@gears-frontx/ui-kit 0.4.2 → 0.4.3

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 (150) hide show
  1. package/README.md +6 -5
  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/empty.DWqLrSfF.css +1 -0
  20. package/dist/chunks/heading.DQxQs5po.css +1 -0
  21. package/dist/chunks/item.BQ70Khqj.css +1 -0
  22. package/dist/chunks/link.BOE4f-aB.css +1 -0
  23. package/dist/chunks/message-scroller.CBjPcz8Y.css +1 -0
  24. package/dist/chunks/sheet.BkZyzAbA.css +1 -0
  25. package/dist/chunks/sidebar.CIuN--7U.css +1 -0
  26. package/dist/chunks/slider.DY1XDCPw.css +1 -0
  27. package/dist/chunks/status-dot.39NKkKQF.css +1 -0
  28. package/dist/chunks/text.7frjnkUr.css +1 -0
  29. package/dist/chunks/visually-hidden.Bd2oAR5D.css +1 -0
  30. package/dist/code-block.d.ts +1 -0
  31. package/dist/code-block.js +152 -0
  32. package/dist/code-block.js.map +1 -0
  33. package/dist/command.js +63 -48
  34. package/dist/command.js.map +1 -1
  35. package/dist/components/alert/alert.d.ts +3 -2
  36. package/dist/components/alert/alert.d.ts.map +1 -1
  37. package/dist/components/attachment/attachment.d.ts +10 -3
  38. package/dist/components/attachment/attachment.d.ts.map +1 -1
  39. package/dist/components/card/card.d.ts +6 -4
  40. package/dist/components/card/card.d.ts.map +1 -1
  41. package/dist/components/code-block/code-block.d.ts +57 -0
  42. package/dist/components/code-block/code-block.d.ts.map +1 -0
  43. package/dist/components/code-block/public.d.ts +2 -0
  44. package/dist/components/code-block/public.d.ts.map +1 -0
  45. package/dist/components/command/command.d.ts +1 -1
  46. package/dist/components/command/command.d.ts.map +1 -1
  47. package/dist/components/description-list/description-list.d.ts +21 -0
  48. package/dist/components/description-list/description-list.d.ts.map +1 -0
  49. package/dist/components/description-list/public.d.ts +2 -0
  50. package/dist/components/description-list/public.d.ts.map +1 -0
  51. package/dist/components/empty/empty.d.ts +3 -2
  52. package/dist/components/empty/empty.d.ts.map +1 -1
  53. package/dist/components/heading/heading.d.ts +10 -0
  54. package/dist/components/heading/heading.d.ts.map +1 -0
  55. package/dist/components/heading/public.d.ts +2 -0
  56. package/dist/components/heading/public.d.ts.map +1 -0
  57. package/dist/components/input-otp/input-otp.d.ts +1 -1
  58. package/dist/components/input-otp/input-otp.d.ts.map +1 -1
  59. package/dist/components/item/item.d.ts +15 -6
  60. package/dist/components/item/item.d.ts.map +1 -1
  61. package/dist/components/link/link.d.ts +18 -0
  62. package/dist/components/link/link.d.ts.map +1 -0
  63. package/dist/components/link/public.d.ts +2 -0
  64. package/dist/components/link/public.d.ts.map +1 -0
  65. package/dist/components/sidebar/sidebar.d.ts +13 -3
  66. package/dist/components/sidebar/sidebar.d.ts.map +1 -1
  67. package/dist/components/slider/slider.d.ts +1 -1
  68. package/dist/components/slider/slider.d.ts.map +1 -1
  69. package/dist/components/table/table.d.ts.map +1 -1
  70. package/dist/components/text/public.d.ts +2 -0
  71. package/dist/components/text/public.d.ts.map +1 -0
  72. package/dist/components/text/text.d.ts +11 -0
  73. package/dist/components/text/text.d.ts.map +1 -0
  74. package/dist/components/visually-hidden/public.d.ts +2 -0
  75. package/dist/components/visually-hidden/public.d.ts.map +1 -0
  76. package/dist/components/visually-hidden/visually-hidden.d.ts +4 -0
  77. package/dist/components/visually-hidden/visually-hidden.d.ts.map +1 -0
  78. package/dist/description-list.d.ts +1 -0
  79. package/dist/description-list.js +78 -0
  80. package/dist/description-list.js.map +1 -0
  81. package/dist/docs/alert.md +8 -2
  82. package/dist/docs/attachment.md +20 -8
  83. package/dist/docs/avatar.md +8 -2
  84. package/dist/docs/badge.md +12 -11
  85. package/dist/docs/button.md +16 -4
  86. package/dist/docs/calendar.md +6 -0
  87. package/dist/docs/card.md +38 -6
  88. package/dist/docs/carousel.md +4 -2
  89. package/dist/docs/chart.md +23 -0
  90. package/dist/docs/code-block.md +114 -0
  91. package/dist/docs/description-list.md +53 -0
  92. package/dist/docs/empty.md +9 -3
  93. package/dist/docs/heading.md +60 -0
  94. package/dist/docs/item.md +70 -3
  95. package/dist/docs/link.md +48 -0
  96. package/dist/docs/message-scroller.md +5 -0
  97. package/dist/docs/sheet.md +20 -3
  98. package/dist/docs/sidebar.md +27 -0
  99. package/dist/docs/status-dot.md +2 -2
  100. package/dist/docs/switch.md +10 -4
  101. package/dist/docs/text.md +51 -0
  102. package/dist/docs/visually-hidden.md +44 -0
  103. package/dist/empty.js +47 -36
  104. package/dist/empty.js.map +1 -1
  105. package/dist/heading.d.ts +1 -0
  106. package/dist/heading.js +36 -0
  107. package/dist/heading.js.map +1 -0
  108. package/dist/index.d.ts +6 -0
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +427 -401
  111. package/dist/index.js.map +1 -1
  112. package/dist/input-otp.js +34 -20
  113. package/dist/input-otp.js.map +1 -1
  114. package/dist/item.js +119 -71
  115. package/dist/item.js.map +1 -1
  116. package/dist/link.d.ts +1 -0
  117. package/dist/link.js +55 -0
  118. package/dist/link.js.map +1 -0
  119. package/dist/message-scroller.js +24 -24
  120. package/dist/sheet.js +41 -41
  121. package/dist/sidebar.js +220 -206
  122. package/dist/sidebar.js.map +1 -1
  123. package/dist/slider.js +34 -21
  124. package/dist/slider.js.map +1 -1
  125. package/dist/status-dot.js +25 -25
  126. package/dist/table.js +172 -157
  127. package/dist/table.js.map +1 -1
  128. package/dist/text.d.ts +1 -0
  129. package/dist/text.js +53 -0
  130. package/dist/text.js.map +1 -0
  131. package/dist/theme.css +29 -6
  132. package/dist/utilities.css +25 -2
  133. package/dist/visually-hidden.d.ts +1 -0
  134. package/dist/visually-hidden.js +18 -0
  135. package/dist/visually-hidden.js.map +1 -0
  136. package/llms.txt +72 -15
  137. package/package.json +1 -1
  138. package/dist/chunks/alert.DsgRIXLn.css +0 -1
  139. package/dist/chunks/attachment.CZuZdlXC.css +0 -1
  140. package/dist/chunks/avatar.BMm-Z9l5.css +0 -1
  141. package/dist/chunks/badge.BCreEn3O.css +0 -1
  142. package/dist/chunks/card.DdBl-usf.css +0 -1
  143. package/dist/chunks/chart.CeyctrXQ.css +0 -1
  144. package/dist/chunks/empty.DnAKlw2g.css +0 -1
  145. package/dist/chunks/item.BkcgydVc.css +0 -1
  146. package/dist/chunks/message-scroller.CbLooS7Q.css +0 -1
  147. package/dist/chunks/sheet.BWvXXyXk.css +0 -1
  148. package/dist/chunks/sidebar.DdEvMURX.css +0 -1
  149. package/dist/chunks/slider.inyNxx4y.css +0 -1
  150. package/dist/chunks/status-dot.DWa2qGKe.css +0 -1
