@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.
- package/CHANGELOG.md +34 -0
- package/dist/_types/messages/BrandMessages.d.ts +13 -1
- package/dist/_types/messages/index.d.ts +1 -1
- package/dist/_types/molecules/AppLauncher/AppLauncher.d.ts +43 -8
- package/dist/_types/molecules/CommandPalette/CommandPalette.d.ts +43 -8
- package/dist/_types/molecules/Consent/Consent.d.ts +93 -20
- package/dist/_types/molecules/NotificationButton/NotificationButton.d.ts +17 -4
- package/dist/_types/molecules/NotificationPanel/NotificationPanel.d.ts +54 -8
- package/dist/_types/sections/FloatingDock/FloatingDock.d.ts +33 -3
- package/dist/app-launcher.js +67 -61
- package/dist/command-palette.js +38 -36
- package/dist/consent.js +75 -73
- package/dist/floating-dock.js +42 -41
- package/dist/notification-button.js +18 -17
- package/dist/notification-panel.js +81 -80
- package/package.json +1 -1
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './notification-button.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
|
10
|
-
let
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
ref:
|
|
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":
|
|
17
|
-
className: ["notification-button",
|
|
18
|
-
...
|
|
19
|
-
children: [/* @__PURE__ */
|
|
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
|
-
}),
|
|
23
|
-
count:
|
|
24
|
-
max:
|
|
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 {
|
|
33
|
+
export { s as NotificationButton };
|
|
@@ -1,139 +1,140 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import './notification-panel.css';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
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
|
|
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
|
|
19
|
+
function _() {
|
|
19
20
|
let e = document.documentElement;
|
|
20
|
-
return
|
|
21
|
+
return g(getComputedStyle(e).getPropertyValue("--notification-panel-offset").trim());
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
function v({ children: e, ...t }) {
|
|
24
|
+
return /* @__PURE__ */ m("a", {
|
|
24
25
|
...t,
|
|
25
26
|
children: e
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
-
function
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
let e =
|
|
36
|
-
return e ? e.querySelector(".notification-panel__item-action") ?? e.querySelector(
|
|
37
|
-
}, []),
|
|
38
|
-
e ||
|
|
39
|
-
},
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
trigger: /* @__PURE__ */
|
|
42
|
-
count:
|
|
43
|
-
max:
|
|
44
|
-
label:
|
|
45
|
-
countLabel:
|
|
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:
|
|
48
|
+
label: Q,
|
|
48
49
|
align: "end",
|
|
49
|
-
sideOffset:
|
|
50
|
-
open:
|
|
51
|
-
defaultOpen:
|
|
52
|
-
onOpenChange:
|
|
53
|
-
initialFocus:
|
|
54
|
-
className: ["notification-panel",
|
|
55
|
-
children: /* @__PURE__ */
|
|
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:
|
|
58
|
+
ref: H,
|
|
58
59
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ m(n, { children: /* @__PURE__ */ m(i, {
|
|
60
61
|
level: 2,
|
|
61
62
|
size: 3,
|
|
62
|
-
id:
|
|
63
|
-
children:
|
|
63
|
+
id: Z,
|
|
64
|
+
children: Q
|
|
64
65
|
}) }),
|
|
65
|
-
|
|
66
|
+
g.length === 0 ? /* @__PURE__ */ m("div", {
|
|
66
67
|
className: "notification-panel__empty",
|
|
67
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ m(a, {
|
|
68
69
|
size: "small",
|
|
69
|
-
children:
|
|
70
|
+
children: B("empty", M)
|
|
70
71
|
})
|
|
71
|
-
}) : /* @__PURE__ */
|
|
72
|
+
}) : /* @__PURE__ */ m("ul", {
|
|
72
73
|
className: "notification-panel__list",
|
|
73
|
-
"aria-labelledby":
|
|
74
|
-
children:
|
|
75
|
-
let i =
|
|
76
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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: () =>
|
|
83
|
-
children: [/* @__PURE__ */
|
|
83
|
+
onClick: () => q(e),
|
|
84
|
+
children: [/* @__PURE__ */ m("span", {
|
|
84
85
|
className: "notification-panel__indicator",
|
|
85
|
-
children: i && /* @__PURE__ */
|
|
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__ */
|
|
90
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ m(n, { children: B("unread", j) })] })
|
|
91
|
+
}), /* @__PURE__ */ h("span", {
|
|
91
92
|
className: "notification-panel__item-text",
|
|
92
93
|
children: [
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ m(s, {
|
|
94
95
|
id: a,
|
|
95
96
|
tone: i ? "default" : "muted",
|
|
96
97
|
className: "notification-panel__item-title",
|
|
97
|
-
children:
|
|
98
|
+
children: e.title
|
|
98
99
|
}),
|
|
99
|
-
|
|
100
|
+
e.body && /* @__PURE__ */ m(s, {
|
|
100
101
|
tone: "muted",
|
|
101
102
|
className: "notification-panel__item-body",
|
|
102
|
-
children:
|
|
103
|
+
children: e.body
|
|
103
104
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ m(s, {
|
|
105
106
|
tone: "muted",
|
|
106
107
|
className: "notification-panel__item-time",
|
|
107
|
-
children:
|
|
108
|
+
children: e.time
|
|
108
109
|
})
|
|
109
110
|
]
|
|
110
111
|
})]
|
|
111
112
|
})
|
|
112
|
-
},
|
|
113
|
+
}, e.id);
|
|
113
114
|
})
|
|
114
115
|
}),
|
|
115
|
-
|
|
116
|
+
w && K && /* @__PURE__ */ m("div", {
|
|
116
117
|
className: "notification-panel__mark-all",
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ m(r, {
|
|
118
119
|
variant: "outline",
|
|
119
120
|
size: "sm",
|
|
120
121
|
block: !0,
|
|
121
|
-
onClick:
|
|
122
|
-
children:
|
|
122
|
+
onClick: J,
|
|
123
|
+
children: B("markAllRead", F)
|
|
123
124
|
})
|
|
124
125
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ m("div", {
|
|
126
127
|
className: "notification-panel__footer",
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ h("div", {
|
|
128
129
|
className: "notification-panel__footer-links",
|
|
129
|
-
children: [
|
|
130
|
-
href: w,
|
|
131
|
-
className: y,
|
|
132
|
-
children: M
|
|
133
|
-
}), E({
|
|
130
|
+
children: [D({
|
|
134
131
|
href: T,
|
|
135
|
-
className:
|
|
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 {
|
|
146
|
+
export { x as NotificationPanel };
|