@keboola/tailwind-config 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @keboola/tailwind-config
2
+
3
+ Shared Tailwind CSS v3 configuration for the Keboola UI platform —
4
+ the same semantic color palette, plugins, and `tw-` class prefix that
5
+ [`@keboola/design`](https://github.com/keboola/ui/tree/main/packages/design)
6
+ is built on.
7
+
8
+ Use this when you want your Tailwind-styled app to inherit the platform's
9
+ visual primitives — most relevant for audiences B (Keboola-branded external
10
+ builders) and audience A (internal monorepo work). Audience C (customer-
11
+ branded) typically supplies its own tokens; this package is optional then.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install -D @keboola/tailwind-config tailwindcss@^3
17
+ # or
18
+ yarn add -D @keboola/tailwind-config tailwindcss@^3
19
+ ```
20
+
21
+ ## Use
22
+
23
+ Extend or reuse the config from your own `tailwind.config.{js,ts}`:
24
+
25
+ ```js
26
+ import keboolaConfig from '@keboola/tailwind-config';
27
+
28
+ /** @type {import('tailwindcss').Config} */
29
+ export default {
30
+ ...keboolaConfig,
31
+ content: ['./src/**/*.{ts,tsx,mdx}'],
32
+ };
33
+ ```
34
+
35
+ ### Subpath imports
36
+
37
+ If you only need the raw token data:
38
+
39
+ ```ts
40
+ import colors from '@keboola/tailwind-config/colors';
41
+ import typography from '@keboola/tailwind-config/typography';
42
+ ```
43
+
44
+ > **Heads up — `colors` and `typography` are shipped as `.ts` source.**
45
+ > Resolution works when the consumer is **Tailwind v3.3+** (uses
46
+ > [jiti](https://github.com/unjs/jiti) under the hood for config loading)
47
+ > or any bundler that's TypeScript-aware (Vite, esbuild, swc, tsx, ts-node
48
+ > via `--loader`). Plain Node ESM **cannot** load these files without a TS
49
+ > loader. A pre-compiled `.js` variant is planned — track or open an issue
50
+ > if your toolchain hits this.
51
+
52
+ ## Layout
53
+
54
+ - `index.js` — the config entry; consumed via `import` (ESM).
55
+ - `colors.ts` — semantic palette (`primary`, `background`, `foreground`,
56
+ `muted`, `border`, `destructive`, etc.) wired to the CSS variables
57
+ shipped by `@keboola/design`.
58
+ - `typography.ts` — typography scale (used by the `@tailwindcss/typography`
59
+ plugin).
60
+
61
+ ## Tailwind v4
62
+
63
+ Tailwind v4 migration is tracked in
64
+ [UT-3997](https://linear.app/keboola/issue/UT-3997). For now this package
65
+ ships a v3-shaped config; the v4 migration moves tokens to CSS `@theme`.
66
+
67
+ ## License
68
+
69
+ MIT
package/colors.ts ADDED
@@ -0,0 +1,176 @@
1
+ export default {
2
+ inherit: 'inherit',
3
+ transparent: 'rgba(255,255,255,0)',
4
+ white: '#fff',
5
+ black: '#000',
6
+ prose: {
7
+ code: '#c7254e',
8
+ preCode: '#33373d',
9
+ preCodeBg: '#f5f5f5',
10
+ },
11
+
12
+ // Main application colors — channel values live in CSS variables (see packages/design/src/styles.css :root).
13
+ // The `<alpha-value>` placeholder lets Tailwind apply opacity modifiers like `tw-bg-muted/50`.
14
+ background: 'rgb(var(--color-background) / <alpha-value>)',
15
+ foreground: 'rgb(var(--color-foreground) / <alpha-value>)',
16
+
17
+ popover: {
18
+ DEFAULT: 'rgb(var(--color-popover) / <alpha-value>)',
19
+ foreground: 'rgb(var(--color-popover-foreground) / <alpha-value>)',
20
+ },
21
+
22
+ // Highlight color for active or focused elements
23
+ accent: {
24
+ DEFAULT: 'rgb(var(--color-accent) / <alpha-value>)',
25
+ foreground: 'rgb(var(--color-accent-foreground) / <alpha-value>)',
26
+ },
27
+
28
+ border: 'rgb(var(--color-border) / <alpha-value>)',
29
+
30
+ input: {
31
+ DEFAULT: 'rgb(var(--color-input) / <alpha-value>)',
32
+ },
33
+
34
+ destructive: {
35
+ DEFAULT: 'rgb(var(--color-destructive) / <alpha-value>)',
36
+ foreground: 'rgb(var(--color-destructive-foreground) / <alpha-value>)',
37
+ },
38
+ success: {
39
+ DEFAULT: 'rgb(var(--color-success) / <alpha-value>)',
40
+ },
41
+
42
+ muted: {
43
+ DEFAULT: 'rgb(var(--color-muted) / <alpha-value>)',
44
+ foreground: 'rgb(var(--color-muted-foreground) / <alpha-value>)',
45
+ },
46
+
47
+ // Sidebar semantic colors
48
+ sidebar: {
49
+ DEFAULT: 'rgb(var(--color-sidebar) / <alpha-value>)',
50
+ foreground: 'rgb(var(--color-sidebar-foreground) / <alpha-value>)',
51
+ primary: 'rgb(var(--color-sidebar-primary) / <alpha-value>)',
52
+ 'primary-foreground': 'rgb(var(--color-sidebar-primary-foreground) / <alpha-value>)',
53
+ accent: 'rgb(var(--color-sidebar-accent) / <alpha-value>)',
54
+ 'accent-foreground': 'rgb(var(--color-sidebar-accent-foreground) / <alpha-value>)',
55
+ border: 'rgb(var(--color-sidebar-border) / <alpha-value>)',
56
+ ring: 'rgb(var(--color-sidebar-ring) / <alpha-value>)',
57
+ },
58
+ neutral: {
59
+ 50: '#f2f4f7',
60
+ 100: '#edf0f5',
61
+ 150: '#d9dde5',
62
+ 200: '#c5cbd6',
63
+ 300: '#a2aab8',
64
+ 400: '#7c8594',
65
+ 500: '#565c66',
66
+ 600: '#454952',
67
+ 700: '#33373d',
68
+ 800: '#222529',
69
+ 900: '#101114',
70
+ },
71
+ primary: {
72
+ DEFAULT: '#1F8FFF',
73
+ foreground: '#FFFFFF',
74
+ 100: '#e0ffe0',
75
+ 200: '#baf5ba',
76
+ 300: '#93f593',
77
+ 400: '#51e051',
78
+ 500: '#1ec71e',
79
+ 600: '#1bb31b',
80
+ 700: '#189f18',
81
+ 800: '#158b15',
82
+ 900: '#0f630f',
83
+ },
84
+ secondary: {
85
+ DEFAULT: '#E2E8F0',
86
+ foreground: '#1E293B',
87
+ 100: '#e0f0ff',
88
+ 200: '#c2e0ff',
89
+ 300: '#99ccff',
90
+ 400: '#5cadff',
91
+ 500: '#1f8fff',
92
+ 600: '#0975e0',
93
+ 700: '#075fb8',
94
+ 800: '#064a8f',
95
+ 900: '#043566',
96
+ },
97
+ error: {
98
+ 100: '#ffe0e6',
99
+ 200: '#ffc2cc',
100
+ 300: '#ff99aa',
101
+ 400: '#ff5c77',
102
+ 500: '#e00025',
103
+ 550: '#c40021',
104
+ 600: '#b8001f',
105
+ 700: '#a3001b',
106
+ 800: '#7a0014',
107
+ 900: '#52000e',
108
+ },
109
+ warning: {
110
+ 100: '#fff3e0',
111
+ 200: '#ffe7c2',
112
+ 300: '#ffd699',
113
+ 400: '#ffbe5c',
114
+ 500: '#f59300',
115
+ 550: '#e38800',
116
+ 600: '#d17d00',
117
+ 700: '#a36200',
118
+ 800: '#7a4900',
119
+ 900: '#523100',
120
+ },
121
+ purple: {
122
+ 100: '#ebe0ff',
123
+ 200: '#d6c2ff',
124
+ 300: '#c9adff',
125
+ 400: '#ad85ff',
126
+ 500: '#925cff',
127
+ 600: '#6f36e0',
128
+ 700: '#5b2cb8',
129
+ 800: '#46228f',
130
+ 900: '#321866',
131
+ },
132
+ cyan: {
133
+ 100: '#e0f9ff',
134
+ 200: '#bef3ff',
135
+ 300: '#83ebff',
136
+ 400: '#00def7',
137
+ 500: '#00bbd1',
138
+ 600: '#00a0b2',
139
+ 700: '#007d8c',
140
+ 800: '#005d69',
141
+ 900: '#003f47',
142
+ },
143
+ teal: {
144
+ 100: '#cfffe6',
145
+ 200: '#96ffce',
146
+ 300: '#00faaf',
147
+ 400: '#00e6a1',
148
+ 500: '#00c287',
149
+ 600: '#00a673',
150
+ 700: '#008159',
151
+ 800: '#006141',
152
+ 900: '#00422b',
153
+ },
154
+ yellow: {
155
+ 100: '#FFFFCC',
156
+ 200: '#FFFF99',
157
+ 300: '#FFFF33',
158
+ 400: '#F5F500',
159
+ 500: '#E5E500',
160
+ 600: '#CCCC00',
161
+ 700: '#B2B200',
162
+ 800: '#999900',
163
+ 900: '#808000',
164
+ },
165
+ pink: {
166
+ 100: '#FDE8FB',
167
+ 200: '#FAD1F6',
168
+ 300: '#F7BBF2',
169
+ 400: '#F28CE8',
170
+ 500: '#ED5EDF',
171
+ 600: '#E619D1',
172
+ 700: '#B814A7',
173
+ 800: '#8A0F7D',
174
+ 900: '#5C0A54',
175
+ },
176
+ };
package/index.js ADDED
@@ -0,0 +1,164 @@
1
+ import plugin from 'tailwindcss/plugin';
2
+ import colors from './colors';
3
+ import animatePlugin from 'tailwindcss-animate';
4
+ import { scopedPreflightStyles, isolateInsideOfContainer } from 'tailwindcss-scoped-preflight';
5
+ import typographyPlugin from '@tailwindcss/typography';
6
+ import containerQueriesPlugin from '@tailwindcss/container-queries';
7
+ import { typography } from './typography';
8
+
9
+ /** @type {import('tailwindcss').Config} */
10
+ export default {
11
+ prefix: 'tw-',
12
+ content: ['./src/**/*.{js,jsx,ts,tsx,mdx}', '../../packages/design/src/**/*.{ts,tsx}'],
13
+ corePlugins: {
14
+ preflight: false,
15
+ },
16
+ theme: {
17
+ extend: {
18
+ fill: {
19
+ aigradient: {
20
+ 600: 'url(#aigradient-600)',
21
+ 700: 'url(#aigradient-700)',
22
+ },
23
+ },
24
+ screens: {
25
+ 'sm-legacy': '992px',
26
+ 'md-legacy': '1092px',
27
+ },
28
+ animation: {
29
+ fade: 'fadeIn 100ms 100ms ease-in-out',
30
+ collapseDown: 'collapseDown 300ms both',
31
+ 'dot-pulse-1': 'dot-pulse 1.5s infinite',
32
+ 'dot-pulse-2': 'dot-pulse 1.5s infinite 0.2s',
33
+ 'dot-pulse-3': 'dot-pulse 1.5s infinite 0.4s',
34
+ 'toast-progress': 'toast-progress 5s linear forwards',
35
+ 'collapsible-down': 'collapsible-down 0.2s ease-out',
36
+ 'collapsible-up': 'collapsible-up 0.2s ease-out',
37
+ 'marching-ants': 'marching-ants 1s linear infinite',
38
+ 'spinner-dots': 'spinner-dots 1s ease-in-out infinite',
39
+ 'progress-bar': 'progress-bar var(--progress-bar-duration, 3s) linear forwards',
40
+ },
41
+ keyframes: {
42
+ shimmer: {
43
+ '100%': {
44
+ transform: 'translateX(100%)',
45
+ },
46
+ },
47
+ collapseDown: {
48
+ from: { overflow: 'hidden' },
49
+ '99%': { overflow: 'hidden' },
50
+ to: { overflow: 'visible' },
51
+ },
52
+ fadeIn: {
53
+ from: { opacity: 0 },
54
+ to: { opacity: 1 },
55
+ },
56
+ 'dot-pulse': {
57
+ '0%, 100%': {
58
+ transform: 'scale(0.1)',
59
+ opacity: '0.1',
60
+ },
61
+ '40%': {
62
+ transform: 'scale(1)',
63
+ opacity: '1',
64
+ },
65
+ },
66
+ 'toast-progress': {
67
+ '0%': {
68
+ width: '100%',
69
+ },
70
+ '100%': {
71
+ width: '0%',
72
+ },
73
+ },
74
+ 'collapsible-down': {
75
+ from: { height: '0', overflow: 'hidden' },
76
+ to: { height: 'var(--radix-collapsible-content-height)', overflow: 'visible' },
77
+ },
78
+ 'collapsible-up': {
79
+ from: { height: 'var(--radix-collapsible-content-height)', overflow: 'visible' },
80
+ to: { height: '0', overflow: 'hidden' },
81
+ },
82
+ 'marching-ants': {
83
+ to: { strokeDashoffset: '-12' },
84
+ },
85
+ 'spinner-dots': {
86
+ '0%, 100%': { opacity: '0' },
87
+ '12.5%': { opacity: '1' },
88
+ '25%': { opacity: '0' },
89
+ },
90
+ 'progress-bar': {
91
+ from: { width: '0%' },
92
+ to: { width: '100%' },
93
+ },
94
+ },
95
+ backgroundImage: {
96
+ 'loader-gradient': 'radial-gradient(circle closest-side,#000 90%,#0000)',
97
+ },
98
+ ringWidth: {
99
+ 3: '3px',
100
+ },
101
+ boxShadow: {
102
+ outline: '0 0 0 3px rgba(34, 141, 255, 0.25)',
103
+ table: '0px 6px 6px -4px rgba(100, 135, 153, 0.13)',
104
+ card: '0px 1px 4px rgba(100, 135, 153, 0.15)',
105
+ },
106
+ borderRadius: {
107
+ card: '10px',
108
+ },
109
+ typography: typography,
110
+ colors,
111
+ },
112
+ fontFamily: {
113
+ mono: [
114
+ 'SFMono-Regular',
115
+ 'Menlo',
116
+ 'Monaco',
117
+ 'Consolas',
118
+ 'Liberation Mono',
119
+ 'Courier New',
120
+ 'monospace',
121
+ ],
122
+ sans: [
123
+ 'Inter',
124
+ 'system-ui',
125
+ '-apple-system',
126
+ 'Segoe UI',
127
+ 'Roboto',
128
+ 'Helvetica Neue',
129
+ 'Arial',
130
+ 'Noto Sans',
131
+ 'Liberation Sans',
132
+ 'sans-serif',
133
+ 'Apple Color Emoji',
134
+ 'Segoe UI Emoji',
135
+ 'Segoe UI Symbol',
136
+ 'Noto Color Emoji',
137
+ ],
138
+ },
139
+ fontWeight: {
140
+ normal: '400',
141
+ medium: '500',
142
+ semibold: '600',
143
+ bold: '700',
144
+ },
145
+ },
146
+ plugins: [
147
+ animatePlugin,
148
+ scopedPreflightStyles({
149
+ isolationStrategy: isolateInsideOfContainer('.tailwindcss-preflight'),
150
+ }),
151
+ typographyPlugin,
152
+ containerQueriesPlugin,
153
+ plugin(function ({ addVariant, addUtilities }) {
154
+ addVariant('hover|focus', ['&:enabled:hover', '&:enabled:focus']);
155
+ addVariant('active|focus', ['&:enabled:active', '&:enabled:focus', '&:enabled:focus-within']);
156
+ addVariant('not-disabled', ['&:not([data-disabled="true"]):not(:disabled)']);
157
+ addUtilities({
158
+ '.break-anywhere': {
159
+ overflowWrap: 'anywhere',
160
+ },
161
+ });
162
+ }),
163
+ ],
164
+ };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@keboola/tailwind-config",
3
+ "version": "0.1.1",
4
+ "description": "Shared Tailwind CSS v3 config for the Keboola UI platform — semantic color palette, plugins, and the `tw-` class prefix.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./index.js",
8
+ "exports": {
9
+ ".": "./index.js",
10
+ "./colors": "./colors.ts",
11
+ "./typography": "./typography.ts"
12
+ },
13
+ "files": [
14
+ "index.js",
15
+ "colors.ts",
16
+ "typography.ts",
17
+ "README.md"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "sideEffects": false,
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/keboola/ui.git",
26
+ "directory": "packages/tailwind-config"
27
+ },
28
+ "homepage": "https://github.com/keboola/ui/tree/main/packages/tailwind-config#readme",
29
+ "bugs": {
30
+ "url": "https://github.com/keboola/ui/issues"
31
+ },
32
+ "keywords": [
33
+ "keboola",
34
+ "tailwind",
35
+ "tailwindcss",
36
+ "config",
37
+ "design-tokens"
38
+ ],
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "scripts": {
43
+ "knip:check": "yarn --cwd ../.. exec knip --workspace packages/tailwind-config",
44
+ "knip:fix": "yarn --cwd ../.. exec knip --workspace packages/tailwind-config --fix-type types,exports,files"
45
+ },
46
+ "peerDependencies": {
47
+ "tailwindcss": "^3.4.0"
48
+ },
49
+ "dependencies": {
50
+ "@tailwindcss/container-queries": "^0.1.1",
51
+ "@tailwindcss/typography": "^0.5.19",
52
+ "tailwindcss-animate": "1.0.7",
53
+ "tailwindcss-scoped-preflight": "3.5.2"
54
+ }
55
+ }
package/typography.ts ADDED
@@ -0,0 +1,120 @@
1
+ import colors from './colors';
2
+
3
+ export const typography = {
4
+ invert: {
5
+ css: {
6
+ 'h1, h2, h3, h4, h5, h6': {
7
+ color: 'inherit',
8
+ },
9
+ 'blockquote code': {
10
+ color: 'var(--tw-prose-code)',
11
+ },
12
+ 'pre code': {
13
+ color: 'var(--tw-prose-code)',
14
+ },
15
+ },
16
+ },
17
+ DEFAULT: {
18
+ css: {
19
+ '--tw-prose-code': colors.prose.code,
20
+ '--tw-prose-pre-code': colors.prose.preCode,
21
+ '--tw-prose-pre-bg': colors.prose.preCodeBg,
22
+ '--tw-prose-invert-body': colors.white,
23
+ '--tw-prose-invert-code': colors.prose.code,
24
+ '--tw-prose-invert-pre-code': colors.prose.preCode,
25
+ '--tw-prose-invert-pre-bg': colors.prose.preCodeBg,
26
+ '--tw-prose-invert-quote-borders': 'var(--tw-prose-quotes)',
27
+ '--tw-prose-invert-bullets': colors.white,
28
+ maxWidth: 'none',
29
+ fontSize: '14px',
30
+ lineHeight: '1.42857143',
31
+ h1: {
32
+ fontSize: '32px',
33
+ lineHeight: '40px',
34
+ fontWeight: '500',
35
+ marginTop: 0,
36
+ marginBottom: '10px',
37
+ },
38
+ 'h1:first-child': {
39
+ marginTop: '10px',
40
+ },
41
+ h2: {
42
+ fontSize: '24px',
43
+ lineHeight: '32px',
44
+ fontWeight: '500',
45
+ color: colors.neutral[900],
46
+ marginTop: 0,
47
+ marginBottom: '10px',
48
+ },
49
+ 'h2:first-child': {
50
+ marginTop: '10px',
51
+ },
52
+ h3: {
53
+ fontSize: '16px',
54
+ lineHeight: '24px',
55
+ fontWeight: '500',
56
+ color: colors.neutral[900],
57
+ margin: 0,
58
+ },
59
+ h4: {
60
+ fontSize: '14px',
61
+ lineHeight: '20px',
62
+ fontWeight: '500',
63
+ color: colors.neutral[900],
64
+ margin: 0,
65
+ },
66
+ h5: {
67
+ fontSize: '12px',
68
+ lineHeight: '20px',
69
+ fontWeight: '500',
70
+ color: colors.neutral[900],
71
+ margin: 0,
72
+ },
73
+ 'h1 small, h2 small, h3 small, h4 small, h5 small, h6 small': {
74
+ color: colors.neutral[400],
75
+ fontSize: '75%',
76
+ },
77
+ p: {
78
+ marginTop: 0,
79
+ marginBottom: '10px',
80
+ lineHeight: '1.42857143',
81
+ },
82
+ 'p:last-child': {
83
+ marginBottom: 0,
84
+ },
85
+ 'ul, ol': {
86
+ listStyle: 'initial',
87
+ marginTop: 0,
88
+ marginBottom: '10px',
89
+ paddingLeft: '24px',
90
+ lineHeight: '1.42857143',
91
+ },
92
+ li: {
93
+ margin: 0,
94
+ },
95
+ table: {
96
+ fontSize: 'initial',
97
+ lineHeight: 'initial',
98
+ marginTop: 0,
99
+ },
100
+ hr: {
101
+ marginTop: '18px',
102
+ marginBottom: '18px',
103
+ },
104
+ img: {
105
+ margin: 0,
106
+ },
107
+ code: {
108
+ fontSize: 'inherit',
109
+ lineHeight: 'inherit',
110
+ // Remove backticks around inline code
111
+ '&::before': { display: 'none' },
112
+ '&::after': { display: 'none' },
113
+ },
114
+ pre: {
115
+ fontSize: 'inherit',
116
+ lineHeight: 'inherit',
117
+ },
118
+ },
119
+ },
120
+ };