@apliteni/apliteni-ui 0.142.8 → 0.146.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/iconography.md +1 -1
- package/package.json +1 -1
- package/react/README.md +2 -2
- package/react/dist/index.d.ts +50 -4
- package/react/dist/index.js +941 -304
- package/src/assets/icons.js +6 -0
- package/src/styles/chart.css +123 -49
- package/src/styles/segmented.css +5 -0
- package/src/tokens/tokens.css +34 -0
package/react/dist/index.js
CHANGED
|
@@ -578,8 +578,8 @@ function StatBand({ stats, variant = "tiles", basis, basisId: sharedBasisId, lab
|
|
|
578
578
|
return /* @__PURE__ */ jsxs8("div", { className: root, role: label ? "group" : void 0, "aria-label": label || void 0, children: [
|
|
579
579
|
basis ? /* @__PURE__ */ jsx12("p", { className: "ui-stats__basis", id: basisId, children: basis }) : null,
|
|
580
580
|
/* @__PURE__ */ jsx12("dl", { className: "ui-stats__list", children: stats.map((s, i) => {
|
|
581
|
-
const
|
|
582
|
-
const cls = ["ui-stat",
|
|
581
|
+
const tone2 = hasChange(s.delta) && (s.delta.tone === "good" || s.delta.tone === "bad") ? s.delta.tone : "";
|
|
582
|
+
const cls = ["ui-stat", tone2 && `ui-stat--${tone2}`, v === "tiles" && "ui-card ui-card--pad-sm"].filter(Boolean).join(" ");
|
|
583
583
|
return /* @__PURE__ */ jsxs8("div", { className: cls, children: [
|
|
584
584
|
/* @__PURE__ */ jsx12("dt", { className: "ui-stat__label", children: s.label }),
|
|
585
585
|
/* @__PURE__ */ jsx12("dd", { className: "ui-stat__value", children: s.value }),
|
|
@@ -2446,9 +2446,9 @@ var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */ jsx22(
|
|
|
2446
2446
|
function RowBadge({ badge }) {
|
|
2447
2447
|
const text2 = typeof badge === "string" ? badge : badge.text;
|
|
2448
2448
|
const given = typeof badge === "string" ? "" : badge.tone || "";
|
|
2449
|
-
let
|
|
2450
|
-
if (!given &&
|
|
2451
|
-
return /* @__PURE__ */ jsx22("span", { className: `ui-dropdown__badge is-${
|
|
2449
|
+
let tone2 = given || (/^live$/i.test(String(text2)) ? "live" : "neutral");
|
|
2450
|
+
if (!given && tone2 === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone2 = "state";
|
|
2451
|
+
return /* @__PURE__ */ jsx22("span", { className: `ui-dropdown__badge is-${tone2}`, children: text2 });
|
|
2452
2452
|
}
|
|
2453
2453
|
var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
|
|
2454
2454
|
var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
|
|
@@ -3097,18 +3097,18 @@ function RowIdentity({ symbol, name, logo, href }) {
|
|
|
3097
3097
|
|
|
3098
3098
|
// src/Segmented.tsx
|
|
3099
3099
|
import { segmentedNextIndex } from "@apliteni/apliteni-ui";
|
|
3100
|
-
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3100
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3101
3101
|
function Segmented({ options, value, onChange, label, appearance = "pill", size, block = false, disabled = false }) {
|
|
3102
3102
|
const enabled = options.filter((o) => !o.disabled);
|
|
3103
3103
|
const tabValue = enabled.some((o) => o.value === value) ? value : enabled[0]?.value;
|
|
3104
|
-
return /* @__PURE__ */ jsx25("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__ */
|
|
3104
|
+
return /* @__PURE__ */ jsx25("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__ */ jsxs21(
|
|
3105
3105
|
"button",
|
|
3106
3106
|
{
|
|
3107
3107
|
type: "button",
|
|
3108
3108
|
"data-value": option.value,
|
|
3109
3109
|
disabled: disabled || option.disabled,
|
|
3110
3110
|
className: value === option.value ? "is-active" : void 0,
|
|
3111
|
-
"aria-label": option.ariaLabel,
|
|
3111
|
+
"aria-label": option.ariaLabel ?? (option.icon && option.iconOnly ? option.label : void 0),
|
|
3112
3112
|
"aria-pressed": value === option.value,
|
|
3113
3113
|
tabIndex: option.value === tabValue ? 0 : -1,
|
|
3114
3114
|
onClick: () => onChange(option.value),
|
|
@@ -3120,7 +3120,10 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
3120
3120
|
buttons[next]?.focus();
|
|
3121
3121
|
onChange(enabled[next].value);
|
|
3122
3122
|
},
|
|
3123
|
-
children:
|
|
3123
|
+
children: [
|
|
3124
|
+
option.icon && /* @__PURE__ */ jsx25(Icon, { name: option.icon }),
|
|
3125
|
+
!(option.icon && option.iconOnly) && option.label
|
|
3126
|
+
]
|
|
3124
3127
|
},
|
|
3125
3128
|
option.value
|
|
3126
3129
|
)) });
|
|
@@ -3129,7 +3132,7 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
3129
3132
|
// src/FilterBar.tsx
|
|
3130
3133
|
import { useRef as useRef13, useState as useState10 } from "react";
|
|
3131
3134
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
3132
|
-
import { Fragment as Fragment10, jsx as jsx26, jsxs as
|
|
3135
|
+
import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3133
3136
|
var SEARCH_AT = 10;
|
|
3134
3137
|
var isRow2 = (entry) => entry !== "---" && !entry.separator;
|
|
3135
3138
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clearVariant = "ghost", add, addLabel = "Filter", disabled = false, busy = false, onRemove, onClear, onChange, onAdd }) {
|
|
@@ -3179,7 +3182,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3179
3182
|
if (target) target.focus();
|
|
3180
3183
|
else focusNextStop(bar.current);
|
|
3181
3184
|
});
|
|
3182
|
-
return /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */
|
|
3185
|
+
return /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsxs22(
|
|
3183
3186
|
"fieldset",
|
|
3184
3187
|
{
|
|
3185
3188
|
ref: bar,
|
|
@@ -3193,7 +3196,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3193
3196
|
},
|
|
3194
3197
|
children: [
|
|
3195
3198
|
/* @__PURE__ */ jsx26("legend", { className: "ui-filter-bar__legend", children: label }),
|
|
3196
|
-
filters.map((filter, index) => /* @__PURE__ */
|
|
3199
|
+
filters.map((filter, index) => /* @__PURE__ */ jsxs22(
|
|
3197
3200
|
"fieldset",
|
|
3198
3201
|
{
|
|
3199
3202
|
className: "ui-filter-bar__chip",
|
|
@@ -3243,7 +3246,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3243
3246
|
variant: "menu",
|
|
3244
3247
|
sections,
|
|
3245
3248
|
ariaLabel: addLabel,
|
|
3246
|
-
triggerContent: /* @__PURE__ */
|
|
3249
|
+
triggerContent: /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
3247
3250
|
/* @__PURE__ */ jsx26(Icon, { name: "plus" }),
|
|
3248
3251
|
addLabel
|
|
3249
3252
|
] }),
|
|
@@ -3269,9 +3272,9 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3269
3272
|
}
|
|
3270
3273
|
|
|
3271
3274
|
// src/KeyValueList.tsx
|
|
3272
|
-
import { jsx as jsx27, jsxs as
|
|
3275
|
+
import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3273
3276
|
function detail({ value, redacted }) {
|
|
3274
|
-
if (redacted) return /* @__PURE__ */
|
|
3277
|
+
if (redacted) return /* @__PURE__ */ jsxs23("span", { className: "ui-kv__hidden", children: [
|
|
3275
3278
|
/* @__PURE__ */ jsx27(Icon, { name: "eyeOff" }),
|
|
3276
3279
|
"Hidden"
|
|
3277
3280
|
] });
|
|
@@ -3279,14 +3282,14 @@ function detail({ value, redacted }) {
|
|
|
3279
3282
|
return typeof value === "boolean" ? String(value) : value;
|
|
3280
3283
|
}
|
|
3281
3284
|
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
3282
|
-
return /* @__PURE__ */ jsx27("dl", { ...rest, className: ["ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */
|
|
3285
|
+
return /* @__PURE__ */ jsx27("dl", { ...rest, className: ["ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */ jsxs23("div", { className: "ui-drawer__row", children: [
|
|
3283
3286
|
/* @__PURE__ */ jsx27("dt", { children: row.label }),
|
|
3284
3287
|
/* @__PURE__ */ jsx27("dd", { children: detail(row) })
|
|
3285
3288
|
] }, index)) });
|
|
3286
3289
|
}
|
|
3287
3290
|
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
3288
3291
|
const Heading = `h${headingLevel}`;
|
|
3289
|
-
return /* @__PURE__ */
|
|
3292
|
+
return /* @__PURE__ */ jsxs23("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
3290
3293
|
title != null && /* @__PURE__ */ jsx27(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
3291
3294
|
children
|
|
3292
3295
|
] });
|
|
@@ -3294,7 +3297,7 @@ function DrawerSection({ title, headingLevel = 3, className, children, ...rest }
|
|
|
3294
3297
|
|
|
3295
3298
|
// src/Snippet.tsx
|
|
3296
3299
|
import { useEffect as useEffect9, useRef as useRef14, useState as useState11 } from "react";
|
|
3297
|
-
import { Fragment as Fragment11, jsx as jsx28, jsxs as
|
|
3300
|
+
import { Fragment as Fragment11, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3298
3301
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
3299
3302
|
const [status, setStatus] = useState11("idle");
|
|
3300
3303
|
const request = useRef14(0);
|
|
@@ -3319,10 +3322,10 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3319
3322
|
if (current === request.current) setStatus("failed");
|
|
3320
3323
|
}
|
|
3321
3324
|
}
|
|
3322
|
-
return /* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
3325
|
+
return /* @__PURE__ */ jsxs24("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
3326
|
+
/* @__PURE__ */ jsxs24("div", { className: "ui-snippet__bar", children: [
|
|
3324
3327
|
/* @__PURE__ */ jsx28("span", { children: label }),
|
|
3325
|
-
copy && /* @__PURE__ */
|
|
3328
|
+
copy && /* @__PURE__ */ jsxs24(Fragment11, { children: [
|
|
3326
3329
|
/* @__PURE__ */ jsx28(
|
|
3327
3330
|
"button",
|
|
3328
3331
|
{
|
|
@@ -3344,7 +3347,7 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3344
3347
|
// src/Tabs.tsx
|
|
3345
3348
|
import { useEffect as useEffect10, useId as useId9, useRef as useRef15 } from "react";
|
|
3346
3349
|
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
3347
|
-
import { Fragment as Fragment12, jsx as jsx29, jsxs as
|
|
3350
|
+
import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3348
3351
|
function Tabs({ items, value, onChange, label }) {
|
|
3349
3352
|
const id = useId9();
|
|
3350
3353
|
const previous = useRef15(value);
|
|
@@ -3354,8 +3357,8 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3354
3357
|
if (previous.current !== value) playEntrance(activePanel.current);
|
|
3355
3358
|
previous.current = value;
|
|
3356
3359
|
}, [value]);
|
|
3357
|
-
return /* @__PURE__ */
|
|
3358
|
-
/* @__PURE__ */ jsx29("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */
|
|
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(
|
|
3359
3362
|
"button",
|
|
3360
3363
|
{
|
|
3361
3364
|
type: "button",
|
|
@@ -3393,7 +3396,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3393
3396
|
},
|
|
3394
3397
|
children: [
|
|
3395
3398
|
item.label,
|
|
3396
|
-
item.count != null && /* @__PURE__ */
|
|
3399
|
+
item.count != null && /* @__PURE__ */ jsxs25(Fragment12, { children: [
|
|
3397
3400
|
" ",
|
|
3398
3401
|
item.count
|
|
3399
3402
|
] })
|
|
@@ -3421,7 +3424,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3421
3424
|
// src/Timeline.tsx
|
|
3422
3425
|
import { useEffect as useEffect11, useRef as useRef16 } from "react";
|
|
3423
3426
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
3424
|
-
import { jsx as jsx30, jsxs as
|
|
3427
|
+
import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3425
3428
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
3426
3429
|
function Timeline({ events, className, ...rest }) {
|
|
3427
3430
|
const previousIds = useRef16(new Set(events.map((event) => event.id)));
|
|
@@ -3438,7 +3441,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3438
3441
|
}
|
|
3439
3442
|
previousIds.current = new Set(events.map((event) => event.id));
|
|
3440
3443
|
}, [events]);
|
|
3441
|
-
return /* @__PURE__ */ jsx30("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__ */
|
|
3444
|
+
return /* @__PURE__ */ jsx30("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__ */ jsxs26(
|
|
3442
3445
|
"li",
|
|
3443
3446
|
{
|
|
3444
3447
|
className: "ui-timeline__event",
|
|
@@ -3452,13 +3455,13 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3452
3455
|
event.kind && "ui-timeline__marker--kind",
|
|
3453
3456
|
event.kind === "reversal" && "ui-timeline__marker--reversal"
|
|
3454
3457
|
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */ jsx30(Icon, { name: kindIcons[event.kind] }) }),
|
|
3455
|
-
/* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsxs26("div", { className: "ui-timeline__head", children: [
|
|
3456
3459
|
/* @__PURE__ */ jsx30("span", { className: "ui-timeline__actor", children: event.actor }),
|
|
3457
3460
|
/* @__PURE__ */ jsx30("time", { dateTime: event.dateTime, children: event.timestamp }),
|
|
3458
3461
|
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */ jsx30("span", { className: "ui-timeline__relative", children: event.relativeTimestamp })
|
|
3459
3462
|
] }),
|
|
3460
3463
|
/* @__PURE__ */ jsx30("p", { className: "ui-timeline__description", children: event.description }),
|
|
3461
|
-
(event.meta != null || event.undo) && /* @__PURE__ */
|
|
3464
|
+
(event.meta != null || event.undo) && /* @__PURE__ */ jsxs26("div", { className: "ui-timeline__meta", children: [
|
|
3462
3465
|
event.meta != null && /* @__PURE__ */ jsx30("span", { children: event.meta }),
|
|
3463
3466
|
event.undo && /* @__PURE__ */ jsx30(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" })
|
|
3464
3467
|
] })
|
|
@@ -3471,13 +3474,13 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3471
3474
|
// src/Field.tsx
|
|
3472
3475
|
import { forwardRef as forwardRef6, useEffect as useEffect12, useId as useId10, useRef as useRef17, useState as useState12 } from "react";
|
|
3473
3476
|
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3474
|
-
import { jsx as jsx31, jsxs as
|
|
3477
|
+
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3475
3478
|
function messages(id, hint, error) {
|
|
3476
3479
|
return [error && `${id}-error`, hint && `${id}-hint`].filter(Boolean).join(" ") || void 0;
|
|
3477
3480
|
}
|
|
3478
3481
|
function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
3479
|
-
return /* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3482
|
+
return /* @__PURE__ */ jsxs27("div", { className: "ui-field", children: [
|
|
3483
|
+
/* @__PURE__ */ jsxs27("label", { className: "ui-field__label", id: labelId, htmlFor: id, children: [
|
|
3481
3484
|
label,
|
|
3482
3485
|
required && /* @__PURE__ */ jsx31("span", { className: "ui-field__req", "aria-hidden": "true", children: "*" })
|
|
3483
3486
|
] }),
|
|
@@ -3521,11 +3524,11 @@ var TextField = forwardRef6(function TextField2({ label, hint, error, required,
|
|
|
3521
3524
|
}
|
|
3522
3525
|
);
|
|
3523
3526
|
const unitSpan = hasUnit ? /* @__PURE__ */ jsx31("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
3524
|
-
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: glyph ? /* @__PURE__ */
|
|
3527
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: glyph ? /* @__PURE__ */ jsxs27("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
3525
3528
|
/* @__PURE__ */ jsx31("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(glyph) } }),
|
|
3526
3529
|
control,
|
|
3527
3530
|
unitSpan
|
|
3528
|
-
] }) : hasUnit ? /* @__PURE__ */
|
|
3531
|
+
] }) : hasUnit ? /* @__PURE__ */ jsxs27("div", { className: "ui-field-number", children: [
|
|
3529
3532
|
control,
|
|
3530
3533
|
unitSpan
|
|
3531
3534
|
] }) : control });
|
|
@@ -3574,7 +3577,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3574
3577
|
setFile(next);
|
|
3575
3578
|
onFileChange?.(next);
|
|
3576
3579
|
};
|
|
3577
|
-
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */
|
|
3580
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsxs27(
|
|
3578
3581
|
"div",
|
|
3579
3582
|
{
|
|
3580
3583
|
className: `ui-file${dragging && !disabled ? " is-dragging" : ""}${file ? " has-file" : ""}${error ? " is-invalid" : ""}${disabled ? " is-disabled" : ""}`,
|
|
@@ -3598,7 +3601,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3598
3601
|
/* @__PURE__ */ jsx31("span", { className: "ui-file__glyph", children: /* @__PURE__ */ jsx31(Icon, { name: "upload" }) }),
|
|
3599
3602
|
/* @__PURE__ */ jsx31("div", { "aria-live": "polite", children: file ? file.name : "Drop a file here" }),
|
|
3600
3603
|
/* @__PURE__ */ jsx31("div", { children: "or choose one from your device" }),
|
|
3601
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsxs27("span", { className: "ui-file__choose", children: [
|
|
3602
3605
|
/* @__PURE__ */ jsx31("span", { className: "ui-btn ui-btn--secondary ui-btn--sm", "aria-hidden": "true", "aria-disabled": disabled || void 0, children: file ? "Replace file" : "Choose file" }),
|
|
3603
3606
|
/* @__PURE__ */ jsx31(
|
|
3604
3607
|
"input",
|
|
@@ -3624,7 +3627,7 @@ import { useRef as useRef18, useState as useState13 } from "react";
|
|
|
3624
3627
|
|
|
3625
3628
|
// src/EmptyState.tsx
|
|
3626
3629
|
import { icon as kitIcon3, illo } from "@apliteni/apliteni-ui";
|
|
3627
|
-
import { jsx as jsx32, jsxs as
|
|
3630
|
+
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3628
3631
|
var cases = {
|
|
3629
3632
|
"first-run": { title: "Nothing needs you yet", sub: "New items will appear here when they need your attention.", icon: "check" },
|
|
3630
3633
|
"no-matches": { title: "No results in this view", sub: "Try another search or clear your filters.", icon: "search" },
|
|
@@ -3636,7 +3639,7 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon9, art, actio
|
|
|
3636
3639
|
const heading = title ?? preset.title;
|
|
3637
3640
|
const guidance = sub ?? preset.sub;
|
|
3638
3641
|
const glyph = icon9 ?? preset.icon;
|
|
3639
|
-
return /* @__PURE__ */
|
|
3642
|
+
return /* @__PURE__ */ jsxs28("div", { className: "ui-empty", children: [
|
|
3640
3643
|
art ? typeof art === "string" ? /* @__PURE__ */ jsx32("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx32("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) : glyph ? /* @__PURE__ */ jsx32("div", { className: "ui-empty__icon", dangerouslySetInnerHTML: { __html: kitIcon3(glyph) } }) : null,
|
|
3641
3644
|
heading && /* @__PURE__ */ jsx32("div", { className: "ui-empty__title", children: heading }),
|
|
3642
3645
|
guidance && /* @__PURE__ */ jsx32("div", { className: "ui-empty__sub", children: guidance }),
|
|
@@ -3645,7 +3648,7 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon9, art, actio
|
|
|
3645
3648
|
}
|
|
3646
3649
|
|
|
3647
3650
|
// src/FileDrop.tsx
|
|
3648
|
-
import { Fragment as Fragment13, jsx as jsx33, jsxs as
|
|
3651
|
+
import { Fragment as Fragment13, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3649
3652
|
var MARKS = {
|
|
3650
3653
|
uploading: "clock",
|
|
3651
3654
|
done: "circleCheck",
|
|
@@ -3731,7 +3734,7 @@ function FileDrop({
|
|
|
3731
3734
|
take(Array.from(event.dataTransfer.files));
|
|
3732
3735
|
}
|
|
3733
3736
|
};
|
|
3734
|
-
if (title !== void 0) return /* @__PURE__ */
|
|
3737
|
+
if (title !== void 0) return /* @__PURE__ */ jsxs29(
|
|
3735
3738
|
"div",
|
|
3736
3739
|
{
|
|
3737
3740
|
className: cx7("ui-drop", "ui-drop--area", showTarget && "is-dragging", disabled && "is-disabled", className),
|
|
@@ -3764,16 +3767,16 @@ function FileDrop({
|
|
|
3764
3767
|
]
|
|
3765
3768
|
}
|
|
3766
3769
|
);
|
|
3767
|
-
return /* @__PURE__ */
|
|
3770
|
+
return /* @__PURE__ */ jsxs29("div", { className: cx7("ui-drop", disabled && "is-disabled", className), ...drag, children: [
|
|
3768
3771
|
children,
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
file ? /* @__PURE__ */
|
|
3771
|
-
/* @__PURE__ */
|
|
3772
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsxs29("div", { className: "ui-drop__row", children: [
|
|
3773
|
+
file ? /* @__PURE__ */ jsxs29("div", { className: cx7("ui-drop__file", status === "error" && "ui-drop__file--failed"), children: [
|
|
3774
|
+
/* @__PURE__ */ jsxs29("div", { className: "ui-drop__line", children: [
|
|
3775
|
+
/* @__PURE__ */ jsxs29("span", { className: "ui-drop__name", title: file.name, children: [
|
|
3773
3776
|
/* @__PURE__ */ jsx33("span", { className: "ui-drop__stem", children: stem }),
|
|
3774
3777
|
/* @__PURE__ */ jsx33("span", { className: "ui-drop__ext", children: ext })
|
|
3775
3778
|
] }),
|
|
3776
|
-
(onRemove || status === "error" && onRetry) && /* @__PURE__ */
|
|
3779
|
+
(onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs29("span", { className: "ui-drop__actions", children: [
|
|
3777
3780
|
status === "error" && onRetry && /* @__PURE__ */ jsx33(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
|
|
3778
3781
|
onRemove && /* @__PURE__ */ jsx33(
|
|
3779
3782
|
Button,
|
|
@@ -3787,14 +3790,14 @@ function FileDrop({
|
|
|
3787
3790
|
)
|
|
3788
3791
|
] })
|
|
3789
3792
|
] }),
|
|
3790
|
-
(showSize || showWord) && /* @__PURE__ */
|
|
3793
|
+
(showSize || showWord) && /* @__PURE__ */ jsxs29(
|
|
3791
3794
|
"div",
|
|
3792
3795
|
{
|
|
3793
3796
|
className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
|
|
3794
3797
|
role: status === "error" ? "alert" : void 0,
|
|
3795
3798
|
children: [
|
|
3796
3799
|
showSize && /* @__PURE__ */ jsx33("span", { className: "ui-drop__size", children: file.size }),
|
|
3797
|
-
showWord && /* @__PURE__ */
|
|
3800
|
+
showWord && /* @__PURE__ */ jsxs29("span", { className: "ui-drop__state", children: [
|
|
3798
3801
|
/* @__PURE__ */ jsx33(Icon, { name: MARKS[status] }),
|
|
3799
3802
|
/* @__PURE__ */ jsx33("span", { className: "ui-drop__word", title: word, children: word })
|
|
3800
3803
|
] })
|
|
@@ -3813,7 +3816,7 @@ function FileDrop({
|
|
|
3813
3816
|
children: /* @__PURE__ */ jsx33("span", { style: { width: `${file.progress}%` } })
|
|
3814
3817
|
}
|
|
3815
3818
|
)
|
|
3816
|
-
] }) : /* @__PURE__ */
|
|
3819
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment13, { children: [
|
|
3817
3820
|
/* @__PURE__ */ jsx33(
|
|
3818
3821
|
Button,
|
|
3819
3822
|
{
|
|
@@ -3835,9 +3838,9 @@ function FileDrop({
|
|
|
3835
3838
|
// src/SearchField.tsx
|
|
3836
3839
|
import { forwardRef as forwardRef7 } from "react";
|
|
3837
3840
|
import { icon as icon6 } from "@apliteni/apliteni-ui";
|
|
3838
|
-
import { jsx as jsx34, jsxs as
|
|
3841
|
+
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3839
3842
|
var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...props }, ref) {
|
|
3840
|
-
return /* @__PURE__ */
|
|
3843
|
+
return /* @__PURE__ */ jsxs30("div", { className: "ui-input-group", children: [
|
|
3841
3844
|
/* @__PURE__ */ jsx34("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon6("search") } }),
|
|
3842
3845
|
/* @__PURE__ */ jsx34(
|
|
3843
3846
|
"input",
|
|
@@ -3963,7 +3966,7 @@ function watchToastPile(stack2) {
|
|
|
3963
3966
|
}
|
|
3964
3967
|
|
|
3965
3968
|
// src/Toast.tsx
|
|
3966
|
-
import { jsx as jsx35, jsxs as
|
|
3969
|
+
import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3967
3970
|
var Context = createContext3(null);
|
|
3968
3971
|
var PileHoldContext = createContext3(false);
|
|
3969
3972
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
@@ -3980,7 +3983,7 @@ function Notice({ notice, remove }) {
|
|
|
3980
3983
|
const [focused, setFocused] = useState14(false);
|
|
3981
3984
|
const pileHeld = useContext3(PileHoldContext);
|
|
3982
3985
|
const paused = hovered || focused || pileHeld;
|
|
3983
|
-
const
|
|
3986
|
+
const tone2 = notice.tone ?? "success";
|
|
3984
3987
|
const timed = !notice.action && notice.timer !== false && notice.timer !== 0;
|
|
3985
3988
|
const duration = typeof notice.timer === "number" ? notice.timer * 1e3 : 5e3;
|
|
3986
3989
|
const remaining = useRef19(duration);
|
|
@@ -4013,13 +4016,13 @@ function Notice({ notice, remove }) {
|
|
|
4013
4016
|
remaining.current = Math.max(0, remaining.current - (Date.now() - started));
|
|
4014
4017
|
};
|
|
4015
4018
|
}, [dismiss, leaving2, paused, timed]);
|
|
4016
|
-
return /* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ jsxs31(
|
|
4017
4020
|
"div",
|
|
4018
4021
|
{
|
|
4019
4022
|
ref: root,
|
|
4020
|
-
className: `ui-toast ui-toast--${
|
|
4021
|
-
role:
|
|
4022
|
-
"aria-live":
|
|
4023
|
+
className: `ui-toast ui-toast--${tone2} ui-toast--soft${notice.compact ? " ui-toast--compact" : ""}${leaving2 ? " is-leaving" : ""}`,
|
|
4024
|
+
role: tone2 === "danger" ? "alert" : "status",
|
|
4025
|
+
"aria-live": tone2 === "danger" ? "assertive" : "polite",
|
|
4023
4026
|
onMouseEnter: () => setHovered(true),
|
|
4024
4027
|
onMouseLeave: () => setHovered(false),
|
|
4025
4028
|
onFocus: () => setFocused(true),
|
|
@@ -4027,8 +4030,8 @@ function Notice({ notice, remove }) {
|
|
|
4027
4030
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
|
|
4028
4031
|
},
|
|
4029
4032
|
children: [
|
|
4030
|
-
/* @__PURE__ */ jsx35("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx35(Icon, { name: glyphs[
|
|
4031
|
-
/* @__PURE__ */
|
|
4033
|
+
/* @__PURE__ */ jsx35("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx35(Icon, { name: glyphs[tone2] }) }),
|
|
4034
|
+
/* @__PURE__ */ jsxs31("div", { className: "ui-toast__body", children: [
|
|
4032
4035
|
/* @__PURE__ */ jsx35("div", { className: "ui-toast__title", children: notice.title }),
|
|
4033
4036
|
!notice.compact && notice.text && /* @__PURE__ */ jsx35("div", { className: "ui-toast__text", children: notice.text })
|
|
4034
4037
|
] }),
|
|
@@ -4109,7 +4112,7 @@ function Toast({ children, collapse = false }) {
|
|
|
4109
4112
|
const leavePileFocus = (event) => {
|
|
4110
4113
|
if (!event.currentTarget.contains(event.relatedTarget)) setPileFocused(false);
|
|
4111
4114
|
};
|
|
4112
|
-
return /* @__PURE__ */
|
|
4115
|
+
return /* @__PURE__ */ jsxs31(Context.Provider, { value: push, children: [
|
|
4113
4116
|
children,
|
|
4114
4117
|
typeof document !== "undefined" && createPortal5(
|
|
4115
4118
|
/* @__PURE__ */ jsx35(
|
|
@@ -4165,7 +4168,7 @@ function storeRailCollapsed(collapsed) {
|
|
|
4165
4168
|
// src/SidebarNav.tsx
|
|
4166
4169
|
import { forwardRef as forwardRef8, useEffect as useEffect14, useId as useId11, useState as useState15 } from "react";
|
|
4167
4170
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
4168
|
-
import { Fragment as Fragment14, jsx as jsx36, jsxs as
|
|
4171
|
+
import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4169
4172
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
4170
4173
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
4171
4174
|
const uid = useId11();
|
|
@@ -4191,14 +4194,14 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
4191
4194
|
item.disabled && "is-disabled",
|
|
4192
4195
|
item.danger && "is-danger"
|
|
4193
4196
|
].filter(Boolean).join(" ");
|
|
4194
|
-
const children = /* @__PURE__ */
|
|
4197
|
+
const children = /* @__PURE__ */ jsxs32(Fragment14, { children: [
|
|
4195
4198
|
(item.leading ?? item.icon) && /* @__PURE__ */ jsx36("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx36(Icon, { name: item.icon }) }),
|
|
4196
4199
|
/* @__PURE__ */ jsx36("span", { className: "ui-nav__label", children: item.label }),
|
|
4197
4200
|
count != null && count !== "" && /* @__PURE__ */ jsx36("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
4198
4201
|
group && /* @__PURE__ */ jsx36("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
4199
4202
|
] });
|
|
4200
4203
|
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
4201
|
-
if (group) return /* @__PURE__ */
|
|
4204
|
+
if (group) return /* @__PURE__ */ jsxs32("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
4202
4205
|
/* @__PURE__ */ jsx36(
|
|
4203
4206
|
"button",
|
|
4204
4207
|
{
|
|
@@ -4226,7 +4229,7 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
4226
4229
|
}
|
|
4227
4230
|
function Section({ section, ...props }) {
|
|
4228
4231
|
const uid = useId11();
|
|
4229
|
-
return /* @__PURE__ */
|
|
4232
|
+
return /* @__PURE__ */ jsxs32("div", { className: "ui-nav__section", children: [
|
|
4230
4233
|
section.label && /* @__PURE__ */ jsx36("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
4231
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)) })
|
|
4232
4235
|
] });
|
|
@@ -4243,7 +4246,7 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
4243
4246
|
"aria-label": label = "Sidebar",
|
|
4244
4247
|
...rest
|
|
4245
4248
|
}, ref) {
|
|
4246
|
-
return /* @__PURE__ */
|
|
4249
|
+
return /* @__PURE__ */ jsxs32("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
4247
4250
|
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx36(
|
|
4248
4251
|
Section,
|
|
4249
4252
|
{
|
|
@@ -4262,7 +4265,7 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
4262
4265
|
// src/Breadcrumbs.tsx
|
|
4263
4266
|
import { forwardRef as forwardRef9 } from "react";
|
|
4264
4267
|
import { icon as icon7, safeUrl as safeUrl2 } from "@apliteni/apliteni-ui";
|
|
4265
|
-
import { Fragment as Fragment15, jsx as jsx37, jsxs as
|
|
4268
|
+
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4266
4269
|
var Breadcrumbs = forwardRef9(function Breadcrumbs2({
|
|
4267
4270
|
items,
|
|
4268
4271
|
renderLink,
|
|
@@ -4279,7 +4282,7 @@ var Breadcrumbs = forwardRef9(function Breadcrumbs2({
|
|
|
4279
4282
|
"aria-label": ariaLabel,
|
|
4280
4283
|
children: /* @__PURE__ */ jsx37("ol", { className: "ui-nav__crumbs", children: items.map((item, index) => {
|
|
4281
4284
|
const current = index === items.length - 1;
|
|
4282
|
-
const inner = /* @__PURE__ */
|
|
4285
|
+
const inner = /* @__PURE__ */ jsxs33(Fragment15, { children: [
|
|
4283
4286
|
item.icon && /* @__PURE__ */ jsx37("span", { className: "ui-nav__ic", dangerouslySetInnerHTML: { __html: icon7(item.icon) } }),
|
|
4284
4287
|
/* @__PURE__ */ jsx37("span", { className: "ui-nav__crumb-label", children: item.label })
|
|
4285
4288
|
] });
|
|
@@ -4300,7 +4303,7 @@ var Breadcrumbs = forwardRef9(function Breadcrumbs2({
|
|
|
4300
4303
|
// src/ThemeToggle.tsx
|
|
4301
4304
|
import { useSyncExternalStore } from "react";
|
|
4302
4305
|
import { themeIcon } from "@apliteni/apliteni-ui";
|
|
4303
|
-
import { jsx as jsx38, jsxs as
|
|
4306
|
+
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4304
4307
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
4305
4308
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
4306
4309
|
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')})()`;
|
|
@@ -4363,9 +4366,9 @@ function useThemeChoice() {
|
|
|
4363
4366
|
function ThemeToggle({ labelled = false }) {
|
|
4364
4367
|
const { theme, label, name, toggle } = useThemeChoice();
|
|
4365
4368
|
const button = /* @__PURE__ */ jsx38("button", { type: "button", className: "toggle", "aria-label": name, title: name, onClick: toggle, children: /* @__PURE__ */ jsx38("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon(theme) } }) });
|
|
4366
|
-
return labelled ? /* @__PURE__ */
|
|
4369
|
+
return labelled ? /* @__PURE__ */ jsxs34("span", { className: "ui-theme-toggle", children: [
|
|
4367
4370
|
button,
|
|
4368
|
-
/* @__PURE__ */
|
|
4371
|
+
/* @__PURE__ */ jsxs34("span", { children: [
|
|
4369
4372
|
label,
|
|
4370
4373
|
" theme"
|
|
4371
4374
|
] })
|
|
@@ -4373,7 +4376,7 @@ function ThemeToggle({ labelled = false }) {
|
|
|
4373
4376
|
}
|
|
4374
4377
|
|
|
4375
4378
|
// src/AppShell.tsx
|
|
4376
|
-
import { Fragment as Fragment16, jsx as jsx39, jsxs as
|
|
4379
|
+
import { Fragment as Fragment16, jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4377
4380
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
4378
4381
|
function AppShell({
|
|
4379
4382
|
sections,
|
|
@@ -4461,7 +4464,7 @@ function AppShell({
|
|
|
4461
4464
|
);
|
|
4462
4465
|
const foldLabel = collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
4463
4466
|
const navigable = sections.length > 1 || Boolean(back);
|
|
4464
|
-
const lockup = /* @__PURE__ */
|
|
4467
|
+
const lockup = /* @__PURE__ */ jsxs35("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
4465
4468
|
brand ?? /* @__PURE__ */ jsx39("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
4466
4469
|
/* @__PURE__ */ jsx39("span", { children: word })
|
|
4467
4470
|
] });
|
|
@@ -4475,15 +4478,15 @@ function AppShell({
|
|
|
4475
4478
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
4476
4479
|
triggerClass: "ui-app__user-trigger",
|
|
4477
4480
|
panelClass: "ui-app__user-panel",
|
|
4478
|
-
triggerContent: /* @__PURE__ */
|
|
4481
|
+
triggerContent: /* @__PURE__ */ jsxs35(Fragment16, { children: [
|
|
4479
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 }) }),
|
|
4480
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsxs35("span", { className: "ui-app__who", children: [
|
|
4481
4484
|
/* @__PURE__ */ jsx39("b", { children: account.name }),
|
|
4482
4485
|
/* @__PURE__ */ jsx39("span", { children: account.email })
|
|
4483
4486
|
] })
|
|
4484
4487
|
] }),
|
|
4485
4488
|
items: [...withTheme ? [{ label: `${theme.label} theme`, value: "theme" }] : [], { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4486
|
-
row: (item, props) => item.value === "theme" ? /* @__PURE__ */
|
|
4489
|
+
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs35(
|
|
4487
4490
|
"div",
|
|
4488
4491
|
{
|
|
4489
4492
|
...props,
|
|
@@ -4501,9 +4504,9 @@ function AppShell({
|
|
|
4501
4504
|
}
|
|
4502
4505
|
) });
|
|
4503
4506
|
const headSlot = layout === "topbar" && headControl && /* @__PURE__ */ jsx39("div", { className: "ui-react-app__head-control", children: headControl });
|
|
4504
|
-
const foldControl = /* @__PURE__ */
|
|
4507
|
+
const foldControl = /* @__PURE__ */ jsxs35("div", { className: "ui-app__fold-row", children: [
|
|
4505
4508
|
headSlot,
|
|
4506
|
-
/* @__PURE__ */
|
|
4509
|
+
/* @__PURE__ */ jsxs35(
|
|
4507
4510
|
"button",
|
|
4508
4511
|
{
|
|
4509
4512
|
type: "button",
|
|
@@ -4512,7 +4515,7 @@ function AppShell({
|
|
|
4512
4515
|
"aria-label": foldLabel,
|
|
4513
4516
|
onClick: fold,
|
|
4514
4517
|
children: [
|
|
4515
|
-
/* @__PURE__ */ jsx39("span", { className: "ui-nav__ic", children: /* @__PURE__ */
|
|
4518
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsxs35("svg", { className: "ui-icon", viewBox: "0 0 24 24", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4516
4519
|
/* @__PURE__ */ jsx39("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
4517
4520
|
/* @__PURE__ */ jsx39("path", { className: "ui-app__fold-seam", d: "M9 3v18" }),
|
|
4518
4521
|
/* @__PURE__ */ jsx39("path", { className: "ui-app__fold-arrow", d: "m16 15-3-3 3-3" })
|
|
@@ -4522,23 +4525,23 @@ function AppShell({
|
|
|
4522
4525
|
}
|
|
4523
4526
|
)
|
|
4524
4527
|
] });
|
|
4525
|
-
const page = /* @__PURE__ */
|
|
4528
|
+
const page = /* @__PURE__ */ jsxs35("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
4526
4529
|
back ? /* @__PURE__ */ jsx39(BackLink, { ...back }) : crumbs?.length ? /* @__PURE__ */ jsx39(Breadcrumbs, { items: crumbs }) : null,
|
|
4527
4530
|
/* @__PURE__ */ jsx39("h1", { children: title }),
|
|
4528
4531
|
lede && /* @__PURE__ */ jsx39("p", { className: "ui-app__sub", children: lede }),
|
|
4529
4532
|
actions && /* @__PURE__ */ jsx39("div", { className: "ui-react-app__actions", children: actions }),
|
|
4530
4533
|
/* @__PURE__ */ jsx39("div", { className: "ui-app__body", children })
|
|
4531
4534
|
] });
|
|
4532
|
-
if (layout === "rail") return /* @__PURE__ */
|
|
4533
|
-
/* @__PURE__ */
|
|
4534
|
-
/* @__PURE__ */
|
|
4535
|
+
if (layout === "rail") return /* @__PURE__ */ jsxs35("div", { className: `ui-app ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
4536
|
+
/* @__PURE__ */ jsxs35("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
4537
|
+
/* @__PURE__ */ jsxs35("div", { className: "ui-app__head", children: [
|
|
4535
4538
|
lockup,
|
|
4536
4539
|
foldControl
|
|
4537
4540
|
] }),
|
|
4538
4541
|
sidebar("Sections"),
|
|
4539
4542
|
accountBlock()
|
|
4540
4543
|
] }),
|
|
4541
|
-
/* @__PURE__ */
|
|
4544
|
+
/* @__PURE__ */ jsxs35("header", { className: "ui-app__bar ui-app__bar--phone", children: [
|
|
4542
4545
|
/* @__PURE__ */ jsx39(
|
|
4543
4546
|
Button,
|
|
4544
4547
|
{
|
|
@@ -4570,9 +4573,9 @@ function AppShell({
|
|
|
4570
4573
|
)
|
|
4571
4574
|
] });
|
|
4572
4575
|
const control = bandControl && /* @__PURE__ */ jsx39("div", { className: "ui-react-app__control", inert: collapsed, children: bandControl });
|
|
4573
|
-
return /* @__PURE__ */
|
|
4574
|
-
navigable && /* @__PURE__ */
|
|
4575
|
-
/* @__PURE__ */
|
|
4576
|
+
return /* @__PURE__ */ jsxs35("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
4577
|
+
navigable && /* @__PURE__ */ jsxs35("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
4578
|
+
/* @__PURE__ */ jsxs35("div", { className: "ui-app__head", children: [
|
|
4576
4579
|
lockup,
|
|
4577
4580
|
foldControl
|
|
4578
4581
|
] }),
|
|
@@ -4580,13 +4583,13 @@ function AppShell({
|
|
|
4580
4583
|
sidebar("Sections"),
|
|
4581
4584
|
accountBlock(true)
|
|
4582
4585
|
] }),
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
navigable ? /* @__PURE__ */
|
|
4586
|
+
/* @__PURE__ */ jsxs35("div", { className: "ui-app__well", children: [
|
|
4587
|
+
/* @__PURE__ */ jsxs35("header", { className: "ui-app__bar", children: [
|
|
4588
|
+
navigable ? /* @__PURE__ */ jsxs35(Fragment16, { children: [
|
|
4586
4589
|
/* @__PURE__ */ jsx39("a", { className: "ui-app__brand ui-app__brand--band", href: brandHref, "aria-label": word, children: brand ?? /* @__PURE__ */ jsx39("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(`${uid}-band`, 24) } }) }),
|
|
4587
4590
|
/* @__PURE__ */ jsx39("span", { className: "ui-react-app__title", "aria-hidden": "true", children: title })
|
|
4588
4591
|
] }) : lockup,
|
|
4589
|
-
/* @__PURE__ */
|
|
4592
|
+
/* @__PURE__ */ jsxs35("button", { type: "button", className: "ui-app__search", "aria-haspopup": "dialog", onClick: () => setSearch(true), children: [
|
|
4590
4593
|
/* @__PURE__ */ jsx39("span", { className: "ui-app__search-ic", children: /* @__PURE__ */ jsx39(Icon, { name: "search" }) }),
|
|
4591
4594
|
/* @__PURE__ */ jsx39("span", { className: "ui-app__search-txt", children: searchLabel }),
|
|
4592
4595
|
/* @__PURE__ */ jsx39("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
|
|
@@ -4605,7 +4608,7 @@ function AppShell({
|
|
|
4605
4608
|
"aria-expanded": menu,
|
|
4606
4609
|
onClick: () => setMenu(true)
|
|
4607
4610
|
}
|
|
4608
|
-
) : /* @__PURE__ */
|
|
4611
|
+
) : /* @__PURE__ */ jsxs35(Fragment16, { children: [
|
|
4609
4612
|
bandControl && /* @__PURE__ */ jsx39("span", { className: "ui-react-app__band-control", children: bandControl }),
|
|
4610
4613
|
headControl && /* @__PURE__ */ jsx39("span", { className: "ui-react-app__band-control", children: headControl }),
|
|
4611
4614
|
/* @__PURE__ */ jsx39(ThemeToggle, {}),
|
|
@@ -4619,7 +4622,7 @@ function AppShell({
|
|
|
4619
4622
|
triggerClass: "ui-app__user-trigger",
|
|
4620
4623
|
panelClass: "ui-app__user-panel",
|
|
4621
4624
|
triggerContent: /* @__PURE__ */ jsx39("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx39(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4622
|
-
header: /* @__PURE__ */
|
|
4625
|
+
header: /* @__PURE__ */ jsxs35("div", { className: "ui-dropdown__head", children: [
|
|
4623
4626
|
/* @__PURE__ */ jsx39("b", { children: account.name }),
|
|
4624
4627
|
/* @__PURE__ */ jsx39("span", { children: account.email })
|
|
4625
4628
|
] }),
|
|
@@ -4642,7 +4645,7 @@ function AppShell({
|
|
|
4642
4645
|
initialFocusRef: firstRow,
|
|
4643
4646
|
headerActions: headSlot,
|
|
4644
4647
|
footer: /* @__PURE__ */ jsx39("div", { className: "ui-app__drawer", children: accountBlock(true) }),
|
|
4645
|
-
children: /* @__PURE__ */
|
|
4648
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "ui-react-app__menu", ref: menuBody, children: [
|
|
4646
4649
|
bandControl && /* @__PURE__ */ jsx39("div", { className: "ui-react-app__control", children: bandControl }),
|
|
4647
4650
|
sidebar("Menu sections")
|
|
4648
4651
|
] })
|
|
@@ -4654,9 +4657,9 @@ function AppShell({
|
|
|
4654
4657
|
|
|
4655
4658
|
// src/AuthShell.tsx
|
|
4656
4659
|
import { forwardRef as forwardRef10 } from "react";
|
|
4657
|
-
import { jsx as jsx40, jsxs as
|
|
4660
|
+
import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4658
4661
|
var AuthShell = forwardRef10(function AuthShell2({ brand, children, className, ...rest }, ref) {
|
|
4659
|
-
return /* @__PURE__ */ jsx40("div", { ...rest, ref, className: ["ui-auth", className].filter(Boolean).join(" "), children: /* @__PURE__ */
|
|
4662
|
+
return /* @__PURE__ */ jsx40("div", { ...rest, ref, className: ["ui-auth", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs36("div", { className: "ui-auth__card", children: [
|
|
4660
4663
|
/* @__PURE__ */ jsx40("div", { className: "ui-auth__brand", children: brand }),
|
|
4661
4664
|
children
|
|
4662
4665
|
] }) });
|
|
@@ -4665,7 +4668,7 @@ var AuthShell = forwardRef10(function AuthShell2({ brand, children, className, .
|
|
|
4665
4668
|
// src/Footer.tsx
|
|
4666
4669
|
import { useId as useId13 } from "react";
|
|
4667
4670
|
import { prism as prism2, safeUrl as safeUrl3 } from "@apliteni/apliteni-ui";
|
|
4668
|
-
import { jsx as jsx41, jsxs as
|
|
4671
|
+
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4669
4672
|
var SOCIAL_GLYPHS = {
|
|
4670
4673
|
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"/>',
|
|
4671
4674
|
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"/>',
|
|
@@ -4674,7 +4677,7 @@ var SOCIAL_GLYPHS = {
|
|
|
4674
4677
|
};
|
|
4675
4678
|
var escapeText = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4676
4679
|
function Legal({ legal, legalLinks, switcher }) {
|
|
4677
|
-
return /* @__PURE__ */
|
|
4680
|
+
return /* @__PURE__ */ jsxs37("div", { className: "ui-footer__bar", children: [
|
|
4678
4681
|
/* @__PURE__ */ jsx41("span", { className: "ui-footer__legal", children: legal }),
|
|
4679
4682
|
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx41("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx41("a", { href: safeUrl3(to ?? "#"), children: label }, label)) }),
|
|
4680
4683
|
switcher ? /* @__PURE__ */ jsx41("div", { className: "ui-footer__switcher", children: switcher }) : null
|
|
@@ -4711,9 +4714,9 @@ function Footer({
|
|
|
4711
4714
|
dangerouslySetInnerHTML: { __html: `${mark}<span>${escapeText(word)}</span>` }
|
|
4712
4715
|
}
|
|
4713
4716
|
);
|
|
4714
|
-
return /* @__PURE__ */ jsx41("footer", { ...rest, className: cls, role: "contentinfo", children: /* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
brand !== false && /* @__PURE__ */
|
|
4717
|
+
return /* @__PURE__ */ jsx41("footer", { ...rest, className: cls, role: "contentinfo", children: /* @__PURE__ */ jsxs37("div", { className: "ui-footer__in", children: [
|
|
4718
|
+
/* @__PURE__ */ jsxs37("div", { className: "ui-footer__top", children: [
|
|
4719
|
+
brand !== false && /* @__PURE__ */ jsxs37("div", { className: "ui-footer__brand", children: [
|
|
4717
4720
|
lockup,
|
|
4718
4721
|
tagline && /* @__PURE__ */ jsx41("p", { className: "ui-footer__tagline", children: tagline }),
|
|
4719
4722
|
social.length > 0 && /* @__PURE__ */ jsx41("div", { className: "ui-footer__socials", children: social.map(({ label, href: to, icon: icon9 = "github" }) => {
|
|
@@ -4723,7 +4726,7 @@ function Footer({
|
|
|
4723
4726
|
return /* @__PURE__ */ jsx41("a", { className: "ui-footer__social", href: safeUrl3(to ?? "#"), "aria-label": label, children: /* @__PURE__ */ jsx41("svg", { viewBox, fill, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: markup } }) }, label);
|
|
4724
4727
|
}) })
|
|
4725
4728
|
] }),
|
|
4726
|
-
(links || columns.length > 0) && /* @__PURE__ */ jsx41("nav", { className: "ui-footer__nav", "aria-label": "Footer", children: links ?? columns.map(({ title, links: columnLinks }, i) => /* @__PURE__ */
|
|
4729
|
+
(links || columns.length > 0) && /* @__PURE__ */ jsx41("nav", { className: "ui-footer__nav", "aria-label": "Footer", children: links ?? columns.map(({ title, links: columnLinks }, i) => /* @__PURE__ */ jsxs37("div", { className: "ui-footer__col", children: [
|
|
4727
4730
|
title && /* @__PURE__ */ jsx41("h2", { className: "ui-footer__col-title", children: title }),
|
|
4728
4731
|
/* @__PURE__ */ jsx41("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx41("li", { children: /* @__PURE__ */ jsx41("a", { href: safeUrl3(to ?? "#"), target, rel: target ? "noreferrer" : void 0, children: label }) }, label)) })
|
|
4729
4732
|
] }, title ?? i)) })
|
|
@@ -4734,10 +4737,10 @@ function Footer({
|
|
|
4734
4737
|
|
|
4735
4738
|
// src/Success.tsx
|
|
4736
4739
|
import { forwardRef as forwardRef11, useEffect as useEffect16, useRef as useRef21, useState as useState17 } from "react";
|
|
4737
|
-
import { jsx as jsx42, jsxs as
|
|
4740
|
+
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4738
4741
|
var SuccessCheck = forwardRef11(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
4739
4742
|
const circled = variant === "circled";
|
|
4740
|
-
return /* @__PURE__ */
|
|
4743
|
+
return /* @__PURE__ */ jsxs38(
|
|
4741
4744
|
"svg",
|
|
4742
4745
|
{
|
|
4743
4746
|
...rest,
|
|
@@ -4757,7 +4760,7 @@ var SuccessCheck = forwardRef11(function SuccessCheck2({ variant = "line", class
|
|
|
4757
4760
|
});
|
|
4758
4761
|
var SuccessPanel = forwardRef11(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
4759
4762
|
const circled = check === "circled";
|
|
4760
|
-
return /* @__PURE__ */
|
|
4763
|
+
return /* @__PURE__ */ jsxs38("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
4761
4764
|
/* @__PURE__ */ jsx42("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx42(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
4762
4765
|
/* @__PURE__ */ jsx42("div", { className: "ui-success__title", children: title }),
|
|
4763
4766
|
sub && /* @__PURE__ */ jsx42("div", { className: "ui-success__sub", children: sub })
|
|
@@ -4797,9 +4800,9 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
4797
4800
|
}, 1e3);
|
|
4798
4801
|
return () => clearInterval(timer);
|
|
4799
4802
|
}, [seconds]);
|
|
4800
|
-
return /* @__PURE__ */
|
|
4803
|
+
return /* @__PURE__ */ jsxs38("div", { className: "ui-sx__count", "data-sx-count": "", style: { "--sx-secs": `${seconds}s` }, children: [
|
|
4801
4804
|
/* @__PURE__ */ jsx42("span", { className: "ui-sx__count-ring", "aria-hidden": "true" }),
|
|
4802
|
-
/* @__PURE__ */
|
|
4805
|
+
/* @__PURE__ */ jsxs38("span", { className: "ui-sx__count-text", children: [
|
|
4803
4806
|
label,
|
|
4804
4807
|
" in ",
|
|
4805
4808
|
/* @__PURE__ */ jsx42("b", { "data-sx-num": "", children: remaining }),
|
|
@@ -4829,7 +4832,7 @@ var Success = forwardRef11(function Success2({
|
|
|
4829
4832
|
const seconds = countdown?.seconds;
|
|
4830
4833
|
const duration = seconds != null && Number.isFinite(seconds) && seconds >= 1 ? Math.floor(seconds) : 5;
|
|
4831
4834
|
const mark = check === "circled" ? "circled" : "line";
|
|
4832
|
-
return /* @__PURE__ */
|
|
4835
|
+
return /* @__PURE__ */ jsxs38(
|
|
4833
4836
|
"div",
|
|
4834
4837
|
{
|
|
4835
4838
|
role: "status",
|
|
@@ -4841,9 +4844,9 @@ var Success = forwardRef11(function Success2({
|
|
|
4841
4844
|
confetti && /* @__PURE__ */ jsx42("div", { className: "ui-sx__confetti", "aria-hidden": "true", children: pieces.map(
|
|
4842
4845
|
([x, d, r, t, s], index) => /* @__PURE__ */ jsx42("i", { className: `ui-sx__piece ui-sx__piece--${t}`, style: { left: `${x}%`, "--sx-d": `${d}s`, "--sx-r": `${r}deg`, "--sx-s": s } }, index)
|
|
4843
4846
|
) }),
|
|
4844
|
-
/* @__PURE__ */
|
|
4847
|
+
/* @__PURE__ */ jsxs38("div", { className: "ui-sx__inner", children: [
|
|
4845
4848
|
/* @__PURE__ */ jsx42("div", { className: "ui-sx__visual", children: /* @__PURE__ */ jsx42(SuccessCheck, { variant: mark }) }),
|
|
4846
|
-
/* @__PURE__ */
|
|
4849
|
+
/* @__PURE__ */ jsxs38("div", { className: "ui-sx__content", children: [
|
|
4847
4850
|
/* @__PURE__ */ jsx42(Heading, { className: "ui-sx__title", children: title }),
|
|
4848
4851
|
body && /* @__PURE__ */ jsx42("p", { className: "ui-sx__body", children: body }),
|
|
4849
4852
|
hasActions && /* @__PURE__ */ jsx42("div", { className: "ui-sx__actions", children: actions }),
|
|
@@ -4866,8 +4869,447 @@ import {
|
|
|
4866
4869
|
useState as useState18
|
|
4867
4870
|
} from "react";
|
|
4868
4871
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
4869
|
-
|
|
4870
|
-
|
|
4872
|
+
|
|
4873
|
+
// src/chart-looks.tsx
|
|
4874
|
+
import { Fragment as Fragment17, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4875
|
+
var LOOK_DEFAULT = {
|
|
4876
|
+
line: "thin",
|
|
4877
|
+
area: "stacked",
|
|
4878
|
+
stacked: "columns",
|
|
4879
|
+
donut: "table"
|
|
4880
|
+
};
|
|
4881
|
+
var TONE_CYCLE = ["accent", "accent-soft", "info", "warn", "good", "bad", "neutral"];
|
|
4882
|
+
var pct = (share) => `${Math.round(share * 100)}%`;
|
|
4883
|
+
var px = (n) => Math.round(n * 10) / 10;
|
|
4884
|
+
var cx8 = (...parts) => parts.filter(Boolean).join(" ");
|
|
4885
|
+
var tone = (t) => `ui-chart__tone--${t}`;
|
|
4886
|
+
var MISSING = "\u2014";
|
|
4887
|
+
var ROW_BAR = 12;
|
|
4888
|
+
var ROW_LEFT = 36;
|
|
4889
|
+
var ROW_RIGHT = 64;
|
|
4890
|
+
var ROW_FOOT = 24;
|
|
4891
|
+
var RING = {
|
|
4892
|
+
thin: { size: 216, thick: 12 },
|
|
4893
|
+
table: { size: 200, thick: 44 },
|
|
4894
|
+
labels: { size: 264, thick: 24, width: 470, radius: 104, room: 90 }
|
|
4895
|
+
};
|
|
4896
|
+
var END_LABEL = { rise: 10, ascent: 10, drop: 20, gap: 4 };
|
|
4897
|
+
var STACK_BAR = { columns: 12, share: 20 };
|
|
4898
|
+
function arc(x, y, r0, r1, a0, a1) {
|
|
4899
|
+
const p = (r, a) => `${px(x + r * Math.cos(a))} ${px(y + r * Math.sin(a))}`;
|
|
4900
|
+
if (a1 - a0 >= Math.PI * 2 - 1e-9) {
|
|
4901
|
+
const h = a0 + Math.PI;
|
|
4902
|
+
const circle = (r, sweep) => `M${p(r, a0)} A${px(r)} ${px(r)} 0 0 ${sweep} ${p(r, h)} A${px(r)} ${px(r)} 0 0 ${sweep} ${p(r, a0)} Z`;
|
|
4903
|
+
return r0 > 0 ? `${circle(r1, 1)} ${circle(r0, 0)}` : circle(r1, 1);
|
|
4904
|
+
}
|
|
4905
|
+
const large = a1 - a0 > Math.PI ? 1 : 0;
|
|
4906
|
+
return `M${p(r1, a0)} A${px(r1)} ${px(r1)} 0 ${large} 1 ${p(r1, a1)} L${p(r0, a1)} A${px(r0)} ${px(r0)} 0 ${large} 0 ${p(r0, a0)} Z`;
|
|
4907
|
+
}
|
|
4908
|
+
var angle = (share) => -Math.PI / 2 + share * Math.PI * 2;
|
|
4909
|
+
function topRounded(x, y, w, h, r) {
|
|
4910
|
+
const k = Math.min(r, h, w / 2);
|
|
4911
|
+
return `M${px(x)} ${px(y + h)}V${px(y + k)}A${px(k)} ${px(k)} 0 0 1 ${px(x + k)} ${px(y)}H${px(x + w - k)}A${px(k)} ${px(k)} 0 0 1 ${px(x + w)} ${px(y + k)}V${px(y + h)}Z`;
|
|
4912
|
+
}
|
|
4913
|
+
function rightRounded(x, y, w, h, r) {
|
|
4914
|
+
const k = Math.min(r, w, h / 2);
|
|
4915
|
+
return `M${px(x)} ${px(y)}H${px(x + w - k)}A${px(k)} ${px(k)} 0 0 1 ${px(x + w)} ${px(y + k)}V${px(y + h - k)}A${px(k)} ${px(k)} 0 0 1 ${px(x + w - k)} ${px(y + h)}H${px(x)}Z`;
|
|
4916
|
+
}
|
|
4917
|
+
var square = (x, y, w, h) => `M${px(x)} ${px(y)}h${px(w)}v${px(h)}h${px(-w)}Z`;
|
|
4918
|
+
var keyShape = (look) => look.variant === "line" || look.variant === "area" && look.look === "flat" ? "line" : "fill";
|
|
4919
|
+
function columnRows(g, i) {
|
|
4920
|
+
const { look, format } = g;
|
|
4921
|
+
const shape = keyShape(look);
|
|
4922
|
+
const rows = look.layers.map((layer) => ({
|
|
4923
|
+
name: layer.name,
|
|
4924
|
+
tone: layer.tone,
|
|
4925
|
+
shape,
|
|
4926
|
+
text: look.share ? pct(layer.to[i] - layer.from[i]) : Number.isFinite(layer.values[i]) ? format(layer.values[i]) : MISSING
|
|
4927
|
+
}));
|
|
4928
|
+
return look.stacked ? rows.reverse() : rows;
|
|
4929
|
+
}
|
|
4930
|
+
function lookBox(g) {
|
|
4931
|
+
const { look, plotWidth, floor, target } = g;
|
|
4932
|
+
if (look.layout === "rows") {
|
|
4933
|
+
const row = Math.max(target, floor);
|
|
4934
|
+
return { w: plotWidth, h: row * g.labels.length + ROW_FOOT, row };
|
|
4935
|
+
}
|
|
4936
|
+
if (look.layout === "ring") {
|
|
4937
|
+
const ring = RING[look.look];
|
|
4938
|
+
if (!("width" in ring)) return { w: ring.size, h: ring.size, row: 0 };
|
|
4939
|
+
const w = Math.min(plotWidth, ring.width);
|
|
4940
|
+
return { w, h: ring.size - 2 * (ring.radius - labelsRadius(w)), row: 0 };
|
|
4941
|
+
}
|
|
4942
|
+
return null;
|
|
4943
|
+
}
|
|
4944
|
+
var labelsRadius = (w) => Math.max(RING.labels.thick * 2, Math.min(RING.labels.radius, w / 2 - RING.labels.room));
|
|
4945
|
+
function ringOf(g) {
|
|
4946
|
+
const look = g.look.look;
|
|
4947
|
+
const box = lookBox(g);
|
|
4948
|
+
const spec = RING[look];
|
|
4949
|
+
const r = "radius" in spec ? labelsRadius(box.w) : spec.size / 2 - g.pad;
|
|
4950
|
+
return { x: box.w / 2, y: box.h / 2, r, thick: spec.thick };
|
|
4951
|
+
}
|
|
4952
|
+
function rowsOf(g) {
|
|
4953
|
+
const box = lookBox(g);
|
|
4954
|
+
const span = g.scale.max - g.scale.min || 1;
|
|
4955
|
+
const x = (v) => ROW_LEFT + (box.w - ROW_LEFT - ROW_RIGHT) * ((v - g.scale.min) / span);
|
|
4956
|
+
return { ...box, x, top: (i) => i * box.row + (box.row - ROW_BAR) / 2 };
|
|
4957
|
+
}
|
|
4958
|
+
function lookMarks(g) {
|
|
4959
|
+
const { look, format, colWidth, plotHeight, pad: pad2, floor } = g;
|
|
4960
|
+
const base = { lane: 0, lanes: 1, band: "full", foot: null, detail: "" };
|
|
4961
|
+
if (look.layout === "ring") {
|
|
4962
|
+
const ring = ringOf(g);
|
|
4963
|
+
const total = look.totals[0];
|
|
4964
|
+
return look.layers.map((slice, i) => {
|
|
4965
|
+
const mid = angle((slice.from[0] + slice.to[0]) / 2);
|
|
4966
|
+
const reach = Math.max(ring.thick, floor);
|
|
4967
|
+
return {
|
|
4968
|
+
...base,
|
|
4969
|
+
id: slice.id,
|
|
4970
|
+
column: i,
|
|
4971
|
+
name: slice.name,
|
|
4972
|
+
tone: slice.tone,
|
|
4973
|
+
kind: "slice",
|
|
4974
|
+
value: slice.values[0],
|
|
4975
|
+
detail: total > 0 ? `${pct(slice.to[0] - slice.from[0])} of ${format(total)}` : "",
|
|
4976
|
+
x: ring.x + ring.r * Math.cos(mid) - 2,
|
|
4977
|
+
y: ring.y + ring.r * Math.sin(mid),
|
|
4978
|
+
w: 4,
|
|
4979
|
+
h: 0,
|
|
4980
|
+
hitPath: slice.to[0] > slice.from[0] ? arc(ring.x, ring.y, Math.max(0, ring.r - reach), ring.r, angle(slice.from[0]), angle(slice.to[0])) : void 0,
|
|
4981
|
+
estimated: false
|
|
4982
|
+
};
|
|
4983
|
+
});
|
|
4984
|
+
}
|
|
4985
|
+
const name = look.layers[0]?.name ?? "";
|
|
4986
|
+
if (look.layout === "rows") {
|
|
4987
|
+
const rows = rowsOf(g);
|
|
4988
|
+
return g.labels.map((label, i) => {
|
|
4989
|
+
const end = rows.x(look.totals[i]);
|
|
4990
|
+
return {
|
|
4991
|
+
...base,
|
|
4992
|
+
id: `row-${i}`,
|
|
4993
|
+
column: i,
|
|
4994
|
+
name,
|
|
4995
|
+
tone: look.layers[0]?.tone ?? "neutral",
|
|
4996
|
+
kind: "column",
|
|
4997
|
+
value: look.totals[i],
|
|
4998
|
+
rows: columnRows(g, i),
|
|
4999
|
+
total: format(look.totals[i]),
|
|
5000
|
+
x: end - 2,
|
|
5001
|
+
y: rows.top(i),
|
|
5002
|
+
w: 4,
|
|
5003
|
+
h: ROW_BAR,
|
|
5004
|
+
hit: { x: 0, y: i * rows.row, w: rows.w, h: rows.row },
|
|
5005
|
+
estimated: label.estimated
|
|
5006
|
+
};
|
|
5007
|
+
});
|
|
5008
|
+
}
|
|
5009
|
+
const lift = look.variant === "line" && look.look === "points" ? 6 : look.variant === "stacked" ? 2 : 4;
|
|
5010
|
+
return g.labels.map((label, i) => {
|
|
5011
|
+
const tops = look.layers.map((l) => l.to[i]).filter(Number.isFinite);
|
|
5012
|
+
const top = tops.length ? Math.max(...tops) : g.scale.min;
|
|
5013
|
+
const first = look.layers.map((l) => l.values[i]).find(Number.isFinite) ?? Number.NaN;
|
|
5014
|
+
return {
|
|
5015
|
+
...base,
|
|
5016
|
+
id: `column-${i}`,
|
|
5017
|
+
column: i,
|
|
5018
|
+
name,
|
|
5019
|
+
tone: look.layers[0]?.tone ?? "neutral",
|
|
5020
|
+
kind: "column",
|
|
5021
|
+
value: look.stacked ? look.totals[i] : first,
|
|
5022
|
+
rows: columnRows(g, i),
|
|
5023
|
+
total: look.stacked ? format(look.totals[i]) : void 0,
|
|
5024
|
+
x: g.centre(i) - 2,
|
|
5025
|
+
y: g.y(top) - lift,
|
|
5026
|
+
w: 4,
|
|
5027
|
+
h: 0,
|
|
5028
|
+
hit: { x: i * colWidth, y: pad2, w: colWidth, h: Math.max(plotHeight - pad2 * 2, g.target) },
|
|
5029
|
+
estimated: label.estimated
|
|
5030
|
+
};
|
|
5031
|
+
});
|
|
5032
|
+
}
|
|
5033
|
+
function lookDrawing(g, open, pick) {
|
|
5034
|
+
const { look } = g;
|
|
5035
|
+
if (look.layout === "ring") return ringDrawing(g);
|
|
5036
|
+
if (look.layout === "rows") return rowsDrawing(g, pick);
|
|
5037
|
+
return look.variant === "stacked" ? columnsDrawing(g) : linesDrawing(g, open);
|
|
5038
|
+
}
|
|
5039
|
+
function linesDrawing(g, open) {
|
|
5040
|
+
const { look, labels, y, centre, pad: pad2, plotHeight, format } = g;
|
|
5041
|
+
const n = labels.length;
|
|
5042
|
+
const area = look.variant === "area";
|
|
5043
|
+
const finite = (layer, i) => Number.isFinite(look.stacked ? layer.to[i] : layer.values[i]);
|
|
5044
|
+
const at = (layer, i) => look.stacked ? layer.to[i] : layer.values[i];
|
|
5045
|
+
const ramps = area && !look.share ? look.layers.map((layer) => {
|
|
5046
|
+
const tops = layer.values.map((_, i) => at(layer, i)).filter(Number.isFinite);
|
|
5047
|
+
const lo = Math.min(...tops);
|
|
5048
|
+
const hi = Math.max(...tops);
|
|
5049
|
+
return tops.length && y(lo) - y(hi) >= 1 ? { id: `${g.uid}-ramp-${layer.id}`, layer, lo, hi } : null;
|
|
5050
|
+
}) : [];
|
|
5051
|
+
const fills = area && look.layers.map((layer, k) => {
|
|
5052
|
+
const up = layer.to.map((v, i) => `${i ? "L" : "M"}${px(centre(i))} ${px(y(Number.isFinite(v) ? v : layer.from[i]))}`);
|
|
5053
|
+
const down = layer.from.map((v, i) => `L${px(centre(i))} ${px(y(v))}`).reverse();
|
|
5054
|
+
const ramp = ramps[k];
|
|
5055
|
+
return /* @__PURE__ */ jsx43(
|
|
5056
|
+
"path",
|
|
5057
|
+
{
|
|
5058
|
+
className: cx8(look.share ? "ui-chart__segment" : "ui-chart__area", tone(layer.tone)),
|
|
5059
|
+
style: ramp ? { "--ui-chart-paint": `url(#${ramp.id})` } : void 0,
|
|
5060
|
+
d: `${up.join("")}${down.join("")}Z`
|
|
5061
|
+
},
|
|
5062
|
+
`fill-${layer.id}`
|
|
5063
|
+
);
|
|
5064
|
+
});
|
|
5065
|
+
const edges = !look.share && look.layers.flatMap((layer) => layer.to.slice(1).map((_, k) => finite(layer, k) && finite(layer, k + 1) ? /* @__PURE__ */ jsx43(
|
|
5066
|
+
"line",
|
|
5067
|
+
{
|
|
5068
|
+
className: cx8(
|
|
5069
|
+
"ui-chart__line",
|
|
5070
|
+
tone(layer.tone),
|
|
5071
|
+
(labels[k]?.estimated || labels[k + 1]?.estimated) && "is-estimated"
|
|
5072
|
+
),
|
|
5073
|
+
x1: px(centre(k)),
|
|
5074
|
+
y1: px(y(at(layer, k))),
|
|
5075
|
+
x2: px(centre(k + 1)),
|
|
5076
|
+
y2: px(y(at(layer, k + 1)))
|
|
5077
|
+
},
|
|
5078
|
+
`edge-${layer.id}-${k}`
|
|
5079
|
+
) : null));
|
|
5080
|
+
const points = look.variant === "line" && look.look === "points";
|
|
5081
|
+
const dots = look.layers.flatMap((layer) => layer.to.map((_, i) => {
|
|
5082
|
+
if (!finite(layer, i)) return null;
|
|
5083
|
+
const lonely = !finite(layer, i - 1) && !finite(layer, i + 1);
|
|
5084
|
+
const shown = i === open || points || lonely && !look.share;
|
|
5085
|
+
if (!shown || look.share && i !== open) return null;
|
|
5086
|
+
if (look.share && layer !== look.layers[look.layers.length - 1]) return null;
|
|
5087
|
+
return /* @__PURE__ */ jsx43(
|
|
5088
|
+
"circle",
|
|
5089
|
+
{
|
|
5090
|
+
className: cx8("ui-chart__dot", tone(layer.tone)),
|
|
5091
|
+
cx: px(centre(i)),
|
|
5092
|
+
cy: px(y(at(layer, i))),
|
|
5093
|
+
r: points && i === open ? 5.5 : 4
|
|
5094
|
+
},
|
|
5095
|
+
`dot-${layer.id}-${i}`
|
|
5096
|
+
);
|
|
5097
|
+
}));
|
|
5098
|
+
const ends = look.variant === "line" && look.look === "labels" && look.layers.map((layer) => {
|
|
5099
|
+
const last = [...Array(n).keys()].reverse().find((i) => finite(layer, i));
|
|
5100
|
+
if (last === void 0) return null;
|
|
5101
|
+
const at2 = y(layer.values[last]);
|
|
5102
|
+
const { rise, ascent, drop, gap } = END_LABEL;
|
|
5103
|
+
let x = centre(last) + 4;
|
|
5104
|
+
let base = at2 - rise;
|
|
5105
|
+
if (base - ascent < 0) {
|
|
5106
|
+
const prev = finite(layer, last - 1) ? last - 1 : last;
|
|
5107
|
+
const fall = Math.max(0, y(layer.values[prev]) - at2);
|
|
5108
|
+
if (fall >= ascent + gap) {
|
|
5109
|
+
base = at2 + ascent;
|
|
5110
|
+
x = centre(last) - Math.max(8, (ascent + gap) * (centre(last) - centre(prev)) / fall);
|
|
5111
|
+
} else {
|
|
5112
|
+
base = at2 + Math.max(drop, fall + gap + ascent);
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
return /* @__PURE__ */ jsxs39("g", { children: [
|
|
5116
|
+
/* @__PURE__ */ jsx43(
|
|
5117
|
+
"circle",
|
|
5118
|
+
{
|
|
5119
|
+
className: cx8("ui-chart__dot", tone(layer.tone)),
|
|
5120
|
+
cx: px(centre(last)),
|
|
5121
|
+
cy: px(at2),
|
|
5122
|
+
r: "4"
|
|
5123
|
+
}
|
|
5124
|
+
),
|
|
5125
|
+
/* @__PURE__ */ jsx43(
|
|
5126
|
+
"text",
|
|
5127
|
+
{
|
|
5128
|
+
className: "ui-chart__text ui-chart__text--strong",
|
|
5129
|
+
textAnchor: "end",
|
|
5130
|
+
x: px(x),
|
|
5131
|
+
y: px(base),
|
|
5132
|
+
children: format(layer.values[last])
|
|
5133
|
+
}
|
|
5134
|
+
)
|
|
5135
|
+
] }, `end-${layer.id}`);
|
|
5136
|
+
});
|
|
5137
|
+
return /* @__PURE__ */ jsxs39(Fragment17, { children: [
|
|
5138
|
+
ramps.some(Boolean) && /* @__PURE__ */ jsx43("defs", { children: ramps.map((ramp) => ramp && /* @__PURE__ */ jsxs39(
|
|
5139
|
+
"linearGradient",
|
|
5140
|
+
{
|
|
5141
|
+
id: ramp.id,
|
|
5142
|
+
className: tone(ramp.layer.tone),
|
|
5143
|
+
gradientUnits: "userSpaceOnUse",
|
|
5144
|
+
x1: "0",
|
|
5145
|
+
x2: "0",
|
|
5146
|
+
y1: px(y(ramp.lo)),
|
|
5147
|
+
y2: px(y(ramp.hi)),
|
|
5148
|
+
children: [
|
|
5149
|
+
/* @__PURE__ */ jsx43("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
5150
|
+
/* @__PURE__ */ jsx43("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
5151
|
+
]
|
|
5152
|
+
},
|
|
5153
|
+
ramp.id
|
|
5154
|
+
)) }),
|
|
5155
|
+
fills,
|
|
5156
|
+
open !== null && /* @__PURE__ */ jsx43(
|
|
5157
|
+
"line",
|
|
5158
|
+
{
|
|
5159
|
+
className: "ui-chart__cross",
|
|
5160
|
+
x1: px(centre(open)),
|
|
5161
|
+
x2: px(centre(open)),
|
|
5162
|
+
y1: pad2,
|
|
5163
|
+
y2: px(plotHeight - pad2)
|
|
5164
|
+
}
|
|
5165
|
+
),
|
|
5166
|
+
edges,
|
|
5167
|
+
ends,
|
|
5168
|
+
dots
|
|
5169
|
+
] });
|
|
5170
|
+
}
|
|
5171
|
+
function columnsDrawing(g) {
|
|
5172
|
+
const { look, labels, y, centre, colWidth } = g;
|
|
5173
|
+
const w = Math.min(STACK_BAR[look.look], Math.max(4, colWidth - 6));
|
|
5174
|
+
return labels.flatMap((label, i) => {
|
|
5175
|
+
const filled = look.layers.filter((l) => l.to[i] > l.from[i]);
|
|
5176
|
+
return filled.map((layer) => {
|
|
5177
|
+
const y0 = y(layer.from[i]);
|
|
5178
|
+
const y1 = y(layer.to[i]);
|
|
5179
|
+
const x = centre(i) - w / 2;
|
|
5180
|
+
const d = layer === filled[filled.length - 1] ? topRounded(x, y1, w, y0 - y1, 4) : square(x, y1, w, y0 - y1);
|
|
5181
|
+
return /* @__PURE__ */ jsx43(
|
|
5182
|
+
"path",
|
|
5183
|
+
{
|
|
5184
|
+
className: cx8("ui-chart__segment", tone(layer.tone), label.estimated && "is-estimated"),
|
|
5185
|
+
d
|
|
5186
|
+
},
|
|
5187
|
+
`seg-${layer.id}-${i}`
|
|
5188
|
+
);
|
|
5189
|
+
});
|
|
5190
|
+
});
|
|
5191
|
+
}
|
|
5192
|
+
function rowsDrawing(g, pick) {
|
|
5193
|
+
const { look, labels, format, formatAxis, scale } = g;
|
|
5194
|
+
const rows = rowsOf(g);
|
|
5195
|
+
const bottom = rows.row * labels.length;
|
|
5196
|
+
return /* @__PURE__ */ jsxs39(Fragment17, { children: [
|
|
5197
|
+
pick !== null && pick >= 0 && pick < labels.length && /* @__PURE__ */ jsx43("rect", { className: "ui-chart__band", x: "0", width: px(rows.w), y: px(pick * rows.row), height: px(rows.row) }),
|
|
5198
|
+
scale.ticks.map((tick) => /* @__PURE__ */ jsxs39("g", { children: [
|
|
5199
|
+
/* @__PURE__ */ jsx43(
|
|
5200
|
+
"line",
|
|
5201
|
+
{
|
|
5202
|
+
className: tick === 0 ? "ui-chart__zero" : "ui-chart__grid",
|
|
5203
|
+
x1: px(rows.x(tick)),
|
|
5204
|
+
x2: px(rows.x(tick)),
|
|
5205
|
+
y1: "0",
|
|
5206
|
+
y2: px(bottom)
|
|
5207
|
+
}
|
|
5208
|
+
),
|
|
5209
|
+
/* @__PURE__ */ jsx43(
|
|
5210
|
+
"text",
|
|
5211
|
+
{
|
|
5212
|
+
className: "ui-chart__caption",
|
|
5213
|
+
textAnchor: "middle",
|
|
5214
|
+
"aria-hidden": "true",
|
|
5215
|
+
x: px(rows.x(tick)),
|
|
5216
|
+
y: px(bottom + 16),
|
|
5217
|
+
children: formatAxis(tick)
|
|
5218
|
+
}
|
|
5219
|
+
)
|
|
5220
|
+
] }, `tick-${tick}`)),
|
|
5221
|
+
labels.map((label, i) => {
|
|
5222
|
+
const top = rows.top(i);
|
|
5223
|
+
const filled = look.layers.filter((l) => l.to[i] > l.from[i]);
|
|
5224
|
+
return /* @__PURE__ */ jsxs39("g", { children: [
|
|
5225
|
+
/* @__PURE__ */ jsx43(
|
|
5226
|
+
"text",
|
|
5227
|
+
{
|
|
5228
|
+
className: "ui-chart__caption",
|
|
5229
|
+
textAnchor: "end",
|
|
5230
|
+
"aria-hidden": "true",
|
|
5231
|
+
x: ROW_LEFT - 8,
|
|
5232
|
+
y: px(top + ROW_BAR - 2),
|
|
5233
|
+
children: label.short
|
|
5234
|
+
}
|
|
5235
|
+
),
|
|
5236
|
+
filled.map((layer) => {
|
|
5237
|
+
const x0 = rows.x(layer.from[i]);
|
|
5238
|
+
const x1 = rows.x(layer.to[i]);
|
|
5239
|
+
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__ */ jsx43(
|
|
5241
|
+
"path",
|
|
5242
|
+
{
|
|
5243
|
+
d,
|
|
5244
|
+
className: cx8("ui-chart__segment", tone(layer.tone), label.estimated && "is-estimated")
|
|
5245
|
+
},
|
|
5246
|
+
`seg-${layer.id}`
|
|
5247
|
+
);
|
|
5248
|
+
}),
|
|
5249
|
+
/* @__PURE__ */ jsx43(
|
|
5250
|
+
"text",
|
|
5251
|
+
{
|
|
5252
|
+
className: "ui-chart__text",
|
|
5253
|
+
"aria-hidden": "true",
|
|
5254
|
+
x: px(rows.x(look.totals[i]) + 6),
|
|
5255
|
+
y: px(top + ROW_BAR - 2),
|
|
5256
|
+
children: format(look.totals[i])
|
|
5257
|
+
}
|
|
5258
|
+
)
|
|
5259
|
+
] }, `row-${i}`);
|
|
5260
|
+
})
|
|
5261
|
+
] });
|
|
5262
|
+
}
|
|
5263
|
+
function ringDrawing(g) {
|
|
5264
|
+
const { look, format } = g;
|
|
5265
|
+
const ring = ringOf(g);
|
|
5266
|
+
const total = look.totals[0];
|
|
5267
|
+
return /* @__PURE__ */ jsxs39(Fragment17, { children: [
|
|
5268
|
+
look.layers.filter((s) => s.to[0] > s.from[0]).map((slice) => /* @__PURE__ */ jsx43(
|
|
5269
|
+
"path",
|
|
5270
|
+
{
|
|
5271
|
+
className: cx8("ui-chart__segment", tone(slice.tone)),
|
|
5272
|
+
d: arc(ring.x, ring.y, ring.r - ring.thick, ring.r, angle(slice.from[0]), angle(slice.to[0]))
|
|
5273
|
+
},
|
|
5274
|
+
`slice-${slice.id}`
|
|
5275
|
+
)),
|
|
5276
|
+
look.look === "thin" && /* @__PURE__ */ jsxs39("g", { "aria-hidden": "true", children: [
|
|
5277
|
+
/* @__PURE__ */ jsx43("text", { className: "ui-chart__total", textAnchor: "middle", x: px(ring.x), y: px(ring.y + 2), children: format(total) }),
|
|
5278
|
+
/* @__PURE__ */ jsx43("text", { className: "ui-chart__caption", textAnchor: "middle", x: px(ring.x), y: px(ring.y + 22), children: look.totalLabel })
|
|
5279
|
+
] }),
|
|
5280
|
+
look.look === "labels" && look.layers.filter((s) => s.to[0] > s.from[0]).map((slice) => {
|
|
5281
|
+
const mid = angle((slice.from[0] + slice.to[0]) / 2);
|
|
5282
|
+
const x = ring.x + (ring.r + 14) * Math.cos(mid);
|
|
5283
|
+
const y = ring.y + (ring.r + 14) * Math.sin(mid);
|
|
5284
|
+
const anchor = Math.cos(mid) >= 0 ? "start" : "end";
|
|
5285
|
+
return /* @__PURE__ */ jsxs39("g", { "aria-hidden": "true", children: [
|
|
5286
|
+
/* @__PURE__ */ jsx43("text", { className: "ui-chart__text ui-chart__text--strong", textAnchor: anchor, x: px(x), y: px(y - 2), children: slice.name }),
|
|
5287
|
+
/* @__PURE__ */ jsx43("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
|
+
] }, `label-${slice.id}`);
|
|
5289
|
+
})
|
|
5290
|
+
] });
|
|
5291
|
+
}
|
|
5292
|
+
function Shares({ look, format, swatch }) {
|
|
5293
|
+
const total = look.totals[0];
|
|
5294
|
+
return /* @__PURE__ */ jsxs39("ul", { className: "ui-chart__shares", "aria-hidden": "true", children: [
|
|
5295
|
+
look.layers.map((slice) => /* @__PURE__ */ jsxs39("li", { className: tone(slice.tone), children: [
|
|
5296
|
+
swatch,
|
|
5297
|
+
/* @__PURE__ */ jsx43("span", { children: slice.name }),
|
|
5298
|
+
/* @__PURE__ */ jsx43("span", { className: "ui-chart__shares-value", children: format(slice.values[0]) }),
|
|
5299
|
+
/* @__PURE__ */ jsx43("span", { className: "ui-chart__shares-pct", children: total > 0 ? pct(slice.to[0] - slice.from[0]) : MISSING })
|
|
5300
|
+
] }, slice.id)),
|
|
5301
|
+
/* @__PURE__ */ jsxs39("li", { className: "ui-chart__shares-total", children: [
|
|
5302
|
+
/* @__PURE__ */ jsx43("span", {}),
|
|
5303
|
+
/* @__PURE__ */ jsx43("span", { children: look.totalLabel }),
|
|
5304
|
+
/* @__PURE__ */ jsx43("span", { className: "ui-chart__shares-value", children: format(total) }),
|
|
5305
|
+
/* @__PURE__ */ jsx43("span", { className: "ui-chart__shares-pct", children: "100%" })
|
|
5306
|
+
] })
|
|
5307
|
+
] });
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5310
|
+
// src/Chart.tsx
|
|
5311
|
+
import { Fragment as Fragment18, jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5312
|
+
var HEIGHT = { months: 216, bridge: 216, spark: 32, line: 216, area: 216, stacked: 216, donut: 216 };
|
|
4871
5313
|
var PAD = 2;
|
|
4872
5314
|
var ZERO_INSET = 1.5;
|
|
4873
5315
|
var TARGET = 24;
|
|
@@ -4875,13 +5317,17 @@ var TAP_FLOOR = 44;
|
|
|
4875
5317
|
var PHONE_MAX2 = 560;
|
|
4876
5318
|
var FALLBACK_COL = 48;
|
|
4877
5319
|
var BAR_SHARE = 0.5;
|
|
4878
|
-
var BAR_MAX =
|
|
4879
|
-
var BAR_MAX_BRIDGE =
|
|
5320
|
+
var BAR_MAX = 12;
|
|
5321
|
+
var BAR_MAX_BRIDGE = 22;
|
|
4880
5322
|
var LANE_GAP = 2;
|
|
4881
|
-
var
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
5323
|
+
var MISSING2 = "\u2014";
|
|
5324
|
+
function fadeOf(uid, m, bridge) {
|
|
5325
|
+
if (!bridge && !m.foot) return null;
|
|
5326
|
+
const up = bridge ? m.value >= 0 : m.foot === "bottom";
|
|
5327
|
+
return { id: `${uid}-fade-${m.tone}-${up ? "up" : "down"}`, tone: m.tone, up };
|
|
5328
|
+
}
|
|
5329
|
+
var cx9 = (...parts) => parts.filter(Boolean).join(" ");
|
|
5330
|
+
var px2 = (n) => Math.round(n * 10) / 10;
|
|
4885
5331
|
var columnOf = (p, fallback) => ({
|
|
4886
5332
|
label: p.label,
|
|
4887
5333
|
short: p.short || fallback,
|
|
@@ -4890,18 +5336,18 @@ var columnOf = (p, fallback) => ({
|
|
|
4890
5336
|
});
|
|
4891
5337
|
function onPrevious(value, previous, when) {
|
|
4892
5338
|
if (previous === void 0 || previous === 0 || !Number.isFinite(previous) || !when) return "";
|
|
4893
|
-
const
|
|
4894
|
-
return `${
|
|
5339
|
+
const pct2 = (value - previous) / Math.abs(previous) * 100;
|
|
5340
|
+
return `${pct2 < 0 ? "\u2212" : "+"}${Math.abs(pct2).toFixed(1)}% on ${when}`;
|
|
4895
5341
|
}
|
|
4896
5342
|
function barPath(m) {
|
|
4897
|
-
const r = Math.min(
|
|
5343
|
+
const r = Math.min(m.w / 2, m.h / (m.foot ? 1 : 4));
|
|
4898
5344
|
const { x, y: top, w, h } = m;
|
|
4899
5345
|
const bottom = top + h;
|
|
4900
|
-
const
|
|
4901
|
-
if (r <= 0) return `M${
|
|
5346
|
+
const arc2 = (dx, dy, sweep) => `a${px2(r)} ${px2(r)} 0 0 ${sweep} ${px2(dx)} ${px2(dy)}`;
|
|
5347
|
+
if (r <= 0) return `M${px2(x)} ${px2(top)}h${px2(w)}v${px2(h)}h${px2(-w)}z`;
|
|
4902
5348
|
const roundTop = m.foot !== "top";
|
|
4903
5349
|
const roundBottom = m.foot !== "bottom";
|
|
4904
|
-
return `M${
|
|
5350
|
+
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";
|
|
4905
5351
|
}
|
|
4906
5352
|
function useTapFloor() {
|
|
4907
5353
|
const [floor, setFloor] = useState18(TARGET);
|
|
@@ -4931,9 +5377,9 @@ function seriesFrame(periods, series, spark, format) {
|
|
|
4931
5377
|
const inBand = (band) => series.filter((s) => shapeOf(s) !== "line" && bandOf(s) === band);
|
|
4932
5378
|
for (const s of series) {
|
|
4933
5379
|
const shape = shapeOf(s);
|
|
4934
|
-
const
|
|
5380
|
+
const tone2 = s.tone ?? (shape === "line" ? "neutral" : "accent");
|
|
4935
5381
|
if (shape === "line") {
|
|
4936
|
-
lines.push({ id: s.id, tone, values: s.values.map((v) => Number.isFinite(v) ? v : Number.NaN) });
|
|
5382
|
+
lines.push({ id: s.id, tone: tone2, values: s.values.map((v) => Number.isFinite(v) ? v : Number.NaN) });
|
|
4937
5383
|
continue;
|
|
4938
5384
|
}
|
|
4939
5385
|
const below = shape === "bars-below";
|
|
@@ -4946,7 +5392,7 @@ function seriesFrame(periods, series, spark, format) {
|
|
|
4946
5392
|
bars.push({
|
|
4947
5393
|
id: `${s.id}-${i}`,
|
|
4948
5394
|
name: s.name,
|
|
4949
|
-
tone,
|
|
5395
|
+
tone: tone2,
|
|
4950
5396
|
column: i,
|
|
4951
5397
|
from: 0,
|
|
4952
5398
|
to: below ? -value : value,
|
|
@@ -4972,7 +5418,7 @@ function seriesFrame(periods, series, spark, format) {
|
|
|
4972
5418
|
tableHead: ["Period", ...series.map((s) => s.name)],
|
|
4973
5419
|
tableRows: columns.map((column, i) => ({
|
|
4974
5420
|
column,
|
|
4975
|
-
cells: series.map((s) => Number.isFinite(s.values[i]) ? format(s.values[i]) :
|
|
5421
|
+
cells: series.map((s) => Number.isFinite(s.values[i]) ? format(s.values[i]) : MISSING2)
|
|
4976
5422
|
}))
|
|
4977
5423
|
};
|
|
4978
5424
|
}
|
|
@@ -4985,9 +5431,9 @@ function bridgeFrame(steps, tones, format) {
|
|
|
4985
5431
|
const toneOf = (step) => step.kind === "total" ? total : step.value < 0 ? fall : rise;
|
|
4986
5432
|
const named = [];
|
|
4987
5433
|
for (const step of walk) {
|
|
4988
|
-
const
|
|
5434
|
+
const tone2 = toneOf(step);
|
|
4989
5435
|
const name = step.kind === "total" ? "Totals" : step.value < 0 ? "Decreases" : "Increases";
|
|
4990
|
-
if (!named.some((k) => k.id ===
|
|
5436
|
+
if (!named.some((k) => k.id === tone2)) named.push({ id: tone2, name, tone: tone2, shape: "bars" });
|
|
4991
5437
|
}
|
|
4992
5438
|
return {
|
|
4993
5439
|
columns,
|
|
@@ -5011,6 +5457,118 @@ function bridgeFrame(steps, tones, format) {
|
|
|
5011
5457
|
tableRows: walk.map((step, i) => ({ column: columns[i], cells: [format(step.value), format(step.to)] }))
|
|
5012
5458
|
};
|
|
5013
5459
|
}
|
|
5460
|
+
function noNegative(variant, values) {
|
|
5461
|
+
const bad = values.find((v) => v.value < 0);
|
|
5462
|
+
if (bad) throw new RangeError(`Chart: a ${variant} chart takes values of 0 or more; ${bad.name} is ${bad.value}`);
|
|
5463
|
+
}
|
|
5464
|
+
function lookFrame(variant, look, periods, series, format) {
|
|
5465
|
+
if (variant !== "line") noNegative(variant, series.flatMap((s) => s.values.map((value2) => ({ name: s.name, value: value2 }))));
|
|
5466
|
+
const columns = periods.map((p) => columnOf(p, p.label.split(" ")[0]));
|
|
5467
|
+
const stacked = variant === "stacked" || look !== "flat" && variant === "area";
|
|
5468
|
+
const share = look === "share";
|
|
5469
|
+
const n = columns.length;
|
|
5470
|
+
const value = (s, i) => Number.isFinite(s.values[i]) ? s.values[i] : Number.NaN;
|
|
5471
|
+
const totals = columns.map((_, i) => series.reduce((sum, s) => sum + (Number.isFinite(s.values[i]) ? s.values[i] : 0), 0));
|
|
5472
|
+
const base = new Array(n).fill(0);
|
|
5473
|
+
const layers = series.map((s, k) => {
|
|
5474
|
+
const values = columns.map((_, i) => value(s, i));
|
|
5475
|
+
const tone2 = s.tone ?? TONE_CYCLE[k % TONE_CYCLE.length];
|
|
5476
|
+
if (!stacked) return { id: s.id, name: s.name, tone: tone2, values, from: base.slice(), to: values.slice() };
|
|
5477
|
+
const from = base.slice();
|
|
5478
|
+
values.forEach((v, i) => {
|
|
5479
|
+
base[i] += Number.isFinite(v) ? v : 0;
|
|
5480
|
+
});
|
|
5481
|
+
const to = base.slice();
|
|
5482
|
+
const of = (v, i) => share ? totals[i] > 0 ? v / totals[i] : 0 : v;
|
|
5483
|
+
return { id: s.id, name: s.name, tone: tone2, values, from: from.map(of), to: to.map(of) };
|
|
5484
|
+
});
|
|
5485
|
+
const reach = stacked ? totals : series.flatMap((s) => s.values.filter(Number.isFinite));
|
|
5486
|
+
const frameLook = {
|
|
5487
|
+
variant,
|
|
5488
|
+
look,
|
|
5489
|
+
layout: look === "rows" ? "rows" : "columns",
|
|
5490
|
+
stacked,
|
|
5491
|
+
share,
|
|
5492
|
+
layers,
|
|
5493
|
+
totals,
|
|
5494
|
+
totalLabel: "Total"
|
|
5495
|
+
};
|
|
5496
|
+
const shape = keyShape(frameLook);
|
|
5497
|
+
return {
|
|
5498
|
+
columns,
|
|
5499
|
+
scale: share ? { min: 0, max: 1, step: 0.25, ticks: [0, 0.25, 0.5, 0.75, 1] } : chartScale([...reach, 0], { zero: true, ticks: 4 }),
|
|
5500
|
+
bars: [],
|
|
5501
|
+
lines: [],
|
|
5502
|
+
links: false,
|
|
5503
|
+
keys: layers.map((l) => ({ id: l.id, name: l.name, tone: l.tone, shape })),
|
|
5504
|
+
tableHead: ["Period", ...series.map((s) => s.name), ...stacked ? ["Total"] : []],
|
|
5505
|
+
tableRows: columns.map((column, i) => ({
|
|
5506
|
+
column,
|
|
5507
|
+
cells: [
|
|
5508
|
+
...series.map((s) => Number.isFinite(s.values[i]) ? format(s.values[i]) : MISSING2),
|
|
5509
|
+
...stacked ? [format(totals[i])] : []
|
|
5510
|
+
]
|
|
5511
|
+
})),
|
|
5512
|
+
look: frameLook
|
|
5513
|
+
};
|
|
5514
|
+
}
|
|
5515
|
+
function donutFrame(look, slices, totalLabel, format) {
|
|
5516
|
+
noNegative("donut", slices);
|
|
5517
|
+
const parts = slices.map((s) => Number.isFinite(s.value) ? s.value : 0);
|
|
5518
|
+
const total = parts.reduce((a, b) => a + b, 0);
|
|
5519
|
+
let at = 0;
|
|
5520
|
+
const layers = slices.map((s, k) => {
|
|
5521
|
+
const from = total > 0 ? at / total : 0;
|
|
5522
|
+
at += parts[k];
|
|
5523
|
+
return {
|
|
5524
|
+
id: s.id,
|
|
5525
|
+
name: s.name,
|
|
5526
|
+
tone: s.tone ?? TONE_CYCLE[k % TONE_CYCLE.length],
|
|
5527
|
+
values: [Number.isFinite(s.value) ? s.value : Number.NaN],
|
|
5528
|
+
from: [from],
|
|
5529
|
+
to: [total > 0 ? at / total : 0]
|
|
5530
|
+
};
|
|
5531
|
+
});
|
|
5532
|
+
const columns = slices.map((s) => ({ label: s.name, short: s.name, estimated: false }));
|
|
5533
|
+
return {
|
|
5534
|
+
columns,
|
|
5535
|
+
scale: { min: 0, max: 1, step: 1, ticks: [] },
|
|
5536
|
+
bars: [],
|
|
5537
|
+
lines: [],
|
|
5538
|
+
links: false,
|
|
5539
|
+
keys: layers.map((l) => ({ id: l.id, name: l.name, tone: l.tone, shape: "fill" })),
|
|
5540
|
+
tableHead: ["Slice", "Value", "Share"],
|
|
5541
|
+
tableRows: columns.map((column, i) => ({
|
|
5542
|
+
column,
|
|
5543
|
+
cells: [
|
|
5544
|
+
Number.isFinite(slices[i].value) ? format(slices[i].value) : MISSING2,
|
|
5545
|
+
total > 0 ? pct(layers[i].to[0] - layers[i].from[0]) : MISSING2
|
|
5546
|
+
]
|
|
5547
|
+
})),
|
|
5548
|
+
look: {
|
|
5549
|
+
variant: "donut",
|
|
5550
|
+
look,
|
|
5551
|
+
layout: "ring",
|
|
5552
|
+
stacked: true,
|
|
5553
|
+
share: true,
|
|
5554
|
+
layers,
|
|
5555
|
+
totals: [total],
|
|
5556
|
+
totalLabel
|
|
5557
|
+
}
|
|
5558
|
+
};
|
|
5559
|
+
}
|
|
5560
|
+
function KeyMark({ shape }) {
|
|
5561
|
+
if (shape === "line") {
|
|
5562
|
+
return /* @__PURE__ */ jsx44("svg", { className: "ui-chart__key-mark", width: "18", height: "12", viewBox: "0 0 18 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx44("path", { className: "ui-chart__key-line", d: "M1 9 L6 5 L12 7 L17 3" }) });
|
|
5563
|
+
}
|
|
5564
|
+
return /* @__PURE__ */ jsx44("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: shape === "fill" ? /* @__PURE__ */ jsx44("rect", { className: "ui-chart__key-swatch", x: "1", y: "1", width: "10", height: "10", rx: "2.5" }) : /* @__PURE__ */ jsx44(
|
|
5565
|
+
"path",
|
|
5566
|
+
{
|
|
5567
|
+
className: "ui-chart__key-swatch",
|
|
5568
|
+
d: barPath({ x: 3.5, y: 1, w: 5, h: 10, foot: shape === "bars-below" ? "top" : "bottom" })
|
|
5569
|
+
}
|
|
5570
|
+
) });
|
|
5571
|
+
}
|
|
5014
5572
|
function Chart(props) {
|
|
5015
5573
|
const {
|
|
5016
5574
|
title,
|
|
@@ -5018,6 +5576,7 @@ function Chart(props) {
|
|
|
5018
5576
|
formatAxis = format,
|
|
5019
5577
|
height,
|
|
5020
5578
|
table,
|
|
5579
|
+
legend: keyed = false,
|
|
5021
5580
|
selectable,
|
|
5022
5581
|
selected,
|
|
5023
5582
|
onSelect,
|
|
@@ -5027,6 +5586,8 @@ function Chart(props) {
|
|
|
5027
5586
|
const spark = variant === "spark";
|
|
5028
5587
|
const plotHeight = height ?? HEIGHT[variant];
|
|
5029
5588
|
const showTable = table ?? !spark;
|
|
5589
|
+
const [view, setView] = useState18("chart");
|
|
5590
|
+
const asTable = showTable && view === "table";
|
|
5030
5591
|
const uid = useId14().replace(/[^\w-]/g, "");
|
|
5031
5592
|
const frameEl = useRef22(null);
|
|
5032
5593
|
const scroller = useRef22(null);
|
|
@@ -5047,10 +5608,19 @@ function Chart(props) {
|
|
|
5047
5608
|
const pick = selected === void 0 ? ownPick : selected;
|
|
5048
5609
|
const steps = props.variant === "bridge" ? props.steps : void 0;
|
|
5049
5610
|
const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
|
|
5050
|
-
const periods = props.variant === "bridge" ? void 0 : props.periods;
|
|
5051
|
-
const series = props.variant === "bridge" ? void 0 : props.series;
|
|
5052
|
-
const
|
|
5053
|
-
const
|
|
5611
|
+
const periods = props.variant === "bridge" || props.variant === "donut" ? void 0 : props.periods;
|
|
5612
|
+
const series = props.variant === "bridge" || props.variant === "donut" ? void 0 : props.series;
|
|
5613
|
+
const slices = props.variant === "donut" ? props.slices : void 0;
|
|
5614
|
+
const totalLabel = props.variant === "donut" ? props.totalLabel ?? "Total" : "Total";
|
|
5615
|
+
const lookName = props.variant === "line" || props.variant === "area" || props.variant === "stacked" || props.variant === "donut" ? props.look ?? LOOK_DEFAULT[props.variant] : void 0;
|
|
5616
|
+
const frame = useMemo5(() => {
|
|
5617
|
+
if (steps) return bridgeFrame(steps, bridgeTones, format);
|
|
5618
|
+
if (slices) return donutFrame(lookName, slices, totalLabel, format);
|
|
5619
|
+
if (lookName) return lookFrame(variant, lookName, periods ?? [], series ?? [], format);
|
|
5620
|
+
return seriesFrame(periods ?? [], series ?? [], spark, format);
|
|
5621
|
+
}, [steps, bridgeTones, slices, totalLabel, lookName, variant, periods, series, spark, format]);
|
|
5622
|
+
const { columns, scale, lines, keys, tableHead, tableRows, look } = frame;
|
|
5623
|
+
const columnsLayout = !look || look.layout === "columns";
|
|
5054
5624
|
const count = columns.length || 1;
|
|
5055
5625
|
const cursor = Math.min(rawCursor, Math.max(columns.length - 1, 0));
|
|
5056
5626
|
const plotWidth = width || count * FALLBACK_COL;
|
|
@@ -5072,7 +5642,26 @@ function Chart(props) {
|
|
|
5072
5642
|
));
|
|
5073
5643
|
const barWidth = (groupWidth - LANE_GAP * (lanes - 1)) / lanes;
|
|
5074
5644
|
const centre = useCallback7((column) => column * colWidth + colWidth / 2, [colWidth]);
|
|
5645
|
+
const axisFormat = look?.share ? pct : formatAxis;
|
|
5646
|
+
const geometry = useMemo5(() => look ? {
|
|
5647
|
+
look,
|
|
5648
|
+
uid,
|
|
5649
|
+
labels: columns,
|
|
5650
|
+
plotWidth,
|
|
5651
|
+
plotHeight,
|
|
5652
|
+
colWidth,
|
|
5653
|
+
pad: PAD,
|
|
5654
|
+
target: TARGET,
|
|
5655
|
+
floor,
|
|
5656
|
+
y,
|
|
5657
|
+
centre,
|
|
5658
|
+
scale,
|
|
5659
|
+
format,
|
|
5660
|
+
formatAxis: axisFormat
|
|
5661
|
+
} : null, [look, uid, columns, plotWidth, plotHeight, colWidth, floor, y, centre, scale, format, axisFormat]);
|
|
5662
|
+
const box = geometry ? lookBox(geometry) : null;
|
|
5075
5663
|
const marks = useMemo5(() => {
|
|
5664
|
+
if (geometry) return lookMarks(geometry);
|
|
5076
5665
|
const out = frame.bars.map((bar) => {
|
|
5077
5666
|
let top = Math.min(y(bar.from), y(bar.to));
|
|
5078
5667
|
let bottom = Math.max(y(bar.from), y(bar.to));
|
|
@@ -5134,17 +5723,18 @@ function Chart(props) {
|
|
|
5134
5723
|
});
|
|
5135
5724
|
});
|
|
5136
5725
|
}
|
|
5137
|
-
const
|
|
5726
|
+
const box2 = { left: 0, right: plotWidth, top: boxTop, bottom: boxTop + boxHeight };
|
|
5138
5727
|
for (const dot of dots) {
|
|
5139
5728
|
const apart = dots.filter((d) => d !== dot && d.column === dot.column).map((d) => d.y + d.h / 2);
|
|
5140
5729
|
dot.hit = pointTarget(
|
|
5141
5730
|
{ x: dot.x + dot.w / 2, y: dot.y + dot.h / 2 },
|
|
5142
|
-
{ floor, min: Math.min(TARGET, colWidth), box, column: [dot.column * colWidth, (dot.column + 1) * colWidth], apart }
|
|
5731
|
+
{ floor, min: Math.min(TARGET, colWidth), box: box2, column: [dot.column * colWidth, (dot.column + 1) * colWidth], apart }
|
|
5143
5732
|
);
|
|
5144
5733
|
}
|
|
5145
5734
|
return [...out, ...dots];
|
|
5146
|
-
}, [frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
|
|
5735
|
+
}, [geometry, frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
|
|
5147
5736
|
const byId = useMemo5(() => new Map(marks.map((m) => [m.id, m])), [marks]);
|
|
5737
|
+
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]);
|
|
5148
5738
|
const lead = useCallback7((column) => marks.find((m) => m.column === column), [marks]);
|
|
5149
5739
|
const open = openId ? byId.get(openId) : void 0;
|
|
5150
5740
|
useEffect17(() => {
|
|
@@ -5157,14 +5747,11 @@ function Chart(props) {
|
|
|
5157
5747
|
observer.observe(el);
|
|
5158
5748
|
return () => observer.disconnect();
|
|
5159
5749
|
}, []);
|
|
5160
|
-
const
|
|
5750
|
+
const opensAtEnd = variant === "line" && lookName === "labels";
|
|
5751
|
+
useLayoutEffect5(() => {
|
|
5161
5752
|
const el = scroller.current;
|
|
5162
|
-
if (
|
|
5163
|
-
|
|
5164
|
-
el.classList.toggle("is-more-before", el.scrollLeft > 1);
|
|
5165
|
-
el.classList.toggle("is-more-after", el.scrollLeft < last - 1);
|
|
5166
|
-
}, []);
|
|
5167
|
-
useEffect17(syncEdges, [syncEdges, plotWidth, count]);
|
|
5753
|
+
if (opensAtEnd && el) el.scrollLeft = el.scrollWidth - el.clientWidth;
|
|
5754
|
+
}, [opensAtEnd, plotWidth, count]);
|
|
5168
5755
|
useLayoutEffect5(() => {
|
|
5169
5756
|
if (!openId || !frameEl.current || !tipEl.current || !svgEl.current) return;
|
|
5170
5757
|
const anchor = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
|
|
@@ -5173,8 +5760,8 @@ function Chart(props) {
|
|
|
5173
5760
|
useEffect17(() => {
|
|
5174
5761
|
if (!openId) return;
|
|
5175
5762
|
const doc = frameEl.current?.ownerDocument;
|
|
5176
|
-
const
|
|
5177
|
-
if (!doc || !
|
|
5763
|
+
const view2 = doc?.defaultView;
|
|
5764
|
+
if (!doc || !view2) return;
|
|
5178
5765
|
const hide = () => setOpenId(null);
|
|
5179
5766
|
const escape = (event) => {
|
|
5180
5767
|
if (event.key !== "Escape") return;
|
|
@@ -5182,10 +5769,10 @@ function Chart(props) {
|
|
|
5182
5769
|
hide();
|
|
5183
5770
|
};
|
|
5184
5771
|
doc.addEventListener("keydown", escape);
|
|
5185
|
-
|
|
5772
|
+
view2.addEventListener("resize", hide);
|
|
5186
5773
|
return () => {
|
|
5187
5774
|
doc.removeEventListener("keydown", escape);
|
|
5188
|
-
|
|
5775
|
+
view2.removeEventListener("resize", hide);
|
|
5189
5776
|
};
|
|
5190
5777
|
}, [openId]);
|
|
5191
5778
|
const show = (id) => {
|
|
@@ -5201,10 +5788,14 @@ function Chart(props) {
|
|
|
5201
5788
|
const announce = useCallback7((column, picked = pick) => {
|
|
5202
5789
|
const where = columns[column];
|
|
5203
5790
|
if (!where) return;
|
|
5204
|
-
const values = marks.filter((m) => m.column === column).map((m) =>
|
|
5791
|
+
const values = marks.filter((m) => m.column === column).map((m) => {
|
|
5792
|
+
if (m.kind === "slice") return [format(m.value), m.detail].filter(Boolean).join(", ");
|
|
5793
|
+
if (!m.rows) return `${m.name} ${format(m.value)}`;
|
|
5794
|
+
return [...m.rows.map((r) => `${r.name} ${r.text}`), ...m.total ? [`${totalLabel} ${m.total}`] : []].join(". ");
|
|
5795
|
+
}).join(". ") || "No value";
|
|
5205
5796
|
const state = stateOf(where);
|
|
5206
5797
|
setSaid(`${where.label}. ${values}.${state ? ` ${state}.` : ""}${picked === column ? " Selected." : ""}`);
|
|
5207
|
-
}, [columns, marks, format, pick]);
|
|
5798
|
+
}, [columns, marks, format, pick, totalLabel]);
|
|
5208
5799
|
const step = (next) => {
|
|
5209
5800
|
const column = Math.max(0, Math.min(next, count - 1));
|
|
5210
5801
|
setCursor(column);
|
|
@@ -5213,7 +5804,6 @@ function Chart(props) {
|
|
|
5213
5804
|
const el = scroller.current;
|
|
5214
5805
|
if (el && el.scrollWidth > el.clientWidth) {
|
|
5215
5806
|
el.scrollLeft = Math.max(0, centre(column) - el.clientWidth / 2);
|
|
5216
|
-
syncEdges();
|
|
5217
5807
|
}
|
|
5218
5808
|
};
|
|
5219
5809
|
const choose = (column) => {
|
|
@@ -5242,45 +5832,60 @@ function Chart(props) {
|
|
|
5242
5832
|
const estimated = columns.filter((c) => c.estimated);
|
|
5243
5833
|
const estimatedTone = marks.find((m) => m.estimated && m.kind === "bar")?.tone ?? keys[0]?.tone ?? "neutral";
|
|
5244
5834
|
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) };
|
|
5245
|
-
|
|
5835
|
+
const legendFirst = !(look?.variant === "donut" && look.look !== "labels");
|
|
5836
|
+
const legend = keyed && !asTable && keys.length > 0 && !(look?.variant === "donut" && look.look === "table") && /* @__PURE__ */ jsxs40("ul", { className: "ui-chart__legend", children: [
|
|
5837
|
+
keys.map((key) => /* @__PURE__ */ jsxs40("li", { className: cx9("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
|
|
5838
|
+
/* @__PURE__ */ jsx44(KeyMark, { shape: key.shape }),
|
|
5839
|
+
key.name
|
|
5840
|
+
] }, key.id)),
|
|
5841
|
+
estimated.length > 0 && /* @__PURE__ */ jsxs40("li", { className: cx9("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
5842
|
+
/* @__PURE__ */ jsx44("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx44("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "2.5" }) }),
|
|
5843
|
+
"Estimated"
|
|
5844
|
+
] })
|
|
5845
|
+
] });
|
|
5846
|
+
const noun = look?.layout === "ring" ? "slices" : look?.layout === "rows" ? "rows" : "columns";
|
|
5847
|
+
return /* @__PURE__ */ jsxs40(
|
|
5246
5848
|
"div",
|
|
5247
5849
|
{
|
|
5248
|
-
className:
|
|
5850
|
+
className: cx9(
|
|
5851
|
+
"ui-chart",
|
|
5852
|
+
`ui-chart--${variant}`,
|
|
5853
|
+
look && `ui-chart--${variant}-${look.look}`,
|
|
5854
|
+
selectable && "ui-chart--pick",
|
|
5855
|
+
className
|
|
5856
|
+
),
|
|
5249
5857
|
style: {
|
|
5250
5858
|
"--ui-chart-h": `${plotHeight}px`,
|
|
5251
|
-
"--ui-chart-box": `${
|
|
5859
|
+
"--ui-chart-box": `${px2(boxHeight)}px`,
|
|
5252
5860
|
"--ui-chart-cols": count,
|
|
5253
5861
|
"--ui-chart-pad": `${PAD}px`
|
|
5254
5862
|
},
|
|
5255
5863
|
children: [
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
estimated.length > 0 && /* @__PURE__ */ jsxs38("li", { className: cx8("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
5272
|
-
/* @__PURE__ */ jsx43("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx43("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "1" }) }),
|
|
5273
|
-
"Estimated"
|
|
5274
|
-
] })
|
|
5864
|
+
(showTable || legendFirst && legend) && /* @__PURE__ */ jsxs40("div", { className: "ui-chart__head", children: [
|
|
5865
|
+
legendFirst && legend,
|
|
5866
|
+
showTable && /* @__PURE__ */ jsx44(
|
|
5867
|
+
Segmented,
|
|
5868
|
+
{
|
|
5869
|
+
size: "sm",
|
|
5870
|
+
label: `${title}, view`,
|
|
5871
|
+
value: view,
|
|
5872
|
+
onChange: (next) => setView(next),
|
|
5873
|
+
options: [
|
|
5874
|
+
{ value: "chart", label: "Chart", icon: "chart", iconOnly: true },
|
|
5875
|
+
{ value: "table", label: "Table", icon: "table", iconOnly: true }
|
|
5876
|
+
]
|
|
5877
|
+
}
|
|
5878
|
+
)
|
|
5275
5879
|
] }),
|
|
5276
|
-
/* @__PURE__ */
|
|
5880
|
+
/* @__PURE__ */ jsxs40(
|
|
5277
5881
|
"div",
|
|
5278
5882
|
{
|
|
5279
5883
|
ref: frameEl,
|
|
5884
|
+
hidden: asTable,
|
|
5280
5885
|
className: "ui-chart__frame ui-tip-host ui-focusable",
|
|
5281
5886
|
tabIndex: 0,
|
|
5282
5887
|
role: "group",
|
|
5283
|
-
"aria-label": `${title}. Arrow keys step through the ${columns.length}
|
|
5888
|
+
"aria-label": `${title}. Arrow keys step through the ${columns.length} ${noun}.`,
|
|
5284
5889
|
onKeyDown,
|
|
5285
5890
|
onFocus: (event) => {
|
|
5286
5891
|
if (event.target !== event.currentTarget) return;
|
|
@@ -5297,24 +5902,24 @@ function Chart(props) {
|
|
|
5297
5902
|
setSaid("");
|
|
5298
5903
|
},
|
|
5299
5904
|
children: [
|
|
5300
|
-
!spark && scale.ticks.length > 0 && /* @__PURE__ */
|
|
5301
|
-
/* @__PURE__ */
|
|
5302
|
-
syncEdges();
|
|
5905
|
+
!spark && columnsLayout && scale.ticks.length > 0 && /* @__PURE__ */ jsx44("div", { className: "ui-chart__axis", "aria-hidden": "true", children: [...scale.ticks].reverse().map((tick) => /* @__PURE__ */ jsx44("span", { className: "ui-chart__tick", children: axisFormat(tick) }, tick)) }),
|
|
5906
|
+
/* @__PURE__ */ jsx44("div", { ref: scroller, className: "ui-chart__scroll", tabIndex: -1, onScroll: () => {
|
|
5303
5907
|
const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
|
|
5304
5908
|
if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
|
|
5305
5909
|
const mark = anchor.getBoundingClientRect();
|
|
5306
|
-
const
|
|
5307
|
-
if (mark.right <=
|
|
5910
|
+
const view2 = scroller.current.getBoundingClientRect();
|
|
5911
|
+
if (mark.right <= view2.left || mark.left >= view2.right) setOpenId(null);
|
|
5308
5912
|
else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
5309
|
-
}, children: /* @__PURE__ */
|
|
5310
|
-
/* @__PURE__ */
|
|
5913
|
+
}, children: /* @__PURE__ */ jsxs40("div", { ref: plot, className: "ui-chart__plot", children: [
|
|
5914
|
+
/* @__PURE__ */ jsxs40(
|
|
5311
5915
|
"svg",
|
|
5312
5916
|
{
|
|
5313
5917
|
ref: svgEl,
|
|
5314
5918
|
className: "ui-chart__svg",
|
|
5315
|
-
width:
|
|
5316
|
-
height:
|
|
5317
|
-
viewBox: `0 ${
|
|
5919
|
+
width: px2(plotWidth),
|
|
5920
|
+
height: px2(boxHeight),
|
|
5921
|
+
viewBox: `0 ${px2(boxTop)} ${px2(plotWidth)} ${px2(boxHeight)}`,
|
|
5922
|
+
...box && { width: px2(box.w), height: px2(box.h), viewBox: `0 0 ${px2(box.w)} ${px2(box.h)}` },
|
|
5318
5923
|
role: "img",
|
|
5319
5924
|
"aria-label": spark && marks.length > 0 ? `${title}. ${format(marks[0].value)} to ${format(marks[marks.length - 1].value)}.` : title,
|
|
5320
5925
|
onMouseMove: (event) => {
|
|
@@ -5367,119 +5972,140 @@ function Chart(props) {
|
|
|
5367
5972
|
announce(mark.column, selectable ? mark.column : pick);
|
|
5368
5973
|
},
|
|
5369
5974
|
children: [
|
|
5370
|
-
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */
|
|
5975
|
+
!spark && columnsLayout && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx44(
|
|
5371
5976
|
"rect",
|
|
5372
5977
|
{
|
|
5373
5978
|
className: "ui-chart__band",
|
|
5374
|
-
x:
|
|
5375
|
-
width:
|
|
5979
|
+
x: px2(pick * colWidth),
|
|
5980
|
+
width: px2(colWidth),
|
|
5376
5981
|
y: "0",
|
|
5377
|
-
height:
|
|
5982
|
+
height: px2(plotHeight)
|
|
5378
5983
|
}
|
|
5379
5984
|
),
|
|
5380
5985
|
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
5381
5986
|
const from = byId.get(bar.id);
|
|
5382
5987
|
const to = byId.get(frame.bars[i + 1].id);
|
|
5383
|
-
return from && to ? /* @__PURE__ */
|
|
5988
|
+
return from && to ? /* @__PURE__ */ jsx44(
|
|
5384
5989
|
"line",
|
|
5385
5990
|
{
|
|
5386
5991
|
className: "ui-chart__carry",
|
|
5387
|
-
x1:
|
|
5388
|
-
x2:
|
|
5389
|
-
y1:
|
|
5390
|
-
y2:
|
|
5992
|
+
x1: px2(from.x + from.w),
|
|
5993
|
+
x2: px2(to.x),
|
|
5994
|
+
y1: px2(y(bar.to)),
|
|
5995
|
+
y2: px2(y(bar.to))
|
|
5391
5996
|
},
|
|
5392
5997
|
`carry-${bar.id}`
|
|
5393
5998
|
) : null;
|
|
5394
5999
|
}),
|
|
5395
|
-
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */
|
|
6000
|
+
!spark && columnsLayout && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx44(
|
|
5396
6001
|
"line",
|
|
5397
6002
|
{
|
|
5398
6003
|
className: "ui-chart__grid",
|
|
5399
6004
|
x1: "0",
|
|
5400
|
-
x2:
|
|
5401
|
-
y1:
|
|
5402
|
-
y2:
|
|
6005
|
+
x2: px2(plotWidth),
|
|
6006
|
+
y1: px2(y(tick)),
|
|
6007
|
+
y2: px2(y(tick))
|
|
5403
6008
|
},
|
|
5404
6009
|
`grid-${tick}`
|
|
5405
6010
|
)),
|
|
5406
|
-
!spark && scale.ticks.includes(0) && /* @__PURE__ */
|
|
6011
|
+
!spark && columnsLayout && scale.ticks.includes(0) && /* @__PURE__ */ jsx44(
|
|
5407
6012
|
"line",
|
|
5408
6013
|
{
|
|
5409
6014
|
className: "ui-chart__zero",
|
|
5410
6015
|
x1: "0",
|
|
5411
|
-
x2:
|
|
5412
|
-
y1:
|
|
5413
|
-
y2:
|
|
6016
|
+
x2: px2(plotWidth),
|
|
6017
|
+
y1: px2(y(0)),
|
|
6018
|
+
y2: px2(y(0))
|
|
5414
6019
|
}
|
|
5415
6020
|
),
|
|
5416
|
-
|
|
5417
|
-
"
|
|
6021
|
+
fades.size > 0 && /* @__PURE__ */ jsx44("defs", { children: [...fades.values()].map((fade) => /* @__PURE__ */ jsxs40(
|
|
6022
|
+
"linearGradient",
|
|
5418
6023
|
{
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
6024
|
+
id: fade.id,
|
|
6025
|
+
className: `ui-chart__tone--${fade.tone}`,
|
|
6026
|
+
x1: "0",
|
|
6027
|
+
x2: "0",
|
|
6028
|
+
y1: fade.up ? "1" : "0",
|
|
6029
|
+
y2: fade.up ? "0" : "1",
|
|
6030
|
+
children: [
|
|
6031
|
+
/* @__PURE__ */ jsx44("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
6032
|
+
/* @__PURE__ */ jsx44("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
6033
|
+
]
|
|
5425
6034
|
},
|
|
5426
|
-
|
|
5427
|
-
)),
|
|
6035
|
+
fade.id
|
|
6036
|
+
)) }),
|
|
6037
|
+
marks.filter((m) => m.kind === "bar").map((mark) => {
|
|
6038
|
+
const fade = fadeOf(uid, mark, variant === "bridge");
|
|
6039
|
+
return /* @__PURE__ */ jsx44(
|
|
6040
|
+
"path",
|
|
6041
|
+
{
|
|
6042
|
+
className: cx9(
|
|
6043
|
+
"ui-chart__bar",
|
|
6044
|
+
`ui-chart__tone--${mark.tone}`,
|
|
6045
|
+
mark.estimated && "is-estimated"
|
|
6046
|
+
),
|
|
6047
|
+
style: fade ? { "--ui-chart-paint": `url(#${fade.id})` } : void 0,
|
|
6048
|
+
d: barPath(mark)
|
|
6049
|
+
},
|
|
6050
|
+
`bar-${mark.id}`
|
|
6051
|
+
);
|
|
6052
|
+
}),
|
|
5428
6053
|
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
5429
|
-
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */
|
|
6054
|
+
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx44(
|
|
5430
6055
|
"line",
|
|
5431
6056
|
{
|
|
5432
|
-
className: layer === "casing" ? "ui-chart__line-casing" :
|
|
6057
|
+
className: layer === "casing" ? "ui-chart__line-casing" : cx9(
|
|
5433
6058
|
"ui-chart__line",
|
|
5434
6059
|
`ui-chart__tone--${line.tone}`,
|
|
5435
6060
|
(columns[i]?.estimated || columns[i + 1]?.estimated) && "is-estimated"
|
|
5436
6061
|
),
|
|
5437
|
-
x1:
|
|
5438
|
-
y1:
|
|
5439
|
-
x2:
|
|
5440
|
-
y2:
|
|
6062
|
+
x1: px2(centre(i)),
|
|
6063
|
+
y1: px2(y(line.values[i])),
|
|
6064
|
+
x2: px2(centre(i + 1)),
|
|
6065
|
+
y2: px2(y(value))
|
|
5441
6066
|
},
|
|
5442
6067
|
`${line.id}-${layer}-${i}`
|
|
5443
6068
|
) : null)
|
|
5444
6069
|
)),
|
|
5445
|
-
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */
|
|
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__ */ jsx44(
|
|
5446
6071
|
"circle",
|
|
5447
6072
|
{
|
|
5448
|
-
className:
|
|
5449
|
-
cx:
|
|
5450
|
-
cy:
|
|
6073
|
+
className: cx9("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
6074
|
+
cx: px2(centre(i)),
|
|
6075
|
+
cy: px2(y(value)),
|
|
5451
6076
|
r: "2"
|
|
5452
6077
|
},
|
|
5453
6078
|
`isolated-${line.id}-${i}`
|
|
5454
6079
|
) : null)),
|
|
5455
|
-
|
|
5456
|
-
|
|
6080
|
+
geometry && lookDrawing(geometry, open?.column ?? null, pick),
|
|
6081
|
+
marks.map((mark) => /* @__PURE__ */ jsxs40("g", { "data-mark": mark.id, children: [
|
|
6082
|
+
mark.hitPath ? /* @__PURE__ */ jsx44("path", { className: "ui-chart__hit", d: mark.hitPath }) : mark.kind === "bar" ? /* @__PURE__ */ jsx44(
|
|
5457
6083
|
"rect",
|
|
5458
6084
|
{
|
|
5459
6085
|
className: "ui-chart__hit",
|
|
5460
|
-
x:
|
|
5461
|
-
width:
|
|
5462
|
-
y:
|
|
5463
|
-
height:
|
|
6086
|
+
x: px2(mark.column * colWidth + mark.lane * colWidth / mark.lanes),
|
|
6087
|
+
width: px2(colWidth / mark.lanes),
|
|
6088
|
+
y: px2(hitBand(mark.band).y),
|
|
6089
|
+
height: px2(hitBand(mark.band).h)
|
|
5464
6090
|
}
|
|
5465
|
-
) : /* @__PURE__ */
|
|
6091
|
+
) : /* @__PURE__ */ jsx44(
|
|
5466
6092
|
"rect",
|
|
5467
6093
|
{
|
|
5468
6094
|
className: "ui-chart__hit",
|
|
5469
|
-
x:
|
|
5470
|
-
y:
|
|
5471
|
-
width:
|
|
5472
|
-
height:
|
|
6095
|
+
x: px2(mark.hit?.x ?? mark.x),
|
|
6096
|
+
y: px2(mark.hit?.y ?? mark.y),
|
|
6097
|
+
width: px2(mark.hit?.w ?? TARGET),
|
|
6098
|
+
height: px2(mark.hit?.h ?? TARGET)
|
|
5473
6099
|
}
|
|
5474
6100
|
),
|
|
5475
|
-
/* @__PURE__ */
|
|
6101
|
+
/* @__PURE__ */ jsx44(
|
|
5476
6102
|
"rect",
|
|
5477
6103
|
{
|
|
5478
6104
|
"data-anchor": mark.id,
|
|
5479
6105
|
className: "ui-chart__anchor",
|
|
5480
|
-
x:
|
|
5481
|
-
y:
|
|
5482
|
-
width:
|
|
6106
|
+
x: px2(mark.x),
|
|
6107
|
+
y: px2(mark.y),
|
|
6108
|
+
width: px2(mark.w),
|
|
5483
6109
|
height: "0"
|
|
5484
6110
|
}
|
|
5485
6111
|
)
|
|
@@ -5487,49 +6113,60 @@ function Chart(props) {
|
|
|
5487
6113
|
]
|
|
5488
6114
|
}
|
|
5489
6115
|
),
|
|
5490
|
-
|
|
6116
|
+
look?.variant === "donut" && look.look === "table" && /* @__PURE__ */ jsx44(Shares, { look, format, swatch: /* @__PURE__ */ jsx44(KeyMark, { shape: "fill" }) }),
|
|
6117
|
+
!spark && columnsLayout && /* @__PURE__ */ jsx44("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx44(
|
|
5491
6118
|
"span",
|
|
5492
6119
|
{
|
|
5493
|
-
className:
|
|
6120
|
+
className: cx9("ui-chart__period", pick === i && "is-selected"),
|
|
5494
6121
|
children: column.short
|
|
5495
6122
|
},
|
|
5496
6123
|
`${column.label}-${i}`
|
|
5497
6124
|
)) })
|
|
5498
6125
|
] }) }),
|
|
5499
|
-
/* @__PURE__ */
|
|
5500
|
-
/* @__PURE__ */
|
|
5501
|
-
/* @__PURE__ */
|
|
5502
|
-
|
|
6126
|
+
/* @__PURE__ */ jsx44("span", { ref: tipEl, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
6127
|
+
/* @__PURE__ */ jsx44("span", { className: "ui-tip__label", children: spark || look ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
6128
|
+
open.rows ? /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
6129
|
+
open.rows.map((row) => /* @__PURE__ */ jsxs40("span", { className: "ui-tip__value ui-chart__row", children: [
|
|
6130
|
+
/* @__PURE__ */ jsxs40("span", { className: cx9("ui-chart__key", `ui-chart__tone--${row.tone}`), children: [
|
|
6131
|
+
/* @__PURE__ */ jsx44(KeyMark, { shape: row.shape }),
|
|
6132
|
+
row.name
|
|
6133
|
+
] }),
|
|
6134
|
+
/* @__PURE__ */ jsx44("span", { children: row.text })
|
|
6135
|
+
] }, row.name)),
|
|
6136
|
+
open.total && /* @__PURE__ */ jsxs40("span", { className: "ui-tip__value ui-chart__row", children: [
|
|
6137
|
+
/* @__PURE__ */ jsx44("span", { children: totalLabel }),
|
|
6138
|
+
/* @__PURE__ */ jsx44("span", { children: open.total })
|
|
6139
|
+
] })
|
|
6140
|
+
] }) : /* @__PURE__ */ jsx44("span", { className: "ui-tip__value", children: format(open.value) }),
|
|
6141
|
+
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */ jsx44("span", { className: "ui-tip__detail", children: stateOf(columns[open.column]) || open.detail })
|
|
5503
6142
|
] }) })
|
|
5504
6143
|
]
|
|
5505
6144
|
}
|
|
5506
6145
|
),
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
children: /* @__PURE__ */
|
|
5518
|
-
|
|
5519
|
-
/* @__PURE__ */
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
)
|
|
5532
|
-
] })
|
|
6146
|
+
!legendFirst && legend,
|
|
6147
|
+
/* @__PURE__ */ jsx44("div", { className: "ui-sr", role: "status", children: said }),
|
|
6148
|
+
asTable && /* @__PURE__ */ jsx44("div", { className: "ui-chart__data", children: /* @__PURE__ */ jsx44(
|
|
6149
|
+
"div",
|
|
6150
|
+
{
|
|
6151
|
+
className: "ui-table-scroll",
|
|
6152
|
+
role: "region",
|
|
6153
|
+
tabIndex: 0,
|
|
6154
|
+
"aria-label": `${title}, as a table. Scroll for more columns.`,
|
|
6155
|
+
children: /* @__PURE__ */ jsxs40("table", { className: "ui-table", "aria-label": title, children: [
|
|
6156
|
+
/* @__PURE__ */ jsx44("thead", { children: /* @__PURE__ */ jsx44("tr", { children: tableHead.map((head, i) => /* @__PURE__ */ jsx44("th", { scope: "col", className: cx9(i > 0 && "ui-table__num"), children: head }, head)) }) }),
|
|
6157
|
+
/* @__PURE__ */ jsx44("tbody", { children: tableRows.map((row, i) => /* @__PURE__ */ jsxs40("tr", { "aria-current": pick === i ? true : void 0, children: [
|
|
6158
|
+
/* @__PURE__ */ jsxs40("th", { scope: "row", children: [
|
|
6159
|
+
row.column.label,
|
|
6160
|
+
row.column.estimated && /* @__PURE__ */ jsxs40(Fragment18, { children: [
|
|
6161
|
+
" ",
|
|
6162
|
+
/* @__PURE__ */ jsx44("span", { className: "ui-chart__state", children: stateOf(row.column) })
|
|
6163
|
+
] })
|
|
6164
|
+
] }),
|
|
6165
|
+
row.cells.map((cell, j) => /* @__PURE__ */ jsx44("td", { className: "ui-table__num", children: cell }, tableHead[j + 1]))
|
|
6166
|
+
] }, `${row.column.label}-${i}`)) })
|
|
6167
|
+
] })
|
|
6168
|
+
}
|
|
6169
|
+
) })
|
|
5533
6170
|
]
|
|
5534
6171
|
}
|
|
5535
6172
|
);
|
|
@@ -5538,7 +6175,7 @@ function Chart(props) {
|
|
|
5538
6175
|
// src/AccentPicker.tsx
|
|
5539
6176
|
import { forwardRef as forwardRef12 } from "react";
|
|
5540
6177
|
import { ACCENTS, accentSwatchStyle } from "@apliteni/apliteni-ui";
|
|
5541
|
-
import { jsx as
|
|
6178
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
5542
6179
|
var AccentPicker = forwardRef12(function AccentPicker2({
|
|
5543
6180
|
value,
|
|
5544
6181
|
onChange,
|
|
@@ -5547,7 +6184,7 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
5547
6184
|
"aria-label": label = "Accent",
|
|
5548
6185
|
...rest
|
|
5549
6186
|
}, ref) {
|
|
5550
|
-
return /* @__PURE__ */
|
|
6187
|
+
return /* @__PURE__ */ jsx45(
|
|
5551
6188
|
"div",
|
|
5552
6189
|
{
|
|
5553
6190
|
...rest,
|
|
@@ -5558,7 +6195,7 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
5558
6195
|
"aria-label": label,
|
|
5559
6196
|
children: options.map((accent) => {
|
|
5560
6197
|
const title = accent.charAt(0).toUpperCase() + accent.slice(1);
|
|
5561
|
-
return /* @__PURE__ */
|
|
6198
|
+
return /* @__PURE__ */ jsx45(
|
|
5562
6199
|
"button",
|
|
5563
6200
|
{
|
|
5564
6201
|
type: "button",
|
|
@@ -5577,9 +6214,9 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
5577
6214
|
});
|
|
5578
6215
|
|
|
5579
6216
|
// src/TopBar.tsx
|
|
5580
|
-
import { Fragment as
|
|
6217
|
+
import { Fragment as Fragment19 } from "react";
|
|
5581
6218
|
import { prism as prism3, safeUrl as safeUrl4, icon as icon8, ACCOUNT_NAV } from "@apliteni/apliteni-ui";
|
|
5582
|
-
import { Fragment as
|
|
6219
|
+
import { Fragment as Fragment20, jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5583
6220
|
function TopBar({
|
|
5584
6221
|
brand,
|
|
5585
6222
|
word = "Strategy",
|
|
@@ -5591,20 +6228,20 @@ function TopBar({
|
|
|
5591
6228
|
className,
|
|
5592
6229
|
...rest
|
|
5593
6230
|
}) {
|
|
5594
|
-
return /* @__PURE__ */
|
|
5595
|
-
brand ?? /* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
5597
|
-
/* @__PURE__ */
|
|
6231
|
+
return /* @__PURE__ */ jsx46("header", { ...rest, className: ["topbar", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs41("div", { className: "topbar__in", children: [
|
|
6232
|
+
brand ?? /* @__PURE__ */ jsxs41("a", { className: "brand", href: safeUrl4(brandHref), "aria-label": `Apliteni ${word}`, children: [
|
|
6233
|
+
/* @__PURE__ */ jsx46("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: prism3("tb-mark", 22) } }),
|
|
6234
|
+
/* @__PURE__ */ jsx46("span", { children: word })
|
|
5598
6235
|
] }),
|
|
5599
6236
|
view,
|
|
5600
|
-
/* @__PURE__ */
|
|
6237
|
+
/* @__PURE__ */ jsx46("span", { className: "spacer" }),
|
|
5601
6238
|
version,
|
|
5602
6239
|
theme,
|
|
5603
6240
|
account
|
|
5604
6241
|
] }) });
|
|
5605
6242
|
}
|
|
5606
6243
|
function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
5607
|
-
return /* @__PURE__ */
|
|
6244
|
+
return /* @__PURE__ */ jsx46("div", { className: "dtsw on", role: "group", "aria-label": label, children: items.map((item) => {
|
|
5608
6245
|
const current = item.id === active;
|
|
5609
6246
|
const linkProps = {
|
|
5610
6247
|
className: current ? "cur" : void 0,
|
|
@@ -5613,13 +6250,13 @@ function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
|
5613
6250
|
"aria-current": current ? "page" : void 0,
|
|
5614
6251
|
children: item.label
|
|
5615
6252
|
};
|
|
5616
|
-
return /* @__PURE__ */
|
|
6253
|
+
return /* @__PURE__ */ jsx46(Fragment19, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx46("a", { ...linkProps }) }, item.id);
|
|
5617
6254
|
}) });
|
|
5618
6255
|
}
|
|
5619
6256
|
var BADGE = { live: "Live", archive: "Archive" };
|
|
5620
6257
|
function VersionSwitcher({ versions, value, onChange, label = "Version", defaultOpen }) {
|
|
5621
6258
|
const current = versions.find((v) => v.value === value);
|
|
5622
|
-
return /* @__PURE__ */
|
|
6259
|
+
return /* @__PURE__ */ jsx46("div", { className: "vsw", children: /* @__PURE__ */ jsx46(
|
|
5623
6260
|
Dropdown,
|
|
5624
6261
|
{
|
|
5625
6262
|
variant: "select",
|
|
@@ -5630,9 +6267,9 @@ function VersionSwitcher({ versions, value, onChange, label = "Version", default
|
|
|
5630
6267
|
chevron: false,
|
|
5631
6268
|
defaultOpen,
|
|
5632
6269
|
ariaLabel: `${label} \u2014 ${current?.label ?? ""}`,
|
|
5633
|
-
triggerContent: /* @__PURE__ */
|
|
5634
|
-
/* @__PURE__ */
|
|
5635
|
-
/* @__PURE__ */
|
|
6270
|
+
triggerContent: /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
6271
|
+
/* @__PURE__ */ jsx46("span", { className: "cur", children: current?.label }),
|
|
6272
|
+
/* @__PURE__ */ jsx46("span", { className: "car", "aria-hidden": "true" })
|
|
5636
6273
|
] }),
|
|
5637
6274
|
items: versions.map((v) => ({
|
|
5638
6275
|
label: v.label,
|
|
@@ -5640,10 +6277,10 @@ function VersionSwitcher({ versions, value, onChange, label = "Version", default
|
|
|
5640
6277
|
badge: BADGE[v.badge ?? "archive"],
|
|
5641
6278
|
selected: v.value === value
|
|
5642
6279
|
})),
|
|
5643
|
-
row: (item, props) => /* @__PURE__ */
|
|
5644
|
-
/* @__PURE__ */
|
|
5645
|
-
/* @__PURE__ */
|
|
5646
|
-
/* @__PURE__ */
|
|
6280
|
+
row: (item, props) => /* @__PURE__ */ jsxs41("div", { ...props, className: `${props.className} vopt`, children: [
|
|
6281
|
+
/* @__PURE__ */ jsx46("span", { className: "vname", children: item.label }),
|
|
6282
|
+
/* @__PURE__ */ jsx46("span", { className: `vbadge ${item.badge === "Live" ? "live" : "arch"}`, children: String(item.badge) }),
|
|
6283
|
+
/* @__PURE__ */ jsx46("span", { className: "vtick", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon8("check") } })
|
|
5647
6284
|
] }),
|
|
5648
6285
|
onSelect: (picked) => {
|
|
5649
6286
|
if (picked != null) onChange?.(String(picked));
|
|
@@ -5672,7 +6309,7 @@ function AccountMenu({
|
|
|
5672
6309
|
defaultOpen
|
|
5673
6310
|
}) {
|
|
5674
6311
|
const mark = initialsOf(name, email);
|
|
5675
|
-
return /* @__PURE__ */
|
|
6312
|
+
return /* @__PURE__ */ jsx46("div", { className: "acct on", children: /* @__PURE__ */ jsx46(
|
|
5676
6313
|
Dropdown,
|
|
5677
6314
|
{
|
|
5678
6315
|
variant: "menu",
|
|
@@ -5683,22 +6320,22 @@ function AccountMenu({
|
|
|
5683
6320
|
defaultOpen,
|
|
5684
6321
|
ariaLabel: "Account",
|
|
5685
6322
|
triggerContent: mark,
|
|
5686
|
-
header: /* @__PURE__ */
|
|
5687
|
-
/* @__PURE__ */
|
|
5688
|
-
/* @__PURE__ */
|
|
5689
|
-
/* @__PURE__ */
|
|
5690
|
-
/* @__PURE__ */
|
|
6323
|
+
header: /* @__PURE__ */ jsxs41("div", { className: "ahead", children: [
|
|
6324
|
+
/* @__PURE__ */ jsx46("span", { className: "avatar", children: mark }),
|
|
6325
|
+
/* @__PURE__ */ jsxs41("span", { className: "aw", children: [
|
|
6326
|
+
/* @__PURE__ */ jsx46("span", { className: "anm", children: name }),
|
|
6327
|
+
/* @__PURE__ */ jsx46("span", { className: "aem", title: email, children: email })
|
|
5691
6328
|
] })
|
|
5692
6329
|
] }),
|
|
5693
6330
|
items: [...items, "---", { label: "Sign out", icon: "logout", value: "sign-out", href: signOutHref }],
|
|
5694
|
-
row: (item, props) => /* @__PURE__ */
|
|
6331
|
+
row: (item, props) => /* @__PURE__ */ jsxs41(
|
|
5695
6332
|
"a",
|
|
5696
6333
|
{
|
|
5697
6334
|
...props,
|
|
5698
6335
|
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}`),
|
|
5699
6336
|
className: [props.className.replace(/\bui-dropdown__item\b/, "").trim(), !item.disabled && item.value === current && "cur", item.value === "sign-out" && "aout"].filter(Boolean).join(" "),
|
|
5700
6337
|
children: [
|
|
5701
|
-
item.icon && /* @__PURE__ */
|
|
6338
|
+
item.icon && /* @__PURE__ */ jsx46("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon8(item.icon) } }),
|
|
5702
6339
|
item.label
|
|
5703
6340
|
]
|
|
5704
6341
|
}
|
|
@@ -5712,9 +6349,9 @@ function AccountMenu({
|
|
|
5712
6349
|
}
|
|
5713
6350
|
|
|
5714
6351
|
// src/NavTabs.tsx
|
|
5715
|
-
import { Fragment as
|
|
6352
|
+
import { Fragment as Fragment21, forwardRef as forwardRef13, useEffect as useEffect18, useRef as useRef23, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
5716
6353
|
import { safeUrl as safeUrl5, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
5717
|
-
import { Fragment as
|
|
6354
|
+
import { Fragment as Fragment22, jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5718
6355
|
var NavTabs = forwardRef13(function NavTabs2({
|
|
5719
6356
|
items,
|
|
5720
6357
|
active,
|
|
@@ -5732,7 +6369,7 @@ var NavTabs = forwardRef13(function NavTabs2({
|
|
|
5732
6369
|
useEffect18(() => {
|
|
5733
6370
|
if (navRef.current) revealCurrentNav(navRef.current);
|
|
5734
6371
|
}, [active, signature]);
|
|
5735
|
-
return /* @__PURE__ */
|
|
6372
|
+
return /* @__PURE__ */ jsx47(
|
|
5736
6373
|
"nav",
|
|
5737
6374
|
{
|
|
5738
6375
|
...rest,
|
|
@@ -5745,11 +6382,11 @@ var NavTabs = forwardRef13(function NavTabs2({
|
|
|
5745
6382
|
},
|
|
5746
6383
|
children: items.map((item) => {
|
|
5747
6384
|
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
5748
|
-
const inner = /* @__PURE__ */
|
|
5749
|
-
/* @__PURE__ */
|
|
5750
|
-
badge.text != null && badge.text !== "" && /* @__PURE__ */
|
|
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 })
|
|
5751
6388
|
] });
|
|
5752
|
-
if (item.disabled) return /* @__PURE__ */
|
|
6389
|
+
if (item.disabled) return /* @__PURE__ */ jsx47("span", { className: "ui-nav__tab is-disabled", "aria-disabled": "true", children: inner }, item.id);
|
|
5753
6390
|
const current = item.id === active;
|
|
5754
6391
|
const linkProps = {
|
|
5755
6392
|
className: ["ui-nav__tab", current && "is-active"].filter(Boolean).join(" "),
|
|
@@ -5758,7 +6395,7 @@ var NavTabs = forwardRef13(function NavTabs2({
|
|
|
5758
6395
|
"aria-current": current ? "page" : void 0,
|
|
5759
6396
|
children: inner
|
|
5760
6397
|
};
|
|
5761
|
-
return /* @__PURE__ */
|
|
6398
|
+
return /* @__PURE__ */ jsx47(Fragment21, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx47("a", { ...linkProps }) }, item.id);
|
|
5762
6399
|
})
|
|
5763
6400
|
}
|
|
5764
6401
|
);
|