@vokality/design-system 2.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +63 -3
  3. package/bin/vokality-skill.mjs +68 -0
  4. package/dist/browser.d.ts +13 -0
  5. package/dist/browser.js +7 -0
  6. package/dist/charts/chart.d.ts +6 -5
  7. package/dist/charts/chart.js +44 -25
  8. package/dist/chat.d.ts +54 -0
  9. package/dist/chat.js +1 -0
  10. package/dist/components/Accordion/Accordion.js +1 -1
  11. package/dist/components/Alert/Alert.js +5 -2
  12. package/dist/components/AppShell/AppShell.js +10 -14
  13. package/dist/components/Avatar/Avatar.js +2 -2
  14. package/dist/components/AvatarGroup/AvatarGroup.js +2 -2
  15. package/dist/components/BarChart/BarChart.js +17 -15
  16. package/dist/components/Breadcrumbs/Breadcrumbs.js +6 -3
  17. package/dist/components/Calendar/Calendar.js +6 -5
  18. package/dist/components/Card/Card.js +2 -3
  19. package/dist/components/ChatInbox/ChatInbox.d.ts +11 -0
  20. package/dist/components/ChatInbox/ChatInbox.js +49 -0
  21. package/dist/components/ChatPanel/ChatPanel.d.ts +3 -0
  22. package/dist/components/ChatPanel/ChatPanel.js +13 -0
  23. package/dist/components/ChatPanel/composer.d.ts +5 -0
  24. package/dist/components/ChatPanel/composer.js +32 -0
  25. package/dist/components/ChatPanel/transcript.d.ts +13 -0
  26. package/dist/components/ChatPanel/transcript.js +39 -0
  27. package/dist/components/ChatWidget/ChatWidget.d.ts +12 -0
  28. package/dist/components/ChatWidget/ChatWidget.js +42 -0
  29. package/dist/components/Checkbox/Checkbox.d.ts +5 -10
  30. package/dist/components/Checkbox/Checkbox.js +5 -19
  31. package/dist/components/CodeBlock/CodeBlock.js +19 -5
  32. package/dist/components/Combobox/Combobox.js +22 -15
  33. package/dist/components/Combobox/ListPanel.js +20 -9
  34. package/dist/components/CommandPalette/CommandPalette.js +33 -14
  35. package/dist/components/ContextMenu/ContextMenu.d.ts +2 -2
  36. package/dist/components/ContextMenu/ContextMenu.js +5 -50
  37. package/dist/components/DatePicker/DatePicker.js +35 -29
  38. package/dist/components/DescriptionList/DescriptionList.js +1 -1
  39. package/dist/components/Dialog/Dialog.d.ts +24 -7
  40. package/dist/components/Dialog/Dialog.js +30 -41
  41. package/dist/components/Drawer/Drawer.d.ts +4 -2
  42. package/dist/components/EmptyState/EmptyState.js +2 -2
  43. package/dist/components/ErrorSummary/ErrorSummary.js +5 -3
  44. package/dist/components/FaqList/FaqList.js +1 -1
  45. package/dist/components/Field/Field.js +2 -2
  46. package/dist/components/FileUpload/FileUpload.js +17 -9
  47. package/dist/components/Grid/Grid.d.ts +5 -5
  48. package/dist/components/Grid/Grid.js +1 -1
  49. package/dist/components/Heading/Heading.js +2 -1
  50. package/dist/components/Icon/Icon.js +4 -2
  51. package/dist/components/Inline/Inline.d.ts +7 -7
  52. package/dist/components/LineChart/LineChart.js +17 -15
  53. package/dist/components/LinkProvider/LinkProvider.d.ts +1 -1
  54. package/dist/components/LinkProvider/LinkProvider.js +6 -2
  55. package/dist/components/List/List.js +1 -1
  56. package/dist/components/MediaCard/MediaCard.js +2 -2
  57. package/dist/components/Menu/Menu.js +6 -43
  58. package/dist/components/Menu/entries.d.ts +1 -30
  59. package/dist/components/Menu/entries.js +16 -100
  60. package/dist/components/MultiSelect/MultiSelect.js +43 -34
  61. package/dist/components/NumberInput/NumberInput.js +17 -18
  62. package/dist/components/OtpInput/OtpInput.d.ts +1 -1
  63. package/dist/components/OtpInput/OtpInput.js +10 -67
  64. package/dist/components/PageHeader/PageHeader.js +2 -2
  65. package/dist/components/Pagination/Pagination.js +3 -1
  66. package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
  67. package/dist/components/PasswordInput/PasswordInput.js +9 -4
  68. package/dist/components/Popover/Popover.d.ts +6 -7
  69. package/dist/components/Popover/Popover.js +2 -19
  70. package/dist/components/Progress/Progress.d.ts +1 -1
  71. package/dist/components/Progress/Progress.js +7 -11
  72. package/dist/components/Radio/Radio.d.ts +4 -2
  73. package/dist/components/RadioGroup/RadioGroup.d.ts +5 -12
  74. package/dist/components/RadioGroup/RadioGroup.js +6 -33
  75. package/dist/components/RichTextEditor/RichTextEditor.d.ts +63 -0
  76. package/dist/components/RichTextEditor/RichTextEditor.js +175 -0
  77. package/dist/components/RichTextEditor/toolbar.d.ts +15 -0
  78. package/dist/components/RichTextEditor/toolbar.js +142 -0
  79. package/dist/components/RichTextEditor/uploads.d.ts +41 -0
  80. package/dist/components/RichTextEditor/uploads.js +124 -0
  81. package/dist/components/SearchInput/SearchInput.js +4 -2
  82. package/dist/components/SectionHeader/SectionHeader.js +1 -3
  83. package/dist/components/SegmentedControl/SegmentedControl.js +2 -12
  84. package/dist/components/Select/Select.d.ts +15 -16
  85. package/dist/components/Select/Select.js +11 -252
  86. package/dist/components/Slider/Slider.js +11 -21
  87. package/dist/components/Sparkline/Sparkline.js +8 -3
  88. package/dist/components/Spinner/Spinner.js +5 -2
  89. package/dist/components/Stack/Stack.d.ts +5 -5
  90. package/dist/components/Stat/Stat.js +6 -3
  91. package/dist/components/Steps/Steps.js +6 -3
  92. package/dist/components/Switch/Switch.d.ts +7 -7
  93. package/dist/components/Switch/Switch.js +4 -10
  94. package/dist/components/Table/Table.js +38 -19
  95. package/dist/components/Tabs/Tabs.js +2 -22
  96. package/dist/components/Tag/Tag.js +3 -1
  97. package/dist/components/Text/Text.d.ts +1 -1
  98. package/dist/components/TileGrid/TileGrid.js +1 -1
  99. package/dist/components/TimePicker/TimePicker.js +35 -33
  100. package/dist/components/Timeline/Timeline.js +5 -4
  101. package/dist/components/Toaster/Toaster.js +21 -17
  102. package/dist/components/Tooltip/Tooltip.d.ts +6 -6
  103. package/dist/components/Tooltip/Tooltip.js +3 -17
  104. package/dist/components/TreeView/TreeView.js +15 -12
  105. package/dist/components.css +179 -8
  106. package/dist/hooks/useTheme.js +6 -6
  107. package/dist/icons/message-circle.svg +1 -0
  108. package/dist/internal/CharCount.js +3 -1
  109. package/dist/internal/choice.d.ts +10 -48
  110. package/dist/internal/choice.js +8 -96
  111. package/dist/internal/options.d.ts +10 -5
  112. package/dist/internal/options.js +25 -11
  113. package/dist/internal/status.d.ts +3 -2
  114. package/dist/internal/status.js +10 -2
  115. package/dist/internal/useScrollActive.js +2 -2
  116. package/dist/internal/useToday.d.ts +3 -0
  117. package/dist/internal/useToday.js +42 -0
  118. package/dist/lib/dates.js +25 -15
  119. package/dist/lib/format.js +11 -8
  120. package/dist/lib/icons.d.ts +5 -0
  121. package/dist/lib/icons.js +2 -0
  122. package/dist/lib/math.js +17 -5
  123. package/dist/lib/rich-text.d.ts +13 -0
  124. package/dist/lib/rich-text.js +62 -0
  125. package/dist/lib/space.d.ts +1 -2
  126. package/dist/lib/space.js +4 -1
  127. package/dist/lib/text.js +1 -1
  128. package/dist/lib/theme.js +1 -1
  129. package/dist/localization.d.ts +166 -0
  130. package/dist/localization.js +142 -0
  131. package/dist/vokality.css +179 -8
  132. package/dist/vokality.iife.js +35986 -9685
  133. package/docs/brand.md +6 -3
  134. package/docs/components/AppShell/README.md +1 -1
  135. package/docs/components/BarChart/README.md +1 -0
  136. package/docs/components/ChatInbox/README.md +41 -0
  137. package/docs/components/ChatWidget/README.md +47 -0
  138. package/docs/components/Checkbox/README.md +7 -3
  139. package/docs/components/ContextMenu/README.md +7 -3
  140. package/docs/components/Dialog/README.md +9 -4
  141. package/docs/components/Drawer/README.md +1 -1
  142. package/docs/components/Field/README.md +1 -1
  143. package/docs/components/Fieldset/README.md +2 -2
  144. package/docs/components/LineChart/README.md +1 -0
  145. package/docs/components/LocaleProvider/README.md +48 -0
  146. package/docs/components/Menu/README.md +13 -8
  147. package/docs/components/OtpInput/README.md +9 -5
  148. package/docs/components/PasswordInput/README.md +11 -2
  149. package/docs/components/Popover/README.md +6 -3
  150. package/docs/components/Progress/README.md +3 -1
  151. package/docs/components/RadioGroup/README.md +5 -2
  152. package/docs/components/RichTextEditor/README.md +84 -0
  153. package/docs/components/SegmentedControl/README.md +2 -0
  154. package/docs/components/Select/README.md +13 -17
  155. package/docs/components/Skeleton/README.md +1 -1
  156. package/docs/components/Slider/README.md +4 -2
  157. package/docs/components/Steps/README.md +1 -1
  158. package/docs/components/Switch/README.md +5 -2
  159. package/docs/components/Tabs/README.md +4 -2
  160. package/docs/components/Toaster/README.md +3 -1
  161. package/docs/components/Tooltip/README.md +5 -3
  162. package/package.json +55 -6
  163. package/skills/vokality-design-system/SKILL.md +55 -0
  164. package/skills/vokality-design-system/references/examples.tsx +103 -0
