@orianatech/pire 2.0.0 → 2.1.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/core/Button.d.cts +12 -0
- package/dist/components/core/Button.d.ts +12 -0
- package/dist/components/core/Button.d.ts.map +1 -1
- package/dist/components/core/ComingSoonMark.d.cts +39 -0
- package/dist/components/core/ComingSoonMark.d.ts +40 -0
- package/dist/components/core/ComingSoonMark.d.ts.map +1 -0
- package/dist/components/data/DataTable.d.cts +35 -1
- package/dist/components/data/DataTable.d.ts +35 -1
- package/dist/components/data/DataTable.d.ts.map +1 -1
- package/dist/components/forms/FormField.d.ts.map +1 -1
- package/dist/components/layout/SelectionBar.d.cts +31 -4
- package/dist/components/layout/SelectionBar.d.ts +31 -4
- package/dist/components/layout/SelectionBar.d.ts.map +1 -1
- package/dist/components/navigation/Breadcrumb.d.cts +12 -2
- package/dist/components/navigation/Breadcrumb.d.ts +12 -2
- package/dist/components/navigation/Breadcrumb.d.ts.map +1 -1
- package/dist/components/navigation/Ribbon.d.cts +27 -0
- package/dist/components/navigation/Ribbon.d.ts +27 -0
- package/dist/components/navigation/Ribbon.d.ts.map +1 -1
- package/dist/components/navigation/ShellBar.d.cts +19 -1
- package/dist/components/navigation/ShellBar.d.ts +19 -1
- package/dist/components/navigation/ShellBar.d.ts.map +1 -1
- package/dist/components/patterns/SidePanel.d.cts +17 -3
- package/dist/components/patterns/SidePanel.d.ts +17 -3
- package/dist/components/patterns/SidePanel.d.ts.map +1 -1
- package/dist/components.css +213 -2
- package/dist/i18n/messages.d.cts +24 -0
- package/dist/i18n/messages.d.ts +24 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +1350 -950
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1327 -919
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,18 +52,18 @@ __export(src_exports, {
|
|
|
52
52
|
DialogBody: () => DialogBody,
|
|
53
53
|
DialogDescription: () => DialogDescription,
|
|
54
54
|
DialogTitle: () => DialogTitle,
|
|
55
|
-
DialogTrigger: () =>
|
|
55
|
+
DialogTrigger: () => import_react_aria_components44.DialogTrigger,
|
|
56
56
|
DonutChart: () => DonutChart,
|
|
57
57
|
EmptyState: () => EmptyState,
|
|
58
58
|
FieldHelp: () => FieldHelp,
|
|
59
59
|
FileDropZone: () => FileDropZone,
|
|
60
60
|
FileUpload: () => FileUpload,
|
|
61
61
|
FilterBar: () => FilterBar,
|
|
62
|
-
Focusable: () =>
|
|
62
|
+
Focusable: () => import_react_aria_components45.Focusable,
|
|
63
63
|
FooterBar: () => FooterBar,
|
|
64
64
|
FormField: () => FormField,
|
|
65
65
|
Heading: () => Heading,
|
|
66
|
-
I18nProvider: () =>
|
|
66
|
+
I18nProvider: () => import_react_aria_components44.I18nProvider,
|
|
67
67
|
ICON_NAMES: () => ICON_NAMES,
|
|
68
68
|
Icon: () => Icon,
|
|
69
69
|
IconButton: () => IconButton,
|
|
@@ -78,7 +78,7 @@ __export(src_exports, {
|
|
|
78
78
|
MenuItem: () => MenuItem,
|
|
79
79
|
MenuSection: () => MenuSection,
|
|
80
80
|
MenuSeparator: () => MenuSeparator,
|
|
81
|
-
MenuTrigger: () =>
|
|
81
|
+
MenuTrigger: () => import_react_aria_components44.MenuTrigger,
|
|
82
82
|
MultiComboBox: () => MultiComboBox,
|
|
83
83
|
NumPad: () => NumPad,
|
|
84
84
|
NumberField: () => NumberField,
|
|
@@ -87,14 +87,14 @@ __export(src_exports, {
|
|
|
87
87
|
PageHeader: () => PageHeader,
|
|
88
88
|
Pagination: () => Pagination,
|
|
89
89
|
PireIntlProvider: () => PireIntlProvider,
|
|
90
|
-
Popover: () =>
|
|
90
|
+
Popover: () => import_react_aria_components44.Popover,
|
|
91
91
|
ProgressBar: () => ProgressBar,
|
|
92
92
|
QuantityStepper: () => QuantityStepper,
|
|
93
93
|
Radio: () => Radio,
|
|
94
94
|
RadioGroup: () => RadioGroup,
|
|
95
95
|
RecordCard: () => RecordCard,
|
|
96
96
|
Ribbon: () => Ribbon,
|
|
97
|
-
RouterProvider: () =>
|
|
97
|
+
RouterProvider: () => import_react_aria_components44.RouterProvider,
|
|
98
98
|
SectionHeader: () => SectionHeader,
|
|
99
99
|
SegmentedControl: () => SegmentedControl,
|
|
100
100
|
Select: () => Select,
|
|
@@ -108,7 +108,7 @@ __export(src_exports, {
|
|
|
108
108
|
SkeletonTableRow: () => SkeletonTableRow,
|
|
109
109
|
SplitPane: () => SplitPane,
|
|
110
110
|
Strong: () => Strong,
|
|
111
|
-
SubmenuTrigger: () =>
|
|
111
|
+
SubmenuTrigger: () => import_react_aria_components44.SubmenuTrigger,
|
|
112
112
|
Switch: () => Switch,
|
|
113
113
|
Tabs: () => Tabs,
|
|
114
114
|
Tag: () => Tag,
|
|
@@ -522,133 +522,11 @@ function Icon({ name, size = 16, label, pack, style, ...rest }) {
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
// src/components/core/Button.tsx
|
|
525
|
-
var React = __toESM(require("react"), 1);
|
|
526
|
-
var import_react_aria_components = require("react-aria-components");
|
|
527
|
-
|
|
528
|
-
// src/components/utils/cx.ts
|
|
529
|
-
function cx(...parts) {
|
|
530
|
-
return parts.filter(Boolean).join(" ");
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
// src/components/core/Button.tsx
|
|
534
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
535
|
-
var Button = React.forwardRef(function Button2({ children, variant = "secondary", size = "md", icon, iconEnd, fullWidth, className, ...rest }, ref) {
|
|
536
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
537
|
-
import_react_aria_components.Button,
|
|
538
|
-
{
|
|
539
|
-
ref,
|
|
540
|
-
className: cx("pire-btn", className),
|
|
541
|
-
"data-variant": variant,
|
|
542
|
-
"data-size": size,
|
|
543
|
-
"data-full-width": fullWidth ? "true" : void 0,
|
|
544
|
-
...rest,
|
|
545
|
-
children: [
|
|
546
|
-
icon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: icon, size: 16 }) : null,
|
|
547
|
-
children,
|
|
548
|
-
iconEnd ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: iconEnd, size: 16 }) : null
|
|
549
|
-
]
|
|
550
|
-
}
|
|
551
|
-
);
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
// src/components/core/IconButton.tsx
|
|
555
|
-
var React3 = __toESM(require("react"), 1);
|
|
556
|
-
var import_react_aria_components3 = require("react-aria-components");
|
|
557
|
-
|
|
558
|
-
// src/components/feedback/Tooltip.tsx
|
|
559
525
|
var React2 = __toESM(require("react"), 1);
|
|
560
|
-
var
|
|
561
|
-
var import_jsx_runtime3 = (
|
|
562
|
-
// `Focusable` also dev-warns when the element it clones onto has neither a native
|
|
563
|
-
// interactive tag nor an ARIA widget role — a bare `<span>` is neither. Every disabled
|
|
564
|
-
// control this wraps (`IconButton`, `Button`, …) is button-shaped, so `role="button"` plus
|
|
565
|
-
// `aria-disabled` describes the wrapper the same way its disabled child already describes
|
|
566
|
-
// itself, and is what lets the accessible name (from the child's own text or `aria-label`)
|
|
567
|
-
// reach the element that actually holds focus. No static `tabIndex` here on purpose: it
|
|
568
|
-
// would win over the one `Focusable` computes at clone time (react-aria's `mergeProps` lets
|
|
569
|
-
// a prop already on this element beat the one it supplies), silently making the span
|
|
570
|
-
// unfocusable again and reintroducing the defect this file exists to fix. A real `<button>`
|
|
571
|
-
// is not an option either: `children` is very often a button itself (`IconButton`), and a
|
|
572
|
-
// button nested in a button is invalid HTML that browsers repair by breaking the DOM tree.
|
|
573
|
-
// biome-ignore lint/a11y/useFocusableInteractive: tabIndex is added by Focusable's clone, not statically — see above.
|
|
574
|
-
// biome-ignore lint/a11y/useSemanticElements: a real <button> would nest inside the disabled child, which is often one itself — see above.
|
|
575
|
-
require("react/jsx-runtime")
|
|
576
|
-
);
|
|
577
|
-
function Tooltip({ label, placement = "top", delay = 500, children }) {
|
|
578
|
-
const props = React2.isValidElement(
|
|
579
|
-
children
|
|
580
|
-
) ? children.props : void 0;
|
|
581
|
-
const isDisabledChild = props?.isDisabled === true || props?.disabled === true;
|
|
582
|
-
const target = React2.isValidElement(children) && !isDisabledChild ? React2.cloneElement(children, { className: cx(children.props.className, "pire-tooltip-target") }) : isDisabledChild ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pire-tooltip-target", role: "button", "aria-disabled": "true", children }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pire-tooltip-target", children });
|
|
583
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_aria_components2.TooltipTrigger, { delay, closeDelay: 0, children: [
|
|
584
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_aria_components2.Focusable, { children: target }),
|
|
585
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_aria_components2.Tooltip, { className: "pire-tooltip", placement, offset: 6, children: [
|
|
586
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_aria_components2.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {}) }),
|
|
587
|
-
label
|
|
588
|
-
] })
|
|
589
|
-
] });
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
// src/components/core/IconButton.tsx
|
|
593
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
594
|
-
var IconButton = React3.forwardRef(function IconButton2({
|
|
595
|
-
icon,
|
|
596
|
-
label,
|
|
597
|
-
size = "md",
|
|
598
|
-
variant = "tertiary",
|
|
599
|
-
selected,
|
|
600
|
-
hideTooltip,
|
|
601
|
-
count,
|
|
602
|
-
countMax = 9,
|
|
603
|
-
countVariant = "number",
|
|
604
|
-
className,
|
|
605
|
-
...rest
|
|
606
|
-
}, ref) {
|
|
607
|
-
const showsCount = count != null && count > 0;
|
|
608
|
-
const button = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
609
|
-
import_react_aria_components3.Button,
|
|
610
|
-
{
|
|
611
|
-
ref,
|
|
612
|
-
"aria-label": label,
|
|
613
|
-
"aria-pressed": selected,
|
|
614
|
-
className: cx("pire-iconbtn", className),
|
|
615
|
-
"data-size": size,
|
|
616
|
-
"data-variant": variant,
|
|
617
|
-
"data-selected": selected ? "true" : void 0,
|
|
618
|
-
"data-has-count": showsCount ? "true" : void 0,
|
|
619
|
-
...rest,
|
|
620
|
-
children: [
|
|
621
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: icon, size: size === "lg" ? 20 : 16 }),
|
|
622
|
-
showsCount ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "pire-iconbtn-count", "data-variant": countVariant, "aria-hidden": "true", children: countVariant === "number" ? count > countMax ? `${countMax}+` : count : null }) : null
|
|
623
|
-
]
|
|
624
|
-
}
|
|
625
|
-
);
|
|
626
|
-
return hideTooltip ? button : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Tooltip, { label, children: button });
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
// src/components/core/Badge.tsx
|
|
630
|
-
var React4 = __toESM(require("react"), 1);
|
|
631
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
632
|
-
var STATUS_ICON = {
|
|
633
|
-
positive: "check-circle-2",
|
|
634
|
-
critical: "alert-triangle",
|
|
635
|
-
negative: "x-circle",
|
|
636
|
-
informative: "info",
|
|
637
|
-
neutral: "circle"
|
|
638
|
-
};
|
|
639
|
-
var Badge = React4.forwardRef(function Badge2({ children, status = "neutral", showIcon = true, className, ...rest }, ref) {
|
|
640
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { ref, className: cx("pire-badge", className), "data-status": status, ...rest, children: [
|
|
641
|
-
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { name: STATUS_ICON[status], size: 12 }) : null,
|
|
642
|
-
children
|
|
643
|
-
] });
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
// src/components/core/Tag.tsx
|
|
647
|
-
var React6 = __toESM(require("react"), 1);
|
|
648
|
-
var import_react_aria_components4 = require("react-aria-components");
|
|
526
|
+
var import_react_aria_components = require("react-aria-components");
|
|
649
527
|
|
|
650
528
|
// src/i18n/PireIntlProvider.tsx
|
|
651
|
-
var
|
|
529
|
+
var React = __toESM(require("react"), 1);
|
|
652
530
|
|
|
653
531
|
// src/i18n/messages.ts
|
|
654
532
|
var enMessages = {
|
|
@@ -737,7 +615,17 @@ var enMessages = {
|
|
|
737
615
|
tagRemove: "Remove",
|
|
738
616
|
ribbonLabel: "Commands",
|
|
739
617
|
ribbonCollapse: "Collapse the ribbon",
|
|
740
|
-
ribbonExpand: "Expand the ribbon"
|
|
618
|
+
ribbonExpand: "Expand the ribbon",
|
|
619
|
+
comingSoon: "Soon",
|
|
620
|
+
selectionBarCountOne: "{count} {noun} selected",
|
|
621
|
+
selectionBarCountOther: "{count} {noun} selected",
|
|
622
|
+
selectionBarCountOneFeminine: "{count} {noun} selected",
|
|
623
|
+
selectionBarCountOtherFeminine: "{count} {noun} selected",
|
|
624
|
+
selectionBarNounOne: "record",
|
|
625
|
+
selectionBarNounOther: "records",
|
|
626
|
+
selectionBarClear: "Clear selection",
|
|
627
|
+
breadcrumbMore: "Show the full path",
|
|
628
|
+
breadcrumbLabel: "Breadcrumb"
|
|
741
629
|
};
|
|
742
630
|
var esMessages = {
|
|
743
631
|
filterBarLabel: "Filtros",
|
|
@@ -825,29 +713,200 @@ var esMessages = {
|
|
|
825
713
|
tagRemove: "Quitar",
|
|
826
714
|
ribbonLabel: "Comandos",
|
|
827
715
|
ribbonCollapse: "Contraer la cinta",
|
|
828
|
-
ribbonExpand: "Expandir la cinta"
|
|
716
|
+
ribbonExpand: "Expandir la cinta",
|
|
717
|
+
comingSoon: "Pronto",
|
|
718
|
+
selectionBarCountOne: "{count} {noun} seleccionado",
|
|
719
|
+
selectionBarCountOther: "{count} {noun} seleccionados",
|
|
720
|
+
selectionBarCountOneFeminine: "{count} {noun} seleccionada",
|
|
721
|
+
selectionBarCountOtherFeminine: "{count} {noun} seleccionadas",
|
|
722
|
+
selectionBarNounOne: "registro",
|
|
723
|
+
selectionBarNounOther: "registros",
|
|
724
|
+
selectionBarClear: "Quitar selecci\xF3n",
|
|
725
|
+
breadcrumbMore: "Mostrar la ruta completa",
|
|
726
|
+
breadcrumbLabel: "Ruta de navegaci\xF3n"
|
|
829
727
|
};
|
|
830
728
|
|
|
831
729
|
// src/i18n/PireIntlProvider.tsx
|
|
832
|
-
var
|
|
833
|
-
var MessagesContext =
|
|
730
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
731
|
+
var MessagesContext = React.createContext(enMessages);
|
|
834
732
|
function PireIntlProvider({ messages, children }) {
|
|
835
|
-
const value =
|
|
836
|
-
return /* @__PURE__ */ (0,
|
|
733
|
+
const value = React.useMemo(() => messages ? { ...enMessages, ...messages } : enMessages, [messages]);
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MessagesContext.Provider, { value, children });
|
|
837
735
|
}
|
|
838
736
|
function usePireMessages() {
|
|
839
|
-
return
|
|
737
|
+
return React.useContext(MessagesContext);
|
|
840
738
|
}
|
|
841
739
|
function useMessage(key, override) {
|
|
842
|
-
const messages =
|
|
740
|
+
const messages = React.useContext(MessagesContext);
|
|
843
741
|
return override ?? messages[key];
|
|
844
742
|
}
|
|
845
743
|
|
|
846
|
-
// src/components/core/
|
|
744
|
+
// src/components/core/ComingSoonMark.tsx
|
|
745
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
746
|
+
function ComingSoonMark({ announce }) {
|
|
747
|
+
const msg = usePireMessages();
|
|
748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
749
|
+
announce ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "pire-sr-only", children: [
|
|
750
|
+
", ",
|
|
751
|
+
msg.comingSoon
|
|
752
|
+
] }) : null,
|
|
753
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pire-soon-mark", "aria-hidden": "true", children: msg.comingSoon })
|
|
754
|
+
] });
|
|
755
|
+
}
|
|
756
|
+
function comingSoonProps(label, comingSoon) {
|
|
757
|
+
return {
|
|
758
|
+
"aria-disabled": true,
|
|
759
|
+
"data-coming-soon": "true",
|
|
760
|
+
type: "button",
|
|
761
|
+
onPress: void 0,
|
|
762
|
+
onPressStart: void 0,
|
|
763
|
+
onPressEnd: void 0,
|
|
764
|
+
onPressUp: void 0,
|
|
765
|
+
onPressChange: void 0,
|
|
766
|
+
onClick: void 0,
|
|
767
|
+
...label != null ? { "aria-label": `${label}, ${comingSoon}` } : {}
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// src/components/utils/cx.ts
|
|
772
|
+
function cx(...parts) {
|
|
773
|
+
return parts.filter(Boolean).join(" ");
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/components/core/Button.tsx
|
|
777
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
778
|
+
var Button = React2.forwardRef(function Button2({
|
|
779
|
+
children,
|
|
780
|
+
variant = "secondary",
|
|
781
|
+
size = "md",
|
|
782
|
+
icon,
|
|
783
|
+
iconEnd,
|
|
784
|
+
fullWidth,
|
|
785
|
+
isComingSoon,
|
|
786
|
+
className,
|
|
787
|
+
...rest
|
|
788
|
+
}, ref) {
|
|
789
|
+
const msg = usePireMessages();
|
|
790
|
+
const soonLabel = rest["aria-label"] ?? (typeof children === "string" ? children : void 0);
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
792
|
+
import_react_aria_components.Button,
|
|
793
|
+
{
|
|
794
|
+
ref,
|
|
795
|
+
className: cx("pire-btn", className),
|
|
796
|
+
"data-variant": variant,
|
|
797
|
+
"data-size": size,
|
|
798
|
+
"data-full-width": fullWidth ? "true" : void 0,
|
|
799
|
+
...rest,
|
|
800
|
+
...isComingSoon ? comingSoonProps(soonLabel, msg.comingSoon) : {},
|
|
801
|
+
children: [
|
|
802
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: icon, size: 16 }) : null,
|
|
803
|
+
children,
|
|
804
|
+
iconEnd ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { name: iconEnd, size: 16 }) : null,
|
|
805
|
+
isComingSoon ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ComingSoonMark, { announce: soonLabel == null }) : null
|
|
806
|
+
]
|
|
807
|
+
}
|
|
808
|
+
);
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
// src/components/core/IconButton.tsx
|
|
812
|
+
var React4 = __toESM(require("react"), 1);
|
|
813
|
+
var import_react_aria_components3 = require("react-aria-components");
|
|
814
|
+
|
|
815
|
+
// src/components/feedback/Tooltip.tsx
|
|
816
|
+
var React3 = __toESM(require("react"), 1);
|
|
817
|
+
var import_react_aria_components2 = require("react-aria-components");
|
|
818
|
+
var import_jsx_runtime5 = (
|
|
819
|
+
// `Focusable` also dev-warns when the element it clones onto has neither a native
|
|
820
|
+
// interactive tag nor an ARIA widget role — a bare `<span>` is neither. Every disabled
|
|
821
|
+
// control this wraps (`IconButton`, `Button`, …) is button-shaped, so `role="button"` plus
|
|
822
|
+
// `aria-disabled` describes the wrapper the same way its disabled child already describes
|
|
823
|
+
// itself, and is what lets the accessible name (from the child's own text or `aria-label`)
|
|
824
|
+
// reach the element that actually holds focus. No static `tabIndex` here on purpose: it
|
|
825
|
+
// would win over the one `Focusable` computes at clone time (react-aria's `mergeProps` lets
|
|
826
|
+
// a prop already on this element beat the one it supplies), silently making the span
|
|
827
|
+
// unfocusable again and reintroducing the defect this file exists to fix. A real `<button>`
|
|
828
|
+
// is not an option either: `children` is very often a button itself (`IconButton`), and a
|
|
829
|
+
// button nested in a button is invalid HTML that browsers repair by breaking the DOM tree.
|
|
830
|
+
// biome-ignore lint/a11y/useFocusableInteractive: tabIndex is added by Focusable's clone, not statically — see above.
|
|
831
|
+
// biome-ignore lint/a11y/useSemanticElements: a real <button> would nest inside the disabled child, which is often one itself — see above.
|
|
832
|
+
require("react/jsx-runtime")
|
|
833
|
+
);
|
|
834
|
+
function Tooltip({ label, placement = "top", delay = 500, children }) {
|
|
835
|
+
const props = React3.isValidElement(
|
|
836
|
+
children
|
|
837
|
+
) ? children.props : void 0;
|
|
838
|
+
const isDisabledChild = props?.isDisabled === true || props?.disabled === true;
|
|
839
|
+
const target = React3.isValidElement(children) && !isDisabledChild ? React3.cloneElement(children, { className: cx(children.props.className, "pire-tooltip-target") }) : isDisabledChild ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "pire-tooltip-target", role: "button", "aria-disabled": "true", children }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "pire-tooltip-target", children });
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_aria_components2.TooltipTrigger, { delay, closeDelay: 0, children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_aria_components2.Focusable, { children: target }),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_aria_components2.Tooltip, { className: "pire-tooltip", placement, offset: 6, children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_aria_components2.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", {}) }),
|
|
844
|
+
label
|
|
845
|
+
] })
|
|
846
|
+
] });
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// src/components/core/IconButton.tsx
|
|
850
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
851
|
+
var IconButton = React4.forwardRef(function IconButton2({
|
|
852
|
+
icon,
|
|
853
|
+
label,
|
|
854
|
+
size = "md",
|
|
855
|
+
variant = "tertiary",
|
|
856
|
+
selected,
|
|
857
|
+
hideTooltip,
|
|
858
|
+
count,
|
|
859
|
+
countMax = 9,
|
|
860
|
+
countVariant = "number",
|
|
861
|
+
className,
|
|
862
|
+
...rest
|
|
863
|
+
}, ref) {
|
|
864
|
+
const showsCount = count != null && count > 0;
|
|
865
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
866
|
+
import_react_aria_components3.Button,
|
|
867
|
+
{
|
|
868
|
+
ref,
|
|
869
|
+
"aria-label": label,
|
|
870
|
+
"aria-pressed": selected,
|
|
871
|
+
className: cx("pire-iconbtn", className),
|
|
872
|
+
"data-size": size,
|
|
873
|
+
"data-variant": variant,
|
|
874
|
+
"data-selected": selected ? "true" : void 0,
|
|
875
|
+
"data-has-count": showsCount ? "true" : void 0,
|
|
876
|
+
...rest,
|
|
877
|
+
children: [
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: icon, size: size === "lg" ? 20 : 16 }),
|
|
879
|
+
showsCount ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "pire-iconbtn-count", "data-variant": countVariant, "aria-hidden": "true", children: countVariant === "number" ? count > countMax ? `${countMax}+` : count : null }) : null
|
|
880
|
+
]
|
|
881
|
+
}
|
|
882
|
+
);
|
|
883
|
+
return hideTooltip ? button : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Tooltip, { label, children: button });
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
// src/components/core/Badge.tsx
|
|
887
|
+
var React5 = __toESM(require("react"), 1);
|
|
847
888
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
889
|
+
var STATUS_ICON = {
|
|
890
|
+
positive: "check-circle-2",
|
|
891
|
+
critical: "alert-triangle",
|
|
892
|
+
negative: "x-circle",
|
|
893
|
+
informative: "info",
|
|
894
|
+
neutral: "circle"
|
|
895
|
+
};
|
|
896
|
+
var Badge = React5.forwardRef(function Badge2({ children, status = "neutral", showIcon = true, className, ...rest }, ref) {
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { ref, className: cx("pire-badge", className), "data-status": status, ...rest, children: [
|
|
898
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: STATUS_ICON[status], size: 12 }) : null,
|
|
899
|
+
children
|
|
900
|
+
] });
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
// src/components/core/Tag.tsx
|
|
904
|
+
var React6 = __toESM(require("react"), 1);
|
|
905
|
+
var import_react_aria_components4 = require("react-aria-components");
|
|
906
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
848
907
|
var Tag = React6.forwardRef(function Tag2({ children, onRemove, isDisabled, category, className, ...rest }, ref) {
|
|
849
908
|
const msg = usePireMessages();
|
|
850
|
-
return /* @__PURE__ */ (0,
|
|
909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
851
910
|
"span",
|
|
852
911
|
{
|
|
853
912
|
ref,
|
|
@@ -855,16 +914,16 @@ var Tag = React6.forwardRef(function Tag2({ children, onRemove, isDisabled, cate
|
|
|
855
914
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
856
915
|
...rest,
|
|
857
916
|
children: [
|
|
858
|
-
category ? /* @__PURE__ */ (0,
|
|
917
|
+
category ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pire-tag-swatch", "data-category": category, "aria-hidden": "true" }) : null,
|
|
859
918
|
children,
|
|
860
|
-
onRemove ? /* @__PURE__ */ (0,
|
|
919
|
+
onRemove ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
861
920
|
import_react_aria_components4.Button,
|
|
862
921
|
{
|
|
863
922
|
className: "pire-tag-remove",
|
|
864
923
|
isDisabled,
|
|
865
924
|
onPress: onRemove,
|
|
866
925
|
"aria-label": typeof children === "string" ? msg.tagRemoveNamed.replace("{name}", children) : msg.tagRemove,
|
|
867
|
-
children: /* @__PURE__ */ (0,
|
|
926
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "x", size: 12 })
|
|
868
927
|
}
|
|
869
928
|
) : null
|
|
870
929
|
]
|
|
@@ -873,7 +932,7 @@ var Tag = React6.forwardRef(function Tag2({ children, onRemove, isDisabled, cate
|
|
|
873
932
|
});
|
|
874
933
|
|
|
875
934
|
// src/components/core/Card.tsx
|
|
876
|
-
var
|
|
935
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
877
936
|
function Card({
|
|
878
937
|
title,
|
|
879
938
|
subtitle,
|
|
@@ -885,23 +944,23 @@ function Card({
|
|
|
885
944
|
className,
|
|
886
945
|
...rest
|
|
887
946
|
}) {
|
|
888
|
-
return /* @__PURE__ */ (0,
|
|
947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
889
948
|
"section",
|
|
890
949
|
{
|
|
891
950
|
className: cx("pire-card", className),
|
|
892
951
|
"data-interactive": interactive ? "true" : void 0,
|
|
893
952
|
...rest,
|
|
894
953
|
children: [
|
|
895
|
-
title || actions ? /* @__PURE__ */ (0,
|
|
896
|
-
icon ? /* @__PURE__ */ (0,
|
|
897
|
-
/* @__PURE__ */ (0,
|
|
898
|
-
/* @__PURE__ */ (0,
|
|
899
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
954
|
+
title || actions ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { className: "pire-card-head", children: [
|
|
955
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon, size: 20, style: { color: "var(--text-secondary)" } }) : null,
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "pire-card-title", children: title }),
|
|
958
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "pire-card-sub", style: { margin: 0 }, children: subtitle }) : null
|
|
900
959
|
] }),
|
|
901
|
-
actions ? /* @__PURE__ */ (0,
|
|
960
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "flex", gap: "var(--sp-1)" }, children: actions }) : null
|
|
902
961
|
] }) : null,
|
|
903
|
-
children ? /* @__PURE__ */ (0,
|
|
904
|
-
footer ? /* @__PURE__ */ (0,
|
|
962
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "pire-card-body", children }) : null,
|
|
963
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("footer", { className: "pire-card-foot", children: footer }) : null
|
|
905
964
|
]
|
|
906
965
|
}
|
|
907
966
|
);
|
|
@@ -909,11 +968,11 @@ function Card({
|
|
|
909
968
|
|
|
910
969
|
// src/components/core/Avatar.tsx
|
|
911
970
|
var React7 = __toESM(require("react"), 1);
|
|
912
|
-
var
|
|
971
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
913
972
|
var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
914
973
|
function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
915
974
|
const [failed, setFailed] = React7.useState(false);
|
|
916
|
-
return /* @__PURE__ */ (0,
|
|
975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: cx("pire-avatar", className), "data-size": size, role: "img", "aria-label": name, ...rest, children: src && !failed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
917
976
|
"img",
|
|
918
977
|
{
|
|
919
978
|
src,
|
|
@@ -927,7 +986,7 @@ function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
|
927
986
|
// src/components/core/SegmentedControl.tsx
|
|
928
987
|
var React8 = __toESM(require("react"), 1);
|
|
929
988
|
var import_react_aria_components5 = require("react-aria-components");
|
|
930
|
-
var
|
|
989
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
931
990
|
function SegmentedControl({
|
|
932
991
|
options,
|
|
933
992
|
value,
|
|
@@ -943,7 +1002,7 @@ function SegmentedControl({
|
|
|
943
1002
|
() => new Set(value ? [value] : defaultValue ? [defaultValue] : []),
|
|
944
1003
|
[value, defaultValue]
|
|
945
1004
|
);
|
|
946
|
-
return /* @__PURE__ */ (0,
|
|
1005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
947
1006
|
import_react_aria_components5.ToggleButtonGroup,
|
|
948
1007
|
{
|
|
949
1008
|
className: cx("pire-segmented", className),
|
|
@@ -957,7 +1016,7 @@ function SegmentedControl({
|
|
|
957
1016
|
const first = [...keys][0];
|
|
958
1017
|
if (first != null) onChange?.(String(first));
|
|
959
1018
|
},
|
|
960
|
-
children: options.map((option) => /* @__PURE__ */ (0,
|
|
1019
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
961
1020
|
import_react_aria_components5.ToggleButton,
|
|
962
1021
|
{
|
|
963
1022
|
id: option.id,
|
|
@@ -965,7 +1024,7 @@ function SegmentedControl({
|
|
|
965
1024
|
isDisabled: option.isDisabled,
|
|
966
1025
|
"aria-label": iconOnly ? option.label : void 0,
|
|
967
1026
|
children: [
|
|
968
|
-
option.icon ? /* @__PURE__ */ (0,
|
|
1027
|
+
option.icon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: option.icon, size: 16 }) : null,
|
|
969
1028
|
iconOnly ? null : option.label
|
|
970
1029
|
]
|
|
971
1030
|
},
|
|
@@ -977,7 +1036,7 @@ function SegmentedControl({
|
|
|
977
1036
|
|
|
978
1037
|
// src/components/core/Text.tsx
|
|
979
1038
|
var React9 = __toESM(require("react"), 1);
|
|
980
|
-
var
|
|
1039
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
981
1040
|
var Text = React9.forwardRef(function Text2({
|
|
982
1041
|
size = "body",
|
|
983
1042
|
color = "primary",
|
|
@@ -992,7 +1051,7 @@ var Text = React9.forwardRef(function Text2({
|
|
|
992
1051
|
}, ref) {
|
|
993
1052
|
const lineClamp = typeof truncate === "number" ? truncate : truncate ? 1 : void 0;
|
|
994
1053
|
const clampStyle = lineClamp == null ? style : { ["--pire-text-clamp"]: lineClamp, ...style };
|
|
995
|
-
return /* @__PURE__ */ (0,
|
|
1054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
996
1055
|
Wrapper,
|
|
997
1056
|
{
|
|
998
1057
|
ref,
|
|
@@ -1009,12 +1068,12 @@ var Text = React9.forwardRef(function Text2({
|
|
|
1009
1068
|
);
|
|
1010
1069
|
});
|
|
1011
1070
|
var Strong = React9.forwardRef(function Strong2({ className, ...rest }, ref) {
|
|
1012
|
-
return /* @__PURE__ */ (0,
|
|
1071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ref, elementType: "span", weight: "strong", className, ...rest });
|
|
1013
1072
|
});
|
|
1014
1073
|
|
|
1015
1074
|
// src/components/core/Heading.tsx
|
|
1016
1075
|
var import_react_aria_components6 = require("react-aria-components");
|
|
1017
|
-
var
|
|
1076
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1018
1077
|
function Heading({
|
|
1019
1078
|
level = 2,
|
|
1020
1079
|
size,
|
|
@@ -1026,7 +1085,7 @@ function Heading({
|
|
|
1026
1085
|
}) {
|
|
1027
1086
|
const lineClamp = typeof truncate === "number" ? truncate : truncate ? 1 : void 0;
|
|
1028
1087
|
const clampStyle = lineClamp == null ? style : { ["--pire-text-clamp"]: lineClamp, ...style };
|
|
1029
|
-
return /* @__PURE__ */ (0,
|
|
1088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1030
1089
|
import_react_aria_components6.Heading,
|
|
1031
1090
|
{
|
|
1032
1091
|
level,
|
|
@@ -1042,9 +1101,9 @@ function Heading({
|
|
|
1042
1101
|
|
|
1043
1102
|
// src/components/core/Link.tsx
|
|
1044
1103
|
var import_react_aria_components7 = require("react-aria-components");
|
|
1045
|
-
var
|
|
1104
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1046
1105
|
function Link({ children, size, isExternal, className, rel, ...rest }) {
|
|
1047
|
-
return /* @__PURE__ */ (0,
|
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1048
1107
|
import_react_aria_components7.Link,
|
|
1049
1108
|
{
|
|
1050
1109
|
className: cx("pire-link", className),
|
|
@@ -1054,7 +1113,7 @@ function Link({ children, size, isExternal, className, rel, ...rest }) {
|
|
|
1054
1113
|
...rest,
|
|
1055
1114
|
children: [
|
|
1056
1115
|
children,
|
|
1057
|
-
isExternal ? /* @__PURE__ */ (0,
|
|
1116
|
+
isExternal ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "external-link", size: 12, className: "pire-link-external" }) : null
|
|
1058
1117
|
]
|
|
1059
1118
|
}
|
|
1060
1119
|
);
|
|
@@ -1062,7 +1121,7 @@ function Link({ children, size, isExternal, className, rel, ...rest }) {
|
|
|
1062
1121
|
|
|
1063
1122
|
// src/components/core/Separator.tsx
|
|
1064
1123
|
var import_react_aria_components8 = require("react-aria-components");
|
|
1065
|
-
var
|
|
1124
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1066
1125
|
function Separator({
|
|
1067
1126
|
orientation = "horizontal",
|
|
1068
1127
|
emphasis = "default",
|
|
@@ -1070,7 +1129,7 @@ function Separator({
|
|
|
1070
1129
|
className,
|
|
1071
1130
|
...rest
|
|
1072
1131
|
}) {
|
|
1073
|
-
return /* @__PURE__ */ (0,
|
|
1132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1074
1133
|
import_react_aria_components8.Separator,
|
|
1075
1134
|
{
|
|
1076
1135
|
orientation,
|
|
@@ -1084,14 +1143,14 @@ function Separator({
|
|
|
1084
1143
|
}
|
|
1085
1144
|
|
|
1086
1145
|
// src/components/core/Kbd.tsx
|
|
1087
|
-
var
|
|
1146
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1088
1147
|
function Kbd({ children, size = "md", className, ...rest }) {
|
|
1089
|
-
return /* @__PURE__ */ (0,
|
|
1148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("kbd", { className: cx("pire-kbd", className), "data-size": size, ...rest, children });
|
|
1090
1149
|
}
|
|
1091
1150
|
|
|
1092
1151
|
// src/components/forms/FieldHelp.tsx
|
|
1093
1152
|
var import_react_aria_components9 = require("react-aria-components");
|
|
1094
|
-
var
|
|
1153
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1095
1154
|
function FieldHelp({ children, label, placement = "top" }) {
|
|
1096
1155
|
const msg = usePireMessages();
|
|
1097
1156
|
return (
|
|
@@ -1102,12 +1161,12 @@ function FieldHelp({ children, label, placement = "top" }) {
|
|
|
1102
1161
|
// renders. `value={null}` is React Aria's own idiom for lifting a subtree back out of a
|
|
1103
1162
|
// slotted context — the same one `MultiComboBox` and `FieldLabel` use — and is what makes
|
|
1104
1163
|
// this component safe anywhere.
|
|
1105
|
-
/* @__PURE__ */ (0,
|
|
1164
|
+
/* @__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: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(IconButton, { icon: "help-circle", label: label ?? msg.fieldHelp, size: "sm", hideTooltip: true }) }) })
|
|
1106
1165
|
);
|
|
1107
1166
|
}
|
|
1108
1167
|
|
|
1109
1168
|
// src/components/forms/FormField.tsx
|
|
1110
|
-
var
|
|
1169
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1111
1170
|
function FormField({
|
|
1112
1171
|
label,
|
|
1113
1172
|
htmlFor,
|
|
@@ -1120,20 +1179,27 @@ function FormField({
|
|
|
1120
1179
|
className,
|
|
1121
1180
|
...rest
|
|
1122
1181
|
}) {
|
|
1123
|
-
const
|
|
1182
|
+
const msg = usePireMessages();
|
|
1183
|
+
const labelEl = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "pire-field-label", htmlFor, children: [
|
|
1124
1184
|
label,
|
|
1125
|
-
isRequired ? /* @__PURE__ */ (0,
|
|
1185
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1126
1186
|
] });
|
|
1127
|
-
return /* @__PURE__ */ (0,
|
|
1128
|
-
help ? /* @__PURE__ */ (0,
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cx("pire-field", className), "data-layout": layout, ...rest, children: [
|
|
1188
|
+
help ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "pire-field-labelrow", children: [
|
|
1129
1189
|
labelEl,
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1190
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1191
|
+
FieldHelp,
|
|
1192
|
+
{
|
|
1193
|
+
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
1194
|
+
children: help
|
|
1195
|
+
}
|
|
1196
|
+
)
|
|
1131
1197
|
] }) : labelEl,
|
|
1132
1198
|
children,
|
|
1133
|
-
error ? /* @__PURE__ */ (0,
|
|
1134
|
-
/* @__PURE__ */ (0,
|
|
1199
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "pire-field-error", role: "alert", children: [
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { name: "alert-circle", size: 12 }),
|
|
1135
1201
|
error
|
|
1136
|
-
] }) : hint ? /* @__PURE__ */ (0,
|
|
1202
|
+
] }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "pire-field-hint", children: hint }) : null
|
|
1137
1203
|
] });
|
|
1138
1204
|
}
|
|
1139
1205
|
|
|
@@ -1160,7 +1226,7 @@ function warnOnce2(key, message) {
|
|
|
1160
1226
|
}
|
|
1161
1227
|
|
|
1162
1228
|
// src/components/forms/FieldLabel.tsx
|
|
1163
|
-
var
|
|
1229
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1164
1230
|
function warnHelpWithoutLabel(component, label, help) {
|
|
1165
1231
|
if (!IS_DEV2 || !help || label) return;
|
|
1166
1232
|
warnOnce2(
|
|
@@ -1170,17 +1236,17 @@ function warnHelpWithoutLabel(component, label, help) {
|
|
|
1170
1236
|
}
|
|
1171
1237
|
function FieldLabel({ label, isRequired, help }) {
|
|
1172
1238
|
const msg = usePireMessages();
|
|
1173
|
-
const text = /* @__PURE__ */ (0,
|
|
1239
|
+
const text = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_aria_components10.Label, { className: "pire-field-label", children: [
|
|
1174
1240
|
label,
|
|
1175
|
-
isRequired ? /* @__PURE__ */ (0,
|
|
1241
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1176
1242
|
] });
|
|
1177
1243
|
return (
|
|
1178
1244
|
// React Aria's own idiom for lifting a subtree back out of a slotted context — the same one
|
|
1179
1245
|
// `MultiComboBox` uses on its chips, and the one Popover uses on the way into an overlay.
|
|
1180
1246
|
// Without it every Button below a field inherits that field's trigger props.
|
|
1181
|
-
/* @__PURE__ */ (0,
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_aria_components10.ButtonContext.Provider, { value: null, children: help ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pire-field-labelrow", children: [
|
|
1182
1248
|
text,
|
|
1183
|
-
/* @__PURE__ */ (0,
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1184
1250
|
FieldHelp,
|
|
1185
1251
|
{
|
|
1186
1252
|
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
@@ -1193,7 +1259,7 @@ function FieldLabel({ label, isRequired, help }) {
|
|
|
1193
1259
|
|
|
1194
1260
|
// src/components/forms/FieldDescription.tsx
|
|
1195
1261
|
var import_react_aria_components11 = require("react-aria-components");
|
|
1196
|
-
var
|
|
1262
|
+
var import_jsx_runtime20 = (
|
|
1197
1263
|
// The class is picked, never combined: `.pire-sr-only` is `!important` and pairing it with
|
|
1198
1264
|
// another pire-* class is what grew the document sideways in 0.23.0. Choosing `pire-sr-only`
|
|
1199
1265
|
// when there is no visible description also keeps the node out of `.pire-field`'s flex gap —
|
|
@@ -1202,14 +1268,14 @@ var import_jsx_runtime19 = (
|
|
|
1202
1268
|
);
|
|
1203
1269
|
function FieldDescription({ description, help }) {
|
|
1204
1270
|
if (!description && !help) return null;
|
|
1205
|
-
return /* @__PURE__ */ (0,
|
|
1271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_aria_components11.Text, { slot: "description", className: description ? "pire-field-hint" : "pire-sr-only", children: [
|
|
1206
1272
|
description,
|
|
1207
|
-
help ? /* @__PURE__ */ (0,
|
|
1273
|
+
help ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "pire-sr-only", children: help }) : null
|
|
1208
1274
|
] });
|
|
1209
1275
|
}
|
|
1210
1276
|
|
|
1211
1277
|
// src/components/forms/Input.tsx
|
|
1212
|
-
var
|
|
1278
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1213
1279
|
function Input({
|
|
1214
1280
|
label,
|
|
1215
1281
|
icon,
|
|
@@ -1240,7 +1306,7 @@ function Input({
|
|
|
1240
1306
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : {};
|
|
1241
1307
|
const showsClear = isClearable && currentValue !== "" && !rest.isDisabled && !rest.isReadOnly;
|
|
1242
1308
|
warnHelpWithoutLabel("Input", label, help);
|
|
1243
|
-
return /* @__PURE__ */ (0,
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1244
1310
|
import_react_aria_components12.TextField,
|
|
1245
1311
|
{
|
|
1246
1312
|
className: cx("pire-field", className),
|
|
@@ -1250,8 +1316,8 @@ function Input({
|
|
|
1250
1316
|
...rest,
|
|
1251
1317
|
...valueProps,
|
|
1252
1318
|
children: [
|
|
1253
|
-
label ? /* @__PURE__ */ (0,
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
1319
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1255
1321
|
import_react_aria_components12.Group,
|
|
1256
1322
|
{
|
|
1257
1323
|
className: "pire-control",
|
|
@@ -1260,9 +1326,9 @@ function Input({
|
|
|
1260
1326
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1261
1327
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1262
1328
|
children: [
|
|
1263
|
-
icon ? /* @__PURE__ */ (0,
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1265
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
1329
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: icon, size: 16, className: "pire-leading-icon" }) : null,
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_aria_components12.Input, { ref: inputRef, className: "pire-input", "data-numeric": numeric ? "true" : void 0 }),
|
|
1331
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1266
1332
|
import_react_aria_components12.Button,
|
|
1267
1333
|
{
|
|
1268
1334
|
className: "pire-input-clear",
|
|
@@ -1273,12 +1339,12 @@ function Input({
|
|
|
1273
1339
|
children: clearLabel ?? msg.inputClear
|
|
1274
1340
|
}
|
|
1275
1341
|
) : null,
|
|
1276
|
-
suffix ? /* @__PURE__ */ (0,
|
|
1342
|
+
suffix ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "pire-affix", children: suffix }) : null
|
|
1277
1343
|
]
|
|
1278
1344
|
}
|
|
1279
1345
|
),
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
/* @__PURE__ */ (0,
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldDescription, { description, help }),
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_aria_components12.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1282
1348
|
]
|
|
1283
1349
|
}
|
|
1284
1350
|
);
|
|
@@ -1287,7 +1353,7 @@ function Input({
|
|
|
1287
1353
|
// src/components/forms/TextArea.tsx
|
|
1288
1354
|
var React11 = __toESM(require("react"), 1);
|
|
1289
1355
|
var import_react_aria_components13 = require("react-aria-components");
|
|
1290
|
-
var
|
|
1356
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1291
1357
|
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React11.useEffect : React11.useLayoutEffect;
|
|
1292
1358
|
function TextArea({
|
|
1293
1359
|
label,
|
|
@@ -1333,7 +1399,7 @@ function TextArea({
|
|
|
1333
1399
|
grow();
|
|
1334
1400
|
}, [autoGrow, grow, rest.value]);
|
|
1335
1401
|
warnHelpWithoutLabel("TextArea", label, help);
|
|
1336
|
-
return /* @__PURE__ */ (0,
|
|
1402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1337
1403
|
import_react_aria_components13.TextField,
|
|
1338
1404
|
{
|
|
1339
1405
|
className: cx("pire-field", className),
|
|
@@ -1342,8 +1408,8 @@ function TextArea({
|
|
|
1342
1408
|
validationBehavior: "aria",
|
|
1343
1409
|
...rest,
|
|
1344
1410
|
children: [
|
|
1345
|
-
label ? /* @__PURE__ */ (0,
|
|
1346
|
-
/* @__PURE__ */ (0,
|
|
1411
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1412
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1347
1413
|
import_react_aria_components13.Group,
|
|
1348
1414
|
{
|
|
1349
1415
|
className: "pire-control",
|
|
@@ -1352,7 +1418,7 @@ function TextArea({
|
|
|
1352
1418
|
"data-multiline": "true",
|
|
1353
1419
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1354
1420
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1355
|
-
children: /* @__PURE__ */ (0,
|
|
1421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1356
1422
|
import_react_aria_components13.TextArea,
|
|
1357
1423
|
{
|
|
1358
1424
|
ref,
|
|
@@ -1364,8 +1430,8 @@ function TextArea({
|
|
|
1364
1430
|
)
|
|
1365
1431
|
}
|
|
1366
1432
|
),
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1368
|
-
/* @__PURE__ */ (0,
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldDescription, { description, help }),
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_aria_components13.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1369
1435
|
]
|
|
1370
1436
|
}
|
|
1371
1437
|
);
|
|
@@ -1374,7 +1440,7 @@ function TextArea({
|
|
|
1374
1440
|
// src/components/forms/Select.tsx
|
|
1375
1441
|
var React12 = __toESM(require("react"), 1);
|
|
1376
1442
|
var import_react_aria_components14 = require("react-aria-components");
|
|
1377
|
-
var
|
|
1443
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1378
1444
|
var CLEAR_KEY = "__pire-select-clear__";
|
|
1379
1445
|
var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
|
|
1380
1446
|
function Select({
|
|
@@ -1417,7 +1483,7 @@ function Select({
|
|
|
1417
1483
|
...items
|
|
1418
1484
|
] : items;
|
|
1419
1485
|
warnHelpWithoutLabel("Select", label, help);
|
|
1420
|
-
return /* @__PURE__ */ (0,
|
|
1486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1421
1487
|
import_react_aria_components14.Select,
|
|
1422
1488
|
{
|
|
1423
1489
|
className: cx("pire-field", className),
|
|
@@ -1435,8 +1501,8 @@ function Select({
|
|
|
1435
1501
|
validationBehavior: "aria",
|
|
1436
1502
|
...rest,
|
|
1437
1503
|
children: [
|
|
1438
|
-
label ? /* @__PURE__ */ (0,
|
|
1439
|
-
/* @__PURE__ */ (0,
|
|
1504
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1440
1506
|
import_react_aria_components14.Button,
|
|
1441
1507
|
{
|
|
1442
1508
|
className: "pire-control",
|
|
@@ -1444,20 +1510,20 @@ function Select({
|
|
|
1444
1510
|
"data-full-width": String(fullWidth),
|
|
1445
1511
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1446
1512
|
children: [
|
|
1447
|
-
/* @__PURE__ */ (0,
|
|
1448
|
-
/* @__PURE__ */ (0,
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_aria_components14.SelectValue, { className: "pire-select-value" }),
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "chevron-down", size: 16, className: "pire-leading-icon" })
|
|
1449
1515
|
]
|
|
1450
1516
|
}
|
|
1451
1517
|
),
|
|
1452
|
-
/* @__PURE__ */ (0,
|
|
1453
|
-
/* @__PURE__ */ (0,
|
|
1454
|
-
/* @__PURE__ */ (0,
|
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldDescription, { description, help }),
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_aria_components14.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_aria_components14.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1455
1521
|
import_react_aria_components14.ListBox,
|
|
1456
1522
|
{
|
|
1457
1523
|
className: "pire-listbox",
|
|
1458
1524
|
items: rows,
|
|
1459
|
-
renderEmptyState: () => /* @__PURE__ */ (0,
|
|
1460
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
1525
|
+
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: emptyLabel ?? msg.selectEmpty }),
|
|
1526
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1461
1527
|
import_react_aria_components14.ListBoxItem,
|
|
1462
1528
|
{
|
|
1463
1529
|
className: "pire-option",
|
|
@@ -1477,20 +1543,20 @@ function Select({
|
|
|
1477
1543
|
|
|
1478
1544
|
// src/components/forms/Checkbox.tsx
|
|
1479
1545
|
var import_react_aria_components15 = require("react-aria-components");
|
|
1480
|
-
var
|
|
1546
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1481
1547
|
function Checkbox({ label, hint, children, className, ...rest }) {
|
|
1482
|
-
return /* @__PURE__ */ (0,
|
|
1483
|
-
/* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_aria_components15.Checkbox, { className: cx("pire-choice", className), ...rest, children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pire-choice-box", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: "minus", size: 12 }) : isSelected ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: "check", size: 12 }) : null }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
|
|
1485
1551
|
label ?? children,
|
|
1486
|
-
hint ? /* @__PURE__ */ (0,
|
|
1552
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1487
1553
|
] })
|
|
1488
1554
|
] }) });
|
|
1489
1555
|
}
|
|
1490
1556
|
|
|
1491
1557
|
// src/components/forms/Radio.tsx
|
|
1492
1558
|
var import_react_aria_components16 = require("react-aria-components");
|
|
1493
|
-
var
|
|
1559
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1494
1560
|
function RadioGroup({
|
|
1495
1561
|
label,
|
|
1496
1562
|
description,
|
|
@@ -1499,36 +1565,36 @@ function RadioGroup({
|
|
|
1499
1565
|
className,
|
|
1500
1566
|
...rest
|
|
1501
1567
|
}) {
|
|
1502
|
-
return /* @__PURE__ */ (0,
|
|
1503
|
-
label ? /* @__PURE__ */ (0,
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1505
|
-
description ? /* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_aria_components16.RadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
|
|
1569
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_aria_components16.Label, { className: "pire-field-label", children: label }) : null,
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pire-radiogroup", children }),
|
|
1571
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_aria_components16.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_aria_components16.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1507
1573
|
] });
|
|
1508
1574
|
}
|
|
1509
1575
|
function Radio({ label, hint, children, className, ...rest }) {
|
|
1510
|
-
return /* @__PURE__ */ (0,
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1512
|
-
/* @__PURE__ */ (0,
|
|
1576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_aria_components16.Radio, { className: cx("pire-choice", className), ...rest, children: [
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "pire-choice-box", "data-radio": "true", "aria-hidden": "true" }),
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { children: [
|
|
1513
1579
|
label ?? children,
|
|
1514
|
-
hint ? /* @__PURE__ */ (0,
|
|
1580
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1515
1581
|
] })
|
|
1516
1582
|
] });
|
|
1517
1583
|
}
|
|
1518
1584
|
|
|
1519
1585
|
// src/components/forms/Switch.tsx
|
|
1520
1586
|
var import_react_aria_components17 = require("react-aria-components");
|
|
1521
|
-
var
|
|
1587
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1522
1588
|
function Switch({ label, children, className, ...rest }) {
|
|
1523
|
-
return /* @__PURE__ */ (0,
|
|
1524
|
-
/* @__PURE__ */ (0,
|
|
1525
|
-
/* @__PURE__ */ (0,
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react_aria_components17.Switch, { className: cx("pire-choice", className), ...rest, children: [
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pire-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pire-switch-thumb" }) }),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: label ?? children })
|
|
1526
1592
|
] });
|
|
1527
1593
|
}
|
|
1528
1594
|
|
|
1529
1595
|
// src/components/forms/ChoiceCardGroup.tsx
|
|
1530
1596
|
var import_react_aria_components18 = require("react-aria-components");
|
|
1531
|
-
var
|
|
1597
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1532
1598
|
function ChoiceCardGroup({
|
|
1533
1599
|
label,
|
|
1534
1600
|
description,
|
|
@@ -1546,7 +1612,7 @@ function ChoiceCardGroup({
|
|
|
1546
1612
|
...rest
|
|
1547
1613
|
}) {
|
|
1548
1614
|
warnHelpWithoutLabel("ChoiceCardGroup", label, help);
|
|
1549
|
-
return /* @__PURE__ */ (0,
|
|
1615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1550
1616
|
import_react_aria_components18.RadioGroup,
|
|
1551
1617
|
{
|
|
1552
1618
|
className: cx("pire-field", className),
|
|
@@ -1559,24 +1625,24 @@ function ChoiceCardGroup({
|
|
|
1559
1625
|
isDisabled,
|
|
1560
1626
|
isRequired,
|
|
1561
1627
|
children: [
|
|
1562
|
-
label ? /* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldLabel, { label, isRequired, help }) : null,
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "pire-choicecards", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1564
1630
|
import_react_aria_components18.Radio,
|
|
1565
1631
|
{
|
|
1566
1632
|
value: option.id,
|
|
1567
1633
|
className: "pire-choicecard",
|
|
1568
1634
|
isDisabled: option.isDisabled,
|
|
1569
1635
|
children: [
|
|
1570
|
-
option.icon ? /* @__PURE__ */ (0,
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
option.description ? /* @__PURE__ */ (0,
|
|
1573
|
-
option.preview ? /* @__PURE__ */ (0,
|
|
1636
|
+
option.icon ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { name: option.icon, size: 20 }) : null,
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pire-choicecard-label", children: option.label }),
|
|
1638
|
+
option.description ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pire-choicecard-desc", children: option.description }) : null,
|
|
1639
|
+
option.preview ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pire-choicecard-preview", "aria-hidden": "true", children: option.preview }) : null
|
|
1574
1640
|
]
|
|
1575
1641
|
},
|
|
1576
1642
|
option.id
|
|
1577
1643
|
)) }),
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldDescription, { description, help }),
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_aria_components18.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1580
1646
|
]
|
|
1581
1647
|
}
|
|
1582
1648
|
);
|
|
@@ -1585,7 +1651,7 @@ function ChoiceCardGroup({
|
|
|
1585
1651
|
// src/components/forms/ComboBox.tsx
|
|
1586
1652
|
var React13 = __toESM(require("react"), 1);
|
|
1587
1653
|
var import_react_aria_components19 = require("react-aria-components");
|
|
1588
|
-
var
|
|
1654
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1589
1655
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1590
1656
|
function ComboBox({
|
|
1591
1657
|
label,
|
|
@@ -1633,7 +1699,7 @@ function ComboBox({
|
|
|
1633
1699
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1634
1700
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1635
1701
|
warnHelpWithoutLabel("ComboBox", label, help);
|
|
1636
|
-
return /* @__PURE__ */ (0,
|
|
1702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1637
1703
|
import_react_aria_components19.ComboBox,
|
|
1638
1704
|
{
|
|
1639
1705
|
className: cx("pire-field", className),
|
|
@@ -1654,8 +1720,8 @@ function ComboBox({
|
|
|
1654
1720
|
validationBehavior: "aria",
|
|
1655
1721
|
...rest,
|
|
1656
1722
|
children: [
|
|
1657
|
-
label ? /* @__PURE__ */ (0,
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1659
1725
|
import_react_aria_components19.Group,
|
|
1660
1726
|
{
|
|
1661
1727
|
className: "pire-control",
|
|
@@ -1663,9 +1729,9 @@ function ComboBox({
|
|
|
1663
1729
|
"data-full-width": String(fullWidth),
|
|
1664
1730
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1665
1731
|
children: [
|
|
1666
|
-
/* @__PURE__ */ (0,
|
|
1667
|
-
/* @__PURE__ */ (0,
|
|
1668
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components19.Input, { className: "pire-input", placeholder: rest.placeholder }),
|
|
1734
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1669
1735
|
import_react_aria_components19.Button,
|
|
1670
1736
|
{
|
|
1671
1737
|
className: "pire-input-clear",
|
|
@@ -1677,22 +1743,22 @@ function ComboBox({
|
|
|
1677
1743
|
children: clearLabel ?? msg.inputClear
|
|
1678
1744
|
}
|
|
1679
1745
|
) : null,
|
|
1680
|
-
/* @__PURE__ */ (0,
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1681
1747
|
import_react_aria_components19.Button,
|
|
1682
1748
|
{
|
|
1683
1749
|
className: "pire-iconbtn",
|
|
1684
1750
|
"data-size": "sm",
|
|
1685
1751
|
"aria-label": msg.comboBoxShowSuggestions,
|
|
1686
1752
|
style: { width: 20, height: 20 },
|
|
1687
|
-
children: /* @__PURE__ */ (0,
|
|
1753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "chevron-down", size: 16 })
|
|
1688
1754
|
}
|
|
1689
1755
|
)
|
|
1690
1756
|
]
|
|
1691
1757
|
}
|
|
1692
1758
|
),
|
|
1693
|
-
/* @__PURE__ */ (0,
|
|
1694
|
-
/* @__PURE__ */ (0,
|
|
1695
|
-
/* @__PURE__ */ (0,
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldDescription, { description, help }),
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components19.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components19.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1696
1762
|
import_react_aria_components19.ListBox,
|
|
1697
1763
|
{
|
|
1698
1764
|
className: "pire-listbox",
|
|
@@ -1700,8 +1766,8 @@ function ComboBox({
|
|
|
1700
1766
|
const el = e.currentTarget;
|
|
1701
1767
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1702
1768
|
} : void 0,
|
|
1703
|
-
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0,
|
|
1704
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
1769
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1770
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1705
1771
|
import_react_aria_components19.ListBoxItem,
|
|
1706
1772
|
{
|
|
1707
1773
|
className: "pire-option",
|
|
@@ -1709,8 +1775,8 @@ function ComboBox({
|
|
|
1709
1775
|
textValue: item.label,
|
|
1710
1776
|
isDisabled: item.isDisabled,
|
|
1711
1777
|
children: [
|
|
1712
|
-
/* @__PURE__ */ (0,
|
|
1713
|
-
item.secondary ? /* @__PURE__ */ (0,
|
|
1778
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pire-option-label", children: item.label }),
|
|
1779
|
+
item.secondary ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1714
1780
|
]
|
|
1715
1781
|
}
|
|
1716
1782
|
)
|
|
@@ -1724,7 +1790,7 @@ function ComboBox({
|
|
|
1724
1790
|
// src/components/forms/MultiComboBox.tsx
|
|
1725
1791
|
var React14 = __toESM(require("react"), 1);
|
|
1726
1792
|
var import_react_aria_components20 = require("react-aria-components");
|
|
1727
|
-
var
|
|
1793
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1728
1794
|
var norm3 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1729
1795
|
function MultiComboBox({
|
|
1730
1796
|
label,
|
|
@@ -1791,7 +1857,7 @@ function MultiComboBox({
|
|
|
1791
1857
|
if (!values.includes(next)) commit([...values, next]);
|
|
1792
1858
|
};
|
|
1793
1859
|
warnHelpWithoutLabel("MultiComboBox", label, help);
|
|
1794
|
-
return /* @__PURE__ */ (0,
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1795
1861
|
import_react_aria_components20.ComboBox,
|
|
1796
1862
|
{
|
|
1797
1863
|
className: cx("pire-field", className),
|
|
@@ -1808,8 +1874,8 @@ function MultiComboBox({
|
|
|
1808
1874
|
validationBehavior: "aria",
|
|
1809
1875
|
...rest,
|
|
1810
1876
|
children: [
|
|
1811
|
-
label ? /* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1877
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1813
1879
|
import_react_aria_components20.Group,
|
|
1814
1880
|
{
|
|
1815
1881
|
className: "pire-control",
|
|
@@ -1819,14 +1885,14 @@ function MultiComboBox({
|
|
|
1819
1885
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1820
1886
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1821
1887
|
children: [
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "pire-chipfield", children: [
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components20.ButtonContext.Provider, { value: null, children: values.map((v) => (
|
|
1825
1891
|
/* Disabled follows the field, not `isEditable`: a read-only field's chips are
|
|
1826
1892
|
real, current values and should read as such — they simply lose the × . */
|
|
1827
|
-
/* @__PURE__ */ (0,
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Tag, { isDisabled: rest.isDisabled, onRemove: isEditable ? () => remove(v) : void 0, children: labelOf(v) }, v)
|
|
1828
1894
|
)) }),
|
|
1829
|
-
/* @__PURE__ */ (0,
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1830
1896
|
import_react_aria_components20.Input,
|
|
1831
1897
|
{
|
|
1832
1898
|
ref: inputRef,
|
|
@@ -1836,23 +1902,23 @@ function MultiComboBox({
|
|
|
1836
1902
|
}
|
|
1837
1903
|
)
|
|
1838
1904
|
] }),
|
|
1839
|
-
/* @__PURE__ */ (0,
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1840
1906
|
import_react_aria_components20.Button,
|
|
1841
1907
|
{
|
|
1842
1908
|
className: "pire-iconbtn",
|
|
1843
1909
|
"data-size": "sm",
|
|
1844
1910
|
"aria-label": msg.comboBoxShowSuggestions,
|
|
1845
1911
|
style: { width: 20, height: 20 },
|
|
1846
|
-
children: /* @__PURE__ */ (0,
|
|
1912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "chevron-down", size: 16 })
|
|
1847
1913
|
}
|
|
1848
1914
|
)
|
|
1849
1915
|
]
|
|
1850
1916
|
}
|
|
1851
1917
|
),
|
|
1852
|
-
/* @__PURE__ */ (0,
|
|
1853
|
-
/* @__PURE__ */ (0,
|
|
1854
|
-
/* @__PURE__ */ (0,
|
|
1855
|
-
/* @__PURE__ */ (0,
|
|
1918
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components20.VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { "aria-live": "polite", children: announcement }) }),
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldDescription, { description, help }),
|
|
1920
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components20.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components20.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1856
1922
|
import_react_aria_components20.ListBox,
|
|
1857
1923
|
{
|
|
1858
1924
|
className: "pire-listbox",
|
|
@@ -1860,8 +1926,8 @@ function MultiComboBox({
|
|
|
1860
1926
|
const el = e.currentTarget;
|
|
1861
1927
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1862
1928
|
} : void 0,
|
|
1863
|
-
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0,
|
|
1864
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
1929
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1930
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1865
1931
|
import_react_aria_components20.ListBoxItem,
|
|
1866
1932
|
{
|
|
1867
1933
|
className: "pire-option",
|
|
@@ -1869,8 +1935,8 @@ function MultiComboBox({
|
|
|
1869
1935
|
textValue: item.label,
|
|
1870
1936
|
isDisabled: item.isDisabled,
|
|
1871
1937
|
children: [
|
|
1872
|
-
/* @__PURE__ */ (0,
|
|
1873
|
-
item.secondary ? /* @__PURE__ */ (0,
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "pire-option-label", children: item.label }),
|
|
1939
|
+
item.secondary ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1874
1940
|
]
|
|
1875
1941
|
}
|
|
1876
1942
|
)
|
|
@@ -1891,7 +1957,7 @@ function decimalSeparatorFor(locale) {
|
|
|
1891
1957
|
}
|
|
1892
1958
|
|
|
1893
1959
|
// src/components/forms/NumberField.tsx
|
|
1894
|
-
var
|
|
1960
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1895
1961
|
function typeIntoInput(el, text) {
|
|
1896
1962
|
const start = el.selectionStart ?? el.value.length;
|
|
1897
1963
|
const end = el.selectionEnd ?? start;
|
|
@@ -1926,7 +1992,7 @@ function ClearButton({ label, onClear }) {
|
|
|
1926
1992
|
if (!state?.inputValue) {
|
|
1927
1993
|
return null;
|
|
1928
1994
|
}
|
|
1929
|
-
return /* @__PURE__ */ (0,
|
|
1995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1930
1996
|
import_react_aria_components21.Button,
|
|
1931
1997
|
{
|
|
1932
1998
|
className: "pire-input-clear",
|
|
@@ -2015,7 +2081,7 @@ function NumberField({
|
|
|
2015
2081
|
typeIntoInput(event.currentTarget, localised);
|
|
2016
2082
|
};
|
|
2017
2083
|
warnHelpWithoutLabel("NumberField", label, help);
|
|
2018
|
-
return /* @__PURE__ */ (0,
|
|
2084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2019
2085
|
import_react_aria_components21.NumberField,
|
|
2020
2086
|
{
|
|
2021
2087
|
className: cx("pire-field", className),
|
|
@@ -2025,8 +2091,8 @@ function NumberField({
|
|
|
2025
2091
|
...rest,
|
|
2026
2092
|
...valueProps,
|
|
2027
2093
|
children: [
|
|
2028
|
-
label ? /* @__PURE__ */ (0,
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2094
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2095
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2030
2096
|
import_react_aria_components21.Group,
|
|
2031
2097
|
{
|
|
2032
2098
|
className: "pire-control",
|
|
@@ -2036,16 +2102,16 @@ function NumberField({
|
|
|
2036
2102
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2037
2103
|
"data-stepper": stepperLayout,
|
|
2038
2104
|
children: [
|
|
2039
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0,
|
|
2105
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2040
2106
|
import_react_aria_components21.Button,
|
|
2041
2107
|
{
|
|
2042
2108
|
slot: "decrement",
|
|
2043
2109
|
className: "pire-qty-btn",
|
|
2044
2110
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
2045
|
-
children: /* @__PURE__ */ (0,
|
|
2111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "minus", size: 16 })
|
|
2046
2112
|
}
|
|
2047
2113
|
) : null,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2114
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2049
2115
|
import_react_aria_components21.Input,
|
|
2050
2116
|
{
|
|
2051
2117
|
className: "pire-input",
|
|
@@ -2054,52 +2120,52 @@ function NumberField({
|
|
|
2054
2120
|
onPasteCapture: handlePaste
|
|
2055
2121
|
}
|
|
2056
2122
|
),
|
|
2057
|
-
suffix ? /* @__PURE__ */ (0,
|
|
2058
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
2059
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0,
|
|
2123
|
+
suffix ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pire-affix", children: suffix }) : null,
|
|
2124
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ClearButton, { label: clearLabel ?? msg.inputClear, onClear: () => handleChange(NaN) }) : null,
|
|
2125
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2060
2126
|
import_react_aria_components21.Button,
|
|
2061
2127
|
{
|
|
2062
2128
|
slot: "increment",
|
|
2063
2129
|
className: "pire-qty-btn",
|
|
2064
2130
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
2065
|
-
children: /* @__PURE__ */ (0,
|
|
2131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "plus", size: 16 })
|
|
2066
2132
|
}
|
|
2067
2133
|
) : null,
|
|
2068
|
-
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */ (0,
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
2134
|
+
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "pire-stepper", children: [
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2070
2136
|
import_react_aria_components21.Button,
|
|
2071
2137
|
{
|
|
2072
2138
|
slot: "increment",
|
|
2073
2139
|
className: "pire-stepper-btn",
|
|
2074
2140
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
2075
|
-
children: /* @__PURE__ */ (0,
|
|
2141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "plus", size: 10 })
|
|
2076
2142
|
}
|
|
2077
2143
|
),
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2079
2145
|
import_react_aria_components21.Button,
|
|
2080
2146
|
{
|
|
2081
2147
|
slot: "decrement",
|
|
2082
2148
|
className: "pire-stepper-btn",
|
|
2083
2149
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
2084
|
-
children: /* @__PURE__ */ (0,
|
|
2150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon, { name: "minus", size: 10 })
|
|
2085
2151
|
}
|
|
2086
2152
|
)
|
|
2087
2153
|
] })
|
|
2088
2154
|
]
|
|
2089
2155
|
}
|
|
2090
2156
|
),
|
|
2091
|
-
/* @__PURE__ */ (0,
|
|
2092
|
-
/* @__PURE__ */ (0,
|
|
2157
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FieldDescription, { description, help }),
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components21.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
2093
2159
|
]
|
|
2094
2160
|
}
|
|
2095
2161
|
);
|
|
2096
2162
|
}
|
|
2097
2163
|
|
|
2098
2164
|
// src/components/forms/QuantityStepper.tsx
|
|
2099
|
-
var
|
|
2165
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2100
2166
|
function QuantityStepper({ size = "md", ...rest }) {
|
|
2101
2167
|
const msg = usePireMessages();
|
|
2102
|
-
return /* @__PURE__ */ (0,
|
|
2168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2103
2169
|
NumberField,
|
|
2104
2170
|
{
|
|
2105
2171
|
...rest,
|
|
@@ -2144,13 +2210,13 @@ function coerceBound(value) {
|
|
|
2144
2210
|
}
|
|
2145
2211
|
|
|
2146
2212
|
// src/components/forms/DatePicker.tsx
|
|
2147
|
-
var
|
|
2213
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2148
2214
|
function ClearButton2({ label }) {
|
|
2149
2215
|
const state = React16.useContext(import_react_aria_components22.DatePickerStateContext);
|
|
2150
2216
|
if (!state?.value) {
|
|
2151
2217
|
return null;
|
|
2152
2218
|
}
|
|
2153
|
-
return /* @__PURE__ */ (0,
|
|
2219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2154
2220
|
import_react_aria_components22.Button,
|
|
2155
2221
|
{
|
|
2156
2222
|
className: "pire-input-clear",
|
|
@@ -2188,7 +2254,7 @@ function DatePicker({
|
|
|
2188
2254
|
valueFormat === "iso" && next ? next.toString() : next
|
|
2189
2255
|
);
|
|
2190
2256
|
warnHelpWithoutLabel("DatePicker", label, help);
|
|
2191
|
-
return /* @__PURE__ */ (0,
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2192
2258
|
import_react_aria_components22.DatePicker,
|
|
2193
2259
|
{
|
|
2194
2260
|
className: cx("pire-field", className),
|
|
@@ -2201,8 +2267,8 @@ function DatePicker({
|
|
|
2201
2267
|
onChange: handleChange,
|
|
2202
2268
|
...rest,
|
|
2203
2269
|
children: [
|
|
2204
|
-
label ? /* @__PURE__ */ (0,
|
|
2205
|
-
/* @__PURE__ */ (0,
|
|
2270
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2206
2272
|
import_react_aria_components22.Group,
|
|
2207
2273
|
{
|
|
2208
2274
|
className: "pire-control",
|
|
@@ -2211,50 +2277,50 @@ function DatePicker({
|
|
|
2211
2277
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
2212
2278
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2213
2279
|
children: [
|
|
2214
|
-
/* @__PURE__ */ (0,
|
|
2215
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.DateInput, { className: "pire-datefield", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2281
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ClearButton2, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2282
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2217
2283
|
import_react_aria_components22.Button,
|
|
2218
2284
|
{
|
|
2219
2285
|
className: "pire-iconbtn",
|
|
2220
2286
|
"data-size": "sm",
|
|
2221
2287
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2222
2288
|
style: { width: 24, height: 24 },
|
|
2223
|
-
children: /* @__PURE__ */ (0,
|
|
2289
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "calendar", size: 16 })
|
|
2224
2290
|
}
|
|
2225
2291
|
)
|
|
2226
2292
|
]
|
|
2227
2293
|
}
|
|
2228
2294
|
),
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2230
|
-
/* @__PURE__ */ (0,
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
2232
|
-
/* @__PURE__ */ (0,
|
|
2233
|
-
/* @__PURE__ */ (0,
|
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldDescription, { description, help }),
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.Dialog, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_aria_components22.Calendar, { className: "pire-calendar", children: [
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("header", { className: "pire-calendar-head", children: [
|
|
2299
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2234
2300
|
import_react_aria_components22.Button,
|
|
2235
2301
|
{
|
|
2236
2302
|
slot: "previous",
|
|
2237
2303
|
className: "pire-iconbtn",
|
|
2238
2304
|
"data-size": "sm",
|
|
2239
2305
|
"aria-label": msg.datePickerPreviousMonth,
|
|
2240
|
-
children: /* @__PURE__ */ (0,
|
|
2306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "chevron-left", size: 16 })
|
|
2241
2307
|
}
|
|
2242
2308
|
),
|
|
2243
|
-
/* @__PURE__ */ (0,
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2309
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.Heading, { className: "pire-calendar-title" }),
|
|
2310
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2245
2311
|
import_react_aria_components22.Button,
|
|
2246
2312
|
{
|
|
2247
2313
|
slot: "next",
|
|
2248
2314
|
className: "pire-iconbtn",
|
|
2249
2315
|
"data-size": "sm",
|
|
2250
2316
|
"aria-label": msg.datePickerNextMonth,
|
|
2251
|
-
children: /* @__PURE__ */ (0,
|
|
2317
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "chevron-right", size: 16 })
|
|
2252
2318
|
}
|
|
2253
2319
|
)
|
|
2254
2320
|
] }),
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2256
|
-
/* @__PURE__ */ (0,
|
|
2257
|
-
/* @__PURE__ */ (0,
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_aria_components22.CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.CalendarHeaderCell, { children: day }) }),
|
|
2323
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components22.CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2258
2324
|
] })
|
|
2259
2325
|
] }) }) })
|
|
2260
2326
|
]
|
|
@@ -2265,7 +2331,7 @@ function DatePicker({
|
|
|
2265
2331
|
// src/components/forms/DateRangePicker.tsx
|
|
2266
2332
|
var React17 = __toESM(require("react"), 1);
|
|
2267
2333
|
var import_react_aria_components23 = require("react-aria-components");
|
|
2268
|
-
var
|
|
2334
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2269
2335
|
function coerceRange(range) {
|
|
2270
2336
|
if (range === void 0) {
|
|
2271
2337
|
return void 0;
|
|
@@ -2290,7 +2356,7 @@ function ClearButton3({ label }) {
|
|
|
2290
2356
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2291
2357
|
return null;
|
|
2292
2358
|
}
|
|
2293
|
-
return /* @__PURE__ */ (0,
|
|
2359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2294
2360
|
import_react_aria_components23.Button,
|
|
2295
2361
|
{
|
|
2296
2362
|
className: "pire-input-clear",
|
|
@@ -2343,7 +2409,7 @@ function DateRangePicker({
|
|
|
2343
2409
|
);
|
|
2344
2410
|
};
|
|
2345
2411
|
warnHelpWithoutLabel("DateRangePicker", label, help);
|
|
2346
|
-
return /* @__PURE__ */ (0,
|
|
2412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
2347
2413
|
import_react_aria_components23.DateRangePicker,
|
|
2348
2414
|
{
|
|
2349
2415
|
className: cx("pire-field", className),
|
|
@@ -2359,8 +2425,8 @@ function DateRangePicker({
|
|
|
2359
2425
|
...rest,
|
|
2360
2426
|
isInvalid: rest.isInvalid || tooLong || void 0,
|
|
2361
2427
|
children: [
|
|
2362
|
-
label ? /* @__PURE__ */ (0,
|
|
2363
|
-
/* @__PURE__ */ (0,
|
|
2428
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2429
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
2364
2430
|
import_react_aria_components23.Group,
|
|
2365
2431
|
{
|
|
2366
2432
|
className: "pire-control pire-daterange-control",
|
|
@@ -2369,30 +2435,30 @@ function DateRangePicker({
|
|
|
2369
2435
|
"data-invalid": rest.isInvalid || tooLong ? "true" : void 0,
|
|
2370
2436
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2371
2437
|
children: [
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2373
|
-
/* @__PURE__ */ (0,
|
|
2374
|
-
/* @__PURE__ */ (0,
|
|
2375
|
-
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */ (0,
|
|
2376
|
-
/* @__PURE__ */ (0,
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.DateInput, { slot: "start", className: "pire-datefield", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { "aria-hidden": "true", className: "pire-daterange-dash", children: "\u2013" }),
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.DateInput, { slot: "end", className: "pire-datefield", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2441
|
+
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ClearButton3, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2377
2443
|
import_react_aria_components23.Button,
|
|
2378
2444
|
{
|
|
2379
2445
|
className: "pire-iconbtn",
|
|
2380
2446
|
"data-size": "sm",
|
|
2381
2447
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2382
2448
|
style: { width: 24, height: 24 },
|
|
2383
|
-
children: /* @__PURE__ */ (0,
|
|
2449
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "calendar", size: 16 })
|
|
2384
2450
|
}
|
|
2385
2451
|
)
|
|
2386
2452
|
]
|
|
2387
2453
|
}
|
|
2388
2454
|
),
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2391
|
-
/* @__PURE__ */ (0,
|
|
2455
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FieldDescription, { description, help }),
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_aria_components23.Dialog, { className: "pire-daterange-dialog", children: [
|
|
2392
2458
|
presets?.length ? (
|
|
2393
2459
|
// Before the calendar in the DOM, so keyboard users reach the shortcut without
|
|
2394
2460
|
// arrowing through a month first.
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "pire-daterange-presets", role: "group", "aria-label": msg.dateRangePresetsLabel, children: presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2396
2462
|
import_react_aria_components23.Button,
|
|
2397
2463
|
{
|
|
2398
2464
|
className: "pire-daterange-preset",
|
|
@@ -2402,33 +2468,33 @@ function DateRangePicker({
|
|
|
2402
2468
|
preset.id
|
|
2403
2469
|
)) })
|
|
2404
2470
|
) : null,
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
2406
|
-
/* @__PURE__ */ (0,
|
|
2407
|
-
/* @__PURE__ */ (0,
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_aria_components23.RangeCalendar, { className: "pire-calendar", children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("header", { className: "pire-calendar-head", children: [
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2408
2474
|
import_react_aria_components23.Button,
|
|
2409
2475
|
{
|
|
2410
2476
|
slot: "previous",
|
|
2411
2477
|
className: "pire-iconbtn",
|
|
2412
2478
|
"data-size": "sm",
|
|
2413
2479
|
"aria-label": msg.datePickerPreviousMonth,
|
|
2414
|
-
children: /* @__PURE__ */ (0,
|
|
2480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "chevron-left", size: 16 })
|
|
2415
2481
|
}
|
|
2416
2482
|
),
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2418
|
-
/* @__PURE__ */ (0,
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.Heading, { className: "pire-calendar-title" }),
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2419
2485
|
import_react_aria_components23.Button,
|
|
2420
2486
|
{
|
|
2421
2487
|
slot: "next",
|
|
2422
2488
|
className: "pire-iconbtn",
|
|
2423
2489
|
"data-size": "sm",
|
|
2424
2490
|
"aria-label": msg.datePickerNextMonth,
|
|
2425
|
-
children: /* @__PURE__ */ (0,
|
|
2491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Icon, { name: "chevron-right", size: 16 })
|
|
2426
2492
|
}
|
|
2427
2493
|
)
|
|
2428
2494
|
] }),
|
|
2429
|
-
/* @__PURE__ */ (0,
|
|
2430
|
-
/* @__PURE__ */ (0,
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_aria_components23.CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.CalendarHeaderCell, { children: day }) }),
|
|
2497
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components23.CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2432
2498
|
] })
|
|
2433
2499
|
] })
|
|
2434
2500
|
] }) })
|
|
@@ -2446,18 +2512,18 @@ var React20 = __toESM(require("react"), 1);
|
|
|
2446
2512
|
// src/components/feedback/Dialog.tsx
|
|
2447
2513
|
var React18 = __toESM(require("react"), 1);
|
|
2448
2514
|
var import_react_aria_components24 = require("react-aria-components");
|
|
2449
|
-
var
|
|
2515
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2450
2516
|
function DialogTitle({ children, className }) {
|
|
2451
|
-
return /* @__PURE__ */ (0,
|
|
2517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_aria_components24.Heading, { slot: "title", className: cx("pire-dialog-title", className), children });
|
|
2452
2518
|
}
|
|
2453
2519
|
function DialogDescription({ children, className }) {
|
|
2454
|
-
return /* @__PURE__ */ (0,
|
|
2520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: cx("pire-dialog-sub", className), style: { margin: 0 }, children });
|
|
2455
2521
|
}
|
|
2456
2522
|
function DialogBody({ children, className }) {
|
|
2457
|
-
return /* @__PURE__ */ (0,
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cx("pire-dialog-body", className), children });
|
|
2458
2524
|
}
|
|
2459
2525
|
function DialogActions({ children, className }) {
|
|
2460
|
-
return /* @__PURE__ */ (0,
|
|
2526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("footer", { className: cx("pire-dialog-foot", className), children });
|
|
2461
2527
|
}
|
|
2462
2528
|
function Dialog({
|
|
2463
2529
|
isOpen,
|
|
@@ -2486,11 +2552,11 @@ function Dialog({
|
|
|
2486
2552
|
const actionsSlot = slotOf(DialogActions);
|
|
2487
2553
|
const slots = [titleSlot, descriptionSlot, bodySlot, actionsSlot];
|
|
2488
2554
|
const loose = parts.filter((node) => !slots.includes(node));
|
|
2489
|
-
const heading = titleSlot ?? (title ? /* @__PURE__ */ (0,
|
|
2490
|
-
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ (0,
|
|
2491
|
-
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ (0,
|
|
2492
|
-
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ (0,
|
|
2493
|
-
return /* @__PURE__ */ (0,
|
|
2555
|
+
const heading = titleSlot ?? (title ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_aria_components24.Heading, { slot: "title", className: "pire-dialog-title", children: title }) : null);
|
|
2556
|
+
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null);
|
|
2557
|
+
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null);
|
|
2558
|
+
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "pire-dialog-body", children: loose }) : null);
|
|
2559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2494
2560
|
import_react_aria_components24.ModalOverlay,
|
|
2495
2561
|
{
|
|
2496
2562
|
className: "pire-modal-overlay",
|
|
@@ -2499,13 +2565,13 @@ function Dialog({
|
|
|
2499
2565
|
onOpenChange: (o) => {
|
|
2500
2566
|
if (!o) close();
|
|
2501
2567
|
},
|
|
2502
|
-
children: /* @__PURE__ */ (0,
|
|
2503
|
-
heading || description ? /* @__PURE__ */ (0,
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_aria_components24.Modal, { className: cx("pire-modal", className), "data-size": size, style, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_aria_components24.Dialog, { className: "pire-dialog", children: [
|
|
2569
|
+
heading || description ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("header", { className: "pire-dialog-head", children: [
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2505
2571
|
heading,
|
|
2506
2572
|
description
|
|
2507
2573
|
] }),
|
|
2508
|
-
showClose ? /* @__PURE__ */ (0,
|
|
2574
|
+
showClose ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(IconButton, { icon: "x", label: msg.dialogClose, size: "sm", onPress: close }) : null
|
|
2509
2575
|
] }) : null,
|
|
2510
2576
|
body,
|
|
2511
2577
|
actions
|
|
@@ -2519,9 +2585,9 @@ var React19 = __toESM(require("react"), 1);
|
|
|
2519
2585
|
var import_react_aria_components25 = require("react-aria-components");
|
|
2520
2586
|
|
|
2521
2587
|
// src/components/feedback/Skeleton.tsx
|
|
2522
|
-
var
|
|
2588
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2523
2589
|
function Skeleton({ shape = "text", width, height, className, style, ...rest }) {
|
|
2524
|
-
return /* @__PURE__ */ (0,
|
|
2590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2525
2591
|
"div",
|
|
2526
2592
|
{
|
|
2527
2593
|
className: cx("pire-skeleton", className),
|
|
@@ -2541,7 +2607,7 @@ function SkeletonTableRow({
|
|
|
2541
2607
|
...rest
|
|
2542
2608
|
}) {
|
|
2543
2609
|
const cells = typeof columns === "number" ? Array.from({ length: columns }, () => ({})) : columns;
|
|
2544
|
-
return /* @__PURE__ */ (0,
|
|
2610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2545
2611
|
"div",
|
|
2546
2612
|
{
|
|
2547
2613
|
className: cx("pire-skeleton-row", className),
|
|
@@ -2551,13 +2617,13 @@ function SkeletonTableRow({
|
|
|
2551
2617
|
...rest,
|
|
2552
2618
|
children: cells.map((c, i) => {
|
|
2553
2619
|
const align = c.numeric ? "right" : c.align ?? "left";
|
|
2554
|
-
return /* @__PURE__ */ (0,
|
|
2620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2555
2621
|
"div",
|
|
2556
2622
|
{
|
|
2557
2623
|
className: "pire-skeleton-cell",
|
|
2558
2624
|
"data-align": align,
|
|
2559
2625
|
style: { width: c.width, flex: c.width ? "0 0 auto" : void 0 },
|
|
2560
|
-
children: /* @__PURE__ */ (0,
|
|
2626
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { width: BAR_WIDTHS[i % BAR_WIDTHS.length] })
|
|
2561
2627
|
},
|
|
2562
2628
|
i
|
|
2563
2629
|
);
|
|
@@ -2567,7 +2633,10 @@ function SkeletonTableRow({
|
|
|
2567
2633
|
}
|
|
2568
2634
|
|
|
2569
2635
|
// src/components/data/DataTable.tsx
|
|
2570
|
-
var
|
|
2636
|
+
var import_jsx_runtime36 = (
|
|
2637
|
+
// 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
|
|
2638
|
+
require("react/jsx-runtime")
|
|
2639
|
+
);
|
|
2571
2640
|
var IS_DEV3 = process.env.NODE_ENV !== "production";
|
|
2572
2641
|
var warned3 = /* @__PURE__ */ new Set();
|
|
2573
2642
|
function warnOnce3(key, message) {
|
|
@@ -2576,6 +2645,90 @@ function warnOnce3(key, message) {
|
|
|
2576
2645
|
console.warn(`[pire] ${message}`);
|
|
2577
2646
|
}
|
|
2578
2647
|
var CHECKBOX_W = 44;
|
|
2648
|
+
var PENDING_KEY = "__pire_pending_row__";
|
|
2649
|
+
var FIELD_SELECTOR = [
|
|
2650
|
+
'input:not([type="hidden"]):not([disabled])',
|
|
2651
|
+
"textarea:not([disabled])",
|
|
2652
|
+
"select:not([disabled])",
|
|
2653
|
+
"button:not([disabled])",
|
|
2654
|
+
'[contenteditable="true"]',
|
|
2655
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
2656
|
+
].join(",");
|
|
2657
|
+
function EditCell({
|
|
2658
|
+
children,
|
|
2659
|
+
isFirst,
|
|
2660
|
+
focusToken,
|
|
2661
|
+
onCommit,
|
|
2662
|
+
onCancel
|
|
2663
|
+
}) {
|
|
2664
|
+
const state = React19.useContext(import_react_aria_components25.TableStateContext);
|
|
2665
|
+
const setNavDisabled = state?.setKeyboardNavigationDisabled;
|
|
2666
|
+
const ref = React19.useRef(null);
|
|
2667
|
+
const focusedWithin = React19.useRef(false);
|
|
2668
|
+
React19.useLayoutEffect(() => {
|
|
2669
|
+
if (!isFirst) return;
|
|
2670
|
+
const row = ref.current?.closest('[role="row"]');
|
|
2671
|
+
void focusToken;
|
|
2672
|
+
for (const cell of row?.querySelectorAll(".pire-td-edit") ?? []) {
|
|
2673
|
+
const field = cell.querySelector(FIELD_SELECTOR);
|
|
2674
|
+
if (field) {
|
|
2675
|
+
field.focus();
|
|
2676
|
+
break;
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
}, [isFirst, focusToken]);
|
|
2680
|
+
React19.useLayoutEffect(() => {
|
|
2681
|
+
if (!isFirst) return;
|
|
2682
|
+
const row = ref.current?.closest('[role="row"]');
|
|
2683
|
+
return () => {
|
|
2684
|
+
requestAnimationFrame(() => {
|
|
2685
|
+
const active = document.activeElement;
|
|
2686
|
+
if (row?.isConnected && (!active || active === document.body || !active.isConnected)) row.focus();
|
|
2687
|
+
});
|
|
2688
|
+
};
|
|
2689
|
+
}, [isFirst]);
|
|
2690
|
+
React19.useEffect(
|
|
2691
|
+
() => () => {
|
|
2692
|
+
if (focusedWithin.current) setNavDisabled?.(false);
|
|
2693
|
+
},
|
|
2694
|
+
[setNavDisabled]
|
|
2695
|
+
);
|
|
2696
|
+
const stop = (e) => e.stopPropagation();
|
|
2697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2698
|
+
"div",
|
|
2699
|
+
{
|
|
2700
|
+
ref,
|
|
2701
|
+
className: "pire-td-edit",
|
|
2702
|
+
onFocus: (e) => {
|
|
2703
|
+
e.stopPropagation();
|
|
2704
|
+
focusedWithin.current = true;
|
|
2705
|
+
setNavDisabled?.(true);
|
|
2706
|
+
},
|
|
2707
|
+
onBlur: (e) => {
|
|
2708
|
+
const next = e.relatedTarget;
|
|
2709
|
+
const row = ref.current?.closest('[role="row"]');
|
|
2710
|
+
if (next && row?.contains(next) && next.closest(".pire-td-edit")) return;
|
|
2711
|
+
focusedWithin.current = false;
|
|
2712
|
+
setNavDisabled?.(false);
|
|
2713
|
+
},
|
|
2714
|
+
onKeyDown: (e) => {
|
|
2715
|
+
stop(e);
|
|
2716
|
+
if (e.nativeEvent.isComposing || e.defaultPrevented) return;
|
|
2717
|
+
if (e.key === "Enter" && !(e.target instanceof HTMLTextAreaElement)) {
|
|
2718
|
+
e.preventDefault();
|
|
2719
|
+
onCommit();
|
|
2720
|
+
} else if (e.key === "Escape") {
|
|
2721
|
+
e.preventDefault();
|
|
2722
|
+
onCancel();
|
|
2723
|
+
}
|
|
2724
|
+
},
|
|
2725
|
+
onPointerDown: stop,
|
|
2726
|
+
onMouseDown: stop,
|
|
2727
|
+
onClick: stop,
|
|
2728
|
+
children
|
|
2729
|
+
}
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2579
2732
|
function DataTable({
|
|
2580
2733
|
columns,
|
|
2581
2734
|
rows,
|
|
@@ -2596,11 +2749,17 @@ function DataTable({
|
|
|
2596
2749
|
rowProps,
|
|
2597
2750
|
renderExpanded,
|
|
2598
2751
|
expandedIds,
|
|
2752
|
+
editingRowId,
|
|
2753
|
+
pendingRow,
|
|
2754
|
+
onCommitRow,
|
|
2755
|
+
onCancelRow,
|
|
2599
2756
|
className,
|
|
2600
2757
|
style,
|
|
2601
2758
|
...rest
|
|
2602
2759
|
}) {
|
|
2603
2760
|
const msg = usePireMessages();
|
|
2761
|
+
const [pendingFocus, setPendingFocus] = React19.useState(0);
|
|
2762
|
+
const isEditing = (row) => editingRowId != null && String(row.id) === String(editingRowId);
|
|
2604
2763
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2605
2764
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2606
2765
|
const pinnedGeometry = React19.useMemo(() => {
|
|
@@ -2638,7 +2797,8 @@ function DataTable({
|
|
|
2638
2797
|
const hasPinned = pinnedGeometry.size > 0;
|
|
2639
2798
|
const lastPinnedKey = hasPinned ? [...pinnedGeometry.keys()][pinnedGeometry.size - 1] : void 0;
|
|
2640
2799
|
const sortDescriptor = sort ? { column: sort.key, direction: sort.dir === "asc" ? "ascending" : "descending" } : void 0;
|
|
2641
|
-
const handleSelection = (
|
|
2800
|
+
const handleSelection = (selection) => {
|
|
2801
|
+
const keys = selection !== "all" && selection.has(PENDING_KEY) ? new Set([...selection].filter((key) => key !== PENDING_KEY)) : selection;
|
|
2642
2802
|
if (keys === "all") {
|
|
2643
2803
|
const inCollection = new Set(rows.map((r) => r.id));
|
|
2644
2804
|
return onSelectionChange?.([
|
|
@@ -2654,6 +2814,7 @@ function DataTable({
|
|
|
2654
2814
|
...columns.map((c) => ({ width: c.width, align: c.align, numeric: c.numeric }))
|
|
2655
2815
|
];
|
|
2656
2816
|
const body = isLoading ? [] : rows;
|
|
2817
|
+
const firstEditable = columns.find((c) => c.renderEdit);
|
|
2657
2818
|
const presentation = new Map(rows.map((row) => [row.id, rowProps?.(row) ?? {}]));
|
|
2658
2819
|
const disabledKeys = rows.filter((row) => presentation.get(row.id)?.isDisabled).map((row) => row.id);
|
|
2659
2820
|
const expanded = new Set((expandedIds ?? []).map(String));
|
|
@@ -2669,14 +2830,14 @@ function DataTable({
|
|
|
2669
2830
|
style: { left: box.left, width: box.width, minWidth: box.width, maxWidth: box.width }
|
|
2670
2831
|
};
|
|
2671
2832
|
};
|
|
2672
|
-
return /* @__PURE__ */ (0,
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2673
2834
|
"div",
|
|
2674
2835
|
{
|
|
2675
2836
|
className: cx("pire-table-wrap", className),
|
|
2676
2837
|
style,
|
|
2677
2838
|
"data-loading": isLoading ? "true" : void 0,
|
|
2678
2839
|
"aria-busy": isLoading ? "true" : void 0,
|
|
2679
|
-
children: /* @__PURE__ */ (0,
|
|
2840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2680
2841
|
import_react_aria_components25.Table,
|
|
2681
2842
|
{
|
|
2682
2843
|
className: "pire-table",
|
|
@@ -2692,11 +2853,11 @@ function DataTable({
|
|
|
2692
2853
|
onSortChange: (d) => onSortChange?.({ key: String(d.column), dir: d.direction === "ascending" ? "asc" : "desc" }),
|
|
2693
2854
|
onRowAction: onRowAction ? (key) => {
|
|
2694
2855
|
const row = rows.find((r) => String(r.id) === String(key));
|
|
2695
|
-
if (row) onRowAction(row);
|
|
2856
|
+
if (row && !isEditing(row)) onRowAction(row);
|
|
2696
2857
|
} : void 0,
|
|
2697
2858
|
children: [
|
|
2698
|
-
/* @__PURE__ */ (0,
|
|
2699
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0,
|
|
2859
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_aria_components25.TableHeader, { className: "pire-thead-row", children: [
|
|
2860
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
2700
2861
|
columns.map((c, i) => (
|
|
2701
2862
|
// The checkbox column is never the row header — a selection control does not identify
|
|
2702
2863
|
// the record — so the first *data* column carries it regardless of whether a checkbox
|
|
@@ -2704,7 +2865,7 @@ function DataTable({
|
|
|
2704
2865
|
// table with no row header at all: invisible on first paint, and a hard crash from
|
|
2705
2866
|
// React Aria's own "table must have a row header" invariant the moment `rows` changes
|
|
2706
2867
|
// under it (search, sort, a paginated load).
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
2868
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2708
2869
|
import_react_aria_components25.Column,
|
|
2709
2870
|
{
|
|
2710
2871
|
id: c.key,
|
|
@@ -2714,9 +2875,9 @@ function DataTable({
|
|
|
2714
2875
|
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
2715
2876
|
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
2716
2877
|
...pinProps(c.key),
|
|
2717
|
-
children: /* @__PURE__ */ (0,
|
|
2878
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
|
|
2718
2879
|
c.label,
|
|
2719
|
-
c.sortable ? /* @__PURE__ */ (0,
|
|
2880
|
+
c.sortable ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2720
2881
|
Icon,
|
|
2721
2882
|
{
|
|
2722
2883
|
size: 12,
|
|
@@ -2732,65 +2893,117 @@ function DataTable({
|
|
|
2732
2893
|
)
|
|
2733
2894
|
))
|
|
2734
2895
|
] }),
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2736
2897
|
import_react_aria_components25.TableBody,
|
|
2737
2898
|
{
|
|
2738
|
-
renderEmptyState: () => isLoading ? /* @__PURE__ */ (0,
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2899
|
+
renderEmptyState: () => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
|
|
2740
2901
|
Array.from({ length: skeletonRows }, (_, i) => (
|
|
2741
2902
|
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
2742
|
-
/* @__PURE__ */ (0,
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
2743
2904
|
))
|
|
2744
|
-
] }) : /* @__PURE__ */ (0,
|
|
2745
|
-
children:
|
|
2746
|
-
|
|
2747
|
-
const record = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2905
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
|
|
2906
|
+
children: [
|
|
2907
|
+
pendingRow && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2748
2908
|
import_react_aria_components25.Row,
|
|
2749
2909
|
{
|
|
2750
|
-
id:
|
|
2751
|
-
className:
|
|
2752
|
-
"data-
|
|
2910
|
+
id: PENDING_KEY,
|
|
2911
|
+
className: "pire-tr",
|
|
2912
|
+
"data-editing": "true",
|
|
2913
|
+
"data-pending": "true",
|
|
2753
2914
|
children: [
|
|
2754
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0,
|
|
2915
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null) }) : null,
|
|
2755
2916
|
columns.map((c) => {
|
|
2756
2917
|
const pin = pinProps(c.key);
|
|
2757
|
-
return /* @__PURE__ */ (0,
|
|
2918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2758
2919
|
import_react_aria_components25.Cell,
|
|
2759
2920
|
{
|
|
2760
2921
|
className: "pire-td",
|
|
2761
2922
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
2762
|
-
"data-tone": c.tone?.(row) ?? void 0,
|
|
2763
2923
|
...pin,
|
|
2764
2924
|
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2765
|
-
children: c.
|
|
2925
|
+
children: c.renderEdit ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2926
|
+
EditCell,
|
|
2927
|
+
{
|
|
2928
|
+
isFirst: c === firstEditable,
|
|
2929
|
+
focusToken: pendingFocus,
|
|
2930
|
+
onCommit: () => {
|
|
2931
|
+
onCommitRow?.(null);
|
|
2932
|
+
setPendingFocus((n) => n + 1);
|
|
2933
|
+
},
|
|
2934
|
+
onCancel: () => onCancelRow?.(null),
|
|
2935
|
+
children: c.renderEdit(pendingRow)
|
|
2936
|
+
}
|
|
2937
|
+
) : null
|
|
2766
2938
|
},
|
|
2767
2939
|
c.key
|
|
2768
2940
|
);
|
|
2769
2941
|
})
|
|
2770
2942
|
]
|
|
2771
2943
|
},
|
|
2772
|
-
|
|
2773
|
-
)
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2944
|
+
PENDING_KEY
|
|
2945
|
+
) : null,
|
|
2946
|
+
body.flatMap((row) => {
|
|
2947
|
+
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
2948
|
+
const editing = isEditing(row);
|
|
2949
|
+
const record = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2950
|
+
import_react_aria_components25.Row,
|
|
2951
|
+
{
|
|
2952
|
+
id: row.id,
|
|
2953
|
+
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
2954
|
+
"data-pressable": onRowAction && !rowIsDisabled && !editing ? "true" : void 0,
|
|
2955
|
+
"data-editing": editing ? "true" : void 0,
|
|
2956
|
+
children: [
|
|
2957
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
2958
|
+
columns.map((c) => {
|
|
2959
|
+
const pin = pinProps(c.key);
|
|
2960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2961
|
+
import_react_aria_components25.Cell,
|
|
2962
|
+
{
|
|
2963
|
+
className: "pire-td",
|
|
2964
|
+
"data-numeric": c.numeric ? "true" : void 0,
|
|
2965
|
+
"data-tone": c.tone?.(row) ?? void 0,
|
|
2966
|
+
...pin,
|
|
2967
|
+
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2968
|
+
children: editing && c.renderEdit ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2969
|
+
EditCell,
|
|
2970
|
+
{
|
|
2971
|
+
isFirst: c === firstEditable,
|
|
2972
|
+
focusToken: 0,
|
|
2973
|
+
onCommit: () => onCommitRow?.(row.id),
|
|
2974
|
+
onCancel: () => onCancelRow?.(row.id),
|
|
2975
|
+
children: c.renderEdit(row)
|
|
2976
|
+
}
|
|
2977
|
+
) : c.render ? c.render(row) : row[c.key]
|
|
2978
|
+
},
|
|
2979
|
+
c.key
|
|
2980
|
+
);
|
|
2981
|
+
})
|
|
2982
|
+
]
|
|
2983
|
+
},
|
|
2984
|
+
row.id
|
|
2985
|
+
);
|
|
2986
|
+
if (!renderExpanded || !expanded.has(String(row.id))) return [record];
|
|
2987
|
+
return [
|
|
2988
|
+
record,
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))
|
|
2990
|
+
];
|
|
2991
|
+
})
|
|
2992
|
+
]
|
|
2780
2993
|
}
|
|
2781
2994
|
),
|
|
2782
|
-
footer && !isLoading ? /* @__PURE__ */ (0,
|
|
2783
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0,
|
|
2995
|
+
footer && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react_aria_components25.Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
2996
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_aria_components25.Cell, { className: "pire-tf", ...pinProps(null) }) : null,
|
|
2784
2997
|
columns.map((c, i) => {
|
|
2785
2998
|
const pin = pinProps(c.key);
|
|
2786
|
-
return /* @__PURE__ */ (0,
|
|
2999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2787
3000
|
import_react_aria_components25.Cell,
|
|
2788
3001
|
{
|
|
2789
3002
|
className: "pire-tf",
|
|
2790
3003
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
2791
3004
|
...pin,
|
|
2792
3005
|
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2793
|
-
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ (0,
|
|
3006
|
+
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
2794
3007
|
},
|
|
2795
3008
|
c.key
|
|
2796
3009
|
);
|
|
@@ -2804,7 +3017,7 @@ function DataTable({
|
|
|
2804
3017
|
}
|
|
2805
3018
|
|
|
2806
3019
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2807
|
-
var
|
|
3020
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2808
3021
|
function ValueHelpDialog({
|
|
2809
3022
|
isOpen,
|
|
2810
3023
|
title,
|
|
@@ -2839,16 +3052,16 @@ function ValueHelpDialog({
|
|
|
2839
3052
|
setQuery(value);
|
|
2840
3053
|
onSearch?.(value);
|
|
2841
3054
|
};
|
|
2842
|
-
return /* @__PURE__ */ (0,
|
|
3055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2843
3056
|
Dialog,
|
|
2844
3057
|
{
|
|
2845
3058
|
isOpen,
|
|
2846
3059
|
size: "lg",
|
|
2847
3060
|
title: title ?? msg.valueHelpDialogTitle,
|
|
2848
3061
|
onClose,
|
|
2849
|
-
footer: /* @__PURE__ */ (0,
|
|
2850
|
-
/* @__PURE__ */ (0,
|
|
2851
|
-
isMultiple ? /* @__PURE__ */ (0,
|
|
3062
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { variant: "tertiary", onPress: onClose, children: msg.valueHelpDialogCancel }),
|
|
3064
|
+
isMultiple ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2852
3065
|
Button,
|
|
2853
3066
|
{
|
|
2854
3067
|
variant: "primary",
|
|
@@ -2860,8 +3073,8 @@ function ValueHelpDialog({
|
|
|
2860
3073
|
}
|
|
2861
3074
|
) : null
|
|
2862
3075
|
] }),
|
|
2863
|
-
children: /* @__PURE__ */ (0,
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
3076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "var(--sp-3)" }, children: [
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2865
3078
|
Input,
|
|
2866
3079
|
{
|
|
2867
3080
|
"aria-label": msg.valueHelpDialogSearch,
|
|
@@ -2874,12 +3087,12 @@ function ValueHelpDialog({
|
|
|
2874
3087
|
autoFocus: true
|
|
2875
3088
|
}
|
|
2876
3089
|
),
|
|
2877
|
-
isMultiple ? /* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
2880
|
-
/* @__PURE__ */ (0,
|
|
3090
|
+
isMultiple ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "pire-valuehelp-selectionbar", children: [
|
|
3091
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.(rows.map((r) => r.id)), children: msg.valueHelpSelectAllCount.replace("{count}", String(rows.length)) }),
|
|
3092
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.([]), children: msg.valueHelpClearSelection }),
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "pire-valuehelp-count", children: msg.valueHelpSelectedCount.replace("{count}", String(selectedKeys?.length ?? 0)) })
|
|
2881
3094
|
] }) : null,
|
|
2882
|
-
/* @__PURE__ */ (0,
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2883
3096
|
"div",
|
|
2884
3097
|
{
|
|
2885
3098
|
onScroll: onLoadMore ? (event) => {
|
|
@@ -2887,7 +3100,7 @@ function ValueHelpDialog({
|
|
|
2887
3100
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 64) onLoadMore();
|
|
2888
3101
|
} : void 0,
|
|
2889
3102
|
style: { overflow: "auto", maxHeight: "48vh" },
|
|
2890
|
-
children: /* @__PURE__ */ (0,
|
|
3103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2891
3104
|
DataTable,
|
|
2892
3105
|
{
|
|
2893
3106
|
"aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
|
|
@@ -2914,7 +3127,7 @@ function ValueHelpDialog({
|
|
|
2914
3127
|
}
|
|
2915
3128
|
|
|
2916
3129
|
// src/components/forms/ValueHelpField.tsx
|
|
2917
|
-
var
|
|
3130
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2918
3131
|
var defaultFormat = (row) => [row.id, row.name ?? row.label ?? row.text].filter(Boolean).join(" \u2014 ");
|
|
2919
3132
|
function ValueHelpField({
|
|
2920
3133
|
label,
|
|
@@ -2941,8 +3154,8 @@ function ValueHelpField({
|
|
|
2941
3154
|
}) {
|
|
2942
3155
|
const msg = usePireMessages();
|
|
2943
3156
|
const [open, setOpen] = React21.useState(false);
|
|
2944
|
-
return /* @__PURE__ */ (0,
|
|
2945
|
-
/* @__PURE__ */ (0,
|
|
3157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cx(className), style, children: [
|
|
3158
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2946
3159
|
Input,
|
|
2947
3160
|
{
|
|
2948
3161
|
label,
|
|
@@ -2954,8 +3167,8 @@ function ValueHelpField({
|
|
|
2954
3167
|
placeholder: placeholder ?? msg.valueHelpFieldPlaceholder,
|
|
2955
3168
|
description,
|
|
2956
3169
|
errorMessage,
|
|
2957
|
-
suffix: /* @__PURE__ */ (0,
|
|
2958
|
-
allowsClear && value ? /* @__PURE__ */ (0,
|
|
3170
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: "pire-valuehelp-actions", children: [
|
|
3171
|
+
allowsClear && value ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2959
3172
|
IconButton,
|
|
2960
3173
|
{
|
|
2961
3174
|
icon: "x",
|
|
@@ -2964,7 +3177,7 @@ function ValueHelpField({
|
|
|
2964
3177
|
onPress: () => onChange?.(null)
|
|
2965
3178
|
}
|
|
2966
3179
|
) : null,
|
|
2967
|
-
/* @__PURE__ */ (0,
|
|
3180
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2968
3181
|
IconButton,
|
|
2969
3182
|
{
|
|
2970
3183
|
icon: "search",
|
|
@@ -2976,7 +3189,7 @@ function ValueHelpField({
|
|
|
2976
3189
|
] })
|
|
2977
3190
|
}
|
|
2978
3191
|
),
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2980
3193
|
ValueHelpDialog,
|
|
2981
3194
|
{
|
|
2982
3195
|
isOpen: open,
|
|
@@ -3001,7 +3214,7 @@ var import_react_aria_components27 = require("react-aria-components");
|
|
|
3001
3214
|
|
|
3002
3215
|
// src/components/feedback/ProgressBar.tsx
|
|
3003
3216
|
var import_react_aria_components26 = require("react-aria-components");
|
|
3004
|
-
var
|
|
3217
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3005
3218
|
function ProgressBar({
|
|
3006
3219
|
value = 0,
|
|
3007
3220
|
minValue = 0,
|
|
@@ -3014,7 +3227,7 @@ function ProgressBar({
|
|
|
3014
3227
|
className,
|
|
3015
3228
|
style
|
|
3016
3229
|
}) {
|
|
3017
|
-
return /* @__PURE__ */ (0,
|
|
3230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3018
3231
|
import_react_aria_components26.ProgressBar,
|
|
3019
3232
|
{
|
|
3020
3233
|
className: cx("pire-progress", className),
|
|
@@ -3025,19 +3238,19 @@ function ProgressBar({
|
|
|
3025
3238
|
maxValue,
|
|
3026
3239
|
isIndeterminate,
|
|
3027
3240
|
style,
|
|
3028
|
-
children: ({ percentage, valueText }) => /* @__PURE__ */ (0,
|
|
3029
|
-
label || showValue ? /* @__PURE__ */ (0,
|
|
3030
|
-
label ? /* @__PURE__ */ (0,
|
|
3031
|
-
showValue && !isIndeterminate ? /* @__PURE__ */ (0,
|
|
3241
|
+
children: ({ percentage, valueText }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
3242
|
+
label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "pire-progress-head", children: [
|
|
3243
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_aria_components26.Label, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", {}),
|
|
3244
|
+
showValue && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-numeric", children: valueText }) : null
|
|
3032
3245
|
] }) : null,
|
|
3033
|
-
/* @__PURE__ */ (0,
|
|
3246
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "pire-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "pire-progress-fill", style: { width: `${isIndeterminate ? 40 : percentage}%` } }) })
|
|
3034
3247
|
] })
|
|
3035
3248
|
}
|
|
3036
3249
|
);
|
|
3037
3250
|
}
|
|
3038
3251
|
|
|
3039
3252
|
// src/components/forms/FileUpload.tsx
|
|
3040
|
-
var
|
|
3253
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3041
3254
|
var isImage = (file) => file.type.startsWith("image/");
|
|
3042
3255
|
function formatFileSize(bytes) {
|
|
3043
3256
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -3115,7 +3328,7 @@ function FileUpload({
|
|
|
3115
3328
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
3116
3329
|
};
|
|
3117
3330
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
3118
|
-
return /* @__PURE__ */ (0,
|
|
3331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
3119
3332
|
"div",
|
|
3120
3333
|
{
|
|
3121
3334
|
className: cx("pire-field", "pire-fileupload", className),
|
|
@@ -3124,101 +3337,55 @@ function FileUpload({
|
|
|
3124
3337
|
"data-invalid": isInvalid ? "true" : void 0,
|
|
3125
3338
|
...rest,
|
|
3126
3339
|
children: [
|
|
3127
|
-
label ? /* @__PURE__ */ (0,
|
|
3340
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "pire-field-label", children: [
|
|
3128
3341
|
label,
|
|
3129
|
-
isRequired ? /* @__PURE__ */ (0,
|
|
3342
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
3130
3343
|
] }) : null,
|
|
3131
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3132
|
-
import_react_aria_components27.FileTrigger,
|
|
3133
|
-
{
|
|
3134
|
-
acceptedFileTypes,
|
|
3135
|
-
allowsMultiple,
|
|
3136
|
-
onSelect: accept,
|
|
3137
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { icon: "paperclip", isDisabled: isDisabled || isReadOnly, children: chooseLabel ?? msg.fileUploadChoose })
|
|
3138
|
-
}
|
|
3139
|
-
),
|
|
3140
|
-
files.length ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("li", { className: "pire-fileupload-item", children: [
|
|
3141
|
-
previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
3142
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-fileupload-name", children: file.name }),
|
|
3143
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
3144
|
-
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3145
|
-
IconButton,
|
|
3146
|
-
{
|
|
3147
|
-
icon: "x",
|
|
3148
|
-
size: "sm",
|
|
3149
|
-
label: msg.fileUploadRemoveNamed.replace("{name}", file.name),
|
|
3150
|
-
onPress: () => remove(file)
|
|
3151
|
-
}
|
|
3152
|
-
)
|
|
3153
|
-
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3154
|
-
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3155
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_aria_components27.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
3156
|
-
isInvalid && errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
3157
|
-
]
|
|
3158
|
-
}
|
|
3159
|
-
);
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3162
|
-
// src/components/navigation/ShellBar.tsx
|
|
3163
|
-
var import_react_aria_components28 = require("react-aria-components");
|
|
3164
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3165
|
-
var initials2 = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
3166
|
-
function ShellBar({
|
|
3167
|
-
launcher,
|
|
3168
|
-
product,
|
|
3169
|
-
monogram,
|
|
3170
|
-
title,
|
|
3171
|
-
onMenu,
|
|
3172
|
-
onSearch,
|
|
3173
|
-
menuLabel = "Open navigation",
|
|
3174
|
-
searchLabel = "Search",
|
|
3175
|
-
actions,
|
|
3176
|
-
user,
|
|
3177
|
-
userMenu,
|
|
3178
|
-
userMenuLabel,
|
|
3179
|
-
className,
|
|
3180
|
-
...rest
|
|
3181
|
-
}) {
|
|
3182
|
-
const msg = usePireMessages();
|
|
3183
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("header", { className: cx("pire-shellbar", className), ...rest, children: [
|
|
3184
|
-
launcher,
|
|
3185
|
-
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IconButton, { icon: "menu", label: menuLabel, variant: "inverse", size: "sm", onPress: onMenu }) : null,
|
|
3186
|
-
monogram ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
|
|
3187
|
-
product ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-product", children: product }) : null,
|
|
3188
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-title", children: title }) : null,
|
|
3189
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-spacer" }),
|
|
3190
|
-
onSearch ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IconButton, { icon: "search", label: searchLabel, variant: "inverse", size: "sm", onPress: onSearch }) : null,
|
|
3191
|
-
actions,
|
|
3192
|
-
user && userMenu ? (
|
|
3193
|
-
// A real button, not the img-role span: the avatar is where "my profile", "switch company"
|
|
3194
|
-
// and "sign out" live in any ERP, and a span accepts neither focus nor onPress. Popover is
|
|
3195
|
-
// rendered here rather than expected from the consumer so the panel keeps shell placement.
|
|
3196
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_aria_components28.MenuTrigger, { children: [
|
|
3197
3344
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3198
|
-
|
|
3345
|
+
import_react_aria_components27.FileTrigger,
|
|
3199
3346
|
{
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3347
|
+
acceptedFileTypes,
|
|
3348
|
+
allowsMultiple,
|
|
3349
|
+
onSelect: accept,
|
|
3350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { icon: "paperclip", isDisabled: isDisabled || isReadOnly, children: chooseLabel ?? msg.fileUploadChoose })
|
|
3203
3351
|
}
|
|
3204
3352
|
),
|
|
3205
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3353
|
+
files.length ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("li", { className: "pire-fileupload-item", children: [
|
|
3354
|
+
previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-fileupload-name", children: file.name }),
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
3357
|
+
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3358
|
+
IconButton,
|
|
3359
|
+
{
|
|
3360
|
+
icon: "x",
|
|
3361
|
+
size: "sm",
|
|
3362
|
+
label: msg.fileUploadRemoveNamed.replace("{name}", file.name),
|
|
3363
|
+
onPress: () => remove(file)
|
|
3364
|
+
}
|
|
3365
|
+
)
|
|
3366
|
+
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3367
|
+
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3368
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_aria_components27.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
3369
|
+
isInvalid && errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
3370
|
+
]
|
|
3371
|
+
}
|
|
3372
|
+
);
|
|
3209
3373
|
}
|
|
3210
3374
|
|
|
3211
|
-
// src/components/navigation/
|
|
3212
|
-
var React23 = __toESM(require("react"), 1);
|
|
3375
|
+
// src/components/navigation/ShellBar.tsx
|
|
3213
3376
|
var import_react_aria_components30 = require("react-aria-components");
|
|
3214
3377
|
|
|
3215
|
-
// src/components/navigation/
|
|
3378
|
+
// src/components/navigation/Breadcrumb.tsx
|
|
3379
|
+
var React23 = __toESM(require("react"), 1);
|
|
3216
3380
|
var import_react_aria_components29 = require("react-aria-components");
|
|
3381
|
+
|
|
3382
|
+
// src/components/navigation/Menu.tsx
|
|
3383
|
+
var import_react_aria_components28 = require("react-aria-components");
|
|
3217
3384
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3218
3385
|
function Menu({ minWidth, className, style, ...rest }) {
|
|
3219
3386
|
const width = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
3220
3387
|
const menuStyle = width == null ? style : { ["--pire-menu-min-w"]: width, ...style };
|
|
3221
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components28.Menu, { className: cx("pire-menu", className), style: menuStyle, ...rest });
|
|
3222
3389
|
}
|
|
3223
3390
|
var shortcutKeys = (shortcut) => {
|
|
3224
3391
|
if (shortcut == null) return [];
|
|
@@ -3236,7 +3403,7 @@ function MenuItem({
|
|
|
3236
3403
|
}) {
|
|
3237
3404
|
const keys = shortcutKeys(shortcut);
|
|
3238
3405
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
3239
|
-
|
|
3406
|
+
import_react_aria_components28.MenuItem,
|
|
3240
3407
|
{
|
|
3241
3408
|
className: cx("pire-menu-item", className),
|
|
3242
3409
|
"data-tone": tone === "danger" ? "danger" : void 0,
|
|
@@ -3260,17 +3427,189 @@ function MenuItem({
|
|
|
3260
3427
|
);
|
|
3261
3428
|
}
|
|
3262
3429
|
function MenuSection({ title, children, className, ...rest }) {
|
|
3263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
3264
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_aria_components28.MenuSection, { className: cx("pire-menu-section", className), ...rest, children: [
|
|
3431
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components28.Header, { className: "pire-menu-section-title", children: title }) : null,
|
|
3265
3432
|
children
|
|
3266
3433
|
] });
|
|
3267
3434
|
}
|
|
3268
3435
|
function MenuSeparator({ className }) {
|
|
3269
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components28.Separator, { className: cx("pire-menu-separator", className) });
|
|
3270
3437
|
}
|
|
3271
3438
|
|
|
3272
|
-
// src/components/navigation/
|
|
3439
|
+
// src/components/navigation/Breadcrumb.tsx
|
|
3273
3440
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3441
|
+
var keyOf = (item) => item.id ?? item.label;
|
|
3442
|
+
var MIN_CURRENT = 64;
|
|
3443
|
+
function useFitLevel(enabled) {
|
|
3444
|
+
const boxRef = React23.useRef(null);
|
|
3445
|
+
const measureRef = React23.useRef(null);
|
|
3446
|
+
const [level, setLevel] = React23.useState(0);
|
|
3447
|
+
React23.useLayoutEffect(() => {
|
|
3448
|
+
const box = boxRef.current;
|
|
3449
|
+
const measure = measureRef.current;
|
|
3450
|
+
if (!enabled || !box || !measure) return;
|
|
3451
|
+
const check = () => {
|
|
3452
|
+
const avail = box.clientWidth;
|
|
3453
|
+
const gap = Number.parseFloat(getComputedStyle(measure).columnGap) || 0;
|
|
3454
|
+
const steps = [...measure.querySelectorAll("[data-step]")].map((el) => el.offsetWidth);
|
|
3455
|
+
const more = measure.querySelector("[data-more]")?.offsetWidth ?? 0;
|
|
3456
|
+
const full = steps.reduce((sum, w) => sum + w, 0) + gap * Math.max(steps.length - 1, 0);
|
|
3457
|
+
if (full <= avail + 0.5) return setLevel(0);
|
|
3458
|
+
const first = steps[0] ?? 0;
|
|
3459
|
+
setLevel(first + more + MIN_CURRENT + gap * 2 <= avail ? 1 : 2);
|
|
3460
|
+
};
|
|
3461
|
+
check();
|
|
3462
|
+
const observer = new ResizeObserver(check);
|
|
3463
|
+
observer.observe(box);
|
|
3464
|
+
observer.observe(measure);
|
|
3465
|
+
return () => observer.disconnect();
|
|
3466
|
+
}, [enabled]);
|
|
3467
|
+
return { boxRef, measureRef, level: enabled ? level : 0 };
|
|
3468
|
+
}
|
|
3469
|
+
function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
3470
|
+
const msg = usePireMessages();
|
|
3471
|
+
const { boxRef, measureRef, level } = useFitLevel(!!isCollapsible);
|
|
3472
|
+
const last = items[items.length - 1];
|
|
3473
|
+
const foldFirst = level === 2 && items.length > 1;
|
|
3474
|
+
const collapse = foldFirst || level === 1 && items.length > 2;
|
|
3475
|
+
const folded = collapse ? items.slice(foldFirst ? 0 : 1, -1) : [];
|
|
3476
|
+
const shown = collapse ? foldFirst ? [last] : [items[0], last] : items;
|
|
3477
|
+
const moreAt = foldFirst ? 0 : 1;
|
|
3478
|
+
const separator = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "chevron-right", size: 12, className: "pire-breadcrumb-sep" });
|
|
3479
|
+
const crumb = (item) => {
|
|
3480
|
+
const isLast = item === last;
|
|
3481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3482
|
+
import_react_aria_components29.Breadcrumb,
|
|
3483
|
+
{
|
|
3484
|
+
className: "pire-breadcrumb",
|
|
3485
|
+
id: keyOf(item),
|
|
3486
|
+
"data-last": isLast ? "true" : void 0,
|
|
3487
|
+
children: [
|
|
3488
|
+
isCollapsible ? (
|
|
3489
|
+
// A Link even for the current step, because that is what React Aria marks
|
|
3490
|
+
// `aria-current="page"`. The `title` is what reads the step whole once it truncates.
|
|
3491
|
+
// A class, not an `a` selector: React Aria renders a Link with no `href` as a <span>.
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components29.Link, { className: "pire-breadcrumb-link", href: isLast ? void 0 : item.href, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { title: isLast ? item.label : void 0, children: item.label }) })
|
|
3493
|
+
) : isLast ? item.label : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components29.Link, { href: item.href, children: item.label }),
|
|
3494
|
+
isLast ? null : separator
|
|
3495
|
+
]
|
|
3496
|
+
},
|
|
3497
|
+
keyOf(item)
|
|
3498
|
+
);
|
|
3499
|
+
};
|
|
3500
|
+
if (!isCollapsible) {
|
|
3501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3502
|
+
import_react_aria_components29.Breadcrumbs,
|
|
3503
|
+
{
|
|
3504
|
+
className: cx("pire-breadcrumbs", className),
|
|
3505
|
+
style,
|
|
3506
|
+
items,
|
|
3507
|
+
onAction: (key) => onNavigate?.(String(key)),
|
|
3508
|
+
children: (item) => crumb(item)
|
|
3509
|
+
}
|
|
3510
|
+
);
|
|
3511
|
+
}
|
|
3512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref: boxRef, className: cx("pire-breadcrumbs-fit", className), style, children: [
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3514
|
+
import_react_aria_components29.Breadcrumbs,
|
|
3515
|
+
{
|
|
3516
|
+
className: "pire-breadcrumbs",
|
|
3517
|
+
"data-collapsible": "true",
|
|
3518
|
+
onAction: (key) => onNavigate?.(String(key)),
|
|
3519
|
+
children: shown.map(
|
|
3520
|
+
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(React23.Fragment, { children: [
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_aria_components29.Breadcrumb, { className: "pire-breadcrumb", id: "__pire_breadcrumb_more__", children: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_aria_components29.MenuTrigger, { children: [
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components29.Button, { className: "pire-breadcrumb-more", "aria-label": msg.breadcrumbMore, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components29.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Menu, { onAction: (key) => onNavigate?.(String(key)), children: folded.map((step) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuItem, { id: keyOf(step), href: step.href, children: step.label }, keyOf(step))) }) })
|
|
3525
|
+
] }),
|
|
3526
|
+
separator
|
|
3527
|
+
] }),
|
|
3528
|
+
crumb(item)
|
|
3529
|
+
] }, "__more__") : crumb(item)
|
|
3530
|
+
)
|
|
3531
|
+
}
|
|
3532
|
+
),
|
|
3533
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pire-breadcrumbs-measure", "aria-hidden": "true", inert: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { ref: measureRef, className: "pire-breadcrumbs", "data-measure": "true", children: [
|
|
3534
|
+
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3535
|
+
"span",
|
|
3536
|
+
{
|
|
3537
|
+
className: "pire-breadcrumb",
|
|
3538
|
+
"data-step": "true",
|
|
3539
|
+
"data-last": item === last ? "true" : void 0,
|
|
3540
|
+
children: [
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: item.label }),
|
|
3542
|
+
item === last ? null : separator
|
|
3543
|
+
]
|
|
3544
|
+
},
|
|
3545
|
+
keyOf(item)
|
|
3546
|
+
)),
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "pire-breadcrumb", "data-more": "true", children: [
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "pire-breadcrumb-more", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
3549
|
+
separator
|
|
3550
|
+
] })
|
|
3551
|
+
] }) })
|
|
3552
|
+
] });
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
// src/components/navigation/ShellBar.tsx
|
|
3556
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3557
|
+
var initials2 = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
3558
|
+
function ShellBar({
|
|
3559
|
+
launcher,
|
|
3560
|
+
product,
|
|
3561
|
+
monogram,
|
|
3562
|
+
title,
|
|
3563
|
+
breadcrumb,
|
|
3564
|
+
onBreadcrumbNavigate,
|
|
3565
|
+
onMenu,
|
|
3566
|
+
onSearch,
|
|
3567
|
+
menuLabel = "Open navigation",
|
|
3568
|
+
searchLabel = "Search",
|
|
3569
|
+
actions,
|
|
3570
|
+
user,
|
|
3571
|
+
userMenu,
|
|
3572
|
+
userMenuLabel,
|
|
3573
|
+
className,
|
|
3574
|
+
...rest
|
|
3575
|
+
}) {
|
|
3576
|
+
const msg = usePireMessages();
|
|
3577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: cx("pire-shellbar", className), ...rest, children: [
|
|
3578
|
+
launcher,
|
|
3579
|
+
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(IconButton, { icon: "menu", label: menuLabel, variant: "inverse", size: "sm", onPress: onMenu }) : null,
|
|
3580
|
+
monogram ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
|
|
3581
|
+
product ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-product", children: product }) : null,
|
|
3582
|
+
breadcrumb?.length ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("nav", { className: "pire-shellbar-crumbs", "aria-label": msg.breadcrumbLabel, children: [
|
|
3583
|
+
product || monogram ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-sep", "aria-hidden": "true" }) : null,
|
|
3584
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Breadcrumb, { items: breadcrumb, onNavigate: onBreadcrumbNavigate, isCollapsible: true })
|
|
3585
|
+
] }) : null,
|
|
3586
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-title", children: title }) : null,
|
|
3587
|
+
breadcrumb?.length ? null : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellbar-spacer" }),
|
|
3588
|
+
onSearch ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(IconButton, { icon: "search", label: searchLabel, variant: "inverse", size: "sm", onPress: onSearch }) : null,
|
|
3589
|
+
actions,
|
|
3590
|
+
user && userMenu ? (
|
|
3591
|
+
// A real button, not the img-role span: the avatar is where "my profile", "switch company"
|
|
3592
|
+
// and "sign out" live in any ERP, and a span accepts neither focus nor onPress. Popover is
|
|
3593
|
+
// rendered here rather than expected from the consumer so the panel keeps shell placement.
|
|
3594
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_aria_components30.MenuTrigger, { children: [
|
|
3595
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3596
|
+
import_react_aria_components30.Button,
|
|
3597
|
+
{
|
|
3598
|
+
className: "pire-avatar pire-avatar-trigger",
|
|
3599
|
+
"aria-label": (userMenuLabel ?? msg.shellBarUserMenu).replace("{user}", user),
|
|
3600
|
+
children: initials2(user)
|
|
3601
|
+
}
|
|
3602
|
+
),
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_aria_components30.Popover, { className: "pire-popover", children: userMenu })
|
|
3604
|
+
] })
|
|
3605
|
+
) : user ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-avatar", title: user, "aria-label": user, role: "img", children: initials2(user) }) : null
|
|
3606
|
+
] });
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
// src/components/navigation/SideNav.tsx
|
|
3610
|
+
var React24 = __toESM(require("react"), 1);
|
|
3611
|
+
var import_react_aria_components31 = require("react-aria-components");
|
|
3612
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3274
3613
|
function findActiveParent(groups, value) {
|
|
3275
3614
|
if (value == null) return void 0;
|
|
3276
3615
|
for (const group of groups) {
|
|
@@ -3297,10 +3636,10 @@ function SideNav({
|
|
|
3297
3636
|
const msg = usePireMessages();
|
|
3298
3637
|
const activeParent = findActiveParent(groups, value);
|
|
3299
3638
|
const isControlled = expandedIds != null;
|
|
3300
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3639
|
+
const [ownExpanded, setOwnExpanded] = React24.useState(
|
|
3301
3640
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3302
3641
|
);
|
|
3303
|
-
const [lastValue, setLastValue] =
|
|
3642
|
+
const [lastValue, setLastValue] = React24.useState(value);
|
|
3304
3643
|
if (value !== lastValue) {
|
|
3305
3644
|
setLastValue(value);
|
|
3306
3645
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3320,8 +3659,8 @@ function SideNav({
|
|
|
3320
3659
|
};
|
|
3321
3660
|
const renderRow = (item, onPress, isGroup) => {
|
|
3322
3661
|
const selected = !isGroup && item.id === value;
|
|
3323
|
-
const button = /* @__PURE__ */ (0,
|
|
3324
|
-
|
|
3662
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3663
|
+
import_react_aria_components31.Button,
|
|
3325
3664
|
{
|
|
3326
3665
|
className: "pire-sidenav-item",
|
|
3327
3666
|
"data-selected": selected ? "true" : void 0,
|
|
@@ -3330,70 +3669,70 @@ function SideNav({
|
|
|
3330
3669
|
"aria-label": collapsed ? item.label : void 0,
|
|
3331
3670
|
onPress,
|
|
3332
3671
|
children: [
|
|
3333
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
3334
|
-
collapsed ? null : /* @__PURE__ */ (0,
|
|
3335
|
-
item.count != null && !collapsed ? /* @__PURE__ */ (0,
|
|
3672
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3673
|
+
collapsed ? null : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label }),
|
|
3674
|
+
item.count != null && !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "pire-sidenav-count", children: item.count }) : null
|
|
3336
3675
|
]
|
|
3337
3676
|
},
|
|
3338
3677
|
item.id
|
|
3339
3678
|
);
|
|
3340
|
-
return collapsed ? /* @__PURE__ */ (0,
|
|
3679
|
+
return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Tooltip, { label: item.label, placement: "right", children: button }, item.id) : button;
|
|
3341
3680
|
};
|
|
3342
|
-
const renderRailFlyout = (item) => /* @__PURE__ */ (0,
|
|
3343
|
-
/* @__PURE__ */ (0,
|
|
3344
|
-
|
|
3681
|
+
const renderRailFlyout = (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_aria_components31.MenuTrigger, { children: [
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3683
|
+
import_react_aria_components31.Button,
|
|
3345
3684
|
{
|
|
3346
3685
|
className: "pire-sidenav-item",
|
|
3347
3686
|
"aria-label": item.label,
|
|
3348
3687
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3349
|
-
children: item.icon ? /* @__PURE__ */ (0,
|
|
3688
|
+
children: item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: item.icon, size: 16 }) : null
|
|
3350
3689
|
}
|
|
3351
3690
|
),
|
|
3352
|
-
/* @__PURE__ */ (0,
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_aria_components31.Popover, { className: "pire-popover", placement: "right top", offset: 4, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3353
3692
|
Menu,
|
|
3354
3693
|
{
|
|
3355
3694
|
"aria-label": item.label,
|
|
3356
3695
|
className: "pire-sidenav-flyout",
|
|
3357
3696
|
onAction: (key) => onChange?.(String(key)),
|
|
3358
|
-
children: (item.items ?? []).map((child) => /* @__PURE__ */ (0,
|
|
3697
|
+
children: (item.items ?? []).map((child) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(MenuItem, { id: child.id, children: child.label }, child.id))
|
|
3359
3698
|
}
|
|
3360
3699
|
) })
|
|
3361
3700
|
] }, item.id);
|
|
3362
|
-
const renderSection = (item) => /* @__PURE__ */ (0,
|
|
3363
|
-
/* @__PURE__ */ (0,
|
|
3364
|
-
|
|
3701
|
+
const renderSection = (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_aria_components31.Disclosure, { id: item.id, className: "pire-sidenav-section", children: [
|
|
3702
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3703
|
+
import_react_aria_components31.Button,
|
|
3365
3704
|
{
|
|
3366
3705
|
slot: "trigger",
|
|
3367
3706
|
className: "pire-sidenav-item",
|
|
3368
3707
|
"data-kind": "group",
|
|
3369
3708
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3370
3709
|
children: [
|
|
3371
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
3372
|
-
/* @__PURE__ */ (0,
|
|
3373
|
-
item.count != null ? /* @__PURE__ */ (0,
|
|
3374
|
-
/* @__PURE__ */ (0,
|
|
3710
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: item.label }),
|
|
3712
|
+
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "pire-sidenav-count", children: item.count }) : null,
|
|
3713
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: "chevron-down", size: 16, className: "pire-sidenav-chevron" })
|
|
3375
3714
|
]
|
|
3376
3715
|
}
|
|
3377
3716
|
),
|
|
3378
|
-
/* @__PURE__ */ (0,
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_aria_components31.DisclosurePanel, { className: "pire-sidenav-subnav", children: item.items?.map((child) => {
|
|
3379
3718
|
const selected = child.id === value;
|
|
3380
|
-
return /* @__PURE__ */ (0,
|
|
3381
|
-
|
|
3719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3720
|
+
import_react_aria_components31.Button,
|
|
3382
3721
|
{
|
|
3383
3722
|
className: "pire-sidenav-item pire-sidenav-subitem",
|
|
3384
3723
|
"data-selected": selected ? "true" : void 0,
|
|
3385
3724
|
"aria-current": selected ? "page" : void 0,
|
|
3386
3725
|
onPress: () => onChange?.(child.id),
|
|
3387
3726
|
children: [
|
|
3388
|
-
/* @__PURE__ */ (0,
|
|
3389
|
-
child.count != null ? /* @__PURE__ */ (0,
|
|
3727
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: child.label }),
|
|
3728
|
+
child.count != null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "pire-sidenav-count", children: child.count }) : null
|
|
3390
3729
|
]
|
|
3391
3730
|
},
|
|
3392
3731
|
child.id
|
|
3393
3732
|
);
|
|
3394
3733
|
}) })
|
|
3395
3734
|
] }, item.id);
|
|
3396
|
-
return /* @__PURE__ */ (0,
|
|
3735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3397
3736
|
"nav",
|
|
3398
3737
|
{
|
|
3399
3738
|
className: cx("pire-sidenav", className),
|
|
@@ -3410,10 +3749,10 @@ function SideNav({
|
|
|
3410
3749
|
if (isGroup && collapsed && railFlyout) return renderRailFlyout(item);
|
|
3411
3750
|
return renderRow(item, () => isGroup ? toggleExpanded(item.id) : onChange?.(item.id), isGroup);
|
|
3412
3751
|
});
|
|
3413
|
-
return /* @__PURE__ */ (0,
|
|
3414
|
-
group.label && !collapsed ? /* @__PURE__ */ (0,
|
|
3415
|
-
hasSections ? /* @__PURE__ */ (0,
|
|
3416
|
-
|
|
3752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "pire-sidenav-group", children: [
|
|
3753
|
+
group.label && !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "pire-sidenav-label", children: group.label }) : null,
|
|
3754
|
+
hasSections ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3755
|
+
import_react_aria_components31.DisclosureGroup,
|
|
3417
3756
|
{
|
|
3418
3757
|
className: "pire-sidenav-tree",
|
|
3419
3758
|
allowsMultipleExpanded: true,
|
|
@@ -3424,44 +3763,44 @@ function SideNav({
|
|
|
3424
3763
|
) : rows
|
|
3425
3764
|
] }, group.label ?? gi);
|
|
3426
3765
|
}),
|
|
3427
|
-
footer ? /* @__PURE__ */ (0,
|
|
3766
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "pire-sidenav-footer", children: footer }) : null
|
|
3428
3767
|
]
|
|
3429
3768
|
}
|
|
3430
3769
|
);
|
|
3431
3770
|
}
|
|
3432
3771
|
|
|
3433
3772
|
// src/components/navigation/ShellRail.tsx
|
|
3434
|
-
var
|
|
3435
|
-
var
|
|
3436
|
-
var
|
|
3773
|
+
var React25 = __toESM(require("react"), 1);
|
|
3774
|
+
var import_react_aria_components32 = require("react-aria-components");
|
|
3775
|
+
var import_jsx_runtime45 = (
|
|
3437
3776
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
3438
3777
|
// scrolling zone would carry its own rule out of view on the first wheel event.
|
|
3439
3778
|
require("react/jsx-runtime")
|
|
3440
3779
|
);
|
|
3441
3780
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
3442
3781
|
const msg = usePireMessages();
|
|
3443
|
-
return /* @__PURE__ */ (0,
|
|
3444
|
-
gi > 0 ? /* @__PURE__ */ (0,
|
|
3445
|
-
/* @__PURE__ */ (0,
|
|
3446
|
-
|
|
3782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(React25.Fragment, { children: [
|
|
3783
|
+
gi > 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pire-shellrail-divider" }) : null,
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3785
|
+
import_react_aria_components32.Button,
|
|
3447
3786
|
{
|
|
3448
3787
|
className: "pire-shellrail-item",
|
|
3449
3788
|
"aria-label": item.label,
|
|
3450
3789
|
"data-selected": item.id === value ? "true" : void 0,
|
|
3451
3790
|
"aria-current": item.id === value ? "true" : void 0,
|
|
3452
3791
|
onPress: () => onChange?.(item.id),
|
|
3453
|
-
children: /* @__PURE__ */ (0,
|
|
3792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "pire-shellrail-tile", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: item.icon, size: 20 }) })
|
|
3454
3793
|
}
|
|
3455
3794
|
) }, item.id)) })
|
|
3456
3795
|
] }, group.items[0]?.id ?? gi)) });
|
|
3457
3796
|
}
|
|
3458
3797
|
|
|
3459
3798
|
// src/components/navigation/Tabs.tsx
|
|
3460
|
-
var
|
|
3461
|
-
var
|
|
3799
|
+
var import_react_aria_components33 = require("react-aria-components");
|
|
3800
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3462
3801
|
function Tabs({ items, value, defaultValue, onChange, panels, className, style, ...rest }) {
|
|
3463
|
-
return /* @__PURE__ */ (0,
|
|
3464
|
-
|
|
3802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3803
|
+
import_react_aria_components33.Tabs,
|
|
3465
3804
|
{
|
|
3466
3805
|
className,
|
|
3467
3806
|
style,
|
|
@@ -3469,41 +3808,19 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
|
|
|
3469
3808
|
defaultSelectedKey: defaultValue,
|
|
3470
3809
|
onSelectionChange: (k) => onChange?.(String(k)),
|
|
3471
3810
|
children: [
|
|
3472
|
-
/* @__PURE__ */ (0,
|
|
3473
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components33.TabList, { className: "pire-tablist", items, "aria-label": rest["aria-label"] ?? "Views", children: (item) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react_aria_components33.Tab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
|
|
3812
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3474
3813
|
item.label,
|
|
3475
|
-
item.count != null ? /* @__PURE__ */ (0,
|
|
3814
|
+
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "pire-tab-count", children: item.count }) : null
|
|
3476
3815
|
] }) }),
|
|
3477
|
-
items.map((item) => /* @__PURE__ */ (0,
|
|
3816
|
+
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_aria_components33.TabPanel, { id: item.id, className: panels ? "pire-tabpanel" : void 0, children: panels?.[item.id] }, item.id))
|
|
3478
3817
|
]
|
|
3479
3818
|
}
|
|
3480
3819
|
);
|
|
3481
3820
|
}
|
|
3482
3821
|
|
|
3483
|
-
// src/components/navigation/Breadcrumb.tsx
|
|
3484
|
-
var import_react_aria_components33 = require("react-aria-components");
|
|
3485
|
-
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3486
|
-
function Breadcrumb({ items, onNavigate, className, style }) {
|
|
3487
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3488
|
-
import_react_aria_components33.Breadcrumbs,
|
|
3489
|
-
{
|
|
3490
|
-
className: cx("pire-breadcrumbs", className),
|
|
3491
|
-
style,
|
|
3492
|
-
items,
|
|
3493
|
-
onAction: (key) => onNavigate?.(String(key)),
|
|
3494
|
-
children: (item) => {
|
|
3495
|
-
const last = items[items.length - 1] === item;
|
|
3496
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_aria_components33.Breadcrumb, { className: "pire-breadcrumb", id: item.id ?? item.label, children: [
|
|
3497
|
-
last ? item.label : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_aria_components33.Link, { href: item.href, children: item.label }),
|
|
3498
|
-
last ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "chevron-right", size: 12, style: { color: "var(--text-tertiary)" } })
|
|
3499
|
-
] });
|
|
3500
|
-
}
|
|
3501
|
-
}
|
|
3502
|
-
);
|
|
3503
|
-
}
|
|
3504
|
-
|
|
3505
3822
|
// src/components/navigation/Pagination.tsx
|
|
3506
|
-
var
|
|
3823
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3507
3824
|
function Pagination({
|
|
3508
3825
|
page = 1,
|
|
3509
3826
|
pageSize = 25,
|
|
@@ -3518,9 +3835,9 @@ function Pagination({
|
|
|
3518
3835
|
const pages = Math.max(1, Math.ceil(total / pageSize));
|
|
3519
3836
|
const from = total === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
3520
3837
|
const to = Math.min(total, page * pageSize);
|
|
3521
|
-
return /* @__PURE__ */ (0,
|
|
3522
|
-
/* @__PURE__ */ (0,
|
|
3523
|
-
/* @__PURE__ */ (0,
|
|
3838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("nav", { className: cx("pire-pagination", className), style, "aria-label": msg.paginationLabel, children: [
|
|
3839
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "pire-pagination-count", children: msg.paginationRange.replace("{from}", from.toLocaleString()).replace("{to}", to.toLocaleString()).replace("{total}", total.toLocaleString()) }),
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3524
3841
|
IconButton,
|
|
3525
3842
|
{
|
|
3526
3843
|
icon: "chevron-left",
|
|
@@ -3531,8 +3848,8 @@ function Pagination({
|
|
|
3531
3848
|
onPress: () => onPageChange?.(page - 1)
|
|
3532
3849
|
}
|
|
3533
3850
|
),
|
|
3534
|
-
/* @__PURE__ */ (0,
|
|
3535
|
-
/* @__PURE__ */ (0,
|
|
3851
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "pire-pagination-count", "aria-live": "polite", children: msg.paginationPageOf.replace("{page}", String(page)).replace("{pages}", String(pages)) }),
|
|
3852
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3536
3853
|
IconButton,
|
|
3537
3854
|
{
|
|
3538
3855
|
icon: "chevron-right",
|
|
@@ -3543,7 +3860,7 @@ function Pagination({
|
|
|
3543
3860
|
onPress: () => onPageChange?.(page + 1)
|
|
3544
3861
|
}
|
|
3545
3862
|
),
|
|
3546
|
-
onPageSizeChange ? /* @__PURE__ */ (0,
|
|
3863
|
+
onPageSizeChange ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3547
3864
|
Select,
|
|
3548
3865
|
{
|
|
3549
3866
|
"aria-label": msg.paginationRowsPerPage,
|
|
@@ -3559,9 +3876,13 @@ function Pagination({
|
|
|
3559
3876
|
}
|
|
3560
3877
|
|
|
3561
3878
|
// src/components/navigation/Ribbon.tsx
|
|
3562
|
-
var
|
|
3879
|
+
var React26 = __toESM(require("react"), 1);
|
|
3563
3880
|
var import_react_aria_components34 = require("react-aria-components");
|
|
3564
|
-
var
|
|
3881
|
+
var import_jsx_runtime48 = (
|
|
3882
|
+
// The tile is a column with no room for a third line under a two-line caption, and a mark
|
|
3883
|
+
// pinned to its corner lands on the icon. Beside the icon is the one place it fits.
|
|
3884
|
+
require("react/jsx-runtime")
|
|
3885
|
+
);
|
|
3565
3886
|
var outside = (what, parent) => {
|
|
3566
3887
|
const Config = () => {
|
|
3567
3888
|
throw new Error(`[pire] ${what} must be a child of ${parent}.`);
|
|
@@ -3575,7 +3896,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
3575
3896
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
3576
3897
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
3577
3898
|
function describe(child) {
|
|
3578
|
-
if (!
|
|
3899
|
+
if (!React26.isValidElement(child)) return JSON.stringify(child);
|
|
3579
3900
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
3580
3901
|
const type = child.type;
|
|
3581
3902
|
return type?.displayName || type?.name || "a component";
|
|
@@ -3583,13 +3904,13 @@ function describe(child) {
|
|
|
3583
3904
|
function childrenOfType(children, type, what, parent) {
|
|
3584
3905
|
const out = [];
|
|
3585
3906
|
const walk = (nodes, path) => {
|
|
3586
|
-
|
|
3907
|
+
React26.Children.forEach(nodes, (child, i) => {
|
|
3587
3908
|
if (child == null || typeof child === "boolean") return;
|
|
3588
|
-
if (
|
|
3909
|
+
if (React26.isValidElement(child) && child.type === React26.Fragment) {
|
|
3589
3910
|
return walk(child.props.children, `${path}${i}.`);
|
|
3590
3911
|
}
|
|
3591
|
-
if (!
|
|
3592
|
-
const isWrapper =
|
|
3912
|
+
if (!React26.isValidElement(child) || child.type !== type) {
|
|
3913
|
+
const isWrapper = React26.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
3593
3914
|
throw new Error(
|
|
3594
3915
|
`[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.` : "")
|
|
3595
3916
|
);
|
|
@@ -3621,37 +3942,50 @@ function Command({
|
|
|
3621
3942
|
selectionCount,
|
|
3622
3943
|
inBar
|
|
3623
3944
|
}) {
|
|
3624
|
-
const size = inBar ? "sm" : command.size ?? "sm";
|
|
3625
|
-
const
|
|
3626
|
-
|
|
3945
|
+
const size = inBar ? "sm" : command.isPrimary ? "lg" : command.size ?? "sm";
|
|
3946
|
+
const msg = usePireMessages();
|
|
3947
|
+
const comingSoon = command.isComingSoon === true;
|
|
3948
|
+
const isDisabled = !comingSoon && (command.isDisabled || command.requiresSelection === true && selectionCount === 0);
|
|
3949
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3627
3950
|
import_react_aria_components34.Button,
|
|
3628
3951
|
{
|
|
3629
3952
|
className: "pire-ribbon-command",
|
|
3630
3953
|
"data-size": size,
|
|
3954
|
+
"data-primary": command.isPrimary ? "true" : void 0,
|
|
3631
3955
|
isDisabled,
|
|
3632
3956
|
onPress: command.onPress,
|
|
3957
|
+
...comingSoon ? comingSoonProps(command.label, msg.comingSoon) : {},
|
|
3633
3958
|
children: [
|
|
3634
|
-
|
|
3635
|
-
|
|
3959
|
+
comingSoon && size === "lg" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "pire-ribbon-command-head", children: [
|
|
3960
|
+
command.icon ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: command.icon, size: 20 }) : null,
|
|
3961
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ComingSoonMark, { announce: false })
|
|
3962
|
+
] }) : command.icon ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: command.icon, size: size === "lg" ? 20 : 16 }) : null,
|
|
3963
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pire-ribbon-command-label", children: command.label }),
|
|
3964
|
+
comingSoon && size !== "lg" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ComingSoonMark, { announce: false }) : null
|
|
3636
3965
|
]
|
|
3637
3966
|
}
|
|
3638
3967
|
);
|
|
3968
|
+
return command.tooltip ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Tooltip, { label: command.tooltip, children: button }) : button;
|
|
3639
3969
|
}
|
|
3640
3970
|
function Group8({ group, selectionCount }) {
|
|
3641
|
-
const
|
|
3642
|
-
const
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3971
|
+
const isLarge = (c) => c.isPrimary || (c.size ?? "sm") === "lg";
|
|
3972
|
+
const large = [
|
|
3973
|
+
...group.commands.filter((c) => c.isPrimary),
|
|
3974
|
+
...group.commands.filter((c) => !c.isPrimary && isLarge(c))
|
|
3975
|
+
];
|
|
3976
|
+
const small = group.commands.filter((c) => !isLarge(c));
|
|
3977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "pire-ribbon-group", role: "group", "aria-label": group.caption, children: [
|
|
3978
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "pire-ribbon-group-body", children: [
|
|
3979
|
+
large.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Command, { command: c, selectionCount }, c.key)),
|
|
3980
|
+
small.length ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-stack", children: small.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Command, { command: c, selectionCount }, c.key)) }) : null
|
|
3647
3981
|
] }),
|
|
3648
|
-
/* @__PURE__ */ (0,
|
|
3982
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-caption", "aria-hidden": "true", children: group.caption })
|
|
3649
3983
|
] });
|
|
3650
3984
|
}
|
|
3651
3985
|
function useTrailingOverflow() {
|
|
3652
|
-
const ref =
|
|
3653
|
-
const [overflow, setOverflow] =
|
|
3654
|
-
|
|
3986
|
+
const ref = React26.useRef(null);
|
|
3987
|
+
const [overflow, setOverflow] = React26.useState(false);
|
|
3988
|
+
React26.useEffect(() => {
|
|
3655
3989
|
const node = ref.current;
|
|
3656
3990
|
if (!node) return;
|
|
3657
3991
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -3676,9 +4010,9 @@ function Surface({
|
|
|
3676
4010
|
}) {
|
|
3677
4011
|
const [scrollRef, overflow] = useTrailingOverflow();
|
|
3678
4012
|
const domId = id ? { id } : {};
|
|
3679
|
-
return /* @__PURE__ */ (0,
|
|
3680
|
-
/* @__PURE__ */ (0,
|
|
3681
|
-
/* @__PURE__ */ (0,
|
|
4013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_aria_components34.Toolbar, { ...domId, className, "aria-label": label, children: [
|
|
4014
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-scroll", ref: scrollRef, children }),
|
|
4015
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-trail", "data-overflow": overflow ? "true" : void 0, children: trailing })
|
|
3682
4016
|
] });
|
|
3683
4017
|
}
|
|
3684
4018
|
function barBlocks(tabs) {
|
|
@@ -3686,12 +4020,15 @@ function barBlocks(tabs) {
|
|
|
3686
4020
|
for (const tab of tabs) {
|
|
3687
4021
|
if (tab.isContextual) continue;
|
|
3688
4022
|
for (const group of tab.groups) {
|
|
3689
|
-
const commands = group.commands.filter((c) => c.inBar);
|
|
4023
|
+
const commands = group.commands.filter((c) => c.inBar && !c.isPrimary);
|
|
3690
4024
|
if (commands.length) blocks.push({ key: `${tab.key}:${group.key}`, commands });
|
|
3691
4025
|
}
|
|
3692
4026
|
}
|
|
3693
4027
|
return blocks;
|
|
3694
4028
|
}
|
|
4029
|
+
function barPrimaries(tabs) {
|
|
4030
|
+
return tabs.filter((tab) => !tab.isContextual).flatMap((tab) => tab.groups.flatMap((group) => group.commands.filter((c) => c.isPrimary)));
|
|
4031
|
+
}
|
|
3695
4032
|
function Ribbon({
|
|
3696
4033
|
children,
|
|
3697
4034
|
value,
|
|
@@ -3711,18 +4048,18 @@ function Ribbon({
|
|
|
3711
4048
|
const count = selectionCount ?? 0;
|
|
3712
4049
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
3713
4050
|
const fallback = visible[0]?.id;
|
|
3714
|
-
const [ownTab, setOwnTab] =
|
|
4051
|
+
const [ownTab, setOwnTab] = React26.useState(defaultValue);
|
|
3715
4052
|
const requested = value ?? ownTab;
|
|
3716
4053
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
3717
|
-
const select =
|
|
4054
|
+
const select = React26.useCallback(
|
|
3718
4055
|
(id) => {
|
|
3719
4056
|
setOwnTab(id);
|
|
3720
4057
|
onChange?.(id);
|
|
3721
4058
|
},
|
|
3722
4059
|
[onChange]
|
|
3723
4060
|
);
|
|
3724
|
-
const hadSelection =
|
|
3725
|
-
|
|
4061
|
+
const hadSelection = React26.useRef(false);
|
|
4062
|
+
React26.useEffect(() => {
|
|
3726
4063
|
const has = count > 0;
|
|
3727
4064
|
if (has === hadSelection.current) return;
|
|
3728
4065
|
hadSelection.current = has;
|
|
@@ -3731,17 +4068,17 @@ function Ribbon({
|
|
|
3731
4068
|
if (has) select(contextual.id);
|
|
3732
4069
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
3733
4070
|
}, [count, tabs, requested, select]);
|
|
3734
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
4071
|
+
const [ownCollapsed, setOwnCollapsed] = React26.useState(false);
|
|
3735
4072
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
3736
|
-
const toggleRef =
|
|
3737
|
-
const restoreFocus =
|
|
3738
|
-
|
|
4073
|
+
const toggleRef = React26.useRef(null);
|
|
4074
|
+
const restoreFocus = React26.useRef(false);
|
|
4075
|
+
React26.useLayoutEffect(() => {
|
|
3739
4076
|
if (!restoreFocus.current) return;
|
|
3740
4077
|
restoreFocus.current = false;
|
|
3741
4078
|
toggleRef.current?.focus();
|
|
3742
4079
|
});
|
|
3743
|
-
const bandId =
|
|
3744
|
-
const toggle = /* @__PURE__ */ (0,
|
|
4080
|
+
const bandId = React26.useId();
|
|
4081
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3745
4082
|
import_react_aria_components34.Button,
|
|
3746
4083
|
{
|
|
3747
4084
|
ref: toggleRef,
|
|
@@ -3754,32 +4091,34 @@ function Ribbon({
|
|
|
3754
4091
|
setOwnCollapsed(!collapsed);
|
|
3755
4092
|
onCollapsedChange?.(!collapsed);
|
|
3756
4093
|
},
|
|
3757
|
-
children: /* @__PURE__ */ (0,
|
|
4094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: collapsed ? "chevron-down" : "chevron-up", size: 16 })
|
|
3758
4095
|
}
|
|
3759
4096
|
);
|
|
3760
4097
|
if (collapsed) {
|
|
3761
4098
|
const blocks = barBlocks(tabs);
|
|
3762
|
-
|
|
4099
|
+
const primaries = barPrimaries(tabs);
|
|
4100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3763
4101
|
Surface,
|
|
3764
4102
|
{
|
|
3765
4103
|
className: "pire-ribbon-bar",
|
|
3766
4104
|
label: rest["aria-label"],
|
|
3767
|
-
trailing: /* @__PURE__ */ (0,
|
|
4105
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3768
4106
|
actions,
|
|
3769
4107
|
toggle
|
|
3770
4108
|
] }),
|
|
3771
4109
|
children: [
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
4110
|
+
primaries.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key)),
|
|
4111
|
+
leading ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
4112
|
+
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(React26.Fragment, { children: [
|
|
4113
|
+
i > 0 || leading || primaries.length ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
4114
|
+
block.commands.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
3776
4115
|
] }, block.key))
|
|
3777
4116
|
]
|
|
3778
4117
|
}
|
|
3779
4118
|
) });
|
|
3780
4119
|
}
|
|
3781
|
-
return /* @__PURE__ */ (0,
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
4120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_aria_components34.Tabs, { selectedKey: selected, onSelectionChange: (k) => select(String(k)), children: [
|
|
4121
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components34.TabList, { className: "pire-ribbon-tablist", "aria-label": rest["aria-label"], children: visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3783
4122
|
import_react_aria_components34.Tab,
|
|
3784
4123
|
{
|
|
3785
4124
|
id: tab.id,
|
|
@@ -3789,17 +4128,17 @@ function Ribbon({
|
|
|
3789
4128
|
},
|
|
3790
4129
|
tab.key
|
|
3791
4130
|
)) }),
|
|
3792
|
-
visible.map((tab) => /* @__PURE__ */ (0,
|
|
4131
|
+
visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_aria_components34.TabPanel, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3793
4132
|
Surface,
|
|
3794
4133
|
{
|
|
3795
4134
|
id: bandId,
|
|
3796
4135
|
className: "pire-ribbon-band",
|
|
3797
4136
|
label: msg.ribbonLabel,
|
|
3798
|
-
trailing: /* @__PURE__ */ (0,
|
|
4137
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3799
4138
|
actions,
|
|
3800
4139
|
toggle
|
|
3801
4140
|
] }),
|
|
3802
|
-
children: tab.groups.map((group) => /* @__PURE__ */ (0,
|
|
4141
|
+
children: tab.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Group8, { group, selectionCount: count }, group.key))
|
|
3803
4142
|
}
|
|
3804
4143
|
) }, tab.key))
|
|
3805
4144
|
] }) });
|
|
@@ -3809,7 +4148,7 @@ Ribbon.Group = RibbonGroup;
|
|
|
3809
4148
|
Ribbon.Command = RibbonCommand;
|
|
3810
4149
|
|
|
3811
4150
|
// src/components/feedback/InlineMessage.tsx
|
|
3812
|
-
var
|
|
4151
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3813
4152
|
var KIND_ICON = {
|
|
3814
4153
|
info: "info",
|
|
3815
4154
|
success: "check-circle-2",
|
|
@@ -3827,7 +4166,7 @@ function InlineMessage({
|
|
|
3827
4166
|
}) {
|
|
3828
4167
|
const msg = usePireMessages();
|
|
3829
4168
|
const assertive = kind === "error" || kind === "warning";
|
|
3830
|
-
return /* @__PURE__ */ (0,
|
|
4169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3831
4170
|
"div",
|
|
3832
4171
|
{
|
|
3833
4172
|
className: cx("pire-msg", className),
|
|
@@ -3836,21 +4175,21 @@ function InlineMessage({
|
|
|
3836
4175
|
"aria-live": assertive ? "assertive" : "polite",
|
|
3837
4176
|
...rest,
|
|
3838
4177
|
children: [
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
3840
|
-
/* @__PURE__ */ (0,
|
|
3841
|
-
title ? /* @__PURE__ */ (0,
|
|
3842
|
-
children ? /* @__PURE__ */ (0,
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { name: KIND_ICON[kind], size: 16, style: { marginTop: 2 } }),
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "var(--sp-1)" }, children: [
|
|
4180
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "pire-msg-title", children: title }) : null,
|
|
4181
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "pire-msg-body", children }) : null,
|
|
3843
4182
|
action
|
|
3844
4183
|
] }),
|
|
3845
|
-
onClose ? /* @__PURE__ */ (0,
|
|
4184
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(IconButton, { icon: "x", label: msg.inlineMessageDismiss, size: "sm", onPress: onClose }) : null
|
|
3846
4185
|
]
|
|
3847
4186
|
}
|
|
3848
4187
|
);
|
|
3849
4188
|
}
|
|
3850
4189
|
|
|
3851
4190
|
// src/components/feedback/Toast.tsx
|
|
3852
|
-
var
|
|
3853
|
-
var
|
|
4191
|
+
var React27 = __toESM(require("react"), 1);
|
|
4192
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3854
4193
|
var KIND_ICON2 = {
|
|
3855
4194
|
info: "info",
|
|
3856
4195
|
success: "check-circle-2",
|
|
@@ -3866,7 +4205,7 @@ function Toast({
|
|
|
3866
4205
|
...rest
|
|
3867
4206
|
}) {
|
|
3868
4207
|
const msg = usePireMessages();
|
|
3869
|
-
return /* @__PURE__ */ (0,
|
|
4208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
3870
4209
|
"div",
|
|
3871
4210
|
{
|
|
3872
4211
|
className: cx("pire-toast", className),
|
|
@@ -3875,22 +4214,22 @@ function Toast({
|
|
|
3875
4214
|
"aria-live": kind === "error" ? "assertive" : "polite",
|
|
3876
4215
|
...rest,
|
|
3877
4216
|
children: [
|
|
3878
|
-
/* @__PURE__ */ (0,
|
|
3879
|
-
/* @__PURE__ */ (0,
|
|
3880
|
-
onClose ? /* @__PURE__ */ (0,
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Icon, { name: KIND_ICON2[kind], size: 16 }),
|
|
4218
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { style: { flex: 1 }, children }),
|
|
4219
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(IconButton, { icon: "x", label: msg.toastDismiss, size: "sm", variant: "inverse", onPress: onClose }) : null
|
|
3881
4220
|
]
|
|
3882
4221
|
}
|
|
3883
4222
|
);
|
|
3884
4223
|
}
|
|
3885
|
-
var ToastContext =
|
|
4224
|
+
var ToastContext = React27.createContext(null);
|
|
3886
4225
|
function ToastProvider({
|
|
3887
4226
|
children,
|
|
3888
4227
|
timeout = 6e3
|
|
3889
4228
|
}) {
|
|
3890
4229
|
const msg = usePireMessages();
|
|
3891
|
-
const [toasts, setToasts] =
|
|
3892
|
-
const close =
|
|
3893
|
-
const add =
|
|
4230
|
+
const [toasts, setToasts] = React27.useState([]);
|
|
4231
|
+
const close = React27.useCallback((id) => setToasts((t) => t.filter((x) => x.id !== id)), []);
|
|
4232
|
+
const add = React27.useCallback(
|
|
3894
4233
|
(toast) => {
|
|
3895
4234
|
const id = Math.random().toString(36).slice(2);
|
|
3896
4235
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
@@ -3900,10 +4239,10 @@ function ToastProvider({
|
|
|
3900
4239
|
},
|
|
3901
4240
|
[close, timeout]
|
|
3902
4241
|
);
|
|
3903
|
-
const value =
|
|
3904
|
-
return /* @__PURE__ */ (0,
|
|
4242
|
+
const value = React27.useMemo(() => ({ add, close }), [add, close]);
|
|
4243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ToastContext.Provider, { value, children: [
|
|
3905
4244
|
children,
|
|
3906
|
-
/* @__PURE__ */ (0,
|
|
4245
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3907
4246
|
Toast,
|
|
3908
4247
|
{
|
|
3909
4248
|
kind: t.kind,
|
|
@@ -3916,14 +4255,14 @@ function ToastProvider({
|
|
|
3916
4255
|
] });
|
|
3917
4256
|
}
|
|
3918
4257
|
function useToast() {
|
|
3919
|
-
const ctx =
|
|
4258
|
+
const ctx = React27.useContext(ToastContext);
|
|
3920
4259
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
3921
4260
|
return ctx;
|
|
3922
4261
|
}
|
|
3923
4262
|
|
|
3924
4263
|
// src/components/data/KpiTile.tsx
|
|
3925
4264
|
var import_react_aria_components35 = require("react-aria-components");
|
|
3926
|
-
var
|
|
4265
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3927
4266
|
function KpiTile({
|
|
3928
4267
|
label,
|
|
3929
4268
|
value,
|
|
@@ -3939,27 +4278,27 @@ function KpiTile({
|
|
|
3939
4278
|
style
|
|
3940
4279
|
}) {
|
|
3941
4280
|
const tone = deltaTone ?? (deltaDirection === "down" ? "negative" : "positive");
|
|
3942
|
-
const body = /* @__PURE__ */ (0,
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
3944
|
-
icon ? /* @__PURE__ */ (0,
|
|
4281
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "pire-kpi-label", children: [
|
|
4283
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon, { name: icon, size: 16 }) : null,
|
|
3945
4284
|
label
|
|
3946
4285
|
] }),
|
|
3947
|
-
/* @__PURE__ */ (0,
|
|
4286
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "pire-kpi-value", children: [
|
|
3948
4287
|
value,
|
|
3949
|
-
unit ? /* @__PURE__ */ (0,
|
|
4288
|
+
unit ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "pire-kpi-unit", children: unit }) : null
|
|
3950
4289
|
] }),
|
|
3951
|
-
delta ? /* @__PURE__ */ (0,
|
|
3952
|
-
deltaDirection ? /* @__PURE__ */ (0,
|
|
4290
|
+
delta ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "pire-kpi-delta", "data-tone": tone, children: [
|
|
4291
|
+
deltaDirection ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon, { name: deltaDirection === "up" ? "trending-up" : "trending-down", size: 12 }) : null,
|
|
3953
4292
|
delta
|
|
3954
4293
|
] }) : null,
|
|
3955
|
-
footnote ? /* @__PURE__ */ (0,
|
|
4294
|
+
footnote ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "pire-kpi-foot", children: footnote }) : null
|
|
3956
4295
|
] });
|
|
3957
4296
|
const props = { className: cx("pire-kpi", className), "data-status": status, style };
|
|
3958
|
-
return onPress ? /* @__PURE__ */ (0,
|
|
4297
|
+
return onPress ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_aria_components35.Button, { ...props, "data-pressable": "true", onPress, children: body }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { ...props, children: body });
|
|
3959
4298
|
}
|
|
3960
4299
|
|
|
3961
4300
|
// src/components/data/ObjectHeader.tsx
|
|
3962
|
-
var
|
|
4301
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3963
4302
|
function ObjectHeader({
|
|
3964
4303
|
title,
|
|
3965
4304
|
subtitle,
|
|
@@ -3971,22 +4310,22 @@ function ObjectHeader({
|
|
|
3971
4310
|
className,
|
|
3972
4311
|
...rest
|
|
3973
4312
|
}) {
|
|
3974
|
-
return /* @__PURE__ */ (0,
|
|
4313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("header", { className: cx("pire-objheader", className), ...rest, children: [
|
|
3975
4314
|
breadcrumb,
|
|
3976
|
-
/* @__PURE__ */ (0,
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3979
|
-
subtitle || id ? /* @__PURE__ */ (0,
|
|
4315
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "pire-objheader-row", children: [
|
|
4316
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h1", { className: "pire-objheader-title", children: title }),
|
|
4318
|
+
subtitle || id ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "pire-objheader-sub", children: [
|
|
3980
4319
|
subtitle,
|
|
3981
|
-
id ? /* @__PURE__ */ (0,
|
|
4320
|
+
id ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "pire-objheader-id", children: id }) : null
|
|
3982
4321
|
] }) : null
|
|
3983
4322
|
] }),
|
|
3984
4323
|
badge,
|
|
3985
|
-
actions ? /* @__PURE__ */ (0,
|
|
4324
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "pire-objheader-actions", children: actions }) : null
|
|
3986
4325
|
] }),
|
|
3987
|
-
facts?.length ? /* @__PURE__ */ (0,
|
|
3988
|
-
/* @__PURE__ */ (0,
|
|
3989
|
-
/* @__PURE__ */ (0,
|
|
4326
|
+
facts?.length ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("dl", { className: "pire-facts", style: { margin: 0 }, children: facts.map((fact) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { children: [
|
|
4327
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("dt", { className: "pire-fact-label", children: fact.label }),
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3990
4329
|
"dd",
|
|
3991
4330
|
{
|
|
3992
4331
|
className: "pire-fact-value",
|
|
@@ -4000,7 +4339,7 @@ function ObjectHeader({
|
|
|
4000
4339
|
}
|
|
4001
4340
|
|
|
4002
4341
|
// src/components/data/FilterBar.tsx
|
|
4003
|
-
var
|
|
4342
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4004
4343
|
function FilterBar({
|
|
4005
4344
|
children,
|
|
4006
4345
|
activeFilters = [],
|
|
@@ -4017,22 +4356,22 @@ function FilterBar({
|
|
|
4017
4356
|
const label = useMessage("filterBarLabel", rest["aria-label"]);
|
|
4018
4357
|
const go = useMessage("filterBarGo", goLabel);
|
|
4019
4358
|
const clearAll = useMessage("filterBarClearAll", clearAllLabel);
|
|
4020
|
-
return /* @__PURE__ */ (0,
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: cx("pire-filterbar", className), ...rest, "aria-label": label, children: [
|
|
4360
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "pire-filterbar-controls", children: [
|
|
4022
4361
|
children,
|
|
4023
|
-
onGo ? /* @__PURE__ */ (0,
|
|
4362
|
+
onGo ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { variant: "primary", onPress: onGo, children: go }) : null
|
|
4024
4363
|
] }),
|
|
4025
|
-
activeFilters.length || resultLabel || actions ? /* @__PURE__ */ (0,
|
|
4026
|
-
activeFilters.map((filter) => /* @__PURE__ */ (0,
|
|
4027
|
-
activeFilters.length && onClear ? /* @__PURE__ */ (0,
|
|
4028
|
-
resultLabel ? /* @__PURE__ */ (0,
|
|
4029
|
-
actions ? /* @__PURE__ */ (0,
|
|
4364
|
+
activeFilters.length || resultLabel || actions ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "pire-filterbar-foot", children: [
|
|
4365
|
+
activeFilters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Tag, { onRemove: onRemoveFilter ? () => onRemoveFilter(filter.id) : void 0, children: filter.label }, filter.id)),
|
|
4366
|
+
activeFilters.length && onClear ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Button, { variant: "tertiary", size: "sm", onPress: onClear, children: clearAll }) : null,
|
|
4367
|
+
resultLabel ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "pire-filterbar-result", "aria-live": "polite", children: resultLabel }) : null,
|
|
4368
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "pire-filterbar-actions", children: actions }) : null
|
|
4030
4369
|
] }) : null
|
|
4031
4370
|
] });
|
|
4032
4371
|
}
|
|
4033
4372
|
|
|
4034
4373
|
// src/components/data/DescriptionList.tsx
|
|
4035
|
-
var
|
|
4374
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4036
4375
|
function DescriptionList({
|
|
4037
4376
|
items,
|
|
4038
4377
|
layout = "rows",
|
|
@@ -4041,32 +4380,32 @@ function DescriptionList({
|
|
|
4041
4380
|
style,
|
|
4042
4381
|
...rest
|
|
4043
4382
|
}) {
|
|
4044
|
-
return /* @__PURE__ */ (0,
|
|
4383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4045
4384
|
"dl",
|
|
4046
4385
|
{
|
|
4047
4386
|
className: cx("pire-dl", className),
|
|
4048
4387
|
"data-layout": layout,
|
|
4049
4388
|
style: { ...layout === "grid" ? { "--pire-dl-cols": columns } : null, ...style },
|
|
4050
4389
|
...rest,
|
|
4051
|
-
children: items.map((item, i) => /* @__PURE__ */ (0,
|
|
4052
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "pire-dl-row", "data-emphasis": item.emphasis ? "true" : void 0, children: [
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("dt", { className: "pire-dl-term", children: [
|
|
4053
4392
|
item.label,
|
|
4054
4393
|
item.hint
|
|
4055
4394
|
] }),
|
|
4056
|
-
/* @__PURE__ */ (0,
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("dd", { className: "pire-dl-value", "data-numeric": item.numeric ? "true" : void 0, children: item.value })
|
|
4057
4396
|
] }, i))
|
|
4058
4397
|
}
|
|
4059
4398
|
);
|
|
4060
4399
|
}
|
|
4061
4400
|
|
|
4062
4401
|
// src/components/data/Timeline.tsx
|
|
4063
|
-
var
|
|
4402
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4064
4403
|
function Timeline({ entries, reverse = false, className, ...rest }) {
|
|
4065
4404
|
const list = reverse ? [...entries].reverse() : entries;
|
|
4066
|
-
return /* @__PURE__ */ (0,
|
|
4067
|
-
/* @__PURE__ */ (0,
|
|
4068
|
-
/* @__PURE__ */ (0,
|
|
4069
|
-
entry.actor ? /* @__PURE__ */ (0,
|
|
4405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ol", { className: cx("pire-timeline", className), ...rest, children: list.map((entry, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: "pire-timeline-item", children: [
|
|
4406
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "pire-timeline-time", children: entry.time }),
|
|
4407
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "pire-timeline-text", children: entry.event }),
|
|
4408
|
+
entry.actor ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "pire-timeline-actor", children: entry.actor }) : null
|
|
4070
4409
|
] }, entry.id ?? i)) });
|
|
4071
4410
|
}
|
|
4072
4411
|
|
|
@@ -4152,7 +4491,7 @@ function alignToCategories(series, categoryCount) {
|
|
|
4152
4491
|
}
|
|
4153
4492
|
|
|
4154
4493
|
// src/components/data/ChartFrame.tsx
|
|
4155
|
-
var
|
|
4494
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4156
4495
|
function seriesLegend(series) {
|
|
4157
4496
|
return series.map((one, index) => ({
|
|
4158
4497
|
key: one.id,
|
|
@@ -4175,29 +4514,29 @@ function ChartFrame({
|
|
|
4175
4514
|
children
|
|
4176
4515
|
}) {
|
|
4177
4516
|
const msg = usePireMessages();
|
|
4178
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
-
title || description ? /* @__PURE__ */ (0,
|
|
4180
|
-
title ? /* @__PURE__ */ (0,
|
|
4181
|
-
description ? /* @__PURE__ */ (0,
|
|
4517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("figure", { className: cx("pire-chart", className), style, children: [
|
|
4518
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("figcaption", { className: "pire-chart-head", children: [
|
|
4519
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "pire-chart-title", children: title }) : null,
|
|
4520
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "pire-chart-desc", children: description }) : null
|
|
4182
4521
|
] }) : null,
|
|
4183
|
-
legend && legend.length > 1 ? /* @__PURE__ */ (0,
|
|
4184
|
-
/* @__PURE__ */ (0,
|
|
4522
|
+
legend && legend.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { className: "pire-chart-legend", children: legend.map((item) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("li", { className: "pire-chart-legend-item", children: [
|
|
4523
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "pire-chart-swatch", style: { background: item.color } }),
|
|
4185
4524
|
item.label
|
|
4186
4525
|
] }, item.key)) }) : null,
|
|
4187
|
-
/* @__PURE__ */ (0,
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
4189
|
-
/* @__PURE__ */ (0,
|
|
4190
|
-
/* @__PURE__ */ (0,
|
|
4191
|
-
/* @__PURE__ */ (0,
|
|
4192
|
-
series.map((one) => /* @__PURE__ */ (0,
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pire-chart-plot", "aria-hidden": "true", children }),
|
|
4527
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: showDataTable ? "pire-chart-table" : "pire-sr-only", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("table", { children: [
|
|
4528
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("caption", { children: label }),
|
|
4529
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("tr", { children: [
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("th", { scope: "col", children: msg.chartCategoryHeader }),
|
|
4531
|
+
series.map((one) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("th", { scope: "col", children: one.label }, one.id))
|
|
4193
4532
|
] }) }),
|
|
4194
|
-
/* @__PURE__ */ (0,
|
|
4533
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("tbody", { children: categories.map((category, categoryIndex) => (
|
|
4195
4534
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4196
|
-
/* @__PURE__ */ (0,
|
|
4197
|
-
/* @__PURE__ */ (0,
|
|
4535
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("tr", { children: [
|
|
4536
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("th", { scope: "row", children: category }),
|
|
4198
4537
|
series.map((one) => {
|
|
4199
4538
|
const value = one.values[categoryIndex];
|
|
4200
|
-
return /* @__PURE__ */ (0,
|
|
4539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("td", { children: value == null ? msg.chartNoValue : formatValue(value) }, one.id);
|
|
4201
4540
|
})
|
|
4202
4541
|
] }, categoryIndex)
|
|
4203
4542
|
)) })
|
|
@@ -4206,7 +4545,7 @@ function ChartFrame({
|
|
|
4206
4545
|
}
|
|
4207
4546
|
|
|
4208
4547
|
// src/components/data/BarChart.tsx
|
|
4209
|
-
var
|
|
4548
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4210
4549
|
function BarChart({
|
|
4211
4550
|
categories,
|
|
4212
4551
|
series: rawSeries,
|
|
@@ -4238,7 +4577,7 @@ function BarChart({
|
|
|
4238
4577
|
const value = series[0].values[categoryIndex];
|
|
4239
4578
|
return value == null ? msg.chartNoValue : formatValue(value);
|
|
4240
4579
|
};
|
|
4241
|
-
return /* @__PURE__ */ (0,
|
|
4580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4242
4581
|
ChartFrame,
|
|
4243
4582
|
{
|
|
4244
4583
|
label,
|
|
@@ -4251,7 +4590,7 @@ function BarChart({
|
|
|
4251
4590
|
showDataTable,
|
|
4252
4591
|
className,
|
|
4253
4592
|
style,
|
|
4254
|
-
children: !hasData ? /* @__PURE__ */ (0,
|
|
4593
|
+
children: !hasData ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4255
4594
|
"div",
|
|
4256
4595
|
{
|
|
4257
4596
|
className: "pire-chart-bars",
|
|
@@ -4260,12 +4599,12 @@ function BarChart({
|
|
|
4260
4599
|
style: { "--pire-chart-height": `${height}px` },
|
|
4261
4600
|
children: categories.map((category, categoryIndex) => (
|
|
4262
4601
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4263
|
-
/* @__PURE__ */ (0,
|
|
4264
|
-
/* @__PURE__ */ (0,
|
|
4265
|
-
/* @__PURE__ */ (0,
|
|
4602
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "pire-chart-group", children: [
|
|
4603
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "pire-chart-cat", children: category }),
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "pire-chart-track", children: series.map((one, seriesIndex) => {
|
|
4266
4605
|
const value = one.values[categoryIndex];
|
|
4267
4606
|
if (value == null) return null;
|
|
4268
|
-
return /* @__PURE__ */ (0,
|
|
4607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
4269
4608
|
"div",
|
|
4270
4609
|
{
|
|
4271
4610
|
className: "pire-chart-bar",
|
|
@@ -4274,8 +4613,8 @@ function BarChart({
|
|
|
4274
4613
|
"--pire-bar-color": seriesColor(one, seriesIndex)
|
|
4275
4614
|
},
|
|
4276
4615
|
children: [
|
|
4277
|
-
withValues && orientation === "vertical" ? /* @__PURE__ */ (0,
|
|
4278
|
-
/* @__PURE__ */ (0,
|
|
4616
|
+
withValues && orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "pire-chart-barval", children: formatValue(value) }) : null,
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4279
4618
|
series.length > 1 ? `${one.label}: ` : "",
|
|
4280
4619
|
formatValue(value)
|
|
4281
4620
|
] })
|
|
@@ -4284,7 +4623,7 @@ function BarChart({
|
|
|
4284
4623
|
one.id
|
|
4285
4624
|
);
|
|
4286
4625
|
}) }),
|
|
4287
|
-
withValues && orientation === "horizontal" ? /* @__PURE__ */ (0,
|
|
4626
|
+
withValues && orientation === "horizontal" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "pire-chart-val", children: horizontalLabelFor(categoryIndex) }) : null
|
|
4288
4627
|
] }, categoryIndex)
|
|
4289
4628
|
))
|
|
4290
4629
|
}
|
|
@@ -4294,14 +4633,14 @@ function BarChart({
|
|
|
4294
4633
|
}
|
|
4295
4634
|
|
|
4296
4635
|
// src/components/data/LineChart.tsx
|
|
4297
|
-
var
|
|
4298
|
-
var
|
|
4636
|
+
var React28 = __toESM(require("react"), 1);
|
|
4637
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4299
4638
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4300
4639
|
var MARKER_LIMIT = 20;
|
|
4301
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4640
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React28.useEffect : React28.useLayoutEffect;
|
|
4302
4641
|
function useMeasuredWidth() {
|
|
4303
|
-
const ref =
|
|
4304
|
-
const [width, setWidth] =
|
|
4642
|
+
const ref = React28.useRef(null);
|
|
4643
|
+
const [width, setWidth] = React28.useState(0);
|
|
4305
4644
|
useIsomorphicLayoutEffect2(() => {
|
|
4306
4645
|
const element = ref.current;
|
|
4307
4646
|
if (!element) return;
|
|
@@ -4362,7 +4701,7 @@ function LineChart({
|
|
|
4362
4701
|
return `M${xAt(present[0].index)} ${baseline} L${line} L${xAt(last.index)} ${baseline} Z`;
|
|
4363
4702
|
};
|
|
4364
4703
|
const labelEvery = Math.max(1, Math.ceil(categories.length / Math.max(2, Math.floor(innerWidth / 64))));
|
|
4365
|
-
return /* @__PURE__ */ (0,
|
|
4704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4366
4705
|
ChartFrame,
|
|
4367
4706
|
{
|
|
4368
4707
|
label,
|
|
@@ -4375,8 +4714,8 @@ function LineChart({
|
|
|
4375
4714
|
showDataTable,
|
|
4376
4715
|
className,
|
|
4377
4716
|
style,
|
|
4378
|
-
children: !hasData ? /* @__PURE__ */ (0,
|
|
4379
|
-
width > 0 ? /* @__PURE__ */ (0,
|
|
4717
|
+
children: !hasData ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "pire-chart-lines", ref: plotRef, style: { height }, children: [
|
|
4718
|
+
width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
4380
4719
|
"svg",
|
|
4381
4720
|
{
|
|
4382
4721
|
width,
|
|
@@ -4385,7 +4724,7 @@ function LineChart({
|
|
|
4385
4724
|
"aria-hidden": "true",
|
|
4386
4725
|
focusable: "false",
|
|
4387
4726
|
children: [
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4727
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("g", { className: "pire-chart-grid", children: scale.ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4389
4728
|
"line",
|
|
4390
4729
|
{
|
|
4391
4730
|
x1: PLOT_INSET.left,
|
|
@@ -4395,8 +4734,8 @@ function LineChart({
|
|
|
4395
4734
|
},
|
|
4396
4735
|
tick
|
|
4397
4736
|
)) }),
|
|
4398
|
-
/* @__PURE__ */ (0,
|
|
4399
|
-
scale.ticks.map((tick) => /* @__PURE__ */ (0,
|
|
4737
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("g", { className: "pire-chart-tick", children: [
|
|
4738
|
+
scale.ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4400
4739
|
"text",
|
|
4401
4740
|
{
|
|
4402
4741
|
x: PLOT_INSET.left - 8,
|
|
@@ -4410,11 +4749,11 @@ function LineChart({
|
|
|
4410
4749
|
categories.map(
|
|
4411
4750
|
(category, index) => index % labelEvery === 0 ? (
|
|
4412
4751
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4413
|
-
/* @__PURE__ */ (0,
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("text", { x: xAt(index), y: height - 6, textAnchor: "middle", children: category }, index)
|
|
4414
4753
|
) : null
|
|
4415
4754
|
)
|
|
4416
4755
|
] }),
|
|
4417
|
-
showArea && series[0] ? /* @__PURE__ */ (0,
|
|
4756
|
+
showArea && series[0] ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4418
4757
|
"path",
|
|
4419
4758
|
{
|
|
4420
4759
|
d: areaFor(series[0].values),
|
|
@@ -4422,10 +4761,10 @@ function LineChart({
|
|
|
4422
4761
|
style: { fill: seriesColor(series[0], 0) }
|
|
4423
4762
|
}
|
|
4424
4763
|
) : null,
|
|
4425
|
-
/* @__PURE__ */ (0,
|
|
4426
|
-
withMarkers ? /* @__PURE__ */ (0,
|
|
4764
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("g", { className: "pire-chart-line", fill: "none", children: series.map((one, index) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("path", { d: pathFor(one.values), stroke: seriesColor(one, index) }, one.id)) }),
|
|
4765
|
+
withMarkers ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("g", { className: "pire-chart-marker", children: series.map(
|
|
4427
4766
|
(one, seriesIndex) => one.values.map(
|
|
4428
|
-
(value, index) => value == null ? null : /* @__PURE__ */ (0,
|
|
4767
|
+
(value, index) => value == null ? null : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4429
4768
|
"circle",
|
|
4430
4769
|
{
|
|
4431
4770
|
cx: xAt(index),
|
|
@@ -4440,7 +4779,7 @@ function LineChart({
|
|
|
4440
4779
|
]
|
|
4441
4780
|
}
|
|
4442
4781
|
) : null,
|
|
4443
|
-
/* @__PURE__ */ (0,
|
|
4782
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4444
4783
|
"div",
|
|
4445
4784
|
{
|
|
4446
4785
|
className: "pire-chart-hover",
|
|
@@ -4449,11 +4788,11 @@ function LineChart({
|
|
|
4449
4788
|
},
|
|
4450
4789
|
children: categories.map((category, categoryIndex) => (
|
|
4451
4790
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4452
|
-
/* @__PURE__ */ (0,
|
|
4453
|
-
/* @__PURE__ */ (0,
|
|
4791
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "pire-chart-band", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("strong", { children: category }),
|
|
4454
4793
|
series.map((one) => {
|
|
4455
4794
|
const value = one.values[categoryIndex];
|
|
4456
|
-
return /* @__PURE__ */ (0,
|
|
4795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "pire-chart-tip-row", children: [
|
|
4457
4796
|
one.label,
|
|
4458
4797
|
": ",
|
|
4459
4798
|
value == null ? "No data" : formatValue(value)
|
|
@@ -4469,8 +4808,8 @@ function LineChart({
|
|
|
4469
4808
|
}
|
|
4470
4809
|
|
|
4471
4810
|
// src/components/data/DonutChart.tsx
|
|
4472
|
-
var
|
|
4473
|
-
var
|
|
4811
|
+
var React29 = __toESM(require("react"), 1);
|
|
4812
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4474
4813
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4475
4814
|
function DonutChart({
|
|
4476
4815
|
categories,
|
|
@@ -4490,7 +4829,7 @@ function DonutChart({
|
|
|
4490
4829
|
}) {
|
|
4491
4830
|
const label = rest["aria-label"];
|
|
4492
4831
|
const msg = usePireMessages();
|
|
4493
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4832
|
+
const [hoveredIndex, setHoveredIndex] = React29.useState(null);
|
|
4494
4833
|
warnOnDonutShape(series, categories.length, label);
|
|
4495
4834
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4496
4835
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -4507,7 +4846,7 @@ function DonutChart({
|
|
|
4507
4846
|
}));
|
|
4508
4847
|
const hovered = hoveredIndex == null ? null : segments.find((segment) => segment.index === hoveredIndex) ?? null;
|
|
4509
4848
|
let arcStart = 0;
|
|
4510
|
-
return /* @__PURE__ */ (0,
|
|
4849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4511
4850
|
ChartFrame,
|
|
4512
4851
|
{
|
|
4513
4852
|
label,
|
|
@@ -4520,8 +4859,8 @@ function DonutChart({
|
|
|
4520
4859
|
showDataTable,
|
|
4521
4860
|
className,
|
|
4522
4861
|
style,
|
|
4523
|
-
children: !hasData ? /* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4862
|
+
children: !hasData ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "pire-chart-donut", style: { height: size }, children: [
|
|
4863
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4525
4864
|
"svg",
|
|
4526
4865
|
{
|
|
4527
4866
|
width: size,
|
|
@@ -4529,13 +4868,13 @@ function DonutChart({
|
|
|
4529
4868
|
"aria-hidden": "true",
|
|
4530
4869
|
focusable: "false",
|
|
4531
4870
|
onMouseLeave: () => setHoveredIndex(null),
|
|
4532
|
-
children: /* @__PURE__ */ (0,
|
|
4871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("g", { transform: `rotate(-90 ${size / 2} ${size / 2})`, children: segments.map((segment) => {
|
|
4533
4872
|
const arcLength = segment.value / total * circumference;
|
|
4534
4873
|
const offset = arcStart;
|
|
4535
4874
|
arcStart += arcLength;
|
|
4536
4875
|
return (
|
|
4537
4876
|
// biome-ignore lint/a11y/noStaticElementInteractions: pointer-only enhancement inside an aria-hidden plot — the arcs carry nothing the data table does not, so there is nothing here for a keyboard to reach.
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4877
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4539
4878
|
"circle",
|
|
4540
4879
|
{
|
|
4541
4880
|
className: "pire-chart-arc",
|
|
@@ -4555,9 +4894,9 @@ function DonutChart({
|
|
|
4555
4894
|
}) })
|
|
4556
4895
|
}
|
|
4557
4896
|
),
|
|
4558
|
-
/* @__PURE__ */ (0,
|
|
4559
|
-
/* @__PURE__ */ (0,
|
|
4560
|
-
/* @__PURE__ */ (0,
|
|
4897
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "pire-chart-donut-center", style: { width: size - thickness * 2 - 8 }, children: [
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "pire-chart-donut-value", children: hovered ? formatValue(hovered.value) : centerLabel ?? formatValue(total) }),
|
|
4899
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "pire-chart-donut-caption", children: hovered ? hovered.category : centerCaption })
|
|
4561
4900
|
] })
|
|
4562
4901
|
] })
|
|
4563
4902
|
}
|
|
@@ -4569,14 +4908,14 @@ function colorForSegment(index) {
|
|
|
4569
4908
|
|
|
4570
4909
|
// src/components/data/LinkList.tsx
|
|
4571
4910
|
var import_react_aria_components36 = require("react-aria-components");
|
|
4572
|
-
var
|
|
4911
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4573
4912
|
function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
4574
|
-
return /* @__PURE__ */ (0,
|
|
4575
|
-
const keySlot = item.key ? /* @__PURE__ */ (0,
|
|
4576
|
-
const textSlot = item.text ? /* @__PURE__ */ (0,
|
|
4913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: cx("pire-linklist", className), role: "list", "data-emphasis": emphasis, ...rest, children: items.map((item) => {
|
|
4914
|
+
const keySlot = item.key ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-linklist-key", children: item.key }) : null;
|
|
4915
|
+
const textSlot = item.text ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-linklist-text", children: item.text }) : null;
|
|
4577
4916
|
const [first, second] = emphasis === "text" ? [textSlot, keySlot] : [keySlot, textSlot];
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
4579
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
4917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react_aria_components36.Button, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
|
|
4918
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: item.icon, size: 16, style: { color: "var(--text-secondary)" } }) : null,
|
|
4580
4919
|
first,
|
|
4581
4920
|
second,
|
|
4582
4921
|
item.trailing
|
|
@@ -4585,7 +4924,7 @@ function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
|
4585
4924
|
}
|
|
4586
4925
|
|
|
4587
4926
|
// src/components/data/RecordCard.tsx
|
|
4588
|
-
var
|
|
4927
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4589
4928
|
function RecordCard({
|
|
4590
4929
|
title,
|
|
4591
4930
|
subtitle,
|
|
@@ -4595,19 +4934,19 @@ function RecordCard({
|
|
|
4595
4934
|
className,
|
|
4596
4935
|
...rest
|
|
4597
4936
|
}) {
|
|
4598
|
-
return /* @__PURE__ */ (0,
|
|
4937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
4599
4938
|
"div",
|
|
4600
4939
|
{
|
|
4601
4940
|
className: cx("pire-recordcard", className),
|
|
4602
4941
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
4603
4942
|
...rest,
|
|
4604
4943
|
children: [
|
|
4605
|
-
icon ? /* @__PURE__ */ (0,
|
|
4606
|
-
/* @__PURE__ */ (0,
|
|
4607
|
-
/* @__PURE__ */ (0,
|
|
4608
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
4944
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "pire-recordcard-tile", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: icon, size: 20 }) }) : null,
|
|
4945
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "pire-recordcard-body", children: [
|
|
4946
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "pire-recordcard-title", children: title }),
|
|
4947
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "pire-recordcard-sub", children: subtitle }) : null
|
|
4609
4948
|
] }),
|
|
4610
|
-
action ? /* @__PURE__ */ (0,
|
|
4949
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "pire-recordcard-action", children: action }) : null
|
|
4611
4950
|
]
|
|
4612
4951
|
}
|
|
4613
4952
|
);
|
|
@@ -4615,7 +4954,7 @@ function RecordCard({
|
|
|
4615
4954
|
|
|
4616
4955
|
// src/components/data/ViewSwitcher.tsx
|
|
4617
4956
|
var import_react_aria_components37 = require("react-aria-components");
|
|
4618
|
-
var
|
|
4957
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4619
4958
|
function ViewSwitcher({
|
|
4620
4959
|
name,
|
|
4621
4960
|
isDirty,
|
|
@@ -4628,7 +4967,7 @@ function ViewSwitcher({
|
|
|
4628
4967
|
}) {
|
|
4629
4968
|
const msg = usePireMessages();
|
|
4630
4969
|
const label = ariaLabel ?? (isDirty ? msg.viewSwitcherNameModified.replace("{view}", name) : msg.viewSwitcherName.replace("{view}", name));
|
|
4631
|
-
return /* @__PURE__ */ (0,
|
|
4970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
4632
4971
|
import_react_aria_components37.Button,
|
|
4633
4972
|
{
|
|
4634
4973
|
className: cx("pire-viewswitcher", className),
|
|
@@ -4637,36 +4976,36 @@ function ViewSwitcher({
|
|
|
4637
4976
|
isDisabled,
|
|
4638
4977
|
onPress,
|
|
4639
4978
|
children: [
|
|
4640
|
-
/* @__PURE__ */ (0,
|
|
4641
|
-
/* @__PURE__ */ (0,
|
|
4642
|
-
isDirty ? /* @__PURE__ */ (0,
|
|
4643
|
-
/* @__PURE__ */ (0,
|
|
4979
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Icon, { name: icon, size: 16 }),
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-viewswitcher-name", children: name }),
|
|
4981
|
+
isDirty ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-viewswitcher-dirty", "aria-hidden": "true", children: msg.viewSwitcherModifiedMark }) : null,
|
|
4982
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Icon, { name: "chevron-down", size: 16 })
|
|
4644
4983
|
]
|
|
4645
4984
|
}
|
|
4646
4985
|
);
|
|
4647
4986
|
}
|
|
4648
4987
|
|
|
4649
4988
|
// src/components/data/BarList.tsx
|
|
4650
|
-
var
|
|
4989
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4651
4990
|
function BarList({ items, max, className, ...rest }) {
|
|
4652
4991
|
const scale = max ?? Math.max(0, ...items.map((i) => i.value));
|
|
4653
|
-
return /* @__PURE__ */ (0,
|
|
4992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { ...rest, className: cx("pire-barlist", className), children: items.map((item) => {
|
|
4654
4993
|
const pct = scale > 0 ? Math.max(0, Math.min(100, item.value / scale * 100)) : 0;
|
|
4655
|
-
return /* @__PURE__ */ (0,
|
|
4656
|
-
/* @__PURE__ */ (0,
|
|
4657
|
-
/* @__PURE__ */ (0,
|
|
4658
|
-
/* @__PURE__ */ (0,
|
|
4994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("li", { className: "pire-barlist-row", "data-tone": item.tone, children: [
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "pire-barlist-main", children: [
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "pire-barlist-label", children: item.label }),
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "pire-barlist-track", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "pire-barlist-fill", style: { width: `${pct}%` } }) })
|
|
4659
4998
|
] }),
|
|
4660
|
-
/* @__PURE__ */ (0,
|
|
4661
|
-
/* @__PURE__ */ (0,
|
|
4662
|
-
item.hint ? /* @__PURE__ */ (0,
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "pire-barlist-figure", children: [
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "pire-barlist-value", children: item.valueLabel ?? String(item.value) }),
|
|
5001
|
+
item.hint ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "pire-barlist-hint", children: item.hint }) : null
|
|
4663
5002
|
] })
|
|
4664
5003
|
] }, item.id);
|
|
4665
5004
|
}) });
|
|
4666
5005
|
}
|
|
4667
5006
|
|
|
4668
5007
|
// src/components/layout/PageBand.tsx
|
|
4669
|
-
var
|
|
5008
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4670
5009
|
function PageBand({
|
|
4671
5010
|
surface = "card",
|
|
4672
5011
|
hasBorder = true,
|
|
@@ -4674,7 +5013,7 @@ function PageBand({
|
|
|
4674
5013
|
className,
|
|
4675
5014
|
...rest
|
|
4676
5015
|
}) {
|
|
4677
|
-
return /* @__PURE__ */ (0,
|
|
5016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4678
5017
|
"div",
|
|
4679
5018
|
{
|
|
4680
5019
|
className: cx("pire-pageband", className),
|
|
@@ -4687,63 +5026,78 @@ function PageBand({
|
|
|
4687
5026
|
}
|
|
4688
5027
|
|
|
4689
5028
|
// src/components/layout/PageHeader.tsx
|
|
4690
|
-
var
|
|
5029
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4691
5030
|
function PageHeader({ title, subtitle, actions, className, ...rest }) {
|
|
4692
|
-
return /* @__PURE__ */ (0,
|
|
4693
|
-
/* @__PURE__ */ (0,
|
|
4694
|
-
/* @__PURE__ */ (0,
|
|
4695
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
5031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("header", { className: cx("pire-pageheader", className), ...rest, children: [
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("h1", { className: "pire-pageheader-title", children: title }),
|
|
5034
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { className: "pire-pageheader-sub", children: subtitle }) : null
|
|
4696
5035
|
] }),
|
|
4697
|
-
actions ? /* @__PURE__ */ (0,
|
|
5036
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "pire-pageheader-actions", children: actions }) : null
|
|
4698
5037
|
] });
|
|
4699
5038
|
}
|
|
4700
5039
|
|
|
4701
5040
|
// src/components/layout/SectionHeader.tsx
|
|
4702
|
-
var
|
|
5041
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4703
5042
|
function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
4704
|
-
return /* @__PURE__ */ (0,
|
|
4705
|
-
/* @__PURE__ */ (0,
|
|
4706
|
-
meta ? /* @__PURE__ */ (0,
|
|
4707
|
-
actions ? /* @__PURE__ */ (0,
|
|
5043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: cx("pire-sectionhead", className), ...rest, children: [
|
|
5044
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "pire-eyebrow", children: title }),
|
|
5045
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { style: { font: "var(--type-caption)", color: "var(--text-tertiary)" }, children: meta }) : null,
|
|
5046
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "pire-sectionhead-actions", children: actions }) : null
|
|
4708
5047
|
] });
|
|
4709
5048
|
}
|
|
4710
5049
|
|
|
4711
5050
|
// src/components/layout/SelectionBar.tsx
|
|
4712
|
-
var
|
|
5051
|
+
var React30 = __toESM(require("react"), 1);
|
|
5052
|
+
var import_react_aria_components38 = require("react-aria-components");
|
|
5053
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4713
5054
|
function SelectionBar({
|
|
4714
5055
|
count,
|
|
4715
|
-
noun
|
|
5056
|
+
noun,
|
|
5057
|
+
gender = "masculine",
|
|
5058
|
+
label,
|
|
5059
|
+
onClear,
|
|
5060
|
+
clearLabel,
|
|
4716
5061
|
children,
|
|
4717
5062
|
actions,
|
|
4718
5063
|
className,
|
|
4719
5064
|
...rest
|
|
4720
5065
|
}) {
|
|
5066
|
+
const msg = usePireMessages();
|
|
5067
|
+
const { locale } = (0, import_react_aria_components38.useLocale)();
|
|
5068
|
+
const plural = React30.useMemo(() => new Intl.PluralRules(locale), [locale]);
|
|
5069
|
+
const numbers = React30.useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
4721
5070
|
if (!count) return null;
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
5071
|
+
const isOne = plural.select(count) === "one";
|
|
5072
|
+
let sentence;
|
|
5073
|
+
if (label) {
|
|
5074
|
+
sentence = label(count);
|
|
5075
|
+
} else {
|
|
5076
|
+
const word = typeof noun === "string" ? `${noun}${count === 1 ? "" : "s"}` : noun ? isOne ? noun.one : noun.other : isOne ? msg.selectionBarNounOne : msg.selectionBarNounOther;
|
|
5077
|
+
const feminine = gender === "feminine";
|
|
5078
|
+
const template = isOne ? feminine ? msg.selectionBarCountOneFeminine : msg.selectionBarCountOne : feminine ? msg.selectionBarCountOtherFeminine : msg.selectionBarCountOther;
|
|
5079
|
+
sentence = template.replace("{count}", numbers.format(count)).replace("{noun}", word);
|
|
5080
|
+
}
|
|
5081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: cx("pire-selectionbar", className), role: "status", "aria-live": "polite", ...rest, children: [
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "pire-selectionbar-count", children: sentence }),
|
|
5083
|
+
onClear ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Button, { size: "sm", variant: "tertiary", onPress: onClear, children: clearLabel ?? msg.selectionBarClear }) : null,
|
|
5084
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "pire-selectionbar-note", children }) : null,
|
|
5085
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "pire-selectionbar-actions", children: actions }) : null
|
|
4732
5086
|
] });
|
|
4733
5087
|
}
|
|
4734
5088
|
|
|
4735
5089
|
// src/components/layout/FooterBar.tsx
|
|
4736
|
-
var
|
|
5090
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4737
5091
|
function FooterBar({ note, actions, children, className, ...rest }) {
|
|
4738
|
-
return /* @__PURE__ */ (0,
|
|
4739
|
-
note ? /* @__PURE__ */ (0,
|
|
5092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("footer", { className: cx("pire-footerbar", className), ...rest, children: [
|
|
5093
|
+
note ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "pire-footerbar-note", children: note }) : null,
|
|
4740
5094
|
children,
|
|
4741
|
-
actions ? /* @__PURE__ */ (0,
|
|
5095
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "pire-footerbar-actions", children: actions }) : null
|
|
4742
5096
|
] });
|
|
4743
5097
|
}
|
|
4744
5098
|
|
|
4745
5099
|
// src/components/layout/SplitPane.tsx
|
|
4746
|
-
var
|
|
5100
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4747
5101
|
function SplitPane({
|
|
4748
5102
|
list,
|
|
4749
5103
|
detail,
|
|
@@ -4759,7 +5113,7 @@ function SplitPane({
|
|
|
4759
5113
|
}) {
|
|
4760
5114
|
const msg = usePireMessages();
|
|
4761
5115
|
const width = typeof listWidth === "number" ? `${listWidth}px` : listWidth;
|
|
4762
|
-
return /* @__PURE__ */ (0,
|
|
5116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
4763
5117
|
"div",
|
|
4764
5118
|
{
|
|
4765
5119
|
className: cx("pire-split", className),
|
|
@@ -4767,10 +5121,10 @@ function SplitPane({
|
|
|
4767
5121
|
style: { ["--pire-split-list-w"]: width, ...style },
|
|
4768
5122
|
...rest,
|
|
4769
5123
|
children: [
|
|
4770
|
-
/* @__PURE__ */ (0,
|
|
4771
|
-
/* @__PURE__ */ (0,
|
|
4772
|
-
onBack ? /* @__PURE__ */ (0,
|
|
4773
|
-
detail ?? /* @__PURE__ */ (0,
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("section", { className: "pire-split-list", "aria-label": listLabel ?? msg.splitPaneList, children: list }),
|
|
5125
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("section", { className: "pire-split-detail", "aria-label": detailLabel ?? msg.splitPaneDetail, children: [
|
|
5126
|
+
onBack ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "pire-split-back", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: "tertiary", size: "sm", icon: "arrow-left", onPress: onBack, children: backLabel ?? msg.splitPaneBack }) }) : null,
|
|
5127
|
+
detail ?? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "pire-split-empty", children: emptyDetail })
|
|
4774
5128
|
] })
|
|
4775
5129
|
]
|
|
4776
5130
|
}
|
|
@@ -4778,7 +5132,7 @@ function SplitPane({
|
|
|
4778
5132
|
}
|
|
4779
5133
|
|
|
4780
5134
|
// src/components/patterns/ConfirmDialog.tsx
|
|
4781
|
-
var
|
|
5135
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4782
5136
|
function ConfirmDialog({
|
|
4783
5137
|
isOpen,
|
|
4784
5138
|
title,
|
|
@@ -4794,7 +5148,7 @@ function ConfirmDialog({
|
|
|
4794
5148
|
onCancel
|
|
4795
5149
|
}) {
|
|
4796
5150
|
const msg = usePireMessages();
|
|
4797
|
-
return /* @__PURE__ */ (0,
|
|
5151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
4798
5152
|
Dialog,
|
|
4799
5153
|
{
|
|
4800
5154
|
isOpen,
|
|
@@ -4804,9 +5158,9 @@ function ConfirmDialog({
|
|
|
4804
5158
|
onClose: onCancel,
|
|
4805
5159
|
isDismissable: !isBusy,
|
|
4806
5160
|
showClose: false,
|
|
4807
|
-
footer: /* @__PURE__ */ (0,
|
|
4808
|
-
/* @__PURE__ */ (0,
|
|
4809
|
-
/* @__PURE__ */ (0,
|
|
5161
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel }),
|
|
5163
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? "Working\u2026" : confirmLabel })
|
|
4810
5164
|
] }),
|
|
4811
5165
|
children: [
|
|
4812
5166
|
facts?.length ? (
|
|
@@ -4814,9 +5168,9 @@ function ConfirmDialog({
|
|
|
4814
5168
|
// *prohibits* `aria-label` — the label named nothing at all, and axe's
|
|
4815
5169
|
// `aria-prohibited-attr` fails it on sight. Every other labelled div/span in this library
|
|
4816
5170
|
// pairs with an explicit role for the same reason.
|
|
4817
|
-
/* @__PURE__ */ (0,
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "pire-confirm-facts", role: "group", "aria-label": msg.confirmDialogFactsLabel, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DescriptionList, { layout: "rows", items: facts }) })
|
|
4818
5172
|
) : null,
|
|
4819
|
-
consequence ? /* @__PURE__ */ (0,
|
|
5173
|
+
consequence ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4820
5174
|
InlineMessage,
|
|
4821
5175
|
{
|
|
4822
5176
|
kind: tone === "danger" ? "error" : "warning",
|
|
@@ -4831,9 +5185,9 @@ function ConfirmDialog({
|
|
|
4831
5185
|
}
|
|
4832
5186
|
|
|
4833
5187
|
// src/components/patterns/CommandPalette.tsx
|
|
4834
|
-
var
|
|
4835
|
-
var
|
|
4836
|
-
var
|
|
5188
|
+
var React31 = __toESM(require("react"), 1);
|
|
5189
|
+
var import_react_aria_components39 = require("react-aria-components");
|
|
5190
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4837
5191
|
var RESULTS_SECTION_KEY = "__pire_results__";
|
|
4838
5192
|
var searchableText = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
4839
5193
|
function CommandPalette({
|
|
@@ -4854,17 +5208,17 @@ function CommandPalette({
|
|
|
4854
5208
|
style
|
|
4855
5209
|
}) {
|
|
4856
5210
|
const msg = usePireMessages();
|
|
4857
|
-
const [query, setQuery] =
|
|
4858
|
-
const { contains } = (0,
|
|
4859
|
-
|
|
5211
|
+
const [query, setQuery] = React31.useState("");
|
|
5212
|
+
const { contains } = (0, import_react_aria_components39.useFilter)({ sensitivity: "base" });
|
|
5213
|
+
React31.useEffect(() => {
|
|
4860
5214
|
if (isOpen) setQuery("");
|
|
4861
5215
|
}, [isOpen]);
|
|
4862
|
-
const searchableById =
|
|
5216
|
+
const searchableById = React31.useMemo(() => {
|
|
4863
5217
|
const byId = /* @__PURE__ */ new Map();
|
|
4864
5218
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
4865
5219
|
return byId;
|
|
4866
5220
|
}, [groups]);
|
|
4867
|
-
const filter =
|
|
5221
|
+
const filter = React31.useCallback(
|
|
4868
5222
|
(textValue, inputValue, node) => {
|
|
4869
5223
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
4870
5224
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -4877,8 +5231,8 @@ function CommandPalette({
|
|
|
4877
5231
|
};
|
|
4878
5232
|
const sections = [...groups, ...resultsGroup ? [{ ...resultsGroup, id: RESULTS_SECTION_KEY }] : []];
|
|
4879
5233
|
const status = isLoading ? loadingLabel ?? msg.commandPaletteLoading : emptyLabel ?? msg.commandPaletteEmpty;
|
|
4880
|
-
return /* @__PURE__ */ (0,
|
|
4881
|
-
|
|
5234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5235
|
+
import_react_aria_components39.ModalOverlay,
|
|
4882
5236
|
{
|
|
4883
5237
|
className: "pire-cp-overlay",
|
|
4884
5238
|
isOpen,
|
|
@@ -4886,12 +5240,12 @@ function CommandPalette({
|
|
|
4886
5240
|
onOpenChange: (open) => {
|
|
4887
5241
|
if (!open) onOpenChange?.(false);
|
|
4888
5242
|
},
|
|
4889
|
-
children: /* @__PURE__ */ (0,
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
|
|
5243
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_aria_components39.Modal, { className: cx("pire-cp-modal", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components39.Dialog, { className: "pire-cp-dialog", "aria-label": ariaLabel ?? msg.commandPaletteLabel, children: [
|
|
5244
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components39.Autocomplete, { filter, inputValue: query, onInputChange: handleInputChange, children: [
|
|
5245
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components39.SearchField, { className: "pire-cp-search", "aria-label": msg.commandPaletteSearchLabel, children: [
|
|
5246
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Icon, { name: "search", size: 18, className: "pire-cp-search-icon" }),
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5248
|
+
import_react_aria_components39.Input,
|
|
4895
5249
|
{
|
|
4896
5250
|
className: "pire-cp-input",
|
|
4897
5251
|
autoFocus: true,
|
|
@@ -4899,16 +5253,16 @@ function CommandPalette({
|
|
|
4899
5253
|
}
|
|
4900
5254
|
)
|
|
4901
5255
|
] }),
|
|
4902
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4903
|
-
/* @__PURE__ */ (0,
|
|
4904
|
-
|
|
5256
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-cp-loading", role: "status", "aria-live": "polite", children: loadingLabel ?? msg.commandPaletteLoading }) : null,
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5258
|
+
import_react_aria_components39.Menu,
|
|
4905
5259
|
{
|
|
4906
5260
|
className: "pire-cp-list",
|
|
4907
5261
|
onAction: (key) => onAction?.(String(key)),
|
|
4908
|
-
renderEmptyState: () => /* @__PURE__ */ (0,
|
|
4909
|
-
children: sections.map((section) => /* @__PURE__ */ (0,
|
|
4910
|
-
section.label ? /* @__PURE__ */ (0,
|
|
4911
|
-
section.items.map((item) => /* @__PURE__ */ (0,
|
|
5262
|
+
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-cp-status", children: status }),
|
|
5263
|
+
children: sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components39.MenuSection, { id: section.id, className: "pire-cp-section", children: [
|
|
5264
|
+
section.label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_aria_components39.Header, { className: "pire-cp-section-title", children: section.label }) : null,
|
|
5265
|
+
section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4912
5266
|
MenuItem,
|
|
4913
5267
|
{
|
|
4914
5268
|
id: item.id,
|
|
@@ -4929,18 +5283,18 @@ function CommandPalette({
|
|
|
4929
5283
|
// aria-hidden: the glyphs are a sighted affordance for discovering the keys. A screen
|
|
4930
5284
|
// reader already announces the listbox semantics that make those keys work, so reading
|
|
4931
5285
|
// "up arrow down arrow navigate" out loud is noise on every open.
|
|
4932
|
-
/* @__PURE__ */ (0,
|
|
4933
|
-
/* @__PURE__ */ (0,
|
|
4934
|
-
/* @__PURE__ */ (0,
|
|
4935
|
-
/* @__PURE__ */ (0,
|
|
5286
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-cp-foot", "aria-hidden": "true", children: footer ?? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
5287
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "pire-cp-hint", children: [
|
|
5288
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Kbd, { children: "\u2191" }),
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Kbd, { children: "\u2193" }),
|
|
4936
5290
|
msg.commandPaletteHintNavigate
|
|
4937
5291
|
] }),
|
|
4938
|
-
/* @__PURE__ */ (0,
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
5292
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "pire-cp-hint", children: [
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Kbd, { children: "\u21B5" }),
|
|
4940
5294
|
msg.commandPaletteHintSelect
|
|
4941
5295
|
] }),
|
|
4942
|
-
/* @__PURE__ */ (0,
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "pire-cp-hint", children: [
|
|
5297
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Kbd, { children: "esc" }),
|
|
4944
5298
|
msg.commandPaletteHintClose
|
|
4945
5299
|
] })
|
|
4946
5300
|
] }) })
|
|
@@ -4950,9 +5304,9 @@ function CommandPalette({
|
|
|
4950
5304
|
);
|
|
4951
5305
|
}
|
|
4952
5306
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
4953
|
-
const handler =
|
|
5307
|
+
const handler = React31.useRef(onTrigger);
|
|
4954
5308
|
handler.current = onTrigger;
|
|
4955
|
-
|
|
5309
|
+
React31.useEffect(() => {
|
|
4956
5310
|
if (isDisabled) return;
|
|
4957
5311
|
const onKeyDown = (event) => {
|
|
4958
5312
|
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
@@ -4966,9 +5320,9 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
|
4966
5320
|
}
|
|
4967
5321
|
|
|
4968
5322
|
// src/components/patterns/AppLauncher.tsx
|
|
4969
|
-
var
|
|
4970
|
-
var
|
|
4971
|
-
var
|
|
5323
|
+
var React32 = __toESM(require("react"), 1);
|
|
5324
|
+
var import_react_aria_components40 = require("react-aria-components");
|
|
5325
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4972
5326
|
var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
4973
5327
|
function AppLauncher({
|
|
4974
5328
|
sections,
|
|
@@ -4987,13 +5341,13 @@ function AppLauncher({
|
|
|
4987
5341
|
className
|
|
4988
5342
|
}) {
|
|
4989
5343
|
const msg = usePireMessages();
|
|
4990
|
-
const [query, setQuery] =
|
|
4991
|
-
const { contains } = (0,
|
|
5344
|
+
const [query, setQuery] = React32.useState("");
|
|
5345
|
+
const { contains } = (0, import_react_aria_components40.useFilter)({ sensitivity: "base" });
|
|
4992
5346
|
const handleSearch = (next) => {
|
|
4993
5347
|
setQuery(next);
|
|
4994
5348
|
onSearchChange?.(next);
|
|
4995
5349
|
};
|
|
4996
|
-
const visible =
|
|
5350
|
+
const visible = React32.useMemo(() => {
|
|
4997
5351
|
if (isFilteredExternally) return sections;
|
|
4998
5352
|
const q = query.trim();
|
|
4999
5353
|
if (!q) return sections;
|
|
@@ -5004,25 +5358,25 @@ function AppLauncher({
|
|
|
5004
5358
|
}, [sections, query, isFilteredExternally, contains]);
|
|
5005
5359
|
const isEmpty = !isLoading && visible.length === 0;
|
|
5006
5360
|
const label = ariaLabel ?? msg.appLauncherLabel;
|
|
5007
|
-
return /* @__PURE__ */ (0,
|
|
5008
|
-
/* @__PURE__ */ (0,
|
|
5009
|
-
/* @__PURE__ */ (0,
|
|
5010
|
-
|
|
5361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_react_aria_components40.DialogTrigger, { children: [
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react_aria_components40.Button, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { name: icon, size: 20 }) }),
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5364
|
+
import_react_aria_components40.Popover,
|
|
5011
5365
|
{
|
|
5012
5366
|
className: cx("pire-launcher-popover", className),
|
|
5013
5367
|
placement: "bottom start",
|
|
5014
5368
|
offset: 0,
|
|
5015
5369
|
crossOffset: 0,
|
|
5016
5370
|
containerPadding: 0,
|
|
5017
|
-
children: /* @__PURE__ */ (0,
|
|
5018
|
-
/* @__PURE__ */ (0,
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5020
|
-
meta ? /* @__PURE__ */ (0,
|
|
5371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react_aria_components40.Dialog, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "pire-launcher-head", children: [
|
|
5373
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
|
|
5374
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-meta", children: meta }) : null
|
|
5021
5375
|
] }),
|
|
5022
5376
|
isSearchable ? (
|
|
5023
5377
|
// autoFocus is right here specifically: the panel exists to be searched, and the
|
|
5024
5378
|
// user just chose to open it, so taking the caret is what they asked for.
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
5379
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5026
5380
|
Input,
|
|
5027
5381
|
{
|
|
5028
5382
|
"aria-label": msg.appLauncherSearch,
|
|
@@ -5036,18 +5390,18 @@ function AppLauncher({
|
|
|
5036
5390
|
}
|
|
5037
5391
|
)
|
|
5038
5392
|
) : null,
|
|
5039
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
5040
|
-
isEmpty ? /* @__PURE__ */ (0,
|
|
5393
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
|
|
5394
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
|
|
5041
5395
|
visible.map((section, si) => (
|
|
5042
5396
|
// Sections are positional zones with no record identity, so the heading is the key
|
|
5043
5397
|
// where there is one. Same reasoning as ShellRail's groups.
|
|
5044
|
-
/* @__PURE__ */ (0,
|
|
5045
|
-
section.label ? /* @__PURE__ */ (0,
|
|
5046
|
-
/* @__PURE__ */ (0,
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "pire-launcher-section", children: [
|
|
5399
|
+
section.label ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-eyebrow", children: section.label }) : null,
|
|
5400
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
|
|
5047
5401
|
const isCurrent = item.id === value;
|
|
5048
5402
|
const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
|
|
5049
|
-
return /* @__PURE__ */ (0,
|
|
5050
|
-
|
|
5403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
5404
|
+
import_react_aria_components40.Button,
|
|
5051
5405
|
{
|
|
5052
5406
|
className: "pire-launcher-item",
|
|
5053
5407
|
"data-selected": isCurrent ? "true" : void 0,
|
|
@@ -5057,16 +5411,16 @@ function AppLauncher({
|
|
|
5057
5411
|
onAction?.(item.id);
|
|
5058
5412
|
},
|
|
5059
5413
|
children: [
|
|
5060
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
5414
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5061
5415
|
Icon,
|
|
5062
5416
|
{
|
|
5063
5417
|
name: item.icon,
|
|
5064
5418
|
size: (section.variant ?? "tile") === "tile" ? 20 : 16
|
|
5065
5419
|
}
|
|
5066
5420
|
) }) : null,
|
|
5067
|
-
/* @__PURE__ */ (0,
|
|
5068
|
-
/* @__PURE__ */ (0,
|
|
5069
|
-
showsDescription ? /* @__PURE__ */ (0,
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "pire-launcher-item-text", children: [
|
|
5422
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-label", children: item.label }),
|
|
5423
|
+
showsDescription ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "pire-launcher-item-desc", children: item.description }) : null
|
|
5070
5424
|
] })
|
|
5071
5425
|
]
|
|
5072
5426
|
},
|
|
@@ -5082,21 +5436,71 @@ function AppLauncher({
|
|
|
5082
5436
|
}
|
|
5083
5437
|
|
|
5084
5438
|
// src/components/patterns/SidePanel.tsx
|
|
5085
|
-
var
|
|
5086
|
-
var
|
|
5439
|
+
var React33 = __toESM(require("react"), 1);
|
|
5440
|
+
var import_react_aria_components41 = require("react-aria-components");
|
|
5441
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5442
|
+
var PHONE_MAX_WIDTH = 600;
|
|
5443
|
+
var narrowQuery = `(max-width: ${PHONE_MAX_WIDTH}px)`;
|
|
5444
|
+
var subscribeNarrow = (notify) => {
|
|
5445
|
+
if (typeof window === "undefined" || !window.matchMedia) return () => {
|
|
5446
|
+
};
|
|
5447
|
+
const query = window.matchMedia(narrowQuery);
|
|
5448
|
+
query.addEventListener("change", notify);
|
|
5449
|
+
return () => query.removeEventListener("change", notify);
|
|
5450
|
+
};
|
|
5451
|
+
var isNarrow = () => typeof window !== "undefined" && !!window.matchMedia && window.matchMedia(narrowQuery).matches;
|
|
5087
5452
|
function SidePanel({
|
|
5088
5453
|
isOpen,
|
|
5089
5454
|
title,
|
|
5090
5455
|
subtitle,
|
|
5091
5456
|
width = 400,
|
|
5457
|
+
presentation = "modal",
|
|
5092
5458
|
children,
|
|
5093
5459
|
footer,
|
|
5094
5460
|
onClose,
|
|
5095
5461
|
className
|
|
5096
5462
|
}) {
|
|
5097
5463
|
const msg = usePireMessages();
|
|
5098
|
-
|
|
5099
|
-
|
|
5464
|
+
const titleId = React33.useId();
|
|
5465
|
+
const narrow = React33.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
|
|
5466
|
+
const head = (heading) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("header", { className: "pire-dialog-head", children: [
|
|
5467
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5468
|
+
heading,
|
|
5469
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null
|
|
5470
|
+
] }),
|
|
5471
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(IconButton, { icon: "x", label: msg.sidePanelClose, size: "sm", onPress: onClose })
|
|
5472
|
+
] });
|
|
5473
|
+
if (presentation === "docked" && !narrow) {
|
|
5474
|
+
if (!isOpen) return null;
|
|
5475
|
+
return (
|
|
5476
|
+
// A named `section` (role `region`) rather than the `aside` the shape suggests: `aside` is a
|
|
5477
|
+
// complementary landmark, which must sit at the top level of the page, and a docked editor
|
|
5478
|
+
// lives inside the app's `main` by definition.
|
|
5479
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
5480
|
+
"section",
|
|
5481
|
+
{
|
|
5482
|
+
className: cx("pire-sidepanel", className),
|
|
5483
|
+
"data-presentation": "docked",
|
|
5484
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
5485
|
+
style: { width },
|
|
5486
|
+
onKeyDown: (e) => {
|
|
5487
|
+
if (e.key !== "Escape" || e.defaultPrevented || e.nativeEvent.isComposing) return;
|
|
5488
|
+
e.preventDefault();
|
|
5489
|
+
onClose?.();
|
|
5490
|
+
},
|
|
5491
|
+
children: [
|
|
5492
|
+
head(
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h2", { id: titleId, className: "pire-dialog-title", children: title })
|
|
5494
|
+
),
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "pire-dialog-body", children }),
|
|
5496
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5497
|
+
]
|
|
5498
|
+
}
|
|
5499
|
+
)
|
|
5500
|
+
);
|
|
5501
|
+
}
|
|
5502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
5503
|
+
import_react_aria_components41.ModalOverlay,
|
|
5100
5504
|
{
|
|
5101
5505
|
className: "pire-sidepanel-overlay",
|
|
5102
5506
|
isOpen,
|
|
@@ -5104,23 +5508,19 @@ function SidePanel({
|
|
|
5104
5508
|
onOpenChange: (o) => {
|
|
5105
5509
|
if (!o) onClose?.();
|
|
5106
5510
|
},
|
|
5107
|
-
children: /* @__PURE__ */ (0,
|
|
5108
|
-
|
|
5109
|
-
/* @__PURE__ */ (0,
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(IconButton, { icon: "x", label: msg.sidePanelClose, size: "sm", onPress: onClose })
|
|
5114
|
-
] }),
|
|
5115
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-dialog-body", style: { flex: 1 }, children }),
|
|
5116
|
-
footer ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react_aria_components41.Modal, { className: cx("pire-sidepanel", className), style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_react_aria_components41.Dialog, { className: "pire-dialog", style: { height: "100%" }, children: [
|
|
5512
|
+
head(
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react_aria_components41.Heading, { slot: "title", className: "pire-dialog-title", children: title })
|
|
5514
|
+
),
|
|
5515
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "pire-dialog-body", style: { flex: 1 }, children }),
|
|
5516
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5117
5517
|
] }) })
|
|
5118
5518
|
}
|
|
5119
5519
|
);
|
|
5120
5520
|
}
|
|
5121
5521
|
|
|
5122
5522
|
// src/components/patterns/EmptyState.tsx
|
|
5123
|
-
var
|
|
5523
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
5124
5524
|
function EmptyState({
|
|
5125
5525
|
icon = "file-text",
|
|
5126
5526
|
title,
|
|
@@ -5130,18 +5530,18 @@ function EmptyState({
|
|
|
5130
5530
|
className,
|
|
5131
5531
|
...rest
|
|
5132
5532
|
}) {
|
|
5133
|
-
return /* @__PURE__ */ (0,
|
|
5134
|
-
/* @__PURE__ */ (0,
|
|
5135
|
-
title ? /* @__PURE__ */ (0,
|
|
5136
|
-
children ? /* @__PURE__ */ (0,
|
|
5533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: cx("pire-empty", className), "data-compact": compact ? "true" : void 0, ...rest, children: [
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Icon, { name: icon, size: 24, className: "pire-empty-icon" }),
|
|
5535
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "pire-empty-title", style: { margin: 0 }, children: title }) : null,
|
|
5536
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "pire-empty-body", style: { margin: 0 }, children }) : null,
|
|
5137
5537
|
action
|
|
5138
5538
|
] });
|
|
5139
5539
|
}
|
|
5140
5540
|
|
|
5141
5541
|
// src/components/patterns/NumPad.tsx
|
|
5142
|
-
var
|
|
5143
|
-
var
|
|
5144
|
-
var
|
|
5542
|
+
var React34 = __toESM(require("react"), 1);
|
|
5543
|
+
var import_react_aria_components42 = require("react-aria-components");
|
|
5544
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5145
5545
|
var BASE_KEYS = [
|
|
5146
5546
|
{ value: "7" },
|
|
5147
5547
|
{ value: "8" },
|
|
@@ -5164,9 +5564,9 @@ function fittingDigits(digits, buffer, separator, maxFractionDigits) {
|
|
|
5164
5564
|
return room <= 0 ? "" : digits.slice(0, room);
|
|
5165
5565
|
}
|
|
5166
5566
|
function useNumPadKeyboard(onKey, isDisabled, containerRef) {
|
|
5167
|
-
const handler =
|
|
5567
|
+
const handler = React34.useRef(onKey);
|
|
5168
5568
|
handler.current = onKey;
|
|
5169
|
-
|
|
5569
|
+
React34.useEffect(() => {
|
|
5170
5570
|
if (isDisabled) return;
|
|
5171
5571
|
const isEditingElsewhere = () => {
|
|
5172
5572
|
const el = document.activeElement;
|
|
@@ -5213,11 +5613,11 @@ function NumPad({
|
|
|
5213
5613
|
style
|
|
5214
5614
|
}) {
|
|
5215
5615
|
const msg = usePireMessages();
|
|
5216
|
-
const containerRef =
|
|
5217
|
-
const { locale } = (0,
|
|
5616
|
+
const containerRef = React34.useRef(null);
|
|
5617
|
+
const { locale } = (0, import_react_aria_components42.useLocale)();
|
|
5218
5618
|
const separator = decimalSeparatorFor(locale);
|
|
5219
5619
|
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5220
|
-
const applyKey =
|
|
5620
|
+
const applyKey = React34.useCallback(
|
|
5221
5621
|
(key) => {
|
|
5222
5622
|
if (isDisabled) return;
|
|
5223
5623
|
if (key.value === "backspace") {
|
|
@@ -5249,7 +5649,7 @@ function NumPad({
|
|
|
5249
5649
|
...allowsDecimal ? [{ value: "decimal", label: separator }] : [],
|
|
5250
5650
|
...extraKeys
|
|
5251
5651
|
];
|
|
5252
|
-
return /* @__PURE__ */ (0,
|
|
5652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
5253
5653
|
"div",
|
|
5254
5654
|
{
|
|
5255
5655
|
ref: containerRef,
|
|
@@ -5258,10 +5658,10 @@ function NumPad({
|
|
|
5258
5658
|
"data-size": size,
|
|
5259
5659
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
5260
5660
|
children: [
|
|
5261
|
-
target !== void 0 ? /* @__PURE__ */ (0,
|
|
5262
|
-
/* @__PURE__ */ (0,
|
|
5661
|
+
target !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "pire-numpad-target", role: "status", "aria-live": "polite", children: target }) : null,
|
|
5662
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "pire-numpad-grid", role: "group", "aria-label": ariaLabel, children: keys.map((key) => {
|
|
5263
5663
|
const accessibleLabel = key.value === "backspace" ? msg.numPadBackspace : key.value === "clear" ? msg.numPadClear : key.value === "decimal" ? msg.numPadDecimal : void 0;
|
|
5264
|
-
return /* @__PURE__ */ (0,
|
|
5664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5265
5665
|
Button,
|
|
5266
5666
|
{
|
|
5267
5667
|
variant: "secondary",
|
|
@@ -5284,9 +5684,9 @@ function NumPad({
|
|
|
5284
5684
|
}
|
|
5285
5685
|
|
|
5286
5686
|
// src/components/patterns/FileDropZone.tsx
|
|
5287
|
-
var
|
|
5288
|
-
var
|
|
5289
|
-
var
|
|
5687
|
+
var React35 = __toESM(require("react"), 1);
|
|
5688
|
+
var import_react_aria_components43 = require("react-aria-components");
|
|
5689
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
5290
5690
|
var isImage2 = (file) => file.type.startsWith("image/");
|
|
5291
5691
|
function FileDropZone({
|
|
5292
5692
|
label,
|
|
@@ -5314,10 +5714,10 @@ function FileDropZone({
|
|
|
5314
5714
|
...rest
|
|
5315
5715
|
}) {
|
|
5316
5716
|
const msg = usePireMessages();
|
|
5317
|
-
const [uncontrolled, setUncontrolled] =
|
|
5717
|
+
const [uncontrolled, setUncontrolled] = React35.useState(defaultValue ?? []);
|
|
5318
5718
|
const files = value ?? uncontrolled;
|
|
5319
|
-
const created =
|
|
5320
|
-
|
|
5719
|
+
const created = React35.useRef([]);
|
|
5720
|
+
React35.useEffect(
|
|
5321
5721
|
() => () => {
|
|
5322
5722
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
5323
5723
|
},
|
|
@@ -5340,42 +5740,42 @@ function FileDropZone({
|
|
|
5340
5740
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
5341
5741
|
};
|
|
5342
5742
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
5343
|
-
return /* @__PURE__ */ (0,
|
|
5344
|
-
label ? /* @__PURE__ */ (0,
|
|
5743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
5744
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "pire-field-label", children: [
|
|
5345
5745
|
label,
|
|
5346
|
-
isRequired ? /* @__PURE__ */ (0,
|
|
5746
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
5347
5747
|
] }) : null,
|
|
5348
|
-
/* @__PURE__ */ (0,
|
|
5349
|
-
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
5749
|
+
import_react_aria_components43.DropZone,
|
|
5350
5750
|
{
|
|
5351
5751
|
className: "pire-dropzone",
|
|
5352
5752
|
"aria-label": ariaLabel,
|
|
5353
5753
|
"data-height": height,
|
|
5354
5754
|
isDisabled: isDisabled || isReadOnly,
|
|
5355
5755
|
onDrop: async (e) => {
|
|
5356
|
-
const dropped = await Promise.all(e.items.filter(
|
|
5756
|
+
const dropped = await Promise.all(e.items.filter(import_react_aria_components43.isFileDropItem).map((item) => item.getFile()));
|
|
5357
5757
|
accept(dropped);
|
|
5358
5758
|
},
|
|
5359
5759
|
children: [
|
|
5360
|
-
/* @__PURE__ */ (0,
|
|
5361
|
-
/* @__PURE__ */ (0,
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5363
|
-
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { name: "download", size: 24, className: "pire-dropzone-icon" }),
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-dropzone-prompt", children: promptLabel ?? msg.fileDropZonePrompt }),
|
|
5762
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5763
|
+
import_react_aria_components43.FileTrigger,
|
|
5364
5764
|
{
|
|
5365
5765
|
acceptedFileTypes,
|
|
5366
5766
|
allowsMultiple,
|
|
5367
5767
|
onSelect: (list) => accept(list ? [...list] : []),
|
|
5368
|
-
children: /* @__PURE__ */ (0,
|
|
5768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, children: msg.fileUploadChoose })
|
|
5369
5769
|
}
|
|
5370
5770
|
)
|
|
5371
5771
|
]
|
|
5372
5772
|
}
|
|
5373
5773
|
),
|
|
5374
|
-
files.length ? /* @__PURE__ */ (0,
|
|
5375
|
-
previewUrl ? /* @__PURE__ */ (0,
|
|
5376
|
-
/* @__PURE__ */ (0,
|
|
5377
|
-
/* @__PURE__ */ (0,
|
|
5378
|
-
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0,
|
|
5774
|
+
files.length ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("li", { className: "pire-fileupload-item", children: [
|
|
5775
|
+
previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
5776
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-fileupload-name", children: file.name }),
|
|
5777
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
5778
|
+
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
5379
5779
|
IconButton,
|
|
5380
5780
|
{
|
|
5381
5781
|
icon: "x",
|
|
@@ -5385,15 +5785,15 @@ function FileDropZone({
|
|
|
5385
5785
|
}
|
|
5386
5786
|
)
|
|
5387
5787
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
5388
|
-
uploadProgress != null ? /* @__PURE__ */ (0,
|
|
5389
|
-
description ? /* @__PURE__ */ (0,
|
|
5390
|
-
isInvalid && errorMessage ? /* @__PURE__ */ (0,
|
|
5788
|
+
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
5789
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-hint", children: description }) : null,
|
|
5790
|
+
isInvalid && errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
5391
5791
|
] });
|
|
5392
5792
|
}
|
|
5393
5793
|
|
|
5394
5794
|
// src/index.ts
|
|
5395
|
-
var import_react_aria_components43 = require("react-aria-components");
|
|
5396
5795
|
var import_react_aria_components44 = require("react-aria-components");
|
|
5796
|
+
var import_react_aria_components45 = require("react-aria-components");
|
|
5397
5797
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5398
5798
|
0 && (module.exports = {
|
|
5399
5799
|
AppLauncher,
|