@castui/cast-ui 4.7.0 → 4.9.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/README.md +61 -0
- package/dist/components/Accordion/Accordion.d.ts +80 -0
- package/dist/components/Accordion/Accordion.js +157 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +6 -0
- package/dist/components/AppBar/AppBar.d.ts +47 -0
- package/dist/components/AppBar/AppBar.js +47 -0
- package/dist/components/AppBar/index.d.ts +1 -0
- package/dist/components/AppBar/index.js +5 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +70 -0
- package/dist/components/Autocomplete/Autocomplete.js +249 -0
- package/dist/components/Autocomplete/index.d.ts +1 -0
- package/dist/components/Autocomplete/index.js +5 -0
- package/dist/components/Backdrop/Backdrop.d.ts +32 -0
- package/dist/components/Backdrop/Backdrop.js +74 -0
- package/dist/components/Backdrop/index.d.ts +1 -0
- package/dist/components/Backdrop/index.js +5 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +50 -0
- package/dist/components/BottomSheet/BottomSheet.js +159 -0
- package/dist/components/BottomSheet/index.d.ts +1 -0
- package/dist/components/BottomSheet/index.js +6 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +63 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +143 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.js +6 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +42 -0
- package/dist/components/CodeBlock/CodeBlock.js +110 -0
- package/dist/components/CodeBlock/index.d.ts +1 -0
- package/dist/components/CodeBlock/index.js +5 -0
- package/dist/components/Drawer/Drawer.d.ts +51 -0
- package/dist/components/Drawer/Drawer.js +168 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +6 -0
- package/dist/components/Link/Link.d.ts +51 -0
- package/dist/components/Link/Link.js +73 -0
- package/dist/components/Link/index.d.ts +1 -0
- package/dist/components/Link/index.js +5 -0
- package/dist/components/Menu/Menu.d.ts +91 -0
- package/dist/components/Menu/Menu.js +211 -0
- package/dist/components/Menu/index.d.ts +1 -0
- package/dist/components/Menu/index.js +9 -0
- package/dist/components/Slider/Slider.d.ts +47 -0
- package/dist/components/Slider/Slider.js +132 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +5 -0
- package/dist/components/SpeedDial/SpeedDial.d.ts +72 -0
- package/dist/components/SpeedDial/SpeedDial.js +189 -0
- package/dist/components/SpeedDial/index.d.ts +1 -0
- package/dist/components/SpeedDial/index.js +6 -0
- package/dist/components/Table/Table.d.ts +74 -0
- package/dist/components/Table/Table.js +176 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.js +9 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +69 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.js +158 -0
- package/dist/components/ToggleButtonGroup/index.d.ts +1 -0
- package/dist/components/ToggleButtonGroup/index.js +6 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useBreakpoint.d.ts +22 -0
- package/dist/hooks/useBreakpoint.js +45 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +59 -2
- package/dist/theme/ThemeContext.d.ts +8 -1
- package/dist/theme/ThemeContext.js +7 -4
- package/dist/theme/applyCastTheme.d.ts +75 -0
- package/dist/theme/applyCastTheme.js +95 -0
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.js +3 -1
- package/dist/theme/themes.js +177 -0
- package/dist/theme/types.d.ts +177 -0
- package/dist/tokens/breakpoints.d.ts +57 -0
- package/dist/tokens/breakpoints.js +92 -0
- package/dist/tokens/colors.d.ts +44 -0
- package/dist/tokens/colors.js +47 -1
- package/dist/tokens/index.d.ts +2 -1
- package/dist/tokens/index.js +9 -1
- package/package.json +2 -1
package/dist/theme/themes.js
CHANGED
|
@@ -14,6 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.themes = void 0;
|
|
15
15
|
exports.themes = {
|
|
16
16
|
compact: {
|
|
17
|
+
accordion: {
|
|
18
|
+
small: { gap: 6, paddingX: 8, paddingY: 6 },
|
|
19
|
+
default: { gap: 8, paddingX: 12, paddingY: 8 },
|
|
20
|
+
large: { gap: 8, paddingX: 16, paddingY: 12 },
|
|
21
|
+
},
|
|
17
22
|
dialog: {
|
|
18
23
|
small: { padding: 16, gap: 12, iconSize: 24 },
|
|
19
24
|
default: { padding: 24, gap: 16, iconSize: 32 },
|
|
@@ -123,8 +128,67 @@ exports.themes = {
|
|
|
123
128
|
default: { gap: 6, paddingX: 10, paddingY: 6, indicatorHeight: 2 },
|
|
124
129
|
large: { gap: 8, paddingX: 12, paddingY: 8, indicatorHeight: 4 },
|
|
125
130
|
},
|
|
131
|
+
bottomSheet: {
|
|
132
|
+
borderRadius: 16, handleWidth: 40, handleHeight: 4, handleGap: 8,
|
|
133
|
+
padding: 16, gap: 12,
|
|
134
|
+
},
|
|
135
|
+
link: {
|
|
136
|
+
small: { gap: 2 },
|
|
137
|
+
default: { gap: 4 },
|
|
138
|
+
large: { gap: 4 },
|
|
139
|
+
},
|
|
140
|
+
breadcrumbs: {
|
|
141
|
+
small: { gap: 4 },
|
|
142
|
+
default: { gap: 4 },
|
|
143
|
+
large: { gap: 8 },
|
|
144
|
+
},
|
|
145
|
+
codeBlock: {
|
|
146
|
+
borderRadius: 8,
|
|
147
|
+
small: { padding: 8, gap: 8 },
|
|
148
|
+
default: { padding: 12, gap: 8 },
|
|
149
|
+
large: { padding: 16, gap: 12 },
|
|
150
|
+
},
|
|
151
|
+
drawer: { padding: 16, gap: 12 },
|
|
152
|
+
menu: {
|
|
153
|
+
item: { gap: 8, paddingX: 8, paddingY: 4, borderRadius: 4 },
|
|
154
|
+
content: { paddingY: 2 },
|
|
155
|
+
group: { paddingX: 8, labelPaddingY: 6 },
|
|
156
|
+
separator: { marginY: 4 },
|
|
157
|
+
},
|
|
158
|
+
toggleButtonGroup: {
|
|
159
|
+
borderRadius: 8,
|
|
160
|
+
small: { paddingX: 6, paddingY: 2, gap: 4 },
|
|
161
|
+
default: { paddingX: 10, paddingY: 6, gap: 8 },
|
|
162
|
+
large: { paddingX: 20, paddingY: 14, gap: 16 },
|
|
163
|
+
},
|
|
164
|
+
appBar: {
|
|
165
|
+
small: { paddingX: 12, paddingY: 6, gap: 8 },
|
|
166
|
+
default: { paddingX: 16, paddingY: 8, gap: 8 },
|
|
167
|
+
large: { paddingX: 16, paddingY: 12, gap: 12 },
|
|
168
|
+
},
|
|
169
|
+
slider: {
|
|
170
|
+
borderRadius: 9999,
|
|
171
|
+
small: { trackHeight: 4, thumbSize: 12 },
|
|
172
|
+
default: { trackHeight: 6, thumbSize: 16 },
|
|
173
|
+
large: { trackHeight: 8, thumbSize: 20 },
|
|
174
|
+
},
|
|
175
|
+
speedDial: {
|
|
176
|
+
small: { fabSize: 40, actionSize: 32, gap: 6 },
|
|
177
|
+
default: { fabSize: 48, actionSize: 40, gap: 8 },
|
|
178
|
+
large: { fabSize: 64, actionSize: 48, gap: 12 },
|
|
179
|
+
},
|
|
180
|
+
table: {
|
|
181
|
+
small: { cellPaddingX: 8, cellPaddingY: 4 },
|
|
182
|
+
default: { cellPaddingX: 12, cellPaddingY: 8 },
|
|
183
|
+
large: { cellPaddingX: 16, cellPaddingY: 12 },
|
|
184
|
+
},
|
|
126
185
|
},
|
|
127
186
|
default: {
|
|
187
|
+
accordion: {
|
|
188
|
+
small: { gap: 8, paddingX: 12, paddingY: 8 },
|
|
189
|
+
default: { gap: 8, paddingX: 16, paddingY: 12 },
|
|
190
|
+
large: { gap: 12, paddingX: 20, paddingY: 16 },
|
|
191
|
+
},
|
|
128
192
|
dialog: {
|
|
129
193
|
small: { padding: 24, gap: 16, iconSize: 24 },
|
|
130
194
|
default: { padding: 32, gap: 24, iconSize: 32 },
|
|
@@ -234,8 +298,67 @@ exports.themes = {
|
|
|
234
298
|
default: { gap: 8, paddingX: 12, paddingY: 8, indicatorHeight: 2 },
|
|
235
299
|
large: { gap: 8, paddingX: 16, paddingY: 10, indicatorHeight: 4 },
|
|
236
300
|
},
|
|
301
|
+
bottomSheet: {
|
|
302
|
+
borderRadius: 16, handleWidth: 40, handleHeight: 4, handleGap: 8,
|
|
303
|
+
padding: 24, gap: 16,
|
|
304
|
+
},
|
|
305
|
+
link: {
|
|
306
|
+
small: { gap: 4 },
|
|
307
|
+
default: { gap: 4 },
|
|
308
|
+
large: { gap: 8 },
|
|
309
|
+
},
|
|
310
|
+
breadcrumbs: {
|
|
311
|
+
small: { gap: 4 },
|
|
312
|
+
default: { gap: 8 },
|
|
313
|
+
large: { gap: 8 },
|
|
314
|
+
},
|
|
315
|
+
codeBlock: {
|
|
316
|
+
borderRadius: 8,
|
|
317
|
+
small: { padding: 12, gap: 8 },
|
|
318
|
+
default: { padding: 16, gap: 12 },
|
|
319
|
+
large: { padding: 24, gap: 16 },
|
|
320
|
+
},
|
|
321
|
+
drawer: { padding: 24, gap: 16 },
|
|
322
|
+
menu: {
|
|
323
|
+
item: { gap: 12, paddingX: 12, paddingY: 6, borderRadius: 4 },
|
|
324
|
+
content: { paddingY: 4 },
|
|
325
|
+
group: { paddingX: 12, labelPaddingY: 6 },
|
|
326
|
+
separator: { marginY: 4 },
|
|
327
|
+
},
|
|
328
|
+
toggleButtonGroup: {
|
|
329
|
+
borderRadius: 8,
|
|
330
|
+
small: { paddingX: 10, paddingY: 6, gap: 8 },
|
|
331
|
+
default: { paddingX: 14, paddingY: 10, gap: 12 },
|
|
332
|
+
large: { paddingX: 24, paddingY: 16, gap: 20 },
|
|
333
|
+
},
|
|
334
|
+
appBar: {
|
|
335
|
+
small: { paddingX: 16, paddingY: 8, gap: 8 },
|
|
336
|
+
default: { paddingX: 16, paddingY: 12, gap: 12 },
|
|
337
|
+
large: { paddingX: 24, paddingY: 16, gap: 16 },
|
|
338
|
+
},
|
|
339
|
+
slider: {
|
|
340
|
+
borderRadius: 9999,
|
|
341
|
+
small: { trackHeight: 4, thumbSize: 12 },
|
|
342
|
+
default: { trackHeight: 6, thumbSize: 16 },
|
|
343
|
+
large: { trackHeight: 8, thumbSize: 20 },
|
|
344
|
+
},
|
|
345
|
+
speedDial: {
|
|
346
|
+
small: { fabSize: 40, actionSize: 32, gap: 8 },
|
|
347
|
+
default: { fabSize: 48, actionSize: 40, gap: 12 },
|
|
348
|
+
large: { fabSize: 64, actionSize: 48, gap: 16 },
|
|
349
|
+
},
|
|
350
|
+
table: {
|
|
351
|
+
small: { cellPaddingX: 12, cellPaddingY: 6 },
|
|
352
|
+
default: { cellPaddingX: 16, cellPaddingY: 12 },
|
|
353
|
+
large: { cellPaddingX: 24, cellPaddingY: 16 },
|
|
354
|
+
},
|
|
237
355
|
},
|
|
238
356
|
comfortable: {
|
|
357
|
+
accordion: {
|
|
358
|
+
small: { gap: 8, paddingX: 16, paddingY: 12 },
|
|
359
|
+
default: { gap: 12, paddingX: 20, paddingY: 16 },
|
|
360
|
+
large: { gap: 12, paddingX: 24, paddingY: 20 },
|
|
361
|
+
},
|
|
239
362
|
dialog: {
|
|
240
363
|
small: { padding: 40, gap: 24, iconSize: 24 },
|
|
241
364
|
default: { padding: 40, gap: 32, iconSize: 32 },
|
|
@@ -345,5 +468,59 @@ exports.themes = {
|
|
|
345
468
|
default: { gap: 8, paddingX: 16, paddingY: 10, indicatorHeight: 2 },
|
|
346
469
|
large: { gap: 12, paddingX: 20, paddingY: 12, indicatorHeight: 4 },
|
|
347
470
|
},
|
|
471
|
+
bottomSheet: {
|
|
472
|
+
borderRadius: 16, handleWidth: 40, handleHeight: 4, handleGap: 8,
|
|
473
|
+
padding: 32, gap: 24,
|
|
474
|
+
},
|
|
475
|
+
link: {
|
|
476
|
+
small: { gap: 4 },
|
|
477
|
+
default: { gap: 8 },
|
|
478
|
+
large: { gap: 8 },
|
|
479
|
+
},
|
|
480
|
+
breadcrumbs: {
|
|
481
|
+
small: { gap: 8 },
|
|
482
|
+
default: { gap: 8 },
|
|
483
|
+
large: { gap: 12 },
|
|
484
|
+
},
|
|
485
|
+
codeBlock: {
|
|
486
|
+
borderRadius: 8,
|
|
487
|
+
small: { padding: 16, gap: 12 },
|
|
488
|
+
default: { padding: 24, gap: 16 },
|
|
489
|
+
large: { padding: 32, gap: 24 },
|
|
490
|
+
},
|
|
491
|
+
drawer: { padding: 32, gap: 24 },
|
|
492
|
+
menu: {
|
|
493
|
+
item: { gap: 16, paddingX: 16, paddingY: 8, borderRadius: 4 },
|
|
494
|
+
content: { paddingY: 6 },
|
|
495
|
+
group: { paddingX: 16, labelPaddingY: 6 },
|
|
496
|
+
separator: { marginY: 4 },
|
|
497
|
+
},
|
|
498
|
+
toggleButtonGroup: {
|
|
499
|
+
borderRadius: 8,
|
|
500
|
+
small: { paddingX: 14, paddingY: 10, gap: 12 },
|
|
501
|
+
default: { paddingX: 20, paddingY: 14, gap: 16 },
|
|
502
|
+
large: { paddingX: 32, paddingY: 20, gap: 24 },
|
|
503
|
+
},
|
|
504
|
+
appBar: {
|
|
505
|
+
small: { paddingX: 16, paddingY: 12, gap: 12 },
|
|
506
|
+
default: { paddingX: 24, paddingY: 16, gap: 16 },
|
|
507
|
+
large: { paddingX: 32, paddingY: 20, gap: 20 },
|
|
508
|
+
},
|
|
509
|
+
slider: {
|
|
510
|
+
borderRadius: 9999,
|
|
511
|
+
small: { trackHeight: 4, thumbSize: 12 },
|
|
512
|
+
default: { trackHeight: 6, thumbSize: 16 },
|
|
513
|
+
large: { trackHeight: 8, thumbSize: 20 },
|
|
514
|
+
},
|
|
515
|
+
speedDial: {
|
|
516
|
+
small: { fabSize: 40, actionSize: 32, gap: 12 },
|
|
517
|
+
default: { fabSize: 48, actionSize: 40, gap: 16 },
|
|
518
|
+
large: { fabSize: 64, actionSize: 48, gap: 20 },
|
|
519
|
+
},
|
|
520
|
+
table: {
|
|
521
|
+
small: { cellPaddingX: 16, cellPaddingY: 8 },
|
|
522
|
+
default: { cellPaddingX: 20, cellPaddingY: 16 },
|
|
523
|
+
large: { cellPaddingX: 32, cellPaddingY: 24 },
|
|
524
|
+
},
|
|
348
525
|
},
|
|
349
526
|
};
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -288,10 +288,175 @@ export type SpinnerThemeTokens = {
|
|
|
288
288
|
default: SpinnerSizeTokens;
|
|
289
289
|
large: SpinnerSizeTokens;
|
|
290
290
|
};
|
|
291
|
+
/**
|
|
292
|
+
* BottomSheet tokens. The sheet hugs its content up to a max height, so there
|
|
293
|
+
* are no size variants. `padding` and `gap` vary by density. The top corner
|
|
294
|
+
* radius and the drag handle dimensions are constant across density (handle
|
|
295
|
+
* width/height are keyed to primitive `size/*`, the radius to a primitive
|
|
296
|
+
* `radius/*`, the handle gap to `space/*`).
|
|
297
|
+
*/
|
|
298
|
+
export type BottomSheetThemeTokens = {
|
|
299
|
+
/** Top-corner radius of the sheet. Constant. */
|
|
300
|
+
borderRadius: number;
|
|
301
|
+
/** Drag handle width. Constant. */
|
|
302
|
+
handleWidth: number;
|
|
303
|
+
/** Drag handle height. Constant. */
|
|
304
|
+
handleHeight: number;
|
|
305
|
+
/** Gap below the handle before the content. Constant. */
|
|
306
|
+
handleGap: number;
|
|
307
|
+
/** Content padding. Varies by density. */
|
|
308
|
+
padding: number;
|
|
309
|
+
/** Gap between stacked content sections. Varies by density. */
|
|
310
|
+
gap: number;
|
|
311
|
+
};
|
|
312
|
+
/** Spacing tokens for one accordion size variant. gap, paddingX, and paddingY
|
|
313
|
+
* all vary by density (bound to primitive space/*). The flush style has no
|
|
314
|
+
* border-radius, and the chevron / leading icon use the named Icon scale keyed
|
|
315
|
+
* by the `size` prop, so there are no constant dimension tokens. */
|
|
316
|
+
export type AccordionSizeTokens = {
|
|
317
|
+
gap: number;
|
|
318
|
+
paddingX: number;
|
|
319
|
+
paddingY: number;
|
|
320
|
+
};
|
|
321
|
+
/** Accordion tokens — three size variants, each density-varying. */
|
|
322
|
+
export type AccordionThemeTokens = {
|
|
323
|
+
small: AccordionSizeTokens;
|
|
324
|
+
default: AccordionSizeTokens;
|
|
325
|
+
large: AccordionSizeTokens;
|
|
326
|
+
};
|
|
291
327
|
/**
|
|
292
328
|
* Component-level tokens that vary by density theme.
|
|
293
329
|
* Extended as new components are added to the library.
|
|
294
330
|
*/
|
|
331
|
+
/** Link spacing tokens for one size variant (icon/label gap, varies by density). */
|
|
332
|
+
export type LinkSizeTokens = {
|
|
333
|
+
gap: number;
|
|
334
|
+
};
|
|
335
|
+
/** Link tokens — gap varies by size and density. */
|
|
336
|
+
export type LinkThemeTokens = {
|
|
337
|
+
small: LinkSizeTokens;
|
|
338
|
+
default: LinkSizeTokens;
|
|
339
|
+
large: LinkSizeTokens;
|
|
340
|
+
};
|
|
341
|
+
/** Breadcrumbs spacing tokens for one size variant (row + icon gap, density). */
|
|
342
|
+
export type BreadcrumbsSizeTokens = {
|
|
343
|
+
gap: number;
|
|
344
|
+
};
|
|
345
|
+
/** Breadcrumbs tokens — gap varies by size and density. */
|
|
346
|
+
export type BreadcrumbsThemeTokens = {
|
|
347
|
+
small: BreadcrumbsSizeTokens;
|
|
348
|
+
default: BreadcrumbsSizeTokens;
|
|
349
|
+
large: BreadcrumbsSizeTokens;
|
|
350
|
+
};
|
|
351
|
+
/** CodeBlock spacing tokens for one size variant (padding + gap, density). */
|
|
352
|
+
export type CodeBlockSizeTokens = {
|
|
353
|
+
padding: number;
|
|
354
|
+
gap: number;
|
|
355
|
+
};
|
|
356
|
+
/** CodeBlock tokens — padding/gap vary by size and density; radius is constant. */
|
|
357
|
+
export type CodeBlockThemeTokens = {
|
|
358
|
+
borderRadius: number;
|
|
359
|
+
small: CodeBlockSizeTokens;
|
|
360
|
+
default: CodeBlockSizeTokens;
|
|
361
|
+
large: CodeBlockSizeTokens;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Drawer tokens. The panel hugs an edge with no size variants, like
|
|
365
|
+
* BottomSheet. padding and gap vary by density; the panel is square (no radius
|
|
366
|
+
* token), and the default width is a layout constant in code, not a token.
|
|
367
|
+
*/
|
|
368
|
+
export type DrawerThemeTokens = {
|
|
369
|
+
padding: number;
|
|
370
|
+
gap: number;
|
|
371
|
+
};
|
|
372
|
+
/** Menu item spacing tokens (density-varying). */
|
|
373
|
+
export type MenuItemTokens = {
|
|
374
|
+
gap: number;
|
|
375
|
+
paddingX: number;
|
|
376
|
+
paddingY: number;
|
|
377
|
+
borderRadius: number;
|
|
378
|
+
};
|
|
379
|
+
/** Menu group (section label) tokens. */
|
|
380
|
+
export type MenuGroupTokens = {
|
|
381
|
+
paddingX: number;
|
|
382
|
+
labelPaddingY: number;
|
|
383
|
+
};
|
|
384
|
+
/** Menu tokens. Mirrors the select shape, namespaced to menu. Item spacing
|
|
385
|
+
* varies by density; the size prop drives typography. */
|
|
386
|
+
export type MenuThemeTokens = {
|
|
387
|
+
item: MenuItemTokens;
|
|
388
|
+
content: {
|
|
389
|
+
paddingY: number;
|
|
390
|
+
};
|
|
391
|
+
group: MenuGroupTokens;
|
|
392
|
+
separator: {
|
|
393
|
+
marginY: number;
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
/** Toggle button spacing tokens for one size variant (density-varying). */
|
|
397
|
+
export type ToggleButtonGroupSizeTokens = {
|
|
398
|
+
paddingX: number;
|
|
399
|
+
paddingY: number;
|
|
400
|
+
gap: number;
|
|
401
|
+
};
|
|
402
|
+
/** Toggle button group tokens — padding/gap vary by size and density; the group
|
|
403
|
+
* border-radius is constant. */
|
|
404
|
+
export type ToggleButtonGroupThemeTokens = {
|
|
405
|
+
borderRadius: number;
|
|
406
|
+
small: ToggleButtonGroupSizeTokens;
|
|
407
|
+
default: ToggleButtonGroupSizeTokens;
|
|
408
|
+
large: ToggleButtonGroupSizeTokens;
|
|
409
|
+
};
|
|
410
|
+
/** App bar spacing tokens for one size variant (density-varying). */
|
|
411
|
+
export type AppBarSizeTokens = {
|
|
412
|
+
paddingX: number;
|
|
413
|
+
paddingY: number;
|
|
414
|
+
gap: number;
|
|
415
|
+
};
|
|
416
|
+
/** App bar tokens — padding/gap vary by size and density. The bar height comes
|
|
417
|
+
* from the padding, so there is no height token. */
|
|
418
|
+
export type AppBarThemeTokens = {
|
|
419
|
+
small: AppBarSizeTokens;
|
|
420
|
+
default: AppBarSizeTokens;
|
|
421
|
+
large: AppBarSizeTokens;
|
|
422
|
+
};
|
|
423
|
+
/** Slider geometry for one size variant (constant across density). */
|
|
424
|
+
export type SliderSizeTokens = {
|
|
425
|
+
trackHeight: number;
|
|
426
|
+
thumbSize: number;
|
|
427
|
+
};
|
|
428
|
+
/** Slider tokens — track thickness + thumb size keyed by the size prop; pill
|
|
429
|
+
* radius constant. No density-varying spacing. */
|
|
430
|
+
export type SliderThemeTokens = {
|
|
431
|
+
borderRadius: number;
|
|
432
|
+
small: SliderSizeTokens;
|
|
433
|
+
default: SliderSizeTokens;
|
|
434
|
+
large: SliderSizeTokens;
|
|
435
|
+
};
|
|
436
|
+
/** Speed dial sizes for one size variant. fab/action sizes are constant per
|
|
437
|
+
* size; gap varies by density. */
|
|
438
|
+
export type SpeedDialSizeTokens = {
|
|
439
|
+
fabSize: number;
|
|
440
|
+
actionSize: number;
|
|
441
|
+
gap: number;
|
|
442
|
+
};
|
|
443
|
+
/** Speed dial tokens — three size variants. */
|
|
444
|
+
export type SpeedDialThemeTokens = {
|
|
445
|
+
small: SpeedDialSizeTokens;
|
|
446
|
+
default: SpeedDialSizeTokens;
|
|
447
|
+
large: SpeedDialSizeTokens;
|
|
448
|
+
};
|
|
449
|
+
/** Table cell padding for one size variant (density-varying). */
|
|
450
|
+
export type TableSizeTokens = {
|
|
451
|
+
cellPaddingX: number;
|
|
452
|
+
cellPaddingY: number;
|
|
453
|
+
};
|
|
454
|
+
/** Table tokens — three size variants. */
|
|
455
|
+
export type TableThemeTokens = {
|
|
456
|
+
small: TableSizeTokens;
|
|
457
|
+
default: TableSizeTokens;
|
|
458
|
+
large: TableSizeTokens;
|
|
459
|
+
};
|
|
295
460
|
export type ComponentTokens = {
|
|
296
461
|
button: ButtonThemeTokens;
|
|
297
462
|
dialog: DialogThemeTokens;
|
|
@@ -311,7 +476,19 @@ export type ComponentTokens = {
|
|
|
311
476
|
tooltip: TooltipThemeTokens;
|
|
312
477
|
progress: ProgressThemeTokens;
|
|
313
478
|
tabs: TabsThemeTokens;
|
|
479
|
+
accordion: AccordionThemeTokens;
|
|
314
480
|
spinner: SpinnerThemeTokens;
|
|
481
|
+
bottomSheet: BottomSheetThemeTokens;
|
|
482
|
+
link: LinkThemeTokens;
|
|
483
|
+
breadcrumbs: BreadcrumbsThemeTokens;
|
|
484
|
+
codeBlock: CodeBlockThemeTokens;
|
|
485
|
+
drawer: DrawerThemeTokens;
|
|
486
|
+
menu: MenuThemeTokens;
|
|
487
|
+
toggleButtonGroup: ToggleButtonGroupThemeTokens;
|
|
488
|
+
appBar: AppBarThemeTokens;
|
|
489
|
+
slider: SliderThemeTokens;
|
|
490
|
+
speedDial: SpeedDialThemeTokens;
|
|
491
|
+
table: TableThemeTokens;
|
|
315
492
|
};
|
|
316
493
|
/** Utility type for partial overrides at any depth */
|
|
317
494
|
export type DeepPartial<T> = {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breakpoint scale — named min-width thresholds in density-independent pixels.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Figma `breakpoint/{sm,md,lg,xl}` primitive variables. This is a
|
|
5
|
+
* foundation reference scale, not a runtime theme value. The numbers do not
|
|
6
|
+
* change with density, they are not part of the ThemeProvider theme, and
|
|
7
|
+
* cast-sync does not export them. Read them with the useBreakpoint /
|
|
8
|
+
* useResponsiveValue hooks, which watch the live window width.
|
|
9
|
+
*
|
|
10
|
+
* Values follow Material 3 window size classes, which are derived from real
|
|
11
|
+
* device-width data across the whole spectrum. The scale is mobile-first: a
|
|
12
|
+
* width is "at" a breakpoint when it is greater than or equal to that
|
|
13
|
+
* breakpoint's value, and anything below `sm` is the implicit `base` tier.
|
|
14
|
+
*
|
|
15
|
+
* Device mapping (width in dp):
|
|
16
|
+
*
|
|
17
|
+
* base < 600 Watches, and every phone in portrait. iPhone SE 320,
|
|
18
|
+
* iPhone 15 390, Pro Max 430, Pixel 7 412, Apple Watch
|
|
19
|
+
* 136-205. This is your default, design-here-first layout.
|
|
20
|
+
* sm >= 600 Large phones in landscape, foldables unfolded, small
|
|
21
|
+
* tablets in portrait.
|
|
22
|
+
* md >= 840 Tablets. iPad portrait ~768-834 (sits at the top of sm),
|
|
23
|
+
* iPad landscape and larger tablets land here and up.
|
|
24
|
+
* lg >= 1200 Laptops and desktops.
|
|
25
|
+
* xl >= 1600 Large desktops and TVs.
|
|
26
|
+
*
|
|
27
|
+
* React Native has no CSS media queries, so a breakpoint here is a width
|
|
28
|
+
* threshold you compare the window against at runtime. It does not restyle
|
|
29
|
+
* anything on its own. Small-vs-large phone differences belong to fluid layout
|
|
30
|
+
* (flex, percentages, maxWidth), not breakpoints. A watch is its own surface,
|
|
31
|
+
* not a tier: it falls into `base` and shares the default layout, which is the
|
|
32
|
+
* safe behaviour for a kit that does not target watchOS.
|
|
33
|
+
*/
|
|
34
|
+
/** The named breakpoint tiers. */
|
|
35
|
+
export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
36
|
+
/** A breakpoint tier including the implicit below-`sm` base tier. */
|
|
37
|
+
export type BreakpointKey = 'base' | Breakpoint;
|
|
38
|
+
/** Min-width thresholds in dp (Material 3 window size classes). */
|
|
39
|
+
export declare const breakpoints: Record<Breakpoint, number>;
|
|
40
|
+
/** Tiers ordered smallest to largest, base first. */
|
|
41
|
+
export declare const breakpointOrder: readonly BreakpointKey[];
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a raw window width (dp) to its active breakpoint tier. Mobile-first:
|
|
44
|
+
* returns the largest tier whose threshold the width has reached, or `base`
|
|
45
|
+
* below `sm`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveBreakpoint(width: number): BreakpointKey;
|
|
48
|
+
/**
|
|
49
|
+
* Pick a value for a tier, mobile-first. Supply values for any subset of tiers.
|
|
50
|
+
* The chosen value is the one at the current tier or, if that tier has none,
|
|
51
|
+
* the nearest defined tier below it. If nothing is defined at or below the
|
|
52
|
+
* current tier, the smallest defined tier above is used. Returns undefined when
|
|
53
|
+
* `values` is empty.
|
|
54
|
+
*
|
|
55
|
+
* resolveResponsiveValue({ base: 1, md: 2, xl: 4 }, 'lg') // => 2
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveResponsiveValue<T>(values: Partial<Record<BreakpointKey, T>>, current: BreakpointKey): T | undefined;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Breakpoint scale — named min-width thresholds in density-independent pixels.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the Figma `breakpoint/{sm,md,lg,xl}` primitive variables. This is a
|
|
6
|
+
* foundation reference scale, not a runtime theme value. The numbers do not
|
|
7
|
+
* change with density, they are not part of the ThemeProvider theme, and
|
|
8
|
+
* cast-sync does not export them. Read them with the useBreakpoint /
|
|
9
|
+
* useResponsiveValue hooks, which watch the live window width.
|
|
10
|
+
*
|
|
11
|
+
* Values follow Material 3 window size classes, which are derived from real
|
|
12
|
+
* device-width data across the whole spectrum. The scale is mobile-first: a
|
|
13
|
+
* width is "at" a breakpoint when it is greater than or equal to that
|
|
14
|
+
* breakpoint's value, and anything below `sm` is the implicit `base` tier.
|
|
15
|
+
*
|
|
16
|
+
* Device mapping (width in dp):
|
|
17
|
+
*
|
|
18
|
+
* base < 600 Watches, and every phone in portrait. iPhone SE 320,
|
|
19
|
+
* iPhone 15 390, Pro Max 430, Pixel 7 412, Apple Watch
|
|
20
|
+
* 136-205. This is your default, design-here-first layout.
|
|
21
|
+
* sm >= 600 Large phones in landscape, foldables unfolded, small
|
|
22
|
+
* tablets in portrait.
|
|
23
|
+
* md >= 840 Tablets. iPad portrait ~768-834 (sits at the top of sm),
|
|
24
|
+
* iPad landscape and larger tablets land here and up.
|
|
25
|
+
* lg >= 1200 Laptops and desktops.
|
|
26
|
+
* xl >= 1600 Large desktops and TVs.
|
|
27
|
+
*
|
|
28
|
+
* React Native has no CSS media queries, so a breakpoint here is a width
|
|
29
|
+
* threshold you compare the window against at runtime. It does not restyle
|
|
30
|
+
* anything on its own. Small-vs-large phone differences belong to fluid layout
|
|
31
|
+
* (flex, percentages, maxWidth), not breakpoints. A watch is its own surface,
|
|
32
|
+
* not a tier: it falls into `base` and shares the default layout, which is the
|
|
33
|
+
* safe behaviour for a kit that does not target watchOS.
|
|
34
|
+
*/
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.breakpointOrder = exports.breakpoints = void 0;
|
|
37
|
+
exports.resolveBreakpoint = resolveBreakpoint;
|
|
38
|
+
exports.resolveResponsiveValue = resolveResponsiveValue;
|
|
39
|
+
/** Min-width thresholds in dp (Material 3 window size classes). */
|
|
40
|
+
exports.breakpoints = {
|
|
41
|
+
sm: 600,
|
|
42
|
+
md: 840,
|
|
43
|
+
lg: 1200,
|
|
44
|
+
xl: 1600,
|
|
45
|
+
};
|
|
46
|
+
/** Tiers ordered smallest to largest, base first. */
|
|
47
|
+
exports.breakpointOrder = [
|
|
48
|
+
'base',
|
|
49
|
+
'sm',
|
|
50
|
+
'md',
|
|
51
|
+
'lg',
|
|
52
|
+
'xl',
|
|
53
|
+
];
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a raw window width (dp) to its active breakpoint tier. Mobile-first:
|
|
56
|
+
* returns the largest tier whose threshold the width has reached, or `base`
|
|
57
|
+
* below `sm`.
|
|
58
|
+
*/
|
|
59
|
+
function resolveBreakpoint(width) {
|
|
60
|
+
if (width >= exports.breakpoints.xl)
|
|
61
|
+
return 'xl';
|
|
62
|
+
if (width >= exports.breakpoints.lg)
|
|
63
|
+
return 'lg';
|
|
64
|
+
if (width >= exports.breakpoints.md)
|
|
65
|
+
return 'md';
|
|
66
|
+
if (width >= exports.breakpoints.sm)
|
|
67
|
+
return 'sm';
|
|
68
|
+
return 'base';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Pick a value for a tier, mobile-first. Supply values for any subset of tiers.
|
|
72
|
+
* The chosen value is the one at the current tier or, if that tier has none,
|
|
73
|
+
* the nearest defined tier below it. If nothing is defined at or below the
|
|
74
|
+
* current tier, the smallest defined tier above is used. Returns undefined when
|
|
75
|
+
* `values` is empty.
|
|
76
|
+
*
|
|
77
|
+
* resolveResponsiveValue({ base: 1, md: 2, xl: 4 }, 'lg') // => 2
|
|
78
|
+
*/
|
|
79
|
+
function resolveResponsiveValue(values, current) {
|
|
80
|
+
const idx = exports.breakpointOrder.indexOf(current);
|
|
81
|
+
for (let i = idx; i >= 0; i--) {
|
|
82
|
+
const v = values[exports.breakpointOrder[i]];
|
|
83
|
+
if (v !== undefined)
|
|
84
|
+
return v;
|
|
85
|
+
}
|
|
86
|
+
for (let i = idx + 1; i < exports.breakpointOrder.length; i++) {
|
|
87
|
+
const v = values[exports.breakpointOrder[i]];
|
|
88
|
+
if (v !== undefined)
|
|
89
|
+
return v;
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
package/dist/tokens/colors.d.ts
CHANGED
|
@@ -95,6 +95,11 @@ export type ColorScheme = {
|
|
|
95
95
|
/** Separator line colour */
|
|
96
96
|
separator: string;
|
|
97
97
|
};
|
|
98
|
+
/** Menu colours — item state colours (neutral) + separator. Mirrors select. */
|
|
99
|
+
menu: {
|
|
100
|
+
item: OptionStateColors;
|
|
101
|
+
separator: string;
|
|
102
|
+
};
|
|
98
103
|
/** Tag tokens — multi-select pill styling (layout constant across modes) */
|
|
99
104
|
tag: {
|
|
100
105
|
bg: string;
|
|
@@ -204,6 +209,14 @@ export type ColorScheme = {
|
|
|
204
209
|
spinner: {
|
|
205
210
|
track: string;
|
|
206
211
|
};
|
|
212
|
+
/**
|
|
213
|
+
* BottomSheet colours. The card surface reuses surface.overlay; the scrim
|
|
214
|
+
* reuses overlay.scrimOpacity. The drag handle is the one bespoke colour:
|
|
215
|
+
* control/bottom-sheet/handle/bg, a primitive grey that follows colour mode.
|
|
216
|
+
*/
|
|
217
|
+
bottomSheet: {
|
|
218
|
+
handle: string;
|
|
219
|
+
};
|
|
207
220
|
/** Avatar colours — initials/icon fallback surface + foreground */
|
|
208
221
|
avatar: {
|
|
209
222
|
bg: string;
|
|
@@ -222,6 +235,19 @@ export type ColorScheme = {
|
|
|
222
235
|
separator: string;
|
|
223
236
|
containerBg: string;
|
|
224
237
|
};
|
|
238
|
+
/** Slider colours — track background (the fill uses the intent system). */
|
|
239
|
+
slider: {
|
|
240
|
+
track: string;
|
|
241
|
+
};
|
|
242
|
+
/** Table colours — header, borders, and row states (neutral/brand, reused). */
|
|
243
|
+
table: {
|
|
244
|
+
headerBg: string;
|
|
245
|
+
border: string;
|
|
246
|
+
rowHover: string;
|
|
247
|
+
stripe: string;
|
|
248
|
+
selectedBg: string;
|
|
249
|
+
selectedHoverBg: string;
|
|
250
|
+
};
|
|
225
251
|
};
|
|
226
252
|
export declare const lightColors: ColorScheme;
|
|
227
253
|
export declare const darkColors: ColorScheme;
|
|
@@ -271,6 +297,11 @@ export declare const selectColors: {
|
|
|
271
297
|
/** Separator line colour */
|
|
272
298
|
separator: string;
|
|
273
299
|
};
|
|
300
|
+
/** Menu colours — item state colours + separator (mirrors select). */
|
|
301
|
+
export declare const menuColors: {
|
|
302
|
+
item: OptionStateColors;
|
|
303
|
+
separator: string;
|
|
304
|
+
};
|
|
274
305
|
/** Tag tokens — multi-select pill styling (constant across densities) */
|
|
275
306
|
export declare const tagTokens: {
|
|
276
307
|
bg: string;
|
|
@@ -382,6 +413,19 @@ export declare const skeletonColors: {
|
|
|
382
413
|
bg: string;
|
|
383
414
|
highlight: string;
|
|
384
415
|
};
|
|
416
|
+
/** Slider colours — track background (fill comes from the intent system). */
|
|
417
|
+
export declare const sliderColors: {
|
|
418
|
+
track: string;
|
|
419
|
+
};
|
|
420
|
+
/** Table colours — header, borders, and row states. */
|
|
421
|
+
export declare const tableColors: {
|
|
422
|
+
headerBg: string;
|
|
423
|
+
border: string;
|
|
424
|
+
rowHover: string;
|
|
425
|
+
stripe: string;
|
|
426
|
+
selectedBg: string;
|
|
427
|
+
selectedHoverBg: string;
|
|
428
|
+
};
|
|
385
429
|
/** List colours — used by List / ListItem / ListSubheader */
|
|
386
430
|
export declare const listColors: {
|
|
387
431
|
item: OptionStateColors;
|