@bitrix24/b24ui-nuxt 0.5.8 → 0.5.10
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/navigation-menu.ts +0 -2
- package/.nuxt/b24ui/popover.ts +1 -1
- package/.nuxt/b24ui/textarea.ts +43 -0
- package/dist/meta.d.mts +5090 -4900
- package/dist/meta.mjs +5090 -4900
- package/dist/module.json +5 -5
- package/dist/module.mjs +11 -7
- package/dist/runtime/components/Advice.vue +47 -54
- package/dist/runtime/components/Advice.vue.d.ts +170 -0
- package/dist/runtime/components/Alert.vue +71 -96
- package/dist/runtime/components/Alert.vue.d.ts +464 -0
- package/dist/runtime/components/App.vue +37 -34
- package/dist/runtime/components/App.vue.d.ts +23 -0
- package/dist/runtime/components/Avatar.vue +69 -81
- package/dist/runtime/components/Avatar.vue.d.ts +281 -0
- package/dist/runtime/components/AvatarGroup.vue +53 -76
- package/dist/runtime/components/AvatarGroup.vue.d.ts +204 -0
- package/dist/runtime/components/Badge.vue +83 -83
- package/dist/runtime/components/Badge.vue.d.ts +517 -0
- package/dist/runtime/components/Button.vue +219 -149
- package/dist/runtime/components/Button.vue.d.ts +640 -0
- package/dist/runtime/components/ButtonGroup.vue +35 -51
- package/dist/runtime/components/ButtonGroup.vue.d.ts +116 -0
- package/dist/runtime/components/Calendar.vue +186 -152
- package/dist/runtime/components/Calendar.vue.d.ts +437 -0
- package/dist/runtime/components/Checkbox.vue +84 -73
- package/dist/runtime/components/Checkbox.vue.d.ts +354 -0
- package/dist/runtime/components/Chip.vue +59 -74
- package/dist/runtime/components/Chip.vue.d.ts +271 -0
- package/dist/runtime/components/Collapsible.vue +44 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +118 -0
- package/dist/runtime/components/Container.vue +18 -27
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +198 -378
- package/dist/runtime/components/Countdown.vue.d.ts +356 -0
- package/dist/runtime/components/DescriptionList.vue +102 -149
- package/dist/runtime/components/DescriptionList.vue.d.ts +379 -0
- package/dist/runtime/components/DropdownMenu.vue +83 -139
- package/dist/runtime/components/DropdownMenu.vue.d.ts +533 -0
- package/dist/runtime/components/DropdownMenuContent.vue +137 -81
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +228 -0
- package/dist/runtime/components/Form.vue +162 -216
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +76 -80
- package/dist/runtime/components/FormField.vue.d.ts +282 -0
- package/dist/runtime/components/Input.vue +166 -185
- package/dist/runtime/components/Input.vue.d.ts +755 -0
- package/dist/runtime/components/InputMenu.vue +300 -381
- package/dist/runtime/components/InputMenu.vue.d.ts +1504 -0
- package/dist/runtime/components/InputNumber.vue +180 -177
- package/dist/runtime/components/InputNumber.vue.d.ts +658 -0
- package/dist/runtime/components/Kbd.vue +33 -45
- package/dist/runtime/components/Kbd.vue.d.ts +109 -0
- package/dist/runtime/components/Link.vue +179 -173
- package/dist/runtime/components/Link.vue.d.ts +129 -0
- package/dist/runtime/components/LinkBase.vue +64 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +105 -127
- package/dist/runtime/components/Modal.vue.d.ts +327 -0
- package/dist/runtime/components/ModalDialogClose.vue +4 -8
- package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
- package/dist/runtime/components/Navbar.vue +24 -33
- package/dist/runtime/components/Navbar.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarDivider.vue +24 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSection.vue +24 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSpacer.vue +24 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/NavigationMenu.vue +152 -216
- package/dist/runtime/components/NavigationMenu.vue.d.ts +824 -0
- package/dist/runtime/components/OverlayProvider.vue +13 -17
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Popover.vue +81 -81
- package/dist/runtime/components/Popover.vue.d.ts +147 -0
- package/dist/runtime/components/Progress.vue +109 -136
- package/dist/runtime/components/Progress.vue.d.ts +592 -0
- package/dist/runtime/components/RadioGroup.vue +120 -134
- package/dist/runtime/components/RadioGroup.vue.d.ts +723 -0
- package/dist/runtime/components/Range.vue +94 -85
- package/dist/runtime/components/Range.vue.d.ts +417 -0
- package/dist/runtime/components/Select.vue +212 -260
- package/dist/runtime/components/Select.vue.d.ts +1200 -0
- package/dist/runtime/components/SelectMenu.vue +272 -366
- package/dist/runtime/components/SelectMenu.vue.d.ts +1298 -0
- package/dist/runtime/components/Separator.vue +61 -71
- package/dist/runtime/components/Separator.vue.d.ts +400 -0
- package/dist/runtime/components/Sidebar.vue +24 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarBody.vue +30 -38
- package/dist/runtime/components/SidebarBody.vue.d.ts +90 -0
- package/dist/runtime/components/SidebarFooter.vue +24 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeader.vue +24 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeading.vue +24 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarLayout.vue +40 -70
- package/dist/runtime/components/SidebarLayout.vue.d.ts +222 -0
- package/dist/runtime/components/SidebarSection.vue +24 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarSpacer.vue +24 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/Skeleton.vue +17 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +108 -131
- package/dist/runtime/components/Slideover.vue.d.ts +360 -0
- package/dist/runtime/components/StackedLayout.vue +40 -73
- package/dist/runtime/components/StackedLayout.vue.d.ts +192 -0
- package/dist/runtime/components/Switch.vue +100 -95
- package/dist/runtime/components/Switch.vue.d.ts +587 -0
- package/dist/runtime/components/Tabs.vue +83 -105
- package/dist/runtime/components/Tabs.vue.d.ts +453 -0
- package/dist/runtime/components/Textarea.vue +215 -203
- package/dist/runtime/components/Textarea.vue.d.ts +601 -0
- package/dist/runtime/components/Toast.vue +94 -105
- package/dist/runtime/components/Toast.vue.d.ts +438 -0
- package/dist/runtime/components/Toaster.vue +94 -111
- package/dist/runtime/components/Toaster.vue.d.ts +219 -0
- package/dist/runtime/components/Tooltip.vue +78 -64
- package/dist/runtime/components/Tooltip.vue.d.ts +186 -0
- package/dist/runtime/components/content/TableWrapper.vue +58 -70
- package/dist/runtime/components/content/TableWrapper.vue.d.ts +237 -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 +1 -1
- package/dist/runtime/prose/A.vue +18 -23
- package/dist/runtime/prose/A.vue.d.ts +84 -0
- package/dist/runtime/prose/Blockquote.vue +18 -23
- package/dist/runtime/prose/Blockquote.vue.d.ts +84 -0
- package/dist/runtime/prose/Code.vue +23 -31
- package/dist/runtime/prose/Code.vue.d.ts +97 -0
- package/dist/runtime/prose/Em.vue +18 -23
- package/dist/runtime/prose/Em.vue.d.ts +84 -0
- package/dist/runtime/prose/H1.vue +18 -23
- package/dist/runtime/prose/H1.vue.d.ts +97 -0
- package/dist/runtime/prose/H2.vue +18 -23
- package/dist/runtime/prose/H2.vue.d.ts +123 -0
- package/dist/runtime/prose/H3.vue +18 -23
- package/dist/runtime/prose/H3.vue.d.ts +123 -0
- package/dist/runtime/prose/H4.vue +18 -23
- package/dist/runtime/prose/H4.vue.d.ts +123 -0
- package/dist/runtime/prose/H5.vue +18 -23
- package/dist/runtime/prose/H5.vue.d.ts +123 -0
- package/dist/runtime/prose/H6.vue +18 -23
- package/dist/runtime/prose/H6.vue.d.ts +123 -0
- package/dist/runtime/prose/Hr.vue +18 -19
- package/dist/runtime/prose/Hr.vue.d.ts +74 -0
- package/dist/runtime/prose/Img.vue +18 -23
- package/dist/runtime/prose/Img.vue.d.ts +77 -0
- package/dist/runtime/prose/Li.vue +18 -23
- package/dist/runtime/prose/Li.vue.d.ts +84 -0
- package/dist/runtime/prose/Ol.vue +18 -23
- package/dist/runtime/prose/Ol.vue.d.ts +84 -0
- package/dist/runtime/prose/P.vue +18 -23
- package/dist/runtime/prose/P.vue.d.ts +84 -0
- package/dist/runtime/prose/Pre.vue +28 -33
- package/dist/runtime/prose/Pre.vue.d.ts +117 -0
- package/dist/runtime/prose/Strong.vue +18 -23
- package/dist/runtime/prose/Strong.vue.d.ts +84 -0
- package/dist/runtime/prose/Table.vue +44 -54
- package/dist/runtime/prose/Table.vue.d.ts +144 -0
- package/dist/runtime/prose/Tbody.vue +18 -23
- package/dist/runtime/prose/Tbody.vue.d.ts +84 -0
- package/dist/runtime/prose/Td.vue +18 -23
- package/dist/runtime/prose/Td.vue.d.ts +84 -0
- package/dist/runtime/prose/Th.vue +18 -23
- package/dist/runtime/prose/Th.vue.d.ts +84 -0
- package/dist/runtime/prose/Thead.vue +18 -23
- package/dist/runtime/prose/Thead.vue.d.ts +84 -0
- package/dist/runtime/prose/Tr.vue +18 -23
- package/dist/runtime/prose/Tr.vue.d.ts +84 -0
- package/dist/runtime/prose/Ul.vue +18 -23
- package/dist/runtime/prose/Ul.vue.d.ts +84 -0
- package/dist/runtime/vue/components/Link.vue +201 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{b24ui-nuxt.DBFS6LH7.mjs → b24ui-nuxt.CS9Lf0os.mjs} +54 -4
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +62 -35
- package/dist/meta.cjs +0 -71922
- package/dist/meta.d.cts +0 -71920
- package/dist/meta.d.ts +0 -71920
- package/dist/module.cjs +0 -59
- package/dist/module.d.cts +0 -15
- package/dist/module.d.ts +0 -15
- package/dist/shared/b24ui-nuxt.B9fPD5yO.cjs +0 -7671
- 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,277 +1,213 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
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 appConfigSelectMenu = _appConfig as AppConfig & { b24ui: { selectMenu: Partial<typeof theme> } }
|
|
23
|
-
|
|
24
|
-
const selectMenu = tv({ extend: tv(theme), ...(appConfigSelectMenu.b24ui?.selectMenu || {}) })
|
|
25
|
-
|
|
26
|
-
interface _SelectMenuItem {
|
|
27
|
-
label?: string
|
|
28
|
-
/**
|
|
29
|
-
* Display an icon on the left side.
|
|
30
|
-
* @IconComponent
|
|
31
|
-
*/
|
|
32
|
-
icon?: IconComponent
|
|
33
|
-
avatar?: AvatarProps
|
|
34
|
-
color?: SelectMenuVariants['color']
|
|
35
|
-
chip?: ChipProps
|
|
36
|
-
/**
|
|
37
|
-
* The item type.
|
|
38
|
-
* @defaultValue 'item'
|
|
39
|
-
*/
|
|
40
|
-
type?: 'label' | 'separator' | 'item'
|
|
41
|
-
value?: string | number
|
|
42
|
-
disabled?: boolean
|
|
43
|
-
onSelect?(e?: Event): void
|
|
44
|
-
[key: string]: any
|
|
45
|
-
}
|
|
46
|
-
export type SelectMenuItem = _SelectMenuItem | AcceptableValue | boolean
|
|
47
|
-
|
|
48
|
-
type SelectMenuVariants = VariantProps<typeof selectMenu>
|
|
49
|
-
|
|
50
|
-
export interface SelectMenuProps<T extends ArrayOrNested<SelectMenuItem> = ArrayOrNested<SelectMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'highlightOnHover'>, UseComponentIconsProps {
|
|
51
|
-
id?: string
|
|
52
|
-
/** The placeholder text when the select is empty. */
|
|
53
|
-
placeholder?: string
|
|
54
|
-
/**
|
|
55
|
-
* Whether to display the search input or not.
|
|
56
|
-
* Can be an object to pass additional props to the input.
|
|
57
|
-
* `{ placeholder: 'Search...', type: 'search' }`{lang="ts"}
|
|
58
|
-
* @defaultValue true
|
|
59
|
-
*/
|
|
60
|
-
searchInput?: boolean | InputProps
|
|
61
|
-
/**
|
|
62
|
-
* @defaultValue 'primary'
|
|
63
|
-
*/
|
|
64
|
-
color?: SelectMenuVariants['color']
|
|
65
|
-
/**
|
|
66
|
-
* @defaultValue 'md'
|
|
67
|
-
*/
|
|
68
|
-
size?: SelectMenuVariants['size']
|
|
69
|
-
/**
|
|
70
|
-
* Removes padding from input
|
|
71
|
-
* @defaultValue false
|
|
72
|
-
*/
|
|
73
|
-
noPadding?: boolean
|
|
74
|
-
/**
|
|
75
|
-
* Removes all borders (rings)
|
|
76
|
-
* @defaultValue false
|
|
77
|
-
*/
|
|
78
|
-
noBorder?: boolean
|
|
79
|
-
/**
|
|
80
|
-
* Removes all borders (rings) except the bottom one
|
|
81
|
-
* @defaultValue false
|
|
82
|
-
*/
|
|
83
|
-
underline?: boolean
|
|
84
|
-
/**
|
|
85
|
-
* Rounds the corners of the button
|
|
86
|
-
* @defaultValue false
|
|
87
|
-
*/
|
|
88
|
-
rounded?: boolean
|
|
89
|
-
tag?: string
|
|
90
|
-
/**
|
|
91
|
-
* @defaultValue 'primary'
|
|
92
|
-
*/
|
|
93
|
-
tagColor?: SelectMenuVariants['tagColor']
|
|
94
|
-
/**
|
|
95
|
-
* @defaultValue false
|
|
96
|
-
*/
|
|
97
|
-
required?: boolean
|
|
98
|
-
/**
|
|
99
|
-
* The icon displayed to open the menu.
|
|
100
|
-
* @defaultValue icons.chevronDown
|
|
101
|
-
* @IconComponent
|
|
102
|
-
*/
|
|
103
|
-
trailingIcon?: IconComponent
|
|
104
|
-
/**
|
|
105
|
-
* The icon displayed when an item is selected.
|
|
106
|
-
* @defaultValue icons.check
|
|
107
|
-
* @IconComponent
|
|
108
|
-
*/
|
|
109
|
-
selectedIcon?: IconComponent
|
|
110
|
-
/**
|
|
111
|
-
* The content of the menu.
|
|
112
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
113
|
-
*/
|
|
114
|
-
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>
|
|
115
|
-
/**
|
|
116
|
-
* Display an arrow alongside the menu.
|
|
117
|
-
* @defaultValue false
|
|
118
|
-
*/
|
|
119
|
-
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
|
|
120
|
-
/**
|
|
121
|
-
* Render the menu in a portal.
|
|
122
|
-
* @defaultValue true
|
|
123
|
-
*/
|
|
124
|
-
portal?: boolean
|
|
125
|
-
/**
|
|
126
|
-
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
127
|
-
* @defaultValue undefined
|
|
128
|
-
*/
|
|
129
|
-
valueKey?: VK
|
|
130
|
-
/**
|
|
131
|
-
* When `items` is an array of objects, select the field to use as the label.
|
|
132
|
-
* @defaultValue 'label'
|
|
133
|
-
*/
|
|
134
|
-
labelKey?: keyof NestedItem<T>
|
|
135
|
-
items?: T
|
|
136
|
-
/**
|
|
137
|
-
* The value of the SelectMenu when initially rendered. Use when you do not need to control the state of the SelectMenu
|
|
138
|
-
*/
|
|
139
|
-
defaultValue?: GetModelValue<T, VK, M>
|
|
140
|
-
/**
|
|
141
|
-
* The controlled value of the SelectMenu. Can be binded-with with `v-model`
|
|
142
|
-
*/
|
|
143
|
-
modelValue?: GetModelValue<T, VK, M>
|
|
144
|
-
/**
|
|
145
|
-
* Whether multiple options can be selected or not
|
|
146
|
-
* @defaultValue false
|
|
147
|
-
*/
|
|
148
|
-
multiple?: M & boolean
|
|
149
|
-
/**
|
|
150
|
-
* Highlight the ring color like a focus state
|
|
151
|
-
* @defaultValue false
|
|
152
|
-
*/
|
|
153
|
-
highlight?: boolean
|
|
154
|
-
/**
|
|
155
|
-
* Determines if custom user input that does not exist in options can be added.
|
|
156
|
-
* @defaultValue false
|
|
157
|
-
*/
|
|
158
|
-
createItem?: boolean | 'always' | { position?: 'top' | 'bottom', when?: 'empty' | 'always' }
|
|
159
|
-
/**
|
|
160
|
-
* Fields to filter items by.
|
|
161
|
-
* @defaultValue [labelKey]
|
|
162
|
-
*/
|
|
163
|
-
filterFields?: string[]
|
|
164
|
-
/**
|
|
165
|
-
* When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
166
|
-
* @defaultValue false
|
|
167
|
-
*/
|
|
168
|
-
ignoreFilter?: boolean
|
|
169
|
-
class?: any
|
|
170
|
-
b24ui?: PartialString<typeof selectMenu.slots>
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export type SelectMenuEmits<A extends ArrayOrNested<SelectMenuItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Pick<ComboboxRootEmits, 'update:open'> & {
|
|
174
|
-
change: [payload: Event]
|
|
175
|
-
blur: [payload: FocusEvent]
|
|
176
|
-
focus: [payload: FocusEvent]
|
|
177
|
-
create: [item: string]
|
|
178
|
-
/** Event handler when highlighted element changes. */
|
|
179
|
-
highlight: [payload: {
|
|
180
|
-
ref: HTMLElement
|
|
181
|
-
value: GetModelValue<A, VK, M>
|
|
182
|
-
} | undefined]
|
|
183
|
-
} & GetModelValueEmits<A, VK, M>
|
|
184
|
-
|
|
185
|
-
type SlotProps<T extends SelectMenuItem> = (props: { item: T, index: number }) => any
|
|
186
|
-
|
|
187
|
-
export interface SelectMenuSlots<
|
|
188
|
-
A extends ArrayOrNested<SelectMenuItem> = ArrayOrNested<SelectMenuItem>,
|
|
189
|
-
VK extends GetItemKeys<A> | undefined = undefined,
|
|
190
|
-
M extends boolean = false,
|
|
191
|
-
T extends NestedItem<A> = NestedItem<A>
|
|
192
|
-
> {
|
|
193
|
-
'leading'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof selectMenu> }): any
|
|
194
|
-
'default'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean }): any
|
|
195
|
-
'trailing'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof selectMenu> }): any
|
|
196
|
-
'empty'(props: { searchTerm?: string }): any
|
|
197
|
-
'item': SlotProps<T>
|
|
198
|
-
'item-leading': SlotProps<T>
|
|
199
|
-
'item-label': SlotProps<T>
|
|
200
|
-
'item-trailing': SlotProps<T>
|
|
201
|
-
'create-item-label'(props: { item: string }): any
|
|
202
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import _appConfig from "#build/app.config";
|
|
3
|
+
import theme from "#build/b24ui/select-menu";
|
|
4
|
+
import { tv } from "../utils/tv";
|
|
5
|
+
const appConfigSelectMenu = _appConfig;
|
|
6
|
+
const selectMenu = tv({ extend: tv(theme), ...appConfigSelectMenu.b24ui?.selectMenu || {} });
|
|
203
7
|
</script>
|
|
204
8
|
|
|
205
|
-
<script setup
|
|
206
|
-
import { computed, toRef, toRaw } from
|
|
9
|
+
<script setup>
|
|
10
|
+
import { computed, toRef, toRaw } from "vue";
|
|
207
11
|
import {
|
|
208
|
-
ComboboxRoot,
|
|
209
|
-
ComboboxArrow,
|
|
210
|
-
ComboboxAnchor,
|
|
211
|
-
ComboboxInput,
|
|
212
|
-
ComboboxTrigger,
|
|
213
|
-
ComboboxPortal,
|
|
214
|
-
ComboboxContent,
|
|
215
|
-
ComboboxViewport,
|
|
216
|
-
ComboboxEmpty,
|
|
217
|
-
ComboboxGroup,
|
|
218
|
-
ComboboxLabel,
|
|
219
|
-
ComboboxSeparator,
|
|
220
|
-
ComboboxItem,
|
|
221
|
-
ComboboxItemIndicator,
|
|
222
|
-
FocusScope,
|
|
223
12
|
useForwardPropsEmits,
|
|
224
|
-
useFilter
|
|
225
|
-
|
|
226
|
-
} from
|
|
227
|
-
import {
|
|
228
|
-
import {
|
|
229
|
-
import {
|
|
230
|
-
import {
|
|
231
|
-
import {
|
|
232
|
-
import {
|
|
233
|
-
import
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
13
|
+
useFilter
|
|
14
|
+
} from "reka-ui";
|
|
15
|
+
import { defu } from "defu";
|
|
16
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
17
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
18
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
19
|
+
import { useFormField } from "../composables/useFormField";
|
|
20
|
+
import { useLocale } from "../composables/useLocale";
|
|
21
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
22
|
+
import icons from "../dictionary/icons";
|
|
23
|
+
defineOptions({ inheritAttrs: false });
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
id: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
placeholder: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false
|
|
32
|
+
},
|
|
33
|
+
searchInput: {
|
|
34
|
+
type: [Boolean, Object],
|
|
35
|
+
required: false,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
color: {
|
|
39
|
+
type: null,
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
size: {
|
|
43
|
+
type: null,
|
|
44
|
+
required: false
|
|
45
|
+
},
|
|
46
|
+
noPadding: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: false
|
|
49
|
+
},
|
|
50
|
+
noBorder: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
required: false
|
|
53
|
+
},
|
|
54
|
+
underline: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
required: false
|
|
57
|
+
},
|
|
58
|
+
rounded: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
required: false
|
|
61
|
+
},
|
|
62
|
+
tag: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: false
|
|
65
|
+
},
|
|
66
|
+
tagColor: {
|
|
67
|
+
type: null,
|
|
68
|
+
required: false
|
|
69
|
+
},
|
|
70
|
+
required: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
required: false
|
|
73
|
+
},
|
|
74
|
+
trailingIcon: {
|
|
75
|
+
type: [Function, Object],
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
selectedIcon: {
|
|
79
|
+
type: [Function, Object],
|
|
80
|
+
required: false
|
|
81
|
+
},
|
|
82
|
+
content: {
|
|
83
|
+
type: Object,
|
|
84
|
+
required: false
|
|
85
|
+
},
|
|
86
|
+
arrow: {
|
|
87
|
+
type: [Boolean, Object],
|
|
88
|
+
required: false
|
|
89
|
+
},
|
|
90
|
+
portal: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
required: false,
|
|
93
|
+
default: true
|
|
94
|
+
},
|
|
95
|
+
valueKey: {
|
|
96
|
+
type: null,
|
|
97
|
+
required: false
|
|
98
|
+
},
|
|
99
|
+
labelKey: {
|
|
100
|
+
type: null,
|
|
101
|
+
required: false,
|
|
102
|
+
default: "label"
|
|
103
|
+
},
|
|
104
|
+
items: {
|
|
105
|
+
type: null,
|
|
106
|
+
required: false
|
|
107
|
+
},
|
|
108
|
+
defaultValue: {
|
|
109
|
+
type: null,
|
|
110
|
+
required: false
|
|
111
|
+
},
|
|
112
|
+
modelValue: {
|
|
113
|
+
type: null,
|
|
114
|
+
required: false
|
|
115
|
+
},
|
|
116
|
+
multiple: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
required: false
|
|
119
|
+
},
|
|
120
|
+
highlight: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
required: false
|
|
123
|
+
},
|
|
124
|
+
createItem: {
|
|
125
|
+
type: [Boolean, String, Object],
|
|
126
|
+
required: false
|
|
127
|
+
},
|
|
128
|
+
filterFields: {
|
|
129
|
+
type: Array,
|
|
130
|
+
required: false
|
|
131
|
+
},
|
|
132
|
+
ignoreFilter: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
required: false
|
|
135
|
+
},
|
|
136
|
+
class: {
|
|
137
|
+
type: null,
|
|
138
|
+
required: false
|
|
139
|
+
},
|
|
140
|
+
b24ui: {
|
|
141
|
+
type: null,
|
|
142
|
+
required: false
|
|
143
|
+
},
|
|
144
|
+
open: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
required: false
|
|
147
|
+
},
|
|
148
|
+
defaultOpen: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
required: false
|
|
151
|
+
},
|
|
152
|
+
disabled: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
required: false
|
|
155
|
+
},
|
|
156
|
+
name: {
|
|
157
|
+
type: String,
|
|
158
|
+
required: false
|
|
159
|
+
},
|
|
160
|
+
resetSearchTermOnBlur: {
|
|
161
|
+
type: Boolean,
|
|
162
|
+
required: false,
|
|
163
|
+
default: true
|
|
164
|
+
},
|
|
165
|
+
highlightOnHover: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
required: false
|
|
168
|
+
},
|
|
169
|
+
icon: {
|
|
170
|
+
type: [Function, Object],
|
|
171
|
+
required: false
|
|
172
|
+
},
|
|
173
|
+
avatar: {
|
|
174
|
+
type: Object,
|
|
175
|
+
required: false
|
|
176
|
+
},
|
|
177
|
+
loading: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
required: false
|
|
180
|
+
},
|
|
181
|
+
trailing: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
required: false
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
const emits = defineEmits(["update:open", "change", "blur", "focus", "create", "highlight", "update:modelValue"]);
|
|
187
|
+
const slots = defineSlots();
|
|
188
|
+
const searchTerm = defineModel("searchTerm", {
|
|
189
|
+
"type": String,
|
|
190
|
+
...{
|
|
191
|
+
default: ""
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
const { t } = useLocale();
|
|
195
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
196
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "highlightOnHover"), emits);
|
|
197
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
198
|
+
const arrowProps = toRef(() => props.arrow);
|
|
199
|
+
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), type: "search" }));
|
|
200
|
+
const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
201
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
262
202
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(
|
|
263
203
|
props,
|
|
264
204
|
{ trailingIcon: icons.chevronDown }
|
|
265
|
-
)))
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate()
|
|
270
|
-
|
|
205
|
+
)));
|
|
206
|
+
const selectSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
207
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
|
|
271
208
|
const isTag = computed(() => {
|
|
272
|
-
return props.tag
|
|
273
|
-
})
|
|
274
|
-
|
|
209
|
+
return props.tag;
|
|
210
|
+
});
|
|
275
211
|
const b24ui = computed(() => selectMenu({
|
|
276
212
|
color: color.value,
|
|
277
213
|
size: selectSize?.value,
|
|
@@ -285,115 +221,85 @@ const b24ui = computed(() => selectMenu({
|
|
|
285
221
|
leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
|
|
286
222
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
287
223
|
buttonGroup: orientation.value
|
|
288
|
-
}))
|
|
289
|
-
|
|
290
|
-
function displayValue(value: GetItemValue<T, VK> | GetItemValue<T, VK>[]): string {
|
|
224
|
+
}));
|
|
225
|
+
function displayValue(value) {
|
|
291
226
|
if (props.multiple && Array.isArray(value)) {
|
|
292
|
-
return value.map(v => displayValue(v)).filter(Boolean).join(
|
|
227
|
+
return value.map((v) => displayValue(v)).filter(Boolean).join(", ");
|
|
293
228
|
}
|
|
294
|
-
|
|
295
229
|
if (!props.valueKey) {
|
|
296
|
-
return value && (typeof value ===
|
|
230
|
+
return value && (typeof value === "object" ? get(value, props.labelKey) : value);
|
|
297
231
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
232
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
233
|
+
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
301
234
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
? props.items
|
|
307
|
-
: [props.items]
|
|
308
|
-
: []
|
|
309
|
-
)
|
|
310
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
311
|
-
const items = computed(() => groups.value.flatMap(group => group) as T[])
|
|
312
|
-
|
|
235
|
+
const groups = computed(
|
|
236
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
237
|
+
);
|
|
238
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
313
239
|
const filteredGroups = computed(() => {
|
|
314
240
|
if (props.ignoreFilter || !searchTerm.value) {
|
|
315
|
-
return groups.value
|
|
241
|
+
return groups.value;
|
|
316
242
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (typeof item !== 'object' || item === null) {
|
|
322
|
-
return contains(String(item), searchTerm.value)
|
|
243
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey];
|
|
244
|
+
return groups.value.map((items2) => items2.filter((item) => {
|
|
245
|
+
if (typeof item !== "object" || item === null) {
|
|
246
|
+
return contains(String(item), searchTerm.value);
|
|
323
247
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
return true
|
|
248
|
+
if (item.type && ["label", "separator"].includes(item.type)) {
|
|
249
|
+
return true;
|
|
327
250
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group))
|
|
335
|
-
|
|
251
|
+
return fields.some((field) => contains(get(item, field), searchTerm.value));
|
|
252
|
+
})).filter((group) => group.filter(
|
|
253
|
+
(item) => !isSelectItem(item) || isSelectItem(item) && (!item.type || !["label", "separator"].includes(item.type))
|
|
254
|
+
).length > 0);
|
|
255
|
+
});
|
|
256
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap((group) => group));
|
|
336
257
|
const createItem = computed(() => {
|
|
337
258
|
if (!props.createItem || !searchTerm.value) {
|
|
338
|
-
return false
|
|
259
|
+
return false;
|
|
339
260
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if ((typeof props.createItem === 'object' && props.createItem.when === 'always') || props.createItem === 'always') {
|
|
344
|
-
return !filteredItems.value.find(item => compare(item, newItem, String(props.valueKey)))
|
|
261
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } : searchTerm.value;
|
|
262
|
+
if (typeof props.createItem === "object" && props.createItem.when === "always" || props.createItem === "always") {
|
|
263
|
+
return !filteredItems.value.find((item) => compare(item, newItem, String(props.valueKey)));
|
|
345
264
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
function onUpdate(value: any) {
|
|
265
|
+
return !filteredItems.value.length;
|
|
266
|
+
});
|
|
267
|
+
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
268
|
+
function onUpdate(value) {
|
|
352
269
|
if (toRaw(props.modelValue) === value) {
|
|
353
|
-
return
|
|
270
|
+
return;
|
|
354
271
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
emitFormChange()
|
|
360
|
-
emitFormInput()
|
|
272
|
+
const event = new Event("change", { target: { value } });
|
|
273
|
+
emits("change", event);
|
|
274
|
+
emitFormChange();
|
|
275
|
+
emitFormInput();
|
|
361
276
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
let timeoutId: ReturnType<typeof setTimeout> | undefined
|
|
365
|
-
|
|
277
|
+
function onUpdateOpen(value) {
|
|
278
|
+
let timeoutId;
|
|
366
279
|
if (!value) {
|
|
367
|
-
const event = new FocusEvent(
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
emitFormBlur()
|
|
371
|
-
|
|
372
|
-
// Since we use `displayValue` prop inside ComboboxInput we should reset searchTerm manually
|
|
373
|
-
// https://reka-ui.com/docs/components/combobox#api-reference
|
|
280
|
+
const event = new FocusEvent("blur");
|
|
281
|
+
emits("blur", event);
|
|
282
|
+
emitFormBlur();
|
|
374
283
|
if (props.resetSearchTermOnBlur) {
|
|
375
|
-
const STATE_ANIMATION_DELAY_MS = 100
|
|
376
|
-
|
|
284
|
+
const STATE_ANIMATION_DELAY_MS = 100;
|
|
377
285
|
timeoutId = setTimeout(() => {
|
|
378
|
-
searchTerm.value =
|
|
379
|
-
}, STATE_ANIMATION_DELAY_MS)
|
|
286
|
+
searchTerm.value = "";
|
|
287
|
+
}, STATE_ANIMATION_DELAY_MS);
|
|
380
288
|
}
|
|
381
289
|
} else {
|
|
382
|
-
const event = new FocusEvent(
|
|
383
|
-
emits(
|
|
384
|
-
emitFormFocus()
|
|
290
|
+
const event = new FocusEvent("focus");
|
|
291
|
+
emits("focus", event);
|
|
292
|
+
emitFormFocus();
|
|
385
293
|
if (timeoutId) {
|
|
386
|
-
clearTimeout(timeoutId)
|
|
294
|
+
clearTimeout(timeoutId);
|
|
387
295
|
}
|
|
388
296
|
}
|
|
389
297
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return typeof item === 'object' && item !== null
|
|
298
|
+
function isSelectItem(item) {
|
|
299
|
+
return typeof item === "object" && item !== null;
|
|
393
300
|
}
|
|
394
301
|
</script>
|
|
395
302
|
|
|
396
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
397
303
|
<template>
|
|
398
304
|
<Primitive as="div" :class="b24ui.root({ addNew: true, class: [props.b24ui?.root] })">
|
|
399
305
|
<DefineCreateItemTemplate>
|
|
@@ -409,7 +315,7 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
409
315
|
:is="icons.plus"
|
|
410
316
|
:class="b24ui.itemLeadingIcon({ addNew: true, class: props.b24ui?.itemLeadingIcon })"
|
|
411
317
|
/>
|
|
412
|
-
{{ t(
|
|
318
|
+
{{ t("selectMenu.create", { label: searchTerm }) }}
|
|
413
319
|
</slot>
|
|
414
320
|
</span>
|
|
415
321
|
</ComboboxItem>
|
|
@@ -433,29 +339,29 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
433
339
|
{{ props.tag }}
|
|
434
340
|
</div>
|
|
435
341
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
436
|
-
<slot name="leading" :model-value="
|
|
342
|
+
<slot name="leading" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
437
343
|
<Component
|
|
438
344
|
:is="leadingIconName"
|
|
439
345
|
v-if="isLeading && leadingIconName"
|
|
440
346
|
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
441
347
|
/>
|
|
442
|
-
<B24Avatar v-else-if="!!avatar" :size="
|
|
348
|
+
<B24Avatar v-else-if="!!avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar })" />
|
|
443
349
|
</slot>
|
|
444
350
|
</span>
|
|
445
351
|
|
|
446
|
-
<slot :model-value="
|
|
447
|
-
<template v-for="displayedModelValue in [displayValue(modelValue
|
|
352
|
+
<slot :model-value="modelValue" :open="open">
|
|
353
|
+
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
448
354
|
<span v-if="displayedModelValue" :class="b24ui.value({ class: props.b24ui?.value })">
|
|
449
355
|
{{ displayedModelValue }}
|
|
450
356
|
</span>
|
|
451
357
|
<span v-else :class="b24ui.placeholder({ class: props.b24ui?.placeholder })">
|
|
452
|
-
{{ placeholder ??
|
|
358
|
+
{{ placeholder ?? "\xA0" }}
|
|
453
359
|
</span>
|
|
454
360
|
</template>
|
|
455
361
|
</slot>
|
|
456
362
|
|
|
457
363
|
<span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
458
|
-
<slot name="trailing" :model-value="
|
|
364
|
+
<slot name="trailing" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
459
365
|
<Component
|
|
460
366
|
:is="trailingIconName"
|
|
461
367
|
v-if="trailingIconName"
|
|
@@ -475,7 +381,7 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
475
381
|
|
|
476
382
|
<ComboboxEmpty :class="b24ui.empty({ class: props.b24ui?.empty })">
|
|
477
383
|
<slot name="empty" :search-term="searchTerm">
|
|
478
|
-
{{ searchTerm ? t(
|
|
384
|
+
{{ searchTerm ? t("selectMenu.noMatch", { searchTerm }) : t("selectMenu.noData") }}
|
|
479
385
|
</slot>
|
|
480
386
|
</ComboboxEmpty>
|
|
481
387
|
|
|
@@ -485,29 +391,29 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
485
391
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
486
392
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
487
393
|
<ComboboxLabel v-if="isSelectItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
488
|
-
{{ get(item, props.labelKey
|
|
394
|
+
{{ get(item, props.labelKey) }}
|
|
489
395
|
</ComboboxLabel>
|
|
490
396
|
|
|
491
397
|
<ComboboxSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
492
398
|
|
|
493
399
|
<ComboboxItem
|
|
494
400
|
v-else
|
|
495
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color :
|
|
401
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color : void 0 })"
|
|
496
402
|
:disabled="isSelectItem(item) && item.disabled"
|
|
497
|
-
:value="props.valueKey && isSelectItem(item) ? get(item, props.valueKey
|
|
403
|
+
:value="props.valueKey && isSelectItem(item) ? get(item, props.valueKey) : item"
|
|
498
404
|
@select="isSelectItem(item) && item.onSelect?.($event)"
|
|
499
405
|
>
|
|
500
|
-
<slot name="item" :item="
|
|
501
|
-
<slot name="item-leading" :item="
|
|
406
|
+
<slot name="item" :item="item" :index="index">
|
|
407
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
502
408
|
<Component
|
|
503
409
|
:is="item.icon"
|
|
504
410
|
v-if="isSelectItem(item) && item.icon"
|
|
505
411
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
506
412
|
/>
|
|
507
|
-
<B24Avatar v-else-if="isSelectItem(item) && item.avatar" :size="
|
|
413
|
+
<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 })" />
|
|
508
414
|
<B24Chip
|
|
509
415
|
v-else-if="isSelectItem(item) && item.chip"
|
|
510
|
-
:size="
|
|
416
|
+
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
511
417
|
inset
|
|
512
418
|
standalone
|
|
513
419
|
v-bind="item.chip"
|
|
@@ -516,18 +422,18 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
516
422
|
</slot>
|
|
517
423
|
|
|
518
424
|
<span :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
519
|
-
<slot name="item-label" :item="
|
|
520
|
-
{{ isSelectItem(item) ? get(item, props.labelKey
|
|
425
|
+
<slot name="item-label" :item="item" :index="index">
|
|
426
|
+
{{ isSelectItem(item) ? get(item, props.labelKey) : item }}
|
|
521
427
|
</slot>
|
|
522
428
|
</span>
|
|
523
429
|
|
|
524
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color :
|
|
525
|
-
<slot name="item-trailing" :item="
|
|
430
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color : void 0 })">
|
|
431
|
+
<slot name="item-trailing" :item="item" :index="index" />
|
|
526
432
|
|
|
527
433
|
<ComboboxItemIndicator as-child>
|
|
528
434
|
<Component
|
|
529
435
|
:is="selectedIcon || icons.check"
|
|
530
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color :
|
|
436
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color : void 0 })"
|
|
531
437
|
/>
|
|
532
438
|
</ComboboxItemIndicator>
|
|
533
439
|
</span>
|