@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
@@ -1,60 +1,61 @@
1
1
  'use client';
2
2
  import './sidebar-nav.css';
3
- import { Icon as e } from "./icon.js";
4
- import { Tooltip as t } from "./tooltip.js";
5
- import { Menu as n } from "./menu.js";
6
- import { n as r } from "./_shared/sidebarcontext.js";
7
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
8
- import { Accordion as s } from "@base-ui/react/accordion";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { Tooltip as n } from "./tooltip.js";
6
+ import { Menu as r } from "./menu.js";
7
+ import { n as i } from "./_shared/sidebarcontext.js";
8
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
9
+ import { Accordion as c } from "@base-ui/react/accordion";
9
10
  //#region src/stories/molecules/SidebarNav/SidebarNav.tsx
10
- function c({ children: e, ...t }) {
11
- return /* @__PURE__ */ a("a", {
11
+ function l({ children: e, ...t }) {
12
+ return /* @__PURE__ */ o("a", {
12
13
  ...t,
13
14
  children: e
14
15
  });
15
16
  }
16
- function l({ label: l = "Navegación principal", emptyLabel: u = "sin docs", rail: d, entries: f, defaultValue: p, value: m, onValueChange: h, renderLink: g = c }) {
17
- let _ = m === void 0 ? { defaultValue: p } : {
18
- value: m,
19
- onValueChange: (e) => h?.(e ?? [])
20
- }, v = r();
21
- return d ?? v.rail ? /* @__PURE__ */ a("nav", {
17
+ function u({ label: u, emptyLabel: d, rail: f, entries: p, defaultValue: m, value: h, onValueChange: g, renderLink: _ = l }) {
18
+ let v = e("sidebarNav"), y = h === void 0 ? { defaultValue: m } : {
19
+ value: h,
20
+ onValueChange: (e) => g?.(e ?? [])
21
+ }, b = i();
22
+ return f ?? b.rail ? /* @__PURE__ */ o("nav", {
22
23
  className: "sidebar-nav sidebar-nav--rail",
23
- "aria-label": l,
24
- children: /* @__PURE__ */ a("ul", {
24
+ "aria-label": v("label", u),
25
+ children: /* @__PURE__ */ o("ul", {
25
26
  className: "sidebar-nav__rail",
26
27
  role: "list",
27
- children: f.map((e) => {
28
- let r = /* @__PURE__ */ a("span", {
28
+ children: p.map((e) => {
29
+ let t = /* @__PURE__ */ o("span", {
29
30
  className: "sidebar-nav__rail-icon",
30
31
  "aria-hidden": "true",
31
- children: e.icon ?? /* @__PURE__ */ a("span", {
32
+ children: e.icon ?? /* @__PURE__ */ o("span", {
32
33
  className: "sidebar-nav__rail-initial",
33
34
  children: e.label.charAt(0)
34
35
  })
35
36
  });
36
- if (e.kind === "link") return e.empty ? /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(t, {
37
- label: `${e.label} — ${u}`,
37
+ if (e.kind === "link") return e.empty ? /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(n, {
38
+ label: `${e.label} — ${v("empty", d)}`,
38
39
  side: "right",
39
- children: /* @__PURE__ */ a("span", {
40
+ children: /* @__PURE__ */ o("span", {
40
41
  className: "sidebar-nav__rail-item sidebar-nav__rail-item--empty",
41
42
  "aria-disabled": "true",
42
- "aria-label": `${e.label} — ${u}`,
43
- children: r
43
+ "aria-label": `${e.label} — ${v("empty", d)}`,
44
+ children: t
44
45
  })
45
- }) }, e.id) : /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(t, {
46
+ }) }, e.id) : /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(n, {
46
47
  label: e.label,
47
48
  side: "right",
48
- children: g({
49
+ children: _({
49
50
  href: e.href,
50
51
  className: ["sidebar-nav__rail-item", e.active ? "sidebar-nav__rail-item--active" : ""].filter(Boolean).join(" "),
51
52
  "aria-current": e.active ? "page" : void 0,
52
53
  "aria-label": e.label,
53
- children: r
54
+ children: t
54
55
  })
55
56
  }) }, e.id);
56
57
  let i = e.items.some((e) => e.active);
57
- return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(n, {
58
+ return /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(r, {
58
59
  items: [
59
60
  e.href ? {
60
61
  type: "link",
@@ -67,7 +68,7 @@ function l({ label: l = "Navegación principal", emptyLabel: u = "sin docs", rai
67
68
  ...e.href ? [{ type: "separator" }] : [],
68
69
  ...e.items.map((e) => e.empty ? {
69
70
  type: "label",
70
- label: `${e.label} · ${u}`
71
+ label: `${e.label} · ${v("empty", d)}`
71
72
  } : {
72
73
  type: "link",
73
74
  label: e.label,
@@ -77,137 +78,137 @@ function l({ label: l = "Navegación principal", emptyLabel: u = "sin docs", rai
77
78
  side: "right",
78
79
  align: "start",
79
80
  openOnHover: !0,
80
- renderLink: (e) => g({
81
+ renderLink: (e) => _({
81
82
  ...e,
82
83
  href: e.href,
83
84
  className: e.className,
84
85
  children: e.children
85
86
  }),
86
- trigger: /* @__PURE__ */ a("button", {
87
+ trigger: /* @__PURE__ */ o("button", {
87
88
  type: "button",
88
89
  className: ["sidebar-nav__rail-item", i ? "sidebar-nav__rail-item--active" : ""].filter(Boolean).join(" "),
89
90
  "aria-label": e.label,
90
- children: r
91
+ children: t
91
92
  })
92
93
  }) }, e.id);
93
94
  })
94
95
  })
95
- }) : /* @__PURE__ */ a("nav", {
96
+ }) : /* @__PURE__ */ o("nav", {
96
97
  className: "sidebar-nav",
97
- "aria-label": l,
98
- children: /* @__PURE__ */ a(s.Root, {
98
+ "aria-label": v("label", u),
99
+ children: /* @__PURE__ */ o(c.Root, {
99
100
  className: "sidebar-nav__accordion",
100
101
  multiple: !0,
101
- ..._,
102
- children: f.map((t) => {
103
- if (t.kind === "link") {
104
- let e = ["sidebar-nav__top-link", t.active ? "sidebar-nav__top-link--active" : ""].filter(Boolean).join(" ");
105
- return t.empty ? /* @__PURE__ */ a("div", { children: /* @__PURE__ */ o("span", {
106
- className: `${e} sidebar-nav__top-link--empty`,
102
+ ...y,
103
+ children: p.map((e) => {
104
+ if (e.kind === "link") {
105
+ let t = ["sidebar-nav__top-link", e.active ? "sidebar-nav__top-link--active" : ""].filter(Boolean).join(" ");
106
+ return e.empty ? /* @__PURE__ */ o("div", { children: /* @__PURE__ */ s("span", {
107
+ className: `${t} sidebar-nav__top-link--empty`,
107
108
  "aria-disabled": "true",
108
- title: t.label,
109
+ title: e.label,
109
110
  children: [
110
- t.icon && /* @__PURE__ */ a("span", {
111
+ e.icon && /* @__PURE__ */ o("span", {
111
112
  className: "sidebar-nav__item-icon",
112
113
  "aria-hidden": "true",
113
- children: t.icon
114
+ children: e.icon
114
115
  }),
115
- /* @__PURE__ */ a("span", {
116
+ /* @__PURE__ */ o("span", {
116
117
  className: "sidebar-nav__item-label",
117
- children: t.label
118
+ children: e.label
118
119
  }),
119
- /* @__PURE__ */ a("span", {
120
+ /* @__PURE__ */ o("span", {
120
121
  className: "sidebar-nav__empty-mark",
121
- children: u
122
+ children: v("empty", d)
122
123
  })
123
124
  ]
124
- }) }, t.id) : /* @__PURE__ */ a("div", { children: g({
125
- href: t.href,
126
- className: e,
127
- title: t.label,
128
- "aria-current": t.active ? "page" : void 0,
129
- children: /* @__PURE__ */ o(i, { children: [t.icon && /* @__PURE__ */ a("span", {
125
+ }) }, e.id) : /* @__PURE__ */ o("div", { children: _({
126
+ href: e.href,
127
+ className: t,
128
+ title: e.label,
129
+ "aria-current": e.active ? "page" : void 0,
130
+ children: /* @__PURE__ */ s(a, { children: [e.icon && /* @__PURE__ */ o("span", {
130
131
  className: "sidebar-nav__item-icon",
131
132
  "aria-hidden": "true",
132
- children: t.icon
133
- }), /* @__PURE__ */ a("span", {
133
+ children: e.icon
134
+ }), /* @__PURE__ */ o("span", {
134
135
  className: "sidebar-nav__item-label",
135
- children: t.label
136
+ children: e.label
136
137
  })] })
137
- }) }, t.id);
138
+ }) }, e.id);
138
139
  }
139
- return /* @__PURE__ */ o(s.Item, {
140
- value: t.id,
140
+ return /* @__PURE__ */ s(c.Item, {
141
+ value: e.id,
141
142
  className: "sidebar-nav__group",
142
- children: [/* @__PURE__ */ o(s.Header, {
143
+ children: [/* @__PURE__ */ s(c.Header, {
143
144
  className: "sidebar-nav__group-header",
144
- children: [t.href ? g({
145
- href: t.href,
145
+ children: [e.href ? _({
146
+ href: e.href,
146
147
  className: "sidebar-nav__group-label",
147
- title: t.label,
148
- children: /* @__PURE__ */ o(i, { children: [t.icon && /* @__PURE__ */ a("span", {
148
+ title: e.label,
149
+ children: /* @__PURE__ */ s(a, { children: [e.icon && /* @__PURE__ */ o("span", {
149
150
  className: "sidebar-nav__item-icon",
150
151
  "aria-hidden": "true",
151
- children: t.icon
152
- }), /* @__PURE__ */ a("span", {
152
+ children: e.icon
153
+ }), /* @__PURE__ */ o("span", {
153
154
  className: "sidebar-nav__item-label",
154
- children: t.label
155
+ children: e.label
155
156
  })] })
156
- }) : /* @__PURE__ */ o("span", {
157
+ }) : /* @__PURE__ */ s("span", {
157
158
  className: "sidebar-nav__group-label",
158
- title: t.label,
159
- children: [t.icon && /* @__PURE__ */ a("span", {
159
+ title: e.label,
160
+ children: [e.icon && /* @__PURE__ */ o("span", {
160
161
  className: "sidebar-nav__item-icon",
161
162
  "aria-hidden": "true",
162
- children: t.icon
163
- }), /* @__PURE__ */ a("span", {
163
+ children: e.icon
164
+ }), /* @__PURE__ */ o("span", {
164
165
  className: "sidebar-nav__item-label",
165
- children: t.label
166
+ children: e.label
166
167
  })]
167
- }), /* @__PURE__ */ a(s.Trigger, {
168
+ }), /* @__PURE__ */ o(c.Trigger, {
168
169
  className: "sidebar-nav__group-chevron",
169
- children: /* @__PURE__ */ a(e, {
170
+ children: /* @__PURE__ */ o(t, {
170
171
  name: "chevron",
171
172
  className: "sidebar-nav__group-chevron-icon",
172
173
  size: "sm"
173
174
  })
174
175
  })]
175
- }), /* @__PURE__ */ a(s.Panel, {
176
+ }), /* @__PURE__ */ o(c.Panel, {
176
177
  className: "sidebar-nav__group-content",
177
- children: /* @__PURE__ */ a("div", {
178
+ children: /* @__PURE__ */ o("div", {
178
179
  className: "sidebar-nav__group-content-inner",
179
- children: /* @__PURE__ */ a("ul", {
180
+ children: /* @__PURE__ */ o("ul", {
180
181
  className: "sidebar-nav__items",
181
182
  role: "list",
182
- children: t.items.map((e) => {
183
+ children: e.items.map((e) => {
183
184
  let t = ["sidebar-nav__item", e.active ? "sidebar-nav__item--active" : ""].filter(Boolean).join(" ");
184
- return e.empty ? /* @__PURE__ */ a("li", { children: /* @__PURE__ */ o("span", {
185
+ return e.empty ? /* @__PURE__ */ o("li", { children: /* @__PURE__ */ s("span", {
185
186
  className: `${t} sidebar-nav__item--empty`,
186
187
  "aria-disabled": "true",
187
188
  children: [
188
- e.icon && /* @__PURE__ */ a("span", {
189
+ e.icon && /* @__PURE__ */ o("span", {
189
190
  className: "sidebar-nav__item-icon",
190
191
  "aria-hidden": "true",
191
192
  children: e.icon
192
193
  }),
193
- /* @__PURE__ */ a("span", {
194
+ /* @__PURE__ */ o("span", {
194
195
  className: "sidebar-nav__item-label",
195
196
  children: e.label
196
197
  }),
197
- /* @__PURE__ */ a("span", {
198
+ /* @__PURE__ */ o("span", {
198
199
  className: "sidebar-nav__empty-mark",
199
- children: u
200
+ children: v("empty", d)
200
201
  })
201
202
  ]
202
- }) }, e.id) : /* @__PURE__ */ a("li", { children: g({
203
+ }) }, e.id) : /* @__PURE__ */ o("li", { children: _({
203
204
  href: e.href,
204
205
  className: t,
205
206
  "aria-current": e.active ? "page" : void 0,
206
- children: /* @__PURE__ */ o(i, { children: [e.icon && /* @__PURE__ */ a("span", {
207
+ children: /* @__PURE__ */ s(a, { children: [e.icon && /* @__PURE__ */ o("span", {
207
208
  className: "sidebar-nav__item-icon",
208
209
  "aria-hidden": "true",
209
210
  children: e.icon
210
- }), /* @__PURE__ */ a("span", {
211
+ }), /* @__PURE__ */ o("span", {
211
212
  className: "sidebar-nav__item-label",
212
213
  children: e.label
213
214
  })] })
@@ -216,10 +217,10 @@ function l({ label: l = "Navegación principal", emptyLabel: u = "sin docs", rai
216
217
  })
217
218
  })
218
219
  })]
219
- }, t.id);
220
+ }, e.id);
220
221
  })
221
222
  })
222
223
  });
223
224
  }
224
225
  //#endregion
225
- export { l as SidebarNav };
226
+ export { u as SidebarNav };
package/dist/sidebar.js CHANGED
@@ -1,122 +1,123 @@
1
1
  'use client';
2
2
  import './sidebar.css';
3
- import { n as e, t } from "./_shared/sidebarcontext.js";
4
- import { t as n } from "./_shared/appshellcontext.js";
5
- import { useCallback as r, useContext as i, useEffect as a, useRef as o, useState as s } from "react";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { n as t, t as n } from "./_shared/sidebarcontext.js";
5
+ import { t as r } from "./_shared/appshellcontext.js";
6
+ import { useCallback as i, useContext as a, useEffect as o, useRef as s, useState as c } from "react";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
8
  //#region src/stories/sections/Sidebar/Sidebar.tsx
8
- function u(e, t) {
9
+ function d(e, t) {
9
10
  let n = document.createElement("div");
10
11
  n.style.position = "absolute", n.style.inlineSize = `var(${t})`, e.appendChild(n);
11
12
  let r = parseFloat(getComputedStyle(n).inlineSize);
12
13
  return n.remove(), r;
13
14
  }
14
- function d({ logo: e, children: d, footer: f, id: p, label: m = "Barra lateral", resizerLabel: h = "Ancho de la barra lateral", resizerValueText: g = (e) => `${e} píxeles`, mode: _ }) {
15
- let v = i(n), y = v ? v.sidebar : _ ?? "open", b = v ? v.isDesktop : !0, x = b && y === "rail", S = !b, C = o(null), w = o(null), [T, E] = s(null);
16
- a(() => {
17
- let e = C.current;
15
+ function f({ logo: t, children: f, footer: p, id: m, label: h, resizerLabel: g, resizerValueText: _, mode: v }) {
16
+ let y = e("sidebar"), b = a(r), x = b ? b.sidebar : v ?? "open", S = b ? b.isDesktop : !0, C = S && x === "rail", w = !S, T = s(null), E = s(null), [D, O] = c(null);
17
+ o(() => {
18
+ let e = T.current;
18
19
  if (!e) return;
19
20
  let t = {
20
- min: u(e, "--sidebar-min-width"),
21
- max: u(e, "--sidebar-max-width"),
22
- rail: u(e, "--sidebar-rail-width"),
23
- base: u(e, "--sidebar-width")
21
+ min: d(e, "--sidebar-min-width"),
22
+ max: d(e, "--sidebar-max-width"),
23
+ rail: d(e, "--sidebar-rail-width"),
24
+ base: d(e, "--sidebar-width")
24
25
  };
25
- Object.values(t).every(Number.isFinite) && E(t);
26
+ Object.values(t).every(Number.isFinite) && O(t);
26
27
  }, []);
27
- let D = (e) => {
28
- !S || !v || e.target.closest("a[href], [aria-haspopup=\"dialog\"]") && v.closeSidebar();
29
- }, O = r((e) => {
30
- let t = C.current;
31
- if (!t || !v) return;
32
- let n = u(t, "--sidebar-min-width"), r = u(t, "--sidebar-max-width");
33
- e < u(t, "--sidebar-rail-width") ? v.setSidebar("closed") : e < n ? v.setSidebar("rail") : (v.setSidebar("open"), v.setSidebarWidth(Math.min(r, Math.round(e))));
34
- }, [v]), k = (e) => {
35
- if (!C.current) return;
28
+ let k = (e) => {
29
+ !w || !b || e.target.closest("a[href], [aria-haspopup=\"dialog\"]") && b.closeSidebar();
30
+ }, A = i((e) => {
31
+ let t = T.current;
32
+ if (!t || !b) return;
33
+ let n = d(t, "--sidebar-min-width"), r = d(t, "--sidebar-max-width");
34
+ e < d(t, "--sidebar-rail-width") ? b.setSidebar("closed") : e < n ? b.setSidebar("rail") : (b.setSidebar("open"), b.setSidebarWidth(Math.min(r, Math.round(e))));
35
+ }, [b]), j = (e) => {
36
+ if (!T.current) return;
36
37
  e.preventDefault();
37
38
  let t = e.currentTarget;
38
39
  t.setPointerCapture(e.pointerId), t.dataset.dragging = "true";
39
- let n = C.current.getBoundingClientRect().left, r = (e) => O(e.clientX - n), i = () => {
40
+ let n = T.current.getBoundingClientRect().left, r = (e) => A(e.clientX - n), i = () => {
40
41
  delete t.dataset.dragging, t.removeEventListener("pointermove", r), t.removeEventListener("pointerup", i), t.removeEventListener("pointercancel", i);
41
42
  };
42
43
  t.addEventListener("pointermove", r), t.addEventListener("pointerup", i), t.addEventListener("pointercancel", i);
43
- }, A = (e) => {
44
- if (!C.current || !v) return;
45
- let t = u(C.current, "--sidebar-resize-step-px"), n = C.current.getBoundingClientRect().width;
46
- e.key === "ArrowLeft" && (e.preventDefault(), O(n - t)), e.key === "ArrowRight" && (e.preventDefault(), y === "open" ? O(n + t) : v.setSidebar("open")), e.key === "Home" && (e.preventDefault(), v.setSidebar("rail")), e.key === "End" && (e.preventDefault(), O(u(C.current, "--sidebar-max-width")));
44
+ }, M = (e) => {
45
+ if (!T.current || !b) return;
46
+ let t = d(T.current, "--sidebar-resize-step-px"), n = T.current.getBoundingClientRect().width;
47
+ e.key === "ArrowLeft" && (e.preventDefault(), A(n - t)), e.key === "ArrowRight" && (e.preventDefault(), x === "open" ? A(n + t) : b.setSidebar("open")), e.key === "Home" && (e.preventDefault(), b.setSidebar("rail")), e.key === "End" && (e.preventDefault(), A(d(T.current, "--sidebar-max-width")));
47
48
  };
48
- a(() => {
49
- if (!S) return;
50
- if (y === "open") {
51
- w.current = document.activeElement, C.current?.focus();
49
+ o(() => {
50
+ if (!w) return;
51
+ if (x === "open") {
52
+ E.current = document.activeElement, T.current?.focus();
52
53
  return;
53
54
  }
54
- let e = C.current, t = document.activeElement;
55
- (e && t instanceof Node && e.contains(t) || t === document.body || t === null) && w.current?.focus?.(), w.current = null;
56
- }, [S, y]);
57
- let j = Math.round(y === "rail" ? T?.rail ?? 0 : (v?.sidebarWidth || T?.base) ?? 0), M = ["sidebar", S ? "sidebar--drawer" : `sidebar--${y}`].join(" ");
58
- return /* @__PURE__ */ c(t.Provider, {
59
- value: { rail: x },
60
- children: /* @__PURE__ */ l("aside", {
61
- ref: C,
62
- id: p,
63
- className: M,
64
- "aria-label": m,
65
- role: S && y === "open" ? "dialog" : void 0,
66
- "aria-modal": S && y === "open" ? !0 : void 0,
67
- "data-state": y,
68
- tabIndex: S ? -1 : void 0,
69
- inert: S && y === "closed" ? !0 : void 0,
70
- onClick: D,
71
- children: [/* @__PURE__ */ l("div", {
55
+ let e = T.current, t = document.activeElement;
56
+ (e && t instanceof Node && e.contains(t) || t === document.body || t === null) && E.current?.focus?.(), E.current = null;
57
+ }, [w, x]);
58
+ let N = Math.round(x === "rail" ? D?.rail ?? 0 : (b?.sidebarWidth || D?.base) ?? 0), P = ["sidebar", w ? "sidebar--drawer" : `sidebar--${x}`].join(" ");
59
+ return /* @__PURE__ */ l(n.Provider, {
60
+ value: { rail: C },
61
+ children: /* @__PURE__ */ u("aside", {
62
+ ref: T,
63
+ id: m,
64
+ className: P,
65
+ "aria-label": y("label", h),
66
+ role: w && x === "open" ? "dialog" : void 0,
67
+ "aria-modal": w && x === "open" ? !0 : void 0,
68
+ "data-state": x,
69
+ tabIndex: w ? -1 : void 0,
70
+ inert: w && x === "closed" ? !0 : void 0,
71
+ onClick: k,
72
+ children: [/* @__PURE__ */ u("div", {
72
73
  className: "sidebar__inner",
73
74
  children: [
74
- e && /* @__PURE__ */ c("div", {
75
+ t && /* @__PURE__ */ l("div", {
75
76
  className: "sidebar__header",
76
- children: e
77
+ children: t
77
78
  }),
78
- /* @__PURE__ */ c("div", {
79
+ /* @__PURE__ */ l("div", {
79
80
  className: "sidebar__panel",
80
- children: d
81
+ children: f
81
82
  }),
82
- f && /* @__PURE__ */ c("div", {
83
+ p && /* @__PURE__ */ l("div", {
83
84
  className: "sidebar__footer",
84
- children: f
85
+ children: p
85
86
  })
86
87
  ]
87
- }), b && v && y !== "closed" && /* @__PURE__ */ c("div", {
88
+ }), S && b && x !== "closed" && /* @__PURE__ */ l("div", {
88
89
  className: "sidebar__resizer",
89
90
  role: "separator",
90
91
  "aria-orientation": "vertical",
91
- "aria-label": h,
92
- "aria-valuenow": j,
93
- "aria-valuemin": T ? Math.round(T.rail) : void 0,
94
- "aria-valuemax": T ? Math.round(T.max) : void 0,
95
- "aria-valuetext": g(j),
92
+ "aria-label": y("resizer", g),
93
+ "aria-valuenow": N,
94
+ "aria-valuemin": D ? Math.round(D.rail) : void 0,
95
+ "aria-valuemax": D ? Math.round(D.max) : void 0,
96
+ "aria-valuetext": y("resizerValue", _)(N),
96
97
  tabIndex: 0,
97
- onPointerDown: k,
98
- onKeyDown: A
98
+ onPointerDown: j,
99
+ onKeyDown: M
99
100
  })]
100
101
  })
101
102
  });
102
103
  }
103
- function f({ className: e, ...t }) {
104
- return /* @__PURE__ */ c("div", {
104
+ function p({ className: e, ...t }) {
105
+ return /* @__PURE__ */ l("div", {
105
106
  className: ["sidebar__group", e].filter(Boolean).join(" "),
106
107
  ...t
107
108
  });
108
109
  }
109
- function p({ className: e, ...t }) {
110
- return /* @__PURE__ */ c("div", {
110
+ function m({ className: e, ...t }) {
111
+ return /* @__PURE__ */ l("div", {
111
112
  className: ["sidebar__group-content", e].filter(Boolean).join(" "),
112
113
  ...t
113
114
  });
114
115
  }
115
- function m({ className: e, ...t }) {
116
- return /* @__PURE__ */ c("hr", {
116
+ function h({ className: e, ...t }) {
117
+ return /* @__PURE__ */ l("hr", {
117
118
  className: ["sidebar__separator", e].filter(Boolean).join(" "),
118
119
  ...t
119
120
  });
120
121
  }
121
122
  //#endregion
122
- export { d as Sidebar, f as SidebarGroup, p as SidebarGroupContent, m as SidebarSeparator, e as useSidebar };
123
+ export { f as Sidebar, p as SidebarGroup, m as SidebarGroupContent, h as SidebarSeparator, t as useSidebar };
@@ -1,74 +1,75 @@
1
1
  'use client';
2
2
  import './site-header.css';
3
- import { Container as e } from "./container.js";
4
- import { MenuButton as t } from "./menu-button.js";
5
- import { t as n } from "./_shared/logo.js";
6
- import { useEffect as r, useRef as i, useState as a } from "react";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Container as t } from "./container.js";
5
+ import { MenuButton as n } from "./menu-button.js";
6
+ import { t as r } from "./_shared/logo.js";
7
+ import { useEffect as i, useRef as a, useState as o } from "react";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
9
  //#region src/stories/sections/SiteHeader/SiteHeader.tsx
9
- function c({ children: e, ...t }) {
10
- return /* @__PURE__ */ o("a", {
10
+ function l({ children: e, ...t }) {
11
+ return /* @__PURE__ */ s("a", {
11
12
  ...t,
12
13
  children: e
13
14
  });
14
15
  }
15
- function l({ logoHref: l = "/", logoLabel: u = "Studio LXD — ir al inicio", menuLabel: d = "Menú de navegación", menuCloseLabel: f, logoSize: p = "xxl", logo: m = /* @__PURE__ */ o(n, { size: p }), menuButtonSize: h = "lg", renderLogoLink: g = c, width: _ = "xl", open: v, onOpenChange: y, children: b, settings: x, panelId: S = "site-header-panel", actions: C, language: w }) {
16
- let [T, E] = a(!1), D = v !== void 0, O = D ? v : T, k = !!(b || x || w), A = i(null), j = i(null), M = (e) => {
17
- D || E(e), y?.(e);
16
+ function u({ logoHref: u = "/", logoLabel: d, menuLabel: f, menuCloseLabel: p, logoSize: m = "xxl", logo: h = /* @__PURE__ */ s(r, { size: m }), menuButtonSize: g = "lg", renderLogoLink: _ = l, width: v = "xl", open: y, onOpenChange: b, children: x, settings: S, panelId: C = "site-header-panel", actions: w, language: T }) {
17
+ let E = e("siteHeader"), [D, O] = o(!1), k = y !== void 0, A = k ? y : D, j = !!(x || S || T), M = a(null), N = a(null), P = (e) => {
18
+ k || O(e), b?.(e);
18
19
  };
19
- return r(() => {
20
- if (!O) return;
20
+ return i(() => {
21
+ if (!A) return;
21
22
  let e = (e) => {
22
- e.key === "Escape" && (M(!1), j.current?.focus());
23
+ e.key === "Escape" && (P(!1), N.current?.focus());
23
24
  }, t = (e) => {
24
25
  let t = e.target;
25
- A.current?.contains(t) || t?.closest("[role=\"menu\"], [role=\"listbox\"], [role=\"dialog\"]") || M(!1);
26
+ M.current?.contains(t) || t?.closest("[role=\"menu\"], [role=\"listbox\"], [role=\"dialog\"]") || P(!1);
26
27
  };
27
28
  document.addEventListener("keydown", e), document.addEventListener("pointerdown", t);
28
29
  let n = document.body.style.overflow;
29
30
  return document.body.style.overflow = "hidden", () => {
30
31
  document.removeEventListener("keydown", e), document.removeEventListener("pointerdown", t), document.body.style.overflow = n;
31
32
  };
32
- }, [O]), /* @__PURE__ */ o("header", {
33
- ref: A,
33
+ }, [A]), /* @__PURE__ */ s("header", {
34
+ ref: M,
34
35
  className: "site-header",
35
- children: /* @__PURE__ */ s(e, {
36
- width: _,
36
+ children: /* @__PURE__ */ c(t, {
37
+ width: v,
37
38
  innerClassName: "site-header__bar",
38
39
  children: [
39
- g({
40
- href: l,
40
+ _({
41
+ href: u,
41
42
  className: "site-header__logo",
42
- "aria-label": u,
43
- children: m
43
+ "aria-label": E("logo", d),
44
+ children: h
44
45
  }),
45
- /* @__PURE__ */ s("div", {
46
+ /* @__PURE__ */ c("div", {
46
47
  className: "site-header__controls",
47
- children: [C && /* @__PURE__ */ o("div", {
48
+ children: [w && /* @__PURE__ */ s("div", {
48
49
  className: "site-header__actions",
49
- children: C
50
- }), k && /* @__PURE__ */ o(t, {
51
- ref: j,
52
- isOpen: O,
53
- onClick: () => M(!O),
54
- label: d,
55
- closeLabel: f,
56
- size: h,
57
- "aria-controls": S
50
+ children: w
51
+ }), j && /* @__PURE__ */ s(n, {
52
+ ref: N,
53
+ isOpen: A,
54
+ onClick: () => P(!A),
55
+ label: f,
56
+ closeLabel: p,
57
+ size: g,
58
+ "aria-controls": C
58
59
  })]
59
60
  }),
60
- k && /* @__PURE__ */ o("div", {
61
- className: ["site-header__panel", O ? "site-header__panel--open" : ""].filter(Boolean).join(" "),
62
- id: S,
63
- inert: !O,
64
- "aria-hidden": !O,
65
- children: /* @__PURE__ */ s(e, {
66
- width: _,
61
+ j && /* @__PURE__ */ s("div", {
62
+ className: ["site-header__panel", A ? "site-header__panel--open" : ""].filter(Boolean).join(" "),
63
+ id: C,
64
+ inert: !A,
65
+ "aria-hidden": !A,
66
+ children: /* @__PURE__ */ c(t, {
67
+ width: v,
67
68
  space: "none",
68
69
  innerClassName: "site-header__panel-inner",
69
- children: [b, (w || x) && /* @__PURE__ */ s("div", {
70
+ children: [x, (T || S) && /* @__PURE__ */ c("div", {
70
71
  className: "site-header__settings",
71
- children: [w, x]
72
+ children: [T, S]
72
73
  })]
73
74
  })
74
75
  })
@@ -77,4 +78,4 @@ function l({ logoHref: l = "/", logoLabel: u = "Studio LXD — ir al inicio", me
77
78
  });
78
79
  }
79
80
  //#endregion
80
- export { l as SiteHeader };
81
+ export { u as SiteHeader };