@auronui/vue 1.0.12 → 1.0.13
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 +785 -711
- 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/index.d.ts +49 -20
- 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
|
@@ -15131,186 +15131,31 @@ var ListBoxSection_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15131
15131
|
//#region src/components/select/Select.context.ts
|
|
15132
15132
|
var { useProvide: useSelectProvide, useInject: useSelectInject, key: selectContextKey } = createContext("Select");
|
|
15133
15133
|
//#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));
|
|
15134
|
+
//#region src/utils/hasSlotComponent.ts
|
|
15135
|
+
/**
|
|
15136
|
+
* Returns true if any vnode in `nodes` has a `type` referentially equal to one
|
|
15137
|
+
* of `components`, recursively flattening `Fragment` (v-for / template) children.
|
|
15138
|
+
*
|
|
15139
|
+
* Dropdown form controls (Select, Autocomplete, ComboBox) use this to detect
|
|
15140
|
+
* whether the consumer supplied explicit compound chrome (e.g. SelectTrigger /
|
|
15141
|
+
* SelectContent) versus terse `*Item` children or an `items` prop. When chrome
|
|
15142
|
+
* is present the control passes the slot through unchanged; otherwise it renders
|
|
15143
|
+
* the trigger/value/content internally.
|
|
15144
|
+
*/
|
|
15145
|
+
function hasSlotComponent(nodes, components) {
|
|
15146
|
+
if (!nodes) return false;
|
|
15147
|
+
for (const node of nodes) {
|
|
15148
|
+
if (components.includes(node.type)) return true;
|
|
15149
|
+
if (node.type === vue.Fragment && Array.isArray(node.children)) {
|
|
15150
|
+
if (hasSlotComponent(node.children, components)) return true;
|
|
15241
15151
|
}
|
|
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
15152
|
}
|
|
15309
|
-
|
|
15153
|
+
return false;
|
|
15154
|
+
}
|
|
15310
15155
|
//#endregion
|
|
15311
15156
|
//#region src/components/select/SelectTrigger.vue?vue&type=script&setup=true&lang.ts
|
|
15312
|
-
var _hoisted_1$
|
|
15313
|
-
var _hoisted_2$
|
|
15157
|
+
var _hoisted_1$37 = ["for"];
|
|
15158
|
+
var _hoisted_2$22 = {
|
|
15314
15159
|
key: 0,
|
|
15315
15160
|
"aria-hidden": "true"
|
|
15316
15161
|
};
|
|
@@ -15345,7 +15190,7 @@ var SelectTrigger_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15345
15190
|
key: 0,
|
|
15346
15191
|
for: (0, vue.unref)(ctx).triggerId.value,
|
|
15347
15192
|
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$
|
|
15193
|
+
}, [(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
15194
|
_ctx.$slots.startContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
15350
15195
|
key: 1,
|
|
15351
15196
|
class: (0, vue.normalizeClass)((0, vue.unref)(ctx).slots.value.startContent()),
|
|
@@ -15386,7 +15231,7 @@ var SelectTrigger_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15386
15231
|
});
|
|
15387
15232
|
//#endregion
|
|
15388
15233
|
//#region src/components/select/SelectOverflowChips.vue?vue&type=script&setup=true&lang.ts
|
|
15389
|
-
var _hoisted_1$
|
|
15234
|
+
var _hoisted_1$36 = {
|
|
15390
15235
|
ref: "container",
|
|
15391
15236
|
style: {
|
|
15392
15237
|
"display": "flex",
|
|
@@ -15444,7 +15289,7 @@ var SelectOverflowChips_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15444
15289
|
(0, _vueuse_core.useResizeObserver)(containerEl, reflow);
|
|
15445
15290
|
(0, vue.watch)(() => props.values.join("\0"), () => reflow(), { flush: "post" });
|
|
15446
15291
|
return (_ctx, _cache) => {
|
|
15447
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
15292
|
+
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
15293
|
return (0, vue.openBlock)(), (0, vue.createBlock)(Chip_default, {
|
|
15449
15294
|
key: val,
|
|
15450
15295
|
"data-chip-item": "",
|
|
@@ -15486,7 +15331,7 @@ var SelectValue_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15486
15331
|
key: 0,
|
|
15487
15332
|
values: modelValue,
|
|
15488
15333
|
"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(
|
|
15334
|
+
}, 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
15335
|
_: 1
|
|
15491
15336
|
}, 8, ["class", "placeholder"]);
|
|
15492
15337
|
};
|
|
@@ -15568,14 +15413,14 @@ var SelectItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15568
15413
|
if (props.textValue !== void 0) ctx.registerItem(props.value, props.textValue);
|
|
15569
15414
|
(0, vue.onMounted)(() => {
|
|
15570
15415
|
const el = textRef.value?.$el;
|
|
15571
|
-
const label = props.textValue ?? el?.textContent?.trim() ?? props.value;
|
|
15416
|
+
const label = props.textValue ?? el?.textContent?.trim() ?? String(props.value);
|
|
15572
15417
|
ctx.registerItem(props.value, label);
|
|
15573
15418
|
});
|
|
15574
15419
|
return (_ctx, _cache) => {
|
|
15575
15420
|
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.SelectItem), {
|
|
15576
15421
|
value: props.value,
|
|
15577
15422
|
disabled: props.isDisabled,
|
|
15578
|
-
"text-value": props.textValue ?? props.value,
|
|
15423
|
+
"text-value": props.textValue ?? String(props.value),
|
|
15579
15424
|
class: "list-box-item list-box-item--default",
|
|
15580
15425
|
"data-slot": "list-box-item"
|
|
15581
15426
|
}, {
|
|
@@ -15619,53 +15464,253 @@ var SelectItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
15619
15464
|
}
|
|
15620
15465
|
});
|
|
15621
15466
|
//#endregion
|
|
15622
|
-
//#region src/components/
|
|
15623
|
-
var
|
|
15467
|
+
//#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
|
|
15468
|
+
var _hoisted_1$35 = [
|
|
15469
|
+
"data-invalid",
|
|
15470
|
+
"data-disabled",
|
|
15471
|
+
"data-readonly",
|
|
15472
|
+
"data-required",
|
|
15473
|
+
"data-has-label",
|
|
15474
|
+
"data-has-helper"
|
|
15475
|
+
];
|
|
15476
|
+
var _hoisted_2$21 = ["for"];
|
|
15477
|
+
var _hoisted_3$13 = {
|
|
15478
|
+
key: 0,
|
|
15479
|
+
"aria-hidden": "true"
|
|
15480
|
+
};
|
|
15481
|
+
var _hoisted_4$8 = ["id"];
|
|
15482
|
+
var _hoisted_5$6 = ["id"];
|
|
15624
15483
|
//#endregion
|
|
15625
|
-
//#region src/components/
|
|
15626
|
-
var
|
|
15627
|
-
|
|
15484
|
+
//#region src/components/select/Select.vue
|
|
15485
|
+
var Select_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
15486
|
+
inheritAttrs: false,
|
|
15487
|
+
__name: "Select",
|
|
15628
15488
|
props: {
|
|
15629
|
-
|
|
15489
|
+
variant: { default: "flat" },
|
|
15490
|
+
size: { default: "md" },
|
|
15491
|
+
color: { default: "default" },
|
|
15492
|
+
labelPlacement: { default: "inside" },
|
|
15493
|
+
fullWidth: {
|
|
15630
15494
|
type: Boolean,
|
|
15631
|
-
default:
|
|
15495
|
+
default: false
|
|
15632
15496
|
},
|
|
15633
|
-
|
|
15497
|
+
isInvalid: {
|
|
15634
15498
|
type: Boolean,
|
|
15635
|
-
default:
|
|
15499
|
+
default: false
|
|
15636
15500
|
},
|
|
15637
|
-
|
|
15501
|
+
isDisabled: {
|
|
15638
15502
|
type: Boolean,
|
|
15639
|
-
default:
|
|
15503
|
+
default: false
|
|
15640
15504
|
},
|
|
15641
|
-
|
|
15642
|
-
color: { default: void 0 },
|
|
15643
|
-
size: { default: void 0 },
|
|
15644
|
-
closeOnSelect: {
|
|
15505
|
+
isReadonly: {
|
|
15645
15506
|
type: Boolean,
|
|
15646
|
-
default:
|
|
15507
|
+
default: false
|
|
15647
15508
|
},
|
|
15648
|
-
|
|
15509
|
+
isRequired: {
|
|
15649
15510
|
type: Boolean,
|
|
15650
15511
|
default: false
|
|
15651
15512
|
},
|
|
15652
|
-
|
|
15513
|
+
placeholder: {},
|
|
15514
|
+
name: {},
|
|
15515
|
+
label: {},
|
|
15516
|
+
description: {},
|
|
15517
|
+
errorMessage: {},
|
|
15518
|
+
class: {},
|
|
15519
|
+
modelValue: { default: void 0 },
|
|
15520
|
+
defaultValue: { default: void 0 },
|
|
15521
|
+
multiple: {
|
|
15522
|
+
type: Boolean,
|
|
15523
|
+
default: false
|
|
15524
|
+
},
|
|
15525
|
+
open: {
|
|
15526
|
+
type: Boolean,
|
|
15527
|
+
default: void 0
|
|
15528
|
+
},
|
|
15529
|
+
defaultOpen: {
|
|
15530
|
+
type: Boolean,
|
|
15531
|
+
default: void 0
|
|
15532
|
+
},
|
|
15533
|
+
items: { default: () => [] }
|
|
15653
15534
|
},
|
|
15654
|
-
emits: ["update:
|
|
15535
|
+
emits: ["update:modelValue", "update:open"],
|
|
15655
15536
|
setup(__props, { emit: __emit }) {
|
|
15656
15537
|
const props = __props;
|
|
15657
15538
|
const emit = __emit;
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
});
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15539
|
+
const attrs = (0, vue.useAttrs)();
|
|
15540
|
+
const generatedId = (0, vue.useId)();
|
|
15541
|
+
const triggerId = (0, vue.computed)(() => attrs.id ?? generatedId);
|
|
15542
|
+
const hasLabel = (0, vue.computed)(() => !!props.label);
|
|
15543
|
+
const slots = (0, vue.useSlots)();
|
|
15544
|
+
const usesCustomChrome = (0, vue.computed)(() => hasSlotComponent(slots.default?.(), [SelectTrigger_default, SelectContent_default]));
|
|
15545
|
+
const descriptionId = (0, vue.computed)(() => `${triggerId.value}-description`);
|
|
15546
|
+
const errorMessageId = (0, vue.computed)(() => `${triggerId.value}-error`);
|
|
15547
|
+
const showError = (0, vue.computed)(() => props.isInvalid && !!props.errorMessage);
|
|
15548
|
+
const showDescription = (0, vue.computed)(() => !!props.description && !showError.value);
|
|
15549
|
+
const hasHelper = (0, vue.computed)(() => showError.value || showDescription.value);
|
|
15550
|
+
const ariaDescribedBy = (0, vue.computed)(() => {
|
|
15551
|
+
if (showError.value) return errorMessageId.value;
|
|
15552
|
+
if (showDescription.value) return descriptionId.value;
|
|
15553
|
+
});
|
|
15554
|
+
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.selectVariants)({
|
|
15555
|
+
variant: props.variant,
|
|
15556
|
+
size: props.size,
|
|
15557
|
+
color: props.color,
|
|
15558
|
+
fullWidth: props.fullWidth,
|
|
15559
|
+
isInvalid: props.isInvalid,
|
|
15560
|
+
isDisabled: props.isDisabled,
|
|
15561
|
+
isReadonly: props.isReadonly,
|
|
15562
|
+
hasLabel: hasLabel.value,
|
|
15563
|
+
labelPlacement: props.labelPlacement
|
|
15564
|
+
}));
|
|
15565
|
+
const showOutsideLabel = (0, vue.computed)(() => hasLabel.value && props.labelPlacement !== "inside");
|
|
15566
|
+
const itemRegistry = (0, vue.reactive)(/* @__PURE__ */ new Map());
|
|
15567
|
+
const registerItem = (value, label) => {
|
|
15568
|
+
itemRegistry.set(value, label);
|
|
15569
|
+
};
|
|
15570
|
+
const itemLabel = (value) => {
|
|
15571
|
+
if (value == null) return "";
|
|
15572
|
+
if (Array.isArray(value)) return value.map((v) => String(itemRegistry.get(v) ?? v)).filter((s) => s.length > 0).join(", ");
|
|
15573
|
+
return itemRegistry.get(value) ?? String(value);
|
|
15574
|
+
};
|
|
15575
|
+
function removeValue(value) {
|
|
15576
|
+
emit("update:modelValue", (Array.isArray(props.modelValue) ? props.modelValue : []).filter((v) => v !== value));
|
|
15577
|
+
}
|
|
15578
|
+
useSelectProvide({
|
|
15579
|
+
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
15580
|
+
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
15581
|
+
isReadonly: (0, vue.toRef)(props, "isReadonly"),
|
|
15582
|
+
isRequired: (0, vue.toRef)(props, "isRequired"),
|
|
15583
|
+
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
15584
|
+
hasLabel,
|
|
15585
|
+
labelPlacement: (0, vue.toRef)(props, "labelPlacement"),
|
|
15586
|
+
triggerId,
|
|
15587
|
+
label: (0, vue.toRef)(props, "label"),
|
|
15588
|
+
ariaDescribedBy,
|
|
15589
|
+
slots: slotFns,
|
|
15590
|
+
multiple: (0, vue.toRef)(props, "multiple"),
|
|
15591
|
+
registerItem,
|
|
15592
|
+
itemLabel,
|
|
15593
|
+
removeValue
|
|
15594
|
+
});
|
|
15595
|
+
return (_ctx, _cache) => {
|
|
15596
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15597
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
15598
|
+
"data-invalid": __props.isInvalid || void 0,
|
|
15599
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
15600
|
+
"data-readonly": __props.isReadonly || void 0,
|
|
15601
|
+
"data-required": __props.isRequired || void 0,
|
|
15602
|
+
"data-has-label": hasLabel.value || void 0,
|
|
15603
|
+
"data-has-helper": hasHelper.value || void 0
|
|
15604
|
+
}, [showOutsideLabel.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
15605
|
+
key: 0,
|
|
15606
|
+
for: triggerId.value,
|
|
15607
|
+
class: (0, vue.normalizeClass)(slotFns.value.label())
|
|
15608
|
+
}, [(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), {
|
|
15609
|
+
"model-value": props.modelValue,
|
|
15610
|
+
"default-value": props.defaultValue,
|
|
15611
|
+
multiple: props.multiple,
|
|
15612
|
+
open: props.open,
|
|
15613
|
+
"default-open": props.defaultOpen,
|
|
15614
|
+
disabled: props.isDisabled,
|
|
15615
|
+
required: props.isRequired,
|
|
15616
|
+
name: props.name,
|
|
15617
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event)),
|
|
15618
|
+
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => emit("update:open", $event))
|
|
15619
|
+
}, {
|
|
15620
|
+
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, {
|
|
15621
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)(SelectValue_default, { placeholder: props.placeholder }, null, 8, ["placeholder"])]),
|
|
15622
|
+
_: 1
|
|
15623
|
+
}), (0, vue.createVNode)(SelectContent_default, null, {
|
|
15624
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(props.items, (item) => {
|
|
15625
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(SelectItem_default, {
|
|
15626
|
+
key: item.value,
|
|
15627
|
+
value: item.value,
|
|
15628
|
+
"text-value": item.textValue ?? item.label,
|
|
15629
|
+
"is-disabled": item.isDisabled
|
|
15630
|
+
}, {
|
|
15631
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "item", { item }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(item.label ?? String(item.value)), 1)])]),
|
|
15632
|
+
_: 2
|
|
15633
|
+
}, 1032, [
|
|
15634
|
+
"value",
|
|
15635
|
+
"text-value",
|
|
15636
|
+
"is-disabled"
|
|
15637
|
+
]);
|
|
15638
|
+
}), 128)), (0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
15639
|
+
_: 3
|
|
15640
|
+
})], 64))]),
|
|
15641
|
+
_: 3
|
|
15642
|
+
}, 8, [
|
|
15643
|
+
"model-value",
|
|
15644
|
+
"default-value",
|
|
15645
|
+
"multiple",
|
|
15646
|
+
"open",
|
|
15647
|
+
"default-open",
|
|
15648
|
+
"disabled",
|
|
15649
|
+
"required",
|
|
15650
|
+
"name"
|
|
15651
|
+
]), hasHelper.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15652
|
+
key: 0,
|
|
15653
|
+
class: (0, vue.normalizeClass)(slotFns.value.helperWrapper())
|
|
15654
|
+
}, [showError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15655
|
+
key: 0,
|
|
15656
|
+
id: errorMessageId.value,
|
|
15657
|
+
class: (0, vue.normalizeClass)(slotFns.value.errorMessage())
|
|
15658
|
+
}, (0, vue.toDisplayString)(__props.errorMessage), 11, _hoisted_4$8)) : showDescription.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
15659
|
+
key: 1,
|
|
15660
|
+
id: descriptionId.value,
|
|
15661
|
+
class: (0, vue.normalizeClass)(slotFns.value.description())
|
|
15662
|
+
}, (0, vue.toDisplayString)(__props.description), 11, _hoisted_5$6)) : (0, vue.createCommentVNode)("", true)], 2)) : (0, vue.createCommentVNode)("", true)], 2)], 10, _hoisted_1$35);
|
|
15663
|
+
};
|
|
15664
|
+
}
|
|
15665
|
+
});
|
|
15666
|
+
//#endregion
|
|
15667
|
+
//#region src/components/dropdown/Dropdown.context.ts
|
|
15668
|
+
var { useProvide: useDropdownProvide, useInject: useDropdownInject, key: dropdownContextKey } = createContext("Dropdown");
|
|
15669
|
+
//#endregion
|
|
15670
|
+
//#region src/components/dropdown/Dropdown.vue
|
|
15671
|
+
var Dropdown_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
15672
|
+
__name: "Dropdown",
|
|
15673
|
+
props: {
|
|
15674
|
+
isOpen: {
|
|
15675
|
+
type: Boolean,
|
|
15676
|
+
default: void 0
|
|
15677
|
+
},
|
|
15678
|
+
defaultOpen: {
|
|
15679
|
+
type: Boolean,
|
|
15680
|
+
default: void 0
|
|
15681
|
+
},
|
|
15682
|
+
modal: {
|
|
15683
|
+
type: Boolean,
|
|
15684
|
+
default: true
|
|
15685
|
+
},
|
|
15686
|
+
variant: { default: void 0 },
|
|
15687
|
+
color: { default: void 0 },
|
|
15688
|
+
size: { default: void 0 },
|
|
15689
|
+
closeOnSelect: {
|
|
15690
|
+
type: Boolean,
|
|
15691
|
+
default: true
|
|
15692
|
+
},
|
|
15693
|
+
disableAnimation: {
|
|
15694
|
+
type: Boolean,
|
|
15695
|
+
default: false
|
|
15696
|
+
},
|
|
15697
|
+
class: { default: void 0 }
|
|
15698
|
+
},
|
|
15699
|
+
emits: ["update:isOpen"],
|
|
15700
|
+
setup(__props, { emit: __emit }) {
|
|
15701
|
+
const props = __props;
|
|
15702
|
+
const emit = __emit;
|
|
15703
|
+
useDropdownProvide({
|
|
15704
|
+
variant: (0, vue.toRef)(props, "variant"),
|
|
15705
|
+
color: (0, vue.toRef)(props, "color"),
|
|
15706
|
+
size: (0, vue.toRef)(props, "size"),
|
|
15707
|
+
closeOnSelect: (0, vue.toRef)(props, "closeOnSelect"),
|
|
15708
|
+
disableAnimation: (0, vue.toRef)(props, "disableAnimation")
|
|
15709
|
+
});
|
|
15710
|
+
return (_ctx, _cache) => {
|
|
15711
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.DropdownMenuRoot), {
|
|
15712
|
+
open: props.isOpen,
|
|
15713
|
+
"default-open": props.defaultOpen,
|
|
15669
15714
|
modal: props.modal,
|
|
15670
15715
|
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => emit("update:isOpen", $event))
|
|
15671
15716
|
}, {
|
|
@@ -16108,176 +16153,14 @@ var DropdownSubContent_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16108
16153
|
//#region src/components/combo-box/ComboBox.context.ts
|
|
16109
16154
|
var { useProvide: useComboBoxProvide, useInject: useComboBoxInject, key: comboBoxContextKey } = createContext("ComboBox");
|
|
16110
16155
|
//#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",
|
|
16156
|
+
//#region src/components/combo-box/ComboBoxInput.vue
|
|
16157
|
+
var ComboBoxInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16158
|
+
__name: "ComboBoxInput",
|
|
16135
16159
|
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
16160
|
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
16161
|
class: { default: void 0 }
|
|
16176
16162
|
},
|
|
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) {
|
|
16163
|
+
setup(__props) {
|
|
16281
16164
|
const props = __props;
|
|
16282
16165
|
const ctx = useComboBoxInject();
|
|
16283
16166
|
return (_ctx, _cache) => {
|
|
@@ -16518,64 +16401,51 @@ var ComboBoxItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16518
16401
|
}
|
|
16519
16402
|
});
|
|
16520
16403
|
//#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 = {
|
|
16404
|
+
//#region src/components/combo-box/ComboBox.vue?vue&type=script&setup=true&lang.ts
|
|
16405
|
+
var _hoisted_1$33 = ["aria-invalid"];
|
|
16406
|
+
var _hoisted_2$19 = ["id"];
|
|
16407
|
+
var _hoisted_3$11 = {
|
|
16551
16408
|
key: 0,
|
|
16552
16409
|
"aria-hidden": "true"
|
|
16553
16410
|
};
|
|
16554
|
-
var _hoisted_4$
|
|
16555
|
-
|
|
16411
|
+
var _hoisted_4$6 = {
|
|
16412
|
+
key: 1,
|
|
16413
|
+
"data-slot": "helper-wrapper"
|
|
16414
|
+
};
|
|
16415
|
+
var _hoisted_5$5 = {
|
|
16416
|
+
key: 0,
|
|
16417
|
+
"data-slot": "error-message",
|
|
16418
|
+
"aria-live": "polite"
|
|
16419
|
+
};
|
|
16420
|
+
var _hoisted_6$4 = {
|
|
16421
|
+
key: 1,
|
|
16422
|
+
"data-slot": "description"
|
|
16423
|
+
};
|
|
16556
16424
|
//#endregion
|
|
16557
|
-
//#region src/components/
|
|
16558
|
-
var
|
|
16559
|
-
|
|
16560
|
-
__name: "Autocomplete",
|
|
16425
|
+
//#region src/components/combo-box/ComboBox.vue
|
|
16426
|
+
var ComboBox_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16427
|
+
__name: "ComboBox",
|
|
16561
16428
|
props: {
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
labelPlacement: { default: "inside" },
|
|
16566
|
-
fullWidth: {
|
|
16429
|
+
modelValue: { default: void 0 },
|
|
16430
|
+
defaultValue: { default: void 0 },
|
|
16431
|
+
open: {
|
|
16567
16432
|
type: Boolean,
|
|
16568
|
-
default:
|
|
16433
|
+
default: void 0
|
|
16569
16434
|
},
|
|
16570
|
-
|
|
16435
|
+
defaultOpen: {
|
|
16571
16436
|
type: Boolean,
|
|
16572
|
-
default:
|
|
16437
|
+
default: void 0
|
|
16573
16438
|
},
|
|
16574
|
-
|
|
16439
|
+
items: { default: () => [] },
|
|
16440
|
+
label: { default: void 0 },
|
|
16441
|
+
placeholder: { default: void 0 },
|
|
16442
|
+
description: { default: void 0 },
|
|
16443
|
+
errorMessage: { default: void 0 },
|
|
16444
|
+
isInvalid: {
|
|
16575
16445
|
type: Boolean,
|
|
16576
16446
|
default: false
|
|
16577
16447
|
},
|
|
16578
|
-
|
|
16448
|
+
isDisabled: {
|
|
16579
16449
|
type: Boolean,
|
|
16580
16450
|
default: false
|
|
16581
16451
|
},
|
|
@@ -16583,54 +16453,32 @@ var Autocomplete_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16583
16453
|
type: Boolean,
|
|
16584
16454
|
default: false
|
|
16585
16455
|
},
|
|
16586
|
-
|
|
16587
|
-
name: {},
|
|
16588
|
-
label: {},
|
|
16589
|
-
description: {},
|
|
16590
|
-
errorMessage: {},
|
|
16591
|
-
class: {},
|
|
16592
|
-
modelValue: { default: void 0 },
|
|
16593
|
-
defaultValue: { default: void 0 },
|
|
16594
|
-
multiple: {
|
|
16456
|
+
allowsCustomValue: {
|
|
16595
16457
|
type: Boolean,
|
|
16596
16458
|
default: false
|
|
16597
16459
|
},
|
|
16598
|
-
|
|
16599
|
-
open: {
|
|
16600
|
-
type: Boolean,
|
|
16601
|
-
default: void 0
|
|
16602
|
-
},
|
|
16603
|
-
defaultOpen: {
|
|
16460
|
+
fullWidth: {
|
|
16604
16461
|
type: Boolean,
|
|
16605
|
-
default:
|
|
16462
|
+
default: false
|
|
16606
16463
|
},
|
|
16607
|
-
|
|
16608
|
-
loadItems: {
|
|
16464
|
+
filterFunction: {
|
|
16609
16465
|
type: Function,
|
|
16610
16466
|
default: void 0
|
|
16611
16467
|
},
|
|
16612
|
-
|
|
16613
|
-
filterOnOpen: {
|
|
16614
|
-
type: Boolean,
|
|
16615
|
-
default: false
|
|
16616
|
-
},
|
|
16617
|
-
truncateItems: {
|
|
16618
|
-
type: Boolean,
|
|
16619
|
-
default: true
|
|
16620
|
-
}
|
|
16468
|
+
class: { default: void 0 }
|
|
16621
16469
|
},
|
|
16622
|
-
emits: [
|
|
16623
|
-
"update:modelValue",
|
|
16624
|
-
"update:open",
|
|
16625
|
-
"create"
|
|
16626
|
-
],
|
|
16470
|
+
emits: ["update:modelValue", "update:open"],
|
|
16627
16471
|
setup(__props, { emit: __emit }) {
|
|
16628
16472
|
const props = __props;
|
|
16629
16473
|
const emit = __emit;
|
|
16630
|
-
const
|
|
16631
|
-
const
|
|
16632
|
-
const
|
|
16633
|
-
const
|
|
16474
|
+
const labelId = (0, vue.useId)();
|
|
16475
|
+
const slots = (0, vue.useSlots)();
|
|
16476
|
+
const usesCustomChrome = (0, vue.computed)(() => hasSlotComponent(slots.default?.(), [ComboBoxInput_default, ComboBoxContent_default]));
|
|
16477
|
+
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.comboBoxVariants)({ fullWidth: props.fullWidth }));
|
|
16478
|
+
const effectiveFilter = (0, vue.computed)(() => {
|
|
16479
|
+
if (props.filterFunction) return props.filterFunction;
|
|
16480
|
+
return (itemText, searchTerm) => itemText.toLowerCase().includes(searchTerm.toLowerCase());
|
|
16481
|
+
});
|
|
16634
16482
|
const slotItemRegistry = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
16635
16483
|
function registerItem(value, label) {
|
|
16636
16484
|
const next = new Map(slotItemRegistry.value);
|
|
@@ -16642,272 +16490,114 @@ var Autocomplete_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
16642
16490
|
next.delete(value);
|
|
16643
16491
|
slotItemRegistry.value = next;
|
|
16644
16492
|
}
|
|
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
16493
|
function labelFor(value) {
|
|
16662
|
-
if (value
|
|
16663
|
-
const
|
|
16664
|
-
if (
|
|
16494
|
+
if (!value) return "";
|
|
16495
|
+
const item = props.items.find((i) => i.value === value);
|
|
16496
|
+
if (item) return item.label ?? item.textValue ?? value;
|
|
16665
16497
|
return slotItemRegistry.value.get(value) ?? value;
|
|
16666
16498
|
}
|
|
16667
|
-
function valueFor(
|
|
16668
|
-
if (!
|
|
16669
|
-
const
|
|
16670
|
-
if (
|
|
16671
|
-
for (const [value,
|
|
16672
|
-
return
|
|
16499
|
+
function valueFor(label) {
|
|
16500
|
+
if (!label) return "";
|
|
16501
|
+
const item = props.items.find((i) => (i.label ?? i.textValue ?? i.value) === label);
|
|
16502
|
+
if (item) return item.value;
|
|
16503
|
+
for (const [value, lbl] of slotItemRegistry.value) if (lbl === label) return value;
|
|
16504
|
+
return label;
|
|
16673
16505
|
}
|
|
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
|
-
});
|
|
16506
|
+
const internalValue = (0, vue.ref)(labelFor(props.modelValue));
|
|
16507
|
+
const displayValue = (0, vue.computed)(() => (val) => val);
|
|
16691
16508
|
(0, vue.watch)(() => props.modelValue, (val) => {
|
|
16692
|
-
|
|
16693
|
-
|
|
16694
|
-
} else {
|
|
16695
|
-
const next = labelFor(val);
|
|
16696
|
-
if (searchTerm.value !== next) searchTerm.value = next;
|
|
16697
|
-
}
|
|
16698
|
-
});
|
|
16699
|
-
(0, vue.watch)(() => props.open, (val) => {
|
|
16700
|
-
if (!props.multiple && val !== void 0) singleOpen.value = val;
|
|
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;
|
|
16509
|
+
const next = labelFor(val);
|
|
16510
|
+
if (internalValue.value !== next) internalValue.value = next;
|
|
16757
16511
|
});
|
|
16758
|
-
function
|
|
16759
|
-
|
|
16760
|
-
|
|
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);
|
|
16512
|
+
function handleModelValueUpdate(emitted) {
|
|
16513
|
+
internalValue.value = emitted;
|
|
16514
|
+
emit("update:modelValue", valueFor(emitted));
|
|
16797
16515
|
}
|
|
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
16516
|
(0, vue.watch)(slotItemRegistry, () => {
|
|
16813
|
-
|
|
16814
|
-
|
|
16815
|
-
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
16517
|
+
const next = labelFor(props.modelValue);
|
|
16518
|
+
if (next !== internalValue.value && valueFor(internalValue.value) === (props.modelValue ?? "")) internalValue.value = next;
|
|
16816
16519
|
});
|
|
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({
|
|
16520
|
+
useComboBoxProvide({
|
|
16830
16521
|
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
16831
16522
|
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
16523
|
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
16524
|
slots: slotFns,
|
|
16845
|
-
|
|
16846
|
-
multipleOverflow: (0, vue.toRef)(props, "multipleOverflow"),
|
|
16847
|
-
selectedValues,
|
|
16848
|
-
selectedLabels,
|
|
16849
|
-
onMultipleSelect,
|
|
16850
|
-
removeValue,
|
|
16851
|
-
clearAll,
|
|
16852
|
-
isSelected,
|
|
16525
|
+
displayValue,
|
|
16853
16526
|
registerItem,
|
|
16854
|
-
unregisterItem
|
|
16855
|
-
searchTerm,
|
|
16856
|
-
hasExactMatch,
|
|
16857
|
-
onCreateValue
|
|
16527
|
+
unregisterItem
|
|
16858
16528
|
});
|
|
16859
16529
|
return (_ctx, _cache) => {
|
|
16860
16530
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
16861
16531
|
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
|
-
|
|
16532
|
+
"aria-invalid": props.isInvalid || void 0,
|
|
16533
|
+
"data-slot": "combo-box"
|
|
16534
|
+
}, [
|
|
16535
|
+
props.label ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
16536
|
+
key: 0,
|
|
16537
|
+
id: (0, vue.unref)(labelId),
|
|
16538
|
+
"data-slot": "label"
|
|
16539
|
+
}, [(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),
|
|
16540
|
+
(0, vue.createVNode)((0, vue.unref)(reka_ui.ComboboxRoot), {
|
|
16541
|
+
modelValue: internalValue.value,
|
|
16542
|
+
"onUpdate:modelValue": [_cache[0] || (_cache[0] = ($event) => internalValue.value = $event), _cache[1] || (_cache[1] = ($event) => handleModelValueUpdate($event))],
|
|
16543
|
+
"default-value": props.defaultValue ? labelFor(props.defaultValue) : void 0,
|
|
16544
|
+
open: props.open,
|
|
16545
|
+
"default-open": props.defaultOpen,
|
|
16546
|
+
disabled: props.isDisabled,
|
|
16547
|
+
required: props.isRequired,
|
|
16548
|
+
"filter-function": effectiveFilter.value,
|
|
16549
|
+
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => emit("update:open", $event))
|
|
16550
|
+
}, {
|
|
16551
|
+
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, {
|
|
16552
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(props.items, (item) => {
|
|
16553
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(ComboBoxItem_default, {
|
|
16554
|
+
key: item.value,
|
|
16555
|
+
value: item.value,
|
|
16556
|
+
"is-disabled": item.isDisabled
|
|
16557
|
+
}, {
|
|
16558
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "item", { item }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(item.label ?? item.textValue ?? item.value), 1)])]),
|
|
16559
|
+
_: 2
|
|
16560
|
+
}, 1032, ["value", "is-disabled"]);
|
|
16561
|
+
}), 128))]),
|
|
16562
|
+
_: 3
|
|
16563
|
+
})], 64))]),
|
|
16564
|
+
_: 3
|
|
16565
|
+
}, 8, [
|
|
16566
|
+
"modelValue",
|
|
16567
|
+
"default-value",
|
|
16568
|
+
"open",
|
|
16569
|
+
"default-open",
|
|
16570
|
+
"disabled",
|
|
16571
|
+
"required",
|
|
16572
|
+
"filter-function"
|
|
16573
|
+
]),
|
|
16574
|
+
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)
|
|
16575
|
+
], 10, _hoisted_1$33);
|
|
16576
|
+
};
|
|
16577
|
+
}
|
|
16578
|
+
});
|
|
16579
|
+
//#endregion
|
|
16580
|
+
//#region src/components/combo-box/ComboBoxEmpty.vue
|
|
16581
|
+
var ComboBoxEmpty_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
16582
|
+
__name: "ComboBoxEmpty",
|
|
16583
|
+
setup(__props) {
|
|
16584
|
+
return (_ctx, _cache) => {
|
|
16585
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.ComboboxEmpty), {
|
|
16586
|
+
class: "py-3 text-center text-sm text-default-400",
|
|
16587
|
+
"data-slot": "empty-content"
|
|
16881
16588
|
}, {
|
|
16882
|
-
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default",
|
|
16883
|
-
isLoading: isLoading.value,
|
|
16884
|
-
items: internalItems.value
|
|
16885
|
-
})]),
|
|
16589
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
16886
16590
|
_: 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);
|
|
16591
|
+
});
|
|
16905
16592
|
};
|
|
16906
16593
|
}
|
|
16907
16594
|
});
|
|
16908
16595
|
//#endregion
|
|
16596
|
+
//#region src/components/autocomplete/Autocomplete.context.ts
|
|
16597
|
+
var { useProvide: useAutocompleteProvide, useInject: useAutocompleteInject, key: autocompleteContextKey } = createContext("Autocomplete");
|
|
16598
|
+
//#endregion
|
|
16909
16599
|
//#region src/components/autocomplete/AutocompleteOverflowChips.vue?vue&type=script&setup=true&lang.ts
|
|
16910
|
-
var _hoisted_1$
|
|
16600
|
+
var _hoisted_1$32 = {
|
|
16911
16601
|
ref: "container",
|
|
16912
16602
|
style: {
|
|
16913
16603
|
"display": "flex",
|
|
@@ -16966,7 +16656,7 @@ var AutocompleteOverflowChips_default = /* @__PURE__ */ (0, vue.defineComponent)
|
|
|
16966
16656
|
(0, _vueuse_core.useResizeObserver)(containerEl, reflow);
|
|
16967
16657
|
(0, vue.watch)(() => props.values.join("\0"), () => reflow(), { flush: "post" });
|
|
16968
16658
|
return (_ctx, _cache) => {
|
|
16969
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
16659
|
+
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
16660
|
return (0, vue.openBlock)(), (0, vue.createBlock)(Chip_default, {
|
|
16971
16661
|
key: val,
|
|
16972
16662
|
"data-chip-item": "",
|
|
@@ -16991,8 +16681,8 @@ var AutocompleteOverflowChips_default = /* @__PURE__ */ (0, vue.defineComponent)
|
|
|
16991
16681
|
});
|
|
16992
16682
|
//#endregion
|
|
16993
16683
|
//#region src/components/autocomplete/AutocompleteInput.vue?vue&type=script&setup=true&lang.ts
|
|
16994
|
-
var _hoisted_1$
|
|
16995
|
-
var _hoisted_2$
|
|
16684
|
+
var _hoisted_1$31 = ["for"];
|
|
16685
|
+
var _hoisted_2$18 = {
|
|
16996
16686
|
key: 0,
|
|
16997
16687
|
"aria-hidden": "true"
|
|
16998
16688
|
};
|
|
@@ -17028,7 +16718,7 @@ var AutocompleteInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17028
16718
|
key: 0,
|
|
17029
16719
|
for: (0, vue.unref)(ctx).inputId.value,
|
|
17030
16720
|
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$
|
|
16721
|
+
}, [(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
16722
|
_ctx.$slots.startContent ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
17033
16723
|
key: 1,
|
|
17034
16724
|
class: (0, vue.normalizeClass)((0, vue.unref)(ctx).slots.value.startContent()),
|
|
@@ -17154,7 +16844,7 @@ var AutocompleteInput_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17154
16844
|
});
|
|
17155
16845
|
//#endregion
|
|
17156
16846
|
//#region src/components/autocomplete/AutocompleteContent.vue?vue&type=script&setup=true&lang.ts
|
|
17157
|
-
var _hoisted_1$
|
|
16847
|
+
var _hoisted_1$30 = [
|
|
17158
16848
|
"inert",
|
|
17159
16849
|
"aria-disabled",
|
|
17160
16850
|
"data-disabled"
|
|
@@ -17254,7 +16944,7 @@ var AutocompleteContent_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17254
16944
|
_: 3
|
|
17255
16945
|
})) : (0, vue.createCommentVNode)("", true)]),
|
|
17256
16946
|
_: 3
|
|
17257
|
-
})], 10, _hoisted_1$
|
|
16947
|
+
})], 10, _hoisted_1$30)]),
|
|
17258
16948
|
_: 3
|
|
17259
16949
|
}, 8, [
|
|
17260
16950
|
"data-loading",
|
|
@@ -17272,11 +16962,11 @@ var AutocompleteContent_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17272
16962
|
});
|
|
17273
16963
|
//#endregion
|
|
17274
16964
|
//#region src/components/autocomplete/AutocompleteItem.vue?vue&type=script&setup=true&lang.ts
|
|
17275
|
-
var _hoisted_1$
|
|
16965
|
+
var _hoisted_1$29 = {
|
|
17276
16966
|
class: "autocomplete-item__text",
|
|
17277
16967
|
"data-slot": "item-text"
|
|
17278
16968
|
};
|
|
17279
|
-
var _hoisted_2$
|
|
16969
|
+
var _hoisted_2$17 = {
|
|
17280
16970
|
key: 1,
|
|
17281
16971
|
class: "list-box-item__indicator",
|
|
17282
16972
|
"data-slot": "list-box-item-indicator"
|
|
@@ -17335,7 +17025,7 @@ var AutocompleteItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17335
17025
|
}, {
|
|
17336
17026
|
default: (0, vue.withCtx)(() => [
|
|
17337
17027
|
(0, vue.renderSlot)(_ctx.$slots, "startContent"),
|
|
17338
|
-
(0, vue.createElementVNode)("span", _hoisted_1$
|
|
17028
|
+
(0, vue.createElementVNode)("span", _hoisted_1$29, [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
17339
17029
|
!(0, vue.unref)(ctx).multiple.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(reka_ui.ComboboxItemIndicator), {
|
|
17340
17030
|
key: 0,
|
|
17341
17031
|
class: "list-box-item__indicator",
|
|
@@ -17355,7 +17045,7 @@ var AutocompleteItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17355
17045
|
"aria-hidden": "true"
|
|
17356
17046
|
}, [(0, vue.createElementVNode)("polyline", { points: "20 6 9 17 4 12" })], -1))])]),
|
|
17357
17047
|
_: 3
|
|
17358
|
-
})) : isChecked.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$
|
|
17048
|
+
})) : 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
17049
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17360
17050
|
width: "12",
|
|
17361
17051
|
height: "12",
|
|
@@ -17382,6 +17072,390 @@ var AutocompleteItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
|
17382
17072
|
}
|
|
17383
17073
|
});
|
|
17384
17074
|
//#endregion
|
|
17075
|
+
//#region src/components/autocomplete/Autocomplete.vue?vue&type=script&setup=true&lang.ts
|
|
17076
|
+
var _hoisted_1$28 = [
|
|
17077
|
+
"data-invalid",
|
|
17078
|
+
"data-disabled",
|
|
17079
|
+
"data-readonly",
|
|
17080
|
+
"data-required",
|
|
17081
|
+
"data-has-label",
|
|
17082
|
+
"data-has-helper"
|
|
17083
|
+
];
|
|
17084
|
+
var _hoisted_2$16 = ["for"];
|
|
17085
|
+
var _hoisted_3$10 = {
|
|
17086
|
+
key: 0,
|
|
17087
|
+
"aria-hidden": "true"
|
|
17088
|
+
};
|
|
17089
|
+
var _hoisted_4$5 = ["id"];
|
|
17090
|
+
var _hoisted_5$4 = ["id"];
|
|
17091
|
+
//#endregion
|
|
17092
|
+
//#region src/components/autocomplete/Autocomplete.vue
|
|
17093
|
+
var Autocomplete_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
17094
|
+
inheritAttrs: false,
|
|
17095
|
+
__name: "Autocomplete",
|
|
17096
|
+
props: {
|
|
17097
|
+
variant: { default: "flat" },
|
|
17098
|
+
size: { default: "md" },
|
|
17099
|
+
color: { default: "default" },
|
|
17100
|
+
labelPlacement: { default: "inside" },
|
|
17101
|
+
fullWidth: {
|
|
17102
|
+
type: Boolean,
|
|
17103
|
+
default: false
|
|
17104
|
+
},
|
|
17105
|
+
isInvalid: {
|
|
17106
|
+
type: Boolean,
|
|
17107
|
+
default: false
|
|
17108
|
+
},
|
|
17109
|
+
isDisabled: {
|
|
17110
|
+
type: Boolean,
|
|
17111
|
+
default: false
|
|
17112
|
+
},
|
|
17113
|
+
isReadonly: {
|
|
17114
|
+
type: Boolean,
|
|
17115
|
+
default: false
|
|
17116
|
+
},
|
|
17117
|
+
isRequired: {
|
|
17118
|
+
type: Boolean,
|
|
17119
|
+
default: false
|
|
17120
|
+
},
|
|
17121
|
+
placeholder: {},
|
|
17122
|
+
name: {},
|
|
17123
|
+
label: {},
|
|
17124
|
+
description: {},
|
|
17125
|
+
errorMessage: {},
|
|
17126
|
+
class: {},
|
|
17127
|
+
modelValue: { default: void 0 },
|
|
17128
|
+
defaultValue: { default: void 0 },
|
|
17129
|
+
multiple: {
|
|
17130
|
+
type: Boolean,
|
|
17131
|
+
default: false
|
|
17132
|
+
},
|
|
17133
|
+
multipleOverflow: { default: "wrap" },
|
|
17134
|
+
open: {
|
|
17135
|
+
type: Boolean,
|
|
17136
|
+
default: void 0
|
|
17137
|
+
},
|
|
17138
|
+
defaultOpen: {
|
|
17139
|
+
type: Boolean,
|
|
17140
|
+
default: void 0
|
|
17141
|
+
},
|
|
17142
|
+
items: { default: () => [] },
|
|
17143
|
+
loadItems: {
|
|
17144
|
+
type: Function,
|
|
17145
|
+
default: void 0
|
|
17146
|
+
},
|
|
17147
|
+
debounceMs: { default: 200 },
|
|
17148
|
+
filterOnOpen: {
|
|
17149
|
+
type: Boolean,
|
|
17150
|
+
default: false
|
|
17151
|
+
},
|
|
17152
|
+
truncateItems: {
|
|
17153
|
+
type: Boolean,
|
|
17154
|
+
default: true
|
|
17155
|
+
}
|
|
17156
|
+
},
|
|
17157
|
+
emits: [
|
|
17158
|
+
"update:modelValue",
|
|
17159
|
+
"update:open",
|
|
17160
|
+
"create"
|
|
17161
|
+
],
|
|
17162
|
+
setup(__props, { emit: __emit }) {
|
|
17163
|
+
const props = __props;
|
|
17164
|
+
const emit = __emit;
|
|
17165
|
+
const attrs = (0, vue.useAttrs)();
|
|
17166
|
+
const generatedId = (0, vue.useId)();
|
|
17167
|
+
const inputId = (0, vue.computed)(() => attrs.id ?? generatedId);
|
|
17168
|
+
const hasLabel = (0, vue.computed)(() => !!props.label);
|
|
17169
|
+
const slots = (0, vue.useSlots)();
|
|
17170
|
+
const usesCustomChrome = (0, vue.computed)(() => hasSlotComponent(slots.default?.(), [AutocompleteInput_default, AutocompleteContent_default]));
|
|
17171
|
+
const slotItemRegistry = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
17172
|
+
function registerItem(value, label) {
|
|
17173
|
+
const next = new Map(slotItemRegistry.value);
|
|
17174
|
+
next.set(value, label);
|
|
17175
|
+
slotItemRegistry.value = next;
|
|
17176
|
+
}
|
|
17177
|
+
function unregisterItem(value) {
|
|
17178
|
+
const next = new Map(slotItemRegistry.value);
|
|
17179
|
+
next.delete(value);
|
|
17180
|
+
slotItemRegistry.value = next;
|
|
17181
|
+
}
|
|
17182
|
+
const isLoading = (0, vue.ref)(false);
|
|
17183
|
+
const internalItems = (0, vue.ref)([...props.items]);
|
|
17184
|
+
const selectedValues = (0, vue.ref)(props.multiple && Array.isArray(props.modelValue) ? [...props.modelValue] : []);
|
|
17185
|
+
const internalOpen = (0, vue.ref)(props.defaultOpen ?? false);
|
|
17186
|
+
let selectingItem = false;
|
|
17187
|
+
const isOpen = (0, vue.ref)(props.defaultOpen ?? false);
|
|
17188
|
+
const termAtOpen = (0, vue.ref)("");
|
|
17189
|
+
const isUserTyping = (0, vue.ref)(false);
|
|
17190
|
+
const singleOpen = (0, vue.ref)(props.open ?? props.defaultOpen ?? false);
|
|
17191
|
+
let blockReopen = false;
|
|
17192
|
+
let blockReopenTimer;
|
|
17193
|
+
const effectiveIgnoreFilter = (0, vue.computed)(() => {
|
|
17194
|
+
if (props.loadItems) return true;
|
|
17195
|
+
if (!props.filterOnOpen && isOpen.value && !isUserTyping.value) return true;
|
|
17196
|
+
return false;
|
|
17197
|
+
});
|
|
17198
|
+
function labelFor(value) {
|
|
17199
|
+
if (value == null || value === "") return "";
|
|
17200
|
+
const match = internalItems.value.find((i) => i.value === value);
|
|
17201
|
+
if (match) return match.label ?? match.textValue ?? value;
|
|
17202
|
+
return slotItemRegistry.value.get(value) ?? value;
|
|
17203
|
+
}
|
|
17204
|
+
function valueFor(displayed) {
|
|
17205
|
+
if (!displayed) return "";
|
|
17206
|
+
const match = internalItems.value.find((i) => (i.label ?? i.textValue ?? i.value) === displayed);
|
|
17207
|
+
if (match) return match.value;
|
|
17208
|
+
for (const [value, label] of slotItemRegistry.value) if (label === displayed) return value;
|
|
17209
|
+
return displayed;
|
|
17210
|
+
}
|
|
17211
|
+
const singleModelValue = (0, vue.computed)(() => props.multiple ? void 0 : props.modelValue);
|
|
17212
|
+
const searchTerm = (0, vue.ref)(labelFor(singleModelValue.value));
|
|
17213
|
+
const isFilled = (0, vue.computed)(() => props.multiple ? selectedValues.value.length > 0 || !!searchTerm.value : !!searchTerm.value);
|
|
17214
|
+
const hasItems = (0, vue.computed)(() => internalItems.value.length > 0);
|
|
17215
|
+
const selectedLabels = (0, vue.computed)(() => selectedValues.value.map((v) => ({
|
|
17216
|
+
value: v,
|
|
17217
|
+
label: labelFor(v) || v
|
|
17218
|
+
})));
|
|
17219
|
+
const descriptionId = (0, vue.computed)(() => `${inputId.value}-description`);
|
|
17220
|
+
const errorMessageId = (0, vue.computed)(() => `${inputId.value}-error`);
|
|
17221
|
+
const showError = (0, vue.computed)(() => props.isInvalid && !!props.errorMessage);
|
|
17222
|
+
const showDescription = (0, vue.computed)(() => !!props.description && !showError.value);
|
|
17223
|
+
const hasHelper = (0, vue.computed)(() => showError.value || showDescription.value);
|
|
17224
|
+
const ariaDescribedBy = (0, vue.computed)(() => {
|
|
17225
|
+
if (showError.value) return errorMessageId.value;
|
|
17226
|
+
if (showDescription.value) return descriptionId.value;
|
|
17227
|
+
});
|
|
17228
|
+
(0, vue.watch)(() => props.modelValue, (val) => {
|
|
17229
|
+
if (props.multiple) {
|
|
17230
|
+
if (Array.isArray(val)) selectedValues.value = [...val];
|
|
17231
|
+
} else {
|
|
17232
|
+
const next = labelFor(val);
|
|
17233
|
+
if (searchTerm.value !== next) searchTerm.value = next;
|
|
17234
|
+
}
|
|
17235
|
+
});
|
|
17236
|
+
(0, vue.watch)(() => props.open, (val) => {
|
|
17237
|
+
if (!props.multiple && val !== void 0) singleOpen.value = val;
|
|
17238
|
+
});
|
|
17239
|
+
(0, vue.watch)(searchTerm, (displayed) => {
|
|
17240
|
+
if (props.multiple) {
|
|
17241
|
+
if (isOpen.value && displayed !== termAtOpen.value) isUserTyping.value = true;
|
|
17242
|
+
return;
|
|
17243
|
+
}
|
|
17244
|
+
const next = valueFor(displayed);
|
|
17245
|
+
if (next !== (singleModelValue.value ?? "")) emit("update:modelValue", next);
|
|
17246
|
+
if (isOpen.value && displayed !== termAtOpen.value) isUserTyping.value = true;
|
|
17247
|
+
});
|
|
17248
|
+
function handleOpenChange(val) {
|
|
17249
|
+
if (props.multiple) {
|
|
17250
|
+
isOpen.value = val;
|
|
17251
|
+
internalOpen.value = !val && selectingItem ? true : val;
|
|
17252
|
+
selectingItem = false;
|
|
17253
|
+
if (val) {
|
|
17254
|
+
termAtOpen.value = searchTerm.value;
|
|
17255
|
+
isUserTyping.value = false;
|
|
17256
|
+
} else isUserTyping.value = false;
|
|
17257
|
+
emit("update:open", val);
|
|
17258
|
+
return;
|
|
17259
|
+
}
|
|
17260
|
+
if (val && blockReopen) return;
|
|
17261
|
+
isOpen.value = val;
|
|
17262
|
+
singleOpen.value = val;
|
|
17263
|
+
if (val) {
|
|
17264
|
+
termAtOpen.value = searchTerm.value;
|
|
17265
|
+
isUserTyping.value = false;
|
|
17266
|
+
} else isUserTyping.value = false;
|
|
17267
|
+
emit("update:open", val);
|
|
17268
|
+
}
|
|
17269
|
+
function onMultipleSelect(value) {
|
|
17270
|
+
selectingItem = true;
|
|
17271
|
+
const idx = selectedValues.value.indexOf(value);
|
|
17272
|
+
selectedValues.value = idx === -1 ? [...selectedValues.value, value] : selectedValues.value.filter((_, i) => i !== idx);
|
|
17273
|
+
searchTerm.value = "";
|
|
17274
|
+
isUserTyping.value = false;
|
|
17275
|
+
emit("update:modelValue", selectedValues.value);
|
|
17276
|
+
}
|
|
17277
|
+
function removeValue(value) {
|
|
17278
|
+
selectedValues.value = selectedValues.value.filter((v) => v !== value);
|
|
17279
|
+
emit("update:modelValue", selectedValues.value);
|
|
17280
|
+
}
|
|
17281
|
+
function clearAll() {
|
|
17282
|
+
selectedValues.value = [];
|
|
17283
|
+
emit("update:modelValue", []);
|
|
17284
|
+
}
|
|
17285
|
+
function isSelected(value) {
|
|
17286
|
+
return selectedValues.value.includes(value);
|
|
17287
|
+
}
|
|
17288
|
+
const hasExactMatch = (0, vue.computed)(() => {
|
|
17289
|
+
const term = searchTerm.value.trim().toLowerCase();
|
|
17290
|
+
if (!term) return false;
|
|
17291
|
+
if (internalItems.value.some((i) => (i.label ?? i.textValue ?? i.value).toLowerCase() === term)) return true;
|
|
17292
|
+
for (const label of slotItemRegistry.value.values()) if (label.toLowerCase() === term) return true;
|
|
17293
|
+
return false;
|
|
17294
|
+
});
|
|
17295
|
+
function onCreateValue(value) {
|
|
17296
|
+
const trimmed = value.trim();
|
|
17297
|
+
if (!trimmed) return;
|
|
17298
|
+
if (props.multiple) {
|
|
17299
|
+
if (!selectedValues.value.includes(trimmed)) {
|
|
17300
|
+
selectingItem = true;
|
|
17301
|
+
selectedValues.value = [...selectedValues.value, trimmed];
|
|
17302
|
+
emit("update:modelValue", selectedValues.value);
|
|
17303
|
+
}
|
|
17304
|
+
searchTerm.value = "";
|
|
17305
|
+
isUserTyping.value = false;
|
|
17306
|
+
} else {
|
|
17307
|
+
searchTerm.value = trimmed;
|
|
17308
|
+
emit("update:modelValue", trimmed);
|
|
17309
|
+
isOpen.value = false;
|
|
17310
|
+
singleOpen.value = false;
|
|
17311
|
+
blockReopen = true;
|
|
17312
|
+
clearTimeout(blockReopenTimer);
|
|
17313
|
+
blockReopenTimer = setTimeout(() => {
|
|
17314
|
+
blockReopen = false;
|
|
17315
|
+
}, 300);
|
|
17316
|
+
}
|
|
17317
|
+
emit("create", trimmed);
|
|
17318
|
+
}
|
|
17319
|
+
let debounceTimer;
|
|
17320
|
+
async function runLoadItems(query) {
|
|
17321
|
+
if (!props.loadItems) return;
|
|
17322
|
+
isLoading.value = true;
|
|
17323
|
+
try {
|
|
17324
|
+
internalItems.value = await props.loadItems(query);
|
|
17325
|
+
} finally {
|
|
17326
|
+
isLoading.value = false;
|
|
17327
|
+
}
|
|
17328
|
+
}
|
|
17329
|
+
function scheduleLoad(query) {
|
|
17330
|
+
if (!props.loadItems) return;
|
|
17331
|
+
clearTimeout(debounceTimer);
|
|
17332
|
+
if (props.debounceMs === 0) runLoadItems(query);
|
|
17333
|
+
else debounceTimer = setTimeout(() => void runLoadItems(query), props.debounceMs);
|
|
17334
|
+
}
|
|
17335
|
+
(0, vue.onMounted)(() => {
|
|
17336
|
+
if (props.loadItems) runLoadItems(searchTerm.value);
|
|
17337
|
+
});
|
|
17338
|
+
(0, vue.watch)(searchTerm, (q) => {
|
|
17339
|
+
if (props.loadItems) scheduleLoad(q);
|
|
17340
|
+
});
|
|
17341
|
+
(0, vue.watch)(() => props.items, (newItems) => {
|
|
17342
|
+
if (!props.loadItems) internalItems.value = [...newItems];
|
|
17343
|
+
});
|
|
17344
|
+
(0, vue.watch)(internalItems, () => {
|
|
17345
|
+
if (props.multiple) return;
|
|
17346
|
+
const next = labelFor(singleModelValue.value);
|
|
17347
|
+
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
17348
|
+
});
|
|
17349
|
+
(0, vue.watch)(slotItemRegistry, () => {
|
|
17350
|
+
if (props.multiple) return;
|
|
17351
|
+
const next = labelFor(singleModelValue.value);
|
|
17352
|
+
if (next && searchTerm.value !== next && valueFor(searchTerm.value) === (singleModelValue.value ?? "")) searchTerm.value = next;
|
|
17353
|
+
});
|
|
17354
|
+
const slotFns = (0, vue.computed)(() => (0, _auronui_styles.autocompleteVariants)({
|
|
17355
|
+
variant: props.variant,
|
|
17356
|
+
size: props.size,
|
|
17357
|
+
color: props.color,
|
|
17358
|
+
fullWidth: props.fullWidth,
|
|
17359
|
+
isInvalid: props.isInvalid,
|
|
17360
|
+
isDisabled: props.isDisabled,
|
|
17361
|
+
isReadonly: props.isReadonly,
|
|
17362
|
+
hasLabel: hasLabel.value,
|
|
17363
|
+
labelPlacement: props.labelPlacement
|
|
17364
|
+
}));
|
|
17365
|
+
const showOutsideLabel = (0, vue.computed)(() => hasLabel.value && props.labelPlacement !== "inside");
|
|
17366
|
+
useAutocompleteProvide({
|
|
17367
|
+
isDisabled: (0, vue.toRef)(props, "isDisabled"),
|
|
17368
|
+
isInvalid: (0, vue.toRef)(props, "isInvalid"),
|
|
17369
|
+
isReadonly: (0, vue.toRef)(props, "isReadonly"),
|
|
17370
|
+
isRequired: (0, vue.toRef)(props, "isRequired"),
|
|
17371
|
+
isLoading,
|
|
17372
|
+
isFilled,
|
|
17373
|
+
fullWidth: (0, vue.toRef)(props, "fullWidth"),
|
|
17374
|
+
hasLabel,
|
|
17375
|
+
labelPlacement: (0, vue.toRef)(props, "labelPlacement"),
|
|
17376
|
+
inputId,
|
|
17377
|
+
label: (0, vue.toRef)(props, "label"),
|
|
17378
|
+
ariaDescribedBy,
|
|
17379
|
+
truncateItems: (0, vue.toRef)(props, "truncateItems"),
|
|
17380
|
+
hasItems,
|
|
17381
|
+
slots: slotFns,
|
|
17382
|
+
multiple: (0, vue.toRef)(props, "multiple"),
|
|
17383
|
+
multipleOverflow: (0, vue.toRef)(props, "multipleOverflow"),
|
|
17384
|
+
selectedValues,
|
|
17385
|
+
selectedLabels,
|
|
17386
|
+
onMultipleSelect,
|
|
17387
|
+
removeValue,
|
|
17388
|
+
clearAll,
|
|
17389
|
+
isSelected,
|
|
17390
|
+
registerItem,
|
|
17391
|
+
unregisterItem,
|
|
17392
|
+
searchTerm,
|
|
17393
|
+
hasExactMatch,
|
|
17394
|
+
onCreateValue
|
|
17395
|
+
});
|
|
17396
|
+
return (_ctx, _cache) => {
|
|
17397
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17398
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(composeClassName)(slotFns.value.base(), props.class)),
|
|
17399
|
+
"data-invalid": __props.isInvalid || void 0,
|
|
17400
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
17401
|
+
"data-readonly": __props.isReadonly || void 0,
|
|
17402
|
+
"data-required": __props.isRequired || void 0,
|
|
17403
|
+
"data-has-label": hasLabel.value || void 0,
|
|
17404
|
+
"data-has-helper": hasHelper.value || void 0
|
|
17405
|
+
}, [showOutsideLabel.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("label", {
|
|
17406
|
+
key: 0,
|
|
17407
|
+
for: inputId.value,
|
|
17408
|
+
class: (0, vue.normalizeClass)(slotFns.value.label())
|
|
17409
|
+
}, [(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), {
|
|
17410
|
+
"model-value": searchTerm.value,
|
|
17411
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchTerm.value = $event),
|
|
17412
|
+
open: props.multiple ? internalOpen.value : singleOpen.value,
|
|
17413
|
+
disabled: props.isDisabled,
|
|
17414
|
+
required: props.isRequired,
|
|
17415
|
+
"ignore-filter": effectiveIgnoreFilter.value,
|
|
17416
|
+
"open-on-focus": true,
|
|
17417
|
+
"onUpdate:open": handleOpenChange
|
|
17418
|
+
}, {
|
|
17419
|
+
default: (0, vue.withCtx)(() => [usesCustomChrome.value ? (0, vue.renderSlot)(_ctx.$slots, "default", {
|
|
17420
|
+
key: 0,
|
|
17421
|
+
isLoading: isLoading.value,
|
|
17422
|
+
items: internalItems.value
|
|
17423
|
+
}) : ((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, {
|
|
17424
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(internalItems.value, (item) => {
|
|
17425
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(AutocompleteItem_default, {
|
|
17426
|
+
key: item.value,
|
|
17427
|
+
value: item.value,
|
|
17428
|
+
"is-disabled": item.isDisabled
|
|
17429
|
+
}, {
|
|
17430
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "item", { item }, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(item.label ?? item.textValue ?? item.value), 1)])]),
|
|
17431
|
+
_: 2
|
|
17432
|
+
}, 1032, ["value", "is-disabled"]);
|
|
17433
|
+
}), 128))]),
|
|
17434
|
+
_: 3
|
|
17435
|
+
})], 64))]),
|
|
17436
|
+
_: 3
|
|
17437
|
+
}, 8, [
|
|
17438
|
+
"model-value",
|
|
17439
|
+
"open",
|
|
17440
|
+
"disabled",
|
|
17441
|
+
"required",
|
|
17442
|
+
"ignore-filter"
|
|
17443
|
+
]), hasHelper.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17444
|
+
key: 0,
|
|
17445
|
+
class: (0, vue.normalizeClass)(slotFns.value.helperWrapper())
|
|
17446
|
+
}, [showError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17447
|
+
key: 0,
|
|
17448
|
+
id: errorMessageId.value,
|
|
17449
|
+
class: (0, vue.normalizeClass)(slotFns.value.errorMessage())
|
|
17450
|
+
}, (0, vue.toDisplayString)(__props.errorMessage), 11, _hoisted_4$5)) : showDescription.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
17451
|
+
key: 1,
|
|
17452
|
+
id: descriptionId.value,
|
|
17453
|
+
class: (0, vue.normalizeClass)(slotFns.value.description())
|
|
17454
|
+
}, (0, vue.toDisplayString)(__props.description), 11, _hoisted_5$4)) : (0, vue.createCommentVNode)("", true)], 2)) : (0, vue.createCommentVNode)("", true)], 2)], 10, _hoisted_1$28);
|
|
17455
|
+
};
|
|
17456
|
+
}
|
|
17457
|
+
});
|
|
17458
|
+
//#endregion
|
|
17385
17459
|
//#region src/components/autocomplete/AutocompleteCreateItem.vue?vue&type=script&setup=true&lang.ts
|
|
17386
17460
|
var _hoisted_1$27 = {
|
|
17387
17461
|
class: "autocomplete-item__text",
|