@gears-frontx/ui-kit 0.4.0-alpha.4 → 0.4.0-alpha.6
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 +1 -1
- package/dist/accordion.js +7 -7
- package/dist/alert-dialog.js +21 -21
- package/dist/alert.js +19 -19
- package/dist/attachment.js +11 -11
- package/dist/avatar.js +33 -33
- package/dist/badge.js +48 -25
- package/dist/badge.js.map +1 -1
- package/dist/bubble.js +38 -38
- package/dist/button-group.js +8 -8
- package/dist/button.js +40 -34
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +30 -30
- package/dist/card.js +56 -33
- package/dist/card.js.map +1 -1
- package/dist/chart.js +183 -115
- package/dist/chart.js.map +1 -1
- package/dist/checkbox.js +12 -12
- package/dist/checkbox.js.map +1 -1
- package/dist/chunks/accordion.CXlSdkrc.css +1 -0
- package/dist/chunks/alert-dialog.C4aLtUC8.css +1 -0
- package/dist/chunks/alert.DsgRIXLn.css +1 -0
- package/dist/chunks/attachment.CZuZdlXC.css +1 -0
- package/dist/chunks/avatar.BMm-Z9l5.css +1 -0
- package/dist/chunks/badge.BCreEn3O.css +1 -0
- package/dist/chunks/bubble.Ccu0e3lY.css +1 -0
- package/dist/chunks/button-group.BB-_2uav.css +1 -0
- package/dist/chunks/button.DgUTlW0_.css +1 -0
- package/dist/chunks/calendar.Dtndav4F.css +1 -0
- package/dist/chunks/card.DdBl-usf.css +1 -0
- package/dist/chunks/checkbox.CrdIZhi1.css +1 -0
- package/dist/chunks/collapsible.BkLeBug_.css +1 -0
- package/dist/chunks/combobox.DZZ3tHP_.css +1 -0
- package/dist/chunks/command.BBW1Cy-M.css +1 -0
- package/dist/chunks/context-menu.D_HuTgqL.css +1 -0
- package/dist/chunks/data-table.DJJaM7bh.css +1 -0
- package/dist/chunks/dialog.Cpo8vChK.css +1 -0
- package/dist/chunks/drawer.D8l6-G8t.css +1 -0
- package/dist/chunks/dropdown-menu.TU3FHXbJ.css +1 -0
- package/dist/chunks/empty.DnAKlw2g.css +1 -0
- package/dist/chunks/field.CDoJmJUe.css +1 -0
- package/dist/chunks/hover-card.D00tbys5.css +1 -0
- package/dist/chunks/input-group.C7XgalVn.css +1 -0
- package/dist/chunks/input-otp.Dvxlngb4.css +1 -0
- package/dist/chunks/input.DORly3Cx.css +1 -0
- package/dist/chunks/{label.jrB9zD_G.css → label.s0Wrm1i-.css} +1 -1
- package/dist/chunks/{menubar.CxRNI9o4.css → menubar.CJcVQhPq.css} +1 -1
- package/dist/chunks/message.B9Rexp_f.css +1 -0
- package/dist/chunks/native-select.BosBdRAx.css +1 -0
- package/dist/chunks/navigation-menu.CuXMCPRN.css +1 -0
- package/dist/chunks/pagination.bFb5us_w.css +1 -0
- package/dist/chunks/popover.BYhwNKnZ.css +1 -0
- package/dist/chunks/progress.DjSEXfxh.css +1 -0
- package/dist/chunks/questionnaire.C-YTRjPE.css +1 -0
- package/dist/chunks/radio-group.CisvBT6g.css +1 -0
- package/dist/chunks/scroll-area.B0OVmDRX.css +1 -0
- package/dist/chunks/select.BFwI5rhI.css +1 -0
- package/dist/chunks/sheet.BWvXXyXk.css +1 -0
- package/dist/chunks/sidebar.DdEvMURX.css +1 -0
- package/dist/chunks/slider.inyNxx4y.css +1 -0
- package/dist/chunks/spinner.sH6x_1Uf.css +1 -0
- package/dist/chunks/status-dot.DWa2qGKe.css +1 -0
- package/dist/chunks/switch.D3_ZyuVP.css +1 -0
- package/dist/chunks/table.DR2nFT0x.css +1 -0
- package/dist/chunks/tabs.DFa0OYMo.css +1 -0
- package/dist/chunks/{textarea.ORRSI69B.css → textarea.DMphp0qh.css} +1 -1
- package/dist/chunks/toast.Dw-jW4YY.css +1 -0
- package/dist/chunks/toggle-group.BpWF6enM.css +1 -0
- package/dist/chunks/toggle.B82Id2zR.css +1 -0
- package/dist/chunks/tooltip.CFJyyz-O.css +1 -0
- package/dist/collapsible.js +7 -7
- package/dist/combobox.js +87 -87
- package/dist/command.js +28 -28
- package/dist/components/badge/badge.d.ts +5 -2
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +10 -4
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/chart/chart.d.ts +7 -6
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +9 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/empty/empty.d.ts +11 -0
- package/dist/components/empty/empty.d.ts.map +1 -1
- package/dist/components/empty/public.d.ts +1 -1
- package/dist/components/empty/public.d.ts.map +1 -1
- package/dist/components/input-group/input-group.d.ts +5 -2
- package/dist/components/input-group/input-group.d.ts.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.ts +7 -2
- package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/pagination/pagination.d.ts +4 -6
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/spinner/spinner.d.ts +19 -3
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/status-dot/public.d.ts +2 -0
- package/dist/components/status-dot/public.d.ts.map +1 -0
- package/dist/components/status-dot/status-dot.d.ts +25 -0
- package/dist/components/status-dot/status-dot.d.ts.map +1 -0
- package/dist/components/table/table.d.ts +31 -5
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/tabs/tabs.d.ts +10 -2
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/toggle/toggle.d.ts +12 -2
- package/dist/components/toggle/toggle.d.ts.map +1 -1
- package/dist/components/toggle-group/toggle-group.d.ts +33 -4
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +5 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/context-menu.js +54 -54
- package/dist/data-table.js +41 -41
- package/dist/dialog.js +39 -39
- package/dist/docs/alert-dialog.md +1 -1
- package/dist/docs/avatar.md +3 -1
- package/dist/docs/badge.md +42 -14
- package/dist/docs/button.md +3 -2
- package/dist/docs/card.md +6 -0
- package/dist/docs/chart.md +20 -14
- package/dist/docs/checkbox.md +6 -0
- package/dist/docs/command.md +4 -0
- package/dist/docs/data-table.md +12 -7
- package/dist/docs/dialog.md +3 -2
- package/dist/docs/dropdown-menu.md +6 -0
- package/dist/docs/empty.md +44 -9
- package/dist/docs/input-group.md +23 -3
- package/dist/docs/navigation-menu.md +14 -5
- package/dist/docs/pagination.md +18 -15
- package/dist/docs/popover.md +6 -0
- package/dist/docs/progress.md +6 -0
- package/dist/docs/questionnaire.md +4 -2
- package/dist/docs/select.md +8 -4
- package/dist/docs/sheet.md +8 -7
- package/dist/docs/spinner.md +35 -5
- package/dist/docs/status-dot.md +77 -0
- package/dist/docs/table.md +69 -25
- package/dist/docs/tabs.md +22 -7
- package/dist/docs/toggle-group.md +68 -9
- package/dist/docs/toggle.md +7 -1
- package/dist/docs/tooltip.md +5 -9
- package/dist/drawer.js +53 -53
- package/dist/dropdown-menu.js +102 -89
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/empty.js +31 -21
- package/dist/empty.js.map +1 -1
- package/dist/field.js +24 -24
- package/dist/hover-card.js +14 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +266 -261
- package/dist/index.js.map +1 -1
- package/dist/input-group.js +73 -50
- package/dist/input-group.js.map +1 -1
- package/dist/input-otp.js +3 -3
- package/dist/input.js +19 -19
- package/dist/label.js +1 -1
- package/dist/menubar.js +18 -18
- package/dist/message.js +11 -11
- package/dist/native-select.js +20 -20
- package/dist/navigation-menu.js +83 -64
- package/dist/navigation-menu.js.map +1 -1
- package/dist/pagination.js +39 -52
- package/dist/pagination.js.map +1 -1
- package/dist/popover.js +33 -31
- package/dist/popover.js.map +1 -1
- package/dist/progress.js +15 -15
- package/dist/questionnaire.js +72 -72
- package/dist/radio-group.js +7 -7
- package/dist/scroll-area.js +8 -8
- package/dist/select.js +82 -80
- package/dist/select.js.map +1 -1
- package/dist/sheet.js +46 -46
- package/dist/sidebar.js +130 -130
- package/dist/slider.js +14 -14
- package/dist/spinner.js +45 -13
- package/dist/spinner.js.map +1 -1
- package/dist/status-dot.d.ts +1 -0
- package/dist/status-dot.js +76 -0
- package/dist/status-dot.js.map +1 -0
- package/dist/switch.js +14 -14
- package/dist/table.js +221 -43
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +44 -26
- package/dist/tabs.js.map +1 -1
- package/dist/textarea.js +5 -5
- package/dist/theme.css +222 -135
- package/dist/toast.js +26 -26
- package/dist/toggle-group.js +40 -25
- package/dist/toggle-group.js.map +1 -1
- package/dist/toggle.js +21 -11
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.js +37 -34
- package/dist/tooltip.js.map +1 -1
- package/llms.txt +26 -10
- package/package.json +1 -1
- package/dist/chunks/accordion.X_AK08Iv.css +0 -1
- package/dist/chunks/alert-dialog.B50f-Gsz.css +0 -1
- package/dist/chunks/alert.C5BedF7l.css +0 -1
- package/dist/chunks/attachment.GAZbWSyB.css +0 -1
- package/dist/chunks/avatar.DZUXl1ev.css +0 -1
- package/dist/chunks/badge.Bi22h20j.css +0 -1
- package/dist/chunks/bubble.DvN6QyQ1.css +0 -1
- package/dist/chunks/button-group.D0Ir-jbL.css +0 -1
- package/dist/chunks/button.DvAxXxKj.css +0 -1
- package/dist/chunks/calendar.Cnbv4EzY.css +0 -1
- package/dist/chunks/card.D3Ct_dza.css +0 -1
- package/dist/chunks/checkbox.CZfE_PkU.css +0 -1
- package/dist/chunks/collapsible.BQ-sU5sQ.css +0 -1
- package/dist/chunks/combobox.CtYpZAKB.css +0 -1
- package/dist/chunks/command.Km60IuqD.css +0 -1
- package/dist/chunks/context-menu.DwGCD0vN.css +0 -1
- package/dist/chunks/data-table.CtZdVSAU.css +0 -1
- package/dist/chunks/dialog.BxcZ12Gb.css +0 -1
- package/dist/chunks/drawer.BkS_qEHj.css +0 -1
- package/dist/chunks/dropdown-menu.C5TLD9JO.css +0 -1
- package/dist/chunks/empty.BlhsHrOz.css +0 -1
- package/dist/chunks/field.Ccqt897k.css +0 -1
- package/dist/chunks/hover-card.DmwvigMp.css +0 -1
- package/dist/chunks/input-group.CFIUP-Oh.css +0 -1
- package/dist/chunks/input-otp.XSpqyVij.css +0 -1
- package/dist/chunks/input.DvA_mTq8.css +0 -1
- package/dist/chunks/message.BhD5JDJK.css +0 -1
- package/dist/chunks/native-select.DF1QrNz4.css +0 -1
- package/dist/chunks/navigation-menu.C2JGHAKD.css +0 -1
- package/dist/chunks/pagination.DUiQuWla.css +0 -1
- package/dist/chunks/popover.fOvPrnsr.css +0 -1
- package/dist/chunks/progress.Bp13t8iw.css +0 -1
- package/dist/chunks/questionnaire.D-u_K3Co.css +0 -1
- package/dist/chunks/radio-group.CV3MBCsI.css +0 -1
- package/dist/chunks/scroll-area.C4kWMAsU.css +0 -1
- package/dist/chunks/select.iEwV-sfJ.css +0 -1
- package/dist/chunks/sheet.DALPg9vf.css +0 -1
- package/dist/chunks/sidebar.CGTQhfWG.css +0 -1
- package/dist/chunks/slider.B5nouD7J.css +0 -1
- package/dist/chunks/spinner.UKK4f1tu.css +0 -1
- package/dist/chunks/switch.CIW9Jr1x.css +0 -1
- package/dist/chunks/table.BpnQ6j85.css +0 -1
- package/dist/chunks/tabs.4MEFBvw-.css +0 -1
- package/dist/chunks/toast.uUtCEAiv.css +0 -1
- package/dist/chunks/toggle-group.Bd0cCCnV.css +0 -1
- package/dist/chunks/toggle.B9tvfl1n.css +0 -1
- package/dist/chunks/tooltip.apA3VWHJ.css +0 -1
package/dist/docs/table.md
CHANGED
|
@@ -32,7 +32,8 @@ no kit-specific props of its own.
|
|
|
32
32
|
## The scroll wrapper
|
|
33
33
|
|
|
34
34
|
`Table` renders two elements: a wrapper `div` around the `<table>`, scrolling
|
|
35
|
-
horizontally when the table is wider than its container
|
|
35
|
+
horizontally when the table is wider than its container, and vertically
|
|
36
|
+
once you give it a height. This matches the
|
|
36
37
|
upstream source exactly, which takes the same view — a table that can
|
|
37
38
|
overflow needs *something* to scroll, and it's simpler for that to be
|
|
38
39
|
Table's own responsibility than to ask every consumer to remember to add a
|
|
@@ -50,9 +51,13 @@ kind of runtime behavior is exactly what this "primitive markup" component
|
|
|
50
51
|
intentionally does not have.
|
|
51
52
|
|
|
52
53
|
If you need a *vertical* scroll region too (capping a long table's height),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Table
|
|
54
|
+
give the wrapper itself a `max-height` through `containerClassName` or
|
|
55
|
+
`containerStyle` (see Examples). Do not put a `div` of your own with
|
|
56
|
+
`overflow-y` around `<Table>` instead: a sticky header sticks to its nearest
|
|
57
|
+
scrolling ancestor, which is Table's own wrapper since it already scrolls
|
|
58
|
+
horizontally. Your outer div would scroll while the wrapper, with no height
|
|
59
|
+
of its own, never does, so the collection view's header would scroll away
|
|
60
|
+
with the rows.
|
|
56
61
|
|
|
57
62
|
A focus stop should announce something: pass `label` to name the wrapper
|
|
58
63
|
(`role="region"` + `aria-label` — a bare `div`'s `aria-label` is ignored
|
|
@@ -61,9 +66,9 @@ labelling your own outer `div` doesn't work: the name lands on a
|
|
|
61
66
|
non-focusable element while the focusable wrapper stays nameless).
|
|
62
67
|
Without `label` the wrapper is roleless and nameless as before. Prefer
|
|
63
68
|
passing it whenever the surrounding page doesn't make the table's purpose
|
|
64
|
-
obvious the moment focus lands. Beyond `label`, the wrapper takes
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
obvious the moment focus lands. Beyond `label`, the wrapper takes
|
|
70
|
+
`containerClassName` and `containerStyle`, merged after its kit class; it
|
|
71
|
+
isn't a separate export.
|
|
67
72
|
|
|
68
73
|
## Semantics and accessibility
|
|
69
74
|
|
|
@@ -197,11 +202,46 @@ its separator, since the body is then no longer the last section.
|
|
|
197
202
|
|
|
198
203
|
## Props (kit level)
|
|
199
204
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
`Table`:
|
|
206
|
+
|
|
207
|
+
| Prop | Type | Default |
|
|
208
|
+
|------|------|---------|
|
|
209
|
+
| `label` | `string` - names the focusable scroll wrapper with `role="region"` + `aria-label` (see above) | - |
|
|
210
|
+
| `density` | `'default'` \| `'compact'` - tightens cell padding for operational views; purely cell metrics, not a data-table feature | `'default'` |
|
|
211
|
+
| `variant` | `'default'` \| `'collection'` - collection is the fixed-layout view with a sticky 40 px header and 64 px rows | `'default'` |
|
|
212
|
+
| `containerClassName` | `string` - className for the scroll wrapper; give it a `max-height` to scroll the rows under a sticky header | - |
|
|
213
|
+
| `containerStyle` | `CSSProperties` - inline style for the same wrapper, e.g. `{ maxHeight: 320 }` | - |
|
|
214
|
+
|
|
215
|
+
`TableHead`:
|
|
216
|
+
|
|
217
|
+
| Prop | Type | Default |
|
|
218
|
+
|------|------|---------|
|
|
219
|
+
| `resizable` | `boolean` - draggable and keyboard-resizable trailing edge | `false` |
|
|
220
|
+
| `resizeMinWidth` | `number` - px floor for this column, overriding the 72 / 32 defaults | - |
|
|
221
|
+
|
|
222
|
+
The two axes on `Table` are orthogonal: `collection` sets the layout, the
|
|
223
|
+
header and the row height, and `density` still tightens the cells inside
|
|
224
|
+
it.
|
|
225
|
+
|
|
226
|
+
A resizable column trades width with its trailing neighbour, so the table's
|
|
227
|
+
own width never changes as an inner boundary moves; the first drag freezes
|
|
228
|
+
every column at what it currently renders, switches the table to a fixed
|
|
229
|
+
layout and pins the table's width to the sum of its columns. The last
|
|
230
|
+
column has no neighbour, so dragging it changes the table's width instead:
|
|
231
|
+
the table can end up narrower than its container, or wider (the wrapper
|
|
232
|
+
then scrolls). It still stops at the table's own `min-width` (the collection
|
|
233
|
+
view's 960 px), so what the handle announces is always the width on
|
|
234
|
+
screen. The handle is an 8 px grab area straddling the trailing edge, drawn
|
|
235
|
+
as a 1 px `--border` hairline that thickens to 2 px `--primary` while
|
|
236
|
+
hovered, focused or dragged. It is focusable, carries `role="separator"`,
|
|
237
|
+
and its accessible name reports the column's current pixel width live;
|
|
238
|
+
arrow keys move the boundary 12 px per press.
|
|
239
|
+
|
|
240
|
+
In the collection view a row carrying `data-pending` fills with `--muted`
|
|
241
|
+
and shows a progress cursor, and a row the caller makes focusable (a
|
|
242
|
+
`tabIndex`) takes a pointer cursor and a focus ring.
|
|
243
|
+
|
|
244
|
+
Every other prop is the matching native element's own (`ComponentProps<'table'>`,
|
|
205
245
|
`<'thead'>`, `<'tbody'>`, `<'tfoot'>`, `<'tr'>`, `<'th'>`, `<'td'>`,
|
|
206
246
|
`<'caption'>`), plus `className`, merged after the kit class on every
|
|
207
247
|
part.
|
|
@@ -274,21 +314,25 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@
|
|
|
274
314
|
</Table>;
|
|
275
315
|
```
|
|
276
316
|
|
|
277
|
-
A vertical scroll region
|
|
278
|
-
"The scroll wrapper"
|
|
317
|
+
A vertical scroll region on `Table`'s own wrapper, with the collection
|
|
318
|
+
view's header staying in place over the rows (see "The scroll wrapper"
|
|
319
|
+
above):
|
|
279
320
|
|
|
280
321
|
```tsx
|
|
281
|
-
import { Table, TableBody, TableCell, TableRow } from '@gears-frontx/ui-kit';
|
|
282
|
-
|
|
283
|
-
<
|
|
284
|
-
<
|
|
285
|
-
<
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
</
|
|
322
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@gears-frontx/ui-kit';
|
|
323
|
+
|
|
324
|
+
<Table variant="collection" containerStyle={{ maxHeight: '20rem' }}>
|
|
325
|
+
<TableHeader>
|
|
326
|
+
<TableRow>
|
|
327
|
+
<TableHead>Name</TableHead>
|
|
328
|
+
</TableRow>
|
|
329
|
+
</TableHeader>
|
|
330
|
+
<TableBody>
|
|
331
|
+
<TableRow>
|
|
332
|
+
<TableCell>Row 1</TableCell>
|
|
333
|
+
</TableRow>
|
|
334
|
+
</TableBody>
|
|
335
|
+
</Table>;
|
|
292
336
|
```
|
|
293
337
|
|
|
294
338
|
A row with a leading checkbox column, sized flush against the cell edge by
|
package/dist/docs/tabs.md
CHANGED
|
@@ -12,6 +12,11 @@ Composition: `Tabs` (root, holds the selected value) → `TabsList` (→ one
|
|
|
12
12
|
`TabsTrigger` per tab) → one `TabsContent` per tab, matched to its trigger
|
|
13
13
|
by `value`.
|
|
14
14
|
|
|
15
|
+
`TabsList` renders the indicator itself: one bar per list that travels to
|
|
16
|
+
the active tab over 240 ms, positioned from the geometry Base UI measures
|
|
17
|
+
at runtime. There is no indicator part to place, because every list has
|
|
18
|
+
exactly one.
|
|
19
|
+
|
|
15
20
|
## When to use
|
|
16
21
|
|
|
17
22
|
- Grouping related views that don't need to be compared side by side —
|
|
@@ -43,7 +48,8 @@ by `value`.
|
|
|
43
48
|
|
|
44
49
|
| Prop | Type | Default |
|
|
45
50
|
|------|------|---------|
|
|
46
|
-
| `variant` | `default` \| `line`
|
|
51
|
+
| `variant` | `default` \| `line` - `line` is a trackless row with one 3px `--primary` bar travelling under the active tab. `default` is the filled track: a `--muted` strip at a 10px corner insetting its triggers by 3, whose active tab takes `--secondary` with a 1px `--border` hairline and no bar. A bordered segmented-control look is not a Tabs variant; that styling belongs to `toggle-group` | `default` |
|
|
52
|
+
| `size` | `sm` \| `default` - a 12/16 or a 14/20 label; nothing else moves between the two | `default` |
|
|
47
53
|
| `className` | `string` — merged after the kit class | — |
|
|
48
54
|
|
|
49
55
|
`TabsTrigger`: `value` (required, matches a `TabsContent`), `disabled`;
|
|
@@ -53,6 +59,15 @@ other props follow Base UI `Tabs.Tab`. Renders a native `<button>`.
|
|
|
53
59
|
(keep the panel in the DOM while inactive instead of unmounting it —
|
|
54
60
|
`false` by default); other props follow Base UI `Tabs.Panel`.
|
|
55
61
|
|
|
62
|
+
| Prop | Type | Default |
|
|
63
|
+
|------|------|---------|
|
|
64
|
+
| `animate` | `boolean` - replay the enter animation each time this panel becomes the active one: a fade up over 4px, on the list's own 240 ms step. Under `prefers-reduced-motion` the panel still fades but does not travel | `true` |
|
|
65
|
+
|
|
66
|
+
Switching tabs therefore moves two things together: the indicator travels
|
|
67
|
+
to the new trigger while its panel arrives. Opt out per panel with
|
|
68
|
+
`animate={false}` where the content animates itself, or must not move at
|
|
69
|
+
all.
|
|
70
|
+
|
|
56
71
|
Set `orientation="vertical"` on `Tabs` for a sidebar-style layout (list on
|
|
57
72
|
the side, panel beside it instead of below it) — every part reads its own
|
|
58
73
|
`data-orientation`, so no other prop changes.
|
|
@@ -110,15 +125,15 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@gears-frontx/ui-kit';
|
|
|
110
125
|
position, uncommitted form input) unless you pass `keepMounted` — by
|
|
111
126
|
default an inactive panel unmounts, and remounts from scratch when
|
|
112
127
|
reselected.
|
|
113
|
-
- Do not reach for `variant="line"` expecting an animated highlight that
|
|
114
|
-
slides between tabs — the underline is a per-tab crossfade, not a
|
|
115
|
-
single element in motion.
|
|
116
128
|
- Do not omit `defaultValue`/`value` and leave the first `TabsTrigger`
|
|
117
129
|
disabled — Base UI falls back to the next enabled tab client-side, but
|
|
118
130
|
it can't do that during server-side rendering (it doesn't yet know
|
|
119
131
|
which tabs are disabled while pre-rendering), so the server- and
|
|
120
132
|
client-rendered output disagree. Set `defaultValue`/`value` explicitly
|
|
121
133
|
to an enabled tab's value whenever the first one might be disabled.
|
|
122
|
-
- Do not
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
- Do not size an icon inside a `TabsTrigger` yourself: the trigger draws
|
|
135
|
+
every direct `svg` child at the drawn 16px box.
|
|
136
|
+
- Do not add a wrapper keyed on the active value to replay an enter
|
|
137
|
+
animation - `TabsContent` already animates on becoming active, and a
|
|
138
|
+
keyed wrapper on top of it remounts the content twice as often as the
|
|
139
|
+
panel does.
|
|
@@ -28,11 +28,13 @@ navigation between items, state via `data-pressed` on each item.
|
|
|
28
28
|
| `disabled` | disables every item in the group | `false` |
|
|
29
29
|
| `variant` | `default` \| `outline` — applied to every item unless an item overrides it | `default` |
|
|
30
30
|
| `size` | `default` \| `sm` \| `lg` — applied to every item unless an item overrides it | `default` |
|
|
31
|
+
| `spacing` | `number` - gap between items, in pixels; `0` also switches to the segmented look (see "Segmented geometry") | `undefined` |
|
|
32
|
+
| `iconOnly` | `boolean` - every item holds a glyph and nothing else: each squares up to the group's size step (32 at `sm`) and draws its glyph at 18; an item's own `iconOnly` applies where the group leaves it unset | `undefined` |
|
|
31
33
|
| `className` | `string` — merged after the kit class | — |
|
|
32
34
|
|
|
33
35
|
`ToggleGroupItem`: `value` (required — identifies the item), `variant`,
|
|
34
|
-
`size` (fall back to the group's when the group sets one),
|
|
35
|
-
other props follow Base UI Toggle (`disabled`, ...).
|
|
36
|
+
`size`, `iconOnly` (fall back to the group's when the group sets one),
|
|
37
|
+
`className`; other props follow Base UI Toggle (`disabled`, ...).
|
|
36
38
|
|
|
37
39
|
## Examples
|
|
38
40
|
|
|
@@ -57,6 +59,14 @@ import { ToggleGroup, ToggleGroupItem } from '@gears-frontx/ui-kit';
|
|
|
57
59
|
<ToggleGroupItem value="list" aria-label="List view"><ListIcon /></ToggleGroupItem>
|
|
58
60
|
<ToggleGroupItem value="grid" aria-label="Grid view"><GridIcon /></ToggleGroupItem>
|
|
59
61
|
</ToggleGroup>
|
|
62
|
+
|
|
63
|
+
// Segmented (spacing={0}) - a single bordered strip instead of
|
|
64
|
+
// independently bordered items; pair with variant="outline" for the
|
|
65
|
+
// border to actually show.
|
|
66
|
+
<ToggleGroup spacing={0} variant="outline" aria-label="View mode">
|
|
67
|
+
<ToggleGroupItem value="list" aria-label="List view"><ListIcon /></ToggleGroupItem>
|
|
68
|
+
<ToggleGroupItem value="grid" aria-label="Grid view"><GridIcon /></ToggleGroupItem>
|
|
69
|
+
</ToggleGroup>
|
|
60
70
|
```
|
|
61
71
|
|
|
62
72
|
## Anti-patterns
|
|
@@ -67,11 +77,60 @@ import { ToggleGroup, ToggleGroupItem } from '@gears-frontx/ui-kit';
|
|
|
67
77
|
- Do not omit `aria-label`/`aria-labelledby` on the group — it groups
|
|
68
78
|
buttons, but the group itself still needs a name for assistive tech.
|
|
69
79
|
|
|
70
|
-
##
|
|
80
|
+
## Icon view switch
|
|
81
|
+
|
|
82
|
+
The drawn single-choice icon switch: one square 32 box per option, glyphs
|
|
83
|
+
at 18, no gap between them, a hairline strip around the whole thing, and
|
|
84
|
+
exactly one option chosen at a time. Every part of it is already a prop -
|
|
85
|
+
`spacing={0}` collapses the gap and joins the borders, `variant="outline"`
|
|
86
|
+
draws the hairline, `iconOnly` squares the items, and single selection is
|
|
87
|
+
what the group does unless `multiple` is set.
|
|
88
|
+
|
|
89
|
+
Each option carries its own accessible name: the label is not drawn, so it
|
|
90
|
+
lives in `aria-label` rather than in hidden text. The group needs a name of
|
|
91
|
+
its own too.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { ToggleGroup, ToggleGroupItem } from '@gears-frontx/ui-kit';
|
|
95
|
+
import { LayoutGridIcon, ListIcon, TableIcon } from 'lucide-react';
|
|
96
|
+
|
|
97
|
+
const [view, setView] = useState('list');
|
|
98
|
+
|
|
99
|
+
<ToggleGroup
|
|
100
|
+
size="sm"
|
|
101
|
+
spacing={0}
|
|
102
|
+
variant="outline"
|
|
103
|
+
iconOnly
|
|
104
|
+
value={[view]}
|
|
105
|
+
onValueChange={([next]) => next && setView(next)}
|
|
106
|
+
aria-label="View"
|
|
107
|
+
>
|
|
108
|
+
<ToggleGroupItem value="list" aria-label="List"><ListIcon /></ToggleGroupItem>
|
|
109
|
+
<ToggleGroupItem value="grid" aria-label="Grid"><LayoutGridIcon /></ToggleGroupItem>
|
|
110
|
+
<ToggleGroupItem value="table" aria-label="Table"><TableIcon /></ToggleGroupItem>
|
|
111
|
+
</ToggleGroup>;
|
|
112
|
+
```
|
|
71
113
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
114
|
+
`onValueChange` hands back an array even in single selection, and that
|
|
115
|
+
array is empty when the chosen option is pressed again. Guarding on
|
|
116
|
+
`next` is what keeps a view switch from ending up with nothing chosen; drop
|
|
117
|
+
the guard where deselecting is a real state.
|
|
118
|
+
|
|
119
|
+
## Segmented geometry
|
|
120
|
+
|
|
121
|
+
The drawn group at `spacing={0}` has no height, no padding, no border and
|
|
122
|
+
no fill of its own: the items carry everything. Adjoining items drop the
|
|
123
|
+
border they share, the group's own outer corners are the only rounded ones
|
|
124
|
+
(10px, or 8px when the group itself is sized `sm`), each item insets its
|
|
125
|
+
label by 8, and the selected one takes the `--secondary` fill `Toggle`
|
|
126
|
+
already paints for its pressed state.
|
|
127
|
+
|
|
128
|
+
Every `spacing={0}` group reaches that look, vertical ones on the block
|
|
129
|
+
axis instead of the inline one. Upstream reaches it
|
|
130
|
+
through arbitrary sibling selectors with no direct CSS Modules equivalent;
|
|
131
|
+
this port reaches the same geometry through plain structural selectors keyed
|
|
132
|
+
on `data-spacing`, the same idiom `ButtonGroup` already uses for its own
|
|
133
|
+
bordered strip (see button-group.module.css).
|
|
134
|
+
|
|
135
|
+
Leaving `spacing` unset renders exactly what this component always has - a
|
|
136
|
+
fixed `--space-1` gap between independently bordered items.
|
package/dist/docs/toggle.md
CHANGED
|
@@ -21,8 +21,9 @@ an item inside `ToggleGroup`.
|
|
|
21
21
|
|------|------|---------|
|
|
22
22
|
| `pressed` / `defaultPressed` | controlled / uncontrolled pressed state | `false` |
|
|
23
23
|
| `onPressedChange` | `(pressed: boolean, eventDetails) => void` | — |
|
|
24
|
-
| `variant` | `default` \| `outline` | `default` |
|
|
24
|
+
| `variant` | `default` \| `outline` \| `steel` - `steel` is a hairline in `--border` over nothing, filling with `--muted` on hover and holding `--secondary` while pressed | `default` |
|
|
25
25
|
| `size` | `default` \| `sm` \| `lg` | `default` |
|
|
26
|
+
| `iconOnly` | `boolean` - the toggle holds a glyph and nothing else: it squares up to its own size step (32 at `sm`) and draws the glyph at 18 | `false` |
|
|
26
27
|
| `value` | identifies this toggle inside a `ToggleGroup` | — |
|
|
27
28
|
| `className` | `string` — merged after variant/size classes | — |
|
|
28
29
|
|
|
@@ -47,6 +48,11 @@ import { Toggle } from '@gears-frontx/ui-kit';
|
|
|
47
48
|
<Toggle variant="outline" size="lg" aria-label="Italic">
|
|
48
49
|
<ItalicIcon />
|
|
49
50
|
</Toggle>
|
|
51
|
+
|
|
52
|
+
// Icon-only: square at its size step, glyph at 18
|
|
53
|
+
<Toggle iconOnly variant="outline" size="sm" aria-label="Grid view">
|
|
54
|
+
<GridIcon />
|
|
55
|
+
</Toggle>
|
|
50
56
|
```
|
|
51
57
|
|
|
52
58
|
## Anti-patterns
|
package/dist/docs/tooltip.md
CHANGED
|
@@ -80,15 +80,11 @@ to share open/close delay and grouping: once one tooltip in the group
|
|
|
80
80
|
opens, adjacent ones open instantly while hovering within `timeout`
|
|
81
81
|
(default `400`ms) of each other. It renders no DOM element itself.
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
the app root — here, where it's optional, defaulting to instant-open
|
|
89
|
-
would mean identical trigger markup opens at 600ms or 0ms depending on
|
|
90
|
-
an invisible ancestor.) Pass `delay` explicitly on `TooltipProvider` (or
|
|
91
|
-
on individual `TooltipTrigger`s) to open faster.
|
|
83
|
+
Inside a provider, `delay` is the drawn `0`: the first tooltip opens on
|
|
84
|
+
hover with no wait, and the rest of the group follows it. Outside one,
|
|
85
|
+
Base UI's per-trigger default (`600`ms) applies. Pass `delay` explicitly
|
|
86
|
+
on `TooltipProvider` (or on individual `TooltipTrigger`s) to slow it back
|
|
87
|
+
down.
|
|
92
88
|
|
|
93
89
|
A lone `Tooltip` works standalone without a `TooltipProvider` — grouping
|
|
94
90
|
is the only thing wrapping one adds.
|
package/dist/drawer.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
3
3
|
import { Drawer as n } from "@base-ui/react/drawer";
|
|
4
|
-
import { cx as
|
|
4
|
+
import { cx as s, cva as f } from "class-variance-authority";
|
|
5
5
|
import { createContext as m, useContext as D } from "react";
|
|
6
|
-
import './chunks/drawer.
|
|
6
|
+
import './chunks/drawer.D8l6-G8t.css';const h = "_backdrop_10ocs_29", v = "_viewport_10ocs_89", g = "_popup_10ocs_119", x = "_sideTop_10ocs_375", N = "_sideBottom_10ocs_379", T = "_sideLeft_10ocs_383", b = "_sideRight_10ocs_387", C = "_content_10ocs_400", P = "_swipeHandle_10ocs_441", H = "_header_10ocs_484", S = "_footer_10ocs_501", k = "_title_10ocs_510", B = "_description_10ocs_518", r = {
|
|
7
7
|
backdrop: h,
|
|
8
|
-
viewport:
|
|
9
|
-
popup:
|
|
10
|
-
sideTop:
|
|
11
|
-
sideBottom:
|
|
12
|
-
sideLeft:
|
|
13
|
-
sideRight:
|
|
14
|
-
content:
|
|
15
|
-
swipeHandle:
|
|
16
|
-
header:
|
|
17
|
-
footer:
|
|
18
|
-
title:
|
|
19
|
-
description:
|
|
20
|
-
},
|
|
8
|
+
viewport: v,
|
|
9
|
+
popup: g,
|
|
10
|
+
sideTop: x,
|
|
11
|
+
sideBottom: N,
|
|
12
|
+
sideLeft: T,
|
|
13
|
+
sideRight: b,
|
|
14
|
+
content: C,
|
|
15
|
+
swipeHandle: P,
|
|
16
|
+
header: H,
|
|
17
|
+
footer: S,
|
|
18
|
+
title: k,
|
|
19
|
+
description: B
|
|
20
|
+
}, R = {
|
|
21
21
|
top: "up",
|
|
22
22
|
right: "right",
|
|
23
23
|
bottom: "down",
|
|
24
24
|
left: "left"
|
|
25
25
|
}, _ = m(null);
|
|
26
|
-
function
|
|
26
|
+
function E() {
|
|
27
27
|
const t = D(_);
|
|
28
28
|
if (!t)
|
|
29
29
|
throw new Error("Drawer parts (DrawerContent, DrawerPortal, ...) must be rendered inside a Drawer.");
|
|
@@ -32,88 +32,88 @@ function R() {
|
|
|
32
32
|
function W({
|
|
33
33
|
modal: t = !0,
|
|
34
34
|
side: e = "bottom",
|
|
35
|
-
showSwipeHandle:
|
|
36
|
-
snapPoints:
|
|
35
|
+
showSwipeHandle: d = !1,
|
|
36
|
+
snapPoints: i,
|
|
37
37
|
...a
|
|
38
38
|
}) {
|
|
39
|
-
const l = { hasSnapPoints:
|
|
40
|
-
return /* @__PURE__ */
|
|
39
|
+
const l = { hasSnapPoints: i != null && i.length > 0, modal: t, showSwipeHandle: d, side: e };
|
|
40
|
+
return /* @__PURE__ */ o(_.Provider, { value: l, children: /* @__PURE__ */ o(
|
|
41
41
|
n.Root,
|
|
42
42
|
{
|
|
43
43
|
modal: t,
|
|
44
|
-
snapPoints:
|
|
45
|
-
swipeDirection:
|
|
44
|
+
snapPoints: i,
|
|
45
|
+
swipeDirection: R[e],
|
|
46
46
|
...a
|
|
47
47
|
}
|
|
48
48
|
) });
|
|
49
49
|
}
|
|
50
50
|
function $({ className: t, ...e }) {
|
|
51
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ o(n.Trigger, { className: t, ...e });
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
return /* @__PURE__ */
|
|
53
|
+
function I(t) {
|
|
54
|
+
return /* @__PURE__ */ o(n.Portal, { ...t });
|
|
55
55
|
}
|
|
56
56
|
function q({ className: t, ...e }) {
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
}
|
|
59
|
-
function I({ className: t, ...e }) {
|
|
60
|
-
return /* @__PURE__ */ r("div", { "aria-hidden": "true", className: i(o.swipeHandle, t), ...e });
|
|
57
|
+
return /* @__PURE__ */ o(n.Close, { className: t, ...e });
|
|
61
58
|
}
|
|
62
59
|
function L({ className: t, ...e }) {
|
|
63
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ o("div", { "aria-hidden": "true", className: s(r.swipeHandle, t), ...e });
|
|
61
|
+
}
|
|
62
|
+
function V({ className: t, ...e }) {
|
|
63
|
+
return /* @__PURE__ */ o(n.Backdrop, { className: s(r.backdrop, t), ...e });
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const j = f(r.popup, {
|
|
66
66
|
variants: {
|
|
67
67
|
side: {
|
|
68
|
-
top:
|
|
69
|
-
right:
|
|
70
|
-
bottom:
|
|
71
|
-
left:
|
|
68
|
+
top: r.sideTop,
|
|
69
|
+
right: r.sideRight,
|
|
70
|
+
bottom: r.sideBottom,
|
|
71
|
+
left: r.sideLeft
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
|
-
function z({ className: t, children: e, container:
|
|
76
|
-
const { hasSnapPoints: a, modal:
|
|
77
|
-
return /* @__PURE__ */ u(
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
75
|
+
function z({ className: t, children: e, container: d, ...i }) {
|
|
76
|
+
const { hasSnapPoints: a, modal: p, showSwipeHandle: l, side: c } = E(), w = c === "top" || c === "bottom" ? "y" : "x";
|
|
77
|
+
return /* @__PURE__ */ u(I, { container: d, children: [
|
|
78
|
+
p === !0 && /* @__PURE__ */ o(V, { "data-snap-points": a ? "" : void 0 }),
|
|
79
|
+
/* @__PURE__ */ o(n.Viewport, { "data-modal": p, className: r.viewport, children: /* @__PURE__ */ u(
|
|
80
80
|
n.Popup,
|
|
81
81
|
{
|
|
82
82
|
"data-swipe-axis": w,
|
|
83
83
|
"data-snap-points": a ? "" : void 0,
|
|
84
|
-
"data-side":
|
|
85
|
-
className:
|
|
86
|
-
...
|
|
84
|
+
"data-side": c,
|
|
85
|
+
className: j({ side: c, className: t }),
|
|
86
|
+
...i,
|
|
87
87
|
children: [
|
|
88
|
-
l && /* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
88
|
+
l && /* @__PURE__ */ o(L, {}),
|
|
89
|
+
/* @__PURE__ */ o(n.Content, { className: r.content, children: e })
|
|
90
90
|
]
|
|
91
91
|
}
|
|
92
92
|
) })
|
|
93
93
|
] });
|
|
94
94
|
}
|
|
95
95
|
function G({ className: t, ...e }) {
|
|
96
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ o("div", { className: s(r.header, t), ...e });
|
|
97
97
|
}
|
|
98
98
|
function J({ className: t, ...e }) {
|
|
99
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ o("div", { className: s(r.footer, t), ...e });
|
|
100
100
|
}
|
|
101
101
|
function K({ className: t, ...e }) {
|
|
102
|
-
return /* @__PURE__ */
|
|
102
|
+
return /* @__PURE__ */ o(n.Title, { className: s(r.title, t), ...e });
|
|
103
103
|
}
|
|
104
104
|
function M({ className: t, ...e }) {
|
|
105
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ o(n.Description, { className: s(r.description, t), ...e });
|
|
106
106
|
}
|
|
107
107
|
export {
|
|
108
108
|
W as Drawer,
|
|
109
|
-
|
|
109
|
+
V as DrawerBackdrop,
|
|
110
110
|
q as DrawerClose,
|
|
111
111
|
z as DrawerContent,
|
|
112
112
|
M as DrawerDescription,
|
|
113
113
|
J as DrawerFooter,
|
|
114
114
|
G as DrawerHeader,
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
I as DrawerPortal,
|
|
116
|
+
L as DrawerSwipeHandle,
|
|
117
117
|
K as DrawerTitle,
|
|
118
118
|
$ as DrawerTrigger
|
|
119
119
|
};
|