@wrdagency/blockout 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2NBKRL7C-DnAMmXv4.js +81 -0
- package/dist/CaretDown.es-eySGHzTJ.js +32 -0
- package/dist/CaretUp.es-Cy8czlHG.js +32 -0
- package/dist/P7GR5CS5-BryEvRCz.js +621 -0
- package/dist/SSRBase.es-BUXS72ra.js +33 -0
- package/dist/T7VMP3TM--1s529fr.js +3544 -0
- package/dist/UQQRIHDV-Bfi_RJby.js +1046 -0
- package/dist/VIIRIBF3-XWA2y8Hu.js +21 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/assets/index.css +1 -0
- package/dist/assets/index10.css +1 -0
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index2.css +1 -0
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/assets/index5.css +1 -0
- package/dist/assets/index6.css +1 -0
- package/dist/assets/index7.css +1 -0
- package/dist/assets/index8.css +1 -0
- package/dist/assets/index9.css +1 -0
- package/dist/components/button/index.d.ts +9 -0
- package/dist/components/button/index.js +28 -0
- package/dist/components/button-group/index.d.ts +6 -0
- package/dist/components/button-group/index.js +6 -0
- package/dist/components/controls/base-control/index.d.ts +3 -0
- package/dist/components/controls/base-control/index.js +26 -0
- package/dist/components/controls/base-control/props.d.ts +23 -0
- package/dist/components/controls/base-control/props.js +21 -0
- package/dist/components/controls/index.d.ts +6 -0
- package/dist/components/controls/index.js +14 -0
- package/dist/components/controls/number-control/index.d.ts +6 -0
- package/dist/components/controls/number-control/index.js +52 -0
- package/dist/components/controls/select-control/index.d.ts +9 -0
- package/dist/components/controls/select-control/index.js +591 -0
- package/dist/components/controls/select-control/options.d.ts +11 -0
- package/dist/components/controls/select-control/options.js +12 -0
- package/dist/components/controls/text-control/index.d.ts +6 -0
- package/dist/components/controls/text-control/index.js +12 -0
- package/dist/components/controls/textarea-control/index.d.ts +6 -0
- package/dist/components/controls/textarea-control/index.js +18 -0
- package/dist/components/controls/toggle-control/index.d.ts +8 -0
- package/dist/components/controls/toggle-control/index.js +46 -0
- package/dist/components/data-table/column.d.ts +4 -0
- package/dist/components/data-table/column.js +874 -0
- package/dist/components/data-table/context.d.ts +7 -0
- package/dist/components/data-table/context.js +36 -0
- package/dist/components/data-table/example.d.ts +1 -0
- package/dist/components/data-table/example.js +5 -0
- package/dist/components/data-table/footer.d.ts +2 -0
- package/dist/components/data-table/footer.js +23 -0
- package/dist/components/data-table/header.d.ts +7 -0
- package/dist/components/data-table/header.js +408 -0
- package/dist/components/data-table/index.d.ts +10 -0
- package/dist/components/data-table/index.js +86 -0
- package/dist/components/data-table/types.d.ts +75 -0
- package/dist/components/data-table/types.js +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +23 -0
- package/dist/components/menu/icon.d.ts +4 -0
- package/dist/components/menu/icon.js +6 -0
- package/dist/components/menu/index.d.ts +8 -0
- package/dist/components/menu/index.js +131 -0
- package/dist/components/menu/item.d.ts +7 -0
- package/dist/components/menu/item.js +8 -0
- package/dist/components/menu/items/action.d.ts +7 -0
- package/dist/components/menu/items/action.js +23 -0
- package/dist/components/menu/items/spacer.d.ts +2 -0
- package/dist/components/menu/items/spacer.js +46 -0
- package/dist/components/menu/items/submenu.d.ts +7 -0
- package/dist/components/menu/items/submenu.js +7 -0
- package/dist/components/menu/items/toggle.d.ts +7 -0
- package/dist/components/menu/items/toggle.js +109 -0
- package/dist/components/menu/types.d.ts +28 -0
- package/dist/components/menu/types.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25 -0
- package/dist/item-CPVd5mKo.js +758 -0
- package/dist/primitives/draggable/index.d.ts +17 -0
- package/dist/primitives/draggable/index.js +52 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/resizable/index.d.ts +7 -0
- package/dist/primitives/resizable/index.js +76 -0
- package/dist/types/component.d.ts +4 -0
- package/dist/types/component.js +1 -0
- package/dist/types/math.d.ts +10 -0
- package/dist/types/math.js +1 -0
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +6 -0
- package/dist/utils/noop.d.ts +1 -0
- package/dist/utils/noop.js +5 -0
- package/package.json +61 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import { jsx as v, jsxs as R, Fragment as ve } from "react/jsx-runtime";
|
|
2
|
+
import { e as _e } from "../../../CaretDown.es-eySGHzTJ.js";
|
|
3
|
+
import { BaseControl as Oe } from "../base-control/index.js";
|
|
4
|
+
import { useBaseControlProps as Ie } from "../base-control/props.js";
|
|
5
|
+
import { normalizeOption as Ae } from "./options.js";
|
|
6
|
+
import { c as De, a as ke, t as ge, u as Ve, b as Ne, d as Ke, e as Me, f as Le, g as Pe, i as Re, h as Te, j as Be, k as Fe } from "../../../T7VMP3TM--1s529fr.js";
|
|
7
|
+
import { m as He, o as je, t as $e, c as ze, s as G, d as re, e as qe, f as Ue, g as fe, i as We, a as Ge, b as Je, u as Qe } from "../../../UQQRIHDV-Bfi_RJby.js";
|
|
8
|
+
import { c as Xe, P as Ye, C as Ze, o as et, a as tt, b as T, _ as B, q as ot, i as Z, h as O, j as S, t as nt, f as F, d as H, x as rt, y as J, z as E, A as k, B as lt, u as V, e as se, D as st, E as Y, s as we, F as at, m as it, r as ye, G as ct, g as ut, k as dt, l as mt, H as pt, I as vt, J as ft } from "../../../P7GR5CS5-BryEvRCz.js";
|
|
9
|
+
import { createContext as ae, useMemo as ie, useState as X, useRef as St, useEffect as le, useCallback as bt, useContext as Se } from "react";
|
|
10
|
+
import '../../../assets/index11.css';var $ = Xe(
|
|
11
|
+
[et, tt],
|
|
12
|
+
[Ye, Ze]
|
|
13
|
+
), ce = $.useContext, ht = $.useScopedContext, ue = $.useProviderContext, gt = $.ContextProvider, Ce = $.ScopedContextProvider, Pt = ae(!1), be = ae(null), wt = "span", yt = {
|
|
14
|
+
top: "4,10 8,6 12,10",
|
|
15
|
+
right: "6,4 10,8 6,12",
|
|
16
|
+
bottom: "4,6 8,10 12,6",
|
|
17
|
+
left: "10,4 6,8 10,12"
|
|
18
|
+
}, xe = T(function(n) {
|
|
19
|
+
var o = n, { store: e, placement: t } = o, s = B(o, ["store", "placement"]);
|
|
20
|
+
const p = ot();
|
|
21
|
+
e = e || p, Z(
|
|
22
|
+
e,
|
|
23
|
+
process.env.NODE_ENV !== "production" && "PopoverDisclosureArrow must be wrapped in a PopoverDisclosure component."
|
|
24
|
+
);
|
|
25
|
+
const C = e.useState((l) => t || l.placement).split("-")[0], c = yt[C], a = ie(
|
|
26
|
+
() => /* @__PURE__ */ v(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
display: "block",
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round",
|
|
34
|
+
strokeWidth: 1.5,
|
|
35
|
+
viewBox: "0 0 16 16",
|
|
36
|
+
height: "1em",
|
|
37
|
+
width: "1em",
|
|
38
|
+
children: /* @__PURE__ */ v("polyline", { points: c })
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
[c]
|
|
42
|
+
);
|
|
43
|
+
return s = O(S({
|
|
44
|
+
children: a,
|
|
45
|
+
"aria-hidden": !0
|
|
46
|
+
}, s), {
|
|
47
|
+
style: S({
|
|
48
|
+
width: "1em",
|
|
49
|
+
height: "1em",
|
|
50
|
+
pointerEvents: "none"
|
|
51
|
+
}, s.style)
|
|
52
|
+
}), nt(s);
|
|
53
|
+
});
|
|
54
|
+
F(
|
|
55
|
+
function(n) {
|
|
56
|
+
const o = xe(n);
|
|
57
|
+
return H(wt, o);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
function Ct(r = {}) {
|
|
61
|
+
var n = r, {
|
|
62
|
+
combobox: o
|
|
63
|
+
} = n, e = rt(n, [
|
|
64
|
+
"combobox"
|
|
65
|
+
]);
|
|
66
|
+
const t = He(
|
|
67
|
+
e.store,
|
|
68
|
+
je(o, [
|
|
69
|
+
"value",
|
|
70
|
+
"items",
|
|
71
|
+
"renderedItems",
|
|
72
|
+
"baseElement",
|
|
73
|
+
"arrowElement",
|
|
74
|
+
"anchorElement",
|
|
75
|
+
"contentElement",
|
|
76
|
+
"popoverElement",
|
|
77
|
+
"disclosureElement"
|
|
78
|
+
])
|
|
79
|
+
);
|
|
80
|
+
$e(e, t);
|
|
81
|
+
const s = t.getState(), p = De(J(k({}, e), {
|
|
82
|
+
store: t,
|
|
83
|
+
virtualFocus: E(
|
|
84
|
+
e.virtualFocus,
|
|
85
|
+
s.virtualFocus,
|
|
86
|
+
!0
|
|
87
|
+
),
|
|
88
|
+
includesBaseElement: E(
|
|
89
|
+
e.includesBaseElement,
|
|
90
|
+
s.includesBaseElement,
|
|
91
|
+
!1
|
|
92
|
+
),
|
|
93
|
+
activeId: E(
|
|
94
|
+
e.activeId,
|
|
95
|
+
s.activeId,
|
|
96
|
+
e.defaultActiveId,
|
|
97
|
+
null
|
|
98
|
+
),
|
|
99
|
+
orientation: E(
|
|
100
|
+
e.orientation,
|
|
101
|
+
s.orientation,
|
|
102
|
+
"vertical"
|
|
103
|
+
)
|
|
104
|
+
})), m = ke(J(k({}, e), {
|
|
105
|
+
store: t,
|
|
106
|
+
placement: E(
|
|
107
|
+
e.placement,
|
|
108
|
+
s.placement,
|
|
109
|
+
"bottom-start"
|
|
110
|
+
)
|
|
111
|
+
})), C = new String(""), c = J(k(k({}, p.getState()), m.getState()), {
|
|
112
|
+
value: E(
|
|
113
|
+
e.value,
|
|
114
|
+
s.value,
|
|
115
|
+
e.defaultValue,
|
|
116
|
+
C
|
|
117
|
+
),
|
|
118
|
+
setValueOnMove: E(
|
|
119
|
+
e.setValueOnMove,
|
|
120
|
+
s.setValueOnMove,
|
|
121
|
+
!1
|
|
122
|
+
),
|
|
123
|
+
labelElement: E(s.labelElement, null),
|
|
124
|
+
selectElement: E(s.selectElement, null),
|
|
125
|
+
listElement: E(s.listElement, null)
|
|
126
|
+
}), a = ze(c, p, m, t);
|
|
127
|
+
return G(
|
|
128
|
+
a,
|
|
129
|
+
() => re(a, ["value", "items"], (l) => {
|
|
130
|
+
if (l.value !== C || !l.items.length) return;
|
|
131
|
+
const b = l.items.find(
|
|
132
|
+
(h) => !h.disabled && h.value != null
|
|
133
|
+
);
|
|
134
|
+
(b == null ? void 0 : b.value) != null && a.setState("value", b.value);
|
|
135
|
+
})
|
|
136
|
+
), G(
|
|
137
|
+
a,
|
|
138
|
+
() => re(a, ["mounted"], (l) => {
|
|
139
|
+
l.mounted || a.setState("activeId", c.activeId);
|
|
140
|
+
})
|
|
141
|
+
), G(
|
|
142
|
+
a,
|
|
143
|
+
() => re(a, ["mounted", "items", "value"], (l) => {
|
|
144
|
+
if (o || l.mounted) return;
|
|
145
|
+
const b = ge(l.value), h = b[b.length - 1];
|
|
146
|
+
if (h == null) return;
|
|
147
|
+
const w = l.items.find(
|
|
148
|
+
(P) => !P.disabled && P.value === h
|
|
149
|
+
);
|
|
150
|
+
w && a.setState("activeId", w.id);
|
|
151
|
+
})
|
|
152
|
+
), G(
|
|
153
|
+
a,
|
|
154
|
+
() => qe(a, ["setValueOnMove", "moves"], (l) => {
|
|
155
|
+
const { mounted: b, value: h, activeId: w } = a.getState();
|
|
156
|
+
if (!l.setValueOnMove && b || Array.isArray(h) || !l.moves || !w) return;
|
|
157
|
+
const P = p.item(w);
|
|
158
|
+
!P || P.disabled || P.value == null || a.setState("value", P.value);
|
|
159
|
+
})
|
|
160
|
+
), J(k(k(k({}, p), m), a), {
|
|
161
|
+
combobox: o,
|
|
162
|
+
setValue: (l) => a.setState("value", l),
|
|
163
|
+
setLabelElement: (l) => a.setState("labelElement", l),
|
|
164
|
+
setSelectElement: (l) => a.setState("selectElement", l),
|
|
165
|
+
setListElement: (l) => a.setState("listElement", l)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function xt(r) {
|
|
169
|
+
const n = Ve();
|
|
170
|
+
return r = O(S({}, r), {
|
|
171
|
+
combobox: r.combobox !== void 0 ? r.combobox : n
|
|
172
|
+
}), Ne(r);
|
|
173
|
+
}
|
|
174
|
+
function Et(r, n, o) {
|
|
175
|
+
return lt(n, [o.combobox]), fe(r, o, "value", "setValue"), fe(r, o, "setValueOnMove"), Object.assign(
|
|
176
|
+
Ke(
|
|
177
|
+
Me(r, n, o),
|
|
178
|
+
n,
|
|
179
|
+
o
|
|
180
|
+
),
|
|
181
|
+
{ combobox: o.combobox }
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
function _t(r = {}) {
|
|
185
|
+
r = xt(r);
|
|
186
|
+
const [n, o] = Ue(Ct, r);
|
|
187
|
+
return Et(n, o, r);
|
|
188
|
+
}
|
|
189
|
+
var Ot = "span", It = T(
|
|
190
|
+
function(n) {
|
|
191
|
+
var o = n, { store: e } = o, t = B(o, ["store"]);
|
|
192
|
+
const s = ce();
|
|
193
|
+
return e = e || s, t = xe(S({ store: e }, t)), t;
|
|
194
|
+
}
|
|
195
|
+
), At = F(function(n) {
|
|
196
|
+
const o = It(n);
|
|
197
|
+
return H(Ot, o);
|
|
198
|
+
}), Dt = "button";
|
|
199
|
+
function kt(r) {
|
|
200
|
+
return Array.from(r.selectedOptions).map((n) => n.value);
|
|
201
|
+
}
|
|
202
|
+
function Q(r, n) {
|
|
203
|
+
return () => {
|
|
204
|
+
const o = n();
|
|
205
|
+
if (!o) return;
|
|
206
|
+
let e = 0, t = r.item(o);
|
|
207
|
+
const s = t;
|
|
208
|
+
for (; t && t.value == null; ) {
|
|
209
|
+
const p = n(++e);
|
|
210
|
+
if (!p) return;
|
|
211
|
+
if (t = r.item(p), t === s) break;
|
|
212
|
+
}
|
|
213
|
+
return t == null ? void 0 : t.id;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
var Vt = T(function(n) {
|
|
217
|
+
var o = n, {
|
|
218
|
+
store: e,
|
|
219
|
+
name: t,
|
|
220
|
+
form: s,
|
|
221
|
+
required: p,
|
|
222
|
+
showOnKeyDown: m = !0,
|
|
223
|
+
moveOnKeyDown: C = !0,
|
|
224
|
+
toggleOnPress: c = !0,
|
|
225
|
+
toggleOnClick: a = c
|
|
226
|
+
} = o, l = B(o, [
|
|
227
|
+
"store",
|
|
228
|
+
"name",
|
|
229
|
+
"form",
|
|
230
|
+
"required",
|
|
231
|
+
"showOnKeyDown",
|
|
232
|
+
"moveOnKeyDown",
|
|
233
|
+
"toggleOnPress",
|
|
234
|
+
"toggleOnClick"
|
|
235
|
+
]);
|
|
236
|
+
const b = ue();
|
|
237
|
+
e = e || b, Z(
|
|
238
|
+
e,
|
|
239
|
+
process.env.NODE_ENV !== "production" && "Select must receive a `store` prop or be wrapped in a SelectProvider component."
|
|
240
|
+
);
|
|
241
|
+
const h = l.onKeyDown, w = V(m), P = V(C), y = e.useState("placement").split("-")[0], x = e.useState("value"), A = Array.isArray(x), K = se((u) => {
|
|
242
|
+
var d;
|
|
243
|
+
if (h == null || h(u), u.defaultPrevented || !e) return;
|
|
244
|
+
const { orientation: te, items: oe, activeId: q } = e.getState(), U = te !== "horizontal", W = te !== "vertical", f = !!((d = oe.find((pe) => !pe.disabled && pe.value != null)) != null && d.rowId), de = {
|
|
245
|
+
ArrowUp: (f || U) && Q(e, e.up),
|
|
246
|
+
ArrowRight: (f || W) && Q(e, e.next),
|
|
247
|
+
ArrowDown: (f || U) && Q(e, e.down),
|
|
248
|
+
ArrowLeft: (f || W) && Q(e, e.previous)
|
|
249
|
+
}[u.key];
|
|
250
|
+
de && P(u) && (u.preventDefault(), e.move(de()));
|
|
251
|
+
const me = y === "top" || y === "bottom";
|
|
252
|
+
({
|
|
253
|
+
ArrowDown: me,
|
|
254
|
+
ArrowUp: me,
|
|
255
|
+
ArrowLeft: y === "left",
|
|
256
|
+
ArrowRight: y === "right"
|
|
257
|
+
})[u.key] && w(u) && (u.preventDefault(), e.move(q), st(u.currentTarget, "keyup", e.show));
|
|
258
|
+
});
|
|
259
|
+
l = Y(
|
|
260
|
+
l,
|
|
261
|
+
(u) => /* @__PURE__ */ v(Ce, { value: e, children: u }),
|
|
262
|
+
[e]
|
|
263
|
+
);
|
|
264
|
+
const [j, M] = X(!1), _ = St(!1);
|
|
265
|
+
le(() => {
|
|
266
|
+
const u = _.current;
|
|
267
|
+
_.current = !1, !u && M(!1);
|
|
268
|
+
}, [x]);
|
|
269
|
+
const L = e.useState((u) => {
|
|
270
|
+
var d;
|
|
271
|
+
return (d = u.labelElement) == null ? void 0 : d.id;
|
|
272
|
+
}), i = l["aria-label"], g = l["aria-labelledby"] || L, D = e.useState((u) => {
|
|
273
|
+
if (t)
|
|
274
|
+
return u.items;
|
|
275
|
+
}), I = ie(() => [...new Set(D == null ? void 0 : D.map((u) => u.value).filter((u) => u != null))], [D]);
|
|
276
|
+
l = Y(
|
|
277
|
+
l,
|
|
278
|
+
(u) => t ? /* @__PURE__ */ R(ve, { children: [
|
|
279
|
+
/* @__PURE__ */ R(
|
|
280
|
+
"select",
|
|
281
|
+
{
|
|
282
|
+
style: {
|
|
283
|
+
border: 0,
|
|
284
|
+
clip: "rect(0 0 0 0)",
|
|
285
|
+
height: "1px",
|
|
286
|
+
margin: "-1px",
|
|
287
|
+
overflow: "hidden",
|
|
288
|
+
padding: 0,
|
|
289
|
+
position: "absolute",
|
|
290
|
+
whiteSpace: "nowrap",
|
|
291
|
+
width: "1px"
|
|
292
|
+
},
|
|
293
|
+
tabIndex: -1,
|
|
294
|
+
"aria-hidden": !0,
|
|
295
|
+
"aria-label": i,
|
|
296
|
+
"aria-labelledby": g,
|
|
297
|
+
name: t,
|
|
298
|
+
form: s,
|
|
299
|
+
required: p,
|
|
300
|
+
disabled: l.disabled,
|
|
301
|
+
value: x,
|
|
302
|
+
multiple: A,
|
|
303
|
+
onFocus: () => {
|
|
304
|
+
var d;
|
|
305
|
+
return (d = e == null ? void 0 : e.getState().selectElement) == null ? void 0 : d.focus();
|
|
306
|
+
},
|
|
307
|
+
onChange: (d) => {
|
|
308
|
+
_.current = !0, M(!0), e == null || e.setValue(
|
|
309
|
+
A ? kt(d.target) : d.target.value
|
|
310
|
+
);
|
|
311
|
+
},
|
|
312
|
+
children: [
|
|
313
|
+
ge(x).map((d) => d == null || I.includes(d) ? null : /* @__PURE__ */ v("option", { value: d, children: d }, d)),
|
|
314
|
+
I.map((d) => /* @__PURE__ */ v("option", { value: d, children: d }, d))
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
u
|
|
319
|
+
] }) : u,
|
|
320
|
+
[
|
|
321
|
+
e,
|
|
322
|
+
i,
|
|
323
|
+
g,
|
|
324
|
+
t,
|
|
325
|
+
s,
|
|
326
|
+
p,
|
|
327
|
+
x,
|
|
328
|
+
A,
|
|
329
|
+
I,
|
|
330
|
+
l.disabled
|
|
331
|
+
]
|
|
332
|
+
);
|
|
333
|
+
const z = /* @__PURE__ */ R(ve, { children: [
|
|
334
|
+
x,
|
|
335
|
+
/* @__PURE__ */ v(At, {})
|
|
336
|
+
] }), ee = e.useState("contentElement");
|
|
337
|
+
return l = O(S({
|
|
338
|
+
role: "combobox",
|
|
339
|
+
"aria-autocomplete": "none",
|
|
340
|
+
"aria-labelledby": L,
|
|
341
|
+
"aria-haspopup": at(ee, "listbox"),
|
|
342
|
+
"data-autofill": j || void 0,
|
|
343
|
+
"data-name": t,
|
|
344
|
+
children: z
|
|
345
|
+
}, l), {
|
|
346
|
+
ref: we(e.setSelectElement, l.ref),
|
|
347
|
+
onKeyDown: K
|
|
348
|
+
}), l = Le(S({ store: e, toggleOnClick: a }, l)), l = Pe(S({ store: e }, l)), l;
|
|
349
|
+
}), Nt = F(function(n) {
|
|
350
|
+
const o = Vt(n);
|
|
351
|
+
return H(Dt, o);
|
|
352
|
+
});
|
|
353
|
+
function Kt(r = {}) {
|
|
354
|
+
const n = _t(r);
|
|
355
|
+
return /* @__PURE__ */ v(gt, { value: n, children: r.children });
|
|
356
|
+
}
|
|
357
|
+
var Mt = "div";
|
|
358
|
+
function Lt(r, n) {
|
|
359
|
+
if (n != null)
|
|
360
|
+
return r == null ? !1 : Array.isArray(r) ? r.includes(n) : r === n;
|
|
361
|
+
}
|
|
362
|
+
var Rt = T(
|
|
363
|
+
function(n) {
|
|
364
|
+
var o = n, {
|
|
365
|
+
store: e,
|
|
366
|
+
value: t,
|
|
367
|
+
getItem: s,
|
|
368
|
+
hideOnClick: p,
|
|
369
|
+
setValueOnClick: m = t != null,
|
|
370
|
+
preventScrollOnKeyDown: C = !0,
|
|
371
|
+
focusOnHover: c = !0
|
|
372
|
+
} = o, a = B(o, [
|
|
373
|
+
"store",
|
|
374
|
+
"value",
|
|
375
|
+
"getItem",
|
|
376
|
+
"hideOnClick",
|
|
377
|
+
"setValueOnClick",
|
|
378
|
+
"preventScrollOnKeyDown",
|
|
379
|
+
"focusOnHover"
|
|
380
|
+
]), l;
|
|
381
|
+
const b = ht();
|
|
382
|
+
e = e || b, Z(
|
|
383
|
+
e,
|
|
384
|
+
process.env.NODE_ENV !== "production" && "SelectItem must be wrapped in a SelectList or SelectPopover component."
|
|
385
|
+
);
|
|
386
|
+
const h = ye(a.id), w = ct(a), { listElement: P, multiSelectable: N, selected: y, autoFocus: x } = We(e, {
|
|
387
|
+
listElement: "listElement",
|
|
388
|
+
multiSelectable(i) {
|
|
389
|
+
return Array.isArray(i.value);
|
|
390
|
+
},
|
|
391
|
+
selected(i) {
|
|
392
|
+
return Lt(i.value, t);
|
|
393
|
+
},
|
|
394
|
+
autoFocus(i) {
|
|
395
|
+
return t == null || i.value == null || i.activeId !== h && (e != null && e.item(i.activeId)) ? !1 : Array.isArray(i.value) ? i.value[i.value.length - 1] === t : i.value === t;
|
|
396
|
+
}
|
|
397
|
+
}), A = bt(
|
|
398
|
+
(i) => {
|
|
399
|
+
const g = O(S({}, i), {
|
|
400
|
+
value: w ? void 0 : t,
|
|
401
|
+
children: t
|
|
402
|
+
});
|
|
403
|
+
return s ? s(g) : g;
|
|
404
|
+
},
|
|
405
|
+
[w, t, s]
|
|
406
|
+
);
|
|
407
|
+
p = p ?? (t != null && !N);
|
|
408
|
+
const K = a.onClick, j = V(m), M = V(p), _ = se((i) => {
|
|
409
|
+
K == null || K(i), !i.defaultPrevented && (dt(i) || mt(i) || (j(i) && t != null && (e == null || e.setValue((g) => Array.isArray(g) ? g.includes(t) ? g.filter((D) => D !== t) : [...g, t] : t)), M(i) && (e == null || e.hide())));
|
|
410
|
+
});
|
|
411
|
+
a = Y(
|
|
412
|
+
a,
|
|
413
|
+
(i) => /* @__PURE__ */ v(Pt.Provider, { value: y ?? !1, children: i }),
|
|
414
|
+
[y]
|
|
415
|
+
), a = O(S({
|
|
416
|
+
id: h,
|
|
417
|
+
role: ut(P),
|
|
418
|
+
"aria-selected": y,
|
|
419
|
+
children: t
|
|
420
|
+
}, a), {
|
|
421
|
+
autoFocus: (l = a.autoFocus) != null ? l : x,
|
|
422
|
+
onClick: _
|
|
423
|
+
}), a = Ge(S({
|
|
424
|
+
store: e,
|
|
425
|
+
getItem: A,
|
|
426
|
+
preventScrollOnKeyDown: C
|
|
427
|
+
}, a));
|
|
428
|
+
const L = V(c);
|
|
429
|
+
return a = Je(O(S({
|
|
430
|
+
store: e
|
|
431
|
+
}, a), {
|
|
432
|
+
// We have to disable focusOnHover when the popup is closed, otherwise
|
|
433
|
+
// the active item will change to null (the container) when the popup is
|
|
434
|
+
// closed by clicking on an item.
|
|
435
|
+
focusOnHover(i) {
|
|
436
|
+
if (!L(i)) return !1;
|
|
437
|
+
const g = e == null ? void 0 : e.getState();
|
|
438
|
+
return !!(g != null && g.open);
|
|
439
|
+
}
|
|
440
|
+
})), a;
|
|
441
|
+
}
|
|
442
|
+
), Tt = it(
|
|
443
|
+
F(function(n) {
|
|
444
|
+
const o = Rt(n);
|
|
445
|
+
return H(Mt, o);
|
|
446
|
+
})
|
|
447
|
+
), Bt = "div", he = ae(null), Ee = T(
|
|
448
|
+
function(n) {
|
|
449
|
+
var o = n, {
|
|
450
|
+
store: e,
|
|
451
|
+
resetOnEscape: t = !0,
|
|
452
|
+
hideOnEnter: s = !0,
|
|
453
|
+
focusOnMove: p = !0,
|
|
454
|
+
composite: m,
|
|
455
|
+
alwaysVisible: C
|
|
456
|
+
} = o, c = B(o, [
|
|
457
|
+
"store",
|
|
458
|
+
"resetOnEscape",
|
|
459
|
+
"hideOnEnter",
|
|
460
|
+
"focusOnMove",
|
|
461
|
+
"composite",
|
|
462
|
+
"alwaysVisible"
|
|
463
|
+
]);
|
|
464
|
+
const a = ce();
|
|
465
|
+
e = e || a, Z(
|
|
466
|
+
e,
|
|
467
|
+
process.env.NODE_ENV !== "production" && "SelectList must receive a `store` prop or be wrapped in a SelectProvider component."
|
|
468
|
+
);
|
|
469
|
+
const l = ye(c.id), b = e.useState("value"), h = Array.isArray(b), [w, P] = X(b), N = e.useState("mounted");
|
|
470
|
+
le(() => {
|
|
471
|
+
N || P(b);
|
|
472
|
+
}, [N, b]), t = t && !h;
|
|
473
|
+
const y = c.onKeyDown, x = V(t), A = V(s), K = se((f) => {
|
|
474
|
+
y == null || y(f), !f.defaultPrevented && (f.key === "Escape" && x(f) && (e == null || e.setValue(w)), (f.key === " " || f.key === "Enter") && pt(f) && A(f) && (f.preventDefault(), e == null || e.hide()));
|
|
475
|
+
}), j = Se(be), M = X(), [_, L] = j || M, i = ie(
|
|
476
|
+
() => [_, L],
|
|
477
|
+
[_]
|
|
478
|
+
), [g, D] = X(null), I = Se(he);
|
|
479
|
+
le(() => {
|
|
480
|
+
if (I)
|
|
481
|
+
return I(e), () => I(null);
|
|
482
|
+
}, [I, e]), c = Y(
|
|
483
|
+
c,
|
|
484
|
+
(f) => /* @__PURE__ */ v(Ce, { value: e, children: /* @__PURE__ */ v(he.Provider, { value: D, children: /* @__PURE__ */ v(be.Provider, { value: i, children: f }) }) }),
|
|
485
|
+
[e, i]
|
|
486
|
+
);
|
|
487
|
+
const z = !!e.combobox;
|
|
488
|
+
m = m ?? (!z && g !== e);
|
|
489
|
+
const [ee, u] = vt(
|
|
490
|
+
m ? e.setListElement : null
|
|
491
|
+
), d = ft(ee, "role", c.role), oe = (m || (d === "listbox" || d === "menu" || d === "tree" || d === "grid")) && h || void 0, q = Re(N, c.hidden, C), U = q ? O(S({}, c.style), { display: "none" }) : c.style;
|
|
492
|
+
m && (c = S({
|
|
493
|
+
role: "listbox",
|
|
494
|
+
"aria-multiselectable": oe
|
|
495
|
+
}, c));
|
|
496
|
+
const W = e.useState(
|
|
497
|
+
(f) => {
|
|
498
|
+
var ne;
|
|
499
|
+
return _ || ((ne = f.labelElement) == null ? void 0 : ne.id);
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
return c = O(S({
|
|
503
|
+
id: l,
|
|
504
|
+
"aria-labelledby": W,
|
|
505
|
+
hidden: q
|
|
506
|
+
}, c), {
|
|
507
|
+
ref: we(u, c.ref),
|
|
508
|
+
style: U,
|
|
509
|
+
onKeyDown: K
|
|
510
|
+
}), c = Te(O(S({ store: e }, c), { composite: m })), c = Pe(S({ store: e, typeahead: !z }, c)), c;
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
F(function(n) {
|
|
514
|
+
const o = Ee(n);
|
|
515
|
+
return H(Bt, o);
|
|
516
|
+
});
|
|
517
|
+
var Ft = "div", Ht = T(
|
|
518
|
+
function(n) {
|
|
519
|
+
var o = n, { store: e, alwaysVisible: t } = o, s = B(o, ["store", "alwaysVisible"]);
|
|
520
|
+
const p = ue();
|
|
521
|
+
return e = e || p, s = Ee(S({ store: e, alwaysVisible: t }, s)), s = Fe(S({ store: e, alwaysVisible: t }, s)), s;
|
|
522
|
+
}
|
|
523
|
+
), jt = Be(
|
|
524
|
+
F(function(n) {
|
|
525
|
+
const o = Ht(n);
|
|
526
|
+
return H(Ft, o);
|
|
527
|
+
}),
|
|
528
|
+
ue
|
|
529
|
+
);
|
|
530
|
+
function $t({
|
|
531
|
+
store: r,
|
|
532
|
+
fallback: n,
|
|
533
|
+
children: o
|
|
534
|
+
} = {}) {
|
|
535
|
+
const e = ce();
|
|
536
|
+
r = r || e;
|
|
537
|
+
const t = Qe(r, (s) => s != null && s.value.length ? s.value : n);
|
|
538
|
+
return o ? o(t || "") : t;
|
|
539
|
+
}
|
|
540
|
+
const no = (r) => {
|
|
541
|
+
const { baseProps: n, controlProps: o } = Ie(r, {
|
|
542
|
+
className: "component-select-control"
|
|
543
|
+
}), {
|
|
544
|
+
options: e,
|
|
545
|
+
placeholder: t = "Choose an option...",
|
|
546
|
+
...s
|
|
547
|
+
} = o, p = (e || []).map(Ae);
|
|
548
|
+
return /* @__PURE__ */ v(Kt, { children: /* @__PURE__ */ R(Oe, { ...n, children: [
|
|
549
|
+
/* @__PURE__ */ R(
|
|
550
|
+
Nt,
|
|
551
|
+
{
|
|
552
|
+
className: "component-select-control__input",
|
|
553
|
+
...s,
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ v("div", { className: "component-select-control__value", children: /* @__PURE__ */ v($t, { fallback: t }) }),
|
|
556
|
+
/* @__PURE__ */ v("div", { className: "component-select-control__caret", children: /* @__PURE__ */ v(_e, {}) })
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
/* @__PURE__ */ v(
|
|
561
|
+
jt,
|
|
562
|
+
{
|
|
563
|
+
className: "component-select-control__popover",
|
|
564
|
+
wrapperProps: {
|
|
565
|
+
className: "component-select-control__popover__wrapper"
|
|
566
|
+
},
|
|
567
|
+
fitViewport: !0,
|
|
568
|
+
flip: !1,
|
|
569
|
+
gutter: 0,
|
|
570
|
+
overflowPadding: 4,
|
|
571
|
+
shift: -1,
|
|
572
|
+
children: p.map((m) => /* @__PURE__ */ R(
|
|
573
|
+
Tt,
|
|
574
|
+
{
|
|
575
|
+
disabled: m.disabled,
|
|
576
|
+
value: m.value,
|
|
577
|
+
className: "component-select-control__option",
|
|
578
|
+
children: [
|
|
579
|
+
/* @__PURE__ */ v("div", { className: "component-select-control__option__label", children: m.label }),
|
|
580
|
+
m.description && /* @__PURE__ */ v("div", { className: "component-select-control__option__description", children: m.description })
|
|
581
|
+
]
|
|
582
|
+
},
|
|
583
|
+
m.value
|
|
584
|
+
))
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
] }) });
|
|
588
|
+
};
|
|
589
|
+
export {
|
|
590
|
+
no as SelectControl
|
|
591
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Option = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
description?: string;
|
|
6
|
+
};
|
|
7
|
+
export type PartialOption = Partial<Option> & {
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
export type Optionable = Option | PartialOption | string;
|
|
11
|
+
export declare function normalizeOption(opt: Optionable): Option;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { BaseControl as s } from "../base-control/index.js";
|
|
3
|
+
import { useBaseControlProps as e } from "../base-control/props.js";
|
|
4
|
+
const l = (r) => {
|
|
5
|
+
const { baseProps: t, controlProps: n } = e(r, {
|
|
6
|
+
className: "component-text-control"
|
|
7
|
+
});
|
|
8
|
+
return /* @__PURE__ */ o(s, { ...t, children: /* @__PURE__ */ o("input", { ...n }) });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
l as TextControl
|
|
12
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { ControlFC } from '../base-control/props';
|
|
3
|
+
interface TextareaControlProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
|
+
}
|
|
5
|
+
export declare const TextareaControl: ControlFC<TextareaControlProps>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { BaseControl as a } from "../base-control/index.js";
|
|
3
|
+
import { useBaseControlProps as n } from "../base-control/props.js";
|
|
4
|
+
import '../../../assets/index4.css';const p = (r) => {
|
|
5
|
+
const { baseProps: t, controlProps: e } = n(r, {
|
|
6
|
+
className: "component-textarea-control"
|
|
7
|
+
});
|
|
8
|
+
return /* @__PURE__ */ o(a, { ...t, children: /* @__PURE__ */ o(
|
|
9
|
+
"textarea",
|
|
10
|
+
{
|
|
11
|
+
className: "component-textarea-control__input",
|
|
12
|
+
...e
|
|
13
|
+
}
|
|
14
|
+
) });
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
p as TextareaControl
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { ControlFC } from '../base-control/props';
|
|
3
|
+
interface ToggleControlProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
4
|
+
onLabel?: string;
|
|
5
|
+
offLabel?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ToggleControl: ControlFC<ToggleControlProps>;
|
|
8
|
+
export {};
|