@aleph-alpha/ui-library 5.3.1 → 5.5.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.
Files changed (109) hide show
  1. package/config.d.ts +38 -3
  2. package/config.js +103 -6
  3. package/dist/system/lib.js +8926 -8768
  4. package/dist/system/patterns/UiDataTable/UiDataTableFilterMenu.vue.d.ts +24 -0
  5. package/dist/system/patterns/UiDataTable/constants.d.ts +10 -0
  6. package/dist/system/patterns/UiDataTable/index.d.ts +1 -0
  7. package/dist/system/patterns/UiDataTable/types.d.ts +23 -1
  8. package/dist/system/patterns/UiFloatActions/UiFloatActionItems.vue.d.ts +173 -2
  9. package/dist/system/patterns/UiFloatActions/floatActionItemContext.d.ts +15 -1
  10. package/dist/system/patterns/UiFloatActions/types.d.ts +25 -1
  11. package/dist/system/story-sidebar-icons.json +5 -1
  12. package/docs/public-docs/getting-started-designers.md +3 -1
  13. package/package.json +5 -3
  14. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +2 -1
  15. package/src/components/UiAutocomplete/UiAutocomplete.vue +5 -5
  16. package/src/components/UiButton/UiButton.stories.ts +14 -14
  17. package/src/components/UiCheckbox/UiCheckbox.stories.ts +260 -9
  18. package/src/components/UiCheckbox/__tests__/UiCheckbox.test.ts +3 -18
  19. package/src/components/UiChip/UiChip.vue +1 -1
  20. package/src/components/UiDrawer/UiDrawer.stories.ts +2 -2
  21. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
  22. package/src/components/UiEmpty/UiEmpty.vue +2 -2
  23. package/src/components/UiField/UiField.stories.ts +610 -3
  24. package/src/components/UiField/UiFieldDescription.vue +7 -2
  25. package/src/components/UiField/UiFieldLabelInfo.vue +1 -1
  26. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +2 -2
  27. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +2 -2
  28. package/src/components/UiInput/UiInput.stories.ts +336 -2
  29. package/src/components/UiInput/UiInput.vue +3 -3
  30. package/src/components/UiInput/__tests__/UiInput.test.ts +20 -28
  31. package/src/components/UiItem/UiItem.stories.ts +236 -1
  32. package/src/components/UiItem/__tests__/UiItem.test.ts +11 -72
  33. package/src/components/UiKbd/UiKbd.stories.ts +14 -14
  34. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +42 -42
  35. package/src/components/UiPopover/UiPopover.stories.ts +6 -6
  36. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +2 -2
  37. package/src/components/UiResizable/UiResizable.stories.ts +6 -5
  38. package/src/components/UiSeparator/UiSeparator.stories.ts +6 -6
  39. package/src/components/UiSheet/UiSheet.stories.ts +2 -2
  40. package/src/components/UiSlider/UiSlider.stories.ts +8 -8
  41. package/src/components/UiSnackbar/UiSnackbar.stories.ts +6 -6
  42. package/src/components/UiSnackbar/UiSnackbar.vue +4 -4
  43. package/src/components/UiSnackbar/UiSnackbarContent.vue +4 -4
  44. package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
  45. package/src/components/UiSwitch/UiSwitch.stories.ts +2 -2
  46. package/src/components/UiTabs/UiTabs.stories.ts +30 -30
  47. package/src/components/UiToggle/__tests__/UiToggle.test.ts +5 -3
  48. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +9 -9
  49. package/src/components/UiTooltip/UiTooltip.stories.ts +3 -3
  50. package/src/components/core/accordion/AccordionTrigger.vue +2 -2
  51. package/src/components/core/alert/AlertDescription.vue +1 -1
  52. package/src/components/core/badge/index.ts +1 -1
  53. package/src/components/core/button/index.ts +2 -2
  54. package/src/components/core/calendar/CalendarCellTrigger.vue +2 -2
  55. package/src/components/core/calendar/CalendarHeadCell.vue +1 -1
  56. package/src/components/core/card/CardDescription.vue +1 -1
  57. package/src/components/core/checkbox/Checkbox.vue +1 -2
  58. package/src/components/core/drawer/DrawerDescription.vue +1 -1
  59. package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
  60. package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +1 -1
  61. package/src/components/core/field/FieldDescription.vue +1 -1
  62. package/src/components/core/field/FieldLabel.vue +1 -1
  63. package/src/components/core/field/FieldSeparator.vue +1 -1
  64. package/src/components/core/input/Input.vue +2 -2
  65. package/src/components/core/item/index.ts +1 -1
  66. package/src/components/core/kbd/Kbd.vue +1 -1
  67. package/src/components/core/listbox/ListboxFilter.vue +1 -1
  68. package/src/components/core/listbox/ListboxGroupLabel.vue +4 -1
  69. package/src/components/core/listbox/ListboxItem.vue +1 -1
  70. package/src/components/core/native-select/NativeSelect.vue +3 -3
  71. package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
  72. package/src/components/core/navigation-menu/index.ts +1 -1
  73. package/src/components/core/radio-group/RadioGroupItem.vue +1 -1
  74. package/src/components/core/range-calendar/RangeCalendarCellTrigger.vue +2 -2
  75. package/src/components/core/range-calendar/RangeCalendarHeadCell.vue +1 -1
  76. package/src/components/core/select/SelectItem.vue +1 -1
  77. package/src/components/core/select/SelectLabel.vue +4 -1
  78. package/src/components/core/select/SelectTrigger.vue +1 -1
  79. package/src/components/core/sheet/SheetDescription.vue +3 -1
  80. package/src/components/core/switch/Switch.vue +1 -1
  81. package/src/components/core/table/TableCaption.vue +3 -1
  82. package/src/components/core/tabs/TabsList.vue +1 -1
  83. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  84. package/src/components/core/tags-input/TagsInput.vue +1 -1
  85. package/src/components/core/tags-input/TagsInputInput.vue +1 -1
  86. package/src/components/core/tags-input/TagsInputItemDelete.vue +1 -1
  87. package/src/components/core/textarea/Textarea.vue +1 -1
  88. package/src/components/core/toggle/index.ts +3 -3
  89. package/src/components/core/toggle-group/index.ts +2 -2
  90. package/src/lib/useDrag.stories.ts +8 -8
  91. package/src/patterns/UiDataTable/UiDataTable.stories.ts +913 -16
  92. package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +1 -1
  93. package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +91 -0
  94. package/src/patterns/UiDataTable/UiDataTablePagination.vue +1 -1
  95. package/src/patterns/UiDataTable/__tests__/UiDataTable.test.ts +7 -184
  96. package/src/patterns/UiDataTable/constants.ts +12 -0
  97. package/src/patterns/UiDataTable/index.ts +1 -0
  98. package/src/patterns/UiDataTable/types.ts +24 -0
  99. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +4 -4
  100. package/src/patterns/UiDatePicker/UiDatePicker.vue +1 -1
  101. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +140 -12
  102. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +1231 -438
  103. package/src/patterns/UiFloatActions/UiFloatActions.vue +1 -1
  104. package/src/patterns/UiFloatActions/__tests__/UiFloatActionItems.test.ts +46 -24
  105. package/src/patterns/UiFloatActions/floatActionItemContext.ts +16 -1
  106. package/src/patterns/UiFloatActions/types.ts +28 -1
  107. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +2 -2
  108. package/src/components/UiField/__tests__/UiFieldError.test.ts +0 -39
  109. package/src/patterns/UiFloatActions/__tests__/UiFloatActions.a11y.test.ts +0 -152
