@aleph-alpha/ui-library 5.3.1 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/config.d.ts +29 -3
  2. package/config.js +91 -3
  3. package/dist/system/lib.js +5246 -5152
  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/docs/public-docs/getting-started-designers.md +3 -1
  9. package/package.json +1 -1
  10. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +1 -1
  11. package/src/components/UiAutocomplete/UiAutocomplete.vue +5 -5
  12. package/src/components/UiButton/UiButton.stories.ts +5 -5
  13. package/src/components/UiCheckbox/UiCheckbox.stories.ts +7 -9
  14. package/src/components/UiChip/UiChip.vue +1 -1
  15. package/src/components/UiDrawer/UiDrawer.stories.ts +2 -2
  16. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +4 -4
  17. package/src/components/UiEmpty/UiEmpty.vue +2 -2
  18. package/src/components/UiField/UiField.stories.ts +2 -2
  19. package/src/components/UiField/UiFieldLabelInfo.vue +1 -1
  20. package/src/components/UiFileUploadBox/UiFileUploadBox.stories.ts +2 -2
  21. package/src/components/UiFileUploadBox/UiFileUploadBox.vue +2 -2
  22. package/src/components/UiInput/UiInput.vue +3 -3
  23. package/src/components/UiKbd/UiKbd.stories.ts +14 -14
  24. package/src/components/UiNavigationMenu/UiNavigationMenu.stories.ts +42 -42
  25. package/src/components/UiPopover/UiPopover.stories.ts +6 -6
  26. package/src/components/UiRadioGroup/UiRadioGroup.stories.ts +2 -2
  27. package/src/components/UiResizable/UiResizable.stories.ts +6 -5
  28. package/src/components/UiSeparator/UiSeparator.stories.ts +6 -6
  29. package/src/components/UiSheet/UiSheet.stories.ts +2 -2
  30. package/src/components/UiSlider/UiSlider.stories.ts +8 -8
  31. package/src/components/UiSpinner/UiSpinner.stories.ts +8 -8
  32. package/src/components/UiSwitch/UiSwitch.stories.ts +2 -2
  33. package/src/components/UiTabs/UiTabs.stories.ts +30 -30
  34. package/src/components/UiToggle/__tests__/UiToggle.test.ts +5 -3
  35. package/src/components/UiToggleGroup/UiToggleGroup.stories.ts +9 -9
  36. package/src/components/UiTooltip/UiTooltip.stories.ts +3 -3
  37. package/src/components/core/accordion/AccordionTrigger.vue +2 -2
  38. package/src/components/core/alert/AlertDescription.vue +1 -1
  39. package/src/components/core/badge/index.ts +1 -1
  40. package/src/components/core/button/index.ts +2 -2
  41. package/src/components/core/calendar/CalendarCellTrigger.vue +2 -2
  42. package/src/components/core/calendar/CalendarHeadCell.vue +1 -1
  43. package/src/components/core/card/CardDescription.vue +1 -1
  44. package/src/components/core/checkbox/Checkbox.vue +1 -1
  45. package/src/components/core/drawer/DrawerDescription.vue +1 -1
  46. package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
  47. package/src/components/core/dropdown-menu/DropdownMenuShortcut.vue +1 -1
  48. package/src/components/core/field/FieldDescription.vue +1 -1
  49. package/src/components/core/field/FieldLabel.vue +1 -1
  50. package/src/components/core/field/FieldSeparator.vue +1 -1
  51. package/src/components/core/input/Input.vue +2 -2
  52. package/src/components/core/item/index.ts +1 -1
  53. package/src/components/core/kbd/Kbd.vue +1 -1
  54. package/src/components/core/listbox/ListboxFilter.vue +1 -1
  55. package/src/components/core/listbox/ListboxGroupLabel.vue +4 -1
  56. package/src/components/core/listbox/ListboxItem.vue +1 -1
  57. package/src/components/core/native-select/NativeSelect.vue +3 -3
  58. package/src/components/core/navigation-menu/NavigationMenuLink.vue +1 -1
  59. package/src/components/core/navigation-menu/index.ts +1 -1
  60. package/src/components/core/radio-group/RadioGroupItem.vue +1 -1
  61. package/src/components/core/range-calendar/RangeCalendarCellTrigger.vue +2 -2
  62. package/src/components/core/range-calendar/RangeCalendarHeadCell.vue +1 -1
  63. package/src/components/core/select/SelectItem.vue +1 -1
  64. package/src/components/core/select/SelectLabel.vue +4 -1
  65. package/src/components/core/select/SelectTrigger.vue +1 -1
  66. package/src/components/core/sheet/SheetDescription.vue +3 -1
  67. package/src/components/core/switch/Switch.vue +1 -1
  68. package/src/components/core/table/TableCaption.vue +3 -1
  69. package/src/components/core/tabs/TabsList.vue +1 -1
  70. package/src/components/core/tabs/TabsTrigger.vue +1 -1
  71. package/src/components/core/tags-input/TagsInput.vue +1 -1
  72. package/src/components/core/tags-input/TagsInputInput.vue +1 -1
  73. package/src/components/core/tags-input/TagsInputItemDelete.vue +1 -1
  74. package/src/components/core/textarea/Textarea.vue +1 -1
  75. package/src/components/core/toggle/index.ts +3 -3
  76. package/src/components/core/toggle-group/index.ts +2 -2
  77. package/src/lib/useDrag.stories.ts +8 -8
  78. package/src/patterns/UiDataTable/UiDataTable.stories.ts +420 -10
  79. package/src/patterns/UiDataTable/UiDataTableColumnFilter.vue +1 -1
  80. package/src/patterns/UiDataTable/UiDataTableFilterMenu.vue +91 -0
  81. package/src/patterns/UiDataTable/UiDataTablePagination.vue +1 -1
  82. package/src/patterns/UiDataTable/constants.ts +12 -0
  83. package/src/patterns/UiDataTable/index.ts +1 -0
  84. package/src/patterns/UiDataTable/types.ts +24 -0
  85. package/src/patterns/UiDatePicker/UiDatePicker.stories.ts +4 -4
  86. package/src/patterns/UiDatePicker/UiDatePicker.vue +1 -1
  87. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +4 -3
  88. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +353 -447
  89. package/src/patterns/UiFloatActions/UiFloatActions.vue +1 -1
  90. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +2 -2
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
 
