@useinsider/ab-components 0.0.3 → 0.0.4
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/{FilledCautionTriangle-Dxi1xHHx.js → FilledCautionTriangle-B75sSsx4.js} +2 -2
- package/dist/{FilledCautionTriangle-Dxi1xHHx.js.map → FilledCautionTriangle-B75sSsx4.js.map} +1 -1
- package/dist/{FilledCheckCircle-BZblXEJF.js → FilledCheckCircle-KVwpT9RS.js} +2 -2
- package/dist/{FilledCheckCircle-BZblXEJF.js.map → FilledCheckCircle-KVwpT9RS.js.map} +1 -1
- package/dist/{FilledErrorBox-Czq7e64W.js → FilledErrorBox-Dpe6OZUM.js} +2 -2
- package/dist/{FilledErrorBox-Czq7e64W.js.map → FilledErrorBox-Dpe6OZUM.js.map} +1 -1
- package/dist/{FilledInfoCircle-BC2xa2R2.js → FilledInfoCircle-BY63hzfn.js} +2 -2
- package/dist/{FilledInfoCircle-BC2xa2R2.js.map → FilledInfoCircle-BY63hzfn.js.map} +1 -1
- package/dist/{LineCheck-dIF58UgU.js → LineCheck-BfCAWbdB.js} +2 -2
- package/dist/{LineCheck-dIF58UgU.js.map → LineCheck-BfCAWbdB.js.map} +1 -1
- package/dist/{LoadingCircle-CoRfnES9.js → LoadingCircle-tXgyfHxd.js} +2 -2
- package/dist/{LoadingCircle-CoRfnES9.js.map → LoadingCircle-tXgyfHxd.js.map} +1 -1
- package/dist/{SmartIcon-m_MkAWvM.js → SmartIcon-QK_6bafK.js} +2 -2
- package/dist/{SmartIcon-m_MkAWvM.js.map → SmartIcon-QK_6bafK.js.map} +1 -1
- package/dist/ab-components.cjs.js +1 -1
- package/dist/ab-components.cjs.js.map +1 -1
- package/dist/ab-components.css +1 -1
- package/dist/ab-components.es.js +1 -1
- package/dist/ab-components.iife.js +1 -1
- package/dist/ab-components.iife.js.map +1 -1
- package/dist/ab-components.umd.js +1 -1
- package/dist/ab-components.umd.js.map +1 -1
- package/dist/{index-BfxawNec.js → index-cklZdQqm.js} +103 -102
- package/dist/index-cklZdQqm.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/package.json +1 -1
- package/dist/index-BfxawNec.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, computed as
|
|
1
|
+
import { defineComponent as q, computed as M, openBlock as s, createElementBlock as d, normalizeClass as l, unref as e, createBlock as L, createCommentVNode as f, toDisplayString as v, ref as w, onMounted as D, Fragment as F, createElementVNode as k, withDirectives as T, normalizeStyle as G, withModifiers as K, vModelText as ee, renderList as U, defineAsyncComponent as I, resolveDynamicComponent as te, createVNode as ne } from "vue";
|
|
2
2
|
const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8", _e = "_button_hp1t7_1", ae = "_button__label_hp1t7_192", le = "_button__solid_hp1t7_204", se = "_fill_hp1t7_1124", $ = {
|
|
3
3
|
button__size_default: oe,
|
|
4
4
|
button__size_small: re,
|
|
@@ -49,31 +49,31 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
49
49
|
},
|
|
50
50
|
emits: ["click"],
|
|
51
51
|
setup(u, { emit: i }) {
|
|
52
|
-
const _ = u, t = i, a = (
|
|
53
|
-
_.disabled || t("click",
|
|
54
|
-
}, m =
|
|
55
|
-
return (
|
|
52
|
+
const _ = u, t = i, a = (r) => {
|
|
53
|
+
_.disabled || t("click", r);
|
|
54
|
+
}, m = M(() => _.loadingStatus ? "LoadingCircle" : _.successStatus ? "LineCheck" : _.leftIconName);
|
|
55
|
+
return (r, n) => (s(), d("button", {
|
|
56
56
|
class: l([
|
|
57
57
|
e($).button,
|
|
58
|
-
e($)[`button__${
|
|
59
|
-
e($)[`button__${
|
|
60
|
-
e($)[`button__size_${
|
|
61
|
-
{ [e($).fill]:
|
|
58
|
+
e($)[`button__${r.variant}`],
|
|
59
|
+
e($)[`button__${r.variant}-${r.color}`],
|
|
60
|
+
e($)[`button__size_${r.size}`],
|
|
61
|
+
{ [e($).fill]: r.fill }
|
|
62
62
|
]),
|
|
63
63
|
disabled: _.disabled,
|
|
64
64
|
onClick: a
|
|
65
65
|
}, [
|
|
66
|
-
m.value ? (s(),
|
|
66
|
+
m.value ? (s(), L(e(S), {
|
|
67
67
|
key: 0,
|
|
68
68
|
name: m.value
|
|
69
69
|
}, null, 8, ["name"])) : f("", !0),
|
|
70
|
-
|
|
70
|
+
r.label ? (s(), d("span", {
|
|
71
71
|
key: 1,
|
|
72
72
|
class: l(e($).button__label)
|
|
73
|
-
}, v(
|
|
74
|
-
|
|
73
|
+
}, v(r.label), 3)) : f("", !0),
|
|
74
|
+
r.rightIconName ? (s(), L(e(S), {
|
|
75
75
|
key: 2,
|
|
76
|
-
name:
|
|
76
|
+
name: r.rightIconName
|
|
77
77
|
}, null, 8, ["name"])) : f("", !0)
|
|
78
78
|
], 10, ue));
|
|
79
79
|
}
|
|
@@ -101,13 +101,13 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
101
101
|
const m = String(a[i]);
|
|
102
102
|
return de(m.toLowerCase(), t);
|
|
103
103
|
}).sort((a, m) => {
|
|
104
|
-
const
|
|
105
|
-
return
|
|
104
|
+
const r = String(a[i]).toLowerCase(), n = String(m[i]).toLowerCase();
|
|
105
|
+
return r === t ? -1 : n === t ? 1 : r.startsWith(t) && !n.startsWith(t) ? -1 : !r.startsWith(t) && n.startsWith(t) ? 1 : r.length - n.length;
|
|
106
106
|
});
|
|
107
|
-
}, pe = "
|
|
107
|
+
}, pe = "_dropdown_1yq1z_169", me = "_dropdown__valueContent_1yq1z_178", he = "_dropdown__label_1yq1z_189", be = "_dropdown__value_1yq1z_178", fe = "_dropdown__placeholder_1yq1z_196", ve = "_dropdown__arrowIcon_1yq1z_204", ge = "_menu_1yq1z_209", we = "_menu__searchContainer_1yq1z_222", ye = "_menu__searchInputWrap_1yq1z_226", Ce = "_menu__searchInput_1yq1z_226", ze = "_menu__errorMessage_1yq1z_247", ke = "_menu__addButton_1yq1z_254", Ie = "_menu__itemContainer_1yq1z_262", xe = "_menu__item_1yq1z_262", h = {
|
|
108
108
|
dropdown: pe,
|
|
109
109
|
dropdown__valueContent: me,
|
|
110
|
-
"dropdown__valueContent--open": "_dropdown__valueContent--
|
|
110
|
+
"dropdown__valueContent--open": "_dropdown__valueContent--open_1yq1z_186",
|
|
111
111
|
dropdown__label: he,
|
|
112
112
|
dropdown__value: be,
|
|
113
113
|
dropdown__placeholder: fe,
|
|
@@ -116,18 +116,18 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
116
116
|
menu__searchContainer: we,
|
|
117
117
|
menu__searchInputWrap: ye,
|
|
118
118
|
menu__searchInput: Ce,
|
|
119
|
-
"menu__searchInput--error": "_menu__searchInput--
|
|
119
|
+
"menu__searchInput--error": "_menu__searchInput--error_1yq1z_244",
|
|
120
120
|
menu__errorMessage: ze,
|
|
121
121
|
menu__addButton: ke,
|
|
122
122
|
menu__itemContainer: Ie,
|
|
123
123
|
menu__item: xe,
|
|
124
|
-
"menu__item--active": "_menu__item--
|
|
124
|
+
"menu__item--active": "_menu__item--active_1yq1z_300"
|
|
125
125
|
}, $e = ["for"], qe = ["placeholder"], Be = ["onClick"], rt = /* @__PURE__ */ q({
|
|
126
126
|
__name: "DropdownMenu",
|
|
127
127
|
props: {
|
|
128
128
|
id: {},
|
|
129
129
|
label: {},
|
|
130
|
-
|
|
130
|
+
modelValue: {},
|
|
131
131
|
menuHeight: { default: 154 },
|
|
132
132
|
placeholder: {},
|
|
133
133
|
addable: { type: Boolean },
|
|
@@ -137,27 +137,27 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
137
137
|
items: {},
|
|
138
138
|
validateAddItem: { type: Function, default: () => null }
|
|
139
139
|
},
|
|
140
|
-
emits: ["add-error", "item-added", "select-item"],
|
|
140
|
+
emits: ["update:modelValue", "add-error", "item-added", "select-item"],
|
|
141
141
|
setup(u, { emit: i }) {
|
|
142
|
-
const _ = ie, t = u, a = i, m = w(),
|
|
142
|
+
const _ = ie, t = u, a = i, m = w(), r = w(), n = w(!0), o = w(null), y = w(""), c = w(null), x = w({ x: 0, y: 0, width: 0, shouldOpenUp: !1, height: t.menuHeight }), H = w([...t.items]), B = w([...t.items]), O = () => {
|
|
143
143
|
if (!m.value)
|
|
144
144
|
return;
|
|
145
|
-
const { offsetTop: p, offsetLeft: b, offsetWidth: g } = m.value,
|
|
145
|
+
const { offsetTop: p, offsetLeft: b, offsetWidth: g } = m.value, P = window.innerHeight, j = p + m.value.offsetHeight, R = j + t.menuHeight > P;
|
|
146
146
|
x.value = {
|
|
147
147
|
x: b + window.scrollX,
|
|
148
|
-
y: R ? p + window.scrollY :
|
|
148
|
+
y: R ? p + window.scrollY : j + window.scrollY,
|
|
149
149
|
width: g,
|
|
150
150
|
shouldOpenUp: R,
|
|
151
151
|
height: t.menuHeight
|
|
152
152
|
};
|
|
153
153
|
}, A = () => {
|
|
154
154
|
O(), n.value = !n.value;
|
|
155
|
-
}, V = () => {
|
|
156
|
-
c.value = null, y.value = "", L.value = [...B.value];
|
|
157
155
|
}, E = () => {
|
|
158
|
-
|
|
156
|
+
c.value = null, y.value = "", H.value = [...B.value];
|
|
157
|
+
}, N = () => {
|
|
158
|
+
n.value = !1, E();
|
|
159
159
|
}, Y = (p) => {
|
|
160
|
-
|
|
160
|
+
o.value = p, a("select-item", p), a("update:modelValue", p.value), N();
|
|
161
161
|
}, Q = () => {
|
|
162
162
|
const p = y.value.trim(), b = t.validateAddItem(p, B.value);
|
|
163
163
|
if (b) {
|
|
@@ -168,24 +168,24 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
168
168
|
text: p,
|
|
169
169
|
value: p
|
|
170
170
|
};
|
|
171
|
-
B.value.push(g),
|
|
171
|
+
B.value.push(g), E(), a("item-added", g);
|
|
172
172
|
}, X = () => {
|
|
173
|
-
|
|
173
|
+
H.value = ce(B.value, "text", y.value);
|
|
174
174
|
}, Z = () => {
|
|
175
175
|
c.value = "";
|
|
176
|
-
}, J =
|
|
176
|
+
}, J = M(() => ({
|
|
177
177
|
top: x.value.shouldOpenUp ? `${x.value.y - 10}px` : `${x.value.y}px`,
|
|
178
178
|
left: `${x.value.x}px`,
|
|
179
179
|
width: `${x.value.width}px`,
|
|
180
180
|
height: `${t.menuHeight}px`
|
|
181
181
|
}));
|
|
182
182
|
D(() => {
|
|
183
|
-
if (O(), t.
|
|
184
|
-
const p = B.value.find((b) => b.value === t.
|
|
185
|
-
p && (
|
|
183
|
+
if (O(), t.modelValue) {
|
|
184
|
+
const p = B.value.find((b) => b.value === t.modelValue);
|
|
185
|
+
p && (o.value = p);
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
-
const
|
|
188
|
+
const W = M(() => o.value ? o.value.text : "");
|
|
189
189
|
return (p, b) => (s(), d(F, null, [
|
|
190
190
|
k("div", {
|
|
191
191
|
ref_key: "dropdownRef",
|
|
@@ -208,8 +208,8 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
208
208
|
}, [
|
|
209
209
|
k("span", {
|
|
210
210
|
class: l(e(h).dropdown__value)
|
|
211
|
-
}, v(
|
|
212
|
-
p.placeholder && !
|
|
211
|
+
}, v(W.value), 3),
|
|
212
|
+
p.placeholder && !W.value ? (s(), d("span", {
|
|
213
213
|
key: 0,
|
|
214
214
|
class: l(e(h).dropdown__placeholder)
|
|
215
215
|
}, v(p.placeholder), 3)) : f("", !0),
|
|
@@ -231,7 +231,7 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
231
231
|
n.value ? T((s(), d("div", {
|
|
232
232
|
key: 0,
|
|
233
233
|
ref_key: "menuRef",
|
|
234
|
-
ref:
|
|
234
|
+
ref: r,
|
|
235
235
|
class: l(e(h).menu),
|
|
236
236
|
style: G(J.value),
|
|
237
237
|
onClick: b[1] || (b[1] = K(() => {
|
|
@@ -273,31 +273,31 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
273
273
|
k("ul", {
|
|
274
274
|
class: l(e(h).menu__itemContainer)
|
|
275
275
|
}, [
|
|
276
|
-
(s(!0), d(F, null, U(
|
|
276
|
+
(s(!0), d(F, null, U(H.value, (g) => (s(), d("li", {
|
|
277
277
|
key: g.value,
|
|
278
278
|
class: l([
|
|
279
279
|
e(h).menu__item,
|
|
280
280
|
{
|
|
281
|
-
[e(h)["menu__item--active"]]:
|
|
281
|
+
[e(h)["menu__item--active"]]: o.value && g.value === o.value.value
|
|
282
282
|
}
|
|
283
283
|
]),
|
|
284
|
-
onClick: (
|
|
284
|
+
onClick: (P) => Y(g)
|
|
285
285
|
}, v(g.text), 11, Be))), 128))
|
|
286
286
|
], 2)
|
|
287
287
|
], 6)), [
|
|
288
|
-
[e(_), { handler:
|
|
288
|
+
[e(_), { handler: N, exclude: [m.value, r.value] }]
|
|
289
289
|
]) : f("", !0)
|
|
290
290
|
], 64));
|
|
291
291
|
}
|
|
292
|
-
}),
|
|
293
|
-
FilledErrorBox: I(() => import("./FilledErrorBox-
|
|
294
|
-
LineCheck: I(() => import("./LineCheck-
|
|
295
|
-
FilledCheckCircle: I(() => import("./FilledCheckCircle-
|
|
296
|
-
LoadingCircle: I(() => import("./LoadingCircle-
|
|
297
|
-
FilledInfoCircle: I(() => import("./FilledInfoCircle-
|
|
298
|
-
SmartIcon: I(() => import("./SmartIcon-
|
|
299
|
-
FilledCautionTriangle: I(() => import("./FilledCautionTriangle-
|
|
300
|
-
},
|
|
292
|
+
}), Me = {
|
|
293
|
+
FilledErrorBox: I(() => import("./FilledErrorBox-Dpe6OZUM.js")),
|
|
294
|
+
LineCheck: I(() => import("./LineCheck-BfCAWbdB.js")),
|
|
295
|
+
FilledCheckCircle: I(() => import("./FilledCheckCircle-KVwpT9RS.js")),
|
|
296
|
+
LoadingCircle: I(() => import("./LoadingCircle-tXgyfHxd.js")),
|
|
297
|
+
FilledInfoCircle: I(() => import("./FilledInfoCircle-BY63hzfn.js")),
|
|
298
|
+
SmartIcon: I(() => import("./SmartIcon-QK_6bafK.js")),
|
|
299
|
+
FilledCautionTriangle: I(() => import("./FilledCautionTriangle-B75sSsx4.js"))
|
|
300
|
+
}, Le = /* @__PURE__ */ q({
|
|
301
301
|
__name: "Icon",
|
|
302
302
|
props: {
|
|
303
303
|
name: {},
|
|
@@ -305,24 +305,24 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
305
305
|
color: {}
|
|
306
306
|
},
|
|
307
307
|
setup(u) {
|
|
308
|
-
const i = u, _ =
|
|
309
|
-
return (t, a) => (s(),
|
|
308
|
+
const i = u, _ = M(() => typeof i.size == "number" ? `${i.size}px` : i.size);
|
|
309
|
+
return (t, a) => (s(), L(te(e(Me)[t.name]), {
|
|
310
310
|
class: "icon",
|
|
311
311
|
style: G({ width: _.value, height: _.value, fill: i.color || "currentColor" })
|
|
312
312
|
}, null, 8, ["style"]));
|
|
313
313
|
}
|
|
314
|
-
}),
|
|
314
|
+
}), Se = (u, i) => {
|
|
315
315
|
const _ = u.__vccOpts || u;
|
|
316
316
|
for (const [t, a] of i)
|
|
317
317
|
_[t] = a;
|
|
318
318
|
return _;
|
|
319
|
-
},
|
|
320
|
-
container:
|
|
321
|
-
container__text:
|
|
319
|
+
}, S = /* @__PURE__ */ Se(Le, [["__scopeId", "data-v-3e9c3b20"]]), He = "_container_2joy4_1", Ve = "_container__text_2joy4_187", Fe = "_container__default_2joy4_191", Ge = "_container__warning_2joy4_199", Oe = "_container__alert_2joy4_207", Ee = "_container__success_2joy4_215", V = {
|
|
320
|
+
container: He,
|
|
321
|
+
container__text: Ve,
|
|
322
322
|
container__default: Fe,
|
|
323
323
|
container__warning: Ge,
|
|
324
324
|
container__alert: Oe,
|
|
325
|
-
container__success:
|
|
325
|
+
container__success: Ee
|
|
326
326
|
}, _t = /* @__PURE__ */ q({
|
|
327
327
|
__name: "OnPageMessage",
|
|
328
328
|
props: {
|
|
@@ -330,7 +330,7 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
330
330
|
text: {}
|
|
331
331
|
},
|
|
332
332
|
setup(u) {
|
|
333
|
-
const i = u, _ =
|
|
333
|
+
const i = u, _ = M(() => {
|
|
334
334
|
switch (i.variant) {
|
|
335
335
|
case "alert":
|
|
336
336
|
return "FilledErrorBox";
|
|
@@ -344,24 +344,24 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
344
344
|
});
|
|
345
345
|
return (t, a) => (s(), d("div", {
|
|
346
346
|
class: l([
|
|
347
|
-
e(
|
|
348
|
-
e(
|
|
347
|
+
e(V).container,
|
|
348
|
+
e(V)[`container__${t.variant}`]
|
|
349
349
|
])
|
|
350
350
|
}, [
|
|
351
|
-
ne(
|
|
351
|
+
ne(S, {
|
|
352
352
|
name: _.value,
|
|
353
353
|
size: 24
|
|
354
354
|
}, null, 8, ["name"]),
|
|
355
355
|
k("span", {
|
|
356
|
-
class: l(e(
|
|
356
|
+
class: l(e(V).container__text)
|
|
357
357
|
}, v(t.text), 3)
|
|
358
358
|
], 2));
|
|
359
359
|
}
|
|
360
|
-
}),
|
|
361
|
-
button__size_default:
|
|
362
|
-
button__size_small:
|
|
363
|
-
button:
|
|
364
|
-
button__label:
|
|
360
|
+
}), Ne = "_button__size_default_qxh1r_1", We = "_button__size_small_qxh1r_8", Pe = "_button_qxh1r_1", je = "_button__label_qxh1r_191", Re = "_button__solid_qxh1r_328", Te = "_segmentGroup_qxh1r_335", De = "_fill_qxh1r_357", C = {
|
|
361
|
+
button__size_default: Ne,
|
|
362
|
+
button__size_small: We,
|
|
363
|
+
button: Pe,
|
|
364
|
+
button__label: je,
|
|
365
365
|
"button--primary": "_button--primary_qxh1r_206",
|
|
366
366
|
"button--selected": "_button--selected_qxh1r_216",
|
|
367
367
|
"button--secondary": "_button--secondary_qxh1r_229",
|
|
@@ -385,38 +385,38 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
385
385
|
},
|
|
386
386
|
emits: ["click"],
|
|
387
387
|
setup(u, { emit: i }) {
|
|
388
|
-
const _ = u, t = i, a = w(""), m = (
|
|
389
|
-
_.disabled ||
|
|
388
|
+
const _ = u, t = i, a = w(""), m = (r) => {
|
|
389
|
+
_.disabled || r.disabled || (a.value = r.value, t("click", r.value));
|
|
390
390
|
};
|
|
391
|
-
return (
|
|
391
|
+
return (r, n) => (s(), d("div", {
|
|
392
392
|
class: l([
|
|
393
393
|
e(C).segmentGroup,
|
|
394
|
-
e(C)[`segmentGroup--${
|
|
395
|
-
{ [e(C).fill]:
|
|
394
|
+
e(C)[`segmentGroup--${r.align}`],
|
|
395
|
+
{ [e(C).fill]: r.fill }
|
|
396
396
|
])
|
|
397
397
|
}, [
|
|
398
|
-
(s(!0), d(F, null, U(
|
|
399
|
-
key:
|
|
398
|
+
(s(!0), d(F, null, U(r.segments, (o) => (s(), d("button", {
|
|
399
|
+
key: o.value,
|
|
400
400
|
class: l([
|
|
401
401
|
e(C).button,
|
|
402
|
-
e(C)[`button--${
|
|
403
|
-
e(C)[`button__size_${
|
|
402
|
+
e(C)[`button--${r.color}`],
|
|
403
|
+
e(C)[`button__size_${r.size}`],
|
|
404
404
|
e(C).fill,
|
|
405
405
|
{
|
|
406
|
-
[e(C)["button--selected"]]:
|
|
406
|
+
[e(C)["button--selected"]]: o.value === a.value
|
|
407
407
|
}
|
|
408
408
|
]),
|
|
409
|
-
disabled:
|
|
410
|
-
onClick: (y) => m(
|
|
409
|
+
disabled: o.disabled || _.disabled,
|
|
410
|
+
onClick: (y) => m(o)
|
|
411
411
|
}, [
|
|
412
|
-
|
|
412
|
+
o.icon ? (s(), L(e(S), {
|
|
413
413
|
key: 0,
|
|
414
|
-
name:
|
|
414
|
+
name: o.icon
|
|
415
415
|
}, null, 8, ["name"])) : f("", !0),
|
|
416
|
-
|
|
416
|
+
o.label ? (s(), d("span", {
|
|
417
417
|
key: 1,
|
|
418
418
|
class: l(e(C).button__label)
|
|
419
|
-
}, v(
|
|
419
|
+
}, v(o.label), 3)) : f("", !0)
|
|
420
420
|
], 10, Ue))), 128))
|
|
421
421
|
], 2));
|
|
422
422
|
}
|
|
@@ -443,7 +443,7 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
443
443
|
autoGrow: { type: Boolean, default: !1 },
|
|
444
444
|
counter: { type: Boolean }
|
|
445
445
|
},
|
|
446
|
-
emits: ["input", "change", "paste", "focus", "blur"],
|
|
446
|
+
emits: ["update:modelValue", "input", "change", "paste", "focus", "blur"],
|
|
447
447
|
setup(u, { emit: i }) {
|
|
448
448
|
const _ = u, t = i, a = w(null), m = () => {
|
|
449
449
|
if (_.autoGrow && a.value) {
|
|
@@ -451,12 +451,13 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
451
451
|
const n = Math.min(a.value.scrollHeight, _.maxHeight || a.value.scrollHeight);
|
|
452
452
|
a.value.style.height = `${n}px`;
|
|
453
453
|
}
|
|
454
|
-
},
|
|
455
|
-
|
|
454
|
+
}, r = (n) => {
|
|
455
|
+
const o = n.target;
|
|
456
|
+
t("input", n), t("update:modelValue", o.value), m();
|
|
456
457
|
};
|
|
457
458
|
return D(() => {
|
|
458
459
|
m();
|
|
459
|
-
}), (n,
|
|
460
|
+
}), (n, o) => {
|
|
460
461
|
var y;
|
|
461
462
|
return s(), d("div", {
|
|
462
463
|
class: l(e(z).wrapper)
|
|
@@ -482,11 +483,11 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
482
483
|
placeholder: n.placeholder,
|
|
483
484
|
style: G(n.maxHeight ? { maxHeight: `${n.maxHeight}px` } : void 0),
|
|
484
485
|
value: n.modelValue,
|
|
485
|
-
onBlur:
|
|
486
|
-
onChange:
|
|
487
|
-
onFocus:
|
|
488
|
-
onInput:
|
|
489
|
-
onPaste:
|
|
486
|
+
onBlur: o[0] || (o[0] = (c) => t("blur", c)),
|
|
487
|
+
onChange: o[1] || (o[1] = (c) => n.$emit("change", c)),
|
|
488
|
+
onFocus: o[2] || (o[2] = (c) => t("focus", c)),
|
|
489
|
+
onInput: r,
|
|
490
|
+
onPaste: o[3] || (o[3] = (c) => t("paste", c))
|
|
490
491
|
}, null, 46, et)) : (s(), d("input", {
|
|
491
492
|
key: 2,
|
|
492
493
|
id: n.id,
|
|
@@ -501,11 +502,11 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
501
502
|
name: n.name,
|
|
502
503
|
placeholder: n.placeholder,
|
|
503
504
|
value: n.modelValue,
|
|
504
|
-
onBlur:
|
|
505
|
-
onChange:
|
|
506
|
-
onFocus:
|
|
507
|
-
onInput:
|
|
508
|
-
onPaste:
|
|
505
|
+
onBlur: o[4] || (o[4] = (c) => t("blur", c)),
|
|
506
|
+
onChange: o[5] || (o[5] = (c) => n.$emit("change", c)),
|
|
507
|
+
onFocus: o[6] || (o[6] = (c) => t("focus", c)),
|
|
508
|
+
onInput: r,
|
|
509
|
+
onPaste: o[7] || (o[7] = (c) => t("paste", c))
|
|
509
510
|
}, null, 42, tt)),
|
|
510
511
|
k("div", {
|
|
511
512
|
class: l(e(z).wrapper__bottom)
|
|
@@ -524,12 +525,12 @@ const oe = "_button__size_default_hp1t7_1", re = "_button__size_small_hp1t7_8",
|
|
|
524
525
|
}
|
|
525
526
|
});
|
|
526
527
|
export {
|
|
527
|
-
|
|
528
|
-
|
|
528
|
+
S as I,
|
|
529
|
+
Se as _,
|
|
529
530
|
ot as a,
|
|
530
531
|
rt as b,
|
|
531
532
|
_t as c,
|
|
532
533
|
at as d,
|
|
533
534
|
lt as e
|
|
534
535
|
};
|
|
535
|
-
//# sourceMappingURL=index-
|
|
536
|
+
//# sourceMappingURL=index-cklZdQqm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-cklZdQqm.js","sources":["../src/components/Button/Button.vue","../src/directives/clickOutside.ts","../src/utils/search.ts","../src/components/Dropdown/DropdownMenu.vue","../src/components/Icon/icons/index.ts","../src/components/Icon/Icon.vue","../src/components/OnPageMessage/OnPageMessage.vue","../src/components/SegmentButton/SegmentButton.vue","../src/components/TextInput/TextInput.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport type { IconNames } from '@/components/Icon/types';\nimport { Icon } from '@/index';\nimport styles from './Button.module.scss';\n\ninterface ButtonProps {\n variant: 'solid' | 'ghost' | 'text' | 'outline';\n color: 'primary' | 'subtle-primary' | 'secondary' | 'danger' | 'warning' | 'smart';\n size?: 'default' | 'small';\n leftIconName?: IconNames;\n rightIconName?: IconNames;\n loadingStatus?: boolean;\n successStatus?: boolean;\n label?: string;\n disabled?: boolean;\n fill?: boolean;\n}\n\nconst props = withDefaults(defineProps<ButtonProps>(), {\n loadingStatus: false,\n successStatus: false,\n disabled: false,\n fill: false,\n size: 'default',\n});\n\nconst emit = defineEmits<{\n click: [event: MouseEvent];\n}>();\n\nconst onClick = (event: MouseEvent) => {\n if (props.disabled) {\n return;\n }\n\n emit('click', event);\n};\n\nconst leftIcon = computed<IconNames | undefined>(() => {\n if (props.loadingStatus) {\n return 'LoadingCircle';\n } else if (props.successStatus) {\n return 'LineCheck';\n }\n\n return props.leftIconName;\n});\n</script>\n\n<template>\n <button\n :class=\"[\n styles.button,\n styles[`button__${variant}`],\n styles[`button__${variant}-${color}`],\n styles[`button__size_${size}`],\n { [styles.fill]: fill },\n ]\"\n :disabled=\"props.disabled\"\n @click=\"onClick\">\n <Icon\n v-if=\"leftIcon\"\n :name=\"leftIcon\" />\n <span\n v-if=\"label\"\n :class=\"styles.button__label\">\n {{ label }}\n </span>\n <Icon\n v-if=\"rightIconName\"\n :name=\"rightIconName\" />\n </button>\n</template>\n","import type { DirectiveBinding } from 'vue';\n\ninterface ClickOutsideElement extends HTMLElement {\n clickOutsideEvent?: (event: Event) => void;\n}\n\nexport default {\n mounted(el: ClickOutsideElement, binding: DirectiveBinding<{ handler: () => void; exclude?: HTMLElement[] }>) {\n el.clickOutsideEvent = (event: Event) => {\n const isClickInside = [el, ...(binding.value.exclude || [])].some(element => {\n return element && (element === event.target || element.contains(event.target as Node))\n });\n\n if (!isClickInside) {\n binding.value.handler(); // Close handler\n }\n };\n\n document.addEventListener('click', el.clickOutsideEvent);\n },\n unmounted(el: ClickOutsideElement) {\n if (el.clickOutsideEvent) {\n document.removeEventListener('click', el.clickOutsideEvent);\n }\n },\n};","const isFuzzyMatch = (choiceValue: string, searchTerm: string): boolean => {\n let searchIndex = 0;\n for (const char of choiceValue) {\n if (char.toLowerCase() === searchTerm[searchIndex]?.toLowerCase()) {\n searchIndex++;\n }\n if (searchIndex === searchTerm.length) {\n return true;\n }\n }\n return false;\n};\n\n\nexport const fuzzySearch = <T>(\n choices: T[],\n key: keyof T,\n searchTerm: string,\n): T[] => {\n if (!searchTerm.trim()) {\n return choices;\n }\n\n const normalizedSearchTerm = searchTerm.toLowerCase();\n\n return choices\n .filter(choice => {\n const value = String(choice[key]);\n\n return isFuzzyMatch(value.toLowerCase(), normalizedSearchTerm)\n })\n .sort((a, b) => {\n const aValue = String(a[key]).toLowerCase();\n const bValue = String(b[key]).toLowerCase();\n\n if (aValue === normalizedSearchTerm) return -1;\n if (bValue === normalizedSearchTerm) return 1;\n\n if (aValue.startsWith(normalizedSearchTerm) && !bValue.startsWith(normalizedSearchTerm))\n return -1;\n if (!aValue.startsWith(normalizedSearchTerm) && bValue.startsWith(normalizedSearchTerm))\n return 1;\n\n return aValue.length - bValue.length;\n });\n};\n","<script lang=\"ts\" setup>\nimport { ref, computed, type StyleValue, onMounted } from 'vue';\nimport clickOutside from '@/directives/clickOutside';\nimport { fuzzySearch } from '@/utils/search';\nimport styles from './Dropdown.module.scss';\n\nconst vClickOutside = clickOutside;\n\ninterface MenuItem {\n text: string;\n value: string;\n}\n\ninterface DropdownProps {\n id: string;\n label?: string;\n modelValue?: string;\n menuHeight?: number;\n placeholder?: string;\n addable?: boolean;\n addButtonText?: string;\n searchable?: boolean;\n searchPlaceHolder?: string;\n items: MenuItem[];\n validateAddItem?: (item: string, items: MenuItem[]) => string | null;\n}\n\ninterface Emits {\n (e: 'update:modelValue', value: string): void;\n (e: 'add-error', error: string): void;\n (e: 'item-added', item: MenuItem): void;\n (e: 'select-item', item: MenuItem): void;\n}\n\nconst props = withDefaults(defineProps<DropdownProps>(), {\n menuHeight: 154,\n searchBar: false,\n addItem: false,\n validateAddItem: () => null,\n});\n\nconst emit = defineEmits<Emits>();\nconst dropdownRef = ref<HTMLDivElement>();\nconst menuRef = ref<HTMLDivElement>();\nconst isOpen = ref(true);\nconst selectedItem = ref<MenuItem | null>(null);\nconst searchQuery = ref('');\nconst errorMessage = ref<string | null>(null);\nconst menuPosition = ref({ x: 0, y: 0, width: 0, shouldOpenUp: false, height: props.menuHeight });\nconst filteredItems = ref([...props.items]);\nconst allItems = ref([...props.items]);\n\nconst calculateMenuPosition = () => {\n if (!dropdownRef.value) {\n return;\n }\n\n const { offsetTop: top, offsetLeft: left, offsetWidth: width } = dropdownRef.value;\n const viewportHeight = window.innerHeight;\n const bottom = top + dropdownRef.value.offsetHeight;\n const shouldOpenUp = bottom + props.menuHeight > viewportHeight;\n\n menuPosition.value = {\n x: left + window.scrollX,\n y: shouldOpenUp ? top + window.scrollY : bottom + window.scrollY,\n width,\n shouldOpenUp,\n height: props.menuHeight,\n };\n};\n\nconst toggleMenu = () => {\n calculateMenuPosition();\n isOpen.value = !isOpen.value;\n};\n\nconst resetSettings = () => {\n errorMessage.value = null;\n searchQuery.value = '';\n filteredItems.value = [...allItems.value];\n};\n\nconst closeMenu = () => {\n isOpen.value = false;\n\n resetSettings();\n};\n\nconst selectItem = (item: MenuItem) => {\n selectedItem.value = item;\n\n emit('select-item', item);\n emit('update:modelValue', item.value);\n\n closeMenu();\n};\n\nconst addItem = () => {\n const query = searchQuery.value.trim();\n const error = props.validateAddItem(query, allItems.value);\n\n if (error) {\n errorMessage.value = error;\n\n emit('add-error', error);\n\n return;\n }\n\n const newItem: MenuItem = {\n text: query,\n value: query,\n };\n\n allItems.value.push(newItem);\n resetSettings();\n\n emit('item-added', newItem);\n};\n\nconst onSearch = () => {\n filteredItems.value = fuzzySearch<MenuItem>(allItems.value, 'text', searchQuery.value);\n};\n\nconst onFocusSearch = () => {\n errorMessage.value = '';\n};\n\nconst menuStyle = computed<Partial<StyleValue>>(() => ({\n top: menuPosition.value.shouldOpenUp ? `${menuPosition.value.y - 10}px` : `${menuPosition.value.y}px`,\n left: `${menuPosition.value.x}px`,\n width: `${menuPosition.value.width}px`,\n height: `${props.menuHeight}px`,\n}));\n\nonMounted(() => {\n calculateMenuPosition();\n\n if (props.modelValue) {\n const defaultItem = allItems.value.find(item => item.value === props.modelValue);\n\n if (defaultItem) {\n selectedItem.value = defaultItem;\n }\n }\n});\n\nconst selectedValue = computed(() => (selectedItem.value ? selectedItem.value.text : ''));\n</script>\n\n<template>\n <div\n ref=\"dropdownRef\"\n :class=\"styles.dropdown\">\n <label\n v-if=\"label\"\n :class=\"styles.dropdown__label\"\n :for=\"id\">\n {{ label }}\n </label>\n <button\n :class=\"[\n styles.dropdown__valueContent, {\n [styles['dropdown__valueContent--open']]: isOpen,\n },\n ]\"\n @click=\"toggleMenu\">\n <span :class=\"styles.dropdown__value\">\n {{ selectedValue }}\n </span>\n <span\n v-if=\"placeholder && !selectedValue\"\n :class=\"styles.dropdown__placeholder\">\n {{ placeholder }}\n </span>\n <svg\n fill=\"none\"\n height=\"17\"\n viewBox=\"0 0 16 17\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n :class=\"styles.dropdown__arrowIcon\">\n <path\n d=\"M8 11.2021L4.5359 6.70215L11.4641 6.70215L8 11.2021Z\"\n fill=\"#91949F\" />\n </svg>\n </button>\n </div>\n\n <div\n v-if=\"isOpen\"\n ref=\"menuRef\"\n :class=\"styles.menu\"\n :style=\"menuStyle\"\n v-click-outside=\"{ handler: closeMenu, exclude: [dropdownRef, menuRef] }\"\n @click.prevent>\n <div\n v-if=\"props.searchable\"\n :class=\"styles.menu__searchContainer\">\n <div :class=\"styles.menu__searchInputWrap\">\n <input\n type=\"text\"\n :class=\"[\n styles.menu__searchInput, {\n [styles['menu__searchInput--error']]: errorMessage,\n },\n ]\"\n :placeholder=\"searchPlaceHolder\"\n v-model=\"searchQuery\"\n @focus=\"onFocusSearch\"\n @input=\"onSearch\">\n <p\n v-if=\"errorMessage\"\n :class=\"styles.menu__errorMessage\">\n {{ errorMessage }}\n </p>\n </div>\n <button\n v-if=\"props.addable\"\n :class=\"styles.menu__addButton\"\n @click=\"addItem\">\n {{ addButtonText }}\n </button>\n </div>\n <ul :class=\"styles.menu__itemContainer\">\n <li\n v-for=\"(item) in filteredItems\"\n :key=\"item.value\"\n :class=\"[\n styles.menu__item, {\n [styles['menu__item--active']]: selectedItem && item.value === selectedItem.value,\n },\n ]\"\n @click=\"selectItem(item)\">\n {{ item.text }}\n </li>\n </ul>\n </div>\n</template>\n","import { defineAsyncComponent } from 'vue';\n\nconst iconMap = {\n FilledErrorBox: defineAsyncComponent(() => import('./FilledErrorBox.vue')),\n LineCheck: defineAsyncComponent(() => import('./LineCheck.vue')),\n FilledCheckCircle: defineAsyncComponent(() => import('./FilledCheckCircle.vue')),\n LoadingCircle: defineAsyncComponent(() => import('./LoadingCircle.vue')),\n FilledInfoCircle: defineAsyncComponent(() => import('./FilledInfoCircle.vue')),\n SmartIcon: defineAsyncComponent(() => import('./SmartIcon.vue')),\n FilledCautionTriangle: defineAsyncComponent(() => import('./FilledCautionTriangle.vue')),\n};\n\nexport default iconMap;\n","<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport iconMap from '@/components/Icon/icons';\nimport type { IconNames } from '@/components/Icon/types';\n\ninterface IconProps {\n name: IconNames;\n size?: 16 | 24;\n color?: string;\n}\n\nconst props = withDefaults(defineProps<IconProps>(), {\n size: 16,\n});\n\nconst iconSize = computed(() => (typeof props.size === 'number' ? `${props.size}px` : props.size));\n</script>\n\n<template>\n <component\n :is=\"iconMap[name]\"\n class=\"icon\"\n :style=\"{ width: iconSize, height: iconSize, fill: props.color || 'currentColor' }\" />\n</template>\n\n<style scoped>\n.icon {\n display: inline-block;\n line-height: 0;\n vertical-align: middle;\n}\n</style>\n","<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport Icon from '@/components/Icon/Icon.vue';\nimport type { IconNames } from '@/components/Icon/types';\nimport styles from './OnPageMessage.module.scss';\n\ninterface OnPageMessageProps {\n variant?: 'default' | 'warning' | 'alert' | 'success';\n text: string;\n}\n\nconst props = withDefaults(defineProps<OnPageMessageProps>(), {\n variant: 'default',\n});\n\nconst IconName = computed<IconNames>(() => {\n switch (props.variant) {\n case 'alert': return 'FilledErrorBox';\n case 'warning': return 'FilledCautionTriangle';\n case 'success': return 'FilledCheckCircle';\n\n default: return 'FilledInfoCircle';\n }\n});\n</script>\n\n<template>\n <div\n :class=\"[\n styles.container,\n styles[`container__${variant}`],\n ]\">\n <Icon\n :name=\"IconName\"\n :size=\"24\" />\n <span :class=\"styles.container__text\">{{ text }}</span>\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref } from 'vue';\nimport type { IconNames } from '@/components/Icon/types';\nimport { Icon } from '@/index';\nimport styles from './SegmentButton.module.scss';\n\ninterface SegmentType {\n value: string;\n label: string;\n disabled?: boolean;\n icon?: IconNames;\n}\n\ninterface SegmentButtonProps {\n color: 'primary' | 'secondary' | 'danger' | 'warning' | 'smart';\n size?: 'default' | 'small';\n align?: 'vertical' | 'horizontal';\n disabled?: boolean;\n segments: SegmentType[];\n fill?: boolean;\n}\n\nconst props = withDefaults(defineProps<SegmentButtonProps>(), {\n loadingStatus: false,\n successStatus: false,\n disabled: false,\n size: 'default',\n align: 'horizontal',\n});\n\nconst emit = defineEmits<{\n click: [event: SegmentType['value']];\n}>();\n\nconst selected = ref<string>('');\n\nconst setSelect = (segment: SegmentType) => {\n if (props.disabled || segment.disabled) {\n return;\n }\n\n selected.value = segment.value;\n\n emit('click', segment.value);\n};\n</script>\n\n<template>\n <div\n :class=\"[\n styles.segmentGroup,\n styles[`segmentGroup--${align}`],\n { [styles.fill]: fill },\n ]\">\n <button\n v-for=\"segment in segments\"\n :key=\"segment.value\"\n :class=\"[\n styles.button,\n styles[`button--${color}`],\n styles[`button__size_${size}`],\n styles.fill,\n {\n [styles[`button--selected`]]: segment.value === selected,\n },\n ]\"\n :disabled=\"segment.disabled || props.disabled\"\n @click=\"setSelect(segment)\">\n <Icon\n v-if=\"segment.icon\"\n :name=\"segment.icon\" />\n <span\n v-if=\"segment.label\"\n :class=\"styles.button__label\">\n {{ segment.label }}\n </span>\n </button>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted, ref } from 'vue';\nimport styles from './TextInput.module.scss';\n\nexport interface Props {\n id: string;\n name: string;\n modelValue: string | number;\n label?: string;\n placeholder?: string;\n maxLength?: number;\n maxHeight?: number;\n error?: string;\n multiline?: boolean;\n autoGrow?: boolean;\n counter?: boolean;\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n label: '',\n placeholder: '',\n maxLength: undefined,\n maxHeight: undefined,\n error: '',\n multiline: false,\n autoGrow: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [Props['modelValue']];\n input: [event: Event];\n change: [event: Event];\n paste: [event: ClipboardEvent];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null);\n\nconst autoGrow = () => {\n if (props.autoGrow && textareaRef.value) {\n textareaRef.value.style.height = '';\n\n const newHeight = Math.min(textareaRef.value.scrollHeight, props.maxHeight || textareaRef.value.scrollHeight);\n\n textareaRef.value.style.height = `${newHeight}px`;\n }\n};\n\nconst handleInput = (event: Event) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n\n emit('input', event);\n emit('update:modelValue', target.value);\n\n autoGrow();\n};\n\nonMounted(() => {\n autoGrow();\n});\n</script>\n\n<template>\n <div :class=\"styles.wrapper\">\n <label\n v-if=\"label\"\n :class=\"styles.wrapper__label\"\n :for=\"id\">\n {{ label }}\n </label>\n <template v-if=\"multiline\">\n <textarea\n :id=\"id\"\n ref=\"textareaRef\"\n :class=\"[\n styles.wrapper__field, {\n [styles['wrapper--error']]: error,\n },\n ]\"\n :maxlength=\"maxLength\"\n :name=\"name\"\n :placeholder=\"placeholder\"\n :style=\"maxHeight ? { maxHeight: `${maxHeight}px` } : undefined\"\n :value=\"modelValue\"\n @blur=\"emit('blur', $event)\"\n @change=\"$emit('change', $event)\"\n @focus=\"emit('focus', $event)\"\n @input=\"handleInput\"\n @paste=\"emit('paste', $event)\" />\n </template>\n <template v-else>\n <input\n :id=\"id\"\n type=\"text\"\n :class=\"[\n styles.wrapper__field, {\n [styles['wrapper--error']]: error,\n },\n ]\"\n :maxlength=\"maxLength\"\n :name=\"name\"\n :placeholder=\"placeholder\"\n :value=\"modelValue\"\n @blur=\"emit('blur', $event)\"\n @change=\"$emit('change', $event)\"\n @focus=\"emit('focus', $event)\"\n @input=\"handleInput\"\n @paste=\"emit('paste', $event)\">\n </template>\n\n <div :class=\"styles.wrapper__bottom\">\n <div\n v-if=\"error\"\n :class=\"styles.wrapper__errorMessage\">\n {{ error }}\n </div>\n <div\n v-if=\"counter\"\n :class=\"styles.wrapper__counter\">\n {{ modelValue?.toString().length || 0 }}\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","emit","__emit","onClick","event","leftIcon","computed","clickOutside","el","binding","element","isFuzzyMatch","choiceValue","searchTerm","searchIndex","char","_a","fuzzySearch","choices","key","normalizedSearchTerm","choice","value","b","aValue","bValue","vClickOutside","dropdownRef","ref","menuRef","isOpen","selectedItem","searchQuery","errorMessage","menuPosition","filteredItems","allItems","calculateMenuPosition","top","left","width","viewportHeight","bottom","shouldOpenUp","toggleMenu","resetSettings","closeMenu","selectItem","item","addItem","query","error","newItem","onSearch","onFocusSearch","menuStyle","onMounted","defaultItem","selectedValue","iconMap","defineAsyncComponent","iconSize","IconName","selected","setSelect","segment","textareaRef","autoGrow","newHeight","handleInput","target"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,UAAMA,IAAQC,GAQRC,IAAOC,GAIPC,IAAU,CAACC,MAAsB;AACnC,MAAIL,EAAM,YAIVE,EAAK,SAASG,CAAK;AAAA,IACvB,GAEMC,IAAWC,EAAgC,MACzCP,EAAM,gBACC,kBACAA,EAAM,gBACN,cAGJA,EAAM,YAChB;;;;;;;;;;;;;;;;;;;;;;;;;;ICzCcQ,KAAA;AAAA,EACX,QAAQC,GAAyBC,GAA6E;AACvG,IAAAD,EAAA,oBAAoB,CAACJ,MAAiB;AAKrC,MAJsB,CAACI,GAAI,GAAIC,EAAQ,MAAM,WAAW,EAAG,EAAE,KAAK,CAAWC,MAClEA,MAAYA,MAAYN,EAAM,UAAUM,EAAQ,SAASN,EAAM,MAAc,EACvF,KAGGK,EAAQ,MAAM,QAAQ;AAAA,IAE9B,GAES,SAAA,iBAAiB,SAASD,EAAG,iBAAiB;AAAA,EAC3D;AAAA,EACA,UAAUA,GAAyB;AAC/B,IAAIA,EAAG,qBACM,SAAA,oBAAoB,SAASA,EAAG,iBAAiB;AAAA,EAC9D;AAER,GCzBMG,KAAe,CAACC,GAAqBC,MAAgC;;AACvE,MAAIC,IAAc;AAClB,aAAWC,KAAQH;AAIX,QAHAG,EAAK,YAAY,QAAMC,IAAAH,EAAWC,CAAW,MAAtB,gBAAAE,EAAyB,kBAChDF,KAEAA,MAAgBD,EAAW;AACpB,aAAA;AAGR,SAAA;AACX,GAGaI,KAAc,CACvBC,GACAC,GACAN,MACM;AACF,MAAA,CAACA,EAAW;AACL,WAAAK;AAGL,QAAAE,IAAuBP,EAAW,YAAY;AAE7C,SAAAK,EACF,OAAO,CAAUG,MAA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AAkB,iBAAA;AAAA,QACvB,KAAK;AAAkB,iBAAA;AAAA,QAEvB;AAAgB,iBAAA;AAAA,MAAA;AAAA,IACpB,CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACDD,UAAMA,IAAQC,GAQRC,IAAOC,GAIP6D,IAAWnC,EAAY,EAAE,GAEzBoC,IAAY,CAACC,MAAyB;AACpC,MAAAlE,EAAM,YAAYkE,EAAQ,aAI9BF,EAAS,QAAQE,EAAQ,OAEpBhE,EAAA,SAASgE,EAAQ,KAAK;AAAA,IAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1BA,UAAMlE,IAAQC,GAURC,IAAOC,GASPgE,IAActC,EAAgC,IAAI,GAElDuC,IAAW,MAAM;AACf,UAAApE,EAAM,YAAYmE,EAAY,OAAO;AACzB,QAAAA,EAAA,MAAM,MAAM,SAAS;AAE3B,cAAAE,IAAY,KAAK,IAAIF,EAAY,MAAM,cAAcnE,EAAM,aAAamE,EAAY,MAAM,YAAY;AAE5G,QAAAA,EAAY,MAAM,MAAM,SAAS,GAAGE,CAAS;AAAA,MAAA;AAAA,IAErD,GAEMC,IAAc,CAACjE,MAAiB;AAClC,YAAMkE,IAASlE,EAAM;AAErB,MAAAH,EAAK,SAASG,CAAK,GACdH,EAAA,qBAAqBqE,EAAO,KAAK,GAE7BH,EAAA;AAAA,IACb;AAEA,WAAAX,EAAU,MAAM;AACH,MAAAW,EAAA;AAAA,IAAA,CACZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -29,15 +29,16 @@ declare interface ButtonProps {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export declare const DropdownMenu: DefineComponent<DropdownProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
32
|
+
"update:modelValue": (value: string) => any;
|
|
32
33
|
"add-error": (error: string) => any;
|
|
33
34
|
"item-added": (item: MenuItem) => any;
|
|
34
35
|
"select-item": (item: MenuItem) => any;
|
|
35
36
|
}, string, PublicProps, Readonly<DropdownProps> & Readonly<{
|
|
37
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
36
38
|
"onAdd-error"?: ((error: string) => any) | undefined;
|
|
37
39
|
"onItem-added"?: ((item: MenuItem) => any) | undefined;
|
|
38
40
|
"onSelect-item"?: ((item: MenuItem) => any) | undefined;
|
|
39
41
|
}>, {
|
|
40
|
-
defaultSelected: string;
|
|
41
42
|
menuHeight: number;
|
|
42
43
|
validateAddItem: (item: string, items: MenuItem[]) => string | null;
|
|
43
44
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
@@ -48,7 +49,7 @@ menuRef: HTMLDivElement;
|
|
|
48
49
|
declare interface DropdownProps {
|
|
49
50
|
id: string;
|
|
50
51
|
label?: string;
|
|
51
|
-
|
|
52
|
+
modelValue?: string;
|
|
52
53
|
menuHeight?: number;
|
|
53
54
|
placeholder?: string;
|
|
54
55
|
addable?: boolean;
|
|
@@ -141,12 +142,14 @@ blur: (event: FocusEvent) => any;
|
|
|
141
142
|
change: (event: Event) => any;
|
|
142
143
|
focus: (event: FocusEvent) => any;
|
|
143
144
|
paste: (event: ClipboardEvent) => any;
|
|
145
|
+
"update:modelValue": (args_0: string | number) => any;
|
|
144
146
|
}, string, PublicProps, Readonly<Props> & Readonly<{
|
|
145
147
|
onInput?: ((event: Event) => any) | undefined;
|
|
146
148
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
147
149
|
onChange?: ((event: Event) => any) | undefined;
|
|
148
150
|
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
149
151
|
onPaste?: ((event: ClipboardEvent) => any) | undefined;
|
|
152
|
+
"onUpdate:modelValue"?: ((args_0: string | number) => any) | undefined;
|
|
150
153
|
}>, {
|
|
151
154
|
label: string;
|
|
152
155
|
error: string;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-BfxawNec.js","sources":["../src/components/Button/Button.vue","../src/directives/clickOutside.ts","../src/utils/search.ts","../src/components/Dropdown/DropdownMenu.vue","../src/components/Icon/icons/index.ts","../src/components/Icon/Icon.vue","../src/components/OnPageMessage/OnPageMessage.vue","../src/components/SegmentButton/SegmentButton.vue","../src/components/TextInput/TextInput.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport type { IconNames } from '@/components/Icon/types';\nimport { Icon } from '@/index';\nimport styles from './Button.module.scss';\n\ninterface ButtonProps {\n variant: 'solid' | 'ghost' | 'text' | 'outline';\n color: 'primary' | 'subtle-primary' | 'secondary' | 'danger' | 'warning' | 'smart';\n size?: 'default' | 'small';\n leftIconName?: IconNames;\n rightIconName?: IconNames;\n loadingStatus?: boolean;\n successStatus?: boolean;\n label?: string;\n disabled?: boolean;\n fill?: boolean;\n}\n\nconst props = withDefaults(defineProps<ButtonProps>(), {\n loadingStatus: false,\n successStatus: false,\n disabled: false,\n fill: false,\n size: 'default',\n});\n\nconst emit = defineEmits<{\n click: [event: MouseEvent];\n}>();\n\nconst onClick = (event: MouseEvent) => {\n if (props.disabled) {\n return;\n }\n\n emit('click', event);\n};\n\nconst leftIcon = computed<IconNames | undefined>(() => {\n if (props.loadingStatus) {\n return 'LoadingCircle';\n } else if (props.successStatus) {\n return 'LineCheck';\n }\n\n return props.leftIconName;\n});\n</script>\n\n<template>\n <button\n :class=\"[\n styles.button,\n styles[`button__${variant}`],\n styles[`button__${variant}-${color}`],\n styles[`button__size_${size}`],\n { [styles.fill]: fill },\n ]\"\n :disabled=\"props.disabled\"\n @click=\"onClick\">\n <Icon\n v-if=\"leftIcon\"\n :name=\"leftIcon\" />\n <span\n v-if=\"label\"\n :class=\"styles.button__label\">\n {{ label }}\n </span>\n <Icon\n v-if=\"rightIconName\"\n :name=\"rightIconName\" />\n </button>\n</template>\n","import type { DirectiveBinding } from 'vue';\n\ninterface ClickOutsideElement extends HTMLElement {\n clickOutsideEvent?: (event: Event) => void;\n}\n\nexport default {\n mounted(el: ClickOutsideElement, binding: DirectiveBinding<{ handler: () => void; exclude?: HTMLElement[] }>) {\n el.clickOutsideEvent = (event: Event) => {\n const isClickInside = [el, ...(binding.value.exclude || [])].some(element => {\n return element && (element === event.target || element.contains(event.target as Node))\n });\n\n if (!isClickInside) {\n binding.value.handler(); // Close handler\n }\n };\n\n document.addEventListener('click', el.clickOutsideEvent);\n },\n unmounted(el: ClickOutsideElement) {\n if (el.clickOutsideEvent) {\n document.removeEventListener('click', el.clickOutsideEvent);\n }\n },\n};","const isFuzzyMatch = (choiceValue: string, searchTerm: string): boolean => {\n let searchIndex = 0;\n for (const char of choiceValue) {\n if (char.toLowerCase() === searchTerm[searchIndex]?.toLowerCase()) {\n searchIndex++;\n }\n if (searchIndex === searchTerm.length) {\n return true;\n }\n }\n return false;\n};\n\n\nexport const fuzzySearch = <T>(\n choices: T[],\n key: keyof T,\n searchTerm: string,\n): T[] => {\n if (!searchTerm.trim()) {\n return choices;\n }\n\n const normalizedSearchTerm = searchTerm.toLowerCase();\n\n return choices\n .filter(choice => {\n const value = String(choice[key]);\n\n return isFuzzyMatch(value.toLowerCase(), normalizedSearchTerm)\n })\n .sort((a, b) => {\n const aValue = String(a[key]).toLowerCase();\n const bValue = String(b[key]).toLowerCase();\n\n if (aValue === normalizedSearchTerm) return -1;\n if (bValue === normalizedSearchTerm) return 1;\n\n if (aValue.startsWith(normalizedSearchTerm) && !bValue.startsWith(normalizedSearchTerm))\n return -1;\n if (!aValue.startsWith(normalizedSearchTerm) && bValue.startsWith(normalizedSearchTerm))\n return 1;\n\n return aValue.length - bValue.length;\n });\n};\n","<script lang=\"ts\" setup>\nimport { ref, computed, type StyleValue, onMounted } from 'vue';\nimport clickOutside from '@/directives/clickOutside';\nimport { fuzzySearch } from '@/utils/search';\nimport styles from './Dropdown.module.scss';\n\nconst vClickOutside = clickOutside;\n\ninterface MenuItem {\n text: string;\n value: string;\n}\n\ninterface DropdownProps {\n id: string;\n label?: string;\n defaultSelected?: string;\n menuHeight?: number;\n placeholder?: string;\n addable?: boolean;\n addButtonText?: string;\n searchable?: boolean;\n searchPlaceHolder?: string;\n items: MenuItem[];\n validateAddItem?: (item: string, items: MenuItem[]) => string | null;\n}\n\ninterface Emits {\n (e: 'add-error', error: string): void;\n (e: 'item-added', item: MenuItem): void;\n (e: 'select-item', item: MenuItem): void;\n}\n\nconst props = withDefaults(defineProps<DropdownProps>(), {\n menuHeight: 154,\n searchBar: false,\n addItem: false,\n defaultSelected: '',\n validateAddItem: () => null,\n});\n\nconst emit = defineEmits<Emits>();\nconst dropdownRef = ref<HTMLDivElement>();\nconst menuRef = ref<HTMLDivElement>();\nconst isOpen = ref(true);\nconst selectedItem = ref<MenuItem | null>(null);\nconst searchQuery = ref('');\nconst errorMessage = ref<string | null>(null);\nconst menuPosition = ref({ x: 0, y: 0, width: 0, shouldOpenUp: false, height: props.menuHeight });\nconst filteredItems = ref([...props.items]);\nconst allItems = ref([...props.items]);\n\nconst calculateMenuPosition = () => {\n if (!dropdownRef.value) {\n return;\n }\n\n const { offsetTop: top, offsetLeft: left, offsetWidth: width } = dropdownRef.value;\n const viewportHeight = window.innerHeight;\n const bottom = top + dropdownRef.value.offsetHeight;\n const shouldOpenUp = bottom + props.menuHeight > viewportHeight;\n\n menuPosition.value = {\n x: left + window.scrollX,\n y: shouldOpenUp ? top + window.scrollY : bottom + window.scrollY,\n width,\n shouldOpenUp,\n height: props.menuHeight,\n };\n};\n\nconst toggleMenu = () => {\n calculateMenuPosition();\n isOpen.value = !isOpen.value;\n};\n\nconst resetSettings = () => {\n errorMessage.value = null;\n searchQuery.value = '';\n filteredItems.value = [...allItems.value];\n};\n\nconst closeMenu = () => {\n isOpen.value = false;\n\n resetSettings();\n};\n\nconst selectItem = (item: MenuItem) => {\n selectedItem.value = item;\n searchQuery.value = '';\n\n closeMenu();\n\n emit('select-item', item);\n};\n\nconst addItem = () => {\n const query = searchQuery.value.trim();\n const error = props.validateAddItem(query, allItems.value);\n\n if (error) {\n errorMessage.value = error;\n\n emit('add-error', error);\n\n return;\n }\n\n const newItem: MenuItem = {\n text: query,\n value: query,\n };\n\n allItems.value.push(newItem);\n resetSettings();\n\n emit('item-added', newItem);\n};\n\nconst onSearch = () => {\n filteredItems.value = fuzzySearch<MenuItem>(allItems.value, 'text', searchQuery.value);\n};\n\nconst onFocusSearch = () => {\n errorMessage.value = '';\n};\n\nconst menuStyle = computed<Partial<StyleValue>>(() => ({\n top: menuPosition.value.shouldOpenUp ? `${menuPosition.value.y - 10}px` : `${menuPosition.value.y}px`,\n left: `${menuPosition.value.x}px`,\n width: `${menuPosition.value.width}px`,\n height: `${props.menuHeight}px`,\n}));\n\nonMounted(() => {\n calculateMenuPosition();\n\n if (props.defaultSelected) {\n const defaultItem = allItems.value.find(item => item.value === props.defaultSelected);\n\n if (defaultItem) {\n selectedItem.value = defaultItem;\n emit('select-item', defaultItem);\n }\n }\n});\n\nconst selectedValue = computed(() => (selectedItem.value ? selectedItem.value.text : ''));\n</script>\n\n<template>\n <div\n ref=\"dropdownRef\"\n :class=\"styles.dropdown\">\n <label\n v-if=\"label\"\n :class=\"styles.dropdown__label\"\n :for=\"id\">\n {{ label }}\n </label>\n <button\n :class=\"[\n styles.dropdown__valueContent, {\n [styles['dropdown__valueContent--open']]: isOpen,\n },\n ]\"\n @click=\"toggleMenu\">\n <span :class=\"styles.dropdown__value\">\n {{ selectedValue }}\n </span>\n <span\n v-if=\"placeholder && !selectedValue\"\n :class=\"styles.dropdown__placeholder\">\n {{ placeholder }}\n </span>\n <svg\n fill=\"none\"\n height=\"17\"\n viewBox=\"0 0 16 17\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n :class=\"styles.dropdown__arrowIcon\">\n <path\n d=\"M8 11.2021L4.5359 6.70215L11.4641 6.70215L8 11.2021Z\"\n fill=\"#91949F\" />\n </svg>\n </button>\n </div>\n\n <div\n v-if=\"isOpen\"\n ref=\"menuRef\"\n :class=\"styles.menu\"\n :style=\"menuStyle\"\n v-click-outside=\"{ handler: closeMenu, exclude: [dropdownRef, menuRef] }\"\n @click.prevent>\n <div\n v-if=\"props.searchable\"\n :class=\"styles.menu__searchContainer\">\n <div :class=\"styles.menu__searchInputWrap\">\n <input\n type=\"text\"\n :class=\"[\n styles.menu__searchInput, {\n [styles['menu__searchInput--error']]: errorMessage,\n },\n ]\"\n :placeholder=\"searchPlaceHolder\"\n v-model=\"searchQuery\"\n @focus=\"onFocusSearch\"\n @input=\"onSearch\">\n <p\n v-if=\"errorMessage\"\n :class=\"styles.menu__errorMessage\">\n {{ errorMessage }}\n </p>\n </div>\n <button\n v-if=\"props.addable\"\n :class=\"styles.menu__addButton\"\n @click=\"addItem\">\n {{ addButtonText }}\n </button>\n </div>\n <ul :class=\"styles.menu__itemContainer\">\n <li\n v-for=\"(item) in filteredItems\"\n :key=\"item.value\"\n :class=\"[\n styles.menu__item, {\n [styles['menu__item--active']]: selectedItem && item.value === selectedItem.value,\n },\n ]\"\n @click=\"selectItem(item)\">\n {{ item.text }}\n </li>\n </ul>\n </div>\n</template>\n","import { defineAsyncComponent } from 'vue';\n\nconst iconMap = {\n FilledErrorBox: defineAsyncComponent(() => import('./FilledErrorBox.vue')),\n LineCheck: defineAsyncComponent(() => import('./LineCheck.vue')),\n FilledCheckCircle: defineAsyncComponent(() => import('./FilledCheckCircle.vue')),\n LoadingCircle: defineAsyncComponent(() => import('./LoadingCircle.vue')),\n FilledInfoCircle: defineAsyncComponent(() => import('./FilledInfoCircle.vue')),\n SmartIcon: defineAsyncComponent(() => import('./SmartIcon.vue')),\n FilledCautionTriangle: defineAsyncComponent(() => import('./FilledCautionTriangle.vue')),\n};\n\nexport default iconMap;\n","<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport iconMap from '@/components/Icon/icons';\nimport type { IconNames } from '@/components/Icon/types';\n\ninterface IconProps {\n name: IconNames;\n size?: 16 | 24;\n color?: string;\n}\n\nconst props = withDefaults(defineProps<IconProps>(), {\n size: 16,\n});\n\nconst iconSize = computed(() => (typeof props.size === 'number' ? `${props.size}px` : props.size));\n</script>\n\n<template>\n <component\n :is=\"iconMap[name]\"\n class=\"icon\"\n :style=\"{ width: iconSize, height: iconSize, fill: props.color || 'currentColor' }\" />\n</template>\n\n<style scoped>\n.icon {\n display: inline-block;\n line-height: 0;\n vertical-align: middle;\n}\n</style>\n","<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport Icon from '@/components/Icon/Icon.vue';\nimport type { IconNames } from '@/components/Icon/types';\nimport styles from './OnPageMessage.module.scss';\n\ninterface OnPageMessageProps {\n variant?: 'default' | 'warning' | 'alert' | 'success';\n text: string;\n}\n\nconst props = withDefaults(defineProps<OnPageMessageProps>(), {\n variant: 'default',\n});\n\nconst IconName = computed<IconNames>(() => {\n switch (props.variant) {\n case 'alert': return 'FilledErrorBox';\n case 'warning': return 'FilledCautionTriangle';\n case 'success': return 'FilledCheckCircle';\n\n default: return 'FilledInfoCircle';\n }\n});\n</script>\n\n<template>\n <div\n :class=\"[\n styles.container,\n styles[`container__${variant}`],\n ]\">\n <Icon\n :name=\"IconName\"\n :size=\"24\" />\n <span :class=\"styles.container__text\">{{ text }}</span>\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport { ref } from 'vue';\nimport type { IconNames } from '@/components/Icon/types';\nimport { Icon } from '@/index';\nimport styles from './SegmentButton.module.scss';\n\ninterface SegmentType {\n value: string;\n label: string;\n disabled?: boolean;\n icon?: IconNames;\n}\n\ninterface SegmentButtonProps {\n color: 'primary' | 'secondary' | 'danger' | 'warning' | 'smart';\n size?: 'default' | 'small';\n align?: 'vertical' | 'horizontal';\n disabled?: boolean;\n segments: SegmentType[];\n fill?: boolean;\n}\n\nconst props = withDefaults(defineProps<SegmentButtonProps>(), {\n loadingStatus: false,\n successStatus: false,\n disabled: false,\n size: 'default',\n align: 'horizontal',\n});\n\nconst emit = defineEmits<{\n click: [event: SegmentType['value']];\n}>();\n\nconst selected = ref<string>('');\n\nconst setSelect = (segment: SegmentType) => {\n if (props.disabled || segment.disabled) {\n return;\n }\n\n selected.value = segment.value;\n\n emit('click', segment.value);\n};\n</script>\n\n<template>\n <div\n :class=\"[\n styles.segmentGroup,\n styles[`segmentGroup--${align}`],\n { [styles.fill]: fill },\n ]\">\n <button\n v-for=\"segment in segments\"\n :key=\"segment.value\"\n :class=\"[\n styles.button,\n styles[`button--${color}`],\n styles[`button__size_${size}`],\n styles.fill,\n {\n [styles[`button--selected`]]: segment.value === selected,\n },\n ]\"\n :disabled=\"segment.disabled || props.disabled\"\n @click=\"setSelect(segment)\">\n <Icon\n v-if=\"segment.icon\"\n :name=\"segment.icon\" />\n <span\n v-if=\"segment.label\"\n :class=\"styles.button__label\">\n {{ segment.label }}\n </span>\n </button>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted, ref } from 'vue';\nimport styles from './TextInput.module.scss';\n\nexport interface Props {\n id: string;\n name: string;\n modelValue: string | number;\n label?: string;\n placeholder?: string;\n maxLength?: number;\n maxHeight?: number;\n error?: string;\n multiline?: boolean;\n autoGrow?: boolean;\n counter?: boolean;\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n label: '',\n placeholder: '',\n maxLength: undefined,\n maxHeight: undefined,\n error: '',\n multiline: false,\n autoGrow: false,\n});\n\nconst emit = defineEmits<{\n input: [event: Event];\n change: [event: Event];\n paste: [event: ClipboardEvent];\n focus: [event: FocusEvent];\n blur: [event: FocusEvent];\n}>();\n\nconst textareaRef = ref<HTMLTextAreaElement | null>(null);\n\nconst autoGrow = () => {\n if (props.autoGrow && textareaRef.value) {\n textareaRef.value.style.height = '';\n\n const newHeight = Math.min(textareaRef.value.scrollHeight, props.maxHeight || textareaRef.value.scrollHeight);\n\n textareaRef.value.style.height = `${newHeight}px`;\n }\n};\n\nconst handleInput = (event: Event) => {\n emit('input', event);\n\n autoGrow();\n};\n\nonMounted(() => {\n autoGrow();\n});\n</script>\n\n<template>\n <div :class=\"styles.wrapper\">\n <label\n v-if=\"label\"\n :class=\"styles.wrapper__label\"\n :for=\"id\">\n {{ label }}\n </label>\n <template v-if=\"multiline\">\n <textarea\n :id=\"id\"\n ref=\"textareaRef\"\n :class=\"[\n styles.wrapper__field, {\n [styles['wrapper--error']]: error,\n },\n ]\"\n :maxlength=\"maxLength\"\n :name=\"name\"\n :placeholder=\"placeholder\"\n :style=\"maxHeight ? { maxHeight: `${maxHeight}px` } : undefined\"\n :value=\"modelValue\"\n @blur=\"emit('blur', $event)\"\n @change=\"$emit('change', $event)\"\n @focus=\"emit('focus', $event)\"\n @input=\"handleInput\"\n @paste=\"emit('paste', $event)\" />\n </template>\n <template v-else>\n <input\n :id=\"id\"\n type=\"text\"\n :class=\"[\n styles.wrapper__field, {\n [styles['wrapper--error']]: error,\n },\n ]\"\n :maxlength=\"maxLength\"\n :name=\"name\"\n :placeholder=\"placeholder\"\n :value=\"modelValue\"\n @blur=\"emit('blur', $event)\"\n @change=\"$emit('change', $event)\"\n @focus=\"emit('focus', $event)\"\n @input=\"handleInput\"\n @paste=\"emit('paste', $event)\">\n </template>\n\n <div :class=\"styles.wrapper__bottom\">\n <div\n v-if=\"error\"\n :class=\"styles.wrapper__errorMessage\">\n {{ error }}\n </div>\n <div\n v-if=\"counter\"\n :class=\"styles.wrapper__counter\">\n {{ modelValue?.toString().length || 0 }}\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","emit","__emit","onClick","event","leftIcon","computed","clickOutside","el","binding","element","isFuzzyMatch","choiceValue","searchTerm","searchIndex","char","_a","fuzzySearch","choices","key","normalizedSearchTerm","choice","value","b","aValue","bValue","vClickOutside","dropdownRef","ref","menuRef","isOpen","selectedItem","searchQuery","errorMessage","menuPosition","filteredItems","allItems","calculateMenuPosition","top","left","width","viewportHeight","bottom","shouldOpenUp","toggleMenu","resetSettings","closeMenu","selectItem","item","addItem","query","error","newItem","onSearch","onFocusSearch","menuStyle","onMounted","defaultItem","selectedValue","iconMap","defineAsyncComponent","iconSize","IconName","selected","setSelect","segment","textareaRef","autoGrow","newHeight","handleInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,UAAMA,IAAQC,GAQRC,IAAOC,GAIPC,IAAU,CAACC,MAAsB;AACnC,MAAIL,EAAM,YAIVE,EAAK,SAASG,CAAK;AAAA,IACvB,GAEMC,IAAWC,EAAgC,MACzCP,EAAM,gBACC,kBACAA,EAAM,gBACN,cAGJA,EAAM,YAChB;;;;;;;;;;;;;;;;;;;;;;;;;;ICzCcQ,KAAA;AAAA,EACX,QAAQC,GAAyBC,GAA6E;AACvG,IAAAD,EAAA,oBAAoB,CAACJ,MAAiB;AAKrC,MAJsB,CAACI,GAAI,GAAIC,EAAQ,MAAM,WAAW,EAAG,EAAE,KAAK,CAAWC,MAClEA,MAAYA,MAAYN,EAAM,UAAUM,EAAQ,SAASN,EAAM,MAAc,EACvF,KAGGK,EAAQ,MAAM,QAAQ;AAAA,IAE9B,GAES,SAAA,iBAAiB,SAASD,EAAG,iBAAiB;AAAA,EAC3D;AAAA,EACA,UAAUA,GAAyB;AAC/B,IAAIA,EAAG,qBACM,SAAA,oBAAoB,SAASA,EAAG,iBAAiB;AAAA,EAC9D;AAER,GCzBMG,KAAe,CAACC,GAAqBC,MAAgC;;AACvE,MAAIC,IAAc;AAClB,aAAWC,KAAQH;AAIX,QAHAG,EAAK,YAAY,QAAMC,IAAAH,EAAWC,CAAW,MAAtB,gBAAAE,EAAyB,kBAChDF,KAEAA,MAAgBD,EAAW;AACpB,aAAA;AAGR,SAAA;AACX,GAGaI,KAAc,CACvBC,GACAC,GACAN,MACM;AACF,MAAA,CAACA,EAAW;AACL,WAAAK;AAGL,QAAAE,IAAuBP,EAAW,YAAY;AAE7C,SAAAK,EACF,OAAO,CAAUG,MAAA;AACd,UAAMC,IAAQ,OAA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