@kuina-ui/vue 0.1.1 → 0.3.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.
- package/dist/{elements → components}/alert/Alert.vue.d.ts +14 -3
- package/dist/{elements → components}/alert/alert.theme.d.ts +1 -0
- package/dist/components/avatar-group/AvatarGroup.vue.d.ts +1 -1
- package/dist/components/date-picker/DateCalendar.vue.d.ts +40 -0
- package/dist/components/date-picker/DateCalendarMonth.vue.d.ts +27 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +44 -0
- package/dist/components/date-picker/DatePickerPanel.vue.d.ts +33 -0
- package/dist/components/date-picker/DateRangePicker.vue.d.ts +54 -0
- package/dist/components/date-picker/date-calendar.theme.d.ts +69 -0
- package/dist/components/date-picker/date-picker.theme.d.ts +19 -0
- package/dist/components/date-picker/datePickerProps.d.ts +39 -0
- package/dist/components/date-picker/index.d.ts +4 -0
- package/dist/components/date-picker/useDatePickerPopover.d.ts +21 -0
- package/dist/components/menu/Menu.vue.d.ts +87 -0
- package/dist/components/menu/MenuItemRow.vue.d.ts +18 -0
- package/dist/components/menu/MenuPanel.vue.d.ts +24 -0
- package/dist/components/menu/index.d.ts +3 -0
- package/dist/components/menu/menu.theme.d.ts +109 -0
- package/dist/components/menu/menuContext.d.ts +27 -0
- package/dist/components/menu/menuEntries.d.ts +10 -0
- package/dist/components/select/Select.vue.d.ts +81 -0
- package/dist/components/select/SelectField.vue.d.ts +70 -0
- package/dist/components/select/SelectOptionRow.vue.d.ts +33 -0
- package/dist/components/select/SelectPanel.vue.d.ts +67 -0
- package/dist/components/select/index.d.ts +6 -0
- package/dist/components/select/select-field.theme.d.ts +250 -0
- package/dist/components/select/select-panel.theme.d.ts +55 -0
- package/dist/components/select/selectOptions.d.ts +43 -0
- package/dist/components/select/useSelectControl.d.ts +77 -0
- package/dist/components/select/useSelectListbox.d.ts +48 -0
- package/dist/components/text-field/TextField.vue.d.ts +4 -1
- package/dist/components/text-field/text-field.theme.d.ts +6 -1
- package/dist/components/textarea/Textarea.vue.d.ts +4 -1
- package/dist/components/textarea/textarea.theme.d.ts +6 -1
- package/dist/elements/avatar/Avatar.vue.d.ts +3 -3
- package/dist/elements/badge/Badge.vue.d.ts +2 -2
- package/dist/elements/button/Button.vue.d.ts +4 -4
- package/dist/elements/checkbox/Checkbox.vue.d.ts +2 -2
- package/dist/elements/radio-group/RadioGroup.vue.d.ts +1 -1
- package/dist/elements/select-control/SelectControl.vue.d.ts +56 -0
- package/dist/elements/select-control/index.d.ts +3 -0
- package/dist/elements/select-control/select-control.theme.d.ts +87 -0
- package/dist/elements/switch/Switch.vue.d.ts +2 -2
- package/dist/elements/text-link/TextLink.vue.d.ts +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +1 -1
- package/dist/nuxt.js +13 -8
- package/dist/shared/composables/useApplePlatform.d.ts +2 -0
- package/dist/shared/composables/useCalendarLabels.d.ts +19 -0
- package/dist/shared/composables/useDismissOnOutsidePointerDown.d.ts +9 -0
- package/dist/shared/composables/useFloatingPosition.d.ts +20 -0
- package/dist/shared/composables/useShortcuts.d.ts +9 -0
- package/dist/shared/types/calendar.d.ts +14 -0
- package/dist/shared/types/floating-position.d.ts +28 -0
- package/dist/shared/types/shortcut.d.ts +28 -0
- package/dist/shared/utils/calendarMonth.d.ts +5 -0
- package/dist/shared/utils/computeFloatingPosition.d.ts +5 -0
- package/dist/shared/utils/createDateFormatters.d.ts +9 -0
- package/dist/shared/utils/createShortcutHandler.d.ts +3 -0
- package/dist/shared/utils/createTypeaheadSearch.d.ts +2 -0
- package/dist/shared/utils/editableFieldGuard.d.ts +3 -0
- package/dist/shared/utils/flipFloatingPosition.d.ts +3 -0
- package/dist/shared/utils/floatingPanelTransition.d.ts +9 -0
- package/dist/shared/utils/formatShortcut.d.ts +2 -0
- package/dist/shared/utils/isApplePlatform.d.ts +2 -0
- package/dist/shared/utils/isExternalUrl.d.ts +2 -0
- package/dist/shared/utils/isoDate.d.ts +18 -0
- package/dist/shared/utils/parseShortcut.d.ts +3 -0
- package/dist/src-Cl5gtlze.js +6369 -0
- package/package.json +4 -1
- package/dist/src-CcuBQU4y.js +0 -2371
- /package/dist/{elements → components}/alert/index.d.ts +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { FloatingStrategy } from '../../shared/types/floating-position';
|
|
3
|
+
import type { MenuItem, MenuItemAction, MenuProps } from './Menu.vue';
|
|
4
|
+
export type MenuFocusTarget = 'panel' | 'firstItem' | 'lastItem';
|
|
5
|
+
export interface MenuFocusRequest {
|
|
6
|
+
focusTarget: MenuFocusTarget;
|
|
7
|
+
}
|
|
8
|
+
export interface MenuSettings {
|
|
9
|
+
ui: MenuProps['ui'];
|
|
10
|
+
indicatorPosition: NonNullable<MenuProps['indicatorPosition']>;
|
|
11
|
+
indicatorVariant: NonNullable<MenuProps['indicatorVariant']>;
|
|
12
|
+
strategy: FloatingStrategy;
|
|
13
|
+
flip: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface MenuContext {
|
|
16
|
+
menuSettings: Readonly<Ref<MenuSettings>>;
|
|
17
|
+
menuLayer: Readonly<Ref<HTMLElement | null>>;
|
|
18
|
+
usesApplePlatform: Readonly<Ref<boolean>>;
|
|
19
|
+
closeMenu: (closeOptions: {
|
|
20
|
+
restoreFocus: boolean;
|
|
21
|
+
}) => void;
|
|
22
|
+
selectMenuItem: (menuItem: MenuItem, selectEvent: Event) => void;
|
|
23
|
+
selectMenuItemAction: (menuItemAction: MenuItemAction, selectEvent: Event) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const menuContextKey: InjectionKey<MenuContext>;
|
|
26
|
+
/** Read what a menu shares with its panels and submenus. */
|
|
27
|
+
export declare function useMenuContext(): MenuContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ShortcutDefinitions } from '../../shared/types/shortcut';
|
|
2
|
+
import type { MenuEntry, MenuGroup, MenuHeader, MenuItem, MenuSeparator } from './Menu.vue';
|
|
3
|
+
export declare function isMenuSeparator(menuEntry: MenuEntry): menuEntry is MenuSeparator;
|
|
4
|
+
export declare function isMenuGroup(menuEntry: MenuEntry): menuEntry is MenuGroup;
|
|
5
|
+
export declare function isMenuHeader(menuEntry: MenuEntry): menuEntry is MenuHeader;
|
|
6
|
+
export declare function isMenuItem(menuEntry: MenuEntry): menuEntry is MenuItem;
|
|
7
|
+
/** List every selectable item of a menu, including the ones in groups and submenus. */
|
|
8
|
+
export declare function collectMenuItems(menuEntries: MenuEntry[]): MenuItem[];
|
|
9
|
+
/** Turn the shortcuts shown in menu items into shortcuts for useShortcuts, so pressing one selects its item. */
|
|
10
|
+
export declare function extractMenuShortcuts(menuEntries: MenuEntry[]): ShortcutDefinitions;
|
|
@@ -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 { SelectFieldSlotName, SelectFieldThemeVariants } from './select-field.theme';
|
|
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?: SelectFieldThemeVariants['size'];
|
|
35
|
+
variant?: SelectFieldThemeVariants['variant'];
|
|
36
|
+
pill?: boolean;
|
|
37
|
+
floatLabel?: SelectFieldThemeVariants['floatLabel'];
|
|
38
|
+
leadingIcon?: Component;
|
|
39
|
+
trailingIcon?: Component | null;
|
|
40
|
+
side?: FloatingSide;
|
|
41
|
+
align?: FloatingAlign;
|
|
42
|
+
flip?: boolean;
|
|
43
|
+
strategy?: FloatingStrategy;
|
|
44
|
+
ui?: Partial<Record<SelectFieldSlotName | 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,250 @@
|
|
|
1
|
+
import { type VariantProps } from '../../shared/utils/tv';
|
|
2
|
+
declare const selectFieldSizeScales: {
|
|
3
|
+
md: {
|
|
4
|
+
height: string;
|
|
5
|
+
fontSize: string;
|
|
6
|
+
leadingIconSize: string;
|
|
7
|
+
leadingAvatarSize: "3xs";
|
|
8
|
+
trailingIconSize: string;
|
|
9
|
+
loadingIndicatorSize: string;
|
|
10
|
+
clearButtonSize: string;
|
|
11
|
+
clearIconSize: string;
|
|
12
|
+
floatingLabelFontSize: string;
|
|
13
|
+
restingLabelFontSize: string;
|
|
14
|
+
pillShape: {
|
|
15
|
+
corners: string;
|
|
16
|
+
gutter: string;
|
|
17
|
+
labelOffset: string;
|
|
18
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
19
|
+
};
|
|
20
|
+
roundedShape: {
|
|
21
|
+
corners: string;
|
|
22
|
+
gutter: string;
|
|
23
|
+
labelOffset: string;
|
|
24
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
lg: {
|
|
28
|
+
height: string;
|
|
29
|
+
fontSize: string;
|
|
30
|
+
leadingIconSize: string;
|
|
31
|
+
leadingAvatarSize: "3xs";
|
|
32
|
+
trailingIconSize: string;
|
|
33
|
+
loadingIndicatorSize: string;
|
|
34
|
+
clearButtonSize: string;
|
|
35
|
+
clearIconSize: string;
|
|
36
|
+
floatingLabelFontSize: string;
|
|
37
|
+
restingLabelFontSize: string;
|
|
38
|
+
pillShape: {
|
|
39
|
+
corners: string;
|
|
40
|
+
gutter: string;
|
|
41
|
+
labelOffset: string;
|
|
42
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
43
|
+
};
|
|
44
|
+
roundedShape: {
|
|
45
|
+
corners: string;
|
|
46
|
+
gutter: string;
|
|
47
|
+
labelOffset: string;
|
|
48
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
xl: {
|
|
52
|
+
height: string;
|
|
53
|
+
fontSize: string;
|
|
54
|
+
leadingIconSize: string;
|
|
55
|
+
leadingAvatarSize: "2xs";
|
|
56
|
+
trailingIconSize: string;
|
|
57
|
+
loadingIndicatorSize: string;
|
|
58
|
+
clearButtonSize: string;
|
|
59
|
+
clearIconSize: string;
|
|
60
|
+
floatingLabelFontSize: string;
|
|
61
|
+
restingLabelFontSize: string;
|
|
62
|
+
pillShape: {
|
|
63
|
+
corners: string;
|
|
64
|
+
gutter: string;
|
|
65
|
+
labelOffset: string;
|
|
66
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
67
|
+
};
|
|
68
|
+
roundedShape: {
|
|
69
|
+
corners: string;
|
|
70
|
+
gutter: string;
|
|
71
|
+
labelOffset: string;
|
|
72
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
'2xl': {
|
|
76
|
+
height: string;
|
|
77
|
+
fontSize: string;
|
|
78
|
+
leadingIconSize: string;
|
|
79
|
+
leadingAvatarSize: "xs";
|
|
80
|
+
trailingIconSize: string;
|
|
81
|
+
loadingIndicatorSize: string;
|
|
82
|
+
clearButtonSize: string;
|
|
83
|
+
clearIconSize: string;
|
|
84
|
+
floatingLabelFontSize: string;
|
|
85
|
+
restingLabelFontSize: string;
|
|
86
|
+
pillShape: {
|
|
87
|
+
corners: string;
|
|
88
|
+
gutter: string;
|
|
89
|
+
labelOffset: string;
|
|
90
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
91
|
+
};
|
|
92
|
+
roundedShape: {
|
|
93
|
+
corners: string;
|
|
94
|
+
gutter: string;
|
|
95
|
+
labelOffset: string;
|
|
96
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
'3xl': {
|
|
100
|
+
height: string;
|
|
101
|
+
fontSize: string;
|
|
102
|
+
leadingIconSize: string;
|
|
103
|
+
leadingAvatarSize: "sm";
|
|
104
|
+
trailingIconSize: string;
|
|
105
|
+
loadingIndicatorSize: string;
|
|
106
|
+
clearButtonSize: string;
|
|
107
|
+
clearIconSize: string;
|
|
108
|
+
floatingLabelFontSize: string;
|
|
109
|
+
restingLabelFontSize: string;
|
|
110
|
+
pillShape: {
|
|
111
|
+
corners: string;
|
|
112
|
+
gutter: string;
|
|
113
|
+
labelOffset: string;
|
|
114
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
115
|
+
};
|
|
116
|
+
roundedShape: {
|
|
117
|
+
corners: string;
|
|
118
|
+
gutter: string;
|
|
119
|
+
labelOffset: string;
|
|
120
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
'4xl': {
|
|
124
|
+
height: string;
|
|
125
|
+
fontSize: string;
|
|
126
|
+
leadingIconSize: string;
|
|
127
|
+
leadingAvatarSize: "md";
|
|
128
|
+
trailingIconSize: string;
|
|
129
|
+
loadingIndicatorSize: string;
|
|
130
|
+
clearButtonSize: string;
|
|
131
|
+
clearIconSize: string;
|
|
132
|
+
floatingLabelFontSize: string;
|
|
133
|
+
restingLabelFontSize: string;
|
|
134
|
+
pillShape: {
|
|
135
|
+
corners: string;
|
|
136
|
+
gutter: string;
|
|
137
|
+
labelOffset: string;
|
|
138
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
139
|
+
};
|
|
140
|
+
roundedShape: {
|
|
141
|
+
corners: string;
|
|
142
|
+
gutter: string;
|
|
143
|
+
labelOffset: string;
|
|
144
|
+
restingLabelOffsetWithLeadingIcon: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
type SelectFieldSizeName = keyof typeof selectFieldSizeScales;
|
|
149
|
+
export declare function findSelectFieldAvatarSize(selectFieldSize: SelectFieldSizeName): "3xs" | "2xs" | "xs" | "sm" | "md";
|
|
150
|
+
export declare const selectFieldTheme: import("tailwind-variants").TVReturnType<{
|
|
151
|
+
size: Record<"md" | "lg" | "xl" | "2xl" | "3xl" | "4xl", {
|
|
152
|
+
base: string[];
|
|
153
|
+
leadingIcon: string;
|
|
154
|
+
trailingIcon: string;
|
|
155
|
+
loadingIndicator: string;
|
|
156
|
+
clearButton: string;
|
|
157
|
+
clearIcon: string;
|
|
158
|
+
}>;
|
|
159
|
+
variant: {
|
|
160
|
+
outline: string;
|
|
161
|
+
soft: string;
|
|
162
|
+
};
|
|
163
|
+
pill: {
|
|
164
|
+
true: string;
|
|
165
|
+
false: string;
|
|
166
|
+
};
|
|
167
|
+
fieldState: {
|
|
168
|
+
invalid: {
|
|
169
|
+
base: string;
|
|
170
|
+
label: string;
|
|
171
|
+
};
|
|
172
|
+
disabled: {
|
|
173
|
+
label: string;
|
|
174
|
+
};
|
|
175
|
+
open: {
|
|
176
|
+
base: string;
|
|
177
|
+
label: string;
|
|
178
|
+
};
|
|
179
|
+
idle: {
|
|
180
|
+
label: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
floatLabel: {
|
|
184
|
+
auto: string;
|
|
185
|
+
always: {
|
|
186
|
+
placeholder: string;
|
|
187
|
+
input: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
labelFloating: {
|
|
191
|
+
true: {
|
|
192
|
+
label: string;
|
|
193
|
+
};
|
|
194
|
+
false: {
|
|
195
|
+
label: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
hasLeadingIcon: {
|
|
199
|
+
true: string;
|
|
200
|
+
false: string;
|
|
201
|
+
};
|
|
202
|
+
disabled: {
|
|
203
|
+
true: {
|
|
204
|
+
container: string;
|
|
205
|
+
base: string;
|
|
206
|
+
};
|
|
207
|
+
false: {
|
|
208
|
+
base: string;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
open: {
|
|
212
|
+
true: {
|
|
213
|
+
trailingIcon: string;
|
|
214
|
+
placeholder: string;
|
|
215
|
+
};
|
|
216
|
+
false: {
|
|
217
|
+
trailingIcon: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
hasTrailingIcon: {
|
|
221
|
+
true: {
|
|
222
|
+
clearButton: string;
|
|
223
|
+
};
|
|
224
|
+
false: {
|
|
225
|
+
clearButton: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
}, {
|
|
229
|
+
root: string;
|
|
230
|
+
container: string;
|
|
231
|
+
base: string;
|
|
232
|
+
leadingIcon: string;
|
|
233
|
+
leadingAvatar: string;
|
|
234
|
+
value: string;
|
|
235
|
+
input: string;
|
|
236
|
+
placeholder: string;
|
|
237
|
+
selectionForScreenReaders: string;
|
|
238
|
+
trailing: string;
|
|
239
|
+
clearButton: string;
|
|
240
|
+
clearIcon: string;
|
|
241
|
+
loadingIndicator: string;
|
|
242
|
+
trailingIcon: string;
|
|
243
|
+
label: string;
|
|
244
|
+
hint: string;
|
|
245
|
+
errorMessage: string;
|
|
246
|
+
errorIcon: string;
|
|
247
|
+
}, undefined, undefined, undefined, undefined>;
|
|
248
|
+
export type SelectFieldThemeVariants = VariantProps<typeof selectFieldTheme>;
|
|
249
|
+
export type SelectFieldSlotName = keyof ReturnType<typeof selectFieldTheme>;
|
|
250
|
+
export {};
|
|
@@ -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>[];
|