@orianatech/pire 1.5.0 → 2.0.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/forms/ChoiceCardGroup.d.cts +11 -1
- package/dist/components/forms/ChoiceCardGroup.d.ts +11 -1
- package/dist/components/forms/ChoiceCardGroup.d.ts.map +1 -1
- package/dist/components/forms/ComboBox.d.cts +11 -1
- package/dist/components/forms/ComboBox.d.ts +11 -1
- package/dist/components/forms/ComboBox.d.ts.map +1 -1
- package/dist/components/forms/DatePicker.d.cts +11 -1
- package/dist/components/forms/DatePicker.d.ts +11 -1
- package/dist/components/forms/DatePicker.d.ts.map +1 -1
- package/dist/components/forms/DateRangePicker.d.cts +11 -1
- package/dist/components/forms/DateRangePicker.d.ts +11 -1
- package/dist/components/forms/DateRangePicker.d.ts.map +1 -1
- package/dist/components/forms/FieldDescription.d.cts +16 -0
- package/dist/components/forms/FieldDescription.d.ts +17 -0
- package/dist/components/forms/FieldDescription.d.ts.map +1 -0
- package/dist/components/forms/FieldHelp.d.cts +19 -0
- package/dist/components/forms/FieldHelp.d.ts +20 -0
- package/dist/components/forms/FieldHelp.d.ts.map +1 -0
- package/dist/components/forms/FieldLabel.d.cts +36 -0
- package/dist/components/forms/FieldLabel.d.ts +37 -0
- package/dist/components/forms/FieldLabel.d.ts.map +1 -0
- package/dist/components/forms/FormField.d.cts +10 -1
- package/dist/components/forms/FormField.d.ts +10 -1
- package/dist/components/forms/FormField.d.ts.map +1 -1
- package/dist/components/forms/Input.d.cts +11 -1
- package/dist/components/forms/Input.d.ts +11 -1
- package/dist/components/forms/Input.d.ts.map +1 -1
- package/dist/components/forms/MultiComboBox.d.cts +11 -1
- package/dist/components/forms/MultiComboBox.d.ts +11 -1
- package/dist/components/forms/MultiComboBox.d.ts.map +1 -1
- package/dist/components/forms/NumberField.d.cts +11 -1
- package/dist/components/forms/NumberField.d.ts +11 -1
- package/dist/components/forms/NumberField.d.ts.map +1 -1
- package/dist/components/forms/Select.d.cts +38 -4
- package/dist/components/forms/Select.d.ts +38 -4
- package/dist/components/forms/Select.d.ts.map +1 -1
- package/dist/components/forms/TextArea.d.cts +11 -1
- package/dist/components/forms/TextArea.d.ts +11 -1
- package/dist/components/forms/TextArea.d.ts.map +1 -1
- package/dist/components/patterns/NumPad.d.cts +19 -2
- package/dist/components/patterns/NumPad.d.ts +19 -2
- package/dist/components/patterns/NumPad.d.ts.map +1 -1
- package/dist/components/utils/decimalSeparator.d.cts +9 -0
- package/dist/components/utils/decimalSeparator.d.ts +10 -0
- package/dist/components/utils/decimalSeparator.d.ts.map +1 -0
- package/dist/components/utils/devWarn.d.cts +9 -0
- package/dist/components/utils/devWarn.d.ts +10 -0
- package/dist/components/utils/devWarn.d.ts.map +1 -0
- package/dist/components.css +19 -0
- package/dist/i18n/messages.d.cts +16 -1
- package/dist/i18n/messages.d.ts +16 -1
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +988 -845
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +874 -752
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,17 +52,18 @@ __export(src_exports, {
|
|
|
52
52
|
DialogBody: () => DialogBody,
|
|
53
53
|
DialogDescription: () => DialogDescription,
|
|
54
54
|
DialogTitle: () => DialogTitle,
|
|
55
|
-
DialogTrigger: () =>
|
|
55
|
+
DialogTrigger: () => import_react_aria_components43.DialogTrigger,
|
|
56
56
|
DonutChart: () => DonutChart,
|
|
57
57
|
EmptyState: () => EmptyState,
|
|
58
|
+
FieldHelp: () => FieldHelp,
|
|
58
59
|
FileDropZone: () => FileDropZone,
|
|
59
60
|
FileUpload: () => FileUpload,
|
|
60
61
|
FilterBar: () => FilterBar,
|
|
61
|
-
Focusable: () =>
|
|
62
|
+
Focusable: () => import_react_aria_components44.Focusable,
|
|
62
63
|
FooterBar: () => FooterBar,
|
|
63
64
|
FormField: () => FormField,
|
|
64
65
|
Heading: () => Heading,
|
|
65
|
-
I18nProvider: () =>
|
|
66
|
+
I18nProvider: () => import_react_aria_components43.I18nProvider,
|
|
66
67
|
ICON_NAMES: () => ICON_NAMES,
|
|
67
68
|
Icon: () => Icon,
|
|
68
69
|
IconButton: () => IconButton,
|
|
@@ -77,7 +78,7 @@ __export(src_exports, {
|
|
|
77
78
|
MenuItem: () => MenuItem,
|
|
78
79
|
MenuSection: () => MenuSection,
|
|
79
80
|
MenuSeparator: () => MenuSeparator,
|
|
80
|
-
MenuTrigger: () =>
|
|
81
|
+
MenuTrigger: () => import_react_aria_components43.MenuTrigger,
|
|
81
82
|
MultiComboBox: () => MultiComboBox,
|
|
82
83
|
NumPad: () => NumPad,
|
|
83
84
|
NumberField: () => NumberField,
|
|
@@ -86,14 +87,14 @@ __export(src_exports, {
|
|
|
86
87
|
PageHeader: () => PageHeader,
|
|
87
88
|
Pagination: () => Pagination,
|
|
88
89
|
PireIntlProvider: () => PireIntlProvider,
|
|
89
|
-
Popover: () =>
|
|
90
|
+
Popover: () => import_react_aria_components43.Popover,
|
|
90
91
|
ProgressBar: () => ProgressBar,
|
|
91
92
|
QuantityStepper: () => QuantityStepper,
|
|
92
93
|
Radio: () => Radio,
|
|
93
94
|
RadioGroup: () => RadioGroup,
|
|
94
95
|
RecordCard: () => RecordCard,
|
|
95
96
|
Ribbon: () => Ribbon,
|
|
96
|
-
RouterProvider: () =>
|
|
97
|
+
RouterProvider: () => import_react_aria_components43.RouterProvider,
|
|
97
98
|
SectionHeader: () => SectionHeader,
|
|
98
99
|
SegmentedControl: () => SegmentedControl,
|
|
99
100
|
Select: () => Select,
|
|
@@ -107,7 +108,7 @@ __export(src_exports, {
|
|
|
107
108
|
SkeletonTableRow: () => SkeletonTableRow,
|
|
108
109
|
SplitPane: () => SplitPane,
|
|
109
110
|
Strong: () => Strong,
|
|
110
|
-
SubmenuTrigger: () =>
|
|
111
|
+
SubmenuTrigger: () => import_react_aria_components43.SubmenuTrigger,
|
|
111
112
|
Switch: () => Switch,
|
|
112
113
|
Tabs: () => Tabs,
|
|
113
114
|
Tag: () => Tag,
|
|
@@ -665,6 +666,7 @@ var enMessages = {
|
|
|
665
666
|
inlineMessageDismiss: "Dismiss message",
|
|
666
667
|
toastDismiss: "Dismiss",
|
|
667
668
|
toastRegionLabel: "Notifications",
|
|
669
|
+
selectPlaceholder: "Select\u2026",
|
|
668
670
|
selectEmpty: "No options available",
|
|
669
671
|
comboBoxShowSuggestions: "Show suggestions",
|
|
670
672
|
comboBoxLoading: "Searching\u2026",
|
|
@@ -675,6 +677,8 @@ var enMessages = {
|
|
|
675
677
|
numberFieldIncrease: "Increase",
|
|
676
678
|
numberFieldDecrease: "Decrease",
|
|
677
679
|
inputClear: "Clear",
|
|
680
|
+
fieldHelp: "More information",
|
|
681
|
+
fieldHelpNamed: "More information about {label}",
|
|
678
682
|
valueHelpFieldPlaceholder: "Not selected",
|
|
679
683
|
valueHelpFieldClear: "Clear selection",
|
|
680
684
|
valueHelpFieldOpenNamed: "Select {label}",
|
|
@@ -718,6 +722,7 @@ var enMessages = {
|
|
|
718
722
|
chartEmpty: "No data for this period",
|
|
719
723
|
numPadClear: "Clear",
|
|
720
724
|
numPadBackspace: "Remove last digit",
|
|
725
|
+
numPadDecimal: "Decimal separator",
|
|
721
726
|
viewSwitcherName: "Saved views: {view}",
|
|
722
727
|
viewSwitcherNameModified: "Saved views: {view}, modified",
|
|
723
728
|
viewSwitcherModifiedMark: "\xB7 modified",
|
|
@@ -749,6 +754,7 @@ var esMessages = {
|
|
|
749
754
|
inlineMessageDismiss: "Descartar mensaje",
|
|
750
755
|
toastDismiss: "Descartar",
|
|
751
756
|
toastRegionLabel: "Notificaciones",
|
|
757
|
+
selectPlaceholder: "Seleccionar\u2026",
|
|
752
758
|
selectEmpty: "Sin opciones disponibles",
|
|
753
759
|
comboBoxShowSuggestions: "Mostrar sugerencias",
|
|
754
760
|
comboBoxLoading: "Buscando\u2026",
|
|
@@ -759,6 +765,8 @@ var esMessages = {
|
|
|
759
765
|
numberFieldIncrease: "Aumentar",
|
|
760
766
|
numberFieldDecrease: "Disminuir",
|
|
761
767
|
inputClear: "Limpiar",
|
|
768
|
+
fieldHelp: "M\xE1s informaci\xF3n",
|
|
769
|
+
fieldHelpNamed: "M\xE1s informaci\xF3n sobre {label}",
|
|
762
770
|
valueHelpFieldPlaceholder: "Sin seleccionar",
|
|
763
771
|
valueHelpFieldClear: "Limpiar selecci\xF3n",
|
|
764
772
|
valueHelpFieldOpenNamed: "Seleccionar {label}",
|
|
@@ -802,6 +810,7 @@ var esMessages = {
|
|
|
802
810
|
chartEmpty: "Sin datos para este per\xEDodo",
|
|
803
811
|
numPadClear: "Limpiar",
|
|
804
812
|
numPadBackspace: "Borrar \xFAltimo d\xEDgito",
|
|
813
|
+
numPadDecimal: "Separador decimal",
|
|
805
814
|
viewSwitcherName: "Vistas guardadas: {view}",
|
|
806
815
|
viewSwitcherNameModified: "Vistas guardadas: {view}, modificada",
|
|
807
816
|
viewSwitcherModifiedMark: "\xB7 modificada",
|
|
@@ -1080,8 +1089,25 @@ function Kbd({ children, size = "md", className, ...rest }) {
|
|
|
1080
1089
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("kbd", { className: cx("pire-kbd", className), "data-size": size, ...rest, children });
|
|
1081
1090
|
}
|
|
1082
1091
|
|
|
1083
|
-
// src/components/forms/
|
|
1092
|
+
// src/components/forms/FieldHelp.tsx
|
|
1093
|
+
var import_react_aria_components9 = require("react-aria-components");
|
|
1084
1094
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1095
|
+
function FieldHelp({ children, label, placement = "top" }) {
|
|
1096
|
+
const msg = usePireMessages();
|
|
1097
|
+
return (
|
|
1098
|
+
// React Aria hands every descendant Button the nearest slotted ButtonContext. Inside a
|
|
1099
|
+
// NumberField that context has only `increment` and `decrement`, and an unslotted Button
|
|
1100
|
+
// throws `A slot prop is required`; inside DatePicker, DateRangePicker and ComboBox the same
|
|
1101
|
+
// Button is silently adopted as the field's *trigger*, which is worse than a crash because it
|
|
1102
|
+
// renders. `value={null}` is React Aria's own idiom for lifting a subtree back out of a
|
|
1103
|
+
// slotted context — the same one `MultiComboBox` and `FieldLabel` use — and is what makes
|
|
1104
|
+
// this component safe anywhere.
|
|
1105
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components9.ButtonContext.Provider, { value: null, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { label: children, placement, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconButton, { icon: "help-circle", label: label ?? msg.fieldHelp, size: "sm", hideTooltip: true }) }) })
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
// src/components/forms/FormField.tsx
|
|
1110
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1085
1111
|
function FormField({
|
|
1086
1112
|
label,
|
|
1087
1113
|
htmlFor,
|
|
@@ -1089,26 +1115,31 @@ function FormField({
|
|
|
1089
1115
|
hint,
|
|
1090
1116
|
error,
|
|
1091
1117
|
layout = "stacked",
|
|
1118
|
+
help,
|
|
1092
1119
|
children,
|
|
1093
1120
|
className,
|
|
1094
1121
|
...rest
|
|
1095
1122
|
}) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1123
|
+
const labelEl = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "pire-field-label", htmlFor, children: [
|
|
1124
|
+
label,
|
|
1125
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1126
|
+
] });
|
|
1127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cx("pire-field", className), "data-layout": layout, ...rest, children: [
|
|
1128
|
+
help ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "pire-field-labelrow", children: [
|
|
1129
|
+
labelEl,
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FieldHelp, { children: help })
|
|
1131
|
+
] }) : labelEl,
|
|
1101
1132
|
children,
|
|
1102
|
-
error ? /* @__PURE__ */ (0,
|
|
1103
|
-
/* @__PURE__ */ (0,
|
|
1133
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "pire-field-error", role: "alert", children: [
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { name: "alert-circle", size: 12 }),
|
|
1104
1135
|
error
|
|
1105
|
-
] }) : hint ? /* @__PURE__ */ (0,
|
|
1136
|
+
] }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pire-field-hint", children: hint }) : null
|
|
1106
1137
|
] });
|
|
1107
1138
|
}
|
|
1108
1139
|
|
|
1109
1140
|
// src/components/forms/Input.tsx
|
|
1110
1141
|
var React10 = __toESM(require("react"), 1);
|
|
1111
|
-
var
|
|
1142
|
+
var import_react_aria_components12 = require("react-aria-components");
|
|
1112
1143
|
|
|
1113
1144
|
// src/components/utils/focusField.ts
|
|
1114
1145
|
function focusFieldOf(button) {
|
|
@@ -1116,13 +1147,75 @@ function focusFieldOf(button) {
|
|
|
1116
1147
|
control?.querySelector(".pire-datesegment, .pire-input, input, textarea")?.focus();
|
|
1117
1148
|
}
|
|
1118
1149
|
|
|
1150
|
+
// src/components/forms/FieldLabel.tsx
|
|
1151
|
+
var import_react_aria_components10 = require("react-aria-components");
|
|
1152
|
+
|
|
1153
|
+
// src/components/utils/devWarn.ts
|
|
1154
|
+
var IS_DEV2 = process.env.NODE_ENV !== "production";
|
|
1155
|
+
var warned2 = /* @__PURE__ */ new Set();
|
|
1156
|
+
function warnOnce2(key, message) {
|
|
1157
|
+
if (warned2.has(key)) return;
|
|
1158
|
+
warned2.add(key);
|
|
1159
|
+
console.warn(`[pire] ${message}`);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
// src/components/forms/FieldLabel.tsx
|
|
1163
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1164
|
+
function warnHelpWithoutLabel(component, label, help) {
|
|
1165
|
+
if (!IS_DEV2 || !help || label) return;
|
|
1166
|
+
warnOnce2(
|
|
1167
|
+
`help-without-label:${component}`,
|
|
1168
|
+
`${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\`.`
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
function FieldLabel({ label, isRequired, help }) {
|
|
1172
|
+
const msg = usePireMessages();
|
|
1173
|
+
const text = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_aria_components10.Label, { className: "pire-field-label", children: [
|
|
1174
|
+
label,
|
|
1175
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1176
|
+
] });
|
|
1177
|
+
return (
|
|
1178
|
+
// React Aria's own idiom for lifting a subtree back out of a slotted context — the same one
|
|
1179
|
+
// `MultiComboBox` uses on its chips, and the one Popover uses on the way into an overlay.
|
|
1180
|
+
// Without it every Button below a field inherits that field's trigger props.
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_aria_components10.ButtonContext.Provider, { value: null, children: help ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "pire-field-labelrow", children: [
|
|
1182
|
+
text,
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1184
|
+
FieldHelp,
|
|
1185
|
+
{
|
|
1186
|
+
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
1187
|
+
children: help
|
|
1188
|
+
}
|
|
1189
|
+
)
|
|
1190
|
+
] }) : text })
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
// src/components/forms/FieldDescription.tsx
|
|
1195
|
+
var import_react_aria_components11 = require("react-aria-components");
|
|
1196
|
+
var import_jsx_runtime19 = (
|
|
1197
|
+
// The class is picked, never combined: `.pire-sr-only` is `!important` and pairing it with
|
|
1198
|
+
// another pire-* class is what grew the document sideways in 0.23.0. Choosing `pire-sr-only`
|
|
1199
|
+
// when there is no visible description also keeps the node out of `.pire-field`'s flex gap —
|
|
1200
|
+
// a `pire-field-hint` holding only hidden text still opens a visible gap under every field.
|
|
1201
|
+
require("react/jsx-runtime")
|
|
1202
|
+
);
|
|
1203
|
+
function FieldDescription({ description, help }) {
|
|
1204
|
+
if (!description && !help) return null;
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_aria_components11.Text, { slot: "description", className: description ? "pire-field-hint" : "pire-sr-only", children: [
|
|
1206
|
+
description,
|
|
1207
|
+
help ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pire-sr-only", children: help }) : null
|
|
1208
|
+
] });
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1119
1211
|
// src/components/forms/Input.tsx
|
|
1120
|
-
var
|
|
1212
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1121
1213
|
function Input({
|
|
1122
1214
|
label,
|
|
1123
1215
|
icon,
|
|
1124
1216
|
suffix,
|
|
1125
1217
|
description,
|
|
1218
|
+
help,
|
|
1126
1219
|
errorMessage,
|
|
1127
1220
|
size = "md",
|
|
1128
1221
|
numeric,
|
|
@@ -1146,8 +1239,9 @@ function Input({
|
|
|
1146
1239
|
const takesOverValue = isClearable && !isControlled;
|
|
1147
1240
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : {};
|
|
1148
1241
|
const showsClear = isClearable && currentValue !== "" && !rest.isDisabled && !rest.isReadOnly;
|
|
1149
|
-
|
|
1150
|
-
|
|
1242
|
+
warnHelpWithoutLabel("Input", label, help);
|
|
1243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1244
|
+
import_react_aria_components12.TextField,
|
|
1151
1245
|
{
|
|
1152
1246
|
className: cx("pire-field", className),
|
|
1153
1247
|
style,
|
|
@@ -1156,12 +1250,9 @@ function Input({
|
|
|
1156
1250
|
...rest,
|
|
1157
1251
|
...valueProps,
|
|
1158
1252
|
children: [
|
|
1159
|
-
label ? /* @__PURE__ */ (0,
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
] }) : null,
|
|
1163
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1164
|
-
import_react_aria_components9.Group,
|
|
1253
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1255
|
+
import_react_aria_components12.Group,
|
|
1165
1256
|
{
|
|
1166
1257
|
className: "pire-control",
|
|
1167
1258
|
"data-size": size,
|
|
@@ -1169,10 +1260,10 @@ function Input({
|
|
|
1169
1260
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1170
1261
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1171
1262
|
children: [
|
|
1172
|
-
icon ? /* @__PURE__ */ (0,
|
|
1173
|
-
/* @__PURE__ */ (0,
|
|
1174
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
1175
|
-
|
|
1263
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { name: icon, size: 16, className: "pire-leading-icon" }) : null,
|
|
1264
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_aria_components12.Input, { ref: inputRef, className: "pire-input", "data-numeric": numeric ? "true" : void 0 }),
|
|
1265
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1266
|
+
import_react_aria_components12.Button,
|
|
1176
1267
|
{
|
|
1177
1268
|
className: "pire-input-clear",
|
|
1178
1269
|
onPress: (event) => {
|
|
@@ -1182,12 +1273,12 @@ function Input({
|
|
|
1182
1273
|
children: clearLabel ?? msg.inputClear
|
|
1183
1274
|
}
|
|
1184
1275
|
) : null,
|
|
1185
|
-
suffix ? /* @__PURE__ */ (0,
|
|
1276
|
+
suffix ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "pire-affix", children: suffix }) : null
|
|
1186
1277
|
]
|
|
1187
1278
|
}
|
|
1188
1279
|
),
|
|
1189
|
-
|
|
1190
|
-
/* @__PURE__ */ (0,
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FieldDescription, { description, help }),
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_aria_components12.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1191
1282
|
]
|
|
1192
1283
|
}
|
|
1193
1284
|
);
|
|
@@ -1195,12 +1286,13 @@ function Input({
|
|
|
1195
1286
|
|
|
1196
1287
|
// src/components/forms/TextArea.tsx
|
|
1197
1288
|
var React11 = __toESM(require("react"), 1);
|
|
1198
|
-
var
|
|
1199
|
-
var
|
|
1289
|
+
var import_react_aria_components13 = require("react-aria-components");
|
|
1290
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1200
1291
|
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React11.useEffect : React11.useLayoutEffect;
|
|
1201
1292
|
function TextArea({
|
|
1202
1293
|
label,
|
|
1203
1294
|
description,
|
|
1295
|
+
help,
|
|
1204
1296
|
errorMessage,
|
|
1205
1297
|
size = "md",
|
|
1206
1298
|
rows = 3,
|
|
@@ -1240,8 +1332,9 @@ function TextArea({
|
|
|
1240
1332
|
}
|
|
1241
1333
|
grow();
|
|
1242
1334
|
}, [autoGrow, grow, rest.value]);
|
|
1243
|
-
|
|
1244
|
-
|
|
1335
|
+
warnHelpWithoutLabel("TextArea", label, help);
|
|
1336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1337
|
+
import_react_aria_components13.TextField,
|
|
1245
1338
|
{
|
|
1246
1339
|
className: cx("pire-field", className),
|
|
1247
1340
|
style,
|
|
@@ -1249,12 +1342,9 @@ function TextArea({
|
|
|
1249
1342
|
validationBehavior: "aria",
|
|
1250
1343
|
...rest,
|
|
1251
1344
|
children: [
|
|
1252
|
-
label ? /* @__PURE__ */ (0,
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
] }) : null,
|
|
1256
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1257
|
-
import_react_aria_components10.Group,
|
|
1345
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1347
|
+
import_react_aria_components13.Group,
|
|
1258
1348
|
{
|
|
1259
1349
|
className: "pire-control",
|
|
1260
1350
|
"data-size": size,
|
|
@@ -1262,8 +1352,8 @@ function TextArea({
|
|
|
1262
1352
|
"data-multiline": "true",
|
|
1263
1353
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1264
1354
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1265
|
-
children: /* @__PURE__ */ (0,
|
|
1266
|
-
|
|
1355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1356
|
+
import_react_aria_components13.TextArea,
|
|
1267
1357
|
{
|
|
1268
1358
|
ref,
|
|
1269
1359
|
rows,
|
|
@@ -1274,16 +1364,18 @@ function TextArea({
|
|
|
1274
1364
|
)
|
|
1275
1365
|
}
|
|
1276
1366
|
),
|
|
1277
|
-
|
|
1278
|
-
/* @__PURE__ */ (0,
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FieldDescription, { description, help }),
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_aria_components13.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1279
1369
|
]
|
|
1280
1370
|
}
|
|
1281
1371
|
);
|
|
1282
1372
|
}
|
|
1283
1373
|
|
|
1284
1374
|
// src/components/forms/Select.tsx
|
|
1285
|
-
var
|
|
1286
|
-
var
|
|
1375
|
+
var React12 = __toESM(require("react"), 1);
|
|
1376
|
+
var import_react_aria_components14 = require("react-aria-components");
|
|
1377
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1378
|
+
var CLEAR_KEY = "__pire-select-clear__";
|
|
1287
1379
|
var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
|
|
1288
1380
|
function Select({
|
|
1289
1381
|
label,
|
|
@@ -1291,8 +1383,10 @@ function Select({
|
|
|
1291
1383
|
defaultValue,
|
|
1292
1384
|
onChange,
|
|
1293
1385
|
options = [],
|
|
1294
|
-
placeholder
|
|
1386
|
+
placeholder,
|
|
1387
|
+
isClearable,
|
|
1295
1388
|
description,
|
|
1389
|
+
help,
|
|
1296
1390
|
errorMessage,
|
|
1297
1391
|
emptyLabel,
|
|
1298
1392
|
size = "md",
|
|
@@ -1303,51 +1397,74 @@ function Select({
|
|
|
1303
1397
|
}) {
|
|
1304
1398
|
const msg = usePireMessages();
|
|
1305
1399
|
const items = options.map(norm);
|
|
1306
|
-
|
|
1307
|
-
|
|
1400
|
+
const effectivePlaceholder = placeholder ?? msg.selectPlaceholder;
|
|
1401
|
+
const isSelectionControlled = value !== void 0;
|
|
1402
|
+
const [ownSelection, setOwnSelection] = React12.useState(defaultValue ?? null);
|
|
1403
|
+
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1404
|
+
const collides = items.some((item) => item.value === CLEAR_KEY);
|
|
1405
|
+
const showsClear = isClearable === true && !rest.isDisabled && items.length > 0 && !collides;
|
|
1406
|
+
if (IS_DEV2 && isClearable === true && !rest.isDisabled && collides) {
|
|
1407
|
+
warnOnce2(
|
|
1408
|
+
CLEAR_KEY,
|
|
1409
|
+
`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.`
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
const rows = showsClear ? [
|
|
1413
|
+
// The row's own label falls back to the dictionary even when `placeholder` is explicitly
|
|
1414
|
+
// `''`: an empty trigger is a deliberate, supported shape, but a listbox option with no
|
|
1415
|
+
// accessible name is not — it would be unreachable by name and silent to a screen reader.
|
|
1416
|
+
{ value: CLEAR_KEY, label: effectivePlaceholder || msg.selectPlaceholder, isDisabled: false },
|
|
1417
|
+
...items
|
|
1418
|
+
] : items;
|
|
1419
|
+
warnHelpWithoutLabel("Select", label, help);
|
|
1420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1421
|
+
import_react_aria_components14.Select,
|
|
1308
1422
|
{
|
|
1309
1423
|
className: cx("pire-field", className),
|
|
1310
1424
|
style,
|
|
1311
|
-
selectedKey: value,
|
|
1312
|
-
defaultSelectedKey: defaultValue,
|
|
1313
|
-
onSelectionChange: (k) =>
|
|
1425
|
+
selectedKey: takesOverSelection ? ownSelection : value,
|
|
1426
|
+
defaultSelectedKey: takesOverSelection ? void 0 : defaultValue,
|
|
1427
|
+
onSelectionChange: (k) => {
|
|
1428
|
+
const raw = k == null ? null : String(k);
|
|
1429
|
+
const next = showsClear && raw === CLEAR_KEY ? null : raw;
|
|
1430
|
+
if (takesOverSelection) setOwnSelection(next);
|
|
1431
|
+
onChange?.(next);
|
|
1432
|
+
},
|
|
1314
1433
|
allowsEmptyCollection: true,
|
|
1315
|
-
placeholder,
|
|
1434
|
+
placeholder: effectivePlaceholder,
|
|
1316
1435
|
validationBehavior: "aria",
|
|
1317
1436
|
...rest,
|
|
1318
1437
|
children: [
|
|
1319
|
-
label ? /* @__PURE__ */ (0,
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
] }) : null,
|
|
1323
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1324
|
-
import_react_aria_components11.Button,
|
|
1438
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1440
|
+
import_react_aria_components14.Button,
|
|
1325
1441
|
{
|
|
1326
1442
|
className: "pire-control",
|
|
1327
1443
|
"data-size": size,
|
|
1328
1444
|
"data-full-width": String(fullWidth),
|
|
1329
1445
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1330
1446
|
children: [
|
|
1331
|
-
/* @__PURE__ */ (0,
|
|
1332
|
-
/* @__PURE__ */ (0,
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_aria_components14.SelectValue, { className: "pire-select-value" }),
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "chevron-down", size: 16, className: "pire-leading-icon" })
|
|
1333
1449
|
]
|
|
1334
1450
|
}
|
|
1335
1451
|
),
|
|
1336
|
-
|
|
1337
|
-
/* @__PURE__ */ (0,
|
|
1338
|
-
/* @__PURE__ */ (0,
|
|
1339
|
-
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldDescription, { description, help }),
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_aria_components14.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_aria_components14.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1455
|
+
import_react_aria_components14.ListBox,
|
|
1340
1456
|
{
|
|
1341
1457
|
className: "pire-listbox",
|
|
1342
|
-
items,
|
|
1343
|
-
renderEmptyState: () => /* @__PURE__ */ (0,
|
|
1344
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
1345
|
-
|
|
1458
|
+
items: rows,
|
|
1459
|
+
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: emptyLabel ?? msg.selectEmpty }),
|
|
1460
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1461
|
+
import_react_aria_components14.ListBoxItem,
|
|
1346
1462
|
{
|
|
1347
1463
|
className: "pire-option",
|
|
1348
1464
|
id: item.value,
|
|
1349
1465
|
textValue: item.label,
|
|
1350
1466
|
isDisabled: item.isDisabled,
|
|
1467
|
+
"data-clear": item.value === CLEAR_KEY ? "true" : void 0,
|
|
1351
1468
|
children: item.label
|
|
1352
1469
|
}
|
|
1353
1470
|
)
|
|
@@ -1359,21 +1476,21 @@ function Select({
|
|
|
1359
1476
|
}
|
|
1360
1477
|
|
|
1361
1478
|
// src/components/forms/Checkbox.tsx
|
|
1362
|
-
var
|
|
1363
|
-
var
|
|
1479
|
+
var import_react_aria_components15 = require("react-aria-components");
|
|
1480
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1364
1481
|
function Checkbox({ label, hint, children, className, ...rest }) {
|
|
1365
|
-
return /* @__PURE__ */ (0,
|
|
1366
|
-
/* @__PURE__ */ (0,
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_aria_components15.Checkbox, { className: cx("pire-choice", className), ...rest, children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "pire-choice-box", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "minus", size: 12 }) : isSelected ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "check", size: 12 }) : null }),
|
|
1484
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
1368
1485
|
label ?? children,
|
|
1369
|
-
hint ? /* @__PURE__ */ (0,
|
|
1486
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1370
1487
|
] })
|
|
1371
1488
|
] }) });
|
|
1372
1489
|
}
|
|
1373
1490
|
|
|
1374
1491
|
// src/components/forms/Radio.tsx
|
|
1375
|
-
var
|
|
1376
|
-
var
|
|
1492
|
+
var import_react_aria_components16 = require("react-aria-components");
|
|
1493
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1377
1494
|
function RadioGroup({
|
|
1378
1495
|
label,
|
|
1379
1496
|
description,
|
|
@@ -1382,39 +1499,40 @@ function RadioGroup({
|
|
|
1382
1499
|
className,
|
|
1383
1500
|
...rest
|
|
1384
1501
|
}) {
|
|
1385
|
-
return /* @__PURE__ */ (0,
|
|
1386
|
-
label ? /* @__PURE__ */ (0,
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1388
|
-
description ? /* @__PURE__ */ (0,
|
|
1389
|
-
/* @__PURE__ */ (0,
|
|
1502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_aria_components16.RadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
|
|
1503
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_aria_components16.Label, { className: "pire-field-label", children: label }) : null,
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pire-radiogroup", children }),
|
|
1505
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_aria_components16.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_aria_components16.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1390
1507
|
] });
|
|
1391
1508
|
}
|
|
1392
1509
|
function Radio({ label, hint, children, className, ...rest }) {
|
|
1393
|
-
return /* @__PURE__ */ (0,
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_aria_components16.Radio, { className: cx("pire-choice", className), ...rest, children: [
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pire-choice-box", "data-radio": "true", "aria-hidden": "true" }),
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
|
|
1396
1513
|
label ?? children,
|
|
1397
|
-
hint ? /* @__PURE__ */ (0,
|
|
1514
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1398
1515
|
] })
|
|
1399
1516
|
] });
|
|
1400
1517
|
}
|
|
1401
1518
|
|
|
1402
1519
|
// src/components/forms/Switch.tsx
|
|
1403
|
-
var
|
|
1404
|
-
var
|
|
1520
|
+
var import_react_aria_components17 = require("react-aria-components");
|
|
1521
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1405
1522
|
function Switch({ label, children, className, ...rest }) {
|
|
1406
|
-
return /* @__PURE__ */ (0,
|
|
1407
|
-
/* @__PURE__ */ (0,
|
|
1408
|
-
/* @__PURE__ */ (0,
|
|
1523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react_aria_components17.Switch, { className: cx("pire-choice", className), ...rest, children: [
|
|
1524
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "pire-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "pire-switch-thumb" }) }),
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: label ?? children })
|
|
1409
1526
|
] });
|
|
1410
1527
|
}
|
|
1411
1528
|
|
|
1412
1529
|
// src/components/forms/ChoiceCardGroup.tsx
|
|
1413
|
-
var
|
|
1414
|
-
var
|
|
1530
|
+
var import_react_aria_components18 = require("react-aria-components");
|
|
1531
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1415
1532
|
function ChoiceCardGroup({
|
|
1416
1533
|
label,
|
|
1417
1534
|
description,
|
|
1535
|
+
help,
|
|
1418
1536
|
errorMessage,
|
|
1419
1537
|
options,
|
|
1420
1538
|
value,
|
|
@@ -1427,8 +1545,9 @@ function ChoiceCardGroup({
|
|
|
1427
1545
|
style,
|
|
1428
1546
|
...rest
|
|
1429
1547
|
}) {
|
|
1430
|
-
|
|
1431
|
-
|
|
1548
|
+
warnHelpWithoutLabel("ChoiceCardGroup", label, help);
|
|
1549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1550
|
+
import_react_aria_components18.RadioGroup,
|
|
1432
1551
|
{
|
|
1433
1552
|
className: cx("pire-field", className),
|
|
1434
1553
|
style,
|
|
@@ -1440,36 +1559,33 @@ function ChoiceCardGroup({
|
|
|
1440
1559
|
isDisabled,
|
|
1441
1560
|
isRequired,
|
|
1442
1561
|
children: [
|
|
1443
|
-
label ? /* @__PURE__ */ (0,
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
] }) : null,
|
|
1447
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "pire-choicecards", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1448
|
-
import_react_aria_components15.Radio,
|
|
1562
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldLabel, { label, isRequired, help }) : null,
|
|
1563
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pire-choicecards", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1564
|
+
import_react_aria_components18.Radio,
|
|
1449
1565
|
{
|
|
1450
1566
|
value: option.id,
|
|
1451
1567
|
className: "pire-choicecard",
|
|
1452
1568
|
isDisabled: option.isDisabled,
|
|
1453
1569
|
children: [
|
|
1454
|
-
option.icon ? /* @__PURE__ */ (0,
|
|
1455
|
-
/* @__PURE__ */ (0,
|
|
1456
|
-
option.description ? /* @__PURE__ */ (0,
|
|
1457
|
-
option.preview ? /* @__PURE__ */ (0,
|
|
1570
|
+
option.icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Icon, { name: option.icon, size: 20 }) : null,
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pire-choicecard-label", children: option.label }),
|
|
1572
|
+
option.description ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pire-choicecard-desc", children: option.description }) : null,
|
|
1573
|
+
option.preview ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "pire-choicecard-preview", "aria-hidden": "true", children: option.preview }) : null
|
|
1458
1574
|
]
|
|
1459
1575
|
},
|
|
1460
1576
|
option.id
|
|
1461
1577
|
)) }),
|
|
1462
|
-
|
|
1463
|
-
/* @__PURE__ */ (0,
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FieldDescription, { description, help }),
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_aria_components18.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1464
1580
|
]
|
|
1465
1581
|
}
|
|
1466
1582
|
);
|
|
1467
1583
|
}
|
|
1468
1584
|
|
|
1469
1585
|
// src/components/forms/ComboBox.tsx
|
|
1470
|
-
var
|
|
1471
|
-
var
|
|
1472
|
-
var
|
|
1586
|
+
var React13 = __toESM(require("react"), 1);
|
|
1587
|
+
var import_react_aria_components19 = require("react-aria-components");
|
|
1588
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1473
1589
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1474
1590
|
function ComboBox({
|
|
1475
1591
|
label,
|
|
@@ -1480,6 +1596,7 @@ function ComboBox({
|
|
|
1480
1596
|
inputValue,
|
|
1481
1597
|
options = [],
|
|
1482
1598
|
description,
|
|
1599
|
+
help,
|
|
1483
1600
|
errorMessage,
|
|
1484
1601
|
size = "md",
|
|
1485
1602
|
fullWidth = true,
|
|
@@ -1497,10 +1614,10 @@ function ComboBox({
|
|
|
1497
1614
|
const msg = usePireMessages();
|
|
1498
1615
|
const items = options.map(norm2);
|
|
1499
1616
|
const isSelectionControlled = value !== void 0;
|
|
1500
|
-
const [ownSelection, setOwnSelection] =
|
|
1617
|
+
const [ownSelection, setOwnSelection] = React13.useState(defaultValue ?? null);
|
|
1501
1618
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1502
1619
|
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1503
|
-
const [typedText, setTypedText] =
|
|
1620
|
+
const [typedText, setTypedText] = React13.useState("");
|
|
1504
1621
|
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1505
1622
|
const handleInputChange = isClearable ? (text) => {
|
|
1506
1623
|
setTypedText(text);
|
|
@@ -1515,8 +1632,9 @@ function ComboBox({
|
|
|
1515
1632
|
};
|
|
1516
1633
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1517
1634
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1518
|
-
|
|
1519
|
-
|
|
1635
|
+
warnHelpWithoutLabel("ComboBox", label, help);
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1637
|
+
import_react_aria_components19.ComboBox,
|
|
1520
1638
|
{
|
|
1521
1639
|
className: cx("pire-field", className),
|
|
1522
1640
|
style,
|
|
@@ -1536,22 +1654,19 @@ function ComboBox({
|
|
|
1536
1654
|
validationBehavior: "aria",
|
|
1537
1655
|
...rest,
|
|
1538
1656
|
children: [
|
|
1539
|
-
label ? /* @__PURE__ */ (0,
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
] }) : null,
|
|
1543
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1544
|
-
import_react_aria_components16.Group,
|
|
1657
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1659
|
+
import_react_aria_components19.Group,
|
|
1545
1660
|
{
|
|
1546
1661
|
className: "pire-control",
|
|
1547
1662
|
"data-size": size,
|
|
1548
1663
|
"data-full-width": String(fullWidth),
|
|
1549
1664
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1550
1665
|
children: [
|
|
1551
|
-
/* @__PURE__ */ (0,
|
|
1552
|
-
/* @__PURE__ */ (0,
|
|
1553
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
1554
|
-
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_aria_components19.Input, { className: "pire-input", placeholder: rest.placeholder }),
|
|
1668
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1669
|
+
import_react_aria_components19.Button,
|
|
1555
1670
|
{
|
|
1556
1671
|
className: "pire-input-clear",
|
|
1557
1672
|
slot: null,
|
|
@@ -1562,40 +1677,40 @@ function ComboBox({
|
|
|
1562
1677
|
children: clearLabel ?? msg.inputClear
|
|
1563
1678
|
}
|
|
1564
1679
|
) : null,
|
|
1565
|
-
/* @__PURE__ */ (0,
|
|
1566
|
-
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1681
|
+
import_react_aria_components19.Button,
|
|
1567
1682
|
{
|
|
1568
1683
|
className: "pire-iconbtn",
|
|
1569
1684
|
"data-size": "sm",
|
|
1570
1685
|
"aria-label": msg.comboBoxShowSuggestions,
|
|
1571
1686
|
style: { width: 20, height: 20 },
|
|
1572
|
-
children: /* @__PURE__ */ (0,
|
|
1687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon, { name: "chevron-down", size: 16 })
|
|
1573
1688
|
}
|
|
1574
1689
|
)
|
|
1575
1690
|
]
|
|
1576
1691
|
}
|
|
1577
1692
|
),
|
|
1578
|
-
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1581
|
-
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldDescription, { description, help }),
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_aria_components19.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_aria_components19.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1696
|
+
import_react_aria_components19.ListBox,
|
|
1582
1697
|
{
|
|
1583
1698
|
className: "pire-listbox",
|
|
1584
1699
|
onScroll: onLoadMore ? (e) => {
|
|
1585
1700
|
const el = e.currentTarget;
|
|
1586
1701
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1587
1702
|
} : void 0,
|
|
1588
|
-
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0,
|
|
1589
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
1590
|
-
|
|
1703
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1704
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1705
|
+
import_react_aria_components19.ListBoxItem,
|
|
1591
1706
|
{
|
|
1592
1707
|
className: "pire-option",
|
|
1593
1708
|
id: item.value,
|
|
1594
1709
|
textValue: item.label,
|
|
1595
1710
|
isDisabled: item.isDisabled,
|
|
1596
1711
|
children: [
|
|
1597
|
-
/* @__PURE__ */ (0,
|
|
1598
|
-
item.secondary ? /* @__PURE__ */ (0,
|
|
1712
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pire-option-label", children: item.label }),
|
|
1713
|
+
item.secondary ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1599
1714
|
]
|
|
1600
1715
|
}
|
|
1601
1716
|
)
|
|
@@ -1607,9 +1722,9 @@ function ComboBox({
|
|
|
1607
1722
|
}
|
|
1608
1723
|
|
|
1609
1724
|
// src/components/forms/MultiComboBox.tsx
|
|
1610
|
-
var
|
|
1611
|
-
var
|
|
1612
|
-
var
|
|
1725
|
+
var React14 = __toESM(require("react"), 1);
|
|
1726
|
+
var import_react_aria_components20 = require("react-aria-components");
|
|
1727
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1613
1728
|
var norm3 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1614
1729
|
function MultiComboBox({
|
|
1615
1730
|
label,
|
|
@@ -1619,6 +1734,7 @@ function MultiComboBox({
|
|
|
1619
1734
|
onInputChange,
|
|
1620
1735
|
options = [],
|
|
1621
1736
|
description,
|
|
1737
|
+
help,
|
|
1622
1738
|
errorMessage,
|
|
1623
1739
|
allowsCustomValue,
|
|
1624
1740
|
size = "md",
|
|
@@ -1633,15 +1749,15 @@ function MultiComboBox({
|
|
|
1633
1749
|
...rest
|
|
1634
1750
|
}) {
|
|
1635
1751
|
const msg = usePireMessages();
|
|
1636
|
-
const items =
|
|
1752
|
+
const items = React14.useMemo(() => options.map(norm3), [options]);
|
|
1637
1753
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1638
1754
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1639
|
-
const [uncontrolled, setUncontrolled] =
|
|
1640
|
-
const [announcement, setAnnouncement] =
|
|
1641
|
-
const inputRef =
|
|
1755
|
+
const [uncontrolled, setUncontrolled] = React14.useState(defaultValue ?? []);
|
|
1756
|
+
const [announcement, setAnnouncement] = React14.useState("");
|
|
1757
|
+
const inputRef = React14.useRef(null);
|
|
1642
1758
|
const raw = value ?? uncontrolled;
|
|
1643
1759
|
const contentKey = raw.join("\0");
|
|
1644
|
-
const values =
|
|
1760
|
+
const values = React14.useMemo(() => raw, [contentKey]);
|
|
1645
1761
|
const labelOf = (v) => items.find((o) => o.value === v)?.label ?? v;
|
|
1646
1762
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1647
1763
|
const commit = (next) => {
|
|
@@ -1674,8 +1790,9 @@ function MultiComboBox({
|
|
|
1674
1790
|
e.stopPropagation();
|
|
1675
1791
|
if (!values.includes(next)) commit([...values, next]);
|
|
1676
1792
|
};
|
|
1677
|
-
|
|
1678
|
-
|
|
1793
|
+
warnHelpWithoutLabel("MultiComboBox", label, help);
|
|
1794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1795
|
+
import_react_aria_components20.ComboBox,
|
|
1679
1796
|
{
|
|
1680
1797
|
className: cx("pire-field", className),
|
|
1681
1798
|
style,
|
|
@@ -1691,12 +1808,9 @@ function MultiComboBox({
|
|
|
1691
1808
|
validationBehavior: "aria",
|
|
1692
1809
|
...rest,
|
|
1693
1810
|
children: [
|
|
1694
|
-
label ? /* @__PURE__ */ (0,
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
] }) : null,
|
|
1698
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1699
|
-
import_react_aria_components17.Group,
|
|
1811
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1813
|
+
import_react_aria_components20.Group,
|
|
1700
1814
|
{
|
|
1701
1815
|
className: "pire-control",
|
|
1702
1816
|
"data-size": size,
|
|
@@ -1705,15 +1819,15 @@ function MultiComboBox({
|
|
|
1705
1819
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1706
1820
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1707
1821
|
children: [
|
|
1708
|
-
/* @__PURE__ */ (0,
|
|
1709
|
-
/* @__PURE__ */ (0,
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "pire-chipfield", children: [
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.ButtonContext.Provider, { value: null, children: values.map((v) => (
|
|
1711
1825
|
/* Disabled follows the field, not `isEditable`: a read-only field's chips are
|
|
1712
1826
|
real, current values and should read as such — they simply lose the × . */
|
|
1713
|
-
/* @__PURE__ */ (0,
|
|
1827
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tag, { isDisabled: rest.isDisabled, onRemove: isEditable ? () => remove(v) : void 0, children: labelOf(v) }, v)
|
|
1714
1828
|
)) }),
|
|
1715
|
-
/* @__PURE__ */ (0,
|
|
1716
|
-
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1830
|
+
import_react_aria_components20.Input,
|
|
1717
1831
|
{
|
|
1718
1832
|
ref: inputRef,
|
|
1719
1833
|
className: cx("pire-input", "pire-chipinput"),
|
|
@@ -1722,41 +1836,41 @@ function MultiComboBox({
|
|
|
1722
1836
|
}
|
|
1723
1837
|
)
|
|
1724
1838
|
] }),
|
|
1725
|
-
/* @__PURE__ */ (0,
|
|
1726
|
-
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1840
|
+
import_react_aria_components20.Button,
|
|
1727
1841
|
{
|
|
1728
1842
|
className: "pire-iconbtn",
|
|
1729
1843
|
"data-size": "sm",
|
|
1730
1844
|
"aria-label": msg.comboBoxShowSuggestions,
|
|
1731
1845
|
style: { width: 20, height: 20 },
|
|
1732
|
-
children: /* @__PURE__ */ (0,
|
|
1846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "chevron-down", size: 16 })
|
|
1733
1847
|
}
|
|
1734
1848
|
)
|
|
1735
1849
|
]
|
|
1736
1850
|
}
|
|
1737
1851
|
),
|
|
1738
|
-
/* @__PURE__ */ (0,
|
|
1739
|
-
|
|
1740
|
-
/* @__PURE__ */ (0,
|
|
1741
|
-
/* @__PURE__ */ (0,
|
|
1742
|
-
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { "aria-live": "polite", children: announcement }) }),
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldDescription, { description, help }),
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
1855
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1856
|
+
import_react_aria_components20.ListBox,
|
|
1743
1857
|
{
|
|
1744
1858
|
className: "pire-listbox",
|
|
1745
1859
|
onScroll: onLoadMore ? (e) => {
|
|
1746
1860
|
const el = e.currentTarget;
|
|
1747
1861
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1748
1862
|
} : void 0,
|
|
1749
|
-
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0,
|
|
1750
|
-
children: (item) => /* @__PURE__ */ (0,
|
|
1751
|
-
|
|
1863
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1864
|
+
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1865
|
+
import_react_aria_components20.ListBoxItem,
|
|
1752
1866
|
{
|
|
1753
1867
|
className: "pire-option",
|
|
1754
1868
|
id: item.value,
|
|
1755
1869
|
textValue: item.label,
|
|
1756
1870
|
isDisabled: item.isDisabled,
|
|
1757
1871
|
children: [
|
|
1758
|
-
/* @__PURE__ */ (0,
|
|
1759
|
-
item.secondary ? /* @__PURE__ */ (0,
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pire-option-label", children: item.label }),
|
|
1873
|
+
item.secondary ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1760
1874
|
]
|
|
1761
1875
|
}
|
|
1762
1876
|
)
|
|
@@ -1768,12 +1882,16 @@ function MultiComboBox({
|
|
|
1768
1882
|
}
|
|
1769
1883
|
|
|
1770
1884
|
// src/components/forms/NumberField.tsx
|
|
1771
|
-
var
|
|
1772
|
-
var
|
|
1773
|
-
|
|
1885
|
+
var React15 = __toESM(require("react"), 1);
|
|
1886
|
+
var import_react_aria_components21 = require("react-aria-components");
|
|
1887
|
+
|
|
1888
|
+
// src/components/utils/decimalSeparator.ts
|
|
1774
1889
|
function decimalSeparatorFor(locale) {
|
|
1775
1890
|
return new Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".";
|
|
1776
1891
|
}
|
|
1892
|
+
|
|
1893
|
+
// src/components/forms/NumberField.tsx
|
|
1894
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1777
1895
|
function typeIntoInput(el, text) {
|
|
1778
1896
|
const start = el.selectionStart ?? el.value.length;
|
|
1779
1897
|
const end = el.selectionEnd ?? start;
|
|
@@ -1804,12 +1922,12 @@ function toAriaNumber(value) {
|
|
|
1804
1922
|
return typeof value === "number" ? value : Number(value);
|
|
1805
1923
|
}
|
|
1806
1924
|
function ClearButton({ label, onClear }) {
|
|
1807
|
-
const state =
|
|
1925
|
+
const state = React15.useContext(import_react_aria_components21.NumberFieldStateContext);
|
|
1808
1926
|
if (!state?.inputValue) {
|
|
1809
1927
|
return null;
|
|
1810
1928
|
}
|
|
1811
|
-
return /* @__PURE__ */ (0,
|
|
1812
|
-
|
|
1929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1930
|
+
import_react_aria_components21.Button,
|
|
1813
1931
|
{
|
|
1814
1932
|
className: "pire-input-clear",
|
|
1815
1933
|
slot: null,
|
|
@@ -1825,6 +1943,7 @@ function NumberField({
|
|
|
1825
1943
|
label,
|
|
1826
1944
|
suffix,
|
|
1827
1945
|
description,
|
|
1946
|
+
help,
|
|
1828
1947
|
errorMessage,
|
|
1829
1948
|
hideStepper,
|
|
1830
1949
|
stepperLayout = "stacked",
|
|
@@ -1843,10 +1962,10 @@ function NumberField({
|
|
|
1843
1962
|
...rest
|
|
1844
1963
|
}) {
|
|
1845
1964
|
const msg = usePireMessages();
|
|
1846
|
-
const { locale } = (0,
|
|
1965
|
+
const { locale } = (0, import_react_aria_components21.useLocale)();
|
|
1847
1966
|
const empty = emptyValue === void 0 ? NaN : emptyValue;
|
|
1848
1967
|
const isControlled = value !== void 0;
|
|
1849
|
-
const [ownValue, setOwnValue] =
|
|
1968
|
+
const [ownValue, setOwnValue] = React15.useState(() => toAriaNumber(defaultValue) ?? NaN);
|
|
1850
1969
|
const takesOverValue = Boolean(isClearable) && !isControlled;
|
|
1851
1970
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
|
|
1852
1971
|
const handleChange = (next) => {
|
|
@@ -1895,8 +2014,9 @@ function NumberField({
|
|
|
1895
2014
|
event.stopPropagation();
|
|
1896
2015
|
typeIntoInput(event.currentTarget, localised);
|
|
1897
2016
|
};
|
|
1898
|
-
|
|
1899
|
-
|
|
2017
|
+
warnHelpWithoutLabel("NumberField", label, help);
|
|
2018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2019
|
+
import_react_aria_components21.NumberField,
|
|
1900
2020
|
{
|
|
1901
2021
|
className: cx("pire-field", className),
|
|
1902
2022
|
style,
|
|
@@ -1905,12 +2025,9 @@ function NumberField({
|
|
|
1905
2025
|
...rest,
|
|
1906
2026
|
...valueProps,
|
|
1907
2027
|
children: [
|
|
1908
|
-
label ? /* @__PURE__ */ (0,
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
] }) : null,
|
|
1912
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1913
|
-
import_react_aria_components18.Group,
|
|
2028
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2030
|
+
import_react_aria_components21.Group,
|
|
1914
2031
|
{
|
|
1915
2032
|
className: "pire-control",
|
|
1916
2033
|
"data-size": size,
|
|
@@ -1919,17 +2036,17 @@ function NumberField({
|
|
|
1919
2036
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1920
2037
|
"data-stepper": stepperLayout,
|
|
1921
2038
|
children: [
|
|
1922
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0,
|
|
1923
|
-
|
|
2039
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2040
|
+
import_react_aria_components21.Button,
|
|
1924
2041
|
{
|
|
1925
2042
|
slot: "decrement",
|
|
1926
2043
|
className: "pire-qty-btn",
|
|
1927
2044
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
1928
|
-
children: /* @__PURE__ */ (0,
|
|
2045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "minus", size: 16 })
|
|
1929
2046
|
}
|
|
1930
2047
|
) : null,
|
|
1931
|
-
/* @__PURE__ */ (0,
|
|
1932
|
-
|
|
2048
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2049
|
+
import_react_aria_components21.Input,
|
|
1933
2050
|
{
|
|
1934
2051
|
className: "pire-input",
|
|
1935
2052
|
"data-numeric": "true",
|
|
@@ -1937,52 +2054,52 @@ function NumberField({
|
|
|
1937
2054
|
onPasteCapture: handlePaste
|
|
1938
2055
|
}
|
|
1939
2056
|
),
|
|
1940
|
-
suffix ? /* @__PURE__ */ (0,
|
|
1941
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
1942
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0,
|
|
1943
|
-
|
|
2057
|
+
suffix ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "pire-affix", children: suffix }) : null,
|
|
2058
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ClearButton, { label: clearLabel ?? msg.inputClear, onClear: () => handleChange(NaN) }) : null,
|
|
2059
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2060
|
+
import_react_aria_components21.Button,
|
|
1944
2061
|
{
|
|
1945
2062
|
slot: "increment",
|
|
1946
2063
|
className: "pire-qty-btn",
|
|
1947
2064
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
1948
|
-
children: /* @__PURE__ */ (0,
|
|
2065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "plus", size: 16 })
|
|
1949
2066
|
}
|
|
1950
2067
|
) : null,
|
|
1951
|
-
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
1953
|
-
|
|
2068
|
+
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "pire-stepper", children: [
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2070
|
+
import_react_aria_components21.Button,
|
|
1954
2071
|
{
|
|
1955
2072
|
slot: "increment",
|
|
1956
2073
|
className: "pire-stepper-btn",
|
|
1957
2074
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
1958
|
-
children: /* @__PURE__ */ (0,
|
|
2075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "plus", size: 10 })
|
|
1959
2076
|
}
|
|
1960
2077
|
),
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
1962
|
-
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2079
|
+
import_react_aria_components21.Button,
|
|
1963
2080
|
{
|
|
1964
2081
|
slot: "decrement",
|
|
1965
2082
|
className: "pire-stepper-btn",
|
|
1966
2083
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
1967
|
-
children: /* @__PURE__ */ (0,
|
|
2084
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "minus", size: 10 })
|
|
1968
2085
|
}
|
|
1969
2086
|
)
|
|
1970
2087
|
] })
|
|
1971
2088
|
]
|
|
1972
2089
|
}
|
|
1973
2090
|
),
|
|
1974
|
-
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
2091
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FieldDescription, { description, help }),
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_aria_components21.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1976
2093
|
]
|
|
1977
2094
|
}
|
|
1978
2095
|
);
|
|
1979
2096
|
}
|
|
1980
2097
|
|
|
1981
2098
|
// src/components/forms/QuantityStepper.tsx
|
|
1982
|
-
var
|
|
2099
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1983
2100
|
function QuantityStepper({ size = "md", ...rest }) {
|
|
1984
2101
|
const msg = usePireMessages();
|
|
1985
|
-
return /* @__PURE__ */ (0,
|
|
2102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1986
2103
|
NumberField,
|
|
1987
2104
|
{
|
|
1988
2105
|
...rest,
|
|
@@ -1996,8 +2113,8 @@ function QuantityStepper({ size = "md", ...rest }) {
|
|
|
1996
2113
|
}
|
|
1997
2114
|
|
|
1998
2115
|
// src/components/forms/DatePicker.tsx
|
|
1999
|
-
var
|
|
2000
|
-
var
|
|
2116
|
+
var React16 = __toESM(require("react"), 1);
|
|
2117
|
+
var import_react_aria_components22 = require("react-aria-components");
|
|
2001
2118
|
|
|
2002
2119
|
// src/components/forms/dateValues.ts
|
|
2003
2120
|
var import_date = require("@internationalized/date");
|
|
@@ -2027,14 +2144,14 @@ function coerceBound(value) {
|
|
|
2027
2144
|
}
|
|
2028
2145
|
|
|
2029
2146
|
// src/components/forms/DatePicker.tsx
|
|
2030
|
-
var
|
|
2147
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2031
2148
|
function ClearButton2({ label }) {
|
|
2032
|
-
const state =
|
|
2149
|
+
const state = React16.useContext(import_react_aria_components22.DatePickerStateContext);
|
|
2033
2150
|
if (!state?.value) {
|
|
2034
2151
|
return null;
|
|
2035
2152
|
}
|
|
2036
|
-
return /* @__PURE__ */ (0,
|
|
2037
|
-
|
|
2153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2154
|
+
import_react_aria_components22.Button,
|
|
2038
2155
|
{
|
|
2039
2156
|
className: "pire-input-clear",
|
|
2040
2157
|
slot: null,
|
|
@@ -2049,6 +2166,7 @@ function ClearButton2({ label }) {
|
|
|
2049
2166
|
function DatePicker({
|
|
2050
2167
|
label,
|
|
2051
2168
|
description,
|
|
2169
|
+
help,
|
|
2052
2170
|
errorMessage,
|
|
2053
2171
|
size = "md",
|
|
2054
2172
|
fullWidth = true,
|
|
@@ -2069,8 +2187,9 @@ function DatePicker({
|
|
|
2069
2187
|
const handleChange = (next) => onChange?.(
|
|
2070
2188
|
valueFormat === "iso" && next ? next.toString() : next
|
|
2071
2189
|
);
|
|
2072
|
-
|
|
2073
|
-
|
|
2190
|
+
warnHelpWithoutLabel("DatePicker", label, help);
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2192
|
+
import_react_aria_components22.DatePicker,
|
|
2074
2193
|
{
|
|
2075
2194
|
className: cx("pire-field", className),
|
|
2076
2195
|
style,
|
|
@@ -2082,12 +2201,9 @@ function DatePicker({
|
|
|
2082
2201
|
onChange: handleChange,
|
|
2083
2202
|
...rest,
|
|
2084
2203
|
children: [
|
|
2085
|
-
label ? /* @__PURE__ */ (0,
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
] }) : null,
|
|
2089
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2090
|
-
import_react_aria_components19.Group,
|
|
2204
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2205
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
2206
|
+
import_react_aria_components22.Group,
|
|
2091
2207
|
{
|
|
2092
2208
|
className: "pire-control",
|
|
2093
2209
|
"data-size": size,
|
|
@@ -2095,50 +2211,50 @@ function DatePicker({
|
|
|
2095
2211
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
2096
2212
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2097
2213
|
children: [
|
|
2098
|
-
/* @__PURE__ */ (0,
|
|
2099
|
-
showsClear ? /* @__PURE__ */ (0,
|
|
2100
|
-
/* @__PURE__ */ (0,
|
|
2101
|
-
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.DateInput, { className: "pire-datefield", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2215
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ClearButton2, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2217
|
+
import_react_aria_components22.Button,
|
|
2102
2218
|
{
|
|
2103
2219
|
className: "pire-iconbtn",
|
|
2104
2220
|
"data-size": "sm",
|
|
2105
2221
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2106
2222
|
style: { width: 24, height: 24 },
|
|
2107
|
-
children: /* @__PURE__ */ (0,
|
|
2223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "calendar", size: 16 })
|
|
2108
2224
|
}
|
|
2109
2225
|
)
|
|
2110
2226
|
]
|
|
2111
2227
|
}
|
|
2112
2228
|
),
|
|
2113
|
-
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2116
|
-
/* @__PURE__ */ (0,
|
|
2117
|
-
/* @__PURE__ */ (0,
|
|
2118
|
-
|
|
2229
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldDescription, { description, help }),
|
|
2230
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
2231
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.Dialog, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_aria_components22.Calendar, { className: "pire-calendar", children: [
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("header", { className: "pire-calendar-head", children: [
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2234
|
+
import_react_aria_components22.Button,
|
|
2119
2235
|
{
|
|
2120
2236
|
slot: "previous",
|
|
2121
2237
|
className: "pire-iconbtn",
|
|
2122
2238
|
"data-size": "sm",
|
|
2123
2239
|
"aria-label": msg.datePickerPreviousMonth,
|
|
2124
|
-
children: /* @__PURE__ */ (0,
|
|
2240
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "chevron-left", size: 16 })
|
|
2125
2241
|
}
|
|
2126
2242
|
),
|
|
2127
|
-
/* @__PURE__ */ (0,
|
|
2128
|
-
/* @__PURE__ */ (0,
|
|
2129
|
-
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.Heading, { className: "pire-calendar-title" }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2245
|
+
import_react_aria_components22.Button,
|
|
2130
2246
|
{
|
|
2131
2247
|
slot: "next",
|
|
2132
2248
|
className: "pire-iconbtn",
|
|
2133
2249
|
"data-size": "sm",
|
|
2134
2250
|
"aria-label": msg.datePickerNextMonth,
|
|
2135
|
-
children: /* @__PURE__ */ (0,
|
|
2251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "chevron-right", size: 16 })
|
|
2136
2252
|
}
|
|
2137
2253
|
)
|
|
2138
2254
|
] }),
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
2140
|
-
/* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2255
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_aria_components22.CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.CalendarHeaderCell, { children: day }) }),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_aria_components22.CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2142
2258
|
] })
|
|
2143
2259
|
] }) }) })
|
|
2144
2260
|
]
|
|
@@ -2147,9 +2263,9 @@ function DatePicker({
|
|
|
2147
2263
|
}
|
|
2148
2264
|
|
|
2149
2265
|
// src/components/forms/DateRangePicker.tsx
|
|
2150
|
-
var
|
|
2151
|
-
var
|
|
2152
|
-
var
|
|
2266
|
+
var React17 = __toESM(require("react"), 1);
|
|
2267
|
+
var import_react_aria_components23 = require("react-aria-components");
|
|
2268
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2153
2269
|
function coerceRange(range) {
|
|
2154
2270
|
if (range === void 0) {
|
|
2155
2271
|
return void 0;
|
|
@@ -2170,12 +2286,12 @@ function rangeLengthInDays(range) {
|
|
|
2170
2286
|
return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
|
|
2171
2287
|
}
|
|
2172
2288
|
function ClearButton3({ label }) {
|
|
2173
|
-
const state =
|
|
2289
|
+
const state = React17.useContext(import_react_aria_components23.DateRangePickerStateContext);
|
|
2174
2290
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2175
2291
|
return null;
|
|
2176
2292
|
}
|
|
2177
|
-
return /* @__PURE__ */ (0,
|
|
2178
|
-
|
|
2293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2294
|
+
import_react_aria_components23.Button,
|
|
2179
2295
|
{
|
|
2180
2296
|
className: "pire-input-clear",
|
|
2181
2297
|
slot: null,
|
|
@@ -2190,6 +2306,7 @@ function ClearButton3({ label }) {
|
|
|
2190
2306
|
function DateRangePicker({
|
|
2191
2307
|
label,
|
|
2192
2308
|
description,
|
|
2309
|
+
help,
|
|
2193
2310
|
errorMessage,
|
|
2194
2311
|
maxRangeDays,
|
|
2195
2312
|
presets,
|
|
@@ -2225,8 +2342,9 @@ function DateRangePicker({
|
|
|
2225
2342
|
valueFormat === "iso" ? { start: next.start.toString(), end: next.end.toString() } : { start: next.start, end: next.end }
|
|
2226
2343
|
);
|
|
2227
2344
|
};
|
|
2228
|
-
|
|
2229
|
-
|
|
2345
|
+
warnHelpWithoutLabel("DateRangePicker", label, help);
|
|
2346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2347
|
+
import_react_aria_components23.DateRangePicker,
|
|
2230
2348
|
{
|
|
2231
2349
|
className: cx("pire-field", className),
|
|
2232
2350
|
style,
|
|
@@ -2241,12 +2359,9 @@ function DateRangePicker({
|
|
|
2241
2359
|
...rest,
|
|
2242
2360
|
isInvalid: rest.isInvalid || tooLong || void 0,
|
|
2243
2361
|
children: [
|
|
2244
|
-
label ? /* @__PURE__ */ (0,
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
] }) : null,
|
|
2248
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2249
|
-
import_react_aria_components20.Group,
|
|
2362
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2363
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2364
|
+
import_react_aria_components23.Group,
|
|
2250
2365
|
{
|
|
2251
2366
|
className: "pire-control pire-daterange-control",
|
|
2252
2367
|
"data-size": size,
|
|
@@ -2254,31 +2369,31 @@ function DateRangePicker({
|
|
|
2254
2369
|
"data-invalid": rest.isInvalid || tooLong ? "true" : void 0,
|
|
2255
2370
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2256
2371
|
children: [
|
|
2257
|
-
/* @__PURE__ */ (0,
|
|
2258
|
-
/* @__PURE__ */ (0,
|
|
2259
|
-
/* @__PURE__ */ (0,
|
|
2260
|
-
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */ (0,
|
|
2261
|
-
/* @__PURE__ */ (0,
|
|
2262
|
-
|
|
2372
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.DateInput, { slot: "start", className: "pire-datefield", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { "aria-hidden": "true", className: "pire-daterange-dash", children: "\u2013" }),
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.DateInput, { slot: "end", className: "pire-datefield", children: (segment) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2375
|
+
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ClearButton3, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2377
|
+
import_react_aria_components23.Button,
|
|
2263
2378
|
{
|
|
2264
2379
|
className: "pire-iconbtn",
|
|
2265
2380
|
"data-size": "sm",
|
|
2266
2381
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2267
2382
|
style: { width: 24, height: 24 },
|
|
2268
|
-
children: /* @__PURE__ */ (0,
|
|
2383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "calendar", size: 16 })
|
|
2269
2384
|
}
|
|
2270
2385
|
)
|
|
2271
2386
|
]
|
|
2272
2387
|
}
|
|
2273
2388
|
),
|
|
2274
|
-
|
|
2275
|
-
/* @__PURE__ */ (0,
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FieldDescription, { description, help }),
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.FieldError, { className: "pire-field-error", children: errorMessage }),
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.Popover, { className: "pire-popover", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_aria_components23.Dialog, { className: "pire-daterange-dialog", children: [
|
|
2277
2392
|
presets?.length ? (
|
|
2278
2393
|
// Before the calendar in the DOM, so keyboard users reach the shortcut without
|
|
2279
2394
|
// arrowing through a month first.
|
|
2280
|
-
/* @__PURE__ */ (0,
|
|
2281
|
-
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "pire-daterange-presets", role: "group", "aria-label": msg.dateRangePresetsLabel, children: presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2396
|
+
import_react_aria_components23.Button,
|
|
2282
2397
|
{
|
|
2283
2398
|
className: "pire-daterange-preset",
|
|
2284
2399
|
onPress: () => emit(coerceRange(preset.range()) ?? null),
|
|
@@ -2287,33 +2402,33 @@ function DateRangePicker({
|
|
|
2287
2402
|
preset.id
|
|
2288
2403
|
)) })
|
|
2289
2404
|
) : null,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2291
|
-
/* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_aria_components23.RangeCalendar, { className: "pire-calendar", children: [
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("header", { className: "pire-calendar-head", children: [
|
|
2407
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2408
|
+
import_react_aria_components23.Button,
|
|
2294
2409
|
{
|
|
2295
2410
|
slot: "previous",
|
|
2296
2411
|
className: "pire-iconbtn",
|
|
2297
2412
|
"data-size": "sm",
|
|
2298
2413
|
"aria-label": msg.datePickerPreviousMonth,
|
|
2299
|
-
children: /* @__PURE__ */ (0,
|
|
2414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "chevron-left", size: 16 })
|
|
2300
2415
|
}
|
|
2301
2416
|
),
|
|
2302
|
-
/* @__PURE__ */ (0,
|
|
2303
|
-
/* @__PURE__ */ (0,
|
|
2304
|
-
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.Heading, { className: "pire-calendar-title" }),
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2419
|
+
import_react_aria_components23.Button,
|
|
2305
2420
|
{
|
|
2306
2421
|
slot: "next",
|
|
2307
2422
|
className: "pire-iconbtn",
|
|
2308
2423
|
"data-size": "sm",
|
|
2309
2424
|
"aria-label": msg.datePickerNextMonth,
|
|
2310
|
-
children: /* @__PURE__ */ (0,
|
|
2425
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon, { name: "chevron-right", size: 16 })
|
|
2311
2426
|
}
|
|
2312
2427
|
)
|
|
2313
2428
|
] }),
|
|
2314
|
-
/* @__PURE__ */ (0,
|
|
2315
|
-
/* @__PURE__ */ (0,
|
|
2316
|
-
/* @__PURE__ */ (0,
|
|
2429
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react_aria_components23.CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.CalendarGridHeader, { children: (day) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.CalendarHeaderCell, { children: day }) }),
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.CalendarGridBody, { children: (date) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_aria_components23.CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2317
2432
|
] })
|
|
2318
2433
|
] })
|
|
2319
2434
|
] }) })
|
|
@@ -2323,26 +2438,26 @@ function DateRangePicker({
|
|
|
2323
2438
|
}
|
|
2324
2439
|
|
|
2325
2440
|
// src/components/forms/ValueHelpField.tsx
|
|
2326
|
-
var
|
|
2441
|
+
var React21 = __toESM(require("react"), 1);
|
|
2327
2442
|
|
|
2328
2443
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2329
|
-
var
|
|
2444
|
+
var React20 = __toESM(require("react"), 1);
|
|
2330
2445
|
|
|
2331
2446
|
// src/components/feedback/Dialog.tsx
|
|
2332
|
-
var
|
|
2333
|
-
var
|
|
2334
|
-
var
|
|
2447
|
+
var React18 = __toESM(require("react"), 1);
|
|
2448
|
+
var import_react_aria_components24 = require("react-aria-components");
|
|
2449
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2335
2450
|
function DialogTitle({ children, className }) {
|
|
2336
|
-
return /* @__PURE__ */ (0,
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components24.Heading, { slot: "title", className: cx("pire-dialog-title", className), children });
|
|
2337
2452
|
}
|
|
2338
2453
|
function DialogDescription({ children, className }) {
|
|
2339
|
-
return /* @__PURE__ */ (0,
|
|
2454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: cx("pire-dialog-sub", className), style: { margin: 0 }, children });
|
|
2340
2455
|
}
|
|
2341
2456
|
function DialogBody({ children, className }) {
|
|
2342
|
-
return /* @__PURE__ */ (0,
|
|
2457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx("pire-dialog-body", className), children });
|
|
2343
2458
|
}
|
|
2344
2459
|
function DialogActions({ children, className }) {
|
|
2345
|
-
return /* @__PURE__ */ (0,
|
|
2460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("footer", { className: cx("pire-dialog-foot", className), children });
|
|
2346
2461
|
}
|
|
2347
2462
|
function Dialog({
|
|
2348
2463
|
isOpen,
|
|
@@ -2363,20 +2478,20 @@ function Dialog({
|
|
|
2363
2478
|
onClose?.();
|
|
2364
2479
|
onOpenChange?.(false);
|
|
2365
2480
|
};
|
|
2366
|
-
const parts =
|
|
2367
|
-
const slotOf = (type) => parts.find((node) =>
|
|
2481
|
+
const parts = React18.Children.toArray(children);
|
|
2482
|
+
const slotOf = (type) => parts.find((node) => React18.isValidElement(node) && node.type === type);
|
|
2368
2483
|
const titleSlot = slotOf(DialogTitle);
|
|
2369
2484
|
const descriptionSlot = slotOf(DialogDescription);
|
|
2370
2485
|
const bodySlot = slotOf(DialogBody);
|
|
2371
2486
|
const actionsSlot = slotOf(DialogActions);
|
|
2372
2487
|
const slots = [titleSlot, descriptionSlot, bodySlot, actionsSlot];
|
|
2373
2488
|
const loose = parts.filter((node) => !slots.includes(node));
|
|
2374
|
-
const heading = titleSlot ?? (title ? /* @__PURE__ */ (0,
|
|
2375
|
-
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ (0,
|
|
2376
|
-
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ (0,
|
|
2377
|
-
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ (0,
|
|
2378
|
-
return /* @__PURE__ */ (0,
|
|
2379
|
-
|
|
2489
|
+
const heading = titleSlot ?? (title ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components24.Heading, { slot: "title", className: "pire-dialog-title", children: title }) : null);
|
|
2490
|
+
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null);
|
|
2491
|
+
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null);
|
|
2492
|
+
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "pire-dialog-body", children: loose }) : null);
|
|
2493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2494
|
+
import_react_aria_components24.ModalOverlay,
|
|
2380
2495
|
{
|
|
2381
2496
|
className: "pire-modal-overlay",
|
|
2382
2497
|
isOpen,
|
|
@@ -2384,13 +2499,13 @@ function Dialog({
|
|
|
2384
2499
|
onOpenChange: (o) => {
|
|
2385
2500
|
if (!o) close();
|
|
2386
2501
|
},
|
|
2387
|
-
children: /* @__PURE__ */ (0,
|
|
2388
|
-
heading || description ? /* @__PURE__ */ (0,
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components24.Modal, { className: cx("pire-modal", className), "data-size": size, style, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_aria_components24.Dialog, { className: "pire-dialog", children: [
|
|
2503
|
+
heading || description ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("header", { className: "pire-dialog-head", children: [
|
|
2504
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2390
2505
|
heading,
|
|
2391
2506
|
description
|
|
2392
2507
|
] }),
|
|
2393
|
-
showClose ? /* @__PURE__ */ (0,
|
|
2508
|
+
showClose ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconButton, { icon: "x", label: msg.dialogClose, size: "sm", onPress: close }) : null
|
|
2394
2509
|
] }) : null,
|
|
2395
2510
|
body,
|
|
2396
2511
|
actions
|
|
@@ -2400,13 +2515,13 @@ function Dialog({
|
|
|
2400
2515
|
}
|
|
2401
2516
|
|
|
2402
2517
|
// src/components/data/DataTable.tsx
|
|
2403
|
-
var
|
|
2404
|
-
var
|
|
2518
|
+
var React19 = __toESM(require("react"), 1);
|
|
2519
|
+
var import_react_aria_components25 = require("react-aria-components");
|
|
2405
2520
|
|
|
2406
2521
|
// src/components/feedback/Skeleton.tsx
|
|
2407
|
-
var
|
|
2522
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2408
2523
|
function Skeleton({ shape = "text", width, height, className, style, ...rest }) {
|
|
2409
|
-
return /* @__PURE__ */ (0,
|
|
2524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2410
2525
|
"div",
|
|
2411
2526
|
{
|
|
2412
2527
|
className: cx("pire-skeleton", className),
|
|
@@ -2426,7 +2541,7 @@ function SkeletonTableRow({
|
|
|
2426
2541
|
...rest
|
|
2427
2542
|
}) {
|
|
2428
2543
|
const cells = typeof columns === "number" ? Array.from({ length: columns }, () => ({})) : columns;
|
|
2429
|
-
return /* @__PURE__ */ (0,
|
|
2544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2430
2545
|
"div",
|
|
2431
2546
|
{
|
|
2432
2547
|
className: cx("pire-skeleton-row", className),
|
|
@@ -2436,13 +2551,13 @@ function SkeletonTableRow({
|
|
|
2436
2551
|
...rest,
|
|
2437
2552
|
children: cells.map((c, i) => {
|
|
2438
2553
|
const align = c.numeric ? "right" : c.align ?? "left";
|
|
2439
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2440
2555
|
"div",
|
|
2441
2556
|
{
|
|
2442
2557
|
className: "pire-skeleton-cell",
|
|
2443
2558
|
"data-align": align,
|
|
2444
2559
|
style: { width: c.width, flex: c.width ? "0 0 auto" : void 0 },
|
|
2445
|
-
children: /* @__PURE__ */ (0,
|
|
2560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { width: BAR_WIDTHS[i % BAR_WIDTHS.length] })
|
|
2446
2561
|
},
|
|
2447
2562
|
i
|
|
2448
2563
|
);
|
|
@@ -2452,12 +2567,12 @@ function SkeletonTableRow({
|
|
|
2452
2567
|
}
|
|
2453
2568
|
|
|
2454
2569
|
// src/components/data/DataTable.tsx
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2457
|
-
var
|
|
2458
|
-
function
|
|
2459
|
-
if (
|
|
2460
|
-
|
|
2570
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2571
|
+
var IS_DEV3 = process.env.NODE_ENV !== "production";
|
|
2572
|
+
var warned3 = /* @__PURE__ */ new Set();
|
|
2573
|
+
function warnOnce3(key, message) {
|
|
2574
|
+
if (warned3.has(key)) return;
|
|
2575
|
+
warned3.add(key);
|
|
2461
2576
|
console.warn(`[pire] ${message}`);
|
|
2462
2577
|
}
|
|
2463
2578
|
var CHECKBOX_W = 44;
|
|
@@ -2488,7 +2603,7 @@ function DataTable({
|
|
|
2488
2603
|
const msg = usePireMessages();
|
|
2489
2604
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2490
2605
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2491
|
-
const pinnedGeometry =
|
|
2606
|
+
const pinnedGeometry = React19.useMemo(() => {
|
|
2492
2607
|
const geometry = /* @__PURE__ */ new Map();
|
|
2493
2608
|
let x = hasCheckboxColumn ? CHECKBOX_W : 0;
|
|
2494
2609
|
let broke = null;
|
|
@@ -2498,8 +2613,8 @@ function DataTable({
|
|
|
2498
2613
|
break;
|
|
2499
2614
|
}
|
|
2500
2615
|
if (typeof column.width !== "number") {
|
|
2501
|
-
if (
|
|
2502
|
-
|
|
2616
|
+
if (IS_DEV3)
|
|
2617
|
+
warnOnce3(
|
|
2503
2618
|
`pin-width:${column.key}`,
|
|
2504
2619
|
`DataTable column "${column.key}" is pinned but has no numeric width, so its offset cannot be computed. It will scroll.`
|
|
2505
2620
|
);
|
|
@@ -2509,10 +2624,10 @@ function DataTable({
|
|
|
2509
2624
|
geometry.set(column.key, { left: x, width: column.width });
|
|
2510
2625
|
x += column.width;
|
|
2511
2626
|
}
|
|
2512
|
-
if (
|
|
2627
|
+
if (IS_DEV3 && broke === "unpinned") {
|
|
2513
2628
|
const stranded = columns.slice(geometry.size).find((c) => c.pinned);
|
|
2514
2629
|
if (stranded) {
|
|
2515
|
-
|
|
2630
|
+
warnOnce3(
|
|
2516
2631
|
`pin-gap:${stranded.key}`,
|
|
2517
2632
|
`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.`
|
|
2518
2633
|
);
|
|
@@ -2554,15 +2669,15 @@ function DataTable({
|
|
|
2554
2669
|
style: { left: box.left, width: box.width, minWidth: box.width, maxWidth: box.width }
|
|
2555
2670
|
};
|
|
2556
2671
|
};
|
|
2557
|
-
return /* @__PURE__ */ (0,
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2558
2673
|
"div",
|
|
2559
2674
|
{
|
|
2560
2675
|
className: cx("pire-table-wrap", className),
|
|
2561
2676
|
style,
|
|
2562
2677
|
"data-loading": isLoading ? "true" : void 0,
|
|
2563
2678
|
"aria-busy": isLoading ? "true" : void 0,
|
|
2564
|
-
children: /* @__PURE__ */ (0,
|
|
2565
|
-
|
|
2679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2680
|
+
import_react_aria_components25.Table,
|
|
2566
2681
|
{
|
|
2567
2682
|
className: "pire-table",
|
|
2568
2683
|
"data-density": density,
|
|
@@ -2580,8 +2695,8 @@ function DataTable({
|
|
|
2580
2695
|
if (row) onRowAction(row);
|
|
2581
2696
|
} : void 0,
|
|
2582
2697
|
children: [
|
|
2583
|
-
/* @__PURE__ */ (0,
|
|
2584
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0,
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_aria_components25.TableHeader, { className: "pire-thead-row", children: [
|
|
2699
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_aria_components25.Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
2585
2700
|
columns.map((c, i) => (
|
|
2586
2701
|
// The checkbox column is never the row header — a selection control does not identify
|
|
2587
2702
|
// the record — so the first *data* column carries it regardless of whether a checkbox
|
|
@@ -2589,8 +2704,8 @@ function DataTable({
|
|
|
2589
2704
|
// table with no row header at all: invisible on first paint, and a hard crash from
|
|
2590
2705
|
// React Aria's own "table must have a row header" invariant the moment `rows` changes
|
|
2591
2706
|
// under it (search, sort, a paginated load).
|
|
2592
|
-
/* @__PURE__ */ (0,
|
|
2593
|
-
|
|
2707
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2708
|
+
import_react_aria_components25.Column,
|
|
2594
2709
|
{
|
|
2595
2710
|
id: c.key,
|
|
2596
2711
|
className: "pire-th",
|
|
@@ -2599,9 +2714,9 @@ function DataTable({
|
|
|
2599
2714
|
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
2600
2715
|
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
2601
2716
|
...pinProps(c.key),
|
|
2602
|
-
children: /* @__PURE__ */ (0,
|
|
2717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
|
|
2603
2718
|
c.label,
|
|
2604
|
-
c.sortable ? /* @__PURE__ */ (0,
|
|
2719
|
+
c.sortable ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2605
2720
|
Icon,
|
|
2606
2721
|
{
|
|
2607
2722
|
size: 12,
|
|
@@ -2617,30 +2732,30 @@ function DataTable({
|
|
|
2617
2732
|
)
|
|
2618
2733
|
))
|
|
2619
2734
|
] }),
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
2621
|
-
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2736
|
+
import_react_aria_components25.TableBody,
|
|
2622
2737
|
{
|
|
2623
|
-
renderEmptyState: () => isLoading ? /* @__PURE__ */ (0,
|
|
2624
|
-
/* @__PURE__ */ (0,
|
|
2738
|
+
renderEmptyState: () => isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
|
|
2739
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
|
|
2625
2740
|
Array.from({ length: skeletonRows }, (_, i) => (
|
|
2626
2741
|
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
2627
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
2628
2743
|
))
|
|
2629
|
-
] }) : /* @__PURE__ */ (0,
|
|
2744
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
|
|
2630
2745
|
children: body.flatMap((row) => {
|
|
2631
2746
|
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
2632
|
-
const record = /* @__PURE__ */ (0,
|
|
2633
|
-
|
|
2747
|
+
const record = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2748
|
+
import_react_aria_components25.Row,
|
|
2634
2749
|
{
|
|
2635
2750
|
id: row.id,
|
|
2636
2751
|
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
2637
2752
|
"data-pressable": onRowAction && !rowIsDisabled ? "true" : void 0,
|
|
2638
2753
|
children: [
|
|
2639
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0,
|
|
2754
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_aria_components25.Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
2640
2755
|
columns.map((c) => {
|
|
2641
2756
|
const pin = pinProps(c.key);
|
|
2642
|
-
return /* @__PURE__ */ (0,
|
|
2643
|
-
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2758
|
+
import_react_aria_components25.Cell,
|
|
2644
2759
|
{
|
|
2645
2760
|
className: "pire-td",
|
|
2646
2761
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
@@ -2659,23 +2774,23 @@ function DataTable({
|
|
|
2659
2774
|
if (!renderExpanded || !expanded.has(String(row.id))) return [record];
|
|
2660
2775
|
return [
|
|
2661
2776
|
record,
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_aria_components25.Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_aria_components25.Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))
|
|
2663
2778
|
];
|
|
2664
2779
|
})
|
|
2665
2780
|
}
|
|
2666
2781
|
),
|
|
2667
|
-
footer && !isLoading ? /* @__PURE__ */ (0,
|
|
2668
|
-
hasCheckboxColumn ? /* @__PURE__ */ (0,
|
|
2782
|
+
footer && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_aria_components25.TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_aria_components25.Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
2783
|
+
hasCheckboxColumn ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_aria_components25.Cell, { className: "pire-tf", ...pinProps(null) }) : null,
|
|
2669
2784
|
columns.map((c, i) => {
|
|
2670
2785
|
const pin = pinProps(c.key);
|
|
2671
|
-
return /* @__PURE__ */ (0,
|
|
2672
|
-
|
|
2786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2787
|
+
import_react_aria_components25.Cell,
|
|
2673
2788
|
{
|
|
2674
2789
|
className: "pire-tf",
|
|
2675
2790
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
2676
2791
|
...pin,
|
|
2677
2792
|
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2678
|
-
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ (0,
|
|
2793
|
+
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
2679
2794
|
},
|
|
2680
2795
|
c.key
|
|
2681
2796
|
);
|
|
@@ -2689,7 +2804,7 @@ function DataTable({
|
|
|
2689
2804
|
}
|
|
2690
2805
|
|
|
2691
2806
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2692
|
-
var
|
|
2807
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2693
2808
|
function ValueHelpDialog({
|
|
2694
2809
|
isOpen,
|
|
2695
2810
|
title,
|
|
@@ -2709,12 +2824,12 @@ function ValueHelpDialog({
|
|
|
2709
2824
|
onConfirm
|
|
2710
2825
|
}) {
|
|
2711
2826
|
const msg = usePireMessages();
|
|
2712
|
-
const [query, setQuery] =
|
|
2713
|
-
|
|
2827
|
+
const [query, setQuery] = React20.useState("");
|
|
2828
|
+
React20.useEffect(() => {
|
|
2714
2829
|
if (isOpen) setQuery("");
|
|
2715
2830
|
}, [isOpen]);
|
|
2716
2831
|
const isMultiple = selectionMode === "multiple";
|
|
2717
|
-
const filtered =
|
|
2832
|
+
const filtered = React20.useMemo(() => {
|
|
2718
2833
|
if (isFilteredExternally) return rows;
|
|
2719
2834
|
const q = query.trim().toLowerCase();
|
|
2720
2835
|
if (!q) return rows;
|
|
@@ -2724,16 +2839,16 @@ function ValueHelpDialog({
|
|
|
2724
2839
|
setQuery(value);
|
|
2725
2840
|
onSearch?.(value);
|
|
2726
2841
|
};
|
|
2727
|
-
return /* @__PURE__ */ (0,
|
|
2842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2728
2843
|
Dialog,
|
|
2729
2844
|
{
|
|
2730
2845
|
isOpen,
|
|
2731
2846
|
size: "lg",
|
|
2732
2847
|
title: title ?? msg.valueHelpDialogTitle,
|
|
2733
2848
|
onClose,
|
|
2734
|
-
footer: /* @__PURE__ */ (0,
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2736
|
-
isMultiple ? /* @__PURE__ */ (0,
|
|
2849
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { variant: "tertiary", onPress: onClose, children: msg.valueHelpDialogCancel }),
|
|
2851
|
+
isMultiple ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2737
2852
|
Button,
|
|
2738
2853
|
{
|
|
2739
2854
|
variant: "primary",
|
|
@@ -2745,8 +2860,8 @@ function ValueHelpDialog({
|
|
|
2745
2860
|
}
|
|
2746
2861
|
) : null
|
|
2747
2862
|
] }),
|
|
2748
|
-
children: /* @__PURE__ */ (0,
|
|
2749
|
-
/* @__PURE__ */ (0,
|
|
2863
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "var(--sp-3)" }, children: [
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2750
2865
|
Input,
|
|
2751
2866
|
{
|
|
2752
2867
|
"aria-label": msg.valueHelpDialogSearch,
|
|
@@ -2759,12 +2874,12 @@ function ValueHelpDialog({
|
|
|
2759
2874
|
autoFocus: true
|
|
2760
2875
|
}
|
|
2761
2876
|
),
|
|
2762
|
-
isMultiple ? /* @__PURE__ */ (0,
|
|
2763
|
-
/* @__PURE__ */ (0,
|
|
2764
|
-
/* @__PURE__ */ (0,
|
|
2765
|
-
/* @__PURE__ */ (0,
|
|
2877
|
+
isMultiple ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "pire-valuehelp-selectionbar", children: [
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.(rows.map((r) => r.id)), children: msg.valueHelpSelectAllCount.replace("{count}", String(rows.length)) }),
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.([]), children: msg.valueHelpClearSelection }),
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "pire-valuehelp-count", children: msg.valueHelpSelectedCount.replace("{count}", String(selectedKeys?.length ?? 0)) })
|
|
2766
2881
|
] }) : null,
|
|
2767
|
-
/* @__PURE__ */ (0,
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2768
2883
|
"div",
|
|
2769
2884
|
{
|
|
2770
2885
|
onScroll: onLoadMore ? (event) => {
|
|
@@ -2772,7 +2887,7 @@ function ValueHelpDialog({
|
|
|
2772
2887
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 64) onLoadMore();
|
|
2773
2888
|
} : void 0,
|
|
2774
2889
|
style: { overflow: "auto", maxHeight: "48vh" },
|
|
2775
|
-
children: /* @__PURE__ */ (0,
|
|
2890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2776
2891
|
DataTable,
|
|
2777
2892
|
{
|
|
2778
2893
|
"aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
|
|
@@ -2799,7 +2914,7 @@ function ValueHelpDialog({
|
|
|
2799
2914
|
}
|
|
2800
2915
|
|
|
2801
2916
|
// src/components/forms/ValueHelpField.tsx
|
|
2802
|
-
var
|
|
2917
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2803
2918
|
var defaultFormat = (row) => [row.id, row.name ?? row.label ?? row.text].filter(Boolean).join(" \u2014 ");
|
|
2804
2919
|
function ValueHelpField({
|
|
2805
2920
|
label,
|
|
@@ -2825,9 +2940,9 @@ function ValueHelpField({
|
|
|
2825
2940
|
style
|
|
2826
2941
|
}) {
|
|
2827
2942
|
const msg = usePireMessages();
|
|
2828
|
-
const [open, setOpen] =
|
|
2829
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2943
|
+
const [open, setOpen] = React21.useState(false);
|
|
2944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cx(className), style, children: [
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2831
2946
|
Input,
|
|
2832
2947
|
{
|
|
2833
2948
|
label,
|
|
@@ -2839,8 +2954,8 @@ function ValueHelpField({
|
|
|
2839
2954
|
placeholder: placeholder ?? msg.valueHelpFieldPlaceholder,
|
|
2840
2955
|
description,
|
|
2841
2956
|
errorMessage,
|
|
2842
|
-
suffix: /* @__PURE__ */ (0,
|
|
2843
|
-
allowsClear && value ? /* @__PURE__ */ (0,
|
|
2957
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "pire-valuehelp-actions", children: [
|
|
2958
|
+
allowsClear && value ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2844
2959
|
IconButton,
|
|
2845
2960
|
{
|
|
2846
2961
|
icon: "x",
|
|
@@ -2849,7 +2964,7 @@ function ValueHelpField({
|
|
|
2849
2964
|
onPress: () => onChange?.(null)
|
|
2850
2965
|
}
|
|
2851
2966
|
) : null,
|
|
2852
|
-
/* @__PURE__ */ (0,
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2853
2968
|
IconButton,
|
|
2854
2969
|
{
|
|
2855
2970
|
icon: "search",
|
|
@@ -2861,7 +2976,7 @@ function ValueHelpField({
|
|
|
2861
2976
|
] })
|
|
2862
2977
|
}
|
|
2863
2978
|
),
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2865
2980
|
ValueHelpDialog,
|
|
2866
2981
|
{
|
|
2867
2982
|
isOpen: open,
|
|
@@ -2881,12 +2996,12 @@ function ValueHelpField({
|
|
|
2881
2996
|
}
|
|
2882
2997
|
|
|
2883
2998
|
// src/components/forms/FileUpload.tsx
|
|
2884
|
-
var
|
|
2885
|
-
var
|
|
2999
|
+
var React22 = __toESM(require("react"), 1);
|
|
3000
|
+
var import_react_aria_components27 = require("react-aria-components");
|
|
2886
3001
|
|
|
2887
3002
|
// src/components/feedback/ProgressBar.tsx
|
|
2888
|
-
var
|
|
2889
|
-
var
|
|
3003
|
+
var import_react_aria_components26 = require("react-aria-components");
|
|
3004
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2890
3005
|
function ProgressBar({
|
|
2891
3006
|
value = 0,
|
|
2892
3007
|
minValue = 0,
|
|
@@ -2899,8 +3014,8 @@ function ProgressBar({
|
|
|
2899
3014
|
className,
|
|
2900
3015
|
style
|
|
2901
3016
|
}) {
|
|
2902
|
-
return /* @__PURE__ */ (0,
|
|
2903
|
-
|
|
3017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3018
|
+
import_react_aria_components26.ProgressBar,
|
|
2904
3019
|
{
|
|
2905
3020
|
className: cx("pire-progress", className),
|
|
2906
3021
|
"data-status": status,
|
|
@@ -2910,19 +3025,19 @@ function ProgressBar({
|
|
|
2910
3025
|
maxValue,
|
|
2911
3026
|
isIndeterminate,
|
|
2912
3027
|
style,
|
|
2913
|
-
children: ({ percentage, valueText }) => /* @__PURE__ */ (0,
|
|
2914
|
-
label || showValue ? /* @__PURE__ */ (0,
|
|
2915
|
-
label ? /* @__PURE__ */ (0,
|
|
2916
|
-
showValue && !isIndeterminate ? /* @__PURE__ */ (0,
|
|
3028
|
+
children: ({ percentage, valueText }) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
3029
|
+
label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "pire-progress-head", children: [
|
|
3030
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_aria_components26.Label, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", {}),
|
|
3031
|
+
showValue && !isIndeterminate ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "pire-numeric", children: valueText }) : null
|
|
2917
3032
|
] }) : null,
|
|
2918
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "pire-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "pire-progress-fill", style: { width: `${isIndeterminate ? 40 : percentage}%` } }) })
|
|
2919
3034
|
] })
|
|
2920
3035
|
}
|
|
2921
3036
|
);
|
|
2922
3037
|
}
|
|
2923
3038
|
|
|
2924
3039
|
// src/components/forms/FileUpload.tsx
|
|
2925
|
-
var
|
|
3040
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2926
3041
|
var isImage = (file) => file.type.startsWith("image/");
|
|
2927
3042
|
function formatFileSize(bytes) {
|
|
2928
3043
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -2974,10 +3089,10 @@ function FileUpload({
|
|
|
2974
3089
|
...rest
|
|
2975
3090
|
}) {
|
|
2976
3091
|
const msg = usePireMessages();
|
|
2977
|
-
const [uncontrolled, setUncontrolled] =
|
|
3092
|
+
const [uncontrolled, setUncontrolled] = React22.useState(defaultValue ?? []);
|
|
2978
3093
|
const files = value ?? uncontrolled;
|
|
2979
|
-
const created =
|
|
2980
|
-
|
|
3094
|
+
const created = React22.useRef([]);
|
|
3095
|
+
React22.useEffect(
|
|
2981
3096
|
() => () => {
|
|
2982
3097
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
2983
3098
|
},
|
|
@@ -3000,7 +3115,7 @@ function FileUpload({
|
|
|
3000
3115
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
3001
3116
|
};
|
|
3002
3117
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
3003
|
-
return /* @__PURE__ */ (0,
|
|
3118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
3004
3119
|
"div",
|
|
3005
3120
|
{
|
|
3006
3121
|
className: cx("pire-field", "pire-fileupload", className),
|
|
@@ -3009,24 +3124,24 @@ function FileUpload({
|
|
|
3009
3124
|
"data-invalid": isInvalid ? "true" : void 0,
|
|
3010
3125
|
...rest,
|
|
3011
3126
|
children: [
|
|
3012
|
-
label ? /* @__PURE__ */ (0,
|
|
3127
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "pire-field-label", children: [
|
|
3013
3128
|
label,
|
|
3014
|
-
isRequired ? /* @__PURE__ */ (0,
|
|
3129
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
3015
3130
|
] }) : null,
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3017
|
-
|
|
3131
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3132
|
+
import_react_aria_components27.FileTrigger,
|
|
3018
3133
|
{
|
|
3019
3134
|
acceptedFileTypes,
|
|
3020
3135
|
allowsMultiple,
|
|
3021
3136
|
onSelect: accept,
|
|
3022
|
-
children: /* @__PURE__ */ (0,
|
|
3137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { icon: "paperclip", isDisabled: isDisabled || isReadOnly, children: chooseLabel ?? msg.fileUploadChoose })
|
|
3023
3138
|
}
|
|
3024
3139
|
),
|
|
3025
|
-
files.length ? /* @__PURE__ */ (0,
|
|
3026
|
-
previewUrl ? /* @__PURE__ */ (0,
|
|
3027
|
-
/* @__PURE__ */ (0,
|
|
3028
|
-
/* @__PURE__ */ (0,
|
|
3029
|
-
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0,
|
|
3140
|
+
files.length ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("li", { className: "pire-fileupload-item", children: [
|
|
3141
|
+
previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
3142
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-fileupload-name", children: file.name }),
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
3144
|
+
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3030
3145
|
IconButton,
|
|
3031
3146
|
{
|
|
3032
3147
|
icon: "x",
|
|
@@ -3036,17 +3151,17 @@ function FileUpload({
|
|
|
3036
3151
|
}
|
|
3037
3152
|
)
|
|
3038
3153
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3039
|
-
uploadProgress != null ? /* @__PURE__ */ (0,
|
|
3040
|
-
description ? /* @__PURE__ */ (0,
|
|
3041
|
-
isInvalid && errorMessage ? /* @__PURE__ */ (0,
|
|
3154
|
+
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3155
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_aria_components27.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
3156
|
+
isInvalid && errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
3042
3157
|
]
|
|
3043
3158
|
}
|
|
3044
3159
|
);
|
|
3045
3160
|
}
|
|
3046
3161
|
|
|
3047
3162
|
// src/components/navigation/ShellBar.tsx
|
|
3048
|
-
var
|
|
3049
|
-
var
|
|
3163
|
+
var import_react_aria_components28 = require("react-aria-components");
|
|
3164
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3050
3165
|
var initials2 = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
3051
3166
|
function ShellBar({
|
|
3052
3167
|
launcher,
|
|
@@ -3065,45 +3180,45 @@ function ShellBar({
|
|
|
3065
3180
|
...rest
|
|
3066
3181
|
}) {
|
|
3067
3182
|
const msg = usePireMessages();
|
|
3068
|
-
return /* @__PURE__ */ (0,
|
|
3183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("header", { className: cx("pire-shellbar", className), ...rest, children: [
|
|
3069
3184
|
launcher,
|
|
3070
|
-
onMenu ? /* @__PURE__ */ (0,
|
|
3071
|
-
monogram ? /* @__PURE__ */ (0,
|
|
3072
|
-
product ? /* @__PURE__ */ (0,
|
|
3073
|
-
title ? /* @__PURE__ */ (0,
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3075
|
-
onSearch ? /* @__PURE__ */ (0,
|
|
3185
|
+
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IconButton, { icon: "menu", label: menuLabel, variant: "inverse", size: "sm", onPress: onMenu }) : null,
|
|
3186
|
+
monogram ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
|
|
3187
|
+
product ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-product", children: product }) : null,
|
|
3188
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-title", children: title }) : null,
|
|
3189
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-shellbar-spacer" }),
|
|
3190
|
+
onSearch ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IconButton, { icon: "search", label: searchLabel, variant: "inverse", size: "sm", onPress: onSearch }) : null,
|
|
3076
3191
|
actions,
|
|
3077
3192
|
user && userMenu ? (
|
|
3078
3193
|
// A real button, not the img-role span: the avatar is where "my profile", "switch company"
|
|
3079
3194
|
// and "sign out" live in any ERP, and a span accepts neither focus nor onPress. Popover is
|
|
3080
3195
|
// rendered here rather than expected from the consumer so the panel keeps shell placement.
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3082
|
-
/* @__PURE__ */ (0,
|
|
3083
|
-
|
|
3196
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_aria_components28.MenuTrigger, { children: [
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3198
|
+
import_react_aria_components28.Button,
|
|
3084
3199
|
{
|
|
3085
3200
|
className: "pire-avatar pire-avatar-trigger",
|
|
3086
3201
|
"aria-label": (userMenuLabel ?? msg.shellBarUserMenu).replace("{user}", user),
|
|
3087
3202
|
children: initials2(user)
|
|
3088
3203
|
}
|
|
3089
3204
|
),
|
|
3090
|
-
/* @__PURE__ */ (0,
|
|
3205
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_aria_components28.Popover, { className: "pire-popover", children: userMenu })
|
|
3091
3206
|
] })
|
|
3092
|
-
) : user ? /* @__PURE__ */ (0,
|
|
3207
|
+
) : user ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "pire-avatar", title: user, "aria-label": user, role: "img", children: initials2(user) }) : null
|
|
3093
3208
|
] });
|
|
3094
3209
|
}
|
|
3095
3210
|
|
|
3096
3211
|
// src/components/navigation/SideNav.tsx
|
|
3097
|
-
var
|
|
3098
|
-
var
|
|
3212
|
+
var React23 = __toESM(require("react"), 1);
|
|
3213
|
+
var import_react_aria_components30 = require("react-aria-components");
|
|
3099
3214
|
|
|
3100
3215
|
// src/components/navigation/Menu.tsx
|
|
3101
|
-
var
|
|
3102
|
-
var
|
|
3216
|
+
var import_react_aria_components29 = require("react-aria-components");
|
|
3217
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3103
3218
|
function Menu({ minWidth, className, style, ...rest }) {
|
|
3104
3219
|
const width = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
3105
3220
|
const menuStyle = width == null ? style : { ["--pire-menu-min-w"]: width, ...style };
|
|
3106
|
-
return /* @__PURE__ */ (0,
|
|
3221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components29.Menu, { className: cx("pire-menu", className), style: menuStyle, ...rest });
|
|
3107
3222
|
}
|
|
3108
3223
|
var shortcutKeys = (shortcut) => {
|
|
3109
3224
|
if (shortcut == null) return [];
|
|
@@ -3120,19 +3235,19 @@ function MenuItem({
|
|
|
3120
3235
|
...rest
|
|
3121
3236
|
}) {
|
|
3122
3237
|
const keys = shortcutKeys(shortcut);
|
|
3123
|
-
return /* @__PURE__ */ (0,
|
|
3124
|
-
|
|
3238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
3239
|
+
import_react_aria_components29.MenuItem,
|
|
3125
3240
|
{
|
|
3126
3241
|
className: cx("pire-menu-item", className),
|
|
3127
3242
|
"data-tone": tone === "danger" ? "danger" : void 0,
|
|
3128
3243
|
...rest,
|
|
3129
3244
|
children: [
|
|
3130
|
-
icon ? /* @__PURE__ */ (0,
|
|
3131
|
-
/* @__PURE__ */ (0,
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3133
|
-
description ? /* @__PURE__ */ (0,
|
|
3245
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Icon, { name: icon, size: 16, className: "pire-menu-item-icon" }) : null,
|
|
3246
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "pire-menu-item-body", children: [
|
|
3247
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "pire-menu-item-label", children }),
|
|
3248
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "pire-menu-item-desc", children: description }) : null
|
|
3134
3249
|
] }),
|
|
3135
|
-
keys.length ? /* @__PURE__ */ (0,
|
|
3250
|
+
keys.length ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "pire-menu-item-shortcut", children: keys.map((cap, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3136
3251
|
Kbd,
|
|
3137
3252
|
{
|
|
3138
3253
|
size: "sm",
|
|
@@ -3145,17 +3260,17 @@ function MenuItem({
|
|
|
3145
3260
|
);
|
|
3146
3261
|
}
|
|
3147
3262
|
function MenuSection({ title, children, className, ...rest }) {
|
|
3148
|
-
return /* @__PURE__ */ (0,
|
|
3149
|
-
title ? /* @__PURE__ */ (0,
|
|
3263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_aria_components29.MenuSection, { className: cx("pire-menu-section", className), ...rest, children: [
|
|
3264
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components29.Header, { className: "pire-menu-section-title", children: title }) : null,
|
|
3150
3265
|
children
|
|
3151
3266
|
] });
|
|
3152
3267
|
}
|
|
3153
3268
|
function MenuSeparator({ className }) {
|
|
3154
|
-
return /* @__PURE__ */ (0,
|
|
3269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_aria_components29.Separator, { className: cx("pire-menu-separator", className) });
|
|
3155
3270
|
}
|
|
3156
3271
|
|
|
3157
3272
|
// src/components/navigation/SideNav.tsx
|
|
3158
|
-
var
|
|
3273
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3159
3274
|
function findActiveParent(groups, value) {
|
|
3160
3275
|
if (value == null) return void 0;
|
|
3161
3276
|
for (const group of groups) {
|
|
@@ -3182,10 +3297,10 @@ function SideNav({
|
|
|
3182
3297
|
const msg = usePireMessages();
|
|
3183
3298
|
const activeParent = findActiveParent(groups, value);
|
|
3184
3299
|
const isControlled = expandedIds != null;
|
|
3185
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3300
|
+
const [ownExpanded, setOwnExpanded] = React23.useState(
|
|
3186
3301
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3187
3302
|
);
|
|
3188
|
-
const [lastValue, setLastValue] =
|
|
3303
|
+
const [lastValue, setLastValue] = React23.useState(value);
|
|
3189
3304
|
if (value !== lastValue) {
|
|
3190
3305
|
setLastValue(value);
|
|
3191
3306
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3205,8 +3320,8 @@ function SideNav({
|
|
|
3205
3320
|
};
|
|
3206
3321
|
const renderRow = (item, onPress, isGroup) => {
|
|
3207
3322
|
const selected = !isGroup && item.id === value;
|
|
3208
|
-
const button = /* @__PURE__ */ (0,
|
|
3209
|
-
|
|
3323
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3324
|
+
import_react_aria_components30.Button,
|
|
3210
3325
|
{
|
|
3211
3326
|
className: "pire-sidenav-item",
|
|
3212
3327
|
"data-selected": selected ? "true" : void 0,
|
|
@@ -3215,70 +3330,70 @@ function SideNav({
|
|
|
3215
3330
|
"aria-label": collapsed ? item.label : void 0,
|
|
3216
3331
|
onPress,
|
|
3217
3332
|
children: [
|
|
3218
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
3219
|
-
collapsed ? null : /* @__PURE__ */ (0,
|
|
3220
|
-
item.count != null && !collapsed ? /* @__PURE__ */ (0,
|
|
3333
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3334
|
+
collapsed ? null : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: item.label }),
|
|
3335
|
+
item.count != null && !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "pire-sidenav-count", children: item.count }) : null
|
|
3221
3336
|
]
|
|
3222
3337
|
},
|
|
3223
3338
|
item.id
|
|
3224
3339
|
);
|
|
3225
|
-
return collapsed ? /* @__PURE__ */ (0,
|
|
3340
|
+
return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Tooltip, { label: item.label, placement: "right", children: button }, item.id) : button;
|
|
3226
3341
|
};
|
|
3227
|
-
const renderRailFlyout = (item) => /* @__PURE__ */ (0,
|
|
3228
|
-
/* @__PURE__ */ (0,
|
|
3229
|
-
|
|
3342
|
+
const renderRailFlyout = (item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_aria_components30.MenuTrigger, { children: [
|
|
3343
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3344
|
+
import_react_aria_components30.Button,
|
|
3230
3345
|
{
|
|
3231
3346
|
className: "pire-sidenav-item",
|
|
3232
3347
|
"aria-label": item.label,
|
|
3233
3348
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3234
|
-
children: item.icon ? /* @__PURE__ */ (0,
|
|
3349
|
+
children: item.icon ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: item.icon, size: 16 }) : null
|
|
3235
3350
|
}
|
|
3236
3351
|
),
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components30.Popover, { className: "pire-popover", placement: "right top", offset: 4, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3238
3353
|
Menu,
|
|
3239
3354
|
{
|
|
3240
3355
|
"aria-label": item.label,
|
|
3241
3356
|
className: "pire-sidenav-flyout",
|
|
3242
3357
|
onAction: (key) => onChange?.(String(key)),
|
|
3243
|
-
children: (item.items ?? []).map((child) => /* @__PURE__ */ (0,
|
|
3358
|
+
children: (item.items ?? []).map((child) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuItem, { id: child.id, children: child.label }, child.id))
|
|
3244
3359
|
}
|
|
3245
3360
|
) })
|
|
3246
3361
|
] }, item.id);
|
|
3247
|
-
const renderSection = (item) => /* @__PURE__ */ (0,
|
|
3248
|
-
/* @__PURE__ */ (0,
|
|
3249
|
-
|
|
3362
|
+
const renderSection = (item) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_aria_components30.Disclosure, { id: item.id, className: "pire-sidenav-section", children: [
|
|
3363
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3364
|
+
import_react_aria_components30.Button,
|
|
3250
3365
|
{
|
|
3251
3366
|
slot: "trigger",
|
|
3252
3367
|
className: "pire-sidenav-item",
|
|
3253
3368
|
"data-kind": "group",
|
|
3254
3369
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3255
3370
|
children: [
|
|
3256
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
3257
|
-
/* @__PURE__ */ (0,
|
|
3258
|
-
item.count != null ? /* @__PURE__ */ (0,
|
|
3259
|
-
/* @__PURE__ */ (0,
|
|
3371
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3372
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: item.label }),
|
|
3373
|
+
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "pire-sidenav-count", children: item.count }) : null,
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "chevron-down", size: 16, className: "pire-sidenav-chevron" })
|
|
3260
3375
|
]
|
|
3261
3376
|
}
|
|
3262
3377
|
),
|
|
3263
|
-
/* @__PURE__ */ (0,
|
|
3378
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_aria_components30.DisclosurePanel, { className: "pire-sidenav-subnav", children: item.items?.map((child) => {
|
|
3264
3379
|
const selected = child.id === value;
|
|
3265
|
-
return /* @__PURE__ */ (0,
|
|
3266
|
-
|
|
3380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3381
|
+
import_react_aria_components30.Button,
|
|
3267
3382
|
{
|
|
3268
3383
|
className: "pire-sidenav-item pire-sidenav-subitem",
|
|
3269
3384
|
"data-selected": selected ? "true" : void 0,
|
|
3270
3385
|
"aria-current": selected ? "page" : void 0,
|
|
3271
3386
|
onPress: () => onChange?.(child.id),
|
|
3272
3387
|
children: [
|
|
3273
|
-
/* @__PURE__ */ (0,
|
|
3274
|
-
child.count != null ? /* @__PURE__ */ (0,
|
|
3388
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { children: child.label }),
|
|
3389
|
+
child.count != null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "pire-sidenav-count", children: child.count }) : null
|
|
3275
3390
|
]
|
|
3276
3391
|
},
|
|
3277
3392
|
child.id
|
|
3278
3393
|
);
|
|
3279
3394
|
}) })
|
|
3280
3395
|
] }, item.id);
|
|
3281
|
-
return /* @__PURE__ */ (0,
|
|
3396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3282
3397
|
"nav",
|
|
3283
3398
|
{
|
|
3284
3399
|
className: cx("pire-sidenav", className),
|
|
@@ -3295,10 +3410,10 @@ function SideNav({
|
|
|
3295
3410
|
if (isGroup && collapsed && railFlyout) return renderRailFlyout(item);
|
|
3296
3411
|
return renderRow(item, () => isGroup ? toggleExpanded(item.id) : onChange?.(item.id), isGroup);
|
|
3297
3412
|
});
|
|
3298
|
-
return /* @__PURE__ */ (0,
|
|
3299
|
-
group.label && !collapsed ? /* @__PURE__ */ (0,
|
|
3300
|
-
hasSections ? /* @__PURE__ */ (0,
|
|
3301
|
-
|
|
3413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "pire-sidenav-group", children: [
|
|
3414
|
+
group.label && !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pire-sidenav-label", children: group.label }) : null,
|
|
3415
|
+
hasSections ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3416
|
+
import_react_aria_components30.DisclosureGroup,
|
|
3302
3417
|
{
|
|
3303
3418
|
className: "pire-sidenav-tree",
|
|
3304
3419
|
allowsMultipleExpanded: true,
|
|
@@ -3309,44 +3424,44 @@ function SideNav({
|
|
|
3309
3424
|
) : rows
|
|
3310
3425
|
] }, group.label ?? gi);
|
|
3311
3426
|
}),
|
|
3312
|
-
footer ? /* @__PURE__ */ (0,
|
|
3427
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pire-sidenav-footer", children: footer }) : null
|
|
3313
3428
|
]
|
|
3314
3429
|
}
|
|
3315
3430
|
);
|
|
3316
3431
|
}
|
|
3317
3432
|
|
|
3318
3433
|
// src/components/navigation/ShellRail.tsx
|
|
3319
|
-
var
|
|
3320
|
-
var
|
|
3321
|
-
var
|
|
3434
|
+
var React24 = __toESM(require("react"), 1);
|
|
3435
|
+
var import_react_aria_components31 = require("react-aria-components");
|
|
3436
|
+
var import_jsx_runtime43 = (
|
|
3322
3437
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
3323
3438
|
// scrolling zone would carry its own rule out of view on the first wheel event.
|
|
3324
3439
|
require("react/jsx-runtime")
|
|
3325
3440
|
);
|
|
3326
3441
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
3327
3442
|
const msg = usePireMessages();
|
|
3328
|
-
return /* @__PURE__ */ (0,
|
|
3329
|
-
gi > 0 ? /* @__PURE__ */ (0,
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3331
|
-
|
|
3443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(React24.Fragment, { children: [
|
|
3444
|
+
gi > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "pire-shellrail-divider" }) : null,
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3446
|
+
import_react_aria_components31.Button,
|
|
3332
3447
|
{
|
|
3333
3448
|
className: "pire-shellrail-item",
|
|
3334
3449
|
"aria-label": item.label,
|
|
3335
3450
|
"data-selected": item.id === value ? "true" : void 0,
|
|
3336
3451
|
"aria-current": item.id === value ? "true" : void 0,
|
|
3337
3452
|
onPress: () => onChange?.(item.id),
|
|
3338
|
-
children: /* @__PURE__ */ (0,
|
|
3453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "pire-shellrail-tile", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: item.icon, size: 20 }) })
|
|
3339
3454
|
}
|
|
3340
3455
|
) }, item.id)) })
|
|
3341
3456
|
] }, group.items[0]?.id ?? gi)) });
|
|
3342
3457
|
}
|
|
3343
3458
|
|
|
3344
3459
|
// src/components/navigation/Tabs.tsx
|
|
3345
|
-
var
|
|
3346
|
-
var
|
|
3460
|
+
var import_react_aria_components32 = require("react-aria-components");
|
|
3461
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3347
3462
|
function Tabs({ items, value, defaultValue, onChange, panels, className, style, ...rest }) {
|
|
3348
|
-
return /* @__PURE__ */ (0,
|
|
3349
|
-
|
|
3463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3464
|
+
import_react_aria_components32.Tabs,
|
|
3350
3465
|
{
|
|
3351
3466
|
className,
|
|
3352
3467
|
style,
|
|
@@ -3354,23 +3469,23 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
|
|
|
3354
3469
|
defaultSelectedKey: defaultValue,
|
|
3355
3470
|
onSelectionChange: (k) => onChange?.(String(k)),
|
|
3356
3471
|
children: [
|
|
3357
|
-
/* @__PURE__ */ (0,
|
|
3358
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
3472
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_aria_components32.TabList, { className: "pire-tablist", items, "aria-label": rest["aria-label"] ?? "Views", children: (item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_aria_components32.Tab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
|
|
3473
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: item.icon, size: 16 }) : null,
|
|
3359
3474
|
item.label,
|
|
3360
|
-
item.count != null ? /* @__PURE__ */ (0,
|
|
3475
|
+
item.count != null ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "pire-tab-count", children: item.count }) : null
|
|
3361
3476
|
] }) }),
|
|
3362
|
-
items.map((item) => /* @__PURE__ */ (0,
|
|
3477
|
+
items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_aria_components32.TabPanel, { id: item.id, className: panels ? "pire-tabpanel" : void 0, children: panels?.[item.id] }, item.id))
|
|
3363
3478
|
]
|
|
3364
3479
|
}
|
|
3365
3480
|
);
|
|
3366
3481
|
}
|
|
3367
3482
|
|
|
3368
3483
|
// src/components/navigation/Breadcrumb.tsx
|
|
3369
|
-
var
|
|
3370
|
-
var
|
|
3484
|
+
var import_react_aria_components33 = require("react-aria-components");
|
|
3485
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3371
3486
|
function Breadcrumb({ items, onNavigate, className, style }) {
|
|
3372
|
-
return /* @__PURE__ */ (0,
|
|
3373
|
-
|
|
3487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3488
|
+
import_react_aria_components33.Breadcrumbs,
|
|
3374
3489
|
{
|
|
3375
3490
|
className: cx("pire-breadcrumbs", className),
|
|
3376
3491
|
style,
|
|
@@ -3378,9 +3493,9 @@ function Breadcrumb({ items, onNavigate, className, style }) {
|
|
|
3378
3493
|
onAction: (key) => onNavigate?.(String(key)),
|
|
3379
3494
|
children: (item) => {
|
|
3380
3495
|
const last = items[items.length - 1] === item;
|
|
3381
|
-
return /* @__PURE__ */ (0,
|
|
3382
|
-
last ? item.label : /* @__PURE__ */ (0,
|
|
3383
|
-
last ? null : /* @__PURE__ */ (0,
|
|
3496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_aria_components33.Breadcrumb, { className: "pire-breadcrumb", id: item.id ?? item.label, children: [
|
|
3497
|
+
last ? item.label : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_aria_components33.Link, { href: item.href, children: item.label }),
|
|
3498
|
+
last ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: "chevron-right", size: 12, style: { color: "var(--text-tertiary)" } })
|
|
3384
3499
|
] });
|
|
3385
3500
|
}
|
|
3386
3501
|
}
|
|
@@ -3388,7 +3503,7 @@ function Breadcrumb({ items, onNavigate, className, style }) {
|
|
|
3388
3503
|
}
|
|
3389
3504
|
|
|
3390
3505
|
// src/components/navigation/Pagination.tsx
|
|
3391
|
-
var
|
|
3506
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3392
3507
|
function Pagination({
|
|
3393
3508
|
page = 1,
|
|
3394
3509
|
pageSize = 25,
|
|
@@ -3403,9 +3518,9 @@ function Pagination({
|
|
|
3403
3518
|
const pages = Math.max(1, Math.ceil(total / pageSize));
|
|
3404
3519
|
const from = total === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
3405
3520
|
const to = Math.min(total, page * pageSize);
|
|
3406
|
-
return /* @__PURE__ */ (0,
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3408
|
-
/* @__PURE__ */ (0,
|
|
3521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("nav", { className: cx("pire-pagination", className), style, "aria-label": msg.paginationLabel, children: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "pire-pagination-count", children: msg.paginationRange.replace("{from}", from.toLocaleString()).replace("{to}", to.toLocaleString()).replace("{total}", total.toLocaleString()) }),
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3409
3524
|
IconButton,
|
|
3410
3525
|
{
|
|
3411
3526
|
icon: "chevron-left",
|
|
@@ -3416,8 +3531,8 @@ function Pagination({
|
|
|
3416
3531
|
onPress: () => onPageChange?.(page - 1)
|
|
3417
3532
|
}
|
|
3418
3533
|
),
|
|
3419
|
-
/* @__PURE__ */ (0,
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3534
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "pire-pagination-count", "aria-live": "polite", children: msg.paginationPageOf.replace("{page}", String(page)).replace("{pages}", String(pages)) }),
|
|
3535
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3421
3536
|
IconButton,
|
|
3422
3537
|
{
|
|
3423
3538
|
icon: "chevron-right",
|
|
@@ -3428,7 +3543,7 @@ function Pagination({
|
|
|
3428
3543
|
onPress: () => onPageChange?.(page + 1)
|
|
3429
3544
|
}
|
|
3430
3545
|
),
|
|
3431
|
-
onPageSizeChange ? /* @__PURE__ */ (0,
|
|
3546
|
+
onPageSizeChange ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3432
3547
|
Select,
|
|
3433
3548
|
{
|
|
3434
3549
|
"aria-label": msg.paginationRowsPerPage,
|
|
@@ -3444,9 +3559,9 @@ function Pagination({
|
|
|
3444
3559
|
}
|
|
3445
3560
|
|
|
3446
3561
|
// src/components/navigation/Ribbon.tsx
|
|
3447
|
-
var
|
|
3448
|
-
var
|
|
3449
|
-
var
|
|
3562
|
+
var React25 = __toESM(require("react"), 1);
|
|
3563
|
+
var import_react_aria_components34 = require("react-aria-components");
|
|
3564
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3450
3565
|
var outside = (what, parent) => {
|
|
3451
3566
|
const Config = () => {
|
|
3452
3567
|
throw new Error(`[pire] ${what} must be a child of ${parent}.`);
|
|
@@ -3460,7 +3575,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
3460
3575
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
3461
3576
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
3462
3577
|
function describe(child) {
|
|
3463
|
-
if (!
|
|
3578
|
+
if (!React25.isValidElement(child)) return JSON.stringify(child);
|
|
3464
3579
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
3465
3580
|
const type = child.type;
|
|
3466
3581
|
return type?.displayName || type?.name || "a component";
|
|
@@ -3468,13 +3583,13 @@ function describe(child) {
|
|
|
3468
3583
|
function childrenOfType(children, type, what, parent) {
|
|
3469
3584
|
const out = [];
|
|
3470
3585
|
const walk = (nodes, path) => {
|
|
3471
|
-
|
|
3586
|
+
React25.Children.forEach(nodes, (child, i) => {
|
|
3472
3587
|
if (child == null || typeof child === "boolean") return;
|
|
3473
|
-
if (
|
|
3588
|
+
if (React25.isValidElement(child) && child.type === React25.Fragment) {
|
|
3474
3589
|
return walk(child.props.children, `${path}${i}.`);
|
|
3475
3590
|
}
|
|
3476
|
-
if (!
|
|
3477
|
-
const isWrapper =
|
|
3591
|
+
if (!React25.isValidElement(child) || child.type !== type) {
|
|
3592
|
+
const isWrapper = React25.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
3478
3593
|
throw new Error(
|
|
3479
3594
|
`[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.` : "")
|
|
3480
3595
|
);
|
|
@@ -3508,16 +3623,16 @@ function Command({
|
|
|
3508
3623
|
}) {
|
|
3509
3624
|
const size = inBar ? "sm" : command.size ?? "sm";
|
|
3510
3625
|
const isDisabled = command.isDisabled || command.requiresSelection === true && selectionCount === 0;
|
|
3511
|
-
return /* @__PURE__ */ (0,
|
|
3512
|
-
|
|
3626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3627
|
+
import_react_aria_components34.Button,
|
|
3513
3628
|
{
|
|
3514
3629
|
className: "pire-ribbon-command",
|
|
3515
3630
|
"data-size": size,
|
|
3516
3631
|
isDisabled,
|
|
3517
3632
|
onPress: command.onPress,
|
|
3518
3633
|
children: [
|
|
3519
|
-
command.icon ? /* @__PURE__ */ (0,
|
|
3520
|
-
/* @__PURE__ */ (0,
|
|
3634
|
+
command.icon ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: command.icon, size: size === "lg" ? 20 : 16 }) : null,
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "pire-ribbon-command-label", children: command.label })
|
|
3521
3636
|
]
|
|
3522
3637
|
}
|
|
3523
3638
|
);
|
|
@@ -3525,18 +3640,18 @@ function Command({
|
|
|
3525
3640
|
function Group8({ group, selectionCount }) {
|
|
3526
3641
|
const large = group.commands.filter((c) => (c.size ?? "sm") === "lg");
|
|
3527
3642
|
const small = group.commands.filter((c) => (c.size ?? "sm") !== "lg");
|
|
3528
|
-
return /* @__PURE__ */ (0,
|
|
3529
|
-
/* @__PURE__ */ (0,
|
|
3530
|
-
large.map((c) => /* @__PURE__ */ (0,
|
|
3531
|
-
small.length ? /* @__PURE__ */ (0,
|
|
3643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "pire-ribbon-group", role: "group", "aria-label": group.caption, children: [
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "pire-ribbon-group-body", children: [
|
|
3645
|
+
large.map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Command, { command: c, selectionCount }, c.key)),
|
|
3646
|
+
small.length ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "pire-ribbon-stack", children: small.map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Command, { command: c, selectionCount }, c.key)) }) : null
|
|
3532
3647
|
] }),
|
|
3533
|
-
/* @__PURE__ */ (0,
|
|
3648
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "pire-ribbon-caption", "aria-hidden": "true", children: group.caption })
|
|
3534
3649
|
] });
|
|
3535
3650
|
}
|
|
3536
3651
|
function useTrailingOverflow() {
|
|
3537
|
-
const ref =
|
|
3538
|
-
const [overflow, setOverflow] =
|
|
3539
|
-
|
|
3652
|
+
const ref = React25.useRef(null);
|
|
3653
|
+
const [overflow, setOverflow] = React25.useState(false);
|
|
3654
|
+
React25.useEffect(() => {
|
|
3540
3655
|
const node = ref.current;
|
|
3541
3656
|
if (!node) return;
|
|
3542
3657
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -3561,9 +3676,9 @@ function Surface({
|
|
|
3561
3676
|
}) {
|
|
3562
3677
|
const [scrollRef, overflow] = useTrailingOverflow();
|
|
3563
3678
|
const domId = id ? { id } : {};
|
|
3564
|
-
return /* @__PURE__ */ (0,
|
|
3565
|
-
/* @__PURE__ */ (0,
|
|
3566
|
-
/* @__PURE__ */ (0,
|
|
3679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_aria_components34.Toolbar, { ...domId, className, "aria-label": label, children: [
|
|
3680
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "pire-ribbon-scroll", ref: scrollRef, children }),
|
|
3681
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "pire-ribbon-trail", "data-overflow": overflow ? "true" : void 0, children: trailing })
|
|
3567
3682
|
] });
|
|
3568
3683
|
}
|
|
3569
3684
|
function barBlocks(tabs) {
|
|
@@ -3596,18 +3711,18 @@ function Ribbon({
|
|
|
3596
3711
|
const count = selectionCount ?? 0;
|
|
3597
3712
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
3598
3713
|
const fallback = visible[0]?.id;
|
|
3599
|
-
const [ownTab, setOwnTab] =
|
|
3714
|
+
const [ownTab, setOwnTab] = React25.useState(defaultValue);
|
|
3600
3715
|
const requested = value ?? ownTab;
|
|
3601
3716
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
3602
|
-
const select =
|
|
3717
|
+
const select = React25.useCallback(
|
|
3603
3718
|
(id) => {
|
|
3604
3719
|
setOwnTab(id);
|
|
3605
3720
|
onChange?.(id);
|
|
3606
3721
|
},
|
|
3607
3722
|
[onChange]
|
|
3608
3723
|
);
|
|
3609
|
-
const hadSelection =
|
|
3610
|
-
|
|
3724
|
+
const hadSelection = React25.useRef(false);
|
|
3725
|
+
React25.useEffect(() => {
|
|
3611
3726
|
const has = count > 0;
|
|
3612
3727
|
if (has === hadSelection.current) return;
|
|
3613
3728
|
hadSelection.current = has;
|
|
@@ -3616,18 +3731,18 @@ function Ribbon({
|
|
|
3616
3731
|
if (has) select(contextual.id);
|
|
3617
3732
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
3618
3733
|
}, [count, tabs, requested, select]);
|
|
3619
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
3734
|
+
const [ownCollapsed, setOwnCollapsed] = React25.useState(false);
|
|
3620
3735
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
3621
|
-
const toggleRef =
|
|
3622
|
-
const restoreFocus =
|
|
3623
|
-
|
|
3736
|
+
const toggleRef = React25.useRef(null);
|
|
3737
|
+
const restoreFocus = React25.useRef(false);
|
|
3738
|
+
React25.useLayoutEffect(() => {
|
|
3624
3739
|
if (!restoreFocus.current) return;
|
|
3625
3740
|
restoreFocus.current = false;
|
|
3626
3741
|
toggleRef.current?.focus();
|
|
3627
3742
|
});
|
|
3628
|
-
const bandId =
|
|
3629
|
-
const toggle = /* @__PURE__ */ (0,
|
|
3630
|
-
|
|
3743
|
+
const bandId = React25.useId();
|
|
3744
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3745
|
+
import_react_aria_components34.Button,
|
|
3631
3746
|
{
|
|
3632
3747
|
ref: toggleRef,
|
|
3633
3748
|
className: "pire-ribbon-toggle",
|
|
@@ -3639,33 +3754,33 @@ function Ribbon({
|
|
|
3639
3754
|
setOwnCollapsed(!collapsed);
|
|
3640
3755
|
onCollapsedChange?.(!collapsed);
|
|
3641
3756
|
},
|
|
3642
|
-
children: /* @__PURE__ */ (0,
|
|
3757
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: collapsed ? "chevron-down" : "chevron-up", size: 16 })
|
|
3643
3758
|
}
|
|
3644
3759
|
);
|
|
3645
3760
|
if (collapsed) {
|
|
3646
3761
|
const blocks = barBlocks(tabs);
|
|
3647
|
-
return /* @__PURE__ */ (0,
|
|
3762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3648
3763
|
Surface,
|
|
3649
3764
|
{
|
|
3650
3765
|
className: "pire-ribbon-bar",
|
|
3651
3766
|
label: rest["aria-label"],
|
|
3652
|
-
trailing: /* @__PURE__ */ (0,
|
|
3767
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3653
3768
|
actions,
|
|
3654
3769
|
toggle
|
|
3655
3770
|
] }),
|
|
3656
3771
|
children: [
|
|
3657
|
-
leading ? /* @__PURE__ */ (0,
|
|
3658
|
-
blocks.map((block, i) => /* @__PURE__ */ (0,
|
|
3659
|
-
i > 0 || leading ? /* @__PURE__ */ (0,
|
|
3660
|
-
block.commands.map((c) => /* @__PURE__ */ (0,
|
|
3772
|
+
leading ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
3773
|
+
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(React25.Fragment, { children: [
|
|
3774
|
+
i > 0 || leading ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
3775
|
+
block.commands.map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
3661
3776
|
] }, block.key))
|
|
3662
3777
|
]
|
|
3663
3778
|
}
|
|
3664
3779
|
) });
|
|
3665
3780
|
}
|
|
3666
|
-
return /* @__PURE__ */ (0,
|
|
3667
|
-
/* @__PURE__ */ (0,
|
|
3668
|
-
|
|
3781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_aria_components34.Tabs, { selectedKey: selected, onSelectionChange: (k) => select(String(k)), children: [
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_aria_components34.TabList, { className: "pire-ribbon-tablist", "aria-label": rest["aria-label"], children: visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3783
|
+
import_react_aria_components34.Tab,
|
|
3669
3784
|
{
|
|
3670
3785
|
id: tab.id,
|
|
3671
3786
|
className: "pire-ribbon-tab",
|
|
@@ -3674,17 +3789,17 @@ function Ribbon({
|
|
|
3674
3789
|
},
|
|
3675
3790
|
tab.key
|
|
3676
3791
|
)) }),
|
|
3677
|
-
visible.map((tab) => /* @__PURE__ */ (0,
|
|
3792
|
+
visible.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_aria_components34.TabPanel, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3678
3793
|
Surface,
|
|
3679
3794
|
{
|
|
3680
3795
|
id: bandId,
|
|
3681
3796
|
className: "pire-ribbon-band",
|
|
3682
3797
|
label: msg.ribbonLabel,
|
|
3683
|
-
trailing: /* @__PURE__ */ (0,
|
|
3798
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3684
3799
|
actions,
|
|
3685
3800
|
toggle
|
|
3686
3801
|
] }),
|
|
3687
|
-
children: tab.groups.map((group) => /* @__PURE__ */ (0,
|
|
3802
|
+
children: tab.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Group8, { group, selectionCount: count }, group.key))
|
|
3688
3803
|
}
|
|
3689
3804
|
) }, tab.key))
|
|
3690
3805
|
] }) });
|
|
@@ -3694,7 +3809,7 @@ Ribbon.Group = RibbonGroup;
|
|
|
3694
3809
|
Ribbon.Command = RibbonCommand;
|
|
3695
3810
|
|
|
3696
3811
|
// src/components/feedback/InlineMessage.tsx
|
|
3697
|
-
var
|
|
3812
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3698
3813
|
var KIND_ICON = {
|
|
3699
3814
|
info: "info",
|
|
3700
3815
|
success: "check-circle-2",
|
|
@@ -3712,7 +3827,7 @@ function InlineMessage({
|
|
|
3712
3827
|
}) {
|
|
3713
3828
|
const msg = usePireMessages();
|
|
3714
3829
|
const assertive = kind === "error" || kind === "warning";
|
|
3715
|
-
return /* @__PURE__ */ (0,
|
|
3830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3716
3831
|
"div",
|
|
3717
3832
|
{
|
|
3718
3833
|
className: cx("pire-msg", className),
|
|
@@ -3721,21 +3836,21 @@ function InlineMessage({
|
|
|
3721
3836
|
"aria-live": assertive ? "assertive" : "polite",
|
|
3722
3837
|
...rest,
|
|
3723
3838
|
children: [
|
|
3724
|
-
/* @__PURE__ */ (0,
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3726
|
-
title ? /* @__PURE__ */ (0,
|
|
3727
|
-
children ? /* @__PURE__ */ (0,
|
|
3839
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: KIND_ICON[kind], size: 16, style: { marginTop: 2 } }),
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "var(--sp-1)" }, children: [
|
|
3841
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pire-msg-title", children: title }) : null,
|
|
3842
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "pire-msg-body", children }) : null,
|
|
3728
3843
|
action
|
|
3729
3844
|
] }),
|
|
3730
|
-
onClose ? /* @__PURE__ */ (0,
|
|
3845
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(IconButton, { icon: "x", label: msg.inlineMessageDismiss, size: "sm", onPress: onClose }) : null
|
|
3731
3846
|
]
|
|
3732
3847
|
}
|
|
3733
3848
|
);
|
|
3734
3849
|
}
|
|
3735
3850
|
|
|
3736
3851
|
// src/components/feedback/Toast.tsx
|
|
3737
|
-
var
|
|
3738
|
-
var
|
|
3852
|
+
var React26 = __toESM(require("react"), 1);
|
|
3853
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3739
3854
|
var KIND_ICON2 = {
|
|
3740
3855
|
info: "info",
|
|
3741
3856
|
success: "check-circle-2",
|
|
@@ -3751,7 +3866,7 @@ function Toast({
|
|
|
3751
3866
|
...rest
|
|
3752
3867
|
}) {
|
|
3753
3868
|
const msg = usePireMessages();
|
|
3754
|
-
return /* @__PURE__ */ (0,
|
|
3869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3755
3870
|
"div",
|
|
3756
3871
|
{
|
|
3757
3872
|
className: cx("pire-toast", className),
|
|
@@ -3760,22 +3875,22 @@ function Toast({
|
|
|
3760
3875
|
"aria-live": kind === "error" ? "assertive" : "polite",
|
|
3761
3876
|
...rest,
|
|
3762
3877
|
children: [
|
|
3763
|
-
/* @__PURE__ */ (0,
|
|
3764
|
-
/* @__PURE__ */ (0,
|
|
3765
|
-
onClose ? /* @__PURE__ */ (0,
|
|
3878
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { name: KIND_ICON2[kind], size: 16 }),
|
|
3879
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { style: { flex: 1 }, children }),
|
|
3880
|
+
onClose ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(IconButton, { icon: "x", label: msg.toastDismiss, size: "sm", variant: "inverse", onPress: onClose }) : null
|
|
3766
3881
|
]
|
|
3767
3882
|
}
|
|
3768
3883
|
);
|
|
3769
3884
|
}
|
|
3770
|
-
var ToastContext =
|
|
3885
|
+
var ToastContext = React26.createContext(null);
|
|
3771
3886
|
function ToastProvider({
|
|
3772
3887
|
children,
|
|
3773
3888
|
timeout = 6e3
|
|
3774
3889
|
}) {
|
|
3775
3890
|
const msg = usePireMessages();
|
|
3776
|
-
const [toasts, setToasts] =
|
|
3777
|
-
const close =
|
|
3778
|
-
const add =
|
|
3891
|
+
const [toasts, setToasts] = React26.useState([]);
|
|
3892
|
+
const close = React26.useCallback((id) => setToasts((t) => t.filter((x) => x.id !== id)), []);
|
|
3893
|
+
const add = React26.useCallback(
|
|
3779
3894
|
(toast) => {
|
|
3780
3895
|
const id = Math.random().toString(36).slice(2);
|
|
3781
3896
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
@@ -3785,10 +3900,10 @@ function ToastProvider({
|
|
|
3785
3900
|
},
|
|
3786
3901
|
[close, timeout]
|
|
3787
3902
|
);
|
|
3788
|
-
const value =
|
|
3789
|
-
return /* @__PURE__ */ (0,
|
|
3903
|
+
const value = React26.useMemo(() => ({ add, close }), [add, close]);
|
|
3904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(ToastContext.Provider, { value, children: [
|
|
3790
3905
|
children,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3906
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3792
3907
|
Toast,
|
|
3793
3908
|
{
|
|
3794
3909
|
kind: t.kind,
|
|
@@ -3801,14 +3916,14 @@ function ToastProvider({
|
|
|
3801
3916
|
] });
|
|
3802
3917
|
}
|
|
3803
3918
|
function useToast() {
|
|
3804
|
-
const ctx =
|
|
3919
|
+
const ctx = React26.useContext(ToastContext);
|
|
3805
3920
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
3806
3921
|
return ctx;
|
|
3807
3922
|
}
|
|
3808
3923
|
|
|
3809
3924
|
// src/components/data/KpiTile.tsx
|
|
3810
|
-
var
|
|
3811
|
-
var
|
|
3925
|
+
var import_react_aria_components35 = require("react-aria-components");
|
|
3926
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3812
3927
|
function KpiTile({
|
|
3813
3928
|
label,
|
|
3814
3929
|
value,
|
|
@@ -3824,27 +3939,27 @@ function KpiTile({
|
|
|
3824
3939
|
style
|
|
3825
3940
|
}) {
|
|
3826
3941
|
const tone = deltaTone ?? (deltaDirection === "down" ? "negative" : "positive");
|
|
3827
|
-
const body = /* @__PURE__ */ (0,
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3829
|
-
icon ? /* @__PURE__ */ (0,
|
|
3942
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "pire-kpi-label", children: [
|
|
3944
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Icon, { name: icon, size: 16 }) : null,
|
|
3830
3945
|
label
|
|
3831
3946
|
] }),
|
|
3832
|
-
/* @__PURE__ */ (0,
|
|
3947
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "pire-kpi-value", children: [
|
|
3833
3948
|
value,
|
|
3834
|
-
unit ? /* @__PURE__ */ (0,
|
|
3949
|
+
unit ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "pire-kpi-unit", children: unit }) : null
|
|
3835
3950
|
] }),
|
|
3836
|
-
delta ? /* @__PURE__ */ (0,
|
|
3837
|
-
deltaDirection ? /* @__PURE__ */ (0,
|
|
3951
|
+
delta ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "pire-kpi-delta", "data-tone": tone, children: [
|
|
3952
|
+
deltaDirection ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Icon, { name: deltaDirection === "up" ? "trending-up" : "trending-down", size: 12 }) : null,
|
|
3838
3953
|
delta
|
|
3839
3954
|
] }) : null,
|
|
3840
|
-
footnote ? /* @__PURE__ */ (0,
|
|
3955
|
+
footnote ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "pire-kpi-foot", children: footnote }) : null
|
|
3841
3956
|
] });
|
|
3842
3957
|
const props = { className: cx("pire-kpi", className), "data-status": status, style };
|
|
3843
|
-
return onPress ? /* @__PURE__ */ (0,
|
|
3958
|
+
return onPress ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react_aria_components35.Button, { ...props, "data-pressable": "true", onPress, children: body }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { ...props, children: body });
|
|
3844
3959
|
}
|
|
3845
3960
|
|
|
3846
3961
|
// src/components/data/ObjectHeader.tsx
|
|
3847
|
-
var
|
|
3962
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3848
3963
|
function ObjectHeader({
|
|
3849
3964
|
title,
|
|
3850
3965
|
subtitle,
|
|
@@ -3856,22 +3971,22 @@ function ObjectHeader({
|
|
|
3856
3971
|
className,
|
|
3857
3972
|
...rest
|
|
3858
3973
|
}) {
|
|
3859
|
-
return /* @__PURE__ */ (0,
|
|
3974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("header", { className: cx("pire-objheader", className), ...rest, children: [
|
|
3860
3975
|
breadcrumb,
|
|
3861
|
-
/* @__PURE__ */ (0,
|
|
3862
|
-
/* @__PURE__ */ (0,
|
|
3863
|
-
/* @__PURE__ */ (0,
|
|
3864
|
-
subtitle || id ? /* @__PURE__ */ (0,
|
|
3976
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "pire-objheader-row", children: [
|
|
3977
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
3978
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h1", { className: "pire-objheader-title", children: title }),
|
|
3979
|
+
subtitle || id ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "pire-objheader-sub", children: [
|
|
3865
3980
|
subtitle,
|
|
3866
|
-
id ? /* @__PURE__ */ (0,
|
|
3981
|
+
id ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "pire-objheader-id", children: id }) : null
|
|
3867
3982
|
] }) : null
|
|
3868
3983
|
] }),
|
|
3869
3984
|
badge,
|
|
3870
|
-
actions ? /* @__PURE__ */ (0,
|
|
3985
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "pire-objheader-actions", children: actions }) : null
|
|
3871
3986
|
] }),
|
|
3872
|
-
facts?.length ? /* @__PURE__ */ (0,
|
|
3873
|
-
/* @__PURE__ */ (0,
|
|
3874
|
-
/* @__PURE__ */ (0,
|
|
3987
|
+
facts?.length ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("dl", { className: "pire-facts", style: { margin: 0 }, children: facts.map((fact) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
|
|
3988
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("dt", { className: "pire-fact-label", children: fact.label }),
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3875
3990
|
"dd",
|
|
3876
3991
|
{
|
|
3877
3992
|
className: "pire-fact-value",
|
|
@@ -3885,7 +4000,7 @@ function ObjectHeader({
|
|
|
3885
4000
|
}
|
|
3886
4001
|
|
|
3887
4002
|
// src/components/data/FilterBar.tsx
|
|
3888
|
-
var
|
|
4003
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3889
4004
|
function FilterBar({
|
|
3890
4005
|
children,
|
|
3891
4006
|
activeFilters = [],
|
|
@@ -3902,22 +4017,22 @@ function FilterBar({
|
|
|
3902
4017
|
const label = useMessage("filterBarLabel", rest["aria-label"]);
|
|
3903
4018
|
const go = useMessage("filterBarGo", goLabel);
|
|
3904
4019
|
const clearAll = useMessage("filterBarClearAll", clearAllLabel);
|
|
3905
|
-
return /* @__PURE__ */ (0,
|
|
3906
|
-
/* @__PURE__ */ (0,
|
|
4020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("section", { className: cx("pire-filterbar", className), ...rest, "aria-label": label, children: [
|
|
4021
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "pire-filterbar-controls", children: [
|
|
3907
4022
|
children,
|
|
3908
|
-
onGo ? /* @__PURE__ */ (0,
|
|
4023
|
+
onGo ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Button, { variant: "primary", onPress: onGo, children: go }) : null
|
|
3909
4024
|
] }),
|
|
3910
|
-
activeFilters.length || resultLabel || actions ? /* @__PURE__ */ (0,
|
|
3911
|
-
activeFilters.map((filter) => /* @__PURE__ */ (0,
|
|
3912
|
-
activeFilters.length && onClear ? /* @__PURE__ */ (0,
|
|
3913
|
-
resultLabel ? /* @__PURE__ */ (0,
|
|
3914
|
-
actions ? /* @__PURE__ */ (0,
|
|
4025
|
+
activeFilters.length || resultLabel || actions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "pire-filterbar-foot", children: [
|
|
4026
|
+
activeFilters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Tag, { onRemove: onRemoveFilter ? () => onRemoveFilter(filter.id) : void 0, children: filter.label }, filter.id)),
|
|
4027
|
+
activeFilters.length && onClear ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Button, { variant: "tertiary", size: "sm", onPress: onClear, children: clearAll }) : null,
|
|
4028
|
+
resultLabel ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "pire-filterbar-result", "aria-live": "polite", children: resultLabel }) : null,
|
|
4029
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "pire-filterbar-actions", children: actions }) : null
|
|
3915
4030
|
] }) : null
|
|
3916
4031
|
] });
|
|
3917
4032
|
}
|
|
3918
4033
|
|
|
3919
4034
|
// src/components/data/DescriptionList.tsx
|
|
3920
|
-
var
|
|
4035
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3921
4036
|
function DescriptionList({
|
|
3922
4037
|
items,
|
|
3923
4038
|
layout = "rows",
|
|
@@ -3926,32 +4041,32 @@ function DescriptionList({
|
|
|
3926
4041
|
style,
|
|
3927
4042
|
...rest
|
|
3928
4043
|
}) {
|
|
3929
|
-
return /* @__PURE__ */ (0,
|
|
4044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3930
4045
|
"dl",
|
|
3931
4046
|
{
|
|
3932
4047
|
className: cx("pire-dl", className),
|
|
3933
4048
|
"data-layout": layout,
|
|
3934
4049
|
style: { ...layout === "grid" ? { "--pire-dl-cols": columns } : null, ...style },
|
|
3935
4050
|
...rest,
|
|
3936
|
-
children: items.map((item, i) => /* @__PURE__ */ (0,
|
|
3937
|
-
/* @__PURE__ */ (0,
|
|
4051
|
+
children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "pire-dl-row", "data-emphasis": item.emphasis ? "true" : void 0, children: [
|
|
4052
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("dt", { className: "pire-dl-term", children: [
|
|
3938
4053
|
item.label,
|
|
3939
4054
|
item.hint
|
|
3940
4055
|
] }),
|
|
3941
|
-
/* @__PURE__ */ (0,
|
|
4056
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("dd", { className: "pire-dl-value", "data-numeric": item.numeric ? "true" : void 0, children: item.value })
|
|
3942
4057
|
] }, i))
|
|
3943
4058
|
}
|
|
3944
4059
|
);
|
|
3945
4060
|
}
|
|
3946
4061
|
|
|
3947
4062
|
// src/components/data/Timeline.tsx
|
|
3948
|
-
var
|
|
4063
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3949
4064
|
function Timeline({ entries, reverse = false, className, ...rest }) {
|
|
3950
4065
|
const list = reverse ? [...entries].reverse() : entries;
|
|
3951
|
-
return /* @__PURE__ */ (0,
|
|
3952
|
-
/* @__PURE__ */ (0,
|
|
3953
|
-
/* @__PURE__ */ (0,
|
|
3954
|
-
entry.actor ? /* @__PURE__ */ (0,
|
|
4066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ol", { className: cx("pire-timeline", className), ...rest, children: list.map((entry, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("li", { className: "pire-timeline-item", children: [
|
|
4067
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "pire-timeline-time", children: entry.time }),
|
|
4068
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "pire-timeline-text", children: entry.event }),
|
|
4069
|
+
entry.actor ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "pire-timeline-actor", children: entry.actor }) : null
|
|
3955
4070
|
] }, entry.id ?? i)) });
|
|
3956
4071
|
}
|
|
3957
4072
|
|
|
@@ -3994,10 +4109,10 @@ function seriesColor(series, index) {
|
|
|
3994
4109
|
const slot = series.colorIndex ?? index + 1;
|
|
3995
4110
|
return slot >= 1 && slot <= VIZ_SLOT_COUNT ? `var(--viz-${slot})` : "var(--viz-other)";
|
|
3996
4111
|
}
|
|
3997
|
-
var
|
|
4112
|
+
var IS_DEV4 = process.env.NODE_ENV !== "production";
|
|
3998
4113
|
var warnedCharts = /* @__PURE__ */ new Set();
|
|
3999
4114
|
function warnOnSlotOverflow(series, chartLabel) {
|
|
4000
|
-
if (!
|
|
4115
|
+
if (!IS_DEV4 || warnedCharts.has(chartLabel)) return;
|
|
4001
4116
|
if (series.length <= VIZ_SLOT_COUNT) return;
|
|
4002
4117
|
warnedCharts.add(chartLabel);
|
|
4003
4118
|
console.warn(
|
|
@@ -4005,7 +4120,7 @@ function warnOnSlotOverflow(series, chartLabel) {
|
|
|
4005
4120
|
);
|
|
4006
4121
|
}
|
|
4007
4122
|
function warnOnDonutShape(series, categoryCount, chartLabel) {
|
|
4008
|
-
if (!
|
|
4123
|
+
if (!IS_DEV4 || warnedCharts.has(`donut:${chartLabel}`)) return;
|
|
4009
4124
|
const complaints = [];
|
|
4010
4125
|
if (series.length > 1) {
|
|
4011
4126
|
complaints.push(`it has ${series.length} series but a donut draws one \u2014 the rest are ignored`);
|
|
@@ -4037,7 +4152,7 @@ function alignToCategories(series, categoryCount) {
|
|
|
4037
4152
|
}
|
|
4038
4153
|
|
|
4039
4154
|
// src/components/data/ChartFrame.tsx
|
|
4040
|
-
var
|
|
4155
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4041
4156
|
function seriesLegend(series) {
|
|
4042
4157
|
return series.map((one, index) => ({
|
|
4043
4158
|
key: one.id,
|
|
@@ -4060,29 +4175,29 @@ function ChartFrame({
|
|
|
4060
4175
|
children
|
|
4061
4176
|
}) {
|
|
4062
4177
|
const msg = usePireMessages();
|
|
4063
|
-
return /* @__PURE__ */ (0,
|
|
4064
|
-
title || description ? /* @__PURE__ */ (0,
|
|
4065
|
-
title ? /* @__PURE__ */ (0,
|
|
4066
|
-
description ? /* @__PURE__ */ (0,
|
|
4178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("figure", { className: cx("pire-chart", className), style, children: [
|
|
4179
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("figcaption", { className: "pire-chart-head", children: [
|
|
4180
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "pire-chart-title", children: title }) : null,
|
|
4181
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "pire-chart-desc", children: description }) : null
|
|
4067
4182
|
] }) : null,
|
|
4068
|
-
legend && legend.length > 1 ? /* @__PURE__ */ (0,
|
|
4069
|
-
/* @__PURE__ */ (0,
|
|
4183
|
+
legend && legend.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "pire-chart-legend", children: legend.map((item) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: "pire-chart-legend-item", children: [
|
|
4184
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "pire-chart-swatch", style: { background: item.color } }),
|
|
4070
4185
|
item.label
|
|
4071
4186
|
] }, item.key)) }) : null,
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4073
|
-
/* @__PURE__ */ (0,
|
|
4074
|
-
/* @__PURE__ */ (0,
|
|
4075
|
-
/* @__PURE__ */ (0,
|
|
4076
|
-
/* @__PURE__ */ (0,
|
|
4077
|
-
series.map((one) => /* @__PURE__ */ (0,
|
|
4187
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pire-chart-plot", "aria-hidden": "true", children }),
|
|
4188
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: showDataTable ? "pire-chart-table" : "pire-sr-only", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("table", { children: [
|
|
4189
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("caption", { children: label }),
|
|
4190
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { children: [
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "col", children: msg.chartCategoryHeader }),
|
|
4192
|
+
series.map((one) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "col", children: one.label }, one.id))
|
|
4078
4193
|
] }) }),
|
|
4079
|
-
/* @__PURE__ */ (0,
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tbody", { children: categories.map((category, categoryIndex) => (
|
|
4080
4195
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4081
|
-
/* @__PURE__ */ (0,
|
|
4082
|
-
/* @__PURE__ */ (0,
|
|
4196
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("tr", { children: [
|
|
4197
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "row", children: category }),
|
|
4083
4198
|
series.map((one) => {
|
|
4084
4199
|
const value = one.values[categoryIndex];
|
|
4085
|
-
return /* @__PURE__ */ (0,
|
|
4200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { children: value == null ? msg.chartNoValue : formatValue(value) }, one.id);
|
|
4086
4201
|
})
|
|
4087
4202
|
] }, categoryIndex)
|
|
4088
4203
|
)) })
|
|
@@ -4091,7 +4206,7 @@ function ChartFrame({
|
|
|
4091
4206
|
}
|
|
4092
4207
|
|
|
4093
4208
|
// src/components/data/BarChart.tsx
|
|
4094
|
-
var
|
|
4209
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4095
4210
|
function BarChart({
|
|
4096
4211
|
categories,
|
|
4097
4212
|
series: rawSeries,
|
|
@@ -4123,7 +4238,7 @@ function BarChart({
|
|
|
4123
4238
|
const value = series[0].values[categoryIndex];
|
|
4124
4239
|
return value == null ? msg.chartNoValue : formatValue(value);
|
|
4125
4240
|
};
|
|
4126
|
-
return /* @__PURE__ */ (0,
|
|
4241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4127
4242
|
ChartFrame,
|
|
4128
4243
|
{
|
|
4129
4244
|
label,
|
|
@@ -4136,7 +4251,7 @@ function BarChart({
|
|
|
4136
4251
|
showDataTable,
|
|
4137
4252
|
className,
|
|
4138
4253
|
style,
|
|
4139
|
-
children: !hasData ? /* @__PURE__ */ (0,
|
|
4254
|
+
children: !hasData ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4140
4255
|
"div",
|
|
4141
4256
|
{
|
|
4142
4257
|
className: "pire-chart-bars",
|
|
@@ -4145,12 +4260,12 @@ function BarChart({
|
|
|
4145
4260
|
style: { "--pire-chart-height": `${height}px` },
|
|
4146
4261
|
children: categories.map((category, categoryIndex) => (
|
|
4147
4262
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4148
|
-
/* @__PURE__ */ (0,
|
|
4149
|
-
/* @__PURE__ */ (0,
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4263
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "pire-chart-group", children: [
|
|
4264
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "pire-chart-cat", children: category }),
|
|
4265
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "pire-chart-track", children: series.map((one, seriesIndex) => {
|
|
4151
4266
|
const value = one.values[categoryIndex];
|
|
4152
4267
|
if (value == null) return null;
|
|
4153
|
-
return /* @__PURE__ */ (0,
|
|
4268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4154
4269
|
"div",
|
|
4155
4270
|
{
|
|
4156
4271
|
className: "pire-chart-bar",
|
|
@@ -4159,8 +4274,8 @@ function BarChart({
|
|
|
4159
4274
|
"--pire-bar-color": seriesColor(one, seriesIndex)
|
|
4160
4275
|
},
|
|
4161
4276
|
children: [
|
|
4162
|
-
withValues && orientation === "vertical" ? /* @__PURE__ */ (0,
|
|
4163
|
-
/* @__PURE__ */ (0,
|
|
4277
|
+
withValues && orientation === "vertical" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "pire-chart-barval", children: formatValue(value) }) : null,
|
|
4278
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4164
4279
|
series.length > 1 ? `${one.label}: ` : "",
|
|
4165
4280
|
formatValue(value)
|
|
4166
4281
|
] })
|
|
@@ -4169,7 +4284,7 @@ function BarChart({
|
|
|
4169
4284
|
one.id
|
|
4170
4285
|
);
|
|
4171
4286
|
}) }),
|
|
4172
|
-
withValues && orientation === "horizontal" ? /* @__PURE__ */ (0,
|
|
4287
|
+
withValues && orientation === "horizontal" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "pire-chart-val", children: horizontalLabelFor(categoryIndex) }) : null
|
|
4173
4288
|
] }, categoryIndex)
|
|
4174
4289
|
))
|
|
4175
4290
|
}
|
|
@@ -4179,14 +4294,14 @@ function BarChart({
|
|
|
4179
4294
|
}
|
|
4180
4295
|
|
|
4181
4296
|
// src/components/data/LineChart.tsx
|
|
4182
|
-
var
|
|
4183
|
-
var
|
|
4297
|
+
var React27 = __toESM(require("react"), 1);
|
|
4298
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4184
4299
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4185
4300
|
var MARKER_LIMIT = 20;
|
|
4186
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4301
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React27.useEffect : React27.useLayoutEffect;
|
|
4187
4302
|
function useMeasuredWidth() {
|
|
4188
|
-
const ref =
|
|
4189
|
-
const [width, setWidth] =
|
|
4303
|
+
const ref = React27.useRef(null);
|
|
4304
|
+
const [width, setWidth] = React27.useState(0);
|
|
4190
4305
|
useIsomorphicLayoutEffect2(() => {
|
|
4191
4306
|
const element = ref.current;
|
|
4192
4307
|
if (!element) return;
|
|
@@ -4247,7 +4362,7 @@ function LineChart({
|
|
|
4247
4362
|
return `M${xAt(present[0].index)} ${baseline} L${line} L${xAt(last.index)} ${baseline} Z`;
|
|
4248
4363
|
};
|
|
4249
4364
|
const labelEvery = Math.max(1, Math.ceil(categories.length / Math.max(2, Math.floor(innerWidth / 64))));
|
|
4250
|
-
return /* @__PURE__ */ (0,
|
|
4365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4251
4366
|
ChartFrame,
|
|
4252
4367
|
{
|
|
4253
4368
|
label,
|
|
@@ -4260,8 +4375,8 @@ function LineChart({
|
|
|
4260
4375
|
showDataTable,
|
|
4261
4376
|
className,
|
|
4262
4377
|
style,
|
|
4263
|
-
children: !hasData ? /* @__PURE__ */ (0,
|
|
4264
|
-
width > 0 ? /* @__PURE__ */ (0,
|
|
4378
|
+
children: !hasData ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "pire-chart-lines", ref: plotRef, style: { height }, children: [
|
|
4379
|
+
width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
4265
4380
|
"svg",
|
|
4266
4381
|
{
|
|
4267
4382
|
width,
|
|
@@ -4270,7 +4385,7 @@ function LineChart({
|
|
|
4270
4385
|
"aria-hidden": "true",
|
|
4271
4386
|
focusable: "false",
|
|
4272
4387
|
children: [
|
|
4273
|
-
/* @__PURE__ */ (0,
|
|
4388
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("g", { className: "pire-chart-grid", children: scale.ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4274
4389
|
"line",
|
|
4275
4390
|
{
|
|
4276
4391
|
x1: PLOT_INSET.left,
|
|
@@ -4280,8 +4395,8 @@ function LineChart({
|
|
|
4280
4395
|
},
|
|
4281
4396
|
tick
|
|
4282
4397
|
)) }),
|
|
4283
|
-
/* @__PURE__ */ (0,
|
|
4284
|
-
scale.ticks.map((tick) => /* @__PURE__ */ (0,
|
|
4398
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("g", { className: "pire-chart-tick", children: [
|
|
4399
|
+
scale.ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4285
4400
|
"text",
|
|
4286
4401
|
{
|
|
4287
4402
|
x: PLOT_INSET.left - 8,
|
|
@@ -4295,11 +4410,11 @@ function LineChart({
|
|
|
4295
4410
|
categories.map(
|
|
4296
4411
|
(category, index) => index % labelEvery === 0 ? (
|
|
4297
4412
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4298
|
-
/* @__PURE__ */ (0,
|
|
4413
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("text", { x: xAt(index), y: height - 6, textAnchor: "middle", children: category }, index)
|
|
4299
4414
|
) : null
|
|
4300
4415
|
)
|
|
4301
4416
|
] }),
|
|
4302
|
-
showArea && series[0] ? /* @__PURE__ */ (0,
|
|
4417
|
+
showArea && series[0] ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4303
4418
|
"path",
|
|
4304
4419
|
{
|
|
4305
4420
|
d: areaFor(series[0].values),
|
|
@@ -4307,10 +4422,10 @@ function LineChart({
|
|
|
4307
4422
|
style: { fill: seriesColor(series[0], 0) }
|
|
4308
4423
|
}
|
|
4309
4424
|
) : null,
|
|
4310
|
-
/* @__PURE__ */ (0,
|
|
4311
|
-
withMarkers ? /* @__PURE__ */ (0,
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("g", { className: "pire-chart-line", fill: "none", children: series.map((one, index) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("path", { d: pathFor(one.values), stroke: seriesColor(one, index) }, one.id)) }),
|
|
4426
|
+
withMarkers ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("g", { className: "pire-chart-marker", children: series.map(
|
|
4312
4427
|
(one, seriesIndex) => one.values.map(
|
|
4313
|
-
(value, index) => value == null ? null : /* @__PURE__ */ (0,
|
|
4428
|
+
(value, index) => value == null ? null : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4314
4429
|
"circle",
|
|
4315
4430
|
{
|
|
4316
4431
|
cx: xAt(index),
|
|
@@ -4325,7 +4440,7 @@ function LineChart({
|
|
|
4325
4440
|
]
|
|
4326
4441
|
}
|
|
4327
4442
|
) : null,
|
|
4328
|
-
/* @__PURE__ */ (0,
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4329
4444
|
"div",
|
|
4330
4445
|
{
|
|
4331
4446
|
className: "pire-chart-hover",
|
|
@@ -4334,11 +4449,11 @@ function LineChart({
|
|
|
4334
4449
|
},
|
|
4335
4450
|
children: categories.map((category, categoryIndex) => (
|
|
4336
4451
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
4338
|
-
/* @__PURE__ */ (0,
|
|
4452
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "pire-chart-band", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4453
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("strong", { children: category }),
|
|
4339
4454
|
series.map((one) => {
|
|
4340
4455
|
const value = one.values[categoryIndex];
|
|
4341
|
-
return /* @__PURE__ */ (0,
|
|
4456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "pire-chart-tip-row", children: [
|
|
4342
4457
|
one.label,
|
|
4343
4458
|
": ",
|
|
4344
4459
|
value == null ? "No data" : formatValue(value)
|
|
@@ -4354,8 +4469,8 @@ function LineChart({
|
|
|
4354
4469
|
}
|
|
4355
4470
|
|
|
4356
4471
|
// src/components/data/DonutChart.tsx
|
|
4357
|
-
var
|
|
4358
|
-
var
|
|
4472
|
+
var React28 = __toESM(require("react"), 1);
|
|
4473
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4359
4474
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4360
4475
|
function DonutChart({
|
|
4361
4476
|
categories,
|
|
@@ -4375,7 +4490,7 @@ function DonutChart({
|
|
|
4375
4490
|
}) {
|
|
4376
4491
|
const label = rest["aria-label"];
|
|
4377
4492
|
const msg = usePireMessages();
|
|
4378
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4493
|
+
const [hoveredIndex, setHoveredIndex] = React28.useState(null);
|
|
4379
4494
|
warnOnDonutShape(series, categories.length, label);
|
|
4380
4495
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4381
4496
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -4392,7 +4507,7 @@ function DonutChart({
|
|
|
4392
4507
|
}));
|
|
4393
4508
|
const hovered = hoveredIndex == null ? null : segments.find((segment) => segment.index === hoveredIndex) ?? null;
|
|
4394
4509
|
let arcStart = 0;
|
|
4395
|
-
return /* @__PURE__ */ (0,
|
|
4510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4396
4511
|
ChartFrame,
|
|
4397
4512
|
{
|
|
4398
4513
|
label,
|
|
@@ -4405,8 +4520,8 @@ function DonutChart({
|
|
|
4405
4520
|
showDataTable,
|
|
4406
4521
|
className,
|
|
4407
4522
|
style,
|
|
4408
|
-
children: !hasData ? /* @__PURE__ */ (0,
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
4523
|
+
children: !hasData ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "pire-chart-donut", style: { height: size }, children: [
|
|
4524
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4410
4525
|
"svg",
|
|
4411
4526
|
{
|
|
4412
4527
|
width: size,
|
|
@@ -4414,13 +4529,13 @@ function DonutChart({
|
|
|
4414
4529
|
"aria-hidden": "true",
|
|
4415
4530
|
focusable: "false",
|
|
4416
4531
|
onMouseLeave: () => setHoveredIndex(null),
|
|
4417
|
-
children: /* @__PURE__ */ (0,
|
|
4532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("g", { transform: `rotate(-90 ${size / 2} ${size / 2})`, children: segments.map((segment) => {
|
|
4418
4533
|
const arcLength = segment.value / total * circumference;
|
|
4419
4534
|
const offset = arcStart;
|
|
4420
4535
|
arcStart += arcLength;
|
|
4421
4536
|
return (
|
|
4422
4537
|
// 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.
|
|
4423
|
-
/* @__PURE__ */ (0,
|
|
4538
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4424
4539
|
"circle",
|
|
4425
4540
|
{
|
|
4426
4541
|
className: "pire-chart-arc",
|
|
@@ -4440,9 +4555,9 @@ function DonutChart({
|
|
|
4440
4555
|
}) })
|
|
4441
4556
|
}
|
|
4442
4557
|
),
|
|
4443
|
-
/* @__PURE__ */ (0,
|
|
4444
|
-
/* @__PURE__ */ (0,
|
|
4445
|
-
/* @__PURE__ */ (0,
|
|
4558
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "pire-chart-donut-center", style: { width: size - thickness * 2 - 8 }, children: [
|
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "pire-chart-donut-value", children: hovered ? formatValue(hovered.value) : centerLabel ?? formatValue(total) }),
|
|
4560
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "pire-chart-donut-caption", children: hovered ? hovered.category : centerCaption })
|
|
4446
4561
|
] })
|
|
4447
4562
|
] })
|
|
4448
4563
|
}
|
|
@@ -4453,15 +4568,15 @@ function colorForSegment(index) {
|
|
|
4453
4568
|
}
|
|
4454
4569
|
|
|
4455
4570
|
// src/components/data/LinkList.tsx
|
|
4456
|
-
var
|
|
4457
|
-
var
|
|
4571
|
+
var import_react_aria_components36 = require("react-aria-components");
|
|
4572
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4458
4573
|
function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
4459
|
-
return /* @__PURE__ */ (0,
|
|
4460
|
-
const keySlot = item.key ? /* @__PURE__ */ (0,
|
|
4461
|
-
const textSlot = item.text ? /* @__PURE__ */ (0,
|
|
4574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: cx("pire-linklist", className), role: "list", "data-emphasis": emphasis, ...rest, children: items.map((item) => {
|
|
4575
|
+
const keySlot = item.key ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "pire-linklist-key", children: item.key }) : null;
|
|
4576
|
+
const textSlot = item.text ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "pire-linklist-text", children: item.text }) : null;
|
|
4462
4577
|
const [first, second] = emphasis === "text" ? [textSlot, keySlot] : [keySlot, textSlot];
|
|
4463
|
-
return /* @__PURE__ */ (0,
|
|
4464
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
4578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_aria_components36.Button, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
|
|
4579
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: item.icon, size: 16, style: { color: "var(--text-secondary)" } }) : null,
|
|
4465
4580
|
first,
|
|
4466
4581
|
second,
|
|
4467
4582
|
item.trailing
|
|
@@ -4470,7 +4585,7 @@ function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
|
4470
4585
|
}
|
|
4471
4586
|
|
|
4472
4587
|
// src/components/data/RecordCard.tsx
|
|
4473
|
-
var
|
|
4588
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4474
4589
|
function RecordCard({
|
|
4475
4590
|
title,
|
|
4476
4591
|
subtitle,
|
|
@@ -4480,27 +4595,27 @@ function RecordCard({
|
|
|
4480
4595
|
className,
|
|
4481
4596
|
...rest
|
|
4482
4597
|
}) {
|
|
4483
|
-
return /* @__PURE__ */ (0,
|
|
4598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4484
4599
|
"div",
|
|
4485
4600
|
{
|
|
4486
4601
|
className: cx("pire-recordcard", className),
|
|
4487
4602
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
4488
4603
|
...rest,
|
|
4489
4604
|
children: [
|
|
4490
|
-
icon ? /* @__PURE__ */ (0,
|
|
4491
|
-
/* @__PURE__ */ (0,
|
|
4492
|
-
/* @__PURE__ */ (0,
|
|
4493
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
4605
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-recordcard-tile", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: icon, size: 20 }) }) : null,
|
|
4606
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "pire-recordcard-body", children: [
|
|
4607
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-recordcard-title", children: title }),
|
|
4608
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-recordcard-sub", children: subtitle }) : null
|
|
4494
4609
|
] }),
|
|
4495
|
-
action ? /* @__PURE__ */ (0,
|
|
4610
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "pire-recordcard-action", children: action }) : null
|
|
4496
4611
|
]
|
|
4497
4612
|
}
|
|
4498
4613
|
);
|
|
4499
4614
|
}
|
|
4500
4615
|
|
|
4501
4616
|
// src/components/data/ViewSwitcher.tsx
|
|
4502
|
-
var
|
|
4503
|
-
var
|
|
4617
|
+
var import_react_aria_components37 = require("react-aria-components");
|
|
4618
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
4504
4619
|
function ViewSwitcher({
|
|
4505
4620
|
name,
|
|
4506
4621
|
isDirty,
|
|
@@ -4513,8 +4628,8 @@ function ViewSwitcher({
|
|
|
4513
4628
|
}) {
|
|
4514
4629
|
const msg = usePireMessages();
|
|
4515
4630
|
const label = ariaLabel ?? (isDirty ? msg.viewSwitcherNameModified.replace("{view}", name) : msg.viewSwitcherName.replace("{view}", name));
|
|
4516
|
-
return /* @__PURE__ */ (0,
|
|
4517
|
-
|
|
4631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
4632
|
+
import_react_aria_components37.Button,
|
|
4518
4633
|
{
|
|
4519
4634
|
className: cx("pire-viewswitcher", className),
|
|
4520
4635
|
style,
|
|
@@ -4522,36 +4637,36 @@ function ViewSwitcher({
|
|
|
4522
4637
|
isDisabled,
|
|
4523
4638
|
onPress,
|
|
4524
4639
|
children: [
|
|
4525
|
-
/* @__PURE__ */ (0,
|
|
4526
|
-
/* @__PURE__ */ (0,
|
|
4527
|
-
isDirty ? /* @__PURE__ */ (0,
|
|
4528
|
-
/* @__PURE__ */ (0,
|
|
4640
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: icon, size: 16 }),
|
|
4641
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "pire-viewswitcher-name", children: name }),
|
|
4642
|
+
isDirty ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "pire-viewswitcher-dirty", "aria-hidden": "true", children: msg.viewSwitcherModifiedMark }) : null,
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: "chevron-down", size: 16 })
|
|
4529
4644
|
]
|
|
4530
4645
|
}
|
|
4531
4646
|
);
|
|
4532
4647
|
}
|
|
4533
4648
|
|
|
4534
4649
|
// src/components/data/BarList.tsx
|
|
4535
|
-
var
|
|
4650
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
4536
4651
|
function BarList({ items, max, className, ...rest }) {
|
|
4537
4652
|
const scale = max ?? Math.max(0, ...items.map((i) => i.value));
|
|
4538
|
-
return /* @__PURE__ */ (0,
|
|
4653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("ul", { ...rest, className: cx("pire-barlist", className), children: items.map((item) => {
|
|
4539
4654
|
const pct = scale > 0 ? Math.max(0, Math.min(100, item.value / scale * 100)) : 0;
|
|
4540
|
-
return /* @__PURE__ */ (0,
|
|
4541
|
-
/* @__PURE__ */ (0,
|
|
4542
|
-
/* @__PURE__ */ (0,
|
|
4543
|
-
/* @__PURE__ */ (0,
|
|
4655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("li", { className: "pire-barlist-row", "data-tone": item.tone, children: [
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "pire-barlist-main", children: [
|
|
4657
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-barlist-label", children: item.label }),
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-barlist-track", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-barlist-fill", style: { width: `${pct}%` } }) })
|
|
4544
4659
|
] }),
|
|
4545
|
-
/* @__PURE__ */ (0,
|
|
4546
|
-
/* @__PURE__ */ (0,
|
|
4547
|
-
item.hint ? /* @__PURE__ */ (0,
|
|
4660
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "pire-barlist-figure", children: [
|
|
4661
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-barlist-value", children: item.valueLabel ?? String(item.value) }),
|
|
4662
|
+
item.hint ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "pire-barlist-hint", children: item.hint }) : null
|
|
4548
4663
|
] })
|
|
4549
4664
|
] }, item.id);
|
|
4550
4665
|
}) });
|
|
4551
4666
|
}
|
|
4552
4667
|
|
|
4553
4668
|
// src/components/layout/PageBand.tsx
|
|
4554
|
-
var
|
|
4669
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4555
4670
|
function PageBand({
|
|
4556
4671
|
surface = "card",
|
|
4557
4672
|
hasBorder = true,
|
|
@@ -4559,7 +4674,7 @@ function PageBand({
|
|
|
4559
4674
|
className,
|
|
4560
4675
|
...rest
|
|
4561
4676
|
}) {
|
|
4562
|
-
return /* @__PURE__ */ (0,
|
|
4677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
4563
4678
|
"div",
|
|
4564
4679
|
{
|
|
4565
4680
|
className: cx("pire-pageband", className),
|
|
@@ -4572,29 +4687,29 @@ function PageBand({
|
|
|
4572
4687
|
}
|
|
4573
4688
|
|
|
4574
4689
|
// src/components/layout/PageHeader.tsx
|
|
4575
|
-
var
|
|
4690
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4576
4691
|
function PageHeader({ title, subtitle, actions, className, ...rest }) {
|
|
4577
|
-
return /* @__PURE__ */ (0,
|
|
4578
|
-
/* @__PURE__ */ (0,
|
|
4579
|
-
/* @__PURE__ */ (0,
|
|
4580
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
4692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("header", { className: cx("pire-pageheader", className), ...rest, children: [
|
|
4693
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { style: { minWidth: 0 }, children: [
|
|
4694
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h1", { className: "pire-pageheader-title", children: title }),
|
|
4695
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "pire-pageheader-sub", children: subtitle }) : null
|
|
4581
4696
|
] }),
|
|
4582
|
-
actions ? /* @__PURE__ */ (0,
|
|
4697
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "pire-pageheader-actions", children: actions }) : null
|
|
4583
4698
|
] });
|
|
4584
4699
|
}
|
|
4585
4700
|
|
|
4586
4701
|
// src/components/layout/SectionHeader.tsx
|
|
4587
|
-
var
|
|
4702
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4588
4703
|
function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
4589
|
-
return /* @__PURE__ */ (0,
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
meta ? /* @__PURE__ */ (0,
|
|
4592
|
-
actions ? /* @__PURE__ */ (0,
|
|
4704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: cx("pire-sectionhead", className), ...rest, children: [
|
|
4705
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "pire-eyebrow", children: title }),
|
|
4706
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { style: { font: "var(--type-caption)", color: "var(--text-tertiary)" }, children: meta }) : null,
|
|
4707
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "pire-sectionhead-actions", children: actions }) : null
|
|
4593
4708
|
] });
|
|
4594
4709
|
}
|
|
4595
4710
|
|
|
4596
4711
|
// src/components/layout/SelectionBar.tsx
|
|
4597
|
-
var
|
|
4712
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4598
4713
|
function SelectionBar({
|
|
4599
4714
|
count,
|
|
4600
4715
|
noun = "record",
|
|
@@ -4604,31 +4719,31 @@ function SelectionBar({
|
|
|
4604
4719
|
...rest
|
|
4605
4720
|
}) {
|
|
4606
4721
|
if (!count) return null;
|
|
4607
|
-
return /* @__PURE__ */ (0,
|
|
4608
|
-
/* @__PURE__ */ (0,
|
|
4722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: cx("pire-selectionbar", className), role: "status", "aria-live": "polite", ...rest, children: [
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "pire-selectionbar-count", children: [
|
|
4609
4724
|
count.toLocaleString(),
|
|
4610
4725
|
" ",
|
|
4611
4726
|
noun,
|
|
4612
4727
|
count === 1 ? "" : "s",
|
|
4613
4728
|
" selected"
|
|
4614
4729
|
] }),
|
|
4615
|
-
children ? /* @__PURE__ */ (0,
|
|
4616
|
-
actions ? /* @__PURE__ */ (0,
|
|
4730
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { style: { color: "var(--text-secondary)", font: "var(--type-caption)" }, children }) : null,
|
|
4731
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "pire-selectionbar-actions", children: actions }) : null
|
|
4617
4732
|
] });
|
|
4618
4733
|
}
|
|
4619
4734
|
|
|
4620
4735
|
// src/components/layout/FooterBar.tsx
|
|
4621
|
-
var
|
|
4736
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4622
4737
|
function FooterBar({ note, actions, children, className, ...rest }) {
|
|
4623
|
-
return /* @__PURE__ */ (0,
|
|
4624
|
-
note ? /* @__PURE__ */ (0,
|
|
4738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("footer", { className: cx("pire-footerbar", className), ...rest, children: [
|
|
4739
|
+
note ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "pire-footerbar-note", children: note }) : null,
|
|
4625
4740
|
children,
|
|
4626
|
-
actions ? /* @__PURE__ */ (0,
|
|
4741
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "pire-footerbar-actions", children: actions }) : null
|
|
4627
4742
|
] });
|
|
4628
4743
|
}
|
|
4629
4744
|
|
|
4630
4745
|
// src/components/layout/SplitPane.tsx
|
|
4631
|
-
var
|
|
4746
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4632
4747
|
function SplitPane({
|
|
4633
4748
|
list,
|
|
4634
4749
|
detail,
|
|
@@ -4644,7 +4759,7 @@ function SplitPane({
|
|
|
4644
4759
|
}) {
|
|
4645
4760
|
const msg = usePireMessages();
|
|
4646
4761
|
const width = typeof listWidth === "number" ? `${listWidth}px` : listWidth;
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
4762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
4648
4763
|
"div",
|
|
4649
4764
|
{
|
|
4650
4765
|
className: cx("pire-split", className),
|
|
@@ -4652,10 +4767,10 @@ function SplitPane({
|
|
|
4652
4767
|
style: { ["--pire-split-list-w"]: width, ...style },
|
|
4653
4768
|
...rest,
|
|
4654
4769
|
children: [
|
|
4655
|
-
/* @__PURE__ */ (0,
|
|
4656
|
-
/* @__PURE__ */ (0,
|
|
4657
|
-
onBack ? /* @__PURE__ */ (0,
|
|
4658
|
-
detail ?? /* @__PURE__ */ (0,
|
|
4770
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("section", { className: "pire-split-list", "aria-label": listLabel ?? msg.splitPaneList, children: list }),
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("section", { className: "pire-split-detail", "aria-label": detailLabel ?? msg.splitPaneDetail, children: [
|
|
4772
|
+
onBack ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "pire-split-back", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Button, { variant: "tertiary", size: "sm", icon: "arrow-left", onPress: onBack, children: backLabel ?? msg.splitPaneBack }) }) : null,
|
|
4773
|
+
detail ?? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "pire-split-empty", children: emptyDetail })
|
|
4659
4774
|
] })
|
|
4660
4775
|
]
|
|
4661
4776
|
}
|
|
@@ -4663,7 +4778,7 @@ function SplitPane({
|
|
|
4663
4778
|
}
|
|
4664
4779
|
|
|
4665
4780
|
// src/components/patterns/ConfirmDialog.tsx
|
|
4666
|
-
var
|
|
4781
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4667
4782
|
function ConfirmDialog({
|
|
4668
4783
|
isOpen,
|
|
4669
4784
|
title,
|
|
@@ -4679,7 +4794,7 @@ function ConfirmDialog({
|
|
|
4679
4794
|
onCancel
|
|
4680
4795
|
}) {
|
|
4681
4796
|
const msg = usePireMessages();
|
|
4682
|
-
return /* @__PURE__ */ (0,
|
|
4797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
4683
4798
|
Dialog,
|
|
4684
4799
|
{
|
|
4685
4800
|
isOpen,
|
|
@@ -4689,9 +4804,9 @@ function ConfirmDialog({
|
|
|
4689
4804
|
onClose: onCancel,
|
|
4690
4805
|
isDismissable: !isBusy,
|
|
4691
4806
|
showClose: false,
|
|
4692
|
-
footer: /* @__PURE__ */ (0,
|
|
4693
|
-
/* @__PURE__ */ (0,
|
|
4694
|
-
/* @__PURE__ */ (0,
|
|
4807
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel }),
|
|
4809
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? "Working\u2026" : confirmLabel })
|
|
4695
4810
|
] }),
|
|
4696
4811
|
children: [
|
|
4697
4812
|
facts?.length ? (
|
|
@@ -4699,9 +4814,9 @@ function ConfirmDialog({
|
|
|
4699
4814
|
// *prohibits* `aria-label` — the label named nothing at all, and axe's
|
|
4700
4815
|
// `aria-prohibited-attr` fails it on sight. Every other labelled div/span in this library
|
|
4701
4816
|
// pairs with an explicit role for the same reason.
|
|
4702
|
-
/* @__PURE__ */ (0,
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "pire-confirm-facts", role: "group", "aria-label": msg.confirmDialogFactsLabel, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(DescriptionList, { layout: "rows", items: facts }) })
|
|
4703
4818
|
) : null,
|
|
4704
|
-
consequence ? /* @__PURE__ */ (0,
|
|
4819
|
+
consequence ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
4705
4820
|
InlineMessage,
|
|
4706
4821
|
{
|
|
4707
4822
|
kind: tone === "danger" ? "error" : "warning",
|
|
@@ -4716,9 +4831,9 @@ function ConfirmDialog({
|
|
|
4716
4831
|
}
|
|
4717
4832
|
|
|
4718
4833
|
// src/components/patterns/CommandPalette.tsx
|
|
4719
|
-
var
|
|
4720
|
-
var
|
|
4721
|
-
var
|
|
4834
|
+
var React29 = __toESM(require("react"), 1);
|
|
4835
|
+
var import_react_aria_components38 = require("react-aria-components");
|
|
4836
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4722
4837
|
var RESULTS_SECTION_KEY = "__pire_results__";
|
|
4723
4838
|
var searchableText = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
4724
4839
|
function CommandPalette({
|
|
@@ -4739,17 +4854,17 @@ function CommandPalette({
|
|
|
4739
4854
|
style
|
|
4740
4855
|
}) {
|
|
4741
4856
|
const msg = usePireMessages();
|
|
4742
|
-
const [query, setQuery] =
|
|
4743
|
-
const { contains } = (0,
|
|
4744
|
-
|
|
4857
|
+
const [query, setQuery] = React29.useState("");
|
|
4858
|
+
const { contains } = (0, import_react_aria_components38.useFilter)({ sensitivity: "base" });
|
|
4859
|
+
React29.useEffect(() => {
|
|
4745
4860
|
if (isOpen) setQuery("");
|
|
4746
4861
|
}, [isOpen]);
|
|
4747
|
-
const searchableById =
|
|
4862
|
+
const searchableById = React29.useMemo(() => {
|
|
4748
4863
|
const byId = /* @__PURE__ */ new Map();
|
|
4749
4864
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
4750
4865
|
return byId;
|
|
4751
4866
|
}, [groups]);
|
|
4752
|
-
const filter =
|
|
4867
|
+
const filter = React29.useCallback(
|
|
4753
4868
|
(textValue, inputValue, node) => {
|
|
4754
4869
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
4755
4870
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -4762,8 +4877,8 @@ function CommandPalette({
|
|
|
4762
4877
|
};
|
|
4763
4878
|
const sections = [...groups, ...resultsGroup ? [{ ...resultsGroup, id: RESULTS_SECTION_KEY }] : []];
|
|
4764
4879
|
const status = isLoading ? loadingLabel ?? msg.commandPaletteLoading : emptyLabel ?? msg.commandPaletteEmpty;
|
|
4765
|
-
return /* @__PURE__ */ (0,
|
|
4766
|
-
|
|
4880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4881
|
+
import_react_aria_components38.ModalOverlay,
|
|
4767
4882
|
{
|
|
4768
4883
|
className: "pire-cp-overlay",
|
|
4769
4884
|
isOpen,
|
|
@@ -4771,12 +4886,12 @@ function CommandPalette({
|
|
|
4771
4886
|
onOpenChange: (open) => {
|
|
4772
4887
|
if (!open) onOpenChange?.(false);
|
|
4773
4888
|
},
|
|
4774
|
-
children: /* @__PURE__ */ (0,
|
|
4775
|
-
/* @__PURE__ */ (0,
|
|
4776
|
-
/* @__PURE__ */ (0,
|
|
4777
|
-
/* @__PURE__ */ (0,
|
|
4778
|
-
/* @__PURE__ */ (0,
|
|
4779
|
-
|
|
4889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react_aria_components38.Modal, { className: cx("pire-cp-modal", className), style, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react_aria_components38.Dialog, { className: "pire-cp-dialog", "aria-label": ariaLabel ?? msg.commandPaletteLabel, children: [
|
|
4890
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react_aria_components38.Autocomplete, { filter, inputValue: query, onInputChange: handleInputChange, children: [
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react_aria_components38.SearchField, { className: "pire-cp-search", "aria-label": msg.commandPaletteSearchLabel, children: [
|
|
4892
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Icon, { name: "search", size: 18, className: "pire-cp-search-icon" }),
|
|
4893
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4894
|
+
import_react_aria_components38.Input,
|
|
4780
4895
|
{
|
|
4781
4896
|
className: "pire-cp-input",
|
|
4782
4897
|
autoFocus: true,
|
|
@@ -4784,16 +4899,16 @@ function CommandPalette({
|
|
|
4784
4899
|
}
|
|
4785
4900
|
)
|
|
4786
4901
|
] }),
|
|
4787
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
|
|
4902
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "pire-cp-loading", role: "status", "aria-live": "polite", children: loadingLabel ?? msg.commandPaletteLoading }) : null,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4904
|
+
import_react_aria_components38.Menu,
|
|
4790
4905
|
{
|
|
4791
4906
|
className: "pire-cp-list",
|
|
4792
4907
|
onAction: (key) => onAction?.(String(key)),
|
|
4793
|
-
renderEmptyState: () => /* @__PURE__ */ (0,
|
|
4794
|
-
children: sections.map((section) => /* @__PURE__ */ (0,
|
|
4795
|
-
section.label ? /* @__PURE__ */ (0,
|
|
4796
|
-
section.items.map((item) => /* @__PURE__ */ (0,
|
|
4908
|
+
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "pire-cp-status", children: status }),
|
|
4909
|
+
children: sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react_aria_components38.MenuSection, { id: section.id, className: "pire-cp-section", children: [
|
|
4910
|
+
section.label ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react_aria_components38.Header, { className: "pire-cp-section-title", children: section.label }) : null,
|
|
4911
|
+
section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4797
4912
|
MenuItem,
|
|
4798
4913
|
{
|
|
4799
4914
|
id: item.id,
|
|
@@ -4814,18 +4929,18 @@ function CommandPalette({
|
|
|
4814
4929
|
// aria-hidden: the glyphs are a sighted affordance for discovering the keys. A screen
|
|
4815
4930
|
// reader already announces the listbox semantics that make those keys work, so reading
|
|
4816
4931
|
// "up arrow down arrow navigate" out loud is noise on every open.
|
|
4817
|
-
/* @__PURE__ */ (0,
|
|
4818
|
-
/* @__PURE__ */ (0,
|
|
4819
|
-
/* @__PURE__ */ (0,
|
|
4820
|
-
/* @__PURE__ */ (0,
|
|
4932
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "pire-cp-foot", "aria-hidden": "true", children: footer ?? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
4933
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "pire-cp-hint", children: [
|
|
4934
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Kbd, { children: "\u2191" }),
|
|
4935
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Kbd, { children: "\u2193" }),
|
|
4821
4936
|
msg.commandPaletteHintNavigate
|
|
4822
4937
|
] }),
|
|
4823
|
-
/* @__PURE__ */ (0,
|
|
4824
|
-
/* @__PURE__ */ (0,
|
|
4938
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "pire-cp-hint", children: [
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Kbd, { children: "\u21B5" }),
|
|
4825
4940
|
msg.commandPaletteHintSelect
|
|
4826
4941
|
] }),
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
4942
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "pire-cp-hint", children: [
|
|
4943
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Kbd, { children: "esc" }),
|
|
4829
4944
|
msg.commandPaletteHintClose
|
|
4830
4945
|
] })
|
|
4831
4946
|
] }) })
|
|
@@ -4835,9 +4950,9 @@ function CommandPalette({
|
|
|
4835
4950
|
);
|
|
4836
4951
|
}
|
|
4837
4952
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
4838
|
-
const handler =
|
|
4953
|
+
const handler = React29.useRef(onTrigger);
|
|
4839
4954
|
handler.current = onTrigger;
|
|
4840
|
-
|
|
4955
|
+
React29.useEffect(() => {
|
|
4841
4956
|
if (isDisabled) return;
|
|
4842
4957
|
const onKeyDown = (event) => {
|
|
4843
4958
|
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
@@ -4851,9 +4966,9 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
|
4851
4966
|
}
|
|
4852
4967
|
|
|
4853
4968
|
// src/components/patterns/AppLauncher.tsx
|
|
4854
|
-
var
|
|
4855
|
-
var
|
|
4856
|
-
var
|
|
4969
|
+
var React30 = __toESM(require("react"), 1);
|
|
4970
|
+
var import_react_aria_components39 = require("react-aria-components");
|
|
4971
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4857
4972
|
var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
4858
4973
|
function AppLauncher({
|
|
4859
4974
|
sections,
|
|
@@ -4872,13 +4987,13 @@ function AppLauncher({
|
|
|
4872
4987
|
className
|
|
4873
4988
|
}) {
|
|
4874
4989
|
const msg = usePireMessages();
|
|
4875
|
-
const [query, setQuery] =
|
|
4876
|
-
const { contains } = (0,
|
|
4990
|
+
const [query, setQuery] = React30.useState("");
|
|
4991
|
+
const { contains } = (0, import_react_aria_components39.useFilter)({ sensitivity: "base" });
|
|
4877
4992
|
const handleSearch = (next) => {
|
|
4878
4993
|
setQuery(next);
|
|
4879
4994
|
onSearchChange?.(next);
|
|
4880
4995
|
};
|
|
4881
|
-
const visible =
|
|
4996
|
+
const visible = React30.useMemo(() => {
|
|
4882
4997
|
if (isFilteredExternally) return sections;
|
|
4883
4998
|
const q = query.trim();
|
|
4884
4999
|
if (!q) return sections;
|
|
@@ -4889,25 +5004,25 @@ function AppLauncher({
|
|
|
4889
5004
|
}, [sections, query, isFilteredExternally, contains]);
|
|
4890
5005
|
const isEmpty = !isLoading && visible.length === 0;
|
|
4891
5006
|
const label = ariaLabel ?? msg.appLauncherLabel;
|
|
4892
|
-
return /* @__PURE__ */ (0,
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
/* @__PURE__ */ (0,
|
|
4895
|
-
|
|
5007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_aria_components39.DialogTrigger, { children: [
|
|
5008
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_aria_components39.Button, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Icon, { name: icon, size: 20 }) }),
|
|
5009
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
5010
|
+
import_react_aria_components39.Popover,
|
|
4896
5011
|
{
|
|
4897
5012
|
className: cx("pire-launcher-popover", className),
|
|
4898
5013
|
placement: "bottom start",
|
|
4899
5014
|
offset: 0,
|
|
4900
5015
|
crossOffset: 0,
|
|
4901
5016
|
containerPadding: 0,
|
|
4902
|
-
children: /* @__PURE__ */ (0,
|
|
4903
|
-
/* @__PURE__ */ (0,
|
|
4904
|
-
/* @__PURE__ */ (0,
|
|
4905
|
-
meta ? /* @__PURE__ */ (0,
|
|
5017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_aria_components39.Dialog, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "pire-launcher-head", children: [
|
|
5019
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
|
|
5020
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "pire-launcher-meta", children: meta }) : null
|
|
4906
5021
|
] }),
|
|
4907
5022
|
isSearchable ? (
|
|
4908
5023
|
// autoFocus is right here specifically: the panel exists to be searched, and the
|
|
4909
5024
|
// user just chose to open it, so taking the caret is what they asked for.
|
|
4910
|
-
/* @__PURE__ */ (0,
|
|
5025
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4911
5026
|
Input,
|
|
4912
5027
|
{
|
|
4913
5028
|
"aria-label": msg.appLauncherSearch,
|
|
@@ -4921,18 +5036,18 @@ function AppLauncher({
|
|
|
4921
5036
|
}
|
|
4922
5037
|
)
|
|
4923
5038
|
) : null,
|
|
4924
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4925
|
-
isEmpty ? /* @__PURE__ */ (0,
|
|
5039
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
|
|
5040
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
|
|
4926
5041
|
visible.map((section, si) => (
|
|
4927
5042
|
// Sections are positional zones with no record identity, so the heading is the key
|
|
4928
5043
|
// where there is one. Same reasoning as ShellRail's groups.
|
|
4929
|
-
/* @__PURE__ */ (0,
|
|
4930
|
-
section.label ? /* @__PURE__ */ (0,
|
|
4931
|
-
/* @__PURE__ */ (0,
|
|
5044
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "pire-launcher-section", children: [
|
|
5045
|
+
section.label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-eyebrow", children: section.label }) : null,
|
|
5046
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
|
|
4932
5047
|
const isCurrent = item.id === value;
|
|
4933
5048
|
const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
|
|
4934
|
-
return /* @__PURE__ */ (0,
|
|
4935
|
-
|
|
5049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
5050
|
+
import_react_aria_components39.Button,
|
|
4936
5051
|
{
|
|
4937
5052
|
className: "pire-launcher-item",
|
|
4938
5053
|
"data-selected": isCurrent ? "true" : void 0,
|
|
@@ -4942,16 +5057,16 @@ function AppLauncher({
|
|
|
4942
5057
|
onAction?.(item.id);
|
|
4943
5058
|
},
|
|
4944
5059
|
children: [
|
|
4945
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
5060
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4946
5061
|
Icon,
|
|
4947
5062
|
{
|
|
4948
5063
|
name: item.icon,
|
|
4949
5064
|
size: (section.variant ?? "tile") === "tile" ? 20 : 16
|
|
4950
5065
|
}
|
|
4951
5066
|
) }) : null,
|
|
4952
|
-
/* @__PURE__ */ (0,
|
|
4953
|
-
/* @__PURE__ */ (0,
|
|
4954
|
-
showsDescription ? /* @__PURE__ */ (0,
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "pire-launcher-item-text", children: [
|
|
5068
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "pire-launcher-item-label", children: item.label }),
|
|
5069
|
+
showsDescription ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "pire-launcher-item-desc", children: item.description }) : null
|
|
4955
5070
|
] })
|
|
4956
5071
|
]
|
|
4957
5072
|
},
|
|
@@ -4967,8 +5082,8 @@ function AppLauncher({
|
|
|
4967
5082
|
}
|
|
4968
5083
|
|
|
4969
5084
|
// src/components/patterns/SidePanel.tsx
|
|
4970
|
-
var
|
|
4971
|
-
var
|
|
5085
|
+
var import_react_aria_components40 = require("react-aria-components");
|
|
5086
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4972
5087
|
function SidePanel({
|
|
4973
5088
|
isOpen,
|
|
4974
5089
|
title,
|
|
@@ -4980,8 +5095,8 @@ function SidePanel({
|
|
|
4980
5095
|
className
|
|
4981
5096
|
}) {
|
|
4982
5097
|
const msg = usePireMessages();
|
|
4983
|
-
return /* @__PURE__ */ (0,
|
|
4984
|
-
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
5099
|
+
import_react_aria_components40.ModalOverlay,
|
|
4985
5100
|
{
|
|
4986
5101
|
className: "pire-sidepanel-overlay",
|
|
4987
5102
|
isOpen,
|
|
@@ -4989,23 +5104,23 @@ function SidePanel({
|
|
|
4989
5104
|
onOpenChange: (o) => {
|
|
4990
5105
|
if (!o) onClose?.();
|
|
4991
5106
|
},
|
|
4992
|
-
children: /* @__PURE__ */ (0,
|
|
4993
|
-
/* @__PURE__ */ (0,
|
|
4994
|
-
/* @__PURE__ */ (0,
|
|
4995
|
-
/* @__PURE__ */ (0,
|
|
4996
|
-
subtitle ? /* @__PURE__ */ (0,
|
|
5107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react_aria_components40.Modal, { className: cx("pire-sidepanel", className), style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_react_aria_components40.Dialog, { className: "pire-dialog", style: { height: "100%" }, children: [
|
|
5108
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("header", { className: "pire-dialog-head", children: [
|
|
5109
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react_aria_components40.Heading, { slot: "title", className: "pire-dialog-title", children: title }),
|
|
5111
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null
|
|
4997
5112
|
] }),
|
|
4998
|
-
/* @__PURE__ */ (0,
|
|
5113
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(IconButton, { icon: "x", label: msg.sidePanelClose, size: "sm", onPress: onClose })
|
|
4999
5114
|
] }),
|
|
5000
|
-
/* @__PURE__ */ (0,
|
|
5001
|
-
footer ? /* @__PURE__ */ (0,
|
|
5115
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "pire-dialog-body", style: { flex: 1 }, children }),
|
|
5116
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5002
5117
|
] }) })
|
|
5003
5118
|
}
|
|
5004
5119
|
);
|
|
5005
5120
|
}
|
|
5006
5121
|
|
|
5007
5122
|
// src/components/patterns/EmptyState.tsx
|
|
5008
|
-
var
|
|
5123
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
5009
5124
|
function EmptyState({
|
|
5010
5125
|
icon = "file-text",
|
|
5011
5126
|
title,
|
|
@@ -5015,17 +5130,18 @@ function EmptyState({
|
|
|
5015
5130
|
className,
|
|
5016
5131
|
...rest
|
|
5017
5132
|
}) {
|
|
5018
|
-
return /* @__PURE__ */ (0,
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5020
|
-
title ? /* @__PURE__ */ (0,
|
|
5021
|
-
children ? /* @__PURE__ */ (0,
|
|
5133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: cx("pire-empty", className), "data-compact": compact ? "true" : void 0, ...rest, children: [
|
|
5134
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon, { name: icon, size: 24, className: "pire-empty-icon" }),
|
|
5135
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "pire-empty-title", style: { margin: 0 }, children: title }) : null,
|
|
5136
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "pire-empty-body", style: { margin: 0 }, children }) : null,
|
|
5022
5137
|
action
|
|
5023
5138
|
] });
|
|
5024
5139
|
}
|
|
5025
5140
|
|
|
5026
5141
|
// src/components/patterns/NumPad.tsx
|
|
5027
|
-
var
|
|
5028
|
-
var
|
|
5142
|
+
var React31 = __toESM(require("react"), 1);
|
|
5143
|
+
var import_react_aria_components41 = require("react-aria-components");
|
|
5144
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
5029
5145
|
var BASE_KEYS = [
|
|
5030
5146
|
{ value: "7" },
|
|
5031
5147
|
{ value: "8" },
|
|
@@ -5041,10 +5157,16 @@ var BASE_KEYS = [
|
|
|
5041
5157
|
{ value: "0" }
|
|
5042
5158
|
];
|
|
5043
5159
|
var isInsertable = (value) => /^[0-9]+$/.test(value);
|
|
5160
|
+
function fittingDigits(digits, buffer, separator, maxFractionDigits) {
|
|
5161
|
+
const separatorAt = buffer.indexOf(separator);
|
|
5162
|
+
if (separatorAt === -1) return digits;
|
|
5163
|
+
const room = maxFractionDigits - (buffer.length - separatorAt - 1);
|
|
5164
|
+
return room <= 0 ? "" : digits.slice(0, room);
|
|
5165
|
+
}
|
|
5044
5166
|
function useNumPadKeyboard(onKey, isDisabled, containerRef) {
|
|
5045
|
-
const handler =
|
|
5167
|
+
const handler = React31.useRef(onKey);
|
|
5046
5168
|
handler.current = onKey;
|
|
5047
|
-
|
|
5169
|
+
React31.useEffect(() => {
|
|
5048
5170
|
if (isDisabled) return;
|
|
5049
5171
|
const isEditingElsewhere = () => {
|
|
5050
5172
|
const el = document.activeElement;
|
|
@@ -5068,6 +5190,10 @@ function useNumPadKeyboard(onKey, isDisabled, containerRef) {
|
|
|
5068
5190
|
handler.current("clear");
|
|
5069
5191
|
return;
|
|
5070
5192
|
}
|
|
5193
|
+
if (event.key === "," || event.key === ".") {
|
|
5194
|
+
handler.current("decimal");
|
|
5195
|
+
return;
|
|
5196
|
+
}
|
|
5071
5197
|
};
|
|
5072
5198
|
document.addEventListener("keydown", onKeyDown);
|
|
5073
5199
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
@@ -5080,14 +5206,18 @@ function NumPad({
|
|
|
5080
5206
|
onChange,
|
|
5081
5207
|
extraKeys = [],
|
|
5082
5208
|
onAction,
|
|
5209
|
+
maxFractionDigits,
|
|
5083
5210
|
isDisabled,
|
|
5084
5211
|
size = "md",
|
|
5085
5212
|
className,
|
|
5086
5213
|
style
|
|
5087
5214
|
}) {
|
|
5088
5215
|
const msg = usePireMessages();
|
|
5089
|
-
const containerRef =
|
|
5090
|
-
const
|
|
5216
|
+
const containerRef = React31.useRef(null);
|
|
5217
|
+
const { locale } = (0, import_react_aria_components41.useLocale)();
|
|
5218
|
+
const separator = decimalSeparatorFor(locale);
|
|
5219
|
+
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5220
|
+
const applyKey = React31.useCallback(
|
|
5091
5221
|
(key) => {
|
|
5092
5222
|
if (isDisabled) return;
|
|
5093
5223
|
if (key.value === "backspace") {
|
|
@@ -5098,17 +5228,28 @@ function NumPad({
|
|
|
5098
5228
|
onChange("");
|
|
5099
5229
|
return;
|
|
5100
5230
|
}
|
|
5231
|
+
if (key.value === "decimal") {
|
|
5232
|
+
if (!allowsDecimal || value.includes(separator)) return;
|
|
5233
|
+
onChange((value === "" ? "0" : value) + separator);
|
|
5234
|
+
return;
|
|
5235
|
+
}
|
|
5101
5236
|
if (isInsertable(key.value)) {
|
|
5102
|
-
onChange(
|
|
5237
|
+
onChange(
|
|
5238
|
+
value + (allowsDecimal ? fittingDigits(key.value, value, separator, maxFractionDigits) : key.value)
|
|
5239
|
+
);
|
|
5103
5240
|
return;
|
|
5104
5241
|
}
|
|
5105
5242
|
onAction?.(key.value);
|
|
5106
5243
|
},
|
|
5107
|
-
[isDisabled, value, onChange, onAction]
|
|
5244
|
+
[isDisabled, value, onChange, onAction, allowsDecimal, separator, maxFractionDigits]
|
|
5108
5245
|
);
|
|
5109
5246
|
useNumPadKeyboard((keyValue) => applyKey({ value: keyValue }), isDisabled, containerRef);
|
|
5110
|
-
const keys = [
|
|
5111
|
-
|
|
5247
|
+
const keys = [
|
|
5248
|
+
...BASE_KEYS,
|
|
5249
|
+
...allowsDecimal ? [{ value: "decimal", label: separator }] : [],
|
|
5250
|
+
...extraKeys
|
|
5251
|
+
];
|
|
5252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
5112
5253
|
"div",
|
|
5113
5254
|
{
|
|
5114
5255
|
ref: containerRef,
|
|
@@ -5117,10 +5258,10 @@ function NumPad({
|
|
|
5117
5258
|
"data-size": size,
|
|
5118
5259
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
5119
5260
|
children: [
|
|
5120
|
-
target !== void 0 ? /* @__PURE__ */ (0,
|
|
5121
|
-
/* @__PURE__ */ (0,
|
|
5122
|
-
const accessibleLabel = key.value === "backspace" ? msg.numPadBackspace : key.value === "clear" ? msg.numPadClear : void 0;
|
|
5123
|
-
return /* @__PURE__ */ (0,
|
|
5261
|
+
target !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "pire-numpad-target", role: "status", "aria-live": "polite", children: target }) : null,
|
|
5262
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "pire-numpad-grid", role: "group", "aria-label": ariaLabel, children: keys.map((key) => {
|
|
5263
|
+
const accessibleLabel = key.value === "backspace" ? msg.numPadBackspace : key.value === "clear" ? msg.numPadClear : key.value === "decimal" ? msg.numPadDecimal : void 0;
|
|
5264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
5124
5265
|
Button,
|
|
5125
5266
|
{
|
|
5126
5267
|
variant: "secondary",
|
|
@@ -5128,6 +5269,7 @@ function NumPad({
|
|
|
5128
5269
|
fullWidth: true,
|
|
5129
5270
|
className: "pire-numpad-key",
|
|
5130
5271
|
"data-span": key.span === 2 ? "2" : void 0,
|
|
5272
|
+
"data-key": key.value === "decimal" ? "decimal" : void 0,
|
|
5131
5273
|
isDisabled,
|
|
5132
5274
|
"aria-label": accessibleLabel,
|
|
5133
5275
|
onPress: () => applyKey(key),
|
|
@@ -5142,9 +5284,9 @@ function NumPad({
|
|
|
5142
5284
|
}
|
|
5143
5285
|
|
|
5144
5286
|
// src/components/patterns/FileDropZone.tsx
|
|
5145
|
-
var
|
|
5146
|
-
var
|
|
5147
|
-
var
|
|
5287
|
+
var React32 = __toESM(require("react"), 1);
|
|
5288
|
+
var import_react_aria_components42 = require("react-aria-components");
|
|
5289
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
5148
5290
|
var isImage2 = (file) => file.type.startsWith("image/");
|
|
5149
5291
|
function FileDropZone({
|
|
5150
5292
|
label,
|
|
@@ -5172,10 +5314,10 @@ function FileDropZone({
|
|
|
5172
5314
|
...rest
|
|
5173
5315
|
}) {
|
|
5174
5316
|
const msg = usePireMessages();
|
|
5175
|
-
const [uncontrolled, setUncontrolled] =
|
|
5317
|
+
const [uncontrolled, setUncontrolled] = React32.useState(defaultValue ?? []);
|
|
5176
5318
|
const files = value ?? uncontrolled;
|
|
5177
|
-
const created =
|
|
5178
|
-
|
|
5319
|
+
const created = React32.useRef([]);
|
|
5320
|
+
React32.useEffect(
|
|
5179
5321
|
() => () => {
|
|
5180
5322
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
5181
5323
|
},
|
|
@@ -5198,42 +5340,42 @@ function FileDropZone({
|
|
|
5198
5340
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
5199
5341
|
};
|
|
5200
5342
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
5201
|
-
return /* @__PURE__ */ (0,
|
|
5202
|
-
label ? /* @__PURE__ */ (0,
|
|
5343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
5344
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("span", { className: "pire-field-label", children: [
|
|
5203
5345
|
label,
|
|
5204
|
-
isRequired ? /* @__PURE__ */ (0,
|
|
5346
|
+
isRequired ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
5205
5347
|
] }) : null,
|
|
5206
|
-
/* @__PURE__ */ (0,
|
|
5207
|
-
|
|
5348
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
5349
|
+
import_react_aria_components42.DropZone,
|
|
5208
5350
|
{
|
|
5209
5351
|
className: "pire-dropzone",
|
|
5210
5352
|
"aria-label": ariaLabel,
|
|
5211
5353
|
"data-height": height,
|
|
5212
5354
|
isDisabled: isDisabled || isReadOnly,
|
|
5213
5355
|
onDrop: async (e) => {
|
|
5214
|
-
const dropped = await Promise.all(e.items.filter(
|
|
5356
|
+
const dropped = await Promise.all(e.items.filter(import_react_aria_components42.isFileDropItem).map((item) => item.getFile()));
|
|
5215
5357
|
accept(dropped);
|
|
5216
5358
|
},
|
|
5217
5359
|
children: [
|
|
5218
|
-
/* @__PURE__ */ (0,
|
|
5219
|
-
/* @__PURE__ */ (0,
|
|
5220
|
-
/* @__PURE__ */ (0,
|
|
5221
|
-
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon, { name: "download", size: 24, className: "pire-dropzone-icon" }),
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pire-dropzone-prompt", children: promptLabel ?? msg.fileDropZonePrompt }),
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5363
|
+
import_react_aria_components42.FileTrigger,
|
|
5222
5364
|
{
|
|
5223
5365
|
acceptedFileTypes,
|
|
5224
5366
|
allowsMultiple,
|
|
5225
5367
|
onSelect: (list) => accept(list ? [...list] : []),
|
|
5226
|
-
children: /* @__PURE__ */ (0,
|
|
5368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, children: msg.fileUploadChoose })
|
|
5227
5369
|
}
|
|
5228
5370
|
)
|
|
5229
5371
|
]
|
|
5230
5372
|
}
|
|
5231
5373
|
),
|
|
5232
|
-
files.length ? /* @__PURE__ */ (0,
|
|
5233
|
-
previewUrl ? /* @__PURE__ */ (0,
|
|
5234
|
-
/* @__PURE__ */ (0,
|
|
5235
|
-
/* @__PURE__ */ (0,
|
|
5236
|
-
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0,
|
|
5374
|
+
files.length ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("li", { className: "pire-fileupload-item", children: [
|
|
5375
|
+
previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
5376
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pire-fileupload-name", children: file.name }),
|
|
5377
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
5378
|
+
isDisabled || isReadOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
5237
5379
|
IconButton,
|
|
5238
5380
|
{
|
|
5239
5381
|
icon: "x",
|
|
@@ -5243,15 +5385,15 @@ function FileDropZone({
|
|
|
5243
5385
|
}
|
|
5244
5386
|
)
|
|
5245
5387
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
5246
|
-
uploadProgress != null ? /* @__PURE__ */ (0,
|
|
5247
|
-
description ? /* @__PURE__ */ (0,
|
|
5248
|
-
isInvalid && errorMessage ? /* @__PURE__ */ (0,
|
|
5388
|
+
uploadProgress != null ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
5389
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pire-field-hint", children: description }) : null,
|
|
5390
|
+
isInvalid && errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
5249
5391
|
] });
|
|
5250
5392
|
}
|
|
5251
5393
|
|
|
5252
5394
|
// src/index.ts
|
|
5253
|
-
var
|
|
5254
|
-
var
|
|
5395
|
+
var import_react_aria_components43 = require("react-aria-components");
|
|
5396
|
+
var import_react_aria_components44 = require("react-aria-components");
|
|
5255
5397
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5256
5398
|
0 && (module.exports = {
|
|
5257
5399
|
AppLauncher,
|
|
@@ -5279,6 +5421,7 @@ var import_react_aria_components40 = require("react-aria-components");
|
|
|
5279
5421
|
DialogTrigger,
|
|
5280
5422
|
DonutChart,
|
|
5281
5423
|
EmptyState,
|
|
5424
|
+
FieldHelp,
|
|
5282
5425
|
FileDropZone,
|
|
5283
5426
|
FileUpload,
|
|
5284
5427
|
FilterBar,
|