From dd8deb14ca8dd89cc7c1850f7ee3108156765af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filiph=20Siitam=20Sandstr=C3=B6m?= Date: Tue, 24 Sep 2024 12:32:57 +0200 Subject: [PATCH] Meta: Add tailwind prefix. --- .changeset/sixty-clocks-joke.md | 5 +++ .eslintignore | 5 +++ docs/package.json | 1 + docs/postcss.config.js | 5 ++- docs/tailwind.config.cjs | 23 +++-------- package.json | 4 +- packages/components/accented/src/globals.css | 1 + packages/components/button/src/globals.css | 1 + packages/components/card/src/globals.css | 1 + packages/components/details/src/globals.css | 1 + packages/components/header/src/globals.css | 1 + packages/components/heading/src/globals.css | 1 + packages/components/input/src/globals.css | 1 + packages/components/input/src/input.tsx | 4 +- packages/components/label/src/globals.css | 1 + packages/components/view/src/globals.css | 1 + packages/core/nordstar/src/globals.css | 1 + .../core/system/src/nordstar-provider.tsx | 4 +- plop/component/src/globals.css.hbs | 1 + pnpm-lock.yaml | 38 ++++++++++++++----- tailwind.config.cjs | 5 ++- vite.config.ts | 4 +- 22 files changed, 71 insertions(+), 38 deletions(-) create mode 100644 .changeset/sixty-clocks-joke.md diff --git a/.changeset/sixty-clocks-joke.md b/.changeset/sixty-clocks-joke.md new file mode 100644 index 00000000..a4cc6069 --- /dev/null +++ b/.changeset/sixty-clocks-joke.md @@ -0,0 +1,5 @@ +--- +'@nordcom/nordstar': patch +--- + +- Add tailwind prefix. diff --git a/.eslintignore b/.eslintignore index 4679d161..d305b2ab 100644 --- a/.eslintignore +++ b/.eslintignore @@ -15,3 +15,8 @@ public/ vite.config.ts vitest.config.ts + +postcss.config.cjs +postcss.config.js + +tailwind.config.cjs diff --git a/docs/package.json b/docs/package.json index 3fa60375..eb32f59f 100644 --- a/docs/package.json +++ b/docs/package.json @@ -78,6 +78,7 @@ "eslint-config-next": "14.2.13", "eslint": "8.57.1", "postcss": "8.4.47", + "postcss-import": "16.1.0", "prettier": "3.3.3", "rimraf": "6.0.1", "tailwindcss": "3.4.13", diff --git a/docs/postcss.config.js b/docs/postcss.config.js index badd1005..41cd24e8 100644 --- a/docs/postcss.config.js +++ b/docs/postcss.config.js @@ -1,6 +1,7 @@ export default { plugins: { - tailwindcss: {}, - autoprefixer: {} + 'postcss-import': {}, + 'tailwindcss': {}, + 'autoprefixer': {} } }; diff --git a/docs/tailwind.config.cjs b/docs/tailwind.config.cjs index 86426747..27913682 100644 --- a/docs/tailwind.config.cjs +++ b/docs/tailwind.config.cjs @@ -1,7 +1,11 @@ /** @type {import('tailwindcss').Config} */ module.exports = { darkMode: ['class'], - content: ['./src/**/*.{ts,tsx}'], + content: [ + './src/**/*.{js,ts,jsx,tsx,mdx}', + './node_modules/@nordcom/nordstar/**/*.{js,jsx}', + '../node_modules/@nordcom/nordstar/**/*.{js,jsx}' + ], prefix: '', theme: { container: { @@ -31,9 +35,6 @@ module.exports = { sans: ['var(--font-sans, var(--font-fallback))', 'sans-serif'], mono: ['var(--font-mono)', 'monospace'] }, - fontWeight: { - inherit: 'inherit' - }, colors: { foreground: { DEFAULT: 'hsl(var(--color-foreground))', @@ -64,20 +65,6 @@ module.exports = { }, aspectRatio: { '3/2': '3 / 2' - }, - keyframes: { - 'accordion-down': { - from: { height: '0' }, - to: { height: 'var(--radix-accordion-content-height)' } - }, - 'accordion-up': { - from: { height: 'var(--radix-accordion-content-height)' }, - to: { height: '0' } - } - }, - animation: { - 'accordion-down': 'accordion-down 0.2s ease-out', - 'accordion-up': 'accordion-up 0.2s ease-out' } } }, diff --git a/package.json b/package.json index 7d0ec939..e1038fe8 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "build:packages": "turbo build --filter=!@nordcom/nordstar-docs --filter=!@nordcom/nordstar-storybook", "build:storybook": "turbo build --filter=@nordcom/nordstar-storybook", "typecheck": "turbo typecheck", - "lint": "eslint **/src/**/*.{ts,tsx}", - "prettier": "prettier --check **/src/**/*.{ts,tsx}", + "lint": "eslint --ignore-pattern ./packages \"./**/*.{cjs,mjs,ts,tsx}\"", + "prettier": "prettier --check \"./**/*.{cjs,mjs,ts,tsx,scss,json}\" \"!\\packages/**\"", "fix": "concurrently -i pnpm:fix:*", "fix:docs": "turbo fix --filter=@nordcom/nordstar-docs", "fix:packages": "turbo fix --filter=!@nordcom/nordstar-docs --filter=!@nordcom/nordstar-storybook", diff --git a/packages/components/accented/src/globals.css b/packages/components/accented/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/accented/src/globals.css +++ b/packages/components/accented/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/button/src/globals.css b/packages/components/button/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/button/src/globals.css +++ b/packages/components/button/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/card/src/globals.css b/packages/components/card/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/card/src/globals.css +++ b/packages/components/card/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/details/src/globals.css b/packages/components/details/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/details/src/globals.css +++ b/packages/components/details/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/header/src/globals.css b/packages/components/header/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/header/src/globals.css +++ b/packages/components/header/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/heading/src/globals.css b/packages/components/heading/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/heading/src/globals.css +++ b/packages/components/heading/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/input/src/globals.css b/packages/components/input/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/input/src/globals.css +++ b/packages/components/input/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/input/src/input.tsx b/packages/components/input/src/input.tsx index 2a8467e0..8bb49b68 100644 --- a/packages/components/input/src/input.tsx +++ b/packages/components/input/src/input.tsx @@ -150,7 +150,7 @@ const Input = forwardRef<'input' | 'textarea', InputProps>( 'pointer-events-none select-none text-xs font-extrabold uppercase transition-all [transform:translateZ(0)_translateY(0)]', !placeholder && !contents && - '-mb-2 text-inherit [transform:translateY(.65rem)] group-first-of-type:-mb-0 group-focus-within:translate-y-0 group-focus-within:text-sm' + '-mb-2 text-inherit group-first-of-type:-mb-0 group-focus-within:translate-y-0 group-focus-within:text-sm [transform:translateY(.65rem)]' )} data-full-height={!placeholder && !contents} > @@ -168,7 +168,7 @@ const Input = forwardRef<'input' | 'textarea', InputProps>( ref={ref} className={cn( styles.input, - 'relative h-full w-full appearance-none border-0 bg-transparent p-0 text-sm leading-none outline-0 [font-size:inherit] placeholder:text-foreground-highlight placeholder:transition-opacity placeholder:[font-size:inherit]', + 'relative h-full w-full appearance-none border-0 bg-transparent p-0 text-sm leading-none outline-0 placeholder:text-foreground-highlight placeholder:transition-opacity [font-size:inherit] placeholder:[font-size:inherit]', label && as !== 'textarea' && 'absolute inset-y-0 h-15 pt-3', as === 'textarea' && 'h-full min-h-20 leading-normal' )} diff --git a/packages/components/label/src/globals.css b/packages/components/label/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/label/src/globals.css +++ b/packages/components/label/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/components/view/src/globals.css b/packages/components/view/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/components/view/src/globals.css +++ b/packages/components/view/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/core/nordstar/src/globals.css b/packages/core/nordstar/src/globals.css index 7c05d4dd..b5c61c95 100644 --- a/packages/core/nordstar/src/globals.css +++ b/packages/core/nordstar/src/globals.css @@ -1,2 +1,3 @@ +@tailwind base; @tailwind components; @tailwind utilities; diff --git a/packages/core/system/src/nordstar-provider.tsx b/packages/core/system/src/nordstar-provider.tsx index 013ae6f8..f0127127 100644 --- a/packages/core/system/src/nordstar-provider.tsx +++ b/packages/core/system/src/nordstar-provider.tsx @@ -124,7 +124,9 @@ export const NordstarProvider = ({ theme, children, className, ...props }: Nords return ( <> - +
=18.0.0'} + peerDependencies: + postcss: ^8.0.0 + postcss-js@4.0.1: resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} engines: {node: ^12 || ^14 || >= 16} @@ -8354,7 +8363,7 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vercel/toolbar@0.1.20(next@14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3))(react@18.3.1)(vite@5.4.7(@types/node@22.5.5)(less@4.2.0)(sass@1.79.3)(stylus@0.62.0)(terser@5.33.0))': + '@vercel/toolbar@0.1.20(next@14.2.13(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3))(react@18.3.1)(vite@5.4.7(@types/node@22.5.5)(less@4.2.0)(sass@1.79.3)(stylus@0.62.0)(terser@5.33.0))': dependencies: '@tinyhttp/app': 1.3.0 chokidar: 3.6.0 @@ -8363,7 +8372,7 @@ snapshots: get-port: 5.1.1 strip-ansi: 6.0.1 optionalDependencies: - next: 14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3) + next: 14.2.13(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3) react: 18.3.1 vite: 5.4.7(@types/node@22.5.5)(less@4.2.0)(sass@1.79.3)(stylus@0.62.0)(terser@5.33.0) @@ -10004,9 +10013,9 @@ snapshots: functions-have-names@1.2.3: {} - geist@1.3.1(next@14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3)): + geist@1.3.1(next@14.2.13(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3)): dependencies: - next: 14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3) + next: 14.2.13(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3) gensync@1.0.0-beta.2: {} @@ -11499,7 +11508,7 @@ snapshots: - '@types/react' - supports-color - next@14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3): + next@14.2.13(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.79.3): dependencies: '@next/env': 14.2.13 '@swc/helpers': 0.5.5 @@ -11509,7 +11518,7 @@ snapshots: postcss: 8.4.31 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - styled-jsx: 5.1.1(react@18.3.1) + styled-jsx: 5.1.1(@babel/core@7.25.2)(react@18.3.1) optionalDependencies: '@next/swc-darwin-arm64': 14.2.13 '@next/swc-darwin-x64': 14.2.13 @@ -11886,6 +11895,13 @@ snapshots: read-cache: 1.0.0 resolve: 1.22.8 + postcss-import@16.1.0(postcss@8.4.47): + dependencies: + postcss: 8.4.47 + postcss-value-parser: 4.2.0 + read-cache: 1.0.0 + resolve: 1.22.8 + postcss-js@4.0.1(postcss@8.4.47): dependencies: camelcase-css: 2.0.1 @@ -12828,10 +12844,12 @@ snapshots: dependencies: inline-style-parser: 0.2.4 - styled-jsx@5.1.1(react@18.3.1): + styled-jsx@5.1.1(@babel/core@7.25.2)(react@18.3.1): dependencies: client-only: 0.0.1 react: 18.3.1 + optionalDependencies: + '@babel/core': 7.25.2 stylus@0.62.0: dependencies: diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 177a61e4..51bd11d6 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -2,7 +2,7 @@ module.exports = { darkMode: ['class'], content: ['./{src,.storybook}/**/*.{ts,tsx}'], - prefix: '', + prefix: 'nordstar-', theme: { container: { center: true, @@ -88,5 +88,8 @@ module.exports = { future: { hoverOnlyWhenSupported: true }, + corePlugins: { + preflight: false + }, plugins: [] }; diff --git a/vite.config.ts b/vite.config.ts index ede0ae86..e9af4916 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -58,8 +58,8 @@ export default defineConfig({ root: resolve(__dirname), build: { copyPublicDir: false, - cssCodeSplit: true, - cssMinify: true, + cssCodeSplit: false, + cssMinify: false, emptyOutDir: true, minify: false, outDir: 'dist',