@sylwellsoftware/fray 0.5.0 → 0.6.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/README.md +34 -27
- package/colors/README.md +28 -13
- package/colors/gray/colors.css +54 -26
- package/colors/green/colors.css +54 -26
- package/colors/iceblue/colors.css +54 -26
- package/colors/ocean/colors.css +54 -26
- package/colors/orange/colors.css +54 -26
- package/colors/purple/colors.css +54 -26
- package/colors/red/colors.css +54 -26
- package/colors/yellow/colors.css +54 -26
- package/dist/Components/data/descriptionList.d.ts.map +1 -1
- package/dist/Components/data/listview/listview.d.ts.map +1 -1
- package/dist/Components/data/table/DataTable.d.ts.map +1 -1
- package/dist/Components/data/table/FilterPanel.d.ts.map +1 -1
- package/dist/Components/data/table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Components/data/treeview/treeview.d.ts.map +1 -1
- package/dist/Components/dialog/dialog.d.ts.map +1 -1
- package/dist/Components/layout/panel.d.ts +0 -1
- package/dist/Components/layout/panel.d.ts.map +1 -1
- package/dist/Components/layout/sidebar.d.ts +0 -1
- package/dist/Components/layout/sidebar.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tabline.d.ts.map +1 -1
- package/dist/Components/layout/tabpanel/tabpanel.d.ts.map +1 -1
- package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Components/lineinputs/dropdown.d.ts.map +1 -1
- package/dist/Components/lineinputs/textbox.d.ts.map +1 -1
- package/dist/Components/lineinputs/toggle.d.ts.map +1 -1
- package/dist/Components/menu/toolbar.d.ts +0 -1
- package/dist/Components/menu/toolbar.d.ts.map +1 -1
- package/dist/Components/status/progressBar.d.ts.map +1 -1
- package/dist/Components/theme/stylesheetPicker.d.ts.map +1 -1
- package/dist/index.js +1214 -1409
- package/dist/index.js.map +1 -1
- package/dist/{jsx-dev-runtime-pzseD2Sz.js → jsx-dev-runtime-CqunwZ8j.js} +404 -486
- package/dist/jsx-dev-runtime-CqunwZ8j.js.map +1 -0
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/styling/baseStyleDefinitions.d.ts +0 -82
- package/dist/styling/baseStyleDefinitions.d.ts.map +1 -1
- package/dist/styling/theme.d.ts +3 -3
- package/dist/styling/theme.d.ts.map +1 -1
- package/package.json +3 -3
- package/styles/structural.css +72 -413
- package/themes/README.md +68 -66
- package/themes/dark.css +48 -1
- package/themes/java/theme.css +410 -135
- package/themes/light.css +48 -1
- package/themes/minimal/theme.css +408 -125
- package/themes/shiny/theme.css +484 -294
- package/dist/jsx-dev-runtime-pzseD2Sz.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Ye = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { C as
|
|
5
|
-
import { F as
|
|
6
|
-
import { Emitter as
|
|
7
|
-
class
|
|
2
|
+
var Xe = (t, r, e) => r in t ? Ye(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
+
var o = (t, r, e) => Xe(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { C as y, j as u, c as S, a as w, i as ie } from "./jsx-dev-runtime-CqunwZ8j.js";
|
|
5
|
+
import { F as br, b as gr, S as yr, d as wr, e as Er, f as Sr, g as Ir, h as kr, k as xr, l as vr, m as Tr, n as Rr, p as Nr, s as $r } from "./jsx-dev-runtime-CqunwZ8j.js";
|
|
6
|
+
import { Emitter as x, DerivedEmitter as ae, FetchState as k, QueryArg as ve, LiveQuery as Ze, RestQueryHandler as et } from "@sylwellsoftware/glue";
|
|
7
|
+
class qe extends y {
|
|
8
8
|
render() {
|
|
9
9
|
return this.props.children ?? [];
|
|
10
10
|
}
|
|
@@ -19,27 +19,30 @@ const b = {
|
|
|
19
19
|
/** Neutral mode: Does not affect the inclusion or exclusion of items. */
|
|
20
20
|
Neutral: "neutral"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function le(t) {
|
|
23
23
|
return Object.values(b).some((r) => r === t);
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
function
|
|
27
|
-
return r != null && String(r).length > 0 ? String(r) : `fray-${t}-${
|
|
25
|
+
let tt = 1;
|
|
26
|
+
function F(t, r) {
|
|
27
|
+
return r != null && String(r).length > 0 ? String(r) : `fray-${t}-${tt++}`;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function z(t, r, e, i) {
|
|
30
30
|
if (r.valueEmitter != null)
|
|
31
|
-
return
|
|
32
|
-
const
|
|
33
|
-
return new
|
|
31
|
+
return rt(r.valueEmitter, "valueEmitter"), r.valueEmitter;
|
|
32
|
+
const s = r.defaultValue ?? r.value ?? r.initialValue ?? e, n = { owner: t, purpose: i };
|
|
33
|
+
return new x(s, n);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function rt(t, r = "emitter") {
|
|
36
36
|
if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "get") != "function" || typeof Reflect.get(t, "set") != "function" || typeof Reflect.get(t, "subscribe") != "function")
|
|
37
37
|
throw new TypeError(`${r} must be an emitter`);
|
|
38
38
|
}
|
|
39
|
+
function R(...t) {
|
|
40
|
+
return t.flatMap((r) => typeof r == "string" ? r.split(/\s+/) : []).filter(Boolean).join(" ");
|
|
41
|
+
}
|
|
39
42
|
function E(t) {
|
|
40
43
|
return t.className ?? t.class ?? "";
|
|
41
44
|
}
|
|
42
|
-
function
|
|
45
|
+
function K(t, ...r) {
|
|
43
46
|
if (t != null) {
|
|
44
47
|
if (typeof t != "function") throw new TypeError("Control callback must be a function");
|
|
45
48
|
t(...r);
|
|
@@ -48,54 +51,53 @@ function C(t, ...r) {
|
|
|
48
51
|
function fe(t, r = "options") {
|
|
49
52
|
if (!Array.isArray(t)) throw new TypeError(`${r} must be an array`);
|
|
50
53
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
54
|
+
function it(t) {
|
|
55
|
+
return le(t) ? t : String(t);
|
|
53
56
|
}
|
|
54
|
-
class
|
|
57
|
+
class V extends y {
|
|
55
58
|
constructor(e = {}) {
|
|
56
59
|
var n;
|
|
57
60
|
super(e);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
61
|
+
o(this, "valueEmitter");
|
|
62
|
+
o(this, "activeTabEmitter");
|
|
63
|
+
const i = e.tabs ?? [];
|
|
64
|
+
Te(i);
|
|
65
|
+
const s = { ...e };
|
|
66
|
+
s.valueEmitter == null && e.activeTabEmitter != null && (s.valueEmitter = e.activeTabEmitter), s.defaultValue == null && e.initialActiveTabId != null && (s.defaultValue = e.initialActiveTabId), this.valueEmitter = z(
|
|
64
67
|
this,
|
|
65
|
-
|
|
66
|
-
((n =
|
|
68
|
+
s,
|
|
69
|
+
((n = i.find((a) => !a.disabled)) == null ? void 0 : n.id) ?? null,
|
|
67
70
|
"active tab"
|
|
68
71
|
), this.activeTabEmitter = this.valueEmitter;
|
|
69
72
|
}
|
|
70
73
|
initialize() {
|
|
71
74
|
this.watch(this.valueEmitter);
|
|
72
75
|
}
|
|
73
|
-
selectTab(e,
|
|
74
|
-
e == null || e.disabled || (this.valueEmitter.set(e.id, "tab selected"),
|
|
76
|
+
selectTab(e, i = null) {
|
|
77
|
+
e == null || e.disabled || (this.valueEmitter.set(e.id, "tab selected"), K(this.props.onChange, e.id, i));
|
|
75
78
|
}
|
|
76
79
|
render() {
|
|
77
|
-
const { tabs: e = [], label:
|
|
78
|
-
|
|
79
|
-
const n = this.valueEmitter.get(),
|
|
80
|
+
const { tabs: e = [], label: i = "Sections", baseId: s = "fray-tabs" } = this.props;
|
|
81
|
+
Te(e);
|
|
82
|
+
const n = this.valueEmitter.get(), a = this.Host;
|
|
80
83
|
return /* @__PURE__ */ u(
|
|
81
|
-
|
|
84
|
+
a,
|
|
82
85
|
{
|
|
83
86
|
role: "tablist",
|
|
84
87
|
className: E(this.props) || null,
|
|
85
|
-
"aria-label":
|
|
86
|
-
children: e.map((l,
|
|
88
|
+
"aria-label": i,
|
|
89
|
+
children: e.map((l, c) => /* @__PURE__ */ u(
|
|
87
90
|
"button",
|
|
88
91
|
{
|
|
89
|
-
id:
|
|
92
|
+
id: Le(s, l.id),
|
|
90
93
|
type: "button",
|
|
91
94
|
role: "tab",
|
|
92
95
|
disabled: !!l.disabled,
|
|
93
|
-
"data-part": "tab",
|
|
94
96
|
"aria-selected": Object.is(n, l.id) ? "true" : "false",
|
|
95
|
-
"aria-controls":
|
|
97
|
+
"aria-controls": Ve(s, l.id),
|
|
96
98
|
tabIndex: Object.is(n, l.id) ? 0 : -1,
|
|
97
99
|
onClick: (h) => this.selectTab(l, h),
|
|
98
|
-
onKeyDown: (h) => this.handleKeyDown(h,
|
|
100
|
+
onKeyDown: (h) => this.handleKeyDown(h, c, e),
|
|
99
101
|
children: l.label ?? String(l.id)
|
|
100
102
|
},
|
|
101
103
|
String(l.id)
|
|
@@ -103,59 +105,46 @@ class L extends g {
|
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
}
|
|
106
|
-
handleKeyDown(e,
|
|
107
|
-
const n =
|
|
108
|
+
handleKeyDown(e, i, s) {
|
|
109
|
+
const n = s.map((c, h) => ({ tab: c, tabIndex: h })).filter(({ tab: c }) => !c.disabled);
|
|
108
110
|
if (n.length === 0) return;
|
|
109
|
-
const
|
|
111
|
+
const a = Math.max(
|
|
110
112
|
0,
|
|
111
|
-
n.findIndex(({ tabIndex:
|
|
113
|
+
n.findIndex(({ tabIndex: c }) => c === i)
|
|
112
114
|
);
|
|
113
115
|
let l;
|
|
114
116
|
if (e.key === "ArrowRight" || e.key === "ArrowDown")
|
|
115
|
-
l = n[(
|
|
117
|
+
l = n[(a + 1) % n.length];
|
|
116
118
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
117
|
-
l = n[(
|
|
119
|
+
l = n[(a - 1 + n.length) % n.length];
|
|
118
120
|
else if (e.key === "Home") l = n[0];
|
|
119
121
|
else if (e.key === "End") l = n.at(-1);
|
|
120
122
|
else return;
|
|
121
123
|
if (l != null && (e.preventDefault(), this.selectTab(l.tab, e), this.dom instanceof Element)) {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
+
const c = this.dom.querySelectorAll('[role="tab"]')[l.tabIndex];
|
|
125
|
+
c == null || c.focus();
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
|
-
|
|
128
|
-
['& > [
|
|
129
|
-
]),
|
|
129
|
+
o(V, "hostName", "tab-line"), o(V, "standaloneHostName", "tab-line"), o(V, "baseStyles", [
|
|
130
|
+
['& > button[role="tab"]', ["uiline", "button"]]
|
|
131
|
+
]), o(V, "css", S`
|
|
130
132
|
& {
|
|
131
133
|
display: flex;
|
|
132
134
|
flex-flow: row wrap;
|
|
133
135
|
padding-top: 3px;
|
|
134
|
-
background: var(--fray-tabline-background, var(--tabline-bg));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
& > [data-part="tab"] {
|
|
138
|
-
background: var(--fray-tab-button-background, var(--fray-button-background));
|
|
139
|
-
border-radius: var(--fray-radius-md, var(--ui-border-radius)) var(--fray-radius-md, var(--ui-border-radius)) 0 0;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
& > [data-part="tab"][aria-selected="true"] {
|
|
143
|
-
background: var(
|
|
144
|
-
--fray-tab-button-background-active,
|
|
145
|
-
var(--fray-tab-active-background, var(--tab-bg-active))
|
|
146
|
-
);
|
|
147
136
|
}
|
|
148
137
|
`);
|
|
149
|
-
function qe(t, r) {
|
|
150
|
-
return `${t}-tab-${Ve(r)}`;
|
|
151
|
-
}
|
|
152
138
|
function Le(t, r) {
|
|
153
|
-
return `${t}-
|
|
139
|
+
return `${t}-tab-${Ue(r)}`;
|
|
154
140
|
}
|
|
155
|
-
function Ve(t) {
|
|
141
|
+
function Ve(t, r) {
|
|
142
|
+
return `${t}-panel-${Ue(r)}`;
|
|
143
|
+
}
|
|
144
|
+
function Ue(t) {
|
|
156
145
|
return encodeURIComponent(String(t)).replaceAll("%", "-");
|
|
157
146
|
}
|
|
158
|
-
function
|
|
147
|
+
function Te(t) {
|
|
159
148
|
if (!Array.isArray(t)) throw new TypeError("TabLine tabs must be an array");
|
|
160
149
|
const r = /* @__PURE__ */ new Set();
|
|
161
150
|
for (const e of t) {
|
|
@@ -164,44 +153,44 @@ function Ie(t) {
|
|
|
164
153
|
r.add(e.id);
|
|
165
154
|
}
|
|
166
155
|
}
|
|
167
|
-
class
|
|
156
|
+
class _ extends y {
|
|
168
157
|
constructor(e = {}) {
|
|
169
158
|
var n;
|
|
170
159
|
super(e);
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
160
|
+
o(this, "valueEmitter");
|
|
161
|
+
o(this, "activeTabEmitter");
|
|
162
|
+
o(this, "baseId");
|
|
163
|
+
const i = Y(e), s = { ...e };
|
|
164
|
+
s.valueEmitter == null && e.activeTabEmitter != null && (s.valueEmitter = e.activeTabEmitter), s.defaultValue == null && e.initialActiveTabId != null && (s.defaultValue = e.initialActiveTabId), this.valueEmitter = z(
|
|
176
165
|
this,
|
|
177
|
-
|
|
178
|
-
((n =
|
|
166
|
+
s,
|
|
167
|
+
((n = i.find((a) => !a.disabled)) == null ? void 0 : n.id) ?? null,
|
|
179
168
|
"active tab"
|
|
180
|
-
), this.activeTabEmitter = this.valueEmitter, this.baseId =
|
|
169
|
+
), this.activeTabEmitter = this.valueEmitter, this.baseId = F("tabs", e.id);
|
|
181
170
|
}
|
|
182
171
|
initialize() {
|
|
183
|
-
var
|
|
172
|
+
var i;
|
|
184
173
|
const e = Y(this.props);
|
|
185
|
-
e.some(({ id:
|
|
174
|
+
e.some(({ id: s }) => Object.is(s, this.valueEmitter.get())) || this.valueEmitter.set(((i = e.find((s) => !s.disabled)) == null ? void 0 : i.id) ?? null), this.watch(this.valueEmitter);
|
|
186
175
|
}
|
|
187
176
|
setProps(e) {
|
|
188
|
-
var
|
|
177
|
+
var s;
|
|
189
178
|
super.setProps(e);
|
|
190
|
-
const
|
|
191
|
-
return
|
|
179
|
+
const i = Y(e);
|
|
180
|
+
return i.some(({ id: n }) => Object.is(n, this.valueEmitter.get())) || this.valueEmitter.set(((s = i.find((n) => !n.disabled)) == null ? void 0 : s.id) ?? null), this;
|
|
192
181
|
}
|
|
193
182
|
render() {
|
|
194
|
-
const e = Y(this.props),
|
|
183
|
+
const e = Y(this.props), i = e.find(({ id: n }) => Object.is(n, this.valueEmitter.get())) ?? e.find((n) => !n.disabled) ?? null, s = this.Host;
|
|
195
184
|
return /* @__PURE__ */ w(
|
|
196
|
-
|
|
185
|
+
s,
|
|
197
186
|
{
|
|
198
187
|
id: this.baseId,
|
|
199
|
-
className: E(this.props)
|
|
188
|
+
className: R("panellike", E(this.props)),
|
|
200
189
|
children: [
|
|
201
190
|
/* @__PURE__ */ u(
|
|
202
|
-
|
|
191
|
+
V,
|
|
203
192
|
{
|
|
204
|
-
tabs: e.map(({ id: n, label:
|
|
193
|
+
tabs: e.map(({ id: n, label: a, disabled: l }) => ({ id: n, label: a, disabled: l })),
|
|
205
194
|
valueEmitter: this.valueEmitter,
|
|
206
195
|
baseId: this.baseId,
|
|
207
196
|
...this.props.label == null ? {} : { label: this.props.label },
|
|
@@ -209,33 +198,30 @@ class J extends g {
|
|
|
209
198
|
},
|
|
210
199
|
"tab-list"
|
|
211
200
|
),
|
|
212
|
-
|
|
201
|
+
i == null ? null : /* @__PURE__ */ u(
|
|
213
202
|
"div",
|
|
214
203
|
{
|
|
215
|
-
id:
|
|
204
|
+
id: Ve(this.baseId, i.id),
|
|
216
205
|
role: "tabpanel",
|
|
217
206
|
"data-part": "content",
|
|
218
|
-
"aria-labelledby":
|
|
207
|
+
"aria-labelledby": Le(this.baseId, i.id),
|
|
219
208
|
tabIndex: 0,
|
|
220
|
-
children:
|
|
209
|
+
children: i.content
|
|
221
210
|
},
|
|
222
|
-
String(
|
|
211
|
+
String(i.id)
|
|
223
212
|
)
|
|
224
213
|
]
|
|
225
214
|
}
|
|
226
215
|
);
|
|
227
216
|
}
|
|
228
217
|
}
|
|
229
|
-
|
|
218
|
+
o(_, "dependencies", [V, qe]), o(_, "hostName", "tab-panel"), o(_, "standaloneHostName", "tab-panel"), o(_, "css", S`
|
|
230
219
|
& {
|
|
231
220
|
display: flex;
|
|
232
221
|
flex-direction: column;
|
|
233
222
|
width: 100%;
|
|
234
223
|
min-height: 0;
|
|
235
224
|
overflow: hidden;
|
|
236
|
-
background: var(--fray-panel-background, var(--panel-bg, transparent));
|
|
237
|
-
border-radius: var(--fray-panel-radius, var(--panel-radius));
|
|
238
|
-
box-shadow: var(--fray-panel-shadow, var(--panel-shadow, none));
|
|
239
225
|
}
|
|
240
226
|
|
|
241
227
|
& > [data-part="content"] {
|
|
@@ -243,75 +229,71 @@ s(J, "dependencies", [L, ze]), s(J, "hostName", "tab-panel"), s(J, "standaloneHo
|
|
|
243
229
|
flex-direction: column;
|
|
244
230
|
flex: 1;
|
|
245
231
|
overflow: auto;
|
|
246
|
-
background: var(--fray-panel-background, var(--panel-bg, transparent));
|
|
247
232
|
}
|
|
248
233
|
`);
|
|
249
234
|
function Y(t) {
|
|
250
235
|
const r = t.tabs ?? [];
|
|
251
236
|
if (!Array.isArray(r)) throw new TypeError("TabPanel tabs must be an array");
|
|
252
|
-
const
|
|
253
|
-
if (!ie(
|
|
254
|
-
const
|
|
237
|
+
const i = (Array.isArray(t.children) ? t.children : t.children == null ? [] : [t.children]).filter((a) => ie(a) && a.type === qe).map((a, l) => {
|
|
238
|
+
if (!ie(a)) throw new TypeError("TabPanel children must be Tab nodes");
|
|
239
|
+
const c = a.props;
|
|
255
240
|
return {
|
|
256
|
-
id:
|
|
257
|
-
label:
|
|
258
|
-
disabled: !!
|
|
259
|
-
content:
|
|
241
|
+
id: c.id ?? `tab-${l + 1}`,
|
|
242
|
+
label: c.label ?? `Tab ${l + 1}`,
|
|
243
|
+
disabled: !!c.disabled,
|
|
244
|
+
content: c.children ?? []
|
|
260
245
|
};
|
|
261
|
-
}),
|
|
262
|
-
...
|
|
263
|
-
label:
|
|
264
|
-
disabled: !!
|
|
265
|
-
content:
|
|
266
|
-
})) :
|
|
267
|
-
for (const
|
|
268
|
-
if ((
|
|
269
|
-
if (n.has(
|
|
270
|
-
n.add(
|
|
271
|
-
}
|
|
272
|
-
return
|
|
273
|
-
}
|
|
274
|
-
class
|
|
246
|
+
}), s = r.length > 0 ? r.map((a) => ({
|
|
247
|
+
...a,
|
|
248
|
+
label: a.label ?? String(a.id),
|
|
249
|
+
disabled: !!a.disabled,
|
|
250
|
+
content: a.content ?? a.component ?? []
|
|
251
|
+
})) : i, n = /* @__PURE__ */ new Set();
|
|
252
|
+
for (const a of s) {
|
|
253
|
+
if ((a == null ? void 0 : a.id) == null) throw new TypeError("Each tab requires an id");
|
|
254
|
+
if (n.has(a.id)) throw new Error(`Duplicate tab id: ${String(a.id)}`);
|
|
255
|
+
n.add(a.id);
|
|
256
|
+
}
|
|
257
|
+
return s;
|
|
258
|
+
}
|
|
259
|
+
class ce extends y {
|
|
275
260
|
constructor(e = {}) {
|
|
276
261
|
super(e);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
this.panelId =
|
|
262
|
+
o(this, "panelId");
|
|
263
|
+
o(this, "headerId");
|
|
264
|
+
this.panelId = F("panel", e.id), this.headerId = `${this.panelId}-title`;
|
|
280
265
|
}
|
|
281
266
|
render() {
|
|
282
267
|
const {
|
|
283
268
|
header: e = null,
|
|
284
|
-
toolbar:
|
|
285
|
-
children:
|
|
269
|
+
toolbar: i = null,
|
|
270
|
+
children: s = [],
|
|
286
271
|
orientation: n = "vertical",
|
|
287
|
-
disabled:
|
|
272
|
+
disabled: a = !1
|
|
288
273
|
} = this.props;
|
|
289
274
|
if (!["horizontal", "vertical"].includes(n))
|
|
290
275
|
throw new TypeError("Panel orientation must be horizontal or vertical");
|
|
291
|
-
const l = this.Host,
|
|
276
|
+
const l = this.Host, c = e == null ? null : /* @__PURE__ */ u("header", { children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ u("h2", { id: this.headerId, children: e }) : /* @__PURE__ */ u("div", { id: this.headerId, children: e }) });
|
|
292
277
|
return /* @__PURE__ */ w(
|
|
293
278
|
l,
|
|
294
279
|
{
|
|
295
280
|
id: this.panelId,
|
|
296
281
|
role: e == null ? null : "region",
|
|
297
|
-
className: E(this.props)
|
|
282
|
+
className: R("panellike", E(this.props)),
|
|
298
283
|
"data-orientation": n,
|
|
299
|
-
"data-disabled":
|
|
300
|
-
"aria-disabled":
|
|
284
|
+
"data-disabled": a ? "" : null,
|
|
285
|
+
"aria-disabled": a ? "true" : null,
|
|
301
286
|
"aria-labelledby": e == null ? null : this.headerId,
|
|
302
287
|
children: [
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
/* @__PURE__ */ u("div", { "data-part": "content", "data-orientation": n, children:
|
|
288
|
+
c,
|
|
289
|
+
i,
|
|
290
|
+
/* @__PURE__ */ u("div", { "data-part": "content", "data-orientation": n, children: s })
|
|
306
291
|
]
|
|
307
292
|
}
|
|
308
293
|
);
|
|
309
294
|
}
|
|
310
295
|
}
|
|
311
|
-
|
|
312
|
-
["&", ["panel"]],
|
|
313
|
-
['& > [data-part="header"]', ["sectionheader"]]
|
|
314
|
-
]), s(_, "css", v`
|
|
296
|
+
o(ce, "hostName", "panel"), o(ce, "standaloneHostName", "layout-panel"), o(ce, "css", S`
|
|
315
297
|
& {
|
|
316
298
|
display: flex;
|
|
317
299
|
flex-direction: column;
|
|
@@ -319,24 +301,11 @@ s(_, "hostName", "panel"), s(_, "standaloneHostName", "layout-panel"), s(_, "bas
|
|
|
319
301
|
flex: 0 0 auto;
|
|
320
302
|
}
|
|
321
303
|
|
|
322
|
-
& >
|
|
304
|
+
& > header h2 {
|
|
323
305
|
margin: 0;
|
|
324
306
|
font: inherit;
|
|
325
307
|
}
|
|
326
308
|
|
|
327
|
-
& > [data-part="header"] {
|
|
328
|
-
background: var(
|
|
329
|
-
--fray-panel-header-background,
|
|
330
|
-
var(--fray-section-header-background, var(--fray-header-background))
|
|
331
|
-
);
|
|
332
|
-
color: var(
|
|
333
|
-
--fray-panel-header-color,
|
|
334
|
-
var(--fray-section-header-color, var(--fray-header-color))
|
|
335
|
-
);
|
|
336
|
-
border: var(--fray-section-header-border, var(--fray-header-border));
|
|
337
|
-
box-shadow: var(--fray-section-header-shadow, var(--fray-header-shadow));
|
|
338
|
-
}
|
|
339
|
-
|
|
340
309
|
& > [data-part="content"] {
|
|
341
310
|
display: flex;
|
|
342
311
|
flex: 1;
|
|
@@ -353,42 +322,39 @@ s(_, "hostName", "panel"), s(_, "standaloneHostName", "layout-panel"), s(_, "bas
|
|
|
353
322
|
flex-direction: column;
|
|
354
323
|
}
|
|
355
324
|
`);
|
|
356
|
-
class
|
|
325
|
+
class st extends y {
|
|
357
326
|
constructor(e = {}) {
|
|
358
327
|
super(e);
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
this.sidebarId =
|
|
328
|
+
o(this, "sidebarId");
|
|
329
|
+
o(this, "headerId");
|
|
330
|
+
this.sidebarId = F("sidebar", e.id), this.headerId = `${this.sidebarId}-title`;
|
|
362
331
|
}
|
|
363
332
|
render() {
|
|
364
333
|
const {
|
|
365
334
|
header: e = null,
|
|
366
|
-
toolbar:
|
|
367
|
-
ariaLabel:
|
|
335
|
+
toolbar: i = null,
|
|
336
|
+
ariaLabel: s,
|
|
368
337
|
children: n = []
|
|
369
|
-
} = this.props,
|
|
338
|
+
} = this.props, a = e == null ? null : /* @__PURE__ */ u("header", { children: typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ u("h2", { id: this.headerId, children: e }) : /* @__PURE__ */ u("div", { id: this.headerId, children: e }) });
|
|
370
339
|
return /* @__PURE__ */ w(
|
|
371
340
|
"aside",
|
|
372
341
|
{
|
|
373
342
|
id: this.sidebarId,
|
|
374
343
|
className: E(this.props) || void 0,
|
|
375
344
|
"data-fray-component": "sidebar",
|
|
376
|
-
"aria-label": e == null ?
|
|
345
|
+
"aria-label": e == null ? s : null,
|
|
377
346
|
"aria-labelledby": e == null ? null : this.headerId,
|
|
378
347
|
children: [
|
|
379
|
-
|
|
380
|
-
|
|
348
|
+
a,
|
|
349
|
+
i == null ? null : /* @__PURE__ */ u("div", { "data-part": "toolbar", children: i }),
|
|
381
350
|
/* @__PURE__ */ u("div", { "data-part": "content", tabIndex: 0, children: n })
|
|
382
351
|
]
|
|
383
352
|
}
|
|
384
353
|
);
|
|
385
354
|
}
|
|
386
355
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
['aside[data-fray-component="sidebar"] > [data-part="header"]', ["sectionheader"]]
|
|
390
|
-
]), s(xe, "css", v`
|
|
391
|
-
aside[data-fray-component="sidebar"] {
|
|
356
|
+
o(st, "css", S`
|
|
357
|
+
aside {
|
|
392
358
|
display: flex;
|
|
393
359
|
flex-direction: column;
|
|
394
360
|
min-width: 0;
|
|
@@ -396,17 +362,17 @@ s(xe, "baseStyles", [
|
|
|
396
362
|
overflow: hidden;
|
|
397
363
|
}
|
|
398
364
|
|
|
399
|
-
aside
|
|
400
|
-
aside
|
|
365
|
+
aside > header,
|
|
366
|
+
aside > [data-part="toolbar"] {
|
|
401
367
|
flex: 0 0 auto;
|
|
402
368
|
}
|
|
403
369
|
|
|
404
|
-
aside
|
|
370
|
+
aside > header h2 {
|
|
405
371
|
margin: 0;
|
|
406
372
|
font: inherit;
|
|
407
373
|
}
|
|
408
374
|
|
|
409
|
-
aside
|
|
375
|
+
aside > [data-part="content"] {
|
|
410
376
|
flex: 1 1 auto;
|
|
411
377
|
min-width: 0;
|
|
412
378
|
min-height: 0;
|
|
@@ -414,27 +380,27 @@ s(xe, "baseStyles", [
|
|
|
414
380
|
overflow-y: auto;
|
|
415
381
|
}
|
|
416
382
|
`);
|
|
417
|
-
class
|
|
383
|
+
class de extends y {
|
|
418
384
|
render() {
|
|
419
385
|
const {
|
|
420
386
|
primary: r = null,
|
|
421
387
|
secondary: e = null,
|
|
422
|
-
direction:
|
|
423
|
-
primarySize:
|
|
388
|
+
direction: i = "horizontal",
|
|
389
|
+
primarySize: s,
|
|
424
390
|
primaryLabel: n,
|
|
425
|
-
secondaryLabel:
|
|
391
|
+
secondaryLabel: a
|
|
426
392
|
} = this.props;
|
|
427
|
-
if (
|
|
393
|
+
if (i !== "horizontal" && i !== "vertical")
|
|
428
394
|
throw new TypeError("SplitView direction must be horizontal or vertical");
|
|
429
|
-
if (
|
|
395
|
+
if (s != null && (typeof s != "string" || s.length === 0))
|
|
430
396
|
throw new TypeError("SplitView primarySize must be a non-empty CSS size");
|
|
431
397
|
const l = this.Host;
|
|
432
398
|
return /* @__PURE__ */ w(
|
|
433
399
|
l,
|
|
434
400
|
{
|
|
435
401
|
className: E(this.props) || null,
|
|
436
|
-
"data-direction":
|
|
437
|
-
style:
|
|
402
|
+
"data-direction": i,
|
|
403
|
+
style: s == null ? void 0 : { "--split-primary-size": s },
|
|
438
404
|
children: [
|
|
439
405
|
/* @__PURE__ */ u(
|
|
440
406
|
"div",
|
|
@@ -449,8 +415,8 @@ class ce extends g {
|
|
|
449
415
|
"div",
|
|
450
416
|
{
|
|
451
417
|
"data-part": "secondary",
|
|
452
|
-
role:
|
|
453
|
-
"aria-label":
|
|
418
|
+
role: a == null ? null : "region",
|
|
419
|
+
"aria-label": a,
|
|
454
420
|
children: e ?? this.props.children ?? []
|
|
455
421
|
}
|
|
456
422
|
)
|
|
@@ -459,7 +425,7 @@ class ce extends g {
|
|
|
459
425
|
);
|
|
460
426
|
}
|
|
461
427
|
}
|
|
462
|
-
|
|
428
|
+
o(de, "hostName", "split-view"), o(de, "standaloneHostName", "split-view"), o(de, "css", S`
|
|
463
429
|
& {
|
|
464
430
|
display: grid;
|
|
465
431
|
flex: 1 1 auto;
|
|
@@ -494,9 +460,9 @@ s(ce, "hostName", "split-view"), s(ce, "standaloneHostName", "split-view"), s(ce
|
|
|
494
460
|
border-block-end: 1px solid var(--ui-border-color);
|
|
495
461
|
}
|
|
496
462
|
`);
|
|
497
|
-
class
|
|
463
|
+
class Pe extends y {
|
|
498
464
|
render() {
|
|
499
|
-
const { term: r, value: e, children:
|
|
465
|
+
const { term: r, value: e, children: i = [] } = this.props;
|
|
500
466
|
return /* @__PURE__ */ w(
|
|
501
467
|
"div",
|
|
502
468
|
{
|
|
@@ -504,45 +470,39 @@ class Ue extends g {
|
|
|
504
470
|
"data-fray-component": "description-item",
|
|
505
471
|
children: [
|
|
506
472
|
/* @__PURE__ */ u("dt", { children: r }),
|
|
507
|
-
/* @__PURE__ */ u("dd", { children: e ??
|
|
473
|
+
/* @__PURE__ */ u("dd", { children: e ?? i })
|
|
508
474
|
]
|
|
509
475
|
}
|
|
510
476
|
);
|
|
511
477
|
}
|
|
512
478
|
}
|
|
513
|
-
|
|
514
|
-
div
|
|
479
|
+
o(Pe, "css", S`
|
|
480
|
+
div:has(> dt + dd) {
|
|
515
481
|
display: grid;
|
|
516
482
|
grid-template-columns: minmax(7rem, 0.7fr) minmax(0, 1.3fr);
|
|
517
483
|
gap: var(--spacing-small, 0.5rem);
|
|
518
484
|
padding-block: var(--spacing-small, 0.5rem);
|
|
519
|
-
border-block-end: 1px solid var(--ui-border-color);
|
|
520
485
|
}
|
|
521
486
|
|
|
522
|
-
div
|
|
523
|
-
color: var(--ui-muted-text-color, var(--ui-text-color));
|
|
524
|
-
font-weight: 600;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
div[data-fray-component="description-item"] > dd {
|
|
487
|
+
div:has(> dt + dd) > dd {
|
|
528
488
|
min-width: 0;
|
|
529
489
|
margin: 0;
|
|
530
490
|
overflow-wrap: anywhere;
|
|
531
491
|
}
|
|
532
492
|
|
|
533
493
|
@media (max-width: 36rem) {
|
|
534
|
-
div
|
|
494
|
+
div:has(> dt + dd) {
|
|
535
495
|
grid-template-columns: minmax(0, 1fr);
|
|
536
496
|
gap: 0.15rem;
|
|
537
497
|
}
|
|
538
498
|
}
|
|
539
499
|
`);
|
|
540
|
-
class
|
|
500
|
+
class Re extends y {
|
|
541
501
|
render() {
|
|
542
502
|
return /* @__PURE__ */ u(
|
|
543
503
|
"dl",
|
|
544
504
|
{
|
|
545
|
-
className: E(this.props)
|
|
505
|
+
className: R("datacomponentlike", E(this.props)),
|
|
546
506
|
"data-fray-component": "description-list",
|
|
547
507
|
"aria-label": this.props.label,
|
|
548
508
|
children: this.props.children ?? []
|
|
@@ -550,21 +510,21 @@ class Te extends g {
|
|
|
550
510
|
);
|
|
551
511
|
}
|
|
552
512
|
}
|
|
553
|
-
|
|
554
|
-
dl
|
|
513
|
+
o(Re, "dependencies", [Pe]), o(Re, "css", S`
|
|
514
|
+
dl:has(> div > dt + dd) {
|
|
555
515
|
display: grid;
|
|
556
516
|
margin: 0;
|
|
557
517
|
}
|
|
558
518
|
`);
|
|
559
|
-
class
|
|
519
|
+
class M extends y {
|
|
560
520
|
render() {
|
|
561
|
-
const r =
|
|
521
|
+
const r = nt(this.props.width ?? 65), e = this.Host;
|
|
562
522
|
return /* @__PURE__ */ u(e, { style: { width: `${r}%` }, "aria-hidden": "true" });
|
|
563
523
|
}
|
|
564
524
|
}
|
|
565
|
-
|
|
525
|
+
o(M, "hostName", "placeholder"), o(M, "standaloneHostName", "loading-placeholder"), o(M, "baseStyles", [
|
|
566
526
|
["&::after", ["after", "working"]]
|
|
567
|
-
]),
|
|
527
|
+
]), o(M, "css", S`
|
|
568
528
|
& {
|
|
569
529
|
display: block;
|
|
570
530
|
min-width: 3rem;
|
|
@@ -581,182 +541,182 @@ s(H, "hostName", "placeholder"), s(H, "standaloneHostName", "loading-placeholder
|
|
|
581
541
|
to { background-position: 2rem 0; }
|
|
582
542
|
}
|
|
583
543
|
`);
|
|
584
|
-
function
|
|
544
|
+
function nt(t) {
|
|
585
545
|
const r = Number(t);
|
|
586
546
|
if (!Number.isFinite(r)) throw new TypeError("Placeholder width must be numeric");
|
|
587
547
|
return Math.min(100, Math.max(10, r));
|
|
588
548
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
591
|
-
for (const
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
const n =
|
|
595
|
-
const h =
|
|
596
|
-
return h == null || h === b.Neutral ? [] : [{ option:
|
|
549
|
+
function Be(t, r, e) {
|
|
550
|
+
we(e);
|
|
551
|
+
for (const i of e) {
|
|
552
|
+
const s = r[i.key];
|
|
553
|
+
if (s == null) continue;
|
|
554
|
+
const n = i.options.flatMap((c) => {
|
|
555
|
+
const h = s[c.key];
|
|
556
|
+
return h == null || h === b.Neutral ? [] : [{ option: c, mode: h }];
|
|
597
557
|
});
|
|
598
|
-
if (n.some(({ option:
|
|
558
|
+
if (n.some(({ option: c, mode: h }) => h === b.Deny && c.matches(t)) || n.filter(({ mode: c }) => c === b.Require).some(({ option: c }) => !c.matches(t)))
|
|
599
559
|
return !1;
|
|
600
|
-
const l = n.filter(({ mode:
|
|
601
|
-
if (l.length > 0 && !l.some(({ option:
|
|
560
|
+
const l = n.filter(({ mode: c }) => c === b.Prefer);
|
|
561
|
+
if (l.length > 0 && !l.some(({ option: c }) => c.matches(t)))
|
|
602
562
|
return !1;
|
|
603
563
|
}
|
|
604
564
|
return !0;
|
|
605
565
|
}
|
|
606
|
-
function
|
|
566
|
+
function ot(t, r, e) {
|
|
607
567
|
if (!Array.isArray(t)) throw new TypeError("Filtered items must be an array");
|
|
608
|
-
return t.filter((
|
|
568
|
+
return t.filter((i) => Be(i, r, e));
|
|
609
569
|
}
|
|
610
|
-
function
|
|
611
|
-
return
|
|
570
|
+
function nr(t, r, e = null) {
|
|
571
|
+
return we(r), new ae(
|
|
612
572
|
[t],
|
|
613
|
-
([
|
|
573
|
+
([i]) => (s) => Be(s, i, r),
|
|
614
574
|
{ owner: e, purpose: "filter predicate" }
|
|
615
575
|
);
|
|
616
576
|
}
|
|
617
|
-
function
|
|
618
|
-
return
|
|
577
|
+
function or(t, r, e, i = null) {
|
|
578
|
+
return we(e), new ae(
|
|
619
579
|
[t, r],
|
|
620
|
-
([
|
|
621
|
-
{ owner:
|
|
580
|
+
([s, n]) => ot(s, n, e),
|
|
581
|
+
{ owner: i, purpose: "filtered items" }
|
|
622
582
|
);
|
|
623
583
|
}
|
|
624
|
-
function
|
|
625
|
-
|
|
584
|
+
function ar(t) {
|
|
585
|
+
at(t);
|
|
626
586
|
const r = {};
|
|
627
587
|
for (const e of Object.keys(t).sort()) {
|
|
628
|
-
const
|
|
629
|
-
for (const n of Object.keys(
|
|
630
|
-
|
|
631
|
-
r[e] =
|
|
588
|
+
const i = {}, s = t[e];
|
|
589
|
+
for (const n of Object.keys(s).sort())
|
|
590
|
+
i[n] = s[n];
|
|
591
|
+
r[e] = i;
|
|
632
592
|
}
|
|
633
593
|
return { version: 1, dimensions: r };
|
|
634
594
|
}
|
|
635
|
-
function
|
|
636
|
-
if (!
|
|
595
|
+
function lr(t) {
|
|
596
|
+
if (!W(t) || t.version !== 1 || !W(t.dimensions))
|
|
637
597
|
throw new TypeError("Filter state must use version 1 with a dimensions object");
|
|
638
598
|
const r = {};
|
|
639
|
-
for (const [e,
|
|
640
|
-
if (
|
|
599
|
+
for (const [e, i] of Object.entries(t.dimensions)) {
|
|
600
|
+
if (P(e, "Filter dimension"), !W(i))
|
|
641
601
|
throw new TypeError(`Filter dimension ${e} must be an object`);
|
|
642
|
-
const
|
|
643
|
-
for (const [n,
|
|
644
|
-
if (
|
|
602
|
+
const s = {};
|
|
603
|
+
for (const [n, a] of Object.entries(i)) {
|
|
604
|
+
if (P(n, `Filter option in ${e}`), !le(a))
|
|
645
605
|
throw new TypeError(
|
|
646
|
-
`Unknown filter mode for ${e}.${n}: ${String(
|
|
606
|
+
`Unknown filter mode for ${e}.${n}: ${String(a)}`
|
|
647
607
|
);
|
|
648
|
-
|
|
608
|
+
s[n] = a;
|
|
649
609
|
}
|
|
650
|
-
r[e] =
|
|
610
|
+
r[e] = s;
|
|
651
611
|
}
|
|
652
612
|
return r;
|
|
653
613
|
}
|
|
654
|
-
function
|
|
655
|
-
if (!
|
|
614
|
+
function at(t) {
|
|
615
|
+
if (!W(t)) throw new TypeError("Filter state must be an object");
|
|
656
616
|
for (const [r, e] of Object.entries(t)) {
|
|
657
|
-
if (
|
|
617
|
+
if (P(r, "Filter dimension"), !W(e))
|
|
658
618
|
throw new TypeError(`Filter dimension ${r} must be an object`);
|
|
659
|
-
for (const [
|
|
660
|
-
if (
|
|
619
|
+
for (const [i, s] of Object.entries(e))
|
|
620
|
+
if (P(i, `Filter option in ${r}`), !le(s))
|
|
661
621
|
throw new TypeError(
|
|
662
|
-
`Unknown filter mode for ${r}.${
|
|
622
|
+
`Unknown filter mode for ${r}.${i}: ${String(s)}`
|
|
663
623
|
);
|
|
664
624
|
}
|
|
665
625
|
}
|
|
666
|
-
function
|
|
626
|
+
function we(t) {
|
|
667
627
|
if (!Array.isArray(t)) throw new TypeError("Filter dimensions must be an array");
|
|
668
628
|
const r = /* @__PURE__ */ new Set();
|
|
669
629
|
for (const e of t) {
|
|
670
|
-
if (
|
|
630
|
+
if (P(e.key, "Filter dimension"), r.has(e.key))
|
|
671
631
|
throw new Error(`Duplicate filter dimension: ${e.key}`);
|
|
672
632
|
if (r.add(e.key), !Array.isArray(e.options))
|
|
673
633
|
throw new TypeError(`Filter dimension ${e.key} options must be an array`);
|
|
674
|
-
const
|
|
675
|
-
for (const
|
|
676
|
-
if (
|
|
677
|
-
throw new Error(`Duplicate filter option: ${e.key}.${
|
|
678
|
-
if (
|
|
679
|
-
throw new TypeError(`Filter matcher ${e.key}.${
|
|
634
|
+
const i = /* @__PURE__ */ new Set();
|
|
635
|
+
for (const s of e.options) {
|
|
636
|
+
if (P(s.key, `Filter option in ${e.key}`), i.has(s.key))
|
|
637
|
+
throw new Error(`Duplicate filter option: ${e.key}.${s.key}`);
|
|
638
|
+
if (i.add(s.key), typeof s.matches != "function")
|
|
639
|
+
throw new TypeError(`Filter matcher ${e.key}.${s.key} must be a function`);
|
|
680
640
|
}
|
|
681
641
|
}
|
|
682
642
|
}
|
|
683
|
-
function
|
|
643
|
+
function P(t, r) {
|
|
684
644
|
if (t.length === 0 || t === "__proto__" || t === "prototype" || t === "constructor")
|
|
685
645
|
throw new TypeError(`${r} key is not safe for persisted state`);
|
|
686
646
|
}
|
|
687
|
-
function
|
|
647
|
+
function W(t) {
|
|
688
648
|
return t != null && typeof t == "object" && !Array.isArray(t);
|
|
689
649
|
}
|
|
690
|
-
class
|
|
650
|
+
class Ge {
|
|
691
651
|
constructor({
|
|
692
652
|
getItems: r,
|
|
693
|
-
getKey: e =
|
|
694
|
-
selectedItemsEmitter:
|
|
695
|
-
owner:
|
|
653
|
+
getKey: e = Se,
|
|
654
|
+
selectedItemsEmitter: i,
|
|
655
|
+
owner: s = null
|
|
696
656
|
}) {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
657
|
+
o(this, "getItems");
|
|
658
|
+
o(this, "getKey");
|
|
659
|
+
o(this, "selectedItemsEmitter");
|
|
660
|
+
o(this, "selectedItems$");
|
|
661
|
+
o(this, "ownsSelectedItemsEmitter");
|
|
662
|
+
o(this, "rows", []);
|
|
663
|
+
o(this, "rowCleanups", []);
|
|
664
|
+
o(this, "activeIndex", 0);
|
|
665
|
+
o(this, "anchorIndex", null);
|
|
666
|
+
o(this, "dragStartIndex", null);
|
|
667
|
+
o(this, "dragOriginEvent", null);
|
|
668
|
+
o(this, "dragMoved", !1);
|
|
669
|
+
o(this, "dragCleanup", null);
|
|
670
|
+
o(this, "suppressNextClick", !1);
|
|
671
|
+
o(this, "suppressClickTimer", null);
|
|
672
|
+
o(this, "destroyed", !1);
|
|
673
|
+
o(this, "ownedSelectedItemsEmitter");
|
|
714
674
|
if (typeof r != "function")
|
|
715
675
|
throw new TypeError("Selection handler getItems must be a function");
|
|
716
676
|
if (typeof e != "function")
|
|
717
677
|
throw new TypeError("Selection handler getKey must be a function");
|
|
718
|
-
this.getItems = r, this.getKey = e, this.ownedSelectedItemsEmitter =
|
|
678
|
+
this.getItems = r, this.getKey = e, this.ownedSelectedItemsEmitter = i == null ? new x([], { owner: s, purpose: "selected items" }) : null, this.selectedItemsEmitter = i ?? this.ownedSelectedItemsEmitter, this.selectedItems$ = this.selectedItemsEmitter, this.ownsSelectedItemsEmitter = this.ownedSelectedItemsEmitter != null;
|
|
719
679
|
}
|
|
720
680
|
rowsUpdated(r) {
|
|
721
|
-
this.destroyed || (this.releaseRows(), this.rows = Array.from(r ?? []), this.rows.forEach((e,
|
|
681
|
+
this.destroyed || (this.releaseRows(), this.rows = Array.from(r ?? []), this.rows.forEach((e, i) => this.wireRow(e, i)), this.activeIndex = dt(this.activeIndex, this.rows.length), this.reconcileSelectedItems(), this.syncRows());
|
|
722
682
|
}
|
|
723
683
|
wireRow(r, e) {
|
|
724
|
-
const
|
|
725
|
-
r.addEventListener("click",
|
|
726
|
-
r.removeEventListener("click",
|
|
684
|
+
const i = (l) => this.handleClick(e, l), s = (l) => this.handleKeyDown(e, l), n = (l) => this.handleMouseDown(e, l, r), a = (l) => this.handleMouseEnter(e, l);
|
|
685
|
+
r.addEventListener("click", i), r.addEventListener("keydown", s), r.addEventListener("mousedown", n), r.addEventListener("mouseenter", a), this.rowCleanups.push(() => {
|
|
686
|
+
r.removeEventListener("click", i), r.removeEventListener("keydown", s), r.removeEventListener("mousedown", n), r.removeEventListener("mouseenter", a);
|
|
727
687
|
});
|
|
728
688
|
}
|
|
729
689
|
handleClick(r, e) {
|
|
730
|
-
var
|
|
690
|
+
var i;
|
|
731
691
|
if (e.preventDefault(), this.suppressNextClick) {
|
|
732
692
|
this.clearClickSuppression();
|
|
733
693
|
return;
|
|
734
694
|
}
|
|
735
|
-
this.activeIndex = r, this.selectIndex(r, e), (
|
|
695
|
+
this.activeIndex = r, this.selectIndex(r, e), (i = this.rows[r]) == null || i.focus();
|
|
736
696
|
}
|
|
737
|
-
handleMouseDown(r, e,
|
|
697
|
+
handleMouseDown(r, e, i) {
|
|
738
698
|
if (e.button !== 0 || !this.supportsDragSelection()) return;
|
|
739
699
|
this.finishDrag(!1), this.clearClickSuppression(), this.dragStartIndex = r, this.dragOriginEvent = e, this.dragMoved = !1;
|
|
740
|
-
const
|
|
741
|
-
|
|
700
|
+
const s = i.ownerDocument, n = () => this.finishDrag(this.dragMoved);
|
|
701
|
+
s.addEventListener("mouseup", n), this.dragCleanup = () => s.removeEventListener("mouseup", n);
|
|
742
702
|
}
|
|
743
703
|
handleMouseEnter(r, e) {
|
|
744
|
-
var
|
|
745
|
-
this.dragStartIndex != null && (r === this.dragStartIndex && !this.dragMoved || r === this.activeIndex && this.dragMoved || (e.preventDefault(), this.dragMoved = !0, this.activeIndex = r, this.selectDragRange(this.dragStartIndex, r, this.dragOriginEvent ?? e), (
|
|
704
|
+
var i;
|
|
705
|
+
this.dragStartIndex != null && (r === this.dragStartIndex && !this.dragMoved || r === this.activeIndex && this.dragMoved || (e.preventDefault(), this.dragMoved = !0, this.activeIndex = r, this.selectDragRange(this.dragStartIndex, r, this.dragOriginEvent ?? e), (i = this.rows[r]) == null || i.focus()));
|
|
746
706
|
}
|
|
747
707
|
handleKeyDown(r, e) {
|
|
748
708
|
var n;
|
|
749
|
-
const
|
|
750
|
-
let
|
|
751
|
-
if (e.key === "ArrowDown")
|
|
752
|
-
else if (e.key === "ArrowUp")
|
|
753
|
-
else if (e.key === "Home")
|
|
754
|
-
else if (e.key === "End")
|
|
709
|
+
const i = this.rows.length - 1;
|
|
710
|
+
let s;
|
|
711
|
+
if (e.key === "ArrowDown") s = Math.min(r + 1, i);
|
|
712
|
+
else if (e.key === "ArrowUp") s = Math.max(r - 1, 0);
|
|
713
|
+
else if (e.key === "Home") s = 0;
|
|
714
|
+
else if (e.key === "End") s = i;
|
|
755
715
|
else if (e.key === " " || e.key === "Enter") {
|
|
756
716
|
e.preventDefault(), this.activeIndex = r, this.selectIndex(r, e);
|
|
757
717
|
return;
|
|
758
718
|
} else return;
|
|
759
|
-
e.preventDefault(), this.activeIndex =
|
|
719
|
+
e.preventDefault(), this.activeIndex = s, this.onKeyboardMove(s, e), this.syncRows(), (n = this.rows[s]) == null || n.focus();
|
|
760
720
|
}
|
|
761
721
|
onKeyboardMove(r, e) {
|
|
762
722
|
this.selectIndex(r, e);
|
|
@@ -764,7 +724,7 @@ class Be {
|
|
|
764
724
|
supportsDragSelection() {
|
|
765
725
|
return !1;
|
|
766
726
|
}
|
|
767
|
-
selectDragRange(r, e,
|
|
727
|
+
selectDragRange(r, e, i) {
|
|
768
728
|
}
|
|
769
729
|
selectIndex(r, e) {
|
|
770
730
|
}
|
|
@@ -780,14 +740,14 @@ class Be {
|
|
|
780
740
|
reconcileSelectedItems() {
|
|
781
741
|
const r = this.getSelectedItems();
|
|
782
742
|
if (r.length === 0) return;
|
|
783
|
-
const e = new Set(r.map((
|
|
784
|
-
(
|
|
743
|
+
const e = new Set(r.map((s, n) => this.getKey(s, n))), i = this.getItems().filter((s, n) => e.has(this.getKey(s, n)));
|
|
744
|
+
(i.length !== r.length || i.some((s, n) => !Object.is(s, r[n]))) && this.selectedItemsEmitter.set([...i], "selection reconciled with rows");
|
|
785
745
|
}
|
|
786
746
|
syncRows() {
|
|
787
|
-
const r = new Set(this.getSelectedItems().map((
|
|
788
|
-
this.rows.forEach((
|
|
789
|
-
const n = e[
|
|
790
|
-
|
|
747
|
+
const r = new Set(this.getSelectedItems().map((i, s) => this.getKey(i, s))), e = this.getItems();
|
|
748
|
+
this.rows.forEach((i, s) => {
|
|
749
|
+
const n = e[s], a = n !== void 0 && r.has(this.getKey(n, s));
|
|
750
|
+
i.classList.toggle("selected", a), i.setAttribute("aria-selected", String(a)), i.tabIndex = s === this.activeIndex ? 0 : -1;
|
|
791
751
|
});
|
|
792
752
|
}
|
|
793
753
|
releaseRows() {
|
|
@@ -806,26 +766,26 @@ class Be {
|
|
|
806
766
|
this.destroyed || (this.destroyed = !0, this.finishDrag(!1), this.clearClickSuppression(), this.releaseRows(), (r = this.ownedSelectedItemsEmitter) == null || r.dispose());
|
|
807
767
|
}
|
|
808
768
|
}
|
|
809
|
-
class
|
|
769
|
+
class Ee extends Ge {
|
|
810
770
|
constructor(e) {
|
|
811
|
-
const
|
|
771
|
+
const i = e.selectedItemEmitter == null ? new x(null, {
|
|
812
772
|
owner: e.owner,
|
|
813
773
|
purpose: "selected item"
|
|
814
|
-
}) : null,
|
|
774
|
+
}) : null, s = e.selectedItemEmitter ?? i;
|
|
815
775
|
super({
|
|
816
776
|
getItems: e.getItems,
|
|
817
777
|
...e.getKey == null ? {} : { getKey: e.getKey },
|
|
818
778
|
...e.owner === void 0 ? {} : { owner: e.owner },
|
|
819
|
-
selectedItemsEmitter: new
|
|
779
|
+
selectedItemsEmitter: new ct(s)
|
|
820
780
|
});
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
this.ownedSelectedItemEmitter =
|
|
781
|
+
o(this, "selectedItemEmitter");
|
|
782
|
+
o(this, "selectedItem$");
|
|
783
|
+
o(this, "ownedSelectedItemEmitter");
|
|
784
|
+
this.ownedSelectedItemEmitter = i, this.selectedItemEmitter = s, this.selectedItem$ = s;
|
|
825
785
|
}
|
|
826
786
|
selectIndex(e) {
|
|
827
|
-
const
|
|
828
|
-
|
|
787
|
+
const i = this.getItems()[e];
|
|
788
|
+
i !== void 0 && (this.anchorIndex = e, this.setSelectedItems([i], "single selection changed"));
|
|
829
789
|
}
|
|
830
790
|
getSelectedItem() {
|
|
831
791
|
return this.selectedItemEmitter.get();
|
|
@@ -835,21 +795,21 @@ class ge extends Be {
|
|
|
835
795
|
super.destroy(), (e = this.ownedSelectedItemEmitter) == null || e.dispose();
|
|
836
796
|
}
|
|
837
797
|
}
|
|
838
|
-
class
|
|
798
|
+
class lt extends Ge {
|
|
839
799
|
selectIndex(r, e) {
|
|
840
|
-
const
|
|
841
|
-
if (
|
|
800
|
+
const i = this.getItems(), s = i[r];
|
|
801
|
+
if (s !== void 0) {
|
|
842
802
|
if (e.shiftKey && this.anchorIndex != null) {
|
|
843
|
-
const n = Math.min(this.anchorIndex, r),
|
|
844
|
-
this.setSelectedItems(
|
|
803
|
+
const n = Math.min(this.anchorIndex, r), a = Math.max(this.anchorIndex, r), l = i.slice(n, a + 1), c = ue(e) ? Ne(this.getSelectedItems(), l, this.getKey) : [...l];
|
|
804
|
+
this.setSelectedItems(c, "range selection changed");
|
|
845
805
|
return;
|
|
846
806
|
}
|
|
847
807
|
if (ue(e) || "key" in e && e.key === " ") {
|
|
848
|
-
const n = this.getSelectedItems(),
|
|
849
|
-
this.anchorIndex = r, this.setSelectedItems(
|
|
808
|
+
const n = this.getSelectedItems(), a = this.getKey(s, r), c = n.some((h, p) => Object.is(this.getKey(h, p), a)) ? n.filter((h, p) => !Object.is(this.getKey(h, p), a)) : [...n, s];
|
|
809
|
+
this.anchorIndex = r, this.setSelectedItems(c, "multi selection toggled");
|
|
850
810
|
return;
|
|
851
811
|
}
|
|
852
|
-
this.anchorIndex = r, this.setSelectedItems([
|
|
812
|
+
this.anchorIndex = r, this.setSelectedItems([s], "multi selection changed");
|
|
853
813
|
}
|
|
854
814
|
}
|
|
855
815
|
onKeyboardMove(r, e) {
|
|
@@ -858,15 +818,15 @@ class st extends Be {
|
|
|
858
818
|
supportsDragSelection() {
|
|
859
819
|
return !0;
|
|
860
820
|
}
|
|
861
|
-
selectDragRange(r, e,
|
|
862
|
-
const
|
|
863
|
-
this.anchorIndex = r, this.setSelectedItems(
|
|
821
|
+
selectDragRange(r, e, i) {
|
|
822
|
+
const s = this.getItems(), n = Math.min(r, e), a = Math.max(r, e), l = s.slice(n, a + 1), c = ue(i) ? Ne(this.getSelectedItems(), l, this.getKey) : [...l];
|
|
823
|
+
this.anchorIndex = r, this.setSelectedItems(c, "drag selection changed");
|
|
864
824
|
}
|
|
865
825
|
}
|
|
866
|
-
function
|
|
867
|
-
return t.multiSelect ? new
|
|
826
|
+
function se(t) {
|
|
827
|
+
return t.multiSelect ? new lt(t) : new Ee(t);
|
|
868
828
|
}
|
|
869
|
-
class
|
|
829
|
+
class ct {
|
|
870
830
|
constructor(r) {
|
|
871
831
|
this.source = r;
|
|
872
832
|
}
|
|
@@ -884,13 +844,13 @@ class ot {
|
|
|
884
844
|
return this.source.set(r[0] ?? null, e);
|
|
885
845
|
}
|
|
886
846
|
subscribe(r, e) {
|
|
887
|
-
return this.source.subscribe((
|
|
888
|
-
...
|
|
889
|
-
value:
|
|
847
|
+
return this.source.subscribe((i) => r({
|
|
848
|
+
...i,
|
|
849
|
+
value: i.value == null ? [] : [i.value]
|
|
890
850
|
}), e);
|
|
891
851
|
}
|
|
892
852
|
}
|
|
893
|
-
function
|
|
853
|
+
function Se(t, r) {
|
|
894
854
|
if (t != null && typeof t == "object") {
|
|
895
855
|
const e = Reflect.get(t, "id");
|
|
896
856
|
if (e != null) return e;
|
|
@@ -903,44 +863,44 @@ function we(t, r) {
|
|
|
903
863
|
function ue(t) {
|
|
904
864
|
return !!(t.ctrlKey || t.metaKey);
|
|
905
865
|
}
|
|
906
|
-
function
|
|
866
|
+
function dt(t, r) {
|
|
907
867
|
return r <= 0 ? 0 : Math.min(Math.max(t, 0), r - 1);
|
|
908
868
|
}
|
|
909
|
-
function
|
|
910
|
-
const
|
|
869
|
+
function Ne(t, r, e) {
|
|
870
|
+
const i = [...t], s = new Set(t.map((n, a) => e(n, a)));
|
|
911
871
|
for (const n of r) {
|
|
912
|
-
const
|
|
913
|
-
|
|
872
|
+
const a = e(n, i.length);
|
|
873
|
+
s.has(a) || (s.add(a), i.push(n));
|
|
914
874
|
}
|
|
915
|
-
return
|
|
875
|
+
return i;
|
|
916
876
|
}
|
|
917
|
-
class
|
|
877
|
+
class Q extends y {
|
|
918
878
|
constructor(e = {}) {
|
|
919
879
|
super(e);
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
880
|
+
o(this, "itemsEmitter");
|
|
881
|
+
o(this, "items$");
|
|
882
|
+
o(this, "selectedItemsEmitter");
|
|
883
|
+
o(this, "selectedItems$");
|
|
884
|
+
o(this, "selectedItemEmitter");
|
|
885
|
+
o(this, "selectedItem$");
|
|
886
|
+
o(this, "getItemKey");
|
|
887
|
+
o(this, "selectionHandler");
|
|
888
|
+
o(this, "ownedItemsEmitter");
|
|
889
|
+
ht(e.items) ? (this.itemsEmitter = e.items, this.ownedItemsEmitter = null) : (this.ownedItemsEmitter = new x(e.items ?? [], {
|
|
930
890
|
owner: this,
|
|
931
891
|
purpose: "list items"
|
|
932
|
-
}), this.itemsEmitter = this.ownedItemsEmitter), this.items$ = this.itemsEmitter, this.getItemKey =
|
|
892
|
+
}), this.itemsEmitter = this.ownedItemsEmitter), this.items$ = this.itemsEmitter, this.getItemKey = ut(e.itemKey), this.selectionHandler = e.multiSelect === !0 ? se({
|
|
933
893
|
owner: this,
|
|
934
894
|
multiSelect: !0,
|
|
935
895
|
...e.selectedItemsEmitter == null ? {} : { selectedItemsEmitter: e.selectedItemsEmitter },
|
|
936
896
|
getItems: () => this.itemsEmitter.get(),
|
|
937
897
|
getKey: this.getItemKey
|
|
938
|
-
}) :
|
|
898
|
+
}) : se({
|
|
939
899
|
owner: this,
|
|
940
900
|
...e.selectedItemEmitter == null ? {} : { selectedItemEmitter: e.selectedItemEmitter },
|
|
941
901
|
getItems: () => this.itemsEmitter.get(),
|
|
942
902
|
getKey: this.getItemKey
|
|
943
|
-
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItems$ = this.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof
|
|
903
|
+
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItems$ = this.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof Ee ? this.selectionHandler.selectedItemEmitter : null, this.selectedItem$ = this.selectedItemEmitter;
|
|
944
904
|
}
|
|
945
905
|
initialize() {
|
|
946
906
|
this.watch(this.itemsEmitter, this.selectedItemsEmitter);
|
|
@@ -948,40 +908,38 @@ class G extends g {
|
|
|
948
908
|
render() {
|
|
949
909
|
const e = this.itemsEmitter.get();
|
|
950
910
|
if (!Array.isArray(e)) throw new TypeError("ListView items must be an array");
|
|
951
|
-
const
|
|
911
|
+
const i = this.itemsEmitter.getFetchState(), s = this.itemsEmitter.getError(), n = i === k.Initial || i === k.Loading, a = new Set(this.selectedItemsEmitter.get().map((c, h) => this.getItemKey(c, h))), l = this.Host;
|
|
952
912
|
return /* @__PURE__ */ w(
|
|
953
913
|
l,
|
|
954
914
|
{
|
|
955
|
-
className: E(this.props)
|
|
915
|
+
className: R("datacomponentlike", E(this.props)),
|
|
956
916
|
children: [
|
|
957
|
-
|
|
917
|
+
i === k.Error ? /* @__PURE__ */ u("p", { role: "alert", children: ft(s, "Unable to load items") }) : null,
|
|
958
918
|
n && e.length === 0 ? /* @__PURE__ */ w("div", { role: "status", "data-part": "loading", children: [
|
|
959
919
|
/* @__PURE__ */ u("span", { children: "Loading items…" }),
|
|
960
|
-
Array.from({ length: this.props.placeholderCount ?? 5 }, (
|
|
920
|
+
Array.from({ length: this.props.placeholderCount ?? 5 }, (c, h) => /* @__PURE__ */ u("div", { "data-part": "placeholder-row", children: /* @__PURE__ */ u(M, { width: 45 + h * 7 }) }, `placeholder-${h}`))
|
|
961
921
|
] }) : null,
|
|
962
|
-
|
|
922
|
+
i === k.Ready && e.length === 0 ? /* @__PURE__ */ u("p", { role: "status", children: "No items" }) : null,
|
|
963
923
|
e.length > 0 ? /* @__PURE__ */ u(
|
|
964
924
|
"div",
|
|
965
925
|
{
|
|
966
926
|
role: "listbox",
|
|
967
|
-
"data-part": "list",
|
|
968
927
|
"aria-label": this.props.label ?? "Items",
|
|
969
928
|
"aria-busy": n ? "true" : null,
|
|
970
929
|
"aria-multiselectable": this.props.multiSelect ? "true" : null,
|
|
971
|
-
children: e.map((
|
|
972
|
-
const
|
|
930
|
+
children: e.map((c, h) => {
|
|
931
|
+
const p = this.getItemKey(c, h), f = a.has(p), g = this.props.renderItem ? this.props.renderItem(c, h) : pt(c);
|
|
973
932
|
return /* @__PURE__ */ u(
|
|
974
933
|
"div",
|
|
975
934
|
{
|
|
976
935
|
role: "option",
|
|
977
|
-
"data-part": "row",
|
|
978
936
|
"data-fray-selectable-row": "",
|
|
979
937
|
"data-index": h,
|
|
980
|
-
"aria-selected": String(
|
|
938
|
+
"aria-selected": String(f),
|
|
981
939
|
tabIndex: h === 0 ? 0 : -1,
|
|
982
|
-
children:
|
|
940
|
+
children: g
|
|
983
941
|
},
|
|
984
|
-
String(
|
|
942
|
+
String(p)
|
|
985
943
|
);
|
|
986
944
|
})
|
|
987
945
|
}
|
|
@@ -991,8 +949,8 @@ class G extends g {
|
|
|
991
949
|
);
|
|
992
950
|
}
|
|
993
951
|
afterUpdate(e) {
|
|
994
|
-
const
|
|
995
|
-
this.selectionHandler.rowsUpdated(
|
|
952
|
+
const i = e instanceof Element ? e.querySelectorAll("[data-fray-selectable-row]") : [];
|
|
953
|
+
this.selectionHandler.rowsUpdated(i);
|
|
996
954
|
}
|
|
997
955
|
getSelectedItems() {
|
|
998
956
|
return this.selectionHandler.getSelectedItems();
|
|
@@ -1012,10 +970,10 @@ class G extends g {
|
|
|
1012
970
|
this.selectionHandler.destroy(), (e = this.ownedItemsEmitter) == null || e.dispose();
|
|
1013
971
|
}
|
|
1014
972
|
}
|
|
1015
|
-
|
|
973
|
+
o(Q, "dependencies", [M]), o(Q, "hostName", "list-view"), o(Q, "standaloneHostName", "list-view"), o(Q, "baseStyles", [
|
|
1016
974
|
["&", "inputlike"],
|
|
1017
|
-
['& > [
|
|
1018
|
-
]),
|
|
975
|
+
['& > [role="listbox"] > [role="option"]', "inputline"]
|
|
976
|
+
]), o(Q, "css", S`
|
|
1019
977
|
& {
|
|
1020
978
|
display: flex;
|
|
1021
979
|
flex-direction: column;
|
|
@@ -1023,127 +981,110 @@ s(G, "dependencies", [H]), s(G, "hostName", "list-view"), s(G, "standaloneHostNa
|
|
|
1023
981
|
min-height: 0;
|
|
1024
982
|
}
|
|
1025
983
|
|
|
1026
|
-
& > [
|
|
984
|
+
& > [role="listbox"],
|
|
1027
985
|
& > [data-part="loading"] {
|
|
1028
986
|
display: flex;
|
|
1029
987
|
flex-direction: column;
|
|
1030
988
|
}
|
|
1031
989
|
|
|
1032
|
-
& > [
|
|
990
|
+
& > [role="listbox"] > [role="option"] {
|
|
1033
991
|
cursor: default;
|
|
1034
992
|
user-select: none;
|
|
1035
993
|
}
|
|
1036
994
|
|
|
1037
|
-
& > [
|
|
1038
|
-
& > [
|
|
1039
|
-
background: var(--button-background-hover);
|
|
1040
|
-
outline: 2px solid var(--ui-accent-color);
|
|
1041
|
-
outline-offset: -2px;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
& > [data-part="list"] > [data-part="row"][aria-selected="true"] {
|
|
1045
|
-
color: var(--toggle-selected-text);
|
|
1046
|
-
background: var(--toggle-selected-bg);
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
& > [data-part="empty"],
|
|
1050
|
-
& > [data-part="error"] {
|
|
995
|
+
& > [role="status"],
|
|
996
|
+
& > [role="alert"] {
|
|
1051
997
|
margin: 0;
|
|
1052
998
|
padding: var(--ui-padding);
|
|
1053
999
|
}
|
|
1054
|
-
|
|
1055
|
-
& > [data-part="error"] {
|
|
1056
|
-
color: var(--error-color);
|
|
1057
|
-
}
|
|
1058
1000
|
`);
|
|
1059
|
-
function
|
|
1060
|
-
if (t == null) return
|
|
1001
|
+
function ut(t) {
|
|
1002
|
+
if (t == null) return Se;
|
|
1061
1003
|
if (typeof t == "function") return t;
|
|
1062
1004
|
if (typeof t == "string" && t.length > 0)
|
|
1063
1005
|
return (r, e) => {
|
|
1064
1006
|
if (r == null || typeof r != "object" && typeof r != "function")
|
|
1065
1007
|
throw new TypeError(`ListView item at index ${e} lacks ${t}`);
|
|
1066
|
-
const
|
|
1067
|
-
if (
|
|
1008
|
+
const i = Reflect.get(r, t);
|
|
1009
|
+
if (i == null)
|
|
1068
1010
|
throw new TypeError(`ListView item at index ${e} lacks ${t}`);
|
|
1069
|
-
return
|
|
1011
|
+
return i;
|
|
1070
1012
|
};
|
|
1071
1013
|
throw new TypeError("ListView itemKey must be a function or property name");
|
|
1072
1014
|
}
|
|
1073
|
-
function
|
|
1015
|
+
function ht(t) {
|
|
1074
1016
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
1075
1017
|
}
|
|
1076
|
-
function
|
|
1018
|
+
function pt(t) {
|
|
1077
1019
|
if (t != null && (typeof t == "object" || typeof t == "function")) {
|
|
1078
1020
|
const r = Reflect.get(t, "label");
|
|
1079
|
-
if (
|
|
1021
|
+
if (mt(r)) return r;
|
|
1080
1022
|
}
|
|
1081
1023
|
return String(t);
|
|
1082
1024
|
}
|
|
1083
|
-
function
|
|
1025
|
+
function mt(t) {
|
|
1084
1026
|
return t == null || typeof t == "string" || typeof t == "number";
|
|
1085
1027
|
}
|
|
1086
1028
|
function ft(t, r) {
|
|
1087
1029
|
return t instanceof Error ? t.message : t == null ? r : String(t);
|
|
1088
1030
|
}
|
|
1089
|
-
class D extends
|
|
1031
|
+
class D extends y {
|
|
1090
1032
|
constructor(e = {}) {
|
|
1091
1033
|
super(e);
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
const
|
|
1096
|
-
this.symbols = e.symbols ??
|
|
1097
|
-
const
|
|
1098
|
-
n.defaultValue == null && e.initialSemanticState != null && (n.defaultValue = e.initialSemanticState), this.valueEmitter =
|
|
1034
|
+
o(this, "symbols");
|
|
1035
|
+
o(this, "valueEmitter");
|
|
1036
|
+
o(this, "semanticStateEmitter");
|
|
1037
|
+
const i = this.constructor;
|
|
1038
|
+
this.symbols = e.symbols ?? i.symbols, bt(this.symbols);
|
|
1039
|
+
const s = e.initialSemanticState ?? i.defaultSemanticState ?? this.symbols[0][1], n = { ...e };
|
|
1040
|
+
n.defaultValue == null && e.initialSemanticState != null && (n.defaultValue = e.initialSemanticState), this.valueEmitter = z(
|
|
1099
1041
|
this,
|
|
1100
1042
|
n,
|
|
1101
|
-
|
|
1043
|
+
s,
|
|
1102
1044
|
"checkbox semantic state"
|
|
1103
1045
|
), this.semanticStateEmitter = this.valueEmitter;
|
|
1104
1046
|
}
|
|
1105
1047
|
initialize() {
|
|
1106
1048
|
this.watch(this.valueEmitter);
|
|
1107
1049
|
}
|
|
1108
|
-
cycleState(e = 1,
|
|
1050
|
+
cycleState(e = 1, i = null) {
|
|
1109
1051
|
if (this.props.disabled) return;
|
|
1110
|
-
const
|
|
1111
|
-
this.valueEmitter.set(l, "checkbox state changed"),
|
|
1052
|
+
const s = this.symbols.findIndex(([, c]) => Object.is(c, this.valueEmitter.get())), a = ((s < 0 ? 0 : s) + e + this.symbols.length) % this.symbols.length, l = this.symbols[a][1];
|
|
1053
|
+
this.valueEmitter.set(l, "checkbox state changed"), K(this.props.onChange, l, i);
|
|
1112
1054
|
}
|
|
1113
1055
|
render() {
|
|
1114
1056
|
const {
|
|
1115
1057
|
label: e = this.props.value ?? "Option",
|
|
1116
|
-
disabled:
|
|
1117
|
-
required:
|
|
1058
|
+
disabled: i = !1,
|
|
1059
|
+
required: s = !1,
|
|
1118
1060
|
name: n,
|
|
1119
|
-
value:
|
|
1120
|
-
} = this.props, l = this.valueEmitter.get(),
|
|
1061
|
+
value: a
|
|
1062
|
+
} = this.props, l = this.valueEmitter.get(), c = this.symbols.findIndex(([, m]) => Object.is(m, l)), [h] = this.symbols[c] ?? ["?", l], p = it(l), f = l === b.Prefer || l === b.Require || this.symbols.length === 2 && c === 1, g = this.Host;
|
|
1121
1063
|
return /* @__PURE__ */ u(
|
|
1122
|
-
|
|
1064
|
+
g,
|
|
1123
1065
|
{
|
|
1124
1066
|
className: E(this.props) || null,
|
|
1125
|
-
"data-disabled":
|
|
1126
|
-
"data-required":
|
|
1127
|
-
"data-state":
|
|
1067
|
+
"data-disabled": i ? "" : null,
|
|
1068
|
+
"data-required": s ? "" : null,
|
|
1069
|
+
"data-state": p,
|
|
1128
1070
|
children: /* @__PURE__ */ w(
|
|
1129
1071
|
"button",
|
|
1130
1072
|
{
|
|
1131
1073
|
type: "button",
|
|
1132
1074
|
role: "checkbox",
|
|
1133
|
-
disabled:
|
|
1075
|
+
disabled: i,
|
|
1134
1076
|
name: n,
|
|
1135
|
-
value:
|
|
1136
|
-
"
|
|
1137
|
-
"aria-
|
|
1138
|
-
"aria-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
p.key === "ArrowRight" || p.key === "ArrowDown" ? (p.preventDefault(), this.cycleState(1, p)) : (p.key === "ArrowLeft" || p.key === "ArrowUp") && (p.preventDefault(), this.cycleState(-1, p));
|
|
1077
|
+
value: a == null ? void 0 : String(a),
|
|
1078
|
+
"aria-checked": f ? "true" : "false",
|
|
1079
|
+
"aria-required": s ? "true" : null,
|
|
1080
|
+
"aria-label": `${e}: ${p}`,
|
|
1081
|
+
onClick: (m) => this.cycleState(1, m),
|
|
1082
|
+
onKeyDown: (m) => {
|
|
1083
|
+
m.key === "ArrowRight" || m.key === "ArrowDown" ? (m.preventDefault(), this.cycleState(1, m)) : (m.key === "ArrowLeft" || m.key === "ArrowUp") && (m.preventDefault(), this.cycleState(-1, m));
|
|
1143
1084
|
},
|
|
1144
1085
|
children: [
|
|
1145
|
-
/* @__PURE__ */ u("span", {
|
|
1146
|
-
/* @__PURE__ */ u("span", {
|
|
1086
|
+
/* @__PURE__ */ u("span", { className: "inputshell", "aria-hidden": "true", children: h }),
|
|
1087
|
+
/* @__PURE__ */ u("span", { children: e })
|
|
1147
1088
|
]
|
|
1148
1089
|
}
|
|
1149
1090
|
)
|
|
@@ -1151,15 +1092,14 @@ class D extends g {
|
|
|
1151
1092
|
);
|
|
1152
1093
|
}
|
|
1153
1094
|
}
|
|
1154
|
-
|
|
1095
|
+
o(D, "symbols", [
|
|
1155
1096
|
["☐", b.Neutral],
|
|
1156
1097
|
["✓", b.Prefer]
|
|
1157
|
-
]),
|
|
1098
|
+
]), o(D, "defaultSemanticState", b.Neutral), o(D, "hostName", "checkbox"), o(D, "standaloneHostName", "check-box"), o(D, "baseStyles", [
|
|
1158
1099
|
["&", ["inputline"]],
|
|
1159
|
-
['& > [
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
& > [data-part="control"] {
|
|
1100
|
+
['& > [role="checkbox"]', ["input", "inputline"]]
|
|
1101
|
+
]), o(D, "css", S`
|
|
1102
|
+
& > [role="checkbox"] {
|
|
1163
1103
|
display: inline-flex;
|
|
1164
1104
|
align-items: center;
|
|
1165
1105
|
gap: 0.35em;
|
|
@@ -1167,66 +1107,55 @@ s(D, "symbols", [
|
|
|
1167
1107
|
font-family: inherit;
|
|
1168
1108
|
}
|
|
1169
1109
|
|
|
1170
|
-
&
|
|
1110
|
+
& .inputshell {
|
|
1171
1111
|
display: inline-grid;
|
|
1172
1112
|
width: 1em;
|
|
1173
1113
|
height: 1em;
|
|
1174
1114
|
line-height: 1;
|
|
1175
1115
|
place-items: center;
|
|
1176
|
-
color: var(--fray-checkbox-symbol-color, currentColor);
|
|
1177
|
-
background: var(--fray-checkbox-box-background, transparent);
|
|
1178
|
-
border: var(--fray-checkbox-box-border, var(--cbx-o-border));
|
|
1179
|
-
border-radius: var(--cbx-border-radius, var(--fray-radius-sm));
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
& [data-part="control"][aria-checked="true"] [data-part="symbol"] {
|
|
1183
|
-
background: var(
|
|
1184
|
-
--fray-checkbox-box-background-checked,
|
|
1185
|
-
var(--fray-selection-background)
|
|
1186
|
-
);
|
|
1187
1116
|
}
|
|
1188
1117
|
`);
|
|
1189
|
-
function
|
|
1118
|
+
function bt(t) {
|
|
1190
1119
|
if (!Array.isArray(t) || t.length === 0)
|
|
1191
1120
|
throw new TypeError("Checkbox symbols must be a non-empty tuple array");
|
|
1192
1121
|
for (const r of t)
|
|
1193
1122
|
if (!Array.isArray(r) || r.length < 2)
|
|
1194
1123
|
throw new TypeError("Checkbox symbols must be [symbol, state] tuples");
|
|
1195
1124
|
}
|
|
1196
|
-
class
|
|
1125
|
+
class U extends y {
|
|
1197
1126
|
constructor(e = {}) {
|
|
1198
1127
|
super(e);
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
this.optionsEmitter =
|
|
1128
|
+
o(this, "optionsEmitter");
|
|
1129
|
+
o(this, "optionStateEmitters", /* @__PURE__ */ new Map());
|
|
1130
|
+
o(this, "staleOptionValues", /* @__PURE__ */ new Set());
|
|
1131
|
+
o(this, "placementTimer", null);
|
|
1132
|
+
this.optionsEmitter = St(e.options) ? e.options : null;
|
|
1204
1133
|
}
|
|
1205
1134
|
initialize() {
|
|
1206
1135
|
this.optionsEmitter && this.watch(this.optionsEmitter);
|
|
1207
1136
|
}
|
|
1208
1137
|
render() {
|
|
1209
|
-
var
|
|
1210
|
-
const e = ((
|
|
1138
|
+
var p, f, g;
|
|
1139
|
+
const e = ((p = this.optionsEmitter) == null ? void 0 : p.get()) ?? (Array.isArray(this.props.options) ? this.props.options : []);
|
|
1211
1140
|
if (!Array.isArray(e))
|
|
1212
1141
|
throw new TypeError("FilterPanel options must be an array or emitter of arrays");
|
|
1213
|
-
const
|
|
1142
|
+
const i = ((f = this.optionsEmitter) == null ? void 0 : f.getFetchState()) ?? k.Ready, s = (g = this.optionsEmitter) == null ? void 0 : g.getError(), n = $e(this.props.filters), a = this.props.filterModes ?? D.symbols, l = this.props.defaultSemanticState ?? b.Neutral, c = new Set(e.map(be));
|
|
1214
1143
|
this.staleOptionValues = new Set(
|
|
1215
|
-
[...this.optionStateEmitters.keys()].filter((
|
|
1144
|
+
[...this.optionStateEmitters.keys()].filter((m) => !c.has(m))
|
|
1216
1145
|
);
|
|
1217
1146
|
const h = this.Host;
|
|
1218
|
-
return
|
|
1147
|
+
return i === k.Error ? /* @__PURE__ */ u(
|
|
1219
1148
|
h,
|
|
1220
1149
|
{
|
|
1221
|
-
className: E(this.props)
|
|
1150
|
+
className: R("panellike", E(this.props)),
|
|
1222
1151
|
role: "alert",
|
|
1223
1152
|
"data-state": "error",
|
|
1224
|
-
children:
|
|
1153
|
+
children: It(s, "Unable to load filter options")
|
|
1225
1154
|
}
|
|
1226
|
-
) : (
|
|
1155
|
+
) : (i === k.Initial || i === k.Loading) && e.length === 0 ? /* @__PURE__ */ u(
|
|
1227
1156
|
h,
|
|
1228
1157
|
{
|
|
1229
|
-
className: E(this.props)
|
|
1158
|
+
className: R("panellike", E(this.props)),
|
|
1230
1159
|
role: "status",
|
|
1231
1160
|
"data-state": "loading",
|
|
1232
1161
|
children: "Loading filter options…"
|
|
@@ -1234,34 +1163,34 @@ class V extends g {
|
|
|
1234
1163
|
) : /* @__PURE__ */ u(
|
|
1235
1164
|
h,
|
|
1236
1165
|
{
|
|
1237
|
-
className: E(this.props)
|
|
1166
|
+
className: R("panellike", E(this.props)),
|
|
1238
1167
|
role: "group",
|
|
1239
1168
|
"aria-label": this.props.label ?? "Filter options",
|
|
1240
|
-
children: e.length === 0 ? /* @__PURE__ */ u("span", { children: "No filter options" }) : e.map((
|
|
1241
|
-
const
|
|
1169
|
+
children: e.length === 0 ? /* @__PURE__ */ u("span", { children: "No filter options" }) : e.map((m) => {
|
|
1170
|
+
const I = be(m), v = yt(m), O = n.get(I) ?? l, C = this.optionEmitter(I, O);
|
|
1242
1171
|
return /* @__PURE__ */ u(
|
|
1243
|
-
|
|
1172
|
+
gt,
|
|
1244
1173
|
{
|
|
1245
|
-
label:
|
|
1246
|
-
valueEmitter:
|
|
1247
|
-
symbols:
|
|
1248
|
-
onChange: (
|
|
1249
|
-
var T,
|
|
1174
|
+
label: v,
|
|
1175
|
+
valueEmitter: C,
|
|
1176
|
+
symbols: a,
|
|
1177
|
+
onChange: (j, A) => {
|
|
1178
|
+
var T, G;
|
|
1250
1179
|
A == null || A.stopPropagation();
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1180
|
+
const H = $e(this.props.filters);
|
|
1181
|
+
j === b.Neutral ? H.delete(I) : H.set(I, j), (G = (T = this.props).onChange) == null || G.call(T, H, A);
|
|
1253
1182
|
}
|
|
1254
1183
|
},
|
|
1255
|
-
|
|
1184
|
+
wt(I)
|
|
1256
1185
|
);
|
|
1257
1186
|
})
|
|
1258
1187
|
}
|
|
1259
1188
|
);
|
|
1260
1189
|
}
|
|
1261
1190
|
afterUpdate(e) {
|
|
1262
|
-
var
|
|
1263
|
-
for (const
|
|
1264
|
-
(
|
|
1191
|
+
var i;
|
|
1192
|
+
for (const s of this.staleOptionValues)
|
|
1193
|
+
(i = this.optionStateEmitters.get(s)) == null || i.dispose(), this.optionStateEmitters.delete(s);
|
|
1265
1194
|
this.staleOptionValues.clear(), this.placementTimer != null && clearTimeout(this.placementTimer), this.placementTimer = setTimeout(() => {
|
|
1266
1195
|
this.placementTimer = null, this.placeInsideViewport(e);
|
|
1267
1196
|
}, 0);
|
|
@@ -1271,26 +1200,26 @@ class V extends g {
|
|
|
1271
1200
|
for (const e of this.optionStateEmitters.values()) e.dispose();
|
|
1272
1201
|
this.optionStateEmitters.clear();
|
|
1273
1202
|
}
|
|
1274
|
-
optionEmitter(e,
|
|
1275
|
-
const
|
|
1276
|
-
if (
|
|
1277
|
-
return
|
|
1278
|
-
const n = new
|
|
1203
|
+
optionEmitter(e, i) {
|
|
1204
|
+
const s = this.optionStateEmitters.get(e);
|
|
1205
|
+
if (s != null)
|
|
1206
|
+
return s.get() !== i && s.set(i, "filter option synchronized"), s;
|
|
1207
|
+
const n = new x(i, { owner: this, purpose: `filter option ${String(e)}` });
|
|
1279
1208
|
return this.optionStateEmitters.set(e, n), n;
|
|
1280
1209
|
}
|
|
1281
1210
|
placeInsideViewport(e) {
|
|
1282
1211
|
if (!(e instanceof HTMLElement) || e.parentElement == null) return;
|
|
1283
|
-
const
|
|
1284
|
-
if (
|
|
1285
|
-
const
|
|
1212
|
+
const i = e.ownerDocument.defaultView;
|
|
1213
|
+
if (i == null || i.innerHeight <= 0) return;
|
|
1214
|
+
const s = e.parentElement.getBoundingClientRect();
|
|
1286
1215
|
e.style.removeProperty("max-height");
|
|
1287
|
-
const n = e.getBoundingClientRect(),
|
|
1288
|
-
|
|
1289
|
-
const h =
|
|
1216
|
+
const n = e.getBoundingClientRect(), a = s.top, l = Math.max(0, i.innerHeight - s.bottom), c = n.height > l && a > l;
|
|
1217
|
+
c ? (e.dataset.placement = "above", e.style.insetBlockStart = `${Math.max(8, s.top - n.height)}px`) : (delete e.dataset.placement, e.style.insetBlockStart = `${s.bottom}px`), e.style.insetInlineEnd = `${Math.max(8, i.innerWidth - s.right)}px`;
|
|
1218
|
+
const h = c ? a : l;
|
|
1290
1219
|
e.style.maxHeight = `${Math.max(48, h - 8)}px`;
|
|
1291
1220
|
}
|
|
1292
1221
|
}
|
|
1293
|
-
|
|
1222
|
+
o(U, "dependencies", [D]), o(U, "hostName", "filter-panel"), o(U, "standaloneHostName", "filter-panel"), o(U, "css", S`
|
|
1294
1223
|
& {
|
|
1295
1224
|
position: fixed;
|
|
1296
1225
|
z-index: 1100;
|
|
@@ -1301,23 +1230,18 @@ s(V, "dependencies", [D]), s(V, "hostName", "filter-panel"), s(V, "standaloneHos
|
|
|
1301
1230
|
padding: var(--ui-padding);
|
|
1302
1231
|
flex-flow: column nowrap;
|
|
1303
1232
|
align-items: stretch;
|
|
1304
|
-
color: var(--panel-color);
|
|
1305
|
-
background: var(--panel-bg);
|
|
1306
|
-
border: var(--panel-border);
|
|
1307
|
-
border-radius: var(--panel-radius);
|
|
1308
|
-
box-shadow: var(--panel-shadow);
|
|
1309
1233
|
overflow-y: auto;
|
|
1310
1234
|
}
|
|
1311
1235
|
|
|
1312
1236
|
`);
|
|
1313
|
-
const
|
|
1314
|
-
function
|
|
1237
|
+
const gt = D;
|
|
1238
|
+
function $e(t) {
|
|
1315
1239
|
if (t == null) return /* @__PURE__ */ new Map();
|
|
1316
1240
|
if (t instanceof Map) return new Map(t);
|
|
1317
1241
|
if (Array.isArray(t)) return new Map(t);
|
|
1318
1242
|
throw new TypeError("FilterPanel filters must be a Map or tuple array");
|
|
1319
1243
|
}
|
|
1320
|
-
function
|
|
1244
|
+
function be(t) {
|
|
1321
1245
|
if (typeof t == "string" || typeof t == "number") return t;
|
|
1322
1246
|
if (t != null && typeof t == "object") {
|
|
1323
1247
|
const r = Reflect.get(t, "value");
|
|
@@ -1325,30 +1249,30 @@ function pe(t) {
|
|
|
1325
1249
|
}
|
|
1326
1250
|
throw new TypeError("Filter options must be strings, numbers, or value/label objects");
|
|
1327
1251
|
}
|
|
1328
|
-
function
|
|
1252
|
+
function yt(t) {
|
|
1329
1253
|
if (t != null && typeof t == "object") {
|
|
1330
1254
|
const r = Reflect.get(t, "label");
|
|
1331
|
-
if (r != null) return
|
|
1255
|
+
if (r != null) return Et(r) ? r : String(r);
|
|
1332
1256
|
}
|
|
1333
|
-
return String(
|
|
1257
|
+
return String(be(t));
|
|
1334
1258
|
}
|
|
1335
|
-
function
|
|
1259
|
+
function wt(t) {
|
|
1336
1260
|
return `${typeof t}:${String(t)}`;
|
|
1337
1261
|
}
|
|
1338
|
-
function
|
|
1262
|
+
function Et(t) {
|
|
1339
1263
|
return typeof t == "string" || typeof t == "number";
|
|
1340
1264
|
}
|
|
1341
|
-
function
|
|
1265
|
+
function St(t) {
|
|
1342
1266
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
1343
1267
|
}
|
|
1344
|
-
function
|
|
1268
|
+
function It(t, r) {
|
|
1345
1269
|
return t instanceof Error ? t.message : t == null ? r : String(t);
|
|
1346
1270
|
}
|
|
1347
|
-
class
|
|
1271
|
+
class J extends y {
|
|
1348
1272
|
constructor() {
|
|
1349
1273
|
super(...arguments);
|
|
1350
|
-
|
|
1351
|
-
|
|
1274
|
+
o(this, "filterVisible", !1);
|
|
1275
|
+
o(this, "onGlobalClick", (e) => {
|
|
1352
1276
|
this.filterVisible && this.dom instanceof Node && e.target instanceof Node && !this.dom.contains(e.target) && (this.filterVisible = !1, this.update());
|
|
1353
1277
|
});
|
|
1354
1278
|
}
|
|
@@ -1358,29 +1282,29 @@ class W extends g {
|
|
|
1358
1282
|
toggleSort() {
|
|
1359
1283
|
if (!this.props.sortable) return;
|
|
1360
1284
|
const e = this.props.sortEmitter.get();
|
|
1361
|
-
let
|
|
1362
|
-
(e == null ? void 0 : e.field) !== this.props.field ?
|
|
1285
|
+
let i;
|
|
1286
|
+
(e == null ? void 0 : e.field) !== this.props.field ? i = { field: this.props.field, direction: "asc" } : e.direction === "asc" ? i = { field: this.props.field, direction: "desc" } : i = null, this.props.sortEmitter.set(i, "table sort changed");
|
|
1363
1287
|
}
|
|
1364
1288
|
toggleFilterPanel(e) {
|
|
1365
1289
|
e.stopPropagation(), this.filterVisible = !this.filterVisible, this.update();
|
|
1366
1290
|
}
|
|
1367
|
-
updateFilters(e,
|
|
1368
|
-
var n,
|
|
1369
|
-
const
|
|
1370
|
-
e.size === 0 ? delete
|
|
1291
|
+
updateFilters(e, i) {
|
|
1292
|
+
var n, a;
|
|
1293
|
+
const s = { ...this.props.filtersEmitter.get() };
|
|
1294
|
+
e.size === 0 ? delete s[this.props.field] : s[this.props.field] = [...e.entries()], this.props.filtersEmitter.set(s, "table filters changed"), (a = (n = this.props).onFilterChange) == null || a.call(n, s, i);
|
|
1371
1295
|
}
|
|
1372
1296
|
render() {
|
|
1373
|
-
const e = this.props.sortEmitter.get(),
|
|
1374
|
-
(this.props.filtersEmitter.get()[this.props.field] ?? []).filter(
|
|
1375
|
-
), n = this.props.label ?? String(this.props.field),
|
|
1297
|
+
const e = this.props.sortEmitter.get(), i = (e == null ? void 0 : e.field) === this.props.field ? e.direction : null, s = new Map(
|
|
1298
|
+
(this.props.filtersEmitter.get()[this.props.field] ?? []).filter(kt)
|
|
1299
|
+
), n = this.props.label ?? String(this.props.field), a = `Filter ${String(n)}`;
|
|
1376
1300
|
let l = null;
|
|
1377
1301
|
return this.filterVisible && this.props.filterOptions != null && (l = /* @__PURE__ */ u(
|
|
1378
|
-
|
|
1302
|
+
U,
|
|
1379
1303
|
{
|
|
1380
|
-
label:
|
|
1304
|
+
label: a,
|
|
1381
1305
|
options: this.props.filterOptions,
|
|
1382
|
-
filters:
|
|
1383
|
-
onChange: (
|
|
1306
|
+
filters: s,
|
|
1307
|
+
onChange: (c, h) => this.updateFilters(c, h),
|
|
1384
1308
|
...this.props.filterModes == null ? {} : { filterModes: this.props.filterModes },
|
|
1385
1309
|
...this.props.defaultSemanticState == null ? {} : { defaultSemanticState: this.props.defaultSemanticState }
|
|
1386
1310
|
},
|
|
@@ -1390,7 +1314,7 @@ class W extends g {
|
|
|
1390
1314
|
{
|
|
1391
1315
|
scope: "col",
|
|
1392
1316
|
"data-fray-component": "table-header-cell",
|
|
1393
|
-
"aria-sort":
|
|
1317
|
+
"aria-sort": i === "asc" ? "ascending" : i === "desc" ? "descending" : "none",
|
|
1394
1318
|
style: { zIndex: this.filterVisible ? 1200 : null },
|
|
1395
1319
|
children: [
|
|
1396
1320
|
this.props.sortable ? /* @__PURE__ */ w(
|
|
@@ -1401,18 +1325,18 @@ class W extends g {
|
|
|
1401
1325
|
onClick: () => this.toggleSort(),
|
|
1402
1326
|
children: [
|
|
1403
1327
|
n,
|
|
1404
|
-
|
|
1328
|
+
i === "asc" ? " ▲" : i === "desc" ? " ▼" : ""
|
|
1405
1329
|
]
|
|
1406
1330
|
}
|
|
1407
|
-
) : /* @__PURE__ */ u("span", {
|
|
1331
|
+
) : /* @__PURE__ */ u("span", { children: n }),
|
|
1408
1332
|
this.props.filterOptions == null ? null : /* @__PURE__ */ u(
|
|
1409
1333
|
"button",
|
|
1410
1334
|
{
|
|
1411
1335
|
type: "button",
|
|
1412
1336
|
"data-part": "filter-toggle",
|
|
1413
|
-
"aria-label":
|
|
1337
|
+
"aria-label": a,
|
|
1414
1338
|
"aria-expanded": String(this.filterVisible),
|
|
1415
|
-
onClick: (
|
|
1339
|
+
onClick: (c) => this.toggleFilterPanel(c),
|
|
1416
1340
|
children: "Filter"
|
|
1417
1341
|
}
|
|
1418
1342
|
),
|
|
@@ -1422,49 +1346,34 @@ class W extends g {
|
|
|
1422
1346
|
);
|
|
1423
1347
|
}
|
|
1424
1348
|
}
|
|
1425
|
-
|
|
1426
|
-
[
|
|
1427
|
-
['th[
|
|
1428
|
-
['th[
|
|
1429
|
-
]),
|
|
1430
|
-
th[
|
|
1349
|
+
o(J, "dependencies", [U]), o(J, "baseStyles", [
|
|
1350
|
+
["th[aria-sort]", "noselect"],
|
|
1351
|
+
['th[aria-sort] > [data-part="sort"]', ["uiline", "button"]],
|
|
1352
|
+
['th[aria-sort] > [data-part="filter-toggle"]', ["uiline", "button"]]
|
|
1353
|
+
]), o(J, "css", S`
|
|
1354
|
+
th[aria-sort] {
|
|
1431
1355
|
position: relative;
|
|
1432
1356
|
text-align: start;
|
|
1433
|
-
color: var(
|
|
1434
|
-
--fray-table-header-color,
|
|
1435
|
-
var(--fray-section-header-color, var(--fray-header-color))
|
|
1436
|
-
);
|
|
1437
|
-
background: var(
|
|
1438
|
-
--fray-table-header-background,
|
|
1439
|
-
var(--fray-section-header-background, var(--fray-header-background))
|
|
1440
|
-
);
|
|
1441
|
-
border-block-end: var(--fray-section-header-border, var(--fray-header-border));
|
|
1442
|
-
box-shadow: var(--fray-section-header-shadow, var(--fray-header-shadow));
|
|
1443
1357
|
}
|
|
1444
1358
|
|
|
1445
|
-
th[
|
|
1446
|
-
th[
|
|
1359
|
+
th[aria-sort] > [data-part="sort"],
|
|
1360
|
+
th[aria-sort] > [data-part="filter-toggle"] {
|
|
1447
1361
|
width: auto;
|
|
1448
1362
|
font-family: inherit;
|
|
1449
|
-
color: inherit;
|
|
1450
|
-
background: var(
|
|
1451
|
-
--fray-table-header-button-background,
|
|
1452
|
-
var(--fray-button-background)
|
|
1453
|
-
);
|
|
1454
1363
|
}
|
|
1455
1364
|
|
|
1456
|
-
th[
|
|
1365
|
+
th[aria-sort] > [data-part="filter-toggle"] {
|
|
1457
1366
|
margin-inline-start: var(--ui-padding-h);
|
|
1458
1367
|
font-size: 0.75em;
|
|
1459
1368
|
}
|
|
1460
1369
|
`);
|
|
1461
|
-
function
|
|
1370
|
+
function kt(t) {
|
|
1462
1371
|
return typeof t[0] == "string" || typeof t[0] == "number";
|
|
1463
1372
|
}
|
|
1464
|
-
class
|
|
1373
|
+
class ge extends y {
|
|
1465
1374
|
render() {
|
|
1466
1375
|
return /* @__PURE__ */ u("thead", { "data-fray-component": "table-header", children: /* @__PURE__ */ u("tr", { children: this.props.columns.map((r) => /* @__PURE__ */ u(
|
|
1467
|
-
|
|
1376
|
+
J,
|
|
1468
1377
|
{
|
|
1469
1378
|
field: r.field,
|
|
1470
1379
|
sortEmitter: this.props.sortEmitter,
|
|
@@ -1480,139 +1389,139 @@ class me extends g {
|
|
|
1480
1389
|
)) }) });
|
|
1481
1390
|
}
|
|
1482
1391
|
}
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1392
|
+
o(ge, "dependencies", [J]);
|
|
1393
|
+
const xt = {
|
|
1485
1394
|
[b.Neutral]: "☐",
|
|
1486
1395
|
[b.Prefer]: "",
|
|
1487
1396
|
[b.Require]: "_",
|
|
1488
1397
|
[b.Deny]: "!"
|
|
1489
1398
|
};
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1492
|
-
for (const [
|
|
1493
|
-
for (const [n,
|
|
1494
|
-
if (!
|
|
1495
|
-
throw new TypeError(`Unknown filter mode for ${
|
|
1399
|
+
function vt(t, { sort: r = null, filters: e = {} } = {}) {
|
|
1400
|
+
Dt(t), r != null && (Qe(r), t.searchParams.set("sort", `${r.field}:${r.direction}`));
|
|
1401
|
+
for (const [i, s] of Object.entries(e))
|
|
1402
|
+
for (const [n, a] of s) {
|
|
1403
|
+
if (!le(a))
|
|
1404
|
+
throw new TypeError(`Unknown filter mode for ${i}: ${String(a)}`);
|
|
1496
1405
|
t.searchParams.append(
|
|
1497
1406
|
"filter",
|
|
1498
|
-
`${
|
|
1407
|
+
`${i}:${xt[a]}:${JSON.stringify(n)}`
|
|
1499
1408
|
);
|
|
1500
1409
|
}
|
|
1501
1410
|
return t;
|
|
1502
1411
|
}
|
|
1503
|
-
function
|
|
1412
|
+
function Tt(t, r, e) {
|
|
1504
1413
|
if (!Array.isArray(t)) throw new TypeError("Local table data must be an array");
|
|
1505
|
-
const
|
|
1506
|
-
if (r == null) return
|
|
1507
|
-
|
|
1508
|
-
const
|
|
1509
|
-
return [...
|
|
1510
|
-
}
|
|
1511
|
-
function
|
|
1512
|
-
for (const [e,
|
|
1513
|
-
const
|
|
1514
|
-
if (
|
|
1515
|
-
const
|
|
1516
|
-
if (
|
|
1517
|
-
const l =
|
|
1518
|
-
if (l.length > 0 && !l.some(([
|
|
1414
|
+
const i = t.filter((n) => Rt(n, e));
|
|
1415
|
+
if (r == null) return i;
|
|
1416
|
+
Qe(r);
|
|
1417
|
+
const s = r.direction === "asc" ? 1 : -1;
|
|
1418
|
+
return [...i].sort((n, a) => $t(ye(n, r.field), ye(a, r.field)) * s);
|
|
1419
|
+
}
|
|
1420
|
+
function Rt(t, r) {
|
|
1421
|
+
for (const [e, i] of Object.entries(r)) {
|
|
1422
|
+
const s = ye(t, e);
|
|
1423
|
+
if (i.filter(([, c]) => c === b.Deny).some(([c]) => Object.is(c, s))) return !1;
|
|
1424
|
+
const a = i.filter(([, c]) => c === b.Require);
|
|
1425
|
+
if (a.length > 0 && !a.some(([c]) => Object.is(c, s))) return !1;
|
|
1426
|
+
const l = i.filter(([, c]) => c === b.Prefer);
|
|
1427
|
+
if (l.length > 0 && !l.some(([c]) => Object.is(c, s))) return !1;
|
|
1519
1428
|
}
|
|
1520
1429
|
return !0;
|
|
1521
1430
|
}
|
|
1522
|
-
function
|
|
1523
|
-
if (t == null || typeof t != "object" || typeof Reflect.get(t, "field") != "string" || !
|
|
1431
|
+
function Qe(t) {
|
|
1432
|
+
if (t == null || typeof t != "object" || typeof Reflect.get(t, "field") != "string" || !Nt(Reflect.get(t, "direction")))
|
|
1524
1433
|
throw new TypeError("Table sort must contain a field and asc/desc direction");
|
|
1525
1434
|
}
|
|
1526
|
-
function
|
|
1435
|
+
function Nt(t) {
|
|
1527
1436
|
return t === "asc" || t === "desc";
|
|
1528
1437
|
}
|
|
1529
|
-
function
|
|
1438
|
+
function $t(t, r) {
|
|
1530
1439
|
return Object.is(t, r) ? 0 : t == null ? -1 : r == null ? 1 : typeof t == "number" && typeof r == "number" ? t - r : String(t).localeCompare(String(r));
|
|
1531
1440
|
}
|
|
1532
|
-
function
|
|
1441
|
+
function ye(t, r) {
|
|
1533
1442
|
if (!(t == null || typeof t != "object" && typeof t != "function"))
|
|
1534
1443
|
return Reflect.get(t, r);
|
|
1535
1444
|
}
|
|
1536
|
-
function
|
|
1445
|
+
function Dt(t) {
|
|
1537
1446
|
if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "toString") != "function")
|
|
1538
1447
|
throw new TypeError("Table serializer requires a URL");
|
|
1539
1448
|
const r = Reflect.get(t, "searchParams");
|
|
1540
1449
|
if (r == null || typeof Reflect.get(r, "set") != "function" || typeof Reflect.get(r, "append") != "function")
|
|
1541
1450
|
throw new TypeError("Table serializer requires URL search parameters");
|
|
1542
1451
|
}
|
|
1543
|
-
function
|
|
1544
|
-
const r =
|
|
1452
|
+
function Ot(t) {
|
|
1453
|
+
const r = ke(t), e = We(t.data) ? null : new x(t.data, {
|
|
1545
1454
|
owner: t.owner,
|
|
1546
1455
|
purpose: "local table data"
|
|
1547
|
-
}),
|
|
1548
|
-
[
|
|
1549
|
-
([n,
|
|
1456
|
+
}), i = e ?? t.data, s = new ae(
|
|
1457
|
+
[i, r.sortEmitter, r.filtersEmitter],
|
|
1458
|
+
([n, a, l]) => Tt(n, a, l),
|
|
1550
1459
|
{ owner: t.owner, purpose: "local table view" }
|
|
1551
1460
|
);
|
|
1552
|
-
return new
|
|
1553
|
-
|
|
1461
|
+
return new Ie(s, r, () => {
|
|
1462
|
+
s.dispose(), e == null || e.dispose();
|
|
1554
1463
|
});
|
|
1555
1464
|
}
|
|
1556
|
-
function
|
|
1557
|
-
|
|
1558
|
-
const r =
|
|
1559
|
-
return new
|
|
1465
|
+
function cr(t) {
|
|
1466
|
+
jt(t.query);
|
|
1467
|
+
const r = ke(t);
|
|
1468
|
+
return new Ie(t.query, r);
|
|
1560
1469
|
}
|
|
1561
|
-
function
|
|
1470
|
+
function Ct(t) {
|
|
1562
1471
|
if (t.handler == null || typeof t.handler.fetch != "function")
|
|
1563
1472
|
throw new TypeError("Table data-source handler must implement fetch");
|
|
1564
|
-
const r =
|
|
1473
|
+
const r = ke(t), e = new ve("sort", r.sortEmitter, {
|
|
1565
1474
|
owner: t.owner,
|
|
1566
1475
|
purpose: "table sort argument"
|
|
1567
|
-
}),
|
|
1476
|
+
}), i = new ve("filters", r.filtersEmitter, {
|
|
1568
1477
|
owner: t.owner,
|
|
1569
1478
|
purpose: "table filters argument"
|
|
1570
|
-
}),
|
|
1479
|
+
}), s = new Ze({
|
|
1571
1480
|
handler: t.handler,
|
|
1572
|
-
args: { sort: e, filters:
|
|
1481
|
+
args: { sort: e, filters: i },
|
|
1573
1482
|
owner: t.owner,
|
|
1574
1483
|
purpose: "table query",
|
|
1575
1484
|
keepPreviousValue: !0
|
|
1576
1485
|
});
|
|
1577
|
-
return new
|
|
1578
|
-
|
|
1486
|
+
return new Ie(s, r, () => {
|
|
1487
|
+
s.dispose(), e.dispose(), i.dispose();
|
|
1579
1488
|
});
|
|
1580
1489
|
}
|
|
1581
|
-
function
|
|
1490
|
+
function Kt(t) {
|
|
1582
1491
|
if (typeof t.url != "string" || t.url.length === 0)
|
|
1583
1492
|
throw new TypeError("REST table data source requires a URL");
|
|
1584
1493
|
const r = {
|
|
1585
1494
|
url: t.url,
|
|
1586
|
-
serialize: t.serializeQuery ??
|
|
1495
|
+
serialize: t.serializeQuery ?? vt
|
|
1587
1496
|
};
|
|
1588
|
-
return t.baseUrl != null && (r.baseUrl = t.baseUrl), t.fetch != null && (r.fetch = t.fetch),
|
|
1589
|
-
handler: new
|
|
1497
|
+
return t.baseUrl != null && (r.baseUrl = t.baseUrl), t.fetch != null && (r.fetch = t.fetch), Ct({
|
|
1498
|
+
handler: new et(r),
|
|
1590
1499
|
...t.sortEmitter == null ? {} : { sortEmitter: t.sortEmitter },
|
|
1591
1500
|
...t.filtersEmitter == null ? {} : { filtersEmitter: t.filtersEmitter },
|
|
1592
1501
|
...t.owner === void 0 ? {} : { owner: t.owner }
|
|
1593
1502
|
});
|
|
1594
1503
|
}
|
|
1595
|
-
class
|
|
1596
|
-
constructor(r, e,
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
this.query = r, this.state = e, this.disposeQuery =
|
|
1504
|
+
class Ie {
|
|
1505
|
+
constructor(r, e, i = null) {
|
|
1506
|
+
o(this, "sortEmitter");
|
|
1507
|
+
o(this, "filtersEmitter");
|
|
1508
|
+
o(this, "retry");
|
|
1509
|
+
o(this, "disposed", !1);
|
|
1510
|
+
this.query = r, this.state = e, this.disposeQuery = i, this.sortEmitter = e.sortEmitter, this.filtersEmitter = e.filtersEmitter, r.retry != null && (this.retry = (s) => {
|
|
1602
1511
|
var n;
|
|
1603
|
-
return (n = r.retry) == null ? void 0 : n.call(r,
|
|
1512
|
+
return (n = r.retry) == null ? void 0 : n.call(r, s);
|
|
1604
1513
|
});
|
|
1605
1514
|
}
|
|
1606
1515
|
dispose() {
|
|
1607
|
-
var r, e,
|
|
1608
|
-
this.disposed || (this.disposed = !0, (r = this.disposeQuery) == null || r.call(this), (e = this.state.ownedSortEmitter) == null || e.dispose(), (
|
|
1516
|
+
var r, e, i;
|
|
1517
|
+
this.disposed || (this.disposed = !0, (r = this.disposeQuery) == null || r.call(this), (e = this.state.ownedSortEmitter) == null || e.dispose(), (i = this.state.ownedFiltersEmitter) == null || i.dispose());
|
|
1609
1518
|
}
|
|
1610
1519
|
}
|
|
1611
|
-
function
|
|
1612
|
-
const r = t.sortEmitter == null ? new
|
|
1520
|
+
function ke(t) {
|
|
1521
|
+
const r = t.sortEmitter == null ? new x(null, {
|
|
1613
1522
|
owner: t.owner,
|
|
1614
1523
|
purpose: "table sort"
|
|
1615
|
-
}) : null, e = t.filtersEmitter == null ? new
|
|
1524
|
+
}) : null, e = t.filtersEmitter == null ? new x({}, {
|
|
1616
1525
|
owner: t.owner,
|
|
1617
1526
|
purpose: "table filters"
|
|
1618
1527
|
}) : null;
|
|
@@ -1623,31 +1532,31 @@ function ve(t) {
|
|
|
1623
1532
|
ownedFiltersEmitter: e
|
|
1624
1533
|
};
|
|
1625
1534
|
}
|
|
1626
|
-
function
|
|
1535
|
+
function We(t) {
|
|
1627
1536
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function" && typeof Reflect.get(t, "getFetchState") == "function" && typeof Reflect.get(t, "getError") == "function";
|
|
1628
1537
|
}
|
|
1629
|
-
function
|
|
1630
|
-
if (!
|
|
1538
|
+
function jt(t) {
|
|
1539
|
+
if (!We(t))
|
|
1631
1540
|
throw new TypeError("Table query must be an emitter");
|
|
1632
1541
|
}
|
|
1633
|
-
class X extends
|
|
1542
|
+
class X extends y {
|
|
1634
1543
|
constructor(e) {
|
|
1635
|
-
var
|
|
1544
|
+
var i, s;
|
|
1636
1545
|
super(e);
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1546
|
+
o(this, "columns");
|
|
1547
|
+
o(this, "rowKey");
|
|
1548
|
+
o(this, "sortEmitter");
|
|
1549
|
+
o(this, "filtersEmitter");
|
|
1550
|
+
o(this, "selectedItemsEmitter");
|
|
1551
|
+
o(this, "selectedItemEmitter");
|
|
1552
|
+
o(this, "selectionHandler");
|
|
1553
|
+
o(this, "query", null);
|
|
1554
|
+
o(this, "dataSource", null);
|
|
1555
|
+
o(this, "suppliedDataSource");
|
|
1556
|
+
o(this, "ownedSortEmitter");
|
|
1557
|
+
o(this, "ownedFiltersEmitter");
|
|
1558
|
+
o(this, "ownedDataSource", null);
|
|
1559
|
+
Ft(e), this.columns = At(e.columns), this.rowKey = Ht(e.rowKey), this.suppliedDataSource = e.dataSource ?? null, this.ownedSortEmitter = this.suppliedDataSource == null ? new x(null, { owner: this, purpose: "table sort" }) : null, this.ownedFiltersEmitter = this.suppliedDataSource == null ? new x({}, { owner: this, purpose: "table filters" }) : null, this.sortEmitter = ((i = this.suppliedDataSource) == null ? void 0 : i.sortEmitter) ?? this.ownedSortEmitter, this.filtersEmitter = ((s = this.suppliedDataSource) == null ? void 0 : s.filtersEmitter) ?? this.ownedFiltersEmitter, this.selectionHandler = e.multiSelect === !0 ? se({
|
|
1651
1560
|
owner: this,
|
|
1652
1561
|
multiSelect: !0,
|
|
1653
1562
|
...e.selectedItemsEmitter == null ? {} : { selectedItemsEmitter: e.selectedItemsEmitter },
|
|
@@ -1656,7 +1565,7 @@ class X extends g {
|
|
|
1656
1565
|
return ((n = this.query) == null ? void 0 : n.get()) ?? [];
|
|
1657
1566
|
},
|
|
1658
1567
|
getKey: this.rowKey
|
|
1659
|
-
}) :
|
|
1568
|
+
}) : se({
|
|
1660
1569
|
owner: this,
|
|
1661
1570
|
...e.selectedItemEmitter == null ? {} : { selectedItemEmitter: e.selectedItemEmitter },
|
|
1662
1571
|
getItems: () => {
|
|
@@ -1664,15 +1573,15 @@ class X extends g {
|
|
|
1664
1573
|
return ((n = this.query) == null ? void 0 : n.get()) ?? [];
|
|
1665
1574
|
},
|
|
1666
1575
|
getKey: this.rowKey
|
|
1667
|
-
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof
|
|
1576
|
+
}), this.selectedItemsEmitter = this.selectionHandler.selectedItemsEmitter, this.selectedItemEmitter = this.selectionHandler instanceof Ee ? this.selectionHandler.selectedItemEmitter : null;
|
|
1668
1577
|
}
|
|
1669
1578
|
initialize() {
|
|
1670
|
-
this.suppliedDataSource != null ? this.dataSource = this.suppliedDataSource : this.props.rest != null ? (this.ownedDataSource =
|
|
1579
|
+
this.suppliedDataSource != null ? this.dataSource = this.suppliedDataSource : this.props.rest != null ? (this.ownedDataSource = Kt({
|
|
1671
1580
|
...this.props.rest,
|
|
1672
1581
|
sortEmitter: this.sortEmitter,
|
|
1673
1582
|
filtersEmitter: this.filtersEmitter,
|
|
1674
1583
|
owner: this
|
|
1675
|
-
}), this.dataSource = this.ownedDataSource) : (this.ownedDataSource =
|
|
1584
|
+
}), this.dataSource = this.ownedDataSource) : (this.ownedDataSource = Ot({
|
|
1676
1585
|
data: this.props.data ?? [],
|
|
1677
1586
|
sortEmitter: this.sortEmitter,
|
|
1678
1587
|
filtersEmitter: this.filtersEmitter,
|
|
@@ -1680,38 +1589,38 @@ class X extends g {
|
|
|
1680
1589
|
}), this.dataSource = this.ownedDataSource), this.query = this.dataSource.query, this.watch(this.query, this.selectedItemsEmitter);
|
|
1681
1590
|
}
|
|
1682
1591
|
render() {
|
|
1683
|
-
var
|
|
1684
|
-
const e = ((
|
|
1592
|
+
var c, h, p, f;
|
|
1593
|
+
const e = ((c = this.query) == null ? void 0 : c.get()) ?? [];
|
|
1685
1594
|
if (!Array.isArray(e)) throw new TypeError("DataTable query value must be an array");
|
|
1686
|
-
const
|
|
1687
|
-
this.selectedItemsEmitter.get().map((
|
|
1595
|
+
const i = ((h = this.query) == null ? void 0 : h.getFetchState()) ?? k.Initial, s = (p = this.query) == null ? void 0 : p.getError(), n = i === k.Initial || i === k.Loading, a = new Set(
|
|
1596
|
+
this.selectedItemsEmitter.get().map((g, m) => this.rowKey(g, m))
|
|
1688
1597
|
), l = this.Host;
|
|
1689
1598
|
return /* @__PURE__ */ w(
|
|
1690
1599
|
l,
|
|
1691
1600
|
{
|
|
1692
|
-
className: E(this.props)
|
|
1601
|
+
className: R("datacomponentlike", E(this.props)),
|
|
1693
1602
|
"data-loading": n ? "" : null,
|
|
1694
|
-
"data-error":
|
|
1603
|
+
"data-error": i === k.Error ? "" : null,
|
|
1695
1604
|
children: [
|
|
1696
|
-
n ? /* @__PURE__ */ u("p", { role: "status",
|
|
1697
|
-
|
|
1698
|
-
/* @__PURE__ */ u("span", { children:
|
|
1699
|
-
typeof ((
|
|
1605
|
+
n ? /* @__PURE__ */ u("p", { role: "status", children: "Loading rows…" }) : null,
|
|
1606
|
+
i === k.Error ? /* @__PURE__ */ w("div", { role: "alert", children: [
|
|
1607
|
+
/* @__PURE__ */ u("span", { children: zt(s, "Unable to load rows") }),
|
|
1608
|
+
typeof ((f = this.dataSource) == null ? void 0 : f.retry) == "function" ? /* @__PURE__ */ u(
|
|
1700
1609
|
"button",
|
|
1701
1610
|
{
|
|
1702
1611
|
type: "button",
|
|
1703
1612
|
onClick: () => {
|
|
1704
|
-
var
|
|
1705
|
-
return (
|
|
1613
|
+
var g, m;
|
|
1614
|
+
return (m = (g = this.dataSource) == null ? void 0 : g.retry) == null ? void 0 : m.call(g, "table retry");
|
|
1706
1615
|
},
|
|
1707
1616
|
children: "Retry"
|
|
1708
1617
|
}
|
|
1709
1618
|
) : null
|
|
1710
1619
|
] }) : null,
|
|
1711
|
-
/* @__PURE__ */ w("table", { "
|
|
1620
|
+
/* @__PURE__ */ w("table", { "aria-busy": n ? "true" : null, children: [
|
|
1712
1621
|
this.props.caption == null ? null : /* @__PURE__ */ u("caption", { children: this.props.caption }),
|
|
1713
1622
|
/* @__PURE__ */ u(
|
|
1714
|
-
|
|
1623
|
+
ge,
|
|
1715
1624
|
{
|
|
1716
1625
|
columns: this.columns,
|
|
1717
1626
|
sortEmitter: this.sortEmitter,
|
|
@@ -1722,38 +1631,38 @@ class X extends g {
|
|
|
1722
1631
|
},
|
|
1723
1632
|
"header"
|
|
1724
1633
|
),
|
|
1725
|
-
/* @__PURE__ */ u("tbody", { children: e.length > 0 ? e.map((
|
|
1634
|
+
/* @__PURE__ */ u("tbody", { children: e.length > 0 ? e.map((g, m) => this.renderRow(g, m, a)) : n ? this.renderPlaceholders() : i === k.Error ? null : /* @__PURE__ */ u("tr", { children: /* @__PURE__ */ u("td", { colSpan: this.columns.length, children: this.props.emptyMessage ?? "No rows" }) }, "empty") })
|
|
1726
1635
|
] })
|
|
1727
1636
|
]
|
|
1728
1637
|
}
|
|
1729
1638
|
);
|
|
1730
1639
|
}
|
|
1731
|
-
renderRow(e,
|
|
1732
|
-
const n = this.rowKey(e,
|
|
1640
|
+
renderRow(e, i, s) {
|
|
1641
|
+
const n = this.rowKey(e, i), a = s.has(n);
|
|
1733
1642
|
return /* @__PURE__ */ u(
|
|
1734
1643
|
"tr",
|
|
1735
1644
|
{
|
|
1736
1645
|
"data-fray-selectable-row": "",
|
|
1737
|
-
"data-index":
|
|
1738
|
-
"aria-selected": String(
|
|
1739
|
-
tabIndex:
|
|
1740
|
-
children: this.columns.map((l) => /* @__PURE__ */ u("td", { children: l.render ? l.render(e,
|
|
1646
|
+
"data-index": i,
|
|
1647
|
+
"aria-selected": String(a),
|
|
1648
|
+
tabIndex: i === 0 ? 0 : -1,
|
|
1649
|
+
children: this.columns.map((l) => /* @__PURE__ */ u("td", { children: l.render ? l.render(e, i) : Mt(e[l.field]) }, String(l.field)))
|
|
1741
1650
|
},
|
|
1742
1651
|
String(n)
|
|
1743
1652
|
);
|
|
1744
1653
|
}
|
|
1745
1654
|
renderPlaceholders() {
|
|
1746
1655
|
const e = this.props.placeholderCount ?? 5;
|
|
1747
|
-
return Array.from({ length: e }, (
|
|
1748
|
-
|
|
1656
|
+
return Array.from({ length: e }, (i, s) => /* @__PURE__ */ u("tr", { children: this.columns.map((n, a) => /* @__PURE__ */ u("td", { children: /* @__PURE__ */ u(
|
|
1657
|
+
M,
|
|
1749
1658
|
{
|
|
1750
|
-
width: 45 + (
|
|
1659
|
+
width: 45 + (s + a) % 6 * 8
|
|
1751
1660
|
}
|
|
1752
|
-
) }, String(n.field))) }, `placeholder-${
|
|
1661
|
+
) }, String(n.field))) }, `placeholder-${s}`));
|
|
1753
1662
|
}
|
|
1754
1663
|
afterUpdate(e) {
|
|
1755
|
-
const
|
|
1756
|
-
this.selectionHandler.rowsUpdated(
|
|
1664
|
+
const i = e instanceof Element ? e.querySelectorAll("tbody [data-fray-selectable-row]") : [];
|
|
1665
|
+
this.selectionHandler.rowsUpdated(i);
|
|
1757
1666
|
}
|
|
1758
1667
|
getSelectedRows() {
|
|
1759
1668
|
return this.selectionHandler.getSelectedItems();
|
|
@@ -1769,14 +1678,13 @@ class X extends g {
|
|
|
1769
1678
|
return this.selectedItemEmitter;
|
|
1770
1679
|
}
|
|
1771
1680
|
onDestroy() {
|
|
1772
|
-
var e,
|
|
1773
|
-
this.selectionHandler.destroy(), (e = this.ownedDataSource) == null || e.dispose(), (
|
|
1681
|
+
var e, i, s;
|
|
1682
|
+
this.selectionHandler.destroy(), (e = this.ownedDataSource) == null || e.dispose(), (i = this.ownedSortEmitter) == null || i.dispose(), (s = this.ownedFiltersEmitter) == null || s.dispose();
|
|
1774
1683
|
}
|
|
1775
1684
|
}
|
|
1776
|
-
|
|
1685
|
+
o(X, "dependencies", [M, ge]), o(X, "hostName", "data-table"), o(X, "standaloneHostName", "data-table"), o(X, "css", S`
|
|
1777
1686
|
& {
|
|
1778
1687
|
overflow: auto;
|
|
1779
|
-
color: var(--ui-text-color);
|
|
1780
1688
|
}
|
|
1781
1689
|
|
|
1782
1690
|
& > table {
|
|
@@ -1784,7 +1692,7 @@ s(X, "dependencies", [H, me]), s(X, "hostName", "data-table"), s(X, "standaloneH
|
|
|
1784
1692
|
border-collapse: collapse;
|
|
1785
1693
|
}
|
|
1786
1694
|
|
|
1787
|
-
& thead:has([
|
|
1695
|
+
& thead:has([aria-expanded="true"]) {
|
|
1788
1696
|
position: relative;
|
|
1789
1697
|
z-index: 1100;
|
|
1790
1698
|
}
|
|
@@ -1800,52 +1708,27 @@ s(X, "dependencies", [H, me]), s(X, "hostName", "data-table"), s(X, "standaloneH
|
|
|
1800
1708
|
user-select: none;
|
|
1801
1709
|
}
|
|
1802
1710
|
|
|
1803
|
-
& tbody tr:nth-child(odd) {
|
|
1804
|
-
background: var(--fray-table-row-background, transparent);
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
& tbody tr:nth-child(even) {
|
|
1808
|
-
background: var(--fray-table-row-alt-background, transparent);
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
& tbody tr[data-fray-selectable-row]:hover {
|
|
1812
|
-
background: var(--fray-row-hover-background, var(--button-background-hover));
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
& tbody tr[data-fray-selectable-row]:focus-visible {
|
|
1816
|
-
outline: 2px solid var(--fray-color-focus, var(--ui-accent-color));
|
|
1817
|
-
outline-offset: -2px;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
& tbody tr[data-fray-selectable-row][aria-selected="true"] {
|
|
1821
|
-
color: var(--fray-selection-color, var(--toggle-selected-text));
|
|
1822
|
-
background: var(--fray-selection-background, var(--toggle-selected-bg));
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
& > [data-part="error"] {
|
|
1826
|
-
color: var(--error-color);
|
|
1827
|
-
}
|
|
1828
1711
|
`);
|
|
1829
|
-
function
|
|
1712
|
+
function At(t) {
|
|
1830
1713
|
if (!Array.isArray(t) || t.length === 0)
|
|
1831
1714
|
throw new TypeError("DataTable columns must be a non-empty array");
|
|
1832
1715
|
const r = /* @__PURE__ */ new Set();
|
|
1833
1716
|
return t.map((e) => {
|
|
1834
1717
|
if (e == null || typeof e != "object")
|
|
1835
1718
|
throw new TypeError("Every DataTable column requires a field");
|
|
1836
|
-
const
|
|
1837
|
-
if (typeof
|
|
1719
|
+
const i = Reflect.get(e, "field");
|
|
1720
|
+
if (typeof i != "string" || i.length === 0)
|
|
1838
1721
|
throw new TypeError("Every DataTable column requires a field");
|
|
1839
|
-
if (r.has(
|
|
1840
|
-
r.add(
|
|
1841
|
-
const
|
|
1842
|
-
if (
|
|
1843
|
-
throw new TypeError(`DataTable column ${
|
|
1722
|
+
if (r.has(i)) throw new Error(`Duplicate DataTable column: ${i}`);
|
|
1723
|
+
r.add(i);
|
|
1724
|
+
const s = Reflect.get(e, "render");
|
|
1725
|
+
if (s != null && typeof s != "function")
|
|
1726
|
+
throw new TypeError(`DataTable column ${i} render must be a function`);
|
|
1844
1727
|
return e;
|
|
1845
1728
|
});
|
|
1846
1729
|
}
|
|
1847
|
-
function
|
|
1848
|
-
var
|
|
1730
|
+
function Ft(t) {
|
|
1731
|
+
var a, l;
|
|
1849
1732
|
const e = [
|
|
1850
1733
|
"mode",
|
|
1851
1734
|
"query",
|
|
@@ -1854,126 +1737,126 @@ function At(t) {
|
|
|
1854
1737
|
"baseUrl",
|
|
1855
1738
|
"fetch",
|
|
1856
1739
|
"serializeQuery"
|
|
1857
|
-
].find((
|
|
1740
|
+
].find((c) => Object.hasOwn(t, c));
|
|
1858
1741
|
if (e != null)
|
|
1859
1742
|
throw new TypeError(
|
|
1860
1743
|
`DataTable ${e} moved to dataSource/rest; see the 0.3 migration guide`
|
|
1861
1744
|
);
|
|
1862
|
-
const
|
|
1863
|
-
if (Number(
|
|
1745
|
+
const i = t.data !== void 0, s = t.dataSource !== void 0, n = t.rest !== void 0;
|
|
1746
|
+
if (Number(i) + Number(s) + Number(n) > 1)
|
|
1864
1747
|
throw new TypeError("DataTable accepts exactly one of data, dataSource, or rest");
|
|
1865
|
-
if (
|
|
1866
|
-
const
|
|
1867
|
-
if (
|
|
1748
|
+
if (s) {
|
|
1749
|
+
const c = t.dataSource;
|
|
1750
|
+
if (c == null || typeof c != "object" || c.query == null || typeof ((a = c.sortEmitter) == null ? void 0 : a.set) != "function" || typeof ((l = c.filtersEmitter) == null ? void 0 : l.set) != "function" || typeof c.dispose != "function")
|
|
1868
1751
|
throw new TypeError("DataTable dataSource must implement the table data-source contract");
|
|
1869
1752
|
}
|
|
1870
1753
|
}
|
|
1871
|
-
function
|
|
1872
|
-
if (t == null) return
|
|
1754
|
+
function Ht(t) {
|
|
1755
|
+
if (t == null) return Se;
|
|
1873
1756
|
if (typeof t == "function") return t;
|
|
1874
1757
|
if (typeof t == "string" && t.length > 0)
|
|
1875
1758
|
return (r, e) => {
|
|
1876
|
-
const
|
|
1877
|
-
if (
|
|
1759
|
+
const i = r[t];
|
|
1760
|
+
if (i == null)
|
|
1878
1761
|
throw new TypeError(`DataTable row at index ${e} lacks ${t}`);
|
|
1879
|
-
return
|
|
1762
|
+
return i;
|
|
1880
1763
|
};
|
|
1881
1764
|
throw new TypeError("DataTable rowKey must be a function or property name");
|
|
1882
1765
|
}
|
|
1883
|
-
function
|
|
1766
|
+
function Mt(t) {
|
|
1884
1767
|
return t == null || typeof t == "string" || typeof t == "number" ? t : String(t);
|
|
1885
1768
|
}
|
|
1886
|
-
function
|
|
1769
|
+
function zt(t, r) {
|
|
1887
1770
|
return t instanceof Error ? t.message : t == null ? r : String(t);
|
|
1888
1771
|
}
|
|
1889
|
-
class
|
|
1772
|
+
class Je extends y {
|
|
1890
1773
|
render() {
|
|
1891
1774
|
return this.props.children ?? [];
|
|
1892
1775
|
}
|
|
1893
1776
|
}
|
|
1894
|
-
function
|
|
1777
|
+
function B(t) {
|
|
1895
1778
|
if (!Array.isArray(t)) throw new TypeError("Tree nodes must be an array");
|
|
1896
|
-
const r = /* @__PURE__ */ new Set(), e = (
|
|
1897
|
-
for (const
|
|
1898
|
-
if (
|
|
1779
|
+
const r = /* @__PURE__ */ new Set(), e = (i) => {
|
|
1780
|
+
for (const s of i) {
|
|
1781
|
+
if (s == null || typeof s != "object" || s.id == null)
|
|
1899
1782
|
throw new TypeError("Each tree node requires an id");
|
|
1900
|
-
if (r.has(
|
|
1901
|
-
if (r.add(
|
|
1902
|
-
throw new TypeError(`Tree node ${String(
|
|
1903
|
-
e(
|
|
1783
|
+
if (r.has(s.id)) throw new Error(`Duplicate tree item id: ${String(s.id)}`);
|
|
1784
|
+
if (r.add(s.id), !Array.isArray(s.children ?? []))
|
|
1785
|
+
throw new TypeError(`Tree node ${String(s.id)} children must be an array`);
|
|
1786
|
+
e(s.children ?? []);
|
|
1904
1787
|
}
|
|
1905
1788
|
};
|
|
1906
1789
|
e(t);
|
|
1907
1790
|
}
|
|
1908
|
-
function
|
|
1909
|
-
return
|
|
1791
|
+
function dr(t, r) {
|
|
1792
|
+
return B(t), xe(t, r);
|
|
1910
1793
|
}
|
|
1911
|
-
function
|
|
1912
|
-
return new
|
|
1794
|
+
function ur(t, r, e = null) {
|
|
1795
|
+
return new ae(
|
|
1913
1796
|
[t, r],
|
|
1914
|
-
([
|
|
1797
|
+
([i, s]) => (B(i), s == null ? null : xe(i, s)),
|
|
1915
1798
|
{ owner: e, purpose: "tree node projection" }
|
|
1916
1799
|
);
|
|
1917
1800
|
}
|
|
1918
|
-
function
|
|
1919
|
-
if (
|
|
1920
|
-
const
|
|
1921
|
-
for (let
|
|
1922
|
-
const l = n[
|
|
1801
|
+
function qt(t, r, e) {
|
|
1802
|
+
if (B(t), typeof e != "function") throw new TypeError("Tree node update must be a function");
|
|
1803
|
+
const i = (n) => {
|
|
1804
|
+
for (let a = 0; a < n.length; a += 1) {
|
|
1805
|
+
const l = n[a];
|
|
1923
1806
|
if (Object.is(l.id, r)) {
|
|
1924
|
-
const
|
|
1925
|
-
if (
|
|
1807
|
+
const p = e(l);
|
|
1808
|
+
if (p == null || typeof p != "object")
|
|
1926
1809
|
throw new TypeError("Tree node update must return a tree node");
|
|
1927
|
-
if (!Object.is(
|
|
1810
|
+
if (!Object.is(p.id, l.id))
|
|
1928
1811
|
throw new Error("Tree node update cannot change the stable id");
|
|
1929
|
-
if (Object.is(
|
|
1930
|
-
const m = [...n];
|
|
1931
|
-
return m[o] = f, m;
|
|
1932
|
-
}
|
|
1933
|
-
const d = l.children ?? [], h = a(d);
|
|
1934
|
-
if (!Object.is(h, d)) {
|
|
1812
|
+
if (Object.is(p, l)) return n;
|
|
1935
1813
|
const f = [...n];
|
|
1936
|
-
return f[
|
|
1814
|
+
return f[a] = p, f;
|
|
1815
|
+
}
|
|
1816
|
+
const c = l.children ?? [], h = i(c);
|
|
1817
|
+
if (!Object.is(h, c)) {
|
|
1818
|
+
const p = [...n];
|
|
1819
|
+
return p[a] = { ...l, children: h }, p;
|
|
1937
1820
|
}
|
|
1938
1821
|
}
|
|
1939
1822
|
return n;
|
|
1940
|
-
},
|
|
1941
|
-
return Object.is(
|
|
1823
|
+
}, s = i(t);
|
|
1824
|
+
return Object.is(s, t) || B(s), s;
|
|
1942
1825
|
}
|
|
1943
|
-
function
|
|
1944
|
-
const
|
|
1945
|
-
return Object.is(n,
|
|
1826
|
+
function hr(t, r, e, i = "tree node updated") {
|
|
1827
|
+
const s = t.get(), n = qt(s, r, e);
|
|
1828
|
+
return Object.is(n, s) ? !1 : t.set(n, i);
|
|
1946
1829
|
}
|
|
1947
|
-
function
|
|
1830
|
+
function xe(t, r) {
|
|
1948
1831
|
for (const e of t) {
|
|
1949
1832
|
if (Object.is(e.id, r)) return e;
|
|
1950
|
-
const
|
|
1951
|
-
if (
|
|
1833
|
+
const i = xe(e.children ?? [], r);
|
|
1834
|
+
if (i != null) return i;
|
|
1952
1835
|
}
|
|
1953
1836
|
return null;
|
|
1954
1837
|
}
|
|
1955
|
-
class Z extends
|
|
1838
|
+
class Z extends y {
|
|
1956
1839
|
constructor(e) {
|
|
1957
1840
|
super(e);
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
if (
|
|
1841
|
+
o(this, "nodesEmitter");
|
|
1842
|
+
o(this, "selectedKeyEmitter");
|
|
1843
|
+
o(this, "expandedKeysEmitter");
|
|
1844
|
+
o(this, "ownedNodesEmitter");
|
|
1845
|
+
o(this, "ownedSelectedEmitter");
|
|
1846
|
+
o(this, "ownedExpandedEmitter");
|
|
1847
|
+
o(this, "focusedKey", null);
|
|
1848
|
+
o(this, "typeahead", "");
|
|
1849
|
+
o(this, "typeaheadTimer", null);
|
|
1850
|
+
if (Pt(e.nodes))
|
|
1968
1851
|
this.nodesEmitter = e.nodes, this.ownedNodesEmitter = null;
|
|
1969
1852
|
else {
|
|
1970
|
-
const
|
|
1971
|
-
this.ownedNodesEmitter = new
|
|
1853
|
+
const i = e.nodes ?? _e(e.children);
|
|
1854
|
+
this.ownedNodesEmitter = new x(i, {
|
|
1972
1855
|
owner: this,
|
|
1973
1856
|
purpose: "tree nodes"
|
|
1974
1857
|
}), this.nodesEmitter = this.ownedNodesEmitter;
|
|
1975
1858
|
}
|
|
1976
|
-
this.ownedSelectedEmitter = e.selectedKeyEmitter == null ? new
|
|
1859
|
+
this.ownedSelectedEmitter = e.selectedKeyEmitter == null ? new x(null, { owner: this, purpose: "selected tree key" }) : null, this.selectedKeyEmitter = e.selectedKeyEmitter ?? this.ownedSelectedEmitter, this.ownedExpandedEmitter = e.expandedKeysEmitter == null ? new x([], { owner: this, purpose: "expanded tree keys" }) : null, this.expandedKeysEmitter = e.expandedKeysEmitter ?? this.ownedExpandedEmitter;
|
|
1977
1860
|
}
|
|
1978
1861
|
initialize() {
|
|
1979
1862
|
this.reconcile(this.nodesEmitter.get()), this.watch(this.nodesEmitter, this.selectedKeyEmitter, this.expandedKeysEmitter), this.onCleanup(this.nodesEmitter.subscribe(({ value: e }) => this.reconcile(e), {
|
|
@@ -1982,124 +1865,123 @@ class Z extends g {
|
|
|
1982
1865
|
}
|
|
1983
1866
|
render() {
|
|
1984
1867
|
const e = this.nodesEmitter.get();
|
|
1985
|
-
|
|
1986
|
-
const
|
|
1987
|
-
this.focusedKey = (
|
|
1868
|
+
B(e);
|
|
1869
|
+
const i = new Set(this.expandedKeysEmitter.get()), s = De(e, i), n = this.selectedKeyEmitter.get(), a = s.find(({ node: c }) => Object.is(c.id, this.focusedKey)) ?? s.find(({ node: c }) => Object.is(c.id, n)) ?? s[0] ?? null;
|
|
1870
|
+
this.focusedKey = (a == null ? void 0 : a.node.id) ?? null;
|
|
1988
1871
|
const l = this.Host;
|
|
1989
|
-
return /* @__PURE__ */ u(l, { className: E(this.props)
|
|
1990
|
-
var
|
|
1991
|
-
const { node:
|
|
1872
|
+
return /* @__PURE__ */ u(l, { className: R("datacomponentlike", E(this.props)), children: s.length === 0 ? /* @__PURE__ */ u("p", { role: "status", children: "No tree items" }) : /* @__PURE__ */ u("div", { role: "tree", "aria-label": this.props.label, children: s.map((c, h) => {
|
|
1873
|
+
var j, A, H;
|
|
1874
|
+
const { node: p, depth: f, position: g, setSize: m } = c, I = (((j = p.children) == null ? void 0 : j.length) ?? 0) > 0, v = I && i.has(p.id), O = Object.is(p.id, n), C = ((H = (A = this.props).renderItem) == null ? void 0 : H.call(A, p, f)) ?? p.label;
|
|
1992
1875
|
return /* @__PURE__ */ w(
|
|
1993
1876
|
"div",
|
|
1994
1877
|
{
|
|
1995
1878
|
role: "treeitem",
|
|
1996
|
-
"data-part": "item",
|
|
1997
1879
|
"data-index": h,
|
|
1998
|
-
"data-depth":
|
|
1999
|
-
"aria-level":
|
|
2000
|
-
"aria-posinset":
|
|
2001
|
-
"aria-setsize":
|
|
2002
|
-
"aria-expanded":
|
|
1880
|
+
"data-depth": f,
|
|
1881
|
+
"aria-level": f + 1,
|
|
1882
|
+
"aria-posinset": g,
|
|
1883
|
+
"aria-setsize": m,
|
|
1884
|
+
"aria-expanded": I ? String(v) : null,
|
|
2003
1885
|
"aria-selected": String(O),
|
|
2004
|
-
tabIndex: Object.is(
|
|
2005
|
-
style: { "--tree-depth":
|
|
1886
|
+
tabIndex: Object.is(p.id, a == null ? void 0 : a.node.id) ? 0 : -1,
|
|
1887
|
+
style: { "--tree-depth": f },
|
|
2006
1888
|
onClick: (T) => {
|
|
2007
|
-
if (this.focusedKey =
|
|
2008
|
-
this.toggleExpanded(
|
|
1889
|
+
if (this.focusedKey = p.id, Bt(T.target) && I) {
|
|
1890
|
+
this.toggleExpanded(p.id), this.focusRow(p.id);
|
|
2009
1891
|
return;
|
|
2010
1892
|
}
|
|
2011
|
-
this.selectNode(
|
|
1893
|
+
this.selectNode(p, T);
|
|
2012
1894
|
},
|
|
2013
|
-
onFocus: () => this.focusedKey =
|
|
2014
|
-
onKeyDown: (T) => this.handleKeyDown(T, h,
|
|
1895
|
+
onFocus: () => this.focusedKey = p.id,
|
|
1896
|
+
onKeyDown: (T) => this.handleKeyDown(T, h, s),
|
|
2015
1897
|
children: [
|
|
2016
1898
|
/* @__PURE__ */ u(
|
|
2017
1899
|
"span",
|
|
2018
1900
|
{
|
|
2019
1901
|
"data-part": "expander",
|
|
2020
|
-
"data-expandable":
|
|
1902
|
+
"data-expandable": I ? "" : null,
|
|
2021
1903
|
"aria-hidden": "true",
|
|
2022
|
-
children:
|
|
1904
|
+
children: I ? v ? "▾" : "▸" : "•"
|
|
2023
1905
|
}
|
|
2024
1906
|
),
|
|
2025
|
-
/* @__PURE__ */ u("span", { "data-part": "label", children:
|
|
1907
|
+
/* @__PURE__ */ u("span", { "data-part": "label", children: C })
|
|
2026
1908
|
]
|
|
2027
1909
|
},
|
|
2028
|
-
|
|
1910
|
+
p.id
|
|
2029
1911
|
);
|
|
2030
1912
|
}) }) });
|
|
2031
1913
|
}
|
|
2032
1914
|
onDestroy() {
|
|
2033
|
-
var e,
|
|
2034
|
-
this.typeaheadTimer != null && clearTimeout(this.typeaheadTimer), (e = this.ownedNodesEmitter) == null || e.dispose(), (
|
|
1915
|
+
var e, i, s;
|
|
1916
|
+
this.typeaheadTimer != null && clearTimeout(this.typeaheadTimer), (e = this.ownedNodesEmitter) == null || e.dispose(), (i = this.ownedSelectedEmitter) == null || i.dispose(), (s = this.ownedExpandedEmitter) == null || s.dispose();
|
|
2035
1917
|
}
|
|
2036
1918
|
reconcile(e) {
|
|
2037
|
-
|
|
2038
|
-
const
|
|
2039
|
-
this.ownedSelectedEmitter != null &&
|
|
2040
|
-
const n = this.expandedKeysEmitter.get(),
|
|
2041
|
-
this.ownedExpandedEmitter != null && !
|
|
1919
|
+
B(e);
|
|
1920
|
+
const i = new Set(Lt(e).map(({ node: l }) => l.id)), s = this.selectedKeyEmitter.get();
|
|
1921
|
+
this.ownedSelectedEmitter != null && s != null && !i.has(s) && this.selectedKeyEmitter.set(null, "selected tree item removed");
|
|
1922
|
+
const n = this.expandedKeysEmitter.get(), a = n.filter((l) => i.has(l));
|
|
1923
|
+
this.ownedExpandedEmitter != null && !Ut(n, a) && this.expandedKeysEmitter.set(a, "removed tree expansions reconciled"), this.focusedKey != null && !i.has(this.focusedKey) && (this.focusedKey = null);
|
|
2042
1924
|
}
|
|
2043
|
-
selectNode(e,
|
|
2044
|
-
this.selectedKeyEmitter.set(e.id, "tree item selected"),
|
|
1925
|
+
selectNode(e, i) {
|
|
1926
|
+
this.selectedKeyEmitter.set(e.id, "tree item selected"), K(this.props.onSelect, e, i), this.focusRow(e.id);
|
|
2045
1927
|
}
|
|
2046
1928
|
toggleExpanded(e) {
|
|
2047
|
-
const
|
|
1929
|
+
const i = this.expandedKeysEmitter.get(), s = i.some((n) => Object.is(n, e));
|
|
2048
1930
|
this.expandedKeysEmitter.set(
|
|
2049
|
-
|
|
2050
|
-
|
|
1931
|
+
s ? i.filter((n) => !Object.is(n, e)) : [...i, e],
|
|
1932
|
+
s ? "tree item collapsed" : "tree item expanded"
|
|
2051
1933
|
);
|
|
2052
1934
|
}
|
|
2053
|
-
handleKeyDown(e,
|
|
2054
|
-
var
|
|
2055
|
-
const n = i
|
|
1935
|
+
handleKeyDown(e, i, s) {
|
|
1936
|
+
var a, l, c, h;
|
|
1937
|
+
const n = s[i];
|
|
2056
1938
|
if (n != null) {
|
|
2057
|
-
if (e.key === "ArrowDown") return this.move(e, (
|
|
2058
|
-
if (e.key === "ArrowUp") return this.move(e, (l = i
|
|
2059
|
-
if (e.key === "Home") return this.move(e, (
|
|
2060
|
-
if (e.key === "End") return this.move(e, (h =
|
|
1939
|
+
if (e.key === "ArrowDown") return this.move(e, (a = s[i + 1]) == null ? void 0 : a.node.id);
|
|
1940
|
+
if (e.key === "ArrowUp") return this.move(e, (l = s[i - 1]) == null ? void 0 : l.node.id);
|
|
1941
|
+
if (e.key === "Home") return this.move(e, (c = s[0]) == null ? void 0 : c.node.id);
|
|
1942
|
+
if (e.key === "End") return this.move(e, (h = s.at(-1)) == null ? void 0 : h.node.id);
|
|
2061
1943
|
if (e.key === "ArrowRight") {
|
|
2062
1944
|
e.preventDefault();
|
|
2063
|
-
const
|
|
2064
|
-
if (
|
|
2065
|
-
this.expandedKeysEmitter.get().some((
|
|
1945
|
+
const p = n.node.children ?? [];
|
|
1946
|
+
if (p.length === 0) return;
|
|
1947
|
+
this.expandedKeysEmitter.get().some((g) => Object.is(g, n.node.id)) ? this.focusRow(p[0].id) : this.toggleExpanded(n.node.id);
|
|
2066
1948
|
return;
|
|
2067
1949
|
}
|
|
2068
1950
|
if (e.key === "ArrowLeft") {
|
|
2069
|
-
e.preventDefault(), this.expandedKeysEmitter.get().some((
|
|
1951
|
+
e.preventDefault(), this.expandedKeysEmitter.get().some((f) => Object.is(f, n.node.id)) ? this.toggleExpanded(n.node.id) : n.parentId != null && this.focusRow(n.parentId);
|
|
2070
1952
|
return;
|
|
2071
1953
|
}
|
|
2072
1954
|
if (e.key === "Enter" || e.key === " ") {
|
|
2073
1955
|
e.preventDefault(), this.selectNode(n.node, e);
|
|
2074
1956
|
return;
|
|
2075
1957
|
}
|
|
2076
|
-
e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey && this.handleTypeahead(e,
|
|
1958
|
+
e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey && this.handleTypeahead(e, s, i);
|
|
2077
1959
|
}
|
|
2078
1960
|
}
|
|
2079
|
-
move(e,
|
|
2080
|
-
|
|
1961
|
+
move(e, i) {
|
|
1962
|
+
i !== void 0 && (e.preventDefault(), this.focusRow(i));
|
|
2081
1963
|
}
|
|
2082
1964
|
focusRow(e) {
|
|
2083
|
-
var
|
|
1965
|
+
var s;
|
|
2084
1966
|
this.focusedKey = e;
|
|
2085
|
-
const
|
|
2086
|
-
for (const n of
|
|
2087
|
-
const
|
|
1967
|
+
const i = this.dom instanceof Element ? [...this.dom.querySelectorAll('[role="treeitem"]')] : [];
|
|
1968
|
+
for (const n of i) {
|
|
1969
|
+
const a = Number(n.dataset.index), l = De(
|
|
2088
1970
|
this.nodesEmitter.get(),
|
|
2089
1971
|
new Set(this.expandedKeysEmitter.get())
|
|
2090
|
-
),
|
|
2091
|
-
n.tabIndex =
|
|
1972
|
+
), c = Object.is((s = l[a]) == null ? void 0 : s.node.id, e);
|
|
1973
|
+
n.tabIndex = c ? 0 : -1, c && n.focus();
|
|
2092
1974
|
}
|
|
2093
1975
|
}
|
|
2094
|
-
handleTypeahead(e,
|
|
1976
|
+
handleTypeahead(e, i, s) {
|
|
2095
1977
|
e.preventDefault(), this.typeaheadTimer != null && clearTimeout(this.typeaheadTimer), this.typeahead += e.key.toLocaleLowerCase(), this.typeaheadTimer = setTimeout(() => {
|
|
2096
1978
|
this.typeahead = "", this.typeaheadTimer = null;
|
|
2097
1979
|
}, 650);
|
|
2098
|
-
const
|
|
2099
|
-
|
|
1980
|
+
const a = [...i.slice(s + 1), ...i.slice(0, s + 1)].find(({ node: l }) => Vt(l).toLocaleLowerCase().startsWith(this.typeahead));
|
|
1981
|
+
a != null && this.focusRow(a.node.id);
|
|
2100
1982
|
}
|
|
2101
1983
|
}
|
|
2102
|
-
|
|
1984
|
+
o(Z, "dependencies", [Je]), o(Z, "hostName", "tree-view"), o(Z, "standaloneHostName", "tree-view"), o(Z, "css", S`
|
|
2103
1985
|
& {
|
|
2104
1986
|
display: flex;
|
|
2105
1987
|
flex-direction: column;
|
|
@@ -2108,12 +1990,12 @@ s(Z, "dependencies", [We]), s(Z, "hostName", "tree-view"), s(Z, "standaloneHostN
|
|
|
2108
1990
|
overflow: auto;
|
|
2109
1991
|
}
|
|
2110
1992
|
|
|
2111
|
-
& > [
|
|
1993
|
+
& > [role="tree"] {
|
|
2112
1994
|
display: grid;
|
|
2113
1995
|
align-content: start;
|
|
2114
1996
|
}
|
|
2115
1997
|
|
|
2116
|
-
& [
|
|
1998
|
+
& [role="treeitem"] {
|
|
2117
1999
|
display: flex;
|
|
2118
2000
|
align-items: flex-start;
|
|
2119
2001
|
gap: 0.35rem;
|
|
@@ -2124,20 +2006,6 @@ s(Z, "dependencies", [We]), s(Z, "hostName", "tree-view"), s(Z, "standaloneHostN
|
|
|
2124
2006
|
user-select: none;
|
|
2125
2007
|
}
|
|
2126
2008
|
|
|
2127
|
-
& [data-part="item"]:hover {
|
|
2128
|
-
background: var(--button-background-hover);
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
& [data-part="item"]:focus-visible {
|
|
2132
|
-
outline: 2px solid var(--ui-accent-color);
|
|
2133
|
-
outline-offset: -2px;
|
|
2134
|
-
}
|
|
2135
|
-
|
|
2136
|
-
& [data-part="item"][aria-selected="true"] {
|
|
2137
|
-
color: var(--toggle-selected-text);
|
|
2138
|
-
background: var(--toggle-selected-bg);
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
2009
|
& [data-part="expander"] {
|
|
2142
2010
|
flex: 0 0 1rem;
|
|
2143
2011
|
text-align: center;
|
|
@@ -2152,62 +2020,62 @@ s(Z, "dependencies", [We]), s(Z, "hostName", "tree-view"), s(Z, "standaloneHostN
|
|
|
2152
2020
|
overflow-wrap: anywhere;
|
|
2153
2021
|
}
|
|
2154
2022
|
|
|
2155
|
-
& > [
|
|
2023
|
+
& > [role="status"] {
|
|
2156
2024
|
margin: 0;
|
|
2157
2025
|
padding: var(--ui-padding, 0.75rem);
|
|
2158
2026
|
}
|
|
2159
2027
|
|
|
2160
2028
|
@media (forced-colors: active) {
|
|
2161
|
-
& [
|
|
2029
|
+
& [role="treeitem"][aria-selected="true"] {
|
|
2162
2030
|
outline: 2px solid Highlight;
|
|
2163
2031
|
forced-color-adjust: auto;
|
|
2164
2032
|
}
|
|
2165
2033
|
}
|
|
2166
2034
|
`);
|
|
2167
|
-
function
|
|
2168
|
-
return (Array.isArray(t) ? t : t == null ? [] : [t]).filter((e) => ie(e) && e.type ===
|
|
2035
|
+
function _e(t) {
|
|
2036
|
+
return (Array.isArray(t) ? t : t == null ? [] : [t]).filter((e) => ie(e) && e.type === Je).map((e) => {
|
|
2169
2037
|
if (!ie(e)) throw new TypeError("TreeView children must be TreeItem nodes");
|
|
2170
|
-
const
|
|
2038
|
+
const i = e.props;
|
|
2171
2039
|
return {
|
|
2172
|
-
id:
|
|
2173
|
-
label:
|
|
2174
|
-
...
|
|
2175
|
-
...
|
|
2176
|
-
children:
|
|
2040
|
+
id: i.id,
|
|
2041
|
+
label: i.label,
|
|
2042
|
+
...i.textValue == null ? {} : { textValue: i.textValue },
|
|
2043
|
+
...i.value === void 0 ? {} : { value: i.value },
|
|
2044
|
+
children: _e(i.children)
|
|
2177
2045
|
};
|
|
2178
2046
|
});
|
|
2179
2047
|
}
|
|
2180
2048
|
function De(t, r) {
|
|
2181
|
-
const e = [],
|
|
2182
|
-
|
|
2049
|
+
const e = [], i = (s, n, a) => {
|
|
2050
|
+
s.forEach((l, c) => {
|
|
2183
2051
|
var h;
|
|
2184
|
-
e.push({ node: l, depth: n, parentId:
|
|
2052
|
+
e.push({ node: l, depth: n, parentId: a, position: c + 1, setSize: s.length }), (((h = l.children) == null ? void 0 : h.length) ?? 0) > 0 && r.has(l.id) && i(l.children ?? [], n + 1, l.id);
|
|
2185
2053
|
});
|
|
2186
2054
|
};
|
|
2187
|
-
return
|
|
2055
|
+
return i(t, 0, null), e;
|
|
2188
2056
|
}
|
|
2189
|
-
function
|
|
2190
|
-
const r = /* @__PURE__ */ new Set(), e = [],
|
|
2191
|
-
|
|
2057
|
+
function Lt(t) {
|
|
2058
|
+
const r = /* @__PURE__ */ new Set(), e = [], i = (s, n, a) => {
|
|
2059
|
+
s.forEach((l, c) => {
|
|
2192
2060
|
if (r.has(l.id)) throw new Error(`Duplicate tree item id: ${String(l.id)}`);
|
|
2193
|
-
r.add(l.id), e.push({ node: l, depth: n, parentId:
|
|
2061
|
+
r.add(l.id), e.push({ node: l, depth: n, parentId: a, position: c + 1, setSize: s.length }), i(l.children ?? [], n + 1, l.id);
|
|
2194
2062
|
});
|
|
2195
2063
|
};
|
|
2196
|
-
return
|
|
2064
|
+
return i(t, 0, null), e;
|
|
2197
2065
|
}
|
|
2198
|
-
function
|
|
2066
|
+
function Vt(t) {
|
|
2199
2067
|
return t.textValue != null ? t.textValue : typeof t.label == "string" || typeof t.label == "number" ? String(t.label) : String(t.id);
|
|
2200
2068
|
}
|
|
2201
|
-
function
|
|
2202
|
-
return t.length === r.length && t.every((e,
|
|
2069
|
+
function Ut(t, r) {
|
|
2070
|
+
return t.length === r.length && t.every((e, i) => Object.is(e, r[i]));
|
|
2203
2071
|
}
|
|
2204
|
-
function
|
|
2072
|
+
function Pt(t) {
|
|
2205
2073
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
2206
2074
|
}
|
|
2207
|
-
function
|
|
2075
|
+
function Bt(t) {
|
|
2208
2076
|
return t instanceof Element && t.closest('[data-part="expander"]') != null;
|
|
2209
2077
|
}
|
|
2210
|
-
class
|
|
2078
|
+
class ne extends y {
|
|
2211
2079
|
constructor(r = {}) {
|
|
2212
2080
|
if (super(r), r.onClick != null && typeof r.onClick != "function")
|
|
2213
2081
|
throw new TypeError("Button onClick must be a function");
|
|
@@ -2216,58 +2084,58 @@ class se extends g {
|
|
|
2216
2084
|
const {
|
|
2217
2085
|
children: r = [],
|
|
2218
2086
|
label: e,
|
|
2219
|
-
type:
|
|
2220
|
-
disabled:
|
|
2087
|
+
type: i = "button",
|
|
2088
|
+
disabled: s = !1,
|
|
2221
2089
|
pressed: n,
|
|
2222
|
-
busy:
|
|
2090
|
+
busy: a = !1,
|
|
2223
2091
|
busyLabel: l,
|
|
2224
|
-
id:
|
|
2092
|
+
id: c,
|
|
2225
2093
|
name: h,
|
|
2226
|
-
value:
|
|
2227
|
-
title:
|
|
2228
|
-
ariaLabel:
|
|
2229
|
-
onClick:
|
|
2230
|
-
} = this.props,
|
|
2094
|
+
value: p,
|
|
2095
|
+
title: f,
|
|
2096
|
+
ariaLabel: g,
|
|
2097
|
+
onClick: m
|
|
2098
|
+
} = this.props, v = (Array.isArray(r) ? r.length > 0 : r != null && typeof r != "boolean") ? r : e ?? "", O = a ? l ?? v : v, C = s || a;
|
|
2231
2099
|
return /* @__PURE__ */ u(
|
|
2232
2100
|
"button",
|
|
2233
2101
|
{
|
|
2234
|
-
id:
|
|
2102
|
+
id: c,
|
|
2235
2103
|
name: h,
|
|
2236
|
-
value:
|
|
2237
|
-
title:
|
|
2238
|
-
type:
|
|
2239
|
-
disabled:
|
|
2104
|
+
value: p == null ? void 0 : String(p),
|
|
2105
|
+
title: f,
|
|
2106
|
+
type: i,
|
|
2107
|
+
disabled: C,
|
|
2240
2108
|
className: E(this.props) || void 0,
|
|
2241
2109
|
"data-fray-component": "button",
|
|
2242
|
-
"aria-label":
|
|
2110
|
+
"aria-label": g,
|
|
2243
2111
|
"aria-pressed": n == null ? null : String(!!n),
|
|
2244
|
-
"aria-busy":
|
|
2245
|
-
onClick: (
|
|
2246
|
-
|
|
2112
|
+
"aria-busy": a ? "true" : null,
|
|
2113
|
+
onClick: (j) => {
|
|
2114
|
+
C || K(m, j);
|
|
2247
2115
|
},
|
|
2248
2116
|
children: O
|
|
2249
2117
|
}
|
|
2250
2118
|
);
|
|
2251
2119
|
}
|
|
2252
2120
|
}
|
|
2253
|
-
|
|
2254
|
-
[
|
|
2255
|
-
]),
|
|
2256
|
-
button
|
|
2121
|
+
o(ne, "baseStyles", [
|
|
2122
|
+
["button", ["uiline", "button"]]
|
|
2123
|
+
]), o(ne, "css", S`
|
|
2124
|
+
button {
|
|
2257
2125
|
font-family: inherit;
|
|
2258
2126
|
}
|
|
2259
2127
|
`);
|
|
2260
|
-
class Oe extends
|
|
2128
|
+
class Oe extends y {
|
|
2261
2129
|
constructor(e) {
|
|
2262
2130
|
super(e);
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
this.openEmitter =
|
|
2131
|
+
o(this, "openEmitter");
|
|
2132
|
+
o(this, "dialogId");
|
|
2133
|
+
o(this, "titleId");
|
|
2134
|
+
o(this, "descriptionId");
|
|
2135
|
+
o(this, "dialogElement", null);
|
|
2136
|
+
o(this, "restoreFocusTo", null);
|
|
2137
|
+
o(this, "synchronizedOpen", !1);
|
|
2138
|
+
this.openEmitter = z(this, e, !1, "dialog open state"), this.dialogId = F("dialog", e.id), this.titleId = `${this.dialogId}-title`, this.descriptionId = `${this.dialogId}-description`;
|
|
2271
2139
|
}
|
|
2272
2140
|
initialize() {
|
|
2273
2141
|
this.watch(this.openEmitter);
|
|
@@ -2275,10 +2143,10 @@ class Oe extends g {
|
|
|
2275
2143
|
render() {
|
|
2276
2144
|
const {
|
|
2277
2145
|
title: e,
|
|
2278
|
-
description:
|
|
2279
|
-
actions:
|
|
2146
|
+
description: i,
|
|
2147
|
+
actions: s,
|
|
2280
2148
|
closeLabel: n = "Close",
|
|
2281
|
-
showCloseButton:
|
|
2149
|
+
showCloseButton: a = !0,
|
|
2282
2150
|
children: l = []
|
|
2283
2151
|
} = this.props;
|
|
2284
2152
|
return /* @__PURE__ */ w(
|
|
@@ -2288,17 +2156,17 @@ class Oe extends g {
|
|
|
2288
2156
|
className: E(this.props) || void 0,
|
|
2289
2157
|
"data-fray-component": "dialog",
|
|
2290
2158
|
"aria-labelledby": this.titleId,
|
|
2291
|
-
"aria-describedby":
|
|
2159
|
+
"aria-describedby": i == null ? null : this.descriptionId,
|
|
2292
2160
|
"aria-modal": "true",
|
|
2293
|
-
ref: (
|
|
2161
|
+
ref: (c) => this.dialogElement = c,
|
|
2294
2162
|
children: [
|
|
2295
|
-
/* @__PURE__ */ u("header", {
|
|
2296
|
-
|
|
2163
|
+
/* @__PURE__ */ u("header", { children: /* @__PURE__ */ u("h2", { id: this.titleId, children: e }) }),
|
|
2164
|
+
i == null ? null : /* @__PURE__ */ u("p", { id: this.descriptionId, children: i }),
|
|
2297
2165
|
/* @__PURE__ */ u("div", { "data-part": "content", children: l }),
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2166
|
+
s == null && !a ? null : /* @__PURE__ */ w("footer", { children: [
|
|
2167
|
+
s,
|
|
2168
|
+
a ? /* @__PURE__ */ u(
|
|
2169
|
+
ne,
|
|
2302
2170
|
{
|
|
2303
2171
|
label: n,
|
|
2304
2172
|
onClick: () => this.requestClose()
|
|
@@ -2311,8 +2179,8 @@ class Oe extends g {
|
|
|
2311
2179
|
}
|
|
2312
2180
|
afterMount() {
|
|
2313
2181
|
const e = this.dialogElement;
|
|
2314
|
-
e != null && (this.listen(e, "cancel", (
|
|
2315
|
-
|
|
2182
|
+
e != null && (this.listen(e, "cancel", (i) => {
|
|
2183
|
+
i.preventDefault(), this.requestClose();
|
|
2316
2184
|
}), this.listen(e, "close", () => {
|
|
2317
2185
|
this.openEmitter.get() && this.openEmitter.set(!1, "native dialog closed"), this.finishClose();
|
|
2318
2186
|
}), this.syncOpenState());
|
|
@@ -2333,91 +2201,57 @@ class Oe extends g {
|
|
|
2333
2201
|
syncOpenState() {
|
|
2334
2202
|
const e = this.dialogElement;
|
|
2335
2203
|
if (e == null) return;
|
|
2336
|
-
const
|
|
2337
|
-
if (
|
|
2338
|
-
const
|
|
2339
|
-
this.restoreFocusTo =
|
|
2204
|
+
const i = this.openEmitter.get();
|
|
2205
|
+
if (i && !this.synchronizedOpen) {
|
|
2206
|
+
const s = document.activeElement;
|
|
2207
|
+
this.restoreFocusTo = s instanceof HTMLElement ? s : null, Gt(e), this.synchronizedOpen = !0, Qt(e, this.props.initialFocusRef);
|
|
2340
2208
|
return;
|
|
2341
2209
|
}
|
|
2342
|
-
!
|
|
2210
|
+
!i && this.synchronizedOpen && (e.open && typeof e.close == "function" ? e.close() : e.removeAttribute("open"), this.finishClose());
|
|
2343
2211
|
}
|
|
2344
2212
|
finishClose() {
|
|
2345
2213
|
if (!this.synchronizedOpen && this.restoreFocusTo == null) return;
|
|
2346
2214
|
this.synchronizedOpen = !1;
|
|
2347
2215
|
const e = this.restoreFocusTo;
|
|
2348
|
-
this.restoreFocusTo = null, (e == null ? void 0 : e.isConnected) === !0 && e.focus(),
|
|
2216
|
+
this.restoreFocusTo = null, (e == null ? void 0 : e.isConnected) === !0 && e.focus(), K(this.props.onClose);
|
|
2349
2217
|
}
|
|
2350
2218
|
}
|
|
2351
|
-
|
|
2352
|
-
dialog
|
|
2219
|
+
o(Oe, "dependencies", [ne]), o(Oe, "css", S`
|
|
2220
|
+
dialog {
|
|
2353
2221
|
width: min(38rem, calc(100vw - 2rem));
|
|
2354
2222
|
max-height: min(42rem, calc(100dvh - 2rem));
|
|
2355
2223
|
padding: 0;
|
|
2356
|
-
color: var(--fray-panel-color, var(--ui-text-color));
|
|
2357
|
-
background: var(--fray-panel-background, var(--panel-bg));
|
|
2358
|
-
border: var(--fray-panel-border, var(--panel-border));
|
|
2359
|
-
border-radius: var(--fray-panel-radius, var(--panel-radius));
|
|
2360
|
-
box-shadow: var(--fray-dialog-shadow, var(--fray-panel-shadow));
|
|
2361
2224
|
}
|
|
2362
2225
|
|
|
2363
|
-
dialog
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
dialog[data-fray-component="dialog"] > [data-part] {
|
|
2226
|
+
dialog > header,
|
|
2227
|
+
dialog > p,
|
|
2228
|
+
dialog > [data-part="content"],
|
|
2229
|
+
dialog > footer {
|
|
2368
2230
|
padding: var(--panel-padding, 0.75rem);
|
|
2369
2231
|
}
|
|
2370
2232
|
|
|
2371
|
-
dialog
|
|
2372
|
-
|
|
2373
|
-
--fray-dialog-header-color,
|
|
2374
|
-
var(--fray-section-header-color, var(--fray-header-color))
|
|
2375
|
-
);
|
|
2376
|
-
background: var(
|
|
2377
|
-
--fray-dialog-header-background,
|
|
2378
|
-
var(--fray-section-header-background, var(--fray-header-background))
|
|
2379
|
-
);
|
|
2380
|
-
border-block-end: var(
|
|
2381
|
-
--fray-section-header-border,
|
|
2382
|
-
var(--fray-header-border)
|
|
2383
|
-
);
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
dialog[data-fray-component="dialog"] > [data-part="header"] h2,
|
|
2387
|
-
dialog[data-fray-component="dialog"] > [data-part="description"] {
|
|
2233
|
+
dialog > header h2,
|
|
2234
|
+
dialog > p {
|
|
2388
2235
|
margin: 0;
|
|
2389
2236
|
}
|
|
2390
2237
|
|
|
2391
|
-
dialog
|
|
2238
|
+
dialog > [data-part="content"] {
|
|
2392
2239
|
overflow: auto;
|
|
2393
2240
|
}
|
|
2394
2241
|
|
|
2395
|
-
dialog
|
|
2242
|
+
dialog > footer {
|
|
2396
2243
|
display: flex;
|
|
2397
2244
|
justify-content: flex-end;
|
|
2398
2245
|
gap: var(--spacing-small, 0.5rem);
|
|
2399
|
-
border-block-start: 1px solid var(--ui-border-color);
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
2403
|
-
dialog[data-fray-component="dialog"][open] {
|
|
2404
|
-
animation: fray-dialog-enter 120ms ease-out;
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
|
|
2408
|
-
@keyframes fray-dialog-enter {
|
|
2409
|
-
from {
|
|
2410
|
-
transform: translateY(0.4rem);
|
|
2411
|
-
}
|
|
2412
2246
|
}
|
|
2413
2247
|
|
|
2414
2248
|
@media (forced-colors: active) {
|
|
2415
|
-
dialog
|
|
2249
|
+
dialog {
|
|
2416
2250
|
border: 2px solid CanvasText;
|
|
2417
2251
|
}
|
|
2418
2252
|
}
|
|
2419
2253
|
`);
|
|
2420
|
-
function
|
|
2254
|
+
function Gt(t) {
|
|
2421
2255
|
if (!t.open) {
|
|
2422
2256
|
if (typeof t.showModal == "function") {
|
|
2423
2257
|
t.showModal();
|
|
@@ -2426,52 +2260,52 @@ function Pt(t) {
|
|
|
2426
2260
|
t.setAttribute("open", "");
|
|
2427
2261
|
}
|
|
2428
2262
|
}
|
|
2429
|
-
function
|
|
2430
|
-
const
|
|
2263
|
+
function Qt(t, r) {
|
|
2264
|
+
const i = (r == null || typeof r == "function" ? null : r.current) ?? t.querySelector(
|
|
2431
2265
|
'[autofocus], button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
2432
2266
|
);
|
|
2433
|
-
|
|
2267
|
+
i == null || i.focus();
|
|
2434
2268
|
}
|
|
2435
|
-
const
|
|
2269
|
+
const q = class q extends D {
|
|
2436
2270
|
constructor(r = {}) {
|
|
2437
|
-
super({ ...r, symbols:
|
|
2271
|
+
super({ ...r, symbols: q.symbols });
|
|
2438
2272
|
}
|
|
2439
2273
|
};
|
|
2440
|
-
|
|
2274
|
+
o(q, "hostName", "quad-checkbox"), o(q, "standaloneHostName", "quad-checkbox"), o(q, "symbols", [
|
|
2441
2275
|
["✖", b.Deny],
|
|
2442
2276
|
["☐", b.Neutral],
|
|
2443
2277
|
["✓", b.Prefer],
|
|
2444
2278
|
["+", b.Require]
|
|
2445
|
-
]),
|
|
2446
|
-
let
|
|
2447
|
-
const
|
|
2279
|
+
]), o(q, "defaultSemanticState", b.Neutral);
|
|
2280
|
+
let Ce = q;
|
|
2281
|
+
const L = class L extends D {
|
|
2448
2282
|
constructor(r = {}) {
|
|
2449
|
-
super({ ...r, symbols:
|
|
2283
|
+
super({ ...r, symbols: L.symbols });
|
|
2450
2284
|
}
|
|
2451
2285
|
};
|
|
2452
|
-
|
|
2286
|
+
o(L, "hostName", "tri-checkbox"), o(L, "standaloneHostName", "tri-checkbox"), o(L, "symbols", [
|
|
2453
2287
|
["✖", b.Deny],
|
|
2454
2288
|
["☐", b.Neutral],
|
|
2455
2289
|
["✓", b.Prefer]
|
|
2456
|
-
]),
|
|
2457
|
-
let
|
|
2458
|
-
class ee extends
|
|
2290
|
+
]), o(L, "defaultSemanticState", b.Neutral);
|
|
2291
|
+
let Ke = L;
|
|
2292
|
+
class ee extends y {
|
|
2459
2293
|
constructor(e = {}) {
|
|
2460
2294
|
var n;
|
|
2461
2295
|
super(e);
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
this.inputId =
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2296
|
+
o(this, "inputId");
|
|
2297
|
+
o(this, "errorId");
|
|
2298
|
+
o(this, "optionsEmitter");
|
|
2299
|
+
o(this, "valueEmitter");
|
|
2300
|
+
o(this, "ownsOptionsEmitter");
|
|
2301
|
+
this.inputId = F("dropdown", e.id), this.errorId = `${this.inputId}-error`;
|
|
2302
|
+
const i = e.options ?? [];
|
|
2303
|
+
Wt(i) ? (this.optionsEmitter = i, this.ownsOptionsEmitter = !1) : (fe(i), this.optionsEmitter = new x(i, {
|
|
2470
2304
|
owner: this,
|
|
2471
2305
|
purpose: "dropdown options"
|
|
2472
2306
|
}), this.ownsOptionsEmitter = !0);
|
|
2473
|
-
const
|
|
2474
|
-
this.valueEmitter =
|
|
2307
|
+
const s = ((n = this.optionsEmitter.get()[0]) == null ? void 0 : n.value) ?? "";
|
|
2308
|
+
this.valueEmitter = z(this, e, s, "dropdown value");
|
|
2475
2309
|
}
|
|
2476
2310
|
initialize() {
|
|
2477
2311
|
this.watch(this.valueEmitter, this.optionsEmitter);
|
|
@@ -2479,66 +2313,65 @@ class ee extends g {
|
|
|
2479
2313
|
render() {
|
|
2480
2314
|
const {
|
|
2481
2315
|
label: e,
|
|
2482
|
-
name:
|
|
2483
|
-
disabled:
|
|
2316
|
+
name: i,
|
|
2317
|
+
disabled: s = !1,
|
|
2484
2318
|
required: n = !1,
|
|
2485
|
-
error:
|
|
2319
|
+
error: a = null,
|
|
2486
2320
|
placeholder: l = "Select…",
|
|
2487
|
-
ariaLabel:
|
|
2321
|
+
ariaLabel: c,
|
|
2488
2322
|
onChange: h
|
|
2489
|
-
} = this.props,
|
|
2490
|
-
fe(
|
|
2491
|
-
const
|
|
2323
|
+
} = this.props, p = this.optionsEmitter.get() ?? [];
|
|
2324
|
+
fe(p);
|
|
2325
|
+
const f = this.valueEmitter.get(), g = this.Host;
|
|
2492
2326
|
return /* @__PURE__ */ w(
|
|
2493
|
-
|
|
2327
|
+
g,
|
|
2494
2328
|
{
|
|
2495
|
-
className: E(this.props)
|
|
2496
|
-
"data-disabled":
|
|
2329
|
+
className: R("selectshell", E(this.props)),
|
|
2330
|
+
"data-disabled": s ? "" : null,
|
|
2497
2331
|
"data-required": n ? "" : null,
|
|
2498
|
-
"data-error":
|
|
2332
|
+
"data-error": a == null ? null : "",
|
|
2499
2333
|
children: [
|
|
2500
2334
|
e == null ? null : /* @__PURE__ */ u("label", { htmlFor: this.inputId, children: e }),
|
|
2501
2335
|
/* @__PURE__ */ w(
|
|
2502
2336
|
"select",
|
|
2503
2337
|
{
|
|
2504
2338
|
id: this.inputId,
|
|
2505
|
-
name:
|
|
2506
|
-
value:
|
|
2507
|
-
disabled:
|
|
2339
|
+
name: i,
|
|
2340
|
+
value: f == null ? "" : String(f),
|
|
2341
|
+
disabled: s,
|
|
2508
2342
|
required: n,
|
|
2509
|
-
"aria-label": e == null ?
|
|
2510
|
-
"aria-invalid":
|
|
2511
|
-
"aria-describedby":
|
|
2512
|
-
onChange: (
|
|
2513
|
-
const
|
|
2514
|
-
this.valueEmitter.set(O, "dropdown selection"),
|
|
2343
|
+
"aria-label": e == null ? c : null,
|
|
2344
|
+
"aria-invalid": a == null ? null : "true",
|
|
2345
|
+
"aria-describedby": a == null ? null : this.errorId,
|
|
2346
|
+
onChange: (m) => {
|
|
2347
|
+
const I = Jt(m, "dropdown change"), v = p.find(({ value: C }) => String(C) === I), O = (v == null ? void 0 : v.value) ?? I;
|
|
2348
|
+
this.valueEmitter.set(O, "dropdown selection"), K(h, O, m);
|
|
2515
2349
|
},
|
|
2516
2350
|
children: [
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
if (
|
|
2351
|
+
f == null || f === "" ? /* @__PURE__ */ u("option", { value: "", disabled: n, selected: !0, children: l }) : null,
|
|
2352
|
+
p.map((m) => {
|
|
2353
|
+
if (m == null || !Object.hasOwn(m, "value"))
|
|
2520
2354
|
throw new TypeError("Dropdown options require value and label fields");
|
|
2521
2355
|
return /* @__PURE__ */ u(
|
|
2522
2356
|
"option",
|
|
2523
2357
|
{
|
|
2524
|
-
value: String(
|
|
2525
|
-
disabled: !!
|
|
2526
|
-
selected: Object.is(
|
|
2527
|
-
children:
|
|
2358
|
+
value: String(m.value),
|
|
2359
|
+
disabled: !!m.disabled,
|
|
2360
|
+
selected: Object.is(f, m.value),
|
|
2361
|
+
children: m.label ?? String(m.value)
|
|
2528
2362
|
},
|
|
2529
|
-
String(
|
|
2363
|
+
String(m.value)
|
|
2530
2364
|
);
|
|
2531
2365
|
})
|
|
2532
2366
|
]
|
|
2533
2367
|
}
|
|
2534
2368
|
),
|
|
2535
|
-
|
|
2369
|
+
a == null ? null : /* @__PURE__ */ u(
|
|
2536
2370
|
"p",
|
|
2537
2371
|
{
|
|
2538
2372
|
id: this.errorId,
|
|
2539
|
-
"data-part": "error",
|
|
2540
2373
|
role: "alert",
|
|
2541
|
-
children: String(
|
|
2374
|
+
children: String(a)
|
|
2542
2375
|
}
|
|
2543
2376
|
)
|
|
2544
2377
|
]
|
|
@@ -2546,33 +2379,30 @@ class ee extends g {
|
|
|
2546
2379
|
);
|
|
2547
2380
|
}
|
|
2548
2381
|
}
|
|
2549
|
-
|
|
2382
|
+
o(ee, "hostName", "dropdown"), o(ee, "standaloneHostName", "drop-down"), o(ee, "baseStyles", [
|
|
2550
2383
|
["&", ["labeledinput", "inputline"]],
|
|
2551
|
-
["& >
|
|
2552
|
-
|
|
2553
|
-
["&[data-disabled]", ["disabled"]],
|
|
2554
|
-
["&[data-error]", ["error"]]
|
|
2555
|
-
]), s(ee, "css", v`
|
|
2384
|
+
["& > select", ["input", "inputline"]]
|
|
2385
|
+
]), o(ee, "css", S`
|
|
2556
2386
|
& {
|
|
2557
2387
|
position: relative;
|
|
2558
2388
|
}
|
|
2559
2389
|
`);
|
|
2560
|
-
function
|
|
2390
|
+
function Wt(t) {
|
|
2561
2391
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
2562
2392
|
}
|
|
2563
|
-
function
|
|
2393
|
+
function Jt(t, r) {
|
|
2564
2394
|
const e = t.currentTarget;
|
|
2565
2395
|
if (e == null || typeof Reflect.get(e, "value") != "string")
|
|
2566
2396
|
throw new TypeError(`${r} requires a value-bearing event target`);
|
|
2567
2397
|
return Reflect.get(e, "value");
|
|
2568
2398
|
}
|
|
2569
|
-
class te extends
|
|
2399
|
+
class te extends y {
|
|
2570
2400
|
constructor(e = {}) {
|
|
2571
2401
|
super(e);
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
this.inputId =
|
|
2402
|
+
o(this, "inputId");
|
|
2403
|
+
o(this, "errorId");
|
|
2404
|
+
o(this, "valueEmitter");
|
|
2405
|
+
this.inputId = F("textbox", e.id), this.errorId = `${this.inputId}-error`, this.valueEmitter = z(this, e, "", "textbox value");
|
|
2576
2406
|
}
|
|
2577
2407
|
initialize() {
|
|
2578
2408
|
this.watch(this.valueEmitter);
|
|
@@ -2580,28 +2410,28 @@ class te extends g {
|
|
|
2580
2410
|
render() {
|
|
2581
2411
|
const {
|
|
2582
2412
|
label: e,
|
|
2583
|
-
placeholder:
|
|
2584
|
-
type:
|
|
2413
|
+
placeholder: i,
|
|
2414
|
+
type: s = "text",
|
|
2585
2415
|
name: n,
|
|
2586
|
-
disabled:
|
|
2416
|
+
disabled: a = !1,
|
|
2587
2417
|
required: l = !1,
|
|
2588
|
-
readOnly:
|
|
2418
|
+
readOnly: c = !1,
|
|
2589
2419
|
error: h = null,
|
|
2590
|
-
autoComplete:
|
|
2591
|
-
inputMode:
|
|
2592
|
-
minLength:
|
|
2593
|
-
maxLength:
|
|
2594
|
-
pattern:
|
|
2595
|
-
ariaLabel:
|
|
2420
|
+
autoComplete: p,
|
|
2421
|
+
inputMode: f,
|
|
2422
|
+
minLength: g,
|
|
2423
|
+
maxLength: m,
|
|
2424
|
+
pattern: I,
|
|
2425
|
+
ariaLabel: v,
|
|
2596
2426
|
inputRef: O,
|
|
2597
|
-
onInput:
|
|
2598
|
-
onChange:
|
|
2599
|
-
} = this.props, A = this.valueEmitter.get() ?? "",
|
|
2427
|
+
onInput: C,
|
|
2428
|
+
onChange: j
|
|
2429
|
+
} = this.props, A = this.valueEmitter.get() ?? "", H = this.Host;
|
|
2600
2430
|
return /* @__PURE__ */ w(
|
|
2601
|
-
|
|
2431
|
+
H,
|
|
2602
2432
|
{
|
|
2603
2433
|
className: E(this.props) || null,
|
|
2604
|
-
"data-disabled":
|
|
2434
|
+
"data-disabled": a ? "" : null,
|
|
2605
2435
|
"data-required": l ? "" : null,
|
|
2606
2436
|
"data-error": h == null ? null : "",
|
|
2607
2437
|
children: [
|
|
@@ -2611,28 +2441,28 @@ class te extends g {
|
|
|
2611
2441
|
{
|
|
2612
2442
|
id: this.inputId,
|
|
2613
2443
|
name: n,
|
|
2614
|
-
type:
|
|
2444
|
+
type: s,
|
|
2615
2445
|
value: A,
|
|
2616
|
-
placeholder:
|
|
2617
|
-
disabled:
|
|
2446
|
+
placeholder: i,
|
|
2447
|
+
disabled: a,
|
|
2618
2448
|
required: l,
|
|
2619
|
-
readOnly:
|
|
2620
|
-
autoComplete:
|
|
2621
|
-
inputMode:
|
|
2622
|
-
minLength:
|
|
2623
|
-
maxLength:
|
|
2624
|
-
pattern:
|
|
2449
|
+
readOnly: c,
|
|
2450
|
+
autoComplete: p,
|
|
2451
|
+
inputMode: f,
|
|
2452
|
+
minLength: g,
|
|
2453
|
+
maxLength: m,
|
|
2454
|
+
pattern: I,
|
|
2625
2455
|
ref: O,
|
|
2626
|
-
"aria-label": e == null ?
|
|
2456
|
+
"aria-label": e == null ? v : null,
|
|
2627
2457
|
"aria-invalid": h == null ? null : "true",
|
|
2628
2458
|
"aria-describedby": h == null ? null : this.errorId,
|
|
2629
2459
|
onInput: (T) => {
|
|
2630
|
-
const
|
|
2631
|
-
this.valueEmitter.set(
|
|
2460
|
+
const G = je(T, "textbox input");
|
|
2461
|
+
this.valueEmitter.set(G, "textbox input"), K(C, G, T);
|
|
2632
2462
|
},
|
|
2633
|
-
onChange: (T) =>
|
|
2634
|
-
|
|
2635
|
-
|
|
2463
|
+
onChange: (T) => K(
|
|
2464
|
+
j,
|
|
2465
|
+
je(T, "textbox change"),
|
|
2636
2466
|
T
|
|
2637
2467
|
)
|
|
2638
2468
|
}
|
|
@@ -2641,7 +2471,6 @@ class te extends g {
|
|
|
2641
2471
|
"p",
|
|
2642
2472
|
{
|
|
2643
2473
|
id: this.errorId,
|
|
2644
|
-
"data-part": "error",
|
|
2645
2474
|
role: "alert",
|
|
2646
2475
|
children: String(h)
|
|
2647
2476
|
}
|
|
@@ -2651,96 +2480,91 @@ class te extends g {
|
|
|
2651
2480
|
);
|
|
2652
2481
|
}
|
|
2653
2482
|
}
|
|
2654
|
-
|
|
2483
|
+
o(te, "hostName", "textbox"), o(te, "standaloneHostName", "text-box"), o(te, "baseStyles", [
|
|
2655
2484
|
["&", ["labeledinput", "inputline"]],
|
|
2656
|
-
["& >
|
|
2657
|
-
|
|
2658
|
-
["&[data-disabled]", ["disabled"]],
|
|
2659
|
-
["&[data-error]", ["error"]]
|
|
2660
|
-
]), s(te, "css", v`
|
|
2485
|
+
["& > input", ["input", "inputline"]]
|
|
2486
|
+
]), o(te, "css", S`
|
|
2661
2487
|
& input {
|
|
2662
2488
|
cursor: text;
|
|
2663
2489
|
}
|
|
2664
2490
|
|
|
2665
|
-
& > [
|
|
2491
|
+
& > [role="alert"] {
|
|
2666
2492
|
margin: 0;
|
|
2667
|
-
color: var(--fray-color-error, var(--error-color));
|
|
2668
2493
|
}
|
|
2669
2494
|
`);
|
|
2670
|
-
function
|
|
2495
|
+
function je(t, r) {
|
|
2671
2496
|
const e = t.currentTarget;
|
|
2672
2497
|
if (e == null || typeof Reflect.get(e, "value") != "string")
|
|
2673
2498
|
throw new TypeError(`${r} requires a value-bearing event target`);
|
|
2674
2499
|
return Reflect.get(e, "value");
|
|
2675
2500
|
}
|
|
2676
|
-
class Ae extends
|
|
2501
|
+
class Ae extends y {
|
|
2677
2502
|
constructor(e = {}) {
|
|
2678
2503
|
var n;
|
|
2679
2504
|
super(e);
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
const
|
|
2684
|
-
|
|
2685
|
-
const
|
|
2686
|
-
this.valueEmitter =
|
|
2505
|
+
o(this, "valueEmitter");
|
|
2506
|
+
o(this, "groupId");
|
|
2507
|
+
o(this, "legendId");
|
|
2508
|
+
const i = e.options ?? [];
|
|
2509
|
+
Fe(i);
|
|
2510
|
+
const s = ((n = i[0]) == null ? void 0 : n[0]) ?? null;
|
|
2511
|
+
this.valueEmitter = z(
|
|
2687
2512
|
this,
|
|
2688
2513
|
e,
|
|
2689
|
-
|
|
2514
|
+
s ?? null,
|
|
2690
2515
|
"toggle value"
|
|
2691
|
-
), this.groupId =
|
|
2516
|
+
), this.groupId = F("toggle", e.id), this.legendId = `${this.groupId}-label`;
|
|
2692
2517
|
}
|
|
2693
2518
|
initialize() {
|
|
2694
2519
|
this.watch(this.valueEmitter);
|
|
2695
2520
|
}
|
|
2696
|
-
selectOption(e,
|
|
2697
|
-
this.props.disabled || (this.valueEmitter.set(e, "toggle option selected"),
|
|
2521
|
+
selectOption(e, i = null) {
|
|
2522
|
+
this.props.disabled || (this.valueEmitter.set(e, "toggle option selected"), K(this.props.onChange, e, i));
|
|
2698
2523
|
}
|
|
2699
2524
|
render() {
|
|
2700
2525
|
const {
|
|
2701
2526
|
options: e = [],
|
|
2702
|
-
label:
|
|
2703
|
-
disabled:
|
|
2527
|
+
label: i,
|
|
2528
|
+
disabled: s = !1,
|
|
2704
2529
|
required: n = !1
|
|
2705
2530
|
} = this.props;
|
|
2706
|
-
|
|
2707
|
-
const
|
|
2531
|
+
Fe(e);
|
|
2532
|
+
const a = this.valueEmitter.get(), l = Math.max(
|
|
2708
2533
|
0,
|
|
2709
|
-
e.findIndex(([
|
|
2534
|
+
e.findIndex(([c]) => Object.is(c, a))
|
|
2710
2535
|
);
|
|
2711
2536
|
return /* @__PURE__ */ w(
|
|
2712
2537
|
"fieldset",
|
|
2713
2538
|
{
|
|
2714
2539
|
id: this.groupId,
|
|
2715
|
-
disabled:
|
|
2540
|
+
disabled: s,
|
|
2716
2541
|
className: E(this.props) || void 0,
|
|
2717
2542
|
"data-fray-component": "toggle",
|
|
2718
|
-
"data-disabled":
|
|
2543
|
+
"data-disabled": s ? "" : null,
|
|
2719
2544
|
"aria-required": n ? "true" : null,
|
|
2720
2545
|
children: [
|
|
2721
|
-
|
|
2546
|
+
i == null ? null : /* @__PURE__ */ u("legend", { id: this.legendId, children: i }),
|
|
2722
2547
|
/* @__PURE__ */ u(
|
|
2723
2548
|
"div",
|
|
2724
2549
|
{
|
|
2725
2550
|
"data-part": "options",
|
|
2726
2551
|
role: "radiogroup",
|
|
2727
|
-
"aria-label":
|
|
2728
|
-
"aria-labelledby":
|
|
2729
|
-
children: e.map(([
|
|
2552
|
+
"aria-label": i == null ? this.props.ariaLabel : null,
|
|
2553
|
+
"aria-labelledby": i == null ? null : this.legendId,
|
|
2554
|
+
children: e.map(([c, h], p) => /* @__PURE__ */ u(
|
|
2730
2555
|
"button",
|
|
2731
2556
|
{
|
|
2732
2557
|
type: "button",
|
|
2733
2558
|
role: "radio",
|
|
2734
|
-
disabled:
|
|
2735
|
-
"
|
|
2736
|
-
"
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
onKeyDown: (m) => this.handleKeyDown(m, f, e),
|
|
2559
|
+
disabled: s,
|
|
2560
|
+
"aria-checked": Object.is(a, c) ? "true" : "false",
|
|
2561
|
+
"data-value": String(c),
|
|
2562
|
+
tabIndex: p === l ? 0 : -1,
|
|
2563
|
+
onClick: (f) => this.selectOption(c, f),
|
|
2564
|
+
onKeyDown: (f) => this.handleKeyDown(f, p, e),
|
|
2741
2565
|
children: h
|
|
2742
2566
|
},
|
|
2743
|
-
String(
|
|
2567
|
+
String(c)
|
|
2744
2568
|
))
|
|
2745
2569
|
}
|
|
2746
2570
|
)
|
|
@@ -2748,74 +2572,54 @@ class Ae extends g {
|
|
|
2748
2572
|
}
|
|
2749
2573
|
);
|
|
2750
2574
|
}
|
|
2751
|
-
handleKeyDown(e,
|
|
2575
|
+
handleKeyDown(e, i, s) {
|
|
2752
2576
|
const { key: n } = e;
|
|
2753
|
-
let
|
|
2754
|
-
if (n === "ArrowRight" || n === "ArrowDown")
|
|
2577
|
+
let a;
|
|
2578
|
+
if (n === "ArrowRight" || n === "ArrowDown") a = (i + 1) % s.length;
|
|
2755
2579
|
else if (n === "ArrowLeft" || n === "ArrowUp")
|
|
2756
|
-
|
|
2757
|
-
else if (n === "Home")
|
|
2758
|
-
else if (n === "End")
|
|
2580
|
+
a = (i - 1 + s.length) % s.length;
|
|
2581
|
+
else if (n === "Home") a = 0;
|
|
2582
|
+
else if (n === "End") a = s.length - 1;
|
|
2759
2583
|
else return;
|
|
2760
2584
|
e.preventDefault();
|
|
2761
|
-
const l =
|
|
2585
|
+
const l = s[a];
|
|
2762
2586
|
if (l != null && (this.selectOption(l[0], e), this.dom instanceof Element)) {
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2587
|
+
const c = this.dom.querySelectorAll('[role="radio"]')[a];
|
|
2588
|
+
c == null || c.focus();
|
|
2765
2589
|
}
|
|
2766
2590
|
}
|
|
2767
2591
|
}
|
|
2768
|
-
|
|
2769
|
-
['fieldset[data-
|
|
2770
|
-
['fieldset[data-
|
|
2771
|
-
]),
|
|
2772
|
-
fieldset[data-
|
|
2592
|
+
o(Ae, "baseStyles", [
|
|
2593
|
+
['fieldset:has(> [data-part="options"]) > [data-part="options"]', ["uiline"]],
|
|
2594
|
+
['fieldset:has(> [data-part="options"]) [role="radio"]', ["uiline", "button"]]
|
|
2595
|
+
]), o(Ae, "css", S`
|
|
2596
|
+
fieldset:has(> [data-part="options"]) {
|
|
2773
2597
|
margin: 0;
|
|
2774
2598
|
padding: 0;
|
|
2775
2599
|
border: 0;
|
|
2776
2600
|
}
|
|
2777
2601
|
|
|
2778
|
-
fieldset[data-
|
|
2602
|
+
fieldset:has(> [data-part="options"]) > [data-part="options"] {
|
|
2779
2603
|
display: flex;
|
|
2780
2604
|
padding: 0;
|
|
2781
2605
|
}
|
|
2782
2606
|
|
|
2783
|
-
fieldset[data-fray-component="toggle"] [data-part="option"] {
|
|
2784
|
-
background: var(--fray-toggle-button-background, var(--fray-button-background));
|
|
2785
|
-
border-radius: 0;
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
fieldset[data-fray-component="toggle"] [data-part="option"]:first-child {
|
|
2789
|
-
border-radius: var(--ui-border-radius) 0 0 var(--ui-border-radius);
|
|
2790
|
-
}
|
|
2791
|
-
|
|
2792
|
-
fieldset[data-fray-component="toggle"] [data-part="option"]:last-child {
|
|
2793
|
-
border-radius: 0 var(--ui-border-radius) var(--ui-border-radius) 0;
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
fieldset[data-fray-component="toggle"] [data-part="option"][aria-checked="true"] {
|
|
2797
|
-
background: var(
|
|
2798
|
-
--fray-toggle-button-background-checked,
|
|
2799
|
-
var(--fray-selection-background, var(--toggle-selected-bg))
|
|
2800
|
-
);
|
|
2801
|
-
color: var(--fray-selection-color, var(--toggle-selected-text));
|
|
2802
|
-
}
|
|
2803
2607
|
`);
|
|
2804
|
-
function
|
|
2608
|
+
function Fe(t) {
|
|
2805
2609
|
fe(t);
|
|
2806
2610
|
for (const r of t)
|
|
2807
2611
|
if (!Array.isArray(r) || r.length < 2)
|
|
2808
2612
|
throw new TypeError("Toggle options must be [value, label] tuples");
|
|
2809
2613
|
}
|
|
2810
|
-
class
|
|
2614
|
+
class he extends y {
|
|
2811
2615
|
render() {
|
|
2812
2616
|
const {
|
|
2813
2617
|
children: r = [],
|
|
2814
2618
|
id: e,
|
|
2815
|
-
label:
|
|
2816
|
-
orientation:
|
|
2619
|
+
label: i = "Actions",
|
|
2620
|
+
orientation: s = "horizontal"
|
|
2817
2621
|
} = this.props;
|
|
2818
|
-
if (!["horizontal", "vertical"].includes(
|
|
2622
|
+
if (!["horizontal", "vertical"].includes(s))
|
|
2819
2623
|
throw new TypeError("Toolbar orientation must be horizontal or vertical");
|
|
2820
2624
|
const n = this.Host;
|
|
2821
2625
|
return /* @__PURE__ */ u(
|
|
@@ -2823,18 +2627,16 @@ class re extends g {
|
|
|
2823
2627
|
{
|
|
2824
2628
|
id: e,
|
|
2825
2629
|
role: "toolbar",
|
|
2826
|
-
className: E(this.props)
|
|
2827
|
-
"data-orientation":
|
|
2828
|
-
"aria-label":
|
|
2829
|
-
"aria-orientation":
|
|
2630
|
+
className: R("toolbarlike", E(this.props)),
|
|
2631
|
+
"data-orientation": s,
|
|
2632
|
+
"aria-label": i,
|
|
2633
|
+
"aria-orientation": s,
|
|
2830
2634
|
children: r
|
|
2831
2635
|
}
|
|
2832
2636
|
);
|
|
2833
2637
|
}
|
|
2834
2638
|
}
|
|
2835
|
-
|
|
2836
|
-
["&", ["toolbar"]]
|
|
2837
|
-
]), s(re, "css", v`
|
|
2639
|
+
o(he, "hostName", "toolbar"), o(he, "standaloneHostName", "tool-bar"), o(he, "css", S`
|
|
2838
2640
|
& {
|
|
2839
2641
|
display: flex;
|
|
2840
2642
|
flex-wrap: wrap;
|
|
@@ -2848,31 +2650,31 @@ s(re, "hostName", "toolbar"), s(re, "standaloneHostName", "tool-bar"), s(re, "ba
|
|
|
2848
2650
|
align-items: stretch;
|
|
2849
2651
|
}
|
|
2850
2652
|
`);
|
|
2851
|
-
class
|
|
2653
|
+
class pe extends y {
|
|
2852
2654
|
constructor(e) {
|
|
2853
2655
|
super(e);
|
|
2854
|
-
|
|
2855
|
-
if (this.progressId =
|
|
2656
|
+
o(this, "progressId");
|
|
2657
|
+
if (this.progressId = F("progress", e.id), e.valueEmitter != null && !_t(e.valueEmitter))
|
|
2856
2658
|
throw new TypeError("ProgressBar valueEmitter must be a readable emitter");
|
|
2857
2659
|
}
|
|
2858
2660
|
render() {
|
|
2859
2661
|
const e = this.props.max ?? 100;
|
|
2860
2662
|
if (!Number.isFinite(e) || e <= 0)
|
|
2861
2663
|
throw new RangeError("ProgressBar max must be a positive finite number");
|
|
2862
|
-
const
|
|
2863
|
-
if (
|
|
2664
|
+
const i = this.props.valueEmitter == null ? this.props.value ?? null : this.read(this.props.valueEmitter);
|
|
2665
|
+
if (i != null && (!Number.isFinite(i) || i < 0))
|
|
2864
2666
|
throw new RangeError("ProgressBar value must be null or a non-negative finite number");
|
|
2865
|
-
const
|
|
2866
|
-
return /* @__PURE__ */ w(
|
|
2667
|
+
const s = i == null ? null : Math.min(i, e), n = this.props.valueText ?? (s == null ? "In progress" : `${Math.round(s / e * 100)}%`), a = this.Host;
|
|
2668
|
+
return /* @__PURE__ */ w(a, { className: E(this.props) || null, children: [
|
|
2867
2669
|
/* @__PURE__ */ w("div", { "data-part": "label-line", children: [
|
|
2868
2670
|
/* @__PURE__ */ u("label", { htmlFor: this.progressId, children: this.props.label }),
|
|
2869
|
-
/* @__PURE__ */ u("
|
|
2671
|
+
/* @__PURE__ */ u("output", { children: n })
|
|
2870
2672
|
] }),
|
|
2871
2673
|
/* @__PURE__ */ u(
|
|
2872
2674
|
"progress",
|
|
2873
2675
|
{
|
|
2874
2676
|
id: this.progressId,
|
|
2875
|
-
value:
|
|
2677
|
+
value: s ?? void 0,
|
|
2876
2678
|
max: e,
|
|
2877
2679
|
"aria-valuetext": n,
|
|
2878
2680
|
children: n
|
|
@@ -2881,7 +2683,7 @@ class he extends g {
|
|
|
2881
2683
|
] });
|
|
2882
2684
|
}
|
|
2883
2685
|
}
|
|
2884
|
-
|
|
2686
|
+
o(pe, "hostName", "progress-bar"), o(pe, "standaloneHostName", "progress-bar"), o(pe, "css", S`
|
|
2885
2687
|
& {
|
|
2886
2688
|
display: grid;
|
|
2887
2689
|
gap: var(--spacing-small, 0.5rem);
|
|
@@ -2893,16 +2695,9 @@ s(he, "hostName", "progress-bar"), s(he, "standaloneHostName", "progress-bar"),
|
|
|
2893
2695
|
gap: var(--spacing-medium, 1rem);
|
|
2894
2696
|
}
|
|
2895
2697
|
|
|
2896
|
-
& > [data-part="label-line"] > label {
|
|
2897
|
-
font-weight: 600;
|
|
2898
|
-
}
|
|
2899
|
-
|
|
2900
2698
|
& > progress {
|
|
2901
2699
|
width: 100%;
|
|
2902
2700
|
min-height: 0.8rem;
|
|
2903
|
-
color: var(--fray-progress-value-background, var(--ui-accent-color));
|
|
2904
|
-
background: var(--fray-progress-track-background, transparent);
|
|
2905
|
-
accent-color: var(--fray-color-primary, var(--ui-accent-color));
|
|
2906
2701
|
}
|
|
2907
2702
|
|
|
2908
2703
|
@media (forced-colors: active) {
|
|
@@ -2911,201 +2706,213 @@ s(he, "hostName", "progress-bar"), s(he, "standaloneHostName", "progress-bar"),
|
|
|
2911
2706
|
}
|
|
2912
2707
|
}
|
|
2913
2708
|
`);
|
|
2914
|
-
function
|
|
2709
|
+
function _t(t) {
|
|
2915
2710
|
return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
|
|
2916
2711
|
}
|
|
2917
|
-
const
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
R("shiny", "Shiny", N("themes/shiny/theme.css")),
|
|
3024
|
-
R("java", "Java", N("themes/java/theme.css")),
|
|
3025
|
-
R("minimal", "Minimal", N("themes/minimal/theme.css"))
|
|
2712
|
+
const pr = Object.freeze([
|
|
2713
|
+
...me("primary"),
|
|
2714
|
+
...me("secondary"),
|
|
2715
|
+
...me("neutral"),
|
|
2716
|
+
d("--palette-primary", "palette", "primary", "color", "Primary anchor color", "--palette-primary-500"),
|
|
2717
|
+
d("--palette-primary-light", "palette", "primary", "color", "Light primary color", "--palette-primary-200"),
|
|
2718
|
+
d("--palette-primary-dark", "palette", "primary", "color", "Dark primary color", "--palette-primary-800"),
|
|
2719
|
+
d("--palette-secondary", "palette", "secondary", "color", "Secondary anchor color", "--palette-secondary-500"),
|
|
2720
|
+
d("--palette-secondary-light", "palette", "secondary", "color", "Light secondary color", "--palette-secondary-200"),
|
|
2721
|
+
d("--palette-secondary-dark", "palette", "secondary", "color", "Dark secondary color", "--palette-secondary-800"),
|
|
2722
|
+
d("--palette-neutral", "palette", "neutral", "color", "Neutral anchor color", "--palette-neutral-500"),
|
|
2723
|
+
d("--palette-neutral-light", "palette", "neutral", "color", "Light neutral color", "--palette-neutral-200"),
|
|
2724
|
+
d("--palette-neutral-dark", "palette", "neutral", "color", "Dark neutral color", "--palette-neutral-800"),
|
|
2725
|
+
d("--palette-light", "palette", "contrast", "color", "Light endpoint"),
|
|
2726
|
+
d("--palette-dark", "palette", "contrast", "color", "Dark endpoint"),
|
|
2727
|
+
d("--palette-contrast-light", "palette", "contrast", "color", "Light contrasting foreground", "--palette-light"),
|
|
2728
|
+
d("--palette-contrast-dark", "palette", "contrast", "color", "Dark contrasting foreground", "--palette-dark"),
|
|
2729
|
+
d("--palette-red", "palette", "hue", "color", "Red palette color"),
|
|
2730
|
+
d("--palette-green", "palette", "hue", "color", "Green palette color"),
|
|
2731
|
+
d("--font-family", "theme", "typography", "font", "UI font stack"),
|
|
2732
|
+
d("--font-size", "theme", "typography", "dimension", "Base UI font size"),
|
|
2733
|
+
d("--line-height", "theme", "typography", "dimension", "Base UI line height"),
|
|
2734
|
+
d("--control-min-height", "theme", "control", "dimension", "Minimum control height"),
|
|
2735
|
+
d("--space-xs", "theme", "spacing", "dimension", "Extra-small spacing"),
|
|
2736
|
+
d("--space-sm", "theme", "spacing", "dimension", "Small spacing"),
|
|
2737
|
+
d("--space-md", "theme", "spacing", "dimension", "Medium spacing"),
|
|
2738
|
+
d("--space-lg", "theme", "spacing", "dimension", "Large spacing"),
|
|
2739
|
+
d("--radius-sm", "theme", "shape", "radius", "Small corner radius"),
|
|
2740
|
+
d("--radius-md", "theme", "shape", "radius", "Ordinary corner radius"),
|
|
2741
|
+
d("--radius-lg", "theme", "shape", "radius", "Large corner radius"),
|
|
2742
|
+
d("--motion-fast", "theme", "motion", "duration", "Fast interaction transition"),
|
|
2743
|
+
d("--ui-background", "theme", "surface", "background", "Default UI background"),
|
|
2744
|
+
d("--ui-color", "theme", "surface", "color", "Default UI text"),
|
|
2745
|
+
d("--ui-border", "theme", "surface", "border", "Default UI border"),
|
|
2746
|
+
d("--ui-shadow", "theme", "surface", "shadow", "Default raised shadow"),
|
|
2747
|
+
d("--focus-ring", "theme", "focus", "shadow", "Keyboard focus ring"),
|
|
2748
|
+
d("--focus-color", "theme", "focus", "color", "Keyboard focus color"),
|
|
2749
|
+
d("--error-color", "theme", "status", "color", "Error state color"),
|
|
2750
|
+
d("--error-contrast", "theme", "status", "color", "Content on an error surface"),
|
|
2751
|
+
d("--success-color", "theme", "status", "color", "Success state color"),
|
|
2752
|
+
d("--panel-background", "theme", "panel", "background", "Panel surface", "--ui-background"),
|
|
2753
|
+
d("--panel-color", "theme", "panel", "color", "Panel content", "--ui-color"),
|
|
2754
|
+
d("--panel-border", "theme", "panel", "border", "Panel border", "--ui-border"),
|
|
2755
|
+
d("--panel-shadow", "theme", "panel", "shadow", "Panel shadow", "--ui-shadow"),
|
|
2756
|
+
d("--panel-radius", "theme", "panel", "radius", "Panel radius", "--radius-md"),
|
|
2757
|
+
d("--dialog-shadow", "theme", "dialog", "shadow", "Modal dialog shadow", "--panel-shadow"),
|
|
2758
|
+
d("--dialog-backdrop-background", "theme", "dialog", "background", "Modal backdrop"),
|
|
2759
|
+
d("--header-background", "theme", "header", "background", "Generic header surface"),
|
|
2760
|
+
d("--header-color", "theme", "header", "color", "Generic header content"),
|
|
2761
|
+
d("--header-border", "theme", "header", "border", "Generic header border"),
|
|
2762
|
+
d("--header-shadow", "theme", "header", "shadow", "Generic header shadow"),
|
|
2763
|
+
d("--section-header-background", "theme", "header", "background", "Section header surface", "--header-background"),
|
|
2764
|
+
d("--section-header-color", "theme", "header", "color", "Section header content", "--header-color"),
|
|
2765
|
+
d("--section-header-border", "theme", "header", "border", "Section header border", "--header-border"),
|
|
2766
|
+
d("--section-header-shadow", "theme", "header", "shadow", "Section header shadow", "--header-shadow"),
|
|
2767
|
+
d("--panel-header-background", "theme", "header", "background", "Panel header surface", "--section-header-background"),
|
|
2768
|
+
d("--panel-header-color", "theme", "header", "color", "Panel header content", "--section-header-color"),
|
|
2769
|
+
d("--table-header-background", "theme", "header", "background", "Table header surface", "--section-header-background"),
|
|
2770
|
+
d("--table-header-color", "theme", "header", "color", "Table header content", "--section-header-color"),
|
|
2771
|
+
d("--dialog-header-background", "theme", "header", "background", "Dialog header surface", "--section-header-background"),
|
|
2772
|
+
d("--dialog-header-color", "theme", "header", "color", "Dialog header content", "--section-header-color"),
|
|
2773
|
+
d("--button-background", "theme", "button", "background", "Generic button surface"),
|
|
2774
|
+
d("--button-background-hover", "theme", "button", "background", "Hovered button surface"),
|
|
2775
|
+
d("--button-background-active", "theme", "button", "background", "Pressed button surface"),
|
|
2776
|
+
d("--button-background-disabled", "theme", "button", "background", "Disabled button surface"),
|
|
2777
|
+
d("--button-color", "theme", "button", "color", "Generic button content"),
|
|
2778
|
+
d("--button-border", "theme", "button", "border", "Generic button border"),
|
|
2779
|
+
d("--button-shadow", "theme", "button", "shadow", "Generic button shadow"),
|
|
2780
|
+
d("--button-shadow-active", "theme", "button", "shadow", "Pressed button shadow"),
|
|
2781
|
+
d("--toggle-button-background", "theme", "button", "background", "Toggle option surface", "--button-background"),
|
|
2782
|
+
d("--toggle-button-background-checked", "theme", "button", "background", "Selected toggle option", "--selection-background"),
|
|
2783
|
+
d("--tab-button-background", "theme", "button", "background", "Tab surface", "--button-background"),
|
|
2784
|
+
d("--tab-button-background-active", "theme", "button", "background", "Active tab surface", "--tab-active-background"),
|
|
2785
|
+
d("--menu-button-background", "theme", "button", "background", "Menu action surface", "--button-background"),
|
|
2786
|
+
d("--dropdown-trigger-background", "theme", "button", "background", "Dropdown arrow/trigger surface", "--button-background"),
|
|
2787
|
+
d("--table-header-button-background", "theme", "button", "background", "Table-header action surface", "--button-background"),
|
|
2788
|
+
d("--input-background", "theme", "input", "background", "Input surface"),
|
|
2789
|
+
d("--input-color", "theme", "input", "color", "Input content"),
|
|
2790
|
+
d("--input-border", "theme", "input", "border", "Input border"),
|
|
2791
|
+
d("--input-shadow", "theme", "input", "shadow", "Input shadow"),
|
|
2792
|
+
d("--input-background-disabled", "theme", "input", "background", "Disabled input surface"),
|
|
2793
|
+
d("--input-color-disabled", "theme", "input", "color", "Disabled input content"),
|
|
2794
|
+
d("--selection-background", "theme", "selection", "background", "Selected item surface"),
|
|
2795
|
+
d("--selection-color", "theme", "selection", "color", "Selected item content"),
|
|
2796
|
+
d("--row-hover-background", "theme", "row", "background", "Hovered list/table/tree row"),
|
|
2797
|
+
d("--table-row-background", "theme", "table", "background", "Odd table row surface"),
|
|
2798
|
+
d("--table-row-alt-background", "theme", "table", "background", "Even table row surface"),
|
|
2799
|
+
d("--checkbox-box-background", "theme", "checkbox", "background", "Unchecked checkbox box", "--input-background"),
|
|
2800
|
+
d("--checkbox-box-background-checked", "theme", "checkbox", "background", "Checked checkbox box", "--selection-background"),
|
|
2801
|
+
d("--checkbox-box-border", "theme", "checkbox", "border", "Checkbox box border", "--input-border"),
|
|
2802
|
+
d("--checkbox-symbol-color", "theme", "checkbox", "color", "Checkbox symbol", "--selection-color"),
|
|
2803
|
+
d("--radio-background", "theme", "radio", "background", "Radio/toggle option surface", "--toggle-button-background"),
|
|
2804
|
+
d("--radio-background-checked", "theme", "radio", "background", "Selected radio/toggle option", "--selection-background"),
|
|
2805
|
+
d("--toolbar-background", "theme", "toolbar", "background", "Toolbar surface", "--panel-background"),
|
|
2806
|
+
d("--toolbar-color", "theme", "toolbar", "color", "Toolbar content", "--panel-color"),
|
|
2807
|
+
d("--toolbar-border", "theme", "toolbar", "border", "Toolbar border", "--panel-border"),
|
|
2808
|
+
d("--toolbar-shadow", "theme", "toolbar", "shadow", "Toolbar shadow", "--panel-shadow"),
|
|
2809
|
+
d("--tabline-background", "theme", "tabs", "background", "Tab strip surface", "--panel-background"),
|
|
2810
|
+
d("--tab-active-background", "theme", "tabs", "background", "Active tab surface", "--panel-background"),
|
|
2811
|
+
d("--progress-track-background", "theme", "progress", "background", "Progress track"),
|
|
2812
|
+
d("--progress-value-background", "theme", "progress", "background", "Progress value"),
|
|
2813
|
+
d("--working-background-image", "theme", "status", "background", "Indeterminate/loading texture"),
|
|
2814
|
+
d("--colored-base", "theme", "colored", "color", "Colored-trait base color", "--palette-primary"),
|
|
2815
|
+
d("--colored-light", "theme", "colored", "color", "Colored-trait light color", "--palette-primary-light"),
|
|
2816
|
+
d("--colored-dark", "theme", "colored", "color", "Colored-trait dark color", "--palette-primary-dark"),
|
|
2817
|
+
d("--colored-contrast", "theme", "colored", "color", "Colored-trait foreground", "--palette-contrast-light")
|
|
3026
2818
|
]), Yt = Object.freeze([
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
2819
|
+
N("shiny", "Shiny", $("themes/shiny/theme.css")),
|
|
2820
|
+
N("java", "Java", $("themes/java/theme.css")),
|
|
2821
|
+
N("minimal", "Minimal", $("themes/minimal/theme.css"))
|
|
2822
|
+
]), Xt = Object.freeze([
|
|
2823
|
+
N("iceblue", "Ice blue", $("colors/iceblue/colors.css")),
|
|
2824
|
+
N("ocean", "Ocean", $("colors/ocean/colors.css")),
|
|
2825
|
+
N("green", "Green", $("colors/green/colors.css")),
|
|
2826
|
+
N("gray", "Gray", $("colors/gray/colors.css")),
|
|
2827
|
+
N("orange", "Orange", $("colors/orange/colors.css")),
|
|
2828
|
+
N("purple", "Purple", $("colors/purple/colors.css")),
|
|
2829
|
+
N("red", "Red", $("colors/red/colors.css")),
|
|
2830
|
+
N("yellow", "Yellow", $("colors/yellow/colors.css"))
|
|
3035
2831
|
]);
|
|
3036
|
-
function
|
|
3037
|
-
if (
|
|
2832
|
+
function Zt(t, r, e = globalThis.document) {
|
|
2833
|
+
if (er(r), (e == null ? void 0 : e.head) == null || e.documentElement == null)
|
|
3038
2834
|
throw new TypeError("replaceFrayStylesheet requires a document with a head and root");
|
|
3039
|
-
const
|
|
3040
|
-
let
|
|
3041
|
-
return
|
|
2835
|
+
const i = `link[data-fray-stylesheet="${t}"]`;
|
|
2836
|
+
let s = e.head.querySelector(i);
|
|
2837
|
+
return s == null && (s = e.createElement("link"), s.rel = "stylesheet", s.dataset.frayStylesheet = t, e.head.append(s)), s.dataset.fraySelection = r.value, s.getAttribute("href") !== r.href && s.setAttribute("href", r.href), t === "theme" ? e.documentElement.dataset.theme = r.value : e.documentElement.dataset.color = r.value, s;
|
|
3042
2838
|
}
|
|
3043
|
-
function
|
|
3044
|
-
const e = t.find((
|
|
2839
|
+
function re(t, r) {
|
|
2840
|
+
const e = t.find((i) => i.value === r);
|
|
3045
2841
|
if (e == null) throw new RangeError(`Unknown Fray stylesheet selection: ${r}`);
|
|
3046
2842
|
return e;
|
|
3047
2843
|
}
|
|
3048
|
-
function
|
|
3049
|
-
return n == null ? Object.freeze({ name: t, layer: r, family: e, value:
|
|
2844
|
+
function d(t, r, e, i, s, n) {
|
|
2845
|
+
return n == null ? Object.freeze({ name: t, layer: r, family: e, value: i, description: s }) : Object.freeze({ name: t, layer: r, family: e, value: i, description: s, fallback: n });
|
|
2846
|
+
}
|
|
2847
|
+
function me(t) {
|
|
2848
|
+
return [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950].map((r) => {
|
|
2849
|
+
var e;
|
|
2850
|
+
return d(
|
|
2851
|
+
`--palette-${t}-${r}`,
|
|
2852
|
+
"palette",
|
|
2853
|
+
t,
|
|
2854
|
+
"color",
|
|
2855
|
+
`${(e = t[0]) == null ? void 0 : e.toUpperCase()}${t.slice(1)} palette stop ${r}`
|
|
2856
|
+
);
|
|
2857
|
+
});
|
|
3050
2858
|
}
|
|
3051
|
-
function
|
|
2859
|
+
function N(t, r, e) {
|
|
3052
2860
|
return Object.freeze({ value: t, label: r, href: e });
|
|
3053
2861
|
}
|
|
3054
|
-
function
|
|
2862
|
+
function $(t) {
|
|
3055
2863
|
const r = import.meta.url.includes("/src/styling/") ? `../../${t}` : `../${t}`;
|
|
3056
2864
|
return new URL(r, import.meta.url).href;
|
|
3057
2865
|
}
|
|
3058
|
-
function
|
|
2866
|
+
function er(t) {
|
|
3059
2867
|
if (t == null || typeof t != "object")
|
|
3060
2868
|
throw new TypeError("Fray stylesheet selection must be an option");
|
|
3061
2869
|
for (const r of ["value", "label", "href"])
|
|
3062
2870
|
if (typeof Reflect.get(t, r) != "string" || String(Reflect.get(t, r)).length === 0)
|
|
3063
2871
|
throw new TypeError(`Fray stylesheet option ${r} must be a non-empty string`);
|
|
3064
2872
|
}
|
|
3065
|
-
class oe extends
|
|
3066
|
-
constructor(e,
|
|
2873
|
+
class oe extends y {
|
|
2874
|
+
constructor(e, i, s) {
|
|
3067
2875
|
var l;
|
|
3068
2876
|
super(e);
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
const n = e.options ??
|
|
3074
|
-
|
|
3075
|
-
const
|
|
3076
|
-
if (
|
|
3077
|
-
this.kind =
|
|
2877
|
+
o(this, "valueEmitter");
|
|
2878
|
+
o(this, "inputId");
|
|
2879
|
+
o(this, "kind");
|
|
2880
|
+
o(this, "defaults");
|
|
2881
|
+
const n = e.options ?? s;
|
|
2882
|
+
ze(n);
|
|
2883
|
+
const a = (l = n[0]) == null ? void 0 : l.value;
|
|
2884
|
+
if (a == null) throw new TypeError(`${i} picker requires at least one option`);
|
|
2885
|
+
this.kind = i, this.defaults = s, this.inputId = F(`${i}-picker`, e.id), this.valueEmitter = z(this, e, a, `${i} selection`), re(n, this.valueEmitter.get());
|
|
3078
2886
|
}
|
|
3079
2887
|
initialize() {
|
|
3080
2888
|
this.watch(this.valueEmitter);
|
|
3081
2889
|
}
|
|
3082
2890
|
render() {
|
|
3083
|
-
const e = this.options,
|
|
2891
|
+
const e = this.options, i = re(e, this.valueEmitter.get()), { label: s, ariaLabel: n, disabled: a = !1, onChange: l } = this.props, c = this.Host;
|
|
3084
2892
|
return /* @__PURE__ */ w(
|
|
3085
|
-
|
|
2893
|
+
c,
|
|
3086
2894
|
{
|
|
3087
|
-
className: E(this.props)
|
|
2895
|
+
className: R("selectshell", E(this.props)),
|
|
3088
2896
|
"data-kind": this.kind,
|
|
3089
|
-
"data-disabled":
|
|
2897
|
+
"data-disabled": a ? "" : null,
|
|
3090
2898
|
children: [
|
|
3091
|
-
|
|
2899
|
+
s == null ? null : /* @__PURE__ */ u("label", { htmlFor: this.inputId, children: s }),
|
|
3092
2900
|
/* @__PURE__ */ u(
|
|
3093
2901
|
"select",
|
|
3094
2902
|
{
|
|
3095
2903
|
id: this.inputId,
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
"aria-label": i == null ? n : null,
|
|
2904
|
+
value: i.value,
|
|
2905
|
+
disabled: a,
|
|
2906
|
+
"aria-label": s == null ? n : null,
|
|
3100
2907
|
onChange: (h) => {
|
|
3101
|
-
const
|
|
3102
|
-
this.valueEmitter.set(
|
|
2908
|
+
const p = tr(h), f = re(e, p);
|
|
2909
|
+
this.valueEmitter.set(p, `${this.kind} selected`), K(l, p, f, h);
|
|
3103
2910
|
},
|
|
3104
2911
|
children: e.map((h) => /* @__PURE__ */ u(
|
|
3105
2912
|
"option",
|
|
3106
2913
|
{
|
|
3107
2914
|
value: h.value,
|
|
3108
|
-
selected: h.value ===
|
|
2915
|
+
selected: h.value === i.value,
|
|
3109
2916
|
children: h.label
|
|
3110
2917
|
},
|
|
3111
2918
|
h.value
|
|
@@ -3124,23 +2931,21 @@ class oe extends g {
|
|
|
3124
2931
|
}
|
|
3125
2932
|
get options() {
|
|
3126
2933
|
const e = this.props.options ?? this.defaults;
|
|
3127
|
-
return
|
|
2934
|
+
return ze(e), e;
|
|
3128
2935
|
}
|
|
3129
2936
|
applySelection() {
|
|
3130
2937
|
const e = this.props.targetDocument ?? (typeof document > "u" ? null : document);
|
|
3131
|
-
e != null &&
|
|
2938
|
+
e != null && Zt(
|
|
3132
2939
|
this.kind,
|
|
3133
|
-
|
|
2940
|
+
re(this.options, this.valueEmitter.get()),
|
|
3134
2941
|
e
|
|
3135
2942
|
);
|
|
3136
2943
|
}
|
|
3137
2944
|
}
|
|
3138
|
-
|
|
2945
|
+
o(oe, "baseStyles", [
|
|
3139
2946
|
["&", ["labeledinput", "inputline"]],
|
|
3140
|
-
["& >
|
|
3141
|
-
|
|
3142
|
-
["&[data-disabled]", ["disabled"]]
|
|
3143
|
-
]), s(oe, "css", v`
|
|
2947
|
+
["& > select", ["input", "inputline"]]
|
|
2948
|
+
]), o(oe, "css", S`
|
|
3144
2949
|
& {
|
|
3145
2950
|
position: relative;
|
|
3146
2951
|
}
|
|
@@ -3149,118 +2954,118 @@ s(oe, "baseStyles", [
|
|
|
3149
2954
|
min-width: 8rem;
|
|
3150
2955
|
}
|
|
3151
2956
|
`);
|
|
3152
|
-
class
|
|
2957
|
+
class He extends oe {
|
|
3153
2958
|
constructor(r = {}) {
|
|
3154
|
-
super(r, "theme",
|
|
2959
|
+
super(r, "theme", Yt);
|
|
3155
2960
|
}
|
|
3156
2961
|
}
|
|
3157
|
-
|
|
3158
|
-
class
|
|
2962
|
+
o(He, "hostName", "theme-picker"), o(He, "standaloneHostName", "theme-picker");
|
|
2963
|
+
class Me extends oe {
|
|
3159
2964
|
constructor(r = {}) {
|
|
3160
|
-
super(r, "colors",
|
|
2965
|
+
super(r, "colors", Xt);
|
|
3161
2966
|
}
|
|
3162
2967
|
}
|
|
3163
|
-
|
|
3164
|
-
function
|
|
2968
|
+
o(Me, "hostName", "color-picker"), o(Me, "standaloneHostName", "color-picker");
|
|
2969
|
+
function ze(t) {
|
|
3165
2970
|
if (!Array.isArray(t) || t.length === 0)
|
|
3166
2971
|
throw new TypeError("Stylesheet picker options must be a non-empty array");
|
|
3167
2972
|
const r = /* @__PURE__ */ new Set();
|
|
3168
2973
|
for (const e of t) {
|
|
3169
2974
|
if (e == null || typeof e != "object")
|
|
3170
2975
|
throw new TypeError("Stylesheet picker options must be objects");
|
|
3171
|
-
for (const
|
|
3172
|
-
if (typeof e[
|
|
3173
|
-
throw new TypeError(`Stylesheet picker option ${
|
|
2976
|
+
for (const i of ["value", "label", "href"])
|
|
2977
|
+
if (typeof e[i] != "string" || e[i].length === 0)
|
|
2978
|
+
throw new TypeError(`Stylesheet picker option ${i} must be a string`);
|
|
3174
2979
|
if (r.has(e.value))
|
|
3175
2980
|
throw new Error(`Duplicate stylesheet picker value: ${e.value}`);
|
|
3176
2981
|
r.add(e.value);
|
|
3177
2982
|
}
|
|
3178
2983
|
}
|
|
3179
|
-
function
|
|
2984
|
+
function tr(t) {
|
|
3180
2985
|
const r = t.currentTarget == null ? null : Reflect.get(t.currentTarget, "value");
|
|
3181
2986
|
if (typeof r != "string")
|
|
3182
2987
|
throw new TypeError("Stylesheet picker change requires a select element");
|
|
3183
2988
|
return r;
|
|
3184
2989
|
}
|
|
3185
2990
|
export {
|
|
3186
|
-
|
|
3187
|
-
|
|
2991
|
+
Ge as BaseSelectionHandler,
|
|
2992
|
+
ne as Button,
|
|
3188
2993
|
D as Checkbox,
|
|
3189
|
-
|
|
3190
|
-
|
|
2994
|
+
Me as ColorPicker,
|
|
2995
|
+
y as Component,
|
|
3191
2996
|
X as DataTable,
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
2997
|
+
xt as DefaultTableFilterEncoding,
|
|
2998
|
+
Pe as DescriptionItem,
|
|
2999
|
+
Re as DescriptionList,
|
|
3195
3000
|
Oe as Dialog,
|
|
3196
3001
|
ee as Dropdown,
|
|
3197
3002
|
b as FilterMode,
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3003
|
+
U as FilterPanel,
|
|
3004
|
+
br as Fragment,
|
|
3005
|
+
gr as FrayRuntime,
|
|
3006
|
+
Q as ListView,
|
|
3007
|
+
lt as MultiSelectionHandler,
|
|
3008
|
+
ce as Panel,
|
|
3009
|
+
M as Placeholder,
|
|
3010
|
+
pe as ProgressBar,
|
|
3011
|
+
Ce as QuadCheckbox,
|
|
3012
|
+
yr as ServiceScope,
|
|
3013
|
+
st as Sidebar,
|
|
3014
|
+
Ee as SingleSelectionHandler,
|
|
3015
|
+
de as SplitView,
|
|
3016
|
+
wr as StyleRegistry,
|
|
3017
|
+
qe as Tab,
|
|
3018
|
+
V as TabLine,
|
|
3019
|
+
_ as TabPanel,
|
|
3020
|
+
ge as TableHeader,
|
|
3021
|
+
J as TableHeaderCell,
|
|
3217
3022
|
te as Textbox,
|
|
3218
|
-
|
|
3023
|
+
He as ThemePicker,
|
|
3219
3024
|
Ae as Toggle,
|
|
3220
|
-
|
|
3221
|
-
|
|
3025
|
+
he as Toolbar,
|
|
3026
|
+
Je as TreeItem,
|
|
3222
3027
|
Z as TreeView,
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3028
|
+
Ke as TriCheckbox,
|
|
3029
|
+
Tt as applyLocalTableState,
|
|
3030
|
+
Qe as assertSort,
|
|
3031
|
+
B as assertTreeNodes,
|
|
3032
|
+
Er as createFrayRuntime,
|
|
3033
|
+
Ct as createHandlerTableDataSource,
|
|
3034
|
+
Ot as createLocalTableDataSource,
|
|
3035
|
+
cr as createQueryTableDataSource,
|
|
3036
|
+
Kt as createRestTableDataSource,
|
|
3037
|
+
se as createSelectionHandler,
|
|
3038
|
+
Sr as createServiceScope,
|
|
3039
|
+
Ir as createStyleRegistry,
|
|
3040
|
+
S as css,
|
|
3041
|
+
kr as defaultFrayRuntime,
|
|
3042
|
+
Se as defaultItemKey,
|
|
3043
|
+
xr as defineService,
|
|
3044
|
+
nr as deriveFilterPredicate,
|
|
3045
|
+
or as deriveFilteredItems,
|
|
3046
|
+
ur as deriveTreeNode,
|
|
3047
|
+
ot as filterByState,
|
|
3048
|
+
re as findFrayStylesheetOption,
|
|
3049
|
+
dr as findTreeNode,
|
|
3050
|
+
Xt as frayColorOptions,
|
|
3051
|
+
Yt as frayThemeOptions,
|
|
3052
|
+
pr as frayThemeVariableCatalog,
|
|
3053
|
+
vr as h,
|
|
3054
|
+
le as isFilterMode,
|
|
3250
3055
|
u as jsx,
|
|
3251
|
-
|
|
3056
|
+
Tr as jsxDEV,
|
|
3252
3057
|
w as jsxs,
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3058
|
+
Rr as live,
|
|
3059
|
+
Be as matchesFilterState,
|
|
3060
|
+
lr as parseFilterState,
|
|
3061
|
+
Nr as provideService,
|
|
3062
|
+
Zt as replaceFrayStylesheet,
|
|
3063
|
+
ar as serializeFilterState,
|
|
3064
|
+
vt as serializeTableQuery,
|
|
3065
|
+
$r as styleRegistry,
|
|
3066
|
+
Le as tabButtonId,
|
|
3067
|
+
Ve as tabPanelId,
|
|
3068
|
+
qt as updateTreeNode,
|
|
3069
|
+
hr as updateWritableTreeNode
|
|
3265
3070
|
};
|
|
3266
3071
|
//# sourceMappingURL=index.js.map
|