@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,274 +1,88 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { VariantProps } from 'tailwind-variants'
|
|
4
|
-
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxContentEmits, ComboboxArrowProps } from 'reka-ui'
|
|
5
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
-
import _appConfig from '#build/app.config'
|
|
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 theme from "#build/b24ui/input-menu";
|
|
222
3
|
</script>
|
|
223
4
|
|
|
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 {
|
|
231
|
-
import {
|
|
232
|
-
import {
|
|
233
|
-
import {
|
|
234
|
-
import {
|
|
235
|
-
import
|
|
236
|
-
import
|
|
237
|
-
import
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const props =
|
|
242
|
-
type:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, ref, toRef, onMounted, toRaw } from "vue";
|
|
7
|
+
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";
|
|
8
|
+
import { defu } from "defu";
|
|
9
|
+
import { isEqual } from "ohash/utils";
|
|
10
|
+
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
11
|
+
import { useAppConfig } from "#imports";
|
|
12
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
13
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
14
|
+
import { useFormField } from "../composables/useFormField";
|
|
15
|
+
import { useLocale } from "../composables/useLocale";
|
|
16
|
+
import { compare, get, isArrayOfArray } from "../utils";
|
|
17
|
+
import { tv } from "../utils/tv";
|
|
18
|
+
import icons from "../dictionary/icons";
|
|
19
|
+
import B24Avatar from "./Avatar.vue";
|
|
20
|
+
import B24Chip from "./Chip.vue";
|
|
21
|
+
defineOptions({ inheritAttrs: false });
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
as: { type: null, required: false },
|
|
24
|
+
id: { type: String, required: false },
|
|
25
|
+
type: { type: null, required: false, default: "text" },
|
|
26
|
+
placeholder: { type: String, required: false },
|
|
27
|
+
color: { type: null, required: false },
|
|
28
|
+
size: { type: null, required: false },
|
|
29
|
+
noPadding: { type: Boolean, required: false },
|
|
30
|
+
noBorder: { type: Boolean, required: false },
|
|
31
|
+
underline: { type: Boolean, required: false },
|
|
32
|
+
rounded: { type: Boolean, required: false },
|
|
33
|
+
required: { type: Boolean, required: false },
|
|
34
|
+
autofocus: { type: Boolean, required: false },
|
|
35
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
36
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
37
|
+
selectedIcon: { type: [Function, Object], required: false },
|
|
38
|
+
deleteIcon: { type: [Function, Object], required: false },
|
|
39
|
+
content: { type: Object, required: false },
|
|
40
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
41
|
+
portal: { type: Boolean, required: false, default: true },
|
|
42
|
+
valueKey: { type: null, required: false },
|
|
43
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
44
|
+
items: { type: null, required: false },
|
|
45
|
+
defaultValue: { type: null, required: false },
|
|
46
|
+
modelValue: { type: null, required: false },
|
|
47
|
+
multiple: { type: Boolean, required: false },
|
|
48
|
+
tag: { type: String, required: false },
|
|
49
|
+
tagColor: { type: null, required: false },
|
|
50
|
+
highlight: { type: Boolean, required: false },
|
|
51
|
+
createItem: { type: [Boolean, String, Object], required: false },
|
|
52
|
+
filterFields: { type: Array, required: false },
|
|
53
|
+
ignoreFilter: { type: Boolean, required: false },
|
|
54
|
+
class: { type: null, required: false },
|
|
55
|
+
b24ui: { type: null, required: false },
|
|
56
|
+
open: { type: Boolean, required: false },
|
|
57
|
+
defaultOpen: { type: Boolean, required: false },
|
|
58
|
+
disabled: { type: Boolean, required: false },
|
|
59
|
+
name: { type: String, required: false },
|
|
60
|
+
resetSearchTermOnBlur: { type: Boolean, required: false, default: true },
|
|
61
|
+
resetSearchTermOnSelect: { type: Boolean, required: false, default: true },
|
|
62
|
+
highlightOnHover: { type: Boolean, required: false },
|
|
63
|
+
icon: { type: [Function, Object], required: false },
|
|
64
|
+
avatar: { type: Object, required: false },
|
|
65
|
+
loading: { type: Boolean, required: false },
|
|
66
|
+
trailing: { type: Boolean, required: false }
|
|
67
|
+
});
|
|
68
|
+
const emits = defineEmits(["update:open", "change", "blur", "focus", "create", "highlight", "update:modelValue"]);
|
|
69
|
+
const slots = defineSlots();
|
|
70
|
+
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
71
|
+
const { t } = useLocale();
|
|
72
|
+
const appConfig = useAppConfig();
|
|
73
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
74
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "highlightOnHover", "ignoreFilter"), emits);
|
|
75
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
76
|
+
const arrowProps = toRef(() => props.arrow);
|
|
77
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
78
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
79
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: icons.chevronDown })));
|
|
80
|
+
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
265
81
|
const isTag = computed(() => {
|
|
266
|
-
return props.tag
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
const b24ui = computed(() => inputMenu({
|
|
82
|
+
return props.tag;
|
|
83
|
+
});
|
|
84
|
+
const [DefineCreateItemTemplate, ReuseCreateItemTemplate] = createReusableTemplate();
|
|
85
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.inputMenu || {} })({
|
|
272
86
|
color: color.value,
|
|
273
87
|
size: inputSize?.value,
|
|
274
88
|
loading: props.loading,
|
|
@@ -282,134 +96,123 @@ const b24ui = computed(() => inputMenu({
|
|
|
282
96
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
283
97
|
multiple: props.multiple,
|
|
284
98
|
buttonGroup: orientation.value
|
|
285
|
-
}))
|
|
286
|
-
|
|
287
|
-
function displayValue(value: T): string {
|
|
99
|
+
}));
|
|
100
|
+
function displayValue(value) {
|
|
288
101
|
if (!props.valueKey) {
|
|
289
|
-
return value && (typeof value ===
|
|
102
|
+
return value && (typeof value === "object" ? get(value, props.labelKey) : value);
|
|
290
103
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return item && (typeof item === 'object' ? get(item, props.labelKey as string) : item)
|
|
104
|
+
const item = items.value.find((item2) => compare(typeof item2 === "object" ? get(item2, props.valueKey) : item2, value));
|
|
105
|
+
return item && (typeof item === "object" ? get(item, props.labelKey) : item);
|
|
294
106
|
}
|
|
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
|
-
|
|
107
|
+
const groups = computed(
|
|
108
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
109
|
+
);
|
|
110
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
306
111
|
const filteredGroups = computed(() => {
|
|
307
112
|
if (props.ignoreFilter || !searchTerm.value) {
|
|
308
|
-
return groups.value
|
|
113
|
+
return groups.value;
|
|
309
114
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (typeof item !== 'object' || item === null) {
|
|
315
|
-
return contains(String(item), searchTerm.value)
|
|
115
|
+
const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey];
|
|
116
|
+
return groups.value.map((group) => group.filter((item) => {
|
|
117
|
+
if (typeof item !== "object" || item === null) {
|
|
118
|
+
return contains(String(item), searchTerm.value);
|
|
316
119
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return true
|
|
120
|
+
if (item.type && ["label", "separator"].includes(item.type)) {
|
|
121
|
+
return true;
|
|
320
122
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const filteredItems = computed(() => filteredGroups.value.flatMap(group => group))
|
|
328
|
-
|
|
123
|
+
return fields.some((field) => contains(get(item, field), searchTerm.value));
|
|
124
|
+
})).filter((group) => group.filter(
|
|
125
|
+
(item) => !isInputItem(item) || isInputItem(item) && (!item.type || !["label", "separator"].includes(item.type))
|
|
126
|
+
).length > 0);
|
|
127
|
+
});
|
|
128
|
+
const filteredItems = computed(() => filteredGroups.value.flatMap((group) => group));
|
|
329
129
|
const createItem = computed(() => {
|
|
330
130
|
if (!props.createItem || !searchTerm.value) {
|
|
331
|
-
return false
|
|
131
|
+
return false;
|
|
332
132
|
}
|
|
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)))
|
|
133
|
+
const newItem = props.valueKey ? { [props.valueKey]: searchTerm.value } : searchTerm.value;
|
|
134
|
+
if (typeof props.createItem === "object" && props.createItem.when === "always" || props.createItem === "always") {
|
|
135
|
+
return !filteredItems.value.find((item) => compare(item, newItem, String(props.valueKey)));
|
|
338
136
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
const inputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
|
|
345
|
-
|
|
137
|
+
return !filteredItems.value.length;
|
|
138
|
+
});
|
|
139
|
+
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
140
|
+
const inputRef = ref(null);
|
|
346
141
|
function autoFocus() {
|
|
347
142
|
if (props.autofocus) {
|
|
348
|
-
inputRef.value?.$el?.focus()
|
|
143
|
+
inputRef.value?.$el?.focus();
|
|
349
144
|
}
|
|
350
145
|
}
|
|
351
|
-
|
|
352
146
|
onMounted(() => {
|
|
353
147
|
setTimeout(() => {
|
|
354
|
-
autoFocus()
|
|
355
|
-
}, props.autofocusDelay)
|
|
356
|
-
})
|
|
357
|
-
|
|
358
|
-
function onUpdate(value: any) {
|
|
148
|
+
autoFocus();
|
|
149
|
+
}, props.autofocusDelay);
|
|
150
|
+
});
|
|
151
|
+
function onUpdate(value) {
|
|
359
152
|
if (toRaw(props.modelValue) === value) {
|
|
360
|
-
return
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const event = new Event("change", { target: { value } });
|
|
156
|
+
emits("change", event);
|
|
157
|
+
emitFormChange();
|
|
158
|
+
emitFormInput();
|
|
159
|
+
if (props.resetSearchTermOnSelect) {
|
|
160
|
+
searchTerm.value = "";
|
|
361
161
|
}
|
|
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
162
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
emitFormBlur()
|
|
163
|
+
function onBlur(event) {
|
|
164
|
+
emits("blur", event);
|
|
165
|
+
emitFormBlur();
|
|
372
166
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
emitFormFocus()
|
|
167
|
+
function onFocus(event) {
|
|
168
|
+
emits("focus", event);
|
|
169
|
+
emitFormFocus();
|
|
377
170
|
}
|
|
378
|
-
|
|
379
|
-
|
|
171
|
+
function onUpdateOpen(value) {
|
|
172
|
+
let timeoutId;
|
|
380
173
|
if (!value) {
|
|
381
|
-
const event = new FocusEvent(
|
|
382
|
-
emits(
|
|
383
|
-
emitFormBlur()
|
|
174
|
+
const event = new FocusEvent("blur");
|
|
175
|
+
emits("blur", event);
|
|
176
|
+
emitFormBlur();
|
|
177
|
+
if (props.resetSearchTermOnBlur) {
|
|
178
|
+
const STATE_ANIMATION_DELAY_MS = 100;
|
|
179
|
+
timeoutId = setTimeout(() => {
|
|
180
|
+
searchTerm.value = "";
|
|
181
|
+
}, STATE_ANIMATION_DELAY_MS);
|
|
182
|
+
}
|
|
384
183
|
} else {
|
|
385
|
-
const event = new FocusEvent(
|
|
386
|
-
emits(
|
|
184
|
+
const event = new FocusEvent("focus");
|
|
185
|
+
emits("focus", event);
|
|
186
|
+
emitFormFocus();
|
|
187
|
+
clearTimeout(timeoutId);
|
|
387
188
|
}
|
|
388
|
-
|
|
389
|
-
nextTick(() => {
|
|
390
|
-
searchTerm.value = ''
|
|
391
|
-
})
|
|
392
189
|
}
|
|
393
|
-
|
|
394
|
-
function onRemoveTag(event: any) {
|
|
190
|
+
function onRemoveTag(event) {
|
|
395
191
|
if (props.multiple) {
|
|
396
|
-
const modelValue = props.modelValue
|
|
397
|
-
const filteredValue = modelValue.filter(value => !isEqual(value, event))
|
|
398
|
-
emits(
|
|
399
|
-
onUpdate(filteredValue)
|
|
192
|
+
const modelValue = props.modelValue;
|
|
193
|
+
const filteredValue = modelValue.filter((value) => !isEqual(value, event));
|
|
194
|
+
emits("update:modelValue", filteredValue);
|
|
195
|
+
onUpdate(filteredValue);
|
|
400
196
|
}
|
|
401
197
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
198
|
+
function onSelect(e, item) {
|
|
199
|
+
if (!isInputItem(item)) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (item.disabled) {
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
item.onSelect?.(e);
|
|
207
|
+
}
|
|
208
|
+
function isInputItem(item) {
|
|
209
|
+
return typeof item === "object" && item !== null;
|
|
405
210
|
}
|
|
406
|
-
|
|
407
211
|
defineExpose({
|
|
408
212
|
inputRef
|
|
409
|
-
})
|
|
213
|
+
});
|
|
410
214
|
</script>
|
|
411
215
|
|
|
412
|
-
<!-- eslint-disable vue/no-template-shadow -->
|
|
413
216
|
<template>
|
|
414
217
|
<DefineCreateItemTemplate>
|
|
415
218
|
<ComboboxGroup :class="b24ui.group({ addNew: true, class: props.b24ui?.group })">
|
|
@@ -451,7 +254,7 @@ defineExpose({
|
|
|
451
254
|
<TagsInputRoot
|
|
452
255
|
v-if="multiple"
|
|
453
256
|
v-slot="{ modelValue: tags }"
|
|
454
|
-
:model-value="
|
|
257
|
+
:model-value="modelValue"
|
|
455
258
|
:disabled="disabled"
|
|
456
259
|
:required="required"
|
|
457
260
|
delimiter=""
|
|
@@ -460,15 +263,15 @@ defineExpose({
|
|
|
460
263
|
@focus="onFocus"
|
|
461
264
|
@remove-tag="onRemoveTag"
|
|
462
265
|
>
|
|
463
|
-
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="
|
|
266
|
+
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="b24ui.tagsItem({ class: props.b24ui?.tagsItem })">
|
|
464
267
|
<TagsInputItemText :class="b24ui.tagsItemText({ class: props.b24ui?.tagsItemText })">
|
|
465
|
-
<slot name="tags-item-text" :item="
|
|
466
|
-
{{ displayValue(item
|
|
268
|
+
<slot name="tags-item-text" :item="item" :index="index">
|
|
269
|
+
{{ displayValue(item) }}
|
|
467
270
|
</slot>
|
|
468
271
|
</TagsInputItemText>
|
|
469
272
|
|
|
470
273
|
<TagsInputItemDelete :class="b24ui.tagsItemDelete({ class: props.b24ui?.tagsItemDelete })" :disabled="disabled">
|
|
471
|
-
<slot name="tags-item-delete" :item="
|
|
274
|
+
<slot name="tags-item-delete" :item="item" :index="index">
|
|
472
275
|
<Component
|
|
473
276
|
:is="deleteIcon || icons.close"
|
|
474
277
|
:class="b24ui.tagsItemDeleteIcon({ class: props.b24ui?.tagsItemDeleteIcon })"
|
|
@@ -477,7 +280,7 @@ defineExpose({
|
|
|
477
280
|
</TagsInputItemDelete>
|
|
478
281
|
</TagsInputItem>
|
|
479
282
|
|
|
480
|
-
<ComboboxInput
|
|
283
|
+
<ComboboxInput v-model="searchTerm" as-child>
|
|
481
284
|
<TagsInputInput
|
|
482
285
|
ref="inputRef"
|
|
483
286
|
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
@@ -502,18 +305,18 @@ defineExpose({
|
|
|
502
305
|
/>
|
|
503
306
|
|
|
504
307
|
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
505
|
-
<slot name="leading" :model-value="
|
|
308
|
+
<slot name="leading" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
506
309
|
<Component
|
|
507
310
|
:is="leadingIconName"
|
|
508
311
|
v-if="isLeading && leadingIconName"
|
|
509
312
|
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
510
313
|
/>
|
|
511
|
-
<B24Avatar v-else-if="!!avatar" :size="
|
|
314
|
+
<B24Avatar v-else-if="!!avatar" :size="props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="avatar" :class="b24ui.itemLeadingAvatar({ class: props.b24ui?.itemLeadingAvatar })" />
|
|
512
315
|
</slot>
|
|
513
316
|
</span>
|
|
514
317
|
|
|
515
318
|
<ComboboxTrigger v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
516
|
-
<slot name="trailing" :model-value="
|
|
319
|
+
<slot name="trailing" :model-value="modelValue" :open="open" :b24ui="b24ui">
|
|
517
320
|
<Component
|
|
518
321
|
:is="trailingIconName"
|
|
519
322
|
v-if="trailingIconName"
|
|
@@ -537,29 +340,29 @@ defineExpose({
|
|
|
537
340
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
538
341
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
539
342
|
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
540
|
-
{{ get(item, props.labelKey
|
|
343
|
+
{{ get(item, props.labelKey) }}
|
|
541
344
|
</ComboboxLabel>
|
|
542
345
|
|
|
543
346
|
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
544
347
|
|
|
545
348
|
<ComboboxItem
|
|
546
349
|
v-else
|
|
547
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color :
|
|
350
|
+
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
548
351
|
:disabled="isInputItem(item) && item.disabled"
|
|
549
352
|
:value="props.valueKey && isInputItem(item) ? get(item, String(props.valueKey)) : item"
|
|
550
|
-
@select="
|
|
353
|
+
@select="onSelect($event, item)"
|
|
551
354
|
>
|
|
552
|
-
<slot name="item" :item="
|
|
553
|
-
<slot name="item-leading" :item="
|
|
355
|
+
<slot name="item" :item="item" :index="index">
|
|
356
|
+
<slot name="item-leading" :item="item" :index="index">
|
|
554
357
|
<Component
|
|
555
358
|
:is="item.icon"
|
|
556
359
|
v-if="isInputItem(item) && item.icon"
|
|
557
360
|
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
558
361
|
/>
|
|
559
|
-
<B24Avatar v-else-if="isInputItem(item) && item.avatar" :size="
|
|
362
|
+
<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
363
|
<B24Chip
|
|
561
364
|
v-else-if="isInputItem(item) && item.chip"
|
|
562
|
-
:size="
|
|
365
|
+
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
563
366
|
inset
|
|
564
367
|
standalone
|
|
565
368
|
v-bind="item.chip"
|
|
@@ -568,18 +371,18 @@ defineExpose({
|
|
|
568
371
|
</slot>
|
|
569
372
|
|
|
570
373
|
<span :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
571
|
-
<slot name="item-label" :item="
|
|
572
|
-
{{ isInputItem(item) ? get(item, props.labelKey
|
|
374
|
+
<slot name="item-label" :item="item" :index="index">
|
|
375
|
+
{{ isInputItem(item) ? get(item, props.labelKey) : item }}
|
|
573
376
|
</slot>
|
|
574
377
|
</span>
|
|
575
378
|
|
|
576
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color :
|
|
577
|
-
<slot name="item-trailing" :item="
|
|
379
|
+
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color : void 0 })">
|
|
380
|
+
<slot name="item-trailing" :item="item" :index="index" />
|
|
578
381
|
|
|
579
382
|
<ComboboxItemIndicator as-child>
|
|
580
383
|
<Component
|
|
581
384
|
:is="selectedIcon || icons.check"
|
|
582
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color :
|
|
385
|
+
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
583
386
|
/>
|
|
584
387
|
</ComboboxItemIndicator>
|
|
585
388
|
</span>
|