@kuina-ui/vue 0.2.0 → 0.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 (57) hide show
  1. package/dist/components/alert/Alert.vue.d.ts +2 -0
  2. package/dist/components/date-picker/DateCalendar.vue.d.ts +39 -0
  3. package/dist/components/date-picker/DateCalendarMonth.vue.d.ts +27 -0
  4. package/dist/components/date-picker/DateCalendarPopover.vue.d.ts +61 -0
  5. package/dist/components/date-picker/DatePicker.vue.d.ts +38 -0
  6. package/dist/components/date-picker/DatePickerField.vue.d.ts +38 -0
  7. package/dist/components/date-picker/DatePickerPanel.vue.d.ts +33 -0
  8. package/dist/components/date-picker/DateRangePicker.vue.d.ts +40 -0
  9. package/dist/components/date-picker/DateRangePickerField.vue.d.ts +40 -0
  10. package/dist/components/date-picker/date-calendar.theme.d.ts +69 -0
  11. package/dist/components/date-picker/date-picker.theme.d.ts +19 -0
  12. package/dist/components/date-picker/datePickerProps.d.ts +75 -0
  13. package/dist/components/date-picker/index.d.ts +10 -0
  14. package/dist/components/date-picker/useDatePickerControl.d.ts +63 -0
  15. package/dist/components/date-picker/useDatePickerPopover.d.ts +21 -0
  16. package/dist/components/date-picker/useDateRangeSelection.d.ts +30 -0
  17. package/dist/components/date-picker/useDateRangeTyping.d.ts +45 -0
  18. package/dist/components/date-picker/useDateTypingFocus.d.ts +28 -0
  19. package/dist/components/date-picker/useSingleDateSelection.d.ts +15 -0
  20. package/dist/components/date-picker/useSingleDateTyping.d.ts +43 -0
  21. package/dist/components/date-picker/useTypedDateInput.d.ts +32 -0
  22. package/dist/components/menu/Menu.vue.d.ts +2 -2
  23. package/dist/components/select/Select.vue.d.ts +81 -0
  24. package/dist/components/select/SelectField.vue.d.ts +70 -0
  25. package/dist/components/select/SelectOptionRow.vue.d.ts +33 -0
  26. package/dist/components/select/SelectPanel.vue.d.ts +67 -0
  27. package/dist/components/select/index.d.ts +6 -0
  28. package/dist/components/select/select-panel.theme.d.ts +55 -0
  29. package/dist/components/select/selectOptions.d.ts +43 -0
  30. package/dist/components/select/useSelectControl.d.ts +77 -0
  31. package/dist/components/select/useSelectListbox.d.ts +48 -0
  32. package/dist/components/text-field/TextField.vue.d.ts +10 -1
  33. package/dist/components/text-field/text-field.theme.d.ts +6 -1
  34. package/dist/components/textarea/Textarea.vue.d.ts +3 -0
  35. package/dist/components/textarea/textarea.theme.d.ts +6 -1
  36. package/dist/elements/select-control/SelectControl.vue.d.ts +56 -0
  37. package/dist/elements/select-control/index.d.ts +3 -0
  38. package/dist/elements/select-control/select-control.theme.d.ts +87 -0
  39. package/dist/elements/select-field-control/SelectFieldControl.vue.d.ts +61 -0
  40. package/dist/elements/select-field-control/index.d.ts +3 -0
  41. package/dist/elements/select-field-control/select-field-control.theme.d.ts +101 -0
  42. package/dist/index.d.ts +8 -0
  43. package/dist/index.js +1 -1
  44. package/dist/nuxt.js +1 -1
  45. package/dist/shared/composables/useCalendarLabels.d.ts +19 -0
  46. package/dist/shared/composables/useMask.d.ts +10 -0
  47. package/dist/shared/types/calendar.d.ts +14 -0
  48. package/dist/shared/types/mask.d.ts +17 -0
  49. package/dist/shared/utils/calendarMonth.d.ts +5 -0
  50. package/dist/shared/utils/createDateFormatters.d.ts +9 -0
  51. package/dist/shared/utils/createDateInputMask.d.ts +19 -0
  52. package/dist/shared/utils/createMask.d.ts +10 -0
  53. package/dist/shared/utils/floatingPanelTransition.d.ts +9 -0
  54. package/dist/shared/utils/isoDate.d.ts +26 -0
  55. package/dist/src-ChY11Hfy.js +7500 -0
  56. package/package.json +1 -1
  57. package/dist/src-Cn6KXW0m.js +0 -3486
