@dynostack/react-grid 0.4.0 → 0.5.0

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/dist/styles.css CHANGED
@@ -1,228 +1,274 @@
1
- /*
2
- * Default theme tokens for @dynostack/react-grid.
3
- *
4
- * Drop-in behavior:
5
- *
6
- * import "@dynostack/react-grid/styles.css"
7
- *
8
- * What you get with this single import:
9
- *
10
- * • Clean light tokens by default.
11
- * • Automatic dark-mode follow: switches when the OS reports
12
- * `prefers-color-scheme: dark`.
13
- * • Manual override: add the `.dark` (or `.light`) class to <html> or any
14
- * ancestor and the table flips immediately, ignoring OS preference.
15
- * • shadcn-compatible: token names match shadcn/ui's CSS variables exactly,
16
- * so if you already have shadcn (or any compatible theme) defined on
17
- * :root, *that* takes precedence and the grid blends in automatically.
18
- * • Tailwind v4 utility classes (`bg-popover`, `text-foreground`, etc.)
19
- * resolve automatically — see the @theme block below.
20
- *
21
- * Cascade design
22
- * --------------
23
- * All variable values live inside the `dynostack-grid-defaults` cascade
24
- * layer. Any *unlayered* declaration in the consumer app (which is where
25
- * shadcn and most app CSS lives) automatically wins, regardless of import
26
- * order. This makes import order non-fragile — you cannot accidentally
27
- * overwrite the consumer's theme by importing this file in the "wrong" spot.
28
- *
29
- * <highest priority>
30
- * inline style on the grid root (per-instance `theme` prop)
31
- * consumer's unlayered :root rules (shadcn, custom app theme)
32
- * this file (@layer dynostack-grid-defaults)
33
- * <lowest priority>
34
- */
35
-
36
- /* ─── Tailwind v4 token registration ──────────────────────────────────
37
- * Tells Tailwind v4 to generate `bg-popover`, `text-foreground`,
38
- * `border-border`, `rounded-lg`, etc. utility classes that resolve to our
39
- * CSS variables. Without this, the bundled `className` strings inside the
40
- * grid have no corresponding CSS rules in zero-config v4 projects, and
41
- * overlays render with transparent backgrounds.
42
- *
43
- * Must be declared at the top level — Tailwind v4 processes `@theme`
44
- * before cascade layers apply, and `@theme` inside `@layer` is not valid.
45
- *
46
- * Safe across stacks:
47
- * • Tailwind v4 → consumed normally, utilities generated.
48
- * • Tailwind v3 → unknown at-rule, silently ignored. (v3 users still
49
- * need to map semantic colors in tailwind.config.js;
50
- * see README → Tailwind setup.)
51
- * • Non-Tailwind → unknown at-rule, ignored.
52
- * • shadcn consumer with their own @theme block → declarations merge.
53
- * Since we use the same shadcn token names, the values are identical
54
- * and there is no conflict.
55
- * ─────────────────────────────────────────────────────────────────────── */
56
- @theme inline {
57
- --color-background: var(--background);
58
- --color-foreground: var(--foreground);
59
- --color-card: var(--card);
60
- --color-card-foreground: var(--card-foreground);
61
- --color-popover: var(--popover);
62
- --color-popover-foreground: var(--popover-foreground);
63
- --color-primary: var(--primary);
64
- --color-primary-foreground: var(--primary-foreground);
65
- --color-secondary: var(--secondary);
66
- --color-secondary-foreground: var(--secondary-foreground);
67
- --color-muted: var(--muted);
68
- --color-muted-foreground: var(--muted-foreground);
69
- --color-accent: var(--accent);
70
- --color-accent-foreground: var(--accent-foreground);
71
- --color-destructive: var(--destructive);
72
- --color-destructive-foreground: var(--destructive-foreground);
73
- --color-border: var(--border);
74
- --color-input: var(--input);
75
- --color-ring: var(--ring);
76
-
77
- --radius-sm: calc(var(--radius) * 0.6);
78
- --radius-md: calc(var(--radius) * 0.8);
79
- --radius-lg: var(--radius);
80
- --radius-xl: calc(var(--radius) * 1.4);
81
- --radius-2xl: calc(var(--radius) * 1.8);
82
- }
83
-
84
- /* Tailwind v4 borders default to currentColor. Keep the default scoped to
85
- * grid surfaces; utility and consumer border colors still take precedence. */
86
- @layer base {
87
- [data-dyno-grid], [data-dyno-grid] * {
88
- border-color: var(--border);
89
- }
90
- }
91
-
92
- @layer dynostack-grid-defaults {
93
- :root {
94
- color-scheme: light;
95
-
96
- --radius: 0.625rem;
97
-
98
- --background: oklch(1 0 0);
99
- --foreground: oklch(0.145 0 0);
100
-
101
- --card: oklch(1 0 0);
102
- --card-foreground: oklch(0.145 0 0);
103
-
104
- --popover: oklch(1 0 0);
105
- --popover-foreground: oklch(0.145 0 0);
106
-
107
- --primary: oklch(0.205 0 0);
108
- --primary-foreground: oklch(0.985 0 0);
109
-
110
- --secondary: oklch(0.97 0 0);
111
- --secondary-foreground: oklch(0.205 0 0);
112
-
113
- --muted: oklch(0.97 0 0);
114
- --muted-foreground: oklch(0.556 0 0);
115
-
116
- --accent: oklch(0.97 0 0);
117
- --accent-foreground: oklch(0.205 0 0);
118
-
119
- --destructive: oklch(0.577 0.245 27.325);
120
- --destructive-foreground: oklch(0.985 0 0);
121
-
122
- --border: oklch(0.922 0 0);
123
- --input: oklch(0.922 0 0);
124
- --ring: oklch(0.708 0 0);
125
- }
126
-
127
- /* Auto-follow OS dark mode. */
128
- @media (prefers-color-scheme: dark) {
129
- :root {
130
- color-scheme: dark;
131
-
132
- --background: oklch(0.145 0 0);
133
- --foreground: oklch(0.985 0 0);
134
-
135
- --card: oklch(0.205 0 0);
136
- --card-foreground: oklch(0.985 0 0);
137
-
138
- --popover: oklch(0.205 0 0);
139
- --popover-foreground: oklch(0.985 0 0);
140
-
141
- --primary: oklch(0.985 0 0);
142
- --primary-foreground: oklch(0.205 0 0);
143
-
144
- --secondary: oklch(0.269 0 0);
145
- --secondary-foreground: oklch(0.985 0 0);
146
-
147
- --muted: oklch(0.269 0 0);
148
- --muted-foreground: oklch(0.708 0 0);
149
-
150
- --accent: oklch(0.269 0 0);
151
- --accent-foreground: oklch(0.985 0 0);
152
-
153
- --destructive: oklch(0.577 0.245 27.325 / 0.6);
154
- --destructive-foreground: oklch(0.985 0 0);
155
-
156
- --border: oklch(0.269 0 0);
157
- --input: oklch(0.269 0 0);
158
- --ring: oklch(0.439 0 0);
159
- }
160
- }
161
-
162
- /* Manual override — wins over the media query above. */
163
- :root.light,
164
- .light {
165
- color-scheme: light;
166
-
167
- --background: oklch(1 0 0);
168
- --foreground: oklch(0.145 0 0);
169
-
170
- --card: oklch(1 0 0);
171
- --card-foreground: oklch(0.145 0 0);
172
-
173
- --popover: oklch(1 0 0);
174
- --popover-foreground: oklch(0.145 0 0);
175
-
176
- --primary: oklch(0.205 0 0);
177
- --primary-foreground: oklch(0.985 0 0);
178
-
179
- --secondary: oklch(0.97 0 0);
180
- --secondary-foreground: oklch(0.205 0 0);
181
-
182
- --muted: oklch(0.97 0 0);
183
- --muted-foreground: oklch(0.556 0 0);
184
-
185
- --accent: oklch(0.97 0 0);
186
- --accent-foreground: oklch(0.205 0 0);
187
-
188
- --destructive: oklch(0.577 0.245 27.325);
189
- --destructive-foreground: oklch(0.985 0 0);
190
-
191
- --border: oklch(0.922 0 0);
192
- --input: oklch(0.922 0 0);
193
- --ring: oklch(0.708 0 0);
194
- }
195
-
196
- :root.dark,
197
- .dark {
198
- color-scheme: dark;
199
-
200
- --background: oklch(0.145 0 0);
201
- --foreground: oklch(0.985 0 0);
202
-
203
- --card: oklch(0.205 0 0);
204
- --card-foreground: oklch(0.985 0 0);
205
-
206
- --popover: oklch(0.205 0 0);
207
- --popover-foreground: oklch(0.985 0 0);
208
-
209
- --primary: oklch(0.985 0 0);
210
- --primary-foreground: oklch(0.205 0 0);
211
-
212
- --secondary: oklch(0.269 0 0);
213
- --secondary-foreground: oklch(0.985 0 0);
214
-
215
- --muted: oklch(0.269 0 0);
216
- --muted-foreground: oklch(0.708 0 0);
217
-
218
- --accent: oklch(0.269 0 0);
219
- --accent-foreground: oklch(0.985 0 0);
220
-
221
- --destructive: oklch(0.577 0.245 27.325 / 0.6);
222
- --destructive-foreground: oklch(0.985 0 0);
223
-
224
- --border: oklch(0.269 0 0);
225
- --input: oklch(0.269 0 0);
226
- --ring: oklch(0.439 0 0);
227
- }
228
- }
1
+ /*
2
+ * Default theme tokens for @dynostack/react-grid.
3
+ *
4
+ * Drop-in behavior:
5
+ *
6
+ * import "@dynostack/react-grid/styles.css"
7
+ *
8
+ * What you get with this single import:
9
+ *
10
+ * • Clean light tokens by default.
11
+ * • Automatic dark-mode follow: switches when the OS reports
12
+ * `prefers-color-scheme: dark`.
13
+ * • Manual override: add the `.dark` (or `.light`) class to <html> or any
14
+ * ancestor and the table flips immediately, ignoring OS preference.
15
+ * • shadcn-compatible: token names match shadcn/ui's CSS variables exactly,
16
+ * so if you already have shadcn (or any compatible theme) defined on
17
+ * :root, *that* takes precedence and the grid blends in automatically.
18
+ * • Tailwind v4 utility classes (`bg-popover`, `text-foreground`, etc.)
19
+ * resolve automatically — see the @theme block below.
20
+ *
21
+ * Cascade design
22
+ * --------------
23
+ * All variable values live inside the `dynostack-grid-defaults` cascade
24
+ * layer. Any *unlayered* declaration in the consumer app (which is where
25
+ * shadcn and most app CSS lives) automatically wins, regardless of import
26
+ * order. This makes import order non-fragile — you cannot accidentally
27
+ * overwrite the consumer's theme by importing this file in the "wrong" spot.
28
+ *
29
+ * <highest priority>
30
+ * inline style on the grid root (per-instance `theme` prop)
31
+ * consumer's unlayered :root rules (shadcn, custom app theme)
32
+ * this file (@layer dynostack-grid-defaults)
33
+ * <lowest priority>
34
+ */
35
+
36
+ /* ─── Tailwind v4 token registration ──────────────────────────────────
37
+ * Tells Tailwind v4 to generate `bg-popover`, `text-foreground`,
38
+ * `border-border`, `rounded-lg`, etc. utility classes that resolve to our
39
+ * CSS variables. Without this, the bundled `className` strings inside the
40
+ * grid have no corresponding CSS rules in zero-config v4 projects, and
41
+ * overlays render with transparent backgrounds.
42
+ *
43
+ * Must be declared at the top level — Tailwind v4 processes `@theme`
44
+ * before cascade layers apply, and `@theme` inside `@layer` is not valid.
45
+ *
46
+ * Safe across stacks:
47
+ * • Tailwind v4 → consumed normally, utilities generated.
48
+ * • Tailwind v3 → unknown at-rule, silently ignored. (v3 users still
49
+ * need to map semantic colors in tailwind.config.js;
50
+ * see README → Tailwind setup.)
51
+ * • Non-Tailwind → unknown at-rule, ignored.
52
+ * • shadcn consumer with their own @theme block → declarations merge.
53
+ * Since we use the same shadcn token names, the values are identical
54
+ * and there is no conflict.
55
+ * ─────────────────────────────────────────────────────────────────────── */
56
+ @theme inline {
57
+ --color-background: var(--background);
58
+ --color-foreground: var(--foreground);
59
+ --color-card: var(--card);
60
+ --color-card-foreground: var(--card-foreground);
61
+ --color-popover: var(--popover);
62
+ --color-popover-foreground: var(--popover-foreground);
63
+ --color-primary: var(--primary);
64
+ --color-primary-foreground: var(--primary-foreground);
65
+ --color-secondary: var(--secondary);
66
+ --color-secondary-foreground: var(--secondary-foreground);
67
+ --color-muted: var(--muted);
68
+ --color-muted-foreground: var(--muted-foreground);
69
+ --color-accent: var(--accent);
70
+ --color-accent-foreground: var(--accent-foreground);
71
+ --color-destructive: var(--destructive);
72
+ --color-destructive-foreground: var(--destructive-foreground);
73
+ --color-border: var(--border);
74
+ --color-input: var(--input);
75
+ --color-ring: var(--ring);
76
+
77
+ --radius-sm: calc(var(--radius) * 0.6);
78
+ --radius-md: calc(var(--radius) * 0.8);
79
+ --radius-lg: var(--radius);
80
+ --radius-xl: calc(var(--radius) * 1.4);
81
+ --radius-2xl: calc(var(--radius) * 1.8);
82
+ }
83
+
84
+ @custom-variant dark (&:where(.dark, .dark *):not(:where([data-dyno-grid].light, [data-dyno-grid].light *)));
85
+
86
+ /* Tailwind v4 borders default to currentColor. Keep the default scoped to
87
+ * grid surfaces; utility and consumer border colors still take precedence. */
88
+ @layer base {
89
+ [data-dyno-grid],
90
+ [data-dyno-grid] * {
91
+ border-color: var(--border);
92
+ }
93
+ }
94
+
95
+ /* Polished surfaces, scoped to the grid so host applications keep their UI. */
96
+ @layer components {
97
+ [data-dyno-grid] {
98
+ box-shadow: none;
99
+ font-family: var(--font-family, inherit);
100
+ font-variant-numeric: tabular-nums;
101
+ }
102
+ [data-dyno-grid] thead {
103
+ background: color-mix(in srgb, var(--muted) 45%, var(--card));
104
+ }
105
+ [data-dyno-grid] th {
106
+ font-weight: 500;
107
+ color: var(--muted-foreground);
108
+ }
109
+ [data-dyno-grid] tbody tr {
110
+ transition: background-color 150ms ease;
111
+ }
112
+ [data-dyno-grid] tbody tr[data-state="selected"] {
113
+ background: color-mix(in srgb, var(--primary) 9%, var(--card));
114
+ }
115
+ [data-dyno-grid] [data-slot="button"] {
116
+ box-shadow: none;
117
+ transition:
118
+ background-color 150ms ease,
119
+ border-color 150ms ease;
120
+ }
121
+ [data-dyno-grid] [data-slot="badge"] {
122
+ border-radius: 4px;
123
+ font-weight: 450;
124
+ }
125
+ [data-dyno-grid] input {
126
+ box-shadow: none;
127
+ }
128
+ @media (prefers-reduced-motion: reduce) {
129
+ [data-dyno-grid] *,
130
+ [data-dyno-grid] *::before,
131
+ [data-dyno-grid] *::after {
132
+ transition: none !important;
133
+ animation: none !important;
134
+ }
135
+ }
136
+ }
137
+
138
+ @layer dynostack-grid-defaults {
139
+ :root {
140
+ color-scheme: light;
141
+
142
+ --radius: 0.375rem;
143
+
144
+ --background: oklch(1 0 0);
145
+ --foreground: oklch(0.145 0 0);
146
+
147
+ --card: oklch(1 0 0);
148
+ --card-foreground: oklch(0.145 0 0);
149
+
150
+ --popover: oklch(1 0 0);
151
+ --popover-foreground: oklch(0.145 0 0);
152
+
153
+ --primary: oklch(0.205 0 0);
154
+ --primary-foreground: oklch(0.985 0 0);
155
+
156
+ --secondary: oklch(0.97 0 0);
157
+ --secondary-foreground: oklch(0.205 0 0);
158
+
159
+ --muted: oklch(0.97 0 0);
160
+ --muted-foreground: oklch(0.556 0 0);
161
+
162
+ --accent: oklch(0.97 0 0);
163
+ --accent-foreground: oklch(0.205 0 0);
164
+
165
+ --destructive: oklch(0.577 0.245 27.325);
166
+ --destructive-foreground: oklch(0.985 0 0);
167
+
168
+ --border: oklch(0.922 0 0);
169
+ --input: oklch(0.922 0 0);
170
+ --ring: oklch(0.708 0 0);
171
+ }
172
+
173
+ /* Auto-follow OS dark mode. */
174
+ @media (prefers-color-scheme: dark) {
175
+ :root {
176
+ color-scheme: dark;
177
+
178
+ --background: oklch(0.145 0 0);
179
+ --foreground: oklch(0.985 0 0);
180
+
181
+ --card: oklch(0.205 0 0);
182
+ --card-foreground: oklch(0.985 0 0);
183
+
184
+ --popover: oklch(0.205 0 0);
185
+ --popover-foreground: oklch(0.985 0 0);
186
+
187
+ --primary: oklch(0.985 0 0);
188
+ --primary-foreground: oklch(0.205 0 0);
189
+
190
+ --secondary: oklch(0.269 0 0);
191
+ --secondary-foreground: oklch(0.985 0 0);
192
+
193
+ --muted: oklch(0.269 0 0);
194
+ --muted-foreground: oklch(0.708 0 0);
195
+
196
+ --accent: oklch(0.269 0 0);
197
+ --accent-foreground: oklch(0.985 0 0);
198
+
199
+ --destructive: oklch(0.577 0.245 27.325 / 0.6);
200
+ --destructive-foreground: oklch(0.985 0 0);
201
+
202
+ --border: oklch(0.269 0 0);
203
+ --input: oklch(0.269 0 0);
204
+ --ring: oklch(0.439 0 0);
205
+ }
206
+ }
207
+
208
+ /* Manual override — wins over the media query above. */
209
+ :root.light,
210
+ .light {
211
+ color-scheme: light;
212
+
213
+ --background: oklch(1 0 0);
214
+ --foreground: oklch(0.145 0 0);
215
+
216
+ --card: oklch(1 0 0);
217
+ --card-foreground: oklch(0.145 0 0);
218
+
219
+ --popover: oklch(1 0 0);
220
+ --popover-foreground: oklch(0.145 0 0);
221
+
222
+ --primary: oklch(0.205 0 0);
223
+ --primary-foreground: oklch(0.985 0 0);
224
+
225
+ --secondary: oklch(0.97 0 0);
226
+ --secondary-foreground: oklch(0.205 0 0);
227
+
228
+ --muted: oklch(0.97 0 0);
229
+ --muted-foreground: oklch(0.556 0 0);
230
+
231
+ --accent: oklch(0.97 0 0);
232
+ --accent-foreground: oklch(0.205 0 0);
233
+
234
+ --destructive: oklch(0.577 0.245 27.325);
235
+ --destructive-foreground: oklch(0.985 0 0);
236
+
237
+ --border: oklch(0.922 0 0);
238
+ --input: oklch(0.922 0 0);
239
+ --ring: oklch(0.708 0 0);
240
+ }
241
+
242
+ :root.dark,
243
+ .dark {
244
+ color-scheme: dark;
245
+
246
+ --background: oklch(0.145 0 0);
247
+ --foreground: oklch(0.985 0 0);
248
+
249
+ --card: oklch(0.205 0 0);
250
+ --card-foreground: oklch(0.985 0 0);
251
+
252
+ --popover: oklch(0.205 0 0);
253
+ --popover-foreground: oklch(0.985 0 0);
254
+
255
+ --primary: oklch(0.985 0 0);
256
+ --primary-foreground: oklch(0.205 0 0);
257
+
258
+ --secondary: oklch(0.269 0 0);
259
+ --secondary-foreground: oklch(0.985 0 0);
260
+
261
+ --muted: oklch(0.269 0 0);
262
+ --muted-foreground: oklch(0.708 0 0);
263
+
264
+ --accent: oklch(0.269 0 0);
265
+ --accent-foreground: oklch(0.985 0 0);
266
+
267
+ --destructive: oklch(0.577 0.245 27.325 / 0.6);
268
+ --destructive-foreground: oklch(0.985 0 0);
269
+
270
+ --border: oklch(0.269 0 0);
271
+ --input: oklch(0.269 0 0);
272
+ --ring: oklch(0.439 0 0);
273
+ }
274
+ }