@studiolxd/brand 46.0.0 → 47.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 (60) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/dist/_shared/portal-container.js +9 -0
  3. package/dist/_types/atoms/AsyncMultiSelect/AsyncMultiSelect.d.ts +8 -7
  4. package/dist/_types/atoms/AsyncSelect/AsyncSelect.d.ts +8 -6
  5. package/dist/_types/atoms/InputPhone/InputPhone.d.ts +8 -5
  6. package/dist/_types/atoms/MenuButton/MenuButton.d.ts +22 -2
  7. package/dist/_types/atoms/MultiSelect/MultiSelect.d.ts +8 -6
  8. package/dist/_types/atoms/Popover/Popover.d.ts +8 -1
  9. package/dist/_types/atoms/Select/Select.d.ts +8 -7
  10. package/dist/_types/atoms/Tooltip/Tooltip.d.ts +7 -0
  11. package/dist/_types/constants/portal-container.d.ts +42 -0
  12. package/dist/_types/messages/BrandMessages.d.ts +29 -1
  13. package/dist/_types/messages/index.d.ts +1 -1
  14. package/dist/_types/molecules/Breadcrumb/Breadcrumb.d.ts +10 -2
  15. package/dist/_types/molecules/Menu/Menu.d.ts +8 -1
  16. package/dist/_types/molecules/Modal/Modal.d.ts +8 -6
  17. package/dist/_types/molecules/OrgSwitcher/OrgSwitcher.d.ts +15 -1
  18. package/dist/_types/molecules/PrevNextNav/PrevNextNav.d.ts +17 -2
  19. package/dist/_types/molecules/Sheet/Sheet.d.ts +8 -7
  20. package/dist/_types/molecules/SidebarNav/SidebarNav.d.ts +18 -3
  21. package/dist/_types/molecules/SiteNav/SiteNav.d.ts +9 -0
  22. package/dist/_types/molecules/TableOfContents/TableOfContents.d.ts +11 -2
  23. package/dist/_types/molecules/UserMenu/UserMenu.d.ts +16 -1
  24. package/dist/_types/sections/AppHeader/AppHeader.d.ts +8 -2
  25. package/dist/_types/sections/AppRoot/AppRoot.d.ts +12 -1
  26. package/dist/_types/sections/AppShell/AppShell.d.ts +14 -1
  27. package/dist/_types/sections/Sidebar/Sidebar.d.ts +27 -3
  28. package/dist/_types/sections/SiteHeader/SiteHeader.d.ts +22 -3
  29. package/dist/_types/sections/SiteShell/SiteShell.d.ts +11 -5
  30. package/dist/_types/templates/OnboardingShell/OnboardingShell.d.ts +19 -2
  31. package/dist/_types/templates/PublicPageShell/PublicPageShell.d.ts +42 -6
  32. package/dist/app-header.js +1 -1
  33. package/dist/app-launcher.js +62 -58
  34. package/dist/app-root.js +10 -8
  35. package/dist/app-shell.js +51 -50
  36. package/dist/async-multi-select.js +65 -64
  37. package/dist/async-select.js +49 -48
  38. package/dist/breadcrumb.js +24 -21
  39. package/dist/input-phone.js +38 -37
  40. package/dist/menu-button.js +16 -14
  41. package/dist/menu.js +44 -40
  42. package/dist/modal.js +32 -31
  43. package/dist/multi-select.js +106 -105
  44. package/dist/onboarding-shell.js +36 -35
  45. package/dist/org-switcher.js +64 -59
  46. package/dist/popover.js +27 -22
  47. package/dist/prev-next-nav.js +38 -36
  48. package/dist/public-page-shell.js +24 -20
  49. package/dist/select.js +70 -69
  50. package/dist/sheet.js +30 -29
  51. package/dist/sidebar-nav.js +91 -90
  52. package/dist/sidebar.js +72 -71
  53. package/dist/site-header.js +44 -43
  54. package/dist/site-nav.js +27 -25
  55. package/dist/site-shell.js +23 -15
  56. package/dist/table-of-contents.js +30 -27
  57. package/dist/toaster.js +57 -53
  58. package/dist/tooltip.js +45 -41
  59. package/dist/user-menu.js +58 -52
  60. package/package.json +1 -1
package/dist/app-shell.js CHANGED
@@ -1,78 +1,79 @@
1
1
  'use client';
2
2
  import './app-shell.css';
3
- import { SkipLink as e } from "./skip-link.js";
4
- import { TooltipProvider as t } from "./tooltip.js";
5
- import { t as n } from "./_shared/css-properties.js";
6
- import { n as r, t as i } from "./_shared/appshellcontext.js";
7
- import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
8
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { SkipLink as t } from "./skip-link.js";
5
+ import { TooltipProvider as n } from "./tooltip.js";
6
+ import { t as r } from "./_shared/css-properties.js";
7
+ import { n as i, t as a } from "./_shared/appshellcontext.js";
8
+ import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
10
  //#region src/stories/sections/AppShell/AppShell.tsx
