@bitrix24/b24ui-nuxt 0.6.8 → 0.7.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/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 +3 -11
- 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 +35333 -15836
- package/dist/meta.mjs +35333 -15836
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -3
- package/dist/runtime/air-design-tokens.css +1 -0
- 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/App.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 +1 -1
- package/dist/runtime/components/Checkbox.vue +13 -4
- 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 +6 -4
- package/dist/runtime/components/InputNumber.vue +17 -10
- package/dist/runtime/components/InputNumber.vue.d.ts +6 -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 +24 -8
- 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/index.css +1 -1
- 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.CxsFEY3M.mjs} +268 -122
- 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 +30 -29
|
@@ -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
|
+
} & {};
|
|
@@ -4,7 +4,7 @@ import theme from "#build/b24ui/input-menu";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed, ref, toRef, onMounted, toRaw } from "vue";
|
|
7
|
-
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent,
|
|
7
|
+
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from "reka-ui";
|
|
8
8
|
import { defu } from "defu";
|
|
9
9
|
import { isEqual } from "ohash/utils";
|
|
10
10
|
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
@@ -229,7 +229,7 @@ defineExpose({
|
|
|
229
229
|
:is="icons.plus"
|
|
230
230
|
:class="b24ui.itemLeadingIcon({ addNew: true, class: props.b24ui?.itemLeadingIcon })"
|
|
231
231
|
/>
|
|
232
|
-
{{ t(
|
|
232
|
+
{{ t("inputMenu.create", { label: searchTerm }) }}
|
|
233
233
|
</slot>
|
|
234
234
|
</span>
|
|
235
235
|
</ComboboxItem>
|
|
@@ -242,7 +242,7 @@ defineExpose({
|
|
|
242
242
|
v-bind="rootProps"
|
|
243
243
|
:name="name"
|
|
244
244
|
:disabled="disabled"
|
|
245
|
-
:class="b24ui.root({ class: [props.
|
|
245
|
+
:class="b24ui.root({ class: [props.b24ui?.root, props.class] })"
|
|
246
246
|
:as-child="!!multiple"
|
|
247
247
|
ignore-filter
|
|
248
248
|
@update:model-value="onUpdate"
|
|
@@ -265,18 +265,18 @@ defineExpose({
|
|
|
265
265
|
@focus="onFocus"
|
|
266
266
|
@remove-tag="onRemoveTag"
|
|
267
267
|
>
|
|
268
|
-
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="b24ui.tagsItem({ class: props.b24ui?.tagsItem })">
|
|
269
|
-
<TagsInputItemText :class="b24ui.tagsItemText({ class: props.b24ui?.tagsItemText })">
|
|
268
|
+
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="b24ui.tagsItem({ class: [props.b24ui?.tagsItem, isInputItem(item) && item.b24ui?.tagsItem] })">
|
|
269
|
+
<TagsInputItemText :class="b24ui.tagsItemText({ class: [props.b24ui?.tagsItemText, isInputItem(item) && item.b24ui?.tagsItemText] })">
|
|
270
270
|
<slot name="tags-item-text" :item="item" :index="index">
|
|
271
271
|
{{ displayValue(item) }}
|
|
272
272
|
</slot>
|
|
273
273
|
</TagsInputItemText>
|
|
274
274
|
|
|
275
|
-
<TagsInputItemDelete :class="b24ui.tagsItemDelete({ class: props.b24ui?.tagsItemDelete })" :disabled="disabled">
|
|
275
|
+
<TagsInputItemDelete :class="b24ui.tagsItemDelete({ class: [props.b24ui?.tagsItemDelete, isInputItem(item) && item.b24ui?.tagsItemDelete] })" :disabled="disabled">
|
|
276
276
|
<slot name="tags-item-delete" :item="item" :index="index">
|
|
277
277
|
<Component
|
|
278
278
|
:is="deleteIcon || icons.close"
|
|
279
|
-
:class="b24ui.tagsItemDeleteIcon({ class: props.b24ui?.tagsItemDeleteIcon })"
|
|
279
|
+
:class="b24ui.tagsItemDeleteIcon({ class: [props.b24ui?.tagsItemDeleteIcon, isInputItem(item) && item.b24ui?.tagsItemDeleteIcon] })"
|
|
280
280
|
/>
|
|
281
281
|
</slot>
|
|
282
282
|
</TagsInputItemDelete>
|
|
@@ -334,24 +334,27 @@ defineExpose({
|
|
|
334
334
|
|
|
335
335
|
<ComboboxEmpty :class="b24ui.empty({ class: props.b24ui?.empty })">
|
|
336
336
|
<slot name="empty" :search-term="searchTerm">
|
|
337
|
-
{{ searchTerm ? t(
|
|
337
|
+
{{ searchTerm ? t("inputMenu.noMatch", { searchTerm }) : t("inputMenu.noData") }}
|
|
338
338
|
</slot>
|
|
339
339
|
</ComboboxEmpty>
|
|
340
340
|
|
|
341
|
-
<
|
|
341
|
+
<div
|
|
342
|
+
role="presentation"
|
|
343
|
+
:class="b24ui.viewport({ class: props.b24ui?.viewport })"
|
|
344
|
+
>
|
|
342
345
|
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'top'" />
|
|
343
346
|
|
|
344
347
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="b24ui.group({ class: props.b24ui?.group })">
|
|
345
348
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
|
346
|
-
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="b24ui.label({ class: props.b24ui?.label })">
|
|
349
|
+
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="b24ui.label({ class: [props.b24ui?.label, item.b24ui?.label, item.class] })">
|
|
347
350
|
{{ get(item, props.labelKey) }}
|
|
348
351
|
</ComboboxLabel>
|
|
349
352
|
|
|
350
|
-
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: props.b24ui?.separator })" />
|
|
353
|
+
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="b24ui.separator({ class: [props.b24ui?.separator, item.b24ui?.separator, item.class] })" />
|
|
351
354
|
|
|
352
355
|
<ComboboxItem
|
|
353
356
|
v-else
|
|
354
|
-
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
357
|
+
:class="b24ui.item({ class: [props.b24ui?.item, isInputItem(item) && item.b24ui?.item, isInputItem(item) && item.class], colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
355
358
|
:disabled="isInputItem(item) && item.disabled"
|
|
356
359
|
:value="props.valueKey && isInputItem(item) ? get(item, props.valueKey) : item"
|
|
357
360
|
@select="onSelect($event, item)"
|
|
@@ -361,32 +364,32 @@ defineExpose({
|
|
|
361
364
|
<Component
|
|
362
365
|
:is="item.icon"
|
|
363
366
|
v-if="isInputItem(item) && item.icon"
|
|
364
|
-
:class="b24ui.itemLeadingIcon({ class: props.b24ui?.itemLeadingIcon, colorItem: item?.color })"
|
|
367
|
+
:class="b24ui.itemLeadingIcon({ class: [props.b24ui?.itemLeadingIcon, item.b24ui?.itemLeadingIcon], colorItem: item?.color })"
|
|
365
368
|
/>
|
|
366
|
-
<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 })" />
|
|
369
|
+
<B24Avatar v-else-if="isInputItem(item) && item.avatar" :size="item.b24ui?.itemLeadingAvatarSize || props.b24ui?.itemLeadingAvatarSize || b24ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="b24ui.itemLeadingAvatar({ class: [props.b24ui?.itemLeadingAvatar, item.b24ui?.itemLeadingAvatar], colorItem: item?.color })" />
|
|
367
370
|
<B24Chip
|
|
368
371
|
v-else-if="isInputItem(item) && item.chip"
|
|
369
|
-
:size="props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
372
|
+
:size="item.b24ui?.itemLeadingChipSize || props.b24ui?.itemLeadingChipSize || b24ui.itemLeadingChipSize()"
|
|
370
373
|
inset
|
|
371
374
|
standalone
|
|
372
375
|
v-bind="item.chip"
|
|
373
|
-
:class="b24ui.itemLeadingChip({ class: props.b24ui?.itemLeadingChip, colorItem: item?.color })"
|
|
376
|
+
:class="b24ui.itemLeadingChip({ class: [props.b24ui?.itemLeadingChip, item.b24ui?.itemLeadingChip], colorItem: item?.color })"
|
|
374
377
|
/>
|
|
375
378
|
</slot>
|
|
376
379
|
|
|
377
|
-
<span :class="b24ui.itemLabel({ class: props.b24ui?.itemLabel })">
|
|
380
|
+
<span :class="b24ui.itemLabel({ class: [props.b24ui?.itemLabel, isInputItem(item) && item.b24ui?.itemLabel] })">
|
|
378
381
|
<slot name="item-label" :item="item" :index="index">
|
|
379
382
|
{{ isInputItem(item) ? get(item, props.labelKey) : item }}
|
|
380
383
|
</slot>
|
|
381
384
|
</span>
|
|
382
385
|
|
|
383
|
-
<span :class="b24ui.itemTrailing({ class: props.b24ui?.itemTrailing, colorItem: isInputItem(item) ? item?.color : void 0 })">
|
|
386
|
+
<span :class="b24ui.itemTrailing({ class: [props.b24ui?.itemTrailing, isInputItem(item) && item.b24ui?.itemTrailing], colorItem: isInputItem(item) ? item?.color : void 0 })">
|
|
384
387
|
<slot name="item-trailing" :item="item" :index="index" />
|
|
385
388
|
|
|
386
389
|
<ComboboxItemIndicator as-child>
|
|
387
390
|
<Component
|
|
388
391
|
:is="selectedIcon || icons.check"
|
|
389
|
-
:class="b24ui.itemTrailingIcon({ class: props.b24ui?.itemTrailingIcon, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
392
|
+
:class="b24ui.itemTrailingIcon({ class: [props.b24ui?.itemTrailingIcon, isInputItem(item) && item.b24ui?.itemTrailingIcon], colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
390
393
|
/>
|
|
391
394
|
</ComboboxItemIndicator>
|
|
392
395
|
</span>
|
|
@@ -396,7 +399,7 @@ defineExpose({
|
|
|
396
399
|
</ComboboxGroup>
|
|
397
400
|
|
|
398
401
|
<ReuseCreateItemTemplate v-if="createItem && createItemPosition === 'bottom'" />
|
|
399
|
-
</
|
|
402
|
+
</div>
|
|
400
403
|
|
|
401
404
|
<slot name="content-bottom" />
|
|
402
405
|
|
|
@@ -23,6 +23,8 @@ interface _InputMenuItem {
|
|
|
23
23
|
type?: 'label' | 'separator' | 'item';
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
onSelect?(e?: Event): void;
|
|
26
|
+
class?: any;
|
|
27
|
+
b24ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemLabel' | 'itemTrailing' | 'itemTrailingIcon'>;
|
|
26
28
|
[key: string]: any;
|
|
27
29
|
}
|
|
28
30
|
export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean;
|
|
@@ -223,12 +225,12 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
|
|
|
223
225
|
readonly onChange?: ((payload: Event) => any) | undefined;
|
|
224
226
|
readonly onFocus?: ((payload: FocusEvent) => any) | undefined;
|
|
225
227
|
readonly onCreate?: ((item: string) => any) | undefined;
|
|
228
|
+
readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
229
|
+
readonly "onUpdate:modelValue"?: ((payload: GetModelValue<T, VK, M>) => any) | undefined;
|
|
226
230
|
readonly onHighlight?: ((payload: {
|
|
227
231
|
ref: HTMLElement;
|
|
228
232
|
value: GetModelValue<T, VK, M>;
|
|
229
233
|
} | undefined) => any) | undefined;
|
|
230
|
-
readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
231
|
-
readonly "onUpdate:modelValue"?: ((payload: GetModelValue<T, VK, M>) => any) | undefined;
|
|
232
234
|
readonly "onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
233
235
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue" | "onCreate" | "onHighlight" | "onUpdate:searchTerm"> & (InputMenuProps<T, VK, M> & {
|
|
234
236
|
searchTerm?: string;
|
|
@@ -566,10 +568,10 @@ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetI
|
|
|
566
568
|
}>): void;
|
|
567
569
|
attrs: any;
|
|
568
570
|
slots: InputMenuSlots<T, VK, M, NestedItem<T>>;
|
|
569
|
-
emit: (((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "create", item: string) => void) & ((evt: "highlight", payload: {
|
|
571
|
+
emit: (((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "create", item: string) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue<T, VK, M>) => void) & ((evt: "highlight", payload: {
|
|
570
572
|
ref: HTMLElement;
|
|
571
573
|
value: GetModelValue<T, VK, M>;
|
|
572
|
-
} | undefined) => void)
|
|
574
|
+
} | undefined) => void)) & ((evt: "update:searchTerm", value: string) => void);
|
|
573
575
|
}>) => import("vue").VNode & {
|
|
574
576
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
575
577
|
};
|
|
@@ -7,6 +7,7 @@ import { onMounted, ref, computed } from "vue";
|
|
|
7
7
|
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
10
11
|
import { useFormField } from "../composables/useFormField";
|
|
11
12
|
import { useLocale } from "../composables/useLocale";
|
|
12
13
|
import { tv } from "../utils/tv";
|
|
@@ -17,7 +18,7 @@ const props = defineProps({
|
|
|
17
18
|
as: { type: null, required: false },
|
|
18
19
|
placeholder: { type: String, required: false },
|
|
19
20
|
color: { type: null, required: false, default: "primary" },
|
|
20
|
-
size: { type: null, required: false
|
|
21
|
+
size: { type: null, required: false },
|
|
21
22
|
noPadding: { type: Boolean, required: false },
|
|
22
23
|
noBorder: { type: Boolean, required: false },
|
|
23
24
|
underline: { type: Boolean, required: false },
|
|
@@ -28,8 +29,10 @@ const props = defineProps({
|
|
|
28
29
|
orientation: { type: String, required: false, default: "horizontal" },
|
|
29
30
|
increment: { type: Object, required: false },
|
|
30
31
|
incrementIcon: { type: [Function, Object], required: false },
|
|
32
|
+
incrementDisabled: { type: Boolean, required: false },
|
|
31
33
|
decrement: { type: Object, required: false },
|
|
32
34
|
decrementIcon: { type: [Function, Object], required: false },
|
|
35
|
+
decrementDisabled: { type: Boolean, required: false },
|
|
33
36
|
autofocus: { type: Boolean, required: false },
|
|
34
37
|
autofocusDelay: { type: Number, required: false },
|
|
35
38
|
locale: { type: String, required: false },
|
|
@@ -46,28 +49,32 @@ const props = defineProps({
|
|
|
46
49
|
id: { type: String, required: false },
|
|
47
50
|
name: { type: String, required: false },
|
|
48
51
|
formatOptions: { type: null, required: false },
|
|
49
|
-
disableWheelChange: { type: Boolean, required: false }
|
|
52
|
+
disableWheelChange: { type: Boolean, required: false },
|
|
53
|
+
invertWheelChange: { type: Boolean, required: false }
|
|
50
54
|
});
|
|
51
55
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
52
56
|
defineSlots();
|
|
53
|
-
const appConfig = useAppConfig();
|
|
54
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange"), emits);
|
|
55
|
-
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
56
57
|
const { t, code: codeLocale } = useLocale();
|
|
58
|
+
const appConfig = useAppConfig();
|
|
59
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange"), emits);
|
|
60
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
61
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
57
62
|
const locale = computed(() => props.locale || codeLocale.value);
|
|
63
|
+
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
58
64
|
const isTag = computed(() => {
|
|
59
65
|
return props.tag;
|
|
60
66
|
});
|
|
61
67
|
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.inputNumber || {} })({
|
|
62
68
|
color: color.value,
|
|
63
|
-
size:
|
|
69
|
+
size: inputSize?.value,
|
|
64
70
|
tagColor: props.tagColor,
|
|
65
71
|
highlight: highlight.value,
|
|
66
72
|
rounded: Boolean(props.rounded),
|
|
67
73
|
noPadding: Boolean(props.noPadding),
|
|
68
74
|
noBorder: Boolean(props.noBorder),
|
|
69
75
|
underline: Boolean(props.underline),
|
|
70
|
-
orientation: props.orientation
|
|
76
|
+
orientation: props.orientation,
|
|
77
|
+
buttonGroup: orientation.value
|
|
71
78
|
}));
|
|
72
79
|
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === "horizontal" ? icons.plus : icons.chevronUp));
|
|
73
80
|
const decrementIcon = computed(() => props.decrementIcon || (props.orientation === "horizontal" ? icons.minus : icons.chevronDown));
|
|
@@ -101,7 +108,7 @@ defineExpose({
|
|
|
101
108
|
<NumberFieldRoot
|
|
102
109
|
v-bind="rootProps"
|
|
103
110
|
:id="id"
|
|
104
|
-
:class="b24ui.root({ class: [props.
|
|
111
|
+
:class="b24ui.root({ class: [props.b24ui?.root, props.class] })"
|
|
105
112
|
:name="name"
|
|
106
113
|
:disabled="disabled"
|
|
107
114
|
:locale="locale"
|
|
@@ -122,7 +129,7 @@ defineExpose({
|
|
|
122
129
|
/>
|
|
123
130
|
|
|
124
131
|
<div :class="b24ui.increment({ class: props.b24ui?.increment })">
|
|
125
|
-
<NumberFieldIncrement as-child :disabled="disabled">
|
|
132
|
+
<NumberFieldIncrement as-child :disabled="disabled || incrementDisabled">
|
|
126
133
|
<slot name="increment">
|
|
127
134
|
<B24Button
|
|
128
135
|
:icon="incrementIcon"
|
|
@@ -137,7 +144,7 @@ defineExpose({
|
|
|
137
144
|
</div>
|
|
138
145
|
|
|
139
146
|
<div :class="b24ui.decrement({ class: props.b24ui?.decrement })">
|
|
140
|
-
<NumberFieldDecrement as-child :disabled="disabled">
|
|
147
|
+
<NumberFieldDecrement as-child :disabled="disabled || decrementDisabled">
|
|
141
148
|
<slot name="decrement">
|
|
142
149
|
<B24Button
|
|
143
150
|
:icon="decrementIcon"
|
|
@@ -4,7 +4,7 @@ import theme from '#build/b24ui/input-number';
|
|
|
4
4
|
import type { ButtonProps, IconComponent } from '../types';
|
|
5
5
|
import type { ComponentConfig } from '../types/utils';
|
|
6
6
|
type InputNumber = ComponentConfig<typeof theme, AppConfig, 'inputNumber'>;
|
|
7
|
-
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'stepSnapping' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions' | 'disableWheelChange'> {
|
|
7
|
+
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'stepSnapping' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions' | 'disableWheelChange' | 'invertWheelChange'> {
|
|
8
8
|
/**
|
|
9
9
|
* The element or component this component should render as.
|
|
10
10
|
* @defaultValue 'div'
|
|
@@ -68,6 +68,8 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|
|
68
68
|
* @IconComponent
|
|
69
69
|
*/
|
|
70
70
|
incrementIcon?: IconComponent;
|
|
71
|
+
/** Disable the increment button. */
|
|
72
|
+
incrementDisabled?: boolean;
|
|
71
73
|
/**
|
|
72
74
|
* Configure the decrement button. The `size` is inherited.
|
|
73
75
|
* @defaultValue { color: 'link', depth: 'light' }
|
|
@@ -79,6 +81,8 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|
|
79
81
|
* @IconComponent
|
|
80
82
|
*/
|
|
81
83
|
decrementIcon?: IconComponent;
|
|
84
|
+
/** Disable the decrement button. */
|
|
85
|
+
decrementDisabled?: boolean;
|
|
82
86
|
/**
|
|
83
87
|
* @defaultValue false
|
|
84
88
|
*/
|
|
@@ -287,9 +291,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputNumbe
|
|
|
287
291
|
onChange?: ((payload: Event) => any) | undefined;
|
|
288
292
|
"onUpdate:modelValue"?: ((payload: number) => any) | undefined;
|
|
289
293
|
}>, {
|
|
290
|
-
size: InputNumber["variants"]["size"];
|
|
291
|
-
orientation: "vertical" | "horizontal";
|
|
292
294
|
color: InputNumber["variants"]["color"];
|
|
295
|
+
orientation: "vertical" | "horizontal";
|
|
293
296
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, InputNumberSlots>;
|
|
294
297
|
export default _default;
|
|
295
298
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -5,11 +5,12 @@ import theme from "#build/b24ui/link";
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
7
|
import { defu } from "defu";
|
|
8
|
-
import { isEqual
|
|
8
|
+
import { isEqual } from "ohash/utils";
|
|
9
9
|
import { useForwardProps } from "reka-ui";
|
|
10
10
|
import { reactiveOmit } from "@vueuse/core";
|
|
11
11
|
import { useRoute, useAppConfig } from "#imports";
|
|
12
12
|
import { tv } from "../utils/tv";
|
|
13
|
+
import { isPartiallyEqual } from "../utils/link";
|
|
13
14
|
import B24LinkBase from "./LinkBase.vue";
|
|
14
15
|
defineOptions({ inheritAttrs: false });
|
|
15
16
|
const props = defineProps({
|
|
@@ -44,7 +45,7 @@ const props = defineProps({
|
|
|
44
45
|
defineSlots();
|
|
45
46
|
const route = useRoute();
|
|
46
47
|
const appConfig = useAppConfig();
|
|
47
|
-
const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "raw", "class"));
|
|
48
|
+
const nuxtLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
48
49
|
const b24ui = computed(() => tv({
|
|
49
50
|
extend: tv(theme),
|
|
50
51
|
...defu({
|
|
@@ -56,17 +57,7 @@ const b24ui = computed(() => tv({
|
|
|
56
57
|
}
|
|
57
58
|
}, appConfig.b24ui?.link || {})
|
|
58
59
|
}));
|
|
59
|
-
|
|
60
|
-
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
61
|
-
if (q.type === "added") {
|
|
62
|
-
filtered.add(q.key);
|
|
63
|
-
}
|
|
64
|
-
return filtered;
|
|
65
|
-
}, /* @__PURE__ */ new Set());
|
|
66
|
-
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
67
|
-
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
68
|
-
return isEqual(item1Filtered, item2Filtered);
|
|
69
|
-
}
|
|
60
|
+
const to = computed(() => props.to ?? props.href);
|
|
70
61
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
71
62
|
if (props.active !== void 0) {
|
|
72
63
|
return props.active;
|
|
@@ -105,6 +96,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive }) {
|
|
|
105
96
|
<NuxtLink
|
|
106
97
|
v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }"
|
|
107
98
|
v-bind="nuxtLinkProps"
|
|
99
|
+
:to="to"
|
|
108
100
|
custom
|
|
109
101
|
>
|
|
110
102
|
<template v-if="custom">
|
|
@@ -31,7 +31,7 @@ const props = defineProps({
|
|
|
31
31
|
defaultOpen: { type: Boolean, required: false },
|
|
32
32
|
modal: { type: Boolean, required: false, default: true }
|
|
33
33
|
});
|
|
34
|
-
const emits = defineEmits(["after:leave", "close:prevent", "update:open"]);
|
|
34
|
+
const emits = defineEmits(["after:leave", "after:enter", "close:prevent", "update:open"]);
|
|
35
35
|
const slots = defineSlots();
|
|
36
36
|
const { t } = useLocale();
|
|
37
37
|
const appConfig = useAppConfig();
|
|
@@ -43,14 +43,14 @@ const contentEvents = computed(() => {
|
|
|
43
43
|
closeAutoFocus: (e) => e.preventDefault()
|
|
44
44
|
};
|
|
45
45
|
if (!props.dismissible) {
|
|
46
|
-
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"
|
|
46
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
47
47
|
return events.reduce((acc, curr) => {
|
|
48
48
|
acc[curr] = (e) => {
|
|
49
49
|
e.preventDefault();
|
|
50
50
|
emits("close:prevent");
|
|
51
51
|
};
|
|
52
52
|
return acc;
|
|
53
|
-
},
|
|
53
|
+
}, defaultEvents);
|
|
54
54
|
}
|
|
55
55
|
return defaultEvents;
|
|
56
56
|
});
|
|
@@ -62,7 +62,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.modal |
|
|
|
62
62
|
</script>
|
|
63
63
|
|
|
64
64
|
<template>
|
|
65
|
-
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
65
|
+
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
66
66
|
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
67
67
|
<slot :open="open" />
|
|
68
68
|
</DialogTrigger>
|
|
@@ -70,7 +70,13 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.modal |
|
|
|
70
70
|
<DialogPortal v-bind="portalProps">
|
|
71
71
|
<DialogOverlay v-if="overlay" :class="b24ui.overlay({ class: props.b24ui?.overlay })" />
|
|
72
72
|
|
|
73
|
-
<DialogContent
|
|
73
|
+
<DialogContent
|
|
74
|
+
:class="b24ui.content({ class: [!slots.default && props.class, props.b24ui?.content] })"
|
|
75
|
+
v-bind="contentProps"
|
|
76
|
+
@after-enter="emits('after:enter')"
|
|
77
|
+
@after-leave="emits('after:leave')"
|
|
78
|
+
v-on="contentEvents"
|
|
79
|
+
>
|
|
74
80
|
<VisuallyHidden v-if="!!slots.content && (title || !!slots.title || (description || !!slots.description))">
|
|
75
81
|
<DialogTitle v-if="title || !!slots.title">
|
|
76
82
|
<slot name="title">
|
|
@@ -85,9 +91,9 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.modal |
|
|
|
85
91
|
</DialogDescription>
|
|
86
92
|
</VisuallyHidden>
|
|
87
93
|
|
|
88
|
-
<slot name="content">
|
|
89
|
-
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="b24ui.header({ class: props.b24ui?.header })">
|
|
90
|
-
<slot name="header">
|
|
94
|
+
<slot name="content" :close="close">
|
|
95
|
+
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (props.close || !!slots.close)" :class="b24ui.header({ class: props.b24ui?.header })">
|
|
96
|
+
<slot name="header" :close="close">
|
|
91
97
|
<div :class="b24ui.wrapper({ class: props.b24ui?.wrapper })">
|
|
92
98
|
<DialogTitle v-if="title || !!slots.title" :class="b24ui.title({ class: props.b24ui?.title })">
|
|
93
99
|
<slot name="title">
|
|
@@ -102,15 +108,17 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.modal |
|
|
|
102
108
|
</DialogDescription>
|
|
103
109
|
</div>
|
|
104
110
|
|
|
105
|
-
<
|
|
106
|
-
|
|
111
|
+
<slot name="actions" />
|
|
112
|
+
|
|
113
|
+
<DialogClose v-if="props.close || !!slots.close" as-child>
|
|
114
|
+
<slot name="close" :close="close" :b24ui="b24ui">
|
|
107
115
|
<B24Button
|
|
108
|
-
v-if="close"
|
|
116
|
+
v-if="props.close"
|
|
109
117
|
:icon="closeIcon || icons.close"
|
|
110
118
|
size="xs"
|
|
111
119
|
color="link"
|
|
112
120
|
:aria-label="t('modal.close')"
|
|
113
|
-
v-bind="typeof close === 'object' ? close : {}"
|
|
121
|
+
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
114
122
|
:class="b24ui.close({ class: props.b24ui?.close })"
|
|
115
123
|
/>
|
|
116
124
|
</slot>
|
|
@@ -119,11 +127,11 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.modal |
|
|
|
119
127
|
</div>
|
|
120
128
|
|
|
121
129
|
<div v-if="!!slots.body" :class="b24ui.body({ class: props.b24ui?.body, scrollbarThin: Boolean(props.scrollbarThin) })">
|
|
122
|
-
<slot name="body" />
|
|
130
|
+
<slot name="body" :close="close" />
|
|
123
131
|
</div>
|
|
124
132
|
|
|
125
133
|
<div v-if="!!slots.footer" :class="b24ui.footer({ class: props.b24ui?.footer })">
|
|
126
|
-
<slot name="footer" />
|
|
134
|
+
<slot name="footer" :close="close" />
|
|
127
135
|
</div>
|
|
128
136
|
</slot>
|
|
129
137
|
</DialogContent>
|