@aleph-alpha/ui-library 5.8.0 → 5.10.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 (111) hide show
  1. package/README.md +8 -7
  2. package/config.js +157 -4
  3. package/dist/system/__tests__/test-utils.d.ts +24 -0
  4. package/dist/system/components/UiAutocomplete/UiAutocomplete.vue.d.ts +8 -4
  5. package/dist/system/components/UiAutocomplete/types.d.ts +11 -0
  6. package/dist/system/components/UiFadeMask/UiFadeMask.vue.d.ts +21 -0
  7. package/dist/system/components/UiFadeMask/index.d.ts +2 -0
  8. package/dist/system/components/UiFadeMask/types.d.ts +33 -0
  9. package/dist/system/components/UiFileItem/UiFileItem.vue.d.ts +3 -1
  10. package/dist/system/components/UiFileType/types.d.ts +2 -1
  11. package/dist/system/components/UiListbox/UiListboxVirtualizer.vue.d.ts +21 -0
  12. package/dist/system/components/UiListbox/index.d.ts +1 -0
  13. package/dist/system/components/UiListbox/types.d.ts +36 -0
  14. package/dist/system/components/UiSelect/UiSelectVirtualizer.vue.d.ts +21 -0
  15. package/dist/system/components/UiSelect/index.d.ts +1 -0
  16. package/dist/system/components/UiSelect/types.d.ts +36 -0
  17. package/dist/system/components/UiSwitch/UiSwitch.vue.d.ts +1 -0
  18. package/dist/system/components/UiSwitch/types.d.ts +12 -0
  19. package/dist/system/components/core/native-select/NativeSelectOptGroup.vue.d.ts +2 -2
  20. package/dist/system/components/core/native-select/NativeSelectOption.vue.d.ts +2 -2
  21. package/dist/system/components/core/switch/Switch.vue.d.ts +2 -0
  22. package/dist/system/components/core/switch/index.d.ts +8 -0
  23. package/dist/system/components/index.d.ts +1 -0
  24. package/dist/system/index.d.ts +1 -0
  25. package/dist/system/lib/scrollbar.d.ts +37 -0
  26. package/dist/system/lib/useAnchorFloat.d.ts +0 -2
  27. package/dist/system/lib/useIsTruncated.d.ts +15 -0
  28. package/dist/system/lib.js +22660 -21292
  29. package/dist/system/mobile-device-frame.png +0 -0
  30. package/dist/system/patterns/UiFloatActions/types.d.ts +2 -2
  31. package/dist/system/patterns/UiProfileCard/index.d.ts +7 -0
  32. package/dist/system/patterns/UiTopBar/UiTopBar.vue.d.ts +23 -0
  33. package/dist/system/patterns/UiTopBar/index.d.ts +2 -0
  34. package/dist/system/patterns/UiTopBar/types.d.ts +28 -0
  35. package/dist/system/patterns/index.d.ts +2 -0
  36. package/dist/system/story-sidebar-icons.json +7 -1
  37. package/docs/public-docs/foundations.md +17 -15
  38. package/package.json +4 -3
  39. package/src/__tests__/test-utils.ts +74 -0
  40. package/src/components/UiAutocomplete/UiAutocomplete.stories.ts +94 -0
  41. package/src/components/UiAutocomplete/UiAutocomplete.vue +164 -44
  42. package/src/components/UiAutocomplete/__tests__/UiAutocompleteVirtualized.test.ts +107 -0
  43. package/src/components/UiAutocomplete/types.ts +11 -0
  44. package/src/components/UiCodeBlock/UiCodeBlock.stories.ts +54 -0
  45. package/src/components/UiCodeBlock/UiCodeBlock.vue +84 -32
  46. package/src/components/UiCodeBlock/__tests__/UiCodeBlock.test.ts +65 -21
  47. package/src/components/UiDropdownMenu/UiDropdownMenu.stories.ts +760 -0
  48. package/src/components/UiFadeMask/UiFadeMask.stories.ts +563 -0
  49. package/src/components/UiFadeMask/UiFadeMask.vue +86 -0
  50. package/src/components/UiFadeMask/__tests__/UiFadeMask.test.ts +52 -0
  51. package/src/components/UiFadeMask/index.ts +6 -0
  52. package/src/components/UiFadeMask/types.ts +35 -0
  53. package/src/components/UiFileItem/UiFileItem.vue +17 -4
  54. package/src/components/UiFileItem/__tests__/UiFileItem.test.ts +49 -90
  55. package/src/components/UiFileType/UiFileType.stories.ts +13 -2
  56. package/src/components/UiFileType/UiFileType.vue +8 -0
  57. package/src/components/UiFileType/__tests__/UiFileType.test.ts +10 -0
  58. package/src/components/UiFileType/types.ts +3 -1
  59. package/src/components/UiListbox/UiListbox.stories.ts +121 -0
  60. package/src/components/UiListbox/UiListboxVirtualizer.vue +42 -0
  61. package/src/components/UiListbox/__tests__/UiListboxVirtualizer.test.ts +96 -0
  62. package/src/components/UiListbox/index.ts +1 -0
  63. package/src/components/UiListbox/types.ts +42 -0
  64. package/src/components/UiSelect/UiSelect.stories.ts +109 -1
  65. package/src/components/UiSelect/UiSelectVirtualizer.vue +373 -0
  66. package/src/components/UiSelect/__tests__/UiSelectVirtualizer.test.ts +185 -0
  67. package/src/components/UiSelect/index.ts +1 -0
  68. package/src/components/UiSelect/types.ts +38 -0
  69. package/src/components/UiSnackbar/UiSnackbar.stories.ts +4 -5
  70. package/src/components/UiSwitch/UiSwitch.stories.ts +658 -7
  71. package/src/components/UiSwitch/UiSwitch.vue +1 -0
  72. package/src/components/UiSwitch/__tests__/UiSwitch.test.ts +48 -0
  73. package/src/components/UiSwitch/types.ts +13 -0
  74. package/src/components/UiToggleGroup/UiToggleGroup.vue +1 -1
  75. package/src/components/core/dropdown-menu/DropdownMenuCheckboxItem.vue +8 -2
  76. package/src/components/core/dropdown-menu/DropdownMenuItem.vue +1 -1
  77. package/src/components/core/dropdown-menu/DropdownMenuRadioItem.vue +8 -2
  78. package/src/components/core/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
  79. package/src/components/core/field/FieldLabel.vue +1 -1
  80. package/src/components/core/label/Label.vue +1 -1
  81. package/src/components/core/listbox/ListboxItem.vue +1 -1
  82. package/src/components/core/switch/Switch.vue +23 -17
  83. package/src/components/core/switch/index.ts +36 -0
  84. package/src/components/index.ts +1 -0
  85. package/src/index.ts +3 -0
  86. package/src/lib/scrollbar.ts +295 -0
  87. package/src/lib/useAnchorFloat.ts +0 -2
  88. package/src/lib/useIsTruncated.test.ts +174 -0
  89. package/src/lib/useIsTruncated.ts +75 -0
  90. package/src/patterns/UiFileUpload/UiFileItem.stories.ts +1162 -0
  91. package/src/patterns/UiFileUpload/UiFileUpload.stories.ts +552 -1
  92. package/src/patterns/UiFileUpload/__tests__/UiFileUpload.test.ts +5 -21
  93. package/src/patterns/UiFloatActions/UiFloatActionItems.vue +0 -1
  94. package/src/patterns/UiFloatActions/UiFloatActions.stories.ts +4 -6
  95. package/src/patterns/UiFloatActions/UiFloatActions.vue +23 -12
  96. package/src/patterns/UiFloatActions/__tests__/UiFloatActions.test.ts +23 -0
  97. package/src/patterns/UiFloatActions/types.ts +2 -2
  98. package/src/patterns/UiProfileCard/UiProfileCard.stories.ts +1079 -0
  99. package/src/patterns/UiProfileCard/index.ts +7 -0
  100. package/src/patterns/UiTopBar/UiTopBar.stories.ts +1121 -0
  101. package/src/patterns/UiTopBar/UiTopBar.vue +166 -0
  102. package/src/patterns/UiTopBar/__tests__/UiTopBar.test.ts +245 -0
  103. package/src/patterns/UiTopBar/index.ts +2 -0
  104. package/src/patterns/UiTopBar/types.ts +29 -0
  105. package/src/patterns/index.ts +2 -0
  106. package/src/theme/Background.stories.ts +27 -1
  107. package/src/theme/BorderRadius.stories.ts +5 -0
  108. package/src/theme/Overlay.stories.ts +12 -1
  109. package/src/theme/Scrollbar.stories.ts +260 -0
  110. package/tokens.json +224 -2
  111. package/src/components/UiFileItem/UiFileItem.stories.ts +0 -442