package/config.js CHANGED
@@ -773,6 +773,13 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
773
773
  const darkSelector = options.darkSelector ?? 'html.dark';
774
774
  const rootFontSize = normalizeRootFontSize(options.rootFontSize);
775
775
 
776
+ // preset-wind4 registers these `--un-*` variables via `@property` and relies
777
+ // on their `initial-value`. That fallback is not honored everywhere (notably
778
+ // web-component shadow roots), so the composed `box-shadow` and `ring`
779
+ // utilities reference undefined variables and the whole declaration is
780
+ // dropped. Reset the base layers here (matching Tailwind's own defaults) so
781
+ // `shadow-*` and `ring-*` render reliably; the utilities still override these
782
+ // per element.
776
783
  const opacityDefaults = `
777
784
  *,
778
785
  ::before,
@@ -782,6 +789,15 @@ export const presetUiLibraryTheme = (theme, options = {}) => {
782
789
  --un-border-opacity: 1;
783
790
  --un-ring-opacity: 1;
784
791
  --un-shadow-opacity: 1;
792
+ --un-shadow: 0 0 #0000;
793
+ --un-inset-shadow: 0 0 #0000;
794
+ --un-inset-ring-shadow: 0 0 #0000;
795
+ --un-ring-offset-shadow: 0 0 #0000;
796
+ --un-ring-shadow: 0 0 #0000;
797
+ --un-ring-offset-width: 0px;
798
+ --un-ring-offset-color: #0000;
799
+ --un-ring-inset: ;
800
+ --un-ring-color: currentColor;
785
801
  }`.trim();
786
802
 