package/dist/docs/card.md CHANGED
@@ -35,6 +35,7 @@ Every part except `Card` itself is a passthrough over
35
35
 
36
36
  | Prop | Type | Default |
37
37
  |------|------|---------|
38
+ | `variant` | `'default' \| 'panel'` - `panel` is the lifted frame a workbench sits in: a 16px corner (`--radius-2xl`), the `--panel-shadow`, and no padding or gap of its own, so its panes lay themselves out edge to edge | `'default'` |
38
39
  | `size` | `'default' \| 'sm'` — scales the card's internal padding and gap, and `CardTitle`'s font size | `'default'` |
39
40
  | `className` | `string` — merged after the kit class | — |
40
41
 
@@ -54,12 +55,43 @@ padding when the image is the first child, and the image's own corners
54
55
  are rounded to match the card (first child rounds the top corners, last
55
56
  child the bottom ones) — useful for a media card with a full-bleed image.
56
57
 
57
- `CardTitle` renders a plain `div`, not a heading element — like every
58
- other part, it has no `render` prop to swap it (Card has no Base UI
59
- primitive to supply one). When a card is a real page landmark rather
60
- than a decorative grouping, supply your own heading (e.g. wrap the text
61
- in an `h2`/`h3`) so the page keeps a document outline; `CardTitle` alone
62
- contributes nothing to it.
58
+ `CardTitle` renders a plain `div` by default. When a card is a real page
59
+ section rather than a decorative grouping, give the title its heading
60
+ element with `render={<h3 />}` (any level): the element changes, the
61
+ title keeps its look, and the page keeps a document outline. Where the
62
+ element cannot change, `role="heading"` with `aria-level` is the
63
+ fallback.
64
+
65
+ A panel frames a workbench, such as a contained `Sidebar` beside a
66
+ document pane:
67
+
68
+ ```tsx
69
+ <Card variant="panel">
70
+ <SidebarProvider contained>
71
+ <Sidebar collapsible="none">{/* file list */}</Sidebar>
72
+ <SidebarInset render={<div />}>{/* the file */}</SidebarInset>
73
+ </SidebarProvider>
74
+ </Card>
75
+ ```
76
+
77
+ `Card` takes `render` too. `render={<a href="..." />}` (or a router link)
78
+ makes the whole card one link: no underline, the page's font, a `--ring`
79
+ border on hover and the kit's focus ring on keyboard focus. Such a card
80
+ must hold no other link or button, since HTML allows no interactive
81
+ content inside a link; for a row with its own actions use `Item`, or keep
82
+ the card a `div` and make its title the link. A `button` root is not
83
+ offered: a button allows only phrasing content, and a card's header and
84
+ title are blocks. Another element (`<article>`, `<section>`) gains no
85
+ hover, pointer or focus styling.
86
+
87
+ ```tsx
88
+ <Card render={<a href="/guides/setup" />}>
89
+ <CardHeader>
90
+ <CardTitle render={<h3 />}>Setup guide</CardTitle>
91
+ <CardDescription>From install to the first screen.</CardDescription>
92
+ </CardHeader>
93
+ </Card>
94
+ ```
63
95
 
