@gears-frontx/ui-kit 0.4.2 → 0.4.4

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.
Files changed (167) hide show
  1. package/README.md +10 -6
  2. package/dist/alert.js +35 -24
  3. package/dist/alert.js.map +1 -1
  4. package/dist/attachment.js +117 -76
  5. package/dist/attachment.js.map +1 -1
  6. package/dist/avatar.js +43 -43
  7. package/dist/badge.js +14 -14
  8. package/dist/card.js +81 -44
  9. package/dist/card.js.map +1 -1
  10. package/dist/chart.js +50 -50
  11. package/dist/chunks/alert.Csv2-ccF.css +1 -0
  12. package/dist/chunks/attachment.BRyIQq3F.css +1 -0
  13. package/dist/chunks/avatar.7EUG65-M.css +1 -0
  14. package/dist/chunks/badge.BwUxa9PB.css +1 -0
  15. package/dist/chunks/card.DSiUMxGK.css +1 -0
  16. package/dist/chunks/chart.B9cGEno8.css +1 -0
  17. package/dist/chunks/code-block.r7Cm0ncj.css +1 -0
  18. package/dist/chunks/description-list.Cx-vFGJL.css +1 -0
  19. package/dist/chunks/dialog.CIR9bQoU.css +1 -0
  20. package/dist/chunks/dropdown-menu.DT1_JLqL.css +1 -0
  21. package/dist/chunks/empty.DWqLrSfF.css +1 -0
  22. package/dist/chunks/heading.DQxQs5po.css +1 -0
  23. package/dist/chunks/item.BQ70Khqj.css +1 -0
  24. package/dist/chunks/link.BOE4f-aB.css +1 -0
  25. package/dist/chunks/message-scroller.CBjPcz8Y.css +1 -0
  26. package/dist/chunks/pagination.BAAl9D_S.css +1 -0
  27. package/dist/chunks/{select.BFwI5rhI.css → select.C3sLDoZI.css} +1 -1
  28. package/dist/chunks/sheet.BkZyzAbA.css +1 -0
  29. package/dist/chunks/sidebar.Dw_e0Jqw.css +1 -0
  30. package/dist/chunks/slider.DY1XDCPw.css +1 -0
  31. package/dist/chunks/status-dot.39NKkKQF.css +1 -0
  32. package/dist/chunks/tabs.BqhiMRUP.css +1 -0
  33. package/dist/chunks/text.7frjnkUr.css +1 -0
  34. package/dist/chunks/visually-hidden.Bd2oAR5D.css +1 -0
  35. package/dist/code-block.d.ts +1 -0
  36. package/dist/code-block.js +152 -0
  37. package/dist/code-block.js.map +1 -0
  38. package/dist/command.js +63 -48
  39. package/dist/command.js.map +1 -1
  40. package/dist/components/alert/alert.d.ts +3 -2
  41. package/dist/components/alert/alert.d.ts.map +1 -1
  42. package/dist/components/attachment/attachment.d.ts +10 -3
  43. package/dist/components/attachment/attachment.d.ts.map +1 -1
  44. package/dist/components/card/card.d.ts +6 -4
  45. package/dist/components/card/card.d.ts.map +1 -1
  46. package/dist/components/code-block/code-block.d.ts +57 -0
  47. package/dist/components/code-block/code-block.d.ts.map +1 -0
  48. package/dist/components/code-block/public.d.ts +2 -0
  49. package/dist/components/code-block/public.d.ts.map +1 -0
  50. package/dist/components/command/command.d.ts +1 -1
  51. package/dist/components/command/command.d.ts.map +1 -1
  52. package/dist/components/description-list/description-list.d.ts +21 -0
  53. package/dist/components/description-list/description-list.d.ts.map +1 -0
  54. package/dist/components/description-list/public.d.ts +2 -0
  55. package/dist/components/description-list/public.d.ts.map +1 -0
  56. package/dist/components/empty/empty.d.ts +3 -2
  57. package/dist/components/empty/empty.d.ts.map +1 -1
  58. package/dist/components/heading/heading.d.ts +10 -0
  59. package/dist/components/heading/heading.d.ts.map +1 -0
  60. package/dist/components/heading/public.d.ts +2 -0
  61. package/dist/components/heading/public.d.ts.map +1 -0
  62. package/dist/components/input-otp/input-otp.d.ts +1 -1
  63. package/dist/components/input-otp/input-otp.d.ts.map +1 -1
  64. package/dist/components/item/item.d.ts +15 -6
  65. package/dist/components/item/item.d.ts.map +1 -1
  66. package/dist/components/link/link.d.ts +18 -0
  67. package/dist/components/link/link.d.ts.map +1 -0
  68. package/dist/components/link/public.d.ts +2 -0
  69. package/dist/components/link/public.d.ts.map +1 -0
  70. package/dist/components/sidebar/sidebar.d.ts +13 -3
  71. package/dist/components/sidebar/sidebar.d.ts.map +1 -1
  72. package/dist/components/slider/slider.d.ts +1 -1
  73. package/dist/components/slider/slider.d.ts.map +1 -1
  74. package/dist/components/table/table.d.ts.map +1 -1
  75. package/dist/components/text/public.d.ts +2 -0
  76. package/dist/components/text/public.d.ts.map +1 -0
  77. package/dist/components/text/text.d.ts +11 -0
  78. package/dist/components/text/text.d.ts.map +1 -0
  79. package/dist/components/visually-hidden/public.d.ts +2 -0
  80. package/dist/components/visually-hidden/public.d.ts.map +1 -0
  81. package/dist/components/visually-hidden/visually-hidden.d.ts +4 -0
  82. package/dist/components/visually-hidden/visually-hidden.d.ts.map +1 -0
  83. package/dist/data-grid/pagination.js +35 -35
  84. package/dist/description-list.d.ts +1 -0
  85. package/dist/description-list.js +78 -0
  86. package/dist/description-list.js.map +1 -0
  87. package/dist/dialog.js +38 -38
  88. package/dist/docs/alert.md +8 -2
  89. package/dist/docs/attachment.md +20 -8
  90. package/dist/docs/avatar.md +8 -2
  91. package/dist/docs/badge.md +12 -11
  92. package/dist/docs/button.md +16 -4
  93. package/dist/docs/calendar.md +6 -0
  94. package/dist/docs/card.md +38 -6
  95. package/dist/docs/carousel.md +4 -2
  96. package/dist/docs/chart.md +23 -0
  97. package/dist/docs/code-block.md +114 -0
  98. package/dist/docs/data-grid.md +2 -0
  99. package/dist/docs/description-list.md +53 -0
  100. package/dist/docs/drawer.md +1 -1
  101. package/dist/docs/empty.md +9 -3
  102. package/dist/docs/heading.md +60 -0
  103. package/dist/docs/item.md +70 -3
  104. package/dist/docs/link.md +48 -0
  105. package/dist/docs/message-scroller.md +5 -0
  106. package/dist/docs/questionnaire.md +1 -1
  107. package/dist/docs/sheet.md +20 -3
  108. package/dist/docs/sidebar.md +27 -0
  109. package/dist/docs/status-dot.md +2 -2
  110. package/dist/docs/switch.md +10 -4
  111. package/dist/docs/text.md +51 -0
  112. package/dist/docs/visually-hidden.md +44 -0
  113. package/dist/dropdown-menu.js +56 -56
  114. package/dist/empty.js +47 -36
  115. package/dist/empty.js.map +1 -1
  116. package/dist/heading.d.ts +1 -0
  117. package/dist/heading.js +36 -0
  118. package/dist/heading.js.map +1 -0
  119. package/dist/index.d.ts +6 -0
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +427 -401
  122. package/dist/index.js.map +1 -1
  123. package/dist/input-otp.js +34 -20
  124. package/dist/input-otp.js.map +1 -1
  125. package/dist/item.js +119 -71
  126. package/dist/item.js.map +1 -1
  127. package/dist/link.d.ts +1 -0
  128. package/dist/link.js +55 -0
  129. package/dist/link.js.map +1 -0
  130. package/dist/message-scroller.js +24 -24
  131. package/dist/select.js +45 -45
  132. package/dist/sheet.js +41 -41
  133. package/dist/sidebar.js +207 -193
  134. package/dist/sidebar.js.map +1 -1
  135. package/dist/slider.js +34 -21
  136. package/dist/slider.js.map +1 -1
  137. package/dist/status-dot.js +25 -25
  138. package/dist/table.js +172 -157
  139. package/dist/table.js.map +1 -1
  140. package/dist/tabs.js +14 -14
  141. package/dist/text.d.ts +1 -0
  142. package/dist/text.js +53 -0
  143. package/dist/text.js.map +1 -0
  144. package/dist/theme.css +29 -6
  145. package/dist/utilities.css +25 -2
  146. package/dist/visually-hidden.d.ts +1 -0
  147. package/dist/visually-hidden.js +18 -0
  148. package/dist/visually-hidden.js.map +1 -0
  149. package/llms.txt +72 -15
  150. package/package.json +1 -4
  151. package/dist/chunks/alert.DsgRIXLn.css +0 -1
  152. package/dist/chunks/attachment.CZuZdlXC.css +0 -1
  153. package/dist/chunks/avatar.BMm-Z9l5.css +0 -1
  154. package/dist/chunks/badge.BCreEn3O.css +0 -1
  155. package/dist/chunks/card.DdBl-usf.css +0 -1
  156. package/dist/chunks/chart.CeyctrXQ.css +0 -1
  157. package/dist/chunks/dialog.Cpo8vChK.css +0 -1
  158. package/dist/chunks/dropdown-menu.TU3FHXbJ.css +0 -1
  159. package/dist/chunks/empty.DnAKlw2g.css +0 -1
  160. package/dist/chunks/item.BkcgydVc.css +0 -1
  161. package/dist/chunks/message-scroller.CbLooS7Q.css +0 -1
  162. package/dist/chunks/pagination.Cn8tIWMX.css +0 -1
  163. package/dist/chunks/sheet.BWvXXyXk.css +0 -1
  164. package/dist/chunks/sidebar.DdEvMURX.css +0 -1
  165. package/dist/chunks/slider.inyNxx4y.css +0 -1
  166. package/dist/chunks/status-dot.DWa2qGKe.css +0 -1
  167. package/dist/chunks/tabs.DFa0OYMo.css +0 -1
