@leitware/composables 0.2.1 → 1.0.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 +186 -49
- package/dist/presets/brutalist.css +53 -39
- package/dist/presets/default.css +52 -38
- package/dist/presets/signal-pop.css +51 -37
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +500 -0
- package/package.json +9 -31
- package/rules/composables.md +80 -84
- package/skills/use-composables/SKILL.md +42 -0
- package/skills/use-composables/agents/openai.yaml +4 -0
- package/skills/use-composables/references/optional-dependencies.md +76 -0
- package/skills/use-composables/references/public-api.md +23 -0
- package/skills/use-composables/references/semantic-styling.md +134 -0
- package/skills/use-composables/references/semantic-utilities.md +131 -0
- package/src/_internal/alert.tsx +1 -1
- package/src/index.ts +33 -10
- package/src/opinionated/accordion.tsx +22 -3
- package/src/opinionated/alert.tsx +21 -7
- package/src/opinionated/tabs.tsx +16 -3
- package/src/styles/composable.css +7 -1
- package/src/styles/presets/brutalist.css +53 -39
- package/src/styles/presets/default.css +52 -38
- package/src/styles/presets/signal-pop.css +51 -37
- package/src/styles/presets-data/brutalist.ts +19 -41
- package/src/styles/presets-data/default.ts +18 -40
- package/src/styles/presets-data/signal-pop.ts +17 -39
- package/src/styles/tokens/registry.ts +126 -18
- package/src/styles/tokens/semantic-utilities.css +503 -0
- package/src/styles/tokens/semantic.css +46 -32
- package/src/styles/tokens/tailwind-color-adapter.css +91 -0
- package/src/styles/tokens/tailwind-public-utilities.css +500 -0
- package/src/styles/tokens/tailwind-theme.css +0 -100
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Public semantic utility manifest
|
|
2
|
+
|
|
3
|
+
<!-- This file is generated by scripts/generate-css.ts. Do not edit it directly. -->
|
|
4
|
+
|
|
5
|
+
This is the exact allowlist of framework-independent semantic colour classes shipped by Composables. It is generated from `publicSemanticUtilities` in `src/styles/tokens/registry.ts`; do not infer additional token/property combinations.
|
|
6
|
+
|
|
7
|
+
| Class | Category | Semantic token | Declaration |
|
|
8
|
+
| --------------------------- | -------- | ----------------------------- | ---------------------------------------------------- |
|
|
9
|
+
| `bg-default` | bg | `--bg-default` | `background-color: var(--bg-default)` |
|
|
10
|
+
| `bg-inverse` | bg | `--bg-inverse` | `background-color: var(--bg-inverse)` |
|
|
11
|
+
| `bg-muted` | bg | `--bg-muted` | `background-color: var(--bg-muted)` |
|
|
12
|
+
| `bg-surface-default` | bg | `--bg-surface-default` | `background-color: var(--bg-surface-default)` |
|
|
13
|
+
| `bg-surface-popover` | bg | `--bg-surface-popover` | `background-color: var(--bg-surface-popover)` |
|
|
14
|
+
| `bg-surface-accent` | bg | `--bg-surface-accent` | `background-color: var(--bg-surface-accent)` |
|
|
15
|
+
| `bg-surface-info` | bg | `--bg-surface-info` | `background-color: var(--bg-surface-info)` |
|
|
16
|
+
| `bg-surface-success` | bg | `--bg-surface-success` | `background-color: var(--bg-surface-success)` |
|
|
17
|
+
| `bg-surface-warning` | bg | `--bg-surface-warning` | `background-color: var(--bg-surface-warning)` |
|
|
18
|
+
| `bg-surface-critical` | bg | `--bg-surface-critical` | `background-color: var(--bg-surface-critical)` |
|
|
19
|
+
| `bg-surface-emphasis` | bg | `--bg-surface-emphasis` | `background-color: var(--bg-surface-emphasis)` |
|
|
20
|
+
| `bg-surface-inverse` | bg | `--bg-surface-inverse` | `background-color: var(--bg-surface-inverse)` |
|
|
21
|
+
| `bg-surface-transparent` | bg | `--bg-surface-transparent` | `background-color: var(--bg-surface-transparent)` |
|
|
22
|
+
| `bg-overlay` | bg | `--bg-overlay` | `background-color: var(--bg-overlay)` |
|
|
23
|
+
| `bg-surface-brand` | bg | `--bg-surface-brand` | `background-color: var(--bg-surface-brand)` |
|
|
24
|
+
| `bg-surface-brand-2` | bg | `--bg-surface-brand-2` | `background-color: var(--bg-surface-brand-2)` |
|
|
25
|
+
| `bg-surface-brand-3` | bg | `--bg-surface-brand-3` | `background-color: var(--bg-surface-brand-3)` |
|
|
26
|
+
| `bg-surface-brand-4` | bg | `--bg-surface-brand-4` | `background-color: var(--bg-surface-brand-4)` |
|
|
27
|
+
| `bg-surface-brand-5` | bg | `--bg-surface-brand-5` | `background-color: var(--bg-surface-brand-5)` |
|
|
28
|
+
| `bg-surface-hover` | bg | `--bg-surface-hover` | `background-color: var(--bg-surface-hover)` |
|
|
29
|
+
| `bg-fill-default` | bg | `--bg-fill-default` | `background-color: var(--bg-fill-default)` |
|
|
30
|
+
| `bg-fill-primary` | bg | `--bg-fill-primary` | `background-color: var(--bg-fill-primary)` |
|
|
31
|
+
| `bg-fill-brand` | bg | `--bg-fill-brand` | `background-color: var(--bg-fill-brand)` |
|
|
32
|
+
| `bg-fill-brand-2` | bg | `--bg-fill-brand-2` | `background-color: var(--bg-fill-brand-2)` |
|
|
33
|
+
| `bg-fill-brand-3` | bg | `--bg-fill-brand-3` | `background-color: var(--bg-fill-brand-3)` |
|
|
34
|
+
| `bg-fill-brand-4` | bg | `--bg-fill-brand-4` | `background-color: var(--bg-fill-brand-4)` |
|
|
35
|
+
| `bg-fill-brand-5` | bg | `--bg-fill-brand-5` | `background-color: var(--bg-fill-brand-5)` |
|
|
36
|
+
| `bg-fill-info` | bg | `--bg-fill-info` | `background-color: var(--bg-fill-info)` |
|
|
37
|
+
| `bg-fill-success` | bg | `--bg-fill-success` | `background-color: var(--bg-fill-success)` |
|
|
38
|
+
| `bg-fill-warning` | bg | `--bg-fill-warning` | `background-color: var(--bg-fill-warning)` |
|
|
39
|
+
| `bg-fill-critical` | bg | `--bg-fill-critical` | `background-color: var(--bg-fill-critical)` |
|
|
40
|
+
| `bg-fill-emphasis` | bg | `--bg-fill-emphasis` | `background-color: var(--bg-fill-emphasis)` |
|
|
41
|
+
| `bg-fill-transparent` | bg | `--bg-fill-transparent` | `background-color: var(--bg-fill-transparent)` |
|
|
42
|
+
| `bg-fill-secondary` | bg | `--bg-fill-secondary` | `background-color: var(--bg-fill-secondary)` |
|
|
43
|
+
| `bg-fill-secondary-inverse` | bg | `--bg-fill-secondary-inverse` | `background-color: var(--bg-fill-secondary-inverse)` |
|
|
44
|
+
| `text-default` | text | `--text-default` | `color: var(--text-default)` |
|
|
45
|
+
| `text-content-secondary` | text | `--text-secondary` | `color: var(--text-secondary)` |
|
|
46
|
+
| `text-content-muted` | text | `--text-muted` | `color: var(--text-muted)` |
|
|
47
|
+
| `text-disabled` | text | `--text-disabled` | `color: var(--text-disabled)` |
|
|
48
|
+
| `text-inverse` | text | `--text-inverse` | `color: var(--text-inverse)` |
|
|
49
|
+
| `text-on-fill-primary` | text | `--text-on-fill-primary` | `color: var(--text-on-fill-primary)` |
|
|
50
|
+
| `text-on-fill-secondary` | text | `--text-on-fill-secondary` | `color: var(--text-on-fill-secondary)` |
|
|
51
|
+
| `text-on-surface-accent` | text | `--text-on-surface-accent` | `color: var(--text-on-surface-accent)` |
|
|
52
|
+
| `text-info` | text | `--text-info` | `color: var(--text-info)` |
|
|
53
|
+
| `text-success` | text | `--text-success` | `color: var(--text-success)` |
|
|
54
|
+
| `text-warning` | text | `--text-warning` | `color: var(--text-warning)` |
|
|
55
|
+
| `text-critical` | text | `--text-critical` | `color: var(--text-critical)` |
|
|
56
|
+
| `text-emphasis` | text | `--text-emphasis` | `color: var(--text-emphasis)` |
|
|
57
|
+
| `text-brand` | text | `--text-brand` | `color: var(--text-brand)` |
|
|
58
|
+
| `text-brand-2` | text | `--text-brand-2` | `color: var(--text-brand-2)` |
|
|
59
|
+
| `text-brand-3` | text | `--text-brand-3` | `color: var(--text-brand-3)` |
|
|
60
|
+
| `text-brand-4` | text | `--text-brand-4` | `color: var(--text-brand-4)` |
|
|
61
|
+
| `text-brand-5` | text | `--text-brand-5` | `color: var(--text-brand-5)` |
|
|
62
|
+
| `text-link` | text | `--text-link` | `color: var(--text-link)` |
|
|
63
|
+
| `text-icon-default` | icon | `--icon-default` | `color: var(--icon-default)` |
|
|
64
|
+
| `fill-icon-default` | icon | `--icon-default` | `fill: var(--icon-default)` |
|
|
65
|
+
| `stroke-icon-default` | icon | `--icon-default` | `stroke: var(--icon-default)` |
|
|
66
|
+
| `text-icon-secondary` | icon | `--icon-secondary` | `color: var(--icon-secondary)` |
|
|
67
|
+
| `fill-icon-secondary` | icon | `--icon-secondary` | `fill: var(--icon-secondary)` |
|
|
68
|
+
| `stroke-icon-secondary` | icon | `--icon-secondary` | `stroke: var(--icon-secondary)` |
|
|
69
|
+
| `text-icon-disabled` | icon | `--icon-disabled` | `color: var(--icon-disabled)` |
|
|
70
|
+
| `fill-icon-disabled` | icon | `--icon-disabled` | `fill: var(--icon-disabled)` |
|
|
71
|
+
| `stroke-icon-disabled` | icon | `--icon-disabled` | `stroke: var(--icon-disabled)` |
|
|
72
|
+
| `text-icon-inverse` | icon | `--icon-inverse` | `color: var(--icon-inverse)` |
|
|
73
|
+
| `fill-icon-inverse` | icon | `--icon-inverse` | `fill: var(--icon-inverse)` |
|
|
74
|
+
| `stroke-icon-inverse` | icon | `--icon-inverse` | `stroke: var(--icon-inverse)` |
|
|
75
|
+
| `text-icon-info` | icon | `--icon-info` | `color: var(--icon-info)` |
|
|
76
|
+
| `fill-icon-info` | icon | `--icon-info` | `fill: var(--icon-info)` |
|
|
77
|
+
| `stroke-icon-info` | icon | `--icon-info` | `stroke: var(--icon-info)` |
|
|
78
|
+
| `text-icon-success` | icon | `--icon-success` | `color: var(--icon-success)` |
|
|
79
|
+
| `fill-icon-success` | icon | `--icon-success` | `fill: var(--icon-success)` |
|
|
80
|
+
| `stroke-icon-success` | icon | `--icon-success` | `stroke: var(--icon-success)` |
|
|
81
|
+
| `text-icon-warning` | icon | `--icon-warning` | `color: var(--icon-warning)` |
|
|
82
|
+
| `fill-icon-warning` | icon | `--icon-warning` | `fill: var(--icon-warning)` |
|
|
83
|
+
| `stroke-icon-warning` | icon | `--icon-warning` | `stroke: var(--icon-warning)` |
|
|
84
|
+
| `text-icon-critical` | icon | `--icon-critical` | `color: var(--icon-critical)` |
|
|
85
|
+
| `fill-icon-critical` | icon | `--icon-critical` | `fill: var(--icon-critical)` |
|
|
86
|
+
| `stroke-icon-critical` | icon | `--icon-critical` | `stroke: var(--icon-critical)` |
|
|
87
|
+
| `text-icon-emphasis` | icon | `--icon-emphasis` | `color: var(--icon-emphasis)` |
|
|
88
|
+
| `fill-icon-emphasis` | icon | `--icon-emphasis` | `fill: var(--icon-emphasis)` |
|
|
89
|
+
| `stroke-icon-emphasis` | icon | `--icon-emphasis` | `stroke: var(--icon-emphasis)` |
|
|
90
|
+
| `text-icon-brand` | icon | `--icon-brand` | `color: var(--icon-brand)` |
|
|
91
|
+
| `fill-icon-brand` | icon | `--icon-brand` | `fill: var(--icon-brand)` |
|
|
92
|
+
| `stroke-icon-brand` | icon | `--icon-brand` | `stroke: var(--icon-brand)` |
|
|
93
|
+
| `text-icon-brand-2` | icon | `--icon-brand-2` | `color: var(--icon-brand-2)` |
|
|
94
|
+
| `fill-icon-brand-2` | icon | `--icon-brand-2` | `fill: var(--icon-brand-2)` |
|
|
95
|
+
| `stroke-icon-brand-2` | icon | `--icon-brand-2` | `stroke: var(--icon-brand-2)` |
|
|
96
|
+
| `text-icon-brand-3` | icon | `--icon-brand-3` | `color: var(--icon-brand-3)` |
|
|
97
|
+
| `fill-icon-brand-3` | icon | `--icon-brand-3` | `fill: var(--icon-brand-3)` |
|
|
98
|
+
| `stroke-icon-brand-3` | icon | `--icon-brand-3` | `stroke: var(--icon-brand-3)` |
|
|
99
|
+
| `text-icon-brand-4` | icon | `--icon-brand-4` | `color: var(--icon-brand-4)` |
|
|
100
|
+
| `fill-icon-brand-4` | icon | `--icon-brand-4` | `fill: var(--icon-brand-4)` |
|
|
101
|
+
| `stroke-icon-brand-4` | icon | `--icon-brand-4` | `stroke: var(--icon-brand-4)` |
|
|
102
|
+
| `text-icon-brand-5` | icon | `--icon-brand-5` | `color: var(--icon-brand-5)` |
|
|
103
|
+
| `fill-icon-brand-5` | icon | `--icon-brand-5` | `fill: var(--icon-brand-5)` |
|
|
104
|
+
| `stroke-icon-brand-5` | icon | `--icon-brand-5` | `stroke: var(--icon-brand-5)` |
|
|
105
|
+
| `border-stroke-default` | border | `--border-default` | `border-color: var(--border-default)` |
|
|
106
|
+
| `border-stroke-secondary` | border | `--border-secondary` | `border-color: var(--border-secondary)` |
|
|
107
|
+
| `border-stroke-input` | border | `--border-input` | `border-color: var(--border-input)` |
|
|
108
|
+
| `border-stroke-tertiary` | border | `--border-tertiary` | `border-color: var(--border-tertiary)` |
|
|
109
|
+
| `border-stroke-disabled` | border | `--border-disabled` | `border-color: var(--border-disabled)` |
|
|
110
|
+
| `border-stroke-inverse` | border | `--border-inverse` | `border-color: var(--border-inverse)` |
|
|
111
|
+
| `border-stroke-focus` | border | `--border-focus` | `border-color: var(--border-focus)` |
|
|
112
|
+
| `border-stroke-brand` | border | `--border-brand` | `border-color: var(--border-brand)` |
|
|
113
|
+
| `border-stroke-brand-2` | border | `--border-brand-2` | `border-color: var(--border-brand-2)` |
|
|
114
|
+
| `border-stroke-brand-3` | border | `--border-brand-3` | `border-color: var(--border-brand-3)` |
|
|
115
|
+
| `border-stroke-brand-4` | border | `--border-brand-4` | `border-color: var(--border-brand-4)` |
|
|
116
|
+
| `border-stroke-brand-5` | border | `--border-brand-5` | `border-color: var(--border-brand-5)` |
|
|
117
|
+
| `border-stroke-info` | border | `--border-info` | `border-color: var(--border-info)` |
|
|
118
|
+
| `border-stroke-success` | border | `--border-success` | `border-color: var(--border-success)` |
|
|
119
|
+
| `border-stroke-warning` | border | `--border-warning` | `border-color: var(--border-warning)` |
|
|
120
|
+
| `border-stroke-critical` | border | `--border-critical` | `border-color: var(--border-critical)` |
|
|
121
|
+
| `border-stroke-emphasis` | border | `--border-emphasis` | `border-color: var(--border-emphasis)` |
|
|
122
|
+
| `fill-chart-1` | chart | `--chart-1` | `fill: var(--chart-1)` |
|
|
123
|
+
| `stroke-chart-1` | chart | `--chart-1` | `stroke: var(--chart-1)` |
|
|
124
|
+
| `fill-chart-2` | chart | `--chart-2` | `fill: var(--chart-2)` |
|
|
125
|
+
| `stroke-chart-2` | chart | `--chart-2` | `stroke: var(--chart-2)` |
|
|
126
|
+
| `fill-chart-3` | chart | `--chart-3` | `fill: var(--chart-3)` |
|
|
127
|
+
| `stroke-chart-3` | chart | `--chart-3` | `stroke: var(--chart-3)` |
|
|
128
|
+
| `fill-chart-4` | chart | `--chart-4` | `fill: var(--chart-4)` |
|
|
129
|
+
| `stroke-chart-4` | chart | `--chart-4` | `stroke: var(--chart-4)` |
|
|
130
|
+
| `fill-chart-5` | chart | `--chart-5` | `fill: var(--chart-5)` |
|
|
131
|
+
| `stroke-chart-5` | chart | `--chart-5` | `stroke: var(--chart-5)` |
|
package/src/_internal/alert.tsx
CHANGED
package/src/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export {
|
|
|
30
30
|
AccordionTrigger,
|
|
31
31
|
type AccordionItemData,
|
|
32
32
|
type AccordionProps,
|
|
33
|
+
type AccordionVariant,
|
|
33
34
|
} from './opinionated/accordion'
|
|
34
35
|
|
|
35
36
|
export {
|
|
@@ -48,6 +49,7 @@ export {
|
|
|
48
49
|
AlertAction,
|
|
49
50
|
AlertDescription,
|
|
50
51
|
AlertTitle,
|
|
52
|
+
type AlertVariant,
|
|
51
53
|
type AlertType,
|
|
52
54
|
type AlertProps,
|
|
53
55
|
} from './opinionated/alert'
|
|
@@ -102,7 +104,7 @@ export {
|
|
|
102
104
|
} from './opinionated/carousel'
|
|
103
105
|
|
|
104
106
|
export { Checkbox } from './opinionated/checkbox'
|
|
105
|
-
export { CodeBlock } from './opinionated/code-block'
|
|
107
|
+
export { CodeBlock, type CodeBlockProps } from './opinionated/code-block'
|
|
106
108
|
|
|
107
109
|
export {
|
|
108
110
|
Collapsible,
|
|
@@ -131,7 +133,7 @@ export {
|
|
|
131
133
|
type ComboboxProps,
|
|
132
134
|
} from './opinionated/combobox'
|
|
133
135
|
|
|
134
|
-
export { Container } from './opinionated/container'
|
|
136
|
+
export { Container, type ContainerProps } from './opinionated/container'
|
|
135
137
|
|
|
136
138
|
export {
|
|
137
139
|
Dialog,
|
|
@@ -145,7 +147,7 @@ export {
|
|
|
145
147
|
type DialogProps,
|
|
146
148
|
} from './opinionated/dialog'
|
|
147
149
|
|
|
148
|
-
export { Divider } from './opinionated/divider'
|
|
150
|
+
export { Divider, type DividerProps } from './opinionated/divider'
|
|
149
151
|
|
|
150
152
|
export {
|
|
151
153
|
DirectionProvider,
|
|
@@ -172,7 +174,14 @@ export {
|
|
|
172
174
|
type DropdownMenuProps,
|
|
173
175
|
} from './opinionated/dropdown-menu'
|
|
174
176
|
|
|
175
|
-
export {
|
|
177
|
+
export {
|
|
178
|
+
DropZone,
|
|
179
|
+
DropZoneFile,
|
|
180
|
+
type Accept,
|
|
181
|
+
type DropZoneFileProps,
|
|
182
|
+
type DropZoneProps,
|
|
183
|
+
type FileRejection,
|
|
184
|
+
} from './opinionated/dropzone'
|
|
176
185
|
|
|
177
186
|
export {
|
|
178
187
|
Empty,
|
|
@@ -237,7 +246,7 @@ export { FormSlider, type FormSliderProps } from './opinionated/form-slider'
|
|
|
237
246
|
export { FormSwitch, type FormSwitchProps } from './opinionated/form-switch'
|
|
238
247
|
export { FormTextarea, type FormTextareaProps } from './opinionated/form-textarea'
|
|
239
248
|
|
|
240
|
-
export { Grid } from './opinionated/grid'
|
|
249
|
+
export { Grid, type GridProps } from './opinionated/grid'
|
|
241
250
|
export { GridOverlay, type GridOverlayProps } from './opinionated/grid-overlay'
|
|
242
251
|
|
|
243
252
|
export {
|
|
@@ -272,11 +281,19 @@ export {
|
|
|
272
281
|
ItemSeparator,
|
|
273
282
|
ItemTitle,
|
|
274
283
|
type ItemProps,
|
|
284
|
+
type ItemVariants,
|
|
275
285
|
} from './opinionated/item'
|
|
276
286
|
|
|
277
287
|
export { Label } from './opinionated/label'
|
|
278
288
|
|
|
279
|
-
export {
|
|
289
|
+
export {
|
|
290
|
+
Section,
|
|
291
|
+
NewspaperGrid,
|
|
292
|
+
NewspaperCell,
|
|
293
|
+
type NewspaperCellProps,
|
|
294
|
+
type NewspaperGridProps,
|
|
295
|
+
type SectionProps,
|
|
296
|
+
} from './opinionated/layout'
|
|
280
297
|
|
|
281
298
|
export { BentoGrid, BentoCell } from './opinionated/layout-bento'
|
|
282
299
|
|
|
@@ -408,8 +425,8 @@ export {
|
|
|
408
425
|
|
|
409
426
|
export { Slider } from './opinionated/slider'
|
|
410
427
|
export { Toaster } from './opinionated/sonner'
|
|
411
|
-
export { Spacer } from './opinionated/spacer'
|
|
412
|
-
export { Stack } from './opinionated/stack'
|
|
428
|
+
export { Spacer, type SpacerProps } from './opinionated/spacer'
|
|
429
|
+
export { Stack, type StackProps } from './opinionated/stack'
|
|
413
430
|
export { Switch } from './opinionated/switch'
|
|
414
431
|
|
|
415
432
|
export {
|
|
@@ -423,7 +440,13 @@ export {
|
|
|
423
440
|
TableRow,
|
|
424
441
|
} from './opinionated/table'
|
|
425
442
|
|
|
426
|
-
export {
|
|
443
|
+
export {
|
|
444
|
+
Tabs,
|
|
445
|
+
TabsContent,
|
|
446
|
+
type TabItem,
|
|
447
|
+
type TabsProps,
|
|
448
|
+
type TabsVariant,
|
|
449
|
+
} from './opinionated/tabs'
|
|
427
450
|
|
|
428
451
|
export { Textarea } from './opinionated/textarea'
|
|
429
452
|
export { ThemeInjector } from './opinionated/theme-injector'
|
|
@@ -437,7 +460,7 @@ export {
|
|
|
437
460
|
|
|
438
461
|
export { Tooltip, TooltipContent, TooltipTrigger, type TooltipProps } from './opinionated/tooltip'
|
|
439
462
|
|
|
440
|
-
export { Typography } from './opinionated/typography'
|
|
463
|
+
export { Typography, type TypographyProps, type TypographyVariant } from './opinionated/typography'
|
|
441
464
|
|
|
442
465
|
// Token config panel (advanced)
|
|
443
466
|
export { TokenConfigPanel } from './opinionated/token-config-panel'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Accordion as AccordionPrimitiveBase } from '@base-ui/react/accordion'
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
2
3
|
import type * as React from 'react'
|
|
3
4
|
|
|
4
5
|
import {
|
|
@@ -6,8 +7,12 @@ import {
|
|
|
6
7
|
AccordionItem,
|
|
7
8
|
Accordion as AccordionPrimitive,
|
|
8
9
|
AccordionTrigger,
|
|
10
|
+
type accordionVariants,
|
|
9
11
|
} from '../_internal/accordion'
|
|
10
12
|
|
|
13
|
+
/** Visual style variants available for the Accordion. */
|
|
14
|
+
export type AccordionVariant = NonNullable<VariantProps<typeof accordionVariants>['variant']>
|
|
15
|
+
|
|
11
16
|
/** A single panel in an Accordion. */
|
|
12
17
|
export interface AccordionItemData {
|
|
13
18
|
/** Unique identifier for this panel (used for controlled open state). */
|
|
@@ -31,11 +36,13 @@ export interface AccordionItemData {
|
|
|
31
36
|
* <Accordion items={[
|
|
32
37
|
* { value: 'faq-1', trigger: 'What is this?', content: 'A component library.' },
|
|
33
38
|
* { value: 'faq-2', trigger: 'How do I install it?', content: '...', defaultOpen: true },
|
|
34
|
-
* ]} />
|
|
39
|
+
* ]} variant="separated" />
|
|
35
40
|
* ```
|
|
36
41
|
*/
|
|
37
42
|
export interface AccordionProps extends Omit<AccordionPrimitiveBase.Root.Props, 'children'> {
|
|
38
43
|
className?: string
|
|
44
|
+
/** Visual style of the accordion. @default 'default' */
|
|
45
|
+
variant?: AccordionVariant
|
|
39
46
|
/** Panels to render. When provided, `children` is ignored. */
|
|
40
47
|
items?: AccordionItemData[]
|
|
41
48
|
children?: React.ReactNode
|
|
@@ -46,6 +53,7 @@ function Accordion({
|
|
|
46
53
|
items,
|
|
47
54
|
children,
|
|
48
55
|
defaultValue,
|
|
56
|
+
variant = 'default',
|
|
49
57
|
...accordionProps
|
|
50
58
|
}: AccordionProps) {
|
|
51
59
|
// If items prop is provided, use opinionated API
|
|
@@ -59,6 +67,7 @@ function Accordion({
|
|
|
59
67
|
<AccordionPrimitive
|
|
60
68
|
className={className}
|
|
61
69
|
defaultValue={computedDefaultValue}
|
|
70
|
+
variant={variant}
|
|
62
71
|
{...accordionProps}
|
|
63
72
|
>
|
|
64
73
|
{items.map((item) => (
|
|
@@ -74,7 +83,12 @@ function Accordion({
|
|
|
74
83
|
// Fallback to children-based API for advanced use cases
|
|
75
84
|
if (children) {
|
|
76
85
|
return (
|
|
77
|
-
<AccordionPrimitive
|
|
86
|
+
<AccordionPrimitive
|
|
87
|
+
className={className}
|
|
88
|
+
defaultValue={defaultValue}
|
|
89
|
+
variant={variant}
|
|
90
|
+
{...accordionProps}
|
|
91
|
+
>
|
|
78
92
|
{children}
|
|
79
93
|
</AccordionPrimitive>
|
|
80
94
|
)
|
|
@@ -82,7 +96,12 @@ function Accordion({
|
|
|
82
96
|
|
|
83
97
|
// If neither items nor children provided, return empty accordion
|
|
84
98
|
return (
|
|
85
|
-
<AccordionPrimitive
|
|
99
|
+
<AccordionPrimitive
|
|
100
|
+
className={className}
|
|
101
|
+
defaultValue={defaultValue}
|
|
102
|
+
variant={variant}
|
|
103
|
+
{...accordionProps}
|
|
104
|
+
>
|
|
86
105
|
{null}
|
|
87
106
|
</AccordionPrimitive>
|
|
88
107
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AlertTriangleIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon } from 'lucide-react'
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
2
3
|
import type * as React from 'react'
|
|
3
4
|
|
|
4
5
|
import {
|
|
@@ -6,10 +7,14 @@ import {
|
|
|
6
7
|
AlertDescription,
|
|
7
8
|
Alert as AlertPrimitive,
|
|
8
9
|
AlertTitle,
|
|
10
|
+
type alertVariants,
|
|
9
11
|
} from '../_internal/alert'
|
|
10
12
|
|
|
11
13
|
export type AlertType = 'notice' | 'negative' | 'positive' | 'default' | 'warning'
|
|
12
14
|
|
|
15
|
+
/** Visual style variants available for the Alert. */
|
|
16
|
+
export type AlertVariant = NonNullable<VariantProps<typeof alertVariants>['variant']>
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* Props for the opinionated Alert component.
|
|
15
20
|
*
|
|
@@ -21,15 +26,13 @@ export type AlertType = 'notice' | 'negative' | 'positive' | 'default' | 'warnin
|
|
|
21
26
|
* <Alert type="positive" title="Payment successful" message="Your invoice has been sent." />
|
|
22
27
|
* <Alert type="negative" title="Something went wrong" message={error.message} />
|
|
23
28
|
* <Alert type="notice" message="Your session expires in 5 minutes." />
|
|
29
|
+
* <Alert variant="brand" title="New feature" message="Try it today." />
|
|
24
30
|
* <Alert type="warning" title="Storage almost full">
|
|
25
31
|
* <Button size="sm">Upgrade plan</Button>
|
|
26
32
|
* </Alert>
|
|
27
33
|
* ```
|
|
28
34
|
*/
|
|
29
|
-
export interface AlertProps extends Omit<
|
|
30
|
-
React.ComponentProps<typeof AlertPrimitive>,
|
|
31
|
-
'variant' | 'title'
|
|
32
|
-
> {
|
|
35
|
+
export interface AlertProps extends Omit<React.ComponentProps<typeof AlertPrimitive>, 'title'> {
|
|
33
36
|
/**
|
|
34
37
|
* Semantic type that controls the icon and colour variant.
|
|
35
38
|
* - `default` — no icon, neutral styling
|
|
@@ -40,6 +43,10 @@ export interface AlertProps extends Omit<
|
|
|
40
43
|
* @default 'default'
|
|
41
44
|
*/
|
|
42
45
|
type?: AlertType
|
|
46
|
+
/**
|
|
47
|
+
* Visual style override. When omitted, the variant is derived from `type`.
|
|
48
|
+
*/
|
|
49
|
+
variant?: AlertVariant
|
|
43
50
|
/** Alert heading rendered in bold. */
|
|
44
51
|
title?: React.ReactNode
|
|
45
52
|
/** Alert body text. Alternatively pass `children`. */
|
|
@@ -57,10 +64,17 @@ function Alert({
|
|
|
57
64
|
children,
|
|
58
65
|
action,
|
|
59
66
|
className,
|
|
67
|
+
variant,
|
|
60
68
|
...alertProps
|
|
61
69
|
}: AlertProps) {
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
const typeVariants: Record<AlertType, AlertVariant> = {
|
|
71
|
+
default: 'default',
|
|
72
|
+
negative: 'destructive',
|
|
73
|
+
notice: 'info',
|
|
74
|
+
positive: 'success',
|
|
75
|
+
warning: 'warning',
|
|
76
|
+
}
|
|
77
|
+
const resolvedVariant = variant ?? typeVariants[type]
|
|
64
78
|
|
|
65
79
|
// Get icon based on type
|
|
66
80
|
const getIcon = () => {
|
|
@@ -82,7 +96,7 @@ function Alert({
|
|
|
82
96
|
const content = message || children
|
|
83
97
|
|
|
84
98
|
return (
|
|
85
|
-
<AlertPrimitive variant={
|
|
99
|
+
<AlertPrimitive variant={resolvedVariant} className={className} {...alertProps}>
|
|
86
100
|
{icon}
|
|
87
101
|
<div className="flex-1">
|
|
88
102
|
{title && <AlertTitle>{title}</AlertTitle>}
|
package/src/opinionated/tabs.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { Tabs as TabsPrimitiveBase } from '@base-ui/react/tabs'
|
|
2
|
-
import {
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
TabsList,
|
|
6
|
+
Tabs as TabsPrimitive,
|
|
7
|
+
TabsTrigger,
|
|
8
|
+
type tabsListVariants,
|
|
9
|
+
} from '../_internal/tabs'
|
|
3
10
|
|
|
4
11
|
/** A single tab in the Tabs navigation bar. */
|
|
5
12
|
export type TabItem = {
|
|
@@ -9,6 +16,9 @@ export type TabItem = {
|
|
|
9
16
|
label: string
|
|
10
17
|
}
|
|
11
18
|
|
|
19
|
+
/** Visual style variants available for the Tabs navigation bar. */
|
|
20
|
+
export type TabsVariant = NonNullable<VariantProps<typeof tabsListVariants>['variant']>
|
|
21
|
+
|
|
12
22
|
/**
|
|
13
23
|
* Props for the opinionated Tabs component.
|
|
14
24
|
*
|
|
@@ -31,7 +41,7 @@ export type TabItem = {
|
|
|
31
41
|
* <TabsContent value="settings">...</TabsContent>
|
|
32
42
|
* ```
|
|
33
43
|
*/
|
|
34
|
-
type TabsProps = Omit<TabsPrimitiveBase.Root.Props, 'children'> & {
|
|
44
|
+
export type TabsProps = Omit<TabsPrimitiveBase.Root.Props, 'children'> & {
|
|
35
45
|
/** Tab definitions to render in the navigation bar. */
|
|
36
46
|
items: TabItem[]
|
|
37
47
|
/** Currently active tab value. */
|
|
@@ -40,6 +50,8 @@ type TabsProps = Omit<TabsPrimitiveBase.Root.Props, 'children'> & {
|
|
|
40
50
|
onValueChange: (value: string) => void
|
|
41
51
|
/** Accessible label for the tab list (for screen readers). */
|
|
42
52
|
ariaLabel?: string
|
|
53
|
+
/** Visual style of the tab list. @default 'line' */
|
|
54
|
+
variant?: TabsVariant
|
|
43
55
|
className?: string
|
|
44
56
|
}
|
|
45
57
|
|
|
@@ -48,12 +60,13 @@ export const Tabs = ({
|
|
|
48
60
|
value,
|
|
49
61
|
onValueChange,
|
|
50
62
|
ariaLabel,
|
|
63
|
+
variant = 'line',
|
|
51
64
|
className,
|
|
52
65
|
...tabsProps
|
|
53
66
|
}: TabsProps) => {
|
|
54
67
|
return (
|
|
55
68
|
<TabsPrimitive value={value} onValueChange={onValueChange} className={className} {...tabsProps}>
|
|
56
|
-
<TabsList variant=
|
|
69
|
+
<TabsList variant={variant} aria-label={ariaLabel}>
|
|
57
70
|
{items.map((item) => (
|
|
58
71
|
<TabsTrigger key={item.value} value={item.value}>
|
|
59
72
|
{item.label}
|
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
File structure:
|
|
9
9
|
tokens/palette.css — Primitive color scales (build-time + runtime)
|
|
10
|
-
tokens/tailwind-
|
|
10
|
+
tokens/tailwind-color-adapter.css — Generated Tailwind color aliases
|
|
11
|
+
tokens/tailwind-theme.css — Non-color Tailwind theme registrations
|
|
11
12
|
tokens/semantic.css — Semantic role tokens (:root + .dark)
|
|
12
13
|
tokens/components.css — Component-level tunables
|
|
14
|
+
presets/default.css — The canonical default light/dark preset
|
|
15
|
+
tokens/semantic-utilities.css — Generated public semantic classes
|
|
13
16
|
tokens/base.css — Global base styles (@layer base)
|
|
14
17
|
============================================================================ */
|
|
15
18
|
|
|
@@ -62,7 +65,10 @@
|
|
|
62
65
|
|
|
63
66
|
/* ── Token layers ─────────────────────────────────────────────────────── */
|
|
64
67
|
@import './tokens/palette.css';
|
|
68
|
+
@import './tokens/tailwind-color-adapter.css';
|
|
65
69
|
@import './tokens/tailwind-theme.css';
|
|
66
70
|
@import './tokens/semantic.css';
|
|
67
71
|
@import './tokens/components.css';
|
|
72
|
+
@import './presets/default.css';
|
|
73
|
+
@import './tokens/semantic-utilities.css';
|
|
68
74
|
@import './tokens/base.css';
|