64
96
  `CardFooter` is a plain flex row and contributes **no gap of its own** —
65
97
  two buttons dropped straight into it render flush against each other.
@@ -91,8 +91,10 @@ import {
91
91
  CarouselPrevious,
92
92
  } from '@gears-frontx/ui-kit';
93
93
 
94
- // Horizontal (default), with nav buttons
95
- <Carousel>
94
+ // Horizontal (default), with nav buttons. The root is a region landmark:
95
+ // give each carousel its own aria-label, so two on one page can be told
96
+ // apart (axe landmark-unique)
97
+ <Carousel aria-label="Featured templates">
96
98
  <CarouselContent>
97
99
  <CarouselItem>Slide 1</CarouselItem>
98
100
  <CarouselItem>Slide 2</CarouselItem>
@@ -34,6 +34,29 @@ layout, spacing, text roles) or supplied per-instance by the consumer's own
34
34
  `content` prop for themed rendering, or omit `content` for Recharts'
35
35
  own default.
36
36
 
37
+ ## Sizing
38
+
39
+ `ChartContainer` keeps a 16:9 aspect ratio by default, so a standalone
40
+ chart takes its height from its width. In a slot that gives the chart its
41
+ height (a dashboard card, a grid row, a split pane), set
42
+ `--chart-aspect-ratio: auto` on the container or any ancestor, together
43
+ with a height or a stretching parent:
44
+
45
+ ```tsx
46
+ <ChartContainer config={chartConfig} style={{ '--chart-aspect-ratio': 'auto', height: '100%' } as React.CSSProperties}>
47
+ …
48
+ </ChartContainer>
49
+ ```
50
+
51
+ Set the custom property rather than overriding `aspect-ratio` from a
52
+ class: a class has the same weight as the kit's rule, so it wins only when
53
+ its stylesheet happens to load after the kit's. Any other ratio works the
54
+ same way (`--chart-aspect-ratio: 4 / 3`). Two things to know: the property
55
+ inherits, so set on a dashboard wrapper it reaches every chart inside,
56
+ including one with no height of its own; and a value that is not a ratio
57
+ (`16:9`) makes `aspect-ratio` fall back to `auto`, not to 16:9, so a chart
58
+ with no height then collapses to nothing.
59
+
37
60
  ## Series colors: `ChartConfig`, with the `--chart-*` palette behind it
