@canonical/maas-react-components 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@canonical/maas-react-components.es.js +2 -678
- package/dist/components/DynamicTable/DynamicTable.d.ts +3 -3
- package/dist/components/DynamicTable/DynamicTable.stories.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.stories.d.ts +1 -1
- package/dist/components/GenericTable/GenericTable.stories.d.ts +1 -1
- package/dist/components/GenericTable/components/PaginationBar/ControlsBar/ControlsBar.d.ts +2 -2
- package/dist/components/GenericTable/components/TableCheckbox/TableCheckbox.d.ts +2 -2
- package/dist/components/GenericTable/utils/renderDataRows.d.ts +1 -1
- package/dist/components/GenericTable/utils/renderLoadingRows.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +1 -1
- package/dist/components/NestedFormGroup/NestedFormGroup.d.ts +1 -1
- package/dist/components/NestedFormGroup/NestedFormGroup.stories.d.ts +2 -2
- package/dist/components/Pagination/Pagination.stories.d.ts +3 -3
- package/dist/components/QueryInput/QueryInput.stories.d.ts +1 -1
- package/dist/components/Stepper/Stepper.stories.d.ts +1 -1
- package/dist/components/TableCaption/TableCaption.d.ts +3 -3
- package/dist/components/TableCaption/TableCaption.stories.d.ts +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/elements/ExternalLink/ExternalLink.d.ts +1 -1
- package/dist/elements/ExternalLink/ExternalLink.stories.d.ts +1 -1
- package/dist/elements/Meter/Meter.d.ts +2 -2
- package/dist/elements/Meter/Meter.stories.d.ts +2 -2
- package/dist/elements/Placeholder/Placeholder.stories.d.ts +1 -1
- package/dist/lib-BEVV6FLF.mjs +2018 -0
- package/dist/maas-react-components.css +2 -1
- package/dist/sections/ContentSection/ContentSection.d.ts +6 -6
- package/dist/sections/ContentSection/ContentSection.stories.d.ts +5 -5
- package/dist/sections/FormSection/FormSection.d.ts +4 -4
- package/dist/sections/FormSection/FormSection.stories.d.ts +3 -3
- package/dist/sections/InputGroup/InputGroup.d.ts +3 -3
- package/dist/sections/InputGroup/InputGroup.stories.d.ts +3 -3
- package/dist/sections/MainToolbar/MainToolbar.d.ts +4 -4
- package/dist/sections/MainToolbar/MainToolbar.stories.d.ts +2 -2
- package/dist/sections/Navigation/Banner/Banner.d.ts +1 -1
- package/dist/sections/Navigation/Banner/Banner.stories.d.ts +2 -2
- package/dist/sections/Navigation/CollapseToggle/CollapseToggle.stories.d.ts +1 -1
- package/dist/sections/Navigation/Content/Content.d.ts +1 -1
- package/dist/sections/Navigation/Content/Content.stories.d.ts +2 -2
- package/dist/sections/Navigation/Controls/Controls.d.ts +1 -1
- package/dist/sections/Navigation/Controls/Controls.stories.d.ts +2 -2
- package/dist/sections/Navigation/Drawer/Drawer.d.ts +1 -1
- package/dist/sections/Navigation/Drawer/Drawer.stories.d.ts +2 -2
- package/dist/sections/Navigation/Footer/Footer.d.ts +1 -1
- package/dist/sections/Navigation/Footer/Footer.stories.d.ts +2 -2
- package/dist/sections/Navigation/Header/Header.d.ts +1 -1
- package/dist/sections/Navigation/Header/Header.stories.d.ts +2 -2
- package/dist/sections/Navigation/Icon/Icon.d.ts +1 -1
- package/dist/sections/Navigation/Icon/Icon.stories.d.ts +1 -1
- package/dist/sections/Navigation/Item/Item.d.ts +1 -1
- package/dist/sections/Navigation/Item/Item.stories.d.ts +3 -3
- package/dist/sections/Navigation/Label/Label.d.ts +1 -1
- package/dist/sections/Navigation/Label/Label.stories.d.ts +1 -1
- package/dist/sections/Navigation/Link/Link.d.ts +2 -2
- package/dist/sections/Navigation/Link/Link.stories.d.ts +3 -3
- package/dist/sections/Navigation/List/List.d.ts +1 -1
- package/dist/sections/Navigation/List/List.stories.d.ts +2 -2
- package/dist/sections/Navigation/Logo/Logo.d.ts +2 -2
- package/dist/sections/Navigation/Logo/Logo.stories.d.ts +2 -2
- package/dist/sections/Navigation/LogoIcon/LogoIcon.stories.d.ts +2 -2
- package/dist/sections/Navigation/LogoName/LogoName.d.ts +1 -1
- package/dist/sections/Navigation/LogoName/LogoName.stories.d.ts +1 -1
- package/dist/sections/Navigation/LogoTag/LogoTag.d.ts +1 -1
- package/dist/sections/Navigation/LogoTag/LogoTag.stories.d.ts +2 -2
- package/dist/sections/Navigation/LogoText/LogoText.d.ts +1 -1
- package/dist/sections/Navigation/MenuButton/MenuButton.d.ts +1 -1
- package/dist/sections/Navigation/MenuButton/MenuButton.stories.d.ts +1 -1
- package/dist/sections/Navigation/Navigation.d.ts +19 -19
- package/dist/sections/Navigation/Navigation.stories.d.ts +3 -3
- package/dist/sections/Navigation/Text/Text.d.ts +1 -1
- package/dist/sections/SidePanel/SidePanel.stories.d.ts +1 -1
- package/dist/sections/SidePanel/index.d.ts +1 -0
- package/dist/testing/index.es.js +112 -129
- package/dist/testing/mockSidePanel.d.ts +3 -2
- package/dist/testing/spyOnMutation.d.ts +2 -1
- package/dist/types.d.ts +7 -0
- package/dist/utils/formatBytes/formatBytes.stories.d.ts +1 -1
- package/package.json +12 -15
- package/dist/QueryInput-D7uXzKgr.mjs +0 -1648
|
@@ -0,0 +1,2018 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { Children as t, Fragment as n, Suspense as r, cloneElement as i, createContext as a, lazy as o, useCallback as s, useContext as c, useEffect as l, useId as u, useLayoutEffect as d, useMemo as f, useReducer as p, useRef as m, useState as h } from "react";
|
|
3
|
+
import { AppAside as g, AppMain as _, Application as v, Button as y, CheckboxInput as b, Col as x, ICONS as S, Icon as C, Input as w, Label as T, Link as E, Row as D, SearchBox as ee, Select as O, Spinner as k, Tooltip as A, useClickOutside as te, useListener as ne, useOnEscapePressed as j } from "@canonical/react-components";
|
|
4
|
+
import M from "classnames";
|
|
5
|
+
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
6
|
+
import { useLocation as re } from "react-router";
|
|
7
|
+
import { useDropzone as ie } from "react-dropzone";
|
|
8
|
+
import { flexRender as I, getCoreRowModel as ae, getExpandedRowModel as oe, getGroupedRowModel as se, useReactTable as ce } from "@tanstack/react-table";
|
|
9
|
+
//#region src/lib/elements/Meter/Meter.tsx
|
|
10
|
+
var L = {
|
|
11
|
+
caution: "#F99B11",
|
|
12
|
+
light: "#F7F7F7",
|
|
13
|
+
linkFaded: "#D3E4ED",
|
|
14
|
+
link: "#0066CC",
|
|
15
|
+
negative: "#C7162B",
|
|
16
|
+
positiveFaded: "#B7CCB9",
|
|
17
|
+
positiveMid: "#4DAB4D",
|
|
18
|
+
positive: "#0E8420"
|
|
19
|
+
}, le = [
|
|
20
|
+
L.link,
|
|
21
|
+
L.positive,
|
|
22
|
+
L.negative,
|
|
23
|
+
L.caution
|
|
24
|
+
], ue = L.linkFaded, R = L.caution, z = L.light, B = 2, V = 1, de = (e, t) => {
|
|
25
|
+
let n = e?.current?.getBoundingClientRect()?.width || 0;
|
|
26
|
+
return n > t * B ? n / t : B;
|
|
27
|
+
}, H = {
|
|
28
|
+
bar: "meter-bar",
|
|
29
|
+
container: "meter-container",
|
|
30
|
+
filled: "meter-filled",
|
|
31
|
+
label: "meter-label",
|
|
32
|
+
meteroverflow: "meter-overflow",
|
|
33
|
+
segments: "meter-segments"
|
|
34
|
+
}, fe = ({ className: e, children: t, data: n, max: r, variant: i = "regular", size: a = "regular", ...o }) => {
|
|
35
|
+
let c = m(null), u = n?.reduce((e, t) => e + t.value, 0), d = r || u, f = n.map((e) => e.value / d * 100), [p, g] = h(0);
|
|
36
|
+
l(() => {
|
|
37
|
+
g(i === "segmented" ? de(c, d) : 0);
|
|
38
|
+
}, [d, i]);
|
|
39
|
+
let _ = s(() => {
|
|
40
|
+
g(de(c, d));
|
|
41
|
+
}, [
|
|
42
|
+
c,
|
|
43
|
+
d,
|
|
44
|
+
g
|
|
45
|
+
]);
|
|
46
|
+
return ne(window, _, "resize", !0, i === "segmented"), /* @__PURE__ */ F("div", {
|
|
47
|
+
className: M("p-meter", e, { "p-meter--small": a === "small" }),
|
|
48
|
+
"aria-label": o?.["aria-label"],
|
|
49
|
+
"data-testid": H.container,
|
|
50
|
+
ref: c,
|
|
51
|
+
children: [/* @__PURE__ */ P(pe, { children: /* @__PURE__ */ P(me, {
|
|
52
|
+
data: n,
|
|
53
|
+
datumWidths: f,
|
|
54
|
+
maximum: d,
|
|
55
|
+
overColor: R,
|
|
56
|
+
segmentWidth: p,
|
|
57
|
+
separatorColor: z
|
|
58
|
+
}) }), t]
|
|
59
|
+
});
|
|
60
|
+
}, pe = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
61
|
+
className: "p-meter__bar",
|
|
62
|
+
"data-testid": H.bar,
|
|
63
|
+
style: { backgroundColor: ue },
|
|
64
|
+
children: e
|
|
65
|
+
}), me = ({ data: e, datumWidths: t, maximum: n, segmentWidth: r }) => {
|
|
66
|
+
let i = () => e?.reduce((e, t) => e + t.value, 0) > n, a = (e, n) => ({
|
|
67
|
+
backgroundColor: e.color,
|
|
68
|
+
left: `${t?.reduce((e, t, r) => n > r ? e + t : e, 0)}%`,
|
|
69
|
+
width: `${t[n]}%`
|
|
70
|
+
});
|
|
71
|
+
return /* @__PURE__ */ F(N, { children: [i() ? /* @__PURE__ */ P("div", {
|
|
72
|
+
className: "p-meter__filled",
|
|
73
|
+
"data-testid": H.meteroverflow,
|
|
74
|
+
style: {
|
|
75
|
+
backgroundColor: R,
|
|
76
|
+
width: "100%"
|
|
77
|
+
}
|
|
78
|
+
}) : e?.map((e, t) => /* @__PURE__ */ P("div", {
|
|
79
|
+
className: "p-meter__filled",
|
|
80
|
+
"data-testid": H.filled,
|
|
81
|
+
style: a(e, t)
|
|
82
|
+
}, `meter-${t}`)), r > 0 && /* @__PURE__ */ P("div", {
|
|
83
|
+
className: "p-meter__separators",
|
|
84
|
+
"data-testid": H.segments,
|
|
85
|
+
style: { background: `repeating-linear-gradient(
|
|
86
|
+
to right,
|
|
87
|
+
transparent 0,
|
|
88
|
+
transparent ${r - V}px,
|
|
89
|
+
${z} ${r - V}px,
|
|
90
|
+
${z} ${r}px
|
|
91
|
+
)` }
|
|
92
|
+
})] });
|
|
93
|
+
};
|
|
94
|
+
fe.Label = ({ className: e, children: t }) => /* @__PURE__ */ P("div", {
|
|
95
|
+
className: M("p-meter__label", e),
|
|
96
|
+
"data-testid": H.label,
|
|
97
|
+
children: t
|
|
98
|
+
});
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/lib/elements/ExternalLink/ExternalLink.tsx
|
|
101
|
+
var he = ({ children: e, to: t, ...n }) => /* @__PURE__ */ P(E, {
|
|
102
|
+
...n,
|
|
103
|
+
href: t,
|
|
104
|
+
rel: "noreferrer noopener",
|
|
105
|
+
target: "_blank",
|
|
106
|
+
children: e
|
|
107
|
+
}), ge = ({ percentComplete: e }) => /* @__PURE__ */ F("small", {
|
|
108
|
+
className: "progress-indicator",
|
|
109
|
+
children: [
|
|
110
|
+
e,
|
|
111
|
+
"% ",
|
|
112
|
+
/* @__PURE__ */ P(k, { className: "progress-indicator__spinner" })
|
|
113
|
+
]
|
|
114
|
+
}), U = ({ className: e, width: t, height: n, isPending: r, text: i, children: a, variant: o = "text", style: s, ...c }) => {
|
|
115
|
+
if (l(() => {
|
|
116
|
+
r !== void 0 && console.warn("[Placeholder] The `isPending` prop is deprecated and will be removed in a future major version. Control skeleton visibility with conditional rendering at the call-site instead.");
|
|
117
|
+
}, [r]), l(() => {
|
|
118
|
+
i !== void 0 && console.warn("[Placeholder] The `text` prop is deprecated and will be removed in a future major version. Use the `width` prop to set the skeleton width.");
|
|
119
|
+
}, [i]), l(() => {
|
|
120
|
+
a !== void 0 && console.warn("[Placeholder] Passing `children` to Placeholder is deprecated and will be removed in a future major version. Render children outside the Placeholder and control visibility at the call-site.");
|
|
121
|
+
}, [a]), o === "text") {
|
|
122
|
+
if (!r) return /* @__PURE__ */ P(N, { children: a });
|
|
123
|
+
let o = Math.floor(Math.random() * 750), l = t ?? "fit-content";
|
|
124
|
+
return /* @__PURE__ */ P("div", {
|
|
125
|
+
"aria-label": "loading",
|
|
126
|
+
className: M("p-placeholder", e),
|
|
127
|
+
role: "progressbar",
|
|
128
|
+
style: {
|
|
129
|
+
animationDelay: `${o}ms`,
|
|
130
|
+
width: l,
|
|
131
|
+
height: n,
|
|
132
|
+
...s
|
|
133
|
+
},
|
|
134
|
+
...c,
|
|
135
|
+
children: /* @__PURE__ */ P("span", {
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
className: "p-placeholder__sizer",
|
|
138
|
+
children: i || a || "Loading"
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
let u = i && !t ? "fit-content" : t;
|
|
143
|
+
return /* @__PURE__ */ P("div", {
|
|
144
|
+
"aria-label": "loading",
|
|
145
|
+
className: M("p-placeholder", e),
|
|
146
|
+
role: "progressbar",
|
|
147
|
+
style: {
|
|
148
|
+
width: u,
|
|
149
|
+
height: n,
|
|
150
|
+
...s
|
|
151
|
+
},
|
|
152
|
+
...c
|
|
153
|
+
});
|
|
154
|
+
}, W = ({ children: e, className: t, as: n, variant: r = "wide", ...i }) => {
|
|
155
|
+
let a = n || "section", o = M("content-section", t);
|
|
156
|
+
return /* @__PURE__ */ P(a, {
|
|
157
|
+
...i,
|
|
158
|
+
className: o,
|
|
159
|
+
children: /* @__PURE__ */ P(D, { children: /* @__PURE__ */ P(x, {
|
|
160
|
+
size: r === "narrow" ? 6 : 12,
|
|
161
|
+
children: /* @__PURE__ */ P(N, { children: e })
|
|
162
|
+
}) })
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
W.Title = ({ children: e, className: t, as: n, ...r }) => /* @__PURE__ */ P(n || "h1", {
|
|
166
|
+
...r,
|
|
167
|
+
className: M("content-section__title p-heading--4", t),
|
|
168
|
+
children: e
|
|
169
|
+
}), W.Header = ({ children: e, className: t }) => /* @__PURE__ */ P("header", {
|
|
170
|
+
className: M("content-section__header", t),
|
|
171
|
+
children: e
|
|
172
|
+
}), W.Content = ({ children: e, className: t }) => /* @__PURE__ */ P("div", {
|
|
173
|
+
className: M("content-section__body", t),
|
|
174
|
+
children: e
|
|
175
|
+
}), W.Footer = ({ children: e, className: t }) => /* @__PURE__ */ P("footer", {
|
|
176
|
+
className: M("content-section__footer", t),
|
|
177
|
+
children: e
|
|
178
|
+
});
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/lib/sections/FormSection/FormSection.tsx
|
|
181
|
+
var G = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
182
|
+
className: "p-form-section",
|
|
183
|
+
children: e
|
|
184
|
+
});
|
|
185
|
+
G.Title = ({ children: e }) => /* @__PURE__ */ P("h5", {
|
|
186
|
+
className: "p-form-section__title u-no-padding--top",
|
|
187
|
+
children: e
|
|
188
|
+
}), G.Description = ({ children: e }) => /* @__PURE__ */ P("p", {
|
|
189
|
+
className: "p-form-help-text",
|
|
190
|
+
children: e
|
|
191
|
+
}), G.Content = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
192
|
+
className: "p-form-section__content",
|
|
193
|
+
children: e
|
|
194
|
+
});
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/lib/sections/InputGroup/InputGroup.tsx
|
|
197
|
+
var K = a(null), _e = ({ children: e }) => {
|
|
198
|
+
let t = u();
|
|
199
|
+
return /* @__PURE__ */ P(K.Provider, {
|
|
200
|
+
value: t,
|
|
201
|
+
children: /* @__PURE__ */ P("div", {
|
|
202
|
+
role: "group",
|
|
203
|
+
"aria-labelledby": `${t}_label`,
|
|
204
|
+
"aria-describedby": `${t}_description`,
|
|
205
|
+
className: "p-input-group",
|
|
206
|
+
children: e
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
_e.Label = ({ children: e }) => {
|
|
211
|
+
let t = c(K);
|
|
212
|
+
return /* @__PURE__ */ P("label", {
|
|
213
|
+
id: `${t}_label`,
|
|
214
|
+
children: e
|
|
215
|
+
});
|
|
216
|
+
}, _e.Description = ({ children: e }) => {
|
|
217
|
+
let t = c(K);
|
|
218
|
+
return /* @__PURE__ */ P("p", {
|
|
219
|
+
className: "p-form-help-text",
|
|
220
|
+
id: `${t}_description`,
|
|
221
|
+
children: e
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/lib/sections/Layout/components/DocumentTitle/DocumentTitle.tsx
|
|
226
|
+
var ve = ({ children: e }) => (l(() => {
|
|
227
|
+
document.title = t.toArray(e).join("");
|
|
228
|
+
}, [e]), null), ye = a(null), q = () => {
|
|
229
|
+
let e = c(ye);
|
|
230
|
+
if (!e) throw Error("useSidePanel must be used within a SidePanelProvider");
|
|
231
|
+
return e;
|
|
232
|
+
}, be = ({ children: e }) => {
|
|
233
|
+
let [t, n] = h({
|
|
234
|
+
isOpen: !1,
|
|
235
|
+
title: "",
|
|
236
|
+
size: "regular",
|
|
237
|
+
component: null,
|
|
238
|
+
props: {}
|
|
239
|
+
}), r = ({ component: e, title: t, props: r = {}, size: i = "regular" }) => {
|
|
240
|
+
n({
|
|
241
|
+
isOpen: !0,
|
|
242
|
+
title: t,
|
|
243
|
+
size: i,
|
|
244
|
+
component: e,
|
|
245
|
+
props: r || {}
|
|
246
|
+
});
|
|
247
|
+
}, i = () => {
|
|
248
|
+
n({
|
|
249
|
+
isOpen: !1,
|
|
250
|
+
title: "",
|
|
251
|
+
size: "regular",
|
|
252
|
+
component: null,
|
|
253
|
+
props: {}
|
|
254
|
+
});
|
|
255
|
+
}, a = s((e) => {
|
|
256
|
+
n((t) => ({
|
|
257
|
+
...t,
|
|
258
|
+
size: e
|
|
259
|
+
}));
|
|
260
|
+
}, []);
|
|
261
|
+
return /* @__PURE__ */ P(ye.Provider, {
|
|
262
|
+
value: {
|
|
263
|
+
...t,
|
|
264
|
+
openSidePanel: r,
|
|
265
|
+
closeSidePanel: i,
|
|
266
|
+
setSidePanelSize: a
|
|
267
|
+
},
|
|
268
|
+
children: e
|
|
269
|
+
});
|
|
270
|
+
}, xe = () => {
|
|
271
|
+
let e = re(), { closeSidePanel: t } = q();
|
|
272
|
+
l(() => {
|
|
273
|
+
t();
|
|
274
|
+
}, [
|
|
275
|
+
e.pathname,
|
|
276
|
+
e.search,
|
|
277
|
+
e.hash
|
|
278
|
+
]);
|
|
279
|
+
}, Se = () => {
|
|
280
|
+
let { setSidePanelSize: e } = q();
|
|
281
|
+
l(() => () => {
|
|
282
|
+
e("regular");
|
|
283
|
+
}, []);
|
|
284
|
+
}, Ce = () => {
|
|
285
|
+
let { closeSidePanel: e } = q();
|
|
286
|
+
j(() => {
|
|
287
|
+
e();
|
|
288
|
+
});
|
|
289
|
+
}, J = () => {
|
|
290
|
+
Ce(), xe(), Se();
|
|
291
|
+
let { isOpen: e, title: t, component: n, props: r, size: i } = q();
|
|
292
|
+
return /* @__PURE__ */ P(g, {
|
|
293
|
+
"aria-label": t ?? void 0,
|
|
294
|
+
className: M({
|
|
295
|
+
"is-narrow": i === "narrow",
|
|
296
|
+
"is-large": i === "large",
|
|
297
|
+
"is-wide": i === "wide"
|
|
298
|
+
}),
|
|
299
|
+
collapsed: !e,
|
|
300
|
+
id: "aside-panel",
|
|
301
|
+
children: /* @__PURE__ */ F(W, { children: [t ? /* @__PURE__ */ P("div", {
|
|
302
|
+
className: "row section-header section-header--side-panel",
|
|
303
|
+
children: /* @__PURE__ */ P("div", {
|
|
304
|
+
className: "col-12",
|
|
305
|
+
children: /* @__PURE__ */ P("h3", {
|
|
306
|
+
className: "section-header__title u-flex--no-shrink p-heading--4",
|
|
307
|
+
children: t
|
|
308
|
+
})
|
|
309
|
+
})
|
|
310
|
+
}) : null, e && n && /* @__PURE__ */ P(n, { ...r })] })
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
J.Skeleton = ({ hasTitle: e }) => /* @__PURE__ */ F(W, {
|
|
314
|
+
"aria-hidden": "true",
|
|
315
|
+
className: "aside-skeleton",
|
|
316
|
+
children: [
|
|
317
|
+
e && /* @__PURE__ */ P(W.Title, { children: /* @__PURE__ */ P(U, {
|
|
318
|
+
height: "2rem",
|
|
319
|
+
variant: "block",
|
|
320
|
+
width: "16ch"
|
|
321
|
+
}) }),
|
|
322
|
+
/* @__PURE__ */ F(W.Content, {
|
|
323
|
+
className: "aside-skeleton__form",
|
|
324
|
+
children: [/* @__PURE__ */ F("div", {
|
|
325
|
+
className: "layout-skeleton__form-description",
|
|
326
|
+
children: [/* @__PURE__ */ P(U, {
|
|
327
|
+
height: "1.5rem",
|
|
328
|
+
variant: "block",
|
|
329
|
+
width: "100%"
|
|
330
|
+
}), /* @__PURE__ */ P(U, {
|
|
331
|
+
height: "1.5rem",
|
|
332
|
+
variant: "block",
|
|
333
|
+
width: "70%"
|
|
334
|
+
})]
|
|
335
|
+
}), Array.from({ length: 2 }).map((e, t) => /* @__PURE__ */ F("div", {
|
|
336
|
+
className: "layout-skeleton__form-field",
|
|
337
|
+
children: [/* @__PURE__ */ P(U, {
|
|
338
|
+
height: "1.5rem",
|
|
339
|
+
variant: "block",
|
|
340
|
+
width: "14ch"
|
|
341
|
+
}), /* @__PURE__ */ P(U, {
|
|
342
|
+
height: "2.5rem",
|
|
343
|
+
variant: "block",
|
|
344
|
+
width: "100%"
|
|
345
|
+
})]
|
|
346
|
+
}, `aside-skeleton-field-${t}`))]
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ F(W.Footer, {
|
|
349
|
+
className: "aside-skeleton__footer",
|
|
350
|
+
children: [/* @__PURE__ */ P(U, {
|
|
351
|
+
height: "2rem",
|
|
352
|
+
variant: "block",
|
|
353
|
+
width: "8ch"
|
|
354
|
+
}), /* @__PURE__ */ P(U, {
|
|
355
|
+
height: "2rem",
|
|
356
|
+
variant: "block",
|
|
357
|
+
width: "10ch"
|
|
358
|
+
})]
|
|
359
|
+
})
|
|
360
|
+
]
|
|
361
|
+
});
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/lib/sections/SidePanel/utils.tsx
|
|
364
|
+
var we = (e, t) => {
|
|
365
|
+
let n = o(e);
|
|
366
|
+
return (e) => /* @__PURE__ */ P(r, {
|
|
367
|
+
fallback: /* @__PURE__ */ P(W, { children: /* @__PURE__ */ P(J.Skeleton, { hasTitle: t }) }),
|
|
368
|
+
children: /* @__PURE__ */ P(n, { ...e })
|
|
369
|
+
});
|
|
370
|
+
}, Te = ({ className: e, children: t, pageTitle: n, view: i, isSecondaryNavVisible: a, navigation: o, secondaryNavigation: s, statusBar: c }) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(ve, { children: n }), /* @__PURE__ */ F(v, { children: [
|
|
371
|
+
o,
|
|
372
|
+
/* @__PURE__ */ F(_, {
|
|
373
|
+
className: e,
|
|
374
|
+
children: [
|
|
375
|
+
/* @__PURE__ */ P("h1", {
|
|
376
|
+
className: "u-visually-hidden",
|
|
377
|
+
children: n
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ P("div", {
|
|
380
|
+
className: M("l-main__nav", { "is-open": a }),
|
|
381
|
+
children: s
|
|
382
|
+
}),
|
|
383
|
+
/* @__PURE__ */ P("div", {
|
|
384
|
+
className: "l-main__content",
|
|
385
|
+
children: /* @__PURE__ */ P("div", {
|
|
386
|
+
className: "row",
|
|
387
|
+
children: /* @__PURE__ */ P("div", {
|
|
388
|
+
className: "col-12",
|
|
389
|
+
children: /* @__PURE__ */ P(r, {
|
|
390
|
+
fallback: /* @__PURE__ */ P(Ee, { view: i }),
|
|
391
|
+
children: t
|
|
392
|
+
})
|
|
393
|
+
})
|
|
394
|
+
})
|
|
395
|
+
})
|
|
396
|
+
]
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ P(J, {}),
|
|
399
|
+
c
|
|
400
|
+
] })] }), Ee = ({ view: e }) => e === "settings" ? /* @__PURE__ */ F(W, {
|
|
401
|
+
"aria-hidden": "true",
|
|
402
|
+
className: "layout-skeleton",
|
|
403
|
+
variant: "narrow",
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ P(W.Title, { children: /* @__PURE__ */ P(U, {
|
|
406
|
+
height: "2rem",
|
|
407
|
+
variant: "block",
|
|
408
|
+
width: "16ch"
|
|
409
|
+
}) }),
|
|
410
|
+
/* @__PURE__ */ P("div", {
|
|
411
|
+
className: "layout-skeleton__form",
|
|
412
|
+
children: Array.from({ length: 3 }).map((e, t) => /* @__PURE__ */ F("div", {
|
|
413
|
+
className: "layout-skeleton__form-field",
|
|
414
|
+
children: [/* @__PURE__ */ P(U, {
|
|
415
|
+
height: "1.5rem",
|
|
416
|
+
variant: "block",
|
|
417
|
+
width: "14ch"
|
|
418
|
+
}), /* @__PURE__ */ P(U, {
|
|
419
|
+
height: "2.5rem",
|
|
420
|
+
variant: "block",
|
|
421
|
+
width: "100%"
|
|
422
|
+
})]
|
|
423
|
+
}, `layout-skeleton-field-${t}`))
|
|
424
|
+
}),
|
|
425
|
+
/* @__PURE__ */ P(W.Footer, { children: /* @__PURE__ */ P(U, {
|
|
426
|
+
height: "2rem",
|
|
427
|
+
variant: "block",
|
|
428
|
+
width: "8ch"
|
|
429
|
+
}) })
|
|
430
|
+
]
|
|
431
|
+
}) : /* @__PURE__ */ F(W, {
|
|
432
|
+
"aria-hidden": "true",
|
|
433
|
+
className: "layout-skeleton",
|
|
434
|
+
children: [/* @__PURE__ */ P(W.Header, { children: /* @__PURE__ */ F("div", {
|
|
435
|
+
className: "layout-skeleton__header",
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ P(U, {
|
|
438
|
+
height: "2rem",
|
|
439
|
+
variant: "block",
|
|
440
|
+
width: "24ch"
|
|
441
|
+
}),
|
|
442
|
+
/* @__PURE__ */ P(U, {
|
|
443
|
+
height: "2rem",
|
|
444
|
+
variant: "block",
|
|
445
|
+
width: "100%"
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ P(U, {
|
|
448
|
+
height: "2rem",
|
|
449
|
+
variant: "block",
|
|
450
|
+
width: "18ch"
|
|
451
|
+
}),
|
|
452
|
+
/* @__PURE__ */ P(U, {
|
|
453
|
+
height: "2rem",
|
|
454
|
+
variant: "block",
|
|
455
|
+
width: "18ch"
|
|
456
|
+
})
|
|
457
|
+
]
|
|
458
|
+
}) }), /* @__PURE__ */ F(W.Content, { children: [/* @__PURE__ */ F("div", {
|
|
459
|
+
className: "layout-skeleton__pagination",
|
|
460
|
+
children: [/* @__PURE__ */ P(U, {
|
|
461
|
+
height: "2rem",
|
|
462
|
+
variant: "block",
|
|
463
|
+
width: "24ch"
|
|
464
|
+
}), /* @__PURE__ */ F("div", {
|
|
465
|
+
className: "layout-skeleton__pagination-controls",
|
|
466
|
+
children: [/* @__PURE__ */ P(U, {
|
|
467
|
+
height: "2rem",
|
|
468
|
+
variant: "block",
|
|
469
|
+
width: "16ch"
|
|
470
|
+
}), /* @__PURE__ */ P(U, {
|
|
471
|
+
height: "2rem",
|
|
472
|
+
variant: "block",
|
|
473
|
+
width: "16ch"
|
|
474
|
+
})]
|
|
475
|
+
})]
|
|
476
|
+
}), /* @__PURE__ */ P(jt, {
|
|
477
|
+
className: "layout-skeleton__table",
|
|
478
|
+
columns: [
|
|
479
|
+
{
|
|
480
|
+
accessorKey: "name",
|
|
481
|
+
header: () => /* @__PURE__ */ P(U, {
|
|
482
|
+
variant: "block",
|
|
483
|
+
width: "8ch"
|
|
484
|
+
}),
|
|
485
|
+
meta: { skeleton: () => /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(U, {
|
|
486
|
+
variant: "block",
|
|
487
|
+
width: "18ch"
|
|
488
|
+
}), /* @__PURE__ */ P(U, {
|
|
489
|
+
variant: "block",
|
|
490
|
+
width: "24ch"
|
|
491
|
+
})] }) }
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
accessorKey: "details",
|
|
495
|
+
header: () => /* @__PURE__ */ P(U, {
|
|
496
|
+
variant: "block",
|
|
497
|
+
width: "12ch"
|
|
498
|
+
}),
|
|
499
|
+
meta: { skeleton: () => /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(U, {
|
|
500
|
+
variant: "block",
|
|
501
|
+
width: "18ch"
|
|
502
|
+
}), /* @__PURE__ */ P(U, {
|
|
503
|
+
variant: "block",
|
|
504
|
+
width: "14ch"
|
|
505
|
+
})] }) }
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
accessorKey: "status",
|
|
509
|
+
header: () => /* @__PURE__ */ P(U, {
|
|
510
|
+
variant: "block",
|
|
511
|
+
width: "10ch"
|
|
512
|
+
}),
|
|
513
|
+
meta: { skeleton: () => /* @__PURE__ */ P(U, {
|
|
514
|
+
variant: "block",
|
|
515
|
+
width: "12ch"
|
|
516
|
+
}) }
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
accessorKey: "updated",
|
|
520
|
+
header: () => /* @__PURE__ */ P(U, {
|
|
521
|
+
variant: "block",
|
|
522
|
+
width: "16ch"
|
|
523
|
+
}),
|
|
524
|
+
meta: { skeleton: () => /* @__PURE__ */ P(U, {
|
|
525
|
+
variant: "block",
|
|
526
|
+
width: "10ch"
|
|
527
|
+
}) }
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
accessorKey: "actions",
|
|
531
|
+
header: () => /* @__PURE__ */ P(U, {
|
|
532
|
+
variant: "block",
|
|
533
|
+
width: "10ch"
|
|
534
|
+
}),
|
|
535
|
+
meta: { skeleton: () => /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P(U, {
|
|
536
|
+
variant: "block",
|
|
537
|
+
width: "2ch"
|
|
538
|
+
}), /* @__PURE__ */ P(U, {
|
|
539
|
+
variant: "block",
|
|
540
|
+
width: "2ch"
|
|
541
|
+
})] }) }
|
|
542
|
+
}
|
|
543
|
+
],
|
|
544
|
+
data: [],
|
|
545
|
+
isLoading: !0,
|
|
546
|
+
loadingVariant: "skeleton"
|
|
547
|
+
})] })]
|
|
548
|
+
});
|
|
549
|
+
Te.Skeleton = Ee;
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region src/lib/sections/MainToolbar/MainToolbar.tsx
|
|
552
|
+
function De(t) {
|
|
553
|
+
let [n, r] = e.useState(null), i = e.useRef(null), a = e.useCallback(() => {
|
|
554
|
+
if (t.current) {
|
|
555
|
+
let e = t.current.getBoundingClientRect();
|
|
556
|
+
r(e);
|
|
557
|
+
}
|
|
558
|
+
}, [t]);
|
|
559
|
+
return e.useEffect(() => {
|
|
560
|
+
let e = new ResizeObserver(() => {
|
|
561
|
+
i.current && cancelAnimationFrame(i.current), i.current = requestAnimationFrame(a);
|
|
562
|
+
});
|
|
563
|
+
return t.current && e.observe(t.current), () => {
|
|
564
|
+
i.current && cancelAnimationFrame(i.current), e.disconnect();
|
|
565
|
+
};
|
|
566
|
+
}, [t, a]), n;
|
|
567
|
+
}
|
|
568
|
+
var Oe = e.createContext(null), ke = e.createContext([!1, () => {}]), Ae = ({ children: t }) => {
|
|
569
|
+
let n = e.useRef(null), r = De(n), [i, a] = e.useState(!1);
|
|
570
|
+
return /* @__PURE__ */ P("header", {
|
|
571
|
+
className: M("main-toolbar", { "main-toolbar--stacked": i }),
|
|
572
|
+
ref: n,
|
|
573
|
+
children: /* @__PURE__ */ P(Oe.Provider, {
|
|
574
|
+
value: r,
|
|
575
|
+
children: /* @__PURE__ */ P(ke.Provider, {
|
|
576
|
+
value: [i, a],
|
|
577
|
+
children: t
|
|
578
|
+
})
|
|
579
|
+
})
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
Ae.Title = ({ as: e, children: t, className: n, ...r }) => /* @__PURE__ */ P(e || "h1", {
|
|
583
|
+
className: M("main-toolbar__title p-heading--4", n),
|
|
584
|
+
"data-testid": "main-toolbar-heading",
|
|
585
|
+
...r,
|
|
586
|
+
children: t
|
|
587
|
+
}), Ae.Controls = ({ children: t }) => {
|
|
588
|
+
let n = e.useContext(Oe), [r, i] = e.useContext(ke), a = e.useRef(null);
|
|
589
|
+
return e.useEffect(() => {
|
|
590
|
+
!a.current || !n || i(a.current.getBoundingClientRect().width > n.width);
|
|
591
|
+
}, [
|
|
592
|
+
i,
|
|
593
|
+
n,
|
|
594
|
+
a
|
|
595
|
+
]), /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("div", {
|
|
596
|
+
"aria-hidden": "true",
|
|
597
|
+
className: "main-toolbar__controls main-toolbar__controls--observer",
|
|
598
|
+
ref: a,
|
|
599
|
+
style: {
|
|
600
|
+
visibility: "hidden",
|
|
601
|
+
position: "absolute"
|
|
602
|
+
},
|
|
603
|
+
children: t
|
|
604
|
+
}), /* @__PURE__ */ P("div", {
|
|
605
|
+
className: M("main-toolbar__controls", { "main-toolbar__controls--stacked": r }),
|
|
606
|
+
children: t
|
|
607
|
+
})] });
|
|
608
|
+
};
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/lib/sections/Navigation/Banner/Banner.tsx
|
|
611
|
+
var je = ({ children: e }) => /* @__PURE__ */ P(N, { children: e }), Me = ({ isCollapsed: e, setIsCollapsed: t, className: n }) => /* @__PURE__ */ P(A, {
|
|
612
|
+
className: "p-side-navigation__tooltip-wrapper",
|
|
613
|
+
message: /* @__PURE__ */ F(N, { children: [
|
|
614
|
+
e ? "expand" : "collapse",
|
|
615
|
+
"( ",
|
|
616
|
+
/* @__PURE__ */ P("code", { children: "[" }),
|
|
617
|
+
" )"
|
|
618
|
+
] }),
|
|
619
|
+
position: "right",
|
|
620
|
+
tooltipClassName: "p-side-navigation__tooltip",
|
|
621
|
+
children: /* @__PURE__ */ P(y, {
|
|
622
|
+
appearance: "base",
|
|
623
|
+
"aria-label": `${e ? "expand" : "collapse"} main navigation`,
|
|
624
|
+
className: M("is-dense has-icon is-dark u-no-margin l-navigation-collapse-toggle", n),
|
|
625
|
+
onClick: (n) => {
|
|
626
|
+
t(!e), n.stopPropagation(), n.currentTarget.blur();
|
|
627
|
+
},
|
|
628
|
+
children: /* @__PURE__ */ P(C, {
|
|
629
|
+
light: !0,
|
|
630
|
+
name: "sidebar-toggle"
|
|
631
|
+
})
|
|
632
|
+
})
|
|
633
|
+
}), Ne = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
634
|
+
className: "p-panel__content",
|
|
635
|
+
children: /* @__PURE__ */ P("nav", {
|
|
636
|
+
className: "p-side-navigation--icons is-dark",
|
|
637
|
+
children: e
|
|
638
|
+
})
|
|
639
|
+
}), Pe = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
640
|
+
className: "p-panel__controls u-no-margin--top",
|
|
641
|
+
children: e
|
|
642
|
+
}), Fe = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
643
|
+
className: "l-navigation__drawer",
|
|
644
|
+
children: /* @__PURE__ */ P("div", {
|
|
645
|
+
className: "p-panel is-dark",
|
|
646
|
+
children: e
|
|
647
|
+
})
|
|
648
|
+
}), Ie = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
649
|
+
className: "p-panel__footer",
|
|
650
|
+
children: e
|
|
651
|
+
}), Le = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
652
|
+
className: "p-panel__header",
|
|
653
|
+
children: e
|
|
654
|
+
}), Re = ({ light: e = !0, name: t }) => /* @__PURE__ */ P(C, {
|
|
655
|
+
className: "p-side-navigation__icon",
|
|
656
|
+
light: e,
|
|
657
|
+
name: t
|
|
658
|
+
}), ze = ({ children: e, className: t, hasActiveChild: n }) => /* @__PURE__ */ P("li", {
|
|
659
|
+
className: M("p-side-navigation__item", t, { "has-active-child": n }),
|
|
660
|
+
children: e
|
|
661
|
+
}), Be = ({ children: e, id: t, variant: n = "base" }) => /* @__PURE__ */ P("span", {
|
|
662
|
+
className: M("p-side-navigation__label", { "p-side-navigation__label--group": n === "group" }),
|
|
663
|
+
id: t,
|
|
664
|
+
children: e
|
|
665
|
+
}), Ve = ({ as: e, ...t }) => /* @__PURE__ */ P(e || "a", {
|
|
666
|
+
className: M("p-side-navigation__link", t.className),
|
|
667
|
+
...t
|
|
668
|
+
}), He = ({ children: e, className: t }) => /* @__PURE__ */ P("ul", {
|
|
669
|
+
className: M("p-side-navigation__list", t),
|
|
670
|
+
children: e
|
|
671
|
+
}), Ue = ({ as: e, children: t, className: n, ...r }) => /* @__PURE__ */ P(e || "a", {
|
|
672
|
+
className: M("p-panel__logo", n),
|
|
673
|
+
...r,
|
|
674
|
+
children: /* @__PURE__ */ P("div", {
|
|
675
|
+
className: "p-navigation__tagged-logo",
|
|
676
|
+
children: t
|
|
677
|
+
})
|
|
678
|
+
}), We = ({ children: e }) => i(e, { className: "p-panel__logo-icon p-navigation__logo-icon" }), Ge = ({ children: e, variant: t = "base" }) => /* @__PURE__ */ P("div", {
|
|
679
|
+
className: M("p-panel__logo-name is-fading-when-collapsed", { "p-panel__logo-name--small": t === "small" }),
|
|
680
|
+
children: e
|
|
681
|
+
}), Ke = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
682
|
+
className: "p-navigation__logo-tag",
|
|
683
|
+
children: e
|
|
684
|
+
}), qe = ({ children: e }) => /* @__PURE__ */ P("span", {
|
|
685
|
+
className: "p-panel__logo-text",
|
|
686
|
+
children: e
|
|
687
|
+
}), Je = ({ children: e, className: t, onClick: n }) => /* @__PURE__ */ P(y, {
|
|
688
|
+
appearance: "base",
|
|
689
|
+
className: M("p-side-navigation__button--menu has-icon is-dark", t),
|
|
690
|
+
onClick: (e) => {
|
|
691
|
+
n && n(e), e.stopPropagation(), e.currentTarget.blur();
|
|
692
|
+
},
|
|
693
|
+
children: /* @__PURE__ */ P(N, { children: e })
|
|
694
|
+
}), Ye = ({ children: e }) => /* @__PURE__ */ P("span", {
|
|
695
|
+
className: "p-side-navigation__text",
|
|
696
|
+
children: e
|
|
697
|
+
}), Y = ({ children: e, className: t, isCollapsed: n }) => /* @__PURE__ */ P("header", {
|
|
698
|
+
"aria-label": "main navigation",
|
|
699
|
+
className: M("l-navigation is-maas", t, {
|
|
700
|
+
"is-collapsed": n,
|
|
701
|
+
"is-pinned": !n
|
|
702
|
+
}),
|
|
703
|
+
children: e
|
|
704
|
+
}), Xe = ({ children: e, className: t }) => /* @__PURE__ */ P("header", {
|
|
705
|
+
"aria-label": "navigation",
|
|
706
|
+
className: "l-navigation-bar",
|
|
707
|
+
children: /* @__PURE__ */ P("div", {
|
|
708
|
+
className: M("p-panel is-dark", t),
|
|
709
|
+
children: e
|
|
710
|
+
})
|
|
711
|
+
});
|
|
712
|
+
Y.Header = Le, Y.Banner = je, Y.Drawer = Fe, Y.Controls = Pe, Y.CollapseToggle = Me, Y.Content = Ne, Y.Footer = Ie, Y.List = He, Y.Item = ze, Y.Link = Ve, Y.Text = Ye, Y.Icon = Re, Y.Label = Be, Y.Logo = Ue, Y.LogoTag = Ke, Y.LogoIcon = We, Y.LogoName = Ge, Y.LogoText = qe, Xe.MenuButton = Je;
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/lib/components/FadeInDown/FadeInDown.tsx
|
|
715
|
+
var Ze = ({ children: e, className: t, isVisible: n }) => /* @__PURE__ */ P("div", {
|
|
716
|
+
className: M("fade-in--down", t),
|
|
717
|
+
"aria-hidden": n ? "false" : "true",
|
|
718
|
+
style: { visibility: n ? "visible" : "hidden" },
|
|
719
|
+
children: e
|
|
720
|
+
}), Qe = ({ children: e, ...t }) => /* @__PURE__ */ P(Ze, {
|
|
721
|
+
isVisible: !t["aria-hidden"],
|
|
722
|
+
children: /* @__PURE__ */ P("div", {
|
|
723
|
+
className: "p-form__nested-group",
|
|
724
|
+
...t,
|
|
725
|
+
children: e
|
|
726
|
+
})
|
|
727
|
+
}), $e = ({ className: e, currentPage: t, error: n, disabled: r, onInputBlur: i, onInputChange: a, onNextClick: o, onPreviousClick: s, totalPages: c, ...l }) => /* @__PURE__ */ P("nav", {
|
|
728
|
+
"aria-label": l?.["aria-label"] || "pagination",
|
|
729
|
+
className: M("p-pagination", e),
|
|
730
|
+
children: /* @__PURE__ */ F("span", {
|
|
731
|
+
className: "p-pagination--items",
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ P(y, {
|
|
734
|
+
"aria-label": "Previous page",
|
|
735
|
+
className: "p-pagination__link--previous",
|
|
736
|
+
disabled: t === 1 || r,
|
|
737
|
+
onClick: s,
|
|
738
|
+
type: "button",
|
|
739
|
+
children: /* @__PURE__ */ P(C, { name: "chevron-left" })
|
|
740
|
+
}),
|
|
741
|
+
/* @__PURE__ */ P("strong", { children: "Page " }),
|
|
742
|
+
" ",
|
|
743
|
+
/* @__PURE__ */ P(w, {
|
|
744
|
+
"aria-label": "page number",
|
|
745
|
+
className: "p-pagination__input",
|
|
746
|
+
disabled: r,
|
|
747
|
+
error: n,
|
|
748
|
+
max: c,
|
|
749
|
+
min: 1,
|
|
750
|
+
onBlur: i,
|
|
751
|
+
onChange: a,
|
|
752
|
+
required: !0,
|
|
753
|
+
type: "number",
|
|
754
|
+
value: t
|
|
755
|
+
}),
|
|
756
|
+
" ",
|
|
757
|
+
/* @__PURE__ */ F("strong", {
|
|
758
|
+
className: "u-no-wrap",
|
|
759
|
+
children: [" of ", c]
|
|
760
|
+
}),
|
|
761
|
+
/* @__PURE__ */ P(y, {
|
|
762
|
+
"aria-label": "Next page",
|
|
763
|
+
className: "p-pagination__link--next",
|
|
764
|
+
disabled: t === c || r,
|
|
765
|
+
onClick: o,
|
|
766
|
+
type: "button",
|
|
767
|
+
children: /* @__PURE__ */ P(C, { name: "chevron-right" })
|
|
768
|
+
})
|
|
769
|
+
]
|
|
770
|
+
})
|
|
771
|
+
}), et = ({ currentPage: e, disabled: t, paginate: n, totalPages: r }) => {
|
|
772
|
+
let [i, a] = h(e), [o, s] = h("");
|
|
773
|
+
return /* @__PURE__ */ P($e, {
|
|
774
|
+
currentPage: i,
|
|
775
|
+
error: o,
|
|
776
|
+
disabled: t,
|
|
777
|
+
onInputBlur: () => {
|
|
778
|
+
a(e), s("");
|
|
779
|
+
},
|
|
780
|
+
onInputChange: (e) => {
|
|
781
|
+
let { value: t, valueAsNumber: i } = e.target;
|
|
782
|
+
t ? (a(i), i > r || i < 1 ? s(`${i} is not a valid page number.`) : (s(""), n(i))) : s("Enter a page number.");
|
|
783
|
+
},
|
|
784
|
+
onNextClick: () => {
|
|
785
|
+
a((e) => Number(e) + 1), n(Number(e) + 1);
|
|
786
|
+
},
|
|
787
|
+
onPreviousClick: () => {
|
|
788
|
+
a((e) => Number(e) - 1), n(Number(e) - 1);
|
|
789
|
+
},
|
|
790
|
+
totalPages: r
|
|
791
|
+
});
|
|
792
|
+
}, tt = ({ activeStep: e, items: t }) => /* @__PURE__ */ P("ol", {
|
|
793
|
+
className: "stepper",
|
|
794
|
+
children: t.map((t, n) => {
|
|
795
|
+
let r = n === e, i = n < e;
|
|
796
|
+
return /* @__PURE__ */ P("li", {
|
|
797
|
+
"aria-label": t,
|
|
798
|
+
className: "stepper__item",
|
|
799
|
+
children: /* @__PURE__ */ P("p", {
|
|
800
|
+
"aria-label": i ? `${t} (completed)` : t,
|
|
801
|
+
className: M("stepper__title", {
|
|
802
|
+
"stepper__title--is-active": r,
|
|
803
|
+
"stepper__title--is-complete": i
|
|
804
|
+
}),
|
|
805
|
+
children: t
|
|
806
|
+
})
|
|
807
|
+
}, n);
|
|
808
|
+
})
|
|
809
|
+
}), nt = () => {
|
|
810
|
+
let [{ acceptedFiles: e, fileRejections: t }, n] = p((e, t) => {
|
|
811
|
+
switch (t.type) {
|
|
812
|
+
case "add-files": return {
|
|
813
|
+
acceptedFiles: [...e.acceptedFiles, ...t.payload.acceptedFiles],
|
|
814
|
+
fileRejections: [...e.fileRejections, ...t.payload.fileRejections]
|
|
815
|
+
};
|
|
816
|
+
case "remove-accepted": return {
|
|
817
|
+
...e,
|
|
818
|
+
acceptedFiles: e.acceptedFiles.filter((e) => e !== t.payload)
|
|
819
|
+
};
|
|
820
|
+
case "remove-rejected": return {
|
|
821
|
+
...e,
|
|
822
|
+
fileRejections: e.fileRejections.filter((e) => e !== t.payload)
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
}, {
|
|
826
|
+
acceptedFiles: [],
|
|
827
|
+
fileRejections: []
|
|
828
|
+
});
|
|
829
|
+
return {
|
|
830
|
+
acceptedFiles: e,
|
|
831
|
+
fileRejections: t,
|
|
832
|
+
onFileUpload: s((e, t) => n({
|
|
833
|
+
type: "add-files",
|
|
834
|
+
payload: {
|
|
835
|
+
acceptedFiles: e,
|
|
836
|
+
fileRejections: t
|
|
837
|
+
}
|
|
838
|
+
}), [n]),
|
|
839
|
+
removeFile: (e) => n({
|
|
840
|
+
type: "remove-accepted",
|
|
841
|
+
payload: e
|
|
842
|
+
}),
|
|
843
|
+
removeRejectedFile: (e) => n({
|
|
844
|
+
type: "remove-rejected",
|
|
845
|
+
payload: e
|
|
846
|
+
})
|
|
847
|
+
};
|
|
848
|
+
}, rt = ({ accept: e, error: t, files: n, help: r, label: i, maxFiles: a, maxSize: o, minSize: s, onFileUpload: c, onRemoveFile: l, rejectedFiles: d }) => {
|
|
849
|
+
let f = nt(), p = n ?? f.acceptedFiles, m = d ?? f.fileRejections, h = c ?? f.onFileUpload, g = (e) => {
|
|
850
|
+
l ? l(e) : "file" in e && "errors" in e ? f.removeRejectedFile(e) : f.removeFile(e);
|
|
851
|
+
}, { getRootProps: _, getInputProps: v } = ie({
|
|
852
|
+
accept: e,
|
|
853
|
+
maxFiles: a,
|
|
854
|
+
maxSize: o,
|
|
855
|
+
minSize: s,
|
|
856
|
+
onDrop: h
|
|
857
|
+
}), b = u();
|
|
858
|
+
return /* @__PURE__ */ F("div", {
|
|
859
|
+
className: M("p-form__group p-form-validation", { "is-error": !!t }),
|
|
860
|
+
children: [
|
|
861
|
+
i && /* @__PURE__ */ P(T, {
|
|
862
|
+
id: b,
|
|
863
|
+
children: i
|
|
864
|
+
}),
|
|
865
|
+
r && /* @__PURE__ */ P("p", {
|
|
866
|
+
className: "p-form-help-text",
|
|
867
|
+
children: r
|
|
868
|
+
}),
|
|
869
|
+
/* @__PURE__ */ F("div", {
|
|
870
|
+
className: "p-form__control",
|
|
871
|
+
children: [
|
|
872
|
+
!a || p.length + m.length < a ? /* @__PURE__ */ P("div", {
|
|
873
|
+
className: "file-upload__wrapper",
|
|
874
|
+
children: /* @__PURE__ */ F("div", {
|
|
875
|
+
..._(),
|
|
876
|
+
"aria-labelledby": i ? b : void 0,
|
|
877
|
+
className: "file-upload",
|
|
878
|
+
"data-testid": "file-upload",
|
|
879
|
+
children: [/* @__PURE__ */ P("input", { ...v() }), /* @__PURE__ */ P("button", {
|
|
880
|
+
className: "file-upload__button",
|
|
881
|
+
type: "button",
|
|
882
|
+
children: "Drag and drop files here or click to upload"
|
|
883
|
+
})]
|
|
884
|
+
})
|
|
885
|
+
}) : null,
|
|
886
|
+
/* @__PURE__ */ F("div", {
|
|
887
|
+
className: "file-upload__files-list",
|
|
888
|
+
children: [m && m.map((e) => /* @__PURE__ */ P("span", {
|
|
889
|
+
className: "is-error",
|
|
890
|
+
children: /* @__PURE__ */ F("div", {
|
|
891
|
+
className: "file-upload__file is-rejected",
|
|
892
|
+
children: [e.file.name, /* @__PURE__ */ P(y, {
|
|
893
|
+
appearance: "base",
|
|
894
|
+
className: "file-upload__file-remove-button",
|
|
895
|
+
onClick: () => g(e),
|
|
896
|
+
type: "button",
|
|
897
|
+
children: /* @__PURE__ */ P(C, {
|
|
898
|
+
name: "close",
|
|
899
|
+
children: "Remove file"
|
|
900
|
+
})
|
|
901
|
+
})]
|
|
902
|
+
})
|
|
903
|
+
}, e.file.name)), p && p.map((e) => /* @__PURE__ */ F("div", {
|
|
904
|
+
className: "file-upload__file",
|
|
905
|
+
children: [e.name, e.percentUploaded === void 0 ? /* @__PURE__ */ P(y, {
|
|
906
|
+
appearance: "base",
|
|
907
|
+
className: "file-upload__file-remove-button",
|
|
908
|
+
onClick: () => g(e),
|
|
909
|
+
type: "button",
|
|
910
|
+
children: /* @__PURE__ */ P(C, {
|
|
911
|
+
name: "close",
|
|
912
|
+
children: "Remove file"
|
|
913
|
+
})
|
|
914
|
+
}) : /* @__PURE__ */ P(ge, { percentComplete: e.percentUploaded })]
|
|
915
|
+
}, e.name))]
|
|
916
|
+
}),
|
|
917
|
+
t ? /* @__PURE__ */ F("p", {
|
|
918
|
+
className: "p-form-validation__message",
|
|
919
|
+
children: [/* @__PURE__ */ P("strong", { children: "Error: " }), t]
|
|
920
|
+
}) : null
|
|
921
|
+
]
|
|
922
|
+
})
|
|
923
|
+
]
|
|
924
|
+
});
|
|
925
|
+
}, it = (e, t) => e.label.localeCompare(t.label, "en", { numeric: !0 }), at = (e) => (t, n) => {
|
|
926
|
+
if (e) {
|
|
927
|
+
let r = e.has(t.value), i = e.has(n.value);
|
|
928
|
+
if (r && !i) return -1;
|
|
929
|
+
if (!r && i) return 1;
|
|
930
|
+
}
|
|
931
|
+
return 0;
|
|
932
|
+
}, ot = (e) => {
|
|
933
|
+
let t = /* @__PURE__ */ new Map();
|
|
934
|
+
return e.forEach((e) => {
|
|
935
|
+
let n = e.group || "Ungrouped", r = t.get(n) || [];
|
|
936
|
+
r.push(e), t.set(n, r);
|
|
937
|
+
}), Array.from(t, ([e, t]) => ({
|
|
938
|
+
group: e,
|
|
939
|
+
items: t
|
|
940
|
+
}));
|
|
941
|
+
}, st = ({ items: e, selectedItems: t, disabledItems: n, header: r, updateItems: i, isOpen: a, footer: o, sortFn: s = it, groupFn: c = ot, ...u }) => {
|
|
942
|
+
let d = f(() => new Set(t.map((e) => e.value)), [t]), p = f(() => new Set(n.map((e) => e.value)), [n]), [m, g] = h(new Set(d));
|
|
943
|
+
l(() => {
|
|
944
|
+
a && g(new Set(d));
|
|
945
|
+
}, [a]);
|
|
946
|
+
let _ = f(() => e.some((e) => e.group), [e]), v = f(() => _ ? c(e) : [{
|
|
947
|
+
group: "Ungrouped",
|
|
948
|
+
items: e
|
|
949
|
+
}], [e, c]), y = (n) => {
|
|
950
|
+
let { checked: r, value: a } = n.target, o = e.find((e) => `${e.value}` === a);
|
|
951
|
+
o && i(r ? [...t, o] : t.filter((e) => `${e.value}` !== a) ?? []);
|
|
952
|
+
};
|
|
953
|
+
return /* @__PURE__ */ P(Ze, {
|
|
954
|
+
isVisible: a,
|
|
955
|
+
className: "put-above",
|
|
956
|
+
children: /* @__PURE__ */ F("div", {
|
|
957
|
+
className: "multi-select__dropdown",
|
|
958
|
+
role: "listbox",
|
|
959
|
+
...u,
|
|
960
|
+
children: [
|
|
961
|
+
r || null,
|
|
962
|
+
v.map(({ group: e, items: t }) => /* @__PURE__ */ F("div", {
|
|
963
|
+
className: "multi-select__group",
|
|
964
|
+
children: [_ ? /* @__PURE__ */ P("h5", {
|
|
965
|
+
className: "multi-select__dropdown-header",
|
|
966
|
+
children: e
|
|
967
|
+
}) : null, /* @__PURE__ */ P("ul", {
|
|
968
|
+
className: "multi-select__dropdown-list",
|
|
969
|
+
"aria-label": e,
|
|
970
|
+
children: t.sort(s).sort(at(m)).map((e) => /* @__PURE__ */ P("li", {
|
|
971
|
+
className: "multi-select__dropdown-item",
|
|
972
|
+
children: /* @__PURE__ */ P(b, {
|
|
973
|
+
disabled: p.has(e.value),
|
|
974
|
+
label: e.label,
|
|
975
|
+
checked: d.has(e.value),
|
|
976
|
+
value: e.value,
|
|
977
|
+
onChange: y
|
|
978
|
+
}, e.value)
|
|
979
|
+
}, e.value))
|
|
980
|
+
})]
|
|
981
|
+
}, e)),
|
|
982
|
+
o ? /* @__PURE__ */ P("div", {
|
|
983
|
+
className: "multi-select__footer",
|
|
984
|
+
children: o
|
|
985
|
+
}) : null
|
|
986
|
+
]
|
|
987
|
+
})
|
|
988
|
+
});
|
|
989
|
+
}, ct = ({ disabled: e, selectedItems: t = [], label: n, onItemsUpdate: r, placeholder: i, required: a = !1, items: o = [], disabledItems: s = [], dropdownHeader: c, dropdownFooter: d, variant: f = "search" }) => {
|
|
990
|
+
let p = te(() => {
|
|
991
|
+
g(!1), v("");
|
|
992
|
+
});
|
|
993
|
+
j(() => {
|
|
994
|
+
g(!1), v("");
|
|
995
|
+
});
|
|
996
|
+
let [m, g] = h(!1), [_, v] = h("");
|
|
997
|
+
l(() => {
|
|
998
|
+
m || v("");
|
|
999
|
+
}, [m]);
|
|
1000
|
+
let [b, x] = h([]), S = t || b, C = (e) => {
|
|
1001
|
+
let t = Array.from(new Set(e));
|
|
1002
|
+
x(t), r && r(t);
|
|
1003
|
+
}, w = u(), T = u(), E = S.filter((e) => o.some((t) => t.value === e.value)).sort(it).map((e) => e.label).join(", ");
|
|
1004
|
+
return /* @__PURE__ */ P("div", {
|
|
1005
|
+
ref: p,
|
|
1006
|
+
children: /* @__PURE__ */ F("div", {
|
|
1007
|
+
className: "multi-select",
|
|
1008
|
+
children: [f === "search" ? /* @__PURE__ */ P(ee, {
|
|
1009
|
+
externallyControlled: !0,
|
|
1010
|
+
"aria-controls": w,
|
|
1011
|
+
"aria-expanded": m,
|
|
1012
|
+
id: T,
|
|
1013
|
+
role: "combobox",
|
|
1014
|
+
"aria-label": n || i || "Search",
|
|
1015
|
+
disabled: e,
|
|
1016
|
+
autoComplete: "off",
|
|
1017
|
+
onChange: (e) => {
|
|
1018
|
+
v(e), g(!0);
|
|
1019
|
+
},
|
|
1020
|
+
onFocus: () => g(!0),
|
|
1021
|
+
placeholder: i ?? "Search",
|
|
1022
|
+
required: a,
|
|
1023
|
+
type: "text",
|
|
1024
|
+
value: _,
|
|
1025
|
+
className: "multi-select__input"
|
|
1026
|
+
}) : /* @__PURE__ */ P("button", {
|
|
1027
|
+
role: "combobox",
|
|
1028
|
+
type: "button",
|
|
1029
|
+
"aria-label": n || i || "Select items",
|
|
1030
|
+
"aria-controls": w,
|
|
1031
|
+
"aria-expanded": m,
|
|
1032
|
+
className: "multi-select__select-button",
|
|
1033
|
+
onClick: () => {
|
|
1034
|
+
g((e) => !e);
|
|
1035
|
+
},
|
|
1036
|
+
children: /* @__PURE__ */ P("span", {
|
|
1037
|
+
className: "multi-select__condensed-text",
|
|
1038
|
+
children: S.length > 0 ? E : i ?? "Select items"
|
|
1039
|
+
})
|
|
1040
|
+
}), /* @__PURE__ */ P(st, {
|
|
1041
|
+
id: w,
|
|
1042
|
+
isOpen: m,
|
|
1043
|
+
items: _.length > 0 ? o.filter((e) => e.label.toLowerCase().includes(_.toLowerCase())) : o,
|
|
1044
|
+
selectedItems: S,
|
|
1045
|
+
disabledItems: s,
|
|
1046
|
+
header: c,
|
|
1047
|
+
updateItems: C,
|
|
1048
|
+
footer: d || /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(y, {
|
|
1049
|
+
appearance: "link",
|
|
1050
|
+
onClick: () => {
|
|
1051
|
+
let e = o.filter((e) => !s.some((t) => t.value === e.value));
|
|
1052
|
+
C([...S, ...e]);
|
|
1053
|
+
},
|
|
1054
|
+
type: "button",
|
|
1055
|
+
children: "Select all"
|
|
1056
|
+
}), /* @__PURE__ */ P(y, {
|
|
1057
|
+
appearance: "link",
|
|
1058
|
+
onClick: () => {
|
|
1059
|
+
let e = S.filter((e) => s.some((t) => t.value === e.value));
|
|
1060
|
+
C(e);
|
|
1061
|
+
},
|
|
1062
|
+
type: "button",
|
|
1063
|
+
children: "Clear"
|
|
1064
|
+
})] })
|
|
1065
|
+
})]
|
|
1066
|
+
})
|
|
1067
|
+
});
|
|
1068
|
+
}, lt = {
|
|
1069
|
+
xSmall: 460,
|
|
1070
|
+
small: 620,
|
|
1071
|
+
large: 1036,
|
|
1072
|
+
xLarge: 1681
|
|
1073
|
+
}, ut = a({ variant: "regular" }), dt = ({ className: e, children: t, variant: n, ...r }) => /* @__PURE__ */ P(ut.Provider, {
|
|
1074
|
+
value: { variant: n },
|
|
1075
|
+
children: /* @__PURE__ */ P("table", {
|
|
1076
|
+
...r,
|
|
1077
|
+
className: M("p-table-dynamic", e, { "is-full-height": n === "full-height" }),
|
|
1078
|
+
children: t
|
|
1079
|
+
})
|
|
1080
|
+
}), ft = ({ columns: e }) => /* @__PURE__ */ P(N, { children: Array.from({ length: 10 }, (t, n) => /* @__PURE__ */ P("tr", {
|
|
1081
|
+
"aria-hidden": "true",
|
|
1082
|
+
children: e.map((e, t) => /* @__PURE__ */ P("td", {
|
|
1083
|
+
className: M(e.id, "u-text-overflow-clip"),
|
|
1084
|
+
children: /* @__PURE__ */ P(U, {
|
|
1085
|
+
isPending: !0,
|
|
1086
|
+
text: "XXXxxxx.xxxxxxxxx"
|
|
1087
|
+
})
|
|
1088
|
+
}, t))
|
|
1089
|
+
}, n)) }), pt = ({ className: e, table: t }) => {
|
|
1090
|
+
let n = t ? t.getAllColumns() : Array.from({ length: 10 }).fill({ id: "" });
|
|
1091
|
+
return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("caption", {
|
|
1092
|
+
className: "u-visually-hidden",
|
|
1093
|
+
children: "Loading..."
|
|
1094
|
+
}), /* @__PURE__ */ P(mt, {
|
|
1095
|
+
"aria-busy": "true",
|
|
1096
|
+
className: e,
|
|
1097
|
+
children: /* @__PURE__ */ P(ft, { columns: n })
|
|
1098
|
+
})] });
|
|
1099
|
+
}, mt = ({ className: e, children: t, style: n, ...r }) => {
|
|
1100
|
+
let { variant: i } = c(ut), a = m(null), [o, u] = h(null), p = s(() => {
|
|
1101
|
+
if (window.innerWidth > lt.small) {
|
|
1102
|
+
let e = a.current?.getBoundingClientRect?.().top;
|
|
1103
|
+
e && u(e + 1);
|
|
1104
|
+
} else u(null);
|
|
1105
|
+
}, []);
|
|
1106
|
+
d(() => {
|
|
1107
|
+
p();
|
|
1108
|
+
}, [p]), l(() => (window.addEventListener("resize", p), () => window.removeEventListener("resize", p)), [p]);
|
|
1109
|
+
let g = f(() => i === "full-height" && o ? {
|
|
1110
|
+
height: `calc(100vh - ${o}px)`,
|
|
1111
|
+
minHeight: `calc(100vh - ${o}px)`,
|
|
1112
|
+
...n
|
|
1113
|
+
} : n, [
|
|
1114
|
+
i,
|
|
1115
|
+
o,
|
|
1116
|
+
n
|
|
1117
|
+
]);
|
|
1118
|
+
return /* @__PURE__ */ P("tbody", {
|
|
1119
|
+
className: e,
|
|
1120
|
+
ref: a,
|
|
1121
|
+
style: g,
|
|
1122
|
+
...r,
|
|
1123
|
+
children: t
|
|
1124
|
+
});
|
|
1125
|
+
};
|
|
1126
|
+
dt.Body = mt, dt.Loading = pt;
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region src/lib/components/TableCaption/TableCaption.tsx
|
|
1129
|
+
var ht = ({ children: e }) => /* @__PURE__ */ P("caption", { children: /* @__PURE__ */ P("div", {
|
|
1130
|
+
className: "p-strip",
|
|
1131
|
+
children: e
|
|
1132
|
+
}) });
|
|
1133
|
+
ht.Title = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
1134
|
+
className: "row",
|
|
1135
|
+
children: /* @__PURE__ */ P("div", {
|
|
1136
|
+
className: "col-start-large-4 u-align--left col-8 col-medium-4",
|
|
1137
|
+
children: /* @__PURE__ */ P("p", {
|
|
1138
|
+
className: "p-heading--4 u-no-margin--bottom",
|
|
1139
|
+
children: e
|
|
1140
|
+
})
|
|
1141
|
+
})
|
|
1142
|
+
}), ht.Description = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
1143
|
+
className: "row",
|
|
1144
|
+
children: /* @__PURE__ */ P("div", {
|
|
1145
|
+
className: "u-align--left col-start-large-4 col-8 col-medium-4",
|
|
1146
|
+
children: /* @__PURE__ */ P("p", { children: e })
|
|
1147
|
+
})
|
|
1148
|
+
});
|
|
1149
|
+
//#endregion
|
|
1150
|
+
//#region src/lib/components/GenericTable/components/SortingIndicator/SortingIndicator.tsx
|
|
1151
|
+
var gt = ({ header: e }) => ({
|
|
1152
|
+
asc: /* @__PURE__ */ P(C, {
|
|
1153
|
+
name: "chevron-up",
|
|
1154
|
+
children: "ascending"
|
|
1155
|
+
}),
|
|
1156
|
+
desc: /* @__PURE__ */ P(C, {
|
|
1157
|
+
name: "chevron-down",
|
|
1158
|
+
children: "descending"
|
|
1159
|
+
})
|
|
1160
|
+
})[e?.column?.getIsSorted()] ?? null, _t = ({ header: e }) => {
|
|
1161
|
+
let t = e.column.getCanSort(), n = e.column.columnDef.meta, r = n?.isInteractiveHeader, i = I(e.column.columnDef.header, e.getContext());
|
|
1162
|
+
return /* @__PURE__ */ P("th", {
|
|
1163
|
+
"aria-hidden": n?.headerAriaHidden || void 0,
|
|
1164
|
+
"aria-label": n?.headerAriaLabel,
|
|
1165
|
+
className: M("p-column-header", e.column.id),
|
|
1166
|
+
children: t && !r ? /* @__PURE__ */ P(y, {
|
|
1167
|
+
appearance: "link",
|
|
1168
|
+
className: "p-button--column-header",
|
|
1169
|
+
onClick: e.column.getToggleSortingHandler(),
|
|
1170
|
+
type: "button",
|
|
1171
|
+
children: /* @__PURE__ */ F(N, { children: [i, /* @__PURE__ */ P(gt, { header: e })] })
|
|
1172
|
+
}) : /* @__PURE__ */ F("span", {
|
|
1173
|
+
className: "p-container--column-header",
|
|
1174
|
+
children: [i, t && !r && /* @__PURE__ */ P(gt, { header: e })]
|
|
1175
|
+
})
|
|
1176
|
+
}, e.id);
|
|
1177
|
+
}, X = ({ children: e, "aria-label": t = "Table controls" }) => /* @__PURE__ */ P("section", {
|
|
1178
|
+
"aria-label": t,
|
|
1179
|
+
className: "controls-bar u-flex u-flex--justify-between u-flex--wrap",
|
|
1180
|
+
children: /* @__PURE__ */ P("div", {
|
|
1181
|
+
className: "p-form p-form--inline",
|
|
1182
|
+
children: e
|
|
1183
|
+
})
|
|
1184
|
+
});
|
|
1185
|
+
X.Left = ({ children: e }) => /* @__PURE__ */ P("strong", {
|
|
1186
|
+
className: "controls-bar__description",
|
|
1187
|
+
children: e
|
|
1188
|
+
}), X.Right = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
1189
|
+
className: "u-flex u-flex--wrap u-flex--column-x-small controls-bar__right",
|
|
1190
|
+
children: e
|
|
1191
|
+
});
|
|
1192
|
+
//#endregion
|
|
1193
|
+
//#region src/lib/components/GenericTable/components/PaginationBar/PaginationBar.tsx
|
|
1194
|
+
var vt = ({ currentPage: e, itemsPerPage: t, totalItems: n, handlePageSizeChange: r, dataContext: i, setCurrentPage: a, isPending: o, pageSizes: s = [
|
|
1195
|
+
20,
|
|
1196
|
+
30,
|
|
1197
|
+
50,
|
|
1198
|
+
100
|
|
1199
|
+
] }) => {
|
|
1200
|
+
let c = f(() => s, []), l = f(() => c.map((e) => ({
|
|
1201
|
+
label: `${e}/page`,
|
|
1202
|
+
value: e
|
|
1203
|
+
})), [c]), u = Math.ceil(n / t);
|
|
1204
|
+
return /* @__PURE__ */ F(X, { children: [/* @__PURE__ */ F(X.Left, { children: [
|
|
1205
|
+
"Showing ",
|
|
1206
|
+
e === u ? t - (u * t - n) : e < u ? t : 0,
|
|
1207
|
+
" out of ",
|
|
1208
|
+
n,
|
|
1209
|
+
" ",
|
|
1210
|
+
i
|
|
1211
|
+
] }), /* @__PURE__ */ F(X.Right, { children: [/* @__PURE__ */ P(et, {
|
|
1212
|
+
currentPage: e,
|
|
1213
|
+
disabled: o,
|
|
1214
|
+
paginate: a,
|
|
1215
|
+
totalPages: u
|
|
1216
|
+
}), /* @__PURE__ */ P(O, {
|
|
1217
|
+
"aria-label": "Items per page",
|
|
1218
|
+
className: "u-no-margin--bottom",
|
|
1219
|
+
name: "Items per page",
|
|
1220
|
+
onChange: (e) => {
|
|
1221
|
+
let { value: t } = e.target;
|
|
1222
|
+
r(Number(t));
|
|
1223
|
+
},
|
|
1224
|
+
options: l,
|
|
1225
|
+
value: t
|
|
1226
|
+
})] })] });
|
|
1227
|
+
}, yt = ({ grouping: e, initialData: t }) => {
|
|
1228
|
+
let [n, r] = h(!0), i = s((e) => {
|
|
1229
|
+
r((t) => {
|
|
1230
|
+
let n = typeof e == "function" ? e(t) : e;
|
|
1231
|
+
if (n === !0) return !0;
|
|
1232
|
+
let r = { ...n };
|
|
1233
|
+
if (t !== !0) for (let e of Object.keys(t)) e in r || (r[e] = !1);
|
|
1234
|
+
return r;
|
|
1235
|
+
});
|
|
1236
|
+
}, []);
|
|
1237
|
+
return l(() => {
|
|
1238
|
+
e.length && i((n) => {
|
|
1239
|
+
let r = { ...n === !0 ? {} : { ...n } };
|
|
1240
|
+
for (let n of t) {
|
|
1241
|
+
let t = e.map((e) => `${e}:${n[e]}`).join(">");
|
|
1242
|
+
t in r || (r[t] = !0);
|
|
1243
|
+
}
|
|
1244
|
+
return r;
|
|
1245
|
+
});
|
|
1246
|
+
}, [t, e]), {
|
|
1247
|
+
expanded: n,
|
|
1248
|
+
setExpanded: i
|
|
1249
|
+
};
|
|
1250
|
+
}, bt = ({ groupBy: e, initialData: t }) => {
|
|
1251
|
+
let [n, r] = h(e ?? []);
|
|
1252
|
+
return {
|
|
1253
|
+
grouping: n,
|
|
1254
|
+
setGrouping: r,
|
|
1255
|
+
groupedData: f(() => n.length ? [...t].sort((e, t) => {
|
|
1256
|
+
for (let r of n) {
|
|
1257
|
+
let n = e[r] ?? null, i = t[r] ?? null;
|
|
1258
|
+
if (n === null) return 1;
|
|
1259
|
+
if (i === null || n < i) return -1;
|
|
1260
|
+
if (n > i) return 1;
|
|
1261
|
+
}
|
|
1262
|
+
return 0;
|
|
1263
|
+
}) : t, [t, n])
|
|
1264
|
+
};
|
|
1265
|
+
}, xt = ({ isLoading: e }) => {
|
|
1266
|
+
let t = m(null), n = m(null);
|
|
1267
|
+
return l(() => {
|
|
1268
|
+
let n = t.current;
|
|
1269
|
+
if (!n || e) return;
|
|
1270
|
+
let r = [
|
|
1271
|
+
"button:not([disabled])",
|
|
1272
|
+
"input:not([disabled])",
|
|
1273
|
+
"select:not([disabled])",
|
|
1274
|
+
"textarea:not([disabled])",
|
|
1275
|
+
"a[href]"
|
|
1276
|
+
].join(", ");
|
|
1277
|
+
n.querySelectorAll(r).forEach((e) => {
|
|
1278
|
+
e.getAttribute("tabindex") !== "-1" && (e.tabIndex = 0);
|
|
1279
|
+
});
|
|
1280
|
+
}), d(() => {
|
|
1281
|
+
let r = t.current;
|
|
1282
|
+
if (!r || e) {
|
|
1283
|
+
n.current = null;
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
let i = Array.from(r.querySelectorAll("tbody tr[role=\"row\"]")).filter((e) => e.hasAttribute("tabindex"));
|
|
1287
|
+
i.length !== 0 && (n.current && i.includes(n.current) ? n.current.tabIndex = 0 : (i[0].tabIndex = 0, n.current = i[0]));
|
|
1288
|
+
}), {
|
|
1289
|
+
tableRef: t,
|
|
1290
|
+
handleTableFocus: s((e) => {
|
|
1291
|
+
if (!t.current) return;
|
|
1292
|
+
let r = e.target.closest("tbody tr[role=\"row\"][tabindex]");
|
|
1293
|
+
r && (n.current && n.current !== r && (n.current.tabIndex = -1), r.tabIndex = 0, n.current = r);
|
|
1294
|
+
}, []),
|
|
1295
|
+
handleTableKeyDown: s((e) => {
|
|
1296
|
+
if (e.key !== "ArrowUp" && e.key !== "ArrowDown" && e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End") return;
|
|
1297
|
+
let n = t.current;
|
|
1298
|
+
if (!n) return;
|
|
1299
|
+
let r = document.activeElement;
|
|
1300
|
+
if (!r) return;
|
|
1301
|
+
let i = r.matches("tr[role=\"row\"]"), a = r.matches("td[role=\"gridcell\"][tabindex=\"-1\"]");
|
|
1302
|
+
if (!i && !a) return;
|
|
1303
|
+
e.preventDefault();
|
|
1304
|
+
let o = Array.from(n.querySelectorAll("tbody tr[role=\"row\"]")), s = i ? r : r.closest("tr");
|
|
1305
|
+
if (!s) return;
|
|
1306
|
+
let c = o.indexOf(s);
|
|
1307
|
+
if (c === -1) return;
|
|
1308
|
+
let l = (e) => Array.from(e.querySelectorAll("td[role=\"gridcell\"][tabindex=\"-1\"]:not(.p-generic-table__group-chevron)")), u = l(s), d = a ? u.indexOf(r) : -1;
|
|
1309
|
+
switch (e.key) {
|
|
1310
|
+
case "ArrowUp": {
|
|
1311
|
+
if (c <= 0) break;
|
|
1312
|
+
let e = o[c - 1];
|
|
1313
|
+
if (a && d >= 0) {
|
|
1314
|
+
let t = l(e);
|
|
1315
|
+
if (t.length > 0) {
|
|
1316
|
+
t[Math.min(d, t.length - 1)].focus();
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
e.focus();
|
|
1321
|
+
break;
|
|
1322
|
+
}
|
|
1323
|
+
case "ArrowDown": {
|
|
1324
|
+
if (c >= o.length - 1) break;
|
|
1325
|
+
let e = o[c + 1];
|
|
1326
|
+
if (a && d >= 0) {
|
|
1327
|
+
let t = l(e);
|
|
1328
|
+
if (t.length > 0) {
|
|
1329
|
+
t[Math.min(d, t.length - 1)].focus();
|
|
1330
|
+
break;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
e.focus();
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1336
|
+
case "ArrowRight":
|
|
1337
|
+
i ? u[0]?.focus() : d < u.length - 1 && u[d + 1].focus();
|
|
1338
|
+
break;
|
|
1339
|
+
case "ArrowLeft":
|
|
1340
|
+
if (i) break;
|
|
1341
|
+
d > 0 ? u[d - 1].focus() : s.focus();
|
|
1342
|
+
break;
|
|
1343
|
+
case "Home":
|
|
1344
|
+
a ? u[0]?.focus() : e.ctrlKey && o[0]?.focus();
|
|
1345
|
+
break;
|
|
1346
|
+
case "End": a ? u[u.length - 1]?.focus() : e.ctrlKey && o[o.length - 1]?.focus();
|
|
1347
|
+
}
|
|
1348
|
+
}, [])
|
|
1349
|
+
};
|
|
1350
|
+
}, St = ({ containerRef: e, variant: t, length: n, isLoading: r }) => {
|
|
1351
|
+
let i = m(null), [a, o] = h("auto"), [s, c] = h(!1);
|
|
1352
|
+
return d(() => {
|
|
1353
|
+
let n = () => {
|
|
1354
|
+
let n = i.current;
|
|
1355
|
+
if (!n) return;
|
|
1356
|
+
let r = e?.current || document.querySelector("main");
|
|
1357
|
+
if (!r) return;
|
|
1358
|
+
let a = r.getBoundingClientRect(), s = n.getBoundingClientRect(), l = a.bottom - s.top, u = n.scrollHeight > l;
|
|
1359
|
+
c(u), o(t === "full-height" && u ? `${l}px` : "auto");
|
|
1360
|
+
};
|
|
1361
|
+
n();
|
|
1362
|
+
let r = new ResizeObserver(n), a = i.current;
|
|
1363
|
+
return a && r.observe(a), window.addEventListener("resize", n), () => {
|
|
1364
|
+
window.removeEventListener("resize", n), a && r.unobserve(a);
|
|
1365
|
+
};
|
|
1366
|
+
}, [
|
|
1367
|
+
e,
|
|
1368
|
+
n,
|
|
1369
|
+
r
|
|
1370
|
+
]), {
|
|
1371
|
+
tableBodyRef: i,
|
|
1372
|
+
maxHeight: a,
|
|
1373
|
+
effectiveVariant: t === "full-height" && s ? "full-height" : "regular"
|
|
1374
|
+
};
|
|
1375
|
+
}, Ct = ({ externalSorting: e, setExternalSorting: t, grouping: n, groupedData: r, pinGroup: i }) => {
|
|
1376
|
+
let [a, o] = h(e ?? []);
|
|
1377
|
+
return {
|
|
1378
|
+
sorting: a,
|
|
1379
|
+
setSorting: s((e) => {
|
|
1380
|
+
o(e), t && t(e);
|
|
1381
|
+
}, [t]),
|
|
1382
|
+
sortedData: f(() => r.length ? [...r].sort((e, t) => {
|
|
1383
|
+
if (i?.length && n.length) for (let { value: r, isTop: a } of i) {
|
|
1384
|
+
let i = n[0], o = e[i] ?? null, s = t[i] ?? null;
|
|
1385
|
+
if (o === r && s !== r) return a ? -1 : 1;
|
|
1386
|
+
if (s === r && o !== r) return a ? 1 : -1;
|
|
1387
|
+
}
|
|
1388
|
+
for (let { id: n, desc: r } of a) {
|
|
1389
|
+
let i = e[n] ?? null, a = t[n] ?? null;
|
|
1390
|
+
if (i === null && a === null) return 0;
|
|
1391
|
+
if (i === null) return r ? -1 : 1;
|
|
1392
|
+
if (a === null || i < a) return r ? 1 : -1;
|
|
1393
|
+
if (i > a) return r ? -1 : 1;
|
|
1394
|
+
}
|
|
1395
|
+
return 0;
|
|
1396
|
+
}) : [], [
|
|
1397
|
+
r,
|
|
1398
|
+
a,
|
|
1399
|
+
i,
|
|
1400
|
+
n
|
|
1401
|
+
])
|
|
1402
|
+
};
|
|
1403
|
+
}, wt = ({ table: e, ...t }) => {
|
|
1404
|
+
let n = m(null);
|
|
1405
|
+
if (!e) return null;
|
|
1406
|
+
let r = e.getCoreRowModel().rows.filter((e) => e.getCanSelect()), i = e.getSelectedRowModel().rows.filter((e) => e.getCanSelect()), a = r.length > 0 && i.length === r.length, o = i.length > 0 && !a;
|
|
1407
|
+
return l(() => {
|
|
1408
|
+
n.current && (n.current.indeterminate = o);
|
|
1409
|
+
}, [o]), /* @__PURE__ */ F("label", {
|
|
1410
|
+
className: "p-checkbox--inline p-table-checkbox--all",
|
|
1411
|
+
onClick: (e) => e.stopPropagation(),
|
|
1412
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1413
|
+
children: [/* @__PURE__ */ P("input", {
|
|
1414
|
+
ref: n,
|
|
1415
|
+
"aria-label": "select all",
|
|
1416
|
+
className: "p-checkbox__input",
|
|
1417
|
+
disabled: r.length === 0,
|
|
1418
|
+
type: "checkbox",
|
|
1419
|
+
checked: a,
|
|
1420
|
+
onChange: () => {
|
|
1421
|
+
let t = e.getCoreRowModel().rows.filter((e) => e.getCanSelect()), n = t.every((e) => e.getIsSelected());
|
|
1422
|
+
t.forEach((e) => e.toggleSelected(!n));
|
|
1423
|
+
},
|
|
1424
|
+
...t
|
|
1425
|
+
}), /* @__PURE__ */ P("span", { className: "p-checkbox__label" })]
|
|
1426
|
+
});
|
|
1427
|
+
}, Tt = ({ row: e, ...t }) => {
|
|
1428
|
+
let n = m(null);
|
|
1429
|
+
if (!e) return /* @__PURE__ */ F("label", {
|
|
1430
|
+
className: "p-checkbox--inline p-table-checkbox--group",
|
|
1431
|
+
onClick: (e) => e.stopPropagation(),
|
|
1432
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1433
|
+
children: [/* @__PURE__ */ P("input", {
|
|
1434
|
+
className: "p-checkbox__input",
|
|
1435
|
+
disabled: !0,
|
|
1436
|
+
type: "checkbox",
|
|
1437
|
+
...t
|
|
1438
|
+
}), /* @__PURE__ */ P("span", { className: "p-checkbox__label" })]
|
|
1439
|
+
});
|
|
1440
|
+
let r = e.subRows.filter((e) => e.getCanSelect()), i = r.filter((e) => e.getIsSelected()).length, a = r.length > 0 && i === r.length, o = i > 0 && !a;
|
|
1441
|
+
return l(() => {
|
|
1442
|
+
n.current && (n.current.indeterminate = o);
|
|
1443
|
+
}, [o]), /* @__PURE__ */ F("label", {
|
|
1444
|
+
className: "p-checkbox--inline p-table-checkbox--group",
|
|
1445
|
+
onClick: (e) => e.stopPropagation(),
|
|
1446
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1447
|
+
children: [/* @__PURE__ */ P("input", {
|
|
1448
|
+
ref: n,
|
|
1449
|
+
className: "p-checkbox__input",
|
|
1450
|
+
type: "checkbox",
|
|
1451
|
+
checked: a,
|
|
1452
|
+
disabled: !e.getCanSelect() && r.length === 0,
|
|
1453
|
+
onChange: () => {
|
|
1454
|
+
let e = !a;
|
|
1455
|
+
r.forEach((t) => t.toggleSelected(e));
|
|
1456
|
+
},
|
|
1457
|
+
...t
|
|
1458
|
+
}), /* @__PURE__ */ P("span", { className: "p-checkbox__label" })]
|
|
1459
|
+
});
|
|
1460
|
+
}, Z = ({ row: e, disabledTooltip: t = "", isNested: n = !1, ...r }) => {
|
|
1461
|
+
if (!e) return /* @__PURE__ */ F("label", {
|
|
1462
|
+
className: "p-checkbox--inline p-table-checkbox",
|
|
1463
|
+
onClick: (e) => e.stopPropagation(),
|
|
1464
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1465
|
+
children: [/* @__PURE__ */ P("input", {
|
|
1466
|
+
className: "p-checkbox__input",
|
|
1467
|
+
disabled: !0,
|
|
1468
|
+
type: "checkbox",
|
|
1469
|
+
...r
|
|
1470
|
+
}), /* @__PURE__ */ P("span", { className: "p-checkbox__label" })]
|
|
1471
|
+
});
|
|
1472
|
+
let i = e.getCanSelect(), a = typeof t == "string" ? t : t(e);
|
|
1473
|
+
return /* @__PURE__ */ P(A, {
|
|
1474
|
+
message: n ? "Selection is managed by the parent row" : !i && a,
|
|
1475
|
+
position: "btm-right",
|
|
1476
|
+
children: /* @__PURE__ */ F("label", {
|
|
1477
|
+
className: "p-checkbox--inline p-table-checkbox",
|
|
1478
|
+
onClick: (e) => e.stopPropagation(),
|
|
1479
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1480
|
+
children: [/* @__PURE__ */ P("input", {
|
|
1481
|
+
className: "p-checkbox__input",
|
|
1482
|
+
type: "checkbox",
|
|
1483
|
+
checked: e.getIsSelected(),
|
|
1484
|
+
disabled: !i || n,
|
|
1485
|
+
onChange: e.getToggleSelectedHandler(),
|
|
1486
|
+
...r
|
|
1487
|
+
}), /* @__PURE__ */ P("span", { className: "p-checkbox__label" })]
|
|
1488
|
+
})
|
|
1489
|
+
});
|
|
1490
|
+
};
|
|
1491
|
+
Z.All = wt, Z.Group = Tt;
|
|
1492
|
+
//#endregion
|
|
1493
|
+
//#region src/lib/components/GenericTable/utils/processColumnDefs.tsx
|
|
1494
|
+
var Et = ({ canSelect: e, initialColumns: t, groupBy: n, getSubRows: r, selection: i, showChevron: a }) => {
|
|
1495
|
+
let o = [...t];
|
|
1496
|
+
if (e && i) {
|
|
1497
|
+
let e = [{
|
|
1498
|
+
id: "p-generic-table__select",
|
|
1499
|
+
accessorKey: "id",
|
|
1500
|
+
enableSorting: !1,
|
|
1501
|
+
meta: { headerAriaLabel: "Row selection" },
|
|
1502
|
+
header: ({ table: e }) => n ? "" : /* @__PURE__ */ P(Z.All, { table: e }),
|
|
1503
|
+
cell: ({ row: e }) => {
|
|
1504
|
+
let t = i.rowSelectionLabelKey && i.rowSelectionLabelKey in e.original ? `select ${e.original[i.rowSelectionLabelKey]}` : "select row";
|
|
1505
|
+
return e.getIsGrouped() ? null : /* @__PURE__ */ P(Z, {
|
|
1506
|
+
"aria-label": t,
|
|
1507
|
+
disabledTooltip: i.disabledSelectionTooltip ?? "",
|
|
1508
|
+
isNested: r !== void 0 && !!e.parentId,
|
|
1509
|
+
row: e
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
}, ...o];
|
|
1513
|
+
if (n) {
|
|
1514
|
+
let t = (e) => n[0] in e.original ? `select ${e.original[n[0]]}` : "select group";
|
|
1515
|
+
o = [{
|
|
1516
|
+
id: "p-generic-table__group-select",
|
|
1517
|
+
accessorKey: "id",
|
|
1518
|
+
enableSorting: !1,
|
|
1519
|
+
meta: { headerAriaLabel: "Row selection" },
|
|
1520
|
+
header: ({ table: e }) => /* @__PURE__ */ P(Z.All, { table: e }),
|
|
1521
|
+
cell: ({ row: e }) => e.getIsGrouped() ? /* @__PURE__ */ P(Z.Group, {
|
|
1522
|
+
"aria-label": t(e),
|
|
1523
|
+
row: e
|
|
1524
|
+
}) : null
|
|
1525
|
+
}, ...e];
|
|
1526
|
+
} else o = e;
|
|
1527
|
+
}
|
|
1528
|
+
return n && a && (o = [{
|
|
1529
|
+
id: "p-generic-table__group-chevron",
|
|
1530
|
+
accessorKey: "id",
|
|
1531
|
+
enableSorting: !1,
|
|
1532
|
+
meta: { headerAriaHidden: !0 },
|
|
1533
|
+
header: "",
|
|
1534
|
+
cell: ({ row: e }) => {
|
|
1535
|
+
let t = e.getIsExpanded();
|
|
1536
|
+
return e.getIsGrouped() ? /* @__PURE__ */ P(A, {
|
|
1537
|
+
message: t ? "Collapse" : "Expand",
|
|
1538
|
+
position: "btm-right",
|
|
1539
|
+
children: /* @__PURE__ */ P(C, { name: t ? S.chevronUp : S.chevronDown })
|
|
1540
|
+
}) : null;
|
|
1541
|
+
}
|
|
1542
|
+
}, ...o]), o;
|
|
1543
|
+
}, Dt = ({ table: e, columns: t, filterCells: n, getSubRows: r, noData: i, selection: a }) => {
|
|
1544
|
+
if (e.getRowModel().rows.length < 1) return /* @__PURE__ */ P("tr", { children: /* @__PURE__ */ P("td", {
|
|
1545
|
+
className: "p-generic-table__no-data",
|
|
1546
|
+
colSpan: t.length,
|
|
1547
|
+
role: "gridcell",
|
|
1548
|
+
children: /* @__PURE__ */ P("div", {
|
|
1549
|
+
"aria-live": "polite",
|
|
1550
|
+
role: "status",
|
|
1551
|
+
children: i
|
|
1552
|
+
})
|
|
1553
|
+
}) });
|
|
1554
|
+
let o = 1;
|
|
1555
|
+
return e.getRowModel().rows.map((e) => {
|
|
1556
|
+
o++;
|
|
1557
|
+
let t = o, { getIsGrouped: i, id: s, getVisibleCells: c, parentId: l } = e, u = !i(), d = a?.rowSelection !== void 0 && Object.keys(a.rowSelection).includes(s);
|
|
1558
|
+
return /* @__PURE__ */ P("tr", {
|
|
1559
|
+
"aria-expanded": u ? void 0 : e.getIsExpanded(),
|
|
1560
|
+
"aria-rowindex": t,
|
|
1561
|
+
"aria-selected": d,
|
|
1562
|
+
className: M({
|
|
1563
|
+
"p-generic-table__individual-row": u,
|
|
1564
|
+
"p-generic-table__group-row": !u,
|
|
1565
|
+
"p-generic-table__nested-row": r !== void 0 && !!l
|
|
1566
|
+
}),
|
|
1567
|
+
onClick: u ? void 0 : () => e.toggleExpanded(),
|
|
1568
|
+
onKeyDown: u ? (e) => {
|
|
1569
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.querySelector("button:not([disabled]), input:not([disabled]), a[href], select:not([disabled]), textarea:not([disabled])")?.focus());
|
|
1570
|
+
} : (t) => {
|
|
1571
|
+
t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e.toggleExpanded());
|
|
1572
|
+
},
|
|
1573
|
+
tabIndex: -1,
|
|
1574
|
+
role: "row",
|
|
1575
|
+
children: c().filter((t) => !u && (t.column.id === "p-generic-table__group-select" || t.column.id === "p-generic-table__group-chevron") || n(e, t.column)).map((t) => /* @__PURE__ */ P("td", {
|
|
1576
|
+
"aria-hidden": t.column.id === "p-generic-table__select" && r !== void 0 && l ? !0 : void 0,
|
|
1577
|
+
"aria-label": t.column.columnDef.meta?.cellAriaLabel?.(e) ?? void 0,
|
|
1578
|
+
className: M(`${t.column.id}`),
|
|
1579
|
+
role: "gridcell",
|
|
1580
|
+
tabIndex: -1,
|
|
1581
|
+
children: I(t.column.columnDef.cell, t.getContext())
|
|
1582
|
+
}, t.id))
|
|
1583
|
+
}, s);
|
|
1584
|
+
});
|
|
1585
|
+
}, Ot = (e, t) => {
|
|
1586
|
+
let n = e.column.id;
|
|
1587
|
+
return n === "p-generic-table__group-chevron" ? t ? /* @__PURE__ */ P(C, { name: S.chevronDown }) : null : n === "p-generic-table__group-select" ? t ? /* @__PURE__ */ P(Z.Group, { "aria-label": "select group" }) : null : n === "p-generic-table__select" ? t ? null : /* @__PURE__ */ P(Z, { "aria-label": "select row" }) : null;
|
|
1588
|
+
}, kt = (e, t, n) => e({ getIsGrouped: () => n }, t), At = ({ table: e, columns: t, filterHeaders: n, filterCells: r, loadingVariant: i, skeletonRowCount: a, skeletonGroupCount: o }) => {
|
|
1589
|
+
let s = e.getHeaderGroups()[0]?.headers ?? [], c = s.filter(n);
|
|
1590
|
+
if (i !== "skeleton") return /* @__PURE__ */ P("tr", { children: /* @__PURE__ */ P("td", {
|
|
1591
|
+
className: "p-generic-table__loading",
|
|
1592
|
+
colSpan: c.length || t.length,
|
|
1593
|
+
role: "gridcell",
|
|
1594
|
+
children: /* @__PURE__ */ P(k, { text: "Loading..." })
|
|
1595
|
+
}) });
|
|
1596
|
+
let l = s.some((e) => e.column.id === "p-generic-table__group-select" || e.column.id === "p-generic-table__group-chevron"), u = (e, t, n) => /* @__PURE__ */ P("tr", {
|
|
1597
|
+
"aria-expanded": n ? !0 : void 0,
|
|
1598
|
+
"aria-rowindex": t,
|
|
1599
|
+
className: M({
|
|
1600
|
+
"p-generic-table__group-row": n,
|
|
1601
|
+
"p-generic-table__individual-row": !n,
|
|
1602
|
+
"p-generic-table__skeleton-row": !0
|
|
1603
|
+
}),
|
|
1604
|
+
role: "row",
|
|
1605
|
+
children: s.filter((e) => {
|
|
1606
|
+
let t = e.column.id;
|
|
1607
|
+
return n && (t === "p-generic-table__group-select" || t === "p-generic-table__group-chevron") ? !0 : kt(r, e.column, n);
|
|
1608
|
+
}).map((t) => {
|
|
1609
|
+
let r = t.column.id, i = r.startsWith("p-generic-table__"), a = t.column.columnDef.meta, o = i ? Ot(t, n) : a?.skeleton ? a.skeleton() : /* @__PURE__ */ P(U, {
|
|
1610
|
+
variant: "block",
|
|
1611
|
+
width: "70%",
|
|
1612
|
+
height: "1.5rem"
|
|
1613
|
+
});
|
|
1614
|
+
return /* @__PURE__ */ P("td", {
|
|
1615
|
+
className: M("p-generic-table__skeleton-cell", r),
|
|
1616
|
+
role: "gridcell",
|
|
1617
|
+
children: o
|
|
1618
|
+
}, `${e}-${t.id}`);
|
|
1619
|
+
})
|
|
1620
|
+
}, e);
|
|
1621
|
+
if (!l) return Array.from({ length: a }).map((e, t) => u(`skel-${t}`, t + 2, !1));
|
|
1622
|
+
let d = [], f = 1;
|
|
1623
|
+
for (let e = 0; e < o; e++) {
|
|
1624
|
+
d.push(u(`skel-group-${e}`, ++f, !0));
|
|
1625
|
+
for (let t = 0; t < a; t++) d.push(u(`skel-${e}-${t}`, ++f, !1));
|
|
1626
|
+
}
|
|
1627
|
+
return d;
|
|
1628
|
+
}, jt = ({ "aria-label": e, className: t, columns: r, columnVisibility: i, containerRef: a, data: o, filterCells: s = () => !0, filterHeaders: c = () => !0, getSubRows: l, groupBy: u, isLoading: d, loadingVariant: p = "spinner", skeletonRowCount: m = 10, skeletonGroupCount: g = 2, noData: _, pagination: v, pinGroup: y, sorting: b = [], selection: x, setSorting: S, showChevron: C = !1, variant: w = "full-height", debug: T = !1, ...E }) => {
|
|
1629
|
+
let { grouping: D, setGrouping: ee, groupedData: O } = bt({
|
|
1630
|
+
groupBy: u,
|
|
1631
|
+
initialData: o
|
|
1632
|
+
}), { sortedData: k, sorting: A, setSorting: te } = Ct({
|
|
1633
|
+
externalSorting: b,
|
|
1634
|
+
setExternalSorting: S,
|
|
1635
|
+
grouping: D,
|
|
1636
|
+
groupedData: O,
|
|
1637
|
+
pinGroup: y
|
|
1638
|
+
}), { expanded: ne, setExpanded: j } = yt({
|
|
1639
|
+
grouping: D,
|
|
1640
|
+
initialData: o
|
|
1641
|
+
}), { tableBodyRef: N, maxHeight: re, effectiveVariant: ie } = St({
|
|
1642
|
+
containerRef: a,
|
|
1643
|
+
variant: w,
|
|
1644
|
+
length: k.length,
|
|
1645
|
+
isLoading: d
|
|
1646
|
+
}), [I, L] = h({}), le = i?.columnVisibility ?? I, ue = i?.setColumnVisibility ?? L, R = !!x, z = f(() => Et({
|
|
1647
|
+
canSelect: R,
|
|
1648
|
+
initialColumns: r,
|
|
1649
|
+
groupBy: u,
|
|
1650
|
+
getSubRows: l,
|
|
1651
|
+
selection: x,
|
|
1652
|
+
showChevron: C
|
|
1653
|
+
}), [
|
|
1654
|
+
R,
|
|
1655
|
+
r,
|
|
1656
|
+
u,
|
|
1657
|
+
l
|
|
1658
|
+
]), B = ce({
|
|
1659
|
+
data: k,
|
|
1660
|
+
columns: z,
|
|
1661
|
+
state: {
|
|
1662
|
+
grouping: D,
|
|
1663
|
+
expanded: ne,
|
|
1664
|
+
sorting: A,
|
|
1665
|
+
columnVisibility: le,
|
|
1666
|
+
rowSelection: x?.rowSelection
|
|
1667
|
+
},
|
|
1668
|
+
manualPagination: !0,
|
|
1669
|
+
autoResetExpanded: !1,
|
|
1670
|
+
onExpandedChange: j,
|
|
1671
|
+
onSortingChange: te,
|
|
1672
|
+
onGroupingChange: ee,
|
|
1673
|
+
onColumnVisibilityChange: ue,
|
|
1674
|
+
onRowSelectionChange: x?.setRowSelection,
|
|
1675
|
+
manualSorting: !0,
|
|
1676
|
+
enableSorting: !0,
|
|
1677
|
+
enableExpanding: !0,
|
|
1678
|
+
getSubRows: l,
|
|
1679
|
+
getExpandedRowModel: oe(),
|
|
1680
|
+
getCoreRowModel: ae(),
|
|
1681
|
+
getGroupedRowModel: se(),
|
|
1682
|
+
groupedColumnMode: !1,
|
|
1683
|
+
enableRowSelection: x?.filterSelectable ?? R,
|
|
1684
|
+
enableMultiRowSelection: x?.filterSelectable ?? R,
|
|
1685
|
+
getRowId: (e) => e.id.toString(),
|
|
1686
|
+
debugAll: T
|
|
1687
|
+
}), { tableRef: V, handleTableFocus: de, handleTableKeyDown: H } = xt({ isLoading: d });
|
|
1688
|
+
return /* @__PURE__ */ F("div", {
|
|
1689
|
+
className: M("p-generic-table", t),
|
|
1690
|
+
"data-testid": "p-generic-table",
|
|
1691
|
+
...E,
|
|
1692
|
+
children: [v && /* @__PURE__ */ P(vt, {
|
|
1693
|
+
currentPage: v.currentPage,
|
|
1694
|
+
dataContext: v.dataContext,
|
|
1695
|
+
handlePageSizeChange: v.handlePageSizeChange,
|
|
1696
|
+
isPending: v.isPending,
|
|
1697
|
+
itemsPerPage: v.itemsPerPage,
|
|
1698
|
+
setCurrentPage: v.setCurrentPage,
|
|
1699
|
+
totalItems: v.totalItems,
|
|
1700
|
+
pageSizes: v.pageSizes
|
|
1701
|
+
}), /* @__PURE__ */ F("table", {
|
|
1702
|
+
ref: V,
|
|
1703
|
+
"aria-busy": d,
|
|
1704
|
+
"aria-label": e,
|
|
1705
|
+
"aria-rowcount": (v?.totalItems ?? B.getRowModel().rows.length) + 1,
|
|
1706
|
+
className: M("p-generic-table__table", {
|
|
1707
|
+
"p-generic-table__is-full-height": ie === "full-height",
|
|
1708
|
+
"p-generic-table__is-selectable": R,
|
|
1709
|
+
"p-generic-table__is-grouped": u !== void 0
|
|
1710
|
+
}),
|
|
1711
|
+
onFocus: de,
|
|
1712
|
+
onKeyDown: H,
|
|
1713
|
+
role: "treegrid",
|
|
1714
|
+
children: [/* @__PURE__ */ P("thead", { children: B.getHeaderGroups().map((e) => /* @__PURE__ */ P("tr", {
|
|
1715
|
+
"aria-rowindex": 1,
|
|
1716
|
+
role: "row",
|
|
1717
|
+
children: e.headers.filter(c).map((e, t) => /* @__PURE__ */ F(n, { children: [/* @__PURE__ */ P(_t, { header: e }), R && u && (!C && t === 2 || C && t === 3) ? /* @__PURE__ */ P("th", {
|
|
1718
|
+
"aria-hidden": "true",
|
|
1719
|
+
className: "p-generic-table__select-alignment",
|
|
1720
|
+
role: "columnheader"
|
|
1721
|
+
}) : null] }, e.id))
|
|
1722
|
+
}, e.id)) }), /* @__PURE__ */ P("tbody", {
|
|
1723
|
+
ref: N,
|
|
1724
|
+
style: {
|
|
1725
|
+
overflowY: "auto",
|
|
1726
|
+
maxHeight: re
|
|
1727
|
+
},
|
|
1728
|
+
children: d ? At({
|
|
1729
|
+
table: B,
|
|
1730
|
+
columns: z,
|
|
1731
|
+
filterHeaders: c,
|
|
1732
|
+
filterCells: s,
|
|
1733
|
+
loadingVariant: p,
|
|
1734
|
+
skeletonRowCount: m,
|
|
1735
|
+
skeletonGroupCount: g
|
|
1736
|
+
}) : Dt({
|
|
1737
|
+
table: B,
|
|
1738
|
+
columns: z,
|
|
1739
|
+
filterCells: s,
|
|
1740
|
+
getSubRows: l,
|
|
1741
|
+
noData: _,
|
|
1742
|
+
selection: x
|
|
1743
|
+
})
|
|
1744
|
+
})]
|
|
1745
|
+
})]
|
|
1746
|
+
});
|
|
1747
|
+
}, Mt = {
|
|
1748
|
+
DEFAULT: 4,
|
|
1749
|
+
EXPANDED: 15
|
|
1750
|
+
}, Q = {
|
|
1751
|
+
OPEN_PAREN: "(",
|
|
1752
|
+
CLOSE_PAREN: ")",
|
|
1753
|
+
EQUALS: "=",
|
|
1754
|
+
COLON: ":",
|
|
1755
|
+
COMMA: ","
|
|
1756
|
+
}, $ = (e, t = e.length) => {
|
|
1757
|
+
let n = Nt(e, t), { token: r, tokenStart: i, tokenEnd: a } = Pt(e, t);
|
|
1758
|
+
return {
|
|
1759
|
+
context: n,
|
|
1760
|
+
token: r,
|
|
1761
|
+
tokenStart: i,
|
|
1762
|
+
tokenEnd: a
|
|
1763
|
+
};
|
|
1764
|
+
}, Nt = (e, t) => {
|
|
1765
|
+
let n = 0;
|
|
1766
|
+
for (let r = t - 1; r >= 0; r--) {
|
|
1767
|
+
let t = e[r];
|
|
1768
|
+
if (t === Q.CLOSE_PAREN) n++;
|
|
1769
|
+
else if (t === Q.OPEN_PAREN) {
|
|
1770
|
+
if (n === 0) return e.slice(0, r).trimEnd().match(/([a-zA-Z0-9_-]+)\s*:\s*$/)?.[1] || "";
|
|
1771
|
+
n--;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
return "";
|
|
1775
|
+
}, Pt = (e, t) => {
|
|
1776
|
+
let n = t, r = t;
|
|
1777
|
+
for (; r < e.length && /[^\s=(),]/.test(e[r]);) r++;
|
|
1778
|
+
for (; n > 0 && /[^\s=(),]/.test(e[n - 1]);) n--;
|
|
1779
|
+
return {
|
|
1780
|
+
token: e.slice(n, r),
|
|
1781
|
+
tokenStart: n,
|
|
1782
|
+
tokenEnd: r
|
|
1783
|
+
};
|
|
1784
|
+
}, Ft = (e, t) => {
|
|
1785
|
+
let n = e.charAt(t - 1);
|
|
1786
|
+
return t > 0 && (n === Q.CLOSE_PAREN || n === Q.COMMA);
|
|
1787
|
+
}, It = ({ className: e, disabled: t = !1, search: n, setSearch: r, context: i, setContext: a, setToken: o, suggestions: c, isLoading: u = !1, placeholder: d, ...p }) => {
|
|
1788
|
+
let [g, _] = h({
|
|
1789
|
+
isVisible: !1,
|
|
1790
|
+
highlightedIndex: -1,
|
|
1791
|
+
showingMore: !1,
|
|
1792
|
+
cursorPosition: 0
|
|
1793
|
+
}), v = m(null), y = m(null), b = m(null), x = f(() => {
|
|
1794
|
+
let e = g.showingMore ? Mt.EXPANDED : Mt.DEFAULT, t = c.slice(0, e);
|
|
1795
|
+
return !g.showingMore && c.length > e ? [...t, {
|
|
1796
|
+
value: "Show more...",
|
|
1797
|
+
type: "more"
|
|
1798
|
+
}] : t;
|
|
1799
|
+
}, [c, g.showingMore]), S = s((e) => {
|
|
1800
|
+
_(typeof e == "function" ? (t) => ({
|
|
1801
|
+
...t,
|
|
1802
|
+
...e(t)
|
|
1803
|
+
}) : (t) => ({
|
|
1804
|
+
...t,
|
|
1805
|
+
...e
|
|
1806
|
+
}));
|
|
1807
|
+
}, []), C = s((e) => {
|
|
1808
|
+
v.current && !v.current.contains(e.target) && S({
|
|
1809
|
+
isVisible: !1,
|
|
1810
|
+
highlightedIndex: -1
|
|
1811
|
+
});
|
|
1812
|
+
}, [S]), w = s((e, t) => {
|
|
1813
|
+
let { tokenStart: r, tokenEnd: a } = t;
|
|
1814
|
+
if (e.type === "filter") {
|
|
1815
|
+
let t = e.value + Q.COLON + Q.OPEN_PAREN;
|
|
1816
|
+
return n.slice(0, r) + t + n.slice(a);
|
|
1817
|
+
}
|
|
1818
|
+
if (i.length === 0) {
|
|
1819
|
+
let t = e.type + Q.COLON + Q.OPEN_PAREN + Q.EQUALS + e.value;
|
|
1820
|
+
return n.slice(0, r) + t + n.slice(a);
|
|
1821
|
+
}
|
|
1822
|
+
let o = n.charAt(r - 1) === Q.EQUALS ? e.value : Q.EQUALS + e.value;
|
|
1823
|
+
return n.slice(0, r) + o + n.slice(a);
|
|
1824
|
+
}, [n, i]), T = s((e) => {
|
|
1825
|
+
let t = x[e];
|
|
1826
|
+
if (!t) return;
|
|
1827
|
+
if (t.type === "more") {
|
|
1828
|
+
S({ showingMore: !0 });
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
let s = $(n, g.cursorPosition), c = w(t, s), l = s.tokenStart + (t.type === "filter" ? t.value.length + 2 : i.length === 0 ? t.type.length + t.value.length + 3 : t.value.length + 1), { context: u, token: d } = $(c, l);
|
|
1832
|
+
a(u), o(d), r(c), setTimeout(() => {
|
|
1833
|
+
b.current && (b.current.focus(), b.current.setSelectionRange(l, l));
|
|
1834
|
+
}, 0), S({
|
|
1835
|
+
highlightedIndex: 0,
|
|
1836
|
+
showingMore: !1,
|
|
1837
|
+
isVisible: t.type === "filter",
|
|
1838
|
+
cursorPosition: l
|
|
1839
|
+
});
|
|
1840
|
+
}, [
|
|
1841
|
+
x,
|
|
1842
|
+
w,
|
|
1843
|
+
n,
|
|
1844
|
+
g.cursorPosition,
|
|
1845
|
+
i,
|
|
1846
|
+
a,
|
|
1847
|
+
o,
|
|
1848
|
+
r,
|
|
1849
|
+
S
|
|
1850
|
+
]), E = s(() => {
|
|
1851
|
+
if (!b.current) return;
|
|
1852
|
+
let e = b.current.selectionStart || 0, { context: t, token: r } = $(n, e);
|
|
1853
|
+
a(t), o(r), S((t) => ({
|
|
1854
|
+
...t,
|
|
1855
|
+
isVisible: !Ft(n, e),
|
|
1856
|
+
cursorPosition: e
|
|
1857
|
+
}));
|
|
1858
|
+
}, [
|
|
1859
|
+
n,
|
|
1860
|
+
a,
|
|
1861
|
+
o,
|
|
1862
|
+
S
|
|
1863
|
+
]), D = s((e) => {
|
|
1864
|
+
let { key: t } = e;
|
|
1865
|
+
if (g.isVisible) {
|
|
1866
|
+
let n = x.length;
|
|
1867
|
+
switch (t) {
|
|
1868
|
+
case "Tab":
|
|
1869
|
+
case "ArrowDown":
|
|
1870
|
+
e.preventDefault(), S({ highlightedIndex: (g.highlightedIndex + 1) % n });
|
|
1871
|
+
return;
|
|
1872
|
+
case "ArrowUp":
|
|
1873
|
+
e.preventDefault(), S({ highlightedIndex: g.highlightedIndex <= 0 ? n - 1 : g.highlightedIndex - 1 });
|
|
1874
|
+
return;
|
|
1875
|
+
case "Enter":
|
|
1876
|
+
e.preventDefault(), g.highlightedIndex >= 0 ? T(g.highlightedIndex) : S({ isVisible: !1 });
|
|
1877
|
+
return;
|
|
1878
|
+
case "Escape":
|
|
1879
|
+
e.preventDefault(), S({
|
|
1880
|
+
isVisible: !1,
|
|
1881
|
+
highlightedIndex: -1
|
|
1882
|
+
});
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
(t === "ArrowLeft" || t === "ArrowRight" || t === "Home" || t === "End") && setTimeout(E, 0);
|
|
1887
|
+
}, [
|
|
1888
|
+
g,
|
|
1889
|
+
x.length,
|
|
1890
|
+
S,
|
|
1891
|
+
T,
|
|
1892
|
+
E
|
|
1893
|
+
]), O = s((e) => {
|
|
1894
|
+
let { key: t } = e;
|
|
1895
|
+
(t === "ArrowLeft" || t === "ArrowRight" || t === "Home" || t === "End") && E();
|
|
1896
|
+
}, [E]), A = s(() => {
|
|
1897
|
+
S({
|
|
1898
|
+
isVisible: !0,
|
|
1899
|
+
highlightedIndex: 0
|
|
1900
|
+
});
|
|
1901
|
+
}, [S]), te = s((e) => {
|
|
1902
|
+
let t = b.current?.selectionStart || e.length, { context: n, token: i } = $(e, t);
|
|
1903
|
+
a(n), o(i), r(e), S({
|
|
1904
|
+
highlightedIndex: 0,
|
|
1905
|
+
isVisible: !Ft(e, t),
|
|
1906
|
+
showingMore: !1,
|
|
1907
|
+
cursorPosition: t
|
|
1908
|
+
});
|
|
1909
|
+
}, [
|
|
1910
|
+
a,
|
|
1911
|
+
o,
|
|
1912
|
+
r,
|
|
1913
|
+
S
|
|
1914
|
+
]), ne = s(() => {
|
|
1915
|
+
setTimeout(E, 0);
|
|
1916
|
+
}, [E]), j = s(() => {
|
|
1917
|
+
S({
|
|
1918
|
+
isVisible: !1,
|
|
1919
|
+
highlightedIndex: -1
|
|
1920
|
+
});
|
|
1921
|
+
}, [S]), N = s((e) => {
|
|
1922
|
+
S({ highlightedIndex: e });
|
|
1923
|
+
}, [S]);
|
|
1924
|
+
return l(() => (document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C)), [C]), /* @__PURE__ */ F("div", {
|
|
1925
|
+
className: M("p-query-input", e),
|
|
1926
|
+
"data-testid": "p-query-input",
|
|
1927
|
+
ref: v,
|
|
1928
|
+
...p,
|
|
1929
|
+
children: [/* @__PURE__ */ P(ee, {
|
|
1930
|
+
disabled: t,
|
|
1931
|
+
placeholder: d,
|
|
1932
|
+
value: n,
|
|
1933
|
+
externallyControlled: !0,
|
|
1934
|
+
autoComplete: "off",
|
|
1935
|
+
id: "query-input",
|
|
1936
|
+
name: "query-input",
|
|
1937
|
+
ref: b,
|
|
1938
|
+
onFocus: A,
|
|
1939
|
+
onChange: te,
|
|
1940
|
+
onKeyDown: D,
|
|
1941
|
+
onKeyUp: O,
|
|
1942
|
+
onClear: j,
|
|
1943
|
+
onClick: ne,
|
|
1944
|
+
"aria-disabled": t,
|
|
1945
|
+
"aria-expanded": g.isVisible,
|
|
1946
|
+
"aria-haspopup": "listbox",
|
|
1947
|
+
"aria-owns": "query-suggestions"
|
|
1948
|
+
}), g.isVisible && c.length > 0 && /* @__PURE__ */ P("ul", {
|
|
1949
|
+
className: "p-query-input__list",
|
|
1950
|
+
ref: y,
|
|
1951
|
+
id: "query-suggestions",
|
|
1952
|
+
role: "listbox",
|
|
1953
|
+
"aria-label": "Search suggestions",
|
|
1954
|
+
children: u ? /* @__PURE__ */ P("div", {
|
|
1955
|
+
className: "p-query-input__loading",
|
|
1956
|
+
children: /* @__PURE__ */ P(k, { text: "Loading..." })
|
|
1957
|
+
}) : x.map((e, t) => /* @__PURE__ */ F("li", {
|
|
1958
|
+
className: M("p-query-input__item", { highlight: t === g.highlightedIndex }),
|
|
1959
|
+
onClick: () => T(t),
|
|
1960
|
+
onKeyDown: () => T(t),
|
|
1961
|
+
onMouseEnter: () => N(t),
|
|
1962
|
+
role: "option",
|
|
1963
|
+
"aria-selected": t === g.highlightedIndex,
|
|
1964
|
+
tabIndex: -1,
|
|
1965
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1966
|
+
className: "p-query-input__item-label",
|
|
1967
|
+
children: [/* @__PURE__ */ P("span", {
|
|
1968
|
+
className: M({ "u-text--muted": e.type === "more" }),
|
|
1969
|
+
children: e.value
|
|
1970
|
+
}), e.type === "filter" && /* @__PURE__ */ P("span", {
|
|
1971
|
+
className: "u-text--muted",
|
|
1972
|
+
children: ":()"
|
|
1973
|
+
})]
|
|
1974
|
+
}), e.type !== "more" && /* @__PURE__ */ P("span", {
|
|
1975
|
+
className: "u-text--muted u-align-text--right",
|
|
1976
|
+
children: e.type
|
|
1977
|
+
})]
|
|
1978
|
+
}, `${e.value}-${t}`))
|
|
1979
|
+
})]
|
|
1980
|
+
});
|
|
1981
|
+
}, Lt = ({ value: e, unit: t }, { binary: n = !1, convertTo: r, decimals: i = 2, roundFunc: a = "round" } = {}) => {
|
|
1982
|
+
let o = e < 0, s = Math.abs(e);
|
|
1983
|
+
if (s === 0) return {
|
|
1984
|
+
value: 0,
|
|
1985
|
+
unit: r || "B"
|
|
1986
|
+
};
|
|
1987
|
+
let c = n ? 1024 : 1e3, l = n ? [
|
|
1988
|
+
"B",
|
|
1989
|
+
"KiB",
|
|
1990
|
+
"MiB",
|
|
1991
|
+
"GiB",
|
|
1992
|
+
"TiB",
|
|
1993
|
+
"PiB",
|
|
1994
|
+
"EiB",
|
|
1995
|
+
"ZiB",
|
|
1996
|
+
"YiB"
|
|
1997
|
+
] : [
|
|
1998
|
+
"B",
|
|
1999
|
+
"KB",
|
|
2000
|
+
"MB",
|
|
2001
|
+
"GB",
|
|
2002
|
+
"TB",
|
|
2003
|
+
"PB",
|
|
2004
|
+
"EB",
|
|
2005
|
+
"ZB",
|
|
2006
|
+
"YB"
|
|
2007
|
+
], u = s * c ** +(l.findIndex((e) => e === t) || 0), d = r ? l.findIndex((e) => e === r) : Math.floor(Math.log(u) / Math.log(c)), f = u / c ** +d;
|
|
2008
|
+
if (f % 1 != 0) {
|
|
2009
|
+
let e = 10 ** i;
|
|
2010
|
+
f = Math[a](f * e) / e;
|
|
2011
|
+
}
|
|
2012
|
+
return {
|
|
2013
|
+
value: o ? -f : f,
|
|
2014
|
+
unit: l[d]
|
|
2015
|
+
};
|
|
2016
|
+
};
|
|
2017
|
+
//#endregion
|
|
2018
|
+
export { H as A, W as C, fe as D, he as E, le as O, G as S, ge as T, we as _, dt as a, q as b, rt as c, et as d, Qe as f, Te as g, Ae as h, ht as i, L as k, tt as l, Xe as m, It as n, ct as o, Y as p, jt as r, st as s, Lt as t, $e as u, J as v, U as w, _e as x, be as y };
|