@@ -0,0 +1,60 @@
1
+ # Heading
2
+
3
+ A heading on the kit's type ramp: `typography` picks the ramp role, `render`
4
+ picks the element, so the document outline (h1 to h6) and the look stay
5
+ independent. No Base UI primitive; `render` comes from
6
+ `useRender`/`mergeProps`.
7
+
8
+ ## When to use
9
+
10
+ - The title of a screen or of a section between kit components.
11
+ - A heading whose outline level differs from its look, such as an `h3`
12
+ drawn on the heading-1 role.
13
+
14
+ ## When not to use
15
+
16
+ - Inside a kit component that has its own title part: use `CardTitle`,
17
+ `EmptyTitle`, `AlertTitle` (each takes `render` for the heading element),
18
+ `DialogTitle` or `ItemTitle`.
19
+ - The title of a page header: use `PageHeaderTitle`, which takes the same
20
+ two top roles (its `typography` `display` is this `display`, its
21
+ `heading` this `heading-1`).
22
+ - Running text, captions and meta lines: use `Text`.
23
+
24
+ ## Props (kit level)
25
+
26
+ | Prop | Type | Default |
27
+ |------|------|---------|
28
+ | `typography` | `'display' \| 'heading-1' \| 'heading-2'` - the ramp role (`--text-<role>-size`, `-line-height`, `-weight`, `-tracking`) on the `--font-heading` family | `'heading-1'` |
29
+ | `render` | `ReactElement` or callback - the element, such as `<h1 />` | `h2` |
30
+ | `className` | `string` - merged after the role class | - |
31
+
32
+ All other props are native heading props, forwarded as they are. Margins
33
+ are zero: spacing belongs to the layout that places the heading. A larger
34
+ display step is branded by overriding the ramp tokens; the kit grows no
35
+ role above `display`.
36
+
37
+ The axis is named `typography`, like `CardTitle`'s: it picks ramp roles,
38
+ not a box size. `display` is the 26/32 page title role, `heading-1` the
39
+ 20/28 role and `heading-2` the 16/24 role.
40
+
41
+ ## Accessibility
42
+
43
+ - The element carries the outline level; pick it from the document
44
+ structure, never from the look you want.
45
+
46
+ ## Examples
47
+
48
+ ```tsx
49
+ import { Heading } from '@gears-frontx/ui-kit';
50
+
51
+ <Heading typography="display" render={<h1 />}>Settings</Heading>
52
+ <Heading typography="heading-2">Members</Heading>
53
+ ```
54
+
55
+ ## Anti-patterns
56
+
57
+ - Do not choose `h1` to get a bigger heading: choose `typography` for the
58
+ look and `render` for the level.
59
+ - Do not add margins through `className`: space headings with the layout's
60
+ gap.
package/dist/docs/item.md CHANGED
@@ -37,14 +37,81 @@ Composition: `ItemGroup` (→ `Item`+, separated by optional
37
37
  | `render` | `ReactElement \| ((props, state) => ReactElement)` — replaces the root element; `state` is `{ variant, size }` | — |
38
38
  | `className` | `string` — merged after variant/size classes | — |
39
39
 
40
+ Rendered as a link (`render={<a href="..." />}`), the row keeps the
41
+ surrounding text colour and no underline, so it looks like the plain rows
42
+ beside it, and gets the same `--muted` hover fill as a link nested in a row.
43
+
44
+ Inside `ItemGroup` (a `role="list"`) each `Item` is a list item
45
+ (`role="listitem"`) and `ItemSeparator` is hidden from assistive
46
+ technology, so a group of rows reads as a list. An `Item` with `render`
47
+ (a link or a button row) keeps its own role and sits in a `div` with
48
+ `role="listitem"` the group adds around it. A `role` passed to an `Item`
49
+ always wins and gets no wrapper.
50
+
51
+ A chosen row is marked with ARIA, and the row paints it:
52
+
53
+ - selection inside a list (`aria-pressed="true"` on a toggle row,
54
+ `aria-selected="true"`, `aria-current="true"` on the file a viewer
55
+ shows) takes `--secondary` / `--secondary-foreground`;
56
+ - the current place in a navigation (`aria-current="page"`, or step,
57
+ location, date, time) takes `--accent` / `--accent-foreground`, and its
58
+ description follows the row's text colour.
59
+
60
+ ```tsx
61
+ <ItemGroup>
62
+ {files.map((file) => (
63
+ <Item
64
+ key={file.path}
65
+ size="sm"
66
+ render={<button type="button" aria-current={file.path === shown ? 'true' : undefined} />}
67
+ onClick={() => show(file.path)}
68
+ >
69
+ <ItemContent>
70
+ <ItemTitle>{file.name}</ItemTitle>
71
+ </ItemContent>
72
+ </Item>
73
+ ))}
74
+ </ItemGroup>
75
+ ```
76
+
77
+ `ItemTitle` stays on one line. A short title is as wide as its text; a long
78
+ one stops at the width of its column and ends with an ellipsis. Its text is
79
+ wrapped in a span that draws the ellipsis (text inside a fragment counts);
80
+ an icon or badge passed beside the text renders as it is. Text that a child
81
+ component renders (a translation component, a `<strong>`) is not wrapped and
82
+ is clipped without an ellipsis: pass the string itself, or wrap that child
83
+ in an element that sets `min-width: 0; overflow: hidden; text-overflow:
84
+ ellipsis`.
85
+
40
86
  `ItemMedia`:
41
87
 
42
88
  | Prop | Type | Default |
43
89
  |------|------|---------|
44
- | `variant` | `'default' \| 'icon' \| 'image'` — `image` also shrinks to match the ancestor `Item`'s `size` | `'default'` |
90
+ | `variant` | `'default' \| 'icon' \| 'image' \| 'chip' \| 'chip-round'` - `image` also shrinks to match the ancestor `Item`'s `size`; `chip` is a 29px rounded square on the `--accent` pair with a 16px glyph, `chip-round` a 30px circle on `--secondary` with the glyph in `--link-foreground`, the icon tile a dashboard row or an activity feed leads with | `'default'` |
91
+
92
+ `ItemDescription`:
93
+
94
+ | Prop | Type | Default |
95
+ |------|------|---------|
96
+ | `lineClamp` | `number \| 'none'` - lines shown before the text is cut with an ellipsis; `'none'` (or a number below 1) shows the full text | `2` |
97
+
98
+ The default writes no inline style, so a plain `<ItemDescription>` renders
99
+ the same markup as before. Another count travels inline as a private custom
100
+ property; `'none'` adds a class that drops the clamp. At every value a long
101
+ unbroken token (a URL, an identifier) wraps inside the description
102
+ (`overflow-wrap: anywhere`) instead of being cut at its edge, and the
103
+ item's media stays top-aligned. Use the prop rather than a `className` that
104
+ resets the clamp: such a class competes with the kit's at equal specificity,
105
+ so stylesheet order decides, and that order differs between the document and
106
+ a shadow root.
107
+
108
+ ```tsx
109
+ <ItemDescription lineClamp={3}>{summary}</ItemDescription>
110
+ <ItemDescription lineClamp="none">{fullRuleText}</ItemDescription>
111
+ ```
45
112
 
46
- Every other part (`ItemContent`, `ItemTitle`, `ItemDescription`,
47
- `ItemActions`, `ItemHeader`, `ItemFooter`, `ItemGroup`) takes no
113
+ Every other part (`ItemContent`, `ItemTitle`, `ItemActions`, `ItemHeader`,
114
+ `ItemFooter`, `ItemGroup`) takes no
48
115
  kit-specific props — native element props, forwarded as-is.
49
116
  `ItemSeparator` takes the kit `Separator`'s own props (its `orientation`
50
117
  is fixed to `'horizontal'`).
