@bitrix24/b24ui-nuxt 2.0.9 → 2.1.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/dist/meta.d.mts +77776 -42923
- package/dist/meta.mjs +77776 -42923
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -3
- package/dist/runtime/components/Advice.d.vue.ts +1 -1
- package/dist/runtime/components/Advice.vue +1 -3
- package/dist/runtime/components/Advice.vue.d.ts +1 -1
- package/dist/runtime/components/App.d.vue.ts +1 -1
- package/dist/runtime/components/App.vue +2 -1
- package/dist/runtime/components/App.vue.d.ts +1 -1
- package/dist/runtime/components/Avatar.d.vue.ts +2 -1
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/Button.vue +1 -0
- package/dist/runtime/components/ChatPrompt.d.vue.ts +2 -2
- package/dist/runtime/components/ChatPrompt.vue +5 -5
- package/dist/runtime/components/ChatPrompt.vue.d.ts +2 -2
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +5 -5
- package/dist/runtime/components/ChatPromptSubmit.vue +53 -4
- package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +5 -5
- package/dist/runtime/components/Checkbox.d.vue.ts +2 -1
- package/dist/runtime/components/Checkbox.vue.d.ts +2 -1
- package/dist/runtime/components/CommandPalette.vue +5 -4
- package/dist/runtime/components/DashboardSearch.d.vue.ts +3 -6
- package/dist/runtime/components/DashboardSearch.vue +2 -3
- package/dist/runtime/components/DashboardSearch.vue.d.ts +3 -6
- package/dist/runtime/components/DashboardSearchButton.d.vue.ts +2 -3
- package/dist/runtime/components/DashboardSearchButton.vue +44 -6
- package/dist/runtime/components/DashboardSearchButton.vue.d.ts +2 -3
- package/dist/runtime/components/Error.d.vue.ts +1 -1
- package/dist/runtime/components/Error.vue.d.ts +1 -1
- package/dist/runtime/components/FileUpload.d.vue.ts +3 -2
- package/dist/runtime/components/FileUpload.vue +9 -9
- package/dist/runtime/components/FileUpload.vue.d.ts +3 -2
- package/dist/runtime/components/Form.d.vue.ts +2 -1
- package/dist/runtime/components/Form.vue.d.ts +2 -1
- package/dist/runtime/components/Input.d.vue.ts +7 -7
- package/dist/runtime/components/Input.vue +2 -2
- package/dist/runtime/components/Input.vue.d.ts +7 -7
- package/dist/runtime/components/InputDate.d.vue.ts +115 -0
- package/dist/runtime/components/InputDate.vue +198 -0
- package/dist/runtime/components/InputDate.vue.d.ts +115 -0
- package/dist/runtime/components/InputMenu.d.vue.ts +7 -128
- package/dist/runtime/components/InputMenu.vue +3 -3
- package/dist/runtime/components/InputMenu.vue.d.ts +7 -128
- package/dist/runtime/components/InputNumber.d.vue.ts +25 -124
- package/dist/runtime/components/InputNumber.vue +3 -3
- package/dist/runtime/components/InputNumber.vue.d.ts +25 -124
- package/dist/runtime/components/InputTags.d.vue.ts +6 -109
- package/dist/runtime/components/InputTags.vue +8 -8
- package/dist/runtime/components/InputTags.vue.d.ts +6 -109
- package/dist/runtime/components/InputTime.d.vue.ts +99 -0
- package/dist/runtime/components/InputTime.vue +170 -0
- package/dist/runtime/components/InputTime.vue.d.ts +99 -0
- package/dist/runtime/components/Link.d.vue.ts +4 -49
- package/dist/runtime/components/Link.vue +1 -0
- package/dist/runtime/components/Link.vue.d.ts +4 -49
- package/dist/runtime/components/Modal.d.vue.ts +1 -1
- package/dist/runtime/components/Modal.vue.d.ts +1 -1
- package/dist/runtime/components/Pagination.d.vue.ts +2 -2
- package/dist/runtime/components/Pagination.vue.d.ts +2 -2
- package/dist/runtime/components/PinInput.d.vue.ts +3 -3
- package/dist/runtime/components/PinInput.vue.d.ts +3 -3
- package/dist/runtime/components/Progress.d.vue.ts +1 -1
- package/dist/runtime/components/Progress.vue.d.ts +1 -1
- package/dist/runtime/components/Select.d.vue.ts +6 -107
- package/dist/runtime/components/Select.vue +3 -3
- package/dist/runtime/components/Select.vue.d.ts +6 -107
- package/dist/runtime/components/SelectMenu.d.vue.ts +7 -106
- package/dist/runtime/components/SelectMenu.vue +3 -3
- package/dist/runtime/components/SelectMenu.vue.d.ts +7 -106
- package/dist/runtime/components/Slideover.d.vue.ts +1 -1
- package/dist/runtime/components/Slideover.vue.d.ts +1 -1
- package/dist/runtime/components/Switch.d.vue.ts +2 -1
- package/dist/runtime/components/Switch.vue.d.ts +2 -1
- package/dist/runtime/components/Table.d.vue.ts +5 -4
- package/dist/runtime/components/Table.vue +4 -3
- package/dist/runtime/components/Table.vue.d.ts +5 -4
- package/dist/runtime/components/Textarea.d.vue.ts +7 -6
- package/dist/runtime/components/Textarea.vue +2 -2
- package/dist/runtime/components/Textarea.vue.d.ts +7 -6
- package/dist/runtime/components/Toast.vue +5 -5
- package/dist/runtime/components/Toaster.d.vue.ts +1 -1
- package/dist/runtime/components/Toaster.vue.d.ts +1 -1
- package/dist/runtime/components/color-mode/ColorModeAvatar.d.vue.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue +16 -4
- package/dist/runtime/components/color-mode/ColorModeAvatar.vue.d.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeButton.vue +54 -6
- package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +3 -3
- package/dist/runtime/components/color-mode/ColorModeImage.d.vue.ts +4 -3
- package/dist/runtime/components/color-mode/ColorModeImage.vue +4 -0
- package/dist/runtime/components/color-mode/ColorModeImage.vue.d.ts +4 -3
- package/dist/runtime/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +47 -5
- package/dist/runtime/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
- package/dist/runtime/components/color-mode/ColorModeSwitch.d.vue.ts +2 -2
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue +29 -5
- package/dist/runtime/components/color-mode/ColorModeSwitch.vue.d.ts +2 -2
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +3 -6
- package/dist/runtime/components/content/ContentSearch.vue +2 -3
- package/dist/runtime/components/content/ContentSearch.vue.d.ts +3 -6
- package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +2 -3
- package/dist/runtime/components/content/ContentSearchButton.vue +43 -5
- package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +2 -3
- package/dist/runtime/components/content/ContentSurround.vue +7 -1
- package/dist/runtime/components/locale/LocaleSelect.d.vue.ts +11 -7
- package/dist/runtime/components/locale/LocaleSelect.vue +50 -6
- package/dist/runtime/components/locale/LocaleSelect.vue.d.ts +11 -7
- package/dist/runtime/components/prose/Callout.vue +4 -0
- package/dist/runtime/composables/index.d.ts +8 -0
- package/dist/runtime/composables/index.js +8 -0
- package/dist/runtime/composables/useFileUpload.d.ts +2 -1
- package/dist/runtime/composables/useFileUpload.js +13 -4
- package/dist/runtime/inertia/components/Link.d.vue.ts +17 -10
- package/dist/runtime/inertia/components/Link.vue +8 -6
- package/dist/runtime/inertia/components/Link.vue.d.ts +17 -10
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/types/html.d.ts +8 -0
- package/dist/runtime/types/html.js +0 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/input.d.ts +5 -5
- package/dist/runtime/types/utils.d.ts +2 -0
- package/dist/runtime/utils/content.d.ts +2 -2
- package/dist/runtime/utils/dashboard.d.ts +1 -1
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +40 -24
- package/dist/runtime/vue/components/Link.d.vue.ts +8 -37
- package/dist/runtime/vue/components/Link.vue +6 -11
- package/dist/runtime/vue/components/Link.vue.d.ts +8 -37
- package/dist/runtime/vue/components/color-mode/ColorModeButton.d.vue.ts +2 -2
- package/dist/runtime/vue/components/color-mode/ColorModeButton.vue +55 -5
- package/dist/runtime/vue/components/color-mode/ColorModeButton.vue.d.ts +2 -2
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +46 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.d.vue.ts +1 -1
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +24 -3
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{b24ui-nuxt.4XNR9Ysu.mjs → b24ui-nuxt.CXLCGBie.mjs} +135 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +24 -14
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/input-date";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, onMounted, ref } from "vue";
|
|
7
|
+
import { useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { DateField as SingleDateField, DateRangeField as RangeDateField } from "reka-ui/namespaced";
|
|
9
|
+
import { reactiveOmit, createReusableTemplate } from "@vueuse/core";
|
|
10
|
+
import { useAppConfig } from "#imports";
|
|
11
|
+
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
12
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
13
|
+
import { useFormField } from "../composables/useFormField";
|
|
14
|
+
import { useLocale } from "../composables/useLocale";
|
|
15
|
+
import { tv } from "../utils/tv";
|
|
16
|
+
import icons from "../dictionary/icons";
|
|
17
|
+
import B24Badge from "./Badge.vue";
|
|
18
|
+
import B24Avatar from "./Avatar.vue";
|
|
19
|
+
defineOptions({ inheritAttrs: false });
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
as: { type: null, required: false },
|
|
22
|
+
color: { type: null, required: false },
|
|
23
|
+
size: { type: null, required: false },
|
|
24
|
+
noPadding: { type: Boolean, required: false },
|
|
25
|
+
noBorder: { type: Boolean, required: false },
|
|
26
|
+
underline: { type: Boolean, required: false },
|
|
27
|
+
rounded: { type: Boolean, required: false },
|
|
28
|
+
tag: { type: String, required: false },
|
|
29
|
+
tagColor: { type: null, required: false },
|
|
30
|
+
highlight: { type: Boolean, required: false },
|
|
31
|
+
autofocus: { type: Boolean, required: false },
|
|
32
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
33
|
+
separatorIcon: { type: [Function, Object], required: false },
|
|
34
|
+
range: { type: Boolean, required: false },
|
|
35
|
+
locale: { type: String, required: false },
|
|
36
|
+
defaultValue: { type: null, required: false },
|
|
37
|
+
modelValue: { type: null, required: false },
|
|
38
|
+
class: { type: null, required: false },
|
|
39
|
+
b24ui: { type: null, required: false },
|
|
40
|
+
icon: { type: [Function, Object], required: false },
|
|
41
|
+
avatar: { type: Object, required: false },
|
|
42
|
+
loading: { type: Boolean, required: false },
|
|
43
|
+
trailing: { type: Boolean, required: false },
|
|
44
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
45
|
+
defaultPlaceholder: { type: null, required: false },
|
|
46
|
+
placeholder: { type: null, required: false },
|
|
47
|
+
hourCycle: { type: null, required: false },
|
|
48
|
+
step: { type: Object, required: false },
|
|
49
|
+
granularity: { type: String, required: false },
|
|
50
|
+
hideTimeZone: { type: Boolean, required: false },
|
|
51
|
+
maxValue: { type: null, required: false },
|
|
52
|
+
minValue: { type: null, required: false },
|
|
53
|
+
disabled: { type: Boolean, required: false },
|
|
54
|
+
readonly: { type: Boolean, required: false },
|
|
55
|
+
isDateUnavailable: { type: Function, required: false },
|
|
56
|
+
id: { type: String, required: false },
|
|
57
|
+
name: { type: String, required: false },
|
|
58
|
+
required: { type: Boolean, required: false }
|
|
59
|
+
});
|
|
60
|
+
const emits = defineEmits(["update:modelValue", "change", "blur", "focus", "update:placeholder"]);
|
|
61
|
+
const slots = defineSlots();
|
|
62
|
+
const { code: codeLocale, dir } = useLocale();
|
|
63
|
+
const appConfig = useAppConfig();
|
|
64
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, "id", "name", "range", "modelValue", "defaultValue", "color", "size", "highlight", "disabled", "autofocus", "autofocusDelay", "icon", "avatar", "trailingIcon", "loading", "separatorIcon", "class", "b24ui"), emits);
|
|
65
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
66
|
+
const { orientation, size: fieldGroupSize } = useFieldGroup(props);
|
|
67
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
|
|
68
|
+
const [DefineSegmentsTemplate, ReuseSegmentsTemplate] = createReusableTemplate();
|
|
69
|
+
const locale = computed(() => props.locale || codeLocale.value);
|
|
70
|
+
const inputSize = computed(() => fieldGroupSize.value || formGroupSize.value);
|
|
71
|
+
const isTag = computed(() => {
|
|
72
|
+
return props.tag;
|
|
73
|
+
});
|
|
74
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.inputDate || {} })({
|
|
75
|
+
color: color.value,
|
|
76
|
+
size: inputSize.value,
|
|
77
|
+
loading: props.loading,
|
|
78
|
+
highlight: highlight.value,
|
|
79
|
+
rounded: Boolean(props.rounded),
|
|
80
|
+
noPadding: Boolean(props.noPadding),
|
|
81
|
+
noBorder: Boolean(props.noBorder),
|
|
82
|
+
underline: Boolean(props.underline),
|
|
83
|
+
leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
|
|
84
|
+
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
85
|
+
fieldGroup: orientation.value
|
|
86
|
+
}));
|
|
87
|
+
const inputsRef = ref([]);
|
|
88
|
+
function onUpdate(value) {
|
|
89
|
+
const event = new Event("change", { target: { value } });
|
|
90
|
+
emits("change", event);
|
|
91
|
+
emitFormChange();
|
|
92
|
+
emitFormInput();
|
|
93
|
+
}
|
|
94
|
+
function onBlur(event) {
|
|
95
|
+
emitFormBlur();
|
|
96
|
+
emits("blur", event);
|
|
97
|
+
}
|
|
98
|
+
function onFocus(event) {
|
|
99
|
+
emitFormFocus();
|
|
100
|
+
emits("focus", event);
|
|
101
|
+
}
|
|
102
|
+
function autoFocus() {
|
|
103
|
+
if (props.autofocus) {
|
|
104
|
+
inputsRef.value[0]?.$el?.focus();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
onMounted(() => {
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
autoFocus();
|
|
110
|
+
}, props.autofocusDelay);
|
|
111
|
+
});
|
|
112
|
+
const DateField = computed(() => props.range ? RangeDateField : SingleDateField);
|
|
113
|
+
defineExpose({
|
|
114
|
+
inputsRef
|
|
115
|
+
});
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<template>
|
|
119
|
+
<DefineSegmentsTemplate v-slot="{ segments, type }">
|
|
120
|
+
<DateField.Input
|
|
121
|
+
v-for="(segment, index) in segments"
|
|
122
|
+
:key="`${segment.part}-${index}`"
|
|
123
|
+
:ref="(el) => inputsRef[index] = el"
|
|
124
|
+
:type="type"
|
|
125
|
+
:part="segment.part"
|
|
126
|
+
:class="b24ui.segment({ class: props.b24ui?.segment })"
|
|
127
|
+
:data-segment="segment.part"
|
|
128
|
+
>
|
|
129
|
+
{{ segment.value.trim() }}
|
|
130
|
+
</DateField.Input>
|
|
131
|
+
</DefineSegmentsTemplate>
|
|
132
|
+
|
|
133
|
+
<DateField.Root
|
|
134
|
+
v-bind="{ ...rootProps, ...$attrs, ...ariaAttrs }"
|
|
135
|
+
:id="id"
|
|
136
|
+
v-slot="{ segments }"
|
|
137
|
+
:model-value="modelValue"
|
|
138
|
+
:default-value="defaultValue"
|
|
139
|
+
:name="name"
|
|
140
|
+
:disabled="disabled"
|
|
141
|
+
:locale="locale"
|
|
142
|
+
:dir="dir"
|
|
143
|
+
:class="b24ui.base({ class: [props.b24ui?.base, props.class] })"
|
|
144
|
+
@update:model-value="onUpdate"
|
|
145
|
+
@blur="onBlur"
|
|
146
|
+
@focus="onFocus"
|
|
147
|
+
>
|
|
148
|
+
<B24Badge
|
|
149
|
+
v-if="isTag"
|
|
150
|
+
:class="b24ui.tag({ class: props.b24ui?.tag })"
|
|
151
|
+
:color="props.tagColor"
|
|
152
|
+
:label="props.tag"
|
|
153
|
+
size="xs"
|
|
154
|
+
/>
|
|
155
|
+
|
|
156
|
+
<template v-if="Array.isArray(segments)">
|
|
157
|
+
<ReuseSegmentsTemplate :segments="segments" />
|
|
158
|
+
</template>
|
|
159
|
+
<template v-else>
|
|
160
|
+
<ReuseSegmentsTemplate :segments="segments.start" type="start" />
|
|
161
|
+
<slot name="separator" :b24ui="b24ui">
|
|
162
|
+
<Component
|
|
163
|
+
:is="separatorIcon || icons.minus"
|
|
164
|
+
:class="b24ui.separatorIcon({ class: props.b24ui?.separatorIcon })"
|
|
165
|
+
/>
|
|
166
|
+
</slot>
|
|
167
|
+
<ReuseSegmentsTemplate :segments="segments.end" type="end" />
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<slot :b24ui="b24ui" />
|
|
171
|
+
|
|
172
|
+
<span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
|
|
173
|
+
<slot name="leading" :b24ui="b24ui">
|
|
174
|
+
<Component
|
|
175
|
+
:is="leadingIconName"
|
|
176
|
+
v-if="isLeading && leadingIconName"
|
|
177
|
+
:class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
|
|
178
|
+
/>
|
|
179
|
+
<B24Avatar
|
|
180
|
+
v-else-if="!!avatar"
|
|
181
|
+
:size="props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()"
|
|
182
|
+
v-bind="avatar"
|
|
183
|
+
:class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })"
|
|
184
|
+
/>
|
|
185
|
+
</slot>
|
|
186
|
+
</span>
|
|
187
|
+
|
|
188
|
+
<span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
|
|
189
|
+
<slot name="trailing" :b24ui="b24ui">
|
|
190
|
+
<Component
|
|
191
|
+
:is="trailingIconName"
|
|
192
|
+
v-if="trailingIconName"
|
|
193
|
+
:class="b24ui.trailingIcon({ class: props.b24ui?.trailingIcon })"
|
|
194
|
+
/>
|
|
195
|
+
</slot>
|
|
196
|
+
</span>
|
|
197
|
+
</DateField.Root>
|
|
198
|
+
</template>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { ComponentPublicInstance } from 'vue';
|
|
2
|
+
import type { DateFieldRootProps, DateFieldRootEmits, DateRangeFieldRootProps, DateRangeFieldRootEmits, DateValue } from 'reka-ui';
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
4
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
5
|
+
import type { BadgeProps, IconComponent } from '../types';
|
|
6
|
+
import type { ComponentConfig } from '../types/tv';
|
|
7
|
+
import theme from '#build/b24ui/input-date';
|
|
8
|
+
type InputDate = ComponentConfig<typeof theme, AppConfig, 'inputDate'>;
|
|
9
|
+
type _DateFieldRootProps = Omit<DateFieldRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale'>;
|
|
10
|
+
type _RangeDateFieldRootProps = Omit<DateRangeFieldRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale'>;
|
|
11
|
+
type InputDateDefaultValue<R extends boolean = false> = R extends true ? DateRangeFieldRootProps['defaultValue'] : DateFieldRootProps['defaultValue'];
|
|
12
|
+
type InputDateModelValue<R extends boolean = false> = (R extends true ? DateRangeFieldRootProps['modelValue'] : DateFieldRootProps['modelValue']) | undefined;
|
|
13
|
+
export interface InputDateProps<R extends boolean = false> extends UseComponentIconsProps, _DateFieldRootProps, _RangeDateFieldRootProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any;
|
|
19
|
+
/**
|
|
20
|
+
* @defaultValue 'air-primary'
|
|
21
|
+
*/
|
|
22
|
+
color?: InputDate['variants']['color'];
|
|
23
|
+
/**
|
|
24
|
+
* @defaultValue 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: InputDate['variants']['size'];
|
|
27
|
+
/**
|
|
28
|
+
* Removes padding from input
|
|
29
|
+
* @defaultValue false
|
|
30
|
+
*/
|
|
31
|
+
noPadding?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Removes all borders (rings)
|
|
34
|
+
* @defaultValue false
|
|
35
|
+
*/
|
|
36
|
+
noBorder?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Removes all borders (rings) except the bottom one
|
|
39
|
+
* @defaultValue false
|
|
40
|
+
*/
|
|
41
|
+
underline?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Rounds the corners of the input
|
|
44
|
+
* @defaultValue false
|
|
45
|
+
*/
|
|
46
|
+
rounded?: boolean;
|
|
47
|
+
tag?: string;
|
|
48
|
+
/**
|
|
49
|
+
* @defaultValue 'air-primary'
|
|
50
|
+
*/
|
|
51
|
+
tagColor?: BadgeProps['color'];
|
|
52
|
+
/** Highlight the ring color like a focus state. */
|
|
53
|
+
highlight?: boolean;
|
|
54
|
+
autofocus?: boolean;
|
|
55
|
+
autofocusDelay?: number;
|
|
56
|
+
/**
|
|
57
|
+
* The icon to use as a range separator.
|
|
58
|
+
* @defaultValue icons.minus
|
|
59
|
+
* @IconComponent
|
|
60
|
+
*/
|
|
61
|
+
separatorIcon?: IconComponent;
|
|
62
|
+
/** Whether or not a range of dates can be selected */
|
|
63
|
+
range?: R & boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The locale to use for formatting and parsing numbers.
|
|
66
|
+
* @defaultValue B24App.locale.code
|
|
67
|
+
*/
|
|
68
|
+
locale?: string;
|
|
69
|
+
defaultValue?: InputDateDefaultValue<R>;
|
|
70
|
+
modelValue?: InputDateModelValue<R>;
|
|
71
|
+
class?: any;
|
|
72
|
+
b24ui?: InputDate['slots'];
|
|
73
|
+
}
|
|
74
|
+
export interface InputDateEmits<R extends boolean> extends Omit<DateFieldRootEmits & DateRangeFieldRootEmits, 'update:modelValue'> {
|
|
75
|
+
'update:modelValue': [date: InputDateModelValue<R>];
|
|
76
|
+
'change': [event: Event];
|
|
77
|
+
'blur': [event: FocusEvent];
|
|
78
|
+
'focus': [event: FocusEvent];
|
|
79
|
+
}
|
|
80
|
+
export interface InputDateSlots {
|
|
81
|
+
leading(props: {
|
|
82
|
+
b24ui: InputDate['b24ui'];
|
|
83
|
+
}): any;
|
|
84
|
+
default(props: {
|
|
85
|
+
b24ui: InputDate['b24ui'];
|
|
86
|
+
}): any;
|
|
87
|
+
trailing(props: {
|
|
88
|
+
b24ui: InputDate['b24ui'];
|
|
89
|
+
}): any;
|
|
90
|
+
separator(props: {
|
|
91
|
+
b24ui: InputDate['b24ui'];
|
|
92
|
+
}): any;
|
|
93
|
+
}
|
|
94
|
+
declare const __VLS_export: <R extends boolean>(__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<{
|
|
95
|
+
props: __VLS_PrettifyLocal<InputDateProps<R> & {
|
|
96
|
+
onChange?: ((event: Event) => any) | undefined;
|
|
97
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
98
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
99
|
+
"onUpdate:modelValue"?: ((date: InputDateModelValue<R>) => any) | undefined;
|
|
100
|
+
"onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
|
|
101
|
+
}> & import("vue").PublicProps;
|
|
102
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
103
|
+
inputsRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
|
|
104
|
+
}>) => void;
|
|
105
|
+
attrs: any;
|
|
106
|
+
slots: InputDateSlots;
|
|
107
|
+
emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:modelValue", date: InputDateModelValue<R>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void);
|
|
108
|
+
}>) => import("vue").VNode & {
|
|
109
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
110
|
+
};
|
|
111
|
+
declare const _default: typeof __VLS_export;
|
|
112
|
+
export default _default;
|
|
113
|
+
type __VLS_PrettifyLocal<T> = {
|
|
114
|
+
[K in keyof T as K]: T[K];
|
|
115
|
+
} & {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { nextTick } from 'vue';
|
|
2
|
-
import type { InputHTMLAttributes } from 'vue';
|
|
3
1
|
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxContentEmits, ComboboxArrowProps } from 'reka-ui';
|
|
4
2
|
import type { AppConfig } from '@nuxt/schema';
|
|
5
3
|
import theme from '#build/b24ui/input-menu';
|
|
6
4
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
7
5
|
import type { AvatarProps, ChipProps, BadgeProps, IconComponent } from '../types';
|
|
6
|
+
import type { InputHTMLAttributes } from '../types/html';
|
|
8
7
|
import type { AcceptableValue, ArrayOrNested, GetItemKeys, GetModelValue, GetModelValueEmits, NestedItem, EmitsToProps } from '../types/utils';
|
|
9
8
|
import type { ComponentConfig } from '../types/tv';
|
|
10
9
|
type InputMenu = ComponentConfig<typeof theme, AppConfig, 'inputMenu'>;
|
|
@@ -30,7 +29,7 @@ export type InputMenuItem = InputMenuValue | {
|
|
|
30
29
|
b24ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>;
|
|
31
30
|
[key: string]: any;
|
|
32
31
|
};
|
|
33
|
-
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' | 'resetSearchTermOnSelect' | 'highlightOnHover' | 'openOnClick' | 'openOnFocus'>, UseComponentIconsProps {
|
|
32
|
+
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' | 'resetSearchTermOnSelect' | 'highlightOnHover' | 'openOnClick' | 'openOnFocus'>, UseComponentIconsProps, /** @vue-ignore */ Omit<InputHTMLAttributes, 'disabled' | 'name' | 'type' | 'placeholder' | 'autofocus' | 'maxlength' | 'minlength' | 'pattern' | 'size' | 'min' | 'max' | 'step'> {
|
|
34
33
|
/**
|
|
35
34
|
* The element or component this component should render as.
|
|
36
35
|
* @defaultValue 'div'
|
|
@@ -59,7 +58,7 @@ export interface InputMenuProps<T extends ArrayOrNested<InputMenuItem> = ArrayOr
|
|
|
59
58
|
*/
|
|
60
59
|
underline?: boolean;
|
|
61
60
|
/**
|
|
62
|
-
* Rounds the corners of the
|
|
61
|
+
* Rounds the corners of the input
|
|
63
62
|
* @defaultValue false
|
|
64
63
|
*/
|
|
65
64
|
rounded?: boolean;
|
|
@@ -226,11 +225,11 @@ declare const __VLS_export: <T extends ArrayOrNested<InputMenuItem>, VK extends
|
|
|
226
225
|
props: __VLS_PrettifyLocal<(InputMenuProps<T, VK, M> & {
|
|
227
226
|
searchTerm?: string;
|
|
228
227
|
}) & {
|
|
229
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
230
228
|
onChange?: ((event: Event) => any) | undefined;
|
|
229
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
231
230
|
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
232
|
-
onCreate?: ((item: string) => any) | undefined;
|
|
233
231
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
232
|
+
onCreate?: ((item: string) => any) | undefined;
|
|
234
233
|
"onUpdate:modelValue"?: ((value: GetModelValue<T, VK, M>) => any) | undefined;
|
|
235
234
|
onHighlight?: ((payload: {
|
|
236
235
|
ref: HTMLElement;
|
|
@@ -240,131 +239,11 @@ declare const __VLS_export: <T extends ArrayOrNested<InputMenuItem>, VK extends
|
|
|
240
239
|
"onRemove-tag"?: ((item: GetModelValue<T, VK, M>) => any) | undefined;
|
|
241
240
|
}> & import("vue").PublicProps;
|
|
242
241
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
243
|
-
inputRef: import("vue").Ref<
|
|
244
|
-
$: import("vue").ComponentInternalInstance;
|
|
245
|
-
$data: {};
|
|
246
|
-
$props: {
|
|
247
|
-
readonly displayValue?: ((val: any) => string) | undefined;
|
|
248
|
-
readonly modelValue?: string | undefined;
|
|
249
|
-
readonly autoFocus?: boolean | undefined;
|
|
250
|
-
readonly disabled?: boolean | undefined;
|
|
251
|
-
readonly asChild?: boolean | undefined;
|
|
252
|
-
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
253
|
-
readonly "onUpdate:modelValue"?: ((args_0: string) => any) | undefined | undefined;
|
|
254
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
255
|
-
$attrs: {
|
|
256
|
-
[x: string]: unknown;
|
|
257
|
-
};
|
|
258
|
-
$refs: {
|
|
259
|
-
[x: string]: unknown;
|
|
260
|
-
};
|
|
261
|
-
$slots: Readonly<{
|
|
262
|
-
[name: string]: import("vue").Slot<any> | undefined;
|
|
263
|
-
}>;
|
|
264
|
-
$root: import("vue").ComponentPublicInstance | null;
|
|
265
|
-
$parent: import("vue").ComponentPublicInstance | null;
|
|
266
|
-
$host: Element | null;
|
|
267
|
-
$emit: (event: "update:modelValue", args_0: string) => void;
|
|
268
|
-
$el: any;
|
|
269
|
-
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
|
|
270
|
-
"onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
|
|
271
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
272
|
-
"update:modelValue": (args_0: string) => any;
|
|
273
|
-
}, string, {
|
|
274
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
275
|
-
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
276
|
-
beforeCreate?: (() => void) | (() => void)[];
|
|
277
|
-
created?: (() => void) | (() => void)[];
|
|
278
|
-
beforeMount?: (() => void) | (() => void)[];
|
|
279
|
-
mounted?: (() => void) | (() => void)[];
|
|
280
|
-
beforeUpdate?: (() => void) | (() => void)[];
|
|
281
|
-
updated?: (() => void) | (() => void)[];
|
|
282
|
-
activated?: (() => void) | (() => void)[];
|
|
283
|
-
deactivated?: (() => void) | (() => void)[];
|
|
284
|
-
beforeDestroy?: (() => void) | (() => void)[];
|
|
285
|
-
beforeUnmount?: (() => void) | (() => void)[];
|
|
286
|
-
destroyed?: (() => void) | (() => void)[];
|
|
287
|
-
unmounted?: (() => void) | (() => void)[];
|
|
288
|
-
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
289
|
-
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
290
|
-
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
291
|
-
};
|
|
292
|
-
$forceUpdate: () => void;
|
|
293
|
-
$nextTick: typeof nextTick;
|
|
294
|
-
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
295
|
-
} & Readonly<{
|
|
296
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
297
|
-
}> & Omit<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
|
|
298
|
-
"onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
|
|
299
|
-
}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
300
|
-
$slots: {
|
|
301
|
-
default?: (props: {}) => any;
|
|
302
|
-
};
|
|
303
|
-
}) | null, ({
|
|
304
|
-
$: import("vue").ComponentInternalInstance;
|
|
305
|
-
$data: {};
|
|
306
|
-
$props: {
|
|
307
|
-
readonly displayValue?: ((val: any) => string) | undefined;
|
|
308
|
-
readonly modelValue?: string | undefined;
|
|
309
|
-
readonly autoFocus?: boolean | undefined;
|
|
310
|
-
readonly disabled?: boolean | undefined;
|
|
311
|
-
readonly asChild?: boolean | undefined;
|
|
312
|
-
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
313
|
-
readonly "onUpdate:modelValue"?: ((args_0: string) => any) | undefined | undefined;
|
|
314
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
315
|
-
$attrs: {
|
|
316
|
-
[x: string]: unknown;
|
|
317
|
-
};
|
|
318
|
-
$refs: {
|
|
319
|
-
[x: string]: unknown;
|
|
320
|
-
};
|
|
321
|
-
$slots: Readonly<{
|
|
322
|
-
[name: string]: import("vue").Slot<any> | undefined;
|
|
323
|
-
}>;
|
|
324
|
-
$root: import("vue").ComponentPublicInstance | null;
|
|
325
|
-
$parent: import("vue").ComponentPublicInstance | null;
|
|
326
|
-
$host: Element | null;
|
|
327
|
-
$emit: (event: "update:modelValue", args_0: string) => void;
|
|
328
|
-
$el: any;
|
|
329
|
-
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
|
|
330
|
-
"onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
|
|
331
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
332
|
-
"update:modelValue": (args_0: string) => any;
|
|
333
|
-
}, string, {
|
|
334
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
335
|
-
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
336
|
-
beforeCreate?: (() => void) | (() => void)[];
|
|
337
|
-
created?: (() => void) | (() => void)[];
|
|
338
|
-
beforeMount?: (() => void) | (() => void)[];
|
|
339
|
-
mounted?: (() => void) | (() => void)[];
|
|
340
|
-
beforeUpdate?: (() => void) | (() => void)[];
|
|
341
|
-
updated?: (() => void) | (() => void)[];
|
|
342
|
-
activated?: (() => void) | (() => void)[];
|
|
343
|
-
deactivated?: (() => void) | (() => void)[];
|
|
344
|
-
beforeDestroy?: (() => void) | (() => void)[];
|
|
345
|
-
beforeUnmount?: (() => void) | (() => void)[];
|
|
346
|
-
destroyed?: (() => void) | (() => void)[];
|
|
347
|
-
unmounted?: (() => void) | (() => void)[];
|
|
348
|
-
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
349
|
-
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
350
|
-
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
351
|
-
};
|
|
352
|
-
$forceUpdate: () => void;
|
|
353
|
-
$nextTick: typeof nextTick;
|
|
354
|
-
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
355
|
-
} & Readonly<{
|
|
356
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
357
|
-
}> & Omit<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
|
|
358
|
-
"onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
|
|
359
|
-
}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
360
|
-
$slots: {
|
|
361
|
-
default?: (props: {}) => any;
|
|
362
|
-
};
|
|
363
|
-
}) | null>;
|
|
242
|
+
inputRef: Readonly<import("vue").Ref<HTMLInputElement, HTMLInputElement>>;
|
|
364
243
|
}>) => void;
|
|
365
244
|
attrs: any;
|
|
366
245
|
slots: InputMenuSlots<T, VK, M, NestedItem<T>>;
|
|
367
|
-
emit: (((evt: "
|
|
246
|
+
emit: (((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "create", item: string) => void) & ((evt: "update:modelValue", value: GetModelValue<T, VK, M>) => void) & ((evt: "highlight", payload: {
|
|
368
247
|
ref: HTMLElement;
|
|
369
248
|
value: GetModelValue<T, VK, M>;
|
|
370
249
|
} | undefined) => void) & ((evt: "remove-tag", item: GetModelValue<T, VK, M>) => void)) & ((evt: "update:searchTerm", value: string) => void);
|
|
@@ -3,7 +3,7 @@ import theme from "#build/b24ui/input-menu";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed,
|
|
6
|
+
import { computed, useTemplateRef, toRef, onMounted, toRaw, nextTick } from "vue";
|
|
7
7
|
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxVirtualizer, 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";
|
|
@@ -169,7 +169,7 @@ const createItem = computed(() => {
|
|
|
169
169
|
return !filteredItems.value.length;
|
|
170
170
|
});
|
|
171
171
|
const createItemPosition = computed(() => typeof props.createItem === "object" ? props.createItem.position : "bottom");
|
|
172
|
-
const inputRef =
|
|
172
|
+
const inputRef = useTemplateRef("inputRef");
|
|
173
173
|
function autoFocus() {
|
|
174
174
|
if (props.autofocus) {
|
|
175
175
|
inputRef.value?.$el?.focus();
|
|
@@ -244,7 +244,7 @@ function isInputItem(item) {
|
|
|
244
244
|
return typeof item === "object" && item !== null;
|
|
245
245
|
}
|
|
246
246
|
defineExpose({
|
|
247
|
-
inputRef
|
|
247
|
+
inputRef: toRef(() => inputRef.value?.$el)
|
|
248
248
|
});
|
|
249
249
|
</script>
|
|
250
250
|
|