@mechane-ai/elements 0.64.0 → 0.67.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.
Files changed (130) hide show
  1. package/README.md +39 -27
  2. package/dist/ai.js +285 -203
  3. package/dist/{article-BopqPz1K.js → article-anMy8fA5.js} +6 -6
  4. package/dist/article.js +1 -1
  5. package/dist/catalog.json +137 -46
  6. package/dist/{categorical-values-8LA9KXhi.js → categorical-values-Bh7ZkEQn.js} +1 -1
  7. package/dist/charts/cartesian.js +1 -1
  8. package/dist/charts/comparison.js +1 -1
  9. package/dist/charts/distribution.js +1 -1
  10. package/dist/charts/figure.js +12 -12
  11. package/dist/charts/graph.js +1 -1
  12. package/dist/charts/hierarchy.js +1 -1
  13. package/dist/charts/image.js +1 -1
  14. package/dist/charts/matrix.js +1 -1
  15. package/dist/charts/plot.js +3 -3
  16. package/dist/charts/relationship.js +1 -1
  17. package/dist/charts/text.js +1 -1
  18. package/dist/charts/timeline.js +2 -2
  19. package/dist/charts/trend.js +1 -1
  20. package/dist/charts.js +2 -2
  21. package/dist/{code-block-BjQUIvvw.js → code-block-DbW_t9U4.js} +1 -1
  22. package/dist/collections.js +1 -1
  23. package/dist/{commands-BI9rWGpb.js → commands-C7Zrp-tG.js} +2 -2
  24. package/dist/content/code.js +1 -1
  25. package/dist/content/diff.js +3 -3
  26. package/dist/content/link.js +1 -1
  27. package/dist/content/markdown.js +1 -1
  28. package/dist/content/tree.js +2 -2
  29. package/dist/{content-link-C3RAJ2kP.js → content-link-BN4NPp0u.js} +1 -1
  30. package/dist/content.js +1 -1
  31. package/dist/{dates-D1v_jiva.js → dates-OTq-xU33.js} +2 -2
  32. package/dist/{dumbbell-plot-QGjFMk0X.js → dumbbell-plot-BQDGe0sQ.js} +3 -3
  33. package/dist/{embedding-map-D_RNxsCD.js → embedding-map-DmmknG7A.js} +6 -6
  34. package/dist/feedback.js +1 -1
  35. package/dist/{figure-frame-CF3298LZ.js → figure-frame-DlyNTDzh.js} +22 -21
  36. package/dist/forms/dates.js +1 -1
  37. package/dist/{forms-DlKhXUlc.js → forms-iAOjGRTO.js} +1 -1
  38. package/dist/forms.js +2 -2
  39. package/dist/{image-grid-BXsgVBnB.js → image-grid-CxEAQvTf.js} +3 -3
  40. package/dist/index.js +1 -1
  41. package/dist/kits/evaluation.js +13 -13
  42. package/dist/kits/interpretability.js +47 -43
  43. package/dist/kits/operations.js +80 -79
  44. package/dist/kits/research.js +364 -520
  45. package/dist/kits/training.js +108 -107
  46. package/dist/layout.js +1 -1
  47. package/dist/lesson.js +3 -3
  48. package/dist/{markdown-B92daSMP.js → markdown-Diffqqm7.js} +2 -2
  49. package/dist/mdx.js +6 -6
  50. package/dist/navigation/commands.js +1 -1
  51. package/dist/{navigation-D3vnWiVv.js → navigation-CTnYtVD8.js} +1 -1
  52. package/dist/navigation.js +4 -4
  53. package/dist/packages/ai/src/index.d.ts +2 -0
  54. package/dist/packages/ai/src/message-reactions.d.ts +51 -0
  55. package/dist/packages/ai/src/message.d.ts +3 -1
  56. package/dist/packages/collections/src/card-columns-model.d.ts +50 -0
  57. package/dist/packages/collections/src/card-columns.d.ts +30 -0
  58. package/dist/packages/collections/src/collection-page.d.ts +43 -0
  59. package/dist/packages/collections/src/column-card.d.ts +15 -0
  60. package/dist/packages/collections/src/data-table-layout.d.ts +2 -0
  61. package/dist/packages/collections/src/data-table-rows.d.ts +4 -3
  62. package/dist/packages/collections/src/data-table.d.ts +2 -2
  63. package/dist/packages/collections/src/index.d.ts +5 -0
  64. package/dist/packages/collections/src/table-query.d.ts +13 -4
  65. package/dist/packages/collections/src/use-collection-controls.d.ts +6 -0
  66. package/dist/packages/feedback/src/feedback.d.ts +0 -4
  67. package/dist/packages/feedback/src/index.d.ts +1 -1
  68. package/dist/packages/kits/src/research/index.d.ts +0 -2
  69. package/dist/packages/layout/src/app-shell.d.ts +3 -1
  70. package/dist/packages/layout/src/index.d.ts +4 -4
  71. package/dist/packages/layout/src/page-inset.d.ts +5 -0
  72. package/dist/packages/layout/src/page-layout.d.ts +4 -9
  73. package/dist/packages/layout/src/page-toolbar.d.ts +1 -2
  74. package/dist/packages/layout/src/reading-column.d.ts +4 -0
  75. package/dist/packages/layout/src/record-page.d.ts +4 -6
  76. package/dist/packages/layout/src/sidebar.d.ts +3 -1
  77. package/dist/packages/layout/src/workbench.d.ts +2 -6
  78. package/dist/packages/navigation/src/current-page-click.d.ts +3 -0
  79. package/dist/packages/navigation/src/index.d.ts +1 -0
  80. package/dist/{param-DfOYi9wL.js → param-CKr8EYxF.js} +1 -1
  81. package/dist/{pierre-diff-DP_TXXIt.js → pierre-diff-DXVIwW7o.js} +1 -1
  82. package/dist/{plot-layout-BfXmAi71.js → plot-layout-CVzSbcU7.js} +24 -23
  83. package/dist/{plot-surface-UQgDiTVe.js → plot-surface-CBhI1alw.js} +1 -1
  84. package/dist/{reference-lines-BRHB78Wb.js → reference-lines-C970JwWZ.js} +1 -1
  85. package/dist/{scene-DlVQupfw.js → scene-C3dCxckI.js} +6 -6
  86. package/dist/scene.js +1 -1
  87. package/dist/{slope-chart-CjXcvoRJ.js → slope-chart-DekEJxsy.js} +4 -4
  88. package/dist/{src-DojhQZKX.js → src-BCAelv4f.js} +376 -399
  89. package/dist/{src-BYmv3_AL.js → src-Bkov5TTa.js} +204 -191
  90. package/dist/{src-BdQGb362.js → src-BsqbWDxS.js} +4 -4
  91. package/dist/{src-DPcnDU5H.js → src-CIyuaSCi.js} +101 -107
  92. package/dist/src-Dc1t1ugL.js +2612 -0
  93. package/dist/{src-BYnmQkDq.js → src-DceyVyL0.js} +2 -2
  94. package/dist/{src-BI1xQE7D.js → src-Dlh99sPD.js} +46 -32
  95. package/dist/styles2.css +35 -41
  96. package/dist/{time-series-Dg3DZRGx.js → time-series-BSNnijxf.js} +8 -8
  97. package/dist/{timeline-C2IVroD3.js → timeline-CnxfYSIg.js} +4 -4
  98. package/dist/{token-heatmap-CZtIPU60.js → token-heatmap-CJaXo56P.js} +3 -3
  99. package/dist/{token-predictions-BJ5L-Lrm.js → token-predictions-Bi7aKPnh.js} +3 -3
  100. package/dist/{transport-D9e0H2we.js → transport-CXj0DV6o.js} +4 -4
  101. package/dist/{tree-diagram-DRAJiqjW.js → tree-diagram-BxOZsjr1.js} +4 -4
  102. package/dist/{treemap-BdELCV7E.js → treemap-B2yOAetT.js} +4 -4
  103. package/dist/{use-tween-COV8bEYL.js → use-tween-C1TWJwce.js} +1 -1
  104. package/dist/{violin-plot-DuxqWnuD.js → violin-plot-W2L_2JRo.js} +3 -3
  105. package/dist/{waterfall-D4ewGb4u.js → waterfall-Bt73N2Ng.js} +4 -4
  106. package/package.json +1 -1
  107. package/recipes/allocation-report.tsx +4 -4
  108. package/recipes/calendar-workspace.tsx +14 -10
  109. package/recipes/consequential-form.tsx +4 -4
  110. package/recipes/searchable-collection.tsx +66 -58
  111. package/recipes/sectioned-report.tsx +17 -18
  112. package/recipes/session-timeline.tsx +59 -0
  113. package/recipes/tabbed-workspace.tsx +7 -8
  114. package/recipes/workspace-files.tsx +94 -0
  115. package/recipes/workspace-report.tsx +130 -0
  116. package/skills/extend-elements/SKILL.md +21 -0
  117. package/skills/review-elements/SKILL.md +20 -13
  118. package/skills/upgrade-elements/SKILL.md +3 -1
  119. package/skills/upgrade-elements/references/releases.md +36 -0
  120. package/skills/use-elements/SKILL.md +13 -7
  121. package/skills/use-elements/references/collections.md +67 -14
  122. package/skills/use-elements/references/conversations.md +32 -0
  123. package/skills/use-elements/references/editorial-restraint.md +17 -34
  124. package/skills/use-elements/references/figures.md +6 -2
  125. package/skills/use-elements/references/reports.md +4 -1
  126. package/skills/use-elements/references/workspace.md +18 -14
  127. package/dist/packages/kits/src/research/collection-page.d.ts +0 -72
  128. package/dist/packages/layout/src/detail-page.d.ts +0 -9
  129. package/dist/packages/layout/src/page-content.d.ts +0 -5
  130. package/dist/src-P19zz_aO.js +0 -2235
