@gears-frontx/ui-kit 0.4.1 → 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.
- package/README.md +6 -5
- package/dist/alert.js +35 -24
- package/dist/alert.js.map +1 -1
- package/dist/attachment.js +117 -76
- package/dist/attachment.js.map +1 -1
- package/dist/avatar.js +43 -43
- package/dist/badge.js +14 -14
- package/dist/card.js +81 -44
- package/dist/card.js.map +1 -1
- package/dist/chart.js +50 -50
- package/dist/chunks/alert.Csv2-ccF.css +1 -0
- package/dist/chunks/attachment.BRyIQq3F.css +1 -0
- package/dist/chunks/avatar.7EUG65-M.css +1 -0
- package/dist/chunks/badge.BwUxa9PB.css +1 -0
- package/dist/chunks/card.DSiUMxGK.css +1 -0
- package/dist/chunks/chart.B9cGEno8.css +1 -0
- package/dist/chunks/code-block.r7Cm0ncj.css +1 -0
- package/dist/chunks/description-list.Cx-vFGJL.css +1 -0
- package/dist/chunks/empty.DWqLrSfF.css +1 -0
- package/dist/chunks/heading.DQxQs5po.css +1 -0
- package/dist/chunks/item.BQ70Khqj.css +1 -0
- package/dist/chunks/link.BOE4f-aB.css +1 -0
- package/dist/chunks/message-scroller.CBjPcz8Y.css +1 -0
- package/dist/chunks/page-header.72nfJNkg.css +1 -0
- package/dist/chunks/sheet.BkZyzAbA.css +1 -0
- package/dist/chunks/sidebar.CIuN--7U.css +1 -0
- package/dist/chunks/slider.DY1XDCPw.css +1 -0
- package/dist/chunks/status-dot.39NKkKQF.css +1 -0
- package/dist/chunks/text.7frjnkUr.css +1 -0
- package/dist/chunks/visually-hidden.Bd2oAR5D.css +1 -0
- package/dist/code-block.d.ts +1 -0
- package/dist/code-block.js +152 -0
- package/dist/code-block.js.map +1 -0
- package/dist/command.js +63 -48
- package/dist/command.js.map +1 -1
- package/dist/components/alert/alert.d.ts +3 -2
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/attachment/attachment.d.ts +10 -3
- package/dist/components/attachment/attachment.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +6 -4
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/code-block/code-block.d.ts +57 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/public.d.ts +2 -0
- package/dist/components/code-block/public.d.ts.map +1 -0
- package/dist/components/command/command.d.ts +1 -1
- package/dist/components/command/command.d.ts.map +1 -1
- package/dist/components/description-list/description-list.d.ts +21 -0
- package/dist/components/description-list/description-list.d.ts.map +1 -0
- package/dist/components/description-list/public.d.ts +2 -0
- package/dist/components/description-list/public.d.ts.map +1 -0
- package/dist/components/empty/empty.d.ts +3 -2
- package/dist/components/empty/empty.d.ts.map +1 -1
- package/dist/components/heading/heading.d.ts +10 -0
- package/dist/components/heading/heading.d.ts.map +1 -0
- package/dist/components/heading/public.d.ts +2 -0
- package/dist/components/heading/public.d.ts.map +1 -0
- package/dist/components/input-otp/input-otp.d.ts +1 -1
- package/dist/components/input-otp/input-otp.d.ts.map +1 -1
- package/dist/components/item/item.d.ts +15 -6
- package/dist/components/item/item.d.ts.map +1 -1
- package/dist/components/link/link.d.ts +18 -0
- package/dist/components/link/link.d.ts.map +1 -0
- package/dist/components/link/public.d.ts +2 -0
- package/dist/components/link/public.d.ts.map +1 -0
- package/dist/components/page-header/page-header.d.ts +50 -0
- package/dist/components/page-header/page-header.d.ts.map +1 -0
- package/dist/components/page-header/public.d.ts +2 -0
- package/dist/components/page-header/public.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar.d.ts +13 -3
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/slider/slider.d.ts +1 -1
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/text/public.d.ts +2 -0
- package/dist/components/text/public.d.ts.map +1 -0
- package/dist/components/text/text.d.ts +11 -0
- package/dist/components/text/text.d.ts.map +1 -0
- package/dist/components/visually-hidden/public.d.ts +2 -0
- package/dist/components/visually-hidden/public.d.ts.map +1 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +4 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/description-list.d.ts +1 -0
- package/dist/description-list.js +78 -0
- package/dist/description-list.js.map +1 -0
- package/dist/docs/alert.md +8 -2
- package/dist/docs/attachment.md +20 -8
- package/dist/docs/avatar.md +8 -2
- package/dist/docs/badge.md +12 -11
- package/dist/docs/button.md +16 -4
- package/dist/docs/calendar.md +6 -0
- package/dist/docs/card.md +38 -6
- package/dist/docs/carousel.md +4 -2
- package/dist/docs/chart.md +23 -0
- package/dist/docs/code-block.md +114 -0
- package/dist/docs/description-list.md +53 -0
- package/dist/docs/empty.md +9 -3
- package/dist/docs/heading.md +60 -0
- package/dist/docs/item.md +70 -3
- package/dist/docs/link.md +48 -0
- package/dist/docs/message-scroller.md +5 -0
- package/dist/docs/page-header.md +266 -0
- package/dist/docs/sheet.md +20 -3
- package/dist/docs/sidebar.md +27 -0
- package/dist/docs/status-dot.md +2 -2
- package/dist/docs/switch.md +10 -4
- package/dist/docs/text.md +51 -0
- package/dist/docs/visually-hidden.md +44 -0
- package/dist/empty.js +47 -36
- package/dist/empty.js.map +1 -1
- package/dist/heading.d.ts +1 -0
- package/dist/heading.js +36 -0
- package/dist/heading.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +437 -402
- package/dist/index.js.map +1 -1
- package/dist/input-otp.js +34 -20
- package/dist/input-otp.js.map +1 -1
- package/dist/item.js +119 -71
- package/dist/item.js.map +1 -1
- package/dist/link.d.ts +1 -0
- package/dist/link.js +55 -0
- package/dist/link.js.map +1 -0
- package/dist/message-scroller.js +24 -24
- package/dist/page-header.d.ts +1 -0
- package/dist/page-header.js +88 -0
- package/dist/page-header.js.map +1 -0
- package/dist/sheet.js +41 -41
- package/dist/sidebar.js +220 -206
- package/dist/sidebar.js.map +1 -1
- package/dist/slider.js +34 -21
- package/dist/slider.js.map +1 -1
- package/dist/status-dot.js +25 -25
- package/dist/table.js +172 -157
- package/dist/table.js.map +1 -1
- package/dist/text.d.ts +1 -0
- package/dist/text.js +53 -0
- package/dist/text.js.map +1 -0
- package/dist/theme.css +29 -6
- package/dist/utilities.css +25 -2
- package/dist/visually-hidden.d.ts +1 -0
- package/dist/visually-hidden.js +18 -0
- package/dist/visually-hidden.js.map +1 -0
- package/llms.txt +82 -15
- package/package.json +1 -1
- package/dist/chunks/alert.DsgRIXLn.css +0 -1
- package/dist/chunks/attachment.CZuZdlXC.css +0 -1
- package/dist/chunks/avatar.BMm-Z9l5.css +0 -1
- package/dist/chunks/badge.BCreEn3O.css +0 -1
- package/dist/chunks/card.DdBl-usf.css +0 -1
- package/dist/chunks/chart.CeyctrXQ.css +0 -1
- package/dist/chunks/empty.DnAKlw2g.css +0 -1
- package/dist/chunks/item.BkcgydVc.css +0 -1
- package/dist/chunks/message-scroller.CbLooS7Q.css +0 -1
- package/dist/chunks/sheet.BWvXXyXk.css +0 -1
- package/dist/chunks/sidebar.DdEvMURX.css +0 -1
- package/dist/chunks/slider.inyNxx4y.css +0 -1
- package/dist/chunks/status-dot.DWa2qGKe.css +0 -1
package/dist/docs/button.md
CHANGED
|
@@ -15,9 +15,15 @@ polymorphism, correct disabled/focus behavior, `type="button"` by default
|
|
|
15
15
|
|
|
16
16
|
## When not to use
|
|
17
17
|
|
|
18
|
-
- Plain in-text navigation
|
|
19
|
-
`variant="link"`; that variant exists for actions
|
|
20
|
-
links
|
|
18
|
+
- Plain in-text navigation: use `Link` (it takes the app's router link
|
|
19
|
+
through `render`), not `variant="link"`; that variant exists for actions
|
|
20
|
+
that visually read as links, and it carries a control's height and
|
|
21
|
+
padding into the line.
|
|
22
|
+
- Navigation that looks like a button (a "Get started" link, a call to
|
|
23
|
+
action): use the consumer app's link component with
|
|
24
|
+
`buttonVariants({ variant, size })` as its class, so the element keeps
|
|
25
|
+
the link role. `render={<a />}` on `Button` keeps the button role, so a
|
|
26
|
+
screen reader announces the link as a button.
|
|
21
27
|
- Toggling on/off state — use `switch` or `checkbox` instead.
|
|
22
28
|
|
|
23
29
|
## Props (kit level)
|
|
@@ -99,7 +105,7 @@ through `onClick`, not a manual listener, if you need it to respect
|
|
|
99
105
|
## Examples
|
|
100
106
|
|
|
101
107
|
```tsx
|
|
102
|
-
import { Button } from '@gears-frontx/ui-kit';
|
|
108
|
+
import { Button, buttonVariants } from '@gears-frontx/ui-kit';
|
|
103
109
|
|
|
104
110
|
// Primary action
|
|
105
111
|
<Button onClick={save}>Save</Button>
|
|
@@ -128,6 +134,12 @@ import { Button } from '@gears-frontx/ui-kit';
|
|
|
128
134
|
Open reports
|
|
129
135
|
</Button>
|
|
130
136
|
|
|
137
|
+
// Navigation drawn as a button: the app's link component (here a plain
|
|
138
|
+
// anchor) wears the button classes and keeps the link role
|
|
139
|
+
<a href="/docs" className={buttonVariants({ size: 'lg' })}>
|
|
140
|
+
Get started
|
|
141
|
+
</a>
|
|
142
|
+
|
|
131
143
|
// Form submit (explicit type)
|
|
132
144
|
<Button type="submit">Create account</Button>
|
|
133
145
|
```
|
package/dist/docs/calendar.md
CHANGED
|
@@ -28,6 +28,12 @@ The kit only fixes defaults and re-authors the styling surface:
|
|
|
28
28
|
| `className` | `string` — merged onto the root | — |
|
|
29
29
|
| `classNames` | `Partial<ClassNames>` — merged over the kit's own per-slot classes, keyed by react-day-picker's own slot names (`root`, `months`, `day`, `range_start`, ...) | — |
|
|
30
30
|
|
|
31
|
+
Name each calendar's month navigation when a page shows more than one:
|
|
32
|
+
react-day-picker names it "Navigation bar" for every instance, so two
|
|
33
|
+
calendars give two identical navigation landmarks (axe `landmark-unique`).
|
|
34
|
+
Pass its `labels` prop, for example
|
|
35
|
+
`labels={{ labelNav: () => 'Start date, month navigation' }}`.
|
|
36
|
+
|
|
31
37
|
`captionLayout`'s four values split into two visually distinct renders,
|
|
32
38
|
both covered by calendar.module.css:
|
|
33
39
|
|
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
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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.
|
package/dist/docs/carousel.md
CHANGED
|
@@ -91,8 +91,10 @@ import {
|
|
|
91
91
|
CarouselPrevious,
|
|
92
92
|
} from '@gears-frontx/ui-kit';
|
|
93
93
|
|
|
94
|
-
// Horizontal (default), with nav buttons
|
|
95
|
-
|
|
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>
|
package/dist/docs/chart.md
CHANGED
|
@@ -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 <p>Hello</p></CodeBlockLine>
|
|
104
|
+
<CodeBlockLine variant="added">return <p>Hello, {'{name}'}</p></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.
|
package/dist/docs/empty.md
CHANGED
|
@@ -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
|
-
`
|
|
35
|
-
|
|
36
|
-
|
|
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'`
|
|
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`, `
|
|
47
|
-
`
|
|
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
|