@orianatech/pire 2.2.0 → 2.3.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/dist/components/data/DataTable.d.cts +12 -1
- package/dist/components/data/DataTable.d.ts +12 -1
- package/dist/components/feedback/ProgressBar.d.cts +5 -1
- package/dist/components/feedback/ProgressBar.d.ts +5 -1
- package/dist/components/forms/FieldHelp.d.cts +1 -1
- package/dist/components/forms/FieldHelp.d.ts +1 -1
- package/dist/components/layout/PageHeader.d.cts +7 -1
- package/dist/components/layout/PageHeader.d.ts +7 -1
- package/dist/components.css +15 -0
- package/dist/index.cjs +196 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +159 -131
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1019,10 +1019,28 @@ function Kbd({ children, size = "md", className, ...rest }) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
1021
|
// src/components/forms/FieldHelp.tsx
|
|
1022
|
+
import * as React10 from "react";
|
|
1022
1023
|
import { ButtonContext } from "react-aria-components";
|
|
1023
1024
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1024
1025
|
function FieldHelp({ children, label, placement = "top" }) {
|
|
1025
1026
|
const msg = usePireMessages();
|
|
1027
|
+
const [isMounted, setIsMounted] = React10.useState(false);
|
|
1028
|
+
const button = (
|
|
1029
|
+
// hideTooltip because IconButton builds its own tooltip from `label`, and `label` here is the
|
|
1030
|
+
// icon's name, not the explanation. The explanation is the Tooltip below.
|
|
1031
|
+
/* @__PURE__ */ jsx17(
|
|
1032
|
+
IconButton,
|
|
1033
|
+
{
|
|
1034
|
+
ref: isMounted ? void 0 : (el) => {
|
|
1035
|
+
if (el) setIsMounted(true);
|
|
1036
|
+
},
|
|
1037
|
+
icon: "help-circle",
|
|
1038
|
+
label: label ?? msg.fieldHelp,
|
|
1039
|
+
size: "sm",
|
|
1040
|
+
hideTooltip: true
|
|
1041
|
+
}
|
|
1042
|
+
)
|
|
1043
|
+
);
|
|
1026
1044
|
return (
|
|
1027
1045
|
// React Aria hands every descendant Button the nearest slotted ButtonContext. Inside a
|
|
1028
1046
|
// NumberField that context has only `increment` and `decrement`, and an unslotted Button
|
|
@@ -1031,7 +1049,7 @@ function FieldHelp({ children, label, placement = "top" }) {
|
|
|
1031
1049
|
// renders. `value={null}` is React Aria's own idiom for lifting a subtree back out of a
|
|
1032
1050
|
// slotted context — the same one `MultiComboBox` and `FieldLabel` use — and is what makes
|
|
1033
1051
|
// this component safe anywhere.
|
|
1034
|
-
/* @__PURE__ */ jsx17(ButtonContext.Provider, { value: null, children: /* @__PURE__ */ jsx17(Tooltip, { label: children, placement, children:
|
|
1052
|
+
/* @__PURE__ */ jsx17(ButtonContext.Provider, { value: null, children: isMounted ? /* @__PURE__ */ jsx17(Tooltip, { label: children, placement, children: button }) : button })
|
|
1035
1053
|
);
|
|
1036
1054
|
}
|
|
1037
1055
|
function NamedFieldHelp({ label, children }) {
|
|
@@ -1077,7 +1095,7 @@ function FormField({
|
|
|
1077
1095
|
}
|
|
1078
1096
|
|
|
1079
1097
|
// src/components/forms/Input.tsx
|
|
1080
|
-
import * as
|
|
1098
|
+
import * as React11 from "react";
|
|
1081
1099
|
import { TextField, Input as AriaInput, Group, FieldError } from "react-aria-components";
|
|
1082
1100
|
|
|
1083
1101
|
// src/components/forms/FieldClearButton.tsx
|
|
@@ -1165,7 +1183,7 @@ function Input({
|
|
|
1165
1183
|
}) {
|
|
1166
1184
|
const msg = usePireMessages();
|
|
1167
1185
|
const isControlled = rest.value !== void 0;
|
|
1168
|
-
const [ownValue, setOwnValue] =
|
|
1186
|
+
const [ownValue, setOwnValue] = React11.useState(rest.defaultValue ?? "");
|
|
1169
1187
|
const currentValue = isControlled ? rest.value : ownValue;
|
|
1170
1188
|
const handleChange = (next) => {
|
|
1171
1189
|
setOwnValue(next);
|
|
@@ -1210,10 +1228,10 @@ function Input({
|
|
|
1210
1228
|
}
|
|
1211
1229
|
|
|
1212
1230
|
// src/components/forms/TextArea.tsx
|
|
1213
|
-
import * as
|
|
1231
|
+
import * as React12 from "react";
|
|
1214
1232
|
import { TextField as TextField2, TextArea as AriaTextArea, Group as Group2, FieldError as FieldError2 } from "react-aria-components";
|
|
1215
1233
|
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1216
|
-
var useIsomorphicLayoutEffect = typeof document === "undefined" ?
|
|
1234
|
+
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React12.useEffect : React12.useLayoutEffect;
|
|
1217
1235
|
function TextArea({
|
|
1218
1236
|
label,
|
|
1219
1237
|
description,
|
|
@@ -1230,8 +1248,8 @@ function TextArea({
|
|
|
1230
1248
|
onChange,
|
|
1231
1249
|
...rest
|
|
1232
1250
|
}) {
|
|
1233
|
-
const innerRef =
|
|
1234
|
-
const ref =
|
|
1251
|
+
const innerRef = React12.useRef(null);
|
|
1252
|
+
const ref = React12.useCallback(
|
|
1235
1253
|
(node) => {
|
|
1236
1254
|
innerRef.current = node;
|
|
1237
1255
|
if (typeof textAreaRef === "function") textAreaRef(node);
|
|
@@ -1239,7 +1257,7 @@ function TextArea({
|
|
|
1239
1257
|
},
|
|
1240
1258
|
[textAreaRef]
|
|
1241
1259
|
);
|
|
1242
|
-
const grow =
|
|
1260
|
+
const grow = React12.useCallback(() => {
|
|
1243
1261
|
const el = innerRef.current;
|
|
1244
1262
|
if (!el || !autoGrow) return;
|
|
1245
1263
|
const styles = getComputedStyle(el);
|
|
@@ -1296,7 +1314,7 @@ function TextArea({
|
|
|
1296
1314
|
}
|
|
1297
1315
|
|
|
1298
1316
|
// src/components/forms/Select.tsx
|
|
1299
|
-
import * as
|
|
1317
|
+
import * as React13 from "react";
|
|
1300
1318
|
import {
|
|
1301
1319
|
Select as AriaSelect,
|
|
1302
1320
|
Button as AriaButton5,
|
|
@@ -1329,10 +1347,10 @@ function Select({
|
|
|
1329
1347
|
...rest
|
|
1330
1348
|
}) {
|
|
1331
1349
|
const msg = usePireMessages();
|
|
1332
|
-
const items =
|
|
1350
|
+
const items = React13.useMemo(() => options.map(norm), [options]);
|
|
1333
1351
|
const effectivePlaceholder = placeholder ?? msg.selectPlaceholder;
|
|
1334
1352
|
const isSelectionControlled = value !== void 0;
|
|
1335
|
-
const [ownSelection, setOwnSelection] =
|
|
1353
|
+
const [ownSelection, setOwnSelection] = React13.useState(defaultValue ?? null);
|
|
1336
1354
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1337
1355
|
const collides = items.some((item) => item.value === CLEAR_KEY);
|
|
1338
1356
|
const showsClear = isClearable === true && !rest.isDisabled && items.length > 0 && !collides;
|
|
@@ -1522,19 +1540,19 @@ function ChoiceCardGroup({
|
|
|
1522
1540
|
}
|
|
1523
1541
|
|
|
1524
1542
|
// src/components/forms/ComboBox.tsx
|
|
1525
|
-
import * as
|
|
1543
|
+
import * as React16 from "react";
|
|
1526
1544
|
import { ComboBox as AriaComboBox, Input as AriaInput2, Group as Group3, FieldError as FieldError6 } from "react-aria-components";
|
|
1527
1545
|
|
|
1528
1546
|
// src/components/forms/ComboBoxListBox.tsx
|
|
1529
|
-
import * as
|
|
1547
|
+
import * as React15 from "react";
|
|
1530
1548
|
import { Button as AriaButton6, Popover as Popover2, ListBox as ListBox2, ListBoxItem as ListBoxItem2 } from "react-aria-components";
|
|
1531
1549
|
|
|
1532
1550
|
// src/components/utils/useLoadMoreOnScroll.ts
|
|
1533
|
-
import * as
|
|
1551
|
+
import * as React14 from "react";
|
|
1534
1552
|
var THRESHOLD = 64;
|
|
1535
1553
|
function useLoadMoreOnScroll(onLoadMore, isLoading) {
|
|
1536
|
-
const requestedAt =
|
|
1537
|
-
|
|
1554
|
+
const requestedAt = React14.useRef(null);
|
|
1555
|
+
React14.useEffect(() => {
|
|
1538
1556
|
if (!isLoading) requestedAt.current = null;
|
|
1539
1557
|
}, [isLoading]);
|
|
1540
1558
|
if (!onLoadMore) return void 0;
|
|
@@ -1551,7 +1569,7 @@ function useLoadMoreOnScroll(onLoadMore, isLoading) {
|
|
|
1551
1569
|
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1552
1570
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1553
1571
|
function useComboBoxItems(options, isFilteredExternally, isLoading) {
|
|
1554
|
-
const items =
|
|
1572
|
+
const items = React15.useMemo(() => options.map(norm2), [options]);
|
|
1555
1573
|
return {
|
|
1556
1574
|
items,
|
|
1557
1575
|
collectionProps: {
|
|
@@ -1635,10 +1653,10 @@ function ComboBox({
|
|
|
1635
1653
|
const msg = usePireMessages();
|
|
1636
1654
|
const { items, collectionProps } = useComboBoxItems(options, isFilteredExternally, isLoading);
|
|
1637
1655
|
const isSelectionControlled = value !== void 0;
|
|
1638
|
-
const [ownSelection, setOwnSelection] =
|
|
1656
|
+
const [ownSelection, setOwnSelection] = React16.useState(defaultValue ?? null);
|
|
1639
1657
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1640
1658
|
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1641
|
-
const [typedText, setTypedText] =
|
|
1659
|
+
const [typedText, setTypedText] = React16.useState("");
|
|
1642
1660
|
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1643
1661
|
const handleInputChange = isClearable ? (text) => {
|
|
1644
1662
|
setTypedText(text);
|
|
@@ -1707,7 +1725,7 @@ function ComboBox({
|
|
|
1707
1725
|
}
|
|
1708
1726
|
|
|
1709
1727
|
// src/components/forms/MultiComboBox.tsx
|
|
1710
|
-
import * as
|
|
1728
|
+
import * as React17 from "react";
|
|
1711
1729
|
import {
|
|
1712
1730
|
ComboBox as AriaComboBox2,
|
|
1713
1731
|
Input as AriaInput3,
|
|
@@ -1741,13 +1759,13 @@ function MultiComboBox({
|
|
|
1741
1759
|
}) {
|
|
1742
1760
|
const msg = usePireMessages();
|
|
1743
1761
|
const { items, collectionProps } = useComboBoxItems(options, isFilteredExternally, isLoading);
|
|
1744
|
-
const [uncontrolled, setUncontrolled] =
|
|
1745
|
-
const [announcement, setAnnouncement] =
|
|
1746
|
-
const inputRef =
|
|
1762
|
+
const [uncontrolled, setUncontrolled] = React17.useState(defaultValue ?? []);
|
|
1763
|
+
const [announcement, setAnnouncement] = React17.useState("");
|
|
1764
|
+
const inputRef = React17.useRef(null);
|
|
1747
1765
|
const raw = value ?? uncontrolled;
|
|
1748
1766
|
const contentKey = raw.join("\0");
|
|
1749
|
-
const values =
|
|
1750
|
-
const labels =
|
|
1767
|
+
const values = React17.useMemo(() => raw, [contentKey]);
|
|
1768
|
+
const labels = React17.useMemo(() => new Map(items.map((o) => [o.value, o.label])), [items]);
|
|
1751
1769
|
const labelOf = (v) => labels.get(v) ?? v;
|
|
1752
1770
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1753
1771
|
const commit = (next) => {
|
|
@@ -1850,7 +1868,7 @@ function MultiComboBox({
|
|
|
1850
1868
|
}
|
|
1851
1869
|
|
|
1852
1870
|
// src/components/forms/NumberField.tsx
|
|
1853
|
-
import * as
|
|
1871
|
+
import * as React18 from "react";
|
|
1854
1872
|
import {
|
|
1855
1873
|
NumberField as AriaNumberField,
|
|
1856
1874
|
Input as AriaInput4,
|
|
@@ -1898,7 +1916,7 @@ function toAriaNumber(value) {
|
|
|
1898
1916
|
return typeof value === "number" ? value : Number(value);
|
|
1899
1917
|
}
|
|
1900
1918
|
function ClearButton({ label, onClear }) {
|
|
1901
|
-
const state =
|
|
1919
|
+
const state = React18.useContext(NumberFieldStateContext);
|
|
1902
1920
|
if (!state?.inputValue) {
|
|
1903
1921
|
return null;
|
|
1904
1922
|
}
|
|
@@ -1930,7 +1948,7 @@ function NumberField({
|
|
|
1930
1948
|
const { locale } = useLocale();
|
|
1931
1949
|
const empty = emptyValue === void 0 ? NaN : emptyValue;
|
|
1932
1950
|
const isControlled = value !== void 0;
|
|
1933
|
-
const [ownValue, setOwnValue] =
|
|
1951
|
+
const [ownValue, setOwnValue] = React18.useState(() => toAriaNumber(defaultValue) ?? NaN);
|
|
1934
1952
|
const takesOverValue = Boolean(isClearable) && !isControlled;
|
|
1935
1953
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
|
|
1936
1954
|
const handleChange = (next) => {
|
|
@@ -2071,7 +2089,7 @@ function QuantityStepper({ size = "md", ...rest }) {
|
|
|
2071
2089
|
}
|
|
2072
2090
|
|
|
2073
2091
|
// src/components/forms/DatePicker.tsx
|
|
2074
|
-
import * as
|
|
2092
|
+
import * as React19 from "react";
|
|
2075
2093
|
import {
|
|
2076
2094
|
DatePicker as AriaDatePicker,
|
|
2077
2095
|
Group as Group6,
|
|
@@ -2150,7 +2168,7 @@ function coerceBound(value) {
|
|
|
2150
2168
|
// src/components/forms/DatePicker.tsx
|
|
2151
2169
|
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2152
2170
|
function ClearButton2({ label }) {
|
|
2153
|
-
const state =
|
|
2171
|
+
const state = React19.useContext(DatePickerStateContext);
|
|
2154
2172
|
if (!state?.value) {
|
|
2155
2173
|
return null;
|
|
2156
2174
|
}
|
|
@@ -2227,7 +2245,7 @@ function DatePicker({
|
|
|
2227
2245
|
}
|
|
2228
2246
|
|
|
2229
2247
|
// src/components/forms/DateRangePicker.tsx
|
|
2230
|
-
import * as
|
|
2248
|
+
import * as React20 from "react";
|
|
2231
2249
|
import {
|
|
2232
2250
|
DateRangePicker as AriaDateRangePicker,
|
|
2233
2251
|
Group as Group7,
|
|
@@ -2261,7 +2279,7 @@ function rangeLengthInDays(range) {
|
|
|
2261
2279
|
return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
|
|
2262
2280
|
}
|
|
2263
2281
|
function ClearButton3({ label }) {
|
|
2264
|
-
const state =
|
|
2282
|
+
const state = React20.useContext(DateRangePickerStateContext);
|
|
2265
2283
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2266
2284
|
return null;
|
|
2267
2285
|
}
|
|
@@ -2373,14 +2391,14 @@ function DateRangePicker({
|
|
|
2373
2391
|
}
|
|
2374
2392
|
|
|
2375
2393
|
// src/components/forms/ValueHelpField.tsx
|
|
2376
|
-
import * as
|
|
2394
|
+
import * as React24 from "react";
|
|
2377
2395
|
|
|
2378
2396
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2379
|
-
import * as
|
|
2397
|
+
import * as React23 from "react";
|
|
2380
2398
|
import { useFilter } from "react-aria-components";
|
|
2381
2399
|
|
|
2382
2400
|
// src/components/feedback/Dialog.tsx
|
|
2383
|
-
import * as
|
|
2401
|
+
import * as React21 from "react";
|
|
2384
2402
|
import { ModalOverlay, Modal, Dialog as AriaDialog3, Heading as Heading3 } from "react-aria-components";
|
|
2385
2403
|
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2386
2404
|
function DialogTitle({ children, className }) {
|
|
@@ -2428,8 +2446,8 @@ function Dialog({
|
|
|
2428
2446
|
onClose?.();
|
|
2429
2447
|
onOpenChange?.(false);
|
|
2430
2448
|
};
|
|
2431
|
-
const parts =
|
|
2432
|
-
const slotOf = (type) => parts.find((node) =>
|
|
2449
|
+
const parts = React21.Children.toArray(children);
|
|
2450
|
+
const slotOf = (type) => parts.find((node) => React21.isValidElement(node) && node.type === type);
|
|
2433
2451
|
const titleSlot = slotOf(DialogTitle);
|
|
2434
2452
|
const descriptionSlot = slotOf(DialogDescription);
|
|
2435
2453
|
const bodySlot = slotOf(DialogBody);
|
|
@@ -2467,7 +2485,7 @@ function Dialog({
|
|
|
2467
2485
|
}
|
|
2468
2486
|
|
|
2469
2487
|
// src/components/data/DataTable.tsx
|
|
2470
|
-
import * as
|
|
2488
|
+
import * as React22 from "react";
|
|
2471
2489
|
import {
|
|
2472
2490
|
Table,
|
|
2473
2491
|
TableHeader,
|
|
@@ -2539,6 +2557,7 @@ var FIELD_SELECTOR = [
|
|
|
2539
2557
|
'[contenteditable="true"]',
|
|
2540
2558
|
'[tabindex]:not([tabindex="-1"])'
|
|
2541
2559
|
].join(",");
|
|
2560
|
+
var EditActionsContext = React22.createContext(null);
|
|
2542
2561
|
function EditCell({
|
|
2543
2562
|
children,
|
|
2544
2563
|
isFirst,
|
|
@@ -2546,11 +2565,11 @@ function EditCell({
|
|
|
2546
2565
|
onCommit,
|
|
2547
2566
|
onCancel
|
|
2548
2567
|
}) {
|
|
2549
|
-
const state =
|
|
2568
|
+
const state = React22.useContext(TableStateContext);
|
|
2550
2569
|
const setNavDisabled = state?.setKeyboardNavigationDisabled;
|
|
2551
|
-
const ref =
|
|
2552
|
-
const focusedWithin =
|
|
2553
|
-
|
|
2570
|
+
const ref = React22.useRef(null);
|
|
2571
|
+
const focusedWithin = React22.useRef(false);
|
|
2572
|
+
React22.useLayoutEffect(() => {
|
|
2554
2573
|
if (!isFirst) return;
|
|
2555
2574
|
const row = ref.current?.closest('[role="row"]');
|
|
2556
2575
|
void focusToken;
|
|
@@ -2562,7 +2581,7 @@ function EditCell({
|
|
|
2562
2581
|
}
|
|
2563
2582
|
}
|
|
2564
2583
|
}, [isFirst, focusToken]);
|
|
2565
|
-
|
|
2584
|
+
React22.useLayoutEffect(() => {
|
|
2566
2585
|
if (!isFirst) return;
|
|
2567
2586
|
const row = ref.current?.closest('[role="row"]');
|
|
2568
2587
|
return () => {
|
|
@@ -2572,7 +2591,7 @@ function EditCell({
|
|
|
2572
2591
|
});
|
|
2573
2592
|
};
|
|
2574
2593
|
}, [isFirst]);
|
|
2575
|
-
|
|
2594
|
+
React22.useEffect(
|
|
2576
2595
|
() => () => {
|
|
2577
2596
|
if (focusedWithin.current) setNavDisabled?.(false);
|
|
2578
2597
|
},
|
|
@@ -2612,21 +2631,22 @@ function EditCell({
|
|
|
2612
2631
|
onPointerDown: stop,
|
|
2613
2632
|
onMouseDown: stop,
|
|
2614
2633
|
onClick: stop,
|
|
2615
|
-
children
|
|
2634
|
+
children: /* @__PURE__ */ jsx39(EditActionsContext.Provider, { value: { commit: onCommit, cancel: onCancel }, children })
|
|
2616
2635
|
}
|
|
2617
2636
|
)
|
|
2618
2637
|
);
|
|
2619
2638
|
}
|
|
2620
|
-
var LiveEditContext =
|
|
2639
|
+
var LiveEditContext = React22.createContext(null);
|
|
2621
2640
|
function LiveEditField({ columnKey, row }) {
|
|
2622
|
-
const live =
|
|
2641
|
+
const live = React22.useContext(LiveEditContext);
|
|
2642
|
+
const actions = React22.useContext(EditActionsContext);
|
|
2623
2643
|
const column = live?.columns.find((c) => c.key === columnKey);
|
|
2624
2644
|
const target = row ?? live?.pendingRow;
|
|
2625
|
-
return target && column?.renderEdit ? column.renderEdit(target) : null;
|
|
2645
|
+
return target && actions && column?.renderEdit ? column.renderEdit(target, actions) : null;
|
|
2626
2646
|
}
|
|
2627
2647
|
function useTableElement(deps, columnFunctions, isEditing, build) {
|
|
2628
|
-
const cache =
|
|
2629
|
-
const churn =
|
|
2648
|
+
const cache = React22.useRef(null);
|
|
2649
|
+
const churn = React22.useRef(0);
|
|
2630
2650
|
const prev = cache.current;
|
|
2631
2651
|
if (prev && sameValues(prev.deps, deps) && sameValues(prev.columnFunctions, columnFunctions)) {
|
|
2632
2652
|
churn.current = 0;
|
|
@@ -2671,13 +2691,13 @@ function DataTable({
|
|
|
2671
2691
|
"aria-label": ariaLabel
|
|
2672
2692
|
}) {
|
|
2673
2693
|
const msg = usePireMessages();
|
|
2674
|
-
const [pendingFocus, setPendingFocus] =
|
|
2675
|
-
const latest =
|
|
2694
|
+
const [pendingFocus, setPendingFocus] = React22.useState(0);
|
|
2695
|
+
const latest = React22.useRef({ onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow });
|
|
2676
2696
|
latest.current = { onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow };
|
|
2677
2697
|
const isEditing = (row) => editingRowId != null && String(row.id) === String(editingRowId);
|
|
2678
2698
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2679
2699
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2680
|
-
const pinnedGeometry =
|
|
2700
|
+
const pinnedGeometry = React22.useMemo(() => {
|
|
2681
2701
|
const geometry = /* @__PURE__ */ new Map();
|
|
2682
2702
|
let x = hasCheckboxColumn ? CHECKBOX_W : 0;
|
|
2683
2703
|
let broke = null;
|
|
@@ -2959,13 +2979,13 @@ function ValueHelpDialog({
|
|
|
2959
2979
|
}) {
|
|
2960
2980
|
const msg = usePireMessages();
|
|
2961
2981
|
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
2962
|
-
const [query, setQuery] =
|
|
2963
|
-
|
|
2982
|
+
const [query, setQuery] = React23.useState("");
|
|
2983
|
+
React23.useEffect(() => {
|
|
2964
2984
|
if (isOpen) setQuery("");
|
|
2965
2985
|
}, [isOpen]);
|
|
2966
2986
|
const isMultiple = selectionMode === "multiple";
|
|
2967
2987
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
2968
|
-
const filtered =
|
|
2988
|
+
const filtered = React23.useMemo(() => {
|
|
2969
2989
|
if (isFilteredExternally) return rows;
|
|
2970
2990
|
const q = query.trim();
|
|
2971
2991
|
if (!q) return rows;
|
|
@@ -3068,7 +3088,7 @@ function ValueHelpField({
|
|
|
3068
3088
|
style
|
|
3069
3089
|
}) {
|
|
3070
3090
|
const msg = usePireMessages();
|
|
3071
|
-
const [open, setOpen] =
|
|
3091
|
+
const [open, setOpen] = React24.useState(false);
|
|
3072
3092
|
return /* @__PURE__ */ jsxs30("div", { className: cx(className), style, children: [
|
|
3073
3093
|
/* @__PURE__ */ jsx41(
|
|
3074
3094
|
Input,
|
|
@@ -3124,7 +3144,7 @@ function ValueHelpField({
|
|
|
3124
3144
|
}
|
|
3125
3145
|
|
|
3126
3146
|
// src/components/forms/FileUpload.tsx
|
|
3127
|
-
import * as
|
|
3147
|
+
import * as React25 from "react";
|
|
3128
3148
|
import { FileTrigger } from "react-aria-components";
|
|
3129
3149
|
|
|
3130
3150
|
// src/components/feedback/ProgressBar.tsx
|
|
@@ -3139,6 +3159,8 @@ function ProgressBar({
|
|
|
3139
3159
|
isIndeterminate,
|
|
3140
3160
|
status = "informative",
|
|
3141
3161
|
size = "md",
|
|
3162
|
+
"aria-label": ariaLabel,
|
|
3163
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3142
3164
|
className,
|
|
3143
3165
|
style
|
|
3144
3166
|
}) {
|
|
@@ -3152,6 +3174,8 @@ function ProgressBar({
|
|
|
3152
3174
|
minValue,
|
|
3153
3175
|
maxValue,
|
|
3154
3176
|
isIndeterminate,
|
|
3177
|
+
"aria-label": ariaLabel,
|
|
3178
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3155
3179
|
style,
|
|
3156
3180
|
children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs31(Fragment5, { children: [
|
|
3157
3181
|
label || showValue ? /* @__PURE__ */ jsxs31("div", { className: "pire-progress-head", children: [
|
|
@@ -3194,8 +3218,8 @@ function screenFiles(files, { maxSize, acceptedFileTypes }) {
|
|
|
3194
3218
|
return { accepted, rejected };
|
|
3195
3219
|
}
|
|
3196
3220
|
function usePreviewUrls(files) {
|
|
3197
|
-
const owned =
|
|
3198
|
-
|
|
3221
|
+
const owned = React25.useRef(/* @__PURE__ */ new Set());
|
|
3222
|
+
React25.useEffect(() => {
|
|
3199
3223
|
const live = new Set(files.map((f) => f.previewUrl));
|
|
3200
3224
|
for (const url of owned.current) {
|
|
3201
3225
|
if (live.has(url)) continue;
|
|
@@ -3203,7 +3227,7 @@ function usePreviewUrls(files) {
|
|
|
3203
3227
|
owned.current.delete(url);
|
|
3204
3228
|
}
|
|
3205
3229
|
}, [files]);
|
|
3206
|
-
|
|
3230
|
+
React25.useEffect(() => {
|
|
3207
3231
|
const urls = owned.current;
|
|
3208
3232
|
return () => {
|
|
3209
3233
|
for (const url of urls) URL.revokeObjectURL(url);
|
|
@@ -3228,7 +3252,7 @@ function useFileList({
|
|
|
3228
3252
|
isDisabled,
|
|
3229
3253
|
isReadOnly
|
|
3230
3254
|
}) {
|
|
3231
|
-
const [uncontrolled, setUncontrolled] =
|
|
3255
|
+
const [uncontrolled, setUncontrolled] = React25.useState(defaultValue ?? []);
|
|
3232
3256
|
const files = value ?? uncontrolled;
|
|
3233
3257
|
const previewUrlFor = usePreviewUrls(files);
|
|
3234
3258
|
const commit = (next) => {
|
|
@@ -3255,7 +3279,7 @@ function useFileFieldIds({
|
|
|
3255
3279
|
errorMessage,
|
|
3256
3280
|
isInvalid
|
|
3257
3281
|
}) {
|
|
3258
|
-
const id =
|
|
3282
|
+
const id = React25.useId();
|
|
3259
3283
|
const labelId = label ? `${id}-label` : void 0;
|
|
3260
3284
|
const hintId = description ? `${id}-hint` : void 0;
|
|
3261
3285
|
const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
|
|
@@ -3395,7 +3419,7 @@ function FileUpload({
|
|
|
3395
3419
|
import { MenuTrigger as MenuTrigger2, Button as AriaButton12, Popover as Popover6 } from "react-aria-components";
|
|
3396
3420
|
|
|
3397
3421
|
// src/components/navigation/Breadcrumb.tsx
|
|
3398
|
-
import * as
|
|
3422
|
+
import * as React26 from "react";
|
|
3399
3423
|
import {
|
|
3400
3424
|
Breadcrumbs as AriaBreadcrumbs,
|
|
3401
3425
|
Breadcrumb as AriaBreadcrumb,
|
|
@@ -3473,10 +3497,10 @@ import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
|
3473
3497
|
var keyOf = (item) => item.id ?? item.label;
|
|
3474
3498
|
var MIN_CURRENT = 64;
|
|
3475
3499
|
function useFitLevel(enabled) {
|
|
3476
|
-
const boxRef =
|
|
3477
|
-
const measureRef =
|
|
3478
|
-
const [level, setLevel] =
|
|
3479
|
-
|
|
3500
|
+
const boxRef = React26.useRef(null);
|
|
3501
|
+
const measureRef = React26.useRef(null);
|
|
3502
|
+
const [level, setLevel] = React26.useState(0);
|
|
3503
|
+
React26.useLayoutEffect(() => {
|
|
3480
3504
|
const box = boxRef.current;
|
|
3481
3505
|
const measure = measureRef.current;
|
|
3482
3506
|
if (!enabled || !box || !measure) return;
|
|
@@ -3549,7 +3573,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3549
3573
|
"data-collapsible": "true",
|
|
3550
3574
|
onAction: (key) => onNavigate?.(String(key)),
|
|
3551
3575
|
children: shown.map(
|
|
3552
|
-
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ jsxs34(
|
|
3576
|
+
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ jsxs34(React26.Fragment, { children: [
|
|
3553
3577
|
/* @__PURE__ */ jsxs34(AriaBreadcrumb, { className: "pire-breadcrumb", id: "__pire_breadcrumb_more__", children: [
|
|
3554
3578
|
/* @__PURE__ */ jsxs34(MenuTrigger, { children: [
|
|
3555
3579
|
/* @__PURE__ */ jsx45(AriaButton11, { className: "pire-breadcrumb-more", "aria-label": msg.breadcrumbMore, children: /* @__PURE__ */ jsx45(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
@@ -3657,7 +3681,7 @@ function ShellBar({
|
|
|
3657
3681
|
}
|
|
3658
3682
|
|
|
3659
3683
|
// src/components/navigation/SideNav.tsx
|
|
3660
|
-
import * as
|
|
3684
|
+
import * as React27 from "react";
|
|
3661
3685
|
import {
|
|
3662
3686
|
Button as AriaButton13,
|
|
3663
3687
|
Disclosure,
|
|
@@ -3693,10 +3717,10 @@ function SideNav({
|
|
|
3693
3717
|
const msg = usePireMessages();
|
|
3694
3718
|
const activeParent = findActiveParent(groups, value);
|
|
3695
3719
|
const isControlled = expandedIds != null;
|
|
3696
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3720
|
+
const [ownExpanded, setOwnExpanded] = React27.useState(
|
|
3697
3721
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3698
3722
|
);
|
|
3699
|
-
const [lastValue, setLastValue] =
|
|
3723
|
+
const [lastValue, setLastValue] = React27.useState(value);
|
|
3700
3724
|
if (value !== lastValue) {
|
|
3701
3725
|
setLastValue(value);
|
|
3702
3726
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3827,7 +3851,7 @@ function SideNav({
|
|
|
3827
3851
|
}
|
|
3828
3852
|
|
|
3829
3853
|
// src/components/navigation/ShellRail.tsx
|
|
3830
|
-
import * as
|
|
3854
|
+
import * as React28 from "react";
|
|
3831
3855
|
import { Button as AriaButton14 } from "react-aria-components";
|
|
3832
3856
|
import { jsx as jsx48, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3833
3857
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
@@ -3835,7 +3859,7 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
|
3835
3859
|
return /* @__PURE__ */ jsx48("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => (
|
|
3836
3860
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
3837
3861
|
// scrolling zone would carry its own rule out of view on the first wheel event.
|
|
3838
|
-
/* @__PURE__ */ jsxs37(
|
|
3862
|
+
/* @__PURE__ */ jsxs37(React28.Fragment, { children: [
|
|
3839
3863
|
gi > 0 ? /* @__PURE__ */ jsx48("div", { className: "pire-shellrail-divider" }) : null,
|
|
3840
3864
|
/* @__PURE__ */ jsx48("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ jsx48(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ jsx48(
|
|
3841
3865
|
AriaButton14,
|
|
@@ -3946,7 +3970,7 @@ function Pagination({
|
|
|
3946
3970
|
}
|
|
3947
3971
|
|
|
3948
3972
|
// src/components/navigation/Ribbon.tsx
|
|
3949
|
-
import * as
|
|
3973
|
+
import * as React29 from "react";
|
|
3950
3974
|
import { Tabs as AriaTabs2, TabList as TabList2, Tab as AriaTab2, TabPanel as TabPanel2, Toolbar, Button as Button3 } from "react-aria-components";
|
|
3951
3975
|
import { Fragment as Fragment10, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3952
3976
|
var outside = (what, parent) => {
|
|
@@ -3962,7 +3986,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
3962
3986
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
3963
3987
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
3964
3988
|
function describe(child) {
|
|
3965
|
-
if (!
|
|
3989
|
+
if (!React29.isValidElement(child)) return JSON.stringify(child);
|
|
3966
3990
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
3967
3991
|
const type = child.type;
|
|
3968
3992
|
return type?.displayName || type?.name || "a component";
|
|
@@ -3970,13 +3994,13 @@ function describe(child) {
|
|
|
3970
3994
|
function childrenOfType(children, type, what, parent) {
|
|
3971
3995
|
const out = [];
|
|
3972
3996
|
const walk = (nodes, path) => {
|
|
3973
|
-
|
|
3997
|
+
React29.Children.forEach(nodes, (child, i) => {
|
|
3974
3998
|
if (child == null || typeof child === "boolean") return;
|
|
3975
|
-
if (
|
|
3999
|
+
if (React29.isValidElement(child) && child.type === React29.Fragment) {
|
|
3976
4000
|
return walk(child.props.children, `${path}${i}.`);
|
|
3977
4001
|
}
|
|
3978
|
-
if (!
|
|
3979
|
-
const isWrapper =
|
|
4002
|
+
if (!React29.isValidElement(child) || child.type !== type) {
|
|
4003
|
+
const isWrapper = React29.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
3980
4004
|
throw new Error(
|
|
3981
4005
|
`[pire] ${parent} accepts only ${what} as children, and got ${describe(child)}.` + (isWrapper ? ` Configuration elements are read, not rendered, so ${parent} cannot see through a wrapper component.` : "")
|
|
3982
4006
|
);
|
|
@@ -4053,9 +4077,9 @@ function Group8({ group, selectionCount }) {
|
|
|
4053
4077
|
] });
|
|
4054
4078
|
}
|
|
4055
4079
|
function useTrailingOverflow() {
|
|
4056
|
-
const ref =
|
|
4057
|
-
const [overflow, setOverflow] =
|
|
4058
|
-
|
|
4080
|
+
const ref = React29.useRef(null);
|
|
4081
|
+
const [overflow, setOverflow] = React29.useState(false);
|
|
4082
|
+
React29.useEffect(() => {
|
|
4059
4083
|
const node = ref.current;
|
|
4060
4084
|
if (!node) return;
|
|
4061
4085
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -4127,18 +4151,18 @@ function Ribbon({
|
|
|
4127
4151
|
const count = selectionCount ?? 0;
|
|
4128
4152
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
4129
4153
|
const fallback = visible[0]?.id;
|
|
4130
|
-
const [ownTab, setOwnTab] =
|
|
4154
|
+
const [ownTab, setOwnTab] = React29.useState(defaultValue);
|
|
4131
4155
|
const requested = value ?? ownTab;
|
|
4132
4156
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
4133
|
-
const select =
|
|
4157
|
+
const select = React29.useCallback(
|
|
4134
4158
|
(id) => {
|
|
4135
4159
|
setOwnTab(id);
|
|
4136
4160
|
onChange?.(id);
|
|
4137
4161
|
},
|
|
4138
4162
|
[onChange]
|
|
4139
4163
|
);
|
|
4140
|
-
const hadSelection =
|
|
4141
|
-
|
|
4164
|
+
const hadSelection = React29.useRef(false);
|
|
4165
|
+
React29.useEffect(() => {
|
|
4142
4166
|
const has = count > 0;
|
|
4143
4167
|
if (has === hadSelection.current) return;
|
|
4144
4168
|
hadSelection.current = has;
|
|
@@ -4147,16 +4171,16 @@ function Ribbon({
|
|
|
4147
4171
|
if (has) select(contextual.id);
|
|
4148
4172
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
4149
4173
|
}, [count, tabs, requested, select]);
|
|
4150
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
4174
|
+
const [ownCollapsed, setOwnCollapsed] = React29.useState(false);
|
|
4151
4175
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
4152
|
-
const toggleRef =
|
|
4153
|
-
const restoreFocus =
|
|
4154
|
-
|
|
4176
|
+
const toggleRef = React29.useRef(null);
|
|
4177
|
+
const restoreFocus = React29.useRef(false);
|
|
4178
|
+
React29.useLayoutEffect(() => {
|
|
4155
4179
|
if (!restoreFocus.current) return;
|
|
4156
4180
|
restoreFocus.current = false;
|
|
4157
4181
|
toggleRef.current?.focus();
|
|
4158
4182
|
});
|
|
4159
|
-
const bandId =
|
|
4183
|
+
const bandId = React29.useId();
|
|
4160
4184
|
const toggle = /* @__PURE__ */ jsx51(
|
|
4161
4185
|
Button3,
|
|
4162
4186
|
{
|
|
@@ -4188,7 +4212,7 @@ function Ribbon({
|
|
|
4188
4212
|
children: [
|
|
4189
4213
|
primaries.map((c) => /* @__PURE__ */ jsx51(Command, { command: c, selectionCount: count, inBar: true }, c.key)),
|
|
4190
4214
|
leading ? /* @__PURE__ */ jsx51("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
4191
|
-
blocks.map((block, i) => /* @__PURE__ */ jsxs40(
|
|
4215
|
+
blocks.map((block, i) => /* @__PURE__ */ jsxs40(React29.Fragment, { children: [
|
|
4192
4216
|
i > 0 || leading || primaries.length ? /* @__PURE__ */ jsx51("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
4193
4217
|
block.commands.map((c) => /* @__PURE__ */ jsx51(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
4194
4218
|
] }, block.key))
|
|
@@ -4267,7 +4291,7 @@ function InlineMessage({
|
|
|
4267
4291
|
}
|
|
4268
4292
|
|
|
4269
4293
|
// src/components/feedback/Toast.tsx
|
|
4270
|
-
import * as
|
|
4294
|
+
import * as React30 from "react";
|
|
4271
4295
|
import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4272
4296
|
function Toast({
|
|
4273
4297
|
kind = "success",
|
|
@@ -4294,21 +4318,21 @@ function Toast({
|
|
|
4294
4318
|
}
|
|
4295
4319
|
);
|
|
4296
4320
|
}
|
|
4297
|
-
var ToastContext =
|
|
4321
|
+
var ToastContext = React30.createContext(null);
|
|
4298
4322
|
function ToastProvider({
|
|
4299
4323
|
children,
|
|
4300
4324
|
timeout = 6e3
|
|
4301
4325
|
}) {
|
|
4302
4326
|
const msg = usePireMessages();
|
|
4303
|
-
const [toasts, setToasts] =
|
|
4304
|
-
const timers =
|
|
4305
|
-
const nextId =
|
|
4306
|
-
const close =
|
|
4327
|
+
const [toasts, setToasts] = React30.useState([]);
|
|
4328
|
+
const timers = React30.useRef(/* @__PURE__ */ new Map());
|
|
4329
|
+
const nextId = React30.useRef(0);
|
|
4330
|
+
const close = React30.useCallback((id) => {
|
|
4307
4331
|
clearTimeout(timers.current.get(id));
|
|
4308
4332
|
timers.current.delete(id);
|
|
4309
4333
|
setToasts((t) => t.filter((x) => x.id !== id));
|
|
4310
4334
|
}, []);
|
|
4311
|
-
const add =
|
|
4335
|
+
const add = React30.useCallback(
|
|
4312
4336
|
(toast) => {
|
|
4313
4337
|
const id = String(++nextId.current);
|
|
4314
4338
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
@@ -4322,21 +4346,21 @@ function ToastProvider({
|
|
|
4322
4346
|
},
|
|
4323
4347
|
[close, timeout]
|
|
4324
4348
|
);
|
|
4325
|
-
|
|
4349
|
+
React30.useEffect(() => {
|
|
4326
4350
|
const pending = timers.current;
|
|
4327
4351
|
return () => {
|
|
4328
4352
|
for (const timer of pending.values()) clearTimeout(timer);
|
|
4329
4353
|
pending.clear();
|
|
4330
4354
|
};
|
|
4331
4355
|
}, []);
|
|
4332
|
-
const value =
|
|
4356
|
+
const value = React30.useMemo(() => ({ add, close }), [add, close]);
|
|
4333
4357
|
return /* @__PURE__ */ jsxs42(ToastContext.Provider, { value, children: [
|
|
4334
4358
|
children,
|
|
4335
4359
|
/* @__PURE__ */ jsx53("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ jsx53(Toast, { kind: t.kind, onClose: () => close(t.id), children: t.message }, t.id)) })
|
|
4336
4360
|
] });
|
|
4337
4361
|
}
|
|
4338
4362
|
function useToast() {
|
|
4339
|
-
const ctx =
|
|
4363
|
+
const ctx = React30.useContext(ToastContext);
|
|
4340
4364
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
4341
4365
|
return ctx;
|
|
4342
4366
|
}
|
|
@@ -4701,14 +4725,14 @@ function BarChart({
|
|
|
4701
4725
|
}
|
|
4702
4726
|
|
|
4703
4727
|
// src/components/data/LineChart.tsx
|
|
4704
|
-
import * as
|
|
4728
|
+
import * as React31 from "react";
|
|
4705
4729
|
import { jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
4706
4730
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4707
4731
|
var MARKER_LIMIT = 20;
|
|
4708
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4732
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React31.useEffect : React31.useLayoutEffect;
|
|
4709
4733
|
function useMeasuredWidth() {
|
|
4710
|
-
const ref =
|
|
4711
|
-
const [width, setWidth] =
|
|
4734
|
+
const ref = React31.useRef(null);
|
|
4735
|
+
const [width, setWidth] = React31.useState(0);
|
|
4712
4736
|
useIsomorphicLayoutEffect2(() => {
|
|
4713
4737
|
const element = ref.current;
|
|
4714
4738
|
if (!element) return;
|
|
@@ -4875,7 +4899,7 @@ function LineChart({
|
|
|
4875
4899
|
}
|
|
4876
4900
|
|
|
4877
4901
|
// src/components/data/DonutChart.tsx
|
|
4878
|
-
import * as
|
|
4902
|
+
import * as React32 from "react";
|
|
4879
4903
|
import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
4880
4904
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4881
4905
|
function DonutChart({
|
|
@@ -4895,7 +4919,7 @@ function DonutChart({
|
|
|
4895
4919
|
"aria-label": label
|
|
4896
4920
|
}) {
|
|
4897
4921
|
const msg = usePireMessages();
|
|
4898
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4922
|
+
const [hoveredIndex, setHoveredIndex] = React32.useState(null);
|
|
4899
4923
|
warnOnDonutShape(series, categories.length, label);
|
|
4900
4924
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4901
4925
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -5093,10 +5117,14 @@ function PageBand({
|
|
|
5093
5117
|
|
|
5094
5118
|
// src/components/layout/PageHeader.tsx
|
|
5095
5119
|
import { jsx as jsx68, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
5096
|
-
function PageHeader({ title, subtitle, actions, className, ...rest }) {
|
|
5120
|
+
function PageHeader({ title, badge, subtitle, actions, className, ...rest }) {
|
|
5121
|
+
const heading = /* @__PURE__ */ jsx68("h1", { className: "pire-pageheader-title", children: title });
|
|
5097
5122
|
return /* @__PURE__ */ jsxs56("header", { className: cx("pire-pageheader", className), ...rest, children: [
|
|
5098
5123
|
/* @__PURE__ */ jsxs56("div", { className: "pire-pageheader-text", children: [
|
|
5099
|
-
/* @__PURE__ */
|
|
5124
|
+
badge ? /* @__PURE__ */ jsxs56("div", { className: "pire-pageheader-titlerow", children: [
|
|
5125
|
+
heading,
|
|
5126
|
+
badge
|
|
5127
|
+
] }) : heading,
|
|
5100
5128
|
subtitle ? /* @__PURE__ */ jsx68("p", { className: "pire-pageheader-sub", children: subtitle }) : null
|
|
5101
5129
|
] }),
|
|
5102
5130
|
actions ? /* @__PURE__ */ jsx68("div", { className: "pire-pageheader-actions", children: actions }) : null
|
|
@@ -5114,7 +5142,7 @@ function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
|
5114
5142
|
}
|
|
5115
5143
|
|
|
5116
5144
|
// src/components/layout/SelectionBar.tsx
|
|
5117
|
-
import * as
|
|
5145
|
+
import * as React33 from "react";
|
|
5118
5146
|
import { useLocale as useLocale2 } from "react-aria-components";
|
|
5119
5147
|
import { jsx as jsx70, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
5120
5148
|
function SelectionBar({
|
|
@@ -5131,8 +5159,8 @@ function SelectionBar({
|
|
|
5131
5159
|
}) {
|
|
5132
5160
|
const msg = usePireMessages();
|
|
5133
5161
|
const { locale } = useLocale2();
|
|
5134
|
-
const plural =
|
|
5135
|
-
const numbers =
|
|
5162
|
+
const plural = React33.useMemo(() => new Intl.PluralRules(locale), [locale]);
|
|
5163
|
+
const numbers = React33.useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
5136
5164
|
if (!count) return null;
|
|
5137
5165
|
const isOne = plural.select(count) === "one";
|
|
5138
5166
|
let sentence;
|
|
@@ -5251,7 +5279,7 @@ function ConfirmDialog({
|
|
|
5251
5279
|
}
|
|
5252
5280
|
|
|
5253
5281
|
// src/components/patterns/CommandPalette.tsx
|
|
5254
|
-
import * as
|
|
5282
|
+
import * as React35 from "react";
|
|
5255
5283
|
import {
|
|
5256
5284
|
Autocomplete,
|
|
5257
5285
|
ModalOverlay as ModalOverlay2,
|
|
@@ -5266,11 +5294,11 @@ import {
|
|
|
5266
5294
|
} from "react-aria-components";
|
|
5267
5295
|
|
|
5268
5296
|
// src/components/utils/useDocumentKeyDown.ts
|
|
5269
|
-
import * as
|
|
5297
|
+
import * as React34 from "react";
|
|
5270
5298
|
function useDocumentKeyDown(onKeyDown, isDisabled) {
|
|
5271
|
-
const handler =
|
|
5299
|
+
const handler = React34.useRef(onKeyDown);
|
|
5272
5300
|
handler.current = onKeyDown;
|
|
5273
|
-
|
|
5301
|
+
React34.useEffect(() => {
|
|
5274
5302
|
if (isDisabled) return;
|
|
5275
5303
|
const listener = (event) => handler.current(event);
|
|
5276
5304
|
document.addEventListener("keydown", listener);
|
|
@@ -5300,17 +5328,17 @@ function CommandPalette({
|
|
|
5300
5328
|
style
|
|
5301
5329
|
}) {
|
|
5302
5330
|
const msg = usePireMessages();
|
|
5303
|
-
const [query, setQuery] =
|
|
5331
|
+
const [query, setQuery] = React35.useState("");
|
|
5304
5332
|
const { contains } = useFilter2({ sensitivity: "base" });
|
|
5305
|
-
|
|
5333
|
+
React35.useEffect(() => {
|
|
5306
5334
|
if (isOpen) setQuery("");
|
|
5307
5335
|
}, [isOpen]);
|
|
5308
|
-
const searchableById =
|
|
5336
|
+
const searchableById = React35.useMemo(() => {
|
|
5309
5337
|
const byId = /* @__PURE__ */ new Map();
|
|
5310
5338
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
5311
5339
|
return byId;
|
|
5312
5340
|
}, [groups]);
|
|
5313
|
-
const filter =
|
|
5341
|
+
const filter = React35.useCallback(
|
|
5314
5342
|
(textValue, inputValue, node) => {
|
|
5315
5343
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
5316
5344
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -5405,7 +5433,7 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
|
5405
5433
|
}
|
|
5406
5434
|
|
|
5407
5435
|
// src/components/patterns/AppLauncher.tsx
|
|
5408
|
-
import * as
|
|
5436
|
+
import * as React36 from "react";
|
|
5409
5437
|
import {
|
|
5410
5438
|
DialogTrigger,
|
|
5411
5439
|
Button as AriaButton18,
|
|
@@ -5432,13 +5460,13 @@ function AppLauncher({
|
|
|
5432
5460
|
className
|
|
5433
5461
|
}) {
|
|
5434
5462
|
const msg = usePireMessages();
|
|
5435
|
-
const [query, setQuery] =
|
|
5463
|
+
const [query, setQuery] = React36.useState("");
|
|
5436
5464
|
const { contains } = useFilter3({ sensitivity: "base" });
|
|
5437
5465
|
const handleSearch = (next) => {
|
|
5438
5466
|
setQuery(next);
|
|
5439
5467
|
onSearchChange?.(next);
|
|
5440
5468
|
};
|
|
5441
|
-
const visible =
|
|
5469
|
+
const visible = React36.useMemo(() => {
|
|
5442
5470
|
if (isFilteredExternally) return sections;
|
|
5443
5471
|
const q = query.trim();
|
|
5444
5472
|
if (!q) return sections;
|
|
@@ -5531,7 +5559,7 @@ function AppLauncher({
|
|
|
5531
5559
|
}
|
|
5532
5560
|
|
|
5533
5561
|
// src/components/patterns/SidePanel.tsx
|
|
5534
|
-
import * as
|
|
5562
|
+
import * as React37 from "react";
|
|
5535
5563
|
import { ModalOverlay as ModalOverlay3, Modal as Modal3, Dialog as AriaDialog6 } from "react-aria-components";
|
|
5536
5564
|
import { jsx as jsx76, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
5537
5565
|
var PHONE_MAX_WIDTH = 600;
|
|
@@ -5556,8 +5584,8 @@ function SidePanel({
|
|
|
5556
5584
|
className
|
|
5557
5585
|
}) {
|
|
5558
5586
|
const msg = usePireMessages();
|
|
5559
|
-
const titleId =
|
|
5560
|
-
const narrow =
|
|
5587
|
+
const titleId = React37.useId();
|
|
5588
|
+
const narrow = React37.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
|
|
5561
5589
|
const head = (heading) => /* @__PURE__ */ jsx76(
|
|
5562
5590
|
DialogHeader,
|
|
5563
5591
|
{
|
|
@@ -5634,7 +5662,7 @@ function EmptyState({
|
|
|
5634
5662
|
}
|
|
5635
5663
|
|
|
5636
5664
|
// src/components/patterns/NumPad.tsx
|
|
5637
|
-
import * as
|
|
5665
|
+
import * as React38 from "react";
|
|
5638
5666
|
import { useLocale as useLocale3 } from "react-aria-components";
|
|
5639
5667
|
import { jsx as jsx78, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
5640
5668
|
var BASE_KEYS = [
|
|
@@ -5701,11 +5729,11 @@ function NumPad({
|
|
|
5701
5729
|
style
|
|
5702
5730
|
}) {
|
|
5703
5731
|
const msg = usePireMessages();
|
|
5704
|
-
const containerRef =
|
|
5732
|
+
const containerRef = React38.useRef(null);
|
|
5705
5733
|
const { locale } = useLocale3();
|
|
5706
5734
|
const separator = decimalSeparatorFor(locale);
|
|
5707
5735
|
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5708
|
-
const applyKey =
|
|
5736
|
+
const applyKey = React38.useCallback(
|
|
5709
5737
|
(key) => {
|
|
5710
5738
|
if (isDisabled) return;
|
|
5711
5739
|
if (key.value === "backspace") {
|