@apliteni/apliteni-ui 0.147.0 → 0.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/guidelines/account-and-settings.md +5 -7
- package/guidelines/dense-tables.md +18 -4
- package/guidelines/density-and-accents.md +1 -1
- package/guidelines/going-back.md +5 -5
- package/guidelines/the-page.md +2 -0
- package/package.json +1 -2
- package/react/README.md +7 -16
- package/react/dist/index.css +121 -0
- package/react/dist/index.d.ts +44 -23
- package/react/dist/index.js +1245 -987
- package/src/assets/icons.js +10 -0
- package/src/logic/dropdown-placement.js +17 -1
- package/src/styles/back.css +2 -2
- package/src/styles/card.css +43 -0
- package/src/styles/dropdown.css +14 -0
- package/src/styles/layout.css +7 -3
- package/src/styles/nav.css +3 -38
- package/src/styles/table.css +33 -110
- package/src/tokens/tokens.css +12 -0
package/react/dist/index.js
CHANGED
|
@@ -1108,10 +1108,376 @@ function Feedback({
|
|
|
1108
1108
|
] }), document.body);
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
|
-
// src/
|
|
1112
|
-
import { useId as
|
|
1111
|
+
// src/AccountWindow.tsx
|
|
1112
|
+
import { useEffect as useEffect7, useId as useId7, useRef as useRef9, useState as useState6 } from "react";
|
|
1113
1113
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1114
|
-
import {
|
|
1114
|
+
import { revealFocusedNav as revealFocusedNav2 } from "@apliteni/apliteni-ui";
|
|
1115
|
+
|
|
1116
|
+
// src/NavTabs.tsx
|
|
1117
|
+
import { Fragment as Fragment6, forwardRef as forwardRef6, useEffect as useEffect4, useRef as useRef7, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
1118
|
+
import { safeUrl as safeUrl2, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
1119
|
+
import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1120
|
+
var NavTabs = forwardRef6(function NavTabs2({
|
|
1121
|
+
items,
|
|
1122
|
+
active,
|
|
1123
|
+
variant = "underline",
|
|
1124
|
+
renderLink,
|
|
1125
|
+
className,
|
|
1126
|
+
onFocus,
|
|
1127
|
+
"aria-label": ariaLabel = "Tabs",
|
|
1128
|
+
...rest
|
|
1129
|
+
}, ref) {
|
|
1130
|
+
const navRef = useRef7(null);
|
|
1131
|
+
useImperativeHandle2(ref, () => navRef.current, []);
|
|
1132
|
+
const signature = items.map((item) => item.id).join("\0");
|
|
1133
|
+
useEffect4(() => observeNavFit(navRef.current), []);
|
|
1134
|
+
useEffect4(() => {
|
|
1135
|
+
if (navRef.current) revealCurrentNav(navRef.current);
|
|
1136
|
+
}, [active, signature]);
|
|
1137
|
+
return /* @__PURE__ */ jsx16(
|
|
1138
|
+
"nav",
|
|
1139
|
+
{
|
|
1140
|
+
...rest,
|
|
1141
|
+
ref: navRef,
|
|
1142
|
+
className: ["ui-nav", "ui-nav--tabs", `is-${variant}`, className].filter(Boolean).join(" "),
|
|
1143
|
+
"aria-label": ariaLabel,
|
|
1144
|
+
onFocus: (event) => {
|
|
1145
|
+
if (navRef.current) revealFocusedNav(navRef.current, event.target);
|
|
1146
|
+
onFocus?.(event);
|
|
1147
|
+
},
|
|
1148
|
+
children: items.map((item) => {
|
|
1149
|
+
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
1150
|
+
const inner = /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
1151
|
+
/* @__PURE__ */ jsx16("span", { className: "ui-nav__tab-label", children: item.label }),
|
|
1152
|
+
badge.text != null && badge.text !== "" && /* @__PURE__ */ jsx16("span", { className: `ui-nav__badge is-${badge.tone || "neutral"}`, children: badge.text })
|
|
1153
|
+
] });
|
|
1154
|
+
if (item.disabled) return /* @__PURE__ */ jsx16("span", { className: "ui-nav__tab is-disabled", "aria-disabled": "true", children: inner }, item.id);
|
|
1155
|
+
const current = item.id === active;
|
|
1156
|
+
const linkProps = {
|
|
1157
|
+
className: ["ui-nav__tab", current && "is-active"].filter(Boolean).join(" "),
|
|
1158
|
+
href: safeUrl2(item.href || `#${item.id}`),
|
|
1159
|
+
target: item.target,
|
|
1160
|
+
"aria-current": current ? "page" : void 0,
|
|
1161
|
+
children: inner
|
|
1162
|
+
};
|
|
1163
|
+
return /* @__PURE__ */ jsx16(Fragment6, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx16("a", { ...linkProps }) }, item.id);
|
|
1164
|
+
})
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
// src/SidebarNav.tsx
|
|
1170
|
+
import { forwardRef as forwardRef7, useEffect as useEffect5, useId as useId5, useState as useState5 } from "react";
|
|
1171
|
+
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
1172
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1173
|
+
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
1174
|
+
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
1175
|
+
const uid = useId5();
|
|
1176
|
+
const group = !sub && !!item.items?.length;
|
|
1177
|
+
const childActive = group && item.items.some((child) => child.id === active);
|
|
1178
|
+
const [expanded, setExpanded] = useState5();
|
|
1179
|
+
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
1180
|
+
const [entering, setEntering] = useState5(false);
|
|
1181
|
+
useEffect5(() => {
|
|
1182
|
+
if (!entering) return;
|
|
1183
|
+
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
1184
|
+
return () => clearTimeout(timer);
|
|
1185
|
+
}, [entering]);
|
|
1186
|
+
const count = badgeText(item.badge);
|
|
1187
|
+
const name = `${item.label}${count == null || count === "" ? "" : ` ${count}`}`;
|
|
1188
|
+
const isActive = !group && item.id === active;
|
|
1189
|
+
const className = [
|
|
1190
|
+
"ui-nav__item",
|
|
1191
|
+
sub && "ui-nav__item--sub",
|
|
1192
|
+
group && "ui-nav__toggle",
|
|
1193
|
+
isActive && "is-active",
|
|
1194
|
+
childActive && "is-current",
|
|
1195
|
+
item.disabled && "is-disabled",
|
|
1196
|
+
item.danger && "is-danger"
|
|
1197
|
+
].filter(Boolean).join(" ");
|
|
1198
|
+
const children = /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
1199
|
+
(item.leading ?? item.icon) && /* @__PURE__ */ jsx17("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx17(Icon, { name: item.icon }) }),
|
|
1200
|
+
/* @__PURE__ */ jsx17("span", { className: "ui-nav__label", children: item.label }),
|
|
1201
|
+
count != null && count !== "" && /* @__PURE__ */ jsx17("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
1202
|
+
group && /* @__PURE__ */ jsx17("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
1203
|
+
] });
|
|
1204
|
+
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
1205
|
+
if (group) return /* @__PURE__ */ jsxs13("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
1206
|
+
/* @__PURE__ */ jsx17(
|
|
1207
|
+
"button",
|
|
1208
|
+
{
|
|
1209
|
+
...common,
|
|
1210
|
+
type: "button",
|
|
1211
|
+
disabled: item.disabled,
|
|
1212
|
+
"aria-expanded": open,
|
|
1213
|
+
"aria-controls": uid,
|
|
1214
|
+
onClick: () => {
|
|
1215
|
+
setExpanded(!open);
|
|
1216
|
+
setEntering(!open);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
),
|
|
1220
|
+
/* @__PURE__ */ jsx17("ul", { id: uid, className: `ui-nav__sub${entering ? " is-entering" : ""}`, hidden: !open, onAnimationEnd: () => setEntering(false), children: item.items.map((child) => /* @__PURE__ */ jsx17(Row, { item: child, active, activeIs, collapsed, renderLink, sub: true }, child.id)) })
|
|
1221
|
+
] });
|
|
1222
|
+
if (item.disabled) return /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsx17("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
1223
|
+
const props = {
|
|
1224
|
+
...common,
|
|
1225
|
+
href: item.href ?? `#${item.id}`,
|
|
1226
|
+
target: item.target,
|
|
1227
|
+
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
1228
|
+
};
|
|
1229
|
+
return /* @__PURE__ */ jsx17("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx17("a", { ...props }) });
|
|
1230
|
+
}
|
|
1231
|
+
function Section({ section, ...props }) {
|
|
1232
|
+
const uid = useId5();
|
|
1233
|
+
return /* @__PURE__ */ jsxs13("div", { className: "ui-nav__section", children: [
|
|
1234
|
+
section.label && /* @__PURE__ */ jsx17("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
1235
|
+
/* @__PURE__ */ jsx17("ul", { className: "ui-nav__list", "aria-labelledby": section.label ? uid : void 0, children: section.items.map((item) => /* @__PURE__ */ jsx17(Row, { item, ...props }, item.id)) })
|
|
1236
|
+
] });
|
|
1237
|
+
}
|
|
1238
|
+
var SidebarNav = forwardRef7(function SidebarNav2({
|
|
1239
|
+
items = [],
|
|
1240
|
+
sections,
|
|
1241
|
+
active,
|
|
1242
|
+
activeIs = "page",
|
|
1243
|
+
collapsed = false,
|
|
1244
|
+
footer,
|
|
1245
|
+
renderLink,
|
|
1246
|
+
className,
|
|
1247
|
+
"aria-label": label = "Sidebar",
|
|
1248
|
+
...rest
|
|
1249
|
+
}, ref) {
|
|
1250
|
+
return /* @__PURE__ */ jsxs13("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
1251
|
+
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx17(
|
|
1252
|
+
Section,
|
|
1253
|
+
{
|
|
1254
|
+
section,
|
|
1255
|
+
active,
|
|
1256
|
+
activeIs,
|
|
1257
|
+
collapsed,
|
|
1258
|
+
renderLink
|
|
1259
|
+
},
|
|
1260
|
+
index
|
|
1261
|
+
)),
|
|
1262
|
+
footer && /* @__PURE__ */ jsx17("div", { className: "ui-nav__foot", children: footer })
|
|
1263
|
+
] });
|
|
1264
|
+
});
|
|
1265
|
+
|
|
1266
|
+
// src/Tabs.tsx
|
|
1267
|
+
import { useEffect as useEffect6, useId as useId6, useRef as useRef8 } from "react";
|
|
1268
|
+
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
1269
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1270
|
+
function tabKeyIndex(key, i, count) {
|
|
1271
|
+
switch (key) {
|
|
1272
|
+
case "ArrowRight":
|
|
1273
|
+
return (i + 1) % count;
|
|
1274
|
+
case "ArrowLeft":
|
|
1275
|
+
return (i - 1 + count) % count;
|
|
1276
|
+
case "Home":
|
|
1277
|
+
return 0;
|
|
1278
|
+
case "End":
|
|
1279
|
+
return count - 1;
|
|
1280
|
+
default:
|
|
1281
|
+
return void 0;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
function Tabs({ items, value, onChange, label }) {
|
|
1285
|
+
const id = useId6();
|
|
1286
|
+
const previous = useRef8(value);
|
|
1287
|
+
const activePanel = useRef8(null);
|
|
1288
|
+
const buttons = useRef8([]);
|
|
1289
|
+
useEffect6(() => {
|
|
1290
|
+
if (previous.current !== value) playEntrance(activePanel.current);
|
|
1291
|
+
previous.current = value;
|
|
1292
|
+
}, [value]);
|
|
1293
|
+
return /* @__PURE__ */ jsxs14("div", { className: "ui-tabs", children: [
|
|
1294
|
+
/* @__PURE__ */ jsx18("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */ jsxs14(
|
|
1295
|
+
"button",
|
|
1296
|
+
{
|
|
1297
|
+
type: "button",
|
|
1298
|
+
role: "tab",
|
|
1299
|
+
ref: (el) => {
|
|
1300
|
+
buttons.current[i] = el;
|
|
1301
|
+
},
|
|
1302
|
+
className: `ui-tabs__tab${item.value === value ? " is-active" : ""}`,
|
|
1303
|
+
id: `${id}-tab-${i}`,
|
|
1304
|
+
"aria-controls": `${id}-panel-${i}`,
|
|
1305
|
+
"aria-selected": item.value === value,
|
|
1306
|
+
tabIndex: item.value === value ? 0 : -1,
|
|
1307
|
+
onClick: () => onChange(item.value),
|
|
1308
|
+
onKeyDown: (event) => {
|
|
1309
|
+
const next = tabKeyIndex(event.key, i, items.length);
|
|
1310
|
+
if (next === void 0) return;
|
|
1311
|
+
event.preventDefault();
|
|
1312
|
+
buttons.current[next]?.focus();
|
|
1313
|
+
onChange(items[next].value);
|
|
1314
|
+
},
|
|
1315
|
+
children: [
|
|
1316
|
+
item.label,
|
|
1317
|
+
item.count != null && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
1318
|
+
" ",
|
|
1319
|
+
item.count
|
|
1320
|
+
] })
|
|
1321
|
+
]
|
|
1322
|
+
},
|
|
1323
|
+
item.value
|
|
1324
|
+
)) }),
|
|
1325
|
+
/* @__PURE__ */ jsx18("div", { className: "ui-tabs__panels", children: items.map((item, i) => /* @__PURE__ */ jsx18(
|
|
1326
|
+
"div",
|
|
1327
|
+
{
|
|
1328
|
+
className: "ui-tabs__panel",
|
|
1329
|
+
role: "tabpanel",
|
|
1330
|
+
ref: item.value === value ? activePanel : void 0,
|
|
1331
|
+
id: `${id}-panel-${i}`,
|
|
1332
|
+
"aria-labelledby": `${id}-tab-${i}`,
|
|
1333
|
+
tabIndex: 0,
|
|
1334
|
+
hidden: item.value !== value,
|
|
1335
|
+
children: item.value === value ? item.panel : null
|
|
1336
|
+
},
|
|
1337
|
+
item.value
|
|
1338
|
+
)) })
|
|
1339
|
+
] });
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// src/AccountWindow.tsx
|
|
1343
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1344
|
+
function AccountWindow({
|
|
1345
|
+
open,
|
|
1346
|
+
onClose,
|
|
1347
|
+
reader,
|
|
1348
|
+
sections,
|
|
1349
|
+
section,
|
|
1350
|
+
defaultSection: defaultSection2,
|
|
1351
|
+
onSectionChange,
|
|
1352
|
+
label = "Account"
|
|
1353
|
+
}) {
|
|
1354
|
+
const titleId = useId7();
|
|
1355
|
+
const root = useRef9(null);
|
|
1356
|
+
const panel = useRef9(null);
|
|
1357
|
+
const body = useRef9(null);
|
|
1358
|
+
const tabs = useRef9(null);
|
|
1359
|
+
const [own, setOwn] = useState6(defaultSection2 ?? sections[0]?.id);
|
|
1360
|
+
const { mounted, shown } = usePresence(open, root, panel);
|
|
1361
|
+
const scope = useDialog(shown, { root, panel, body }, onClose);
|
|
1362
|
+
const currentId = section ?? own;
|
|
1363
|
+
useEffect7(() => {
|
|
1364
|
+
const nav = tabs.current;
|
|
1365
|
+
if (nav) revealFocusedNav2(nav, nav.querySelector('[aria-selected="true"]'));
|
|
1366
|
+
}, [mounted, currentId]);
|
|
1367
|
+
if (!mounted) return null;
|
|
1368
|
+
const current = sections.find((s) => s.id === currentId) ?? sections[0];
|
|
1369
|
+
const select = (id) => {
|
|
1370
|
+
if (section === void 0) setOwn(id);
|
|
1371
|
+
onSectionChange?.(id);
|
|
1372
|
+
};
|
|
1373
|
+
const asButton = (id, { href: _href, target: _target, ...props }) => /* @__PURE__ */ jsx19(
|
|
1374
|
+
"button",
|
|
1375
|
+
{
|
|
1376
|
+
...props,
|
|
1377
|
+
type: "button",
|
|
1378
|
+
"aria-current": id === current?.id ? "true" : void 0,
|
|
1379
|
+
onClick: () => select(id)
|
|
1380
|
+
}
|
|
1381
|
+
);
|
|
1382
|
+
const tabId = (i) => `${titleId}-tab-${i}`;
|
|
1383
|
+
const asTab = (i, { href: _href, target: _target, "aria-current": _current, ...props }) => {
|
|
1384
|
+
const selected = sections[i].id === current?.id;
|
|
1385
|
+
return /* @__PURE__ */ jsx19(
|
|
1386
|
+
"button",
|
|
1387
|
+
{
|
|
1388
|
+
...props,
|
|
1389
|
+
type: "button",
|
|
1390
|
+
role: "tab",
|
|
1391
|
+
id: tabId(i),
|
|
1392
|
+
"aria-selected": selected,
|
|
1393
|
+
"aria-controls": `${titleId}-panel`,
|
|
1394
|
+
tabIndex: selected ? 0 : -1,
|
|
1395
|
+
onClick: () => select(sections[i].id),
|
|
1396
|
+
onKeyDown: (event) => {
|
|
1397
|
+
const next = tabKeyIndex(event.key, i, sections.length);
|
|
1398
|
+
if (next === void 0) return;
|
|
1399
|
+
event.preventDefault();
|
|
1400
|
+
document.getElementById(tabId(next))?.focus();
|
|
1401
|
+
select(sections[next].id);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
);
|
|
1405
|
+
};
|
|
1406
|
+
const close = /* @__PURE__ */ jsx19(Button, { variant: "ghost", size: "sm", iconOnly: true, icon: "x", "aria-label": "Close", onClick: onClose });
|
|
1407
|
+
const items = sections.map(({ id, label: label2, icon: icon9 }) => ({ id, label: label2, icon: icon9 }));
|
|
1408
|
+
return createPortal3(
|
|
1409
|
+
/* @__PURE__ */ jsx19(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsx19("div", { className: shown ? "rx-scrim is-open" : "rx-scrim", ref: root, onMouseDown: dismissOnScrim(onClose), children: /* @__PURE__ */ jsxs15(
|
|
1410
|
+
"div",
|
|
1411
|
+
{
|
|
1412
|
+
className: "rx-modal rx-account",
|
|
1413
|
+
role: "dialog",
|
|
1414
|
+
"aria-modal": "true",
|
|
1415
|
+
"aria-label": label,
|
|
1416
|
+
tabIndex: -1,
|
|
1417
|
+
ref: panel,
|
|
1418
|
+
children: [
|
|
1419
|
+
/* @__PURE__ */ jsxs15("div", { className: "rx-account__rail", children: [
|
|
1420
|
+
/* @__PURE__ */ jsxs15("div", { className: "rx-account__who", children: [
|
|
1421
|
+
/* @__PURE__ */ jsx19("span", { className: "rx-account__av", children: /* @__PURE__ */ jsx19(Avatar, { personKey: reader.personKey, name: reader.name, src: reader.avatarSrc, size: 32 }) }),
|
|
1422
|
+
/* @__PURE__ */ jsxs15("span", { className: "ui-app__who", children: [
|
|
1423
|
+
/* @__PURE__ */ jsx19("b", { children: reader.name }),
|
|
1424
|
+
/* @__PURE__ */ jsx19("span", { children: reader.email })
|
|
1425
|
+
] }),
|
|
1426
|
+
close
|
|
1427
|
+
] }),
|
|
1428
|
+
/* @__PURE__ */ jsx19(
|
|
1429
|
+
SidebarNav,
|
|
1430
|
+
{
|
|
1431
|
+
className: "rx-account__side",
|
|
1432
|
+
"aria-label": label,
|
|
1433
|
+
items,
|
|
1434
|
+
active: current?.id,
|
|
1435
|
+
activeIs: "section",
|
|
1436
|
+
renderLink: (item, props) => asButton(item.id, props)
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
/* @__PURE__ */ jsx19(
|
|
1440
|
+
NavTabs,
|
|
1441
|
+
{
|
|
1442
|
+
className: "rx-account__tabs",
|
|
1443
|
+
role: "tablist",
|
|
1444
|
+
"aria-label": label,
|
|
1445
|
+
items,
|
|
1446
|
+
active: current?.id,
|
|
1447
|
+
ref: tabs,
|
|
1448
|
+
renderLink: (item, props) => asTab(sections.findIndex((s) => s.id === item.id), props)
|
|
1449
|
+
}
|
|
1450
|
+
)
|
|
1451
|
+
] }),
|
|
1452
|
+
/* @__PURE__ */ jsxs15("div", { className: "rx-account__pane", children: [
|
|
1453
|
+
/* @__PURE__ */ jsxs15("div", { className: "rx-modal__head rx-account__head", children: [
|
|
1454
|
+
/* @__PURE__ */ jsx19("h2", { className: "rx-account__title", id: titleId, children: current?.label }),
|
|
1455
|
+
close
|
|
1456
|
+
] }),
|
|
1457
|
+
/* @__PURE__ */ jsx19(
|
|
1458
|
+
"div",
|
|
1459
|
+
{
|
|
1460
|
+
className: "rx-modal__body rx-account__body",
|
|
1461
|
+
ref: body,
|
|
1462
|
+
id: `${titleId}-panel`,
|
|
1463
|
+
role: "tabpanel",
|
|
1464
|
+
"aria-labelledby": tabId(sections.findIndex((s) => s.id === current?.id)),
|
|
1465
|
+
children: current?.content
|
|
1466
|
+
},
|
|
1467
|
+
current?.id
|
|
1468
|
+
)
|
|
1469
|
+
] })
|
|
1470
|
+
]
|
|
1471
|
+
}
|
|
1472
|
+
) }) }),
|
|
1473
|
+
document.body
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// src/Drawer.tsx
|
|
1478
|
+
import { useId as useId8, useRef as useRef10 } from "react";
|
|
1479
|
+
import { createPortal as createPortal4 } from "react-dom";
|
|
1480
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1115
1481
|
function Drawer({
|
|
1116
1482
|
open,
|
|
1117
1483
|
title,
|
|
@@ -1124,18 +1490,18 @@ function Drawer({
|
|
|
1124
1490
|
closeLabel = "Close",
|
|
1125
1491
|
initialFocusRef
|
|
1126
1492
|
}) {
|
|
1127
|
-
const root =
|
|
1128
|
-
const panel =
|
|
1129
|
-
const body =
|
|
1130
|
-
const titleId =
|
|
1493
|
+
const root = useRef10(null);
|
|
1494
|
+
const panel = useRef10(null);
|
|
1495
|
+
const body = useRef10(null);
|
|
1496
|
+
const titleId = useId8();
|
|
1131
1497
|
const { mounted, shown } = usePresence(open, root, panel);
|
|
1132
1498
|
const scope = useDialog(shown, { root, panel, body, initialFocus: initialFocusRef }, onClose);
|
|
1133
1499
|
if (!mounted) return null;
|
|
1134
1500
|
const cls = ["ui-drawer", `ui-drawer--${side}`, `ui-drawer--${size}`, shown && "is-open"].filter(Boolean).join(" ");
|
|
1135
|
-
return
|
|
1136
|
-
/* @__PURE__ */
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1501
|
+
return createPortal4(
|
|
1502
|
+
/* @__PURE__ */ jsx20(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs16("div", { className: cls, ref: root, children: [
|
|
1503
|
+
/* @__PURE__ */ jsx20("div", { className: "ui-drawer__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
1504
|
+
/* @__PURE__ */ jsxs16(
|
|
1139
1505
|
"aside",
|
|
1140
1506
|
{
|
|
1141
1507
|
className: "ui-drawer__panel",
|
|
@@ -1145,13 +1511,13 @@ function Drawer({
|
|
|
1145
1511
|
tabIndex: -1,
|
|
1146
1512
|
ref: panel,
|
|
1147
1513
|
children: [
|
|
1148
|
-
/* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
headerActions && /* @__PURE__ */
|
|
1151
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ jsxs16("header", { className: "ui-drawer__header", children: [
|
|
1515
|
+
/* @__PURE__ */ jsx20("h2", { className: "ui-drawer__title", id: titleId, children: title }),
|
|
1516
|
+
headerActions && /* @__PURE__ */ jsx20("div", { className: "ui-drawer__actions", children: headerActions }),
|
|
1517
|
+
/* @__PURE__ */ jsx20("button", { type: "button", className: "ui-drawer__close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx20(Icon, { name: "x" }) })
|
|
1152
1518
|
] }),
|
|
1153
|
-
/* @__PURE__ */
|
|
1154
|
-
footer && /* @__PURE__ */
|
|
1519
|
+
/* @__PURE__ */ jsx20("div", { className: "ui-drawer__body", ref: body, children }),
|
|
1520
|
+
footer && /* @__PURE__ */ jsx20("footer", { className: "ui-drawer__footer", children: footer })
|
|
1155
1521
|
]
|
|
1156
1522
|
}
|
|
1157
1523
|
)
|
|
@@ -1161,12 +1527,12 @@ function Drawer({
|
|
|
1161
1527
|
}
|
|
1162
1528
|
|
|
1163
1529
|
// src/CommandPalette.tsx
|
|
1164
|
-
import { useCallback as useCallback2, useEffect as
|
|
1165
|
-
import { createPortal as
|
|
1530
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useId as useId9, useMemo, useRef as useRef11, useState as useState7 } from "react";
|
|
1531
|
+
import { createPortal as createPortal5 } from "react-dom";
|
|
1166
1532
|
import { rankGroups, icon as icon3 } from "@apliteni/apliteni-ui";
|
|
1167
|
-
import { jsx as
|
|
1533
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1168
1534
|
var cx2 = (...a) => a.filter(Boolean).join(" ");
|
|
1169
|
-
var Glyph = ({ name, className }) => /* @__PURE__ */
|
|
1535
|
+
var Glyph = ({ name, className }) => /* @__PURE__ */ jsx21("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon3(name) } });
|
|
1170
1536
|
var keysOf = (shortcut) => shortcut == null ? [] : Array.isArray(shortcut) ? shortcut : [shortcut];
|
|
1171
1537
|
function CommandPalette({
|
|
1172
1538
|
open,
|
|
@@ -1181,13 +1547,13 @@ function CommandPalette({
|
|
|
1181
1547
|
rank = true,
|
|
1182
1548
|
onQueryChange
|
|
1183
1549
|
}) {
|
|
1184
|
-
const uid =
|
|
1185
|
-
const root =
|
|
1186
|
-
const panel =
|
|
1187
|
-
const search =
|
|
1188
|
-
const [query, setQuery] =
|
|
1189
|
-
const [at, setAt] =
|
|
1190
|
-
|
|
1550
|
+
const uid = useId9().replace(/:/g, "");
|
|
1551
|
+
const root = useRef11(null);
|
|
1552
|
+
const panel = useRef11(null);
|
|
1553
|
+
const search = useRef11(null);
|
|
1554
|
+
const [query, setQuery] = useState7("");
|
|
1555
|
+
const [at, setAt] = useState7(0);
|
|
1556
|
+
useEffect8(() => {
|
|
1191
1557
|
if (open) {
|
|
1192
1558
|
setQuery("");
|
|
1193
1559
|
setAt(0);
|
|
@@ -1199,7 +1565,7 @@ function CommandPalette({
|
|
|
1199
1565
|
);
|
|
1200
1566
|
const rows = useMemo(() => shown.flatMap((g) => g.items).filter((it) => !isDisabled(it)), [shown]);
|
|
1201
1567
|
const active = rows[Math.min(at, rows.length - 1)];
|
|
1202
|
-
|
|
1568
|
+
useEffect8(() => {
|
|
1203
1569
|
setAt(0);
|
|
1204
1570
|
}, [query]);
|
|
1205
1571
|
const scope = useDialog(open, { root, panel, body: search }, onClose);
|
|
@@ -1230,10 +1596,10 @@ function CommandPalette({
|
|
|
1230
1596
|
if (!open) return null;
|
|
1231
1597
|
const listId = `${uid}-list`;
|
|
1232
1598
|
let n = 0;
|
|
1233
|
-
return
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */
|
|
1599
|
+
return createPortal5(
|
|
1600
|
+
/* @__PURE__ */ jsx21(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs17("div", { className: cx2("ui-cmdk", density === "roomy" && "ui-cmdk--roomy", "is-open"), ref: root, children: [
|
|
1601
|
+
/* @__PURE__ */ jsx21("div", { className: "ui-cmdk__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
1602
|
+
/* @__PURE__ */ jsxs17(
|
|
1237
1603
|
"div",
|
|
1238
1604
|
{
|
|
1239
1605
|
className: "ui-cmdk__panel",
|
|
@@ -1244,9 +1610,9 @@ function CommandPalette({
|
|
|
1244
1610
|
ref: panel,
|
|
1245
1611
|
onKeyDown,
|
|
1246
1612
|
children: [
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsxs17("div", { className: "ui-cmdk__search", ref: search, children: [
|
|
1614
|
+
/* @__PURE__ */ jsx21(Glyph, { name: "search", className: "ui-cmdk__search-ic" }),
|
|
1615
|
+
/* @__PURE__ */ jsx21(
|
|
1250
1616
|
"input",
|
|
1251
1617
|
{
|
|
1252
1618
|
className: "ui-cmdk__input",
|
|
@@ -1268,19 +1634,19 @@ function CommandPalette({
|
|
|
1268
1634
|
}
|
|
1269
1635
|
)
|
|
1270
1636
|
] }),
|
|
1271
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ jsx21("div", { className: "ui-cmdk__list", id: listId, role: "listbox", "aria-label": `${label} results`, children: shown.map((group, gi) => /* @__PURE__ */ jsxs17(
|
|
1272
1638
|
"div",
|
|
1273
1639
|
{
|
|
1274
1640
|
className: "ui-cmdk__group",
|
|
1275
1641
|
role: "group",
|
|
1276
1642
|
"aria-labelledby": group.label ? `${uid}-g${gi}` : void 0,
|
|
1277
1643
|
children: [
|
|
1278
|
-
group.label && /* @__PURE__ */
|
|
1644
|
+
group.label && /* @__PURE__ */ jsx21("div", { className: "ui-cmdk__group-head", id: `${uid}-g${gi}`, children: group.label }),
|
|
1279
1645
|
group.items.map((item) => {
|
|
1280
1646
|
const disabled = isDisabled(item);
|
|
1281
1647
|
const id = `${uid}-o${n++}`;
|
|
1282
1648
|
const on = item === active;
|
|
1283
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ jsxs17(
|
|
1284
1650
|
"div",
|
|
1285
1651
|
{
|
|
1286
1652
|
id,
|
|
@@ -1300,13 +1666,13 @@ function CommandPalette({
|
|
|
1300
1666
|
},
|
|
1301
1667
|
onClick: (e) => run(item, e.metaKey || e.ctrlKey),
|
|
1302
1668
|
children: [
|
|
1303
|
-
item.icon && /* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
item.description && /* @__PURE__ */
|
|
1669
|
+
item.icon && /* @__PURE__ */ jsx21(Glyph, { name: item.icon, className: "ui-cmdk__ic" }),
|
|
1670
|
+
/* @__PURE__ */ jsxs17("span", { className: "ui-cmdk__main", children: [
|
|
1671
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-cmdk__label", children: item.label }),
|
|
1672
|
+
item.description && /* @__PURE__ */ jsx21("span", { className: "ui-cmdk__desc", children: item.description })
|
|
1307
1673
|
] }),
|
|
1308
|
-
item.badge && /* @__PURE__ */
|
|
1309
|
-
keysOf(item.shortcut).length > 0 && /* @__PURE__ */
|
|
1674
|
+
item.badge && /* @__PURE__ */ jsx21("span", { className: "ui-cmdk__badge", children: item.badge }),
|
|
1675
|
+
keysOf(item.shortcut).length > 0 && /* @__PURE__ */ jsx21("span", { className: "ui-cmdk__keys", "aria-hidden": "true", children: keysOf(item.shortcut).map((k) => /* @__PURE__ */ jsx21("kbd", { className: "ui-cmdk__key", children: k }, k)) })
|
|
1310
1676
|
]
|
|
1311
1677
|
},
|
|
1312
1678
|
item.id
|
|
@@ -1316,20 +1682,20 @@ function CommandPalette({
|
|
|
1316
1682
|
},
|
|
1317
1683
|
group.label ?? `g${gi}`
|
|
1318
1684
|
)) }),
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
hint && /* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1685
|
+
/* @__PURE__ */ jsx21("p", { className: "ui-cmdk__empty", hidden: countOf(shown) > 0, children: empty }),
|
|
1686
|
+
/* @__PURE__ */ jsx21("p", { className: "ui-sr", role: "status", "aria-live": "polite", children: countOf(shown) === 0 ? "No results" : `${countOf(shown)} result${countOf(shown) === 1 ? "" : "s"}` }),
|
|
1687
|
+
hint && /* @__PURE__ */ jsxs17("div", { className: "ui-cmdk__foot", "aria-hidden": "true", children: [
|
|
1688
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
1689
|
+
/* @__PURE__ */ jsx21("kbd", { className: "ui-cmdk__key", children: "\u2191" }),
|
|
1690
|
+
/* @__PURE__ */ jsx21("kbd", { className: "ui-cmdk__key", children: "\u2193" }),
|
|
1325
1691
|
" move"
|
|
1326
1692
|
] }),
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
1694
|
+
/* @__PURE__ */ jsx21("kbd", { className: "ui-cmdk__key", children: "\u21B5" }),
|
|
1329
1695
|
" run"
|
|
1330
1696
|
] }),
|
|
1331
|
-
/* @__PURE__ */
|
|
1332
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
1698
|
+
/* @__PURE__ */ jsx21("kbd", { className: "ui-cmdk__key", children: "esc" }),
|
|
1333
1699
|
" close"
|
|
1334
1700
|
] })
|
|
1335
1701
|
] })
|
|
@@ -1354,13 +1720,13 @@ function rowId(uid, groups, item) {
|
|
|
1354
1720
|
}
|
|
1355
1721
|
|
|
1356
1722
|
// src/DataTable.tsx
|
|
1357
|
-
import { Fragment as
|
|
1723
|
+
import { Fragment as Fragment10, useCallback as useCallback3, useEffect as useEffect10, useMemo as useMemo2, useRef as useRef13, useState as useState9 } from "react";
|
|
1358
1724
|
import { DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE2 } from "@apliteni/apliteni-ui";
|
|
1359
1725
|
|
|
1360
1726
|
// src/Pagination.tsx
|
|
1361
|
-
import { useEffect as
|
|
1727
|
+
import { useEffect as useEffect9, useId as useId10, useRef as useRef12, useState as useState8 } from "react";
|
|
1362
1728
|
import { DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1363
|
-
import { jsx as
|
|
1729
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1364
1730
|
var GHOST_SM = "ui-btn ui-btn--ghost ui-btn--sm";
|
|
1365
1731
|
var VARIANTS = ["steps", "numbered", "jump"];
|
|
1366
1732
|
var cx3 = (...a) => a.filter(Boolean).join(" ");
|
|
@@ -1402,11 +1768,11 @@ function Pagination({
|
|
|
1402
1768
|
onPageChange,
|
|
1403
1769
|
onPageSizeChange
|
|
1404
1770
|
}) {
|
|
1405
|
-
const auto =
|
|
1406
|
-
const [draft, setDraft] =
|
|
1407
|
-
const [drafting, setDrafting] =
|
|
1408
|
-
const nav =
|
|
1409
|
-
const pressed =
|
|
1771
|
+
const auto = useId10();
|
|
1772
|
+
const [draft, setDraft] = useState8("");
|
|
1773
|
+
const [drafting, setDrafting] = useState8(false);
|
|
1774
|
+
const nav = useRef12(null);
|
|
1775
|
+
const pressed = useRef12(null);
|
|
1410
1776
|
const uid = id ?? auto;
|
|
1411
1777
|
const kind = VARIANTS.includes(variant) ? variant : "steps";
|
|
1412
1778
|
const size = sizeOf(pageSize, DEFAULT_PAGE_SIZE);
|
|
@@ -1415,7 +1781,7 @@ function Pagination({
|
|
|
1415
1781
|
const rows = counted ? Math.max(0, asRows) : null;
|
|
1416
1782
|
const last = counted ? Math.max(1, Math.ceil(rows / size)) : null;
|
|
1417
1783
|
const at = counted ? Math.min(Math.max(1, int(page, 1)), last) : Math.min(Math.max(1, int(page, 1)), CAP - 1);
|
|
1418
|
-
const [draftFor, setDraftFor] =
|
|
1784
|
+
const [draftFor, setDraftFor] = useState8(at);
|
|
1419
1785
|
if (draftFor !== at) {
|
|
1420
1786
|
setDraftFor(at);
|
|
1421
1787
|
setDraft("");
|
|
@@ -1423,7 +1789,7 @@ function Pagination({
|
|
|
1423
1789
|
}
|
|
1424
1790
|
const offered = (Array.isArray(pageSizes) ? pageSizes : []).slice(0, 12).map((s) => int(s, 0)).filter((s) => s > 0);
|
|
1425
1791
|
const sizes = offered.length ? [.../* @__PURE__ */ new Set([...offered, size])].sort((a, b) => a - b) : [];
|
|
1426
|
-
|
|
1792
|
+
useEffect9(() => {
|
|
1427
1793
|
const was = pressed.current;
|
|
1428
1794
|
if (!was || loading) return;
|
|
1429
1795
|
pressed.current = null;
|
|
@@ -1452,7 +1818,7 @@ function Pagination({
|
|
|
1452
1818
|
const step = (label_, target, disabled) => (
|
|
1453
1819
|
// A control at an end is disabled and stays where it is: removing it slides
|
|
1454
1820
|
// the next control under a pointer already travelling toward it.
|
|
1455
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx22(
|
|
1456
1822
|
"button",
|
|
1457
1823
|
{
|
|
1458
1824
|
type: "button",
|
|
@@ -1491,14 +1857,14 @@ function Pagination({
|
|
|
1491
1857
|
if (single) {
|
|
1492
1858
|
steps = null;
|
|
1493
1859
|
} else if (!counted) {
|
|
1494
|
-
steps = /* @__PURE__ */
|
|
1860
|
+
steps = /* @__PURE__ */ jsxs18("div", { className: "ui-pager__steps", children: [
|
|
1495
1861
|
step("Prev", Math.max(1, at - 1), atStart),
|
|
1496
1862
|
step("Next", at + 1, !hasMore)
|
|
1497
1863
|
] });
|
|
1498
1864
|
} else {
|
|
1499
1865
|
let middle = null;
|
|
1500
1866
|
if (kind === "numbered") {
|
|
1501
|
-
middle = slotsFor(at, last).map((n, i) => n == null ? /* @__PURE__ */
|
|
1867
|
+
middle = slotsFor(at, last).map((n, i) => n == null ? /* @__PURE__ */ jsx22("span", { className: "ui-pager__gap", "aria-hidden": "true", children: "\u2026" }, `gap${i}`) : /* @__PURE__ */ jsx22(
|
|
1502
1868
|
"button",
|
|
1503
1869
|
{
|
|
1504
1870
|
type: "button",
|
|
@@ -1513,9 +1879,9 @@ function Pagination({
|
|
|
1513
1879
|
n
|
|
1514
1880
|
));
|
|
1515
1881
|
} else if (kind === "jump") {
|
|
1516
|
-
middle = /* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1882
|
+
middle = /* @__PURE__ */ jsxs18("span", { className: "ui-pager__jump", children: [
|
|
1883
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: `${uid}-jump`, children: "Page" }),
|
|
1884
|
+
/* @__PURE__ */ jsx22(
|
|
1519
1885
|
"input",
|
|
1520
1886
|
{
|
|
1521
1887
|
className: "ui-input ui-pager__jump-input",
|
|
@@ -1538,13 +1904,13 @@ function Pagination({
|
|
|
1538
1904
|
}
|
|
1539
1905
|
}
|
|
1540
1906
|
),
|
|
1541
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ jsxs18("span", { className: "ui-pager__jump-of", children: [
|
|
1542
1908
|
"of ",
|
|
1543
1909
|
fmt(last)
|
|
1544
1910
|
] })
|
|
1545
1911
|
] });
|
|
1546
1912
|
}
|
|
1547
|
-
steps = /* @__PURE__ */
|
|
1913
|
+
steps = /* @__PURE__ */ jsxs18("div", { className: "ui-pager__steps", children: [
|
|
1548
1914
|
ends ? step("First", 1, atStart) : null,
|
|
1549
1915
|
step("Prev", Math.max(1, at - 1), atStart),
|
|
1550
1916
|
middle,
|
|
@@ -1552,7 +1918,7 @@ function Pagination({
|
|
|
1552
1918
|
ends ? step("Last", last, atEnd) : null
|
|
1553
1919
|
] });
|
|
1554
1920
|
}
|
|
1555
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ jsxs18(
|
|
1556
1922
|
"nav",
|
|
1557
1923
|
{
|
|
1558
1924
|
ref: nav,
|
|
@@ -1560,10 +1926,10 @@ function Pagination({
|
|
|
1560
1926
|
"aria-label": label,
|
|
1561
1927
|
"aria-busy": loading ? true : void 0,
|
|
1562
1928
|
children: [
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
sizes.length ? /* @__PURE__ */
|
|
1565
|
-
/* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1929
|
+
/* @__PURE__ */ jsx22("p", { className: "ui-pager__status", "aria-live": "polite", "aria-atomic": "true", children: status }),
|
|
1930
|
+
sizes.length ? /* @__PURE__ */ jsxs18("div", { className: "ui-pager__size", children: [
|
|
1931
|
+
/* @__PURE__ */ jsx22("label", { className: "ui-pager__size-label", htmlFor: `${uid}-size`, children: "Rows" }),
|
|
1932
|
+
/* @__PURE__ */ jsx22(
|
|
1567
1933
|
"select",
|
|
1568
1934
|
{
|
|
1569
1935
|
className: "ui-select ui-pager__size-select",
|
|
@@ -1571,7 +1937,7 @@ function Pagination({
|
|
|
1571
1937
|
disabled: loading,
|
|
1572
1938
|
value: size,
|
|
1573
1939
|
onChange: (e) => onPageSizeChange?.(Number(e.target.value)),
|
|
1574
|
-
children: sizes.map((s) => /* @__PURE__ */
|
|
1940
|
+
children: sizes.map((s) => /* @__PURE__ */ jsx22("option", { value: s, children: fmt(s) }, s))
|
|
1575
1941
|
}
|
|
1576
1942
|
)
|
|
1577
1943
|
] }) : null,
|
|
@@ -1582,7 +1948,7 @@ function Pagination({
|
|
|
1582
1948
|
}
|
|
1583
1949
|
|
|
1584
1950
|
// src/DataTable.tsx
|
|
1585
|
-
import { Fragment as
|
|
1951
|
+
import { Fragment as Fragment11, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1586
1952
|
var CELL_CLASS = { title: "ui-table__title", code: "ui-table__code", long: "ui-table__long", strong: "ui-table__num--strong", act: "ui-table__act" };
|
|
1587
1953
|
var NO_SORT = { key: void 0, dir: -1 };
|
|
1588
1954
|
function sortTableRows(rows, sort) {
|
|
@@ -1595,7 +1961,6 @@ function DataTable({
|
|
|
1595
1961
|
rows,
|
|
1596
1962
|
zebra = false,
|
|
1597
1963
|
hover = true,
|
|
1598
|
-
stack: stack2 = false,
|
|
1599
1964
|
rowState,
|
|
1600
1965
|
footer,
|
|
1601
1966
|
caption,
|
|
@@ -1625,14 +1990,14 @@ function DataTable({
|
|
|
1625
1990
|
hasMore = false
|
|
1626
1991
|
}) {
|
|
1627
1992
|
const scrollable = stickyHeader || pinnedIdentity;
|
|
1628
|
-
const table =
|
|
1629
|
-
const [pagerHost, setPagerHost] =
|
|
1993
|
+
const table = useRef13(null);
|
|
1994
|
+
const [pagerHost, setPagerHost] = useState9(null);
|
|
1630
1995
|
const holdPagerBox = useCallback3(
|
|
1631
1996
|
(box) => setPagerHost(box?.parentElement ?? null),
|
|
1632
1997
|
[]
|
|
1633
1998
|
);
|
|
1634
|
-
const [strip2, setStrip] =
|
|
1635
|
-
|
|
1999
|
+
const [strip2, setStrip] = useState9();
|
|
2000
|
+
useEffect10(() => {
|
|
1636
2001
|
const el = table.current;
|
|
1637
2002
|
const host = pagerHost;
|
|
1638
2003
|
if (!el || !host || typeof ResizeObserver === "undefined") {
|
|
@@ -1652,16 +2017,16 @@ function DataTable({
|
|
|
1652
2017
|
measure();
|
|
1653
2018
|
return () => observer.disconnect();
|
|
1654
2019
|
}, [pagerHost, columns, rows]);
|
|
1655
|
-
const [localSort, setLocalSort] =
|
|
2020
|
+
const [localSort, setLocalSort] = useState9(
|
|
1656
2021
|
{ key: columns.find((c) => c.sortable)?.key, dir: -1 }
|
|
1657
2022
|
);
|
|
1658
2023
|
const owned = controlledPage === void 0;
|
|
1659
2024
|
const sort = controlledSort ?? (owned ? localSort : NO_SORT);
|
|
1660
2025
|
const sortIsKnown = owned || controlledSort !== void 0;
|
|
1661
|
-
const [localPage, setLocalPage] =
|
|
1662
|
-
const [localSize, setLocalSize] =
|
|
2026
|
+
const [localPage, setLocalPage] = useState9(1);
|
|
2027
|
+
const [localSize, setLocalSize] = useState9(DEFAULT_PAGE_SIZE2);
|
|
1663
2028
|
const size = sizeOf(pageSize, owned ? localSize : rows.length || DEFAULT_PAGE_SIZE2);
|
|
1664
|
-
const [pagedSort, setPagedSort] =
|
|
2029
|
+
const [pagedSort, setPagedSort] = useState9(sort);
|
|
1665
2030
|
if (pagedSort.key !== sort.key || pagedSort.dir !== sort.dir) {
|
|
1666
2031
|
setPagedSort(sort);
|
|
1667
2032
|
setLocalPage(1);
|
|
@@ -1684,7 +2049,7 @@ function DataTable({
|
|
|
1684
2049
|
onSortChange?.(next);
|
|
1685
2050
|
toFirstPage();
|
|
1686
2051
|
};
|
|
1687
|
-
const caret = (k) => /* @__PURE__ */
|
|
2052
|
+
const caret = (k) => /* @__PURE__ */ jsx23(
|
|
1688
2053
|
"svg",
|
|
1689
2054
|
{
|
|
1690
2055
|
className: "rx-caret",
|
|
@@ -1696,27 +2061,26 @@ function DataTable({
|
|
|
1696
2061
|
strokeLinejoin: "round",
|
|
1697
2062
|
"aria-hidden": "true",
|
|
1698
2063
|
focusable: "false",
|
|
1699
|
-
children: sort.key === k ? /* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
2064
|
+
children: sort.key === k ? /* @__PURE__ */ jsx23("path", { d: "m8 10 4 4 4-4" }) : /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
2065
|
+
/* @__PURE__ */ jsx23("path", { d: "m8 9 4-4 4 4" }),
|
|
2066
|
+
/* @__PURE__ */ jsx23("path", { d: "m8 15 4 4 4-4" })
|
|
1702
2067
|
] })
|
|
1703
2068
|
}
|
|
1704
2069
|
);
|
|
1705
|
-
const Wrap = scrollable ? "div" :
|
|
2070
|
+
const Wrap = scrollable ? "div" : Fragment10;
|
|
1706
2071
|
const pageAllOn = selectable && slice.length > 0 && slice.every((r) => selected.has(r.name));
|
|
1707
2072
|
const pageSomeOn = selectable && !pageAllOn && slice.some((r) => selected.has(r.name));
|
|
1708
|
-
return /* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
2073
|
+
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
2074
|
+
/* @__PURE__ */ jsx23(Wrap, { ...scrollable ? { className: "ui-table-scroll", role: "region", "aria-label": scrollLabel, tabIndex: 0 } : {}, children: /* @__PURE__ */ jsxs19(
|
|
1710
2075
|
"table",
|
|
1711
2076
|
{
|
|
1712
2077
|
ref: table,
|
|
1713
|
-
className: ["ui-table", hover && "ui-table--hover", zebra && "ui-table--zebra",
|
|
2078
|
+
className: ["ui-table", hover && "ui-table--hover", zebra && "ui-table--zebra", (density === "dense" || !density && dense) && "ui-table--dense", density === "compact" && "ui-table--compact", stickyHeader && "ui-table--sticky", pinnedIdentity && "ui-table--pinned"].filter(Boolean).join(" "),
|
|
1714
2079
|
"aria-busy": loading || void 0,
|
|
1715
|
-
role: stack2 ? "table" : void 0,
|
|
1716
2080
|
children: [
|
|
1717
|
-
caption ? /* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
selectable ? /* @__PURE__ */
|
|
2081
|
+
caption ? /* @__PURE__ */ jsx23("caption", { className: "ui-sr", children: caption }) : null,
|
|
2082
|
+
/* @__PURE__ */ jsx23("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
|
|
2083
|
+
selectable ? /* @__PURE__ */ jsx23("th", { scope: "col", className: "ui-table__selection", children: /* @__PURE__ */ jsx23(
|
|
1720
2084
|
"input",
|
|
1721
2085
|
{
|
|
1722
2086
|
type: "checkbox",
|
|
@@ -1732,19 +2096,18 @@ function DataTable({
|
|
|
1732
2096
|
// The sort control is a real <button> inside the header cell. It used to be
|
|
1733
2097
|
// role="button" ON the <th>, which threw away the columnheader role and put
|
|
1734
2098
|
// aria-sort on a role that forbids it.
|
|
1735
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ jsx23(
|
|
1736
2100
|
"th",
|
|
1737
2101
|
{
|
|
1738
2102
|
scope: "col",
|
|
1739
|
-
role: stack2 ? "columnheader" : void 0,
|
|
1740
2103
|
className: [pinnedIdentity && columnIndex === 0 && "ui-table__identity", c.num && "ui-table__num", c.sortable && "rx-sortable"].filter(Boolean).join(" "),
|
|
1741
2104
|
"aria-sort": sort.key === c.key ? sort.dir === 1 ? "ascending" : "descending" : c.sortable && sortIsKnown ? "none" : void 0,
|
|
1742
2105
|
children: c.sortable ? (
|
|
1743
2106
|
// The label is its own box so it can truncate: in a pinned
|
|
1744
2107
|
// identity column on a phone the header is capped, and a bare
|
|
1745
2108
|
// text node would push the caret out of the cell instead.
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
2109
|
+
/* @__PURE__ */ jsxs19("button", { type: "button", className: "rx-sort", onClick: () => onSort(c.key), children: [
|
|
2110
|
+
/* @__PURE__ */ jsx23("span", { className: "rx-sort__label", children: c.label }),
|
|
1748
2111
|
caret(c.key)
|
|
1749
2112
|
] })
|
|
1750
2113
|
) : c.label
|
|
@@ -1753,15 +2116,14 @@ function DataTable({
|
|
|
1753
2116
|
)
|
|
1754
2117
|
))
|
|
1755
2118
|
] }) }),
|
|
1756
|
-
/* @__PURE__ */
|
|
1757
|
-
!slice.length && /* @__PURE__ */
|
|
1758
|
-
slice.map((r) => /* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsxs19("tbody", { children: [
|
|
2120
|
+
!slice.length && /* @__PURE__ */ jsx23("tr", { children: /* @__PURE__ */ jsx23("td", { colSpan: columns.length + (selectable ? 1 : 0), children: loading ? "Loading rows\u2026" : empty }) }),
|
|
2121
|
+
slice.map((r) => /* @__PURE__ */ jsxs19(
|
|
1759
2122
|
"tr",
|
|
1760
2123
|
{
|
|
1761
|
-
role: stack2 ? "row" : void 0,
|
|
1762
2124
|
className: rowState?.(r) ? `is-${rowState(r)}` : void 0,
|
|
1763
2125
|
children: [
|
|
1764
|
-
selectable ? /* @__PURE__ */
|
|
2126
|
+
selectable ? /* @__PURE__ */ jsx23("td", { className: "ui-table__selection", children: /* @__PURE__ */ jsx23(
|
|
1765
2127
|
"input",
|
|
1766
2128
|
{
|
|
1767
2129
|
type: "checkbox",
|
|
@@ -1772,12 +2134,10 @@ function DataTable({
|
|
|
1772
2134
|
) }) : null,
|
|
1773
2135
|
columns.map((c, columnIndex) => {
|
|
1774
2136
|
const Cell = c.rowHeader ? "th" : "td";
|
|
1775
|
-
return /* @__PURE__ */
|
|
2137
|
+
return /* @__PURE__ */ jsx23(
|
|
1776
2138
|
Cell,
|
|
1777
2139
|
{
|
|
1778
2140
|
scope: c.rowHeader ? "row" : void 0,
|
|
1779
|
-
role: stack2 ? c.rowHeader ? "rowheader" : "cell" : void 0,
|
|
1780
|
-
"data-label": stack2 && c.num && typeof c.label === "string" ? c.label : void 0,
|
|
1781
2141
|
className: [c.num && "ui-table__num", c.cell && CELL_CLASS[c.cell], pinnedIdentity && columnIndex === 0 && "ui-table__identity", c.linked && "ui-table__linked"].filter(Boolean).join(" ") || void 0,
|
|
1782
2142
|
children: c.render ? c.render(r) : String(r[c.key])
|
|
1783
2143
|
},
|
|
@@ -1789,7 +2149,7 @@ function DataTable({
|
|
|
1789
2149
|
r.name
|
|
1790
2150
|
))
|
|
1791
2151
|
] }),
|
|
1792
|
-
footer ? /* @__PURE__ */
|
|
2152
|
+
footer ? /* @__PURE__ */ jsx23("tfoot", { children: footer }) : null
|
|
1793
2153
|
]
|
|
1794
2154
|
}
|
|
1795
2155
|
) }),
|
|
@@ -1798,13 +2158,13 @@ function DataTable({
|
|
|
1798
2158
|
// The two are siblings, and no selector sizes one to the other, so the width is
|
|
1799
2159
|
// measured: a cap rather than a width, so a pager wider than the table wraps
|
|
1800
2160
|
// inside it and a table wider than the room still leaves the strip in the room.
|
|
1801
|
-
/* @__PURE__ */
|
|
2161
|
+
/* @__PURE__ */ jsx23(
|
|
1802
2162
|
"div",
|
|
1803
2163
|
{
|
|
1804
2164
|
className: "rx-table-pager",
|
|
1805
2165
|
ref: holdPagerBox,
|
|
1806
2166
|
style: strip2 ? { maxWidth: strip2.width, marginInlineStart: strip2.inset || void 0 } : void 0,
|
|
1807
|
-
children: /* @__PURE__ */
|
|
2167
|
+
children: /* @__PURE__ */ jsx23(
|
|
1808
2168
|
Pagination,
|
|
1809
2169
|
{
|
|
1810
2170
|
page,
|
|
@@ -1832,7 +2192,7 @@ function DataTable({
|
|
|
1832
2192
|
import { PAGE_SIZES as KIT_PAGE_SIZES, DEFAULT_PAGE_SIZE as KIT_DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1833
2193
|
|
|
1834
2194
|
// src/Loading.tsx
|
|
1835
|
-
import { jsx as
|
|
2195
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1836
2196
|
var cx4 = (...a) => a.filter(Boolean).join(" ");
|
|
1837
2197
|
function Skeleton({ lines = 3, width, height, radius, className }) {
|
|
1838
2198
|
const widths = Array.isArray(lines) ? lines : null;
|
|
@@ -1842,19 +2202,19 @@ function Skeleton({ lines = 3, width, height, radius, className }) {
|
|
|
1842
2202
|
if (!w && !height && !radius) return void 0;
|
|
1843
2203
|
return { ...w && { width: w }, ...height && { height }, ...radius && { borderRadius: radius } };
|
|
1844
2204
|
};
|
|
1845
|
-
return /* @__PURE__ */
|
|
2205
|
+
return /* @__PURE__ */ jsx24("div", { className: cx4("ui-skel", className), "aria-hidden": "true", children: Array.from({ length: n }, (_, i) => /* @__PURE__ */ jsx24("span", { className: "ui-skel__bar m-skeleton", style: styleFor(i) }, i)) });
|
|
1846
2206
|
}
|
|
1847
2207
|
function SkeletonTable({ rows = 5, cols = 4, head = true }) {
|
|
1848
|
-
const cells = Array.from({ length: Math.max(1, cols) }, (_, i) => /* @__PURE__ */
|
|
1849
|
-
return /* @__PURE__ */
|
|
2208
|
+
const cells = Array.from({ length: Math.max(1, cols) }, (_, i) => /* @__PURE__ */ jsx24("span", { className: "ui-skel__bar m-skeleton" }, i));
|
|
2209
|
+
return /* @__PURE__ */ jsxs20(
|
|
1850
2210
|
"div",
|
|
1851
2211
|
{
|
|
1852
2212
|
className: "ui-skel ui-skel--table",
|
|
1853
2213
|
style: { "--skel-cols": Math.max(1, cols) },
|
|
1854
2214
|
"aria-hidden": "true",
|
|
1855
2215
|
children: [
|
|
1856
|
-
head && /* @__PURE__ */
|
|
1857
|
-
Array.from({ length: Math.max(1, rows) }, (_, i) => /* @__PURE__ */
|
|
2216
|
+
head && /* @__PURE__ */ jsx24("div", { className: "ui-skel__row ui-skel__row--head", children: cells }),
|
|
2217
|
+
Array.from({ length: Math.max(1, rows) }, (_, i) => /* @__PURE__ */ jsx24("div", { className: "ui-skel__row", children: cells }, i))
|
|
1858
2218
|
]
|
|
1859
2219
|
}
|
|
1860
2220
|
);
|
|
@@ -1867,7 +2227,7 @@ function BusyRegion({
|
|
|
1867
2227
|
className,
|
|
1868
2228
|
children
|
|
1869
2229
|
}) {
|
|
1870
|
-
return /* @__PURE__ */
|
|
2230
|
+
return /* @__PURE__ */ jsxs20(
|
|
1871
2231
|
"div",
|
|
1872
2232
|
{
|
|
1873
2233
|
className: cx4("ui-busy", className),
|
|
@@ -1875,8 +2235,8 @@ function BusyRegion({
|
|
|
1875
2235
|
"aria-live": "polite",
|
|
1876
2236
|
"aria-busy": busy,
|
|
1877
2237
|
children: [
|
|
1878
|
-
/* @__PURE__ */
|
|
1879
|
-
/* @__PURE__ */
|
|
2238
|
+
/* @__PURE__ */ jsx24("span", { className: "ui-sr", children: busy ? label : message }),
|
|
2239
|
+
/* @__PURE__ */ jsx24("div", { className: "ui-busy__body", children: busy ? placeholder ?? /* @__PURE__ */ jsx24(Skeleton, { lines: 3 }) : children })
|
|
1880
2240
|
]
|
|
1881
2241
|
}
|
|
1882
2242
|
);
|
|
@@ -1889,28 +2249,28 @@ function Denied({
|
|
|
1889
2249
|
className,
|
|
1890
2250
|
children
|
|
1891
2251
|
}) {
|
|
1892
|
-
return /* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
sub && /* @__PURE__ */
|
|
1896
|
-
need && /* @__PURE__ */
|
|
2252
|
+
return /* @__PURE__ */ jsxs20("div", { className: cx4("ui-denied", className), children: [
|
|
2253
|
+
/* @__PURE__ */ jsx24("div", { className: "ui-denied__seal", children: /* @__PURE__ */ jsx24(Icon, { name: icon9 }) }),
|
|
2254
|
+
/* @__PURE__ */ jsx24("div", { className: "ui-denied__title", children: title }),
|
|
2255
|
+
sub && /* @__PURE__ */ jsx24("div", { className: "ui-denied__sub", children: sub }),
|
|
2256
|
+
need && /* @__PURE__ */ jsxs20("div", { className: "ui-denied__need", children: [
|
|
1897
2257
|
"Needs ",
|
|
1898
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ jsx24("code", { className: "ui-code", children: need })
|
|
1899
2259
|
] }),
|
|
1900
|
-
children && /* @__PURE__ */
|
|
2260
|
+
children && /* @__PURE__ */ jsx24("div", { className: "ui-denied__actions", children })
|
|
1901
2261
|
] });
|
|
1902
2262
|
}
|
|
1903
2263
|
|
|
1904
2264
|
// src/DatePicker.tsx
|
|
1905
2265
|
import {
|
|
1906
2266
|
useCallback as useCallback4,
|
|
1907
|
-
useEffect as
|
|
2267
|
+
useEffect as useEffect11,
|
|
1908
2268
|
useMemo as useMemo3,
|
|
1909
|
-
useRef as
|
|
1910
|
-
useState as
|
|
2269
|
+
useRef as useRef14,
|
|
2270
|
+
useState as useState10
|
|
1911
2271
|
} from "react";
|
|
1912
2272
|
import { dropdownViewportFit } from "@apliteni/apliteni-ui";
|
|
1913
|
-
import { jsx as
|
|
2273
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1914
2274
|
var cx5 = (...a) => a.filter(Boolean).join(" ");
|
|
1915
2275
|
var pad = (n) => String(n).padStart(2, "0");
|
|
1916
2276
|
var DAY_MS = 864e5;
|
|
@@ -1919,8 +2279,8 @@ var MONTH_RE = /^(\d{4})-(\d{2})$/;
|
|
|
1919
2279
|
var DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
1920
2280
|
var PHONE_MAX = 560;
|
|
1921
2281
|
function usePhone() {
|
|
1922
|
-
const [phone, setPhone] =
|
|
1923
|
-
|
|
2282
|
+
const [phone, setPhone] = useState10(false);
|
|
2283
|
+
useEffect11(() => {
|
|
1924
2284
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX}px)`);
|
|
1925
2285
|
if (!query) return;
|
|
1926
2286
|
const read = () => setPhone(query.matches);
|
|
@@ -2015,15 +2375,15 @@ function DatePicker({
|
|
|
2015
2375
|
const picksRange = mode === "range" || mode === "day-range";
|
|
2016
2376
|
const phone = usePhone();
|
|
2017
2377
|
const asSheet = sheet ?? phone;
|
|
2018
|
-
const root =
|
|
2019
|
-
const trigger =
|
|
2020
|
-
const grid =
|
|
2021
|
-
const panel =
|
|
2022
|
-
const [selfOpen, setSelfOpen] =
|
|
2378
|
+
const root = useRef14(null);
|
|
2379
|
+
const trigger = useRef14(null);
|
|
2380
|
+
const grid = useRef14(null);
|
|
2381
|
+
const panel = useRef14(null);
|
|
2382
|
+
const [selfOpen, setSelfOpen] = useState10(defaultOpen);
|
|
2023
2383
|
const open = openProp ?? selfOpen;
|
|
2024
|
-
const [selfValue, setSelfValue] =
|
|
2384
|
+
const [selfValue, setSelfValue] = useState10(defaultValue);
|
|
2025
2385
|
const picked = value !== void 0 ? value : selfValue;
|
|
2026
|
-
const [selfRange, setSelfRange] =
|
|
2386
|
+
const [selfRange, setSelfRange] = useState10(defaultRange ?? { start: null, end: null });
|
|
2027
2387
|
const span = range !== void 0 ? range : selfRange;
|
|
2028
2388
|
const names = useMemo3(() => ({
|
|
2029
2389
|
month: new Intl.DateTimeFormat(locale, { month: "long", timeZone: "UTC" }),
|
|
@@ -2054,17 +2414,17 @@ function DatePicker({
|
|
|
2054
2414
|
return grain === "month" ? monthOf(now) : now;
|
|
2055
2415
|
}, [today, grain]);
|
|
2056
2416
|
const anchor = toIndex(picked, grain) ?? toIndex(picksRange ? span.start ?? span.end : null, grain) ?? todayIndex;
|
|
2057
|
-
const [cursor, setCursor] =
|
|
2058
|
-
const land =
|
|
2417
|
+
const [cursor, setCursor] = useState10(() => clamp(anchor, lo, hi));
|
|
2418
|
+
const land = useRef14(false);
|
|
2059
2419
|
const setOpen = useCallback4((next) => {
|
|
2060
2420
|
if (openProp === void 0) setSelfOpen(next);
|
|
2061
2421
|
onOpenChange?.(next);
|
|
2062
2422
|
}, [openProp, onOpenChange]);
|
|
2063
|
-
const close =
|
|
2423
|
+
const close = useRef14(setOpen);
|
|
2064
2424
|
useIsoLayoutEffect(() => {
|
|
2065
2425
|
close.current = setOpen;
|
|
2066
2426
|
});
|
|
2067
|
-
|
|
2427
|
+
useEffect11(() => {
|
|
2068
2428
|
if (open) setCursor(clamp(anchor, lo, hi));
|
|
2069
2429
|
}, [open]);
|
|
2070
2430
|
useIsoLayoutEffect(() => {
|
|
@@ -2088,7 +2448,7 @@ function DatePicker({
|
|
|
2088
2448
|
view.removeEventListener("resize", fit);
|
|
2089
2449
|
};
|
|
2090
2450
|
}, [open, asSheet]);
|
|
2091
|
-
|
|
2451
|
+
useEffect11(() => {
|
|
2092
2452
|
if (!open || asSheet) return;
|
|
2093
2453
|
const doc = root.current?.ownerDocument ?? document;
|
|
2094
2454
|
const onClick = (e) => {
|
|
@@ -2250,10 +2610,10 @@ function DatePicker({
|
|
|
2250
2610
|
}
|
|
2251
2611
|
const noneBefore = lo != null && first <= lo;
|
|
2252
2612
|
const noneAfter = hi != null && last >= hi;
|
|
2253
|
-
const calendar = /* @__PURE__ */
|
|
2254
|
-
picksRange && presets?.length ? /* @__PURE__ */
|
|
2613
|
+
const calendar = /* @__PURE__ */ jsxs21("div", { className: cx5("ui-datepicker__body", asSheet && "is-sheet"), children: [
|
|
2614
|
+
picksRange && presets?.length ? /* @__PURE__ */ jsx25("div", { className: "ui-datepicker__presets", role: "group", "aria-label": "Period shortcuts", children: presets.map((preset) => {
|
|
2255
2615
|
const within = allowed(preset);
|
|
2256
|
-
return /* @__PURE__ */
|
|
2616
|
+
return /* @__PURE__ */ jsx25(
|
|
2257
2617
|
"button",
|
|
2258
2618
|
{
|
|
2259
2619
|
type: "button",
|
|
@@ -2265,9 +2625,9 @@ function DatePicker({
|
|
|
2265
2625
|
preset.label
|
|
2266
2626
|
);
|
|
2267
2627
|
}) }) : null,
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsxs21("div", { className: "ui-datepicker__calendar", children: [
|
|
2629
|
+
/* @__PURE__ */ jsxs21("div", { className: "ui-datepicker__head", children: [
|
|
2630
|
+
/* @__PURE__ */ jsx25(
|
|
2271
2631
|
"button",
|
|
2272
2632
|
{
|
|
2273
2633
|
type: "button",
|
|
@@ -2275,11 +2635,11 @@ function DatePicker({
|
|
|
2275
2635
|
"aria-label": stepBack,
|
|
2276
2636
|
disabled: noneBefore,
|
|
2277
2637
|
onClick: () => stepPage(-1),
|
|
2278
|
-
children: /* @__PURE__ */
|
|
2638
|
+
children: /* @__PURE__ */ jsx25(Icon, { name: "chevronLeft" })
|
|
2279
2639
|
}
|
|
2280
2640
|
),
|
|
2281
|
-
/* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2641
|
+
/* @__PURE__ */ jsx25("span", { className: "ui-datepicker__caption", "aria-live": "polite", children: caption }),
|
|
2642
|
+
/* @__PURE__ */ jsx25(
|
|
2283
2643
|
"button",
|
|
2284
2644
|
{
|
|
2285
2645
|
type: "button",
|
|
@@ -2287,11 +2647,11 @@ function DatePicker({
|
|
|
2287
2647
|
"aria-label": stepOn,
|
|
2288
2648
|
disabled: noneAfter,
|
|
2289
2649
|
onClick: () => stepPage(1),
|
|
2290
|
-
children: /* @__PURE__ */
|
|
2650
|
+
children: /* @__PURE__ */ jsx25(Icon, { name: "chevronRight" })
|
|
2291
2651
|
}
|
|
2292
2652
|
)
|
|
2293
2653
|
] }),
|
|
2294
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ jsxs21(
|
|
2295
2655
|
"div",
|
|
2296
2656
|
{
|
|
2297
2657
|
className: cx5("ui-datepicker__grid", grain === "day" && "is-days"),
|
|
@@ -2300,7 +2660,7 @@ function DatePicker({
|
|
|
2300
2660
|
ref: grid,
|
|
2301
2661
|
onKeyDown: onGridKeyDown,
|
|
2302
2662
|
children: [
|
|
2303
|
-
weekdays.length > 0 && /* @__PURE__ */
|
|
2663
|
+
weekdays.length > 0 && /* @__PURE__ */ jsx25("div", { className: "ui-datepicker__row", role: "row", children: weekdays.map((weekday) => /* @__PURE__ */ jsx25(
|
|
2304
2664
|
"span",
|
|
2305
2665
|
{
|
|
2306
2666
|
className: "ui-datepicker__weekday",
|
|
@@ -2310,13 +2670,13 @@ function DatePicker({
|
|
|
2310
2670
|
},
|
|
2311
2671
|
weekday.long
|
|
2312
2672
|
)) }),
|
|
2313
|
-
rows.map((cellsInRow, r) => /* @__PURE__ */
|
|
2673
|
+
rows.map((cellsInRow, r) => /* @__PURE__ */ jsx25("div", { className: "ui-datepicker__row", role: "row", children: cellsInRow.map((cell, c) => cell ? /* @__PURE__ */ jsx25(
|
|
2314
2674
|
"span",
|
|
2315
2675
|
{
|
|
2316
2676
|
className: "ui-datepicker__cell",
|
|
2317
2677
|
role: "gridcell",
|
|
2318
2678
|
"aria-selected": isPicked(cell.index),
|
|
2319
|
-
children: /* @__PURE__ */
|
|
2679
|
+
children: /* @__PURE__ */ jsx25(
|
|
2320
2680
|
"button",
|
|
2321
2681
|
{
|
|
2322
2682
|
type: "button",
|
|
@@ -2335,12 +2695,12 @@ function DatePicker({
|
|
|
2335
2695
|
"aria-label": state(cell),
|
|
2336
2696
|
onClick: () => pick(cell),
|
|
2337
2697
|
onFocus: () => setCursor(cell.index),
|
|
2338
|
-
children: /* @__PURE__ */
|
|
2698
|
+
children: /* @__PURE__ */ jsx25("span", { className: "ui-datepicker__num", children: cell.label })
|
|
2339
2699
|
}
|
|
2340
2700
|
)
|
|
2341
2701
|
},
|
|
2342
2702
|
cell.period
|
|
2343
|
-
) : /* @__PURE__ */
|
|
2703
|
+
) : /* @__PURE__ */ jsx25("span", { className: "ui-datepicker__cell is-empty", role: "gridcell" }, `e${r}-${c}`)) }, `r${r}`))
|
|
2344
2704
|
]
|
|
2345
2705
|
}
|
|
2346
2706
|
)
|
|
@@ -2350,8 +2710,8 @@ function DatePicker({
|
|
|
2350
2710
|
// `open` on the root whichever form the panel takes, so the trigger's
|
|
2351
2711
|
// chevron flips for the sheet as it does for the popover. The panel rules
|
|
2352
2712
|
// it also switches on have no panel to find while the sheet is up.
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2713
|
+
/* @__PURE__ */ jsxs21("div", { className: cx5("ui-dropdown", "ui-datepicker", open && "open"), ref: root, children: [
|
|
2714
|
+
/* @__PURE__ */ jsxs21(
|
|
2355
2715
|
"button",
|
|
2356
2716
|
{
|
|
2357
2717
|
type: "button",
|
|
@@ -2367,8 +2727,8 @@ function DatePicker({
|
|
|
2367
2727
|
setOpen(!open);
|
|
2368
2728
|
},
|
|
2369
2729
|
children: [
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsx25("span", { className: "ui-dropdown__value", children: shown ?? empty }),
|
|
2731
|
+
/* @__PURE__ */ jsx25("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2372
2732
|
]
|
|
2373
2733
|
}
|
|
2374
2734
|
),
|
|
@@ -2379,8 +2739,8 @@ function DatePicker({
|
|
|
2379
2739
|
// without taking the sheet's affordances left a phone reader with no
|
|
2380
2740
|
// visible way out and a Tab that walked into the live page behind it.
|
|
2381
2741
|
// why: guidelines/drawer.md
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
) : /* @__PURE__ */
|
|
2742
|
+
/* @__PURE__ */ jsx25(Drawer, { open, side: "bottom", size: "md", title: name, onClose: () => setOpen(false), children: calendar })
|
|
2743
|
+
) : /* @__PURE__ */ jsx25(
|
|
2384
2744
|
"div",
|
|
2385
2745
|
{
|
|
2386
2746
|
className: cx5("ui-dropdown__panel", "ui-datepicker__panel", align === "end" && "is-end"),
|
|
@@ -2398,13 +2758,13 @@ function DatePicker({
|
|
|
2398
2758
|
|
|
2399
2759
|
// src/Dropdown.tsx
|
|
2400
2760
|
import {
|
|
2401
|
-
Fragment as
|
|
2761
|
+
Fragment as Fragment12,
|
|
2402
2762
|
useCallback as useCallback5,
|
|
2403
2763
|
useContext as useContext2,
|
|
2404
|
-
useEffect as
|
|
2405
|
-
useId as
|
|
2406
|
-
useRef as
|
|
2407
|
-
useState as
|
|
2764
|
+
useEffect as useEffect12,
|
|
2765
|
+
useId as useId11,
|
|
2766
|
+
useRef as useRef15,
|
|
2767
|
+
useState as useState11
|
|
2408
2768
|
} from "react";
|
|
2409
2769
|
import {
|
|
2410
2770
|
icon as icon4,
|
|
@@ -2426,7 +2786,7 @@ import { createContext as createContext2 } from "react";
|
|
|
2426
2786
|
var FieldContext = createContext2(null);
|
|
2427
2787
|
|
|
2428
2788
|
// src/Dropdown.tsx
|
|
2429
|
-
import { Fragment as
|
|
2789
|
+
import { Fragment as Fragment13, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2430
2790
|
var EXIT_SLACK_MS2 = 50;
|
|
2431
2791
|
var SETTLE_MS = 450;
|
|
2432
2792
|
var inPanel = (node) => {
|
|
@@ -2435,7 +2795,7 @@ var inPanel = (node) => {
|
|
|
2435
2795
|
};
|
|
2436
2796
|
var cx6 = (...a) => a.filter(Boolean).join(" ");
|
|
2437
2797
|
var isRow = (it) => Boolean(it) && it !== "---" && !it.separator;
|
|
2438
|
-
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */
|
|
2798
|
+
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */ jsx26(
|
|
2439
2799
|
"span",
|
|
2440
2800
|
{
|
|
2441
2801
|
className,
|
|
@@ -2448,7 +2808,7 @@ function RowBadge({ badge }) {
|
|
|
2448
2808
|
const given = typeof badge === "string" ? "" : badge.tone || "";
|
|
2449
2809
|
let tone2 = given || (/^live$/i.test(String(text2)) ? "live" : "neutral");
|
|
2450
2810
|
if (!given && tone2 === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone2 = "state";
|
|
2451
|
-
return /* @__PURE__ */
|
|
2811
|
+
return /* @__PURE__ */ jsx26("span", { className: `ui-dropdown__badge is-${tone2}`, children: text2 });
|
|
2452
2812
|
}
|
|
2453
2813
|
var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
|
|
2454
2814
|
var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
|
|
@@ -2493,19 +2853,19 @@ function Dropdown({
|
|
|
2493
2853
|
onSelect,
|
|
2494
2854
|
row
|
|
2495
2855
|
}) {
|
|
2496
|
-
const [selfOpen, setSelfOpen] =
|
|
2856
|
+
const [selfOpen, setSelfOpen] = useState11(defaultOpen);
|
|
2497
2857
|
const open = openProp ?? selfOpen;
|
|
2498
|
-
const [pick, setPick] =
|
|
2499
|
-
const [query, setQuery] =
|
|
2500
|
-
const [activeKey, setActiveKey] =
|
|
2501
|
-
const root =
|
|
2502
|
-
const panel =
|
|
2503
|
-
const trigger =
|
|
2504
|
-
const field =
|
|
2505
|
-
const landOn =
|
|
2506
|
-
const revealed =
|
|
2507
|
-
const at =
|
|
2508
|
-
const auto =
|
|
2858
|
+
const [pick, setPick] = useState11(null);
|
|
2859
|
+
const [query, setQuery] = useState11(() => search && search !== true ? search.query || "" : "");
|
|
2860
|
+
const [activeKey, setActiveKey] = useState11(null);
|
|
2861
|
+
const root = useRef15(null);
|
|
2862
|
+
const panel = useRef15(null);
|
|
2863
|
+
const trigger = useRef15(null);
|
|
2864
|
+
const field = useRef15(null);
|
|
2865
|
+
const landOn = useRef15(null);
|
|
2866
|
+
const revealed = useRef15(false);
|
|
2867
|
+
const at = useRef15("");
|
|
2868
|
+
const auto = useId11().replace(/:/g, "");
|
|
2509
2869
|
const uid = id ?? auto;
|
|
2510
2870
|
const inField = useContext2(FieldContext);
|
|
2511
2871
|
const fieldName = inField && id === inField.id && !(ariaLabel && triggerContent != null) ? { id: `${uid}-trigger`, labelId: inField.labelId, labelledBy: `${inField.labelId} ${uid}-trigger` } : null;
|
|
@@ -2513,7 +2873,7 @@ function Dropdown({
|
|
|
2513
2873
|
if (openProp === void 0) setSelfOpen(next);
|
|
2514
2874
|
onOpenChange?.(next);
|
|
2515
2875
|
}, [openProp, onOpenChange]);
|
|
2516
|
-
const close =
|
|
2876
|
+
const close = useRef15(setOpen);
|
|
2517
2877
|
useIsoLayoutEffect(() => {
|
|
2518
2878
|
close.current = setOpen;
|
|
2519
2879
|
});
|
|
@@ -2566,7 +2926,7 @@ function Dropdown({
|
|
|
2566
2926
|
stop.forEach((off) => off());
|
|
2567
2927
|
};
|
|
2568
2928
|
}, [open]);
|
|
2569
|
-
const opened =
|
|
2929
|
+
const opened = useRef15(false);
|
|
2570
2930
|
useIsoLayoutEffect(() => {
|
|
2571
2931
|
const el = panel.current;
|
|
2572
2932
|
if (open) {
|
|
@@ -2613,7 +2973,7 @@ function Dropdown({
|
|
|
2613
2973
|
const given = rows.find((it) => it.selected);
|
|
2614
2974
|
const givenKey = given ? keyOf(given) : null;
|
|
2615
2975
|
const pickedKey = selectedValue === void 0 && pick && pick.against === givenKey ? pick.key : null;
|
|
2616
|
-
|
|
2976
|
+
useEffect12(() => {
|
|
2617
2977
|
if (pick && pick.against !== givenKey) setPick(null);
|
|
2618
2978
|
}, [givenKey, pick]);
|
|
2619
2979
|
const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
|
|
@@ -2630,7 +2990,7 @@ function Dropdown({
|
|
|
2630
2990
|
const rowIds = /* @__PURE__ */ new Map();
|
|
2631
2991
|
rows.forEach((it, i) => rowIds.set(it, `${uid}-opt-${i}`));
|
|
2632
2992
|
const listId = `${uid}-list`;
|
|
2633
|
-
|
|
2993
|
+
useEffect12(() => {
|
|
2634
2994
|
if (!open) return;
|
|
2635
2995
|
const mine = () => close.current(false);
|
|
2636
2996
|
for (const other of [...openNow]) other();
|
|
@@ -2639,7 +2999,7 @@ function Dropdown({
|
|
|
2639
2999
|
openNow.delete(mine);
|
|
2640
3000
|
};
|
|
2641
3001
|
}, [open]);
|
|
2642
|
-
|
|
3002
|
+
useEffect12(() => {
|
|
2643
3003
|
if (!open) return;
|
|
2644
3004
|
const doc = root.current?.ownerDocument ?? document;
|
|
2645
3005
|
const onClick = (e) => {
|
|
@@ -2869,7 +3229,7 @@ function Dropdown({
|
|
|
2869
3229
|
};
|
|
2870
3230
|
function renderRow(entry, key) {
|
|
2871
3231
|
if (!isRow(entry)) {
|
|
2872
|
-
return /* @__PURE__ */
|
|
3232
|
+
return /* @__PURE__ */ jsx26("div", { className: "ui-dropdown__sep", role: "separator", hidden: filtering || void 0 }, key);
|
|
2873
3233
|
}
|
|
2874
3234
|
const disabled2 = !!entry.disabled;
|
|
2875
3235
|
const selected = selectedOf(entry);
|
|
@@ -2891,23 +3251,23 @@ function Dropdown({
|
|
|
2891
3251
|
...asLink ? { href: entry.href, ...entry.target ? { target: entry.target } : null } : null,
|
|
2892
3252
|
...sx ? { id: rowIds.get(entry), hidden: hiddenBy(entry) || void 0 } : null,
|
|
2893
3253
|
onClick: (e) => choose(entry, e),
|
|
2894
|
-
children: /* @__PURE__ */
|
|
2895
|
-
entry.avatar ? /* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
entry.description && /* @__PURE__ */
|
|
3254
|
+
children: /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
3255
|
+
entry.avatar ? /* @__PURE__ */ jsx26(Avatar, { personKey: entry.avatar.key, name: entry.avatar.name, src: entry.avatar.src, empty: entry.avatar.empty }) : entry.icon && /* @__PURE__ */ jsx26(Glyph2, { name: entry.icon, className: "ui-dropdown__ic" }),
|
|
3256
|
+
/* @__PURE__ */ jsxs22("span", { className: "ui-dropdown__main", children: [
|
|
3257
|
+
/* @__PURE__ */ jsx26("span", { className: "ui-dropdown__label", children: entry.label }),
|
|
3258
|
+
entry.description && /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__desc", children: entry.description })
|
|
2899
3259
|
] }),
|
|
2900
|
-
entry.badge ? /* @__PURE__ */
|
|
2901
|
-
asOption && /* @__PURE__ */
|
|
3260
|
+
entry.badge ? /* @__PURE__ */ jsx26(RowBadge, { badge: entry.badge }) : null,
|
|
3261
|
+
asOption && /* @__PURE__ */ jsx26(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
|
|
2902
3262
|
] })
|
|
2903
3263
|
};
|
|
2904
|
-
if (row) return /* @__PURE__ */
|
|
3264
|
+
if (row) return /* @__PURE__ */ jsx26(Fragment12, { children: row(entry, props) }, key);
|
|
2905
3265
|
const Tag = asLink ? "a" : "div";
|
|
2906
|
-
return /* @__PURE__ */
|
|
3266
|
+
return /* @__PURE__ */ jsx26(Tag, { ...props }, key);
|
|
2907
3267
|
}
|
|
2908
3268
|
const body = sections?.length ? sections.map((section, si) => {
|
|
2909
3269
|
const gone = filtering && !(section.items || []).some((it) => isRow(it) && !hiddenBy(it));
|
|
2910
|
-
return /* @__PURE__ */
|
|
3270
|
+
return /* @__PURE__ */ jsxs22(
|
|
2911
3271
|
"div",
|
|
2912
3272
|
{
|
|
2913
3273
|
className: "ui-dropdown__section",
|
|
@@ -2915,7 +3275,7 @@ function Dropdown({
|
|
|
2915
3275
|
"aria-label": section.label || void 0,
|
|
2916
3276
|
hidden: gone || void 0,
|
|
2917
3277
|
children: [
|
|
2918
|
-
section.label && /* @__PURE__ */
|
|
3278
|
+
section.label && /* @__PURE__ */ jsx26("div", { className: "ui-dropdown__group", role: "presentation", children: section.label }),
|
|
2919
3279
|
(section.items || []).map((entry, i) => renderRow(entry, `s${si}-${i}`))
|
|
2920
3280
|
]
|
|
2921
3281
|
},
|
|
@@ -2923,12 +3283,12 @@ function Dropdown({
|
|
|
2923
3283
|
);
|
|
2924
3284
|
}) : (items || []).map((entry, i) => renderRow(entry, `i${i}`));
|
|
2925
3285
|
const cap = scroll && scroll !== true ? { "--ui-dropdown-cap": typeof scroll === "number" ? `${scroll}px` : scroll } : void 0;
|
|
2926
|
-
const none = sx && filtering && !visible.length ? /* @__PURE__ */
|
|
2927
|
-
/* @__PURE__ */
|
|
2928
|
-
/* @__PURE__ */
|
|
3286
|
+
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
3287
|
+
/* @__PURE__ */ jsx26("span", { className: "ui-dropdown__none-title", children: sx.empty.replace("{q}", () => query.trim()) }),
|
|
3288
|
+
/* @__PURE__ */ jsx26("span", { className: "ui-dropdown__none-hint", children: sx.hint })
|
|
2929
3289
|
] }) : null;
|
|
2930
|
-
return /* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
3290
|
+
return /* @__PURE__ */ jsxs22("div", { className: cx6("ui-dropdown", open && "open"), id, ref: root, onKeyDown, children: [
|
|
3291
|
+
/* @__PURE__ */ jsxs22(
|
|
2932
3292
|
"button",
|
|
2933
3293
|
{
|
|
2934
3294
|
type: "button",
|
|
@@ -2948,16 +3308,16 @@ function Dropdown({
|
|
|
2948
3308
|
setOpen(!open);
|
|
2949
3309
|
},
|
|
2950
3310
|
children: [
|
|
2951
|
-
triggerContent != null ? typeof triggerContent === "string" ? /* @__PURE__ */
|
|
2952
|
-
marked2 && (chosen?.avatar ? /* @__PURE__ */
|
|
2953
|
-
label && /* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
3311
|
+
triggerContent != null ? typeof triggerContent === "string" ? /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__text", children: triggerContent }) : triggerContent : /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
3312
|
+
marked2 && (chosen?.avatar ? /* @__PURE__ */ jsx26(Avatar, { personKey: chosen.avatar.key, name: chosen.avatar.name, src: chosen.avatar.src, empty: chosen.avatar.empty }) : /* @__PURE__ */ jsx26(Avatar, { empty: true })),
|
|
3313
|
+
label && /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__pre", children: label }),
|
|
3314
|
+
/* @__PURE__ */ jsx26("span", { className: cx6("ui-dropdown__value", marked2 && !chosen && "is-placeholder"), children: shown != null ? shown : placeholder })
|
|
2955
3315
|
] }),
|
|
2956
|
-
chevron && /* @__PURE__ */
|
|
3316
|
+
chevron && /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2957
3317
|
]
|
|
2958
3318
|
}
|
|
2959
3319
|
),
|
|
2960
|
-
/* @__PURE__ */
|
|
3320
|
+
/* @__PURE__ */ jsxs22(
|
|
2961
3321
|
"div",
|
|
2962
3322
|
{
|
|
2963
3323
|
className: cx6(
|
|
@@ -2978,10 +3338,10 @@ function Dropdown({
|
|
|
2978
3338
|
onMouseMove,
|
|
2979
3339
|
children: [
|
|
2980
3340
|
header,
|
|
2981
|
-
sx ? /* @__PURE__ */
|
|
2982
|
-
/* @__PURE__ */
|
|
2983
|
-
/* @__PURE__ */
|
|
2984
|
-
/* @__PURE__ */
|
|
3341
|
+
sx ? /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
3342
|
+
/* @__PURE__ */ jsxs22("div", { className: "ui-dropdown__search", children: [
|
|
3343
|
+
/* @__PURE__ */ jsx26(Glyph2, { name: "search", className: "ui-dropdown__search-ic", hidden: true }),
|
|
3344
|
+
/* @__PURE__ */ jsx26(
|
|
2985
3345
|
"input",
|
|
2986
3346
|
{
|
|
2987
3347
|
className: "ui-dropdown__search-input",
|
|
@@ -3005,8 +3365,8 @@ function Dropdown({
|
|
|
3005
3365
|
}
|
|
3006
3366
|
)
|
|
3007
3367
|
] }),
|
|
3008
|
-
/* @__PURE__ */
|
|
3009
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ jsx26("div", { className: "ui-dropdown__list", role: "listbox", id: listId, "aria-label": name, style: cap, children: body }),
|
|
3369
|
+
/* @__PURE__ */ jsx26(
|
|
3010
3370
|
"div",
|
|
3011
3371
|
{
|
|
3012
3372
|
className: "ui-dropdown__none",
|
|
@@ -3031,7 +3391,7 @@ function strip(o) {
|
|
|
3031
3391
|
}
|
|
3032
3392
|
|
|
3033
3393
|
// src/BackLink.tsx
|
|
3034
|
-
import { jsx as
|
|
3394
|
+
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3035
3395
|
var BARE = "Back";
|
|
3036
3396
|
var SCRIPTED = /^javascript:/i;
|
|
3037
3397
|
var LEADING = /^[\u0000-\u0020]+/;
|
|
@@ -3050,7 +3410,7 @@ function BackLink({
|
|
|
3050
3410
|
const name = text(label).replace(SAID, "");
|
|
3051
3411
|
const bare = !name || name.toLowerCase() === BARE.toLowerCase();
|
|
3052
3412
|
const Tag = as ?? "a";
|
|
3053
|
-
return /* @__PURE__ */
|
|
3413
|
+
return /* @__PURE__ */ jsxs23(
|
|
3054
3414
|
Tag,
|
|
3055
3415
|
{
|
|
3056
3416
|
className: ["ui-back", className].filter(Boolean).join(" "),
|
|
@@ -3058,8 +3418,8 @@ function BackLink({
|
|
|
3058
3418
|
"aria-label": bare ? void 0 : `${BARE} to ${name}`,
|
|
3059
3419
|
...rest,
|
|
3060
3420
|
children: [
|
|
3061
|
-
/* @__PURE__ */
|
|
3062
|
-
/* @__PURE__ */
|
|
3421
|
+
/* @__PURE__ */ jsx27(Icon, { name: "chevronLeft" }),
|
|
3422
|
+
/* @__PURE__ */ jsx27("span", { className: "ui-back__label", children: bare ? BARE : name })
|
|
3063
3423
|
]
|
|
3064
3424
|
}
|
|
3065
3425
|
);
|
|
@@ -3067,41 +3427,41 @@ function BackLink({
|
|
|
3067
3427
|
|
|
3068
3428
|
// src/TableValues.tsx
|
|
3069
3429
|
import { formatNumericValue, formatDeltaValue } from "@apliteni/apliteni-ui";
|
|
3070
|
-
import { jsx as
|
|
3430
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3071
3431
|
function NumericValue(props) {
|
|
3072
3432
|
const value = formatNumericValue(props);
|
|
3073
|
-
return /* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ jsx28("span", { children: /* @__PURE__ */ jsxs24("span", { className: "ui-value", "aria-label": value.missing, children: [
|
|
3074
3434
|
value.text,
|
|
3075
|
-
value.unit && /* @__PURE__ */
|
|
3435
|
+
value.unit && /* @__PURE__ */ jsx28("span", { className: "ui-value__unit", children: value.unit })
|
|
3076
3436
|
] }) });
|
|
3077
3437
|
}
|
|
3078
3438
|
function DeltaValue(props) {
|
|
3079
3439
|
const value = formatDeltaValue(props);
|
|
3080
|
-
return /* @__PURE__ */
|
|
3440
|
+
return /* @__PURE__ */ jsx28("span", { children: /* @__PURE__ */ jsx28("span", { className: value.className, "aria-describedby": value.basisId || void 0, children: value.text }) });
|
|
3081
3441
|
}
|
|
3082
3442
|
function RowIdentity({ symbol, name, logo, href }) {
|
|
3083
3443
|
const Tag = href ? "a" : "span";
|
|
3084
|
-
return /* @__PURE__ */
|
|
3085
|
-
/* @__PURE__ */
|
|
3086
|
-
/* @__PURE__ */
|
|
3087
|
-
logo && /* @__PURE__ */
|
|
3444
|
+
return /* @__PURE__ */ jsxs24(Tag, { className: "ui-identity", href, children: [
|
|
3445
|
+
/* @__PURE__ */ jsxs24("span", { className: "ui-identity__logo", "aria-hidden": "true", children: [
|
|
3446
|
+
/* @__PURE__ */ jsx28("span", { children: symbol.slice(0, 1) }),
|
|
3447
|
+
logo && /* @__PURE__ */ jsx28("img", { src: logo, alt: "", onLoad: (e) => {
|
|
3088
3448
|
e.currentTarget.hidden = false;
|
|
3089
3449
|
}, onError: (e) => {
|
|
3090
3450
|
e.currentTarget.hidden = true;
|
|
3091
3451
|
} })
|
|
3092
3452
|
] }),
|
|
3093
|
-
/* @__PURE__ */
|
|
3094
|
-
/* @__PURE__ */
|
|
3453
|
+
/* @__PURE__ */ jsx28("span", { className: "ui-identity__symbol", children: symbol }),
|
|
3454
|
+
/* @__PURE__ */ jsx28("span", { className: "ui-identity__name", children: name })
|
|
3095
3455
|
] });
|
|
3096
3456
|
}
|
|
3097
3457
|
|
|
3098
3458
|
// src/Segmented.tsx
|
|
3099
3459
|
import { segmentedNextIndex } from "@apliteni/apliteni-ui";
|
|
3100
|
-
import { jsx as
|
|
3460
|
+
import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3101
3461
|
function Segmented({ options, value, onChange, label, appearance = "pill", size, block = false, disabled = false }) {
|
|
3102
3462
|
const enabled = options.filter((o) => !o.disabled);
|
|
3103
3463
|
const tabValue = enabled.some((o) => o.value === value) ? value : enabled[0]?.value;
|
|
3104
|
-
return /* @__PURE__ */
|
|
3464
|
+
return /* @__PURE__ */ jsx29("div", { className: `ui-seg${size === "sm" ? " ui-seg--sm" : ""}${block ? " ui-seg--block" : ""}${appearance === "underline" ? " ui-seg--underline" : ""}`, role: "toolbar", "aria-label": label, children: options.map((option) => /* @__PURE__ */ jsxs25(
|
|
3105
3465
|
"button",
|
|
3106
3466
|
{
|
|
3107
3467
|
type: "button",
|
|
@@ -3121,7 +3481,7 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
3121
3481
|
onChange(enabled[next].value);
|
|
3122
3482
|
},
|
|
3123
3483
|
children: [
|
|
3124
|
-
option.icon && /* @__PURE__ */
|
|
3484
|
+
option.icon && /* @__PURE__ */ jsx29(Icon, { name: option.icon }),
|
|
3125
3485
|
!(option.icon && option.iconOnly) && option.label
|
|
3126
3486
|
]
|
|
3127
3487
|
},
|
|
@@ -3130,17 +3490,17 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
3130
3490
|
}
|
|
3131
3491
|
|
|
3132
3492
|
// src/FilterBar.tsx
|
|
3133
|
-
import { useRef as
|
|
3493
|
+
import { useRef as useRef16, useState as useState12 } from "react";
|
|
3134
3494
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
3135
|
-
import { Fragment as
|
|
3495
|
+
import { Fragment as Fragment14, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3136
3496
|
var SEARCH_AT = 10;
|
|
3137
3497
|
var isRow2 = (entry) => entry !== "---" && !entry.separator;
|
|
3138
3498
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clearVariant = "ghost", add, addLabel = "Filter", disabled = false, busy = false, onRemove, onClear, onChange, onAdd }) {
|
|
3139
|
-
const bar =
|
|
3140
|
-
const focused =
|
|
3141
|
-
const landing =
|
|
3142
|
-
const [opened, setOpened] =
|
|
3143
|
-
const [adding, setAdding] =
|
|
3499
|
+
const bar = useRef16(null);
|
|
3500
|
+
const focused = useRef16(null);
|
|
3501
|
+
const landing = useRef16(null);
|
|
3502
|
+
const [opened, setOpened] = useState12({});
|
|
3503
|
+
const [adding, setAdding] = useState12(false);
|
|
3144
3504
|
const blocked = disabled || busy;
|
|
3145
3505
|
const offer = (add || []).filter((entry) => !filters.some((filter) => filter.id === entry.id));
|
|
3146
3506
|
const source = /* @__PURE__ */ new Map();
|
|
@@ -3182,7 +3542,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3182
3542
|
if (target) target.focus();
|
|
3183
3543
|
else focusNextStop(bar.current);
|
|
3184
3544
|
});
|
|
3185
|
-
return /* @__PURE__ */
|
|
3545
|
+
return /* @__PURE__ */ jsx30("div", { children: /* @__PURE__ */ jsxs26(
|
|
3186
3546
|
"fieldset",
|
|
3187
3547
|
{
|
|
3188
3548
|
ref: bar,
|
|
@@ -3195,8 +3555,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3195
3555
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) focused.current = null;
|
|
3196
3556
|
},
|
|
3197
3557
|
children: [
|
|
3198
|
-
/* @__PURE__ */
|
|
3199
|
-
filters.map((filter, index) => /* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx30("legend", { className: "ui-filter-bar__legend", children: label }),
|
|
3559
|
+
filters.map((filter, index) => /* @__PURE__ */ jsxs26(
|
|
3200
3560
|
"fieldset",
|
|
3201
3561
|
{
|
|
3202
3562
|
className: "ui-filter-bar__chip",
|
|
@@ -3206,14 +3566,14 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3206
3566
|
focused.current = { id: filter.id, index, remove: Boolean(event.target.closest("[data-filter-remove]")) };
|
|
3207
3567
|
},
|
|
3208
3568
|
children: [
|
|
3209
|
-
/* @__PURE__ */
|
|
3210
|
-
/* @__PURE__ */
|
|
3569
|
+
/* @__PURE__ */ jsx30("legend", { className: "ui-filter-bar__legend", children: filter.label }),
|
|
3570
|
+
/* @__PURE__ */ jsx30(
|
|
3211
3571
|
Dropdown,
|
|
3212
3572
|
{
|
|
3213
3573
|
items: filterChipItems(filter),
|
|
3214
3574
|
variant: "select",
|
|
3215
3575
|
ariaLabel: filterChipName(filter),
|
|
3216
|
-
triggerContent: /* @__PURE__ */
|
|
3576
|
+
triggerContent: /* @__PURE__ */ jsx30("span", { className: filterChipUnset(filter) ? "ui-dropdown__value is-placeholder" : "ui-dropdown__value", children: filterChipText(filter) }),
|
|
3217
3577
|
open: !blocked && !filter.disabled && (opened[filter.id] && opened[filter.id].against === filter.open ? opened[filter.id].open : !!filter.open),
|
|
3218
3578
|
onOpenChange: (open) => setOpened((previous) => ({ ...previous, [filter.id]: { open, against: filter.open } })),
|
|
3219
3579
|
onSelect: (value) => {
|
|
@@ -3221,7 +3581,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3221
3581
|
}
|
|
3222
3582
|
}
|
|
3223
3583
|
),
|
|
3224
|
-
!filterChipUnset(filter) && /* @__PURE__ */
|
|
3584
|
+
!filterChipUnset(filter) && /* @__PURE__ */ jsx30(
|
|
3225
3585
|
"button",
|
|
3226
3586
|
{
|
|
3227
3587
|
type: "button",
|
|
@@ -3238,16 +3598,16 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3238
3598
|
},
|
|
3239
3599
|
filter.id
|
|
3240
3600
|
)),
|
|
3241
|
-
offering && /* @__PURE__ */
|
|
3601
|
+
offering && /* @__PURE__ */ jsx30("div", { "data-filter-add": "", onFocus: () => {
|
|
3242
3602
|
focused.current = null;
|
|
3243
|
-
}, children: /* @__PURE__ */
|
|
3603
|
+
}, children: /* @__PURE__ */ jsx30(
|
|
3244
3604
|
Dropdown,
|
|
3245
3605
|
{
|
|
3246
3606
|
variant: "menu",
|
|
3247
3607
|
sections,
|
|
3248
3608
|
ariaLabel: addLabel,
|
|
3249
|
-
triggerContent: /* @__PURE__ */
|
|
3250
|
-
/* @__PURE__ */
|
|
3609
|
+
triggerContent: /* @__PURE__ */ jsxs26(Fragment14, { children: [
|
|
3610
|
+
/* @__PURE__ */ jsx30(Icon, { name: "plus" }),
|
|
3251
3611
|
addLabel
|
|
3252
3612
|
] }),
|
|
3253
3613
|
search: options >= SEARCH_AT && { label: `Search ${label.toLowerCase()}` },
|
|
@@ -3261,9 +3621,9 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3261
3621
|
}
|
|
3262
3622
|
}
|
|
3263
3623
|
) }),
|
|
3264
|
-
filters.some((filter) => !filterChipUnset(filter)) && /* @__PURE__ */
|
|
3624
|
+
filters.some((filter) => !filterChipUnset(filter)) && /* @__PURE__ */ jsx30("span", { "data-filter-clear": "", onFocus: () => {
|
|
3265
3625
|
focused.current = { id: null, index: 0 };
|
|
3266
|
-
}, children: /* @__PURE__ */
|
|
3626
|
+
}, children: /* @__PURE__ */ jsx30(Button, { size: "sm", variant: clearVariant, onClick: () => {
|
|
3267
3627
|
if (!blocked) onClear();
|
|
3268
3628
|
}, children: clearLabel }) })
|
|
3269
3629
|
]
|
|
@@ -3272,37 +3632,37 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3272
3632
|
}
|
|
3273
3633
|
|
|
3274
3634
|
// src/KeyValueList.tsx
|
|
3275
|
-
import { jsx as
|
|
3635
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3276
3636
|
function detail({ value, redacted }) {
|
|
3277
|
-
if (redacted) return /* @__PURE__ */
|
|
3278
|
-
/* @__PURE__ */
|
|
3637
|
+
if (redacted) return /* @__PURE__ */ jsxs27("span", { className: "ui-kv__hidden", children: [
|
|
3638
|
+
/* @__PURE__ */ jsx31(Icon, { name: "eyeOff" }),
|
|
3279
3639
|
"Hidden"
|
|
3280
3640
|
] });
|
|
3281
3641
|
if (value == null) return "\u2014";
|
|
3282
3642
|
return typeof value === "boolean" ? String(value) : value;
|
|
3283
3643
|
}
|
|
3284
3644
|
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
3285
|
-
return /* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3645
|
+
return /* @__PURE__ */ jsx31("dl", { ...rest, className: ["ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */ jsxs27("div", { className: "ui-drawer__row", children: [
|
|
3646
|
+
/* @__PURE__ */ jsx31("dt", { children: row.label }),
|
|
3647
|
+
/* @__PURE__ */ jsx31("dd", { children: detail(row) })
|
|
3288
3648
|
] }, index)) });
|
|
3289
3649
|
}
|
|
3290
3650
|
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
3291
3651
|
const Heading = `h${headingLevel}`;
|
|
3292
|
-
return /* @__PURE__ */
|
|
3293
|
-
title != null && /* @__PURE__ */
|
|
3652
|
+
return /* @__PURE__ */ jsxs27("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
3653
|
+
title != null && /* @__PURE__ */ jsx31(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
3294
3654
|
children
|
|
3295
3655
|
] });
|
|
3296
3656
|
}
|
|
3297
3657
|
|
|
3298
3658
|
// src/Snippet.tsx
|
|
3299
|
-
import { useEffect as
|
|
3300
|
-
import { Fragment as
|
|
3659
|
+
import { useEffect as useEffect13, useRef as useRef17, useState as useState13 } from "react";
|
|
3660
|
+
import { Fragment as Fragment15, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3301
3661
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
3302
|
-
const [status, setStatus] =
|
|
3303
|
-
const request =
|
|
3304
|
-
const timer =
|
|
3305
|
-
|
|
3662
|
+
const [status, setStatus] = useState13("idle");
|
|
3663
|
+
const request = useRef17(0);
|
|
3664
|
+
const timer = useRef17(void 0);
|
|
3665
|
+
useEffect13(() => {
|
|
3306
3666
|
setStatus("idle");
|
|
3307
3667
|
return () => {
|
|
3308
3668
|
request.current++;
|
|
@@ -3322,114 +3682,37 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3322
3682
|
if (current === request.current) setStatus("failed");
|
|
3323
3683
|
}
|
|
3324
3684
|
}
|
|
3325
|
-
return /* @__PURE__ */
|
|
3326
|
-
/* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
copy && /* @__PURE__ */
|
|
3329
|
-
/* @__PURE__ */
|
|
3685
|
+
return /* @__PURE__ */ jsxs28("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
3686
|
+
/* @__PURE__ */ jsxs28("div", { className: "ui-snippet__bar", children: [
|
|
3687
|
+
/* @__PURE__ */ jsx32("span", { children: label }),
|
|
3688
|
+
copy && /* @__PURE__ */ jsxs28(Fragment15, { children: [
|
|
3689
|
+
/* @__PURE__ */ jsx32(
|
|
3330
3690
|
"button",
|
|
3331
3691
|
{
|
|
3332
3692
|
type: "button",
|
|
3333
3693
|
className: "ui-snippet__copy",
|
|
3334
3694
|
"aria-label": copyLabel,
|
|
3335
|
-
title: copyLabel,
|
|
3336
|
-
onClick: handleCopy,
|
|
3337
|
-
children: /* @__PURE__ */
|
|
3338
|
-
}
|
|
3339
|
-
),
|
|
3340
|
-
/* @__PURE__ */
|
|
3341
|
-
] })
|
|
3342
|
-
] }),
|
|
3343
|
-
/* @__PURE__ */
|
|
3344
|
-
] });
|
|
3345
|
-
}
|
|
3346
|
-
|
|
3347
|
-
// src/Tabs.tsx
|
|
3348
|
-
import { useEffect as useEffect10, useId as useId9, useRef as useRef15 } from "react";
|
|
3349
|
-
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
3350
|
-
import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3351
|
-
function Tabs({ items, value, onChange, label }) {
|
|
3352
|
-
const id = useId9();
|
|
3353
|
-
const previous = useRef15(value);
|
|
3354
|
-
const activePanel = useRef15(null);
|
|
3355
|
-
const buttons = useRef15([]);
|
|
3356
|
-
useEffect10(() => {
|
|
3357
|
-
if (previous.current !== value) playEntrance(activePanel.current);
|
|
3358
|
-
previous.current = value;
|
|
3359
|
-
}, [value]);
|
|
3360
|
-
return /* @__PURE__ */ jsxs25("div", { className: "ui-tabs", children: [
|
|
3361
|
-
/* @__PURE__ */ jsx29("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */ jsxs25(
|
|
3362
|
-
"button",
|
|
3363
|
-
{
|
|
3364
|
-
type: "button",
|
|
3365
|
-
role: "tab",
|
|
3366
|
-
ref: (el) => {
|
|
3367
|
-
buttons.current[i] = el;
|
|
3368
|
-
},
|
|
3369
|
-
className: `ui-tabs__tab${item.value === value ? " is-active" : ""}`,
|
|
3370
|
-
id: `${id}-tab-${i}`,
|
|
3371
|
-
"aria-controls": `${id}-panel-${i}`,
|
|
3372
|
-
"aria-selected": item.value === value,
|
|
3373
|
-
tabIndex: item.value === value ? 0 : -1,
|
|
3374
|
-
onClick: () => onChange(item.value),
|
|
3375
|
-
onKeyDown: (event) => {
|
|
3376
|
-
let next;
|
|
3377
|
-
switch (event.key) {
|
|
3378
|
-
case "ArrowRight":
|
|
3379
|
-
next = (i + 1) % items.length;
|
|
3380
|
-
break;
|
|
3381
|
-
case "ArrowLeft":
|
|
3382
|
-
next = (i - 1 + items.length) % items.length;
|
|
3383
|
-
break;
|
|
3384
|
-
case "Home":
|
|
3385
|
-
next = 0;
|
|
3386
|
-
break;
|
|
3387
|
-
case "End":
|
|
3388
|
-
next = items.length - 1;
|
|
3389
|
-
break;
|
|
3390
|
-
default:
|
|
3391
|
-
return;
|
|
3392
|
-
}
|
|
3393
|
-
event.preventDefault();
|
|
3394
|
-
buttons.current[next]?.focus();
|
|
3395
|
-
onChange(items[next].value);
|
|
3396
|
-
},
|
|
3397
|
-
children: [
|
|
3398
|
-
item.label,
|
|
3399
|
-
item.count != null && /* @__PURE__ */ jsxs25(Fragment12, { children: [
|
|
3400
|
-
" ",
|
|
3401
|
-
item.count
|
|
3402
|
-
] })
|
|
3403
|
-
]
|
|
3404
|
-
},
|
|
3405
|
-
item.value
|
|
3406
|
-
)) }),
|
|
3407
|
-
/* @__PURE__ */ jsx29("div", { className: "ui-tabs__panels", children: items.map((item, i) => /* @__PURE__ */ jsx29(
|
|
3408
|
-
"div",
|
|
3409
|
-
{
|
|
3410
|
-
className: "ui-tabs__panel",
|
|
3411
|
-
role: "tabpanel",
|
|
3412
|
-
ref: item.value === value ? activePanel : void 0,
|
|
3413
|
-
id: `${id}-panel-${i}`,
|
|
3414
|
-
"aria-labelledby": `${id}-tab-${i}`,
|
|
3415
|
-
tabIndex: 0,
|
|
3416
|
-
hidden: item.value !== value,
|
|
3417
|
-
children: item.value === value ? item.panel : null
|
|
3418
|
-
},
|
|
3419
|
-
item.value
|
|
3420
|
-
)) })
|
|
3695
|
+
title: copyLabel,
|
|
3696
|
+
onClick: handleCopy,
|
|
3697
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: status === "idle" ? "copy" : "check" })
|
|
3698
|
+
}
|
|
3699
|
+
),
|
|
3700
|
+
/* @__PURE__ */ jsx32("span", { className: "ui-sr ui-snippet__status", role: "status", "aria-live": "polite", children: status === "copied" ? "Copied" : status === "failed" ? "Copy failed" : "" })
|
|
3701
|
+
] })
|
|
3702
|
+
] }),
|
|
3703
|
+
/* @__PURE__ */ jsx32("pre", { children: children ?? code })
|
|
3421
3704
|
] });
|
|
3422
3705
|
}
|
|
3423
3706
|
|
|
3424
3707
|
// src/Timeline.tsx
|
|
3425
|
-
import { useEffect as
|
|
3708
|
+
import { useEffect as useEffect14, useRef as useRef18 } from "react";
|
|
3426
3709
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
3427
|
-
import { jsx as
|
|
3710
|
+
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3428
3711
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
3429
3712
|
function Timeline({ events, className, ...rest }) {
|
|
3430
|
-
const previousIds =
|
|
3431
|
-
const rows =
|
|
3432
|
-
|
|
3713
|
+
const previousIds = useRef18(new Set(events.map((event) => event.id)));
|
|
3714
|
+
const rows = useRef18(/* @__PURE__ */ new Map());
|
|
3715
|
+
useEffect14(() => {
|
|
3433
3716
|
if (previousIds.current.size > 0 && !prefersReducedMotion()) {
|
|
3434
3717
|
for (const event of events) {
|
|
3435
3718
|
if (previousIds.current.has(event.id)) continue;
|
|
@@ -3441,7 +3724,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3441
3724
|
}
|
|
3442
3725
|
previousIds.current = new Set(events.map((event) => event.id));
|
|
3443
3726
|
}, [events]);
|
|
3444
|
-
return /* @__PURE__ */
|
|
3727
|
+
return /* @__PURE__ */ jsx33("ol", { ...rest, role: "list", className: ["ui-timeline", events.some((event) => event.kind) && "ui-timeline--kinds", className].filter(Boolean).join(" "), children: events.map((event, index) => /* @__PURE__ */ jsxs29(
|
|
3445
3728
|
"li",
|
|
3446
3729
|
{
|
|
3447
3730
|
className: "ui-timeline__event",
|
|
@@ -3450,20 +3733,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3450
3733
|
else rows.current.delete(event.id);
|
|
3451
3734
|
},
|
|
3452
3735
|
children: [
|
|
3453
|
-
/* @__PURE__ */
|
|
3736
|
+
/* @__PURE__ */ jsx33("span", { "aria-hidden": "true", className: [
|
|
3454
3737
|
"ui-timeline__marker",
|
|
3455
3738
|
event.kind && "ui-timeline__marker--kind",
|
|
3456
3739
|
event.kind === "reversal" && "ui-timeline__marker--reversal"
|
|
3457
|
-
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */
|
|
3458
|
-
/* @__PURE__ */
|
|
3459
|
-
/* @__PURE__ */
|
|
3460
|
-
/* @__PURE__ */
|
|
3461
|
-
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */
|
|
3740
|
+
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */ jsx33(Icon, { name: kindIcons[event.kind] }) }),
|
|
3741
|
+
/* @__PURE__ */ jsxs29("div", { className: "ui-timeline__head", children: [
|
|
3742
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-timeline__actor", children: event.actor }),
|
|
3743
|
+
/* @__PURE__ */ jsx33("time", { dateTime: event.dateTime, children: event.timestamp }),
|
|
3744
|
+
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */ jsx33("span", { className: "ui-timeline__relative", children: event.relativeTimestamp })
|
|
3462
3745
|
] }),
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
(event.meta != null || event.undo) && /* @__PURE__ */
|
|
3465
|
-
event.meta != null && /* @__PURE__ */
|
|
3466
|
-
event.undo && /* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ jsx33("p", { className: "ui-timeline__description", children: event.description }),
|
|
3747
|
+
(event.meta != null || event.undo) && /* @__PURE__ */ jsxs29("div", { className: "ui-timeline__meta", children: [
|
|
3748
|
+
event.meta != null && /* @__PURE__ */ jsx33("span", { children: event.meta }),
|
|
3749
|
+
event.undo && /* @__PURE__ */ jsx33(Button, { variant: "ghost", size: "xs", className: "ui-btn ui-btn--ghost ui-btn--xs ui-timeline__undo", "aria-label": event.undo.label, onClick: event.undo.onUndo, children: "Undo" })
|
|
3467
3750
|
] })
|
|
3468
3751
|
]
|
|
3469
3752
|
},
|
|
@@ -3472,20 +3755,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3472
3755
|
}
|
|
3473
3756
|
|
|
3474
3757
|
// src/Field.tsx
|
|
3475
|
-
import { forwardRef as
|
|
3758
|
+
import { forwardRef as forwardRef8, useEffect as useEffect15, useId as useId12, useRef as useRef19, useState as useState14 } from "react";
|
|
3476
3759
|
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3477
|
-
import { jsx as
|
|
3760
|
+
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3478
3761
|
function messages(id, hint, error) {
|
|
3479
3762
|
return [error && `${id}-error`, hint && `${id}-hint`].filter(Boolean).join(" ") || void 0;
|
|
3480
3763
|
}
|
|
3481
3764
|
function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
3482
|
-
return /* @__PURE__ */
|
|
3483
|
-
/* @__PURE__ */
|
|
3765
|
+
return /* @__PURE__ */ jsxs30("div", { className: "ui-field", children: [
|
|
3766
|
+
/* @__PURE__ */ jsxs30("label", { className: "ui-field__label", id: labelId, htmlFor: id, children: [
|
|
3484
3767
|
label,
|
|
3485
|
-
required && /* @__PURE__ */
|
|
3768
|
+
required && /* @__PURE__ */ jsx34("span", { className: "ui-field__req", "aria-hidden": "true", children: "*" })
|
|
3486
3769
|
] }),
|
|
3487
3770
|
children,
|
|
3488
|
-
error && /* @__PURE__ */
|
|
3771
|
+
error && /* @__PURE__ */ jsx34(
|
|
3489
3772
|
"div",
|
|
3490
3773
|
{
|
|
3491
3774
|
id: `${id}-error`,
|
|
@@ -3494,23 +3777,23 @@ function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
|
3494
3777
|
dangerouslySetInnerHTML: { __html: icon5("alert") + esc(error) }
|
|
3495
3778
|
}
|
|
3496
3779
|
),
|
|
3497
|
-
hint && /* @__PURE__ */
|
|
3780
|
+
hint && /* @__PURE__ */ jsx34("div", { id: `${id}-hint`, className: "ui-field__hint", children: hint })
|
|
3498
3781
|
] });
|
|
3499
3782
|
}
|
|
3500
3783
|
function wiring(id, hint, error) {
|
|
3501
3784
|
return { id, "aria-describedby": messages(id, hint, error), "aria-invalid": error ? true : void 0 };
|
|
3502
3785
|
}
|
|
3503
3786
|
function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
3504
|
-
const generatedId =
|
|
3787
|
+
const generatedId = useId12();
|
|
3505
3788
|
const id = suppliedId ?? generatedId;
|
|
3506
3789
|
const labelId = `${id}-label`;
|
|
3507
|
-
return /* @__PURE__ */
|
|
3790
|
+
return /* @__PURE__ */ jsx34(Frame, { ...{ id, labelId, label, hint, error, required }, children: /* @__PURE__ */ jsx34(FieldContext.Provider, { value: { id, labelId }, children: children({ ...wiring(id, hint, error), required }) }) });
|
|
3508
3791
|
}
|
|
3509
|
-
var TextField =
|
|
3510
|
-
const id =
|
|
3792
|
+
var TextField = forwardRef8(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph2, className = "", ...props }, ref) {
|
|
3793
|
+
const id = useId12();
|
|
3511
3794
|
const hasUnit = type === "number" && !!unit;
|
|
3512
3795
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
3513
|
-
const control = /* @__PURE__ */
|
|
3796
|
+
const control = /* @__PURE__ */ jsx34(
|
|
3514
3797
|
"input",
|
|
3515
3798
|
{
|
|
3516
3799
|
ref,
|
|
@@ -3523,19 +3806,19 @@ var TextField = forwardRef6(function TextField2({ label, hint, error, required,
|
|
|
3523
3806
|
className: `ui-input${error ? " is-invalid" : ""} ${className}`
|
|
3524
3807
|
}
|
|
3525
3808
|
);
|
|
3526
|
-
const unitSpan = hasUnit ? /* @__PURE__ */
|
|
3527
|
-
return /* @__PURE__ */
|
|
3528
|
-
/* @__PURE__ */
|
|
3809
|
+
const unitSpan = hasUnit ? /* @__PURE__ */ jsx34("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
3810
|
+
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: glyph2 ? /* @__PURE__ */ jsxs30("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
3811
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(glyph2) } }),
|
|
3529
3812
|
control,
|
|
3530
3813
|
unitSpan
|
|
3531
|
-
] }) : hasUnit ? /* @__PURE__ */
|
|
3814
|
+
] }) : hasUnit ? /* @__PURE__ */ jsxs30("div", { className: "ui-field-number", children: [
|
|
3532
3815
|
control,
|
|
3533
3816
|
unitSpan
|
|
3534
3817
|
] }) : control });
|
|
3535
3818
|
});
|
|
3536
3819
|
function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
3537
|
-
const id =
|
|
3538
|
-
return /* @__PURE__ */
|
|
3820
|
+
const id = useId12();
|
|
3821
|
+
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx34(
|
|
3539
3822
|
"textarea",
|
|
3540
3823
|
{
|
|
3541
3824
|
rows: 4,
|
|
@@ -3547,8 +3830,8 @@ function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
|
3547
3830
|
) });
|
|
3548
3831
|
}
|
|
3549
3832
|
function SelectField({ label, hint, error, required, className = "", children, ...props }) {
|
|
3550
|
-
const id =
|
|
3551
|
-
return /* @__PURE__ */
|
|
3833
|
+
const id = useId12();
|
|
3834
|
+
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx34(
|
|
3552
3835
|
"select",
|
|
3553
3836
|
{
|
|
3554
3837
|
...props,
|
|
@@ -3560,11 +3843,11 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
3560
3843
|
) });
|
|
3561
3844
|
}
|
|
3562
3845
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
3563
|
-
const id =
|
|
3564
|
-
const input =
|
|
3565
|
-
const [file, setFile] =
|
|
3566
|
-
const [dragging, setDragging] =
|
|
3567
|
-
|
|
3846
|
+
const id = useId12();
|
|
3847
|
+
const input = useRef19(null);
|
|
3848
|
+
const [file, setFile] = useState14(null);
|
|
3849
|
+
const [dragging, setDragging] = useState14(false);
|
|
3850
|
+
useEffect15(() => {
|
|
3568
3851
|
const form = input.current?.form;
|
|
3569
3852
|
const reset = () => {
|
|
3570
3853
|
setFile(null);
|
|
@@ -3577,7 +3860,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3577
3860
|
setFile(next);
|
|
3578
3861
|
onFileChange?.(next);
|
|
3579
3862
|
};
|
|
3580
|
-
return /* @__PURE__ */
|
|
3863
|
+
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsxs30(
|
|
3581
3864
|
"div",
|
|
3582
3865
|
{
|
|
3583
3866
|
className: `ui-file${dragging && !disabled ? " is-dragging" : ""}${file ? " has-file" : ""}${error ? " is-invalid" : ""}${disabled ? " is-disabled" : ""}`,
|
|
@@ -3598,12 +3881,12 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3598
3881
|
update(transfer.files[0]);
|
|
3599
3882
|
},
|
|
3600
3883
|
children: [
|
|
3601
|
-
/* @__PURE__ */
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-file__glyph", children: /* @__PURE__ */ jsx34(Icon, { name: "upload" }) }),
|
|
3885
|
+
/* @__PURE__ */ jsx34("div", { "aria-live": "polite", children: file ? file.name : "Drop a file here" }),
|
|
3886
|
+
/* @__PURE__ */ jsx34("div", { children: "or choose one from your device" }),
|
|
3887
|
+
/* @__PURE__ */ jsxs30("span", { className: "ui-file__choose", children: [
|
|
3888
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-btn ui-btn--secondary ui-btn--sm", "aria-hidden": "true", "aria-disabled": disabled || void 0, children: file ? "Replace file" : "Choose file" }),
|
|
3889
|
+
/* @__PURE__ */ jsx34(
|
|
3607
3890
|
"input",
|
|
3608
3891
|
{
|
|
3609
3892
|
...props,
|
|
@@ -3623,11 +3906,11 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3623
3906
|
}
|
|
3624
3907
|
|
|
3625
3908
|
// src/FileDrop.tsx
|
|
3626
|
-
import { useRef as
|
|
3909
|
+
import { useRef as useRef20, useState as useState15 } from "react";
|
|
3627
3910
|
|
|
3628
3911
|
// src/EmptyState.tsx
|
|
3629
3912
|
import { icon as kitIcon3, illo } from "@apliteni/apliteni-ui";
|
|
3630
|
-
import { jsx as
|
|
3913
|
+
import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3631
3914
|
var cases = {
|
|
3632
3915
|
"first-run": { title: "Nothing needs you yet", sub: "New items will appear here when they need your attention.", icon: "check" },
|
|
3633
3916
|
"no-matches": { title: "No results in this view", sub: "Try another search or clear your filters.", icon: "search" },
|
|
@@ -3638,17 +3921,17 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon9, art, actio
|
|
|
3638
3921
|
const preset = cases[variant];
|
|
3639
3922
|
const heading = title ?? preset.title;
|
|
3640
3923
|
const guidance = sub ?? preset.sub;
|
|
3641
|
-
const
|
|
3642
|
-
return /* @__PURE__ */
|
|
3643
|
-
art ? typeof art === "string" ? /* @__PURE__ */
|
|
3644
|
-
heading && /* @__PURE__ */
|
|
3645
|
-
guidance && /* @__PURE__ */
|
|
3646
|
-
actions && /* @__PURE__ */
|
|
3924
|
+
const glyph2 = icon9 ?? preset.icon;
|
|
3925
|
+
return /* @__PURE__ */ jsxs31("div", { className: "ui-empty", children: [
|
|
3926
|
+
art ? typeof art === "string" ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) : glyph2 ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__icon", dangerouslySetInnerHTML: { __html: kitIcon3(glyph2) } }) : null,
|
|
3927
|
+
heading && /* @__PURE__ */ jsx35("div", { className: "ui-empty__title", children: heading }),
|
|
3928
|
+
guidance && /* @__PURE__ */ jsx35("div", { className: "ui-empty__sub", children: guidance }),
|
|
3929
|
+
actions && /* @__PURE__ */ jsx35("div", { className: "ui-empty__actions", children: actions })
|
|
3647
3930
|
] });
|
|
3648
3931
|
}
|
|
3649
3932
|
|
|
3650
3933
|
// src/FileDrop.tsx
|
|
3651
|
-
import { Fragment as
|
|
3934
|
+
import { Fragment as Fragment16, jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3652
3935
|
var MARKS = {
|
|
3653
3936
|
uploading: "clock",
|
|
3654
3937
|
done: "circleCheck",
|
|
@@ -3684,8 +3967,8 @@ function FileDrop({
|
|
|
3684
3967
|
children,
|
|
3685
3968
|
className
|
|
3686
3969
|
}) {
|
|
3687
|
-
const input =
|
|
3688
|
-
const [over, setOver] =
|
|
3970
|
+
const input = useRef20(null);
|
|
3971
|
+
const [over, setOver] = useState15(false);
|
|
3689
3972
|
const status = file?.status ?? "uploading";
|
|
3690
3973
|
const word = status === "error" ? file?.error ?? WORDS.error : file?.state ?? WORDS[status];
|
|
3691
3974
|
const [stem, ext] = splitName(file?.name ?? "");
|
|
@@ -3701,7 +3984,7 @@ function FileDrop({
|
|
|
3701
3984
|
const pick = () => {
|
|
3702
3985
|
if (!disabled) input.current?.click();
|
|
3703
3986
|
};
|
|
3704
|
-
const picker = /* @__PURE__ */
|
|
3987
|
+
const picker = /* @__PURE__ */ jsx36(
|
|
3705
3988
|
"input",
|
|
3706
3989
|
{
|
|
3707
3990
|
ref: input,
|
|
@@ -3734,20 +4017,20 @@ function FileDrop({
|
|
|
3734
4017
|
take(Array.from(event.dataTransfer.files));
|
|
3735
4018
|
}
|
|
3736
4019
|
};
|
|
3737
|
-
if (title !== void 0) return /* @__PURE__ */
|
|
4020
|
+
if (title !== void 0) return /* @__PURE__ */ jsxs32(
|
|
3738
4021
|
"div",
|
|
3739
4022
|
{
|
|
3740
4023
|
className: cx7("ui-drop", "ui-drop--area", showTarget && "is-dragging", disabled && "is-disabled", className),
|
|
3741
4024
|
onClick: pick,
|
|
3742
4025
|
...drag,
|
|
3743
4026
|
children: [
|
|
3744
|
-
/* @__PURE__ */
|
|
4027
|
+
/* @__PURE__ */ jsx36(
|
|
3745
4028
|
EmptyState,
|
|
3746
4029
|
{
|
|
3747
4030
|
icon: "upload",
|
|
3748
4031
|
title,
|
|
3749
4032
|
sub: note ?? "",
|
|
3750
|
-
actions: /* @__PURE__ */
|
|
4033
|
+
actions: /* @__PURE__ */ jsx36(
|
|
3751
4034
|
Button,
|
|
3752
4035
|
{
|
|
3753
4036
|
variant: "primary",
|
|
@@ -3767,18 +4050,18 @@ function FileDrop({
|
|
|
3767
4050
|
]
|
|
3768
4051
|
}
|
|
3769
4052
|
);
|
|
3770
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ jsxs32("div", { className: cx7("ui-drop", disabled && "is-disabled", className), ...drag, children: [
|
|
3771
4054
|
children,
|
|
3772
|
-
/* @__PURE__ */
|
|
3773
|
-
file ? /* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
3775
|
-
/* @__PURE__ */
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
/* @__PURE__ */
|
|
4055
|
+
/* @__PURE__ */ jsxs32("div", { className: "ui-drop__row", children: [
|
|
4056
|
+
file ? /* @__PURE__ */ jsxs32("div", { className: cx7("ui-drop__file", status === "error" && "ui-drop__file--failed"), children: [
|
|
4057
|
+
/* @__PURE__ */ jsxs32("div", { className: "ui-drop__line", children: [
|
|
4058
|
+
/* @__PURE__ */ jsxs32("span", { className: "ui-drop__name", title: file.name, children: [
|
|
4059
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-drop__stem", children: stem }),
|
|
4060
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-drop__ext", children: ext })
|
|
3778
4061
|
] }),
|
|
3779
|
-
(onRemove || status === "error" && onRetry) && /* @__PURE__ */
|
|
3780
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
3781
|
-
onRemove && /* @__PURE__ */
|
|
4062
|
+
(onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs32("span", { className: "ui-drop__actions", children: [
|
|
4063
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx36(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
|
|
4064
|
+
onRemove && /* @__PURE__ */ jsx36(
|
|
3782
4065
|
Button,
|
|
3783
4066
|
{
|
|
3784
4067
|
variant: "ghost",
|
|
@@ -3790,21 +4073,21 @@ function FileDrop({
|
|
|
3790
4073
|
)
|
|
3791
4074
|
] })
|
|
3792
4075
|
] }),
|
|
3793
|
-
(showSize || showWord) && /* @__PURE__ */
|
|
4076
|
+
(showSize || showWord) && /* @__PURE__ */ jsxs32(
|
|
3794
4077
|
"div",
|
|
3795
4078
|
{
|
|
3796
4079
|
className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
|
|
3797
4080
|
role: status === "error" ? "alert" : void 0,
|
|
3798
4081
|
children: [
|
|
3799
|
-
showSize && /* @__PURE__ */
|
|
3800
|
-
showWord && /* @__PURE__ */
|
|
3801
|
-
/* @__PURE__ */
|
|
3802
|
-
/* @__PURE__ */
|
|
4082
|
+
showSize && /* @__PURE__ */ jsx36("span", { className: "ui-drop__size", children: file.size }),
|
|
4083
|
+
showWord && /* @__PURE__ */ jsxs32("span", { className: "ui-drop__state", children: [
|
|
4084
|
+
/* @__PURE__ */ jsx36(Icon, { name: MARKS[status] }),
|
|
4085
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-drop__word", title: word, children: word })
|
|
3803
4086
|
] })
|
|
3804
4087
|
]
|
|
3805
4088
|
}
|
|
3806
4089
|
),
|
|
3807
|
-
hasBar && /* @__PURE__ */
|
|
4090
|
+
hasBar && /* @__PURE__ */ jsx36(
|
|
3808
4091
|
"span",
|
|
3809
4092
|
{
|
|
3810
4093
|
className: "ui-drop__bar",
|
|
@@ -3813,11 +4096,11 @@ function FileDrop({
|
|
|
3813
4096
|
"aria-valuenow": file.progress,
|
|
3814
4097
|
"aria-valuemin": 0,
|
|
3815
4098
|
"aria-valuemax": 100,
|
|
3816
|
-
children: /* @__PURE__ */
|
|
4099
|
+
children: /* @__PURE__ */ jsx36("span", { style: { width: `${file.progress}%` } })
|
|
3817
4100
|
}
|
|
3818
4101
|
)
|
|
3819
|
-
] }) : /* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
4102
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment16, { children: [
|
|
4103
|
+
/* @__PURE__ */ jsx36(
|
|
3821
4104
|
Button,
|
|
3822
4105
|
{
|
|
3823
4106
|
size: "sm",
|
|
@@ -3827,22 +4110,22 @@ function FileDrop({
|
|
|
3827
4110
|
children: label
|
|
3828
4111
|
}
|
|
3829
4112
|
),
|
|
3830
|
-
note && /* @__PURE__ */
|
|
4113
|
+
note && /* @__PURE__ */ jsx36("p", { className: "ui-drop__note", children: note })
|
|
3831
4114
|
] }),
|
|
3832
4115
|
picker
|
|
3833
4116
|
] }),
|
|
3834
|
-
showTarget && /* @__PURE__ */
|
|
4117
|
+
showTarget && /* @__PURE__ */ jsx36("div", { className: "ui-drop__target", "aria-hidden": "true", children: dropLabel })
|
|
3835
4118
|
] });
|
|
3836
4119
|
}
|
|
3837
4120
|
|
|
3838
4121
|
// src/SearchField.tsx
|
|
3839
|
-
import { forwardRef as
|
|
4122
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
3840
4123
|
import { icon as icon6 } from "@apliteni/apliteni-ui";
|
|
3841
|
-
import { jsx as
|
|
3842
|
-
var SearchField =
|
|
3843
|
-
return /* @__PURE__ */
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
4124
|
+
import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4125
|
+
var SearchField = forwardRef9(function SearchField2({ ariaLabel, className, ...props }, ref) {
|
|
4126
|
+
return /* @__PURE__ */ jsxs33("div", { className: "ui-input-group", children: [
|
|
4127
|
+
/* @__PURE__ */ jsx37("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon6("search") } }),
|
|
4128
|
+
/* @__PURE__ */ jsx37(
|
|
3846
4129
|
"input",
|
|
3847
4130
|
{
|
|
3848
4131
|
ref,
|
|
@@ -3856,8 +4139,8 @@ var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...p
|
|
|
3856
4139
|
});
|
|
3857
4140
|
|
|
3858
4141
|
// src/Toast.tsx
|
|
3859
|
-
import { createContext as createContext3, useCallback as useCallback6, useContext as useContext3, useEffect as
|
|
3860
|
-
import { createPortal as
|
|
4142
|
+
import { createContext as createContext3, useCallback as useCallback6, useContext as useContext3, useEffect as useEffect16, useLayoutEffect as useLayoutEffect4, useRef as useRef21, useState as useState16 } from "react";
|
|
4143
|
+
import { createPortal as createPortal6 } from "react-dom";
|
|
3861
4144
|
|
|
3862
4145
|
// src/lib/toast-stack.ts
|
|
3863
4146
|
var TOAST_PEEK = 8;
|
|
@@ -3966,7 +4249,7 @@ function watchToastPile(stack2) {
|
|
|
3966
4249
|
}
|
|
3967
4250
|
|
|
3968
4251
|
// src/Toast.tsx
|
|
3969
|
-
import { jsx as
|
|
4252
|
+
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3970
4253
|
var Context = createContext3(null);
|
|
3971
4254
|
var PileHoldContext = createContext3(false);
|
|
3972
4255
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
@@ -3976,24 +4259,24 @@ function useToast() {
|
|
|
3976
4259
|
return push;
|
|
3977
4260
|
}
|
|
3978
4261
|
function Notice({ notice, remove }) {
|
|
3979
|
-
const root =
|
|
3980
|
-
const [leaving2, setLeaving] =
|
|
3981
|
-
const dismissed =
|
|
3982
|
-
const [hovered, setHovered] =
|
|
3983
|
-
const [focused, setFocused] =
|
|
4262
|
+
const root = useRef21(null);
|
|
4263
|
+
const [leaving2, setLeaving] = useState16(false);
|
|
4264
|
+
const dismissed = useRef21(false);
|
|
4265
|
+
const [hovered, setHovered] = useState16(false);
|
|
4266
|
+
const [focused, setFocused] = useState16(false);
|
|
3984
4267
|
const pileHeld = useContext3(PileHoldContext);
|
|
3985
4268
|
const paused = hovered || focused || pileHeld;
|
|
3986
4269
|
const tone2 = notice.tone ?? "success";
|
|
3987
4270
|
const timed = !notice.action && notice.timer !== false && notice.timer !== 0;
|
|
3988
4271
|
const duration = typeof notice.timer === "number" ? notice.timer * 1e3 : 5e3;
|
|
3989
|
-
const remaining =
|
|
4272
|
+
const remaining = useRef21(duration);
|
|
3990
4273
|
const dismiss = useCallback6(() => {
|
|
3991
4274
|
if (dismissed.current) return;
|
|
3992
4275
|
dismissed.current = true;
|
|
3993
4276
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
3994
4277
|
else setLeaving(true);
|
|
3995
4278
|
}, [remove]);
|
|
3996
|
-
|
|
4279
|
+
useEffect16(() => {
|
|
3997
4280
|
if (leaving2) {
|
|
3998
4281
|
const element = root.current;
|
|
3999
4282
|
const finish = (event) => {
|
|
@@ -4007,7 +4290,7 @@ function Notice({ notice, remove }) {
|
|
|
4007
4290
|
};
|
|
4008
4291
|
}
|
|
4009
4292
|
}, [leaving2, remove]);
|
|
4010
|
-
|
|
4293
|
+
useEffect16(() => {
|
|
4011
4294
|
if (leaving2 || !timed || paused) return;
|
|
4012
4295
|
const started = Date.now();
|
|
4013
4296
|
const timer = setTimeout(dismiss, remaining.current);
|
|
@@ -4016,7 +4299,7 @@ function Notice({ notice, remove }) {
|
|
|
4016
4299
|
remaining.current = Math.max(0, remaining.current - (Date.now() - started));
|
|
4017
4300
|
};
|
|
4018
4301
|
}, [dismiss, leaving2, paused, timed]);
|
|
4019
|
-
return /* @__PURE__ */
|
|
4302
|
+
return /* @__PURE__ */ jsxs34(
|
|
4020
4303
|
"div",
|
|
4021
4304
|
{
|
|
4022
4305
|
ref: root,
|
|
@@ -4030,12 +4313,12 @@ function Notice({ notice, remove }) {
|
|
|
4030
4313
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
|
|
4031
4314
|
},
|
|
4032
4315
|
children: [
|
|
4033
|
-
/* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
4035
|
-
/* @__PURE__ */
|
|
4036
|
-
!notice.compact && notice.text && /* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx38(Icon, { name: glyphs[tone2] }) }),
|
|
4317
|
+
/* @__PURE__ */ jsxs34("div", { className: "ui-toast__body", children: [
|
|
4318
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-toast__title", children: notice.title }),
|
|
4319
|
+
!notice.compact && notice.text && /* @__PURE__ */ jsx38("div", { className: "ui-toast__text", children: notice.text })
|
|
4037
4320
|
] }),
|
|
4038
|
-
notice.action && /* @__PURE__ */
|
|
4321
|
+
notice.action && /* @__PURE__ */ jsx38(
|
|
4039
4322
|
"button",
|
|
4040
4323
|
{
|
|
4041
4324
|
type: "button",
|
|
@@ -4050,8 +4333,8 @@ function Notice({ notice, remove }) {
|
|
|
4050
4333
|
children: notice.action.label
|
|
4051
4334
|
}
|
|
4052
4335
|
),
|
|
4053
|
-
notice.dismissible !== false && /* @__PURE__ */
|
|
4054
|
-
timed && /* @__PURE__ */
|
|
4336
|
+
notice.dismissible !== false && /* @__PURE__ */ jsx38("button", { type: "button", className: "ui-toast__close", "aria-label": "Dismiss", disabled: leaving2, onClick: dismiss, children: /* @__PURE__ */ jsx38(Icon, { name: "x" }) }),
|
|
4337
|
+
timed && /* @__PURE__ */ jsx38(
|
|
4055
4338
|
"span",
|
|
4056
4339
|
{
|
|
4057
4340
|
className: "ui-toast__timer is-running",
|
|
@@ -4095,11 +4378,11 @@ function usePile(stack2, piled, count) {
|
|
|
4095
4378
|
}, [stack2, piled, count]);
|
|
4096
4379
|
}
|
|
4097
4380
|
function Toast({ children, collapse = false }) {
|
|
4098
|
-
const [entries, setEntries] =
|
|
4099
|
-
const [pileHovered, setPileHovered] =
|
|
4100
|
-
const [pileFocused, setPileFocused] =
|
|
4101
|
-
const nextId =
|
|
4102
|
-
const stack2 =
|
|
4381
|
+
const [entries, setEntries] = useState16([]);
|
|
4382
|
+
const [pileHovered, setPileHovered] = useState16(false);
|
|
4383
|
+
const [pileFocused, setPileFocused] = useState16(false);
|
|
4384
|
+
const nextId = useRef21(0);
|
|
4385
|
+
const stack2 = useRef21(null);
|
|
4103
4386
|
const push = useCallback6((notice) => {
|
|
4104
4387
|
const id = nextId.current++;
|
|
4105
4388
|
const remove = () => setEntries((current) => current.filter((entry) => entry.id !== id));
|
|
@@ -4112,10 +4395,10 @@ function Toast({ children, collapse = false }) {
|
|
|
4112
4395
|
const leavePileFocus = (event) => {
|
|
4113
4396
|
if (!event.currentTarget.contains(event.relatedTarget)) setPileFocused(false);
|
|
4114
4397
|
};
|
|
4115
|
-
return /* @__PURE__ */
|
|
4398
|
+
return /* @__PURE__ */ jsxs34(Context.Provider, { value: push, children: [
|
|
4116
4399
|
children,
|
|
4117
|
-
typeof document !== "undefined" &&
|
|
4118
|
-
/* @__PURE__ */
|
|
4400
|
+
typeof document !== "undefined" && createPortal6(
|
|
4401
|
+
/* @__PURE__ */ jsx38(
|
|
4119
4402
|
"div",
|
|
4120
4403
|
{
|
|
4121
4404
|
className: `ui-toast-stack rx-toast-stack${piled ? " ui-toast-stack--collapsed" : ""}`,
|
|
@@ -4127,7 +4410,7 @@ function Toast({ children, collapse = false }) {
|
|
|
4127
4410
|
onMouseLeave: () => setPileHovered(false),
|
|
4128
4411
|
onFocus: () => setPileFocused(true),
|
|
4129
4412
|
onBlur: leavePileFocus,
|
|
4130
|
-
children: /* @__PURE__ */
|
|
4413
|
+
children: /* @__PURE__ */ jsx38(PileHoldContext.Provider, { value: pileHeld, children: entries.map((entry) => /* @__PURE__ */ jsx38(Notice, { notice: entry.notice, remove: entry.remove }, entry.id)) })
|
|
4131
4414
|
}
|
|
4132
4415
|
),
|
|
4133
4416
|
document.body
|
|
@@ -4136,8 +4419,8 @@ function Toast({ children, collapse = false }) {
|
|
|
4136
4419
|
}
|
|
4137
4420
|
|
|
4138
4421
|
// src/AppShell.tsx
|
|
4139
|
-
import { useEffect as
|
|
4140
|
-
import { prism
|
|
4422
|
+
import { useEffect as useEffect18, useId as useId13, useMemo as useMemo4, useRef as useRef23, useState as useState18 } from "react";
|
|
4423
|
+
import { prism } from "@apliteni/apliteni-ui";
|
|
4141
4424
|
|
|
4142
4425
|
// src/lib/palette-hotkey.ts
|
|
4143
4426
|
function paletteHotkey(platform = typeof navigator === "undefined" ? "" : navigator.platform) {
|
|
@@ -4165,145 +4448,15 @@ function storeRailCollapsed(collapsed) {
|
|
|
4165
4448
|
}
|
|
4166
4449
|
}
|
|
4167
4450
|
|
|
4168
|
-
// src/
|
|
4169
|
-
import {
|
|
4170
|
-
import {
|
|
4171
|
-
import {
|
|
4172
|
-
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
4173
|
-
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
4174
|
-
const uid = useId11();
|
|
4175
|
-
const group = !sub && !!item.items?.length;
|
|
4176
|
-
const childActive = group && item.items.some((child) => child.id === active);
|
|
4177
|
-
const [expanded, setExpanded] = useState15();
|
|
4178
|
-
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
4179
|
-
const [entering, setEntering] = useState15(false);
|
|
4180
|
-
useEffect14(() => {
|
|
4181
|
-
if (!entering) return;
|
|
4182
|
-
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
4183
|
-
return () => clearTimeout(timer);
|
|
4184
|
-
}, [entering]);
|
|
4185
|
-
const count = badgeText(item.badge);
|
|
4186
|
-
const name = `${item.label}${count == null || count === "" ? "" : ` ${count}`}`;
|
|
4187
|
-
const isActive = !group && item.id === active;
|
|
4188
|
-
const className = [
|
|
4189
|
-
"ui-nav__item",
|
|
4190
|
-
sub && "ui-nav__item--sub",
|
|
4191
|
-
group && "ui-nav__toggle",
|
|
4192
|
-
isActive && "is-active",
|
|
4193
|
-
childActive && "is-current",
|
|
4194
|
-
item.disabled && "is-disabled",
|
|
4195
|
-
item.danger && "is-danger"
|
|
4196
|
-
].filter(Boolean).join(" ");
|
|
4197
|
-
const children = /* @__PURE__ */ jsxs32(Fragment14, { children: [
|
|
4198
|
-
(item.leading ?? item.icon) && /* @__PURE__ */ jsx36("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx36(Icon, { name: item.icon }) }),
|
|
4199
|
-
/* @__PURE__ */ jsx36("span", { className: "ui-nav__label", children: item.label }),
|
|
4200
|
-
count != null && count !== "" && /* @__PURE__ */ jsx36("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
4201
|
-
group && /* @__PURE__ */ jsx36("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
4202
|
-
] });
|
|
4203
|
-
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
4204
|
-
if (group) return /* @__PURE__ */ jsxs32("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
4205
|
-
/* @__PURE__ */ jsx36(
|
|
4206
|
-
"button",
|
|
4207
|
-
{
|
|
4208
|
-
...common,
|
|
4209
|
-
type: "button",
|
|
4210
|
-
disabled: item.disabled,
|
|
4211
|
-
"aria-expanded": open,
|
|
4212
|
-
"aria-controls": uid,
|
|
4213
|
-
onClick: () => {
|
|
4214
|
-
setExpanded(!open);
|
|
4215
|
-
setEntering(!open);
|
|
4216
|
-
}
|
|
4217
|
-
}
|
|
4218
|
-
),
|
|
4219
|
-
/* @__PURE__ */ jsx36("ul", { id: uid, className: `ui-nav__sub${entering ? " is-entering" : ""}`, hidden: !open, onAnimationEnd: () => setEntering(false), children: item.items.map((child) => /* @__PURE__ */ jsx36(Row, { item: child, active, activeIs, collapsed, renderLink, sub: true }, child.id)) })
|
|
4220
|
-
] });
|
|
4221
|
-
if (item.disabled) return /* @__PURE__ */ jsx36("li", { children: /* @__PURE__ */ jsx36("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
4222
|
-
const props = {
|
|
4223
|
-
...common,
|
|
4224
|
-
href: item.href ?? `#${item.id}`,
|
|
4225
|
-
target: item.target,
|
|
4226
|
-
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
4227
|
-
};
|
|
4228
|
-
return /* @__PURE__ */ jsx36("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx36("a", { ...props }) });
|
|
4229
|
-
}
|
|
4230
|
-
function Section({ section, ...props }) {
|
|
4231
|
-
const uid = useId11();
|
|
4232
|
-
return /* @__PURE__ */ jsxs32("div", { className: "ui-nav__section", children: [
|
|
4233
|
-
section.label && /* @__PURE__ */ jsx36("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
4234
|
-
/* @__PURE__ */ jsx36("ul", { className: "ui-nav__list", "aria-labelledby": section.label ? uid : void 0, children: section.items.map((item) => /* @__PURE__ */ jsx36(Row, { item, ...props }, item.id)) })
|
|
4235
|
-
] });
|
|
4236
|
-
}
|
|
4237
|
-
var SidebarNav = forwardRef8(function SidebarNav2({
|
|
4238
|
-
items = [],
|
|
4239
|
-
sections,
|
|
4240
|
-
active,
|
|
4241
|
-
activeIs = "page",
|
|
4242
|
-
collapsed = false,
|
|
4243
|
-
footer,
|
|
4244
|
-
renderLink,
|
|
4245
|
-
className,
|
|
4246
|
-
"aria-label": label = "Sidebar",
|
|
4247
|
-
...rest
|
|
4248
|
-
}, ref) {
|
|
4249
|
-
return /* @__PURE__ */ jsxs32("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
4250
|
-
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx36(
|
|
4251
|
-
Section,
|
|
4252
|
-
{
|
|
4253
|
-
section,
|
|
4254
|
-
active,
|
|
4255
|
-
activeIs,
|
|
4256
|
-
collapsed,
|
|
4257
|
-
renderLink
|
|
4258
|
-
},
|
|
4259
|
-
index
|
|
4260
|
-
)),
|
|
4261
|
-
footer && /* @__PURE__ */ jsx36("div", { className: "ui-nav__foot", children: footer })
|
|
4262
|
-
] });
|
|
4263
|
-
});
|
|
4264
|
-
|
|
4265
|
-
// src/Breadcrumbs.tsx
|
|
4266
|
-
import { forwardRef as forwardRef9 } from "react";
|
|
4267
|
-
import { icon as icon7, safeUrl as safeUrl2 } from "@apliteni/apliteni-ui";
|
|
4268
|
-
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4269
|
-
var Breadcrumbs = forwardRef9(function Breadcrumbs2({
|
|
4270
|
-
items,
|
|
4271
|
-
renderLink,
|
|
4272
|
-
className,
|
|
4273
|
-
"aria-label": ariaLabel = "Breadcrumb",
|
|
4274
|
-
...rest
|
|
4275
|
-
}, ref) {
|
|
4276
|
-
return /* @__PURE__ */ jsx37(
|
|
4277
|
-
"nav",
|
|
4278
|
-
{
|
|
4279
|
-
...rest,
|
|
4280
|
-
ref,
|
|
4281
|
-
className: ["ui-nav", "ui-nav--crumbs", className].filter(Boolean).join(" "),
|
|
4282
|
-
"aria-label": ariaLabel,
|
|
4283
|
-
children: /* @__PURE__ */ jsx37("ol", { className: "ui-nav__crumbs", children: items.map((item, index) => {
|
|
4284
|
-
const current = index === items.length - 1;
|
|
4285
|
-
const inner = /* @__PURE__ */ jsxs33(Fragment15, { children: [
|
|
4286
|
-
item.icon && /* @__PURE__ */ jsx37("span", { className: "ui-nav__ic", dangerouslySetInnerHTML: { __html: icon7(item.icon) } }),
|
|
4287
|
-
/* @__PURE__ */ jsx37("span", { className: "ui-nav__crumb-label", children: item.label })
|
|
4288
|
-
] });
|
|
4289
|
-
const linkProps = !current && item.href ? { className: "ui-nav__crumb", href: safeUrl2(item.href), target: item.target, children: inner } : null;
|
|
4290
|
-
return /* @__PURE__ */ jsx37("li", { className: "ui-nav__crumb-item", children: linkProps ? renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx37("a", { ...linkProps }) : /* @__PURE__ */ jsx37(
|
|
4291
|
-
"span",
|
|
4292
|
-
{
|
|
4293
|
-
className: ["ui-nav__crumb", current && "is-current"].filter(Boolean).join(" "),
|
|
4294
|
-
"aria-current": current ? "page" : void 0,
|
|
4295
|
-
children: inner
|
|
4296
|
-
}
|
|
4297
|
-
) }, index);
|
|
4298
|
-
}) })
|
|
4299
|
-
}
|
|
4300
|
-
);
|
|
4301
|
-
});
|
|
4451
|
+
// src/AccountMenu.tsx
|
|
4452
|
+
import { useEffect as useEffect17, useRef as useRef22, useState as useState17 } from "react";
|
|
4453
|
+
import { createPortal as createPortal7 } from "react-dom";
|
|
4454
|
+
import { icon as icon7, themeIcon as themeIcon2, transitionMs as transitionMs3 } from "@apliteni/apliteni-ui";
|
|
4302
4455
|
|
|
4303
4456
|
// src/ThemeToggle.tsx
|
|
4304
4457
|
import { useSyncExternalStore } from "react";
|
|
4305
4458
|
import { themeIcon } from "@apliteni/apliteni-ui";
|
|
4306
|
-
import { jsx as
|
|
4459
|
+
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4307
4460
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
4308
4461
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
4309
4462
|
var THEME_INIT_SCRIPT = `(()=>{let t;try{t=localStorage.getItem('apliteni-strategy-theme')}catch{}document.documentElement.setAttribute('data-theme',t==='dark'||t==='light'?t:window.matchMedia?.('(prefers-color-scheme: light)').matches?'light':'dark')})()`;
|
|
@@ -4352,31 +4505,205 @@ function useThemeChoice() {
|
|
|
4352
4505
|
const next = theme === "dark" ? "light" : theme === "light" ? "auto" : "dark";
|
|
4353
4506
|
const label = theme === "auto" ? "Auto" : theme === "light" ? "Light" : "Dark";
|
|
4354
4507
|
const name = `Theme: ${label}. Switch to ${next}.`;
|
|
4355
|
-
const
|
|
4356
|
-
document.documentElement.setAttribute("data-theme-choice",
|
|
4357
|
-
document.documentElement.setAttribute("data-theme",
|
|
4508
|
+
const set = (choice) => {
|
|
4509
|
+
document.documentElement.setAttribute("data-theme-choice", choice);
|
|
4510
|
+
document.documentElement.setAttribute("data-theme", choice === "auto" ? window.matchMedia?.("(prefers-color-scheme: light)").matches ? "light" : "dark" : choice);
|
|
4358
4511
|
try {
|
|
4359
|
-
localStorage.setItem(STORAGE_KEY,
|
|
4512
|
+
localStorage.setItem(STORAGE_KEY, choice);
|
|
4360
4513
|
} catch {
|
|
4361
4514
|
}
|
|
4362
4515
|
window.dispatchEvent(new Event(CHOICE_EVENT));
|
|
4363
4516
|
};
|
|
4364
|
-
|
|
4517
|
+
const toggle = () => set(next);
|
|
4518
|
+
return { theme, next, label, name, toggle, set };
|
|
4365
4519
|
}
|
|
4366
4520
|
function ThemeToggle({ labelled = false }) {
|
|
4367
4521
|
const { theme, label, name, toggle } = useThemeChoice();
|
|
4368
|
-
const button = /* @__PURE__ */
|
|
4369
|
-
return labelled ? /* @__PURE__ */
|
|
4522
|
+
const button = /* @__PURE__ */ jsx39("button", { type: "button", className: "toggle", "aria-label": name, title: name, onClick: toggle, children: /* @__PURE__ */ jsx39("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon(theme) } }) });
|
|
4523
|
+
return labelled ? /* @__PURE__ */ jsxs35("span", { className: "ui-theme-toggle", children: [
|
|
4370
4524
|
button,
|
|
4371
|
-
/* @__PURE__ */
|
|
4525
|
+
/* @__PURE__ */ jsxs35("span", { children: [
|
|
4372
4526
|
label,
|
|
4373
4527
|
" theme"
|
|
4374
4528
|
] })
|
|
4375
4529
|
] }) : button;
|
|
4376
4530
|
}
|
|
4377
4531
|
|
|
4532
|
+
// src/AccountMenu.tsx
|
|
4533
|
+
import { Fragment as Fragment17, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4534
|
+
var THEMES = [["auto", "Auto"], ["light", "Light"], ["dark", "Dark"]];
|
|
4535
|
+
var glyph = (svg, className) => /* @__PURE__ */ jsx40("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: svg } });
|
|
4536
|
+
function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
4537
|
+
const theme = useThemeChoice();
|
|
4538
|
+
const [open, setOpen] = useState17(false);
|
|
4539
|
+
const [sub, setSub] = useState17(false);
|
|
4540
|
+
const block = useRef22(null);
|
|
4541
|
+
const themeRow = useRef22(null);
|
|
4542
|
+
const list = useRef22(null);
|
|
4543
|
+
const flyout = useRef22(null);
|
|
4544
|
+
const refocus = useRef22(false);
|
|
4545
|
+
const close = () => {
|
|
4546
|
+
refocus.current = true;
|
|
4547
|
+
setSub(false);
|
|
4548
|
+
};
|
|
4549
|
+
useIsoLayoutEffect(() => {
|
|
4550
|
+
if (!sub || inPlace) return;
|
|
4551
|
+
const place = () => {
|
|
4552
|
+
const row = themeRow.current;
|
|
4553
|
+
const fly = flyout.current;
|
|
4554
|
+
const panel2 = row?.closest(".ui-dropdown__panel");
|
|
4555
|
+
if (!row || !fly || !panel2) return;
|
|
4556
|
+
const right = panel2.getBoundingClientRect().right;
|
|
4557
|
+
const style = getComputedStyle(fly);
|
|
4558
|
+
const pad2 = parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth);
|
|
4559
|
+
const top = Math.min(row.getBoundingClientRect().top - pad2, window.innerHeight - fly.offsetHeight - parseFloat(style.paddingTop));
|
|
4560
|
+
fly.style.left = `${right + parseFloat(style.paddingLeft)}px`;
|
|
4561
|
+
fly.style.top = `${Math.max(0, top)}px`;
|
|
4562
|
+
};
|
|
4563
|
+
const panel = themeRow.current?.closest(".ui-dropdown__panel");
|
|
4564
|
+
place();
|
|
4565
|
+
window.addEventListener("resize", place);
|
|
4566
|
+
panel?.addEventListener("transitionend", place);
|
|
4567
|
+
const landed = panel ? setTimeout(place, transitionMs3(panel)) : void 0;
|
|
4568
|
+
return () => {
|
|
4569
|
+
window.removeEventListener("resize", place);
|
|
4570
|
+
panel?.removeEventListener("transitionend", place);
|
|
4571
|
+
clearTimeout(landed);
|
|
4572
|
+
};
|
|
4573
|
+
}, [sub, inPlace]);
|
|
4574
|
+
useEffect17(() => {
|
|
4575
|
+
if (!open || !away) return;
|
|
4576
|
+
const gone = () => {
|
|
4577
|
+
if (block.current?.getClientRects().length) return;
|
|
4578
|
+
const el = document.activeElement;
|
|
4579
|
+
const held = !el || el === document.body || block.current?.contains(el) || flyout.current?.contains(el);
|
|
4580
|
+
setSub(false);
|
|
4581
|
+
setOpen(false);
|
|
4582
|
+
if (held) away.current?.focus();
|
|
4583
|
+
};
|
|
4584
|
+
window.addEventListener("resize", gone);
|
|
4585
|
+
return () => window.removeEventListener("resize", gone);
|
|
4586
|
+
}, [open, away]);
|
|
4587
|
+
useEffect17(() => {
|
|
4588
|
+
if (sub) list.current?.querySelector('[role="menuitemradio"]')?.focus();
|
|
4589
|
+
else if (refocus.current) {
|
|
4590
|
+
refocus.current = false;
|
|
4591
|
+
themeRow.current?.focus();
|
|
4592
|
+
}
|
|
4593
|
+
}, [sub]);
|
|
4594
|
+
const subKeys = (e) => {
|
|
4595
|
+
const rows = [...e.currentTarget.querySelectorAll(".ui-dropdown__item")];
|
|
4596
|
+
const i = rows.indexOf(document.activeElement);
|
|
4597
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") rows[(i + (e.key === "ArrowDown" ? 1 : rows.length - 1)) % rows.length]?.focus();
|
|
4598
|
+
else if (e.key === "Home" || e.key === "End") rows[e.key === "Home" ? 0 : rows.length - 1]?.focus();
|
|
4599
|
+
else if (e.key === "Enter" || e.key === " ") rows[i]?.click();
|
|
4600
|
+
else if (e.key === "ArrowLeft" || e.key === "Escape") close();
|
|
4601
|
+
else {
|
|
4602
|
+
if (e.key === "Tab" && !inPlace) themeRow.current?.focus();
|
|
4603
|
+
return;
|
|
4604
|
+
}
|
|
4605
|
+
e.preventDefault();
|
|
4606
|
+
e.stopPropagation();
|
|
4607
|
+
};
|
|
4608
|
+
const choices = /* @__PURE__ */ jsxs36(
|
|
4609
|
+
"div",
|
|
4610
|
+
{
|
|
4611
|
+
ref: list,
|
|
4612
|
+
role: "menu",
|
|
4613
|
+
"aria-label": "Theme",
|
|
4614
|
+
className: "ui-dropdown__sub",
|
|
4615
|
+
onKeyDown: subKeys,
|
|
4616
|
+
onClick: (e) => e.stopPropagation(),
|
|
4617
|
+
children: [
|
|
4618
|
+
inPlace && /* @__PURE__ */ jsxs36("div", { role: "menuitem", tabIndex: -1, className: "ui-dropdown__item", "aria-label": "Back from Theme", onClick: close, children: [
|
|
4619
|
+
glyph(icon7("chevronLeft"), "ui-dropdown__ic"),
|
|
4620
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx40("span", { className: "ui-dropdown__label", children: "Theme" }) })
|
|
4621
|
+
] }),
|
|
4622
|
+
THEMES.map(([value, label]) => /* @__PURE__ */ jsxs36(
|
|
4623
|
+
"div",
|
|
4624
|
+
{
|
|
4625
|
+
role: "menuitemradio",
|
|
4626
|
+
"aria-checked": theme.theme === value,
|
|
4627
|
+
tabIndex: -1,
|
|
4628
|
+
className: `ui-dropdown__item${theme.theme === value ? " is-selected" : ""}`,
|
|
4629
|
+
onClick: () => {
|
|
4630
|
+
theme.set(value);
|
|
4631
|
+
close();
|
|
4632
|
+
},
|
|
4633
|
+
children: [
|
|
4634
|
+
glyph(themeIcon2(value), "ui-dropdown__ic"),
|
|
4635
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx40("span", { className: "ui-dropdown__label", children: label }) }),
|
|
4636
|
+
glyph(icon7("check"), "ui-dropdown__tick")
|
|
4637
|
+
]
|
|
4638
|
+
},
|
|
4639
|
+
value
|
|
4640
|
+
))
|
|
4641
|
+
]
|
|
4642
|
+
}
|
|
4643
|
+
);
|
|
4644
|
+
return /* @__PURE__ */ jsx40("div", { ref: block, className: "ui-app__user", children: /* @__PURE__ */ jsx40(
|
|
4645
|
+
Dropdown,
|
|
4646
|
+
{
|
|
4647
|
+
variant: "menu",
|
|
4648
|
+
direction: "up",
|
|
4649
|
+
align: "start",
|
|
4650
|
+
chevron: true,
|
|
4651
|
+
open,
|
|
4652
|
+
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
4653
|
+
triggerClass: "ui-app__user-trigger",
|
|
4654
|
+
panelClass: `ui-app__user-panel${sub && inPlace ? " is-sub" : ""}`,
|
|
4655
|
+
onOpenChange: (next) => {
|
|
4656
|
+
setOpen(next);
|
|
4657
|
+
if (!next) setSub(false);
|
|
4658
|
+
},
|
|
4659
|
+
triggerContent: /* @__PURE__ */ jsxs36(Fragment17, { children: [
|
|
4660
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx40(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4661
|
+
/* @__PURE__ */ jsxs36("span", { className: "ui-app__who", children: [
|
|
4662
|
+
/* @__PURE__ */ jsx40("b", { children: account.name }),
|
|
4663
|
+
/* @__PURE__ */ jsx40("span", { children: account.email })
|
|
4664
|
+
] })
|
|
4665
|
+
] }),
|
|
4666
|
+
items: [...items, ...withTheme ? [{ label: "Theme", value: "theme" }, "---"] : [], { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4667
|
+
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs36(Fragment17, { children: [
|
|
4668
|
+
/* @__PURE__ */ jsxs36(
|
|
4669
|
+
"div",
|
|
4670
|
+
{
|
|
4671
|
+
...props,
|
|
4672
|
+
ref: themeRow,
|
|
4673
|
+
"aria-haspopup": "menu",
|
|
4674
|
+
"aria-expanded": sub,
|
|
4675
|
+
onClick: () => setSub((open2) => !open2),
|
|
4676
|
+
onKeyDown: (e) => {
|
|
4677
|
+
if (e.key === "ArrowRight") {
|
|
4678
|
+
e.preventDefault();
|
|
4679
|
+
e.stopPropagation();
|
|
4680
|
+
setSub(true);
|
|
4681
|
+
}
|
|
4682
|
+
},
|
|
4683
|
+
children: [
|
|
4684
|
+
glyph(themeIcon2(theme.theme), "ui-dropdown__ic"),
|
|
4685
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx40("span", { className: "ui-dropdown__label", children: "Theme" }) }),
|
|
4686
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__aside", children: theme.label }),
|
|
4687
|
+
glyph(icon7("chevronRight"), "ui-dropdown__more")
|
|
4688
|
+
]
|
|
4689
|
+
}
|
|
4690
|
+
),
|
|
4691
|
+
sub && (inPlace ? choices : createPortal7(/* @__PURE__ */ jsx40(
|
|
4692
|
+
"div",
|
|
4693
|
+
{
|
|
4694
|
+
ref: flyout,
|
|
4695
|
+
className: "ui-dropdown__panel ui-dropdown__panel--portal ui-dropdown__panel--sub is-open",
|
|
4696
|
+
children: choices
|
|
4697
|
+
}
|
|
4698
|
+
), document.body))
|
|
4699
|
+
] }) : props.href ? /* @__PURE__ */ jsx40("a", { ...props }) : /* @__PURE__ */ jsx40("div", { ...props }),
|
|
4700
|
+
onSelect
|
|
4701
|
+
}
|
|
4702
|
+
) });
|
|
4703
|
+
}
|
|
4704
|
+
|
|
4378
4705
|
// src/AppShell.tsx
|
|
4379
|
-
import { Fragment as
|
|
4706
|
+
import { Fragment as Fragment18, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4380
4707
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
4381
4708
|
function AppShell({
|
|
4382
4709
|
sections,
|
|
@@ -4389,38 +4716,38 @@ function AppShell({
|
|
|
4389
4716
|
brandHref = "/",
|
|
4390
4717
|
width = "centered",
|
|
4391
4718
|
back,
|
|
4392
|
-
crumbs,
|
|
4393
4719
|
lede,
|
|
4394
4720
|
actions,
|
|
4721
|
+
tools,
|
|
4395
4722
|
bandControl,
|
|
4396
4723
|
headControl,
|
|
4397
4724
|
account,
|
|
4725
|
+
accountItems = [],
|
|
4398
4726
|
onSignOut,
|
|
4399
4727
|
searchLabel = "Search or run a command\u2026",
|
|
4400
4728
|
defaultCollapsed = false,
|
|
4401
4729
|
palette,
|
|
4402
4730
|
renderLink
|
|
4403
4731
|
}) {
|
|
4404
|
-
const uid =
|
|
4405
|
-
const
|
|
4406
|
-
const [
|
|
4407
|
-
const [
|
|
4408
|
-
const
|
|
4409
|
-
const
|
|
4410
|
-
const menuBody = useRef20(null);
|
|
4732
|
+
const uid = useId13();
|
|
4733
|
+
const [collapsed, setCollapsed] = useState18(defaultCollapsed);
|
|
4734
|
+
const [search, setSearch] = useState18(false);
|
|
4735
|
+
const [menu, setMenu] = useState18(false);
|
|
4736
|
+
const menuButton = useRef23(null);
|
|
4737
|
+
const menuBody = useRef23(null);
|
|
4411
4738
|
const firstRow = useMemo4(() => ({ get current() {
|
|
4412
4739
|
return menuBody.current?.querySelector(".ui-nav__item") ?? null;
|
|
4413
4740
|
} }), []);
|
|
4414
4741
|
const current = path(pathname);
|
|
4415
4742
|
const active = sections.filter((section) => current === path(section.href) || path(section.href) !== "/" && current.startsWith(`${path(section.href)}/`)).sort((a, b) => path(b.href).length - path(a.href).length)[0];
|
|
4416
|
-
|
|
4743
|
+
useEffect18(() => {
|
|
4417
4744
|
setCollapsed(railCollapsed() ?? defaultCollapsed);
|
|
4418
4745
|
}, [defaultCollapsed]);
|
|
4419
|
-
|
|
4746
|
+
useEffect18(() => {
|
|
4420
4747
|
setMenu(false);
|
|
4421
4748
|
setSearch(false);
|
|
4422
4749
|
}, [pathname]);
|
|
4423
|
-
|
|
4750
|
+
useEffect18(() => {
|
|
4424
4751
|
if (!menu) return;
|
|
4425
4752
|
const grown = () => {
|
|
4426
4753
|
const button = menuButton.current;
|
|
@@ -4429,7 +4756,7 @@ function AppShell({
|
|
|
4429
4756
|
window.addEventListener("resize", grown);
|
|
4430
4757
|
return () => window.removeEventListener("resize", grown);
|
|
4431
4758
|
}, [menu]);
|
|
4432
|
-
|
|
4759
|
+
useEffect18(() => {
|
|
4433
4760
|
if (layout === "rail") return;
|
|
4434
4761
|
const hotkey = (event) => {
|
|
4435
4762
|
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey || event.key.toLowerCase() !== "k") return;
|
|
@@ -4446,7 +4773,7 @@ function AppShell({
|
|
|
4446
4773
|
setCollapsed(next);
|
|
4447
4774
|
storeRailCollapsed(next);
|
|
4448
4775
|
};
|
|
4449
|
-
const sidebar = (label) => /* @__PURE__ */
|
|
4776
|
+
const sidebar = (label) => /* @__PURE__ */ jsx41(
|
|
4450
4777
|
SidebarNav,
|
|
4451
4778
|
{
|
|
4452
4779
|
"aria-label": label,
|
|
@@ -4458,55 +4785,36 @@ function AppShell({
|
|
|
4458
4785
|
const linkProps = { ...props, onClick: (event) => {
|
|
4459
4786
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMenu(false);
|
|
4460
4787
|
} };
|
|
4461
|
-
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */
|
|
4788
|
+
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */ jsx41("a", { ...linkProps });
|
|
4462
4789
|
}
|
|
4463
4790
|
}
|
|
4464
4791
|
);
|
|
4465
4792
|
const foldLabel = collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
4466
4793
|
const navigable = sections.length > 1 || Boolean(back);
|
|
4467
|
-
const lockup = /* @__PURE__ */
|
|
4468
|
-
brand ?? /* @__PURE__ */
|
|
4469
|
-
/* @__PURE__ */
|
|
4794
|
+
const lockup = /* @__PURE__ */ jsxs37("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
4795
|
+
brand ?? /* @__PURE__ */ jsx41("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
4796
|
+
/* @__PURE__ */ jsx41("span", { children: word })
|
|
4470
4797
|
] });
|
|
4471
|
-
const
|
|
4472
|
-
|
|
4798
|
+
const ownItems = accountItems.map(({ label, icon: icon9, href }, i) => ({ label, icon: icon9, href, value: `item-${i}` }));
|
|
4799
|
+
const pick = (value) => {
|
|
4800
|
+
if (value === "sign-out") onSignOut();
|
|
4801
|
+
else accountItems[Number(String(value).slice(5))]?.onSelect?.();
|
|
4802
|
+
};
|
|
4803
|
+
const accountBlock = (withTheme = false, inPlace = false) => /* @__PURE__ */ jsx41(
|
|
4804
|
+
AccountMenu,
|
|
4473
4805
|
{
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
panelClass: "ui-app__user-panel",
|
|
4481
|
-
triggerContent: /* @__PURE__ */ jsxs35(Fragment16, { children: [
|
|
4482
|
-
/* @__PURE__ */ jsx39("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx39(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4483
|
-
/* @__PURE__ */ jsxs35("span", { className: "ui-app__who", children: [
|
|
4484
|
-
/* @__PURE__ */ jsx39("b", { children: account.name }),
|
|
4485
|
-
/* @__PURE__ */ jsx39("span", { children: account.email })
|
|
4486
|
-
] })
|
|
4487
|
-
] }),
|
|
4488
|
-
items: [...withTheme ? [{ label: `${theme.label} theme`, value: "theme" }] : [], { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4489
|
-
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs35(
|
|
4490
|
-
"div",
|
|
4491
|
-
{
|
|
4492
|
-
...props,
|
|
4493
|
-
"aria-label": `${item.label}. Switch to ${theme.next}.`,
|
|
4494
|
-
onClick: theme.toggle,
|
|
4495
|
-
children: [
|
|
4496
|
-
/* @__PURE__ */ jsx39("span", { className: "ui-dropdown__ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon2(theme.theme) } }),
|
|
4497
|
-
/* @__PURE__ */ jsx39("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx39("span", { className: "ui-dropdown__label", children: item.label }) })
|
|
4498
|
-
]
|
|
4499
|
-
}
|
|
4500
|
-
) : /* @__PURE__ */ jsx39("div", { ...props }),
|
|
4501
|
-
onSelect: (value) => {
|
|
4502
|
-
if (value === "sign-out") onSignOut();
|
|
4503
|
-
}
|
|
4806
|
+
account,
|
|
4807
|
+
items: ownItems,
|
|
4808
|
+
onSelect: pick,
|
|
4809
|
+
withTheme,
|
|
4810
|
+
inPlace,
|
|
4811
|
+
away: menuButton
|
|
4504
4812
|
}
|
|
4505
|
-
)
|
|
4506
|
-
const headSlot = layout === "topbar" && headControl && /* @__PURE__ */
|
|
4507
|
-
const foldControl = /* @__PURE__ */
|
|
4813
|
+
);
|
|
4814
|
+
const headSlot = layout === "topbar" && headControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__head-control", children: headControl });
|
|
4815
|
+
const foldControl = /* @__PURE__ */ jsxs37("div", { className: "ui-app__fold-row", children: [
|
|
4508
4816
|
headSlot,
|
|
4509
|
-
/* @__PURE__ */
|
|
4817
|
+
/* @__PURE__ */ jsxs37(
|
|
4510
4818
|
"button",
|
|
4511
4819
|
{
|
|
4512
4820
|
type: "button",
|
|
@@ -4515,34 +4823,37 @@ function AppShell({
|
|
|
4515
4823
|
"aria-label": foldLabel,
|
|
4516
4824
|
onClick: fold,
|
|
4517
4825
|
children: [
|
|
4518
|
-
/* @__PURE__ */
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
/* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4826
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsxs37("svg", { className: "ui-icon", viewBox: "0 0 24 24", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4827
|
+
/* @__PURE__ */ jsx41("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
4828
|
+
/* @__PURE__ */ jsx41("path", { className: "ui-app__fold-seam", d: "M9 3v18" }),
|
|
4829
|
+
/* @__PURE__ */ jsx41("path", { className: "ui-app__fold-arrow", d: "m16 15-3-3 3-3" })
|
|
4522
4830
|
] }) }),
|
|
4523
|
-
/* @__PURE__ */
|
|
4831
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-nav__label", children: foldLabel })
|
|
4524
4832
|
]
|
|
4525
4833
|
}
|
|
4526
4834
|
)
|
|
4527
4835
|
] });
|
|
4528
|
-
const page = /* @__PURE__ */
|
|
4529
|
-
back
|
|
4530
|
-
/* @__PURE__ */
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
/* @__PURE__ */
|
|
4836
|
+
const page = /* @__PURE__ */ jsxs37("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
4837
|
+
back && /* @__PURE__ */ jsx41(BackLink, { ...back }),
|
|
4838
|
+
tools ? /* @__PURE__ */ jsxs37("div", { className: "ui-app__title-row", children: [
|
|
4839
|
+
/* @__PURE__ */ jsx41("h1", { children: title }),
|
|
4840
|
+
/* @__PURE__ */ jsx41("div", { className: "ui-app__tools", children: tools })
|
|
4841
|
+
] }) : /* @__PURE__ */ jsx41("h1", { children: title }),
|
|
4842
|
+
lede && /* @__PURE__ */ jsx41("p", { className: "ui-app__sub", children: lede }),
|
|
4843
|
+
actions && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__actions", children: actions }),
|
|
4844
|
+
/* @__PURE__ */ jsx41("div", { className: "ui-app__body", children })
|
|
4534
4845
|
] });
|
|
4535
|
-
if (layout === "rail") return /* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4846
|
+
if (layout === "rail") return /* @__PURE__ */ jsxs37("div", { className: `ui-app ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
4847
|
+
/* @__PURE__ */ jsxs37("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
4848
|
+
/* @__PURE__ */ jsxs37("div", { className: "ui-app__head", children: [
|
|
4538
4849
|
lockup,
|
|
4539
4850
|
foldControl
|
|
4540
4851
|
] }),
|
|
4541
4852
|
sidebar("Sections"),
|
|
4542
4853
|
accountBlock()
|
|
4543
4854
|
] }),
|
|
4544
|
-
/* @__PURE__ */
|
|
4545
|
-
/* @__PURE__ */
|
|
4855
|
+
/* @__PURE__ */ jsxs37("header", { className: "ui-app__bar ui-app__bar--phone", children: [
|
|
4856
|
+
/* @__PURE__ */ jsx41(
|
|
4546
4857
|
Button,
|
|
4547
4858
|
{
|
|
4548
4859
|
ref: menuButton,
|
|
@@ -4556,10 +4867,10 @@ function AppShell({
|
|
|
4556
4867
|
onClick: () => setMenu(true)
|
|
4557
4868
|
}
|
|
4558
4869
|
),
|
|
4559
|
-
/* @__PURE__ */
|
|
4870
|
+
/* @__PURE__ */ jsx41("a", { className: "ui-app__brand ui-app__brand--band", href: brandHref, "aria-label": word, children: brand ?? /* @__PURE__ */ jsx41("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(`${uid}-band`, 24) } }) })
|
|
4560
4871
|
] }),
|
|
4561
4872
|
page,
|
|
4562
|
-
/* @__PURE__ */
|
|
4873
|
+
/* @__PURE__ */ jsx41(
|
|
4563
4874
|
Drawer,
|
|
4564
4875
|
{
|
|
4565
4876
|
open: menu,
|
|
@@ -4567,15 +4878,15 @@ function AppShell({
|
|
|
4567
4878
|
title: word,
|
|
4568
4879
|
side: "left",
|
|
4569
4880
|
size: "sm",
|
|
4570
|
-
footer: /* @__PURE__ */
|
|
4571
|
-
children: /* @__PURE__ */
|
|
4881
|
+
footer: /* @__PURE__ */ jsx41("div", { className: "ui-app__drawer", children: accountBlock() }),
|
|
4882
|
+
children: /* @__PURE__ */ jsx41("div", { className: "ui-app__drawer", children: sidebar("Menu sections") })
|
|
4572
4883
|
}
|
|
4573
4884
|
)
|
|
4574
4885
|
] });
|
|
4575
|
-
const control = bandControl && /* @__PURE__ */
|
|
4576
|
-
return /* @__PURE__ */
|
|
4577
|
-
navigable && /* @__PURE__ */
|
|
4578
|
-
/* @__PURE__ */
|
|
4886
|
+
const control = bandControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__control", inert: collapsed, children: bandControl });
|
|
4887
|
+
return /* @__PURE__ */ jsxs37("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
4888
|
+
navigable && /* @__PURE__ */ jsxs37("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
4889
|
+
/* @__PURE__ */ jsxs37("div", { className: "ui-app__head", children: [
|
|
4579
4890
|
lockup,
|
|
4580
4891
|
foldControl
|
|
4581
4892
|
] }),
|
|
@@ -4583,19 +4894,19 @@ function AppShell({
|
|
|
4583
4894
|
sidebar("Sections"),
|
|
4584
4895
|
accountBlock(true)
|
|
4585
4896
|
] }),
|
|
4586
|
-
/* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4588
|
-
navigable ? /* @__PURE__ */
|
|
4589
|
-
/* @__PURE__ */
|
|
4590
|
-
/* @__PURE__ */
|
|
4897
|
+
/* @__PURE__ */ jsxs37("div", { className: "ui-app__well", children: [
|
|
4898
|
+
/* @__PURE__ */ jsxs37("header", { className: "ui-app__bar", children: [
|
|
4899
|
+
navigable ? /* @__PURE__ */ jsxs37(Fragment18, { children: [
|
|
4900
|
+
/* @__PURE__ */ jsx41("a", { className: "ui-app__brand ui-app__brand--band", href: brandHref, "aria-label": word, children: brand ?? /* @__PURE__ */ jsx41("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(`${uid}-band`, 24) } }) }),
|
|
4901
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-react-app__title", "aria-hidden": "true", children: title })
|
|
4591
4902
|
] }) : lockup,
|
|
4592
|
-
/* @__PURE__ */
|
|
4593
|
-
/* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4595
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__PURE__ */ jsxs37("button", { type: "button", className: "ui-app__search", "aria-haspopup": "dialog", onClick: () => setSearch(true), children: [
|
|
4904
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-app__search-ic", children: /* @__PURE__ */ jsx41(Icon, { name: "search" }) }),
|
|
4905
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-app__search-txt", children: searchLabel }),
|
|
4906
|
+
/* @__PURE__ */ jsx41("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
|
|
4596
4907
|
] }),
|
|
4597
|
-
/* @__PURE__ */
|
|
4598
|
-
navigable ? /* @__PURE__ */
|
|
4908
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-app__bar-gap" }),
|
|
4909
|
+
navigable ? /* @__PURE__ */ jsx41(
|
|
4599
4910
|
Button,
|
|
4600
4911
|
{
|
|
4601
4912
|
ref: menuButton,
|
|
@@ -4608,11 +4919,11 @@ function AppShell({
|
|
|
4608
4919
|
"aria-expanded": menu,
|
|
4609
4920
|
onClick: () => setMenu(true)
|
|
4610
4921
|
}
|
|
4611
|
-
) : /* @__PURE__ */
|
|
4612
|
-
bandControl && /* @__PURE__ */
|
|
4613
|
-
headControl && /* @__PURE__ */
|
|
4614
|
-
/* @__PURE__ */
|
|
4615
|
-
/* @__PURE__ */
|
|
4922
|
+
) : /* @__PURE__ */ jsxs37(Fragment18, { children: [
|
|
4923
|
+
bandControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: bandControl }),
|
|
4924
|
+
headControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: headControl }),
|
|
4925
|
+
/* @__PURE__ */ jsx41(ThemeToggle, {}),
|
|
4926
|
+
/* @__PURE__ */ jsx41("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx41(
|
|
4616
4927
|
Dropdown,
|
|
4617
4928
|
{
|
|
4618
4929
|
variant: "menu",
|
|
@@ -4621,20 +4932,20 @@ function AppShell({
|
|
|
4621
4932
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
4622
4933
|
triggerClass: "ui-app__user-trigger",
|
|
4623
4934
|
panelClass: "ui-app__user-panel",
|
|
4624
|
-
triggerContent: /* @__PURE__ */
|
|
4625
|
-
header: /* @__PURE__ */
|
|
4626
|
-
/* @__PURE__ */
|
|
4627
|
-
/* @__PURE__ */
|
|
4935
|
+
triggerContent: /* @__PURE__ */ jsx41("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx41(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4936
|
+
header: /* @__PURE__ */ jsxs37("div", { className: "ui-dropdown__head", children: [
|
|
4937
|
+
/* @__PURE__ */ jsx41("b", { children: account.name }),
|
|
4938
|
+
/* @__PURE__ */ jsx41("span", { children: account.email })
|
|
4628
4939
|
] }),
|
|
4629
|
-
items: [{ label: "Sign out", icon: "logout", danger: true }],
|
|
4630
|
-
onSelect:
|
|
4940
|
+
items: [...ownItems, { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4941
|
+
onSelect: pick
|
|
4631
4942
|
}
|
|
4632
4943
|
) })
|
|
4633
4944
|
] })
|
|
4634
4945
|
] }),
|
|
4635
4946
|
page
|
|
4636
4947
|
] }),
|
|
4637
|
-
navigable && /* @__PURE__ */
|
|
4948
|
+
navigable && /* @__PURE__ */ jsx41(
|
|
4638
4949
|
Drawer,
|
|
4639
4950
|
{
|
|
4640
4951
|
open: menu,
|
|
@@ -4644,31 +4955,31 @@ function AppShell({
|
|
|
4644
4955
|
size: "sm",
|
|
4645
4956
|
initialFocusRef: firstRow,
|
|
4646
4957
|
headerActions: headSlot,
|
|
4647
|
-
footer: /* @__PURE__ */
|
|
4648
|
-
children: /* @__PURE__ */
|
|
4649
|
-
bandControl && /* @__PURE__ */
|
|
4958
|
+
footer: /* @__PURE__ */ jsx41("div", { className: "ui-app__drawer", children: accountBlock(true, true) }),
|
|
4959
|
+
children: /* @__PURE__ */ jsxs37("div", { className: "ui-react-app__menu", ref: menuBody, children: [
|
|
4960
|
+
bandControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__control", children: bandControl }),
|
|
4650
4961
|
sidebar("Menu sections")
|
|
4651
4962
|
] })
|
|
4652
4963
|
}
|
|
4653
4964
|
),
|
|
4654
|
-
/* @__PURE__ */
|
|
4965
|
+
/* @__PURE__ */ jsx41(CommandPalette, { ...palette ?? { groups: [{ items: sections.map((section) => ({ id: section.href, ...section })) }] }, open: search, onClose: () => setSearch(false) })
|
|
4655
4966
|
] });
|
|
4656
4967
|
}
|
|
4657
4968
|
|
|
4658
4969
|
// src/AuthShell.tsx
|
|
4659
4970
|
import { forwardRef as forwardRef10 } from "react";
|
|
4660
|
-
import { jsx as
|
|
4971
|
+
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4661
4972
|
var AuthShell = forwardRef10(function AuthShell2({ brand, children, className, ...rest }, ref) {
|
|
4662
|
-
return /* @__PURE__ */
|
|
4663
|
-
/* @__PURE__ */
|
|
4973
|
+
return /* @__PURE__ */ jsx42("div", { ...rest, ref, className: ["ui-auth", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs38("div", { className: "ui-auth__card", children: [
|
|
4974
|
+
/* @__PURE__ */ jsx42("div", { className: "ui-auth__brand", children: brand }),
|
|
4664
4975
|
children
|
|
4665
4976
|
] }) });
|
|
4666
4977
|
});
|
|
4667
4978
|
|
|
4668
4979
|
// src/Footer.tsx
|
|
4669
|
-
import { useId as
|
|
4980
|
+
import { useId as useId14 } from "react";
|
|
4670
4981
|
import { prism as prism2, safeUrl as safeUrl3 } from "@apliteni/apliteni-ui";
|
|
4671
|
-
import { jsx as
|
|
4982
|
+
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4672
4983
|
var SOCIAL_GLYPHS = {
|
|
4673
4984
|
github: '<path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.34 1.09 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.64 0 0 .84-.27 2.75 1.02a9.5 9.5 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.37.2 2.39.1 2.64.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2z"/>',
|
|
4674
4985
|
x: '<path d="M4 3h4.5l4 5.5L17.5 3H21l-6.5 8.5L21 21h-4.5l-4.3-5.9L7 21H3.5l6.8-8.9z"/>',
|
|
@@ -4677,10 +4988,10 @@ var SOCIAL_GLYPHS = {
|
|
|
4677
4988
|
};
|
|
4678
4989
|
var escapeText = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4679
4990
|
function Legal({ legal, legalLinks, switcher }) {
|
|
4680
|
-
return /* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
legalLinks && legalLinks.length > 0 && /* @__PURE__ */
|
|
4683
|
-
switcher ? /* @__PURE__ */
|
|
4991
|
+
return /* @__PURE__ */ jsxs39("div", { className: "ui-footer__bar", children: [
|
|
4992
|
+
/* @__PURE__ */ jsx43("span", { className: "ui-footer__legal", children: legal }),
|
|
4993
|
+
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx43("a", { href: safeUrl3(to ?? "#"), children: label }, label)) }),
|
|
4994
|
+
switcher ? /* @__PURE__ */ jsx43("div", { className: "ui-footer__switcher", children: switcher }) : null
|
|
4684
4995
|
] });
|
|
4685
4996
|
}
|
|
4686
4997
|
function Footer({
|
|
@@ -4698,14 +5009,14 @@ function Footer({
|
|
|
4698
5009
|
className,
|
|
4699
5010
|
...rest
|
|
4700
5011
|
}) {
|
|
4701
|
-
const uid =
|
|
5012
|
+
const uid = useId14();
|
|
4702
5013
|
const cls = ["ui-footer", `ui-footer--${variant}`, className].filter(Boolean).join(" ");
|
|
4703
|
-
const bar = /* @__PURE__ */
|
|
5014
|
+
const bar = /* @__PURE__ */ jsx43(Legal, { legal, legalLinks, switcher });
|
|
4704
5015
|
if (variant !== "full") {
|
|
4705
|
-
return /* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ jsx43("footer", { ...rest, className: cls, role: "contentinfo", children: /* @__PURE__ */ jsx43("div", { className: "ui-footer__in", children: bar }) });
|
|
4706
5017
|
}
|
|
4707
5018
|
const mark = prism2(uid.replace(/:/g, ""), 22);
|
|
4708
|
-
const lockup = brand ?? /* @__PURE__ */
|
|
5019
|
+
const lockup = brand ?? /* @__PURE__ */ jsx43(
|
|
4709
5020
|
"a",
|
|
4710
5021
|
{
|
|
4711
5022
|
className: "brand",
|
|
@@ -4714,21 +5025,21 @@ function Footer({
|
|
|
4714
5025
|
dangerouslySetInnerHTML: { __html: `${mark}<span>${escapeText(word)}</span>` }
|
|
4715
5026
|
}
|
|
4716
5027
|
);
|
|
4717
|
-
return /* @__PURE__ */
|
|
4718
|
-
/* @__PURE__ */
|
|
4719
|
-
brand !== false && /* @__PURE__ */
|
|
5028
|
+
return /* @__PURE__ */ jsx43("footer", { ...rest, className: cls, role: "contentinfo", children: /* @__PURE__ */ jsxs39("div", { className: "ui-footer__in", children: [
|
|
5029
|
+
/* @__PURE__ */ jsxs39("div", { className: "ui-footer__top", children: [
|
|
5030
|
+
brand !== false && /* @__PURE__ */ jsxs39("div", { className: "ui-footer__brand", children: [
|
|
4720
5031
|
lockup,
|
|
4721
|
-
tagline && /* @__PURE__ */
|
|
4722
|
-
social.length > 0 && /* @__PURE__ */
|
|
5032
|
+
tagline && /* @__PURE__ */ jsx43("p", { className: "ui-footer__tagline", children: tagline }),
|
|
5033
|
+
social.length > 0 && /* @__PURE__ */ jsx43("div", { className: "ui-footer__socials", children: social.map(({ label, href: to, icon: icon9 = "github" }) => {
|
|
4723
5034
|
const markup = SOCIAL_GLYPHS[icon9];
|
|
4724
5035
|
const fill = icon9 === "mail" ? "none" : "currentColor";
|
|
4725
5036
|
const viewBox = icon9 === "linkedin" ? "0 0 448 512" : "0 0 24 24";
|
|
4726
|
-
return /* @__PURE__ */
|
|
5037
|
+
return /* @__PURE__ */ jsx43("a", { className: "ui-footer__social", href: safeUrl3(to ?? "#"), "aria-label": label, children: /* @__PURE__ */ jsx43("svg", { viewBox, fill, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: markup } }) }, label);
|
|
4727
5038
|
}) })
|
|
4728
5039
|
] }),
|
|
4729
|
-
(links || columns.length > 0) && /* @__PURE__ */
|
|
4730
|
-
title && /* @__PURE__ */
|
|
4731
|
-
/* @__PURE__ */
|
|
5040
|
+
(links || columns.length > 0) && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__nav", "aria-label": "Footer", children: links ?? columns.map(({ title, links: columnLinks }, i) => /* @__PURE__ */ jsxs39("div", { className: "ui-footer__col", children: [
|
|
5041
|
+
title && /* @__PURE__ */ jsx43("h2", { className: "ui-footer__col-title", children: title }),
|
|
5042
|
+
/* @__PURE__ */ jsx43("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx43("li", { children: /* @__PURE__ */ jsx43("a", { href: safeUrl3(to ?? "#"), target, rel: target ? "noreferrer" : void 0, children: label }) }, label)) })
|
|
4732
5043
|
] }, title ?? i)) })
|
|
4733
5044
|
] }),
|
|
4734
5045
|
bar
|
|
@@ -4736,11 +5047,11 @@ function Footer({
|
|
|
4736
5047
|
}
|
|
4737
5048
|
|
|
4738
5049
|
// src/Success.tsx
|
|
4739
|
-
import { forwardRef as forwardRef11, useEffect as
|
|
4740
|
-
import { jsx as
|
|
5050
|
+
import { forwardRef as forwardRef11, useEffect as useEffect19, useRef as useRef24, useState as useState19 } from "react";
|
|
5051
|
+
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4741
5052
|
var SuccessCheck = forwardRef11(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
4742
5053
|
const circled = variant === "circled";
|
|
4743
|
-
return /* @__PURE__ */
|
|
5054
|
+
return /* @__PURE__ */ jsxs40(
|
|
4744
5055
|
"svg",
|
|
4745
5056
|
{
|
|
4746
5057
|
...rest,
|
|
@@ -4752,18 +5063,18 @@ var SuccessCheck = forwardRef11(function SuccessCheck2({ variant = "line", class
|
|
|
4752
5063
|
"aria-hidden": "true",
|
|
4753
5064
|
focusable: "false",
|
|
4754
5065
|
children: [
|
|
4755
|
-
circled && /* @__PURE__ */
|
|
4756
|
-
/* @__PURE__ */
|
|
5066
|
+
circled && /* @__PURE__ */ jsx44("path", { className: "ui-sx__circle", d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
5067
|
+
/* @__PURE__ */ jsx44("path", { className: "ui-sx__tick", d: circled ? "M22 4L12 14.01l-3-3" : "M20 6L9 17l-5-5" })
|
|
4757
5068
|
]
|
|
4758
5069
|
}
|
|
4759
5070
|
);
|
|
4760
5071
|
});
|
|
4761
5072
|
var SuccessPanel = forwardRef11(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
4762
5073
|
const circled = check === "circled";
|
|
4763
|
-
return /* @__PURE__ */
|
|
4764
|
-
/* @__PURE__ */
|
|
4765
|
-
/* @__PURE__ */
|
|
4766
|
-
sub && /* @__PURE__ */
|
|
5074
|
+
return /* @__PURE__ */ jsxs40("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
5075
|
+
/* @__PURE__ */ jsx44("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx44(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
5076
|
+
/* @__PURE__ */ jsx44("div", { className: "ui-success__title", children: title }),
|
|
5077
|
+
sub && /* @__PURE__ */ jsx44("div", { className: "ui-success__sub", children: sub })
|
|
4767
5078
|
] });
|
|
4768
5079
|
});
|
|
4769
5080
|
var pieces = [
|
|
@@ -4783,12 +5094,12 @@ var pieces = [
|
|
|
4783
5094
|
[80, 0.36, -20, "c", 1.05]
|
|
4784
5095
|
];
|
|
4785
5096
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
4786
|
-
const [remaining, setRemaining] =
|
|
4787
|
-
const callback =
|
|
4788
|
-
|
|
5097
|
+
const [remaining, setRemaining] = useState19(seconds);
|
|
5098
|
+
const callback = useRef24(onDone);
|
|
5099
|
+
useEffect19(() => {
|
|
4789
5100
|
callback.current = onDone;
|
|
4790
5101
|
}, [onDone]);
|
|
4791
|
-
|
|
5102
|
+
useEffect19(() => {
|
|
4792
5103
|
let count = seconds;
|
|
4793
5104
|
const timer = setInterval(() => {
|
|
4794
5105
|
count -= 1;
|
|
@@ -4800,12 +5111,12 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
4800
5111
|
}, 1e3);
|
|
4801
5112
|
return () => clearInterval(timer);
|
|
4802
5113
|
}, [seconds]);
|
|
4803
|
-
return /* @__PURE__ */
|
|
4804
|
-
/* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
5114
|
+
return /* @__PURE__ */ jsxs40("div", { className: "ui-sx__count", "data-sx-count": "", style: { "--sx-secs": `${seconds}s` }, children: [
|
|
5115
|
+
/* @__PURE__ */ jsx44("span", { className: "ui-sx__count-ring", "aria-hidden": "true" }),
|
|
5116
|
+
/* @__PURE__ */ jsxs40("span", { className: "ui-sx__count-text", children: [
|
|
4806
5117
|
label,
|
|
4807
5118
|
" in ",
|
|
4808
|
-
/* @__PURE__ */
|
|
5119
|
+
/* @__PURE__ */ jsx44("b", { "data-sx-num": "", children: remaining }),
|
|
4809
5120
|
"s"
|
|
4810
5121
|
] })
|
|
4811
5122
|
] });
|
|
@@ -4832,7 +5143,7 @@ var Success = forwardRef11(function Success2({
|
|
|
4832
5143
|
const seconds = countdown?.seconds;
|
|
4833
5144
|
const duration = seconds != null && Number.isFinite(seconds) && seconds >= 1 ? Math.floor(seconds) : 5;
|
|
4834
5145
|
const mark = check === "circled" ? "circled" : "line";
|
|
4835
|
-
return /* @__PURE__ */
|
|
5146
|
+
return /* @__PURE__ */ jsxs40(
|
|
4836
5147
|
"div",
|
|
4837
5148
|
{
|
|
4838
5149
|
role: "status",
|
|
@@ -4841,16 +5152,16 @@ var Success = forwardRef11(function Success2({
|
|
|
4841
5152
|
ref,
|
|
4842
5153
|
className: ["ui-sx", `ui-sx--${layout}`, `ui-sx--check-${mark}`, confetti && "ui-sx--confetti", className].filter(Boolean).join(" "),
|
|
4843
5154
|
children: [
|
|
4844
|
-
confetti && /* @__PURE__ */
|
|
4845
|
-
([x, d, r, t, s], index) => /* @__PURE__ */
|
|
5155
|
+
confetti && /* @__PURE__ */ jsx44("div", { className: "ui-sx__confetti", "aria-hidden": "true", children: pieces.map(
|
|
5156
|
+
([x, d, r, t, s], index) => /* @__PURE__ */ jsx44("i", { className: `ui-sx__piece ui-sx__piece--${t}`, style: { left: `${x}%`, "--sx-d": `${d}s`, "--sx-r": `${r}deg`, "--sx-s": s } }, index)
|
|
4846
5157
|
) }),
|
|
4847
|
-
/* @__PURE__ */
|
|
4848
|
-
/* @__PURE__ */
|
|
4849
|
-
/* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
4851
|
-
body && /* @__PURE__ */
|
|
4852
|
-
hasActions && /* @__PURE__ */
|
|
4853
|
-
countdown && /* @__PURE__ */
|
|
5158
|
+
/* @__PURE__ */ jsxs40("div", { className: "ui-sx__inner", children: [
|
|
5159
|
+
/* @__PURE__ */ jsx44("div", { className: "ui-sx__visual", children: /* @__PURE__ */ jsx44(SuccessCheck, { variant: mark }) }),
|
|
5160
|
+
/* @__PURE__ */ jsxs40("div", { className: "ui-sx__content", children: [
|
|
5161
|
+
/* @__PURE__ */ jsx44(Heading, { className: "ui-sx__title", children: title }),
|
|
5162
|
+
body && /* @__PURE__ */ jsx44("p", { className: "ui-sx__body", children: body }),
|
|
5163
|
+
hasActions && /* @__PURE__ */ jsx44("div", { className: "ui-sx__actions", children: actions }),
|
|
5164
|
+
countdown && /* @__PURE__ */ jsx44(Countdown, { seconds: duration, label: countdown.label, onDone: onCountdownEnd }, duration)
|
|
4854
5165
|
] })
|
|
4855
5166
|
] })
|
|
4856
5167
|
]
|
|
@@ -4861,17 +5172,17 @@ var Success = forwardRef11(function Success2({
|
|
|
4861
5172
|
// src/Chart.tsx
|
|
4862
5173
|
import {
|
|
4863
5174
|
useCallback as useCallback7,
|
|
4864
|
-
useEffect as
|
|
4865
|
-
useId as
|
|
5175
|
+
useEffect as useEffect20,
|
|
5176
|
+
useId as useId15,
|
|
4866
5177
|
useLayoutEffect as useLayoutEffect5,
|
|
4867
5178
|
useMemo as useMemo5,
|
|
4868
|
-
useRef as
|
|
4869
|
-
useState as
|
|
5179
|
+
useRef as useRef25,
|
|
5180
|
+
useState as useState20
|
|
4870
5181
|
} from "react";
|
|
4871
5182
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
4872
5183
|
|
|
4873
5184
|
// src/chart-looks.tsx
|
|
4874
|
-
import { Fragment as
|
|
5185
|
+
import { Fragment as Fragment19, jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4875
5186
|
var LOOK_DEFAULT = {
|
|
4876
5187
|
line: "thin",
|
|
4877
5188
|
area: "stacked",
|
|
@@ -5052,7 +5363,7 @@ function linesDrawing(g, open) {
|
|
|
5052
5363
|
const up = layer.to.map((v, i) => `${i ? "L" : "M"}${px(centre(i))} ${px(y(Number.isFinite(v) ? v : layer.from[i]))}`);
|
|
5053
5364
|
const down = layer.from.map((v, i) => `L${px(centre(i))} ${px(y(v))}`).reverse();
|
|
5054
5365
|
const ramp = ramps[k];
|
|
5055
|
-
return /* @__PURE__ */
|
|
5366
|
+
return /* @__PURE__ */ jsx45(
|
|
5056
5367
|
"path",
|
|
5057
5368
|
{
|
|
5058
5369
|
className: cx8(look.share ? "ui-chart__segment" : "ui-chart__area", tone(layer.tone)),
|
|
@@ -5062,7 +5373,7 @@ function linesDrawing(g, open) {
|
|
|
5062
5373
|
`fill-${layer.id}`
|
|
5063
5374
|
);
|
|
5064
5375
|
});
|
|
5065
|
-
const edges = !look.share && look.layers.flatMap((layer) => layer.to.slice(1).map((_, k) => finite(layer, k) && finite(layer, k + 1) ? /* @__PURE__ */
|
|
5376
|
+
const edges = !look.share && look.layers.flatMap((layer) => layer.to.slice(1).map((_, k) => finite(layer, k) && finite(layer, k + 1) ? /* @__PURE__ */ jsx45(
|
|
5066
5377
|
"line",
|
|
5067
5378
|
{
|
|
5068
5379
|
className: cx8(
|
|
@@ -5084,7 +5395,7 @@ function linesDrawing(g, open) {
|
|
|
5084
5395
|
const shown = i === open || points || lonely && !look.share;
|
|
5085
5396
|
if (!shown || look.share && i !== open) return null;
|
|
5086
5397
|
if (look.share && layer !== look.layers[look.layers.length - 1]) return null;
|
|
5087
|
-
return /* @__PURE__ */
|
|
5398
|
+
return /* @__PURE__ */ jsx45(
|
|
5088
5399
|
"circle",
|
|
5089
5400
|
{
|
|
5090
5401
|
className: cx8("ui-chart__dot", tone(layer.tone)),
|
|
@@ -5112,8 +5423,8 @@ function linesDrawing(g, open) {
|
|
|
5112
5423
|
base = at2 + Math.max(drop, fall + gap + ascent);
|
|
5113
5424
|
}
|
|
5114
5425
|
}
|
|
5115
|
-
return /* @__PURE__ */
|
|
5116
|
-
/* @__PURE__ */
|
|
5426
|
+
return /* @__PURE__ */ jsxs41("g", { children: [
|
|
5427
|
+
/* @__PURE__ */ jsx45(
|
|
5117
5428
|
"circle",
|
|
5118
5429
|
{
|
|
5119
5430
|
className: cx8("ui-chart__dot", tone(layer.tone)),
|
|
@@ -5122,7 +5433,7 @@ function linesDrawing(g, open) {
|
|
|
5122
5433
|
r: "4"
|
|
5123
5434
|
}
|
|
5124
5435
|
),
|
|
5125
|
-
/* @__PURE__ */
|
|
5436
|
+
/* @__PURE__ */ jsx45(
|
|
5126
5437
|
"text",
|
|
5127
5438
|
{
|
|
5128
5439
|
className: "ui-chart__text ui-chart__text--strong",
|
|
@@ -5134,8 +5445,8 @@ function linesDrawing(g, open) {
|
|
|
5134
5445
|
)
|
|
5135
5446
|
] }, `end-${layer.id}`);
|
|
5136
5447
|
});
|
|
5137
|
-
return /* @__PURE__ */
|
|
5138
|
-
ramps.some(Boolean) && /* @__PURE__ */
|
|
5448
|
+
return /* @__PURE__ */ jsxs41(Fragment19, { children: [
|
|
5449
|
+
ramps.some(Boolean) && /* @__PURE__ */ jsx45("defs", { children: ramps.map((ramp) => ramp && /* @__PURE__ */ jsxs41(
|
|
5139
5450
|
"linearGradient",
|
|
5140
5451
|
{
|
|
5141
5452
|
id: ramp.id,
|
|
@@ -5146,14 +5457,14 @@ function linesDrawing(g, open) {
|
|
|
5146
5457
|
y1: px(y(ramp.lo)),
|
|
5147
5458
|
y2: px(y(ramp.hi)),
|
|
5148
5459
|
children: [
|
|
5149
|
-
/* @__PURE__ */
|
|
5150
|
-
/* @__PURE__ */
|
|
5460
|
+
/* @__PURE__ */ jsx45("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
5461
|
+
/* @__PURE__ */ jsx45("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
5151
5462
|
]
|
|
5152
5463
|
},
|
|
5153
5464
|
ramp.id
|
|
5154
5465
|
)) }),
|
|
5155
5466
|
fills,
|
|
5156
|
-
open !== null && /* @__PURE__ */
|
|
5467
|
+
open !== null && /* @__PURE__ */ jsx45(
|
|
5157
5468
|
"line",
|
|
5158
5469
|
{
|
|
5159
5470
|
className: "ui-chart__cross",
|
|
@@ -5178,7 +5489,7 @@ function columnsDrawing(g) {
|
|
|
5178
5489
|
const y1 = y(layer.to[i]);
|
|
5179
5490
|
const x = centre(i) - w / 2;
|
|
5180
5491
|
const d = layer === filled[filled.length - 1] ? topRounded(x, y1, w, y0 - y1, 4) : square(x, y1, w, y0 - y1);
|
|
5181
|
-
return /* @__PURE__ */
|
|
5492
|
+
return /* @__PURE__ */ jsx45(
|
|
5182
5493
|
"path",
|
|
5183
5494
|
{
|
|
5184
5495
|
className: cx8("ui-chart__segment", tone(layer.tone), label.estimated && "is-estimated"),
|
|
@@ -5193,10 +5504,10 @@ function rowsDrawing(g, pick) {
|
|
|
5193
5504
|
const { look, labels, format, formatAxis, scale } = g;
|
|
5194
5505
|
const rows = rowsOf(g);
|
|
5195
5506
|
const bottom = rows.row * labels.length;
|
|
5196
|
-
return /* @__PURE__ */
|
|
5197
|
-
pick !== null && pick >= 0 && pick < labels.length && /* @__PURE__ */
|
|
5198
|
-
scale.ticks.map((tick) => /* @__PURE__ */
|
|
5199
|
-
/* @__PURE__ */
|
|
5507
|
+
return /* @__PURE__ */ jsxs41(Fragment19, { children: [
|
|
5508
|
+
pick !== null && pick >= 0 && pick < labels.length && /* @__PURE__ */ jsx45("rect", { className: "ui-chart__band", x: "0", width: px(rows.w), y: px(pick * rows.row), height: px(rows.row) }),
|
|
5509
|
+
scale.ticks.map((tick) => /* @__PURE__ */ jsxs41("g", { children: [
|
|
5510
|
+
/* @__PURE__ */ jsx45(
|
|
5200
5511
|
"line",
|
|
5201
5512
|
{
|
|
5202
5513
|
className: tick === 0 ? "ui-chart__zero" : "ui-chart__grid",
|
|
@@ -5206,7 +5517,7 @@ function rowsDrawing(g, pick) {
|
|
|
5206
5517
|
y2: px(bottom)
|
|
5207
5518
|
}
|
|
5208
5519
|
),
|
|
5209
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx45(
|
|
5210
5521
|
"text",
|
|
5211
5522
|
{
|
|
5212
5523
|
className: "ui-chart__caption",
|
|
@@ -5221,8 +5532,8 @@ function rowsDrawing(g, pick) {
|
|
|
5221
5532
|
labels.map((label, i) => {
|
|
5222
5533
|
const top = rows.top(i);
|
|
5223
5534
|
const filled = look.layers.filter((l) => l.to[i] > l.from[i]);
|
|
5224
|
-
return /* @__PURE__ */
|
|
5225
|
-
/* @__PURE__ */
|
|
5535
|
+
return /* @__PURE__ */ jsxs41("g", { children: [
|
|
5536
|
+
/* @__PURE__ */ jsx45(
|
|
5226
5537
|
"text",
|
|
5227
5538
|
{
|
|
5228
5539
|
className: "ui-chart__caption",
|
|
@@ -5237,7 +5548,7 @@ function rowsDrawing(g, pick) {
|
|
|
5237
5548
|
const x0 = rows.x(layer.from[i]);
|
|
5238
5549
|
const x1 = rows.x(layer.to[i]);
|
|
5239
5550
|
const d = layer === filled[filled.length - 1] ? rightRounded(x0, top, x1 - x0, ROW_BAR, 4) : square(x0, top, x1 - x0, ROW_BAR);
|
|
5240
|
-
return /* @__PURE__ */
|
|
5551
|
+
return /* @__PURE__ */ jsx45(
|
|
5241
5552
|
"path",
|
|
5242
5553
|
{
|
|
5243
5554
|
d,
|
|
@@ -5246,7 +5557,7 @@ function rowsDrawing(g, pick) {
|
|
|
5246
5557
|
`seg-${layer.id}`
|
|
5247
5558
|
);
|
|
5248
5559
|
}),
|
|
5249
|
-
/* @__PURE__ */
|
|
5560
|
+
/* @__PURE__ */ jsx45(
|
|
5250
5561
|
"text",
|
|
5251
5562
|
{
|
|
5252
5563
|
className: "ui-chart__text",
|
|
@@ -5264,8 +5575,8 @@ function ringDrawing(g) {
|
|
|
5264
5575
|
const { look, format } = g;
|
|
5265
5576
|
const ring = ringOf(g);
|
|
5266
5577
|
const total = look.totals[0];
|
|
5267
|
-
return /* @__PURE__ */
|
|
5268
|
-
look.layers.filter((s) => s.to[0] > s.from[0]).map((slice) => /* @__PURE__ */
|
|
5578
|
+
return /* @__PURE__ */ jsxs41(Fragment19, { children: [
|
|
5579
|
+
look.layers.filter((s) => s.to[0] > s.from[0]).map((slice) => /* @__PURE__ */ jsx45(
|
|
5269
5580
|
"path",
|
|
5270
5581
|
{
|
|
5271
5582
|
className: cx8("ui-chart__segment", tone(slice.tone)),
|
|
@@ -5273,42 +5584,42 @@ function ringDrawing(g) {
|
|
|
5273
5584
|
},
|
|
5274
5585
|
`slice-${slice.id}`
|
|
5275
5586
|
)),
|
|
5276
|
-
look.look === "thin" && /* @__PURE__ */
|
|
5277
|
-
/* @__PURE__ */
|
|
5278
|
-
/* @__PURE__ */
|
|
5587
|
+
look.look === "thin" && /* @__PURE__ */ jsxs41("g", { "aria-hidden": "true", children: [
|
|
5588
|
+
/* @__PURE__ */ jsx45("text", { className: "ui-chart__total", textAnchor: "middle", x: px(ring.x), y: px(ring.y + 2), children: format(total) }),
|
|
5589
|
+
/* @__PURE__ */ jsx45("text", { className: "ui-chart__caption", textAnchor: "middle", x: px(ring.x), y: px(ring.y + 22), children: look.totalLabel })
|
|
5279
5590
|
] }),
|
|
5280
5591
|
look.look === "labels" && look.layers.filter((s) => s.to[0] > s.from[0]).map((slice) => {
|
|
5281
5592
|
const mid = angle((slice.from[0] + slice.to[0]) / 2);
|
|
5282
5593
|
const x = ring.x + (ring.r + 14) * Math.cos(mid);
|
|
5283
5594
|
const y = ring.y + (ring.r + 14) * Math.sin(mid);
|
|
5284
5595
|
const anchor = Math.cos(mid) >= 0 ? "start" : "end";
|
|
5285
|
-
return /* @__PURE__ */
|
|
5286
|
-
/* @__PURE__ */
|
|
5287
|
-
/* @__PURE__ */
|
|
5596
|
+
return /* @__PURE__ */ jsxs41("g", { "aria-hidden": "true", children: [
|
|
5597
|
+
/* @__PURE__ */ jsx45("text", { className: "ui-chart__text ui-chart__text--strong", textAnchor: anchor, x: px(x), y: px(y - 2), children: slice.name }),
|
|
5598
|
+
/* @__PURE__ */ jsx45("text", { className: "ui-chart__text", textAnchor: anchor, x: px(x), y: px(y + 13), children: `${format(slice.values[0])} ${pct(slice.to[0] - slice.from[0])}` })
|
|
5288
5599
|
] }, `label-${slice.id}`);
|
|
5289
5600
|
})
|
|
5290
5601
|
] });
|
|
5291
5602
|
}
|
|
5292
5603
|
function Shares({ look, format, swatch }) {
|
|
5293
5604
|
const total = look.totals[0];
|
|
5294
|
-
return /* @__PURE__ */
|
|
5295
|
-
look.layers.map((slice) => /* @__PURE__ */
|
|
5605
|
+
return /* @__PURE__ */ jsxs41("ul", { className: "ui-chart__shares", "aria-hidden": "true", children: [
|
|
5606
|
+
look.layers.map((slice) => /* @__PURE__ */ jsxs41("li", { className: tone(slice.tone), children: [
|
|
5296
5607
|
swatch,
|
|
5297
|
-
/* @__PURE__ */
|
|
5298
|
-
/* @__PURE__ */
|
|
5299
|
-
/* @__PURE__ */
|
|
5608
|
+
/* @__PURE__ */ jsx45("span", { children: slice.name }),
|
|
5609
|
+
/* @__PURE__ */ jsx45("span", { className: "ui-chart__shares-value", children: format(slice.values[0]) }),
|
|
5610
|
+
/* @__PURE__ */ jsx45("span", { className: "ui-chart__shares-pct", children: total > 0 ? pct(slice.to[0] - slice.from[0]) : MISSING })
|
|
5300
5611
|
] }, slice.id)),
|
|
5301
|
-
/* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
5303
|
-
/* @__PURE__ */
|
|
5304
|
-
/* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5612
|
+
/* @__PURE__ */ jsxs41("li", { className: "ui-chart__shares-total", children: [
|
|
5613
|
+
/* @__PURE__ */ jsx45("span", {}),
|
|
5614
|
+
/* @__PURE__ */ jsx45("span", { children: look.totalLabel }),
|
|
5615
|
+
/* @__PURE__ */ jsx45("span", { className: "ui-chart__shares-value", children: format(total) }),
|
|
5616
|
+
/* @__PURE__ */ jsx45("span", { className: "ui-chart__shares-pct", children: "100%" })
|
|
5306
5617
|
] })
|
|
5307
5618
|
] });
|
|
5308
5619
|
}
|
|
5309
5620
|
|
|
5310
5621
|
// src/Chart.tsx
|
|
5311
|
-
import { Fragment as
|
|
5622
|
+
import { Fragment as Fragment20, jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5312
5623
|
var HEIGHT = { months: 216, bridge: 216, spark: 32, line: 216, area: 216, stacked: 216, donut: 216 };
|
|
5313
5624
|
var PAD = 2;
|
|
5314
5625
|
var ZERO_INSET = 1.5;
|
|
@@ -5350,8 +5661,8 @@ function barPath(m) {
|
|
|
5350
5661
|
return `M${px2(x)} ${px2(roundBottom ? bottom - r : bottom)}V${px2(roundTop ? top + r : top)}` + (roundTop ? `${arc2(r, -r, 1)}h${px2(w - r * 2)}${arc2(r, r, 1)}` : `h${px2(w)}`) + `V${px2(roundBottom ? bottom - r : bottom)}` + (roundBottom ? `${arc2(-r, r, 1)}h${px2(-(w - r * 2))}${arc2(-r, -r, 1)}` : `h${px2(-w)}`) + "z";
|
|
5351
5662
|
}
|
|
5352
5663
|
function useTapFloor() {
|
|
5353
|
-
const [floor, setFloor] =
|
|
5354
|
-
|
|
5664
|
+
const [floor, setFloor] = useState20(TARGET);
|
|
5665
|
+
useEffect20(() => {
|
|
5355
5666
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX2}px) and (pointer: coarse)`);
|
|
5356
5667
|
if (!query) return;
|
|
5357
5668
|
const read = () => setFloor(query.matches ? TAP_FLOOR : TARGET);
|
|
@@ -5559,9 +5870,9 @@ function donutFrame(look, slices, totalLabel, format) {
|
|
|
5559
5870
|
}
|
|
5560
5871
|
function KeyMark({ shape }) {
|
|
5561
5872
|
if (shape === "line") {
|
|
5562
|
-
return /* @__PURE__ */
|
|
5873
|
+
return /* @__PURE__ */ jsx46("svg", { className: "ui-chart__key-mark", width: "18", height: "12", viewBox: "0 0 18 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx46("path", { className: "ui-chart__key-line", d: "M1 9 L6 5 L12 7 L17 3" }) });
|
|
5563
5874
|
}
|
|
5564
|
-
return /* @__PURE__ */
|
|
5875
|
+
return /* @__PURE__ */ jsx46("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: shape === "fill" ? /* @__PURE__ */ jsx46("rect", { className: "ui-chart__key-swatch", x: "1", y: "1", width: "10", height: "10", rx: "2.5" }) : /* @__PURE__ */ jsx46(
|
|
5565
5876
|
"path",
|
|
5566
5877
|
{
|
|
5567
5878
|
className: "ui-chart__key-swatch",
|
|
@@ -5586,25 +5897,25 @@ function Chart(props) {
|
|
|
5586
5897
|
const spark = variant === "spark";
|
|
5587
5898
|
const plotHeight = height ?? HEIGHT[variant];
|
|
5588
5899
|
const showTable = table ?? !spark;
|
|
5589
|
-
const [view, setView] =
|
|
5900
|
+
const [view, setView] = useState20("chart");
|
|
5590
5901
|
const asTable = showTable && view === "table";
|
|
5591
|
-
const uid =
|
|
5592
|
-
const frameEl =
|
|
5593
|
-
const scroller =
|
|
5594
|
-
const plot =
|
|
5595
|
-
const tipEl =
|
|
5596
|
-
const svgEl =
|
|
5597
|
-
const ignoreMouseUntil =
|
|
5598
|
-
const touchMoved =
|
|
5599
|
-
const dismissed =
|
|
5600
|
-
const opening =
|
|
5601
|
-
const pointerFocus =
|
|
5902
|
+
const uid = useId15().replace(/[^\w-]/g, "");
|
|
5903
|
+
const frameEl = useRef25(null);
|
|
5904
|
+
const scroller = useRef25(null);
|
|
5905
|
+
const plot = useRef25(null);
|
|
5906
|
+
const tipEl = useRef25(null);
|
|
5907
|
+
const svgEl = useRef25(null);
|
|
5908
|
+
const ignoreMouseUntil = useRef25(0);
|
|
5909
|
+
const touchMoved = useRef25(false);
|
|
5910
|
+
const dismissed = useRef25(null);
|
|
5911
|
+
const opening = useRef25(false);
|
|
5912
|
+
const pointerFocus = useRef25(false);
|
|
5602
5913
|
const floor = useTapFloor();
|
|
5603
|
-
const [width, setWidth] =
|
|
5604
|
-
const [openId, setOpenId] =
|
|
5605
|
-
const [rawCursor, setCursor] =
|
|
5606
|
-
const [said, setSaid] =
|
|
5607
|
-
const [ownPick, setOwnPick] =
|
|
5914
|
+
const [width, setWidth] = useState20(0);
|
|
5915
|
+
const [openId, setOpenId] = useState20(null);
|
|
5916
|
+
const [rawCursor, setCursor] = useState20(0);
|
|
5917
|
+
const [said, setSaid] = useState20("");
|
|
5918
|
+
const [ownPick, setOwnPick] = useState20(null);
|
|
5608
5919
|
const pick = selected === void 0 ? ownPick : selected;
|
|
5609
5920
|
const steps = props.variant === "bridge" ? props.steps : void 0;
|
|
5610
5921
|
const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
|
|
@@ -5737,7 +6048,7 @@ function Chart(props) {
|
|
|
5737
6048
|
const fades = useMemo5(() => new Map(marks.filter((m) => m.kind === "bar").map((m) => fadeOf(uid, m, variant === "bridge")).filter((f) => f !== null).map((f) => [f.id, f])), [marks, uid, variant]);
|
|
5738
6049
|
const lead = useCallback7((column) => marks.find((m) => m.column === column), [marks]);
|
|
5739
6050
|
const open = openId ? byId.get(openId) : void 0;
|
|
5740
|
-
|
|
6051
|
+
useEffect20(() => {
|
|
5741
6052
|
const el = plot.current;
|
|
5742
6053
|
if (!el) return;
|
|
5743
6054
|
const read = () => setWidth(el.clientWidth);
|
|
@@ -5757,7 +6068,7 @@ function Chart(props) {
|
|
|
5757
6068
|
const anchor = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
|
|
5758
6069
|
if (anchor) placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
5759
6070
|
}, [openId, plotWidth, plotHeight]);
|
|
5760
|
-
|
|
6071
|
+
useEffect20(() => {
|
|
5761
6072
|
if (!openId) return;
|
|
5762
6073
|
const doc = frameEl.current?.ownerDocument;
|
|
5763
6074
|
const view2 = doc?.defaultView;
|
|
@@ -5833,18 +6144,18 @@ function Chart(props) {
|
|
|
5833
6144
|
const estimatedTone = marks.find((m) => m.estimated && m.kind === "bar")?.tone ?? keys[0]?.tone ?? "neutral";
|
|
5834
6145
|
const hitBand = (band) => band === "up" ? { y: PAD, h: Math.max(zero - PAD, TARGET) } : band === "down" ? { y: zero, h: Math.max(plotHeight - PAD - zero, TARGET) } : { y: PAD, h: Math.max(plotHeight - PAD * 2, TARGET) };
|
|
5835
6146
|
const legendFirst = !(look?.variant === "donut" && look.look !== "labels");
|
|
5836
|
-
const legend = keyed && !asTable && keys.length > 0 && !(look?.variant === "donut" && look.look === "table") && /* @__PURE__ */
|
|
5837
|
-
keys.map((key) => /* @__PURE__ */
|
|
5838
|
-
/* @__PURE__ */
|
|
6147
|
+
const legend = keyed && !asTable && keys.length > 0 && !(look?.variant === "donut" && look.look === "table") && /* @__PURE__ */ jsxs42("ul", { className: "ui-chart__legend", children: [
|
|
6148
|
+
keys.map((key) => /* @__PURE__ */ jsxs42("li", { className: cx9("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
|
|
6149
|
+
/* @__PURE__ */ jsx46(KeyMark, { shape: key.shape }),
|
|
5839
6150
|
key.name
|
|
5840
6151
|
] }, key.id)),
|
|
5841
|
-
estimated.length > 0 && /* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
6152
|
+
estimated.length > 0 && /* @__PURE__ */ jsxs42("li", { className: cx9("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
6153
|
+
/* @__PURE__ */ jsx46("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx46("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "2.5" }) }),
|
|
5843
6154
|
"Estimated"
|
|
5844
6155
|
] })
|
|
5845
6156
|
] });
|
|
5846
6157
|
const noun = look?.layout === "ring" ? "slices" : look?.layout === "rows" ? "rows" : "columns";
|
|
5847
|
-
return /* @__PURE__ */
|
|
6158
|
+
return /* @__PURE__ */ jsxs42(
|
|
5848
6159
|
"div",
|
|
5849
6160
|
{
|
|
5850
6161
|
className: cx9(
|
|
@@ -5861,9 +6172,9 @@ function Chart(props) {
|
|
|
5861
6172
|
"--ui-chart-pad": `${PAD}px`
|
|
5862
6173
|
},
|
|
5863
6174
|
children: [
|
|
5864
|
-
(showTable || legendFirst && legend) && /* @__PURE__ */
|
|
6175
|
+
(showTable || legendFirst && legend) && /* @__PURE__ */ jsxs42("div", { className: "ui-chart__head", children: [
|
|
5865
6176
|
legendFirst && legend,
|
|
5866
|
-
showTable && /* @__PURE__ */
|
|
6177
|
+
showTable && /* @__PURE__ */ jsx46(
|
|
5867
6178
|
Segmented,
|
|
5868
6179
|
{
|
|
5869
6180
|
size: "sm",
|
|
@@ -5877,7 +6188,7 @@ function Chart(props) {
|
|
|
5877
6188
|
}
|
|
5878
6189
|
)
|
|
5879
6190
|
] }),
|
|
5880
|
-
/* @__PURE__ */
|
|
6191
|
+
/* @__PURE__ */ jsxs42(
|
|
5881
6192
|
"div",
|
|
5882
6193
|
{
|
|
5883
6194
|
ref: frameEl,
|
|
@@ -5902,16 +6213,16 @@ function Chart(props) {
|
|
|
5902
6213
|
setSaid("");
|
|
5903
6214
|
},
|
|
5904
6215
|
children: [
|
|
5905
|
-
!spark && columnsLayout && scale.ticks.length > 0 && /* @__PURE__ */
|
|
5906
|
-
/* @__PURE__ */
|
|
6216
|
+
!spark && columnsLayout && scale.ticks.length > 0 && /* @__PURE__ */ jsx46("div", { className: "ui-chart__axis", "aria-hidden": "true", children: [...scale.ticks].reverse().map((tick) => /* @__PURE__ */ jsx46("span", { className: "ui-chart__tick", children: axisFormat(tick) }, tick)) }),
|
|
6217
|
+
/* @__PURE__ */ jsx46("div", { ref: scroller, className: "ui-chart__scroll", tabIndex: -1, onScroll: () => {
|
|
5907
6218
|
const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
|
|
5908
6219
|
if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
|
|
5909
6220
|
const mark = anchor.getBoundingClientRect();
|
|
5910
6221
|
const view2 = scroller.current.getBoundingClientRect();
|
|
5911
6222
|
if (mark.right <= view2.left || mark.left >= view2.right) setOpenId(null);
|
|
5912
6223
|
else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
5913
|
-
}, children: /* @__PURE__ */
|
|
5914
|
-
/* @__PURE__ */
|
|
6224
|
+
}, children: /* @__PURE__ */ jsxs42("div", { ref: plot, className: "ui-chart__plot", children: [
|
|
6225
|
+
/* @__PURE__ */ jsxs42(
|
|
5915
6226
|
"svg",
|
|
5916
6227
|
{
|
|
5917
6228
|
ref: svgEl,
|
|
@@ -5972,7 +6283,7 @@ function Chart(props) {
|
|
|
5972
6283
|
announce(mark.column, selectable ? mark.column : pick);
|
|
5973
6284
|
},
|
|
5974
6285
|
children: [
|
|
5975
|
-
!spark && columnsLayout && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */
|
|
6286
|
+
!spark && columnsLayout && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx46(
|
|
5976
6287
|
"rect",
|
|
5977
6288
|
{
|
|
5978
6289
|
className: "ui-chart__band",
|
|
@@ -5985,7 +6296,7 @@ function Chart(props) {
|
|
|
5985
6296
|
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
5986
6297
|
const from = byId.get(bar.id);
|
|
5987
6298
|
const to = byId.get(frame.bars[i + 1].id);
|
|
5988
|
-
return from && to ? /* @__PURE__ */
|
|
6299
|
+
return from && to ? /* @__PURE__ */ jsx46(
|
|
5989
6300
|
"line",
|
|
5990
6301
|
{
|
|
5991
6302
|
className: "ui-chart__carry",
|
|
@@ -5997,7 +6308,7 @@ function Chart(props) {
|
|
|
5997
6308
|
`carry-${bar.id}`
|
|
5998
6309
|
) : null;
|
|
5999
6310
|
}),
|
|
6000
|
-
!spark && columnsLayout && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */
|
|
6311
|
+
!spark && columnsLayout && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx46(
|
|
6001
6312
|
"line",
|
|
6002
6313
|
{
|
|
6003
6314
|
className: "ui-chart__grid",
|
|
@@ -6008,7 +6319,7 @@ function Chart(props) {
|
|
|
6008
6319
|
},
|
|
6009
6320
|
`grid-${tick}`
|
|
6010
6321
|
)),
|
|
6011
|
-
!spark && columnsLayout && scale.ticks.includes(0) && /* @__PURE__ */
|
|
6322
|
+
!spark && columnsLayout && scale.ticks.includes(0) && /* @__PURE__ */ jsx46(
|
|
6012
6323
|
"line",
|
|
6013
6324
|
{
|
|
6014
6325
|
className: "ui-chart__zero",
|
|
@@ -6018,7 +6329,7 @@ function Chart(props) {
|
|
|
6018
6329
|
y2: px2(y(0))
|
|
6019
6330
|
}
|
|
6020
6331
|
),
|
|
6021
|
-
fades.size > 0 && /* @__PURE__ */
|
|
6332
|
+
fades.size > 0 && /* @__PURE__ */ jsx46("defs", { children: [...fades.values()].map((fade) => /* @__PURE__ */ jsxs42(
|
|
6022
6333
|
"linearGradient",
|
|
6023
6334
|
{
|
|
6024
6335
|
id: fade.id,
|
|
@@ -6028,15 +6339,15 @@ function Chart(props) {
|
|
|
6028
6339
|
y1: fade.up ? "1" : "0",
|
|
6029
6340
|
y2: fade.up ? "0" : "1",
|
|
6030
6341
|
children: [
|
|
6031
|
-
/* @__PURE__ */
|
|
6032
|
-
/* @__PURE__ */
|
|
6342
|
+
/* @__PURE__ */ jsx46("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
6343
|
+
/* @__PURE__ */ jsx46("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
6033
6344
|
]
|
|
6034
6345
|
},
|
|
6035
6346
|
fade.id
|
|
6036
6347
|
)) }),
|
|
6037
6348
|
marks.filter((m) => m.kind === "bar").map((mark) => {
|
|
6038
6349
|
const fade = fadeOf(uid, mark, variant === "bridge");
|
|
6039
|
-
return /* @__PURE__ */
|
|
6350
|
+
return /* @__PURE__ */ jsx46(
|
|
6040
6351
|
"path",
|
|
6041
6352
|
{
|
|
6042
6353
|
className: cx9(
|
|
@@ -6051,7 +6362,7 @@ function Chart(props) {
|
|
|
6051
6362
|
);
|
|
6052
6363
|
}),
|
|
6053
6364
|
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
6054
|
-
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */
|
|
6365
|
+
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx46(
|
|
6055
6366
|
"line",
|
|
6056
6367
|
{
|
|
6057
6368
|
className: layer === "casing" ? "ui-chart__line-casing" : cx9(
|
|
@@ -6067,7 +6378,7 @@ function Chart(props) {
|
|
|
6067
6378
|
`${line.id}-${layer}-${i}`
|
|
6068
6379
|
) : null)
|
|
6069
6380
|
)),
|
|
6070
|
-
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */
|
|
6381
|
+
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */ jsx46(
|
|
6071
6382
|
"circle",
|
|
6072
6383
|
{
|
|
6073
6384
|
className: cx9("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
@@ -6078,8 +6389,8 @@ function Chart(props) {
|
|
|
6078
6389
|
`isolated-${line.id}-${i}`
|
|
6079
6390
|
) : null)),
|
|
6080
6391
|
geometry && lookDrawing(geometry, open?.column ?? null, pick),
|
|
6081
|
-
marks.map((mark) => /* @__PURE__ */
|
|
6082
|
-
mark.hitPath ? /* @__PURE__ */
|
|
6392
|
+
marks.map((mark) => /* @__PURE__ */ jsxs42("g", { "data-mark": mark.id, children: [
|
|
6393
|
+
mark.hitPath ? /* @__PURE__ */ jsx46("path", { className: "ui-chart__hit", d: mark.hitPath }) : mark.kind === "bar" ? /* @__PURE__ */ jsx46(
|
|
6083
6394
|
"rect",
|
|
6084
6395
|
{
|
|
6085
6396
|
className: "ui-chart__hit",
|
|
@@ -6088,7 +6399,7 @@ function Chart(props) {
|
|
|
6088
6399
|
y: px2(hitBand(mark.band).y),
|
|
6089
6400
|
height: px2(hitBand(mark.band).h)
|
|
6090
6401
|
}
|
|
6091
|
-
) : /* @__PURE__ */
|
|
6402
|
+
) : /* @__PURE__ */ jsx46(
|
|
6092
6403
|
"rect",
|
|
6093
6404
|
{
|
|
6094
6405
|
className: "ui-chart__hit",
|
|
@@ -6098,7 +6409,7 @@ function Chart(props) {
|
|
|
6098
6409
|
height: px2(mark.hit?.h ?? TARGET)
|
|
6099
6410
|
}
|
|
6100
6411
|
),
|
|
6101
|
-
/* @__PURE__ */
|
|
6412
|
+
/* @__PURE__ */ jsx46(
|
|
6102
6413
|
"rect",
|
|
6103
6414
|
{
|
|
6104
6415
|
"data-anchor": mark.id,
|
|
@@ -6113,8 +6424,8 @@ function Chart(props) {
|
|
|
6113
6424
|
]
|
|
6114
6425
|
}
|
|
6115
6426
|
),
|
|
6116
|
-
look?.variant === "donut" && look.look === "table" && /* @__PURE__ */
|
|
6117
|
-
!spark && columnsLayout && /* @__PURE__ */
|
|
6427
|
+
look?.variant === "donut" && look.look === "table" && /* @__PURE__ */ jsx46(Shares, { look, format, swatch: /* @__PURE__ */ jsx46(KeyMark, { shape: "fill" }) }),
|
|
6428
|
+
!spark && columnsLayout && /* @__PURE__ */ jsx46("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx46(
|
|
6118
6429
|
"span",
|
|
6119
6430
|
{
|
|
6120
6431
|
className: cx9("ui-chart__period", pick === i && "is-selected"),
|
|
@@ -6123,46 +6434,46 @@ function Chart(props) {
|
|
|
6123
6434
|
`${column.label}-${i}`
|
|
6124
6435
|
)) })
|
|
6125
6436
|
] }) }),
|
|
6126
|
-
/* @__PURE__ */
|
|
6127
|
-
/* @__PURE__ */
|
|
6128
|
-
open.rows ? /* @__PURE__ */
|
|
6129
|
-
open.rows.map((row) => /* @__PURE__ */
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
/* @__PURE__ */
|
|
6437
|
+
/* @__PURE__ */ jsx46("span", { ref: tipEl, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
6438
|
+
/* @__PURE__ */ jsx46("span", { className: "ui-tip__label", children: spark || look ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
6439
|
+
open.rows ? /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
6440
|
+
open.rows.map((row) => /* @__PURE__ */ jsxs42("span", { className: "ui-tip__value ui-chart__row", children: [
|
|
6441
|
+
/* @__PURE__ */ jsxs42("span", { className: cx9("ui-chart__key", `ui-chart__tone--${row.tone}`), children: [
|
|
6442
|
+
/* @__PURE__ */ jsx46(KeyMark, { shape: row.shape }),
|
|
6132
6443
|
row.name
|
|
6133
6444
|
] }),
|
|
6134
|
-
/* @__PURE__ */
|
|
6445
|
+
/* @__PURE__ */ jsx46("span", { children: row.text })
|
|
6135
6446
|
] }, row.name)),
|
|
6136
|
-
open.total && /* @__PURE__ */
|
|
6137
|
-
/* @__PURE__ */
|
|
6138
|
-
/* @__PURE__ */
|
|
6447
|
+
open.total && /* @__PURE__ */ jsxs42("span", { className: "ui-tip__value ui-chart__row", children: [
|
|
6448
|
+
/* @__PURE__ */ jsx46("span", { children: totalLabel }),
|
|
6449
|
+
/* @__PURE__ */ jsx46("span", { children: open.total })
|
|
6139
6450
|
] })
|
|
6140
|
-
] }) : /* @__PURE__ */
|
|
6141
|
-
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */
|
|
6451
|
+
] }) : /* @__PURE__ */ jsx46("span", { className: "ui-tip__value", children: format(open.value) }),
|
|
6452
|
+
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */ jsx46("span", { className: "ui-tip__detail", children: stateOf(columns[open.column]) || open.detail })
|
|
6142
6453
|
] }) })
|
|
6143
6454
|
]
|
|
6144
6455
|
}
|
|
6145
6456
|
),
|
|
6146
6457
|
!legendFirst && legend,
|
|
6147
|
-
/* @__PURE__ */
|
|
6148
|
-
asTable && /* @__PURE__ */
|
|
6458
|
+
/* @__PURE__ */ jsx46("div", { className: "ui-sr", role: "status", children: said }),
|
|
6459
|
+
asTable && /* @__PURE__ */ jsx46("div", { className: "ui-chart__data", children: /* @__PURE__ */ jsx46(
|
|
6149
6460
|
"div",
|
|
6150
6461
|
{
|
|
6151
6462
|
className: "ui-table-scroll",
|
|
6152
6463
|
role: "region",
|
|
6153
6464
|
tabIndex: 0,
|
|
6154
6465
|
"aria-label": `${title}, as a table. Scroll for more columns.`,
|
|
6155
|
-
children: /* @__PURE__ */
|
|
6156
|
-
/* @__PURE__ */
|
|
6157
|
-
/* @__PURE__ */
|
|
6158
|
-
/* @__PURE__ */
|
|
6466
|
+
children: /* @__PURE__ */ jsxs42("table", { className: "ui-table", "aria-label": title, children: [
|
|
6467
|
+
/* @__PURE__ */ jsx46("thead", { children: /* @__PURE__ */ jsx46("tr", { children: tableHead.map((head, i) => /* @__PURE__ */ jsx46("th", { scope: "col", className: cx9(i > 0 && "ui-table__num"), children: head }, head)) }) }),
|
|
6468
|
+
/* @__PURE__ */ jsx46("tbody", { children: tableRows.map((row, i) => /* @__PURE__ */ jsxs42("tr", { "aria-current": pick === i ? true : void 0, children: [
|
|
6469
|
+
/* @__PURE__ */ jsxs42("th", { scope: "row", children: [
|
|
6159
6470
|
row.column.label,
|
|
6160
|
-
row.column.estimated && /* @__PURE__ */
|
|
6471
|
+
row.column.estimated && /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
6161
6472
|
" ",
|
|
6162
|
-
/* @__PURE__ */
|
|
6473
|
+
/* @__PURE__ */ jsx46("span", { className: "ui-chart__state", children: stateOf(row.column) })
|
|
6163
6474
|
] })
|
|
6164
6475
|
] }),
|
|
6165
|
-
row.cells.map((cell, j) => /* @__PURE__ */
|
|
6476
|
+
row.cells.map((cell, j) => /* @__PURE__ */ jsx46("td", { className: "ui-table__num", children: cell }, tableHead[j + 1]))
|
|
6166
6477
|
] }, `${row.column.label}-${i}`)) })
|
|
6167
6478
|
] })
|
|
6168
6479
|
}
|
|
@@ -6175,7 +6486,7 @@ function Chart(props) {
|
|
|
6175
6486
|
// src/AccentPicker.tsx
|
|
6176
6487
|
import { forwardRef as forwardRef12 } from "react";
|
|
6177
6488
|
import { ACCENTS, accentSwatchStyle } from "@apliteni/apliteni-ui";
|
|
6178
|
-
import { jsx as
|
|
6489
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
6179
6490
|
var AccentPicker = forwardRef12(function AccentPicker2({
|
|
6180
6491
|
value,
|
|
6181
6492
|
onChange,
|
|
@@ -6184,7 +6495,7 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
6184
6495
|
"aria-label": label = "Accent",
|
|
6185
6496
|
...rest
|
|
6186
6497
|
}, ref) {
|
|
6187
|
-
return /* @__PURE__ */
|
|
6498
|
+
return /* @__PURE__ */ jsx47(
|
|
6188
6499
|
"div",
|
|
6189
6500
|
{
|
|
6190
6501
|
...rest,
|
|
@@ -6195,7 +6506,7 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
6195
6506
|
"aria-label": label,
|
|
6196
6507
|
children: options.map((accent) => {
|
|
6197
6508
|
const title = accent.charAt(0).toUpperCase() + accent.slice(1);
|
|
6198
|
-
return /* @__PURE__ */
|
|
6509
|
+
return /* @__PURE__ */ jsx47(
|
|
6199
6510
|
"button",
|
|
6200
6511
|
{
|
|
6201
6512
|
type: "button",
|
|
@@ -6214,9 +6525,9 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
6214
6525
|
});
|
|
6215
6526
|
|
|
6216
6527
|
// src/TopBar.tsx
|
|
6217
|
-
import { Fragment as
|
|
6528
|
+
import { Fragment as Fragment21 } from "react";
|
|
6218
6529
|
import { prism as prism3, safeUrl as safeUrl4, icon as icon8, ACCOUNT_NAV } from "@apliteni/apliteni-ui";
|
|
6219
|
-
import { Fragment as
|
|
6530
|
+
import { Fragment as Fragment22, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6220
6531
|
function TopBar({
|
|
6221
6532
|
brand,
|
|
6222
6533
|
word = "Strategy",
|
|
@@ -6228,20 +6539,20 @@ function TopBar({
|
|
|
6228
6539
|
className,
|
|
6229
6540
|
...rest
|
|
6230
6541
|
}) {
|
|
6231
|
-
return /* @__PURE__ */
|
|
6232
|
-
brand ?? /* @__PURE__ */
|
|
6233
|
-
/* @__PURE__ */
|
|
6234
|
-
/* @__PURE__ */
|
|
6542
|
+
return /* @__PURE__ */ jsx48("header", { ...rest, className: ["topbar", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs43("div", { className: "topbar__in", children: [
|
|
6543
|
+
brand ?? /* @__PURE__ */ jsxs43("a", { className: "brand", href: safeUrl4(brandHref), "aria-label": `Apliteni ${word}`, children: [
|
|
6544
|
+
/* @__PURE__ */ jsx48("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: prism3("tb-mark", 22) } }),
|
|
6545
|
+
/* @__PURE__ */ jsx48("span", { children: word })
|
|
6235
6546
|
] }),
|
|
6236
6547
|
view,
|
|
6237
|
-
/* @__PURE__ */
|
|
6548
|
+
/* @__PURE__ */ jsx48("span", { className: "spacer" }),
|
|
6238
6549
|
version,
|
|
6239
6550
|
theme,
|
|
6240
6551
|
account
|
|
6241
6552
|
] }) });
|
|
6242
6553
|
}
|
|
6243
6554
|
function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
6244
|
-
return /* @__PURE__ */
|
|
6555
|
+
return /* @__PURE__ */ jsx48("div", { className: "dtsw on", role: "group", "aria-label": label, children: items.map((item) => {
|
|
6245
6556
|
const current = item.id === active;
|
|
6246
6557
|
const linkProps = {
|
|
6247
6558
|
className: current ? "cur" : void 0,
|
|
@@ -6250,13 +6561,13 @@ function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
|
6250
6561
|
"aria-current": current ? "page" : void 0,
|
|
6251
6562
|
children: item.label
|
|
6252
6563
|
};
|
|
6253
|
-
return /* @__PURE__ */
|
|
6564
|
+
return /* @__PURE__ */ jsx48(Fragment21, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx48("a", { ...linkProps }) }, item.id);
|
|
6254
6565
|
}) });
|
|
6255
6566
|
}
|
|
6256
6567
|
var BADGE = { live: "Live", archive: "Archive" };
|
|
6257
6568
|
function VersionSwitcher({ versions, value, onChange, label = "Version", defaultOpen }) {
|
|
6258
6569
|
const current = versions.find((v) => v.value === value);
|
|
6259
|
-
return /* @__PURE__ */
|
|
6570
|
+
return /* @__PURE__ */ jsx48("div", { className: "vsw", children: /* @__PURE__ */ jsx48(
|
|
6260
6571
|
Dropdown,
|
|
6261
6572
|
{
|
|
6262
6573
|
variant: "select",
|
|
@@ -6267,9 +6578,9 @@ function VersionSwitcher({ versions, value, onChange, label = "Version", default
|
|
|
6267
6578
|
chevron: false,
|
|
6268
6579
|
defaultOpen,
|
|
6269
6580
|
ariaLabel: `${label} \u2014 ${current?.label ?? ""}`,
|
|
6270
|
-
triggerContent: /* @__PURE__ */
|
|
6271
|
-
/* @__PURE__ */
|
|
6272
|
-
/* @__PURE__ */
|
|
6581
|
+
triggerContent: /* @__PURE__ */ jsxs43(Fragment22, { children: [
|
|
6582
|
+
/* @__PURE__ */ jsx48("span", { className: "cur", children: current?.label }),
|
|
6583
|
+
/* @__PURE__ */ jsx48("span", { className: "car", "aria-hidden": "true" })
|
|
6273
6584
|
] }),
|
|
6274
6585
|
items: versions.map((v) => ({
|
|
6275
6586
|
label: v.label,
|
|
@@ -6277,10 +6588,10 @@ function VersionSwitcher({ versions, value, onChange, label = "Version", default
|
|
|
6277
6588
|
badge: BADGE[v.badge ?? "archive"],
|
|
6278
6589
|
selected: v.value === value
|
|
6279
6590
|
})),
|
|
6280
|
-
row: (item, props) => /* @__PURE__ */
|
|
6281
|
-
/* @__PURE__ */
|
|
6282
|
-
/* @__PURE__ */
|
|
6283
|
-
/* @__PURE__ */
|
|
6591
|
+
row: (item, props) => /* @__PURE__ */ jsxs43("div", { ...props, className: `${props.className} vopt`, children: [
|
|
6592
|
+
/* @__PURE__ */ jsx48("span", { className: "vname", children: item.label }),
|
|
6593
|
+
/* @__PURE__ */ jsx48("span", { className: `vbadge ${item.badge === "Live" ? "live" : "arch"}`, children: String(item.badge) }),
|
|
6594
|
+
/* @__PURE__ */ jsx48("span", { className: "vtick", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon8("check") } })
|
|
6284
6595
|
] }),
|
|
6285
6596
|
onSelect: (picked) => {
|
|
6286
6597
|
if (picked != null) onChange?.(String(picked));
|
|
@@ -6298,7 +6609,7 @@ var ACCOUNT_ITEMS = ACCOUNT_NAV.map((item) => ({
|
|
|
6298
6609
|
value: item.id,
|
|
6299
6610
|
href: `#${item.id}`
|
|
6300
6611
|
}));
|
|
6301
|
-
function
|
|
6612
|
+
function AccountMenu2({
|
|
6302
6613
|
name,
|
|
6303
6614
|
email,
|
|
6304
6615
|
items = ACCOUNT_ITEMS,
|
|
@@ -6309,7 +6620,7 @@ function AccountMenu({
|
|
|
6309
6620
|
defaultOpen
|
|
6310
6621
|
}) {
|
|
6311
6622
|
const mark = initialsOf(name, email);
|
|
6312
|
-
return /* @__PURE__ */
|
|
6623
|
+
return /* @__PURE__ */ jsx48("div", { className: "acct on", children: /* @__PURE__ */ jsx48(
|
|
6313
6624
|
Dropdown,
|
|
6314
6625
|
{
|
|
6315
6626
|
variant: "menu",
|
|
@@ -6320,22 +6631,22 @@ function AccountMenu({
|
|
|
6320
6631
|
defaultOpen,
|
|
6321
6632
|
ariaLabel: "Account",
|
|
6322
6633
|
triggerContent: mark,
|
|
6323
|
-
header: /* @__PURE__ */
|
|
6324
|
-
/* @__PURE__ */
|
|
6325
|
-
/* @__PURE__ */
|
|
6326
|
-
/* @__PURE__ */
|
|
6327
|
-
/* @__PURE__ */
|
|
6634
|
+
header: /* @__PURE__ */ jsxs43("div", { className: "ahead", children: [
|
|
6635
|
+
/* @__PURE__ */ jsx48("span", { className: "avatar", children: mark }),
|
|
6636
|
+
/* @__PURE__ */ jsxs43("span", { className: "aw", children: [
|
|
6637
|
+
/* @__PURE__ */ jsx48("span", { className: "anm", children: name }),
|
|
6638
|
+
/* @__PURE__ */ jsx48("span", { className: "aem", title: email, children: email })
|
|
6328
6639
|
] })
|
|
6329
6640
|
] }),
|
|
6330
6641
|
items: [...items, "---", { label: "Sign out", icon: "logout", value: "sign-out", href: signOutHref }],
|
|
6331
|
-
row: (item, props) => /* @__PURE__ */
|
|
6642
|
+
row: (item, props) => /* @__PURE__ */ jsxs43(
|
|
6332
6643
|
"a",
|
|
6333
6644
|
{
|
|
6334
6645
|
...props,
|
|
6335
6646
|
href: item.disabled ? void 0 : item.href ? safeUrl4(item.href) : item.value === "sign-out" && onSignOut ? void 0 : safeUrl4(item.value === "sign-out" ? "#logout" : `#${item.value}`),
|
|
6336
6647
|
className: [props.className.replace(/\bui-dropdown__item\b/, "").trim(), !item.disabled && item.value === current && "cur", item.value === "sign-out" && "aout"].filter(Boolean).join(" "),
|
|
6337
6648
|
children: [
|
|
6338
|
-
item.icon && /* @__PURE__ */
|
|
6649
|
+
item.icon && /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon8(item.icon) } }),
|
|
6339
6650
|
item.label
|
|
6340
6651
|
]
|
|
6341
6652
|
}
|
|
@@ -6348,71 +6659,18 @@ function AccountMenu({
|
|
|
6348
6659
|
) });
|
|
6349
6660
|
}
|
|
6350
6661
|
|
|
6351
|
-
// src/NavTabs.tsx
|
|
6352
|
-
import { Fragment as Fragment21, forwardRef as forwardRef13, useEffect as useEffect18, useRef as useRef23, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
6353
|
-
import { safeUrl as safeUrl5, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
6354
|
-
import { Fragment as Fragment22, jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
6355
|
-
var NavTabs = forwardRef13(function NavTabs2({
|
|
6356
|
-
items,
|
|
6357
|
-
active,
|
|
6358
|
-
variant = "underline",
|
|
6359
|
-
renderLink,
|
|
6360
|
-
className,
|
|
6361
|
-
onFocus,
|
|
6362
|
-
"aria-label": ariaLabel = "Tabs",
|
|
6363
|
-
...rest
|
|
6364
|
-
}, ref) {
|
|
6365
|
-
const navRef = useRef23(null);
|
|
6366
|
-
useImperativeHandle2(ref, () => navRef.current, []);
|
|
6367
|
-
const signature = items.map((item) => item.id).join("\0");
|
|
6368
|
-
useEffect18(() => observeNavFit(navRef.current), []);
|
|
6369
|
-
useEffect18(() => {
|
|
6370
|
-
if (navRef.current) revealCurrentNav(navRef.current);
|
|
6371
|
-
}, [active, signature]);
|
|
6372
|
-
return /* @__PURE__ */ jsx47(
|
|
6373
|
-
"nav",
|
|
6374
|
-
{
|
|
6375
|
-
...rest,
|
|
6376
|
-
ref: navRef,
|
|
6377
|
-
className: ["ui-nav", "ui-nav--tabs", `is-${variant}`, className].filter(Boolean).join(" "),
|
|
6378
|
-
"aria-label": ariaLabel,
|
|
6379
|
-
onFocus: (event) => {
|
|
6380
|
-
if (navRef.current) revealFocusedNav(navRef.current, event.target);
|
|
6381
|
-
onFocus?.(event);
|
|
6382
|
-
},
|
|
6383
|
-
children: items.map((item) => {
|
|
6384
|
-
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
6385
|
-
const inner = /* @__PURE__ */ jsxs42(Fragment22, { children: [
|
|
6386
|
-
/* @__PURE__ */ jsx47("span", { className: "ui-nav__tab-label", children: item.label }),
|
|
6387
|
-
badge.text != null && badge.text !== "" && /* @__PURE__ */ jsx47("span", { className: `ui-nav__badge is-${badge.tone || "neutral"}`, children: badge.text })
|
|
6388
|
-
] });
|
|
6389
|
-
if (item.disabled) return /* @__PURE__ */ jsx47("span", { className: "ui-nav__tab is-disabled", "aria-disabled": "true", children: inner }, item.id);
|
|
6390
|
-
const current = item.id === active;
|
|
6391
|
-
const linkProps = {
|
|
6392
|
-
className: ["ui-nav__tab", current && "is-active"].filter(Boolean).join(" "),
|
|
6393
|
-
href: safeUrl5(item.href || `#${item.id}`),
|
|
6394
|
-
target: item.target,
|
|
6395
|
-
"aria-current": current ? "page" : void 0,
|
|
6396
|
-
children: inner
|
|
6397
|
-
};
|
|
6398
|
-
return /* @__PURE__ */ jsx47(Fragment21, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx47("a", { ...linkProps }) }, item.id);
|
|
6399
|
-
})
|
|
6400
|
-
}
|
|
6401
|
-
);
|
|
6402
|
-
});
|
|
6403
|
-
|
|
6404
6662
|
// src/index.ts
|
|
6405
6663
|
var PAGE_SIZES = KIT_PAGE_SIZES;
|
|
6406
6664
|
var DEFAULT_PAGE_SIZE3 = KIT_DEFAULT_PAGE_SIZE;
|
|
6407
6665
|
export {
|
|
6408
6666
|
AccentPicker,
|
|
6409
|
-
AccountMenu,
|
|
6667
|
+
AccountMenu2 as AccountMenu,
|
|
6668
|
+
AccountWindow,
|
|
6410
6669
|
AppShell,
|
|
6411
6670
|
AuthShell,
|
|
6412
6671
|
Avatar,
|
|
6413
6672
|
BackLink,
|
|
6414
6673
|
Badge,
|
|
6415
|
-
Breadcrumbs,
|
|
6416
6674
|
BusyRegion,
|
|
6417
6675
|
Button,
|
|
6418
6676
|
Callout,
|