@byyuurin/ui 0.0.9 → 0.0.11
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 +2 -5
- package/dist/module.json +3 -3
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/app/injections.d.ts +9323 -3
- package/dist/runtime/app/injections.js +35 -0
- package/dist/runtime/components/Accordion.vue +36 -69
- package/dist/runtime/components/Accordion.vue.d.ts +52 -0
- package/dist/runtime/components/Alert.vue +37 -75
- package/dist/runtime/components/Alert.vue.d.ts +59 -0
- package/dist/runtime/components/App.vue +25 -40
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +31 -51
- package/dist/runtime/components/Avatar.vue.d.ts +25 -0
- package/dist/runtime/components/AvatarGroup.vue +38 -69
- package/dist/runtime/components/AvatarGroup.vue.d.ts +27 -0
- package/dist/runtime/components/Badge.vue +25 -51
- package/dist/runtime/components/Badge.vue.d.ts +44 -0
- package/dist/runtime/components/Breadcrumb.vue +35 -77
- package/dist/runtime/components/Breadcrumb.vue.d.ts +52 -0
- package/dist/runtime/components/Button.vue +62 -51
- package/dist/runtime/components/Button.vue.d.ts +29 -0
- package/dist/runtime/components/ButtonGroup.vue +17 -37
- package/dist/runtime/components/ButtonGroup.vue.d.ts +26 -0
- package/dist/runtime/components/Calendar.vue +75 -101
- package/dist/runtime/components/Calendar.vue.d.ts +75 -0
- package/dist/runtime/components/Card.vue +25 -42
- package/dist/runtime/components/Card.vue.d.ts +30 -0
- package/dist/runtime/components/Carousel.vue +118 -223
- package/dist/runtime/components/Carousel.vue.d.ts +104 -0
- package/dist/runtime/components/Checkbox.vue +49 -71
- package/dist/runtime/components/Checkbox.vue.d.ts +56 -0
- package/dist/runtime/components/Chip.vue +31 -48
- package/dist/runtime/components/Chip.vue.d.ts +30 -0
- package/dist/runtime/components/Collapsible.vue +22 -30
- package/dist/runtime/components/Collapsible.vue.d.ts +26 -0
- package/dist/runtime/components/Drawer.vue +52 -102
- package/dist/runtime/components/Drawer.vue.d.ts +80 -0
- package/dist/runtime/components/DropdownMenu.vue +65 -0
- package/dist/runtime/components/DropdownMenu.vue.d.ts +99 -0
- package/dist/runtime/components/DropdownMenuContent.vue +192 -0
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +39 -0
- package/dist/runtime/components/Form.vue +197 -0
- package/dist/runtime/components/Form.vue.d.ts +78 -0
- package/dist/runtime/components/FormItem.vue +90 -0
- package/dist/runtime/components/FormItem.vue.d.ts +60 -0
- package/dist/runtime/components/Input.vue +93 -115
- package/dist/runtime/components/Input.vue.d.ts +64 -0
- package/dist/runtime/components/InputNumber.vue +81 -116
- package/dist/runtime/components/InputNumber.vue.d.ts +245 -0
- package/dist/runtime/components/Kbd.vue +18 -39
- package/dist/runtime/components/Kbd.vue.d.ts +28 -0
- package/dist/runtime/components/Link.vue +170 -244
- package/dist/runtime/components/Link.vue.d.ts +95 -0
- package/dist/runtime/components/LinkBase.vue +36 -54
- package/dist/runtime/components/LinkBase.vue.d.ts +28 -0
- package/dist/runtime/components/Modal.vue +50 -85
- package/dist/runtime/components/Modal.vue.d.ts +66 -0
- package/dist/runtime/components/OverlayProvider.vue +10 -14
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +55 -121
- package/dist/runtime/components/Pagination.vue.d.ts +93 -0
- package/dist/runtime/components/PinInput.vue +57 -57
- package/dist/runtime/components/PinInput.vue.d.ts +35 -0
- package/dist/runtime/components/Popover.vue +39 -68
- package/dist/runtime/components/Popover.vue.d.ts +45 -0
- package/dist/runtime/components/Progress.vue +68 -120
- package/dist/runtime/components/Progress.vue.d.ts +54 -0
- package/dist/runtime/components/RadioGroup.vue +75 -129
- package/dist/runtime/components/RadioGroup.vue.d.ts +74 -0
- package/dist/runtime/components/ScrollArea.vue +31 -31
- package/dist/runtime/components/ScrollArea.vue.d.ts +17 -0
- package/dist/runtime/components/Select.vue +119 -199
- package/dist/runtime/components/Select.vue.d.ts +119 -0
- package/dist/runtime/components/Separator.vue +26 -44
- package/dist/runtime/components/Separator.vue.d.ts +27 -0
- package/dist/runtime/components/Skeleton.vue +12 -21
- package/dist/runtime/components/Skeleton.vue.d.ts +19 -0
- package/dist/runtime/components/Slider.vue +54 -71
- package/dist/runtime/components/Slider.vue.d.ts +36 -0
- package/dist/runtime/components/Switch.vue +54 -68
- package/dist/runtime/components/Switch.vue.d.ts +49 -0
- package/dist/runtime/components/Table.vue +113 -186
- package/dist/runtime/components/Table.vue.d.ts +148 -0
- package/dist/runtime/components/Tabs.vue +35 -79
- package/dist/runtime/components/Tabs.vue.d.ts +65 -0
- package/dist/runtime/components/Textarea.vue +82 -123
- package/dist/runtime/components/Textarea.vue.d.ts +60 -0
- package/dist/runtime/components/Toast.vue +51 -76
- package/dist/runtime/components/Toast.vue.d.ts +131 -0
- package/dist/runtime/components/ToastProvider.vue +65 -101
- package/dist/runtime/components/ToastProvider.vue.d.ts +38 -0
- package/dist/runtime/components/Tooltip.vue +36 -47
- package/dist/runtime/components/Tooltip.vue.d.ts +31 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormItem.d.ts +27 -0
- package/dist/runtime/composables/useFormItem.js +64 -0
- package/dist/runtime/composables/useKbd.d.ts +1 -1
- package/dist/runtime/composables/useLocale.d.ts +3 -3
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +2 -1
- package/dist/runtime/composables/useToast.d.ts +1 -1
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/locale/en.d.ts +1 -1
- package/dist/runtime/locale/zh-tw.d.ts +1 -1
- package/dist/runtime/theme/accordion.d.ts +45 -51
- package/dist/runtime/theme/accordion.js +1 -1
- package/dist/runtime/theme/alert.d.ts +115 -121
- package/dist/runtime/theme/alert.js +1 -1
- package/dist/runtime/theme/app.d.ts +1 -0
- package/dist/runtime/theme/app.js +2 -1
- package/dist/runtime/theme/avatar-group.d.ts +42 -48
- package/dist/runtime/theme/avatar-group.js +1 -1
- package/dist/runtime/theme/avatar.d.ts +46 -52
- package/dist/runtime/theme/avatar.js +1 -1
- package/dist/runtime/theme/badge.d.ts +63 -93
- package/dist/runtime/theme/badge.js +1 -1
- package/dist/runtime/theme/breadcrumb.d.ts +52 -58
- package/dist/runtime/theme/breadcrumb.js +1 -1
- package/dist/runtime/theme/button-group.d.ts +36 -42
- package/dist/runtime/theme/button.d.ts +165 -117
- package/dist/runtime/theme/button.js +1 -1
- package/dist/runtime/theme/calendar.d.ts +52 -50
- package/dist/runtime/theme/calendar.js +20 -3
- package/dist/runtime/theme/card.d.ts +52 -58
- package/dist/runtime/theme/card.js +1 -1
- package/dist/runtime/theme/carousel.d.ts +98 -104
- package/dist/runtime/theme/carousel.js +1 -1
- package/dist/runtime/theme/checkbox.d.ts +77 -83
- package/dist/runtime/theme/checkbox.js +1 -1
- package/dist/runtime/theme/chip.d.ts +50 -89
- package/dist/runtime/theme/chip.js +1 -1
- package/dist/runtime/theme/collapsible.d.ts +29 -35
- package/dist/runtime/theme/collapsible.js +1 -1
- package/dist/runtime/theme/drawer.d.ts +131 -102
- package/dist/runtime/theme/drawer.js +1 -1
- package/dist/runtime/theme/dropdown-menu.d.ts +65 -0
- package/dist/runtime/theme/dropdown-menu.js +83 -0
- package/dist/runtime/theme/form-item.d.ts +70 -0
- package/dist/runtime/theme/form-item.js +34 -0
- package/dist/runtime/theme/form.d.ts +2 -0
- package/dist/runtime/theme/form.js +7 -0
- package/dist/runtime/theme/index.d.ts +3 -0
- package/dist/runtime/theme/index.js +3 -0
- package/dist/runtime/theme/input-number.d.ts +100 -126
- package/dist/runtime/theme/input-number.js +1 -1
- package/dist/runtime/theme/input.d.ts +153 -131
- package/dist/runtime/theme/input.js +3 -3
- package/dist/runtime/theme/kbd.d.ts +30 -36
- package/dist/runtime/theme/link.d.ts +37 -43
- package/dist/runtime/theme/modal.d.ts +35 -69
- package/dist/runtime/theme/modal.js +1 -1
- package/dist/runtime/theme/pagination.d.ts +71 -77
- package/dist/runtime/theme/pagination.js +1 -1
- package/dist/runtime/theme/pinInput.d.ts +82 -88
- package/dist/runtime/theme/pinInput.js +2 -2
- package/dist/runtime/theme/popover.d.ts +29 -35
- package/dist/runtime/theme/popover.js +1 -1
- package/dist/runtime/theme/progress.d.ts +167 -109
- package/dist/runtime/theme/progress.js +1 -1
- package/dist/runtime/theme/radio-group.d.ts +99 -105
- package/dist/runtime/theme/radio-group.js +1 -1
- package/dist/runtime/theme/scroll-area.d.ts +62 -68
- package/dist/runtime/theme/scroll-area.js +1 -1
- package/dist/runtime/theme/select.d.ts +168 -158
- package/dist/runtime/theme/select.js +3 -2
- package/dist/runtime/theme/separator.d.ts +64 -85
- package/dist/runtime/theme/separator.js +1 -1
- package/dist/runtime/theme/skeleton.d.ts +1 -7
- package/dist/runtime/theme/slider.d.ts +62 -68
- package/dist/runtime/theme/slider.js +1 -1
- package/dist/runtime/theme/switch.d.ts +111 -117
- package/dist/runtime/theme/switch.js +1 -1
- package/dist/runtime/theme/table.d.ts +75 -78
- package/dist/runtime/theme/table.js +3 -2
- package/dist/runtime/theme/tabs.d.ts +116 -139
- package/dist/runtime/theme/tabs.js +1 -1
- package/dist/runtime/theme/textarea.d.ts +78 -90
- package/dist/runtime/theme/textarea.js +2 -2
- package/dist/runtime/theme/toast-provider.d.ts +110 -131
- package/dist/runtime/theme/toast-provider.js +1 -1
- package/dist/runtime/theme/toast.d.ts +74 -80
- package/dist/runtime/theme/toast.js +1 -1
- package/dist/runtime/theme/tooltip.d.ts +35 -41
- package/dist/runtime/theme/tooltip.js +1 -1
- package/dist/runtime/types/components.d.ts +3 -0
- package/dist/runtime/types/form.d.ts +45 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/index.d.ts +5 -2
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +37 -16
- package/dist/runtime/utils/extend-theme.js +15 -4
- package/dist/runtime/utils/form.d.ts +5 -0
- package/dist/runtime/utils/form.js +24 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +4 -0
- package/dist/runtime/utils/link.d.ts +4 -28
- package/dist/runtime/utils/link.js +10 -3
- package/dist/runtime/utils/styler.d.ts +2 -2
- package/dist/runtime/utils/styler.js +2 -2
- package/dist/shared/ui.D1BTWZFB.mjs +5 -0
- package/dist/shared/ui.D1BTWZFB.mjs.map +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/unocss.mjs +7 -6
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +78 -74
- package/dist/module.cjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs.map +0 -1
- package/dist/types.d.ts +0 -1
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { scrollArea } from '../theme'
|
|
4
|
-
import { transitionProps } from '../theme/scroll-area'
|
|
5
|
-
import type { ComponentAttrs } from '../types'
|
|
6
|
-
|
|
7
|
-
export interface ScrollAreaProps extends ComponentAttrs<typeof scrollArea>, Pick<ScrollAreaRootProps, 'type' | 'dir' | 'scrollHideDelay'> {}
|
|
1
|
+
<script>
|
|
2
|
+
import { transitionProps } from "../theme/scroll-area";
|
|
8
3
|
</script>
|
|
9
4
|
|
|
10
|
-
<script setup
|
|
11
|
-
import { reactivePick } from
|
|
12
|
-
import { ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport } from
|
|
13
|
-
import { computed, ref } from
|
|
14
|
-
import { useTheme } from
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport } from "reka-ui";
|
|
8
|
+
import { computed, ref } from "vue";
|
|
9
|
+
import { useTheme } from "../composables/useTheme";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
class: { type: null, required: false },
|
|
12
|
+
ui: { type: null, required: false },
|
|
13
|
+
type: { type: String, required: false },
|
|
14
|
+
dir: { type: String, required: false },
|
|
15
|
+
scrollHideDelay: { type: Number, required: false }
|
|
16
|
+
});
|
|
17
|
+
const rootRef = ref();
|
|
18
|
+
const rootProps = reactivePick(props, "type", "dir", "scrollHideDelay");
|
|
19
|
+
const { generateStyle } = useTheme();
|
|
20
|
+
const style = computed(() => generateStyle("scrollArea", props));
|
|
23
21
|
defineExpose({
|
|
24
22
|
scrollTop,
|
|
25
|
-
scrollTopLeft
|
|
26
|
-
})
|
|
27
|
-
|
|
23
|
+
scrollTopLeft
|
|
24
|
+
});
|
|
28
25
|
function scrollTop() {
|
|
29
|
-
rootRef.value?.scrollTop()
|
|
26
|
+
rootRef.value?.scrollTop();
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
function scrollTopLeft() {
|
|
33
|
-
rootRef.value?.scrollTopLeft()
|
|
29
|
+
rootRef.value?.scrollTopLeft();
|
|
34
30
|
}
|
|
35
31
|
</script>
|
|
36
32
|
|
|
@@ -39,29 +35,33 @@ function scrollTopLeft() {
|
|
|
39
35
|
ref="rootRef"
|
|
40
36
|
v-bind="rootProps"
|
|
41
37
|
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
38
|
+
data-part="root"
|
|
42
39
|
>
|
|
43
|
-
<ScrollAreaViewport :class="style.viewport({ class: props.ui?.viewport })">
|
|
40
|
+
<ScrollAreaViewport :class="style.viewport({ class: props.ui?.viewport })" data-part="viewport">
|
|
44
41
|
<slot></slot>
|
|
45
42
|
</ScrollAreaViewport>
|
|
46
43
|
|
|
47
44
|
<TransitionGroup v-bind="transitionProps">
|
|
48
45
|
<ScrollAreaScrollbar
|
|
49
46
|
key="scrollbar-horizontal"
|
|
50
|
-
:class="style.scrollbar({ class: props.ui?.scrollbar })"
|
|
51
47
|
orientation="horizontal"
|
|
48
|
+
:class="style.scrollbar({ class: props.ui?.scrollbar })"
|
|
49
|
+
data-part="scrollbar"
|
|
52
50
|
>
|
|
53
|
-
<ScrollAreaThumb :class="style.thumb({ class: props.ui?.thumb })" />
|
|
51
|
+
<ScrollAreaThumb :class="style.thumb({ class: props.ui?.thumb })" data-part="thumb" />
|
|
54
52
|
</ScrollAreaScrollbar>
|
|
55
53
|
<ScrollAreaScrollbar
|
|
56
54
|
key="scrollbar-vertical"
|
|
57
|
-
:class="style.scrollbar({ class: props.ui?.scrollbar })"
|
|
58
55
|
orientation="vertical"
|
|
56
|
+
:class="style.scrollbar({ class: props.ui?.scrollbar })"
|
|
57
|
+
data-part="scrollbar"
|
|
59
58
|
>
|
|
60
|
-
<ScrollAreaThumb :class="style.thumb({ class: props.ui?.thumb })" />
|
|
59
|
+
<ScrollAreaThumb :class="style.thumb({ class: props.ui?.thumb })" data-part="thumb" />
|
|
61
60
|
</ScrollAreaScrollbar>
|
|
62
61
|
<ScrollAreaCorner
|
|
63
62
|
key="corner"
|
|
64
63
|
:class="style.corner({ class: props.ui?.corner })"
|
|
64
|
+
data-part="corner"
|
|
65
65
|
/>
|
|
66
66
|
</TransitionGroup>
|
|
67
67
|
</ScrollAreaRoot>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScrollAreaRootProps } from 'reka-ui';
|
|
2
|
+
import type { scrollArea } from '../theme/index.js';
|
|
3
|
+
import type { ComponentAttrs } from '../types/index.js';
|
|
4
|
+
export interface ScrollAreaProps extends ComponentAttrs<typeof scrollArea>, Pick<ScrollAreaRootProps, 'type' | 'dir' | 'scrollHideDelay'> {
|
|
5
|
+
}
|
|
6
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ScrollAreaProps, {
|
|
7
|
+
scrollTop: () => void;
|
|
8
|
+
scrollTopLeft: () => void;
|
|
9
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScrollAreaProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
10
|
+
default?: (props: {}) => any;
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -1,181 +1,100 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
-
import type { AcceptableValue, SelectArrowProps, SelectContentProps, SelectRootProps } from 'reka-ui'
|
|
4
|
-
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
5
|
-
import type { select } from '../theme'
|
|
6
|
-
import type { ComponentAttrs, MaybeArray, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectOptionKey } from '../types'
|
|
1
|
+
<script>
|
|
7
2
|
|
|
8
|
-
export interface SelectEmits<T, V, M extends boolean> {
|
|
9
|
-
(event: 'update:open', value: boolean): void
|
|
10
|
-
(event: 'update:modelValue', payload: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>): void
|
|
11
|
-
(event: 'change', payload: Event): void
|
|
12
|
-
(event: 'blur', payload: FocusEvent): void
|
|
13
|
-
(event: 'focus', payload: FocusEvent): void
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
17
|
-
|
|
18
|
-
export interface SelectSlots<T, M extends boolean> {
|
|
19
|
-
'leading'?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: ComponentAttrs<typeof select>['ui'] }) => any
|
|
20
|
-
'default'?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean }) => any
|
|
21
|
-
'trailing'?: (props: { modelValue?: M extends true ? AcceptableValue[] : AcceptableValue, open: boolean, ui: ComponentAttrs<typeof select>['ui'] }) => any
|
|
22
|
-
'item'?: SlotProps<T>
|
|
23
|
-
'item-leading'?: SlotProps<T>
|
|
24
|
-
'item-label'?: SlotProps<T>
|
|
25
|
-
'item-trailing'?: SlotProps<T>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type SelectVariants = VariantProps<typeof select>
|
|
29
|
-
|
|
30
|
-
export interface SelectOption {
|
|
31
|
-
label?: string
|
|
32
|
-
icon?: string
|
|
33
|
-
/**
|
|
34
|
-
* The option type.
|
|
35
|
-
* @default "option"
|
|
36
|
-
*/
|
|
37
|
-
type?: 'label' | 'separator' | 'option'
|
|
38
|
-
value?: string
|
|
39
|
-
disabled?: boolean
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type SelectOptionValue = SelectOption | AcceptableValue | boolean
|
|
43
|
-
|
|
44
|
-
export interface SelectProps<
|
|
45
|
-
T extends MaybeArrayOfArrayItem<I>,
|
|
46
|
-
I extends MaybeArrayOfArray<SelectOptionValue> = MaybeArrayOfArray<SelectOptionValue>,
|
|
47
|
-
V extends SelectOptionKey<T> | undefined = undefined,
|
|
48
|
-
M extends boolean = false,
|
|
49
|
-
> extends Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'>, ComponentAttrs<typeof select>, UseComponentIconsProps {
|
|
50
|
-
id?: string
|
|
51
|
-
/** The placeholder text when the select is empty. */
|
|
52
|
-
placeholder?: string
|
|
53
|
-
variant?: SelectVariants['variant']
|
|
54
|
-
size?: SelectVariants['size']
|
|
55
|
-
/**
|
|
56
|
-
* The icon displayed to open the menu.
|
|
57
|
-
* @default app.icons.chevronDown
|
|
58
|
-
*/
|
|
59
|
-
trailingIcon?: string
|
|
60
|
-
/**
|
|
61
|
-
* The icon displayed when an item is selected.
|
|
62
|
-
* @default app.icons.check
|
|
63
|
-
*/
|
|
64
|
-
selectedIcon?: string
|
|
65
|
-
/**
|
|
66
|
-
* The content of the menu.
|
|
67
|
-
* @default { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
68
|
-
*/
|
|
69
|
-
content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
70
|
-
/**
|
|
71
|
-
* Display an arrow alongside the menu.
|
|
72
|
-
* @default false
|
|
73
|
-
*/
|
|
74
|
-
arrow?: boolean | Omit<SelectArrowProps, 'as' | 'asChild'>
|
|
75
|
-
/**
|
|
76
|
-
* Render the menu in a portal.
|
|
77
|
-
* @default true
|
|
78
|
-
*/
|
|
79
|
-
portal?: boolean
|
|
80
|
-
/**
|
|
81
|
-
* When `options` is an array of objects, select the field to use as the value.
|
|
82
|
-
* @default "value"
|
|
83
|
-
*/
|
|
84
|
-
valueKey?: V
|
|
85
|
-
/**
|
|
86
|
-
* When `options` is an array of objects, select the field to use as the label.
|
|
87
|
-
* @default "label"
|
|
88
|
-
*/
|
|
89
|
-
labelKey?: V
|
|
90
|
-
options?: I
|
|
91
|
-
/** The value of the Select when initially rendered. Use when you do not need to control the state of the Select. */
|
|
92
|
-
defaultValue?: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>
|
|
93
|
-
/** The controlled value of the Select. Can be bind as `v-model`. */
|
|
94
|
-
modelValue?: SelectModelValue<T, V, M, T extends { value: infer U } ? U : never>
|
|
95
|
-
/** Whether multiple options can be selected or not. */
|
|
96
|
-
multiple?: M & boolean
|
|
97
|
-
/** Highlight the ring color like a focus state. */
|
|
98
|
-
highlight?: boolean
|
|
99
|
-
underline?: boolean
|
|
100
|
-
}
|
|
101
3
|
</script>
|
|
102
4
|
|
|
103
|
-
<script
|
|
104
|
-
import { reactivePick } from
|
|
105
|
-
import { defu } from
|
|
106
|
-
import { SelectArrow, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectSeparator, SelectTrigger, SelectViewport, useForwardPropsEmits } from
|
|
107
|
-
import { computed, toRef } from
|
|
108
|
-
import { useButtonGroup } from
|
|
109
|
-
import { useComponentIcons } from
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { reactivePick } from "@vueuse/core";
|
|
7
|
+
import { defu } from "defu";
|
|
8
|
+
import { SelectArrow, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectSeparator, SelectTrigger, SelectViewport, useForwardPropsEmits } from "reka-ui";
|
|
9
|
+
import { computed, toRef } from "vue";
|
|
10
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
11
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
12
|
+
import { useFormItem } from "../composables/useFormItem";
|
|
13
|
+
import { useTheme } from "../composables/useTheme";
|
|
14
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
15
|
+
defineOptions({
|
|
16
|
+
inheritAttrs: false
|
|
17
|
+
});
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
id: { type: String, required: false },
|
|
20
|
+
placeholder: { type: String, required: false },
|
|
21
|
+
variant: { type: null, required: false },
|
|
22
|
+
size: { type: null, required: false },
|
|
23
|
+
trailingIcon: { type: String, required: false },
|
|
24
|
+
selectedIcon: { type: String, required: false },
|
|
25
|
+
content: { type: Object, required: false },
|
|
26
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
27
|
+
portal: { type: Boolean, required: false, default: true },
|
|
28
|
+
valueKey: { type: null, required: false, default: "value" },
|
|
29
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
30
|
+
options: { type: null, required: false },
|
|
31
|
+
defaultValue: { type: null, required: false },
|
|
32
|
+
modelValue: { type: null, required: false },
|
|
33
|
+
multiple: { type: Boolean, required: false },
|
|
34
|
+
highlight: { type: Boolean, required: false },
|
|
35
|
+
underline: { type: Boolean, required: false },
|
|
36
|
+
class: { type: null, required: false },
|
|
37
|
+
ui: { type: null, required: false },
|
|
38
|
+
icon: { type: String, required: false },
|
|
39
|
+
leading: { type: Boolean, required: false },
|
|
40
|
+
leadingIcon: { type: String, required: false },
|
|
41
|
+
trailing: { type: Boolean, required: false },
|
|
42
|
+
loading: { type: Boolean, required: false },
|
|
43
|
+
loadingIcon: { type: String, required: false },
|
|
44
|
+
open: { type: Boolean, required: false },
|
|
45
|
+
defaultOpen: { type: Boolean, required: false },
|
|
46
|
+
autocomplete: { type: String, required: false },
|
|
47
|
+
disabled: { type: Boolean, required: false },
|
|
48
|
+
name: { type: String, required: false },
|
|
49
|
+
required: { type: Boolean, required: false }
|
|
50
|
+
});
|
|
51
|
+
const emit = defineEmits(["update:open", "change", "blur", "focus", "update:modelValue"]);
|
|
52
|
+
const slots = defineSlots();
|
|
53
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "disabled", "autocomplete", "required", "multiple"), emit);
|
|
54
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
55
|
+
const arrowProps = toRef(() => props.arrow);
|
|
56
|
+
const { id, name, size: formItemSize, highlight, disabled, ariaAttrs, emitFormChange, emitFormInput, emitFormBlur, emitFormFocus } = useFormItem(props);
|
|
57
|
+
const { size: buttonGroupSize, orientation } = useButtonGroup(props);
|
|
58
|
+
const { theme, generateStyle } = useTheme();
|
|
130
59
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, {
|
|
131
|
-
trailingIcon: theme.value.app.icons.chevronDown
|
|
132
|
-
})))
|
|
133
|
-
|
|
134
|
-
const style = computed(() => generateStyle('select', {
|
|
60
|
+
trailingIcon: theme.value.app.icons.chevronDown
|
|
61
|
+
})));
|
|
62
|
+
const style = computed(() => generateStyle("select", {
|
|
135
63
|
...props,
|
|
136
|
-
size: size.value,
|
|
137
64
|
groupOrientation: orientation.value,
|
|
65
|
+
size: buttonGroupSize.value || formItemSize.value,
|
|
66
|
+
highlight: highlight.value,
|
|
138
67
|
leading: isLeading.value,
|
|
139
|
-
trailing: isTrailing.value
|
|
140
|
-
}))
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
function
|
|
146
|
-
return item as unknown as T
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function typedValue<V extends MaybeArray<AcceptableValue>>(value?: V) {
|
|
150
|
-
return value as unknown as M extends true ? AcceptableValue[] : AcceptableValue
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function typedModelValue(value: any) {
|
|
154
|
-
return value as MaybeArray<AcceptableValue> | undefined
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function displayValue(value?: MaybeArray<AcceptableValue>): string | undefined {
|
|
68
|
+
trailing: isTrailing.value
|
|
69
|
+
}));
|
|
70
|
+
const groups = computed(
|
|
71
|
+
() => props.options?.length ? isArrayOfArray(props.options) ? props.options : [props.options] : []
|
|
72
|
+
);
|
|
73
|
+
const items = computed(() => groups.value.flat());
|
|
74
|
+
function displayValue(value) {
|
|
158
75
|
if (props.multiple && Array.isArray(value))
|
|
159
|
-
return value.map((v) => displayValue(v)).filter(Boolean).join(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return (item != null) && (typeof item === 'object' ? get(item, props.labelKey as string) : item.toString())
|
|
76
|
+
return value.map((v) => displayValue(v)).filter(Boolean).join(", ");
|
|
77
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
78
|
+
return item != null && (typeof item === "object" ? get(item, props.labelKey) : String(item));
|
|
163
79
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
167
|
-
const event = new Event('change', { target: { value } })
|
|
168
|
-
emit('change', event)
|
|
80
|
+
function isSelectItem(item) {
|
|
81
|
+
return typeof item === "object" && item !== null;
|
|
169
82
|
}
|
|
170
|
-
|
|
171
|
-
|
|
83
|
+
function onUpdate(value) {
|
|
84
|
+
const event = new Event("change", { target: { value } });
|
|
85
|
+
emit("change", event);
|
|
86
|
+
emitFormChange();
|
|
87
|
+
emitFormInput();
|
|
88
|
+
}
|
|
89
|
+
function onUpdateOpen(value) {
|
|
172
90
|
if (value) {
|
|
173
|
-
const event = new FocusEvent(
|
|
174
|
-
emit(
|
|
175
|
-
|
|
176
|
-
else {
|
|
177
|
-
const event = new FocusEvent(
|
|
178
|
-
emit(
|
|
91
|
+
const event = new FocusEvent("focus");
|
|
92
|
+
emit("focus", event);
|
|
93
|
+
emitFormFocus();
|
|
94
|
+
} else {
|
|
95
|
+
const event = new FocusEvent("blur");
|
|
96
|
+
emit("blur", event);
|
|
97
|
+
emitFormBlur();
|
|
179
98
|
}
|
|
180
99
|
}
|
|
181
100
|
</script>
|
|
@@ -183,72 +102,73 @@ function onUpdateOpen(value: boolean) {
|
|
|
183
102
|
<template>
|
|
184
103
|
<SelectRoot
|
|
185
104
|
v-slot="{ modelValue: innerValue, open }"
|
|
186
|
-
:name="props.name"
|
|
187
105
|
v-bind="rootProps"
|
|
106
|
+
:name="name"
|
|
188
107
|
:autocomplete="props.autocomplete"
|
|
189
|
-
:disabled="
|
|
190
|
-
:default-value="
|
|
191
|
-
:model-value="
|
|
108
|
+
:disabled="disabled"
|
|
109
|
+
:default-value="props.defaultValue"
|
|
110
|
+
:model-value="props.modelValue"
|
|
192
111
|
@update:model-value="onUpdate"
|
|
193
112
|
@update:open="onUpdateOpen"
|
|
194
113
|
>
|
|
195
|
-
<SelectTrigger
|
|
196
|
-
<span v-if="isLeading || slots.leading" :class="style.leading({ class: props.ui?.leading })">
|
|
197
|
-
<slot name="leading" :model-value="
|
|
198
|
-
<span v-if="isLeading && leadingIconName" :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })"></span>
|
|
114
|
+
<SelectTrigger v-bind="{ ...$attrs, ...ariaAttrs, id }" :class="style.base({ class: [props.class, props.ui?.base] })" data-part="base">
|
|
115
|
+
<span v-if="isLeading || slots.leading" :class="style.leading({ class: props.ui?.leading })" data-part="leading">
|
|
116
|
+
<slot name="leading" :model-value="innerValue" :open="open" :ui="props.ui">
|
|
117
|
+
<span v-if="isLeading && leadingIconName" :class="style.leadingIcon({ class: [leadingIconName, props.ui?.leadingIcon] })" data-part="leading-icon"></span>
|
|
199
118
|
</slot>
|
|
200
119
|
</span>
|
|
201
120
|
|
|
202
|
-
<slot :model-value="
|
|
121
|
+
<slot :model-value="innerValue" :open="open">
|
|
203
122
|
<template v-for="displayedModelValue in [displayValue(innerValue)]" :key="displayedModelValue">
|
|
204
|
-
<span v-if="displayedModelValue" :class="style.value({ class: props.ui?.value })">
|
|
123
|
+
<span v-if="displayedModelValue" :class="style.value({ class: props.ui?.value })" data-part="value">
|
|
205
124
|
{{ displayedModelValue }}
|
|
206
125
|
</span>
|
|
207
|
-
<span v-else :class="style.placeholder({ class: props.ui?.placeholder })">
|
|
126
|
+
<span v-else :class="style.placeholder({ class: props.ui?.placeholder })" data-part="placeholder">
|
|
208
127
|
{{ placeholder }}
|
|
209
128
|
</span>
|
|
210
129
|
</template>
|
|
211
130
|
</slot>
|
|
212
131
|
|
|
213
|
-
<span v-if="isTrailing || !!slots.trailing" :class="style.trailing({ class: props.ui?.trailing })">
|
|
214
|
-
<slot name="trailing" :model-value="
|
|
215
|
-
<span v-if="trailingIconName" :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })"></span>
|
|
132
|
+
<span v-if="isTrailing || !!slots.trailing" :class="style.trailing({ class: props.ui?.trailing })" data-part="trailing">
|
|
133
|
+
<slot name="trailing" :model-value="innerValue" :open="open" :ui="props.ui">
|
|
134
|
+
<span v-if="trailingIconName" :class="style.trailingIcon({ class: [trailingIconName, props.ui?.trailingIcon] })" data-part="trailing-icon"></span>
|
|
216
135
|
</slot>
|
|
217
136
|
</span>
|
|
218
137
|
</SelectTrigger>
|
|
219
138
|
|
|
220
139
|
<SelectPortal :disabled="!props.portal">
|
|
221
|
-
<SelectContent v-bind="contentProps" :class="style.content({ class: props.ui?.content })">
|
|
222
|
-
<SelectViewport :class="style.viewport({ class: props.ui?.viewport })">
|
|
223
|
-
<SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="style.group({ class: props.ui?.group })">
|
|
140
|
+
<SelectContent v-bind="contentProps" :class="style.content({ class: props.ui?.content })" data-part="content">
|
|
141
|
+
<SelectViewport :class="style.viewport({ class: props.ui?.viewport })" data-part="viewport">
|
|
142
|
+
<SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="style.group({ class: props.ui?.group })" data-part="group">
|
|
224
143
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
225
|
-
<SelectLabel v-if="item.type === 'label'" :class="style.label({ class: props.ui?.label })">
|
|
226
|
-
{{ get(item, props.labelKey
|
|
144
|
+
<SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="style.label({ class: props.ui?.label })" data-part="label">
|
|
145
|
+
{{ get(item, props.labelKey) }}
|
|
227
146
|
</SelectLabel>
|
|
228
|
-
<SelectSeparator v-else-if="item.type === 'separator'" :class="style.separator({ class: props.ui?.separator })" />
|
|
147
|
+
<SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="style.separator({ class: props.ui?.separator })" data-part="separator" />
|
|
229
148
|
|
|
230
149
|
<SelectItem
|
|
231
150
|
v-else
|
|
151
|
+
:value="isSelectItem(item) ? get(item, props.valueKey) : item"
|
|
152
|
+
:disabled="isSelectItem(item) && item.disabled"
|
|
232
153
|
:class="style.item({ class: props.ui?.item })"
|
|
233
|
-
|
|
234
|
-
:value="typeof item === 'object' ? get(item, props.valueKey as string) : item"
|
|
154
|
+
data-part="item"
|
|
235
155
|
>
|
|
236
|
-
<slot name="item" :item="
|
|
237
|
-
<slot name="item-leading" :item="
|
|
238
|
-
<span v-if="item.icon" :class="style.itemLeadingIcon({ class: [item.icon, props.ui?.itemLeadingIcon] })"></span>
|
|
156
|
+
<slot name="item" :item="item" :index="index">
|
|
157
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
158
|
+
<span v-if="isSelectItem(item) && item.icon" :class="style.itemLeadingIcon({ class: [item.icon, props.ui?.itemLeadingIcon] })" data-part="item-leading-icon"></span>
|
|
239
159
|
</slot>
|
|
240
160
|
|
|
241
|
-
<SelectItemText :class="style.itemLabel({ class: props.ui?.itemLabel })">
|
|
242
|
-
<slot name="item-label" :item="
|
|
243
|
-
{{
|
|
161
|
+
<SelectItemText :class="style.itemLabel({ class: props.ui?.itemLabel })" data-part="item-label">
|
|
162
|
+
<slot name="item-label" :item="item" :index="index">
|
|
163
|
+
{{ isSelectItem(item) ? get(item, props.labelKey) : item }}
|
|
244
164
|
</slot>
|
|
245
165
|
</SelectItemText>
|
|
246
166
|
|
|
247
|
-
<span :class="style.itemTrailing({ class: props.ui?.itemTrailing })">
|
|
248
|
-
<slot name="item-trailing" :item="
|
|
167
|
+
<span :class="style.itemTrailing({ class: props.ui?.itemTrailing })" data-part="item-trailing">
|
|
168
|
+
<slot name="item-trailing" :item="item" :index="index"></slot>
|
|
249
169
|
|
|
250
170
|
<SelectItemIndicator as-child>
|
|
251
|
-
<span :class="style.itemTrailingIcon({ class: [props.selectedIcon || theme.app.icons.check, props.ui?.itemTrailingIcon] })"></span>
|
|
171
|
+
<span :class="style.itemTrailingIcon({ class: [props.selectedIcon || theme.app.icons.check, props.ui?.itemTrailingIcon] })" data-part="item-trailing-icon"></span>
|
|
252
172
|
</SelectItemIndicator>
|
|
253
173
|
</span>
|
|
254
174
|
</slot>
|
|
@@ -257,7 +177,7 @@ function onUpdateOpen(value: boolean) {
|
|
|
257
177
|
</SelectGroup>
|
|
258
178
|
</SelectViewport>
|
|
259
179
|
|
|
260
|
-
<SelectArrow v-if="!!props.arrow" v-bind="arrowProps" :class="style.arrow({ class: props.ui?.arrow })" />
|
|
180
|
+
<SelectArrow v-if="!!props.arrow" v-bind="arrowProps" :class="style.arrow({ class: props.ui?.arrow })" data-part="arrow" />
|
|
261
181
|
</SelectContent>
|
|
262
182
|
</SelectPortal>
|
|
263
183
|
</SelectRoot>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
+
import type { SelectArrowProps, SelectContentEmits, SelectContentProps, SelectRootEmits, SelectRootProps } from 'reka-ui';
|
|
3
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons.js';
|
|
4
|
+
import type { select } from '../theme/index.js';
|
|
5
|
+
import type { AcceptableValue, ArrayOrNested, ComponentAttrs, EmitsToProps, GetItemKeys, GetModelValue, GetModelValueEmits, NestedItem } from '../types/index.js';
|
|
6
|
+
interface SelectItemBase {
|
|
7
|
+
label?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The option type.
|
|
11
|
+
* @default "option"
|
|
12
|
+
*/
|
|
13
|
+
type?: 'label' | 'separator' | 'option';
|
|
14
|
+
value?: AcceptableValue;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export type SelectItem = SelectItemBase | string | number | boolean;
|
|
19
|
+
export type SelectEmits<T extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> | undefined, M extends boolean> = Omit<SelectRootEmits, 'update:modelValue'> & {
|
|
20
|
+
change: [payload: Event];
|
|
21
|
+
blur: [payload: FocusEvent];
|
|
22
|
+
focus: [payload: FocusEvent];
|
|
23
|
+
} & GetModelValueEmits<T, VK, M>;
|
|
24
|
+
type SlotProps<T extends SelectItem> = (props: {
|
|
25
|
+
item: T;
|
|
26
|
+
index: number;
|
|
27
|
+
}) => any;
|
|
28
|
+
export interface SelectSlots<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false, I extends NestedItem<T> = NestedItem<T>> {
|
|
29
|
+
'leading'?: (props: {
|
|
30
|
+
modelValue?: GetModelValue<T, VK, M>;
|
|
31
|
+
open: boolean;
|
|
32
|
+
ui: ComponentAttrs<typeof select>['ui'];
|
|
33
|
+
}) => any;
|
|
34
|
+
'default'?: (props: {
|
|
35
|
+
modelValue?: GetModelValue<T, VK, M>;
|
|
36
|
+
open: boolean;
|
|
37
|
+
}) => any;
|
|
38
|
+
'trailing'?: (props: {
|
|
39
|
+
modelValue?: GetModelValue<T, VK, M>;
|
|
40
|
+
open: boolean;
|
|
41
|
+
ui: ComponentAttrs<typeof select>['ui'];
|
|
42
|
+
}) => any;
|
|
43
|
+
'item'?: SlotProps<I>;
|
|
44
|
+
'item-leading'?: SlotProps<I>;
|
|
45
|
+
'item-label'?: SlotProps<I>;
|
|
46
|
+
'item-trailing'?: SlotProps<I>;
|
|
47
|
+
}
|
|
48
|
+
type SelectVariants = VariantProps<typeof select>;
|
|
49
|
+
export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = 'value', M extends boolean = false> extends ComponentAttrs<typeof select>, UseComponentIconsProps, Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'> {
|
|
50
|
+
id?: string;
|
|
51
|
+
/** The placeholder text when the select is empty. */
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
variant?: SelectVariants['variant'];
|
|
54
|
+
size?: SelectVariants['size'];
|
|
55
|
+
/**
|
|
56
|
+
* The icon displayed to open the menu.
|
|
57
|
+
* @default app.icons.chevronDown
|
|
58
|
+
*/
|
|
59
|
+
trailingIcon?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The icon displayed when an item is selected.
|
|
62
|
+
* @default app.icons.check
|
|
63
|
+
*/
|
|
64
|
+
selectedIcon?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The content of the menu.
|
|
67
|
+
* @default { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
68
|
+
*/
|
|
69
|
+
content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<SelectContentEmits>>;
|
|
70
|
+
/**
|
|
71
|
+
* Display an arrow alongside the menu.
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
arrow?: boolean | Omit<SelectArrowProps, 'as' | 'asChild'>;
|
|
75
|
+
/**
|
|
76
|
+
* Render the menu in a portal.
|
|
77
|
+
* @default true
|
|
78
|
+
*/
|
|
79
|
+
portal?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* When `options` is an array of objects, select the field to use as the value.
|
|
82
|
+
* @default "value"
|
|
83
|
+
*/
|
|
84
|
+
valueKey?: VK;
|
|
85
|
+
/**
|
|
86
|
+
* When `options` is an array of objects, select the field to use as the label.
|
|
87
|
+
* @default "label"
|
|
88
|
+
*/
|
|
89
|
+
labelKey?: VK;
|
|
90
|
+
options?: T;
|
|
91
|
+
/** The value of the Select when initially rendered. Use when you do not need to control the state of the Select. */
|
|
92
|
+
defaultValue?: GetModelValue<T, VK, M> | null;
|
|
93
|
+
/** The controlled value of the Select. Can be bind as `v-model`. */
|
|
94
|
+
modelValue?: GetModelValue<T, VK, M> | null;
|
|
95
|
+
/** Whether multiple options can be selected or not. */
|
|
96
|
+
multiple?: M & boolean;
|
|
97
|
+
/** Highlight the ring color like a focus state. */
|
|
98
|
+
highlight?: boolean;
|
|
99
|
+
underline?: boolean;
|
|
100
|
+
}
|
|
101
|
+
declare const _default: <T extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = "value", M 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_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
102
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
103
|
+
readonly onBlur?: ((payload: FocusEvent) => any) | undefined;
|
|
104
|
+
readonly onChange?: ((payload: Event) => any) | undefined;
|
|
105
|
+
readonly onFocus?: ((payload: FocusEvent) => any) | undefined;
|
|
106
|
+
readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
107
|
+
readonly "onUpdate:modelValue"?: ((payload: GetModelValue<T, VK, M>) => any) | undefined;
|
|
108
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue"> & SelectProps<T, VK, M> & Partial<{}>> & import("vue").PublicProps;
|
|
109
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
110
|
+
attrs: any;
|
|
111
|
+
slots: SelectSlots<T, VK, M, NestedItem<T>>;
|
|
112
|
+
emit: ((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue<T, VK, M>) => void);
|
|
113
|
+
}>) => import("vue").VNode & {
|
|
114
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
115
|
+
};
|
|
116
|
+
export default _default;
|
|
117
|
+
type __VLS_PrettifyLocal<T> = {
|
|
118
|
+
[K in keyof T]: T[K];
|
|
119
|
+
} & {};
|