@orianatech/pire 1.6.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/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 +11 -0
- package/dist/i18n/messages.d.cts +13 -1
- package/dist/i18n/messages.d.ts +13 -1
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +953 -843
- 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 +837 -748
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -531,6 +531,7 @@ var enMessages = {
|
|
|
531
531
|
inlineMessageDismiss: "Dismiss message",
|
|
532
532
|
toastDismiss: "Dismiss",
|
|
533
533
|
toastRegionLabel: "Notifications",
|
|
534
|
+
selectPlaceholder: "Select\u2026",
|
|
534
535
|
selectEmpty: "No options available",
|
|
535
536
|
comboBoxShowSuggestions: "Show suggestions",
|
|
536
537
|
comboBoxLoading: "Searching\u2026",
|
|
@@ -541,6 +542,8 @@ var enMessages = {
|
|
|
541
542
|
numberFieldIncrease: "Increase",
|
|
542
543
|
numberFieldDecrease: "Decrease",
|
|
543
544
|
inputClear: "Clear",
|
|
545
|
+
fieldHelp: "More information",
|
|
546
|
+
fieldHelpNamed: "More information about {label}",
|
|
544
547
|
valueHelpFieldPlaceholder: "Not selected",
|
|
545
548
|
valueHelpFieldClear: "Clear selection",
|
|
546
549
|
valueHelpFieldOpenNamed: "Select {label}",
|
|
@@ -616,6 +619,7 @@ var esMessages = {
|
|
|
616
619
|
inlineMessageDismiss: "Descartar mensaje",
|
|
617
620
|
toastDismiss: "Descartar",
|
|
618
621
|
toastRegionLabel: "Notificaciones",
|
|
622
|
+
selectPlaceholder: "Seleccionar\u2026",
|
|
619
623
|
selectEmpty: "Sin opciones disponibles",
|
|
620
624
|
comboBoxShowSuggestions: "Mostrar sugerencias",
|
|
621
625
|
comboBoxLoading: "Buscando\u2026",
|
|
@@ -626,6 +630,8 @@ var esMessages = {
|
|
|
626
630
|
numberFieldIncrease: "Aumentar",
|
|
627
631
|
numberFieldDecrease: "Disminuir",
|
|
628
632
|
inputClear: "Limpiar",
|
|
633
|
+
fieldHelp: "M\xE1s informaci\xF3n",
|
|
634
|
+
fieldHelpNamed: "M\xE1s informaci\xF3n sobre {label}",
|
|
629
635
|
valueHelpFieldPlaceholder: "Sin seleccionar",
|
|
630
636
|
valueHelpFieldClear: "Limpiar selecci\xF3n",
|
|
631
637
|
valueHelpFieldOpenNamed: "Seleccionar {label}",
|
|
@@ -948,8 +954,25 @@ function Kbd({ children, size = "md", className, ...rest }) {
|
|
|
948
954
|
return /* @__PURE__ */ jsx15("kbd", { className: cx("pire-kbd", className), "data-size": size, ...rest, children });
|
|
949
955
|
}
|
|
950
956
|
|
|
957
|
+
// src/components/forms/FieldHelp.tsx
|
|
958
|
+
import { ButtonContext } from "react-aria-components";
|
|
959
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
960
|
+
function FieldHelp({ children, label, placement = "top" }) {
|
|
961
|
+
const msg = usePireMessages();
|
|
962
|
+
return (
|
|
963
|
+
// React Aria hands every descendant Button the nearest slotted ButtonContext. Inside a
|
|
964
|
+
// NumberField that context has only `increment` and `decrement`, and an unslotted Button
|
|
965
|
+
// throws `A slot prop is required`; inside DatePicker, DateRangePicker and ComboBox the same
|
|
966
|
+
// Button is silently adopted as the field's *trigger*, which is worse than a crash because it
|
|
967
|
+
// renders. `value={null}` is React Aria's own idiom for lifting a subtree back out of a
|
|
968
|
+
// slotted context — the same one `MultiComboBox` and `FieldLabel` use — and is what makes
|
|
969
|
+
// this component safe anywhere.
|
|
970
|
+
/* @__PURE__ */ jsx16(ButtonContext.Provider, { value: null, children: /* @__PURE__ */ jsx16(Tooltip, { label: children, placement, children: /* @__PURE__ */ jsx16(IconButton, { icon: "help-circle", label: label ?? msg.fieldHelp, size: "sm", hideTooltip: true }) }) })
|
|
971
|
+
);
|
|
972
|
+
}
|
|
973
|
+
|
|
951
974
|
// src/components/forms/FormField.tsx
|
|
952
|
-
import { jsx as
|
|
975
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
953
976
|
function FormField({
|
|
954
977
|
label,
|
|
955
978
|
htmlFor,
|
|
@@ -957,20 +980,25 @@ function FormField({
|
|
|
957
980
|
hint,
|
|
958
981
|
error,
|
|
959
982
|
layout = "stacked",
|
|
983
|
+
help,
|
|
960
984
|
children,
|
|
961
985
|
className,
|
|
962
986
|
...rest
|
|
963
987
|
}) {
|
|
988
|
+
const labelEl = /* @__PURE__ */ jsxs9("label", { className: "pire-field-label", htmlFor, children: [
|
|
989
|
+
label,
|
|
990
|
+
isRequired ? /* @__PURE__ */ jsx17("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
991
|
+
] });
|
|
964
992
|
return /* @__PURE__ */ jsxs9("div", { className: cx("pire-field", className), "data-layout": layout, ...rest, children: [
|
|
965
|
-
/* @__PURE__ */ jsxs9("
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
] }),
|
|
993
|
+
help ? /* @__PURE__ */ jsxs9("div", { className: "pire-field-labelrow", children: [
|
|
994
|
+
labelEl,
|
|
995
|
+
/* @__PURE__ */ jsx17(FieldHelp, { children: help })
|
|
996
|
+
] }) : labelEl,
|
|
969
997
|
children,
|
|
970
998
|
error ? /* @__PURE__ */ jsxs9("span", { className: "pire-field-error", role: "alert", children: [
|
|
971
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ jsx17(Icon, { name: "alert-circle", size: 12 }),
|
|
972
1000
|
error
|
|
973
|
-
] }) : hint ? /* @__PURE__ */
|
|
1001
|
+
] }) : hint ? /* @__PURE__ */ jsx17("span", { className: "pire-field-hint", children: hint }) : null
|
|
974
1002
|
] });
|
|
975
1003
|
}
|
|
976
1004
|
|
|
@@ -978,10 +1006,8 @@ function FormField({
|
|
|
978
1006
|
import * as React10 from "react";
|
|
979
1007
|
import {
|
|
980
1008
|
TextField,
|
|
981
|
-
Label,
|
|
982
1009
|
Input as AriaInput,
|
|
983
1010
|
Group,
|
|
984
|
-
Text as Text3,
|
|
985
1011
|
FieldError,
|
|
986
1012
|
Button as AriaButton4
|
|
987
1013
|
} from "react-aria-components";
|
|
@@ -992,13 +1018,75 @@ function focusFieldOf(button) {
|
|
|
992
1018
|
control?.querySelector(".pire-datesegment, .pire-input, input, textarea")?.focus();
|
|
993
1019
|
}
|
|
994
1020
|
|
|
1021
|
+
// src/components/forms/FieldLabel.tsx
|
|
1022
|
+
import { ButtonContext as ButtonContext2, Label } from "react-aria-components";
|
|
1023
|
+
|
|
1024
|
+
// src/components/utils/devWarn.ts
|
|
1025
|
+
var IS_DEV2 = process.env.NODE_ENV !== "production";
|
|
1026
|
+
var warned2 = /* @__PURE__ */ new Set();
|
|
1027
|
+
function warnOnce2(key, message) {
|
|
1028
|
+
if (warned2.has(key)) return;
|
|
1029
|
+
warned2.add(key);
|
|
1030
|
+
console.warn(`[pire] ${message}`);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// src/components/forms/FieldLabel.tsx
|
|
1034
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1035
|
+
function warnHelpWithoutLabel(component, label, help) {
|
|
1036
|
+
if (!IS_DEV2 || !help || label) return;
|
|
1037
|
+
warnOnce2(
|
|
1038
|
+
`help-without-label:${component}`,
|
|
1039
|
+
`${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\`.`
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
function FieldLabel({ label, isRequired, help }) {
|
|
1043
|
+
const msg = usePireMessages();
|
|
1044
|
+
const text = /* @__PURE__ */ jsxs10(Label, { className: "pire-field-label", children: [
|
|
1045
|
+
label,
|
|
1046
|
+
isRequired ? /* @__PURE__ */ jsx18("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1047
|
+
] });
|
|
1048
|
+
return (
|
|
1049
|
+
// React Aria's own idiom for lifting a subtree back out of a slotted context — the same one
|
|
1050
|
+
// `MultiComboBox` uses on its chips, and the one Popover uses on the way into an overlay.
|
|
1051
|
+
// Without it every Button below a field inherits that field's trigger props.
|
|
1052
|
+
/* @__PURE__ */ jsx18(ButtonContext2.Provider, { value: null, children: help ? /* @__PURE__ */ jsxs10("div", { className: "pire-field-labelrow", children: [
|
|
1053
|
+
text,
|
|
1054
|
+
/* @__PURE__ */ jsx18(
|
|
1055
|
+
FieldHelp,
|
|
1056
|
+
{
|
|
1057
|
+
label: typeof label === "string" ? msg.fieldHelpNamed.replace("{label}", label.toLowerCase()) : void 0,
|
|
1058
|
+
children: help
|
|
1059
|
+
}
|
|
1060
|
+
)
|
|
1061
|
+
] }) : text })
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// src/components/forms/FieldDescription.tsx
|
|
1066
|
+
import { Text as Text3 } from "react-aria-components";
|
|
1067
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1068
|
+
function FieldDescription({ description, help }) {
|
|
1069
|
+
if (!description && !help) return null;
|
|
1070
|
+
return (
|
|
1071
|
+
// The class is picked, never combined: `.pire-sr-only` is `!important` and pairing it with
|
|
1072
|
+
// another pire-* class is what grew the document sideways in 0.23.0. Choosing `pire-sr-only`
|
|
1073
|
+
// when there is no visible description also keeps the node out of `.pire-field`'s flex gap —
|
|
1074
|
+
// a `pire-field-hint` holding only hidden text still opens a visible gap under every field.
|
|
1075
|
+
/* @__PURE__ */ jsxs11(Text3, { slot: "description", className: description ? "pire-field-hint" : "pire-sr-only", children: [
|
|
1076
|
+
description,
|
|
1077
|
+
help ? /* @__PURE__ */ jsx19("span", { className: "pire-sr-only", children: help }) : null
|
|
1078
|
+
] })
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
995
1082
|
// src/components/forms/Input.tsx
|
|
996
|
-
import { jsx as
|
|
1083
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
997
1084
|
function Input({
|
|
998
1085
|
label,
|
|
999
1086
|
icon,
|
|
1000
1087
|
suffix,
|
|
1001
1088
|
description,
|
|
1089
|
+
help,
|
|
1002
1090
|
errorMessage,
|
|
1003
1091
|
size = "md",
|
|
1004
1092
|
numeric,
|
|
@@ -1022,7 +1110,8 @@ function Input({
|
|
|
1022
1110
|
const takesOverValue = isClearable && !isControlled;
|
|
1023
1111
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : {};
|
|
1024
1112
|
const showsClear = isClearable && currentValue !== "" && !rest.isDisabled && !rest.isReadOnly;
|
|
1025
|
-
|
|
1113
|
+
warnHelpWithoutLabel("Input", label, help);
|
|
1114
|
+
return /* @__PURE__ */ jsxs12(
|
|
1026
1115
|
TextField,
|
|
1027
1116
|
{
|
|
1028
1117
|
className: cx("pire-field", className),
|
|
@@ -1032,11 +1121,8 @@ function Input({
|
|
|
1032
1121
|
...rest,
|
|
1033
1122
|
...valueProps,
|
|
1034
1123
|
children: [
|
|
1035
|
-
label ? /* @__PURE__ */
|
|
1036
|
-
|
|
1037
|
-
rest.isRequired ? /* @__PURE__ */ jsx17("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1038
|
-
] }) : null,
|
|
1039
|
-
/* @__PURE__ */ jsxs10(
|
|
1124
|
+
label ? /* @__PURE__ */ jsx20(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1125
|
+
/* @__PURE__ */ jsxs12(
|
|
1040
1126
|
Group,
|
|
1041
1127
|
{
|
|
1042
1128
|
className: "pire-control",
|
|
@@ -1045,9 +1131,9 @@ function Input({
|
|
|
1045
1131
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1046
1132
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1047
1133
|
children: [
|
|
1048
|
-
icon ? /* @__PURE__ */
|
|
1049
|
-
/* @__PURE__ */
|
|
1050
|
-
showsClear ? /* @__PURE__ */
|
|
1134
|
+
icon ? /* @__PURE__ */ jsx20(Icon, { name: icon, size: 16, className: "pire-leading-icon" }) : null,
|
|
1135
|
+
/* @__PURE__ */ jsx20(AriaInput, { ref: inputRef, className: "pire-input", "data-numeric": numeric ? "true" : void 0 }),
|
|
1136
|
+
showsClear ? /* @__PURE__ */ jsx20(
|
|
1051
1137
|
AriaButton4,
|
|
1052
1138
|
{
|
|
1053
1139
|
className: "pire-input-clear",
|
|
@@ -1058,12 +1144,12 @@ function Input({
|
|
|
1058
1144
|
children: clearLabel ?? msg.inputClear
|
|
1059
1145
|
}
|
|
1060
1146
|
) : null,
|
|
1061
|
-
suffix ? /* @__PURE__ */
|
|
1147
|
+
suffix ? /* @__PURE__ */ jsx20("span", { className: "pire-affix", children: suffix }) : null
|
|
1062
1148
|
]
|
|
1063
1149
|
}
|
|
1064
1150
|
),
|
|
1065
|
-
|
|
1066
|
-
/* @__PURE__ */
|
|
1151
|
+
/* @__PURE__ */ jsx20(FieldDescription, { description, help }),
|
|
1152
|
+
/* @__PURE__ */ jsx20(FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1067
1153
|
]
|
|
1068
1154
|
}
|
|
1069
1155
|
);
|
|
@@ -1071,12 +1157,13 @@ function Input({
|
|
|
1071
1157
|
|
|
1072
1158
|
// src/components/forms/TextArea.tsx
|
|
1073
1159
|
import * as React11 from "react";
|
|
1074
|
-
import { TextField as TextField2,
|
|
1075
|
-
import { jsx as
|
|
1160
|
+
import { TextField as TextField2, TextArea as AriaTextArea, Group as Group2, FieldError as FieldError2 } from "react-aria-components";
|
|
1161
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1076
1162
|
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React11.useEffect : React11.useLayoutEffect;
|
|
1077
1163
|
function TextArea({
|
|
1078
1164
|
label,
|
|
1079
1165
|
description,
|
|
1166
|
+
help,
|
|
1080
1167
|
errorMessage,
|
|
1081
1168
|
size = "md",
|
|
1082
1169
|
rows = 3,
|
|
@@ -1116,7 +1203,8 @@ function TextArea({
|
|
|
1116
1203
|
}
|
|
1117
1204
|
grow();
|
|
1118
1205
|
}, [autoGrow, grow, rest.value]);
|
|
1119
|
-
|
|
1206
|
+
warnHelpWithoutLabel("TextArea", label, help);
|
|
1207
|
+
return /* @__PURE__ */ jsxs13(
|
|
1120
1208
|
TextField2,
|
|
1121
1209
|
{
|
|
1122
1210
|
className: cx("pire-field", className),
|
|
@@ -1125,11 +1213,8 @@ function TextArea({
|
|
|
1125
1213
|
validationBehavior: "aria",
|
|
1126
1214
|
...rest,
|
|
1127
1215
|
children: [
|
|
1128
|
-
label ? /* @__PURE__ */
|
|
1129
|
-
|
|
1130
|
-
rest.isRequired ? /* @__PURE__ */ jsx18("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1131
|
-
] }) : null,
|
|
1132
|
-
/* @__PURE__ */ jsx18(
|
|
1216
|
+
label ? /* @__PURE__ */ jsx21(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1217
|
+
/* @__PURE__ */ jsx21(
|
|
1133
1218
|
Group2,
|
|
1134
1219
|
{
|
|
1135
1220
|
className: "pire-control",
|
|
@@ -1138,7 +1223,7 @@ function TextArea({
|
|
|
1138
1223
|
"data-multiline": "true",
|
|
1139
1224
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1140
1225
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1141
|
-
children: /* @__PURE__ */
|
|
1226
|
+
children: /* @__PURE__ */ jsx21(
|
|
1142
1227
|
AriaTextArea,
|
|
1143
1228
|
{
|
|
1144
1229
|
ref,
|
|
@@ -1150,26 +1235,26 @@ function TextArea({
|
|
|
1150
1235
|
)
|
|
1151
1236
|
}
|
|
1152
1237
|
),
|
|
1153
|
-
|
|
1154
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ jsx21(FieldDescription, { description, help }),
|
|
1239
|
+
/* @__PURE__ */ jsx21(FieldError2, { className: "pire-field-error", children: errorMessage })
|
|
1155
1240
|
]
|
|
1156
1241
|
}
|
|
1157
1242
|
);
|
|
1158
1243
|
}
|
|
1159
1244
|
|
|
1160
1245
|
// src/components/forms/Select.tsx
|
|
1246
|
+
import * as React12 from "react";
|
|
1161
1247
|
import {
|
|
1162
1248
|
Select as AriaSelect,
|
|
1163
|
-
Label as Label3,
|
|
1164
1249
|
Button as AriaButton5,
|
|
1165
1250
|
SelectValue,
|
|
1166
1251
|
Popover,
|
|
1167
1252
|
ListBox,
|
|
1168
1253
|
ListBoxItem,
|
|
1169
|
-
Text as Text5,
|
|
1170
1254
|
FieldError as FieldError3
|
|
1171
1255
|
} from "react-aria-components";
|
|
1172
|
-
import { jsx as
|
|
1256
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1257
|
+
var CLEAR_KEY = "__pire-select-clear__";
|
|
1173
1258
|
var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
|
|
1174
1259
|
function Select({
|
|
1175
1260
|
label,
|
|
@@ -1177,8 +1262,10 @@ function Select({
|
|
|
1177
1262
|
defaultValue,
|
|
1178
1263
|
onChange,
|
|
1179
1264
|
options = [],
|
|
1180
|
-
placeholder
|
|
1265
|
+
placeholder,
|
|
1266
|
+
isClearable,
|
|
1181
1267
|
description,
|
|
1268
|
+
help,
|
|
1182
1269
|
errorMessage,
|
|
1183
1270
|
emptyLabel,
|
|
1184
1271
|
size = "md",
|
|
@@ -1189,24 +1276,46 @@ function Select({
|
|
|
1189
1276
|
}) {
|
|
1190
1277
|
const msg = usePireMessages();
|
|
1191
1278
|
const items = options.map(norm);
|
|
1192
|
-
|
|
1279
|
+
const effectivePlaceholder = placeholder ?? msg.selectPlaceholder;
|
|
1280
|
+
const isSelectionControlled = value !== void 0;
|
|
1281
|
+
const [ownSelection, setOwnSelection] = React12.useState(defaultValue ?? null);
|
|
1282
|
+
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1283
|
+
const collides = items.some((item) => item.value === CLEAR_KEY);
|
|
1284
|
+
const showsClear = isClearable === true && !rest.isDisabled && items.length > 0 && !collides;
|
|
1285
|
+
if (IS_DEV2 && isClearable === true && !rest.isDisabled && collides) {
|
|
1286
|
+
warnOnce2(
|
|
1287
|
+
CLEAR_KEY,
|
|
1288
|
+
`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.`
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
const rows = showsClear ? [
|
|
1292
|
+
// The row's own label falls back to the dictionary even when `placeholder` is explicitly
|
|
1293
|
+
// `''`: an empty trigger is a deliberate, supported shape, but a listbox option with no
|
|
1294
|
+
// accessible name is not — it would be unreachable by name and silent to a screen reader.
|
|
1295
|
+
{ value: CLEAR_KEY, label: effectivePlaceholder || msg.selectPlaceholder, isDisabled: false },
|
|
1296
|
+
...items
|
|
1297
|
+
] : items;
|
|
1298
|
+
warnHelpWithoutLabel("Select", label, help);
|
|
1299
|
+
return /* @__PURE__ */ jsxs14(
|
|
1193
1300
|
AriaSelect,
|
|
1194
1301
|
{
|
|
1195
1302
|
className: cx("pire-field", className),
|
|
1196
1303
|
style,
|
|
1197
|
-
selectedKey: value,
|
|
1198
|
-
defaultSelectedKey: defaultValue,
|
|
1199
|
-
onSelectionChange: (k) =>
|
|
1304
|
+
selectedKey: takesOverSelection ? ownSelection : value,
|
|
1305
|
+
defaultSelectedKey: takesOverSelection ? void 0 : defaultValue,
|
|
1306
|
+
onSelectionChange: (k) => {
|
|
1307
|
+
const raw = k == null ? null : String(k);
|
|
1308
|
+
const next = showsClear && raw === CLEAR_KEY ? null : raw;
|
|
1309
|
+
if (takesOverSelection) setOwnSelection(next);
|
|
1310
|
+
onChange?.(next);
|
|
1311
|
+
},
|
|
1200
1312
|
allowsEmptyCollection: true,
|
|
1201
|
-
placeholder,
|
|
1313
|
+
placeholder: effectivePlaceholder,
|
|
1202
1314
|
validationBehavior: "aria",
|
|
1203
1315
|
...rest,
|
|
1204
1316
|
children: [
|
|
1205
|
-
label ? /* @__PURE__ */
|
|
1206
|
-
|
|
1207
|
-
rest.isRequired ? /* @__PURE__ */ jsx19("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1208
|
-
] }) : null,
|
|
1209
|
-
/* @__PURE__ */ jsxs12(
|
|
1317
|
+
label ? /* @__PURE__ */ jsx22(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1318
|
+
/* @__PURE__ */ jsxs14(
|
|
1210
1319
|
AriaButton5,
|
|
1211
1320
|
{
|
|
1212
1321
|
className: "pire-control",
|
|
@@ -1214,26 +1323,27 @@ function Select({
|
|
|
1214
1323
|
"data-full-width": String(fullWidth),
|
|
1215
1324
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1216
1325
|
children: [
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ jsx22(SelectValue, { className: "pire-select-value" }),
|
|
1327
|
+
/* @__PURE__ */ jsx22(Icon, { name: "chevron-down", size: 16, className: "pire-leading-icon" })
|
|
1219
1328
|
]
|
|
1220
1329
|
}
|
|
1221
1330
|
),
|
|
1222
|
-
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */
|
|
1331
|
+
/* @__PURE__ */ jsx22(FieldDescription, { description, help }),
|
|
1332
|
+
/* @__PURE__ */ jsx22(FieldError3, { className: "pire-field-error", children: errorMessage }),
|
|
1333
|
+
/* @__PURE__ */ jsx22(Popover, { className: "pire-popover", children: /* @__PURE__ */ jsx22(
|
|
1225
1334
|
ListBox,
|
|
1226
1335
|
{
|
|
1227
1336
|
className: "pire-listbox",
|
|
1228
|
-
items,
|
|
1229
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
1230
|
-
children: (item) => /* @__PURE__ */
|
|
1337
|
+
items: rows,
|
|
1338
|
+
renderEmptyState: () => /* @__PURE__ */ jsx22("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: emptyLabel ?? msg.selectEmpty }),
|
|
1339
|
+
children: (item) => /* @__PURE__ */ jsx22(
|
|
1231
1340
|
ListBoxItem,
|
|
1232
1341
|
{
|
|
1233
1342
|
className: "pire-option",
|
|
1234
1343
|
id: item.value,
|
|
1235
1344
|
textValue: item.label,
|
|
1236
1345
|
isDisabled: item.isDisabled,
|
|
1346
|
+
"data-clear": item.value === CLEAR_KEY ? "true" : void 0,
|
|
1237
1347
|
children: item.label
|
|
1238
1348
|
}
|
|
1239
1349
|
)
|
|
@@ -1246,13 +1356,13 @@ function Select({
|
|
|
1246
1356
|
|
|
1247
1357
|
// src/components/forms/Checkbox.tsx
|
|
1248
1358
|
import { Checkbox as AriaCheckbox } from "react-aria-components";
|
|
1249
|
-
import { Fragment, jsx as
|
|
1359
|
+
import { Fragment, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1250
1360
|
function Checkbox({ label, hint, children, className, ...rest }) {
|
|
1251
|
-
return /* @__PURE__ */
|
|
1252
|
-
/* @__PURE__ */
|
|
1253
|
-
/* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ jsx23(AriaCheckbox, { className: cx("pire-choice", className), ...rest, children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs15(Fragment, { children: [
|
|
1362
|
+
/* @__PURE__ */ jsx23("span", { className: "pire-choice-box", "aria-hidden": "true", children: isIndeterminate ? /* @__PURE__ */ jsx23(Icon, { name: "minus", size: 12 }) : isSelected ? /* @__PURE__ */ jsx23(Icon, { name: "check", size: 12 }) : null }),
|
|
1363
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
1254
1364
|
label ?? children,
|
|
1255
|
-
hint ? /* @__PURE__ */
|
|
1365
|
+
hint ? /* @__PURE__ */ jsx23("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1256
1366
|
] })
|
|
1257
1367
|
] }) });
|
|
1258
1368
|
}
|
|
@@ -1261,11 +1371,11 @@ function Checkbox({ label, hint, children, className, ...rest }) {
|
|
|
1261
1371
|
import {
|
|
1262
1372
|
RadioGroup as AriaRadioGroup,
|
|
1263
1373
|
Radio as AriaRadio,
|
|
1264
|
-
Label as
|
|
1265
|
-
Text as
|
|
1374
|
+
Label as Label2,
|
|
1375
|
+
Text as Text4,
|
|
1266
1376
|
FieldError as FieldError4
|
|
1267
1377
|
} from "react-aria-components";
|
|
1268
|
-
import { jsx as
|
|
1378
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1269
1379
|
function RadioGroup({
|
|
1270
1380
|
label,
|
|
1271
1381
|
description,
|
|
@@ -1274,45 +1384,40 @@ function RadioGroup({
|
|
|
1274
1384
|
className,
|
|
1275
1385
|
...rest
|
|
1276
1386
|
}) {
|
|
1277
|
-
return /* @__PURE__ */
|
|
1278
|
-
label ? /* @__PURE__ */
|
|
1279
|
-
/* @__PURE__ */
|
|
1280
|
-
description ? /* @__PURE__ */
|
|
1281
|
-
/* @__PURE__ */
|
|
1387
|
+
return /* @__PURE__ */ jsxs16(AriaRadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
|
|
1388
|
+
label ? /* @__PURE__ */ jsx24(Label2, { className: "pire-field-label", children: label }) : null,
|
|
1389
|
+
/* @__PURE__ */ jsx24("div", { className: "pire-radiogroup", children }),
|
|
1390
|
+
description ? /* @__PURE__ */ jsx24(Text4, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1391
|
+
/* @__PURE__ */ jsx24(FieldError4, { className: "pire-field-error", children: errorMessage })
|
|
1282
1392
|
] });
|
|
1283
1393
|
}
|
|
1284
1394
|
function Radio({ label, hint, children, className, ...rest }) {
|
|
1285
|
-
return /* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
/* @__PURE__ */
|
|
1395
|
+
return /* @__PURE__ */ jsxs16(AriaRadio, { className: cx("pire-choice", className), ...rest, children: [
|
|
1396
|
+
/* @__PURE__ */ jsx24("span", { className: "pire-choice-box", "data-radio": "true", "aria-hidden": "true" }),
|
|
1397
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
1288
1398
|
label ?? children,
|
|
1289
|
-
hint ? /* @__PURE__ */
|
|
1399
|
+
hint ? /* @__PURE__ */ jsx24("span", { className: "pire-choice-hint", children: hint }) : null
|
|
1290
1400
|
] })
|
|
1291
1401
|
] });
|
|
1292
1402
|
}
|
|
1293
1403
|
|
|
1294
1404
|
// src/components/forms/Switch.tsx
|
|
1295
1405
|
import { Switch as AriaSwitch } from "react-aria-components";
|
|
1296
|
-
import { jsx as
|
|
1406
|
+
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1297
1407
|
function Switch({ label, children, className, ...rest }) {
|
|
1298
|
-
return /* @__PURE__ */
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
/* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ jsxs17(AriaSwitch, { className: cx("pire-choice", className), ...rest, children: [
|
|
1409
|
+
/* @__PURE__ */ jsx25("span", { className: "pire-switch-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx25("span", { className: "pire-switch-thumb" }) }),
|
|
1410
|
+
/* @__PURE__ */ jsx25("span", { children: label ?? children })
|
|
1301
1411
|
] });
|
|
1302
1412
|
}
|
|
1303
1413
|
|
|
1304
1414
|
// src/components/forms/ChoiceCardGroup.tsx
|
|
1305
|
-
import {
|
|
1306
|
-
|
|
1307
|
-
Radio as AriaRadio2,
|
|
1308
|
-
Label as Label5,
|
|
1309
|
-
Text as Text7,
|
|
1310
|
-
FieldError as FieldError5
|
|
1311
|
-
} from "react-aria-components";
|
|
1312
|
-
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1415
|
+
import { RadioGroup as AriaRadioGroup2, Radio as AriaRadio2, FieldError as FieldError5 } from "react-aria-components";
|
|
1416
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1313
1417
|
function ChoiceCardGroup({
|
|
1314
1418
|
label,
|
|
1315
1419
|
description,
|
|
1420
|
+
help,
|
|
1316
1421
|
errorMessage,
|
|
1317
1422
|
options,
|
|
1318
1423
|
value,
|
|
@@ -1325,7 +1430,8 @@ function ChoiceCardGroup({
|
|
|
1325
1430
|
style,
|
|
1326
1431
|
...rest
|
|
1327
1432
|
}) {
|
|
1328
|
-
|
|
1433
|
+
warnHelpWithoutLabel("ChoiceCardGroup", label, help);
|
|
1434
|
+
return /* @__PURE__ */ jsxs18(
|
|
1329
1435
|
AriaRadioGroup2,
|
|
1330
1436
|
{
|
|
1331
1437
|
className: cx("pire-field", className),
|
|
@@ -1338,47 +1444,42 @@ function ChoiceCardGroup({
|
|
|
1338
1444
|
isDisabled,
|
|
1339
1445
|
isRequired,
|
|
1340
1446
|
children: [
|
|
1341
|
-
label ? /* @__PURE__ */
|
|
1342
|
-
|
|
1343
|
-
isRequired ? /* @__PURE__ */ jsx23("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1344
|
-
] }) : null,
|
|
1345
|
-
/* @__PURE__ */ jsx23("div", { className: "pire-choicecards", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }, children: options.map((option) => /* @__PURE__ */ jsxs16(
|
|
1447
|
+
label ? /* @__PURE__ */ jsx26(FieldLabel, { label, isRequired, help }) : null,
|
|
1448
|
+
/* @__PURE__ */ jsx26("div", { className: "pire-choicecards", style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }, children: options.map((option) => /* @__PURE__ */ jsxs18(
|
|
1346
1449
|
AriaRadio2,
|
|
1347
1450
|
{
|
|
1348
1451
|
value: option.id,
|
|
1349
1452
|
className: "pire-choicecard",
|
|
1350
1453
|
isDisabled: option.isDisabled,
|
|
1351
1454
|
children: [
|
|
1352
|
-
option.icon ? /* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
option.description ? /* @__PURE__ */
|
|
1355
|
-
option.preview ? /* @__PURE__ */
|
|
1455
|
+
option.icon ? /* @__PURE__ */ jsx26(Icon, { name: option.icon, size: 20 }) : null,
|
|
1456
|
+
/* @__PURE__ */ jsx26("span", { className: "pire-choicecard-label", children: option.label }),
|
|
1457
|
+
option.description ? /* @__PURE__ */ jsx26("span", { className: "pire-choicecard-desc", children: option.description }) : null,
|
|
1458
|
+
option.preview ? /* @__PURE__ */ jsx26("span", { className: "pire-choicecard-preview", "aria-hidden": "true", children: option.preview }) : null
|
|
1356
1459
|
]
|
|
1357
1460
|
},
|
|
1358
1461
|
option.id
|
|
1359
1462
|
)) }),
|
|
1360
|
-
|
|
1361
|
-
/* @__PURE__ */
|
|
1463
|
+
/* @__PURE__ */ jsx26(FieldDescription, { description, help }),
|
|
1464
|
+
/* @__PURE__ */ jsx26(FieldError5, { className: "pire-field-error", children: errorMessage })
|
|
1362
1465
|
]
|
|
1363
1466
|
}
|
|
1364
1467
|
);
|
|
1365
1468
|
}
|
|
1366
1469
|
|
|
1367
1470
|
// src/components/forms/ComboBox.tsx
|
|
1368
|
-
import * as
|
|
1471
|
+
import * as React13 from "react";
|
|
1369
1472
|
import {
|
|
1370
1473
|
ComboBox as AriaComboBox,
|
|
1371
|
-
Label as Label6,
|
|
1372
1474
|
Input as AriaInput2,
|
|
1373
1475
|
Button as AriaButton6,
|
|
1374
1476
|
Group as Group3,
|
|
1375
1477
|
Popover as Popover2,
|
|
1376
1478
|
ListBox as ListBox2,
|
|
1377
1479
|
ListBoxItem as ListBoxItem2,
|
|
1378
|
-
Text as Text8,
|
|
1379
1480
|
FieldError as FieldError6
|
|
1380
1481
|
} from "react-aria-components";
|
|
1381
|
-
import { jsx as
|
|
1482
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1382
1483
|
var norm2 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1383
1484
|
function ComboBox({
|
|
1384
1485
|
label,
|
|
@@ -1389,6 +1490,7 @@ function ComboBox({
|
|
|
1389
1490
|
inputValue,
|
|
1390
1491
|
options = [],
|
|
1391
1492
|
description,
|
|
1493
|
+
help,
|
|
1392
1494
|
errorMessage,
|
|
1393
1495
|
size = "md",
|
|
1394
1496
|
fullWidth = true,
|
|
@@ -1406,10 +1508,10 @@ function ComboBox({
|
|
|
1406
1508
|
const msg = usePireMessages();
|
|
1407
1509
|
const items = options.map(norm2);
|
|
1408
1510
|
const isSelectionControlled = value !== void 0;
|
|
1409
|
-
const [ownSelection, setOwnSelection] =
|
|
1511
|
+
const [ownSelection, setOwnSelection] = React13.useState(defaultValue ?? null);
|
|
1410
1512
|
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1411
1513
|
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1412
|
-
const [typedText, setTypedText] =
|
|
1514
|
+
const [typedText, setTypedText] = React13.useState("");
|
|
1413
1515
|
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1414
1516
|
const handleInputChange = isClearable ? (text) => {
|
|
1415
1517
|
setTypedText(text);
|
|
@@ -1424,7 +1526,8 @@ function ComboBox({
|
|
|
1424
1526
|
};
|
|
1425
1527
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1426
1528
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1427
|
-
|
|
1529
|
+
warnHelpWithoutLabel("ComboBox", label, help);
|
|
1530
|
+
return /* @__PURE__ */ jsxs19(
|
|
1428
1531
|
AriaComboBox,
|
|
1429
1532
|
{
|
|
1430
1533
|
className: cx("pire-field", className),
|
|
@@ -1445,11 +1548,8 @@ function ComboBox({
|
|
|
1445
1548
|
validationBehavior: "aria",
|
|
1446
1549
|
...rest,
|
|
1447
1550
|
children: [
|
|
1448
|
-
label ? /* @__PURE__ */
|
|
1449
|
-
|
|
1450
|
-
rest.isRequired ? /* @__PURE__ */ jsx24("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1451
|
-
] }) : null,
|
|
1452
|
-
/* @__PURE__ */ jsxs17(
|
|
1551
|
+
label ? /* @__PURE__ */ jsx27(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1552
|
+
/* @__PURE__ */ jsxs19(
|
|
1453
1553
|
Group3,
|
|
1454
1554
|
{
|
|
1455
1555
|
className: "pire-control",
|
|
@@ -1457,9 +1557,9 @@ function ComboBox({
|
|
|
1457
1557
|
"data-full-width": String(fullWidth),
|
|
1458
1558
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1459
1559
|
children: [
|
|
1460
|
-
/* @__PURE__ */
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
showsClear ? /* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ jsx27(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1561
|
+
/* @__PURE__ */ jsx27(AriaInput2, { className: "pire-input", placeholder: rest.placeholder }),
|
|
1562
|
+
showsClear ? /* @__PURE__ */ jsx27(
|
|
1463
1563
|
AriaButton6,
|
|
1464
1564
|
{
|
|
1465
1565
|
className: "pire-input-clear",
|
|
@@ -1471,22 +1571,22 @@ function ComboBox({
|
|
|
1471
1571
|
children: clearLabel ?? msg.inputClear
|
|
1472
1572
|
}
|
|
1473
1573
|
) : null,
|
|
1474
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ jsx27(
|
|
1475
1575
|
AriaButton6,
|
|
1476
1576
|
{
|
|
1477
1577
|
className: "pire-iconbtn",
|
|
1478
1578
|
"data-size": "sm",
|
|
1479
1579
|
"aria-label": msg.comboBoxShowSuggestions,
|
|
1480
1580
|
style: { width: 20, height: 20 },
|
|
1481
|
-
children: /* @__PURE__ */
|
|
1581
|
+
children: /* @__PURE__ */ jsx27(Icon, { name: "chevron-down", size: 16 })
|
|
1482
1582
|
}
|
|
1483
1583
|
)
|
|
1484
1584
|
]
|
|
1485
1585
|
}
|
|
1486
1586
|
),
|
|
1487
|
-
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsx27(FieldDescription, { description, help }),
|
|
1588
|
+
/* @__PURE__ */ jsx27(FieldError6, { className: "pire-field-error", children: errorMessage }),
|
|
1589
|
+
/* @__PURE__ */ jsx27(Popover2, { className: "pire-popover", children: /* @__PURE__ */ jsx27(
|
|
1490
1590
|
ListBox2,
|
|
1491
1591
|
{
|
|
1492
1592
|
className: "pire-listbox",
|
|
@@ -1494,8 +1594,8 @@ function ComboBox({
|
|
|
1494
1594
|
const el = e.currentTarget;
|
|
1495
1595
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1496
1596
|
} : void 0,
|
|
1497
|
-
renderEmptyState: showsStatus ? () => /* @__PURE__ */
|
|
1498
|
-
children: (item) => /* @__PURE__ */
|
|
1597
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ jsx27("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1598
|
+
children: (item) => /* @__PURE__ */ jsxs19(
|
|
1499
1599
|
ListBoxItem2,
|
|
1500
1600
|
{
|
|
1501
1601
|
className: "pire-option",
|
|
@@ -1503,8 +1603,8 @@ function ComboBox({
|
|
|
1503
1603
|
textValue: item.label,
|
|
1504
1604
|
isDisabled: item.isDisabled,
|
|
1505
1605
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
item.secondary ? /* @__PURE__ */
|
|
1606
|
+
/* @__PURE__ */ jsx27("span", { className: "pire-option-label", children: item.label }),
|
|
1607
|
+
item.secondary ? /* @__PURE__ */ jsx27("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1508
1608
|
]
|
|
1509
1609
|
}
|
|
1510
1610
|
)
|
|
@@ -1516,22 +1616,20 @@ function ComboBox({
|
|
|
1516
1616
|
}
|
|
1517
1617
|
|
|
1518
1618
|
// src/components/forms/MultiComboBox.tsx
|
|
1519
|
-
import * as
|
|
1619
|
+
import * as React14 from "react";
|
|
1520
1620
|
import {
|
|
1521
1621
|
ComboBox as AriaComboBox2,
|
|
1522
|
-
Label as Label7,
|
|
1523
1622
|
Input as AriaInput3,
|
|
1524
1623
|
Button as AriaButton7,
|
|
1525
|
-
ButtonContext,
|
|
1624
|
+
ButtonContext as ButtonContext3,
|
|
1526
1625
|
Group as Group4,
|
|
1527
1626
|
Popover as Popover3,
|
|
1528
1627
|
ListBox as ListBox3,
|
|
1529
1628
|
ListBoxItem as ListBoxItem3,
|
|
1530
|
-
Text as Text9,
|
|
1531
1629
|
FieldError as FieldError7,
|
|
1532
1630
|
VisuallyHidden
|
|
1533
1631
|
} from "react-aria-components";
|
|
1534
|
-
import { jsx as
|
|
1632
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1535
1633
|
var norm3 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
1536
1634
|
function MultiComboBox({
|
|
1537
1635
|
label,
|
|
@@ -1541,6 +1639,7 @@ function MultiComboBox({
|
|
|
1541
1639
|
onInputChange,
|
|
1542
1640
|
options = [],
|
|
1543
1641
|
description,
|
|
1642
|
+
help,
|
|
1544
1643
|
errorMessage,
|
|
1545
1644
|
allowsCustomValue,
|
|
1546
1645
|
size = "md",
|
|
@@ -1555,15 +1654,15 @@ function MultiComboBox({
|
|
|
1555
1654
|
...rest
|
|
1556
1655
|
}) {
|
|
1557
1656
|
const msg = usePireMessages();
|
|
1558
|
-
const items =
|
|
1657
|
+
const items = React14.useMemo(() => options.map(norm3), [options]);
|
|
1559
1658
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1560
1659
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1561
|
-
const [uncontrolled, setUncontrolled] =
|
|
1562
|
-
const [announcement, setAnnouncement] =
|
|
1563
|
-
const inputRef =
|
|
1660
|
+
const [uncontrolled, setUncontrolled] = React14.useState(defaultValue ?? []);
|
|
1661
|
+
const [announcement, setAnnouncement] = React14.useState("");
|
|
1662
|
+
const inputRef = React14.useRef(null);
|
|
1564
1663
|
const raw = value ?? uncontrolled;
|
|
1565
1664
|
const contentKey = raw.join("\0");
|
|
1566
|
-
const values =
|
|
1665
|
+
const values = React14.useMemo(() => raw, [contentKey]);
|
|
1567
1666
|
const labelOf = (v) => items.find((o) => o.value === v)?.label ?? v;
|
|
1568
1667
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1569
1668
|
const commit = (next) => {
|
|
@@ -1596,7 +1695,8 @@ function MultiComboBox({
|
|
|
1596
1695
|
e.stopPropagation();
|
|
1597
1696
|
if (!values.includes(next)) commit([...values, next]);
|
|
1598
1697
|
};
|
|
1599
|
-
|
|
1698
|
+
warnHelpWithoutLabel("MultiComboBox", label, help);
|
|
1699
|
+
return /* @__PURE__ */ jsxs20(
|
|
1600
1700
|
AriaComboBox2,
|
|
1601
1701
|
{
|
|
1602
1702
|
className: cx("pire-field", className),
|
|
@@ -1613,11 +1713,8 @@ function MultiComboBox({
|
|
|
1613
1713
|
validationBehavior: "aria",
|
|
1614
1714
|
...rest,
|
|
1615
1715
|
children: [
|
|
1616
|
-
label ? /* @__PURE__ */
|
|
1617
|
-
|
|
1618
|
-
rest.isRequired ? /* @__PURE__ */ jsx25("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1619
|
-
] }) : null,
|
|
1620
|
-
/* @__PURE__ */ jsxs18(
|
|
1716
|
+
label ? /* @__PURE__ */ jsx28(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1717
|
+
/* @__PURE__ */ jsxs20(
|
|
1621
1718
|
Group4,
|
|
1622
1719
|
{
|
|
1623
1720
|
className: "pire-control",
|
|
@@ -1627,14 +1724,14 @@ function MultiComboBox({
|
|
|
1627
1724
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1628
1725
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1629
1726
|
children: [
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1727
|
+
/* @__PURE__ */ jsx28(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1728
|
+
/* @__PURE__ */ jsxs20("div", { className: "pire-chipfield", children: [
|
|
1729
|
+
/* @__PURE__ */ jsx28(ButtonContext3.Provider, { value: null, children: values.map((v) => (
|
|
1633
1730
|
/* Disabled follows the field, not `isEditable`: a read-only field's chips are
|
|
1634
1731
|
real, current values and should read as such — they simply lose the × . */
|
|
1635
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ jsx28(Tag, { isDisabled: rest.isDisabled, onRemove: isEditable ? () => remove(v) : void 0, children: labelOf(v) }, v)
|
|
1636
1733
|
)) }),
|
|
1637
|
-
/* @__PURE__ */
|
|
1734
|
+
/* @__PURE__ */ jsx28(
|
|
1638
1735
|
AriaInput3,
|
|
1639
1736
|
{
|
|
1640
1737
|
ref: inputRef,
|
|
@@ -1644,23 +1741,23 @@ function MultiComboBox({
|
|
|
1644
1741
|
}
|
|
1645
1742
|
)
|
|
1646
1743
|
] }),
|
|
1647
|
-
/* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ jsx28(
|
|
1648
1745
|
AriaButton7,
|
|
1649
1746
|
{
|
|
1650
1747
|
className: "pire-iconbtn",
|
|
1651
1748
|
"data-size": "sm",
|
|
1652
1749
|
"aria-label": msg.comboBoxShowSuggestions,
|
|
1653
1750
|
style: { width: 20, height: 20 },
|
|
1654
|
-
children: /* @__PURE__ */
|
|
1751
|
+
children: /* @__PURE__ */ jsx28(Icon, { name: "chevron-down", size: 16 })
|
|
1655
1752
|
}
|
|
1656
1753
|
)
|
|
1657
1754
|
]
|
|
1658
1755
|
}
|
|
1659
1756
|
),
|
|
1660
|
-
/* @__PURE__ */
|
|
1661
|
-
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */
|
|
1757
|
+
/* @__PURE__ */ jsx28(VisuallyHidden, { children: /* @__PURE__ */ jsx28("span", { "aria-live": "polite", children: announcement }) }),
|
|
1758
|
+
/* @__PURE__ */ jsx28(FieldDescription, { description, help }),
|
|
1759
|
+
/* @__PURE__ */ jsx28(FieldError7, { className: "pire-field-error", children: errorMessage }),
|
|
1760
|
+
/* @__PURE__ */ jsx28(Popover3, { className: "pire-popover", children: /* @__PURE__ */ jsx28(
|
|
1664
1761
|
ListBox3,
|
|
1665
1762
|
{
|
|
1666
1763
|
className: "pire-listbox",
|
|
@@ -1668,8 +1765,8 @@ function MultiComboBox({
|
|
|
1668
1765
|
const el = e.currentTarget;
|
|
1669
1766
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) onLoadMore();
|
|
1670
1767
|
} : void 0,
|
|
1671
|
-
renderEmptyState: showsStatus ? () => /* @__PURE__ */
|
|
1672
|
-
children: (item) => /* @__PURE__ */
|
|
1768
|
+
renderEmptyState: showsStatus ? () => /* @__PURE__ */ jsx28("div", { className: "pire-listbox-status", role: "status", "aria-live": "polite", children: isLoading ? loadingLabel ?? msg.comboBoxLoading : emptyLabel }) : void 0,
|
|
1769
|
+
children: (item) => /* @__PURE__ */ jsxs20(
|
|
1673
1770
|
ListBoxItem3,
|
|
1674
1771
|
{
|
|
1675
1772
|
className: "pire-option",
|
|
@@ -1677,8 +1774,8 @@ function MultiComboBox({
|
|
|
1677
1774
|
textValue: item.label,
|
|
1678
1775
|
isDisabled: item.isDisabled,
|
|
1679
1776
|
children: [
|
|
1680
|
-
/* @__PURE__ */
|
|
1681
|
-
item.secondary ? /* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ jsx28("span", { className: "pire-option-label", children: item.label }),
|
|
1778
|
+
item.secondary ? /* @__PURE__ */ jsx28("span", { className: "pire-option-secondary", children: item.secondary }) : null
|
|
1682
1779
|
]
|
|
1683
1780
|
}
|
|
1684
1781
|
)
|
|
@@ -1690,14 +1787,12 @@ function MultiComboBox({
|
|
|
1690
1787
|
}
|
|
1691
1788
|
|
|
1692
1789
|
// src/components/forms/NumberField.tsx
|
|
1693
|
-
import * as
|
|
1790
|
+
import * as React15 from "react";
|
|
1694
1791
|
import {
|
|
1695
1792
|
NumberField as AriaNumberField,
|
|
1696
|
-
Label as Label8,
|
|
1697
1793
|
Input as AriaInput4,
|
|
1698
1794
|
Group as Group5,
|
|
1699
1795
|
Button as AriaButton8,
|
|
1700
|
-
Text as Text10,
|
|
1701
1796
|
FieldError as FieldError8,
|
|
1702
1797
|
useLocale,
|
|
1703
1798
|
NumberFieldStateContext
|
|
@@ -1709,7 +1804,7 @@ function decimalSeparatorFor(locale) {
|
|
|
1709
1804
|
}
|
|
1710
1805
|
|
|
1711
1806
|
// src/components/forms/NumberField.tsx
|
|
1712
|
-
import { jsx as
|
|
1807
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1713
1808
|
function typeIntoInput(el, text) {
|
|
1714
1809
|
const start = el.selectionStart ?? el.value.length;
|
|
1715
1810
|
const end = el.selectionEnd ?? start;
|
|
@@ -1740,11 +1835,11 @@ function toAriaNumber(value) {
|
|
|
1740
1835
|
return typeof value === "number" ? value : Number(value);
|
|
1741
1836
|
}
|
|
1742
1837
|
function ClearButton({ label, onClear }) {
|
|
1743
|
-
const state =
|
|
1838
|
+
const state = React15.useContext(NumberFieldStateContext);
|
|
1744
1839
|
if (!state?.inputValue) {
|
|
1745
1840
|
return null;
|
|
1746
1841
|
}
|
|
1747
|
-
return /* @__PURE__ */
|
|
1842
|
+
return /* @__PURE__ */ jsx29(
|
|
1748
1843
|
AriaButton8,
|
|
1749
1844
|
{
|
|
1750
1845
|
className: "pire-input-clear",
|
|
@@ -1761,6 +1856,7 @@ function NumberField({
|
|
|
1761
1856
|
label,
|
|
1762
1857
|
suffix,
|
|
1763
1858
|
description,
|
|
1859
|
+
help,
|
|
1764
1860
|
errorMessage,
|
|
1765
1861
|
hideStepper,
|
|
1766
1862
|
stepperLayout = "stacked",
|
|
@@ -1782,7 +1878,7 @@ function NumberField({
|
|
|
1782
1878
|
const { locale } = useLocale();
|
|
1783
1879
|
const empty = emptyValue === void 0 ? NaN : emptyValue;
|
|
1784
1880
|
const isControlled = value !== void 0;
|
|
1785
|
-
const [ownValue, setOwnValue] =
|
|
1881
|
+
const [ownValue, setOwnValue] = React15.useState(() => toAriaNumber(defaultValue) ?? NaN);
|
|
1786
1882
|
const takesOverValue = Boolean(isClearable) && !isControlled;
|
|
1787
1883
|
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : { value: toAriaNumber(value), defaultValue: toAriaNumber(defaultValue) };
|
|
1788
1884
|
const handleChange = (next) => {
|
|
@@ -1831,7 +1927,8 @@ function NumberField({
|
|
|
1831
1927
|
event.stopPropagation();
|
|
1832
1928
|
typeIntoInput(event.currentTarget, localised);
|
|
1833
1929
|
};
|
|
1834
|
-
|
|
1930
|
+
warnHelpWithoutLabel("NumberField", label, help);
|
|
1931
|
+
return /* @__PURE__ */ jsxs21(
|
|
1835
1932
|
AriaNumberField,
|
|
1836
1933
|
{
|
|
1837
1934
|
className: cx("pire-field", className),
|
|
@@ -1841,11 +1938,8 @@ function NumberField({
|
|
|
1841
1938
|
...rest,
|
|
1842
1939
|
...valueProps,
|
|
1843
1940
|
children: [
|
|
1844
|
-
label ? /* @__PURE__ */
|
|
1845
|
-
|
|
1846
|
-
rest.isRequired ? /* @__PURE__ */ jsx26("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1847
|
-
] }) : null,
|
|
1848
|
-
/* @__PURE__ */ jsxs19(
|
|
1941
|
+
label ? /* @__PURE__ */ jsx29(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
1942
|
+
/* @__PURE__ */ jsxs21(
|
|
1849
1943
|
Group5,
|
|
1850
1944
|
{
|
|
1851
1945
|
className: "pire-control",
|
|
@@ -1855,16 +1949,16 @@ function NumberField({
|
|
|
1855
1949
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1856
1950
|
"data-stepper": stepperLayout,
|
|
1857
1951
|
children: [
|
|
1858
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */
|
|
1952
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ jsx29(
|
|
1859
1953
|
AriaButton8,
|
|
1860
1954
|
{
|
|
1861
1955
|
slot: "decrement",
|
|
1862
1956
|
className: "pire-qty-btn",
|
|
1863
1957
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
1864
|
-
children: /* @__PURE__ */
|
|
1958
|
+
children: /* @__PURE__ */ jsx29(Icon, { name: "minus", size: 16 })
|
|
1865
1959
|
}
|
|
1866
1960
|
) : null,
|
|
1867
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ jsx29(
|
|
1868
1962
|
AriaInput4,
|
|
1869
1963
|
{
|
|
1870
1964
|
className: "pire-input",
|
|
@@ -1873,52 +1967,52 @@ function NumberField({
|
|
|
1873
1967
|
onPasteCapture: handlePaste
|
|
1874
1968
|
}
|
|
1875
1969
|
),
|
|
1876
|
-
suffix ? /* @__PURE__ */
|
|
1877
|
-
showsClear ? /* @__PURE__ */
|
|
1878
|
-
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */
|
|
1970
|
+
suffix ? /* @__PURE__ */ jsx29("span", { className: "pire-affix", children: suffix }) : null,
|
|
1971
|
+
showsClear ? /* @__PURE__ */ jsx29(ClearButton, { label: clearLabel ?? msg.inputClear, onClear: () => handleChange(NaN) }) : null,
|
|
1972
|
+
!hideStepper && stepperLayout === "inline" ? /* @__PURE__ */ jsx29(
|
|
1879
1973
|
AriaButton8,
|
|
1880
1974
|
{
|
|
1881
1975
|
slot: "increment",
|
|
1882
1976
|
className: "pire-qty-btn",
|
|
1883
1977
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
1884
|
-
children: /* @__PURE__ */
|
|
1978
|
+
children: /* @__PURE__ */ jsx29(Icon, { name: "plus", size: 16 })
|
|
1885
1979
|
}
|
|
1886
1980
|
) : null,
|
|
1887
|
-
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1981
|
+
hideStepper ? null : stepperLayout === "inline" ? null : /* @__PURE__ */ jsxs21("span", { className: "pire-stepper", children: [
|
|
1982
|
+
/* @__PURE__ */ jsx29(
|
|
1889
1983
|
AriaButton8,
|
|
1890
1984
|
{
|
|
1891
1985
|
slot: "increment",
|
|
1892
1986
|
className: "pire-stepper-btn",
|
|
1893
1987
|
"aria-label": incrementLabel ?? msg.numberFieldIncrease,
|
|
1894
|
-
children: /* @__PURE__ */
|
|
1988
|
+
children: /* @__PURE__ */ jsx29(Icon, { name: "plus", size: 10 })
|
|
1895
1989
|
}
|
|
1896
1990
|
),
|
|
1897
|
-
/* @__PURE__ */
|
|
1991
|
+
/* @__PURE__ */ jsx29(
|
|
1898
1992
|
AriaButton8,
|
|
1899
1993
|
{
|
|
1900
1994
|
slot: "decrement",
|
|
1901
1995
|
className: "pire-stepper-btn",
|
|
1902
1996
|
"aria-label": decrementLabel ?? msg.numberFieldDecrease,
|
|
1903
|
-
children: /* @__PURE__ */
|
|
1997
|
+
children: /* @__PURE__ */ jsx29(Icon, { name: "minus", size: 10 })
|
|
1904
1998
|
}
|
|
1905
1999
|
)
|
|
1906
2000
|
] })
|
|
1907
2001
|
]
|
|
1908
2002
|
}
|
|
1909
2003
|
),
|
|
1910
|
-
|
|
1911
|
-
/* @__PURE__ */
|
|
2004
|
+
/* @__PURE__ */ jsx29(FieldDescription, { description, help }),
|
|
2005
|
+
/* @__PURE__ */ jsx29(FieldError8, { className: "pire-field-error", children: errorMessage })
|
|
1912
2006
|
]
|
|
1913
2007
|
}
|
|
1914
2008
|
);
|
|
1915
2009
|
}
|
|
1916
2010
|
|
|
1917
2011
|
// src/components/forms/QuantityStepper.tsx
|
|
1918
|
-
import { jsx as
|
|
2012
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1919
2013
|
function QuantityStepper({ size = "md", ...rest }) {
|
|
1920
2014
|
const msg = usePireMessages();
|
|
1921
|
-
return /* @__PURE__ */
|
|
2015
|
+
return /* @__PURE__ */ jsx30(
|
|
1922
2016
|
NumberField,
|
|
1923
2017
|
{
|
|
1924
2018
|
...rest,
|
|
@@ -1932,10 +2026,9 @@ function QuantityStepper({ size = "md", ...rest }) {
|
|
|
1932
2026
|
}
|
|
1933
2027
|
|
|
1934
2028
|
// src/components/forms/DatePicker.tsx
|
|
1935
|
-
import * as
|
|
2029
|
+
import * as React16 from "react";
|
|
1936
2030
|
import {
|
|
1937
2031
|
DatePicker as AriaDatePicker,
|
|
1938
|
-
Label as Label9,
|
|
1939
2032
|
Group as Group6,
|
|
1940
2033
|
DateInput,
|
|
1941
2034
|
DateSegment,
|
|
@@ -1949,7 +2042,6 @@ import {
|
|
|
1949
2042
|
CalendarGridBody,
|
|
1950
2043
|
CalendarCell,
|
|
1951
2044
|
Heading as Heading2,
|
|
1952
|
-
Text as Text11,
|
|
1953
2045
|
FieldError as FieldError9,
|
|
1954
2046
|
DatePickerStateContext
|
|
1955
2047
|
} from "react-aria-components";
|
|
@@ -1982,13 +2074,13 @@ function coerceBound(value) {
|
|
|
1982
2074
|
}
|
|
1983
2075
|
|
|
1984
2076
|
// src/components/forms/DatePicker.tsx
|
|
1985
|
-
import { jsx as
|
|
2077
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1986
2078
|
function ClearButton2({ label }) {
|
|
1987
|
-
const state =
|
|
2079
|
+
const state = React16.useContext(DatePickerStateContext);
|
|
1988
2080
|
if (!state?.value) {
|
|
1989
2081
|
return null;
|
|
1990
2082
|
}
|
|
1991
|
-
return /* @__PURE__ */
|
|
2083
|
+
return /* @__PURE__ */ jsx31(
|
|
1992
2084
|
AriaButton9,
|
|
1993
2085
|
{
|
|
1994
2086
|
className: "pire-input-clear",
|
|
@@ -2004,6 +2096,7 @@ function ClearButton2({ label }) {
|
|
|
2004
2096
|
function DatePicker({
|
|
2005
2097
|
label,
|
|
2006
2098
|
description,
|
|
2099
|
+
help,
|
|
2007
2100
|
errorMessage,
|
|
2008
2101
|
size = "md",
|
|
2009
2102
|
fullWidth = true,
|
|
@@ -2024,7 +2117,8 @@ function DatePicker({
|
|
|
2024
2117
|
const handleChange = (next) => onChange?.(
|
|
2025
2118
|
valueFormat === "iso" && next ? next.toString() : next
|
|
2026
2119
|
);
|
|
2027
|
-
|
|
2120
|
+
warnHelpWithoutLabel("DatePicker", label, help);
|
|
2121
|
+
return /* @__PURE__ */ jsxs22(
|
|
2028
2122
|
AriaDatePicker,
|
|
2029
2123
|
{
|
|
2030
2124
|
className: cx("pire-field", className),
|
|
@@ -2037,11 +2131,8 @@ function DatePicker({
|
|
|
2037
2131
|
onChange: handleChange,
|
|
2038
2132
|
...rest,
|
|
2039
2133
|
children: [
|
|
2040
|
-
label ? /* @__PURE__ */
|
|
2041
|
-
|
|
2042
|
-
rest.isRequired ? /* @__PURE__ */ jsx28("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
2043
|
-
] }) : null,
|
|
2044
|
-
/* @__PURE__ */ jsxs20(
|
|
2134
|
+
label ? /* @__PURE__ */ jsx31(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2135
|
+
/* @__PURE__ */ jsxs22(
|
|
2045
2136
|
Group6,
|
|
2046
2137
|
{
|
|
2047
2138
|
className: "pire-control",
|
|
@@ -2050,50 +2141,50 @@ function DatePicker({
|
|
|
2050
2141
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
2051
2142
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2052
2143
|
children: [
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
showsClear ? /* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2144
|
+
/* @__PURE__ */ jsx31(DateInput, { className: "pire-datefield", children: (segment) => /* @__PURE__ */ jsx31(DateSegment, { segment, className: "pire-datesegment" }) }),
|
|
2145
|
+
showsClear ? /* @__PURE__ */ jsx31(ClearButton2, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2146
|
+
/* @__PURE__ */ jsx31(
|
|
2056
2147
|
AriaButton9,
|
|
2057
2148
|
{
|
|
2058
2149
|
className: "pire-iconbtn",
|
|
2059
2150
|
"data-size": "sm",
|
|
2060
2151
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2061
2152
|
style: { width: 24, height: 24 },
|
|
2062
|
-
children: /* @__PURE__ */
|
|
2153
|
+
children: /* @__PURE__ */ jsx31(Icon, { name: "calendar", size: 16 })
|
|
2063
2154
|
}
|
|
2064
2155
|
)
|
|
2065
2156
|
]
|
|
2066
2157
|
}
|
|
2067
2158
|
),
|
|
2068
|
-
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ jsx31(FieldDescription, { description, help }),
|
|
2160
|
+
/* @__PURE__ */ jsx31(FieldError9, { className: "pire-field-error", children: errorMessage }),
|
|
2161
|
+
/* @__PURE__ */ jsx31(Popover4, { className: "pire-popover", children: /* @__PURE__ */ jsx31(AriaDialog, { children: /* @__PURE__ */ jsxs22(Calendar, { className: "pire-calendar", children: [
|
|
2162
|
+
/* @__PURE__ */ jsxs22("header", { className: "pire-calendar-head", children: [
|
|
2163
|
+
/* @__PURE__ */ jsx31(
|
|
2073
2164
|
AriaButton9,
|
|
2074
2165
|
{
|
|
2075
2166
|
slot: "previous",
|
|
2076
2167
|
className: "pire-iconbtn",
|
|
2077
2168
|
"data-size": "sm",
|
|
2078
2169
|
"aria-label": msg.datePickerPreviousMonth,
|
|
2079
|
-
children: /* @__PURE__ */
|
|
2170
|
+
children: /* @__PURE__ */ jsx31(Icon, { name: "chevron-left", size: 16 })
|
|
2080
2171
|
}
|
|
2081
2172
|
),
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsx31(Heading2, { className: "pire-calendar-title" }),
|
|
2174
|
+
/* @__PURE__ */ jsx31(
|
|
2084
2175
|
AriaButton9,
|
|
2085
2176
|
{
|
|
2086
2177
|
slot: "next",
|
|
2087
2178
|
className: "pire-iconbtn",
|
|
2088
2179
|
"data-size": "sm",
|
|
2089
2180
|
"aria-label": msg.datePickerNextMonth,
|
|
2090
|
-
children: /* @__PURE__ */
|
|
2181
|
+
children: /* @__PURE__ */ jsx31(Icon, { name: "chevron-right", size: 16 })
|
|
2091
2182
|
}
|
|
2092
2183
|
)
|
|
2093
2184
|
] }),
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsxs22(CalendarGrid, { className: "pire-calendar-grid", children: [
|
|
2186
|
+
/* @__PURE__ */ jsx31(CalendarGridHeader, { children: (day) => /* @__PURE__ */ jsx31(CalendarHeaderCell, { children: day }) }),
|
|
2187
|
+
/* @__PURE__ */ jsx31(CalendarGridBody, { children: (date) => /* @__PURE__ */ jsx31(CalendarCell, { date, className: "pire-calendar-cell" }) })
|
|
2097
2188
|
] })
|
|
2098
2189
|
] }) }) })
|
|
2099
2190
|
]
|
|
@@ -2102,10 +2193,9 @@ function DatePicker({
|
|
|
2102
2193
|
}
|
|
2103
2194
|
|
|
2104
2195
|
// src/components/forms/DateRangePicker.tsx
|
|
2105
|
-
import * as
|
|
2196
|
+
import * as React17 from "react";
|
|
2106
2197
|
import {
|
|
2107
2198
|
DateRangePicker as AriaDateRangePicker,
|
|
2108
|
-
Label as Label10,
|
|
2109
2199
|
Group as Group7,
|
|
2110
2200
|
DateInput as DateInput2,
|
|
2111
2201
|
DateSegment as DateSegment2,
|
|
@@ -2119,11 +2209,10 @@ import {
|
|
|
2119
2209
|
CalendarGridBody as CalendarGridBody2,
|
|
2120
2210
|
CalendarCell as CalendarCell2,
|
|
2121
2211
|
Heading as Heading3,
|
|
2122
|
-
Text as Text12,
|
|
2123
2212
|
FieldError as FieldError10,
|
|
2124
2213
|
DateRangePickerStateContext
|
|
2125
2214
|
} from "react-aria-components";
|
|
2126
|
-
import { jsx as
|
|
2215
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2127
2216
|
function coerceRange(range) {
|
|
2128
2217
|
if (range === void 0) {
|
|
2129
2218
|
return void 0;
|
|
@@ -2144,11 +2233,11 @@ function rangeLengthInDays(range) {
|
|
|
2144
2233
|
return end.toDate("UTC").getTime() / 864e5 - start.toDate("UTC").getTime() / 864e5 + 1;
|
|
2145
2234
|
}
|
|
2146
2235
|
function ClearButton3({ label }) {
|
|
2147
|
-
const state =
|
|
2236
|
+
const state = React17.useContext(DateRangePickerStateContext);
|
|
2148
2237
|
if (!state?.value?.start && !state?.value?.end) {
|
|
2149
2238
|
return null;
|
|
2150
2239
|
}
|
|
2151
|
-
return /* @__PURE__ */
|
|
2240
|
+
return /* @__PURE__ */ jsx32(
|
|
2152
2241
|
AriaButton10,
|
|
2153
2242
|
{
|
|
2154
2243
|
className: "pire-input-clear",
|
|
@@ -2164,6 +2253,7 @@ function ClearButton3({ label }) {
|
|
|
2164
2253
|
function DateRangePicker({
|
|
2165
2254
|
label,
|
|
2166
2255
|
description,
|
|
2256
|
+
help,
|
|
2167
2257
|
errorMessage,
|
|
2168
2258
|
maxRangeDays,
|
|
2169
2259
|
presets,
|
|
@@ -2199,7 +2289,8 @@ function DateRangePicker({
|
|
|
2199
2289
|
valueFormat === "iso" ? { start: next.start.toString(), end: next.end.toString() } : { start: next.start, end: next.end }
|
|
2200
2290
|
);
|
|
2201
2291
|
};
|
|
2202
|
-
|
|
2292
|
+
warnHelpWithoutLabel("DateRangePicker", label, help);
|
|
2293
|
+
return /* @__PURE__ */ jsxs23(
|
|
2203
2294
|
AriaDateRangePicker,
|
|
2204
2295
|
{
|
|
2205
2296
|
className: cx("pire-field", className),
|
|
@@ -2215,11 +2306,8 @@ function DateRangePicker({
|
|
|
2215
2306
|
...rest,
|
|
2216
2307
|
isInvalid: rest.isInvalid || tooLong || void 0,
|
|
2217
2308
|
children: [
|
|
2218
|
-
label ? /* @__PURE__ */
|
|
2219
|
-
|
|
2220
|
-
rest.isRequired ? /* @__PURE__ */ jsx29("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
2221
|
-
] }) : null,
|
|
2222
|
-
/* @__PURE__ */ jsxs21(
|
|
2309
|
+
label ? /* @__PURE__ */ jsx32(FieldLabel, { label, isRequired: rest.isRequired, help }) : null,
|
|
2310
|
+
/* @__PURE__ */ jsxs23(
|
|
2223
2311
|
Group7,
|
|
2224
2312
|
{
|
|
2225
2313
|
className: "pire-control pire-daterange-control",
|
|
@@ -2228,30 +2316,30 @@ function DateRangePicker({
|
|
|
2228
2316
|
"data-invalid": rest.isInvalid || tooLong ? "true" : void 0,
|
|
2229
2317
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
2230
2318
|
children: [
|
|
2231
|
-
/* @__PURE__ */
|
|
2232
|
-
/* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2319
|
+
/* @__PURE__ */ jsx32(DateInput2, { slot: "start", className: "pire-datefield", children: (segment) => /* @__PURE__ */ jsx32(DateSegment2, { segment, className: "pire-datesegment" }) }),
|
|
2320
|
+
/* @__PURE__ */ jsx32("span", { "aria-hidden": "true", className: "pire-daterange-dash", children: "\u2013" }),
|
|
2321
|
+
/* @__PURE__ */ jsx32(DateInput2, { slot: "end", className: "pire-datefield", children: (segment) => /* @__PURE__ */ jsx32(DateSegment2, { segment, className: "pire-datesegment" }) }),
|
|
2322
|
+
isClearable && !rest.isDisabled && !rest.isReadOnly ? /* @__PURE__ */ jsx32(ClearButton3, { label: clearLabel ?? msg.inputClear }) : null,
|
|
2323
|
+
/* @__PURE__ */ jsx32(
|
|
2236
2324
|
AriaButton10,
|
|
2237
2325
|
{
|
|
2238
2326
|
className: "pire-iconbtn",
|
|
2239
2327
|
"data-size": "sm",
|
|
2240
2328
|
"aria-label": msg.datePickerOpenCalendar,
|
|
2241
2329
|
style: { width: 24, height: 24 },
|
|
2242
|
-
children: /* @__PURE__ */
|
|
2330
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "calendar", size: 16 })
|
|
2243
2331
|
}
|
|
2244
2332
|
)
|
|
2245
2333
|
]
|
|
2246
2334
|
}
|
|
2247
2335
|
),
|
|
2248
|
-
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2336
|
+
/* @__PURE__ */ jsx32(FieldDescription, { description, help }),
|
|
2337
|
+
/* @__PURE__ */ jsx32(FieldError10, { className: "pire-field-error", children: errorMessage }),
|
|
2338
|
+
/* @__PURE__ */ jsx32(Popover5, { className: "pire-popover", children: /* @__PURE__ */ jsxs23(AriaDialog2, { className: "pire-daterange-dialog", children: [
|
|
2251
2339
|
presets?.length ? (
|
|
2252
2340
|
// Before the calendar in the DOM, so keyboard users reach the shortcut without
|
|
2253
2341
|
// arrowing through a month first.
|
|
2254
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ jsx32("div", { className: "pire-daterange-presets", role: "group", "aria-label": msg.dateRangePresetsLabel, children: presets.map((preset) => /* @__PURE__ */ jsx32(
|
|
2255
2343
|
AriaButton10,
|
|
2256
2344
|
{
|
|
2257
2345
|
className: "pire-daterange-preset",
|
|
@@ -2261,33 +2349,33 @@ function DateRangePicker({
|
|
|
2261
2349
|
preset.id
|
|
2262
2350
|
)) })
|
|
2263
2351
|
) : null,
|
|
2264
|
-
/* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
2266
|
-
/* @__PURE__ */
|
|
2352
|
+
/* @__PURE__ */ jsxs23(RangeCalendar, { className: "pire-calendar", children: [
|
|
2353
|
+
/* @__PURE__ */ jsxs23("header", { className: "pire-calendar-head", children: [
|
|
2354
|
+
/* @__PURE__ */ jsx32(
|
|
2267
2355
|
AriaButton10,
|
|
2268
2356
|
{
|
|
2269
2357
|
slot: "previous",
|
|
2270
2358
|
className: "pire-iconbtn",
|
|
2271
2359
|
"data-size": "sm",
|
|
2272
2360
|
"aria-label": msg.datePickerPreviousMonth,
|
|
2273
|
-
children: /* @__PURE__ */
|
|
2361
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "chevron-left", size: 16 })
|
|
2274
2362
|
}
|
|
2275
2363
|
),
|
|
2276
|
-
/* @__PURE__ */
|
|
2277
|
-
/* @__PURE__ */
|
|
2364
|
+
/* @__PURE__ */ jsx32(Heading3, { className: "pire-calendar-title" }),
|
|
2365
|
+
/* @__PURE__ */ jsx32(
|
|
2278
2366
|
AriaButton10,
|
|
2279
2367
|
{
|
|
2280
2368
|
slot: "next",
|
|
2281
2369
|
className: "pire-iconbtn",
|
|
2282
2370
|
"data-size": "sm",
|
|
2283
2371
|
"aria-label": msg.datePickerNextMonth,
|
|
2284
|
-
children: /* @__PURE__ */
|
|
2372
|
+
children: /* @__PURE__ */ jsx32(Icon, { name: "chevron-right", size: 16 })
|
|
2285
2373
|
}
|
|
2286
2374
|
)
|
|
2287
2375
|
] }),
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2376
|
+
/* @__PURE__ */ jsxs23(CalendarGrid2, { className: "pire-calendar-grid", children: [
|
|
2377
|
+
/* @__PURE__ */ jsx32(CalendarGridHeader2, { children: (day) => /* @__PURE__ */ jsx32(CalendarHeaderCell2, { children: day }) }),
|
|
2378
|
+
/* @__PURE__ */ jsx32(CalendarGridBody2, { children: (date) => /* @__PURE__ */ jsx32(CalendarCell2, { date, className: "pire-calendar-cell" }) })
|
|
2291
2379
|
] })
|
|
2292
2380
|
] })
|
|
2293
2381
|
] }) })
|
|
@@ -2297,26 +2385,26 @@ function DateRangePicker({
|
|
|
2297
2385
|
}
|
|
2298
2386
|
|
|
2299
2387
|
// src/components/forms/ValueHelpField.tsx
|
|
2300
|
-
import * as
|
|
2388
|
+
import * as React21 from "react";
|
|
2301
2389
|
|
|
2302
2390
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2303
|
-
import * as
|
|
2391
|
+
import * as React20 from "react";
|
|
2304
2392
|
|
|
2305
2393
|
// src/components/feedback/Dialog.tsx
|
|
2306
|
-
import * as
|
|
2394
|
+
import * as React18 from "react";
|
|
2307
2395
|
import { ModalOverlay, Modal, Dialog as AriaDialog3, Heading as Heading4 } from "react-aria-components";
|
|
2308
|
-
import { jsx as
|
|
2396
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2309
2397
|
function DialogTitle({ children, className }) {
|
|
2310
|
-
return /* @__PURE__ */
|
|
2398
|
+
return /* @__PURE__ */ jsx33(Heading4, { slot: "title", className: cx("pire-dialog-title", className), children });
|
|
2311
2399
|
}
|
|
2312
2400
|
function DialogDescription({ children, className }) {
|
|
2313
|
-
return /* @__PURE__ */
|
|
2401
|
+
return /* @__PURE__ */ jsx33("p", { className: cx("pire-dialog-sub", className), style: { margin: 0 }, children });
|
|
2314
2402
|
}
|
|
2315
2403
|
function DialogBody({ children, className }) {
|
|
2316
|
-
return /* @__PURE__ */
|
|
2404
|
+
return /* @__PURE__ */ jsx33("div", { className: cx("pire-dialog-body", className), children });
|
|
2317
2405
|
}
|
|
2318
2406
|
function DialogActions({ children, className }) {
|
|
2319
|
-
return /* @__PURE__ */
|
|
2407
|
+
return /* @__PURE__ */ jsx33("footer", { className: cx("pire-dialog-foot", className), children });
|
|
2320
2408
|
}
|
|
2321
2409
|
function Dialog({
|
|
2322
2410
|
isOpen,
|
|
@@ -2337,19 +2425,19 @@ function Dialog({
|
|
|
2337
2425
|
onClose?.();
|
|
2338
2426
|
onOpenChange?.(false);
|
|
2339
2427
|
};
|
|
2340
|
-
const parts =
|
|
2341
|
-
const slotOf = (type) => parts.find((node) =>
|
|
2428
|
+
const parts = React18.Children.toArray(children);
|
|
2429
|
+
const slotOf = (type) => parts.find((node) => React18.isValidElement(node) && node.type === type);
|
|
2342
2430
|
const titleSlot = slotOf(DialogTitle);
|
|
2343
2431
|
const descriptionSlot = slotOf(DialogDescription);
|
|
2344
2432
|
const bodySlot = slotOf(DialogBody);
|
|
2345
2433
|
const actionsSlot = slotOf(DialogActions);
|
|
2346
2434
|
const slots = [titleSlot, descriptionSlot, bodySlot, actionsSlot];
|
|
2347
2435
|
const loose = parts.filter((node) => !slots.includes(node));
|
|
2348
|
-
const heading = titleSlot ?? (title ? /* @__PURE__ */
|
|
2349
|
-
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */
|
|
2350
|
-
const actions = actionsSlot ?? (footer ? /* @__PURE__ */
|
|
2351
|
-
const body = bodySlot ?? (loose.length ? /* @__PURE__ */
|
|
2352
|
-
return /* @__PURE__ */
|
|
2436
|
+
const heading = titleSlot ?? (title ? /* @__PURE__ */ jsx33(Heading4, { slot: "title", className: "pire-dialog-title", children: title }) : null);
|
|
2437
|
+
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ jsx33("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null);
|
|
2438
|
+
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ jsx33("footer", { className: "pire-dialog-foot", children: footer }) : null);
|
|
2439
|
+
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ jsx33("div", { className: "pire-dialog-body", children: loose }) : null);
|
|
2440
|
+
return /* @__PURE__ */ jsx33(
|
|
2353
2441
|
ModalOverlay,
|
|
2354
2442
|
{
|
|
2355
2443
|
className: "pire-modal-overlay",
|
|
@@ -2358,13 +2446,13 @@ function Dialog({
|
|
|
2358
2446
|
onOpenChange: (o) => {
|
|
2359
2447
|
if (!o) close();
|
|
2360
2448
|
},
|
|
2361
|
-
children: /* @__PURE__ */
|
|
2362
|
-
heading || description ? /* @__PURE__ */
|
|
2363
|
-
/* @__PURE__ */
|
|
2449
|
+
children: /* @__PURE__ */ jsx33(Modal, { className: cx("pire-modal", className), "data-size": size, style, children: /* @__PURE__ */ jsxs24(AriaDialog3, { className: "pire-dialog", children: [
|
|
2450
|
+
heading || description ? /* @__PURE__ */ jsxs24("header", { className: "pire-dialog-head", children: [
|
|
2451
|
+
/* @__PURE__ */ jsxs24("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2364
2452
|
heading,
|
|
2365
2453
|
description
|
|
2366
2454
|
] }),
|
|
2367
|
-
showClose ? /* @__PURE__ */
|
|
2455
|
+
showClose ? /* @__PURE__ */ jsx33(IconButton, { icon: "x", label: msg.dialogClose, size: "sm", onPress: close }) : null
|
|
2368
2456
|
] }) : null,
|
|
2369
2457
|
body,
|
|
2370
2458
|
actions
|
|
@@ -2374,7 +2462,7 @@ function Dialog({
|
|
|
2374
2462
|
}
|
|
2375
2463
|
|
|
2376
2464
|
// src/components/data/DataTable.tsx
|
|
2377
|
-
import * as
|
|
2465
|
+
import * as React19 from "react";
|
|
2378
2466
|
import {
|
|
2379
2467
|
Table,
|
|
2380
2468
|
TableHeader,
|
|
@@ -2386,9 +2474,9 @@ import {
|
|
|
2386
2474
|
} from "react-aria-components";
|
|
2387
2475
|
|
|
2388
2476
|
// src/components/feedback/Skeleton.tsx
|
|
2389
|
-
import { jsx as
|
|
2477
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2390
2478
|
function Skeleton({ shape = "text", width, height, className, style, ...rest }) {
|
|
2391
|
-
return /* @__PURE__ */
|
|
2479
|
+
return /* @__PURE__ */ jsx34(
|
|
2392
2480
|
"div",
|
|
2393
2481
|
{
|
|
2394
2482
|
className: cx("pire-skeleton", className),
|
|
@@ -2408,7 +2496,7 @@ function SkeletonTableRow({
|
|
|
2408
2496
|
...rest
|
|
2409
2497
|
}) {
|
|
2410
2498
|
const cells = typeof columns === "number" ? Array.from({ length: columns }, () => ({})) : columns;
|
|
2411
|
-
return /* @__PURE__ */
|
|
2499
|
+
return /* @__PURE__ */ jsx34(
|
|
2412
2500
|
"div",
|
|
2413
2501
|
{
|
|
2414
2502
|
className: cx("pire-skeleton-row", className),
|
|
@@ -2418,13 +2506,13 @@ function SkeletonTableRow({
|
|
|
2418
2506
|
...rest,
|
|
2419
2507
|
children: cells.map((c, i) => {
|
|
2420
2508
|
const align = c.numeric ? "right" : c.align ?? "left";
|
|
2421
|
-
return /* @__PURE__ */
|
|
2509
|
+
return /* @__PURE__ */ jsx34(
|
|
2422
2510
|
"div",
|
|
2423
2511
|
{
|
|
2424
2512
|
className: "pire-skeleton-cell",
|
|
2425
2513
|
"data-align": align,
|
|
2426
2514
|
style: { width: c.width, flex: c.width ? "0 0 auto" : void 0 },
|
|
2427
|
-
children: /* @__PURE__ */
|
|
2515
|
+
children: /* @__PURE__ */ jsx34(Skeleton, { width: BAR_WIDTHS[i % BAR_WIDTHS.length] })
|
|
2428
2516
|
},
|
|
2429
2517
|
i
|
|
2430
2518
|
);
|
|
@@ -2434,12 +2522,12 @@ function SkeletonTableRow({
|
|
|
2434
2522
|
}
|
|
2435
2523
|
|
|
2436
2524
|
// src/components/data/DataTable.tsx
|
|
2437
|
-
import { jsx as
|
|
2438
|
-
var
|
|
2439
|
-
var
|
|
2440
|
-
function
|
|
2441
|
-
if (
|
|
2442
|
-
|
|
2525
|
+
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2526
|
+
var IS_DEV3 = process.env.NODE_ENV !== "production";
|
|
2527
|
+
var warned3 = /* @__PURE__ */ new Set();
|
|
2528
|
+
function warnOnce3(key, message) {
|
|
2529
|
+
if (warned3.has(key)) return;
|
|
2530
|
+
warned3.add(key);
|
|
2443
2531
|
console.warn(`[pire] ${message}`);
|
|
2444
2532
|
}
|
|
2445
2533
|
var CHECKBOX_W = 44;
|
|
@@ -2470,7 +2558,7 @@ function DataTable({
|
|
|
2470
2558
|
const msg = usePireMessages();
|
|
2471
2559
|
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
2472
2560
|
const hasCheckboxColumn = selectionMode === "multiple";
|
|
2473
|
-
const pinnedGeometry =
|
|
2561
|
+
const pinnedGeometry = React19.useMemo(() => {
|
|
2474
2562
|
const geometry = /* @__PURE__ */ new Map();
|
|
2475
2563
|
let x = hasCheckboxColumn ? CHECKBOX_W : 0;
|
|
2476
2564
|
let broke = null;
|
|
@@ -2480,8 +2568,8 @@ function DataTable({
|
|
|
2480
2568
|
break;
|
|
2481
2569
|
}
|
|
2482
2570
|
if (typeof column.width !== "number") {
|
|
2483
|
-
if (
|
|
2484
|
-
|
|
2571
|
+
if (IS_DEV3)
|
|
2572
|
+
warnOnce3(
|
|
2485
2573
|
`pin-width:${column.key}`,
|
|
2486
2574
|
`DataTable column "${column.key}" is pinned but has no numeric width, so its offset cannot be computed. It will scroll.`
|
|
2487
2575
|
);
|
|
@@ -2491,10 +2579,10 @@ function DataTable({
|
|
|
2491
2579
|
geometry.set(column.key, { left: x, width: column.width });
|
|
2492
2580
|
x += column.width;
|
|
2493
2581
|
}
|
|
2494
|
-
if (
|
|
2582
|
+
if (IS_DEV3 && broke === "unpinned") {
|
|
2495
2583
|
const stranded = columns.slice(geometry.size).find((c) => c.pinned);
|
|
2496
2584
|
if (stranded) {
|
|
2497
|
-
|
|
2585
|
+
warnOnce3(
|
|
2498
2586
|
`pin-gap:${stranded.key}`,
|
|
2499
2587
|
`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.`
|
|
2500
2588
|
);
|
|
@@ -2536,14 +2624,14 @@ function DataTable({
|
|
|
2536
2624
|
style: { left: box.left, width: box.width, minWidth: box.width, maxWidth: box.width }
|
|
2537
2625
|
};
|
|
2538
2626
|
};
|
|
2539
|
-
return /* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ jsx35(
|
|
2540
2628
|
"div",
|
|
2541
2629
|
{
|
|
2542
2630
|
className: cx("pire-table-wrap", className),
|
|
2543
2631
|
style,
|
|
2544
2632
|
"data-loading": isLoading ? "true" : void 0,
|
|
2545
2633
|
"aria-busy": isLoading ? "true" : void 0,
|
|
2546
|
-
children: /* @__PURE__ */
|
|
2634
|
+
children: /* @__PURE__ */ jsxs25(
|
|
2547
2635
|
Table,
|
|
2548
2636
|
{
|
|
2549
2637
|
className: "pire-table",
|
|
@@ -2562,8 +2650,8 @@ function DataTable({
|
|
|
2562
2650
|
if (row) onRowAction(row);
|
|
2563
2651
|
} : void 0,
|
|
2564
2652
|
children: [
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
2653
|
+
/* @__PURE__ */ jsxs25(TableHeader, { className: "pire-thead-row", children: [
|
|
2654
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx35(Column, { className: "pire-th", ...pinProps(null), children: hideSelectAll ? /* @__PURE__ */ jsx35("span", { className: "pire-sr-only", children: msg.dataTableSelectionColumn }) : /* @__PURE__ */ jsx35(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
2567
2655
|
columns.map((c, i) => (
|
|
2568
2656
|
// The checkbox column is never the row header — a selection control does not identify
|
|
2569
2657
|
// the record — so the first *data* column carries it regardless of whether a checkbox
|
|
@@ -2571,7 +2659,7 @@ function DataTable({
|
|
|
2571
2659
|
// table with no row header at all: invisible on first paint, and a hard crash from
|
|
2572
2660
|
// React Aria's own "table must have a row header" invariant the moment `rows` changes
|
|
2573
2661
|
// under it (search, sort, a paginated load).
|
|
2574
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ jsx35(
|
|
2575
2663
|
Column,
|
|
2576
2664
|
{
|
|
2577
2665
|
id: c.key,
|
|
@@ -2581,9 +2669,9 @@ function DataTable({
|
|
|
2581
2669
|
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
2582
2670
|
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
2583
2671
|
...pinProps(c.key),
|
|
2584
|
-
children: /* @__PURE__ */
|
|
2672
|
+
children: /* @__PURE__ */ jsxs25("span", { className: c.hideLabel ? "pire-sr-only" : "pire-th-inner", children: [
|
|
2585
2673
|
c.label,
|
|
2586
|
-
c.sortable ? /* @__PURE__ */
|
|
2674
|
+
c.sortable ? /* @__PURE__ */ jsx35(
|
|
2587
2675
|
Icon,
|
|
2588
2676
|
{
|
|
2589
2677
|
size: 12,
|
|
@@ -2599,29 +2687,29 @@ function DataTable({
|
|
|
2599
2687
|
)
|
|
2600
2688
|
))
|
|
2601
2689
|
] }),
|
|
2602
|
-
/* @__PURE__ */
|
|
2690
|
+
/* @__PURE__ */ jsx35(
|
|
2603
2691
|
TableBody,
|
|
2604
2692
|
{
|
|
2605
|
-
renderEmptyState: () => isLoading ? /* @__PURE__ */
|
|
2606
|
-
/* @__PURE__ */
|
|
2693
|
+
renderEmptyState: () => isLoading ? /* @__PURE__ */ jsxs25("div", { className: "pire-table-loading", role: "status", "aria-live": "polite", children: [
|
|
2694
|
+
/* @__PURE__ */ jsx35("span", { className: "pire-sr-only", children: loadingLabel ?? msg.dataTableLoading }),
|
|
2607
2695
|
Array.from({ length: skeletonRows }, (_, i) => (
|
|
2608
2696
|
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
2609
|
-
/* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ jsx35(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
2610
2698
|
))
|
|
2611
|
-
] }) : /* @__PURE__ */
|
|
2699
|
+
] }) : /* @__PURE__ */ jsx35("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }),
|
|
2612
2700
|
children: body.flatMap((row) => {
|
|
2613
2701
|
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
2614
|
-
const record = /* @__PURE__ */
|
|
2702
|
+
const record = /* @__PURE__ */ jsxs25(
|
|
2615
2703
|
Row,
|
|
2616
2704
|
{
|
|
2617
2705
|
id: row.id,
|
|
2618
2706
|
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
2619
2707
|
"data-pressable": onRowAction && !rowIsDisabled ? "true" : void 0,
|
|
2620
2708
|
children: [
|
|
2621
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
2709
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx35(Cell, { className: "pire-td", ...pinProps(null), children: /* @__PURE__ */ jsx35(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
2622
2710
|
columns.map((c) => {
|
|
2623
2711
|
const pin = pinProps(c.key);
|
|
2624
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ jsx35(
|
|
2625
2713
|
Cell,
|
|
2626
2714
|
{
|
|
2627
2715
|
className: "pire-td",
|
|
@@ -2641,23 +2729,23 @@ function DataTable({
|
|
|
2641
2729
|
if (!renderExpanded || !expanded.has(String(row.id))) return [record];
|
|
2642
2730
|
return [
|
|
2643
2731
|
record,
|
|
2644
|
-
/* @__PURE__ */
|
|
2732
|
+
/* @__PURE__ */ jsx35(Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ jsx35(Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))
|
|
2645
2733
|
];
|
|
2646
2734
|
})
|
|
2647
2735
|
}
|
|
2648
2736
|
),
|
|
2649
|
-
footer && !isLoading ? /* @__PURE__ */
|
|
2650
|
-
hasCheckboxColumn ? /* @__PURE__ */
|
|
2737
|
+
footer && !isLoading ? /* @__PURE__ */ jsx35(TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ jsxs25(Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
2738
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx35(Cell, { className: "pire-tf", ...pinProps(null) }) : null,
|
|
2651
2739
|
columns.map((c, i) => {
|
|
2652
2740
|
const pin = pinProps(c.key);
|
|
2653
|
-
return /* @__PURE__ */
|
|
2741
|
+
return /* @__PURE__ */ jsx35(
|
|
2654
2742
|
Cell,
|
|
2655
2743
|
{
|
|
2656
2744
|
className: "pire-tf",
|
|
2657
2745
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
2658
2746
|
...pin,
|
|
2659
2747
|
style: { ...pin.style, textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
2660
|
-
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */
|
|
2748
|
+
children: footer[c.key] ?? (i === 0 ? /* @__PURE__ */ jsx35("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
2661
2749
|
},
|
|
2662
2750
|
c.key
|
|
2663
2751
|
);
|
|
@@ -2671,7 +2759,7 @@ function DataTable({
|
|
|
2671
2759
|
}
|
|
2672
2760
|
|
|
2673
2761
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
2674
|
-
import { Fragment as Fragment2, jsx as
|
|
2762
|
+
import { Fragment as Fragment2, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2675
2763
|
function ValueHelpDialog({
|
|
2676
2764
|
isOpen,
|
|
2677
2765
|
title,
|
|
@@ -2691,12 +2779,12 @@ function ValueHelpDialog({
|
|
|
2691
2779
|
onConfirm
|
|
2692
2780
|
}) {
|
|
2693
2781
|
const msg = usePireMessages();
|
|
2694
|
-
const [query, setQuery] =
|
|
2695
|
-
|
|
2782
|
+
const [query, setQuery] = React20.useState("");
|
|
2783
|
+
React20.useEffect(() => {
|
|
2696
2784
|
if (isOpen) setQuery("");
|
|
2697
2785
|
}, [isOpen]);
|
|
2698
2786
|
const isMultiple = selectionMode === "multiple";
|
|
2699
|
-
const filtered =
|
|
2787
|
+
const filtered = React20.useMemo(() => {
|
|
2700
2788
|
if (isFilteredExternally) return rows;
|
|
2701
2789
|
const q = query.trim().toLowerCase();
|
|
2702
2790
|
if (!q) return rows;
|
|
@@ -2706,16 +2794,16 @@ function ValueHelpDialog({
|
|
|
2706
2794
|
setQuery(value);
|
|
2707
2795
|
onSearch?.(value);
|
|
2708
2796
|
};
|
|
2709
|
-
return /* @__PURE__ */
|
|
2797
|
+
return /* @__PURE__ */ jsx36(
|
|
2710
2798
|
Dialog,
|
|
2711
2799
|
{
|
|
2712
2800
|
isOpen,
|
|
2713
2801
|
size: "lg",
|
|
2714
2802
|
title: title ?? msg.valueHelpDialogTitle,
|
|
2715
2803
|
onClose,
|
|
2716
|
-
footer: /* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
isMultiple ? /* @__PURE__ */
|
|
2804
|
+
footer: /* @__PURE__ */ jsxs26(Fragment2, { children: [
|
|
2805
|
+
/* @__PURE__ */ jsx36(Button, { variant: "tertiary", onPress: onClose, children: msg.valueHelpDialogCancel }),
|
|
2806
|
+
isMultiple ? /* @__PURE__ */ jsx36(
|
|
2719
2807
|
Button,
|
|
2720
2808
|
{
|
|
2721
2809
|
variant: "primary",
|
|
@@ -2727,8 +2815,8 @@ function ValueHelpDialog({
|
|
|
2727
2815
|
}
|
|
2728
2816
|
) : null
|
|
2729
2817
|
] }),
|
|
2730
|
-
children: /* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2818
|
+
children: /* @__PURE__ */ jsxs26("div", { style: { display: "flex", flexDirection: "column", gap: "var(--sp-3)" }, children: [
|
|
2819
|
+
/* @__PURE__ */ jsx36(
|
|
2732
2820
|
Input,
|
|
2733
2821
|
{
|
|
2734
2822
|
"aria-label": msg.valueHelpDialogSearch,
|
|
@@ -2741,12 +2829,12 @@ function ValueHelpDialog({
|
|
|
2741
2829
|
autoFocus: true
|
|
2742
2830
|
}
|
|
2743
2831
|
),
|
|
2744
|
-
isMultiple ? /* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
2832
|
+
isMultiple ? /* @__PURE__ */ jsxs26("div", { className: "pire-valuehelp-selectionbar", children: [
|
|
2833
|
+
/* @__PURE__ */ jsx36(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.(rows.map((r) => r.id)), children: msg.valueHelpSelectAllCount.replace("{count}", String(rows.length)) }),
|
|
2834
|
+
/* @__PURE__ */ jsx36(Button, { size: "sm", variant: "tertiary", onPress: () => onSelectionChange?.([]), children: msg.valueHelpClearSelection }),
|
|
2835
|
+
/* @__PURE__ */ jsx36("span", { className: "pire-valuehelp-count", children: msg.valueHelpSelectedCount.replace("{count}", String(selectedKeys?.length ?? 0)) })
|
|
2748
2836
|
] }) : null,
|
|
2749
|
-
/* @__PURE__ */
|
|
2837
|
+
/* @__PURE__ */ jsx36(
|
|
2750
2838
|
"div",
|
|
2751
2839
|
{
|
|
2752
2840
|
onScroll: onLoadMore ? (event) => {
|
|
@@ -2754,7 +2842,7 @@ function ValueHelpDialog({
|
|
|
2754
2842
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 64) onLoadMore();
|
|
2755
2843
|
} : void 0,
|
|
2756
2844
|
style: { overflow: "auto", maxHeight: "48vh" },
|
|
2757
|
-
children: /* @__PURE__ */
|
|
2845
|
+
children: /* @__PURE__ */ jsx36(
|
|
2758
2846
|
DataTable,
|
|
2759
2847
|
{
|
|
2760
2848
|
"aria-label": typeof title === "string" ? title : msg.valueHelpDialogTitle,
|
|
@@ -2781,7 +2869,7 @@ function ValueHelpDialog({
|
|
|
2781
2869
|
}
|
|
2782
2870
|
|
|
2783
2871
|
// src/components/forms/ValueHelpField.tsx
|
|
2784
|
-
import { jsx as
|
|
2872
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2785
2873
|
var defaultFormat = (row) => [row.id, row.name ?? row.label ?? row.text].filter(Boolean).join(" \u2014 ");
|
|
2786
2874
|
function ValueHelpField({
|
|
2787
2875
|
label,
|
|
@@ -2807,9 +2895,9 @@ function ValueHelpField({
|
|
|
2807
2895
|
style
|
|
2808
2896
|
}) {
|
|
2809
2897
|
const msg = usePireMessages();
|
|
2810
|
-
const [open, setOpen] =
|
|
2811
|
-
return /* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2898
|
+
const [open, setOpen] = React21.useState(false);
|
|
2899
|
+
return /* @__PURE__ */ jsxs27("div", { className: cx(className), style, children: [
|
|
2900
|
+
/* @__PURE__ */ jsx37(
|
|
2813
2901
|
Input,
|
|
2814
2902
|
{
|
|
2815
2903
|
label,
|
|
@@ -2821,8 +2909,8 @@ function ValueHelpField({
|
|
|
2821
2909
|
placeholder: placeholder ?? msg.valueHelpFieldPlaceholder,
|
|
2822
2910
|
description,
|
|
2823
2911
|
errorMessage,
|
|
2824
|
-
suffix: /* @__PURE__ */
|
|
2825
|
-
allowsClear && value ? /* @__PURE__ */
|
|
2912
|
+
suffix: /* @__PURE__ */ jsxs27("span", { className: "pire-valuehelp-actions", children: [
|
|
2913
|
+
allowsClear && value ? /* @__PURE__ */ jsx37(
|
|
2826
2914
|
IconButton,
|
|
2827
2915
|
{
|
|
2828
2916
|
icon: "x",
|
|
@@ -2831,7 +2919,7 @@ function ValueHelpField({
|
|
|
2831
2919
|
onPress: () => onChange?.(null)
|
|
2832
2920
|
}
|
|
2833
2921
|
) : null,
|
|
2834
|
-
/* @__PURE__ */
|
|
2922
|
+
/* @__PURE__ */ jsx37(
|
|
2835
2923
|
IconButton,
|
|
2836
2924
|
{
|
|
2837
2925
|
icon: "search",
|
|
@@ -2843,7 +2931,7 @@ function ValueHelpField({
|
|
|
2843
2931
|
] })
|
|
2844
2932
|
}
|
|
2845
2933
|
),
|
|
2846
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ jsx37(
|
|
2847
2935
|
ValueHelpDialog,
|
|
2848
2936
|
{
|
|
2849
2937
|
isOpen: open,
|
|
@@ -2863,12 +2951,12 @@ function ValueHelpField({
|
|
|
2863
2951
|
}
|
|
2864
2952
|
|
|
2865
2953
|
// src/components/forms/FileUpload.tsx
|
|
2866
|
-
import * as
|
|
2867
|
-
import { FileTrigger, Text as
|
|
2954
|
+
import * as React22 from "react";
|
|
2955
|
+
import { FileTrigger, Text as Text5 } from "react-aria-components";
|
|
2868
2956
|
|
|
2869
2957
|
// src/components/feedback/ProgressBar.tsx
|
|
2870
|
-
import { ProgressBar as AriaProgressBar, Label as
|
|
2871
|
-
import { Fragment as Fragment3, jsx as
|
|
2958
|
+
import { ProgressBar as AriaProgressBar, Label as Label3 } from "react-aria-components";
|
|
2959
|
+
import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2872
2960
|
function ProgressBar({
|
|
2873
2961
|
value = 0,
|
|
2874
2962
|
minValue = 0,
|
|
@@ -2881,7 +2969,7 @@ function ProgressBar({
|
|
|
2881
2969
|
className,
|
|
2882
2970
|
style
|
|
2883
2971
|
}) {
|
|
2884
|
-
return /* @__PURE__ */
|
|
2972
|
+
return /* @__PURE__ */ jsx38(
|
|
2885
2973
|
AriaProgressBar,
|
|
2886
2974
|
{
|
|
2887
2975
|
className: cx("pire-progress", className),
|
|
@@ -2892,19 +2980,19 @@ function ProgressBar({
|
|
|
2892
2980
|
maxValue,
|
|
2893
2981
|
isIndeterminate,
|
|
2894
2982
|
style,
|
|
2895
|
-
children: ({ percentage, valueText }) => /* @__PURE__ */
|
|
2896
|
-
label || showValue ? /* @__PURE__ */
|
|
2897
|
-
label ? /* @__PURE__ */
|
|
2898
|
-
showValue && !isIndeterminate ? /* @__PURE__ */
|
|
2983
|
+
children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs28(Fragment3, { children: [
|
|
2984
|
+
label || showValue ? /* @__PURE__ */ jsxs28("div", { className: "pire-progress-head", children: [
|
|
2985
|
+
label ? /* @__PURE__ */ jsx38(Label3, { children: label }) : /* @__PURE__ */ jsx38("span", {}),
|
|
2986
|
+
showValue && !isIndeterminate ? /* @__PURE__ */ jsx38("span", { className: "pire-numeric", children: valueText }) : null
|
|
2899
2987
|
] }) : null,
|
|
2900
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ jsx38("div", { className: "pire-progress-track", children: /* @__PURE__ */ jsx38("div", { className: "pire-progress-fill", style: { width: `${isIndeterminate ? 40 : percentage}%` } }) })
|
|
2901
2989
|
] })
|
|
2902
2990
|
}
|
|
2903
2991
|
);
|
|
2904
2992
|
}
|
|
2905
2993
|
|
|
2906
2994
|
// src/components/forms/FileUpload.tsx
|
|
2907
|
-
import { jsx as
|
|
2995
|
+
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2908
2996
|
var isImage = (file) => file.type.startsWith("image/");
|
|
2909
2997
|
function formatFileSize(bytes) {
|
|
2910
2998
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -2956,10 +3044,10 @@ function FileUpload({
|
|
|
2956
3044
|
...rest
|
|
2957
3045
|
}) {
|
|
2958
3046
|
const msg = usePireMessages();
|
|
2959
|
-
const [uncontrolled, setUncontrolled] =
|
|
3047
|
+
const [uncontrolled, setUncontrolled] = React22.useState(defaultValue ?? []);
|
|
2960
3048
|
const files = value ?? uncontrolled;
|
|
2961
|
-
const created =
|
|
2962
|
-
|
|
3049
|
+
const created = React22.useRef([]);
|
|
3050
|
+
React22.useEffect(
|
|
2963
3051
|
() => () => {
|
|
2964
3052
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
2965
3053
|
},
|
|
@@ -2982,7 +3070,7 @@ function FileUpload({
|
|
|
2982
3070
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
2983
3071
|
};
|
|
2984
3072
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
2985
|
-
return /* @__PURE__ */
|
|
3073
|
+
return /* @__PURE__ */ jsxs29(
|
|
2986
3074
|
"div",
|
|
2987
3075
|
{
|
|
2988
3076
|
className: cx("pire-field", "pire-fileupload", className),
|
|
@@ -2991,24 +3079,24 @@ function FileUpload({
|
|
|
2991
3079
|
"data-invalid": isInvalid ? "true" : void 0,
|
|
2992
3080
|
...rest,
|
|
2993
3081
|
children: [
|
|
2994
|
-
label ? /* @__PURE__ */
|
|
3082
|
+
label ? /* @__PURE__ */ jsxs29("span", { className: "pire-field-label", children: [
|
|
2995
3083
|
label,
|
|
2996
|
-
isRequired ? /* @__PURE__ */
|
|
3084
|
+
isRequired ? /* @__PURE__ */ jsx39("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
2997
3085
|
] }) : null,
|
|
2998
|
-
/* @__PURE__ */
|
|
3086
|
+
/* @__PURE__ */ jsx39(
|
|
2999
3087
|
FileTrigger,
|
|
3000
3088
|
{
|
|
3001
3089
|
acceptedFileTypes,
|
|
3002
3090
|
allowsMultiple,
|
|
3003
3091
|
onSelect: accept,
|
|
3004
|
-
children: /* @__PURE__ */
|
|
3092
|
+
children: /* @__PURE__ */ jsx39(Button, { icon: "paperclip", isDisabled: isDisabled || isReadOnly, children: chooseLabel ?? msg.fileUploadChoose })
|
|
3005
3093
|
}
|
|
3006
3094
|
),
|
|
3007
|
-
files.length ? /* @__PURE__ */
|
|
3008
|
-
previewUrl ? /* @__PURE__ */
|
|
3009
|
-
/* @__PURE__ */
|
|
3010
|
-
/* @__PURE__ */
|
|
3011
|
-
isDisabled || isReadOnly ? null : /* @__PURE__ */
|
|
3095
|
+
files.length ? /* @__PURE__ */ jsx39("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ jsxs29("li", { className: "pire-fileupload-item", children: [
|
|
3096
|
+
previewUrl ? /* @__PURE__ */ jsx39("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ jsx39(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
3097
|
+
/* @__PURE__ */ jsx39("span", { className: "pire-fileupload-name", children: file.name }),
|
|
3098
|
+
/* @__PURE__ */ jsx39("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
3099
|
+
isDisabled || isReadOnly ? null : /* @__PURE__ */ jsx39(
|
|
3012
3100
|
IconButton,
|
|
3013
3101
|
{
|
|
3014
3102
|
icon: "x",
|
|
@@ -3018,9 +3106,9 @@ function FileUpload({
|
|
|
3018
3106
|
}
|
|
3019
3107
|
)
|
|
3020
3108
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
3021
|
-
uploadProgress != null ? /* @__PURE__ */
|
|
3022
|
-
description ? /* @__PURE__ */
|
|
3023
|
-
isInvalid && errorMessage ? /* @__PURE__ */
|
|
3109
|
+
uploadProgress != null ? /* @__PURE__ */ jsx39(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
3110
|
+
description ? /* @__PURE__ */ jsx39(Text5, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
3111
|
+
isInvalid && errorMessage ? /* @__PURE__ */ jsx39("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
3024
3112
|
]
|
|
3025
3113
|
}
|
|
3026
3114
|
);
|
|
@@ -3028,7 +3116,7 @@ function FileUpload({
|
|
|
3028
3116
|
|
|
3029
3117
|
// src/components/navigation/ShellBar.tsx
|
|
3030
3118
|
import { MenuTrigger, Button as AriaButton11, Popover as Popover6 } from "react-aria-components";
|
|
3031
|
-
import { jsx as
|
|
3119
|
+
import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3032
3120
|
var initials2 = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
3033
3121
|
function ShellBar({
|
|
3034
3122
|
launcher,
|
|
@@ -3047,21 +3135,21 @@ function ShellBar({
|
|
|
3047
3135
|
...rest
|
|
3048
3136
|
}) {
|
|
3049
3137
|
const msg = usePireMessages();
|
|
3050
|
-
return /* @__PURE__ */
|
|
3138
|
+
return /* @__PURE__ */ jsxs30("header", { className: cx("pire-shellbar", className), ...rest, children: [
|
|
3051
3139
|
launcher,
|
|
3052
|
-
onMenu ? /* @__PURE__ */
|
|
3053
|
-
monogram ? /* @__PURE__ */
|
|
3054
|
-
product ? /* @__PURE__ */
|
|
3055
|
-
title ? /* @__PURE__ */
|
|
3056
|
-
/* @__PURE__ */
|
|
3057
|
-
onSearch ? /* @__PURE__ */
|
|
3140
|
+
onMenu ? /* @__PURE__ */ jsx40(IconButton, { icon: "menu", label: menuLabel, variant: "inverse", size: "sm", onPress: onMenu }) : null,
|
|
3141
|
+
monogram ? /* @__PURE__ */ jsx40("span", { className: "pire-shellbar-mono", "aria-hidden": "true", children: monogram }) : null,
|
|
3142
|
+
product ? /* @__PURE__ */ jsx40("span", { className: "pire-shellbar-product", children: product }) : null,
|
|
3143
|
+
title ? /* @__PURE__ */ jsx40("span", { className: "pire-shellbar-title", children: title }) : null,
|
|
3144
|
+
/* @__PURE__ */ jsx40("span", { className: "pire-shellbar-spacer" }),
|
|
3145
|
+
onSearch ? /* @__PURE__ */ jsx40(IconButton, { icon: "search", label: searchLabel, variant: "inverse", size: "sm", onPress: onSearch }) : null,
|
|
3058
3146
|
actions,
|
|
3059
3147
|
user && userMenu ? (
|
|
3060
3148
|
// A real button, not the img-role span: the avatar is where "my profile", "switch company"
|
|
3061
3149
|
// and "sign out" live in any ERP, and a span accepts neither focus nor onPress. Popover is
|
|
3062
3150
|
// rendered here rather than expected from the consumer so the panel keeps shell placement.
|
|
3063
|
-
/* @__PURE__ */
|
|
3064
|
-
/* @__PURE__ */
|
|
3151
|
+
/* @__PURE__ */ jsxs30(MenuTrigger, { children: [
|
|
3152
|
+
/* @__PURE__ */ jsx40(
|
|
3065
3153
|
AriaButton11,
|
|
3066
3154
|
{
|
|
3067
3155
|
className: "pire-avatar pire-avatar-trigger",
|
|
@@ -3069,14 +3157,14 @@ function ShellBar({
|
|
|
3069
3157
|
children: initials2(user)
|
|
3070
3158
|
}
|
|
3071
3159
|
),
|
|
3072
|
-
/* @__PURE__ */
|
|
3160
|
+
/* @__PURE__ */ jsx40(Popover6, { className: "pire-popover", children: userMenu })
|
|
3073
3161
|
] })
|
|
3074
|
-
) : user ? /* @__PURE__ */
|
|
3162
|
+
) : user ? /* @__PURE__ */ jsx40("span", { className: "pire-avatar", title: user, "aria-label": user, role: "img", children: initials2(user) }) : null
|
|
3075
3163
|
] });
|
|
3076
3164
|
}
|
|
3077
3165
|
|
|
3078
3166
|
// src/components/navigation/SideNav.tsx
|
|
3079
|
-
import * as
|
|
3167
|
+
import * as React23 from "react";
|
|
3080
3168
|
import {
|
|
3081
3169
|
Button as AriaButton12,
|
|
3082
3170
|
Disclosure,
|
|
@@ -3094,11 +3182,11 @@ import {
|
|
|
3094
3182
|
Separator as AriaSeparator2,
|
|
3095
3183
|
Header
|
|
3096
3184
|
} from "react-aria-components";
|
|
3097
|
-
import { jsx as
|
|
3185
|
+
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3098
3186
|
function Menu({ minWidth, className, style, ...rest }) {
|
|
3099
3187
|
const width = typeof minWidth === "number" ? `${minWidth}px` : minWidth;
|
|
3100
3188
|
const menuStyle = width == null ? style : { ["--pire-menu-min-w"]: width, ...style };
|
|
3101
|
-
return /* @__PURE__ */
|
|
3189
|
+
return /* @__PURE__ */ jsx41(AriaMenu, { className: cx("pire-menu", className), style: menuStyle, ...rest });
|
|
3102
3190
|
}
|
|
3103
3191
|
var shortcutKeys = (shortcut) => {
|
|
3104
3192
|
if (shortcut == null) return [];
|
|
@@ -3115,19 +3203,19 @@ function MenuItem({
|
|
|
3115
3203
|
...rest
|
|
3116
3204
|
}) {
|
|
3117
3205
|
const keys = shortcutKeys(shortcut);
|
|
3118
|
-
return /* @__PURE__ */
|
|
3206
|
+
return /* @__PURE__ */ jsxs31(
|
|
3119
3207
|
AriaMenuItem,
|
|
3120
3208
|
{
|
|
3121
3209
|
className: cx("pire-menu-item", className),
|
|
3122
3210
|
"data-tone": tone === "danger" ? "danger" : void 0,
|
|
3123
3211
|
...rest,
|
|
3124
3212
|
children: [
|
|
3125
|
-
icon ? /* @__PURE__ */
|
|
3126
|
-
/* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
description ? /* @__PURE__ */
|
|
3213
|
+
icon ? /* @__PURE__ */ jsx41(Icon, { name: icon, size: 16, className: "pire-menu-item-icon" }) : null,
|
|
3214
|
+
/* @__PURE__ */ jsxs31("span", { className: "pire-menu-item-body", children: [
|
|
3215
|
+
/* @__PURE__ */ jsx41("span", { className: "pire-menu-item-label", children }),
|
|
3216
|
+
description ? /* @__PURE__ */ jsx41("span", { className: "pire-menu-item-desc", children: description }) : null
|
|
3129
3217
|
] }),
|
|
3130
|
-
keys.length ? /* @__PURE__ */
|
|
3218
|
+
keys.length ? /* @__PURE__ */ jsx41("span", { className: "pire-menu-item-shortcut", children: keys.map((cap, index) => /* @__PURE__ */ jsx41(
|
|
3131
3219
|
Kbd,
|
|
3132
3220
|
{
|
|
3133
3221
|
size: "sm",
|
|
@@ -3140,17 +3228,17 @@ function MenuItem({
|
|
|
3140
3228
|
);
|
|
3141
3229
|
}
|
|
3142
3230
|
function MenuSection({ title, children, className, ...rest }) {
|
|
3143
|
-
return /* @__PURE__ */
|
|
3144
|
-
title ? /* @__PURE__ */
|
|
3231
|
+
return /* @__PURE__ */ jsxs31(AriaMenuSection, { className: cx("pire-menu-section", className), ...rest, children: [
|
|
3232
|
+
title ? /* @__PURE__ */ jsx41(Header, { className: "pire-menu-section-title", children: title }) : null,
|
|
3145
3233
|
children
|
|
3146
3234
|
] });
|
|
3147
3235
|
}
|
|
3148
3236
|
function MenuSeparator({ className }) {
|
|
3149
|
-
return /* @__PURE__ */
|
|
3237
|
+
return /* @__PURE__ */ jsx41(AriaSeparator2, { className: cx("pire-menu-separator", className) });
|
|
3150
3238
|
}
|
|
3151
3239
|
|
|
3152
3240
|
// src/components/navigation/SideNav.tsx
|
|
3153
|
-
import { jsx as
|
|
3241
|
+
import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3154
3242
|
function findActiveParent(groups, value) {
|
|
3155
3243
|
if (value == null) return void 0;
|
|
3156
3244
|
for (const group of groups) {
|
|
@@ -3177,10 +3265,10 @@ function SideNav({
|
|
|
3177
3265
|
const msg = usePireMessages();
|
|
3178
3266
|
const activeParent = findActiveParent(groups, value);
|
|
3179
3267
|
const isControlled = expandedIds != null;
|
|
3180
|
-
const [ownExpanded, setOwnExpanded] =
|
|
3268
|
+
const [ownExpanded, setOwnExpanded] = React23.useState(
|
|
3181
3269
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
3182
3270
|
);
|
|
3183
|
-
const [lastValue, setLastValue] =
|
|
3271
|
+
const [lastValue, setLastValue] = React23.useState(value);
|
|
3184
3272
|
if (value !== lastValue) {
|
|
3185
3273
|
setLastValue(value);
|
|
3186
3274
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -3200,7 +3288,7 @@ function SideNav({
|
|
|
3200
3288
|
};
|
|
3201
3289
|
const renderRow = (item, onPress, isGroup) => {
|
|
3202
3290
|
const selected = !isGroup && item.id === value;
|
|
3203
|
-
const button = /* @__PURE__ */
|
|
3291
|
+
const button = /* @__PURE__ */ jsxs32(
|
|
3204
3292
|
AriaButton12,
|
|
3205
3293
|
{
|
|
3206
3294
|
className: "pire-sidenav-item",
|
|
@@ -3210,37 +3298,37 @@ function SideNav({
|
|
|
3210
3298
|
"aria-label": collapsed ? item.label : void 0,
|
|
3211
3299
|
onPress,
|
|
3212
3300
|
children: [
|
|
3213
|
-
item.icon ? /* @__PURE__ */
|
|
3214
|
-
collapsed ? null : /* @__PURE__ */
|
|
3215
|
-
item.count != null && !collapsed ? /* @__PURE__ */
|
|
3301
|
+
item.icon ? /* @__PURE__ */ jsx42(Icon, { name: item.icon, size: 16 }) : null,
|
|
3302
|
+
collapsed ? null : /* @__PURE__ */ jsx42("span", { children: item.label }),
|
|
3303
|
+
item.count != null && !collapsed ? /* @__PURE__ */ jsx42("span", { className: "pire-sidenav-count", children: item.count }) : null
|
|
3216
3304
|
]
|
|
3217
3305
|
},
|
|
3218
3306
|
item.id
|
|
3219
3307
|
);
|
|
3220
|
-
return collapsed ? /* @__PURE__ */
|
|
3308
|
+
return collapsed ? /* @__PURE__ */ jsx42(Tooltip, { label: item.label, placement: "right", children: button }, item.id) : button;
|
|
3221
3309
|
};
|
|
3222
|
-
const renderRailFlyout = (item) => /* @__PURE__ */
|
|
3223
|
-
/* @__PURE__ */
|
|
3310
|
+
const renderRailFlyout = (item) => /* @__PURE__ */ jsxs32(MenuTrigger2, { children: [
|
|
3311
|
+
/* @__PURE__ */ jsx42(
|
|
3224
3312
|
AriaButton12,
|
|
3225
3313
|
{
|
|
3226
3314
|
className: "pire-sidenav-item",
|
|
3227
3315
|
"aria-label": item.label,
|
|
3228
3316
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3229
|
-
children: item.icon ? /* @__PURE__ */
|
|
3317
|
+
children: item.icon ? /* @__PURE__ */ jsx42(Icon, { name: item.icon, size: 16 }) : null
|
|
3230
3318
|
}
|
|
3231
3319
|
),
|
|
3232
|
-
/* @__PURE__ */
|
|
3320
|
+
/* @__PURE__ */ jsx42(Popover7, { className: "pire-popover", placement: "right top", offset: 4, children: /* @__PURE__ */ jsx42(
|
|
3233
3321
|
Menu,
|
|
3234
3322
|
{
|
|
3235
3323
|
"aria-label": item.label,
|
|
3236
3324
|
className: "pire-sidenav-flyout",
|
|
3237
3325
|
onAction: (key) => onChange?.(String(key)),
|
|
3238
|
-
children: (item.items ?? []).map((child) => /* @__PURE__ */
|
|
3326
|
+
children: (item.items ?? []).map((child) => /* @__PURE__ */ jsx42(MenuItem, { id: child.id, children: child.label }, child.id))
|
|
3239
3327
|
}
|
|
3240
3328
|
) })
|
|
3241
3329
|
] }, item.id);
|
|
3242
|
-
const renderSection = (item) => /* @__PURE__ */
|
|
3243
|
-
/* @__PURE__ */
|
|
3330
|
+
const renderSection = (item) => /* @__PURE__ */ jsxs32(Disclosure, { id: item.id, className: "pire-sidenav-section", children: [
|
|
3331
|
+
/* @__PURE__ */ jsxs32(
|
|
3244
3332
|
AriaButton12,
|
|
3245
3333
|
{
|
|
3246
3334
|
slot: "trigger",
|
|
@@ -3248,16 +3336,16 @@ function SideNav({
|
|
|
3248
3336
|
"data-kind": "group",
|
|
3249
3337
|
"data-active-child": item.id === activeParent ? "true" : void 0,
|
|
3250
3338
|
children: [
|
|
3251
|
-
item.icon ? /* @__PURE__ */
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
item.count != null ? /* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3339
|
+
item.icon ? /* @__PURE__ */ jsx42(Icon, { name: item.icon, size: 16 }) : null,
|
|
3340
|
+
/* @__PURE__ */ jsx42("span", { children: item.label }),
|
|
3341
|
+
item.count != null ? /* @__PURE__ */ jsx42("span", { className: "pire-sidenav-count", children: item.count }) : null,
|
|
3342
|
+
/* @__PURE__ */ jsx42(Icon, { name: "chevron-down", size: 16, className: "pire-sidenav-chevron" })
|
|
3255
3343
|
]
|
|
3256
3344
|
}
|
|
3257
3345
|
),
|
|
3258
|
-
/* @__PURE__ */
|
|
3346
|
+
/* @__PURE__ */ jsx42(DisclosurePanel, { className: "pire-sidenav-subnav", children: item.items?.map((child) => {
|
|
3259
3347
|
const selected = child.id === value;
|
|
3260
|
-
return /* @__PURE__ */
|
|
3348
|
+
return /* @__PURE__ */ jsxs32(
|
|
3261
3349
|
AriaButton12,
|
|
3262
3350
|
{
|
|
3263
3351
|
className: "pire-sidenav-item pire-sidenav-subitem",
|
|
@@ -3265,15 +3353,15 @@ function SideNav({
|
|
|
3265
3353
|
"aria-current": selected ? "page" : void 0,
|
|
3266
3354
|
onPress: () => onChange?.(child.id),
|
|
3267
3355
|
children: [
|
|
3268
|
-
/* @__PURE__ */
|
|
3269
|
-
child.count != null ? /* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsx42("span", { children: child.label }),
|
|
3357
|
+
child.count != null ? /* @__PURE__ */ jsx42("span", { className: "pire-sidenav-count", children: child.count }) : null
|
|
3270
3358
|
]
|
|
3271
3359
|
},
|
|
3272
3360
|
child.id
|
|
3273
3361
|
);
|
|
3274
3362
|
}) })
|
|
3275
3363
|
] }, item.id);
|
|
3276
|
-
return /* @__PURE__ */
|
|
3364
|
+
return /* @__PURE__ */ jsxs32(
|
|
3277
3365
|
"nav",
|
|
3278
3366
|
{
|
|
3279
3367
|
className: cx("pire-sidenav", className),
|
|
@@ -3290,9 +3378,9 @@ function SideNav({
|
|
|
3290
3378
|
if (isGroup && collapsed && railFlyout) return renderRailFlyout(item);
|
|
3291
3379
|
return renderRow(item, () => isGroup ? toggleExpanded(item.id) : onChange?.(item.id), isGroup);
|
|
3292
3380
|
});
|
|
3293
|
-
return /* @__PURE__ */
|
|
3294
|
-
group.label && !collapsed ? /* @__PURE__ */
|
|
3295
|
-
hasSections ? /* @__PURE__ */
|
|
3381
|
+
return /* @__PURE__ */ jsxs32("div", { className: "pire-sidenav-group", children: [
|
|
3382
|
+
group.label && !collapsed ? /* @__PURE__ */ jsx42("div", { className: "pire-sidenav-label", children: group.label }) : null,
|
|
3383
|
+
hasSections ? /* @__PURE__ */ jsx42(
|
|
3296
3384
|
DisclosureGroup,
|
|
3297
3385
|
{
|
|
3298
3386
|
className: "pire-sidenav-tree",
|
|
@@ -3304,24 +3392,24 @@ function SideNav({
|
|
|
3304
3392
|
) : rows
|
|
3305
3393
|
] }, group.label ?? gi);
|
|
3306
3394
|
}),
|
|
3307
|
-
footer ? /* @__PURE__ */
|
|
3395
|
+
footer ? /* @__PURE__ */ jsx42("div", { className: "pire-sidenav-footer", children: footer }) : null
|
|
3308
3396
|
]
|
|
3309
3397
|
}
|
|
3310
3398
|
);
|
|
3311
3399
|
}
|
|
3312
3400
|
|
|
3313
3401
|
// src/components/navigation/ShellRail.tsx
|
|
3314
|
-
import * as
|
|
3402
|
+
import * as React24 from "react";
|
|
3315
3403
|
import { Button as AriaButton13 } from "react-aria-components";
|
|
3316
|
-
import { jsx as
|
|
3404
|
+
import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3317
3405
|
function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
3318
3406
|
const msg = usePireMessages();
|
|
3319
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ jsx43("nav", { className: cx("pire-shellrail", className), "aria-label": msg.shellRailLabel, ...rest, children: groups.map((group, gi) => (
|
|
3320
3408
|
// The divider is a sibling of the groups rather than a pseudo-element on one, because the
|
|
3321
3409
|
// scrolling zone would carry its own rule out of view on the first wheel event.
|
|
3322
|
-
/* @__PURE__ */
|
|
3323
|
-
gi > 0 ? /* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3410
|
+
/* @__PURE__ */ jsxs33(React24.Fragment, { children: [
|
|
3411
|
+
gi > 0 ? /* @__PURE__ */ jsx43("div", { className: "pire-shellrail-divider" }) : null,
|
|
3412
|
+
/* @__PURE__ */ jsx43("div", { className: "pire-shellrail-group", "data-scroll": group.isScrollable ? "true" : void 0, children: group.items.map((item) => /* @__PURE__ */ jsx43(Tooltip, { label: item.label, placement: "right", children: /* @__PURE__ */ jsx43(
|
|
3325
3413
|
AriaButton13,
|
|
3326
3414
|
{
|
|
3327
3415
|
className: "pire-shellrail-item",
|
|
@@ -3329,7 +3417,7 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
|
3329
3417
|
"data-selected": item.id === value ? "true" : void 0,
|
|
3330
3418
|
"aria-current": item.id === value ? "true" : void 0,
|
|
3331
3419
|
onPress: () => onChange?.(item.id),
|
|
3332
|
-
children: /* @__PURE__ */
|
|
3420
|
+
children: /* @__PURE__ */ jsx43("span", { className: "pire-shellrail-tile", children: /* @__PURE__ */ jsx43(Icon, { name: item.icon, size: 20 }) })
|
|
3333
3421
|
}
|
|
3334
3422
|
) }, item.id)) })
|
|
3335
3423
|
] }, group.items[0]?.id ?? gi)
|
|
@@ -3338,9 +3426,9 @@ function ShellRail({ groups, value, onChange, className, ...rest }) {
|
|
|
3338
3426
|
|
|
3339
3427
|
// src/components/navigation/Tabs.tsx
|
|
3340
3428
|
import { Tabs as AriaTabs, TabList, Tab as AriaTab, TabPanel } from "react-aria-components";
|
|
3341
|
-
import { jsx as
|
|
3429
|
+
import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3342
3430
|
function Tabs({ items, value, defaultValue, onChange, panels, className, style, ...rest }) {
|
|
3343
|
-
return /* @__PURE__ */
|
|
3431
|
+
return /* @__PURE__ */ jsxs34(
|
|
3344
3432
|
AriaTabs,
|
|
3345
3433
|
{
|
|
3346
3434
|
className,
|
|
@@ -3349,12 +3437,12 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
|
|
|
3349
3437
|
defaultSelectedKey: defaultValue,
|
|
3350
3438
|
onSelectionChange: (k) => onChange?.(String(k)),
|
|
3351
3439
|
children: [
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
item.icon ? /* @__PURE__ */
|
|
3440
|
+
/* @__PURE__ */ jsx44(TabList, { className: "pire-tablist", items, "aria-label": rest["aria-label"] ?? "Views", children: (item) => /* @__PURE__ */ jsxs34(AriaTab, { className: cx("pire-tab"), id: item.id, isDisabled: item.isDisabled, children: [
|
|
3441
|
+
item.icon ? /* @__PURE__ */ jsx44(Icon, { name: item.icon, size: 16 }) : null,
|
|
3354
3442
|
item.label,
|
|
3355
|
-
item.count != null ? /* @__PURE__ */
|
|
3443
|
+
item.count != null ? /* @__PURE__ */ jsx44("span", { className: "pire-tab-count", children: item.count }) : null
|
|
3356
3444
|
] }) }),
|
|
3357
|
-
items.map((item) => /* @__PURE__ */
|
|
3445
|
+
items.map((item) => /* @__PURE__ */ jsx44(TabPanel, { id: item.id, className: panels ? "pire-tabpanel" : void 0, children: panels?.[item.id] }, item.id))
|
|
3358
3446
|
]
|
|
3359
3447
|
}
|
|
3360
3448
|
);
|
|
@@ -3362,9 +3450,9 @@ function Tabs({ items, value, defaultValue, onChange, panels, className, style,
|
|
|
3362
3450
|
|
|
3363
3451
|
// src/components/navigation/Breadcrumb.tsx
|
|
3364
3452
|
import { Breadcrumbs as AriaBreadcrumbs, Breadcrumb as AriaBreadcrumb, Link as Link2 } from "react-aria-components";
|
|
3365
|
-
import { jsx as
|
|
3453
|
+
import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3366
3454
|
function Breadcrumb({ items, onNavigate, className, style }) {
|
|
3367
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ jsx45(
|
|
3368
3456
|
AriaBreadcrumbs,
|
|
3369
3457
|
{
|
|
3370
3458
|
className: cx("pire-breadcrumbs", className),
|
|
@@ -3373,9 +3461,9 @@ function Breadcrumb({ items, onNavigate, className, style }) {
|
|
|
3373
3461
|
onAction: (key) => onNavigate?.(String(key)),
|
|
3374
3462
|
children: (item) => {
|
|
3375
3463
|
const last = items[items.length - 1] === item;
|
|
3376
|
-
return /* @__PURE__ */
|
|
3377
|
-
last ? item.label : /* @__PURE__ */
|
|
3378
|
-
last ? null : /* @__PURE__ */
|
|
3464
|
+
return /* @__PURE__ */ jsxs35(AriaBreadcrumb, { className: "pire-breadcrumb", id: item.id ?? item.label, children: [
|
|
3465
|
+
last ? item.label : /* @__PURE__ */ jsx45(Link2, { href: item.href, children: item.label }),
|
|
3466
|
+
last ? null : /* @__PURE__ */ jsx45(Icon, { name: "chevron-right", size: 12, style: { color: "var(--text-tertiary)" } })
|
|
3379
3467
|
] });
|
|
3380
3468
|
}
|
|
3381
3469
|
}
|
|
@@ -3383,7 +3471,7 @@ function Breadcrumb({ items, onNavigate, className, style }) {
|
|
|
3383
3471
|
}
|
|
3384
3472
|
|
|
3385
3473
|
// src/components/navigation/Pagination.tsx
|
|
3386
|
-
import { jsx as
|
|
3474
|
+
import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3387
3475
|
function Pagination({
|
|
3388
3476
|
page = 1,
|
|
3389
3477
|
pageSize = 25,
|
|
@@ -3398,9 +3486,9 @@ function Pagination({
|
|
|
3398
3486
|
const pages = Math.max(1, Math.ceil(total / pageSize));
|
|
3399
3487
|
const from = total === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
3400
3488
|
const to = Math.min(total, page * pageSize);
|
|
3401
|
-
return /* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
3403
|
-
/* @__PURE__ */
|
|
3489
|
+
return /* @__PURE__ */ jsxs36("nav", { className: cx("pire-pagination", className), style, "aria-label": msg.paginationLabel, children: [
|
|
3490
|
+
/* @__PURE__ */ jsx46("span", { className: "pire-pagination-count", children: msg.paginationRange.replace("{from}", from.toLocaleString()).replace("{to}", to.toLocaleString()).replace("{total}", total.toLocaleString()) }),
|
|
3491
|
+
/* @__PURE__ */ jsx46(
|
|
3404
3492
|
IconButton,
|
|
3405
3493
|
{
|
|
3406
3494
|
icon: "chevron-left",
|
|
@@ -3411,8 +3499,8 @@ function Pagination({
|
|
|
3411
3499
|
onPress: () => onPageChange?.(page - 1)
|
|
3412
3500
|
}
|
|
3413
3501
|
),
|
|
3414
|
-
/* @__PURE__ */
|
|
3415
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ jsx46("span", { className: "pire-pagination-count", "aria-live": "polite", children: msg.paginationPageOf.replace("{page}", String(page)).replace("{pages}", String(pages)) }),
|
|
3503
|
+
/* @__PURE__ */ jsx46(
|
|
3416
3504
|
IconButton,
|
|
3417
3505
|
{
|
|
3418
3506
|
icon: "chevron-right",
|
|
@@ -3423,7 +3511,7 @@ function Pagination({
|
|
|
3423
3511
|
onPress: () => onPageChange?.(page + 1)
|
|
3424
3512
|
}
|
|
3425
3513
|
),
|
|
3426
|
-
onPageSizeChange ? /* @__PURE__ */
|
|
3514
|
+
onPageSizeChange ? /* @__PURE__ */ jsx46(
|
|
3427
3515
|
Select,
|
|
3428
3516
|
{
|
|
3429
3517
|
"aria-label": msg.paginationRowsPerPage,
|
|
@@ -3439,9 +3527,9 @@ function Pagination({
|
|
|
3439
3527
|
}
|
|
3440
3528
|
|
|
3441
3529
|
// src/components/navigation/Ribbon.tsx
|
|
3442
|
-
import * as
|
|
3530
|
+
import * as React25 from "react";
|
|
3443
3531
|
import { Tabs as AriaTabs2, TabList as TabList2, Tab as AriaTab2, TabPanel as TabPanel2, Toolbar, Button as Button3 } from "react-aria-components";
|
|
3444
|
-
import { Fragment as Fragment6, jsx as
|
|
3532
|
+
import { Fragment as Fragment6, jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3445
3533
|
var outside = (what, parent) => {
|
|
3446
3534
|
const Config = () => {
|
|
3447
3535
|
throw new Error(`[pire] ${what} must be a child of ${parent}.`);
|
|
@@ -3455,7 +3543,7 @@ var RibbonGroup = outside("Ribbon.Group", "Ribbon.Tab");
|
|
|
3455
3543
|
var RibbonCommand = outside("Ribbon.Command", "Ribbon.Group");
|
|
3456
3544
|
var CONFIG_ELEMENTS = /* @__PURE__ */ new Set([RibbonTab, RibbonGroup, RibbonCommand]);
|
|
3457
3545
|
function describe(child) {
|
|
3458
|
-
if (!
|
|
3546
|
+
if (!React25.isValidElement(child)) return JSON.stringify(child);
|
|
3459
3547
|
if (typeof child.type === "string") return `<${child.type}>`;
|
|
3460
3548
|
const type = child.type;
|
|
3461
3549
|
return type?.displayName || type?.name || "a component";
|
|
@@ -3463,13 +3551,13 @@ function describe(child) {
|
|
|
3463
3551
|
function childrenOfType(children, type, what, parent) {
|
|
3464
3552
|
const out = [];
|
|
3465
3553
|
const walk = (nodes, path) => {
|
|
3466
|
-
|
|
3554
|
+
React25.Children.forEach(nodes, (child, i) => {
|
|
3467
3555
|
if (child == null || typeof child === "boolean") return;
|
|
3468
|
-
if (
|
|
3556
|
+
if (React25.isValidElement(child) && child.type === React25.Fragment) {
|
|
3469
3557
|
return walk(child.props.children, `${path}${i}.`);
|
|
3470
3558
|
}
|
|
3471
|
-
if (!
|
|
3472
|
-
const isWrapper =
|
|
3559
|
+
if (!React25.isValidElement(child) || child.type !== type) {
|
|
3560
|
+
const isWrapper = React25.isValidElement(child) && typeof child.type !== "string" && !CONFIG_ELEMENTS.has(child.type);
|
|
3473
3561
|
throw new Error(
|
|
3474
3562
|
`[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.` : "")
|
|
3475
3563
|
);
|
|
@@ -3503,7 +3591,7 @@ function Command({
|
|
|
3503
3591
|
}) {
|
|
3504
3592
|
const size = inBar ? "sm" : command.size ?? "sm";
|
|
3505
3593
|
const isDisabled = command.isDisabled || command.requiresSelection === true && selectionCount === 0;
|
|
3506
|
-
return /* @__PURE__ */
|
|
3594
|
+
return /* @__PURE__ */ jsxs37(
|
|
3507
3595
|
Button3,
|
|
3508
3596
|
{
|
|
3509
3597
|
className: "pire-ribbon-command",
|
|
@@ -3511,8 +3599,8 @@ function Command({
|
|
|
3511
3599
|
isDisabled,
|
|
3512
3600
|
onPress: command.onPress,
|
|
3513
3601
|
children: [
|
|
3514
|
-
command.icon ? /* @__PURE__ */
|
|
3515
|
-
/* @__PURE__ */
|
|
3602
|
+
command.icon ? /* @__PURE__ */ jsx47(Icon, { name: command.icon, size: size === "lg" ? 20 : 16 }) : null,
|
|
3603
|
+
/* @__PURE__ */ jsx47("span", { className: "pire-ribbon-command-label", children: command.label })
|
|
3516
3604
|
]
|
|
3517
3605
|
}
|
|
3518
3606
|
);
|
|
@@ -3520,18 +3608,18 @@ function Command({
|
|
|
3520
3608
|
function Group8({ group, selectionCount }) {
|
|
3521
3609
|
const large = group.commands.filter((c) => (c.size ?? "sm") === "lg");
|
|
3522
3610
|
const small = group.commands.filter((c) => (c.size ?? "sm") !== "lg");
|
|
3523
|
-
return /* @__PURE__ */
|
|
3524
|
-
/* @__PURE__ */
|
|
3525
|
-
large.map((c) => /* @__PURE__ */
|
|
3526
|
-
small.length ? /* @__PURE__ */
|
|
3611
|
+
return /* @__PURE__ */ jsxs37("div", { className: "pire-ribbon-group", role: "group", "aria-label": group.caption, children: [
|
|
3612
|
+
/* @__PURE__ */ jsxs37("div", { className: "pire-ribbon-group-body", children: [
|
|
3613
|
+
large.map((c) => /* @__PURE__ */ jsx47(Command, { command: c, selectionCount }, c.key)),
|
|
3614
|
+
small.length ? /* @__PURE__ */ jsx47("div", { className: "pire-ribbon-stack", children: small.map((c) => /* @__PURE__ */ jsx47(Command, { command: c, selectionCount }, c.key)) }) : null
|
|
3527
3615
|
] }),
|
|
3528
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx47("div", { className: "pire-ribbon-caption", "aria-hidden": "true", children: group.caption })
|
|
3529
3617
|
] });
|
|
3530
3618
|
}
|
|
3531
3619
|
function useTrailingOverflow() {
|
|
3532
|
-
const ref =
|
|
3533
|
-
const [overflow, setOverflow] =
|
|
3534
|
-
|
|
3620
|
+
const ref = React25.useRef(null);
|
|
3621
|
+
const [overflow, setOverflow] = React25.useState(false);
|
|
3622
|
+
React25.useEffect(() => {
|
|
3535
3623
|
const node = ref.current;
|
|
3536
3624
|
if (!node) return;
|
|
3537
3625
|
const measure = () => setOverflow(node.scrollLeft + node.clientWidth < node.scrollWidth - 1);
|
|
@@ -3556,9 +3644,9 @@ function Surface({
|
|
|
3556
3644
|
}) {
|
|
3557
3645
|
const [scrollRef, overflow] = useTrailingOverflow();
|
|
3558
3646
|
const domId = id ? { id } : {};
|
|
3559
|
-
return /* @__PURE__ */
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
/* @__PURE__ */
|
|
3647
|
+
return /* @__PURE__ */ jsxs37(Toolbar, { ...domId, className, "aria-label": label, children: [
|
|
3648
|
+
/* @__PURE__ */ jsx47("div", { className: "pire-ribbon-scroll", ref: scrollRef, children }),
|
|
3649
|
+
/* @__PURE__ */ jsx47("div", { className: "pire-ribbon-trail", "data-overflow": overflow ? "true" : void 0, children: trailing })
|
|
3562
3650
|
] });
|
|
3563
3651
|
}
|
|
3564
3652
|
function barBlocks(tabs) {
|
|
@@ -3591,18 +3679,18 @@ function Ribbon({
|
|
|
3591
3679
|
const count = selectionCount ?? 0;
|
|
3592
3680
|
const visible = tabs.filter((tab) => !tab.isContextual || count > 0);
|
|
3593
3681
|
const fallback = visible[0]?.id;
|
|
3594
|
-
const [ownTab, setOwnTab] =
|
|
3682
|
+
const [ownTab, setOwnTab] = React25.useState(defaultValue);
|
|
3595
3683
|
const requested = value ?? ownTab;
|
|
3596
3684
|
const selected = visible.some((tab) => tab.id === requested) ? requested : fallback;
|
|
3597
|
-
const select =
|
|
3685
|
+
const select = React25.useCallback(
|
|
3598
3686
|
(id) => {
|
|
3599
3687
|
setOwnTab(id);
|
|
3600
3688
|
onChange?.(id);
|
|
3601
3689
|
},
|
|
3602
3690
|
[onChange]
|
|
3603
3691
|
);
|
|
3604
|
-
const hadSelection =
|
|
3605
|
-
|
|
3692
|
+
const hadSelection = React25.useRef(false);
|
|
3693
|
+
React25.useEffect(() => {
|
|
3606
3694
|
const has = count > 0;
|
|
3607
3695
|
if (has === hadSelection.current) return;
|
|
3608
3696
|
hadSelection.current = has;
|
|
@@ -3611,17 +3699,17 @@ function Ribbon({
|
|
|
3611
3699
|
if (has) select(contextual.id);
|
|
3612
3700
|
else if (requested === contextual.id) select(tabs.find((tab) => !tab.isContextual)?.id ?? "");
|
|
3613
3701
|
}, [count, tabs, requested, select]);
|
|
3614
|
-
const [ownCollapsed, setOwnCollapsed] =
|
|
3702
|
+
const [ownCollapsed, setOwnCollapsed] = React25.useState(false);
|
|
3615
3703
|
const collapsed = isCollapsed ?? ownCollapsed;
|
|
3616
|
-
const toggleRef =
|
|
3617
|
-
const restoreFocus =
|
|
3618
|
-
|
|
3704
|
+
const toggleRef = React25.useRef(null);
|
|
3705
|
+
const restoreFocus = React25.useRef(false);
|
|
3706
|
+
React25.useLayoutEffect(() => {
|
|
3619
3707
|
if (!restoreFocus.current) return;
|
|
3620
3708
|
restoreFocus.current = false;
|
|
3621
3709
|
toggleRef.current?.focus();
|
|
3622
3710
|
});
|
|
3623
|
-
const bandId =
|
|
3624
|
-
const toggle = /* @__PURE__ */
|
|
3711
|
+
const bandId = React25.useId();
|
|
3712
|
+
const toggle = /* @__PURE__ */ jsx47(
|
|
3625
3713
|
Button3,
|
|
3626
3714
|
{
|
|
3627
3715
|
ref: toggleRef,
|
|
@@ -3634,32 +3722,32 @@ function Ribbon({
|
|
|
3634
3722
|
setOwnCollapsed(!collapsed);
|
|
3635
3723
|
onCollapsedChange?.(!collapsed);
|
|
3636
3724
|
},
|
|
3637
|
-
children: /* @__PURE__ */
|
|
3725
|
+
children: /* @__PURE__ */ jsx47(Icon, { name: collapsed ? "chevron-down" : "chevron-up", size: 16 })
|
|
3638
3726
|
}
|
|
3639
3727
|
);
|
|
3640
3728
|
if (collapsed) {
|
|
3641
3729
|
const blocks = barBlocks(tabs);
|
|
3642
|
-
return /* @__PURE__ */
|
|
3730
|
+
return /* @__PURE__ */ jsx47("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs37(
|
|
3643
3731
|
Surface,
|
|
3644
3732
|
{
|
|
3645
3733
|
className: "pire-ribbon-bar",
|
|
3646
3734
|
label: rest["aria-label"],
|
|
3647
|
-
trailing: /* @__PURE__ */
|
|
3735
|
+
trailing: /* @__PURE__ */ jsxs37(Fragment6, { children: [
|
|
3648
3736
|
actions,
|
|
3649
3737
|
toggle
|
|
3650
3738
|
] }),
|
|
3651
3739
|
children: [
|
|
3652
|
-
leading ? /* @__PURE__ */
|
|
3653
|
-
blocks.map((block, i) => /* @__PURE__ */
|
|
3654
|
-
i > 0 || leading ? /* @__PURE__ */
|
|
3655
|
-
block.commands.map((c) => /* @__PURE__ */
|
|
3740
|
+
leading ? /* @__PURE__ */ jsx47("div", { className: "pire-ribbon-leading", children: leading }) : null,
|
|
3741
|
+
blocks.map((block, i) => /* @__PURE__ */ jsxs37(React25.Fragment, { children: [
|
|
3742
|
+
i > 0 || leading ? /* @__PURE__ */ jsx47("span", { className: "pire-ribbon-bar-sep" }) : null,
|
|
3743
|
+
block.commands.map((c) => /* @__PURE__ */ jsx47(Command, { command: c, selectionCount: count, inBar: true }, c.key))
|
|
3656
3744
|
] }, block.key))
|
|
3657
3745
|
]
|
|
3658
3746
|
}
|
|
3659
3747
|
) });
|
|
3660
3748
|
}
|
|
3661
|
-
return /* @__PURE__ */
|
|
3662
|
-
/* @__PURE__ */
|
|
3749
|
+
return /* @__PURE__ */ jsx47("div", { className: cx("pire-ribbon", className), style, children: /* @__PURE__ */ jsxs37(AriaTabs2, { selectedKey: selected, onSelectionChange: (k) => select(String(k)), children: [
|
|
3750
|
+
/* @__PURE__ */ jsx47(TabList2, { className: "pire-ribbon-tablist", "aria-label": rest["aria-label"], children: visible.map((tab) => /* @__PURE__ */ jsx47(
|
|
3663
3751
|
AriaTab2,
|
|
3664
3752
|
{
|
|
3665
3753
|
id: tab.id,
|
|
@@ -3669,17 +3757,17 @@ function Ribbon({
|
|
|
3669
3757
|
},
|
|
3670
3758
|
tab.key
|
|
3671
3759
|
)) }),
|
|
3672
|
-
visible.map((tab) => /* @__PURE__ */
|
|
3760
|
+
visible.map((tab) => /* @__PURE__ */ jsx47(TabPanel2, { id: tab.id, className: "pire-ribbon-panel", children: /* @__PURE__ */ jsx47(
|
|
3673
3761
|
Surface,
|
|
3674
3762
|
{
|
|
3675
3763
|
id: bandId,
|
|
3676
3764
|
className: "pire-ribbon-band",
|
|
3677
3765
|
label: msg.ribbonLabel,
|
|
3678
|
-
trailing: /* @__PURE__ */
|
|
3766
|
+
trailing: /* @__PURE__ */ jsxs37(Fragment6, { children: [
|
|
3679
3767
|
actions,
|
|
3680
3768
|
toggle
|
|
3681
3769
|
] }),
|
|
3682
|
-
children: tab.groups.map((group) => /* @__PURE__ */
|
|
3770
|
+
children: tab.groups.map((group) => /* @__PURE__ */ jsx47(Group8, { group, selectionCount: count }, group.key))
|
|
3683
3771
|
}
|
|
3684
3772
|
) }, tab.key))
|
|
3685
3773
|
] }) });
|
|
@@ -3689,7 +3777,7 @@ Ribbon.Group = RibbonGroup;
|
|
|
3689
3777
|
Ribbon.Command = RibbonCommand;
|
|
3690
3778
|
|
|
3691
3779
|
// src/components/feedback/InlineMessage.tsx
|
|
3692
|
-
import { jsx as
|
|
3780
|
+
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3693
3781
|
var KIND_ICON = {
|
|
3694
3782
|
info: "info",
|
|
3695
3783
|
success: "check-circle-2",
|
|
@@ -3707,7 +3795,7 @@ function InlineMessage({
|
|
|
3707
3795
|
}) {
|
|
3708
3796
|
const msg = usePireMessages();
|
|
3709
3797
|
const assertive = kind === "error" || kind === "warning";
|
|
3710
|
-
return /* @__PURE__ */
|
|
3798
|
+
return /* @__PURE__ */ jsxs38(
|
|
3711
3799
|
"div",
|
|
3712
3800
|
{
|
|
3713
3801
|
className: cx("pire-msg", className),
|
|
@@ -3716,21 +3804,21 @@ function InlineMessage({
|
|
|
3716
3804
|
"aria-live": assertive ? "assertive" : "polite",
|
|
3717
3805
|
...rest,
|
|
3718
3806
|
children: [
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
/* @__PURE__ */
|
|
3721
|
-
title ? /* @__PURE__ */
|
|
3722
|
-
children ? /* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsx48(Icon, { name: KIND_ICON[kind], size: 16, style: { marginTop: 2 } }),
|
|
3808
|
+
/* @__PURE__ */ jsxs38("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: "var(--sp-1)" }, children: [
|
|
3809
|
+
title ? /* @__PURE__ */ jsx48("span", { className: "pire-msg-title", children: title }) : null,
|
|
3810
|
+
children ? /* @__PURE__ */ jsx48("span", { className: "pire-msg-body", children }) : null,
|
|
3723
3811
|
action
|
|
3724
3812
|
] }),
|
|
3725
|
-
onClose ? /* @__PURE__ */
|
|
3813
|
+
onClose ? /* @__PURE__ */ jsx48(IconButton, { icon: "x", label: msg.inlineMessageDismiss, size: "sm", onPress: onClose }) : null
|
|
3726
3814
|
]
|
|
3727
3815
|
}
|
|
3728
3816
|
);
|
|
3729
3817
|
}
|
|
3730
3818
|
|
|
3731
3819
|
// src/components/feedback/Toast.tsx
|
|
3732
|
-
import * as
|
|
3733
|
-
import { jsx as
|
|
3820
|
+
import * as React26 from "react";
|
|
3821
|
+
import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3734
3822
|
var KIND_ICON2 = {
|
|
3735
3823
|
info: "info",
|
|
3736
3824
|
success: "check-circle-2",
|
|
@@ -3746,7 +3834,7 @@ function Toast({
|
|
|
3746
3834
|
...rest
|
|
3747
3835
|
}) {
|
|
3748
3836
|
const msg = usePireMessages();
|
|
3749
|
-
return /* @__PURE__ */
|
|
3837
|
+
return /* @__PURE__ */ jsxs39(
|
|
3750
3838
|
"div",
|
|
3751
3839
|
{
|
|
3752
3840
|
className: cx("pire-toast", className),
|
|
@@ -3755,22 +3843,22 @@ function Toast({
|
|
|
3755
3843
|
"aria-live": kind === "error" ? "assertive" : "polite",
|
|
3756
3844
|
...rest,
|
|
3757
3845
|
children: [
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3760
|
-
onClose ? /* @__PURE__ */
|
|
3846
|
+
/* @__PURE__ */ jsx49(Icon, { name: KIND_ICON2[kind], size: 16 }),
|
|
3847
|
+
/* @__PURE__ */ jsx49("span", { style: { flex: 1 }, children }),
|
|
3848
|
+
onClose ? /* @__PURE__ */ jsx49(IconButton, { icon: "x", label: msg.toastDismiss, size: "sm", variant: "inverse", onPress: onClose }) : null
|
|
3761
3849
|
]
|
|
3762
3850
|
}
|
|
3763
3851
|
);
|
|
3764
3852
|
}
|
|
3765
|
-
var ToastContext =
|
|
3853
|
+
var ToastContext = React26.createContext(null);
|
|
3766
3854
|
function ToastProvider({
|
|
3767
3855
|
children,
|
|
3768
3856
|
timeout = 6e3
|
|
3769
3857
|
}) {
|
|
3770
3858
|
const msg = usePireMessages();
|
|
3771
|
-
const [toasts, setToasts] =
|
|
3772
|
-
const close =
|
|
3773
|
-
const add =
|
|
3859
|
+
const [toasts, setToasts] = React26.useState([]);
|
|
3860
|
+
const close = React26.useCallback((id) => setToasts((t) => t.filter((x) => x.id !== id)), []);
|
|
3861
|
+
const add = React26.useCallback(
|
|
3774
3862
|
(toast) => {
|
|
3775
3863
|
const id = Math.random().toString(36).slice(2);
|
|
3776
3864
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
@@ -3780,10 +3868,10 @@ function ToastProvider({
|
|
|
3780
3868
|
},
|
|
3781
3869
|
[close, timeout]
|
|
3782
3870
|
);
|
|
3783
|
-
const value =
|
|
3784
|
-
return /* @__PURE__ */
|
|
3871
|
+
const value = React26.useMemo(() => ({ add, close }), [add, close]);
|
|
3872
|
+
return /* @__PURE__ */ jsxs39(ToastContext.Provider, { value, children: [
|
|
3785
3873
|
children,
|
|
3786
|
-
/* @__PURE__ */
|
|
3874
|
+
/* @__PURE__ */ jsx49("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ jsx49(
|
|
3787
3875
|
Toast,
|
|
3788
3876
|
{
|
|
3789
3877
|
kind: t.kind,
|
|
@@ -3796,14 +3884,14 @@ function ToastProvider({
|
|
|
3796
3884
|
] });
|
|
3797
3885
|
}
|
|
3798
3886
|
function useToast() {
|
|
3799
|
-
const ctx =
|
|
3887
|
+
const ctx = React26.useContext(ToastContext);
|
|
3800
3888
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
3801
3889
|
return ctx;
|
|
3802
3890
|
}
|
|
3803
3891
|
|
|
3804
3892
|
// src/components/data/KpiTile.tsx
|
|
3805
3893
|
import { Button as AriaButton14 } from "react-aria-components";
|
|
3806
|
-
import { Fragment as Fragment7, jsx as
|
|
3894
|
+
import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3807
3895
|
function KpiTile({
|
|
3808
3896
|
label,
|
|
3809
3897
|
value,
|
|
@@ -3819,27 +3907,27 @@ function KpiTile({
|
|
|
3819
3907
|
style
|
|
3820
3908
|
}) {
|
|
3821
3909
|
const tone = deltaTone ?? (deltaDirection === "down" ? "negative" : "positive");
|
|
3822
|
-
const body = /* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
icon ? /* @__PURE__ */
|
|
3910
|
+
const body = /* @__PURE__ */ jsxs40(Fragment7, { children: [
|
|
3911
|
+
/* @__PURE__ */ jsxs40("span", { className: "pire-kpi-label", children: [
|
|
3912
|
+
icon ? /* @__PURE__ */ jsx50(Icon, { name: icon, size: 16 }) : null,
|
|
3825
3913
|
label
|
|
3826
3914
|
] }),
|
|
3827
|
-
/* @__PURE__ */
|
|
3915
|
+
/* @__PURE__ */ jsxs40("span", { className: "pire-kpi-value", children: [
|
|
3828
3916
|
value,
|
|
3829
|
-
unit ? /* @__PURE__ */
|
|
3917
|
+
unit ? /* @__PURE__ */ jsx50("span", { className: "pire-kpi-unit", children: unit }) : null
|
|
3830
3918
|
] }),
|
|
3831
|
-
delta ? /* @__PURE__ */
|
|
3832
|
-
deltaDirection ? /* @__PURE__ */
|
|
3919
|
+
delta ? /* @__PURE__ */ jsxs40("span", { className: "pire-kpi-delta", "data-tone": tone, children: [
|
|
3920
|
+
deltaDirection ? /* @__PURE__ */ jsx50(Icon, { name: deltaDirection === "up" ? "trending-up" : "trending-down", size: 12 }) : null,
|
|
3833
3921
|
delta
|
|
3834
3922
|
] }) : null,
|
|
3835
|
-
footnote ? /* @__PURE__ */
|
|
3923
|
+
footnote ? /* @__PURE__ */ jsx50("span", { className: "pire-kpi-foot", children: footnote }) : null
|
|
3836
3924
|
] });
|
|
3837
3925
|
const props = { className: cx("pire-kpi", className), "data-status": status, style };
|
|
3838
|
-
return onPress ? /* @__PURE__ */
|
|
3926
|
+
return onPress ? /* @__PURE__ */ jsx50(AriaButton14, { ...props, "data-pressable": "true", onPress, children: body }) : /* @__PURE__ */ jsx50("div", { ...props, children: body });
|
|
3839
3927
|
}
|
|
3840
3928
|
|
|
3841
3929
|
// src/components/data/ObjectHeader.tsx
|
|
3842
|
-
import { jsx as
|
|
3930
|
+
import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3843
3931
|
function ObjectHeader({
|
|
3844
3932
|
title,
|
|
3845
3933
|
subtitle,
|
|
@@ -3851,22 +3939,22 @@ function ObjectHeader({
|
|
|
3851
3939
|
className,
|
|
3852
3940
|
...rest
|
|
3853
3941
|
}) {
|
|
3854
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ jsxs41("header", { className: cx("pire-objheader", className), ...rest, children: [
|
|
3855
3943
|
breadcrumb,
|
|
3856
|
-
/* @__PURE__ */
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3859
|
-
subtitle || id ? /* @__PURE__ */
|
|
3944
|
+
/* @__PURE__ */ jsxs41("div", { className: "pire-objheader-row", children: [
|
|
3945
|
+
/* @__PURE__ */ jsxs41("div", { style: { minWidth: 0 }, children: [
|
|
3946
|
+
/* @__PURE__ */ jsx51("h1", { className: "pire-objheader-title", children: title }),
|
|
3947
|
+
subtitle || id ? /* @__PURE__ */ jsxs41("div", { className: "pire-objheader-sub", children: [
|
|
3860
3948
|
subtitle,
|
|
3861
|
-
id ? /* @__PURE__ */
|
|
3949
|
+
id ? /* @__PURE__ */ jsx51("span", { className: "pire-objheader-id", children: id }) : null
|
|
3862
3950
|
] }) : null
|
|
3863
3951
|
] }),
|
|
3864
3952
|
badge,
|
|
3865
|
-
actions ? /* @__PURE__ */
|
|
3953
|
+
actions ? /* @__PURE__ */ jsx51("div", { className: "pire-objheader-actions", children: actions }) : null
|
|
3866
3954
|
] }),
|
|
3867
|
-
facts?.length ? /* @__PURE__ */
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3955
|
+
facts?.length ? /* @__PURE__ */ jsx51("dl", { className: "pire-facts", style: { margin: 0 }, children: facts.map((fact) => /* @__PURE__ */ jsxs41("div", { children: [
|
|
3956
|
+
/* @__PURE__ */ jsx51("dt", { className: "pire-fact-label", children: fact.label }),
|
|
3957
|
+
/* @__PURE__ */ jsx51(
|
|
3870
3958
|
"dd",
|
|
3871
3959
|
{
|
|
3872
3960
|
className: "pire-fact-value",
|
|
@@ -3880,7 +3968,7 @@ function ObjectHeader({
|
|
|
3880
3968
|
}
|
|
3881
3969
|
|
|
3882
3970
|
// src/components/data/FilterBar.tsx
|
|
3883
|
-
import { jsx as
|
|
3971
|
+
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3884
3972
|
function FilterBar({
|
|
3885
3973
|
children,
|
|
3886
3974
|
activeFilters = [],
|
|
@@ -3897,22 +3985,22 @@ function FilterBar({
|
|
|
3897
3985
|
const label = useMessage("filterBarLabel", rest["aria-label"]);
|
|
3898
3986
|
const go = useMessage("filterBarGo", goLabel);
|
|
3899
3987
|
const clearAll = useMessage("filterBarClearAll", clearAllLabel);
|
|
3900
|
-
return /* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsxs42("section", { className: cx("pire-filterbar", className), ...rest, "aria-label": label, children: [
|
|
3989
|
+
/* @__PURE__ */ jsxs42("div", { className: "pire-filterbar-controls", children: [
|
|
3902
3990
|
children,
|
|
3903
|
-
onGo ? /* @__PURE__ */
|
|
3991
|
+
onGo ? /* @__PURE__ */ jsx52(Button, { variant: "primary", onPress: onGo, children: go }) : null
|
|
3904
3992
|
] }),
|
|
3905
|
-
activeFilters.length || resultLabel || actions ? /* @__PURE__ */
|
|
3906
|
-
activeFilters.map((filter) => /* @__PURE__ */
|
|
3907
|
-
activeFilters.length && onClear ? /* @__PURE__ */
|
|
3908
|
-
resultLabel ? /* @__PURE__ */
|
|
3909
|
-
actions ? /* @__PURE__ */
|
|
3993
|
+
activeFilters.length || resultLabel || actions ? /* @__PURE__ */ jsxs42("div", { className: "pire-filterbar-foot", children: [
|
|
3994
|
+
activeFilters.map((filter) => /* @__PURE__ */ jsx52(Tag, { onRemove: onRemoveFilter ? () => onRemoveFilter(filter.id) : void 0, children: filter.label }, filter.id)),
|
|
3995
|
+
activeFilters.length && onClear ? /* @__PURE__ */ jsx52(Button, { variant: "tertiary", size: "sm", onPress: onClear, children: clearAll }) : null,
|
|
3996
|
+
resultLabel ? /* @__PURE__ */ jsx52("span", { className: "pire-filterbar-result", "aria-live": "polite", children: resultLabel }) : null,
|
|
3997
|
+
actions ? /* @__PURE__ */ jsx52("div", { className: "pire-filterbar-actions", children: actions }) : null
|
|
3910
3998
|
] }) : null
|
|
3911
3999
|
] });
|
|
3912
4000
|
}
|
|
3913
4001
|
|
|
3914
4002
|
// src/components/data/DescriptionList.tsx
|
|
3915
|
-
import { jsx as
|
|
4003
|
+
import { jsx as jsx53, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3916
4004
|
function DescriptionList({
|
|
3917
4005
|
items,
|
|
3918
4006
|
layout = "rows",
|
|
@@ -3921,32 +4009,32 @@ function DescriptionList({
|
|
|
3921
4009
|
style,
|
|
3922
4010
|
...rest
|
|
3923
4011
|
}) {
|
|
3924
|
-
return /* @__PURE__ */
|
|
4012
|
+
return /* @__PURE__ */ jsx53(
|
|
3925
4013
|
"dl",
|
|
3926
4014
|
{
|
|
3927
4015
|
className: cx("pire-dl", className),
|
|
3928
4016
|
"data-layout": layout,
|
|
3929
4017
|
style: { ...layout === "grid" ? { "--pire-dl-cols": columns } : null, ...style },
|
|
3930
4018
|
...rest,
|
|
3931
|
-
children: items.map((item, i) => /* @__PURE__ */
|
|
3932
|
-
/* @__PURE__ */
|
|
4019
|
+
children: items.map((item, i) => /* @__PURE__ */ jsxs43("div", { className: "pire-dl-row", "data-emphasis": item.emphasis ? "true" : void 0, children: [
|
|
4020
|
+
/* @__PURE__ */ jsxs43("dt", { className: "pire-dl-term", children: [
|
|
3933
4021
|
item.label,
|
|
3934
4022
|
item.hint
|
|
3935
4023
|
] }),
|
|
3936
|
-
/* @__PURE__ */
|
|
4024
|
+
/* @__PURE__ */ jsx53("dd", { className: "pire-dl-value", "data-numeric": item.numeric ? "true" : void 0, children: item.value })
|
|
3937
4025
|
] }, i))
|
|
3938
4026
|
}
|
|
3939
4027
|
);
|
|
3940
4028
|
}
|
|
3941
4029
|
|
|
3942
4030
|
// src/components/data/Timeline.tsx
|
|
3943
|
-
import { jsx as
|
|
4031
|
+
import { jsx as jsx54, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
3944
4032
|
function Timeline({ entries, reverse = false, className, ...rest }) {
|
|
3945
4033
|
const list = reverse ? [...entries].reverse() : entries;
|
|
3946
|
-
return /* @__PURE__ */
|
|
3947
|
-
/* @__PURE__ */
|
|
3948
|
-
/* @__PURE__ */
|
|
3949
|
-
entry.actor ? /* @__PURE__ */
|
|
4034
|
+
return /* @__PURE__ */ jsx54("ol", { className: cx("pire-timeline", className), ...rest, children: list.map((entry, i) => /* @__PURE__ */ jsxs44("li", { className: "pire-timeline-item", children: [
|
|
4035
|
+
/* @__PURE__ */ jsx54("span", { className: "pire-timeline-time", children: entry.time }),
|
|
4036
|
+
/* @__PURE__ */ jsx54("span", { className: "pire-timeline-text", children: entry.event }),
|
|
4037
|
+
entry.actor ? /* @__PURE__ */ jsx54("span", { className: "pire-timeline-actor", children: entry.actor }) : null
|
|
3950
4038
|
] }, entry.id ?? i)) });
|
|
3951
4039
|
}
|
|
3952
4040
|
|
|
@@ -3989,10 +4077,10 @@ function seriesColor(series, index) {
|
|
|
3989
4077
|
const slot = series.colorIndex ?? index + 1;
|
|
3990
4078
|
return slot >= 1 && slot <= VIZ_SLOT_COUNT ? `var(--viz-${slot})` : "var(--viz-other)";
|
|
3991
4079
|
}
|
|
3992
|
-
var
|
|
4080
|
+
var IS_DEV4 = process.env.NODE_ENV !== "production";
|
|
3993
4081
|
var warnedCharts = /* @__PURE__ */ new Set();
|
|
3994
4082
|
function warnOnSlotOverflow(series, chartLabel) {
|
|
3995
|
-
if (!
|
|
4083
|
+
if (!IS_DEV4 || warnedCharts.has(chartLabel)) return;
|
|
3996
4084
|
if (series.length <= VIZ_SLOT_COUNT) return;
|
|
3997
4085
|
warnedCharts.add(chartLabel);
|
|
3998
4086
|
console.warn(
|
|
@@ -4000,7 +4088,7 @@ function warnOnSlotOverflow(series, chartLabel) {
|
|
|
4000
4088
|
);
|
|
4001
4089
|
}
|
|
4002
4090
|
function warnOnDonutShape(series, categoryCount, chartLabel) {
|
|
4003
|
-
if (!
|
|
4091
|
+
if (!IS_DEV4 || warnedCharts.has(`donut:${chartLabel}`)) return;
|
|
4004
4092
|
const complaints = [];
|
|
4005
4093
|
if (series.length > 1) {
|
|
4006
4094
|
complaints.push(`it has ${series.length} series but a donut draws one \u2014 the rest are ignored`);
|
|
@@ -4032,7 +4120,7 @@ function alignToCategories(series, categoryCount) {
|
|
|
4032
4120
|
}
|
|
4033
4121
|
|
|
4034
4122
|
// src/components/data/ChartFrame.tsx
|
|
4035
|
-
import { jsx as
|
|
4123
|
+
import { jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4036
4124
|
function seriesLegend(series) {
|
|
4037
4125
|
return series.map((one, index) => ({
|
|
4038
4126
|
key: one.id,
|
|
@@ -4055,29 +4143,29 @@ function ChartFrame({
|
|
|
4055
4143
|
children
|
|
4056
4144
|
}) {
|
|
4057
4145
|
const msg = usePireMessages();
|
|
4058
|
-
return /* @__PURE__ */
|
|
4059
|
-
title || description ? /* @__PURE__ */
|
|
4060
|
-
title ? /* @__PURE__ */
|
|
4061
|
-
description ? /* @__PURE__ */
|
|
4146
|
+
return /* @__PURE__ */ jsxs45("figure", { className: cx("pire-chart", className), style, children: [
|
|
4147
|
+
title || description ? /* @__PURE__ */ jsxs45("figcaption", { className: "pire-chart-head", children: [
|
|
4148
|
+
title ? /* @__PURE__ */ jsx55("span", { className: "pire-chart-title", children: title }) : null,
|
|
4149
|
+
description ? /* @__PURE__ */ jsx55("span", { className: "pire-chart-desc", children: description }) : null
|
|
4062
4150
|
] }) : null,
|
|
4063
|
-
legend && legend.length > 1 ? /* @__PURE__ */
|
|
4064
|
-
/* @__PURE__ */
|
|
4151
|
+
legend && legend.length > 1 ? /* @__PURE__ */ jsx55("ul", { className: "pire-chart-legend", children: legend.map((item) => /* @__PURE__ */ jsxs45("li", { className: "pire-chart-legend-item", children: [
|
|
4152
|
+
/* @__PURE__ */ jsx55("span", { className: "pire-chart-swatch", style: { background: item.color } }),
|
|
4065
4153
|
item.label
|
|
4066
4154
|
] }, item.key)) }) : null,
|
|
4067
|
-
/* @__PURE__ */
|
|
4068
|
-
/* @__PURE__ */
|
|
4069
|
-
/* @__PURE__ */
|
|
4070
|
-
/* @__PURE__ */
|
|
4071
|
-
/* @__PURE__ */
|
|
4072
|
-
series.map((one) => /* @__PURE__ */
|
|
4155
|
+
/* @__PURE__ */ jsx55("div", { className: "pire-chart-plot", "aria-hidden": "true", children }),
|
|
4156
|
+
/* @__PURE__ */ jsx55("div", { className: showDataTable ? "pire-chart-table" : "pire-sr-only", children: /* @__PURE__ */ jsxs45("table", { children: [
|
|
4157
|
+
/* @__PURE__ */ jsx55("caption", { children: label }),
|
|
4158
|
+
/* @__PURE__ */ jsx55("thead", { children: /* @__PURE__ */ jsxs45("tr", { children: [
|
|
4159
|
+
/* @__PURE__ */ jsx55("th", { scope: "col", children: msg.chartCategoryHeader }),
|
|
4160
|
+
series.map((one) => /* @__PURE__ */ jsx55("th", { scope: "col", children: one.label }, one.id))
|
|
4073
4161
|
] }) }),
|
|
4074
|
-
/* @__PURE__ */
|
|
4162
|
+
/* @__PURE__ */ jsx55("tbody", { children: categories.map((category, categoryIndex) => (
|
|
4075
4163
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4076
|
-
/* @__PURE__ */
|
|
4077
|
-
/* @__PURE__ */
|
|
4164
|
+
/* @__PURE__ */ jsxs45("tr", { children: [
|
|
4165
|
+
/* @__PURE__ */ jsx55("th", { scope: "row", children: category }),
|
|
4078
4166
|
series.map((one) => {
|
|
4079
4167
|
const value = one.values[categoryIndex];
|
|
4080
|
-
return /* @__PURE__ */
|
|
4168
|
+
return /* @__PURE__ */ jsx55("td", { children: value == null ? msg.chartNoValue : formatValue(value) }, one.id);
|
|
4081
4169
|
})
|
|
4082
4170
|
] }, categoryIndex)
|
|
4083
4171
|
)) })
|
|
@@ -4086,7 +4174,7 @@ function ChartFrame({
|
|
|
4086
4174
|
}
|
|
4087
4175
|
|
|
4088
4176
|
// src/components/data/BarChart.tsx
|
|
4089
|
-
import { jsx as
|
|
4177
|
+
import { jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4090
4178
|
function BarChart({
|
|
4091
4179
|
categories,
|
|
4092
4180
|
series: rawSeries,
|
|
@@ -4118,7 +4206,7 @@ function BarChart({
|
|
|
4118
4206
|
const value = series[0].values[categoryIndex];
|
|
4119
4207
|
return value == null ? msg.chartNoValue : formatValue(value);
|
|
4120
4208
|
};
|
|
4121
|
-
return /* @__PURE__ */
|
|
4209
|
+
return /* @__PURE__ */ jsx56(
|
|
4122
4210
|
ChartFrame,
|
|
4123
4211
|
{
|
|
4124
4212
|
label,
|
|
@@ -4131,7 +4219,7 @@ function BarChart({
|
|
|
4131
4219
|
showDataTable,
|
|
4132
4220
|
className,
|
|
4133
4221
|
style,
|
|
4134
|
-
children: !hasData ? /* @__PURE__ */
|
|
4222
|
+
children: !hasData ? /* @__PURE__ */ jsx56("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ jsx56(
|
|
4135
4223
|
"div",
|
|
4136
4224
|
{
|
|
4137
4225
|
className: "pire-chart-bars",
|
|
@@ -4140,12 +4228,12 @@ function BarChart({
|
|
|
4140
4228
|
style: { "--pire-chart-height": `${height}px` },
|
|
4141
4229
|
children: categories.map((category, categoryIndex) => (
|
|
4142
4230
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4143
|
-
/* @__PURE__ */
|
|
4144
|
-
/* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsxs46("div", { className: "pire-chart-group", children: [
|
|
4232
|
+
/* @__PURE__ */ jsx56("span", { className: "pire-chart-cat", children: category }),
|
|
4233
|
+
/* @__PURE__ */ jsx56("div", { className: "pire-chart-track", children: series.map((one, seriesIndex) => {
|
|
4146
4234
|
const value = one.values[categoryIndex];
|
|
4147
4235
|
if (value == null) return null;
|
|
4148
|
-
return /* @__PURE__ */
|
|
4236
|
+
return /* @__PURE__ */ jsxs46(
|
|
4149
4237
|
"div",
|
|
4150
4238
|
{
|
|
4151
4239
|
className: "pire-chart-bar",
|
|
@@ -4154,8 +4242,8 @@ function BarChart({
|
|
|
4154
4242
|
"--pire-bar-color": seriesColor(one, seriesIndex)
|
|
4155
4243
|
},
|
|
4156
4244
|
children: [
|
|
4157
|
-
withValues && orientation === "vertical" ? /* @__PURE__ */
|
|
4158
|
-
/* @__PURE__ */
|
|
4245
|
+
withValues && orientation === "vertical" ? /* @__PURE__ */ jsx56("span", { className: "pire-chart-barval", children: formatValue(value) }) : null,
|
|
4246
|
+
/* @__PURE__ */ jsxs46("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4159
4247
|
series.length > 1 ? `${one.label}: ` : "",
|
|
4160
4248
|
formatValue(value)
|
|
4161
4249
|
] })
|
|
@@ -4164,7 +4252,7 @@ function BarChart({
|
|
|
4164
4252
|
one.id
|
|
4165
4253
|
);
|
|
4166
4254
|
}) }),
|
|
4167
|
-
withValues && orientation === "horizontal" ? /* @__PURE__ */
|
|
4255
|
+
withValues && orientation === "horizontal" ? /* @__PURE__ */ jsx56("span", { className: "pire-chart-val", children: horizontalLabelFor(categoryIndex) }) : null
|
|
4168
4256
|
] }, categoryIndex)
|
|
4169
4257
|
))
|
|
4170
4258
|
}
|
|
@@ -4174,14 +4262,14 @@ function BarChart({
|
|
|
4174
4262
|
}
|
|
4175
4263
|
|
|
4176
4264
|
// src/components/data/LineChart.tsx
|
|
4177
|
-
import * as
|
|
4178
|
-
import { jsx as
|
|
4265
|
+
import * as React27 from "react";
|
|
4266
|
+
import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
4179
4267
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
4180
4268
|
var MARKER_LIMIT = 20;
|
|
4181
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
4269
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React27.useEffect : React27.useLayoutEffect;
|
|
4182
4270
|
function useMeasuredWidth() {
|
|
4183
|
-
const ref =
|
|
4184
|
-
const [width, setWidth] =
|
|
4271
|
+
const ref = React27.useRef(null);
|
|
4272
|
+
const [width, setWidth] = React27.useState(0);
|
|
4185
4273
|
useIsomorphicLayoutEffect2(() => {
|
|
4186
4274
|
const element = ref.current;
|
|
4187
4275
|
if (!element) return;
|
|
@@ -4242,7 +4330,7 @@ function LineChart({
|
|
|
4242
4330
|
return `M${xAt(present[0].index)} ${baseline} L${line} L${xAt(last.index)} ${baseline} Z`;
|
|
4243
4331
|
};
|
|
4244
4332
|
const labelEvery = Math.max(1, Math.ceil(categories.length / Math.max(2, Math.floor(innerWidth / 64))));
|
|
4245
|
-
return /* @__PURE__ */
|
|
4333
|
+
return /* @__PURE__ */ jsx57(
|
|
4246
4334
|
ChartFrame,
|
|
4247
4335
|
{
|
|
4248
4336
|
label,
|
|
@@ -4255,8 +4343,8 @@ function LineChart({
|
|
|
4255
4343
|
showDataTable,
|
|
4256
4344
|
className,
|
|
4257
4345
|
style,
|
|
4258
|
-
children: !hasData ? /* @__PURE__ */
|
|
4259
|
-
width > 0 ? /* @__PURE__ */
|
|
4346
|
+
children: !hasData ? /* @__PURE__ */ jsx57("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ jsxs47("div", { className: "pire-chart-lines", ref: plotRef, style: { height }, children: [
|
|
4347
|
+
width > 0 ? /* @__PURE__ */ jsxs47(
|
|
4260
4348
|
"svg",
|
|
4261
4349
|
{
|
|
4262
4350
|
width,
|
|
@@ -4265,7 +4353,7 @@ function LineChart({
|
|
|
4265
4353
|
"aria-hidden": "true",
|
|
4266
4354
|
focusable: "false",
|
|
4267
4355
|
children: [
|
|
4268
|
-
/* @__PURE__ */
|
|
4356
|
+
/* @__PURE__ */ jsx57("g", { className: "pire-chart-grid", children: scale.ticks.map((tick) => /* @__PURE__ */ jsx57(
|
|
4269
4357
|
"line",
|
|
4270
4358
|
{
|
|
4271
4359
|
x1: PLOT_INSET.left,
|
|
@@ -4275,8 +4363,8 @@ function LineChart({
|
|
|
4275
4363
|
},
|
|
4276
4364
|
tick
|
|
4277
4365
|
)) }),
|
|
4278
|
-
/* @__PURE__ */
|
|
4279
|
-
scale.ticks.map((tick) => /* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsxs47("g", { className: "pire-chart-tick", children: [
|
|
4367
|
+
scale.ticks.map((tick) => /* @__PURE__ */ jsx57(
|
|
4280
4368
|
"text",
|
|
4281
4369
|
{
|
|
4282
4370
|
x: PLOT_INSET.left - 8,
|
|
@@ -4290,11 +4378,11 @@ function LineChart({
|
|
|
4290
4378
|
categories.map(
|
|
4291
4379
|
(category, index) => index % labelEvery === 0 ? (
|
|
4292
4380
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4293
|
-
/* @__PURE__ */
|
|
4381
|
+
/* @__PURE__ */ jsx57("text", { x: xAt(index), y: height - 6, textAnchor: "middle", children: category }, index)
|
|
4294
4382
|
) : null
|
|
4295
4383
|
)
|
|
4296
4384
|
] }),
|
|
4297
|
-
showArea && series[0] ? /* @__PURE__ */
|
|
4385
|
+
showArea && series[0] ? /* @__PURE__ */ jsx57(
|
|
4298
4386
|
"path",
|
|
4299
4387
|
{
|
|
4300
4388
|
d: areaFor(series[0].values),
|
|
@@ -4302,10 +4390,10 @@ function LineChart({
|
|
|
4302
4390
|
style: { fill: seriesColor(series[0], 0) }
|
|
4303
4391
|
}
|
|
4304
4392
|
) : null,
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
withMarkers ? /* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx57("g", { className: "pire-chart-line", fill: "none", children: series.map((one, index) => /* @__PURE__ */ jsx57("path", { d: pathFor(one.values), stroke: seriesColor(one, index) }, one.id)) }),
|
|
4394
|
+
withMarkers ? /* @__PURE__ */ jsx57("g", { className: "pire-chart-marker", children: series.map(
|
|
4307
4395
|
(one, seriesIndex) => one.values.map(
|
|
4308
|
-
(value, index) => value == null ? null : /* @__PURE__ */
|
|
4396
|
+
(value, index) => value == null ? null : /* @__PURE__ */ jsx57(
|
|
4309
4397
|
"circle",
|
|
4310
4398
|
{
|
|
4311
4399
|
cx: xAt(index),
|
|
@@ -4320,7 +4408,7 @@ function LineChart({
|
|
|
4320
4408
|
]
|
|
4321
4409
|
}
|
|
4322
4410
|
) : null,
|
|
4323
|
-
/* @__PURE__ */
|
|
4411
|
+
/* @__PURE__ */ jsx57(
|
|
4324
4412
|
"div",
|
|
4325
4413
|
{
|
|
4326
4414
|
className: "pire-chart-hover",
|
|
@@ -4329,11 +4417,11 @@ function LineChart({
|
|
|
4329
4417
|
},
|
|
4330
4418
|
children: categories.map((category, categoryIndex) => (
|
|
4331
4419
|
// biome-ignore lint/suspicious/noArrayIndexKey: categories are positional and repeat legitimately (two quarters both labelled "Q1").
|
|
4332
|
-
/* @__PURE__ */
|
|
4333
|
-
/* @__PURE__ */
|
|
4420
|
+
/* @__PURE__ */ jsx57("div", { className: "pire-chart-band", children: /* @__PURE__ */ jsxs47("span", { className: "pire-chart-tip", role: "presentation", children: [
|
|
4421
|
+
/* @__PURE__ */ jsx57("strong", { children: category }),
|
|
4334
4422
|
series.map((one) => {
|
|
4335
4423
|
const value = one.values[categoryIndex];
|
|
4336
|
-
return /* @__PURE__ */
|
|
4424
|
+
return /* @__PURE__ */ jsxs47("span", { className: "pire-chart-tip-row", children: [
|
|
4337
4425
|
one.label,
|
|
4338
4426
|
": ",
|
|
4339
4427
|
value == null ? "No data" : formatValue(value)
|
|
@@ -4349,8 +4437,8 @@ function LineChart({
|
|
|
4349
4437
|
}
|
|
4350
4438
|
|
|
4351
4439
|
// src/components/data/DonutChart.tsx
|
|
4352
|
-
import * as
|
|
4353
|
-
import { jsx as
|
|
4440
|
+
import * as React28 from "react";
|
|
4441
|
+
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
4354
4442
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
4355
4443
|
function DonutChart({
|
|
4356
4444
|
categories,
|
|
@@ -4370,7 +4458,7 @@ function DonutChart({
|
|
|
4370
4458
|
}) {
|
|
4371
4459
|
const label = rest["aria-label"];
|
|
4372
4460
|
const msg = usePireMessages();
|
|
4373
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
4461
|
+
const [hoveredIndex, setHoveredIndex] = React28.useState(null);
|
|
4374
4462
|
warnOnDonutShape(series, categories.length, label);
|
|
4375
4463
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
4376
4464
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -4387,7 +4475,7 @@ function DonutChart({
|
|
|
4387
4475
|
}));
|
|
4388
4476
|
const hovered = hoveredIndex == null ? null : segments.find((segment) => segment.index === hoveredIndex) ?? null;
|
|
4389
4477
|
let arcStart = 0;
|
|
4390
|
-
return /* @__PURE__ */
|
|
4478
|
+
return /* @__PURE__ */ jsx58(
|
|
4391
4479
|
ChartFrame,
|
|
4392
4480
|
{
|
|
4393
4481
|
label,
|
|
@@ -4400,8 +4488,8 @@ function DonutChart({
|
|
|
4400
4488
|
showDataTable,
|
|
4401
4489
|
className,
|
|
4402
4490
|
style,
|
|
4403
|
-
children: !hasData ? /* @__PURE__ */
|
|
4404
|
-
/* @__PURE__ */
|
|
4491
|
+
children: !hasData ? /* @__PURE__ */ jsx58("div", { className: "pire-chart-empty", children: emptyState ?? msg.chartEmpty }) : /* @__PURE__ */ jsxs48("div", { className: "pire-chart-donut", style: { height: size }, children: [
|
|
4492
|
+
/* @__PURE__ */ jsx58(
|
|
4405
4493
|
"svg",
|
|
4406
4494
|
{
|
|
4407
4495
|
width: size,
|
|
@@ -4409,13 +4497,13 @@ function DonutChart({
|
|
|
4409
4497
|
"aria-hidden": "true",
|
|
4410
4498
|
focusable: "false",
|
|
4411
4499
|
onMouseLeave: () => setHoveredIndex(null),
|
|
4412
|
-
children: /* @__PURE__ */
|
|
4500
|
+
children: /* @__PURE__ */ jsx58("g", { transform: `rotate(-90 ${size / 2} ${size / 2})`, children: segments.map((segment) => {
|
|
4413
4501
|
const arcLength = segment.value / total * circumference;
|
|
4414
4502
|
const offset = arcStart;
|
|
4415
4503
|
arcStart += arcLength;
|
|
4416
4504
|
return (
|
|
4417
4505
|
// 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.
|
|
4418
|
-
/* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ jsx58(
|
|
4419
4507
|
"circle",
|
|
4420
4508
|
{
|
|
4421
4509
|
className: "pire-chart-arc",
|
|
@@ -4435,9 +4523,9 @@ function DonutChart({
|
|
|
4435
4523
|
}) })
|
|
4436
4524
|
}
|
|
4437
4525
|
),
|
|
4438
|
-
/* @__PURE__ */
|
|
4439
|
-
/* @__PURE__ */
|
|
4440
|
-
/* @__PURE__ */
|
|
4526
|
+
/* @__PURE__ */ jsxs48("div", { className: "pire-chart-donut-center", style: { width: size - thickness * 2 - 8 }, children: [
|
|
4527
|
+
/* @__PURE__ */ jsx58("span", { className: "pire-chart-donut-value", children: hovered ? formatValue(hovered.value) : centerLabel ?? formatValue(total) }),
|
|
4528
|
+
/* @__PURE__ */ jsx58("span", { className: "pire-chart-donut-caption", children: hovered ? hovered.category : centerCaption })
|
|
4441
4529
|
] })
|
|
4442
4530
|
] })
|
|
4443
4531
|
}
|
|
@@ -4449,14 +4537,14 @@ function colorForSegment(index) {
|
|
|
4449
4537
|
|
|
4450
4538
|
// src/components/data/LinkList.tsx
|
|
4451
4539
|
import { Button as AriaButton15 } from "react-aria-components";
|
|
4452
|
-
import { jsx as
|
|
4540
|
+
import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
4453
4541
|
function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
4454
|
-
return /* @__PURE__ */
|
|
4455
|
-
const keySlot = item.key ? /* @__PURE__ */
|
|
4456
|
-
const textSlot = item.text ? /* @__PURE__ */
|
|
4542
|
+
return /* @__PURE__ */ jsx59("div", { className: cx("pire-linklist", className), role: "list", "data-emphasis": emphasis, ...rest, children: items.map((item) => {
|
|
4543
|
+
const keySlot = item.key ? /* @__PURE__ */ jsx59("span", { className: "pire-linklist-key", children: item.key }) : null;
|
|
4544
|
+
const textSlot = item.text ? /* @__PURE__ */ jsx59("span", { className: "pire-linklist-text", children: item.text }) : null;
|
|
4457
4545
|
const [first, second] = emphasis === "text" ? [textSlot, keySlot] : [keySlot, textSlot];
|
|
4458
|
-
return /* @__PURE__ */
|
|
4459
|
-
item.icon ? /* @__PURE__ */
|
|
4546
|
+
return /* @__PURE__ */ jsx59("div", { role: "listitem", className: "pire-linklist-row", children: /* @__PURE__ */ jsxs49(AriaButton15, { className: "pire-linklist-item", onPress: () => onSelect?.(item.id), children: [
|
|
4547
|
+
item.icon ? /* @__PURE__ */ jsx59(Icon, { name: item.icon, size: 16, style: { color: "var(--text-secondary)" } }) : null,
|
|
4460
4548
|
first,
|
|
4461
4549
|
second,
|
|
4462
4550
|
item.trailing
|
|
@@ -4465,7 +4553,7 @@ function LinkList({ items, onSelect, emphasis = "key", className, ...rest }) {
|
|
|
4465
4553
|
}
|
|
4466
4554
|
|
|
4467
4555
|
// src/components/data/RecordCard.tsx
|
|
4468
|
-
import { jsx as
|
|
4556
|
+
import { jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
4469
4557
|
function RecordCard({
|
|
4470
4558
|
title,
|
|
4471
4559
|
subtitle,
|
|
@@ -4475,19 +4563,19 @@ function RecordCard({
|
|
|
4475
4563
|
className,
|
|
4476
4564
|
...rest
|
|
4477
4565
|
}) {
|
|
4478
|
-
return /* @__PURE__ */
|
|
4566
|
+
return /* @__PURE__ */ jsxs50(
|
|
4479
4567
|
"div",
|
|
4480
4568
|
{
|
|
4481
4569
|
className: cx("pire-recordcard", className),
|
|
4482
4570
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
4483
4571
|
...rest,
|
|
4484
4572
|
children: [
|
|
4485
|
-
icon ? /* @__PURE__ */
|
|
4486
|
-
/* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4488
|
-
subtitle ? /* @__PURE__ */
|
|
4573
|
+
icon ? /* @__PURE__ */ jsx60("span", { className: "pire-recordcard-tile", "aria-hidden": "true", children: /* @__PURE__ */ jsx60(Icon, { name: icon, size: 20 }) }) : null,
|
|
4574
|
+
/* @__PURE__ */ jsxs50("span", { className: "pire-recordcard-body", children: [
|
|
4575
|
+
/* @__PURE__ */ jsx60("span", { className: "pire-recordcard-title", children: title }),
|
|
4576
|
+
subtitle ? /* @__PURE__ */ jsx60("span", { className: "pire-recordcard-sub", children: subtitle }) : null
|
|
4489
4577
|
] }),
|
|
4490
|
-
action ? /* @__PURE__ */
|
|
4578
|
+
action ? /* @__PURE__ */ jsx60("span", { className: "pire-recordcard-action", children: action }) : null
|
|
4491
4579
|
]
|
|
4492
4580
|
}
|
|
4493
4581
|
);
|
|
@@ -4495,7 +4583,7 @@ function RecordCard({
|
|
|
4495
4583
|
|
|
4496
4584
|
// src/components/data/ViewSwitcher.tsx
|
|
4497
4585
|
import { Button as AriaButton16 } from "react-aria-components";
|
|
4498
|
-
import { jsx as
|
|
4586
|
+
import { jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
4499
4587
|
function ViewSwitcher({
|
|
4500
4588
|
name,
|
|
4501
4589
|
isDirty,
|
|
@@ -4508,7 +4596,7 @@ function ViewSwitcher({
|
|
|
4508
4596
|
}) {
|
|
4509
4597
|
const msg = usePireMessages();
|
|
4510
4598
|
const label = ariaLabel ?? (isDirty ? msg.viewSwitcherNameModified.replace("{view}", name) : msg.viewSwitcherName.replace("{view}", name));
|
|
4511
|
-
return /* @__PURE__ */
|
|
4599
|
+
return /* @__PURE__ */ jsxs51(
|
|
4512
4600
|
AriaButton16,
|
|
4513
4601
|
{
|
|
4514
4602
|
className: cx("pire-viewswitcher", className),
|
|
@@ -4517,36 +4605,36 @@ function ViewSwitcher({
|
|
|
4517
4605
|
isDisabled,
|
|
4518
4606
|
onPress,
|
|
4519
4607
|
children: [
|
|
4520
|
-
/* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
isDirty ? /* @__PURE__ */
|
|
4523
|
-
/* @__PURE__ */
|
|
4608
|
+
/* @__PURE__ */ jsx61(Icon, { name: icon, size: 16 }),
|
|
4609
|
+
/* @__PURE__ */ jsx61("span", { className: "pire-viewswitcher-name", children: name }),
|
|
4610
|
+
isDirty ? /* @__PURE__ */ jsx61("span", { className: "pire-viewswitcher-dirty", "aria-hidden": "true", children: msg.viewSwitcherModifiedMark }) : null,
|
|
4611
|
+
/* @__PURE__ */ jsx61(Icon, { name: "chevron-down", size: 16 })
|
|
4524
4612
|
]
|
|
4525
4613
|
}
|
|
4526
4614
|
);
|
|
4527
4615
|
}
|
|
4528
4616
|
|
|
4529
4617
|
// src/components/data/BarList.tsx
|
|
4530
|
-
import { jsx as
|
|
4618
|
+
import { jsx as jsx62, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
4531
4619
|
function BarList({ items, max, className, ...rest }) {
|
|
4532
4620
|
const scale = max ?? Math.max(0, ...items.map((i) => i.value));
|
|
4533
|
-
return /* @__PURE__ */
|
|
4621
|
+
return /* @__PURE__ */ jsx62("ul", { ...rest, className: cx("pire-barlist", className), children: items.map((item) => {
|
|
4534
4622
|
const pct = scale > 0 ? Math.max(0, Math.min(100, item.value / scale * 100)) : 0;
|
|
4535
|
-
return /* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4538
|
-
/* @__PURE__ */
|
|
4623
|
+
return /* @__PURE__ */ jsxs52("li", { className: "pire-barlist-row", "data-tone": item.tone, children: [
|
|
4624
|
+
/* @__PURE__ */ jsxs52("span", { className: "pire-barlist-main", children: [
|
|
4625
|
+
/* @__PURE__ */ jsx62("span", { className: "pire-barlist-label", children: item.label }),
|
|
4626
|
+
/* @__PURE__ */ jsx62("span", { className: "pire-barlist-track", "aria-hidden": "true", children: /* @__PURE__ */ jsx62("span", { className: "pire-barlist-fill", style: { width: `${pct}%` } }) })
|
|
4539
4627
|
] }),
|
|
4540
|
-
/* @__PURE__ */
|
|
4541
|
-
/* @__PURE__ */
|
|
4542
|
-
item.hint ? /* @__PURE__ */
|
|
4628
|
+
/* @__PURE__ */ jsxs52("span", { className: "pire-barlist-figure", children: [
|
|
4629
|
+
/* @__PURE__ */ jsx62("span", { className: "pire-barlist-value", children: item.valueLabel ?? String(item.value) }),
|
|
4630
|
+
item.hint ? /* @__PURE__ */ jsx62("span", { className: "pire-barlist-hint", children: item.hint }) : null
|
|
4543
4631
|
] })
|
|
4544
4632
|
] }, item.id);
|
|
4545
4633
|
}) });
|
|
4546
4634
|
}
|
|
4547
4635
|
|
|
4548
4636
|
// src/components/layout/PageBand.tsx
|
|
4549
|
-
import { jsx as
|
|
4637
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
4550
4638
|
function PageBand({
|
|
4551
4639
|
surface = "card",
|
|
4552
4640
|
hasBorder = true,
|
|
@@ -4554,7 +4642,7 @@ function PageBand({
|
|
|
4554
4642
|
className,
|
|
4555
4643
|
...rest
|
|
4556
4644
|
}) {
|
|
4557
|
-
return /* @__PURE__ */
|
|
4645
|
+
return /* @__PURE__ */ jsx63(
|
|
4558
4646
|
"div",
|
|
4559
4647
|
{
|
|
4560
4648
|
className: cx("pire-pageband", className),
|
|
@@ -4567,29 +4655,29 @@ function PageBand({
|
|
|
4567
4655
|
}
|
|
4568
4656
|
|
|
4569
4657
|
// src/components/layout/PageHeader.tsx
|
|
4570
|
-
import { jsx as
|
|
4658
|
+
import { jsx as jsx64, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
4571
4659
|
function PageHeader({ title, subtitle, actions, className, ...rest }) {
|
|
4572
|
-
return /* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
/* @__PURE__ */
|
|
4575
|
-
subtitle ? /* @__PURE__ */
|
|
4660
|
+
return /* @__PURE__ */ jsxs53("header", { className: cx("pire-pageheader", className), ...rest, children: [
|
|
4661
|
+
/* @__PURE__ */ jsxs53("div", { style: { minWidth: 0 }, children: [
|
|
4662
|
+
/* @__PURE__ */ jsx64("h1", { className: "pire-pageheader-title", children: title }),
|
|
4663
|
+
subtitle ? /* @__PURE__ */ jsx64("p", { className: "pire-pageheader-sub", children: subtitle }) : null
|
|
4576
4664
|
] }),
|
|
4577
|
-
actions ? /* @__PURE__ */
|
|
4665
|
+
actions ? /* @__PURE__ */ jsx64("div", { className: "pire-pageheader-actions", children: actions }) : null
|
|
4578
4666
|
] });
|
|
4579
4667
|
}
|
|
4580
4668
|
|
|
4581
4669
|
// src/components/layout/SectionHeader.tsx
|
|
4582
|
-
import { jsx as
|
|
4670
|
+
import { jsx as jsx65, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
4583
4671
|
function SectionHeader({ title, meta, actions, className, ...rest }) {
|
|
4584
|
-
return /* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
meta ? /* @__PURE__ */
|
|
4587
|
-
actions ? /* @__PURE__ */
|
|
4672
|
+
return /* @__PURE__ */ jsxs54("div", { className: cx("pire-sectionhead", className), ...rest, children: [
|
|
4673
|
+
/* @__PURE__ */ jsx65("span", { className: "pire-eyebrow", children: title }),
|
|
4674
|
+
meta ? /* @__PURE__ */ jsx65("span", { style: { font: "var(--type-caption)", color: "var(--text-tertiary)" }, children: meta }) : null,
|
|
4675
|
+
actions ? /* @__PURE__ */ jsx65("div", { className: "pire-sectionhead-actions", children: actions }) : null
|
|
4588
4676
|
] });
|
|
4589
4677
|
}
|
|
4590
4678
|
|
|
4591
4679
|
// src/components/layout/SelectionBar.tsx
|
|
4592
|
-
import { jsx as
|
|
4680
|
+
import { jsx as jsx66, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
4593
4681
|
function SelectionBar({
|
|
4594
4682
|
count,
|
|
4595
4683
|
noun = "record",
|
|
@@ -4599,31 +4687,31 @@ function SelectionBar({
|
|
|
4599
4687
|
...rest
|
|
4600
4688
|
}) {
|
|
4601
4689
|
if (!count) return null;
|
|
4602
|
-
return /* @__PURE__ */
|
|
4603
|
-
/* @__PURE__ */
|
|
4690
|
+
return /* @__PURE__ */ jsxs55("div", { className: cx("pire-selectionbar", className), role: "status", "aria-live": "polite", ...rest, children: [
|
|
4691
|
+
/* @__PURE__ */ jsxs55("span", { className: "pire-selectionbar-count", children: [
|
|
4604
4692
|
count.toLocaleString(),
|
|
4605
4693
|
" ",
|
|
4606
4694
|
noun,
|
|
4607
4695
|
count === 1 ? "" : "s",
|
|
4608
4696
|
" selected"
|
|
4609
4697
|
] }),
|
|
4610
|
-
children ? /* @__PURE__ */
|
|
4611
|
-
actions ? /* @__PURE__ */
|
|
4698
|
+
children ? /* @__PURE__ */ jsx66("span", { style: { color: "var(--text-secondary)", font: "var(--type-caption)" }, children }) : null,
|
|
4699
|
+
actions ? /* @__PURE__ */ jsx66("div", { className: "pire-selectionbar-actions", children: actions }) : null
|
|
4612
4700
|
] });
|
|
4613
4701
|
}
|
|
4614
4702
|
|
|
4615
4703
|
// src/components/layout/FooterBar.tsx
|
|
4616
|
-
import { jsx as
|
|
4704
|
+
import { jsx as jsx67, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
4617
4705
|
function FooterBar({ note, actions, children, className, ...rest }) {
|
|
4618
|
-
return /* @__PURE__ */
|
|
4619
|
-
note ? /* @__PURE__ */
|
|
4706
|
+
return /* @__PURE__ */ jsxs56("footer", { className: cx("pire-footerbar", className), ...rest, children: [
|
|
4707
|
+
note ? /* @__PURE__ */ jsx67("span", { className: "pire-footerbar-note", children: note }) : null,
|
|
4620
4708
|
children,
|
|
4621
|
-
actions ? /* @__PURE__ */
|
|
4709
|
+
actions ? /* @__PURE__ */ jsx67("div", { className: "pire-footerbar-actions", children: actions }) : null
|
|
4622
4710
|
] });
|
|
4623
4711
|
}
|
|
4624
4712
|
|
|
4625
4713
|
// src/components/layout/SplitPane.tsx
|
|
4626
|
-
import { jsx as
|
|
4714
|
+
import { jsx as jsx68, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
4627
4715
|
function SplitPane({
|
|
4628
4716
|
list,
|
|
4629
4717
|
detail,
|
|
@@ -4639,7 +4727,7 @@ function SplitPane({
|
|
|
4639
4727
|
}) {
|
|
4640
4728
|
const msg = usePireMessages();
|
|
4641
4729
|
const width = typeof listWidth === "number" ? `${listWidth}px` : listWidth;
|
|
4642
|
-
return /* @__PURE__ */
|
|
4730
|
+
return /* @__PURE__ */ jsxs57(
|
|
4643
4731
|
"div",
|
|
4644
4732
|
{
|
|
4645
4733
|
className: cx("pire-split", className),
|
|
@@ -4647,10 +4735,10 @@ function SplitPane({
|
|
|
4647
4735
|
style: { ["--pire-split-list-w"]: width, ...style },
|
|
4648
4736
|
...rest,
|
|
4649
4737
|
children: [
|
|
4650
|
-
/* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
4652
|
-
onBack ? /* @__PURE__ */
|
|
4653
|
-
detail ?? /* @__PURE__ */
|
|
4738
|
+
/* @__PURE__ */ jsx68("section", { className: "pire-split-list", "aria-label": listLabel ?? msg.splitPaneList, children: list }),
|
|
4739
|
+
/* @__PURE__ */ jsxs57("section", { className: "pire-split-detail", "aria-label": detailLabel ?? msg.splitPaneDetail, children: [
|
|
4740
|
+
onBack ? /* @__PURE__ */ jsx68("div", { className: "pire-split-back", children: /* @__PURE__ */ jsx68(Button, { variant: "tertiary", size: "sm", icon: "arrow-left", onPress: onBack, children: backLabel ?? msg.splitPaneBack }) }) : null,
|
|
4741
|
+
detail ?? /* @__PURE__ */ jsx68("div", { className: "pire-split-empty", children: emptyDetail })
|
|
4654
4742
|
] })
|
|
4655
4743
|
]
|
|
4656
4744
|
}
|
|
@@ -4658,7 +4746,7 @@ function SplitPane({
|
|
|
4658
4746
|
}
|
|
4659
4747
|
|
|
4660
4748
|
// src/components/patterns/ConfirmDialog.tsx
|
|
4661
|
-
import { Fragment as Fragment8, jsx as
|
|
4749
|
+
import { Fragment as Fragment8, jsx as jsx69, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
4662
4750
|
function ConfirmDialog({
|
|
4663
4751
|
isOpen,
|
|
4664
4752
|
title,
|
|
@@ -4674,7 +4762,7 @@ function ConfirmDialog({
|
|
|
4674
4762
|
onCancel
|
|
4675
4763
|
}) {
|
|
4676
4764
|
const msg = usePireMessages();
|
|
4677
|
-
return /* @__PURE__ */
|
|
4765
|
+
return /* @__PURE__ */ jsxs58(
|
|
4678
4766
|
Dialog,
|
|
4679
4767
|
{
|
|
4680
4768
|
isOpen,
|
|
@@ -4684,9 +4772,9 @@ function ConfirmDialog({
|
|
|
4684
4772
|
onClose: onCancel,
|
|
4685
4773
|
isDismissable: !isBusy,
|
|
4686
4774
|
showClose: false,
|
|
4687
|
-
footer: /* @__PURE__ */
|
|
4688
|
-
/* @__PURE__ */
|
|
4689
|
-
/* @__PURE__ */
|
|
4775
|
+
footer: /* @__PURE__ */ jsxs58(Fragment8, { children: [
|
|
4776
|
+
/* @__PURE__ */ jsx69(Button, { variant: "tertiary", isDisabled: isBusy, onPress: onCancel, children: cancelLabel }),
|
|
4777
|
+
/* @__PURE__ */ jsx69(Button, { variant: tone === "danger" ? "danger" : "primary", isDisabled: isBusy, onPress: onConfirm, children: isBusy ? "Working\u2026" : confirmLabel })
|
|
4690
4778
|
] }),
|
|
4691
4779
|
children: [
|
|
4692
4780
|
facts?.length ? (
|
|
@@ -4694,9 +4782,9 @@ function ConfirmDialog({
|
|
|
4694
4782
|
// *prohibits* `aria-label` — the label named nothing at all, and axe's
|
|
4695
4783
|
// `aria-prohibited-attr` fails it on sight. Every other labelled div/span in this library
|
|
4696
4784
|
// pairs with an explicit role for the same reason.
|
|
4697
|
-
/* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx69("div", { className: "pire-confirm-facts", role: "group", "aria-label": msg.confirmDialogFactsLabel, children: /* @__PURE__ */ jsx69(DescriptionList, { layout: "rows", items: facts }) })
|
|
4698
4786
|
) : null,
|
|
4699
|
-
consequence ? /* @__PURE__ */
|
|
4787
|
+
consequence ? /* @__PURE__ */ jsx69(
|
|
4700
4788
|
InlineMessage,
|
|
4701
4789
|
{
|
|
4702
4790
|
kind: tone === "danger" ? "error" : "warning",
|
|
@@ -4711,7 +4799,7 @@ function ConfirmDialog({
|
|
|
4711
4799
|
}
|
|
4712
4800
|
|
|
4713
4801
|
// src/components/patterns/CommandPalette.tsx
|
|
4714
|
-
import * as
|
|
4802
|
+
import * as React29 from "react";
|
|
4715
4803
|
import {
|
|
4716
4804
|
Autocomplete,
|
|
4717
4805
|
ModalOverlay as ModalOverlay2,
|
|
@@ -4724,7 +4812,7 @@ import {
|
|
|
4724
4812
|
Header as Header2,
|
|
4725
4813
|
useFilter
|
|
4726
4814
|
} from "react-aria-components";
|
|
4727
|
-
import { Fragment as Fragment9, jsx as
|
|
4815
|
+
import { Fragment as Fragment9, jsx as jsx70, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
4728
4816
|
var RESULTS_SECTION_KEY = "__pire_results__";
|
|
4729
4817
|
var searchableText = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
4730
4818
|
function CommandPalette({
|
|
@@ -4745,17 +4833,17 @@ function CommandPalette({
|
|
|
4745
4833
|
style
|
|
4746
4834
|
}) {
|
|
4747
4835
|
const msg = usePireMessages();
|
|
4748
|
-
const [query, setQuery] =
|
|
4836
|
+
const [query, setQuery] = React29.useState("");
|
|
4749
4837
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
4750
|
-
|
|
4838
|
+
React29.useEffect(() => {
|
|
4751
4839
|
if (isOpen) setQuery("");
|
|
4752
4840
|
}, [isOpen]);
|
|
4753
|
-
const searchableById =
|
|
4841
|
+
const searchableById = React29.useMemo(() => {
|
|
4754
4842
|
const byId = /* @__PURE__ */ new Map();
|
|
4755
4843
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
4756
4844
|
return byId;
|
|
4757
4845
|
}, [groups]);
|
|
4758
|
-
const filter =
|
|
4846
|
+
const filter = React29.useCallback(
|
|
4759
4847
|
(textValue, inputValue, node) => {
|
|
4760
4848
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
4761
4849
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
@@ -4768,7 +4856,7 @@ function CommandPalette({
|
|
|
4768
4856
|
};
|
|
4769
4857
|
const sections = [...groups, ...resultsGroup ? [{ ...resultsGroup, id: RESULTS_SECTION_KEY }] : []];
|
|
4770
4858
|
const status = isLoading ? loadingLabel ?? msg.commandPaletteLoading : emptyLabel ?? msg.commandPaletteEmpty;
|
|
4771
|
-
return /* @__PURE__ */
|
|
4859
|
+
return /* @__PURE__ */ jsx70(
|
|
4772
4860
|
ModalOverlay2,
|
|
4773
4861
|
{
|
|
4774
4862
|
className: "pire-cp-overlay",
|
|
@@ -4777,11 +4865,11 @@ function CommandPalette({
|
|
|
4777
4865
|
onOpenChange: (open) => {
|
|
4778
4866
|
if (!open) onOpenChange?.(false);
|
|
4779
4867
|
},
|
|
4780
|
-
children: /* @__PURE__ */
|
|
4781
|
-
/* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
4784
|
-
/* @__PURE__ */
|
|
4868
|
+
children: /* @__PURE__ */ jsx70(Modal2, { className: cx("pire-cp-modal", className), style, children: /* @__PURE__ */ jsxs59(AriaDialog4, { className: "pire-cp-dialog", "aria-label": ariaLabel ?? msg.commandPaletteLabel, children: [
|
|
4869
|
+
/* @__PURE__ */ jsxs59(Autocomplete, { filter, inputValue: query, onInputChange: handleInputChange, children: [
|
|
4870
|
+
/* @__PURE__ */ jsxs59(SearchField, { className: "pire-cp-search", "aria-label": msg.commandPaletteSearchLabel, children: [
|
|
4871
|
+
/* @__PURE__ */ jsx70(Icon, { name: "search", size: 18, className: "pire-cp-search-icon" }),
|
|
4872
|
+
/* @__PURE__ */ jsx70(
|
|
4785
4873
|
AriaInput5,
|
|
4786
4874
|
{
|
|
4787
4875
|
className: "pire-cp-input",
|
|
@@ -4790,16 +4878,16 @@ function CommandPalette({
|
|
|
4790
4878
|
}
|
|
4791
4879
|
)
|
|
4792
4880
|
] }),
|
|
4793
|
-
isLoading ? /* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4881
|
+
isLoading ? /* @__PURE__ */ jsx70("div", { className: "pire-cp-loading", role: "status", "aria-live": "polite", children: loadingLabel ?? msg.commandPaletteLoading }) : null,
|
|
4882
|
+
/* @__PURE__ */ jsx70(
|
|
4795
4883
|
AriaMenu2,
|
|
4796
4884
|
{
|
|
4797
4885
|
className: "pire-cp-list",
|
|
4798
4886
|
onAction: (key) => onAction?.(String(key)),
|
|
4799
|
-
renderEmptyState: () => /* @__PURE__ */
|
|
4800
|
-
children: sections.map((section) => /* @__PURE__ */
|
|
4801
|
-
section.label ? /* @__PURE__ */
|
|
4802
|
-
section.items.map((item) => /* @__PURE__ */
|
|
4887
|
+
renderEmptyState: () => /* @__PURE__ */ jsx70("div", { className: "pire-cp-status", children: status }),
|
|
4888
|
+
children: sections.map((section) => /* @__PURE__ */ jsxs59(AriaMenuSection2, { id: section.id, className: "pire-cp-section", children: [
|
|
4889
|
+
section.label ? /* @__PURE__ */ jsx70(Header2, { className: "pire-cp-section-title", children: section.label }) : null,
|
|
4890
|
+
section.items.map((item) => /* @__PURE__ */ jsx70(
|
|
4803
4891
|
MenuItem,
|
|
4804
4892
|
{
|
|
4805
4893
|
id: item.id,
|
|
@@ -4820,18 +4908,18 @@ function CommandPalette({
|
|
|
4820
4908
|
// aria-hidden: the glyphs are a sighted affordance for discovering the keys. A screen
|
|
4821
4909
|
// reader already announces the listbox semantics that make those keys work, so reading
|
|
4822
4910
|
// "up arrow down arrow navigate" out loud is noise on every open.
|
|
4823
|
-
/* @__PURE__ */
|
|
4824
|
-
/* @__PURE__ */
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4911
|
+
/* @__PURE__ */ jsx70("div", { className: "pire-cp-foot", "aria-hidden": "true", children: footer ?? /* @__PURE__ */ jsxs59(Fragment9, { children: [
|
|
4912
|
+
/* @__PURE__ */ jsxs59("span", { className: "pire-cp-hint", children: [
|
|
4913
|
+
/* @__PURE__ */ jsx70(Kbd, { children: "\u2191" }),
|
|
4914
|
+
/* @__PURE__ */ jsx70(Kbd, { children: "\u2193" }),
|
|
4827
4915
|
msg.commandPaletteHintNavigate
|
|
4828
4916
|
] }),
|
|
4829
|
-
/* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
4917
|
+
/* @__PURE__ */ jsxs59("span", { className: "pire-cp-hint", children: [
|
|
4918
|
+
/* @__PURE__ */ jsx70(Kbd, { children: "\u21B5" }),
|
|
4831
4919
|
msg.commandPaletteHintSelect
|
|
4832
4920
|
] }),
|
|
4833
|
-
/* @__PURE__ */
|
|
4834
|
-
/* @__PURE__ */
|
|
4921
|
+
/* @__PURE__ */ jsxs59("span", { className: "pire-cp-hint", children: [
|
|
4922
|
+
/* @__PURE__ */ jsx70(Kbd, { children: "esc" }),
|
|
4835
4923
|
msg.commandPaletteHintClose
|
|
4836
4924
|
] })
|
|
4837
4925
|
] }) })
|
|
@@ -4841,9 +4929,9 @@ function CommandPalette({
|
|
|
4841
4929
|
);
|
|
4842
4930
|
}
|
|
4843
4931
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
4844
|
-
const handler =
|
|
4932
|
+
const handler = React29.useRef(onTrigger);
|
|
4845
4933
|
handler.current = onTrigger;
|
|
4846
|
-
|
|
4934
|
+
React29.useEffect(() => {
|
|
4847
4935
|
if (isDisabled) return;
|
|
4848
4936
|
const onKeyDown = (event) => {
|
|
4849
4937
|
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
@@ -4857,7 +4945,7 @@ function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
|
4857
4945
|
}
|
|
4858
4946
|
|
|
4859
4947
|
// src/components/patterns/AppLauncher.tsx
|
|
4860
|
-
import * as
|
|
4948
|
+
import * as React30 from "react";
|
|
4861
4949
|
import {
|
|
4862
4950
|
DialogTrigger,
|
|
4863
4951
|
Button as AriaButton17,
|
|
@@ -4865,7 +4953,7 @@ import {
|
|
|
4865
4953
|
Dialog as AriaDialog5,
|
|
4866
4954
|
useFilter as useFilter2
|
|
4867
4955
|
} from "react-aria-components";
|
|
4868
|
-
import { Fragment as Fragment10, jsx as
|
|
4956
|
+
import { Fragment as Fragment10, jsx as jsx71, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
4869
4957
|
var searchableText2 = (item) => [item.label, item.description, item.keywords].filter(Boolean).join(" ");
|
|
4870
4958
|
function AppLauncher({
|
|
4871
4959
|
sections,
|
|
@@ -4884,13 +4972,13 @@ function AppLauncher({
|
|
|
4884
4972
|
className
|
|
4885
4973
|
}) {
|
|
4886
4974
|
const msg = usePireMessages();
|
|
4887
|
-
const [query, setQuery] =
|
|
4975
|
+
const [query, setQuery] = React30.useState("");
|
|
4888
4976
|
const { contains } = useFilter2({ sensitivity: "base" });
|
|
4889
4977
|
const handleSearch = (next) => {
|
|
4890
4978
|
setQuery(next);
|
|
4891
4979
|
onSearchChange?.(next);
|
|
4892
4980
|
};
|
|
4893
|
-
const visible =
|
|
4981
|
+
const visible = React30.useMemo(() => {
|
|
4894
4982
|
if (isFilteredExternally) return sections;
|
|
4895
4983
|
const q = query.trim();
|
|
4896
4984
|
if (!q) return sections;
|
|
@@ -4901,9 +4989,9 @@ function AppLauncher({
|
|
|
4901
4989
|
}, [sections, query, isFilteredExternally, contains]);
|
|
4902
4990
|
const isEmpty = !isLoading && visible.length === 0;
|
|
4903
4991
|
const label = ariaLabel ?? msg.appLauncherLabel;
|
|
4904
|
-
return /* @__PURE__ */
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
/* @__PURE__ */
|
|
4992
|
+
return /* @__PURE__ */ jsxs60(DialogTrigger, { children: [
|
|
4993
|
+
/* @__PURE__ */ jsx71(AriaButton17, { className: "pire-launcher-trigger", "aria-label": label, children: /* @__PURE__ */ jsx71(Icon, { name: icon, size: 20 }) }),
|
|
4994
|
+
/* @__PURE__ */ jsx71(
|
|
4907
4995
|
Popover8,
|
|
4908
4996
|
{
|
|
4909
4997
|
className: cx("pire-launcher-popover", className),
|
|
@@ -4911,15 +4999,15 @@ function AppLauncher({
|
|
|
4911
4999
|
offset: 0,
|
|
4912
5000
|
crossOffset: 0,
|
|
4913
5001
|
containerPadding: 0,
|
|
4914
|
-
children: /* @__PURE__ */
|
|
4915
|
-
/* @__PURE__ */
|
|
4916
|
-
/* @__PURE__ */
|
|
4917
|
-
meta ? /* @__PURE__ */
|
|
5002
|
+
children: /* @__PURE__ */ jsx71(AriaDialog5, { className: "pire-launcher", "aria-label": label, children: ({ close }) => /* @__PURE__ */ jsxs60(Fragment10, { children: [
|
|
5003
|
+
/* @__PURE__ */ jsxs60("div", { className: "pire-launcher-head", children: [
|
|
5004
|
+
/* @__PURE__ */ jsx71("span", { className: "pire-launcher-title", children: title ?? msg.appLauncherTitle }),
|
|
5005
|
+
meta ? /* @__PURE__ */ jsx71("span", { className: "pire-launcher-meta", children: meta }) : null
|
|
4918
5006
|
] }),
|
|
4919
5007
|
isSearchable ? (
|
|
4920
5008
|
// autoFocus is right here specifically: the panel exists to be searched, and the
|
|
4921
5009
|
// user just chose to open it, so taking the caret is what they asked for.
|
|
4922
|
-
/* @__PURE__ */
|
|
5010
|
+
/* @__PURE__ */ jsx71(
|
|
4923
5011
|
Input,
|
|
4924
5012
|
{
|
|
4925
5013
|
"aria-label": msg.appLauncherSearch,
|
|
@@ -4933,17 +5021,17 @@ function AppLauncher({
|
|
|
4933
5021
|
}
|
|
4934
5022
|
)
|
|
4935
5023
|
) : null,
|
|
4936
|
-
isLoading ? /* @__PURE__ */
|
|
4937
|
-
isEmpty ? /* @__PURE__ */
|
|
5024
|
+
isLoading ? /* @__PURE__ */ jsx71("div", { className: "pire-launcher-empty", role: "status", "aria-live": "polite", children: msg.appLauncherLoading }) : null,
|
|
5025
|
+
isEmpty ? /* @__PURE__ */ jsx71("div", { className: "pire-launcher-empty", children: emptyLabel ?? msg.appLauncherEmpty }) : null,
|
|
4938
5026
|
visible.map((section, si) => (
|
|
4939
5027
|
// Sections are positional zones with no record identity, so the heading is the key
|
|
4940
5028
|
// where there is one. Same reasoning as ShellRail's groups.
|
|
4941
|
-
/* @__PURE__ */
|
|
4942
|
-
section.label ? /* @__PURE__ */
|
|
4943
|
-
/* @__PURE__ */
|
|
5029
|
+
/* @__PURE__ */ jsxs60("div", { className: "pire-launcher-section", children: [
|
|
5030
|
+
section.label ? /* @__PURE__ */ jsx71("div", { className: "pire-eyebrow", children: section.label }) : null,
|
|
5031
|
+
/* @__PURE__ */ jsx71("div", { className: "pire-launcher-grid", "data-variant": section.variant ?? "tile", children: section.items.map((item) => {
|
|
4944
5032
|
const isCurrent = item.id === value;
|
|
4945
5033
|
const showsDescription = (section.variant ?? "tile") === "tile" && Boolean(item.description);
|
|
4946
|
-
return /* @__PURE__ */
|
|
5034
|
+
return /* @__PURE__ */ jsxs60(
|
|
4947
5035
|
AriaButton17,
|
|
4948
5036
|
{
|
|
4949
5037
|
className: "pire-launcher-item",
|
|
@@ -4954,16 +5042,16 @@ function AppLauncher({
|
|
|
4954
5042
|
onAction?.(item.id);
|
|
4955
5043
|
},
|
|
4956
5044
|
children: [
|
|
4957
|
-
item.icon ? /* @__PURE__ */
|
|
5045
|
+
item.icon ? /* @__PURE__ */ jsx71("span", { className: "pire-launcher-item-icon", children: /* @__PURE__ */ jsx71(
|
|
4958
5046
|
Icon,
|
|
4959
5047
|
{
|
|
4960
5048
|
name: item.icon,
|
|
4961
5049
|
size: (section.variant ?? "tile") === "tile" ? 20 : 16
|
|
4962
5050
|
}
|
|
4963
5051
|
) }) : null,
|
|
4964
|
-
/* @__PURE__ */
|
|
4965
|
-
/* @__PURE__ */
|
|
4966
|
-
showsDescription ? /* @__PURE__ */
|
|
5052
|
+
/* @__PURE__ */ jsxs60("span", { className: "pire-launcher-item-text", children: [
|
|
5053
|
+
/* @__PURE__ */ jsx71("span", { className: "pire-launcher-item-label", children: item.label }),
|
|
5054
|
+
showsDescription ? /* @__PURE__ */ jsx71("span", { className: "pire-launcher-item-desc", children: item.description }) : null
|
|
4967
5055
|
] })
|
|
4968
5056
|
]
|
|
4969
5057
|
},
|
|
@@ -4980,7 +5068,7 @@ function AppLauncher({
|
|
|
4980
5068
|
|
|
4981
5069
|
// src/components/patterns/SidePanel.tsx
|
|
4982
5070
|
import { ModalOverlay as ModalOverlay3, Modal as Modal3, Dialog as AriaDialog6, Heading as Heading5 } from "react-aria-components";
|
|
4983
|
-
import { jsx as
|
|
5071
|
+
import { jsx as jsx72, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
4984
5072
|
function SidePanel({
|
|
4985
5073
|
isOpen,
|
|
4986
5074
|
title,
|
|
@@ -4992,7 +5080,7 @@ function SidePanel({
|
|
|
4992
5080
|
className
|
|
4993
5081
|
}) {
|
|
4994
5082
|
const msg = usePireMessages();
|
|
4995
|
-
return /* @__PURE__ */
|
|
5083
|
+
return /* @__PURE__ */ jsx72(
|
|
4996
5084
|
ModalOverlay3,
|
|
4997
5085
|
{
|
|
4998
5086
|
className: "pire-sidepanel-overlay",
|
|
@@ -5001,23 +5089,23 @@ function SidePanel({
|
|
|
5001
5089
|
onOpenChange: (o) => {
|
|
5002
5090
|
if (!o) onClose?.();
|
|
5003
5091
|
},
|
|
5004
|
-
children: /* @__PURE__ */
|
|
5005
|
-
/* @__PURE__ */
|
|
5006
|
-
/* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
subtitle ? /* @__PURE__ */
|
|
5092
|
+
children: /* @__PURE__ */ jsx72(Modal3, { className: cx("pire-sidepanel", className), style: { width }, children: /* @__PURE__ */ jsxs61(AriaDialog6, { className: "pire-dialog", style: { height: "100%" }, children: [
|
|
5093
|
+
/* @__PURE__ */ jsxs61("header", { className: "pire-dialog-head", children: [
|
|
5094
|
+
/* @__PURE__ */ jsxs61("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5095
|
+
/* @__PURE__ */ jsx72(Heading5, { slot: "title", className: "pire-dialog-title", children: title }),
|
|
5096
|
+
subtitle ? /* @__PURE__ */ jsx72("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null
|
|
5009
5097
|
] }),
|
|
5010
|
-
/* @__PURE__ */
|
|
5098
|
+
/* @__PURE__ */ jsx72(IconButton, { icon: "x", label: msg.sidePanelClose, size: "sm", onPress: onClose })
|
|
5011
5099
|
] }),
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
footer ? /* @__PURE__ */
|
|
5100
|
+
/* @__PURE__ */ jsx72("div", { className: "pire-dialog-body", style: { flex: 1 }, children }),
|
|
5101
|
+
footer ? /* @__PURE__ */ jsx72("footer", { className: "pire-dialog-foot", children: footer }) : null
|
|
5014
5102
|
] }) })
|
|
5015
5103
|
}
|
|
5016
5104
|
);
|
|
5017
5105
|
}
|
|
5018
5106
|
|
|
5019
5107
|
// src/components/patterns/EmptyState.tsx
|
|
5020
|
-
import { jsx as
|
|
5108
|
+
import { jsx as jsx73, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
5021
5109
|
function EmptyState({
|
|
5022
5110
|
icon = "file-text",
|
|
5023
5111
|
title,
|
|
@@ -5027,18 +5115,18 @@ function EmptyState({
|
|
|
5027
5115
|
className,
|
|
5028
5116
|
...rest
|
|
5029
5117
|
}) {
|
|
5030
|
-
return /* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
title ? /* @__PURE__ */
|
|
5033
|
-
children ? /* @__PURE__ */
|
|
5118
|
+
return /* @__PURE__ */ jsxs62("div", { className: cx("pire-empty", className), "data-compact": compact ? "true" : void 0, ...rest, children: [
|
|
5119
|
+
/* @__PURE__ */ jsx73(Icon, { name: icon, size: 24, className: "pire-empty-icon" }),
|
|
5120
|
+
title ? /* @__PURE__ */ jsx73("p", { className: "pire-empty-title", style: { margin: 0 }, children: title }) : null,
|
|
5121
|
+
children ? /* @__PURE__ */ jsx73("p", { className: "pire-empty-body", style: { margin: 0 }, children }) : null,
|
|
5034
5122
|
action
|
|
5035
5123
|
] });
|
|
5036
5124
|
}
|
|
5037
5125
|
|
|
5038
5126
|
// src/components/patterns/NumPad.tsx
|
|
5039
|
-
import * as
|
|
5127
|
+
import * as React31 from "react";
|
|
5040
5128
|
import { useLocale as useLocale2 } from "react-aria-components";
|
|
5041
|
-
import { jsx as
|
|
5129
|
+
import { jsx as jsx74, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
5042
5130
|
var BASE_KEYS = [
|
|
5043
5131
|
{ value: "7" },
|
|
5044
5132
|
{ value: "8" },
|
|
@@ -5061,9 +5149,9 @@ function fittingDigits(digits, buffer, separator, maxFractionDigits) {
|
|
|
5061
5149
|
return room <= 0 ? "" : digits.slice(0, room);
|
|
5062
5150
|
}
|
|
5063
5151
|
function useNumPadKeyboard(onKey, isDisabled, containerRef) {
|
|
5064
|
-
const handler =
|
|
5152
|
+
const handler = React31.useRef(onKey);
|
|
5065
5153
|
handler.current = onKey;
|
|
5066
|
-
|
|
5154
|
+
React31.useEffect(() => {
|
|
5067
5155
|
if (isDisabled) return;
|
|
5068
5156
|
const isEditingElsewhere = () => {
|
|
5069
5157
|
const el = document.activeElement;
|
|
@@ -5110,11 +5198,11 @@ function NumPad({
|
|
|
5110
5198
|
style
|
|
5111
5199
|
}) {
|
|
5112
5200
|
const msg = usePireMessages();
|
|
5113
|
-
const containerRef =
|
|
5201
|
+
const containerRef = React31.useRef(null);
|
|
5114
5202
|
const { locale } = useLocale2();
|
|
5115
5203
|
const separator = decimalSeparatorFor(locale);
|
|
5116
5204
|
const allowsDecimal = maxFractionDigits !== void 0 && maxFractionDigits > 0;
|
|
5117
|
-
const applyKey =
|
|
5205
|
+
const applyKey = React31.useCallback(
|
|
5118
5206
|
(key) => {
|
|
5119
5207
|
if (isDisabled) return;
|
|
5120
5208
|
if (key.value === "backspace") {
|
|
@@ -5146,7 +5234,7 @@ function NumPad({
|
|
|
5146
5234
|
...allowsDecimal ? [{ value: "decimal", label: separator }] : [],
|
|
5147
5235
|
...extraKeys
|
|
5148
5236
|
];
|
|
5149
|
-
return /* @__PURE__ */
|
|
5237
|
+
return /* @__PURE__ */ jsxs63(
|
|
5150
5238
|
"div",
|
|
5151
5239
|
{
|
|
5152
5240
|
ref: containerRef,
|
|
@@ -5155,10 +5243,10 @@ function NumPad({
|
|
|
5155
5243
|
"data-size": size,
|
|
5156
5244
|
"data-disabled": isDisabled ? "true" : void 0,
|
|
5157
5245
|
children: [
|
|
5158
|
-
target !== void 0 ? /* @__PURE__ */
|
|
5159
|
-
/* @__PURE__ */
|
|
5246
|
+
target !== void 0 ? /* @__PURE__ */ jsx74("div", { className: "pire-numpad-target", role: "status", "aria-live": "polite", children: target }) : null,
|
|
5247
|
+
/* @__PURE__ */ jsx74("div", { className: "pire-numpad-grid", role: "group", "aria-label": ariaLabel, children: keys.map((key) => {
|
|
5160
5248
|
const accessibleLabel = key.value === "backspace" ? msg.numPadBackspace : key.value === "clear" ? msg.numPadClear : key.value === "decimal" ? msg.numPadDecimal : void 0;
|
|
5161
|
-
return /* @__PURE__ */
|
|
5249
|
+
return /* @__PURE__ */ jsx74(
|
|
5162
5250
|
Button,
|
|
5163
5251
|
{
|
|
5164
5252
|
variant: "secondary",
|
|
@@ -5181,9 +5269,9 @@ function NumPad({
|
|
|
5181
5269
|
}
|
|
5182
5270
|
|
|
5183
5271
|
// src/components/patterns/FileDropZone.tsx
|
|
5184
|
-
import * as
|
|
5272
|
+
import * as React32 from "react";
|
|
5185
5273
|
import { DropZone, FileTrigger as FileTrigger2, isFileDropItem } from "react-aria-components";
|
|
5186
|
-
import { jsx as
|
|
5274
|
+
import { jsx as jsx75, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
5187
5275
|
var isImage2 = (file) => file.type.startsWith("image/");
|
|
5188
5276
|
function FileDropZone({
|
|
5189
5277
|
label,
|
|
@@ -5211,10 +5299,10 @@ function FileDropZone({
|
|
|
5211
5299
|
...rest
|
|
5212
5300
|
}) {
|
|
5213
5301
|
const msg = usePireMessages();
|
|
5214
|
-
const [uncontrolled, setUncontrolled] =
|
|
5302
|
+
const [uncontrolled, setUncontrolled] = React32.useState(defaultValue ?? []);
|
|
5215
5303
|
const files = value ?? uncontrolled;
|
|
5216
|
-
const created =
|
|
5217
|
-
|
|
5304
|
+
const created = React32.useRef([]);
|
|
5305
|
+
React32.useEffect(
|
|
5218
5306
|
() => () => {
|
|
5219
5307
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
5220
5308
|
},
|
|
@@ -5237,12 +5325,12 @@ function FileDropZone({
|
|
|
5237
5325
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
5238
5326
|
};
|
|
5239
5327
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
5240
|
-
return /* @__PURE__ */
|
|
5241
|
-
label ? /* @__PURE__ */
|
|
5328
|
+
return /* @__PURE__ */ jsxs64("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
5329
|
+
label ? /* @__PURE__ */ jsxs64("span", { className: "pire-field-label", children: [
|
|
5242
5330
|
label,
|
|
5243
|
-
isRequired ? /* @__PURE__ */
|
|
5331
|
+
isRequired ? /* @__PURE__ */ jsx75("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
5244
5332
|
] }) : null,
|
|
5245
|
-
/* @__PURE__ */
|
|
5333
|
+
/* @__PURE__ */ jsxs64(
|
|
5246
5334
|
DropZone,
|
|
5247
5335
|
{
|
|
5248
5336
|
className: "pire-dropzone",
|
|
@@ -5254,25 +5342,25 @@ function FileDropZone({
|
|
|
5254
5342
|
accept(dropped);
|
|
5255
5343
|
},
|
|
5256
5344
|
children: [
|
|
5257
|
-
/* @__PURE__ */
|
|
5258
|
-
/* @__PURE__ */
|
|
5259
|
-
/* @__PURE__ */
|
|
5345
|
+
/* @__PURE__ */ jsx75(Icon, { name: "download", size: 24, className: "pire-dropzone-icon" }),
|
|
5346
|
+
/* @__PURE__ */ jsx75("span", { className: "pire-dropzone-prompt", children: promptLabel ?? msg.fileDropZonePrompt }),
|
|
5347
|
+
/* @__PURE__ */ jsx75(
|
|
5260
5348
|
FileTrigger2,
|
|
5261
5349
|
{
|
|
5262
5350
|
acceptedFileTypes,
|
|
5263
5351
|
allowsMultiple,
|
|
5264
5352
|
onSelect: (list) => accept(list ? [...list] : []),
|
|
5265
|
-
children: /* @__PURE__ */
|
|
5353
|
+
children: /* @__PURE__ */ jsx75(Button, { variant: "secondary", isDisabled: isDisabled || isReadOnly, children: msg.fileUploadChoose })
|
|
5266
5354
|
}
|
|
5267
5355
|
)
|
|
5268
5356
|
]
|
|
5269
5357
|
}
|
|
5270
5358
|
),
|
|
5271
|
-
files.length ? /* @__PURE__ */
|
|
5272
|
-
previewUrl ? /* @__PURE__ */
|
|
5273
|
-
/* @__PURE__ */
|
|
5274
|
-
/* @__PURE__ */
|
|
5275
|
-
isDisabled || isReadOnly ? null : /* @__PURE__ */
|
|
5359
|
+
files.length ? /* @__PURE__ */ jsx75("ul", { className: "pire-fileupload-list", children: files.map(({ file, previewUrl }) => /* @__PURE__ */ jsxs64("li", { className: "pire-fileupload-item", children: [
|
|
5360
|
+
previewUrl ? /* @__PURE__ */ jsx75("img", { className: "pire-fileupload-thumb", src: previewUrl, alt: "" }) : /* @__PURE__ */ jsx75(Icon, { name: "file-text", size: 16, className: "pire-fileupload-icon" }),
|
|
5361
|
+
/* @__PURE__ */ jsx75("span", { className: "pire-fileupload-name", children: file.name }),
|
|
5362
|
+
/* @__PURE__ */ jsx75("span", { className: "pire-fileupload-size", children: formatFileSize(file.size) }),
|
|
5363
|
+
isDisabled || isReadOnly ? null : /* @__PURE__ */ jsx75(
|
|
5276
5364
|
IconButton,
|
|
5277
5365
|
{
|
|
5278
5366
|
icon: "x",
|
|
@@ -5282,9 +5370,9 @@ function FileDropZone({
|
|
|
5282
5370
|
}
|
|
5283
5371
|
)
|
|
5284
5372
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
5285
|
-
uploadProgress != null ? /* @__PURE__ */
|
|
5286
|
-
description ? /* @__PURE__ */
|
|
5287
|
-
isInvalid && errorMessage ? /* @__PURE__ */
|
|
5373
|
+
uploadProgress != null ? /* @__PURE__ */ jsx75(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
5374
|
+
description ? /* @__PURE__ */ jsx75("span", { className: "pire-field-hint", children: description }) : null,
|
|
5375
|
+
isInvalid && errorMessage ? /* @__PURE__ */ jsx75("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
5288
5376
|
] });
|
|
5289
5377
|
}
|
|
5290
5378
|
|
|
@@ -5324,6 +5412,7 @@ export {
|
|
|
5324
5412
|
DialogTrigger2 as DialogTrigger,
|
|
5325
5413
|
DonutChart,
|
|
5326
5414
|
EmptyState,
|
|
5415
|
+
FieldHelp,
|
|
5327
5416
|
FileDropZone,
|
|
5328
5417
|
FileUpload,
|
|
5329
5418
|
FilterBar,
|