@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.
- package/CHANGELOG.md +134 -0
- package/dist/_shared/portal-container.js +9 -0
- package/dist/_types/atoms/AsyncMultiSelect/AsyncMultiSelect.d.ts +8 -7
- package/dist/_types/atoms/AsyncSelect/AsyncSelect.d.ts +8 -6
- package/dist/_types/atoms/InputPhone/InputPhone.d.ts +8 -5
- package/dist/_types/atoms/MenuButton/MenuButton.d.ts +22 -2
- package/dist/_types/atoms/MultiSelect/MultiSelect.d.ts +8 -6
- package/dist/_types/atoms/Popover/Popover.d.ts +8 -1
- package/dist/_types/atoms/Select/Select.d.ts +8 -7
- package/dist/_types/atoms/Tooltip/Tooltip.d.ts +7 -0
- package/dist/_types/constants/portal-container.d.ts +42 -0
- package/dist/_types/messages/BrandMessages.d.ts +29 -1
- package/dist/_types/messages/index.d.ts +1 -1
- package/dist/_types/molecules/Breadcrumb/Breadcrumb.d.ts +10 -2
- package/dist/_types/molecules/Menu/Menu.d.ts +8 -1
- package/dist/_types/molecules/Modal/Modal.d.ts +8 -6
- package/dist/_types/molecules/OrgSwitcher/OrgSwitcher.d.ts +15 -1
- package/dist/_types/molecules/PrevNextNav/PrevNextNav.d.ts +17 -2
- package/dist/_types/molecules/Sheet/Sheet.d.ts +8 -7
- package/dist/_types/molecules/SidebarNav/SidebarNav.d.ts +18 -3
- package/dist/_types/molecules/SiteNav/SiteNav.d.ts +9 -0
- package/dist/_types/molecules/TableOfContents/TableOfContents.d.ts +11 -2
- package/dist/_types/molecules/UserMenu/UserMenu.d.ts +16 -1
- package/dist/_types/sections/AppHeader/AppHeader.d.ts +8 -2
- package/dist/_types/sections/AppRoot/AppRoot.d.ts +12 -1
- package/dist/_types/sections/AppShell/AppShell.d.ts +14 -1
- package/dist/_types/sections/Sidebar/Sidebar.d.ts +27 -3
- package/dist/_types/sections/SiteHeader/SiteHeader.d.ts +22 -3
- package/dist/_types/sections/SiteShell/SiteShell.d.ts +11 -5
- package/dist/_types/templates/OnboardingShell/OnboardingShell.d.ts +19 -2
- package/dist/_types/templates/PublicPageShell/PublicPageShell.d.ts +42 -6
- package/dist/app-header.js +1 -1
- package/dist/app-launcher.js +62 -58
- package/dist/app-root.js +10 -8
- package/dist/app-shell.js +51 -50
- package/dist/async-multi-select.js +65 -64
- package/dist/async-select.js +49 -48
- package/dist/breadcrumb.js +24 -21
- package/dist/input-phone.js +38 -37
- package/dist/menu-button.js +16 -14
- package/dist/menu.js +44 -40
- package/dist/modal.js +32 -31
- package/dist/multi-select.js +106 -105
- package/dist/onboarding-shell.js +36 -35
- package/dist/org-switcher.js +64 -59
- package/dist/popover.js +27 -22
- package/dist/prev-next-nav.js +38 -36
- package/dist/public-page-shell.js +24 -20
- package/dist/select.js +70 -69
- package/dist/sheet.js +30 -29
- package/dist/sidebar-nav.js +91 -90
- package/dist/sidebar.js +72 -71
- package/dist/site-header.js +44 -43
- package/dist/site-nav.js +27 -25
- package/dist/site-shell.js +23 -15
- package/dist/table-of-contents.js +30 -27
- package/dist/toaster.js +57 -53
- package/dist/tooltip.js +45 -41
- package/dist/user-menu.js +58 -52
- 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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
-
function
|
|
12
|
-
let [e, t] =
|
|
13
|
-
return
|
|
14
|
-
let e = window.matchMedia(
|
|
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
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
}, [
|
|
22
|
-
|
|
23
|
-
}, [
|
|
24
|
-
|
|
25
|
-
if (
|
|
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" &&
|
|
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
|
-
}, [
|
|
35
|
-
let
|
|
36
|
-
sidebar:
|
|
37
|
-
setSidebar:
|
|
38
|
-
sidebarWidth:
|
|
39
|
-
setSidebarWidth:
|
|
40
|
-
toggleSidebar:
|
|
41
|
-
closeSidebar:
|
|
42
|
-
isDesktop:
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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:
|
|
57
|
-
}), /* @__PURE__ */
|
|
58
|
-
ref:
|
|
57
|
+
children: x("skipToContent", b)
|
|
58
|
+
}), /* @__PURE__ */ d("div", {
|
|
59
|
+
ref: F,
|
|
59
60
|
className: "app-shell",
|
|
60
|
-
"data-sidebar":
|
|
61
|
-
children: [
|
|
61
|
+
"data-sidebar": k,
|
|
62
|
+
children: [i, /* @__PURE__ */ d("div", {
|
|
62
63
|
className: "app-shell__body",
|
|
63
64
|
children: [
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
f,
|
|
66
|
+
I && /* @__PURE__ */ u("div", {
|
|
66
67
|
className: "app-shell__backdrop",
|
|
67
|
-
onClick:
|
|
68
|
+
onClick: M,
|
|
68
69
|
"aria-hidden": "true"
|
|
69
70
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ u("main", {
|
|
71
72
|
id: "main-content",
|
|
72
73
|
tabIndex: -1,
|
|
73
74
|
className: "app-shell__content",
|
|
74
|
-
inert:
|
|
75
|
-
children:
|
|
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 {
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
+
function ee(e, t) {
|
|
11
12
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
12
13
|
}
|
|
13
|
-
var
|
|
14
|
-
let
|
|
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) => `${
|
|
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
|
|
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
|
-
}, [
|
|
31
|
-
|
|
31
|
+
}, [i]);
|
|
32
|
+
o(() => () => {
|
|
32
33
|
K.current += 1, G.current && clearTimeout(G.current);
|
|
33
34
|
}, []);
|
|
34
|
-
function
|
|
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),
|
|
37
|
+
M(t), k || A(!0), G.current && clearTimeout(G.current), G.current = setTimeout(() => void Q(t), re);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
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]),
|
|
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
|
|
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
|
|
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
|
|
66
|
+
let he = [
|
|
66
67
|
"async-multi-select",
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
72
|
-
].filter(Boolean).join(" "),
|
|
73
|
-
return /* @__PURE__ */
|
|
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:
|
|
76
|
-
children: [/* @__PURE__ */
|
|
76
|
+
onOpenChange: me,
|
|
77
|
+
children: [/* @__PURE__ */ d("div", {
|
|
77
78
|
ref: J,
|
|
78
|
-
className:
|
|
79
|
+
className: he,
|
|
79
80
|
"data-popup-open": k || void 0,
|
|
80
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ d("div", {
|
|
81
82
|
className: "async-multi-select__input-area",
|
|
82
83
|
children: [
|
|
83
|
-
|
|
84
|
+
ue.map((e) => /* @__PURE__ */ d("span", {
|
|
84
85
|
className: "async-multi-select__pill",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
+
children: [/* @__PURE__ */ u("span", {
|
|
86
87
|
className: "async-multi-select__pill-label",
|
|
87
88
|
children: e.label
|
|
88
|
-
}), !
|
|
89
|
+
}), !g && !_ && /* @__PURE__ */ u("button", {
|
|
89
90
|
type: "button",
|
|
90
91
|
className: "async-multi-select__pill-remove",
|
|
91
|
-
"aria-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__ */
|
|
97
|
+
children: /* @__PURE__ */ u(t, {
|
|
97
98
|
name: "close",
|
|
98
99
|
size: "xs"
|
|
99
100
|
})
|
|
100
101
|
})]
|
|
101
102
|
}, e.value)),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ u("input", {
|
|
103
104
|
ref: (e) => {
|
|
104
|
-
q.current = e,
|
|
105
|
+
q.current = e, ee(E, e);
|
|
105
106
|
},
|
|
106
|
-
id:
|
|
107
|
+
id: ie,
|
|
107
108
|
type: "text",
|
|
108
109
|
className: "async-multi-select__input",
|
|
109
110
|
value: j,
|
|
110
|
-
onChange:
|
|
111
|
-
onPointerDown:
|
|
112
|
-
onKeyDown:
|
|
113
|
-
placeholder: X.length === 0 ?
|
|
114
|
-
disabled:
|
|
115
|
-
readOnly:
|
|
116
|
-
"aria-label":
|
|
117
|
-
"aria-describedby":
|
|
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":
|
|
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:
|
|
128
|
+
onBlur: S
|
|
128
129
|
}),
|
|
129
|
-
y && X.map((e) => /* @__PURE__ */
|
|
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__ */
|
|
136
|
+
}), N && /* @__PURE__ */ u(n, {
|
|
136
137
|
size: "sm",
|
|
137
138
|
"aria-hidden": !0
|
|
138
139
|
})]
|
|
139
|
-
}), /* @__PURE__ */
|
|
140
|
-
container:
|
|
141
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
147
|
-
className:
|
|
147
|
+
children: /* @__PURE__ */ u(f.Popup, {
|
|
148
|
+
className: ge,
|
|
148
149
|
initialFocus: !1,
|
|
149
150
|
finalFocus: !1,
|
|
150
|
-
children: /* @__PURE__ */
|
|
151
|
+
children: /* @__PURE__ */ d("div", {
|
|
151
152
|
role: "listbox",
|
|
152
153
|
"aria-multiselectable": "true",
|
|
153
|
-
"aria-label":
|
|
154
|
+
"aria-label": C ?? D("placeholder", h),
|
|
154
155
|
id: Y,
|
|
155
156
|
children: [
|
|
156
|
-
N && /* @__PURE__ */
|
|
157
|
+
N && /* @__PURE__ */ u("div", {
|
|
157
158
|
className: "async-multi-select__loading",
|
|
158
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ u(n, {
|
|
159
160
|
size: "sm",
|
|
160
|
-
label:
|
|
161
|
+
label: D("loading", w)
|
|
161
162
|
})
|
|
162
163
|
}),
|
|
163
|
-
!N && L && F.length === 0 && /* @__PURE__ */
|
|
164
|
+
!N && L && F.length === 0 && /* @__PURE__ */ u("div", {
|
|
164
165
|
className: "async-multi-select__empty",
|
|
165
|
-
children:
|
|
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__ */
|
|
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__ */
|
|
183
|
+
children: [/* @__PURE__ */ u("span", {
|
|
183
184
|
className: "async-multi-select__item-check",
|
|
184
185
|
"aria-hidden": "true",
|
|
185
|
-
children: /* @__PURE__ */
|
|
186
|
-
}), /* @__PURE__ */
|
|
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 {
|
|
198
|
+
export { p as AsyncMultiSelect };
|
package/dist/async-select.js
CHANGED
|
@@ -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 {
|
|
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
|
|
11
|
+
function f(e, t) {
|
|
11
12
|
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
12
13
|
}
|
|
13
|
-
var
|
|
14
|
-
let O = e("asyncSelect"), [k, A] = c(!1), [j, M] = c(""), [N, P] = c(!1), [F, I] = c([]), [
|
|
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
|
|
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
|
-
}, [
|
|
28
|
+
}, [i]);
|
|
28
29
|
a(() => () => {
|
|
29
30
|
G.current += 1, W.current && clearTimeout(W.current);
|
|
30
31
|
}, []);
|
|
31
|
-
function
|
|
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),
|
|
34
|
+
M(t), W.current && clearTimeout(W.current), W.current = setTimeout(() => void Z(t), b);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
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
|
-
|
|
40
|
+
p === void 0 && (V(e.value), U(e)), m?.(e.value, e), A(!1), z(-1), M("");
|
|
40
41
|
}
|
|
41
42
|
function $() {
|
|
42
|
-
|
|
43
|
+
p === void 0 && (V(null), U(null)), m?.(null, null), M(""), I([]), L(!1), K.current?.focus();
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function pe(e) {
|
|
45
46
|
e.stopPropagation(), $();
|
|
46
47
|
}
|
|
47
|
-
function
|
|
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 && !
|
|
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
|
|
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
|
|
60
|
+
let ge = k ? j : ue?.label ?? "", _e = [
|
|
60
61
|
"async-select",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
].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:
|
|
69
|
+
onOpenChange: he,
|
|
69
70
|
children: [/* @__PURE__ */ u("div", {
|
|
70
71
|
ref: q,
|
|
71
|
-
className:
|
|
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,
|
|
77
|
+
K.current = e, f(oe, e);
|
|
77
78
|
},
|
|
78
|
-
id:
|
|
79
|
+
id: x,
|
|
79
80
|
type: "text",
|
|
80
81
|
className: "async-select__input",
|
|
81
|
-
value:
|
|
82
|
-
onChange:
|
|
83
|
-
onPointerDown:
|
|
84
|
-
onKeyDown:
|
|
85
|
-
placeholder: O("placeholder",
|
|
86
|
-
disabled:
|
|
87
|
-
readOnly:
|
|
88
|
-
"aria-label":
|
|
89
|
-
"aria-describedby":
|
|
90
|
-
"aria-invalid":
|
|
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
|
-
|
|
102
|
+
S && /* @__PURE__ */ l("input", {
|
|
102
103
|
type: "hidden",
|
|
103
|
-
name:
|
|
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 && !
|
|
111
|
+
!N && Y && !_ && !v && /* @__PURE__ */ l("button", {
|
|
111
112
|
type: "button",
|
|
112
113
|
className: "async-select__clear",
|
|
113
|
-
"aria-label": O("clear",
|
|
114
|
+
"aria-label": O("clear", ie),
|
|
114
115
|
tabIndex: -1,
|
|
115
|
-
onMouseDown:
|
|
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:
|
|
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:
|
|
131
|
+
className: ve,
|
|
131
132
|
initialFocus: !1,
|
|
132
133
|
finalFocus: !1,
|
|
133
134
|
children: /* @__PURE__ */ u("div", {
|
|
134
135
|
role: "listbox",
|
|
135
|
-
"aria-label":
|
|
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",
|
|
143
|
+
label: O("loading", D)
|
|
143
144
|
})
|
|
144
145
|
}),
|
|
145
|
-
!N &&
|
|
146
|
+
!N && ce && F.length === 0 && /* @__PURE__ */ l("div", {
|
|
146
147
|
className: "async-select__empty",
|
|
147
|
-
children: O("empty",
|
|
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 {
|
|
174
|
+
export { p as AsyncSelect };
|
package/dist/breadcrumb.js
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import './breadcrumb.css';
|
|
2
|
-
import {
|
|
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
|
|
5
|
-
return /* @__PURE__ */
|
|
6
|
+
function r({ children: e, ...n }) {
|
|
7
|
+
return /* @__PURE__ */ t("a", {
|
|
6
8
|
...n,
|
|
7
|
-
children:
|
|
9
|
+
children: e
|
|
8
10
|
});
|
|
9
11
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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:
|
|
17
|
-
let s =
|
|
18
|
-
return /* @__PURE__ */
|
|
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 || !
|
|
23
|
+
children: [s || !e.href ? /* @__PURE__ */ t("span", {
|
|
21
24
|
className: s ? "breadcrumb__current" : "breadcrumb__static",
|
|
22
25
|
...s ? { "aria-current": "page" } : {},
|
|
23
|
-
children:
|
|
24
|
-
}) :
|
|
25
|
-
href:
|
|
26
|
-
children:
|
|
26
|
+
children: e.label
|
|
27
|
+
}) : a({
|
|
28
|
+
href: e.href,
|
|
29
|
+
children: e.label,
|
|
27
30
|
className: "breadcrumb__link"
|
|
28
|
-
}), !s && /* @__PURE__ */
|
|
31
|
+
}), !s && /* @__PURE__ */ t("span", {
|
|
29
32
|
className: "breadcrumb__separator",
|
|
30
33
|
"aria-hidden": "true",
|
|
31
|
-
children:
|
|
34
|
+
children: o
|
|
32
35
|
})]
|
|
33
|
-
}, `${
|
|
36
|
+
}, `${e.label}-${r}`);
|
|
34
37
|
})
|
|
35
38
|
})
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
//#endregion
|
|
39
|
-
export {
|
|
42
|
+
export { i as Breadcrumb };
|