@bitrix24/b24ui-nuxt 0.6.7 → 0.7.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/accordion.ts +20 -0
- package/.nuxt/b24ui/advice.ts +2 -10
- package/.nuxt/b24ui/alert.ts +2 -15
- package/.nuxt/b24ui/avatar-group.ts +2 -10
- package/.nuxt/b24ui/avatar.ts +3 -11
- package/.nuxt/b24ui/badge.ts +48 -13
- package/.nuxt/b24ui/button-group.ts +2 -22
- package/.nuxt/b24ui/button.ts +4 -17
- package/.nuxt/b24ui/calendar.ts +3 -11
- package/.nuxt/b24ui/checkbox.ts +75 -11
- package/.nuxt/b24ui/chip.ts +2 -10
- package/.nuxt/b24ui/collapsible.ts +2 -10
- package/.nuxt/b24ui/container.ts +2 -10
- package/.nuxt/b24ui/countdown.ts +2 -10
- package/.nuxt/b24ui/description-list.ts +2 -15
- package/.nuxt/b24ui/dropdown-menu.ts +4 -11
- package/.nuxt/b24ui/form-field.ts +3 -10
- package/.nuxt/b24ui/form.ts +2 -10
- package/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/input-menu.ts +6 -30
- package/.nuxt/b24ui/input-number.ts +15 -10
- package/.nuxt/b24ui/input.ts +4 -17
- package/.nuxt/b24ui/kbd.ts +2 -10
- package/.nuxt/b24ui/link.ts +11 -17
- package/.nuxt/b24ui/modal.ts +3 -11
- package/.nuxt/b24ui/navbar-divider.ts +2 -10
- package/.nuxt/b24ui/navbar-section.ts +2 -10
- package/.nuxt/b24ui/navbar-spacer.ts +2 -10
- package/.nuxt/b24ui/navbar.ts +2 -10
- package/.nuxt/b24ui/navigation-menu.ts +69 -60
- package/.nuxt/b24ui/popover.ts +2 -10
- package/.nuxt/b24ui/progress.ts +2 -10
- package/.nuxt/b24ui/radio-group.ts +3 -11
- package/.nuxt/b24ui/range.ts +2 -10
- package/.nuxt/b24ui/select-menu.ts +10 -40
- package/.nuxt/b24ui/select.ts +10 -40
- package/.nuxt/b24ui/separator.ts +2 -10
- package/.nuxt/b24ui/sidebar-body.ts +2 -10
- package/.nuxt/b24ui/sidebar-footer.ts +2 -10
- package/.nuxt/b24ui/sidebar-header.ts +2 -10
- package/.nuxt/b24ui/sidebar-heading.ts +2 -10
- package/.nuxt/b24ui/sidebar-layout.ts +2 -10
- package/.nuxt/b24ui/sidebar-section.ts +2 -10
- package/.nuxt/b24ui/sidebar-spacer.ts +2 -10
- package/.nuxt/b24ui/sidebar.ts +2 -10
- package/.nuxt/b24ui/skeleton.ts +2 -10
- package/.nuxt/b24ui/slideover.ts +2 -10
- package/.nuxt/b24ui/stacked-layout.ts +2 -10
- package/.nuxt/b24ui/switch.ts +2 -10
- package/.nuxt/b24ui/tabs.ts +6 -13
- package/.nuxt/b24ui/textarea.ts +4 -17
- package/.nuxt/b24ui/toast.ts +2 -15
- package/.nuxt/b24ui/toaster.ts +3 -11
- package/.nuxt/b24ui/tooltip.ts +3 -11
- package/.nuxt/b24ui.css +1 -1
- package/cli/templates.mjs +2 -2
- package/dist/meta.d.mts +38368 -18666
- package/dist/meta.mjs +38368 -18666
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -3
- package/dist/runtime/components/Accordion.vue +96 -0
- package/dist/runtime/components/Accordion.vue.d.ts +78 -0
- package/dist/runtime/components/Advice.vue +1 -1
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Avatar.vue +11 -3
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/AvatarGroup.vue +1 -1
- package/dist/runtime/components/Badge.vue +5 -3
- package/dist/runtime/components/Badge.vue.d.ts +2 -0
- package/dist/runtime/components/Button.vue +2 -3
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +6 -2
- package/dist/runtime/components/Checkbox.vue +14 -5
- package/dist/runtime/components/Checkbox.vue.d.ts +9 -0
- package/dist/runtime/components/Chip.vue +1 -1
- package/dist/runtime/components/Collapsible.vue +1 -1
- package/dist/runtime/components/Countdown.vue +1 -1
- package/dist/runtime/components/Countdown.vue.d.ts +2 -2
- package/dist/runtime/components/DescriptionList.vue +3 -2
- package/dist/runtime/components/DescriptionList.vue.d.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
- package/dist/runtime/components/DropdownMenuContent.vue +74 -72
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/Form.vue.d.ts +12 -11
- package/dist/runtime/components/FormField.vue +4 -4
- package/dist/runtime/components/Input.vue +12 -8
- package/dist/runtime/components/Input.vue.d.ts +31 -30
- package/dist/runtime/components/InputMenu.vue +23 -20
- package/dist/runtime/components/InputMenu.vue.d.ts +214 -4
- package/dist/runtime/components/InputNumber.vue +17 -10
- package/dist/runtime/components/InputNumber.vue.d.ts +80 -3
- package/dist/runtime/components/Link.vue +5 -13
- package/dist/runtime/components/Modal.vue +22 -14
- package/dist/runtime/components/Modal.vue.d.ts +18 -5
- package/dist/runtime/components/Navbar.vue +1 -1
- package/dist/runtime/components/NavbarDivider.vue +1 -1
- package/dist/runtime/components/NavbarSection.vue +1 -1
- package/dist/runtime/components/NavbarSpacer.vue +1 -1
- package/dist/runtime/components/NavigationMenu.vue +186 -44
- package/dist/runtime/components/NavigationMenu.vue.d.ts +39 -8
- package/dist/runtime/components/OverlayProvider.vue +2 -2
- package/dist/runtime/components/Popover.vue +4 -0
- package/dist/runtime/components/Popover.vue.d.ts +2 -1
- package/dist/runtime/components/Progress.vue +3 -2
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +26 -10
- package/dist/runtime/components/RadioGroup.vue.d.ts +3 -1
- package/dist/runtime/components/Range.vue +2 -2
- package/dist/runtime/components/Range.vue.d.ts +19 -20
- package/dist/runtime/components/Select.vue +57 -31
- package/dist/runtime/components/Select.vue.d.ts +110 -2
- package/dist/runtime/components/SelectMenu.vue +77 -23
- package/dist/runtime/components/SelectMenu.vue.d.ts +111 -5
- package/dist/runtime/components/Separator.vue +3 -3
- package/dist/runtime/components/Sidebar.vue +1 -1
- package/dist/runtime/components/SidebarBody.vue +1 -1
- package/dist/runtime/components/SidebarFooter.vue +1 -1
- package/dist/runtime/components/SidebarHeader.vue +1 -1
- package/dist/runtime/components/SidebarHeading.vue +1 -1
- package/dist/runtime/components/SidebarLayout.vue +1 -1
- package/dist/runtime/components/SidebarSection.vue +1 -1
- package/dist/runtime/components/SidebarSpacer.vue +1 -1
- package/dist/runtime/components/Slideover.vue +23 -15
- package/dist/runtime/components/Slideover.vue.d.ts +18 -5
- package/dist/runtime/components/StackedLayout.vue +1 -1
- package/dist/runtime/components/Switch.vue +1 -1
- package/dist/runtime/components/Tabs.vue +28 -7
- package/dist/runtime/components/Tabs.vue.d.ts +6 -1
- package/dist/runtime/components/Textarea.vue +13 -9
- package/dist/runtime/components/Textarea.vue.d.ts +31 -30
- package/dist/runtime/components/Toast.vue +7 -6
- package/dist/runtime/components/Toast.vue.d.ts +6 -0
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Toaster.vue.d.ts +6 -0
- package/dist/runtime/components/Tooltip.vue +9 -2
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -1
- package/dist/runtime/components/content/TableWrapper.vue +1 -1
- package/dist/runtime/composables/defineLocale.d.ts +2 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +8 -2
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/composables/useKbd.d.ts +1 -0
- package/dist/runtime/composables/useKbd.js +4 -3
- package/dist/runtime/composables/useOverlay.d.ts +11 -11
- package/dist/runtime/composables/useOverlay.js +17 -11
- package/dist/runtime/inertia/components/Link.vue +45 -60
- package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
- package/dist/runtime/inertia/components/LinkBase.vue +68 -0
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/inertia/stubs.js +1 -1
- package/dist/runtime/prose/A.vue +1 -1
- package/dist/runtime/prose/Blockquote.vue +1 -1
- package/dist/runtime/prose/Code.vue +1 -1
- package/dist/runtime/prose/Em.vue +1 -1
- package/dist/runtime/prose/H1.vue +1 -1
- package/dist/runtime/prose/H2.vue +1 -1
- package/dist/runtime/prose/H3.vue +1 -1
- package/dist/runtime/prose/H4.vue +1 -1
- package/dist/runtime/prose/H5.vue +1 -1
- package/dist/runtime/prose/H6.vue +1 -1
- package/dist/runtime/prose/Hr.vue +1 -1
- package/dist/runtime/prose/Img.vue +1 -1
- package/dist/runtime/prose/Li.vue +1 -1
- package/dist/runtime/prose/Ol.vue +1 -1
- package/dist/runtime/prose/P.vue +1 -1
- package/dist/runtime/prose/Pre.vue +1 -1
- package/dist/runtime/prose/Strong.vue +1 -1
- package/dist/runtime/prose/Table.vue +1 -1
- package/dist/runtime/prose/Tbody.vue +1 -1
- package/dist/runtime/prose/Td.vue +1 -1
- package/dist/runtime/prose/Th.vue +1 -1
- package/dist/runtime/prose/Thead.vue +1 -1
- package/dist/runtime/prose/Tr.vue +1 -1
- package/dist/runtime/prose/Ul.vue +1 -1
- package/dist/runtime/types/form.d.ts +11 -10
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +1 -0
- package/dist/runtime/types/tv.d.ts +53 -0
- package/dist/runtime/types/tv.js +0 -0
- package/dist/runtime/types/utils.d.ts +4 -51
- package/dist/runtime/types/utils.js +1 -0
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +12 -0
- package/dist/runtime/vue/components/Link.vue +26 -40
- package/dist/runtime/vue/composables/useAppConfig.js +3 -1
- package/dist/runtime/vue/stubs.d.ts +1 -1
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{b24ui-nuxt.jU270f-Q.mjs → b24ui-nuxt.C-kZb5Ac.mjs} +267 -121
- package/dist/unplugin.d.mts +2 -2
- package/dist/unplugin.mjs +6 -3
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +41 -40
|
@@ -67,48 +67,48 @@ const groups = computed(
|
|
|
67
67
|
<Component
|
|
68
68
|
:is="icons.loading"
|
|
69
69
|
v-if="item.loading"
|
|
70
|
-
:class="b24ui.itemLeadingIcon({ class: b24uiOverride?.itemLeadingIcon, color: item?.color, loading: true })"
|
|
70
|
+
:class="b24ui.itemLeadingIcon({ class: [b24uiOverride?.itemLeadingIcon, item.b24ui?.itemLeadingIcon], color: item?.color, loading: true })"
|
|
71
71
|
/>
|
|
72
72
|
<Component
|
|
73
73
|
:is="item.icon"
|
|
74
74
|
v-else-if="item.icon"
|
|
75
|
-
:class="b24ui.itemLeadingIcon({ class: b24uiOverride?.itemLeadingIcon, color: item?.color, active })"
|
|
75
|
+
:class="b24ui.itemLeadingIcon({ class: [b24uiOverride?.itemLeadingIcon, item.b24ui?.itemLeadingIcon], color: item?.color, active })"
|
|
76
76
|
/>
|
|
77
77
|
<B24Avatar
|
|
78
78
|
v-else-if="item.avatar"
|
|
79
|
-
:size="props.b24uiOverride?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()"
|
|
79
|
+
:size="item.b24ui?.itemLeadingAvatarSize || props.b24uiOverride?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()"
|
|
80
80
|
v-bind="item.avatar"
|
|
81
|
-
:class="b24ui.itemLeadingAvatar({ class: b24uiOverride?.itemLeadingAvatar, active })"
|
|
81
|
+
:class="b24ui.itemLeadingAvatar({ class: [b24uiOverride?.itemLeadingAvatar, item.b24ui?.itemLeadingAvatar], active })"
|
|
82
82
|
/>
|
|
83
83
|
</slot>
|
|
84
84
|
|
|
85
|
-
<span v-if="getLabel(item) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="b24ui.itemLabel({ class: b24uiOverride?.itemLabel, active })">
|
|
85
|
+
<span v-if="getLabel(item) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="b24ui.itemLabel({ class: [b24uiOverride?.itemLabel, item.b24ui?.itemLabel], active })">
|
|
86
86
|
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
|
|
87
87
|
{{ getLabel(item) }}
|
|
88
88
|
</slot>
|
|
89
89
|
<Component
|
|
90
90
|
:is="typeof externalIcon !== 'boolean' ? externalIcon : icons.external"
|
|
91
91
|
v-if="item.target === '_blank' && externalIcon !== false"
|
|
92
|
-
:class="b24ui.itemLabelExternalIcon({ class: b24uiOverride?.itemLabelExternalIcon, color: item?.color, active })"
|
|
92
|
+
:class="b24ui.itemLabelExternalIcon({ class: [b24uiOverride?.itemLabelExternalIcon, item.b24ui?.itemLabelExternalIcon], color: item?.color, active })"
|
|
93
93
|
/>
|
|
94
94
|
</span>
|
|
95
95
|
|
|
96
|
-
<span :class="b24ui.itemTrailing({ class: b24uiOverride?.itemTrailing })">
|
|
96
|
+
<span :class="b24ui.itemTrailing({ class: [b24uiOverride?.itemTrailing, item.b24ui?.itemTrailing] })">
|
|
97
97
|
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
|
|
98
98
|
<Component
|
|
99
99
|
:is="childrenIcon"
|
|
100
100
|
v-if="item.children?.length"
|
|
101
|
-
:class="b24ui.itemTrailingIcon({ class: b24uiOverride?.itemTrailingIcon, color: item?.color, active })"
|
|
101
|
+
:class="b24ui.itemTrailingIcon({ class: [b24uiOverride?.itemTrailingIcon, item.b24ui?.itemTrailingIcon], color: item?.color, active })"
|
|
102
102
|
/>
|
|
103
|
-
<span v-else-if="item.kbds?.length" :class="b24ui.itemTrailingKbds({ class: b24uiOverride?.itemTrailingKbds })">
|
|
104
|
-
<B24Kbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="props.b24uiOverride?.itemTrailingKbdsSize || b24ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
103
|
+
<span v-else-if="item.kbds?.length" :class="b24ui.itemTrailingKbds({ class: [b24uiOverride?.itemTrailingKbds, item.b24ui?.itemTrailingKbds] })">
|
|
104
|
+
<B24Kbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="item.b24ui?.itemTrailingKbdsSize || props.b24uiOverride?.itemTrailingKbdsSize || b24ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
105
105
|
</span>
|
|
106
106
|
</slot>
|
|
107
107
|
|
|
108
108
|
<DropdownMenu.ItemIndicator as-child>
|
|
109
109
|
<Component
|
|
110
110
|
:is="checkedIcon || icons.check"
|
|
111
|
-
:class="b24ui.itemTrailingIcon({ class: b24uiOverride?.itemTrailingIcon, color: item?.color })"
|
|
111
|
+
:class="b24ui.itemTrailingIcon({ class: [b24uiOverride?.itemTrailingIcon, item.b24ui?.itemTrailingIcon], color: item?.color })"
|
|
112
112
|
/>
|
|
113
113
|
</DropdownMenu.ItemIndicator>
|
|
114
114
|
</span>
|
|
@@ -119,72 +119,74 @@ const groups = computed(
|
|
|
119
119
|
<component :is="sub ? DropdownMenu.SubContent : DropdownMenu.Content" :class="props.class" v-bind="contentProps">
|
|
120
120
|
<slot name="content-top" />
|
|
121
121
|
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<DropdownMenu.
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
<div role="presentation" :class="b24ui.viewport({ class: props.b24ui?.viewport })">
|
|
123
|
+
<DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: b24uiOverride?.group })">
|
|
124
|
+
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
125
|
+
<DropdownMenu.Label v-if="item.type === 'label'" :class="b24ui.label({ class: [b24uiOverride?.label, item.b24ui?.label, item.class] })">
|
|
126
|
+
<ReuseItemTemplate :item="item" :index="index" />
|
|
127
|
+
</DropdownMenu.Label>
|
|
128
|
+
<DropdownMenu.Separator v-else-if="item.type === 'separator'" :class="b24ui.separator({ class: [b24uiOverride?.separator, item.b24ui?.separator, item.class] })" />
|
|
129
|
+
<DropdownMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
|
130
|
+
<DropdownMenu.SubTrigger
|
|
131
|
+
as="button"
|
|
132
|
+
type="button"
|
|
133
|
+
:disabled="item.disabled"
|
|
134
|
+
:text-value="getLabel(item)"
|
|
135
|
+
:class="b24ui.item({ class: [b24uiOverride?.item, item.b24ui?.item, item.class], color: item?.color })"
|
|
136
|
+
>
|
|
137
|
+
<ReuseItemTemplate :item="item" :index="index" />
|
|
138
|
+
</DropdownMenu.SubTrigger>
|
|
139
|
+
|
|
140
|
+
<B24DropdownMenuContent
|
|
141
|
+
sub
|
|
142
|
+
:class="props.class"
|
|
143
|
+
:b24ui="b24ui"
|
|
144
|
+
:b24ui-override="b24uiOverride"
|
|
145
|
+
:portal="portal"
|
|
146
|
+
:items="item.children"
|
|
147
|
+
align="start"
|
|
148
|
+
:align-offset="-4"
|
|
149
|
+
:side-offset="3"
|
|
150
|
+
:label-key="labelKey"
|
|
151
|
+
:checked-icon="checkedIcon"
|
|
152
|
+
:external-icon="externalIcon"
|
|
153
|
+
v-bind="item.content"
|
|
154
|
+
>
|
|
155
|
+
<template v-for="(_, name) in proxySlots" #[name]="slotData">
|
|
156
|
+
<slot :name="name" v-bind="slotData" />
|
|
157
|
+
</template>
|
|
158
|
+
</B24DropdownMenuContent>
|
|
159
|
+
</DropdownMenu.Sub>
|
|
160
|
+
<DropdownMenu.CheckboxItem
|
|
161
|
+
v-else-if="item.type === 'checkbox'"
|
|
162
|
+
:model-value="item.checked"
|
|
132
163
|
:disabled="item.disabled"
|
|
133
164
|
:text-value="getLabel(item)"
|
|
134
|
-
:class="b24ui.item({ class: b24uiOverride?.item, color: item?.color })"
|
|
165
|
+
:class="b24ui.item({ class: [b24uiOverride?.item, item.b24ui?.item, item.class], color: item?.color })"
|
|
166
|
+
@update:model-value="item.onUpdateChecked"
|
|
167
|
+
@select="item.onSelect"
|
|
135
168
|
>
|
|
136
169
|
<ReuseItemTemplate :item="item" :index="index" />
|
|
137
|
-
</DropdownMenu.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
:
|
|
142
|
-
:
|
|
143
|
-
|
|
144
|
-
:portal="portal"
|
|
145
|
-
:items="item.children"
|
|
146
|
-
align="start"
|
|
147
|
-
:align-offset="-4"
|
|
148
|
-
:side-offset="3"
|
|
149
|
-
:label-key="labelKey"
|
|
150
|
-
:checked-icon="checkedIcon"
|
|
151
|
-
:external-icon="externalIcon"
|
|
152
|
-
v-bind="item.content"
|
|
170
|
+
</DropdownMenu.CheckboxItem>
|
|
171
|
+
<DropdownMenu.Item
|
|
172
|
+
v-else
|
|
173
|
+
as-child
|
|
174
|
+
:disabled="item.disabled"
|
|
175
|
+
:text-value="getLabel(item)"
|
|
176
|
+
@select="item.onSelect"
|
|
153
177
|
>
|
|
154
|
-
<
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
@select="item.onSelect"
|
|
167
|
-
>
|
|
168
|
-
<ReuseItemTemplate :item="item" :index="index" />
|
|
169
|
-
</DropdownMenu.CheckboxItem>
|
|
170
|
-
<DropdownMenu.Item
|
|
171
|
-
v-else
|
|
172
|
-
as-child
|
|
173
|
-
:disabled="item.disabled"
|
|
174
|
-
:text-value="getLabel(item)"
|
|
175
|
-
@select="item.onSelect"
|
|
176
|
-
>
|
|
177
|
-
<B24Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
178
|
-
<B24LinkBase
|
|
179
|
-
v-bind="slotProps"
|
|
180
|
-
:class="b24ui.item({ class: [b24uiOverride?.item, item.class], color: item?.color, active })"
|
|
181
|
-
>
|
|
182
|
-
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
183
|
-
</B24LinkBase>
|
|
184
|
-
</B24Link>
|
|
185
|
-
</DropdownMenu.Item>
|
|
186
|
-
</template>
|
|
187
|
-
</DropdownMenu.Group>
|
|
178
|
+
<B24Link v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
179
|
+
<B24LinkBase
|
|
180
|
+
v-bind="slotProps"
|
|
181
|
+
:class="b24ui.item({ class: [b24uiOverride?.item, item.b24ui?.item, item.class], color: item?.color, active })"
|
|
182
|
+
>
|
|
183
|
+
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
|
184
|
+
</B24LinkBase>
|
|
185
|
+
</B24Link>
|
|
186
|
+
</DropdownMenu.Item>
|
|
187
|
+
</template>
|
|
188
|
+
</DropdownMenu.Group>
|
|
189
|
+
</div>
|
|
188
190
|
|
|
189
191
|
<slot />
|
|
190
192
|
|
|
@@ -30,31 +30,15 @@ type DropdownMenuContentSlots<T extends ArrayOrNested<DropdownMenuItem>> = Omit<
|
|
|
30
30
|
declare const _default: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
31
31
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
32
32
|
readonly onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
|
|
33
|
-
readonly onPointerDownOutside?: ((event:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
readonly onFocusOutside?: ((event: CustomEvent<{
|
|
37
|
-
originalEvent: FocusEvent;
|
|
38
|
-
}>) => any) | undefined;
|
|
39
|
-
readonly onInteractOutside?: ((event: CustomEvent<{
|
|
40
|
-
originalEvent: PointerEvent;
|
|
41
|
-
}> | CustomEvent<{
|
|
42
|
-
originalEvent: FocusEvent;
|
|
43
|
-
}>) => any) | undefined;
|
|
33
|
+
readonly onPointerDownOutside?: ((event: import("reka-ui").PointerDownOutsideEvent) => any) | undefined;
|
|
34
|
+
readonly onFocusOutside?: ((event: import("reka-ui").FocusOutsideEvent) => any) | undefined;
|
|
35
|
+
readonly onInteractOutside?: ((event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => any) | undefined;
|
|
44
36
|
readonly onCloseAutoFocus?: ((event: Event) => any) | undefined;
|
|
45
37
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "onCloseAutoFocus"> & DropdownMenuContentProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
46
38
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
47
39
|
attrs: any;
|
|
48
40
|
slots: DropdownMenuContentSlots<T>;
|
|
49
|
-
emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event:
|
|
50
|
-
originalEvent: PointerEvent;
|
|
51
|
-
}>) => void) & ((evt: "focusOutside", event: CustomEvent<{
|
|
52
|
-
originalEvent: FocusEvent;
|
|
53
|
-
}>) => void) & ((evt: "interactOutside", event: CustomEvent<{
|
|
54
|
-
originalEvent: PointerEvent;
|
|
55
|
-
}> | CustomEvent<{
|
|
56
|
-
originalEvent: FocusEvent;
|
|
57
|
-
}>) => void) & ((evt: "closeAutoFocus", event: Event) => void);
|
|
41
|
+
emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event: import("reka-ui").PointerDownOutsideEvent) => void) & ((evt: "focusOutside", event: import("reka-ui").FocusOutsideEvent) => void) & ((evt: "interactOutside", event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => void) & ((evt: "closeAutoFocus", event: Event) => void);
|
|
58
42
|
}>) => import("vue").VNode & {
|
|
59
43
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
60
44
|
};
|
|
@@ -3,7 +3,7 @@ import theme from "#build/b24ui/form";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed, useId, readonly } from "vue";
|
|
6
|
+
import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed, useId, readonly, reactive } from "vue";
|
|
7
7
|
import { useEventBus } from "@vueuse/core";
|
|
8
8
|
import { useAppConfig } from "#imports";
|
|
9
9
|
import { formOptionsInjectionKey, formInputsInjectionKey, formBusInjectionKey, formLoadingInjectionKey } from "../composables/useFormField";
|
|
@@ -20,7 +20,7 @@ const props = defineProps({
|
|
|
20
20
|
} },
|
|
21
21
|
disabled: { type: Boolean, required: false },
|
|
22
22
|
validateOnInputDelay: { type: Number, required: false, default: 300 },
|
|
23
|
-
transform: { type:
|
|
23
|
+
transform: { type: null, required: false, default: () => true },
|
|
24
24
|
attach: { type: Boolean, required: false, default: true },
|
|
25
25
|
loadingAuto: { type: Boolean, required: false, default: true },
|
|
26
26
|
class: { type: null, required: false },
|
|
@@ -80,9 +80,9 @@ const errors = ref([]);
|
|
|
80
80
|
provide("form-errors", errors);
|
|
81
81
|
const inputs = ref({});
|
|
82
82
|
provide(formInputsInjectionKey, inputs);
|
|
83
|
-
const dirtyFields = /* @__PURE__ */ new Set();
|
|
84
|
-
const touchedFields = /* @__PURE__ */ new Set();
|
|
85
|
-
const blurredFields = /* @__PURE__ */ new Set();
|
|
83
|
+
const dirtyFields = reactive(/* @__PURE__ */ new Set());
|
|
84
|
+
const touchedFields = reactive(/* @__PURE__ */ new Set());
|
|
85
|
+
const blurredFields = reactive(/* @__PURE__ */ new Set());
|
|
86
86
|
function resolveErrorIds(errs) {
|
|
87
87
|
return errs.map((err) => ({
|
|
88
88
|
...err,
|
|
@@ -205,6 +205,6 @@ defineExpose({
|
|
|
205
205
|
:class="b24ui({ class: props.class })"
|
|
206
206
|
@submit.prevent="onSubmitWrapper"
|
|
207
207
|
>
|
|
208
|
-
<slot :errors="errors" />
|
|
208
|
+
<slot :errors="errors" :loading="loading" />
|
|
209
209
|
</component>
|
|
210
210
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, Form, InferInput,
|
|
2
|
-
export interface FormProps<S extends FormSchema> {
|
|
1
|
+
import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, Form, InferInput, FormData } from '../types/form';
|
|
2
|
+
export interface FormProps<S extends FormSchema, T extends boolean = true> {
|
|
3
3
|
id?: string | number;
|
|
4
4
|
/** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */
|
|
5
5
|
schema?: S;
|
|
@@ -27,7 +27,7 @@ export interface FormProps<S extends FormSchema> {
|
|
|
27
27
|
* If true, schema transformations will be applied to the state on submit.
|
|
28
28
|
* @defaultValue `true`
|
|
29
29
|
*/
|
|
30
|
-
transform?:
|
|
30
|
+
transform?: T;
|
|
31
31
|
/**
|
|
32
32
|
* If true, this form will attach to its parent Form (if any) and validate at the same time.
|
|
33
33
|
* @defaultValue `true`
|
|
@@ -40,26 +40,27 @@ export interface FormProps<S extends FormSchema> {
|
|
|
40
40
|
*/
|
|
41
41
|
loadingAuto?: boolean;
|
|
42
42
|
class?: any;
|
|
43
|
-
onSubmit?: ((event: FormSubmitEvent<
|
|
43
|
+
onSubmit?: ((event: FormSubmitEvent<FormData<S, T>>) => void | Promise<void>) | (() => void | Promise<void>);
|
|
44
44
|
}
|
|
45
|
-
export interface FormEmits<S extends FormSchema> {
|
|
46
|
-
(e: 'submit', payload: FormSubmitEvent<
|
|
45
|
+
export interface FormEmits<S extends FormSchema, T extends boolean = true> {
|
|
46
|
+
(e: 'submit', payload: FormSubmitEvent<FormData<S, T>>): void;
|
|
47
47
|
(e: 'error', payload: FormErrorEvent): void;
|
|
48
48
|
}
|
|
49
49
|
export interface FormSlots {
|
|
50
50
|
default(props?: {
|
|
51
51
|
errors: FormError[];
|
|
52
|
+
loading: boolean;
|
|
52
53
|
}): any;
|
|
53
54
|
}
|
|
54
|
-
declare const _default: <S extends FormSchema>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
55
|
+
declare const _default: <S extends FormSchema, T extends boolean = true>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
55
56
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
56
57
|
readonly onError?: ((payload: FormErrorEvent) => any) | undefined;
|
|
57
|
-
readonly onSubmit?: ((payload: FormSubmitEvent<
|
|
58
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "
|
|
59
|
-
expose(exposed: import("vue").ShallowUnwrapRef<Form<
|
|
58
|
+
readonly onSubmit?: ((payload: FormSubmitEvent<FormData<S, T>>) => any) | undefined;
|
|
59
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSubmit" | "onError"> & FormProps<S, T> & Partial<{}>> & import("vue").PublicProps;
|
|
60
|
+
expose(exposed: import("vue").ShallowUnwrapRef<Form<S>>): void;
|
|
60
61
|
attrs: any;
|
|
61
62
|
slots: FormSlots;
|
|
62
|
-
emit: FormEmits<S>;
|
|
63
|
+
emit: FormEmits<S, T>;
|
|
63
64
|
}>) => import("vue").VNode & {
|
|
64
65
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
65
66
|
};
|
|
@@ -52,7 +52,7 @@ provide(formFieldInjectionKey, computed(() => ({
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<template>
|
|
55
|
-
<Primitive :as="as" :class="b24ui.root({ class: [props.
|
|
55
|
+
<Primitive :as="as" :class="b24ui.root({ class: [props.b24ui?.root, props.class] })">
|
|
56
56
|
<div :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
|
|
57
57
|
<div v-if="label || !!slots.label" :class="b24ui.labelWrapper({ class: props.b24ui?.labelWrapper })">
|
|
58
58
|
<Label :for="id" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
@@ -79,17 +79,17 @@ provide(formFieldInjectionKey, computed(() => ({
|
|
|
79
79
|
|
|
80
80
|
<div v-if="typeof error === 'string' && error || !!slots.error" :id="`${ariaId}-error`" :class="b24ui.error({ class: props.b24ui?.error })">
|
|
81
81
|
<slot name="error" :error="error">
|
|
82
|
-
<div class="
|
|
82
|
+
<div :class="b24ui.errorWrapper({ class: props.b24ui?.errorWrapper })">
|
|
83
83
|
<WarningIcon :class="b24ui.errorIcon()" />
|
|
84
84
|
<div>{{ error }}</div>
|
|
85
85
|
</div>
|
|
86
86
|
</slot>
|
|
87
87
|
</div>
|
|
88
|
-
<
|
|
88
|
+
<div v-else-if="help || !!slots.help" :class="b24ui.help({ class: props.b24ui?.help })">
|
|
89
89
|
<slot name="help" :help="help">
|
|
90
90
|
{{ help }}
|
|
91
91
|
</slot>
|
|
92
|
-
</
|
|
92
|
+
</div>
|
|
93
93
|
</div>
|
|
94
94
|
</Primitive>
|
|
95
95
|
</template>
|
|
@@ -5,6 +5,7 @@ import theme from "#build/b24ui/input";
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { ref, computed, onMounted } from "vue";
|
|
7
7
|
import { Primitive } from "reka-ui";
|
|
8
|
+
import { useVModel } from "@vueuse/core";
|
|
8
9
|
import { useAppConfig } from "#imports";
|
|
9
10
|
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
10
11
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
@@ -33,6 +34,9 @@ const props = defineProps({
|
|
|
33
34
|
tag: { type: String, required: false },
|
|
34
35
|
tagColor: { type: null, required: false },
|
|
35
36
|
highlight: { type: Boolean, required: false },
|
|
37
|
+
modelValue: { type: null, required: false },
|
|
38
|
+
defaultValue: { type: null, required: false },
|
|
39
|
+
modelModifiers: { type: Object, required: false },
|
|
36
40
|
class: { type: null, required: false },
|
|
37
41
|
b24ui: { type: null, required: false },
|
|
38
42
|
icon: { type: [Function, Object], required: false },
|
|
@@ -43,7 +47,7 @@ const props = defineProps({
|
|
|
43
47
|
});
|
|
44
48
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
45
49
|
const slots = defineSlots();
|
|
46
|
-
const
|
|
50
|
+
const modelValue = useVModel(props, "modelValue", emits, { defaultValue: props.defaultValue });
|
|
47
51
|
const appConfig = useAppConfig();
|
|
48
52
|
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField(props, { deferInputValidation: true });
|
|
49
53
|
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
@@ -69,29 +73,29 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.input |
|
|
|
69
73
|
}));
|
|
70
74
|
const inputRef = ref(null);
|
|
71
75
|
function updateInput(value) {
|
|
72
|
-
if (modelModifiers
|
|
76
|
+
if (props.modelModifiers?.trim) {
|
|
73
77
|
value = value?.trim() ?? null;
|
|
74
78
|
}
|
|
75
|
-
if (modelModifiers
|
|
79
|
+
if (props.modelModifiers?.number || props.type === "number") {
|
|
76
80
|
value = looseToNumber(value);
|
|
77
81
|
}
|
|
78
|
-
if (modelModifiers
|
|
82
|
+
if (props.modelModifiers?.nullify) {
|
|
79
83
|
value ||= null;
|
|
80
84
|
}
|
|
81
85
|
modelValue.value = value;
|
|
82
86
|
emitFormInput();
|
|
83
87
|
}
|
|
84
88
|
function onInput(event) {
|
|
85
|
-
if (!modelModifiers
|
|
89
|
+
if (!props.modelModifiers?.lazy) {
|
|
86
90
|
updateInput(event.target.value);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
function onChange(event) {
|
|
90
94
|
const value = event.target.value;
|
|
91
|
-
if (modelModifiers
|
|
95
|
+
if (props.modelModifiers?.lazy) {
|
|
92
96
|
updateInput(value);
|
|
93
97
|
}
|
|
94
|
-
if (modelModifiers
|
|
98
|
+
if (props.modelModifiers?.trim) {
|
|
95
99
|
event.target.value = value.trim();
|
|
96
100
|
}
|
|
97
101
|
emitFormChange();
|
|
@@ -117,7 +121,7 @@ defineExpose({
|
|
|
117
121
|
</script>
|
|
118
122
|
|
|
119
123
|
<template>
|
|
120
|
-
<Primitive :as="as" :class="b24ui.root({ class: [props.
|
|
124
|
+
<Primitive :as="as" :class="b24ui.root({ class: [props.b24ui?.root, props.class] })">
|
|
121
125
|
<div v-if="isTag" :class="b24ui.tag({ class: props.b24ui?.tag })">
|
|
122
126
|
{{ props.tag }}
|
|
123
127
|
</div>
|
|
@@ -2,9 +2,9 @@ import type { InputHTMLAttributes } from 'vue';
|
|
|
2
2
|
import type { AppConfig } from '@nuxt/schema';
|
|
3
3
|
import theme from '#build/b24ui/input';
|
|
4
4
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
5
|
-
import type { ComponentConfig } from '../types/utils';
|
|
5
|
+
import type { AcceptableValue, ComponentConfig } from '../types/utils';
|
|
6
6
|
type Input = ComponentConfig<typeof theme, AppConfig, 'input'>;
|
|
7
|
-
export interface InputProps extends UseComponentIconsProps {
|
|
7
|
+
export interface InputProps<T extends AcceptableValue = AcceptableValue> extends UseComponentIconsProps {
|
|
8
8
|
/**
|
|
9
9
|
* The element or component this component should render as.
|
|
10
10
|
* @defaultValue 'div'
|
|
@@ -78,11 +78,20 @@ export interface InputProps extends UseComponentIconsProps {
|
|
|
78
78
|
* @defaultValue false
|
|
79
79
|
*/
|
|
80
80
|
highlight?: boolean;
|
|
81
|
+
modelValue?: T;
|
|
82
|
+
defaultValue?: T;
|
|
83
|
+
modelModifiers?: {
|
|
84
|
+
string?: boolean;
|
|
85
|
+
number?: boolean;
|
|
86
|
+
trim?: boolean;
|
|
87
|
+
lazy?: boolean;
|
|
88
|
+
nullify?: boolean;
|
|
89
|
+
};
|
|
81
90
|
class?: any;
|
|
82
91
|
b24ui?: Input['slots'];
|
|
83
92
|
}
|
|
84
|
-
export interface InputEmits {
|
|
85
|
-
(e: 'update:modelValue', payload:
|
|
93
|
+
export interface InputEmits<T extends AcceptableValue = AcceptableValue> {
|
|
94
|
+
(e: 'update:modelValue', payload: T): void;
|
|
86
95
|
(e: 'blur', event: FocusEvent): void;
|
|
87
96
|
(e: 'change', event: Event): void;
|
|
88
97
|
}
|
|
@@ -91,30 +100,22 @@ export interface InputSlots {
|
|
|
91
100
|
default(props?: {}): any;
|
|
92
101
|
trailing(props?: {}): any;
|
|
93
102
|
}
|
|
94
|
-
declare const _default:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}> &
|
|
107
|
-
|
|
108
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
109
|
-
"onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
110
|
-
}>, {
|
|
111
|
-
type: import("vue").InputTypeHTMLAttribute;
|
|
112
|
-
autocomplete: string;
|
|
113
|
-
autofocusDelay: number;
|
|
114
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, InputSlots>;
|
|
115
|
-
export default _default;
|
|
116
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
117
|
-
new (): {
|
|
118
|
-
$slots: S;
|
|
119
|
-
};
|
|
103
|
+
declare const _default: <T extends AcceptableValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
104
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
105
|
+
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
106
|
+
readonly onChange?: ((event: Event) => any) | undefined;
|
|
107
|
+
readonly "onUpdate:modelValue"?: ((payload: T) => any) | undefined;
|
|
108
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onChange" | "onUpdate:modelValue"> & InputProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
109
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
110
|
+
inputRef: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
111
|
+
}>): void;
|
|
112
|
+
attrs: any;
|
|
113
|
+
slots: InputSlots;
|
|
114
|
+
emit: InputEmits<T>;
|
|
115
|
+
}>) => import("vue").VNode & {
|
|
116
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
120
117
|
};
|
|
118
|
+
export default _default;
|
|
119
|
+
type __VLS_PrettifyLocal<T> = {
|
|
120
|
+
[K in keyof T]: T[K];
|
|
121
|
+
} & {};
|