@dcs-tech/ui 0.9.0 → 0.11.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/CHANGELOG.md +488 -0
- package/README.md +43 -7
- package/THIRD_PARTY_NOTICES.md +23 -0
- package/dist/ChartImageMenu-sB2QNQzd.js +9673 -0
- package/dist/ChartView-BstZkP1g.js +1942 -0
- package/dist/{SummaryChart-CxRjK_HU.js → SummaryChart-B5ibDNOZ.js} +11 -10
- package/dist/{SummaryImage-Crf1R-3a.js → SummaryImage-CRP7X2Nl.js} +2 -2
- package/dist/SummarySeeAll-CtYRGV4G.js +101 -0
- package/dist/assets/fileTask.worker-D97s2vRV.js +1 -0
- package/dist/columnValue-BOn9NC8X.js +644 -0
- package/dist/exportContext-CMzuzRjc.js +274 -0
- package/dist/{exportEngine-BFZD6djX.js → exportEngine-CYDN8Ty-.js} +167 -137
- package/dist/file-worker.js +1 -1
- package/dist/{fileActions-CFNO14Aj.js → fileActions-DkPEWE-t.js} +1 -1
- package/dist/{geometry-yZmKN662.js → geometry-CFS5If1N.js} +848 -439
- package/dist/index.js +24208 -12603
- package/dist/{labels-CnqqTrne.js → labels-mukFhYkc.js} +126 -1
- package/dist/{runFileTask-BIZTFnZP.js → runFileTask-DI_39TjR.js} +17 -0
- package/dist/scrollArea-B52kugL1.js +291 -0
- package/dist/style.css +1 -1
- package/dist/{summaryChartData-CARqGRUl.js → summaryChartData-D15kw64n.js} +10 -3
- package/dist/types/components/Alert/Alert.d.ts +16 -0
- package/dist/types/components/Alert/index.d.ts +2 -0
- package/dist/types/components/Card/Card.d.ts +4 -3
- package/dist/types/components/Card/index.d.ts +1 -1
- package/dist/types/components/Charts/BarList.d.ts +4 -3
- package/dist/types/components/Charts/CalendarHeatmap.d.ts +4 -2
- package/dist/types/components/Charts/Chart.d.ts +3 -2
- package/dist/types/components/Charts/ChartView.d.ts +3 -2
- package/dist/types/components/Charts/ColumnChart.d.ts +4 -3
- package/dist/types/components/Charts/Donut.d.ts +3 -2
- package/dist/types/components/Charts/Funnel.d.ts +4 -2
- package/dist/types/components/Charts/Gauge.d.ts +3 -2
- package/dist/types/components/Charts/LineChart.d.ts +4 -3
- package/dist/types/components/Charts/NumberTrend.d.ts +4 -3
- package/dist/types/components/Charts/Progress.d.ts +3 -2
- package/dist/types/components/Charts/StackedBar.d.ts +3 -2
- package/dist/types/components/Charts/Treemap.d.ts +3 -2
- package/dist/types/components/Charts/chartData.d.ts +6 -0
- package/dist/types/components/Charts/chartImage.d.ts +3 -0
- package/dist/types/components/Charts/geometry.d.ts +3 -0
- package/dist/types/components/Charts/index.d.ts +2 -0
- package/dist/types/components/Charts/palette.d.ts +1 -0
- package/dist/types/components/Charts/parts.d.ts +14 -0
- package/dist/types/components/Charts/useChartMotion.d.ts +8 -0
- package/dist/types/components/ChipInput/ChipTags.d.ts +3 -0
- package/dist/types/components/CommandPalette/CommandPaletteTrigger.d.ts +9 -0
- package/dist/types/components/CommandPalette/index.d.ts +2 -0
- package/dist/types/components/DataTable/DataTable.d.ts +3 -1
- package/dist/types/components/DataTable/DisplayPopover.d.ts +1 -0
- package/dist/types/components/DataTable/HeaderMenu.d.ts +1 -0
- package/dist/types/components/DataTable/TableColumnModal.d.ts +4 -1
- package/dist/types/components/DataTable/TablePagination.d.ts +1 -1
- package/dist/types/components/DataTable/TableToolbar.d.ts +21 -1
- package/dist/types/components/DataTable/TableView.d.ts +19 -2
- package/dist/types/components/DataTable/cards/CardView.d.ts +25 -5
- package/dist/types/components/DataTable/cards/cardFields.d.ts +1 -0
- package/dist/types/components/DataTable/cards/rowParts.d.ts +1 -0
- package/dist/types/components/DataTable/cellSelection/CellRangeBar.d.ts +16 -0
- package/dist/types/components/DataTable/cellSelection/cellRangeStore.d.ts +18 -0
- package/dist/types/components/DataTable/cellSelection/paintRanges.d.ts +2 -0
- package/dist/types/components/DataTable/cellSelection/useCellSelection.d.ts +63 -0
- package/dist/types/components/DataTable/data/listDelta.d.ts +27 -0
- package/dist/types/components/DataTable/data/rowLineage.d.ts +3 -0
- package/dist/types/components/DataTable/data/rowModels.d.ts +9 -0
- package/dist/types/components/DataTable/data/rowTransaction.d.ts +9 -0
- package/dist/types/components/DataTable/data/useServerData.d.ts +3 -1
- package/dist/types/components/DataTable/defaults.d.ts +4 -0
- package/dist/types/components/DataTable/export/exportCells.d.ts +5 -2
- package/dist/types/components/DataTable/export/exportEngine.d.ts +7 -2
- package/dist/types/components/DataTable/export/useTableExport.d.ts +17 -1
- package/dist/types/components/DataTable/filters/filterRowModel.d.ts +1 -0
- package/dist/types/components/DataTable/grouping/groupModel.d.ts +11 -0
- package/dist/types/components/DataTable/index.d.ts +1 -1
- package/dist/types/components/DataTable/keyboard/ShortcutsDialog.d.ts +4 -1
- package/dist/types/components/DataTable/keyboard/useGridKeyboard.d.ts +8 -0
- package/dist/types/components/DataTable/labels.d.ts +130 -0
- package/dist/types/components/DataTable/layout/LayoutSwitcher.d.ts +10 -2
- package/dist/types/components/DataTable/layout/useFitWidths.d.ts +7 -0
- package/dist/types/components/DataTable/menu/RowMenu.d.ts +1 -0
- package/dist/types/components/DataTable/menu/buildRowMenu.d.ts +6 -3
- package/dist/types/components/DataTable/motion/RowChangeNotice.d.ts +19 -0
- package/dist/types/components/DataTable/motion/rowChanges.d.ts +25 -0
- package/dist/types/components/DataTable/motion/useNoticeInsets.d.ts +2 -0
- package/dist/types/components/DataTable/motion/useRowChangeNotices.d.ts +35 -0
- package/dist/types/components/DataTable/motion/useRowMotion.d.ts +29 -3
- package/dist/types/components/DataTable/persistence/reconcile.d.ts +4 -0
- package/dist/types/components/DataTable/persistence/useColumnPersistence.d.ts +5 -1
- package/dist/types/components/DataTable/pivot/PivotPanel.d.ts +11 -0
- package/dist/types/components/DataTable/pivot/PivotView.d.ts +22 -0
- package/dist/types/components/DataTable/pivot/pivotModel.d.ts +54 -0
- package/dist/types/components/DataTable/pivot/usePivot.d.ts +44 -0
- package/dist/types/components/DataTable/rows/PressRow.d.ts +1 -0
- package/dist/types/components/DataTable/rows/RowLead.d.ts +23 -0
- package/dist/types/components/DataTable/rows/rowPress.d.ts +2 -0
- package/dist/types/components/DataTable/rows/usePinnedRows.d.ts +34 -0
- package/dist/types/components/DataTable/rows/useRowDrag.d.ts +44 -0
- package/dist/types/components/DataTable/split/SplitView.d.ts +4 -2
- package/dist/types/components/DataTable/summary/SummaryChart.d.ts +2 -1
- package/dist/types/components/DataTable/summary/TableSummary.d.ts +2 -1
- package/dist/types/components/DataTable/summary/summaryModel.d.ts +28 -6
- package/dist/types/components/DataTable/summary/useTableSummary.d.ts +3 -0
- package/dist/types/components/DataTable/toolbar/ToolbarMore.d.ts +14 -0
- package/dist/types/components/DataTable/toolbar/useToolbarFit.d.ts +10 -0
- package/dist/types/components/DataTable/tree/TreeChips.d.ts +5 -0
- package/dist/types/components/DataTable/tree/treeExport.d.ts +54 -0
- package/dist/types/components/DataTable/tree/treeMove.d.ts +1 -0
- package/dist/types/components/DataTable/tree/useTreeChildren.d.ts +15 -0
- package/dist/types/components/DataTable/tree/useTreeData.d.ts +60 -0
- package/dist/types/components/DataTable/types.d.ts +290 -6
- package/dist/types/components/DataTable/ui-local/TableReorderList.d.ts +13 -0
- package/dist/types/components/DataTable/ui.d.ts +2 -1
- package/dist/types/components/DataTable/useDataChangeTracker.d.ts +11 -4
- package/dist/types/components/DataTable/useTable.d.ts +14 -1
- package/dist/types/components/DataTable/virtual/useVirtualLines.d.ts +1 -0
- package/dist/types/components/DatePicker/PeriodGrid.d.ts +13 -0
- package/dist/types/components/DatePicker/PeriodPicker.d.ts +19 -0
- package/dist/types/components/DatePicker/index.d.ts +1 -1
- package/dist/types/components/Dialog/dialogSlots.d.ts +9 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +8 -0
- package/dist/types/components/EventCalendar/EventCalendar.d.ts +46 -0
- package/dist/types/components/EventCalendar/eventParts.d.ts +10 -0
- package/dist/types/components/EventCalendar/index.d.ts +3 -0
- package/dist/types/components/EventCalendar/useCalendarEdit.d.ts +40 -0
- package/dist/types/components/FieldWrapper/index.d.ts +1 -1
- package/dist/types/components/Fields/index.d.ts +1 -1
- package/dist/types/components/Icon/Icon.d.ts +36 -0
- package/dist/types/components/Icon/Icon.storyData.d.ts +6 -0
- package/dist/types/components/Icon/IconContext.d.ts +7 -0
- package/dist/types/components/Icon/icons.d.ts +223 -0
- package/dist/types/components/Icon/index.d.ts +7 -0
- package/dist/types/components/Icon/useIconDone.d.ts +5 -0
- package/dist/types/components/Image/ImageEditor.d.ts +21 -0
- package/dist/types/components/Image/ImagePicker.d.ts +10 -1
- package/dist/types/components/Image/imageRender.d.ts +33 -0
- package/dist/types/components/Image/index.d.ts +3 -1
- package/dist/types/components/Image/prepareImage.d.ts +4 -3
- package/dist/types/components/Link/Link.d.ts +22 -0
- package/dist/types/components/Link/index.d.ts +2 -0
- package/dist/types/components/NavList/NavList.d.ts +13 -0
- package/dist/types/components/NavList/index.d.ts +2 -0
- package/dist/types/components/PageProgress/PageProgress.d.ts +10 -0
- package/dist/types/components/PageProgress/index.d.ts +2 -0
- package/dist/types/components/Pagination/Pagination.d.ts +19 -0
- package/dist/types/components/Pagination/index.d.ts +2 -0
- package/dist/types/components/Popover/Popover.d.ts +2 -1
- package/dist/types/components/Popover/floatingPosition.d.ts +26 -2
- package/dist/types/components/ReorderList/ReorderGroup.d.ts +16 -0
- package/dist/types/components/ReorderList/ReorderList.d.ts +56 -0
- package/dist/types/components/ReorderList/crossListDrag.d.ts +61 -0
- package/dist/types/components/ReorderList/index.d.ts +5 -0
- package/dist/types/components/ReorderList/useReorderDrag.d.ts +28 -0
- package/dist/types/components/Scroll/ui.d.ts +1 -0
- package/dist/types/components/SlidingHighlight/index.d.ts +2 -0
- package/dist/types/components/SlidingHighlight/useSlidingHighlight.d.ts +20 -0
- package/dist/types/components/Suggest/SuggestionList.d.ts +1 -0
- package/dist/types/components/Tooltip/useTooltip.d.ts +4 -0
- package/dist/types/components/UIProvider/UILabelsContext.d.ts +120 -0
- package/dist/types/components/UIProvider/UIProvider.d.ts +2 -0
- package/dist/types/core/hooks/index.d.ts +2 -1
- package/dist/types/core/hooks/useMeasuredState.d.ts +1 -0
- package/dist/types/core/hooks/usePresence.d.ts +1 -0
- package/dist/types/core/icons/actions.icons.d.ts +37 -0
- package/dist/types/core/icons/commerce.icons.d.ts +16 -0
- package/dist/types/core/icons/communication.icons.d.ts +10 -0
- package/dist/types/core/icons/delivery.icons.d.ts +13 -0
- package/dist/types/core/icons/devices.icons.d.ts +16 -0
- package/dist/types/core/icons/files.icons.d.ts +13 -0
- package/dist/types/core/icons/general.icons.d.ts +24 -0
- package/dist/types/core/icons/index.d.ts +14 -0
- package/dist/types/core/icons/media.icons.d.ts +11 -0
- package/dist/types/core/icons/navigation.icons.d.ts +25 -0
- package/dist/types/core/icons/people.icons.d.ts +13 -0
- package/dist/types/core/icons/registry.d.ts +2 -0
- package/dist/types/core/icons/state.icons.d.ts +14 -0
- package/dist/types/core/icons/status.icons.d.ts +10 -0
- package/dist/types/core/icons/table.icons.d.ts +22 -0
- package/dist/types/core/icons/text.icons.d.ts +13 -0
- package/dist/types/core/logic/alert.logic.d.ts +3 -0
- package/dist/types/core/logic/cellRange.logic.d.ts +66 -0
- package/dist/types/core/logic/cellTouch.logic.d.ts +16 -0
- package/dist/types/core/logic/columnGroups.logic.d.ts +31 -0
- package/dist/types/core/logic/commandPalette.logic.d.ts +2 -0
- package/dist/types/core/logic/datePicker.logic.d.ts +12 -0
- package/dist/types/core/logic/dropdownSide.logic.d.ts +19 -0
- package/dist/types/core/logic/eventCalendar.logic.d.ts +225 -0
- package/dist/types/core/logic/fieldWrapper.logic.d.ts +6 -1
- package/dist/types/core/logic/fitColumns.logic.d.ts +7 -0
- package/dist/types/core/logic/icon.logic.d.ts +24 -0
- package/dist/types/core/logic/imageEditor.logic.d.ts +132 -0
- package/dist/types/core/logic/imageTransform.logic.d.ts +57 -0
- package/dist/types/core/logic/index.d.ts +25 -0
- package/dist/types/core/logic/inertProps.d.ts +3 -0
- package/dist/types/core/logic/pageProgress.logic.d.ts +3 -0
- package/dist/types/core/logic/pagination.logic.d.ts +7 -0
- package/dist/types/core/logic/periodPicker.logic.d.ts +86 -0
- package/dist/types/core/logic/pivot.logic.d.ts +100 -0
- package/dist/types/core/logic/reorder.logic.d.ts +49 -0
- package/dist/types/core/logic/rowActions.logic.d.ts +7 -0
- package/dist/types/core/logic/rowDrag.logic.d.ts +36 -0
- package/dist/types/core/logic/rowPinning.logic.d.ts +12 -0
- package/dist/types/core/logic/slidingHighlight.logic.d.ts +20 -0
- package/dist/types/core/logic/toolbarOverflow.logic.d.ts +21 -0
- package/dist/types/core/logic/treeData.logic.d.ts +44 -0
- package/dist/types/core/logic/treeDrag.logic.d.ts +63 -0
- package/dist/types/core/logic/tween.logic.d.ts +33 -0
- package/dist/types/core/logic/visualViewport.logic.d.ts +13 -0
- package/dist/types/core/types/chipinput.types.d.ts +3 -1
- package/dist/types/core/types/collapsible.types.d.ts +3 -0
- package/dist/types/core/types/datePicker.types.d.ts +7 -0
- package/dist/types/core/types/eventCalendar.types.d.ts +18 -0
- package/dist/types/core/types/field.types.d.ts +6 -3
- package/dist/types/core/types/fieldWrapper.types.d.ts +2 -0
- package/dist/types/core/types/fields.types.d.ts +6 -1
- package/dist/types/core/types/fileEngine.types.d.ts +6 -0
- package/dist/types/core/types/form.types.d.ts +1 -0
- package/dist/types/core/types/format.types.d.ts +2 -0
- package/dist/types/core/types/icon.types.d.ts +109 -0
- package/dist/types/core/types/index.d.ts +2 -0
- package/dist/types/core/types/input.types.d.ts +2 -0
- package/dist/types/core/types/navigation.types.d.ts +1 -0
- package/dist/types/core/types/select.types.d.ts +2 -6
- package/dist/types/core/types/suggest.types.d.ts +2 -0
- package/dist/types/index.d.ts +31 -6
- package/package.json +4 -4
- package/dist/ChartImageMenu-DDVNJNc6.js +0 -1499
- package/dist/ChartView-CW3m4Z_1.js +0 -1703
- package/dist/SummarySeeAll-BRHOMQRA.js +0 -101
- package/dist/assets/fileTask.worker--Q3rI3Bn.js +0 -1
- package/dist/columnValue-DwUqueZ6.js +0 -610
- package/dist/exportContext-BKFnNQ0q.js +0 -166
- package/dist/scrollArea-DbYFqbIH.js +0 -269
- package/dist/types/components/DataTable/ui-local/DragAndDropList/DragAndDropList.d.ts +0 -4
- package/dist/types/components/DataTable/ui-local/DragAndDropList/index.d.ts +0 -3
- package/dist/types/components/DataTable/ui-local/DragAndDropList/types.d.ts +0 -70
|
@@ -1,1499 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { A as e, C as t, Cn as n, Dn as r, E as i, En as a, F as o, J as s, L as c, N as l, Nn as u, O as d, P as f, Q as p, R as m, S as h, T as g, Tn as _, Y as v, _ as y, b, c as x, d as S, et as C, ft as w, g as T, h as ee, i as te, j as ne, kn as re, l as ie, r as ae, rt as oe, st as E, ut as se, w as ce, y as le } from "./geometry-yZmKN662.js";
|
|
3
|
-
import { a as ue, l as de, n as fe, o as pe, u as me } from "./fileActions-CFNO14Aj.js";
|
|
4
|
-
import { t as he } from "./runFileTask-BIZTFnZP.js";
|
|
5
|
-
import ge, { cloneElement as _e, createContext as ve, forwardRef as ye, useCallback as D, useContext as be, useEffect as O, useId as xe, useLayoutEffect as Se, useMemo as Ce, useRef as k, useState as A, useSyncExternalStore as we } from "react";
|
|
6
|
-
import { Fragment as Te, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
7
|
-
import { createPortal as Ee } from "react-dom";
|
|
8
|
-
// src/core/logic/button.logic.ts
|
|
9
|
-
function De(e) {
|
|
10
|
-
let t = e.isIconOnly && e.shape === "rounded" ? "circle" : e.shape, n = [
|
|
11
|
-
"root",
|
|
12
|
-
`variant_${e.variant}`,
|
|
13
|
-
`size_${e.size}`,
|
|
14
|
-
`color_${e.color}`,
|
|
15
|
-
`shape_${t}`
|
|
16
|
-
];
|
|
17
|
-
return e.disabled && n.push("disabled"), e.loading && (n.push("loading"), n.push(`loading_${e.loadingPosition}`)), e.fullWidth && n.push("fullWidth"), e.disableTextTransform && n.push("disableTextTransform"), e.disableElevation && n.push("disableElevation"), e.showFocusRing && n.push("showFocusRing"), e.isIconOnly && n.push("iconOnly"), n;
|
|
18
|
-
}
|
|
19
|
-
function Oe(e) {
|
|
20
|
-
let t = ["group", `orientation_${e.orientation}`];
|
|
21
|
-
return e.fullWidth && t.push("groupFullWidth"), t;
|
|
22
|
-
}
|
|
23
|
-
// src/core/logic/press.logic.ts
|
|
24
|
-
function ke(e, t) {
|
|
25
|
-
let n = t ? Math.min(Math.max(t.x, 0), e.width) : e.width / 2, r = t ? Math.min(Math.max(t.y, 0), e.height) : e.height / 2, i = Math.max(n, e.width - n), a = Math.max(r, e.height - r);
|
|
26
|
-
return {
|
|
27
|
-
x: n,
|
|
28
|
-
y: r,
|
|
29
|
-
size: 2 * Math.hypot(i, a)
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function Ae(e, t = 150) {
|
|
33
|
-
return Math.max(0, t - e);
|
|
34
|
-
}
|
|
35
|
-
// src/core/logic/fileQueue.logic.ts
|
|
36
|
-
var je = {
|
|
37
|
-
concurrency: 2,
|
|
38
|
-
maxQueued: 20,
|
|
39
|
-
timeoutMs: 12e4,
|
|
40
|
-
keepFinished: 10,
|
|
41
|
-
workers: "auto"
|
|
42
|
-
};
|
|
43
|
-
function Me(e = {}) {
|
|
44
|
-
let t = (e, t, n) => typeof e == "number" && Number.isFinite(e) && e >= n ? Math.floor(e) : t;
|
|
45
|
-
return {
|
|
46
|
-
concurrency: t(e.concurrency, je.concurrency, 1),
|
|
47
|
-
maxQueued: t(e.maxQueued, je.maxQueued, 0),
|
|
48
|
-
timeoutMs: t(e.timeoutMs, je.timeoutMs, 1),
|
|
49
|
-
keepFinished: t(e.keepFinished, je.keepFinished, 0),
|
|
50
|
-
workers: e.workers === "off" ? "off" : "auto"
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
var N = {
|
|
54
|
-
high: 0,
|
|
55
|
-
normal: 1,
|
|
56
|
-
low: 2
|
|
57
|
-
}, Ne = /* @__PURE__ */ new Set([
|
|
58
|
-
"delivered",
|
|
59
|
-
"failed",
|
|
60
|
-
"cancelled"
|
|
61
|
-
]), P = (e) => Ne.has(e.status), Pe = (e) => e.status === "queued" || e.status === "running";
|
|
62
|
-
function F(e, t) {
|
|
63
|
-
let n = e.filter((e) => e.status === "running").length, r = Math.max(0, t - n);
|
|
64
|
-
return r === 0 ? [] : e.filter((e) => e.status === "queued").sort((e, t) => N[e.priority] - N[t.priority] || e.seq - t.seq).slice(0, r).map((e) => e.id);
|
|
65
|
-
}
|
|
66
|
-
function Fe(e, t, n) {
|
|
67
|
-
let r = t.dedupeKey ? e.filter((e) => e.dedupeKey === t.dedupeKey && Pe(e)) : [];
|
|
68
|
-
if (r.length && !t.replace) return {
|
|
69
|
-
kind: "reuse",
|
|
70
|
-
id: r[0].id
|
|
71
|
-
};
|
|
72
|
-
let i = t.replace ? r.map((e) => e.id) : [];
|
|
73
|
-
return e.filter((e) => e.status === "queued" && !i.includes(e.id)).length >= n ? {
|
|
74
|
-
kind: "reject",
|
|
75
|
-
reason: "queue-full"
|
|
76
|
-
} : {
|
|
77
|
-
kind: "add",
|
|
78
|
-
cancel: i
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var Ie = (e) => e.attempts <= e.retry;
|
|
82
|
-
function Le(e, t) {
|
|
83
|
-
if (!Number.isFinite(t)) return null;
|
|
84
|
-
let n = Math.min(1, Math.max(e, t));
|
|
85
|
-
return n === e || n < 1 && n - e < .01 ? null : n;
|
|
86
|
-
}
|
|
87
|
-
function Re(e, t) {
|
|
88
|
-
return e === "download" || e === "none" ? "now" : t.activationActive === void 0 ? t.sinceSubmitMs <= 4e3 ? "now" : "wait" : t.activationActive ? "now" : "wait";
|
|
89
|
-
}
|
|
90
|
-
function ze(e, t) {
|
|
91
|
-
return e.filter(P).sort((e, t) => (t.finishedAt ?? 0) - (e.finishedAt ?? 0) || t.seq - e.seq).slice(t).map((e) => e.id);
|
|
92
|
-
}
|
|
93
|
-
// src/core/logic/useMergeRefs.ts
|
|
94
|
-
function Be(...e) {
|
|
95
|
-
let t = k(e);
|
|
96
|
-
return t.current = e, D((e) => {
|
|
97
|
-
for (let n of t.current) n && (typeof n == "function" ? n(e) : n.current = e);
|
|
98
|
-
}, []);
|
|
99
|
-
}
|
|
100
|
-
var I = {
|
|
101
|
-
tooltip: "_tooltip_2q3ib_14",
|
|
102
|
-
open: "_open_2q3ib_42",
|
|
103
|
-
tone_info: "_tone_info_2q3ib_53",
|
|
104
|
-
tone_success: "_tone_success_2q3ib_54",
|
|
105
|
-
tone_warning: "_tone_warning_2q3ib_55",
|
|
106
|
-
tone_danger: "_tone_danger_2q3ib_56",
|
|
107
|
-
placement_top: "_placement_top_2q3ib_88",
|
|
108
|
-
placement_bottom: "_placement_bottom_2q3ib_89",
|
|
109
|
-
placement_left: "_placement_left_2q3ib_90",
|
|
110
|
-
placement_right: "_placement_right_2q3ib_91",
|
|
111
|
-
measured: "_measured_2q3ib_97",
|
|
112
|
-
helpIcon: "_helpIcon_2q3ib_105",
|
|
113
|
-
disabledAnchor: "_disabledAnchor_2q3ib_138"
|
|
114
|
-
}, Ve = 500, He = 100, L = 8, Ue = 16, We = 300, Ge = 0, Ke = () => Date.now() - Ge < We, R = () => typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --probe"), qe = () => typeof HTMLElement < "u" && Object.prototype.hasOwnProperty.call(HTMLElement.prototype, "popover");
|
|
115
|
-
function Je(e) {
|
|
116
|
-
let t = r(e), n = `tooltip-${xe().replace(/:/g, "")}`, [i, o] = A(!1), [s, c] = A(t?.placement || "top"), [l, u] = A(!1), d = k(null), f = k(null), p = k(void 0), m = k(void 0), h = k(null), g = k("pointer"), _ = t?.placement || "top", v = t?.anchorTo || "auto", y = t?.delay ?? Ve, b = t?.closeDelay ?? He, x = D(() => {
|
|
117
|
-
let e = d.current, t = f.current;
|
|
118
|
-
if (!e || !t) return;
|
|
119
|
-
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = h.current, o = !!i && re({
|
|
120
|
-
anchorTo: v,
|
|
121
|
-
openedBy: g.current,
|
|
122
|
-
anchorWidth: n.width,
|
|
123
|
-
tooltipWidth: r.width
|
|
124
|
-
}), s = a({
|
|
125
|
-
anchor: o && i ? {
|
|
126
|
-
top: i.y - Ue / 2,
|
|
127
|
-
left: i.x - Ue / 2,
|
|
128
|
-
width: Ue,
|
|
129
|
-
height: Ue
|
|
130
|
-
} : {
|
|
131
|
-
top: n.top,
|
|
132
|
-
left: n.left,
|
|
133
|
-
width: n.width,
|
|
134
|
-
height: n.height
|
|
135
|
-
},
|
|
136
|
-
tooltip: {
|
|
137
|
-
width: r.width,
|
|
138
|
-
height: r.height
|
|
139
|
-
},
|
|
140
|
-
viewport: {
|
|
141
|
-
width: window.innerWidth,
|
|
142
|
-
height: window.innerHeight
|
|
143
|
-
},
|
|
144
|
-
placement: _,
|
|
145
|
-
offset: L
|
|
146
|
-
});
|
|
147
|
-
e.style.top = `${s.top}px`, e.style.left = `${s.left}px`, c(s.placement);
|
|
148
|
-
}, [_, v]), S = () => {
|
|
149
|
-
window.clearTimeout(p.current), window.clearTimeout(m.current);
|
|
150
|
-
}, C = D((e, t) => {
|
|
151
|
-
f.current = e, g.current = t, u(t === "pointer" && v !== "element"), R() && e.style.setProperty("anchor-name", `--${n}`), o(!0);
|
|
152
|
-
}, [n, v]), w = D(() => {
|
|
153
|
-
o(!1), Ge = Date.now();
|
|
154
|
-
}, []), T = D((e, t) => {
|
|
155
|
-
S();
|
|
156
|
-
let n = Ke() ? 0 : y;
|
|
157
|
-
n === 0 ? C(e, t) : p.current = window.setTimeout(() => C(e, t), n);
|
|
158
|
-
}, [y, C]), ee = D(() => {
|
|
159
|
-
S(), m.current = window.setTimeout(w, b);
|
|
160
|
-
}, [b, w]);
|
|
161
|
-
return O(() => {
|
|
162
|
-
let e = d.current;
|
|
163
|
-
if (!e) return;
|
|
164
|
-
if (!i) {
|
|
165
|
-
qe() && e.matches(":popover-open") && e.hidePopover();
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (qe() && !e.matches(":popover-open") && e.showPopover(), R() && !l) return;
|
|
169
|
-
x();
|
|
170
|
-
let t = () => x();
|
|
171
|
-
return window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), () => {
|
|
172
|
-
window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
|
|
173
|
-
};
|
|
174
|
-
}, [
|
|
175
|
-
i,
|
|
176
|
-
l,
|
|
177
|
-
x
|
|
178
|
-
]), O(() => {
|
|
179
|
-
if (!i) return;
|
|
180
|
-
let e = (e) => {
|
|
181
|
-
e.key === "Escape" && (S(), w());
|
|
182
|
-
};
|
|
183
|
-
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
184
|
-
}, [i, w]), O(() => S, []), t ? {
|
|
185
|
-
hasTooltip: !0,
|
|
186
|
-
tooltipNode: /* @__PURE__ */ j("div", {
|
|
187
|
-
ref: d,
|
|
188
|
-
id: n,
|
|
189
|
-
role: "tooltip",
|
|
190
|
-
popover: qe() ? "manual" : void 0,
|
|
191
|
-
className: [
|
|
192
|
-
I.tooltip,
|
|
193
|
-
I[`placement_${s}`],
|
|
194
|
-
t.tone && t.tone !== "default" ? I[`tone_${t.tone}`] : "",
|
|
195
|
-
i ? I.open : "",
|
|
196
|
-
l ? I.measured : "",
|
|
197
|
-
t.className || ""
|
|
198
|
-
].filter(Boolean).join(" "),
|
|
199
|
-
style: { "--tooltip-anchor": `--${n}` },
|
|
200
|
-
children: t.content
|
|
201
|
-
}),
|
|
202
|
-
triggerProps: {
|
|
203
|
-
onPointerEnter: (e) => {
|
|
204
|
-
e.pointerType !== "touch" && (h.current = {
|
|
205
|
-
x: e.clientX,
|
|
206
|
-
y: e.clientY
|
|
207
|
-
}, T(e.currentTarget, "pointer"));
|
|
208
|
-
},
|
|
209
|
-
onPointerMove: (e) => {
|
|
210
|
-
e.pointerType === "touch" || i || p.current === void 0 || (h.current = {
|
|
211
|
-
x: e.clientX,
|
|
212
|
-
y: e.clientY
|
|
213
|
-
});
|
|
214
|
-
},
|
|
215
|
-
onPointerLeave: ee,
|
|
216
|
-
onFocus: (e) => {
|
|
217
|
-
e.currentTarget.matches(":focus-visible") && (h.current = null, T(e.currentTarget, "focus"));
|
|
218
|
-
},
|
|
219
|
-
onBlur: ee,
|
|
220
|
-
"aria-describedby": i ? n : void 0
|
|
221
|
-
}
|
|
222
|
-
} : {
|
|
223
|
-
triggerProps: {
|
|
224
|
-
onPointerEnter: () => {},
|
|
225
|
-
onPointerMove: () => {},
|
|
226
|
-
onPointerLeave: () => {},
|
|
227
|
-
onFocus: () => {},
|
|
228
|
-
onBlur: () => {}
|
|
229
|
-
},
|
|
230
|
-
tooltipNode: null,
|
|
231
|
-
hasTooltip: !1
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
var Ye = {
|
|
235
|
-
press: "_press_1iawn_23",
|
|
236
|
-
ripple: "_ripple_1iawn_60",
|
|
237
|
-
rippleHost: "_rippleHost_1iawn_70",
|
|
238
|
-
wave: "_wave_1iawn_82",
|
|
239
|
-
waveGrow: "_waveGrow_1iawn_1",
|
|
240
|
-
waveFade: "_waveFade_1iawn_1",
|
|
241
|
-
waveAppear: "_waveAppear_1iawn_1"
|
|
242
|
-
}, Xe = 1500;
|
|
243
|
-
function Ze(e) {
|
|
244
|
-
let t = e.querySelector(":scope > [data-press-ripples]");
|
|
245
|
-
if (t) return t;
|
|
246
|
-
let n = document.createElement("span");
|
|
247
|
-
return n.className = Ye.rippleHost, n.setAttribute("data-press-ripples", ""), n.setAttribute("aria-hidden", "true"), e.appendChild(n), n;
|
|
248
|
-
}
|
|
249
|
-
function Qe(e, t) {
|
|
250
|
-
let n = e.getBoundingClientRect(), r = ke(n, t && {
|
|
251
|
-
x: t.x - n.left,
|
|
252
|
-
y: t.y - n.top
|
|
253
|
-
}), i = document.createElement("span");
|
|
254
|
-
return i.className = Ye.wave, i.style.left = `${r.x - r.size / 2}px`, i.style.top = `${r.y - r.size / 2}px`, i.style.width = `${r.size}px`, i.style.height = `${r.size}px`, i.appendChild(document.createElement("span")), Ze(e).appendChild(i), () => {
|
|
255
|
-
i.setAttribute("data-leaving", "");
|
|
256
|
-
let e = () => i.remove();
|
|
257
|
-
i.firstElementChild?.addEventListener("animationend", e, { once: !0 }), setTimeout(e, Xe);
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
function $e({ enabled: e = !0, ripple: t = !1, centered: n = !1, target: r } = {}) {
|
|
261
|
-
let i = k(null);
|
|
262
|
-
O(() => () => {
|
|
263
|
-
i.current && clearTimeout(i.current);
|
|
264
|
-
}, []);
|
|
265
|
-
let a = D((e, n) => {
|
|
266
|
-
if (e.matches(":disabled, [aria-disabled=\"true\"]")) return () => void 0;
|
|
267
|
-
i.current && clearTimeout(i.current);
|
|
268
|
-
let r = performance.now();
|
|
269
|
-
e.setAttribute("data-pressed", "");
|
|
270
|
-
let a = t ? Qe(e, n) : null, o = !1;
|
|
271
|
-
return () => {
|
|
272
|
-
o || (o = !0, a?.(), i.current = setTimeout(() => e.removeAttribute("data-pressed"), Ae(performance.now() - r)));
|
|
273
|
-
};
|
|
274
|
-
}, [t]), o = D((t) => {
|
|
275
|
-
if (!e || t.button !== 0) return;
|
|
276
|
-
let i = t.currentTarget, o = a(r?.current ?? i, n ? null : {
|
|
277
|
-
x: t.clientX,
|
|
278
|
-
y: t.clientY
|
|
279
|
-
});
|
|
280
|
-
window.addEventListener("pointerup", o, { once: !0 }), window.addEventListener("pointercancel", o, { once: !0 }), i.addEventListener("pointerleave", o, { once: !0 });
|
|
281
|
-
}, [
|
|
282
|
-
e,
|
|
283
|
-
n,
|
|
284
|
-
r,
|
|
285
|
-
a
|
|
286
|
-
]), s = D((t) => {
|
|
287
|
-
if (!e || t.repeat || t.key !== " " && t.key !== "Enter") return;
|
|
288
|
-
let n = t.currentTarget, i = a(r?.current ?? n, null);
|
|
289
|
-
t.key === "Enter" ? i() : n.addEventListener("keyup", i, { once: !0 });
|
|
290
|
-
}, [
|
|
291
|
-
e,
|
|
292
|
-
r,
|
|
293
|
-
a
|
|
294
|
-
]);
|
|
295
|
-
return Ce(() => ({
|
|
296
|
-
onPointerDown: o,
|
|
297
|
-
onKeyDown: s
|
|
298
|
-
}), [o, s]);
|
|
299
|
-
}
|
|
300
|
-
// src/components/Button/ButtonGroupContext.ts
|
|
301
|
-
var et = ve(null);
|
|
302
|
-
function tt() {
|
|
303
|
-
return be(et);
|
|
304
|
-
}
|
|
305
|
-
var z = {
|
|
306
|
-
root: "_root_1mlby_6",
|
|
307
|
-
size_xxs: "_size_xxs_1mlby_45",
|
|
308
|
-
size_xs: "_size_xs_1mlby_52",
|
|
309
|
-
size_small: "_size_small_1mlby_59",
|
|
310
|
-
size_medium: "_size_medium_1mlby_66",
|
|
311
|
-
size_large: "_size_large_1mlby_73",
|
|
312
|
-
size_xl: "_size_xl_1mlby_80",
|
|
313
|
-
iconOnly: "_iconOnly_1mlby_89",
|
|
314
|
-
shape_rectangle: "_shape_rectangle_1mlby_98",
|
|
315
|
-
shape_rounded: "_shape_rounded_1mlby_102",
|
|
316
|
-
shape_pill: "_shape_pill_1mlby_106",
|
|
317
|
-
shape_circle: "_shape_circle_1mlby_110",
|
|
318
|
-
shape_square: "_shape_square_1mlby_122",
|
|
319
|
-
color_primary: "_color_primary_1mlby_140",
|
|
320
|
-
color_secondary: "_color_secondary_1mlby_150",
|
|
321
|
-
color_success: "_color_success_1mlby_160",
|
|
322
|
-
color_error: "_color_error_1mlby_170",
|
|
323
|
-
color_warning: "_color_warning_1mlby_180",
|
|
324
|
-
color_info: "_color_info_1mlby_190",
|
|
325
|
-
color_neutral: "_color_neutral_1mlby_200",
|
|
326
|
-
variant_filled: "_variant_filled_1mlby_211",
|
|
327
|
-
disabled: "_disabled_1mlby_217",
|
|
328
|
-
disableElevation: "_disableElevation_1mlby_225",
|
|
329
|
-
variant_outlined: "_variant_outlined_1mlby_235",
|
|
330
|
-
variant_text: "_variant_text_1mlby_254",
|
|
331
|
-
variant_elevated: "_variant_elevated_1mlby_270",
|
|
332
|
-
variant_tonal: "_variant_tonal_1mlby_288",
|
|
333
|
-
loading: "_loading_1mlby_312",
|
|
334
|
-
fullWidth: "_fullWidth_1mlby_316",
|
|
335
|
-
disableTextTransform: "_disableTextTransform_1mlby_320",
|
|
336
|
-
showFocusRing: "_showFocusRing_1mlby_331",
|
|
337
|
-
content: "_content_1mlby_338",
|
|
338
|
-
loading_overlay: "_loading_overlay_1mlby_346",
|
|
339
|
-
loading_center: "_loading_center_1mlby_347",
|
|
340
|
-
icon: "_icon_1mlby_89",
|
|
341
|
-
loadingWrapper: "_loadingWrapper_1mlby_365",
|
|
342
|
-
loading_start: "_loading_start_1mlby_377",
|
|
343
|
-
loading_end: "_loading_end_1mlby_378",
|
|
344
|
-
spinner: "_spinner_1mlby_383",
|
|
345
|
-
spin: "_spin_1mlby_383",
|
|
346
|
-
srOnly: "_srOnly_1mlby_394",
|
|
347
|
-
group: "_group_1mlby_414",
|
|
348
|
-
orientation_horizontal: "_orientation_horizontal_1mlby_419",
|
|
349
|
-
orientation_vertical: "_orientation_vertical_1mlby_423",
|
|
350
|
-
groupFullWidth: "_groupFullWidth_1mlby_427"
|
|
351
|
-
}, nt = () => {
|
|
352
|
-
let e = u();
|
|
353
|
-
return /* @__PURE__ */ j("span", {
|
|
354
|
-
className: z.spinner,
|
|
355
|
-
role: "status",
|
|
356
|
-
"aria-label": e.common.loading,
|
|
357
|
-
children: /* @__PURE__ */ j("span", {
|
|
358
|
-
className: z.srOnly,
|
|
359
|
-
children: e.common.loading
|
|
360
|
-
})
|
|
361
|
-
});
|
|
362
|
-
}, rt = ye(({ type: e = "button", name: t, value: n, onClick: i, onFocus: a, onBlur: o, onMouseEnter: s, onMouseLeave: c, onPointerEnter: l, onPointerMove: u, onPointerLeave: d, onKeyDown: f, children: p, label: m, startIcon: h, endIcon: g, icon: _, tooltip: v, tooltipTrigger: y, disabled: b = !1, loading: x = !1, loadingPosition: S = "center", loadingIndicator: C, autoFocus: w = !1, tabIndex: T, preventDefault: ee = !1, stopPropagation: te = !1, variant: ne = "elevated", size: re = "small", color: ie = "primary", shape: ae = "rounded", className: oe = "", style: E = {}, fullWidth: se = !1, disableTextTransform: ce = !1, disableElevation: le = !1, ripple: ue, feedback: de, showFocusRing: fe = !0, id: pe, buttonRef: me, href: he, target: _e, rel: ve, download: ye, component: be, componentProps: O = {}, "aria-label": Se, "aria-labelledby": A, "aria-describedby": we, "aria-pressed": Ee, "aria-expanded": Oe, "aria-controls": ke, "aria-haspopup": Ae, role: je }, Me) => {
|
|
363
|
-
let N = tt(), Ne = N?.size || re, P = N?.variant || ne, Pe = N?.color || ie, F = N?.disabled || b, Fe = xe(), Ie = pe || Fe, Le = k(null), Re = Be(Me, me, Le);
|
|
364
|
-
ge.useEffect(() => {
|
|
365
|
-
w && Le.current && Le.current.focus();
|
|
366
|
-
}, [w]);
|
|
367
|
-
let ze = !!_ && !p && !m, Ve = p || m || "", He = D((e) => {
|
|
368
|
-
F || x || (ee && e.preventDefault(), te && e.stopPropagation(), i?.(e));
|
|
369
|
-
}, [
|
|
370
|
-
F,
|
|
371
|
-
x,
|
|
372
|
-
ee,
|
|
373
|
-
te,
|
|
374
|
-
i
|
|
375
|
-
]), L = de ?? (ue === !1 ? "none" : "ripple"), Ue = Ce(() => {
|
|
376
|
-
let e = De({
|
|
377
|
-
variant: P,
|
|
378
|
-
size: Ne,
|
|
379
|
-
color: Pe,
|
|
380
|
-
shape: ae,
|
|
381
|
-
isIconOnly: ze,
|
|
382
|
-
disabled: F,
|
|
383
|
-
loading: x,
|
|
384
|
-
loadingPosition: S,
|
|
385
|
-
fullWidth: se,
|
|
386
|
-
disableTextTransform: ce,
|
|
387
|
-
disableElevation: le,
|
|
388
|
-
showFocusRing: fe
|
|
389
|
-
}).map((e) => z[e]).filter(Boolean);
|
|
390
|
-
return L !== "none" && e.push(Ye.press), L === "ripple" && e.push(Ye.ripple), oe && e.push(oe), e.join(" ");
|
|
391
|
-
}, [
|
|
392
|
-
P,
|
|
393
|
-
Ne,
|
|
394
|
-
Pe,
|
|
395
|
-
ae,
|
|
396
|
-
ze,
|
|
397
|
-
F,
|
|
398
|
-
x,
|
|
399
|
-
S,
|
|
400
|
-
se,
|
|
401
|
-
ce,
|
|
402
|
-
le,
|
|
403
|
-
fe,
|
|
404
|
-
oe,
|
|
405
|
-
L
|
|
406
|
-
]), We = $e({
|
|
407
|
-
enabled: L !== "none",
|
|
408
|
-
ripple: L === "ripple"
|
|
409
|
-
}), Ge = D((e) => {
|
|
410
|
-
We.onPointerDown(e), O.onPointerDown?.(e);
|
|
411
|
-
}, [We, O]), Ke = D((e) => {
|
|
412
|
-
We.onKeyDown(e), f?.(e);
|
|
413
|
-
}, [We, f]), { triggerProps: R, tooltipNode: qe, hasTooltip: Xe } = Je(v), Ze = r(v), Qe = typeof Ze?.content == "string" ? Ze.content : void 0, et = (F || x) && Xe, rt = D((e) => {
|
|
414
|
-
a?.(e), R.onFocus(e);
|
|
415
|
-
}, [a, R]), B = D((e) => {
|
|
416
|
-
o?.(e), R.onBlur();
|
|
417
|
-
}, [o, R]), it = D((e) => {
|
|
418
|
-
l?.(e), R.onPointerEnter(e);
|
|
419
|
-
}, [l, R]), V = D((e) => {
|
|
420
|
-
u?.(e), R.onPointerMove(e);
|
|
421
|
-
}, [u, R]), at = D((e) => {
|
|
422
|
-
d?.(e), R.onPointerLeave();
|
|
423
|
-
}, [d, R]), ot = C || /* @__PURE__ */ j(nt, {}), H = () => S === "overlay" || S === "center" ? /* @__PURE__ */ j("span", {
|
|
424
|
-
className: `${z.loadingWrapper} ${z[`loading_${S}`] || ""}`,
|
|
425
|
-
children: ot
|
|
426
|
-
}) : ot, st = () => ze ? /* @__PURE__ */ j("span", {
|
|
427
|
-
className: z.icon,
|
|
428
|
-
children: _
|
|
429
|
-
}) : /* @__PURE__ */ M("span", {
|
|
430
|
-
className: z.content,
|
|
431
|
-
children: [
|
|
432
|
-
x && S === "start" && /* @__PURE__ */ j("span", {
|
|
433
|
-
className: `${z.loadingWrapper} ${z.loading_start || ""}`,
|
|
434
|
-
children: H()
|
|
435
|
-
}),
|
|
436
|
-
h && !x && /* @__PURE__ */ j("span", {
|
|
437
|
-
className: `${z.icon} ${z.iconStart || ""}`,
|
|
438
|
-
children: h
|
|
439
|
-
}),
|
|
440
|
-
Ve && /* @__PURE__ */ j("span", { children: Ve }),
|
|
441
|
-
g && !x && /* @__PURE__ */ j("span", {
|
|
442
|
-
className: `${z.icon} ${z.iconEnd || ""}`,
|
|
443
|
-
children: g
|
|
444
|
-
}),
|
|
445
|
-
x && S === "end" && /* @__PURE__ */ j("span", {
|
|
446
|
-
className: `${z.loadingWrapper} ${z.loading_end || ""}`,
|
|
447
|
-
children: H()
|
|
448
|
-
})
|
|
449
|
-
]
|
|
450
|
-
}), ct = x && (S === "overlay" || S === "center"), lt = {
|
|
451
|
-
ref: Re,
|
|
452
|
-
id: Ie,
|
|
453
|
-
name: t,
|
|
454
|
-
value: n,
|
|
455
|
-
disabled: F || x,
|
|
456
|
-
tabIndex: T,
|
|
457
|
-
className: Ue,
|
|
458
|
-
style: E,
|
|
459
|
-
onClick: He,
|
|
460
|
-
onFocus: rt,
|
|
461
|
-
onBlur: B,
|
|
462
|
-
onMouseEnter: s,
|
|
463
|
-
onMouseLeave: c,
|
|
464
|
-
onKeyDown: Ke,
|
|
465
|
-
"aria-label": Se || (ze ? Qe : void 0),
|
|
466
|
-
"aria-labelledby": A,
|
|
467
|
-
"aria-describedby": R["aria-describedby"] || we,
|
|
468
|
-
onPointerEnter: it,
|
|
469
|
-
onPointerMove: V,
|
|
470
|
-
onPointerLeave: at,
|
|
471
|
-
"aria-pressed": Ee,
|
|
472
|
-
"aria-expanded": Oe,
|
|
473
|
-
"aria-controls": ke,
|
|
474
|
-
"aria-haspopup": Ae,
|
|
475
|
-
"aria-busy": x || void 0,
|
|
476
|
-
"aria-disabled": F || void 0,
|
|
477
|
-
role: je || (he ? "link" : void 0),
|
|
478
|
-
...O,
|
|
479
|
-
onPointerDown: Ge
|
|
480
|
-
}, ut = /* @__PURE__ */ M(Te, { children: [st(), ct && H()] }), dt = () => {
|
|
481
|
-
if (he) {
|
|
482
|
-
let { disabled: e, ref: t, ...n } = lt;
|
|
483
|
-
return /* @__PURE__ */ j("a", {
|
|
484
|
-
...n,
|
|
485
|
-
href: he,
|
|
486
|
-
target: _e,
|
|
487
|
-
rel: ve || (_e === "_blank" ? "noopener noreferrer" : void 0),
|
|
488
|
-
download: ye,
|
|
489
|
-
children: ut
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
return j(be || "button", {
|
|
493
|
-
...lt,
|
|
494
|
-
type: e,
|
|
495
|
-
children: ut
|
|
496
|
-
});
|
|
497
|
-
};
|
|
498
|
-
return Xe ? /* @__PURE__ */ M(Te, { children: [et ? /* @__PURE__ */ j("span", {
|
|
499
|
-
className: I.disabledAnchor,
|
|
500
|
-
onPointerEnter: R.onPointerEnter,
|
|
501
|
-
onPointerLeave: R.onPointerLeave,
|
|
502
|
-
children: dt()
|
|
503
|
-
}) : dt(), qe] }) : dt();
|
|
504
|
-
});
|
|
505
|
-
rt.displayName = "Button";
|
|
506
|
-
// src/file/workerPool.ts
|
|
507
|
-
var B = class extends Error {
|
|
508
|
-
constructor(e, t) {
|
|
509
|
-
super(t), this.name = "WorkerFallback", this.reason = e;
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
function it(e) {
|
|
513
|
-
let t = [], n = /* @__PURE__ */ new Set(), r = !1, i = 0, a = () => {
|
|
514
|
-
let t = e.create();
|
|
515
|
-
return e.init !== void 0 && t.postMessage(e.init), {
|
|
516
|
-
worker: t,
|
|
517
|
-
started: !1
|
|
518
|
-
};
|
|
519
|
-
}, o = (r) => {
|
|
520
|
-
n.delete(r), t.length < e.size ? t.push(r) : r.worker.terminate();
|
|
521
|
-
}, s = (e) => {
|
|
522
|
-
n.delete(e), e.worker.terminate();
|
|
523
|
-
};
|
|
524
|
-
return {
|
|
525
|
-
get broken() {
|
|
526
|
-
return r;
|
|
527
|
-
},
|
|
528
|
-
run(e, { signal: c, progress: l }) {
|
|
529
|
-
return new Promise((u, d) => {
|
|
530
|
-
if (r) return d(new B("unavailable", "Workers are unavailable"));
|
|
531
|
-
if (c.aborted) return d(new DOMException("Aborted", "AbortError"));
|
|
532
|
-
let f;
|
|
533
|
-
try {
|
|
534
|
-
f = t.pop() ?? a();
|
|
535
|
-
} catch (e) {
|
|
536
|
-
return r = !0, d(new B("unavailable", `Worker could not be created: ${String(e)}`));
|
|
537
|
-
}
|
|
538
|
-
n.add(f);
|
|
539
|
-
let p = ++i, m = () => {
|
|
540
|
-
f.worker.removeEventListener("message", h), f.worker.removeEventListener("error", g), f.worker.removeEventListener("messageerror", _), c.removeEventListener("abort", v);
|
|
541
|
-
}, h = (e) => {
|
|
542
|
-
let t = e.data;
|
|
543
|
-
if (t && t.id === p) {
|
|
544
|
-
if (f.started = !0, t.type === "progress") return l(t.fraction);
|
|
545
|
-
m(), o(f), t.type === "done" ? u(t.buffer) : d(Error(t.message));
|
|
546
|
-
}
|
|
547
|
-
}, g = (e) => {
|
|
548
|
-
e.preventDefault?.(), m(), s(f), f.started ? d(Error(e.message || "The file worker stopped unexpectedly")) : (r = !0, d(new B("unavailable", e.message || "The file worker failed to start")));
|
|
549
|
-
}, _ = () => {
|
|
550
|
-
m(), s(f), d(/* @__PURE__ */ Error("The file worker sent a message that could not be read"));
|
|
551
|
-
}, v = () => {
|
|
552
|
-
m(), s(f), d(c.reason ?? new DOMException("Aborted", "AbortError"));
|
|
553
|
-
};
|
|
554
|
-
f.worker.addEventListener("message", h), f.worker.addEventListener("error", g), f.worker.addEventListener("messageerror", _), c.addEventListener("abort", v);
|
|
555
|
-
try {
|
|
556
|
-
f.worker.postMessage({
|
|
557
|
-
type: "run",
|
|
558
|
-
id: p,
|
|
559
|
-
task: e
|
|
560
|
-
});
|
|
561
|
-
} catch (e) {
|
|
562
|
-
m(), o(f), d(new B("uncloneable", e instanceof Error ? e.message : String(e)));
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
},
|
|
566
|
-
dispose() {
|
|
567
|
-
for (let e of [...t, ...n]) e.worker.terminate();
|
|
568
|
-
t.length = 0, n.clear();
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
// src/file/fileEngine.ts
|
|
573
|
-
var V = class extends Error {
|
|
574
|
-
constructor(e, t) {
|
|
575
|
-
super(t), this.name = "FileEngineError", this.code = e;
|
|
576
|
-
}
|
|
577
|
-
}, at = (e, t, n) => ue(e, me(t.filename) + pe(t.format), t.format, n, t.title ?? t.filename), ot = () => typeof navigator > "u" ? void 0 : navigator.userActivation?.isActive, H = (e) => e instanceof Error ? e.message : String(e), st = () => new Worker(new URL("./assets/fileTask.worker--Q3rI3Bn.js", import.meta.url), { type: "module" }), ct = () => typeof Worker < "u", lt = 0;
|
|
578
|
-
function ut(e = {}) {
|
|
579
|
-
let t = Me(e), n = e.deliver ?? at, r = `file-${++lt}-`, i = [], a = 0, o = !1, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), d = null, f = t.workers === "auto" && (!!e.createWorker || ct()), p = () => {
|
|
580
|
-
if (!f) return null;
|
|
581
|
-
if (!d) {
|
|
582
|
-
let n = typeof navigator < "u" && navigator.hardwareConcurrency ? navigator.hardwareConcurrency : t.concurrency;
|
|
583
|
-
d = it({
|
|
584
|
-
size: Math.max(1, Math.min(t.concurrency, n)),
|
|
585
|
-
create: e.createWorker ?? st,
|
|
586
|
-
...e.pdfFonts ? { init: {
|
|
587
|
-
type: "init",
|
|
588
|
-
pdfFonts: e.pdfFonts
|
|
589
|
-
} } : {}
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
return d;
|
|
593
|
-
}, m = async (t, n, r) => {
|
|
594
|
-
let i = p(), a;
|
|
595
|
-
if (i && !i.broken) try {
|
|
596
|
-
a = await i.run(t, r);
|
|
597
|
-
} catch (n) {
|
|
598
|
-
if (!(n instanceof B)) throw n;
|
|
599
|
-
a = await he(t, {
|
|
600
|
-
...r,
|
|
601
|
-
pdfFonts: e.pdfFonts
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
else a = await he(t, {
|
|
605
|
-
...r,
|
|
606
|
-
pdfFonts: e.pdfFonts
|
|
607
|
-
});
|
|
608
|
-
return new Blob([a], { type: fe[n] });
|
|
609
|
-
}, h = (e) => i.find((t) => t.id === e), g = () => u.forEach((e) => e()), _ = (e, t) => {
|
|
610
|
-
i = i.map((n) => n.id === e ? {
|
|
611
|
-
...n,
|
|
612
|
-
...t
|
|
613
|
-
} : n);
|
|
614
|
-
}, v = (e) => {
|
|
615
|
-
if (!e.length) return;
|
|
616
|
-
let t = new Set(e);
|
|
617
|
-
i = i.filter((e) => !t.has(e.id)), e.forEach((e) => {
|
|
618
|
-
s.delete(e), c.delete(e);
|
|
619
|
-
});
|
|
620
|
-
}, y = (e, t) => {
|
|
621
|
-
let n = l.get(e);
|
|
622
|
-
n && (clearTimeout(n.timer), l.delete(e), t !== void 0 && n.controller.abort(t));
|
|
623
|
-
}, b = () => {
|
|
624
|
-
v(ze(i, t.keepFinished)), o || F(i, t.concurrency).forEach(S), g();
|
|
625
|
-
}, x = (e, t) => {
|
|
626
|
-
let n = h(e);
|
|
627
|
-
n && (Ie(n) ? _(e, {
|
|
628
|
-
status: "queued",
|
|
629
|
-
progress: 0,
|
|
630
|
-
error: H(t)
|
|
631
|
-
}) : _(e, {
|
|
632
|
-
status: "failed",
|
|
633
|
-
finishedAt: Date.now(),
|
|
634
|
-
error: H(t)
|
|
635
|
-
}));
|
|
636
|
-
}, S = (e) => {
|
|
637
|
-
let n = s.get(e), r = h(e);
|
|
638
|
-
if (!n || !r) return;
|
|
639
|
-
let i = new AbortController(), a = setTimeout(() => {
|
|
640
|
-
if (!l.has(e)) return;
|
|
641
|
-
let n = new V("timeout", `Timed out after ${t.timeoutMs} ms`);
|
|
642
|
-
y(e, n), x(e, n), b();
|
|
643
|
-
}, t.timeoutMs);
|
|
644
|
-
l.set(e, {
|
|
645
|
-
controller: i,
|
|
646
|
-
timer: a
|
|
647
|
-
}), _(e, {
|
|
648
|
-
status: "running",
|
|
649
|
-
attempts: r.attempts + 1,
|
|
650
|
-
startedAt: Date.now(),
|
|
651
|
-
progress: 0,
|
|
652
|
-
error: void 0
|
|
653
|
-
});
|
|
654
|
-
let o = () => l.get(e)?.controller === i, u = (t) => {
|
|
655
|
-
if (!o()) return;
|
|
656
|
-
let n = h(e), r = n ? Le(n.progress, t) : null;
|
|
657
|
-
r !== null && (_(e, { progress: r }), g());
|
|
658
|
-
}, d;
|
|
659
|
-
try {
|
|
660
|
-
let e = {
|
|
661
|
-
signal: i.signal,
|
|
662
|
-
progress: u
|
|
663
|
-
};
|
|
664
|
-
d = n.task ? m(n.task, r.format, e) : n.build(e);
|
|
665
|
-
} catch (e) {
|
|
666
|
-
d = Promise.reject(e);
|
|
667
|
-
}
|
|
668
|
-
Promise.resolve(d).then((e) => e instanceof Blob ? e : de(r.format, e)).then((t) => {
|
|
669
|
-
if (!o()) return;
|
|
670
|
-
y(e), c.set(e, t);
|
|
671
|
-
let i = Re(r.action ?? "download", {
|
|
672
|
-
activationActive: ot(),
|
|
673
|
-
sinceSubmitMs: Date.now() - r.createdAt
|
|
674
|
-
});
|
|
675
|
-
_(e, {
|
|
676
|
-
status: "ready",
|
|
677
|
-
progress: 1,
|
|
678
|
-
finishedAt: Date.now(),
|
|
679
|
-
awaitingClick: i === "wait"
|
|
680
|
-
});
|
|
681
|
-
let a = h(e);
|
|
682
|
-
try {
|
|
683
|
-
n.onReady?.(t, a);
|
|
684
|
-
} catch {}
|
|
685
|
-
b(), i === "now" && C.deliver(e);
|
|
686
|
-
}).catch((t) => {
|
|
687
|
-
o() && (y(e), x(e, t), b());
|
|
688
|
-
});
|
|
689
|
-
}, C = {
|
|
690
|
-
submit(e) {
|
|
691
|
-
if (o) throw new V("disposed", "The file engine has been disposed");
|
|
692
|
-
let n = Fe(i, e, t.maxQueued);
|
|
693
|
-
if (n.kind === "reject") throw new V("queue-full", `The file queue is full (${t.maxQueued} waiting)`);
|
|
694
|
-
if (n.kind === "reuse") return n.id;
|
|
695
|
-
n.cancel.forEach((e) => C.cancel(e));
|
|
696
|
-
let c = r + ++a, l = Number.isInteger(e.retry) && e.retry > 0 ? e.retry : 0;
|
|
697
|
-
return s.set(c, e), i = [...i, {
|
|
698
|
-
id: c,
|
|
699
|
-
format: e.task ? e.task.kind : e.format,
|
|
700
|
-
filename: e.filename,
|
|
701
|
-
...e.title ? { title: e.title } : {},
|
|
702
|
-
action: e.action ?? "download",
|
|
703
|
-
priority: e.priority ?? "normal",
|
|
704
|
-
...e.dedupeKey ? { dedupeKey: e.dedupeKey } : {},
|
|
705
|
-
status: "queued",
|
|
706
|
-
progress: 0,
|
|
707
|
-
attempts: 0,
|
|
708
|
-
retry: l,
|
|
709
|
-
notify: e.notify ?? "all",
|
|
710
|
-
seq: a,
|
|
711
|
-
createdAt: Date.now()
|
|
712
|
-
}], b(), c;
|
|
713
|
-
},
|
|
714
|
-
cancel(e) {
|
|
715
|
-
let t = h(e);
|
|
716
|
-
t && !P(t) && (y(e, new DOMException("Cancelled", "AbortError")), c.delete(e), _(e, {
|
|
717
|
-
status: "cancelled",
|
|
718
|
-
finishedAt: Date.now(),
|
|
719
|
-
awaitingClick: !1
|
|
720
|
-
}), b());
|
|
721
|
-
},
|
|
722
|
-
retry(e) {
|
|
723
|
-
let t = h(e);
|
|
724
|
-
t && s.has(e) && (t.status === "failed" || t.status === "cancelled") && (_(e, {
|
|
725
|
-
status: "queued",
|
|
726
|
-
attempts: 0,
|
|
727
|
-
progress: 0,
|
|
728
|
-
error: void 0,
|
|
729
|
-
finishedAt: void 0,
|
|
730
|
-
seq: ++a
|
|
731
|
-
}), b());
|
|
732
|
-
},
|
|
733
|
-
async deliver(e, t) {
|
|
734
|
-
let r = h(e), i = c.get(e);
|
|
735
|
-
if (!r || r.status !== "ready" || !i) return;
|
|
736
|
-
let a = t ?? r.action;
|
|
737
|
-
try {
|
|
738
|
-
if (a !== "none" && await n(i, r, a), h(e)?.status !== "ready") return;
|
|
739
|
-
c.delete(e), _(e, {
|
|
740
|
-
status: "delivered",
|
|
741
|
-
finishedAt: Date.now(),
|
|
742
|
-
awaitingClick: !1
|
|
743
|
-
});
|
|
744
|
-
} catch (t) {
|
|
745
|
-
if (h(e)?.status !== "ready") return;
|
|
746
|
-
c.delete(e), _(e, {
|
|
747
|
-
status: "failed",
|
|
748
|
-
finishedAt: Date.now(),
|
|
749
|
-
error: H(t),
|
|
750
|
-
awaitingClick: !1
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
b();
|
|
754
|
-
},
|
|
755
|
-
wait(e) {
|
|
756
|
-
let t = () => {
|
|
757
|
-
let t = h(e);
|
|
758
|
-
if (t) return P(t) || t.status === "ready" && t.awaitingClick ? t : null;
|
|
759
|
-
}, n = t();
|
|
760
|
-
return n === null ? new Promise((e) => {
|
|
761
|
-
let n = C.subscribe(() => {
|
|
762
|
-
let r = t();
|
|
763
|
-
r !== null && (n(), e(r));
|
|
764
|
-
});
|
|
765
|
-
}) : Promise.resolve(n);
|
|
766
|
-
},
|
|
767
|
-
clear(e) {
|
|
768
|
-
v(i.filter((t) => (P(t) || e && t.status === "ready") && (!e || e(t))).map((e) => e.id)), g();
|
|
769
|
-
},
|
|
770
|
-
getJobs: () => i,
|
|
771
|
-
subscribe(e) {
|
|
772
|
-
return u.add(e), () => {
|
|
773
|
-
u.delete(e);
|
|
774
|
-
};
|
|
775
|
-
},
|
|
776
|
-
dispose() {
|
|
777
|
-
if (!o) {
|
|
778
|
-
o = !0;
|
|
779
|
-
for (let e of [...l.keys()]) y(e, new DOMException("Disposed", "AbortError")), _(e, {
|
|
780
|
-
status: "cancelled",
|
|
781
|
-
finishedAt: Date.now()
|
|
782
|
-
});
|
|
783
|
-
i.filter((e) => e.status === "queued").forEach((e) => _(e.id, {
|
|
784
|
-
status: "cancelled",
|
|
785
|
-
finishedAt: Date.now()
|
|
786
|
-
})), d?.dispose(), g(), u.clear();
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
};
|
|
790
|
-
return C;
|
|
791
|
-
}
|
|
792
|
-
// src/components/FileEngine/FileEngineContext.ts
|
|
793
|
-
var dt = ve(null), ft = null;
|
|
794
|
-
function pt() {
|
|
795
|
-
return ft ||= ut(), ft;
|
|
796
|
-
}
|
|
797
|
-
function mt() {
|
|
798
|
-
return be(dt) ?? pt();
|
|
799
|
-
}
|
|
800
|
-
function ht() {
|
|
801
|
-
let e = mt();
|
|
802
|
-
return {
|
|
803
|
-
jobs: we(e.subscribe, e.getJobs, e.getJobs),
|
|
804
|
-
submit: D((t) => e.submit(t), [e]),
|
|
805
|
-
cancel: D((t) => e.cancel(t), [e]),
|
|
806
|
-
retry: D((t) => e.retry(t), [e]),
|
|
807
|
-
deliver: D((t, n) => e.deliver(t, n), [e]),
|
|
808
|
-
wait: D((t) => e.wait(t), [e]),
|
|
809
|
-
clear: D((t) => e.clear(t), [e]),
|
|
810
|
-
engine: e
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
function gt(e) {
|
|
814
|
-
let t = mt(), n = D(() => e ? t.getJobs().find((t) => t.id === e) : void 0, [t, e]);
|
|
815
|
-
return we(t.subscribe, n, n);
|
|
816
|
-
}
|
|
817
|
-
// src/components/Charts/menuPlacement.ts
|
|
818
|
-
function _t(e, t, n, { align: r = "end", offset: i = 4, margin: a = 8 } = {}) {
|
|
819
|
-
let o = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n)), s = e.top + e.height, c = n.height - a - (s + i), l = e.top - i - a, u = t.height <= c || c >= l ? "below" : "above", d = u === "below" ? s + i : e.top - i - t.height;
|
|
820
|
-
return {
|
|
821
|
-
left: o(r === "end" ? e.left + e.width - t.width : e.left, a, n.width - t.width - a),
|
|
822
|
-
top: o(d, a, n.height - t.height - a),
|
|
823
|
-
side: u
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
function vt(e, t, n) {
|
|
827
|
-
return {
|
|
828
|
-
x: e.left - t,
|
|
829
|
-
y: e.top - n
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
// src/components/Charts/AnchoredMenu.tsx
|
|
833
|
-
var yt = () => ({
|
|
834
|
-
width: document.documentElement.clientWidth || window.innerWidth,
|
|
835
|
-
height: document.documentElement.clientHeight || window.innerHeight
|
|
836
|
-
});
|
|
837
|
-
function bt({ trigger: e, items: t, onSelect: n, align: r = "end", "aria-label": i }) {
|
|
838
|
-
let a = _(), o = k(null), s = k(null), c = k([]), [l, u] = A(!1), [d, f] = A(-1), p = D((e) => {
|
|
839
|
-
u(!1), f(-1), e && o.current?.querySelector("button")?.focus({ preventScroll: !0 });
|
|
840
|
-
}, []), m = D(() => {
|
|
841
|
-
let e = o.current, t = s.current;
|
|
842
|
-
if (!e || !t) return;
|
|
843
|
-
let n = vt(t.getBoundingClientRect(), parseFloat(t.style.left) || 0, parseFloat(t.style.top) || 0), i = _t(e.getBoundingClientRect(), {
|
|
844
|
-
width: t.offsetWidth,
|
|
845
|
-
height: t.offsetHeight
|
|
846
|
-
}, yt(), { align: r });
|
|
847
|
-
t.style.left = `${Math.round(i.left - n.x)}px`, t.style.top = `${Math.round(i.top - n.y)}px`, t.style.visibility = "visible", t.dataset.side = i.side;
|
|
848
|
-
}, [r]);
|
|
849
|
-
Se(() => {
|
|
850
|
-
l && m();
|
|
851
|
-
}, [
|
|
852
|
-
l,
|
|
853
|
-
m,
|
|
854
|
-
t.length
|
|
855
|
-
]), O(() => {
|
|
856
|
-
if (!l) return;
|
|
857
|
-
let e = 0, t = () => {
|
|
858
|
-
cancelAnimationFrame(e), e = requestAnimationFrame(m);
|
|
859
|
-
}, n = (e) => {
|
|
860
|
-
let t = e.target;
|
|
861
|
-
!s.current?.contains(t) && !o.current?.contains(t) && p(!1);
|
|
862
|
-
};
|
|
863
|
-
return window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), document.addEventListener("pointerdown", n, !0), () => {
|
|
864
|
-
cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t), document.removeEventListener("pointerdown", n, !0);
|
|
865
|
-
};
|
|
866
|
-
}, [
|
|
867
|
-
l,
|
|
868
|
-
m,
|
|
869
|
-
p
|
|
870
|
-
]), O(() => {
|
|
871
|
-
l && d >= 0 && c.current[d]?.focus({ preventScroll: !0 });
|
|
872
|
-
}, [l, d]);
|
|
873
|
-
let h = (e) => {
|
|
874
|
-
u(!0), f(e && t.length ? 0 : -1);
|
|
875
|
-
}, g = (e) => f((n) => n < 0 ? e > 0 ? 0 : t.length - 1 : (n + e + t.length) % t.length);
|
|
876
|
-
return /* @__PURE__ */ M(Te, { children: [/* @__PURE__ */ j("span", {
|
|
877
|
-
ref: o,
|
|
878
|
-
className: "chart-menu-anchor",
|
|
879
|
-
children: _e(e, {
|
|
880
|
-
"aria-haspopup": "menu",
|
|
881
|
-
"aria-expanded": l,
|
|
882
|
-
onClick: (t) => {
|
|
883
|
-
e.props.onClick?.(t), l ? p(!1) : h(!1);
|
|
884
|
-
},
|
|
885
|
-
onKeyDown: (t) => {
|
|
886
|
-
e.props.onKeyDown?.(t), l || t.key !== "ArrowDown" && t.key !== "Enter" && t.key !== " " || (t.preventDefault(), h(!0));
|
|
887
|
-
}
|
|
888
|
-
})
|
|
889
|
-
}), l && a && Ee(/* @__PURE__ */ j("div", {
|
|
890
|
-
ref: s,
|
|
891
|
-
className: "chart-menu",
|
|
892
|
-
role: "menu",
|
|
893
|
-
"aria-label": i,
|
|
894
|
-
tabIndex: -1,
|
|
895
|
-
style: {
|
|
896
|
-
left: 0,
|
|
897
|
-
top: 0,
|
|
898
|
-
visibility: "hidden"
|
|
899
|
-
},
|
|
900
|
-
onKeyDown: (e) => {
|
|
901
|
-
switch (e.key) {
|
|
902
|
-
case "ArrowDown":
|
|
903
|
-
e.preventDefault(), g(1);
|
|
904
|
-
break;
|
|
905
|
-
case "ArrowUp":
|
|
906
|
-
e.preventDefault(), g(-1);
|
|
907
|
-
break;
|
|
908
|
-
case "Home":
|
|
909
|
-
e.preventDefault(), f(0);
|
|
910
|
-
break;
|
|
911
|
-
case "End":
|
|
912
|
-
e.preventDefault(), f(t.length - 1);
|
|
913
|
-
break;
|
|
914
|
-
case "Escape":
|
|
915
|
-
e.preventDefault(), e.stopPropagation(), p(!0);
|
|
916
|
-
break;
|
|
917
|
-
case "Tab": p(!1);
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
children: t.map((e, t) => /* @__PURE__ */ M("button", {
|
|
921
|
-
ref: (e) => {
|
|
922
|
-
c.current[t] = e;
|
|
923
|
-
},
|
|
924
|
-
type: "button",
|
|
925
|
-
role: "menuitem",
|
|
926
|
-
tabIndex: d === t ? 0 : -1,
|
|
927
|
-
className: `chart-menu-item${d === t ? " chart-menu-item--cursor" : ""}`,
|
|
928
|
-
onMouseEnter: () => f(t),
|
|
929
|
-
onClick: () => {
|
|
930
|
-
p(!0), n(e.value);
|
|
931
|
-
},
|
|
932
|
-
children: [e.icon && /* @__PURE__ */ j("span", {
|
|
933
|
-
className: "chart-menu-item-icon",
|
|
934
|
-
"aria-hidden": !0,
|
|
935
|
-
children: e.icon
|
|
936
|
-
}), e.label]
|
|
937
|
-
}, e.value))
|
|
938
|
-
}), a)] });
|
|
939
|
-
}
|
|
940
|
-
// src/components/Charts/chartImage.ts
|
|
941
|
-
var U = {
|
|
942
|
-
background: "#ffffff",
|
|
943
|
-
text: "#0f0f0f",
|
|
944
|
-
muted: "#616161",
|
|
945
|
-
faint: "#737373",
|
|
946
|
-
line: "#e6e6e6",
|
|
947
|
-
track: "#ebebeb",
|
|
948
|
-
slots: oe.light,
|
|
949
|
-
heat: C.light
|
|
950
|
-
}, W = 28, G = 16, xt = 22, St = 14, Ct = 12, K = 20, q = 28, J = 220, wt = 220, Y = 44, Tt = 80, Et = 300, Dt = 36, Ot = 3, kt = 10, At = 50, X = 664, jt = (e) => ({
|
|
951
|
-
title: `700 ${xt}px ${e}`,
|
|
952
|
-
report: `600 ${St}px ${e}`,
|
|
953
|
-
big: `700 ${Y}px ${e}`,
|
|
954
|
-
bold: `700 ${St}px ${e}`,
|
|
955
|
-
text: `400 ${St}px ${e}`,
|
|
956
|
-
small: `400 ${Ct}px ${e}`
|
|
957
|
-
});
|
|
958
|
-
function Mt(e) {
|
|
959
|
-
if (e.format) return e.format;
|
|
960
|
-
let t;
|
|
961
|
-
try {
|
|
962
|
-
t = new Intl.NumberFormat(e.locale);
|
|
963
|
-
} catch {
|
|
964
|
-
t = new Intl.NumberFormat();
|
|
965
|
-
}
|
|
966
|
-
return (e) => t.format(e);
|
|
967
|
-
}
|
|
968
|
-
function Nt(e, t) {
|
|
969
|
-
try {
|
|
970
|
-
return new Intl.DateTimeFormat(t, {
|
|
971
|
-
dateStyle: "medium",
|
|
972
|
-
timeStyle: "short"
|
|
973
|
-
}).format(e);
|
|
974
|
-
} catch {
|
|
975
|
-
return e.toLocaleString();
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
var Pt = (e, t) => {
|
|
979
|
-
let n = e.reduce((e, t) => e + t.value, 0);
|
|
980
|
-
return e.map((e) => ({
|
|
981
|
-
slot: e.slot,
|
|
982
|
-
label: e.label,
|
|
983
|
-
value: `${t(e.value)} · ${s(l(e.value, n))}`
|
|
984
|
-
}));
|
|
985
|
-
};
|
|
986
|
-
function Ft(e) {
|
|
987
|
-
switch (e.kind) {
|
|
988
|
-
case "donut":
|
|
989
|
-
case "pie": return Math.max(J, e.slices.length * q);
|
|
990
|
-
case "stacked": return 48 + Math.ceil(e.slices.length / 2) * q;
|
|
991
|
-
case "bars": return (e.series.length > 1 ? q : 0) + Math.max(1, e.data.length) * q;
|
|
992
|
-
case "columns": return (e.series.length > 1 ? 44 + Math.ceil(e.series.length / 2) * q : 0) + wt + K + 8;
|
|
993
|
-
case "line": return 264 + Math.ceil(e.series.length / 2) * q;
|
|
994
|
-
case "progress": return Math.max(1, e.rows.length) * At;
|
|
995
|
-
case "number": return Y + ((e.points?.length ?? 0) > 1 ? 116 : 0) + (e.previous === void 0 ? 0 : 24);
|
|
996
|
-
case "gauge": return Rt(e.rows.length, e.variant ?? "half").height + 8 + 40;
|
|
997
|
-
case "funnel": return Math.max(1, e.steps.length) * Dt;
|
|
998
|
-
case "treemap": return 316 + Math.ceil(e.nodes.length / 2) * q;
|
|
999
|
-
case "calendar": {
|
|
1000
|
-
let { cell: t } = Lt(S(e.days).weeks);
|
|
1001
|
-
return K + 7 * (t + It) + G + q;
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
var It = 3;
|
|
1006
|
-
function Lt(e) {
|
|
1007
|
-
return { cell: Math.max(4, Math.min(16, 608 / Math.max(1, e) - It)) };
|
|
1008
|
-
}
|
|
1009
|
-
function Rt(e, t) {
|
|
1010
|
-
let n = X / Math.max(1, e), r = te[t], i = Math.min(t === "half" ? 260 : 200, n - 24);
|
|
1011
|
-
return {
|
|
1012
|
-
cell: n,
|
|
1013
|
-
width: i,
|
|
1014
|
-
height: i * r.height / r.width,
|
|
1015
|
-
k: i / r.width
|
|
1016
|
-
};
|
|
1017
|
-
}
|
|
1018
|
-
function Z(e, t, n) {
|
|
1019
|
-
if (e.measureText(t).width <= n) return t;
|
|
1020
|
-
let r = 0, i = t.length;
|
|
1021
|
-
for (; r < i;) {
|
|
1022
|
-
let a = Math.ceil((r + i) / 2);
|
|
1023
|
-
e.measureText(`${t.slice(0, a)}…`).width <= n ? r = a : i = a - 1;
|
|
1024
|
-
}
|
|
1025
|
-
return `${t.slice(0, r)}…`;
|
|
1026
|
-
}
|
|
1027
|
-
function zt(e, t, n, r = Ot) {
|
|
1028
|
-
if (r <= 1 || e.measureText(t).width <= n) return [Z(e, t, n)];
|
|
1029
|
-
let i = t.split(" "), a = "", o = 0;
|
|
1030
|
-
for (; o < i.length; o++) {
|
|
1031
|
-
let t = a ? `${a} ${i[o]}` : i[o];
|
|
1032
|
-
if (e.measureText(t).width > n) break;
|
|
1033
|
-
a = t;
|
|
1034
|
-
}
|
|
1035
|
-
return a ? [a, ...zt(e, i.slice(o).join(" "), n, r - 1)] : [Z(e, t, n)];
|
|
1036
|
-
}
|
|
1037
|
-
function Bt(e, t, n, r) {
|
|
1038
|
-
e.fillStyle = E(r, "light"), e.fillRect(t, n - 6, 12, 12);
|
|
1039
|
-
}
|
|
1040
|
-
function Q(e, t, n, r, i, a, o) {
|
|
1041
|
-
let s = (a - (o - 1) * G) / o;
|
|
1042
|
-
t.forEach((t, a) => {
|
|
1043
|
-
let c = r + a % o * (s + G), l = i + Math.floor(a / o) * q + q / 2;
|
|
1044
|
-
Bt(e, c, l, t.slot), e.font = n.bold, e.textAlign = "right", e.fillStyle = U.text, e.fillText(t.value, c + s, l);
|
|
1045
|
-
let u = e.measureText(t.value).width;
|
|
1046
|
-
e.font = n.text, e.textAlign = "left", e.fillText(Z(e, t.label, s - 20 - u - 10), c + 20, l);
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
function Vt(e, n, r, i, a, o) {
|
|
1050
|
-
let c = J / 100, u = r + J / 2, d = 40 * c;
|
|
1051
|
-
e.lineWidth = 16 * c, e.lineCap = "butt";
|
|
1052
|
-
let f = (e) => -Math.PI / 2 + e / ae * 2 * Math.PI, p = t(n);
|
|
1053
|
-
p.length || (e.globalAlpha = .5, e.strokeStyle = U.slots.rest, e.beginPath(), e.arc(138, u, d, 0, 2 * Math.PI), e.stroke(), e.globalAlpha = 1);
|
|
1054
|
-
for (let t of p) e.strokeStyle = E(t.slice.slot, "light"), e.beginPath(), e.arc(138, u, d, f(t.start), f(t.start + t.length)), e.stroke();
|
|
1055
|
-
let m = n.reduce((e, t) => e + t.value, 0), h = n[0];
|
|
1056
|
-
e.textAlign = "center", m > 0 && h ? (e.font = o.title, e.fillStyle = U.text, e.fillText(s(l(h.value, m)), 138, u - 6), e.font = o.small, e.fillStyle = U.muted, e.fillText(Z(e, h.label.toLowerCase(), d * 1.3), 138, u + 16)) : (e.font = o.small, e.fillStyle = U.muted, e.fillText(a.empty, 138, u));
|
|
1057
|
-
let g = Pt(n, i);
|
|
1058
|
-
Q(e, g, o, 276, r + Math.max(0, (J - g.length * q) / 2), 416, 1);
|
|
1059
|
-
}
|
|
1060
|
-
var $ = (e) => e - Math.PI / 2;
|
|
1061
|
-
function Ht(t, n, r, i, a, o) {
|
|
1062
|
-
let c = J / 100, l = r + J / 2, u = e(n);
|
|
1063
|
-
u.length || (t.globalAlpha = .5, t.fillStyle = U.slots.rest, t.beginPath(), t.arc(138, l, 48 * c, 0, 2 * Math.PI), t.fill(), t.globalAlpha = 1, t.font = o.small, t.textAlign = "center", t.fillStyle = U.text, t.fillText(a.empty, 138, l)), t.lineWidth = 2, t.lineJoin = "round";
|
|
1064
|
-
for (let e of u) t.fillStyle = E(e.slice.slot, "light"), t.strokeStyle = U.background, t.beginPath(), u.length > 1 && t.moveTo(138, l), t.arc(138, l, 48 * c, $(e.a0), $(e.a1)), t.closePath(), t.fill(), u.length > 1 && t.stroke();
|
|
1065
|
-
t.font = o.bold, t.textAlign = "center";
|
|
1066
|
-
for (let e of u) e.label && (t.fillStyle = se(E(e.slice.slot, "light")), t.fillText(s(e.share), W + e.label.x * c, r + e.label.y * c));
|
|
1067
|
-
let d = Pt(n, i);
|
|
1068
|
-
Q(t, d, o, 276, r + Math.max(0, (J - d.length * q) / 2), 416, 1);
|
|
1069
|
-
}
|
|
1070
|
-
function Ut(e, t, n, r, i) {
|
|
1071
|
-
let a = t.reduce((e, t) => e + t.value, 0), o = t.filter((e) => e.value > 0), s = Math.max(0, o.length - 1) * 2, c = W;
|
|
1072
|
-
e.fillStyle = U.track, a || e.fillRect(W, n, X, 32);
|
|
1073
|
-
for (let t of o) {
|
|
1074
|
-
let r = (X - s) * t.value / a;
|
|
1075
|
-
e.fillStyle = E(t.slot, "light"), e.fillRect(c, n, r, 32), c += r + 2;
|
|
1076
|
-
}
|
|
1077
|
-
Q(e, Pt(t, r), i, W, n + 32 + G, X, 2);
|
|
1078
|
-
}
|
|
1079
|
-
function Wt(e, t, n, r) {
|
|
1080
|
-
let i = W;
|
|
1081
|
-
e.font = r.text, e.textAlign = "left";
|
|
1082
|
-
for (let r of t) Bt(e, i, n, r.slot), e.fillStyle = U.text, e.fillText(r.label, i + 18, n), i += 18 + e.measureText(r.label).width + 24;
|
|
1083
|
-
}
|
|
1084
|
-
function Gt(e, t, n, r, i, a, o) {
|
|
1085
|
-
let c = r;
|
|
1086
|
-
n.length > 1 && (Wt(e, n, c + q / 2, o), c += q);
|
|
1087
|
-
let u = t.map((e) => le(e, n)), d = u.reduce((e, t) => e + t, 0);
|
|
1088
|
-
if (!d) {
|
|
1089
|
-
e.font = o.text, e.fillStyle = U.muted, e.textAlign = "left", e.fillText(a.empty, W, c + q / 2);
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
let f = ie(u), p = Math.min(200, X * .3), m = 239.2, h = 310.8;
|
|
1093
|
-
t.forEach((t, r) => {
|
|
1094
|
-
let a = c + r * q + q / 2;
|
|
1095
|
-
e.font = o.text, e.textAlign = "left", e.fillStyle = U.text, e.fillText(Z(e, t.fullLabel ?? t.label, p), W, a), e.fillStyle = U.track, e.fillRect(m, a - 7, h, 14);
|
|
1096
|
-
let g = m;
|
|
1097
|
-
for (let r of n) {
|
|
1098
|
-
let i = t.values[r.key] ?? 0;
|
|
1099
|
-
if (!i) continue;
|
|
1100
|
-
let o = i / f * h;
|
|
1101
|
-
e.fillStyle = E(n.length === 1 && t.slot ? t.slot : r.slot, "light"), e.fillRect(g, a - 7, o, 14), g += o;
|
|
1102
|
-
}
|
|
1103
|
-
e.font = o.bold, e.textAlign = "right", e.fillStyle = U.text, e.fillText(n.length === 1 ? `${i(u[r])} · ${s(l(u[r], d))}` : i(u[r]), 692, a);
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
function Kt(e, t, n, r, i, a) {
|
|
1107
|
-
let o = r + wt;
|
|
1108
|
-
e.font = a.small, e.textAlign = "right", e.lineWidth = 1;
|
|
1109
|
-
for (let r of t) {
|
|
1110
|
-
let t = o - r / n * 204;
|
|
1111
|
-
e.fillStyle = U.faint, e.fillText(i(r), 76, t), e.strokeStyle = U.line, e.setLineDash(r === 0 ? [] : [4, 4]), e.beginPath(), e.moveTo(84, t), e.lineTo(692, t), e.stroke();
|
|
1112
|
-
}
|
|
1113
|
-
return e.setLineDash([]), {
|
|
1114
|
-
plotX: 84,
|
|
1115
|
-
plotW: 608,
|
|
1116
|
-
bottom: o,
|
|
1117
|
-
plotH: 204
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
function qt(e, t, n, r, i, a, o, c) {
|
|
1121
|
-
let u = t.flatMap((e) => n.map((t) => e.values[t.key] ?? 0)), { max: f, ticks: p } = T(u), { plotX: m, plotW: h, bottom: g, plotH: _ } = Kt(e, p, f, i, a, c);
|
|
1122
|
-
if (!u.some((e) => e > 0)) e.textAlign = "center", e.fillStyle = U.muted, e.fillText(o.empty, m + h / 2, i + wt / 2);
|
|
1123
|
-
else {
|
|
1124
|
-
e.lineWidth = 2, e.lineJoin = "round";
|
|
1125
|
-
for (let i of n) {
|
|
1126
|
-
let n = d(t.map((e) => e.values[i.key] ?? 0), h, _, f).map((e) => ({
|
|
1127
|
-
x: m + e.x,
|
|
1128
|
-
y: g - _ + e.y
|
|
1129
|
-
})), a = E(i.slot, "light");
|
|
1130
|
-
r && n.length && (e.globalAlpha = .14, e.fillStyle = a, e.beginPath(), n.forEach((t, n) => n ? e.lineTo(t.x, t.y) : e.moveTo(t.x, t.y)), e.lineTo(n[n.length - 1].x, g), e.lineTo(n[0].x, g), e.closePath(), e.fill(), e.globalAlpha = 1), e.strokeStyle = a, e.beginPath(), n.forEach((t, n) => n ? e.lineTo(t.x, t.y) : e.moveTo(t.x, t.y)), e.stroke();
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
e.font = c.small, e.fillStyle = U.muted;
|
|
1134
|
-
let v = x(t.length, 6);
|
|
1135
|
-
for (let n of v) {
|
|
1136
|
-
let r = m + ne(n, t.length, h);
|
|
1137
|
-
e.textAlign = n === 0 ? "left" : n === t.length - 1 ? "right" : "center", e.fillText(Z(e, t[n].label, h / v.length), r, g + K / 2 + 4);
|
|
1138
|
-
}
|
|
1139
|
-
let y = n.map((e) => t.reduce((t, n) => t + (n.values[e.key] ?? 0), 0)), b = y.reduce((e, t) => e + t, 0);
|
|
1140
|
-
Q(e, n.map((e, t) => ({
|
|
1141
|
-
slot: e.slot,
|
|
1142
|
-
label: e.label,
|
|
1143
|
-
value: n.length > 1 ? `${a(y[t])} · ${s(l(y[t], b))}` : `${o.total}: ${a(y[t])}`
|
|
1144
|
-
})), c, W, g + K + 8 + G, X, 2);
|
|
1145
|
-
}
|
|
1146
|
-
function Jt(e, t, n, r, a, o, c, u) {
|
|
1147
|
-
let d = a;
|
|
1148
|
-
n.length > 1 && (Wt(e, n, d + q / 2, u), d += q);
|
|
1149
|
-
let p = r === "grouped" && n.length > 1, m = t.map((e) => le(e, n)), { max: h, ticks: g } = T(y(t, n, p ? "grouped" : "stacked")), { plotX: _, plotW: v, bottom: b } = Kt(e, g, h, d, o, u);
|
|
1150
|
-
if (!m.some((e) => e > 0)) {
|
|
1151
|
-
e.textAlign = "center", e.fillStyle = U.muted, e.fillText(c.empty, _ + v / 2, d + wt / 2);
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
if (n.length > 1) {
|
|
1155
|
-
let r = n.map((e) => t.reduce((t, n) => t + (n.values[e.key] ?? 0), 0)), i = r.reduce((e, t) => e + t, 0);
|
|
1156
|
-
Q(e, n.map((e, t) => ({
|
|
1157
|
-
slot: e.slot,
|
|
1158
|
-
label: e.label,
|
|
1159
|
-
value: `${o(r[t])} · ${s(l(r[t], i))}`
|
|
1160
|
-
})), u, W, b + K + 8 + G, X, 2);
|
|
1161
|
-
}
|
|
1162
|
-
let x = v / Math.max(1, t.length), S = p ? Math.min(24 * n.length, x * .8) : Math.min(48, x * .6), C = i(n.length, S, 2);
|
|
1163
|
-
t.forEach((r, i) => {
|
|
1164
|
-
let a = _ + i * x + (x - S) / 2, s = b;
|
|
1165
|
-
n.forEach((t, n) => {
|
|
1166
|
-
let i = r.values[t.key] ?? 0;
|
|
1167
|
-
if (!i) return;
|
|
1168
|
-
let o = i / h * 204;
|
|
1169
|
-
e.fillStyle = E(t.slot, "light"), p ? (e.fillRect(a + C[n].x, b - o, C[n].width, o), s = Math.min(s, b - o)) : (e.fillRect(a, s - o, S, o), s -= o);
|
|
1170
|
-
}), e.textAlign = "center", m[i] && (e.font = u.small, e.fillStyle = U.text, e.fillText(o(m[i]), a + S / 2, s - 8)), f(i, t.length) && (e.font = u.small, e.fillStyle = U.muted, e.fillText(Z(e, r.label, x - 4), a + S / 2, b + K / 2 + 4));
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
function Yt(e, t, n) {
|
|
1174
|
-
e.beginPath(), t.forEach((t, n) => n ? e.lineTo(t.x, t.y) : e.moveTo(t.x, t.y)), n !== void 0 && t.length && (e.lineTo(t[t.length - 1].x, n), e.lineTo(t[0].x, n), e.closePath());
|
|
1175
|
-
}
|
|
1176
|
-
function Xt(e, t, n, r, i, a) {
|
|
1177
|
-
let c = t.points ?? [];
|
|
1178
|
-
e.textAlign = "left", e.font = a.big, e.fillStyle = U.text;
|
|
1179
|
-
let l = r(t.value);
|
|
1180
|
-
e.fillText(l, W, n + Y / 2);
|
|
1181
|
-
let u = e.measureText(l).width, d = n + Y;
|
|
1182
|
-
if (t.previous !== void 0) {
|
|
1183
|
-
let r = m(t.current ?? c.reduce((e, t) => e + t.value, 0), t.previous), o = h(r.direction, t.good ?? "up"), l = r.direction === "up" ? "▲" : r.direction === "down" ? "▼" : "=";
|
|
1184
|
-
e.font = a.bold, e.fillStyle = E(o, "light"), e.fillText(`${l} ${r.percent === null ? i.deltaNew : s(Math.abs(r.percent))}`, W + u + 16, n + Y / 2 + 6);
|
|
1185
|
-
}
|
|
1186
|
-
if (c.length > 1) {
|
|
1187
|
-
d += G;
|
|
1188
|
-
let n = E(t.slot ?? 1, "light"), r = o(c.map((e) => e.value), X, Tt).map((e) => ({
|
|
1189
|
-
x: W + e.x,
|
|
1190
|
-
y: d + e.y
|
|
1191
|
-
}));
|
|
1192
|
-
e.globalAlpha = .14, e.fillStyle = n, Yt(e, r, d + Tt), e.fill(), e.globalAlpha = 1, e.strokeStyle = n, e.lineWidth = 2, e.lineJoin = "round", Yt(e, r), e.stroke(), d += Tt, e.font = a.small, e.fillStyle = U.muted, e.fillText(c[0].label, W, d + K / 2), e.textAlign = "right", e.fillText(c[c.length - 1].label, 692, d + K / 2), e.textAlign = "left", d += K;
|
|
1193
|
-
}
|
|
1194
|
-
t.previous !== void 0 && (e.font = a.small, e.fillStyle = U.faint, e.fillText(i.vsPrevious, W, d + 4 + K / 2));
|
|
1195
|
-
}
|
|
1196
|
-
function Zt(e, t, n, r, i, a) {
|
|
1197
|
-
if (t.reduce((e, t) => e + Math.max(0, t.value), 0) <= 0) {
|
|
1198
|
-
e.font = a.text, e.fillStyle = U.muted, e.textAlign = "left", e.fillText(i.empty, W, n + K / 2);
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
let o = c(t, X, Et);
|
|
1202
|
-
for (let t of o) {
|
|
1203
|
-
let i = t.parent ?? t.node, o = E(i.slot, "light"), s = !!t.node.children?.some((e) => e.value > 0);
|
|
1204
|
-
t.parent && (e.globalAlpha = ee(t.parent.children.filter((e) => e.value > 0).indexOf(t.node))), e.fillStyle = o, e.fillRect(W + t.rect.x + 1, n + t.rect.y + 1, Math.max(0, t.rect.w - 2), Math.max(0, t.rect.h - 2)), e.globalAlpha = 1, t.label && (e.textAlign = "left", e.fillStyle = se(o), e.font = a.bold, e.fillText(Z(e, t.node.label, t.rect.w - 12), W + t.rect.x + 6, n + t.rect.y + (s ? 9 : 12)), s || (e.font = a.small, e.fillText(Z(e, r(t.node.value), t.rect.w - 12), W + t.rect.x + 6, n + t.rect.y + 28)));
|
|
1205
|
-
}
|
|
1206
|
-
Q(e, Pt(t, r), a, W, n + Et + G, X, 2);
|
|
1207
|
-
}
|
|
1208
|
-
function Qt(e, t) {
|
|
1209
|
-
try {
|
|
1210
|
-
return new Intl.DateTimeFormat(e, {
|
|
1211
|
-
...t,
|
|
1212
|
-
timeZone: "UTC"
|
|
1213
|
-
});
|
|
1214
|
-
} catch {
|
|
1215
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
1216
|
-
...t,
|
|
1217
|
-
timeZone: "UTC"
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
function $t(e, t, n, r, i, a, o) {
|
|
1222
|
-
let s = S(t), { cell: c } = Lt(s.weeks), l = c + It, u = n + K;
|
|
1223
|
-
e.font = a.small, e.textAlign = "left", e.fillStyle = U.muted;
|
|
1224
|
-
let d = Qt(o, { month: "short" });
|
|
1225
|
-
for (let t of s.months) e.fillText(d.format(b(`${t.month}-01`)), 84 + t.week * l, n + K / 2);
|
|
1226
|
-
let f = Qt(o, { weekday: "short" });
|
|
1227
|
-
for (let t = 0; t < 7; t += 2) e.fillText(Z(e, f.format(Date.UTC(2024, 0, 1 + t)), 50), W, u + t * l + c / 2);
|
|
1228
|
-
for (let t of s.cells) e.fillStyle = U.heat[t.level], e.fillRect(84 + t.week * l, u + t.weekday * l, c, c);
|
|
1229
|
-
let p = u + 7 * l + G + q / 2;
|
|
1230
|
-
e.fillStyle = U.muted, e.fillText(i.less, W, p);
|
|
1231
|
-
let m = W + e.measureText(i.less).width + 8;
|
|
1232
|
-
for (let t of U.heat) e.fillStyle = t, e.fillRect(m, p - 6, 12, 12), m += 15;
|
|
1233
|
-
e.fillStyle = U.muted, e.fillText(i.more, m + 5, p);
|
|
1234
|
-
let h = s.cells.reduce((e, t) => t.count > (e?.count ?? 0) ? t : e, null);
|
|
1235
|
-
e.textAlign = "right", e.font = a.bold, e.fillStyle = U.text;
|
|
1236
|
-
let g = Qt(o, { dateStyle: "medium" });
|
|
1237
|
-
e.fillText(`${i.total}: ${r(s.total)}${h ? ` · ${i.busiest}: ${g.format(b(h.day))} (${r(h.count)})` : ""}`, 692, p);
|
|
1238
|
-
}
|
|
1239
|
-
function en(e, t, n, r, i, a) {
|
|
1240
|
-
if (!t.some((e) => e.value > 0)) {
|
|
1241
|
-
e.font = a.text, e.fillStyle = U.muted, e.textAlign = "left", e.fillText(i.empty, W, n + K / 2);
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
let o = Math.min(180, X * .26), c = 317.36;
|
|
1245
|
-
ce(t).forEach(({ step: t, width: i, ofFirst: l, drop: u }, d) => {
|
|
1246
|
-
let f = n + d * Dt + Dt / 2;
|
|
1247
|
-
e.font = a.bold, e.textAlign = "left", e.fillStyle = U.text, e.fillText(Z(e, t.label, o), W, f);
|
|
1248
|
-
let p = Math.max(2, c * i), m = 212.64000000000001 + (c - p) / 2, h = E(t.slot, "light");
|
|
1249
|
-
e.fillStyle = h, e.fillRect(m, f - 13, p, 26), e.textAlign = "center";
|
|
1250
|
-
let g = r(t.value);
|
|
1251
|
-
e.measureText(g).width + 12 <= p ? (e.fillStyle = se(h), e.fillText(g, m + p / 2, f)) : (e.fillStyle = U.text, e.textAlign = "left", e.fillText(g, m + p + 6, f)), e.textAlign = "right", u !== null && (e.fillStyle = u === 0 ? U.muted : E(u > 0 ? "negative" : "positive", "light"), e.fillText(v(u), 692, f - 7)), e.font = a.small, e.fillStyle = U.muted, e.fillText(s(l), 692, u === null ? f : f + 8);
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
function tn(e, t, n, r, i, a, o) {
|
|
1255
|
-
let { cell: c, width: u, height: d, k: f } = Rt(t.length, n), p = te[n];
|
|
1256
|
-
t.length ? t.forEach((t, m) => {
|
|
1257
|
-
let h = W + m * c + (c - u) / 2 + p.cx * f, _ = r + p.cy * f, v = l(t.value, t.total), { a0: y, a1: b, end: x } = g(n, v);
|
|
1258
|
-
e.lineWidth = 12 * f, e.lineCap = "round", e.strokeStyle = U.track, e.beginPath(), e.arc(h, _, p.r * f, $(y), $(b)), e.stroke(), v > 0 && (e.strokeStyle = E(w(t.color ?? 1, v), "light"), e.beginPath(), e.arc(h, _, p.r * f, $(y), $(Math.max(x, y + .01))), e.stroke()), e.lineCap = "butt", e.textAlign = "center", e.font = o.title, e.fillStyle = U.text, e.fillText(s(v), h, n === "half" ? _ - xt / 2 : _);
|
|
1259
|
-
let S = W + m * c + c / 2;
|
|
1260
|
-
e.font = o.bold, e.fillText(Z(e, t.label, c - 8), S, r + d + 8 + K / 2), e.font = o.text, e.fillStyle = U.muted, e.fillText(Z(e, `${a.ofTotal(i(t.value), i(t.total))} · ${s(v)}`, c - 8), S, r + d + 8 + K * 1.5);
|
|
1261
|
-
}) : (e.font = o.text, e.fillStyle = U.muted, e.textAlign = "left", e.fillText(a.empty, W, r + K / 2));
|
|
1262
|
-
}
|
|
1263
|
-
function nn(e, t, n, r, i, a) {
|
|
1264
|
-
t.length ? t.forEach((t, o) => {
|
|
1265
|
-
let c = n + o * At, l = t.total > 0 ? t.value / t.total * 100 : 0, u = `${i.ofTotal(r(t.value), r(t.total))} · ${s(l)}`;
|
|
1266
|
-
e.font = a.bold, e.textAlign = "right", e.fillStyle = U.text, e.fillText(u, 692, c + K / 2);
|
|
1267
|
-
let d = e.measureText(u).width;
|
|
1268
|
-
e.font = a.text, e.textAlign = "left", e.fillText(Z(e, t.label, X - d - 16), W, c + K / 2);
|
|
1269
|
-
let f = c + K + 4;
|
|
1270
|
-
e.fillStyle = U.track, e.fillRect(W, f, X, kt), e.fillStyle = E(w(t.color ?? 1, l), "light"), l > 0 && e.fillRect(W, f, X * Math.min(100, l) / 100, kt);
|
|
1271
|
-
}) : (e.font = a.text, e.fillStyle = U.muted, e.textAlign = "left", e.fillText(i.empty, W, n + K / 2));
|
|
1272
|
-
}
|
|
1273
|
-
function rn(e, t, n) {
|
|
1274
|
-
let r = e.getContext("2d");
|
|
1275
|
-
if (!r) throw Error("No 2D canvas");
|
|
1276
|
-
let i = jt(n.fontFamily), a = {
|
|
1277
|
-
...p,
|
|
1278
|
-
...t.labels
|
|
1279
|
-
}, o = Mt(t), s = n.pixelRatio ?? 2;
|
|
1280
|
-
r.font = i.text;
|
|
1281
|
-
let c = t.context ? zt(r, t.context, X) : [], l = W + ((t.report ? 24 : 0) + xt + 8 + c.length * K) + G + Ft(t.chart) + G + K + W;
|
|
1282
|
-
e.width = 720 * s, e.height = l * s, r.setTransform(s, 0, 0, s, 0, 0), r.textBaseline = "middle", r.fillStyle = U.background, r.fillRect(0, 0, 720, l);
|
|
1283
|
-
let u = W;
|
|
1284
|
-
r.textAlign = "left", t.report && (r.font = i.report, r.fillStyle = U.muted, r.fillText(Z(r, t.report, X), W, u + K / 2), u += 24), r.font = i.title, r.fillStyle = U.text, r.fillText(Z(r, t.title, X), W, u + xt / 2), u += 30, r.font = i.text, r.fillStyle = U.muted;
|
|
1285
|
-
for (let e of c) r.fillText(e, W, u + K / 2), u += K;
|
|
1286
|
-
u += G;
|
|
1287
|
-
let d = t.chart;
|
|
1288
|
-
switch (d.kind) {
|
|
1289
|
-
case "donut":
|
|
1290
|
-
Vt(r, d.slices, u, o, a, i);
|
|
1291
|
-
break;
|
|
1292
|
-
case "pie":
|
|
1293
|
-
Ht(r, d.slices, u, o, a, i);
|
|
1294
|
-
break;
|
|
1295
|
-
case "stacked":
|
|
1296
|
-
Ut(r, d.slices, u, o, i);
|
|
1297
|
-
break;
|
|
1298
|
-
case "bars":
|
|
1299
|
-
Gt(r, d.data, d.series, u, o, a, i);
|
|
1300
|
-
break;
|
|
1301
|
-
case "progress":
|
|
1302
|
-
nn(r, d.rows, u, o, a, i);
|
|
1303
|
-
break;
|
|
1304
|
-
case "columns":
|
|
1305
|
-
Jt(r, d.data, d.series, d.mode ?? "stacked", u, o, a, i);
|
|
1306
|
-
break;
|
|
1307
|
-
case "line":
|
|
1308
|
-
qt(r, d.data, d.series, !!d.area, u, o, a, i);
|
|
1309
|
-
break;
|
|
1310
|
-
case "number":
|
|
1311
|
-
Xt(r, d, u, o, a, i);
|
|
1312
|
-
break;
|
|
1313
|
-
case "gauge":
|
|
1314
|
-
tn(r, d.rows, d.variant ?? "half", u, o, a, i);
|
|
1315
|
-
break;
|
|
1316
|
-
case "funnel":
|
|
1317
|
-
en(r, d.steps, u, o, a, i);
|
|
1318
|
-
break;
|
|
1319
|
-
case "calendar":
|
|
1320
|
-
$t(r, d.days, u, o, a, i, t.locale);
|
|
1321
|
-
break;
|
|
1322
|
-
case "treemap": Zt(r, d.nodes, u, o, a, i);
|
|
1323
|
-
}
|
|
1324
|
-
u += Ft(d) + G, r.font = i.small, r.fillStyle = U.faint, r.textAlign = "left", r.fillText(Nt(t.at ?? /* @__PURE__ */ new Date(), t.locale), W, u + K / 2), t.branding && (r.textAlign = "right", r.fillText(Z(r, t.branding, X / 2), 692, u + K / 2));
|
|
1325
|
-
}
|
|
1326
|
-
function an(e) {
|
|
1327
|
-
return [
|
|
1328
|
-
e.report ?? "",
|
|
1329
|
-
e.title,
|
|
1330
|
-
e.context ?? "",
|
|
1331
|
-
e.branding ?? "",
|
|
1332
|
-
...on(e.chart)
|
|
1333
|
-
].join(" ");
|
|
1334
|
-
}
|
|
1335
|
-
function on(e) {
|
|
1336
|
-
switch (e.kind) {
|
|
1337
|
-
case "donut":
|
|
1338
|
-
case "pie":
|
|
1339
|
-
case "stacked": return e.slices.map((e) => e.label);
|
|
1340
|
-
case "funnel": return e.steps.map((e) => e.label);
|
|
1341
|
-
case "calendar": return [];
|
|
1342
|
-
case "treemap": return e.nodes.flatMap((e) => [e.label, ...(e.children ?? []).map((e) => e.label)]);
|
|
1343
|
-
case "progress":
|
|
1344
|
-
case "gauge": return e.rows.map((e) => e.label);
|
|
1345
|
-
case "number": return (e.points ?? []).map((e) => e.label);
|
|
1346
|
-
case "bars":
|
|
1347
|
-
case "columns":
|
|
1348
|
-
case "line": return [...e.data.map((e) => e.fullLabel ?? e.label), ...e.series.map((e) => e.label)];
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
async function sn(e, t = {}) {
|
|
1352
|
-
let n = t.fontFamily || (typeof document < "u" ? getComputedStyle(document.body).fontFamily : "") || "sans-serif", r = jt(n);
|
|
1353
|
-
if (typeof document < "u" && document.fonts) {
|
|
1354
|
-
let t = an(e);
|
|
1355
|
-
await Promise.all([
|
|
1356
|
-
r.report,
|
|
1357
|
-
r.title,
|
|
1358
|
-
r.bold,
|
|
1359
|
-
r.text
|
|
1360
|
-
].map((e) => document.fonts.load(e, t).catch(() => []))), await document.fonts.ready;
|
|
1361
|
-
}
|
|
1362
|
-
let i = document.createElement("canvas");
|
|
1363
|
-
return rn(i, e, { fontFamily: n }), new Promise((e, t) => i.toBlob((n) => n ? e(n) : t(/* @__PURE__ */ Error("No image")), "image/png"));
|
|
1364
|
-
}
|
|
1365
|
-
function cn(e, t = /* @__PURE__ */ new Date(), n) {
|
|
1366
|
-
let r = [n, e].filter(Boolean).join(" ").trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "chart", i = (e) => String(e).padStart(2, "0");
|
|
1367
|
-
return `${r}-${t.getFullYear()}-${i(t.getMonth() + 1)}-${i(t.getDate())}-${i(t.getHours())}${i(t.getMinutes())}.png`;
|
|
1368
|
-
}
|
|
1369
|
-
// src/components/Charts/ChartImageMenu.tsx
|
|
1370
|
-
var ln = 2e3;
|
|
1371
|
-
function un() {
|
|
1372
|
-
if (typeof navigator > "u") return {
|
|
1373
|
-
copy: !1,
|
|
1374
|
-
share: !1
|
|
1375
|
-
};
|
|
1376
|
-
let e = typeof navigator.clipboard?.write == "function" && typeof ClipboardItem < "u", t = !1;
|
|
1377
|
-
try {
|
|
1378
|
-
t = typeof navigator.share == "function" && typeof navigator.canShare == "function" && navigator.canShare({ files: [new File([], "chart.png", { type: "image/png" })] });
|
|
1379
|
-
} catch {
|
|
1380
|
-
t = !1;
|
|
1381
|
-
}
|
|
1382
|
-
return {
|
|
1383
|
-
copy: e,
|
|
1384
|
-
share: t
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
var dn = (e) => /* @__PURE__ */ j("svg", {
|
|
1388
|
-
width: "16",
|
|
1389
|
-
height: "16",
|
|
1390
|
-
viewBox: "0 0 24 24",
|
|
1391
|
-
fill: "none",
|
|
1392
|
-
stroke: "currentColor",
|
|
1393
|
-
strokeWidth: "2",
|
|
1394
|
-
strokeLinecap: "round",
|
|
1395
|
-
strokeLinejoin: "round",
|
|
1396
|
-
"aria-hidden": !0,
|
|
1397
|
-
children: /* @__PURE__ */ j("path", { d: e })
|
|
1398
|
-
}), fn = () => dn("M12 4v11M7 10l5 5 5-5M5 20h14"), pn = () => dn("M9 9h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1zM5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"), mn = () => /* @__PURE__ */ j("svg", {
|
|
1399
|
-
width: "16",
|
|
1400
|
-
height: "16",
|
|
1401
|
-
viewBox: "0 0 24 24",
|
|
1402
|
-
fill: "none",
|
|
1403
|
-
stroke: "currentColor",
|
|
1404
|
-
strokeWidth: "2",
|
|
1405
|
-
strokeLinecap: "round",
|
|
1406
|
-
strokeLinejoin: "round",
|
|
1407
|
-
"aria-hidden": !0,
|
|
1408
|
-
children: /* @__PURE__ */ j("path", { d: "M4 12v7a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-7M16 6l-4-4-4 4M12 2v13" })
|
|
1409
|
-
});
|
|
1410
|
-
function hn(e) {
|
|
1411
|
-
let t = {
|
|
1412
|
-
...p,
|
|
1413
|
-
...u().charts,
|
|
1414
|
-
...e.labels
|
|
1415
|
-
}, r = mt(), i = n().locale, a = Ce(un, []), o = k(null), [s, c] = A(null);
|
|
1416
|
-
O(() => {
|
|
1417
|
-
if (!s) return;
|
|
1418
|
-
let e = setTimeout(() => c(null), ln);
|
|
1419
|
-
return () => clearTimeout(e);
|
|
1420
|
-
}, [s]);
|
|
1421
|
-
let l = [
|
|
1422
|
-
{
|
|
1423
|
-
value: "download",
|
|
1424
|
-
label: t.imageDownload,
|
|
1425
|
-
icon: /* @__PURE__ */ j(fn, {})
|
|
1426
|
-
},
|
|
1427
|
-
...a.copy ? [{
|
|
1428
|
-
value: "copy",
|
|
1429
|
-
label: t.imageCopy,
|
|
1430
|
-
icon: /* @__PURE__ */ j(pn, {})
|
|
1431
|
-
}] : [],
|
|
1432
|
-
...a.share ? [{
|
|
1433
|
-
value: "share",
|
|
1434
|
-
label: t.imageShare,
|
|
1435
|
-
icon: /* @__PURE__ */ j(mn, {})
|
|
1436
|
-
}] : []
|
|
1437
|
-
], d = async (n) => {
|
|
1438
|
-
c(null);
|
|
1439
|
-
let a = /* @__PURE__ */ new Date(), s = cn(e.title, a, e.report), l = () => sn({
|
|
1440
|
-
...e,
|
|
1441
|
-
locale: e.locale ?? i,
|
|
1442
|
-
at: a
|
|
1443
|
-
}, { fontFamily: o.current ? getComputedStyle(o.current).fontFamily : void 0 });
|
|
1444
|
-
try {
|
|
1445
|
-
if (n === "copy") {
|
|
1446
|
-
await navigator.clipboard.write([new ClipboardItem({ "image/png": l() })]), c({
|
|
1447
|
-
tone: "done",
|
|
1448
|
-
text: t.imageCopied
|
|
1449
|
-
});
|
|
1450
|
-
return;
|
|
1451
|
-
}
|
|
1452
|
-
let i = r.submit({
|
|
1453
|
-
format: "png",
|
|
1454
|
-
filename: s.replace(/\.png$/i, ""),
|
|
1455
|
-
title: e.title,
|
|
1456
|
-
action: n,
|
|
1457
|
-
dedupeKey: `dcs-chart-image:${s}:${n}`,
|
|
1458
|
-
notify: "awaiting-click",
|
|
1459
|
-
build: () => l()
|
|
1460
|
-
});
|
|
1461
|
-
(await r.wait(i))?.status === "failed" && c({
|
|
1462
|
-
tone: "failed",
|
|
1463
|
-
text: t.imageFailed
|
|
1464
|
-
});
|
|
1465
|
-
} catch (e) {
|
|
1466
|
-
e?.name !== "AbortError" && c({
|
|
1467
|
-
tone: "failed",
|
|
1468
|
-
text: t.imageFailed
|
|
1469
|
-
});
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
return /* @__PURE__ */ M("span", {
|
|
1473
|
-
ref: o,
|
|
1474
|
-
className: "chart-root chart-image-menu",
|
|
1475
|
-
children: [/* @__PURE__ */ j(bt, {
|
|
1476
|
-
"aria-label": t.imageMenu,
|
|
1477
|
-
items: l,
|
|
1478
|
-
onSelect: (e) => void d(e),
|
|
1479
|
-
trigger: /* @__PURE__ */ j(rt, {
|
|
1480
|
-
variant: "text",
|
|
1481
|
-
color: "neutral",
|
|
1482
|
-
size: "xs",
|
|
1483
|
-
startIcon: /* @__PURE__ */ j(mn, {}),
|
|
1484
|
-
"aria-label": `${t.imageMenu}: ${e.title}`,
|
|
1485
|
-
tooltip: t.imageMenu
|
|
1486
|
-
})
|
|
1487
|
-
}), /* @__PURE__ */ j("span", {
|
|
1488
|
-
className: "chart-image-status",
|
|
1489
|
-
role: "status",
|
|
1490
|
-
"aria-live": "polite",
|
|
1491
|
-
"data-tone": s?.tone,
|
|
1492
|
-
children: s && /* @__PURE__ */ M(Te, { children: [s.tone === "done" && /* @__PURE__ */ j("span", {
|
|
1493
|
-
"aria-hidden": !0,
|
|
1494
|
-
children: "✓"
|
|
1495
|
-
}), s.text] })
|
|
1496
|
-
})]
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
export { Oe as C, Be as S, et as _, rn as a, Je as b, _t as c, mt as d, gt as f, z as g, rt as h, cn as i, dt as l, ut as m, U as n, bt as o, V as p, sn as r, vt as s, hn as t, ht as u, $e as v, I as x, Ye as y };
|