@orianatech/pire 2.1.1 → 2.2.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/Avatar.d.ts +0 -1
- package/dist/components/core/Badge.d.cts +2 -5
- package/dist/components/core/Badge.d.ts +2 -6
- package/dist/components/core/Button.d.ts +0 -1
- package/dist/components/core/Card.d.ts +0 -1
- package/dist/components/core/ComingSoonMark.d.ts +0 -1
- package/dist/components/core/Heading.d.cts +1 -1
- package/dist/components/core/Heading.d.ts +1 -2
- package/dist/components/core/Icon.d.cts +1 -2
- package/dist/components/core/Icon.d.ts +1 -3
- package/dist/components/core/IconButton.d.ts +0 -1
- package/dist/components/core/Kbd.d.ts +0 -1
- package/dist/components/core/Link.d.ts +0 -1
- package/dist/components/core/SegmentedControl.d.cts +1 -1
- package/dist/components/core/SegmentedControl.d.ts +1 -2
- package/dist/components/core/Separator.d.ts +0 -1
- package/dist/components/core/Tag.d.cts +1 -1
- package/dist/components/core/Tag.d.ts +1 -2
- package/dist/components/core/Text.d.cts +9 -1
- package/dist/components/core/Text.d.ts +9 -2
- package/dist/components/core/icon-data.generated.d.ts +0 -1
- package/dist/components/core/icon-map.d.ts +0 -1
- package/dist/components/data/BarChart.d.cts +1 -1
- package/dist/components/data/BarChart.d.ts +1 -2
- package/dist/components/data/BarList.d.ts +0 -1
- package/dist/components/data/ChartFrame.d.ts +0 -1
- package/dist/components/data/DataTable.d.cts +1 -1
- package/dist/components/data/DataTable.d.ts +1 -2
- package/dist/components/data/DescriptionList.d.ts +0 -1
- package/dist/components/data/DonutChart.d.cts +1 -1
- package/dist/components/data/DonutChart.d.ts +1 -2
- package/dist/components/data/FilterBar.d.ts +0 -1
- package/dist/components/data/KpiTile.d.ts +0 -1
- package/dist/components/data/LineChart.d.cts +1 -1
- package/dist/components/data/LineChart.d.ts +1 -2
- package/dist/components/data/LinkList.d.ts +0 -1
- package/dist/components/data/ObjectHeader.d.ts +0 -1
- package/dist/components/data/RecordCard.d.ts +0 -1
- package/dist/components/data/Timeline.d.ts +0 -1
- package/dist/components/data/ViewSwitcher.d.ts +0 -1
- package/dist/components/data/chartGeometry.d.ts +0 -1
- package/dist/components/feedback/Dialog.d.cts +11 -0
- package/dist/components/feedback/Dialog.d.ts +11 -1
- package/dist/components/feedback/InlineMessage.d.cts +2 -0
- package/dist/components/feedback/InlineMessage.d.ts +2 -1
- package/dist/components/feedback/ProgressBar.d.ts +0 -1
- package/dist/components/feedback/Skeleton.d.ts +0 -1
- package/dist/components/feedback/Toast.d.cts +1 -1
- package/dist/components/feedback/Toast.d.ts +1 -2
- package/dist/components/feedback/Tooltip.d.ts +0 -1
- package/dist/components/forms/CalendarMonth.d.cts +6 -0
- package/dist/components/forms/CalendarMonth.d.ts +6 -0
- package/dist/components/forms/Checkbox.d.ts +0 -1
- package/dist/components/forms/ChoiceCardGroup.d.cts +3 -12
- package/dist/components/forms/ChoiceCardGroup.d.ts +3 -13
- package/dist/components/forms/ComboBox.d.cts +2 -11
- package/dist/components/forms/ComboBox.d.ts +2 -12
- package/dist/components/forms/ComboBoxListBox.d.cts +35 -0
- package/dist/components/forms/ComboBoxListBox.d.ts +35 -0
- package/dist/components/forms/DatePicker.d.cts +3 -13
- package/dist/components/forms/DatePicker.d.ts +3 -14
- package/dist/components/forms/DateRangePicker.d.cts +5 -15
- package/dist/components/forms/DateRangePicker.d.ts +5 -16
- package/dist/components/forms/FieldClearButton.d.cts +12 -0
- package/dist/components/forms/FieldClearButton.d.ts +12 -0
- package/dist/components/forms/FieldDescription.d.ts +0 -1
- package/dist/components/forms/FieldHelp.d.cts +23 -0
- package/dist/components/forms/FieldHelp.d.ts +23 -1
- package/dist/components/forms/FieldLabel.d.cts +2 -5
- package/dist/components/forms/FieldLabel.d.ts +2 -6
- package/dist/components/forms/FileUpload.d.cts +37 -4
- package/dist/components/forms/FileUpload.d.ts +37 -5
- package/dist/components/forms/FormField.d.ts +0 -1
- package/dist/components/forms/Input.d.cts +2 -11
- package/dist/components/forms/Input.d.ts +2 -12
- package/dist/components/forms/MultiComboBox.d.cts +2 -11
- package/dist/components/forms/MultiComboBox.d.ts +2 -12
- package/dist/components/forms/NumberField.d.cts +3 -13
- package/dist/components/forms/NumberField.d.ts +3 -14
- package/dist/components/forms/QuantityStepper.d.ts +0 -1
- package/dist/components/forms/Radio.d.ts +0 -1
- package/dist/components/forms/Select.d.cts +2 -11
- package/dist/components/forms/Select.d.ts +2 -12
- package/dist/components/forms/Switch.d.ts +0 -1
- package/dist/components/forms/TextArea.d.cts +2 -11
- package/dist/components/forms/TextArea.d.ts +2 -12
- package/dist/components/forms/ValueHelpField.d.cts +7 -3
- package/dist/components/forms/ValueHelpField.d.ts +7 -4
- package/dist/components/forms/dateValues.d.cts +2 -5
- package/dist/components/forms/dateValues.d.ts +2 -6
- package/dist/components/layout/FooterBar.d.ts +0 -1
- package/dist/components/layout/PageBand.d.ts +0 -1
- package/dist/components/layout/PageHeader.d.ts +0 -1
- package/dist/components/layout/SectionHeader.d.ts +0 -1
- package/dist/components/layout/SelectionBar.d.cts +1 -2
- package/dist/components/layout/SelectionBar.d.ts +1 -3
- package/dist/components/layout/SplitPane.d.ts +0 -1
- package/dist/components/navigation/Breadcrumb.d.ts +0 -1
- package/dist/components/navigation/Menu.d.ts +0 -1
- package/dist/components/navigation/Pagination.d.ts +0 -1
- package/dist/components/navigation/Ribbon.d.cts +1 -1
- package/dist/components/navigation/Ribbon.d.ts +1 -2
- package/dist/components/navigation/ShellBar.d.ts +0 -1
- package/dist/components/navigation/ShellRail.d.ts +0 -1
- package/dist/components/navigation/SideNav.d.cts +3 -6
- package/dist/components/navigation/SideNav.d.ts +3 -7
- package/dist/components/navigation/Tabs.d.cts +1 -1
- package/dist/components/navigation/Tabs.d.ts +1 -2
- package/dist/components/patterns/AppLauncher.d.cts +1 -2
- package/dist/components/patterns/AppLauncher.d.ts +1 -3
- package/dist/components/patterns/CommandPalette.d.ts +0 -1
- package/dist/components/patterns/ConfirmDialog.d.ts +0 -1
- package/dist/components/patterns/EmptyState.d.ts +0 -1
- package/dist/components/patterns/FileDropZone.d.cts +1 -1
- package/dist/components/patterns/FileDropZone.d.ts +1 -2
- package/dist/components/patterns/NumPad.d.cts +2 -8
- package/dist/components/patterns/NumPad.d.ts +2 -9
- package/dist/components/patterns/SidePanel.d.ts +0 -1
- package/dist/components/patterns/ValueHelpDialog.d.cts +5 -5
- package/dist/components/patterns/ValueHelpDialog.d.ts +5 -6
- package/dist/components/utils/cx.d.ts +0 -1
- package/dist/components/utils/decimalSeparator.d.cts +1 -4
- package/dist/components/utils/decimalSeparator.d.ts +1 -5
- package/dist/components/utils/devWarn.d.cts +5 -3
- package/dist/components/utils/devWarn.d.ts +5 -4
- package/dist/components/utils/useDocumentKeyDown.d.cts +5 -0
- package/dist/components/utils/useDocumentKeyDown.d.ts +5 -0
- package/dist/components/utils/useLoadMoreOnScroll.d.ts +0 -1
- package/dist/components.css +139 -85
- package/dist/i18n/PireIntlProvider.d.ts +0 -1
- package/dist/i18n/messages.d.ts +0 -1
- package/dist/index.cjs +1272 -1342
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1171 -1264
- package/dist/index.js.map +1 -1
- package/dist/tokens/base.css +2 -5
- package/dist/tokens/colors.css +13 -8
- package/dist/tokens/elevation.css +15 -0
- package/dist/tokens/themes.css +6 -12
- package/package.json +1 -1
- package/dist/components/core/Avatar.d.ts.map +0 -1
- package/dist/components/core/Badge.d.ts.map +0 -1
- package/dist/components/core/Button.d.ts.map +0 -1
- package/dist/components/core/Card.d.ts.map +0 -1
- package/dist/components/core/ComingSoonMark.d.ts.map +0 -1
- package/dist/components/core/Heading.d.ts.map +0 -1
- package/dist/components/core/Icon.d.ts.map +0 -1
- package/dist/components/core/IconButton.d.ts.map +0 -1
- package/dist/components/core/Kbd.d.ts.map +0 -1
- package/dist/components/core/Link.d.ts.map +0 -1
- package/dist/components/core/SegmentedControl.d.ts.map +0 -1
- package/dist/components/core/Separator.d.ts.map +0 -1
- package/dist/components/core/Tag.d.ts.map +0 -1
- package/dist/components/core/Text.d.ts.map +0 -1
- package/dist/components/core/icon-data.generated.d.ts.map +0 -1
- package/dist/components/core/icon-map.d.ts.map +0 -1
- package/dist/components/data/BarChart.d.ts.map +0 -1
- package/dist/components/data/BarList.d.ts.map +0 -1
- package/dist/components/data/ChartFrame.d.ts.map +0 -1
- package/dist/components/data/DataTable.d.ts.map +0 -1
- package/dist/components/data/DescriptionList.d.ts.map +0 -1
- package/dist/components/data/DonutChart.d.ts.map +0 -1
- package/dist/components/data/FilterBar.d.ts.map +0 -1
- package/dist/components/data/KpiTile.d.ts.map +0 -1
- package/dist/components/data/LineChart.d.ts.map +0 -1
- package/dist/components/data/LinkList.d.ts.map +0 -1
- package/dist/components/data/ObjectHeader.d.ts.map +0 -1
- package/dist/components/data/RecordCard.d.ts.map +0 -1
- package/dist/components/data/Timeline.d.ts.map +0 -1
- package/dist/components/data/ViewSwitcher.d.ts.map +0 -1
- package/dist/components/data/chartGeometry.d.ts.map +0 -1
- package/dist/components/feedback/Dialog.d.ts.map +0 -1
- package/dist/components/feedback/InlineMessage.d.ts.map +0 -1
- package/dist/components/feedback/ProgressBar.d.ts.map +0 -1
- package/dist/components/feedback/Skeleton.d.ts.map +0 -1
- package/dist/components/feedback/Toast.d.ts.map +0 -1
- package/dist/components/feedback/Tooltip.d.ts.map +0 -1
- package/dist/components/forms/Checkbox.d.ts.map +0 -1
- package/dist/components/forms/ChoiceCardGroup.d.ts.map +0 -1
- package/dist/components/forms/ComboBox.d.ts.map +0 -1
- package/dist/components/forms/DatePicker.d.ts.map +0 -1
- package/dist/components/forms/DateRangePicker.d.ts.map +0 -1
- package/dist/components/forms/FieldDescription.d.ts.map +0 -1
- package/dist/components/forms/FieldHelp.d.ts.map +0 -1
- package/dist/components/forms/FieldLabel.d.ts.map +0 -1
- package/dist/components/forms/FileUpload.d.ts.map +0 -1
- package/dist/components/forms/FormField.d.ts.map +0 -1
- package/dist/components/forms/Input.d.ts.map +0 -1
- package/dist/components/forms/MultiComboBox.d.ts.map +0 -1
- package/dist/components/forms/NumberField.d.ts.map +0 -1
- package/dist/components/forms/QuantityStepper.d.ts.map +0 -1
- package/dist/components/forms/Radio.d.ts.map +0 -1
- package/dist/components/forms/Select.d.ts.map +0 -1
- package/dist/components/forms/Switch.d.ts.map +0 -1
- package/dist/components/forms/TextArea.d.ts.map +0 -1
- package/dist/components/forms/ValueHelpField.d.ts.map +0 -1
- package/dist/components/forms/dateValues.d.ts.map +0 -1
- package/dist/components/layout/FooterBar.d.ts.map +0 -1
- package/dist/components/layout/PageBand.d.ts.map +0 -1
- package/dist/components/layout/PageHeader.d.ts.map +0 -1
- package/dist/components/layout/SectionHeader.d.ts.map +0 -1
- package/dist/components/layout/SelectionBar.d.ts.map +0 -1
- package/dist/components/layout/SplitPane.d.ts.map +0 -1
- package/dist/components/navigation/Breadcrumb.d.ts.map +0 -1
- package/dist/components/navigation/Menu.d.ts.map +0 -1
- package/dist/components/navigation/Pagination.d.ts.map +0 -1
- package/dist/components/navigation/Ribbon.d.ts.map +0 -1
- package/dist/components/navigation/ShellBar.d.ts.map +0 -1
- package/dist/components/navigation/ShellRail.d.ts.map +0 -1
- package/dist/components/navigation/SideNav.d.ts.map +0 -1
- package/dist/components/navigation/Tabs.d.ts.map +0 -1
- package/dist/components/patterns/AppLauncher.d.ts.map +0 -1
- package/dist/components/patterns/CommandPalette.d.ts.map +0 -1
- package/dist/components/patterns/ConfirmDialog.d.ts.map +0 -1
- package/dist/components/patterns/EmptyState.d.ts.map +0 -1
- package/dist/components/patterns/FileDropZone.d.ts.map +0 -1
- package/dist/components/patterns/NumPad.d.ts.map +0 -1
- package/dist/components/patterns/SidePanel.d.ts.map +0 -1
- package/dist/components/patterns/ValueHelpDialog.d.ts.map +0 -1
- package/dist/components/utils/cx.d.ts.map +0 -1
- package/dist/components/utils/decimalSeparator.d.ts.map +0 -1
- package/dist/components/utils/devWarn.d.ts.map +0 -1
- package/dist/components/utils/focusField.d.cts +0 -11
- package/dist/components/utils/focusField.d.ts +0 -12
- package/dist/components/utils/focusField.d.ts.map +0 -1
- package/dist/components/utils/useLoadMoreOnScroll.d.ts.map +0 -1
- package/dist/i18n/PireIntlProvider.d.ts.map +0 -1
- package/dist/i18n/messages.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -311,8 +311,7 @@ var CARBON_MAP = {
|
|
|
311
311
|
};
|
|
312
312
|
var ICON_NAMES = Object.freeze(Object.keys(CARBON_MAP).sort());
|
|
313
313
|
|
|
314
|
-
// src/components/
|
|
315
|
-
import { jsx } from "react/jsx-runtime";
|
|
314
|
+
// src/components/utils/devWarn.ts
|
|
316
315
|
var IS_DEV = process.env.NODE_ENV !== "production";
|
|
317
316
|
var warned = /* @__PURE__ */ new Set();
|
|
318
317
|
function warnOnce(key, message) {
|
|
@@ -320,19 +319,22 @@ function warnOnce(key, message) {
|
|
|
320
319
|
warned.add(key);
|
|
321
320
|
console.warn(`[pire] ${message}`);
|
|
322
321
|
}
|
|
322
|
+
|
|
323
|
+
// src/components/core/Icon.tsx
|
|
324
|
+
import { jsx } from "react/jsx-runtime";
|
|
323
325
|
var config = {};
|
|
324
326
|
function configureIcons(next) {
|
|
325
327
|
config = { ...config, ...next };
|
|
326
328
|
if (!IS_DEV) return;
|
|
327
329
|
if (next.base !== void 0) {
|
|
328
330
|
warnOnce(
|
|
329
|
-
"config:base",
|
|
331
|
+
"icon:config:base",
|
|
330
332
|
"configureIcons({ base }) is ignored: glyphs are inlined in the bundle and no longer fetched over the network. Remove the call, and the self-hosted SVGs it pointed at."
|
|
331
333
|
);
|
|
332
334
|
}
|
|
333
335
|
if (next.pack !== void 0) {
|
|
334
336
|
warnOnce(
|
|
335
|
-
"config:pack",
|
|
337
|
+
"icon:config:pack",
|
|
336
338
|
"configureIcons({ pack }) is ignored: the bundled Carbon pack is the only pack. Use configureIcons({ resolve }) to supply a glyph Pire does not ship."
|
|
337
339
|
);
|
|
338
340
|
}
|
|
@@ -342,13 +344,13 @@ function Icon({ name, size = 16, label, pack, style, ...rest }) {
|
|
|
342
344
|
if (IS_DEV) {
|
|
343
345
|
if (pack !== void 0) {
|
|
344
346
|
warnOnce(
|
|
345
|
-
"prop:pack",
|
|
347
|
+
"icon:prop:pack",
|
|
346
348
|
"The Icon `pack` prop is ignored: the bundled Carbon pack is the only pack. Drop the prop."
|
|
347
349
|
);
|
|
348
350
|
}
|
|
349
351
|
if (markup === void 0) {
|
|
350
352
|
warnOnce(
|
|
351
|
-
`missing:${name}`,
|
|
353
|
+
`icon:missing:${name}`,
|
|
352
354
|
`Unknown icon name "${name}" \u2014 nothing will render. Add it to CARBON_MAP in src/components/core/icon-map.ts and rebuild, or register it with configureIcons({ resolve }).`
|
|
353
355
|
);
|
|
354
356
|
}
|
|
@@ -364,8 +366,7 @@ function Icon({ name, size = 16, label, pack, style, ...rest }) {
|
|
|
364
366
|
style: { display: "inline-block", flex: "0 0 auto", width: size, height: size, ...style },
|
|
365
367
|
children: markup === void 0 ? (
|
|
366
368
|
// A broken icon has to look broken. In development the box gets a dashed outline so the
|
|
367
|
-
// gap is visible on screen instead of only in a console warning that is easy to lose
|
|
368
|
-
// busy log — which is how a missing `credit-card` reached production as a blank square.
|
|
369
|
+
// gap is visible on screen instead of only in a console warning that is easy to lose.
|
|
369
370
|
// Production still renders nothing at all: a dev diagnostic must never become a user's
|
|
370
371
|
// first sight of a defect. Deliberately not an <svg>, so nothing reads it as a real glyph.
|
|
371
372
|
IS_DEV ? /* @__PURE__ */ jsx("span", { className: "pire-icon-missing", title: `Unknown icon: ${name}` }) : null
|
|
@@ -705,17 +706,8 @@ function Tooltip({ label, placement = "top", delay = 500, children }) {
|
|
|
705
706
|
) ? children.props : void 0;
|
|
706
707
|
const isDisabledChild = props?.isDisabled === true || props?.disabled === true;
|
|
707
708
|
const target = React3.isValidElement(children) && !isDisabledChild ? React3.cloneElement(children, { className: cx(children.props.className, "pire-tooltip-target") }) : isDisabledChild ? (
|
|
708
|
-
// `
|
|
709
|
-
//
|
|
710
|
-
// control this wraps (`IconButton`, `Button`, …) is button-shaped, so `role="button"` plus
|
|
711
|
-
// `aria-disabled` describes the wrapper the same way its disabled child already describes
|
|
712
|
-
// itself, and is what lets the accessible name (from the child's own text or `aria-label`)
|
|
713
|
-
// reach the element that actually holds focus. No static `tabIndex` here on purpose: it
|
|
714
|
-
// would win over the one `Focusable` computes at clone time (react-aria's `mergeProps` lets
|
|
715
|
-
// a prop already on this element beat the one it supplies), silently making the span
|
|
716
|
-
// unfocusable again and reintroducing the defect this file exists to fix. A real `<button>`
|
|
717
|
-
// is not an option either: `children` is very often a button itself (`IconButton`), and a
|
|
718
|
-
// button nested in a button is invalid HTML that browsers repair by breaking the DOM tree.
|
|
709
|
+
// `role="button"` + `aria-disabled` for the reasons in the JSDoc above. No static tabIndex: it
|
|
710
|
+
// would beat the one Focusable merges in. Not a `<button>`: the child often is one.
|
|
719
711
|
// biome-ignore lint/a11y/useFocusableInteractive: tabIndex is added by Focusable's clone, not statically — see above.
|
|
720
712
|
// biome-ignore lint/a11y/useSemanticElements: a real <button> would nest inside the disabled child, which is often one itself — see above.
|
|
721
713
|
/* @__PURE__ */ jsx5("span", { className: "pire-tooltip-target", role: "button", "aria-disabled": "true", children })
|
|
@@ -835,12 +827,12 @@ function Card({
|
|
|
835
827
|
...rest,
|
|
836
828
|
children: [
|
|
837
829
|
title || actions ? /* @__PURE__ */ jsxs7("header", { className: "pire-card-head", children: [
|
|
838
|
-
icon ? /* @__PURE__ */ jsx9(Icon, { name: icon, size: 20,
|
|
839
|
-
/* @__PURE__ */ jsxs7("div", {
|
|
830
|
+
icon ? /* @__PURE__ */ jsx9(Icon, { name: icon, size: 20, className: "pire-card-icon" }) : null,
|
|
831
|
+
/* @__PURE__ */ jsxs7("div", { className: "pire-card-heading", children: [
|
|
840
832
|
/* @__PURE__ */ jsx9("h3", { className: "pire-card-title", children: title }),
|
|
841
|
-
subtitle ? /* @__PURE__ */ jsx9("p", { className: "pire-card-sub",
|
|
833
|
+
subtitle ? /* @__PURE__ */ jsx9("p", { className: "pire-card-sub", children: subtitle }) : null
|
|
842
834
|
] }),
|
|
843
|
-
actions ? /* @__PURE__ */ jsx9("div", {
|
|
835
|
+
actions ? /* @__PURE__ */ jsx9("div", { className: "pire-card-actions", children: actions }) : null
|
|
844
836
|
] }) : null,
|
|
845
837
|
children ? /* @__PURE__ */ jsx9("div", { className: "pire-card-body", children }) : null,
|
|
846
838
|
footer ? /* @__PURE__ */ jsx9("footer", { className: "pire-card-foot", children: footer }) : null
|
|
@@ -855,15 +847,7 @@ import { jsx as jsx10 } from "react/jsx-runtime";
|
|
|
855
847
|
var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
856
848
|
function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
857
849
|
const [failed, setFailed] = React7.useState(false);
|
|
858
|
-
return /* @__PURE__ */ jsx10("span", { className: cx("pire-avatar", className), "data-size": size, role: "img", "aria-label": name, ...rest, children: src && !failed ? /* @__PURE__ */ jsx10(
|
|
859
|
-
"img",
|
|
860
|
-
{
|
|
861
|
-
src,
|
|
862
|
-
alt: "",
|
|
863
|
-
onError: () => setFailed(true),
|
|
864
|
-
style: { width: "100%", height: "100%", borderRadius: "inherit", objectFit: "cover" }
|
|
865
|
-
}
|
|
866
|
-
) : initials(name) });
|
|
850
|
+
return /* @__PURE__ */ jsx10("span", { className: cx("pire-avatar", className), "data-size": size, role: "img", "aria-label": name, ...rest, children: src && !failed ? /* @__PURE__ */ jsx10("img", { src, alt: "", className: "pire-avatar-img", onError: () => setFailed(true) }) : initials(name) });
|
|
867
851
|
}
|
|
868
852
|
|
|
869
853
|
// src/components/core/SegmentedControl.tsx
|
|
@@ -879,7 +863,7 @@ function SegmentedControl({
|
|
|
879
863
|
size = "sm",
|
|
880
864
|
className,
|
|
881
865
|
style,
|
|
882
|
-
|
|
866
|
+
"aria-label": ariaLabel
|
|
883
867
|
}) {
|
|
884
868
|
const selected = React8.useMemo(
|
|
885
869
|
() => new Set(value ? [value] : defaultValue ? [defaultValue] : []),
|
|
@@ -891,7 +875,7 @@ function SegmentedControl({
|
|
|
891
875
|
className: cx("pire-segmented", className),
|
|
892
876
|
"data-size": size,
|
|
893
877
|
style,
|
|
894
|
-
"aria-label":
|
|
878
|
+
"aria-label": ariaLabel,
|
|
895
879
|
selectionMode: "single",
|
|
896
880
|
disallowEmptySelection: true,
|
|
897
881
|
selectedKeys: selected,
|
|
@@ -920,6 +904,11 @@ function SegmentedControl({
|
|
|
920
904
|
// src/components/core/Text.tsx
|
|
921
905
|
import * as React9 from "react";
|
|
922
906
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
907
|
+
function truncateStyle(truncate, style) {
|
|
908
|
+
const lines = typeof truncate === "number" ? truncate : truncate ? 1 : void 0;
|
|
909
|
+
if (lines == null) return { isTruncated: false, clampStyle: style };
|
|
910
|
+
return { isTruncated: true, clampStyle: { ["--pire-text-clamp"]: lines, ...style } };
|
|
911
|
+
}
|
|
923
912
|
var Text = React9.forwardRef(function Text2({
|
|
924
913
|
size = "body",
|
|
925
914
|
color = "primary",
|
|
@@ -932,8 +921,7 @@ var Text = React9.forwardRef(function Text2({
|
|
|
932
921
|
style,
|
|
933
922
|
...rest
|
|
934
923
|
}, ref) {
|
|
935
|
-
const
|
|
936
|
-
const clampStyle = lineClamp == null ? style : { ["--pire-text-clamp"]: lineClamp, ...style };
|
|
924
|
+
const { isTruncated, clampStyle } = truncateStyle(truncate, style);
|
|
937
925
|
return /* @__PURE__ */ jsx12(
|
|
938
926
|
Wrapper,
|
|
939
927
|
{
|
|
@@ -944,7 +932,7 @@ var Text = React9.forwardRef(function Text2({
|
|
|
944
932
|
"data-weight": weight === "strong" ? "strong" : void 0,
|
|
945
933
|
"data-numeric": numeric ? "true" : void 0,
|
|
946
934
|
"data-eyebrow": eyebrow ? "true" : void 0,
|
|
947
|
-
"data-truncate":
|
|
935
|
+
"data-truncate": isTruncated ? "true" : void 0,
|
|
948
936
|
style: clampStyle,
|
|
949
937
|
...rest
|
|
950
938
|
}
|
|
@@ -966,8 +954,7 @@ function Heading({
|
|
|
966
954
|
style,
|
|
967
955
|
...rest
|
|
968
956
|
}) {
|
|
969
|
-
const
|
|
970
|
-
const clampStyle = lineClamp == null ? style : { ["--pire-text-clamp"]: lineClamp, ...style };
|
|
957
|
+
const { isTruncated, clampStyle } = truncateStyle(truncate, style);
|
|
971
958
|
return /* @__PURE__ */ jsx13(
|
|
972
959
|
AriaHeading,
|
|
973
960
|
{
|
|
@@ -975,7 +962,7 @@ function Heading({
|
|
|
975
962
|
className: cx("pire-heading", className),
|
|
976
963
|
"data-size": size ?? `h${level}`,
|
|
977
964
|
"data-color": color,
|
|
978
|
-
"data-truncate":
|
|
965
|
+
"data-truncate": isTruncated ? "true" : void 0,
|
|
979
966
|
style: clampStyle,
|
|
980
967
|
...rest
|
|
981
968
|
}
|
|
@@ -1047,6 +1034,16 @@ function FieldHelp({ children, label, placement = "top" }) {
|
|
|
1047
1034
|
/* @__PURE__ */ jsx17(ButtonContext.Provider, { value: null, children: /* @__PURE__ */ jsx17(Tooltip, { label: children, placement, children: /* @__PURE__ */ jsx17(IconButton, { icon: "help-circle", label: label ?? msg.fieldHelp, size: "sm", hideTooltip: true }) }) })
|
|
1048
1035
|
);
|
|
1049
1036
|
}
|
|
1037
|
+
function NamedFieldHelp({ label, children }) {
|
|
1038
|
+
const msg = usePireMessages();
|
|
1039
|
+
return /* @__PURE__ */ jsx17(
|
|
1040
|
+
FieldHelp,
|
|
1041
|
+
{
|
|
1042
|
+
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
1043
|
+
children
|
|
1044
|
+
}
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1050
1047
|
|
|
1051
1048
|
// src/components/forms/FormField.tsx
|
|
1052
1049
|
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
@@ -1062,7 +1059,6 @@ function FormField({
|
|
|
1062
1059
|
className,
|
|
1063
1060
|
...rest
|
|
1064
1061
|
}) {
|
|
1065
|
-
const msg = usePireMessages();
|
|
1066
1062
|
const labelEl = /* @__PURE__ */ jsxs10("label", { className: "pire-field-label", htmlFor, children: [
|
|
1067
1063
|
label,
|
|
1068
1064
|
isRequired ? /* @__PURE__ */ jsx18("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
@@ -1070,13 +1066,7 @@ function FormField({
|
|
|
1070
1066
|
return /* @__PURE__ */ jsxs10("div", { className: cx("pire-field", className), "data-layout": layout, ...rest, children: [
|
|
1071
1067
|
help ? /* @__PURE__ */ jsxs10("div", { className: "pire-field-labelrow", children: [
|
|
1072
1068
|
labelEl,
|
|
1073
|
-
/* @__PURE__ */ jsx18(
|
|
1074
|
-
FieldHelp,
|
|
1075
|
-
{
|
|
1076
|
-
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
1077
|
-
children: help
|
|
1078
|
-
}
|
|
1079
|
-
)
|
|
1069
|
+
/* @__PURE__ */ jsx18(NamedFieldHelp, { label, children: help })
|
|
1080
1070
|
] }) : labelEl,
|
|
1081
1071
|
children,
|
|
1082
1072
|
error ? /* @__PURE__ */ jsxs10("span", { className: "pire-field-error", role: "alert", children: [
|
|
@@ -1088,83 +1078,73 @@ function FormField({
|
|
|
1088
1078
|
|
|
1089
1079
|
// src/components/forms/Input.tsx
|
|
1090
1080
|
import * as React10 from "react";
|
|
1091
|
-
import {
|
|
1092
|
-
TextField,
|
|
1093
|
-
Input as AriaInput,
|
|
1094
|
-
Group,
|
|
1095
|
-
FieldError,
|
|
1096
|
-
Button as AriaButton4
|
|
1097
|
-
} from "react-aria-components";
|
|
1081
|
+
import { TextField, Input as AriaInput, Group, FieldError } from "react-aria-components";
|
|
1098
1082
|
|
|
1099
|
-
// src/components/
|
|
1083
|
+
// src/components/forms/FieldClearButton.tsx
|
|
1084
|
+
import { Button as AriaButton4 } from "react-aria-components";
|
|
1085
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1100
1086
|
function focusFieldOf(button) {
|
|
1101
1087
|
const control = button?.closest?.(".pire-control");
|
|
1102
1088
|
control?.querySelector(".pire-datesegment, .pire-input, input, textarea")?.focus();
|
|
1103
1089
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1090
|
+
function FieldClearButton({ label, onClear }) {
|
|
1091
|
+
return /* @__PURE__ */ jsx19(
|
|
1092
|
+
AriaButton4,
|
|
1093
|
+
{
|
|
1094
|
+
className: "pire-input-clear",
|
|
1095
|
+
slot: null,
|
|
1096
|
+
onPress: (event) => {
|
|
1097
|
+
onClear();
|
|
1098
|
+
focusFieldOf(event.target);
|
|
1099
|
+
},
|
|
1100
|
+
children: label
|
|
1101
|
+
}
|
|
1102
|
+
);
|
|
1115
1103
|
}
|
|
1116
1104
|
|
|
1117
1105
|
// src/components/forms/FieldLabel.tsx
|
|
1118
|
-
import {
|
|
1106
|
+
import { ButtonContext as ButtonContext2, Label } from "react-aria-components";
|
|
1107
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1119
1108
|
function warnHelpWithoutLabel(component, label, help) {
|
|
1120
|
-
if (!
|
|
1121
|
-
|
|
1109
|
+
if (!IS_DEV || !help || label) return;
|
|
1110
|
+
warnOnce(
|
|
1122
1111
|
`help-without-label:${component}`,
|
|
1123
1112
|
`${component}: \`help\` needs a visible \`label\`. Its icon is drawn beside one, so a field named only by \`aria-label\` renders no icon at all \u2014 the text still reaches a screen reader through the field's description, but nothing on screen offers it. Pass \`label\`, or move the sentence to \`description\`.`
|
|
1124
1113
|
);
|
|
1125
1114
|
}
|
|
1126
1115
|
function FieldLabel({ label, isRequired, help }) {
|
|
1127
|
-
const msg = usePireMessages();
|
|
1128
1116
|
const text = /* @__PURE__ */ jsxs11(Label, { className: "pire-field-label", children: [
|
|
1129
1117
|
label,
|
|
1130
|
-
isRequired ? /* @__PURE__ */
|
|
1118
|
+
isRequired ? /* @__PURE__ */ jsx20("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1131
1119
|
] });
|
|
1132
1120
|
return (
|
|
1133
|
-
//
|
|
1134
|
-
|
|
1135
|
-
// Without it every Button below a field inherits that field's trigger props.
|
|
1136
|
-
/* @__PURE__ */ jsx19(ButtonContext2.Provider, { value: null, children: help ? /* @__PURE__ */ jsxs11("div", { className: "pire-field-labelrow", children: [
|
|
1121
|
+
// Lifts the label out of the field's slotted ButtonContext — see `FieldHelp`.
|
|
1122
|
+
/* @__PURE__ */ jsx20(ButtonContext2.Provider, { value: null, children: help ? /* @__PURE__ */ jsxs11("div", { className: "pire-field-labelrow", children: [
|
|
1137
1123
|
text,
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
FieldHelp,
|
|
1140
|
-
{
|
|
1141
|
-
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
1142
|
-
children: help
|
|
1143
|
-
}
|
|
1144
|
-
)
|
|
1124
|
+
/* @__PURE__ */ jsx20(NamedFieldHelp, { label, children: help })
|
|
1145
1125
|
] }) : text })
|
|
1146
1126
|
);
|
|
1147
1127
|
}
|
|
1148
1128
|
|
|
1149
1129
|
// src/components/forms/FieldDescription.tsx
|
|
1150
1130
|
import { Text as Text3 } from "react-aria-components";
|
|
1151
|
-
import { jsx as
|
|
1131
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1152
1132
|
function FieldDescription({ description, help }) {
|
|
1153
1133
|
if (!description && !help) return null;
|
|
1154
1134
|
return (
|
|
1155
1135
|
// The class is picked, never combined: `.pire-sr-only` is `!important` and pairing it with
|
|
1156
|
-
// another pire-* class
|
|
1136
|
+
// another pire-* class can grow the document sideways (see CLAUDE.md). Choosing `pire-sr-only`
|
|
1157
1137
|
// when there is no visible description also keeps the node out of `.pire-field`'s flex gap —
|
|
1158
1138
|
// a `pire-field-hint` holding only hidden text still opens a visible gap under every field.
|
|
1159
1139
|
/* @__PURE__ */ jsxs12(Text3, { slot: "description", className: description ? "pire-field-hint" : "pire-sr-only", children: [
|
|
1160
1140
|
description,
|
|
1161
|
-
help ? /* @__PURE__ */
|
|
1141
|
+
help ? /* @__PURE__ */ jsx21("span", { className: "pire-sr-only", children: help }) : null
|
|
1162
1142
|
] })
|
|
1163
1143
|
);
|
|
1164
1144
|
}
|
|
1165
1145
|
|
|
1166
1146
|
// src/components/forms/Input.tsx
|
|
1167
|
-
import { jsx as
|
|
1147
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1168
1148
|
function Input({
|
|
1169
1149
|
label,
|
|
1170
1150
|
icon,
|
|
@@ -1205,7 +1185,7 @@ function Input({
|
|
|
1205
1185
|
...rest,
|
|
1206
1186
|
...valueProps,
|
|
1207
1187
|
children: [
|
|
1208
|
-
label ? /* @__PURE__ */
|
|
1188
|
+
label ? /* @__PURE__ */ jsx22(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1209
1189
|
/* @__PURE__ */ jsxs13(
|
|
1210
1190
|
Group,
|
|
1211
1191
|
{
|
|
@@ -1215,25 +1195,15 @@ function Input({
|
|
|
1215
1195
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1216
1196
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1217
1197
|
children: [
|
|
1218
|
-
icon ? /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
showsClear ? /* @__PURE__ */
|
|
1221
|
-
|
|
1222
|
-
{
|
|
1223
|
-
className: "pire-input-clear",
|
|
1224
|
-
onPress: (event) => {
|
|
1225
|
-
handleChange("");
|
|
1226
|
-
focusFieldOf(event.target);
|
|
1227
|
-
},
|
|
1228
|
-
children: clearLabel ?? msg.inputClear
|
|
1229
|
-
}
|
|
1230
|
-
) : null,
|
|
1231
|
-
suffix ? /* @__PURE__ */ jsx21("span", { className: "pire-affix", children: suffix }) : null
|
|
1198
|
+
icon ? /* @__PURE__ */ jsx22(Icon, { name: icon, size: 16, className: "pire-leading-icon" }) : null,
|
|
1199
|
+
/* @__PURE__ */ jsx22(AriaInput, { ref: inputRef, className: "pire-input", "data-numeric": numeric ? "true" : void 0 }),
|
|
1200
|
+
showsClear ? /* @__PURE__ */ jsx22(FieldClearButton, { label: clearLabel ?? msg.inputClear, onClear: () => handleChange("") }) : null,
|
|
1201
|
+
suffix ? /* @__PURE__ */ jsx22("span", { className: "pire-affix", children: suffix }) : null
|
|
1232
1202
|
]
|
|
1233
1203
|
}
|
|
1234
1204
|
),
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
/* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ jsx22(FieldDescription, { description, help }),
|
|
1206
|
+
/* @__PURE__ */ jsx22(FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1237
1207
|
]
|
|
1238
1208
|
}
|
|
1239
1209
|
);
|
|
@@ -1242,7 +1212,7 @@ function Input({
|
|
|
1242
1212
|
// src/components/forms/TextArea.tsx
|
|
1243
1213
|
import * as React11 from "react";
|
|
1244
1214
|
import { TextField as TextField2, TextArea as AriaTextArea, Group as Group2, FieldError as FieldError2 } from "react-aria-components";
|
|
1245
|
-
import { jsx as
|
|
1215
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1246
1216
|
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React11.useEffect : React11.useLayoutEffect;
|
|
1247
1217
|
function TextArea({
|
|
1248
1218
|
label,
|
|
@@ -1296,8 +1266,8 @@ function TextArea({
|
|
|
1296
1266
|
validationBehavior: "aria",
|
|
1297
1267
|
...rest,
|
|
1298
1268
|
children: [
|
|
1299
|
-
label ? /* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1269
|
+
label ? /* @__PURE__ */ jsx23(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1270
|
+
/* @__PURE__ */ jsx23(
|
|
1301
1271
|
Group2,
|
|
1302
1272
|
{
|
|
1303
1273
|
className: "pire-control",
|
|
@@ -1306,7 +1276,7 @@ function TextArea({
|
|
|
1306
1276
|
"data-multiline": "true",
|
|
1307
1277
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1308
1278
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1309
|
-
children: /* @__PURE__ */
|
|
1279
|
+
children: /* @__PURE__ */ jsx23(
|
|
1310
1280
|
AriaTextArea,
|
|
1311
1281
|
{
|
|
1312
1282
|
ref,
|
|
@@ -1318,8 +1288,8 @@ function TextArea({
|
|
|
1318
1288
|
)
|
|
1319
1289
|
}
|
|
1320
1290
|
),
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1291
|
+
/* @__PURE__ */ jsx23(FieldDescription, { description, help }),
|
|
1292
|
+
/* @__PURE__ */ jsx23(FieldError2, { className: "pire-field-error", children: errorMessage })
|
|
1323
1293
|
]
|
|
1324
1294
|
}
|
|
1325
1295
|
);
|
|
@@ -1336,15 +1306,16 @@ import {
|
|
|
1336
1306
|
ListBoxItem,
|
|
1337
1307
|
FieldError as FieldError3
|
|
1338
1308
|
} from "react-aria-components";
|
|
1339
|
-
import { jsx as
|
|
1309
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1340
1310
|
var CLEAR_KEY = "__pire-select-clear__";
|
|
1341
1311
|
var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
|
|
1312
|
+
var NO_OPTIONS = [];
|
|
1342
1313
|
function Select({
|
|
1343
1314
|
label,
|
|
1344
1315
|
value,
|
|
1345
1316
|
defaultValue,
|
|
1346
1317
|
onChange,
|
|
1347
|
-
options =
|
|
1318
|
+
options = NO_OPTIONS,
|
|
1348
1319
|
placeholder,
|
|
1349
1320
|
isClearable,
|
|
1350
1321
|
description,
|
|
@@ -1358,15 +1329,15 @@ function Select({
|
|
|
1358
1329
|
...rest
|
|
1359
1330
|
}) {
|
|
1360
1331
|
const msg = usePireMessages();
|
|
1361
|
-
const items = options.map(norm);
|
|
1332
|
+
const items = React12.useMemo(() => options.map(norm), [options]);
|
|
1362
1333
|
const effectivePlaceholder = placeholder ?? msg.selectPlaceholder;
|
|
1363
1334
|
const isSelectionControlled = value !== void 0;
|
|
1364
1335
|
const [ownSelection, setOwnSelection] = React12.useState(defaultValue ?? null);
|
|
1365
1336
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1366
1337
|
const collides = items.some((item) => item.value === CLEAR_KEY);
|
|
1367
1338
|
const showsClear = isClearable === true && !rest.isDisabled && items.length > 0 && !collides;
|
|
1368
|
-
if (
|
|
1369
|
-
|
|
1339
|
+
if (IS_DEV && isClearable === true && !rest.isDisabled && collides) {
|
|
1340
|
+
warnOnce(
|
|
1370
1341
|
CLEAR_KEY,
|
|
1371
1342
|
`Select: an option's value is "${CLEAR_KEY}", which isClearable reserves for its "nothing chosen" row. The clear row has been dropped so the option keeps working \u2014 rename the option to get it back.`
|
|
1372
1343
|
);
|
|
@@ -1397,7 +1368,7 @@ function Select({
|
|
|
1397
1368
|
validationBehavior: "aria",
|
|
1398
1369
|
...rest,
|
|
1399
1370
|
children: [
|
|
1400
|
-
label ? /* @__PURE__ */
|
|
1371
|
+
label ? /* @__PURE__ */ jsx24(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1401
1372
|
/* @__PURE__ */ jsxs15(
|
|
1402
1373
|
AriaButton5,
|
|
1403
1374
|
{
|
|
@@ -1406,20 +1377,20 @@ function Select({
|
|
|
1406
1377
|
"data-full-width": String(fullWidth),
|
|
1407
1378
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1408
1379
|
children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ jsx24(SelectValue, { className: "pire-select-value" }),
|
|
1381
|
+
/* @__PURE__ */ jsx24(Icon, { name: "chevron-down", size: 16, className: "pire-leading-icon" })
|
|
1411
1382
|
]
|
|
1412
1383
|
}
|
|
1413
1384
|
),
|
|
1414
|
-
/* @__PURE__ */
|
|
1415
|
-
/* @__PURE__ */
|
|
1416
|
-
/* @__PURE__ */
|
|
1385
|
+
/* @__PURE__ */ jsx24(FieldDescription, { description, help }),
|
|
1386
|
+
/* @__PURE__ */ jsx24(FieldError3, { className: "pire-field-error", children: errorMessage }),
|
|
1387
|
+
/* @__PURE__ */ jsx24(Popover, { className: "pire-popover", children: /* @__PURE__ */ jsx24(
|
|
1417
1388
|
ListBox,
|
|
1418
1389
|
{
|
|
1419
1390
|
className: "pire-listbox",
|
|
1420
1391
|
items: rows,
|
|
1421
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
1422
|
-
children: (item) => /* @__PURE__ */
|
|
1392
|
+
renderEmptyState: () => /* @__PURE__ */ jsx24("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: emptyLabel ?? msg.selectEmpty }),
|
|
1393
|
+
children: (item) => /* @__PURE__ */ jsx24(
|
|
1423
1394
|
ListBoxItem,
|
|
1424
1395
|
{
|
|
1425
1396
|
className: "pire-option",
|
|
@@ -1439,13 +1410,13 @@ function Select({
|
|
|
1439
1410
|
|
|
1440
1411
|
// src/components/forms/Checkbox.tsx
|
|
1441
1412
|
import { Checkbox as AriaCheckbox } from "react-aria-components";
|
|
1442
|
-
import { Fragment as Fragment2, jsx as
|
|
1413
|
+
import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1443
1414
|
function Checkbox({ label, hint, children, className, ...rest }) {
|
|
1444
|
-
return /* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1415
|
+
return /* @__PURE__ */ jsx25(AriaCheckbox, { className: cx("pire-choice", className), ...rest, children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
1416
|
+
/* @__PURE__ */ jsx25("span", { className: "pire-choice-box", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ jsx25(Icon, { name: "minus", size: 12 }) : isSelected ? /* @__PURE__ */ jsx25(Icon, { name: "check", size: 12 }) : null }),
|
|
1446
1417
|
/* @__PURE__ */ jsxs16("span", { children: [
|
|
1447
1418
|
label ?? children,
|
|
1448
|
-
hint ? /* @__PURE__ */
|
|
1419
|
+
hint ? /* @__PURE__ */ jsx25("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1449
1420
|
] })
|
|
1450
1421
|
] }) });
|
|
1451
1422
|
}
|
|
@@ -1458,7 +1429,7 @@ import {
|
|
|
1458
1429
|
Text as Text4,
|
|
1459
1430
|
FieldError as FieldError4
|
|
1460
1431
|
} from "react-aria-components";
|
|
1461
|
-
import { jsx as
|
|
1432
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1462
1433
|
function RadioGroup({
|
|
1463
1434
|
label,
|
|
1464
1435
|
description,
|
|
@@ -1468,35 +1439,35 @@ function RadioGroup({
|
|
|
1468
1439
|
...rest
|
|
1469
1440
|
}) {
|
|
1470
1441
|
return /* @__PURE__ */ jsxs17(AriaRadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
|
|
1471
|
-
label ? /* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
description ? /* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1442
|
+
label ? /* @__PURE__ */ jsx26(Label2, { className: "pire-field-label", children: label }) : null,
|
|
1443
|
+
/* @__PURE__ */ jsx26("div", { className: "pire-radiogroup", children }),
|
|
1444
|
+
description ? /* @__PURE__ */ jsx26(Text4, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1445
|
+
/* @__PURE__ */ jsx26(FieldError4, { className: "pire-field-error", children: errorMessage })
|
|
1475
1446
|
] });
|
|
1476
1447
|
}
|
|
1477
1448
|
function Radio({ label, hint, children, className, ...rest }) {
|
|
1478
1449
|
return /* @__PURE__ */ jsxs17(AriaRadio, { className: cx("pire-choice", className), ...rest, children: [
|
|
1479
|
-
/* @__PURE__ */
|
|
1450
|
+
/* @__PURE__ */ jsx26("span", { className: "pire-choice-box", "data-radio": "true", "aria-hidden": "true" }),
|
|
1480
1451
|
/* @__PURE__ */ jsxs17("span", { children: [
|
|
1481
1452
|
label ?? children,
|
|
1482
|
-
hint ? /* @__PURE__ */
|
|
1453
|
+
hint ? /* @__PURE__ */ jsx26("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1483
1454
|
] })
|
|
1484
1455
|
] });
|
|
1485
1456
|
}
|
|
1486
1457
|
|
|
1487
1458
|
// src/components/forms/Switch.tsx
|
|
1488
1459
|
import { Switch as AriaSwitch } from "react-aria-components";
|
|
1489
|
-
import { jsx as
|
|
1460
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1490
1461
|
function Switch({ label, children, className, ...rest }) {
|
|
1491
1462
|
return /* @__PURE__ */ jsxs18(AriaSwitch, { className: cx("pire-choice", className), ...rest, children: [
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1463
|
+
/* @__PURE__ */ jsx27("span", { className: "pire-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx27("span", { className: "pire-switch-thumb" }) }),
|
|
1464
|
+
/* @__PURE__ */ jsx27("span", { children: label ?? children })
|
|
1494
1465
|
] });
|
|
1495
1466
|
}
|
|
1496
1467
|
|
|
1497
1468
|
// src/components/forms/ChoiceCardGroup.tsx
|
|
1498
1469
|
import { RadioGroup as AriaRadioGroup2, Radio as AriaRadio2, FieldError as FieldError5 } from "react-aria-components";
|
|
1499
|
-
import { jsx as
|
|
1470
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1500
1471
|
function ChoiceCardGroup({
|
|
1501
1472
|
label,
|
|
1502
1473
|
description,
|
|
@@ -1511,7 +1482,7 @@ function ChoiceCardGroup({
|
|
|
1511
1482
|
isRequired,
|
|
1512
1483
|
className,
|
|
1513
1484
|
style,
|
|
1514
|
-
|
|
1485
|
+
"aria-label": ariaLabel
|
|
1515
1486
|
}) {
|
|
1516
1487
|
warnHelpWithoutLabel("ChoiceCardGroup", label, help);
|
|
1517
1488
|
return /* @__PURE__ */ jsxs19(
|
|
@@ -1520,48 +1491,43 @@ function ChoiceCardGroup({
|
|
|
1520
1491
|
className: cx("pire-field", className),
|
|
1521
1492
|
style,
|
|
1522
1493
|
validationBehavior: "aria",
|
|
1523
|
-
"aria-label": label ? void 0 :
|
|
1494
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1524
1495
|
value,
|
|
1525
1496
|
defaultValue,
|
|
1526
1497
|
onChange,
|
|
1527
1498
|
isDisabled,
|
|
1528
1499
|
isRequired,
|
|
1529
1500
|
children: [
|
|
1530
|
-
label ? /* @__PURE__ */
|
|
1531
|
-
/* @__PURE__ */
|
|
1501
|
+
label ? /* @__PURE__ */ jsx28(FieldLabel, { label, isRequired, help }) : null,
|
|
1502
|
+
/* @__PURE__ */ jsx28("div", { className: "pire-choicecards", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }, children: options.map((option) => /* @__PURE__ */ jsxs19(
|
|
1532
1503
|
AriaRadio2,
|
|
1533
1504
|
{
|
|
1534
1505
|
value: option.id,
|
|
1535
1506
|
className: "pire-choicecard",
|
|
1536
1507
|
isDisabled: option.isDisabled,
|
|
1537
1508
|
children: [
|
|
1538
|
-
option.icon ? /* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
option.description ? /* @__PURE__ */
|
|
1541
|
-
option.preview ? /* @__PURE__ */
|
|
1509
|
+
option.icon ? /* @__PURE__ */ jsx28(Icon, { name: option.icon, size: 20 }) : null,
|
|
1510
|
+
/* @__PURE__ */ jsx28("span", { className: "pire-choicecard-label", children: option.label }),
|
|
1511
|
+
option.description ? /* @__PURE__ */ jsx28("span", { className: "pire-choicecard-desc", children: option.description }) : null,
|
|
1512
|
+
option.preview ? /* @__PURE__ */ jsx28("span", { className: "pire-choicecard-preview", "aria-hidden": "true", children: option.preview }) : null
|
|
1542
1513
|
]
|
|
1543
1514
|
},
|
|
1544
1515
|
option.id
|
|
1545
1516
|
)) }),
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ jsx28(FieldDescription, { description, help }),
|
|
1518
|
+
/* @__PURE__ */ jsx28(FieldError5, { className: "pire-field-error", children: errorMessage })
|
|
1548
1519
|
]
|
|
1549
1520
|
}
|
|
1550
1521
|
);
|
|
1551
1522
|
}
|
|
1552
1523
|
|
|
1553
1524
|
// src/components/forms/ComboBox.tsx
|
|
1525
|
+
import * as React15 from "react";
|
|
1526
|
+
import { ComboBox as AriaComboBox, Input as AriaInput2, Group as Group3, FieldError as FieldError6 } from "react-aria-components";
|
|
1527
|
+
|
|
1528
|
+
// src/components/forms/ComboBoxListBox.tsx
|
|
1554
1529
|
import * as React14 from "react";
|
|
1555
|
-
import {
|
|
1556
|
-
ComboBox as AriaComboBox,
|
|
1557
|
-
Input as AriaInput2,
|
|
1558
|
-
Button as AriaButton6,
|
|
1559
|
-
Group as Group3,
|
|
1560
|
-
Popover as Popover2,
|
|
1561
|
-
ListBox as ListBox2,
|
|
1562
|
-
ListBoxItem as ListBoxItem2,
|
|
1563
|
-
FieldError as FieldError6
|
|
1564
|
-
} from "react-aria-components";
|
|
1530
|
+
import { Button as AriaButton6, Popover as Popover2, ListBox as ListBox2, ListBoxItem as ListBoxItem2 } from "react-aria-components";
|
|
1565
1531
|
|
|
1566
1532
|
// src/components/utils/useLoadMoreOnScroll.ts
|
|
1567
1533
|
import * as React13 from "react";
|
|
@@ -1581,9 +1547,67 @@ function useLoadMoreOnScroll(onLoadMore, isLoading) {
|
|
|
1581
1547
|
};
|
|
1582
1548
|
}
|
|
1583
1549
|
|
|
1584
|
-
// src/components/forms/
|
|
1585
|
-
import { jsx as
|
|
1550
|
+
// src/components/forms/ComboBoxListBox.tsx
|
|
1551
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1586
1552
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1553
|
+
function useComboBoxItems(options, isFilteredExternally, isLoading) {
|
|
1554
|
+
const items = React14.useMemo(() => options.map(norm2), [options]);
|
|
1555
|
+
return {
|
|
1556
|
+
items,
|
|
1557
|
+
collectionProps: {
|
|
1558
|
+
...isFilteredExternally ? { items } : { defaultItems: items },
|
|
1559
|
+
allowsEmptyCollection: Boolean(isFilteredExternally || isLoading)
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
function ComboBoxTrigger() {
|
|
1564
|
+
const msg = usePireMessages();
|
|
1565
|
+
return /* @__PURE__ */ jsx29(
|
|
1566
|
+
AriaButton6,
|
|
1567
|
+
{
|
|
1568
|
+
className: "pire-iconbtn pire-field-trigger",
|
|
1569
|
+
"data-size": "xs",
|
|
1570
|
+
"aria-label": msg.comboBoxShowSuggestions,
|
|
1571
|
+
children: /* @__PURE__ */ jsx29(Icon, { name: "chevron-down", size: 16 })
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
function ComboBoxListBox({
|
|
1576
|
+
items,
|
|
1577
|
+
isFilteredExternally,
|
|
1578
|
+
isLoading,
|
|
1579
|
+
loadingLabel,
|
|
1580
|
+
emptyLabel,
|
|
1581
|
+
onLoadMore
|
|
1582
|
+
}) {
|
|
1583
|
+
const msg = usePireMessages();
|
|
1584
|
+
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
1585
|
+
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1586
|
+
return /* @__PURE__ */ jsx29(Popover2, { className: "pire-popover", children: /* @__PURE__ */ jsx29(
|
|
1587
|
+
ListBox2,
|
|
1588
|
+
{
|
|
1589
|
+
className: "pire-listbox",
|
|
1590
|
+
onScroll: onListScroll,
|
|
1591
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ jsx29("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1592
|
+
children: (item) => /* @__PURE__ */ jsxs20(
|
|
1593
|
+
ListBoxItem2,
|
|
1594
|
+
{
|
|
1595
|
+
className: "pire-option",
|
|
1596
|
+
id: item.value,
|
|
1597
|
+
textValue: item.label,
|
|
1598
|
+
isDisabled: item.isDisabled,
|
|
1599
|
+
children: [
|
|
1600
|
+
/* @__PURE__ */ jsx29("span", { className: "pire-option-label", children: item.label }),
|
|
1601
|
+
item.secondary ? /* @__PURE__ */ jsx29("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1602
|
+
]
|
|
1603
|
+
}
|
|
1604
|
+
)
|
|
1605
|
+
}
|
|
1606
|
+
) });
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// src/components/forms/ComboBox.tsx
|
|
1610
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1587
1611
|
function ComboBox({
|
|
1588
1612
|
label,
|
|
1589
1613
|
value,
|
|
@@ -1609,12 +1633,12 @@ function ComboBox({
|
|
|
1609
1633
|
...rest
|
|
1610
1634
|
}) {
|
|
1611
1635
|
const msg = usePireMessages();
|
|
1612
|
-
const items = options
|
|
1636
|
+
const { items, collectionProps } = useComboBoxItems(options, isFilteredExternally, isLoading);
|
|
1613
1637
|
const isSelectionControlled = value !== void 0;
|
|
1614
|
-
const [ownSelection, setOwnSelection] =
|
|
1638
|
+
const [ownSelection, setOwnSelection] = React15.useState(defaultValue ?? null);
|
|
1615
1639
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1616
1640
|
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1617
|
-
const [typedText, setTypedText] =
|
|
1641
|
+
const [typedText, setTypedText] = React15.useState("");
|
|
1618
1642
|
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1619
1643
|
const handleInputChange = isClearable ? (text) => {
|
|
1620
1644
|
setTypedText(text);
|
|
@@ -1627,11 +1651,8 @@ function ComboBox({
|
|
|
1627
1651
|
onChange?.(null);
|
|
1628
1652
|
onInputChange?.("");
|
|
1629
1653
|
};
|
|
1630
|
-
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1631
|
-
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
1632
|
-
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1633
1654
|
warnHelpWithoutLabel("ComboBox", label, help);
|
|
1634
|
-
return /* @__PURE__ */
|
|
1655
|
+
return /* @__PURE__ */ jsxs21(
|
|
1635
1656
|
AriaComboBox,
|
|
1636
1657
|
{
|
|
1637
1658
|
className: cx("pire-field", className),
|
|
@@ -1646,14 +1667,13 @@ function ComboBox({
|
|
|
1646
1667
|
},
|
|
1647
1668
|
inputValue,
|
|
1648
1669
|
onInputChange: handleInputChange,
|
|
1649
|
-
...
|
|
1650
|
-
allowsEmptyCollection: isFilteredExternally || isLoading,
|
|
1670
|
+
...collectionProps,
|
|
1651
1671
|
menuTrigger: "input",
|
|
1652
1672
|
validationBehavior: "aria",
|
|
1653
1673
|
...rest,
|
|
1654
1674
|
children: [
|
|
1655
|
-
label ? /* @__PURE__ */
|
|
1656
|
-
/* @__PURE__ */
|
|
1675
|
+
label ? /* @__PURE__ */ jsx30(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1676
|
+
/* @__PURE__ */ jsxs21(
|
|
1657
1677
|
Group3,
|
|
1658
1678
|
{
|
|
1659
1679
|
className: "pire-control",
|
|
@@ -1661,77 +1681,42 @@ function ComboBox({
|
|
|
1661
1681
|
"data-full-width": String(fullWidth),
|
|
1662
1682
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1663
1683
|
children: [
|
|
1664
|
-
/* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
1666
|
-
showsClear ? /* @__PURE__ */
|
|
1667
|
-
|
|
1668
|
-
{
|
|
1669
|
-
className: "pire-input-clear",
|
|
1670
|
-
slot: null,
|
|
1671
|
-
onPress: (event) => {
|
|
1672
|
-
clear();
|
|
1673
|
-
focusFieldOf(event.target);
|
|
1674
|
-
},
|
|
1675
|
-
children: clearLabel ?? msg.inputClear
|
|
1676
|
-
}
|
|
1677
|
-
) : null,
|
|
1678
|
-
/* @__PURE__ */ jsx28(
|
|
1679
|
-
AriaButton6,
|
|
1680
|
-
{
|
|
1681
|
-
className: "pire-iconbtn",
|
|
1682
|
-
"data-size": "sm",
|
|
1683
|
-
"aria-label": msg.comboBoxShowSuggestions,
|
|
1684
|
-
style: { width: 20, height: 20 },
|
|
1685
|
-
children: /* @__PURE__ */ jsx28(Icon, { name: "chevron-down", size: 16 })
|
|
1686
|
-
}
|
|
1687
|
-
)
|
|
1684
|
+
/* @__PURE__ */ jsx30(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1685
|
+
/* @__PURE__ */ jsx30(AriaInput2, { className: "pire-input", placeholder: rest.placeholder }),
|
|
1686
|
+
showsClear ? /* @__PURE__ */ jsx30(FieldClearButton, { label: clearLabel ?? msg.inputClear, onClear: clear }) : null,
|
|
1687
|
+
/* @__PURE__ */ jsx30(ComboBoxTrigger, {})
|
|
1688
1688
|
]
|
|
1689
1689
|
}
|
|
1690
1690
|
),
|
|
1691
|
-
/* @__PURE__ */
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
|
|
1691
|
+
/* @__PURE__ */ jsx30(FieldDescription, { description, help }),
|
|
1692
|
+
/* @__PURE__ */ jsx30(FieldError6, { className: "pire-field-error", children: errorMessage }),
|
|
1693
|
+
/* @__PURE__ */ jsx30(
|
|
1694
|
+
ComboBoxListBox,
|
|
1695
1695
|
{
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
className: "pire-option",
|
|
1703
|
-
id: item.value,
|
|
1704
|
-
textValue: item.label,
|
|
1705
|
-
isDisabled: item.isDisabled,
|
|
1706
|
-
children: [
|
|
1707
|
-
/* @__PURE__ */ jsx28("span", { className: "pire-option-label", children: item.label }),
|
|
1708
|
-
item.secondary ? /* @__PURE__ */ jsx28("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1709
|
-
]
|
|
1710
|
-
}
|
|
1711
|
-
)
|
|
1696
|
+
items,
|
|
1697
|
+
isFilteredExternally,
|
|
1698
|
+
isLoading,
|
|
1699
|
+
loadingLabel,
|
|
1700
|
+
emptyLabel,
|
|
1701
|
+
onLoadMore
|
|
1712
1702
|
}
|
|
1713
|
-
)
|
|
1703
|
+
)
|
|
1714
1704
|
]
|
|
1715
1705
|
}
|
|
1716
1706
|
);
|
|
1717
1707
|
}
|
|
1718
1708
|
|
|
1719
1709
|
// src/components/forms/MultiComboBox.tsx
|
|
1720
|
-
import * as
|
|
1710
|
+
import * as React16 from "react";
|
|
1721
1711
|
import {
|
|
1722
1712
|
ComboBox as AriaComboBox2,
|
|
1723
1713
|
Input as AriaInput3,
|
|
1724
|
-
Button as AriaButton7,
|
|
1725
1714
|
ButtonContext as ButtonContext3,
|
|
1726
1715
|
Group as Group4,
|
|
1727
|
-
Popover as Popover3,
|
|
1728
|
-
ListBox as ListBox3,
|
|
1729
|
-
ListBoxItem as ListBoxItem3,
|
|
1730
1716
|
FieldError as FieldError7,
|
|
1731
1717
|
VisuallyHidden
|
|
1732
1718
|
} from "react-aria-components";
|
|
1733
|
-
import { jsx as
|
|
1734
|
-
var norm3 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1719
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1735
1720
|
function MultiComboBox({
|
|
1736
1721
|
label,
|
|
1737
1722
|
value,
|
|
@@ -1755,17 +1740,15 @@ function MultiComboBox({
|
|
|
1755
1740
|
...rest
|
|
1756
1741
|
}) {
|
|
1757
1742
|
const msg = usePireMessages();
|
|
1758
|
-
const items =
|
|
1759
|
-
const
|
|
1760
|
-
const
|
|
1761
|
-
const
|
|
1762
|
-
const [uncontrolled, setUncontrolled] = React15.useState(defaultValue ?? []);
|
|
1763
|
-
const [announcement, setAnnouncement] = React15.useState("");
|
|
1764
|
-
const inputRef = React15.useRef(null);
|
|
1743
|
+
const { items, collectionProps } = useComboBoxItems(options, isFilteredExternally, isLoading);
|
|
1744
|
+
const [uncontrolled, setUncontrolled] = React16.useState(defaultValue ?? []);
|
|
1745
|
+
const [announcement, setAnnouncement] = React16.useState("");
|
|
1746
|
+
const inputRef = React16.useRef(null);
|
|
1765
1747
|
const raw = value ?? uncontrolled;
|
|
1766
1748
|
const contentKey = raw.join("\0");
|
|
1767
|
-
const values =
|
|
1768
|
-
const
|
|
1749
|
+
const values = React16.useMemo(() => raw, [contentKey]);
|
|
1750
|
+
const labels = React16.useMemo(() => new Map(items.map((o) => [o.value, o.label])), [items]);
|
|
1751
|
+
const labelOf = (v) => labels.get(v) ?? v;
|
|
1769
1752
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1770
1753
|
const commit = (next) => {
|
|
1771
1754
|
const added = next.find((v) => !values.includes(v));
|
|
@@ -1799,7 +1782,7 @@ function MultiComboBox({
|
|
|
1799
1782
|
if (!values.includes(next)) commit([...values, next]);
|
|
1800
1783
|
};
|
|
1801
1784
|
warnHelpWithoutLabel("MultiComboBox", label, help);
|
|
1802
|
-
return /* @__PURE__ */
|
|
1785
|
+
return /* @__PURE__ */ jsxs22(
|
|
1803
1786
|
AriaComboBox2,
|
|
1804
1787
|
{
|
|
1805
1788
|
className: cx("pire-field", className),
|
|
@@ -1810,14 +1793,13 @@ function MultiComboBox({
|
|
|
1810
1793
|
if (!isLoading) commit(keys.map(String));
|
|
1811
1794
|
},
|
|
1812
1795
|
onInputChange,
|
|
1813
|
-
...
|
|
1814
|
-
allowsEmptyCollection: isFilteredExternally || isLoading,
|
|
1796
|
+
...collectionProps,
|
|
1815
1797
|
menuTrigger: "input",
|
|
1816
1798
|
validationBehavior: "aria",
|
|
1817
1799
|
...rest,
|
|
1818
1800
|
children: [
|
|
1819
|
-
label ? /* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1801
|
+
label ? /* @__PURE__ */ jsx31(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1802
|
+
/* @__PURE__ */ jsxs22(
|
|
1821
1803
|
Group4,
|
|
1822
1804
|
{
|
|
1823
1805
|
className: "pire-control",
|
|
@@ -1827,14 +1809,14 @@ function MultiComboBox({
|
|
|
1827
1809
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1828
1810
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1829
1811
|
children: [
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1812
|
+
/* @__PURE__ */ jsx31(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1813
|
+
/* @__PURE__ */ jsxs22("div", { className: "pire-chipfield", children: [
|
|
1814
|
+
/* @__PURE__ */ jsx31(ButtonContext3.Provider, { value: null, children: values.map((v) => (
|
|
1833
1815
|
/* Disabled follows the field, not `isEditable`: a read-only field's chips are
|
|
1834
1816
|
real, current values and should read as such — they simply lose the × . */
|
|
1835
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsx31(Tag, { isDisabled: rest.isDisabled, onRemove: isEditable ? () => remove(v) : void 0, children: labelOf(v) }, v)
|
|
1836
1818
|
)) }),
|
|
1837
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ jsx31(
|
|
1838
1820
|
AriaInput3,
|
|
1839
1821
|
{
|
|
1840
1822
|
ref: inputRef,
|
|
@@ -1844,55 +1826,36 @@ function MultiComboBox({
|
|
|
1844
1826
|
}
|
|
1845
1827
|
)
|
|
1846
1828
|
] }),
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
AriaButton7,
|
|
1849
|
-
{
|
|
1850
|
-
className: "pire-iconbtn",
|
|
1851
|
-
"data-size": "sm",
|
|
1852
|
-
"aria-label": msg.comboBoxShowSuggestions,
|
|
1853
|
-
style: { width: 20, height: 20 },
|
|
1854
|
-
children: /* @__PURE__ */ jsx29(Icon, { name: "chevron-down", size: 16 })
|
|
1855
|
-
}
|
|
1856
|
-
)
|
|
1829
|
+
/* @__PURE__ */ jsx31(ComboBoxTrigger, {})
|
|
1857
1830
|
]
|
|
1858
1831
|
}
|
|
1859
1832
|
),
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
1862
|
-
/* @__PURE__ */
|
|
1863
|
-
/* @__PURE__ */
|
|
1864
|
-
|
|
1833
|
+
/* @__PURE__ */ jsx31(VisuallyHidden, { children: /* @__PURE__ */ jsx31("span", { "aria-live": "polite", children: announcement }) }),
|
|
1834
|
+
/* @__PURE__ */ jsx31(FieldDescription, { description, help }),
|
|
1835
|
+
/* @__PURE__ */ jsx31(FieldError7, { className: "pire-field-error", children: errorMessage }),
|
|
1836
|
+
/* @__PURE__ */ jsx31(
|
|
1837
|
+
ComboBoxListBox,
|
|
1865
1838
|
{
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
className: "pire-option",
|
|
1873
|
-
id: item.value,
|
|
1874
|
-
textValue: item.label,
|
|
1875
|
-
isDisabled: item.isDisabled,
|
|
1876
|
-
children: [
|
|
1877
|
-
/* @__PURE__ */ jsx29("span", { className: "pire-option-label", children: item.label }),
|
|
1878
|
-
item.secondary ? /* @__PURE__ */ jsx29("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1879
|
-
]
|
|
1880
|
-
}
|
|
1881
|
-
)
|
|
1839
|
+
items,
|
|
1840
|
+
isFilteredExternally,
|
|
1841
|
+
isLoading,
|
|
1842
|
+
loadingLabel,
|
|
1843
|
+
emptyLabel,
|
|
1844
|
+
onLoadMore
|
|
1882
1845
|
}
|
|
1883
|
-
)
|
|
1846
|
+
)
|
|
1884
1847
|
]
|
|
1885
1848
|
}
|
|
1886
1849
|
);
|
|
1887
1850
|
}
|
|
1888
1851
|
|
|
1889
1852
|
// src/components/forms/NumberField.tsx
|
|
1890
|
-
import * as
|
|
1853
|
+
import * as React17 from "react";
|
|
1891
1854
|
import {
|
|
1892
1855
|
NumberField as AriaNumberField,
|
|
1893
1856
|
Input as AriaInput4,
|
|
1894
1857
|
Group as Group5,
|
|
1895
|
-
Button as
|
|
1858
|
+
Button as AriaButton7,
|
|
1896
1859
|
FieldError as FieldError8,
|
|
1897
1860
|
useLocale,
|
|
1898
1861
|
NumberFieldStateContext
|
|
@@ -1904,7 +1867,7 @@ function decimalSeparatorFor(locale) {
|
|
|
1904
1867
|
}
|
|
1905
1868
|
|
|
1906
1869
|
// src/components/forms/NumberField.tsx
|
|
1907
|
-
import { jsx as
|
|
1870
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1908
1871
|
function typeIntoInput(el, text) {
|
|
1909
1872
|
const start = el.selectionStart ?? el.value.length;
|
|
1910
1873
|
const end = el.selectionEnd ?? start;
|
|
@@ -1935,22 +1898,11 @@ function toAriaNumber(value) {
|
|
|
1935
1898
|
return typeof value === "number" ? value : Number(value);
|
|
1936
1899
|
}
|
|
1937
1900
|
function ClearButton({ label, onClear }) {
|
|
1938
|
-
const state =
|
|
1901
|
+
const state = React17.useContext(NumberFieldStateContext);
|
|
1939
1902
|
if (!state?.inputValue) {
|
|
1940
1903
|
return null;
|
|
1941
1904
|
}
|
|
1942
|
-
return /* @__PURE__ */
|
|
1943
|
-
AriaButton8,
|
|
1944
|
-
{
|
|
1945
|
-
className: "pire-input-clear",
|
|
1946
|
-
slot: null,
|
|
1947
|
-
onPress: (event) => {
|
|
1948
|
-
onClear();
|
|
1949
|
-
focusFieldOf(event.target);
|
|
1950
|
-
},
|
|
1951
|
-
children: label
|
|
1952
|
-
}
|
|
1953
|
-
);
|
|
1905
|
+
return /* @__PURE__ */ jsx32(FieldClearButton, { label, onClear });
|
|
1954
1906
|
}
|
|
1955
1907
|
function NumberField({
|
|
1956
1908
|
label,
|
|
@@ -1978,7 +1930,7 @@ function NumberField({
|
|
|
1978
1930
|
const { locale } = useLocale();
|
|
1979
1931
|
const empty = emptyValue === void 0 ? NaN : emptyValue;
|
|
1980
1932
|
const isControlled = value !== void 0;
|
|
1981
|
-
const [ownValue, setOwnValue] =
|
|
1933
|
+
const [ownValue, setOwnValue] = React17.useState(() => toAriaNumber(defaultValue) ?? NaN);
|
|
1982
1934
|
const takesOverValue = Boolean(isClearable) && !isControlled;
|
|
1983
1935
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
|
|
1984
1936
|
const handleChange = (next) => {
|
|
@@ -1988,34 +1940,27 @@ function NumberField({
|
|
|
1988
1940
|
onChange?.(Number.isNaN(next) ? empty : next);
|
|
1989
1941
|
};
|
|
1990
1942
|
const showsClear = Boolean(isClearable) && !rest.isDisabled && !rest.isReadOnly;
|
|
1943
|
+
const remapsDotTo = () => {
|
|
1944
|
+
if (rest.isReadOnly || rest.isDisabled) return null;
|
|
1945
|
+
const separator = decimalSeparatorFor(locale);
|
|
1946
|
+
if (separator === ".") return null;
|
|
1947
|
+
const { maximumFractionDigits } = new Intl.NumberFormat(locale, rest.formatOptions).resolvedOptions();
|
|
1948
|
+
return maximumFractionDigits ? separator : null;
|
|
1949
|
+
};
|
|
1991
1950
|
const handleDecimalKey = (event) => {
|
|
1992
1951
|
if (event.key !== "." || event.ctrlKey || event.metaKey || event.altKey) {
|
|
1993
1952
|
return;
|
|
1994
1953
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
}
|
|
1998
|
-
const separator = decimalSeparatorFor(locale);
|
|
1999
|
-
if (separator === ".") {
|
|
2000
|
-
return;
|
|
2001
|
-
}
|
|
2002
|
-
const { maximumFractionDigits } = new Intl.NumberFormat(locale, rest.formatOptions).resolvedOptions();
|
|
2003
|
-
if (!maximumFractionDigits) {
|
|
1954
|
+
const separator = remapsDotTo();
|
|
1955
|
+
if (!separator) {
|
|
2004
1956
|
return;
|
|
2005
1957
|
}
|
|
2006
1958
|
event.preventDefault();
|
|
2007
1959
|
typeIntoInput(event.currentTarget, separator);
|
|
2008
1960
|
};
|
|
2009
1961
|
const handlePaste = (event) => {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
}
|
|
2013
|
-
const separator = decimalSeparatorFor(locale);
|
|
2014
|
-
if (separator === ".") {
|
|
2015
|
-
return;
|
|
2016
|
-
}
|
|
2017
|
-
const { maximumFractionDigits } = new Intl.NumberFormat(locale, rest.formatOptions).resolvedOptions();
|
|
2018
|
-
if (!maximumFractionDigits) {
|
|
1962
|
+
const separator = remapsDotTo();
|
|
1963
|
+
if (!separator) {
|
|
2019
1964
|
return;
|
|
2020
1965
|
}
|
|
2021
1966
|
const pasted = event.clipboardData.getData("text");
|
|
@@ -2028,7 +1973,7 @@ function NumberField({
|
|
|
2028
1973
|
typeIntoInput(event.currentTarget, localised);
|
|
2029
1974
|
};
|
|
2030
1975
|
warnHelpWithoutLabel("NumberField", label, help);
|
|
2031
|
-
return /* @__PURE__ */
|
|
1976
|
+
return /* @__PURE__ */ jsxs23(
|
|
2032
1977
|
AriaNumberField,
|
|
2033
1978
|
{
|
|
2034
1979
|
className: cx("pire-field", className),
|
|
@@ -2038,8 +1983,8 @@ function NumberField({
|
|
|
2038
1983
|
...rest,
|
|
2039
1984
|
...valueProps,
|
|
2040
1985
|
children: [
|
|
2041
|
-
label ? /* @__PURE__ */
|
|
2042
|
-
/* @__PURE__ */
|
|
1986
|
+
label ? /* @__PURE__ */ jsx32(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1987
|
+
/* @__PURE__ */ jsxs23(
|
|
2043
1988
|
Group5,
|
|
2044
1989
|
{
|
|
2045
1990
|
className: "pire-control",
|
|
@@ -2049,16 +1994,16 @@ function NumberField({
|
|
|
2049
1994
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2050
1995
|
"data-stepper": stepperLayout,
|
|
2051
1996
|
children: [
|
|
2052
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */
|
|
2053
|
-
|
|
1997
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ jsx32(
|
|
1998
|
+
AriaButton7,
|
|
2054
1999
|
{
|
|
2055
2000
|
slot: "decrement",
|
|
2056
2001
|
className: "pire-qty-btn",
|
|
2057
2002
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
2058
|
-
children: /* @__PURE__ */
|
|
2003
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "minus", size: 16 })
|
|
2059
2004
|
}
|
|
2060
2005
|
) : null,
|
|
2061
|
-
/* @__PURE__ */
|
|
2006
|
+
/* @__PURE__ */ jsx32(
|
|
2062
2007
|
AriaInput4,
|
|
2063
2008
|
{
|
|
2064
2009
|
className: "pire-input",
|
|
@@ -2067,52 +2012,52 @@ function NumberField({
|
|
|
2067
2012
|
onPasteCapture: handlePaste
|
|
2068
2013
|
}
|
|
2069
2014
|
),
|
|
2070
|
-
suffix ? /* @__PURE__ */
|
|
2071
|
-
showsClear ? /* @__PURE__ */
|
|
2072
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */
|
|
2073
|
-
|
|
2015
|
+
suffix ? /* @__PURE__ */ jsx32("span", { className: "pire-affix", children: suffix }) : null,
|
|
2016
|
+
showsClear ? /* @__PURE__ */ jsx32(ClearButton, { label: clearLabel ?? msg.inputClear, onClear: () => handleChange(NaN) }) : null,
|
|
2017
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ jsx32(
|
|
2018
|
+
AriaButton7,
|
|
2074
2019
|
{
|
|
2075
2020
|
slot: "increment",
|
|
2076
2021
|
className: "pire-qty-btn",
|
|
2077
2022
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
2078
|
-
children: /* @__PURE__ */
|
|
2023
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "plus", size: 16 })
|
|
2079
2024
|
}
|
|
2080
2025
|
) : null,
|
|
2081
|
-
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
|
|
2026
|
+
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */ jsxs23("span", { className: "pire-stepper", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx32(
|
|
2028
|
+
AriaButton7,
|
|
2084
2029
|
{
|
|
2085
2030
|
slot: "increment",
|
|
2086
2031
|
className: "pire-stepper-btn",
|
|
2087
2032
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
2088
|
-
children: /* @__PURE__ */
|
|
2033
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "plus", size: 10 })
|
|
2089
2034
|
}
|
|
2090
2035
|
),
|
|
2091
|
-
/* @__PURE__ */
|
|
2092
|
-
|
|
2036
|
+
/* @__PURE__ */ jsx32(
|
|
2037
|
+
AriaButton7,
|
|
2093
2038
|
{
|
|
2094
2039
|
slot: "decrement",
|
|
2095
2040
|
className: "pire-stepper-btn",
|
|
2096
2041
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
2097
|
-
children: /* @__PURE__ */
|
|
2042
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "minus", size: 10 })
|
|
2098
2043
|
}
|
|
2099
2044
|
)
|
|
2100
2045
|
] })
|
|
2101
2046
|
]
|
|
2102
2047
|
}
|
|
2103
2048
|
),
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ jsx32(FieldDescription, { description, help }),
|
|
2050
|
+
/* @__PURE__ */ jsx32(FieldError8, { className: "pire-field-error", children: errorMessage })
|
|
2106
2051
|
]
|
|
2107
2052
|
}
|
|
2108
2053
|
);
|
|
2109
2054
|
}
|
|
2110
2055
|
|
|
2111
2056
|
// src/components/forms/QuantityStepper.tsx
|
|
2112
|
-
import { jsx as
|
|
2057
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2113
2058
|
function QuantityStepper({ size = "md", ...rest }) {
|
|
2114
2059
|
const msg = usePireMessages();
|
|
2115
|
-
return /* @__PURE__ */
|
|
2060
|
+
return /* @__PURE__ */ jsx33(
|
|
2116
2061
|
NumberField,
|
|
2117
2062
|
{
|
|
2118
2063
|
...rest,
|
|
@@ -2126,25 +2071,54 @@ function QuantityStepper({ size = "md", ...rest }) {
|
|
|
2126
2071
|
}
|
|
2127
2072
|
|
|
2128
2073
|
// src/components/forms/DatePicker.tsx
|
|
2129
|
-
import * as
|
|
2074
|
+
import * as React18 from "react";
|
|
2130
2075
|
import {
|
|
2131
2076
|
DatePicker as AriaDatePicker,
|
|
2132
2077
|
Group as Group6,
|
|
2133
2078
|
DateInput,
|
|
2134
2079
|
DateSegment,
|
|
2135
2080
|
Button as AriaButton9,
|
|
2136
|
-
Popover as
|
|
2081
|
+
Popover as Popover3,
|
|
2137
2082
|
Dialog as AriaDialog,
|
|
2138
2083
|
Calendar,
|
|
2084
|
+
FieldError as FieldError9,
|
|
2085
|
+
DatePickerStateContext
|
|
2086
|
+
} from "react-aria-components";
|
|
2087
|
+
|
|
2088
|
+
// src/components/forms/CalendarMonth.tsx
|
|
2089
|
+
import {
|
|
2090
|
+
Button as AriaButton8,
|
|
2139
2091
|
CalendarGrid,
|
|
2140
2092
|
CalendarGridHeader,
|
|
2141
2093
|
CalendarHeaderCell,
|
|
2142
2094
|
CalendarGridBody,
|
|
2143
2095
|
CalendarCell,
|
|
2144
|
-
Heading as Heading2
|
|
2145
|
-
FieldError as FieldError9,
|
|
2146
|
-
DatePickerStateContext
|
|
2096
|
+
Heading as Heading2
|
|
2147
2097
|
} from "react-aria-components";
|
|
2098
|
+
import { Fragment as Fragment3, jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2099
|
+
function CalendarMonth() {
|
|
2100
|
+
const msg = usePireMessages();
|
|
2101
|
+
return /* @__PURE__ */ jsxs24(Fragment3, { children: [
|
|
2102
|
+
/* @__PURE__ */ jsxs24("header", { className: "pire-calendar-head", children: [
|
|
2103
|
+
/* @__PURE__ */ jsx34(
|
|
2104
|
+
AriaButton8,
|
|
2105
|
+
{
|
|
2106
|
+
slot: "previous",
|
|
2107
|
+
className: "pire-iconbtn",
|
|
2108
|
+
"data-size": "sm",
|
|
2109
|
+
"aria-label": msg.datePickerPreviousMonth,
|
|
2110
|
+
children: /* @__PURE__ */ jsx34(Icon, { name: "chevron-left", size: 16 })
|
|
2111
|
+
}
|
|
2112
|
+
),
|
|
2113
|
+
/* @__PURE__ */ jsx34(Heading2, { className: "pire-calendar-title" }),
|
|
2114
|
+
/* @__PURE__ */ jsx34(AriaButton8, { slot: "next", className: "pire-iconbtn", "data-size": "sm", "aria-label": msg.datePickerNextMonth, children: /* @__PURE__ */ jsx34(Icon, { name: "chevron-right", size: 16 }) })
|
|
2115
|
+
] }),
|
|
2116
|
+
/* @__PURE__ */ jsxs24(CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2117
|
+
/* @__PURE__ */ jsx34(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx34(CalendarHeaderCell, { children: day }) }),
|
|
2118
|
+
/* @__PURE__ */ jsx34(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx34(CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2119
|
+
] })
|
|
2120
|
+
] });
|
|
2121
|
+
}
|
|
2148
2122
|
|
|
2149
2123
|
// src/components/forms/dateValues.ts
|
|
2150
2124
|
import { parseDate } from "@internationalized/date";
|
|
@@ -2174,24 +2148,13 @@ function coerceBound(value) {
|
|
|
2174
2148
|
}
|
|
2175
2149
|
|
|
2176
2150
|
// src/components/forms/DatePicker.tsx
|
|
2177
|
-
import { jsx as
|
|
2151
|
+
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2178
2152
|
function ClearButton2({ label }) {
|
|
2179
|
-
const state =
|
|
2153
|
+
const state = React18.useContext(DatePickerStateContext);
|
|
2180
2154
|
if (!state?.value) {
|
|
2181
2155
|
return null;
|
|
2182
2156
|
}
|
|
2183
|
-
return /* @__PURE__ */
|
|
2184
|
-
AriaButton9,
|
|
2185
|
-
{
|
|
2186
|
-
className: "pire-input-clear",
|
|
2187
|
-
slot: null,
|
|
2188
|
-
onPress: (event) => {
|
|
2189
|
-
state.setValue(null);
|
|
2190
|
-
focusFieldOf(event.target);
|
|
2191
|
-
},
|
|
2192
|
-
children: label
|
|
2193
|
-
}
|
|
2194
|
-
);
|
|
2157
|
+
return /* @__PURE__ */ jsx35(FieldClearButton, { label, onClear: () => state.setValue(null) });
|
|
2195
2158
|
}
|
|
2196
2159
|
function DatePicker({
|
|
2197
2160
|
label,
|
|
@@ -2218,7 +2181,7 @@ function DatePicker({
|
|
|
2218
2181
|
valueFormat === "iso" && next ? next.toString() : next
|
|
2219
2182
|
);
|
|
2220
2183
|
warnHelpWithoutLabel("DatePicker", label, help);
|
|
2221
|
-
return /* @__PURE__ */
|
|
2184
|
+
return /* @__PURE__ */ jsxs25(
|
|
2222
2185
|
AriaDatePicker,
|
|
2223
2186
|
{
|
|
2224
2187
|
className: cx("pire-field", className),
|
|
@@ -2231,8 +2194,8 @@ function DatePicker({
|
|
|
2231
2194
|
onChange: handleChange,
|
|
2232
2195
|
...rest,
|
|
2233
2196
|
children: [
|
|
2234
|
-
label ? /* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2197
|
+
label ? /* @__PURE__ */ jsx35(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2198
|
+
/* @__PURE__ */ jsxs25(
|
|
2236
2199
|
Group6,
|
|
2237
2200
|
{
|
|
2238
2201
|
className: "pire-control",
|
|
@@ -2241,78 +2204,43 @@ function DatePicker({
|
|
|
2241
2204
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
2242
2205
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2243
2206
|
children: [
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
showsClear ? /* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2207
|
+
/* @__PURE__ */ jsx35(DateInput, { className: "pire-datefield", children: (segment) => /* @__PURE__ */ jsx35(DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2208
|
+
showsClear ? /* @__PURE__ */ jsx35(ClearButton2, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2209
|
+
/* @__PURE__ */ jsx35(
|
|
2247
2210
|
AriaButton9,
|
|
2248
2211
|
{
|
|
2249
|
-
className: "pire-iconbtn",
|
|
2212
|
+
className: "pire-iconbtn pire-field-trigger",
|
|
2250
2213
|
"data-size": "sm",
|
|
2251
2214
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2252
|
-
|
|
2253
|
-
children: /* @__PURE__ */ jsx32(Icon, { name: "calendar", size: 16 })
|
|
2215
|
+
children: /* @__PURE__ */ jsx35(Icon, { name: "calendar", size: 16 })
|
|
2254
2216
|
}
|
|
2255
2217
|
)
|
|
2256
2218
|
]
|
|
2257
2219
|
}
|
|
2258
2220
|
),
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2261
|
-
/* @__PURE__ */
|
|
2262
|
-
/* @__PURE__ */ jsxs23("header", { className: "pire-calendar-head", children: [
|
|
2263
|
-
/* @__PURE__ */ jsx32(
|
|
2264
|
-
AriaButton9,
|
|
2265
|
-
{
|
|
2266
|
-
slot: "previous",
|
|
2267
|
-
className: "pire-iconbtn",
|
|
2268
|
-
"data-size": "sm",
|
|
2269
|
-
"aria-label": msg.datePickerPreviousMonth,
|
|
2270
|
-
children: /* @__PURE__ */ jsx32(Icon, { name: "chevron-left", size: 16 })
|
|
2271
|
-
}
|
|
2272
|
-
),
|
|
2273
|
-
/* @__PURE__ */ jsx32(Heading2, { className: "pire-calendar-title" }),
|
|
2274
|
-
/* @__PURE__ */ jsx32(
|
|
2275
|
-
AriaButton9,
|
|
2276
|
-
{
|
|
2277
|
-
slot: "next",
|
|
2278
|
-
className: "pire-iconbtn",
|
|
2279
|
-
"data-size": "sm",
|
|
2280
|
-
"aria-label": msg.datePickerNextMonth,
|
|
2281
|
-
children: /* @__PURE__ */ jsx32(Icon, { name: "chevron-right", size: 16 })
|
|
2282
|
-
}
|
|
2283
|
-
)
|
|
2284
|
-
] }),
|
|
2285
|
-
/* @__PURE__ */ jsxs23(CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2286
|
-
/* @__PURE__ */ jsx32(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx32(CalendarHeaderCell, { children: day }) }),
|
|
2287
|
-
/* @__PURE__ */ jsx32(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx32(CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2288
|
-
] })
|
|
2289
|
-
] }) }) })
|
|
2221
|
+
/* @__PURE__ */ jsx35(FieldDescription, { description, help }),
|
|
2222
|
+
/* @__PURE__ */ jsx35(FieldError9, { className: "pire-field-error", children: errorMessage }),
|
|
2223
|
+
/* @__PURE__ */ jsx35(Popover3, { className: "pire-popover", children: /* @__PURE__ */ jsx35(AriaDialog, { children: /* @__PURE__ */ jsx35(Calendar, { className: "pire-calendar", children: /* @__PURE__ */ jsx35(CalendarMonth, {}) }) }) })
|
|
2290
2224
|
]
|
|
2291
2225
|
}
|
|
2292
2226
|
);
|
|
2293
2227
|
}
|
|
2294
2228
|
|
|
2295
2229
|
// src/components/forms/DateRangePicker.tsx
|
|
2296
|
-
import * as
|
|
2230
|
+
import * as React19 from "react";
|
|
2297
2231
|
import {
|
|
2298
2232
|
DateRangePicker as AriaDateRangePicker,
|
|
2299
2233
|
Group as Group7,
|
|
2300
2234
|
DateInput as DateInput2,
|
|
2301
2235
|
DateSegment as DateSegment2,
|
|
2302
2236
|
Button as AriaButton10,
|
|
2303
|
-
Popover as
|
|
2237
|
+
Popover as Popover4,
|
|
2304
2238
|
Dialog as AriaDialog2,
|
|
2305
2239
|
RangeCalendar,
|
|
2306
|
-
CalendarGrid as CalendarGrid2,
|
|
2307
|
-
CalendarGridHeader as CalendarGridHeader2,
|
|
2308
|
-
CalendarHeaderCell as CalendarHeaderCell2,
|
|
2309
|
-
CalendarGridBody as CalendarGridBody2,
|
|
2310
|
-
CalendarCell as CalendarCell2,
|
|
2311
|
-
Heading as Heading3,
|
|
2312
2240
|
FieldError as FieldError10,
|
|
2313
2241
|
DateRangePickerStateContext
|
|
2314
2242
|
} from "react-aria-components";
|
|
2315
|
-
import { jsx as
|
|
2243
|
+
import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2316
2244
|
function coerceRange(range) {
|
|
2317
2245
|
if (range === void 0) {
|
|
2318
2246
|
return void 0;
|
|
@@ -2333,22 +2261,11 @@ function rangeLengthInDays(range) {
|
|
|
2333
2261
|
return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
|
|
2334
2262
|
}
|
|
2335
2263
|
function ClearButton3({ label }) {
|
|
2336
|
-
const state =
|
|
2264
|
+
const state = React19.useContext(DateRangePickerStateContext);
|
|
2337
2265
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2338
2266
|
return null;
|
|
2339
2267
|
}
|
|
2340
|
-
return /* @__PURE__ */
|
|
2341
|
-
AriaButton10,
|
|
2342
|
-
{
|
|
2343
|
-
className: "pire-input-clear",
|
|
2344
|
-
slot: null,
|
|
2345
|
-
onPress: (event) => {
|
|
2346
|
-
state.setValue(null);
|
|
2347
|
-
focusFieldOf(event.target);
|
|
2348
|
-
},
|
|
2349
|
-
children: label
|
|
2350
|
-
}
|
|
2351
|
-
);
|
|
2268
|
+
return /* @__PURE__ */ jsx36(FieldClearButton, { label, onClear: () => state.setValue(null) });
|
|
2352
2269
|
}
|
|
2353
2270
|
function DateRangePicker({
|
|
2354
2271
|
label,
|
|
@@ -2390,7 +2307,7 @@ function DateRangePicker({
|
|
|
2390
2307
|
);
|
|
2391
2308
|
};
|
|
2392
2309
|
warnHelpWithoutLabel("DateRangePicker", label, help);
|
|
2393
|
-
return /* @__PURE__ */
|
|
2310
|
+
return /* @__PURE__ */ jsxs26(
|
|
2394
2311
|
AriaDateRangePicker,
|
|
2395
2312
|
{
|
|
2396
2313
|
className: cx("pire-field", className),
|
|
@@ -2406,8 +2323,8 @@ function DateRangePicker({
|
|
|
2406
2323
|
...rest,
|
|
2407
2324
|
isInvalid: rest.isInvalid || tooLong || void 0,
|
|
2408
2325
|
children: [
|
|
2409
|
-
label ? /* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
2326
|
+
label ? /* @__PURE__ */ jsx36(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2327
|
+
/* @__PURE__ */ jsxs26(
|
|
2411
2328
|
Group7,
|
|
2412
2329
|
{
|
|
2413
2330
|
className: "pire-control pire-daterange-control",
|
|
@@ -2416,30 +2333,29 @@ function DateRangePicker({
|
|
|
2416
2333
|
"data-invalid": rest.isInvalid || tooLong ? "true" : void 0,
|
|
2417
2334
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2418
2335
|
children: [
|
|
2419
|
-
/* @__PURE__ */
|
|
2420
|
-
/* @__PURE__ */
|
|
2421
|
-
/* @__PURE__ */
|
|
2422
|
-
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2336
|
+
/* @__PURE__ */ jsx36(DateInput2, { slot: "start", className: "pire-datefield", children: (segment) => /* @__PURE__ */ jsx36(DateSegment2, { segment, className: "pire-datesegment" }) }),
|
|
2337
|
+
/* @__PURE__ */ jsx36("span", { "aria-hidden": "true", className: "pire-daterange-dash", children: "\u2013" }),
|
|
2338
|
+
/* @__PURE__ */ jsx36(DateInput2, { slot: "end", className: "pire-datefield", children: (segment) => /* @__PURE__ */ jsx36(DateSegment2, { segment, className: "pire-datesegment" }) }),
|
|
2339
|
+
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */ jsx36(ClearButton3, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2340
|
+
/* @__PURE__ */ jsx36(
|
|
2424
2341
|
AriaButton10,
|
|
2425
2342
|
{
|
|
2426
|
-
className: "pire-iconbtn",
|
|
2343
|
+
className: "pire-iconbtn pire-field-trigger",
|
|
2427
2344
|
"data-size": "sm",
|
|
2428
2345
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2429
|
-
|
|
2430
|
-
children: /* @__PURE__ */ jsx33(Icon, { name: "calendar", size: 16 })
|
|
2346
|
+
children: /* @__PURE__ */ jsx36(Icon, { name: "calendar", size: 16 })
|
|
2431
2347
|
}
|
|
2432
2348
|
)
|
|
2433
2349
|
]
|
|
2434
2350
|
}
|
|
2435
2351
|
),
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2352
|
+
/* @__PURE__ */ jsx36(FieldDescription, { description, help }),
|
|
2353
|
+
/* @__PURE__ */ jsx36(FieldError10, { className: "pire-field-error", children: errorMessage }),
|
|
2354
|
+
/* @__PURE__ */ jsx36(Popover4, { className: "pire-popover", children: /* @__PURE__ */ jsxs26(AriaDialog2, { className: "pire-daterange-dialog", children: [
|
|
2439
2355
|
presets?.length ? (
|
|
2440
2356
|
// Before the calendar in the DOM, so keyboard users reach the shortcut without
|
|
2441
2357
|
// arrowing through a month first.
|
|
2442
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ jsx36("div", { className: "pire-daterange-presets", role: "group", "aria-label": msg.dateRangePresetsLabel, children: presets.map((preset) => /* @__PURE__ */ jsx36(
|
|
2443
2359
|
AriaButton10,
|
|
2444
2360
|
{
|
|
2445
2361
|
className: "pire-daterange-preset",
|
|
@@ -2449,35 +2365,7 @@ function DateRangePicker({
|
|
|
2449
2365
|
preset.id
|
|
2450
2366
|
)) })
|
|
2451
2367
|
) : null,
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */ jsxs24("header", { className: "pire-calendar-head", children: [
|
|
2454
|
-
/* @__PURE__ */ jsx33(
|
|
2455
|
-
AriaButton10,
|
|
2456
|
-
{
|
|
2457
|
-
slot: "previous",
|
|
2458
|
-
className: "pire-iconbtn",
|
|
2459
|
-
"data-size": "sm",
|
|
2460
|
-
"aria-label": msg.datePickerPreviousMonth,
|
|
2461
|
-
children: /* @__PURE__ */ jsx33(Icon, { name: "chevron-left", size: 16 })
|
|
2462
|
-
}
|
|
2463
|
-
),
|
|
2464
|
-
/* @__PURE__ */ jsx33(Heading3, { className: "pire-calendar-title" }),
|
|
2465
|
-
/* @__PURE__ */ jsx33(
|
|
2466
|
-
AriaButton10,
|
|
2467
|
-
{
|
|
2468
|
-
slot: "next",
|
|
2469
|
-
className: "pire-iconbtn",
|
|
2470
|
-
"data-size": "sm",
|
|
2471
|
-
"aria-label": msg.datePickerNextMonth,
|
|
2472
|
-
children: /* @__PURE__ */ jsx33(Icon, { name: "chevron-right", size: 16 })
|
|
2473
|
-
}
|
|
2474
|
-
)
|
|
2475
|
-
] }),
|
|
2476
|
-
/* @__PURE__ */ jsxs24(CalendarGrid2, { className: "pire-calendar-grid", children: [
|
|
2477
|
-
/* @__PURE__ */ jsx33(CalendarGridHeader2, { children: (day) => /* @__PURE__ */ jsx33(CalendarHeaderCell2, { children: day }) }),
|
|
2478
|
-
/* @__PURE__ */ jsx33(CalendarGridBody2, { children: (date) => /* @__PURE__ */ jsx33(CalendarCell2, { date, className: "pire-calendar-cell" }) })
|
|
2479
|
-
] })
|
|
2480
|
-
] })
|
|
2368
|
+
/* @__PURE__ */ jsx36(RangeCalendar, { className: "pire-calendar", children: /* @__PURE__ */ jsx36(CalendarMonth, {}) })
|
|
2481
2369
|
] }) })
|
|
2482
2370
|
]
|
|
2483
2371
|
}
|
|
@@ -2485,27 +2373,41 @@ function DateRangePicker({
|
|
|
2485
2373
|
}
|
|
2486
2374
|
|
|
2487
2375
|
// src/components/forms/ValueHelpField.tsx
|
|
2488
|
-
import * as
|
|
2376
|
+
import * as React23 from "react";
|
|
2489
2377
|
|
|
2490
2378
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2491
|
-
import * as
|
|
2379
|
+
import * as React22 from "react";
|
|
2492
2380
|
import { useFilter } from "react-aria-components";
|
|
2493
2381
|
|
|
2494
2382
|
// src/components/feedback/Dialog.tsx
|
|
2495
|
-
import * as
|
|
2496
|
-
import { ModalOverlay, Modal, Dialog as AriaDialog3, Heading as
|
|
2497
|
-
import { jsx as
|
|
2383
|
+
import * as React20 from "react";
|
|
2384
|
+
import { ModalOverlay, Modal, Dialog as AriaDialog3, Heading as Heading3 } from "react-aria-components";
|
|
2385
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2498
2386
|
function DialogTitle({ children, className }) {
|
|
2499
|
-
return /* @__PURE__ */
|
|
2387
|
+
return /* @__PURE__ */ jsx37(Heading3, { slot: "title", className: cx("pire-dialog-title", className), children });
|
|
2500
2388
|
}
|
|
2501
2389
|
function DialogDescription({ children, className }) {
|
|
2502
|
-
return /* @__PURE__ */
|
|
2390
|
+
return /* @__PURE__ */ jsx37("p", { className: cx("pire-dialog-sub", className), children });
|
|
2503
2391
|
}
|
|
2504
2392
|
function DialogBody({ children, className }) {
|
|
2505
|
-
return /* @__PURE__ */
|
|
2393
|
+
return /* @__PURE__ */ jsx37("div", { className: cx("pire-dialog-body", className), children });
|
|
2506
2394
|
}
|
|
2507
2395
|
function DialogActions({ children, className }) {
|
|
2508
|
-
return /* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ jsx37("footer", { className: cx("pire-dialog-foot", className), children });
|
|
2397
|
+
}
|
|
2398
|
+
function DialogHeader({
|
|
2399
|
+
heading,
|
|
2400
|
+
description,
|
|
2401
|
+
closeLabel,
|
|
2402
|
+
onClose
|
|
2403
|
+
}) {
|
|
2404
|
+
return /* @__PURE__ */ jsxs27("header", { className: "pire-dialog-head", children: [
|
|
2405
|
+
/* @__PURE__ */ jsxs27("div", { className: "pire-dialog-heading", children: [
|
|
2406
|
+
heading,
|
|
2407
|
+
description
|
|
2408
|
+
] }),
|
|
2409
|
+
closeLabel ? /* @__PURE__ */ jsx37(IconButton, { icon: "x", label: closeLabel, size: "sm", onPress: onClose }) : null
|
|
2410
|
+
] });
|
|
2509
2411
|
}
|
|
2510
2412
|
function Dialog({
|
|
2511
2413
|
isOpen,
|
|
@@ -2526,19 +2428,19 @@ function Dialog({
|
|
|
2526
2428
|
onClose?.();
|
|
2527
2429
|
onOpenChange?.(false);
|
|
2528
2430
|
};
|
|
2529
|
-
const parts =
|
|
2530
|
-
const slotOf = (type) => parts.find((node) =>
|
|
2431
|
+
const parts = React20.Children.toArray(children);
|
|
2432
|
+
const slotOf = (type) => parts.find((node) => React20.isValidElement(node) && node.type === type);
|
|
2531
2433
|
const titleSlot = slotOf(DialogTitle);
|
|
2532
2434
|
const descriptionSlot = slotOf(DialogDescription);
|
|
2533
2435
|
const bodySlot = slotOf(DialogBody);
|
|
2534
2436
|
const actionsSlot = slotOf(DialogActions);
|
|
2535
2437
|
const slots = [titleSlot, descriptionSlot, bodySlot, actionsSlot];
|
|
2536
2438
|
const loose = parts.filter((node) => !slots.includes(node));
|
|
2537
|
-
const heading = titleSlot ?? (title ? /* @__PURE__ */
|
|
2538
|
-
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */
|
|
2539
|
-
const actions = actionsSlot ?? (footer ? /* @__PURE__ */
|
|
2540
|
-
const body = bodySlot ?? (loose.length ? /* @__PURE__ */
|
|
2541
|
-
return /* @__PURE__ */
|
|
2439
|
+
const heading = titleSlot ?? (title ? /* @__PURE__ */ jsx37(DialogTitle, { children: title }) : null);
|
|
2440
|
+
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ jsx37(DialogDescription, { children: subtitle }) : null);
|
|
2441
|
+
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ jsx37("footer", { className: "pire-dialog-foot", children: footer }) : null);
|
|
2442
|
+
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ jsx37("div", { className: "pire-dialog-body", children: loose }) : null);
|
|
2443
|
+
return /* @__PURE__ */ jsx37(
|
|
2542
2444
|
ModalOverlay,
|
|
2543
2445
|
{
|
|
2544
2446
|
className: "pire-modal-overlay",
|
|
@@ -2547,14 +2449,16 @@ function Dialog({
|
|
|
2547
2449
|
onOpenChange: (o) => {
|
|
2548
2450
|
if (!o) close();
|
|
2549
2451
|
},
|
|
2550
|
-
children: /* @__PURE__ */
|
|
2551
|
-
heading || description ? /* @__PURE__ */
|
|
2552
|
-
|
|
2452
|
+
children: /* @__PURE__ */ jsx37(Modal, { className: cx("pire-modal", className), "data-size": size, style, children: /* @__PURE__ */ jsxs27(AriaDialog3, { className: "pire-dialog", children: [
|
|
2453
|
+
heading || description ? /* @__PURE__ */ jsx37(
|
|
2454
|
+
DialogHeader,
|
|
2455
|
+
{
|
|
2553
2456
|
heading,
|
|
2554
|
-
description
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2457
|
+
description,
|
|
2458
|
+
closeLabel: showClose ? msg.dialogClose : void 0,
|
|
2459
|
+
onClose: close
|
|
2460
|
+
}
|
|
2461
|
+
) : null,
|
|
2558
2462
|
body,
|
|
2559
2463
|
actions
|
|
2560
2464
|
] }) })
|
|
@@ -2563,7 +2467,7 @@ function Dialog({
|
|
|
2563
2467
|
}
|
|
2564
2468
|
|
|
2565
2469
|
// src/components/data/DataTable.tsx
|
|
2566
|
-
import * as
|
|
2470
|
+
import * as React21 from "react";
|
|
2567
2471
|
import {
|
|
2568
2472
|
Table,
|
|
2569
2473
|
TableHeader,
|
|
@@ -2576,9 +2480,9 @@ import {
|
|
|
2576
2480
|
} from "react-aria-components";
|
|
2577
2481
|
|
|
2578
2482
|
// src/components/feedback/Skeleton.tsx
|
|
2579
|
-
import { jsx as
|
|
2483
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2580
2484
|
function Skeleton({ shape = "text", width, height, className, style, ...rest }) {
|
|
2581
|
-
return /* @__PURE__ */
|
|
2485
|
+
return /* @__PURE__ */ jsx38(
|
|
2582
2486
|
"div",
|
|
2583
2487
|
{
|
|
2584
2488
|
className: cx("pire-skeleton", className),
|
|
@@ -2598,7 +2502,7 @@ function SkeletonTableRow({
|
|
|
2598
2502
|
...rest
|
|
2599
2503
|
}) {
|
|
2600
2504
|
const cells = typeof columns === "number" ? Array.from({ length: columns }, () => ({})) : columns;
|
|
2601
|
-
return /* @__PURE__ */
|
|
2505
|
+
return /* @__PURE__ */ jsx38(
|
|
2602
2506
|
"div",
|
|
2603
2507
|
{
|
|
2604
2508
|
className: cx("pire-skeleton-row", className),
|
|
@@ -2608,13 +2512,13 @@ function SkeletonTableRow({
|
|
|
2608
2512
|
...rest,
|
|
2609
2513
|
children: cells.map((c, i) => {
|
|
2610
2514
|
const align = c.numeric ? "right" : c.align ?? "left";
|
|
2611
|
-
return /* @__PURE__ */
|
|
2515
|
+
return /* @__PURE__ */ jsx38(
|
|
2612
2516
|
"div",
|
|
2613
2517
|
{
|
|
2614
2518
|
className: "pire-skeleton-cell",
|
|
2615
2519
|
"data-align": align,
|
|
2616
2520
|
style: { width: c.width, flex: c.width ? "0 0 auto" : void 0 },
|
|
2617
|
-
children: /* @__PURE__ */
|
|
2521
|
+
children: /* @__PURE__ */ jsx38(Skeleton, { width: BAR_WIDTHS[i % BAR_WIDTHS.length] })
|
|
2618
2522
|
},
|
|
2619
2523
|
i
|
|
2620
2524
|
);
|
|
@@ -2624,14 +2528,7 @@ function SkeletonTableRow({
|
|
|
2624
2528
|
}
|
|
2625
2529
|
|
|
2626
2530
|
// src/components/data/DataTable.tsx
|
|
2627
|
-
import { jsx as
|
|
2628
|
-
var IS_DEV3 = process.env.NODE_ENV !== "production";
|
|
2629
|
-
var warned3 = /* @__PURE__ */ new Set();
|
|
2630
|
-
function warnOnce3(key, message) {
|
|
2631
|
-
if (warned3.has(key)) return;
|
|
2632
|
-
warned3.add(key);
|
|
2633
|
-
console.warn(`[pire] ${message}`);
|
|
2634
|
-
}
|
|
2531
|
+
import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2635
2532
|
var CHECKBOX_W = 44;
|
|
2636
2533
|
var PENDING_KEY = "__pire_pending_row__";
|
|
2637
2534
|
var FIELD_SELECTOR = [
|
|
@@ -2649,11 +2546,11 @@ function EditCell({
|
|
|
2649
2546
|
onCommit,
|
|
2650
2547
|
onCancel
|
|
2651
2548
|
}) {
|
|
2652
|
-
const state =
|
|
2549
|
+
const state = React21.useContext(TableStateContext);
|
|
2653
2550
|
const setNavDisabled = state?.setKeyboardNavigationDisabled;
|
|
2654
|
-
const ref =
|
|
2655
|
-
const focusedWithin =
|
|
2656
|
-
|
|
2551
|
+
const ref = React21.useRef(null);
|
|
2552
|
+
const focusedWithin = React21.useRef(false);
|
|
2553
|
+
React21.useLayoutEffect(() => {
|
|
2657
2554
|
if (!isFirst) return;
|
|
2658
2555
|
const row = ref.current?.closest('[role="row"]');
|
|
2659
2556
|
void focusToken;
|
|
@@ -2665,7 +2562,7 @@ function EditCell({
|
|
|
2665
2562
|
}
|
|
2666
2563
|
}
|
|
2667
2564
|
}, [isFirst, focusToken]);
|
|
2668
|
-
|
|
2565
|
+
React21.useLayoutEffect(() => {
|
|
2669
2566
|
if (!isFirst) return;
|
|
2670
2567
|
const row = ref.current?.closest('[role="row"]');
|
|
2671
2568
|
return () => {
|
|
@@ -2675,7 +2572,7 @@ function EditCell({
|
|
|
2675
2572
|
});
|
|
2676
2573
|
};
|
|
2677
2574
|
}, [isFirst]);
|
|
2678
|
-
|
|
2575
|
+
React21.useEffect(
|
|
2679
2576
|
() => () => {
|
|
2680
2577
|
if (focusedWithin.current) setNavDisabled?.(false);
|
|
2681
2578
|
},
|
|
@@ -2684,7 +2581,7 @@ function EditCell({
|
|
|
2684
2581
|
const stop = (e) => e.stopPropagation();
|
|
2685
2582
|
return (
|
|
2686
2583
|
// 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
|
|
2687
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsx39(
|
|
2688
2585
|
"div",
|
|
2689
2586
|
{
|
|
2690
2587
|
ref,
|
|
@@ -2720,24 +2617,24 @@ function EditCell({
|
|
|
2720
2617
|
)
|
|
2721
2618
|
);
|
|
2722
2619
|
}
|
|
2723
|
-
var LiveEditContext =
|
|
2620
|
+
var LiveEditContext = React21.createContext(null);
|
|
2724
2621
|
function LiveEditField({ columnKey, row }) {
|
|
2725
|
-
const live =
|
|
2622
|
+
const live = React21.useContext(LiveEditContext);
|
|
2726
2623
|
const column = live?.columns.find((c) => c.key === columnKey);
|
|
2727
2624
|
const target = row ?? live?.pendingRow;
|
|
2728
2625
|
return target && column?.renderEdit ? column.renderEdit(target) : null;
|
|
2729
2626
|
}
|
|
2730
2627
|
function useTableElement(deps, columnFunctions, isEditing, build) {
|
|
2731
|
-
const cache =
|
|
2732
|
-
const churn =
|
|
2628
|
+
const cache = React21.useRef(null);
|
|
2629
|
+
const churn = React21.useRef(0);
|
|
2733
2630
|
const prev = cache.current;
|
|
2734
2631
|
if (prev && sameValues(prev.deps, deps) && sameValues(prev.columnFunctions, columnFunctions)) {
|
|
2735
2632
|
churn.current = 0;
|
|
2736
2633
|
return prev.element;
|
|
2737
2634
|
}
|
|
2738
|
-
if (
|
|
2739
|
-
|
|
2740
|
-
"columns-churn",
|
|
2635
|
+
if (IS_DEV && isEditing && prev && sameValues(prev.deps, deps) && ++churn.current === 3) {
|
|
2636
|
+
warnOnce(
|
|
2637
|
+
"datatable:columns-churn",
|
|
2741
2638
|
"DataTable columns get new render/tone functions on every render, so each keystroke in an editing row re-renders the whole table. Define the columns outside the component or memoize them; see the `columns` prop."
|
|
2742
2639
|
);
|
|
2743
2640
|
}
|
|
@@ -2771,16 +2668,16 @@ function DataTable({
|
|
|
2771
2668
|
onCancelRow,
|
|
2772
2669
|
className,
|
|
2773
2670
|
style,
|
|
2774
|
-
|
|
2671
|
+
"aria-label": ariaLabel
|
|
2775
2672
|
}) {
|
|
2776
2673
|
const msg = usePireMessages();
|
|
2777
|
-
const [pendingFocus, setPendingFocus] =
|
|
2778
|
-
const latest =
|
|
2674
|
+
const [pendingFocus, setPendingFocus] = React21.useState(0);
|
|
2675
|
+
const latest = React21.useRef({ onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow });
|
|
2779
2676
|
latest.current = { onSelectionChange, onSortChange, onRowAction, onCommitRow, onCancelRow };
|
|
2780
2677
|
const isEditing = (row) => editingRowId != null && String(row.id) === String(editingRowId);
|
|
2781
2678
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2782
2679
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2783
|
-
const pinnedGeometry =
|
|
2680
|
+
const pinnedGeometry = React21.useMemo(() => {
|
|
2784
2681
|
const geometry = /* @__PURE__ */ new Map();
|
|
2785
2682
|
let x = hasCheckboxColumn ? CHECKBOX_W : 0;
|
|
2786
2683
|
let broke = null;
|
|
@@ -2790,9 +2687,9 @@ function DataTable({
|
|
|
2790
2687
|
break;
|
|
2791
2688
|
}
|
|
2792
2689
|
if (typeof column.width !== "number") {
|
|
2793
|
-
if (
|
|
2794
|
-
|
|
2795
|
-
`pin-width:${column.key}`,
|
|
2690
|
+
if (IS_DEV)
|
|
2691
|
+
warnOnce(
|
|
2692
|
+
`datatable:pin-width:${column.key}`,
|
|
2796
2693
|
`DataTable column "${column.key}" is pinned but has no numeric width, so its offset cannot be computed. It will scroll.`
|
|
2797
2694
|
);
|
|
2798
2695
|
broke = "width";
|
|
@@ -2801,11 +2698,11 @@ function DataTable({
|
|
|
2801
2698
|
geometry.set(column.key, { left: x, width: column.width });
|
|
2802
2699
|
x += column.width;
|
|
2803
2700
|
}
|
|
2804
|
-
if (
|
|
2701
|
+
if (IS_DEV && broke === "unpinned") {
|
|
2805
2702
|
const stranded = columns.slice(geometry.size).find((c) => c.pinned);
|
|
2806
2703
|
if (stranded) {
|
|
2807
|
-
|
|
2808
|
-
`pin-gap:${stranded.key}`,
|
|
2704
|
+
warnOnce(
|
|
2705
|
+
`datatable:pin-gap:${stranded.key}`,
|
|
2809
2706
|
`DataTable column "${stranded.key}" is pinned but does not sit in the leading run, so it will scroll. Move it before the first unpinned column.`
|
|
2810
2707
|
);
|
|
2811
2708
|
}
|
|
@@ -2848,9 +2745,17 @@ function DataTable({
|
|
|
2848
2745
|
style: { left: box.left, width: box.width, minWidth: box.width, maxWidth: box.width }
|
|
2849
2746
|
};
|
|
2850
2747
|
};
|
|
2748
|
+
const cellProps = (c) => {
|
|
2749
|
+
const pin = pinProps(c.key);
|
|
2750
|
+
return {
|
|
2751
|
+
"data-numeric": c.numeric ? "true" : void 0,
|
|
2752
|
+
...pin,
|
|
2753
|
+
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 }
|
|
2754
|
+
};
|
|
2755
|
+
};
|
|
2851
2756
|
const renderRecord = (row, editing) => {
|
|
2852
2757
|
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
2853
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsxs28(
|
|
2854
2759
|
Row,
|
|
2855
2760
|
{
|
|
2856
2761
|
id: row.id,
|
|
@@ -2858,37 +2763,23 @@ function DataTable({
|
|
|
2858
2763
|
"data-pressable": onRowAction && !rowIsDisabled && !editing ? "true" : void 0,
|
|
2859
2764
|
"data-editing": editing ? "true" : void 0,
|
|
2860
2765
|
children: [
|
|
2861
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
2862
|
-
columns.map((c) => {
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
children: editing && c.renderEdit ? /* @__PURE__ */ jsx36(
|
|
2873
|
-
EditCell,
|
|
2874
|
-
{
|
|
2875
|
-
isFirst: c === firstEditable,
|
|
2876
|
-
focusToken: 0,
|
|
2877
|
-
onCommit: () => latest.current.onCommitRow?.(row.id),
|
|
2878
|
-
onCancel: () => latest.current.onCancelRow?.(row.id),
|
|
2879
|
-
children: /* @__PURE__ */ jsx36(LiveEditField, { columnKey: c.key, row })
|
|
2880
|
-
}
|
|
2881
|
-
) : c.render ? c.render(row) : row[c.key]
|
|
2882
|
-
},
|
|
2883
|
-
c.key
|
|
2884
|
-
);
|
|
2885
|
-
})
|
|
2766
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx39(Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ jsx39(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
2767
|
+
columns.map((c) => /* @__PURE__ */ jsx39(Cell, { className: "pire-td", "data-tone": c.tone?.(row) ?? void 0, ...cellProps(c), children: editing && c.renderEdit ? /* @__PURE__ */ jsx39(
|
|
2768
|
+
EditCell,
|
|
2769
|
+
{
|
|
2770
|
+
isFirst: c === firstEditable,
|
|
2771
|
+
focusToken: 0,
|
|
2772
|
+
onCommit: () => latest.current.onCommitRow?.(row.id),
|
|
2773
|
+
onCancel: () => latest.current.onCancelRow?.(row.id),
|
|
2774
|
+
children: /* @__PURE__ */ jsx39(LiveEditField, { columnKey: c.key, row })
|
|
2775
|
+
}
|
|
2776
|
+
) : c.render ? c.render(row) : row[c.key] }, c.key))
|
|
2886
2777
|
]
|
|
2887
2778
|
},
|
|
2888
2779
|
row.id
|
|
2889
2780
|
);
|
|
2890
2781
|
};
|
|
2891
|
-
const renderDetail = (row) => /* @__PURE__ */
|
|
2782
|
+
const renderDetail = (row) => /* @__PURE__ */ jsx39(Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ jsx39(Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded?.(row) }) }, expandedKey(row.id));
|
|
2892
2783
|
const table = useTableElement(
|
|
2893
2784
|
[
|
|
2894
2785
|
rows,
|
|
@@ -2900,7 +2791,7 @@ function DataTable({
|
|
|
2900
2791
|
stickyHeader,
|
|
2901
2792
|
hideSelectAll,
|
|
2902
2793
|
selectionMode,
|
|
2903
|
-
|
|
2794
|
+
ariaLabel,
|
|
2904
2795
|
selected,
|
|
2905
2796
|
sort?.key,
|
|
2906
2797
|
sort?.dir,
|
|
@@ -2927,14 +2818,14 @@ function DataTable({
|
|
|
2927
2818
|
],
|
|
2928
2819
|
columns.flatMap((c) => [c.render, c.tone]),
|
|
2929
2820
|
editingRowId != null || pendingRow != null,
|
|
2930
|
-
() => /* @__PURE__ */
|
|
2821
|
+
() => /* @__PURE__ */ jsxs28(
|
|
2931
2822
|
Table,
|
|
2932
2823
|
{
|
|
2933
2824
|
className: "pire-table",
|
|
2934
2825
|
"data-density": density,
|
|
2935
2826
|
"data-sticky": String(stickyHeader),
|
|
2936
2827
|
"data-pinned": hasPinned ? "true" : void 0,
|
|
2937
|
-
"aria-label":
|
|
2828
|
+
"aria-label": ariaLabel,
|
|
2938
2829
|
disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
|
|
2939
2830
|
selectionMode,
|
|
2940
2831
|
selectedKeys: selected ? new Set(selected) : void 0,
|
|
@@ -2949,16 +2840,12 @@ function DataTable({
|
|
|
2949
2840
|
if (row && !isEditing(row)) latest.current.onRowAction?.(row);
|
|
2950
2841
|
} : void 0,
|
|
2951
2842
|
children: [
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
2843
|
+
/* @__PURE__ */ jsxs28(TableHeader, { className: "pire-thead-row", children: [
|
|
2844
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx39(Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ jsx39("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ jsx39(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
2954
2845
|
columns.map((c, i) => (
|
|
2955
|
-
// The
|
|
2956
|
-
//
|
|
2957
|
-
|
|
2958
|
-
// table with no row header at all: invisible on first paint, and a hard crash from
|
|
2959
|
-
// React Aria's own "table must have a row header" invariant the moment `rows` changes
|
|
2960
|
-
// under it (search, sort, a paginated load).
|
|
2961
|
-
/* @__PURE__ */ jsx36(
|
|
2846
|
+
// The first *data* column is the row header, checkbox column or not: a selection
|
|
2847
|
+
// control does not identify the record, and React Aria throws without a row header.
|
|
2848
|
+
/* @__PURE__ */ jsx39(
|
|
2962
2849
|
Column,
|
|
2963
2850
|
{
|
|
2964
2851
|
id: c.key,
|
|
@@ -2968,16 +2855,15 @@ function DataTable({
|
|
|
2968
2855
|
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
2969
2856
|
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
2970
2857
|
...pinProps(c.key),
|
|
2971
|
-
children: /* @__PURE__ */
|
|
2858
|
+
children: /* @__PURE__ */ jsxs28("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
|
|
2972
2859
|
c.label,
|
|
2973
|
-
c.sortable ? /* @__PURE__ */
|
|
2860
|
+
c.sortable ? /* @__PURE__ */ jsx39(
|
|
2974
2861
|
Icon,
|
|
2975
2862
|
{
|
|
2976
2863
|
size: 12,
|
|
2977
2864
|
name: sort?.key === c.key ? sort.dir === "asc" ? "arrow-up" : "arrow-down" : "chevrons-up-down",
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
}
|
|
2865
|
+
className: "pire-th-sort-icon",
|
|
2866
|
+
"data-active": sort?.key === c.key ? "true" : void 0
|
|
2981
2867
|
}
|
|
2982
2868
|
) : null
|
|
2983
2869
|
] })
|
|
@@ -2986,18 +2872,18 @@ function DataTable({
|
|
|
2986
2872
|
)
|
|
2987
2873
|
))
|
|
2988
2874
|
] }),
|
|
2989
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ jsxs28(
|
|
2990
2876
|
TableBody,
|
|
2991
2877
|
{
|
|
2992
|
-
renderEmptyState: () => isLoading ? /* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2878
|
+
renderEmptyState: () => isLoading ? /* @__PURE__ */ jsxs28("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
|
|
2879
|
+
/* @__PURE__ */ jsx39("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
|
|
2994
2880
|
Array.from({ length: skeletonRows }, (_, i) => (
|
|
2995
2881
|
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
2996
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsx39(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
2997
2883
|
))
|
|
2998
|
-
] }) : /* @__PURE__ */
|
|
2884
|
+
] }) : /* @__PURE__ */ jsx39("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
|
|
2999
2885
|
children: [
|
|
3000
|
-
pendingRow && !isLoading ? /* @__PURE__ */
|
|
2886
|
+
pendingRow && !isLoading ? /* @__PURE__ */ jsxs28(
|
|
3001
2887
|
Row,
|
|
3002
2888
|
{
|
|
3003
2889
|
id: PENDING_KEY,
|
|
@@ -3005,33 +2891,20 @@ function DataTable({
|
|
|
3005
2891
|
"data-editing": "true",
|
|
3006
2892
|
"data-pending": "true",
|
|
3007
2893
|
children: [
|
|
3008
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
3009
|
-
columns.map((c) => {
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
3018
|
-
children: c.renderEdit ? /* @__PURE__ */ jsx36(
|
|
3019
|
-
EditCell,
|
|
3020
|
-
{
|
|
3021
|
-
isFirst: c === firstEditable,
|
|
3022
|
-
focusToken: pendingFocus,
|
|
3023
|
-
onCommit: () => {
|
|
3024
|
-
latest.current.onCommitRow?.(null);
|
|
3025
|
-
setPendingFocus((n) => n + 1);
|
|
3026
|
-
},
|
|
3027
|
-
onCancel: () => latest.current.onCancelRow?.(null),
|
|
3028
|
-
children: /* @__PURE__ */ jsx36(LiveEditField, { columnKey: c.key, row: null })
|
|
3029
|
-
}
|
|
3030
|
-
) : null
|
|
2894
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx39(Cell, { className: "pire-td", ...pinProps(null) }) : null,
|
|
2895
|
+
columns.map((c) => /* @__PURE__ */ jsx39(Cell, { className: "pire-td", ...cellProps(c), children: c.renderEdit ? /* @__PURE__ */ jsx39(
|
|
2896
|
+
EditCell,
|
|
2897
|
+
{
|
|
2898
|
+
isFirst: c === firstEditable,
|
|
2899
|
+
focusToken: pendingFocus,
|
|
2900
|
+
onCommit: () => {
|
|
2901
|
+
latest.current.onCommitRow?.(null);
|
|
2902
|
+
setPendingFocus((n) => n + 1);
|
|
3031
2903
|
},
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
2904
|
+
onCancel: () => latest.current.onCancelRow?.(null),
|
|
2905
|
+
children: /* @__PURE__ */ jsx39(LiveEditField, { columnKey: c.key, row: null })
|
|
2906
|
+
}
|
|
2907
|
+
) : null }, c.key))
|
|
3035
2908
|
]
|
|
3036
2909
|
},
|
|
3037
2910
|
PENDING_KEY
|
|
@@ -3044,41 +2917,28 @@ function DataTable({
|
|
|
3044
2917
|
]
|
|
3045
2918
|
}
|
|
3046
2919
|
),
|
|
3047
|
-
footer && !isLoading ? /* @__PURE__ */
|
|
3048
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
3049
|
-
columns.map((c, i) => {
|
|
3050
|
-
const pin = pinProps(c.key);
|
|
3051
|
-
return /* @__PURE__ */ jsx36(
|
|
3052
|
-
Cell,
|
|
3053
|
-
{
|
|
3054
|
-
className: "pire-tf",
|
|
3055
|
-
"data-numeric": c.numeric ? "true" : void 0,
|
|
3056
|
-
...pin,
|
|
3057
|
-
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
3058
|
-
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ jsx36("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
3059
|
-
},
|
|
3060
|
-
c.key
|
|
3061
|
-
);
|
|
3062
|
-
})
|
|
2920
|
+
footer && !isLoading ? /* @__PURE__ */ jsx39(TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ jsxs28(Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
2921
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx39(Cell, { className: "pire-tf", ...pinProps(null) }) : null,
|
|
2922
|
+
columns.map((c, i) => /* @__PURE__ */ jsx39(Cell, { className: "pire-tf", ...cellProps(c), children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ jsx39("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null) }, c.key))
|
|
3063
2923
|
] }) }) : null
|
|
3064
2924
|
]
|
|
3065
2925
|
}
|
|
3066
2926
|
)
|
|
3067
2927
|
);
|
|
3068
|
-
return /* @__PURE__ */
|
|
2928
|
+
return /* @__PURE__ */ jsx39(
|
|
3069
2929
|
"div",
|
|
3070
2930
|
{
|
|
3071
2931
|
className: cx("pire-table-wrap", className),
|
|
3072
2932
|
style,
|
|
3073
2933
|
"data-loading": isLoading ? "true" : void 0,
|
|
3074
2934
|
"aria-busy": isLoading ? "true" : void 0,
|
|
3075
|
-
children: /* @__PURE__ */
|
|
2935
|
+
children: /* @__PURE__ */ jsx39(LiveEditContext.Provider, { value: { columns, pendingRow }, children: table })
|
|
3076
2936
|
}
|
|
3077
2937
|
);
|
|
3078
2938
|
}
|
|
3079
2939
|
|
|
3080
2940
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
3081
|
-
import { Fragment as
|
|
2941
|
+
import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3082
2942
|
function ValueHelpDialog({
|
|
3083
2943
|
isOpen,
|
|
3084
2944
|
title,
|
|
@@ -3099,13 +2959,13 @@ function ValueHelpDialog({
|
|
|
3099
2959
|
}) {
|
|
3100
2960
|
const msg = usePireMessages();
|
|
3101
2961
|
const onListScroll = useLoadMoreOnScroll(onLoadMore, isLoading);
|
|
3102
|
-
const [query, setQuery] =
|
|
3103
|
-
|
|
2962
|
+
const [query, setQuery] = React22.useState("");
|
|
2963
|
+
React22.useEffect(() => {
|
|
3104
2964
|
if (isOpen) setQuery("");
|
|
3105
2965
|
}, [isOpen]);
|
|
3106
2966
|
const isMultiple = selectionMode === "multiple";
|
|
3107
2967
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
3108
|
-
const filtered =
|
|
2968
|
+
const filtered = React22.useMemo(() => {
|
|
3109
2969
|
if (isFilteredExternally) return rows;
|
|
3110
2970
|
const q = query.trim();
|
|
3111
2971
|
if (!q) return rows;
|
|
@@ -3116,16 +2976,16 @@ function ValueHelpDialog({
|
|
|
3116
2976
|
setQuery(value);
|
|
3117
2977
|
onSearch?.(value);
|
|
3118
2978
|
};
|
|
3119
|
-
return /* @__PURE__ */
|
|
2979
|
+
return /* @__PURE__ */ jsx40(
|
|
3120
2980
|
Dialog,
|
|
3121
2981
|
{
|
|
3122
2982
|
isOpen,
|
|
3123
2983
|
size: "lg",
|
|
3124
2984
|
title: title ?? msg.valueHelpDialogTitle,
|
|
3125
2985
|
onClose,
|
|
3126
|
-
footer: /* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
isMultiple ? /* @__PURE__ */
|
|
2986
|
+
footer: /* @__PURE__ */ jsxs29(Fragment4, { children: [
|
|
2987
|
+
/* @__PURE__ */ jsx40(Button, { variant: "tertiary", onPress: onClose, children: msg.valueHelpDialogCancel }),
|
|
2988
|
+
isMultiple ? /* @__PURE__ */ jsx40(
|
|
3129
2989
|
Button,
|
|
3130
2990
|
{
|
|
3131
2991
|
variant: "primary",
|
|
@@ -3137,8 +2997,8 @@ function ValueHelpDialog({
|
|
|
3137
2997
|
}
|
|
3138
2998
|
) : null
|
|
3139
2999
|
] }),
|
|
3140
|
-
children: /* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3000
|
+
children: /* @__PURE__ */ jsxs29("div", { className: "pire-valuehelp-body", children: [
|
|
3001
|
+
/* @__PURE__ */ jsx40(
|
|
3142
3002
|
Input,
|
|
3143
3003
|
{
|
|
3144
3004
|
"aria-label": msg.valueHelpDialogSearch,
|
|
@@ -3151,12 +3011,12 @@ function ValueHelpDialog({
|
|
|
3151
3011
|
autoFocus: true
|
|
3152
3012
|
}
|
|
3153
3013
|
),
|
|
3154
|
-
isMultiple ? /* @__PURE__ */
|
|
3155
|
-
/* @__PURE__ */
|
|
3156
|
-
/* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3014
|
+
isMultiple ? /* @__PURE__ */ jsxs29("div", { className: "pire-valuehelp-selectionbar", children: [
|
|
3015
|
+
/* @__PURE__ */ jsx40(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.(rows.map((r) => r.id)), children: msg.valueHelpSelectAllCount.replace("{count}", String(rows.length)) }),
|
|
3016
|
+
/* @__PURE__ */ jsx40(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.([]), children: msg.valueHelpClearSelection }),
|
|
3017
|
+
/* @__PURE__ */ jsx40("span", { className: "pire-valuehelp-count", children: msg.valueHelpSelectedCount.replace("{count}", String(selectedKeys?.length ?? 0)) })
|
|
3158
3018
|
] }) : null,
|
|
3159
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx40("div", { className: "pire-valuehelp-list", onScroll: onListScroll, children: /* @__PURE__ */ jsx40(
|
|
3160
3020
|
DataTable,
|
|
3161
3021
|
{
|
|
3162
3022
|
"aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
|
|
@@ -3181,7 +3041,7 @@ function ValueHelpDialog({
|
|
|
3181
3041
|
}
|
|
3182
3042
|
|
|
3183
3043
|
// src/components/forms/ValueHelpField.tsx
|
|
3184
|
-
import { jsx as
|
|
3044
|
+
import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3185
3045
|
var defaultFormat = (row) => [row.id, row.name ?? row.label ?? row.text].filter(Boolean).join(" \u2014 ");
|
|
3186
3046
|
function ValueHelpField({
|
|
3187
3047
|
label,
|
|
@@ -3202,14 +3062,15 @@ function ValueHelpField({
|
|
|
3202
3062
|
isInvalid,
|
|
3203
3063
|
isDisabled,
|
|
3204
3064
|
isRequired,
|
|
3065
|
+
isClearable,
|
|
3205
3066
|
allowsClear,
|
|
3206
3067
|
className,
|
|
3207
3068
|
style
|
|
3208
3069
|
}) {
|
|
3209
3070
|
const msg = usePireMessages();
|
|
3210
|
-
const [open, setOpen] =
|
|
3211
|
-
return /* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3071
|
+
const [open, setOpen] = React23.useState(false);
|
|
3072
|
+
return /* @__PURE__ */ jsxs30("div", { className: cx(className), style, children: [
|
|
3073
|
+
/* @__PURE__ */ jsx41(
|
|
3213
3074
|
Input,
|
|
3214
3075
|
{
|
|
3215
3076
|
label,
|
|
@@ -3221,8 +3082,8 @@ function ValueHelpField({
|
|
|
3221
3082
|
placeholder: placeholder ?? msg.valueHelpFieldPlaceholder,
|
|
3222
3083
|
description,
|
|
3223
3084
|
errorMessage,
|
|
3224
|
-
suffix: /* @__PURE__ */
|
|
3225
|
-
allowsClear && value ? /* @__PURE__ */
|
|
3085
|
+
suffix: /* @__PURE__ */ jsxs30("span", { className: "pire-valuehelp-actions", children: [
|
|
3086
|
+
(isClearable ?? allowsClear) && value ? /* @__PURE__ */ jsx41(
|
|
3226
3087
|
IconButton,
|
|
3227
3088
|
{
|
|
3228
3089
|
icon: "x",
|
|
@@ -3231,7 +3092,7 @@ function ValueHelpField({
|
|
|
3231
3092
|
onPress: () => onChange?.(null)
|
|
3232
3093
|
}
|
|
3233
3094
|
) : null,
|
|
3234
|
-
/* @__PURE__ */
|
|
3095
|
+
/* @__PURE__ */ jsx41(
|
|
3235
3096
|
IconButton,
|
|
3236
3097
|
{
|
|
3237
3098
|
icon: "search",
|
|
@@ -3243,7 +3104,7 @@ function ValueHelpField({
|
|
|
3243
3104
|
] })
|
|
3244
3105
|
}
|
|
3245
3106
|
),
|
|
3246
|
-
/* @__PURE__ */
|
|
3107
|
+
/* @__PURE__ */ jsx41(
|
|
3247
3108
|
ValueHelpDialog,
|
|
3248
3109
|
{
|
|
3249
3110
|
isOpen: open,
|
|
@@ -3263,12 +3124,12 @@ function ValueHelpField({
|
|
|
3263
3124
|
}
|
|
3264
3125
|
|
|
3265
3126
|
// src/components/forms/FileUpload.tsx
|
|
3266
|
-
import * as
|
|
3127
|
+
import * as React24 from "react";
|
|
3267
3128
|
import { FileTrigger } from "react-aria-components";
|
|
3268
3129
|
|
|
3269
3130
|
// src/components/feedback/ProgressBar.tsx
|
|
3270
3131
|
import { ProgressBar as AriaProgressBar, Label as Label3 } from "react-aria-components";
|
|
3271
|
-
import { Fragment as
|
|
3132
|
+
import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3272
3133
|
function ProgressBar({
|
|
3273
3134
|
value = 0,
|
|
3274
3135
|
minValue = 0,
|
|
@@ -3281,7 +3142,7 @@ function ProgressBar({
|
|
|
3281
3142
|
className,
|
|
3282
3143
|
style
|
|
3283
3144
|
}) {
|
|
3284
|
-
return /* @__PURE__ */
|
|
3145
|
+
return /* @__PURE__ */ jsx42(
|
|
3285
3146
|
AriaProgressBar,
|
|
3286
3147
|
{
|
|
3287
3148
|
className: cx("pire-progress", className),
|
|
@@ -3292,19 +3153,19 @@ function ProgressBar({
|
|
|
3292
3153
|
maxValue,
|
|
3293
3154
|
isIndeterminate,
|
|
3294
3155
|
style,
|
|
3295
|
-
children: ({ percentage, valueText }) => /* @__PURE__ */
|
|
3296
|
-
label || showValue ? /* @__PURE__ */
|
|
3297
|
-
label ? /* @__PURE__ */
|
|
3298
|
-
showValue && !isIndeterminate ? /* @__PURE__ */
|
|
3156
|
+
children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs31(Fragment5, { children: [
|
|
3157
|
+
label || showValue ? /* @__PURE__ */ jsxs31("div", { className: "pire-progress-head", children: [
|
|
3158
|
+
label ? /* @__PURE__ */ jsx42(Label3, { children: label }) : /* @__PURE__ */ jsx42("span", {}),
|
|
3159
|
+
showValue && !isIndeterminate ? /* @__PURE__ */ jsx42("span", { className: "pire-numeric", children: valueText }) : null
|
|
3299
3160
|
] }) : null,
|
|
3300
|
-
/* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ jsx42("div", { className: "pire-progress-track", children: /* @__PURE__ */ jsx42("div", { className: "pire-progress-fill", style: { width: `${isIndeterminate ? 40 : percentage}%` } }) })
|
|
3301
3162
|
] })
|
|
3302
3163
|
}
|
|
3303
3164
|
);
|
|
3304
3165
|
}
|
|
3305
3166
|
|
|
3306
3167
|
// src/components/forms/FileUpload.tsx
|
|
3307
|
-
import { jsx as
|
|
3168
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3308
3169
|
var isImage = (file) => file.type.startsWith("image/");
|
|
3309
3170
|
function formatFileSize(bytes) {
|
|
3310
3171
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -3333,8 +3194,8 @@ function screenFiles(files, { maxSize, acceptedFileTypes }) {
|
|
|
3333
3194
|
return { accepted, rejected };
|
|
3334
3195
|
}
|
|
3335
3196
|
function usePreviewUrls(files) {
|
|
3336
|
-
const owned =
|
|
3337
|
-
|
|
3197
|
+
const owned = React24.useRef(/* @__PURE__ */ new Set());
|
|
3198
|
+
React24.useEffect(() => {
|
|
3338
3199
|
const live = new Set(files.map((f) => f.previewUrl));
|
|
3339
3200
|
for (const url of owned.current) {
|
|
3340
3201
|
if (live.has(url)) continue;
|
|
@@ -3342,7 +3203,7 @@ function usePreviewUrls(files) {
|
|
|
3342
3203
|
owned.current.delete(url);
|
|
3343
3204
|
}
|
|
3344
3205
|
}, [files]);
|
|
3345
|
-
|
|
3206
|
+
React24.useEffect(() => {
|
|
3346
3207
|
const urls = owned.current;
|
|
3347
3208
|
return () => {
|
|
3348
3209
|
for (const url of urls) URL.revokeObjectURL(url);
|
|
@@ -3355,8 +3216,7 @@ function usePreviewUrls(files) {
|
|
|
3355
3216
|
return url;
|
|
3356
3217
|
};
|
|
3357
3218
|
}
|
|
3358
|
-
function
|
|
3359
|
-
label,
|
|
3219
|
+
function useFileList({
|
|
3360
3220
|
value,
|
|
3361
3221
|
defaultValue,
|
|
3362
3222
|
onChange,
|
|
@@ -3365,35 +3225,19 @@ function FileUpload({
|
|
|
3365
3225
|
maxSize,
|
|
3366
3226
|
onError,
|
|
3367
3227
|
showPreview = true,
|
|
3368
|
-
uploadProgress,
|
|
3369
|
-
chooseLabel,
|
|
3370
|
-
description,
|
|
3371
|
-
errorMessage,
|
|
3372
|
-
isInvalid,
|
|
3373
3228
|
isDisabled,
|
|
3374
|
-
isReadOnly
|
|
3375
|
-
isRequired,
|
|
3376
|
-
fullWidth = true,
|
|
3377
|
-
className,
|
|
3378
|
-
style,
|
|
3379
|
-
...rest
|
|
3229
|
+
isReadOnly
|
|
3380
3230
|
}) {
|
|
3381
|
-
const
|
|
3382
|
-
const [uncontrolled, setUncontrolled] = React23.useState(defaultValue ?? []);
|
|
3231
|
+
const [uncontrolled, setUncontrolled] = React24.useState(defaultValue ?? []);
|
|
3383
3232
|
const files = value ?? uncontrolled;
|
|
3384
3233
|
const previewUrlFor = usePreviewUrls(files);
|
|
3385
|
-
const id = React23.useId();
|
|
3386
|
-
const labelId = label ? `${id}-label` : void 0;
|
|
3387
|
-
const hintId = description ? `${id}-hint` : void 0;
|
|
3388
|
-
const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
|
|
3389
|
-
const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
|
|
3390
3234
|
const commit = (next) => {
|
|
3391
3235
|
if (value === void 0) setUncontrolled(next);
|
|
3392
3236
|
onChange?.(next);
|
|
3393
3237
|
};
|
|
3394
3238
|
const accept = (picked) => {
|
|
3395
|
-
if (
|
|
3396
|
-
const { accepted, rejected } = screenFiles(
|
|
3239
|
+
if (isDisabled || isReadOnly || !picked.length) return;
|
|
3240
|
+
const { accepted, rejected } = screenFiles(picked, { maxSize, acceptedFileTypes });
|
|
3397
3241
|
if (rejected.length) onError?.(rejected);
|
|
3398
3242
|
if (!accepted.length) return;
|
|
3399
3243
|
const wrapped = accepted.map((file) => {
|
|
@@ -3403,7 +3247,105 @@ function FileUpload({
|
|
|
3403
3247
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
3404
3248
|
};
|
|
3405
3249
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
3406
|
-
return
|
|
3250
|
+
return { files, accept, remove };
|
|
3251
|
+
}
|
|
3252
|
+
function useFileFieldIds({
|
|
3253
|
+
label,
|
|
3254
|
+
description,
|
|
3255
|
+
errorMessage,
|
|
3256
|
+
isInvalid
|
|
3257
|
+
}) {
|
|
3258
|
+
const id = React24.useId();
|
|
3259
|
+
const labelId = label ? `${id}-label` : void 0;
|
|
3260
|
+
const hintId = description ? `${id}-hint` : void 0;
|
|
3261
|
+
const errorId = isInvalid && errorMessage ? `${id}-error` : void 0;
|
|
3262
|
+
const describedBy = [hintId, errorId].filter(Boolean).join(" ") || void 0;
|
|
3263
|
+
return { id, labelId, hintId, errorId, describedBy };
|
|
3264
|
+
}
|
|
3265
|
+
function FileFieldLabel({
|
|
3266
|
+
id,
|
|
3267
|
+
label,
|
|
3268
|
+
isRequired
|
|
3269
|
+
}) {
|
|
3270
|
+
if (!label) return null;
|
|
3271
|
+
return /* @__PURE__ */ jsxs32("span", { className: "pire-field-label", id, children: [
|
|
3272
|
+
label,
|
|
3273
|
+
isRequired ? /* @__PURE__ */ jsx43("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
3274
|
+
] });
|
|
3275
|
+
}
|
|
3276
|
+
function FileFieldFooter({
|
|
3277
|
+
files,
|
|
3278
|
+
onRemove,
|
|
3279
|
+
uploadProgress,
|
|
3280
|
+
description,
|
|
3281
|
+
errorMessage,
|
|
3282
|
+
hintId,
|
|
3283
|
+
errorId
|
|
3284
|
+
}) {
|
|
3285
|
+
const msg = usePireMessages();
|
|
3286
|
+
return /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
3287
|
+
files.length ? /* @__PURE__ */ jsx43("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ jsxs32("li", { className: "pire-fileupload-item", children: [
|
|
3288
|
+
previewUrl ? /* @__PURE__ */ jsx43("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ jsx43(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
3289
|
+
/* @__PURE__ */ jsx43("span", { className: "pire-fileupload-name", children: file.name }),
|
|
3290
|
+
/* @__PURE__ */ jsx43("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
3291
|
+
onRemove ? /* @__PURE__ */ jsx43(
|
|
3292
|
+
IconButton,
|
|
3293
|
+
{
|
|
3294
|
+
icon: "x",
|
|
3295
|
+
size: "sm",
|
|
3296
|
+
label: msg.fileUploadRemoveNamed.replace("{name}", file.name),
|
|
3297
|
+
onPress: () => onRemove(file)
|
|
3298
|
+
}
|
|
3299
|
+
) : null
|
|
3300
|
+
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3301
|
+
uploadProgress != null ? /* @__PURE__ */ jsx43(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3302
|
+
description ? /* @__PURE__ */ jsx43("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
|
|
3303
|
+
errorId ? /* @__PURE__ */ jsx43("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
|
|
3304
|
+
] });
|
|
3305
|
+
}
|
|
3306
|
+
function FileUpload({
|
|
3307
|
+
label,
|
|
3308
|
+
value,
|
|
3309
|
+
defaultValue,
|
|
3310
|
+
onChange,
|
|
3311
|
+
acceptedFileTypes,
|
|
3312
|
+
allowsMultiple,
|
|
3313
|
+
maxSize,
|
|
3314
|
+
onError,
|
|
3315
|
+
showPreview = true,
|
|
3316
|
+
uploadProgress,
|
|
3317
|
+
chooseLabel,
|
|
3318
|
+
description,
|
|
3319
|
+
errorMessage,
|
|
3320
|
+
isInvalid,
|
|
3321
|
+
isDisabled,
|
|
3322
|
+
isReadOnly,
|
|
3323
|
+
isRequired,
|
|
3324
|
+
fullWidth = true,
|
|
3325
|
+
className,
|
|
3326
|
+
style,
|
|
3327
|
+
...rest
|
|
3328
|
+
}) {
|
|
3329
|
+
const msg = usePireMessages();
|
|
3330
|
+
const { files, accept, remove } = useFileList({
|
|
3331
|
+
value,
|
|
3332
|
+
defaultValue,
|
|
3333
|
+
onChange,
|
|
3334
|
+
acceptedFileTypes,
|
|
3335
|
+
allowsMultiple,
|
|
3336
|
+
maxSize,
|
|
3337
|
+
onError,
|
|
3338
|
+
showPreview,
|
|
3339
|
+
isDisabled,
|
|
3340
|
+
isReadOnly
|
|
3341
|
+
});
|
|
3342
|
+
const { id, labelId, hintId, errorId, describedBy } = useFileFieldIds({
|
|
3343
|
+
label,
|
|
3344
|
+
description,
|
|
3345
|
+
errorMessage,
|
|
3346
|
+
isInvalid
|
|
3347
|
+
});
|
|
3348
|
+
return /* @__PURE__ */ jsxs32(
|
|
3407
3349
|
"div",
|
|
3408
3350
|
{
|
|
3409
3351
|
className: cx("pire-field", "pire-fileupload", className),
|
|
@@ -3412,17 +3354,14 @@ function FileUpload({
|
|
|
3412
3354
|
"data-invalid": isInvalid ? "true" : void 0,
|
|
3413
3355
|
...rest,
|
|
3414
3356
|
children: [
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
isRequired ? /* @__PURE__ */ jsx40("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
3418
|
-
] }) : null,
|
|
3419
|
-
/* @__PURE__ */ jsx40(
|
|
3357
|
+
/* @__PURE__ */ jsx43(FileFieldLabel, { id: labelId, label, isRequired }),
|
|
3358
|
+
/* @__PURE__ */ jsx43(
|
|
3420
3359
|
FileTrigger,
|
|
3421
3360
|
{
|
|
3422
3361
|
acceptedFileTypes,
|
|
3423
3362
|
allowsMultiple,
|
|
3424
|
-
onSelect: accept,
|
|
3425
|
-
children: /* @__PURE__ */
|
|
3363
|
+
onSelect: (list) => accept(list ? [...list] : []),
|
|
3364
|
+
children: /* @__PURE__ */ jsx43(
|
|
3426
3365
|
Button,
|
|
3427
3366
|
{
|
|
3428
3367
|
id: `${id}-button`,
|
|
@@ -3435,40 +3374,35 @@ function FileUpload({
|
|
|
3435
3374
|
)
|
|
3436
3375
|
}
|
|
3437
3376
|
),
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
)
|
|
3451
|
-
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3452
|
-
uploadProgress != null ? /* @__PURE__ */ jsx40(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3453
|
-
description ? /* @__PURE__ */ jsx40("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
|
|
3454
|
-
errorId ? /* @__PURE__ */ jsx40("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
|
|
3377
|
+
/* @__PURE__ */ jsx43(
|
|
3378
|
+
FileFieldFooter,
|
|
3379
|
+
{
|
|
3380
|
+
files,
|
|
3381
|
+
onRemove: isDisabled || isReadOnly ? void 0 : remove,
|
|
3382
|
+
uploadProgress,
|
|
3383
|
+
description,
|
|
3384
|
+
errorMessage,
|
|
3385
|
+
hintId,
|
|
3386
|
+
errorId
|
|
3387
|
+
}
|
|
3388
|
+
)
|
|
3455
3389
|
]
|
|
3456
3390
|
}
|
|
3457
3391
|
);
|
|
3458
3392
|
}
|
|
3459
3393
|
|
|
3460
3394
|
// src/components/navigation/ShellBar.tsx
|
|
3461
|
-
import { MenuTrigger as MenuTrigger2, Button as AriaButton12, Popover as
|
|
3395
|
+
import { MenuTrigger as MenuTrigger2, Button as AriaButton12, Popover as Popover6 } from "react-aria-components";
|
|
3462
3396
|
|
|
3463
3397
|
// src/components/navigation/Breadcrumb.tsx
|
|
3464
|
-
import * as
|
|
3398
|
+
import * as React25 from "react";
|
|
3465
3399
|
import {
|
|
3466
3400
|
Breadcrumbs as AriaBreadcrumbs,
|
|
3467
3401
|
Breadcrumb as AriaBreadcrumb,
|
|
3468
3402
|
Link as Link2,
|
|
3469
3403
|
MenuTrigger,
|
|
3470
3404
|
Button as AriaButton11,
|
|
3471
|
-
Popover as
|
|
3405
|
+
Popover as Popover5
|
|
3472
3406
|
} from "react-aria-components";
|
|
3473
3407
|
|
|
3474
3408
|
// src/components/navigation/Menu.tsx
|
|
@@ -3479,11 +3413,11 @@ import {
|
|
|
3479
3413
|
Separator as AriaSeparator2,
|
|
3480
3414
|
Header
|
|
3481
3415
|
} from "react-aria-components";
|
|
3482
|
-
import { jsx as
|
|
3416
|
+
import { jsx as jsx44, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3483
3417
|
function Menu({ minWidth, className, style, ...rest }) {
|
|
3484
3418
|
const width = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
3485
3419
|
const menuStyle = width == null ? style : { ["--pire-menu-min-w"]: width, ...style };
|
|
3486
|
-
return /* @__PURE__ */
|
|
3420
|
+
return /* @__PURE__ */ jsx44(AriaMenu, { className: cx("pire-menu", className), style: menuStyle, ...rest });
|
|
3487
3421
|
}
|
|
3488
3422
|
var shortcutKeys = (shortcut) => {
|
|
3489
3423
|
if (shortcut == null) return [];
|
|
@@ -3500,19 +3434,19 @@ function MenuItem({
|
|
|
3500
3434
|
...rest
|
|
3501
3435
|
}) {
|
|
3502
3436
|
const keys = shortcutKeys(shortcut);
|
|
3503
|
-
return /* @__PURE__ */
|
|
3437
|
+
return /* @__PURE__ */ jsxs33(
|
|
3504
3438
|
AriaMenuItem,
|
|
3505
3439
|
{
|
|
3506
3440
|
className: cx("pire-menu-item", className),
|
|
3507
3441
|
"data-tone": tone === "danger" ? "danger" : void 0,
|
|
3508
3442
|
...rest,
|
|
3509
3443
|
children: [
|
|
3510
|
-
icon ? /* @__PURE__ */
|
|
3511
|
-
/* @__PURE__ */
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
description ? /* @__PURE__ */
|
|
3444
|
+
icon ? /* @__PURE__ */ jsx44(Icon, { name: icon, size: 16, className: "pire-menu-item-icon" }) : null,
|
|
3445
|
+
/* @__PURE__ */ jsxs33("span", { className: "pire-menu-item-body", children: [
|
|
3446
|
+
/* @__PURE__ */ jsx44("span", { className: "pire-menu-item-label", children }),
|
|
3447
|
+
description ? /* @__PURE__ */ jsx44("span", { className: "pire-menu-item-desc", children: description }) : null
|
|
3514
3448
|
] }),
|
|
3515
|
-
keys.length ? /* @__PURE__ */
|
|
3449
|
+
keys.length ? /* @__PURE__ */ jsx44("span", { className: "pire-menu-item-shortcut", children: keys.map((cap, index) => /* @__PURE__ */ jsx44(
|
|
3516
3450
|
Kbd,
|
|
3517
3451
|
{
|
|
3518
3452
|
size: "sm",
|
|
@@ -3525,24 +3459,24 @@ function MenuItem({
|
|
|
3525
3459
|
);
|
|
3526
3460
|
}
|
|
3527
3461
|
function MenuSection({ title, children, className, ...rest }) {
|
|
3528
|
-
return /* @__PURE__ */
|
|
3529
|
-
title ? /* @__PURE__ */
|
|
3462
|
+
return /* @__PURE__ */ jsxs33(AriaMenuSection, { className: cx("pire-menu-section", className), ...rest, children: [
|
|
3463
|
+
title ? /* @__PURE__ */ jsx44(Header, { className: "pire-menu-section-title", children: title }) : null,
|
|
3530
3464
|
children
|
|
3531
3465
|
] });
|
|
3532
3466
|
}
|
|
3533
3467
|
function MenuSeparator({ className }) {
|
|
3534
|
-
return /* @__PURE__ */
|
|
3468
|
+
return /* @__PURE__ */ jsx44(AriaSeparator2, { className: cx("pire-menu-separator", className) });
|
|
3535
3469
|
}
|
|
3536
3470
|
|
|
3537
3471
|
// src/components/navigation/Breadcrumb.tsx
|
|
3538
|
-
import { jsx as
|
|
3472
|
+
import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3539
3473
|
var keyOf = (item) => item.id ?? item.label;
|
|
3540
3474
|
var MIN_CURRENT = 64;
|
|
3541
3475
|
function useFitLevel(enabled) {
|
|
3542
|
-
const boxRef =
|
|
3543
|
-
const measureRef =
|
|
3544
|
-
const [level, setLevel] =
|
|
3545
|
-
|
|
3476
|
+
const boxRef = React25.useRef(null);
|
|
3477
|
+
const measureRef = React25.useRef(null);
|
|
3478
|
+
const [level, setLevel] = React25.useState(0);
|
|
3479
|
+
React25.useLayoutEffect(() => {
|
|
3546
3480
|
const box = boxRef.current;
|
|
3547
3481
|
const measure = measureRef.current;
|
|
3548
3482
|
if (!enabled || !box || !measure) return;
|
|
@@ -3573,10 +3507,10 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3573
3507
|
const folded = collapse ? items.slice(foldFirst ? 0 : 1, -1) : [];
|
|
3574
3508
|
const shown = collapse ? foldFirst ? [last] : [items[0], last] : items;
|
|
3575
3509
|
const moreAt = foldFirst ? 0 : 1;
|
|
3576
|
-
const separator = /* @__PURE__ */
|
|
3510
|
+
const separator = /* @__PURE__ */ jsx45(Icon, { name: "chevron-right", size: 12, className: "pire-breadcrumb-sep" });
|
|
3577
3511
|
const crumb = (item) => {
|
|
3578
3512
|
const isLast = item === last;
|
|
3579
|
-
return /* @__PURE__ */
|
|
3513
|
+
return /* @__PURE__ */ jsxs34(
|
|
3580
3514
|
AriaBreadcrumb,
|
|
3581
3515
|
{
|
|
3582
3516
|
className: "pire-breadcrumb",
|
|
@@ -3587,8 +3521,8 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3587
3521
|
// A Link even for the current step, because that is what React Aria marks
|
|
3588
3522
|
// `aria-current="page"`. The `title` is what reads the step whole once it truncates.
|
|
3589
3523
|
// A class, not an `a` selector: React Aria renders a Link with no `href` as a <span>.
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
) : isLast ? item.label : /* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ jsx45(Link2, { className: "pire-breadcrumb-link", href: isLast ? void 0 : item.href, children: /* @__PURE__ */ jsx45("span", { title: isLast ? item.label : void 0, children: item.label }) })
|
|
3525
|
+
) : isLast ? item.label : /* @__PURE__ */ jsx45(Link2, { href: item.href, children: item.label }),
|
|
3592
3526
|
isLast ? null : separator
|
|
3593
3527
|
]
|
|
3594
3528
|
},
|
|
@@ -3596,7 +3530,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3596
3530
|
);
|
|
3597
3531
|
};
|
|
3598
3532
|
if (!isCollapsible) {
|
|
3599
|
-
return /* @__PURE__ */
|
|
3533
|
+
return /* @__PURE__ */ jsx45(
|
|
3600
3534
|
AriaBreadcrumbs,
|
|
3601
3535
|
{
|
|
3602
3536
|
className: cx("pire-breadcrumbs", className),
|
|
@@ -3607,19 +3541,19 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3607
3541
|
}
|
|
3608
3542
|
);
|
|
3609
3543
|
}
|
|
3610
|
-
return /* @__PURE__ */
|
|
3611
|
-
/* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ jsxs34("div", { ref: boxRef, className: cx("pire-breadcrumbs-fit", className), style, children: [
|
|
3545
|
+
/* @__PURE__ */ jsx45(
|
|
3612
3546
|
AriaBreadcrumbs,
|
|
3613
3547
|
{
|
|
3614
3548
|
className: "pire-breadcrumbs",
|
|
3615
3549
|
"data-collapsible": "true",
|
|
3616
3550
|
onAction: (key) => onNavigate?.(String(key)),
|
|
3617
3551
|
children: shown.map(
|
|
3618
|
-
(item, i) => collapse && i === moreAt ? /* @__PURE__ */
|
|
3619
|
-
/* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3552
|
+
(item, i) => collapse && i === moreAt ? /* @__PURE__ */ jsxs34(React25.Fragment, { children: [
|
|
3553
|
+
/* @__PURE__ */ jsxs34(AriaBreadcrumb, { className: "pire-breadcrumb", id: "__pire_breadcrumb_more__", children: [
|
|
3554
|
+
/* @__PURE__ */ jsxs34(MenuTrigger, { children: [
|
|
3555
|
+
/* @__PURE__ */ jsx45(AriaButton11, { className: "pire-breadcrumb-more", "aria-label": msg.breadcrumbMore, children: /* @__PURE__ */ jsx45(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
3556
|
+
/* @__PURE__ */ jsx45(Popover5, { className: "pire-popover", children: /* @__PURE__ */ jsx45(Menu, { onAction: (key) => onNavigate?.(String(key)), children: folded.map((step) => /* @__PURE__ */ jsx45(MenuItem, { id: keyOf(step), href: step.href, children: step.label }, keyOf(step))) }) })
|
|
3623
3557
|
] }),
|
|
3624
3558
|
separator
|
|
3625
3559
|
] }),
|
|
@@ -3628,22 +3562,22 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3628
3562
|
)
|
|
3629
3563
|
}
|
|
3630
3564
|
),
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
items.map((item) => /* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx45("div", { className: "pire-breadcrumbs-measure", "aria-hidden": "true", inert: true, children: /* @__PURE__ */ jsxs34("div", { ref: measureRef, className: "pire-breadcrumbs", "data-measure": "true", children: [
|
|
3566
|
+
items.map((item) => /* @__PURE__ */ jsxs34(
|
|
3633
3567
|
"span",
|
|
3634
3568
|
{
|
|
3635
3569
|
className: "pire-breadcrumb",
|
|
3636
3570
|
"data-step": "true",
|
|
3637
3571
|
"data-last": item === last ? "true" : void 0,
|
|
3638
3572
|
children: [
|
|
3639
|
-
/* @__PURE__ */
|
|
3573
|
+
/* @__PURE__ */ jsx45("span", { children: item.label }),
|
|
3640
3574
|
item === last ? null : separator
|
|
3641
3575
|
]
|
|
3642
3576
|
},
|
|
3643
3577
|
keyOf(item)
|
|
3644
3578
|
)),
|
|
3645
|
-
/* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsxs34("span", { className: "pire-breadcrumb", "data-more": "true", children: [
|
|
3580
|
+
/* @__PURE__ */ jsx45("span", { className: "pire-breadcrumb-more", children: /* @__PURE__ */ jsx45(Icon, { name: "more-horizontal", size: 16 }) }),
|
|
3647
3581
|
separator
|
|
3648
3582
|
] })
|
|
3649
3583
|
] }) })
|
|
@@ -3651,7 +3585,7 @@ function Breadcrumb({ items, onNavigate, isCollapsible, className, style }) {
|
|
|
3651
3585
|
}
|
|
3652
3586
|
|
|
3653
3587
|
// src/components/navigation/ShellBar.tsx
|
|
3654
|
-
import { jsx as
|
|
3588
|
+
import { jsx as jsx46, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3655
3589
|
var initials2 = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
3656
3590
|
function ShellBar({
|
|
3657
3591
|
launcher,
|
|
@@ -3672,9 +3606,9 @@ function ShellBar({
|
|
|
3672
3606
|
...rest
|
|
3673
3607
|
}) {
|
|
3674
3608
|
const msg = usePireMessages();
|
|
3675
|
-
return /* @__PURE__ */
|
|
3609
|
+
return /* @__PURE__ */ jsxs35("header", { className: cx("pire-shellbar", className), ...rest, children: [
|
|
3676
3610
|
launcher,
|
|
3677
|
-
onMenu ? /* @__PURE__ */
|
|
3611
|
+
onMenu ? /* @__PURE__ */ jsx46(
|
|
3678
3612
|
IconButton,
|
|
3679
3613
|
{
|
|
3680
3614
|
icon: "menu",
|
|
@@ -3684,15 +3618,15 @@ function ShellBar({
|
|
|
3684
3618
|
onPress: onMenu
|
|
3685
3619
|
}
|
|
3686
3620
|
) : null,
|
|
3687
|
-
monogram ? /* @__PURE__ */
|
|
3688
|
-
product ? /* @__PURE__ */
|
|
3689
|
-
breadcrumb?.length ? /* @__PURE__ */
|
|
3690
|
-
product || monogram ? /* @__PURE__ */
|
|
3691
|
-
/* @__PURE__ */
|
|
3621
|
+
monogram ? /* @__PURE__ */ jsx46("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
|
|
3622
|
+
product ? /* @__PURE__ */ jsx46("span", { className: "pire-shellbar-product", children: product }) : null,
|
|
3623
|
+
breadcrumb?.length ? /* @__PURE__ */ jsxs35("nav", { className: "pire-shellbar-crumbs", "aria-label": msg.breadcrumbLabel, children: [
|
|
3624
|
+
product || monogram ? /* @__PURE__ */ jsx46("span", { className: "pire-shellbar-sep", "aria-hidden": "true" }) : null,
|
|
3625
|
+
/* @__PURE__ */ jsx46(Breadcrumb, { items: breadcrumb, onNavigate: onBreadcrumbNavigate, isCollapsible: true })
|
|
3692
3626
|
] }) : null,
|
|
3693
|
-
title ? /* @__PURE__ */
|
|
3694
|
-
breadcrumb?.length ? null : /* @__PURE__ */
|
|
3695
|
-
onSearch ? /* @__PURE__ */
|
|
3627
|
+
title ? /* @__PURE__ */ jsx46("span", { className: "pire-shellbar-title", children: title }) : null,
|
|
3628
|
+
breadcrumb?.length ? null : /* @__PURE__ */ jsx46("span", { className: "pire-shellbar-spacer" }),
|
|
3629
|
+
onSearch ? /* @__PURE__ */ jsx46(
|
|
3696
3630
|
IconButton,
|
|
3697
3631
|
{
|
|
3698
3632
|
icon: "search",
|
|
@@ -3707,8 +3641,8 @@ function ShellBar({
|
|
|
3707
3641
|
// A real button, not the img-role span: the avatar is where "my profile", "switch company"
|
|
3708
3642
|
// and "sign out" live in any ERP, and a span accepts neither focus nor onPress. Popover is
|
|
3709
3643
|
// rendered here rather than expected from the consumer so the panel keeps shell placement.
|
|
3710
|
-
/* @__PURE__ */
|
|
3711
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ jsxs35(MenuTrigger2, { children: [
|
|
3645
|
+
/* @__PURE__ */ jsx46(
|
|
3712
3646
|
AriaButton12,
|
|
3713
3647
|
{
|
|
3714
3648
|
className: "pire-avatar pire-avatar-trigger",
|
|
@@ -3716,23 +3650,23 @@ function ShellBar({
|
|
|
3716
3650
|
children: initials2(user)
|
|
3717
3651
|
}
|
|
3718
3652
|
),
|
|
3719
|
-
/* @__PURE__ */
|
|
3653
|
+
/* @__PURE__ */ jsx46(Popover6, { className: "pire-popover", children: userMenu })
|
|
3720
3654
|
] })
|
|
3721
|
-
) : user ? /* @__PURE__ */
|
|
3655
|
+
) : user ? /* @__PURE__ */ jsx46("span", { className: "pire-avatar", title: user, "aria-label": user, role: "img", children: initials2(user) }) : null
|
|
3722
3656
|
] });
|
|
3723
3657
|
}
|
|
3724
3658
|
|
|
3725
3659
|
// src/components/navigation/SideNav.tsx
|
|
3726
|
-
import * as
|
|
3660
|
+
import * as React26 from "react";
|
|
3727
3661
|
import {
|
|
3728
3662
|
Button as AriaButton13,
|
|
3729
3663
|
Disclosure,
|
|
3730
3664
|
DisclosureGroup,
|
|
3731
3665
|
DisclosurePanel,
|
|
3732
3666
|
MenuTrigger as MenuTrigger3,
|
|
3733
|
-
Popover as
|
|
3667
|
+
Popover as Popover7
|
|
3734
3668
|
} from "react-aria-components";
|
|
3735
|
-
import { jsx as
|
|
3669
|
+
import { jsx as jsx47, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3736
3670
|
function findActiveParent(groups, value) {
|
|
3737
3671
|
if (value == null) return void 0;
|
|
3738
3672
|
for (const group of groups) {
|
|
@@ -3759,10 +3693,10 @@ function SideNav({
|
|
|
3759
3693
|
const msg = usePireMessages();
|
|
3760
3694
|
const activeParent = findActiveParent(groups, value);
|
|
3761
3695
|
const isControlled = expandedIds != null;
|
|
3762
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3696
|
+
const [ownExpanded, setOwnExpanded] = React26.useState(
|
|
3763
3697
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3764
3698
|
);
|
|
3765
|
-
const [lastValue, setLastValue] =
|
|
3699
|
+
const [lastValue, setLastValue] = React26.useState(value);
|
|
3766
3700
|
if (value !== lastValue) {
|
|
3767
3701
|
setLastValue(value);
|
|
3768
3702
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3782,7 +3716,7 @@ function SideNav({
|
|
|
3782
3716
|
};
|
|
3783
3717
|
const renderRow = (item, onPress, isGroup) => {
|
|
3784
3718
|
const selected = !isGroup && item.id === value;
|
|
3785
|
-
const button = /* @__PURE__ */
|
|
3719
|
+
const button = /* @__PURE__ */ jsxs36(
|
|
3786
3720
|
AriaButton13,
|
|
3787
3721
|
{
|
|
3788
3722
|
className: "pire-sidenav-item",
|
|
@@ -3792,37 +3726,37 @@ function SideNav({
|
|
|
3792
3726
|
"aria-label": collapsed ? item.label : void 0,
|
|
3793
3727
|
onPress,
|
|
3794
3728
|
children: [
|
|
3795
|
-
item.icon ? /* @__PURE__ */
|
|
3796
|
-
collapsed ? null : /* @__PURE__ */
|
|
3797
|
-
item.count != null && !collapsed ? /* @__PURE__ */
|
|
3729
|
+
item.icon ? /* @__PURE__ */ jsx47(Icon, { name: item.icon, size: 16 }) : null,
|
|
3730
|
+
collapsed ? null : /* @__PURE__ */ jsx47("span", { children: item.label }),
|
|
3731
|
+
item.count != null && !collapsed ? /* @__PURE__ */ jsx47("span", { className: "pire-sidenav-count", children: item.count }) : null
|
|
3798
3732
|
]
|
|
3799
3733
|
},
|
|
3800
3734
|
item.id
|
|
3801
3735
|
);
|
|
3802
|
-
return collapsed ? /* @__PURE__ */
|
|
3736
|
+
return collapsed ? /* @__PURE__ */ jsx47(Tooltip, { label: item.label, placement: "right", children: button }, item.id) : button;
|
|
3803
3737
|
};
|
|
3804
|
-
const renderRailFlyout = (item) => /* @__PURE__ */
|
|
3805
|
-
/* @__PURE__ */
|
|
3738
|
+
const renderRailFlyout = (item) => /* @__PURE__ */ jsxs36(MenuTrigger3, { children: [
|
|
3739
|
+
/* @__PURE__ */ jsx47(
|
|
3806
3740
|
AriaButton13,
|
|
3807
3741
|
{
|
|
3808
3742
|
className: "pire-sidenav-item",
|
|
3809
3743
|
"aria-label": item.label,
|
|
3810
3744
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3811
|
-
children: item.icon ? /* @__PURE__ */
|
|
3745
|
+
children: item.icon ? /* @__PURE__ */ jsx47(Icon, { name: item.icon, size: 16 }) : null
|
|
3812
3746
|
}
|
|
3813
3747
|
),
|
|
3814
|
-
/* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ jsx47(Popover7, { className: "pire-popover", placement: "right top", offset: 4, children: /* @__PURE__ */ jsx47(
|
|
3815
3749
|
Menu,
|
|
3816
3750
|
{
|
|
3817
3751
|
"aria-label": item.label,
|
|
3818
3752
|
className: "pire-sidenav-flyout",
|
|
3819
3753
|
onAction: (key) => onChange?.(String(key)),
|
|
3820
|
-
children: (item.items ?? []).map((child) => /* @__PURE__ */
|
|
3754
|
+
children: (item.items ?? []).map((child) => /* @__PURE__ */ jsx47(MenuItem, { id: child.id, children: child.label }, child.id))
|
|
3821
3755
|
}
|
|
3822
3756
|
) })
|
|
3823
3757
|
] }, item.id);
|
|
3824
|
-
const renderSection = (item) => /* @__PURE__ */
|
|
3825
|
-
/* @__PURE__ */
|
|
3758
|
+
const renderSection = (item) => /* @__PURE__ */ jsxs36(Disclosure, { id: item.id, className: "pire-sidenav-section", children: [
|
|
3759
|
+
/* @__PURE__ */ jsxs36(
|
|
3826
3760
|
AriaButton13,
|
|
3827
3761
|
{
|
|
3828
3762
|
slot: "trigger",
|
|
@@ -3830,16 +3764,16 @@ function SideNav({
|
|
|
3830
3764
|
"data-kind": "group",
|
|
3831
3765
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3832
3766
|
children: [
|
|
3833
|
-
item.icon ? /* @__PURE__ */
|
|
3834
|
-
/* @__PURE__ */
|
|
3835
|
-
item.count != null ? /* @__PURE__ */
|
|
3836
|
-
/* @__PURE__ */
|
|
3767
|
+
item.icon ? /* @__PURE__ */ jsx47(Icon, { name: item.icon, size: 16 }) : null,
|
|
3768
|
+
/* @__PURE__ */ jsx47("span", { children: item.label }),
|
|
3769
|
+
item.count != null ? /* @__PURE__ */ jsx47("span", { className: "pire-sidenav-count", children: item.count }) : null,
|
|
3770
|
+
/* @__PURE__ */ jsx47(Icon, { name: "chevron-down", size: 16, className: "pire-sidenav-chevron" })
|
|
3837
3771
|
]
|
|
3838
3772
|
}
|
|
3839
3773
|
),
|
|
3840
|
-
/* @__PURE__ */
|
|
3774
|
+
/* @__PURE__ */ jsx47(DisclosurePanel, { className: "pire-sidenav-subnav", children: item.items?.map((child) => {
|
|
3841
3775
|
const selected = child.id === value;
|
|
3842
|
-
return /* @__PURE__ */
|
|
3776
|
+
return /* @__PURE__ */ jsxs36(
|
|
3843
3777
|
AriaButton13,
|
|
3844
3778
|
{
|
|
3845
3779
|
className: "pire-sidenav-item pire-sidenav-subitem",
|
|
@@ -3847,15 +3781,15 @@ function SideNav({
|
|
|
3847
3781
|
"aria-current": selected ? "page" : void 0,
|
|
3848
3782
|
onPress: () => onChange?.(child.id),
|
|
3849
3783
|
children: [
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
child.count != null ? /* @__PURE__ */
|
|
3784
|
+
/* @__PURE__ */ jsx47("span", { children: child.label }),
|
|
3785
|
+
child.count != null ? /* @__PURE__ */ jsx47("span", { className: "pire-sidenav-count", children: child.count }) : null
|
|
3852
3786
|
]
|
|
3853
3787
|
},
|
|
3854
3788
|
child.id
|
|
3855
3789
|
);
|
|
3856
3790
|
}) })
|
|
3857
3791
|
] }, item.id);
|
|
3858
|
-
return /* @__PURE__ */
|
|
3792
|
+
return /* @__PURE__ */ jsxs36(
|
|
3859
3793
|
"nav",
|
|
3860
3794
|
{
|
|
3861
3795
|
className: cx("pire-sidenav", className),
|
|
@@ -3872,9 +3806,9 @@ function SideNav({
|
|
|
3872
3806
|
if (isGroup && collapsed && railFlyout) return renderRailFlyout(item);
|
|
3873
3807
|
return renderRow(item, () => isGroup ? toggleExpanded(item.id) : onChange?.(item.id), isGroup);
|
|
3874
3808
|
});
|
|
3875
|
-
return /* @__PURE__ */
|
|
3876
|
-
group.label && !collapsed ? /* @__PURE__ */
|
|
3877
|
-
hasSections ? /* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsxs36("div", { className: "pire-sidenav-group", children: [
|
|
3810
|
+
group.label && !collapsed ? /* @__PURE__ */ jsx47("div", { className: "pire-sidenav-label", children: group.label }) : null,
|
|
3811
|
+
hasSections ? /* @__PURE__ */ jsx47(
|
|
3878
3812
|
DisclosureGroup,
|
|
3879
3813
|
{
|
|
3880
3814
|
className: "pire-sidenav-tree",
|
|
@@ -3886,24 +3820,24 @@ function SideNav({
|
|
|
3886
3820
|
) : rows
|
|
3887
3821
|
] }, group.label ?? gi);
|
|
3888
3822
|
}),
|
|
3889
|
-
footer ? /* @__PURE__ */
|
|
3823
|
+
footer ? /* @__PURE__ */ jsx47("div", { className: "pire-sidenav-footer", children: footer }) : null
|
|
3890
3824
|
]
|
|
3891
3825
|
}
|
|
3892
3826
|
);
|
|
3893
3827
|
}
|
|
3894
3828
|
|
|
3895
3829
|
// src/components/navigation/ShellRail.tsx
|
|
3896
|
-
import * as
|
|
3830
|
+
import * as React27 from "react";
|
|
3897
3831
|
import { Button as AriaButton14 } from "react-aria-components";
|
|
3898
|
-
import { jsx as
|
|
3832
|
+
import { jsx as jsx48, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3899
3833
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
3900
3834
|
const msg = usePireMessages();
|
|
3901
|
-
return /* @__PURE__ */
|
|
3835
|
+
return /* @__PURE__ */ jsx48("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => (
|
|
3902
3836
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
3903
3837
|
// scrolling zone would carry its own rule out of view on the first wheel event.
|
|
3904
|
-
/* @__PURE__ */
|
|
3905
|
-
gi > 0 ? /* @__PURE__ */
|
|
3906
|
-
/* @__PURE__ */
|
|
3838
|
+
/* @__PURE__ */ jsxs37(React27.Fragment, { children: [
|
|
3839
|
+
gi > 0 ? /* @__PURE__ */ jsx48("div", { className: "pire-shellrail-divider" }) : null,
|
|
3840
|
+
/* @__PURE__ */ jsx48("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ jsx48(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ jsx48(
|
|
3907
3841
|
AriaButton14,
|
|
3908
3842
|
{
|
|
3909
3843
|
className: "pire-shellrail-item",
|
|
@@ -3911,7 +3845,7 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
|
3911
3845
|
"data-selected": item.id === value ? "true" : void 0,
|
|
3912
3846
|
"aria-current": item.id === value ? "true" : void 0,
|
|
3913
3847
|
onPress: () => onChange?.(item.id),
|
|
3914
|
-
children: /* @__PURE__ */
|
|
3848
|
+
children: /* @__PURE__ */ jsx48("span", { className: "pire-shellrail-tile", children: /* @__PURE__ */ jsx48(Icon, { name: item.icon, size: 20 }) })
|
|
3915
3849
|
}
|
|
3916
3850
|
) }, item.id)) })
|
|
3917
3851
|
] }, group.items[0]?.id ?? gi)
|
|
@@ -3920,10 +3854,19 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
|
3920
3854
|
|
|
3921
3855
|
// src/components/navigation/Tabs.tsx
|
|
3922
3856
|
import { Tabs as AriaTabs, TabList, Tab as AriaTab, TabPanel } from "react-aria-components";
|
|
3923
|
-
import { jsx as
|
|
3924
|
-
function Tabs({
|
|
3857
|
+
import { jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3858
|
+
function Tabs({
|
|
3859
|
+
items,
|
|
3860
|
+
value,
|
|
3861
|
+
defaultValue,
|
|
3862
|
+
onChange,
|
|
3863
|
+
panels,
|
|
3864
|
+
className,
|
|
3865
|
+
style,
|
|
3866
|
+
"aria-label": ariaLabel
|
|
3867
|
+
}) {
|
|
3925
3868
|
const msg = usePireMessages();
|
|
3926
|
-
return /* @__PURE__ */
|
|
3869
|
+
return /* @__PURE__ */ jsxs38(
|
|
3927
3870
|
AriaTabs,
|
|
3928
3871
|
{
|
|
3929
3872
|
className,
|
|
@@ -3932,19 +3875,19 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
|
|
|
3932
3875
|
defaultSelectedKey: defaultValue,
|
|
3933
3876
|
onSelectionChange: (k) => onChange?.(String(k)),
|
|
3934
3877
|
children: [
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
item.icon ? /* @__PURE__ */
|
|
3878
|
+
/* @__PURE__ */ jsx49(TabList, { className: "pire-tablist", items, "aria-label": ariaLabel ?? msg.tabsLabel, children: (item) => /* @__PURE__ */ jsxs38(AriaTab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
|
|
3879
|
+
item.icon ? /* @__PURE__ */ jsx49(Icon, { name: item.icon, size: 16 }) : null,
|
|
3937
3880
|
item.label,
|
|
3938
|
-
item.count != null ? /* @__PURE__ */
|
|
3881
|
+
item.count != null ? /* @__PURE__ */ jsx49("span", { className: "pire-tab-count", children: item.count }) : null
|
|
3939
3882
|
] }) }),
|
|
3940
|
-
items.map((item) => /* @__PURE__ */
|
|
3883
|
+
items.map((item) => /* @__PURE__ */ jsx49(TabPanel, { id: item.id, className: panels ? "pire-tabpanel" : void 0, children: panels?.[item.id] }, item.id))
|
|
3941
3884
|
]
|
|
3942
3885
|
}
|
|
3943
3886
|
);
|
|
3944
3887
|
}
|
|
3945
3888
|
|
|
3946
3889
|
// src/components/navigation/Pagination.tsx
|
|
3947
|
-
import { jsx as
|
|
3890
|
+
import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3948
3891
|
function Pagination({
|
|
3949
3892
|
page = 1,
|
|
3950
3893
|
pageSize = 25,
|
|
@@ -3959,9 +3902,9 @@ function Pagination({
|
|
|
3959
3902
|
const pages = Math.max(1, Math.ceil(total / pageSize));
|
|
3960
3903
|
const from = total === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
3961
3904
|
const to = Math.min(total, page * pageSize);
|
|
3962
|
-
return /* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
/* @__PURE__ */
|
|
3905
|
+
return /* @__PURE__ */ jsxs39("nav", { className: cx("pire-pagination", className), style, "aria-label": msg.paginationLabel, children: [
|
|
3906
|
+
/* @__PURE__ */ jsx50("span", { className: "pire-pagination-count", children: msg.paginationRange.replace("{from}", from.toLocaleString()).replace("{to}", to.toLocaleString()).replace("{total}", total.toLocaleString()) }),
|
|
3907
|
+
/* @__PURE__ */ jsx50(
|
|
3965
3908
|
IconButton,
|
|
3966
3909
|
{
|
|
3967
3910
|
icon: "chevron-left",
|
|
@@ -3972,8 +3915,8 @@ function Pagination({
|
|
|
3972
3915
|
onPress: () => onPageChange?.(page - 1)
|
|
3973
3916
|
}
|
|
3974
3917
|
),
|
|
3975
|
-
/* @__PURE__ */
|
|
3976
|
-
/* @__PURE__ */
|
|
3918
|
+
/* @__PURE__ */ jsx50("span", { className: "pire-pagination-count", "aria-live": "polite", children: msg.paginationPageOf.replace("{page}", String(page)).replace("{pages}", String(pages)) }),
|
|
3919
|
+
/* @__PURE__ */ jsx50(
|
|
3977
3920
|
IconButton,
|
|
3978
3921
|
{
|
|
3979
3922
|
icon: "chevron-right",
|
|
@@ -3984,7 +3927,7 @@ function Pagination({
|
|
|
3984
3927
|
onPress: () => onPageChange?.(page + 1)
|
|
3985
3928
|
}
|
|
3986
3929
|
),
|
|
3987
|
-
onPageSizeChange ? /* @__PURE__ */
|
|
3930
|
+
onPageSizeChange ? /* @__PURE__ */ jsx50(
|
|
3988
3931
|
Select,
|
|
3989
3932
|
{
|
|
3990
3933
|
"aria-label": msg.paginationRowsPerPage,
|
|
@@ -4003,9 +3946,9 @@ function Pagination({
|
|
|
4003
3946
|
}
|
|
4004
3947
|
|
|
4005
3948
|
// src/components/navigation/Ribbon.tsx
|
|
4006
|
-
import * as
|
|
3949
|
+
import * as React28 from "react";
|
|
4007
3950
|
import { Tabs as AriaTabs2, TabList as TabList2, Tab as AriaTab2, TabPanel as TabPanel2, Toolbar, Button as Button3 } from "react-aria-components";
|
|
4008
|
-
import { Fragment as
|
|
3951
|
+
import { Fragment as Fragment10, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4009
3952
|
var outside = (what, parent) => {
|
|
4010
3953
|
const Config = () => {
|
|
4011
3954
|
throw new Error(`[pire] ${what} must be a child of ${parent}.`);
|
|
@@ -4019,7 +3962,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
4019
3962
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
4020
3963
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
4021
3964
|
function describe(child) {
|
|
4022
|
-
if (!
|
|
3965
|
+
if (!React28.isValidElement(child)) return JSON.stringify(child);
|
|
4023
3966
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
4024
3967
|
const type = child.type;
|
|
4025
3968
|
return type?.displayName || type?.name || "a component";
|
|
@@ -4027,13 +3970,13 @@ function describe(child) {
|
|
|
4027
3970
|
function childrenOfType(children, type, what, parent) {
|
|
4028
3971
|
const out = [];
|
|
4029
3972
|
const walk = (nodes, path) => {
|
|
4030
|
-
|
|
3973
|
+
React28.Children.forEach(nodes, (child, i) => {
|
|
4031
3974
|
if (child == null || typeof child === "boolean") return;
|
|
4032
|
-
if (
|
|
3975
|
+
if (React28.isValidElement(child) && child.type === React28.Fragment) {
|
|
4033
3976
|
return walk(child.props.children, `${path}${i}.`);
|
|
4034
3977
|
}
|
|
4035
|
-
if (!
|
|
4036
|
-
const isWrapper =
|
|
3978
|
+
if (!React28.isValidElement(child) || child.type !== type) {
|
|
3979
|
+
const isWrapper = React28.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
4037
3980
|
throw new Error(
|
|
4038
3981
|
`[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.` : "")
|
|
4039
3982
|
);
|
|
@@ -4069,7 +4012,7 @@ function Command({
|
|
|
4069
4012
|
const msg = usePireMessages();
|
|
4070
4013
|
const comingSoon = command.isComingSoon === true;
|
|
4071
4014
|
const isDisabled = !comingSoon && (command.isDisabled || command.requiresSelection === true && selectionCount === 0);
|
|
4072
|
-
const button = /* @__PURE__ */
|
|
4015
|
+
const button = /* @__PURE__ */ jsxs40(
|
|
4073
4016
|
Button3,
|
|
4074
4017
|
{
|
|
4075
4018
|
className: "pire-ribbon-command",
|
|
@@ -4082,17 +4025,17 @@ function Command({
|
|
|
4082
4025
|
comingSoon && size === "lg" ? (
|
|
4083
4026
|
// The tile is a column with no room for a third line under a two-line caption, and a mark
|
|
4084
4027
|
// pinned to its corner lands on the icon. Beside the icon is the one place it fits.
|
|
4085
|
-
/* @__PURE__ */
|
|
4086
|
-
command.icon ? /* @__PURE__ */
|
|
4087
|
-
/* @__PURE__ */
|
|
4028
|
+
/* @__PURE__ */ jsxs40("span", { className: "pire-ribbon-command-head", children: [
|
|
4029
|
+
command.icon ? /* @__PURE__ */ jsx51(Icon, { name: command.icon, size: 20 }) : null,
|
|
4030
|
+
/* @__PURE__ */ jsx51(ComingSoonMark, { announce: false })
|
|
4088
4031
|
] })
|
|
4089
|
-
) : command.icon ? /* @__PURE__ */
|
|
4090
|
-
/* @__PURE__ */
|
|
4091
|
-
comingSoon && size !== "lg" ? /* @__PURE__ */
|
|
4032
|
+
) : command.icon ? /* @__PURE__ */ jsx51(Icon, { name: command.icon, size: size === "lg" ? 20 : 16 }) : null,
|
|
4033
|
+
/* @__PURE__ */ jsx51("span", { className: "pire-ribbon-command-label", children: command.label }),
|
|
4034
|
+
comingSoon && size !== "lg" ? /* @__PURE__ */ jsx51(ComingSoonMark, { announce: false }) : null
|
|
4092
4035
|
]
|
|
4093
4036
|
}
|
|
4094
4037
|
);
|
|
4095
|
-
return command.tooltip ? /* @__PURE__ */
|
|
4038
|
+
return command.tooltip ? /* @__PURE__ */ jsx51(Tooltip, { label: command.tooltip, children: button }) : button;
|
|
4096
4039
|
}
|
|
4097
4040
|
function Group8({ group, selectionCount }) {
|
|
4098
4041
|
const isLarge = (c) => c.isPrimary || (c.size ?? "sm") === "lg";
|
|
@@ -4101,18 +4044,18 @@ function Group8({ group, selectionCount }) {
|
|
|
4101
4044
|
...group.commands.filter((c) => !c.isPrimary && isLarge(c))
|
|
4102
4045
|
];
|
|
4103
4046
|
const small = group.commands.filter((c) => !isLarge(c));
|
|
4104
|
-
return /* @__PURE__ */
|
|
4105
|
-
/* @__PURE__ */
|
|
4106
|
-
large.map((c) => /* @__PURE__ */
|
|
4107
|
-
small.length ? /* @__PURE__ */
|
|
4047
|
+
return /* @__PURE__ */ jsxs40("div", { className: "pire-ribbon-group", role: "group", "aria-label": group.caption, children: [
|
|
4048
|
+
/* @__PURE__ */ jsxs40("div", { className: "pire-ribbon-group-body", children: [
|
|
4049
|
+
large.map((c) => /* @__PURE__ */ jsx51(Command, { command: c, selectionCount }, c.key)),
|
|
4050
|
+
small.length ? /* @__PURE__ */ jsx51("div", { className: "pire-ribbon-stack", children: small.map((c) => /* @__PURE__ */ jsx51(Command, { command: c, selectionCount }, c.key)) }) : null
|
|
4108
4051
|
] }),
|
|
4109
|
-
/* @__PURE__ */
|
|
4052
|
+
/* @__PURE__ */ jsx51("div", { className: "pire-ribbon-caption", "aria-hidden": "true", children: group.caption })
|
|
4110
4053
|
] });
|
|
4111
4054
|
}
|
|
4112
4055
|
function useTrailingOverflow() {
|
|
4113
|
-
const ref =
|
|
4114
|
-
const [overflow, setOverflow] =
|
|
4115
|
-
|
|
4056
|
+
const ref = React28.useRef(null);
|
|
4057
|
+
const [overflow, setOverflow] = React28.useState(false);
|
|
4058
|
+
React28.useEffect(() => {
|
|
4116
4059
|
const node = ref.current;
|
|
4117
4060
|
if (!node) return;
|
|
4118
4061
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -4121,9 +4064,18 @@ function useTrailingOverflow() {
|
|
|
4121
4064
|
const resize = new ResizeObserver(measure);
|
|
4122
4065
|
resize.observe(node);
|
|
4123
4066
|
for (const child of node.children) resize.observe(child);
|
|
4067
|
+
const mutation = new MutationObserver((records) => {
|
|
4068
|
+
for (const record of records) {
|
|
4069
|
+
for (const added of record.addedNodes) if (added instanceof Element) resize.observe(added);
|
|
4070
|
+
for (const removed of record.removedNodes) if (removed instanceof Element) resize.unobserve(removed);
|
|
4071
|
+
}
|
|
4072
|
+
measure();
|
|
4073
|
+
});
|
|
4074
|
+
mutation.observe(node, { childList: true });
|
|
4124
4075
|
return () => {
|
|
4125
4076
|
node.removeEventListener("scroll", measure);
|
|
4126
4077
|
resize.disconnect();
|
|
4078
|
+
mutation.disconnect();
|
|
4127
4079
|
};
|
|
4128
4080
|
}, []);
|
|
4129
4081
|
return [ref, overflow];
|
|
@@ -4137,9 +4089,9 @@ function Surface({
|
|
|
4137
4089
|
}) {
|
|
4138
4090
|
const [scrollRef, overflow] = useTrailingOverflow();
|
|
4139
4091
|
const domId = id ? { id } : {};
|
|
4140
|
-
return /* @__PURE__ */
|
|
4141
|
-
/* @__PURE__ */
|
|
4142
|
-
/* @__PURE__ */
|
|
4092
|
+
return /* @__PURE__ */ jsxs40(Toolbar, { ...domId, className, "aria-label": label, children: [
|
|
4093
|
+
/* @__PURE__ */ jsx51("div", { className: "pire-ribbon-scroll", ref: scrollRef, children }),
|
|
4094
|
+
/* @__PURE__ */ jsx51("div", { className: "pire-ribbon-trail", "data-overflow": overflow ? "true" : void 0, children: trailing })
|
|
4143
4095
|
] });
|
|
4144
4096
|
}
|
|
4145
4097
|
function barBlocks(tabs) {
|
|
@@ -4168,25 +4120,25 @@ function Ribbon({
|
|
|
4168
4120
|
selectionCount,
|
|
4169
4121
|
className,
|
|
4170
4122
|
style,
|
|
4171
|
-
|
|
4123
|
+
"aria-label": ariaLabel
|
|
4172
4124
|
}) {
|
|
4173
4125
|
const msg = usePireMessages();
|
|
4174
4126
|
const tabs = readTabs(children);
|
|
4175
4127
|
const count = selectionCount ?? 0;
|
|
4176
4128
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
4177
4129
|
const fallback = visible[0]?.id;
|
|
4178
|
-
const [ownTab, setOwnTab] =
|
|
4130
|
+
const [ownTab, setOwnTab] = React28.useState(defaultValue);
|
|
4179
4131
|
const requested = value ?? ownTab;
|
|
4180
4132
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
4181
|
-
const select =
|
|
4133
|
+
const select = React28.useCallback(
|
|
4182
4134
|
(id) => {
|
|
4183
4135
|
setOwnTab(id);
|
|
4184
4136
|
onChange?.(id);
|
|
4185
4137
|
},
|
|
4186
4138
|
[onChange]
|
|
4187
4139
|
);
|
|
4188
|
-
const hadSelection =
|
|
4189
|
-
|
|
4140
|
+
const hadSelection = React28.useRef(false);
|
|
4141
|
+
React28.useEffect(() => {
|
|
4190
4142
|
const has = count > 0;
|
|
4191
4143
|
if (has === hadSelection.current) return;
|
|
4192
4144
|
hadSelection.current = has;
|
|
@@ -4195,17 +4147,17 @@ function Ribbon({
|
|
|
4195
4147
|
if (has) select(contextual.id);
|
|
4196
4148
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
4197
4149
|
}, [count, tabs, requested, select]);
|
|
4198
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
4150
|
+
const [ownCollapsed, setOwnCollapsed] = React28.useState(false);
|
|
4199
4151
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
4200
|
-
const toggleRef =
|
|
4201
|
-
const restoreFocus =
|
|
4202
|
-
|
|
4152
|
+
const toggleRef = React28.useRef(null);
|
|
4153
|
+
const restoreFocus = React28.useRef(false);
|
|
4154
|
+
React28.useLayoutEffect(() => {
|
|
4203
4155
|
if (!restoreFocus.current) return;
|
|
4204
4156
|
restoreFocus.current = false;
|
|
4205
4157
|
toggleRef.current?.focus();
|
|
4206
4158
|
});
|
|
4207
|
-
const bandId =
|
|
4208
|
-
const toggle = /* @__PURE__ */
|
|
4159
|
+
const bandId = React28.useId();
|
|
4160
|
+
const toggle = /* @__PURE__ */ jsx51(
|
|
4209
4161
|
Button3,
|
|
4210
4162
|
{
|
|
4211
4163
|
ref: toggleRef,
|
|
@@ -4218,34 +4170,34 @@ function Ribbon({
|
|
|
4218
4170
|
setOwnCollapsed(!collapsed);
|
|
4219
4171
|
onCollapsedChange?.(!collapsed);
|
|
4220
4172
|
},
|
|
4221
|
-
children: /* @__PURE__ */
|
|
4173
|
+
children: /* @__PURE__ */ jsx51(Icon, { name: collapsed ? "chevron-down" : "chevron-up", size: 16 })
|
|
4222
4174
|
}
|
|
4223
4175
|
);
|
|
4224
4176
|
if (collapsed) {
|
|
4225
4177
|
const blocks = barBlocks(tabs);
|
|
4226
4178
|
const primaries = barPrimaries(tabs);
|
|
4227
|
-
return /* @__PURE__ */
|
|
4179
|
+
return /* @__PURE__ */ jsx51("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs40(
|
|
4228
4180
|
Surface,
|
|
4229
4181
|
{
|
|
4230
4182
|
className: "pire-ribbon-bar",
|
|
4231
|
-
label:
|
|
4232
|
-
trailing: /* @__PURE__ */
|
|
4183
|
+
label: ariaLabel,
|
|
4184
|
+
trailing: /* @__PURE__ */ jsxs40(Fragment10, { children: [
|
|
4233
4185
|
actions,
|
|
4234
4186
|
toggle
|
|
4235
4187
|
] }),
|
|
4236
4188
|
children: [
|
|
4237
|
-
primaries.map((c) => /* @__PURE__ */
|
|
4238
|
-
leading ? /* @__PURE__ */
|
|
4239
|
-
blocks.map((block, i) => /* @__PURE__ */
|
|
4240
|
-
i > 0 || leading || primaries.length ? /* @__PURE__ */
|
|
4241
|
-
block.commands.map((c) => /* @__PURE__ */
|
|
4189
|
+
primaries.map((c) => /* @__PURE__ */ jsx51(Command, { command: c, selectionCount: count, inBar: true }, c.key)),
|
|
4190
|
+
leading ? /* @__PURE__ */ jsx51("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
4191
|
+
blocks.map((block, i) => /* @__PURE__ */ jsxs40(React28.Fragment, { children: [
|
|
4192
|
+
i > 0 || leading || primaries.length ? /* @__PURE__ */ jsx51("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
4193
|
+
block.commands.map((c) => /* @__PURE__ */ jsx51(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
4242
4194
|
] }, block.key))
|
|
4243
4195
|
]
|
|
4244
4196
|
}
|
|
4245
4197
|
) });
|
|
4246
4198
|
}
|
|
4247
|
-
return /* @__PURE__ */
|
|
4248
|
-
/* @__PURE__ */
|
|
4199
|
+
return /* @__PURE__ */ jsx51("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs40(AriaTabs2, { selectedKey: selected, onSelectionChange: (k) => select(String(k)), children: [
|
|
4200
|
+
/* @__PURE__ */ jsx51(TabList2, { className: "pire-ribbon-tablist", "aria-label": ariaLabel, children: visible.map((tab) => /* @__PURE__ */ jsx51(
|
|
4249
4201
|
AriaTab2,
|
|
4250
4202
|
{
|
|
4251
4203
|
id: tab.id,
|
|
@@ -4255,17 +4207,17 @@ function Ribbon({
|
|
|
4255
4207
|
},
|
|
4256
4208
|
tab.key
|
|
4257
4209
|
)) }),
|
|
4258
|
-
visible.map((tab) => /* @__PURE__ */
|
|
4210
|
+
visible.map((tab) => /* @__PURE__ */ jsx51(TabPanel2, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ jsx51(
|
|
4259
4211
|
Surface,
|
|
4260
4212
|
{
|
|
4261
4213
|
id: bandId,
|
|
4262
4214
|
className: "pire-ribbon-band",
|
|
4263
4215
|
label: msg.ribbonLabel,
|
|
4264
|
-
trailing: /* @__PURE__ */
|
|
4216
|
+
trailing: /* @__PURE__ */ jsxs40(Fragment10, { children: [
|
|
4265
4217
|
actions,
|
|
4266
4218
|
toggle
|
|
4267
4219
|
] }),
|
|
4268
|
-
children: tab.groups.map((group) => /* @__PURE__ */
|
|
4220
|
+
children: tab.groups.map((group) => /* @__PURE__ */ jsx51(Group8, { group, selectionCount: count }, group.key))
|
|
4269
4221
|
}
|
|
4270
4222
|
) }, tab.key))
|
|
4271
4223
|
] }) });
|
|
@@ -4275,8 +4227,8 @@ Ribbon.Group = RibbonGroup;
|
|
|
4275
4227
|
Ribbon.Command = RibbonCommand;
|
|
4276
4228
|
|
|
4277
4229
|
// src/components/feedback/InlineMessage.tsx
|
|
4278
|
-
import { jsx as
|
|
4279
|
-
var
|
|
4230
|
+
import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4231
|
+
var MESSAGE_KIND_ICON = {
|
|
4280
4232
|
info: "info",
|
|
4281
4233
|
success: "check-circle-2",
|
|
4282
4234
|
warning: "alert-triangle",
|
|
@@ -4293,7 +4245,7 @@ function InlineMessage({
|
|
|
4293
4245
|
}) {
|
|
4294
4246
|
const msg = usePireMessages();
|
|
4295
4247
|
const assertive = kind === "error" || kind === "warning";
|
|
4296
|
-
return /* @__PURE__ */
|
|
4248
|
+
return /* @__PURE__ */ jsxs41(
|
|
4297
4249
|
"div",
|
|
4298
4250
|
{
|
|
4299
4251
|
className: cx("pire-msg", className),
|
|
@@ -4302,27 +4254,21 @@ function InlineMessage({
|
|
|
4302
4254
|
"aria-live": assertive ? "assertive" : "polite",
|
|
4303
4255
|
...rest,
|
|
4304
4256
|
children: [
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
/* @__PURE__ */
|
|
4307
|
-
title ? /* @__PURE__ */
|
|
4308
|
-
children ? /* @__PURE__ */
|
|
4257
|
+
/* @__PURE__ */ jsx52(Icon, { name: MESSAGE_KIND_ICON[kind], size: 16, className: "pire-msg-icon" }),
|
|
4258
|
+
/* @__PURE__ */ jsxs41("div", { className: "pire-msg-content", children: [
|
|
4259
|
+
title ? /* @__PURE__ */ jsx52("span", { className: "pire-msg-title", children: title }) : null,
|
|
4260
|
+
children ? /* @__PURE__ */ jsx52("span", { className: "pire-msg-body", children }) : null,
|
|
4309
4261
|
action
|
|
4310
4262
|
] }),
|
|
4311
|
-
onClose ? /* @__PURE__ */
|
|
4263
|
+
onClose ? /* @__PURE__ */ jsx52(IconButton, { icon: "x", label: msg.inlineMessageDismiss, size: "sm", onPress: onClose }) : null
|
|
4312
4264
|
]
|
|
4313
4265
|
}
|
|
4314
4266
|
);
|
|
4315
4267
|
}
|
|
4316
4268
|
|
|
4317
4269
|
// src/components/feedback/Toast.tsx
|
|
4318
|
-
import * as
|
|
4319
|
-
import { jsx as
|
|
4320
|
-
var KIND_ICON2 = {
|
|
4321
|
-
info: "info",
|
|
4322
|
-
success: "check-circle-2",
|
|
4323
|
-
warning: "alert-triangle",
|
|
4324
|
-
error: "alert-octagon"
|
|
4325
|
-
};
|
|
4270
|
+
import * as React29 from "react";
|
|
4271
|
+
import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4326
4272
|
function Toast({
|
|
4327
4273
|
kind = "success",
|
|
4328
4274
|
onClose,
|
|
@@ -4332,7 +4278,7 @@ function Toast({
|
|
|
4332
4278
|
...rest
|
|
4333
4279
|
}) {
|
|
4334
4280
|
const msg = usePireMessages();
|
|
4335
|
-
return /* @__PURE__ */
|
|
4281
|
+
return /* @__PURE__ */ jsxs42(
|
|
4336
4282
|
"div",
|
|
4337
4283
|
{
|
|
4338
4284
|
className: cx("pire-toast", className),
|
|
@@ -4341,28 +4287,28 @@ function Toast({
|
|
|
4341
4287
|
"aria-live": kind === "error" ? "assertive" : "polite",
|
|
4342
4288
|
...rest,
|
|
4343
4289
|
children: [
|
|
4344
|
-
/* @__PURE__ */
|
|
4345
|
-
/* @__PURE__ */
|
|
4346
|
-
onClose ? /* @__PURE__ */
|
|
4290
|
+
/* @__PURE__ */ jsx53(Icon, { name: MESSAGE_KIND_ICON[kind], size: 16 }),
|
|
4291
|
+
/* @__PURE__ */ jsx53("span", { className: "pire-toast-text", children }),
|
|
4292
|
+
onClose ? /* @__PURE__ */ jsx53(IconButton, { icon: "x", label: msg.toastDismiss, size: "sm", variant: "inverse", onPress: onClose }) : null
|
|
4347
4293
|
]
|
|
4348
4294
|
}
|
|
4349
4295
|
);
|
|
4350
4296
|
}
|
|
4351
|
-
var ToastContext =
|
|
4297
|
+
var ToastContext = React29.createContext(null);
|
|
4352
4298
|
function ToastProvider({
|
|
4353
4299
|
children,
|
|
4354
4300
|
timeout = 6e3
|
|
4355
4301
|
}) {
|
|
4356
4302
|
const msg = usePireMessages();
|
|
4357
|
-
const [toasts, setToasts] =
|
|
4358
|
-
const timers =
|
|
4359
|
-
const nextId =
|
|
4360
|
-
const close =
|
|
4303
|
+
const [toasts, setToasts] = React29.useState([]);
|
|
4304
|
+
const timers = React29.useRef(/* @__PURE__ */ new Map());
|
|
4305
|
+
const nextId = React29.useRef(0);
|
|
4306
|
+
const close = React29.useCallback((id) => {
|
|
4361
4307
|
clearTimeout(timers.current.get(id));
|
|
4362
4308
|
timers.current.delete(id);
|
|
4363
4309
|
setToasts((t) => t.filter((x) => x.id !== id));
|
|
4364
4310
|
}, []);
|
|
4365
|
-
const add =
|
|
4311
|
+
const add = React29.useCallback(
|
|
4366
4312
|
(toast) => {
|
|
4367
4313
|
const id = String(++nextId.current);
|
|
4368
4314
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
@@ -4376,37 +4322,28 @@ function ToastProvider({
|
|
|
4376
4322
|
},
|
|
4377
4323
|
[close, timeout]
|
|
4378
4324
|
);
|
|
4379
|
-
|
|
4325
|
+
React29.useEffect(() => {
|
|
4380
4326
|
const pending = timers.current;
|
|
4381
4327
|
return () => {
|
|
4382
4328
|
for (const timer of pending.values()) clearTimeout(timer);
|
|
4383
4329
|
pending.clear();
|
|
4384
4330
|
};
|
|
4385
4331
|
}, []);
|
|
4386
|
-
const value =
|
|
4387
|
-
return /* @__PURE__ */
|
|
4332
|
+
const value = React29.useMemo(() => ({ add, close }), [add, close]);
|
|
4333
|
+
return /* @__PURE__ */ jsxs42(ToastContext.Provider, { value, children: [
|
|
4388
4334
|
children,
|
|
4389
|
-
/* @__PURE__ */
|
|
4390
|
-
Toast,
|
|
4391
|
-
{
|
|
4392
|
-
kind: t.kind,
|
|
4393
|
-
onClose: () => close(t.id),
|
|
4394
|
-
style: { position: "static", transform: "none" },
|
|
4395
|
-
children: t.message
|
|
4396
|
-
},
|
|
4397
|
-
t.id
|
|
4398
|
-
)) })
|
|
4335
|
+
/* @__PURE__ */ jsx53("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ jsx53(Toast, { kind: t.kind, onClose: () => close(t.id), children: t.message }, t.id)) })
|
|
4399
4336
|
] });
|
|
4400
4337
|
}
|
|
4401
4338
|
function useToast() {
|
|
4402
|
-
const ctx =
|
|
4339
|
+
const ctx = React29.useContext(ToastContext);
|
|
4403
4340
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
4404
4341
|
return ctx;
|
|
4405
4342
|
}
|
|
4406
4343
|
|
|
4407
4344
|
// src/components/data/KpiTile.tsx
|
|
4408
4345
|
import { Button as AriaButton15 } from "react-aria-components";
|
|
4409
|
-
import { Fragment as
|
|
4346
|
+
import { Fragment as Fragment11, jsx as jsx54, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4410
4347
|
function KpiTile({
|
|
4411
4348
|
label,
|
|
4412
4349
|
value,
|
|
@@ -4422,27 +4359,27 @@ function KpiTile({
|
|
|
4422
4359
|
style
|
|
4423
4360
|
}) {
|
|
4424
4361
|
const tone = deltaTone ?? (deltaDirection === "down" ? "negative" : "positive");
|
|
4425
|
-
const body = /* @__PURE__ */
|
|
4426
|
-
/* @__PURE__ */
|
|
4427
|
-
icon ? /* @__PURE__ */
|
|
4362
|
+
const body = /* @__PURE__ */ jsxs43(Fragment11, { children: [
|
|
4363
|
+
/* @__PURE__ */ jsxs43("span", { className: "pire-kpi-label", children: [
|
|
4364
|
+
icon ? /* @__PURE__ */ jsx54(Icon, { name: icon, size: 16 }) : null,
|
|
4428
4365
|
label
|
|
4429
4366
|
] }),
|
|
4430
|
-
/* @__PURE__ */
|
|
4367
|
+
/* @__PURE__ */ jsxs43("span", { className: "pire-kpi-value", children: [
|
|
4431
4368
|
value,
|
|
4432
|
-
unit ? /* @__PURE__ */
|
|
4369
|
+
unit ? /* @__PURE__ */ jsx54("span", { className: "pire-kpi-unit", children: unit }) : null
|
|
4433
4370
|
] }),
|
|
4434
|
-
delta ? /* @__PURE__ */
|
|
4435
|
-
deltaDirection ? /* @__PURE__ */
|
|
4371
|
+
delta ? /* @__PURE__ */ jsxs43("span", { className: "pire-kpi-delta", "data-tone": tone, children: [
|
|
4372
|
+
deltaDirection ? /* @__PURE__ */ jsx54(Icon, { name: deltaDirection === "up" ? "trending-up" : "trending-down", size: 12 }) : null,
|
|
4436
4373
|
delta
|
|
4437
4374
|
] }) : null,
|
|
4438
|
-
footnote ? /* @__PURE__ */
|
|
4375
|
+
footnote ? /* @__PURE__ */ jsx54("span", { className: "pire-kpi-foot", children: footnote }) : null
|
|
4439
4376
|
] });
|
|
4440
4377
|
const props = { className: cx("pire-kpi", className), "data-status": status, style };
|
|
4441
|
-
return onPress ? /* @__PURE__ */
|
|
4378
|
+
return onPress ? /* @__PURE__ */ jsx54(AriaButton15, { ...props, "data-pressable": "true", onPress, children: body }) : /* @__PURE__ */ jsx54("div", { ...props, children: body });
|
|
4442
4379
|
}
|
|
4443
4380
|
|
|
4444
4381
|
// src/components/data/ObjectHeader.tsx
|
|
4445
|
-
import { jsx as
|
|
4382
|
+
import { jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4446
4383
|
function ObjectHeader({
|
|
4447
4384
|
title,
|
|
4448
4385
|
subtitle,
|
|
@@ -4454,36 +4391,28 @@ function ObjectHeader({
|
|
|
4454
4391
|
className,
|
|
4455
4392
|
...rest
|
|
4456
4393
|
}) {
|
|
4457
|
-
return /* @__PURE__ */
|
|
4394
|
+
return /* @__PURE__ */ jsxs44("header", { className: cx("pire-objheader", className), ...rest, children: [
|
|
4458
4395
|
breadcrumb,
|
|
4459
|
-
/* @__PURE__ */
|
|
4460
|
-
/* @__PURE__ */
|
|
4461
|
-
/* @__PURE__ */
|
|
4462
|
-
subtitle || id ? /* @__PURE__ */
|
|
4396
|
+
/* @__PURE__ */ jsxs44("div", { className: "pire-objheader-row", children: [
|
|
4397
|
+
/* @__PURE__ */ jsxs44("div", { className: "pire-objheader-text", children: [
|
|
4398
|
+
/* @__PURE__ */ jsx55("h1", { className: "pire-objheader-title", children: title }),
|
|
4399
|
+
subtitle || id ? /* @__PURE__ */ jsxs44("div", { className: "pire-objheader-sub", children: [
|
|
4463
4400
|
subtitle,
|
|
4464
|
-
id ? /* @__PURE__ */
|
|
4401
|
+
id ? /* @__PURE__ */ jsx55("span", { className: "pire-objheader-id", children: id }) : null
|
|
4465
4402
|
] }) : null
|
|
4466
4403
|
] }),
|
|
4467
4404
|
badge,
|
|
4468
|
-
actions ? /* @__PURE__ */
|
|
4405
|
+
actions ? /* @__PURE__ */ jsx55("div", { className: "pire-objheader-actions", children: actions }) : null
|
|
4469
4406
|
] }),
|
|
4470
|
-
facts?.length ? /* @__PURE__ */
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
/* @__PURE__ */
|
|
4473
|
-
"dd",
|
|
4474
|
-
{
|
|
4475
|
-
className: "pire-fact-value",
|
|
4476
|
-
"data-numeric": fact.numeric ? "true" : void 0,
|
|
4477
|
-
style: { margin: 0 },
|
|
4478
|
-
children: fact.value
|
|
4479
|
-
}
|
|
4480
|
-
)
|
|
4407
|
+
facts?.length ? /* @__PURE__ */ jsx55("dl", { className: "pire-facts", children: facts.map((fact) => /* @__PURE__ */ jsxs44("div", { children: [
|
|
4408
|
+
/* @__PURE__ */ jsx55("dt", { className: "pire-fact-label", children: fact.label }),
|
|
4409
|
+
/* @__PURE__ */ jsx55("dd", { className: "pire-fact-value", "data-numeric": fact.numeric ? "true" : void 0, children: fact.value })
|
|
4481
4410
|
] }, fact.label)) }) : null
|
|
4482
4411
|
] });
|
|
4483
4412
|
}
|
|
4484
4413
|
|
|
4485
4414
|
// src/components/data/FilterBar.tsx
|
|
4486
|
-
import { jsx as
|
|
4415
|
+
import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4487
4416
|
function FilterBar({
|
|
4488
4417
|
children,
|
|
4489
4418
|
activeFilters = [],
|
|
@@ -4500,22 +4429,22 @@ function FilterBar({
|
|
|
4500
4429
|
const label = useMessage("filterBarLabel", rest["aria-label"]);
|
|
4501
4430
|
const go = useMessage("filterBarGo", goLabel);
|
|
4502
4431
|
const clearAll = useMessage("filterBarClearAll", clearAllLabel);
|
|
4503
|
-
return /* @__PURE__ */
|
|
4504
|
-
/* @__PURE__ */
|
|
4432
|
+
return /* @__PURE__ */ jsxs45("section", { className: cx("pire-filterbar", className), ...rest, "aria-label": label, children: [
|
|
4433
|
+
/* @__PURE__ */ jsxs45("div", { className: "pire-filterbar-controls", children: [
|
|
4505
4434
|
children,
|
|
4506
|
-
onGo ? /* @__PURE__ */
|
|
4435
|
+
onGo ? /* @__PURE__ */ jsx56(Button, { variant: "primary", onPress: onGo, children: go }) : null
|
|
4507
4436
|
] }),
|
|
4508
|
-
activeFilters.length || resultLabel || actions ? /* @__PURE__ */
|
|
4509
|
-
activeFilters.map((filter) => /* @__PURE__ */
|
|
4510
|
-
activeFilters.length && onClear ? /* @__PURE__ */
|
|
4511
|
-
resultLabel ? /* @__PURE__ */
|
|
4512
|
-
actions ? /* @__PURE__ */
|
|
4437
|
+
activeFilters.length || resultLabel || actions ? /* @__PURE__ */ jsxs45("div", { className: "pire-filterbar-foot", children: [
|
|
4438
|
+
activeFilters.map((filter) => /* @__PURE__ */ jsx56(Tag, { onRemove: onRemoveFilter ? () => onRemoveFilter(filter.id) : void 0, children: filter.label }, filter.id)),
|
|
4439
|
+
activeFilters.length && onClear ? /* @__PURE__ */ jsx56(Button, { variant: "tertiary", size: "sm", onPress: onClear, children: clearAll }) : null,
|
|
4440
|
+
resultLabel ? /* @__PURE__ */ jsx56("span", { className: "pire-filterbar-result", "aria-live": "polite", children: resultLabel }) : null,
|
|
4441
|
+
actions ? /* @__PURE__ */ jsx56("div", { className: "pire-filterbar-actions", children: actions }) : null
|
|
4513
4442
|
] }) : null
|
|
4514
4443
|
] });
|
|
4515
4444
|
}
|
|
4516
4445
|
|
|
4517
4446
|
// src/components/data/DescriptionList.tsx
|
|
4518
|
-
import { jsx as
|
|
4447
|
+
import { jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4519
4448
|
function DescriptionList({
|
|
4520
4449
|
items,
|
|
4521
4450
|
layout = "rows",
|
|
@@ -4524,32 +4453,32 @@ function DescriptionList({
|
|
|
4524
4453
|
style,
|
|
4525
4454
|
...rest
|
|
4526
4455
|
}) {
|
|
4527
|
-
return /* @__PURE__ */
|
|
4456
|
+
return /* @__PURE__ */ jsx57(
|
|
4528
4457
|
"dl",
|
|
4529
4458
|
{
|
|
4530
4459
|
className: cx("pire-dl", className),
|
|
4531
4460
|
"data-layout": layout,
|
|
4532
4461
|
style: { ...layout === "grid" ? { "--pire-dl-cols": columns } : null, ...style },
|
|
4533
4462
|
...rest,
|
|
4534
|
-
children: items.map((item, i) => /* @__PURE__ */
|
|
4535
|
-
/* @__PURE__ */
|
|
4463
|
+
children: items.map((item, i) => /* @__PURE__ */ jsxs46("div", { className: "pire-dl-row", "data-emphasis": item.emphasis ? "true" : void 0, children: [
|
|
4464
|
+
/* @__PURE__ */ jsxs46("dt", { className: "pire-dl-term", children: [
|
|
4536
4465
|
item.label,
|
|
4537
4466
|
item.hint
|
|
4538
4467
|
] }),
|
|
4539
|
-
/* @__PURE__ */
|
|
4468
|
+
/* @__PURE__ */ jsx57("dd", { className: "pire-dl-value", "data-numeric": item.numeric ? "true" : void 0, children: item.value })
|
|
4540
4469
|
] }, i))
|
|
4541
4470
|
}
|
|
4542
4471
|
);
|
|
4543
4472
|
}
|
|
4544
4473
|
|
|
4545
4474
|
// src/components/data/Timeline.tsx
|
|
4546
|
-
import { jsx as
|
|
4475
|
+
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
4547
4476
|
function Timeline({ entries, reverse = false, className, ...rest }) {
|
|
4548
4477
|
const list = reverse ? [...entries].reverse() : entries;
|
|
4549
|
-
return /* @__PURE__ */
|
|
4550
|
-
/* @__PURE__ */
|
|
4551
|
-
/* @__PURE__ */
|
|
4552
|
-
entry.actor ? /* @__PURE__ */
|
|
4478
|
+
return /* @__PURE__ */ jsx58("ol", { className: cx("pire-timeline", className), ...rest, children: list.map((entry, i) => /* @__PURE__ */ jsxs47("li", { className: "pire-timeline-item", children: [
|
|
4479
|
+
/* @__PURE__ */ jsx58("span", { className: "pire-timeline-time", children: entry.time }),
|
|
4480
|
+
/* @__PURE__ */ jsx58("span", { className: "pire-timeline-text", children: entry.event }),
|
|
4481
|
+
entry.actor ? /* @__PURE__ */ jsx58("span", { className: "pire-timeline-actor", children: entry.actor }) : null
|
|
4553
4482
|
] }, entry.id ?? i)) });
|
|
4554
4483
|
}
|
|
4555
4484
|
|
|
@@ -4592,18 +4521,15 @@ function seriesColor(series, index) {
|
|
|
4592
4521
|
const slot = series.colorIndex ?? index + 1;
|
|
4593
4522
|
return slot >= 1 && slot <= VIZ_SLOT_COUNT ? `var(--viz-${slot})` : "var(--viz-other)";
|
|
4594
4523
|
}
|
|
4595
|
-
var IS_DEV4 = process.env.NODE_ENV !== "production";
|
|
4596
|
-
var warnedCharts = /* @__PURE__ */ new Set();
|
|
4597
4524
|
function warnOnSlotOverflow(series, chartLabel) {
|
|
4598
|
-
if (!
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
`[pire] "${chartLabel}" has ${series.length} series but the palette defines ${VIZ_SLOT_COUNT} distinguishable colours. The extras render in one shared neutral. Group the tail into an "Other" series, or split the chart into small multiples.`
|
|
4525
|
+
if (!IS_DEV || series.length <= VIZ_SLOT_COUNT) return;
|
|
4526
|
+
warnOnce(
|
|
4527
|
+
`chart:slots:${chartLabel}`,
|
|
4528
|
+
`"${chartLabel}" has ${series.length} series but the palette defines ${VIZ_SLOT_COUNT} distinguishable colours. The extras render in one shared neutral. Group the tail into an "Other" series, or split the chart into small multiples.`
|
|
4603
4529
|
);
|
|
4604
4530
|
}
|
|
4605
4531
|
function warnOnDonutShape(series, categoryCount, chartLabel) {
|
|
4606
|
-
if (!
|
|
4532
|
+
if (!IS_DEV) return;
|
|
4607
4533
|
const complaints = [];
|
|
4608
4534
|
if (series.length > 1) {
|
|
4609
4535
|
complaints.push(`it has ${series.length} series but a donut draws one \u2014 the rest are ignored`);
|
|
@@ -4619,8 +4545,7 @@ function warnOnDonutShape(series, categoryCount, chartLabel) {
|
|
|
4619
4545
|
);
|
|
4620
4546
|
}
|
|
4621
4547
|
if (complaints.length === 0) return;
|
|
4622
|
-
|
|
4623
|
-
console.warn(`[pire] DonutChart "${chartLabel}": ${complaints.join("; ")}.`);
|
|
4548
|
+
warnOnce(`chart:donut:${chartLabel}`, `DonutChart "${chartLabel}": ${complaints.join("; ")}.`);
|
|
4624
4549
|
}
|
|
4625
4550
|
function stackTotal(series, categoryIndex) {
|
|
4626
4551
|
return series.reduce((total, one) => total + (one.values[categoryIndex] ?? 0), 0);
|
|
@@ -4635,7 +4560,7 @@ function alignToCategories(series, categoryCount) {
|
|
|
4635
4560
|
}
|
|
4636
4561
|
|
|
4637
4562
|
// src/components/data/ChartFrame.tsx
|
|
4638
|
-
import { jsx as
|
|
4563
|
+
import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
4639
4564
|
function seriesLegend(series) {
|
|
4640
4565
|
return series.map((one, index) => ({
|
|
4641
4566
|
key: one.id,
|
|
@@ -4658,29 +4583,29 @@ function ChartFrame({
|
|
|
4658
4583
|
children
|
|
4659
4584
|
}) {
|
|
4660
4585
|
const msg = usePireMessages();
|
|
4661
|
-
return /* @__PURE__ */
|
|
4662
|
-
title || description ? /* @__PURE__ */
|
|
4663
|
-
title ? /* @__PURE__ */
|
|
4664
|
-
description ? /* @__PURE__ */
|
|
4586
|
+
return /* @__PURE__ */ jsxs48("figure", { className: cx("pire-chart", className), style, children: [
|
|
4587
|
+
title || description ? /* @__PURE__ */ jsxs48("figcaption", { className: "pire-chart-head", children: [
|
|
4588
|
+
title ? /* @__PURE__ */ jsx59("span", { className: "pire-chart-title", children: title }) : null,
|
|
4589
|
+
description ? /* @__PURE__ */ jsx59("span", { className: "pire-chart-desc", children: description }) : null
|
|
4665
4590
|
] }) : null,
|
|
4666
|
-
legend && legend.length > 1 ? /* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
4591
|
+
legend && legend.length > 1 ? /* @__PURE__ */ jsx59("ul", { className: "pire-chart-legend", children: legend.map((item) => /* @__PURE__ */ jsxs48("li", { className: "pire-chart-legend-item", children: [
|
|
4592
|
+
/* @__PURE__ */ jsx59("span", { className: "pire-chart-swatch", style: { background: item.color } }),
|
|
4668
4593
|
item.label
|
|
4669
4594
|
] }, item.key)) }) : null,
|
|
4670
|
-
/* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
/* @__PURE__ */
|
|
4674
|
-
/* @__PURE__ */
|
|
4675
|
-
series.map((one) => /* @__PURE__ */
|
|
4595
|
+
/* @__PURE__ */ jsx59("div", { className: "pire-chart-plot", "aria-hidden": "true", children }),
|
|
4596
|
+
/* @__PURE__ */ jsx59("div", { className: showDataTable ? "pire-chart-table" : "pire-sr-only", children: /* @__PURE__ */ jsxs48("table", { children: [
|
|
4597
|
+
/* @__PURE__ */ jsx59("caption", { children: label }),
|
|
4598
|
+
/* @__PURE__ */ jsx59("thead", { children: /* @__PURE__ */ jsxs48("tr", { children: [
|
|
4599
|
+
/* @__PURE__ */ jsx59("th", { scope: "col", children: msg.chartCategoryHeader }),
|
|
4600
|
+
series.map((one) => /* @__PURE__ */ jsx59("th", { scope: "col", children: one.label }, one.id))
|
|
4676
4601
|
] }) }),
|
|
4677
|
-
/* @__PURE__ */
|
|
4602
|
+
/* @__PURE__ */ jsx59("tbody", { children: categories.map((category, categoryIndex) => (
|
|
4678
4603
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4679
|
-
/* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4604
|
+
/* @__PURE__ */ jsxs48("tr", { children: [
|
|
4605
|
+
/* @__PURE__ */ jsx59("th", { scope: "row", children: category }),
|
|
4681
4606
|
series.map((one) => {
|
|
4682
4607
|
const value = one.values[categoryIndex];
|
|
4683
|
-
return /* @__PURE__ */
|
|
4608
|
+
return /* @__PURE__ */ jsx59("td", { children: value == null ? msg.chartNoValue : formatValue(value) }, one.id);
|
|
4684
4609
|
})
|
|
4685
4610
|
] }, categoryIndex)
|
|
4686
4611
|
)) })
|
|
@@ -4689,7 +4614,7 @@ function ChartFrame({
|
|
|
4689
4614
|
}
|
|
4690
4615
|
|
|
4691
4616
|
// src/components/data/BarChart.tsx
|
|
4692
|
-
import { jsx as
|
|
4617
|
+
import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
4693
4618
|
function BarChart({
|
|
4694
4619
|
categories,
|
|
4695
4620
|
series: rawSeries,
|
|
@@ -4704,9 +4629,8 @@ function BarChart({
|
|
|
4704
4629
|
showValues,
|
|
4705
4630
|
className,
|
|
4706
4631
|
style,
|
|
4707
|
-
|
|
4632
|
+
"aria-label": label
|
|
4708
4633
|
}) {
|
|
4709
|
-
const label = rest["aria-label"];
|
|
4710
4634
|
const msg = usePireMessages();
|
|
4711
4635
|
warnOnSlotOverflow(rawSeries, label);
|
|
4712
4636
|
const series = alignToCategories(rawSeries, categories.length);
|
|
@@ -4721,7 +4645,7 @@ function BarChart({
|
|
|
4721
4645
|
const value = series[0].values[categoryIndex];
|
|
4722
4646
|
return value == null ? msg.chartNoValue : formatValue(value);
|
|
4723
4647
|
};
|
|
4724
|
-
return /* @__PURE__ */
|
|
4648
|
+
return /* @__PURE__ */ jsx60(
|
|
4725
4649
|
ChartFrame,
|
|
4726
4650
|
{
|
|
4727
4651
|
label,
|
|
@@ -4734,7 +4658,7 @@ function BarChart({
|
|
|
4734
4658
|
showDataTable,
|
|
4735
4659
|
className,
|
|
4736
4660
|
style,
|
|
4737
|
-
children: !hasData ? /* @__PURE__ */
|
|
4661
|
+
children: !hasData ? /* @__PURE__ */ jsx60("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ jsx60(
|
|
4738
4662
|
"div",
|
|
4739
4663
|
{
|
|
4740
4664
|
className: "pire-chart-bars",
|
|
@@ -4743,12 +4667,12 @@ function BarChart({
|
|
|
4743
4667
|
style: { "--pire-chart-height": `${height}px` },
|
|
4744
4668
|
children: categories.map((category, categoryIndex) => (
|
|
4745
4669
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4746
|
-
/* @__PURE__ */
|
|
4747
|
-
/* @__PURE__ */
|
|
4748
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsxs49("div", { className: "pire-chart-group", children: [
|
|
4671
|
+
/* @__PURE__ */ jsx60("span", { className: "pire-chart-cat", children: category }),
|
|
4672
|
+
/* @__PURE__ */ jsx60("div", { className: "pire-chart-track", children: series.map((one, seriesIndex) => {
|
|
4749
4673
|
const value = one.values[categoryIndex];
|
|
4750
4674
|
if (value == null) return null;
|
|
4751
|
-
return /* @__PURE__ */
|
|
4675
|
+
return /* @__PURE__ */ jsxs49(
|
|
4752
4676
|
"div",
|
|
4753
4677
|
{
|
|
4754
4678
|
className: "pire-chart-bar",
|
|
@@ -4757,8 +4681,8 @@ function BarChart({
|
|
|
4757
4681
|
"--pire-bar-color": seriesColor(one, seriesIndex)
|
|
4758
4682
|
},
|
|
4759
4683
|
children: [
|
|
4760
|
-
withValues && orientation === "vertical" ? /* @__PURE__ */
|
|
4761
|
-
/* @__PURE__ */
|
|
4684
|
+
withValues && orientation === "vertical" ? /* @__PURE__ */ jsx60("span", { className: "pire-chart-barval", children: formatValue(value) }) : null,
|
|
4685
|
+
/* @__PURE__ */ jsxs49("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4762
4686
|
series.length > 1 ? `${one.label}: ` : "",
|
|
4763
4687
|
formatValue(value)
|
|
4764
4688
|
] })
|
|
@@ -4767,7 +4691,7 @@ function BarChart({
|
|
|
4767
4691
|
one.id
|
|
4768
4692
|
);
|
|
4769
4693
|
}) }),
|
|
4770
|
-
withValues && orientation === "horizontal" ? /* @__PURE__ */
|
|
4694
|
+
withValues && orientation === "horizontal" ? /* @__PURE__ */ jsx60("span", { className: "pire-chart-val", children: horizontalLabelFor(categoryIndex) }) : null
|
|
4771
4695
|
] }, categoryIndex)
|
|
4772
4696
|
))
|
|
4773
4697
|
}
|
|
@@ -4777,14 +4701,14 @@ function BarChart({
|
|
|
4777
4701
|
}
|
|
4778
4702
|
|
|
4779
4703
|
// src/components/data/LineChart.tsx
|
|
4780
|
-
import * as
|
|
4781
|
-
import { jsx as
|
|
4704
|
+
import * as React30 from "react";
|
|
4705
|
+
import { jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
4782
4706
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4783
4707
|
var MARKER_LIMIT = 20;
|
|
4784
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4708
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React30.useEffect : React30.useLayoutEffect;
|
|
4785
4709
|
function useMeasuredWidth() {
|
|
4786
|
-
const ref =
|
|
4787
|
-
const [width, setWidth] =
|
|
4710
|
+
const ref = React30.useRef(null);
|
|
4711
|
+
const [width, setWidth] = React30.useState(0);
|
|
4788
4712
|
useIsomorphicLayoutEffect2(() => {
|
|
4789
4713
|
const element = ref.current;
|
|
4790
4714
|
if (!element) return;
|
|
@@ -4809,9 +4733,8 @@ function LineChart({
|
|
|
4809
4733
|
zoomToData = false,
|
|
4810
4734
|
className,
|
|
4811
4735
|
style,
|
|
4812
|
-
|
|
4736
|
+
"aria-label": label
|
|
4813
4737
|
}) {
|
|
4814
|
-
const label = rest["aria-label"];
|
|
4815
4738
|
const msg = usePireMessages();
|
|
4816
4739
|
warnOnSlotOverflow(rawSeries, label);
|
|
4817
4740
|
const [plotRef, width] = useMeasuredWidth();
|
|
@@ -4845,7 +4768,7 @@ function LineChart({
|
|
|
4845
4768
|
return `M${xAt(present[0].index)} ${baseline} L${line} L${xAt(last.index)} ${baseline} Z`;
|
|
4846
4769
|
};
|
|
4847
4770
|
const labelEvery = Math.max(1, Math.ceil(categories.length / Math.max(2, Math.floor(innerWidth / 64))));
|
|
4848
|
-
return /* @__PURE__ */
|
|
4771
|
+
return /* @__PURE__ */ jsx61(
|
|
4849
4772
|
ChartFrame,
|
|
4850
4773
|
{
|
|
4851
4774
|
label,
|
|
@@ -4858,8 +4781,8 @@ function LineChart({
|
|
|
4858
4781
|
showDataTable,
|
|
4859
4782
|
className,
|
|
4860
4783
|
style,
|
|
4861
|
-
children: !hasData ? /* @__PURE__ */
|
|
4862
|
-
width > 0 ? /* @__PURE__ */
|
|
4784
|
+
children: !hasData ? /* @__PURE__ */ jsx61("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ jsxs50("div", { className: "pire-chart-lines", ref: plotRef, style: { height }, children: [
|
|
4785
|
+
width > 0 ? /* @__PURE__ */ jsxs50(
|
|
4863
4786
|
"svg",
|
|
4864
4787
|
{
|
|
4865
4788
|
width,
|
|
@@ -4868,7 +4791,7 @@ function LineChart({
|
|
|
4868
4791
|
"aria-hidden": "true",
|
|
4869
4792
|
focusable: "false",
|
|
4870
4793
|
children: [
|
|
4871
|
-
/* @__PURE__ */
|
|
4794
|
+
/* @__PURE__ */ jsx61("g", { className: "pire-chart-grid", children: scale.ticks.map((tick) => /* @__PURE__ */ jsx61(
|
|
4872
4795
|
"line",
|
|
4873
4796
|
{
|
|
4874
4797
|
x1: PLOT_INSET.left,
|
|
@@ -4878,8 +4801,8 @@ function LineChart({
|
|
|
4878
4801
|
},
|
|
4879
4802
|
tick
|
|
4880
4803
|
)) }),
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
scale.ticks.map((tick) => /* @__PURE__ */
|
|
4804
|
+
/* @__PURE__ */ jsxs50("g", { className: "pire-chart-tick", children: [
|
|
4805
|
+
scale.ticks.map((tick) => /* @__PURE__ */ jsx61(
|
|
4883
4806
|
"text",
|
|
4884
4807
|
{
|
|
4885
4808
|
x: PLOT_INSET.left - 8,
|
|
@@ -4893,11 +4816,11 @@ function LineChart({
|
|
|
4893
4816
|
categories.map(
|
|
4894
4817
|
(category, index) => index % labelEvery === 0 ? (
|
|
4895
4818
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4896
|
-
/* @__PURE__ */
|
|
4819
|
+
/* @__PURE__ */ jsx61("text", { x: xAt(index), y: height - 6, textAnchor: "middle", children: category }, index)
|
|
4897
4820
|
) : null
|
|
4898
4821
|
)
|
|
4899
4822
|
] }),
|
|
4900
|
-
showArea && series[0] ? /* @__PURE__ */
|
|
4823
|
+
showArea && series[0] ? /* @__PURE__ */ jsx61(
|
|
4901
4824
|
"path",
|
|
4902
4825
|
{
|
|
4903
4826
|
d: areaFor(series[0].values),
|
|
@@ -4905,10 +4828,10 @@ function LineChart({
|
|
|
4905
4828
|
style: { fill: seriesColor(series[0], 0) }
|
|
4906
4829
|
}
|
|
4907
4830
|
) : null,
|
|
4908
|
-
/* @__PURE__ */
|
|
4909
|
-
withMarkers ? /* @__PURE__ */
|
|
4831
|
+
/* @__PURE__ */ jsx61("g", { className: "pire-chart-line", fill: "none", children: series.map((one, index) => /* @__PURE__ */ jsx61("path", { d: pathFor(one.values), stroke: seriesColor(one, index) }, one.id)) }),
|
|
4832
|
+
withMarkers ? /* @__PURE__ */ jsx61("g", { className: "pire-chart-marker", children: series.map(
|
|
4910
4833
|
(one, seriesIndex) => one.values.map(
|
|
4911
|
-
(value, index) => value == null ? null : /* @__PURE__ */
|
|
4834
|
+
(value, index) => value == null ? null : /* @__PURE__ */ jsx61(
|
|
4912
4835
|
"circle",
|
|
4913
4836
|
{
|
|
4914
4837
|
cx: xAt(index),
|
|
@@ -4923,7 +4846,7 @@ function LineChart({
|
|
|
4923
4846
|
]
|
|
4924
4847
|
}
|
|
4925
4848
|
) : null,
|
|
4926
|
-
/* @__PURE__ */
|
|
4849
|
+
/* @__PURE__ */ jsx61(
|
|
4927
4850
|
"div",
|
|
4928
4851
|
{
|
|
4929
4852
|
className: "pire-chart-hover",
|
|
@@ -4932,11 +4855,11 @@ function LineChart({
|
|
|
4932
4855
|
},
|
|
4933
4856
|
children: categories.map((category, categoryIndex) => (
|
|
4934
4857
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4935
|
-
/* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
4858
|
+
/* @__PURE__ */ jsx61("div", { className: "pire-chart-band", children: /* @__PURE__ */ jsxs50("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4859
|
+
/* @__PURE__ */ jsx61("strong", { children: category }),
|
|
4937
4860
|
series.map((one) => {
|
|
4938
4861
|
const value = one.values[categoryIndex];
|
|
4939
|
-
return /* @__PURE__ */
|
|
4862
|
+
return /* @__PURE__ */ jsxs50("span", { className: "pire-chart-tip-row", children: [
|
|
4940
4863
|
one.label,
|
|
4941
4864
|
": ",
|
|
4942
4865
|
value == null ? msg.chartNoValue : formatValue(value)
|
|
@@ -4952,8 +4875,8 @@ function LineChart({
|
|
|
4952
4875
|
}
|
|
4953
4876
|
|
|
4954
4877
|
// src/components/data/DonutChart.tsx
|
|
4955
|
-
import * as
|
|
4956
|
-
import { jsx as
|
|
4878
|
+
import * as React31 from "react";
|
|
4879
|
+
import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
4957
4880
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4958
4881
|
function DonutChart({
|
|
4959
4882
|
categories,
|
|
@@ -4969,11 +4892,10 @@ function DonutChart({
|
|
|
4969
4892
|
thickness = 28,
|
|
4970
4893
|
className,
|
|
4971
4894
|
style,
|
|
4972
|
-
|
|
4895
|
+
"aria-label": label
|
|
4973
4896
|
}) {
|
|
4974
|
-
const label = rest["aria-label"];
|
|
4975
4897
|
const msg = usePireMessages();
|
|
4976
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4898
|
+
const [hoveredIndex, setHoveredIndex] = React31.useState(null);
|
|
4977
4899
|
warnOnDonutShape(series, categories.length, label);
|
|
4978
4900
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4979
4901
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -4990,7 +4912,7 @@ function DonutChart({
|
|
|
4990
4912
|
}));
|
|
4991
4913
|
const hovered = hoveredIndex == null ? null : segments.find((segment) => segment.index === hoveredIndex) ?? null;
|
|
4992
4914
|
let arcStart = 0;
|
|
4993
|
-
return /* @__PURE__ */
|
|
4915
|
+
return /* @__PURE__ */ jsx62(
|
|
4994
4916
|
ChartFrame,
|
|
4995
4917
|
{
|
|
4996
4918
|
label,
|
|
@@ -5003,8 +4925,8 @@ function DonutChart({
|
|
|
5003
4925
|
showDataTable,
|
|
5004
4926
|
className,
|
|
5005
4927
|
style,
|
|
5006
|
-
children: !hasData ? /* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
4928
|
+
children: !hasData ? /* @__PURE__ */ jsx62("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ jsxs51("div", { className: "pire-chart-donut", style: { height: size }, children: [
|
|
4929
|
+
/* @__PURE__ */ jsx62(
|
|
5008
4930
|
"svg",
|
|
5009
4931
|
{
|
|
5010
4932
|
width: size,
|
|
@@ -5012,13 +4934,13 @@ function DonutChart({
|
|
|
5012
4934
|
"aria-hidden": "true",
|
|
5013
4935
|
focusable: "false",
|
|
5014
4936
|
onMouseLeave: () => setHoveredIndex(null),
|
|
5015
|
-
children: /* @__PURE__ */
|
|
4937
|
+
children: /* @__PURE__ */ jsx62("g", { transform: `rotate(-90 ${size / 2} ${size / 2})`, children: segments.map((segment) => {
|
|
5016
4938
|
const arcLength = segment.value / total * circumference;
|
|
5017
4939
|
const offset = arcStart;
|
|
5018
4940
|
arcStart += arcLength;
|
|
5019
4941
|
return (
|
|
5020
4942
|
// 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.
|
|
5021
|
-
/* @__PURE__ */
|
|
4943
|
+
/* @__PURE__ */ jsx62(
|
|
5022
4944
|
"circle",
|
|
5023
4945
|
{
|
|
5024
4946
|
className: "pire-chart-arc",
|
|
@@ -5038,9 +4960,9 @@ function DonutChart({
|
|
|
5038
4960
|
}) })
|
|
5039
4961
|
}
|
|
5040
4962
|
),
|
|
5041
|
-
/* @__PURE__ */
|
|
5042
|
-
/* @__PURE__ */
|
|
5043
|
-
/* @__PURE__ */
|
|
4963
|
+
/* @__PURE__ */ jsxs51("div", { className: "pire-chart-donut-center", style: { width: size - thickness * 2 - 8 }, children: [
|
|
4964
|
+
/* @__PURE__ */ jsx62("span", { className: "pire-chart-donut-value", children: hovered ? formatValue(hovered.value) : centerLabel ?? formatValue(total) }),
|
|
4965
|
+
/* @__PURE__ */ jsx62("span", { className: "pire-chart-donut-caption", children: hovered ? hovered.category : centerCaption })
|
|
5044
4966
|
] })
|
|
5045
4967
|
] })
|
|
5046
4968
|
}
|
|
@@ -5052,14 +4974,14 @@ function colorForSegment(index) {
|
|
|
5052
4974
|
|
|
5053
4975
|
// src/components/data/LinkList.tsx
|
|
5054
4976
|
import { Button as AriaButton16 } from "react-aria-components";
|
|
5055
|
-
import { jsx as
|
|
4977
|
+
import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
5056
4978
|
function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
5057
|
-
return /* @__PURE__ */
|
|
5058
|
-
const keySlot = item.key ? /* @__PURE__ */
|
|
5059
|
-
const textSlot = item.text ? /* @__PURE__ */
|
|
4979
|
+
return /* @__PURE__ */ jsx63("div", { className: cx("pire-linklist", className), role: "list", "data-emphasis": emphasis, ...rest, children: items.map((item) => {
|
|
4980
|
+
const keySlot = item.key ? /* @__PURE__ */ jsx63("span", { className: "pire-linklist-key", children: item.key }) : null;
|
|
4981
|
+
const textSlot = item.text ? /* @__PURE__ */ jsx63("span", { className: "pire-linklist-text", children: item.text }) : null;
|
|
5060
4982
|
const [first, second] = emphasis === "text" ? [textSlot, keySlot] : [keySlot, textSlot];
|
|
5061
|
-
return /* @__PURE__ */
|
|
5062
|
-
item.icon ? /* @__PURE__ */
|
|
4983
|
+
return /* @__PURE__ */ jsx63("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ jsxs52(AriaButton16, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
|
|
4984
|
+
item.icon ? /* @__PURE__ */ jsx63(Icon, { name: item.icon, size: 16, className: "pire-linklist-icon" }) : null,
|
|
5063
4985
|
first,
|
|
5064
4986
|
second,
|
|
5065
4987
|
item.trailing
|
|
@@ -5068,7 +4990,7 @@ function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
|
5068
4990
|
}
|
|
5069
4991
|
|
|
5070
4992
|
// src/components/data/RecordCard.tsx
|
|
5071
|
-
import { jsx as
|
|
4993
|
+
import { jsx as jsx64, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
5072
4994
|
function RecordCard({
|
|
5073
4995
|
title,
|
|
5074
4996
|
subtitle,
|
|
@@ -5078,19 +5000,19 @@ function RecordCard({
|
|
|
5078
5000
|
className,
|
|
5079
5001
|
...rest
|
|
5080
5002
|
}) {
|
|
5081
|
-
return /* @__PURE__ */
|
|
5003
|
+
return /* @__PURE__ */ jsxs53(
|
|
5082
5004
|
"div",
|
|
5083
5005
|
{
|
|
5084
5006
|
className: cx("pire-recordcard", className),
|
|
5085
5007
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
5086
5008
|
...rest,
|
|
5087
5009
|
children: [
|
|
5088
|
-
icon ? /* @__PURE__ */
|
|
5089
|
-
/* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5091
|
-
subtitle ? /* @__PURE__ */
|
|
5010
|
+
icon ? /* @__PURE__ */ jsx64("span", { className: "pire-recordcard-tile", "aria-hidden": "true", children: /* @__PURE__ */ jsx64(Icon, { name: icon, size: 20 }) }) : null,
|
|
5011
|
+
/* @__PURE__ */ jsxs53("span", { className: "pire-recordcard-body", children: [
|
|
5012
|
+
/* @__PURE__ */ jsx64("span", { className: "pire-recordcard-title", children: title }),
|
|
5013
|
+
subtitle ? /* @__PURE__ */ jsx64("span", { className: "pire-recordcard-sub", children: subtitle }) : null
|
|
5092
5014
|
] }),
|
|
5093
|
-
action ? /* @__PURE__ */
|
|
5015
|
+
action ? /* @__PURE__ */ jsx64("span", { className: "pire-recordcard-action", children: action }) : null
|
|
5094
5016
|
]
|
|
5095
5017
|
}
|
|
5096
5018
|
);
|
|
@@ -5098,7 +5020,7 @@ function RecordCard({
|
|
|
5098
5020
|
|
|
5099
5021
|
// src/components/data/ViewSwitcher.tsx
|
|
5100
5022
|
import { Button as AriaButton17 } from "react-aria-components";
|
|
5101
|
-
import { jsx as
|
|
5023
|
+
import { jsx as jsx65, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
5102
5024
|
function ViewSwitcher({
|
|
5103
5025
|
name,
|
|
5104
5026
|
isDirty,
|
|
@@ -5111,7 +5033,7 @@ function ViewSwitcher({
|
|
|
5111
5033
|
}) {
|
|
5112
5034
|
const msg = usePireMessages();
|
|
5113
5035
|
const label = ariaLabel ?? (isDirty ? msg.viewSwitcherNameModified.replace("{view}", name) : msg.viewSwitcherName.replace("{view}", name));
|
|
5114
|
-
return /* @__PURE__ */
|
|
5036
|
+
return /* @__PURE__ */ jsxs54(
|
|
5115
5037
|
AriaButton17,
|
|
5116
5038
|
{
|
|
5117
5039
|
className: cx("pire-viewswitcher", className),
|
|
@@ -5120,36 +5042,36 @@ function ViewSwitcher({
|
|
|
5120
5042
|
isDisabled,
|
|
5121
5043
|
onPress,
|
|
5122
5044
|
children: [
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5125
|
-
isDirty ? /* @__PURE__ */
|
|
5126
|
-
/* @__PURE__ */
|
|
5045
|
+
/* @__PURE__ */ jsx65(Icon, { name: icon, size: 16 }),
|
|
5046
|
+
/* @__PURE__ */ jsx65("span", { className: "pire-viewswitcher-name", children: name }),
|
|
5047
|
+
isDirty ? /* @__PURE__ */ jsx65("span", { className: "pire-viewswitcher-dirty", "aria-hidden": "true", children: msg.viewSwitcherModifiedMark }) : null,
|
|
5048
|
+
/* @__PURE__ */ jsx65(Icon, { name: "chevron-down", size: 16 })
|
|
5127
5049
|
]
|
|
5128
5050
|
}
|
|
5129
5051
|
);
|
|
5130
5052
|
}
|
|
5131
5053
|
|
|
5132
5054
|
// src/components/data/BarList.tsx
|
|
5133
|
-
import { jsx as
|
|
5055
|
+
import { jsx as jsx66, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
5134
5056
|
function BarList({ items, max, className, ...rest }) {
|
|
5135
5057
|
const scale = max ?? Math.max(0, ...items.map((i) => i.value));
|
|
5136
|
-
return /* @__PURE__ */
|
|
5058
|
+
return /* @__PURE__ */ jsx66("ul", { ...rest, className: cx("pire-barlist", className), children: items.map((item) => {
|
|
5137
5059
|
const pct = scale > 0 ? Math.max(0, Math.min(100, item.value / scale * 100)) : 0;
|
|
5138
|
-
return /* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5140
|
-
/* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5060
|
+
return /* @__PURE__ */ jsxs55("li", { className: "pire-barlist-row", "data-tone": item.tone, children: [
|
|
5061
|
+
/* @__PURE__ */ jsxs55("span", { className: "pire-barlist-main", children: [
|
|
5062
|
+
/* @__PURE__ */ jsx66("span", { className: "pire-barlist-label", children: item.label }),
|
|
5063
|
+
/* @__PURE__ */ jsx66("span", { className: "pire-barlist-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx66("span", { className: "pire-barlist-fill", style: { width: `${pct}%` } }) })
|
|
5142
5064
|
] }),
|
|
5143
|
-
/* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
5145
|
-
item.hint ? /* @__PURE__ */
|
|
5065
|
+
/* @__PURE__ */ jsxs55("span", { className: "pire-barlist-figure", children: [
|
|
5066
|
+
/* @__PURE__ */ jsx66("span", { className: "pire-barlist-value", children: item.valueLabel ?? String(item.value) }),
|
|
5067
|
+
item.hint ? /* @__PURE__ */ jsx66("span", { className: "pire-barlist-hint", children: item.hint }) : null
|
|
5146
5068
|
] })
|
|
5147
5069
|
] }, item.id);
|
|
5148
5070
|
}) });
|
|
5149
5071
|
}
|
|
5150
5072
|
|
|
5151
5073
|
// src/components/layout/PageBand.tsx
|
|
5152
|
-
import { jsx as
|
|
5074
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
5153
5075
|
function PageBand({
|
|
5154
5076
|
surface = "card",
|
|
5155
5077
|
hasBorder = true,
|
|
@@ -5157,7 +5079,7 @@ function PageBand({
|
|
|
5157
5079
|
className,
|
|
5158
5080
|
...rest
|
|
5159
5081
|
}) {
|
|
5160
|
-
return /* @__PURE__ */
|
|
5082
|
+
return /* @__PURE__ */ jsx67(
|
|
5161
5083
|
"div",
|
|
5162
5084
|
{
|
|
5163
5085
|
className: cx("pire-pageband", className),
|
|
@@ -5170,31 +5092,31 @@ function PageBand({
|
|
|
5170
5092
|
}
|
|
5171
5093
|
|
|
5172
5094
|
// src/components/layout/PageHeader.tsx
|
|
5173
|
-
import { jsx as
|
|
5095
|
+
import { jsx as jsx68, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
5174
5096
|
function PageHeader({ title, subtitle, actions, className, ...rest }) {
|
|
5175
|
-
return /* @__PURE__ */
|
|
5176
|
-
/* @__PURE__ */
|
|
5177
|
-
/* @__PURE__ */
|
|
5178
|
-
subtitle ? /* @__PURE__ */
|
|
5097
|
+
return /* @__PURE__ */ jsxs56("header", { className: cx("pire-pageheader", className), ...rest, children: [
|
|
5098
|
+
/* @__PURE__ */ jsxs56("div", { className: "pire-pageheader-text", children: [
|
|
5099
|
+
/* @__PURE__ */ jsx68("h1", { className: "pire-pageheader-title", children: title }),
|
|
5100
|
+
subtitle ? /* @__PURE__ */ jsx68("p", { className: "pire-pageheader-sub", children: subtitle }) : null
|
|
5179
5101
|
] }),
|
|
5180
|
-
actions ? /* @__PURE__ */
|
|
5102
|
+
actions ? /* @__PURE__ */ jsx68("div", { className: "pire-pageheader-actions", children: actions }) : null
|
|
5181
5103
|
] });
|
|
5182
5104
|
}
|
|
5183
5105
|
|
|
5184
5106
|
// src/components/layout/SectionHeader.tsx
|
|
5185
|
-
import { jsx as
|
|
5107
|
+
import { jsx as jsx69, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
5186
5108
|
function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
5187
|
-
return /* @__PURE__ */
|
|
5188
|
-
/* @__PURE__ */
|
|
5189
|
-
meta ? /* @__PURE__ */
|
|
5190
|
-
actions ? /* @__PURE__ */
|
|
5109
|
+
return /* @__PURE__ */ jsxs57("div", { className: cx("pire-sectionhead", className), ...rest, children: [
|
|
5110
|
+
/* @__PURE__ */ jsx69("span", { className: "pire-eyebrow", children: title }),
|
|
5111
|
+
meta ? /* @__PURE__ */ jsx69("span", { className: "pire-sectionhead-meta", children: meta }) : null,
|
|
5112
|
+
actions ? /* @__PURE__ */ jsx69("div", { className: "pire-sectionhead-actions", children: actions }) : null
|
|
5191
5113
|
] });
|
|
5192
5114
|
}
|
|
5193
5115
|
|
|
5194
5116
|
// src/components/layout/SelectionBar.tsx
|
|
5195
|
-
import * as
|
|
5117
|
+
import * as React32 from "react";
|
|
5196
5118
|
import { useLocale as useLocale2 } from "react-aria-components";
|
|
5197
|
-
import { jsx as
|
|
5119
|
+
import { jsx as jsx70, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
5198
5120
|
function SelectionBar({
|
|
5199
5121
|
count,
|
|
5200
5122
|
noun,
|
|
@@ -5209,8 +5131,8 @@ function SelectionBar({
|
|
|
5209
5131
|
}) {
|
|
5210
5132
|
const msg = usePireMessages();
|
|
5211
5133
|
const { locale } = useLocale2();
|
|
5212
|
-
const plural =
|
|
5213
|
-
const numbers =
|
|
5134
|
+
const plural = React32.useMemo(() => new Intl.PluralRules(locale), [locale]);
|
|
5135
|
+
const numbers = React32.useMemo(() => new Intl.NumberFormat(locale), [locale]);
|
|
5214
5136
|
if (!count) return null;
|
|
5215
5137
|
const isOne = plural.select(count) === "one";
|
|
5216
5138
|
let sentence;
|
|
@@ -5222,26 +5144,26 @@ function SelectionBar({
|
|
|
5222
5144
|
const template = isOne ? feminine ? msg.selectionBarCountOneFeminine : msg.selectionBarCountOne : feminine ? msg.selectionBarCountOtherFeminine : msg.selectionBarCountOther;
|
|
5223
5145
|
sentence = template.replace("{count}", numbers.format(count)).replace("{noun}", word);
|
|
5224
5146
|
}
|
|
5225
|
-
return /* @__PURE__ */
|
|
5226
|
-
/* @__PURE__ */
|
|
5227
|
-
onClear ? /* @__PURE__ */
|
|
5228
|
-
children ? /* @__PURE__ */
|
|
5229
|
-
actions ? /* @__PURE__ */
|
|
5147
|
+
return /* @__PURE__ */ jsxs58("div", { className: cx("pire-selectionbar", className), role: "status", "aria-live": "polite", ...rest, children: [
|
|
5148
|
+
/* @__PURE__ */ jsx70("span", { className: "pire-selectionbar-count", children: sentence }),
|
|
5149
|
+
onClear ? /* @__PURE__ */ jsx70(Button, { size: "sm", variant: "tertiary", onPress: onClear, children: clearLabel ?? msg.selectionBarClear }) : null,
|
|
5150
|
+
children ? /* @__PURE__ */ jsx70("span", { className: "pire-selectionbar-note", children }) : null,
|
|
5151
|
+
actions ? /* @__PURE__ */ jsx70("div", { className: "pire-selectionbar-actions", children: actions }) : null
|
|
5230
5152
|
] });
|
|
5231
5153
|
}
|
|
5232
5154
|
|
|
5233
5155
|
// src/components/layout/FooterBar.tsx
|
|
5234
|
-
import { jsx as
|
|
5156
|
+
import { jsx as jsx71, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
5235
5157
|
function FooterBar({ note, actions, children, className, ...rest }) {
|
|
5236
|
-
return /* @__PURE__ */
|
|
5237
|
-
note ? /* @__PURE__ */
|
|
5158
|
+
return /* @__PURE__ */ jsxs59("footer", { className: cx("pire-footerbar", className), ...rest, children: [
|
|
5159
|
+
note ? /* @__PURE__ */ jsx71("span", { className: "pire-footerbar-note", children: note }) : null,
|
|
5238
5160
|
children,
|
|
5239
|
-
actions ? /* @__PURE__ */
|
|
5161
|
+
actions ? /* @__PURE__ */ jsx71("div", { className: "pire-footerbar-actions", children: actions }) : null
|
|
5240
5162
|
] });
|
|
5241
5163
|
}
|
|
5242
5164
|
|
|
5243
5165
|
// src/components/layout/SplitPane.tsx
|
|
5244
|
-
import { jsx as
|
|
5166
|
+
import { jsx as jsx72, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
5245
5167
|
function SplitPane({
|
|
5246
5168
|
list,
|
|
5247
5169
|
detail,
|
|
@@ -5257,7 +5179,7 @@ function SplitPane({
|
|
|
5257
5179
|
}) {
|
|
5258
5180
|
const msg = usePireMessages();
|
|
5259
5181
|
const width = typeof listWidth === "number" ? `${listWidth}px` : listWidth;
|
|
5260
|
-
return /* @__PURE__ */
|
|
5182
|
+
return /* @__PURE__ */ jsxs60(
|
|
5261
5183
|
"div",
|
|
5262
5184
|
{
|
|
5263
5185
|
className: cx("pire-split", className),
|
|
@@ -5265,10 +5187,10 @@ function SplitPane({
|
|
|
5265
5187
|
style: { ["--pire-split-list-w"]: width, ...style },
|
|
5266
5188
|
...rest,
|
|
5267
5189
|
children: [
|
|
5268
|
-
/* @__PURE__ */
|
|
5269
|
-
/* @__PURE__ */
|
|
5270
|
-
onBack ? /* @__PURE__ */
|
|
5271
|
-
detail ?? /* @__PURE__ */
|
|
5190
|
+
/* @__PURE__ */ jsx72("section", { className: "pire-split-list", "aria-label": listLabel ?? msg.splitPaneList, children: list }),
|
|
5191
|
+
/* @__PURE__ */ jsxs60("section", { className: "pire-split-detail", "aria-label": detailLabel ?? msg.splitPaneDetail, children: [
|
|
5192
|
+
onBack ? /* @__PURE__ */ jsx72("div", { className: "pire-split-back", children: /* @__PURE__ */ jsx72(Button, { variant: "tertiary", size: "sm", icon: "arrow-left", onPress: onBack, children: backLabel ?? msg.splitPaneBack }) }) : null,
|
|
5193
|
+
detail ?? /* @__PURE__ */ jsx72("div", { className: "pire-split-empty", children: emptyDetail })
|
|
5272
5194
|
] })
|
|
5273
5195
|
]
|
|
5274
5196
|
}
|
|
@@ -5276,7 +5198,7 @@ function SplitPane({
|
|
|
5276
5198
|
}
|
|
5277
5199
|
|
|
5278
5200
|
// src/components/patterns/ConfirmDialog.tsx
|
|
5279
|
-
import { Fragment as
|
|
5201
|
+
import { Fragment as Fragment12, jsx as jsx73, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
5280
5202
|
function ConfirmDialog({
|
|
5281
5203
|
isOpen,
|
|
5282
5204
|
title,
|
|
@@ -5292,7 +5214,7 @@ function ConfirmDialog({
|
|
|
5292
5214
|
onCancel
|
|
5293
5215
|
}) {
|
|
5294
5216
|
const msg = usePireMessages();
|
|
5295
|
-
return /* @__PURE__ */
|
|
5217
|
+
return /* @__PURE__ */ jsxs61(
|
|
5296
5218
|
Dialog,
|
|
5297
5219
|
{
|
|
5298
5220
|
isOpen,
|
|
@@ -5302,9 +5224,9 @@ function ConfirmDialog({
|
|
|
5302
5224
|
onClose: onCancel,
|
|
5303
5225
|
isDismissable: !isBusy,
|
|
5304
5226
|
showClose: false,
|
|
5305
|
-
footer: /* @__PURE__ */
|
|
5306
|
-
/* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5227
|
+
footer: /* @__PURE__ */ jsxs61(Fragment12, { children: [
|
|
5228
|
+
/* @__PURE__ */ jsx73(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel ?? msg.confirmDialogCancel }),
|
|
5229
|
+
/* @__PURE__ */ jsx73(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? msg.confirmDialogBusy : confirmLabel ?? msg.confirmDialogConfirm })
|
|
5308
5230
|
] }),
|
|
5309
5231
|
children: [
|
|
5310
5232
|
facts?.length ? (
|
|
@@ -5312,9 +5234,9 @@ function ConfirmDialog({
|
|
|
5312
5234
|
// *prohibits* `aria-label` — the label named nothing at all, and axe's
|
|
5313
5235
|
// `aria-prohibited-attr` fails it on sight. Every other labelled div/span in this library
|
|
5314
5236
|
// pairs with an explicit role for the same reason.
|
|
5315
|
-
/* @__PURE__ */
|
|
5237
|
+
/* @__PURE__ */ jsx73("div", { className: "pire-confirm-facts", role: "group", "aria-label": msg.confirmDialogFactsLabel, children: /* @__PURE__ */ jsx73(DescriptionList, { layout: "rows", items: facts }) })
|
|
5316
5238
|
) : null,
|
|
5317
|
-
consequence ? /* @__PURE__ */
|
|
5239
|
+
consequence ? /* @__PURE__ */ jsx73(
|
|
5318
5240
|
InlineMessage,
|
|
5319
5241
|
{
|
|
5320
5242
|
kind: tone === "danger" ? "error" : "warning",
|
|
@@ -5329,7 +5251,7 @@ function ConfirmDialog({
|
|
|
5329
5251
|
}
|
|
5330
5252
|
|
|
5331
5253
|
// src/components/patterns/CommandPalette.tsx
|
|
5332
|
-
import * as
|
|
5254
|
+
import * as React34 from "react";
|
|
5333
5255
|
import {
|
|
5334
5256
|
Autocomplete,
|
|
5335
5257
|
ModalOverlay as ModalOverlay2,
|
|
@@ -5342,7 +5264,22 @@ import {
|
|
|
5342
5264
|
Header as Header2,
|
|
5343
5265
|
useFilter as useFilter2
|
|
5344
5266
|
} from "react-aria-components";
|
|
5345
|
-
|
|
5267
|
+
|
|
5268
|
+
// src/components/utils/useDocumentKeyDown.ts
|
|
5269
|
+
import * as React33 from "react";
|
|
5270
|
+
function useDocumentKeyDown(onKeyDown, isDisabled) {
|
|
5271
|
+
const handler = React33.useRef(onKeyDown);
|
|
5272
|
+
handler.current = onKeyDown;
|
|
5273
|
+
React33.useEffect(() => {
|
|
5274
|
+
if (isDisabled) return;
|
|
5275
|
+
const listener = (event) => handler.current(event);
|
|
5276
|
+
document.addEventListener("keydown", listener);
|
|
5277
|
+
return () => document.removeEventListener("keydown", listener);
|
|
5278
|
+
}, [isDisabled]);
|
|
5279
|
+
}
|
|
5280
|
+
|
|
5281
|
+
// src/components/patterns/CommandPalette.tsx
|
|
5282
|
+
import { Fragment as Fragment13, jsx as jsx74, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
5346
5283
|
var RESULTS_SECTION_KEY = "__pire_results__";
|
|
5347
5284
|
var searchableText = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
5348
5285
|
function CommandPalette({
|
|
@@ -5363,17 +5300,17 @@ function CommandPalette({
|
|
|
5363
5300
|
style
|
|
5364
5301
|
}) {
|
|
5365
5302
|
const msg = usePireMessages();
|
|
5366
|
-
const [query, setQuery] =
|
|
5303
|
+
const [query, setQuery] = React34.useState("");
|
|
5367
5304
|
const { contains } = useFilter2({ sensitivity: "base" });
|
|
5368
|
-
|
|
5305
|
+
React34.useEffect(() => {
|
|
5369
5306
|
if (isOpen) setQuery("");
|
|
5370
5307
|
}, [isOpen]);
|
|
5371
|
-
const searchableById =
|
|
5308
|
+
const searchableById = React34.useMemo(() => {
|
|
5372
5309
|
const byId = /* @__PURE__ */ new Map();
|
|
5373
5310
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
5374
5311
|
return byId;
|
|
5375
5312
|
}, [groups]);
|
|
5376
|
-
const filter =
|
|
5313
|
+
const filter = React34.useCallback(
|
|
5377
5314
|
(textValue, inputValue, node) => {
|
|
5378
5315
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
5379
5316
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -5386,7 +5323,7 @@ function CommandPalette({
|
|
|
5386
5323
|
};
|
|
5387
5324
|
const sections = [...groups, ...resultsGroup ? [{ ...resultsGroup, id: RESULTS_SECTION_KEY }] : []];
|
|
5388
5325
|
const status = isLoading ? loadingLabel ?? msg.commandPaletteLoading : emptyLabel ?? msg.commandPaletteEmpty;
|
|
5389
|
-
return /* @__PURE__ */
|
|
5326
|
+
return /* @__PURE__ */ jsx74(
|
|
5390
5327
|
ModalOverlay2,
|
|
5391
5328
|
{
|
|
5392
5329
|
className: "pire-cp-overlay",
|
|
@@ -5395,11 +5332,11 @@ function CommandPalette({
|
|
|
5395
5332
|
onOpenChange: (open) => {
|
|
5396
5333
|
if (!open) onOpenChange?.(false);
|
|
5397
5334
|
},
|
|
5398
|
-
children: /* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5400
|
-
/* @__PURE__ */
|
|
5401
|
-
/* @__PURE__ */
|
|
5402
|
-
/* @__PURE__ */
|
|
5335
|
+
children: /* @__PURE__ */ jsx74(Modal2, { className: cx("pire-cp-modal", className), style, children: /* @__PURE__ */ jsxs62(AriaDialog4, { className: "pire-cp-dialog", "aria-label": ariaLabel ?? msg.commandPaletteLabel, children: [
|
|
5336
|
+
/* @__PURE__ */ jsxs62(Autocomplete, { filter, inputValue: query, onInputChange: handleInputChange, children: [
|
|
5337
|
+
/* @__PURE__ */ jsxs62(SearchField, { className: "pire-cp-search", "aria-label": msg.commandPaletteSearchLabel, children: [
|
|
5338
|
+
/* @__PURE__ */ jsx74(Icon, { name: "search", size: 18, className: "pire-cp-search-icon" }),
|
|
5339
|
+
/* @__PURE__ */ jsx74(
|
|
5403
5340
|
AriaInput5,
|
|
5404
5341
|
{
|
|
5405
5342
|
className: "pire-cp-input",
|
|
@@ -5408,16 +5345,16 @@ function CommandPalette({
|
|
|
5408
5345
|
}
|
|
5409
5346
|
)
|
|
5410
5347
|
] }),
|
|
5411
|
-
isLoading ? /* @__PURE__ */
|
|
5412
|
-
/* @__PURE__ */
|
|
5348
|
+
isLoading ? /* @__PURE__ */ jsx74("div", { className: "pire-cp-loading", role: "status", "aria-live": "polite", children: loadingLabel ?? msg.commandPaletteLoading }) : null,
|
|
5349
|
+
/* @__PURE__ */ jsx74(
|
|
5413
5350
|
AriaMenu2,
|
|
5414
5351
|
{
|
|
5415
5352
|
className: "pire-cp-list",
|
|
5416
5353
|
onAction: (key) => onAction?.(String(key)),
|
|
5417
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
5418
|
-
children: sections.map((section) => /* @__PURE__ */
|
|
5419
|
-
section.label ? /* @__PURE__ */
|
|
5420
|
-
section.items.map((item) => /* @__PURE__ */
|
|
5354
|
+
renderEmptyState: () => /* @__PURE__ */ jsx74("div", { className: "pire-cp-status", children: status }),
|
|
5355
|
+
children: sections.map((section) => /* @__PURE__ */ jsxs62(AriaMenuSection2, { id: section.id, className: "pire-cp-section", children: [
|
|
5356
|
+
section.label ? /* @__PURE__ */ jsx74(Header2, { className: "pire-cp-section-title", children: section.label }) : null,
|
|
5357
|
+
section.items.map((item) => /* @__PURE__ */ jsx74(
|
|
5421
5358
|
MenuItem,
|
|
5422
5359
|
{
|
|
5423
5360
|
id: item.id,
|
|
@@ -5438,18 +5375,18 @@ function CommandPalette({
|
|
|
5438
5375
|
// aria-hidden: the glyphs are a sighted affordance for discovering the keys. A screen
|
|
5439
5376
|
// reader already announces the listbox semantics that make those keys work, so reading
|
|
5440
5377
|
// "up arrow down arrow navigate" out loud is noise on every open.
|
|
5441
|
-
/* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
/* @__PURE__ */
|
|
5444
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsx74("div", { className: "pire-cp-foot", "aria-hidden": "true", children: footer ?? /* @__PURE__ */ jsxs62(Fragment13, { children: [
|
|
5379
|
+
/* @__PURE__ */ jsxs62("span", { className: "pire-cp-hint", children: [
|
|
5380
|
+
/* @__PURE__ */ jsx74(Kbd, { children: "\u2191" }),
|
|
5381
|
+
/* @__PURE__ */ jsx74(Kbd, { children: "\u2193" }),
|
|
5445
5382
|
msg.commandPaletteHintNavigate
|
|
5446
5383
|
] }),
|
|
5447
|
-
/* @__PURE__ */
|
|
5448
|
-
/* @__PURE__ */
|
|
5384
|
+
/* @__PURE__ */ jsxs62("span", { className: "pire-cp-hint", children: [
|
|
5385
|
+
/* @__PURE__ */ jsx74(Kbd, { children: "\u21B5" }),
|
|
5449
5386
|
msg.commandPaletteHintSelect
|
|
5450
5387
|
] }),
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5388
|
+
/* @__PURE__ */ jsxs62("span", { className: "pire-cp-hint", children: [
|
|
5389
|
+
/* @__PURE__ */ jsx74(Kbd, { children: "esc" }),
|
|
5453
5390
|
msg.commandPaletteHintClose
|
|
5454
5391
|
] })
|
|
5455
5392
|
] }) })
|
|
@@ -5459,31 +5396,24 @@ function CommandPalette({
|
|
|
5459
5396
|
);
|
|
5460
5397
|
}
|
|
5461
5398
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
if (event.key.toLowerCase() !== key.toLowerCase()) return;
|
|
5469
|
-
event.preventDefault();
|
|
5470
|
-
handler.current();
|
|
5471
|
-
};
|
|
5472
|
-
document.addEventListener("keydown", onKeyDown);
|
|
5473
|
-
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5474
|
-
}, [key, isDisabled]);
|
|
5399
|
+
useDocumentKeyDown((event) => {
|
|
5400
|
+
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
5401
|
+
if (event.key.toLowerCase() !== key.toLowerCase()) return;
|
|
5402
|
+
event.preventDefault();
|
|
5403
|
+
onTrigger();
|
|
5404
|
+
}, isDisabled);
|
|
5475
5405
|
}
|
|
5476
5406
|
|
|
5477
5407
|
// src/components/patterns/AppLauncher.tsx
|
|
5478
|
-
import * as
|
|
5408
|
+
import * as React35 from "react";
|
|
5479
5409
|
import {
|
|
5480
5410
|
DialogTrigger,
|
|
5481
5411
|
Button as AriaButton18,
|
|
5482
|
-
Popover as
|
|
5412
|
+
Popover as Popover8,
|
|
5483
5413
|
Dialog as AriaDialog5,
|
|
5484
5414
|
useFilter as useFilter3
|
|
5485
5415
|
} from "react-aria-components";
|
|
5486
|
-
import { Fragment as
|
|
5416
|
+
import { Fragment as Fragment14, jsx as jsx75, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
5487
5417
|
var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
5488
5418
|
function AppLauncher({
|
|
5489
5419
|
sections,
|
|
@@ -5502,13 +5432,13 @@ function AppLauncher({
|
|
|
5502
5432
|
className
|
|
5503
5433
|
}) {
|
|
5504
5434
|
const msg = usePireMessages();
|
|
5505
|
-
const [query, setQuery] =
|
|
5435
|
+
const [query, setQuery] = React35.useState("");
|
|
5506
5436
|
const { contains } = useFilter3({ sensitivity: "base" });
|
|
5507
5437
|
const handleSearch = (next) => {
|
|
5508
5438
|
setQuery(next);
|
|
5509
5439
|
onSearchChange?.(next);
|
|
5510
5440
|
};
|
|
5511
|
-
const visible =
|
|
5441
|
+
const visible = React35.useMemo(() => {
|
|
5512
5442
|
if (isFilteredExternally) return sections;
|
|
5513
5443
|
const q = query.trim();
|
|
5514
5444
|
if (!q) return sections;
|
|
@@ -5522,25 +5452,25 @@ function AppLauncher({
|
|
|
5522
5452
|
return (
|
|
5523
5453
|
// Each opening starts from the full list, as CommandPalette and ValueHelpDialog do. Reset through
|
|
5524
5454
|
// `handleSearch` so a consumer filtering on the server clears its query too.
|
|
5525
|
-
/* @__PURE__ */
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5528
|
-
|
|
5455
|
+
/* @__PURE__ */ jsxs63(DialogTrigger, { onOpenChange: (open) => open && query && handleSearch(""), children: [
|
|
5456
|
+
/* @__PURE__ */ jsx75(AriaButton18, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ jsx75(Icon, { name: icon, size: 20 }) }),
|
|
5457
|
+
/* @__PURE__ */ jsx75(
|
|
5458
|
+
Popover8,
|
|
5529
5459
|
{
|
|
5530
5460
|
className: cx("pire-launcher-popover", className),
|
|
5531
5461
|
placement: "bottom start",
|
|
5532
5462
|
offset: 0,
|
|
5533
5463
|
crossOffset: 0,
|
|
5534
5464
|
containerPadding: 0,
|
|
5535
|
-
children: /* @__PURE__ */
|
|
5536
|
-
/* @__PURE__ */
|
|
5537
|
-
/* @__PURE__ */
|
|
5538
|
-
meta ? /* @__PURE__ */
|
|
5465
|
+
children: /* @__PURE__ */ jsx75(AriaDialog5, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ jsxs63(Fragment14, { children: [
|
|
5466
|
+
/* @__PURE__ */ jsxs63("div", { className: "pire-launcher-head", children: [
|
|
5467
|
+
/* @__PURE__ */ jsx75("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
|
|
5468
|
+
meta ? /* @__PURE__ */ jsx75("span", { className: "pire-launcher-meta", children: meta }) : null
|
|
5539
5469
|
] }),
|
|
5540
5470
|
isSearchable ? (
|
|
5541
5471
|
// autoFocus is right here specifically: the panel exists to be searched, and the
|
|
5542
5472
|
// user just chose to open it, so taking the caret is what they asked for.
|
|
5543
|
-
/* @__PURE__ */
|
|
5473
|
+
/* @__PURE__ */ jsx75(
|
|
5544
5474
|
Input,
|
|
5545
5475
|
{
|
|
5546
5476
|
"aria-label": msg.appLauncherSearch,
|
|
@@ -5554,17 +5484,17 @@ function AppLauncher({
|
|
|
5554
5484
|
}
|
|
5555
5485
|
)
|
|
5556
5486
|
) : null,
|
|
5557
|
-
isLoading ? /* @__PURE__ */
|
|
5558
|
-
isEmpty ? /* @__PURE__ */
|
|
5487
|
+
isLoading ? /* @__PURE__ */ jsx75("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
|
|
5488
|
+
isEmpty ? /* @__PURE__ */ jsx75("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
|
|
5559
5489
|
visible.map((section, si) => (
|
|
5560
5490
|
// Sections are positional zones with no record identity, so the heading is the key
|
|
5561
5491
|
// where there is one. Same reasoning as ShellRail's groups.
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
section.label ? /* @__PURE__ */
|
|
5564
|
-
/* @__PURE__ */
|
|
5492
|
+
/* @__PURE__ */ jsxs63("div", { className: "pire-launcher-section", children: [
|
|
5493
|
+
section.label ? /* @__PURE__ */ jsx75("div", { className: "pire-eyebrow", children: section.label }) : null,
|
|
5494
|
+
/* @__PURE__ */ jsx75("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
|
|
5565
5495
|
const isCurrent = item.id === value;
|
|
5566
5496
|
const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
|
|
5567
|
-
return /* @__PURE__ */
|
|
5497
|
+
return /* @__PURE__ */ jsxs63(
|
|
5568
5498
|
AriaButton18,
|
|
5569
5499
|
{
|
|
5570
5500
|
className: "pire-launcher-item",
|
|
@@ -5575,16 +5505,16 @@ function AppLauncher({
|
|
|
5575
5505
|
onAction?.(item.id);
|
|
5576
5506
|
},
|
|
5577
5507
|
children: [
|
|
5578
|
-
item.icon ? /* @__PURE__ */
|
|
5508
|
+
item.icon ? /* @__PURE__ */ jsx75("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ jsx75(
|
|
5579
5509
|
Icon,
|
|
5580
5510
|
{
|
|
5581
5511
|
name: item.icon,
|
|
5582
5512
|
size: (section.variant ?? "tile") === "tile" ? 20 : 16
|
|
5583
5513
|
}
|
|
5584
5514
|
) }) : null,
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
showsDescription ? /* @__PURE__ */
|
|
5515
|
+
/* @__PURE__ */ jsxs63("span", { className: "pire-launcher-item-text", children: [
|
|
5516
|
+
/* @__PURE__ */ jsx75("span", { className: "pire-launcher-item-label", children: item.label }),
|
|
5517
|
+
showsDescription ? /* @__PURE__ */ jsx75("span", { className: "pire-launcher-item-desc", children: item.description }) : null
|
|
5588
5518
|
] })
|
|
5589
5519
|
]
|
|
5590
5520
|
},
|
|
@@ -5601,9 +5531,9 @@ function AppLauncher({
|
|
|
5601
5531
|
}
|
|
5602
5532
|
|
|
5603
5533
|
// src/components/patterns/SidePanel.tsx
|
|
5604
|
-
import * as
|
|
5605
|
-
import { ModalOverlay as ModalOverlay3, Modal as Modal3, Dialog as AriaDialog6
|
|
5606
|
-
import { jsx as
|
|
5534
|
+
import * as React36 from "react";
|
|
5535
|
+
import { ModalOverlay as ModalOverlay3, Modal as Modal3, Dialog as AriaDialog6 } from "react-aria-components";
|
|
5536
|
+
import { jsx as jsx76, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
5607
5537
|
var PHONE_MAX_WIDTH = 600;
|
|
5608
5538
|
var narrowQuery = `(max-width: ${PHONE_MAX_WIDTH}px)`;
|
|
5609
5539
|
var subscribeNarrow = (notify) => {
|
|
@@ -5626,22 +5556,24 @@ function SidePanel({
|
|
|
5626
5556
|
className
|
|
5627
5557
|
}) {
|
|
5628
5558
|
const msg = usePireMessages();
|
|
5629
|
-
const titleId =
|
|
5630
|
-
const narrow =
|
|
5631
|
-
const head = (heading) => /* @__PURE__ */
|
|
5632
|
-
|
|
5559
|
+
const titleId = React36.useId();
|
|
5560
|
+
const narrow = React36.useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
|
|
5561
|
+
const head = (heading) => /* @__PURE__ */ jsx76(
|
|
5562
|
+
DialogHeader,
|
|
5563
|
+
{
|
|
5633
5564
|
heading,
|
|
5634
|
-
subtitle ? /* @__PURE__ */
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5565
|
+
description: subtitle ? /* @__PURE__ */ jsx76(DialogDescription, { children: subtitle }) : null,
|
|
5566
|
+
closeLabel: msg.sidePanelClose,
|
|
5567
|
+
onClose
|
|
5568
|
+
}
|
|
5569
|
+
);
|
|
5638
5570
|
if (presentation === "docked" && !narrow) {
|
|
5639
5571
|
if (!isOpen) return null;
|
|
5640
5572
|
return (
|
|
5641
5573
|
// A named `section` (role `region`) rather than the `aside` the shape suggests: `aside` is a
|
|
5642
5574
|
// complementary landmark, which must sit at the top level of the page, and a docked editor
|
|
5643
5575
|
// lives inside the app's `main` by definition.
|
|
5644
|
-
/* @__PURE__ */
|
|
5576
|
+
/* @__PURE__ */ jsxs64(
|
|
5645
5577
|
"section",
|
|
5646
5578
|
{
|
|
5647
5579
|
className: cx("pire-sidepanel", className),
|
|
@@ -5655,16 +5587,16 @@ function SidePanel({
|
|
|
5655
5587
|
},
|
|
5656
5588
|
children: [
|
|
5657
5589
|
head(
|
|
5658
|
-
/* @__PURE__ */
|
|
5590
|
+
/* @__PURE__ */ jsx76("h2", { id: titleId, className: "pire-dialog-title", children: title })
|
|
5659
5591
|
),
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
footer ? /* @__PURE__ */
|
|
5592
|
+
/* @__PURE__ */ jsx76("div", { className: "pire-dialog-body", children }),
|
|
5593
|
+
footer ? /* @__PURE__ */ jsx76("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5662
5594
|
]
|
|
5663
5595
|
}
|
|
5664
5596
|
)
|
|
5665
5597
|
);
|
|
5666
5598
|
}
|
|
5667
|
-
return /* @__PURE__ */
|
|
5599
|
+
return /* @__PURE__ */ jsx76(
|
|
5668
5600
|
ModalOverlay3,
|
|
5669
5601
|
{
|
|
5670
5602
|
className: "pire-sidepanel-overlay",
|
|
@@ -5673,19 +5605,17 @@ function SidePanel({
|
|
|
5673
5605
|
onOpenChange: (o) => {
|
|
5674
5606
|
if (!o) onClose?.();
|
|
5675
5607
|
},
|
|
5676
|
-
children: /* @__PURE__ */
|
|
5677
|
-
head(
|
|
5678
|
-
|
|
5679
|
-
)
|
|
5680
|
-
/* @__PURE__ */ jsx73("div", { className: "pire-dialog-body", style: { flex: 1 }, children }),
|
|
5681
|
-
footer ? /* @__PURE__ */ jsx73("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5608
|
+
children: /* @__PURE__ */ jsx76(Modal3, { className: cx("pire-sidepanel", className), style: { width }, children: /* @__PURE__ */ jsxs64(AriaDialog6, { className: "pire-dialog", children: [
|
|
5609
|
+
head(/* @__PURE__ */ jsx76(DialogTitle, { children: title })),
|
|
5610
|
+
/* @__PURE__ */ jsx76("div", { className: "pire-dialog-body", children }),
|
|
5611
|
+
footer ? /* @__PURE__ */ jsx76("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5682
5612
|
] }) })
|
|
5683
5613
|
}
|
|
5684
5614
|
);
|
|
5685
5615
|
}
|
|
5686
5616
|
|
|
5687
5617
|
// src/components/patterns/EmptyState.tsx
|
|
5688
|
-
import { jsx as
|
|
5618
|
+
import { jsx as jsx77, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
5689
5619
|
function EmptyState({
|
|
5690
5620
|
icon = "file-text",
|
|
5691
5621
|
title,
|
|
@@ -5695,18 +5625,18 @@ function EmptyState({
|
|
|
5695
5625
|
className,
|
|
5696
5626
|
...rest
|
|
5697
5627
|
}) {
|
|
5698
|
-
return /* @__PURE__ */
|
|
5699
|
-
/* @__PURE__ */
|
|
5700
|
-
title ? /* @__PURE__ */
|
|
5701
|
-
children ? /* @__PURE__ */
|
|
5628
|
+
return /* @__PURE__ */ jsxs65("div", { className: cx("pire-empty", className), "data-compact": compact ? "true" : void 0, ...rest, children: [
|
|
5629
|
+
/* @__PURE__ */ jsx77(Icon, { name: icon, size: 24, className: "pire-empty-icon" }),
|
|
5630
|
+
title ? /* @__PURE__ */ jsx77("p", { className: "pire-empty-title", children: title }) : null,
|
|
5631
|
+
children ? /* @__PURE__ */ jsx77("p", { className: "pire-empty-body", children }) : null,
|
|
5702
5632
|
action
|
|
5703
5633
|
] });
|
|
5704
5634
|
}
|
|
5705
5635
|
|
|
5706
5636
|
// src/components/patterns/NumPad.tsx
|
|
5707
|
-
import * as
|
|
5637
|
+
import * as React37 from "react";
|
|
5708
5638
|
import { useLocale as useLocale3 } from "react-aria-components";
|
|
5709
|
-
import { jsx as
|
|
5639
|
+
import { jsx as jsx78, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
5710
5640
|
var BASE_KEYS = [
|
|
5711
5641
|
{ value: "7" },
|
|
5712
5642
|
{ value: "8" },
|
|
@@ -5729,40 +5659,33 @@ function fittingDigits(digits, buffer, separator, maxFractionDigits) {
|
|
|
5729
5659
|
return room <= 0 ? "" : digits.slice(0, room);
|
|
5730
5660
|
}
|
|
5731
5661
|
function useNumPadKeyboard(onKey, isDisabled, containerRef) {
|
|
5732
|
-
const
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
handler.current("decimal");
|
|
5760
|
-
return;
|
|
5761
|
-
}
|
|
5762
|
-
};
|
|
5763
|
-
document.addEventListener("keydown", onKeyDown);
|
|
5764
|
-
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5765
|
-
}, [isDisabled, containerRef]);
|
|
5662
|
+
const isEditingElsewhere = () => {
|
|
5663
|
+
const el = document.activeElement;
|
|
5664
|
+
if (!el) return false;
|
|
5665
|
+
const tag = el.tagName;
|
|
5666
|
+
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || el.hasAttribute("contenteditable");
|
|
5667
|
+
};
|
|
5668
|
+
const isBackgroundedByAnOverlay = () => containerRef.current?.closest("[inert]") != null;
|
|
5669
|
+
useDocumentKeyDown((event) => {
|
|
5670
|
+
if (event.metaKey || event.ctrlKey || event.altKey) return;
|
|
5671
|
+
if (isEditingElsewhere() || isBackgroundedByAnOverlay()) return;
|
|
5672
|
+
if (event.key >= "0" && event.key <= "9") {
|
|
5673
|
+
onKey(event.key);
|
|
5674
|
+
return;
|
|
5675
|
+
}
|
|
5676
|
+
if (event.key === "Backspace") {
|
|
5677
|
+
onKey("backspace");
|
|
5678
|
+
return;
|
|
5679
|
+
}
|
|
5680
|
+
if (event.key === "Escape") {
|
|
5681
|
+
onKey("clear");
|
|
5682
|
+
return;
|
|
5683
|
+
}
|
|
5684
|
+
if (event.key === "," || event.key === ".") {
|
|
5685
|
+
onKey("decimal");
|
|
5686
|
+
return;
|
|
5687
|
+
}
|
|
5688
|
+
}, isDisabled);
|
|
5766
5689
|
}
|
|
5767
5690
|
function NumPad({
|
|
5768
5691
|
"aria-label": ariaLabel,
|
|
@@ -5778,11 +5701,11 @@ function NumPad({
|
|
|
5778
5701
|
style
|
|
5779
5702
|
}) {
|
|
5780
5703
|
const msg = usePireMessages();
|
|
5781
|
-
const containerRef =
|
|
5704
|
+
const containerRef = React37.useRef(null);
|
|
5782
5705
|
const { locale } = useLocale3();
|
|
5783
5706
|
const separator = decimalSeparatorFor(locale);
|
|
5784
5707
|
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5785
|
-
const applyKey =
|
|
5708
|
+
const applyKey = React37.useCallback(
|
|
5786
5709
|
(key) => {
|
|
5787
5710
|
if (isDisabled) return;
|
|
5788
5711
|
if (key.value === "backspace") {
|
|
@@ -5814,7 +5737,7 @@ function NumPad({
|
|
|
5814
5737
|
...allowsDecimal ? [{ value: "decimal", label: separator }] : [],
|
|
5815
5738
|
...extraKeys
|
|
5816
5739
|
];
|
|
5817
|
-
return /* @__PURE__ */
|
|
5740
|
+
return /* @__PURE__ */ jsxs66(
|
|
5818
5741
|
"div",
|
|
5819
5742
|
{
|
|
5820
5743
|
ref: containerRef,
|
|
@@ -5823,10 +5746,10 @@ function NumPad({
|
|
|
5823
5746
|
"data-size": size,
|
|
5824
5747
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
5825
5748
|
children: [
|
|
5826
|
-
target !== void 0 ? /* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5749
|
+
target !== void 0 ? /* @__PURE__ */ jsx78("div", { className: "pire-numpad-target", role: "status", "aria-live": "polite", children: target }) : null,
|
|
5750
|
+
/* @__PURE__ */ jsx78("div", { className: "pire-numpad-grid", role: "group", "aria-label": ariaLabel, children: keys.map((key) => {
|
|
5828
5751
|
const accessibleLabel = key.value === "backspace" ? msg.numPadBackspace : key.value === "clear" ? msg.numPadClear : key.value === "decimal" ? msg.numPadDecimal : void 0;
|
|
5829
|
-
return /* @__PURE__ */
|
|
5752
|
+
return /* @__PURE__ */ jsx78(
|
|
5830
5753
|
Button,
|
|
5831
5754
|
{
|
|
5832
5755
|
variant: "secondary",
|
|
@@ -5849,10 +5772,8 @@ function NumPad({
|
|
|
5849
5772
|
}
|
|
5850
5773
|
|
|
5851
5774
|
// src/components/patterns/FileDropZone.tsx
|
|
5852
|
-
import * as React36 from "react";
|
|
5853
5775
|
import { DropZone, FileTrigger as FileTrigger2, isFileDropItem } from "react-aria-components";
|
|
5854
|
-
import { jsx as
|
|
5855
|
-
var isImage2 = (file) => file.type.startsWith("image/");
|
|
5776
|
+
import { jsx as jsx79, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
5856
5777
|
function FileDropZone({
|
|
5857
5778
|
label,
|
|
5858
5779
|
value,
|
|
@@ -5879,36 +5800,27 @@ function FileDropZone({
|
|
|
5879
5800
|
...rest
|
|
5880
5801
|
}) {
|
|
5881
5802
|
const msg = usePireMessages();
|
|
5882
|
-
const
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
};
|
|
5894
|
-
const
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
5904
|
-
};
|
|
5905
|
-
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
5906
|
-
return /* @__PURE__ */ jsxs65("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
5907
|
-
label ? /* @__PURE__ */ jsxs65("span", { className: "pire-field-label", id: labelId, children: [
|
|
5908
|
-
label,
|
|
5909
|
-
isRequired ? /* @__PURE__ */ jsx76("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
5910
|
-
] }) : null,
|
|
5911
|
-
/* @__PURE__ */ jsxs65(
|
|
5803
|
+
const { files, accept, remove } = useFileList({
|
|
5804
|
+
value,
|
|
5805
|
+
defaultValue,
|
|
5806
|
+
onChange,
|
|
5807
|
+
acceptedFileTypes,
|
|
5808
|
+
allowsMultiple,
|
|
5809
|
+
maxSize,
|
|
5810
|
+
onError,
|
|
5811
|
+
showPreview,
|
|
5812
|
+
isDisabled,
|
|
5813
|
+
isReadOnly
|
|
5814
|
+
});
|
|
5815
|
+
const { labelId, hintId, errorId, describedBy } = useFileFieldIds({
|
|
5816
|
+
label,
|
|
5817
|
+
description,
|
|
5818
|
+
errorMessage,
|
|
5819
|
+
isInvalid
|
|
5820
|
+
});
|
|
5821
|
+
return /* @__PURE__ */ jsxs67("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
5822
|
+
/* @__PURE__ */ jsx79(FileFieldLabel, { id: labelId, label, isRequired }),
|
|
5823
|
+
/* @__PURE__ */ jsxs67(
|
|
5912
5824
|
DropZone,
|
|
5913
5825
|
{
|
|
5914
5826
|
className: "pire-dropzone",
|
|
@@ -5921,37 +5833,32 @@ function FileDropZone({
|
|
|
5921
5833
|
accept(dropped);
|
|
5922
5834
|
},
|
|
5923
5835
|
children: [
|
|
5924
|
-
/* @__PURE__ */
|
|
5925
|
-
/* @__PURE__ */
|
|
5926
|
-
/* @__PURE__ */
|
|
5836
|
+
/* @__PURE__ */ jsx79(Icon, { name: "download", size: 24, className: "pire-dropzone-icon" }),
|
|
5837
|
+
/* @__PURE__ */ jsx79("span", { className: "pire-dropzone-prompt", children: promptLabel ?? msg.fileDropZonePrompt }),
|
|
5838
|
+
/* @__PURE__ */ jsx79(
|
|
5927
5839
|
FileTrigger2,
|
|
5928
5840
|
{
|
|
5929
5841
|
acceptedFileTypes,
|
|
5930
5842
|
allowsMultiple,
|
|
5931
5843
|
onSelect: (list) => accept(list ? [...list] : []),
|
|
5932
|
-
children: /* @__PURE__ */
|
|
5844
|
+
children: /* @__PURE__ */ jsx79(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, "aria-describedby": describedBy, children: msg.fileUploadChoose })
|
|
5933
5845
|
}
|
|
5934
5846
|
)
|
|
5935
5847
|
]
|
|
5936
5848
|
}
|
|
5937
5849
|
),
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
)
|
|
5951
|
-
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
5952
|
-
uploadProgress != null ? /* @__PURE__ */ jsx76(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
5953
|
-
description ? /* @__PURE__ */ jsx76("span", { className: "pire-field-hint", id: hintId, children: description }) : null,
|
|
5954
|
-
errorId ? /* @__PURE__ */ jsx76("span", { className: "pire-field-error", id: errorId, children: errorMessage }) : null
|
|
5850
|
+
/* @__PURE__ */ jsx79(
|
|
5851
|
+
FileFieldFooter,
|
|
5852
|
+
{
|
|
5853
|
+
files,
|
|
5854
|
+
onRemove: isDisabled || isReadOnly ? void 0 : remove,
|
|
5855
|
+
uploadProgress,
|
|
5856
|
+
description,
|
|
5857
|
+
errorMessage,
|
|
5858
|
+
hintId,
|
|
5859
|
+
errorId
|
|
5860
|
+
}
|
|
5861
|
+
)
|
|
5955
5862
|
] });
|
|
5956
5863
|
}
|
|
5957
5864
|
|
|
@@ -5960,7 +5867,7 @@ import {
|
|
|
5960
5867
|
DialogTrigger as DialogTrigger2,
|
|
5961
5868
|
MenuTrigger as MenuTrigger4,
|
|
5962
5869
|
SubmenuTrigger,
|
|
5963
|
-
Popover as
|
|
5870
|
+
Popover as Popover9,
|
|
5964
5871
|
RouterProvider,
|
|
5965
5872
|
I18nProvider
|
|
5966
5873
|
} from "react-aria-components";
|
|
@@ -6023,7 +5930,7 @@ export {
|
|
|
6023
5930
|
PageHeader,
|
|
6024
5931
|
Pagination,
|
|
6025
5932
|
PireIntlProvider,
|
|
6026
|
-
|
|
5933
|
+
Popover9 as Popover,
|
|
6027
5934
|
ProgressBar,
|
|
6028
5935
|
QuantityStepper,
|
|
6029
5936
|
Radio,
|