@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
package/dist/calendar.js CHANGED
@@ -1,121 +1,122 @@
1
1
  'use client';
2
2
  import './calendar.css';
3
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s as ee, t as te } from "./_shared/calendargrid.js";
4
- import { useCallback as s, useEffect as c, useId as ne, useRef as l, useState as u } from "react";
5
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { a as t, c as n, i as r, l as i, n as a, o, r as ee, s as te, t as ne } from "./_shared/calendargrid.js";
5
+ import { useCallback as s, useEffect as c, useId as l, useRef as u, useState as d } from "react";
6
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
7
  //#region src/stories/molecules/Calendar/Calendar.tsx
7
- var p = 12, m = 4;
8
- function h(e) {
9
- return Math.floor(e / p) * p;
8
+ var m = 12, h = 4;
9
+ function g(e) {
10
+ return Math.floor(e / m) * m;
10
11
  }
11
- function g({ value: g, onChange: _, defaultMonth: v, month: y, onMonthChange: b, navigable: re = !0, disabledDates: x, minDate: S, maxDate: C, locale: w = "es-ES", previousMonthLabel: T = "Mes anterior", nextMonthLabel: ie = "Mes siguiente", previousYearsLabel: ae = "Años anteriores", nextYearsLabel: oe = "Años siguientes", yearGridLabel: se = "Elegir año", gridLabel: E, size: D = "md", className: O }) {
12
- let [k, A] = u(() => y ?? v ?? (g instanceof Date ? g : /* @__PURE__ */ new Date())), j = y ?? k, M = s((e) => {
13
- A(e), b?.(e);
14
- }, [b]), N = /* @__PURE__ */ new Date(), ce = s((e) => S && e < S || C && e > C ? !0 : Array.isArray(x) ? x.some((t) => n(t, e)) : typeof x == "function" ? x(e) : !1, [
12
+ function _({ value: _, onChange: re, defaultMonth: ie, month: v, onMonthChange: y, navigable: b = !0, disabledDates: x, minDate: S, maxDate: C, locale: w = "es-ES", previousMonthLabel: ae, nextMonthLabel: oe, previousYearsLabel: T, nextYearsLabel: E, yearGridLabel: D, gridLabel: O, size: k = "md", className: A }) {
13
+ let j = e("calendar"), [se, ce] = d(() => v ?? ie ?? (_ instanceof Date ? _ : /* @__PURE__ */ new Date())), M = v ?? se, N = s((e) => {
14
+ ce(e), y?.(e);
15
+ }, [y]), P = /* @__PURE__ */ new Date(), le = s((e) => S && e < S || C && e > C ? !0 : Array.isArray(x) ? x.some((t) => r(t, e)) : typeof x == "function" ? x(e) : !1, [
15
16
  x,
16
17
  S,
17
18
  C
18
- ]), P = r({
19
- month: j,
20
- onMonthChange: M,
21
- selected: g ?? null,
19
+ ]), F = i({
20
+ month: M,
21
+ onMonthChange: N,
22
+ selected: _ ?? null,
22
23
  minDate: S,
23
24
  maxDate: C
24
- }), [F, I] = u("days"), [L, R] = u(() => h(j.getFullYear())), [z, B] = u(() => j.getFullYear()), V = l(null), H = l(/* @__PURE__ */ new Map()), U = l(null), W = s(() => {
25
- let e = j.getFullYear();
26
- R(h(e)), B(e), U.current = "year", I("years");
27
- }, [j]), G = s(() => {
28
- U.current = "title", I("days");
29
- }, []), le = s((e) => {
30
- M(new Date(e, j.getMonth(), 1)), G();
25
+ }), [I, L] = d("days"), [R, z] = d(() => g(M.getFullYear())), [B, V] = d(() => M.getFullYear()), H = u(null), U = u(/* @__PURE__ */ new Map()), W = u(null), ue = s(() => {
26
+ let e = M.getFullYear();
27
+ z(g(e)), V(e), W.current = "year", L("years");
28
+ }, [M]), G = s(() => {
29
+ W.current = "title", L("days");
30
+ }, []), de = s((e) => {
31
+ N(new Date(e, M.getMonth(), 1)), G();
31
32
  }, [
32
33
  G,
33
- j,
34
- M
34
+ M,
35
+ N
35
36
  ]);
36
37
  c(() => {
37
- if (!U.current) return;
38
- let e = U.current;
39
- U.current = null, e === "title" ? V.current?.focus() : H.current.get(z)?.focus();
40
- }, [F, z]);
41
- let ue = D === "sm" ? "xs" : D === "lg" ? "md" : "sm", de = new Intl.DateTimeFormat(w, {
38
+ if (!W.current) return;
39
+ let e = W.current;
40
+ W.current = null, e === "title" ? H.current?.focus() : U.current.get(B)?.focus();
41
+ }, [I, B]);
42
+ let fe = k === "sm" ? "xs" : k === "lg" ? "md" : "sm", pe = new Intl.DateTimeFormat(w, {
42
43
  month: "long",
43
44
  year: "numeric"
44
- }).format(j), fe = new Intl.DateTimeFormat(w, { year: "numeric" }), K = (e) => fe.format(new Date(e, 0, 1)), pe = Array.from({ length: p }, (e, t) => L + t), me = `${K(L)}–${K(L + p - 1)}`, he = new Intl.DateTimeFormat(w, {
45
+ }).format(M), me = new Intl.DateTimeFormat(w, { year: "numeric" }), K = (e) => me.format(new Date(e, 0, 1)), he = Array.from({ length: m }, (e, t) => R + t), ge = `${K(R)}–${K(R + m - 1)}`, _e = new Intl.DateTimeFormat(w, {
45
46
  weekday: "long",
46
47
  day: "numeric",
47
48
  month: "long",
48
49
  year: "numeric"
49
- }), ge = o(w, "narrow"), _e = te(i(j)), q = t(j, -1), J = t(j, 1), Y = S ? !e(q, S) && q < S : !1, ve = C ? !e(J, C) && J > C : !1, ye = (e) => (S ? e < S.getFullYear() : !1) || (C ? e > C.getFullYear() : !1), be = S ? L - 1 < S.getFullYear() : !1, xe = C ? L + p > C.getFullYear() : !1, X = F === "years", Z = z >= L && z <= L + p - 1 ? z : L, Se = (e) => {
50
- (e < L || e > L + p - 1) && R(h(e)), U.current = "year", B(e);
51
- }, Ce = (e) => {
50
+ }), ve = ee(w, "narrow"), ye = ne(a(M)), q = n(M, -1), J = n(M, 1), be = S ? !t(q, S) && q < S : !1, xe = C ? !t(J, C) && J > C : !1, Se = (e) => (S ? e < S.getFullYear() : !1) || (C ? e > C.getFullYear() : !1), Ce = S ? R - 1 < S.getFullYear() : !1, we = C ? R + m > C.getFullYear() : !1, Y = I === "years", X = B >= R && B <= R + m - 1 ? B : R, Te = (e) => {
51
+ (e < R || e > R + m - 1) && z(g(e)), W.current = "year", V(e);
52
+ }, Z = (e) => {
52
53
  let t = null;
53
54
  switch (e.key) {
54
55
  case "ArrowLeft":
55
- t = Z - 1;
56
+ t = X - 1;
56
57
  break;
57
58
  case "ArrowRight":
58
- t = Z + 1;
59
+ t = X + 1;
59
60
  break;
60
61
  case "ArrowUp":
61
- t = Z - m;
62
+ t = X - h;
62
63
  break;
63
64
  case "ArrowDown":
64
- t = Z + m;
65
+ t = X + h;
65
66
  break;
66
67
  case "Home":
67
- t = L;
68
+ t = R;
68
69
  break;
69
70
  case "End":
70
- t = L + p - 1;
71
+ t = R + m - 1;
71
72
  break;
72
73
  case "PageUp":
73
- t = Z - p;
74
+ t = X - m;
74
75
  break;
75
76
  case "PageDown":
76
- t = Z + p;
77
+ t = X + m;
77
78
  break;
78
79
  case "Escape":
79
80
  e.preventDefault(), G();
80
81
  return;
81
82
  default: return;
82
83
  }
83
- e.preventDefault(), Se(t);
84
- }, Q = ne(), $ = X ? `${Q}-calendar-title-${L}` : `${Q}-calendar-title-${j.getFullYear()}-${j.getMonth()}`;
85
- return /* @__PURE__ */ f("div", {
84
+ e.preventDefault(), Te(t);
85
+ }, Q = l(), $ = Y ? `${Q}-calendar-title-${R}` : `${Q}-calendar-title-${M.getFullYear()}-${M.getMonth()}`;
86
+ return /* @__PURE__ */ p("div", {
86
87
  className: [
87
88
  "calendar",
88
- `calendar--${D}`,
89
- O
89
+ `calendar--${k}`,
90
+ A
90
91
  ].filter(Boolean).join(" "),
91
- children: [a({
92
+ children: [o({
92
93
  block: "calendar",
93
- title: X ? me : de,
94
+ title: Y ? ge : pe,
94
95
  titleId: $,
95
- navigable: re,
96
- previousLabel: X ? ae : T,
97
- nextLabel: X ? oe : ie,
98
- prevDisabled: X ? be : Y,
99
- nextDisabled: X ? xe : ve,
100
- onPrev: X ? () => R(L - p) : () => M(q),
101
- onNext: X ? () => R(L + p) : () => M(J),
102
- chevronSize: ue,
103
- onTitleClick: X ? G : W,
104
- titleExpanded: X,
105
- titleRef: V
106
- }), X ? /* @__PURE__ */ d("div", {
96
+ navigable: b,
97
+ previousLabel: b ? Y ? j("previousYears", T) : j("previousMonth", ae) : void 0,
98
+ nextLabel: b ? Y ? j("nextYears", E) : j("nextMonth", oe) : void 0,
99
+ prevDisabled: Y ? Ce : be,
100
+ nextDisabled: Y ? we : xe,
101
+ onPrev: Y ? () => z(R - m) : () => N(q),
102
+ onNext: Y ? () => z(R + m) : () => N(J),
103
+ chevronSize: fe,
104
+ onTitleClick: Y ? G : ue,
105
+ titleExpanded: Y,
106
+ titleRef: H
107
+ }), Y ? /* @__PURE__ */ f("div", {
107
108
  className: "calendar__years",
108
109
  role: "grid",
109
- "aria-label": se,
110
- onKeyDown: Ce,
111
- children: Array.from({ length: p / m }, (e, t) => /* @__PURE__ */ d("div", {
110
+ "aria-label": j("yearGrid", D),
111
+ onKeyDown: Z,
112
+ children: Array.from({ length: m / h }, (e, t) => /* @__PURE__ */ f("div", {
112
113
  role: "row",
113
114
  className: "calendar__row",
114
- children: pe.slice(t * m, t * m + m).map((e) => {
115
- let t = ye(e), n = e === N.getFullYear(), r = g instanceof Date ? g.getFullYear() === e : !1;
116
- return /* @__PURE__ */ d("button", {
115
+ children: he.slice(t * h, t * h + h).map((e) => {
116
+ let t = Se(e), n = e === P.getFullYear(), r = _ instanceof Date ? _.getFullYear() === e : !1;
117
+ return /* @__PURE__ */ f("button", {
117
118
  ref: (t) => {
118
- t ? H.current.set(e, t) : H.current.delete(e);
119
+ t ? U.current.set(e, t) : U.current.delete(e);
119
120
  },
120
121
  type: "button",
121
122
  role: "gridcell",
@@ -128,45 +129,45 @@ function g({ value: g, onChange: _, defaultMonth: v, month: y, onMonthChange: b,
128
129
  "aria-selected": r,
129
130
  "aria-disabled": t ? "true" : void 0,
130
131
  "aria-current": n ? "date" : void 0,
131
- tabIndex: e === Z ? 0 : -1,
132
- onFocus: () => B(e),
133
- onClick: t ? void 0 : () => le(e),
132
+ tabIndex: e === X ? 0 : -1,
133
+ onFocus: () => V(e),
134
+ onClick: t ? void 0 : () => de(e),
134
135
  children: K(e)
135
136
  }, e);
136
137
  })
137
138
  }, t))
138
- }) : /* @__PURE__ */ f("div", {
139
+ }) : /* @__PURE__ */ p("div", {
139
140
  className: "calendar__grid",
140
141
  role: "grid",
141
- "aria-label": E,
142
- "aria-labelledby": E ? void 0 : $,
143
- onKeyDown: P.onKeyDown,
144
- children: [ee({
142
+ "aria-label": O,
143
+ "aria-labelledby": O ? void 0 : $,
144
+ onKeyDown: F.onKeyDown,
145
+ children: [te({
145
146
  block: "calendar",
146
- weekdays: ge
147
- }), _e.map((e, t) => /* @__PURE__ */ d("div", {
147
+ weekdays: ve
148
+ }), ye.map((e, t) => /* @__PURE__ */ f("div", {
148
149
  role: "row",
149
150
  className: "calendar__row",
150
151
  children: e.map(({ date: e, outside: t }) => {
151
- let r = ce(e), i = n(e, N), a = g instanceof Date ? n(e, g) : !1, o = [
152
+ let n = le(e), i = r(e, P), a = _ instanceof Date ? r(e, _) : !1, o = [
152
153
  "calendar__day",
153
154
  t && "calendar__day--outside",
154
155
  i && "calendar__day--today",
155
156
  a && "calendar__day--selected",
156
- r && "calendar__day--disabled"
157
+ n && "calendar__day--disabled"
157
158
  ].filter(Boolean).join(" ");
158
- return /* @__PURE__ */ d("button", {
159
- ref: P.cellRef(e),
159
+ return /* @__PURE__ */ f("button", {
160
+ ref: F.cellRef(e),
160
161
  type: "button",
161
162
  role: "gridcell",
162
163
  className: o,
163
- "aria-label": he.format(e),
164
+ "aria-label": _e.format(e),
164
165
  "aria-selected": a,
165
- "aria-disabled": r ? "true" : void 0,
166
+ "aria-disabled": n ? "true" : void 0,
166
167
  "aria-current": i ? "date" : void 0,
167
- tabIndex: P.isTabbable(e) ? 0 : -1,
168
- onFocus: () => P.onCellFocus(e),
169
- onClick: r ? void 0 : () => _?.(e),
168
+ tabIndex: F.isTabbable(e) ? 0 : -1,
169
+ onFocus: () => F.onCellFocus(e),
170
+ onClick: n ? void 0 : () => re?.(e),
170
171
  children: e.getDate()
171
172
  }, e.toISOString());
172
173
  })
@@ -175,4 +176,4 @@ function g({ value: g, onChange: _, defaultMonth: v, month: y, onMonthChange: b,
175
176
  });
176
177
  }
177
178
  //#endregion
178
- export { g as Calendar };
179
+ export { _ as Calendar };
@@ -1,60 +1,61 @@
1
1
  'use client';
2
2
  import './docs-search.css';
3
- import { Spinner as e } from "./spinner.js";
4
- import { InputField as t } from "./input-field.js";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Spinner as t } from "./spinner.js";
5
+ import { InputField as n } from "./input-field.js";
5
6
  import "react";
6
- import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
7
- import { Autocomplete as a } from "@base-ui/react/autocomplete";
7
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
8
+ import { Autocomplete as o } from "@base-ui/react/autocomplete";
8
9
  //#region src/stories/molecules/DocsSearch/DocsSearch.tsx
9
- function o(e) {
10
- return /* @__PURE__ */ r("a", { ...e });
10
+ function s(e) {
11
+ return /* @__PURE__ */ i("a", { ...e });
11
12
  }
12
- function s({ id: s = "docs-search", query: c, onQueryChange: l, results: u, loading: d = !1, label: f = "Buscar en la documentación", labelHidden: p, placeholder: m = "Buscar…", clearable: h = !0, clearLabel: g = "Borrar", resultsLabel: _ = "Resultados", emptyLabel: v = "Sin resultados.", loadingLabel: y = "Buscando…", size: b, renderLink: x = o, onSelect: S, className: C }) {
13
- let w = c.trim() !== "" && u.length === 0 ? d ? y : v : null;
14
- return /* @__PURE__ */ r(a.Root, {
13
+ function c({ id: c = "docs-search", query: l, onQueryChange: u, results: d, loading: f = !1, label: p, labelHidden: m, placeholder: h, clearable: g = !0, clearLabel: _, resultsLabel: v, emptyLabel: y, loadingLabel: b, size: x, renderLink: S = s, onSelect: C, className: w }) {
14
+ let T = e("docsSearch"), E = l.trim() !== "" && d.length === 0 ? f ? T("loading", b) : T("empty", y) : null;
15
+ return /* @__PURE__ */ i(o.Root, {
15
16
  inline: !0,
16
17
  open: !0,
17
- items: u,
18
+ items: d,
18
19
  filter: null,
19
- value: c,
20
- onValueChange: l,
21
- children: /* @__PURE__ */ i("div", {
22
- className: ["docs-search", C].filter(Boolean).join(" "),
20
+ value: l,
21
+ onValueChange: u,
22
+ children: /* @__PURE__ */ a("div", {
23
+ className: ["docs-search", w].filter(Boolean).join(" "),
23
24
  children: [
24
- /* @__PURE__ */ r(a.Input, {
25
- id: s,
26
- render: /* @__PURE__ */ r(t, {
27
- id: s,
28
- label: f,
29
- labelHidden: p,
25
+ /* @__PURE__ */ i(o.Input, {
26
+ id: c,
27
+ render: /* @__PURE__ */ i(n, {
28
+ id: c,
29
+ label: T("label", p),
30
+ labelHidden: m,
30
31
  kind: "search",
31
- clearable: h,
32
- clearLabel: g,
33
- placeholder: m,
34
- ...b ? { size: b } : {}
32
+ clearable: g,
33
+ ..._ === void 0 ? {} : { clearLabel: _ },
34
+ placeholder: T("placeholder", h),
35
+ ...x ? { size: x } : {}
35
36
  })
36
37
  }),
37
- /* @__PURE__ */ r(a.List, {
38
+ /* @__PURE__ */ i(o.List, {
38
39
  className: "docs-search__results",
39
- "aria-label": _,
40
- children: (e) => /* @__PURE__ */ r(a.Item, {
40
+ "aria-label": T("results", v),
41
+ children: (e) => /* @__PURE__ */ i(o.Item, {
41
42
  value: e,
42
43
  className: "docs-search__result",
43
- onClick: () => S?.(e),
44
- render: (t) => x({
44
+ onClick: () => C?.(e),
45
+ render: (t) => S({
45
46
  ...t,
46
47
  href: e.href,
47
48
  className: t.className ?? "docs-search__result",
48
- children: /* @__PURE__ */ i(n, { children: [
49
- e.product && /* @__PURE__ */ r("span", {
49
+ children: /* @__PURE__ */ a(r, { children: [
50
+ e.product && /* @__PURE__ */ i("span", {
50
51
  className: "docs-search__result-product",
51
52
  children: e.product
52
53
  }),
53
- /* @__PURE__ */ r("span", {
54
+ /* @__PURE__ */ i("span", {
54
55
  className: "docs-search__result-title",
55
56
  children: e.title
56
57
  }),
57
- e.excerpt && /* @__PURE__ */ r("span", {
58
+ e.excerpt && /* @__PURE__ */ i("span", {
58
59
  className: "docs-search__result-excerpt",
59
60
  children: e.excerpt
60
61
  })
@@ -62,17 +63,17 @@ function s({ id: s = "docs-search", query: c, onQueryChange: l, results: u, load
62
63
  })
63
64
  }, e.href)
64
65
  }),
65
- w && /* @__PURE__ */ i("p", {
66
+ E && /* @__PURE__ */ a("p", {
66
67
  className: "docs-search__status",
67
68
  role: "status",
68
- children: [d && /* @__PURE__ */ r(e, {
69
+ children: [f && /* @__PURE__ */ i(t, {
69
70
  size: "sm",
70
71
  "aria-hidden": !0
71
- }), w]
72
+ }), E]
72
73
  })
73
74
  ]
74
75
  })
75
76
  });
76
77
  }
77
78
  //#endregion
78
- export { s as DocsSearch };
79
+ export { c as DocsSearch };
@@ -1 +1 @@
1
- .filter-bar{gap:var(--filter-bar-gap);flex-direction:column;display:flex}.filter-bar__search{inline-size:100%}.filter-bar__row{grid-template-columns:repeat(auto-fill, minmax(min(var(--filter-bar-column-min-inline-size), 100%), 1fr));column-gap:var(--filter-bar-column-gap);row-gap:var(--filter-bar-row-gap);display:grid}.filter-bar__filters{display:contents}.filter-bar__filter{min-inline-size:0}.filter-bar__actions{align-items:stretch;gap:var(--filter-bar-actions-gap);flex-direction:column;min-inline-size:0;display:flex}.filter-bar__actions>*{inline-size:100%}@media (width>=768px){.filter-bar__actions{flex-flow:wrap;align-items:center}.filter-bar__actions>*{inline-size:auto}:is(.filter-bar__row:has(.label:not(.visually-hidden)) .filter-bar__filter:not(:has(.label:not(.visually-hidden))),.filter-bar__row:has(.label:not(.visually-hidden))>.filter-bar__actions){align-self:start;padding-block-start:var(--filter-bar-label-offset)}.filter-bar__row:has(.label:not(.visually-hidden)) .filter-bar__filter:not(:has(.label:not(.visually-hidden))){block-size:calc(var(--filter-bar-label-offset) + var(--filter-bar-control-block-size));flex-direction:column;justify-content:center;display:flex}.filter-bar__row:has(.label:not(.visually-hidden))>.filter-bar__actions{min-block-size:calc(var(--filter-bar-label-offset) + var(--filter-bar-control-block-size))}}
1
+ .filter-bar{gap:var(--filter-bar-gap);flex-direction:column;display:flex}.filter-bar__search{inline-size:100%}.filter-bar__row{column-gap:var(--filter-bar-column-gap);row-gap:var(--filter-bar-row-gap);grid-template-columns:1fr;display:grid}.filter-bar__filters{display:contents}.filter-bar__filter{min-inline-size:0}.filter-bar__actions{align-items:stretch;gap:var(--filter-bar-actions-gap);flex-direction:column;min-inline-size:0;display:flex}.filter-bar__actions>*{inline-size:100%}@media (width>=768px){.filter-bar__row{grid-template-columns:repeat(auto-fill, minmax(min(var(--filter-bar-column-min-inline-size), 100%), 1fr))}.filter-bar__actions{flex-flow:wrap;align-items:center}.filter-bar__actions>*{inline-size:auto}:is(.filter-bar__row:has(.label:not(.visually-hidden)) .filter-bar__filter:not(:has(.label:not(.visually-hidden))),.filter-bar__row:has(.label:not(.visually-hidden))>.filter-bar__actions){align-self:start;padding-block-start:var(--filter-bar-label-offset)}.filter-bar__row:has(.label:not(.visually-hidden)) .filter-bar__filter:not(:has(.label:not(.visually-hidden))){block-size:calc(var(--filter-bar-label-offset) + var(--filter-bar-control-block-size));flex-direction:column;justify-content:center;display:flex}.filter-bar__row:has(.label:not(.visually-hidden))>.filter-bar__actions{min-block-size:calc(var(--filter-bar-label-offset) + var(--filter-bar-control-block-size))}}
@@ -1,31 +1,33 @@
1
+ 'use client';
1
2
  import './filter-bar.css';
2
- import { Children as e } from "react";
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Children as t } from "react";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
6
  //#region src/stories/molecules/FilterBar/FilterBar.tsx
5
- function r({ search: r, children: i, actions: a, ariaLabel: o = "Filtros", className: s, ...c }) {
6
- let l = e.toArray(i);
7
- return /* @__PURE__ */ n("div", {
8
- className: ["filter-bar", s].filter(Boolean).join(" "),
7
+ function i({ search: i, children: a, actions: o, ariaLabel: s, className: c, ...l }) {
8
+ let u = e("filterBar"), d = t.toArray(a);
9
+ return /* @__PURE__ */ r("div", {
10
+ className: ["filter-bar", c].filter(Boolean).join(" "),
9
11
  role: "search",
10
- "aria-label": o,
11
- ...c,
12
- children: [r && /* @__PURE__ */ t("div", {
12
+ "aria-label": u("label", s),
13
+ ...l,
14
+ children: [i && /* @__PURE__ */ n("div", {
13
15
  className: "filter-bar__search",
14
- children: r
15
- }), (l.length > 0 || a) && /* @__PURE__ */ n("div", {
16
+ children: i
17
+ }), (d.length > 0 || o) && /* @__PURE__ */ r("div", {
16
18
  className: "filter-bar__row",
17
- children: [l.length > 0 && /* @__PURE__ */ t("div", {
19
+ children: [d.length > 0 && /* @__PURE__ */ n("div", {
18
20
  className: "filter-bar__filters",
19
- children: l.map((e, n) => /* @__PURE__ */ t("div", {
21
+ children: d.map((e, t) => /* @__PURE__ */ n("div", {
20
22
  className: "filter-bar__filter",
21
23
  children: e
22
- }, n))
23
- }), a && /* @__PURE__ */ t("div", {
24
+ }, t))
25
+ }), o && /* @__PURE__ */ n("div", {
24
26
  className: "filter-bar__actions",
25
- children: a
27
+ children: o
26
28
  })]
27
29
  })]
28
30
  });
29
31
  }
30
32
  //#endregion
31
- export { r as FilterBar };
33
+ export { i as FilterBar };
@@ -1,100 +1,101 @@
1
1
  'use client';
2
2
  import './input-field.css';
3
- import { Icon as e } from "./icon.js";
4
- import { n as t } from "./_shared/form-size.js";
5
- import { ErrorText as n } from "./error-text.js";
6
- import { Input as r } from "./input.js";
7
- import { Label as i } from "./label.js";
8
- import { n as a } from "./_shared/field-labels.js";
9
- import { forwardRef as o, useImperativeHandle as s, useRef as c, useState as l } from "react";
10
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { n } from "./_shared/form-size.js";
6
+ import { ErrorText as r } from "./error-text.js";
7
+ import { Input as i } from "./input.js";
8
+ import { Label as a } from "./label.js";
9
+ import { n as o } from "./_shared/field-labels.js";
10
+ import { forwardRef as s, useImperativeHandle as c, useRef as l, useState as u } from "react";
11
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
11
12
  //#region src/stories/molecules/InputField/InputField.tsx
12
- var f = o(function({ id: o, label: f, labelHidden: p, name: m, type: h, kind: g = "text", clearable: _ = !1, clearLabel: v = "Borrar", onClear: y, placeholder: b, value: x, defaultValue: S, disabled: C, readOnly: w, size: T, error: E = !1, errorMessage: D, helperText: O, onChange: k, onBlur: A, onFocus: j, className: M, ...N }, P) {
13
- let F = a(p), I = t(T), L = D ? `${o}-error` : void 0, R = O ? `${o}-helper` : void 0, z = [
14
- L,
15
- R,
16
- N["aria-describedby"]
17
- ].filter(Boolean).join(" ") || void 0, B = E || !!D, V = g === "search", H = c(null);
18
- s(P, () => H.current);
19
- let [U, W] = l(() => (S ?? "") !== ""), G = V && _ && (x === void 0 ? U : x !== "") && !C && !w;
20
- function K(e) {
21
- x === void 0 && W(e.target.value !== ""), k?.(e);
13
+ var p = s(function({ id: s, label: p, labelHidden: m, name: h, type: g, kind: _ = "text", clearable: v = !1, clearLabel: y, onClear: b, placeholder: x, value: S, defaultValue: C, disabled: w, readOnly: T, size: E, error: D = !1, errorMessage: O, helperText: k, onChange: A, onBlur: j, onFocus: M, className: N, ...P }, F) {
14
+ let I = e("inputField"), L = o(m), R = n(E), z = O ? `${s}-error` : void 0, B = k ? `${s}-helper` : void 0, V = [
15
+ z,
16
+ B,
17
+ P["aria-describedby"]
18
+ ].filter(Boolean).join(" ") || void 0, H = D || !!O, U = _ === "search", W = l(null);
19
+ c(F, () => W.current);
20
+ let [G, K] = u(() => (C ?? "") !== ""), q = U && v && (S === void 0 ? G : S !== "") && !w && !T;
21
+ function J(e) {
22
+ S === void 0 && K(e.target.value !== ""), A?.(e);
22
23
  }
23
- function q() {
24
- let e = H.current;
25
- e && ((Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), W(!1), e.focus(), y?.());
24
+ function Y() {
25
+ let e = W.current;
26
+ e && ((Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set)?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 })), K(!1), e.focus(), b?.());
26
27
  }
27
- let J = /* @__PURE__ */ u(r, {
28
- ref: H,
29
- ...V ? {
28
+ let X = /* @__PURE__ */ d(i, {
29
+ ref: W,
30
+ ...U ? {
30
31
  type: "text",
31
32
  autoComplete: "off",
32
33
  enterKeyHint: "search"
33
- } : { type: h },
34
- ...N,
35
- id: o,
36
- name: m,
37
- placeholder: b ?? (F ? f : void 0),
38
- value: x,
39
- defaultValue: S,
40
- disabled: C,
41
- readOnly: w,
42
- size: I,
43
- error: B,
44
- "aria-describedby": z,
45
- onChange: K,
46
- onBlur: A,
47
- onFocus: j
34
+ } : { type: g },
35
+ ...P,
36
+ id: s,
37
+ name: h,
38
+ placeholder: x ?? (L ? p : void 0),
39
+ value: S,
40
+ defaultValue: C,
41
+ disabled: w,
42
+ readOnly: T,
43
+ size: R,
44
+ error: H,
45
+ "aria-describedby": V,
46
+ onChange: J,
47
+ onBlur: j,
48
+ onFocus: M
48
49
  });
49
- return /* @__PURE__ */ d("div", {
50
- className: ["input-field", M].filter(Boolean).join(" "),
50
+ return /* @__PURE__ */ f("div", {
51
+ className: ["input-field", N].filter(Boolean).join(" "),
51
52
  children: [
52
- /* @__PURE__ */ u(i, {
53
- htmlFor: o,
54
- hidden: F,
55
- size: I,
56
- children: f
53
+ /* @__PURE__ */ d(a, {
54
+ htmlFor: s,
55
+ hidden: L,
56
+ size: R,
57
+ children: p
57
58
  }),
58
- V ? /* @__PURE__ */ d("div", {
59
+ U ? /* @__PURE__ */ f("div", {
59
60
  className: [
60
61
  "input-field__search",
61
- I === "md" ? "" : `input-field__search--${I}`,
62
- _ ? "input-field__search--clearable" : ""
62
+ R === "md" ? "" : `input-field__search--${R}`,
63
+ v ? "input-field__search--clearable" : ""
63
64
  ].filter(Boolean).join(" "),
64
65
  children: [
65
- /* @__PURE__ */ u("span", {
66
+ /* @__PURE__ */ d("span", {
66
67
  className: "input-field__search-icon",
67
68
  "aria-hidden": "true",
68
- children: /* @__PURE__ */ u(e, {
69
+ children: /* @__PURE__ */ d(t, {
69
70
  name: "search",
70
71
  className: "input-field__search-glyph"
71
72
  })
72
73
  }),
73
- J,
74
- G && /* @__PURE__ */ u("button", {
74
+ X,
75
+ q && /* @__PURE__ */ d("button", {
75
76
  type: "button",
76
77
  className: "input-field__clear",
77
- "aria-label": v,
78
- "aria-controls": o,
79
- onClick: q,
80
- children: /* @__PURE__ */ u(e, {
78
+ "aria-label": I("clear", y),
79
+ "aria-controls": s,
80
+ onClick: Y,
81
+ children: /* @__PURE__ */ d(t, {
81
82
  name: "close",
82
83
  className: "input-field__search-glyph"
83
84
  })
84
85
  })
85
86
  ]
86
- }) : J,
87
- D && /* @__PURE__ */ u(n, {
88
- id: L,
89
- children: D
87
+ }) : X,
88
+ O && /* @__PURE__ */ d(r, {
89
+ id: z,
90
+ children: O
90
91
  }),
91
- O && /* @__PURE__ */ u("span", {
92
- id: R,
92
+ k && /* @__PURE__ */ d("span", {
93
+ id: B,
93
94
  className: "input-field__helper",
94
- children: O
95
+ children: k
95
96
  })
96
97
  ]
97
98
  });
98
99
  });
99
100
  //#endregion
100
- export { f as InputField };
101
+ export { p as InputField };