@aleph-alpha/ui-library 1.25.0 → 1.25.2

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 (32) hide show
  1. package/dist/system/components/UiBadge/index.d.ts +1 -1
  2. package/dist/system/components/UiProgress/index.d.ts +1 -1
  3. package/dist/system/components/UiSelect/UiSelect.vue.d.ts +6 -4
  4. package/dist/system/components/UiSelect/UiSelectContent.vue.d.ts +1 -0
  5. package/dist/system/components/UiSelect/UiSelectItem.vue.d.ts +8 -2
  6. package/dist/system/components/UiSelect/UiSelectTrigger.vue.d.ts +1 -0
  7. package/dist/system/components/UiSelect/UiSelectValue.vue.d.ts +3 -0
  8. package/dist/system/components/UiSelect/context.d.ts +28 -0
  9. package/dist/system/components/UiSelect/types.d.ts +32 -8
  10. package/dist/system/lib.js +16142 -15927
  11. package/package.json +4 -3
  12. package/src/components/UiBadge/index.ts +1 -1
  13. package/src/components/UiProgress/index.ts +1 -1
  14. package/src/components/UiSelect/UiSelect.stories.ts +137 -0
  15. package/src/components/UiSelect/UiSelect.vue +161 -6
  16. package/src/components/UiSelect/UiSelectContent.vue +22 -0
  17. package/src/components/UiSelect/UiSelectItem.vue +83 -1
  18. package/src/components/UiSelect/UiSelectTrigger.vue +51 -0
  19. package/src/components/UiSelect/UiSelectValue.vue +37 -1
  20. package/src/components/UiSelect/__tests__/UiSelect.test.ts +564 -0
  21. package/src/components/UiSelect/context.ts +41 -0
  22. package/src/components/UiSelect/types.ts +32 -8
  23. package/src/components/core/navigation-menu/NavigationMenuContent.vue +1 -1
  24. package/src/components/core/navigation-menu/NavigationMenuLink.vue +7 -1
  25. package/src/components/core/navigation-menu/NavigationMenuViewport.vue +1 -1
  26. package/src/components/core/navigation-menu/index.ts +10 -1
  27. package/src/patterns/UiSidebar/UiSidebarChatHistoryItem.vue +6 -1
  28. package/src/patterns/UiSidebar/UiSidebarMenuButton.stories.ts +117 -2
  29. package/src/patterns/UiSidebar/UiSidebarMenuButton.vue +4 -0
  30. package/src/patterns/UiSidebar/UiSidebarMenuItem.stories.ts +119 -1
  31. package/src/patterns/UiSidebar/UiSidebarMenuSubItem.vue +3 -0
  32. package/src/patterns/UiSidebar/UiSidebarPopoverTrigger.vue +2 -2
@@ -1,2 +1,2 @@
1
1
  export { default as UiBadge } from './UiBadge.vue';
2
- export type * from './types.ts';
2
+ export type * from './types';
@@ -1,2 +1,2 @@
1
1
  export { default as UiProgress } from './UiProgress.vue';
2
- export type * from './types.ts';
2
+ export type * from './types';
@@ -3,22 +3,24 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  default?(_: {}): any;
6
+ default?(_: {}): any;
6
7
  };
7
8
  refs: {};
8
9
  rootEl: any;
9
10
  };
10
11
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
12
  declare const __VLS_component: import('vue').DefineComponent<UiSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
- "update:modelValue": (value: string) => any;
13
+ "update:modelValue": (value: string | string[]) => any;
13
14
  "update:open": (value: boolean) => any;
14
15
  }, string, import('vue').PublicProps, Readonly<UiSelectProps> & Readonly<{
15
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
16
+ "onUpdate:modelValue"?: ((value: string | string[]) => any) | undefined;
16
17
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
17
18
  }>, {
18
19
  disabled: boolean;
19
20
  dir: "ltr" | "rtl";
20
- modelValue: string;
21
- defaultValue: string;
21
+ modelValue: string | string[];
22
+ defaultValue: string | string[];
23
+ multiple: boolean;
22
24
  open: boolean;
23
25
  defaultOpen: boolean;
24
26
  name: string;
@@ -3,6 +3,7 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  default?(_: {}): any;
6
+ default?(_: {}): any;
6
7
  };
7
8
  refs: {};
8
9
  rootEl: any;
@@ -3,15 +3,21 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  default?(_: {}): any;
6
+ default?(_: {}): any;
7
+ 'indicator-icon'?(_: {}): any;
8
+ };
9
+ refs: {
10
+ labelEl: HTMLSpanElement;
6
11
  };
7
- refs: {};
8
12
  rootEl: any;
9
13
  };