@@ -1 +1,9 @@
1
+ import { VariantProps } from 'class-variance-authority';
1
2
  export { default as Switch } from './Switch.vue';
3
+ export declare const switchRootVariants: (props?: ({
4
+ size?: "default" | "sm" | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
+ export declare const switchThumbVariants: (props?: ({
7
+ size?: "default" | "sm" | null | undefined;
8
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
9
+ export type SwitchVariants = VariantProps<typeof switchRootVariants>;
@@ -20,6 +20,7 @@ export * from './UiDialog';
20
20
  export * from './UiDrawer';
21
21
  export * from './UiDropdownMenu';
22
22
  export * from './UiEmpty';
23
+ export * from './UiFadeMask';
23
24
  export * from './UiField';
24
25
  export * from './UiFileItem';
25
26
  export * from './UiFileType';
@@ -5,6 +5,7 @@ export * from './patterns';
5
5
  export * from './templates';
6
6
  export * from './lib/useDevice';
7
7
  export * from './lib/useAnchorFloat';
8
+ export * from './lib/scrollbar';
8
9
  export * from './directives';
9
10
  export { Primitive } from 'reka-ui';
10
11
  export type PrimitiveProps = RekaPrimitiveProps;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Auto-hide behavior for the library scrollbar.
3
+ *
4
+ * The look of the scrollbar (4px thumb, invisible track, reserved 16px lane) is
5
+ * pure CSS and ships with the UnoCSS preset. Only the *timing* rules need a
6
+ * runtime, because CSS has no way to express "one second after the last scroll":
7
+ *
8
+ * | Situation | Thumb |
9
+ * | -------------------------- | ------------------------------------------- |
10
+ * | At rest | Hidden |
11
+ * | Scrolling, incl. keyboard | Visible, fades in quickly |
12
+ * | Scrolling stops | Stays ~1s, then fades out |
13
+ * | Pointer hovering the lane | Visible, stays visible |
14
+ * | Being dragged | Visible until released, even off-element |
15
+ * | Content too short | No thumb, lane stays reserved |
16
+ * | Reduced motion | Appears and disappears instantly, no fade |
17
+ *
18
+ * The fades and the reduced-motion rule are CSS; this module only decides when
19
+ * a scroll container counts as active.
20
+ */
21
+ export type ScrollbarBehaviorOptions = {
22
+ /** Milliseconds the thumb stays visible after the last scroll. Defaults to 1000. */
23
+ idleDelay?: number;
24
+ /** Document to attach the listeners to. Defaults to the ambient `document`. */
25
+ document?: Document;
26
+ };
27
+ /**
28
+ * Installs the scroll, hover, and drag listeners that reveal and hide scrollbar
29
+ * thumbs, and puts the document into auto-hide mode.
30
+ *
31
+ * The library's Vue plugin calls this for you. Call it directly when you
32
+ * register components individually instead of installing the plugin. Safe to
33
+ * call during SSR and safe to call more than once per document.
34
+ * @param options Idle delay and target document overrides.
35
+ * @returns Teardown that removes the listeners and restores always-visible thumbs.
36
+ */
37
+ export declare function installScrollbarBehavior(options?: ScrollbarBehaviorOptions): () => void;
@@ -10,7 +10,6 @@ export interface AnchorFloatOffset {
10
10
  }
11
11
  /**
12
12
  * Options for {@link useAnchorFloat}.
13
- *
14
13
  * @category Composables
15
14
  * @useCases contextual toolbar positioning, custom floating panels
16
15
  * @keywords float, anchor, floating-ui, composable, positioning
@@ -74,7 +73,6 @@ export interface UseAnchorFloatOptions {
74
73
  *
75
74
  * Prefer {@link UiFloatActions} for the standard component API. Use this composable
76
75
  * when you need full control over markup, animation, or teleport targets.
77
- *
78
76
  * @param options - Trigger, placement, offset, and dismiss behaviour.
79
77
  * @returns Refs, computed styles, open state, and event handlers to wire up
80
78
  * anchor and floating elements manually.
@@ -0,0 +1,15 @@
1
+ import { Ref, ShallowRef } from 'vue';
2
+ /** An element ref as produced by `useTemplateRef`. */
3
+ type ElementRef = Readonly<ShallowRef<HTMLElement | null>>;
4
+ /**
5
+ * Whether an element's text is currently clipped by `text-overflow: ellipsis`.
6
+ *
7
+ * Re-measures when the element resizes and whenever `watchSource` changes, so
8
+ * it stays correct as the container narrows or the text is swapped out. Use it
9
+ * to show a tooltip only for names that are actually cut off.
10
+ * @param elementRef - The element whose text may be clipped
11
+ * @param watchSource - Value to re-measure on, e.g. the rendered text
12
+ * @returns Reactive truncation state
13
+ */
14
+ export declare function useIsTruncated(elementRef: ElementRef, watchSource?: () => unknown): Ref<boolean>;
15
+ export {};