@solibo/solibo-ui 1.0.13 → 1.0.15
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/dist/assets/index.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +0 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -0
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/menu-popover.css +1 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +1 -1
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.cjs.map +1 -1
- package/dist/components/chip/index.js +29 -21
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.cjs.map +1 -1
- package/dist/components/controls/index.js +108 -36
- package/dist/components/controls/index.js.map +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.cjs.map +1 -1
- package/dist/components/dropdown/index.js +92 -89
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +2 -2
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.cjs.map +1 -1
- package/dist/components/file/index.js +38 -34
- package/dist/components/file/index.js.map +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +12 -12
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +2 -2
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +1 -1
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +3 -3
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.cjs.map +1 -1
- package/dist/components/list/index.js +39 -36
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/menu/index.cjs +1 -1
- package/dist/components/menu/index.cjs.map +1 -1
- package/dist/components/menu/index.js +37 -87
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.cjs.map +1 -1
- package/dist/components/message/index.js +25 -25
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +21 -21
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.cjs.map +1 -1
- package/dist/components/popover/index.js +46 -50
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.cjs.map +1 -1
- package/dist/components/search/index.js +48 -50
- package/dist/components/search/index.js.map +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +3 -3
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.cjs.map +1 -1
- package/dist/components/textarea/index.js +25 -21
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +1 -1
- package/dist/icons-DaZGJzI0.cjs +2 -0
- package/dist/icons-DaZGJzI0.cjs.map +1 -0
- package/dist/{icons-Bq3diTRm.js → icons-Dj0vEOCB.js} +2 -1
- package/dist/icons-Dj0vEOCB.js.map +1 -0
- package/dist/{index-DwzLUapm.js → index-CgA0NUMD.js} +35 -33
- package/dist/index-CgA0NUMD.js.map +1 -0
- package/dist/index-DE2nzqL5.js +76 -0
- package/dist/index-DE2nzqL5.js.map +1 -0
- package/dist/index-DF8JisYI.cjs +2 -0
- package/dist/index-DF8JisYI.cjs.map +1 -0
- package/dist/index-Dn1v0qm6.cjs +2 -0
- package/dist/index-Dn1v0qm6.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +30 -9
- package/dist/index.js +2 -2
- package/dist/menu-popover-SiOOwab-.js +74 -0
- package/dist/menu-popover-SiOOwab-.js.map +1 -0
- package/dist/menu-popover-jTTxzTGZ.cjs +2 -0
- package/dist/menu-popover-jTTxzTGZ.cjs.map +1 -0
- package/dist/tokens.json +1 -1
- package/dist/use-touched-B999bBr8.js +20 -0
- package/dist/use-touched-B999bBr8.js.map +1 -0
- package/dist/use-touched-Bq5Gjbpz.cjs +2 -0
- package/dist/use-touched-Bq5Gjbpz.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/assets/index52.css +0 -1
- package/dist/icons-Bq3diTRm.js.map +0 -1
- package/dist/icons-ovA21Oao.cjs +0 -2
- package/dist/icons-ovA21Oao.cjs.map +0 -1
- package/dist/index-BcY9DZZ8.cjs +0 -2
- package/dist/index-BcY9DZZ8.cjs.map +0 -1
- package/dist/index-CjI8oRpS.cjs +0 -2
- package/dist/index-CjI8oRpS.cjs.map +0 -1
- package/dist/index-ClZkChEh.js +0 -73
- package/dist/index-ClZkChEh.js.map +0 -1
- package/dist/index-DwzLUapm.js.map +0 -1
- package/dist/use-touched-DXIJVVzz.js +0 -14
- package/dist/use-touched-DXIJVVzz.js.map +0 -1
- package/dist/use-touched-D_TJ8wDc.cjs +0 -2
- package/dist/use-touched-D_TJ8wDc.cjs.map +0 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as p, Fragment as me, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { t as v } from "../../classix-DG18itHa.js";
|
|
3
|
+
import be, { Children as he, isValidElement as x, useRef as I, useId as _e, useState as W, useEffect as Q } from "react";
|
|
4
4
|
import { Button as z } from "../button/index.js";
|
|
5
|
-
import { i as
|
|
6
|
-
import { f as
|
|
7
|
-
import { List as
|
|
8
|
-
import { S as
|
|
9
|
-
import '../../assets/
|
|
10
|
-
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(L).join(" ") :
|
|
11
|
-
}
|
|
12
|
-
function we(t) {
|
|
13
|
-
return v(t) && t.type === "option";
|
|
5
|
+
import { i as ye } from "../../icons-Dj0vEOCB.js";
|
|
6
|
+
import { f as ge, I as ve } from "../../index-DE2nzqL5.js";
|
|
7
|
+
import { List as xe } from "../list/index.js";
|
|
8
|
+
import { S as we, s as Ne, r as ee } from "../../index-CgA0NUMD.js";
|
|
9
|
+
import '../../assets/index37.css';function L(t) {
|
|
10
|
+
return typeof t == "string" || typeof t == "number" ? String(t) : Array.isArray(t) ? t.map(L).join(" ") : x(t) ? L(t.props.children) : "";
|
|
14
11
|
}
|
|
15
12
|
function Se(t) {
|
|
16
|
-
return
|
|
13
|
+
return x(t) && t.type === "option";
|
|
17
14
|
}
|
|
18
15
|
function qe(t) {
|
|
19
|
-
return
|
|
16
|
+
return x(t) && t.type === "optgroup";
|
|
17
|
+
}
|
|
18
|
+
function Ce(t) {
|
|
19
|
+
return x(t) && t.type === be.Fragment;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function Ee(t) {
|
|
22
|
+
return x(t) && t.type === we;
|
|
23
23
|
}
|
|
24
|
-
function M(t,
|
|
24
|
+
function M(t, s, r = !1) {
|
|
25
25
|
const l = [];
|
|
26
|
-
return
|
|
27
|
-
if (
|
|
28
|
-
l.push(...M(n.props.children,
|
|
29
|
-
else if (
|
|
26
|
+
return he.forEach(t, (n) => {
|
|
27
|
+
if (Ce(n))
|
|
28
|
+
l.push(...M(n.props.children, s, r));
|
|
29
|
+
else if (Se(n)) {
|
|
30
30
|
const a = L(n.props.children).trim(), f = n.props.value != null ? String(n.props.value) : a;
|
|
31
31
|
l.push({
|
|
32
32
|
disabled: r || !!n.props.disabled,
|
|
33
|
-
groupLabel:
|
|
33
|
+
groupLabel: s,
|
|
34
34
|
hidden: !!n.props.hidden,
|
|
35
35
|
isPlaceholder: !!(n.props.hidden && f === ""),
|
|
36
36
|
label: n.props.children,
|
|
@@ -38,37 +38,37 @@ function M(t, i, r = !1) {
|
|
|
38
38
|
text: a,
|
|
39
39
|
value: f
|
|
40
40
|
});
|
|
41
|
-
} else
|
|
41
|
+
} else qe(n) && l.push(...M(n.props.children, n.props.label, r || !!n.props.disabled));
|
|
42
42
|
}), l;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
const l = [.../[*?]/.test(
|
|
44
|
+
function Ve(t) {
|
|
45
|
+
const s = t.trim();
|
|
46
|
+
if (!s) return null;
|
|
47
|
+
const l = [.../[*?]/.test(s) ? s : `*${s}*`].map((n) => n === "*" ? ".*" : n === "?" ? "." : n.replace(/[|\\{}()[\]^$+.,]/g, "\\$&")).join("");
|
|
48
48
|
return new RegExp(`^${l}$`, "i");
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const r =
|
|
50
|
+
function Ie(t, s) {
|
|
51
|
+
const r = Ve(s), l = t.filter((n) => !n.hidden && !n.isPlaceholder);
|
|
52
52
|
return r ? l.filter((n) => r.test([n.groupLabel, n.text, n.value].filter(Boolean).join(" "))) : l;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return t.find((r) => r.value ===
|
|
54
|
+
function Le(t, s) {
|
|
55
|
+
return t.find((r) => r.value === s) ?? t.find((r) => r.isPlaceholder) ?? t[0];
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function $e(t, s, r) {
|
|
58
58
|
var l, n;
|
|
59
|
-
return
|
|
59
|
+
return s != null ? String(s) : r != null ? String(r) : ((l = t.find((a) => a.selected)) == null ? void 0 : l.value) ?? ((n = t[0]) == null ? void 0 : n.value) ?? "";
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
61
|
+
function Be(t) {
|
|
62
|
+
if (Ee(t)) {
|
|
63
63
|
const {
|
|
64
|
-
children:
|
|
64
|
+
children: s,
|
|
65
65
|
placeholder: r,
|
|
66
66
|
...l
|
|
67
67
|
} = t.props;
|
|
68
68
|
return {
|
|
69
|
-
children: /* @__PURE__ */ p(
|
|
70
|
-
r && /* @__PURE__ */
|
|
71
|
-
|
|
69
|
+
children: /* @__PURE__ */ p(me, { children: [
|
|
70
|
+
r && /* @__PURE__ */ i("option", { hidden: !0, value: "", children: r }),
|
|
71
|
+
s
|
|
72
72
|
] }),
|
|
73
73
|
props: l
|
|
74
74
|
};
|
|
@@ -78,34 +78,34 @@ function Le(t) {
|
|
|
78
78
|
props: t.props
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
combobox:
|
|
81
|
+
const Pe = "_combobox_1bqyf_3", ke = "_dropdown_1bqyf_27", De = "_empty_1bqyf_30", Re = "_group_1bqyf_31", je = "_placeholder_1bqyf_32", Fe = "_filter_1bqyf_40", We = "_native_1bqyf_52", Qe = "_option_1bqyf_62", ze = "_options_1bqyf_84", Me = "_panel_1bqyf_108", Ae = "_selected_1bqyf_132", Ge = "_text_1bqyf_136", Ke = "_trigger_1bqyf_144", Oe = "_minimal_1bqyf_180", Te = "_inline_1bqyf_235", He = "_label_1bqyf_267", o = {
|
|
82
|
+
combobox: Pe,
|
|
83
83
|
"combobox-input": "_combobox-input_1bqyf_12",
|
|
84
|
-
dropdown:
|
|
85
|
-
empty:
|
|
86
|
-
group:
|
|
87
|
-
placeholder:
|
|
88
|
-
filter:
|
|
89
|
-
native:
|
|
90
|
-
option:
|
|
91
|
-
options:
|
|
92
|
-
panel:
|
|
93
|
-
selected:
|
|
94
|
-
text:
|
|
95
|
-
trigger:
|
|
96
|
-
minimal:
|
|
97
|
-
inline:
|
|
98
|
-
label:
|
|
84
|
+
dropdown: ke,
|
|
85
|
+
empty: De,
|
|
86
|
+
group: Re,
|
|
87
|
+
placeholder: je,
|
|
88
|
+
filter: Fe,
|
|
89
|
+
native: We,
|
|
90
|
+
option: Qe,
|
|
91
|
+
options: ze,
|
|
92
|
+
panel: Me,
|
|
93
|
+
selected: Ae,
|
|
94
|
+
text: Ge,
|
|
95
|
+
trigger: Ke,
|
|
96
|
+
minimal: Oe,
|
|
97
|
+
inline: Te,
|
|
98
|
+
label: He,
|
|
99
99
|
"inline-field": "_inline-field_1bqyf_273"
|
|
100
100
|
};
|
|
101
|
-
function te(t,
|
|
101
|
+
function te(t, s) {
|
|
102
102
|
return {
|
|
103
|
-
"--icon-svg":
|
|
103
|
+
"--icon-svg": ye(t).replace("currentColor", s)
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
const
|
|
106
|
+
const rt = ({
|
|
107
107
|
children: t,
|
|
108
|
-
className:
|
|
108
|
+
className: s,
|
|
109
109
|
combobox: r = !1,
|
|
110
110
|
createOption: l,
|
|
111
111
|
emptyLabel: n = "No matches found",
|
|
@@ -116,24 +116,27 @@ const tt = ({
|
|
|
116
116
|
variant: _ = "default",
|
|
117
117
|
...re
|
|
118
118
|
}) => {
|
|
119
|
-
const B =
|
|
119
|
+
const B = Be(t), {
|
|
120
120
|
defaultValue: le,
|
|
121
|
-
onChange:
|
|
122
|
-
value:
|
|
121
|
+
onChange: P,
|
|
122
|
+
value: k,
|
|
123
123
|
...oe
|
|
124
|
-
} = B.props,
|
|
124
|
+
} = B.props, w = Ne(oe), {
|
|
125
|
+
className: se,
|
|
126
|
+
...ie
|
|
127
|
+
} = w, A = I(null), G = I(null), N = _e(), K = I(null), m = I(null), y = M(B.children), g = k != null, D = $e(y, k, le), [R, j] = W(() => D), [c, d] = W(!1), [S, q] = W(""), C = g ? String(k) : R, O = {
|
|
125
128
|
default: ee("--colors-semantic-content-secondary"),
|
|
126
129
|
white: ee("--color-white", "white")
|
|
127
|
-
}, T = _ === "minimal" ? O.white : O.default,
|
|
130
|
+
}, T = _ === "minimal" ? O.white : O.default, E = Le(y, C), ae = te("chevron", T), ce = te("search", T), H = Ie(y, S), b = S.trim(), V = !!(r && l && b && l.isValid(b)), ue = a && _ === "inline" ? ge(a) : a, J = (e) => e ? (f == null ? void 0 : f({
|
|
128
131
|
groupLabel: e.groupLabel,
|
|
129
|
-
isSelected: e.value ===
|
|
132
|
+
isSelected: e.value === C,
|
|
130
133
|
label: e.label,
|
|
131
134
|
text: e.text,
|
|
132
135
|
value: e.value
|
|
133
136
|
})) ?? e.label : "Select an option";
|
|
134
137
|
Q(() => {
|
|
135
|
-
!g && !y.some((e) => e.value === R) && j(
|
|
136
|
-
}, [
|
|
138
|
+
!g && !y.some((e) => e.value === R) && j(D);
|
|
139
|
+
}, [D, R, g, y]), Q(() => {
|
|
137
140
|
var e;
|
|
138
141
|
if (!c) {
|
|
139
142
|
q("");
|
|
@@ -151,8 +154,8 @@ const tt = ({
|
|
|
151
154
|
document.removeEventListener("mousedown", e);
|
|
152
155
|
};
|
|
153
156
|
}, [c]);
|
|
154
|
-
const
|
|
155
|
-
g || j(e.target.value),
|
|
157
|
+
const de = (e) => {
|
|
158
|
+
g || j(e.target.value), P == null || P(e);
|
|
156
159
|
}, F = () => {
|
|
157
160
|
var e;
|
|
158
161
|
d(!1), r || (e = A.current) == null || e.focus();
|
|
@@ -160,8 +163,8 @@ const tt = ({
|
|
|
160
163
|
var e;
|
|
161
164
|
q(""), d(!0), (e = m.current) == null || e.focus();
|
|
162
165
|
}, X = () => {
|
|
163
|
-
!l || !
|
|
164
|
-
},
|
|
166
|
+
!l || !V || (l.onCreate(b), U());
|
|
167
|
+
}, pe = (e) => {
|
|
165
168
|
var Z;
|
|
166
169
|
g || j(e);
|
|
167
170
|
const u = K.current;
|
|
@@ -173,40 +176,40 @@ const tt = ({
|
|
|
173
176
|
h == null || h.call(u, e), u.dispatchEvent(new Event("change", {
|
|
174
177
|
bubbles: !0
|
|
175
178
|
})), r ? U() : F();
|
|
176
|
-
},
|
|
177
|
-
e.key === "Escape" && F(), e.key === "Enter" && e.target === m.current &&
|
|
178
|
-
}, Y = /* @__PURE__ */ p("div", { className:
|
|
179
|
-
/* @__PURE__ */
|
|
179
|
+
}, fe = (e) => {
|
|
180
|
+
e.key === "Escape" && F(), e.key === "Enter" && e.target === m.current && V && (e.preventDefault(), X());
|
|
181
|
+
}, Y = /* @__PURE__ */ p("div", { className: v(o.dropdown, _ === "inline" && o.inline, _ === "minimal" && o.minimal, s), onKeyDown: fe, ref: G, ...re, children: [
|
|
182
|
+
/* @__PURE__ */ i("select", { ...ie, "aria-hidden": "true", className: v(o.native, se), onChange: de, ref: K, tabIndex: -1, value: C, children: B.children }),
|
|
180
183
|
r ? /* @__PURE__ */ p("div", { className: o.combobox, onClick: () => {
|
|
181
184
|
var e;
|
|
182
185
|
return (e = m.current) == null ? void 0 : e.focus();
|
|
183
186
|
}, children: [
|
|
184
187
|
ne,
|
|
185
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ i("input", { "aria-autocomplete": "list", "aria-expanded": c, "aria-label": w["aria-label"] ?? a ?? $, className: o["combobox-input"], disabled: w.disabled, onChange: (e) => {
|
|
186
189
|
q(e.target.value), d(!0);
|
|
187
190
|
}, onClick: () => d(!0), onFocus: () => d(!0), placeholder: $ || void 0, ref: m, role: "combobox", type: "text", value: S })
|
|
188
|
-
] }) : /* @__PURE__ */
|
|
191
|
+
] }) : /* @__PURE__ */ i(z, { "aria-expanded": c, "aria-haspopup": "dialog", "aria-labelledby": a ? `${N} ${N}-value` : void 0, className: v(o.trigger, (E == null ? void 0 : E.isPlaceholder) && o.placeholder), "data-open": c ? "true" : void 0, disabled: w.disabled, onClick: () => d((e) => !e), ref: A, style: ae, variant: "tertiary", children: /* @__PURE__ */ i("span", { className: o.text, id: `${N}-value`, children: J(E) }) }),
|
|
189
192
|
c && /* @__PURE__ */ p("div", { className: o.panel, children: [
|
|
190
|
-
!r && /* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */ p(
|
|
193
|
+
!r && /* @__PURE__ */ i(ve, { "aria-label": "Filter", className: o.filter, icon: "search", onChange: (e) => q(e.target.value), placeholder: $, ref: m, style: ce, type: "search", value: S }),
|
|
194
|
+
/* @__PURE__ */ p(xe, { "aria-label": "Dropdown", className: o.options, children: [
|
|
192
195
|
H.map((e) => {
|
|
193
|
-
const u = e.value ===
|
|
194
|
-
return /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
e.groupLabel && /* @__PURE__ */
|
|
196
|
+
const u = e.value === C;
|
|
197
|
+
return /* @__PURE__ */ i("li", { "data-component": "dropdown", children: /* @__PURE__ */ p(z, { "aria-label": u ? `${e.text}, selected` : e.text, className: v(o.option, u && o.selected), disabled: e.disabled, onClick: () => pe(e.value), variant: "tertiary", children: [
|
|
198
|
+
/* @__PURE__ */ i("span", { className: o.text, children: J(e) }),
|
|
199
|
+
e.groupLabel && /* @__PURE__ */ i("small", { className: o.group, children: e.groupLabel })
|
|
197
200
|
] }) }, `${e.groupLabel ?? "root"}-${e.value}`);
|
|
198
201
|
}),
|
|
199
|
-
|
|
200
|
-
H.length === 0 && !
|
|
202
|
+
V && l && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(z, { "aria-label": L(l.render(b)) || b, className: o.option, onClick: X, variant: "tertiary", children: /* @__PURE__ */ i("span", { className: o.text, children: l.render(b) }) }) }),
|
|
203
|
+
H.length === 0 && !V && /* @__PURE__ */ i("li", { className: o.empty, children: n })
|
|
201
204
|
] })
|
|
202
205
|
] })
|
|
203
206
|
] });
|
|
204
|
-
return a ? /* @__PURE__ */ p("div", { className:
|
|
205
|
-
/* @__PURE__ */
|
|
207
|
+
return a ? /* @__PURE__ */ p("div", { className: v(o.label, _ === "inline" && o["inline-field"]), "data-component": "dropdown", children: [
|
|
208
|
+
/* @__PURE__ */ i("span", { id: N, children: ue }),
|
|
206
209
|
Y
|
|
207
210
|
] }) : Y;
|
|
208
211
|
};
|
|
209
212
|
export {
|
|
210
|
-
|
|
213
|
+
rt as Dropdown
|
|
211
214
|
};
|
|
212
215
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/dropdown/options.tsx","../../../src/components/dropdown/index.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\n\nimport { Select, type SelectProps } from '@/components/select';\n\ntype NativeSelectProps = Omit<React.ComponentPropsWithoutRef<'select'>, 'children' | 'multiple'> & {\n children: React.ReactNode;\n multiple?: false;\n};\n\ntype NativeSelectElement = React.ReactElement<NativeSelectProps, 'select'>;\ntype WrappedSelectElement = React.ReactElement<SelectProps, typeof Select>;\n\nexport type DropdownSelectElement = NativeSelectElement | WrappedSelectElement;\n\nexport type DropdownOption = {\n disabled: boolean;\n groupLabel?: string;\n hidden: boolean;\n isPlaceholder: boolean;\n label: React.ReactNode;\n selected: boolean;\n text: string;\n value: string;\n};\n\nexport type DropdownRenderOption = Pick<\n DropdownOption,\n 'groupLabel' | 'label' | 'text' | 'value'\n> & {\n isSelected: boolean;\n};\n\nexport function getNodeText(node: React.ReactNode): string {\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getNodeText).join(' ');\n if (isValidElement<{ children?: React.ReactNode }>(node)) return getNodeText(node.props.children);\n return '';\n}\n\nfunction isOptionElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'option'>, 'option'> {\n return isValidElement(node) && node.type === 'option';\n}\n\nfunction isOptGroupElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'optgroup'>, 'optgroup'> {\n return isValidElement(node) && node.type === 'optgroup';\n}\n\nfunction isFragmentElement(\n node: React.ReactNode\n): node is React.ReactElement<{ children?: React.ReactNode }, typeof React.Fragment> {\n return isValidElement(node) && node.type === React.Fragment;\n}\n\nfunction isWrappedSelectElement(node: React.ReactNode): node is WrappedSelectElement {\n return isValidElement(node) && node.type === Select;\n}\n\nexport function extractOptions(\n children: React.ReactNode,\n groupLabel?: string,\n groupDisabled = false\n): DropdownOption[] {\n const options: DropdownOption[] = [];\n\n Children.forEach(children, (child) => {\n if (isFragmentElement(child)) {\n options.push(...extractOptions(child.props.children, groupLabel, groupDisabled));\n } else if (isOptionElement(child)) {\n const text = getNodeText(child.props.children).trim();\n const value = child.props.value != null ? String(child.props.value) : text;\n options.push({\n disabled: groupDisabled || Boolean(child.props.disabled),\n groupLabel,\n hidden: Boolean(child.props.hidden),\n isPlaceholder: Boolean(child.props.hidden && value === ''),\n label: child.props.children,\n selected: Boolean(child.props.selected),\n text,\n value,\n });\n } else if (isOptGroupElement(child)) {\n options.push(\n ...extractOptions(\n child.props.children,\n child.props.label,\n groupDisabled || Boolean(child.props.disabled)\n )\n );\n }\n });\n\n return options;\n}\n\nfunction buildWildcardMatcher(query: string) {\n const trimmedQuery = query.trim();\n if (!trimmedQuery) return null;\n\n const wildcardQuery = /[*?]/.test(trimmedQuery) ? trimmedQuery : `*${trimmedQuery}*`;\n const expression = [...wildcardQuery]\n .map((character) => {\n if (character === '*') return '.*';\n if (character === '?') return '.';\n return character.replace(/[|\\\\{}()[\\]^$+.,]/g, '\\\\$&');\n })\n .join('');\n\n return new RegExp(`^${expression}$`, 'i');\n}\n\nexport function filterOptions(options: DropdownOption[], query: string) {\n const matcher = buildWildcardMatcher(query);\n const selectableOptions = options.filter((option) => !option.hidden && !option.isPlaceholder);\n return matcher\n ? selectableOptions.filter((option) =>\n matcher.test([option.groupLabel, option.text, option.value].filter(Boolean).join(' '))\n )\n : selectableOptions;\n}\n\nexport function getDisplayOption(options: DropdownOption[], selectedValue: string) {\n return (\n options.find((option) => option.value === selectedValue) ??\n options.find((option) => option.isPlaceholder) ??\n options[0]\n );\n}\n\nexport function getInitialValue(\n options: DropdownOption[],\n value?: NativeSelectProps['value'],\n defaultValue?: NativeSelectProps['defaultValue']\n) {\n if (value != null) return String(value);\n if (defaultValue != null) return String(defaultValue);\n return options.find((option) => option.selected)?.value ?? options[0]?.value ?? '';\n}\n\nexport function normalizeSelectElement(selectElement: DropdownSelectElement) {\n if (isWrappedSelectElement(selectElement)) {\n const { children, placeholder, ...props } = selectElement.props;\n return {\n children: (\n <>\n {placeholder && (\n <option\n hidden\n value=''\n >\n {placeholder}\n </option>\n )}\n {children}\n </>\n ),\n props,\n };\n }\n\n return { children: selectElement.props.children, props: selectElement.props };\n}\n","import cx from 'classix';\nimport React, { useEffect, useId, useRef, useState } from 'react';\n\nimport { Button } from '@/components/button';\nimport { type IconName, iconSVG } from '@/components/icon/icons';\nimport { Input } from '@/components/input';\nimport { List } from '@/components/list';\nimport { sanitizeSelectProps } from '@/components/select/sanitize-select-props';\nimport { resolveColor } from '@/lib/color';\nimport { formatInlineLabel } from '@/lib/text';\n\nimport {\n type DropdownOption,\n type DropdownRenderOption,\n type DropdownSelectElement,\n extractOptions,\n filterOptions,\n getDisplayOption,\n getInitialValue,\n getNodeText,\n normalizeSelectElement,\n} from './options';\nimport styles from './styles.module.css';\n\nexport type { DropdownRenderOption } from './options';\n\nexport type DropdownCreateOption = {\n isValid: (value: string) => boolean;\n onCreate: (value: string) => void;\n render: (value: string) => React.ReactNode;\n};\n\nexport type DropdownProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {\n children: DropdownSelectElement;\n combobox?: boolean;\n createOption?: DropdownCreateOption;\n emptyLabel?: string;\n label?: string;\n renderOption?: (option: DropdownRenderOption) => React.ReactNode;\n searchPlaceholder?: string;\n selectedItems?: React.ReactNode;\n variant?: 'default' | 'inline' | 'minimal';\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nfunction getIconWithVars(icon: IconName, color: string): withVars {\n return {\n '--icon-svg': iconSVG(icon).replace('currentColor', color),\n };\n}\n\nexport const Dropdown = ({\n children: selectElement,\n className,\n combobox = false,\n createOption,\n emptyLabel = 'No matches found',\n label,\n renderOption,\n searchPlaceholder = 'Filter',\n selectedItems,\n variant = 'default',\n ...props\n}: DropdownProps) => {\n const normalizedSelect = normalizeSelectElement(selectElement);\n const { defaultValue, onChange, value, ...restSelectProps } = normalizedSelect.props;\n const selectProps = sanitizeSelectProps(restSelectProps);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const labelId = useId();\n const nativeSelectRef = useRef<HTMLSelectElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const options = extractOptions(normalizedSelect.children);\n const isControlled = value != null;\n const initialValue = getInitialValue(options, value, defaultValue);\n const [internalValue, setInternalValue] = useState(() => initialValue);\n const [isOpen, setIsOpen] = useState(false);\n const [query, setQuery] = useState('');\n const selectedValue = isControlled ? String(value) : internalValue;\n const iconColors = {\n default: resolveColor('--colors-semantic-content-secondary'),\n white: resolveColor('--color-white', 'white'),\n };\n const dropdownIconColor = variant === 'minimal' ? iconColors.white : iconColors.default;\n const displayOption = getDisplayOption(options, selectedValue);\n const triggerWithVars = getIconWithVars('chevron', dropdownIconColor);\n const filterWithVars = getIconWithVars('search', dropdownIconColor);\n const filteredOptions = filterOptions(options, query);\n const customValue = query.trim();\n const canCreateOption = Boolean(\n combobox && createOption && customValue && createOption.isValid(customValue)\n );\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n const renderDropdownOption = (option: DropdownOption | undefined) => {\n if (!option) return 'Select an option';\n\n return (\n renderOption?.({\n groupLabel: option.groupLabel,\n isSelected: option.value === selectedValue,\n label: option.label,\n text: option.text,\n value: option.value,\n }) ?? option.label\n );\n };\n\n useEffect(() => {\n if (!isControlled && !options.some((option) => option.value === internalValue)) {\n setInternalValue(initialValue);\n }\n }, [initialValue, internalValue, isControlled, options]);\n\n useEffect(() => {\n if (!isOpen) {\n setQuery('');\n return;\n }\n\n searchRef.current?.focus();\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const handlePointerDown = (event: MouseEvent) => {\n if (!containerRef.current?.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handlePointerDown);\n\n return () => {\n document.removeEventListener('mousedown', handlePointerDown);\n };\n }, [isOpen]);\n\n const handleNativeChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (!isControlled) {\n setInternalValue(event.target.value);\n }\n\n onChange?.(event);\n };\n\n const closeMenu = () => {\n setIsOpen(false);\n if (!combobox) {\n buttonRef.current?.focus();\n }\n };\n\n const continueComboboxSelection = () => {\n setQuery('');\n setIsOpen(true);\n searchRef.current?.focus();\n };\n\n const commitCustomValue = () => {\n if (!createOption || !canCreateOption) return;\n\n createOption.onCreate(customValue);\n continueComboboxSelection();\n };\n\n const commitValue = (nextValue: string) => {\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n\n const nativeSelect = nativeSelectRef.current;\n\n if (!nativeSelect) {\n closeMenu();\n return;\n }\n\n const valueSetter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value')?.set;\n\n valueSetter?.call(nativeSelect, nextValue);\n nativeSelect.dispatchEvent(new Event('change', { bubbles: true }));\n if (combobox) {\n continueComboboxSelection();\n } else {\n closeMenu();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n closeMenu();\n }\n\n if (event.key === 'Enter' && event.target === searchRef.current && canCreateOption) {\n event.preventDefault();\n commitCustomValue();\n }\n };\n\n const dropdown = (\n <div\n className={cx(\n styles.dropdown,\n variant === 'inline' && styles.inline,\n variant === 'minimal' && styles.minimal,\n className\n )}\n onKeyDown={handleKeyDown}\n ref={containerRef}\n {...props}\n >\n <select\n {...selectProps}\n aria-hidden='true'\n className={styles.native}\n onChange={handleNativeChange}\n ref={nativeSelectRef}\n tabIndex={-1}\n value={selectedValue}\n >\n {normalizedSelect.children}\n </select>\n {combobox ? (\n <div\n className={styles.combobox}\n onClick={() => searchRef.current?.focus()}\n >\n {selectedItems}\n <input\n aria-autocomplete='list'\n aria-expanded={isOpen}\n aria-label={selectProps['aria-label'] ?? label ?? searchPlaceholder}\n className={styles['combobox-input']}\n disabled={selectProps.disabled}\n onChange={(event) => {\n setQuery(event.target.value);\n setIsOpen(true);\n }}\n onClick={() => setIsOpen(true)}\n onFocus={() => setIsOpen(true)}\n placeholder={searchPlaceholder || undefined}\n ref={searchRef}\n role='combobox'\n type='text'\n value={query}\n />\n </div>\n ) : (\n <Button\n aria-expanded={isOpen}\n aria-haspopup='dialog'\n aria-labelledby={label ? `${labelId} ${labelId}-value` : undefined}\n className={cx(styles.trigger, displayOption?.isPlaceholder && styles.placeholder)}\n data-open={isOpen ? 'true' : undefined}\n disabled={selectProps.disabled}\n onClick={() => setIsOpen((currentValue) => !currentValue)}\n ref={buttonRef}\n style={triggerWithVars}\n variant='tertiary'\n >\n <span\n className={styles.text}\n id={`${labelId}-value`}\n >\n {renderDropdownOption(displayOption)}\n </span>\n </Button>\n )}\n {isOpen && (\n <div className={styles.panel}>\n {!combobox && (\n <Input\n aria-label='Filter'\n className={styles.filter}\n icon='search'\n onChange={(event) => setQuery(event.target.value)}\n placeholder={searchPlaceholder}\n ref={searchRef}\n style={filterWithVars}\n type='search'\n value={query}\n />\n )}\n <List\n aria-label='Dropdown'\n className={styles.options}\n >\n {filteredOptions.map((option) => {\n const isSelected = option.value === selectedValue;\n\n return (\n <li key={`${option.groupLabel ?? 'root'}-${option.value}`}>\n <Button\n aria-label={isSelected ? `${option.text}, selected` : option.text}\n className={cx(styles.option, isSelected && styles.selected)}\n disabled={option.disabled}\n onClick={() => commitValue(option.value)}\n variant='tertiary'\n >\n <span className={styles.text}>{renderDropdownOption(option)}</span>\n {option.groupLabel && (\n <small className={styles.group}>{option.groupLabel}</small>\n )}\n </Button>\n </li>\n );\n })}\n {canCreateOption && createOption && (\n <li>\n <Button\n aria-label={getNodeText(createOption.render(customValue)) || customValue}\n className={styles.option}\n onClick={commitCustomValue}\n variant='tertiary'\n >\n <span className={styles.text}>{createOption.render(customValue)}</span>\n </Button>\n </li>\n )}\n {filteredOptions.length === 0 && !canCreateOption && (\n <li className={styles.empty}>{emptyLabel}</li>\n )}\n </List>\n </div>\n )}\n </div>\n );\n\n return label ? (\n <div className={cx(styles.label, variant === 'inline' && styles['inline-field'])}>\n <span id={labelId}>{displayLabel}</span>\n {dropdown}\n </div>\n ) : (\n dropdown\n );\n};\n"],"names":["getNodeText","node","String","Array","isArray","map","join","isValidElement","props","children","isOptionElement","type","isOptGroupElement","isFragmentElement","React","Fragment","isWrappedSelectElement","Select","extractOptions","groupLabel","groupDisabled","options","Children","forEach","child","push","text","trim","value","disabled","Boolean","hidden","isPlaceholder","label","selected","buildWildcardMatcher","query","trimmedQuery","expression","test","character","replace","RegExp","filterOptions","matcher","selectableOptions","filter","option","getDisplayOption","selectedValue","find","getInitialValue","defaultValue","normalizeSelectElement","selectElement","placeholder","jsxs","getIconWithVars","icon","color","iconSVG","Dropdown","className","combobox","createOption","emptyLabel","renderOption","searchPlaceholder","selectedItems","variant","normalizedSelect","onChange","restSelectProps","selectProps","sanitizeSelectProps","buttonRef","useRef","containerRef","labelId","useId","nativeSelectRef","searchRef","isControlled","initialValue","internalValue","setInternalValue","useState","isOpen","setIsOpen","setQuery","iconColors","default","resolveColor","white","dropdownIconColor","displayOption","triggerWithVars","filterWithVars","filteredOptions","customValue","canCreateOption","isValid","displayLabel","formatInlineLabel","renderDropdownOption","isSelected","useEffect","some","current","focus","handlePointerDown","event","contains","target","document","addEventListener","removeEventListener","handleNativeChange","closeMenu","continueComboboxSelection","commitCustomValue","onCreate","commitValue","nextValue","nativeSelect","valueSetter","Object","getOwnPropertyDescriptor","HTMLSelectElement","prototype","set","call","dispatchEvent","Event","bubbles","handleKeyDown","key","preventDefault","dropdown","cx","styles","inline","minimal","jsx","native","undefined","Button","trigger","currentValue","panel","Input","List","group","render","length","empty"],"mappings":";;;;;;;;AAgCO,SAASA,EAAYC,GAA+B;AACzD,SAAI,OAAOA,KAAS,YAAY,OAAOA,KAAS,WAAiBC,OAAOD,CAAI,IACxEE,MAAMC,QAAQH,CAAI,IAAUA,EAAKI,IAAIL,CAAW,EAAEM,KAAK,GAAG,IAC1DC,EAA+CN,CAAI,IAAUD,EAAYC,EAAKO,MAAMC,QAAQ,IACzF;AACT;AAEA,SAASC,GACPT,GACgF;AAChF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAAS;AAC/C;AAEA,SAASC,GACPX,GACoF;AACpF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAAS;AAC/C;AAEA,SAASE,GACPZ,GACmF;AACnF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAASG,GAAMC;AACrD;AAEA,SAASC,GAAuBf,GAAqD;AACnF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAASM;AAC/C;AAEO,SAASC,EACdT,GACAU,GACAC,IAAgB,IACE;AAClB,QAAMC,IAA4B,CAAA;AAElCC,SAAAA,GAASC,QAAQd,GAAWe,CAAAA,MAAU;AACpC,QAAIX,GAAkBW,CAAK;AACzBH,MAAAA,EAAQI,KAAK,GAAGP,EAAeM,EAAMhB,MAAMC,UAAUU,GAAYC,CAAa,CAAC;AAAA,aACtEV,GAAgBc,CAAK,GAAG;AACjC,YAAME,IAAO1B,EAAYwB,EAAMhB,MAAMC,QAAQ,EAAEkB,KAAAA,GACzCC,IAAQJ,EAAMhB,MAAMoB,SAAS,OAAO1B,OAAOsB,EAAMhB,MAAMoB,KAAK,IAAIF;AACtEL,MAAAA,EAAQI,KAAK;AAAA,QACXI,UAAUT,KAAiBU,EAAQN,EAAMhB,MAAMqB;AAAAA,QA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AAA,GAEJ;AAGF,SAAOhC,IACL,gBAAAuB,EAAC,OAAA,EAAI,WAAWmF,EAAGC,EAAO3G,OAAOoC,MAAY,YAAYuE,EAAO,cAAc,CAAC,GAAE,kBAAA,YAC/E,UAAA;AAAA,IAAA,gBAAAG,EAAC,QAAA,EAAK,IAAIjE,GAAUwB,UAAAA,IAAa;AAAA,IAChCoC;AAAAA,EAAAA,EAAAA,CACH,IAEAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/dropdown/options.tsx","../../../src/components/dropdown/index.tsx"],"sourcesContent":["import React, { Children, isValidElement } from 'react';\n\nimport { Select, type SelectProps } from '@/components/select';\n\ntype NativeSelectProps = Omit<React.ComponentPropsWithoutRef<'select'>, 'children' | 'multiple'> & {\n children: React.ReactNode;\n multiple?: false;\n};\n\ntype NativeSelectElement = React.ReactElement<NativeSelectProps, 'select'>;\ntype WrappedSelectElement = React.ReactElement<SelectProps, typeof Select>;\n\nexport type DropdownSelectElement = NativeSelectElement | WrappedSelectElement;\n\nexport type DropdownOption = {\n disabled: boolean;\n groupLabel?: string;\n hidden: boolean;\n isPlaceholder: boolean;\n label: React.ReactNode;\n selected: boolean;\n text: string;\n value: string;\n};\n\nexport type DropdownRenderOption = Pick<\n DropdownOption,\n 'groupLabel' | 'label' | 'text' | 'value'\n> & {\n isSelected: boolean;\n};\n\nexport function getNodeText(node: React.ReactNode): string {\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getNodeText).join(' ');\n if (isValidElement<{ children?: React.ReactNode }>(node)) return getNodeText(node.props.children);\n return '';\n}\n\nfunction isOptionElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'option'>, 'option'> {\n return isValidElement(node) && node.type === 'option';\n}\n\nfunction isOptGroupElement(\n node: React.ReactNode\n): node is React.ReactElement<React.ComponentPropsWithoutRef<'optgroup'>, 'optgroup'> {\n return isValidElement(node) && node.type === 'optgroup';\n}\n\nfunction isFragmentElement(\n node: React.ReactNode\n): node is React.ReactElement<{ children?: React.ReactNode }, typeof React.Fragment> {\n return isValidElement(node) && node.type === React.Fragment;\n}\n\nfunction isWrappedSelectElement(node: React.ReactNode): node is WrappedSelectElement {\n return isValidElement(node) && node.type === Select;\n}\n\nexport function extractOptions(\n children: React.ReactNode,\n groupLabel?: string,\n groupDisabled = false\n): DropdownOption[] {\n const options: DropdownOption[] = [];\n\n Children.forEach(children, (child) => {\n if (isFragmentElement(child)) {\n options.push(...extractOptions(child.props.children, groupLabel, groupDisabled));\n } else if (isOptionElement(child)) {\n const text = getNodeText(child.props.children).trim();\n const value = child.props.value != null ? String(child.props.value) : text;\n options.push({\n disabled: groupDisabled || Boolean(child.props.disabled),\n groupLabel,\n hidden: Boolean(child.props.hidden),\n isPlaceholder: Boolean(child.props.hidden && value === ''),\n label: child.props.children,\n selected: Boolean(child.props.selected),\n text,\n value,\n });\n } else if (isOptGroupElement(child)) {\n options.push(\n ...extractOptions(\n child.props.children,\n child.props.label,\n groupDisabled || Boolean(child.props.disabled)\n )\n );\n }\n });\n\n return options;\n}\n\nfunction buildWildcardMatcher(query: string) {\n const trimmedQuery = query.trim();\n if (!trimmedQuery) return null;\n\n const wildcardQuery = /[*?]/.test(trimmedQuery) ? trimmedQuery : `*${trimmedQuery}*`;\n const expression = [...wildcardQuery]\n .map((character) => {\n if (character === '*') return '.*';\n if (character === '?') return '.';\n return character.replace(/[|\\\\{}()[\\]^$+.,]/g, '\\\\$&');\n })\n .join('');\n\n return new RegExp(`^${expression}$`, 'i');\n}\n\nexport function filterOptions(options: DropdownOption[], query: string) {\n const matcher = buildWildcardMatcher(query);\n const selectableOptions = options.filter((option) => !option.hidden && !option.isPlaceholder);\n return matcher\n ? selectableOptions.filter((option) =>\n matcher.test([option.groupLabel, option.text, option.value].filter(Boolean).join(' '))\n )\n : selectableOptions;\n}\n\nexport function getDisplayOption(options: DropdownOption[], selectedValue: string) {\n return (\n options.find((option) => option.value === selectedValue) ??\n options.find((option) => option.isPlaceholder) ??\n options[0]\n );\n}\n\nexport function getInitialValue(\n options: DropdownOption[],\n value?: NativeSelectProps['value'],\n defaultValue?: NativeSelectProps['defaultValue']\n) {\n if (value != null) return String(value);\n if (defaultValue != null) return String(defaultValue);\n return options.find((option) => option.selected)?.value ?? options[0]?.value ?? '';\n}\n\nexport function normalizeSelectElement(selectElement: DropdownSelectElement) {\n if (isWrappedSelectElement(selectElement)) {\n const { children, placeholder, ...props } = selectElement.props;\n return {\n children: (\n <>\n {placeholder && (\n <option\n hidden\n value=''\n >\n {placeholder}\n </option>\n )}\n {children}\n </>\n ),\n props,\n };\n }\n\n return { children: selectElement.props.children, props: selectElement.props };\n}\n","import cx from 'classix';\nimport React, { useEffect, useId, useRef, useState } from 'react';\n\nimport { Button } from '@/components/button';\nimport { type IconName, iconSVG } from '@/components/icon/icons';\nimport { Input } from '@/components/input';\nimport { List } from '@/components/list';\nimport { sanitizeSelectProps } from '@/components/select/sanitize-select-props';\nimport { resolveColor } from '@/lib/color';\nimport { formatInlineLabel } from '@/lib/text';\n\nimport {\n type DropdownOption,\n type DropdownRenderOption,\n type DropdownSelectElement,\n extractOptions,\n filterOptions,\n getDisplayOption,\n getInitialValue,\n getNodeText,\n normalizeSelectElement,\n} from './options';\nimport styles from './styles.module.css';\n\nexport type { DropdownRenderOption } from './options';\n\nexport type DropdownCreateOption = {\n isValid: (value: string) => boolean;\n onCreate: (value: string) => void;\n render: (value: string) => React.ReactNode;\n};\n\nexport type DropdownProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {\n children: DropdownSelectElement;\n combobox?: boolean;\n createOption?: DropdownCreateOption;\n emptyLabel?: string;\n label?: string;\n renderOption?: (option: DropdownRenderOption) => React.ReactNode;\n searchPlaceholder?: string;\n selectedItems?: React.ReactNode;\n variant?: 'default' | 'inline' | 'minimal';\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nfunction getIconWithVars(icon: IconName, color: string): withVars {\n return {\n '--icon-svg': iconSVG(icon).replace('currentColor', color),\n };\n}\n\nexport const Dropdown = ({\n children: selectElement,\n className,\n combobox = false,\n createOption,\n emptyLabel = 'No matches found',\n label,\n renderOption,\n searchPlaceholder = 'Filter',\n selectedItems,\n variant = 'default',\n ...props\n}: DropdownProps) => {\n const normalizedSelect = normalizeSelectElement(selectElement);\n const { defaultValue, onChange, value, ...restSelectProps } = normalizedSelect.props;\n const selectProps = sanitizeSelectProps(restSelectProps);\n const { className: selectClassName, ...nativeSelectProps } = selectProps;\n const buttonRef = useRef<HTMLButtonElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const labelId = useId();\n const nativeSelectRef = useRef<HTMLSelectElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const options = extractOptions(normalizedSelect.children);\n const isControlled = value != null;\n const initialValue = getInitialValue(options, value, defaultValue);\n const [internalValue, setInternalValue] = useState(() => initialValue);\n const [isOpen, setIsOpen] = useState(false);\n const [query, setQuery] = useState('');\n const selectedValue = isControlled ? String(value) : internalValue;\n const iconColors = {\n default: resolveColor('--colors-semantic-content-secondary'),\n white: resolveColor('--color-white', 'white'),\n };\n const dropdownIconColor = variant === 'minimal' ? iconColors.white : iconColors.default;\n const displayOption = getDisplayOption(options, selectedValue);\n const triggerWithVars = getIconWithVars('chevron', dropdownIconColor);\n const filterWithVars = getIconWithVars('search', dropdownIconColor);\n const filteredOptions = filterOptions(options, query);\n const customValue = query.trim();\n const canCreateOption = Boolean(\n combobox && createOption && customValue && createOption.isValid(customValue)\n );\n const displayLabel = label && variant === 'inline' ? formatInlineLabel(label) : label;\n const renderDropdownOption = (option: DropdownOption | undefined) => {\n if (!option) return 'Select an option';\n\n return (\n renderOption?.({\n groupLabel: option.groupLabel,\n isSelected: option.value === selectedValue,\n label: option.label,\n text: option.text,\n value: option.value,\n }) ?? option.label\n );\n };\n\n useEffect(() => {\n if (!isControlled && !options.some((option) => option.value === internalValue)) {\n setInternalValue(initialValue);\n }\n }, [initialValue, internalValue, isControlled, options]);\n\n useEffect(() => {\n if (!isOpen) {\n setQuery('');\n return;\n }\n\n searchRef.current?.focus();\n }, [isOpen]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const handlePointerDown = (event: MouseEvent) => {\n if (!containerRef.current?.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handlePointerDown);\n\n return () => {\n document.removeEventListener('mousedown', handlePointerDown);\n };\n }, [isOpen]);\n\n const handleNativeChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (!isControlled) {\n setInternalValue(event.target.value);\n }\n\n onChange?.(event);\n };\n\n const closeMenu = () => {\n setIsOpen(false);\n if (!combobox) {\n buttonRef.current?.focus();\n }\n };\n\n const continueComboboxSelection = () => {\n setQuery('');\n setIsOpen(true);\n searchRef.current?.focus();\n };\n\n const commitCustomValue = () => {\n if (!createOption || !canCreateOption) return;\n\n createOption.onCreate(customValue);\n continueComboboxSelection();\n };\n\n const commitValue = (nextValue: string) => {\n if (!isControlled) {\n setInternalValue(nextValue);\n }\n\n const nativeSelect = nativeSelectRef.current;\n\n if (!nativeSelect) {\n closeMenu();\n return;\n }\n\n const valueSetter = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value')?.set;\n\n valueSetter?.call(nativeSelect, nextValue);\n nativeSelect.dispatchEvent(new Event('change', { bubbles: true }));\n if (combobox) {\n continueComboboxSelection();\n } else {\n closeMenu();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n closeMenu();\n }\n\n if (event.key === 'Enter' && event.target === searchRef.current && canCreateOption) {\n event.preventDefault();\n commitCustomValue();\n }\n };\n\n const dropdown = (\n <div\n className={cx(\n styles.dropdown,\n variant === 'inline' && styles.inline,\n variant === 'minimal' && styles.minimal,\n className\n )}\n onKeyDown={handleKeyDown}\n ref={containerRef}\n {...props}\n >\n <select\n {...nativeSelectProps}\n aria-hidden='true'\n className={cx(styles.native, selectClassName)}\n onChange={handleNativeChange}\n ref={nativeSelectRef}\n tabIndex={-1}\n value={selectedValue}\n >\n {normalizedSelect.children}\n </select>\n {combobox ? (\n <div\n className={styles.combobox}\n onClick={() => searchRef.current?.focus()}\n >\n {selectedItems}\n <input\n aria-autocomplete='list'\n aria-expanded={isOpen}\n aria-label={selectProps['aria-label'] ?? label ?? searchPlaceholder}\n className={styles['combobox-input']}\n disabled={selectProps.disabled}\n onChange={(event) => {\n setQuery(event.target.value);\n setIsOpen(true);\n }}\n onClick={() => setIsOpen(true)}\n onFocus={() => setIsOpen(true)}\n placeholder={searchPlaceholder || undefined}\n ref={searchRef}\n role='combobox'\n type='text'\n value={query}\n />\n </div>\n ) : (\n <Button\n aria-expanded={isOpen}\n aria-haspopup='dialog'\n aria-labelledby={label ? `${labelId} ${labelId}-value` : undefined}\n className={cx(styles.trigger, displayOption?.isPlaceholder && styles.placeholder)}\n data-open={isOpen ? 'true' : undefined}\n disabled={selectProps.disabled}\n onClick={() => setIsOpen((currentValue) => !currentValue)}\n ref={buttonRef}\n style={triggerWithVars}\n variant='tertiary'\n >\n <span\n className={styles.text}\n id={`${labelId}-value`}\n >\n {renderDropdownOption(displayOption)}\n </span>\n </Button>\n )}\n {isOpen && (\n <div className={styles.panel}>\n {!combobox && (\n <Input\n aria-label='Filter'\n className={styles.filter}\n icon='search'\n onChange={(event) => setQuery(event.target.value)}\n placeholder={searchPlaceholder}\n ref={searchRef}\n style={filterWithVars}\n type='search'\n value={query}\n />\n )}\n <List\n aria-label='Dropdown'\n className={styles.options}\n >\n {filteredOptions.map((option) => {\n const isSelected = option.value === selectedValue;\n\n return (\n <li key={`${option.groupLabel ?? 'root'}-${option.value}`}>\n <Button\n aria-label={isSelected ? `${option.text}, selected` : option.text}\n className={cx(styles.option, isSelected && styles.selected)}\n disabled={option.disabled}\n onClick={() => commitValue(option.value)}\n variant='tertiary'\n >\n <span className={styles.text}>{renderDropdownOption(option)}</span>\n {option.groupLabel && (\n <small className={styles.group}>{option.groupLabel}</small>\n )}\n </Button>\n </li>\n );\n })}\n {canCreateOption && createOption && (\n <li>\n <Button\n aria-label={getNodeText(createOption.render(customValue)) || customValue}\n className={styles.option}\n onClick={commitCustomValue}\n variant='tertiary'\n >\n <span className={styles.text}>{createOption.render(customValue)}</span>\n </Button>\n </li>\n )}\n {filteredOptions.length === 0 && !canCreateOption && (\n <li className={styles.empty}>{emptyLabel}</li>\n )}\n </List>\n </div>\n )}\n </div>\n );\n\n return label ? (\n <div className={cx(styles.label, variant === 'inline' && styles['inline-field'])}>\n <span id={labelId}>{displayLabel}</span>\n {dropdown}\n </div>\n ) : (\n dropdown\n );\n};\n"],"names":["getNodeText","node","String","Array","isArray","map","join","isValidElement","props","children","isOptionElement","type","isOptGroupElement","isFragmentElement","React","Fragment","isWrappedSelectElement","Select","extractOptions","groupLabel","groupDisabled","options","Children","forEach","child","push","text","trim","value","disabled","Boolean","hidden","isPlaceholder","label","selected","buildWildcardMatcher","query","trimmedQuery","expression","test","character","replace","RegExp","filterOptions","matcher","selectableOptions","filter","option","getDisplayOption","selectedValue","find","getInitialValue","defaultValue","normalizeSelectElement","selectElement","placeholder","jsxs","getIconWithVars","icon","color","iconSVG","Dropdown","className","combobox","createOption","emptyLabel","renderOption","searchPlaceholder","selectedItems","variant","normalizedSelect","onChange","restSelectProps","selectProps","sanitizeSelectProps","selectClassName","nativeSelectProps","buttonRef","useRef","containerRef","labelId","useId","nativeSelectRef","searchRef","isControlled","initialValue","internalValue","setInternalValue","useState","isOpen","setIsOpen","setQuery","iconColors","default","resolveColor","white","dropdownIconColor","displayOption","triggerWithVars","filterWithVars","filteredOptions","customValue","canCreateOption","isValid","displayLabel","formatInlineLabel","renderDropdownOption","isSelected","useEffect","some","current","focus","handlePointerDown","event","contains","target","document","addEventListener","removeEventListener","handleNativeChange","closeMenu","continueComboboxSelection","commitCustomValue","onCreate","commitValue","nextValue","nativeSelect","valueSetter","Object","getOwnPropertyDescriptor","HTMLSelectElement","prototype","set","call","dispatchEvent","Event","bubbles","handleKeyDown","key","preventDefault","dropdown","cx","styles","inline","minimal","jsx","native","undefined","Button","trigger","currentValue","panel","Input","List","group","render","length","empty"],"mappings":";;;;;;;;AAgCO,SAASA,EAAYC,GAA+B;AACzD,SAAI,OAAOA,KAAS,YAAY,OAAOA,KAAS,WAAiBC,OAAOD,CAAI,IACxEE,MAAMC,QAAQH,CAAI,IAAUA,EAAKI,IAAIL,CAAW,EAAEM,KAAK,GAAG,IAC1DC,EAA+CN,CAAI,IAAUD,EAAYC,EAAKO,MAAMC,QAAQ,IACzF;AACT;AAEA,SAASC,GACPT,GACgF;AAChF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAAS;AAC/C;AAEA,SAASC,GACPX,GACoF;AACpF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAAS;AAC/C;AAEA,SAASE,GACPZ,GACmF;AACnF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAASG,GAAMC;AACrD;AAEA,SAASC,GAAuBf,GAAqD;AACnF,SAAOM,EAAeN,CAAI,KAAKA,EAAKU,SAASM;AAC/C;AAEO,SAASC,EACdT,GACAU,GACAC,IAAgB,IACE;AAClB,QAAMC,IAA4B,CAAA;AAElCC,SAAAA,GAASC,QAAQd,GAAWe,CAAAA,MAAU;AACpC,QAAIX,GAAkBW,CAAK;AACzBH,MAAAA,EAAQI,KAAK,GAAGP,EAAeM,EAAMhB,MAAMC,UAAUU,GAAYC,CAAa,CAAC;AAAA,aACtEV,GAAgBc,CAAK,GAAG;AACjC,YAAME,IAAO1B,EAAYwB,EAAMhB,MAAMC,QAAQ,EAAEkB,KAAAA,GACzCC,IAAQJ,EAAMhB,MAAMoB,SAAS,OAAO1B,OAAOsB,EAAMhB,MAAMoB,KAAK,IAAIF;AACtEL,MAAAA,EAAQI,KAAK;AAAA,QACXI,UAAUT,KAAiBU,EAAQN,EAAMhB,MAAMqB;AAAAA,QAC/CV,YAAAA;AAAAA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G,WAAWwC,EAAOe,OAAQ5F,UAAAA,EAAAA,CAAW;AAAA,MAAA,EAAA,CAE7C;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GAEJ;AAGF,SAAOhC,IACL,gBAAAuB,EAAC,OAAA,EAAI,WAAWqF,EAAGC,EAAO7G,OAAOoC,MAAY,YAAYyE,EAAO,cAAc,CAAC,GAAE,kBAAA,YAC/E,UAAA;AAAA,IAAA,gBAAAG,EAAC,QAAA,EAAK,IAAIjE,GAAUwB,UAAAA,IAAa;AAAA,IAChCoC;AAAAA,EAAAA,EAAAA,CACH,IAEAA;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const i=require("react/jsx-runtime"),b=require("../../classix-5H4IWnMA.cjs"),F=require("react"),q=require("../button/index.cjs"),I=require("../icon/index.cjs"),R="_dropzone_1rpsf_1",T="_dragging_1rpsf_19",S="_minimal_1rpsf_23",g={dropzone:R,dragging:T,minimal:S},k=({accepts:D,label:m="Select files",maxFileSize:_,multiple:d=!1,onChange:n,onValidation:a,variant:p="default",...y})=>{const f=F.useRef(null),[x,l]=F.useState(!1),c=e=>{e.preventDefault(),e.stopPropagation()},v=e=>{const t=f.current;if(!t)return;const s=new DataTransfer;for(const r of e)s.items.add(r);t.files=s.files,n==null||n({target:t,currentTarget:t})},z=e=>{const{validFiles:t,emptyFiles:s,oversizedFiles:r}=e.reduce((u,o)=>(o.size===0?u.emptyFiles.push(o):_&&o.size>_?u.oversizedFiles.push(o):u.validFiles.push(o),u),{validFiles:[],emptyFiles:[],oversizedFiles:[]});return(s.length>0||r.length>0)&&(a==null||a(s,r)),t},j=e=>{c(e),l(!1);const t=Array.from(e.dataTransfer.files??[]),s=z(t);if(s.length===0)return;const r=d?s:s.slice(0,1);v(r)},h=e=>{const t=Array.from(e.target.files??[]),s=z(t);if(s.length===t.length){n==null||n(e);return}const r=d?s:s.slice(0,1);v(r)};return i.jsx("div",{className:b.t(g.dropzone,g[p],x&&g.dragging),onDragEnter:e=>{c(e),l(!0)},onDragOver:e=>{c(e),l(!0)},onDragLeave:e=>{c(e),l(!1)},onDrop:j,...y,"data-component":"dropzone",children:i.jsxs("label",{children:[i.jsx("input",{accept:D,"aria-label":m,hidden:!0,multiple:d,onChange:h,ref:f,type:"file"}),i.jsx(I.Icon,{name:"upload",size:p==="minimal"?"medium":"large"}),i.jsx("br",{}),p!=="minimal"&&i.jsx(q.Button,{onClick:()=>{var e;return(e=f.current)==null?void 0:e.click()},type:"button",children:m})]})})};exports.Dropzone=k;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -3,7 +3,7 @@ import { t as T } from "../../classix-DG18itHa.js";
|
|
|
3
3
|
import { useRef as j, useState as k } from "react";
|
|
4
4
|
import { Button as x } from "../button/index.js";
|
|
5
5
|
import { Icon as A } from "../icon/index.js";
|
|
6
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index38.css';const R = "_dropzone_1rpsf_1", w = "_dragging_1rpsf_19", B = "_minimal_1rpsf_23", m = {
|
|
7
7
|
dropzone: R,
|
|
8
8
|
dragging: w,
|
|
9
9
|
minimal: B
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require('../../assets/
|
|
1
|
+
"use strict";require('../../assets/index39.css');var m0=Object.defineProperty;var b0=(n,e,t)=>e in n?m0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Gt=(n,e,t)=>b0(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),j=require("react"),$s=require("react-dom"),Ur=require("../../classix-5H4IWnMA.cjs"),y0=require("../file/index.cjs"),Ue=require("../button/index.cjs"),_0=require("../dropzone/index.cjs"),ze=require("../icon/index.cjs"),Ws=require("../../index-DF8JisYI.cjs"),x0=require("../toolbar/index.cjs");function v0(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const ju=v0(j);function hn(n){return{}}const mu={},w0={},Ia={},It={},tn={},Mn={},nn={},bu={},ii={},Rn={},Bn={},Ge={},Ji={},Xi={},S0={},Pa={},T0={},Da={},C0={},La={},Ma={},zr={},E0={},Ra={},Ba={},Fa={},k0={},N0={},A0={},Hs={},qa={},O0={},ja={},Ua={},I0={},yu={},Zi={},si={},P0={},D0={},mr={},br={},L0={},M0={},R0={},Fe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,B0=Fe&&"documentMode"in document?document.documentMode:null,Pe=Fe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),_t=Fe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$r=!(!Fe||!("InputEvent"in window)||B0)&&"getTargetRanges"in new window.InputEvent("input"),_u=Fe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Xn=Fe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,F0=Fe&&/Android/.test(navigator.userAgent),za=Fe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),q0=Fe&&F0&&za,Qi=Fe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!za,Zn=1,wt=3,Dt=0,$a=1,sn=2,j0=0,U0=1,z0=2,Wr=4,Hr=8,Yi=128,$0=112|(3|Wr|Hr)|Yi,es=1,ts=2,ns=3,rs=4,us=5,is=6,xu=_u||Xn||Qi?" ":"",rt=`
|
|
2
2
|
|
|
3
3
|
`,W0=_t?" ":xu,Wa="֑-߿יִ-﷽ﹰ-ﻼ",Ha="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",H0=new RegExp("^[^"+Ha+"]*["+Wa+"]"),V0=new RegExp("^[^"+Wa+"]*["+Ha+"]"),Lt={bold:1,code:16,highlight:Yi,italic:2,strikethrough:Wr,subscript:32,superscript:64,underline:Hr},G0={directionless:1,unmergeable:2},Vs={center:ts,end:is,justify:rs,left:es,right:ns,start:us},K0={[ts]:"center",[is]:"end",[rs]:"justify",[es]:"left",[ns]:"right",[us]:"start"},J0={normal:0,segmented:2,token:1},X0={[j0]:"normal",[z0]:"segmented",[U0]:"token"};function Z0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var R=Z0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Vr(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const Q0=100;let oi=!1,ss=0;function Y0(n){ss=n.timeStamp}function Uu(n,e,t){const r=n.nodeName==="BR",u=e.__lexicalLineBreak;return u&&(n===u||r&&n.previousSibling===u)||r&&wu(n,t)!==void 0}function ef(n,e,t){const r=Oe(t._window);let u=null,i=null;r!==null&&r.anchorNode===n&&(u=r.anchorOffset,i=r.focusOffset);const s=n.nodeValue;s!==null&&fs(e,s,u,i,!1)}function tf(n,e,t){if(D(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===wt&&t.isAttached()}function nf(n,e,t,r){for(let u=n;u&&!bf(u);u=Yn(u)){const i=wu(u,e);if(i!==void 0){const s=he(i,t);if(s)return re(s)?void 0:[u,s]}else if(u===r)return[r,el(t)]}}function Va(n,e,t){oi=!0;const r=performance.now()-ss>Q0;try{Ce(n,()=>{const u=q()||function(c){return c.getEditorState().read(()=>{const d=q();return d!==null?d.clone():null})}(n),i=new Map,s=n.getRootElement(),o=n._editorState,a=n._blockCursorElement;let l=!1,f="";for(let c=0;c<e.length;c++){const d=e[c],p=d.type,m=d.target,g=nf(m,n,o,s);if(!g)continue;const[y,b]=g;if(p==="characterData")r&&M(b)&&tf(u,m,b)&&ef(m,b,n);else if(p==="childList"){l=!0;const v=d.addedNodes;for(let S=0;S<v.length;S++){const I=v[S],T=Qa(I),P=I.parentNode;if(P!=null&&I!==a&&T===null&&!Uu(I,P,n)){if(_t){const $=I.innerText||I.nodeValue;$&&(f+=$)}P.removeChild(I)}}const w=d.removedNodes,C=w.length;if(C>0){let S=0;for(let I=0;I<C;I++){const T=w[I];(Uu(T,m,n)||a===T)&&(m.appendChild(T),S++)}C!==S&&i.set(y,b)}}}if(i.size>0)for(const[c,d]of i)d.reconcileObservedMutation(c,n);const h=t.takeRecords();if(h.length>0){for(let c=0;c<h.length;c++){const d=h[c],p=d.addedNodes,m=d.target;for(let g=0;g<p.length;g++){const y=p[g],b=y.parentNode;b==null||y.nodeName!=="BR"||Uu(y,m,n)||b.removeChild(y)}}t.takeRecords()}u!==null&&(l&&(u.dirty=!0,Ae(u)),_t&&ul(n)&&u.insertRawText(f))})}finally{oi=!1}}function Ga(n){const e=n._observer;e!==null&&Va(n,e.takeRecords(),e)}function Ka(n){(function(e){ss===0&&Tu(e).addEventListener("textInput",Y0,!0)})(n),n._observer=new MutationObserver((e,t)=>{Va(n,e,t)})}function Gs(n,e){const t=n.__mode,r=n.__format,u=n.__style,i=e.__mode,s=e.__format,o=e.__style;return!(t!==null&&t!==i||r!==null&&r!==s||u!==null&&u!==o)}function Ks(n,e){const t=n.mergeWithSibling(e),r=oe()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Js(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&M(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Gs(e,r)){r=Ks(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&M(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Gs(r,t)){r=Ks(r,t);break}break}t.remove()}}else r.remove()}function Ja(n){return Xs(n.anchor),Xs(n.focus),n}function Xs(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,u;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),u=!0):(r=e.getChildAtIndex(t),u=!1),M(r)){n.set(r.__key,u?r.getTextContentSize():0,"text");break}if(!k(r))break;n.set(r.__key,u?r.getChildrenSize():0,"element")}}let rf=1;const uf=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function os(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return re(on(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&vu(e)==null)}function Qn(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!os(e)&&Xa(e)===n}catch{return!1}}function as(n){return n instanceof Au}function Xa(n){let e=n;for(;e!=null;){const t=vu(e);if(as(t))return t;e=Yn(e)}return null}function vu(n){return n?n.__lexicalEditor:null}function At(n){return n.isToken()||n.isSegmented()}function sf(n){return n.nodeType===wt}function Gr(n){let e=n;for(;e!=null;){if(sf(e))return e;e=e.firstChild}return null}function Kr(n,e,t){const r=Lt[e];if(t!==null&&(n&r)==(t&r))return n;let u=n^r;return e==="subscript"?u&=-65:e==="superscript"&&(u&=-33),u}function Za(n){return M(n)||xt(n)||re(n)}function of(n,e){if(e!=null)return void(n.__key=e);ve(),Tl();const t=oe(),r=ot(),u=""+rf++;r._nodeMap.set(u,n),k(n)?t._dirtyElements.set(u,!0):t._dirtyLeaves.add(u),t._cloneNotNeeded.add(u),t._dirtyType=$a,n.__key=u}function Pt(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),u=n.getPreviousSibling(),i=n.getNextSibling();if(u===null)if(i!==null){const s=i.getWritable();r.__first=i.__key,s.__prev=null}else r.__first=null;else{const s=u.getWritable();if(i!==null){const o=i.getWritable();o.__prev=s.__key,s.__next=o.__key}else s.__next=null;t.__prev=null}if(i===null)if(u!==null){const s=u.getWritable();r.__last=u.__key,s.__next=null}else r.__last=null;else{const s=i.getWritable();if(u!==null){const o=u.getWritable();o.__next=s.__key,s.__prev=o.__key}else s.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function Jr(n){Tl();const e=n.getLatest(),t=e.__parent,r=ot(),u=oe(),i=r._nodeMap,s=u._dirtyElements;t!==null&&function(a,l,f){let h=a;for(;h!==null;){if(f.has(h))return;const c=l.get(h);if(c===void 0)break;f.set(h,!1),h=c.__parent}}(t,i,s);const o=e.__key;u._dirtyType=$a,k(n)?s.set(o,!0):u._dirtyLeaves.add(o)}function me(n){ve();const e=oe(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=he(t);r!==null&&r.getWritable()}if(n!==null){const r=he(n);r!==null&&r.getWritable()}}}function gt(){return ur()?null:oe()._compositionKey}function he(n,e){const t=(e||ot())._nodeMap.get(n);return t===void 0?null:t}function Qa(n,e){const t=wu(n,oe());return t!==void 0?he(t,e):null}function wu(n,e){return n[`__lexicalKey_${e._key}`]}function on(n,e){let t=n;for(;t!=null;){const r=Qa(t,e);if(r!==null)return r;t=Yn(t)}return null}function Ya(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Zs(n){return n.read(()=>ce().getTextContent())}function ce(){return el(ot())}function el(n){return n._nodeMap.get("root")}function Ae(n){ve();const e=ot();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Yt(n){const e=oe(),t=function(r,u){let i=r;for(;i!=null;){const s=wu(i,u);if(s!==void 0)return s;i=Yn(i)}return null}(n,e);return t===null?n===e.getRootElement()?he("root"):null:he(t)}function Qs(n,e){return e?n.getTextContentSize():0}function tl(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function ls(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function nl(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function rl(n){return n.nodeType===wt?n.nodeValue:null}function cs(n,e,t){const r=Oe(e._window);if(r===null)return;const u=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(u!==null){let o=rl(u);const a=on(u);if(o!==null&&M(a)){if(o===xu&&t){const l=t.length;o=t,i=l,s=l}o!==null&&fs(a,o,i,s,n)}}}function fs(n,e,t,r,u){let i=n;if(i.isAttached()&&(u||!i.isDirty())){const s=i.isComposing();let o=e;(s||u)&&e[e.length-1]===xu&&(o=e.slice(0,-1));const a=i.getTextContent();if(u||o!==a){if(o===""){if(me(null),_u||Xn||Qi)i.remove();else{const m=oe();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const l=i.getParent(),f=rr(),h=i.getTextContentSize(),c=gt(),d=i.getKey();if(i.isToken()||c!==null&&d===c&&!s||D(f)&&(l!==null&&!l.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===n.__key&&f.focus.offset===h&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const p=q();if(!D(p)||t===null||r===null)return void i.setTextContent(o);if(p.setTextNodeRange(i,t,i,r),i.isSegmented()){const m=le(i.getTextContent());i.replace(m),i=m}i.setTextContent(o)}}}function af(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),u=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||u||function(i){const s=i.getPreviousSibling();return(M(s)||k(s)&&s.isInline())&&!s.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||u)}function Ys(n){return n==="ArrowLeft"}function eo(n){return n==="ArrowRight"}function En(n,e){return Pe?n:e}function to(n){return n==="Enter"}function _n(n){return n==="Backspace"}function xn(n){return n==="Delete"}function no(n,e,t){return n.toLowerCase()==="a"&&En(e,t)}function lf(){const n=ce();Ae(Ja(n.select(0,n.getChildrenSize())))}function Nn(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const u=n[e];if(typeof u=="string"){const i=Vr(u);return t[e]=i,i}return u}function ds(n,e,t,r,u){if(t.size===0)return;const i=r.__type,s=r.__key,o=e.get(i);o===void 0&&R(33,i);const a=o.klass;let l=n.get(a);l===void 0&&(l=new Map,n.set(a,l));const f=l.get(s),h=f==="destroyed"&&u==="created";(f===void 0||h)&&l.set(s,h?"updated":u)}function ro(n,e,t){const r=n.getParent();let u=t,i=n;return r!==null&&(e&&t===0?(u=i.getIndexWithinParent(),i=r):e||t!==i.getChildrenSize()||(u=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?u-1:u)}function Fn(n,e){const t=n.offset;if(n.type==="element")return ro(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const u=e?r.getPreviousSibling():r.getNextSibling();return u===null?ro(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):u}}return null}function ul(n){const e=Tu(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function F(n,e,t){return kl(n,e,t)}function Su(n){return!ye(n)&&!n.isLastChild()&&!n.isInline()}function Xr(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&R(75,e),t}function Yn(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function An(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Tu(n){const e=n._window;return e===null&&R(78),e}function cf(n){let e=n.getParentOrThrow();for(;e!==null;){if(ut(e))return e;e=e.getParentOrThrow()}return e}function ut(n){return ye(n)||k(n)&&n.isShadowRoot()}function St(n){const e=oe(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&R(200,n.constructor.name,t);const{replace:u,replaceWithKlass:i}=r;if(u!==null){const s=u(n),o=s.constructor;return i!==null?s instanceof i||R(201,i.name,i.getType(),o.name,o.getType(),n.constructor.name,t):s instanceof n.constructor&&o!==n.constructor||R(202,o.name,o.getType(),n.constructor.name,t),s.__key===n.__key&&R(203,n.constructor.name,t,o.name,o.getType()),s}return n}function zu(n,e){!ye(n.getParent())||k(e)||re(e)||R(99)}function $u(n){return(re(n)||k(n)&&!n.canBeEmpty())&&!n.isInline()}function hs(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function ff(n,e,t){let r=n._blockCursorElement;if(D(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const u=t.anchor,i=u.getNode(),s=u.offset;let o=!1,a=null;if(s===i.getChildrenSize())$u(i.getChildAtIndex(s-1))&&(o=!0);else{const l=i.getChildAtIndex(s);if(l!==null&&$u(l)){const f=l.getPreviousSibling();(f===null||$u(f))&&(o=!0,a=n.getElementByKey(l.__key))}}if(o){const l=n.getElementByKey(i.__key);return r===null&&(n._blockCursorElement=r=function(f){const h=f.theme,c=document.createElement("div");c.contentEditable="false",c.setAttribute("data-lexical-cursor","true");let d=h.blockCursor;if(d!==void 0){if(typeof d=="string"){const p=Vr(d);d=h.blockCursor=p}d!==void 0&&c.classList.add(...d)}return c}(n._config)),e.style.caretColor="transparent",void(a===null?l.appendChild(r):l.insertBefore(r,a))}}r!==null&&hs(r,n,e)}function Oe(n){return Fe?(n||window).getSelection():null}function df(n){return Ut(n)&&n.tagName==="A"}function Ut(n){return n.nodeType===1}function uo(n){return n.nodeType===11}function ai(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Zr(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function ht(n){if(re(n)&&!n.isInline())return!0;if(!k(n)||ut(n))return!1;const e=n.getFirstChild(),t=e===null||xt(e)||M(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function vn(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function hf(){return oe()}const io=new WeakMap,pf=new Map;function gf(n){if(!n._readOnly&&n.isEmpty())return pf;n._readOnly||R(192);let e=io.get(n);if(!e){e=new Map,io.set(n,e);for(const[t,r]of n._nodeMap){const u=r.__type;let i=e.get(u);i||(i=new Map,e.set(u,i)),i.set(t,r)}}return e}function ps(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function mf(n,e){const t=(parseInt(n.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function bf(n){return n.__lexicalUnmanaged===!0}function il(n,e,t,r,u,i){let s=n.getFirstChild();for(;s!==null;){const o=s.__key;s.__parent===e&&(k(s)&&il(s,o,t,r,u,i),t.has(o)||i.delete(o),u.push(o)),s=s.getNextSibling()}}let vt,_e,qn,Cu,li,ci,Mt,Be,fi,jn,de="",be="",We=null,De="",tt="",sl=!1,Un=!1,Lr=null;function Qr(n,e){const t=Mt.get(n);if(e!==null){const r=pi(n);r.parentNode===e&&e.removeChild(r)}if(Be.has(n)||_e._keyToDOMMap.delete(n),k(t)){const r=eu(t,Mt);di(r,0,r.length-1,null)}t!==void 0&&ds(jn,qn,Cu,t,"destroyed")}function di(n,e,t,r){let u=e;for(;u<=t;++u){const i=n[u];i!==void 0&&Qr(i,r)}}function Nt(n,e){n.setProperty("text-align",e)}const yf="40px";function ol(n,e){const t=vt.theme.indent;if(typeof t=="string"){const u=n.classList.contains(t);e>0&&!u?n.classList.add(t):e<1&&u&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||yf;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function al(n,e){const t=n.style;e===0?Nt(t,""):e===es?Nt(t,"left"):e===ts?Nt(t,"center"):e===ns?Nt(t,"right"):e===rs?Nt(t,"justify"):e===us?Nt(t,"start"):e===is&&Nt(t,"end")}function Yr(n,e){const t=Be.get(n);t===void 0&&R(60);const r=t.createDOM(vt,_e);if(function(u,i,s){const o=s._keyToDOMMap;(function(a,l,f){a[`__lexicalKey_${l._key}`]=f})(i,s,u),o.set(u,i)}(n,r,_e),M(t)?r.setAttribute("data-lexical-text","true"):re(t)&&r.setAttribute("data-lexical-decorator","true"),k(t)){const u=t.__indent,i=t.__size;if(u!==0&&ol(r,u),i!==0){const o=i-1;(function(a,l,f,h){const c=be;be="",hi(a,f,0,l,f.getDOMSlot(h)),cl(f,h),be=c})(eu(t,Be),o,t,r)}const s=t.__format;s!==0&&al(r,s),t.isInline()||ll(null,t,r),Su(t)&&(de+=rt,tt+=rt)}else{const u=t.getTextContent();if(re(t)){const i=t.decorate(_e,vt);i!==null&&fl(n,i),r.contentEditable="false"}else M(t)&&(t.isDirectionless()||(be+=u));de+=u,tt+=u}return e!==null&&e.insertChild(r),ds(jn,qn,Cu,t,"created"),r}function hi(n,e,t,r,u){const i=de;de="";let s=t;for(;s<=r;++s){Yr(n[s],u);const o=Be.get(n[s]);o!==null&&M(o)&&(We===null&&(We=o.getFormat()),De===""&&(De=o.getStyle()))}Su(e)&&(de+=rt),u.element.__lexicalTextContent=de,de=i+de}function so(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return xt(r)?"line-break":re(r)&&r.isInline()?"decorator":null}return"empty"}return null}function ll(n,e,t){const r=so(n,Mt),u=so(e,Be);r!==u&&e.getDOMSlot(t).setManagedLineBreak(u)}function cl(n,e){const t=e.__lexicalDirTextContent||"",r=e.__lexicalDir||"";if(t!==be||r!==Lr){const i=be==="",s=i?Lr:(u=be,H0.test(u)?"rtl":V0.test(u)?"ltr":null);if(s!==r){const o=e.classList,a=vt.theme;let l=r!==null?a[r]:void 0,f=s!==null?a[s]:void 0;if(l!==void 0){if(typeof l=="string"){const h=Vr(l);l=a[r]=h}o.remove(...l)}if(s===null||i&&s==="ltr")e.removeAttribute("dir");else{if(f!==void 0){if(typeof f=="string"){const h=Vr(f);f=a[s]=h}f!==void 0&&o.add(...f)}e.dir=s}Un||(n.getWritable().__dir=s)}Lr=s,e.__lexicalDirTextContent=be,e.__lexicalDir=s}var u}function _f(n,e,t){const r=be;var u;be="",We=null,De="",function(i,s,o){const a=de,l=i.__size,f=s.__size;de="";const h=o.element;if(l===1&&f===1){const c=i.__first,d=s.__first;if(c===d)kn(c,h);else{const m=pi(c),g=Yr(d,null);try{h.replaceChild(g,m)}catch(y){if(typeof y=="object"&&y!=null){const b=`${y.toString()} Parent: ${h.tagName}, new child: {tag: ${g.tagName} key: ${d}}, old child: {tag: ${m.tagName}, key: ${c}}.`;throw new Error(b)}throw y}Qr(c,null)}const p=Be.get(d);M(p)&&(We===null&&(We=p.getFormat()),De===""&&(De=p.getStyle()))}else{const c=eu(i,Mt),d=eu(s,Be);if(c.length!==l&&R(227),d.length!==f&&R(228),l===0)f!==0&&hi(d,s,0,f-1,o);else if(f===0){if(l!==0){const p=o.after==null&&o.before==null&&o.element.__lexicalLineBreak==null;di(c,0,l-1,p?null:h),p&&(h.textContent="")}}else(function(p,m,g,y,b,v){const w=y-1,C=b-1;let S,I,T=v.getFirstChild(),P=0,$=0;for(;P<=w&&$<=C;){const N=m[P],B=g[$];if(N===B)T=Wu(kn(B,v.element)),P++,$++;else{S===void 0&&(S=new Set(m)),I===void 0&&(I=new Set(g));const O=I.has(N),A=S.has(B);if(O)if(A){const U=Xr(_e,B);U===T?T=Wu(kn(B,v.element)):(v.withBefore(T).insertChild(U),kn(B,v.element)),P++,$++}else Yr(B,v.withBefore(T)),$++;else T=Wu(pi(N)),Qr(N,v.element),P++}const x=Be.get(B);x!==null&&M(x)&&(We===null&&(We=x.getFormat()),De===""&&(De=x.getStyle()))}const _=P>w,E=$>C;if(_&&!E){const N=g[C+1],B=N===void 0?null:_e.getElementByKey(N);hi(g,p,$,C,v.withBefore(B))}else E&&!_&&di(m,P,w,v.element)})(s,c,d,l,f,o)}Su(s)&&(de+=rt),h.__lexicalTextContent=de,de=a+de}(n,e,e.getDOMSlot(t)),cl(e,t),Bt(u=e)&&We!=null&&We!==u.__textFormat&&!Un&&(u.setTextFormat(We),u.setTextStyle(De)),function(i){Bt(i)&&De!==""&&De!==i.__textStyle&&!Un&&i.setTextStyle(De)}(e),be=r}function eu(n,e){const t=[];let r=n.__first;for(;r!==null;){const u=e.get(r);u===void 0&&R(101),t.push(r),r=u.__next}return t}function kn(n,e){const t=Mt.get(n);let r=Be.get(n);t!==void 0&&r!==void 0||R(61);const u=sl||ci.has(n)||li.has(n),i=Xr(_e,n);if(t===r&&!u){if(k(t)){const s=i.__lexicalTextContent;s!==void 0&&(de+=s,tt+=s);const o=i.__lexicalDirTextContent;o!==void 0&&(be+=o)}else{const s=t.getTextContent();M(t)&&!t.isDirectionless()&&(be+=s),tt+=s,de+=s}return i}if(t!==r&&u&&ds(jn,qn,Cu,r,"updated"),r.updateDOM(t,i,vt)){const s=Yr(n,null);return e===null&&R(62),e.replaceChild(s,i),Qr(n,null),s}if(k(t)&&k(r)){const s=r.__indent;s!==t.__indent&&ol(i,s);const o=r.__format;o!==t.__format&&al(i,o),u&&(_f(t,r,i),ye(r)||r.isInline()||ll(t,r,i)),Su(r)&&(de+=rt,tt+=rt)}else{const s=r.getTextContent();if(re(r)){const o=r.decorate(_e,vt);o!==null&&fl(n,o)}else M(r)&&!r.isDirectionless()&&(be+=s);de+=s,tt+=s}if(!Un&&ye(r)&&r.__cachedText!==tt){const s=r.getWritable();s.__cachedText=tt,r=s}return i}function fl(n,e){let t=_e._pendingDecorators;const r=_e._decorators;if(t===null){if(r[n]===e)return;t=Ya(_e)}t[n]=e}function Wu(n){let e=n.nextSibling;return e!==null&&e===_e._blockCursorElement&&(e=e.nextSibling),e}function xf(n,e,t,r,u,i){de="",tt="",be="",sl=r===sn,Lr=null,_e=t,vt=t._config,qn=t._nodes,Cu=_e._listeners.mutation,li=u,ci=i,Mt=n._nodeMap,Be=e._nodeMap,Un=e._readOnly,fi=new Map(t._keyToDOMMap);const s=new Map;return jn=s,kn("root",null),_e=void 0,qn=void 0,li=void 0,ci=void 0,Mt=void 0,Be=void 0,vt=void 0,fi=void 0,jn=void 0,s}function pi(n){const e=fi.get(n);return e===void 0&&R(75,n),e}const Ze=Object.freeze({}),gi=30,mi=[["keydown",function(n,e){if(On=n.timeStamp,dl=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:u,metaKey:i,altKey:s}=n;if(!F(e,S0,n)&&t!=null){if(function(o,a,l,f){return eo(o)&&!a&&!f&&!l}(t,u,s,i))F(e,Pa,n);else if(function(o,a,l,f,h){return eo(o)&&!f&&!l&&(a||h)}(t,u,r,s,i))F(e,T0,n);else if(function(o,a,l,f){return Ys(o)&&!a&&!f&&!l}(t,u,s,i))F(e,Da,n);else if(function(o,a,l,f,h){return Ys(o)&&!f&&!l&&(a||h)}(t,u,r,s,i))F(e,C0,n);else if(function(o,a,l){return function(f){return f==="ArrowUp"}(o)&&!a&&!l}(t,u,i))F(e,La,n);else if(function(o,a,l){return function(f){return f==="ArrowDown"}(o)&&!a&&!l}(t,u,i))F(e,Ma,n);else if(function(o,a){return to(o)&&a}(t,r))In=!0,F(e,zr,n);else if(function(o){return o===" "}(t))F(e,E0,n);else if(function(o,a){return Pe&&a&&o.toLowerCase()==="o"}(t,u))n.preventDefault(),In=!0,F(e,tn,!0);else if(function(o,a){return to(o)&&!a}(t,r))In=!1,F(e,zr,n);else if(function(o,a,l,f){return Pe?!a&&!l&&(_n(o)||o.toLowerCase()==="h"&&f):!(f||a||l)&&_n(o)}(t,s,i,u))_n(t)?F(e,Ra,n):(n.preventDefault(),F(e,It,!0));else if(function(o){return o==="Escape"}(t))F(e,Ba,n);else if(function(o,a,l,f,h){return Pe?!(l||f||h)&&(xn(o)||o.toLowerCase()==="d"&&a):!(a||f||h)&&xn(o)}(t,u,r,s,i))xn(t)?F(e,Fa,n):(n.preventDefault(),F(e,It,!1));else if(function(o,a,l){return _n(o)&&(Pe?a:l)}(t,s,u))n.preventDefault(),F(e,Rn,!0);else if(function(o,a,l){return xn(o)&&(Pe?a:l)}(t,s,u))n.preventDefault(),F(e,Rn,!1);else if(function(o,a){return Pe&&a&&_n(o)}(t,i))n.preventDefault(),F(e,Bn,!0);else if(function(o,a){return Pe&&a&&xn(o)}(t,i))n.preventDefault(),F(e,Bn,!1);else if(function(o,a,l,f){return o.toLowerCase()==="b"&&!a&&En(l,f)}(t,s,i,u))n.preventDefault(),F(e,Ge,"bold");else if(function(o,a,l,f){return o.toLowerCase()==="u"&&!a&&En(l,f)}(t,s,i,u))n.preventDefault(),F(e,Ge,"underline");else if(function(o,a,l,f){return o.toLowerCase()==="i"&&!a&&En(l,f)}(t,s,i,u))n.preventDefault(),F(e,Ge,"italic");else if(function(o,a,l,f){return o==="Tab"&&!a&&!l&&!f}(t,s,u,i))F(e,k0,n);else if(function(o,a,l,f){return o.toLowerCase()==="z"&&!a&&En(l,f)}(t,r,i,u))n.preventDefault(),F(e,Ji,void 0);else if(function(o,a,l,f){return Pe?o.toLowerCase()==="z"&&l&&a:o.toLowerCase()==="y"&&f||o.toLowerCase()==="z"&&f&&a}(t,r,i,u))n.preventDefault(),F(e,Xi,void 0);else{const o=e._editorState._selection;o===null||D(o)?!_t&&no(t,i,u)&&(n.preventDefault(),F(e,si,n)):function(a,l,f,h){return!l&&a.toLowerCase()==="c"&&(Pe?f:h)}(t,r,i,u)?(n.preventDefault(),F(e,yu,n)):function(a,l,f,h){return!l&&a.toLowerCase()==="x"&&(Pe?f:h)}(t,r,i,u)?(n.preventDefault(),F(e,Zi,n)):no(t,i,u)&&(n.preventDefault(),F(e,si,n))}(function(o,a,l,f){return o||a||l||f})(u,r,s,i)&&F(e,R0,n)}}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&Ce(e,()=>{re(on(t))||(yi=!0)})}],["compositionstart",function(n,e){Ce(e,()=>{const t=q();if(D(t)&&!e.isComposing()){const r=t.anchor,u=t.anchor.getNode();me(r.key),(n.timeStamp<On+gi||r.type==="element"||!t.isCollapsed()||u.getFormat()!==t.format||M(u)&&u.getStyle()!==t.style)&&F(e,nn,W0)}})}],["compositionend",function(n,e){_t?wn=!0:Ce(e,()=>{Hu(e,n.data)})}],["input",function(n,e){n.stopPropagation(),Ce(e,()=>{const t=q(),r=n.data,u=ml(n);if(r!=null&&D(t)&&gl(t,u,r,n.timeStamp,!1)){wn&&(Hu(e,r),wn=!1);const i=t.anchor.getNode(),s=Oe(e._window);if(s===null)return;const o=t.isBackward(),a=o?t.anchor.offset:t.focus.offset,l=o?t.focus.offset:t.anchor.offset;$r&&!t.isCollapsed()&&M(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===rl(s.anchorNode)||F(e,nn,r);const f=r.length;_t&&f>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=f),_u||Xn||Qi||!e.isComposing()||(On=0,me(null))}else cs(!1,e,r!==null?r:void 0),wn&&(Hu(e,r||void 0),wn=!1);ve(),Ga(oe())}),Xt=null}],["click",function(n,e){Ce(e,()=>{const t=q(),r=Oe(e._window),u=rr();if(r){if(D(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!ye(s)&&ce().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&u!==null&&t.is(u)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&s!==t.focus.getNode()&&(k(s)?s.select(0):s.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const i=r.anchorNode;if(i!==null){const s=i.nodeType;(s===Zn||s===wt)&&Ae(ms(u,r,e,n))}}}F(e,Ia,n)})}],["cut",Ze],["copy",Ze],["dragstart",Ze],["dragover",Ze],["dragend",Ze],["paste",Ze],["focus",Ze],["blur",Ze],["drop",Ze]];$r&&mi.push(["beforeinput",(n,e)=>function(t,r){const u=t.inputType,i=ml(t);u==="deleteCompositionText"||_t&&ul(r)||u!=="insertCompositionText"&&Ce(r,()=>{const s=q();if(u==="deleteContentBackward"){if(s===null){const d=rr();if(!D(d))return;Ae(d.clone())}if(D(s)){const d=s.anchor.key===s.focus.key;if(o=t.timeStamp,dl==="MediaLast"&&o<On+gi&&r.isComposing()&&d){if(me(null),On=0,setTimeout(()=>{Ce(r,()=>{me(null)})},gi),D(s)){const p=s.anchor.getNode();p.markDirty(),s.format=p.getFormat(),M(p)||R(142),s.style=p.getStyle()}}else{me(null),t.preventDefault();const p=s.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),y=s.anchor.offset===0&&s.focus.offset===m.length;q0&&d&&!y&&g||F(r,It,!0)}return}}var o;if(!D(s))return;const a=t.data;Xt!==null&&cs(!1,r,Xt),s.dirty&&Xt===null||!s.isCollapsed()||ye(s.anchor.getNode())||i===null||s.applyDOMRange(i),Xt=null;const l=s.anchor,f=s.focus,h=l.getNode(),c=f.getNode();if(u!=="insertText"&&u!=="insertTranspose")switch(t.preventDefault(),u){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":F(r,nn,t);break;case"insertFromComposition":me(null),F(r,nn,t);break;case"insertLineBreak":me(null),F(r,tn,!1);break;case"insertParagraph":me(null),In&&!Xn?(In=!1,F(r,tn,!1)):F(r,Mn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":F(r,bu,t);break;case"deleteByComposition":(function(d,p){return d!==p||k(d)||k(p)||!d.isToken()||!p.isToken()})(h,c)&&F(r,ii,t);break;case"deleteByDrag":case"deleteByCut":F(r,ii,t);break;case"deleteContent":F(r,It,!1);break;case"deleteWordBackward":F(r,Rn,!0);break;case"deleteWordForward":F(r,Rn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":F(r,Bn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":F(r,Bn,!1);break;case"formatStrikeThrough":F(r,Ge,"strikethrough");break;case"formatBold":F(r,Ge,"bold");break;case"formatItalic":F(r,Ge,"italic");break;case"formatUnderline":F(r,Ge,"underline");break;case"historyUndo":F(r,Ji,void 0);break;case"historyRedo":F(r,Xi,void 0)}else{if(a===`
|
|
4
4
|
`)t.preventDefault(),F(r,tn,!1);else if(a===rt)t.preventDefault(),F(r,Mn,void 0);else if(a==null&&t.dataTransfer){const d=t.dataTransfer.getData("text/plain");t.preventDefault(),s.insertRawText(d)}else a!=null&&gl(s,i,a,t.timeStamp,!0)?(t.preventDefault(),F(r,nn,a)):Xt=a;hl=t.timeStamp}})}(n,e)]);let On=0,dl=null,hl=0,Xt=null;const tu=new WeakMap;let bi=!1,yi=!1,In=!1,wn=!1,pl=[0,"",0,"root",0];function gl(n,e,t,r,u){const i=n.anchor,s=n.focus,o=i.getNode(),a=oe(),l=Oe(a._window),f=l!==null?l.anchorNode:null,h=i.key,c=a.getElementByKey(h),d=t.length;return h!==s.key||!M(o)||(!u&&(!$r||hl<r+50)||o.isDirty()&&d<2||tl(t))&&i.offset!==s.offset&&!o.isComposing()||At(o)||o.isDirty()&&d>1||(u||!$r)&&c!==null&&!o.isComposing()&&f!==Gr(c)||l!==null&&e!==null&&(!e.collapsed||e.startContainer!==l.anchorNode||e.startOffset!==l.anchorOffset)||o.getFormat()!==n.format||o.getStyle()!==n.style||af(n,o)}function oo(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===wt&&e!==0&&e!==n.nodeValue.length}function ao(n,e,t){const{anchorNode:r,anchorOffset:u,focusNode:i,focusOffset:s}=n;bi&&(bi=!1,oo(r,u)&&oo(i,s))||Ce(e,()=>{if(!t)return void Ae(null);if(!Qn(e,r,i))return;const o=q();if(D(o)){const a=o.anchor,l=a.getNode();if(o.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(o.dirty=!0);const f=Tu(e).event,h=f?f.timeStamp:performance.now(),[c,d,p,m,g]=pl,y=ce(),b=e.isComposing()===!1&&y.getTextContent()==="";if(h<g+200&&a.offset===p&&a.key===m)o.format=c,o.style=d;else if(a.type==="text")M(l)||R(141),o.format=l.getFormat(),o.style=l.getStyle();else if(a.type==="element"&&!b){const v=a.getNode();o.style="",v instanceof pn&&v.getChildrenSize()===0?(o.format=v.getTextFormat(),o.style=v.getTextStyle()):o.format=0}}else{const f=a.key,h=o.focus.key,c=o.getNodes(),d=c.length,p=o.isBackward(),m=p?s:u,g=p?u:s,y=p?h:f,b=p?f:h;let v=$0,w=!1;for(let C=0;C<d;C++){const S=c[C],I=S.getTextContentSize();if(M(S)&&I!==0&&!(C===0&&S.__key===y&&m===I||C===d-1&&S.__key===b&&g===0)&&(w=!0,v&=S.getFormat(),v===0))break}o.format=w?v:0}}F(e,mu,void 0)})}function ml(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Hu(n,e){const t=n._compositionKey;if(me(null),t!==null&&e!=null){if(e===""){const r=he(t),u=Gr(n.getElementByKey(t));return void(u!==null&&u.nodeValue!==null&&M(r)&&fs(r,u.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../../assets/
|
|
1
|
+
import '../../assets/index39.css';var S0 = Object.defineProperty;
|
|
2
2
|
var T0 = (n, e, t) => e in n ? S0(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var Xt = (n, e, t) => T0(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { jsx as z, jsxs as bt, Fragment as Gr } from "react/jsx-runtime";
|
|
@@ -10,7 +10,7 @@ import { File as I0 } from "../file/index.js";
|
|
|
10
10
|
import { Button as $e } from "../button/index.js";
|
|
11
11
|
import { Dropzone as P0 } from "../dropzone/index.js";
|
|
12
12
|
import { Icon as We } from "../icon/index.js";
|
|
13
|
-
import { I as Xs } from "../../index-
|
|
13
|
+
import { I as Xs } from "../../index-DE2nzqL5.js";
|
|
14
14
|
import { Toolbar as D0 } from "../toolbar/index.js";
|
|
15
15
|
function yn(n) {
|
|
16
16
|
return {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const e=require("react/jsx-runtime"),n="_header_1byal_15",t={"empty-state":"_empty-state_1byal_3",header:n},c=({button:s,content:a,header:r})=>e.jsxs("div",{className:t["empty-state"],"data-component":"emptystate",children:[e.jsx("p",{className:t.header,children:r}),e.jsx("p",{children:a}),s]});exports.EmptyState=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index41.css');const s=require("react/jsx-runtime"),i=require("../../classix-5H4IWnMA.cjs"),l="_fieldset_f5vpp_1",d={fieldset:l},o=({className:e,...t})=>s.jsx("fieldset",{className:i.t(d.fieldset,e),...t,"data-component":"fieldset"});exports.Fieldset=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { t as o } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index41.css';const f = "_fieldset_f5vpp_1", i = {
|
|
4
4
|
fieldset: f
|
|
5
5
|
}, m = ({
|
|
6
6
|
className: e,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index42.css');const r=require("react/jsx-runtime"),s=require("../../classix-5H4IWnMA.cjs"),n="_figure_spygr_1",u={figure:n},c=({accessibleLabel:e,children:t,className:i})=>r.jsxs("figure",{className:s.t(u.figure,i),"data-component":"figure",children:[t,e&&r.jsx("figcaption",{"data-content":"screen-reader",children:e})]});exports.Figure=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|