@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.cjs
CHANGED
|
@@ -1154,10 +1154,28 @@ function Kbd({ children, size = "md", className, ...rest }) {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
1156
1156
|
// src/components/forms/FieldHelp.tsx
|
|
1157
|
+
var React10 = __toESM(require("react"), 1);
|
|
1157
1158
|
var import_react_aria_components9 = require("react-aria-components");
|
|
1158
|
-
var import_jsx_runtime17 =
|
|
1159
|
+
var import_jsx_runtime17 = (
|
|
1160
|
+
// hideTooltip because IconButton builds its own tooltip from `label`, and `label` here is the
|
|
1161
|
+
// icon's name, not the explanation. The explanation is the Tooltip below.
|
|
1162
|
+
require("react/jsx-runtime")
|
|
1163
|
+
);
|
|
1159
1164
|
function FieldHelp({ children, label, placement = "top" }) {
|
|
1160
1165
|
const msg = usePireMessages();
|
|
1166
|
+
const [isMounted, setIsMounted] = React10.useState(false);
|
|
1167
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1168
|
+
IconButton,
|
|
1169
|
+
{
|
|
1170
|
+
ref: isMounted ? void 0 : (el) => {
|
|
1171
|
+
if (el) setIsMounted(true);
|
|
1172
|
+
},
|
|
1173
|
+
icon: "help-circle",
|
|
1174
|
+
label: label ?? msg.fieldHelp,
|
|
1175
|
+
size: "sm",
|
|
1176
|
+
hideTooltip: true
|
|
1177
|
+
}
|
|
1178
|
+
);
|
|
1161
1179
|
return (
|
|
1162
1180
|
// React Aria hands every descendant Button the nearest slotted ButtonContext. Inside a
|
|
1163
1181
|
// NumberField that context has only `increment` and `decrement`, and an unslotted Button
|
|
@@ -1166,7 +1184,7 @@ function FieldHelp({ children, label, placement = "top" }) {
|
|
|
1166
1184
|
// renders. `value={null}` is React Aria's own idiom for lifting a subtree back out of a
|
|
1167
1185
|
// slotted context — the same one `MultiComboBox` and `FieldLabel` use — and is what makes
|
|
1168
1186
|
// this component safe anywhere.
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components9.ButtonContext.Provider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: children, placement, children:
|
|
1187
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components9.ButtonContext.Provider, { value: null, children: isMounted ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: children, placement, children: button }) : button })
|
|
1170
1188
|
);
|
|
1171
1189
|
}
|
|
1172
1190
|
function NamedFieldHelp({ label, children }) {
|
|
@@ -1212,7 +1230,7 @@ function FormField({
|
|
|
1212
1230
|
}
|
|
1213
1231
|
|
|
1214
1232
|
// src/components/forms/Input.tsx
|
|
1215
|
-
var
|
|
1233
|
+
var React11 = __toESM(require("react"), 1);
|
|
1216
1234
|
var import_react_aria_components13 = require("react-aria-components");
|
|
1217
1235
|
|
|
1218
1236
|
// src/components/forms/FieldClearButton.tsx
|
|
@@ -1300,7 +1318,7 @@ function Input({
|
|
|
1300
1318
|
}) {
|
|
1301
1319
|
const msg = usePireMessages();
|
|
1302
1320
|
const isControlled = rest.value !== void 0;
|
|
1303
|
-
const [ownValue, setOwnValue] =
|
|
1321
|
+
const [ownValue, setOwnValue] = React11.useState(rest.defaultValue ?? "");
|
|
1304
1322
|
const currentValue = isControlled ? rest.value : ownValue;
|
|
1305
1323
|
const handleChange = (next) => {
|
|
1306
1324
|
setOwnValue(next);
|
|
@@ -1345,10 +1363,10 @@ function Input({
|
|
|
1345
1363
|
}
|
|
1346
1364
|
|
|
1347
1365
|
// src/components/forms/TextArea.tsx
|
|
1348
|
-
var
|
|
1366
|
+
var React12 = __toESM(require("react"), 1);
|
|
1349
1367
|
var import_react_aria_components14 = require("react-aria-components");
|
|
1350
1368
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1351
|
-
var useIsomorphicLayoutEffect = typeof document === "undefined" ?
|
|
1369
|
+
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React12.useEffect : React12.useLayoutEffect;
|
|
1352
1370
|
function TextArea({
|
|
1353
1371
|
label,
|
|
1354
1372
|
description,
|
|
@@ -1365,8 +1383,8 @@ function TextArea({
|
|
|
1365
1383
|
onChange,
|
|
1366
1384
|
...rest
|
|
1367
1385
|
}) {
|
|
1368
|
-
const innerRef =
|
|
1369
|
-
const ref =
|
|
1386
|
+
const innerRef = React12.useRef(null);
|
|
1387
|
+
const ref = React12.useCallback(
|
|
1370
1388
|
(node) => {
|
|
1371
1389
|
innerRef.current = node;
|
|
1372
1390
|
if (typeof textAreaRef === "function") textAreaRef(node);
|
|
@@ -1374,7 +1392,7 @@ function TextArea({
|
|
|
1374
1392
|
},
|
|
1375
1393
|
[textAreaRef]
|
|
1376
1394
|
);
|
|
1377
|
-
const grow =
|
|
1395
|
+
const grow = React12.useCallback(() => {
|
|
1378
1396
|
const el = innerRef.current;
|
|
1379
1397
|
if (!el || !autoGrow) return;
|
|
1380
1398
|
const styles = getComputedStyle(el);
|
|
@@ -1431,7 +1449,7 @@ function TextArea({
|
|
|
1431
1449
|
}
|
|
1432
1450
|
|
|
1433
1451
|
// src/components/forms/Select.tsx
|
|
1434
|
-
var
|
|
1452
|
+
var React13 = __toESM(require("react"), 1);
|
|
1435
1453
|
var import_react_aria_components15 = require("react-aria-components");
|
|
1436
1454
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1437
1455
|
var CLEAR_KEY = "__pire-select-clear__";
|
|
@@ -1456,10 +1474,10 @@ function Select({
|
|
|
1456
1474
|
...rest
|
|
1457
1475
|
}) {
|
|
1458
1476
|
const msg = usePireMessages();
|
|
1459
|
-
const items =
|
|
1477
|
+
const items = React13.useMemo(() => options.map(norm), [options]);
|
|
1460
1478
|
const effectivePlaceholder = placeholder ?? msg.selectPlaceholder;
|
|
1461
1479
|
const isSelectionControlled = value !== void 0;
|
|
1462
|
-
const [ownSelection, setOwnSelection] =
|
|
1480
|
+
const [ownSelection, setOwnSelection] = React13.useState(defaultValue ?? null);
|
|
1463
1481
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1464
1482
|
const collides = items.some((item) => item.value === CLEAR_KEY);
|
|
1465
1483
|
const showsClear = isClearable === true && !rest.isDisabled && items.length > 0 && !collides;
|
|
@@ -1643,19 +1661,19 @@ function ChoiceCardGroup({
|
|
|
1643
1661
|
}
|
|
1644
1662
|
|
|
1645
1663
|
// src/components/forms/ComboBox.tsx
|
|
1646
|
-
var
|
|
1664
|
+
var React16 = __toESM(require("react"), 1);
|
|
1647
1665
|
var import_react_aria_components21 = require("react-aria-components");
|
|
1648
1666
|
|
|
1649
1667
|
// src/components/forms/ComboBoxListBox.tsx
|
|
1650
|
-
var
|
|
1668
|
+
var React15 = __toESM(require("react"), 1);
|
|
1651
1669
|
var import_react_aria_components20 = require("react-aria-components");
|
|
1652
1670
|
|
|
1653
1671
|
// src/components/utils/useLoadMoreOnScroll.ts
|
|
1654
|
-
var
|
|
1672
|
+
var React14 = __toESM(require("react"), 1);
|
|
1655
1673
|
var THRESHOLD = 64;
|
|
1656
1674
|
function useLoadMoreOnScroll(onLoadMore, isLoading) {
|
|
1657
|
-
const requestedAt =
|
|
1658
|
-
|
|
1675
|
+
const requestedAt = React14.useRef(null);
|
|
1676
|
+
React14.useEffect(() => {
|
|
1659
1677
|
if (!isLoading) requestedAt.current = null;
|
|
1660
1678
|
}, [isLoading]);
|
|
1661
1679
|
if (!onLoadMore) return void 0;
|
|
@@ -1672,7 +1690,7 @@ function useLoadMoreOnScroll(onLoadMore, isLoading) {
|
|
|
1672
1690
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1673
1691
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1674
1692
|
function useComboBoxItems(options, isFilteredExternally, isLoading) {
|
|
1675
|
-
const items =
|
|
1693
|
+
const items = React15.useMemo(() => options.map(norm2), [options]);
|
|
1676
1694
|
return {
|
|
1677
1695
|
items,
|
|
1678
1696
|
collectionProps: {
|
|
@@ -1756,10 +1774,10 @@ function ComboBox({
|
|
|
1756
1774
|
const msg = usePireMessages();
|
|
1757
1775
|
const { items, collectionProps } = useComboBoxItems(options, isFilteredExternally, isLoading);
|
|
1758
1776
|
const isSelectionControlled = value !== void 0;
|
|
1759
|
-
const [ownSelection, setOwnSelection] =
|
|
1777
|
+
const [ownSelection, setOwnSelection] = React16.useState(defaultValue ?? null);
|
|
1760
1778
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1761
1779
|
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1762
|
-
const [typedText, setTypedText] =
|
|
1780
|
+
const [typedText, setTypedText] = React16.useState("");
|
|
1763
1781
|
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1764
1782
|
const handleInputChange = isClearable ? (text) => {
|
|
1765
1783
|
setTypedText(text);
|
|
@@ -1828,7 +1846,7 @@ function ComboBox({
|
|
|
1828
1846
|
}
|
|
1829
1847
|
|
|
1830
1848
|
// src/components/forms/MultiComboBox.tsx
|
|
1831
|
-
var
|
|
1849
|
+
var React17 = __toESM(require("react"), 1);
|
|
1832
1850
|
var import_react_aria_components22 = require("react-aria-components");
|
|
1833
1851
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1834
1852
|
function MultiComboBox({
|
|
@@ -1855,13 +1873,13 @@ function MultiComboBox({
|
|
|
1855
1873
|
}) {
|
|
1856
1874
|
const msg = usePireMessages();
|
|
1857
1875
|
const { items, collectionProps } = useComboBoxItems(options, isFilteredExternally, isLoading);
|
|
1858
|
-
const [uncontrolled, setUncontrolled] =
|
|
1859
|
-
const [announcement, setAnnouncement] =
|
|
1860
|
-
const inputRef =
|
|
1876
|
+
const [uncontrolled, setUncontrolled] = React17.useState(defaultValue ?? []);
|
|
1877
|
+
const [announcement, setAnnouncement] = React17.useState("");
|
|
1878
|
+
const inputRef = React17.useRef(null);
|
|
1861
1879
|
const raw = value ?? uncontrolled;
|
|
1862
1880
|
const contentKey = raw.join("\0");
|
|
1863
|
-
const values =
|
|
1864
|
-
const labels =
|
|
1881
|
+
const values = React17.useMemo(() => raw, [contentKey]);
|
|
1882
|
+
const labels = React17.useMemo(() => new Map(items.map((o) => [o.value, o.label])), [items]);
|
|
1865
1883
|
const labelOf = (v) => labels.get(v) ?? v;
|
|
1866
1884
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1867
1885
|
const commit = (next) => {
|
|
@@ -1964,7 +1982,7 @@ function MultiComboBox({
|
|
|
1964
1982
|
}
|
|
1965
1983
|
|
|
1966
1984
|
// src/components/forms/NumberField.tsx
|
|
1967
|
-
var
|
|
1985
|
+
var React18 = __toESM(require("react"), 1);
|
|
1968
1986
|
var import_react_aria_components23 = require("react-aria-components");
|
|
1969
1987
|
|
|
1970
1988
|
// src/components/utils/decimalSeparator.ts
|
|
@@ -2004,7 +2022,7 @@ function toAriaNumber(value) {
|
|
|
2004
2022
|
return typeof value === "number" ? value : Number(value);
|
|
2005
2023
|
}
|
|
2006
2024
|
function ClearButton({ label, onClear }) {
|
|
2007
|
-
const state =
|
|
2025
|
+
const state = React18.useContext(import_react_aria_components23.NumberFieldStateContext);
|
|
2008
2026
|
if (!state?.inputValue) {
|
|
2009
2027
|
return null;
|
|
2010
2028
|
}
|
|
@@ -2036,7 +2054,7 @@ function NumberField({
|
|
|
2036
2054
|
const { locale } = (0, import_react_aria_components23.useLocale)();
|
|
2037
2055
|
const empty = emptyValue === void 0 ? NaN : emptyValue;
|
|
2038
2056
|
const isControlled = value !== void 0;
|
|
2039
|
-
const [ownValue, setOwnValue] =
|
|
2057
|
+
const [ownValue, setOwnValue] = React18.useState(() => toAriaNumber(defaultValue) ?? NaN);
|
|
2040
2058
|
const takesOverValue = Boolean(isClearable) && !isControlled;
|
|
2041
2059
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
|
|
2042
2060
|
const handleChange = (next) => {
|
|
@@ -2177,7 +2195,7 @@ function QuantityStepper({ size = "md", ...rest }) {
|
|
|
2177
2195
|
}
|
|
2178
2196
|
|
|
2179
2197
|
// src/components/forms/DatePicker.tsx
|
|
2180
|
-
var
|
|
2198
|
+
var React19 = __toESM(require("react"), 1);
|
|
2181
2199
|
var import_react_aria_components25 = require("react-aria-components");
|
|
2182
2200
|
|
|
2183
2201
|
// src/components/forms/CalendarMonth.tsx
|
|
@@ -2237,7 +2255,7 @@ function coerceBound(value) {
|
|
|
2237
2255
|
// src/components/forms/DatePicker.tsx
|
|
2238
2256
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2239
2257
|
function ClearButton2({ label }) {
|
|
2240
|
-
const state =
|
|
2258
|
+
const state = React19.useContext(import_react_aria_components25.DatePickerStateContext);
|
|
2241
2259
|
if (!state?.value) {
|
|
2242
2260
|
return null;
|
|
2243
2261
|
}
|
|
@@ -2314,7 +2332,7 @@ function DatePicker({
|
|
|
2314
2332
|
}
|
|
2315
2333
|
|
|
2316
2334
|
// src/components/forms/DateRangePicker.tsx
|
|
2317
|
-
var
|
|
2335
|
+
var React20 = __toESM(require("react"), 1);
|
|
2318
2336
|
var import_react_aria_components26 = require("react-aria-components");
|
|
2319
2337
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2320
2338
|
function coerceRange(range) {
|
|
@@ -2337,7 +2355,7 @@ function rangeLengthInDays(range) {
|
|
|
2337
2355
|
return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
|
|
2338
2356
|
}
|
|
2339
2357
|
function ClearButton3({ label }) {
|
|
2340
|
-
const state =
|
|
2358
|
+
const state = React20.useContext(import_react_aria_components26.DateRangePickerStateContext);
|
|
2341
2359
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2342
2360
|
return null;
|
|
2343
2361
|
}
|
|
@@ -2449,14 +2467,14 @@ function DateRangePicker({
|
|
|
2449
2467
|
}
|
|
2450
2468
|
|
|
2451
2469
|
// src/components/forms/ValueHelpField.tsx
|
|
2452
|
-
var
|
|
2470
|
+
var React24 = __toESM(require("react"), 1);
|
|
2453
2471
|
|
|
2454
2472
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2455
|
-
var
|
|
2473
|
+
var React23 = __toESM(require("react"), 1);
|
|
2456
2474
|
var import_react_aria_components29 = require("react-aria-components");
|
|
2457
2475
|
|
|
2458
2476
|
// src/components/feedback/Dialog.tsx
|
|
2459
|
-
var
|
|
2477
|
+
var React21 = __toESM(require("react"), 1);
|
|
2460
2478
|
var import_react_aria_components27 = require("react-aria-components");
|
|
2461
2479
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2462
2480
|
function DialogTitle({ children, className }) {
|
|
@@ -2504,8 +2522,8 @@ function Dialog({
|
|
|
2504
2522
|
onClose?.();
|
|
2505
2523
|
onOpenChange?.(false);
|
|
2506
2524
|
};
|
|
2507
|
-
const parts =
|
|
2508
|
-
const slotOf = (type) => parts.find((node) =>
|
|
2525
|
+
const parts = React21.Children.toArray(children);
|
|
2526
|
+
const slotOf = (type) => parts.find((node) => React21.isValidElement(node) && node.type === type);
|
|
2509
2527
|
const titleSlot = slotOf(DialogTitle);
|
|
2510
2528
|
const descriptionSlot = slotOf(DialogDescription);
|
|
2511
2529
|
const bodySlot = slotOf(DialogBody);
|
|
@@ -2543,7 +2561,7 @@ function Dialog({
|
|
|
2543
2561
|
}
|
|
2544
2562
|
|
|
2545
2563
|
// src/components/data/DataTable.tsx
|
|
2546
|
-
var
|
|
2564
|
+
var React22 = __toESM(require("react"), 1);
|
|
2547
2565
|
var import_react_aria_components28 = require("react-aria-components");
|
|
2548
2566
|
|
|
2549
2567
|
// src/components/feedback/Skeleton.tsx
|
|
@@ -2595,10 +2613,7 @@ function SkeletonTableRow({
|
|
|
2595
2613
|
}
|
|
2596
2614
|
|
|
2597
2615
|
// src/components/data/DataTable.tsx
|
|
2598
|
-
var import_jsx_runtime39 = (
|
|
2599
|
-
// biome-ignore lint/a11y/noStaticElementInteractions: not a control — it only intercepts events bubbling out of the fields inside it, so the grid does not act on them
|
|
2600
|
-
require("react/jsx-runtime")
|
|
2601
|
-
);
|
|
2616
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2602
2617
|
var CHECKBOX_W = 44;
|
|
2603
2618
|
var PENDING_KEY = "__pire_pending_row__";
|
|
2604
2619
|
var FIELD_SELECTOR = [
|
|
@@ -2609,6 +2624,7 @@ var FIELD_SELECTOR = [
|
|
|
2609
2624
|
'[contenteditable="true"]',
|
|
2610
2625
|
'[tabindex]:not([tabindex="-1"])'
|
|
2611
2626
|
].join(",");
|
|
2627
|
+
var EditActionsContext = React22.createContext(null);
|
|
2612
2628
|
function EditCell({
|
|
2613
2629
|
children,
|
|
2614
2630
|
isFirst,
|
|
@@ -2616,11 +2632,11 @@ function EditCell({
|
|
|
2616
2632
|
onCommit,
|
|
2617
2633
|
onCancel
|
|
2618
2634
|
}) {
|
|
2619
|
-
const state =
|
|
2635
|
+
const state = React22.useContext(import_react_aria_components28.TableStateContext);
|
|
2620
2636
|
const setNavDisabled = state?.setKeyboardNavigationDisabled;
|
|
2621
|
-
const ref =
|
|
2622
|
-
const focusedWithin =
|
|
2623
|
-
|
|
2637
|
+
const ref = React22.useRef(null);
|
|
2638
|
+
const focusedWithin = React22.useRef(false);
|
|
2639
|
+
React22.useLayoutEffect(() => {
|
|
2624
2640
|
if (!isFirst) return;
|
|
2625
2641
|
const row = ref.current?.closest('[role="row"]');
|
|
2626
2642
|
void focusToken;
|
|
@@ -2632,7 +2648,7 @@ function EditCell({
|
|
|
2632
2648
|
}
|
|
2633
2649
|
}
|
|
2634
2650
|
}, [isFirst, focusToken]);
|
|
2635
|
-
|
|
2651
|
+
React22.useLayoutEffect(() => {
|
|
2636
2652
|
if (!isFirst) return;
|
|
2637
2653
|
const row = ref.current?.closest('[role="row"]');
|
|
2638
2654
|
return () => {
|
|
@@ -2642,58 +2658,62 @@ function EditCell({
|
|
|
2642
2658
|
});
|
|
2643
2659
|
};
|
|
2644
2660
|
}, [isFirst]);
|
|
2645
|
-
|
|
2661
|
+
React22.useEffect(
|
|
2646
2662
|
() => () => {
|
|
2647
2663
|
if (focusedWithin.current) setNavDisabled?.(false);
|
|
2648
2664
|
},
|
|
2649
2665
|
[setNavDisabled]
|
|
2650
2666
|
);
|
|
2651
2667
|
const stop = (e) => e.stopPropagation();
|
|
2652
|
-
return
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
e.
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2668
|
+
return (
|
|
2669
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: not a control — it only intercepts events bubbling out of the fields inside it, so the grid does not act on them
|
|
2670
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2671
|
+
"div",
|
|
2672
|
+
{
|
|
2673
|
+
ref,
|
|
2674
|
+
className: "pire-td-edit",
|
|
2675
|
+
onFocus: (e) => {
|
|
2676
|
+
e.stopPropagation();
|
|
2677
|
+
focusedWithin.current = true;
|
|
2678
|
+
setNavDisabled?.(true);
|
|
2679
|
+
},
|
|
2680
|
+
onBlur: (e) => {
|
|
2681
|
+
const next = e.relatedTarget;
|
|
2682
|
+
const row = ref.current?.closest('[role="row"]');
|
|
2683
|
+
if (next && row?.contains(next) && next.closest(".pire-td-edit")) return;
|
|
2684
|
+
focusedWithin.current = false;
|
|
2685
|
+
setNavDisabled?.(false);
|
|
2686
|
+
},
|
|
2687
|
+
onKeyDown: (e) => {
|
|
2688
|
+
stop(e);
|
|
2689
|
+
if (e.nativeEvent.isComposing || e.defaultPrevented) return;
|
|
2690
|
+
if (e.key === "Enter" && !(e.target instanceof HTMLTextAreaElement)) {
|
|
2691
|
+
e.preventDefault();
|
|
2692
|
+
onCommit();
|
|
2693
|
+
} else if (e.key === "Escape") {
|
|
2694
|
+
e.preventDefault();
|
|
2695
|
+
onCancel();
|
|
2696
|
+
}
|
|
2697
|
+
},
|
|
2698
|
+
onPointerDown: stop,
|
|
2699
|
+
onMouseDown: stop,
|
|
2700
|
+
onClick: stop,
|
|
2701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EditActionsContext.Provider, { value: { commit: onCommit, cancel: onCancel }, children })
|
|
2702
|
+
}
|
|
2703
|
+
)
|
|
2685
2704
|
);
|
|
2686
2705
|
}
|
|
2687
|
-
var LiveEditContext =
|
|
2706
|
+
var LiveEditContext = React22.createContext(null);
|
|
2688
2707
|
function LiveEditField({ columnKey, row }) {
|
|
2689
|
-
const live =
|
|
2708
|
+
const live = React22.useContext(LiveEditContext);
|
|
2709
|
+
const actions = React22.useContext(EditActionsContext);
|
|
2690
2710
|
const column = live?.columns.find((c) => c.key === columnKey);
|
|
2691
2711
|
const target = row ?? live?.pendingRow;
|
|
2692
|
-
return target && column?.renderEdit ? column.renderEdit(target) : null;
|
|
2712
|
+
return target && actions && column?.renderEdit ? column.renderEdit(target, actions) : null;
|
|
2693
2713
|
}
|
|
2694
2714
|
function useTableElement(deps, columnFunctions, isEditing, build) {
|
|
2695
|
-
const cache =
|
|
2696
|
-
const churn =
|
|
2715
|
+
const cache = React22.useRef(null);
|
|
2716
|
+
const churn = React22.useRef(0);
|
|
2697
2717
|
const prev = cache.current;
|
|
2698
2718
|
if (prev && sameValues(prev.deps, deps) && sameValues(prev.columnFunctions, columnFunctions)) {
|
|
2699
2719
|
churn.current = 0;
|
|
@@ -2738,13 +2758,13 @@ function DataTable({
|
|
|
2738
2758
|
"aria-label": ariaLabel
|
|
2739
2759
|
}) {
|
|
2740
2760
|
const msg = usePireMessages();
|
|
2741
|
-
const [pendingFocus, setPendingFocus] =
|
|
2742
|
-
const latest =
|
|
2761
|
+
const [pendingFocus, setPendingFocus] = React22.useState(0);
|
|
2762
|
+
const latest = React22.useRef({ onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow });
|
|
2743
2763
|
latest.current = { onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow };
|
|
2744
2764
|
const isEditing = (row) => editingRowId != null && String(row.id) === String(editingRowId);
|
|
2745
2765
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2746
2766
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2747
|
-
const pinnedGeometry =
|
|
2767
|
+
const pinnedGeometry = React22.useMemo(() => {
|
|
2748
2768
|
const geometry = /* @__PURE__ */ new Map();
|
|
2749
2769
|
let x = hasCheckboxColumn ? CHECKBOX_W : 0;
|
|
2750
2770
|
let broke = null;
|
|
@@ -3026,13 +3046,13 @@ function ValueHelpDialog({
|
|
|
3026
3046
|
}) {
|
|
3027
3047
|
const msg = usePireMessages();
|
|
3028
3048
|
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
3029
|
-
const [query, setQuery] =
|
|
3030
|
-
|
|
3049
|
+
const [query, setQuery] = React23.useState("");
|
|
3050
|
+
React23.useEffect(() => {
|
|
3031
3051
|
if (isOpen) setQuery("");
|
|
3032
3052
|
}, [isOpen]);
|
|
3033
3053
|
const isMultiple = selectionMode === "multiple";
|
|
3034
3054
|
const { contains } = (0, import_react_aria_components29.useFilter)({ sensitivity: "base" });
|
|
3035
|
-
const filtered =
|
|
3055
|
+
const filtered = React23.useMemo(() => {
|
|
3036
3056
|
if (isFilteredExternally) return rows;
|
|
3037
3057
|
const q = query.trim();
|
|
3038
3058
|
if (!q) return rows;
|
|
@@ -3135,7 +3155,7 @@ function ValueHelpField({
|
|
|
3135
3155
|
style
|
|
3136
3156
|
}) {
|
|
3137
3157
|
const msg = usePireMessages();
|
|
3138
|
-
const [open, setOpen] =
|
|
3158
|
+
const [open, setOpen] = React24.useState(false);
|
|
3139
3159
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cx(className), style, children: [
|
|
3140
3160
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3141
3161
|
Input,
|
|
@@ -3191,7 +3211,7 @@ function ValueHelpField({
|
|
|
3191
3211
|
}
|
|
3192
3212
|
|
|
3193
3213
|
// src/components/forms/FileUpload.tsx
|
|
3194
|
-
var
|
|
3214
|
+
var React25 = __toESM(require("react"), 1);
|
|
3195
3215
|
var import_react_aria_components31 = require("react-aria-components");
|
|
3196
3216
|
|
|
3197
3217
|
// src/components/feedback/ProgressBar.tsx
|
|
@@ -3206,6 +3226,8 @@ function ProgressBar({
|
|
|
3206
3226
|
isIndeterminate,
|
|
3207
3227
|
status = "informative",
|
|
3208
3228
|
size = "md",
|
|
3229
|
+
"aria-label": ariaLabel,
|
|
3230
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3209
3231
|
className,
|
|
3210
3232
|
style
|
|
3211
3233
|
}) {
|
|
@@ -3219,6 +3241,8 @@ function ProgressBar({
|
|
|
3219
3241
|
minValue,
|
|
3220
3242
|
maxValue,
|
|
3221
3243
|
isIndeterminate,
|
|
3244
|
+
"aria-label": ariaLabel,
|
|
3245
|
+
"aria-labelledby": ariaLabelledBy,
|
|
3222
3246
|
style,
|
|
3223
3247
|
children: ({ percentage, valueText }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
3224
3248
|
label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pire-progress-head", children: [
|
|
@@ -3261,8 +3285,8 @@ function screenFiles(files, { maxSize, acceptedFileTypes }) {
|
|
|
3261
3285
|
return { accepted, rejected };
|
|
3262
3286
|
}
|
|
3263
3287
|
function usePreviewUrls(files) {
|
|
3264
|
-
const owned =
|
|
3265
|
-
|
|
3288
|
+
const owned = React25.useRef(/* @__PURE__ */ new Set());
|
|
3289
|
+
React25.useEffect(() => {
|
|
3266
3290
|
const live = new Set(files.map((f) => f.previewUrl));
|
|
3267
3291
|
for (const url of owned.current) {
|
|
3268
3292
|
if (live.has(url)) continue;
|
|
@@ -3270,7 +3294,7 @@ function usePreviewUrls(files) {
|
|
|
3270
3294
|
owned.current.delete(url);
|
|
3271
3295
|
}
|
|
3272
3296
|
}, [files]);
|
|
3273
|
-
|
|
3297
|
+
React25.useEffect(() => {
|
|
3274
3298
|
const urls = owned.current;
|
|
3275
3299
|
return () => {
|
|
3276
3300
|
for (const url of urls) URL.revokeObjectURL(url);
|
|
@@ -3295,7 +3319,7 @@ function useFileList({
|
|
|
3295
3319
|
isDisabled,
|
|
3296
3320
|
isReadOnly
|
|
3297
3321
|
}) {
|
|
3298
|
-
const [uncontrolled, setUncontrolled] =
|
|
3322
|
+
const [uncontrolled, setUncontrolled] = React25.useState(defaultValue ?? []);
|
|
3299
3323
|
const files = value ?? uncontrolled;
|
|
3300
3324
|
const previewUrlFor = usePreviewUrls(files);
|
|
3301
3325
|
const commit = (next) => {
|
|
@@ -3322,7 +3346,7 @@ function useFileFieldIds({
|
|
|
3322
3346
|
errorMessage,
|
|
3323
3347
|
isInvalid
|
|
3324
3348
|
}) {
|
|
3325
|
-
const id =
|
|
3349
|
+
const id = React25.useId();
|
|
3326
3350
|
const labelId = label ? `${id}-label` : void 0;
|
|
3327
3351
|
const hintId = description ? `${id}-hint` : void 0;
|
|
3328
3352
|
const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
|
|
@@ -3462,7 +3486,7 @@ function FileUpload({
|
|
|
3462
3486
|
var import_react_aria_components34 = require("react-aria-components");
|
|
3463
3487
|
|
|
3464
3488
|
// src/components/navigation/Breadcrumb.tsx
|
|
3465
|
-
var
|
|
3489
|
+
var React26 = __toESM(require("react"), 1);
|
|
3466
3490
|
var import_react_aria_components33 = require("react-aria-components");
|
|
3467
3491
|
|
|
3468
3492
|
// src/components/navigation/Menu.tsx
|
|
@@ -3527,10 +3551,10 @@ var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
|
3527
3551
|
var keyOf = (item) => item.id ?? item.label;
|
|
3528
3552
|
var MIN_CURRENT = 64;
|
|
3529
3553
|
function useFitLevel(enabled) {
|
|
3530
|
-
const boxRef =
|
|
3531
|
-
const measureRef =
|
|
3532
|
-
const [level, setLevel] =
|
|
3533
|
-
|
|
3554
|
+
const boxRef = React26.useRef(null);
|
|
3555
|
+
const measureRef = React26.useRef(null);
|
|
3556
|
+
const [level, setLevel] = React26.useState(0);
|
|
3557
|
+
React26.useLayoutEffect(() => {
|
|
3534
3558
|
const box = boxRef.current;
|
|
3535
3559
|
const measure = measureRef.current;
|
|
3536
3560
|
if (!enabled || !box || !measure) return;
|
|
@@ -3603,7 +3627,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3603
3627
|
"data-collapsible": "true",
|
|
3604
3628
|
onAction: (key) => onNavigate?.(String(key)),
|
|
3605
3629
|
children: shown.map(
|
|
3606
|
-
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3630
|
+
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(React26.Fragment, { children: [
|
|
3607
3631
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_aria_components33.Breadcrumb, { className: "pire-breadcrumb", id: "__pire_breadcrumb_more__", children: [
|
|
3608
3632
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_aria_components33.MenuTrigger, { children: [
|
|
3609
3633
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_aria_components33.Button, { className: "pire-breadcrumb-more", "aria-label": msg.breadcrumbMore, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
@@ -3711,7 +3735,7 @@ function ShellBar({
|
|
|
3711
3735
|
}
|
|
3712
3736
|
|
|
3713
3737
|
// src/components/navigation/SideNav.tsx
|
|
3714
|
-
var
|
|
3738
|
+
var React27 = __toESM(require("react"), 1);
|
|
3715
3739
|
var import_react_aria_components35 = require("react-aria-components");
|
|
3716
3740
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3717
3741
|
function findActiveParent(groups, value) {
|
|
@@ -3740,10 +3764,10 @@ function SideNav({
|
|
|
3740
3764
|
const msg = usePireMessages();
|
|
3741
3765
|
const activeParent = findActiveParent(groups, value);
|
|
3742
3766
|
const isControlled = expandedIds != null;
|
|
3743
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3767
|
+
const [ownExpanded, setOwnExpanded] = React27.useState(
|
|
3744
3768
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3745
3769
|
);
|
|
3746
|
-
const [lastValue, setLastValue] =
|
|
3770
|
+
const [lastValue, setLastValue] = React27.useState(value);
|
|
3747
3771
|
if (value !== lastValue) {
|
|
3748
3772
|
setLastValue(value);
|
|
3749
3773
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3874,7 +3898,7 @@ function SideNav({
|
|
|
3874
3898
|
}
|
|
3875
3899
|
|
|
3876
3900
|
// src/components/navigation/ShellRail.tsx
|
|
3877
|
-
var
|
|
3901
|
+
var React28 = __toESM(require("react"), 1);
|
|
3878
3902
|
var import_react_aria_components36 = require("react-aria-components");
|
|
3879
3903
|
var import_jsx_runtime48 = (
|
|
3880
3904
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
@@ -3883,7 +3907,7 @@ var import_jsx_runtime48 = (
|
|
|
3883
3907
|
);
|
|
3884
3908
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
3885
3909
|
const msg = usePireMessages();
|
|
3886
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(React28.Fragment, { children: [
|
|
3887
3911
|
gi > 0 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-shellrail-divider" }) : null,
|
|
3888
3912
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3889
3913
|
import_react_aria_components36.Button,
|
|
@@ -3993,7 +4017,7 @@ function Pagination({
|
|
|
3993
4017
|
}
|
|
3994
4018
|
|
|
3995
4019
|
// src/components/navigation/Ribbon.tsx
|
|
3996
|
-
var
|
|
4020
|
+
var React29 = __toESM(require("react"), 1);
|
|
3997
4021
|
var import_react_aria_components38 = require("react-aria-components");
|
|
3998
4022
|
var import_jsx_runtime51 = (
|
|
3999
4023
|
// The tile is a column with no room for a third line under a two-line caption, and a mark
|
|
@@ -4013,7 +4037,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
4013
4037
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
4014
4038
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
4015
4039
|
function describe(child) {
|
|
4016
|
-
if (!
|
|
4040
|
+
if (!React29.isValidElement(child)) return JSON.stringify(child);
|
|
4017
4041
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
4018
4042
|
const type = child.type;
|
|
4019
4043
|
return type?.displayName || type?.name || "a component";
|
|
@@ -4021,13 +4045,13 @@ function describe(child) {
|
|
|
4021
4045
|
function childrenOfType(children, type, what, parent) {
|
|
4022
4046
|
const out = [];
|
|
4023
4047
|
const walk = (nodes, path) => {
|
|
4024
|
-
|
|
4048
|
+
React29.Children.forEach(nodes, (child, i) => {
|
|
4025
4049
|
if (child == null || typeof child === "boolean") return;
|
|
4026
|
-
if (
|
|
4050
|
+
if (React29.isValidElement(child) && child.type === React29.Fragment) {
|
|
4027
4051
|
return walk(child.props.children, `${path}${i}.`);
|
|
4028
4052
|
}
|
|
4029
|
-
if (!
|
|
4030
|
-
const isWrapper =
|
|
4053
|
+
if (!React29.isValidElement(child) || child.type !== type) {
|
|
4054
|
+
const isWrapper = React29.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
4031
4055
|
throw new Error(
|
|
4032
4056
|
`[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.` : "")
|
|
4033
4057
|
);
|
|
@@ -4100,9 +4124,9 @@ function Group8({ group, selectionCount }) {
|
|
|
4100
4124
|
] });
|
|
4101
4125
|
}
|
|
4102
4126
|
function useTrailingOverflow() {
|
|
4103
|
-
const ref =
|
|
4104
|
-
const [overflow, setOverflow] =
|
|
4105
|
-
|
|
4127
|
+
const ref = React29.useRef(null);
|
|
4128
|
+
const [overflow, setOverflow] = React29.useState(false);
|
|
4129
|
+
React29.useEffect(() => {
|
|
4106
4130
|
const node = ref.current;
|
|
4107
4131
|
if (!node) return;
|
|
4108
4132
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -4174,18 +4198,18 @@ function Ribbon({
|
|
|
4174
4198
|
const count = selectionCount ?? 0;
|
|
4175
4199
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
4176
4200
|
const fallback = visible[0]?.id;
|
|
4177
|
-
const [ownTab, setOwnTab] =
|
|
4201
|
+
const [ownTab, setOwnTab] = React29.useState(defaultValue);
|
|
4178
4202
|
const requested = value ?? ownTab;
|
|
4179
4203
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
4180
|
-
const select =
|
|
4204
|
+
const select = React29.useCallback(
|
|
4181
4205
|
(id) => {
|
|
4182
4206
|
setOwnTab(id);
|
|
4183
4207
|
onChange?.(id);
|
|
4184
4208
|
},
|
|
4185
4209
|
[onChange]
|
|
4186
4210
|
);
|
|
4187
|
-
const hadSelection =
|
|
4188
|
-
|
|
4211
|
+
const hadSelection = React29.useRef(false);
|
|
4212
|
+
React29.useEffect(() => {
|
|
4189
4213
|
const has = count > 0;
|
|
4190
4214
|
if (has === hadSelection.current) return;
|
|
4191
4215
|
hadSelection.current = has;
|
|
@@ -4194,16 +4218,16 @@ function Ribbon({
|
|
|
4194
4218
|
if (has) select(contextual.id);
|
|
4195
4219
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
4196
4220
|
}, [count, tabs, requested, select]);
|
|
4197
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
4221
|
+
const [ownCollapsed, setOwnCollapsed] = React29.useState(false);
|
|
4198
4222
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
4199
|
-
const toggleRef =
|
|
4200
|
-
const restoreFocus =
|
|
4201
|
-
|
|
4223
|
+
const toggleRef = React29.useRef(null);
|
|
4224
|
+
const restoreFocus = React29.useRef(false);
|
|
4225
|
+
React29.useLayoutEffect(() => {
|
|
4202
4226
|
if (!restoreFocus.current) return;
|
|
4203
4227
|
restoreFocus.current = false;
|
|
4204
4228
|
toggleRef.current?.focus();
|
|
4205
4229
|
});
|
|
4206
|
-
const bandId =
|
|
4230
|
+
const bandId = React29.useId();
|
|
4207
4231
|
const toggle = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
4208
4232
|
import_react_aria_components38.Button,
|
|
4209
4233
|
{
|
|
@@ -4235,7 +4259,7 @@ function Ribbon({
|
|
|
4235
4259
|
children: [
|
|
4236
4260
|
primaries.map((c) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key)),
|
|
4237
4261
|
leading ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
4238
|
-
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
4262
|
+
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(React29.Fragment, { children: [
|
|
4239
4263
|
i > 0 || leading || primaries.length ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
4240
4264
|
block.commands.map((c) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
4241
4265
|
] }, block.key))
|
|
@@ -4314,7 +4338,7 @@ function InlineMessage({
|
|
|
4314
4338
|
}
|
|
4315
4339
|
|
|
4316
4340
|
// src/components/feedback/Toast.tsx
|
|
4317
|
-
var
|
|
4341
|
+
var React30 = __toESM(require("react"), 1);
|
|
4318
4342
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4319
4343
|
function Toast({
|
|
4320
4344
|
kind = "success",
|
|
@@ -4341,21 +4365,21 @@ function Toast({
|
|
|
4341
4365
|
}
|
|
4342
4366
|
);
|
|
4343
4367
|
}
|
|
4344
|
-
var ToastContext =
|
|
4368
|
+
var ToastContext = React30.createContext(null);
|
|
4345
4369
|
function ToastProvider({
|
|
4346
4370
|
children,
|
|
4347
4371
|
timeout = 6e3
|
|
4348
4372
|
}) {
|
|
4349
4373
|
const msg = usePireMessages();
|
|
4350
|
-
const [toasts, setToasts] =
|
|
4351
|
-
const timers =
|
|
4352
|
-
const nextId =
|
|
4353
|
-
const close =
|
|
4374
|
+
const [toasts, setToasts] = React30.useState([]);
|
|
4375
|
+
const timers = React30.useRef(/* @__PURE__ */ new Map());
|
|
4376
|
+
const nextId = React30.useRef(0);
|
|
4377
|
+
const close = React30.useCallback((id) => {
|
|
4354
4378
|
clearTimeout(timers.current.get(id));
|
|
4355
4379
|
timers.current.delete(id);
|
|
4356
4380
|
setToasts((t) => t.filter((x) => x.id !== id));
|
|
4357
4381
|
}, []);
|
|
4358
|
-
const add =
|
|
4382
|
+
const add = React30.useCallback(
|
|
4359
4383
|
(toast) => {
|
|
4360
4384
|
const id = String(++nextId.current);
|
|
4361
4385
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
@@ -4369,21 +4393,21 @@ function ToastProvider({
|
|
|
4369
4393
|
},
|
|
4370
4394
|
[close, timeout]
|
|
4371
4395
|
);
|
|
4372
|
-
|
|
4396
|
+
React30.useEffect(() => {
|
|
4373
4397
|
const pending = timers.current;
|
|
4374
4398
|
return () => {
|
|
4375
4399
|
for (const timer of pending.values()) clearTimeout(timer);
|
|
4376
4400
|
pending.clear();
|
|
4377
4401
|
};
|
|
4378
4402
|
}, []);
|
|
4379
|
-
const value =
|
|
4403
|
+
const value = React30.useMemo(() => ({ add, close }), [add, close]);
|
|
4380
4404
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(ToastContext.Provider, { value, children: [
|
|
4381
4405
|
children,
|
|
4382
4406
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Toast, { kind: t.kind, onClose: () => close(t.id), children: t.message }, t.id)) })
|
|
4383
4407
|
] });
|
|
4384
4408
|
}
|
|
4385
4409
|
function useToast() {
|
|
4386
|
-
const ctx =
|
|
4410
|
+
const ctx = React30.useContext(ToastContext);
|
|
4387
4411
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
4388
4412
|
return ctx;
|
|
4389
4413
|
}
|
|
@@ -4748,14 +4772,14 @@ function BarChart({
|
|
|
4748
4772
|
}
|
|
4749
4773
|
|
|
4750
4774
|
// src/components/data/LineChart.tsx
|
|
4751
|
-
var
|
|
4775
|
+
var React31 = __toESM(require("react"), 1);
|
|
4752
4776
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4753
4777
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4754
4778
|
var MARKER_LIMIT = 20;
|
|
4755
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4779
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React31.useEffect : React31.useLayoutEffect;
|
|
4756
4780
|
function useMeasuredWidth() {
|
|
4757
|
-
const ref =
|
|
4758
|
-
const [width, setWidth] =
|
|
4781
|
+
const ref = React31.useRef(null);
|
|
4782
|
+
const [width, setWidth] = React31.useState(0);
|
|
4759
4783
|
useIsomorphicLayoutEffect2(() => {
|
|
4760
4784
|
const element = ref.current;
|
|
4761
4785
|
if (!element) return;
|
|
@@ -4922,7 +4946,7 @@ function LineChart({
|
|
|
4922
4946
|
}
|
|
4923
4947
|
|
|
4924
4948
|
// src/components/data/DonutChart.tsx
|
|
4925
|
-
var
|
|
4949
|
+
var React32 = __toESM(require("react"), 1);
|
|
4926
4950
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4927
4951
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4928
4952
|
function DonutChart({
|
|
@@ -4942,7 +4966,7 @@ function DonutChart({
|
|
|
4942
4966
|
"aria-label": label
|
|
4943
4967
|
}) {
|
|
4944
4968
|
const msg = usePireMessages();
|
|
4945
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4969
|
+
const [hoveredIndex, setHoveredIndex] = React32.useState(null);
|
|
4946
4970
|
warnOnDonutShape(series, categories.length, label);
|
|
4947
4971
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4948
4972
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -5140,10 +5164,14 @@ function PageBand({
|
|
|
5140
5164
|
|
|
5141
5165
|
// src/components/layout/PageHeader.tsx
|
|
5142
5166
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
5143
|
-
function PageHeader({ title, subtitle, actions, className, ...rest }) {
|
|
5167
|
+
function PageHeader({ title, badge, subtitle, actions, className, ...rest }) {
|
|
5168
|
+
const heading = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h1", { className: "pire-pageheader-title", children: title });
|
|
5144
5169
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("header", { className: cx("pire-pageheader", className), ...rest, children: [
|
|
5145
5170
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "pire-pageheader-text", children: [
|
|
5146
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.
|
|
5171
|
+
badge ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "pire-pageheader-titlerow", children: [
|
|
5172
|
+
heading,
|
|
5173
|
+
badge
|
|
5174
|
+
] }) : heading,
|
|
5147
5175
|
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "pire-pageheader-sub", children: subtitle }) : null
|
|
5148
5176
|
] }),
|
|
5149
5177
|
actions ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "pire-pageheader-actions", children: actions }) : null
|
|
@@ -5161,7 +5189,7 @@ function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
|
5161
5189
|
}
|
|
5162
5190
|
|
|
5163
5191
|
// src/components/layout/SelectionBar.tsx
|
|
5164
|
-
var
|
|
5192
|
+
var React33 = __toESM(require("react"), 1);
|
|
5165
5193
|
var import_react_aria_components42 = require("react-aria-components");
|
|
5166
5194
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
5167
5195
|
function SelectionBar({
|
|
@@ -5178,8 +5206,8 @@ function SelectionBar({
|
|
|
5178
5206
|
}) {
|
|
5179
5207
|
const msg = usePireMessages();
|
|
5180
5208
|
const { locale } = (0, import_react_aria_components42.useLocale)();
|
|
5181
|
-
const plural =
|
|
5182
|
-
const numbers =
|
|
5209
|
+
const plural = React33.useMemo(() => new Intl.PluralRules(locale), [locale]);
|
|
5210
|
+
const numbers = React33.useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
5183
5211
|
if (!count) return null;
|
|
5184
5212
|
const isOne = plural.select(count) === "one";
|
|
5185
5213
|
let sentence;
|
|
@@ -5298,15 +5326,15 @@ function ConfirmDialog({
|
|
|
5298
5326
|
}
|
|
5299
5327
|
|
|
5300
5328
|
// src/components/patterns/CommandPalette.tsx
|
|
5301
|
-
var
|
|
5329
|
+
var React35 = __toESM(require("react"), 1);
|
|
5302
5330
|
var import_react_aria_components43 = require("react-aria-components");
|
|
5303
5331
|
|
|
5304
5332
|
// src/components/utils/useDocumentKeyDown.ts
|
|
5305
|
-
var
|
|
5333
|
+
var React34 = __toESM(require("react"), 1);
|
|
5306
5334
|
function useDocumentKeyDown(onKeyDown, isDisabled) {
|
|
5307
|
-
const handler =
|
|
5335
|
+
const handler = React34.useRef(onKeyDown);
|
|
5308
5336
|
handler.current = onKeyDown;
|
|
5309
|
-
|
|
5337
|
+
React34.useEffect(() => {
|
|
5310
5338
|
if (isDisabled) return;
|
|
5311
5339
|
const listener = (event) => handler.current(event);
|
|
5312
5340
|
document.addEventListener("keydown", listener);
|
|
@@ -5336,17 +5364,17 @@ function CommandPalette({
|
|
|
5336
5364
|
style
|
|
5337
5365
|
}) {
|
|
5338
5366
|
const msg = usePireMessages();
|
|
5339
|
-
const [query, setQuery] =
|
|
5367
|
+
const [query, setQuery] = React35.useState("");
|
|
5340
5368
|
const { contains } = (0, import_react_aria_components43.useFilter)({ sensitivity: "base" });
|
|
5341
|
-
|
|
5369
|
+
React35.useEffect(() => {
|
|
5342
5370
|
if (isOpen) setQuery("");
|
|
5343
5371
|
}, [isOpen]);
|
|
5344
|
-
const searchableById =
|
|
5372
|
+
const searchableById = React35.useMemo(() => {
|
|
5345
5373
|
const byId = /* @__PURE__ */ new Map();
|
|
5346
5374
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
5347
5375
|
return byId;
|
|
5348
5376
|
}, [groups]);
|
|
5349
|
-
const filter =
|
|
5377
|
+
const filter = React35.useCallback(
|
|
5350
5378
|
(textValue, inputValue, node) => {
|
|
5351
5379
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
5352
5380
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -5441,7 +5469,7 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
|
5441
5469
|
}
|
|
5442
5470
|
|
|
5443
5471
|
// src/components/patterns/AppLauncher.tsx
|
|
5444
|
-
var
|
|
5472
|
+
var React36 = __toESM(require("react"), 1);
|
|
5445
5473
|
var import_react_aria_components44 = require("react-aria-components");
|
|
5446
5474
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5447
5475
|
var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
@@ -5462,13 +5490,13 @@ function AppLauncher({
|
|
|
5462
5490
|
className
|
|
5463
5491
|
}) {
|
|
5464
5492
|
const msg = usePireMessages();
|
|
5465
|
-
const [query, setQuery] =
|
|
5493
|
+
const [query, setQuery] = React36.useState("");
|
|
5466
5494
|
const { contains } = (0, import_react_aria_components44.useFilter)({ sensitivity: "base" });
|
|
5467
5495
|
const handleSearch = (next) => {
|
|
5468
5496
|
setQuery(next);
|
|
5469
5497
|
onSearchChange?.(next);
|
|
5470
5498
|
};
|
|
5471
|
-
const visible =
|
|
5499
|
+
const visible = React36.useMemo(() => {
|
|
5472
5500
|
if (isFilteredExternally) return sections;
|
|
5473
5501
|
const q = query.trim();
|
|
5474
5502
|
if (!q) return sections;
|
|
@@ -5561,7 +5589,7 @@ function AppLauncher({
|
|
|
5561
5589
|
}
|
|
5562
5590
|
|
|
5563
5591
|
// src/components/patterns/SidePanel.tsx
|
|
5564
|
-
var
|
|
5592
|
+
var React37 = __toESM(require("react"), 1);
|
|
5565
5593
|
var import_react_aria_components45 = require("react-aria-components");
|
|
5566
5594
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
5567
5595
|
var PHONE_MAX_WIDTH = 600;
|
|
@@ -5586,8 +5614,8 @@ function SidePanel({
|
|
|
5586
5614
|
className
|
|
5587
5615
|
}) {
|
|
5588
5616
|
const msg = usePireMessages();
|
|
5589
|
-
const titleId =
|
|
5590
|
-
const narrow =
|
|
5617
|
+
const titleId = React37.useId();
|
|
5618
|
+
const narrow = React37.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
|
|
5591
5619
|
const head = (heading) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5592
5620
|
DialogHeader,
|
|
5593
5621
|
{
|
|
@@ -5664,7 +5692,7 @@ function EmptyState({
|
|
|
5664
5692
|
}
|
|
5665
5693
|
|
|
5666
5694
|
// src/components/patterns/NumPad.tsx
|
|
5667
|
-
var
|
|
5695
|
+
var React38 = __toESM(require("react"), 1);
|
|
5668
5696
|
var import_react_aria_components46 = require("react-aria-components");
|
|
5669
5697
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
5670
5698
|
var BASE_KEYS = [
|
|
@@ -5731,11 +5759,11 @@ function NumPad({
|
|
|
5731
5759
|
style
|
|
5732
5760
|
}) {
|
|
5733
5761
|
const msg = usePireMessages();
|
|
5734
|
-
const containerRef =
|
|
5762
|
+
const containerRef = React38.useRef(null);
|
|
5735
5763
|
const { locale } = (0, import_react_aria_components46.useLocale)();
|
|
5736
5764
|
const separator = decimalSeparatorFor(locale);
|
|
5737
5765
|
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5738
|
-
const applyKey =
|
|
5766
|
+
const applyKey = React38.useCallback(
|
|
5739
5767
|
(key) => {
|
|
5740
5768
|
if (isDisabled) return;
|
|
5741
5769
|
if (key.value === "backspace") {
|