@auronui/vue 1.0.12 → 1.0.14
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/cjs/index.cjs +798 -723
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js.map +1 -1
- package/dist/components/autocomplete/Autocomplete.vue_vue_type_script_setup_true_lang.js +22 -3
- package/dist/components/autocomplete/Autocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/combo-box/ComboBox.vue_vue_type_script_setup_true_lang.js +20 -2
- package/dist/components/combo-box/ComboBox.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/select/Select.context.js.map +1 -1
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/Select.vue_vue_type_script_setup_true_lang.js +33 -5
- package/dist/components/select/Select.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/select/SelectItem.js.map +1 -1
- package/dist/components/select/SelectItem.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/select/SelectItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/select/SelectOverflowChips.js.map +1 -1
- package/dist/components/select/SelectOverflowChips.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/select/SelectValue.js.map +1 -1
- package/dist/components/select/SelectValue.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/select/SelectValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/TabList.js.map +1 -1
- package/dist/components/tabs/TabList.vue_vue_type_script_setup_true_lang.js +15 -14
- package/dist/components/tabs/TabList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/index.d.ts +49 -212
- package/dist/index.js +3 -3
- package/dist/utils/hasSlotComponent.js +26 -0
- package/dist/utils/hasSlotComponent.js.map +1 -0
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -13430,12 +13430,10 @@ var TabList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
13430
13430
|
}, { immediate: true });
|
|
13431
13431
|
(0, _vueuse_core.useResizeObserver)(scrollWrapperEl, () => (0, vue.nextTick)(updateScrollButtons));
|
|
13432
13432
|
const containerEl = (0, vue.useTemplateRef)("containerEl");
|
|
13433
|
-
const moreBtnEl = (0, vue.useTemplateRef)("moreBtnEl");
|
|
13434
13433
|
const dropdownEl = (0, vue.useTemplateRef)("dropdownEl");
|
|
13435
13434
|
const hiddenTabs = (0, vue.ref)([]);
|
|
13436
13435
|
const dropdownOpen = (0, vue.ref)(false);
|
|
13437
13436
|
const hasOverflow = (0, vue.computed)(() => hiddenTabs.value.length > 0);
|
|
13438
|
-
let moreBtnNaturalWidth = 48;
|
|
13439
13437
|
(0, _vueuse_core.onClickOutside)(dropdownEl, () => {
|
|
13440
13438
|
dropdownOpen.value = false;
|
|
13441
13439
|
});
|
|
@@ -13452,7 +13450,19 @@ var TabList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
13452
13450
|
});
|
|
13453
13451
|
listEl.offsetWidth;
|
|
13454
13452
|
}
|
|
13455
|
-
|
|
13453
|
+
let moreWidth = 0;
|
|
13454
|
+
const moreEl = dropdownEl.value;
|
|
13455
|
+
if (moreEl) {
|
|
13456
|
+
const prevDisplay = moreEl.style.display;
|
|
13457
|
+
moreEl.style.display = "flex";
|
|
13458
|
+
moreEl.offsetWidth;
|
|
13459
|
+
moreWidth = moreEl.offsetWidth;
|
|
13460
|
+
moreEl.style.display = prevDisplay;
|
|
13461
|
+
}
|
|
13462
|
+
const cs = getComputedStyle(containerEl.value);
|
|
13463
|
+
const padX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
|
|
13464
|
+
const gap = parseFloat(cs.columnGap) || 0;
|
|
13465
|
+
const contentWidth = containerEl.value.clientWidth - padX;
|
|
13456
13466
|
const tabWidths = allTabs.map((t) => t.offsetWidth);
|
|
13457
13467
|
const totalWidth = tabWidths.reduce((sum, w) => sum + w, 0);
|
|
13458
13468
|
if (listEl) {
|
|
@@ -13462,11 +13472,11 @@ var TabList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
13462
13472
|
t.style.width = "";
|
|
13463
13473
|
});
|
|
13464
13474
|
}
|
|
13465
|
-
if (totalWidth <=
|
|
13475
|
+
if (totalWidth <= contentWidth) {
|
|
13466
13476
|
hiddenTabs.value = [];
|
|
13467
13477
|
return;
|
|
13468
13478
|
}
|
|
13469
|
-
const available =
|
|
13479
|
+
const available = contentWidth - moreWidth - gap - 1;
|
|
13470
13480
|
let accumulated = 0;
|
|
13471
13481
|
const newHidden = [];
|
|
13472
13482
|
const visibleEls = [];
|
|
@@ -13508,13 +13518,6 @@ var TabList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
13508
13518
|
}
|
|
13509
13519
|
(0, _vueuse_core.useResizeObserver)(containerEl, () => (0, vue.nextTick)(computeOverflow));
|
|
13510
13520
|
(0, vue.onMounted)(() => {
|
|
13511
|
-
const btnEl = moreBtnEl.value?.$el;
|
|
13512
|
-
if (btnEl) {
|
|
13513
|
-
btnEl.style.display = "flex";
|
|
13514
|
-
btnEl.offsetWidth;
|
|
13515
|
-
moreBtnNaturalWidth = btnEl.offsetWidth;
|
|
13516
|
-
btnEl.style.display = "";
|
|
13517
|
-
}
|
|
13518
13521
|
(0, vue.nextTick)(computeOverflow);
|
|
13519
13522
|
});
|
|
13520
13523
|
(0, vue.watch)(() => ctx.currentValue.value, () => {
|
|
@@ -13619,8 +13622,6 @@ var TabList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
13619
13622
|
ref: dropdownEl,
|
|
13620
13623
|
class: (0, vue.normalizeClass)(["tabs__more", { "tabs__more--visible": hasOverflow.value }])
|
|
13621
13624
|
}, [(0, vue.createVNode)(Button_default, {
|
|
13622
|
-
ref_key: "moreBtnEl",
|
|
13623
|
-
ref: moreBtnEl,
|
|
13624
13625
|
variant: "secondary",
|
|
13625
13626
|
size: "sm",
|
|
13626
13627
|
radius: "full",
|
|
@@ -15131,186 +15132,31 @@ var ListBoxSection_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15131
15132
|
//#region src/components/select/Select.context.ts
|
|
15132
15133
|
var { useProvide: useSelectProvide, useInject: useSelectInject, key: selectContextKey } = createContext("Select");
|
|
15133
15134
|
//#endregion
|
|
15134
|
-
//#region src/
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
//#region src/components/select/Select.vue
|
|
15152
|
-
var Select_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
15153
|
-
inheritAttrs: false,
|
|
15154
|
-
__name: "Select",
|
|
15155
|
-
props: {
|
|
15156
|
-
variant: { default: "flat" },
|
|
15157
|
-
size: { default: "md" },
|
|
15158
|
-
color: { default: "default" },
|
|
15159
|
-
labelPlacement: { default: "inside" },
|
|
15160
|
-
fullWidth: {
|
|
15161
|
-
type: Boolean,
|
|
15162
|
-
default: false
|
|
15163
|
-
},
|
|
15164
|
-
isInvalid: {
|
|
15165
|
-
type: Boolean,
|
|
15166
|
-
default: false
|
|
15167
|
-
},
|
|
15168
|
-
isDisabled: {
|
|
15169
|
-
type: Boolean,
|
|
15170
|
-
default: false
|
|
15171
|
-
},
|
|
15172
|
-
isReadonly: {
|
|
15173
|
-
type: Boolean,
|
|
15174
|
-
default: false
|
|
15175
|
-
},
|
|
15176
|
-
isRequired: {
|
|
15177
|
-
type: Boolean,
|
|
15178
|
-
default: false
|
|
15179
|
-
},
|
|
15180
|
-
placeholder: {},
|
|
15181
|
-
name: {},
|
|
15182
|
-
label: {},
|
|
15183
|
-
description: {},
|
|
15184
|
-
errorMessage: {},
|
|
15185
|
-
class: {},
|
|
15186
|
-
modelValue: { default: void 0 },
|
|
15187
|
-
defaultValue: { default: void 0 },
|
|
15188
|
-
multiple: {
|
|
15189
|
-
type: Boolean,
|
|
15190
|
-
default: false
|
|
15191
|
-
},
|
|
15192
|
-
open: {
|
|
15193
|
-
type: Boolean,
|
|
15194
|
-
default: void 0
|
|
15195
|
-
},
|
|
15196
|
-
defaultOpen: {
|
|
15197
|
-
type: Boolean,
|
|
15198
|
-
default: void 0
|
|
15199
|
-
}
|
|
15200
|
-
},
|
|
15201
|
-
emits: ["update:modelValue", "update:open"],
|
|
15202
|
-
setup(__props, { emit: __emit }) {
|
|
15203
|
-
const props = __props;
|
|
15204
|
-
const emit = __emit;
|
|
15205
|
-
const attrs = (0, vue.useAttrs)();
|
|
15206
|
-
const generatedId = (0, vue.useId)();
|
|
15207
|
-
const triggerId = (0, vue.computed)(() => attrs.id ?? generatedId);
|
|
15208
|
-
const hasLabel = (0, vue.computed)(() => !!props.label);
|
|
15209
|
-
const descriptionId = (0, vue.computed)(() => `${triggerId.value}-description`);
|
|
15210
|
-
const errorMessageId = (0, vue.computed)(() => `${triggerId.value}-error`);
|
|
15211
|
-
const showError = (0, vue.computed)(() => props.isInvalid && !!props.errorMessage);
|
|
15212
|
-
const showDescription = (0, vue.computed)(() => !!props.description && !showError.value);
|
|
15213
|
-
const hasHelper = (0, vue.computed)(() => showError.value || showDescription.value);
|
|
15214
|
-
const ariaDescribedBy = (0, vue.computed)(() => {
|
|
15215
|
-
if (showError.value) return errorMessageId.value;
|
|
15216
|
-
if (showDescription.value) return descriptionId.value;
|
|
15217
|
-
});
|
|
15218
|
-
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.selectVariants)({
|
|
15219
|
-
variant: props.variant,
|
|
15220
|
-
size: props.size,
|
|
15221
|
-
color: props.color,
|
|
15222
|
-
fullWidth: props.fullWidth,
|
|
15223
|
-
isInvalid: props.isInvalid,
|
|
15224
|
-
isDisabled: props.isDisabled,
|
|
15225
|
-
isReadonly: props.isReadonly,
|
|
15226
|
-
hasLabel: hasLabel.value,
|
|
15227
|
-
labelPlacement: props.labelPlacement
|
|
15228
|
-
}));
|
|
15229
|
-
const showOutsideLabel = (0, vue.computed)(() => hasLabel.value && props.labelPlacement !== "inside");
|
|
15230
|
-
const itemRegistry = (0, vue.reactive)(/* @__PURE__ */ new Map());
|
|
15231
|
-
const registerItem = (value, label) => {
|
|
15232
|
-
itemRegistry.set(value, label);
|
|
15233
|
-
};
|
|
15234
|
-
const itemLabel = (value) => {
|
|
15235
|
-
if (value == null) return "";
|
|
15236
|
-
if (Array.isArray(value)) return value.map((v) => itemRegistry.get(v) ?? v).filter(Boolean).join(", ");
|
|
15237
|
-
return itemRegistry.get(value) ?? value;
|
|
15238
|
-
};
|
|
15239
|
-
function removeValue(value) {
|
|
15240
|
-
emit("update:modelValue", (Array.isArray(props.modelValue) ? props.modelValue : []).filter((v) => v !== value));
|
|
15135
|
+
//#region src/utils/hasSlotComponent.ts
|
|
15136
|
+
/**
|
|
15137
|
+
* Returns true if any vnode in `nodes` has a `type` referentially equal to one
|
|
15138
|
+
* of `components`, recursively flattening `Fragment` (v-for / template) children.
|
|
15139
|
+
*
|
|
15140
|
+
* Dropdown form controls (Select, Autocomplete, ComboBox) use this to detect
|
|
15141
|
+
* whether the consumer supplied explicit compound chrome (e.g. SelectTrigger /
|
|
15142
|
+
* SelectContent) versus terse `*Item` children or an `items` prop. When chrome
|
|
15143
|
+
* is present the control passes the slot through unchanged; otherwise it renders
|
|
15144
|
+
* the trigger/value/content internally.
|
|
15145
|
+
*/
|
|
15146
|
+
function hasSlotComponent(nodes, components) {
|
|
15147
|
+
if (!nodes) return false;
|
|
15148
|
+
for (const node of nodes) {
|
|
15149
|
+
if (components.includes(node.type)) return true;
|
|
15150
|
+
if (node.type === vue.Fragment && Array.isArray(node.children)) {
|
|
15151
|
+
if (hasSlotComponent(node.children, components)) return true;
|
|
15241
15152
|
}
|
|
15242
|
-
useSelectProvide({
|
|
15243
|
-
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
15244
|
-
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
15245
|
-
isReadonly: (0, vue.toRef)(props, "isReadonly"),
|
|
15246
|
-
isRequired: (0, vue.toRef)(props, "isRequired"),
|
|
15247
|
-
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
15248
|
-
hasLabel,
|
|
15249
|
-
labelPlacement: (0, vue.toRef)(props, "labelPlacement"),
|
|
15250
|
-
triggerId,
|
|
15251
|
-
label: (0, vue.toRef)(props, "label"),
|
|
15252
|
-
ariaDescribedBy,
|
|
15253
|
-
slots: slotFns,
|
|
15254
|
-
multiple: (0, vue.toRef)(props, "multiple"),
|
|
15255
|
-
registerItem,
|
|
15256
|
-
itemLabel,
|
|
15257
|
-
removeValue
|
|
15258
|
-
});
|
|
15259
|
-
return (_ctx, _cache) => {
|
|
15260
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15261
|
-
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
15262
|
-
"data-invalid": __props.isInvalid || void 0,
|
|
15263
|
-
"data-disabled": __props.isDisabled || void 0,
|
|
15264
|
-
"data-readonly": __props.isReadonly || void 0,
|
|
15265
|
-
"data-required": __props.isRequired || void 0,
|
|
15266
|
-
"data-has-label": hasLabel.value || void 0,
|
|
15267
|
-
"data-has-helper": hasHelper.value || void 0
|
|
15268
|
-
}, [showOutsideLabel.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
15269
|
-
key: 0,
|
|
15270
|
-
for: triggerId.value,
|
|
15271
|
-
class: (0, vue.normalizeClass)(slotFns.value.label())
|
|
15272
|
-
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.label), 1), __props.isRequired ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3$13, " *")) : (0, vue.createCommentVNode)("", true)], 10, _hoisted_2$22)) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(slotFns.value.mainWrapper()) }, [(0, vue.createVNode)((0, vue.unref)(reka_ui.SelectRoot), {
|
|
15273
|
-
"model-value": props.modelValue,
|
|
15274
|
-
"default-value": props.defaultValue,
|
|
15275
|
-
multiple: props.multiple,
|
|
15276
|
-
open: props.open,
|
|
15277
|
-
"default-open": props.defaultOpen,
|
|
15278
|
-
disabled: props.isDisabled,
|
|
15279
|
-
required: props.isRequired,
|
|
15280
|
-
name: props.name,
|
|
15281
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event)),
|
|
15282
|
-
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => emit("update:open", $event))
|
|
15283
|
-
}, {
|
|
15284
|
-
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
15285
|
-
_: 3
|
|
15286
|
-
}, 8, [
|
|
15287
|
-
"model-value",
|
|
15288
|
-
"default-value",
|
|
15289
|
-
"multiple",
|
|
15290
|
-
"open",
|
|
15291
|
-
"default-open",
|
|
15292
|
-
"disabled",
|
|
15293
|
-
"required",
|
|
15294
|
-
"name"
|
|
15295
|
-
]), hasHelper.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15296
|
-
key: 0,
|
|
15297
|
-
class: (0, vue.normalizeClass)(slotFns.value.helperWrapper())
|
|
15298
|
-
}, [showError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15299
|
-
key: 0,
|
|
15300
|
-
id: errorMessageId.value,
|
|
15301
|
-
class: (0, vue.normalizeClass)(slotFns.value.errorMessage())
|
|
15302
|
-
}, (0, vue.toDisplayString)(__props.errorMessage), 11, _hoisted_4$8)) : showDescription.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15303
|
-
key: 1,
|
|
15304
|
-
id: descriptionId.value,
|
|
15305
|
-
class: (0, vue.normalizeClass)(slotFns.value.description())
|
|
15306
|
-
}, (0, vue.toDisplayString)(__props.description), 11, _hoisted_5$6)) : (0, vue.createCommentVNode)("", true)], 2)) : (0, vue.createCommentVNode)("", true)], 2)], 10, _hoisted_1$37);
|
|
15307
|
-
};
|
|
15308
15153
|
}
|
|
15309
|
-
|
|
15154
|
+
return false;
|
|
15155
|
+
}
|
|
15310
15156
|
//#endregion
|
|
15311
15157
|
//#region src/components/select/SelectTrigger.vue?vue&type=script&setup=true&lang.ts
|
|
15312
|
-
var _hoisted_1$
|
|
15313
|
-
var _hoisted_2$
|
|
15158
|
+
var _hoisted_1$37 = ["for"];
|
|
15159
|
+
var _hoisted_2$22 = {
|
|
15314
15160
|
key: 0,
|
|
15315
15161
|
"aria-hidden": "true"
|
|
15316
15162
|
};
|
|
@@ -15345,7 +15191,7 @@ var SelectTrigger_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15345
15191
|
key: 0,
|
|
15346
15192
|
for: (0, vue.unref)(ctx).triggerId.value,
|
|
15347
15193
|
class: (0, vue.normalizeClass)((0, vue.unref)(ctx).slots.value.label())
|
|
15348
|
-
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(ctx).label.value), 1), (0, vue.unref)(ctx).isRequired.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$
|
|
15194
|
+
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(ctx).label.value), 1), (0, vue.unref)(ctx).isRequired.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$22, " *")) : (0, vue.createCommentVNode)("", true)], 10, _hoisted_1$37)) : (0, vue.createCommentVNode)("", true),
|
|
15349
15195
|
_ctx.$slots.startContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
15350
15196
|
key: 1,
|
|
15351
15197
|
class: (0, vue.normalizeClass)((0, vue.unref)(ctx).slots.value.startContent()),
|
|
@@ -15386,7 +15232,7 @@ var SelectTrigger_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15386
15232
|
});
|
|
15387
15233
|
//#endregion
|
|
15388
15234
|
//#region src/components/select/SelectOverflowChips.vue?vue&type=script&setup=true&lang.ts
|
|
15389
|
-
var _hoisted_1$
|
|
15235
|
+
var _hoisted_1$36 = {
|
|
15390
15236
|
ref: "container",
|
|
15391
15237
|
style: {
|
|
15392
15238
|
"display": "flex",
|
|
@@ -15444,7 +15290,7 @@ var SelectOverflowChips_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15444
15290
|
(0, _vueuse_core.useResizeObserver)(containerEl, reflow);
|
|
15445
15291
|
(0, vue.watch)(() => props.values.join("\0"), () => reflow(), { flush: "post" });
|
|
15446
15292
|
return (_ctx, _cache) => {
|
|
15447
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
15293
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$36, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.values, (val, i) => {
|
|
15448
15294
|
return (0, vue.openBlock)(), (0, vue.createBlock)(Chip_default, {
|
|
15449
15295
|
key: val,
|
|
15450
15296
|
"data-chip-item": "",
|
|
@@ -15486,7 +15332,7 @@ var SelectValue_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15486
15332
|
key: 0,
|
|
15487
15333
|
values: modelValue,
|
|
15488
15334
|
"get-label": (0, vue.unref)(ctx).itemLabel
|
|
15489
|
-
}, null, 8, ["values", "get-label"])) : (0, vue.unref)(ctx).multiple.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(props.placeholder), 1)], 64)) : selectedLabel && selectedLabel.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(selectedLabel.join(", ")), 1)], 64)) : modelValue != null && (Array.isArray(modelValue) ? modelValue.length > 0 : modelValue !== "") ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 3 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(ctx).itemLabel(
|
|
15335
|
+
}, null, 8, ["values", "get-label"])) : (0, vue.unref)(ctx).multiple.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(props.placeholder), 1)], 64)) : selectedLabel && selectedLabel.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(selectedLabel.join(", ")), 1)], 64)) : modelValue != null && (Array.isArray(modelValue) ? modelValue.length > 0 : modelValue !== "") ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 3 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(ctx).itemLabel(modelValue)), 1)], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 4 }, [(0, vue.createTextVNode)((0, vue.toDisplayString)(props.placeholder), 1)], 64))]),
|
|
15490
15336
|
_: 1
|
|
15491
15337
|
}, 8, ["class", "placeholder"]);
|
|
15492
15338
|
};
|
|
@@ -15568,14 +15414,14 @@ var SelectItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15568
15414
|
if (props.textValue !== void 0) ctx.registerItem(props.value, props.textValue);
|
|
15569
15415
|
(0, vue.onMounted)(() => {
|
|
15570
15416
|
const el = textRef.value?.$el;
|
|
15571
|
-
const label = props.textValue ?? el?.textContent?.trim() ?? props.value;
|
|
15417
|
+
const label = props.textValue ?? el?.textContent?.trim() ?? String(props.value);
|
|
15572
15418
|
ctx.registerItem(props.value, label);
|
|
15573
15419
|
});
|
|
15574
15420
|
return (_ctx, _cache) => {
|
|
15575
15421
|
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.SelectItem), {
|
|
15576
15422
|
value: props.value,
|
|
15577
15423
|
disabled: props.isDisabled,
|
|
15578
|
-
"text-value": props.textValue ?? props.value,
|
|
15424
|
+
"text-value": props.textValue ?? String(props.value),
|
|
15579
15425
|
class: "list-box-item list-box-item--default",
|
|
15580
15426
|
"data-slot": "list-box-item"
|
|
15581
15427
|
}, {
|
|
@@ -15619,51 +15465,251 @@ var SelectItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15619
15465
|
}
|
|
15620
15466
|
});
|
|
15621
15467
|
//#endregion
|
|
15622
|
-
//#region src/components/
|
|
15623
|
-
var
|
|
15468
|
+
//#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
|
|
15469
|
+
var _hoisted_1$35 = [
|
|
15470
|
+
"data-invalid",
|
|
15471
|
+
"data-disabled",
|
|
15472
|
+
"data-readonly",
|
|
15473
|
+
"data-required",
|
|
15474
|
+
"data-has-label",
|
|
15475
|
+
"data-has-helper"
|
|
15476
|
+
];
|
|
15477
|
+
var _hoisted_2$21 = ["for"];
|
|
15478
|
+
var _hoisted_3$13 = {
|
|
15479
|
+
key: 0,
|
|
15480
|
+
"aria-hidden": "true"
|
|
15481
|
+
};
|
|
15482
|
+
var _hoisted_4$8 = ["id"];
|
|
15483
|
+
var _hoisted_5$6 = ["id"];
|
|
15624
15484
|
//#endregion
|
|
15625
|
-
//#region src/components/
|
|
15626
|
-
var
|
|
15627
|
-
|
|
15485
|
+
//#region src/components/select/Select.vue
|
|
15486
|
+
var Select_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
15487
|
+
inheritAttrs: false,
|
|
15488
|
+
__name: "Select",
|
|
15628
15489
|
props: {
|
|
15629
|
-
|
|
15490
|
+
variant: { default: "flat" },
|
|
15491
|
+
size: { default: "md" },
|
|
15492
|
+
color: { default: "default" },
|
|
15493
|
+
labelPlacement: { default: "inside" },
|
|
15494
|
+
fullWidth: {
|
|
15630
15495
|
type: Boolean,
|
|
15631
|
-
default:
|
|
15496
|
+
default: false
|
|
15632
15497
|
},
|
|
15633
|
-
|
|
15498
|
+
isInvalid: {
|
|
15634
15499
|
type: Boolean,
|
|
15635
|
-
default:
|
|
15500
|
+
default: false
|
|
15636
15501
|
},
|
|
15637
|
-
|
|
15502
|
+
isDisabled: {
|
|
15638
15503
|
type: Boolean,
|
|
15639
|
-
default:
|
|
15504
|
+
default: false
|
|
15640
15505
|
},
|
|
15641
|
-
|
|
15642
|
-
color: { default: void 0 },
|
|
15643
|
-
size: { default: void 0 },
|
|
15644
|
-
closeOnSelect: {
|
|
15506
|
+
isReadonly: {
|
|
15645
15507
|
type: Boolean,
|
|
15646
|
-
default:
|
|
15508
|
+
default: false
|
|
15647
15509
|
},
|
|
15648
|
-
|
|
15510
|
+
isRequired: {
|
|
15649
15511
|
type: Boolean,
|
|
15650
15512
|
default: false
|
|
15651
15513
|
},
|
|
15652
|
-
|
|
15514
|
+
placeholder: {},
|
|
15515
|
+
name: {},
|
|
15516
|
+
label: {},
|
|
15517
|
+
description: {},
|
|
15518
|
+
errorMessage: {},
|
|
15519
|
+
class: {},
|
|
15520
|
+
modelValue: { default: void 0 },
|
|
15521
|
+
defaultValue: { default: void 0 },
|
|
15522
|
+
multiple: {
|
|
15523
|
+
type: Boolean,
|
|
15524
|
+
default: false
|
|
15525
|
+
},
|
|
15526
|
+
open: {
|
|
15527
|
+
type: Boolean,
|
|
15528
|
+
default: void 0
|
|
15529
|
+
},
|
|
15530
|
+
defaultOpen: {
|
|
15531
|
+
type: Boolean,
|
|
15532
|
+
default: void 0
|
|
15533
|
+
},
|
|
15534
|
+
items: { default: () => [] }
|
|
15653
15535
|
},
|
|
15654
|
-
emits: ["update:
|
|
15536
|
+
emits: ["update:modelValue", "update:open"],
|
|
15655
15537
|
setup(__props, { emit: __emit }) {
|
|
15656
15538
|
const props = __props;
|
|
15657
15539
|
const emit = __emit;
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
});
|
|
15665
|
-
|
|
15666
|
-
|
|
15540
|
+
const attrs = (0, vue.useAttrs)();
|
|
15541
|
+
const generatedId = (0, vue.useId)();
|
|
15542
|
+
const triggerId = (0, vue.computed)(() => attrs.id ?? generatedId);
|
|
15543
|
+
const hasLabel = (0, vue.computed)(() => !!props.label);
|
|
15544
|
+
const slots = (0, vue.useSlots)();
|
|
15545
|
+
const usesCustomChrome = (0, vue.computed)(() => hasSlotComponent(slots.default?.(), [SelectTrigger_default, SelectContent_default]));
|
|
15546
|
+
const descriptionId = (0, vue.computed)(() => `${triggerId.value}-description`);
|
|
15547
|
+
const errorMessageId = (0, vue.computed)(() => `${triggerId.value}-error`);
|
|
15548
|
+
const showError = (0, vue.computed)(() => props.isInvalid && !!props.errorMessage);
|
|
15549
|
+
const showDescription = (0, vue.computed)(() => !!props.description && !showError.value);
|
|
15550
|
+
const hasHelper = (0, vue.computed)(() => showError.value || showDescription.value);
|
|
15551
|
+
const ariaDescribedBy = (0, vue.computed)(() => {
|
|
15552
|
+
if (showError.value) return errorMessageId.value;
|
|
15553
|
+
if (showDescription.value) return descriptionId.value;
|
|
15554
|
+
});
|
|
15555
|
+
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.selectVariants)({
|
|
15556
|
+
variant: props.variant,
|
|
15557
|
+
size: props.size,
|
|
15558
|
+
color: props.color,
|
|
15559
|
+
fullWidth: props.fullWidth,
|
|
15560
|
+
isInvalid: props.isInvalid,
|
|
15561
|
+
isDisabled: props.isDisabled,
|
|
15562
|
+
isReadonly: props.isReadonly,
|
|
15563
|
+
hasLabel: hasLabel.value,
|
|
15564
|
+
labelPlacement: props.labelPlacement
|
|
15565
|
+
}));
|
|
15566
|
+
const showOutsideLabel = (0, vue.computed)(() => hasLabel.value && props.labelPlacement !== "inside");
|
|
15567
|
+
const itemRegistry = (0, vue.reactive)(/* @__PURE__ */ new Map());
|
|
15568
|
+
const registerItem = (value, label) => {
|
|
15569
|
+
itemRegistry.set(value, label);
|
|
15570
|
+
};
|
|
15571
|
+
const itemLabel = (value) => {
|
|
15572
|
+
if (value == null) return "";
|
|
15573
|
+
if (Array.isArray(value)) return value.map((v) => String(itemRegistry.get(v) ?? v)).filter((s) => s.length > 0).join(", ");
|
|
15574
|
+
return itemRegistry.get(value) ?? String(value);
|
|
15575
|
+
};
|
|
15576
|
+
function removeValue(value) {
|
|
15577
|
+
emit("update:modelValue", (Array.isArray(props.modelValue) ? props.modelValue : []).filter((v) => v !== value));
|
|
15578
|
+
}
|
|
15579
|
+
useSelectProvide({
|
|
15580
|
+
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
15581
|
+
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
15582
|
+
isReadonly: (0, vue.toRef)(props, "isReadonly"),
|
|
15583
|
+
isRequired: (0, vue.toRef)(props, "isRequired"),
|
|
15584
|
+
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
15585
|
+
hasLabel,
|
|
15586
|
+
labelPlacement: (0, vue.toRef)(props, "labelPlacement"),
|
|
15587
|
+
triggerId,
|
|
15588
|
+
label: (0, vue.toRef)(props, "label"),
|
|
15589
|
+
ariaDescribedBy,
|
|
15590
|
+
slots: slotFns,
|
|
15591
|
+
multiple: (0, vue.toRef)(props, "multiple"),
|
|
15592
|
+
registerItem,
|
|
15593
|
+
itemLabel,
|
|
15594
|
+
removeValue
|
|
15595
|
+
});
|
|
15596
|
+
return (_ctx, _cache) => {
|
|
15597
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15598
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
15599
|
+
"data-invalid": __props.isInvalid || void 0,
|
|
15600
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
15601
|
+
"data-readonly": __props.isReadonly || void 0,
|
|
15602
|
+
"data-required": __props.isRequired || void 0,
|
|
15603
|
+
"data-has-label": hasLabel.value || void 0,
|
|
15604
|
+
"data-has-helper": hasHelper.value || void 0
|
|
15605
|
+
}, [showOutsideLabel.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
15606
|
+
key: 0,
|
|
15607
|
+
for: triggerId.value,
|
|
15608
|
+
class: (0, vue.normalizeClass)(slotFns.value.label())
|
|
15609
|
+
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.label), 1), __props.isRequired ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3$13, " *")) : (0, vue.createCommentVNode)("", true)], 10, _hoisted_2$21)) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(slotFns.value.mainWrapper()) }, [(0, vue.createVNode)((0, vue.unref)(reka_ui.SelectRoot), {
|
|
15610
|
+
"model-value": props.modelValue,
|
|
15611
|
+
"default-value": props.defaultValue,
|
|
15612
|
+
multiple: props.multiple,
|
|
15613
|
+
open: props.open,
|
|
15614
|
+
"default-open": props.defaultOpen,
|
|
15615
|
+
disabled: props.isDisabled,
|
|
15616
|
+
required: props.isRequired,
|
|
15617
|
+
name: props.name,
|
|
15618
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event)),
|
|
15619
|
+
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => emit("update:open", $event))
|
|
15620
|
+
}, {
|
|
15621
|
+
default: (0, vue.withCtx)(() => [usesCustomChrome.value ? (0, vue.renderSlot)(_ctx.$slots, "default", { key: 0 }) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.createVNode)(SelectTrigger_default, null, {
|
|
15622
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)(SelectValue_default, { placeholder: props.placeholder }, null, 8, ["placeholder"])]),
|
|
15623
|
+
_: 1
|
|
15624
|
+
}), (0, vue.createVNode)(SelectContent_default, null, {
|
|
15625
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(props.items, (item) => {
|
|
15626
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(SelectItem_default, {
|
|
15627
|
+
key: item.value,
|
|
15628
|
+
value: item.value,
|
|
15629
|
+
"text-value": item.textValue ?? item.label,
|
|
15630
|
+
"is-disabled": item.isDisabled
|
|
15631
|
+
}, {
|
|
15632
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "item", { item }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(item.label ?? String(item.value)), 1)])]),
|
|
15633
|
+
_: 2
|
|
15634
|
+
}, 1032, [
|
|
15635
|
+
"value",
|
|
15636
|
+
"text-value",
|
|
15637
|
+
"is-disabled"
|
|
15638
|
+
]);
|
|
15639
|
+
}), 128)), (0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
15640
|
+
_: 3
|
|
15641
|
+
})], 64))]),
|
|
15642
|
+
_: 3
|
|
15643
|
+
}, 8, [
|
|
15644
|
+
"model-value",
|
|
15645
|
+
"default-value",
|
|
15646
|
+
"multiple",
|
|
15647
|
+
"open",
|
|
15648
|
+
"default-open",
|
|
15649
|
+
"disabled",
|
|
15650
|
+
"required",
|
|
15651
|
+
"name"
|
|
15652
|
+
]), hasHelper.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15653
|
+
key: 0,
|
|
15654
|
+
class: (0, vue.normalizeClass)(slotFns.value.helperWrapper())
|
|
15655
|
+
}, [showError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15656
|
+
key: 0,
|
|
15657
|
+
id: errorMessageId.value,
|
|
15658
|
+
class: (0, vue.normalizeClass)(slotFns.value.errorMessage())
|
|
15659
|
+
}, (0, vue.toDisplayString)(__props.errorMessage), 11, _hoisted_4$8)) : showDescription.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15660
|
+
key: 1,
|
|
15661
|
+
id: descriptionId.value,
|
|
15662
|
+
class: (0, vue.normalizeClass)(slotFns.value.description())
|
|
15663
|
+
}, (0, vue.toDisplayString)(__props.description), 11, _hoisted_5$6)) : (0, vue.createCommentVNode)("", true)], 2)) : (0, vue.createCommentVNode)("", true)], 2)], 10, _hoisted_1$35);
|
|
15664
|
+
};
|
|
15665
|
+
}
|
|
15666
|
+
});
|
|
15667
|
+
//#endregion
|
|
15668
|
+
//#region src/components/dropdown/Dropdown.context.ts
|
|
15669
|
+
var { useProvide: useDropdownProvide, useInject: useDropdownInject, key: dropdownContextKey } = createContext("Dropdown");
|
|
15670
|
+
//#endregion
|
|
15671
|
+
//#region src/components/dropdown/Dropdown.vue
|
|
15672
|
+
var Dropdown_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
15673
|
+
__name: "Dropdown",
|
|
15674
|
+
props: {
|
|
15675
|
+
isOpen: {
|
|
15676
|
+
type: Boolean,
|
|
15677
|
+
default: void 0
|
|
15678
|
+
},
|
|
15679
|
+
defaultOpen: {
|
|
15680
|
+
type: Boolean,
|
|
15681
|
+
default: void 0
|
|
15682
|
+
},
|
|
15683
|
+
modal: {
|
|
15684
|
+
type: Boolean,
|
|
15685
|
+
default: true
|
|
15686
|
+
},
|
|
15687
|
+
variant: { default: void 0 },
|
|
15688
|
+
color: { default: void 0 },
|
|
15689
|
+
size: { default: void 0 },
|
|
15690
|
+
closeOnSelect: {
|
|
15691
|
+
type: Boolean,
|
|
15692
|
+
default: true
|
|
15693
|
+
},
|
|
15694
|
+
disableAnimation: {
|
|
15695
|
+
type: Boolean,
|
|
15696
|
+
default: false
|
|
15697
|
+
},
|
|
15698
|
+
class: { default: void 0 }
|
|
15699
|
+
},
|
|
15700
|
+
emits: ["update:isOpen"],
|
|
15701
|
+
setup(__props, { emit: __emit }) {
|
|
15702
|
+
const props = __props;
|
|
15703
|
+
const emit = __emit;
|
|
15704
|
+
useDropdownProvide({
|
|
15705
|
+
variant: (0, vue.toRef)(props, "variant"),
|
|
15706
|
+
color: (0, vue.toRef)(props, "color"),
|
|
15707
|
+
size: (0, vue.toRef)(props, "size"),
|
|
15708
|
+
closeOnSelect: (0, vue.toRef)(props, "closeOnSelect"),
|
|
15709
|
+
disableAnimation: (0, vue.toRef)(props, "disableAnimation")
|
|
15710
|
+
});
|
|
15711
|
+
return (_ctx, _cache) => {
|
|
15712
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.DropdownMenuRoot), {
|
|
15667
15713
|
open: props.isOpen,
|
|
15668
15714
|
"default-open": props.defaultOpen,
|
|
15669
15715
|
modal: props.modal,
|
|
@@ -16108,176 +16154,14 @@ var DropdownSubContent_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16108
16154
|
//#region src/components/combo-box/ComboBox.context.ts
|
|
16109
16155
|
var { useProvide: useComboBoxProvide, useInject: useComboBoxInject, key: comboBoxContextKey } = createContext("ComboBox");
|
|
16110
16156
|
//#endregion
|
|
16111
|
-
//#region src/components/combo-box/
|
|
16112
|
-
var
|
|
16113
|
-
|
|
16114
|
-
var _hoisted_3$11 = {
|
|
16115
|
-
key: 0,
|
|
16116
|
-
"aria-hidden": "true"
|
|
16117
|
-
};
|
|
16118
|
-
var _hoisted_4$6 = {
|
|
16119
|
-
key: 1,
|
|
16120
|
-
"data-slot": "helper-wrapper"
|
|
16121
|
-
};
|
|
16122
|
-
var _hoisted_5$5 = {
|
|
16123
|
-
key: 0,
|
|
16124
|
-
"data-slot": "error-message",
|
|
16125
|
-
"aria-live": "polite"
|
|
16126
|
-
};
|
|
16127
|
-
var _hoisted_6$4 = {
|
|
16128
|
-
key: 1,
|
|
16129
|
-
"data-slot": "description"
|
|
16130
|
-
};
|
|
16131
|
-
//#endregion
|
|
16132
|
-
//#region src/components/combo-box/ComboBox.vue
|
|
16133
|
-
var ComboBox_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16134
|
-
__name: "ComboBox",
|
|
16157
|
+
//#region src/components/combo-box/ComboBoxInput.vue
|
|
16158
|
+
var ComboBoxInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16159
|
+
__name: "ComboBoxInput",
|
|
16135
16160
|
props: {
|
|
16136
|
-
modelValue: { default: void 0 },
|
|
16137
|
-
defaultValue: { default: void 0 },
|
|
16138
|
-
open: {
|
|
16139
|
-
type: Boolean,
|
|
16140
|
-
default: void 0
|
|
16141
|
-
},
|
|
16142
|
-
defaultOpen: {
|
|
16143
|
-
type: Boolean,
|
|
16144
|
-
default: void 0
|
|
16145
|
-
},
|
|
16146
|
-
items: { default: () => [] },
|
|
16147
|
-
label: { default: void 0 },
|
|
16148
16161
|
placeholder: { default: void 0 },
|
|
16149
|
-
description: { default: void 0 },
|
|
16150
|
-
errorMessage: { default: void 0 },
|
|
16151
|
-
isInvalid: {
|
|
16152
|
-
type: Boolean,
|
|
16153
|
-
default: false
|
|
16154
|
-
},
|
|
16155
|
-
isDisabled: {
|
|
16156
|
-
type: Boolean,
|
|
16157
|
-
default: false
|
|
16158
|
-
},
|
|
16159
|
-
isRequired: {
|
|
16160
|
-
type: Boolean,
|
|
16161
|
-
default: false
|
|
16162
|
-
},
|
|
16163
|
-
allowsCustomValue: {
|
|
16164
|
-
type: Boolean,
|
|
16165
|
-
default: false
|
|
16166
|
-
},
|
|
16167
|
-
fullWidth: {
|
|
16168
|
-
type: Boolean,
|
|
16169
|
-
default: false
|
|
16170
|
-
},
|
|
16171
|
-
filterFunction: {
|
|
16172
|
-
type: Function,
|
|
16173
|
-
default: void 0
|
|
16174
|
-
},
|
|
16175
16162
|
class: { default: void 0 }
|
|
16176
16163
|
},
|
|
16177
|
-
|
|
16178
|
-
setup(__props, { emit: __emit }) {
|
|
16179
|
-
const props = __props;
|
|
16180
|
-
const emit = __emit;
|
|
16181
|
-
const labelId = (0, vue.useId)();
|
|
16182
|
-
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.comboBoxVariants)({ fullWidth: props.fullWidth }));
|
|
16183
|
-
const effectiveFilter = (0, vue.computed)(() => {
|
|
16184
|
-
if (props.filterFunction) return props.filterFunction;
|
|
16185
|
-
return (itemText, searchTerm) => itemText.toLowerCase().includes(searchTerm.toLowerCase());
|
|
16186
|
-
});
|
|
16187
|
-
const slotItemRegistry = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
16188
|
-
function registerItem(value, label) {
|
|
16189
|
-
const next = new Map(slotItemRegistry.value);
|
|
16190
|
-
next.set(value, label);
|
|
16191
|
-
slotItemRegistry.value = next;
|
|
16192
|
-
}
|
|
16193
|
-
function unregisterItem(value) {
|
|
16194
|
-
const next = new Map(slotItemRegistry.value);
|
|
16195
|
-
next.delete(value);
|
|
16196
|
-
slotItemRegistry.value = next;
|
|
16197
|
-
}
|
|
16198
|
-
function labelFor(value) {
|
|
16199
|
-
if (!value) return "";
|
|
16200
|
-
const item = props.items.find((i) => i.value === value);
|
|
16201
|
-
if (item) return item.label ?? item.textValue ?? value;
|
|
16202
|
-
return slotItemRegistry.value.get(value) ?? value;
|
|
16203
|
-
}
|
|
16204
|
-
function valueFor(label) {
|
|
16205
|
-
if (!label) return "";
|
|
16206
|
-
const item = props.items.find((i) => (i.label ?? i.textValue ?? i.value) === label);
|
|
16207
|
-
if (item) return item.value;
|
|
16208
|
-
for (const [value, lbl] of slotItemRegistry.value) if (lbl === label) return value;
|
|
16209
|
-
return label;
|
|
16210
|
-
}
|
|
16211
|
-
const internalValue = (0, vue.ref)(labelFor(props.modelValue));
|
|
16212
|
-
const displayValue = (0, vue.computed)(() => (val) => val);
|
|
16213
|
-
(0, vue.watch)(() => props.modelValue, (val) => {
|
|
16214
|
-
const next = labelFor(val);
|
|
16215
|
-
if (internalValue.value !== next) internalValue.value = next;
|
|
16216
|
-
});
|
|
16217
|
-
function handleModelValueUpdate(emitted) {
|
|
16218
|
-
internalValue.value = emitted;
|
|
16219
|
-
emit("update:modelValue", valueFor(emitted));
|
|
16220
|
-
}
|
|
16221
|
-
(0, vue.watch)(slotItemRegistry, () => {
|
|
16222
|
-
const next = labelFor(props.modelValue);
|
|
16223
|
-
if (next !== internalValue.value && valueFor(internalValue.value) === (props.modelValue ?? "")) internalValue.value = next;
|
|
16224
|
-
});
|
|
16225
|
-
useComboBoxProvide({
|
|
16226
|
-
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
16227
|
-
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
16228
|
-
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
16229
|
-
slots: slotFns,
|
|
16230
|
-
displayValue,
|
|
16231
|
-
registerItem,
|
|
16232
|
-
unregisterItem
|
|
16233
|
-
});
|
|
16234
|
-
return (_ctx, _cache) => {
|
|
16235
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
16236
|
-
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
16237
|
-
"aria-invalid": props.isInvalid || void 0,
|
|
16238
|
-
"data-slot": "combo-box"
|
|
16239
|
-
}, [
|
|
16240
|
-
props.label ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
16241
|
-
key: 0,
|
|
16242
|
-
id: (0, vue.unref)(labelId),
|
|
16243
|
-
"data-slot": "label"
|
|
16244
|
-
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)(props.label) + " ", 1), props.isRequired ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3$11, " *")) : (0, vue.createCommentVNode)("", true)], 8, _hoisted_2$19)) : (0, vue.createCommentVNode)("", true),
|
|
16245
|
-
(0, vue.createVNode)((0, vue.unref)(reka_ui.ComboboxRoot), {
|
|
16246
|
-
modelValue: internalValue.value,
|
|
16247
|
-
"onUpdate:modelValue": [_cache[0] || (_cache[0] = ($event) => internalValue.value = $event), _cache[1] || (_cache[1] = ($event) => handleModelValueUpdate($event))],
|
|
16248
|
-
"default-value": props.defaultValue ? labelFor(props.defaultValue) : void 0,
|
|
16249
|
-
open: props.open,
|
|
16250
|
-
"default-open": props.defaultOpen,
|
|
16251
|
-
disabled: props.isDisabled,
|
|
16252
|
-
required: props.isRequired,
|
|
16253
|
-
"filter-function": effectiveFilter.value,
|
|
16254
|
-
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => emit("update:open", $event))
|
|
16255
|
-
}, {
|
|
16256
|
-
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
16257
|
-
_: 3
|
|
16258
|
-
}, 8, [
|
|
16259
|
-
"modelValue",
|
|
16260
|
-
"default-value",
|
|
16261
|
-
"open",
|
|
16262
|
-
"default-open",
|
|
16263
|
-
"disabled",
|
|
16264
|
-
"required",
|
|
16265
|
-
"filter-function"
|
|
16266
|
-
]),
|
|
16267
|
-
props.description || props.isInvalid && props.errorMessage ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$6, [props.isInvalid && props.errorMessage ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_5$5, (0, vue.toDisplayString)(props.errorMessage), 1)) : props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_6$4, (0, vue.toDisplayString)(props.description), 1)) : (0, vue.createCommentVNode)("", true)])) : (0, vue.createCommentVNode)("", true)
|
|
16268
|
-
], 10, _hoisted_1$33);
|
|
16269
|
-
};
|
|
16270
|
-
}
|
|
16271
|
-
});
|
|
16272
|
-
//#endregion
|
|
16273
|
-
//#region src/components/combo-box/ComboBoxInput.vue
|
|
16274
|
-
var ComboBoxInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16275
|
-
__name: "ComboBoxInput",
|
|
16276
|
-
props: {
|
|
16277
|
-
placeholder: { default: void 0 },
|
|
16278
|
-
class: { default: void 0 }
|
|
16279
|
-
},
|
|
16280
|
-
setup(__props) {
|
|
16164
|
+
setup(__props) {
|
|
16281
16165
|
const props = __props;
|
|
16282
16166
|
const ctx = useComboBoxInject();
|
|
16283
16167
|
return (_ctx, _cache) => {
|
|
@@ -16518,64 +16402,51 @@ var ComboBoxItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16518
16402
|
}
|
|
16519
16403
|
});
|
|
16520
16404
|
//#endregion
|
|
16521
|
-
//#region src/components/combo-box/
|
|
16522
|
-
var
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
return (_ctx, _cache) => {
|
|
16526
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.ComboboxEmpty), {
|
|
16527
|
-
class: "py-3 text-center text-sm text-default-400",
|
|
16528
|
-
"data-slot": "empty-content"
|
|
16529
|
-
}, {
|
|
16530
|
-
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
16531
|
-
_: 3
|
|
16532
|
-
});
|
|
16533
|
-
};
|
|
16534
|
-
}
|
|
16535
|
-
});
|
|
16536
|
-
//#endregion
|
|
16537
|
-
//#region src/components/autocomplete/Autocomplete.context.ts
|
|
16538
|
-
var { useProvide: useAutocompleteProvide, useInject: useAutocompleteInject, key: autocompleteContextKey } = createContext("Autocomplete");
|
|
16539
|
-
//#endregion
|
|
16540
|
-
//#region src/components/autocomplete/Autocomplete.vue?vue&type=script&setup=true&lang.ts
|
|
16541
|
-
var _hoisted_1$32 = [
|
|
16542
|
-
"data-invalid",
|
|
16543
|
-
"data-disabled",
|
|
16544
|
-
"data-readonly",
|
|
16545
|
-
"data-required",
|
|
16546
|
-
"data-has-label",
|
|
16547
|
-
"data-has-helper"
|
|
16548
|
-
];
|
|
16549
|
-
var _hoisted_2$18 = ["for"];
|
|
16550
|
-
var _hoisted_3$10 = {
|
|
16405
|
+
//#region src/components/combo-box/ComboBox.vue?vue&type=script&setup=true&lang.ts
|
|
16406
|
+
var _hoisted_1$33 = ["aria-invalid"];
|
|
16407
|
+
var _hoisted_2$19 = ["id"];
|
|
16408
|
+
var _hoisted_3$11 = {
|
|
16551
16409
|
key: 0,
|
|
16552
16410
|
"aria-hidden": "true"
|
|
16553
16411
|
};
|
|
16554
|
-
var _hoisted_4$
|
|
16555
|
-
|
|
16412
|
+
var _hoisted_4$6 = {
|
|
16413
|
+
key: 1,
|
|
16414
|
+
"data-slot": "helper-wrapper"
|
|
16415
|
+
};
|
|
16416
|
+
var _hoisted_5$5 = {
|
|
16417
|
+
key: 0,
|
|
16418
|
+
"data-slot": "error-message",
|
|
16419
|
+
"aria-live": "polite"
|
|
16420
|
+
};
|
|
16421
|
+
var _hoisted_6$4 = {
|
|
16422
|
+
key: 1,
|
|
16423
|
+
"data-slot": "description"
|
|
16424
|
+
};
|
|
16556
16425
|
//#endregion
|
|
16557
|
-
//#region src/components/
|
|
16558
|
-
var
|
|
16559
|
-
|
|
16560
|
-
__name: "Autocomplete",
|
|
16426
|
+
//#region src/components/combo-box/ComboBox.vue
|
|
16427
|
+
var ComboBox_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16428
|
+
__name: "ComboBox",
|
|
16561
16429
|
props: {
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
labelPlacement: { default: "inside" },
|
|
16566
|
-
fullWidth: {
|
|
16430
|
+
modelValue: { default: void 0 },
|
|
16431
|
+
defaultValue: { default: void 0 },
|
|
16432
|
+
open: {
|
|
16567
16433
|
type: Boolean,
|
|
16568
|
-
default:
|
|
16434
|
+
default: void 0
|
|
16569
16435
|
},
|
|
16570
|
-
|
|
16436
|
+
defaultOpen: {
|
|
16571
16437
|
type: Boolean,
|
|
16572
|
-
default:
|
|
16438
|
+
default: void 0
|
|
16573
16439
|
},
|
|
16574
|
-
|
|
16440
|
+
items: { default: () => [] },
|
|
16441
|
+
label: { default: void 0 },
|
|
16442
|
+
placeholder: { default: void 0 },
|
|
16443
|
+
description: { default: void 0 },
|
|
16444
|
+
errorMessage: { default: void 0 },
|
|
16445
|
+
isInvalid: {
|
|
16575
16446
|
type: Boolean,
|
|
16576
16447
|
default: false
|
|
16577
16448
|
},
|
|
16578
|
-
|
|
16449
|
+
isDisabled: {
|
|
16579
16450
|
type: Boolean,
|
|
16580
16451
|
default: false
|
|
16581
16452
|
},
|
|
@@ -16583,54 +16454,32 @@ var Autocomplete_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16583
16454
|
type: Boolean,
|
|
16584
16455
|
default: false
|
|
16585
16456
|
},
|
|
16586
|
-
|
|
16587
|
-
name: {},
|
|
16588
|
-
label: {},
|
|
16589
|
-
description: {},
|
|
16590
|
-
errorMessage: {},
|
|
16591
|
-
class: {},
|
|
16592
|
-
modelValue: { default: void 0 },
|
|
16593
|
-
defaultValue: { default: void 0 },
|
|
16594
|
-
multiple: {
|
|
16457
|
+
allowsCustomValue: {
|
|
16595
16458
|
type: Boolean,
|
|
16596
16459
|
default: false
|
|
16597
16460
|
},
|
|
16598
|
-
|
|
16599
|
-
open: {
|
|
16600
|
-
type: Boolean,
|
|
16601
|
-
default: void 0
|
|
16602
|
-
},
|
|
16603
|
-
defaultOpen: {
|
|
16461
|
+
fullWidth: {
|
|
16604
16462
|
type: Boolean,
|
|
16605
|
-
default:
|
|
16463
|
+
default: false
|
|
16606
16464
|
},
|
|
16607
|
-
|
|
16608
|
-
loadItems: {
|
|
16465
|
+
filterFunction: {
|
|
16609
16466
|
type: Function,
|
|
16610
16467
|
default: void 0
|
|
16611
16468
|
},
|
|
16612
|
-
|
|
16613
|
-
filterOnOpen: {
|
|
16614
|
-
type: Boolean,
|
|
16615
|
-
default: false
|
|
16616
|
-
},
|
|
16617
|
-
truncateItems: {
|
|
16618
|
-
type: Boolean,
|
|
16619
|
-
default: true
|
|
16620
|
-
}
|
|
16469
|
+
class: { default: void 0 }
|
|
16621
16470
|
},
|
|
16622
|
-
emits: [
|
|
16623
|
-
"update:modelValue",
|
|
16624
|
-
"update:open",
|
|
16625
|
-
"create"
|
|
16626
|
-
],
|
|
16471
|
+
emits: ["update:modelValue", "update:open"],
|
|
16627
16472
|
setup(__props, { emit: __emit }) {
|
|
16628
16473
|
const props = __props;
|
|
16629
16474
|
const emit = __emit;
|
|
16630
|
-
const
|
|
16631
|
-
const
|
|
16632
|
-
const
|
|
16633
|
-
const
|
|
16475
|
+
const labelId = (0, vue.useId)();
|
|
16476
|
+
const slots = (0, vue.useSlots)();
|
|
16477
|
+
const usesCustomChrome = (0, vue.computed)(() => hasSlotComponent(slots.default?.(), [ComboBoxInput_default, ComboBoxContent_default]));
|
|
16478
|
+
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.comboBoxVariants)({ fullWidth: props.fullWidth }));
|
|
16479
|
+
const effectiveFilter = (0, vue.computed)(() => {
|
|
16480
|
+
if (props.filterFunction) return props.filterFunction;
|
|
16481
|
+
return (itemText, searchTerm) => itemText.toLowerCase().includes(searchTerm.toLowerCase());
|
|
16482
|
+
});
|
|
16634
16483
|
const slotItemRegistry = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
16635
16484
|
function registerItem(value, label) {
|
|
16636
16485
|
const next = new Map(slotItemRegistry.value);
|
|
@@ -16642,272 +16491,114 @@ var Autocomplete_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16642
16491
|
next.delete(value);
|
|
16643
16492
|
slotItemRegistry.value = next;
|
|
16644
16493
|
}
|
|
16645
|
-
const isLoading = (0, vue.ref)(false);
|
|
16646
|
-
const internalItems = (0, vue.ref)([...props.items]);
|
|
16647
|
-
const selectedValues = (0, vue.ref)(props.multiple && Array.isArray(props.modelValue) ? [...props.modelValue] : []);
|
|
16648
|
-
const internalOpen = (0, vue.ref)(props.defaultOpen ?? false);
|
|
16649
|
-
let selectingItem = false;
|
|
16650
|
-
const isOpen = (0, vue.ref)(props.defaultOpen ?? false);
|
|
16651
|
-
const termAtOpen = (0, vue.ref)("");
|
|
16652
|
-
const isUserTyping = (0, vue.ref)(false);
|
|
16653
|
-
const singleOpen = (0, vue.ref)(props.open ?? props.defaultOpen ?? false);
|
|
16654
|
-
let blockReopen = false;
|
|
16655
|
-
let blockReopenTimer;
|
|
16656
|
-
const effectiveIgnoreFilter = (0, vue.computed)(() => {
|
|
16657
|
-
if (props.loadItems) return true;
|
|
16658
|
-
if (!props.filterOnOpen && isOpen.value && !isUserTyping.value) return true;
|
|
16659
|
-
return false;
|
|
16660
|
-
});
|
|
16661
16494
|
function labelFor(value) {
|
|
16662
|
-
if (value
|
|
16663
|
-
const
|
|
16664
|
-
if (
|
|
16495
|
+
if (!value) return "";
|
|
16496
|
+
const item = props.items.find((i) => i.value === value);
|
|
16497
|
+
if (item) return item.label ?? item.textValue ?? value;
|
|
16665
16498
|
return slotItemRegistry.value.get(value) ?? value;
|
|
16666
16499
|
}
|
|
16667
|
-
function valueFor(
|
|
16668
|
-
if (!
|
|
16669
|
-
const
|
|
16670
|
-
if (
|
|
16671
|
-
for (const [value,
|
|
16672
|
-
return
|
|
16500
|
+
function valueFor(label) {
|
|
16501
|
+
if (!label) return "";
|
|
16502
|
+
const item = props.items.find((i) => (i.label ?? i.textValue ?? i.value) === label);
|
|
16503
|
+
if (item) return item.value;
|
|
16504
|
+
for (const [value, lbl] of slotItemRegistry.value) if (lbl === label) return value;
|
|
16505
|
+
return label;
|
|
16673
16506
|
}
|
|
16674
|
-
const
|
|
16675
|
-
const
|
|
16676
|
-
const isFilled = (0, vue.computed)(() => props.multiple ? selectedValues.value.length > 0 || !!searchTerm.value : !!searchTerm.value);
|
|
16677
|
-
const hasItems = (0, vue.computed)(() => internalItems.value.length > 0);
|
|
16678
|
-
const selectedLabels = (0, vue.computed)(() => selectedValues.value.map((v) => ({
|
|
16679
|
-
value: v,
|
|
16680
|
-
label: labelFor(v) || v
|
|
16681
|
-
})));
|
|
16682
|
-
const descriptionId = (0, vue.computed)(() => `${inputId.value}-description`);
|
|
16683
|
-
const errorMessageId = (0, vue.computed)(() => `${inputId.value}-error`);
|
|
16684
|
-
const showError = (0, vue.computed)(() => props.isInvalid && !!props.errorMessage);
|
|
16685
|
-
const showDescription = (0, vue.computed)(() => !!props.description && !showError.value);
|
|
16686
|
-
const hasHelper = (0, vue.computed)(() => showError.value || showDescription.value);
|
|
16687
|
-
const ariaDescribedBy = (0, vue.computed)(() => {
|
|
16688
|
-
if (showError.value) return errorMessageId.value;
|
|
16689
|
-
if (showDescription.value) return descriptionId.value;
|
|
16690
|
-
});
|
|
16507
|
+
const internalValue = (0, vue.ref)(labelFor(props.modelValue));
|
|
16508
|
+
const displayValue = (0, vue.computed)(() => (val) => val);
|
|
16691
16509
|
(0, vue.watch)(() => props.modelValue, (val) => {
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
} else {
|
|
16695
|
-
const next = labelFor(val);
|
|
16696
|
-
if (searchTerm.value !== next) searchTerm.value = next;
|
|
16697
|
-
}
|
|
16510
|
+
const next = labelFor(val);
|
|
16511
|
+
if (internalValue.value !== next) internalValue.value = next;
|
|
16698
16512
|
});
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
(0, vue.watch)(searchTerm, (displayed) => {
|
|
16703
|
-
if (props.multiple) {
|
|
16704
|
-
if (isOpen.value && displayed !== termAtOpen.value) isUserTyping.value = true;
|
|
16705
|
-
return;
|
|
16706
|
-
}
|
|
16707
|
-
const next = valueFor(displayed);
|
|
16708
|
-
if (next !== (singleModelValue.value ?? "")) emit("update:modelValue", next);
|
|
16709
|
-
if (isOpen.value && displayed !== termAtOpen.value) isUserTyping.value = true;
|
|
16710
|
-
});
|
|
16711
|
-
function handleOpenChange(val) {
|
|
16712
|
-
if (props.multiple) {
|
|
16713
|
-
isOpen.value = val;
|
|
16714
|
-
internalOpen.value = !val && selectingItem ? true : val;
|
|
16715
|
-
selectingItem = false;
|
|
16716
|
-
if (val) {
|
|
16717
|
-
termAtOpen.value = searchTerm.value;
|
|
16718
|
-
isUserTyping.value = false;
|
|
16719
|
-
} else isUserTyping.value = false;
|
|
16720
|
-
emit("update:open", val);
|
|
16721
|
-
return;
|
|
16722
|
-
}
|
|
16723
|
-
if (val && blockReopen) return;
|
|
16724
|
-
isOpen.value = val;
|
|
16725
|
-
singleOpen.value = val;
|
|
16726
|
-
if (val) {
|
|
16727
|
-
termAtOpen.value = searchTerm.value;
|
|
16728
|
-
isUserTyping.value = false;
|
|
16729
|
-
} else isUserTyping.value = false;
|
|
16730
|
-
emit("update:open", val);
|
|
16731
|
-
}
|
|
16732
|
-
function onMultipleSelect(value) {
|
|
16733
|
-
selectingItem = true;
|
|
16734
|
-
const idx = selectedValues.value.indexOf(value);
|
|
16735
|
-
selectedValues.value = idx === -1 ? [...selectedValues.value, value] : selectedValues.value.filter((_, i) => i !== idx);
|
|
16736
|
-
searchTerm.value = "";
|
|
16737
|
-
isUserTyping.value = false;
|
|
16738
|
-
emit("update:modelValue", selectedValues.value);
|
|
16739
|
-
}
|
|
16740
|
-
function removeValue(value) {
|
|
16741
|
-
selectedValues.value = selectedValues.value.filter((v) => v !== value);
|
|
16742
|
-
emit("update:modelValue", selectedValues.value);
|
|
16743
|
-
}
|
|
16744
|
-
function clearAll() {
|
|
16745
|
-
selectedValues.value = [];
|
|
16746
|
-
emit("update:modelValue", []);
|
|
16747
|
-
}
|
|
16748
|
-
function isSelected(value) {
|
|
16749
|
-
return selectedValues.value.includes(value);
|
|
16750
|
-
}
|
|
16751
|
-
const hasExactMatch = (0, vue.computed)(() => {
|
|
16752
|
-
const term = searchTerm.value.trim().toLowerCase();
|
|
16753
|
-
if (!term) return false;
|
|
16754
|
-
if (internalItems.value.some((i) => (i.label ?? i.textValue ?? i.value).toLowerCase() === term)) return true;
|
|
16755
|
-
for (const label of slotItemRegistry.value.values()) if (label.toLowerCase() === term) return true;
|
|
16756
|
-
return false;
|
|
16757
|
-
});
|
|
16758
|
-
function onCreateValue(value) {
|
|
16759
|
-
const trimmed = value.trim();
|
|
16760
|
-
if (!trimmed) return;
|
|
16761
|
-
if (props.multiple) {
|
|
16762
|
-
if (!selectedValues.value.includes(trimmed)) {
|
|
16763
|
-
selectingItem = true;
|
|
16764
|
-
selectedValues.value = [...selectedValues.value, trimmed];
|
|
16765
|
-
emit("update:modelValue", selectedValues.value);
|
|
16766
|
-
}
|
|
16767
|
-
searchTerm.value = "";
|
|
16768
|
-
isUserTyping.value = false;
|
|
16769
|
-
} else {
|
|
16770
|
-
searchTerm.value = trimmed;
|
|
16771
|
-
emit("update:modelValue", trimmed);
|
|
16772
|
-
isOpen.value = false;
|
|
16773
|
-
singleOpen.value = false;
|
|
16774
|
-
blockReopen = true;
|
|
16775
|
-
clearTimeout(blockReopenTimer);
|
|
16776
|
-
blockReopenTimer = setTimeout(() => {
|
|
16777
|
-
blockReopen = false;
|
|
16778
|
-
}, 300);
|
|
16779
|
-
}
|
|
16780
|
-
emit("create", trimmed);
|
|
16781
|
-
}
|
|
16782
|
-
let debounceTimer;
|
|
16783
|
-
async function runLoadItems(query) {
|
|
16784
|
-
if (!props.loadItems) return;
|
|
16785
|
-
isLoading.value = true;
|
|
16786
|
-
try {
|
|
16787
|
-
internalItems.value = await props.loadItems(query);
|
|
16788
|
-
} finally {
|
|
16789
|
-
isLoading.value = false;
|
|
16790
|
-
}
|
|
16791
|
-
}
|
|
16792
|
-
function scheduleLoad(query) {
|
|
16793
|
-
if (!props.loadItems) return;
|
|
16794
|
-
clearTimeout(debounceTimer);
|
|
16795
|
-
if (props.debounceMs === 0) runLoadItems(query);
|
|
16796
|
-
else debounceTimer = setTimeout(() => void runLoadItems(query), props.debounceMs);
|
|
16513
|
+
function handleModelValueUpdate(emitted) {
|
|
16514
|
+
internalValue.value = emitted;
|
|
16515
|
+
emit("update:modelValue", valueFor(emitted));
|
|
16797
16516
|
}
|
|
16798
|
-
(0, vue.onMounted)(() => {
|
|
16799
|
-
if (props.loadItems) runLoadItems(searchTerm.value);
|
|
16800
|
-
});
|
|
16801
|
-
(0, vue.watch)(searchTerm, (q) => {
|
|
16802
|
-
if (props.loadItems) scheduleLoad(q);
|
|
16803
|
-
});
|
|
16804
|
-
(0, vue.watch)(() => props.items, (newItems) => {
|
|
16805
|
-
if (!props.loadItems) internalItems.value = [...newItems];
|
|
16806
|
-
});
|
|
16807
|
-
(0, vue.watch)(internalItems, () => {
|
|
16808
|
-
if (props.multiple) return;
|
|
16809
|
-
const next = labelFor(singleModelValue.value);
|
|
16810
|
-
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
16811
|
-
});
|
|
16812
16517
|
(0, vue.watch)(slotItemRegistry, () => {
|
|
16813
|
-
|
|
16814
|
-
|
|
16815
|
-
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
16518
|
+
const next = labelFor(props.modelValue);
|
|
16519
|
+
if (next !== internalValue.value && valueFor(internalValue.value) === (props.modelValue ?? "")) internalValue.value = next;
|
|
16816
16520
|
});
|
|
16817
|
-
|
|
16818
|
-
variant: props.variant,
|
|
16819
|
-
size: props.size,
|
|
16820
|
-
color: props.color,
|
|
16821
|
-
fullWidth: props.fullWidth,
|
|
16822
|
-
isInvalid: props.isInvalid,
|
|
16823
|
-
isDisabled: props.isDisabled,
|
|
16824
|
-
isReadonly: props.isReadonly,
|
|
16825
|
-
hasLabel: hasLabel.value,
|
|
16826
|
-
labelPlacement: props.labelPlacement
|
|
16827
|
-
}));
|
|
16828
|
-
const showOutsideLabel = (0, vue.computed)(() => hasLabel.value && props.labelPlacement !== "inside");
|
|
16829
|
-
useAutocompleteProvide({
|
|
16521
|
+
useComboBoxProvide({
|
|
16830
16522
|
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
16831
16523
|
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
16832
|
-
isReadonly: (0, vue.toRef)(props, "isReadonly"),
|
|
16833
|
-
isRequired: (0, vue.toRef)(props, "isRequired"),
|
|
16834
|
-
isLoading,
|
|
16835
|
-
isFilled,
|
|
16836
16524
|
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
16837
|
-
hasLabel,
|
|
16838
|
-
labelPlacement: (0, vue.toRef)(props, "labelPlacement"),
|
|
16839
|
-
inputId,
|
|
16840
|
-
label: (0, vue.toRef)(props, "label"),
|
|
16841
|
-
ariaDescribedBy,
|
|
16842
|
-
truncateItems: (0, vue.toRef)(props, "truncateItems"),
|
|
16843
|
-
hasItems,
|
|
16844
16525
|
slots: slotFns,
|
|
16845
|
-
|
|
16846
|
-
multipleOverflow: (0, vue.toRef)(props, "multipleOverflow"),
|
|
16847
|
-
selectedValues,
|
|
16848
|
-
selectedLabels,
|
|
16849
|
-
onMultipleSelect,
|
|
16850
|
-
removeValue,
|
|
16851
|
-
clearAll,
|
|
16852
|
-
isSelected,
|
|
16526
|
+
displayValue,
|
|
16853
16527
|
registerItem,
|
|
16854
|
-
unregisterItem
|
|
16855
|
-
searchTerm,
|
|
16856
|
-
hasExactMatch,
|
|
16857
|
-
onCreateValue
|
|
16528
|
+
unregisterItem
|
|
16858
16529
|
});
|
|
16859
16530
|
return (_ctx, _cache) => {
|
|
16860
16531
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
16861
16532
|
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
16862
|
-
"
|
|
16863
|
-
"data-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
|
|
16533
|
+
"aria-invalid": props.isInvalid || void 0,
|
|
16534
|
+
"data-slot": "combo-box"
|
|
16535
|
+
}, [
|
|
16536
|
+
props.label ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
16537
|
+
key: 0,
|
|
16538
|
+
id: (0, vue.unref)(labelId),
|
|
16539
|
+
"data-slot": "label"
|
|
16540
|
+
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)(props.label) + " ", 1), props.isRequired ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3$11, " *")) : (0, vue.createCommentVNode)("", true)], 8, _hoisted_2$19)) : (0, vue.createCommentVNode)("", true),
|
|
16541
|
+
(0, vue.createVNode)((0, vue.unref)(reka_ui.ComboboxRoot), {
|
|
16542
|
+
modelValue: internalValue.value,
|
|
16543
|
+
"onUpdate:modelValue": [_cache[0] || (_cache[0] = ($event) => internalValue.value = $event), _cache[1] || (_cache[1] = ($event) => handleModelValueUpdate($event))],
|
|
16544
|
+
"default-value": props.defaultValue ? labelFor(props.defaultValue) : void 0,
|
|
16545
|
+
open: props.open,
|
|
16546
|
+
"default-open": props.defaultOpen,
|
|
16547
|
+
disabled: props.isDisabled,
|
|
16548
|
+
required: props.isRequired,
|
|
16549
|
+
"filter-function": effectiveFilter.value,
|
|
16550
|
+
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => emit("update:open", $event))
|
|
16551
|
+
}, {
|
|
16552
|
+
default: (0, vue.withCtx)(() => [usesCustomChrome.value ? (0, vue.renderSlot)(_ctx.$slots, "default", { key: 0 }) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.createVNode)(ComboBoxInput_default, { placeholder: props.placeholder }, null, 8, ["placeholder"]), (0, vue.createVNode)(ComboBoxContent_default, null, {
|
|
16553
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(props.items, (item) => {
|
|
16554
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(ComboBoxItem_default, {
|
|
16555
|
+
key: item.value,
|
|
16556
|
+
value: item.value,
|
|
16557
|
+
"is-disabled": item.isDisabled
|
|
16558
|
+
}, {
|
|
16559
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "item", { item }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(item.label ?? item.textValue ?? item.value), 1)])]),
|
|
16560
|
+
_: 2
|
|
16561
|
+
}, 1032, ["value", "is-disabled"]);
|
|
16562
|
+
}), 128))]),
|
|
16563
|
+
_: 3
|
|
16564
|
+
})], 64))]),
|
|
16565
|
+
_: 3
|
|
16566
|
+
}, 8, [
|
|
16567
|
+
"modelValue",
|
|
16568
|
+
"default-value",
|
|
16569
|
+
"open",
|
|
16570
|
+
"default-open",
|
|
16571
|
+
"disabled",
|
|
16572
|
+
"required",
|
|
16573
|
+
"filter-function"
|
|
16574
|
+
]),
|
|
16575
|
+
props.description || props.isInvalid && props.errorMessage ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$6, [props.isInvalid && props.errorMessage ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_5$5, (0, vue.toDisplayString)(props.errorMessage), 1)) : props.description ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_6$4, (0, vue.toDisplayString)(props.description), 1)) : (0, vue.createCommentVNode)("", true)])) : (0, vue.createCommentVNode)("", true)
|
|
16576
|
+
], 10, _hoisted_1$33);
|
|
16577
|
+
};
|
|
16578
|
+
}
|
|
16579
|
+
});
|
|
16580
|
+
//#endregion
|
|
16581
|
+
//#region src/components/combo-box/ComboBoxEmpty.vue
|
|
16582
|
+
var ComboBoxEmpty_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16583
|
+
__name: "ComboBoxEmpty",
|
|
16584
|
+
setup(__props) {
|
|
16585
|
+
return (_ctx, _cache) => {
|
|
16586
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.ComboboxEmpty), {
|
|
16587
|
+
class: "py-3 text-center text-sm text-default-400",
|
|
16588
|
+
"data-slot": "empty-content"
|
|
16881
16589
|
}, {
|
|
16882
|
-
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default",
|
|
16883
|
-
isLoading: isLoading.value,
|
|
16884
|
-
items: internalItems.value
|
|
16885
|
-
})]),
|
|
16590
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
16886
16591
|
_: 3
|
|
16887
|
-
}
|
|
16888
|
-
"model-value",
|
|
16889
|
-
"open",
|
|
16890
|
-
"disabled",
|
|
16891
|
-
"required",
|
|
16892
|
-
"ignore-filter"
|
|
16893
|
-
]), hasHelper.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
16894
|
-
key: 0,
|
|
16895
|
-
class: (0, vue.normalizeClass)(slotFns.value.helperWrapper())
|
|
16896
|
-
}, [showError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
16897
|
-
key: 0,
|
|
16898
|
-
id: errorMessageId.value,
|
|
16899
|
-
class: (0, vue.normalizeClass)(slotFns.value.errorMessage())
|
|
16900
|
-
}, (0, vue.toDisplayString)(__props.errorMessage), 11, _hoisted_4$5)) : showDescription.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
16901
|
-
key: 1,
|
|
16902
|
-
id: descriptionId.value,
|
|
16903
|
-
class: (0, vue.normalizeClass)(slotFns.value.description())
|
|
16904
|
-
}, (0, vue.toDisplayString)(__props.description), 11, _hoisted_5$4)) : (0, vue.createCommentVNode)("", true)], 2)) : (0, vue.createCommentVNode)("", true)], 2)], 10, _hoisted_1$32);
|
|
16592
|
+
});
|
|
16905
16593
|
};
|
|
16906
16594
|
}
|
|
16907
16595
|
});
|
|
16908
16596
|
//#endregion
|
|
16597
|
+
//#region src/components/autocomplete/Autocomplete.context.ts
|
|
16598
|
+
var { useProvide: useAutocompleteProvide, useInject: useAutocompleteInject, key: autocompleteContextKey } = createContext("Autocomplete");
|
|
16599
|
+
//#endregion
|
|
16909
16600
|
//#region src/components/autocomplete/AutocompleteOverflowChips.vue?vue&type=script&setup=true&lang.ts
|
|
16910
|
-
var _hoisted_1$
|
|
16601
|
+
var _hoisted_1$32 = {
|
|
16911
16602
|
ref: "container",
|
|
16912
16603
|
style: {
|
|
16913
16604
|
"display": "flex",
|
|
@@ -16966,7 +16657,7 @@ var AutocompleteOverflowChips_default = /* @__PURE__ */ (0, vue.defineComponent)
|
|
|
16966
16657
|
(0, _vueuse_core.useResizeObserver)(containerEl, reflow);
|
|
16967
16658
|
(0, vue.watch)(() => props.values.join("\0"), () => reflow(), { flush: "post" });
|
|
16968
16659
|
return (_ctx, _cache) => {
|
|
16969
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
16660
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$32, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.values, (val, i) => {
|
|
16970
16661
|
return (0, vue.openBlock)(), (0, vue.createBlock)(Chip_default, {
|
|
16971
16662
|
key: val,
|
|
16972
16663
|
"data-chip-item": "",
|
|
@@ -16991,8 +16682,8 @@ var AutocompleteOverflowChips_default = /* @__PURE__ */ (0, vue.defineComponent)
|
|
|
16991
16682
|
});
|
|
16992
16683
|
//#endregion
|
|
16993
16684
|
//#region src/components/autocomplete/AutocompleteInput.vue?vue&type=script&setup=true&lang.ts
|
|
16994
|
-
var _hoisted_1$
|
|
16995
|
-
var _hoisted_2$
|
|
16685
|
+
var _hoisted_1$31 = ["for"];
|
|
16686
|
+
var _hoisted_2$18 = {
|
|
16996
16687
|
key: 0,
|
|
16997
16688
|
"aria-hidden": "true"
|
|
16998
16689
|
};
|
|
@@ -17028,7 +16719,7 @@ var AutocompleteInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17028
16719
|
key: 0,
|
|
17029
16720
|
for: (0, vue.unref)(ctx).inputId.value,
|
|
17030
16721
|
class: (0, vue.normalizeClass)((0, vue.unref)(ctx).slots.value.label())
|
|
17031
|
-
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(ctx).label.value), 1), (0, vue.unref)(ctx).isRequired.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$
|
|
16722
|
+
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(ctx).label.value), 1), (0, vue.unref)(ctx).isRequired.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$18, " *")) : (0, vue.createCommentVNode)("", true)], 10, _hoisted_1$31)) : (0, vue.createCommentVNode)("", true),
|
|
17032
16723
|
_ctx.$slots.startContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
17033
16724
|
key: 1,
|
|
17034
16725
|
class: (0, vue.normalizeClass)((0, vue.unref)(ctx).slots.value.startContent()),
|
|
@@ -17154,7 +16845,7 @@ var AutocompleteInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17154
16845
|
});
|
|
17155
16846
|
//#endregion
|
|
17156
16847
|
//#region src/components/autocomplete/AutocompleteContent.vue?vue&type=script&setup=true&lang.ts
|
|
17157
|
-
var _hoisted_1$
|
|
16848
|
+
var _hoisted_1$30 = [
|
|
17158
16849
|
"inert",
|
|
17159
16850
|
"aria-disabled",
|
|
17160
16851
|
"data-disabled"
|
|
@@ -17254,7 +16945,7 @@ var AutocompleteContent_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17254
16945
|
_: 3
|
|
17255
16946
|
})) : (0, vue.createCommentVNode)("", true)]),
|
|
17256
16947
|
_: 3
|
|
17257
|
-
})], 10, _hoisted_1$
|
|
16948
|
+
})], 10, _hoisted_1$30)]),
|
|
17258
16949
|
_: 3
|
|
17259
16950
|
}, 8, [
|
|
17260
16951
|
"data-loading",
|
|
@@ -17272,11 +16963,11 @@ var AutocompleteContent_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17272
16963
|
});
|
|
17273
16964
|
//#endregion
|
|
17274
16965
|
//#region src/components/autocomplete/AutocompleteItem.vue?vue&type=script&setup=true&lang.ts
|
|
17275
|
-
var _hoisted_1$
|
|
16966
|
+
var _hoisted_1$29 = {
|
|
17276
16967
|
class: "autocomplete-item__text",
|
|
17277
16968
|
"data-slot": "item-text"
|
|
17278
16969
|
};
|
|
17279
|
-
var _hoisted_2$
|
|
16970
|
+
var _hoisted_2$17 = {
|
|
17280
16971
|
key: 1,
|
|
17281
16972
|
class: "list-box-item__indicator",
|
|
17282
16973
|
"data-slot": "list-box-item-indicator"
|
|
@@ -17335,7 +17026,7 @@ var AutocompleteItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17335
17026
|
}, {
|
|
17336
17027
|
default: (0, vue.withCtx)(() => [
|
|
17337
17028
|
(0, vue.renderSlot)(_ctx.$slots, "startContent"),
|
|
17338
|
-
(0, vue.createElementVNode)("span", _hoisted_1$
|
|
17029
|
+
(0, vue.createElementVNode)("span", _hoisted_1$29, [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
17339
17030
|
!(0, vue.unref)(ctx).multiple.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.ComboboxItemIndicator), {
|
|
17340
17031
|
key: 0,
|
|
17341
17032
|
class: "list-box-item__indicator",
|
|
@@ -17355,7 +17046,7 @@ var AutocompleteItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17355
17046
|
"aria-hidden": "true"
|
|
17356
17047
|
}, [(0, vue.createElementVNode)("polyline", { points: "20 6 9 17 4 12" })], -1))])]),
|
|
17357
17048
|
_: 3
|
|
17358
|
-
})) : isChecked.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$
|
|
17049
|
+
})) : isChecked.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$17, [(0, vue.renderSlot)(_ctx.$slots, "selectedIcon", {}, () => [_cache[1] || (_cache[1] = (0, vue.createElementVNode)("svg", {
|
|
17359
17050
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17360
17051
|
width: "12",
|
|
17361
17052
|
height: "12",
|
|
@@ -17382,6 +17073,390 @@ var AutocompleteItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17382
17073
|
}
|
|
17383
17074
|
});
|
|
17384
17075
|
//#endregion
|
|
17076
|
+
//#region src/components/autocomplete/Autocomplete.vue?vue&type=script&setup=true&lang.ts
|
|
17077
|
+
var _hoisted_1$28 = [
|
|
17078
|
+
"data-invalid",
|
|
17079
|
+
"data-disabled",
|
|
17080
|
+
"data-readonly",
|
|
17081
|
+
"data-required",
|
|
17082
|
+
"data-has-label",
|
|
17083
|
+
"data-has-helper"
|
|
17084
|
+
];
|
|
17085
|
+
var _hoisted_2$16 = ["for"];
|
|
17086
|
+
var _hoisted_3$10 = {
|
|
17087
|
+
key: 0,
|
|
17088
|
+
"aria-hidden": "true"
|
|
17089
|
+
};
|
|
17090
|
+
var _hoisted_4$5 = ["id"];
|
|
17091
|
+
var _hoisted_5$4 = ["id"];
|
|
17092
|
+
//#endregion
|
|
17093
|
+
//#region src/components/autocomplete/Autocomplete.vue
|
|
17094
|
+
var Autocomplete_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
17095
|
+
inheritAttrs: false,
|
|
17096
|
+
__name: "Autocomplete",
|
|
17097
|
+
props: {
|
|
17098
|
+
variant: { default: "flat" },
|
|
17099
|
+
size: { default: "md" },
|
|
17100
|
+
color: { default: "default" },
|
|
17101
|
+
labelPlacement: { default: "inside" },
|
|
17102
|
+
fullWidth: {
|
|
17103
|
+
type: Boolean,
|
|
17104
|
+
default: false
|
|
17105
|
+
},
|
|
17106
|
+
isInvalid: {
|
|
17107
|
+
type: Boolean,
|
|
17108
|
+
default: false
|
|
17109
|
+
},
|
|
17110
|
+
isDisabled: {
|
|
17111
|
+
type: Boolean,
|
|
17112
|
+
default: false
|
|
17113
|
+
},
|
|
17114
|
+
isReadonly: {
|
|
17115
|
+
type: Boolean,
|
|
17116
|
+
default: false
|
|
17117
|
+
},
|
|
17118
|
+
isRequired: {
|
|
17119
|
+
type: Boolean,
|
|
17120
|
+
default: false
|
|
17121
|
+
},
|
|
17122
|
+
placeholder: {},
|
|
17123
|
+
name: {},
|
|
17124
|
+
label: {},
|
|
17125
|
+
description: {},
|
|
17126
|
+
errorMessage: {},
|
|
17127
|
+
class: {},
|
|
17128
|
+
modelValue: { default: void 0 },
|
|
17129
|
+
defaultValue: { default: void 0 },
|
|
17130
|
+
multiple: {
|
|
17131
|
+
type: Boolean,
|
|
17132
|
+
default: false
|
|
17133
|
+
},
|
|
17134
|
+
multipleOverflow: { default: "wrap" },
|
|
17135
|
+
open: {
|
|
17136
|
+
type: Boolean,
|
|
17137
|
+
default: void 0
|
|
17138
|
+
},
|
|
17139
|
+
defaultOpen: {
|
|
17140
|
+
type: Boolean,
|
|
17141
|
+
default: void 0
|
|
17142
|
+
},
|
|
17143
|
+
items: { default: () => [] },
|
|
17144
|
+
loadItems: {
|
|
17145
|
+
type: Function,
|
|
17146
|
+
default: void 0
|
|
17147
|
+
},
|
|
17148
|
+
debounceMs: { default: 200 },
|
|
17149
|
+
filterOnOpen: {
|
|
17150
|
+
type: Boolean,
|
|
17151
|
+
default: false
|
|
17152
|
+
},
|
|
17153
|
+
truncateItems: {
|
|
17154
|
+
type: Boolean,
|
|
17155
|
+
default: true
|
|
17156
|
+
}
|
|
17157
|
+
},
|
|
17158
|
+
emits: [
|
|
17159
|
+
"update:modelValue",
|
|
17160
|
+
"update:open",
|
|
17161
|
+
"create"
|
|
17162
|
+
],
|
|
17163
|
+
setup(__props, { emit: __emit }) {
|
|
17164
|
+
const props = __props;
|
|
17165
|
+
const emit = __emit;
|
|
17166
|
+
const attrs = (0, vue.useAttrs)();
|
|
17167
|
+
const generatedId = (0, vue.useId)();
|
|
17168
|
+
const inputId = (0, vue.computed)(() => attrs.id ?? generatedId);
|
|
17169
|
+
const hasLabel = (0, vue.computed)(() => !!props.label);
|
|
17170
|
+
const slots = (0, vue.useSlots)();
|
|
17171
|
+
const usesCustomChrome = (0, vue.computed)(() => hasSlotComponent(slots.default?.(), [AutocompleteInput_default, AutocompleteContent_default]));
|
|
17172
|
+
const slotItemRegistry = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
17173
|
+
function registerItem(value, label) {
|
|
17174
|
+
const next = new Map(slotItemRegistry.value);
|
|
17175
|
+
next.set(value, label);
|
|
17176
|
+
slotItemRegistry.value = next;
|
|
17177
|
+
}
|
|
17178
|
+
function unregisterItem(value) {
|
|
17179
|
+
const next = new Map(slotItemRegistry.value);
|
|
17180
|
+
next.delete(value);
|
|
17181
|
+
slotItemRegistry.value = next;
|
|
17182
|
+
}
|
|
17183
|
+
const isLoading = (0, vue.ref)(false);
|
|
17184
|
+
const internalItems = (0, vue.ref)([...props.items]);
|
|
17185
|
+
const selectedValues = (0, vue.ref)(props.multiple && Array.isArray(props.modelValue) ? [...props.modelValue] : []);
|
|
17186
|
+
const internalOpen = (0, vue.ref)(props.defaultOpen ?? false);
|
|
17187
|
+
let selectingItem = false;
|
|
17188
|
+
const isOpen = (0, vue.ref)(props.defaultOpen ?? false);
|
|
17189
|
+
const termAtOpen = (0, vue.ref)("");
|
|
17190
|
+
const isUserTyping = (0, vue.ref)(false);
|
|
17191
|
+
const singleOpen = (0, vue.ref)(props.open ?? props.defaultOpen ?? false);
|
|
17192
|
+
let blockReopen = false;
|
|
17193
|
+
let blockReopenTimer;
|
|
17194
|
+
const effectiveIgnoreFilter = (0, vue.computed)(() => {
|
|
17195
|
+
if (props.loadItems) return true;
|
|
17196
|
+
if (!props.filterOnOpen && isOpen.value && !isUserTyping.value) return true;
|
|
17197
|
+
return false;
|
|
17198
|
+
});
|
|
17199
|
+
function labelFor(value) {
|
|
17200
|
+
if (value == null || value === "") return "";
|
|
17201
|
+
const match = internalItems.value.find((i) => i.value === value);
|
|
17202
|
+
if (match) return match.label ?? match.textValue ?? value;
|
|
17203
|
+
return slotItemRegistry.value.get(value) ?? value;
|
|
17204
|
+
}
|
|
17205
|
+
function valueFor(displayed) {
|
|
17206
|
+
if (!displayed) return "";
|
|
17207
|
+
const match = internalItems.value.find((i) => (i.label ?? i.textValue ?? i.value) === displayed);
|
|
17208
|
+
if (match) return match.value;
|
|
17209
|
+
for (const [value, label] of slotItemRegistry.value) if (label === displayed) return value;
|
|
17210
|
+
return displayed;
|
|
17211
|
+
}
|
|
17212
|
+
const singleModelValue = (0, vue.computed)(() => props.multiple ? void 0 : props.modelValue);
|
|
17213
|
+
const searchTerm = (0, vue.ref)(labelFor(singleModelValue.value));
|
|
17214
|
+
const isFilled = (0, vue.computed)(() => props.multiple ? selectedValues.value.length > 0 || !!searchTerm.value : !!searchTerm.value);
|
|
17215
|
+
const hasItems = (0, vue.computed)(() => internalItems.value.length > 0);
|
|
17216
|
+
const selectedLabels = (0, vue.computed)(() => selectedValues.value.map((v) => ({
|
|
17217
|
+
value: v,
|
|
17218
|
+
label: labelFor(v) || v
|
|
17219
|
+
})));
|
|
17220
|
+
const descriptionId = (0, vue.computed)(() => `${inputId.value}-description`);
|
|
17221
|
+
const errorMessageId = (0, vue.computed)(() => `${inputId.value}-error`);
|
|
17222
|
+
const showError = (0, vue.computed)(() => props.isInvalid && !!props.errorMessage);
|
|
17223
|
+
const showDescription = (0, vue.computed)(() => !!props.description && !showError.value);
|
|
17224
|
+
const hasHelper = (0, vue.computed)(() => showError.value || showDescription.value);
|
|
17225
|
+
const ariaDescribedBy = (0, vue.computed)(() => {
|
|
17226
|
+
if (showError.value) return errorMessageId.value;
|
|
17227
|
+
if (showDescription.value) return descriptionId.value;
|
|
17228
|
+
});
|
|
17229
|
+
(0, vue.watch)(() => props.modelValue, (val) => {
|
|
17230
|
+
if (props.multiple) {
|
|
17231
|
+
if (Array.isArray(val)) selectedValues.value = [...val];
|
|
17232
|
+
} else {
|
|
17233
|
+
const next = labelFor(val);
|
|
17234
|
+
if (searchTerm.value !== next) searchTerm.value = next;
|
|
17235
|
+
}
|
|
17236
|
+
});
|
|
17237
|
+
(0, vue.watch)(() => props.open, (val) => {
|
|
17238
|
+
if (!props.multiple && val !== void 0) singleOpen.value = val;
|
|
17239
|
+
});
|
|
17240
|
+
(0, vue.watch)(searchTerm, (displayed) => {
|
|
17241
|
+
if (props.multiple) {
|
|
17242
|
+
if (isOpen.value && displayed !== termAtOpen.value) isUserTyping.value = true;
|
|
17243
|
+
return;
|
|
17244
|
+
}
|
|
17245
|
+
const next = valueFor(displayed);
|
|
17246
|
+
if (next !== (singleModelValue.value ?? "")) emit("update:modelValue", next);
|
|
17247
|
+
if (isOpen.value && displayed !== termAtOpen.value) isUserTyping.value = true;
|
|
17248
|
+
});
|
|
17249
|
+
function handleOpenChange(val) {
|
|
17250
|
+
if (props.multiple) {
|
|
17251
|
+
isOpen.value = val;
|
|
17252
|
+
internalOpen.value = !val && selectingItem ? true : val;
|
|
17253
|
+
selectingItem = false;
|
|
17254
|
+
if (val) {
|
|
17255
|
+
termAtOpen.value = searchTerm.value;
|
|
17256
|
+
isUserTyping.value = false;
|
|
17257
|
+
} else isUserTyping.value = false;
|
|
17258
|
+
emit("update:open", val);
|
|
17259
|
+
return;
|
|
17260
|
+
}
|
|
17261
|
+
if (val && blockReopen) return;
|
|
17262
|
+
isOpen.value = val;
|
|
17263
|
+
singleOpen.value = val;
|
|
17264
|
+
if (val) {
|
|
17265
|
+
termAtOpen.value = searchTerm.value;
|
|
17266
|
+
isUserTyping.value = false;
|
|
17267
|
+
} else isUserTyping.value = false;
|
|
17268
|
+
emit("update:open", val);
|
|
17269
|
+
}
|
|
17270
|
+
function onMultipleSelect(value) {
|
|
17271
|
+
selectingItem = true;
|
|
17272
|
+
const idx = selectedValues.value.indexOf(value);
|
|
17273
|
+
selectedValues.value = idx === -1 ? [...selectedValues.value, value] : selectedValues.value.filter((_, i) => i !== idx);
|
|
17274
|
+
searchTerm.value = "";
|
|
17275
|
+
isUserTyping.value = false;
|
|
17276
|
+
emit("update:modelValue", selectedValues.value);
|
|
17277
|
+
}
|
|
17278
|
+
function removeValue(value) {
|
|
17279
|
+
selectedValues.value = selectedValues.value.filter((v) => v !== value);
|
|
17280
|
+
emit("update:modelValue", selectedValues.value);
|
|
17281
|
+
}
|
|
17282
|
+
function clearAll() {
|
|
17283
|
+
selectedValues.value = [];
|
|
17284
|
+
emit("update:modelValue", []);
|
|
17285
|
+
}
|
|
17286
|
+
function isSelected(value) {
|
|
17287
|
+
return selectedValues.value.includes(value);
|
|
17288
|
+
}
|
|
17289
|
+
const hasExactMatch = (0, vue.computed)(() => {
|
|
17290
|
+
const term = searchTerm.value.trim().toLowerCase();
|
|
17291
|
+
if (!term) return false;
|
|
17292
|
+
if (internalItems.value.some((i) => (i.label ?? i.textValue ?? i.value).toLowerCase() === term)) return true;
|
|
17293
|
+
for (const label of slotItemRegistry.value.values()) if (label.toLowerCase() === term) return true;
|
|
17294
|
+
return false;
|
|
17295
|
+
});
|
|
17296
|
+
function onCreateValue(value) {
|
|
17297
|
+
const trimmed = value.trim();
|
|
17298
|
+
if (!trimmed) return;
|
|
17299
|
+
if (props.multiple) {
|
|
17300
|
+
if (!selectedValues.value.includes(trimmed)) {
|
|
17301
|
+
selectingItem = true;
|
|
17302
|
+
selectedValues.value = [...selectedValues.value, trimmed];
|
|
17303
|
+
emit("update:modelValue", selectedValues.value);
|
|
17304
|
+
}
|
|
17305
|
+
searchTerm.value = "";
|
|
17306
|
+
isUserTyping.value = false;
|
|
17307
|
+
} else {
|
|
17308
|
+
searchTerm.value = trimmed;
|
|
17309
|
+
emit("update:modelValue", trimmed);
|
|
17310
|
+
isOpen.value = false;
|
|
17311
|
+
singleOpen.value = false;
|
|
17312
|
+
blockReopen = true;
|
|
17313
|
+
clearTimeout(blockReopenTimer);
|
|
17314
|
+
blockReopenTimer = setTimeout(() => {
|
|
17315
|
+
blockReopen = false;
|
|
17316
|
+
}, 300);
|
|
17317
|
+
}
|
|
17318
|
+
emit("create", trimmed);
|
|
17319
|
+
}
|
|
17320
|
+
let debounceTimer;
|
|
17321
|
+
async function runLoadItems(query) {
|
|
17322
|
+
if (!props.loadItems) return;
|
|
17323
|
+
isLoading.value = true;
|
|
17324
|
+
try {
|
|
17325
|
+
internalItems.value = await props.loadItems(query);
|
|
17326
|
+
} finally {
|
|
17327
|
+
isLoading.value = false;
|
|
17328
|
+
}
|
|
17329
|
+
}
|
|
17330
|
+
function scheduleLoad(query) {
|
|
17331
|
+
if (!props.loadItems) return;
|
|
17332
|
+
clearTimeout(debounceTimer);
|
|
17333
|
+
if (props.debounceMs === 0) runLoadItems(query);
|
|
17334
|
+
else debounceTimer = setTimeout(() => void runLoadItems(query), props.debounceMs);
|
|
17335
|
+
}
|
|
17336
|
+
(0, vue.onMounted)(() => {
|
|
17337
|
+
if (props.loadItems) runLoadItems(searchTerm.value);
|
|
17338
|
+
});
|
|
17339
|
+
(0, vue.watch)(searchTerm, (q) => {
|
|
17340
|
+
if (props.loadItems) scheduleLoad(q);
|
|
17341
|
+
});
|
|
17342
|
+
(0, vue.watch)(() => props.items, (newItems) => {
|
|
17343
|
+
if (!props.loadItems) internalItems.value = [...newItems];
|
|
17344
|
+
});
|
|
17345
|
+
(0, vue.watch)(internalItems, () => {
|
|
17346
|
+
if (props.multiple) return;
|
|
17347
|
+
const next = labelFor(singleModelValue.value);
|
|
17348
|
+
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
17349
|
+
});
|
|
17350
|
+
(0, vue.watch)(slotItemRegistry, () => {
|
|
17351
|
+
if (props.multiple) return;
|
|
17352
|
+
const next = labelFor(singleModelValue.value);
|
|
17353
|
+
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
17354
|
+
});
|
|
17355
|
+
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.autocompleteVariants)({
|
|
17356
|
+
variant: props.variant,
|
|
17357
|
+
size: props.size,
|
|
17358
|
+
color: props.color,
|
|
17359
|
+
fullWidth: props.fullWidth,
|
|
17360
|
+
isInvalid: props.isInvalid,
|
|
17361
|
+
isDisabled: props.isDisabled,
|
|
17362
|
+
isReadonly: props.isReadonly,
|
|
17363
|
+
hasLabel: hasLabel.value,
|
|
17364
|
+
labelPlacement: props.labelPlacement
|
|
17365
|
+
}));
|
|
17366
|
+
const showOutsideLabel = (0, vue.computed)(() => hasLabel.value && props.labelPlacement !== "inside");
|
|
17367
|
+
useAutocompleteProvide({
|
|
17368
|
+
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
17369
|
+
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
17370
|
+
isReadonly: (0, vue.toRef)(props, "isReadonly"),
|
|
17371
|
+
isRequired: (0, vue.toRef)(props, "isRequired"),
|
|
17372
|
+
isLoading,
|
|
17373
|
+
isFilled,
|
|
17374
|
+
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
17375
|
+
hasLabel,
|
|
17376
|
+
labelPlacement: (0, vue.toRef)(props, "labelPlacement"),
|
|
17377
|
+
inputId,
|
|
17378
|
+
label: (0, vue.toRef)(props, "label"),
|
|
17379
|
+
ariaDescribedBy,
|
|
17380
|
+
truncateItems: (0, vue.toRef)(props, "truncateItems"),
|
|
17381
|
+
hasItems,
|
|
17382
|
+
slots: slotFns,
|
|
17383
|
+
multiple: (0, vue.toRef)(props, "multiple"),
|
|
17384
|
+
multipleOverflow: (0, vue.toRef)(props, "multipleOverflow"),
|
|
17385
|
+
selectedValues,
|
|
17386
|
+
selectedLabels,
|
|
17387
|
+
onMultipleSelect,
|
|
17388
|
+
removeValue,
|
|
17389
|
+
clearAll,
|
|
17390
|
+
isSelected,
|
|
17391
|
+
registerItem,
|
|
17392
|
+
unregisterItem,
|
|
17393
|
+
searchTerm,
|
|
17394
|
+
hasExactMatch,
|
|
17395
|
+
onCreateValue
|
|
17396
|
+
});
|
|
17397
|
+
return (_ctx, _cache) => {
|
|
17398
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17399
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
17400
|
+
"data-invalid": __props.isInvalid || void 0,
|
|
17401
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
17402
|
+
"data-readonly": __props.isReadonly || void 0,
|
|
17403
|
+
"data-required": __props.isRequired || void 0,
|
|
17404
|
+
"data-has-label": hasLabel.value || void 0,
|
|
17405
|
+
"data-has-helper": hasHelper.value || void 0
|
|
17406
|
+
}, [showOutsideLabel.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
17407
|
+
key: 0,
|
|
17408
|
+
for: inputId.value,
|
|
17409
|
+
class: (0, vue.normalizeClass)(slotFns.value.label())
|
|
17410
|
+
}, [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.label), 1), __props.isRequired ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_3$10, " *")) : (0, vue.createCommentVNode)("", true)], 10, _hoisted_2$16)) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(slotFns.value.mainWrapper()) }, [(0, vue.createVNode)((0, vue.unref)(reka_ui.AutocompleteRoot), {
|
|
17411
|
+
"model-value": searchTerm.value,
|
|
17412
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchTerm.value = $event),
|
|
17413
|
+
open: props.multiple ? internalOpen.value : singleOpen.value,
|
|
17414
|
+
disabled: props.isDisabled,
|
|
17415
|
+
required: props.isRequired,
|
|
17416
|
+
"ignore-filter": effectiveIgnoreFilter.value,
|
|
17417
|
+
"open-on-focus": true,
|
|
17418
|
+
"onUpdate:open": handleOpenChange
|
|
17419
|
+
}, {
|
|
17420
|
+
default: (0, vue.withCtx)(() => [usesCustomChrome.value ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
17421
|
+
key: 0,
|
|
17422
|
+
isLoading: isLoading.value,
|
|
17423
|
+
items: internalItems.value
|
|
17424
|
+
}) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.createVNode)(AutocompleteInput_default, { placeholder: props.placeholder }, null, 8, ["placeholder"]), (0, vue.createVNode)(AutocompleteContent_default, null, {
|
|
17425
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(internalItems.value, (item) => {
|
|
17426
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(AutocompleteItem_default, {
|
|
17427
|
+
key: item.value,
|
|
17428
|
+
value: item.value,
|
|
17429
|
+
"is-disabled": item.isDisabled
|
|
17430
|
+
}, {
|
|
17431
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "item", { item }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(item.label ?? item.textValue ?? item.value), 1)])]),
|
|
17432
|
+
_: 2
|
|
17433
|
+
}, 1032, ["value", "is-disabled"]);
|
|
17434
|
+
}), 128))]),
|
|
17435
|
+
_: 3
|
|
17436
|
+
})], 64))]),
|
|
17437
|
+
_: 3
|
|
17438
|
+
}, 8, [
|
|
17439
|
+
"model-value",
|
|
17440
|
+
"open",
|
|
17441
|
+
"disabled",
|
|
17442
|
+
"required",
|
|
17443
|
+
"ignore-filter"
|
|
17444
|
+
]), hasHelper.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17445
|
+
key: 0,
|
|
17446
|
+
class: (0, vue.normalizeClass)(slotFns.value.helperWrapper())
|
|
17447
|
+
}, [showError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17448
|
+
key: 0,
|
|
17449
|
+
id: errorMessageId.value,
|
|
17450
|
+
class: (0, vue.normalizeClass)(slotFns.value.errorMessage())
|
|
17451
|
+
}, (0, vue.toDisplayString)(__props.errorMessage), 11, _hoisted_4$5)) : showDescription.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17452
|
+
key: 1,
|
|
17453
|
+
id: descriptionId.value,
|
|
17454
|
+
class: (0, vue.normalizeClass)(slotFns.value.description())
|
|
17455
|
+
}, (0, vue.toDisplayString)(__props.description), 11, _hoisted_5$4)) : (0, vue.createCommentVNode)("", true)], 2)) : (0, vue.createCommentVNode)("", true)], 2)], 10, _hoisted_1$28);
|
|
17456
|
+
};
|
|
17457
|
+
}
|
|
17458
|
+
});
|
|
17459
|
+
//#endregion
|
|
17385
17460
|
//#region src/components/autocomplete/AutocompleteCreateItem.vue?vue&type=script&setup=true&lang.ts
|
|
17386
17461
|
var _hoisted_1$27 = {
|
|
17387
17462
|
class: "autocomplete-item__text",
|