@@ -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
- ## Keyboard
24
- | Key | Closed | Open |
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
- Mouse: press on the trigger to open, click an option to choose it, click outside (or on the trigger) to close. While the list is open the rest of the page doesn't take clicks or scroll, as with a native select.
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 returns focus to the trigger at once. Inside a `Field`, the label names the control and clicking the label focuses it without opening it.
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. Without it, the first option is chosen up front.
42
- - `value` + `onChange(value, option)` to control it, or `defaultValue`. `value={null}` clears it to the placeholder. Any option value works, `""` included. `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.
43
- - `name`: adds a hidden input so the value posts with a regular form.
44
- - `disabled`, `required` (sets `aria-required`; validate in your submit handler and show the message through `Field` `error`), `aria-label` when there is no `Field`.
45
- - `defaultOpen`: starts open (for documentation and tests).
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
- `card` fill, square, with a faint `foreground` 5% shimmer moving left every 1.4s (still under reduced motion).
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 a tenth of the range; Home / End jump to the ends. Clicking the track jumps there; dragging follows the pointer.
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, or vertically with `orientation="vertical"`.
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`, `onChange`, `disabled`, `name`, `value`, `hideLabel`.
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
- - `onChange` receives a change event whose `target` reads `checked`, `value` and `name` as a native checkbox would. The ref (and any `Tooltip` or `Popover` around it) gets the switch.
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`). Every panel stays in the DOM (hidden unless selected) so each `aria-controls` resolves; only the selected one renders its content unless `keepMounted`.
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` (default: the first tab). `onChange(id)` runs when the selection changes. `label` (the list's accessible name). `keepMounted` keeps hidden panels rendered.
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.
@@ -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
- - The timer pauses while the pointer is over the stack, focus is inside it, or the window is in the background.
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. Moving straight to another tooltip within 300ms shows it at once.
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
- On touch screens a tap on the trigger runs its action and shows the tooltip for 1.5 seconds (`touchDuration`). Nothing essential may live only in a tooltip.
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": "2.0.0",
3
+ "version": "3.0.1",
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,14 +30,28 @@
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",
29
49
  "README.md",
30
50
  "CHANGELOG.md",
31
51
  "docs/brand.md",
32
- "docs/components/*/README.md"
52
+ "docs/components/*/README.md",
53
+ "skills",
54
+ "bin/vokality-skill.mjs"
33
55
  ],
