@fiscozen/input 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/input.js +206 -207
- package/dist/input.umd.cjs +1 -1
- package/dist/src/FzCurrencyInput.vue.d.ts +2 -0
- package/dist/src/types.d.ts +6 -0
- package/dist/src/useInputStyle.d.ts +0 -1
- package/package.json +6 -6
- package/src/FzInput.vue +14 -16
- package/src/__tests__/FzInput.spec.ts +94 -15
- package/src/types.ts +6 -0
- package/src/useInputStyle.ts +3 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/coverage/FzCurrencyInput.vue.html +0 -640
- package/coverage/FzInput.vue.html +0 -709
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -494
- package/coverage/coverage-final.json +0 -4
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -146
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/useInputStyle.ts.html +0 -343
package/dist/input.js
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createSlots as a, createVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, normalizeClass as u,
|
|
1
|
+
import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createSlots as a, createVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, normalizeClass as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, toRefs as g, unref as _, useAttrs as v, useModel as y, useSlots as b, vModelDynamic as x, watch as S, withCtx as C, withDirectives as ee, withModifiers as w } from "vue";
|
|
2
2
|
import { FzAlert as T } from "@fiscozen/alert";
|
|
3
3
|
import { FzIcon as E } from "@fiscozen/icons";
|
|
4
4
|
import { FzIconButton as D } from "@fiscozen/button";
|
|
5
5
|
import { clamp as O, format as k, parse as A, roundTo as j, truncateDecimals as M } from "@fiscozen/composables";
|
|
6
6
|
//#region src/useInputStyle.ts
|
|
7
7
|
function N(t, n, r, i, a) {
|
|
8
|
-
let o =
|
|
8
|
+
let o = {
|
|
9
9
|
backoffice: "h-32",
|
|
10
10
|
frontoffice: "h-44"
|
|
11
|
-
},
|
|
11
|
+
}, s = e(() => {
|
|
12
12
|
let e = i.value;
|
|
13
|
-
return [t.variant?.value === "normal" ?
|
|
14
|
-
}),
|
|
13
|
+
return [t.variant?.value === "normal" ? o[e] : o.frontoffice, v()];
|
|
14
|
+
}), c = e(() => ["font-normal text-base mb-0", t.disabled?.value || t.readonly?.value ? "text-grey-300" : "text-grey-500"]), l = {
|
|
15
15
|
backoffice: "text-base",
|
|
16
16
|
frontoffice: "text-base"
|
|
17
|
-
},
|
|
17
|
+
}, u = e(() => t.variant?.value === "floating-label" ? !r.value && !a.value : !0), d = e(() => {
|
|
18
18
|
let e = i.value;
|
|
19
|
-
return t.variant?.value === "floating-label" ? [
|
|
20
|
-
}),
|
|
19
|
+
return t.variant?.value === "floating-label" ? [l[e]] : [];
|
|
20
|
+
}), f = e(() => ["font-normal text-base", t.disabled?.value || t.readonly?.value ? "text-grey-300" : "text-grey-500"]), p = e(() => ["font-normal text-base", t.disabled?.value || t.readonly?.value ? "text-grey-300" : "text-core-black"]), m = (e) => !!e.error?.value, h = (e) => !!e.disabled?.value || !!e.readonly?.value, g = (e) => !!e.highlighted?.value, _ = (e) => !!e.aiReasoning?.value, v = () => {
|
|
21
21
|
switch (!0) {
|
|
22
|
-
case
|
|
23
|
-
case
|
|
24
|
-
case
|
|
25
|
-
case
|
|
22
|
+
case m(t): return "border-semantic-error-200 has-[:focus]:border-semantic-error-300 bg-core-white text-core-black cursor-text";
|
|
23
|
+
case h(t): return "bg-grey-100 border-grey-100 text-grey-300 cursor-not-allowed";
|
|
24
|
+
case g(t): return "bg-semantic-warning-50 border-semantic-warning-200 ring-2 ring-semantic-warning-100 text-core-black cursor-text";
|
|
25
|
+
case _(t): return "bg-purple-50 border-purple-600 ring-2 ring-purple-200 text-core-black cursor-text";
|
|
26
26
|
default: return "border-grey-200 has-[:focus]:border-blue-600 bg-core-white text-core-black cursor-text";
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
return {
|
|
30
|
-
staticContainerClass: "flex justify-between w-full items-center pl-[10px] pr-[10px] rounded border-1 gap-8 text-left relative outline-none",
|
|
31
|
-
computedContainerClass:
|
|
32
|
-
computedLabelClass:
|
|
33
|
-
staticInputClass: "peer w-full bg-transparent border-0 outline-none focus:outline-none cursor-[inherit] focus:ring-0 truncate placeholder:text-grey-300 font-normal text-base",
|
|
34
|
-
computedInputClass:
|
|
35
|
-
computedHelpClass:
|
|
36
|
-
computedErrorClass:
|
|
37
|
-
|
|
38
|
-
showNormalPlaceholder: d
|
|
30
|
+
staticContainerClass: "flex justify-between w-full items-center pl-[10px] pr-[10px] rounded border-1 border-solid gap-8 text-left relative outline-none",
|
|
31
|
+
computedContainerClass: s,
|
|
32
|
+
computedLabelClass: c,
|
|
33
|
+
staticInputClass: "peer w-full bg-transparent border-0 outline-none focus:outline-none cursor-[inherit] focus:ring-0 truncate placeholder:text-grey-300 disabled:text-grey-300 read-only:text-grey-300 font-normal text-base",
|
|
34
|
+
computedInputClass: d,
|
|
35
|
+
computedHelpClass: f,
|
|
36
|
+
computedErrorClass: p,
|
|
37
|
+
showNormalPlaceholder: u
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
40
|
//#endregion
|
|
@@ -48,12 +47,12 @@ var P = {
|
|
|
48
47
|
function I(e) {
|
|
49
48
|
return `${e}-${Date.now() - 16e11}-${++F}`;
|
|
50
49
|
}
|
|
51
|
-
function
|
|
50
|
+
function L() {
|
|
52
51
|
return I("fz-input");
|
|
53
52
|
}
|
|
54
53
|
//#endregion
|
|
55
54
|
//#region src/FzInput.vue?vue&type=script&setup=true&lang.ts
|
|
56
|
-
var
|
|
55
|
+
var te = ["id", "for"], ne = ["tabindex"], re = { class: "flex flex-col justify-around min-w-0 grow" }, ie = {
|
|
57
56
|
key: 0,
|
|
58
57
|
class: "text-xs text-grey-300 grow-0 overflow-hidden text-ellipsis whitespace-nowrap"
|
|
59
58
|
}, R = [
|
|
@@ -62,7 +61,6 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
62
61
|
"disabled",
|
|
63
62
|
"readonly",
|
|
64
63
|
"placeholder",
|
|
65
|
-
"id",
|
|
66
64
|
"pattern",
|
|
67
65
|
"name",
|
|
68
66
|
"maxlength",
|
|
@@ -72,11 +70,13 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
72
70
|
"aria-disabled",
|
|
73
71
|
"aria-labelledby",
|
|
74
72
|
"aria-describedby",
|
|
75
|
-
"aria-description"
|
|
73
|
+
"aria-description",
|
|
74
|
+
"id"
|
|
76
75
|
], z = { class: "flex items-center gap-4" }, B = ["id"], V = /* @__PURE__ */ s({
|
|
77
76
|
inheritAttrs: !1,
|
|
78
77
|
__name: "FzInput",
|
|
79
78
|
props: /* @__PURE__ */ c({
|
|
79
|
+
id: {},
|
|
80
80
|
label: {},
|
|
81
81
|
environment: { default: "frontoffice" },
|
|
82
82
|
size: {},
|
|
@@ -150,77 +150,77 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
150
150
|
"fzinput:clear"
|
|
151
151
|
], ["update:modelValue"]),
|
|
152
152
|
setup(a, { expose: o, emit: s }) {
|
|
153
|
-
let c = a,
|
|
154
|
-
...
|
|
155
|
-
|
|
156
|
-
})
|
|
157
|
-
|
|
153
|
+
let c = a, d = v(), O = e(() => {
|
|
154
|
+
let { class: e, id: t, ...n } = d;
|
|
155
|
+
return n;
|
|
156
|
+
}), k = e(() => d.class);
|
|
157
|
+
S(() => c.size, (e) => {
|
|
158
158
|
if (e !== void 0) {
|
|
159
159
|
let t = P[e];
|
|
160
160
|
c.environment && c.environment !== t ? console.warn(`[FzInput] Both "size" and "environment" props are provided. "environment=${c.environment}" will be used and "size=${e}" will be ignored. Please remove the deprecated "size" prop.`) : console.warn(`[FzInput] The "size" prop is deprecated and will be removed in a future version. Please use environment="${t}" instead of size="${e}".`);
|
|
161
161
|
}
|
|
162
|
-
}, { immediate: !0 }),
|
|
162
|
+
}, { immediate: !0 }), S(() => c.rightIconSize, (e) => {
|
|
163
163
|
e !== void 0 && console.warn(`[FzInput] The "rightIconSize" prop is deprecated and will be removed in a future version. Icons now have a fixed size of "md". The provided value "${e}" will be ignored.`);
|
|
164
164
|
}, { immediate: !0 });
|
|
165
|
-
let A = e(() => c.environment ? c.environment : c.size ? P[c.size] : "frontoffice"), j =
|
|
166
|
-
|
|
167
|
-
H.value = e;
|
|
168
|
-
}), x(() => c.aiReasoning, (e) => {
|
|
165
|
+
let A = e(() => c.environment ? c.environment : c.size ? P[c.size] : "frontoffice"), j = y(a, "modelValue"), M = p(null), F = p(null), I = L(), V = e(() => c.id || I), H = p(!1), U = p(c.highlighted), W = p(c.aiReasoning);
|
|
166
|
+
S(() => c.highlighted, (e) => {
|
|
169
167
|
U.value = e;
|
|
168
|
+
}), S(() => c.aiReasoning, (e) => {
|
|
169
|
+
W.value = e;
|
|
170
170
|
});
|
|
171
|
-
let
|
|
172
|
-
c.disableEmphasisReset || (
|
|
173
|
-
}, { staticContainerClass: oe, computedContainerClass: se, computedLabelClass: ce, staticInputClass: le, computedInputClass: ue, computedHelpClass: de,
|
|
174
|
-
...
|
|
175
|
-
highlighted:
|
|
176
|
-
aiReasoning:
|
|
177
|
-
}, M, j, A,
|
|
171
|
+
let ae = () => {
|
|
172
|
+
c.disableEmphasisReset || (U.value && (U.value = !1, q("update:highlighted", !1)), W.value && (W.value = !1, q("update:aiReasoning", !1)));
|
|
173
|
+
}, { staticContainerClass: oe, computedContainerClass: se, computedLabelClass: ce, staticInputClass: le, computedInputClass: ue, computedHelpClass: de, showNormalPlaceholder: G } = N({
|
|
174
|
+
...g(c),
|
|
175
|
+
highlighted: U,
|
|
176
|
+
aiReasoning: W
|
|
177
|
+
}, M, j, A, H);
|
|
178
178
|
b();
|
|
179
|
-
let
|
|
180
|
-
let e = !!c.label, t = !!
|
|
181
|
-
if (e && !t) return `${
|
|
179
|
+
let K = b(), fe = e(() => {
|
|
180
|
+
let e = !!c.label, t = !!K.label;
|
|
181
|
+
if (e && !t) return `${V.value}-label`;
|
|
182
182
|
}), pe = e(() => {
|
|
183
183
|
let e = [];
|
|
184
|
-
return c.error &&
|
|
185
|
-
}),
|
|
184
|
+
return c.error && K.errorMessage && e.push(`${V.value}-error`), !c.error && K.helpText && e.push(`${V.value}-help`), e.length > 0 ? e.join(" ") : void 0;
|
|
185
|
+
}), q = s, me = () => {
|
|
186
186
|
!c.disabled && !c.readonly && F.value && F.value.focus();
|
|
187
187
|
}, he = (e) => {
|
|
188
188
|
(e.key === "Enter" || e.key === " ") && (e.target === e.currentTarget || e.target === M.value) && (e.preventDefault(), me());
|
|
189
|
-
},
|
|
190
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), Z.value ||
|
|
189
|
+
}, J = (e, t) => {
|
|
190
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), Z.value || q(t === "fzinput:left-icon-click" ? "fzinput:left-icon-click" : t === "fzinput:right-icon-click" ? "fzinput:right-icon-click" : "fzinput:second-right-icon-click"));
|
|
191
191
|
}, ge = () => {
|
|
192
|
-
Z.value ||
|
|
192
|
+
Z.value || q("fzinput:left-icon-click");
|
|
193
193
|
}, _e = () => {
|
|
194
|
-
Z.value ||
|
|
195
|
-
},
|
|
196
|
-
Z.value ||
|
|
197
|
-
},
|
|
194
|
+
Z.value || q("fzinput:right-icon-click");
|
|
195
|
+
}, Y = () => {
|
|
196
|
+
Z.value || q("fzinput:second-right-icon-click");
|
|
197
|
+
}, ve = e(() => !!c.leftIcon), X = e(() => ve.value && !!c.leftIconAriaLabel), Z = e(() => !!c.disabled || !!c.readonly), ye = e(() => Z.value || c.error ? "text-grey-300" : "text-purple-600"), be = e(() => {
|
|
198
198
|
if (!(Z.value || c.error)) {
|
|
199
|
-
if (
|
|
200
|
-
if (
|
|
199
|
+
if (U.value) return c.highlightedDescription;
|
|
200
|
+
if (W.value) return c.aiReasoningDescription;
|
|
201
201
|
}
|
|
202
|
-
}),
|
|
203
|
-
j.value = "",
|
|
202
|
+
}), xe = e(() => !!c.rightIcon && !c.rightIconButton), Q = e(() => xe.value && !!c.rightIconAriaLabel), Se = e(() => !!c.secondRightIcon && !c.secondRightIconButton), $ = e(() => Se.value && !!c.secondRightIconAriaLabel), Ce = e(() => c.clearable && !!j.value && !Z.value), we = () => {
|
|
203
|
+
j.value = "", q("fzinput:clear"), F.value?.focus();
|
|
204
204
|
};
|
|
205
205
|
return o({
|
|
206
206
|
inputRef: F,
|
|
207
207
|
containerRef: M
|
|
208
|
-
}), (e, o) => (
|
|
209
|
-
|
|
208
|
+
}), (e, o) => (f(), r("div", { class: u(["fz-input text-core-black w-full flex flex-col gap-8", k.value]) }, [
|
|
209
|
+
m(e.$slots, "label", {}, () => [a.label ? (f(), r("label", {
|
|
210
210
|
key: 0,
|
|
211
|
-
id: `${
|
|
212
|
-
class: u(
|
|
213
|
-
for:
|
|
214
|
-
},
|
|
211
|
+
id: `${V.value}-label`,
|
|
212
|
+
class: u(_(ce)),
|
|
213
|
+
for: V.value
|
|
214
|
+
}, h(a.label) + h(a.required ? " *" : ""), 11, te)) : n("", !0)]),
|
|
215
215
|
i("div", {
|
|
216
|
-
class: u([
|
|
216
|
+
class: u([_(oe), _(se)]),
|
|
217
217
|
ref_key: "containerRef",
|
|
218
218
|
ref: M,
|
|
219
219
|
tabindex: Z.value ? void 0 : 0,
|
|
220
220
|
onClick: me,
|
|
221
221
|
onKeydown: he
|
|
222
222
|
}, [
|
|
223
|
-
|
|
223
|
+
m(e.$slots, "left-icon", {}, () => [a.leftIcon ? (f(), t(_(E), {
|
|
224
224
|
key: 0,
|
|
225
225
|
name: a.leftIcon,
|
|
226
226
|
size: "md",
|
|
@@ -231,7 +231,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
231
231
|
tabindex: X.value && !Z.value ? 0 : void 0,
|
|
232
232
|
class: u(a.leftIconClass),
|
|
233
233
|
onClick: w(ge, ["stop"]),
|
|
234
|
-
onKeydown: o[0] ||= (e) => X.value ? (e) =>
|
|
234
|
+
onKeydown: o[0] ||= (e) => X.value ? (e) => J(e, "fzinput:left-icon-click") : void 0
|
|
235
235
|
}, null, 8, [
|
|
236
236
|
"name",
|
|
237
237
|
"variant",
|
|
@@ -240,25 +240,24 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
240
240
|
"aria-disabled",
|
|
241
241
|
"tabindex",
|
|
242
242
|
"class"
|
|
243
|
-
])) :
|
|
243
|
+
])) : W.value && !U.value ? (f(), t(_(E), {
|
|
244
244
|
key: 1,
|
|
245
245
|
name: "sparkles",
|
|
246
246
|
variant: "fas",
|
|
247
247
|
size: "md",
|
|
248
248
|
"aria-hidden": "true",
|
|
249
|
-
class: u(
|
|
249
|
+
class: u(ye.value)
|
|
250
250
|
}, null, 8, ["class"])) : n("", !0)]),
|
|
251
|
-
i("div",
|
|
251
|
+
i("div", re, [_(G) ? n("", !0) : (f(), r("span", ie, h(a.placeholder), 1)), ee(i("input", l({
|
|
252
252
|
type: a.type,
|
|
253
253
|
required: a.required,
|
|
254
254
|
disabled: a.disabled,
|
|
255
255
|
readonly: a.readonly,
|
|
256
|
-
placeholder:
|
|
256
|
+
placeholder: _(G) ? a.placeholder : "",
|
|
257
257
|
"onUpdate:modelValue": o[1] ||= (e) => j.value = e,
|
|
258
|
-
id: v(I),
|
|
259
258
|
ref_key: "inputRef",
|
|
260
259
|
ref: F,
|
|
261
|
-
class: [
|
|
260
|
+
class: [_(le), _(ue)],
|
|
262
261
|
pattern: a.pattern,
|
|
263
262
|
name: a.name,
|
|
264
263
|
maxlength: a.maxlength,
|
|
@@ -268,25 +267,26 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
268
267
|
"aria-disabled": Z.value ? "true" : "false",
|
|
269
268
|
"aria-labelledby": fe.value,
|
|
270
269
|
"aria-describedby": pe.value,
|
|
271
|
-
"aria-description":
|
|
270
|
+
"aria-description": be.value
|
|
272
271
|
}, O.value, {
|
|
273
|
-
|
|
272
|
+
id: V.value,
|
|
273
|
+
onInput: ae,
|
|
274
274
|
onBlur: o[2] ||= (t) => {
|
|
275
|
-
|
|
275
|
+
H.value = !1, e.$emit("blur", t);
|
|
276
276
|
},
|
|
277
277
|
onFocus: o[3] ||= (t) => {
|
|
278
|
-
|
|
278
|
+
H.value = !0, e.$emit("focus", t);
|
|
279
279
|
}
|
|
280
|
-
}), null, 16, R), [[
|
|
281
|
-
i("div", z, [
|
|
280
|
+
}), null, 16, R), [[x, j.value]])]),
|
|
281
|
+
i("div", z, [Ce.value ? (f(), t(_(D), {
|
|
282
282
|
key: 0,
|
|
283
283
|
iconName: "xmark",
|
|
284
284
|
size: "md",
|
|
285
285
|
variant: "invisible",
|
|
286
286
|
ariaLabel: a.clearAriaLabel,
|
|
287
|
-
onClick: w(
|
|
288
|
-
}, null, 8, ["ariaLabel"])) : n("", !0),
|
|
289
|
-
a.secondRightIcon && !a.secondRightIconButton ? (
|
|
287
|
+
onClick: w(we, ["stop"])
|
|
288
|
+
}, null, 8, ["ariaLabel"])) : n("", !0), m(e.$slots, "right-icon", {}, () => [
|
|
289
|
+
a.secondRightIcon && !a.secondRightIconButton ? (f(), t(_(E), {
|
|
290
290
|
key: 0,
|
|
291
291
|
name: a.secondRightIcon,
|
|
292
292
|
size: "md",
|
|
@@ -296,8 +296,8 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
296
296
|
"aria-disabled": $.value && Z.value ? "true" : void 0,
|
|
297
297
|
tabindex: $.value && !Z.value ? 0 : void 0,
|
|
298
298
|
class: u(a.secondRightIconClass),
|
|
299
|
-
onClick: w(
|
|
300
|
-
onKeydown: o[4] ||= (e) => $.value ? (e) =>
|
|
299
|
+
onClick: w(Y, ["stop"]),
|
|
300
|
+
onKeydown: o[4] ||= (e) => $.value ? (e) => J(e, "fzinput:second-right-icon-click") : void 0
|
|
301
301
|
}, null, 8, [
|
|
302
302
|
"name",
|
|
303
303
|
"variant",
|
|
@@ -307,13 +307,13 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
307
307
|
"tabindex",
|
|
308
308
|
"class"
|
|
309
309
|
])) : n("", !0),
|
|
310
|
-
a.secondRightIcon && a.secondRightIconButton ? (
|
|
310
|
+
a.secondRightIcon && a.secondRightIconButton ? (f(), t(_(D), {
|
|
311
311
|
key: 1,
|
|
312
312
|
iconName: a.secondRightIcon,
|
|
313
313
|
size: "md",
|
|
314
314
|
iconVariant: a.secondRightIconVariant,
|
|
315
315
|
variant: Z.value ? "invisible" : a.secondRightIconButtonVariant,
|
|
316
|
-
onClick: w(
|
|
316
|
+
onClick: w(Y, ["stop"]),
|
|
317
317
|
class: u([{ "bg-grey-100 !text-grey-300": Z.value }, a.secondRightIconClass])
|
|
318
318
|
}, null, 8, [
|
|
319
319
|
"iconName",
|
|
@@ -321,7 +321,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
321
321
|
"variant",
|
|
322
322
|
"class"
|
|
323
323
|
])) : n("", !0),
|
|
324
|
-
a.rightIcon && !a.rightIconButton ? (
|
|
324
|
+
a.rightIcon && !a.rightIconButton ? (f(), t(_(E), {
|
|
325
325
|
key: 2,
|
|
326
326
|
name: a.rightIcon,
|
|
327
327
|
size: "md",
|
|
@@ -332,7 +332,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
332
332
|
tabindex: Q.value && !Z.value ? 0 : void 0,
|
|
333
333
|
class: u(a.rightIconClass),
|
|
334
334
|
onClick: w(_e, ["stop"]),
|
|
335
|
-
onKeydown: o[5] ||= (e) => Q.value ? (e) =>
|
|
335
|
+
onKeydown: o[5] ||= (e) => Q.value ? (e) => J(e, "fzinput:right-icon-click") : void 0
|
|
336
336
|
}, null, 8, [
|
|
337
337
|
"name",
|
|
338
338
|
"variant",
|
|
@@ -342,7 +342,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
342
342
|
"tabindex",
|
|
343
343
|
"class"
|
|
344
344
|
])) : n("", !0),
|
|
345
|
-
a.rightIcon && a.rightIconButton ? (
|
|
345
|
+
a.rightIcon && a.rightIconButton ? (f(), t(_(D), {
|
|
346
346
|
key: 3,
|
|
347
347
|
iconName: a.rightIcon,
|
|
348
348
|
size: "md",
|
|
@@ -356,7 +356,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
356
356
|
"variant",
|
|
357
357
|
"class"
|
|
358
358
|
])) : n("", !0),
|
|
359
|
-
a.valid ? (
|
|
359
|
+
a.valid ? (f(), t(_(E), {
|
|
360
360
|
key: 4,
|
|
361
361
|
name: "check",
|
|
362
362
|
size: "md",
|
|
@@ -364,23 +364,21 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
364
364
|
"aria-hidden": "true"
|
|
365
365
|
})) : n("", !0)
|
|
366
366
|
])])
|
|
367
|
-
], 42,
|
|
368
|
-
a.error && e.$slots.errorMessage ? (
|
|
367
|
+
], 42, ne),
|
|
368
|
+
a.error && e.$slots.errorMessage ? (f(), t(_(T), {
|
|
369
369
|
key: 0,
|
|
370
|
-
id: `${
|
|
370
|
+
id: `${V.value}-error`,
|
|
371
371
|
role: "alert",
|
|
372
372
|
tone: "error",
|
|
373
|
-
variant: "text"
|
|
374
|
-
style: d({ width: v(G) })
|
|
373
|
+
variant: "text"
|
|
375
374
|
}, {
|
|
376
|
-
default:
|
|
375
|
+
default: C(() => [m(e.$slots, "errorMessage")]),
|
|
377
376
|
_: 3
|
|
378
|
-
}, 8, ["id"
|
|
377
|
+
}, 8, ["id"])) : e.$slots.helpText ? (f(), r("span", {
|
|
379
378
|
key: 1,
|
|
380
|
-
id: `${
|
|
381
|
-
class: u([
|
|
382
|
-
|
|
383
|
-
}, [h(e.$slots, "helpText")], 14, B)) : n("", !0)
|
|
379
|
+
id: `${V.value}-help`,
|
|
380
|
+
class: u([_(de)])
|
|
381
|
+
}, [m(e.$slots, "helpText")], 10, B)) : n("", !0)
|
|
384
382
|
], 2));
|
|
385
383
|
}
|
|
386
384
|
}), H = { class: "flex items-center gap-4" }, U = { class: "flex flex-col justify-between items-center" }, W = /* @__PURE__ */ s({
|
|
@@ -397,6 +395,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
397
395
|
forceStep: { type: Boolean },
|
|
398
396
|
stepUpAriaLabel: {},
|
|
399
397
|
stepDownAriaLabel: {},
|
|
398
|
+
id: {},
|
|
400
399
|
label: {},
|
|
401
400
|
environment: {},
|
|
402
401
|
size: {},
|
|
@@ -429,15 +428,15 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
429
428
|
}),
|
|
430
429
|
emits: /* @__PURE__ */ c(["fzcurrencyinput:clear"], ["update:modelValue"]),
|
|
431
430
|
setup(r, { expose: s, emit: c }) {
|
|
432
|
-
let u =
|
|
433
|
-
if (
|
|
434
|
-
if (
|
|
435
|
-
},
|
|
436
|
-
minimumFractionDigits:
|
|
437
|
-
maximumFractionDigits:
|
|
431
|
+
let u = p(), h = p(), g = e(() => u.value?.containerRef), v = e(() => u.value?.inputRef), b = p(!1), x = r, ee = c, w = y(r, "modelValue"), T = !1, D = () => {
|
|
432
|
+
if (x.nullOnEmpty) return null;
|
|
433
|
+
if (x.zeroOnEmpty) return 0;
|
|
434
|
+
}, N = (e, t) => e ? t ? "" : k(0, {
|
|
435
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
436
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
438
437
|
roundDecimals: !1,
|
|
439
438
|
useGrouping: !0
|
|
440
|
-
}) : "",
|
|
439
|
+
}) : "", P = e(() => x.stepUpAriaLabel ? x.stepUpAriaLabel : `Incrementa di ${x.step}`), F = e(() => x.stepDownAriaLabel ? x.stepDownAriaLabel : `Decrementa di ${x.step}`), I = e(() => x.readonly || x.disabled), L = (e) => {
|
|
441
440
|
let t = e.replace(/[^0-9.,-]/g, ""), n = t.startsWith("-");
|
|
442
441
|
t = t.replace(/-/g, ""), t = t.replace(/\./g, ",");
|
|
443
442
|
let r = t.indexOf(",");
|
|
@@ -446,7 +445,7 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
446
445
|
t = e + "," + n;
|
|
447
446
|
}
|
|
448
447
|
return n ? "-" + t : t;
|
|
449
|
-
},
|
|
448
|
+
}, te = (e) => {
|
|
450
449
|
if (!(e.ctrlKey || e.metaKey || e.altKey || [
|
|
451
450
|
"Backspace",
|
|
452
451
|
"Delete",
|
|
@@ -466,56 +465,56 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
466
465
|
}
|
|
467
466
|
/^[0-9.,]$/.test(e.key) || e.preventDefault();
|
|
468
467
|
}
|
|
469
|
-
},
|
|
470
|
-
if (
|
|
468
|
+
}, ne = (e) => {
|
|
469
|
+
if (x.readonly || x.disabled) return;
|
|
471
470
|
e.preventDefault();
|
|
472
471
|
let t = e.clipboardData?.getData("text") || "";
|
|
473
472
|
if (!t) return;
|
|
474
473
|
let n = A(t);
|
|
475
474
|
if (!isNaN(n) && isFinite(n)) {
|
|
476
|
-
let e = M(n,
|
|
477
|
-
|
|
475
|
+
let e = M(n, x.maximumFractionDigits);
|
|
476
|
+
T = !0, w.value = e, T = !1, h.value = L(String(e));
|
|
478
477
|
}
|
|
479
|
-
},
|
|
478
|
+
}, re = (e) => {
|
|
480
479
|
if (!e) {
|
|
481
|
-
let e =
|
|
482
|
-
|
|
480
|
+
let e = D();
|
|
481
|
+
T = !0, w.value = e, T = !1, h.value = "";
|
|
483
482
|
return;
|
|
484
483
|
}
|
|
485
|
-
let t =
|
|
486
|
-
|
|
484
|
+
let t = L(e);
|
|
485
|
+
h.value = t;
|
|
487
486
|
let n = A(t);
|
|
488
487
|
if (!isNaN(n) && isFinite(n)) {
|
|
489
|
-
let e = M(n,
|
|
490
|
-
|
|
491
|
-
} else
|
|
492
|
-
},
|
|
493
|
-
if (
|
|
494
|
-
|
|
495
|
-
let e =
|
|
488
|
+
let e = M(n, x.maximumFractionDigits);
|
|
489
|
+
T = !0, w.value = e, T = !1;
|
|
490
|
+
} else T = !0, w.value = D(), T = !1;
|
|
491
|
+
}, ie = () => {
|
|
492
|
+
if (x.readonly || x.disabled) return;
|
|
493
|
+
b.value = !1;
|
|
494
|
+
let e = z(w.value);
|
|
496
495
|
if (e == null) {
|
|
497
|
-
let e =
|
|
498
|
-
|
|
496
|
+
let e = D();
|
|
497
|
+
w.value !== e && (T = !0, w.value = e, T = !1), h.value = N(e === 0, !1);
|
|
499
498
|
return;
|
|
500
499
|
}
|
|
501
500
|
let t = e;
|
|
502
|
-
|
|
503
|
-
minimumFractionDigits:
|
|
504
|
-
maximumFractionDigits:
|
|
501
|
+
x.forceStep && (t = j(x.step, t)), t = O(x.min, t, x.max), t !== e && (T = !0, w.value = t, T = !1), h.value = k(t, {
|
|
502
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
503
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
505
504
|
roundDecimals: !1,
|
|
506
505
|
useGrouping: !0
|
|
507
506
|
});
|
|
508
|
-
},
|
|
509
|
-
if (
|
|
510
|
-
|
|
511
|
-
let e =
|
|
512
|
-
e !== void 0 && (
|
|
513
|
-
minimumFractionDigits:
|
|
514
|
-
maximumFractionDigits:
|
|
507
|
+
}, R = () => {
|
|
508
|
+
if (x.readonly || x.disabled) return;
|
|
509
|
+
b.value = !0;
|
|
510
|
+
let e = z(w.value);
|
|
511
|
+
e !== void 0 && (h.value = k(e, {
|
|
512
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
513
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
515
514
|
roundDecimals: !1,
|
|
516
515
|
useGrouping: !0
|
|
517
516
|
}).replace(/\./g, ""));
|
|
518
|
-
},
|
|
517
|
+
}, z = (e) => {
|
|
519
518
|
if (e == null || e === "") return e === null ? null : void 0;
|
|
520
519
|
if (typeof e == "number") return e;
|
|
521
520
|
if (typeof e == "string") {
|
|
@@ -523,141 +522,141 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
523
522
|
let t = A(e);
|
|
524
523
|
return isNaN(t) ? void 0 : t;
|
|
525
524
|
}
|
|
526
|
-
},
|
|
527
|
-
if (
|
|
528
|
-
let e = M((
|
|
529
|
-
|
|
530
|
-
minimumFractionDigits:
|
|
531
|
-
maximumFractionDigits:
|
|
525
|
+
}, B = () => {
|
|
526
|
+
if (x.readonly || x.disabled) return;
|
|
527
|
+
let e = M((z(w.value) ?? 0) + x.step, x.maximumFractionDigits), t = O(x.min, e, x.max);
|
|
528
|
+
T = !0, w.value = t, T = !1, h.value = k(t, {
|
|
529
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
530
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
532
531
|
roundDecimals: !1,
|
|
533
532
|
useGrouping: !0
|
|
534
533
|
});
|
|
535
|
-
},
|
|
536
|
-
if (
|
|
537
|
-
let e = M((
|
|
538
|
-
|
|
539
|
-
minimumFractionDigits:
|
|
540
|
-
maximumFractionDigits:
|
|
534
|
+
}, W = () => {
|
|
535
|
+
if (x.readonly || x.disabled) return;
|
|
536
|
+
let e = M((z(w.value) ?? 0) - x.step, x.maximumFractionDigits), t = O(x.min, e, x.max);
|
|
537
|
+
T = !0, w.value = t, T = !1, h.value = k(t, {
|
|
538
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
539
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
541
540
|
roundDecimals: !1,
|
|
542
541
|
useGrouping: !0
|
|
543
542
|
});
|
|
544
543
|
};
|
|
545
|
-
return
|
|
546
|
-
let e =
|
|
544
|
+
return d(() => {
|
|
545
|
+
let e = w.value;
|
|
547
546
|
if (e == null) {
|
|
548
|
-
let t =
|
|
549
|
-
e !== t && (
|
|
547
|
+
let t = D();
|
|
548
|
+
e !== t && (T = !0, w.value = t, T = !1), h.value = N(t === 0, !1);
|
|
550
549
|
return;
|
|
551
550
|
}
|
|
552
551
|
if (typeof e == "number") {
|
|
553
|
-
let t = M(e,
|
|
554
|
-
|
|
555
|
-
minimumFractionDigits:
|
|
556
|
-
maximumFractionDigits:
|
|
552
|
+
let t = M(e, x.maximumFractionDigits);
|
|
553
|
+
x.forceStep && (t = j(x.step, t)), t = O(x.min, t, x.max), t !== e && (T = !0, w.value = t, T = !1), h.value = k(t, {
|
|
554
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
555
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
557
556
|
roundDecimals: !1,
|
|
558
557
|
useGrouping: !0
|
|
559
558
|
});
|
|
560
559
|
return;
|
|
561
560
|
}
|
|
562
561
|
if (typeof e == "string") {
|
|
563
|
-
let t =
|
|
562
|
+
let t = z(e);
|
|
564
563
|
if (t != null) {
|
|
565
|
-
let e = M(t,
|
|
566
|
-
|
|
567
|
-
minimumFractionDigits:
|
|
568
|
-
maximumFractionDigits:
|
|
564
|
+
let e = M(t, x.maximumFractionDigits);
|
|
565
|
+
x.forceStep && (e = j(x.step, e)), e = O(x.min, e, x.max), T = !0, w.value = e, T = !1, h.value = k(e, {
|
|
566
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
567
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
569
568
|
roundDecimals: !1,
|
|
570
569
|
useGrouping: !0
|
|
571
570
|
});
|
|
572
571
|
} else {
|
|
573
|
-
let e =
|
|
574
|
-
|
|
572
|
+
let e = D();
|
|
573
|
+
T = !0, w.value = e, T = !1, h.value = N(e === 0, !1);
|
|
575
574
|
}
|
|
576
575
|
return;
|
|
577
576
|
}
|
|
578
|
-
}),
|
|
579
|
-
if (!
|
|
577
|
+
}), S(() => w.value, (e) => {
|
|
578
|
+
if (!T) {
|
|
580
579
|
if (e == null) {
|
|
581
|
-
let t =
|
|
582
|
-
e !== t && (
|
|
580
|
+
let t = D();
|
|
581
|
+
e !== t && (T = !0, w.value = t, T = !1), h.value = N(t === 0, b.value);
|
|
583
582
|
return;
|
|
584
583
|
}
|
|
585
584
|
if (typeof e == "number") {
|
|
586
|
-
let t = M(e,
|
|
587
|
-
|
|
588
|
-
minimumFractionDigits:
|
|
589
|
-
maximumFractionDigits:
|
|
585
|
+
let t = M(e, x.maximumFractionDigits);
|
|
586
|
+
x.forceStep && (t = j(x.step, t)), b.value || (t = O(x.min, t, x.max)), t !== e && (T = !0, w.value = t, T = !1), b.value || (h.value = k(t, {
|
|
587
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
588
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
590
589
|
roundDecimals: !1,
|
|
591
590
|
useGrouping: !0
|
|
592
591
|
}));
|
|
593
592
|
return;
|
|
594
593
|
}
|
|
595
594
|
if (typeof e == "string") {
|
|
596
|
-
let t =
|
|
595
|
+
let t = z(e);
|
|
597
596
|
if (t != null) {
|
|
598
|
-
let e = M(t,
|
|
599
|
-
|
|
600
|
-
minimumFractionDigits:
|
|
601
|
-
maximumFractionDigits:
|
|
597
|
+
let e = M(t, x.maximumFractionDigits);
|
|
598
|
+
x.forceStep && (e = j(x.step, e)), b.value || (e = O(x.min, e, x.max)), T = !0, w.value = e, T = !1, b.value || (h.value = k(e, {
|
|
599
|
+
minimumFractionDigits: x.minimumFractionDigits,
|
|
600
|
+
maximumFractionDigits: x.maximumFractionDigits,
|
|
602
601
|
roundDecimals: !1,
|
|
603
602
|
useGrouping: !0
|
|
604
603
|
}));
|
|
605
604
|
} else {
|
|
606
|
-
let e =
|
|
607
|
-
|
|
605
|
+
let e = D();
|
|
606
|
+
T = !0, w.value = e, T = !1, h.value = N(e === 0, b.value);
|
|
608
607
|
}
|
|
609
608
|
return;
|
|
610
609
|
}
|
|
611
610
|
}
|
|
612
611
|
}), s({
|
|
613
|
-
inputRef:
|
|
612
|
+
inputRef: v,
|
|
614
613
|
containerRef: g
|
|
615
|
-
}), (e, r) => (
|
|
614
|
+
}), (e, r) => (f(), t(V, l({
|
|
616
615
|
ref_key: "fzInputRef",
|
|
617
616
|
ref: u
|
|
618
|
-
},
|
|
619
|
-
modelValue:
|
|
617
|
+
}, x, {
|
|
618
|
+
modelValue: h.value,
|
|
620
619
|
type: "text",
|
|
621
|
-
"onUpdate:modelValue":
|
|
622
|
-
onKeydown:
|
|
623
|
-
onFocus:
|
|
624
|
-
onBlur:
|
|
625
|
-
onPaste:
|
|
626
|
-
"onFzinput:clear": r[2] ||= (e) =>
|
|
620
|
+
"onUpdate:modelValue": re,
|
|
621
|
+
onKeydown: te,
|
|
622
|
+
onFocus: R,
|
|
623
|
+
onBlur: ie,
|
|
624
|
+
onPaste: ne,
|
|
625
|
+
"onFzinput:clear": r[2] ||= (e) => ee("fzcurrencyinput:clear")
|
|
627
626
|
}), a({
|
|
628
|
-
"right-icon":
|
|
627
|
+
"right-icon": C(() => [i("div", H, [x.valid ? (f(), t(_(E), {
|
|
629
628
|
key: 0,
|
|
630
629
|
name: "check",
|
|
631
630
|
size: "md",
|
|
632
631
|
class: "text-semantic-success",
|
|
633
632
|
"aria-hidden": "true"
|
|
634
|
-
})) : n("", !0), i("div", U, [o(
|
|
633
|
+
})) : n("", !0), i("div", U, [o(_(E), {
|
|
635
634
|
name: "angle-up",
|
|
636
635
|
size: "xs",
|
|
637
636
|
role: "button",
|
|
638
|
-
"aria-label":
|
|
639
|
-
"aria-disabled":
|
|
640
|
-
tabindex:
|
|
637
|
+
"aria-label": P.value,
|
|
638
|
+
"aria-disabled": I.value ? "true" : void 0,
|
|
639
|
+
tabindex: I.value ? void 0 : "0",
|
|
641
640
|
class: "fz__currencyinput__arrowup cursor-pointer",
|
|
642
|
-
onClick:
|
|
641
|
+
onClick: B,
|
|
643
642
|
onKeydown: r[0] ||= (e) => {
|
|
644
|
-
(e.key === "Enter" || e.key === " ") && !
|
|
643
|
+
(e.key === "Enter" || e.key === " ") && !I.value && (e.preventDefault(), B());
|
|
645
644
|
}
|
|
646
645
|
}, null, 8, [
|
|
647
646
|
"aria-label",
|
|
648
647
|
"aria-disabled",
|
|
649
648
|
"tabindex"
|
|
650
|
-
]), o(
|
|
649
|
+
]), o(_(E), {
|
|
651
650
|
name: "angle-down",
|
|
652
651
|
size: "xs",
|
|
653
652
|
role: "button",
|
|
654
|
-
"aria-label":
|
|
655
|
-
"aria-disabled":
|
|
656
|
-
tabindex:
|
|
653
|
+
"aria-label": F.value,
|
|
654
|
+
"aria-disabled": I.value ? "true" : void 0,
|
|
655
|
+
tabindex: I.value ? void 0 : "0",
|
|
657
656
|
class: "fz__currencyinput__arrowdown cursor-pointer",
|
|
658
|
-
onClick:
|
|
657
|
+
onClick: W,
|
|
659
658
|
onKeydown: r[1] ||= (e) => {
|
|
660
|
-
(e.key === "Enter" || e.key === " ") && !
|
|
659
|
+
(e.key === "Enter" || e.key === " ") && !I.value && (e.preventDefault(), W());
|
|
661
660
|
}
|
|
662
661
|
}, null, 8, [
|
|
663
662
|
"aria-label",
|
|
@@ -668,22 +667,22 @@ var re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-
|
|
|
668
667
|
}, [
|
|
669
668
|
e.$slots.label ? {
|
|
670
669
|
name: "label",
|
|
671
|
-
fn:
|
|
670
|
+
fn: C(() => [m(e.$slots, "label")]),
|
|
672
671
|
key: "0"
|
|
673
672
|
} : void 0,
|
|
674
673
|
e.$slots["left-icon"] ? {
|
|
675
674
|
name: "left-icon",
|
|
676
|
-
fn:
|
|
675
|
+
fn: C(() => [m(e.$slots, "left-icon")]),
|
|
677
676
|
key: "1"
|
|
678
677
|
} : void 0,
|
|
679
678
|
e.$slots.helpText ? {
|
|
680
679
|
name: "helpText",
|
|
681
|
-
fn:
|
|
680
|
+
fn: C(() => [m(e.$slots, "helpText")]),
|
|
682
681
|
key: "2"
|
|
683
682
|
} : void 0,
|
|
684
683
|
e.$slots.errorMessage ? {
|
|
685
684
|
name: "errorMessage",
|
|
686
|
-
fn:
|
|
685
|
+
fn: C(() => [m(e.$slots, "errorMessage")]),
|
|
687
686
|
key: "3"
|
|
688
687
|
} : void 0
|
|
689
688
|
]), 1040, ["modelValue"]));
|