@studiolxd/brand 43.0.0 → 44.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.
@@ -1,18 +1,19 @@
1
1
  'use client';
2
2
  import './avatar-upload.css';
3
- import { Icon as e } from "./icon.js";
4
- import { VisuallyHidden as t } from "./visually-hidden.js";
5
- import { n } from "./_shared/form-size.js";
6
- import { Button as r } from "./button.js";
7
- import { Avatar as i } from "./avatar.js";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { VisuallyHidden as n } from "./visually-hidden.js";
6
+ import { n as r } from "./_shared/form-size.js";
7
+ import { Button as i } from "./button.js";
8
+ import { Avatar as a } from "./avatar.js";
8
9
  import { ErrorText as ee } from "./error-text.js";
9
- import { n as te, t as a } from "./_shared/validate.js";
10
- import { t as ne } from "./_shared/env.js";
11
- import { t as re } from "./_shared/imagecropdialog.js";
12
- import { useCallback as ie, useEffect as o, useId as s, useRef as c, useState as l } from "react";
10
+ import { i as te, n as ne, r as o, t as re } from "./_shared/validate.js";
11
+ import { t as ie } from "./_shared/env.js";
12
+ import { t as ae } from "./_shared/imagecropdialog.js";
13
+ import { useCallback as oe, useEffect as s, useId as se, useRef as c, useState as l } from "react";
13
14
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
14
15
  //#region src/stories/molecules/AvatarUpload/AvatarUpload.tsx