34
56
  "sideEffects": [
35
57
  "*.css"
@@ -38,23 +60,38 @@
38
60
  "build": "bun scripts/build.mjs",
39
61
  "test": "bun run build && bun test test/",
40
62
  "test:browser": "bun run build && bun test --timeout 30000 e2e/",
63
+ "test:visual": "bun run build && bunx playwright test -c validation/playwright.config.mjs",
64
+ "test:visual:update": "bun run build && bunx playwright test -c validation/playwright.config.mjs --update-snapshots",
65
+ "test:next": "bun run build && bun scripts/test-next.mjs build && VK_NEXT=1 bunx playwright test -c validation/playwright.config.mjs",
41
66
  "typecheck": "tsc -p tsconfig.json",
67
+ "lint": "eslint src --max-warnings 0",
68
+ "doctor": "react-doctor --yes --scope full --blocking warning --no-supply-chain --no-score",
42
69
  "preview": "bun run build && bun scripts/preview.mjs",
43
70
  "artifact": "bun run build && bun scripts/build-artifact.mjs",
44
71
  "prepack": "bun run build",
45
72
  "verify:docs": "bun scripts/verify-docs-page.mjs"
46
73
  },
47
74
  "peerDependencies": {
48
- "react": ">=18",
49
- "react-dom": ">=18"
75
+ "react": ">=18.2",
76
+ "react-dom": ">=18.2"
50
77
  },
