@fiscozen/input 3.3.1 → 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/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, normalizeStyle as d, onMounted as f, openBlock as p, ref as m, renderSlot as h, toDisplayString as g, toRefs as _, unref as v, useAttrs as y, useModel as ee, useSlots as b, vModelDynamic as te, watch as x, withCtx as S, withDirectives as C, withModifiers as w } from "vue";
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 = e(() => n.value ? `${n.value.clientWidth}px` : "auto"), s = {
8
+ let o = {
9
9
  backoffice: "h-32",
10
10
  frontoffice: "h-44"
11
- }, c = e(() => {
11
+ }, s = e(() => {
12
12
  let e = i.value;
13
- return [t.variant?.value === "normal" ? s[e] : s.frontoffice, y()];
14
- }), l = e(() => ["font-normal text-base", t.disabled?.value || t.readonly?.value ? "text-grey-300" : "text-grey-500"]), u = {
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
- }, d = e(() => t.variant?.value === "floating-label" ? !r.value && !a.value : !0), f = e(() => {
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" ? [u[e]] : [];
20
- }), p = e(() => ["font-normal text-base", t.disabled?.value || t.readonly?.value ? "text-grey-300" : "text-grey-500"]), m = e(() => ["font-normal text-base", t.disabled?.value || t.readonly?.value ? "text-grey-300" : "text-core-black"]), h = (e) => !!e.error?.value, g = (e) => !!e.disabled?.value || !!e.readonly?.value, _ = (e) => !!e.highlighted?.value, v = (e) => !!e.aiReasoning?.value, y = () => {
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 h(t): return "border-semantic-error-200 has-[:focus]:border-semantic-error-300 bg-core-white text-core-black cursor-text";
23
- case g(t): return "bg-grey-100 border-grey-100 text-grey-300 cursor-not-allowed";
24
- case _(t): return "bg-semantic-warning-50 border-semantic-warning-200 ring-2 ring-semantic-warning-100 text-core-black cursor-text";
25
- case v(t): return "bg-purple-50 border-purple-600 ring-2 ring-purple-200 text-core-black cursor-text";
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: c,
32
- computedLabelClass: l,
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: f,
35
- computedHelpClass: p,
36
- computedErrorClass: m,
37
- containerWidth: o,
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 ne() {
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 re = ["id", "for"], ie = ["tabindex"], ae = { class: "flex flex-col justify-around min-w-0 grow" }, L = {
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, f = y(), O = e(() => ({
154
- ...f,
155
- class: void 0
156
- })), k = e(() => f.class);
157
- x(() => c.size, (e) => {
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 }), x(() => c.rightIconSize, (e) => {
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 = ee(a, "modelValue"), M = m(null), F = m(null), I = ne(), V = m(!1), H = m(c.highlighted), U = m(c.aiReasoning);
166
- x(() => c.highlighted, (e) => {
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 W = () => {
172
- c.disableEmphasisReset || (H.value && (H.value = !1, J("update:highlighted", !1)), U.value && (U.value = !1, J("update:aiReasoning", !1)));
173
- }, { staticContainerClass: oe, computedContainerClass: se, computedLabelClass: ce, staticInputClass: le, computedInputClass: ue, computedHelpClass: de, containerWidth: G, showNormalPlaceholder: K } = N({
174
- ..._(c),
175
- highlighted: H,
176
- aiReasoning: U
177
- }, M, j, A, V);
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 q = b(), fe = e(() => {
180
- let e = !!c.label, t = !!q.label;
181
- if (e && !t) return `${I}-label`;
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 && q.errorMessage && e.push(`${I}-error`), !c.error && q.helpText && e.push(`${I}-help`), e.length > 0 ? e.join(" ") : void 0;
185
- }), J = s, me = () => {
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
- }, Y = (e, t) => {
190
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Z.value || J(t === "fzinput:left-icon-click" ? "fzinput:left-icon-click" : t === "fzinput:right-icon-click" ? "fzinput:right-icon-click" : "fzinput:second-right-icon-click"));
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 || J("fzinput:left-icon-click");
192
+ Z.value || q("fzinput:left-icon-click");
193
193
  }, _e = () => {
194
- Z.value || J("fzinput:right-icon-click");
195
- }, ve = () => {
196
- Z.value || J("fzinput:second-right-icon-click");
197
- }, ye = e(() => !!c.leftIcon), X = e(() => ye.value && !!c.leftIconAriaLabel), Z = e(() => !!c.disabled || !!c.readonly), be = e(() => Z.value || c.error ? "text-grey-300" : "text-purple-600"), xe = e(() => {
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 (H.value) return c.highlightedDescription;
200
- if (U.value) return c.aiReasoningDescription;
199
+ if (U.value) return c.highlightedDescription;
200
+ if (W.value) return c.aiReasoningDescription;
201
201
  }
202
- }), Se = e(() => !!c.rightIcon && !c.rightIconButton), Q = e(() => Se.value && !!c.rightIconAriaLabel), Ce = e(() => !!c.secondRightIcon && !c.secondRightIconButton), $ = e(() => Ce.value && !!c.secondRightIconAriaLabel), we = e(() => c.clearable && !!j.value && !Z.value), Te = () => {
203
- j.value = "", J("fzinput:clear"), F.value?.focus();
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) => (p(), r("div", { class: u(["fz-input w-full flex flex-col gap-8", k.value]) }, [
209
- h(e.$slots, "label", {}, () => [a.label ? (p(), r("label", {
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: `${v(I)}-label`,
212
- class: u(v(ce)),
213
- for: v(I)
214
- }, g(a.label) + g(a.required ? " *" : ""), 11, re)) : n("", !0)]),
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([v(oe), v(se)]),
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
- h(e.$slots, "left-icon", {}, () => [a.leftIcon ? (p(), t(v(E), {
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) => Y(e, "fzinput:left-icon-click") : void 0
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
- ])) : U.value && !H.value ? (p(), t(v(E), {
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(be.value)
249
+ class: u(ye.value)
250
250
  }, null, 8, ["class"])) : n("", !0)]),
251
- i("div", ae, [v(K) ? n("", !0) : (p(), r("span", L, g(a.placeholder), 1)), C(i("input", l({
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: v(K) ? a.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: [v(le), v(ue)],
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": xe.value
270
+ "aria-description": be.value
272
271
  }, O.value, {
273
- onInput: W,
272
+ id: V.value,
273
+ onInput: ae,
274
274
  onBlur: o[2] ||= (t) => {
275
- V.value = !1, e.$emit("blur", t);
275
+ H.value = !1, e.$emit("blur", t);
276
276
  },
277
277
  onFocus: o[3] ||= (t) => {
278
- V.value = !0, e.$emit("focus", t);
278
+ H.value = !0, e.$emit("focus", t);
279
279
  }
280
- }), null, 16, R), [[te, j.value]])]),
281
- i("div", z, [we.value ? (p(), t(v(D), {
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(Te, ["stop"])
288
- }, null, 8, ["ariaLabel"])) : n("", !0), h(e.$slots, "right-icon", {}, () => [
289
- a.secondRightIcon && !a.secondRightIconButton ? (p(), t(v(E), {
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(ve, ["stop"]),
300
- onKeydown: o[4] ||= (e) => $.value ? (e) => Y(e, "fzinput:second-right-icon-click") : void 0
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 ? (p(), t(v(D), {
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(ve, ["stop"]),
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 ? (p(), t(v(E), {
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) => Y(e, "fzinput:right-icon-click") : void 0
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 ? (p(), t(v(D), {
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 ? (p(), t(v(E), {
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, ie),
368
- a.error && e.$slots.errorMessage ? (p(), t(v(T), {
367
+ ], 42, ne),
368
+ a.error && e.$slots.errorMessage ? (f(), t(_(T), {
369
369
  key: 0,
370
- id: `${v(I)}-error`,
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: S(() => [h(e.$slots, "errorMessage")]),
375
+ default: C(() => [m(e.$slots, "errorMessage")]),
377
376
  _: 3
378
- }, 8, ["id", "style"])) : e.$slots.helpText ? (p(), r("span", {
377
+ }, 8, ["id"])) : e.$slots.helpText ? (f(), r("span", {
379
378
  key: 1,
380
- id: `${v(I)}-help`,
381
- class: u([v(de)]),
382
- style: d({ width: v(G) })
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 = m(), d = m(), g = e(() => u.value?.containerRef), _ = e(() => u.value?.inputRef), y = m(!1), b = r, te = c, C = ee(r, "modelValue"), w = !1, T = () => {
433
- if (b.nullOnEmpty) return null;
434
- if (b.zeroOnEmpty) return 0;
435
- }, D = (e, t) => e ? t ? "" : k(0, {
436
- minimumFractionDigits: b.minimumFractionDigits,
437
- maximumFractionDigits: b.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
- }) : "", N = e(() => b.stepUpAriaLabel ? b.stepUpAriaLabel : `Incrementa di ${b.step}`), P = e(() => b.stepDownAriaLabel ? b.stepDownAriaLabel : `Decrementa di ${b.step}`), F = e(() => b.readonly || b.disabled), I = (e) => {
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
- }, ne = (e) => {
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
- }, re = (e) => {
470
- if (b.readonly || b.disabled) return;
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, b.maximumFractionDigits);
477
- w = !0, C.value = e, w = !1, d.value = I(String(e));
475
+ let e = M(n, x.maximumFractionDigits);
476
+ T = !0, w.value = e, T = !1, h.value = L(String(e));
478
477
  }
479
- }, ie = (e) => {
478
+ }, re = (e) => {
480
479
  if (!e) {
481
- let e = T();
482
- w = !0, C.value = e, w = !1, d.value = "";
480
+ let e = D();
481
+ T = !0, w.value = e, T = !1, h.value = "";
483
482
  return;
484
483
  }
485
- let t = I(e);
486
- d.value = t;
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, b.maximumFractionDigits);
490
- w = !0, C.value = e, w = !1;
491
- } else w = !0, C.value = T(), w = !1;
492
- }, ae = () => {
493
- if (b.readonly || b.disabled) return;
494
- y.value = !1;
495
- let e = R(C.value);
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 = T();
498
- C.value !== e && (w = !0, C.value = e, w = !1), d.value = D(e === 0, !1);
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
- b.forceStep && (t = j(b.step, t)), t = O(b.min, t, b.max), t !== e && (w = !0, C.value = t, w = !1), d.value = k(t, {
503
- minimumFractionDigits: b.minimumFractionDigits,
504
- maximumFractionDigits: b.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
- }, L = () => {
509
- if (b.readonly || b.disabled) return;
510
- y.value = !0;
511
- let e = R(C.value);
512
- e !== void 0 && (d.value = k(e, {
513
- minimumFractionDigits: b.minimumFractionDigits,
514
- maximumFractionDigits: b.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
- }, R = (e) => {
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
- }, z = () => {
527
- if (b.readonly || b.disabled) return;
528
- let e = M((R(C.value) ?? 0) + b.step, b.maximumFractionDigits), t = O(b.min, e, b.max);
529
- w = !0, C.value = t, w = !1, d.value = k(t, {
530
- minimumFractionDigits: b.minimumFractionDigits,
531
- maximumFractionDigits: b.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
- }, B = () => {
536
- if (b.readonly || b.disabled) return;
537
- let e = M((R(C.value) ?? 0) - b.step, b.maximumFractionDigits), t = O(b.min, e, b.max);
538
- w = !0, C.value = t, w = !1, d.value = k(t, {
539
- minimumFractionDigits: b.minimumFractionDigits,
540
- maximumFractionDigits: b.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 f(() => {
546
- let e = C.value;
544
+ return d(() => {
545
+ let e = w.value;
547
546
  if (e == null) {
548
- let t = T();
549
- e !== t && (w = !0, C.value = t, w = !1), d.value = D(t === 0, !1);
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, b.maximumFractionDigits);
554
- b.forceStep && (t = j(b.step, t)), t = O(b.min, t, b.max), t !== e && (w = !0, C.value = t, w = !1), d.value = k(t, {
555
- minimumFractionDigits: b.minimumFractionDigits,
556
- maximumFractionDigits: b.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 = R(e);
562
+ let t = z(e);
564
563
  if (t != null) {
565
- let e = M(t, b.maximumFractionDigits);
566
- b.forceStep && (e = j(b.step, e)), e = O(b.min, e, b.max), w = !0, C.value = e, w = !1, d.value = k(e, {
567
- minimumFractionDigits: b.minimumFractionDigits,
568
- maximumFractionDigits: b.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 = T();
574
- w = !0, C.value = e, w = !1, d.value = D(e === 0, !1);
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
- }), x(() => C.value, (e) => {
579
- if (!w) {
577
+ }), S(() => w.value, (e) => {
578
+ if (!T) {
580
579
  if (e == null) {
581
- let t = T();
582
- e !== t && (w = !0, C.value = t, w = !1), d.value = D(t === 0, y.value);
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, b.maximumFractionDigits);
587
- b.forceStep && (t = j(b.step, t)), y.value || (t = O(b.min, t, b.max)), t !== e && (w = !0, C.value = t, w = !1), y.value || (d.value = k(t, {
588
- minimumFractionDigits: b.minimumFractionDigits,
589
- maximumFractionDigits: b.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 = R(e);
595
+ let t = z(e);
597
596
  if (t != null) {
598
- let e = M(t, b.maximumFractionDigits);
599
- b.forceStep && (e = j(b.step, e)), y.value || (e = O(b.min, e, b.max)), w = !0, C.value = e, w = !1, y.value || (d.value = k(e, {
600
- minimumFractionDigits: b.minimumFractionDigits,
601
- maximumFractionDigits: b.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 = T();
607
- w = !0, C.value = e, w = !1, d.value = D(e === 0, y.value);
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) => (p(), t(V, l({
614
+ }), (e, r) => (f(), t(V, l({
616
615
  ref_key: "fzInputRef",
617
616
  ref: u
618
- }, b, {
619
- modelValue: d.value,
617
+ }, x, {
618
+ modelValue: h.value,
620
619
  type: "text",
621
- "onUpdate:modelValue": ie,
622
- onKeydown: ne,
623
- onFocus: L,
624
- onBlur: ae,
625
- onPaste: re,
626
- "onFzinput:clear": r[2] ||= (e) => te("fzcurrencyinput:clear")
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": S(() => [i("div", H, [b.valid ? (p(), t(v(E), {
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(v(E), {
633
+ })) : n("", !0), i("div", U, [o(_(E), {
635
634
  name: "angle-up",
636
635
  size: "xs",
637
636
  role: "button",
638
- "aria-label": N.value,
639
- "aria-disabled": F.value ? "true" : void 0,
640
- tabindex: F.value ? void 0 : "0",
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: z,
641
+ onClick: B,
643
642
  onKeydown: r[0] ||= (e) => {
644
- (e.key === "Enter" || e.key === " ") && !F.value && (e.preventDefault(), z());
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(v(E), {
649
+ ]), o(_(E), {
651
650
  name: "angle-down",
652
651
  size: "xs",
653
652
  role: "button",
654
- "aria-label": P.value,
655
- "aria-disabled": F.value ? "true" : void 0,
656
- tabindex: F.value ? void 0 : "0",
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: B,
657
+ onClick: W,
659
658
  onKeydown: r[1] ||= (e) => {
660
- (e.key === "Enter" || e.key === " ") && !F.value && (e.preventDefault(), B());
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: S(() => [h(e.$slots, "label")]),
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: S(() => [h(e.$slots, "left-icon")]),
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: S(() => [h(e.$slots, "helpText")]),
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: S(() => [h(e.$slots, "errorMessage")]),
685
+ fn: C(() => [m(e.$slots, "errorMessage")]),
687
686
  key: "3"
688
687
  } : void 0
689
688
  ]), 1040, ["modelValue"]));