@sylwellsoftware/fray 0.1.0-alpha.1

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.
Files changed (94) hide show
  1. package/EXPERIMENTAL.md +75 -0
  2. package/LICENSE +55 -0
  3. package/NOTICE +2 -0
  4. package/README.md +521 -0
  5. package/dist/Components/Placeholder.d.ts +14 -0
  6. package/dist/Components/Placeholder.d.ts.map +1 -0
  7. package/dist/Components/component.d.ts +187 -0
  8. package/dist/Components/component.d.ts.map +1 -0
  9. package/dist/Components/controlUtils.d.ts +20 -0
  10. package/dist/Components/controlUtils.d.ts.map +1 -0
  11. package/dist/Components/data/descriptionList.d.ts +21 -0
  12. package/dist/Components/data/descriptionList.d.ts.map +1 -0
  13. package/dist/Components/data/listview/listview.d.ts +39 -0
  14. package/dist/Components/data/listview/listview.d.ts.map +1 -0
  15. package/dist/Components/data/selectionhandler.d.ts +68 -0
  16. package/dist/Components/data/selectionhandler.d.ts.map +1 -0
  17. package/dist/Components/data/table/DataTable.d.ts +72 -0
  18. package/dist/Components/data/table/DataTable.d.ts.map +1 -0
  19. package/dist/Components/data/table/FilterPanel.d.ts +35 -0
  20. package/dist/Components/data/table/FilterPanel.d.ts.map +1 -0
  21. package/dist/Components/data/table/TableHeader.d.ts +21 -0
  22. package/dist/Components/data/table/TableHeader.d.ts.map +1 -0
  23. package/dist/Components/data/table/TableHeaderCell.d.ts +39 -0
  24. package/dist/Components/data/table/TableHeaderCell.d.ts.map +1 -0
  25. package/dist/Components/data/table/tableQuery.d.ts +25 -0
  26. package/dist/Components/data/table/tableQuery.d.ts.map +1 -0
  27. package/dist/Components/data/treeview/treeitem.d.ts +20 -0
  28. package/dist/Components/data/treeview/treeitem.d.ts.map +1 -0
  29. package/dist/Components/data/treeview/treeview.d.ts +42 -0
  30. package/dist/Components/data/treeview/treeview.d.ts.map +1 -0
  31. package/dist/Components/dialog/dialog.d.ts +37 -0
  32. package/dist/Components/dialog/dialog.d.ts.map +1 -0
  33. package/dist/Components/layout/panel.d.ts +20 -0
  34. package/dist/Components/layout/panel.d.ts.map +1 -0
  35. package/dist/Components/layout/sidebar.d.ts +18 -0
  36. package/dist/Components/layout/sidebar.d.ts.map +1 -0
  37. package/dist/Components/layout/splitView.d.ts +18 -0
  38. package/dist/Components/layout/splitView.d.ts.map +1 -0
  39. package/dist/Components/layout/tabpanel/tab.d.ts +12 -0
  40. package/dist/Components/layout/tabpanel/tab.d.ts.map +1 -0
  41. package/dist/Components/layout/tabpanel/tabline.d.ts +32 -0
  42. package/dist/Components/layout/tabpanel/tabline.d.ts.map +1 -0
  43. package/dist/Components/layout/tabpanel/tabpanel.d.ts +34 -0
  44. package/dist/Components/layout/tabpanel/tabpanel.d.ts.map +1 -0
  45. package/dist/Components/lineinputs/checkbox/Checkbox.d.ts +35 -0
  46. package/dist/Components/lineinputs/checkbox/Checkbox.d.ts.map +1 -0
  47. package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts +12 -0
  48. package/dist/Components/lineinputs/checkbox/QuadCheckbox.d.ts.map +1 -0
  49. package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts +12 -0
  50. package/dist/Components/lineinputs/checkbox/TriCheckbox.d.ts.map +1 -0
  51. package/dist/Components/lineinputs/dropdown.d.ts +37 -0
  52. package/dist/Components/lineinputs/dropdown.d.ts.map +1 -0
  53. package/dist/Components/lineinputs/textbox.d.ts +36 -0
  54. package/dist/Components/lineinputs/textbox.d.ts.map +1 -0
  55. package/dist/Components/lineinputs/toggle.d.ts +30 -0
  56. package/dist/Components/lineinputs/toggle.d.ts.map +1 -0
  57. package/dist/Components/menu/button.d.ts +24 -0
  58. package/dist/Components/menu/button.d.ts.map +1 -0
  59. package/dist/Components/menu/toolbar.d.ts +15 -0
  60. package/dist/Components/menu/toolbar.d.ts.map +1 -0
  61. package/dist/Components/status/progressBar.d.ts +21 -0
  62. package/dist/Components/status/progressBar.d.ts.map +1 -0
  63. package/dist/button-BRDkmR1C.js +203 -0
  64. package/dist/button-BRDkmR1C.js.map +1 -0
  65. package/dist/experimental.d.ts +16 -0
  66. package/dist/experimental.d.ts.map +1 -0
  67. package/dist/experimental.js +1361 -0
  68. package/dist/experimental.js.map +1 -0
  69. package/dist/index.d.ts +23 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +1014 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/jsx-dev-runtime-CarwHDyL.js +1155 -0
  74. package/dist/jsx-dev-runtime-CarwHDyL.js.map +1 -0
  75. package/dist/jsx-dev-runtime.d.ts +2 -0
  76. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  77. package/dist/jsx-dev-runtime.js +6 -0
  78. package/dist/jsx-dev-runtime.js.map +1 -0
  79. package/dist/jsx-runtime.d.ts +26 -0
  80. package/dist/jsx-runtime.d.ts.map +1 -0
  81. package/dist/jsx-runtime.js +9 -0
  82. package/dist/jsx-runtime.js.map +1 -0
  83. package/dist/runtime.d.ts +29 -0
  84. package/dist/runtime.d.ts.map +1 -0
  85. package/dist/styling/baseStyleDefinitions.d.ts +154 -0
  86. package/dist/styling/baseStyleDefinitions.d.ts.map +1 -0
  87. package/dist/styling/styleRegistry.d.ts +19 -0
  88. package/dist/styling/styleRegistry.d.ts.map +1 -0
  89. package/dist/util/filterMode.d.ts +13 -0
  90. package/dist/util/filterMode.d.ts.map +1 -0
  91. package/package.json +83 -0
  92. package/themes/README.md +30 -0
  93. package/themes/dark.css +39 -0
  94. package/themes/light.css +39 -0
