@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,208 +1,9 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxContentEmits, ComboboxArrowProps } from 'reka-ui'
|
|
4
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import _appConfig from '#build/app.config'
|
|
6
|
-
import theme from '#build/b24ui/select-menu'
|
|
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
|
-
disabled?: boolean
|
|
42
|
-
onSelect?(e?: Event): void
|
|
43
|
-
[key: string]: any
|
|
44
|
-
}
|
|
45
|
-
export type SelectMenuItem = _SelectMenuItem | AcceptableValue | boolean
|
|
46
|
-
|
|
47
|
-
type SelectMenuVariants = VariantProps<typeof selectMenu>
|
|
48
|
-
|
|
49
|
-
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 {
|
|
50
|
-
id?: string
|
|
51
|
-
/** The placeholder text when the select is empty. */
|
|
52
|
-
placeholder?: string
|
|
53
|
-
/**
|
|
54
|
-
* Whether to display the search input or not.
|
|
55
|
-
* Can be an object to pass additional props to the input.
|
|
56
|
-
* `{ placeholder: 'Search...', type: 'search' }`{lang="ts"}
|
|
57
|
-
* @defaultValue true
|
|
58
|
-
*/
|
|
59
|
-
searchInput?: boolean | InputProps
|
|
60
|
-
/**
|
|
61
|
-
* @defaultValue 'primary'
|
|
62
|
-
*/
|
|
63
|
-
color?: SelectMenuVariants['color']
|
|
64
|
-
/**
|
|
65
|
-
* @defaultValue 'md'
|
|
66
|
-
*/
|
|
67
|
-
size?: SelectMenuVariants['size']
|
|
68
|
-
/**
|
|
69
|
-
* Removes padding from input
|
|
70
|
-
* @defaultValue false
|
|
71
|
-
*/
|
|
72
|
-
noPadding?: boolean
|
|
73
|
-
/**
|
|
74
|
-
* Removes all borders (rings)
|
|
75
|
-
* @defaultValue false
|
|
76
|
-
*/
|
|
77
|
-
noBorder?: boolean
|
|
78
|
-
/**
|
|
79
|
-
* Removes all borders (rings) except the bottom one
|
|
80
|
-
* @defaultValue false
|
|
81
|
-
*/
|
|
82
|
-
underline?: boolean
|
|
83
|
-
/**
|
|
84
|
-
* Rounds the corners of the button
|
|
85
|
-
* @defaultValue false
|
|
86
|
-
*/
|
|
87
|
-
rounded?: boolean
|
|
88
|
-
tag?: string
|
|
89
|
-
/**
|
|
90
|
-
* @defaultValue 'primary'
|
|
91
|
-
*/
|
|
92
|
-
tagColor?: SelectMenuVariants['tagColor']
|
|
93
|
-
/**
|
|
94
|
-
* @defaultValue false
|
|
95
|
-
*/
|
|
96
|
-
required?: boolean
|
|
97
|
-
/**
|
|
98
|
-
* The icon displayed to open the menu.
|
|
99
|
-
* @defaultValue icons.chevronDown
|
|
100
|
-
* @IconComponent
|
|
101
|
-
*/
|
|
102
|
-
trailingIcon?: IconComponent
|
|
103
|
-
/**
|
|
104
|
-
* The icon displayed when an item is selected.
|
|
105
|
-
* @defaultValue icons.check
|
|
106
|
-
* @IconComponent
|
|
107
|
-
*/
|
|
108
|
-
selectedIcon?: IconComponent
|
|
109
|
-
/**
|
|
110
|
-
* The content of the menu.
|
|
111
|
-
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
|
|
112
|
-
*/
|
|
113
|
-
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>
|
|
114
|
-
/**
|
|
115
|
-
* Display an arrow alongside the menu.
|
|
116
|
-
* @defaultValue false
|
|
117
|
-
*/
|
|
118
|
-
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
|
|
119
|
-
/**
|
|
120
|
-
* Render the menu in a portal.
|
|
121
|
-
* @defaultValue true
|
|
122
|
-
*/
|
|
123
|
-
portal?: boolean
|
|
124
|
-
/**
|
|
125
|
-
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
126
|
-
* @defaultValue undefined
|
|
127
|
-
*/
|
|
128
|
-
valueKey?: VK
|
|
129
|
-
/**
|
|
130
|
-
* When `items` is an array of objects, select the field to use as the label.
|
|
131
|
-
* @defaultValue 'label'
|
|
132
|
-
*/
|
|
133
|
-
labelKey?: keyof NestedItem<T>
|
|
134
|
-
items?: T
|
|
135
|
-
/**
|
|
136
|
-
* The value of the SelectMenu when initially rendered. Use when you do not need to control the state of the SelectMenu
|
|
137
|
-
*/
|
|
138
|
-
defaultValue?: GetModelValue<T, VK, M>
|
|
139
|
-
/**
|
|
140
|
-
* The controlled value of the SelectMenu. Can be binded-with with `v-model`
|
|
141
|
-
*/
|
|
142
|
-
modelValue?: GetModelValue<T, VK, M>
|
|
143
|
-
/**
|
|
144
|
-
* Whether multiple options can be selected or not
|
|
145
|
-
* @defaultValue false
|
|
146
|
-
*/
|
|
147
|
-
multiple?: M & boolean
|
|
148
|
-
/**
|
|
149
|
-
* Highlight the ring color like a focus state
|
|
150
|
-
* @defaultValue false
|
|
151
|
-
*/
|
|
152
|
-
highlight?: boolean
|
|
153
|
-
/**
|
|
154
|
-
* Determines if custom user input that does not exist in options can be added.
|
|
155
|
-
* @defaultValue false
|
|
156
|
-
*/
|
|
157
|
-
createItem?: boolean | 'always' | { position?: 'top' | 'bottom', when?: 'empty' | 'always' }
|
|
158
|
-
/**
|
|
159
|
-
* Fields to filter items by.
|
|
160
|
-
* @defaultValue [labelKey]
|
|
161
|
-
*/
|
|
162
|
-
filterFields?: string[]
|
|
163
|
-
/**
|
|
164
|
-
* When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
165
|
-
* @defaultValue false
|
|
166
|
-
*/
|
|
167
|
-
ignoreFilter?: boolean
|
|
168
|
-
class?: any
|
|
169
|
-
b24ui?: PartialString<typeof selectMenu.slots>
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export type SelectMenuEmits<A extends ArrayOrNested<SelectMenuItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Pick<ComboboxRootEmits, 'update:open'> & {
|
|
173
|
-
change: [payload: Event]
|
|
174
|
-
blur: [payload: FocusEvent]
|
|
175
|
-
focus: [payload: FocusEvent]
|
|
176
|
-
create: [item: string]
|
|
177
|
-
/** Event handler when highlighted element changes. */
|
|
178
|
-
highlight: [payload: {
|
|
179
|
-
ref: HTMLElement
|
|
180
|
-
value: GetModelValue<A, VK, M>
|
|
181
|
-
} | undefined]
|
|
182
|
-
} & GetModelValueEmits<A, VK, M>
|
|
183
|
-
|
|
184
|
-
type SlotProps<T extends SelectMenuItem> = (props: { item: T, index: number }) => any
|
|
185
|
-
|
|
186
|
-
export interface SelectMenuSlots<
|
|
187
|
-
A extends ArrayOrNested<SelectMenuItem> = ArrayOrNested<SelectMenuItem>,
|
|
188
|
-
VK extends GetItemKeys<A> | undefined = undefined,
|
|
189
|
-
M extends boolean = false,
|
|
190
|
-
T extends NestedItem<A> = NestedItem<A>
|
|
191
|
-
> {
|
|
192
|
-
'leading'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof selectMenu> }): any
|
|
193
|
-
'default'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean }): any
|
|
194
|
-
'trailing'(props: { modelValue?: GetModelValue<A, VK, M>, open: boolean, b24ui: ReturnType<typeof selectMenu> }): any
|
|
195
|
-
'empty'(props: { searchTerm?: string }): any
|
|
196
|
-
'item': SlotProps<T>
|
|
197
|
-
'item-leading': SlotProps<T>
|
|
198
|
-
'item-label': SlotProps<T>
|
|
199
|
-
'item-trailing': SlotProps<T>
|
|
200
|
-
'create-item-label'(props: { item: string }): any
|
|
201
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/select-menu";
|
|
202
3
|
</script>
|
|
203
4
|
|
|
204
|
-
<script setup
|
|
205
|
-
import { computed, toRef, toRaw } from
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, toRef, toRaw } from "vue";
|
|
206
7
|
import {
|
|
207
8
|
ComboboxRoot,
|
|
208
9
|
ComboboxArrow,
|
|
@@ -222,56 +23,85 @@ import {
|
|
|
222
23
|
useForwardPropsEmits,
|
|
223
24
|
useFilter,
|
|
224
25
|
Primitive
|
|
225
|
-
} from
|
|
226
|
-
import { defu } from
|
|
227
|
-
import { reactivePick, createReusableTemplate } from
|
|
228
|
-
import {
|
|
229
|
-
import {
|
|
230
|
-
import {
|
|
231
|
-
import {
|
|
232
|
-
import {
|
|
233
|
-
import
|
|
234
|
-
import
|
|
235
|
-
import
|
|
236
|
-
import
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const props =
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
26
|
+
} from "reka-ui";
|
|
27
|
+
import { defu } from "defu";
|
|
28
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
29
|
+
import { useAppConfig } from "#imports";
|
|
30
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
31
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
32
|
+
import { useFormField } from "../composables/useFormField";
|
|
33
|
+
import { useLocale } from "../composables/useLocale";
|
|
34
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
35
|
+
import { tv } from "../utils/tv";
|
|
36
|
+
import icons from "../dictionary/icons";
|
|
37
|
+
import B24Avatar from "./Avatar.vue";
|
|
38
|
+
import B24Chip from "./Chip.vue";
|
|
39
|
+
import B24Input from "./Input.vue";
|
|
40
|
+
defineOptions({ inheritAttrs: false });
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
id: { type: String, required: false },
|
|
43
|
+
placeholder: { type: String, required: false },
|
|
44
|
+
searchInput: { type: [Boolean, Object], required: false, default: true },
|
|
45
|
+
color: { type: null, required: false },
|
|
46
|
+
size: { type: null, required: false },
|
|
47
|
+
noPadding: { type: Boolean, required: false },
|
|
48
|
+
noBorder: { type: Boolean, required: false },
|
|
49
|
+
underline: { type: Boolean, required: false },
|
|
50
|
+
rounded: { type: Boolean, required: false },
|
|
51
|
+
tag: { type: String, required: false },
|
|
52
|
+
tagColor: { type: null, required: false },
|
|
53
|
+
required: { type: Boolean, required: false },
|
|
54
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
55
|
+
selectedIcon: { type: [Function, Object], required: false },
|
|
56
|
+
content: { type: Object, required: false },
|
|
57
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
58
|
+
portal: { type: Boolean, required: false, default: true },
|
|
59
|
+
valueKey: { type: null, required: false },
|
|
60
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
61
|
+
items: { type: null, required: false },
|
|
62
|
+
defaultValue: { type: null, required: false },
|
|
63
|
+
modelValue: { type: null, required: false },
|
|
64
|
+
multiple: { type: Boolean, required: false },
|
|
65
|
+
highlight: { type: Boolean, required: false },
|
|
66
|
+
createItem: { type: [Boolean, String, Object], required: false },
|
|
67
|
+
filterFields: { type: Array, required: false },
|
|
68
|
+
ignoreFilter: { type: Boolean, required: false },
|
|
69
|
+
class: { type: null, required: false },
|
|
70
|
+
b24ui: { type: null, required: false },
|
|
71
|
+
open: { type: Boolean, required: false },
|
|
72
|
+
defaultOpen: { type: Boolean, required: false },
|
|
73
|
+
disabled: { type: Boolean, required: false },
|
|
74
|
+
name: { type: String, required: false },
|
|
75
|
+
resetSearchTermOnBlur: { type: Boolean, required: false, default: true },
|
|
76
|
+
resetSearchTermOnSelect: { type: Boolean, required: false, default: true },
|
|
77
|
+
highlightOnHover: { type: Boolean, required: false },
|
|
78
|
+
icon: { type: [Function, Object], required: false },
|
|
79
|
+
avatar: { type: Object, required: false },
|
|
80
|
+
loading: { type: Boolean, required: false },
|
|
81
|
+
trailing: { type: Boolean, required: false }
|
|
82
|
+
});
|
|
83
|
+
const emits = defineEmits(["update:open", "change", "blur", "focus", "create", "highlight", "update:modelValue"]);
|
|
84
|
+
const slots = defineSlots();
|
|
85
|
+
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
86
|
+
const { t } = useLocale();
|
|
87
|
+
const appConfig = useAppConfig();
|
|
88
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
89
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "highlightOnHover"), emits);
|
|
90
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
91
|
+
const arrowProps = toRef(() => props.arrow);
|
|
92
|
+
const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), type: "search" }));
|
|
93
|
+
const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
94
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
261
95
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(
|
|
262
96
|
props,
|
|
263
97
|
{ trailingIcon: icons.chevronDown }
|
|
264
|
-
)))
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate()
|
|
269
|
-
|
|
98
|
+
)));
|
|
99
|
+
const selectSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
100
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
|
|
270
101
|
const isTag = computed(() => {
|
|
271
|
-
return props.tag
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
const b24ui = computed(() => selectMenu({
|
|
102
|
+
return props.tag;
|
|
103
|
+
});
|
|
104
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.selectMenu || {} })({
|
|
275
105
|
color: color.value,
|
|
276
106
|
size: selectSize?.value,
|
|
277
107
|
loading: props.loading,
|
|
@@ -284,115 +114,98 @@ const b24ui = computed(() => selectMenu({
|
|
|
284
114
|
leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
|
|
285
115
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
286
116
|
buttonGroup: orientation.value
|
|
287
|
-
}))
|
|
288
|
-
|
|
289
|
-
function displayValue(value: GetItemValue<T, VK> | GetItemValue<T, VK>[]): string {
|
|
117
|
+
}));
|
|
118
|
+
function displayValue(value) {
|
|
290
119
|
if (props.multiple && Array.isArray(value)) {
|
|
291
|
-
return value.map(v => displayValue(v)).filter(Boolean).join(
|
|
120
|
+
return value.map((v) => displayValue(v)).filter(Boolean).join(", ");
|
|
292
121
|
}
|
|
293
|
-
|
|
294
122
|
if (!props.valueKey) {
|
|
295
|
-
return value && (typeof value ===
|
|
123
|
+
return value && (typeof value === "object" ? get(value, props.labelKey) : value);
|
|
296
124
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
125
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
126
|
+
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
300
127
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
? props.items
|
|
306
|
-
: [props.items]
|
|
307
|
-
: []
|
|
308
|
-
)
|
|
309
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
310
|
-
const items = computed(() => groups.value.flatMap(group => group) as T[])
|
|
311
|
-
|
|
128
|
+
const groups = computed(
|
|
129
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
130
|
+
);
|
|
131
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
312
132
|
const filteredGroups = computed(() => {
|
|
313
133
|
if (props.ignoreFilter || !searchTerm.value) {
|
|
314
|
-
return groups.value
|
|
134
|
+
return groups.value;
|
|
315
135
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (typeof item !== 'object' || item === null) {
|
|
321
|
-
return contains(String(item), searchTerm.value)
|
|
136
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey];
|
|
137
|
+
return groups.value.map((items2) => items2.filter((item) => {
|
|
138
|
+
if (typeof item !== "object" || item === null) {
|
|
139
|
+
return contains(String(item), searchTerm.value);
|
|
322
140
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
return true
|
|
141
|
+
if (item.type && ["label", "separator"].includes(item.type)) {
|
|
142
|
+
return true;
|
|
326
143
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group))
|
|
334
|
-
|
|
144
|
+
return fields.some((field) => contains(get(item, field), searchTerm.value));
|
|
145
|
+
})).filter((group) => group.filter(
|
|
146
|
+
(item) => !isSelectItem(item) || isSelectItem(item) && (!item.type || !["label", "separator"].includes(item.type))
|
|
147
|
+
).length > 0);
|
|
148
|
+
});
|
|
149
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap((group) => group));
|
|
335
150
|
const createItem = computed(() => {
|
|
336
151
|
if (!props.createItem || !searchTerm.value) {
|
|
337
|
-
return false
|
|
152
|
+
return false;
|
|
338
153
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if ((typeof props.createItem === 'object' && props.createItem.when === 'always') || props.createItem === 'always') {
|
|
343
|
-
return !filteredItems.value.find(item => compare(item, newItem, String(props.valueKey)))
|
|
154
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } : searchTerm.value;
|
|
155
|
+
if (typeof props.createItem === "object" && props.createItem.when === "always" || props.createItem === "always") {
|
|
156
|
+
return !filteredItems.value.find((item) => compare(item, newItem, String(props.valueKey)));
|
|
344
157
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
function onUpdate(value: any) {
|
|
158
|
+
return !filteredItems.value.length;
|
|
159
|
+
});
|
|
160
|
+
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
161
|
+
function onUpdate(value) {
|
|
351
162
|
if (toRaw(props.modelValue) === value) {
|
|
352
|
-
return
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const event = new Event("change", { target: { value } });
|
|
166
|
+
emits("change", event);
|
|
167
|
+
emitFormChange();
|
|
168
|
+
emitFormInput();
|
|
169
|
+
if (props.resetSearchTermOnSelect) {
|
|
170
|
+
searchTerm.value = "";
|
|
353
171
|
}
|
|
354
|
-
// @ts-expect-error - 'target' does not exist in type 'EventInit'
|
|
355
|
-
const event = new Event('change', { target: { value } })
|
|
356
|
-
emits('change', event)
|
|
357
|
-
|
|
358
|
-
emitFormChange()
|
|
359
|
-
emitFormInput()
|
|
360
172
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
let timeoutId: ReturnType<typeof setTimeout> | undefined
|
|
364
|
-
|
|
173
|
+
function onUpdateOpen(value) {
|
|
174
|
+
let timeoutId;
|
|
365
175
|
if (!value) {
|
|
366
|
-
const event = new FocusEvent(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
emitFormBlur()
|
|
370
|
-
|
|
371
|
-
// Since we use `displayValue` prop inside ComboboxInput we should reset searchTerm manually
|
|
372
|
-
// https://reka-ui.com/docs/components/combobox#api-reference
|
|
176
|
+
const event = new FocusEvent("blur");
|
|
177
|
+
emits("blur", event);
|
|
178
|
+
emitFormBlur();
|
|
373
179
|
if (props.resetSearchTermOnBlur) {
|
|
374
|
-
const STATE_ANIMATION_DELAY_MS = 100
|
|
375
|
-
|
|
180
|
+
const STATE_ANIMATION_DELAY_MS = 100;
|
|
376
181
|
timeoutId = setTimeout(() => {
|
|
377
|
-
searchTerm.value =
|
|
378
|
-
}, STATE_ANIMATION_DELAY_MS)
|
|
182
|
+
searchTerm.value = "";
|
|
183
|
+
}, STATE_ANIMATION_DELAY_MS);
|
|
379
184
|
}
|
|
380
185
|
} else {
|
|
381
|
-
const event = new FocusEvent(
|
|
382
|
-
emits(
|
|
383
|
-
emitFormFocus()
|
|
186
|
+
const event = new FocusEvent("focus");
|
|
187
|
+
emits("focus", event);
|
|
188
|
+
emitFormFocus();
|
|
384
189
|
if (timeoutId) {
|
|
385
|
-
clearTimeout(timeoutId)
|
|
190
|
+
clearTimeout(timeoutId);
|
|
386
191
|
}
|
|
387
192
|
}
|
|
388
193
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
194
|
+
function onSelect(e, item) {
|
|
195
|
+
if (!isSelectItem(item)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (item.disabled) {
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
item.onSelect?.(e);
|
|
203
|
+
}
|
|
204
|
+
function isSelectItem(item) {
|
|
205
|
+
return typeof item === "object" && item !== null;
|
|
392
206
|
}
|
|
393
207
|
</script>
|
|
394
208
|
|
|
395
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
396
209
|
<template>
|
|
397
210
|
<Primitive as="div" :class="b24ui.root({ addNew: true, class: [props.b24ui?.root] })">
|
|
398
211
|
<DefineCreateItemTemplate>
|
|
@@ -432,29 +245,29 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
432
245
|
{{ props.tag }}
|
|
433
246
|
</div>
|
|
434
247
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
435
|
-
<slot name="leading" :model-value="
|
|
248
|
+
<slot name="leading" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
436
249
|
<Component
|
|
437
250
|
:is="leadingIconName"
|
|
438
251
|
v-if="isLeading && leadingIconName"
|
|
439
252
|
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
440
253
|
/>
|
|
441
|
-
<B24Avatar v-else-if="!!avatar" :size="
|
|
254
|
+
<B24Avatar v-else-if="!!avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar })" />
|
|
442
255
|
</slot>
|
|
443
256
|
</span>
|
|
444
257
|
|
|
445
|
-
<slot :model-value="
|
|
446
|
-
<template v-for="displayedModelValue in [displayValue(modelValue
|
|
258
|
+
<slot :model-value="modelValue" :open="open">
|
|
259
|
+
<template v-for="displayedModelValue in [displayValue(modelValue)]" :key="displayedModelValue">
|
|
447
260
|
<span v-if="displayedModelValue" :class="b24ui.value({ class: props.b24ui?.value })">
|
|
448
261
|
{{ displayedModelValue }}
|
|
449
262
|
</span>
|
|
450
263
|
<span v-else :class="b24ui.placeholder({ class: props.b24ui?.placeholder })">
|
|
451
|
-
{{ placeholder ?? '
|
|
264
|
+
{{ placeholder ?? '\xA0' }}
|
|
452
265
|
</span>
|
|
453
266
|
</template>
|
|
454
267
|
</slot>
|
|
455
268
|
|
|
456
269
|
<span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
457
|
-
<slot name="trailing" :model-value="
|
|
270
|
+
<slot name="trailing" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
458
271
|
<Component
|
|
459
272
|
:is="trailingIconName"
|
|
460
273
|
v-if="trailingIconName"
|
|
@@ -484,29 +297,29 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
484
297
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
485
298
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
486
299
|
<ComboboxLabel v-if="isSelectItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
487
|
-
{{ get(item, props.labelKey
|
|
300
|
+
{{ get(item, props.labelKey) }}
|
|
488
301
|
</ComboboxLabel>
|
|
489
302
|
|
|
490
303
|
<ComboboxSeparator v-else-if="isSelectItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
491
304
|
|
|
492
305
|
<ComboboxItem
|
|
493
306
|
v-else
|
|
494
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color :
|
|
307
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isSelectItem(item) ? item?.color : void 0 })"
|
|
495
308
|
:disabled="isSelectItem(item) && item.disabled"
|
|
496
|
-
:value="props.valueKey && isSelectItem(item) ? get(item, props.valueKey
|
|
497
|
-
@select="
|
|
309
|
+
:value="props.valueKey && isSelectItem(item) ? get(item, props.valueKey) : item"
|
|
310
|
+
@select="onSelect($event, item)"
|
|
498
311
|
>
|
|
499
|
-
<slot name="item" :item="
|
|
500
|
-
<slot name="item-leading" :item="
|
|
312
|
+
<slot name="item" :item="item" :index="index">
|
|
313
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
501
314
|
<Component
|
|
502
315
|
:is="item.icon"
|
|
503
316
|
v-if="isSelectItem(item) && item.icon"
|
|
504
317
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
505
318
|
/>
|
|
506
|
-
<B24Avatar v-else-if="isSelectItem(item) && item.avatar" :size="
|
|
319
|
+
<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 })" />
|
|
507
320
|
<B24Chip
|
|
508
321
|
v-else-if="isSelectItem(item) && item.chip"
|
|
509
|
-
:size="
|
|
322
|
+
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
510
323
|
inset
|
|
511
324
|
standalone
|
|
512
325
|
v-bind="item.chip"
|
|
@@ -515,18 +328,18 @@ function isSelectItem(item: SelectMenuItem): item is _SelectMenuItem {
|
|
|
515
328
|
</slot>
|
|
516
329
|
|
|
517
330
|
<span :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
518
|
-
<slot name="item-label" :item="
|
|
519
|
-
{{ isSelectItem(item) ? get(item, props.labelKey
|
|
331
|
+
<slot name="item-label" :item="item" :index="index">
|
|
332
|
+
{{ isSelectItem(item) ? get(item, props.labelKey) : item }}
|
|
520
333
|
</slot>
|
|
521
334
|
</span>
|
|
522
335
|
|
|
523
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color :
|
|
524
|
-
<slot name="item-trailing" :item="
|
|
336
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isSelectItem(item) ? item?.color : void 0 })">
|
|
337
|
+
<slot name="item-trailing" :item="item" :index="index" />
|
|
525
338
|
|
|
526
339
|
<ComboboxItemIndicator as-child>
|
|
527
340
|
<Component
|
|
528
341
|
:is="selectedIcon || icons.check"
|
|
529
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color :
|
|
342
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isSelectItem(item) ? item?.color : void 0 })"
|
|
530
343
|
/>
|
|
531
344
|
</ComboboxItemIndicator>
|
|
532
345
|
</span>
|