@@ -1,2235 +0,0 @@
1
- import { E as e, O as t, c as n, i as r, m as i, u as a, v as o } from "./src-BYmv3_AL.js";
2
- import { c as s } from "./src-BYnmQkDq.js";
3
- import { i as c, r as l, t as u } from "./src-na2DdkKI.js";
4
- import { d } from "./src-DPcnDU5H.js";
5
- import { l as f, t as p } from "./constants.stylex-CqhVl0uU.js";
6
- import { t as ee } from "./accessibility-P89UG9-r.js";
7
- import { t as te } from "./use-scroll-tab-index-Dxpdh4W7.js";
8
- import { n as m } from "./forms-DlKhXUlc.js";
9
- import * as h from "@stylexjs/stylex";
10
- import { Button as g } from "@ui-sdk/react/button";
11
- import { createParts as _, mergeProps as v, usePart as y, usePrimitive as b } from "@ui-sdk/react/primitive";
12
- import { Children as x, Fragment as ne, createContext as S, useContext as C, useEffect as w, useId as T, useLayoutEffect as E, useMemo as D, useRef as O, useState as k, useSyncExternalStore as re } from "react";
13
- import { byCell as A, createChange as ie, createGridFocus as ae, createSelection as j, createVirtualizer as oe, definePrimitive as M, dispatch as N, selects as se } from "@ui-sdk/core";
14
- import { Fragment as ce, jsx as P, jsxs as F } from "react/jsx-runtime";
15
- import { ArrowDown as le, ArrowUp as ue, ArrowUpDown as de, ChevronLeft as fe, ChevronRight as pe, CircleDashed as me, ListFilter as I, Search as he, Settings2 as ge, X as L } from "lucide-react";
16
- import { useShortcut as R } from "@ui-sdk/react/shortcuts";
17
- import { Toolbar as _e, ToolbarButton as z, ToolbarGroup as ve, ToolbarInput as B } from "@ui-sdk/react/toolbar";
18
- import { createColumnHelper as ye, tableFeatures as be, useTable as xe } from "@tanstack/react-table";
19
- import { Timeline as Se, TimelineDescription as Ce, TimelineItem as we, TimelineMarker as Te, TimelineTime as V, TimelineTitle as Ee } from "@ui-sdk/react/timeline";
20
- // packages/collections/src/control-toolbar.tsx
21
- var H = S(!1);
22
- function U(e) {
23
- return C(H) ? /* @__PURE__ */ P(ve, { ...e }) : /* @__PURE__ */ P(H, {
24
- value: !0,
25
- children: /* @__PURE__ */ P(_e, { ...e })
26
- });
27
- }
28
- function De(e) {
29
- return C(H) ? /* @__PURE__ */ P(z, { render: e }) : e;
30
- }
31
- // packages/collections/src/collection-controls.tsx
32
- var W = {
33
- toolbar: {
34
- kOIVth: "x1hnptsi",
35
- kMwMTN: "xbixft",
36
- kMv6JI: "x1hz01jw",
37
- kGuDYH: "xtqrqnz",
38
- kLWn49: "x1778rvt",
39
- kbsrmU: "xjl7jj",
40
- $$css: !0
41
- },
42
- remove: {
43
- kmuXW: "x2lah0s",
44
- $$css: !0
45
- }
46
- };
47
- function G({ label: e, children: t, actions: n }) {
48
- let r = x.toArray(t).length > 0, i = x.toArray(n).length > 0;
49
- return !r && !i ? null : /* @__PURE__ */ F(U, {
50
- "aria-label": e,
51
- ...h.props(a.row, a.blockEnd, W.toolbar),
52
- children: [t, i && /* @__PURE__ */ P("div", {
53
- className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli xvc5jky",
54
- children: n
55
- })]
56
- });
57
- }
58
- function K({ filters: e, onRemove: n, label: r = "Applied filters" }) {
59
- return e.length === 0 ? null : /* @__PURE__ */ P(U, {
60
- "aria-label": r,
61
- className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli",
62
- children: e.map((e) => /* @__PURE__ */ F("span", {
63
- className: "x1n2onr6 x9f619 x3nfvp2 x6s0dn4 xunmzkg x1f9pz31 x992rv9 xyibt8p x1ok0vyi xeuugli x193iq5w xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt x1s928wv x1j6awrg xarstr8 x5hscyn x86avzo x10z0kkz x1k48kgn x2q1x1w",
64
- children: [/* @__PURE__ */ P("span", {
65
- title: e.label,
66
- className: "xeuugli xb3r6kr xlyipyv xuxw1ft",
67
- children: e.label
68
- }), /* @__PURE__ */ P(z, {
69
- render: /* @__PURE__ */ P(t, {
70
- "aria-label": `Remove ${e.label}`,
71
- variant: "ghost",
72
- xstyle: W.remove
73
- }),
74
- onClick: (t) => {
75
- N({ options: () => ({ onRemove: n }) }, "onRemove", e.id, {
76
- reason: "remove-press",
77
- event: t.nativeEvent
78
- });
79
- },
80
- children: /* @__PURE__ */ P(L, {
81
- size: 14,
82
- "aria-hidden": "true"
83
- })
84
- })]
85
- }, e.id))
86
- });
87
- }
88
- function Oe({ options: n, onChange: r, onReset: i, label: a = "Display options" }) {
89
- let o = De(/* @__PURE__ */ P(t, {
90
- "aria-label": a,
91
- title: a
92
- }));
93
- return /* @__PURE__ */ F(l.Root, { children: [/* @__PURE__ */ P(l.Trigger, {
94
- render: o,
95
- children: /* @__PURE__ */ P(ge, {
96
- size: 14,
97
- "aria-hidden": "true"
98
- })
99
- }), /* @__PURE__ */ F(l.Popup, {
100
- align: "end",
101
- children: [/* @__PURE__ */ P(l.Title, { children: "Display" }), /* @__PURE__ */ F("div", {
102
- className: "xrvj5dj x1n8ia3y xfb3i0g",
103
- children: [n.map((e) => /* @__PURE__ */ F("label", {
104
- className: "x78zum5 x6s0dn4 x1hnptsi xbixft xtqrqnz x1hz01jw x1778rvt xeuugli xj0a0fe",
105
- children: [/* @__PURE__ */ P(s.Root, {
106
- checked: e.isChecked,
107
- onCheckedChange: (t) => r(e.id, t),
108
- disabled: e.isRequired === !0,
109
- children: /* @__PURE__ */ P(s.Indicator, {})
110
- }), e.label]
111
- }, e.id)), i !== void 0 && /* @__PURE__ */ P(e, {
112
- type: "button",
113
- variant: "ghost",
114
- onClick: i,
115
- children: "Reset defaults"
116
- })]
117
- })]
118
- })] });
119
- }
120
- function ke({ label: t, description: r, previous: i, next: a }) {
121
- return /* @__PURE__ */ F("nav", {
122
- "aria-label": t === void 0 ? "Pagination" : `${t} pagination`,
123
- className: "x78zum5 x6s0dn4 x1qughib x1a02dak xaml1ju xeuugli",
124
- children: [/* @__PURE__ */ P(n, { children: r }), /* @__PURE__ */ F("div", {
125
- className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli xvc5jky",
126
- children: [/* @__PURE__ */ F(e, {
127
- variant: "outline",
128
- "aria-label": t === void 0 ? void 0 : `Previous page of ${t}`,
129
- disabled: i.disabled,
130
- onClick: i.onClick,
131
- children: [/* @__PURE__ */ P(fe, {
132
- size: 16,
133
- "aria-hidden": "true"
134
- }), "Previous"]
135
- }), /* @__PURE__ */ F(e, {
136
- variant: "outline",
137
- "aria-label": t === void 0 ? void 0 : `Next page of ${t}`,
138
- disabled: a.disabled,
139
- onClick: a.onClick,
140
- children: ["Next", /* @__PURE__ */ P(pe, {
141
- size: 16,
142
- "aria-hidden": "true"
143
- })]
144
- })]
145
- })]
146
- });
147
- }
148
- // packages/collections/src/data-table-styles.ts
149
- var Ae = {
150
- kmVPX3: "x1717udv",
151
- kMzoRj: "xc342km",
152
- $$css: !0
153
- }, je = {
154
- kVAEAm: "x10l6tqk",
155
- k87sOh: "x13vifvy",
156
- kLqNvP: "x1o0tod",
157
- kzqmXN: "x1i1rx1s",
158
- k33iCy: "xlshs6z",
159
- kfzvcC: "x47corl",
160
- $$css: !0
161
- }, q = {
162
- frame: {
163
- k7Eaqz: "xeuugli",
164
- kMv6JI: "x1hz01jw",
165
- kGuDYH: "xtqrqnz",
166
- kLWn49: "x1778rvt",
167
- k63SB2: "xj57cvi",
168
- kMwMTN: "xbixft",
169
- khiITx: "xvmahel",
170
- $$css: !0
171
- },
172
- content: { $$css: !0 },
173
- placeholder: {
174
- kfzvcC: "x47corl",
175
- $$css: !0
176
- },
177
- fillFrame: {
178
- k1xSpc: "x78zum5",
179
- kXwgrk: "xdt5ytf",
180
- kUk6DE: "x98rzlu",
181
- kAzted: "x2lwn1j",
182
- $$css: !0
183
- },
184
- viewport: {
185
- kVAEAm: "x1n2onr6",
186
- k7Eaqz: "xeuugli",
187
- k9g6sI: "x12h1iku",
188
- kVQacm: "xysyzu8",
189
- kacamN: "xy5w88m",
190
- k3XXqK: "x1t137rt",
191
- kPJHz1: "x13qnu6",
192
- k7shQP: "x9v5kkp",
193
- kZs9gx: "x19rmrnh",
194
- kiEn40: "x1bqaal",
195
- $$css: !0
196
- },
197
- fillViewport: {
198
- kUk6DE: "x98rzlu",
199
- kAzted: "x2lwn1j",
200
- $$css: !0
201
- },
202
- virtual: (e) => [{
203
- kskxy: e == null ? e : "x1jols5v",
204
- $$css: !0
205
- }, { "--x-maxHeight": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
206
- table: {
207
- kzqmXN: "xh8yej3",
208
- kLvRdT: "x1mwwwfo",
209
- kcqcaj: "xss6m8b",
210
- k9WMMc: "xdpxx8g",
211
- kMwMTN: "xbixft",
212
- kWkggS: "xpvm0e4",
213
- $$css: !0
214
- },
215
- fixed: {
216
- kPzzVL: "x140o2bo",
217
- $$css: !0
218
- },
219
- minimumWidth: (e, t) => [{
220
- k7Eaqz: (e == null ? e : "x7w7ha4 ") + (t == null ? t : "x18ie477"),
221
- $$css: !0
222
- }, {
223
- "--x-1utbgw4": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
224
- "--x-1wqfzdf": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
225
- }],
226
- caption: {
227
- k9WMMc: "xdpxx8g",
228
- kmVPX3: "xg7ukam",
229
- kMwMTN: "x153jb6y",
230
- kGuDYH: "xy8obcc",
231
- kLWn49: "xas2l8k",
232
- $$css: !0
233
- },
234
- header: {
235
- kB7OPa: "x9f619",
236
- kVAEAm: "x7wzq59",
237
- k87sOh: "x13vifvy",
238
- kY2c9j: "x11ru5tl",
239
- kZKoxP: "x1krvmzm",
240
- k8WAf4: "xt970qd",
241
- kg3NbH: "x1dc62k6",
242
- kt9PQ7: "xso031l",
243
- kfdmCh: "x1q0q8m5",
244
- kL6WhQ: "x1qndepd",
245
- kMwMTN: "x153jb6y",
246
- kWkggS: "xpvm0e4",
247
- k63SB2: "xj57cvi",
248
- kGuDYH: "xy8obcc",
249
- kLWn49: "xas2l8k",
250
- khDVqt: "xuxw1ft",
251
- $$css: !0
252
- },
253
- headerLabel: {
254
- k1xSpc: "x1lliihq",
255
- k7Eaqz: "xeuugli",
256
- kVQacm: "xb3r6kr",
257
- kg5iWk: "xlyipyv",
258
- khDVqt: "xuxw1ft",
259
- $$css: !0
260
- },
261
- sort: {
262
- k1xSpc: "x3nfvp2",
263
- kGNEyG: "x6s0dn4",
264
- kOIVth: "x1hnptsi",
265
- ks0D6T: "x193iq5w",
266
- k7Eaqz: "xeuugli",
267
- kAzted: "x2zujid x17oiadl",
268
- kmVPX3: "x1717udv",
269
- kMzoRj: "xc342km",
270
- kMwMTN: "x1heor9g",
271
- kWkggS: "xjbqb8w",
272
- kMv6JI: "xjb2p0i",
273
- kGuDYH: "x1qlqyl8",
274
- k63SB2: "x1pd3egz",
275
- kLWn49: "x15bjb6t",
276
- kkrTdU: "x1ypdohk",
277
- kDPRdz: "xp9636p",
278
- kSReZ0: "x1s9zmfe",
279
- kPJHz1: "x13qnu6",
280
- k7shQP: "x9v5kkp",
281
- kZs9gx: "x19rmrnh",
282
- kiEn40: "x7s97pk",
283
- $$css: !0
284
- },
285
- sortIcon: {
286
- kmuXW: "x2lah0s",
287
- $$css: !0
288
- },
289
- row: {
290
- kVAEAm: "x1n2onr6",
291
- kHBbk8: "xc8icb0",
292
- kZKoxP: "x1wtzb06",
293
- kt9PQ7: "xso031l",
294
- kfdmCh: "x1q0q8m5",
295
- kL6WhQ: "x1qndepd",
296
- ko0ZBZ: "x19k386i",
297
- kx8K5S: "x1t1lzn6",
298
- $$css: !0
299
- },
300
- selected: {
301
- kWkggS: "x1r8u7ye",
302
- $$css: !0
303
- },
304
- actionable: {
305
- kkrTdU: "x1ypdohk",
306
- kSReZ0: "x1ecmtor",
307
- $$css: !0
308
- },
309
- trigger: {
310
- kO7zv1: "x1rh3ycu",
311
- kfSwDN: "x1hx0egp",
312
- k1xSpc: "x78zum5",
313
- kGNEyG: "x6s0dn4",
314
- kzqmXN: "xh8yej3",
315
- k7Eaqz: "xeuugli",
316
- kAzted: "x17tes2r x17oiadl",
317
- kmVPX3: "x1717udv",
318
- kMzoRj: "xc342km",
319
- kaIpWk: "x1ok0vyi",
320
- kMwMTN: "x1heor9g",
321
- kWkggS: "xjbqb8w",
322
- kMv6JI: "xjb2p0i",
323
- kGuDYH: "x1qlqyl8",
324
- k63SB2: "x1pd3egz",
325
- kLWn49: "x15bjb6t",
326
- k9WMMc: "x16tdsg8",
327
- kybGjl: "x1hl2dhg",
328
- kkrTdU: "x1ypdohk",
329
- k3XXqK: "x1t137rt",
330
- k5JduY: "x1s928wv",
331
- kwXMNM: "x1j6awrg",
332
- kv0HGH: "xarstr8",
333
- kIHVmn: "x11q50lq",
334
- kEbOEz: "xa2q2qx",
335
- kQSxdi: "x1x5eltu",
336
- kUivIt: "x1jdy9wv",
337
- kYPGJ8: "xtgyt42",
338
- kWC4TW: "x19mxcj1",
339
- $$css: !0
340
- },
341
- cell: {
342
- kB7OPa: "x9f619",
343
- k8WAf4: "xt970qd",
344
- kg3NbH: "x1dc62k6",
345
- kXLuUW: "xxymvpz",
346
- kHjlTd: "xj0a0fe",
347
- $$css: !0
348
- },
349
- start: {
350
- k9WMMc: "x1yc453h",
351
- $$css: !0
352
- },
353
- end: {
354
- k9WMMc: "xp4054r",
355
- $$css: !0
356
- },
357
- width: (e) => [{
358
- kzqmXN: e == null ? e : "x5lhr3w",
359
- k7Eaqz: e == null ? e : "xkj4a21",
360
- $$css: !0
361
- }, {
362
- "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
363
- "--x-minWidth": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e)
364
- }],
365
- secondary: {
366
- k1xSpc: "xqxxu6g",
367
- $$css: !0
368
- },
369
- truncated: {
370
- kVQacm: "xb3r6kr",
371
- khDVqt: "xuxw1ft",
372
- kg5iWk: "xlyipyv",
373
- $$css: !0
374
- },
375
- cellContent: {
376
- k1xSpc: "x1lliihq",
377
- k7Eaqz: "xeuugli",
378
- kzqmXN: "xh8yej3",
379
- ks0D6T: "x193iq5w",
380
- k8hWNX: "xkfz77",
381
- kDUsi3: "x1ljc890",
382
- $$css: !0
383
- },
384
- rowControl: {
385
- kVAEAm: "x1n2onr6",
386
- kY2c9j: "x1vjfegm",
387
- $$css: !0
388
- },
389
- text: {
390
- k1xSpc: "x1lliihq",
391
- k7Eaqz: "xeuugli",
392
- kzqmXN: "xh8yej3",
393
- $$css: !0
394
- },
395
- textColumn: {
396
- kUk6DE: "x98rzlu",
397
- k7Eaqz: "xeuugli",
398
- $$css: !0
399
- },
400
- textRow: {
401
- k1xSpc: "x78zum5",
402
- kGNEyG: "x6s0dn4",
403
- kOIVth: "x1n8ia3y",
404
- k7Eaqz: "xeuugli",
405
- kzqmXN: "xh8yej3",
406
- kMv6JI: "x1hz01jw",
407
- kGuDYH: "xtqrqnz",
408
- kLWn49: "x1778rvt",
409
- k63SB2: "xj57cvi",
410
- $$css: !0
411
- },
412
- primaryRow: {
413
- k1xSpc: "x78zum5",
414
- kGNEyG: "x6s0dn4",
415
- kOIVth: "x1hnptsi",
416
- k7Eaqz: "xeuugli",
417
- $$css: !0
418
- },
419
- primaryText: {
420
- kzqmXN: "x14atkfc",
421
- kmuXW: "xs83m0k",
422
- $$css: !0
423
- },
424
- mono: {
425
- kMv6JI: "xiard35",
426
- kcqcaj: "xss6m8b",
427
- $$css: !0
428
- },
429
- adornment: {
430
- k1xSpc: "x3nfvp2",
431
- kGNEyG: "x6s0dn4",
432
- kmuXW: "x2lah0s",
433
- $$css: !0
434
- },
435
- secondaryText: {
436
- kMwMTN: "x153jb6y",
437
- kGuDYH: "xy8obcc",
438
- kLWn49: "xas2l8k",
439
- $$css: !0
440
- },
441
- cellViewport: {
442
- k1xSpc: "x78zum5",
443
- kGNEyG: "x6s0dn4",
444
- k7Eaqz: "xeuugli",
445
- kzqmXN: "xh8yej3",
446
- kZKoxP: "xw3im37",
447
- $$css: !0
448
- },
449
- fixedContent: {
450
- kskxy: "x1l6neo7",
451
- $$css: !0
452
- },
453
- readable: {
454
- khDVqt: "xuxw1ft",
455
- $$css: !0
456
- },
457
- contentCell: {
458
- k8WAf4: "xn9t2bk",
459
- $$css: !0
460
- },
461
- contentViewport: {
462
- kZKoxP: "xt7dq6l",
463
- $$css: !0
464
- },
465
- selection: {
466
- kzqmXN: "x1d7z9mz",
467
- k7Eaqz: "xeuugli",
468
- kg3NbH: "x1dc62k6",
469
- $$css: !0
470
- },
471
- spacer: (e) => [
472
- Ae,
473
- {
474
- kZKoxP: e == null ? e : "x16ye13r",
475
- $$css: !0
476
- },
477
- { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
478
- ],
479
- sizer: (e) => [
480
- je,
481
- {
482
- kZKoxP: e == null ? e : "x16ye13r",
483
- $$css: !0
484
- },
485
- { "--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }
486
- ],
487
- emptyCell: {
488
- kmVPX3: "x1717udv",
489
- $$css: !0
490
- },
491
- empty: {
492
- kB7OPa: "x9f619",
493
- kVAEAm: "x7wzq59",
494
- kLqNvP: "x1o0tod",
495
- kzqmXN: "xzfn7dr",
496
- ks0D6T: "x193iq5w",
497
- kmVPX3: "x1ttojsm",
498
- k9WMMc: "x2b8uid",
499
- khDVqt: "xeaf4i8",
500
- kHjlTd: "xj0a0fe",
501
- kMwMTN: "x153jb6y",
502
- $$css: !0
503
- },
504
- footer: {
505
- kmVPX3: "xg7ukam",
506
- kEafiO: "x178xt8z",
507
- kPef9Z: "x13fuv20",
508
- kLZC3w: "xhjagg4",
509
- $$css: !0
510
- },
511
- endContent: {
512
- kAzted: "xid9utz",
513
- kmVPX3: "xg7ukam",
514
- kMwMTN: "x153jb6y",
515
- kGuDYH: "xy8obcc",
516
- kLWn49: "xas2l8k",
517
- kefpsp: "x15x95ik",
518
- kyjxKa: "x1az1eml",
519
- $$css: !0
520
- }
521
- };
522
- // packages/collections/src/data-table-text.tsx
523
- function Me({ children: e, leading: t, isDecorative: n = !1 }) {
524
- let r = x.toArray(t).length > 0;
525
- return /* @__PURE__ */ F("span", {
526
- "aria-hidden": n || void 0,
527
- inert: n || void 0,
528
- ...h.props(q.textRow),
529
- children: [r && /* @__PURE__ */ P("span", {
530
- "aria-hidden": !0,
531
- ...h.props(q.adornment),
532
- children: t
533
- }), /* @__PURE__ */ P("span", {
534
- ...h.props(q.textColumn),
535
- children: e
536
- })]
537
- });
538
- }
539
- function Ne({ children: e, secondary: t, leading: n, trailing: r, isMono: i = !1 }) {
540
- let a = x.toArray(r).length > 0;
541
- return /* @__PURE__ */ F(Me, {
542
- leading: n,
543
- children: [/* @__PURE__ */ F("span", {
544
- ...h.props(q.primaryRow),
545
- children: [/* @__PURE__ */ P("span", {
546
- "data-record-text": !0,
547
- title: typeof e == "string" ? e : void 0,
548
- ...h.props(q.text, q.primaryText, q.truncated, i && q.mono),
549
- children: e
550
- }), a && /* @__PURE__ */ P("span", {
551
- ...h.props(q.adornment),
552
- children: r
553
- })]
554
- }), t !== void 0 && /* @__PURE__ */ P("span", {
555
- title: t,
556
- ...h.props(q.text, q.truncated, q.secondaryText),
557
- children: t
558
- })]
559
- });
560
- }
561
- function Pe({ leading: e, isSecondary: t = !1 }) {
562
- return /* @__PURE__ */ F(Me, {
563
- leading: e,
564
- isDecorative: !0,
565
- children: [/* @__PURE__ */ P("span", {
566
- ...h.props(q.text),
567
- children: /* @__PURE__ */ P(d, { width: "70%" })
568
- }), t && /* @__PURE__ */ P("span", {
569
- ...h.props(q.text, q.secondaryText),
570
- children: /* @__PURE__ */ P(d, { width: "45%" })
571
- })]
572
- });
573
- }
574
- // packages/collections/src/data-table-layout.tsx
575
- var Fe = p.compactTable.slice(7), Ie = /* @__PURE__ */ new Set(["string", "number"]), J = {
576
- primary: {
577
- minimumWidth: 240,
578
- isFlexible: !0,
579
- shouldTruncate: !0
580
- },
581
- text: {
582
- minimumWidth: 160,
583
- isFlexible: !1,
584
- shouldTruncate: !0
585
- },
586
- status: {
587
- minimumWidth: 160,
588
- isFlexible: !1,
589
- shouldTruncate: !1
590
- },
591
- number: {
592
- minimumWidth: 112,
593
- isFlexible: !1,
594
- shouldTruncate: !1
595
- },
596
- timestamp: {
597
- minimumWidth: 160,
598
- isFlexible: !1,
599
- shouldTruncate: !1
600
- },
601
- actions: {
602
- minimumWidth: 112,
603
- isFlexible: !1,
604
- shouldTruncate: !1
605
- }
606
- }, Le = {
607
- fixed: q.content,
608
- content: q.contentCell
609
- }, Re = {
610
- primary: q.start,
611
- text: q.start,
612
- status: q.start,
613
- number: q.end,
614
- timestamp: q.end,
615
- actions: q.end
616
- }, ze = {
617
- content: q.content,
618
- fill: q.fillFrame
619
- }, Be = {
620
- content: q.content,
621
- fill: q.fillViewport
622
- };
623
- function Ve(e) {
624
- return e.map((e) => {
625
- let t = J[e.role], n = e.width ?? (t.isFlexible ? void 0 : t.minimumWidth);
626
- return {
627
- ...e,
628
- ...n === void 0 ? {} : { width: n }
629
- };
630
- });
631
- }
632
- function He(e, t = 0) {
633
- return {
634
- minimumWidth: e.reduce((e, t) => e + (t.width ?? J[t.role].minimumWidth), t),
635
- compactWidth: e.filter((e) => e.isSecondary !== !0).reduce((e, t) => e + (t.width ?? J[t.role].minimumWidth), t)
636
- };
637
- }
638
- function Ue(e) {
639
- let t = globalThis.matchMedia(Fe);
640
- return t.addEventListener("change", e), () => t.removeEventListener("change", e);
641
- }
642
- function We() {
643
- return globalThis.matchMedia(Fe).matches;
644
- }
645
- function Ge({ columns: e, canSelect: t = !1 }) {
646
- return /* @__PURE__ */ F("colgroup", { children: [t && /* @__PURE__ */ P("col", { ...h.props(q.selection) }), e.map((e) => /* @__PURE__ */ P("col", { ...h.props(e.width !== void 0 && q.width(e.width), e.isSecondary === !0 && q.secondary) }, e.id))] });
647
- }
648
- function Ke({ role: e, isFixed: t, shouldTruncate: n, children: r }) {
649
- let i = J[e], a = t && i.shouldTruncate, o = n === !0 || typeof r == "string" && (n ?? a);
650
- return /* @__PURE__ */ P("span", {
651
- ...h.props(q.cellViewport, !t && q.contentViewport),
652
- children: /* @__PURE__ */ P("span", {
653
- "data-record-text": Ie.has(typeof r) || void 0,
654
- title: typeof r == "string" ? r : void 0,
655
- ...h.props(q.cellContent, t && q.fixedContent, t && !i.shouldTruncate && q.readable, o && q.truncated),
656
- children: r
657
- })
658
- });
659
- }
660
- // packages/collections/src/table-results.tsx
661
- function qe({ status: e, sort: t, selected: n, pagination: r, isPlaceholder: i }) {
662
- return {
663
- status: e,
664
- pending: e === "pending",
665
- sort: t,
666
- selected: n === null ? [] : [...n],
667
- page: r?.description ?? null,
668
- hasPreviousPage: r !== void 0 && !r.previous.disabled,
669
- hasNextPage: r !== void 0 && !r.next.disabled,
670
- isPlaceholder: i
671
- };
672
- }
673
- var Y = "[hidden], [inert], [aria-hidden=\"true\"], [data-agent-hidden], [data-agent-secret]";
674
- function Je(e) {
675
- let t = e instanceof HTMLTableElement ? e.tBodies[0] : void 0;
676
- if (t !== void 0 && t.closest(Y) === null) return new Map(Array.from(t.rows).flatMap((e) => {
677
- let t = e.dataset.rowId, n = Array.from(e.cells).find((e) => e.dataset.recordLabel !== void 0);
678
- if (t === void 0 || n === void 0) return [];
679
- if (n.closest(Y) !== null || n.querySelector("[data-agent-secret], [data-agent-hidden]") !== null || !n.checkVisibility({ visibilityProperty: !0 })) return [[t, null]];
680
- let r = n.querySelector("[data-row-action][aria-label]") ?? n.querySelector("[data-record-text]");
681
- if (r !== null && r.closest(Y) !== null || r?.checkVisibility({ visibilityProperty: !0 }) === !1) return [[t, null]];
682
- let i = r?.getAttribute("aria-label") ?? r?.textContent.trim();
683
- return [[t, i === void 0 || i.length === 0 ? t : i]];
684
- }));
685
- }
686
- var Ye = {
687
- none: "ascending",
688
- ascending: "descending",
689
- descending: "none"
690
- }, Xe = /* @__PURE__ */ new Set(["ascending", "descending"]), Ze = /* @__PURE__ */ new Set(["Home", "End"]), Qe = M({
691
- name: "collection-results",
692
- options: {
693
- status: "string",
694
- sort: "value",
695
- onSortChange: "callback",
696
- sortable: "list",
697
- selected: "value",
698
- onSelectedChange: "callback",
699
- pagination: "value",
700
- rowIds: "list",
701
- rowLabel: "callback",
702
- isActionable: "boolean",
703
- reveal: "callback",
704
- onOpen: "callback",
705
- isPlaceholder: "boolean"
706
- },
707
- state: (e) => ({
708
- ...qe(e),
709
- active: null
710
- }),
711
- sync: qe,
712
- controlled: [
713
- "status",
714
- "sort",
715
- "selected",
716
- "page",
717
- "hasPreviousPage",
718
- "hasNextPage"
719
- ],
720
- api: (e) => {
721
- let t = ie(e), n = ae(e, {
722
- key: "active",
723
- rows: () => e.options().rowIds.length,
724
- cols: () => 1,
725
- disabled: () => !e.options().isActionable,
726
- reveal: (t) => e.options().reveal(t.row)
727
- }), r = { rowIds: e.options().rowIds };
728
- e.onOptions((t) => {
729
- let i = n.active(), a = i === null ? void 0 : r.rowIds[i.row];
730
- if (r.rowIds = t.rowIds, i === null || t.rowIds[i.row] === a) return;
731
- let o = a === void 0 ? -1 : t.rowIds.indexOf(a);
732
- e.store.set({ active: o === -1 ? null : {
733
- row: o,
734
- col: 0
735
- } });
736
- });
737
- let i = j(e, {
738
- key: "selected",
739
- set: (e, n) => t("selected", e, n),
740
- order: () => e.options().rowIds,
741
- multiple: () => !0
742
- });
743
- function a() {
744
- if (e.options().selected === null) throw Error("This table has no row selection.");
745
- }
746
- function o(t) {
747
- let { sortable: n } = e.options(), r = n.find((e) => e.id === t || e.label === t);
748
- if (r === void 0) {
749
- let e = n.map((e) => e.label).join(", ");
750
- throw Error(e.length === 0 ? "This table has no sortable column." : `Sort by one of: ${e}.`);
751
- }
752
- return r.id;
753
- }
754
- function s(t) {
755
- let n = e.options().pagination?.[t];
756
- if (n === void 0 || n.disabled) throw Error(`There is no ${t} page.`);
757
- return n.onClick(), !0;
758
- }
759
- return {
760
- grid: n,
761
- rowKeydown(t) {
762
- t.shiftKey || (t.metaKey || t.ctrlKey || !Ze.has(t.key) ? n.keydown(t) : (t.preventDefault(), n.focus({
763
- row: t.key === "Home" ? 0 : e.options().rowIds.length - 1,
764
- col: 0
765
- }, {
766
- reason: "list-navigation",
767
- event: t
768
- })));
769
- },
770
- focusRow: (e) => n.focus({
771
- row: e,
772
- col: 0
773
- }),
774
- toggleSort(n, r) {
775
- let { sort: i } = e.options(), a = Ye[i?.columnId === n ? i.direction : "none"];
776
- return t("sort", a === "none" ? null : {
777
- columnId: n,
778
- direction: a
779
- }, {
780
- reason: "trigger-press",
781
- event: r
782
- });
783
- },
784
- toggleRow(e, t) {
785
- let n = t === void 0 ? { reason: "item-press" } : {
786
- reason: "item-press",
787
- event: t
788
- };
789
- t instanceof MouseEvent && t.shiftKey ? i.extend(e, n) : i.toggle(e, n);
790
- },
791
- toggleAll(e) {
792
- i.toggleAll(e === void 0 ? { reason: "item-press" } : {
793
- reason: "item-press",
794
- event: e
795
- });
796
- },
797
- sort(e, n = "ascending") {
798
- if (n === "none") return t("sort", null, { reason: "imperative" });
799
- if (!Xe.has(n)) throw Error("The direction is ascending, descending or none.");
800
- return t("sort", {
801
- columnId: o(e),
802
- direction: n === "descending" ? "descending" : "ascending"
803
- }, { reason: "imperative" });
804
- },
805
- select(n) {
806
- a();
807
- let { rowIds: r } = e.options(), i = (Array.isArray(n) ? n : [n]).map(String), o = i.find((e) => !r.includes(e));
808
- if (o !== void 0) throw Error(`No row "${o}" is in this table.`);
809
- return t("selected", i, { reason: "imperative" });
810
- },
811
- open(t) {
812
- let n = e.options().rowIds.indexOf(String(t));
813
- if (n === -1 || !e.options().isActionable) throw Error(n === -1 ? `No row "${String(t)}" is in this table.` : "The rows have no action now.");
814
- return e.options().onOpen(n), !0;
815
- },
816
- previousPage: () => s("previous"),
817
- nextPage: () => s("next"),
818
- records() {
819
- let t = Je(e.element("root")), { rowIds: n, rowLabel: r } = e.options();
820
- if (t === void 0) return [];
821
- let i = Array.from(t.values()).includes(null);
822
- return n.flatMap((e, n) => {
823
- let a = t.has(e) ? t.get(e) : r(n);
824
- return !t.has(e) && i || a == null ? [] : [{
825
- value: e,
826
- label: a
827
- }];
828
- });
829
- }
830
- };
831
- },
832
- slots: (e) => ({
833
- root: e({}),
834
- trigger: e({
835
- props: {
836
- value: "string",
837
- row: "number",
838
- col: "number"
839
- },
840
- selects: se({ active: A }),
841
- attrs: (e, { props: t, api: n }) => ({ tabindex: n.grid.tabIndex(e, t) }),
842
- on: {
843
- keydown: (e, { api: t }) => t.rowKeydown(e),
844
- focus: (e, { api: t, props: n }) => {
845
- t.grid.focus(n, {
846
- reason: "item-press",
847
- event: e
848
- });
849
- }
850
- },
851
- bind: (e, { api: t, props: n }) => t.grid.bind(e, n)
852
- })
853
- }),
854
- agent: {
855
- actions: [
856
- "sort",
857
- "select",
858
- "open",
859
- "previousPage",
860
- "nextPage"
861
- ],
862
- items: (e) => e.records(),
863
- shown: (e) => !e.isPlaceholder
864
- }
865
- });
866
- function $e(e, t) {
867
- let n = b(Qe, e), r = y(n, "root", {}, t(n.api), "table");
868
- return {
869
- api: n.api,
870
- element: r
871
- };
872
- }
873
- var et = _(Qe, {
874
- root: "table",
875
- trigger: "a"
876
- }).Trigger, tt = _(Qe, {
877
- root: "table",
878
- trigger: "button"
879
- }).Trigger;
880
- // packages/collections/src/data-table-trigger.tsx
881
- function nt(e) {
882
- if (e.defaultPrevented || e.button !== 0) return !1;
883
- let t = e.metaKey || e.ctrlKey, n = e.altKey || e.shiftKey;
884
- return t || n ? !1 : e.detail === 0 || e.currentTarget.ownerDocument.getSelection()?.isCollapsed !== !1;
885
- }
886
- function rt({ index: e, recordId: t, row: n, action: r, isActive: i, children: a }) {
887
- let o = r.label?.(n), s = r.href === void 0 ? /* @__PURE__ */ P(tt, {
888
- value: t,
889
- row: e,
890
- col: 0,
891
- type: "button",
892
- disabled: r.disabled === !0,
893
- "aria-label": o,
894
- "aria-pressed": i,
895
- "data-row-action": !0,
896
- onClick: (e) => {
897
- nt(e) && r.onActivate(n);
898
- },
899
- ...h.props(q.trigger),
900
- children: a
901
- }) : /* @__PURE__ */ P(et, {
902
- value: t,
903
- row: e,
904
- col: 0,
905
- "aria-label": o,
906
- href: r.href(n),
907
- "data-row-action": !0,
908
- onClick: (e) => {
909
- r.onActivate !== void 0 && nt(e) && (e.preventDefault(), r.onActivate(n));
910
- },
911
- ...h.props(q.trigger),
912
- children: a
913
- });
914
- return o === void 0 || r.showTooltip !== !0 ? s : /* @__PURE__ */ F(u.Root, { children: [/* @__PURE__ */ P(u.Trigger, { render: s }), /* @__PURE__ */ P(u.Popup, {
915
- side: "top",
916
- align: "start",
917
- children: o
918
- })] });
919
- }
920
- // packages/collections/src/use-end-reached.ts
921
- function it({ end: e, viewport: t, onEndReached: n, content: r }) {
922
- w(() => {
923
- if (n === void 0 || e.current === null) return;
924
- let r = new IntersectionObserver((e) => {
925
- e.some((e) => e.isIntersecting) && n();
926
- }, { root: t?.current ?? null });
927
- return r.observe(e.current), () => r.disconnect();
928
- }, [
929
- e,
930
- t,
931
- n,
932
- r
933
- ]);
934
- }
935
- // packages/collections/src/use-table-window.ts
936
- var at = [];
937
- function ot(e) {
938
- let t = O(e), [{ rows: n, subscribe: r, readItems: i, scrollToIndex: a }] = k(() => {
939
- let e = oe({
940
- count: () => t.current.count,
941
- estimate: () => t.current.estimate,
942
- key: (e) => t.current.keyOf(e),
943
- overscan: 6,
944
- keep: () => t.current.keep(),
945
- onEnd: () => t.current.onEnd?.(),
946
- endThreshold: 0,
947
- get scrollMargin() {
948
- return t.current.margin;
949
- }
950
- });
951
- return {
952
- rows: e,
953
- subscribe: (t) => e.subscribe(t),
954
- readItems: () => e.items(),
955
- scrollToIndex: (t) => e.scrollToIndex(t)
956
- };
957
- }), [o] = k(() => /* @__PURE__ */ new Map()), { isEnabled: s, viewport: c } = e;
958
- return E(() => {
959
- t.current = e, n.refresh();
960
- }), E(() => {
961
- let e = c.current;
962
- if (s && e !== null) return n.connect(e);
963
- }, [
964
- s,
965
- n,
966
- c
967
- ]), {
968
- items: re(r, i, () => at),
969
- size: n.size(),
970
- scrollToIndex: a,
971
- measure(e) {
972
- let t = o.get(e);
973
- if (t !== void 0) return t;
974
- let r = (t) => n.measure(e, t);
975
- return o.set(e, r), r;
976
- }
977
- };
978
- }
979
- // packages/collections/src/data-table-rows.tsx
980
- var st = be({}), ct = {
981
- ascending: ue,
982
- descending: le,
983
- none: de
984
- };
985
- function lt(e, t) {
986
- let n = O(void 0);
987
- w(() => {
988
- if (t === void 0) {
989
- n.current = void 0;
990
- return;
991
- }
992
- if (n.current !== void 0 && n.current.id === e) return;
993
- let r = { isCurrent: !0 };
994
- return queueMicrotask(() => {
995
- r.isCurrent && (n.current = { id: e }, t(e));
996
- }), () => {
997
- r.isCurrent = !1;
998
- };
999
- }, [e, t]);
1000
- }
1001
- function X({ rows: e, columns: t, getRowId: n, caption: r, empty: i, sort: a, onSortChange: o, selectedIds: c, onSelectionChange: l, selectionLabel: u, rowAction: d, activeRowId: p, focusRowId: m, onRowHighlightChange: _, hideCaption: v = !1, hideHeaders: y = !1, rowSizing: b = "fixed", window: x, endContent: S, onEndReached: C, footer: T, pagination: A, resultStatus: ie = "ready", isPlaceholder: ae = !1 }) {
1002
- let j = D(() => Ve(t), [t]), oe = re(Ue, We, () => !1), M = D(() => {
1003
- let e = ye();
1004
- return e.columns(j.map((t) => e.display({
1005
- id: t.id,
1006
- header: t.label
1007
- })));
1008
- }, [j]), N = xe({
1009
- features: st,
1010
- columns: M,
1011
- data: e,
1012
- getRowId: n
1013
- }), se = te(), le = se.viewport, ue = O(null), de = O(null), fe = O(null), [pe, me] = k(0), [I, he] = k(), [ge, L] = k(), R = O(void 0), _e = O(void 0), z = D(() => e.map(n), [e, n]), ve = I === void 0 ? -1 : z.indexOf(I.id), B = I?.isWithin === !0 ? ve : -1, be = B === -1 ? void 0 : I?.id, Se = j.findIndex((e) => e.role === "primary" && e.isSecondary !== !0), Ce = Se === -1 ? j.findIndex((e) => e.isSecondary !== !0) : Se, we = typeof x?.height == "string" ? x.height : "content", Te = d !== void 0 && d.disabled !== !0;
1014
- it({
1015
- end: ue,
1016
- onEndReached: x === void 0 ? C : void 0,
1017
- content: e.length
1018
- }), w(() => {
1019
- let e = de.current, t = fe.current;
1020
- if (x === void 0 || e === null || t === null) return;
1021
- let n = new ResizeObserver(() => me(e.offsetHeight + t.offsetHeight));
1022
- return n.observe(e), n.observe(t), () => n.disconnect();
1023
- }, [
1024
- x,
1025
- v,
1026
- y
1027
- ]);
1028
- let V = ot({
1029
- isEnabled: x !== void 0,
1030
- viewport: le,
1031
- count: e.length,
1032
- keyOf: (e) => z[e] ?? String(e),
1033
- estimate: b === "fixed" ? f.rowHeight : x?.estimatedRowHeight ?? f.rowHeight,
1034
- margin: pe,
1035
- keep: () => [
1036
- Math.max(0, ve),
1037
- B - 1,
1038
- B,
1039
- B + 1
1040
- ],
1041
- onEnd: C
1042
- });
1043
- w(() => {
1044
- x !== void 0 && e.length === 0 && C?.();
1045
- }, [
1046
- x,
1047
- e.length,
1048
- C
1049
- ]);
1050
- function Ee(e) {
1051
- return le.current?.querySelector(`[data-row-id="${CSS.escape(e)}"] [data-row-action]`) ?? null;
1052
- }
1053
- let H = D(() => o === void 0 ? [] : j.filter((e) => e.canSort === !0).map(({ id: e, label: t }) => ({
1054
- id: e,
1055
- label: t
1056
- })), [j, o]), U = D(() => c === void 0 ? null : Array.from(c), [c]), De = {
1057
- status: ie,
1058
- sort: a ?? null,
1059
- onSortChange: o === void 0 ? void 0 : (e, t) => o(e ?? void 0, t),
1060
- sortable: H,
1061
- selected: U,
1062
- onSelectedChange: l === void 0 ? void 0 : (e, t) => l(new Set(e), t),
1063
- pagination: A,
1064
- rowIds: z,
1065
- rowLabel: (t) => {
1066
- let n = e[t];
1067
- return n === void 0 ? void 0 : d?.label?.(n) ?? u?.(n);
1068
- },
1069
- isActionable: Te,
1070
- reveal: (e) => {
1071
- x !== void 0 && V.scrollToIndex(e);
1072
- },
1073
- onOpen: (e) => {
1074
- let t = z[e], n = t === void 0 ? null : Ee(t);
1075
- n === null ? (_e.current = t, V.scrollToIndex(e)) : n.click();
1076
- },
1077
- isPlaceholder: ae
1078
- };
1079
- E(() => {
1080
- let e = _e.current;
1081
- e !== void 0 && (_e.current = void 0, Ee(e)?.click());
1082
- });
1083
- let W = x === void 0 ? N.getRowModel().rows.map((e, t) => ({
1084
- row: e,
1085
- index: t,
1086
- spacerHeight: 0
1087
- })) : V.items.flatMap((e, t, n) => {
1088
- let r = N.getRowModel().rows[e.index], i = n[t - 1];
1089
- if (r === void 0) return [];
1090
- let a = i === void 0 ? 0 : i.start + i.size;
1091
- return [{
1092
- row: r,
1093
- index: e.index,
1094
- spacerHeight: e.start - a
1095
- }];
1096
- }), G = W.some(({ row: e }) => e.id === ge) ? ge : void 0;
1097
- ge !== void 0 && G === void 0 && L(void 0), lt(G ?? be, _);
1098
- let K = j.filter((e) => !oe || e.isSecondary !== !0).length + (c === void 0 ? 0 : 1), Oe = c === void 0 ? 0 : 76, Ae = T != null && typeof T != "boolean" || A !== void 0, { minimumWidth: je, compactWidth: Me } = He(j, Oe), Ne = V.items.at(-1), Pe = V.size - (Ne === void 0 ? 0 : Ne.start + Ne.size), Fe = c === void 0 ? 0 : z.filter((e) => c.has(e)).length, Ie = z.length > 0 && Fe === z.length, J = Fe > 0 && !Ie;
1099
- function qe(t) {
1100
- return /* @__PURE__ */ F(ce, { children: [
1101
- /* @__PURE__ */ P("caption", {
1102
- ref: de,
1103
- "aria-label": r,
1104
- ...h.props(q.caption, v && ee.hidden),
1105
- children: r
1106
- }),
1107
- /* @__PURE__ */ P(Ge, {
1108
- columns: j,
1109
- canSelect: c !== void 0
1110
- }),
1111
- /* @__PURE__ */ P("thead", {
1112
- ref: fe,
1113
- ...h.props(y && ee.hidden),
1114
- children: /* @__PURE__ */ F("tr", { children: [c !== void 0 && /* @__PURE__ */ P("th", {
1115
- scope: "col",
1116
- "aria-label": "Select",
1117
- ...h.props(q.header, q.selection, q.rowControl),
1118
- children: /* @__PURE__ */ P(s.Root, {
1119
- "aria-label": `Select every row of ${r}`,
1120
- checked: Ie,
1121
- indeterminate: J,
1122
- disabled: z.length === 0,
1123
- onCheckedChange: (e, n) => t.toggleAll(n.event),
1124
- children: /* @__PURE__ */ P(s.Indicator, {})
1125
- })
1126
- }), j.map((e) => {
1127
- let n = a?.columnId === e.id ? a.direction : void 0, i = ct[n ?? "none"];
1128
- return /* @__PURE__ */ P("th", {
1129
- scope: "col",
1130
- title: e.label,
1131
- "aria-sort": n,
1132
- ...h.props(q.header, Re[e.role], e.width !== void 0 && q.width(e.width), e.isSecondary === !0 && q.secondary),
1133
- children: e.canSort === !0 && o !== void 0 ? /* @__PURE__ */ F(g, {
1134
- type: "button",
1135
- "aria-label": `Sort ${r} by ${e.label}`,
1136
- ...h.props(q.sort),
1137
- onClick: (n) => t.toggleSort(e.id, n.nativeEvent),
1138
- children: [/* @__PURE__ */ P("span", {
1139
- ...h.props(q.headerLabel),
1140
- children: e.label
1141
- }), /* @__PURE__ */ P(i, {
1142
- size: 14,
1143
- "aria-hidden": "true",
1144
- ...h.props(q.sortIcon)
1145
- })]
1146
- }) : /* @__PURE__ */ P("span", {
1147
- ...h.props(q.headerLabel),
1148
- children: e.label
1149
- })
1150
- }, e.id);
1151
- })] })
1152
- }),
1153
- /* @__PURE__ */ F("tbody", {
1154
- onPointerLeave: () => L(void 0),
1155
- onKeyDownCapture: () => L(void 0),
1156
- onBlur: (e) => {
1157
- e.currentTarget.contains(e.relatedTarget) || he((e) => e === void 0 ? void 0 : {
1158
- id: e.id,
1159
- isWithin: !1
1160
- });
1161
- },
1162
- children: [
1163
- W.map(({ row: e, index: n, spacerHeight: r }) => /* @__PURE__ */ F(ne, { children: [r > 0 && /* @__PURE__ */ P("tr", {
1164
- "aria-hidden": "true",
1165
- children: /* @__PURE__ */ P("td", {
1166
- colSpan: K,
1167
- ...h.props(q.spacer(r))
1168
- })
1169
- }), /* @__PURE__ */ F("tr", {
1170
- "data-index": n,
1171
- "data-row-id": e.id,
1172
- "aria-rowindex": x === void 0 ? void 0 : n + 2,
1173
- ref: x === void 0 || b === "fixed" ? void 0 : V.measure(n),
1174
- onPointerMove: (t) => {
1175
- t.pointerType === "mouse" && L(e.id);
1176
- },
1177
- onPointerEnter: (t) => {
1178
- t.pointerType === "mouse" && L(e.id);
1179
- },
1180
- onPointerLeave: () => {
1181
- L((t) => t === e.id ? void 0 : t);
1182
- },
1183
- onPointerDown: (e) => {
1184
- e.pointerType !== "mouse" && L(void 0);
1185
- },
1186
- onFocus: () => {
1187
- L(void 0), he({
1188
- id: e.id,
1189
- isWithin: !0
1190
- });
1191
- },
1192
- ...h.props(q.row, Te && q.actionable, (c?.has(e.id) === !0 || p === e.id) && q.selected),
1193
- children: [c !== void 0 && /* @__PURE__ */ P("td", {
1194
- ...h.props(q.cell, q.selection, q.rowControl),
1195
- children: /* @__PURE__ */ P(s.Root, {
1196
- "aria-label": u(e.original),
1197
- checked: c.has(e.id),
1198
- onCheckedChange: (n, r) => t.toggleRow(e.id, r.event),
1199
- children: /* @__PURE__ */ P(s.Indicator, {})
1200
- })
1201
- }), j.map((t, r) => {
1202
- let i = /* @__PURE__ */ P(Ke, {
1203
- role: t.role,
1204
- isFixed: b === "fixed",
1205
- shouldTruncate: t.shouldTruncate,
1206
- children: t.cell(e.original)
1207
- });
1208
- return /* @__PURE__ */ P("td", {
1209
- "data-record-label": r === Ce || void 0,
1210
- ...h.props(q.cell, Le[b], Re[t.role], t.width !== void 0 && q.width(t.width), t.isSecondary === !0 && q.secondary),
1211
- children: d !== void 0 && r === Ce ? /* @__PURE__ */ P(rt, {
1212
- index: n,
1213
- recordId: e.id,
1214
- row: e.original,
1215
- action: d,
1216
- isActive: p === e.id,
1217
- children: i
1218
- }) : i
1219
- }, t.id);
1220
- })]
1221
- })] }, e.id)),
1222
- x !== void 0 && Pe > 0 && /* @__PURE__ */ P("tr", {
1223
- "aria-hidden": "true",
1224
- children: /* @__PURE__ */ P("td", {
1225
- colSpan: K,
1226
- ...h.props(q.spacer(Pe))
1227
- })
1228
- }),
1229
- e.length === 0 && /* @__PURE__ */ P("tr", { children: /* @__PURE__ */ P("td", {
1230
- colSpan: K,
1231
- ...h.props(q.emptyCell),
1232
- children: /* @__PURE__ */ P("div", {
1233
- ...h.props(q.empty),
1234
- children: i
1235
- })
1236
- }) })
1237
- ]
1238
- })
1239
- ] });
1240
- }
1241
- let { api: Y, element: Je } = $e(De, (t) => ({
1242
- "aria-label": r,
1243
- "aria-busy": ie === "pending" || void 0,
1244
- "aria-rowcount": x === void 0 ? void 0 : Math.max(1, e.length) + 1,
1245
- ...h.props(q.table, q.fixed, q.minimumWidth(je, Me)),
1246
- children: qe(t)
1247
- }));
1248
- return E(() => {
1249
- if (m === void 0) {
1250
- R.current = void 0;
1251
- return;
1252
- }
1253
- let e = z.indexOf(m);
1254
- if (R.current === m || e === -1) return;
1255
- let t = requestAnimationFrame(() => {
1256
- Y.focusRow(e) && (R.current = m);
1257
- });
1258
- return () => cancelAnimationFrame(t);
1259
- }, [
1260
- z,
1261
- m,
1262
- Te,
1263
- Y
1264
- ]), /* @__PURE__ */ F("div", {
1265
- ...h.props(q.frame, ze[we]),
1266
- children: [/* @__PURE__ */ F("div", {
1267
- ref: se.ref,
1268
- "data-table-viewport": !0,
1269
- role: "region",
1270
- "aria-label": r,
1271
- tabIndex: se.tabIndex,
1272
- ...h.props(q.viewport, Be[we], typeof x?.height == "number" && q.virtual(x.height)),
1273
- children: [
1274
- Je,
1275
- x !== void 0 && /* @__PURE__ */ P("div", {
1276
- "aria-hidden": !0,
1277
- ...h.props(q.sizer(pe + V.size))
1278
- }),
1279
- /* @__PURE__ */ P("div", {
1280
- ref: ue,
1281
- ...h.props(S !== void 0 && q.endContent),
1282
- children: S
1283
- })
1284
- ]
1285
- }), Ae && /* @__PURE__ */ F("div", {
1286
- ...h.props(q.footer),
1287
- children: [T, A !== void 0 && /* @__PURE__ */ P(ke, {
1288
- ...A,
1289
- label: r
1290
- })]
1291
- })]
1292
- });
1293
- }
1294
- // packages/collections/src/table-query.tsx
1295
- var ut = S(void 0);
1296
- function Z(e) {
1297
- if (e.reason.trim().length === 0) throw Error("A table query exception requires a reason.");
1298
- }
1299
- function dt({ search: e, filters: t, children: n, isFiltered: r = !1 }) {
1300
- return e === void 0 ? /* @__PURE__ */ P(ut, {
1301
- value: void 0,
1302
- children: n
1303
- }) : (e !== !0 && Z(e), t !== !0 && Z(t), /* @__PURE__ */ P(ut, {
1304
- value: r,
1305
- children: n
1306
- }));
1307
- }
1308
- function ft(e) {
1309
- if ("reason" in e) Z(e);
1310
- else {
1311
- if (e.length === 0) throw Error("Supply filter dimensions or explain why the table has none.");
1312
- if (new Set(e.map((e) => e.id)).size !== e.length) throw Error("Each table filter must have a unique ID.");
1313
- }
1314
- }
1315
- var pt = [];
1316
- function mt(e, t) {
1317
- let [n, r] = k(""), [i, a] = k(/* @__PURE__ */ new Map()), o = typeof t.search == "function" ? t.search : void 0;
1318
- typeof t.search != "function" && Z(t.search), ft(t.filters);
1319
- let s = "reason" in t.filters ? pt : t.filters, c = o === void 0 ? void 0 : {
1320
- value: n,
1321
- onChange: r
1322
- }, l = n.trim().toLowerCase(), u = D(() => s.map((t) => {
1323
- let n = new Set(e.map(t.value)), r = i.get(t.id);
1324
- r !== void 0 && n.add(r);
1325
- let o = Array.from(n, (e) => ({
1326
- value: `value:${e}`,
1327
- label: t.formatLabel?.(e) ?? (e === "" ? "Unspecified" : e)
1328
- }));
1329
- return {
1330
- id: t.id,
1331
- label: t.label,
1332
- options: [{
1333
- value: "",
1334
- label: "All"
1335
- }, ...o],
1336
- defaultValue: "",
1337
- value: r === void 0 ? "" : `value:${r}`,
1338
- onChange(e) {
1339
- a((n) => {
1340
- let r = new Map(n);
1341
- return e === "" ? r.delete(t.id) : r.set(t.id, e.slice(6)), r;
1342
- });
1343
- }
1344
- };
1345
- }), [
1346
- s,
1347
- i,
1348
- e
1349
- ]), d = l !== "" && o !== void 0, f = u.some((e) => e.value !== e.defaultValue);
1350
- return {
1351
- rows: d || f ? e.filter((e) => d && !o(e).toLowerCase().includes(l) ? !1 : s.every((t) => !i.has(t.id) || t.value(e) === i.get(t.id))) : e,
1352
- search: c,
1353
- filters: u,
1354
- isFiltered: d || f
1355
- };
1356
- }
1357
- function ht() {
1358
- let e = C(ut);
1359
- if (e === void 0) throw Error("A frame-owned table requires its enclosing collection to supply TableQueryFrame.");
1360
- return e;
1361
- }
1362
- function gt(e) {
1363
- "reason" in e.search && Z(e.search), ft(e.filters);
1364
- let t = "reason" in e.search ? void 0 : e.search, n = "reason" in e.filters ? [] : e.filters;
1365
- return {
1366
- search: t,
1367
- filters: n,
1368
- isFiltered: !!t?.value.trim() || n.some((e) => e.value !== e.defaultValue)
1369
- };
1370
- }
1371
- // packages/collections/src/collection-filters.tsx
1372
- var Q = {
1373
- search: {
1374
- kzqmXN: "xh8yej3",
1375
- k1K539: "x1kk91vl",
1376
- $$css: !0
1377
- },
1378
- icon: {
1379
- k1xSpc: "x78zum5",
1380
- kMwMTN: "x153jb6y",
1381
- $$css: !0
1382
- },
1383
- positive: {
1384
- kMwMTN: "x7ixh4y",
1385
- $$css: !0
1386
- },
1387
- warning: {
1388
- kMwMTN: "x1f9ixgr",
1389
- $$css: !0
1390
- },
1391
- negative: {
1392
- kMwMTN: "xr5kp14",
1393
- $$css: !0
1394
- }
1395
- }, _t = {
1396
- positive: Q.positive,
1397
- negative: Q.negative,
1398
- warning: Q.warning,
1399
- neutral: void 0
1400
- }, vt = /* @__PURE__ */ new Set([
1401
- "Home",
1402
- "End",
1403
- "ArrowLeft",
1404
- "ArrowRight",
1405
- "Backspace",
1406
- "Delete"
1407
- ]);
1408
- function yt({ option: e }) {
1409
- return /* @__PURE__ */ P("span", {
1410
- ...h.props(Q.icon, _t[e.tone ?? "neutral"]),
1411
- children: e.icon ?? /* @__PURE__ */ P(me, {
1412
- size: 14,
1413
- "aria-hidden": !0
1414
- })
1415
- });
1416
- }
1417
- function bt({ groups: e }) {
1418
- let [n, i] = k(""), a = e.filter((e) => e.label.toLowerCase().includes(n.toLowerCase())), o = e.length === 1 && e[0] !== void 0 ? `Filter by ${e[0].label.toLowerCase()}` : "Filters", s = De(/* @__PURE__ */ P(t, {
1419
- "aria-label": o,
1420
- title: "Filters"
1421
- }));
1422
- return /* @__PURE__ */ F(c.Root, {
1423
- onOpenChange: (e) => {
1424
- e || i("");
1425
- },
1426
- children: [/* @__PURE__ */ P(c.Trigger, {
1427
- render: s,
1428
- children: /* @__PURE__ */ P(I, {
1429
- size: 14,
1430
- "aria-hidden": !0
1431
- })
1432
- }), /* @__PURE__ */ F(c.Popup, {
1433
- align: "end",
1434
- children: [
1435
- /* @__PURE__ */ P(xt, {
1436
- label: "Find a filter",
1437
- value: n,
1438
- onChange: i
1439
- }),
1440
- a.map((e) => /* @__PURE__ */ P(St, { group: e }, e.id)),
1441
- a.length === 0 && /* @__PURE__ */ P("div", {
1442
- className: "x1hmw7ec x5g2kb4",
1443
- children: /* @__PURE__ */ P(r, { children: "No filters found" })
1444
- })
1445
- ]
1446
- })]
1447
- });
1448
- }
1449
- function xt({ label: e, value: t, onChange: n }) {
1450
- return /* @__PURE__ */ P(m, {
1451
- type: "search",
1452
- "aria-label": e,
1453
- placeholder: "Filter…",
1454
- autoFocus: !0,
1455
- value: t,
1456
- onValueChange: n,
1457
- onKeyDown: (e) => {
1458
- (e.key.length === 1 || vt.has(e.key)) && e.stopPropagation();
1459
- },
1460
- xstyle: Q.search
1461
- });
1462
- }
1463
- function St({ group: e }) {
1464
- let [t, n] = k(""), i = e.options.filter((e) => e.label.toLowerCase().includes(t.toLowerCase()));
1465
- return /* @__PURE__ */ F(c.SubmenuRoot, {
1466
- onOpenChange: (e) => {
1467
- e || n("");
1468
- },
1469
- children: [/* @__PURE__ */ F(c.SubmenuTrigger, { children: [
1470
- e.icon ?? /* @__PURE__ */ P(I, {
1471
- size: 14,
1472
- "aria-hidden": !0
1473
- }),
1474
- /* @__PURE__ */ P("span", {
1475
- className: "x98rzlu xeuugli xj0a0fe",
1476
- children: e.label
1477
- }),
1478
- /* @__PURE__ */ P("span", {
1479
- className: "xazcve0 xb3r6kr xuxw1ft xlyipyv x153jb6y xy8obcc xas2l8k",
1480
- children: e.options.find((t) => t.value === e.value)?.label
1481
- }),
1482
- /* @__PURE__ */ P(pe, {
1483
- size: 14,
1484
- "aria-hidden": !0
1485
- })
1486
- ] }), /* @__PURE__ */ F(c.Popup, {
1487
- align: "start",
1488
- "aria-label": e.label,
1489
- children: [
1490
- /* @__PURE__ */ P(xt, {
1491
- label: `Find ${e.label.toLowerCase()}`,
1492
- value: t,
1493
- onChange: n
1494
- }),
1495
- /* @__PURE__ */ P(c.RadioGroup, {
1496
- value: e.value,
1497
- onValueChange: e.onChange,
1498
- children: i.map((e) => /* @__PURE__ */ F(c.RadioItem, {
1499
- value: e.value,
1500
- closeOnSelect: !0,
1501
- children: [/* @__PURE__ */ P(yt, { option: e }), /* @__PURE__ */ P("span", {
1502
- className: "x98rzlu xeuugli xj0a0fe",
1503
- children: e.label
1504
- })]
1505
- }, e.value))
1506
- }),
1507
- i.length === 0 && /* @__PURE__ */ P("div", {
1508
- className: "x1hmw7ec x5g2kb4",
1509
- children: /* @__PURE__ */ P(r, { children: "No options found" })
1510
- })
1511
- ]
1512
- })]
1513
- });
1514
- }
1515
- // packages/collections/src/query-controls.tsx
1516
- function Ct(e) {
1517
- return {
1518
- value: e.search?.value ?? "",
1519
- filters: e.selections,
1520
- disabled: e.isDisabled,
1521
- available: e.search !== void 0 || e.groups.length > 0
1522
- };
1523
- }
1524
- function wt(e) {
1525
- let t = JSON.parse(e);
1526
- if (Array.isArray(t) && t.length === 2) {
1527
- let e = t[0], n = t[1];
1528
- if (typeof e == "string" && typeof n == "string") return [e, n];
1529
- }
1530
- throw Error("Select a listed filter option, or provide a filter ID and value.");
1531
- }
1532
- var Tt = M({
1533
- name: "collection-query",
1534
- options: {
1535
- search: "value",
1536
- groups: "list",
1537
- selections: "value",
1538
- isDisabled: "boolean"
1539
- },
1540
- state: Ct,
1541
- sync: Ct,
1542
- controlled: ["value", "filters"],
1543
- api: ({ options: e }) => ({
1544
- get setQuery() {
1545
- let { search: t, isDisabled: n } = e();
1546
- return n || t === void 0 ? null : (e) => {
1547
- if (typeof e != "string") throw TypeError("The search term must be a string.");
1548
- N({ options: () => t }, "onChange", e, { reason: "imperative" });
1549
- };
1550
- },
1551
- get submitSearch() {
1552
- let { search: t, isDisabled: n } = e();
1553
- return n || t?.onSubmit === void 0 ? null : () => {
1554
- N({ options: () => t }, "onSubmit", t.value, { reason: "imperative" });
1555
- };
1556
- },
1557
- get setFilter() {
1558
- let { groups: t, isDisabled: n } = e();
1559
- return n || t.length === 0 ? null : (e, n) => {
1560
- let [r, i] = n === void 0 ? wt(e) : [e, n], a = t.find((e) => e.id === r);
1561
- if (a === void 0 || !a.options.some((e) => e.value === i)) throw Error("Unknown filter or option. Choose one of the listed filter options.");
1562
- N({ options: () => a }, "onChange", i, { reason: "imperative" });
1563
- };
1564
- },
1565
- items() {
1566
- return e().groups.flatMap((e) => e.options.map((t) => ({
1567
- value: JSON.stringify([e.id, t.value]),
1568
- label: `${e.label} · ${t.label}`
1569
- })));
1570
- }
1571
- }),
1572
- agent: {
1573
- actions: [
1574
- "setQuery",
1575
- "submitSearch",
1576
- "setFilter"
1577
- ],
1578
- items: (e) => e.items(),
1579
- shown: (e) => e.available && !e.disabled
1580
- },
1581
- slots: (e) => ({ root: e({}) })
1582
- }), Et = _(Tt, { root: "div" }).Root, Dt = { input: {
1583
- k7Eaqz: "xeuugli",
1584
- kUk6DE: "x98rzlu",
1585
- $$css: !0
1586
- } };
1587
- function Ot({ label: e = "Collection controls", search: n, filters: r = [], filterContent: i, chips: a = [], viewActions: o, display: s, isPlaceholder: c = !1, isReady: u }) {
1588
- let [d, f] = k(!1), [p, ee] = k(!1), te = O(null), h = O(null), g = O(null), _ = D(() => Object.fromEntries(r.map((e) => [e.id, e.value])), [r]), v = c || !u, y = n !== void 0 && (d || n.value.length > 0);
1589
- E(() => {
1590
- d && !c && u && (g.current?.focus(), g.current?.select());
1591
- }, [
1592
- d,
1593
- c,
1594
- u
1595
- ]);
1596
- function b() {
1597
- (te.current ?? h.current?.querySelector("button"))?.focus();
1598
- }
1599
- function ne() {
1600
- n !== void 0 && !c && u && (g.current?.focus(), g.current?.select(), f(!0));
1601
- }
1602
- function S(e, t) {
1603
- n !== void 0 && N({ options: () => n }, "onChange", "", {
1604
- reason: e,
1605
- event: t
1606
- }), f(!1), b();
1607
- }
1608
- function C(e) {
1609
- y && !e.defaultPrevented && e.key === "Escape" && e.target instanceof Element && e.target.closest("[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"], [data-native-find], input:not([data-view-find]), textarea, select") === null && (e.preventDefault(), e.stopPropagation(), S("escape-key", e.nativeEvent));
1610
- }
1611
- let w = r.filter((e) => e.value !== e.defaultValue).map((e) => ({
1612
- id: `filter:${e.id}`,
1613
- label: e.options.find((t) => t.value === e.value)?.label ?? e.value,
1614
- onRemove: (t) => e.onChange(e.defaultValue, t)
1615
- }));
1616
- for (let e of a) w.push({
1617
- ...e,
1618
- id: `chip:${e.id}`
1619
- });
1620
- let T = i !== void 0 || r.length > 0, re = x.toArray([o, s]).length > 0, A = n !== void 0 || T || re, ie = n?.label ?? "Search this view", ae = n?.placeholder ?? "Find in view…";
1621
- return {
1622
- openSearch: ne,
1623
- onKeyDown: C,
1624
- actions: A ? /* @__PURE__ */ F(U, {
1625
- "aria-label": e,
1626
- render: /* @__PURE__ */ P(Et, {
1627
- search: n,
1628
- groups: r,
1629
- selections: _,
1630
- isDisabled: v,
1631
- ref: h,
1632
- "aria-hidden": v,
1633
- inert: v,
1634
- className: "x78zum5 x6s0dn4 x1a02dak x13a6bvl x1hnptsi xeuugli x193iq5w"
1635
- }),
1636
- children: [
1637
- n !== void 0 && /* @__PURE__ */ P(z, {
1638
- disabled: c,
1639
- render: /* @__PURE__ */ P(t, {
1640
- ref: te,
1641
- type: "button",
1642
- "aria-label": "Find in view",
1643
- title: "Find in view",
1644
- "data-view-find-trigger": !0,
1645
- "aria-expanded": y,
1646
- onClick: ne
1647
- }),
1648
- children: /* @__PURE__ */ P(he, {
1649
- size: 14,
1650
- "aria-hidden": !0
1651
- })
1652
- }),
1653
- y && /* @__PURE__ */ F("div", {
1654
- className: "x78zum5 x6s0dn4 xunmzkg xdl07me x193iq5w",
1655
- children: [/* @__PURE__ */ P(B, {
1656
- disabled: c,
1657
- render: /* @__PURE__ */ P(m, {
1658
- ref: g,
1659
- type: "search",
1660
- "data-view-find": !0,
1661
- "aria-label": ie,
1662
- placeholder: ae,
1663
- value: n.value,
1664
- onValueChange: n.onChange,
1665
- onKeyDown: (e) => {
1666
- e.key === "Enter" && n.onSubmit !== void 0 && (e.preventDefault(), N({ options: () => n }, "onSubmit", n.value, {
1667
- reason: "enter-key",
1668
- event: e.nativeEvent
1669
- })), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), S("escape-key", e.nativeEvent));
1670
- },
1671
- xstyle: Dt.input
1672
- })
1673
- }), /* @__PURE__ */ P(z, {
1674
- render: /* @__PURE__ */ P(t, {
1675
- type: "button",
1676
- variant: "ghost",
1677
- "data-view-find-close": !0,
1678
- "aria-label": "Close search",
1679
- title: "Close search (Esc)",
1680
- onClick: (e) => S("clear-press", e.nativeEvent)
1681
- }),
1682
- children: /* @__PURE__ */ P(L, {
1683
- size: 14,
1684
- "aria-hidden": !0
1685
- })
1686
- })]
1687
- }),
1688
- i === void 0 ? r.length > 0 ? /* @__PURE__ */ P(bt, { groups: r }) : null : /* @__PURE__ */ F(l.Root, {
1689
- open: p,
1690
- onOpenChange: ee,
1691
- children: [/* @__PURE__ */ P(l.Trigger, {
1692
- render: /* @__PURE__ */ P(z, { render: /* @__PURE__ */ P(t, {
1693
- "aria-label": "Filters",
1694
- title: "Filters"
1695
- }) }),
1696
- children: /* @__PURE__ */ P(I, {
1697
- size: 14,
1698
- "aria-hidden": !0
1699
- })
1700
- }), /* @__PURE__ */ F(l.Popup, {
1701
- align: "end",
1702
- className: "x1m258z3 xw7nakj",
1703
- children: [/* @__PURE__ */ P(l.Title, { children: "Filters" }), i(() => ee(!1))]
1704
- })]
1705
- }),
1706
- o,
1707
- s
1708
- ]
1709
- }) : void 0,
1710
- chips: w.length > 0 && /* @__PURE__ */ P("div", {
1711
- "aria-hidden": v,
1712
- inert: v,
1713
- className: "xjp7ctv",
1714
- children: /* @__PURE__ */ P(K, {
1715
- filters: w,
1716
- onRemove: (e, t) => {
1717
- b(), w.find((t) => t.id === e)?.onRemove(t);
1718
- }
1719
- })
1720
- })
1721
- };
1722
- }
1723
- // packages/collections/src/data-table.tsx
1724
- function kt({ columns: e, rows: t = 3, hideCaption: n = !0, ...r }) {
1725
- let i = typeof r.window?.height == "string" ? r.window.height : "content", a = Array.from({ length: t }, (e, t) => ({ id: String(t) })), o = e.map(({ placeholder: e, ...t }) => ({
1726
- ...t,
1727
- cell: () => e ?? /* @__PURE__ */ P(d, { width: "60%" })
1728
- }));
1729
- return /* @__PURE__ */ P("div", {
1730
- "aria-hidden": !0,
1731
- inert: !0,
1732
- ...h.props(ze[i], q.placeholder),
1733
- children: /* @__PURE__ */ P(X, {
1734
- ...r,
1735
- hideCaption: n,
1736
- isPlaceholder: !0,
1737
- rows: a,
1738
- getRowId: (e) => e.id,
1739
- columns: o,
1740
- empty: null
1741
- })
1742
- });
1743
- }
1744
- function At({ query: e, ...t }) {
1745
- switch (e.mode) {
1746
- case "local":
1747
- if (t.onEndReached !== void 0 || t.pagination !== void 0) throw Error("Local table queries require all rows. Use a controlled or frame query for a paged source.");
1748
- return /* @__PURE__ */ P(Mt, {
1749
- query: e,
1750
- table: t
1751
- });
1752
- case "controlled": return /* @__PURE__ */ P(Nt, {
1753
- table: {
1754
- ...t,
1755
- filteredEmpty: t.filteredEmpty ?? t.empty
1756
- },
1757
- ...gt(e)
1758
- });
1759
- case "frame": return /* @__PURE__ */ P(jt, { table: t });
1760
- case "static": return Z(e), /* @__PURE__ */ P(dt, { children: /* @__PURE__ */ P(X, { ...t }) });
1761
- }
1762
- }
1763
- function jt({ table: e }) {
1764
- let t = ht();
1765
- return /* @__PURE__ */ P(dt, { children: /* @__PURE__ */ P(X, {
1766
- ...e,
1767
- empty: t ? e.filteredEmpty ?? "No matching records." : e.empty
1768
- }) });
1769
- }
1770
- function Mt({ query: e, table: t }) {
1771
- let { rows: n, search: r, filters: i, isFiltered: a } = mt(t.rows, e);
1772
- return /* @__PURE__ */ P(Nt, {
1773
- table: {
1774
- ...t,
1775
- rows: n
1776
- },
1777
- search: r,
1778
- filters: i,
1779
- isFiltered: a
1780
- });
1781
- }
1782
- function Nt({ table: e, search: t, filters: n, isFiltered: r }) {
1783
- let i = Ot({
1784
- ...t !== void 0 && { search: t },
1785
- filters: n,
1786
- isReady: !0,
1787
- label: e.caption
1788
- }), a = O(null), o = {
1789
- description: `Find in ${e.caption}`,
1790
- layer: a,
1791
- when: () => {
1792
- let e = a.current;
1793
- if (e === null) return !1;
1794
- let t = e.ownerDocument.activeElement;
1795
- return t === null || t.closest("[data-native-find], textarea, select, input:not([data-view-find]), [contenteditable=\"true\"], [role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"], [role=\"listbox\"]") !== null ? !1 : t.closest("[data-table-query]") === e || t === e.ownerDocument.body && e.ownerDocument.querySelectorAll("[data-view-find-trigger]").length === 1;
1796
- }
1797
- };
1798
- return R(t === void 0 ? null : "/", i.openSearch, o), R(t === void 0 ? null : "mod+f", i.openSearch, o), /* @__PURE__ */ P(dt, { children: /* @__PURE__ */ F("div", {
1799
- ref: a,
1800
- "data-table-query": !0,
1801
- onKeyDown: i.onKeyDown,
1802
- ...h.props(ze[typeof e.window?.height == "string" ? e.window.height : "content"]),
1803
- children: [(t !== void 0 || n.length > 0) && /* @__PURE__ */ P(G, {
1804
- label: `${e.caption} controls`,
1805
- actions: i.actions,
1806
- children: i.chips
1807
- }), /* @__PURE__ */ P(X, {
1808
- ...e,
1809
- empty: r ? e.filteredEmpty ?? "No matching records." : e.empty
1810
- })]
1811
- }) });
1812
- }
1813
- // packages/collections/src/collection-scroll.tsx
1814
- function Pt(t) {
1815
- switch (t.status) {
1816
- case "loading": return /* @__PURE__ */ P(n, {
1817
- role: "status",
1818
- variant: "caption",
1819
- tone: "muted",
1820
- children: t.message ?? "Loading…"
1821
- });
1822
- case "complete": return t.message === void 0 ? null : /* @__PURE__ */ P(n, {
1823
- variant: "caption",
1824
- tone: "muted",
1825
- children: t.message
1826
- });
1827
- case "ready": return /* @__PURE__ */ P(e, {
1828
- onClick: t.onLoadMore,
1829
- children: t.message ?? "Load more"
1830
- });
1831
- case "error": return /* @__PURE__ */ F(i, {
1832
- role: "status",
1833
- children: [/* @__PURE__ */ P(n, {
1834
- variant: "caption",
1835
- tone: "muted",
1836
- children: t.message ?? "More records could not be loaded."
1837
- }), /* @__PURE__ */ P(e, {
1838
- onClick: t.onLoadMore,
1839
- children: "Retry"
1840
- })]
1841
- });
1842
- }
1843
- }
1844
- function Ft({ children: e, endContent: t, onEndReached: n, shouldFill: r = !1, endPosition: i = "end", label: a = "Collection" }) {
1845
- let o = te(), s = o.viewport, c = O(null);
1846
- it({
1847
- end: c,
1848
- viewport: r ? s : void 0,
1849
- onEndReached: n,
1850
- content: e
1851
- });
1852
- let l = /* @__PURE__ */ P("div", {
1853
- ref: c,
1854
- ...{
1855
- 0: {},
1856
- 1: { className: "x15x95ik x1az1eml xid9utz x1c8xbx5 x153jb6y xy8obcc x1hz01jw xas2l8k x2b8uid" }
1857
- }[t !== void 0 | 0],
1858
- children: t
1859
- });
1860
- return /* @__PURE__ */ F("div", {
1861
- ref: o.ref,
1862
- role: r ? "region" : void 0,
1863
- "aria-label": r ? a : void 0,
1864
- tabIndex: o.tabIndex,
1865
- ...{
1866
- 0: { className: "xeuugli" },
1867
- 1: { className: "xeuugli x98rzlu x2lwn1j x1odjw0f xy5w88m x1t137rt x13qnu6 x9v5kkp x19rmrnh x1bqaal" }
1868
- }[!!r | 0],
1869
- children: [
1870
- i === "start" && l,
1871
- e,
1872
- i === "end" && l
1873
- ]
1874
- });
1875
- }
1876
- // packages/collections/src/inspector.tsx
1877
- var It = 860, Lt = S(void 0);
1878
- function Rt({ reading: e }) {
1879
- return { value: e };
1880
- }
1881
- var zt = M({
1882
- name: "detail-field",
1883
- options: { reading: "string" },
1884
- state: Rt,
1885
- sync: Rt,
1886
- api: () => ({}),
1887
- agent: { actions: [] },
1888
- slots: (e) => ({ root: e({}) })
1889
- }), Bt = _(zt, { root: "dd" }).Root;
1890
- function Vt({ master: t, detail: n, label: r, masterLabel: i, revealKey: a, returnFocusRef: o, ...s }) {
1891
- let c = T(), l = O(null), u = O(null), d = O(null);
1892
- E(() => {
1893
- a !== void 0 && l.current !== null && d.current !== null && l.current.clientWidth <= It && (d.current.focus({ preventScroll: !0 }), d.current.scrollIntoView({
1894
- block: "start",
1895
- behavior: "instant"
1896
- }));
1897
- }, [a]);
1898
- function f() {
1899
- let e = o?.current ?? u.current;
1900
- e?.focus({ preventScroll: !0 }), e?.scrollIntoView({
1901
- block: "nearest",
1902
- behavior: "instant"
1903
- });
1904
- }
1905
- return /* @__PURE__ */ P("div", {
1906
- ...v({ className: "x9vvk8s x12h1iku xeuugli xbixft x1hz01jw xtqrqnz x1778rvt" }, s),
1907
- children: /* @__PURE__ */ F("div", {
1908
- ref: l,
1909
- className: "xrvj5dj x4ruv2j x1y7acmc x7a106z x1j825kq xeuugli",
1910
- children: [/* @__PURE__ */ P("div", {
1911
- ref: u,
1912
- role: "group",
1913
- "aria-label": i,
1914
- "aria-details": c,
1915
- tabIndex: -1,
1916
- className: "xeuugli",
1917
- children: t
1918
- }), /* @__PURE__ */ F("aside", {
1919
- ref: d,
1920
- id: c,
1921
- "aria-label": r,
1922
- tabIndex: -1,
1923
- className: "x7wzq59 x7cfggw xqfmuo8 xeuugli x1sbza1b xhuqrux xexx8yu xdz7uhd xpilrb4 xdctr63 x1t7ytsu x97x49r x972fbf x1mg79u0 x13fuv20 xhjagg4 x14ijc3v x13qnu6 x9v5kkp x19rmrnh x12ijfkc",
1924
- children: [/* @__PURE__ */ P("div", {
1925
- className: "x1s85apg x1yamub6 x1xxlxpq",
1926
- children: /* @__PURE__ */ F(e, {
1927
- variant: "ghost",
1928
- onClick: f,
1929
- children: ["Back to ", i.toLowerCase()]
1930
- })
1931
- }), /* @__PURE__ */ P(Lt.Provider, {
1932
- value: r,
1933
- children: n
1934
- })]
1935
- })]
1936
- })
1937
- });
1938
- }
1939
- function Ht({ value: e, label: t }) {
1940
- let n = typeof e == "number" ? String(e) : e;
1941
- return typeof n == "string" ? /* @__PURE__ */ P(Bt, {
1942
- "aria-label": t,
1943
- reading: n,
1944
- className: "xeuugli x1ghz6dp xbixft xj0a0fe xss6m8b",
1945
- children: n
1946
- }) : /* @__PURE__ */ P("dd", {
1947
- className: "xeuugli x1ghz6dp xbixft xj0a0fe xss6m8b",
1948
- children: e
1949
- });
1950
- }
1951
- function Ut({ items: e, ...t }) {
1952
- let n = C(Lt), r = t["aria-label"] ?? n;
1953
- return /* @__PURE__ */ P("dl", {
1954
- ...v({ className: "x1ghz6dp xrvj5dj xezdspq x1i3977y xuytk5h x1hz01jw xvmahel xtqrqnz x1778rvt" }, t),
1955
- children: e.map(({ label: e, value: t }) => /* @__PURE__ */ F("div", {
1956
- className: "xjp7ctv",
1957
- children: [/* @__PURE__ */ P("dt", {
1958
- className: "xeuugli x153jb6y xj0a0fe",
1959
- children: e
1960
- }), /* @__PURE__ */ P(Ht, {
1961
- value: t,
1962
- label: r === void 0 ? e : `${r} · ${e}`
1963
- })]
1964
- }, e))
1965
- });
1966
- }
1967
- // packages/collections/src/list-footer.tsx
1968
- function Wt({ children: e, actions: t, ...n }) {
1969
- return /* @__PURE__ */ F("div", {
1970
- ...v({ className: "x78zum5 x6s0dn4 x1qughib x1a02dak xeuugli x1n8ia3y x1qokhjc x1m92p3w x178xt8z x13fuv20 xhjagg4 x153jb6y x1hz01jw xvmahel xtqrqnz x1778rvt" }, n),
1971
- children: [/* @__PURE__ */ P("div", {
1972
- className: "xeuugli xj0a0fe",
1973
- children: e
1974
- }), t != null && /* @__PURE__ */ P("div", {
1975
- className: "x78zum5 x6s0dn4 x1a02dak x1hnptsi xeuugli",
1976
- children: t
1977
- })]
1978
- });
1979
- }
1980
- // packages/collections/src/metrics.tsx
1981
- var $ = {
1982
- grid: {
1983
- k1xSpc: "x78zum5",
1984
- kwnvtZ: "x1a02dak",
1985
- khm7nJ: "xpb3s3w",
1986
- k1C7PZ: "x1i3977y",
1987
- k7Eaqz: "xeuugli",
1988
- kogj98: "x1ghz6dp",
1989
- $$css: !0
1990
- },
1991
- columns: {
1992
- k1xSpc: "xrvj5dj",
1993
- kumcoG: "xpuu00s",
1994
- kOIVth: "x1j825kq",
1995
- k7Eaqz: "xeuugli",
1996
- kogj98: "x1ghz6dp",
1997
- $$css: !0
1998
- },
1999
- metric: {
2000
- k1xSpc: "x3nfvp2",
2001
- kGNEyG: "x1pha0wt",
2002
- kwnvtZ: "x1a02dak",
2003
- kOIVth: "xunmzkg",
2004
- k7Eaqz: "xeuugli",
2005
- kMv6JI: "x1hz01jw",
2006
- khiITx: "xvmahel",
2007
- kGuDYH: "xtqrqnz",
2008
- kLWn49: "x1778rvt",
2009
- $$css: !0
2010
- },
2011
- label: {
2012
- k7Eaqz: "xeuugli",
2013
- kMwMTN: "x153jb6y",
2014
- kayTVb: "x9ek82g",
2015
- kHjlTd: "xj0a0fe",
2016
- $$css: !0
2017
- },
2018
- value: {
2019
- k7Eaqz: "xeuugli",
2020
- kogj98: "x1ghz6dp",
2021
- kMwMTN: "xbixft",
2022
- k63SB2: "xk4h15q",
2023
- kcqcaj: "xss6m8b",
2024
- kHjlTd: "xj0a0fe",
2025
- $$css: !0
2026
- },
2027
- statistic: {
2028
- kXwgrk: "xdt5ytf",
2029
- kGNEyG: "x1cy8zhl",
2030
- $$css: !0
2031
- },
2032
- stackedLabel: {
2033
- kayTVb: "x1g77sc7",
2034
- $$css: !0
2035
- },
2036
- statisticValue: {
2037
- kGuDYH: "x71lla1",
2038
- kLWn49: "xgkpprq",
2039
- k63SB2: "x1b5ytql",
2040
- kb6lSQ: "x1wjjqco",
2041
- $$css: !0
2042
- },
2043
- headline: {
2044
- k1C7PZ: "xa2sdi0",
2045
- $$css: !0
2046
- },
2047
- headlineLabel: {
2048
- kayTVb: "x1g77sc7",
2049
- kCS8Yb: "x1l7klhg",
2050
- kGuDYH: "xy8obcc",
2051
- $$css: !0
2052
- },
2053
- headlineValue: {
2054
- kGuDYH: "xc0f4dz",
2055
- kLWn49: "xzju6ct",
2056
- k63SB2: "xtjd4bd",
2057
- kb6lSQ: "x1wjjqco",
2058
- $$css: !0
2059
- },
2060
- detail: {
2061
- k7Eaqz: "xeuugli",
2062
- kogj98: "x1ghz6dp",
2063
- kMwMTN: "x153jb6y",
2064
- kGuDYH: "xy8obcc",
2065
- kLWn49: "xas2l8k",
2066
- kAzted: "x1mqbd49",
2067
- kHjlTd: "xj0a0fe",
2068
- $$css: !0
2069
- },
2070
- inlineDetail: {
2071
- kCS8Yb: "x1l7klhg",
2072
- $$css: !0
2073
- },
2074
- change: {
2075
- k1xSpc: "x3nfvp2",
2076
- kGNEyG: "x6s0dn4",
2077
- k8WAf4: "x10dazmo",
2078
- kg3NbH: "x5g2kb4",
2079
- kaIpWk: "x1ok0vyi",
2080
- kGuDYH: "xy8obcc",
2081
- kLWn49: "xas2l8k",
2082
- k63SB2: "xk4h15q",
2083
- kb6lSQ: "x1i21sxh",
2084
- kcqcaj: "xss6m8b",
2085
- kWkggS: "x1r7kqkb",
2086
- kMwMTN: "x153jb6y",
2087
- $$css: !0
2088
- },
2089
- changePositive: {
2090
- kWkggS: "x1r8u7ye",
2091
- kMwMTN: "x7ixh4y",
2092
- $$css: !0
2093
- },
2094
- changeNegative: {
2095
- kWkggS: "xcqwzn",
2096
- kMwMTN: "xr5kp14",
2097
- $$css: !0
2098
- }
2099
- }, Gt = {
2100
- inline: {
2101
- metric: void 0,
2102
- label: void 0,
2103
- value: void 0,
2104
- detail: $.inlineDetail,
2105
- valueWidth: "5ch"
2106
- },
2107
- statistic: {
2108
- metric: $.statistic,
2109
- label: $.stackedLabel,
2110
- value: $.statisticValue,
2111
- detail: void 0,
2112
- valueWidth: "5ch"
2113
- },
2114
- headline: {
2115
- metric: $.headline,
2116
- label: $.headlineLabel,
2117
- value: $.headlineValue,
2118
- detail: void 0,
2119
- valueWidth: "9ch"
2120
- }
2121
- }, Kt = {
2122
- inline: $.grid,
2123
- columns: $.columns
2124
- };
2125
- function qt({ layout: e = "inline", ...t }) {
2126
- return /* @__PURE__ */ P("dl", { ...v(h.props(Kt[e]), t) });
2127
- }
2128
- function Jt({ label: e, value: t, detail: n, change: r, target: i, isLoading: a = !1, hasDetail: o = !1, variant: s = "inline", trend: c, ...l }) {
2129
- let u = Gt[s], f = a && o || n !== void 0, p = r?.tone === "positive" ? $.changePositive : r?.tone === "negative" ? $.changeNegative : void 0;
2130
- return /* @__PURE__ */ F("div", {
2131
- ...v(h.props($.metric, u.metric), l),
2132
- children: [
2133
- /* @__PURE__ */ P("dt", {
2134
- ...h.props($.label, u.label),
2135
- children: e
2136
- }),
2137
- /* @__PURE__ */ P("dd", {
2138
- ...h.props($.value, u.value),
2139
- children: /* @__PURE__ */ F("span", {
2140
- className: "x78zum5 x1pha0wt x1a02dak x1hnptsi xeuugli",
2141
- children: [/* @__PURE__ */ P("span", { children: a ? /* @__PURE__ */ P(d, { width: u.valueWidth }) : t ?? "—" }), !a && r !== void 0 && /* @__PURE__ */ P("span", {
2142
- ...h.props($.change, p),
2143
- children: r.value
2144
- })]
2145
- })
2146
- }),
2147
- f && /* @__PURE__ */ P("dd", {
2148
- ...h.props($.detail, u.detail),
2149
- children: a ? /* @__PURE__ */ P(d, { width: "24ch" }) : n
2150
- }),
2151
- !a && i !== void 0 && /* @__PURE__ */ P("dd", {
2152
- className: "x1ghz6dp xeuugli xy8obcc xas2l8k x153jb6y xss6m8b",
2153
- children: i
2154
- }),
2155
- c !== void 0 && /* @__PURE__ */ P("dd", {
2156
- className: "x1ghz6dp xeuugli xh8yej3 xkh2ocl",
2157
- children: c
2158
- })
2159
- ]
2160
- });
2161
- }
2162
- // packages/collections/src/timestamp.tsx
2163
- function Yt({ dateTime: e, label: t, title: n }) {
2164
- return n === void 0 ? /* @__PURE__ */ P("time", {
2165
- dateTime: e,
2166
- className: "x1hz01jw xy8obcc xas2l8k x153jb6y xss6m8b xj0a0fe x13qnu6 x9v5kkp x19rmrnh x7s97pk",
2167
- children: t
2168
- }) : /* @__PURE__ */ F(u.Root, { children: [/* @__PURE__ */ P(u.Trigger, {
2169
- render: /* @__PURE__ */ P("time", {
2170
- dateTime: e,
2171
- tabIndex: 0,
2172
- "aria-label": n,
2173
- className: "x1hz01jw xy8obcc xas2l8k x153jb6y xss6m8b xj0a0fe x13qnu6 x9v5kkp x19rmrnh x7s97pk"
2174
- }),
2175
- children: t
2176
- }), /* @__PURE__ */ P(u.Popup, { children: n })] });
2177
- }
2178
- // packages/collections/src/timeline.tsx
2179
- function Xt({ label: e, children: t }) {
2180
- return /* @__PURE__ */ P(Se, {
2181
- "aria-label": e,
2182
- render: /* @__PURE__ */ P("ol", {}),
2183
- className: "xe8uvvx x1ghz6dp x1717udv xeuugli",
2184
- children: t
2185
- });
2186
- }
2187
- function Zt({ icon: e, title: t, time: n, metadata: r, children: i, details: a, defaultOpen: s = !1 }) {
2188
- let [c, l] = k(s), u = /* @__PURE__ */ F("div", {
2189
- className: "x78zum5 x1pha0wt x1hnptsi x1a02dak xeuugli",
2190
- children: [/* @__PURE__ */ P(Ee, {
2191
- className: "xeuugli xk4h15q xj0a0fe",
2192
- children: a === void 0 ? t : /* @__PURE__ */ P(o.Trigger, {
2193
- className: "x14atkfc x16exltd x17oiadl xt970qd xlqzeqv",
2194
- children: t
2195
- })
2196
- }), n != null && /* @__PURE__ */ P(V, {
2197
- render: /* @__PURE__ */ P("div", {}),
2198
- className: "xeuugli x153jb6y xy8obcc xas2l8k xss6m8b xj0a0fe",
2199
- children: n
2200
- })]
2201
- }), d = /* @__PURE__ */ F(ce, { children: [
2202
- u,
2203
- i != null && (!c || a === void 0) && /* @__PURE__ */ P(Ce, {
2204
- className: "xeuugli x1ewvobj xj0a0fe",
2205
- children: i
2206
- }),
2207
- r != null && /* @__PURE__ */ P("div", {
2208
- className: "xeuugli x153jb6y xy8obcc xas2l8k xj0a0fe",
2209
- children: r
2210
- }),
2211
- a !== void 0 && /* @__PURE__ */ P(o.Panel, { children: a })
2212
- ] });
2213
- return /* @__PURE__ */ F(we, {
2214
- render: /* @__PURE__ */ P("li", {}),
2215
- className: "x1n2onr6 xrvj5dj x1eqwfih x1y1mm1b xhlx3wy xeuugli x1hz01jw xvmahel xtqrqnz x1778rvt xbixft x1cpjm7i x1hmns74 x1lk18uv x1gi6gvw x1jw5pjq x1vgi0k x1mi36wk x1wse844 xup0pd7 x1t137rt x13qnu6 x9v5kkp x19rmrnh x7s97pk",
2216
- children: [/* @__PURE__ */ P(Te, {
2217
- render: /* @__PURE__ */ P("span", {}),
2218
- className: "x78zum5 x6s0dn4 xl56j7k x1b1e0sl x153jb6y",
2219
- children: e
2220
- }), a === void 0 ? /* @__PURE__ */ P("div", {
2221
- className: "xrvj5dj x1hnptsi xeuugli",
2222
- children: d
2223
- }) : /* @__PURE__ */ P(o.Root, {
2224
- open: c,
2225
- onOpenChange: l,
2226
- className: "xrvj5dj x1hnptsi xeuugli xh8yej3",
2227
- children: d
2228
- })]
2229
- });
2230
- }
2231
- var Qt = {
2232
- Root: Xt,
2233
- Item: Zt
2234
- };
2235
- export { Pe as _, Wt as a, Oe as b, Pt as c, kt as d, Ot as f, Ne as g, mt as h, qt as i, Ft as l, dt as m, Yt as n, Ut as o, bt as p, Jt as r, Vt as s, Qt as t, At as u, ke as v, K as x, G as y };