15
- var ae = {
16
+ var ce = {
16
17
  sm: "2xl",
17
18
  md: "3xl",
18
19
  lg: "4xl"
@@ -21,92 +22,94 @@ var ae = {
21
22
  md: "lg",
22
23
  lg: "xl"
23
24
  };
24
- function p(e) {
25
- return e.split(",").map((e) => e.trim()).filter(Boolean).map((e) => e.startsWith(".") ? e.slice(1) : e.split("/")[1] ?? e).map((e) => e.toUpperCase()).join(", ");
25
+ function le(e, t) {
26
+ return o(e.split(",").map((e) => e.trim()).filter(Boolean).map((e) => e.startsWith(".") ? e.slice(1) : e.split("/")[1] ?? e).map((e) => e.toUpperCase()), t);
26
27
  }
27
- function m({ src: m, name: oe, alt: h, shape: g = "circle", size: se, accept: _ = "image/jpeg,image/png,image/webp", maxSize: v, outputMimeType: y = "image/jpeg", outputSize: b, disabled: x = !1, busy: S = !1, errorMessage: ce, onChange: le, onSelect: C, onError: w, buttonLabel: T = "Subir", buttonAccessibleLabel: ue, hintLabel: de, formatsLabel: fe, maxSizeHint: pe = (e) => `máx. ${e}`, invalidTypeError: E = (e) => `Formato no admitido. Se aceptan ${e}.`, tooLargeError: D = (e) => `El archivo pesa demasiado. El máximo es ${e}.`, dropActiveMessage: me = "Suelta la imagen sobre el avatar para subirla", dropHintLabel: O = "…o arrastra la imagen hasta el avatar", cropTitle: he = "Recortar imagen", cropDescription: k, cropCancelLabel: A = "Cancelar", cropConfirmLabel: j = "Guardar", cropCloseLabel: M = "Cerrar", cropLoadingLabel: N, cropErrorMessage: P, className: F }) {
28
- let I = n(se), L = c(null), R = c(null), [z, B] = l(null), [V, H] = l(!1), [ge, U] = l(!1), [_e, W] = l(null), G = s(), K = `${G}-hint`, q = `${G}-error`, J = fe ?? p(_), Y = de ?? [J, v === void 0 ? null : pe(a(v))].filter(Boolean).join(" · "), X = _e ?? ce, Z = x || S, Q = ue ?? T;
29
- ne() && !Q.toLowerCase().includes(T.toLowerCase()) && console.warn(`[AvatarUpload] El nombre accesible del botón ("${Q}") no contiene su texto visible ("${T}"). WCAG 2.5.3 (Label in Name) lo exige: quien navega por voz dice lo que ve, y con estos textos no encontraría el control.`), o(() => {
30
- R.current = z;
31
- }, [z]), o(() => () => {
32
- R.current && URL.revokeObjectURL(R.current.url);
33
- }, []), o(() => {
34
- if (Z) return;
28
+ function p({ src: o, name: p, alt: m, shape: h = "circle", size: ue, accept: g = "image/jpeg,image/png,image/webp", maxSize: _, outputMimeType: de = "image/jpeg", outputSize: v, disabled: fe = !1, busy: y = !1, errorMessage: b, onChange: pe, onSelect: x, onError: S, subject: me, buttonLabel: he, buttonAccessibleLabel: ge, hintLabel: _e, formatsLabel: ve, locale: C = re, maxSizeHint: ye, invalidTypeError: w, tooLargeError: T, dropActiveMessage: be, dropHintLabel: xe, cropTitle: Se, cropDescription: Ce, cropCancelLabel: E, cropConfirmLabel: D, cropCloseLabel: O, cropLoadingLabel: k, cropErrorMessage: A, className: we }) {
29
+ let j = e("avatarUpload"), M = r(ue), N = c(null), P = c(null), [F, I] = l(null), [L, R] = l(!1), [z, B] = l(!1), [Te, V] = l(null), H = se(), U = `${H}-hint`, W = `${H}-error`, G = j("subject", me), K = ve ?? le(g, C), q = _e ?? [K, _ === void 0 ? null : j("maxSize", ye)(ne(_, C))].filter(Boolean).join(" · "), J = Te ?? b, Y = fe || y, X = j("button", he), Z = ge ?? j("buttonFor")(G);
30
+ ie() && !Z.toLowerCase().includes(X.toLowerCase()) && console.warn(`[AvatarUpload] El nombre accesible del botón ("${Z}") no contiene su texto visible ("${X}"). WCAG 2.5.3 (Label in Name) lo exige: quien navega por voz dice lo que ve, y con estos textos no encontraría el control.`), s(() => {
31
+ P.current = F;
32
+ }, [F]), s(() => () => {
33
+ P.current && URL.revokeObjectURL(P.current.url);
34
+ }, []), s(() => {
35
+ if (Y) return;
35
36
  let e = 0, t = (e) => Array.from(e.dataTransfer?.types ?? []).includes("Files"), n = (n) => {
36
- t(n) && (e += 1, H(!0));
37
+ t(n) && (e += 1, R(!0));
37
38
  }, r = () => {
38
- e = Math.max(0, e - 1), e === 0 && H(!1);
39
+ e = Math.max(0, e - 1), e === 0 && R(!1);
39
40
  }, i = () => {
40
- e = 0, H(!1);
41
+ e = 0, R(!1);
41
42
  };
42
43
  return window.addEventListener("dragenter", n), window.addEventListener("dragleave", r), window.addEventListener("drop", i), window.addEventListener("dragend", i), () => {
43
- window.removeEventListener("dragenter", n), window.removeEventListener("dragleave", r), window.removeEventListener("drop", i), window.removeEventListener("dragend", i), H(!1);
44
+ window.removeEventListener("dragenter", n), window.removeEventListener("dragleave", r), window.removeEventListener("drop", i), window.removeEventListener("dragend", i), R(!1);
44
45
  };
45
- }, [Z]);
46
- let $ = ie((e) => {
47
- let t = te(e, _, v, D, E(J));
46
+ }, [Y]);
47
+ let Q = oe((e) => {
48
+ let t = te(e, g, _, j("tooLarge", T), j("invalidType", w)(K), C);
48
49
  if (t) {
49
- W(t), w?.(t);
50
+ V(t), S?.(t);
50
51
  return;
51
52
  }
52
- W(null), C?.(e), B({
53
+ V(null), x?.(e), I({
53
54
  url: URL.createObjectURL(e),
54
55
  file: e
55
56
  });
56
57
  }, [
58
+ g,
57
59
  _,
58
- v,
59
- D,
60
- E,
61
- J,
60
+ j,
61
+ T,
62
62
  w,
63
- C
64
- ]), ve = () => {
65
- z && URL.revokeObjectURL(z.url), B(null);
66
- }, ye = async (e) => {
67
- z && await le(e, z.file);
68
- };
63
+ K,
64
+ C,
65
+ S,
66
+ x
67
+ ]), Ee = () => {
68
+ F && URL.revokeObjectURL(F.url), I(null);
69
+ }, De = async (e) => {
70
+ F && await pe(e, F.file);
71
+ }, $ = xe ?? j("dropHint")(G);
69
72
  return /* @__PURE__ */ d("div", {
70
73
  className: [
71
74
  "avatar-upload",
72
- g === "square" ? "avatar-upload--square" : "",
73
- V ? "avatar-upload--armed" : "",
74
- ge ? "avatar-upload--over" : "",
75
- Z ? "avatar-upload--inert" : "",
76
- F ?? ""
75
+ h === "square" ? "avatar-upload--square" : "",
76
+ L ? "avatar-upload--armed" : "",
77
+ z ? "avatar-upload--over" : "",
78
+ Y ? "avatar-upload--inert" : "",
79
+ we ?? ""
77
80
  ].filter(Boolean).join(" "),
78
81
  children: [
79
82
  /* @__PURE__ */ d("div", {
80
83
  className: "avatar-upload__target",
81
84
  onClick: () => {
82
- Z || L.current?.click();
85
+ Y || N.current?.click();
83
86
  },
84
87
  onDragEnter: (e) => {
85
- e.preventDefault(), Z || U(!0);
88
+ e.preventDefault(), Y || B(!0);
86
89
  },
87
90
  onDragOver: (e) => {
88
- e.preventDefault(), !Z && (e.dataTransfer.dropEffect = "copy", U(!0));
91
+ e.preventDefault(), !Y && (e.dataTransfer.dropEffect = "copy", B(!0));
89
92
  },
90
93
  onDragLeave: (e) => {
91
- e.currentTarget.contains(e.relatedTarget) || U(!1);
94
+ e.currentTarget.contains(e.relatedTarget) || B(!1);
92
95
  },
93
96
  onDrop: (e) => {
94
- if (e.preventDefault(), U(!1), H(!1), Z) return;
97
+ if (e.preventDefault(), B(!1), R(!1), Y) return;
95
98
  let t = e.dataTransfer.files?.[0];
96
- t && $(t);
99
+ t && Q(t);
97
100
  },
98
- children: [/* @__PURE__ */ u(i, {
99
- src: m ?? void 0,
100
- name: oe,
101
- ...h === void 0 ? {} : { alt: h },
102
- shape: g,
103
- size: ae[I]
101
+ children: [/* @__PURE__ */ u(a, {
102
+ src: o ?? void 0,
103
+ name: p,
104
+ ...m === void 0 ? {} : { alt: m },
105
+ shape: h,
106
+ size: ce[M]
104
107
  }), /* @__PURE__ */ u("span", {
105
108
  className: "avatar-upload__overlay",
106
109
  "aria-hidden": "true",
107
- children: /* @__PURE__ */ u(e, {
110
+ children: /* @__PURE__ */ u(t, {
108
111
  name: "upload",
109
- size: f[I]
112
+ size: f[M]
110
113
  })
111
114
  })]
112
115
  }),
@@ -114,63 +117,63 @@ function m({ src: m, name: oe, alt: h, shape: g = "circle", size: se, accept: _
114
117
  className: "avatar-upload__body",
115
118
  children: [
116
119
  /* @__PURE__ */ u("input", {
117
- ref: L,
120
+ ref: N,
118
121
  type: "file",
119
122
  className: "avatar-upload__input",
120
- accept: _,
123
+ accept: g,
121
124
  tabIndex: -1,
122
125
  "aria-hidden": "true",
123
- disabled: Z,
126
+ disabled: Y,
124
127
  onChange: (e) => {
125
128
  let t = e.target.files?.[0];
126
- t && $(t), e.target.value = "";
129
+ t && Q(t), e.target.value = "";
127
130
  }
128
131
  }),
129
- /* @__PURE__ */ u(r, {
132
+ /* @__PURE__ */ u(i, {
130
133
  variant: "outline",
131
- size: I,
132
- disabled: Z,
133
- onClick: () => L.current?.click(),
134
- ...Q === T ? {} : { "aria-label": Q },
135
- "aria-describedby": [Y ? K : null, X ? q : null].filter(Boolean).join(" ") || void 0,
136
- children: T
134
+ size: M,
135
+ disabled: Y,
136
+ onClick: () => N.current?.click(),
137
+ ...Z === X ? {} : { "aria-label": Z },
138
+ "aria-describedby": [q ? U : null, J ? W : null].filter(Boolean).join(" ") || void 0,
139
+ children: X
137
140
  }),
138
- Y && /* @__PURE__ */ u(t, {
139
- id: K,
140
- children: Y
141
+ q && /* @__PURE__ */ u(n, {
142
+ id: U,
143
+ children: q
141
144
  }),
142
- O && /* @__PURE__ */ u("span", {
145
+ $ && /* @__PURE__ */ u("span", {
143
146
  className: "avatar-upload__hint",
144
- children: O
147
+ children: $
145
148
  }),
146
- X && /* @__PURE__ */ u(ee, {
147
- id: q,
148
- children: X
149
+ J && /* @__PURE__ */ u(ee, {
150
+ id: W,
151
+ children: J
149
152
  })
150
153
  ]
151
154
  }),
152
- /* @__PURE__ */ u(t, {
155
+ /* @__PURE__ */ u(n, {
153
156
  role: "status",
154
- children: V ? me : ""
157
+ children: L ? be ?? j("dropActive")(G) : ""
155
158
  }),
156
- /* @__PURE__ */ u(re, {
157
- sourceUrl: z?.url ?? null,
158
- title: he,
159
- description: k,
160
- circularCrop: g === "circle",
161
- outputMimeType: y,
162
- ...b === void 0 ? {} : { outputSize: b },
163
- busy: S,
164
- cancelLabel: A,
165
- confirmLabel: j,
166
- closeLabel: M,
167
- ...N === void 0 ? {} : { loadingLabel: N },
168
- ...P === void 0 ? {} : { errorMessage: P },
169
- onConfirm: ye,
170
- onClose: ve
159
+ /* @__PURE__ */ u(ae, {
160
+ sourceUrl: F?.url ?? null,
161
+ title: Se,
162
+ description: Ce,
163
+ circularCrop: h === "circle",
164
+ outputMimeType: de,
165
+ ...v === void 0 ? {} : { outputSize: v },
166
+ busy: y,
167
+ cancelLabel: E ?? j("cropCancel"),
168
+ confirmLabel: D ?? j("cropConfirm"),
169
+ ...O === void 0 ? {} : { closeLabel: O },
170
+ ...k === void 0 ? {} : { loadingLabel: k },
171
+ ...A === void 0 ? {} : { errorMessage: A },
172
+ onConfirm: De,
173
+ onClose: Ee
171
174
  })
172
175
  ]
173
176
  });
174
177
  }
175
178
  //#endregion
176
- export { m as AvatarUpload };
179
+ export { p as AvatarUpload };
@@ -1,19 +1,20 @@
1
1
  'use client';
2
2
  import './calendar-planner.css';
3
- import { VisuallyHidden as e } from "./visually-hidden.js";
4
- import { Tag as t } from "./tag.js";
5
- import { Modal as n } from "./modal.js";
6
- import { c as r, i, l as a, n as o, o as s, r as c, s as l, t as u } from "./_shared/calendargrid.js";
7
- import { useCallback as d, useId as f, useState as p } from "react";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { VisuallyHidden as t } from "./visually-hidden.js";
5
+ import { Tag as n } from "./tag.js";
6
+ import { Modal as r } from "./modal.js";
7
+ import { c as i, i as a, l as o, n as s, o as c, r as l, s as u, t as d } from "./_shared/calendargrid.js";
8
+ import { useCallback as f, useId as ee, useState as p } from "react";
8
9
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
9
10
  //#region src/stories/molecules/CalendarPlanner/CalendarPlanner.tsx
10
- function _({ events: _ = [], renderDay: v, maxItemsPerDay: y = 3, onMoreClick: b, showMoreDialog: x, onDayClick: S, month: C, defaultMonth: w, onMonthChange: T, navigable: E = !0, locale: D = "es-ES", previousMonthLabel: O = "Mes anterior", nextMonthLabel: k = "Mes siguiente", gridLabel: A, moreLabel: j = (e) => `+${e} más`, size: M = "md", className: N }) {
11
- let [P, F] = p(() => C ?? w ?? /* @__PURE__ */ new Date()), [I, L] = p(null), R = x ?? !b, z = d(() => L(null), []), B = C ?? P, V = d((e) => {
12
- F(e), T?.(e);
13
- }, [T]), H = /* @__PURE__ */ new Date(), U = M === "sm" ? "xs" : M === "lg" ? "md" : "sm", W = new Intl.DateTimeFormat(D, {
11
+ function _({ events: _ = [], renderDay: v, maxItemsPerDay: y = 3, onMoreClick: b, showMoreDialog: x, onDayClick: S, month: C, defaultMonth: w, onMonthChange: T, navigable: E = !0, locale: D = "es-ES", previousMonthLabel: O, nextMonthLabel: k, gridLabel: A, moreLabel: te = (e) => `+${e} más`, size: j = "md", className: M }) {
12
+ let [N, P] = p(() => C ?? w ?? /* @__PURE__ */ new Date()), [F, I] = p(null), L = x ?? !b, R = f(() => I(null), []), z = C ?? N, B = f((e) => {
13
+ P(e), T?.(e);
14
+ }, [T]), V = e("calendar"), H = /* @__PURE__ */ new Date(), U = j === "sm" ? "xs" : j === "lg" ? "md" : "sm", W = new Intl.DateTimeFormat(D, {
14
15
  month: "long",
15
16
  year: "numeric"
16
- }).format(B), G = new Intl.DateTimeFormat(D, {
17
+ }).format(z), G = new Intl.DateTimeFormat(D, {
17
18
  weekday: "long",
18
19
  day: "numeric",
19
20
  month: "long",
@@ -23,27 +24,27 @@ function _({ events: _ = [], renderDay: v, maxItemsPerDay: y = 3, onMoreClick: b
23
24
  day: "numeric",
24
25
  month: "long",
25
26
  year: "numeric"
26
- }), q = c(D, "short"), J = u(o(B)), Y = r(B, -1), X = r(B, 1), Z = (e) => _.filter((t) => i(t.date, e)), Q = a({
27
- month: B,
28
- onMonthChange: V,
27
+ }), q = l(D, "short"), J = d(s(z)), Y = i(z, -1), X = i(z, 1), Z = (e) => _.filter((t) => a(t.date, e)), Q = o({
28
+ month: z,
29
+ onMonthChange: B,
29
30
  onActivate: S ? (e) => S(e, Z(e)) : void 0
30
- }), $ = `${f()}-planner-title-${B.getFullYear()}-${B.getMonth()}`;
31
+ }), $ = `${ee()}-planner-title-${z.getFullYear()}-${z.getMonth()}`;
31
32
  return /* @__PURE__ */ g("div", {
32
33
  className: [
33
34
  "calendar-planner",
34
- `calendar-planner--${M}`,
35
- N
35
+ `calendar-planner--${j}`,
36
+ M
36
37
  ].filter(Boolean).join(" "),
37
38
  children: [
38
- s({
39
+ c({
39
40
  block: "calendar-planner",
40
41
  title: W,
41
42
  titleId: $,
42
43
  navigable: E,
43
- previousLabel: O,
44
- nextLabel: k,
45
- onPrev: () => V(Y),
46
- onNext: () => V(X),
44
+ previousLabel: E ? V("previousMonth", O) : void 0,
45
+ nextLabel: E ? V("nextMonth", k) : void 0,
46
+ onPrev: () => B(Y),
47
+ onNext: () => B(X),
47
48
  chevronSize: U
48
49
  }),
49
50
  /* @__PURE__ */ g("div", {
@@ -52,65 +53,65 @@ function _({ events: _ = [], renderDay: v, maxItemsPerDay: y = 3, onMoreClick: b
52
53
  "aria-label": A,
53
54
  "aria-labelledby": A ? void 0 : $,
54
55
  onKeyDown: S ? Q.onKeyDown : void 0,
55
- children: [l({
56
+ children: [u({
56
57
  block: "calendar-planner",
57
58
  rowModifier: "header",
58
59
  weekdays: q
59
- }), J.map((n, r) => /* @__PURE__ */ h("div", {
60
+ }), J.map((e, r) => /* @__PURE__ */ h("div", {
60
61
  role: "row",
61
62
  className: "calendar-planner__row",
62
- children: n.map(({ date: n, outside: r }) => {
63
- let a = i(n, H), o = Z(n), s = o.slice(0, y), c = o.length - s.length, l = [
63
+ children: e.map(({ date: e, outside: r }) => {
64
+ let i = a(e, H), o = Z(e), s = o.slice(0, y), c = o.length - s.length, l = [
64
65
  "calendar-planner__cell",
65
66
  r && "calendar-planner__cell--outside",
66
- a && "calendar-planner__cell--today"
67
+ i && "calendar-planner__cell--today"
67
68
  ].filter(Boolean).join(" "), u = [
68
69
  "calendar-planner__day-number",
69
- a && "calendar-planner__day-number--today",
70
+ i && "calendar-planner__day-number--today",
70
71
  r && "calendar-planner__day-number--outside"
71
72
  ].filter(Boolean).join(" ");
72
73
  return /* @__PURE__ */ g("div", {
73
- ref: S ? Q.cellRef(n) : void 0,
74
+ ref: S ? Q.cellRef(e) : void 0,
74
75
  role: "gridcell",
75
76
  className: [l, S ? "calendar-planner__cell--clickable" : ""].filter(Boolean).join(" "),
76
- "aria-current": a ? "date" : void 0,
77
- tabIndex: S ? Q.isTabbable(n) ? 0 : -1 : void 0,
78
- onFocus: S ? () => Q.onCellFocus(n) : void 0,
79
- onClick: S ? () => S(n, o) : void 0,
77
+ "aria-current": i ? "date" : void 0,
78
+ tabIndex: S ? Q.isTabbable(e) ? 0 : -1 : void 0,
79
+ onFocus: S ? () => Q.onCellFocus(e) : void 0,
80
+ onClick: S ? () => S(e, o) : void 0,
80
81
  children: [/* @__PURE__ */ g("span", {
81
82
  className: u,
82
- children: [/* @__PURE__ */ h(e, { children: G.format(n) }), /* @__PURE__ */ h("span", {
83
+ children: [/* @__PURE__ */ h(t, { children: G.format(e) }), /* @__PURE__ */ h("span", {
83
84
  "aria-hidden": "true",
84
- children: n.getDate()
85
+ children: e.getDate()
85
86
  })]
86
87
  }), /* @__PURE__ */ h("div", {
87
88
  className: "calendar-planner__cell-body",
88
- children: v ? v(n, o) : /* @__PURE__ */ g(m, { children: [s.map((e) => /* @__PURE__ */ h(t, {
89
+ children: v ? v(e, o) : /* @__PURE__ */ g(m, { children: [s.map((e) => /* @__PURE__ */ h(n, {
89
90
  variant: e.variant ?? "neutral",
90
91
  children: e.label
91
92
  }, e.id)), c > 0 && /* @__PURE__ */ h("button", {
92
93
  type: "button",
93
94
  className: "calendar-planner__more",
94
- onClick: (e) => {
95
- e.stopPropagation(), R && L({
96
- date: n,
95
+ onClick: (t) => {
96
+ t.stopPropagation(), L && I({
97
+ date: e,
97
98
  events: o
98
- }), b?.(n, o);
99
+ }), b?.(e, o);
99
100
  },
100
- children: j(c)
101
+ children: te(c)
101
102
  })] })
102
103
  })]
103
- }, n.toISOString());
104
+ }, e.toISOString());
104
105
  })
105
106
  }, r))]
106
107
  }),
107
- /* @__PURE__ */ h(n, {
108
- open: I !== null,
109
- onClose: z,
110
- title: I ? K.format(I.date) : void 0,
108
+ /* @__PURE__ */ h(r, {
109
+ open: F !== null,
110
+ onClose: R,
111
+ title: F ? K.format(F.date) : void 0,
111
112
  children: /* @__PURE__ */ h("div", {
112
113
  className: "calendar-planner__modal-events",
113
- children: I?.events.map((e) => /* @__PURE__ */ h(t, {
114
+ children: F?.events.map((e) => /* @__PURE__ */ h(n, {
114
115
  variant: e.variant ?? "neutral",
115
116
  children: e.label
116
117
  }, e.id))
@@ -1,25 +1,26 @@
1
1
  'use client';
2
2
  import './calendar-roster.css';
3
- import { Tag as e } from "./tag.js";
4
- import { PrevNextNav as t } from "./prev-next-nav.js";
5
- import { c as n, i as r } from "./_shared/calendargrid.js";
6
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Tag as t } from "./tag.js";
5
+ import { PrevNextNav as n } from "./prev-next-nav.js";
6
+ import { c as r, i } from "./_shared/calendargrid.js";
7
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
8
  //#region src/stories/molecules/CalendarRoster/CalendarRoster.tsx
8
- function s(e) {
9
+ function c(e) {
9
10
  let t = e.getDay();
10
11
  return t === 0 || t === 6;
11
12
  }
12
- function c(e) {
13
+ function l(e) {
13
14
  let t = e.getFullYear(), n = e.getMonth(), r = new Date(t, n + 1, 0).getDate();
14
15
  return Array.from({ length: r }, (e, r) => new Date(t, n, r + 1));
15
16
  }
16
- var l = {
17
+ var u = {
17
18
  holiday: "neutral",
18
19
  vacation: "info",
19
20
  absence: "danger",
20
21
  recovery: "success",
21
22
  birthday: "info"
22
- }, u = [
23
+ }, d = [
23
24
  {
24
25
  type: "holiday",
25
26
  label: "Festivo"
@@ -45,67 +46,67 @@ var l = {
45
46
  label: "No laborable"
46
47
  }
47
48
  ];
48
- function d({ rows: d, month: f, onMonthChange: p, hrefBuilder: m, linkComponent: h, renderCell: g, nameLabel: _ = "Empleado", birthdayPrefix: v = "🎂 ", showLegend: y = !0, locale: b = "es-ES", legendItems: x = u, legendLabel: S = "Leyenda", previousMonthLabel: C = "Mes anterior", nextMonthLabel: w = "Mes siguiente", className: T }) {
49
- let E = /* @__PURE__ */ new Date(), D = c(f), O = n(f, -1), k = n(f, 1), A = new Intl.DateTimeFormat(b, {
49
+ function f({ rows: f, month: p, onMonthChange: m, hrefBuilder: h, linkComponent: g, renderCell: _, nameLabel: v = "Empleado", birthdayPrefix: y = "🎂 ", showLegend: b = !0, locale: x = "es-ES", legendItems: S = d, legendLabel: C = "Leyenda", previousMonthLabel: w, nextMonthLabel: T, className: E }) {
50
+ let D = e("calendar"), O = /* @__PURE__ */ new Date(), k = l(p), A = r(p, -1), j = r(p, 1), M = new Intl.DateTimeFormat(x, {
50
51
  month: "long",
51
52
  year: "numeric"
52
- }).format(f), j = new Intl.DateTimeFormat(b, { weekday: "narrow" }), M = new Intl.DateTimeFormat(b, { weekday: "long" }), N = p ? (e) => (t) => {
53
- m && t.preventDefault(), p(e);
54
- } : void 0, P = `roster-title-${f.getFullYear()}-${f.getMonth()}`;
55
- return /* @__PURE__ */ o("div", {
56
- className: ["calendar-roster", T].filter(Boolean).join(" "),
53
+ }).format(p), N = new Intl.DateTimeFormat(x, { weekday: "narrow" }), P = new Intl.DateTimeFormat(x, { weekday: "long" }), F = m ? (e) => (t) => {
54
+ h && t.preventDefault(), m(e);
55
+ } : void 0, I = `roster-title-${p.getFullYear()}-${p.getMonth()}`;
56
+ return /* @__PURE__ */ s("div", {
57
+ className: ["calendar-roster", E].filter(Boolean).join(" "),
57
58
  children: [
58
- /* @__PURE__ */ a("div", {
59
+ /* @__PURE__ */ o("div", {
59
60
  className: "calendar-roster__nav",
60
- children: /* @__PURE__ */ a(t, {
61
- label: A,
62
- labelId: P,
63
- prevHref: m?.(O),
64
- nextHref: m?.(k),
65
- prevOnClick: N?.(O),
66
- nextOnClick: N?.(k),
67
- prevLabel: C,
68
- nextLabel: w,
69
- linkComponent: h
61
+ children: /* @__PURE__ */ o(n, {
62
+ label: M,
63
+ labelId: I,
64
+ prevHref: h?.(A),
65
+ nextHref: h?.(j),
66
+ prevOnClick: F?.(A),
67
+ nextOnClick: F?.(j),
68
+ prevLabel: D("previousMonth", w),
69
+ nextLabel: D("nextMonth", T),
70
+ linkComponent: g
70
71
  })
71
72
  }),
72
- /* @__PURE__ */ a("div", {
73
+ /* @__PURE__ */ o("div", {
73
74
  className: "calendar-roster__wrap",
74
- children: /* @__PURE__ */ o("table", {
75
+ children: /* @__PURE__ */ s("table", {
75
76
  className: "calendar-roster__table",
76
- "aria-labelledby": P,
77
- children: [/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ o("tr", { children: [/* @__PURE__ */ a("th", {
77
+ "aria-labelledby": I,
78
+ children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", {
78
79
  className: "calendar-roster__th-name",
79
80
  scope: "col",
80
- children: _
81
- }), D.map((e) => {
82
- let t = r(e, E), n = [
81
+ children: v
82
+ }), k.map((e) => {
83
+ let t = i(e, O), n = [
83
84
  "calendar-roster__th-day",
84
- s(e) && "calendar-roster__th-day--weekend",
85
+ c(e) && "calendar-roster__th-day--weekend",
85
86
  t && "calendar-roster__th-day--today"
86
- ].filter(Boolean).join(" "), i = String(e.getDate()).padStart(2, "0"), c = j.format(e), l = M.format(e);
87
- return /* @__PURE__ */ o("th", {
87
+ ].filter(Boolean).join(" "), r = String(e.getDate()).padStart(2, "0"), a = N.format(e), l = P.format(e);
88
+ return /* @__PURE__ */ s("th", {
88
89
  className: n,
89
90
  scope: "col",
90
- children: [/* @__PURE__ */ a("div", {
91
+ children: [/* @__PURE__ */ o("div", {
91
92
  className: "calendar-roster__th-day-number",
92
- children: i
93
- }), /* @__PURE__ */ a("div", {
93
+ children: r
94
+ }), /* @__PURE__ */ o("div", {
94
95
  className: "calendar-roster__th-day-sub",
95
- children: /* @__PURE__ */ a("abbr", {
96
+ children: /* @__PURE__ */ o("abbr", {
96
97
  title: l,
97
- children: c
98
+ children: a
98
99
  })
99
100
  })]
100
101
  }, e.getDate());
101
- })] }) }), /* @__PURE__ */ a("tbody", { children: d.map((t) => /* @__PURE__ */ o("tr", { children: [/* @__PURE__ */ a("th", {
102
+ })] }) }), /* @__PURE__ */ o("tbody", { children: f.map((e) => /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", {
102
103
  scope: "row",
103
104
  className: "calendar-roster__th-name-row",
104
- title: t.name,
105
- children: t.name
106
- }), D.map((n) => {
107
- let c = n.getDate(), u = t.cells[c] ?? null, d = s(n), f = r(n, E), p = u?.type === "holiday", m = u?.type === "non-working";
108
- return /* @__PURE__ */ a("td", {
105
+ title: e.name,
106
+ children: e.name
107
+ }), k.map((n) => {
108
+ let r = n.getDate(), l = e.cells[r] ?? null, d = c(n), f = i(n, O), p = l?.type === "holiday", m = l?.type === "non-working";
109
+ return /* @__PURE__ */ o("td", {
109
110
  className: [
110
111
  "calendar-roster__cell",
111
112
  d && "calendar-roster__cell--weekend",
@@ -113,31 +114,31 @@ function d({ rows: d, month: f, onMonthChange: p, hrefBuilder: m, linkComponent:
113
114
  m && "calendar-roster__cell--non-working",
114
115
  f && "calendar-roster__cell--today"
115
116
  ].filter(Boolean).join(" "),
116
- children: g ? g(c, n, u) : /* @__PURE__ */ o(i, { children: [u?.type === "schedule" && /* @__PURE__ */ a("span", {
117
+ children: _ ? _(r, n, l) : /* @__PURE__ */ s(a, { children: [l?.type === "schedule" && /* @__PURE__ */ o("span", {
117
118
  className: "calendar-roster__schedule",
118
- children: u.label
119
- }), u && u.type !== "schedule" && u.type !== "non-working" && /* @__PURE__ */ a(e, {
120
- variant: l[u.type],
121
- children: u.type === "birthday" ? `${v}${u.label}` : u.label
119
+ children: l.label
120
+ }), l && l.type !== "schedule" && l.type !== "non-working" && /* @__PURE__ */ o(t, {
121
+ variant: u[l.type],
122
+ children: l.type === "birthday" ? `${y}${l.label}` : l.label
122
123
  })] })
123
- }, c);
124
- })] }, t.id)) })]
124
+ }, r);
125
+ })] }, e.id)) })]
125
126
  })
126
127
  }),
127
- y && /* @__PURE__ */ a("div", {
128
+ b && /* @__PURE__ */ o("div", {
128
129
  className: "calendar-roster__legend",
129
130
  role: "group",
130
- "aria-label": S,
131
- children: x.map(({ type: t, label: n }) => /* @__PURE__ */ a("span", {
131
+ "aria-label": C,
132
+ children: S.map(({ type: e, label: n }) => /* @__PURE__ */ o("span", {
132
133
  className: "calendar-roster__legend-item",
133
- children: t === "non-working" ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("span", { className: "calendar-roster__legend-swatch calendar-roster__legend-swatch--non-working" }), n] }) : /* @__PURE__ */ a(e, {
134
- variant: l[t],
134
+ children: e === "non-working" ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", { className: "calendar-roster__legend-swatch calendar-roster__legend-swatch--non-working" }), n] }) : /* @__PURE__ */ o(t, {
135
+ variant: u[e],
135
136
  children: n
136
137
  })
137
- }, t))
138
+ }, e))
138
139
  })
139
140
  ]
140
141
  });
141
142
  }
142
143
  //#endregion
143
- export { d as CalendarRoster };
144
+ export { f as CalendarRoster };