@sewadah/selaras 0.7.1 → 0.9.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/README.md +1 -1
- package/dist/agent/catalog.json +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/Autocomplete.vue +6 -0
- package/dist/runtime/components/AvatarGroup.vue +3 -2
- package/dist/runtime/components/CodeGroup.vue +3 -15
- package/dist/runtime/components/ColorModeSwitch.vue +5 -4
- package/dist/runtime/components/ColorModeToggle.vue +5 -4
- package/dist/runtime/components/Input.d.vue.ts +7 -4
- package/dist/runtime/components/Input.vue +22 -5
- package/dist/runtime/components/Input.vue.d.ts +7 -4
- package/dist/runtime/components/Listbox.d.vue.ts +28 -0
- package/dist/runtime/components/Listbox.vue +53 -0
- package/dist/runtime/components/Listbox.vue.d.ts +28 -0
- package/dist/runtime/components/Select.vue +6 -0
- package/dist/runtime/components/Textarea.d.vue.ts +7 -4
- package/dist/runtime/components/Textarea.vue +24 -7
- package/dist/runtime/components/Textarea.vue.d.ts +7 -4
- package/dist/runtime/components/TransferList.d.vue.ts +47 -0
- package/dist/runtime/components/TransferList.vue +67 -0
- package/dist/runtime/components/TransferList.vue.d.ts +47 -0
- package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +7 -63
- package/dist/runtime/internal/ComboboxSelectBase.vue +18 -5
- package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +7 -63
- package/dist/runtime/internal/ListSelectionForm.d.vue.ts +15 -0
- package/dist/runtime/internal/ListSelectionForm.vue +33 -0
- package/dist/runtime/internal/ListSelectionForm.vue.d.ts +15 -0
- package/dist/runtime/internal/ListboxBase.d.vue.ts +49 -0
- package/dist/runtime/internal/ListboxBase.vue +177 -0
- package/dist/runtime/internal/ListboxBase.vue.d.ts +49 -0
- package/dist/runtime/internal/ListboxOption.d.vue.ts +31 -0
- package/dist/runtime/internal/ListboxOption.vue +37 -0
- package/dist/runtime/internal/ListboxOption.vue.d.ts +31 -0
- package/dist/runtime/internal/TransferListBase.d.vue.ts +63 -0
- package/dist/runtime/internal/TransferListBase.vue +206 -0
- package/dist/runtime/internal/TransferListBase.vue.d.ts +63 -0
- package/dist/runtime/internal/color-mode-control.d.ts +7 -0
- package/dist/runtime/internal/color-mode-control.js +12 -0
- package/dist/runtime/internal/list-selection.d.ts +15 -0
- package/dist/runtime/internal/list-selection.js +43 -0
- package/dist/runtime/theme/input.d.ts +6 -0
- package/dist/runtime/theme/input.js +2 -0
- package/dist/runtime/theme/listbox.d.ts +131 -0
- package/dist/runtime/theme/listbox.js +27 -0
- package/dist/runtime/theme/select.d.ts +6 -0
- package/dist/runtime/theme/select.js +3 -1
- package/dist/runtime/theme/textarea.d.ts +6 -0
- package/dist/runtime/theme/textarea.js +2 -0
- package/dist/runtime/theme/transfer-list.d.ts +74 -0
- package/dist/runtime/theme/transfer-list.js +21 -0
- package/dist/runtime/theme-config.d.ts +10 -0
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/utils/field-adornments.d.ts +14 -0
- package/dist/runtime/utils/field-adornments.js +36 -0
- package/dist/runtime/utils/listbox-contracts.d.ts +31 -0
- package/dist/runtime/utils/listbox-contracts.js +0 -0
- package/dist/runtime/utils/messages.d.ts +7 -0
- package/dist/runtime/utils/messages.js +7 -0
- package/dist/runtime/utils/select-contracts.d.ts +3 -0
- package/dist/runtime/utils/slot-children.d.ts +2 -0
- package/dist/runtime/utils/slot-children.js +15 -0
- package/dist/runtime/utils/transfer-list-contracts.d.ts +48 -0
- package/dist/runtime/utils/transfer-list-contracts.js +0 -0
- package/package.json +5 -4
- package/skills/selaras/SKILL.md +7 -7
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getCurrentInstance } from "vue";
|
|
3
|
+
import TransferListBase from "../internal/TransferListBase.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
checked: { type: null, required: false },
|
|
6
|
+
sourceLabel: { type: String, required: false },
|
|
7
|
+
targetLabel: { type: String, required: false },
|
|
8
|
+
sourceSearchTerm: { type: String, required: false },
|
|
9
|
+
targetSearchTerm: { type: String, required: false },
|
|
10
|
+
showSelectAll: { type: Boolean, required: false, default: true },
|
|
11
|
+
layout: { type: String, required: false },
|
|
12
|
+
ui: { type: Object, required: false },
|
|
13
|
+
descriptionKey: { type: String, required: false },
|
|
14
|
+
items: { type: Array, required: true },
|
|
15
|
+
modelValue: { type: null, required: false },
|
|
16
|
+
defaultValue: { type: null, required: false },
|
|
17
|
+
valueKey: { type: void 0, required: false },
|
|
18
|
+
labelKey: { type: String, required: false },
|
|
19
|
+
searchable: { type: Boolean, required: false },
|
|
20
|
+
virtualize: { type: [Boolean, Object], required: false },
|
|
21
|
+
disabled: { type: Boolean, required: false },
|
|
22
|
+
loading: { type: Boolean, required: false },
|
|
23
|
+
invalid: { type: Boolean, required: false },
|
|
24
|
+
size: { type: null, required: false },
|
|
25
|
+
color: { type: null, required: false },
|
|
26
|
+
id: { type: String, required: false },
|
|
27
|
+
name: { type: String, required: false },
|
|
28
|
+
form: { type: String, required: false },
|
|
29
|
+
required: { type: Boolean, required: false }
|
|
30
|
+
});
|
|
31
|
+
const emit = defineEmits(["update:modelValue", "update:checked", "update:sourceSearchTerm", "update:targetSearchTerm", "transfer"]);
|
|
32
|
+
const slots = defineSlots();
|
|
33
|
+
const instance = getCurrentInstance();
|
|
34
|
+
function baseProps() {
|
|
35
|
+
const raw = instance.vnode.props ?? {};
|
|
36
|
+
const { modelValue, checked, ...rest } = props;
|
|
37
|
+
return {
|
|
38
|
+
...rest,
|
|
39
|
+
...Object.hasOwn(raw, "modelValue") || Object.hasOwn(raw, "model-value") ? { modelValue } : {},
|
|
40
|
+
...Object.hasOwn(raw, "checked") ? { checked } : {}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<TransferListBase
|
|
47
|
+
v-bind="baseProps()"
|
|
48
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
49
|
+
@update:checked="emit('update:checked', $event)"
|
|
50
|
+
@update:source-search-term="emit('update:sourceSearchTerm', $event)"
|
|
51
|
+
@update:target-search-term="emit('update:targetSearchTerm', $event)"
|
|
52
|
+
@transfer="emit('transfer', $event)"
|
|
53
|
+
>
|
|
54
|
+
<template v-if="slots.item" #item="data">
|
|
55
|
+
<slot name="item" v-bind="data" />
|
|
56
|
+
</template>
|
|
57
|
+
<template v-for="name in ['source-header', 'target-header'].filter((name) => slots[name])" :key="name" #[name]="data">
|
|
58
|
+
<slot :name="name" v-bind="data" />
|
|
59
|
+
</template>
|
|
60
|
+
<template v-for="name in ['source-footer', 'target-footer'].filter((name) => slots[name])" :key="name" #[name]>
|
|
61
|
+
<slot :name="name" />
|
|
62
|
+
</template>
|
|
63
|
+
<template v-for="name in ['empty', 'empty-filter'].filter((name) => slots[name])" :key="name" #[name]="data">
|
|
64
|
+
<slot :name="name" v-bind="data" />
|
|
65
|
+
</template>
|
|
66
|
+
</TransferListBase>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SelectEntry } from '../utils/select-contracts.js';
|
|
2
|
+
import type { TransferListProps, TransferListSlots } from '../utils/transfer-list-contracts.js';
|
|
3
|
+
export type { TransferDirection, TransferListEmits, TransferListProps, TransferListSlots, TransferSide } from '../utils/transfer-list-contracts.js';
|
|
4
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value">(__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<{
|
|
5
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<TransferListProps<Entry, Key> & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
7
|
+
value: infer Value;
|
|
8
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => any) | undefined;
|
|
9
|
+
"onUpdate:checked"?: ((value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
10
|
+
value: infer Value;
|
|
11
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => any) | undefined;
|
|
12
|
+
"onUpdate:sourceSearchTerm"?: ((value: string) => any) | undefined;
|
|
13
|
+
"onUpdate:targetSearchTerm"?: ((value: string) => any) | undefined;
|
|
14
|
+
onTransfer?: ((payload: {
|
|
15
|
+
direction: import("./TransferList.vue.js").TransferDirection;
|
|
16
|
+
items: import("../utils/select-contracts.js").SelectEntryItem<Entry>[];
|
|
17
|
+
values: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
18
|
+
value: infer Value;
|
|
19
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[];
|
|
20
|
+
}) => any) | undefined;
|
|
21
|
+
}> & (typeof globalThis extends {
|
|
22
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
23
|
+
} ? P : {});
|
|
24
|
+
expose: (exposed: {}) => void;
|
|
25
|
+
attrs: any;
|
|
26
|
+
slots: TransferListSlots<Entry>;
|
|
27
|
+
emit: ((evt: "update:modelValue", value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
28
|
+
value: infer Value;
|
|
29
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => void) & ((evt: "update:checked", value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
30
|
+
value: infer Value;
|
|
31
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => void) & ((evt: "update:sourceSearchTerm", value: string) => void) & ((evt: "update:targetSearchTerm", value: string) => void) & ((evt: "transfer", payload: {
|
|
32
|
+
direction: import("./TransferList.vue.js").TransferDirection;
|
|
33
|
+
items: import("../utils/select-contracts.js").SelectEntryItem<Entry>[];
|
|
34
|
+
values: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
35
|
+
value: infer Value;
|
|
36
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[];
|
|
37
|
+
}) => void);
|
|
38
|
+
}>) => import("vue").VNode & {
|
|
39
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
40
|
+
};
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
44
|
+
[K in keyof T]: T[K];
|
|
45
|
+
} : {
|
|
46
|
+
[K in keyof T as K]: T[K];
|
|
47
|
+
}) & {};
|
|
@@ -2,12 +2,18 @@ import type { VariantProps } from 'tailwind-variants';
|
|
|
2
2
|
import type { SelectThemeSlots } from '../theme/select.js';
|
|
3
3
|
import type { RoundedArrowConfig } from '../utils/arrow.js';
|
|
4
4
|
import type { ColorRole } from '../utils/color-registry.js';
|
|
5
|
+
import type { FieldAdornmentSlotProps } from '../utils/field-adornments.js';
|
|
5
6
|
import type { OverlayPortal, OverlayPositioning } from '../utils/overlay.js';
|
|
6
7
|
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
7
8
|
import type { UiProp } from '../utils/ui.js';
|
|
8
|
-
import type { SelectItems
|
|
9
|
+
import type { SelectItems } from './combobox-select.js';
|
|
9
10
|
import { selectTheme } from '../theme/select.js';
|
|
10
11
|
type SelectVariants = VariantProps<typeof selectTheme>;
|
|
12
|
+
type __VLS_Slots = {
|
|
13
|
+
leading?: (props: FieldAdornmentSlotProps) => any;
|
|
14
|
+
trailing?: (props: FieldAdornmentSlotProps) => any;
|
|
15
|
+
[name: string]: ((props: any) => any) | undefined;
|
|
16
|
+
};
|
|
11
17
|
export interface ComboboxSelectBaseProps {
|
|
12
18
|
id?: string;
|
|
13
19
|
name?: string;
|
|
@@ -58,68 +64,6 @@ export interface ComboboxSelectBaseEmits {
|
|
|
58
64
|
'update:modelValue': [value: SelectModelValue | SelectModelValue[] | undefined];
|
|
59
65
|
'update:searchTerm': [value: string];
|
|
60
66
|
}
|
|
61
|
-
declare var __VLS_43: {
|
|
62
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
63
|
-
}, __VLS_98: {}, __VLS_105: {}, __VLS_120: {}, __VLS_136: {}, __VLS_143: {}, __VLS_150: {}, __VLS_174: {
|
|
64
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
65
|
-
}, __VLS_194: {
|
|
66
|
-
selected: import("./combobox-select.js").ResolvedOption | undefined;
|
|
67
|
-
}, __VLS_205: {}, __VLS_212: {}, __VLS_219: {}, __VLS_249: {}, __VLS_252: {}, __VLS_255: {}, __VLS_258: {}, __VLS_261: {
|
|
68
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
69
|
-
}, __VLS_264: {
|
|
70
|
-
group: import("./combobox-select.js").SelectOptionGroup<SelectModelValue>;
|
|
71
|
-
}, __VLS_267: {}, __VLS_305: string, __VLS_306: {}, __VLS_309: {}, __VLS_319: {
|
|
72
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
73
|
-
}, __VLS_322: {
|
|
74
|
-
group: import("./combobox-select.js").SelectOptionGroup<SelectModelValue>;
|
|
75
|
-
};
|
|
76
|
-
type __VLS_Slots = {} & {
|
|
77
|
-
[K in NonNullable<typeof __VLS_305>]?: (props: typeof __VLS_306) => any;
|
|
78
|
-
} & {
|
|
79
|
-
item?: (props: typeof __VLS_43) => any;
|
|
80
|
-
} & {
|
|
81
|
-
'clear-icon'?: (props: typeof __VLS_98) => any;
|
|
82
|
-
} & {
|
|
83
|
-
'loading-icon'?: (props: typeof __VLS_105) => any;
|
|
84
|
-
} & {
|
|
85
|
-
'dropdown-icon'?: (props: typeof __VLS_120) => any;
|
|
86
|
-
} & {
|
|
87
|
-
'clear-icon'?: (props: typeof __VLS_136) => any;
|
|
88
|
-
} & {
|
|
89
|
-
'loading-icon'?: (props: typeof __VLS_143) => any;
|
|
90
|
-
} & {
|
|
91
|
-
'dropdown-icon'?: (props: typeof __VLS_150) => any;
|
|
92
|
-
} & {
|
|
93
|
-
item?: (props: typeof __VLS_174) => any;
|
|
94
|
-
} & {
|
|
95
|
-
value?: (props: typeof __VLS_194) => any;
|
|
96
|
-
} & {
|
|
97
|
-
'clear-icon'?: (props: typeof __VLS_205) => any;
|
|
98
|
-
} & {
|
|
99
|
-
'loading-icon'?: (props: typeof __VLS_212) => any;
|
|
100
|
-
} & {
|
|
101
|
-
'dropdown-icon'?: (props: typeof __VLS_219) => any;
|
|
102
|
-
} & {
|
|
103
|
-
header?: (props: typeof __VLS_249) => any;
|
|
104
|
-
} & {
|
|
105
|
-
'filter-icon'?: (props: typeof __VLS_252) => any;
|
|
106
|
-
} & {
|
|
107
|
-
empty?: (props: typeof __VLS_255) => any;
|
|
108
|
-
} & {
|
|
109
|
-
'empty-filter'?: (props: typeof __VLS_258) => any;
|
|
110
|
-
} & {
|
|
111
|
-
item?: (props: typeof __VLS_261) => any;
|
|
112
|
-
} & {
|
|
113
|
-
group?: (props: typeof __VLS_264) => any;
|
|
114
|
-
} & {
|
|
115
|
-
footer?: (props: typeof __VLS_267) => any;
|
|
116
|
-
} & {
|
|
117
|
-
header?: (props: typeof __VLS_309) => any;
|
|
118
|
-
} & {
|
|
119
|
-
item?: (props: typeof __VLS_319) => any;
|
|
120
|
-
} & {
|
|
121
|
-
group?: (props: typeof __VLS_322) => any;
|
|
122
|
-
};
|
|
123
67
|
declare const __VLS_base: import("vue").DefineComponent<ComboboxSelectBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
124
68
|
"update:modelValue": (value: SelectModelValue | SelectModelValue[] | undefined) => any;
|
|
125
69
|
"update:open": (value: boolean) => any;
|
|
@@ -28,10 +28,11 @@ import { useIsMobile } from "../composables/use-media-query";
|
|
|
28
28
|
import { useMessages } from "../composables/use-messages";
|
|
29
29
|
import { selectTheme } from "../theme/select";
|
|
30
30
|
import { arrowContentProps, arrowElementProps } from "../utils/arrow";
|
|
31
|
+
import { useFieldAdornments } from "../utils/field-adornments";
|
|
31
32
|
import { isNativeInputA11yAttr, isNativeInputAttr, isNativeInputEvent } from "../utils/native-input";
|
|
32
33
|
import { overlayPortalProps } from "../utils/overlay";
|
|
33
34
|
import { resolveRegisteredColorRole } from "../utils/registered-colors";
|
|
34
|
-
import { resolveSlot, useComponentTheme, useFallthroughAttrs, useRootProps, useThemeBindings } from "../utils/ui";
|
|
35
|
+
import { applyClassPrefix, resolveSlot, useComponentTheme, useFallthroughAttrs, useRootProps, useThemeBindings } from "../utils/ui";
|
|
35
36
|
import { useComboboxSelect } from "./combobox-select";
|
|
36
37
|
import ComboboxSelectBody from "./ComboboxSelectBody.vue";
|
|
37
38
|
defineOptions({ inheritAttrs: false });
|
|
@@ -72,6 +73,8 @@ const props = defineProps({
|
|
|
72
73
|
ui: { type: Object, required: false }
|
|
73
74
|
});
|
|
74
75
|
const emit = defineEmits(["update:open", "update:modelValue", "update:searchTerm"]);
|
|
76
|
+
const slots = defineSlots();
|
|
77
|
+
const { leading, trailing, padding } = useFieldAdornments();
|
|
75
78
|
const instance = getCurrentInstance();
|
|
76
79
|
const initialValue = Array.isArray(props.defaultValue) ? [...props.defaultValue] : props.defaultValue;
|
|
77
80
|
const isControlled = () => Object.hasOwn(instance.vnode.props ?? {}, "modelValue") || Object.hasOwn(instance.vnode.props ?? {}, "model-value");
|
|
@@ -413,6 +416,7 @@ const searchDescribedBy = computed(() => [
|
|
|
413
416
|
].filter(Boolean).join(" ") || void 0);
|
|
414
417
|
const effectiveSize = computed(() => props.size ?? field?.size ?? "md");
|
|
415
418
|
const clearSize = computed(() => ({ sm: "sm", md: "sm", lg: "md" })[effectiveSize.value]);
|
|
419
|
+
const adornmentScope = computed(() => ({ disabled: !!props.disabled, size: effectiveSize.value, buttonSize: clearSize.value }));
|
|
416
420
|
const icons = useIcons();
|
|
417
421
|
const messages = useMessages();
|
|
418
422
|
const theme = useComponentTheme("select", selectTheme);
|
|
@@ -427,6 +431,9 @@ const triggerProps = computed(() => mergeProps(
|
|
|
427
431
|
resolveSlot(ui.value.trigger, props.ui?.trigger),
|
|
428
432
|
!props.creatable ? nativeTriggerAttrs.value : {}
|
|
429
433
|
));
|
|
434
|
+
function adornedTriggerProps() {
|
|
435
|
+
return mergeProps({ style: padding(!!slots.leading, !!slots.trailing) }, triggerProps.value);
|
|
436
|
+
}
|
|
430
437
|
const valueProps = computed(() => resolveSlot(ui.value.value, props.ui?.value));
|
|
431
438
|
const commaValueProps = computed(() => {
|
|
432
439
|
const override = props.ui?.value;
|
|
@@ -596,7 +603,10 @@ const bodyProps = computed(() => ({
|
|
|
596
603
|
@update:open="updateOpen($event)"
|
|
597
604
|
@update:model-value="(value2) => onComboboxValueUpdate(value2)"
|
|
598
605
|
>
|
|
599
|
-
<ComboboxAnchor>
|
|
606
|
+
<ComboboxAnchor :class="applyClassPrefix('relative')">
|
|
607
|
+
<fieldset v-if="slots.leading" ref="leading" :disabled="disabled" :inert="disabled || void 0" v-bind="resolveSlot(ui.leading, props.ui?.leading)">
|
|
608
|
+
<slot name="leading" v-bind="adornmentScope" />
|
|
609
|
+
</fieldset>
|
|
600
610
|
<!--
|
|
601
611
|
Select (creatable=false): a button trigger, opened by clicking anywhere
|
|
602
612
|
on it - the search input (if any) lives inside the popover instead.
|
|
@@ -608,7 +618,7 @@ const bodyProps = computed(() => ({
|
|
|
608
618
|
data-ui-group-item
|
|
609
619
|
:data-selaras-field-filled="selectedValues.length ? '' : void 0"
|
|
610
620
|
:data-selaras-field-active="open ? '' : void 0"
|
|
611
|
-
v-bind="
|
|
621
|
+
v-bind="adornedTriggerProps()"
|
|
612
622
|
@keydown.capture="onSearchKeydown"
|
|
613
623
|
>
|
|
614
624
|
<!--
|
|
@@ -745,7 +755,7 @@ const bodyProps = computed(() => ({
|
|
|
745
755
|
data-ui-group-item
|
|
746
756
|
:data-selaras-field-filled="selectedValues.length ? '' : void 0"
|
|
747
757
|
:data-selaras-field-active="open ? '' : void 0"
|
|
748
|
-
v-bind="
|
|
758
|
+
v-bind="adornedTriggerProps()"
|
|
749
759
|
@click="openMobileAutocomplete()"
|
|
750
760
|
>
|
|
751
761
|
<span v-if="multiple && selectedOptions.length" v-bind="commaValueProps">{{ commaText }}</span>
|
|
@@ -794,7 +804,7 @@ const bodyProps = computed(() => ({
|
|
|
794
804
|
:aria-invalid="selectInvalid || void 0"
|
|
795
805
|
:aria-describedby="describedBy"
|
|
796
806
|
:aria-busy="loading || void 0"
|
|
797
|
-
v-bind="mergeProps(
|
|
807
|
+
v-bind="mergeProps(adornedTriggerProps(), modalTriggerAttrs)"
|
|
798
808
|
tabindex="0"
|
|
799
809
|
@keydown="onTriggerKeydown"
|
|
800
810
|
@blur="selectedChipValue = void 0"
|
|
@@ -894,6 +904,9 @@ const bodyProps = computed(() => ({
|
|
|
894
904
|
</template>
|
|
895
905
|
<span v-if="loading" class="sr-only">{{ messages.loading }}</span>
|
|
896
906
|
</ComboboxTrigger>
|
|
907
|
+
<fieldset v-if="slots.trailing" ref="trailing" :disabled="disabled" :inert="disabled || void 0" v-bind="resolveSlot(ui.trailing, props.ui?.trailing)">
|
|
908
|
+
<slot name="trailing" v-bind="adornmentScope" />
|
|
909
|
+
</fieldset>
|
|
897
910
|
</ComboboxAnchor>
|
|
898
911
|
|
|
899
912
|
<ComboboxPortal v-if="!showMobileModal" v-bind="portalProps">
|
|
@@ -2,12 +2,18 @@ import type { VariantProps } from 'tailwind-variants';
|
|
|
2
2
|
import type { SelectThemeSlots } from '../theme/select.js';
|
|
3
3
|
import type { RoundedArrowConfig } from '../utils/arrow.js';
|
|
4
4
|
import type { ColorRole } from '../utils/color-registry.js';
|
|
5
|
+
import type { FieldAdornmentSlotProps } from '../utils/field-adornments.js';
|
|
5
6
|
import type { OverlayPortal, OverlayPositioning } from '../utils/overlay.js';
|
|
6
7
|
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
7
8
|
import type { UiProp } from '../utils/ui.js';
|
|
8
|
-
import type { SelectItems
|
|
9
|
+
import type { SelectItems } from './combobox-select.js';
|
|
9
10
|
import { selectTheme } from '../theme/select.js';
|
|
10
11
|
type SelectVariants = VariantProps<typeof selectTheme>;
|
|
12
|
+
type __VLS_Slots = {
|
|
13
|
+
leading?: (props: FieldAdornmentSlotProps) => any;
|
|
14
|
+
trailing?: (props: FieldAdornmentSlotProps) => any;
|
|
15
|
+
[name: string]: ((props: any) => any) | undefined;
|
|
16
|
+
};
|
|
11
17
|
export interface ComboboxSelectBaseProps {
|
|
12
18
|
id?: string;
|
|
13
19
|
name?: string;
|
|
@@ -58,68 +64,6 @@ export interface ComboboxSelectBaseEmits {
|
|
|
58
64
|
'update:modelValue': [value: SelectModelValue | SelectModelValue[] | undefined];
|
|
59
65
|
'update:searchTerm': [value: string];
|
|
60
66
|
}
|
|
61
|
-
declare var __VLS_43: {
|
|
62
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
63
|
-
}, __VLS_98: {}, __VLS_105: {}, __VLS_120: {}, __VLS_136: {}, __VLS_143: {}, __VLS_150: {}, __VLS_174: {
|
|
64
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
65
|
-
}, __VLS_194: {
|
|
66
|
-
selected: import("./combobox-select.js").ResolvedOption | undefined;
|
|
67
|
-
}, __VLS_205: {}, __VLS_212: {}, __VLS_219: {}, __VLS_249: {}, __VLS_252: {}, __VLS_255: {}, __VLS_258: {}, __VLS_261: {
|
|
68
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
69
|
-
}, __VLS_264: {
|
|
70
|
-
group: import("./combobox-select.js").SelectOptionGroup<SelectModelValue>;
|
|
71
|
-
}, __VLS_267: {}, __VLS_305: string, __VLS_306: {}, __VLS_309: {}, __VLS_319: {
|
|
72
|
-
item: SelectModelValue | SelectOption<SelectModelValue>;
|
|
73
|
-
}, __VLS_322: {
|
|
74
|
-
group: import("./combobox-select.js").SelectOptionGroup<SelectModelValue>;
|
|
75
|
-
};
|
|
76
|
-
type __VLS_Slots = {} & {
|
|
77
|
-
[K in NonNullable<typeof __VLS_305>]?: (props: typeof __VLS_306) => any;
|
|
78
|
-
} & {
|
|
79
|
-
item?: (props: typeof __VLS_43) => any;
|
|
80
|
-
} & {
|
|
81
|
-
'clear-icon'?: (props: typeof __VLS_98) => any;
|
|
82
|
-
} & {
|
|
83
|
-
'loading-icon'?: (props: typeof __VLS_105) => any;
|
|
84
|
-
} & {
|
|
85
|
-
'dropdown-icon'?: (props: typeof __VLS_120) => any;
|
|
86
|
-
} & {
|
|
87
|
-
'clear-icon'?: (props: typeof __VLS_136) => any;
|
|
88
|
-
} & {
|
|
89
|
-
'loading-icon'?: (props: typeof __VLS_143) => any;
|
|
90
|
-
} & {
|
|
91
|
-
'dropdown-icon'?: (props: typeof __VLS_150) => any;
|
|
92
|
-
} & {
|
|
93
|
-
item?: (props: typeof __VLS_174) => any;
|
|
94
|
-
} & {
|
|
95
|
-
value?: (props: typeof __VLS_194) => any;
|
|
96
|
-
} & {
|
|
97
|
-
'clear-icon'?: (props: typeof __VLS_205) => any;
|
|
98
|
-
} & {
|
|
99
|
-
'loading-icon'?: (props: typeof __VLS_212) => any;
|
|
100
|
-
} & {
|
|
101
|
-
'dropdown-icon'?: (props: typeof __VLS_219) => any;
|
|
102
|
-
} & {
|
|
103
|
-
header?: (props: typeof __VLS_249) => any;
|
|
104
|
-
} & {
|
|
105
|
-
'filter-icon'?: (props: typeof __VLS_252) => any;
|
|
106
|
-
} & {
|
|
107
|
-
empty?: (props: typeof __VLS_255) => any;
|
|
108
|
-
} & {
|
|
109
|
-
'empty-filter'?: (props: typeof __VLS_258) => any;
|
|
110
|
-
} & {
|
|
111
|
-
item?: (props: typeof __VLS_261) => any;
|
|
112
|
-
} & {
|
|
113
|
-
group?: (props: typeof __VLS_264) => any;
|
|
114
|
-
} & {
|
|
115
|
-
footer?: (props: typeof __VLS_267) => any;
|
|
116
|
-
} & {
|
|
117
|
-
header?: (props: typeof __VLS_309) => any;
|
|
118
|
-
} & {
|
|
119
|
-
item?: (props: typeof __VLS_319) => any;
|
|
120
|
-
} & {
|
|
121
|
-
group?: (props: typeof __VLS_322) => any;
|
|
122
|
-
};
|
|
123
67
|
declare const __VLS_base: import("vue").DefineComponent<ComboboxSelectBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
124
68
|
"update:modelValue": (value: SelectModelValue | SelectModelValue[] | undefined) => any;
|
|
125
69
|
"update:open": (value: boolean) => any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
values: SelectModelValue[];
|
|
4
|
+
name?: string;
|
|
5
|
+
form?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
reset: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onReset?: (() => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, onUnmounted, ref } from "vue";
|
|
3
|
+
import { applyClassPrefix } from "../utils/ui";
|
|
4
|
+
defineProps({
|
|
5
|
+
values: { type: Array, required: true },
|
|
6
|
+
name: { type: String, required: false },
|
|
7
|
+
form: { type: String, required: false },
|
|
8
|
+
required: { type: Boolean, required: false },
|
|
9
|
+
disabled: { type: Boolean, required: false }
|
|
10
|
+
});
|
|
11
|
+
const emit = defineEmits(["reset"]);
|
|
12
|
+
const anchor = ref();
|
|
13
|
+
let owner = null;
|
|
14
|
+
function reset(event) {
|
|
15
|
+
queueMicrotask(() => {
|
|
16
|
+
if (!event.defaultPrevented)
|
|
17
|
+
emit("reset");
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
owner = anchor.value?.form ?? null;
|
|
22
|
+
owner?.addEventListener("reset", reset);
|
|
23
|
+
});
|
|
24
|
+
onUnmounted(() => owner?.removeEventListener("reset", reset));
|
|
25
|
+
function serialize(value) {
|
|
26
|
+
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<input ref="anchor" :type="required ? 'text' : 'hidden'" :class="required ? applyClassPrefix('sr-only') : void 0" :form="form" :required="required && !disabled && !values.length" :disabled="disabled || !!values.length" aria-hidden="true" tabindex="-1" autocomplete="off">
|
|
32
|
+
<input v-for="(value, index) in values" :key="index" type="hidden" :name="name" :form="form" :value="serialize(value)" :disabled="disabled">
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
values: SelectModelValue[];
|
|
4
|
+
name?: string;
|
|
5
|
+
form?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
reset: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onReset?: (() => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ListboxProps } from '../utils/listbox-contracts.js';
|
|
2
|
+
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
3
|
+
import type { SelectItems } from './combobox-select.js';
|
|
4
|
+
export interface ListboxBaseProps extends Omit<ListboxProps, 'items' | 'valueKey' | 'labelKey' | 'descriptionKey' | 'multiple' | 'modelValue' | 'defaultValue'> {
|
|
5
|
+
items: SelectItems;
|
|
6
|
+
valueKey?: string;
|
|
7
|
+
labelKey?: string;
|
|
8
|
+
descriptionKey?: string;
|
|
9
|
+
multiple?: boolean;
|
|
10
|
+
modelValue?: SelectModelValue | SelectModelValue[];
|
|
11
|
+
defaultValue?: SelectModelValue | SelectModelValue[];
|
|
12
|
+
/** Composite panels must not inherit or submit their parent's form value. */
|
|
13
|
+
formField?: boolean;
|
|
14
|
+
}
|
|
15
|
+
type __VLS_Slots = {
|
|
16
|
+
'item'?: (props: {
|
|
17
|
+
item: SelectModelValue;
|
|
18
|
+
index: number;
|
|
19
|
+
selected: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}) => any;
|
|
22
|
+
'group'?: (props: {
|
|
23
|
+
group: {
|
|
24
|
+
label: string;
|
|
25
|
+
items: readonly SelectModelValue[];
|
|
26
|
+
};
|
|
27
|
+
}) => any;
|
|
28
|
+
'header'?: () => any;
|
|
29
|
+
'footer'?: () => any;
|
|
30
|
+
'empty'?: () => any;
|
|
31
|
+
'empty-filter'?: () => any;
|
|
32
|
+
};
|
|
33
|
+
declare const __VLS_base: import("vue").DefineComponent<ListboxBaseProps, {
|
|
34
|
+
focus: () => void | undefined;
|
|
35
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
"update:modelValue": (value: SelectModelValue | SelectModelValue[] | undefined) => any;
|
|
37
|
+
"update:searchTerm": (value: string) => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<ListboxBaseProps> & Readonly<{
|
|
39
|
+
"onUpdate:modelValue"?: ((value: SelectModelValue | SelectModelValue[] | undefined) => any) | undefined;
|
|
40
|
+
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
41
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|