@@ -0,0 +1,48 @@
1
+ # Link
2
+
3
+ An inline anchor that inherits font size and line height from its line, so it never changes the line box. That is the difference from `buttonVariants({ variant: 'link' })`, which carries a control's height and padding.
4
+
5
+ ## When to use
6
+
7
+ - A link inside a sentence or a short line.
8
+ - The application's router link, through `render`.
9
+ - A link to another site, with `external`.
10
+
11
+ ## When not to use
12
+
13
+ - An action: use `Button`.
14
+ - A whole card or a whole row that navigates: use `Card` or `Item` with `render`.
15
+ - A trail of pages: use `Breadcrumb`.
16
+
17
+ ## Props (kit level)
18
+
19
+ | Prop | Type | Default |
20
+ |------|------|---------|
21
+ | `variant` | `'default' \| 'muted' \| 'inherit'` - `--link-foreground`; `--muted-foreground` turning `--link-foreground` on hover; `currentColor` | `'default'` |
22
+ | `external` | `boolean` - `target="_blank"` and `rel="noopener noreferrer"` unless passed, plus an arrow icon with `aria-hidden` | `false` |
23
+ | `render` | `ReactElement` or callback - the router's link component | `a` |
24
+ | `className` | `string` | - |
25
+
26
+ Underlined at rest, so a link inside text never relies on colour alone; keyboard focus draws an outline on `--ring` at `--border-width-focus`. `linkVariants` is exported for a router component that cannot take `render`.
27
+
28
+ An icon placed directly in the link (the external arrow or the caller's own) takes a 1em square from the link text, sits on its baseline and keeps a 0.25em gap on both sides. The rule carries no specificity, so a caller that sizes or spaces its icons itself keeps its own values.
29
+
30
+ ## Accessibility
31
+
32
+ - With `external`, the wording that the link opens a new tab stays with the caller (visible text or a `VisuallyHidden` hint).
33
+ - Inside coloured text, `inherit` keeps the colour and the underline marks the link.
34
+
35
+ ## Examples
36
+
37
+ ```tsx
38
+ import { Link, Text } from '@gears-frontx/ui-kit';
39
+
40
+ <Text>Read the <Link href="/docs/setup">setup guide</Link> first.</Text>
41
+ <Link render={<RouterLink to="/settings" />}>Settings</Link>
42
+ <Link href="https://example.com" external>Example</Link>
43
+ ```
44
+
45
+ ## Anti-patterns
46
+
47
+ - Do not use the button's link variant inside text.
48
+ - Do not give a link an `onClick` with no destination: that is a `Button`.
@@ -66,6 +66,11 @@ exists past each edge; `useMessageScrollerVisibility()` —
66
66
 
67
67
  ## Behavior notes
68
68
 
69
+ - **Padding stays inside the box.** `MessageScroller` and
70
+ `MessageScrollerViewport` fill their parent (`width` and `height` 100%)
71
+ with `box-sizing: border-box`, so a padding or border added through
72
+ `className` (an inner gutter around the transcript) stays inside the
73
+ parent instead of overflowing it.
69
74
  - **Short transcripts bottom-anchor.** `MessageScrollerContent` renders
70
75
  `justify-content: flex-end` whenever it directly contains at least one
71
76
  `MessageScrollerItem` (detected via the `data-scroll-anchor` attribute
@@ -99,7 +99,7 @@ Shortcuts and arrow navigation pause while typing in a text field.
99
99
  `QuestionnaireProgress`: renders `Question {current} of {total}` as text in
100
100
  a `role="progressbar"` — it is **not** a bar by default. Pass `children` to
101
101
  replace the copy, or `render={(props, state) => ...}` to draw a real bar
102
- from `state.current`/`state.total` (see the demo's segmented example).
102
+ from `state.current`/`state.total`, for example one segment per question.
103
103
 
104
104
  `QuestionnaireItem`: `name` (matches an `items` entry), `required`,
105
105
  `multiple` (renders every child `QuestionnaireChoice` as a checkbox
@@ -151,9 +151,26 @@ inset on the first, bottom inset on the last), so header and footer span
151
151
  the panel's full width and reach its top and bottom edges. Padding on the
152
152
  scroll container would have left strips that no sticky region can cover -
153
153
  see `dialog.md`'s "Scrolling content" for the mechanism. Consequence when
154
- styling children: a `className` that sets `padding` on a region overrides
155
- the inset (same single-class weight) rather than adding to it, and a
156
- full-width child reaches the panel edges by zeroing its `padding-inline`.
154
+ styling children: the inset rules read the `--sheet-inset` custom property
155
+ (default `var(--space-6)`, 24px). It sets a region's side inset and, on the
156
+ first and last regions, their top and bottom inset too. A region that should
157
+ run edge to edge (a navigation column, a full-width list with dividers, a
158
+ media header) sets `--sheet-inset: 0` on itself; as the first region it then
159
+ also starts at the panel's top edge, under the close button, so put it after
160
+ `SheetHeader` or give it its own top padding. Setting it on `SheetContent`
161
+ changes the inset of every region except `SheetHeader` and `SheetFooter`,
162
+ which keep their own 16px, and leaves the 24px gap between regions as it is. Use the property rather than a `padding` override:
163
+ a class that sets `padding` on a region has the same weight as the kit
164
+ rule, so it wins only when its stylesheet loads after the kit's.
165
+
166
+ ```tsx
167
+ <SheetContent>
168
+ <SheetHeader>
169
+ <SheetTitle>Navigation</SheetTitle>
170
+ </SheetHeader>
171
+ <nav style={{ '--sheet-inset': 0 } as React.CSSProperties}>{/* full-width rows */}</nav>
172
+ </SheetContent>
173
+ ```
157
174
 
158
175
  ## Anti-patterns
159
176
 
@@ -119,6 +119,7 @@ needed for the normal case, where the shell IS the page.
119
119
  | `defaultOpen` | `boolean` — starting state AND an opt-out of the cookie | persisted cookie, else `true` |
120
120
  | `open` | `boolean` — controlled desktop open state | — |
121
121
  | `onOpenChange` | `(open: boolean) => void` | — |
122
+ | `contained` | `boolean` - lay the sidebar out inside a bounded container instead of against the viewport (see "Inside a container") | `false` |
122
123
 
123
124
  Omit `defaultOpen` and the provider restores whatever was last persisted
124
125
  (`sidebar_state`, 7 days). Pass it and it wins outright, cookie ignored.
@@ -220,6 +221,32 @@ inherited down to `Sidebar`/`SidebarInset` the same way `Card` shares
220
221
  <SidebarProvider style={{ '--sidebar-width': '20rem' }}>
221
222
  ```
222
223
 
224
+ ## Inside a container
225
+
226
+ A sidebar that belongs to a panel or a page section (a file list beside a
227
+ viewer, a settings section) rather than to the app shell: pass
228
+ `contained` to `SidebarProvider`, use `collapsible="none"` on `Sidebar`,
229
+ and render `SidebarInset` as a `div` so the page keeps its own main. The
230
+ wrapper then fills its parent instead of the screen height, the sidebar
231
+ sticks to the top of the container with a `--sidebar-border` line toward
232
+ the content, the content scrolls inside the container, and on a narrow
233
+ screen the sidebar stacks above the content with its list capped at 190px
234
+ and scrolling. A contained provider keeps its own state: it reads and
235
+ writes no `sidebar_state` cookie and does not answer Cmd/Ctrl+B, so it
236
+ never moves with the page's app sidebar. Set the width through
237
+ `--sidebar-width` as above (the drawn explorer uses `14rem`).
238
+
239
+ ```tsx
240
+ <Card variant="panel">
241
+ <SidebarProvider contained style={{ '--sidebar-width': '14rem' } as CSSProperties}>
242
+ <Sidebar collapsible="none">
243
+ <SidebarContent>{/* file list */}</SidebarContent>
244
+ </Sidebar>
245
+ <SidebarInset render={<div />}>{/* the file */}</SidebarInset>
246
+ </SidebarProvider>
247
+ </Card>
248
+ ```
249
+
223
250
  ## Not reproduced from upstream
224
251
 
225
252
  Row geometry is upstream's, not invented: the metrics come from
@@ -1,7 +1,7 @@
1
1
  # StatusDot
2
2
 
3
3
  An inline status indicator: a 6px round dot plus an optional 12/16 label,
4
- both painted in the tone's own colour. No Base UI primitive and no
4
+ both painted in the tone. No Base UI primitive and no
5
5
  interactive behaviour - a pure styling translation over native spans, like
6
6
  `Skeleton` and `Spinner`.
7
7
 
@@ -28,7 +28,7 @@ interactive behaviour - a pure styling translation over native spans, like
28
28
 
29
29
  | Prop | Type | Default |
30
30
  |------|------|---------|
31
- | `tone` | `'neutral' \| 'success' \| 'warning' \| 'danger' \| 'info'` - paints the dot and the label alike (`--muted-foreground` for neutral, `--success` / `--warning` / `--danger` / `--info` for the rest); the root also carries `data-tone` | `'neutral'` |
31
+ | `tone` | `'neutral' \| 'success' \| 'warning' \| 'danger' \| 'info'` - paints the dot in the tone (`--muted-foreground` for neutral, `--success` / `--warning` / `--danger` / `--info` for the rest) and the label in the same tone, written in the tone's text token (`--success-foreground` / `--warning-foreground` / `--danger-foreground`) where the fill tone is too light for 12px text; the root also carries `data-tone` | `'neutral'` |
32
32
  | `label` | `ReactNode` - the text beside the dot; omitted renders the dot on its own | - |
33
33
  | `live` | `boolean` - the dot breathes on a 2s opacity cycle and the root carries `data-live`; off under `prefers-reduced-motion` | `false` |
34
34
  | `render` | `ReactElement` - replaces the root `span`, e.g. with an `<li>` inside a status list | - |
@@ -1,8 +1,8 @@
1
1
  # Switch
2
2
 
3
3
  An on/off toggle with immediate effect. Wraps the Base UI Switch primitive
4
- (Root + Thumb): renders a `role="switch"` button with a hidden native input
5
- for forms, state via `data-checked`/`data-unchecked`.
4
+ (Root + Thumb): renders a `span` with `role="switch"` and a hidden native
5
+ input for forms, state via `data-checked`/`data-unchecked`.
6
6
 
7
7
  ## When to use
8
8
 
@@ -32,9 +32,11 @@ Other props follow Base UI Switch.Root (`disabled`, `readOnly`, ...).
32
32
  ```tsx
33
33
  import { Label, Switch } from '@gears-frontx/ui-kit';
34
34
 
35
- // Labelled toggle — nesting gives one click target
35
+ // Labelled toggle: nesting gives one click target, and aria-labelledby
36
+ // names the switch (a wrapping label does not name its role="switch" span)
36
37
  <Label>
37
- <Switch checked={notify} onCheckedChange={setNotify} /> Email notifications
38
+ <Switch checked={notify} onCheckedChange={setNotify} aria-labelledby="notify-label" />
39
+ <span id="notify-label">Email notifications</span>
38
40
  </Label>
39
41
 
40
42
  // Compact rows
@@ -49,3 +51,7 @@ import { Label, Switch } from '@gears-frontx/ui-kit';
49
51
  - Do not use a switch when the change needs a confirm/submit step — that is
50
52
  `checkbox` semantics.
51
53
  - Do not render one without a visible label or `aria-label`.
54
+ - Do not rely on a wrapping `Label` alone for the name: the switch is a
55
+ `span` with `role="switch"`, which a wrapping label does not name (axe
56
+ `aria-toggle-field-name`). Point `aria-labelledby` at the label text, or
57
+ pass `aria-label`.
@@ -0,0 +1,51 @@
1
+ # Text
2
+
3
+ Text on the kit's type ramp: `typography` is the ramp role and `tone` the
4
+ colour. The default element is `p`; `render` swaps it. No Base UI
5
+ primitive; `render` comes from `useRender`/`mergeProps`.
6
+
7
+ ## When to use
8
+
9
+ - A paragraph between kit components.
10
+ - A short muted line (an update time, a hint) on the meta role.
11
+ - A path or a name on the mono role, with `render={<code />}`.
12
+
13
+ ## When not to use
14
+
15
+ - A heading: use `Heading`.
16
+ - A block of code with a copy action: use `CodeBlock`.
17
+ - A key or a shortcut: use `Kbd`.
18
+ - The description line of a card: use `CardDescription`.
19
+
20
+ ## Props (kit level)
21
+
22
+ | Prop | Type | Default |
23
+ |------|------|---------|
24
+ | `typography` | `'body' \| 'label' \| 'meta' \| 'mono' \| 'micro' \| 'kpi' \| 'kpi-lg'` - the ramp role; `mono` also sets `--font-mono`; `kpi` (32/32) and `kpi-lg` (48/48) are key figures on a dashboard card, with tabular figures | `'body'` |
25
+ | `tone` | `'default' \| 'muted'` - `--foreground` or `--muted-foreground` | `'default'` |
26
+ | `render` | `ReactElement` or callback - the element | `p` |
27
+ | `className` | `string` - merged after the role and tone classes | - |
28
+
29
+ All other props are native paragraph props. Margins are zero. No `lead`,
30
+ `overline` or uppercase roles: they are not ramp roles; a consumer that
31
+ wants one adds a class or brands a role.
32
+
33
+ ## Accessibility
34
+
35
+ - Contrast of the two tones is a property of the theme's tokens.
36
+
37
+ ## Examples
38
+
39
+ ```tsx
40
+ import { Text } from '@gears-frontx/ui-kit';
41
+
42
+ <Text>Invite people by email.</Text>
43
+ <Text typography="meta" tone="muted" render={<span />}>Updated 2 hours ago</Text>
44
+ <Text typography="mono" render={<code />}>src/app/main.tsx</Text>
45
+ <Text typography="kpi" render={<strong />}>41,302</Text>
46
+ ```
47
+
48
+ ## Anti-patterns
49
+
50
+ - Do not set font sizes or colours on it from outside: pick `typography`
51
+ and `tone`.
@@ -0,0 +1,44 @@
1
+ # VisuallyHidden
2
+
3
+ Text a screen reader reads and the screen does not show. A `span` by default, with `render`. The same declarations the kit repeats
4
+ inside several component modules, as the one public copy; the `sr-only` class
5
+ in `utilities.css` is the same rule for markup that is not React.
6
+
7
+ ## When to use
8
+
9
+ - The name of an icon-only link or of a custom control without a label prop.
10
+ - A table caption the surrounding heading already shows.
11
+ - A live-region announcement.
12
+
13
+ ## When not to use
14
+
15
+ - An icon-only `Button`: give it `icon` and `aria-label`.
16
+ - Text hidden from everyone: do not render it.
17
+ - A status dot without a label: give `StatusDot` an `aria-label`.
18
+
19
+ ## Props (kit level)
20
+
21
+ | Prop | Type | Default |
22
+ |------|------|---------|
23
+ | `render` | `ReactElement` or callback - the element, such as `<caption />` | `span` |
24
+ | `className` | `string` - merged after the kit class | - |
25
+
26
+ ## Accessibility
27
+
28
+ - The box is absolutely positioned, 1x1px, clipped with
29
+ `clip-path: inset(50%)`, with no padding or border and no wrapping; its
30
+ text stays in the accessibility tree.
31
+
32
+ ## Examples
33
+
34
+ ```tsx
35
+ import { VisuallyHidden } from '@gears-frontx/ui-kit';
36
+
37
+ <a href="/docs"><ExternalLink aria-hidden="true" /><VisuallyHidden>Open the docs</VisuallyHidden></a>
38
+ <VisuallyHidden render={<caption />}>Members</VisuallyHidden>
39
+ <span className="sr-only">Opens in a new tab</span>
40
+ ```
41
+
42
+ ## Anti-patterns
43
+
44
+ - Do not hide a visible label: sighted users need it too.
@@ -1,56 +1,56 @@
1
1
  "use client";
2
2
  import { jsxs as p, jsx as n } from "react/jsx-runtime";
3
3
  import { Menu as r } from "@base-ui/react/menu";
4
- import { cx as i, cva as f } from "class-variance-authority";
5
- import { CheckIcon as _, ChevronRightIcon as h } from "lucide-react";
6
- import { useContext as D, createContext as j } from "react";
7
- import './chunks/dropdown-menu.TU3FHXbJ.css';const M = "_positioner_1w0pj_14", S = "_popup_1w0pj_6", N = "_subPopup_1w0pj_33", x = "_label_1w0pj_124", C = "_item_1w0pj_121", T = "_variantDefault_1w0pj_166", k = "_variantDestructive_1w0pj_193", P = "_checkboxItem_1w0pj_121", R = "_radioItem_1w0pj_121", G = "_itemIndicator_1w0pj_235", L = "_indicatorSideStart_1w0pj_254", V = "_separator_1w0pj_272", y = "_shortcut_1w0pj_279", q = "_subTrigger_1w0pj_122", z = "_subTriggerIcon_1w0pj_337", A = "_svgIcon_1w0pj_344", e = {
8
- positioner: M,
9
- popup: S,
10
- subPopup: N,
11
- label: x,
12
- item: C,
13
- variantDefault: T,
14
- variantDestructive: k,
15
- checkboxItem: P,
16
- radioItem: R,
17
- itemIndicator: G,
4
+ import { cx as a, cva as h } from "class-variance-authority";
5
+ import { CheckIcon as g, ChevronRightIcon as D } from "lucide-react";
6
+ import { useContext as M, createContext as S } from "react";
7
+ import './chunks/dropdown-menu.DT1_JLqL.css';const N = "_positioner_s67g2_14", w = "_popup_s67g2_6", x = "_subPopup_s67g2_32", C = "_label_s67g2_123", T = "_item_s67g2_120", k = "_variantDefault_s67g2_165", P = "_variantDestructive_s67g2_192", R = "_checkboxItem_s67g2_120", G = "_radioItem_s67g2_120", j = "_itemIndicator_s67g2_234", L = "_indicatorSideStart_s67g2_253", V = "_separator_s67g2_271", y = "_shortcut_s67g2_278", q = "_subTrigger_s67g2_121", z = "_subTriggerIcon_s67g2_336", A = "_svgIcon_s67g2_343", e = {
8
+ positioner: N,
9
+ popup: w,
10
+ subPopup: x,
11
+ label: C,
12
+ item: T,
13
+ variantDefault: k,
14
+ variantDestructive: P,
15
+ checkboxItem: R,
16
+ radioItem: G,
17
+ itemIndicator: j,
18
18
  indicatorSideStart: L,
19
19
  separator: V,
20
20
  shortcut: y,
21
21
  subTrigger: q,
22
22
  subTriggerIcon: z,
23
23
  svgIcon: A
24
- }, m = j(void 0), Q = r.Root;
24
+ }, m = S(void 0), Q = r.Root;
25
25
  function U({ className: t, ...o }) {
26
26
  return /* @__PURE__ */ n(r.Trigger, { className: t, ...o });
27
27
  }
28
28
  function B({
29
29
  className: t,
30
30
  children: o,
31
- container: a,
32
- side: c = "bottom",
33
- sideOffset: s = 4,
31
+ container: s,
32
+ side: i = "bottom",
33
+ sideOffset: c = 4,
34
34
  align: u = "start",
35
- alignOffset: l = 0,
36
- positionMethod: I,
37
- collisionBoundary: g,
35
+ alignOffset: _ = 0,
36
+ positionMethod: l,
37
+ collisionBoundary: I,
38
38
  collisionPadding: b,
39
- ...w
39
+ ...v
40
40
  }) {
41
- const v = D(m), d = a ?? v;
41
+ const f = M(m), d = s ?? f;
42
42
  return /* @__PURE__ */ n(m.Provider, { value: d, children: /* @__PURE__ */ n(r.Portal, { container: d, children: /* @__PURE__ */ n(
43
43
  r.Positioner,
44
44
  {
45
- side: c,
46
- sideOffset: s,
45
+ side: i,
46
+ sideOffset: c,
47
47
  align: u,
48
- alignOffset: l,
49
- positionMethod: I,
50
- collisionBoundary: g,
48
+ alignOffset: _,
49
+ positionMethod: l,
50
+ collisionBoundary: I,
51
51
  collisionPadding: b,
52
52
  className: e.positioner,
53
- children: /* @__PURE__ */ n(r.Popup, { className: i(e.popup, t), ...w, children: o })
53
+ children: /* @__PURE__ */ n(r.Popup, { className: a(e.popup, t), ...v, children: o })
54
54
  }
55
55
  ) }) });
56
56
  }
@@ -58,9 +58,9 @@ function W({ className: t, ...o }) {
58
58
  return /* @__PURE__ */ n(r.Group, { className: t, ...o });
59
59
  }
60
60
  function X({ className: t, ...o }) {
61
- return /* @__PURE__ */ n(r.GroupLabel, { className: i(e.label, t), ...o });
61
+ return /* @__PURE__ */ n(r.GroupLabel, { className: a(e.label, t), ...o });
62
62
  }
63
- const E = f(e.item, {
63
+ const E = h(e.item, {
64
64
  variants: {
65
65
  variant: {
66
66
  default: e.variantDefault,
@@ -71,17 +71,17 @@ const E = f(e.item, {
71
71
  variant: "default"
72
72
  }
73
73
  });
74
- function Y({ className: t, variant: o, ...a }) {
75
- return /* @__PURE__ */ n(r.Item, { className: E({ variant: o, className: t }), ...a });
74
+ function Y({ className: t, variant: o, ...s }) {
75
+ return /* @__PURE__ */ n(r.Item, { className: E({ variant: o, className: t }), ...s });
76
76
  }
77
77
  function Z({
78
78
  className: t,
79
79
  children: o,
80
- ...a
80
+ ...s
81
81
  }) {
82
- return /* @__PURE__ */ p(r.CheckboxItem, { className: i(e.checkboxItem, t), ...a, children: [
82
+ return /* @__PURE__ */ p(r.CheckboxItem, { className: a(e.checkboxItem, t), ...s, children: [
83
83
  o,
84
- /* @__PURE__ */ n(r.CheckboxItemIndicator, { className: e.itemIndicator, children: /* @__PURE__ */ n(_, { className: e.svgIcon }) })
84
+ /* @__PURE__ */ n(r.CheckboxItemIndicator, { className: e.itemIndicator, children: /* @__PURE__ */ n(g, { className: e.svgIcon }) })
85
85
  ] });
86
86
  }
87
87
  function $({ className: t, ...o }) {
@@ -90,58 +90,58 @@ function $({ className: t, ...o }) {
90
90
  function tt({
91
91
  className: t,
92
92
  children: o,
93
- indicatorSide: a = "end",
94
- ...c
93
+ indicatorSide: s = "end",
94
+ ...i
95
95
  }) {
96
96
  return /* @__PURE__ */ p(
97
97
  r.RadioItem,
98
98
  {
99
- className: i(
99
+ className: a(
100
100
  e.radioItem,
101
- a === "start" && e.indicatorSideStart,
101
+ s === "start" && e.indicatorSideStart,
102
102
  t
103
103
  ),
104
- ...c,
104
+ ...i,
105
105
  children: [
106
106
  o,
107
- /* @__PURE__ */ n(r.RadioItemIndicator, { className: e.itemIndicator, children: /* @__PURE__ */ n(_, { className: e.svgIcon }) })
107
+ /* @__PURE__ */ n(r.RadioItemIndicator, { className: e.itemIndicator, children: /* @__PURE__ */ n(g, { className: e.svgIcon }) })
108
108
  ]
109
109
  }
110
110
  );
111
111
  }
112
112
  function ot({ className: t, ...o }) {
113
- return /* @__PURE__ */ n(r.Separator, { className: i(e.separator, t), ...o });
113
+ return /* @__PURE__ */ n(r.Separator, { className: a(e.separator, t), ...o });
114
114
  }
115
115
  function et({ className: t, ...o }) {
116
- return /* @__PURE__ */ n("span", { className: i(e.shortcut, t), ...o });
116
+ return /* @__PURE__ */ n("span", { className: a(e.shortcut, t), ...o });
117
117
  }
118
118
  const nt = r.SubmenuRoot;
119
119
  function rt({
120
120
  className: t,
121
121
  children: o,
122
- ...a
122
+ ...s
123
123
  }) {
124
- return /* @__PURE__ */ p(r.SubmenuTrigger, { className: i(e.subTrigger, t), ...a, children: [
124
+ return /* @__PURE__ */ p(r.SubmenuTrigger, { className: a(e.subTrigger, t), ...s, children: [
125
125
  o,
126
- /* @__PURE__ */ n(h, { className: i(e.svgIcon, e.subTriggerIcon) })
126
+ /* @__PURE__ */ n(D, { className: a(e.svgIcon, e.subTriggerIcon) })
127
127
  ] });
128
128
  }
129
- function at({
129
+ function st({
130
130
  className: t,
131
131
  side: o = "right",
132
- align: a = "start",
133
- sideOffset: c = 0,
134
- alignOffset: s = -3,
132
+ align: s = "start",
133
+ sideOffset: i = 0,
134
+ alignOffset: c = -3,
135
135
  ...u
136
136
  }) {
137
137
  return /* @__PURE__ */ n(
138
138
  B,
139
139
  {
140
- className: i(e.subPopup, t),
140
+ className: a(e.subPopup, t),
141
141
  side: o,
142
- align: a,
143
- sideOffset: c,
144
- alignOffset: s,
142
+ align: s,
143
+ sideOffset: i,
144
+ alignOffset: c,
145
145
  ...u
146
146
  }
147
147
  );
@@ -158,7 +158,7 @@ export {
158
158
  ot as DropdownMenuSeparator,
159
159
  et as DropdownMenuShortcut,
160
160
  nt as DropdownMenuSub,
161
- at as DropdownMenuSubContent,
161
+ st as DropdownMenuSubContent,
162
162
  rt as DropdownMenuSubTrigger,
163
163
  U as DropdownMenuTrigger
164
164
  };