10
14
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
15
  declare const __VLS_component: import('vue').DefineComponent<UiSelectItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UiSelectItemProps> & Readonly<{}>, {
12
16
  disabled: boolean;
13
17
  textValue: string;
14
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
19
+ labelEl: HTMLSpanElement;
20
+ }, any>;
15
21
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
22
  export default _default;
17
23
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -3,6 +3,7 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  default?(_: {}): any;
6
+ default?(_: {}): any;
6
7
  };
7
8
  refs: {};
8
9
  rootEl: any;
@@ -3,6 +3,9 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  default?(_: {}): any;
6
+ default?(_: {
7
+ selected: string[];
8
+ }): any;
6
9
  };
7
10
  refs: {};
8
11
  rootEl: any;
@@ -0,0 +1,28 @@
1
+ import { Ref } from 'vue';
2
+ /**
3
+ * Internal context used by `UiSelect` and its subcomponents to coordinate
4
+ * single vs. multi-select rendering paths and to share the label registry
5
+ * needed to render selected values in the trigger.
6
+ *
7
+ * Not part of the public API — do not export from the package index.
8
+ */
9
+ export type UiSelectMode = 'single' | 'multiple';
10
+ export type UiSelectMultipleContext = {
11
+ /** Currently selected values (multi-select). */
12
+ selectedValues: Ref<string[]>;
13
+ /** Reactive map of `value -> rendered label` populated by `UiSelectItem`. */
14
+ itemLabels: Ref<Map<string, string>>;
15
+ };
16
+ export type UiSelectContext = {
17
+ /** Whether the parent UiSelect is in single or multiple selection mode. */
18
+ mode: UiSelectMode;
19
+ /** Present only when `mode === 'multiple'`. */
20
+ multiple?: UiSelectMultipleContext;
21
+ };
22
+ /**
23
+ * Provide the context from `UiSelect` to its descendant subcomponents.
24
+ * @param ctx The context value to expose to children.
25
+ */
26
+ export declare function provideUiSelectContext(ctx: UiSelectContext): void;
27
+ /** Inject the context inside a UiSelect subcomponent. Falls back to single-mode. */
28
+ export declare function useUiSelectContext(): UiSelectContext;
@@ -7,29 +7,53 @@
7
7
  * @related UiDropdownMenu, UiRadioGroup
8
8
  */
9
9
  export type UiSelectProps = {
10
- /** The controlled value of the select. */
11
- modelValue?: string;
12
- /** The value when initially rendered (uncontrolled). */
13
- defaultValue?: string;
10
+ /**
11
+ * The controlled value of the select.
12
+ * - In single-select (default): a `string`.
13
+ * - In multi-select (`multiple: true`): a `string[]`.
14
+ */
15
+ modelValue?: string | string[];
16
+ /** The value when initially rendered (uncontrolled). Same shape as `modelValue`. */
17
+ defaultValue?: string | string[];
14
18
  /** Whether the select is open by default. */
15
19
  defaultOpen?: boolean;
16
20
  /** Controlled open state. */
17
21
  open?: boolean;
18
22
  /** Whether the select is disabled. */
19
23
  disabled?: boolean;
20
- /** Whether the select is required in a form. */
24
+ /**
25
+ * Whether the select is required in a form.
26
+ * - Single-select: forwarded to the underlying native select primitive.
27
+ * - Multi-select: enforced via a visually-hidden focusable `<input required>`
28
+ * that participates in native form validation when no items are selected.
29
+ */
21
30
  required?: boolean;
22
- /** The name for form submission. */
31
+ /**
32
+ * The name for form submission.
33
+ * - Single-select: forwarded to the underlying native select primitive.
34
+ * - Multi-select: rendered as one `<input type="hidden" name="<name>">`
35
+ * per selected value, mirroring how `<select multiple name="...">`
36
+ * contributes one form entry per selected option.
37
+ */
23
38
  name?: string;
24
39
  /** Reading direction. */
25
40
  dir?: 'ltr' | 'rtl';
41
+ /**
42
+ * When true, allows selecting multiple items. The popover stays open on
43
+ * click and the trigger renders the selected values as a comma-separated
44
+ * list. `modelValue` becomes a `string[]`.
45
+ */
46
+ multiple?: boolean;
26
47
  };
27
48
  /**
28
49
  * Emits for the UiSelect root component.
29
50
  */
30
51
  export type UiSelectEmits = {
31
- /** Emitted when the selected value changes. */
32
- 'update:modelValue': [value: string];
52
+ /**
53
+ * Emitted when the selected value changes.
54
+ * Payload is `string` in single-select and `string[]` in multi-select.
55
+ */
56
+ 'update:modelValue': [value: string | string[]];
33
57
  /** Emitted when the open state changes. */
34
58
  'update:open': [value: boolean];
35
59
  };