package/dist/index.js ADDED
@@ -0,0 +1,1014 @@
1
+ var nt = Object.defineProperty;
2
+ var st = (n, s, t) => s in n ? nt(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
3
+ var a = (n, s, t) => st(n, typeof s != "symbol" ? s + "" : s, t);
4
+ import { C as p, j as c, c as m, a as g, i as K } from "./jsx-dev-runtime-CarwHDyL.js";
5
+ import { F as vt, b as yt, S as wt, d as Et, e as xt, f as It, h as Nt, g as St, l as Ht, s as Tt } from "./jsx-dev-runtime-CarwHDyL.js";
6
+ import { a as T, i as H, c as b, b as x, C as Z, F as v, d as B } from "./button-BRDkmR1C.js";
7
+ import { B as Rt } from "./button-BRDkmR1C.js";
8
+ import { Emitter as ot } from "@sylwellsoftware/glue";
9
+ class Q extends p {
10
+ render() {
11
+ return this.props.children ?? [];
12
+ }
13
+ }
14
+ class I extends p {
15
+ constructor(t = {}) {
16
+ var e;
17
+ super(t);
18
+ a(this, "valueEmitter");
19
+ a(this, "activeTabEmitter");
20
+ const r = t.tabs ?? [];
21
+ M(r);
22
+ const i = { ...t };
23
+ i.valueEmitter == null && t.activeTabEmitter != null && (i.valueEmitter = t.activeTabEmitter), i.defaultValue == null && t.initialActiveTabId != null && (i.defaultValue = t.initialActiveTabId), this.valueEmitter = T(
24
+ this,
25
+ i,
26
+ ((e = r.find((l) => !l.disabled)) == null ? void 0 : e.id) ?? null,
27
+ "active tab"
28
+ ), this.activeTabEmitter = this.valueEmitter;
29
+ }
30
+ initialize() {
31
+ this.watch(this.valueEmitter);
32
+ }
33
+ selectTab(t, r = null) {
34
+ t == null || t.disabled || (this.valueEmitter.set(t.id, "tab selected"), H(this.props.onChange, t.id, r));
35
+ }
36
+ render() {
37
+ const { tabs: t = [], label: r = "Sections", baseId: i = "fray-tabs" } = this.props;
38
+ M(t);
39
+ const e = this.valueEmitter.get(), l = this.Host;
40
+ return /* @__PURE__ */ c(
41
+ l,
42
+ {
43
+ role: "tablist",
44
+ className: b(this.props) || null,
45
+ "aria-label": r,
46
+ children: t.map((o, d) => /* @__PURE__ */ c(
47
+ "button",
48
+ {
49
+ id: _(i, o.id),
50
+ type: "button",
51
+ role: "tab",
52
+ disabled: !!o.disabled,
53
+ "data-part": "tab",
54
+ "aria-selected": Object.is(e, o.id) ? "true" : "false",
55
+ "aria-controls": tt(i, o.id),
56
+ tabIndex: Object.is(e, o.id) ? 0 : -1,
57
+ onClick: (u) => this.selectTab(o, u),
58
+ onKeyDown: (u) => this.handleKeyDown(u, d, t),
59
+ children: o.label ?? String(o.id)
60
+ },
61
+ String(o.id)
62
+ ))
63
+ }
64
+ );
65
+ }
66
+ handleKeyDown(t, r, i) {
67
+ const e = i.map((d, u) => ({ tab: d, tabIndex: u })).filter(({ tab: d }) => !d.disabled);
68
+ if (e.length === 0) return;
69
+ const l = Math.max(
70
+ 0,
71
+ e.findIndex(({ tabIndex: d }) => d === r)
72
+ );
73
+ let o;
74
+ if (t.key === "ArrowRight" || t.key === "ArrowDown")
75
+ o = e[(l + 1) % e.length];
76
+ else if (t.key === "ArrowLeft" || t.key === "ArrowUp")
77
+ o = e[(l - 1 + e.length) % e.length];
78
+ else if (t.key === "Home") o = e[0];
79
+ else if (t.key === "End") o = e.at(-1);
80
+ else return;
81
+ if (o != null && (t.preventDefault(), this.selectTab(o.tab, t), this.dom instanceof Element)) {
82
+ const d = this.dom.querySelectorAll('[role="tab"]')[o.tabIndex];
83
+ d == null || d.focus();
84
+ }
85
+ }
86
+ }
87
+ a(I, "hostName", "tab-line"), a(I, "standaloneHostName", "tab-line"), a(I, "baseStyles", [
88
+ ['& > [data-part="tab"]', ["uiline", "button"]]
89
+ ]), a(I, "css", m`
90
+ & {
91
+ display: flex;
92
+ flex-flow: row wrap;
93
+ padding-top: 3px;
94
+ background: var(--tabline-bg, #f5f5f5);
95
+ }
96
+
97
+ & > [data-part="tab"] {
98
+ border-radius: var(--ui-border-radius) var(--ui-border-radius) 0 0;
99
+ }
100
+
101
+ & > [data-part="tab"][aria-selected="true"] {
102
+ background: var(--tab-bg-active, var(--panel-bg, #fff));
103
+ }
104
+ `);
105
+ function _(n, s) {
106
+ return `${n}-tab-${et(s)}`;
107
+ }
108
+ function tt(n, s) {
109
+ return `${n}-panel-${et(s)}`;
110
+ }
111
+ function et(n) {
112
+ return encodeURIComponent(String(n)).replaceAll("%", "-");
113
+ }
114
+ function M(n) {
115
+ if (!Array.isArray(n)) throw new TypeError("TabLine tabs must be an array");
116
+ const s = /* @__PURE__ */ new Set();
117
+ for (const t of n) {
118
+ if (t == null || t.id == null) throw new TypeError("Each tab requires an id");
119
+ if (s.has(t.id)) throw new Error(`Duplicate tab id: ${String(t.id)}`);
120
+ s.add(t.id);
121
+ }
122
+ }
123
+ class z extends p {
124
+ constructor(t = {}) {
125
+ var e;
126
+ super(t);
127
+ a(this, "valueEmitter");
128
+ a(this, "activeTabEmitter");
129
+ a(this, "baseId");
130
+ const r = O(t), i = { ...t };
131
+ i.valueEmitter == null && t.activeTabEmitter != null && (i.valueEmitter = t.activeTabEmitter), i.defaultValue == null && t.initialActiveTabId != null && (i.defaultValue = t.initialActiveTabId), this.valueEmitter = T(
132
+ this,
133
+ i,
134
+ ((e = r.find((l) => !l.disabled)) == null ? void 0 : e.id) ?? null,
135
+ "active tab"
136
+ ), this.activeTabEmitter = this.valueEmitter, this.baseId = x("tabs", t.id);
137
+ }
138
+ initialize() {
139
+ var r;
140
+ const t = O(this.props);
141
+ t.some(({ id: i }) => Object.is(i, this.valueEmitter.get())) || this.valueEmitter.set(((r = t.find((i) => !i.disabled)) == null ? void 0 : r.id) ?? null), this.watch(this.valueEmitter);
142
+ }
143
+ setProps(t) {
144
+ var i;
145
+ super.setProps(t);
146
+ const r = O(t);
147
+ return r.some(({ id: e }) => Object.is(e, this.valueEmitter.get())) || this.valueEmitter.set(((i = r.find((e) => !e.disabled)) == null ? void 0 : i.id) ?? null), this;
148
+ }
149
+ render() {
150
+ const t = O(this.props), r = t.find(({ id: e }) => Object.is(e, this.valueEmitter.get())) ?? t.find((e) => !e.disabled) ?? null, i = this.Host;
151
+ return /* @__PURE__ */ g(
152
+ i,
153
+ {
154
+ id: this.baseId,
155
+ className: b(this.props) || null,
156
+ children: [
157
+ /* @__PURE__ */ c(
158
+ I,
159
+ {
160
+ tabs: t.map(({ id: e, label: l, disabled: o }) => ({ id: e, label: l, disabled: o })),
161
+ valueEmitter: this.valueEmitter,
162
+ baseId: this.baseId,
163
+ ...this.props.label == null ? {} : { label: this.props.label },
164
+ ...this.props.onChange == null ? {} : { onChange: this.props.onChange }
165
+ },
166
+ "tab-list"
167
+ ),
168
+ r == null ? null : /* @__PURE__ */ c(
169
+ "div",
170
+ {
171
+ id: tt(this.baseId, r.id),
172
+ role: "tabpanel",
173
+ "data-part": "content",
174
+ "aria-labelledby": _(this.baseId, r.id),
175
+ tabIndex: 0,
176
+ children: r.content
177
+ },
178
+ String(r.id)
179
+ )
180
+ ]
181
+ }
182
+ );
183
+ }
184
+ }
185
+ a(z, "dependencies", [I, Q]), a(z, "hostName", "tab-panel"), a(z, "standaloneHostName", "tab-panel"), a(z, "css", m`
186
+ & {
187
+ display: flex;
188
+ flex-direction: column;
189
+ width: 100%;
190
+ min-height: 0;
191
+ overflow: hidden;
192
+ background: var(--panel-bg, white);
193
+ border-radius: var(--panel-radius, var(--ui-border-radius));
194
+ box-shadow: var(--panel-shadow, none);
195
+ }
196
+
197
+ & > [data-part="content"] {
198
+ display: flex;
199
+ flex-direction: column;
200
+ flex: 1;
201
+ overflow: auto;
202
+ background: var(--panel-bg, white);
203
+ }
204
+ `);
205
+ function O(n) {
206
+ const s = n.tabs ?? [];
207
+ if (!Array.isArray(s)) throw new TypeError("TabPanel tabs must be an array");
208
+ const r = (Array.isArray(n.children) ? n.children : n.children == null ? [] : [n.children]).filter((l) => K(l) && l.type === Q).map((l, o) => {
209
+ if (!K(l)) throw new TypeError("TabPanel children must be Tab nodes");
210
+ const d = l.props;
211
+ return {
212
+ id: d.id ?? `tab-${o + 1}`,
213
+ label: d.label ?? `Tab ${o + 1}`,
214
+ disabled: !!d.disabled,
215
+ content: d.children ?? []
216
+ };
217
+ }), i = s.length > 0 ? s.map((l) => ({
218
+ ...l,
219
+ label: l.label ?? String(l.id),
220
+ disabled: !!l.disabled,
221
+ content: l.content ?? l.component ?? []
222
+ })) : r, e = /* @__PURE__ */ new Set();
223
+ for (const l of i) {
224
+ if ((l == null ? void 0 : l.id) == null) throw new TypeError("Each tab requires an id");
225
+ if (e.has(l.id)) throw new Error(`Duplicate tab id: ${String(l.id)}`);
226
+ e.add(l.id);
227
+ }
228
+ return i;
229
+ }
230
+ class $ extends p {
231
+ constructor(t = {}) {
232
+ super(t);
233
+ a(this, "panelId");
234
+ a(this, "headerId");
235
+ this.panelId = x("panel", t.id), this.headerId = `${this.panelId}-title`;
236
+ }
237
+ render() {
238
+ const {
239
+ header: t = null,
240
+ toolbar: r = null,
241
+ children: i = [],
242
+ orientation: e = "vertical",
243
+ disabled: l = !1
244
+ } = this.props;
245
+ if (!["horizontal", "vertical"].includes(e))
246
+ throw new TypeError("Panel orientation must be horizontal or vertical");
247
+ const o = this.Host, d = t == null ? null : /* @__PURE__ */ c("header", { "data-part": "header", children: typeof t == "string" || typeof t == "number" ? /* @__PURE__ */ c("h2", { id: this.headerId, children: t }) : /* @__PURE__ */ c("div", { id: this.headerId, children: t }) });
248
+ return /* @__PURE__ */ g(
249
+ o,
250
+ {
251
+ id: this.panelId,
252
+ role: t == null ? null : "region",
253
+ className: b(this.props) || null,
254
+ "data-orientation": e,
255
+ "data-disabled": l ? "" : null,
256
+ "aria-disabled": l ? "true" : null,
257
+ "aria-labelledby": t == null ? null : this.headerId,
258
+ children: [
259
+ d,
260
+ r,
261
+ /* @__PURE__ */ c("div", { "data-part": "content", "data-orientation": e, children: i })
262
+ ]
263
+ }
264
+ );
265
+ }
266
+ }
267
+ a($, "hostName", "panel"), a($, "standaloneHostName", "layout-panel"), a($, "baseStyles", [
268
+ ["&", ["panel"]],
269
+ ['& > [data-part="header"]', ["sectionheader"]]
270
+ ]), a($, "css", m`
271
+ & {
272
+ display: flex;
273
+ flex-direction: column;
274
+ overflow: auto;
275
+ flex: 0 0 auto;
276
+ }
277
+
278
+ & > [data-part="header"] h2 {
279
+ margin: 0;
280
+ font: inherit;
281
+ }
282
+
283
+ & > [data-part="content"] {
284
+ display: flex;
285
+ flex: 1;
286
+ overflow: auto;
287
+ padding: var(--panel-padding, 0.75rem);
288
+ gap: var(--spacing-medium, 1rem);
289
+ }
290
+
291
+ & > [data-part="content"][data-orientation="horizontal"] {
292
+ flex-direction: row;
293
+ }
294
+
295
+ & > [data-part="content"][data-orientation="vertical"] {
296
+ flex-direction: column;
297
+ }
298
+ `);
299
+ class P extends p {
300
+ constructor(t = {}) {
301
+ super(t);
302
+ a(this, "sidebarId");
303
+ a(this, "headerId");
304
+ this.sidebarId = x("sidebar", t.id), this.headerId = `${this.sidebarId}-title`;
305
+ }
306
+ render() {
307
+ const {
308
+ header: t = null,
309
+ toolbar: r = null,
310
+ ariaLabel: i,
311
+ children: e = []
312
+ } = this.props, l = t == null ? null : /* @__PURE__ */ c("header", { "data-part": "header", children: typeof t == "string" || typeof t == "number" ? /* @__PURE__ */ c("h2", { id: this.headerId, children: t }) : /* @__PURE__ */ c("div", { id: this.headerId, children: t }) });
313
+ return /* @__PURE__ */ g(
314
+ "aside",
315
+ {
316
+ id: this.sidebarId,
317
+ className: b(this.props) || void 0,
318
+ "data-fray-component": "sidebar",
319
+ "aria-label": t == null ? i : null,
320
+ "aria-labelledby": t == null ? null : this.headerId,
321
+ children: [
322
+ l,
323
+ r == null ? null : /* @__PURE__ */ c("div", { "data-part": "toolbar", children: r }),
324
+ /* @__PURE__ */ c("div", { "data-part": "content", tabIndex: 0, children: e })
325
+ ]
326
+ }
327
+ );
328
+ }
329
+ }
330
+ a(P, "baseStyles", [
331
+ ['aside[data-fray-component="sidebar"]', ["panel"]],
332
+ ['aside[data-fray-component="sidebar"] > [data-part="header"]', ["sectionheader"]]
333
+ ]), a(P, "css", m`
334
+ aside[data-fray-component="sidebar"] {
335
+ display: flex;
336
+ flex-direction: column;
337
+ min-width: 0;
338
+ min-height: 0;
339
+ overflow: hidden;
340
+ }
341
+
342
+ aside[data-fray-component="sidebar"] > [data-part="header"],
343
+ aside[data-fray-component="sidebar"] > [data-part="toolbar"] {
344
+ flex: 0 0 auto;
345
+ }
346
+
347
+ aside[data-fray-component="sidebar"] > [data-part="header"] h2 {
348
+ margin: 0;
349
+ font: inherit;
350
+ }
351
+
352
+ aside[data-fray-component="sidebar"] > [data-part="content"] {
353
+ flex: 1 1 auto;
354
+ min-width: 0;
355
+ min-height: 0;
356
+ overflow-x: hidden;
357
+ overflow-y: auto;
358
+ }
359
+ `);
360
+ class F extends p {
361
+ render() {
362
+ const {
363
+ primary: s = null,
364
+ secondary: t = null,
365
+ direction: r = "horizontal",
366
+ primarySize: i,
367
+ primaryLabel: e,
368
+ secondaryLabel: l
369
+ } = this.props;
370
+ if (r !== "horizontal" && r !== "vertical")
371
+ throw new TypeError("SplitView direction must be horizontal or vertical");
372
+ if (i != null && (typeof i != "string" || i.length === 0))
373
+ throw new TypeError("SplitView primarySize must be a non-empty CSS size");
374
+ const o = this.Host;
375
+ return /* @__PURE__ */ g(
376
+ o,
377
+ {
378
+ className: b(this.props) || null,
379
+ "data-direction": r,
380
+ style: i == null ? void 0 : { "--split-primary-size": i },
381
+ children: [
382
+ /* @__PURE__ */ c(
383
+ "div",
384
+ {
385
+ "data-part": "primary",
386
+ role: e == null ? null : "region",
387
+ "aria-label": e,
388
+ children: s
389
+ }
390
+ ),
391
+ /* @__PURE__ */ c(
392
+ "div",
393
+ {
394
+ "data-part": "secondary",
395
+ role: l == null ? null : "region",
396
+ "aria-label": l,
397
+ children: t ?? this.props.children ?? []
398
+ }
399
+ )
400
+ ]
401
+ }
402
+ );
403
+ }
404
+ }
405
+ a(F, "hostName", "split-view"), a(F, "standaloneHostName", "split-view"), a(F, "css", m`
406
+ & {
407
+ display: grid;
408
+ flex: 1 1 auto;
409
+ min-width: 0;
410
+ min-height: 0;
411
+ overflow: hidden;
412
+ }
413
+
414
+ &[data-direction="horizontal"] {
415
+ grid-template-columns:
416
+ var(--split-primary-size, minmax(16rem, 0.8fr))
417
+ minmax(0, 1.2fr);
418
+ }
419
+
420
+ &[data-direction="vertical"] {
421
+ grid-template-rows:
422
+ var(--split-primary-size, minmax(12rem, 0.8fr))
423
+ minmax(0, 1.2fr);
424
+ }
425
+
426
+ & > [data-part] {
427
+ min-width: 0;
428
+ min-height: 0;
429
+ overflow: auto;
430
+ }
431
+
432
+ &[data-direction="horizontal"] > [data-part="primary"] {
433
+ border-inline-end: 1px solid var(--ui-border-color);
434
+ }
435
+
436
+ &[data-direction="vertical"] > [data-part="primary"] {
437
+ border-block-end: 1px solid var(--ui-border-color);
438
+ }
439
+ `);
440
+ class at extends p {
441
+ render() {
442
+ const { term: s, value: t, children: r = [] } = this.props;
443
+ return /* @__PURE__ */ g(
444
+ "div",
445
+ {
446
+ className: b(this.props) || void 0,
447
+ "data-fray-component": "description-item",
448
+ children: [
449
+ /* @__PURE__ */ c("dt", { children: s }),
450
+ /* @__PURE__ */ c("dd", { children: t ?? r })
451
+ ]
452
+ }
453
+ );
454
+ }
455
+ }
456
+ a(at, "css", m`
457
+ div[data-fray-component="description-item"] {
458
+ display: grid;
459
+ grid-template-columns: minmax(7rem, 0.7fr) minmax(0, 1.3fr);
460
+ gap: var(--spacing-small, 0.5rem);
461
+ padding-block: var(--spacing-small, 0.5rem);
462
+ border-block-end: 1px solid var(--ui-border-color);
463
+ }
464
+
465
+ div[data-fray-component="description-item"] > dt {
466
+ color: var(--ui-muted-text-color, var(--ui-text-color));
467
+ font-weight: 600;
468
+ }
469
+
470
+ div[data-fray-component="description-item"] > dd {
471
+ min-width: 0;
472
+ margin: 0;
473
+ overflow-wrap: anywhere;
474
+ }
475
+
476
+ @media (max-width: 36rem) {
477
+ div[data-fray-component="description-item"] {
478
+ grid-template-columns: minmax(0, 1fr);
479
+ gap: 0.15rem;
480
+ }
481
+ }
482
+ `);
483
+ class U extends p {
484
+ render() {
485
+ return /* @__PURE__ */ c(
486
+ "dl",
487
+ {
488
+ className: b(this.props) || void 0,
489
+ "data-fray-component": "description-list",
490
+ "aria-label": this.props.label,
491
+ children: this.props.children ?? []
492
+ }
493
+ );
494
+ }
495
+ }
496
+ a(U, "dependencies", [at]), a(U, "css", m`
497
+ dl[data-fray-component="description-list"] {
498
+ display: grid;
499
+ margin: 0;
500
+ }
501
+ `);
502
+ const w = class w extends Z {
503
+ constructor(s = {}) {
504
+ super({ ...s, symbols: w.symbols });
505
+ }
506
+ };
507
+ a(w, "hostName", "quad-checkbox"), a(w, "standaloneHostName", "quad-checkbox"), a(w, "symbols", [
508
+ ["✖", v.Deny],
509
+ ["☐", v.Neutral],
510
+ ["✓", v.Prefer],
511
+ ["+", v.Require]
512
+ ]), a(w, "defaultSemanticState", v.Neutral);
513
+ let G = w;
514
+ const E = class E extends Z {
515
+ constructor(s = {}) {
516
+ super({ ...s, symbols: E.symbols });
517
+ }
518
+ };
519
+ a(E, "hostName", "tri-checkbox"), a(E, "standaloneHostName", "tri-checkbox"), a(E, "symbols", [
520
+ ["✖", v.Deny],
521
+ ["☐", v.Neutral],
522
+ ["✓", v.Prefer]
523
+ ]), a(E, "defaultSemanticState", v.Neutral);
524
+ let J = E;
525
+ class j extends p {
526
+ constructor(t = {}) {
527
+ var e;
528
+ super(t);
529
+ a(this, "inputId");
530
+ a(this, "errorId");
531
+ a(this, "optionsEmitter");
532
+ a(this, "valueEmitter");
533
+ a(this, "ownsOptionsEmitter");
534
+ this.inputId = x("dropdown", t.id), this.errorId = `${this.inputId}-error`;
535
+ const r = t.options ?? [];
536
+ dt(r) ? (this.optionsEmitter = r, this.ownsOptionsEmitter = !1) : (B(r), this.optionsEmitter = new ot(r, {
537
+ owner: this,
538
+ purpose: "dropdown options"
539
+ }), this.ownsOptionsEmitter = !0);
540
+ const i = ((e = this.optionsEmitter.get()[0]) == null ? void 0 : e.value) ?? "";
541
+ this.valueEmitter = T(this, t, i, "dropdown value");
542
+ }
543
+ initialize() {
544
+ this.watch(this.valueEmitter, this.optionsEmitter);
545
+ }
546
+ render() {
547
+ const {
548
+ label: t,
549
+ name: r,
550
+ disabled: i = !1,
551
+ required: e = !1,
552
+ error: l = null,
553
+ placeholder: o = "Select…",
554
+ ariaLabel: d,
555
+ onChange: u
556
+ } = this.props, y = this.optionsEmitter.get() ?? [];
557
+ B(y);
558
+ const f = this.valueEmitter.get(), k = this.Host;
559
+ return /* @__PURE__ */ g(
560
+ k,
561
+ {
562
+ className: b(this.props) || null,
563
+ "data-disabled": i ? "" : null,
564
+ "data-required": e ? "" : null,
565
+ "data-error": l == null ? null : "",
566
+ children: [
567
+ t == null ? null : /* @__PURE__ */ c("label", { htmlFor: this.inputId, children: t }),
568
+ /* @__PURE__ */ g(
569
+ "select",
570
+ {
571
+ id: this.inputId,
572
+ name: r,
573
+ value: f == null ? "" : String(f),
574
+ disabled: i,
575
+ required: e,
576
+ "aria-label": t == null ? d : null,
577
+ "aria-invalid": l == null ? null : "true",
578
+ "aria-describedby": l == null ? null : this.errorId,
579
+ onChange: (h) => {
580
+ const A = ct(h, "dropdown change"), N = y.find(({ value: D }) => String(D) === A), R = (N == null ? void 0 : N.value) ?? A;
581
+ this.valueEmitter.set(R, "dropdown selection"), H(u, R, h);
582
+ },
583
+ children: [
584
+ f == null || f === "" ? /* @__PURE__ */ c("option", { value: "", disabled: e, selected: !0, children: o }) : null,
585
+ y.map((h) => {
586
+ if (h == null || !Object.hasOwn(h, "value"))
587
+ throw new TypeError("Dropdown options require value and label fields");
588
+ return /* @__PURE__ */ c(
589
+ "option",
590
+ {
591
+ value: String(h.value),
592
+ disabled: !!h.disabled,
593
+ selected: Object.is(f, h.value),
594
+ children: h.label ?? String(h.value)
595
+ },
596
+ String(h.value)
597
+ );
598
+ })
599
+ ]
600
+ }
601
+ ),
602
+ l == null ? null : /* @__PURE__ */ c(
603
+ "p",
604
+ {
605
+ id: this.errorId,
606
+ "data-part": "error",
607
+ role: "alert",
608
+ children: String(l)
609
+ }
610
+ )
611
+ ]
612
+ }
613
+ );
614
+ }
615
+ }
616
+ a(j, "hostName", "dropdown"), a(j, "standaloneHostName", "drop-down"), a(j, "baseStyles", [
617
+ ["&", ["labeledinput", "inputline"]],
618
+ ["& > label", ["label"]],
619
+ ["& > select", ["input", "inputline"]],
620
+ ["&[data-disabled]", ["disabled"]],
621
+ ["&[data-error]", ["error"]]
622
+ ]), a(j, "css", m`
623
+ & {
624
+ position: relative;
625
+ }
626
+ `);
627
+ function dt(n) {
628
+ return n != null && (typeof n == "object" || typeof n == "function") && typeof Reflect.get(n, "get") == "function" && typeof Reflect.get(n, "subscribe") == "function";
629
+ }
630
+ function ct(n, s) {
631
+ const t = n.currentTarget;
632
+ if (t == null || typeof Reflect.get(t, "value") != "string")
633
+ throw new TypeError(`${s} requires a value-bearing event target`);
634
+ return Reflect.get(t, "value");
635
+ }
636
+ class q extends p {
637
+ constructor(t = {}) {
638
+ super(t);
639
+ a(this, "inputId");
640
+ a(this, "errorId");
641
+ a(this, "valueEmitter");
642
+ this.inputId = x("textbox", t.id), this.errorId = `${this.inputId}-error`, this.valueEmitter = T(this, t, "", "textbox value");
643
+ }
644
+ initialize() {
645
+ this.watch(this.valueEmitter);
646
+ }
647
+ render() {
648
+ const {
649
+ label: t,
650
+ placeholder: r,
651
+ type: i = "text",
652
+ name: e,
653
+ disabled: l = !1,
654
+ required: o = !1,
655
+ readOnly: d = !1,
656
+ error: u = null,
657
+ autoComplete: y,
658
+ inputMode: f,
659
+ minLength: k,
660
+ maxLength: h,
661
+ pattern: A,
662
+ ariaLabel: N,
663
+ inputRef: R,
664
+ onInput: D,
665
+ onChange: it
666
+ } = this.props, rt = this.valueEmitter.get() ?? "", lt = this.Host;
667
+ return /* @__PURE__ */ g(
668
+ lt,
669
+ {
670
+ className: b(this.props) || null,
671
+ "data-disabled": l ? "" : null,
672
+ "data-required": o ? "" : null,
673
+ "data-error": u == null ? null : "",
674
+ children: [
675
+ t == null ? null : /* @__PURE__ */ c("label", { htmlFor: this.inputId, children: t }),
676
+ /* @__PURE__ */ c(
677
+ "input",
678
+ {
679
+ id: this.inputId,
680
+ name: e,
681
+ type: i,
682
+ value: rt,
683
+ placeholder: r,
684
+ disabled: l,
685
+ required: o,
686
+ readOnly: d,
687
+ autoComplete: y,
688
+ inputMode: f,
689
+ minLength: k,
690
+ maxLength: h,
691
+ pattern: A,
692
+ ref: R,
693
+ "aria-label": t == null ? N : null,
694
+ "aria-invalid": u == null ? null : "true",
695
+ "aria-describedby": u == null ? null : this.errorId,
696
+ onInput: (S) => {
697
+ const L = W(S, "textbox input");
698
+ this.valueEmitter.set(L, "textbox input"), H(D, L, S);
699
+ },
700
+ onChange: (S) => H(
701
+ it,
702
+ W(S, "textbox change"),
703
+ S
704
+ )
705
+ }
706
+ ),
707
+ u == null ? null : /* @__PURE__ */ c(
708
+ "p",
709
+ {
710
+ id: this.errorId,
711
+ "data-part": "error",
712
+ role: "alert",
713
+ children: String(u)
714
+ }
715
+ )
716
+ ]
717
+ }
718
+ );
719
+ }
720
+ }
721
+ a(q, "hostName", "textbox"), a(q, "standaloneHostName", "text-box"), a(q, "baseStyles", [
722
+ ["&", ["labeledinput", "inputline"]],
723
+ ["& > label", ["label"]],
724
+ ["& > input", ["input", "inputline"]],
725
+ ["&[data-disabled]", ["disabled"]],
726
+ ["&[data-error]", ["error"]]
727
+ ]), a(q, "css", m`
728
+ & input {
729
+ cursor: text;
730
+ }
731
+
732
+ & > [data-part="error"] {
733
+ margin: 0;
734
+ color: var(--error-color, #b00020);
735
+ }
736
+ `);
737
+ function W(n, s) {
738
+ const t = n.currentTarget;
739
+ if (t == null || typeof Reflect.get(t, "value") != "string")
740
+ throw new TypeError(`${s} requires a value-bearing event target`);
741
+ return Reflect.get(t, "value");
742
+ }
743
+ class X extends p {
744
+ constructor(t = {}) {
745
+ var e;
746
+ super(t);
747
+ a(this, "valueEmitter");
748
+ a(this, "groupId");
749
+ a(this, "legendId");
750
+ const r = t.options ?? [];
751
+ Y(r);
752
+ const i = ((e = r[0]) == null ? void 0 : e[0]) ?? null;
753
+ this.valueEmitter = T(
754
+ this,
755
+ t,
756
+ i ?? null,
757
+ "toggle value"
758
+ ), this.groupId = x("toggle", t.id), this.legendId = `${this.groupId}-label`;
759
+ }
760
+ initialize() {
761
+ this.watch(this.valueEmitter);
762
+ }
763
+ selectOption(t, r = null) {
764
+ this.props.disabled || (this.valueEmitter.set(t, "toggle option selected"), H(this.props.onChange, t, r));
765
+ }
766
+ render() {
767
+ const {
768
+ options: t = [],
769
+ label: r,
770
+ disabled: i = !1,
771
+ required: e = !1
772
+ } = this.props;
773
+ Y(t);
774
+ const l = this.valueEmitter.get(), o = Math.max(
775
+ 0,
776
+ t.findIndex(([d]) => Object.is(d, l))
777
+ );
778
+ return /* @__PURE__ */ g(
779
+ "fieldset",
780
+ {
781
+ id: this.groupId,
782
+ disabled: i,
783
+ className: b(this.props) || void 0,
784
+ "data-fray-component": "toggle",
785
+ "data-disabled": i ? "" : null,
786
+ "aria-required": e ? "true" : null,
787
+ children: [
788
+ r == null ? null : /* @__PURE__ */ c("legend", { id: this.legendId, children: r }),
789
+ /* @__PURE__ */ c(
790
+ "div",
791
+ {
792
+ "data-part": "options",
793
+ role: "radiogroup",
794
+ "aria-label": r == null ? this.props.ariaLabel : null,
795
+ "aria-labelledby": r == null ? null : this.legendId,
796
+ children: t.map(([d, u], y) => /* @__PURE__ */ c(
797
+ "button",
798
+ {
799
+ type: "button",
800
+ role: "radio",
801
+ disabled: i,
802
+ "data-part": "option",
803
+ "aria-checked": Object.is(l, d) ? "true" : "false",
804
+ "data-value": String(d),
805
+ tabIndex: y === o ? 0 : -1,
806
+ onClick: (f) => this.selectOption(d, f),
807
+ onKeyDown: (f) => this.handleKeyDown(f, y, t),
808
+ children: u
809
+ },
810
+ String(d)
811
+ ))
812
+ }
813
+ )
814
+ ]
815
+ }
816
+ );
817
+ }
818
+ handleKeyDown(t, r, i) {
819
+ const { key: e } = t;
820
+ let l;
821
+ if (e === "ArrowRight" || e === "ArrowDown") l = (r + 1) % i.length;
822
+ else if (e === "ArrowLeft" || e === "ArrowUp")
823
+ l = (r - 1 + i.length) % i.length;
824
+ else if (e === "Home") l = 0;
825
+ else if (e === "End") l = i.length - 1;
826
+ else return;
827
+ t.preventDefault();
828
+ const o = i[l];
829
+ if (o != null && (this.selectOption(o[0], t), this.dom instanceof Element)) {
830
+ const d = this.dom.querySelectorAll('[role="radio"]')[l];
831
+ d == null || d.focus();
832
+ }
833
+ }
834
+ }
835
+ a(X, "baseStyles", [
836
+ ['fieldset[data-fray-component="toggle"] > [data-part="options"]', ["uiline"]],
837
+ ['fieldset[data-fray-component="toggle"] [data-part="option"]', ["uiline", "button"]]
838
+ ]), a(X, "css", m`
839
+ fieldset[data-fray-component="toggle"] {
840
+ margin: 0;
841
+ padding: 0;
842
+ border: 0;
843
+ }
844
+
845
+ fieldset[data-fray-component="toggle"] > [data-part="options"] {
846
+ display: flex;
847
+ padding: 0;
848
+ }
849
+
850
+ fieldset[data-fray-component="toggle"] [data-part="option"] {
851
+ border-radius: 0;
852
+ }
853
+
854
+ fieldset[data-fray-component="toggle"] [data-part="option"]:first-child {
855
+ border-radius: var(--ui-border-radius) 0 0 var(--ui-border-radius);
856
+ }
857
+
858
+ fieldset[data-fray-component="toggle"] [data-part="option"]:last-child {
859
+ border-radius: 0 var(--ui-border-radius) var(--ui-border-radius) 0;
860
+ }
861
+
862
+ fieldset[data-fray-component="toggle"] [data-part="option"][aria-checked="true"] {
863
+ background: var(--toggle-selected-bg, var(--ui-accent-color));
864
+ color: var(--toggle-selected-text, white);
865
+ }
866
+ `);
867
+ function Y(n) {
868
+ B(n);
869
+ for (const s of n)
870
+ if (!Array.isArray(s) || s.length < 2)
871
+ throw new TypeError("Toggle options must be [value, label] tuples");
872
+ }
873
+ class V extends p {
874
+ render() {
875
+ const {
876
+ children: s = [],
877
+ id: t,
878
+ label: r = "Actions",
879
+ orientation: i = "horizontal"
880
+ } = this.props;
881
+ if (!["horizontal", "vertical"].includes(i))
882
+ throw new TypeError("Toolbar orientation must be horizontal or vertical");
883
+ const e = this.Host;
884
+ return /* @__PURE__ */ c(
885
+ e,
886
+ {
887
+ id: t,
888
+ role: "toolbar",
889
+ className: b(this.props) || null,
890
+ "data-orientation": i,
891
+ "aria-label": r,
892
+ "aria-orientation": i,
893
+ children: s
894
+ }
895
+ );
896
+ }
897
+ }
898
+ a(V, "hostName", "toolbar"), a(V, "standaloneHostName", "tool-bar"), a(V, "baseStyles", [
899
+ ["&", ["toolbar"]]
900
+ ]), a(V, "css", m`
901
+ & {
902
+ display: flex;
903
+ flex-wrap: wrap;
904
+ align-items: center;
905
+ gap: var(--spacing-small, 0.5rem);
906
+ padding: var(--ui-padding);
907
+ }
908
+
909
+ &[data-orientation="vertical"] {
910
+ flex-direction: column;
911
+ align-items: stretch;
912
+ }
913
+ `);
914
+ class C extends p {
915
+ constructor(t) {
916
+ super(t);
917
+ a(this, "progressId");
918
+ if (this.progressId = x("progress", t.id), t.valueEmitter != null && !ut(t.valueEmitter))
919
+ throw new TypeError("ProgressBar valueEmitter must be a readable emitter");
920
+ }
921
+ render() {
922
+ const t = this.props.max ?? 100;
923
+ if (!Number.isFinite(t) || t <= 0)
924
+ throw new RangeError("ProgressBar max must be a positive finite number");
925
+ const r = this.props.valueEmitter == null ? this.props.value ?? null : this.read(this.props.valueEmitter);
926
+ if (r != null && (!Number.isFinite(r) || r < 0))
927
+ throw new RangeError("ProgressBar value must be null or a non-negative finite number");
928
+ const i = r == null ? null : Math.min(r, t), e = this.props.valueText ?? (i == null ? "In progress" : `${Math.round(i / t * 100)}%`), l = this.Host;
929
+ return /* @__PURE__ */ g(l, { className: b(this.props) || null, children: [
930
+ /* @__PURE__ */ g("div", { "data-part": "label-line", children: [
931
+ /* @__PURE__ */ c("label", { htmlFor: this.progressId, children: this.props.label }),
932
+ /* @__PURE__ */ c("span", { "data-part": "value", children: e })
933
+ ] }),
934
+ /* @__PURE__ */ c(
935
+ "progress",
936
+ {
937
+ id: this.progressId,
938
+ value: i ?? void 0,
939
+ max: t,
940
+ "aria-valuetext": e,
941
+ children: e
942
+ }
943
+ )
944
+ ] });
945
+ }
946
+ }
947
+ a(C, "hostName", "progress-bar"), a(C, "standaloneHostName", "progress-bar"), a(C, "css", m`
948
+ & {
949
+ display: grid;
950
+ gap: var(--spacing-small, 0.5rem);
951
+ }
952
+
953
+ & > [data-part="label-line"] {
954
+ display: flex;
955
+ justify-content: space-between;
956
+ gap: var(--spacing-medium, 1rem);
957
+ }
958
+
959
+ & > [data-part="label-line"] > label {
960
+ font-weight: 600;
961
+ }
962
+
963
+ & > progress {
964
+ width: 100%;
965
+ min-height: 0.8rem;
966
+ accent-color: var(--ui-accent-color);
967
+ }
968
+
969
+ @media (forced-colors: active) {
970
+ & > progress {
971
+ forced-color-adjust: auto;
972
+ }
973
+ }
974
+ `);
975
+ function ut(n) {
976
+ return n != null && (typeof n == "object" || typeof n == "function") && typeof Reflect.get(n, "get") == "function" && typeof Reflect.get(n, "subscribe") == "function";
977
+ }
978
+ export {
979
+ Rt as Button,
980
+ Z as Checkbox,
981
+ p as Component,
982
+ at as DescriptionItem,
983
+ U as DescriptionList,
984
+ j as Dropdown,
985
+ v as FilterMode,
986
+ vt as Fragment,
987
+ yt as FrayRuntime,
988
+ $ as Panel,
989
+ C as ProgressBar,
990
+ G as QuadCheckbox,
991
+ P as Sidebar,
992
+ F as SplitView,
993
+ wt as StyleRegistry,
994
+ Q as Tab,
995
+ I as TabLine,
996
+ z as TabPanel,
997
+ q as Textbox,
998
+ X as Toggle,
999
+ V as Toolbar,
1000
+ J as TriCheckbox,
1001
+ Et as createFrayRuntime,
1002
+ xt as createStyleRegistry,
1003
+ m as css,
1004
+ It as defaultFrayRuntime,
1005
+ Nt as h,
1006
+ c as jsx,
1007
+ St as jsxDEV,
1008
+ g as jsxs,
1009
+ Ht as live,
1010
+ Tt as styleRegistry,
1011
+ _ as tabButtonId,
1012
+ tt as tabPanelId
1013
+ };
1014
+ //# sourceMappingURL=index.js.map