@studiolxd/brand 41.1.0 → 43.0.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/_shared/datepicker.js +75 -78
  3. package/dist/_types/atoms/AsyncMultiSelect/AsyncMultiSelect.d.ts +28 -5
  4. package/dist/_types/atoms/AsyncSelect/AsyncSelect.d.ts +26 -6
  5. package/dist/_types/atoms/InputPhone/InputPhone.d.ts +15 -4
  6. package/dist/_types/atoms/MultiSelect/MultiSelect.d.ts +20 -1
  7. package/dist/_types/atoms/NumberInput/NumberInput.d.ts +14 -4
  8. package/dist/_types/atoms/OtpInput/OtpInput.d.ts +15 -4
  9. package/dist/_types/atoms/Select/Select.d.ts +18 -1
  10. package/dist/_types/atoms/TimeSelect/TimeSelect.d.ts +34 -6
  11. package/dist/_types/messages/BrandMessages.d.ts +31 -1
  12. package/dist/_types/messages/index.d.ts +1 -1
  13. package/dist/_types/molecules/Calendar/Calendar.d.ts +44 -13
  14. package/dist/_types/molecules/DatePicker/DatePicker.d.ts +56 -26
  15. package/dist/_types/molecules/DatePicker/dateMask.d.ts +9 -2
  16. package/dist/_types/molecules/DateTimeField/DateTimeField.d.ts +12 -12
  17. package/dist/_types/molecules/DocsSearch/DocsSearch.d.ts +31 -12
  18. package/dist/_types/molecules/FilterBar/FilterBar.d.ts +10 -1
  19. package/dist/_types/molecules/InputField/InputField.d.ts +16 -2
  20. package/dist/_types/molecules/MultiSelectField/MultiSelectField.d.ts +9 -1
  21. package/dist/_types/molecules/PasswordField/PasswordField.d.ts +22 -2
  22. package/dist/_types/molecules/SearchForm/SearchForm.d.ts +18 -6
  23. package/dist/_types/molecules/SelectField/SelectField.d.ts +5 -0
  24. package/dist/_types/molecules/TimeField/TimeField.d.ts +9 -2
  25. package/dist/_types/molecules/_shared/calendarGrid.d.ts +6 -2
  26. package/dist/async-multi-select.js +50 -49
  27. package/dist/async-select.js +89 -88
  28. package/dist/calendar.js +87 -86
  29. package/dist/docs-search.js +38 -37
  30. package/dist/filter-bar.css +1 -1
  31. package/dist/filter-bar.js +19 -17
  32. package/dist/input-field.js +66 -65
  33. package/dist/input-phone.js +39 -38
  34. package/dist/multi-select.js +109 -108
  35. package/dist/number-input.js +61 -60
  36. package/dist/otp-input.js +86 -85
  37. package/dist/password-field.js +46 -45
  38. package/dist/search-form.js +35 -34
  39. package/dist/select.js +75 -71
  40. package/dist/time-select.js +57 -56
  41. package/package.json +1 -1
@@ -1,72 +1,73 @@
1
1
  'use client';
2
2
  import './input-phone.css';
3
- import { Icon as e } from "./icon.js";
4
- import { forwardRef as t, useMemo as n } from "react";
5
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
- import { Select as a } from "@base-ui/react/select";
7
- import o, { getCountryCallingCode as s } from "react-phone-number-input";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { forwardRef as n, useMemo as r } from "react";
6
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
+ import { Select as o } from "@base-ui/react/select";
8
+ import s, { getCountryCallingCode as c } from "react-phone-number-input";
8
9
  //#region src/stories/atoms/InputPhone/InputPhone.tsx
