@studiolxd/brand 45.1.0 → 46.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,27 +1,28 @@
1
1
  'use client';
2
2
  import './notification-button.css';
3
- import { Icon as e } from "./icon.js";
4
- import { Button as t } from "./button.js";
5
- import { NumberBadge as n } from "./number-badge.js";
6
- import { forwardRef as r } from "react";
7
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Icon as t } from "./icon.js";
5
+ import { Button as n } from "./button.js";
6
+ import { NumberBadge as r } from "./number-badge.js";
7
+ import { forwardRef as i } from "react";
8
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
9
  //#region src/stories/molecules/NotificationButton/NotificationButton.tsx
9
- var o = r(function({ count: r = 0, max: o = 99, label: s = "Notificaciones", countLabel: c = (e) => `Notificaciones: ${e} sin leer`, className: l, ...u }, d) {
10
- let f = r > 0 ? c(r) : s;
11
- return /* @__PURE__ */ a(t, {
12
- ref: d,
10
+ var s = i(function({ count: i = 0, max: s = 99, label: c, countLabel: l, className: u, ...d }, f) {
11
+ let p = e("notificationButton"), m = i > 0 ? p("countLabel", l)(i) : p("label", c);
12
+ return /* @__PURE__ */ o(n, {
13
+ ref: f,
13
14
  variant: "ghost",
14
15
  iconOnly: !0,
15
16
  size: "md",
16
- "aria-label": f,
17
- className: ["notification-button", l].filter(Boolean).join(" "),
18
- ...u,
19
- children: [/* @__PURE__ */ i(e, {
17
+ "aria-label": m,
18
+ className: ["notification-button", u].filter(Boolean).join(" "),
19
+ ...d,
20
+ children: [/* @__PURE__ */ a(t, {
20
21
  name: "bell",
21
22
  size: "md"
22
- }), r > 0 && /* @__PURE__ */ i(n, {
23
- count: r,
24
- max: o,
23
+ }), i > 0 && /* @__PURE__ */ a(r, {
24
+ count: i,
25
+ max: s,
25
26
  variant: "danger",
26
27
  "aria-hidden": "true",
27
28
  className: "notification-button__badge"
@@ -29,4 +30,4 @@ var o = r(function({ count: r = 0, max: o = 99, label: s = "Notificaciones", cou
29
30
  });
30
31
  });
31
32
  //#endregion
32
- export { o as NotificationButton };
33
+ export { s as NotificationButton };
@@ -1,139 +1,140 @@
1
1
  'use client';
2
2
  import './notification-panel.css';
3
- import { Icon as e } from "./icon.js";
4
- import { VisuallyHidden as t } from "./visually-hidden.js";
5
- import { Button as n } from "./button.js";
6
- import { Heading as r } from "./heading.js";
7
- import { Paragraph as i } from "./paragraph.js";
8
- import { Popover as a } from "./popover.js";
9
- import { Text as o } from "./text.js";
10
- import { NotificationButton as s } from "./notification-button.js";
11
- import { useCallback as c, useId as l, useRef as u, useState as d } from "react";
12
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
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 { Button as r } from "./button.js";
7
+ import { Heading as i } from "./heading.js";
8
+ import { Paragraph as a } from "./paragraph.js";
9
+ import { Popover as o } from "./popover.js";
10
+ import { Text as s } from "./text.js";
11
+ import { NotificationButton as c } from "./notification-button.js";
12
+ import { useCallback as l, useId as u, useRef as d, useState as f } from "react";
13
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
13
14
  //#region src/stories/molecules/NotificationPanel/NotificationPanel.tsx
14
- function h(e) {
15
+ function g(e) {
15
16
  let t = parseFloat(e);
16
17
  return Number.isNaN(t) ? 0 : e.endsWith("rem") ? t * parseFloat(getComputedStyle(document.documentElement).fontSize) : t;
17
18
  }
18
- function g() {
19
+ function _() {
19
20
  let e = document.documentElement;
20
- return h(getComputedStyle(e).getPropertyValue("--notification-panel-offset").trim());
21
+ return g(getComputedStyle(e).getPropertyValue("--notification-panel-offset").trim());
21
22
  }
22
- function _({ children: e, ...t }) {
23
- return /* @__PURE__ */ p("a", {
23
+ function v({ children: e, ...t }) {
24
+ return /* @__PURE__ */ m("a", {
24
25
  ...t,
25
26
  children: e
26
27
  });
27
28
  }
28
- var v = "button, a[href]", y = "notification-panel__footer-link";
29
- function b({ items: h = [], count: b = 0, max: x, onRead: S, onMarkAllRead: C, allHref: w, preferencesHref: T, renderLink: E = _, label: D, countLabel: O, panelLabel: k = "Notificaciones", unreadLabel: A = "Sin leer", emptyLabel: j = "Estás al día", allLabel: M = "Ver todas las notificaciones", preferencesLabel: N = "Preferencias de notificaciones", markAllReadLabel: P = "Marcar todas como leídas", open: F, defaultOpen: I, onOpenChange: L, className: R }) {
30
- let z = l(), B = u(null), [V, H] = d([]), U = (e) => e.unread && !V.includes(e.id), W = h.some(U), G = (e) => {
31
- U(e) && (H((t) => [...t, e.id]), S(e.id));
32
- }, K = () => {
33
- H(h.map((e) => e.id)), C?.();
34
- }, q = c(() => {
35
- let e = B.current;
36
- return e ? e.querySelector(".notification-panel__item-action") ?? e.querySelector(v) : null;
37
- }, []), J = (e, t) => {
38
- e || H([]), L?.(e, t);
39
- }, Y = `${z}-title`;
40
- return /* @__PURE__ */ p(a, {
41
- trigger: /* @__PURE__ */ p(s, {
42
- count: b,
43
- max: x,
44
- label: D,
45
- countLabel: O
29
+ var y = "button, a[href]", b = "notification-panel__footer-link";
30
+ function x({ items: g = [], count: x = 0, max: S, onRead: C, onMarkAllRead: w, allHref: T, preferencesHref: E, renderLink: D = v, label: O, countLabel: k, panelLabel: A, unreadLabel: j, emptyLabel: M, allLabel: N, preferencesLabel: P, markAllReadLabel: F, open: I, defaultOpen: L, onOpenChange: R, className: z }) {
31
+ let B = e("notificationPanel"), V = u(), H = d(null), [U, W] = f([]), G = (e) => e.unread && !U.includes(e.id), K = g.some(G), q = (e) => {
32
+ G(e) && (W((t) => [...t, e.id]), C(e.id));
33
+ }, J = () => {
34
+ W(g.map((e) => e.id)), w?.();
35
+ }, Y = l(() => {
36
+ let e = H.current;
37
+ return e ? e.querySelector(".notification-panel__item-action") ?? e.querySelector(y) : null;
38
+ }, []), X = (e, t) => {
39
+ e || W([]), R?.(e, t);
40
+ }, Z = `${V}-title`, Q = B("panel", A);
41
+ return /* @__PURE__ */ m(o, {
42
+ trigger: /* @__PURE__ */ m(c, {
43
+ count: x,
44
+ max: S,
45
+ label: O,
46
+ countLabel: k
46
47
  }),
47
- label: k,
48
+ label: Q,
48
49
  align: "end",
49
- sideOffset: g,
50
- open: F,
51
- defaultOpen: I,
52
- onOpenChange: J,
53
- initialFocus: q,
54
- className: ["notification-panel", R].filter(Boolean).join(" "),
55
- children: /* @__PURE__ */ m("div", {
50
+ sideOffset: _,
51
+ open: I,
52
+ defaultOpen: L,
53
+ onOpenChange: X,
54
+ initialFocus: Y,
55
+ className: ["notification-panel", z].filter(Boolean).join(" "),
56
+ children: /* @__PURE__ */ h("div", {
56
57
  className: "notification-panel__body",
57
- ref: B,
58
+ ref: H,
58
59
  children: [
59
- /* @__PURE__ */ p(t, { children: /* @__PURE__ */ p(r, {
60
+ /* @__PURE__ */ m(n, { children: /* @__PURE__ */ m(i, {
60
61
  level: 2,
61
62
  size: 3,
62
- id: Y,
63
- children: k
63
+ id: Z,
64
+ children: Q
64
65
  }) }),
65
- h.length === 0 ? /* @__PURE__ */ p("div", {
66
+ g.length === 0 ? /* @__PURE__ */ m("div", {
66
67
  className: "notification-panel__empty",
67
- children: /* @__PURE__ */ p(i, {
68
+ children: /* @__PURE__ */ m(a, {
68
69
  size: "small",
69
- children: j
70
+ children: B("empty", M)
70
71
  })
71
- }) : /* @__PURE__ */ p("ul", {
72
+ }) : /* @__PURE__ */ m("ul", {
72
73
  className: "notification-panel__list",
73
- "aria-labelledby": Y,
74
- children: h.map((n, r) => {
75
- let i = U(n), a = `${z}-t-${r}`;
76
- return /* @__PURE__ */ p("li", {
74
+ "aria-labelledby": Z,
75
+ children: g.map((e, r) => {
76
+ let i = G(e), a = `${V}-t-${r}`;
77
+ return /* @__PURE__ */ m("li", {
77
78
  className: "notification-panel__item",
78
- children: /* @__PURE__ */ m("button", {
79
+ children: /* @__PURE__ */ h("button", {
79
80
  type: "button",
80
81
  className: "notification-panel__item-action",
81
82
  "aria-disabled": i ? void 0 : !0,
82
- onClick: () => G(n),
83
- children: [/* @__PURE__ */ p("span", {
83
+ onClick: () => q(e),
84
+ children: [/* @__PURE__ */ m("span", {
84
85
  className: "notification-panel__indicator",
85
- children: i && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(e, {
86
+ children: i && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(t, {
86
87
  name: "dot",
87
88
  size: "sm",
88
89
  className: "notification-panel__dot"
89
- }), /* @__PURE__ */ p(t, { children: A })] })
90
- }), /* @__PURE__ */ m("span", {
90
+ }), /* @__PURE__ */ m(n, { children: B("unread", j) })] })
91
+ }), /* @__PURE__ */ h("span", {
91
92
  className: "notification-panel__item-text",
92
93
  children: [
93
- /* @__PURE__ */ p(o, {
94
+ /* @__PURE__ */ m(s, {
94
95
  id: a,
95
96
  tone: i ? "default" : "muted",
96
97
  className: "notification-panel__item-title",
97
- children: n.title
98
+ children: e.title
98
99
  }),
99
- n.body && /* @__PURE__ */ p(o, {
100
+ e.body && /* @__PURE__ */ m(s, {
100
101
  tone: "muted",
101
102
  className: "notification-panel__item-body",
102
- children: n.body
103
+ children: e.body
103
104
  }),
104
- /* @__PURE__ */ p(o, {
105
+ /* @__PURE__ */ m(s, {
105
106
  tone: "muted",
106
107
  className: "notification-panel__item-time",
107
- children: n.time
108
+ children: e.time
108
109
  })
109
110
  ]
110
111
  })]
111
112
  })
112
- }, n.id);
113
+ }, e.id);
113
114
  })
114
115
  }),
115
- C && W && /* @__PURE__ */ p("div", {
116
+ w && K && /* @__PURE__ */ m("div", {
116
117
  className: "notification-panel__mark-all",
117
- children: /* @__PURE__ */ p(n, {
118
+ children: /* @__PURE__ */ m(r, {
118
119
  variant: "outline",
119
120
  size: "sm",
120
121
  block: !0,
121
- onClick: K,
122
- children: P
122
+ onClick: J,
123
+ children: B("markAllRead", F)
123
124
  })
124
125
  }),
125
- /* @__PURE__ */ p("div", {
126
+ /* @__PURE__ */ m("div", {
126
127
  className: "notification-panel__footer",
127
- children: /* @__PURE__ */ m("div", {
128
+ children: /* @__PURE__ */ h("div", {
128
129
  className: "notification-panel__footer-links",
129
- children: [E({
130
- href: w,
131
- className: y,
132
- children: M
133
- }), E({
130
+ children: [D({
134
131
  href: T,
135
- className: y,
136
- children: N
132
+ className: b,
133
+ children: B("all", N)
134
+ }), D({
135
+ href: E,
136
+ className: b,
137
+ children: B("preferences", P)
137
138
  })]
138
139
  })
139
140
  })
@@ -142,4 +143,4 @@ function b({ items: h = [], count: b = 0, max: x, onRead: S, onMarkAllRead: C, a
142
143
  });
143
144
  }
144
145
  //#endregion
145
- export { b as NotificationPanel };
146
+ export { x as NotificationPanel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiolxd/brand",
3
- "version": "45.1.0",
3
+ "version": "46.0.0",
4
4
  "description": "El sistema de diseño de Studio LXD: componentes React, tokens y documentación de la suite SLXD.",
5
5
  "repository": {
6
6
  "type": "git",