51
78
  "devDependencies": {
79
+ "@axe-core/playwright": "4.14.0",
80
+ "@eslint/js": "9.39.5",
81
+ "@playwright/test": "1.56.1",
82
+ "@types/node": "26.6.5",
52
83
  "@types/react": "^18",
53
84
  "@types/react-dom": "^18",
85
+ "eslint": "9.39.5",
86
+ "eslint-plugin-react": "7.37.5",
87
+ "eslint-plugin-react-hooks": "7.1.1",
88
+ "next": "16.4.2",
54
89
  "playwright": "1.56.1",
55
90
  "react": "18.3.1",
91
+ "react-doctor": "0.9.18",
56
92
  "react-dom": "18.3.1",
57
- "typescript": "^7.0.2"
93
+ "typescript": "6.0.3",
94
+ "typescript-eslint": "8.71.2"
58
95
  },
59
96
  "publishConfig": {
60
97
  "registry": "https://registry.npmjs.org",
@@ -73,6 +110,18 @@
73
110
  "bun": ">=1.4.3"
74
111
  },
75
112
  "dependencies": {
113
+ "motion": "14.3.0",
114
+ "prosemirror-commands": "1.7.2",
115
+ "prosemirror-history": "1.5.1",
116
+ "prosemirror-keymap": "1.2.3",
117
+ "prosemirror-markdown": "1.13.8",
118
+ "prosemirror-model": "1.25.12",
119
+ "prosemirror-schema-list": "1.5.1",
120
+ "prosemirror-state": "1.4.4",
121
+ "prosemirror-view": "1.42.6",
76
122
  "radix-ui": "1.8.0"
123
+ },
124
+ "bin": {
125
+ "vokality-skill": "./bin/vokality-skill.mjs"
77
126
  }