9
- function c({ value: t, onChange: n, options: o, disabled: c, size: l = "md", countryLabel: u = "País", internationalLabel: d = "🌐", container: f }) {
10
- let p = "__intl__", m = (e) => e ?? p, h = (e) => e === p ? void 0 : e, g = l === "sm" ? "xs" : l === "lg" ? "md" : "sm", _ = ["input-phone__country-content", l === "md" ? "" : `input-phone__country-content--${l}`].filter(Boolean).join(" ");
11
- return /* @__PURE__ */ i(a.Root, {
12
- value: m(t),
13
- onValueChange: (e) => n(h(e)),
14
- disabled: c,
15
- children: [/* @__PURE__ */ i(a.Trigger, {
10
+ function l({ value: n, onChange: r, options: s, disabled: l, size: u = "md", countryLabel: d, internationalLabel: f = "🌐", container: p }) {
11
+ let m = e("inputPhone"), h = "__intl__", g = (e) => e ?? h, _ = (e) => e === h ? void 0 : e, v = u === "sm" ? "xs" : u === "lg" ? "md" : "sm", y = ["input-phone__country-content", u === "md" ? "" : `input-phone__country-content--${u}`].filter(Boolean).join(" ");
12
+ return /* @__PURE__ */ a(o.Root, {
13
+ value: g(n),
14
+ onValueChange: (e) => r(_(e)),
15
+ disabled: l,
16
+ children: [/* @__PURE__ */ a(o.Trigger, {
16
17
  className: "input-phone__country",
17
- "aria-label": u,
18
- children: [/* @__PURE__ */ r(a.Value, { children: t ? `+${s(t)}` : d }), /* @__PURE__ */ r(e, {
18
+ "aria-label": m("country", d),
19
+ children: [/* @__PURE__ */ i(o.Value, { children: n ? `+${c(n)}` : f }), /* @__PURE__ */ i(t, {
19
20
  name: "chevron",
20
21
  className: "input-phone__country-icon",
21
- size: g
22
+ size: v
22
23
  })]
23
- }), /* @__PURE__ */ r(a.Portal, {
24
- container: f,
25
- children: /* @__PURE__ */ r(a.Positioner, {
24
+ }), /* @__PURE__ */ i(o.Portal, {
25
+ container: p,
26
+ children: /* @__PURE__ */ i(o.Positioner, {
26
27
  className: "input-phone__country-positioner",
27
28
  side: "bottom",
28
29
  align: "start",
29
30
  alignItemWithTrigger: !1,
30
- children: /* @__PURE__ */ r(a.Popup, {
31
- className: _,
32
- children: o.map(({ value: e, label: t }) => /* @__PURE__ */ r(a.Item, {
33
- value: m(e),
31
+ children: /* @__PURE__ */ i(o.Popup, {
32
+ className: y,
33
+ children: s.map(({ value: e, label: t }) => /* @__PURE__ */ i(o.Item, {
34
+ value: g(e),
34
35
  className: "input-phone__country-item",
35
- children: /* @__PURE__ */ r(a.ItemText, { children: t })
36
- }, m(e)))
36
+ children: /* @__PURE__ */ i(o.ItemText, { children: t })
37
+ }, g(e)))
37
38
  })
38
39
  })
39
40
  })]
40
41
  });
41
42
  }
42
- var l = t(function({ value: e, defaultCountry: i = "ES", placeholder: a, disabled: s, error: l = !1, size: d = "md", id: f, name: p, describedBy: m, "aria-describedby": h, "aria-label": g, autoComplete: _, required: v, readOnly: y, onChange: b, onBlur: x, onFocus: S, countryLabel: C, internationalLabel: w, container: T }, E) {
43
- return /* @__PURE__ */ r(o, {
43
+ var u = n(function({ value: e, defaultCountry: t = "ES", placeholder: a, disabled: o, error: c = !1, size: u = "md", id: f, name: p, describedBy: m, "aria-describedby": h, "aria-label": g, autoComplete: _, required: v, readOnly: y, onChange: b, onBlur: x, onFocus: S, countryLabel: C, internationalLabel: w, container: T }, E) {
44
+ return /* @__PURE__ */ i(s, {
44
45
  className: [
45
46
  "input-phone",
46
- l ? "input-phone--error" : "",
47
- d === "md" ? "" : `input-phone--${d}`
47
+ c ? "input-phone--error" : "",
48
+ u === "md" ? "" : `input-phone--${u}`
48
49
  ].filter(Boolean).join(" "),
49
50
  value: e,
50
- defaultCountry: i,
51
+ defaultCountry: t,
51
52
  placeholder: a,
52
- disabled: s,
53
+ disabled: o,
53
54
  readOnly: y,
54
55
  required: v,
55
56
  autoComplete: _,
56
57
  id: f,
57
58
  name: p,
58
- inputComponent: n(() => t(function(e, t) {
59
- return /* @__PURE__ */ r("input", {
59
+ inputComponent: r(() => n(function(e, t) {
60
+ return /* @__PURE__ */ i("input", {
60
61
  ...e,
61
62
  ref: (e) => {
62
- u(t, e), u(E, e);
63
+ d(t, e), d(E, e);
63
64
  },
64
65
  className: "input-phone__number"
65
66
  });
66
67
  }), [E]),
67
- countrySelectComponent: c,
68
+ countrySelectComponent: l,
68
69
  countrySelectProps: {
69
- size: d,
70
+ size: u,
70
71
  countryLabel: C,
71
72
  internationalLabel: w,
72
73
  container: T
@@ -77,12 +78,12 @@ var l = t(function({ value: e, defaultCountry: i = "ES", placeholder: a, disable
77
78
  numberInputProps: {
78
79
  "aria-describedby": h ?? m,
79
80
  "aria-label": g,
80
- "aria-invalid": l || void 0
81
+ "aria-invalid": c || void 0
81
82
  }
82
83
  });
83
84
  });
84
- function u(e, t) {
85
+ function d(e, t) {
85
86
  typeof e == "function" ? e(t) : e && (e.current = t);
86
87
  }
87
88
  //#endregion
88
- export { l as InputPhone };
89
+ export { u as InputPhone };
@@ -1,166 +1,167 @@
1
1
  'use client';
2
2
  import './multi-select.css';
3
- import { Icon as e } from "./icon.js";
4
- import { forwardRef as t, useEffect as n, useId as r, useRef as i, useState as a } from "react";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
- import { Popover as c } from "@base-ui/react/popover";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { forwardRef as n, useEffect as r, useId as i, useRef as a, useState as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { Popover as l } from "@base-ui/react/popover";
7
8
  //#region src/stories/atoms/MultiSelect/MultiSelect.tsx
8
- function l(e, t) {
9
+ function u(e, t) {
9
10
  typeof e == "function" ? e(t) : e && (e.current = t);
10
11
  }
11
- var u = 500, d = t(function({ options: t, value: d, defaultValue: f = [], placeholder: p = "Seleccionar…", disabled: m, readOnly: h, size: g = "md", onValueChange: _, id: v, name: y, error: b = !1, onBlur: x, className: S, "aria-label": C, "aria-labelledby": w, "aria-describedby": T, removeLabel: E = (e) => `Quitar ${e}`, container: D }, O) {
12
- let [k, A] = a(!1), [j, M] = a(f), [N, P] = a(-1), F = i(null), I = i(null), L = r(), R = r(), z = i(""), B = i(0), V = d === void 0 ? j : d, H = (e) => `${R}-opt-${e}`;
13
- function U(e) {
14
- let t = V.includes(e) ? V.filter((t) => t !== e) : [...V, e];
15
- d === void 0 && M(t), _?.(t);
12
+ var d = 500, f = n(function({ options: n, value: f, defaultValue: p = [], placeholder: m, disabled: h, readOnly: g, size: _ = "md", onValueChange: v, id: y, name: b, error: x = !1, onBlur: S, className: C, "aria-label": w, "aria-labelledby": T, "aria-describedby": E, removeLabel: D, container: O }, k) {
13
+ let A = e("multiSelect"), [j, M] = o(!1), [N, P] = o(p), [F, I] = o(-1), L = a(null), R = a(null), z = i(), B = i(), V = a(""), H = a(0), U = f === void 0 ? N : f, W = (e) => `${B}-opt-${e}`;
14
+ function G(e) {
15
+ let t = U.includes(e) ? U.filter((t) => t !== e) : [...U, e];
16
+ f === void 0 && P(t), v?.(t);
16
17
  }
17
- function W(e) {
18
- m || h || (A(!0), P(t.length === 0 ? -1 : e));
18
+ function K(e) {
19
+ h || g || (M(!0), I(n.length === 0 ? -1 : e));
19
20
  }
20
- function G() {
21
- A(!1), P(-1), z.current = "";
21
+ function q() {
22
+ M(!1), I(-1), V.current = "";
22
23
  }
23
- function K(e, t) {
24
+ function J(e, t) {
24
25
  if (!e) {
25
26
  if (t.reason === "outside-press") {
26
27
  let e = t.event?.target;
27
- if (e instanceof Node && F.current?.contains(e)) return;
28
+ if (e instanceof Node && L.current?.contains(e)) return;
28
29
  }
29
- G();
30
+ q();
30
31
  }
31
32
  }
32
- function q(e) {
33
- if (t.length === 0) return;
34
- let n = Date.now(), r = n - B.current > u ? e : z.current + e;
35
- z.current = r, B.current = n;
36
- let i = r.length === 1 ? N + 1 : Math.max(N, 0), a = r.toLowerCase();
37
- for (let e = 0; e < t.length; e++) {
38
- let n = (i + e) % t.length;
39
- if (t[n].label.toLowerCase().startsWith(a)) {
40
- P(n), k || A(!0);
33
+ function Y(e) {
34
+ if (n.length === 0) return;
35
+ let t = Date.now(), r = t - H.current > d ? e : V.current + e;
36
+ V.current = r, H.current = t;
37
+ let i = r.length === 1 ? F + 1 : Math.max(F, 0), a = r.toLowerCase();
38
+ for (let e = 0; e < n.length; e++) {
39
+ let t = (i + e) % n.length;
40
+ if (n[t].label.toLowerCase().startsWith(a)) {
41
+ I(t), j || M(!0);
41
42
  return;
42
43
  }
43
44
  }
44
45
  }
45
- function J(e) {
46
- if (m || h) return;
47
- let n = t.length - 1;
48
- if (e.key === "ArrowDown") e.preventDefault(), k ? P((e) => Math.min(e + 1, n)) : W(0);
49
- else if (e.key === "ArrowUp") e.preventDefault(), k ? P((e) => Math.max(e - 1, 0)) : W(n);
50
- else if (e.key === "Home") e.preventDefault(), k ? P(t.length === 0 ? -1 : 0) : W(0);
51
- else if (e.key === "End") e.preventDefault(), k ? P(n) : W(n);
52
- else if (e.key === "Enter" || e.key === " ") e.preventDefault(), k ? N >= 0 && N < t.length && U(t[N].value) : W(0);
46
+ function X(e) {
47
+ if (h || g) return;
48
+ let t = n.length - 1;
49
+ if (e.key === "ArrowDown") e.preventDefault(), j ? I((e) => Math.min(e + 1, t)) : K(0);
50
+ else if (e.key === "ArrowUp") e.preventDefault(), j ? I((e) => Math.max(e - 1, 0)) : K(t);
51
+ else if (e.key === "Home") e.preventDefault(), j ? I(n.length === 0 ? -1 : 0) : K(0);
52
+ else if (e.key === "End") e.preventDefault(), j ? I(t) : K(t);
53
+ else if (e.key === "Enter" || e.key === " ") e.preventDefault(), j ? F >= 0 && F < n.length && G(n[F].value) : K(0);
53
54
  else if (e.key === "Escape") {
54
- if (!k) return;
55
- e.preventDefault(), G();
56
- } else e.key === "Tab" ? k && G() : e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), q(e.key));
55
+ if (!j) return;
56
+ e.preventDefault(), q();
57
+ } else e.key === "Tab" ? j && q() : e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), Y(e.key));
57
58
  }
58
- function Y(e) {
59
- m || h || e.target instanceof Element && e.target.closest(".multi-select__pill-remove") || (e.preventDefault(), I.current?.focus(), k ? G() : W(0));
59
+ function Z(e) {
60
+ h || g || e.target instanceof Element && e.target.closest(".multi-select__pill-remove") || (e.preventDefault(), R.current?.focus(), j ? q() : K(0));
60
61
  }
61
- n(() => {
62
- !k || N < 0 || document.getElementById(H(N))?.scrollIntoView({ block: "nearest" });
62
+ r(() => {
63
+ !j || F < 0 || document.getElementById(W(F))?.scrollIntoView({ block: "nearest" });
63
64
  }, [
64
- k,
65
- N,
66
- R
65
+ j,
66
+ F,
67
+ B
67
68
  ]);
68
- let X = [
69
+ let Q = [
69
70
  "multi-select",
70
- g === "md" ? "" : `multi-select--${g}`,
71
- m ? "multi-select--disabled" : "",
72
- b ? "multi-select--error" : "",
73
- S ?? ""
74
- ].filter(Boolean).join(" "), Z = ["multi-select__content", g === "md" ? "" : `multi-select__content--${g}`].filter(Boolean).join(" ");
75
- return /* @__PURE__ */ s(c.Root, {
76
- open: k,
77
- onOpenChange: K,
78
- children: [/* @__PURE__ */ s("div", {
79
- ref: F,
80
- className: X,
81
- "data-popup-open": k || void 0,
82
- onPointerDown: Y,
71
+ _ === "md" ? "" : `multi-select--${_}`,
72
+ h ? "multi-select--disabled" : "",
73
+ x ? "multi-select--error" : "",
74
+ C ?? ""
75
+ ].filter(Boolean).join(" "), $ = ["multi-select__content", _ === "md" ? "" : `multi-select__content--${_}`].filter(Boolean).join(" ");
76
+ return /* @__PURE__ */ c(l.Root, {
77
+ open: j,
78
+ onOpenChange: J,
79
+ children: [/* @__PURE__ */ c("div", {
80
+ ref: L,
81
+ className: Q,
82
+ "data-popup-open": j || void 0,
83
+ onPointerDown: Z,
83
84
  children: [
84
- /* @__PURE__ */ s("div", {
85
+ /* @__PURE__ */ c("div", {
85
86
  className: "multi-select__values",
86
- children: [V.map((n) => {
87
- let r = t.find((e) => e.value === n);
88
- return r ? /* @__PURE__ */ s("span", {
87
+ children: [U.map((e) => {
88
+ let r = n.find((t) => t.value === e);
89
+ return r ? /* @__PURE__ */ c("span", {
89
90
  className: "multi-select__pill",
90
- children: [/* @__PURE__ */ o("span", {
91
+ children: [/* @__PURE__ */ s("span", {
91
92
  className: "multi-select__pill-label",
92
93
  children: r.label
93
- }), !m && !h && /* @__PURE__ */ o("button", {
94
+ }), !h && !g && /* @__PURE__ */ s("button", {
94
95
  type: "button",
95
96
  className: "multi-select__pill-remove",
96
- "aria-label": E(r.label),
97
+ "aria-label": A("remove", D)(r.label),
97
98
  tabIndex: -1,
98
- onClick: (e) => {
99
- e.stopPropagation(), U(n), I.current?.focus();
99
+ onClick: (t) => {
100
+ t.stopPropagation(), G(e), R.current?.focus();
100
101
  },
101
- children: /* @__PURE__ */ o(e, {
102
+ children: /* @__PURE__ */ s(t, {
102
103
  name: "close",
103
104
  size: "xs"
104
105
  })
105
106
  })]
106
- }, n) : null;
107
- }), /* @__PURE__ */ o("div", {
107
+ }, e) : null;
108
+ }), /* @__PURE__ */ s("div", {
108
109
  ref: (e) => {
109
- I.current = e, l(O, e);
110
+ R.current = e, u(k, e);
110
111
  },
111
112
  className: "multi-select__combobox",
112
- tabIndex: m ? -1 : 0,
113
+ tabIndex: h ? -1 : 0,
113
114
  role: "combobox",
114
- "aria-expanded": k,
115
+ "aria-expanded": j,
115
116
  "aria-haspopup": "listbox",
116
- "aria-controls": k ? L : void 0,
117
- "aria-activedescendant": k && N >= 0 ? H(N) : void 0,
118
- "aria-label": w ? void 0 : C ?? p,
119
- "aria-labelledby": w,
120
- "aria-describedby": T,
121
- "aria-invalid": b || void 0,
122
- "aria-disabled": m || void 0,
123
- "aria-readonly": h || void 0,
124
- id: v,
125
- onKeyDown: J,
126
- onBlur: x,
127
- children: V.length === 0 && /* @__PURE__ */ o("span", {
117
+ "aria-controls": j ? z : void 0,
118
+ "aria-activedescendant": j && F >= 0 ? W(F) : void 0,
119
+ "aria-label": T ? void 0 : w ?? A("placeholder", m),
120
+ "aria-labelledby": T,
121
+ "aria-describedby": E,
122
+ "aria-invalid": x || void 0,
123
+ "aria-disabled": h || void 0,
124
+ "aria-readonly": g || void 0,
125
+ id: y,
126
+ onKeyDown: X,
127
+ onBlur: S,
128
+ children: U.length === 0 && /* @__PURE__ */ s("span", {
128
129
  className: "multi-select__placeholder",
129
- children: p
130
+ children: A("placeholder", m)
130
131
  })
131
132
  })]
132
133
  }),
133
- /* @__PURE__ */ o(e, {
134
+ /* @__PURE__ */ s(t, {
134
135
  name: "chevron",
135
136
  className: "multi-select__icon",
136
- size: g === "sm" ? "xs" : g === "lg" ? "md" : "sm"
137
+ size: _ === "sm" ? "xs" : _ === "lg" ? "md" : "sm"
137
138
  }),
138
- y && V.map((e) => /* @__PURE__ */ o("input", {
139
+ b && U.map((e) => /* @__PURE__ */ s("input", {
139
140
  type: "hidden",
140
- name: y,
141
+ name: b,
141
142
  value: e
142
143
  }, e))
143
144
  ]
144
- }), /* @__PURE__ */ o(c.Portal, {
145
- container: D,
146
- children: /* @__PURE__ */ o(c.Positioner, {
145
+ }), /* @__PURE__ */ s(l.Portal, {
146
+ container: O,
147
+ children: /* @__PURE__ */ s(l.Positioner, {
147
148
  className: "multi-select__positioner",
148
- anchor: F,
149
+ anchor: L,
149
150
  align: "start",
150
151
  sideOffset: -1,
151
- children: /* @__PURE__ */ o(c.Popup, {
152
- className: Z,
152
+ children: /* @__PURE__ */ s(l.Popup, {
153
+ className: $,
153
154
  initialFocus: !1,
154
155
  finalFocus: !1,
155
- children: /* @__PURE__ */ o("div", {
156
+ children: /* @__PURE__ */ s("div", {
156
157
  role: "listbox",
157
158
  "aria-multiselectable": "true",
158
- "aria-label": C ?? p,
159
- id: L,
160
- children: t.map((e, t) => {
161
- let n = V.includes(e.value), r = N === t;
162
- return /* @__PURE__ */ s("div", {
163
- id: H(t),
159
+ "aria-label": w ?? m,
160
+ id: z,
161
+ children: n.map((e, t) => {
162
+ let n = U.includes(e.value), r = F === t;
163
+ return /* @__PURE__ */ c("div", {
164
+ id: W(t),
164
165
  role: "option",
165
166
  "aria-selected": n,
166
167
  "aria-label": e["aria-label"] ?? e.label,
@@ -173,13 +174,13 @@ var u = 500, d = t(function({ options: t, value: d, defaultValue: f = [], placeh
173
174
  e.preventDefault(), e.stopPropagation();
174
175
  },
175
176
  onClick: () => {
176
- U(e.value), P(t), I.current?.focus();
177
+ G(e.value), I(t), R.current?.focus();
177
178
  },
178
- children: [/* @__PURE__ */ o("span", {
179
+ children: [/* @__PURE__ */ s("span", {
179
180
  className: "multi-select__item-check",
180
181
  "aria-hidden": "true",
181
- children: /* @__PURE__ */ o("span", { className: "multi-select__item-check-mark" })
182
- }), /* @__PURE__ */ o("span", { children: e.label })]
182
+ children: /* @__PURE__ */ s("span", { className: "multi-select__item-check-mark" })
183
+ }), /* @__PURE__ */ s("span", { children: e.label })]
183
184
  }, e.value);
184
185
  })
185
186
  })
@@ -189,4 +190,4 @@ var u = 500, d = t(function({ options: t, value: d, defaultValue: f = [], placeh
189
190
  });
190
191
  });
191
192
  //#endregion
192
- export { d as MultiSelect };
193
+ export { f as MultiSelect };
@@ -1,83 +1,84 @@
1
1
  'use client';
2
2
  import './number-input.css';
3
- import { Icon as e } from "./icon.js";
4
- import { forwardRef as t, useCallback as n, useState as r } from "react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { forwardRef as n, useCallback as r, useState as i } from "react";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
7
  //#region src/stories/atoms/NumberInput/NumberInput.tsx
7
- var o = t(function({ value: t, defaultValue: o = 0, min: s, max: c, step: l = 1, decimal: u = !1, disabled: d = !1, readOnly: f = !1, size: p = "md", error: m = !1, id: h, name: g, describedBy: _, ariaLabel: v, decrementLabel: y = "Decrementar", incrementLabel: b = "Incrementar", className: x, onChange: S, onBlur: C, onFocus: w, ...T }, E) {
8
- let D = t !== void 0, [O, k] = r(o), [A, j] = r(!1), [M, N] = r(null), P = D ? t : O, F = M === null ? String(P) : M, I = n((e) => {
8
+ var s = n(function({ value: n, defaultValue: s = 0, min: c, max: l, step: u = 1, decimal: d = !1, disabled: f = !1, readOnly: p = !1, size: m = "md", error: h = !1, id: g, name: _, describedBy: v, ariaLabel: y, decrementLabel: b, incrementLabel: x, className: S, onChange: C, onBlur: w, onFocus: T, ...E }, D) {
9
+ let O = e("numberInput"), k = n !== void 0, [A, j] = i(s), [M, N] = i(!1), [P, F] = i(null), I = k ? n : A, L = P === null ? String(I) : P, R = r((e) => {
9
10
  let t = e;
10
- return s !== void 0 && (t = Math.max(s, t)), c !== void 0 && (t = Math.min(c, t)), t;
11
- }, [s, c]), L = n((e) => {
12
- let t = I(e);
13
- D || k(t), S?.(t);
11
+ return c !== void 0 && (t = Math.max(c, t)), l !== void 0 && (t = Math.min(l, t)), t;
12
+ }, [c, l]), z = r((e) => {
13
+ let t = R(e);
14
+ k || j(t), C?.(t);
14
15
  }, [
15
- I,
16
- D,
17
- S
18
- ]), R = () => {
19
- d || f || (N(null), L(P - l));
20
- }, z = () => {
21
- d || f || (N(null), L(P + l));
22
- }, B = (e) => {
23
- let t = e.target.value;
24
- N(t);
25
- let n = u ? t.replace(",", ".") : t, r = parseFloat(n);
26
- isNaN(r) || L(r);
27
- }, V = (e) => {
28
- j(!0), w?.(e);
16
+ R,
17
+ k,
18
+ C
19
+ ]), B = () => {
20
+ f || p || (F(null), z(I - u));
21
+ }, V = () => {
22
+ f || p || (F(null), z(I + u));
29
23
  }, H = (e) => {
30
- j(!1), N(null), C?.(e);
31
- }, U = [
24
+ let t = e.target.value;
25
+ F(t);
26
+ let n = d ? t.replace(",", ".") : t, r = parseFloat(n);
27
+ isNaN(r) || z(r);
28
+ }, U = (e) => {
29
+ N(!0), T?.(e);
30
+ }, W = (e) => {
31
+ N(!1), F(null), w?.(e);
32
+ }, G = [
32
33
  "number-input",
33
- p === "md" ? "" : `number-input--${p}`,
34
- m ? "number-input--error" : "",
35
- d ? "number-input--disabled" : "",
36
- A ? "number-input--focused" : "",
37
- x ?? ""
38
- ].filter(Boolean).join(" "), W = d || f || s !== void 0 && P <= s, G = d || f || c !== void 0 && P >= c;
39
- return /* @__PURE__ */ a("div", {
40
- className: U,
34
+ m === "md" ? "" : `number-input--${m}`,
35
+ h ? "number-input--error" : "",
36
+ f ? "number-input--disabled" : "",
37
+ M ? "number-input--focused" : "",
38
+ S ?? ""
39
+ ].filter(Boolean).join(" "), K = f || p || c !== void 0 && I <= c, q = f || p || l !== void 0 && I >= l;
40
+ return /* @__PURE__ */ o("div", {
41
+ className: G,
41
42
  children: [
42
- /* @__PURE__ */ i("button", {
43
+ /* @__PURE__ */ a("button", {
43
44
  className: "number-input__btn number-input__btn--decrement",
44
45
  type: "button",
45
- onClick: R,
46
- disabled: W,
47
- "aria-label": y,
46
+ onClick: B,
47
+ disabled: K,
48
+ "aria-label": O("decrement", b),
48
49
  tabIndex: -1,
49
- children: /* @__PURE__ */ i(e, {
50
+ children: /* @__PURE__ */ a(t, {
50
51
  name: "minus",
51
52
  size: "sm"
52
53
  })
53
54
  }),
54
- /* @__PURE__ */ i("input", {
55
- ref: E,
55
+ /* @__PURE__ */ a("input", {
56
+ ref: D,
56
57
  className: "number-input__field",
57
58
  type: "text",
58
- inputMode: u ? "decimal" : "numeric",
59
- pattern: u ? "[0-9]*[.,]?[0-9]*" : "[0-9]*",
60
- "aria-invalid": m || void 0,
61
- "aria-describedby": _,
62
- "aria-label": v,
63
- ...T,
64
- id: h,
65
- name: g,
66
- value: F,
67
- disabled: d,
68
- readOnly: f,
69
- onChange: B,
70
- onFocus: V,
71
- onBlur: H
59
+ inputMode: d ? "decimal" : "numeric",
60
+ pattern: d ? "[0-9]*[.,]?[0-9]*" : "[0-9]*",
61
+ "aria-invalid": h || void 0,
62
+ "aria-describedby": v,
63
+ "aria-label": y,
64
+ ...E,
65
+ id: g,
66
+ name: _,
67
+ value: L,
68
+ disabled: f,
69
+ readOnly: p,
70
+ onChange: H,
71
+ onFocus: U,
72
+ onBlur: W
72
73
  }),
73
- /* @__PURE__ */ i("button", {
74
+ /* @__PURE__ */ a("button", {
74
75
  className: "number-input__btn number-input__btn--increment",
75
76
  type: "button",
76
- onClick: z,
77
- disabled: G,
78
- "aria-label": b,
77
+ onClick: V,
78
+ disabled: q,
79
+ "aria-label": O("increment", x),
79
80
  tabIndex: -1,
80
- children: /* @__PURE__ */ i(e, {
81
+ children: /* @__PURE__ */ a(t, {
81
82
  name: "plus",
82
83
  size: "sm"
83
84
  })
@@ -86,4 +87,4 @@ var o = t(function({ value: t, defaultValue: o = 0, min: s, max: c, step: l = 1,
86
87
  });
87
88
  });
88
89
  //#endregion
89
- export { o as NumberInput };
90
+ export { s as NumberInput };