@bitrix24/b24ui-nuxt 0.5.11 → 0.6.1
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/.nuxt/b24ui/advice.ts +10 -2
- package/.nuxt/b24ui/alert.ts +10 -2
- package/.nuxt/b24ui/avatar-group.ts +10 -2
- package/.nuxt/b24ui/avatar.ts +10 -2
- package/.nuxt/b24ui/badge.ts +10 -2
- package/.nuxt/b24ui/button-group.ts +10 -2
- package/.nuxt/b24ui/button.ts +16 -6
- package/.nuxt/b24ui/calendar.ts +10 -2
- package/.nuxt/b24ui/checkbox.ts +10 -2
- package/.nuxt/b24ui/chip.ts +10 -2
- package/.nuxt/b24ui/collapsible.ts +10 -2
- package/.nuxt/b24ui/container.ts +10 -2
- package/.nuxt/b24ui/countdown.ts +10 -2
- package/.nuxt/b24ui/description-list.ts +10 -2
- package/.nuxt/b24ui/dropdown-menu.ts +10 -2
- package/.nuxt/b24ui/form-field.ts +10 -2
- package/.nuxt/b24ui/form.ts +10 -2
- package/.nuxt/b24ui/input-menu.ts +12 -4
- package/.nuxt/b24ui/input-number.ts +10 -2
- package/.nuxt/b24ui/input.ts +10 -2
- package/.nuxt/b24ui/kbd.ts +10 -2
- package/.nuxt/b24ui/link.ts +10 -2
- package/.nuxt/b24ui/modal.ts +10 -2
- package/.nuxt/b24ui/navbar-divider.ts +10 -2
- package/.nuxt/b24ui/navbar-section.ts +10 -2
- package/.nuxt/b24ui/navbar-spacer.ts +10 -2
- package/.nuxt/b24ui/navbar.ts +10 -2
- package/.nuxt/b24ui/navigation-menu.ts +10 -2
- package/.nuxt/b24ui/popover.ts +10 -2
- package/.nuxt/b24ui/progress.ts +10 -2
- package/.nuxt/b24ui/radio-group.ts +10 -2
- package/.nuxt/b24ui/range.ts +10 -2
- package/.nuxt/b24ui/select-menu.ts +14 -6
- package/.nuxt/b24ui/select.ts +12 -4
- package/.nuxt/b24ui/separator.ts +10 -2
- package/.nuxt/b24ui/sidebar-body.ts +10 -2
- package/.nuxt/b24ui/sidebar-footer.ts +10 -2
- package/.nuxt/b24ui/sidebar-header.ts +10 -2
- package/.nuxt/b24ui/sidebar-heading.ts +10 -2
- package/.nuxt/b24ui/sidebar-layout.ts +10 -2
- package/.nuxt/b24ui/sidebar-section.ts +10 -2
- package/.nuxt/b24ui/sidebar-spacer.ts +10 -2
- package/.nuxt/b24ui/sidebar.ts +10 -2
- package/.nuxt/b24ui/skeleton.ts +10 -2
- package/.nuxt/b24ui/slideover.ts +10 -2
- package/.nuxt/b24ui/stacked-layout.ts +10 -2
- package/.nuxt/b24ui/switch.ts +10 -2
- package/.nuxt/b24ui/tabs.ts +10 -2
- package/.nuxt/b24ui/textarea.ts +10 -2
- package/.nuxt/b24ui/toast.ts +10 -2
- package/.nuxt/b24ui/toaster.ts +10 -2
- package/.nuxt/b24ui/tooltip.ts +10 -2
- package/cli/templates.mjs +19 -15
- package/dist/meta.d.mts +5675 -7513
- package/dist/meta.mjs +5675 -7513
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Advice.vue +27 -55
- package/dist/runtime/components/Advice.vue.d.ts +56 -0
- package/dist/runtime/components/Alert.vue +35 -97
- package/dist/runtime/components/Alert.vue.d.ts +97 -0
- package/dist/runtime/components/App.vue +24 -34
- package/dist/runtime/components/App.vue.d.ts +23 -0
- package/dist/runtime/components/Avatar.vue +43 -82
- package/dist/runtime/components/Avatar.vue.d.ts +62 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
- package/dist/runtime/components/Badge.vue +40 -84
- package/dist/runtime/components/Badge.vue.d.ts +78 -0
- package/dist/runtime/components/Button.vue +107 -164
- package/dist/runtime/components/Button.vue.d.ts +115 -0
- package/dist/runtime/components/ButtonGroup.vue +25 -52
- package/dist/runtime/components/ButtonGroup.vue.d.ts +63 -0
- package/dist/runtime/components/Calendar.vue +73 -153
- package/dist/runtime/components/Calendar.vue.d.ts +107 -0
- package/dist/runtime/components/Checkbox.vue +42 -74
- package/dist/runtime/components/Checkbox.vue.d.ts +55 -0
- package/dist/runtime/components/Chip.vue +26 -75
- package/dist/runtime/components/Chip.vue.d.ts +77 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +153 -379
- package/dist/runtime/components/Countdown.vue.d.ts +122 -0
- package/dist/runtime/components/DescriptionList.vue +78 -150
- package/dist/runtime/components/DescriptionList.vue.d.ts +109 -0
- package/dist/runtime/components/DropdownMenu.vue +38 -140
- package/dist/runtime/components/DropdownMenu.vue.d.ts +133 -0
- package/dist/runtime/components/DropdownMenuContent.vue +65 -79
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
- package/dist/runtime/components/Form.vue +132 -218
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +36 -81
- package/dist/runtime/components/FormField.vue.d.ts +73 -0
- package/dist/runtime/components/Input.vue +79 -180
- package/dist/runtime/components/Input.vue.d.ts +135 -0
- package/dist/runtime/components/InputMenu.vue +185 -382
- package/dist/runtime/components/InputMenu.vue.d.ts +357 -0
- package/dist/runtime/components/InputNumber.vue +77 -176
- package/dist/runtime/components/InputNumber.vue.d.ts +238 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +55 -0
- package/dist/runtime/components/Link.vue +99 -179
- package/dist/runtime/components/Link.vue.d.ts +129 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +48 -128
- package/dist/runtime/components/Modal.vue.d.ts +124 -0
- package/dist/runtime/components/ModalDialogClose.vue +5 -8
- package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
- package/dist/runtime/components/Navbar.vue +15 -33
- package/dist/runtime/components/Navbar.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarDivider.vue +15 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarSection.vue +15 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarSpacer.vue +15 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +46 -0
- package/dist/runtime/components/NavigationMenu.vue +74 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Popover.vue +40 -82
- package/dist/runtime/components/Popover.vue.d.ts +79 -0
- package/dist/runtime/components/Progress.vue +70 -137
- package/dist/runtime/components/Progress.vue.d.ts +103 -0
- package/dist/runtime/components/RadioGroup.vue +59 -135
- package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
- package/dist/runtime/components/Range.vue +46 -86
- package/dist/runtime/components/Range.vue.d.ts +73 -0
- package/dist/runtime/components/Select.vue +110 -261
- package/dist/runtime/components/Select.vue.d.ts +170 -0
- package/dist/runtime/components/SelectMenu.vue +161 -348
- package/dist/runtime/components/SelectMenu.vue.d.ts +217 -0
- package/dist/runtime/components/Separator.vue +28 -72
- package/dist/runtime/components/Separator.vue.d.ts +77 -0
- package/dist/runtime/components/Sidebar.vue +15 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarBody.vue +17 -39
- package/dist/runtime/components/SidebarBody.vue.d.ts +53 -0
- package/dist/runtime/components/SidebarFooter.vue +15 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarHeader.vue +15 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarHeading.vue +15 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarLayout.vue +34 -71
- package/dist/runtime/components/SidebarLayout.vue.d.ts +65 -0
- package/dist/runtime/components/SidebarSection.vue +15 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarSpacer.vue +15 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +46 -0
- package/dist/runtime/components/Skeleton.vue +14 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +50 -132
- package/dist/runtime/components/Slideover.vue.d.ts +127 -0
- package/dist/runtime/components/StackedLayout.vue +34 -74
- package/dist/runtime/components/StackedLayout.vue.d.ts +65 -0
- package/dist/runtime/components/Switch.vue +46 -96
- package/dist/runtime/components/Switch.vue.d.ts +77 -0
- package/dist/runtime/components/Tabs.vue +41 -106
- package/dist/runtime/components/Tabs.vue.d.ts +104 -0
- package/dist/runtime/components/Textarea.vue +92 -202
- package/dist/runtime/components/Textarea.vue.d.ts +141 -0
- package/dist/runtime/components/Toast.vue +47 -106
- package/dist/runtime/components/Toast.vue.d.ts +95 -0
- package/dist/runtime/components/Toaster.vue +70 -116
- package/dist/runtime/components/Toaster.vue.d.ts +70 -0
- package/dist/runtime/components/Tooltip.vue +36 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
- package/dist/runtime/components/content/TableWrapper.vue +24 -71
- package/dist/runtime/components/content/TableWrapper.vue.d.ts +83 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/prose/A.vue +16 -26
- package/dist/runtime/prose/A.vue.d.ts +27 -0
- package/dist/runtime/prose/Blockquote.vue +14 -26
- package/dist/runtime/prose/Blockquote.vue.d.ts +27 -0
- package/dist/runtime/prose/Code.vue +15 -32
- package/dist/runtime/prose/Code.vue.d.ts +31 -0
- package/dist/runtime/prose/Em.vue +16 -26
- package/dist/runtime/prose/Em.vue.d.ts +27 -0
- package/dist/runtime/prose/H1.vue +14 -26
- package/dist/runtime/prose/H1.vue.d.ts +27 -0
- package/dist/runtime/prose/H2.vue +14 -26
- package/dist/runtime/prose/H2.vue.d.ts +27 -0
- package/dist/runtime/prose/H3.vue +14 -26
- package/dist/runtime/prose/H3.vue.d.ts +27 -0
- package/dist/runtime/prose/H4.vue +14 -26
- package/dist/runtime/prose/H4.vue.d.ts +27 -0
- package/dist/runtime/prose/H5.vue +14 -26
- package/dist/runtime/prose/H5.vue.d.ts +27 -0
- package/dist/runtime/prose/H6.vue +14 -26
- package/dist/runtime/prose/H6.vue.d.ts +27 -0
- package/dist/runtime/prose/Hr.vue +13 -22
- package/dist/runtime/prose/Hr.vue.d.ts +19 -0
- package/dist/runtime/prose/Img.vue +13 -26
- package/dist/runtime/prose/Img.vue.d.ts +19 -0
- package/dist/runtime/prose/Li.vue +14 -26
- package/dist/runtime/prose/Li.vue.d.ts +27 -0
- package/dist/runtime/prose/Ol.vue +14 -26
- package/dist/runtime/prose/Ol.vue.d.ts +27 -0
- package/dist/runtime/prose/P.vue +14 -26
- package/dist/runtime/prose/P.vue.d.ts +27 -0
- package/dist/runtime/prose/Pre.vue +17 -33
- package/dist/runtime/prose/Pre.vue.d.ts +47 -0
- package/dist/runtime/prose/Strong.vue +14 -26
- package/dist/runtime/prose/Strong.vue.d.ts +27 -0
- package/dist/runtime/prose/Table.vue +21 -57
- package/dist/runtime/prose/Table.vue.d.ts +74 -0
- package/dist/runtime/prose/Tbody.vue +14 -26
- package/dist/runtime/prose/Tbody.vue.d.ts +27 -0
- package/dist/runtime/prose/Td.vue +14 -26
- package/dist/runtime/prose/Td.vue.d.ts +27 -0
- package/dist/runtime/prose/Th.vue +14 -26
- package/dist/runtime/prose/Th.vue.d.ts +27 -0
- package/dist/runtime/prose/Thead.vue +14 -26
- package/dist/runtime/prose/Thead.vue.d.ts +27 -0
- package/dist/runtime/prose/Tr.vue +14 -26
- package/dist/runtime/prose/Tr.vue.d.ts +27 -0
- package/dist/runtime/prose/Ul.vue +14 -26
- package/dist/runtime/prose/Ul.vue.d.ts +27 -0
- package/dist/runtime/types/form.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +42 -3
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Link.vue +122 -208
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.wBs9vEU5.mjs} +33 -8
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +19 -27
- package/dist/meta.cjs +0 -72112
- package/dist/meta.d.cts +0 -72110
- package/dist/meta.d.ts +0 -72110
- package/dist/module.cjs +0 -63
- package/dist/module.d.cts +0 -15
- package/dist/module.d.ts +0 -15
- package/dist/shared/b24ui-nuxt.DrKwIWoc.cjs +0 -7721
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -236
- package/dist/unplugin.d.cts +0 -33
- package/dist/unplugin.d.ts +0 -33
- package/dist/vite.cjs +0 -21
- package/dist/vite.d.cts +0 -14
- package/dist/vite.d.ts +0 -14
|
@@ -1,213 +1,75 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectContentEmits, SelectArrowProps } from 'reka-ui'
|
|
4
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import _appConfig from '#build/app.config'
|
|
6
|
-
import theme from '#build/b24ui/select'
|
|
7
|
-
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
-
import { tv } from '../utils/tv'
|
|
9
|
-
import type { AvatarProps, ChipProps, InputProps, IconComponent } from '../types'
|
|
10
|
-
import type {
|
|
11
|
-
AcceptableValue,
|
|
12
|
-
ArrayOrNested,
|
|
13
|
-
GetItemKeys,
|
|
14
|
-
GetItemValue,
|
|
15
|
-
GetModelValue,
|
|
16
|
-
GetModelValueEmits,
|
|
17
|
-
NestedItem,
|
|
18
|
-
PartialString,
|
|
19
|
-
EmitsToProps
|
|
20
|
-
} from '../types/utils'
|
|
21
|
-
|
|
22
|
-
const appConfigSelect = _appConfig as AppConfig & { b24ui: { select: Partial<typeof theme> } }
|
|
23
|
-
|
|
24
|
-
const select = tv({ extend: tv(theme), ...(appConfigSelect.b24ui?.select || {}) })
|
|
25
|
-
|
|
26
|
-
type SelectVariants = VariantProps<typeof select>
|
|
27
|
-
|
|
28
|
-
interface SelectItemBase {
|
|
29
|
-
label?: string
|
|
30
|
-
/**
|
|
31
|
-
* Display an icon on the left side.
|
|
32
|
-
* @IconComponent
|
|
33
|
-
*/
|
|
34
|
-
icon?: IconComponent
|
|
35
|
-
avatar?: AvatarProps
|
|
36
|
-
color?: SelectVariants['color']
|
|
37
|
-
chip?: ChipProps
|
|
38
|
-
/**
|
|
39
|
-
* The item type.
|
|
40
|
-
* @defaultValue 'item'
|
|
41
|
-
*/
|
|
42
|
-
type?: 'label' | 'separator' | 'item'
|
|
43
|
-
value?: string | number
|
|
44
|
-
disabled?: boolean
|
|
45
|
-
[key: string]: any
|
|
46
|
-
}
|
|
47
|
-
export type SelectItem = SelectItemBase | AcceptableValue | boolean
|
|
48
|
-
|
|
49
|
-
export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = 'value', M extends boolean = false> extends Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'>, UseComponentIconsProps {
|
|
50
|
-
id?: string
|
|
51
|
-
/** The placeholder text when the select is empty. */
|
|
52
|
-
placeholder?: string
|
|
53
|
-
/**
|
|
54
|
-
* @defaultValue 'primary'
|
|
55
|
-
*/
|
|
56
|
-
color?: SelectVariants['color']
|
|
57
|
-
/**
|
|
58
|
-
* @defaultValue 'md'
|
|
59
|
-
*/
|
|
60
|
-
size?: SelectVariants['size']
|
|
61
|
-
/**
|
|
62
|
-
* Removes padding from input
|
|
63
|
-
* @defaultValue false
|
|
64
|
-
*/
|
|
65
|
-
noPadding?: boolean
|
|
66
|
-
/**
|
|
67
|
-
* Removes all borders (rings)
|
|
68
|
-
* @defaultValue false
|
|
69
|
-
*/
|
|
70
|
-
noBorder?: boolean
|
|
71
|
-
/**
|
|
72
|
-
* Removes all borders (rings) except the bottom one
|
|
73
|
-
* @defaultValue false
|
|
74
|
-
*/
|
|
75
|
-
underline?: boolean
|
|
76
|
-
/**
|
|
77
|
-
* Rounds the corners of the button
|
|
78
|
-
* @defaultValue false
|
|
79
|
-
*/
|
|
80
|
-
rounded?: boolean
|
|
81
|
-
tag?: string
|
|
82
|
-
/**
|
|
83
|
-
* @defaultValue 'primary'
|
|
84
|
-
*/
|
|
85
|
-
tagColor?: SelectVariants['tagColor']
|
|
86
|
-
/**
|
|
87
|
-
* The icon displayed to open the menu.
|
|
88
|
-
* @defaultValue icons.chevronDown
|
|
89
|
-
* @IconComponent
|
|
90
|
-
*/
|
|
91
|
-
trailingIcon?: IconComponent
|
|
92
|
-
/**
|
|
93
|
-
* The icon displayed when an item is selected.
|
|
94
|
-
* @defaultValue icons.check
|
|
95
|
-
* @IconComponent
|
|
96
|
-
*/
|
|
97
|
-
selectedIcon?: IconComponent
|
|
98
|
-
/**
|
|
99
|
-
* The content of the menu.
|
|
100
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
101
|
-
*/
|
|
102
|
-
content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<SelectContentEmits>>
|
|
103
|
-
/**
|
|
104
|
-
* Display an arrow alongside the menu.
|
|
105
|
-
* @defaultValue false
|
|
106
|
-
*/
|
|
107
|
-
arrow?: boolean | Omit<SelectArrowProps, 'as' | 'asChild'>
|
|
108
|
-
/**
|
|
109
|
-
* Render the menu in a portal.
|
|
110
|
-
* @defaultValue true
|
|
111
|
-
*/
|
|
112
|
-
portal?: boolean
|
|
113
|
-
/**
|
|
114
|
-
* When `items` is an array of objects, select the field to use as the value.
|
|
115
|
-
* @defaultValue 'value'
|
|
116
|
-
*/
|
|
117
|
-
valueKey?: VK
|
|
118
|
-
/**
|
|
119
|
-
* When `items` is an array of objects, select the field to use as the label.
|
|
120
|
-
* @defaultValue 'label'
|
|
121
|
-
*/
|
|
122
|
-
labelKey?: keyof NestedItem<T>
|
|
123
|
-
items?: T
|
|
124
|
-
/**
|
|
125
|
-
* The value of the Select when initially rendered. Use when you do not need to control the state of the Select
|
|
126
|
-
*/
|
|
127
|
-
defaultValue?: GetModelValue<T, VK, M>
|
|
128
|
-
/**
|
|
129
|
-
* The controlled value of the Select. Can be bind as `v-model`
|
|
130
|
-
*/
|
|
131
|
-
modelValue?: GetModelValue<T, VK, M>
|
|
132
|
-
/**
|
|
133
|
-
* Whether multiple options can be selected or not
|
|
134
|
-
* @defaultValue false
|
|
135
|
-
*/
|
|
136
|
-
multiple?: M & boolean
|
|
137
|
-
/**
|
|
138
|
-
* Highlight the ring color like a focus state
|
|
139
|
-
* @defaultValue false
|
|
140
|
-
*/
|
|
141
|
-
highlight?: boolean
|
|
142
|
-
class?: any
|
|
143
|
-
b24ui?: PartialString<typeof select.slots>
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type SelectEmits<A extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Omit<SelectRootEmits, 'update:modelValue'> & {
|
|
147
|
-
change: [payload: Event]
|
|
148
|
-
blur: [payload: FocusEvent]
|
|
149
|
-
focus: [payload: FocusEvent]
|
|
150
|
-
} & GetModelValueEmits<A, VK, M>
|
|
151
|
-
|
|
152
|
-
type SlotProps<T extends SelectItem> = (props: { item: T, index: number }) => any
|
|
153
|
-
|
|
154
|
-
export interface SelectSlots<
|
|
155
|
-
A extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>,
|
|
156
|
-
VK extends GetItemKeys<A> | undefined = undefined,
|
|
157
|
-
M extends boolean = false,
|
|
158
|
-
T extends NestedItem<A> = NestedItem<A>
|
|
159
|
-
> {
|
|
160
|
-
'leading'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof select> }): any
|
|
161
|
-
'default'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean }): any
|
|
162
|
-
'trailing'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof select> }): any
|
|
163
|
-
'item': SlotProps<T>
|
|
164
|
-
'item-leading': SlotProps<T>
|
|
165
|
-
'item-label': SlotProps<T>
|
|
166
|
-
'item-trailing': SlotProps<T>
|
|
167
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/select";
|
|
168
3
|
</script>
|
|
169
4
|
|
|
170
|
-
<script setup
|
|
171
|
-
import { computed, toRef } from
|
|
172
|
-
import { Primitive, SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectScrollUpButton, SelectScrollDownButton, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from
|
|
173
|
-
import { defu } from
|
|
174
|
-
import { reactivePick } from
|
|
175
|
-
import {
|
|
176
|
-
import {
|
|
177
|
-
import {
|
|
178
|
-
import {
|
|
179
|
-
import
|
|
180
|
-
import
|
|
181
|
-
import
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const props =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, toRef } from "vue";
|
|
7
|
+
import { Primitive, SelectRoot, SelectArrow, SelectTrigger, SelectPortal, SelectContent, SelectViewport, SelectScrollUpButton, SelectScrollDownButton, SelectLabel, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectSeparator, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { defu } from "defu";
|
|
9
|
+
import { reactivePick } from "@vueuse/core";
|
|
10
|
+
import { useAppConfig } from "#imports";
|
|
11
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
12
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
13
|
+
import { useFormField } from "../composables/useFormField";
|
|
14
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
15
|
+
import { tv } from "../utils/tv";
|
|
16
|
+
import icons from "../dictionary/icons";
|
|
17
|
+
import B24Avatar from "./Avatar.vue";
|
|
18
|
+
import B24Chip from "./Chip.vue";
|
|
19
|
+
defineOptions({ inheritAttrs: false });
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
id: { type: String, required: false },
|
|
22
|
+
placeholder: { type: String, required: false },
|
|
23
|
+
color: { type: null, required: false },
|
|
24
|
+
size: { type: null, required: false },
|
|
25
|
+
noPadding: { type: Boolean, required: false },
|
|
26
|
+
noBorder: { type: Boolean, required: false },
|
|
27
|
+
underline: { type: Boolean, required: false },
|
|
28
|
+
rounded: { type: Boolean, required: false },
|
|
29
|
+
tag: { type: String, required: false },
|
|
30
|
+
tagColor: { type: null, required: false },
|
|
31
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
32
|
+
selectedIcon: { type: [Function, Object], required: false },
|
|
33
|
+
content: { type: Object, required: false },
|
|
34
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
35
|
+
portal: { type: Boolean, required: false, default: true },
|
|
36
|
+
valueKey: { type: null, required: false, default: "value" },
|
|
37
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
38
|
+
items: { type: null, required: false },
|
|
39
|
+
defaultValue: { type: null, required: false },
|
|
40
|
+
modelValue: { type: null, required: false },
|
|
41
|
+
multiple: { type: Boolean, required: false },
|
|
42
|
+
highlight: { type: Boolean, required: false },
|
|
43
|
+
class: { type: null, required: false },
|
|
44
|
+
b24ui: { type: null, required: false },
|
|
45
|
+
open: { type: Boolean, required: false },
|
|
46
|
+
defaultOpen: { type: Boolean, required: false },
|
|
47
|
+
autocomplete: { type: String, required: false },
|
|
48
|
+
disabled: { type: Boolean, required: false },
|
|
49
|
+
name: { type: String, required: false },
|
|
50
|
+
required: { type: Boolean, required: false },
|
|
51
|
+
icon: { type: [Function, Object], required: false },
|
|
52
|
+
avatar: { type: Object, required: false },
|
|
53
|
+
loading: { type: Boolean, required: false },
|
|
54
|
+
trailing: { type: Boolean, required: false }
|
|
55
|
+
});
|
|
56
|
+
const emits = defineEmits(["update:open", "change", "blur", "focus", "update:modelValue"]);
|
|
57
|
+
const slots = defineSlots();
|
|
58
|
+
const appConfig = useAppConfig();
|
|
59
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "disabled", "autocomplete", "required", "multiple"), emits);
|
|
60
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
61
|
+
const arrowProps = toRef(() => props.arrow);
|
|
62
|
+
const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
63
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
199
64
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(
|
|
200
65
|
props,
|
|
201
66
|
{ trailingIcon: icons.chevronDown }
|
|
202
|
-
)))
|
|
203
|
-
|
|
204
|
-
const selectSize = computed(() => buttonGroupSize.value || formGroupSize.value)
|
|
205
|
-
|
|
67
|
+
)));
|
|
68
|
+
const selectSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
206
69
|
const isTag = computed(() => {
|
|
207
|
-
return props.tag
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
const b24ui = computed(() => select({
|
|
70
|
+
return props.tag;
|
|
71
|
+
});
|
|
72
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.select || {} })({
|
|
211
73
|
color: color.value,
|
|
212
74
|
size: selectSize?.value,
|
|
213
75
|
loading: props.loading,
|
|
@@ -220,54 +82,40 @@ const b24ui = computed(() => select({
|
|
|
220
82
|
leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
|
|
221
83
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
222
84
|
buttonGroup: orientation.value
|
|
223
|
-
}))
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
: [props.items]
|
|
230
|
-
: []
|
|
231
|
-
)
|
|
232
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
233
|
-
const items = computed(() => groups.value.flatMap(group => group) as T[])
|
|
234
|
-
|
|
235
|
-
function displayValue(value?: GetItemValue<T, VK> | GetItemValue<T, VK>[]): string {
|
|
85
|
+
}));
|
|
86
|
+
const groups = computed(
|
|
87
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
88
|
+
);
|
|
89
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
90
|
+
function displayValue(value) {
|
|
236
91
|
if (props.multiple && Array.isArray(value)) {
|
|
237
|
-
return value.map(v => displayValue(v)).filter(Boolean).join(
|
|
92
|
+
return value.map((v) => displayValue(v)).filter(Boolean).join(", ");
|
|
238
93
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
94
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
95
|
+
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
242
96
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
emitFormChange()
|
|
250
|
-
emitFormInput()
|
|
97
|
+
function onUpdate(value) {
|
|
98
|
+
const event = new Event("change", { target: { value } });
|
|
99
|
+
emits("change", event);
|
|
100
|
+
emitFormChange();
|
|
101
|
+
emitFormInput();
|
|
251
102
|
}
|
|
252
|
-
|
|
253
|
-
function onUpdateOpen(value: boolean) {
|
|
103
|
+
function onUpdateOpen(value) {
|
|
254
104
|
if (!value) {
|
|
255
|
-
const event = new FocusEvent(
|
|
256
|
-
emits(
|
|
257
|
-
emitFormBlur()
|
|
105
|
+
const event = new FocusEvent("blur");
|
|
106
|
+
emits("blur", event);
|
|
107
|
+
emitFormBlur();
|
|
258
108
|
} else {
|
|
259
|
-
const event = new FocusEvent(
|
|
260
|
-
emits(
|
|
261
|
-
emitFormFocus()
|
|
109
|
+
const event = new FocusEvent("focus");
|
|
110
|
+
emits("focus", event);
|
|
111
|
+
emitFormFocus();
|
|
262
112
|
}
|
|
263
113
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return typeof item === 'object' && item !== null
|
|
114
|
+
function isSelectItem(item) {
|
|
115
|
+
return typeof item === "object" && item !== null;
|
|
267
116
|
}
|
|
268
117
|
</script>
|
|
269
118
|
|
|
270
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
271
119
|
<template>
|
|
272
120
|
<Primitive as="div" :class="b24ui.root({ class: [props.b24ui?.root] })">
|
|
273
121
|
<SelectRoot
|
|
@@ -276,8 +124,8 @@ function isSelectItem(item: SelectItem): item is SelectItemBase {
|
|
|
276
124
|
v-bind="rootProps"
|
|
277
125
|
:autocomplete="autocomplete"
|
|
278
126
|
:disabled="disabled"
|
|
279
|
-
:default-value="
|
|
280
|
-
:model-value="
|
|
127
|
+
:default-value="defaultValue"
|
|
128
|
+
:model-value="modelValue"
|
|
281
129
|
@update:model-value="onUpdate"
|
|
282
130
|
@update:open="onUpdateOpen"
|
|
283
131
|
>
|
|
@@ -287,29 +135,29 @@ function isSelectItem(item: SelectItem): item is SelectItemBase {
|
|
|
287
135
|
</div>
|
|
288
136
|
|
|
289
137
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
290
|
-
<slot name="leading" :model-value="
|
|
138
|
+
<slot name="leading" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
291
139
|
<Component
|
|
292
140
|
:is="leadingIconName"
|
|
293
141
|
v-if="isLeading && leadingIconName"
|
|
294
142
|
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
295
143
|
/>
|
|
296
|
-
<B24Avatar v-else-if="!!avatar" :size="
|
|
144
|
+
<B24Avatar v-else-if="!!avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar })" />
|
|
297
145
|
</slot>
|
|
298
146
|
</span>
|
|
299
147
|
|
|
300
|
-
<slot :model-value="
|
|
301
|
-
<template v-for="displayedModelValue in [displayValue(modelValue
|
|
148
|
+
<slot :model-value="modelValue" :open="open">
|
|
149
|
+
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
302
150
|
<span v-if="displayedModelValue" :class="b24ui.value({ class: props.b24ui?.value })">
|
|
303
151
|
{{ displayedModelValue }}
|
|
304
152
|
</span>
|
|
305
153
|
<span v-else :class="b24ui.placeholder({ class: props.b24ui?.placeholder })">
|
|
306
|
-
{{ placeholder ?? '
|
|
154
|
+
{{ placeholder ?? '\xA0' }}
|
|
307
155
|
</span>
|
|
308
156
|
</template>
|
|
309
157
|
</slot>
|
|
310
158
|
|
|
311
159
|
<span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
312
|
-
<slot name="trailing" :model-value="
|
|
160
|
+
<slot name="trailing" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
313
161
|
<Component
|
|
314
162
|
:is="trailingIconName"
|
|
315
163
|
v-if="trailingIconName"
|
|
@@ -331,28 +179,29 @@ function isSelectItem(item: SelectItem): item is SelectItemBase {
|
|
|
331
179
|
<SelectGroup v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
332
180
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
333
181
|
<SelectLabel v-if="isSelectItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
334
|
-
{{ get(item, props.labelKey
|
|
182
|
+
{{ get(item, props.labelKey) }}
|
|
335
183
|
</SelectLabel>
|
|
336
184
|
|
|
337
185
|
<SelectSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
338
186
|
|
|
339
187
|
<SelectItem
|
|
340
188
|
v-else
|
|
341
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color :
|
|
189
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color : void 0 })"
|
|
342
190
|
:disabled="isSelectItem(item) && item.disabled"
|
|
343
|
-
:value="isSelectItem(item) ? get(item, props.valueKey
|
|
191
|
+
:value="isSelectItem(item) ? get(item, props.valueKey) : item"
|
|
192
|
+
@select="isSelectItem(item) && item.onSelect?.($event)"
|
|
344
193
|
>
|
|
345
|
-
<slot name="item" :item="
|
|
346
|
-
<slot name="item-leading" :item="
|
|
194
|
+
<slot name="item" :item="item" :index="index">
|
|
195
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
347
196
|
<Component
|
|
348
197
|
:is="item.icon"
|
|
349
198
|
v-if="isSelectItem(item) && item.icon"
|
|
350
199
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
351
200
|
/>
|
|
352
|
-
<B24Avatar v-else-if="isSelectItem(item) && item.avatar" :size="
|
|
201
|
+
<B24Avatar v-else-if="isSelectItem(item) && item.avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar, colorItem: item?.color })" />
|
|
353
202
|
<B24Chip
|
|
354
203
|
v-else-if="isSelectItem(item) && item.chip"
|
|
355
|
-
:size="
|
|
204
|
+
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
356
205
|
inset
|
|
357
206
|
standalone
|
|
358
207
|
v-bind="item.chip"
|
|
@@ -361,18 +210,18 @@ function isSelectItem(item: SelectItem): item is SelectItemBase {
|
|
|
361
210
|
</slot>
|
|
362
211
|
|
|
363
212
|
<SelectItemText :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
364
|
-
<slot name="item-label" :item="
|
|
365
|
-
{{ isSelectItem(item) ? get(item, props.labelKey
|
|
213
|
+
<slot name="item-label" :item="item" :index="index">
|
|
214
|
+
{{ isSelectItem(item) ? get(item, props.labelKey) : item }}
|
|
366
215
|
</slot>
|
|
367
216
|
</SelectItemText>
|
|
368
217
|
|
|
369
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color :
|
|
370
|
-
<slot name="item-trailing" :item="
|
|
218
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color : void 0 })">
|
|
219
|
+
<slot name="item-trailing" :item="item" :index="index" />
|
|
371
220
|
|
|
372
221
|
<SelectItemIndicator as-child>
|
|
373
222
|
<Component
|
|
374
223
|
:is="selectedIcon || icons.check"
|
|
375
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color :
|
|
224
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color : void 0 })"
|
|
376
225
|
/>
|
|
377
226
|
</SelectItemIndicator>
|
|
378
227
|
</span>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectContentEmits, SelectArrowProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/b24ui/select';
|
|
4
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
5
|
+
import type { AvatarProps, ChipProps, IconComponent } from '../types';
|
|
6
|
+
import type { AcceptableValue, ArrayOrNested, GetItemKeys, GetModelValue, GetModelValueEmits, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils';
|
|
7
|
+
type Select = ComponentConfig<typeof theme, AppConfig, 'select'>;
|
|
8
|
+
interface SelectItemBase {
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Display an icon on the left side.
|
|
12
|
+
* @IconComponent
|
|
13
|
+
*/
|
|
14
|
+
icon?: IconComponent;
|
|
15
|
+
avatar?: AvatarProps;
|
|
16
|
+
color?: Select['variants']['color'];
|
|
17
|
+
chip?: ChipProps;
|
|
18
|
+
/**
|
|
19
|
+
* The item type.
|
|
20
|
+
* @defaultValue 'item'
|
|
21
|
+
*/
|
|
22
|
+
type?: 'label' | 'separator' | 'item';
|
|
23
|
+
value?: string | number;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
onSelect?(e?: Event): void;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
export type SelectItem = SelectItemBase | AcceptableValue | boolean;
|
|
29
|
+
export interface SelectProps<T extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<T> = 'value', M extends boolean = false> extends Omit<SelectRootProps<T>, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'>, UseComponentIconsProps {
|
|
30
|
+
id?: string;
|
|
31
|
+
/** The placeholder text when the select is empty. */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @defaultValue 'primary'
|
|
35
|
+
*/
|
|
36
|
+
color?: Select['variants']['color'];
|
|
37
|
+
/**
|
|
38
|
+
* @defaultValue 'md'
|
|
39
|
+
*/
|
|
40
|
+
size?: Select['variants']['size'];
|
|
41
|
+
/**
|
|
42
|
+
* Removes padding from input
|
|
43
|
+
* @defaultValue false
|
|
44
|
+
*/
|
|
45
|
+
noPadding?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Removes all borders (rings)
|
|
48
|
+
* @defaultValue false
|
|
49
|
+
*/
|
|
50
|
+
noBorder?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Removes all borders (rings) except the bottom one
|
|
53
|
+
* @defaultValue false
|
|
54
|
+
*/
|
|
55
|
+
underline?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Rounds the corners of the button
|
|
58
|
+
* @defaultValue false
|
|
59
|
+
*/
|
|
60
|
+
rounded?: boolean;
|
|
61
|
+
tag?: string;
|
|
62
|
+
/**
|
|
63
|
+
* @defaultValue 'primary'
|
|
64
|
+
*/
|
|
65
|
+
tagColor?: Select['variants']['tagColor'];
|
|
66
|
+
/**
|
|
67
|
+
* The icon displayed to open the menu.
|
|
68
|
+
* @defaultValue icons.chevronDown
|
|
69
|
+
* @IconComponent
|
|
70
|
+
*/
|
|
71
|
+
trailingIcon?: IconComponent;
|
|
72
|
+
/**
|
|
73
|
+
* The icon displayed when an item is selected.
|
|
74
|
+
* @defaultValue icons.check
|
|
75
|
+
* @IconComponent
|
|
76
|
+
*/
|
|
77
|
+
selectedIcon?: IconComponent;
|
|
78
|
+
/**
|
|
79
|
+
* The content of the menu.
|
|
80
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
81
|
+
*/
|
|
82
|
+
content?: Omit<SelectContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<SelectContentEmits>>;
|
|
83
|
+
/**
|
|
84
|
+
* Display an arrow alongside the menu.
|
|
85
|
+
* @defaultValue false
|
|
86
|
+
*/
|
|
87
|
+
arrow?: boolean | Omit<SelectArrowProps, 'as' | 'asChild'>;
|
|
88
|
+
/**
|
|
89
|
+
* Render the menu in a portal.
|
|
90
|
+
* @defaultValue true
|
|
91
|
+
*/
|
|
92
|
+
portal?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* When `items` is an array of objects, select the field to use as the value.
|
|
95
|
+
* @defaultValue 'value'
|
|
96
|
+
*/
|
|
97
|
+
valueKey?: VK;
|
|
98
|
+
/**
|
|
99
|
+
* When `items` is an array of objects, select the field to use as the label.
|
|
100
|
+
* @defaultValue 'label'
|
|
101
|
+
*/
|
|
102
|
+
labelKey?: keyof NestedItem<T>;
|
|
103
|
+
items?: T;
|
|
104
|
+
/**
|
|
105
|
+
* The value of the Select when initially rendered. Use when you do not need to control the state of the Select
|
|
106
|
+
*/
|
|
107
|
+
defaultValue?: GetModelValue<T, VK, M>;
|
|
108
|
+
/**
|
|
109
|
+
* The controlled value of the Select. Can be bind as `v-model`
|
|
110
|
+
*/
|
|
111
|
+
modelValue?: GetModelValue<T, VK, M>;
|
|
112
|
+
/**
|
|
113
|
+
* Whether multiple options can be selected or not
|
|
114
|
+
* @defaultValue false
|
|
115
|
+
*/
|
|
116
|
+
multiple?: M & boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Highlight the ring color like a focus state
|
|
119
|
+
* @defaultValue false
|
|
120
|
+
*/
|
|
121
|
+
highlight?: boolean;
|
|
122
|
+
class?: any;
|
|
123
|
+
b24ui?: Select['slots'];
|
|
124
|
+
}
|
|
125
|
+
export type SelectEmits<A extends ArrayOrNested<SelectItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Omit<SelectRootEmits, 'update:modelValue'> & {
|
|
126
|
+
change: [payload: Event];
|
|
127
|
+
blur: [payload: FocusEvent];
|
|
128
|
+
focus: [payload: FocusEvent];
|
|
129
|
+
} & GetModelValueEmits<A, VK, M>;
|
|
130
|
+
type SlotProps<T extends SelectItem> = (props: {
|
|
131
|
+
item: T;
|
|
132
|
+
index: number;
|
|
133
|
+
}) => any;
|
|
134
|
+
export interface SelectSlots<A extends ArrayOrNested<SelectItem> = ArrayOrNested<SelectItem>, VK extends GetItemKeys<A> | undefined = undefined, M extends boolean = false, T extends NestedItem<A> = NestedItem<A>> {
|
|
135
|
+
'leading'(props: {
|
|
136
|
+
modelValue?: GetModelValue<A, VK, M>;
|
|
137
|
+
open: boolean;
|
|
138
|
+
b24ui: {
|
|
139
|
+
[K in keyof Required<Select['slots']>]: (props?: Record<string, any>) => string;
|
|
140
|
+
};
|
|
141
|
+
}): any;
|
|
142
|
+
'default'(props: {
|
|
143
|
+
modelValue?: GetModelValue<A, VK, M>;
|
|
144
|
+
open: boolean;
|
|
145
|
+
}): any;
|
|
146
|
+
'trailing'(props: {
|
|
147
|
+
modelValue?: GetModelValue<A, VK, M>;
|
|
148
|
+
open: boolean;
|
|
149
|
+
b24ui: {
|
|
150
|
+
[K in keyof Required<Select['slots']>]: (props?: Record<string, any>) => string;
|
|
151
|
+
};
|
|
152
|
+
}): any;
|
|
153
|
+
'item': SlotProps<T>;
|
|
154
|
+
'item-leading': SlotProps<T>;
|
|
155
|
+
'item-label': SlotProps<T>;
|
|
156
|
+
'item-trailing': SlotProps<T>;
|
|
157
|
+
}
|
|
158
|
+
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<{
|
|
159
|
+
props: __VLS_PrettifyLocal<any & SelectProps<T, VK, M> & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
|
|
160
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
161
|
+
attrs: any;
|
|
162
|
+
slots: Readonly<SelectSlots<T, VK, M, NestedItem<T>>> & SelectSlots<T, VK, M, NestedItem<T>>;
|
|
163
|
+
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);
|
|
164
|
+
}>) => import("vue").VNode & {
|
|
165
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
166
|
+
};
|
|
167
|
+
export default _default;
|
|
168
|
+
type __VLS_PrettifyLocal<T> = {
|
|
169
|
+
[K in keyof T]: T[K];
|
|
170
|
+
} & {};
|