787
803
  const toCssBlock = (selector, vars, extraDeclarations = []) => {
@@ -1103,12 +1119,84 @@ const vHoverOverlayCSS = `
1103
1119
  transition: none;
1104
1120
  }
1105
1121
  }
1122
+ /* Shared focus-visible style for every focusable component. Reproduces the
1123
+ exact UiButton focus treatment:
1124
+ outline-none
1125
+ focus-visible:border-border-surface-focus-ring
1126
+ focus-visible:ring-ring/50 focus-visible:ring-[3px]
1127
+ i.e. the border switches to border/surface/focus-ring and a 3px ring in the
1128
+ focus-ring color at 50% opacity is drawn around it. Add the single
1129
+ "ui-focus-ring" class to any focusable element (give it a border so the
1130
+ border color can show, e.g. "border border-transparent").
1131
+
1132
+ NOTE: the class is namespaced ("ui-focus-ring", not "focus-ring") because
1133
+ UnoCSS treats "-" as a variant separator, so "focus-ring" would be parsed as
1134
+ the "focus:" variant applied to the "ring" utility and emit an unwanted
1135
+ ".focus-ring:focus" rule with the ring box-shadow. */
1136
+ .ui-focus-ring {
1137
+ outline: none;
1138
+ transition:
1139
+ box-shadow 0.15s ease,
1140
+ border-color 0.15s ease;
1141
+ }
1142
+ .ui-focus-ring:focus-visible {
1143
+ outline: none;
1144
+ border-color: oklch(var(--border-surface-focus-ring));
1145
+ box-shadow: 0 0 0 2px oklch(var(--ring) / 0.5);
1146
+ }
1147
+ /* Companion for container/wrapper controls (text field wrappers, tag inputs,
1148
+ comboboxes) that surface the ring when any descendant is focused. Same visual
1149
+ as "ui-focus-ring", triggered on :focus-within instead of :focus-visible. */
1150
+ .ui-focus-ring-within {
1151
+ outline: none;
1152
+ transition:
1153
+ box-shadow 0.15s ease,
1154
+ border-color 0.15s ease;
1155
+ }
1156
+ .ui-focus-ring-within:focus-within {
1157
+ outline: none;
1158
+ border-color: oklch(var(--border-surface-focus-ring));
1159
+ box-shadow: 0 0 0 2px oklch(var(--ring) / 0.5);
1160
+ }
1161
+ @media (prefers-reduced-motion: reduce) {
1162
+ .ui-focus-ring,
1163
+ .ui-focus-ring-within {
1164
+ transition: none;
1165
+ }
1166
+ }
1106
1167
  `.trim();
1107
1168
 
1108
1169
  /**
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.
1170
+ * UnoCSS preset with utility rules and preflight classes required by the UI
1171
+ * library's components.
1172
+ *
1173
+ * Adds Tailwind v4 CSS variable syntax (`w-(--var)`, `h-(--var)`, etc.) that
1174
+ * preset-wind4 does not yet support, plus the shared focus and hover helpers.
1175
+ *
1176
+ * ## Focus utilities
1177
+ *
1178
+ * The library exposes one canonical focus style so every focusable component
1179
+ * looks identical. Prefer these over ad-hoc `focus-visible:ring-*` recipes.
1180
+ *
1181
+ * - `ui-focus-ring` — apply to a focusable element (button, link, input,
1182
+ * checkbox, switch, tab, menu item, etc.). On `:focus-visible` it sets the
1183
+ * border color to `border/surface/focus-ring` and draws a 2px ring in the
1184
+ * focus-ring color at 50% opacity. Give the element a border so the border
1185
+ * color can show, e.g. `border border-transparent`.
1186
+ * - `ui-focus-ring-within` — same visual, but triggered on `:focus-within`.
1187
+ * Apply to container controls that wrap the real focusable element (text
1188
+ * field wrappers, tag inputs, comboboxes).
1189
+ *
1190
+ * Both are namespaced with the `ui-` prefix on purpose: an unprefixed
1191
+ * `focus-ring` would be parsed by UnoCSS as the `focus:` variant of the `ring`
1192
+ * utility and emit an unintended `.focus-ring:focus` rule.
1193
+ *
1194
+ * @example
1195
+ * ```html
1196
+ * <button class="ui-focus-ring border border-transparent">Save</button>
1197
+ * <div class="ui-focus-ring-within border border-input"><input /></div>
1198
+ * ```
1199
+ *
1112
1200
  * @returns {import('unocss').Preset} UnoCSS utility preset for ui-library components.
1113
1201
  */
1114
1202
  export const presetUiLibraryUtils = () =>