@bitrix24/b24ui-nuxt 0.5.11 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nuxt/b24ui/input-menu.ts +2 -2
- package/.nuxt/b24ui/select-menu.ts +4 -4
- package/.nuxt/b24ui/select.ts +2 -2
- package/dist/meta.d.mts +5208 -5061
- package/dist/meta.mjs +5208 -5061
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Advice.vue +27 -54
- package/dist/runtime/components/Advice.vue.d.ts +170 -0
- package/dist/runtime/components/Alert.vue +35 -96
- package/dist/runtime/components/Alert.vue.d.ts +464 -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 -81
- package/dist/runtime/components/Avatar.vue.d.ts +281 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -76
- package/dist/runtime/components/AvatarGroup.vue.d.ts +204 -0
- package/dist/runtime/components/Badge.vue +40 -83
- package/dist/runtime/components/Badge.vue.d.ts +517 -0
- package/dist/runtime/components/Button.vue +96 -155
- package/dist/runtime/components/Button.vue.d.ts +640 -0
- package/dist/runtime/components/ButtonGroup.vue +19 -51
- package/dist/runtime/components/ButtonGroup.vue.d.ts +116 -0
- package/dist/runtime/components/Calendar.vue +73 -152
- package/dist/runtime/components/Calendar.vue.d.ts +437 -0
- package/dist/runtime/components/Checkbox.vue +42 -73
- package/dist/runtime/components/Checkbox.vue.d.ts +354 -0
- package/dist/runtime/components/Chip.vue +26 -74
- package/dist/runtime/components/Chip.vue.d.ts +271 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +118 -0
- package/dist/runtime/components/Container.vue +13 -27
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +153 -378
- package/dist/runtime/components/Countdown.vue.d.ts +356 -0
- package/dist/runtime/components/DescriptionList.vue +78 -149
- package/dist/runtime/components/DescriptionList.vue.d.ts +379 -0
- package/dist/runtime/components/DropdownMenu.vue +38 -139
- package/dist/runtime/components/DropdownMenu.vue.d.ts +533 -0
- package/dist/runtime/components/DropdownMenuContent.vue +68 -80
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +228 -0
- package/dist/runtime/components/Form.vue +130 -217
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +36 -80
- package/dist/runtime/components/FormField.vue.d.ts +282 -0
- package/dist/runtime/components/Input.vue +79 -179
- package/dist/runtime/components/Input.vue.d.ts +755 -0
- package/dist/runtime/components/InputMenu.vue +185 -381
- package/dist/runtime/components/InputMenu.vue.d.ts +1523 -0
- package/dist/runtime/components/InputNumber.vue +77 -175
- package/dist/runtime/components/InputNumber.vue.d.ts +658 -0
- package/dist/runtime/components/Kbd.vue +18 -45
- package/dist/runtime/components/Kbd.vue.d.ts +109 -0
- package/dist/runtime/components/Link.vue +92 -173
- 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 -127
- package/dist/runtime/components/Modal.vue.d.ts +327 -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 +101 -0
- package/dist/runtime/components/NavbarDivider.vue +15 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSection.vue +15 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +101 -0
- package/dist/runtime/components/NavbarSpacer.vue +15 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/NavigationMenu.vue +74 -208
- package/dist/runtime/components/NavigationMenu.vue.d.ts +824 -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 -81
- package/dist/runtime/components/Popover.vue.d.ts +147 -0
- package/dist/runtime/components/Progress.vue +70 -136
- package/dist/runtime/components/Progress.vue.d.ts +592 -0
- package/dist/runtime/components/RadioGroup.vue +59 -134
- package/dist/runtime/components/RadioGroup.vue.d.ts +723 -0
- package/dist/runtime/components/Range.vue +46 -85
- package/dist/runtime/components/Range.vue.d.ts +417 -0
- package/dist/runtime/components/Select.vue +110 -260
- package/dist/runtime/components/Select.vue.d.ts +1201 -0
- package/dist/runtime/components/SelectMenu.vue +161 -347
- package/dist/runtime/components/SelectMenu.vue.d.ts +1298 -0
- package/dist/runtime/components/Separator.vue +28 -71
- package/dist/runtime/components/Separator.vue.d.ts +400 -0
- package/dist/runtime/components/Sidebar.vue +15 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarBody.vue +17 -38
- package/dist/runtime/components/SidebarBody.vue.d.ts +90 -0
- package/dist/runtime/components/SidebarFooter.vue +15 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeader.vue +15 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarHeading.vue +15 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarLayout.vue +34 -70
- package/dist/runtime/components/SidebarLayout.vue.d.ts +222 -0
- package/dist/runtime/components/SidebarSection.vue +15 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +101 -0
- package/dist/runtime/components/SidebarSpacer.vue +15 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +101 -0
- package/dist/runtime/components/Skeleton.vue +12 -22
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +50 -131
- package/dist/runtime/components/Slideover.vue.d.ts +360 -0
- package/dist/runtime/components/StackedLayout.vue +34 -73
- package/dist/runtime/components/StackedLayout.vue.d.ts +192 -0
- package/dist/runtime/components/Switch.vue +46 -95
- package/dist/runtime/components/Switch.vue.d.ts +587 -0
- package/dist/runtime/components/Tabs.vue +37 -105
- package/dist/runtime/components/Tabs.vue.d.ts +453 -0
- package/dist/runtime/components/Textarea.vue +92 -201
- package/dist/runtime/components/Textarea.vue.d.ts +601 -0
- package/dist/runtime/components/Toast.vue +47 -105
- package/dist/runtime/components/Toast.vue.d.ts +438 -0
- package/dist/runtime/components/Toaster.vue +70 -115
- package/dist/runtime/components/Toaster.vue.d.ts +219 -0
- package/dist/runtime/components/Tooltip.vue +36 -64
- package/dist/runtime/components/Tooltip.vue.d.ts +186 -0
- package/dist/runtime/components/content/TableWrapper.vue +24 -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 +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 +12 -23
- package/dist/runtime/prose/A.vue.d.ts +84 -0
- package/dist/runtime/prose/Blockquote.vue +12 -23
- package/dist/runtime/prose/Blockquote.vue.d.ts +84 -0
- package/dist/runtime/prose/Code.vue +14 -31
- package/dist/runtime/prose/Code.vue.d.ts +97 -0
- package/dist/runtime/prose/Em.vue +12 -23
- package/dist/runtime/prose/Em.vue.d.ts +84 -0
- package/dist/runtime/prose/H1.vue +12 -23
- package/dist/runtime/prose/H1.vue.d.ts +97 -0
- package/dist/runtime/prose/H2.vue +12 -23
- package/dist/runtime/prose/H2.vue.d.ts +123 -0
- package/dist/runtime/prose/H3.vue +12 -23
- package/dist/runtime/prose/H3.vue.d.ts +123 -0
- package/dist/runtime/prose/H4.vue +12 -23
- package/dist/runtime/prose/H4.vue.d.ts +123 -0
- package/dist/runtime/prose/H5.vue +12 -23
- package/dist/runtime/prose/H5.vue.d.ts +123 -0
- package/dist/runtime/prose/H6.vue +12 -23
- package/dist/runtime/prose/H6.vue.d.ts +123 -0
- package/dist/runtime/prose/Hr.vue +12 -19
- package/dist/runtime/prose/Hr.vue.d.ts +74 -0
- package/dist/runtime/prose/Img.vue +12 -23
- package/dist/runtime/prose/Img.vue.d.ts +77 -0
- package/dist/runtime/prose/Li.vue +12 -23
- package/dist/runtime/prose/Li.vue.d.ts +84 -0
- package/dist/runtime/prose/Ol.vue +12 -23
- package/dist/runtime/prose/Ol.vue.d.ts +84 -0
- package/dist/runtime/prose/P.vue +12 -23
- package/dist/runtime/prose/P.vue.d.ts +84 -0
- package/dist/runtime/prose/Pre.vue +16 -33
- package/dist/runtime/prose/Pre.vue.d.ts +117 -0
- package/dist/runtime/prose/Strong.vue +12 -23
- package/dist/runtime/prose/Strong.vue.d.ts +84 -0
- package/dist/runtime/prose/Table.vue +19 -54
- package/dist/runtime/prose/Table.vue.d.ts +144 -0
- package/dist/runtime/prose/Tbody.vue +12 -23
- package/dist/runtime/prose/Tbody.vue.d.ts +84 -0
- package/dist/runtime/prose/Td.vue +12 -23
- package/dist/runtime/prose/Td.vue.d.ts +84 -0
- package/dist/runtime/prose/Th.vue +12 -23
- package/dist/runtime/prose/Th.vue.d.ts +84 -0
- package/dist/runtime/prose/Thead.vue +12 -23
- package/dist/runtime/prose/Thead.vue.d.ts +84 -0
- package/dist/runtime/prose/Tr.vue +12 -23
- package/dist/runtime/prose/Tr.vue.d.ts +84 -0
- package/dist/runtime/prose/Ul.vue +12 -23
- package/dist/runtime/prose/Ul.vue.d.ts +84 -0
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/vue/components/Link.vue +115 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.BA6Y2FnC.mjs} +6 -6
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +14 -22
- 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,273 +1,88 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import theme from '#build/b24ui/input-menu'
|
|
8
|
-
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
9
|
-
import { tv } from '../utils/tv'
|
|
10
|
-
import type { AvatarProps, ChipProps, InputProps, IconComponent } from '../types'
|
|
11
|
-
import type {
|
|
12
|
-
AcceptableValue,
|
|
13
|
-
ArrayOrNested,
|
|
14
|
-
GetItemKeys,
|
|
15
|
-
GetModelValue,
|
|
16
|
-
GetModelValueEmits,
|
|
17
|
-
NestedItem,
|
|
18
|
-
PartialString,
|
|
19
|
-
EmitsToProps
|
|
20
|
-
} from '../types/utils'
|
|
21
|
-
|
|
22
|
-
const appConfigInputMenu = _appConfig as AppConfig & { b24ui: { inputMenu: Partial<typeof theme> } }
|
|
23
|
-
|
|
24
|
-
const inputMenu = tv({ extend: tv(theme), ...(appConfigInputMenu.b24ui?.inputMenu || {}) })
|
|
25
|
-
|
|
26
|
-
type InputMenuVariants = VariantProps<typeof inputMenu>
|
|
27
|
-
|
|
28
|
-
interface _InputMenuItem {
|
|
29
|
-
label?: string
|
|
30
|
-
/**
|
|
31
|
-
* Display an icon on the left side.
|
|
32
|
-
* @IconComponent
|
|
33
|
-
*/
|
|
34
|
-
icon?: IconComponent
|
|
35
|
-
avatar?: AvatarProps
|
|
36
|
-
color?: InputMenuVariants['color']
|
|
37
|
-
chip?: ChipProps
|
|
38
|
-
/**
|
|
39
|
-
* The item type.
|
|
40
|
-
* @defaultValue 'item'
|
|
41
|
-
*/
|
|
42
|
-
type?: 'label' | 'separator' | 'item'
|
|
43
|
-
disabled?: boolean
|
|
44
|
-
onSelect?(e?: Event): void
|
|
45
|
-
[key: string]: any
|
|
46
|
-
}
|
|
47
|
-
export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean
|
|
48
|
-
|
|
49
|
-
export interface InputMenuProps<T extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'highlightOnHover'>, UseComponentIconsProps {
|
|
50
|
-
/**
|
|
51
|
-
* The element or component this component should render as.
|
|
52
|
-
* @defaultValue 'div'
|
|
53
|
-
*/
|
|
54
|
-
as?: any
|
|
55
|
-
id?: string
|
|
56
|
-
/**
|
|
57
|
-
* @defaultValue 'text'
|
|
58
|
-
*/
|
|
59
|
-
type?: InputHTMLAttributes['type']
|
|
60
|
-
/**
|
|
61
|
-
* The placeholder text when the input is empty
|
|
62
|
-
*/
|
|
63
|
-
placeholder?: string
|
|
64
|
-
/**
|
|
65
|
-
* @defaultValue 'primary'
|
|
66
|
-
*/
|
|
67
|
-
color?: InputMenuVariants['color']
|
|
68
|
-
/**
|
|
69
|
-
* @defaultValue 'md'
|
|
70
|
-
*/
|
|
71
|
-
size?: InputMenuVariants['size']
|
|
72
|
-
/**
|
|
73
|
-
* Removes padding from input
|
|
74
|
-
* @defaultValue false
|
|
75
|
-
*/
|
|
76
|
-
noPadding?: boolean
|
|
77
|
-
/**
|
|
78
|
-
* Removes all borders (rings)
|
|
79
|
-
* @defaultValue false
|
|
80
|
-
*/
|
|
81
|
-
noBorder?: boolean
|
|
82
|
-
/**
|
|
83
|
-
* Removes all borders (rings) except the bottom one
|
|
84
|
-
* @defaultValue false
|
|
85
|
-
*/
|
|
86
|
-
underline?: boolean
|
|
87
|
-
/**
|
|
88
|
-
* Rounds the corners of the button
|
|
89
|
-
* @defaultValue false
|
|
90
|
-
*/
|
|
91
|
-
rounded?: boolean
|
|
92
|
-
/**
|
|
93
|
-
* @defaultValue false
|
|
94
|
-
*/
|
|
95
|
-
required?: boolean
|
|
96
|
-
/**
|
|
97
|
-
* @defaultValue false
|
|
98
|
-
*/
|
|
99
|
-
autofocus?: boolean
|
|
100
|
-
/**
|
|
101
|
-
* @defaultValue 0
|
|
102
|
-
*/
|
|
103
|
-
autofocusDelay?: number
|
|
104
|
-
/**
|
|
105
|
-
* The icon displayed to open the menu.
|
|
106
|
-
* @defaultValue icons.chevronDown
|
|
107
|
-
* @IconComponent
|
|
108
|
-
*/
|
|
109
|
-
trailingIcon?: IconComponent
|
|
110
|
-
/**
|
|
111
|
-
* The icon displayed when an item is selected.
|
|
112
|
-
* @defaultValue icons.check
|
|
113
|
-
* @IconComponent
|
|
114
|
-
*/
|
|
115
|
-
selectedIcon?: IconComponent
|
|
116
|
-
/**
|
|
117
|
-
* The icon displayed to delete a tag.
|
|
118
|
-
* Works only when `multiple` is `true`.
|
|
119
|
-
* @defaultValue icons.close
|
|
120
|
-
* @IconComponent
|
|
121
|
-
*/
|
|
122
|
-
deleteIcon?: IconComponent
|
|
123
|
-
/**
|
|
124
|
-
* The content of the menu.
|
|
125
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
126
|
-
*/
|
|
127
|
-
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>
|
|
128
|
-
/**
|
|
129
|
-
* Display an arrow alongside the menu.
|
|
130
|
-
* @defaultValue false
|
|
131
|
-
*/
|
|
132
|
-
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
|
|
133
|
-
/**
|
|
134
|
-
* Render the menu in a portal.
|
|
135
|
-
* @defaultValue true
|
|
136
|
-
*/
|
|
137
|
-
portal?: boolean
|
|
138
|
-
/**
|
|
139
|
-
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
140
|
-
* @defaultValue undefined
|
|
141
|
-
*/
|
|
142
|
-
valueKey?: VK
|
|
143
|
-
/**
|
|
144
|
-
* When `items` is an array of objects, select the field to use as the label.
|
|
145
|
-
* @defaultValue 'label'
|
|
146
|
-
*/
|
|
147
|
-
labelKey?: keyof NestedItem<T>
|
|
148
|
-
items?: T
|
|
149
|
-
/**
|
|
150
|
-
* The value of the InputMenu when initially rendered. Use when you do not need to control the state of the InputMenu
|
|
151
|
-
*/
|
|
152
|
-
defaultValue?: GetModelValue<T, VK, M>
|
|
153
|
-
/**
|
|
154
|
-
* The controlled value of the InputMenu. Can be binded-with with `v-model`
|
|
155
|
-
*/
|
|
156
|
-
modelValue?: GetModelValue<T, VK, M>
|
|
157
|
-
/**
|
|
158
|
-
* Whether multiple options can be selected or not
|
|
159
|
-
* @defaultValue false
|
|
160
|
-
*/
|
|
161
|
-
multiple?: M & boolean
|
|
162
|
-
tag?: string
|
|
163
|
-
/**
|
|
164
|
-
* @defaultValue 'primary'
|
|
165
|
-
*/
|
|
166
|
-
tagColor?: InputMenuVariants['tagColor']
|
|
167
|
-
/**
|
|
168
|
-
* Highlight the ring color like a focus state
|
|
169
|
-
* @defaultValue false
|
|
170
|
-
*/
|
|
171
|
-
highlight?: boolean
|
|
172
|
-
/**
|
|
173
|
-
* Determines if custom user input that does not exist in options can be added.
|
|
174
|
-
* @defaultValue false
|
|
175
|
-
*/
|
|
176
|
-
createItem?: boolean | 'always' | { position?: 'top' | 'bottom', when?: 'empty' | 'always' }
|
|
177
|
-
/**
|
|
178
|
-
* Fields to filter items by.
|
|
179
|
-
* @defaultValue [labelKey]
|
|
180
|
-
*/
|
|
181
|
-
filterFields?: string[]
|
|
182
|
-
/**
|
|
183
|
-
* When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
184
|
-
* @defaultValue false
|
|
185
|
-
*/
|
|
186
|
-
ignoreFilter?: boolean
|
|
187
|
-
class?: any
|
|
188
|
-
b24ui?: PartialString<typeof inputMenu.slots>
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export type InputMenuEmits<A extends ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Pick<ComboboxRootEmits, 'update:open'> & {
|
|
192
|
-
change: [payload: Event]
|
|
193
|
-
blur: [payload: FocusEvent]
|
|
194
|
-
focus: [payload: FocusEvent]
|
|
195
|
-
create: [item: string]
|
|
196
|
-
/** Event handler when highlighted element changes. */
|
|
197
|
-
highlight: [payload: {
|
|
198
|
-
ref: HTMLElement
|
|
199
|
-
value: GetModelValue<A, VK, M>
|
|
200
|
-
} | undefined]
|
|
201
|
-
} & GetModelValueEmits<A, VK, M>
|
|
202
|
-
|
|
203
|
-
type SlotProps<T extends InputMenuItem> = (props: { item: T, index: number }) => any
|
|
204
|
-
|
|
205
|
-
export interface InputMenuSlots<
|
|
206
|
-
A extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>,
|
|
207
|
-
VK extends GetItemKeys<A> | undefined = undefined,
|
|
208
|
-
M extends boolean = false,
|
|
209
|
-
T extends NestedItem<A> = NestedItem<A>
|
|
210
|
-
> {
|
|
211
|
-
'leading'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof inputMenu> }): any
|
|
212
|
-
'trailing'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof inputMenu> }): any
|
|
213
|
-
'empty'(props: { searchTerm?: string }): any
|
|
214
|
-
'item': SlotProps<T>
|
|
215
|
-
'item-leading': SlotProps<T>
|
|
216
|
-
'item-label': SlotProps<T>
|
|
217
|
-
'item-trailing': SlotProps<T>
|
|
218
|
-
'tags-item-text': SlotProps<T>
|
|
219
|
-
'tags-item-delete': SlotProps<T>
|
|
220
|
-
'create-item-label'(props: { item: string }): any
|
|
221
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import _appConfig from "#build/app.config";
|
|
3
|
+
import theme from "#build/b24ui/input-menu";
|
|
4
|
+
import { tv } from "../utils/tv";
|
|
5
|
+
const appConfigInputMenu = _appConfig;
|
|
6
|
+
const inputMenu = tv({ extend: tv(theme), ...appConfigInputMenu.b24ui?.inputMenu || {} });
|
|
222
7
|
</script>
|
|
223
8
|
|
|
224
|
-
<script setup
|
|
225
|
-
import { computed, ref, toRef, onMounted, toRaw
|
|
226
|
-
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from
|
|
227
|
-
import { defu } from
|
|
228
|
-
import { isEqual } from
|
|
229
|
-
import { reactivePick, createReusableTemplate } from
|
|
230
|
-
import { useButtonGroup } from
|
|
231
|
-
import { useComponentIcons } from
|
|
232
|
-
import { useFormField } from
|
|
233
|
-
import { useLocale } from
|
|
234
|
-
import { compare, get, isArrayOfArray } from
|
|
235
|
-
import icons from
|
|
236
|
-
import B24Avatar from
|
|
237
|
-
import B24Chip from
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
type:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
9
|
+
<script setup>
|
|
10
|
+
import { computed, ref, toRef, onMounted, toRaw } from "vue";
|
|
11
|
+
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from "reka-ui";
|
|
12
|
+
import { defu } from "defu";
|
|
13
|
+
import { isEqual } from "ohash/utils";
|
|
14
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
15
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
16
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
17
|
+
import { useFormField } from "../composables/useFormField";
|
|
18
|
+
import { useLocale } from "../composables/useLocale";
|
|
19
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
20
|
+
import icons from "../dictionary/icons";
|
|
21
|
+
import B24Avatar from "./Avatar.vue";
|
|
22
|
+
import B24Chip from "./Chip.vue";
|
|
23
|
+
defineOptions({ inheritAttrs: false });
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
as: { type: null, required: false },
|
|
26
|
+
id: { type: String, required: false },
|
|
27
|
+
type: { type: null, required: false, default: "text" },
|
|
28
|
+
placeholder: { type: String, required: false },
|
|
29
|
+
color: { type: null, required: false },
|
|
30
|
+
size: { type: null, required: false },
|
|
31
|
+
noPadding: { type: Boolean, required: false },
|
|
32
|
+
noBorder: { type: Boolean, required: false },
|
|
33
|
+
underline: { type: Boolean, required: false },
|
|
34
|
+
rounded: { type: Boolean, required: false },
|
|
35
|
+
required: { type: Boolean, required: false },
|
|
36
|
+
autofocus: { type: Boolean, required: false },
|
|
37
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
38
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
39
|
+
selectedIcon: { type: [Function, Object], required: false },
|
|
40
|
+
deleteIcon: { type: [Function, Object], required: false },
|
|
41
|
+
content: { type: Object, required: false },
|
|
42
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
43
|
+
portal: { type: Boolean, required: false, default: true },
|
|
44
|
+
valueKey: { type: null, required: false },
|
|
45
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
46
|
+
items: { type: null, required: false },
|
|
47
|
+
defaultValue: { type: null, required: false },
|
|
48
|
+
modelValue: { type: null, required: false },
|
|
49
|
+
multiple: { type: Boolean, required: false },
|
|
50
|
+
tag: { type: String, required: false },
|
|
51
|
+
tagColor: { type: null, required: false },
|
|
52
|
+
highlight: { type: Boolean, required: false },
|
|
53
|
+
createItem: { type: [Boolean, String, Object], required: false },
|
|
54
|
+
filterFields: { type: Array, required: false },
|
|
55
|
+
ignoreFilter: { type: Boolean, required: false },
|
|
56
|
+
class: { type: null, required: false },
|
|
57
|
+
b24ui: { type: null, required: false },
|
|
58
|
+
open: { type: Boolean, required: false },
|
|
59
|
+
defaultOpen: { type: Boolean, required: false },
|
|
60
|
+
disabled: { type: Boolean, required: false },
|
|
61
|
+
name: { type: String, required: false },
|
|
62
|
+
resetSearchTermOnBlur: { type: Boolean, required: false, default: true },
|
|
63
|
+
resetSearchTermOnSelect: { type: Boolean, required: false, default: true },
|
|
64
|
+
highlightOnHover: { type: Boolean, required: false },
|
|
65
|
+
icon: { type: [Function, Object], required: false },
|
|
66
|
+
avatar: { type: Object, required: false },
|
|
67
|
+
loading: { type: Boolean, required: false },
|
|
68
|
+
trailing: { type: Boolean, required: false }
|
|
69
|
+
});
|
|
70
|
+
const emits = defineEmits(["update:open", "change", "blur", "focus", "create", "highlight", "update:modelValue"]);
|
|
71
|
+
const slots = defineSlots();
|
|
72
|
+
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
73
|
+
const { t } = useLocale();
|
|
74
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
75
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "highlightOnHover", "ignoreFilter"), emits);
|
|
76
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
77
|
+
const arrowProps = toRef(() => props.arrow);
|
|
78
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
79
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
80
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: icons.chevronDown })));
|
|
81
|
+
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
265
82
|
const isTag = computed(() => {
|
|
266
|
-
return props.tag
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate()
|
|
270
|
-
|
|
83
|
+
return props.tag;
|
|
84
|
+
});
|
|
85
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
|
|
271
86
|
const b24ui = computed(() => inputMenu({
|
|
272
87
|
color: color.value,
|
|
273
88
|
size: inputSize?.value,
|
|
@@ -282,134 +97,123 @@ const b24ui = computed(() => inputMenu({
|
|
|
282
97
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
283
98
|
multiple: props.multiple,
|
|
284
99
|
buttonGroup: orientation.value
|
|
285
|
-
}))
|
|
286
|
-
|
|
287
|
-
function displayValue(value: T): string {
|
|
100
|
+
}));
|
|
101
|
+
function displayValue(value) {
|
|
288
102
|
if (!props.valueKey) {
|
|
289
|
-
return value && (typeof value ===
|
|
103
|
+
return value && (typeof value === "object" ? get(value, props.labelKey) : value);
|
|
290
104
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
105
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
106
|
+
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
294
107
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
? props.items
|
|
300
|
-
: [props.items]
|
|
301
|
-
: []
|
|
302
|
-
)
|
|
303
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
304
|
-
const items = computed(() => groups.value.flatMap(group => group))
|
|
305
|
-
|
|
108
|
+
const groups = computed(
|
|
109
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
110
|
+
);
|
|
111
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
306
112
|
const filteredGroups = computed(() => {
|
|
307
113
|
if (props.ignoreFilter || !searchTerm.value) {
|
|
308
|
-
return groups.value
|
|
114
|
+
return groups.value;
|
|
309
115
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (typeof item !== 'object' || item === null) {
|
|
315
|
-
return contains(String(item), searchTerm.value)
|
|
116
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey];
|
|
117
|
+
return groups.value.map((group) => group.filter((item) => {
|
|
118
|
+
if (typeof item !== "object" || item === null) {
|
|
119
|
+
return contains(String(item), searchTerm.value);
|
|
316
120
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return true
|
|
121
|
+
if (item.type && ["label", "separator"].includes(item.type)) {
|
|
122
|
+
return true;
|
|
320
123
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group))
|
|
328
|
-
|
|
124
|
+
return fields.some((field) => contains(get(item, field), searchTerm.value));
|
|
125
|
+
})).filter((group) => group.filter(
|
|
126
|
+
(item) => !isInputItem(item) || isInputItem(item) && (!item.type || !["label", "separator"].includes(item.type))
|
|
127
|
+
).length > 0);
|
|
128
|
+
});
|
|
129
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap((group) => group));
|
|
329
130
|
const createItem = computed(() => {
|
|
330
131
|
if (!props.createItem || !searchTerm.value) {
|
|
331
|
-
return false
|
|
132
|
+
return false;
|
|
332
133
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if ((typeof props.createItem === 'object' && props.createItem.when === 'always') || props.createItem === 'always') {
|
|
337
|
-
return !filteredItems.value.find(item => compare(item, newItem, String(props.valueKey)))
|
|
134
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } : searchTerm.value;
|
|
135
|
+
if (typeof props.createItem === "object" && props.createItem.when === "always" || props.createItem === "always") {
|
|
136
|
+
return !filteredItems.value.find((item) => compare(item, newItem, String(props.valueKey)));
|
|
338
137
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
const inputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
|
|
345
|
-
|
|
138
|
+
return !filteredItems.value.length;
|
|
139
|
+
});
|
|
140
|
+
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
141
|
+
const inputRef = ref(null);
|
|
346
142
|
function autoFocus() {
|
|
347
143
|
if (props.autofocus) {
|
|
348
|
-
inputRef.value?.$el?.focus()
|
|
144
|
+
inputRef.value?.$el?.focus();
|
|
349
145
|
}
|
|
350
146
|
}
|
|
351
|
-
|
|
352
147
|
onMounted(() => {
|
|
353
148
|
setTimeout(() => {
|
|
354
|
-
autoFocus()
|
|
355
|
-
}, props.autofocusDelay)
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
function onUpdate(value: any) {
|
|
149
|
+
autoFocus();
|
|
150
|
+
}, props.autofocusDelay);
|
|
151
|
+
});
|
|
152
|
+
function onUpdate(value) {
|
|
359
153
|
if (toRaw(props.modelValue) === value) {
|
|
360
|
-
return
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const event = new Event("change", { target: { value } });
|
|
157
|
+
emits("change", event);
|
|
158
|
+
emitFormChange();
|
|
159
|
+
emitFormInput();
|
|
160
|
+
if (props.resetSearchTermOnSelect) {
|
|
161
|
+
searchTerm.value = "";
|
|
361
162
|
}
|
|
362
|
-
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
363
|
-
const event = new Event('change', { target: { value } })
|
|
364
|
-
emits('change', event)
|
|
365
|
-
emitFormChange()
|
|
366
|
-
emitFormInput()
|
|
367
163
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
emitFormBlur()
|
|
164
|
+
function onBlur(event) {
|
|
165
|
+
emits("blur", event);
|
|
166
|
+
emitFormBlur();
|
|
372
167
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
emitFormFocus()
|
|
168
|
+
function onFocus(event) {
|
|
169
|
+
emits("focus", event);
|
|
170
|
+
emitFormFocus();
|
|
377
171
|
}
|
|
378
|
-
|
|
379
|
-
|
|
172
|
+
function onUpdateOpen(value) {
|
|
173
|
+
let timeoutId;
|
|
380
174
|
if (!value) {
|
|
381
|
-
const event = new FocusEvent(
|
|
382
|
-
emits(
|
|
383
|
-
emitFormBlur()
|
|
175
|
+
const event = new FocusEvent("blur");
|
|
176
|
+
emits("blur", event);
|
|
177
|
+
emitFormBlur();
|
|
178
|
+
if (props.resetSearchTermOnBlur) {
|
|
179
|
+
const STATE_ANIMATION_DELAY_MS = 100;
|
|
180
|
+
timeoutId = setTimeout(() => {
|
|
181
|
+
searchTerm.value = "";
|
|
182
|
+
}, STATE_ANIMATION_DELAY_MS);
|
|
183
|
+
}
|
|
384
184
|
} else {
|
|
385
|
-
const event = new FocusEvent(
|
|
386
|
-
emits(
|
|
185
|
+
const event = new FocusEvent("focus");
|
|
186
|
+
emits("focus", event);
|
|
187
|
+
emitFormFocus();
|
|
188
|
+
clearTimeout(timeoutId);
|
|
387
189
|
}
|
|
388
|
-
|
|
389
|
-
nextTick(() => {
|
|
390
|
-
searchTerm.value = ''
|
|
391
|
-
})
|
|
392
190
|
}
|
|
393
|
-
|
|
394
|
-
function onRemoveTag(event: any) {
|
|
191
|
+
function onRemoveTag(event) {
|
|
395
192
|
if (props.multiple) {
|
|
396
|
-
const modelValue = props.modelValue
|
|
397
|
-
const filteredValue = modelValue.filter(value => !isEqual(value, event))
|
|
398
|
-
emits(
|
|
399
|
-
onUpdate(filteredValue)
|
|
193
|
+
const modelValue = props.modelValue;
|
|
194
|
+
const filteredValue = modelValue.filter((value) => !isEqual(value, event));
|
|
195
|
+
emits("update:modelValue", filteredValue);
|
|
196
|
+
onUpdate(filteredValue);
|
|
400
197
|
}
|
|
401
198
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
199
|
+
function onSelect(e, item) {
|
|
200
|
+
if (!isInputItem(item)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (item.disabled) {
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
item.onSelect?.(e);
|
|
208
|
+
}
|
|
209
|
+
function isInputItem(item) {
|
|
210
|
+
return typeof item === "object" && item !== null;
|
|
405
211
|
}
|
|
406
|
-
|
|
407
212
|
defineExpose({
|
|
408
213
|
inputRef
|
|
409
|
-
})
|
|
214
|
+
});
|
|
410
215
|
</script>
|
|
411
216
|
|
|
412
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
413
217
|
<template>
|
|
414
218
|
<DefineCreateItemTemplate>
|
|
415
219
|
<ComboboxGroup :class="b24ui.group({ addNew: true, class: props.b24ui?.group })">
|
|
@@ -451,7 +255,7 @@ defineExpose({
|
|
|
451
255
|
<TagsInputRoot
|
|
452
256
|
v-if="multiple"
|
|
453
257
|
v-slot="{ modelValue: tags }"
|
|
454
|
-
:model-value="
|
|
258
|
+
:model-value="modelValue"
|
|
455
259
|
:disabled="disabled"
|
|
456
260
|
:required="required"
|
|
457
261
|
delimiter=""
|
|
@@ -460,15 +264,15 @@ defineExpose({
|
|
|
460
264
|
@focus="onFocus"
|
|
461
265
|
@remove-tag="onRemoveTag"
|
|
462
266
|
>
|
|
463
|
-
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="
|
|
267
|
+
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="b24ui.tagsItem({ class: props.b24ui?.tagsItem })">
|
|
464
268
|
<TagsInputItemText :class="b24ui.tagsItemText({ class: props.b24ui?.tagsItemText })">
|
|
465
|
-
<slot name="tags-item-text" :item="
|
|
466
|
-
{{ displayValue(item
|
|
269
|
+
<slot name="tags-item-text" :item="item" :index="index">
|
|
270
|
+
{{ displayValue(item) }}
|
|
467
271
|
</slot>
|
|
468
272
|
</TagsInputItemText>
|
|
469
273
|
|
|
470
274
|
<TagsInputItemDelete :class="b24ui.tagsItemDelete({ class: props.b24ui?.tagsItemDelete })" :disabled="disabled">
|
|
471
|
-
<slot name="tags-item-delete" :item="
|
|
275
|
+
<slot name="tags-item-delete" :item="item" :index="index">
|
|
472
276
|
<Component
|
|
473
277
|
:is="deleteIcon || icons.close"
|
|
474
278
|
:class="b24ui.tagsItemDeleteIcon({ class: props.b24ui?.tagsItemDeleteIcon })"
|
|
@@ -477,7 +281,7 @@ defineExpose({
|
|
|
477
281
|
</TagsInputItemDelete>
|
|
478
282
|
</TagsInputItem>
|
|
479
283
|
|
|
480
|
-
<ComboboxInput
|
|
284
|
+
<ComboboxInput v-model="searchTerm" as-child>
|
|
481
285
|
<TagsInputInput
|
|
482
286
|
ref="inputRef"
|
|
483
287
|
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
@@ -502,18 +306,18 @@ defineExpose({
|
|
|
502
306
|
/>
|
|
503
307
|
|
|
504
308
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
505
|
-
<slot name="leading" :model-value="
|
|
309
|
+
<slot name="leading" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
506
310
|
<Component
|
|
507
311
|
:is="leadingIconName"
|
|
508
312
|
v-if="isLeading && leadingIconName"
|
|
509
313
|
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
510
314
|
/>
|
|
511
|
-
<B24Avatar v-else-if="!!avatar" :size="
|
|
315
|
+
<B24Avatar v-else-if="!!avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar })" />
|
|
512
316
|
</slot>
|
|
513
317
|
</span>
|
|
514
318
|
|
|
515
319
|
<ComboboxTrigger v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
516
|
-
<slot name="trailing" :model-value="
|
|
320
|
+
<slot name="trailing" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
517
321
|
<Component
|
|
518
322
|
:is="trailingIconName"
|
|
519
323
|
v-if="trailingIconName"
|
|
@@ -537,29 +341,29 @@ defineExpose({
|
|
|
537
341
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
538
342
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
539
343
|
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
540
|
-
{{ get(item, props.labelKey
|
|
344
|
+
{{ get(item, props.labelKey) }}
|
|
541
345
|
</ComboboxLabel>
|
|
542
346
|
|
|
543
347
|
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
544
348
|
|
|
545
349
|
<ComboboxItem
|
|
546
350
|
v-else
|
|
547
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color :
|
|
351
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
548
352
|
:disabled="isInputItem(item) && item.disabled"
|
|
549
353
|
:value="props.valueKey && isInputItem(item) ? get(item, String(props.valueKey)) : item"
|
|
550
|
-
@select="
|
|
354
|
+
@select="onSelect($event, item)"
|
|
551
355
|
>
|
|
552
|
-
<slot name="item" :item="
|
|
553
|
-
<slot name="item-leading" :item="
|
|
356
|
+
<slot name="item" :item="item" :index="index">
|
|
357
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
554
358
|
<Component
|
|
555
359
|
:is="item.icon"
|
|
556
360
|
v-if="isInputItem(item) && item.icon"
|
|
557
361
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
558
362
|
/>
|
|
559
|
-
<B24Avatar v-else-if="isInputItem(item) && item.avatar" :size="
|
|
363
|
+
<B24Avatar v-else-if="isInputItem(item) && item.avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar, colorItem: item?.color })" />
|
|
560
364
|
<B24Chip
|
|
561
365
|
v-else-if="isInputItem(item) && item.chip"
|
|
562
|
-
:size="
|
|
366
|
+
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
563
367
|
inset
|
|
564
368
|
standalone
|
|
565
369
|
v-bind="item.chip"
|
|
@@ -568,18 +372,18 @@ defineExpose({
|
|
|
568
372
|
</slot>
|
|
569
373
|
|
|
570
374
|
<span :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
571
|
-
<slot name="item-label" :item="
|
|
572
|
-
{{ isInputItem(item) ? get(item, props.labelKey
|
|
375
|
+
<slot name="item-label" :item="item" :index="index">
|
|
376
|
+
{{ isInputItem(item) ? get(item, props.labelKey) : item }}
|
|
573
377
|
</slot>
|
|
574
378
|
</span>
|
|
575
379
|
|
|
576
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color :
|
|
577
|
-
<slot name="item-trailing" :item="
|
|
380
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color : void 0 })">
|
|
381
|
+
<slot name="item-trailing" :item="item" :index="index" />
|
|
578
382
|
|
|
579
383
|
<ComboboxItemIndicator as-child>
|
|
580
384
|
<Component
|
|
581
385
|
:is="selectedIcon || icons.check"
|
|
582
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color :
|
|
386
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
583
387
|
/>
|
|
584
388
|
</ComboboxItemIndicator>
|
|
585
389
|
</span>
|