@@ -0,0 +1,45 @@
1
+ import { type Ref } from 'vue';
2
+ import type { DateRange } from '../../shared/types/calendar';
3
+ import { type IsoDateLimits } from '../../shared/utils/isoDate';
4
+ import { type DateTypingCalendarControls } from './useDateTypingFocus';
5
+ interface DateRangeTypingOptions {
6
+ selectedRange: Ref<DateRange | undefined>;
7
+ typingProps: IsoDateLimits & {
8
+ locale: string;
9
+ maxRangeDays?: number;
10
+ };
11
+ calendar: DateTypingCalendarControls;
12
+ containerElement: Readonly<Ref<HTMLElement | null>>;
13
+ rangeInput: Readonly<Ref<HTMLInputElement | null>>;
14
+ }
15
+ /** Let people type a range in one field, the dash coming by itself after the start, and update the range once both ends fit together. */
16
+ export declare function useDateRangeTyping(typingOptions: DateRangeTypingOptions): {
17
+ dateInputMask: import("vue").ComputedRef<{
18
+ pattern: string;
19
+ formatHint: string;
20
+ formatIsoDate: (isoDate: string) => string;
21
+ parseTypedDate: (typedText: string) => string | undefined;
22
+ normalizeTypedDate: (typedText: string) => string;
23
+ rangePattern: string;
24
+ rangeFormatHint: string;
25
+ formatIsoRange: ([rangeStart, rangeEnd]: [string, string]) => string;
26
+ parseTypedRange: (typedText: string) => {
27
+ hasCompleteStart: boolean;
28
+ hasCompleteEnd: boolean;
29
+ rangeStart: string | undefined;
30
+ rangeEnd: string | undefined;
31
+ };
32
+ normalizeTypedRange: (typedText: string) => string;
33
+ }>;
34
+ typedText: Readonly<Ref<string, string>>;
35
+ isTypedDateRejected: Ref<boolean, boolean>;
36
+ movesFocusIntoCalendar: Ref<boolean, boolean>;
37
+ openCalendarFromControlClick: (clickEvent: MouseEvent) => void;
38
+ resetCalendarFocusMode: () => void;
39
+ typedInputListeners: {
40
+ onInput: (inputEvent: Event) => void;
41
+ onKeydown: (keydownEvent: Event) => void;
42
+ onFocusout: (focusEvent: FocusEvent) => void;
43
+ };
44
+ };
45
+ export {};
@@ -0,0 +1,28 @@
1
+ import { type Ref } from 'vue';
2
+ type MaybeElement = Element | null | undefined;
3
+ export interface DateTypingCalendarControls {
4
+ isOpen: Ref<boolean>;
5
+ openCalendar: () => void;
6
+ closeCalendar: (closeOptions: {
7
+ restoreFocus: boolean;
8
+ }) => void;
9
+ closeCalendarWhenFocusLeaves: (focusEvent: FocusEvent) => void;
10
+ showDate: (isoDate: string) => void;
11
+ focusCalendar: () => void;
12
+ panelElement: () => MaybeElement;
13
+ }
14
+ interface DateTypingFocusOptions {
15
+ calendar: DateTypingCalendarControls;
16
+ typedInputs: () => (HTMLInputElement | null)[];
17
+ containerElement: Readonly<Ref<HTMLElement | null>>;
18
+ onFocusLeave: () => void;
19
+ }
20
+ /** Open the calendar from a typed date field without leaving it, move into the calendar on demand, and notice when the focus leaves. */
21
+ export declare function useDateTypingFocus(typingFocusOptions: DateTypingFocusOptions): {
22
+ movesFocusIntoCalendar: Ref<boolean, boolean>;
23
+ openCalendarFromControlClick: (clickEvent: MouseEvent) => void;
24
+ handleTypingKeys: (keydownEvent: Event) => void;
25
+ handleTypingFocusout: (focusEvent: FocusEvent) => void;
26
+ resetCalendarFocusMode: () => void;
27
+ };
28
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type Ref } from 'vue';
2
+ import type { DateFormatters } from '../../shared/utils/createDateFormatters';
3
+ import type { SingleDateProps } from './datePickerProps';
4
+ interface SingleDateSelectionProps extends SingleDateProps {
5
+ placeholder?: string;
6
+ min?: string;
7
+ max?: string;
8
+ }
9
+ /** Describe the date a date picker holds: the text its trigger shows and the day its calendar opens on. */
10
+ export declare function useSingleDateSelection(selectedDate: Ref<string | undefined>, selectionProps: SingleDateSelectionProps, dateFormatters: Ref<DateFormatters>, fallbackPlaceholder?: string): {
11
+ hasSelection: import("vue").ComputedRef<boolean>;
12
+ selectionText: import("vue").ComputedRef<string>;
13
+ initialFocusedDate: import("vue").ComputedRef<string>;
14
+ };
15
+ export {};
@@ -0,0 +1,43 @@
1
+ import type { Ref } from 'vue';
2
+ import { type IsoDateLimits } from '../../shared/utils/isoDate';
3
+ import { type DateTypingCalendarControls } from './useDateTypingFocus';
4
+ interface SingleDateTypingOptions {
5
+ selectedDate: Ref<string | undefined>;
6
+ typingProps: IsoDateLimits & {
7
+ locale: string;
8
+ };
9
+ calendar: DateTypingCalendarControls;
10
+ containerElement: Readonly<Ref<HTMLElement | null>>;
11
+ dateInput: Readonly<Ref<HTMLInputElement | null>>;
12
+ }
13
+ /** Let people type the date of a date picker: masked input, calendar following the typed date, and the last valid date back when the focus leaves. */
14
+ export declare function useSingleDateTyping(typingOptions: SingleDateTypingOptions): {
15
+ dateInputMask: import("vue").ComputedRef<{
16
+ pattern: string;
17
+ formatHint: string;
18
+ formatIsoDate: (isoDate: string) => string;
19
+ parseTypedDate: (typedText: string) => string | undefined;
20
+ normalizeTypedDate: (typedText: string) => string;
21
+ rangePattern: string;
22
+ rangeFormatHint: string;
23
+ formatIsoRange: ([rangeStart, rangeEnd]: [string, string]) => string;
24
+ parseTypedRange: (typedText: string) => {
25
+ hasCompleteStart: boolean;
26
+ hasCompleteEnd: boolean;
27
+ rangeStart: string | undefined;
28
+ rangeEnd: string | undefined;
29
+ };
30
+ normalizeTypedRange: (typedText: string) => string;
31
+ }>;
32
+ typedText: Readonly<Ref<string, string>>;
33
+ isTypedDateRejected: Ref<boolean, boolean>;
34
+ movesFocusIntoCalendar: Ref<boolean, boolean>;
35
+ openCalendarFromControlClick: (clickEvent: MouseEvent) => void;
36
+ resetCalendarFocusMode: () => void;
37
+ typedInputListeners: {
38
+ onInput: (inputEvent: Event) => void;
39
+ onKeydown: (keydownEvent: Event) => void;
40
+ onFocusout: (focusEvent: FocusEvent) => void;
41
+ };
42
+ };
43
+ export {};
@@ -0,0 +1,32 @@
1
+ import { type Ref } from 'vue';
2
+ interface TypedDateInputOptions {
3
+ selectedDate: Ref<string | undefined>;
4
+ locale: () => string;
5
+ isDateUnavailable: (isoDate: string) => boolean;
6
+ onDateTyped: (isoDate: string) => void;
7
+ }
8
+ /** Let people type a date through the mask of its language, keep it in sync with the selected date, and refuse dates that cannot be picked. */
9
+ export declare function useTypedDateInput(typedDateOptions: TypedDateInputOptions): {
10
+ dateInputMask: import("vue").ComputedRef<{
11
+ pattern: string;
12
+ formatHint: string;
13
+ formatIsoDate: (isoDate: string) => string;
14
+ parseTypedDate: (typedText: string) => string | undefined;
15
+ normalizeTypedDate: (typedText: string) => string;
16
+ rangePattern: string;
17
+ rangeFormatHint: string;
18
+ formatIsoRange: ([rangeStart, rangeEnd]: [string, string]) => string;
19
+ parseTypedRange: (typedText: string) => {
20
+ hasCompleteStart: boolean;
21
+ hasCompleteEnd: boolean;
22
+ rangeStart: string | undefined;
23
+ rangeEnd: string | undefined;
24
+ };
25
+ normalizeTypedRange: (typedText: string) => string;
26
+ }>;
27
+ typedText: Readonly<Ref<string, string>>;
28
+ isTypedDateRejected: Ref<boolean, boolean>;
29
+ updateTypedText: (inputEvent: Event) => void;
30
+ restoreTypedText: () => void;
31
+ };
32
+ export {};
@@ -64,10 +64,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<MenuPr
64
64
  width: "sm" | "md" | "lg" | "xl" | "auto" | "trigger";
