@wikicasa-dev/components 2.2.9-alpha.28 → 2.2.9-alpha.3

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.
@@ -1,10 +1,10 @@
1
- import { defineComponent as D, mergeModels as y, useModel as p, useId as F, useTemplateRef as z, computed as C, watch as I, createElementBlock as a, openBlock as l, createVNode as $, createCommentVNode as r, normalizeClass as o, withCtx as x, Fragment as M, renderList as N, withModifiers as f, createElementVNode as n, renderSlot as A, createBlock as E, unref as V } from "vue";
2
- import { WarningIconRounded as P, ArrowIcon as R } from "@wikicasa-dev/svg-icons";
3
- import q from "./BaseDropDown.vue.js";
4
- import '../../../../assets/BaseDropDown.css';/* empty css */
5
- const S = { class: "uikit-relative uikit-flex uikit-h-12 uikit-items-center" }, U = ["id", "innerHTML"], j = ["onClick"], G = ["id", "data-cy", "aria-required", "aria-controls", "aria-labelledby", "aria-expanded", "aria-activedescendant", "aria-invalid", "aria-describedby", "onClick"], W = ["innerHTML"], J = { class: "uikit-pointer-events-none uikit-mt-1 uikit-inline-flex" }, K = ["innerHTML"], O = ["id", "aria-selected", "onClick", "onMouseover"], Q = { class: "uikit-inline-block uikit-cursor-pointer uikit-text-sm" }, X = ["name", "checked", "onInput"], Y = ["innerHTML"], Z = ["id", "arial-live", "innerHTML"], _ = ["id", "arial-live", "innerHTML"], ae = /* @__PURE__ */ D({
1
+ import { defineComponent as H, mergeModels as $, useModel as p, useId as I, computed as M, ref as D, watch as h, onMounted as F, onUnmounted as P, createElementBlock as u, openBlock as n, normalizeClass as a, createElementVNode as o, createCommentVNode as r, withModifiers as c, renderSlot as z, unref as b, createBlock as A, createVNode as E, Fragment as V, renderList as N } from "vue";
2
+ import { useKeyboardController as O } from "@wikicasa-dev/vue-composables";
3
+ import { WarningIconRounded as S, ArrowIcon as q } from "@wikicasa-dev/svg-icons";
4
+ const j = ["id", "innerHTML"], K = ["id", "data-cy", "aria-required", "aria-controls", "aria-labelledby", "aria-expanded", "aria-activedescendant", "aria-invalid", "aria-describedby"], R = ["innerHTML"], U = { class: "uikit-pointer-events-none uikit-mt-1 uikit-inline-flex" }, W = ["innerHTML"], G = ["data-cy"], J = ["id", "aria-selected", "onClick", "onMouseover"], Q = { class: "uikit-inline-block uikit-cursor-pointer uikit-text-sm" }, X = ["name", "checked", "onInput"], Y = ["innerHTML"], Z = ["id", "arial-live", "innerHTML"], _ = ["id", "arial-live", "innerHTML"], le = /* @__PURE__ */ H({
5
+ inheritAttrs: !1,
6
6
  __name: "AccessibleSelect",
7
- props: /* @__PURE__ */ y({
7
+ props: /* @__PURE__ */ $({
8
8
  label: { default: "" },
9
9
  dropdownPosition: { default: "bottom" },
10
10
  namespace: {},
@@ -28,174 +28,181 @@ const S = { class: "uikit-relative uikit-flex uikit-h-12 uikit-items-center" },
28
28
  default: () => ({ id: "", label: "" })
29
29
  },
30
30
  modelModifiers: {},
31
- open: { type: Boolean, default: !1 },
32
- openModifiers: {},
33
31
  toggleDropdown: { type: Boolean, default: void 0 },
34
32
  toggleDropdownModifiers: {}
35
33
  }),
36
- emits: /* @__PURE__ */ y(["click", "update:dropdownState"], ["update:modelValue", "update:open", "update:toggleDropdown"]),
37
- setup(e, { emit: T }) {
38
- const L = T, k = p(e, "modelValue"), m = p(e, "open"), g = p(e, "toggleDropdown"), B = F(), H = z("dropdownRef"), t = C(() => e.namespace || B), v = C(() => !!k.value.label), w = (i) => {
39
- m.value = !1, k.value = i, console.log("DEBUG:handleChange", i);
34
+ emits: /* @__PURE__ */ $(["click", "update:dropdownState"], ["update:modelValue", "update:toggleDropdown"]),
35
+ setup(e, { emit: L }) {
36
+ const y = L, k = p(e, "modelValue"), g = p(e, "toggleDropdown"), T = I(), l = M(() => e.namespace || T), t = D(!1), m = M(() => !!k.value.label), { activeIdx: v, selectedIdx: B } = O({
37
+ optionsLength: e.options.length,
38
+ isDropdownOpen: t
39
+ }), w = (i) => {
40
+ t.value = !1, k.value = i;
40
41
  };
41
- return I(
42
- () => H.value?.selectedIdx,
43
- (i) => {
44
- i === void 0 || i === -1 || (w(e.options[i]), m.value = !1);
45
- }
46
- ), (i, c) => (l(), a("div", null, [
47
- $(q, {
48
- ref: "dropdownRef",
49
- open: m.value,
50
- "onUpdate:open": c[1] || (c[1] = (s) => m.value = s),
51
- "toggle-dropdown": g.value,
52
- "onUpdate:toggleDropdown": c[2] || (c[2] = (s) => g.value = s),
53
- class: o([e.wrapperClasses]),
54
- "close-when-clicked-outside": e.closeOnBodyPressed,
55
- direction: e.dropdownPosition === "top" ? "up" : "down",
56
- "dropdown-element": "ul",
57
- "dropdown-classes": [
58
- "uikit-select-dropdown uikit-z-30 uikit-mt-[7px] uikit-mb-0",
59
- e.dropdownClasses
60
- ],
61
- "dropdown-attrs": {
62
- role: "listbox",
63
- tabindex: -1,
64
- "aria-multiselectable": !1
65
- }
66
- }, {
67
- btn_slot: x(({ toggleDropdown: s, isOpen: b, activeIdx: u }) => [
68
- n("div", S, [
69
- e.label ? (l(), a("label", {
42
+ h(B, (i) => {
43
+ w(e.options[i]), t.value = !1;
44
+ }), h(g, (i) => {
45
+ i && (t.value = !t.value, g.value = !1);
46
+ }), h(t, (i) => {
47
+ y("update:dropdownState", i);
48
+ });
49
+ const C = ({ target: i }) => {
50
+ `${l.value}_btn` !== i.id && (t.value = !1);
51
+ };
52
+ return F(() => {
53
+ e.closeOnBodyPressed && document.addEventListener("click", C);
54
+ }), P(() => {
55
+ e.closeOnBodyPressed && document.removeEventListener("click", C);
56
+ }), (i, s) => (n(), u("div", {
57
+ class: a(i.$attrs.class)
58
+ }, [
59
+ o("div", {
60
+ class: a(["uikit-relative uikit-flex uikit-h-12 uikit-items-center", e.wrapperClasses])
61
+ }, [
62
+ e.label ? (n(), u("label", {
63
+ key: 0,
64
+ id: `${l.value}_label`,
65
+ class: a(["uikit-pointer-events-none uikit-absolute uikit-z-10 uikit-text-sm uikit-font-medium uikit-transition-all uikit-ease-in-out", [
66
+ m.value ? "as-floating -uikit-top-1 uikit-left-[22px] uikit-text-w-black" : "as-inline uikit-top-4 uikit-text-w-gray",
67
+ e.labelClasses,
68
+ { "uikit-left-9": i.$slots.lefticon && !m.value },
69
+ { "uikit-left-4": !i.$slots.lefticon && !m.value }
70
+ ]]),
71
+ innerHTML: e.label
72
+ }, null, 10, j)) : r("", !0),
73
+ i.$slots.lefticon ? (n(), u("span", {
74
+ key: 1,
75
+ class: "uikit-z-20 uikit-mt-2 uikit-pl-2",
76
+ onClick: s[0] || (s[0] = c((d) => t.value = !t.value, ["stop"]))
77
+ }, [
78
+ z(i.$slots, "lefticon")
79
+ ])) : r("", !0),
80
+ o("button", {
81
+ id: `${l.value}_btn`,
82
+ ref: "btnEl",
83
+ type: "button",
84
+ "data-cy": e.dataCy,
85
+ class: a(["uikit-peer uikit-relative uikit-z-10 uikit-flex uikit-h-full uikit-w-full uikit-items-center uikit-justify-between uikit-truncate uikit-border-0 uikit-bg-transparent uikit-pr-4 uikit-text-left focus-visible:uikit-outline-0", [i.$slots.lefticon ? "uikit-pl-2" : "uikit-pl-4", e.btnClasses]]),
86
+ "aria-required": !!i.$attrs.required,
87
+ role: "combobox",
88
+ "aria-haspopup": "listbox",
89
+ "aria-controls": `${l.value}_dropdown`,
90
+ "aria-labelledby": `${l.value}_label ${l.value}_btn`,
91
+ "aria-expanded": t.value,
92
+ "aria-activedescendant": b(v) >= 0 && t.value ? `${l.value}_element_${e.options[b(v)].label}` : "",
93
+ "aria-invalid": e.isValid === !1,
94
+ "aria-describedby": e.isValid === !1 ? `${l.value}_invalid_msg` : void 0,
95
+ onClick: s[1] || (s[1] = (d) => {
96
+ t.value = !t.value, y("click", d);
97
+ })
98
+ }, [
99
+ o("span", {
100
+ class: a(["uikit-pointer-events-none uikit-mt-1", e.btnTextClasses]),
101
+ innerHTML: k.value.visibleLabel || k.value.label
102
+ }, null, 10, R),
103
+ o("span", U, [
104
+ e.isValid == !1 ? (n(), A(b(S), {
70
105
  key: 0,
71
- id: `${t.value}_label`,
72
- class: o(["uikit-pointer-events-none uikit-absolute uikit-z-10 uikit-text-sm uikit-font-medium uikit-transition-all uikit-ease-in-out", [
73
- v.value ? "as-floating -uikit-top-1 uikit-left-[22px] uikit-text-w-black" : "as-inline uikit-top-4 uikit-text-w-gray",
74
- e.labelClasses,
75
- { "uikit-left-9": i.$slots.lefticon && !v.value },
76
- { "uikit-left-4": !i.$slots.lefticon && !v.value }
106
+ class: "uikit-mr-1",
107
+ width: 20,
108
+ height: 20,
109
+ "stroke-color": "#FA4F64"
110
+ })) : r("", !0),
111
+ E(b(q), {
112
+ class: a(["uikit-transition-transform motion-reduce:uikit-transition-none", [
113
+ t.value ? "uikit-rotate-180" : "",
114
+ e.arrowIcon?.classes
77
115
  ]]),
78
- innerHTML: e.label
79
- }, null, 10, U)) : r("", !0),
80
- i.$slots.lefticon ? (l(), a("span", {
81
- key: 1,
82
- class: "uikit-z-20 uikit-mt-2 uikit-pl-2",
83
- onClick: f((d) => s(), ["stop"])
84
- }, [
85
- A(i.$slots, "lefticon")
86
- ], 8, j)) : r("", !0),
87
- n("button", {
88
- id: `${t.value}_btn`,
89
- ref: "btnEl",
90
- type: "button",
91
- "data-cy": e.dataCy,
92
- class: o(["uikit-peer uikit-relative uikit-z-10 uikit-flex uikit-h-full uikit-w-full uikit-items-center uikit-justify-between uikit-truncate uikit-border-0 uikit-bg-transparent uikit-pr-4 uikit-text-left focus-visible:uikit-outline-0", [i.$slots.lefticon ? "uikit-pl-2" : "uikit-pl-4", e.btnClasses]]),
93
- "aria-required": !!i.$attrs.required,
94
- role: "combobox",
95
- "aria-haspopup": "listbox",
96
- "aria-controls": `${t.value}_dropdown`,
97
- "aria-labelledby": `${t.value}_label ${t.value}_btn`,
98
- "aria-expanded": b,
99
- "aria-activedescendant": u >= 0 && b ? `${t.value}_element_${e.options[u].label}` : "",
100
- "aria-invalid": e.isValid === !1,
101
- "aria-describedby": e.isValid === !1 ? `${t.value}_invalid_msg` : void 0,
102
- onClick: (d) => {
103
- s(), L("click", d);
104
- }
105
- }, [
106
- n("span", {
107
- class: o(["uikit-pointer-events-none uikit-mt-1", e.btnTextClasses]),
108
- innerHTML: k.value?.visibleLabel || k.value?.label
109
- }, null, 10, W),
110
- n("span", J, [
111
- e.isValid == !1 ? (l(), E(V(P), {
112
- key: 0,
113
- class: "uikit-mr-1",
114
- width: 20,
115
- height: 20,
116
- "stroke-color": "#FA4F64"
117
- })) : r("", !0),
118
- $(V(R), {
119
- class: o(["uikit-transition-transform motion-reduce:uikit-transition-none", [b ? "uikit-rotate-180" : "", e.arrowIcon?.classes]]),
120
- width: e.arrowIcon?.width ?? 18,
121
- height: e.arrowIcon?.height ?? 18,
122
- "stroke-color": e.isValid ? "#2B5DFF" : e.isValid === !1 ? "#FA4F64" : e.arrowIcon?.strokeColor ?? "#222"
123
- }, null, 8, ["class", "width", "height", "stroke-color"])
124
- ])
125
- ], 10, G),
126
- n("fieldset", {
127
- "aria-hidden": "true",
128
- class: o(["uikit-pointer-events-none uikit-absolute uikit-bottom-0 uikit-left-0 uikit-right-0 uikit-m-0 uikit-box-border uikit-h-12 uikit-cursor-pointer uikit-rounded-xs uikit-bg-white uikit-px-2 uikit-py-0 peer-focus:uikit-border-2", [
129
- e.fieldsetClasses,
130
- e.isValid ? "uikit-border-w-primary" : e.isValid === !1 ? "uikit-border-w-danger" : "uikit-border-w-secondary",
131
- {
132
- "uikit-border uikit-border-solid peer-focus:uikit-border-w-primary peer-focus-visible:uikit-border-2 peer-focus-visible:uikit-border-w-primary peer-aria-invalid:uikit-border-w-danger": e.border
133
- },
134
- { "uikit-border-0 peer-focus:uikit-border-0": !e.border }
135
- ]])
136
- }, [
137
- n("legend", {
138
- class: o([[e.legendClasses, { "uikit-m-0 uikit-w-0": !e.label }], "uikit-ml-2 uikit-h-3 uikit-px-0 uikit-text-sm"])
139
- }, [
140
- e.label ? (l(), a("span", {
141
- key: 0,
142
- class: o(["uikit-mx-5px", [
143
- k.value.label ? "uikit-invisible" : "uikit-hidden"
144
- ]]),
145
- innerHTML: e.label
146
- }, null, 10, K)) : r("", !0)
147
- ], 2)
148
- ], 2)
116
+ width: e.arrowIcon?.width ?? 18,
117
+ height: e.arrowIcon?.height ?? 18,
118
+ "stroke-color": e.isValid ? "#2B5DFF" : e.isValid === !1 ? "#FA4F64" : e.arrowIcon?.strokeColor ?? "#222"
119
+ }, null, 8, ["class", "width", "height", "stroke-color"])
149
120
  ])
150
- ]),
151
- default: x(({ activeIdx: s, setActiveIdx: b }) => [
152
- (l(!0), a(M, null, N(e.options, (u, d) => (l(), a("li", {
153
- id: `${t.value}_element_${e.options[d].label}`,
154
- key: `${u.label}_${d}`,
121
+ ], 10, K),
122
+ o("fieldset", {
123
+ "aria-hidden": "true",
124
+ class: a(["uikit-pointer-events-none uikit-absolute uikit-bottom-0 uikit-left-0 uikit-right-0 uikit-m-0 uikit-box-border uikit-h-12 uikit-cursor-pointer uikit-rounded-xs uikit-bg-white uikit-px-2 uikit-py-0 peer-focus:uikit-border-2", [
125
+ e.fieldsetClasses,
126
+ e.isValid ? "uikit-border-w-primary" : e.isValid === !1 ? "uikit-border-w-danger" : "uikit-border-w-secondary",
127
+ {
128
+ "uikit-border uikit-border-solid peer-focus:uikit-border-w-primary peer-focus-visible:uikit-border-2 peer-focus-visible:uikit-border-w-primary peer-aria-invalid:uikit-border-w-danger": e.border
129
+ },
130
+ { "uikit-border-0 peer-focus:uikit-border-0": !e.border }
131
+ ]])
132
+ }, [
133
+ o("legend", {
134
+ class: a([[e.legendClasses, { "uikit-m-0 uikit-w-0": !e.label }], "uikit-ml-2 uikit-h-3 uikit-px-0 uikit-text-sm"])
135
+ }, [
136
+ e.label ? (n(), u("span", {
137
+ key: 0,
138
+ class: a(["uikit-mx-5px", [k.value.label ? "uikit-invisible" : "uikit-hidden"]]),
139
+ innerHTML: e.label
140
+ }, null, 10, W)) : r("", !0)
141
+ ], 2)
142
+ ], 2),
143
+ o("ul", {
144
+ "data-cy": e.dataCy && `${e.dataCy}_dropdown`,
145
+ role: "listbox",
146
+ tabindex: -1,
147
+ "aria-multiselectable": !1,
148
+ class: a(["uikit-absolute uikit-z-30 uikit-m-0 uikit-max-h-[225px] uikit-w-full uikit-min-w-full uikit-list-none uikit-overflow-y-auto uikit-p-0 uikit-no-scrollbar", [
149
+ { "uikit-h-0 uikit-w-0 uikit-overflow-hidden": !t.value },
150
+ {
151
+ "uikit-rounded-xs uikit-border uikit-border-solid uikit-border-w-secondary uikit-bg-white": t.value
152
+ },
153
+ { "uikit-bottom-[55px]": e.dropdownPosition === "top" },
154
+ { "uikit-top-[55px]": e.dropdownPosition === "bottom" },
155
+ e.dropdownClasses
156
+ ]]),
157
+ onClick: s[3] || (s[3] = c(() => {
158
+ }, ["stop"]))
159
+ }, [
160
+ (n(!0), u(V, null, N(e.options, (d, f) => (n(), u("li", {
161
+ id: `${l.value}_element_${e.options[f].label}`,
162
+ key: `${d.label}_${f}`,
155
163
  role: "option",
156
- "aria-selected": s === d,
157
- class: o(["uikit-m-1 uikit-cursor-pointer uikit-px-20px uikit-py-10px uikit-text aria-selected:uikit-rounded-xs aria-selected:uikit-bg-w-cultured", e.dropdownItemClasses]),
158
- onClick: f((h) => w(u), ["stop"]),
159
- onMouseover: f((h) => b(d), ["stop"]),
160
- onBlur: c[0] || (c[0] = f(() => {
164
+ "aria-selected": b(v) === f,
165
+ class: a(["uikit-m-1 uikit-cursor-pointer uikit-px-20px uikit-py-10px uikit-text aria-selected:uikit-rounded-xs aria-selected:uikit-bg-w-cultured", e.dropdownItemClasses]),
166
+ onClick: c((x) => w(d), ["stop"]),
167
+ onMouseover: c((x) => v.value = f, ["stop"]),
168
+ onBlur: s[2] || (s[2] = c(() => {
161
169
  }, ["stop"]))
162
170
  }, [
163
- n("label", Q, [
164
- n("input", {
171
+ o("label", Q, [
172
+ o("input", {
165
173
  tabindex: "-1",
166
174
  class: "uikit-m-0 uikit-appearance-none",
167
- name: `${t.value}_radio`,
175
+ name: `${l.value}_radio`,
168
176
  type: "radio",
169
- checked: u.label === k.value.label,
170
- onInput: f((h) => w(u), ["stop"])
177
+ checked: d.label === k.value.label,
178
+ onInput: c((x) => w(d), ["stop"])
171
179
  }, null, 40, X),
172
- n("span", {
173
- innerHTML: u.label
180
+ o("span", {
181
+ innerHTML: d.label
174
182
  }, null, 8, Y)
175
183
  ])
176
- ], 42, O))), 128))
177
- ]),
178
- _: 3
179
- }, 8, ["open", "toggle-dropdown", "class", "close-when-clicked-outside", "direction", "dropdown-classes"]),
180
- e.feedback ? (l(), a(M, { key: 0 }, [
181
- e.feedback.valid ? (l(), a("span", {
184
+ ], 42, J))), 128))
185
+ ], 10, G)
186
+ ], 2),
187
+ e.feedback ? (n(), u(V, { key: 0 }, [
188
+ e.feedback.valid ? (n(), u("span", {
182
189
  key: 0,
183
- id: `${t.value}_valid_msg`,
190
+ id: `${l.value}_valid_msg`,
184
191
  "arial-live": i.$attrs["aria-live"],
185
192
  class: "uikit-mt-1 uikit-inline-block uikit-text-12",
186
193
  innerHTML: e.isValid ? e.feedback.valid : ""
187
194
  }, null, 8, Z)) : r("", !0),
188
- e.feedback.invalid ? (l(), a("span", {
195
+ e.feedback.invalid ? (n(), u("span", {
189
196
  key: 1,
190
- id: `${t.value}_invalid_msg`,
197
+ id: `${l.value}_invalid_msg`,
191
198
  "arial-live": i.$attrs["aria-live"],
192
199
  class: "uikit-mt-1 uikit-inline-block uikit-text-12 uikit-text-w-danger",
193
200
  innerHTML: e.isValid === !1 ? e.feedback.invalid : ""
194
201
  }, null, 8, _)) : r("", !0)
195
202
  ], 64)) : r("", !0)
196
- ]));
203
+ ], 2));
197
204
  }
198
205
  });
199
206
  export {
200
- ae as default
207
+ le as default
201
208
  };
@@ -1,178 +1,162 @@
1
- import { defineComponent as P, mergeModels as O, useModel as B, useId as X, useTemplateRef as d, shallowRef as c, onBeforeMount as j, watch as T, nextTick as q, createBlock as V, openBlock as g, withCtx as S, createElementBlock as G, Fragment as J, renderList as Q, renderSlot as C, createElementVNode as s, normalizeClass as f, withDirectives as W, unref as Y, vModelText as Z, toDisplayString as _, withModifiers as ee, normalizeStyle as te, createTextVNode as le, vShow as ne } from "vue";
2
- import oe from "../BaseDropDown.vue.js";
1
+ import { defineComponent as L, mergeModels as M, useModel as V, useTemplateRef as m, shallowRef as p, onBeforeMount as W, watch as b, nextTick as I, createBlock as F, openBlock as C, withCtx as y, createElementBlock as N, Fragment as A, renderList as H, renderSlot as f, createElementVNode as u, normalizeClass as v, withDirectives as $, vModelText as G, toDisplayString as P, withModifiers as X, normalizeStyle as j, createTextVNode as q, vShow as J } from "vue";
2
+ import Q from "../BaseDropDown.vue.js";
3
3
  import '../../../../../assets/BaseDropDown.css';/* empty css */
4
- import ae from "../BaseSelect/SelectItem.vue.js";
5
- import { debounce as ie } from "@wikicasa-dev/utilities";
6
- const ue = ["id", "data-cy", "placeholder"], se = ["innerHTML"], ke = /* @__PURE__ */ P({
4
+ import Y from "../BaseSelect/SelectItem.vue.js";
5
+ import { debounce as Z } from "@wikicasa-dev/utilities";
6
+ const _ = ["readonly", "placeholder"], ee = ["innerHTML"], ue = /* @__PURE__ */ L({
7
7
  __name: "ClearableAutocomplete",
8
- props: /* @__PURE__ */ O({
8
+ props: /* @__PURE__ */ M({
9
9
  dataCy: {},
10
10
  placeholder: {},
11
11
  enableKeyboardController: { type: Boolean, default: !0 },
12
12
  triggerWrapperClasses: {},
13
13
  inputWrapperClasses: {},
14
14
  inputClasses: {},
15
- hiddenTextClasses: {},
16
15
  dropdownClasses: {},
17
16
  clearButton: {},
18
17
  keepState: {},
19
- disableCb: { type: Boolean, default: !1 },
20
18
  onInputChangeCb: { type: Function },
21
19
  onOptionSelectedCb: { type: [Function, null] }
22
20
  }, {
23
21
  open: { type: Boolean, default: !1 },
24
22
  openModifiers: {},
25
23
  modelValue: { default: null },
26
- modelModifiers: {},
27
- inputValue: {
28
- default: ""
29
- },
30
- inputValueModifiers: {}
24
+ modelModifiers: {}
31
25
  }),
32
- emits: /* @__PURE__ */ O(["input", "click", "inputClick", "keydown"], ["update:open", "update:modelValue", "update:inputValue"]),
33
- setup(t, { expose: U, emit: E }) {
34
- const r = B(t, "open"), u = B(t, "modelValue"), o = B(t, "inputValue");
35
- o.value = o.value ?? u.value?.label ?? "";
36
- const p = E, I = X(), b = d("inputRef"), v = c(0), y = c(!1), k = c(!!u.value?.label), x = c(null), a = c([]), M = d("dropdownRef"), F = d("hiddenSpan"), L = d("inputWrapperRef"), z = d("clearButtonRef"), D = () => {
37
- o.value = "", u.value = null, k.value = !1;
38
- }, K = async (l) => {
39
- if (!l) {
40
- a.value = [], r.value = !1;
26
+ emits: /* @__PURE__ */ M(["click", "inputClick", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
27
+ setup(o, { expose: E, emit: O }) {
28
+ const s = V(o, "open"), a = V(o, "modelValue"), r = O, w = m("inputRef"), n = p(a.value?.label || ""), c = p(0), k = p(!1), g = p(null), i = p([]), h = m("dropdownRef"), S = m("hiddenSpan"), R = () => {
29
+ n.value = "", a.value = null, r("update:inputValue", "");
30
+ }, U = async (t) => {
31
+ if (r("update:inputValue", t), !t) {
32
+ i.value = [], s.value = !1;
41
33
  return;
42
34
  }
43
- t.disableCb || (a.value = await x.value?.(l) || [], y.value = !0, r.value = !!a.value.length);
44
- }, R = (l = -1) => {
45
- const e = a.value[l];
46
- !e || e.id === u.value?.id || (t.onOptionSelectedCb?.(e), o.value = e.label, r.value = !1, u.value = e, k.value = !0, a.value = []);
47
- }, N = () => {
48
- b.value?.select();
49
- }, A = () => {
50
- b.value?.focus();
35
+ i.value = await g.value?.(t) || [], k.value = !0, s.value = !!i.value.length;
36
+ }, T = (t = -1) => {
37
+ const e = i.value[t];
38
+ !e || e.id === a.value?.id || (o.onOptionSelectedCb?.(e), n.value = e.label, s.value = !1, a.value = e, i.value = []);
39
+ }, x = () => {
40
+ w.value?.select();
41
+ }, z = () => {
42
+ w.value?.focus();
51
43
  };
52
- return j(() => {
53
- x.value = ie({ delay: 300 }, t.onInputChangeCb);
54
- }), T(
55
- [o, F, L, z],
56
- ([, l, e, n]) => {
57
- !l || !e || q(() => {
58
- if (!l || !e) return;
59
- const h = l.offsetWidth, m = e.offsetWidth, i = t.clearButton?.offset || 0, w = t.clearButton?.width || n?.offsetWidth || 0, H = m - i - w, $ = Math.min(h, H);
60
- $ !== v.value && (v.value = $);
44
+ return W(() => {
45
+ g.value = Z({ delay: 300 }, o.onInputChangeCb);
46
+ }), b(
47
+ [n, () => S.value],
48
+ ([t, e]) => {
49
+ e && I(() => {
50
+ if (!e) return;
51
+ const l = e.offsetWidth;
52
+ l !== c.value && (console.log("DEBUG:updating icon positioning", {
53
+ curInputValue: t
54
+ }), c.value = l);
61
55
  });
62
56
  },
63
57
  { immediate: !0 }
64
- ), T(
65
- () => M.value?.selectedIdx,
66
- (l) => {
67
- const e = l ?? -1;
68
- e !== -1 && R(e);
58
+ ), b(
59
+ () => h.value?.selectedIdx,
60
+ (t) => {
61
+ const e = t ?? -1;
62
+ e !== -1 && T(e);
69
63
  }
70
- ), T(
71
- u,
72
- (l, e) => {
73
- l === e || l?.label === o.value || (o.value = l?.label || "");
64
+ ), b(
65
+ a,
66
+ (t, e) => {
67
+ t === e || t?.label === n.value || (n.value = t?.label || "");
74
68
  },
75
69
  { immediate: !0 }
76
- ), U({
77
- getRootElement: () => M.value?.getRootElement(),
78
- select: N,
79
- focus: A
80
- }), (l, e) => (g(), V(oe, {
70
+ ), E({
71
+ getRootElement: () => h.value?.getRootElement(),
72
+ select: x,
73
+ focus: z
74
+ }), (t, e) => (C(), F(Q, {
81
75
  ref: "dropdownRef",
82
76
  class: "uikit-clearable-autocomplete",
83
- "data-cy": t.dataCy,
77
+ "data-cy": o.dataCy,
84
78
  "dropdown-element": "ul",
85
- "dropdown-classes": ["uikit-z-30", t.dropdownClasses],
86
- "open-dropdown": r.value,
87
- "keep-state": !a.value.length || t.keepState === "closed" ? "closed" : "opened",
88
- "activate-keyboard-controller": t.enableKeyboardController,
89
- "reset-keyboard-controller": y.value,
90
- "onUpdate:resetKeyboardController": e[5] || (e[5] = (n) => y.value = n),
91
- "onUpdate:dropdownState": e[6] || (e[6] = (n) => r.value = n)
79
+ "dropdown-classes": ["uikit-z-30", o.dropdownClasses],
80
+ "open-dropdown": s.value,
81
+ "keep-state": !i.value.length || o.keepState === "closed" ? "closed" : "opened",
82
+ "activate-keyboard-controller": o.enableKeyboardController,
83
+ "reset-keyboard-controller": k.value,
84
+ "onUpdate:resetKeyboardController": e[4] || (e[4] = (l) => k.value = l),
85
+ "onUpdate:dropdownState": e[5] || (e[5] = (l) => s.value = l)
92
86
  }, {
93
- btn_slot: S(() => [
94
- s("div", {
95
- class: f(["uikit-text-16", t.triggerWrapperClasses]),
96
- onClick: e[4] || (e[4] = (n) => p("click", n))
87
+ btn_slot: y(() => [
88
+ u("div", {
89
+ class: v(["uikit-text-16", o.triggerWrapperClasses]),
90
+ onClick: e[3] || (e[3] = (l) => r("click", l))
97
91
  }, [
98
- C(l.$slots, "left-icon"),
99
- s("div", {
100
- ref: "inputWrapperRef",
101
- class: f(["uikit-relative", t.inputWrapperClasses])
92
+ f(t.$slots, "left-icon"),
93
+ u("div", {
94
+ class: v(["uikit-relative", o.inputWrapperClasses])
102
95
  }, [
103
- W(s("input", {
96
+ $(u("input", {
104
97
  ref: "inputRef",
105
98
  "onUpdate:modelValue": [
106
- e[0] || (e[0] = (n) => o.value = n),
107
- K
99
+ e[0] || (e[0] = (l) => n.value = l),
100
+ U
108
101
  ],
109
- id: Y(I),
110
- "data-cy": t.dataCy ? `ac_input_${t.dataCy}` : "",
102
+ readonly: !!a.value?.label,
111
103
  type: "text",
112
104
  autocomplete: "off",
113
- class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", t.inputClasses]),
105
+ class: v(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", o.inputClasses]),
114
106
  style: {
115
107
  font: "inherit",
116
108
  fontSize: "inherit"
117
109
  },
118
- placeholder: t.placeholder,
119
- onKeydown: e[1] || (e[1] = (n) => p("keydown", n)),
120
- onInput: e[2] || (e[2] = (n) => {
121
- p("input", n), k.value = !1;
122
- }),
123
- onClick: e[3] || (e[3] = (n) => {
124
- p("inputClick", n), b.value?.select();
125
- })
126
- }, null, 42, ue), [
127
- [Z, o.value]
110
+ placeholder: o.placeholder,
111
+ onKeydown: e[1] || (e[1] = (l) => r("keydown", l)),
112
+ onClick: e[2] || (e[2] = (l) => r("inputClick", l))
113
+ }, null, 42, _), [
114
+ [G, n.value]
128
115
  ]),
129
- s("span", {
116
+ u("span", {
130
117
  ref_key: "hiddenSpan",
131
- ref: F,
132
- class: f(["uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre", t.hiddenTextClasses]),
118
+ ref: S,
119
+ class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
133
120
  style: {
134
121
  font: "inherit",
135
122
  fontSize: "inherit"
136
123
  }
137
- }, _(o.value), 3),
138
- W(s("button", {
139
- ref: "clearButtonRef",
124
+ }, P(n.value), 513),
125
+ $(u("button", {
140
126
  type: "button",
141
- class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", t.clearButton?.classes]),
127
+ class: v(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", o.clearButton?.classes]),
142
128
  "aria-label": "Clear input",
143
- style: te({
144
- left: `${v.value + (t.clearButton?.offset || 0)}px`,
145
- width: t.clearButton?.width ? `${t.clearButton.width}px` : "auto",
146
- height: t.clearButton?.height ? `${t.clearButton.height}px` : "auto"
129
+ style: j({
130
+ left: `${c.value + (o.clearButton?.offset || 10)}px`
147
131
  }),
148
- onClick: ee(D, ["stop"])
132
+ onClick: X(R, ["stop"])
149
133
  }, [
150
- C(l.$slots, "clear-icon", {}, () => [
151
- e[7] || (e[7] = le("X", -1))
134
+ f(t.$slots, "clear-icon", {}, () => [
135
+ e[6] || (e[6] = q("X", -1))
152
136
  ])
153
137
  ], 6), [
154
- [ne, k.value && v.value]
138
+ [J, a.value?.label && c.value]
155
139
  ])
156
140
  ], 2),
157
- C(l.$slots, "right-icon")
141
+ f(t.$slots, "right-icon")
158
142
  ], 2)
159
143
  ]),
160
- default: S(({ activeIdx: n, setActiveIdx: h }) => [
161
- (g(!0), G(J, null, Q(a.value, (m, i) => (g(), V(ae, {
162
- key: i,
163
- active: n === i,
144
+ default: y(({ activeIdx: l, setActiveIdx: D }) => [
145
+ (C(!0), N(A, null, H(i.value, (B, d) => (C(), F(Y, {
146
+ key: d,
147
+ active: l === d,
164
148
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
165
- onClick: (w) => R(i),
166
- onMouseover: (w) => h(i)
149
+ onClick: (K) => T(d),
150
+ onMouseover: (K) => D(d)
167
151
  }, {
168
- default: S(() => [
169
- C(l.$slots, "option-content", {
170
- option: m,
171
- idx: i
152
+ default: y(() => [
153
+ f(t.$slots, "option-content", {
154
+ option: B,
155
+ idx: d
172
156
  }, () => [
173
- s("span", {
174
- innerHTML: m.label
175
- }, null, 8, se)
157
+ u("span", {
158
+ innerHTML: B.label
159
+ }, null, 8, ee)
176
160
  ])
177
161
  ]),
178
162
  _: 2
@@ -183,5 +167,5 @@ const ue = ["id", "data-cy", "placeholder"], se = ["innerHTML"], ke = /* @__PURE
183
167
  }
184
168
  });
185
169
  export {
186
- ke as default
170
+ ue as default
187
171
  };