@vokality/design-system 1.3.0 → 3.0.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/CHANGELOG.md +54 -0
- package/README.md +51 -5
- package/dist/browser.d.ts +13 -0
- package/dist/browser.js +7 -0
- package/dist/charts/chart.d.ts +6 -5
- package/dist/charts/chart.js +44 -25
- package/dist/chat.d.ts +54 -0
- package/dist/chat.js +1 -0
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Alert/Alert.js +5 -2
- package/dist/components/AppShell/AppShell.js +10 -14
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/AvatarGroup/AvatarGroup.js +2 -2
- package/dist/components/BarChart/BarChart.js +17 -15
- package/dist/components/Breadcrumbs/Breadcrumbs.js +6 -3
- package/dist/components/Calendar/Calendar.js +6 -5
- package/dist/components/Card/Card.js +2 -3
- package/dist/components/ChatInbox/ChatInbox.d.ts +11 -0
- package/dist/components/ChatInbox/ChatInbox.js +49 -0
- package/dist/components/ChatPanel/ChatPanel.d.ts +3 -0
- package/dist/components/ChatPanel/ChatPanel.js +13 -0
- package/dist/components/ChatPanel/composer.d.ts +5 -0
- package/dist/components/ChatPanel/composer.js +32 -0
- package/dist/components/ChatPanel/transcript.d.ts +13 -0
- package/dist/components/ChatPanel/transcript.js +39 -0
- package/dist/components/ChatWidget/ChatWidget.d.ts +12 -0
- package/dist/components/ChatWidget/ChatWidget.js +42 -0
- package/dist/components/Checkbox/Checkbox.d.ts +5 -10
- package/dist/components/Checkbox/Checkbox.js +5 -19
- package/dist/components/CodeBlock/CodeBlock.js +19 -5
- package/dist/components/Combobox/Combobox.js +22 -15
- package/dist/components/Combobox/ListPanel.js +20 -9
- package/dist/components/CommandPalette/CommandPalette.js +33 -14
- package/dist/components/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/components/ContextMenu/ContextMenu.js +5 -50
- package/dist/components/DatePicker/DatePicker.js +35 -29
- package/dist/components/DescriptionList/DescriptionList.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +24 -7
- package/dist/components/Dialog/Dialog.js +30 -41
- package/dist/components/Drawer/Drawer.d.ts +4 -2
- package/dist/components/EmptyState/EmptyState.js +2 -2
- package/dist/components/ErrorSummary/ErrorSummary.js +5 -3
- package/dist/components/FaqList/FaqList.js +1 -1
- package/dist/components/Field/Field.js +4 -4
- package/dist/components/Fieldset/Fieldset.js +3 -3
- package/dist/components/FileUpload/FileUpload.js +17 -9
- package/dist/components/Grid/Grid.d.ts +867 -5
- package/dist/components/Grid/Grid.js +3 -4
- package/dist/components/Heading/Heading.js +2 -1
- package/dist/components/Icon/Icon.js +4 -2
- package/dist/components/Inline/Inline.d.ts +867 -5
- package/dist/components/Inline/Inline.js +2 -3
- package/dist/components/LineChart/LineChart.js +17 -15
- package/dist/components/LinkProvider/LinkProvider.d.ts +1 -1
- package/dist/components/LinkProvider/LinkProvider.js +6 -2
- package/dist/components/List/List.js +1 -1
- package/dist/components/MediaCard/MediaCard.js +2 -2
- package/dist/components/Menu/Menu.js +6 -43
- package/dist/components/Menu/entries.d.ts +1 -30
- package/dist/components/Menu/entries.js +16 -100
- package/dist/components/MultiSelect/MultiSelect.js +43 -34
- package/dist/components/NumberInput/NumberInput.js +17 -18
- package/dist/components/OtpInput/OtpInput.d.ts +1 -1
- package/dist/components/OtpInput/OtpInput.js +10 -67
- package/dist/components/PageHeader/PageHeader.js +2 -2
- package/dist/components/Pagination/Pagination.js +3 -1
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +9 -4
- package/dist/components/Popover/Popover.d.ts +6 -7
- package/dist/components/Popover/Popover.js +2 -19
- package/dist/components/Progress/Progress.d.ts +1 -1
- package/dist/components/Progress/Progress.js +7 -11
- package/dist/components/Radio/Radio.d.ts +4 -2
- package/dist/components/RadioGroup/RadioGroup.d.ts +5 -12
- package/dist/components/RadioGroup/RadioGroup.js +6 -33
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +63 -0
- package/dist/components/RichTextEditor/RichTextEditor.js +175 -0
- package/dist/components/RichTextEditor/toolbar.d.ts +15 -0
- package/dist/components/RichTextEditor/toolbar.js +142 -0
- package/dist/components/RichTextEditor/uploads.d.ts +41 -0
- package/dist/components/RichTextEditor/uploads.js +124 -0
- package/dist/components/SearchInput/SearchInput.js +4 -2
- package/dist/components/SectionHeader/SectionHeader.js +1 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +2 -12
- package/dist/components/Select/Select.d.ts +15 -16
- package/dist/components/Select/Select.js +11 -252
- package/dist/components/Slider/Slider.js +11 -21
- package/dist/components/Sparkline/Sparkline.js +8 -3
- package/dist/components/Spinner/Spinner.js +5 -2
- package/dist/components/Stack/Stack.d.ts +867 -5
- package/dist/components/Stack/Stack.js +2 -3
- package/dist/components/Stat/Stat.js +6 -3
- package/dist/components/Steps/Steps.js +6 -3
- package/dist/components/Switch/Switch.d.ts +7 -7
- package/dist/components/Switch/Switch.js +4 -10
- package/dist/components/Table/Table.js +38 -19
- package/dist/components/Tabs/Tabs.js +2 -22
- package/dist/components/Tag/Tag.js +3 -1
- package/dist/components/Text/Text.d.ts +9 -5
- package/dist/components/Text/Text.js +3 -4
- package/dist/components/TileGrid/TileGrid.js +1 -1
- package/dist/components/TimePicker/TimePicker.js +35 -33
- package/dist/components/Timeline/Timeline.js +5 -4
- package/dist/components/Toaster/Toaster.js +21 -17
- package/dist/components/Tooltip/Tooltip.d.ts +6 -6
- package/dist/components/Tooltip/Tooltip.js +3 -17
- package/dist/components/TreeView/TreeView.js +15 -12
- package/dist/components.css +281 -60
- package/dist/hooks/useTheme.js +6 -6
- package/dist/icons/message-circle.svg +1 -0
- package/dist/internal/CharCount.js +3 -1
- package/dist/internal/choice.d.ts +10 -48
- package/dist/internal/choice.js +8 -96
- package/dist/internal/describedBy.d.ts +3 -0
- package/dist/internal/describedBy.js +4 -0
- package/dist/internal/options.d.ts +10 -5
- package/dist/internal/options.js +25 -11
- package/dist/internal/status.d.ts +3 -2
- package/dist/internal/status.js +10 -2
- package/dist/internal/useScrollActive.js +2 -2
- package/dist/internal/useToday.d.ts +3 -0
- package/dist/internal/useToday.js +42 -0
- package/dist/lib/dates.js +25 -15
- package/dist/lib/format.js +11 -8
- package/dist/lib/icons.d.ts +5 -0
- package/dist/lib/icons.js +2 -0
- package/dist/lib/math.js +17 -5
- package/dist/lib/rich-text.d.ts +13 -0
- package/dist/lib/rich-text.js +62 -0
- package/dist/lib/space.d.ts +1 -2
- package/dist/lib/space.js +4 -1
- package/dist/lib/text.js +1 -1
- package/dist/lib/theme.js +1 -1
- package/dist/localization.d.ts +166 -0
- package/dist/localization.js +142 -0
- package/dist/tokens.css +2 -0
- package/dist/tokens.dtcg.json +10 -0
- package/dist/tokens.json +10 -0
- package/dist/types.d.ts +6 -1
- package/dist/vokality.css +283 -60
- package/dist/vokality.iife.js +35981 -9698
- package/docs/brand.md +8 -5
- package/docs/components/AppShell/README.md +1 -1
- package/docs/components/Badge/README.md +1 -1
- package/docs/components/BarChart/README.md +1 -0
- package/docs/components/Button/README.md +4 -2
- package/docs/components/ChatInbox/README.md +41 -0
- package/docs/components/ChatWidget/README.md +47 -0
- package/docs/components/Checkbox/README.md +7 -3
- package/docs/components/ContextMenu/README.md +7 -3
- package/docs/components/Dialog/README.md +9 -4
- package/docs/components/Drawer/README.md +1 -1
- package/docs/components/Field/README.md +1 -1
- package/docs/components/Fieldset/README.md +2 -2
- package/docs/components/Inline/README.md +1 -1
- package/docs/components/LineChart/README.md +1 -0
- package/docs/components/LocaleProvider/README.md +48 -0
- package/docs/components/Menu/README.md +13 -8
- package/docs/components/OtpInput/README.md +9 -5
- package/docs/components/PasswordInput/README.md +11 -2
- package/docs/components/Popover/README.md +6 -3
- package/docs/components/Progress/README.md +3 -1
- package/docs/components/RadioGroup/README.md +5 -2
- package/docs/components/RichTextEditor/README.md +84 -0
- package/docs/components/SegmentedControl/README.md +2 -0
- package/docs/components/Select/README.md +13 -17
- package/docs/components/Skeleton/README.md +1 -1
- package/docs/components/Slider/README.md +4 -2
- package/docs/components/Steps/README.md +1 -1
- package/docs/components/Switch/README.md +5 -2
- package/docs/components/Tabs/README.md +4 -2
- package/docs/components/Text/README.md +1 -1
- package/docs/components/Toaster/README.md +3 -1
- package/docs/components/Tooltip/README.md +5 -3
- package/package.json +49 -5
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# RichTextEditor
|
|
2
|
+
|
|
3
|
+
A real rich-text surface powered by ProseMirror. The value is a CommonMark Markdown string, including formatting, Unicode emoji and durable attachment links. Import the editor from its own entrypoint so applications that do not edit rich text do not bundle the editor engine.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Field } from "@vokality/design-system";
|
|
7
|
+
import { RichTextEditor } from "@vokality/design-system/rich-text";
|
|
8
|
+
import type { RichTextAttachment } from "@vokality/design-system/rich-text";
|
|
9
|
+
|
|
10
|
+
async function uploadAttachment(file: File, { signal }: { signal: AbortSignal }): Promise<RichTextAttachment> {
|
|
11
|
+
const body = new FormData();
|
|
12
|
+
body.append("file", file);
|
|
13
|
+
const response = await fetch("/api/attachments", { method: "POST", body, signal });
|
|
14
|
+
if (!response.ok) throw new Error("Upload failed");
|
|
15
|
+
// Validate your endpoint's unknown response before returning clean data.
|
|
16
|
+
const result: unknown = await response.json();
|
|
17
|
+
if (typeof result !== "object" || result === null || !("url" in result) ||
|
|
18
|
+
!("name" in result) || typeof result.url !== "string" || typeof result.name !== "string") {
|
|
19
|
+
throw new TypeError("Invalid attachment response");
|
|
20
|
+
}
|
|
21
|
+
return { url: result.url, name: result.name };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
<Field label="Notes" hint="Formatting and attachments are saved as Markdown.">
|
|
25
|
+
<RichTextEditor
|
|
26
|
+
name="notes"
|
|
27
|
+
defaultValue="## Project notes\n\nStart writing."
|
|
28
|
+
onUploadAttachment={uploadAttachment}
|
|
29
|
+
accept="image/*,.pdf"
|
|
30
|
+
maxFileSize={10 * 1024 * 1024}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Anatomy
|
|
36
|
+
|
|
37
|
+
- Formatting toolbar: paragraph, headings 1–3, bold, italic, inline code, code block, bullet/ordered lists, blockquote, links, emoji, optional attachments, undo and redo.
|
|
38
|
+
- `toolbar="minimal"` places the writing field first, followed by a small action row: Aa, emoji, and attachments when uploads are configured. Aa opens a native Radix disclosure with bold, italic, link and bullet-list controls. The default `toolbar="full"` retains the complete toolbar above the field. Both layouts use the same editor commands and Markdown model.
|
|
39
|
+
- Multiline editable textbox: its `id` and forwarded `HTMLDivElement` ref point to the actual editor. `Field` wires label, hint, error and invalid state onto it.
|
|
40
|
+
- A native form field carries the Markdown value. Required validation prevents an empty submission and focuses the visible editor. A disabled editor is excluded from form data; a read-only editor remains included.
|
|
41
|
+
- Attachment progress/error rows provide cancellation, retry and removal. Uploaded files become Markdown links in separate paragraphs at the document's end, so a late response never replaces a later selection.
|
|
42
|
+
|
|
43
|
+
## Value and supported content
|
|
44
|
+
|
|
45
|
+
Use `value` with `onChange` for a controlled editor, or `defaultValue` for an uncontrolled one. Changes emit canonical CommonMark; whitespace, list markers and equivalent Markdown syntax may normalize. Selection changes do not emit. External controlled values replace the document and reset edit history; normal parent echoes preserve selection and history. Native form reset restores the uncontrolled default and cancels pending uploads.
|
|
46
|
+
|
|
47
|
+
The parser and serializer preserve the CommonMark document model: paragraphs, six heading levels, bold, italic, inline/fenced code, nested lists, blockquotes, hard breaks, horizontal rules, links and inline images. The toolbar offers the first three heading levels. Unicode emoji remain ordinary text and survive copying and Markdown reloads. The default picker is a small searchable set; `emojiOptions` supplies other Unicode sequences with localized accessible labels. Operating-system emoji input and pasted emoji also work.
|
|
48
|
+
|
|
49
|
+
Raw HTML is treated as text. GFM tables, task lists, mentions, embeds and arbitrary HTML are outside this content contract; this is not a general HTML editor. Render saved Markdown using a trusted CommonMark renderer with raw HTML disabled and the same URL policy. `Prose` provides the system's reading styles.
|
|
50
|
+
|
|
51
|
+
## Attachments
|
|
52
|
+
|
|
53
|
+
`onUploadAttachment(file, { signal })` enables the attach button. The application owns authentication, endpoint validation, storage, upload progress transport and deletion of server assets. It returns `{ name, url }` after upload. The editor validates this result at runtime, then inserts its escaped name as a Markdown link.
|
|
54
|
+
|
|
55
|
+
`accept` filters the file chooser; `maxFileSize` rejects oversized files before upload. The server must enforce its own limits. Multiple files upload independently. Failed attempts retain their file for retry. Canceling, unmounting, resetting or locking the editor aborts pending attempts; late results are ignored even if the callback disregards the signal. Removing an uploaded attachment removes its document reference, without deleting the server file. Editing/removing attachment links directly is ordinary document editing; undo can restore them.
|
|
56
|
+
|
|
57
|
+
`onUploadPendingChange(pending)` observes the existing upload attempt lifecycle, so a surrounding send action can wait for attachment links. It reports when attempts start, settle or abort; canceling or unmounting releases pending state. It adds no upload tracking or transport.
|
|
58
|
+
|
|
59
|
+
Links accept HTTP(S), mailto, tel and relative/fragment URLs. Attachment and image URLs accept HTTP(S) and relative URLs. Script/data/blob URLs, protocol-relative URLs, backslashes and control characters are rejected. The same document policy guards pasted content before it reaches the view. Editing a link never navigates the application.
|
|
60
|
+
|
|
61
|
+
## States and tokens
|
|
62
|
+
|
|
63
|
+
- Default: `card` fill, `input-border`, body type from `control-font-size`.
|
|
64
|
+
- Focus: `primary` border with a 2px `ring` outline on the editor or toolbar action.
|
|
65
|
+
- Pressed formatting: `primary`, `primary-tint`, `primary-line`, plus `aria-pressed`.
|
|
66
|
+
- Invalid: `danger` border; pair with `Field error` for an explanation.
|
|
67
|
+
- Disabled: dashed border and unavailable toolbar; `readOnly` retains selectable content and hides the toolbar.
|
|
68
|
+
- Forced colors: selected tools use system `Highlight`/`HighlightText`. There are no animations. Touch actions meet the shared control height.
|
|
69
|
+
|
|
70
|
+
## Accessibility and localization
|
|
71
|
+
|
|
72
|
+
The toolbar uses Radix's roving focus: Tab enters/exits once, Left/Right move between available tools, and Home/End jump to the ends. Mouse formatting preserves the editor selection. Bold/italic have standard Mod+B/Mod+I shortcuts; Mod+Z and Shift+Mod+Z undo/redo. Enter splits list items; Mod+[ and Mod+] outdent/indent; Shift+Enter adds a hard break. Link and emoji panels are Radix popovers with labeled controls and Escape handling. Emoji options have searchable text labels. Upload feedback has a polite live region, and every action names its file.
|
|
73
|
+
|
|
74
|
+
All built-in labels, emoji names and upload feedback use `LocaleProvider`, including changes while the editor is mounted. `emojiOptions` labels and app-supplied placeholders use the application's language.
|
|
75
|
+
|
|
76
|
+
The editor initializes in an effect, so server rendering and hydration do not access browser globals. Its form value and accessible textbox exist in the initial HTML; the editable document mounts on the client.
|
|
77
|
+
|
|
78
|
+
## Props
|
|
79
|
+
|
|
80
|
+
`value`, `defaultValue`, `onChange`, `name`, `id`, `disabled`, `readOnly`, `toolbar`, `required`, `placeholder`, `className`, `onBlur`, `onUploadAttachment`, `accept`, `maxFileSize`, `emojiOptions`, `onUploadError`, `onUploadPendingChange`, and `aria-label`, `aria-labelledby`, `aria-describedby`, `aria-invalid`. Types and prop documentation ship through the direct `rich-text` entrypoint.
|
|
81
|
+
|
|
82
|
+
## Engine references
|
|
83
|
+
|
|
84
|
+
The [official Markdown module](https://code.haverbeke.berlin/prosemirror/prosemirror-markdown) defines the CommonMark schema, parser and serializer. The [official ProseMirror guide](https://prosemirror.net/docs/guide/) explains immutable editor state, transactions and the view; the [Radix toolbar documentation](https://www.radix-ui.com/primitives/docs/components/toolbar) documents the keyboard model.
|
|
@@ -17,3 +17,5 @@ Built on Radix RadioGroup: `role="radiogroup"` (named by `label`) with `radio` b
|
|
|
17
17
|
## Rules
|
|
18
18
|
- The choice applies immediately. For a choice inside a form, use `RadioGroup`.
|
|
19
19
|
- Keep labels to one word where you can.
|
|
20
|
+
|
|
21
|
+
Radix owns selection and keyboard interaction. Pass `defaultValue` explicitly when an initial selection is needed; the wrapper does not choose the first option.
|
|
@@ -20,29 +20,25 @@ A custom drop-down for picking one option from a known list. Trigger and option
|
|
|
20
20
|
| Option | Selected | `primary-hover` text and check (4.7:1 on the active row) |
|
|
21
21
|
| Option | Disabled | `muted-subtle` text; skipped by arrow keys and type-to-jump |
|
|
22
22
|
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
| Enter, Space, ↓ | Opens on the selected option (the first enabled one if none) | Enter and Space choose the active option and close (Space typed within a second of a letter is part of the search) |
|
|
27
|
-
| ↑ | Opens on the selected option (the last one if none) | Moves up (Alt + ↑ chooses and closes) |
|
|
28
|
-
| ↓ | | Moves down |
|
|
29
|
-
| Home, End (PageUp, PageDown) | Opens at the first or last option | Jumps to the first or last option |
|
|
30
|
-
| Typing letters | Opens at the first match (without choosing it) | Jumps to the next match; letters typed within a second search together, a repeated letter cycles |
|
|
31
|
-
| Esc | | Closes without changing the value |
|
|
32
|
-
| Tab | Moves focus on | Chooses the active option, closes, moves focus on |
|
|
23
|
+
## Behavior
|
|
24
|
+
|
|
25
|
+
State, trigger gestures, focus, keyboard navigation, typeahead, dismissal and form participation come directly from [Radix Select](https://www.radix-ui.com/primitives/docs/components/select). This component adds tokens, layout, icons, descriptions and option-data mapping.
|
|
33
26
|
|
|
34
|
-
|
|
27
|
+
- Enter, Space and arrow keys open the list. Arrow keys and Home/End navigate open options; disabled options are skipped.
|
|
28
|
+
- Typing on a closed trigger changes the selected value using Radix typeahead. Typing in the open list moves focus to a matching option.
|
|
29
|
+
- Enter or Space selects. Escape dismisses and restores trigger focus. Radix prevents Tab while the list is open; dismiss before tabbing onward.
|
|
30
|
+
- Pointer opening, selection and outside dismissal use Radix's handlers. Clicking a native label activates its associated trigger.
|
|
35
31
|
|
|
36
32
|
## Accessibility
|
|
37
|
-
Implements the WAI-ARIA *select-only combobox* pattern with Radix Select: the trigger is a `<button>` with `role="combobox"`, `aria-expanded` and (while open) `aria-controls`, and the list has `role="listbox"` with `role="option"` items, each named by its label and described by its `description`. While the list is open, focus moves onto the active option (Radix's model, instead of `aria-activedescendant`) and the rest of the page is hidden from assistive technology; closing
|
|
33
|
+
Implements the WAI-ARIA *select-only combobox* pattern with Radix Select: the trigger is a `<button>` with `role="combobox"`, `aria-expanded` and (while open) `aria-controls`, and the list has `role="listbox"` with `role="option"` items, each named by its label and described by its `description`. While the list is open, focus moves onto the active option (Radix's model, instead of `aria-activedescendant`) and the rest of the page is hidden from assistive technology; closing restores trigger focus through Radix. Inside a `Field`, the label names the control and native label activation reaches the trigger.
|
|
38
34
|
|
|
39
35
|
## Props
|
|
40
36
|
- `options`: strings or `{ value, label, description, disabled }`.
|
|
41
|
-
- `placeholder`: shown until something is chosen
|
|
42
|
-
- `value` + `onChange(value, option)` to control it, or `defaultValue`. `value={null}` clears it to the placeholder.
|
|
43
|
-
- `name
|
|
44
|
-
- `
|
|
45
|
-
- `defaultOpen
|
|
37
|
+
- `placeholder`: shown until something is chosen; defaults to the localized select prompt. No value is selected unless supplied through `value` or `defaultValue`.
|
|
38
|
+
- `value` + `onChange(value, option)` to control it, or `defaultValue`. `value={null}` clears it to the placeholder. Option values must be non-empty strings, as required by Radix. `onChange` runs when the value changes (choosing the option that is already chosen doesn't call it); resetting the surrounding form puts an uncontrolled select back to its first value.
|
|
39
|
+
- `name`, `form`, `required` and `disabled` pass to Radix Root. Its native form select posts the value, participates in validation and handles reset; disabled controls are excluded.
|
|
40
|
+
- `aria-label` when there is no `Field`; `aria-labelledby`, `aria-describedby` and `aria-invalid` wire accessible presentation.
|
|
41
|
+
- `open`, `defaultOpen` and `onOpenChange` pass directly to Radix; `dir` and `autoComplete` are supported through its Root contract.
|
|
46
42
|
- The ref is the trigger `<button>`, so a `Select` can be a `Tooltip` trigger.
|
|
47
43
|
|
|
48
44
|
## Rules
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Placeholder blocks shown where content is loading, in its final shape, so the layout doesn't jump.
|
|
4
4
|
|
|
5
5
|
## Anatomy
|
|
6
|
-
`
|
|
6
|
+
`border-subtle` fill keeps placeholder shapes visible in every theme, with a faint `foreground` 5% shimmer moving left every 1.4s (still under reduced motion).
|
|
7
7
|
|
|
8
8
|
## Props
|
|
9
9
|
- `width`, `height` for a single block, or `lines` for a paragraph (the last line is shorter).
|
|
@@ -10,13 +10,15 @@ Picks a value from a continuous range by dragging or with the keyboard, for sett
|
|
|
10
10
|
5. **Limits** (optional, `showLimits`): minimum and maximum below the track.
|
|
11
11
|
|
|
12
12
|
## Keyboard
|
|
13
|
-
← → (or ↓ ↑) step by `step`, ten steps with Shift; PageUp / PageDown move
|
|
13
|
+
← → (or ↓ ↑) step by `step`, ten steps with Shift; PageUp / PageDown move ten steps; Home / End jump to the ends. Clicking the track jumps there; dragging follows the pointer.
|
|
14
14
|
|
|
15
15
|
## Accessibility
|
|
16
|
-
`role="slider"` with `aria-valuenow`, min and max, and `aria-valuetext` from `valueText` or `format` ("$1,200 per month").
|
|
16
|
+
`role="slider"` with Radix-managed `aria-valuenow`, min and max, and `aria-valuetext` from `valueText` or `format` ("$1,200 per month").
|
|
17
17
|
|
|
18
18
|
## Props
|
|
19
19
|
- `value` + `onChange`, or `defaultValue`. `min` (0), `max` (100), `step` (1), `format(v)`, `valueText(v)`, `showValue`, `showLimits`, `name` (submitted through a hidden input inside a `form`), `disabled`, `aria-label` or the `Field` label.
|
|
20
20
|
|
|
21
21
|
## Rules
|
|
22
22
|
- If people need an exact number, add a `NumberInput` beside it or use one instead.
|
|
23
|
+
|
|
24
|
+
The scalar value callback adapts Radix's one-thumb number array; Radix owns stepping, pointer handling, keyboard behavior, bounds and uncontrolled form reset. [Radix Slider documentation](https://www.radix-ui.com/primitives/docs/components/slider).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Shows where someone is in a fixed sequence: onboarding, a checkout, a multi-page form.
|
|
4
4
|
|
|
5
5
|
## Anatomy
|
|
6
|
-
Each step has a 28px square marker with the number zero-padded in Space Grotesk, a label, and an optional description in `muted-subtle`. A 1px rule connects the markers. It runs horizontally by default
|
|
6
|
+
Each step has a 28px square marker with the number zero-padded in Space Grotesk, a label, and an optional description in `muted-subtle`. A 1px rule connects the markers. It runs horizontally by default and stacks vertically at viewport widths of 28rem or less so labels remain distinct. Use `orientation="vertical"` for a vertical sequence at every width.
|
|
7
7
|
|
|
8
8
|
## Step states
|
|
9
9
|
| State | Marker | Label | Rule after it |
|
|
@@ -18,9 +18,12 @@ A square on/off toggle for settings that take effect immediately.
|
|
|
18
18
|
| Disabled, on | `muted-subtle` fill and border | `background`, right |
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
|
-
- `label`, `description`, `checked` or `defaultChecked`, `
|
|
21
|
+
- `label`, `description`, `checked` or `defaultChecked`, `onCheckedChange`, `disabled`, `name`, `value`, `hideLabel`.
|
|
22
22
|
- Built on Radix Switch: the track is a `button` with `role="switch"` and `aria-checked`; Space or Enter toggles it. Inside a `form` a hidden checkbox carries `name` and `value`.
|
|
23
|
-
- `
|
|
23
|
+
- `onCheckedChange(checked)` receives a boolean directly. The ref and DOM callbacks refer to the actual `HTMLButtonElement`; no input event is synthesized.
|
|
24
|
+
- Migration: replace `onChange={event => setChecked(event.target.checked)}` with `onCheckedChange={setChecked}`. Radix owns uncontrolled state and form reset.
|
|
25
|
+
|
|
26
|
+
See [Radix Switch](https://www.radix-ui.com/primitives/docs/components/switch) for the public behavior and props.
|
|
24
27
|
|
|
25
28
|
## Rules
|
|
26
29
|
- Use a switch only when the change applies without a Save button. Inside a form that is submitted, use `Checkbox`.
|
|
@@ -16,11 +16,13 @@ Style state with Radix's attributes on `.vk-tab`: `[data-state=active|inactive]`
|
|
|
16
16
|
Tab lands on the selected tab. ← → move between tabs and select them (wrapping); Home and End (or Page Up and Page Down) jump to the first or last. Tab again moves into the panel.
|
|
17
17
|
|
|
18
18
|
## Accessibility
|
|
19
|
-
WAI-ARIA tabs with automatic activation: `tablist`, `tab` (`aria-selected`, `aria-controls`, roving `tabIndex`) and `tabpanel` (`aria-labelledby`).
|
|
19
|
+
WAI-ARIA tabs with automatic activation: `tablist`, `tab` (`aria-selected`, `aria-controls`, roving `tabIndex`) and `tabpanel` (`aria-labelledby`). Radix manages panel presence and selection. `keepMounted` maps to Radix `forceMount`; inactive panels remain hidden through their `data-state` styling.
|
|
20
20
|
|
|
21
21
|
## Props
|
|
22
|
-
- `tabs`: `{ id, label, content, count, disabled }`. `value` + `onChange`, or `defaultValue` (
|
|
22
|
+
- `tabs`: `{ id, label, content, count, disabled }`. `value` + `onChange`, or `defaultValue` (no selected tab unless supplied). `onChange(id)` maps directly to Radix `onValueChange` without filtering callbacks. `label` (the list's accessible name). `keepMounted` keeps hidden panels rendered.
|
|
23
23
|
|
|
24
24
|
## Rules
|
|
25
25
|
- Two to six tabs with short labels. Tabs never change the URL's page; use links for that.
|
|
26
26
|
- For switching how one thing is displayed (chart or table), use `SegmentedControl`.
|
|
27
|
+
|
|
28
|
+
[Radix Tabs documentation](https://www.radix-ui.com/primitives/docs/components/tabs) defines automatic activation and controlled/uncontrolled behavior.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Text
|
|
2
2
|
|
|
3
|
-
Use `numeric` for Space Grotesk with tabular figures, `
|
|
3
|
+
Use `numeric` for Space Grotesk with tabular figures, `overflowWrap="anywhere"` for long IDs, and `weight="regular" | "medium" | "semibold" | "bold"` for emphasis independent of size. Standard element attributes pass through. For example: `<Text as="span" size="small" numeric overflowWrap="anywhere">{record.id}</Text>`.
|
|
4
4
|
|
|
5
5
|
Use `truncate` for a single line that ends in an ellipsis when its container narrows, such as the two lines of an app-shell brand. The full text remains available to assistive technology.
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Short, temporary notifications about an action someone just took ("Changes saved
|
|
|
9
9
|
|
|
10
10
|
## Timing
|
|
11
11
|
- Info, success and warning toasts dismiss after 5 seconds. Danger toasts stay until dismissed.
|
|
12
|
-
-
|
|
12
|
+
- Radix owns the timer and pauses it while the pointer is over the stack, focus is inside it, or the window is in the background. The `toast()` store only maps notification data to Radix instances; it has no timer or keyboard engine.
|
|
13
13
|
- Toasts slide up 0.5rem on entry; that motion stops under reduced motion.
|
|
14
14
|
|
|
15
15
|
## API
|
|
@@ -32,3 +32,5 @@ Each new toast is announced once through Radix's live region ("Notification", th
|
|
|
32
32
|
- One short sentence for the title, in the past tense for completed actions ("Invoice sent").
|
|
33
33
|
- Never put the only path to something important in a toast; it disappears. Use an `Alert` or `Dialog` for that.
|
|
34
34
|
- An action in a toast must also be available elsewhere (Undo is the classic case).
|
|
35
|
+
|
|
36
|
+
[Radix Toast documentation](https://www.radix-ui.com/primitives/docs/components/toast) defines timing, focus, hotkeys and swipe behavior.
|
|
@@ -6,14 +6,14 @@ A short text label that appears on hover or keyboard focus, for an icon-only con
|
|
|
6
6
|
Inverted for contrast: `foreground` fill with `background` text (14.6:1), 12px IBM Plex Sans 500, 0.35rem 0.55rem padding, square, at most 16rem wide. It sits 6px above the trigger (or below with `placement="bottom"`), flips when there's no room, and is centered (or start-aligned with `align="start"`).
|
|
7
7
|
|
|
8
8
|
## Behaviour
|
|
9
|
-
- Appears 400ms after the pointer enters (`delay`), immediately on keyboard focus.
|
|
9
|
+
- Appears 400ms after the pointer enters (`delay`), immediately on keyboard focus.
|
|
10
10
|
- Disappears when the pointer leaves, focus moves, or Esc is pressed.
|
|
11
11
|
|
|
12
12
|
## Props
|
|
13
|
-
- `content`, `children` (exactly one focusable element; a custom component must forward its ref, as every component in the system does), `placement` (`top` or `bottom`), `align`, `delay`.
|
|
13
|
+
- `content`, `children` (exactly one focusable element; a custom component must forward its ref, as every component in the system does), `placement` (`top` or `bottom`), `align`, `delay`, and native Radix `open`, `defaultOpen`, `onOpenChange`.
|
|
14
14
|
|
|
15
15
|
## Touch
|
|
16
|
-
|
|
16
|
+
Touch taps keep Radix Tooltip’s native behavior: they run the trigger action without opening a timed tooltip. `touchDuration` is removed. Nothing essential may live only in a tooltip.
|
|
17
17
|
|
|
18
18
|
## Accessibility
|
|
19
19
|
`role="tooltip"`, linked to the trigger with `aria-describedby` while visible. It describes; it doesn't name. An `IconButton` still needs its own `label`.
|
|
@@ -21,3 +21,5 @@ On touch screens a tap on the trigger runs its action and shows the tooltip for
|
|
|
21
21
|
## Rules
|
|
22
22
|
- Plain text only: no links, buttons or anything interactive. Use `Popover` for that.
|
|
23
23
|
- Never hide information someone needs to finish a task in a tooltip; touch screens can't hover.
|
|
24
|
+
|
|
25
|
+
[Radix Tooltip documentation](https://www.radix-ui.com/primitives/docs/components/tooltip) defines its hover, focus and dismissal contract.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vokality/design-system",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Vokality's design system: tokens, themes and React components for every Vokality project.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js"
|
|
15
15
|
},
|
|
16
|
+
"./localization": {
|
|
17
|
+
"types": "./dist/localization.d.ts",
|
|
18
|
+
"import": "./dist/localization.js"
|
|
19
|
+
},
|
|
20
|
+
"./rich-text": {
|
|
21
|
+
"types": "./dist/components/RichTextEditor/RichTextEditor.d.ts",
|
|
22
|
+
"import": "./dist/components/RichTextEditor/RichTextEditor.js"
|
|
23
|
+
},
|
|
16
24
|
"./vokality.css": "./dist/vokality.css",
|
|
17
25
|
"./tokens.css": "./dist/tokens.css",
|
|
18
26
|
"./components.css": "./dist/components.css",
|
|
@@ -22,7 +30,19 @@
|
|
|
22
30
|
"./tokens.dtcg.json": "./dist/tokens.dtcg.json",
|
|
23
31
|
"./icons/*": "./dist/icons/*",
|
|
24
32
|
"./fonts/*": "./dist/fonts/*",
|
|
25
|
-
"./iife": "./dist/vokality.iife.js"
|
|
33
|
+
"./iife": "./dist/vokality.iife.js",
|
|
34
|
+
"./chat-widget": {
|
|
35
|
+
"types": "./dist/components/ChatWidget/ChatWidget.d.ts",
|
|
36
|
+
"import": "./dist/components/ChatWidget/ChatWidget.js"
|
|
37
|
+
},
|
|
38
|
+
"./chat-inbox": {
|
|
39
|
+
"types": "./dist/components/ChatInbox/ChatInbox.d.ts",
|
|
40
|
+
"import": "./dist/components/ChatInbox/ChatInbox.js"
|
|
41
|
+
},
|
|
42
|
+
"./chat-models": {
|
|
43
|
+
"types": "./dist/chat.d.ts",
|
|
44
|
+
"import": "./dist/chat.js"
|
|
45
|
+
}
|
|
26
46
|
},
|
|
27
47
|
"files": [
|
|
28
48
|
"dist",
|
|
@@ -38,23 +58,38 @@
|
|
|
38
58
|
"build": "bun scripts/build.mjs",
|
|
39
59
|
"test": "bun run build && bun test test/",
|
|
40
60
|
"test:browser": "bun run build && bun test --timeout 30000 e2e/",
|
|
61
|
+
"test:visual": "bun run build && bunx playwright test -c validation/playwright.config.mjs",
|
|
62
|
+
"test:visual:update": "bun run build && bunx playwright test -c validation/playwright.config.mjs --update-snapshots",
|
|
63
|
+
"test:next": "bun run build && bun scripts/test-next.mjs build && VK_NEXT=1 bunx playwright test -c validation/playwright.config.mjs",
|
|
41
64
|
"typecheck": "tsc -p tsconfig.json",
|
|
65
|
+
"lint": "eslint src --max-warnings 0",
|
|
66
|
+
"doctor": "react-doctor --yes --scope full --blocking warning --no-supply-chain --no-score",
|
|
42
67
|
"preview": "bun run build && bun scripts/preview.mjs",
|
|
43
68
|
"artifact": "bun run build && bun scripts/build-artifact.mjs",
|
|
44
69
|
"prepack": "bun run build",
|
|
45
70
|
"verify:docs": "bun scripts/verify-docs-page.mjs"
|
|
46
71
|
},
|
|
47
72
|
"peerDependencies": {
|
|
48
|
-
"react": ">=18",
|
|
49
|
-
"react-dom": ">=18"
|
|
73
|
+
"react": ">=18.2",
|
|
74
|
+
"react-dom": ">=18.2"
|
|
50
75
|
},
|
|
51
76
|
"devDependencies": {
|
|
77
|
+
"@axe-core/playwright": "4.14.0",
|
|
78
|
+
"@eslint/js": "9.39.5",
|
|
79
|
+
"@playwright/test": "1.56.1",
|
|
80
|
+
"@types/node": "26.6.5",
|
|
52
81
|
"@types/react": "^18",
|
|
53
82
|
"@types/react-dom": "^18",
|
|
83
|
+
"eslint": "9.39.5",
|
|
84
|
+
"eslint-plugin-react": "7.37.5",
|
|
85
|
+
"eslint-plugin-react-hooks": "7.1.1",
|
|
86
|
+
"next": "16.4.2",
|
|
54
87
|
"playwright": "1.56.1",
|
|
55
88
|
"react": "18.3.1",
|
|
89
|
+
"react-doctor": "0.9.18",
|
|
56
90
|
"react-dom": "18.3.1",
|
|
57
|
-
"typescript": "
|
|
91
|
+
"typescript": "6.0.3",
|
|
92
|
+
"typescript-eslint": "8.71.2"
|
|
58
93
|
},
|
|
59
94
|
"publishConfig": {
|
|
60
95
|
"registry": "https://registry.npmjs.org",
|
|
@@ -73,6 +108,15 @@
|
|
|
73
108
|
"bun": ">=1.4.3"
|
|
74
109
|
},
|
|
75
110
|
"dependencies": {
|
|
111
|
+
"motion": "14.3.0",
|
|
112
|
+
"prosemirror-commands": "1.7.2",
|
|
113
|
+
"prosemirror-history": "1.5.1",
|
|
114
|
+
"prosemirror-keymap": "1.2.3",
|
|
115
|
+
"prosemirror-markdown": "1.13.8",
|
|
116
|
+
"prosemirror-model": "1.25.12",
|
|
117
|
+
"prosemirror-schema-list": "1.5.1",
|
|
118
|
+
"prosemirror-state": "1.4.4",
|
|
119
|
+
"prosemirror-view": "1.42.6",
|
|
76
120
|
"radix-ui": "1.8.0"
|
|
77
121
|
}
|
|
78
122
|
}
|