78
127
  }
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: vokality-design-system
3
+ description: Build and update Vokality interfaces with the installed @vokality/design-system package. Use for component selection, layouts, forms, themes, localization, rich-text editing, and chat surfaces in projects using this package or explicitly requesting Vokality styling.
4
+ ---
5
+
6
+ # Vokality design system
7
+
8
+ Use the installed package's components and visual language within the user's requested scope. Keep the application's framework, router, data ownership, and existing conventions unless the task requires changing them.
9
+
10
+ ## Start with the installed contract
11
+
12
+ If this skill was registered through a symlink, resolve its physical directory in the installed package before following relative links. The `../../README.md` and `../../docs/` paths below are relative to that real skill directory, not the application's `.agents/skills` directory.
13
+
14
+ 1. Read the relevant sections of the [package README](../../README.md) and [brand guide](../../docs/brand.md).
15
+ 2. Find the component in the README, then read its `../../docs/components/ComponentName/README.md`. Check the installed public declarations for exact props and ref types before coding; component-specific contracts take precedence over broad descriptions in the brand guide.
16
+ 3. Compose existing components before creating a new control. Use `Stack`, `Inline`, and `Grid` for layout; `Heading` and `Text` for interface copy; `Prose` for rendered long-form content. Use semantic `as` elements where appropriate.
17
+
18
+ Do not deep-import `src/` or `dist/`, invent props from another component library, or add a parallel UI kit to implement an existing component. The examples in [references/examples.tsx](references/examples.tsx) compile against the public package API; read them when implementing forms, Markdown editing, or conversations.
19
+
20
+ ## Imports and presentation
21
+
22
+ - Import `@vokality/design-system/vokality.css` once at the application's stylesheet entry. Core components and their prop types come from `@vokality/design-system`.
23
+ - Use the direct entrypoints `@vokality/design-system/localization`, `@vokality/design-system/rich-text`, `@vokality/design-system/chat-widget`, `@vokality/design-system/chat-inbox`, and `@vokality/design-system/chat-models` for those features. Keep type imports explicit. These features are not root exports.
24
+ - Use existing tokens such as `var(--background)`, `var(--foreground)`, `var(--primary)`, `var(--border-subtle)`, and `var(--space-lg)` for application CSS. Prefer component variants and layout props over overriding internal selectors. Corners are square, surfaces have thin outlines, and orange identifies the primary action or selection. Avoid decorative shadows and gradients.
25
+ - Write labels in sentence case; styles provide uppercase presentation. Use the supplied icons and accessible labels. User-authored emoji belong in rich text; interface copy follows the brand guide.
26
+ - Preserve the current theme preference. Themes are `dark`, `light`, and `contrast` through `data-theme`; compact density uses `data-density="compact"`. Put attributes on `html` when portalled content must inherit them. Use [ThemeScript and useTheme](../../docs/components/ThemeScript/README.md) when adding theme switching, with matching options for server initialization and client changes.
27
+ - In Tailwind v4 applications, follow the README's stylesheet order and token mapping. Do not introduce Tailwind or replace the application's styling setup merely to use the package.
28
+
29
+ ## Behavior, forms, and React
30
+
31
+ The fully supplied Radix controls already own keyboard interaction, focus, selection, dismissal, gestures, timers, and native form integration. Compose and style them through their public props. Do not add a second keyboard/focus engine, synthetic input-event targets, or wrapper-owned default-selection policy. Composite controls such as `Combobox` and `DatePicker` already compose their required behavior too; use their documented APIs.
32
+
33
+ - [Checkbox](../../docs/components/Checkbox/README.md) uses `onCheckedChange(boolean | "indeterminate")`; [Switch](../../docs/components/Switch/README.md) uses `onCheckedChange(boolean)`. Their refs and DOM callbacks target buttons, not native checkbox inputs. Map state explicitly only when the application's domain requires it.
34
+ - [RadioGroup](../../docs/components/RadioGroup/README.md) uses `onValueChange(string)`, `Select` uses `onChange(value, option)`, and `SegmentedControl` uses `onChange(value)`. Supply `value` or `defaultValue` when selection is intended. Native `Input` and standalone `Radio` keep native input events.
35
+ - [Field](../../docs/components/Field/README.md) labels one control and wires its ID, hint, and error attributes. Checkbox and Switch provide their own labels; RadioGroup provides a legend. Give form controls names and use their documented `required` and `disabled` props. Submit through the form's native event and `FormData`; a save action needs `type="submit"` because `Button` defaults to `button`.
36
+ - Choose controlled `value` plus its change callback, or uncontrolled `defaultValue`; do not synchronize both through an effect. Keep handlers and stateful composition in the framework's client boundary. Preserve React 18.2+ compatibility, server-safe rendering, and actual DOM ref types. Do not access browser globals or read/write refs during render.
37
+ - For server-rendered Calendar/DatePicker output, pass the same explicit `today` value on server and client when their day or time zone may differ. Read the component docs for date-string and locale contracts.
38
+
39
+ ## Locale and content ownership
40
+
41
+ Use [LocaleProvider](../../docs/components/LocaleProvider/README.md) from the localization entrypoint for built-in labels and formatting. It supports scoped, typed message overrides and reaches portals. Explicit label props remain application copy. Keep placeholders, custom emoji labels, and server-provided content in the application's language. Use the exported formatting helpers rather than constructing localized number or date strings by hand.
42
+
43
+ For [RichTextEditor](../../docs/components/RichTextEditor/README.md), store a CommonMark Markdown string. `value`/`onChange` are Markdown, not HTML or editor JSON; serialization may normalize equivalent syntax. Use `toolbar="minimal"` for a small writing-first composer when appropriate. The application owns persistence and rendering saved Markdown; `Prose` supplies reading styles, not a parser.
44
+
45
+ Attachments are opt-in through `onUploadAttachment(file, { signal })`, returning a durable `{ name, url }`. Reuse the application's upload service, validate unknown responses at that service boundary, honor cancellation, and enforce upload policy on the server. The editor handles upload feedback, cancel/retry, safe URL checks, and Markdown links. Removing a link does not delete its server asset. Use `onUploadPendingChange` when an external send action must wait for uploads.
46
+
47
+ For [ChatWidget](../../docs/components/ChatWidget/README.md) and [ChatInbox](../../docs/components/ChatInbox/README.md), supply typed `ChatMessage`/`ChatThread` data with stable IDs. Message `content` is a render-ready React node; a string displays as text. Use the application's established safe Markdown renderer if formatted incoming content is needed. The composer emits Markdown.
48
+
49
+ `composer.onSend` synchronously accepts a draft; the application owns async transport, streaming, pending/error state, retry callbacks, and persistence. An uncontrolled draft clears after normal callback return. Clear a controlled draft explicitly after application acceptance. Inbox selection is controlled, Back emits `null`, and switching threads resets uncontrolled drafts and cancels pending uploads. Keep controlled drafts by thread ID if navigation must preserve them. Do not invent an AI backend or upload endpoint for a presentation task.
50
+
51
+ ## Motion and verification
52
+
53
+ Keep the package's existing motion and reduced-motion handling. Chat already uses Motion for panel entry/exit and newly added messages while Radix retains interaction ownership. Avoid animating existing history, stacking a second transition on an overlay, or adding timers to retain content. Any requested application motion should be brief and stop under reduced motion.
54
+
55
+ Run the host application's relevant type, lint, and behavioral checks. Verify changed UI at its narrow container size and with long real content, keyboard focus, disabled/loading/error states, and the themes or density affected by the task. Check portalled content and short viewport containment when changing overlays. Keep verification proportional to the change; do not expand a component task into an application rewrite.
@@ -0,0 +1,103 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+ import { Button, Checkbox, Field, Input, RadioGroup, Stack, Switch } from "@vokality/design-system";
5
+ import { LocaleProvider } from "@vokality/design-system/localization";
6
+ import { RichTextEditor } from "@vokality/design-system/rich-text";
7
+ import type { RichTextUpload } from "@vokality/design-system/rich-text";
8
+ import { ChatWidget } from "@vokality/design-system/chat-widget";
9
+ import { ChatInbox } from "@vokality/design-system/chat-inbox";
10
+ import type { ChatComposerOptions, ChatMessage, ChatThread } from "@vokality/design-system/chat-models";
11
+
12
+ // Import @vokality/design-system/vokality.css once in the application entry.
13
+ // Upload and persistence callbacks below belong to the application, not the UI.
14
+ interface NotesFormProps {
15
+ initialMarkdown: string;
16
+ uploadAttachment?: RichTextUpload;
17
+ onSave: (data: FormData) => void;
18
+ }
19
+
20
+ export function NotesForm({ initialMarkdown, uploadAttachment, onSave }: NotesFormProps) {
21
+ const [markdown, setMarkdown] = useState(initialMarkdown);
22
+ const [notify, setNotify] = useState(false);
23
+ const [uploadPending, setUploadPending] = useState(false);
24
+ return (
25
+ <LocaleProvider locale="en-US">
26
+ <Stack as="form" gap="lg" onSubmit={(event) => {
27
+ event.preventDefault();
28
+ if (uploadPending) return;
29
+ onSave(new FormData(event.currentTarget));
30
+ }}>
31
+ <Field label="Subject">
32
+ <Input name="subject" required />
33
+ </Field>
34
+ <Field label="Notes" hint="Formatting and attachments are saved as Markdown.">
35
+ <RichTextEditor name="notes" value={markdown} onChange={setMarkdown} onUploadAttachment={uploadAttachment} onUploadPendingChange={setUploadPending} />
36
+ </Field>
37
+ <RadioGroup label="Visibility" name="visibility" defaultValue="team" options={[
38
+ { value: "team", label: "Team" },
39
+ { value: "private", label: "Only me" },
40
+ ]} />
41
+ <Checkbox label="Notify the team" name="notify" checked={notify} onCheckedChange={(next) => {
42
+ // This domain is binary. Preserve "indeterminate" in domains that need it.
43
+ setNotify(next === true);
44
+ }} />
45
+ <Button type="submit" disabled={uploadPending}>Save notes</Button>
46
+ </Stack>
47
+ </LocaleProvider>
48
+ );
49
+ }
50
+
51
+ // Switch applies an immediate setting through its boolean callback.
52
+ export function EmailSetting({ enabled, onChange }: { enabled: boolean; onChange: (enabled: boolean) => void }) {
53
+ return <Switch label="Weekly summary email" checked={enabled} onCheckedChange={onChange} />;
54
+ }
55
+
56
+ interface SupportWidgetProps {
57
+ messages: readonly ChatMessage[];
58
+ sending: boolean;
59
+ // Accept synchronously; the application manages the eventual transport result.
60
+ acceptMessage: (markdown: string) => void;
61
+ retryMessage: (messageId: string) => void;
62
+ uploadAttachment?: RichTextUpload;
63
+ }
64
+
65
+ export function SupportWidget({ messages, sending, acceptMessage, retryMessage, uploadAttachment }: SupportWidgetProps) {
66
+ const [draft, setDraft] = useState("");
67
+ return (
68
+ <ChatWidget title="Support" messages={messages} onRetryMessage={retryMessage} composer={{
69
+ value: draft,
70
+ onChange: setDraft,
71
+ sending,
72
+ onUploadAttachment: uploadAttachment,
73
+ onSend(markdown) {
74
+ acceptMessage(markdown);
75
+ // A controlled draft clears only when the application acknowledges it.
76
+ setDraft("");
77
+ },
78
+ }} />
79
+ );
80
+ }
81
+
82
+ interface SupportInboxProps {
83
+ threads: readonly ChatThread[];
84
+ selectedThreadId: string | null;
85
+ onSelectThread: (threadId: string | null) => void;
86
+ // These messages and this composer must belong to the selected thread.
87
+ messages: readonly ChatMessage[];
88
+ // Supply value/onChange backed by thread IDs to preserve drafts on navigation.
89
+ composer: ChatComposerOptions;
90
+ retryMessage: (messageId: string) => void;
91
+ }
92
+
93
+ export function SupportInbox({ threads, selectedThreadId, onSelectThread, messages, composer, retryMessage }: SupportInboxProps) {
94
+ return <ChatInbox title="Inbox" threads={threads} selectedThreadId={selectedThreadId} onSelectThread={onSelectThread} messages={messages} composer={composer} onRetryMessage={retryMessage} />;
95
+ }
96
+
97
+ // content is ready to render. A Markdown string here would display as text.
98
+ export const welcomeMessage: ChatMessage = {
99
+ id: "support-welcome",
100
+ direction: "incoming",
101
+ author: { name: "Support" },
102
+ content: <p>What can we help you with?</p>,
103
+ };