10
- var d = "(min-width: 1024px)";
11
- function f() {
12
- let [e, t] = c(() => typeof window > "u" ? !0 : window.matchMedia(d).matches);
13
- return o(() => {
14
- let e = window.matchMedia(d), n = () => t(e.matches);
11
+ var f = "(min-width: 1024px)";
12
+ function p() {
13
+ let [e, t] = l(() => typeof window > "u" ? !0 : window.matchMedia(f).matches);
14
+ return s(() => {
15
+ let e = window.matchMedia(f), n = () => t(e.matches);
15
16
  return n(), e.addEventListener("change", n), () => e.removeEventListener("change", n);
16
17
  }, []), e;
17
18
  }
18
- function p({ header: r, sidebar: d, children: p, defaultSidebar: m = "open", sidebarState: h, onSidebarChange: g, defaultSidebarWidth: _, onSidebarWidthChange: v, skipLabel: y = "Saltar al contenido principal" }) {
19
- let b = f(), [x, S] = c(m), [C, w] = c(!1), [T, E] = c(_), D = b ? h ?? x : C ? "open" : "closed", O = a((e) => {
20
- b ? (S(e), g?.(e)) : w(e === "open");
21
- }, [b, g]), k = a(() => O(D === "open" ? "closed" : "open"), [O, D]), A = a(() => O("closed"), [O]), j = a((e) => {
22
- E(e), v?.(e);
23
- }, [v]);
24
- o(() => {
25
- if (b || !C) return;
19
+ function m({ header: i, sidebar: f, children: m, defaultSidebar: h = "open", sidebarState: g, onSidebarChange: _, defaultSidebarWidth: v, onSidebarWidthChange: y, skipLabel: b }) {
20
+ let x = e("appShell"), S = p(), [C, w] = l(h), [T, E] = l(!1), [D, O] = l(v), k = S ? g ?? C : T ? "open" : "closed", A = o((e) => {
21
+ S ? (w(e), _?.(e)) : E(e === "open");
22
+ }, [S, _]), j = o(() => A(k === "open" ? "closed" : "open"), [A, k]), M = o(() => A("closed"), [A]), N = o((e) => {
23
+ O(e), y?.(e);
24
+ }, [y]);
25
+ s(() => {
26
+ if (S || !T) return;
26
27
  let e = (e) => {
27
- e.key === "Escape" && w(!1);
28
+ e.key === "Escape" && E(!1);
28
29
  };
29
30
  document.addEventListener("keydown", e);
30
31
  let t = document.body.style.overflow;
31
32
  return document.body.style.overflow = "hidden", () => {
32
33
  document.removeEventListener("keydown", e), document.body.style.overflow = t;
33
34
  };
34
- }, [b, C]);
35
- let M = s(() => ({
36
- sidebar: D,
37
- setSidebar: O,
38
- sidebarWidth: T ?? 0,
39
- setSidebarWidth: j,
40
- toggleSidebar: k,
41
- closeSidebar: A,
42
- isDesktop: b
35
+ }, [S, T]);
36
+ let P = c(() => ({
37
+ sidebar: k,
38
+ setSidebar: A,
39
+ sidebarWidth: D ?? 0,
40
+ setSidebarWidth: N,
41
+ toggleSidebar: j,
42
+ closeSidebar: M,
43
+ isDesktop: S
43
44
  }), [
44
- D,
45
- O,
46
- T,
47
- j,
48
45
  k,
49
46
  A,
50
- b
51
- ]), N = n({ "--app-shell-sidebar-width": T ? `${T}px` : void 0 }), P = !b && C;
52
- return /* @__PURE__ */ l(i.Provider, {
53
- value: M,
54
- children: /* @__PURE__ */ u(t, { children: [/* @__PURE__ */ l(e, {
47
+ D,
48
+ N,
49
+ j,
50
+ M,
51
+ S
52
+ ]), F = r({ "--app-shell-sidebar-width": D ? `${D}px` : void 0 }), I = !S && T;
53
+ return /* @__PURE__ */ u(a.Provider, {
54
+ value: P,
55
+ children: /* @__PURE__ */ d(n, { children: [/* @__PURE__ */ u(t, {
55
56
  href: "#main-content",
56
- children: y
57
- }), /* @__PURE__ */ u("div", {
58
- ref: N,
57
+ children: x("skipToContent", b)
58
+ }), /* @__PURE__ */ d("div", {
59
+ ref: F,
59
60
  className: "app-shell",
60
- "data-sidebar": D,
61
- children: [r, /* @__PURE__ */ u("div", {
61
+ "data-sidebar": k,
62
+ children: [i, /* @__PURE__ */ d("div", {
62
63
  className: "app-shell__body",
63
64
  children: [
64
- d,
65
- P && /* @__PURE__ */ l("div", {
65
+ f,
66
+ I && /* @__PURE__ */ u("div", {
66
67
  className: "app-shell__backdrop",
67
- onClick: A,
68
+ onClick: M,
68
69
  "aria-hidden": "true"
69
70
  }),
70
- /* @__PURE__ */ l("main", {
71
+ /* @__PURE__ */ u("main", {
71
72
  id: "main-content",
72
73
  tabIndex: -1,
73
74
  className: "app-shell__content",
74
- inert: P || void 0,
75
- children: p
75
+ inert: I || void 0,
76
+ children: m
76
77
  })
77
78
  ]
78
79
  })]
@@ -80,4 +81,4 @@ function p({ header: r, sidebar: d, children: p, defaultSidebar: m = "open", sid
80
81
  });
81
82
  }
82
83
  //#endregion
83
- export { p as AppShell, r as useAppShell };
84
+ export { m as AppShell, i as useAppShell };
@@ -3,22 +3,23 @@ import './async-multi-select.css';
3
3
  import { n as e } from "./_shared/brandmessagescontext.js";
4
4
  import { Icon as t } from "./icon.js";
5
5
  import { Spinner as n } from "./spinner.js";
6
- import { forwardRef as r, useCallback as ee, useEffect as te, useId as i, useRef as a, useState as o } from "react";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
- import { Popover as l } from "@base-ui/react/popover";
6
+ import { n as r } from "./_shared/portal-container.js";
7
+ import { forwardRef as i, useCallback as a, useEffect as o, useId as s, useRef as c, useState as l } from "react";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import { Popover as f } from "@base-ui/react/popover";
9
10
  //#region src/stories/atoms/AsyncMultiSelect/AsyncMultiSelect.tsx
10
- function u(e, t) {
11
+ function ee(e, t) {
11
12
  typeof e == "function" ? e(t) : e && (e.current = t);
12
13
  }
13
- var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange: p, selectedOptions: ne, placeholder: m, disabled: h, readOnly: g, size: _ = "md", debounceMs: v = 300, id: re, name: y, error: b = !1, required: ie, onBlur: ae, className: x, "aria-label": S, "aria-describedby": C, removeLabel: w, emptyMessage: T, loadingLabel: E, container: D }, oe) {
14
- let O = e("asyncMultiSelect"), [k, A] = o(!1), [j, M] = o(""), [N, P] = o(!1), [F, I] = o([]), [L, R] = o(!1), [z, B] = o(-1), [V, H] = o(f), [U, W] = o([]), G = a(null), K = a(0), q = a(null), J = a(null), Y = i(), se = i(), X = d === void 0 ? V : d, ce = X.map((e) => ne?.find((t) => t.value === e) ?? U.find((t) => t.value === e) ?? {
14
+ var p = i(function({ onSearch: i, value: p, defaultValue: te = [], onValueChange: ne, selectedOptions: m, placeholder: h, disabled: g, readOnly: _, size: v = "md", debounceMs: re = 300, id: ie, name: y, error: b = !1, required: x, onBlur: S, className: ae, "aria-label": C, "aria-describedby": oe, removeLabel: se, emptyMessage: ce, loadingLabel: w, container: T }, E) {
15
+ let D = e("asyncMultiSelect"), O = r(T), [k, A] = l(!1), [j, M] = l(""), [N, P] = l(!1), [F, I] = l([]), [L, R] = l(!1), [z, B] = l(-1), [V, H] = l(te), [U, W] = l([]), G = c(null), K = c(0), q = c(null), J = c(null), Y = s(), le = s(), X = p === void 0 ? V : p, ue = X.map((e) => m?.find((t) => t.value === e) ?? U.find((t) => t.value === e) ?? {
15
16
  value: e,
16
17
  label: e
17
- }), Z = (e) => `${se}-opt-${e}`, Q = ee(async (e) => {
18
+ }), Z = (e) => `${le}-opt-${e}`, Q = a(async (e) => {
18
19
  let t = ++K.current;
19
20
  P(!0), R(!1);
20
21
  try {
21
- let n = await r(e);
22
+ let n = await i(e);
22
23
  if (t !== K.current) return;
23
24
  I(n), B(-1);
24
25
  } catch {
@@ -27,22 +28,22 @@ var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange:
27
28
  } finally {
28
29
  t === K.current && (P(!1), R(!0));
29
30
  }
30
- }, [r]);
31
- te(() => () => {
31
+ }, [i]);
32
+ o(() => () => {
32
33
  K.current += 1, G.current && clearTimeout(G.current);
33
34
  }, []);
34
- function le(e) {
35
+ function de(e) {
35
36
  let t = e.target.value;
36
- M(t), k || A(!0), G.current && clearTimeout(G.current), G.current = setTimeout(() => void Q(t), v);
37
+ M(t), k || A(!0), G.current && clearTimeout(G.current), G.current = setTimeout(() => void Q(t), re);
37
38
  }
38
- function ue(e) {
39
- h || g || k || (e.preventDefault(), q.current?.focus(), B(-1), M(""), I([]), R(!1), A(!0), Q(""));
39
+ function fe(e) {
40
+ g || _ || k || (e.preventDefault(), q.current?.focus(), B(-1), M(""), I([]), R(!1), A(!0), Q(""));
40
41
  }
41
42
  function $(e, t) {
42
43
  let n = X.includes(e) ? X.filter((t) => t !== e) : [...X, e];
43
- t && W((e) => e.some((e) => e.value === t.value) ? e : [...e, t]), d === void 0 && H(n), p?.(n);
44
+ t && W((e) => e.some((e) => e.value === t.value) ? e : [...e, t]), p === void 0 && H(n), ne?.(n);
44
45
  }
45
- function de(e) {
46
+ function pe(e) {
46
47
  if (e.key === "ArrowDown") e.preventDefault(), k ? B((e) => Math.min(e + 1, F.length - 1)) : (A(!0), Q(j));
47
48
  else if (e.key === "ArrowUp") e.preventDefault(), B((e) => Math.max(e - 1, -1));
48
49
  else if (e.key === "Enter" && z >= 0 && F[z]) e.preventDefault(), $(F[z].value, F[z]), q.current?.focus();
@@ -53,7 +54,7 @@ var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange:
53
54
  $(e);
54
55
  }
55
56
  }
56
- function fe(e, t) {
57
+ function me(e, t) {
57
58
  if (!e) {
58
59
  if (t.reason === "outside-press") {
59
60
  let e = t.event?.target;
@@ -62,61 +63,61 @@ var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange:
62
63
  A(!1), M(""), B(-1);
63
64
  }
64
65
  }
65
- let pe = [
66
+ let he = [
66
67
  "async-multi-select",
67
- _ === "md" ? "" : `async-multi-select--${_}`,
68
- h ? "async-multi-select--disabled" : "",
68
+ v === "md" ? "" : `async-multi-select--${v}`,
69
+ g ? "async-multi-select--disabled" : "",
69
70
  k ? "async-multi-select--open" : "",
70
71
  b ? "async-multi-select--error" : "",
71
- x ?? ""
72
- ].filter(Boolean).join(" "), me = ["async-multi-select__content", _ === "md" ? "" : `async-multi-select__content--${_}`].filter(Boolean).join(" ");
73
- return /* @__PURE__ */ c(l.Root, {
72
+ ae ?? ""
73
+ ].filter(Boolean).join(" "), ge = ["async-multi-select__content", v === "md" ? "" : `async-multi-select__content--${v}`].filter(Boolean).join(" ");
74
+ return /* @__PURE__ */ d(f.Root, {
74
75
  open: k,
75
- onOpenChange: fe,
76
- children: [/* @__PURE__ */ c("div", {
76
+ onOpenChange: me,
77
+ children: [/* @__PURE__ */ d("div", {
77
78
  ref: J,
78
- className: pe,
79
+ className: he,
79
80
  "data-popup-open": k || void 0,
80
- children: [/* @__PURE__ */ c("div", {
81
+ children: [/* @__PURE__ */ d("div", {
81
82
  className: "async-multi-select__input-area",
82
83
  children: [
83
- ce.map((e) => /* @__PURE__ */ c("span", {
84
+ ue.map((e) => /* @__PURE__ */ d("span", {
84
85
  className: "async-multi-select__pill",
85
- children: [/* @__PURE__ */ s("span", {
86
+ children: [/* @__PURE__ */ u("span", {
86
87
  className: "async-multi-select__pill-label",
87
88
  children: e.label
88
- }), !h && !g && /* @__PURE__ */ s("button", {
89
+ }), !g && !_ && /* @__PURE__ */ u("button", {
89
90
  type: "button",
90
91
  className: "async-multi-select__pill-remove",
91
- "aria-label": O("remove", w)(e.label),
92
+ "aria-label": D("remove", se)(e.label),
92
93
  tabIndex: -1,
93
94
  onMouseDown: (t) => {
94
95
  t.preventDefault(), $(e.value);
95
96
  },
96
- children: /* @__PURE__ */ s(t, {
97
+ children: /* @__PURE__ */ u(t, {
97
98
  name: "close",
98
99
  size: "xs"
99
100
  })
100
101
  })]
101
102
  }, e.value)),
102
- /* @__PURE__ */ s("input", {
103
+ /* @__PURE__ */ u("input", {
103
104
  ref: (e) => {
104
- q.current = e, u(oe, e);
105
+ q.current = e, ee(E, e);
105
106
  },
106
- id: re,
107
+ id: ie,
107
108
  type: "text",
108
109
  className: "async-multi-select__input",
109
110
  value: j,
110
- onChange: le,
111
- onPointerDown: ue,
112
- onKeyDown: de,
113
- placeholder: X.length === 0 ? O("placeholder", m) : void 0,
114
- disabled: h,
115
- readOnly: g,
116
- "aria-label": S,
117
- "aria-describedby": C,
111
+ onChange: de,
112
+ onPointerDown: fe,
113
+ onKeyDown: pe,
114
+ placeholder: X.length === 0 ? D("placeholder", h) : void 0,
115
+ disabled: g,
116
+ readOnly: _,
117
+ "aria-label": C,
118
+ "aria-describedby": oe,
118
119
  "aria-invalid": b || void 0,
119
- "aria-required": ie || void 0,
120
+ "aria-required": x || void 0,
120
121
  "aria-expanded": k,
121
122
  "aria-haspopup": "listbox",
122
123
  "aria-controls": k ? Y : void 0,
@@ -124,49 +125,49 @@ var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange:
124
125
  autoComplete: "off",
125
126
  role: "combobox",
126
127
  "aria-autocomplete": "list",
127
- onBlur: ae
128
+ onBlur: S
128
129
  }),
129
- y && X.map((e) => /* @__PURE__ */ s("input", {
130
+ y && X.map((e) => /* @__PURE__ */ u("input", {
130
131
  type: "hidden",
131
132
  name: y,
132
133
  value: e
133
134
  }, e))
134
135
  ]
135
- }), N && /* @__PURE__ */ s(n, {
136
+ }), N && /* @__PURE__ */ u(n, {
136
137
  size: "sm",
137
138
  "aria-hidden": !0
138
139
  })]
139
- }), /* @__PURE__ */ s(l.Portal, {
140
- container: D,
141
- children: /* @__PURE__ */ s(l.Positioner, {
140
+ }), /* @__PURE__ */ u(f.Portal, {
141
+ container: O,
142
+ children: /* @__PURE__ */ u(f.Positioner, {
142
143
  className: "async-multi-select__positioner",
143
144
  anchor: J,
144
145
  align: "start",
145
146
  sideOffset: -1,
146
- children: /* @__PURE__ */ s(l.Popup, {
147
- className: me,
147
+ children: /* @__PURE__ */ u(f.Popup, {
148
+ className: ge,
148
149
  initialFocus: !1,
149
150
  finalFocus: !1,
150
- children: /* @__PURE__ */ c("div", {
151
+ children: /* @__PURE__ */ d("div", {
151
152
  role: "listbox",
152
153
  "aria-multiselectable": "true",
153
- "aria-label": S ?? O("placeholder", m),
154
+ "aria-label": C ?? D("placeholder", h),
154
155
  id: Y,
155
156
  children: [
156
- N && /* @__PURE__ */ s("div", {
157
+ N && /* @__PURE__ */ u("div", {
157
158
  className: "async-multi-select__loading",
158
- children: /* @__PURE__ */ s(n, {
159
+ children: /* @__PURE__ */ u(n, {
159
160
  size: "sm",
160
- label: O("loading", E)
161
+ label: D("loading", w)
161
162
  })
162
163
  }),
163
- !N && L && F.length === 0 && /* @__PURE__ */ s("div", {
164
+ !N && L && F.length === 0 && /* @__PURE__ */ u("div", {
164
165
  className: "async-multi-select__empty",
165
- children: O("empty", T)
166
+ children: D("empty", ce)
166
167
  }),
167
168
  !N && F.map((e, t) => {
168
169
  let n = X.includes(e.value), r = z === t;
169
- return /* @__PURE__ */ c("div", {
170
+ return /* @__PURE__ */ d("div", {
170
171
  id: Z(t),
171
172
  role: "option",
172
173
  "aria-selected": n,
@@ -179,11 +180,11 @@ var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange:
179
180
  onClick: () => {
180
181
  $(e.value, e), q.current?.focus();
181
182
  },
182
- children: [/* @__PURE__ */ s("span", {
183
+ children: [/* @__PURE__ */ u("span", {
183
184
  className: "async-multi-select__item-check",
184
185
  "aria-hidden": "true",
185
- children: /* @__PURE__ */ s("span", { className: "async-multi-select__item-check-mark" })
186
- }), /* @__PURE__ */ s("span", { children: e.label })]
186
+ children: /* @__PURE__ */ u("span", { className: "async-multi-select__item-check-mark" })
187
+ }), /* @__PURE__ */ u("span", { children: e.label })]
187
188
  }, e.value);
188
189
  })
189
190
  ]
@@ -194,4 +195,4 @@ var d = r(function({ onSearch: r, value: d, defaultValue: f = [], onValueChange:
194
195
  });
195
196
  });
196
197
  //#endregion
197
- export { d as AsyncMultiSelect };
198
+ export { p as AsyncMultiSelect };
@@ -3,19 +3,20 @@ import './async-select.css';
3
3
  import { n as e } from "./_shared/brandmessagescontext.js";
4
4
  import { Icon as t } from "./icon.js";
5
5
  import { Spinner as n } from "./spinner.js";
6
- import { forwardRef as r, useCallback as i, useEffect as a, useId as o, useRef as s, useState as c } from "react";
6
+ import { n as r } from "./_shared/portal-container.js";
7
+ import { forwardRef as i, useCallback as ee, useEffect as a, useId as o, useRef as s, useState as c } from "react";
7
8
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
9
  import { Popover as d } from "@base-ui/react/popover";
9
10
  //#region src/stories/atoms/AsyncSelect/AsyncSelect.tsx
10
- function ee(e, t) {
11
+ function f(e, t) {
11
12
  typeof e == "function" ? e(t) : e && (e.current = t);
12
13
  }
13
- var f = r(function({ onSearch: r, value: f, onValueChange: p, selectedOption: m, placeholder: h, disabled: g, readOnly: _, size: v = "md", debounceMs: y = 300, id: b, name: x, error: S = !1, required: te, onBlur: ne, className: C, "aria-label": w, "aria-describedby": T, emptyMessage: re, loadingLabel: ie, clearLabel: ae, container: E }, D) {
14
- let O = e("asyncSelect"), [k, A] = c(!1), [j, M] = c(""), [N, P] = c(!1), [F, I] = c([]), [oe, L] = c(!1), [R, z] = c(-1), [B, V] = c(null), [H, U] = c(null), W = s(null), G = s(0), K = s(null), q = s(null), J = o(), se = o(), Y = f === void 0 ? B : f, ce = m === void 0 ? H : m, X = (e) => `${se}-opt-${e}`, Z = i(async (e) => {
14
+ var p = i(function({ onSearch: i, value: p, onValueChange: m, selectedOption: h, placeholder: g, disabled: _, readOnly: v, size: y = "md", debounceMs: b = 300, id: x, name: S, error: C = !1, required: te, onBlur: ne, className: w, "aria-label": T, "aria-describedby": re, emptyMessage: E, loadingLabel: D, clearLabel: ie, container: ae }, oe) {
15
+ let O = e("asyncSelect"), se = r(ae), [k, A] = c(!1), [j, M] = c(""), [N, P] = c(!1), [F, I] = c([]), [ce, L] = c(!1), [R, z] = c(-1), [B, V] = c(null), [H, U] = c(null), W = s(null), G = s(0), K = s(null), q = s(null), J = o(), le = o(), Y = p === void 0 ? B : p, ue = h === void 0 ? H : h, X = (e) => `${le}-opt-${e}`, Z = ee(async (e) => {
15
16
  let t = ++G.current;
16
17
  P(!0), L(!1);
17
18
  try {
18
- let n = await r(e);
19
+ let n = await i(e);
19
20
  if (t !== G.current) return;
20
21
  I(n), z(-1);
21
22
  } catch {
@@ -24,30 +25,30 @@ var f = r(function({ onSearch: r, value: f, onValueChange: p, selectedOption: m,
24
25
  } finally {
25
26
  t === G.current && (P(!1), L(!0));
26
27
  }
27
- }, [r]);
28
+ }, [i]);
28
29
  a(() => () => {
29
30
  G.current += 1, W.current && clearTimeout(W.current);
30
31
  }, []);
31
- function le(e) {
32
+ function de(e) {
32
33
  let t = e.target.value;
33
- M(t), W.current && clearTimeout(W.current), W.current = setTimeout(() => void Z(t), y);
34
+ M(t), W.current && clearTimeout(W.current), W.current = setTimeout(() => void Z(t), b);
34
35
  }
35
- function ue(e) {
36
- g || _ || k || (e.preventDefault(), K.current?.focus(), z(-1), M(""), I([]), L(!1), A(!0), Z(""));
36
+ function fe(e) {
37
+ _ || v || k || (e.preventDefault(), K.current?.focus(), z(-1), M(""), I([]), L(!1), A(!0), Z(""));
37
38
  }
38
39
  function Q(e) {
39
- f === void 0 && (V(e.value), U(e)), p?.(e.value, e), A(!1), z(-1), M("");
40
+ p === void 0 && (V(e.value), U(e)), m?.(e.value, e), A(!1), z(-1), M("");
40
41
  }
41
42
  function $() {
42
- f === void 0 && (V(null), U(null)), p?.(null, null), M(""), I([]), L(!1), K.current?.focus();
43
+ p === void 0 && (V(null), U(null)), m?.(null, null), M(""), I([]), L(!1), K.current?.focus();
43
44
  }
44
- function de(e) {
45
+ function pe(e) {
45
46
  e.stopPropagation(), $();
46
47
  }
47
- function fe(e) {
48
- e.key === "ArrowDown" ? (e.preventDefault(), k ? z((e) => Math.min(e + 1, F.length - 1)) : (A(!0), Z(j))) : e.key === "ArrowUp" ? (e.preventDefault(), z((e) => Math.max(e - 1, -1))) : e.key === "Enter" && R >= 0 && F[R] ? (e.preventDefault(), Q(F[R])) : e.key === "Escape" ? (A(!1), M(""), z(-1)) : e.key === "Tab" ? (A(!1), z(-1)) : (e.key === "Backspace" || e.key === "Delete") && j === "" && Y && !g && !_ ? (e.preventDefault(), $()) : !k && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), M(e.key), A(!0), I([]), L(!1), W.current && clearTimeout(W.current), W.current = setTimeout(() => void Z(e.key), y));
48
+ function me(e) {
49
+ e.key === "ArrowDown" ? (e.preventDefault(), k ? z((e) => Math.min(e + 1, F.length - 1)) : (A(!0), Z(j))) : e.key === "ArrowUp" ? (e.preventDefault(), z((e) => Math.max(e - 1, -1))) : e.key === "Enter" && R >= 0 && F[R] ? (e.preventDefault(), Q(F[R])) : e.key === "Escape" ? (A(!1), M(""), z(-1)) : e.key === "Tab" ? (A(!1), z(-1)) : (e.key === "Backspace" || e.key === "Delete") && j === "" && Y && !_ && !v ? (e.preventDefault(), $()) : !k && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), M(e.key), A(!0), I([]), L(!1), W.current && clearTimeout(W.current), W.current = setTimeout(() => void Z(e.key), b));
49
50
  }
50
- function pe(e, t) {
51
+ function he(e, t) {
51
52
  if (!e) {
52
53
  if (t.reason === "outside-press") {
53
54
  let e = t.event?.target;
@@ -56,38 +57,38 @@ var f = r(function({ onSearch: r, value: f, onValueChange: p, selectedOption: m,
56
57
  A(!1), M(""), z(-1);
57
58
  }
58
59
  }
59
- let me = k ? j : ce?.label ?? "", he = [
60
+ let ge = k ? j : ue?.label ?? "", _e = [
60
61
  "async-select",
61
- v === "md" ? "" : `async-select--${v}`,
62
- g ? "async-select--disabled" : "",
63
- S ? "async-select--error" : "",
64
- C ?? ""
65
- ].filter(Boolean).join(" "), ge = ["async-select__content", v === "md" ? "" : `async-select__content--${v}`].filter(Boolean).join(" ");
62
+ y === "md" ? "" : `async-select--${y}`,
63
+ _ ? "async-select--disabled" : "",
64
+ C ? "async-select--error" : "",
65
+ w ?? ""
66
+ ].filter(Boolean).join(" "), ve = ["async-select__content", y === "md" ? "" : `async-select__content--${y}`].filter(Boolean).join(" ");
66
67
  return /* @__PURE__ */ u(d.Root, {
67
68
  open: k,
68
- onOpenChange: pe,
69
+ onOpenChange: he,
69
70
  children: [/* @__PURE__ */ u("div", {
70
71
  ref: q,
71
- className: he,
72
+ className: _e,
72
73
  "data-popup-open": k || void 0,
73
74
  children: [
74
75
  /* @__PURE__ */ l("input", {
75
76
  ref: (e) => {
76
- K.current = e, ee(D, e);
77
+ K.current = e, f(oe, e);
77
78
  },
78
- id: b,
79
+ id: x,
79
80
  type: "text",
80
81
  className: "async-select__input",
81
- value: me,
82
- onChange: le,
83
- onPointerDown: ue,
84
- onKeyDown: fe,
85
- placeholder: O("placeholder", h),
86
- disabled: g,
87
- readOnly: _,
88
- "aria-label": w,
89
- "aria-describedby": T,
90
- "aria-invalid": S || void 0,
82
+ value: ge,
83
+ onChange: de,
84
+ onPointerDown: fe,
85
+ onKeyDown: me,
86
+ placeholder: O("placeholder", g),
87
+ disabled: _,
88
+ readOnly: v,
89
+ "aria-label": T,
90
+ "aria-describedby": re,
91
+ "aria-invalid": C || void 0,
91
92
  "aria-required": te || void 0,
92
93
  "aria-expanded": k,
93
94
  "aria-haspopup": "listbox",
@@ -98,21 +99,21 @@ var f = r(function({ onSearch: r, value: f, onValueChange: p, selectedOption: m,
98
99
  "aria-autocomplete": "list",
99
100
  onBlur: ne
100
101
  }),
101
- x && /* @__PURE__ */ l("input", {
102
+ S && /* @__PURE__ */ l("input", {
102
103
  type: "hidden",
103
- name: x,
104
+ name: S,
104
105
  value: Y ?? ""
105
106
  }),
106
107
  N && /* @__PURE__ */ l(n, {
107
108
  size: "sm",
108
109
  "aria-hidden": !0
109
110
  }),
110
- !N && Y && !g && !_ && /* @__PURE__ */ l("button", {
111
+ !N && Y && !_ && !v && /* @__PURE__ */ l("button", {
111
112
  type: "button",
112
113
  className: "async-select__clear",
113
- "aria-label": O("clear", ae),
114
+ "aria-label": O("clear", ie),
114
115
  tabIndex: -1,
115
- onMouseDown: de,
116
+ onMouseDown: pe,
116
117
  children: /* @__PURE__ */ l(t, {
117
118
  name: "close",
118
119
  size: "xs"
@@ -120,31 +121,31 @@ var f = r(function({ onSearch: r, value: f, onValueChange: p, selectedOption: m,
120
121
  })
121
122
  ]
122
123
  }), /* @__PURE__ */ l(d.Portal, {
123
- container: E,
124
+ container: se,
124
125
  children: /* @__PURE__ */ l(d.Positioner, {
125
126
  className: "async-select__positioner",
126
127
  anchor: q,
127
128
  align: "start",
128
129
  sideOffset: -1,
129
130
  children: /* @__PURE__ */ l(d.Popup, {
130
- className: ge,
131
+ className: ve,
131
132
  initialFocus: !1,
132
133
  finalFocus: !1,
133
134
  children: /* @__PURE__ */ u("div", {
134
135
  role: "listbox",
135
- "aria-label": w ?? O("placeholder", h),
136
+ "aria-label": T ?? O("placeholder", g),
136
137
  id: J,
137
138
  children: [
138
139
  N && /* @__PURE__ */ l("div", {
139
140
  className: "async-select__loading",
140
141
  children: /* @__PURE__ */ l(n, {
141
142
  size: "sm",
142
- label: O("loading", ie)
143
+ label: O("loading", D)
143
144
  })
144
145
  }),
145
- !N && oe && F.length === 0 && /* @__PURE__ */ l("div", {
146
+ !N && ce && F.length === 0 && /* @__PURE__ */ l("div", {
146
147
  className: "async-select__empty",
147
- children: O("empty", re)
148
+ children: O("empty", E)
148
149
  }),
149
150
  !N && F.map((e, t) => {
150
151
  let n = e.value === Y, r = R === t;
@@ -170,4 +171,4 @@ var f = r(function({ onSearch: r, value: f, onValueChange: p, selectedOption: m,
170
171
  });
171
172
  });
172
173
  //#endregion
173
- export { f as AsyncSelect };
174
+ export { p as AsyncSelect };
@@ -1,39 +1,42 @@
1
+ 'use client';
1
2
  import './breadcrumb.css';
2
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
5
  //#region src/stories/molecules/Breadcrumb/Breadcrumb.tsx
4
- function n({ children: t, ...n }) {
5
- return /* @__PURE__ */ e("a", {
6
+ function r({ children: e, ...n }) {
7
+ return /* @__PURE__ */ t("a", {
6
8
  ...n,
7
- children: t
9
+ children: e
8
10
  });
9
11
  }
10
- function r({ items: r, renderLink: i = n, separator: a = "/", ariaLabel: o = "Migas de pan", className: s }) {
11
- return /* @__PURE__ */ e("nav", {
12
- "aria-label": o,
13
- className: ["breadcrumb", s].filter(Boolean).join(" "),
14
- children: /* @__PURE__ */ e("ol", {
12
+ function i({ items: i, renderLink: a = r, separator: o = "/", ariaLabel: s, className: c }) {
13
+ let l = e("breadcrumb");
14
+ return /* @__PURE__ */ t("nav", {
15
+ "aria-label": l("label", s),
16
+ className: ["breadcrumb", c].filter(Boolean).join(" "),
17
+ children: /* @__PURE__ */ t("ol", {
15
18
  className: "breadcrumb__list",
16
- children: r.map((n, o) => {
17
- let s = o === r.length - 1;
18
- return /* @__PURE__ */ t("li", {
19
+ children: i.map((e, r) => {
20
+ let s = r === i.length - 1;
21
+ return /* @__PURE__ */ n("li", {
19
22
  className: ["breadcrumb__item", s ? "breadcrumb__item--current" : ""].filter(Boolean).join(" "),
20
- children: [s || !n.href ? /* @__PURE__ */ e("span", {
23
+ children: [s || !e.href ? /* @__PURE__ */ t("span", {
21
24
  className: s ? "breadcrumb__current" : "breadcrumb__static",
22
25
  ...s ? { "aria-current": "page" } : {},
23
- children: n.label
24
- }) : i({
25
- href: n.href,
26
- children: n.label,
26
+ children: e.label
27
+ }) : a({
28
+ href: e.href,
29
+ children: e.label,
27
30
  className: "breadcrumb__link"
28
- }), !s && /* @__PURE__ */ e("span", {
31
+ }), !s && /* @__PURE__ */ t("span", {
29
32
  className: "breadcrumb__separator",
30
33
  "aria-hidden": "true",
31
- children: a
34
+ children: o
32
35
  })]
33
- }, `${n.label}-${o}`);
36
+ }, `${e.label}-${r}`);
34
37
  })
35
38
  })
36
39
  });
37
40
  }
38
41
  //#endregion
39
- export { r as Breadcrumb };
42
+ export { i as Breadcrumb };