@karmo-co/drift-kit-reference 0.0.0-stage → 23.4.0
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/LICENSE +7 -0
- package/README.md +24 -2
- package/bin/drift-kit-ref.js +169 -0
- package/manifest/components/accordion.md +47 -0
- package/manifest/components/action-bar.md +51 -0
- package/manifest/components/alert.md +53 -0
- package/manifest/components/app-shell.md +43 -0
- package/manifest/components/avatar.md +42 -0
- package/manifest/components/body.md +48 -0
- package/manifest/components/box.md +58 -0
- package/manifest/components/breadcrumb.md +59 -0
- package/manifest/components/button.md +46 -0
- package/manifest/components/calendar.md +69 -0
- package/manifest/components/card.md +71 -0
- package/manifest/components/checkbox.md +43 -0
- package/manifest/components/choice-card.md +61 -0
- package/manifest/components/code-input.md +56 -0
- package/manifest/components/date-picker.md +66 -0
- package/manifest/components/day-of-month.md +54 -0
- package/manifest/components/detail-list.md +37 -0
- package/manifest/components/divider.md +33 -0
- package/manifest/components/dropdown.md +52 -0
- package/manifest/components/dropzone.md +56 -0
- package/manifest/components/eyebrow.md +45 -0
- package/manifest/components/feedback-badge.md +35 -0
- package/manifest/components/glider.md +34 -0
- package/manifest/components/heading.md +47 -0
- package/manifest/components/hero.md +46 -0
- package/manifest/components/icon-button.md +41 -0
- package/manifest/components/icon-tile.md +44 -0
- package/manifest/components/icon.md +30 -0
- package/manifest/components/input.md +63 -0
- package/manifest/components/link.md +42 -0
- package/manifest/components/loading-spinner.md +42 -0
- package/manifest/components/logo.md +38 -0
- package/manifest/components/modal.md +53 -0
- package/manifest/components/pagination.md +54 -0
- package/manifest/components/payment-form.md +29 -0
- package/manifest/components/price-summary.md +30 -0
- package/manifest/components/radio.md +42 -0
- package/manifest/components/section-heading.md +41 -0
- package/manifest/components/select.md +99 -0
- package/manifest/components/shield.md +34 -0
- package/manifest/components/sidebar.md +73 -0
- package/manifest/components/stepper.md +53 -0
- package/manifest/components/switch.md +45 -0
- package/manifest/components/table.md +77 -0
- package/manifest/components/tabs.md +43 -0
- package/manifest/components/tag.md +43 -0
- package/manifest/components/textarea.md +52 -0
- package/manifest/components/toast.md +52 -0
- package/manifest/components/tooltip.md +42 -0
- package/manifest/components/top-bar.md +60 -0
- package/manifest/components/vehicle.md +43 -0
- package/manifest/index.json +402 -0
- package/manifest/migrations/1.0.0.md +50 -0
- package/manifest/migrations/10.0.0.md +154 -0
- package/manifest/migrations/11.0.0.md +24 -0
- package/manifest/migrations/12.0.0.md +38 -0
- package/manifest/migrations/13.0.0.md +50 -0
- package/manifest/migrations/14.0.0.md +148 -0
- package/manifest/migrations/15.0.0.md +140 -0
- package/manifest/migrations/16.0.0.md +196 -0
- package/manifest/migrations/17.0.0.md +19 -0
- package/manifest/migrations/18.0.0.md +23 -0
- package/manifest/migrations/19.0.0.md +15 -0
- package/manifest/migrations/2.0.0.md +18 -0
- package/manifest/migrations/20.0.0.md +43 -0
- package/manifest/migrations/21.0.0.md +97 -0
- package/manifest/migrations/22.0.0.md +17 -0
- package/manifest/migrations/23.0.0.md +86 -0
- package/manifest/migrations/3.0.0.md +34 -0
- package/manifest/migrations/4.0.0.md +147 -0
- package/manifest/migrations/5.0.0.md +73 -0
- package/manifest/migrations/6.0.0.md +67 -0
- package/manifest/migrations/7.0.0.md +71 -0
- package/manifest/migrations/8.0.0.md +16 -0
- package/manifest/migrations/9.0.0.md +107 -0
- package/manifest/rules.md +37 -0
- package/manifest/setup.md +28 -0
- package/manifest/tokens/border-width.md +12 -0
- package/manifest/tokens/border.md +147 -0
- package/manifest/tokens/font.md +90 -0
- package/manifest/tokens/icon.md +84 -0
- package/manifest/tokens/interactive.md +37 -0
- package/manifest/tokens/motion.md +69 -0
- package/manifest/tokens/radius.md +20 -0
- package/manifest/tokens/shadow.md +28 -0
- package/manifest/tokens/spacing.md +35 -0
- package/manifest/tokens/surface.md +138 -0
- package/manifest/tokens/text.md +92 -0
- package/package.json +20 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Dropdown (`dropdown`)
|
|
2
|
+
|
|
3
|
+
A menu of commands hanging off a trigger. Select's surface, a menu's semantics: real focus, no value.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
div.dk-component-dropdown
|
|
10
|
+
button.dk-component-dropdown__trigger (aria-haspopup="menu")
|
|
11
|
+
div.dk-component-menu.dk-component-dropdown__menu (role="menu", portalled)
|
|
12
|
+
span.dk-component-dropdown__label (optional heading)
|
|
13
|
+
button|a.dk-component-dropdown__item (role="menuitem"
|
|
14
|
+
span.dk-component-dropdown__item-icon | "menuitemradio"
|
|
15
|
+
span.dk-component-dropdown__item-label | "menuitemcheckbox")
|
|
16
|
+
svg.dk-component-dropdown__check (shown when aria-checked)
|
|
17
|
+
hr.dk-component-dropdown__separator
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Attributes
|
|
21
|
+
|
|
22
|
+
| Attribute | Values the stylesheet styles |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `data-destructive` | (present or absent) |
|
|
25
|
+
| `data-dropdown-chevron` | (present or absent) |
|
|
26
|
+
| `data-open` | (present or absent) |
|
|
27
|
+
| `data-sheet-open` | (present or absent) |
|
|
28
|
+
| `data-size` | `large`, `medium` |
|
|
29
|
+
|
|
30
|
+
## React
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Dropdown } from '@karmo-co/drift-kit/react';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Notes |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `items` (required) | `DropdownEntry[]` | |
|
|
39
|
+
| `label` | `ReactNode` | The words on the default trigger, a raised Button. |
|
|
40
|
+
| `trigger` | `ReactElement<{ className?: string }>` | Your own trigger instead: a Button, an icon button, any element that takes a className. It keeps its look and gains the trigger class; the runtime adds aria-haspopup, aria-controls and aria-expanded to it. |
|
|
41
|
+
| `triggerSize` | `'small' \| 'medium' \| 'large'` | The default trigger's size. The menu's is `size`. |
|
|
42
|
+
| `size` | `'small' \| 'medium' \| 'large'` | The list's type and rows, on Select's three rungs. Small when absent: a menu is chrome. |
|
|
43
|
+
| `selection` | `'none' \| 'single' \| 'multiple'` | 'single' makes every item a menuitemradio with a tick (a switcher, like View as); 'multiple' a menuitemcheckbox. 'none', the default, is a list of commands. |
|
|
44
|
+
| `placement` | `'top' \| 'bottom' \| 'left' \| 'right'` | Where the menu opens, in dk.position's vocabulary. Below and start-aligned by default. |
|
|
45
|
+
| `align` | `'start' \| 'center' \| 'end'` | |
|
|
46
|
+
| `sheet` | `'auto' \| 'always' \| 'never'` | How it presents on a phone: a bottom sheet below the mobile breakpoint by default; 'never' for a menu already inside a sheet; 'always' to force it. |
|
|
47
|
+
| `onSelect` | `(value: string \| undefined, item: HTMLElement) => void` | Any item chosen: its value (undefined for one without) and the element. |
|
|
48
|
+
| `className` | `string` | |
|
|
49
|
+
|
|
50
|
+
## Component tokens
|
|
51
|
+
|
|
52
|
+
`--dk-component-dropdown-item-padding-block`, `--dk-component-dropdown-item-padding-inline`, `--dk-component-dropdown-item-gap`, `--dk-component-dropdown-item-radius`, `--dk-component-dropdown-item-font-family`, `--dk-component-dropdown-item-font-size`, `--dk-component-dropdown-item-line-height`, `--dk-component-dropdown-item-font-weight`, `--dk-component-dropdown-item-touch-height`, `--dk-component-dropdown-medium-item-font-size`, `--dk-component-dropdown-medium-item-line-height`, `--dk-component-dropdown-medium-item-padding-block`, `--dk-component-dropdown-medium-item-icon-size`, `--dk-component-dropdown-medium-check-size`, `--dk-component-dropdown-large-item-font-size`, `--dk-component-dropdown-large-item-line-height`, `--dk-component-dropdown-large-item-padding-block`, `--dk-component-dropdown-large-item-icon-size`, `--dk-component-dropdown-large-check-size`, `--dk-component-dropdown-item-color`, `--dk-component-dropdown-item-color-active`, `--dk-component-dropdown-item-color-hover`, `--dk-component-dropdown-item-icon-color`, `--dk-component-dropdown-item-icon-color-hover`, `--dk-component-dropdown-item-surface-hover`, `--dk-component-dropdown-item-surface-active`, `--dk-component-dropdown-item-disabled-color`, `--dk-component-dropdown-item-disabled-icon-color`, `--dk-component-dropdown-item-destructive-color`, `--dk-component-dropdown-item-destructive-icon-color`, `--dk-component-dropdown-item-destructive-surface-hover`, `--dk-component-dropdown-item-destructive-surface-active`, `--dk-component-dropdown-check-size`, `--dk-component-dropdown-check-color`, `--dk-component-dropdown-check-stroke-width`, `--dk-component-dropdown-item-icon-size`, `--dk-component-dropdown-label-font-size`, `--dk-component-dropdown-label-line-height`, `--dk-component-dropdown-label-letter-spacing`, `--dk-component-dropdown-label-font-weight`, `--dk-component-dropdown-label-color`, `--dk-component-dropdown-label-padding-block`, `--dk-component-dropdown-separator-color`, `--dk-component-dropdown-separator-width`, `--dk-component-dropdown-separator-spacing`, `--dk-component-dropdown-duration`, `--dk-component-dropdown-easing`, `--dk-component-dropdown-item-transform-scale-active`
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Dropzone (`dropzone`)
|
|
2
|
+
|
|
3
|
+
A place to drop or browse for files: one file or a list, with the type, size and count checked on the way in and a plain message when something is refused.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
div.dk-component-dropzone[data-layout="row"]?
|
|
10
|
+
label.__area
|
|
11
|
+
input.__input[type="file"]
|
|
12
|
+
span.__icon
|
|
13
|
+
span.__text > span.__title + span.__hint
|
|
14
|
+
ul.__list? (the chosen files, written by the runtime)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Attributes
|
|
18
|
+
|
|
19
|
+
| Attribute | Values the stylesheet styles |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `data-dragover` | (present or absent) |
|
|
22
|
+
| `data-has-file` | (present or absent) |
|
|
23
|
+
| `data-layout` | `compact` |
|
|
24
|
+
| `data-pseudo-class` | `active`, `focus`, `hover` |
|
|
25
|
+
| `data-runtime` | (present or absent) |
|
|
26
|
+
|
|
27
|
+
## React
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Dropzone } from '@karmo-co/drift-kit/react';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Notes |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `label` | `ReactNode` | A field label above the area, the same eyebrow Input uses. |
|
|
36
|
+
| `caption` | `ReactNode` | Helper text under the area, wired as the input's description. |
|
|
37
|
+
| `error` | `ReactNode` | A message from the page (a failed upload, a server check) AND the invalid state, one prop as Input spells it. The runtime's own validation messages are separate and do not need this. |
|
|
38
|
+
| `title` | `ReactNode` | The prompt. Defaults to "Drop a file here" or, with multiple, "Drop files here"; '' leaves it out and the hint names the field. In single mode the chosen file's name shows in its place. |
|
|
39
|
+
| `hint` | `ReactNode` | The line under the prompt; '' leaves it out. In single mode it becomes the chosen file's size. |
|
|
40
|
+
| `icon` | `ReactNode \| null` | Any node; the default is an upload cloud; null leaves the icon out. |
|
|
41
|
+
| `layout` | `'stacked' \| 'compact'` | |
|
|
42
|
+
| `name` | `string` | |
|
|
43
|
+
| `accept` | `string` | The same string as the input's accept, enforced on a drop too. |
|
|
44
|
+
| `multiple` | `boolean` | A list that new picks and drops add to. Read when the component mounts: to switch modes, give it a new key. |
|
|
45
|
+
| `maxSize` | `string \| number` | "500KB", "5MB", or a number of bytes. |
|
|
46
|
+
| `maxFiles` | `number` | Multiple only. |
|
|
47
|
+
| `disabled` | `boolean` | |
|
|
48
|
+
| `required` | `boolean` | |
|
|
49
|
+
| `id` | `string` | Goes on the input, so a <label htmlFor> elsewhere can point at it. |
|
|
50
|
+
| `className` | `string` | |
|
|
51
|
+
| `style` | `CSSProperties` | On the root: --dk-component-dropzone-radius and the other tokens. |
|
|
52
|
+
| `onFilesChange` | `(files: File[], rejected: DropzoneRejection[]) => void` | Every change, with the files now held and any that were refused. |
|
|
53
|
+
|
|
54
|
+
## Component tokens
|
|
55
|
+
|
|
56
|
+
`--dk-component-dropzone-hint-font-weight`, `--dk-component-dropzone-title-font-weight`, `--dk-component-dropzone-gap`, `--dk-component-dropzone-label-font-family`, `--dk-component-dropzone-label-font-size`, `--dk-component-dropzone-label-line-height`, `--dk-component-dropzone-label-letter-spacing`, `--dk-component-dropzone-label-font-weight`, `--dk-component-dropzone-caption-font-size`, `--dk-component-dropzone-caption-line-height`, `--dk-component-dropzone-error-color`, `--dk-component-dropzone-padding-y`, `--dk-component-dropzone-padding-x`, `--dk-component-dropzone-compact-padding-y`, `--dk-component-dropzone-compact-padding-x`, `--dk-component-dropzone-content-gap`, `--dk-component-dropzone-compact-content-gap`, `--dk-component-dropzone-text-gap`, `--dk-component-dropzone-radius`, `--dk-component-dropzone-border-width`, `--dk-component-dropzone-icon-size`, `--dk-component-dropzone-compact-icon-size`, `--dk-component-dropzone-clear-inset`, `--dk-component-dropzone-active-scale`, `--dk-component-dropzone-surface`, `--dk-component-dropzone-border`, `--dk-component-dropzone-icon-color`, `--dk-component-dropzone-title-color`, `--dk-component-dropzone-hint-color`, `--dk-component-dropzone-surface-hover`, `--dk-component-dropzone-border-hover`, `--dk-component-dropzone-icon-color-hover`, `--dk-component-dropzone-title-color-hover`, `--dk-component-dropzone-hint-color-hover`, `--dk-component-dropzone-surface-active`, `--dk-component-dropzone-border-active`, `--dk-component-dropzone-surface-filled`, `--dk-component-dropzone-border-filled`, `--dk-component-dropzone-border-error`, `--dk-component-dropzone-surface-disabled`, `--dk-component-dropzone-border-disabled`, `--dk-component-dropzone-title-disabled`, `--dk-component-dropzone-hint-disabled`, `--dk-component-dropzone-icon-disabled`, `--dk-component-dropzone-focus-ring-width`, `--dk-component-dropzone-focus-ring`, `--dk-component-dropzone-focus-border`, `--dk-component-dropzone-files-gap`, `--dk-component-dropzone-file-gap`, `--dk-component-dropzone-file-padding-y`, `--dk-component-dropzone-file-padding-x`, `--dk-component-dropzone-file-radius`, `--dk-component-dropzone-file-surface`, `--dk-component-dropzone-file-border`, `--dk-component-dropzone-file-border-width`, `--dk-component-dropzone-file-icon-size`, `--dk-component-dropzone-file-icon-color`, `--dk-component-dropzone-file-name-color`, `--dk-component-dropzone-file-name-font-weight`, `--dk-component-dropzone-file-size-color`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Eyebrow (`eyebrow`)
|
|
2
|
+
|
|
3
|
+
Uppercase labels, the component-library's Overline, renamed. Three fixed sizes (12 / 11 / 10 px) with tracking that widens as the size shrinks, bold by default, the Body colour grammar.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
span.dk-component-eyebrow[data-size="large|medium|small"]?[data-color]?[data-emphasis="subtle"]?
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Attributes
|
|
13
|
+
|
|
14
|
+
| Attribute | Values the stylesheet styles |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `data-align` | `center`, `left`, `right` |
|
|
17
|
+
| `data-color` | `black`, `default`, `error`, `information`, `inverse`, `neutral`, `primary`, `success`, `warning`, `white` |
|
|
18
|
+
| `data-disabled` | (present or absent) |
|
|
19
|
+
| `data-emphasis` | `subtle` |
|
|
20
|
+
| `data-size` | `large`, `medium`, `small` |
|
|
21
|
+
| `data-weight` | `bold`, `medium`, `semi-bold` |
|
|
22
|
+
|
|
23
|
+
## React
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Eyebrow } from '@karmo-co/drift-kit/react';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Notes |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `size` | `'large' \| 'medium' \| 'small'` | |
|
|
32
|
+
| `weight` | `'medium' \| 'semi-bold' \| 'bold'` | |
|
|
33
|
+
| `textStyle` | `` | React owns `style`, so the data-style axis is `textStyle`. This is the one place the mirror-the-HTML rule cannot hold. |
|
|
34
|
+
| `as` | `ElementType` | |
|
|
35
|
+
| `color` | `Color` | |
|
|
36
|
+
| `emphasis` | `Emphasis` | |
|
|
37
|
+
| `align` | `Align` | |
|
|
38
|
+
| `trim` | `Trim` | |
|
|
39
|
+
| `disabled` | `boolean` | A span cannot carry :disabled, so the kit uses [data-disabled]. |
|
|
40
|
+
| `children` | `ReactNode` | |
|
|
41
|
+
| `className` | `string` | |
|
|
42
|
+
|
|
43
|
+
## Component tokens
|
|
44
|
+
|
|
45
|
+
`--dk-component-eyebrow-font-family`, `--dk-component-eyebrow-transition-duration`, `--dk-component-eyebrow-large-font-size`, `--dk-component-eyebrow-large-line-height`, `--dk-component-eyebrow-medium-font-size`, `--dk-component-eyebrow-medium-line-height`, `--dk-component-eyebrow-small-font-size`, `--dk-component-eyebrow-small-line-height`, `--dk-component-eyebrow-large-letter-spacing`, `--dk-component-eyebrow-medium-letter-spacing`, `--dk-component-eyebrow-small-letter-spacing`, `--dk-component-eyebrow-medium-font-weight`, `--dk-component-eyebrow-semi-bold-font-weight`, `--dk-component-eyebrow-bold-font-weight`, `--dk-component-eyebrow-default-color`, `--dk-component-eyebrow-inverse-color`, `--dk-component-eyebrow-white-color`, `--dk-component-eyebrow-black-color`, `--dk-component-eyebrow-primary-color`, `--dk-component-eyebrow-success-color`, `--dk-component-eyebrow-error-color`, `--dk-component-eyebrow-warning-color`, `--dk-component-eyebrow-information-color`, `--dk-component-eyebrow-neutral-default-color`, `--dk-component-eyebrow-neutral-subtle-color`, `--dk-component-eyebrow-disabled-color`
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Feedback badge (`feedback-badge`)
|
|
2
|
+
|
|
3
|
+
A status's circle inside its own soft ring, with a white glyph. The big mark at the top of a success screen or an empty state.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
div.dk-component-feedback-badge[data-status]?[data-size="small|medium|large"]?
|
|
10
|
+
(the glyph is drawn by the runtime)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Attributes
|
|
14
|
+
|
|
15
|
+
| Attribute | Values the stylesheet styles |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `data-size` | `medium`, `small` |
|
|
18
|
+
| `data-status` | `error`, `information`, `neutral`, `success`, `warning` |
|
|
19
|
+
|
|
20
|
+
## React
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { FeedbackBadge } from '@karmo-co/drift-kit/react';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Notes |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `status` | `FeedbackBadgeStatus` | |
|
|
29
|
+
| `size` | `'small' \| 'medium' \| 'large'` | |
|
|
30
|
+
| `icon` | `ReactNode` | Any kit icon. Without one, the status's own glyph, as in CL. |
|
|
31
|
+
| `label` | `string` | |
|
|
32
|
+
|
|
33
|
+
## Component tokens
|
|
34
|
+
|
|
35
|
+
`--dk-component-feedback-badge-small-size`, `--dk-component-feedback-badge-small-padding`, `--dk-component-feedback-badge-small-icon`, `--dk-component-feedback-badge-medium-size`, `--dk-component-feedback-badge-medium-padding`, `--dk-component-feedback-badge-medium-icon`, `--dk-component-feedback-badge-large-size`, `--dk-component-feedback-badge-large-padding`, `--dk-component-feedback-badge-large-icon`, `--dk-component-feedback-badge-glyph`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Glider (`glider`)
|
|
2
|
+
|
|
3
|
+
One value from a few options side by side, or several: a raised frame with a primary pill that slides to the choice.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
div.dk-component-glider[data-variant="raised|plain|inset|ghost"]?[data-multiple]?[role="radiogroup"]
|
|
10
|
+
button.__option[data-value][aria-checked]
|
|
11
|
+
span.__icon?
|
|
12
|
+
span.__label
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Attributes
|
|
16
|
+
|
|
17
|
+
| Attribute | Values the stylesheet styles |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `data-direction` | `back`, `forward` |
|
|
20
|
+
| `data-full-width` | (present or absent) |
|
|
21
|
+
| `data-multiple` | (present or absent) |
|
|
22
|
+
| `data-size` | `large`, `small` |
|
|
23
|
+
| `data-tone` | `error`, `information`, `primary`, `success`, `warning` |
|
|
24
|
+
| `data-variant` | `ghost`, `inset`, `plain` |
|
|
25
|
+
|
|
26
|
+
## React
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { Glider } from '@karmo-co/drift-kit/react';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Component tokens
|
|
33
|
+
|
|
34
|
+
`--dk-component-glider-height`, `--dk-component-glider-small-height`, `--dk-component-glider-large-height`, `--dk-component-glider-inset`, `--dk-component-glider-gap`, `--dk-component-glider-padding-inline`, `--dk-component-glider-small-padding-inline`, `--dk-component-glider-large-padding-inline`, `--dk-component-glider-font-family`, `--dk-component-glider-font-size`, `--dk-component-glider-line-height`, `--dk-component-glider-small-font-size`, `--dk-component-glider-small-line-height`, `--dk-component-glider-large-font-size`, `--dk-component-glider-large-line-height`, `--dk-component-glider-font-weight`, `--dk-component-glider-icon-size`, `--dk-component-glider-small-icon-size`, `--dk-component-glider-large-icon-size`, `--dk-component-glider-icon-gap`, `--dk-component-glider-surface`, `--dk-component-glider-border`, `--dk-component-glider-border-width`, `--dk-component-glider-radius`, `--dk-component-glider-shadow`, `--dk-component-glider-plain-border`, `--dk-component-glider-inset-surface`, `--dk-component-glider-inset-surface-hover`, `--dk-component-glider-inset-surface-active`, `--dk-component-glider-inset-border`, `--dk-component-glider-inset-toned-color`, `--dk-component-glider-ghost-surface`, `--dk-component-glider-ghost-border`, `--dk-component-glider-ghost-surface-hover`, `--dk-component-glider-ghost-surface-active`, `--dk-component-glider-indicator-surface`, `--dk-component-glider-indicator-surface-hover`, `--dk-component-glider-indicator-surface-active`, `--dk-component-glider-indicator-border`, `--dk-component-glider-indicator-border-hover`, `--dk-component-glider-indicator-border-active`, `--dk-component-glider-indicator-radius`, `--dk-component-glider-selected-color`, `--dk-component-glider-color`, `--dk-component-glider-color-hover`, `--dk-component-glider-surface-hover`, `--dk-component-glider-border-hover`, `--dk-component-glider-surface-active`, `--dk-component-glider-border-active`, `--dk-component-glider-color-disabled`, `--dk-component-glider-transition-duration`, `--dk-component-glider-slide-duration`, `--dk-component-glider-transition-easing`, `--dk-component-glider-slide-lag`, `--dk-component-glider-active-scale`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Heading (`heading`)
|
|
2
|
+
|
|
3
|
+
The outline tier: Inter, six responsive sizes, nine weights, the Body colour grammar.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
h1..h6.dk-component-heading[data-size="xxlarge|xlarge|large|medium|small|xsmall"]?[data-weight]?[data-color]?[data-align]?
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Attributes
|
|
13
|
+
|
|
14
|
+
| Attribute | Values the stylesheet styles |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `data-align` | `center`, `left`, `right` |
|
|
17
|
+
| `data-color` | `black`, `default`, `error`, `information`, `inverse`, `neutral`, `primary`, `success`, `warning`, `white` |
|
|
18
|
+
| `data-disabled` | (present or absent) |
|
|
19
|
+
| `data-emphasis` | `subtle` |
|
|
20
|
+
| `data-size` | `large`, `medium`, `small`, `xlarge`, `xsmall`, `xxlarge`, `xxsmall` |
|
|
21
|
+
| `data-style` | `italic` |
|
|
22
|
+
| `data-trim` | `both`, `end`, `start` |
|
|
23
|
+
| `data-weight` | `black`, `bold`, `extra-bold`, `extra-light`, `light`, `medium`, `regular`, `semi-bold`, `thin` |
|
|
24
|
+
|
|
25
|
+
## React
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Heading } from '@karmo-co/drift-kit/react';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| Prop | Type | Notes |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `size` | `\| 'xxlarge' \| 'xlarge' \| 'large' \| 'medium' \| 'small' \| 'xsmall' \| 'xxsmall'` | |
|
|
34
|
+
| `weight` | `HeadingWeight` | |
|
|
35
|
+
| `textStyle` | `'italic'` | React owns `style`, so the data-style axis is `textStyle`. This is the one place the mirror-the-HTML rule cannot hold. |
|
|
36
|
+
| `as` | `ElementType` | |
|
|
37
|
+
| `color` | `Color` | |
|
|
38
|
+
| `emphasis` | `Emphasis` | |
|
|
39
|
+
| `align` | `Align` | |
|
|
40
|
+
| `trim` | `Trim` | |
|
|
41
|
+
| `disabled` | `boolean` | A span cannot carry :disabled, so the kit uses [data-disabled]. |
|
|
42
|
+
| `children` | `ReactNode` | |
|
|
43
|
+
| `className` | `string` | |
|
|
44
|
+
|
|
45
|
+
## Component tokens
|
|
46
|
+
|
|
47
|
+
`--dk-component-heading-font-family`, `--dk-component-heading-italic-font-style`, `--dk-component-heading-transition-duration`, `--dk-component-heading-xxlarge-font-size`, `--dk-component-heading-xxlarge-line-height`, `--dk-component-heading-xlarge-font-size`, `--dk-component-heading-xlarge-line-height`, `--dk-component-heading-large-font-size`, `--dk-component-heading-large-line-height`, `--dk-component-heading-medium-font-size`, `--dk-component-heading-medium-line-height`, `--dk-component-heading-small-font-size`, `--dk-component-heading-small-line-height`, `--dk-component-heading-xsmall-font-size`, `--dk-component-heading-xsmall-line-height`, `--dk-component-heading-xxsmall-font-size`, `--dk-component-heading-xxsmall-line-height`, `--dk-component-heading-thin-font-weight`, `--dk-component-heading-extra-light-font-weight`, `--dk-component-heading-light-font-weight`, `--dk-component-heading-regular-font-weight`, `--dk-component-heading-medium-font-weight`, `--dk-component-heading-semi-bold-font-weight`, `--dk-component-heading-bold-font-weight`, `--dk-component-heading-extra-bold-font-weight`, `--dk-component-heading-black-font-weight`, `--dk-component-heading-default-color`, `--dk-component-heading-inverse-color`, `--dk-component-heading-white-color`, `--dk-component-heading-black-color`, `--dk-component-heading-primary-color`, `--dk-component-heading-success-color`, `--dk-component-heading-error-color`, `--dk-component-heading-warning-color`, `--dk-component-heading-information-color`, `--dk-component-heading-neutral-default-color`, `--dk-component-heading-neutral-subtle-color`, `--dk-component-heading-disabled-color`
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Hero (`hero`)
|
|
2
|
+
|
|
3
|
+
The display tier: Syne on the heading ramp, five responsive sizes, four weights, the Body colour grammar.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
h1|h2.dk-component-hero[data-size="xxlarge|xlarge|large|medium|small"]?[data-weight]?[data-color]?[data-align]?
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Attributes
|
|
13
|
+
|
|
14
|
+
| Attribute | Values the stylesheet styles |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `data-align` | `center`, `left`, `right` |
|
|
17
|
+
| `data-color` | `black`, `default`, `error`, `information`, `inverse`, `neutral`, `primary`, `success`, `warning`, `white` |
|
|
18
|
+
| `data-disabled` | (present or absent) |
|
|
19
|
+
| `data-emphasis` | `subtle` |
|
|
20
|
+
| `data-size` | `large`, `medium`, `small`, `xlarge`, `xxlarge` |
|
|
21
|
+
| `data-trim` | `both`, `end`, `start` |
|
|
22
|
+
| `data-weight` | `bold`, `medium`, `regular`, `semi-bold` |
|
|
23
|
+
|
|
24
|
+
## React
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Hero } from '@karmo-co/drift-kit/react';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Notes |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `size` | `'xxlarge' \| 'xlarge' \| 'large' \| 'medium' \| 'small'` | |
|
|
33
|
+
| `weight` | `'regular' \| 'medium' \| 'semi-bold' \| 'bold'` | |
|
|
34
|
+
| `textStyle` | `` | React owns `style`, so the data-style axis is `textStyle`. This is the one place the mirror-the-HTML rule cannot hold. |
|
|
35
|
+
| `as` | `ElementType` | |
|
|
36
|
+
| `color` | `Color` | |
|
|
37
|
+
| `emphasis` | `Emphasis` | |
|
|
38
|
+
| `align` | `Align` | |
|
|
39
|
+
| `trim` | `Trim` | |
|
|
40
|
+
| `disabled` | `boolean` | A span cannot carry :disabled, so the kit uses [data-disabled]. |
|
|
41
|
+
| `children` | `ReactNode` | |
|
|
42
|
+
| `className` | `string` | |
|
|
43
|
+
|
|
44
|
+
## Component tokens
|
|
45
|
+
|
|
46
|
+
`--dk-component-hero-font-family`, `--dk-component-hero-transition-duration`, `--dk-component-hero-xxlarge-font-size`, `--dk-component-hero-xxlarge-line-height`, `--dk-component-hero-xlarge-font-size`, `--dk-component-hero-xlarge-line-height`, `--dk-component-hero-large-font-size`, `--dk-component-hero-large-line-height`, `--dk-component-hero-medium-font-size`, `--dk-component-hero-medium-line-height`, `--dk-component-hero-small-font-size`, `--dk-component-hero-small-line-height`, `--dk-component-hero-regular-font-weight`, `--dk-component-hero-medium-font-weight`, `--dk-component-hero-semi-bold-font-weight`, `--dk-component-hero-bold-font-weight`, `--dk-component-hero-default-color`, `--dk-component-hero-inverse-color`, `--dk-component-hero-white-color`, `--dk-component-hero-black-color`, `--dk-component-hero-primary-color`, `--dk-component-hero-success-color`, `--dk-component-hero-error-color`, `--dk-component-hero-warning-color`, `--dk-component-hero-information-color`, `--dk-component-hero-neutral-default-color`, `--dk-component-hero-neutral-subtle-color`, `--dk-component-hero-disabled-color`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Icon button (`icon-button`)
|
|
2
|
+
|
|
3
|
+
A button whose whole label is its icon. Same rungs as Button, so the two line up in a row, plus one rung below Button's smallest because compact chrome is where most icon buttons actually live.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
button.dk-component-icon-button[data-variant="subtle|ghost|plain|raised"]?[data-size="extra-small|small|medium|large"]?[aria-label][aria-pressed]?[data-pressed-glyph="fill"]?
|
|
10
|
+
svg | i.dk-component-icon (the glyph)
|
|
11
|
+
span.__spinner? (while .is-loading)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
|
|
16
|
+
| Attribute | Values the stylesheet styles |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `data-pressed-glyph` | `fill` |
|
|
19
|
+
| `data-pseudo-class` | `active`, `focus`, `hover` |
|
|
20
|
+
| `data-size` | `extra-small`, `large`, `medium`, `small` |
|
|
21
|
+
| `data-variant` | `ghost`, `plain`, `raised`, `subtle` |
|
|
22
|
+
|
|
23
|
+
## React
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { IconButton } from '@karmo-co/drift-kit/react';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Notes |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `'aria-label'` | `string` | |
|
|
32
|
+
| `'aria-labelledby'` | `string` | |
|
|
33
|
+
| `icon` (required) | `ReactNode` | The glyph: one <svg>, an icon component, or an <i data-lucide>. The component sizes it to its rung. |
|
|
34
|
+
| `variant` | `'subtle' \| 'ghost' \| 'plain' \| 'raised'` | subtle when absent: a tint of the surface it sits on. ghost and plain are transparent at rest; raised lifts it on an elevation. |
|
|
35
|
+
| `size` | `'extra-small' \| 'small' \| 'medium' \| 'large'` | medium when absent. small, medium and large are Button's rungs and land on its heights, so the two line up in a row. |
|
|
36
|
+
| `loading` | `boolean` | Button's loading state: a spinner in place of the glyph, aria-busy and aria-disabled, still focusable, clicks and Enter/Space blocked. |
|
|
37
|
+
| `pressedGlyph` | `'fill'` | With aria-pressed: fill the glyph when on. For closed glyphs only (a heart, a star, a bookmark); a line glyph would fill to a blob. |
|
|
38
|
+
|
|
39
|
+
## Component tokens
|
|
40
|
+
|
|
41
|
+
`--dk-component-icon-button-extra-small-padding`, `--dk-component-icon-button-extra-small-line-height`, `--dk-component-icon-button-extra-small-icon-size`, `--dk-component-icon-button-extra-small-border-radius`, `--dk-component-icon-button-small-padding`, `--dk-component-icon-button-small-line-height`, `--dk-component-icon-button-small-icon-size`, `--dk-component-icon-button-small-border-radius`, `--dk-component-icon-button-medium-padding`, `--dk-component-icon-button-medium-line-height`, `--dk-component-icon-button-medium-icon-size`, `--dk-component-icon-button-medium-border-radius`, `--dk-component-icon-button-large-padding`, `--dk-component-icon-button-large-line-height`, `--dk-component-icon-button-large-icon-size`, `--dk-component-icon-button-large-border-radius`, `--dk-component-icon-button-extra-small-spinner-size`, `--dk-component-icon-button-small-spinner-size`, `--dk-component-icon-button-medium-spinner-size`, `--dk-component-icon-button-large-spinner-size`, `--dk-component-icon-button-spinner-border-width`, `--dk-component-icon-button-spinner-track`, `--dk-component-icon-button-spinner-head`, `--dk-component-icon-button-spin-duration`, `--dk-component-icon-button-focus-ring-width`, `--dk-component-icon-button-transform-scale-active`, `--dk-component-icon-button-subtle-surface-default`, `--dk-component-icon-button-subtle-surface-hover`, `--dk-component-icon-button-subtle-surface-active`, `--dk-component-icon-button-subtle-icon-default`, `--dk-component-icon-button-subtle-icon-hover`, `--dk-component-icon-button-subtle-icon-active`, `--dk-component-icon-button-subtle-ring`, `--dk-component-icon-button-ghost-surface-default`, `--dk-component-icon-button-ghost-surface-hover`, `--dk-component-icon-button-ghost-surface-active`, `--dk-component-icon-button-ghost-icon-default`, `--dk-component-icon-button-ghost-icon-hover`, `--dk-component-icon-button-ghost-icon-active`, `--dk-component-icon-button-ghost-ring`, `--dk-component-icon-button-plain-border-width`, `--dk-component-icon-button-plain-surface-default`, `--dk-component-icon-button-plain-surface-hover`, `--dk-component-icon-button-plain-surface-active`, `--dk-component-icon-button-plain-border-default`, `--dk-component-icon-button-plain-border-hover`, `--dk-component-icon-button-plain-border-active`, `--dk-component-icon-button-plain-icon-default`, `--dk-component-icon-button-plain-icon-hover`, `--dk-component-icon-button-plain-icon-active`, `--dk-component-icon-button-plain-ring`, `--dk-component-icon-button-raised-border-width`, `--dk-component-icon-button-raised-shadow`, `--dk-component-icon-button-raised-shadow-hover`, `--dk-component-icon-button-raised-shadow-active`, `--dk-component-icon-button-raised-surface-default`, `--dk-component-icon-button-raised-surface-hover`, `--dk-component-icon-button-raised-surface-active`, `--dk-component-icon-button-raised-border-default`, `--dk-component-icon-button-raised-border-hover`, `--dk-component-icon-button-raised-border-active`, `--dk-component-icon-button-raised-icon-default`, `--dk-component-icon-button-raised-icon-hover`, `--dk-component-icon-button-raised-icon-active`, `--dk-component-icon-button-pressed-icon-default`, `--dk-component-icon-button-pressed-icon-hover`, `--dk-component-icon-button-pressed-icon-active`, `--dk-component-icon-button-preview-fill-hover`, `--dk-component-icon-button-preview-fill-active`, `--dk-component-icon-button-raised-ring`, `--dk-component-icon-button-surface-disabled`, `--dk-component-icon-button-icon-disabled`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Icon tile (`icon-tile`)
|
|
2
|
+
|
|
3
|
+
A glyph on a small coloured square, subtle or solid, with one corner at every size.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
span.dk-component-icon-tile[data-status|data-hue][data-variant][data-size]
|
|
10
|
+
the glyph: a kit Icon, a Lucide <i>, an <svg> or an <img>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Attributes
|
|
14
|
+
|
|
15
|
+
| Attribute | Values the stylesheet styles |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `data-disabled` | (present or absent) |
|
|
18
|
+
| `data-highlighted` | `false` |
|
|
19
|
+
| `data-hue` | `next1`, `next2`, `next3`, `next4`, `prev1`, `prev2`, `prev3`, `prev4`, `primary` |
|
|
20
|
+
| `data-interactive` | (present or absent) |
|
|
21
|
+
| `data-pseudo-class` | `active`, `hover` |
|
|
22
|
+
| `data-size` | `24`, `32`, `40`, `56`, `64` |
|
|
23
|
+
| `data-status` | `error`, `information`, `primary`, `success`, `warning` |
|
|
24
|
+
| `data-tone-fill` | `solid` |
|
|
25
|
+
| `data-variant` | `solid` |
|
|
26
|
+
|
|
27
|
+
## React
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { IconTile } from '@karmo-co/drift-kit/react';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Notes |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `icon` (required) | `ReactNode` | The glyph: a kit icon, a Lucide icon, any svg. The tile sizes it. |
|
|
36
|
+
| `status` | `'neutral' \| 'primary' \| 'success' \| 'error' \| 'warning' \| 'information'` | Neutral when absent, as a Tag's is. |
|
|
37
|
+
| `hue` | `IconTileHue` | A category colour instead of a status. With status also set, hue wins. |
|
|
38
|
+
| `variant` | `'subtle' \| 'solid'` | Subtle when absent. |
|
|
39
|
+
| `size` | `24 \| 32 \| 40 \| 48 \| 56 \| 64` | 48 when absent. |
|
|
40
|
+
| `label` | `string` | A name, for a tile that means something on its own. Without one the tile is decorative and hidden from a screen reader. |
|
|
41
|
+
|
|
42
|
+
## Component tokens
|
|
43
|
+
|
|
44
|
+
`--dk-component-icon-tile-radius`, `--dk-component-icon-tile-24-size`, `--dk-component-icon-tile-24-icon-size`, `--dk-component-icon-tile-32-size`, `--dk-component-icon-tile-32-icon-size`, `--dk-component-icon-tile-40-size`, `--dk-component-icon-tile-40-icon-size`, `--dk-component-icon-tile-48-size`, `--dk-component-icon-tile-48-icon-size`, `--dk-component-icon-tile-56-size`, `--dk-component-icon-tile-56-icon-size`, `--dk-component-icon-tile-64-size`, `--dk-component-icon-tile-64-icon-size`, `--dk-component-icon-tile-primary-solid`, `--dk-component-icon-tile-success-solid`, `--dk-component-icon-tile-error-solid`, `--dk-component-icon-tile-warning-solid`, `--dk-component-icon-tile-information-solid`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Icon (`icon`)
|
|
2
|
+
|
|
3
|
+
The icon primitive, built to behave like text: the same colour grammar, sizes named and fixed like the body rungs, weight as stroke width, and 1em when unsized.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
i.dk-component-icon[data-lucide|data-karmo|data-card|...="<glyph>"][data-size="12..48"]?[data-color]?
|
|
10
|
+
(the runtime swaps in the svg)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Attributes
|
|
14
|
+
|
|
15
|
+
| Attribute | Values the stylesheet styles |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `data-color` | `black`, `default`, `error`, `information`, `inverse`, `neutral`, `primary`, `success`, `warning`, `white` |
|
|
18
|
+
| `data-disabled` | (present or absent) |
|
|
19
|
+
| `data-emphasis` | `subtle` |
|
|
20
|
+
| `data-icon-kind` | `picture` |
|
|
21
|
+
| `data-size` | `12`, `14`, `16`, `20`, `24`, `28`, `32`, `40`, `48` |
|
|
22
|
+
| `data-weight` | `bold`, `light`, `regular` |
|
|
23
|
+
|
|
24
|
+
## React
|
|
25
|
+
|
|
26
|
+
One component per glyph, per set: `import { Heart } from '@karmo-co/drift-kit/icons/lucide';`
|
|
27
|
+
|
|
28
|
+
## Component tokens
|
|
29
|
+
|
|
30
|
+
`--dk-component-icon-transition-duration`, `--dk-component-icon-light-stroke-width`, `--dk-component-icon-regular-stroke-width`, `--dk-component-icon-bold-stroke-width`, `--dk-component-icon-12-size`, `--dk-component-icon-14-size`, `--dk-component-icon-16-size`, `--dk-component-icon-20-size`, `--dk-component-icon-24-size`, `--dk-component-icon-28-size`, `--dk-component-icon-32-size`, `--dk-component-icon-40-size`, `--dk-component-icon-48-size`, `--dk-component-icon-default-color`, `--dk-component-icon-inverse-color`, `--dk-component-icon-white-color`, `--dk-component-icon-black-color`, `--dk-component-icon-primary-color`, `--dk-component-icon-success-color`, `--dk-component-icon-error-color`, `--dk-component-icon-warning-color`, `--dk-component-icon-information-color`, `--dk-component-icon-neutral-default-color`, `--dk-component-icon-neutral-subtle-color`, `--dk-component-icon-disabled-color`
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Text input (`input`)
|
|
2
|
+
|
|
3
|
+
Label, field and caption, with leading and trailing slots, three sizes, and error, disabled and read-only states.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
div.dk-component-input[data-size="small|medium|large"]?[data-variant="raised"]?[data-leading-control]?
|
|
10
|
+
label.__label
|
|
11
|
+
div.__field
|
|
12
|
+
span.__leading?
|
|
13
|
+
input|select|textarea
|
|
14
|
+
span.__trailing?
|
|
15
|
+
button.__action?
|
|
16
|
+
p.__caption? | p.__error?
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Attributes
|
|
20
|
+
|
|
21
|
+
| Attribute | Values the stylesheet styles |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `data-appearance` | `sentence` |
|
|
24
|
+
| `data-input-reveal` | (present or absent) |
|
|
25
|
+
| `data-leading-control` | (present or absent) |
|
|
26
|
+
| `data-open` | (present or absent) |
|
|
27
|
+
| `data-raised` | (present or absent) |
|
|
28
|
+
| `data-size` | `large`, `small` |
|
|
29
|
+
| `data-tone` | `error`, `information`, `primary`, `success`, `warning` |
|
|
30
|
+
| `data-variant` | `inset`, `raised` |
|
|
31
|
+
| `data-when` | `hidden`, `shown` |
|
|
32
|
+
|
|
33
|
+
## React
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Input } from '@karmo-co/drift-kit/react';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Prop | Type | Notes |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `label` | `ReactNode` | The visible label. Optional in the TYPE only: see InputProps below, where the union makes an unlabelled field legal exactly when it carries an aria-label or an aria-labelledby instead. A field with no name at all is not a field anyone can use, and that is still unreachable from here. |
|
|
42
|
+
| `size` | `'small' \| 'medium' \| 'large'` | |
|
|
43
|
+
| `caption` | `ReactNode` | Helper text. Rendered as the control's DESCRIPTION, never part of its name: the markup this component replaces wrapped label, field and caption in one <label>, which made every Karmo field announce its helper text as part of its own name. |
|
|
44
|
+
| `error` | `ReactNode` | The message AND the invalid state. One prop so the border, the words and aria-invalid cannot disagree; there is deliberately no separate `invalid` boolean. |
|
|
45
|
+
| `leading` | `ReactNode` | |
|
|
46
|
+
| `trailing` | `ReactNode` | |
|
|
47
|
+
| `required` | `boolean` | Marks the control required and renders the asterisk. The asterisk is decorative; the native attribute is what carries the meaning. |
|
|
48
|
+
| `revealable` | `boolean` | A reveal toggle for type="password". Flips the control to type="text" and back, and moves aria-pressed with it. |
|
|
49
|
+
| `clearable` | `boolean` | A clear button, shown only while there is something to clear. |
|
|
50
|
+
| `clearPrefix` | `string` | Text Clear keeps, a phone field's dial code: Clear sets the value back to it, and a field holding only it has nothing to clear. Rendered as data-input-prefix, as the HTML runtime reads it. |
|
|
51
|
+
| `raised` | `boolean` | Lifts the field off the surface on an elevation instead of sitting flush in it. The shadow is the whole of it: padding and height still come from the size rung. This is what Search bar was until 14.0.0: raised, large, no label, a magnifier in `leading` and a placeholder. See components/input/styles.css for why that component became an attribute on this one. Kept as an alias of variant="raised". |
|
|
52
|
+
| `variant` | `'plain' \| 'raised' \| 'inset'` | How the field separates from the surface, as Select's and Glider's do: plain (the default) sits flush with an edge, raised lifts it on a shadow, inset sinks it into the nested fill with no edge. |
|
|
53
|
+
| `help` | `string` | Help text behind an info button in the field. ONE prop, not the reference's three (showHelp, helpIcon, helpTooltipContent): its presence renders the button, its content is the tooltip, so they cannot disagree. Typed string rather than ReactNode because the kit's tooltip renders textContent, and a prop that silently drops the markup you passed it is worse than one that never offered to take it. |
|
|
54
|
+
| `revealLabels` | `{ show: string; hide: string }` | Overridable because these are announced, and a page in another language should not be stuck with English. |
|
|
55
|
+
| `clearLabel` | `string` | |
|
|
56
|
+
| `helpLabel` | `string` | The help button's NAME, not its tip. Defaults to "Help"; the tip itself reaches a screen reader as the description, wired by the tooltip. |
|
|
57
|
+
| `className` | `string` | |
|
|
58
|
+
| `'aria-label'` (required) | `string` | |
|
|
59
|
+
| `'aria-labelledby'` (required) | `string` | |
|
|
60
|
+
|
|
61
|
+
## Component tokens
|
|
62
|
+
|
|
63
|
+
`--dk-component-input-small-padding-y`, `--dk-component-input-padding-y`, `--dk-component-input-large-padding-y`, `--dk-component-input-small-height`, `--dk-component-input-height`, `--dk-component-input-large-height`, `--dk-component-input-label-font-family`, `--dk-component-input-label-font-size`, `--dk-component-input-label-line-height`, `--dk-component-input-label-letter-spacing`, `--dk-component-input-label-font-weight`, `--dk-component-input-border-width`, `--dk-component-input-focus-ring-width`, `--dk-component-input-action-radius`, `--dk-component-input-caption-font-size`, `--dk-component-input-caption-line-height`, `--dk-component-input-font-weight`, `--dk-component-input-padding-inline`, `--dk-component-input-large-padding-inline`, `--dk-component-input-sentence-border`, `--dk-component-input-sentence-surface`, `--dk-component-input-sentence-text`, `--dk-component-input-sentence-font-weight`, `--dk-component-input-sentence-font-size`, `--dk-component-input-sentence-line-height`, `--dk-component-input-sentence-small-font-size`, `--dk-component-input-sentence-small-line-height`, `--dk-component-input-sentence-large-font-size`, `--dk-component-input-sentence-large-line-height`, `--dk-component-input-sentence-padding-inline`, `--dk-component-input-sentence-chevron-size`, `--dk-component-input-sentence-value-min-width`, `--dk-component-input-sentence-margin-inline`, `--dk-component-input-raised-shadow`, `--dk-component-input-raised-shadow-hover`, `--dk-component-input-inset-surface`, `--dk-component-input-inset-surface-hover`, `--dk-component-input-inset-surface-active`, `--dk-component-input-inset-action-hover`, `--dk-component-input-inset-action-active`, `--dk-component-input-inset-border`, `--dk-component-input-inset-text`, `--dk-component-input-inset-placeholder`, `--dk-component-input-inset-icon`, `--dk-component-input-inset-affix`, `--dk-component-input-inset-icon-subtle`, `--dk-component-input-inset-icon-subtle-hover`, `--dk-component-input-inset-icon-primary`, `--dk-component-input-inset-icon-success`, `--dk-component-input-inset-icon-error`, `--dk-component-input-inset-icon-warning`, `--dk-component-input-inset-icon-information`, `--dk-component-input-radius`, `--dk-component-input-gap`, `--dk-component-input-slot-gap`, `--dk-component-input-leading-control-divider`, `--dk-component-input-leading-control-divider-width`, `--dk-component-input-leading-control-gap`, `--dk-component-input-leading-icon-color`, `--dk-component-input-leading-icon-color-hover`, `--dk-component-input-leading-icon-color-focus`, `--dk-component-input-slot-icon-size`, `--dk-component-input-small-slot-icon-size`, `--dk-component-input-large-slot-icon-size`, `--dk-component-input-action-size`, `--dk-component-input-action-glyph-size`, `--dk-component-input-small-action-size`, `--dk-component-input-small-action-glyph-size`, `--dk-component-input-large-action-size`, `--dk-component-input-large-action-glyph-size`, `--dk-component-input-error-color`, `--dk-component-input-obscured-font-family`, `--dk-component-input-font-size`, `--dk-component-input-line-height`, `--dk-component-input-small-font-size`, `--dk-component-input-small-line-height`, `--dk-component-input-large-font-size`, `--dk-component-input-large-line-height`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Link (`link`)
|
|
2
|
+
|
|
3
|
+
A way to go somewhere. Inline, it is the sentence it sits in; standalone, it has its own size and room for an icon.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
a.dk-component-link[data-variant][data-standalone][data-size][data-show-visited]
|
|
10
|
+
span.dk-component-link__icon (standalone only, aria-hidden)
|
|
11
|
+
the text
|
|
12
|
+
span.dk-component-link__icon[data-trailing]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Attributes
|
|
16
|
+
|
|
17
|
+
| Attribute | Values the stylesheet styles |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `data-pseudo-class` | `active`, `focus`, `hover`, `visited` |
|
|
20
|
+
| `data-show-visited` | (present or absent) |
|
|
21
|
+
| `data-size` | `large`, `small` |
|
|
22
|
+
| `data-standalone` | (present or absent) |
|
|
23
|
+
| `data-trailing` | (present or absent) |
|
|
24
|
+
| `data-variant` | `neutral` |
|
|
25
|
+
|
|
26
|
+
## React
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { Link } from '@karmo-co/drift-kit/react';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
| Prop | Type | Notes |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `as` | `C` | The element or component to render, react-router's Link most often, so navigation stays client-side. Its own props (`to`) are typed from it: the props below are Link's, everything else is whatever `as` accepts. |
|
|
35
|
+
| `variant` | `'primary' \| 'neutral'` | |
|
|
36
|
+
| `showVisited` | `boolean` | Opt-in visited styling, for docs and long-form content. App UI leaves it off. |
|
|
37
|
+
| `disabled` | `boolean` | Renders a plain <a aria-disabled="true"> with no href, whatever `as` is: a router Link always navigates, so it cannot be disabled. Prefer removing a link to disabling it. |
|
|
38
|
+
| `children` | `ReactNode` | |
|
|
39
|
+
|
|
40
|
+
## Component tokens
|
|
41
|
+
|
|
42
|
+
`--dk-component-link-color-default`, `--dk-component-link-color-hover`, `--dk-component-link-color-active`, `--dk-component-link-underline-color-default`, `--dk-component-link-neutral-color-default`, `--dk-component-link-neutral-underline-color`, `--dk-component-link-visited-color`, `--dk-component-link-disabled-color`, `--dk-component-link-underline-thickness-default`, `--dk-component-link-underline-thickness-hover`, `--dk-component-link-underline-offset`, `--dk-component-link-small-font-size`, `--dk-component-link-small-line-height`, `--dk-component-link-medium-font-size`, `--dk-component-link-medium-line-height`, `--dk-component-link-large-font-size`, `--dk-component-link-large-line-height`, `--dk-component-link-font-weight`, `--dk-component-link-small-icon-size`, `--dk-component-link-medium-icon-size`, `--dk-component-link-large-icon-size`, `--dk-component-link-gap`, `--dk-component-link-icon-travel`, `--dk-component-link-focus-ring-width`, `--dk-component-link-focus-ring-offset`, `--dk-component-link-focus-ring-radius`, `--dk-component-link-external-icon-size`, `--dk-component-link-external-icon-gap`, `--dk-component-link-external-icon`, `--dk-component-link-motion-duration`, `--dk-component-link-motion-easing`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Loading spinner (`loading-spinner`)
|
|
2
|
+
|
|
3
|
+
The brand symbol inside a sweeping arc. It spins for at least half a second, so a fast load does not flash, and tells you when it has gone.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Anatomy (HTML)
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
div.dk-component-loading-spinner[data-size="small|medium|large"]?
|
|
10
|
+
span.__message?
|
|
11
|
+
(the arc and the brand symbol are drawn by the runtime)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Attributes
|
|
15
|
+
|
|
16
|
+
| Attribute | Values the stylesheet styles |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `data-animation` | `enter`, `exit` |
|
|
19
|
+
| `data-color` | `neutral` |
|
|
20
|
+
| `data-size` | `large`, `small`, `xsmall` |
|
|
21
|
+
| `data-variant` | `ring` |
|
|
22
|
+
|
|
23
|
+
## React
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { LoadingSpinner } from '@karmo-co/drift-kit/react';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Notes |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `size` | `'xsmall' \| 'small' \| 'medium' \| 'large'` | |
|
|
32
|
+
| `variant` | `'symbol' \| 'ring'` | |
|
|
33
|
+
| `color` | `'primary' \| 'neutral'` | neutral is grayscale: the arc, and the mark in the symbol variant. |
|
|
34
|
+
| `animation` | `'enter' \| 'exit'` | "enter" shows it; "exit" plays the exit once 500ms have passed since enter, then unmounts and calls onExitComplete. |
|
|
35
|
+
| `onExitComplete` | `() => void` | |
|
|
36
|
+
| `label` | `string` | |
|
|
37
|
+
| `message` | `string` | Text under the spinner, "Loading reports". It is also the accessible name unless label is given. |
|
|
38
|
+
| `brand` | `LogoBrand` | |
|
|
39
|
+
|
|
40
|
+
## Component tokens
|
|
41
|
+
|
|
42
|
+
`--dk-component-loading-spinner-color`, `--dk-component-loading-spinner-neutral-color`, `--dk-component-loading-spinner-message-gap`, `--dk-component-loading-spinner-message-font-size`, `--dk-component-loading-spinner-message-line-height`, `--dk-component-loading-spinner-message-font-weight`, `--dk-component-loading-spinner-message-color`, `--dk-component-loading-spinner-message-max-width`, `--dk-component-loading-spinner-tail-start`, `--dk-component-loading-spinner-ring-tail-start`, `--dk-component-loading-spinner-ring-xsmall-size`, `--dk-component-loading-spinner-ring-xsmall-stroke`, `--dk-component-loading-spinner-ring-small-size`, `--dk-component-loading-spinner-ring-medium-size`, `--dk-component-loading-spinner-ring-large-size`, `--dk-component-loading-spinner-small-logo-size`, `--dk-component-loading-spinner-small-gap`, `--dk-component-loading-spinner-small-stroke`, `--dk-component-loading-spinner-medium-logo-size`, `--dk-component-loading-spinner-medium-gap`, `--dk-component-loading-spinner-medium-stroke`, `--dk-component-loading-spinner-large-logo-size`, `--dk-component-loading-spinner-large-gap`, `--dk-component-loading-spinner-large-stroke`, `--dk-component-loading-spinner-spin-duration`, `--dk-component-loading-spinner-ring-spin-duration`, `--dk-component-loading-spinner-enter-duration`, `--dk-component-loading-spinner-exit-duration`, `--dk-component-loading-spinner-exit-delay`, `--dk-component-loading-spinner-fade-duration`, `--dk-component-loading-spinner-fade-delay`, `--dk-component-loading-spinner-enter-easing`, `--dk-component-loading-spinner-exit-easing`
|