package/config.d.ts CHANGED
@@ -225,9 +225,35 @@ export declare const presetUiLibraryThemeFromTokens: (
225
225
  ) => Preset;
226
226
 
227
227
  /**
228
- * UnoCSS preset with utility rules required by the UI library's components.
229
- * Adds Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
230
- * that preset-wind4 does not yet support.
228
+ * UnoCSS preset with utility rules and preflight classes required by the UI
229
+ * library's components.
230
+ *
231
+ * Adds Tailwind v4 CSS variable syntax (`w-(--var)`, `h-(--var)`, etc.) that
232
+ * preset-wind4 does not yet support, plus the shared focus and hover helpers.
233
+ *
234
+ * ## Focus utilities
235
+ *
236
+ * The library exposes one canonical focus style so every focusable component
237
+ * looks identical. Prefer these over ad-hoc `focus-visible:ring-*` recipes.
238
+ *
239
+ * - `ui-focus-ring` — apply to a focusable element (button, link, input,
240
+ * checkbox, switch, tab, menu item, etc.). On `:focus-visible` it sets the
241
+ * border color to `border/surface/focus-ring` and draws a 2px ring in the
242
+ * focus-ring color at 50% opacity. Give the element a border so the border
243
+ * color can show, e.g. `border border-transparent`.
244
+ * - `ui-focus-ring-within` — same visual, but triggered on `:focus-within`.
245
+ * Apply to container controls that wrap the real focusable element (text
246
+ * field wrappers, tag inputs, comboboxes).
247
+ *
248
+ * Both are namespaced with the `ui-` prefix on purpose: an unprefixed
249
+ * `focus-ring` would be parsed by UnoCSS as the `focus:` variant of the `ring`
250
+ * utility and emit an unintended `.focus-ring:focus` rule.
251
+ *
252
+ * @example
253
+ * ```html
254
+ * <button class="ui-focus-ring border border-transparent">Save</button>
255
+ * <div class="ui-focus-ring-within border border-input"><input /></div>
256
+ * ```
231
257
  */