65
65
  side: "bottom" | "top" | "left" | "right";
66
66
  align: "end" | "start" | "center";
67
+ flip: boolean;
68
+ strategy: FloatingStrategy;
67
69
  indicatorPosition: "end" | "start";
68
70
  indicatorVariant: "solid" | "ghost";
69
- strategy: FloatingStrategy;
70
- flip: boolean;
71
71
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
72
72
  trigger?: (props: {
73
73
  open: boolean;
@@ -0,0 +1,81 @@
1
+ import type { Component, InputHTMLAttributes } from 'vue';
2
+ import type { FloatingAlign, FloatingSide, FloatingStrategy } from '../../shared/types/floating-position';
3
+ import type { ClassNameValue } from '../../shared/utils/tv';
4
+ import type { SelectPanelSlotName } from './select-panel.theme';
5
+ import type { SelectControlSlotName, SelectControlThemeVariants } from '../../elements/select-control';
6
+ import type { SelectOption, SelectOptionEntry } from './selectOptions';
7
+ import type { SelectAction } from './useSelectListbox';
8
+ type ValueAtFieldPath<SourceOption, FieldPath extends string> = FieldPath extends `${infer FieldName}.${infer RemainingPath}` ? FieldName extends keyof SourceOption ? ValueAtFieldPath<NonNullable<SourceOption[FieldName]>, RemainingPath> : unknown : FieldPath extends keyof SourceOption ? SourceOption[FieldPath] : unknown;
9
+ export type SelectOptionValue<SourceOption, ValueKey extends string> = SourceOption extends string | number ? SourceOption : ValueAtFieldPath<SourceOption, ValueKey>;
10
+ export type SelectModelValue<SourceOption, ValueKey extends string, Multiple extends boolean> = Multiple extends true ? SelectOptionValue<SourceOption, ValueKey>[] : SelectOptionValue<SourceOption, ValueKey> | undefined;
11
+ export interface SelectProps<SourceOption = SelectOption, ValueKey extends string = 'value', Multiple extends boolean = false> {
12
+ label: string;
13
+ options: SelectOptionEntry<SourceOption>[];
14
+ multiple?: Multiple & boolean;
15
+ valueKey?: ValueKey;
16
+ labelKey?: string;
17
+ descriptionKey?: string;
18
+ avatarKey?: string;
19
+ placeholder?: string;
20
+ searchable?: boolean;
21
+ searchPlacement?: 'list' | 'field';
22
+ searchPlaceholder?: string;
23
+ clearable?: boolean;
24
+ clearLabel?: string;
25
+ loading?: boolean;
26
+ loadingPlaceholder?: string;
27
+ noResultsLabel?: (searchQuery: string) => string;
28
+ selectionLabel?: (selectedOptions: SourceOption[]) => string;
29
+ actions?: SelectAction[];
30
+ name?: string;
31
+ disabled?: boolean;
32
+ invalid?: boolean;
33
+ size?: SelectControlThemeVariants['size'];
34
+ variant?: SelectControlThemeVariants['variant'];
35
+ pill?: boolean;
36
+ block?: boolean;
37
+ leadingIcon?: Component;
38
+ trailingIcon?: Component | null;
39
+ side?: FloatingSide;
40
+ align?: FloatingAlign;
41
+ flip?: boolean;
42
+ strategy?: FloatingStrategy;
43
+ ui?: Partial<Record<SelectControlSlotName | SelectPanelSlotName, ClassNameValue>>;
44
+ class?: ClassNameValue;
45
+ }
46
+ export interface SelectSlots<SourceOption> {
47
+ option?: (optionSlotProps: {
48
+ option: SourceOption;
49
+ selected: boolean;
50
+ }) => unknown;
51
+ selection?: (selectionSlotProps: {
52
+ selectedOptions: SourceOption[];
53
+ }) => unknown;
54
+ search?: (searchSlotProps: {
55
+ searchAttributes: InputHTMLAttributes;
56
+ }) => unknown;
57
+ }
58
+ declare const _default: typeof __VLS_export;
59
+ export default _default;
60
+ declare const __VLS_export: <SourceOption = SelectOption, ValueKey extends string = "value", Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
61
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(SelectProps<SourceOption, ValueKey, Multiple> & {
62
+ modelValue?: SelectModelValue<SourceOption, ValueKey, Multiple>;
63
+ open?: boolean;
64
+ }) & {
65
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
66
+ "onUpdate:modelValue"?: ((value: SelectModelValue<SourceOption, ValueKey, Multiple> | undefined) => any) | undefined;
67
+ }> & (typeof globalThis extends {
68
+ __VLS_PROPS_FALLBACK: infer P;
69
+ } ? P : {});
70
+ expose: (exposed: {}) => void;
71
+ attrs: any;
72
+ slots: SelectSlots<SourceOption>;
73
+ emit: ((event: "update:open", value: boolean) => void) & ((event: "update:modelValue", value: SelectModelValue<SourceOption, ValueKey, Multiple> | undefined) => void);
74
+ }>) => import("vue").VNode & {
75
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
76
+ };
77
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
78
+ [K in keyof T]: T[K];
79
+ } : {
80
+ [K in keyof T as K]: T[K];
81
+ }) & {};
@@ -0,0 +1,70 @@
1
+ import type { SelectModelValue, SelectSlots } from './Select.vue';
2
+ import type { Component } from 'vue';
3
+ import type { FloatingAlign, FloatingSide, FloatingStrategy } from '../../shared/types/floating-position';
4
+ import type { ClassNameValue } from '../../shared/utils/tv';
5
+ import type { SelectFieldControlSlotName, SelectFieldControlThemeVariants } from '../../elements/select-field-control';
6
+ import type { SelectPanelSlotName } from './select-panel.theme';
7
+ import type { SelectOption, SelectOptionEntry } from './selectOptions';
8
+ import type { SelectAction } from './useSelectListbox';
9
+ export interface SelectFieldProps<SourceOption = SelectOption, ValueKey extends string = 'value', Multiple extends boolean = false> {
10
+ label: string;
11
+ options: SelectOptionEntry<SourceOption>[];
12
+ id?: string;
13
+ multiple?: Multiple & boolean;
14
+ valueKey?: ValueKey;
15
+ labelKey?: string;
16
+ descriptionKey?: string;
17
+ avatarKey?: string;
18
+ placeholder?: string;
19
+ searchable?: boolean;
20
+ searchPlacement?: 'list' | 'field';
21
+ searchPlaceholder?: string;
22
+ clearable?: boolean;
23
+ clearLabel?: string;
24
+ loading?: boolean;
25
+ loadingLabel?: string;
26
+ noResultsLabel?: (searchQuery: string) => string;
27
+ selectionLabel?: (selectedOptions: SourceOption[]) => string;
28
+ actions?: SelectAction[];
29
+ name?: string;
30
+ hint?: string;
31
+ errorMessage?: string;
32
+ invalid?: boolean;
33
+ disabled?: boolean;
34
+ size?: SelectFieldControlThemeVariants['size'];
35
+ variant?: SelectFieldControlThemeVariants['variant'];
36
+ pill?: boolean;
37
+ floatLabel?: SelectFieldControlThemeVariants['floatLabel'];
38
+ leadingIcon?: Component;
39
+ trailingIcon?: Component | null;
40
+ side?: FloatingSide;
41
+ align?: FloatingAlign;
42
+ flip?: boolean;
43
+ strategy?: FloatingStrategy;
44
+ ui?: Partial<Record<SelectFieldControlSlotName | SelectPanelSlotName, ClassNameValue>>;
45
+ class?: ClassNameValue;
46
+ }
47
+ declare const _default: typeof __VLS_export;
48
+ export default _default;
49
+ declare const __VLS_export: <SourceOption = SelectOption, ValueKey extends string = "value", Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
50
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<(SelectFieldProps<SourceOption, ValueKey, Multiple> & {
51
+ modelValue?: SelectModelValue<SourceOption, ValueKey, Multiple>;
52
+ open?: boolean;
53
+ }) & {
54
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
55
+ "onUpdate:modelValue"?: ((value: SelectModelValue<SourceOption, ValueKey, Multiple> | undefined) => any) | undefined;
56
+ }> & (typeof globalThis extends {
57
+ __VLS_PROPS_FALLBACK: infer P;
58
+ } ? P : {});
59
+ expose: (exposed: {}) => void;
60
+ attrs: any;
61
+ slots: SelectSlots<SourceOption>;
62
+ emit: ((event: "update:open", value: boolean) => void) & ((event: "update:modelValue", value: SelectModelValue<SourceOption, ValueKey, Multiple> | undefined) => void);
63
+ }>) => import("vue").VNode & {
64
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
65
+ };
66
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
67
+ [K in keyof T]: T[K];
68
+ } : {
69
+ [K in keyof T as K]: T[K];
70
+ }) & {};
@@ -0,0 +1,33 @@
1
+ import type { ClassNameValue } from '../../shared/utils/tv';
2
+ import { type SelectPanelSlotName } from './select-panel.theme';
3
+ import type { ResolvedSelectOption } from './selectOptions';
4
+ type __VLS_Props = {
5
+ resolvedOption: ResolvedSelectOption;
6
+ selected: boolean;
7
+ highlighted: boolean;
8
+ ui?: Partial<Record<SelectPanelSlotName, ClassNameValue>>;
9
+ };
10
+ declare const __VLS_template: () => {
11
+ __VLS_Slots: {
12
+ default?: (props: {
13
+ option: unknown;
14
+ selected: boolean;
15
+ }) => any;
16
+ };
17
+ };
18
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
19
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ select: () => any;
21
+ highlight: () => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
+ onSelect?: (() => any) | undefined;
24
+ onHighlight?: (() => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
29
+ type __VLS_WithSlots<T, S> = T & {
30
+ new (): {
31
+ $slots: S;
32
+ };
33
+ };
@@ -0,0 +1,67 @@
1
+ import { type InputHTMLAttributes } from 'vue';
2
+ import type { FloatingAlign, FloatingSide, FloatingStrategy } from '../../shared/types/floating-position';
3
+ import type { ClassNameValue } from '../../shared/utils/tv';
4
+ import { type SelectPanelSlotName } from './select-panel.theme';
5
+ import { type ResolvedSelectEntry, type ResolvedSelectOption } from './selectOptions';
6
+ import { type SelectAction } from './useSelectListbox';
7
+ type __VLS_Props = {
8
+ listboxId: string;
9
+ label: string;
10
+ visibleEntries: ResolvedSelectEntry[];
11
+ isOptionSelected: (resolvedOption: ResolvedSelectOption) => boolean;
12
+ highlightedItemId?: string;
13
+ multiple: boolean;
14
+ showsSearchInput: boolean;
15
+ searchPlaceholder: string;
16
+ noResultsLabel: (searchQuery: string) => string;
17
+ actions: SelectAction[];
18
+ anchorElement: HTMLElement | null | undefined;
19
+ side: FloatingSide;
20
+ align: FloatingAlign;
21
+ flip: boolean;
22
+ strategy: FloatingStrategy;
23
+ ui?: Partial<Record<SelectPanelSlotName, ClassNameValue>>;
24
+ };
25
+ type __VLS_ModelProps = {
26
+ 'searchQuery': string;
27
+ };
28
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
+ declare const __VLS_template: () => {
30
+ __VLS_Slots: {
31
+ search?: (props: {
32
+ searchAttributes: InputHTMLAttributes;
33
+ }) => any;
34
+ } & {
35
+ option?: (props: {
36
+ option: unknown;
37
+ selected: boolean;
38
+ }) => any;
39
+ } & {
40
+ option?: (props: {
41
+ option: unknown;
42
+ selected: boolean;
43
+ }) => any;
44
+ };
45
+ };
46
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
47
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
+ selectOption: (resolvedOption: ResolvedSelectOption<unknown>) => any;
49
+ runSelectAction: (selectAction: SelectAction, selectEvent: MouseEvent) => any;
50
+ highlightItem: (itemId: string) => any;
51
+ searchKeydown: (keyboardEvent: KeyboardEvent) => any;
52
+ "update:searchQuery": (value: string) => any;
53
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
54
+ onSelectOption?: ((resolvedOption: ResolvedSelectOption<unknown>) => any) | undefined;
55
+ onRunSelectAction?: ((selectAction: SelectAction, selectEvent: MouseEvent) => any) | undefined;
56
+ onHighlightItem?: ((itemId: string) => any) | undefined;
57
+ onSearchKeydown?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
58
+ "onUpdate:searchQuery"?: ((value: string) => any) | undefined;
59
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
60
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
61
+ declare const _default: typeof __VLS_export;
62
+ export default _default;
63
+ type __VLS_WithSlots<T, S> = T & {
64
+ new (): {
65
+ $slots: S;
66
+ };
67
+ };
@@ -0,0 +1,6 @@
1
+ export { default as KSelect } from './Select.vue';
2
+ export { default as KSelectField } from './SelectField.vue';
3
+ export type { SelectModelValue, SelectOptionValue, SelectProps, SelectSlots } from './Select.vue';
4
+ export type { SelectFieldProps } from './SelectField.vue';
5
+ export type { SelectOption, SelectOptionAvatar, SelectOptionEntry, SelectOptionGroup } from './selectOptions';
6
+ export type { SelectAction } from './useSelectListbox';
@@ -0,0 +1,55 @@
1
+ import { type VariantProps } from '../../shared/utils/tv';
2
+ export declare const selectPanelTheme: import("tailwind-variants").TVReturnType<{
3
+ optionSelected: {
4
+ true: {
5
+ option: string;
6
+ };
7
+ };
8
+ optionDisabled: {
9
+ true: {
10
+ option: string;
11
+ };
12
+ false: {
13
+ option: string;
14
+ };
15
+ };
16
+ highlighted: {
17
+ true: {
18
+ option: string;
19
+ action: string;
20
+ };
21
+ };
22
+ optionLayout: {
23
+ text: {
24
+ option: string;
25
+ };
26
+ avatar: {
27
+ option: string;
28
+ optionAvatar: string;
29
+ };
30
+ avatarWithDescription: {
31
+ option: string;
32
+ };
33
+ };
34
+ }, {
35
+ panel: string;
36
+ search: string;
37
+ searchIcon: string;
38
+ searchInput: string;
39
+ optionList: string;
40
+ group: string;
41
+ groupLabel: string;
42
+ option: string;
43
+ optionIndicator: string;
44
+ optionCheckIcon: string;
45
+ optionAvatar: string;
46
+ optionText: string;
47
+ optionLabel: string;
48
+ optionDescription: string;
49
+ noResults: string;
50
+ actions: string;
51
+ action: string;
52
+ actionIcon: string;
53
+ }, undefined, undefined, undefined, undefined>;
54
+ export type SelectPanelThemeVariants = VariantProps<typeof selectPanelTheme>;
55
+ export type SelectPanelSlotName = keyof ReturnType<typeof selectPanelTheme>;
@@ -0,0 +1,43 @@
1
+ import type { AvatarProps } from '../../elements/avatar';
2
+ export type SelectOptionAvatar = Pick<AvatarProps, 'imageUrl' | 'initials' | 'icon' | 'color' | 'variant' | 'pill'>;
3
+ export interface SelectOption {
4
+ value: string | number;
5
+ label: string;
6
+ description?: string;
7
+ disabled?: boolean;
8
+ avatar?: SelectOptionAvatar | string;
9
+ }
10
+ export interface SelectOptionGroup<SourceOption = SelectOption> {
11
+ label: string;
12
+ options: SourceOption[];
13
+ }
14
+ export type SelectOptionEntry<SourceOption = SelectOption> = SourceOption | SelectOptionGroup<SourceOption>;
15
+ export interface SelectOptionFieldKeys {
16
+ valueKey: string;
17
+ labelKey: string;
18
+ descriptionKey: string;
19
+ avatarKey: string;
20
+ }
21
+ export interface ResolvedSelectOption<SourceOption = unknown> {
22
+ optionId: string;
23
+ value: unknown;
24
+ label: string;
25
+ description?: string;
26
+ disabled: boolean;
27
+ avatar?: SelectOptionAvatar;
28
+ sourceOption: SourceOption;
29
+ }
30
+ export interface ResolvedSelectGroup<SourceOption = unknown> {
31
+ groupLabel: string;
32
+ options: ResolvedSelectOption<SourceOption>[];
33
+ }
34
+ export type ResolvedSelectEntry<SourceOption = unknown> = ResolvedSelectOption<SourceOption> | ResolvedSelectGroup<SourceOption>;
35
+ export declare function isSelectOptionGroup<SourceOption>(optionEntry: SelectOptionEntry<SourceOption>): optionEntry is SelectOptionGroup<SourceOption>;
36
+ export declare function isResolvedSelectGroup<SourceOption>(resolvedEntry: ResolvedSelectEntry<SourceOption>): resolvedEntry is ResolvedSelectGroup<SourceOption>;
37
+ /** Read a field of an option, following dotted paths such as "profile.name". */
38
+ export declare function readOptionField(sourceOption: unknown, fieldPath: string): unknown;
39
+ /** Turn the options given to a select, raw API objects included, into options it can display. */
40
+ export declare function resolveSelectEntries<SourceOption>(optionEntries: SelectOptionEntry<SourceOption>[], fieldKeys: SelectOptionFieldKeys, optionIdPrefix: string): ResolvedSelectEntry<SourceOption>[];
41
+ /** Keep the options whose label contains the search query, and drop the groups left empty. */
42
+ export declare function filterSelectEntries<SourceOption>(resolvedEntries: ResolvedSelectEntry<SourceOption>[], searchQuery: string): ResolvedSelectEntry<SourceOption>[];
43
+ export declare function collectSelectOptions<SourceOption>(resolvedEntries: ResolvedSelectEntry<SourceOption>[]): ResolvedSelectOption<SourceOption>[];
@@ -0,0 +1,77 @@
1
+ import { type Component, type Ref } from 'vue';
2
+ import type { SelectOptionEntry } from './selectOptions';
3
+ import { type SelectAction } from './useSelectListbox';
4
+ export interface SelectControlProps<SourceOption> {
5
+ options: SelectOptionEntry<SourceOption>[];
6
+ multiple?: boolean;
7
+ valueKey?: string;
8
+ labelKey: string;
9
+ descriptionKey: string;
10
+ avatarKey: string;
11
+ searchable?: boolean;
12
+ searchPlacement?: 'list' | 'field';
13
+ clearable?: boolean;
14
+ loading?: boolean;
15
+ disabled?: boolean;
16
+ selectionLabel?: (selectedOptions: SourceOption[]) => string;
17
+ actions: SelectAction[];
18
+ trailingIcon?: Component | null;
19
+ }
20
+ interface SelectControlElements {
21
+ selectedValue: Ref<unknown>;
22
+ isOpen: Ref<boolean>;
23
+ rootElement: Readonly<Ref<HTMLElement | null>>;
24
+ triggerElement: Readonly<Ref<HTMLElement | null>>;
25
+ layerElement: Readonly<Ref<HTMLElement | null>>;
26
+ hasSelectionSlot: () => boolean;
27
+ }
28
+ /** Share between the select and the select field what their trigger shows and does, on top of their listbox. */
29
+ export declare function useSelectControl<SourceOption>(controlProps: SelectControlProps<SourceOption>, controlElements: SelectControlElements): {
30
+ isOpenable: import("vue").ComputedRef<boolean>;
31
+ searchesInTrigger: import("vue").ComputedRef<boolean>;
32
+ navigatesFromTrigger: import("vue").ComputedRef<boolean>;
33
+ triggerSearchValue: import("vue").ComputedRef<string>;
34
+ openTriggerSearchFromClick: (clickEvent: MouseEvent, triggerSearchInput: HTMLInputElement | null) => void;
35
+ searchFromTriggerInput: (inputEvent: Event) => void;
36
+ hasSelection: import("vue").ComputedRef<boolean>;
37
+ selectedSourceOptions: import("vue").ComputedRef<SourceOption[]>;
38
+ selectedLabels: import("vue").ComputedRef<string>;
39
+ selectionText: import("vue").ComputedRef<string>;
40
+ announcesSelectedLabelsSeparately: import("vue").ComputedRef<boolean>;
41
+ selectedAvatar: import("vue").ComputedRef<{
42
+ initials: string;
43
+ pill?: boolean | undefined;
44
+ variant?: "solid" | "soft" | undefined;
45
+ color?: "primary" | "secondary" | "gray" | "danger" | "success" | "info" | "discovery" | undefined;
46
+ icon?: Component | undefined;
47
+ imageUrl?: string | undefined;
48
+ } | undefined>;
49
+ resolvedTrailingIcon: import("vue").ComputedRef<Component | import("vue").FunctionalComponent<import("lucide-vue-next").LucideProps, {}, any, {}> | null>;
50
+ showsTrailingIcon: import("vue").ComputedRef<boolean>;
51
+ showsClearButton: import("vue").ComputedRef<boolean>;
52
+ clearSelectionFromButton: () => void;
53
+ listboxId: string;
54
+ searchQuery: import("vue").ShallowRef<string, string>;
55
+ hasStartedTriggerSearch: import("vue").ShallowRef<boolean, boolean>;
56
+ highlightedItemId: import("vue").ShallowRef<string | undefined, string | undefined>;
57
+ visibleEntries: import("vue").ComputedRef<import("./selectOptions").ResolvedSelectEntry<unknown>[]>;
58
+ visibleOptions: import("vue").ComputedRef<import("./selectOptions").ResolvedSelectOption<unknown>[]>;
59
+ selectedValues: import("vue").ComputedRef<unknown[]>;
60
+ selectedOptions: import("vue").ComputedRef<import("./selectOptions").ResolvedSelectOption<unknown>[]>;
61
+ isOptionSelected: (resolvedOption: import("./selectOptions").ResolvedSelectOption) => boolean;
62
+ highlightItem: (itemId: string | undefined) => void;
63
+ openListbox: (highlightTarget?: import("./useSelectListbox").SelectHighlightTarget) => void;
64
+ closeListbox: ({ restoreFocus }: {
65
+ restoreFocus: boolean;
66
+ }) => void;
67
+ toggleListbox: () => void;
68
+ selectOption: (resolvedOption: import("./selectOptions").ResolvedSelectOption) => void;
69
+ clearSelection: () => void;
70
+ runSelectAction: (selectAction: SelectAction, selectEvent: Event) => void;
71
+ handleTriggerKeydown: (keyboardEvent: KeyboardEvent) => void;
72
+ handleSearchKeydown: (keyboardEvent: KeyboardEvent) => void;
73
+ handleSearchTriggerKeydown: (keyboardEvent: KeyboardEvent) => void;
74
+ handleSearchTriggerPaste: (clipboardEvent: ClipboardEvent) => void;
75
+ searchFromTrigger: (typedQuery: string) => void;
76
+ };
77
+ export {};