38
61
 
39
62
  ```ts
@@ -0,0 +1,114 @@
1
+ # CodeBlock
2
+
3
+ Code, terminal output, logs and diffs, with an optional header (title and
4
+ actions), line numbers, wrapping, diff and highlighted lines, and a small
5
+ size. A port of [shadcn/ui's base CodeBlock](https://ui.shadcn.com/docs/components/base/code-block)
6
+ to CSS Modules; no Base UI primitive.
7
+
8
+ Composition: `CodeBlock` (→ `CodeBlockHeader` (→ `CodeBlockTitle`,
9
+ `CodeBlockActions` (→ `CodeBlockCopyButton`)), `CodeBlockActions` (floating,
10
+ when there is no header), `CodeBlockContent` (→ `CodeBlockLine`),
11
+ `CodeBlockFooter`).
12
+
13
+ Syntax highlighting is not ported. Upstream keeps it in a separate hook
14
+ (`useHighlightedCode`, on Shiki), which would add a highlighter to every
15
+ consumer; a consumer that highlights renders the tokens inside
16
+ `CodeBlockLine` children.
17
+
18
+ ## When to use
19
+
20
+ - An install or start command with a copy button.
21
+ - A file excerpt in a guide, terminal output, a log or a diff.
22
+
23
+ ## When not to use
24
+
25
+ - A key or a shortcut: use `Kbd`.
26
+ - Code inside rendered Markdown or HTML: use the kit's `typeset.css`.
27
+ - A single path or name inside a line of text: use `Text` with
28
+ `typography="mono"`.
29
+
30
+ ## Props (kit level)
31
+
32
+ | Part | Prop | Type | Default |
33
+ |------|------|------|---------|
34
+ | `CodeBlock` | `variant` | `'default' \| 'destructive'` - `destructive` for error output, on `--destructive` | `'default'` |
35
+ | | `size` | `'default' \| 'sm'` - the body or the meta size, tighter insets at `sm` | `'default'` |
36
+ | `CodeBlockContent` | `wrap` | `boolean` - wrap long lines instead of scrolling sideways | `false` |
37
+ | | `lineNumbers` | `boolean` - number the lines; a string child is split into lines | `false` |
38
+ | | `startLine` | `number` - the first line's number | `1` |
39
+ | `CodeBlockLine` | `variant` | `'default' \| 'added' \| 'removed' \| 'highlighted'` - `added` and `removed` add a + or − marker | `'default'` |
40
+ | `CodeBlockCopyButton` | `value` | `string` - the text written to the clipboard | required |
41
+ | | `copyLabel`, `copiedLabel` | `string` - the button's name before and after a copy, and the announcement | `'Copy'`, `'Copied'` |
42
+
43
+ `CodeBlockCopyButton` is a kit `Button` (`variant="ghost"`, `size="sm"`,
44
+ icon-only) and takes the other Button props except `icon`, `end`,
45
+ `children`, `render`, `nativeButton` and `aria-label`: it draws its own
46
+ glyph and names itself from `copyLabel` and `copiedLabel`. `CodeBlockHeader`,
47
+ `CodeBlockTitle`, `CodeBlockActions` and `CodeBlockFooter` take their
48
+ element's props. The family ships `'use client'` (the copy button holds
49
+ state).
50
+
51
+ The edge fade of a scrolling block is the `scroll-fade-x` (or, wrapped,
52
+ `scroll-fade-y`) class from `utilities.css`: without that import the code
53
+ scrolls with no fade.
54
+
55
+ ## Behavior
56
+
57
+ - `CodeBlockContent` is a `pre` that is always a tab stop, so a keyboard
58
+ user can scroll a long line; keyboard focus marks the whole block with
59
+ the kit's focus ring. It is always left to right; the header follows
60
+ the page direction. Name it with `aria-label` when a page holds several
61
+ blocks.
62
+ - A string child renders as one text node, so a block stays cheap while
63
+ output streams. With `lineNumbers`, a string is split into lines; the
64
+ numbers come from a CSS counter and stay out of a copied selection, and
65
+ an empty line keeps a newline so blank lines survive the copy.
66
+ - A long `CodeBlockTitle` is cut with an ellipsis; to link the title to a
67
+ file, wrap it in an anchor.
68
+ - `CodeBlockActions` placed straight in `CodeBlock` (no header) float over
69
+ the top end of the block and show on hover or focus, and always on a
70
+ touch screen.
71
+ - The copy button writes `value`, switches to a check glyph and
72
+ `copiedLabel` for two seconds (a second copy restarts the two seconds)
73
+ and says `copiedLabel` once in a polite live region. A refused write, or
74
+ a page with no clipboard (an insecure context), changes nothing.
75
+ - Cap a long block's height with a `max-height` on `CodeBlockContent`; it
76
+ scrolls inside the block.
77
+
78
+ ## Examples
79
+
80
+ ```tsx
81
+ import {
82
+ CodeBlock,
83
+ CodeBlockActions,
84
+ CodeBlockContent,
85
+ CodeBlockCopyButton,
86
+ CodeBlockHeader,
87
+ CodeBlockLine,
88
+ CodeBlockTitle,
89
+ } from '@gears-frontx/ui-kit';
90
+
91
+ <CodeBlock>
92
+ <CodeBlockHeader>
93
+ <CodeBlockTitle>Terminal</CodeBlockTitle>
94
+ <CodeBlockActions>
95
+ <CodeBlockCopyButton value={command} />
96
+ </CodeBlockActions>
97
+ </CodeBlockHeader>
98
+ <CodeBlockContent>{command}</CodeBlockContent>
99
+ </CodeBlock>
100
+
101
+ <CodeBlock size="sm">
102
+ <CodeBlockContent lineNumbers>
103
+ <CodeBlockLine variant="removed">return &lt;p&gt;Hello&lt;/p&gt;</CodeBlockLine>
104
+ <CodeBlockLine variant="added">return &lt;p&gt;Hello, {'{name}'}&lt;/p&gt;</CodeBlockLine>
105
+ </CodeBlockContent>
106
+ </CodeBlock>
107
+ ```
108
+
109
+ ## Anti-patterns
110
+
111
+ - Do not put a highlighter's HTML string into `CodeBlockContent`: render
112
+ the tokens as elements inside `CodeBlockLine`.
113
+ - Do not wrap the whole block in a link or a button: it holds a focusable
114
+ scroll region and its own actions.
@@ -0,0 +1,53 @@
1
+ # DescriptionList
2
+
3
+ Name and value pairs on real `dl`/`dt`/`dd`, so assistive technology keeps each term with its value. `DescriptionListItem` is the `div` grouping HTML allows inside `dl`.
4
+
5
+ ## When to use
6
+
7
+ - The facts of a record in a detail panel.
8
+ - A short aside of requirements and values.
9
+
10
+ ## When not to use
11
+
12
+ - A form row with an input: use `Field`.
13
+ - Rows the user acts on or navigates: use `Item`.
14
+ - Data compared across many records: use `Table`.
15
+
16
+ ## Props (kit level)
17
+
18
+ | Part | Prop | Type | Default |
19
+ |------|------|------|---------|
20
+ | `DescriptionList` | `orientation` | `'vertical' \| 'horizontal'` - term above value, or a two-column grid whose term column takes the widest term | `'vertical'` |
21
+ | | `size` | `'default' \| 'sm'` - row gap and the value's role (body or meta) | `'default'` |
22
+ | `DescriptionListDetails` | `typography` | `'body' \| 'mono'` - the value's ramp role; `mono` sets `--font-mono` | `'body'` |
23
+
24
+ No part takes `render`: the elements are the point of the component. Terms use the label role on `--muted-foreground`.
25
+
26
+ ## Accessibility
27
+
28
+ - Real description list semantics; horizontal items sit on a subgrid, so every term lines up in one column.
29
+
30
+ ## Layout
31
+
32
+ The horizontal term column is as wide as the longest term and does not shrink, so it suits short terms (Owner, Path, Updated). In a panel narrower than the longest term, use the vertical orientation.
33
+
34
+ ## Examples
35
+
36
+ ```tsx
37
+ import { DescriptionListDetails, DescriptionListItem, DescriptionList, DescriptionListTerm } from '@gears-frontx/ui-kit';
38
+
39
+ <DescriptionList orientation="horizontal">
40
+ <DescriptionListItem>
41
+ <DescriptionListTerm>Owner</DescriptionListTerm>
42
+ <DescriptionListDetails>Platform team</DescriptionListDetails>
43
+ </DescriptionListItem>
44
+ <DescriptionListItem>
45
+ <DescriptionListTerm>Path</DescriptionListTerm>
46
+ <DescriptionListDetails typography="mono">src/app/main.tsx</DescriptionListDetails>
47
+ </DescriptionListItem>
48
+ </DescriptionList>
49
+ ```
50
+
51
+ ## Anti-patterns
52
+
53
+ - Do not build the pairs from `div`s and `span`s.
@@ -31,9 +31,15 @@ Composition: `Empty` (root) → `EmptyHeader` (→ `EmptyMedia`, `EmptyTitle`,
31
31
  | `variant` | `'default' \| 'icon'` — `icon` draws a muted rounded square behind the icon; `default` stays transparent | `'default'` |
32
32
  | `className` | `string` — merged after the variant class | — |
33
33
 
34
- `Empty`, `EmptyHeader`, `EmptyTitle`, `EmptyDescription`, `EmptyDetail`,
35
- `EmptyActions` and `EmptyContent` take no kit-specific props - every prop is
36
- the underlying native element's props (`EmptyDescription` renders a `<div>`,
34
+ `EmptyTitle`:
35
+
36
+ | Prop | Type | Default |
37
+ |------|------|---------|
38
+ | `render` | `ReactElement` or callback - the element, such as `<h2 />` to put the headline in the page outline; the title keeps its look | `div` |
39
+
40
+ `Empty`, `EmptyHeader`, `EmptyDescription`, `EmptyDetail`, `EmptyActions`
41
+ and `EmptyContent` take no kit-specific props - every prop is the
42
+ underlying native element's props (`EmptyDescription` renders a `<div>`,
37
43
  matching upstream, despite its own props type naming `<p>` - see
38
44
  `empty.tsx`), forwarded as-is.
39
45
 
@@ -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
@@ -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`.