232
258
  export declare const presetUiLibraryUtils: () => Preset;
233
259
 
@@ -278,6 +304,15 @@ export declare const getSparkTokenPresetWithoutUiLibraryTypography: () => Preset
278
304
  * Combines theme customization with additional UnoCSS config.
279
305
  */
280
306
  export interface UiLibraryConfigOptions extends UiLibraryPresetOptions {
307
+ /**
308
+ * Include the legacy Spark design-system token preset (emits `--core-*`,
309
+ * `--brand-*`, `--semantic-*`, `--primitives-*` plus Spark spacing/shadow
310
+ * vars and utilities). Enabled by default for coexistence with
311
+ * `ds-components-vue`. Pure ui-library apps can set this to `false` so only
312
+ * ui-library theme tokens are emitted.
313
+ * @default true
314
+ */
315
+ includeSparkTokens?: boolean;
281
316
  /** Additional UnoCSS presets to append after the built-in ones */
282
317
  presets?: Preset[];
283
318
  /** Additional UnoCSS rules */
package/config.js CHANGED
@@ -646,6 +646,9 @@ const getBorderRadiusExactUtilityRules = () => {
646
646
  const className = key === 'DEFAULT' ? 'rounded' : `rounded-${key}`;
647
647
  entries.push([className, { 'border-radius': value }]);
648
648
  }
649
+ // Manual intermediate radius between the `xl` and `2xl` tokens; not sourced
650
+ // from Figma, so it's declared here rather than in tokens.json.
651
+ entries.push(['rounded-xl-2xl', { 'border-radius': '1.375rem' }]);
649
652
  return entriesToRules(entries);
650
653
  };
651
654
 
@@ -773,6 +776,13 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
773
776
  const darkSelector = options.darkSelector ?? 'html.dark';
774
777
  const rootFontSize = normalizeRootFontSize(options.rootFontSize);
775
778
 
779
+ // preset-wind4 registers these `--un-*` variables via `@property` and relies
780
+ // on their `initial-value`. That fallback is not honored everywhere (notably
781
+ // web-component shadow roots), so the composed `box-shadow` and `ring`
782
+ // utilities reference undefined variables and the whole declaration is
783
+ // dropped. Reset the base layers here (matching Tailwind's own defaults) so
784
+ // `shadow-*` and `ring-*` render reliably; the utilities still override these
785
+ // per element.
776
786
  const opacityDefaults = `
777
787
  *,
778
788
  ::before,
@@ -782,6 +792,15 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
782
792
  --un-border-opacity: 1;
783
793
  --un-ring-opacity: 1;
784
794
  --un-shadow-opacity: 1;
795
+ --un-shadow: 0 0 #0000;
796
+ --un-inset-shadow: 0 0 #0000;
797
+ --un-inset-ring-shadow: 0 0 #0000;
798
+ --un-ring-offset-shadow: 0 0 #0000;
799
+ --un-ring-shadow: 0 0 #0000;
800
+ --un-ring-offset-width: 0px;
801
+ --un-ring-offset-color: #0000;
802
+ --un-ring-inset: ;
803
+ --un-ring-color: currentColor;
785
804
  }`.trim();
786
805
 
787
806
  const toCssBlock = (selector, vars, extraDeclarations = []) => {
@@ -1103,12 +1122,84 @@ const vHoverOverlayCSS = `
1103
1122
  transition: none;
1104
1123
  }
1105
1124
  }
1125
+ /* Shared focus-visible style for every focusable component. Reproduces the
1126
+ exact UiButton focus treatment:
1127
+ outline-none
1128
+ focus-visible:border-border-surface-focus-ring
1129
+ focus-visible:ring-ring/50 focus-visible:ring-[3px]
1130
+ i.e. the border switches to border/surface/focus-ring and a 3px ring in the
1131
+ focus-ring color at 50% opacity is drawn around it. Add the single
1132
+ "ui-focus-ring" class to any focusable element (give it a border so the
1133
+ border color can show, e.g. "border border-transparent").
1134
+
1135
+ NOTE: the class is namespaced ("ui-focus-ring", not "focus-ring") because
1136
+ UnoCSS treats "-" as a variant separator, so "focus-ring" would be parsed as
1137
+ the "focus:" variant applied to the "ring" utility and emit an unwanted
1138
+ ".focus-ring:focus" rule with the ring box-shadow. */
1139
+ .ui-focus-ring {
1140
+ outline: none;
1141
+ transition:
1142
+ box-shadow 0.15s ease,
1143
+ border-color 0.15s ease;
1144
+ }
1145
+ .ui-focus-ring:focus-visible {
1146
+ outline: none;
1147
+ border-color: oklch(var(--border-surface-focus-ring));
1148
+ box-shadow: 0 0 0 2px oklch(var(--ring) / 0.5);
1149
+ }
1150
+ /* Companion for container/wrapper controls (text field wrappers, tag inputs,
1151
+ comboboxes) that surface the ring when any descendant is focused. Same visual
1152
+ as "ui-focus-ring", triggered on :focus-within instead of :focus-visible. */
1153
+ .ui-focus-ring-within {
1154
+ outline: none;
1155
+ transition:
1156
+ box-shadow 0.15s ease,
1157
+ border-color 0.15s ease;
1158
+ }
1159
+ .ui-focus-ring-within:focus-within {
1160
+ outline: none;
1161
+ border-color: oklch(var(--border-surface-focus-ring));
1162
+ box-shadow: 0 0 0 2px oklch(var(--ring) / 0.5);
1163
+ }
1164
+ @media (prefers-reduced-motion: reduce) {
1165
+ .ui-focus-ring,
1166
+ .ui-focus-ring-within {
1167
+ transition: none;
1168
+ }
1169
+ }
1106
1170
  `.trim();
1107
1171
 
1108
1172
  /**
1109
- * UnoCSS preset with utility rules required by the UI library's components.
1110
- * Adds Tailwind v4 CSS variable syntax (w-(--var), h-(--var), etc.)
1111
- * that preset-wind4 does not yet support.
1173
+ * UnoCSS preset with utility rules and preflight classes required by the UI
1174
+ * library's components.
1175
+ *
1176
+ * Adds Tailwind v4 CSS variable syntax (`w-(--var)`, `h-(--var)`, etc.) that
1177
+ * preset-wind4 does not yet support, plus the shared focus and hover helpers.
1178
+ *
1179
+ * ## Focus utilities
1180
+ *
1181
+ * The library exposes one canonical focus style so every focusable component
1182
+ * looks identical. Prefer these over ad-hoc `focus-visible:ring-*` recipes.
1183
+ *
1184
+ * - `ui-focus-ring` — apply to a focusable element (button, link, input,
1185
+ * checkbox, switch, tab, menu item, etc.). On `:focus-visible` it sets the
1186
+ * border color to `border/surface/focus-ring` and draws a 2px ring in the
1187
+ * focus-ring color at 50% opacity. Give the element a border so the border
1188
+ * color can show, e.g. `border border-transparent`.
1189
+ * - `ui-focus-ring-within` — same visual, but triggered on `:focus-within`.
1190
+ * Apply to container controls that wrap the real focusable element (text
1191
+ * field wrappers, tag inputs, comboboxes).
1192
+ *
1193
+ * Both are namespaced with the `ui-` prefix on purpose: an unprefixed
1194
+ * `focus-ring` would be parsed by UnoCSS as the `focus:` variant of the `ring`
1195
+ * utility and emit an unintended `.focus-ring:focus` rule.
1196
+ *
1197
+ * @example
1198
+ * ```html
1199
+ * <button class="ui-focus-ring border border-transparent">Save</button>
1200
+ * <div class="ui-focus-ring-within border border-input"><input /></div>
1201
+ * ```
1202
+ *
1112
1203
  * @returns {import('unocss').Preset} UnoCSS utility preset for ui-library components.
1113
1204
  */
1114
1205
  export const presetUiLibraryUtils = () =>
@@ -1167,6 +1258,7 @@ export const defineUiLibraryConfig = (options = {}) => {
1167
1258
  extend,
1168
1259
  theme,
1169
1260
  includeAllTokens,
1261
+ includeSparkTokens = true,
1170
1262
  themeMode,
1171
1263
  accessible,
1172
1264
  accessibleTheme,
@@ -1202,9 +1294,14 @@ export const defineUiLibraryConfig = (options = {}) => {
1202
1294
  color: 'neutral',
1203
1295
  darkSelector: darkSelector ?? 'html.dark',
1204
1296
  }),
1205
- // Spark Colors / Spacings / Box-shadow tokens. Typography utilities are
1206
- // filtered out where ui-library owns the same class names.
1207
- getSparkTokenPresetWithoutUiLibraryTypography(),
1297
+ // Legacy Spark Colors / Spacings / Box-shadow tokens, bundled for
1298
+ // coexistence with ds-components-vue. Typography utilities are filtered
1299
+ // out where ui-library owns the same class names. Pure ui-library apps
1300
+ // can opt out via `includeSparkTokens: false` so only ui-library theme
1301
+ // tokens are emitted.
1302
+ ...(includeSparkTokens
1303
+ ? [getSparkTokenPresetWithoutUiLibraryTypography()]
1304
+ : []),
1208
1305
  presetUiLibraryThemeFromTokens(themeOptions),
1209
1306
  presetUiLibraryUtils(),
1210
1307
  ...extraPresets,