@orianatech/pire 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/Badge.d.cts +14 -3
- package/dist/components/core/Badge.d.ts +14 -3
- package/dist/components/core/Badge.d.ts.map +1 -1
- package/dist/components/core/Tag.d.cts +8 -3
- package/dist/components/core/Tag.d.ts +8 -3
- package/dist/components/core/Tag.d.ts.map +1 -1
- package/dist/components/core/Text.d.cts +9 -4
- package/dist/components/core/Text.d.ts +9 -4
- package/dist/components/core/Text.d.ts.map +1 -1
- package/dist/components/data/DataTable.d.cts +9 -1
- package/dist/components/data/DataTable.d.ts +9 -1
- package/dist/components/data/DataTable.d.ts.map +1 -1
- package/dist/components/forms/ComboBox.d.cts +12 -2
- package/dist/components/forms/ComboBox.d.ts +12 -2
- package/dist/components/forms/ComboBox.d.ts.map +1 -1
- package/dist/components/forms/FileUpload.d.cts +10 -2
- package/dist/components/forms/FileUpload.d.ts +10 -2
- package/dist/components/forms/FileUpload.d.ts.map +1 -1
- package/dist/components/forms/NumberField.d.cts +17 -2
- package/dist/components/forms/NumberField.d.ts +17 -2
- package/dist/components/forms/NumberField.d.ts.map +1 -1
- package/dist/components/patterns/FileDropZone.d.cts +8 -1
- package/dist/components/patterns/FileDropZone.d.ts +8 -1
- package/dist/components/patterns/FileDropZone.d.ts.map +1 -1
- package/dist/i18n/messages.d.cts +2 -0
- package/dist/i18n/messages.d.ts +2 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +159 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +181 -113
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -461,6 +461,7 @@ var IconButton = React3.forwardRef(function IconButton2({
|
|
|
461
461
|
});
|
|
462
462
|
|
|
463
463
|
// src/components/core/Badge.tsx
|
|
464
|
+
import * as React4 from "react";
|
|
464
465
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
465
466
|
var STATUS_ICON = {
|
|
466
467
|
positive: "check-circle-2",
|
|
@@ -469,18 +470,19 @@ var STATUS_ICON = {
|
|
|
469
470
|
informative: "info",
|
|
470
471
|
neutral: "circle"
|
|
471
472
|
};
|
|
472
|
-
|
|
473
|
-
return /* @__PURE__ */ jsxs4("span", { className: cx("pire-badge", className), "data-status": status, ...rest, children: [
|
|
473
|
+
var Badge = React4.forwardRef(function Badge2({ children, status = "neutral", showIcon = true, className, ...rest }, ref) {
|
|
474
|
+
return /* @__PURE__ */ jsxs4("span", { ref, className: cx("pire-badge", className), "data-status": status, ...rest, children: [
|
|
474
475
|
showIcon ? /* @__PURE__ */ jsx5(Icon, { name: STATUS_ICON[status], size: 12 }) : null,
|
|
475
476
|
children
|
|
476
477
|
] });
|
|
477
|
-
}
|
|
478
|
+
});
|
|
478
479
|
|
|
479
480
|
// src/components/core/Tag.tsx
|
|
481
|
+
import * as React5 from "react";
|
|
480
482
|
import { Button as AriaButton3 } from "react-aria-components";
|
|
481
483
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
482
|
-
|
|
483
|
-
return /* @__PURE__ */ jsxs5("span", { className: cx("pire-tag", className), "data-disabled": isDisabled ? "true" : void 0, ...rest, children: [
|
|
484
|
+
var Tag = React5.forwardRef(function Tag2({ children, onRemove, isDisabled, category, className, ...rest }, ref) {
|
|
485
|
+
return /* @__PURE__ */ jsxs5("span", { ref, className: cx("pire-tag", className), "data-disabled": isDisabled ? "true" : void 0, ...rest, children: [
|
|
484
486
|
category ? /* @__PURE__ */ jsx6("span", { className: "pire-tag-swatch", "data-category": category, "aria-hidden": "true" }) : null,
|
|
485
487
|
children,
|
|
486
488
|
onRemove ? /* @__PURE__ */ jsx6(
|
|
@@ -494,7 +496,7 @@ function Tag({ children, onRemove, isDisabled, category, className, ...rest }) {
|
|
|
494
496
|
}
|
|
495
497
|
) : null
|
|
496
498
|
] });
|
|
497
|
-
}
|
|
499
|
+
});
|
|
498
500
|
|
|
499
501
|
// src/components/core/Card.tsx
|
|
500
502
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -514,11 +516,11 @@ function Card({ title, subtitle, icon, actions, footer, interactive, children, c
|
|
|
514
516
|
}
|
|
515
517
|
|
|
516
518
|
// src/components/core/Avatar.tsx
|
|
517
|
-
import * as
|
|
519
|
+
import * as React6 from "react";
|
|
518
520
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
519
521
|
var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
520
522
|
function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
521
|
-
const [failed, setFailed] =
|
|
523
|
+
const [failed, setFailed] = React6.useState(false);
|
|
522
524
|
return /* @__PURE__ */ jsx8("span", { className: cx("pire-avatar", className), "data-size": size, role: "img", "aria-label": name, ...rest, children: src && !failed ? /* @__PURE__ */ jsx8(
|
|
523
525
|
"img",
|
|
524
526
|
{
|
|
@@ -531,7 +533,7 @@ function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
|
531
533
|
}
|
|
532
534
|
|
|
533
535
|
// src/components/core/SegmentedControl.tsx
|
|
534
|
-
import * as
|
|
536
|
+
import * as React7 from "react";
|
|
535
537
|
import { ToggleButtonGroup, ToggleButton } from "react-aria-components";
|
|
536
538
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
537
539
|
function SegmentedControl({
|
|
@@ -545,7 +547,7 @@ function SegmentedControl({
|
|
|
545
547
|
style,
|
|
546
548
|
...rest
|
|
547
549
|
}) {
|
|
548
|
-
const selected =
|
|
550
|
+
const selected = React7.useMemo(() => new Set(value ? [value] : defaultValue ? [defaultValue] : []), [value, defaultValue]);
|
|
549
551
|
return /* @__PURE__ */ jsx9(
|
|
550
552
|
ToggleButtonGroup,
|
|
551
553
|
{
|
|
@@ -579,8 +581,9 @@ function SegmentedControl({
|
|
|
579
581
|
}
|
|
580
582
|
|
|
581
583
|
// src/components/core/Text.tsx
|
|
584
|
+
import * as React8 from "react";
|
|
582
585
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
583
|
-
|
|
586
|
+
var Text = React8.forwardRef(function Text2({
|
|
584
587
|
size = "body",
|
|
585
588
|
color = "primary",
|
|
586
589
|
weight = "regular",
|
|
@@ -591,12 +594,13 @@ function Text({
|
|
|
591
594
|
className,
|
|
592
595
|
style,
|
|
593
596
|
...rest
|
|
594
|
-
}) {
|
|
597
|
+
}, ref) {
|
|
595
598
|
const lineClamp = typeof truncate === "number" ? truncate : truncate ? 1 : void 0;
|
|
596
599
|
const clampStyle = lineClamp == null ? style : { ["--pire-text-clamp"]: lineClamp, ...style };
|
|
597
600
|
return /* @__PURE__ */ jsx10(
|
|
598
601
|
Wrapper,
|
|
599
602
|
{
|
|
603
|
+
ref,
|
|
600
604
|
className: cx("pire-text", className),
|
|
601
605
|
"data-size": size,
|
|
602
606
|
"data-color": color,
|
|
@@ -608,10 +612,10 @@ function Text({
|
|
|
608
612
|
...rest
|
|
609
613
|
}
|
|
610
614
|
);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
return /* @__PURE__ */ jsx10(Text, { elementType: "span", weight: "strong", className, ...rest });
|
|
614
|
-
}
|
|
615
|
+
});
|
|
616
|
+
var Strong = React8.forwardRef(function Strong2({ className, ...rest }, ref) {
|
|
617
|
+
return /* @__PURE__ */ jsx10(Text, { ref, elementType: "span", weight: "strong", className, ...rest });
|
|
618
|
+
});
|
|
615
619
|
|
|
616
620
|
// src/components/core/Heading.tsx
|
|
617
621
|
import { Heading as AriaHeading } from "react-aria-components";
|
|
@@ -707,19 +711,19 @@ function FormField({ label, htmlFor, isRequired, hint, error, layout = "stacked"
|
|
|
707
711
|
}
|
|
708
712
|
|
|
709
713
|
// src/components/forms/Input.tsx
|
|
710
|
-
import * as
|
|
714
|
+
import * as React10 from "react";
|
|
711
715
|
import {
|
|
712
716
|
TextField,
|
|
713
717
|
Label,
|
|
714
718
|
Input as AriaInput,
|
|
715
719
|
Group,
|
|
716
|
-
Text as
|
|
720
|
+
Text as Text3,
|
|
717
721
|
FieldError,
|
|
718
722
|
Button as AriaButton4
|
|
719
723
|
} from "react-aria-components";
|
|
720
724
|
|
|
721
725
|
// src/i18n/PireIntlProvider.tsx
|
|
722
|
-
import * as
|
|
726
|
+
import * as React9 from "react";
|
|
723
727
|
|
|
724
728
|
// src/i18n/messages.ts
|
|
725
729
|
var enMessages = {
|
|
@@ -730,6 +734,7 @@ var enMessages = {
|
|
|
730
734
|
dataTableSelectRow: "Select row",
|
|
731
735
|
dataTableLoading: "Loading records",
|
|
732
736
|
dataTableSummaryRow: "Summary",
|
|
737
|
+
dataTableEmpty: "No records match the current filters.",
|
|
733
738
|
dialogClose: "Close",
|
|
734
739
|
sidePanelClose: "Close panel",
|
|
735
740
|
inlineMessageDismiss: "Dismiss message",
|
|
@@ -789,6 +794,7 @@ var esMessages = {
|
|
|
789
794
|
dataTableSelectRow: "Seleccionar fila",
|
|
790
795
|
dataTableLoading: "Cargando registros",
|
|
791
796
|
dataTableSummaryRow: "Resumen",
|
|
797
|
+
dataTableEmpty: "Ning\xFAn registro coincide con los filtros actuales.",
|
|
792
798
|
dialogClose: "Cerrar",
|
|
793
799
|
sidePanelClose: "Cerrar panel",
|
|
794
800
|
inlineMessageDismiss: "Descartar mensaje",
|
|
@@ -843,19 +849,19 @@ var esMessages = {
|
|
|
843
849
|
|
|
844
850
|
// src/i18n/PireIntlProvider.tsx
|
|
845
851
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
846
|
-
var MessagesContext =
|
|
852
|
+
var MessagesContext = React9.createContext(enMessages);
|
|
847
853
|
function PireIntlProvider({ messages, children }) {
|
|
848
|
-
const value =
|
|
854
|
+
const value = React9.useMemo(
|
|
849
855
|
() => messages ? { ...enMessages, ...messages } : enMessages,
|
|
850
856
|
[messages]
|
|
851
857
|
);
|
|
852
858
|
return /* @__PURE__ */ jsx16(MessagesContext.Provider, { value, children });
|
|
853
859
|
}
|
|
854
860
|
function usePireMessages() {
|
|
855
|
-
return
|
|
861
|
+
return React9.useContext(MessagesContext);
|
|
856
862
|
}
|
|
857
863
|
function useMessage(key, override) {
|
|
858
|
-
const messages =
|
|
864
|
+
const messages = React9.useContext(MessagesContext);
|
|
859
865
|
return override ?? messages[key];
|
|
860
866
|
}
|
|
861
867
|
|
|
@@ -880,7 +886,7 @@ function Input({
|
|
|
880
886
|
}) {
|
|
881
887
|
const msg = usePireMessages();
|
|
882
888
|
const isControlled = rest.value !== void 0;
|
|
883
|
-
const [ownValue, setOwnValue] =
|
|
889
|
+
const [ownValue, setOwnValue] = React10.useState(rest.defaultValue ?? "");
|
|
884
890
|
const currentValue = isControlled ? rest.value : ownValue;
|
|
885
891
|
const handleChange = (next) => {
|
|
886
892
|
setOwnValue(next);
|
|
@@ -919,7 +925,7 @@ function Input({
|
|
|
919
925
|
]
|
|
920
926
|
}
|
|
921
927
|
),
|
|
922
|
-
description ? /* @__PURE__ */ jsx17(
|
|
928
|
+
description ? /* @__PURE__ */ jsx17(Text3, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
923
929
|
/* @__PURE__ */ jsx17(FieldError, { className: "pire-field-error", children: errorMessage })
|
|
924
930
|
]
|
|
925
931
|
}
|
|
@@ -927,10 +933,10 @@ function Input({
|
|
|
927
933
|
}
|
|
928
934
|
|
|
929
935
|
// src/components/forms/TextArea.tsx
|
|
930
|
-
import * as
|
|
931
|
-
import { TextField as TextField2, Label as Label2, TextArea as AriaTextArea, Group as Group2, Text as
|
|
936
|
+
import * as React11 from "react";
|
|
937
|
+
import { TextField as TextField2, Label as Label2, TextArea as AriaTextArea, Group as Group2, Text as Text4, FieldError as FieldError2 } from "react-aria-components";
|
|
932
938
|
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
933
|
-
var useIsomorphicLayoutEffect = typeof document === "undefined" ?
|
|
939
|
+
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React11.useEffect : React11.useLayoutEffect;
|
|
934
940
|
function TextArea({
|
|
935
941
|
label,
|
|
936
942
|
description,
|
|
@@ -946,13 +952,13 @@ function TextArea({
|
|
|
946
952
|
onChange,
|
|
947
953
|
...rest
|
|
948
954
|
}) {
|
|
949
|
-
const innerRef =
|
|
950
|
-
const ref =
|
|
955
|
+
const innerRef = React11.useRef(null);
|
|
956
|
+
const ref = React11.useCallback((node) => {
|
|
951
957
|
innerRef.current = node;
|
|
952
958
|
if (typeof textAreaRef === "function") textAreaRef(node);
|
|
953
959
|
else if (textAreaRef) textAreaRef.current = node;
|
|
954
960
|
}, [textAreaRef]);
|
|
955
|
-
const grow =
|
|
961
|
+
const grow = React11.useCallback(() => {
|
|
956
962
|
const el = innerRef.current;
|
|
957
963
|
if (!el || !autoGrow) return;
|
|
958
964
|
const styles = getComputedStyle(el);
|
|
@@ -1004,7 +1010,7 @@ function TextArea({
|
|
|
1004
1010
|
)
|
|
1005
1011
|
}
|
|
1006
1012
|
),
|
|
1007
|
-
description ? /* @__PURE__ */ jsx18(
|
|
1013
|
+
description ? /* @__PURE__ */ jsx18(Text4, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1008
1014
|
/* @__PURE__ */ jsx18(FieldError2, { className: "pire-field-error", children: errorMessage })
|
|
1009
1015
|
]
|
|
1010
1016
|
}
|
|
@@ -1020,7 +1026,7 @@ import {
|
|
|
1020
1026
|
Popover,
|
|
1021
1027
|
ListBox,
|
|
1022
1028
|
ListBoxItem,
|
|
1023
|
-
Text as
|
|
1029
|
+
Text as Text5,
|
|
1024
1030
|
FieldError as FieldError3
|
|
1025
1031
|
} from "react-aria-components";
|
|
1026
1032
|
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -1073,7 +1079,7 @@ function Select({
|
|
|
1073
1079
|
]
|
|
1074
1080
|
}
|
|
1075
1081
|
),
|
|
1076
|
-
description ? /* @__PURE__ */ jsx19(
|
|
1082
|
+
description ? /* @__PURE__ */ jsx19(Text5, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1077
1083
|
/* @__PURE__ */ jsx19(FieldError3, { className: "pire-field-error", children: errorMessage }),
|
|
1078
1084
|
/* @__PURE__ */ jsx19(Popover, { className: "pire-popover", children: /* @__PURE__ */ jsx19(
|
|
1079
1085
|
ListBox,
|
|
@@ -1107,7 +1113,7 @@ import {
|
|
|
1107
1113
|
RadioGroup as AriaRadioGroup,
|
|
1108
1114
|
Radio as AriaRadio,
|
|
1109
1115
|
Label as Label4,
|
|
1110
|
-
Text as
|
|
1116
|
+
Text as Text6,
|
|
1111
1117
|
FieldError as FieldError4
|
|
1112
1118
|
} from "react-aria-components";
|
|
1113
1119
|
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
@@ -1115,7 +1121,7 @@ function RadioGroup({ label, description, errorMessage, children, className, ...
|
|
|
1115
1121
|
return /* @__PURE__ */ jsxs14(AriaRadioGroup, { className: cx("pire-field", className), validationBehavior: "aria", ...rest, children: [
|
|
1116
1122
|
label ? /* @__PURE__ */ jsx21(Label4, { className: "pire-field-label", children: label }) : null,
|
|
1117
1123
|
/* @__PURE__ */ jsx21("div", { className: "pire-radiogroup", children }),
|
|
1118
|
-
description ? /* @__PURE__ */ jsx21(
|
|
1124
|
+
description ? /* @__PURE__ */ jsx21(Text6, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1119
1125
|
/* @__PURE__ */ jsx21(FieldError4, { className: "pire-field-error", children: errorMessage })
|
|
1120
1126
|
] });
|
|
1121
1127
|
}
|
|
@@ -1140,6 +1146,7 @@ function Switch({ label, children, className, ...rest }) {
|
|
|
1140
1146
|
}
|
|
1141
1147
|
|
|
1142
1148
|
// src/components/forms/ComboBox.tsx
|
|
1149
|
+
import * as React12 from "react";
|
|
1143
1150
|
import {
|
|
1144
1151
|
ComboBox as AriaComboBox,
|
|
1145
1152
|
Label as Label5,
|
|
@@ -1149,7 +1156,7 @@ import {
|
|
|
1149
1156
|
Popover as Popover2,
|
|
1150
1157
|
ListBox as ListBox2,
|
|
1151
1158
|
ListBoxItem as ListBoxItem2,
|
|
1152
|
-
Text as
|
|
1159
|
+
Text as Text7,
|
|
1153
1160
|
FieldError as FieldError5
|
|
1154
1161
|
} from "react-aria-components";
|
|
1155
1162
|
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -1170,6 +1177,8 @@ function ComboBox({
|
|
|
1170
1177
|
isLoading,
|
|
1171
1178
|
loadingLabel,
|
|
1172
1179
|
emptyLabel,
|
|
1180
|
+
isClearable,
|
|
1181
|
+
clearLabel,
|
|
1173
1182
|
onLoadMore,
|
|
1174
1183
|
className,
|
|
1175
1184
|
style,
|
|
@@ -1177,6 +1186,23 @@ function ComboBox({
|
|
|
1177
1186
|
}) {
|
|
1178
1187
|
const msg = usePireMessages();
|
|
1179
1188
|
const items = options.map(norm2);
|
|
1189
|
+
const isSelectionControlled = value !== void 0;
|
|
1190
|
+
const [ownSelection, setOwnSelection] = React12.useState(defaultValue ?? null);
|
|
1191
|
+
const takesOverSelection = isClearable === true && !isSelectionControlled;
|
|
1192
|
+
const currentSelection = isSelectionControlled ? value : ownSelection;
|
|
1193
|
+
const [typedText, setTypedText] = React12.useState("");
|
|
1194
|
+
const currentText = inputValue !== void 0 ? inputValue : typedText;
|
|
1195
|
+
const handleInputChange = isClearable ? (text) => {
|
|
1196
|
+
setTypedText(text);
|
|
1197
|
+
onInputChange?.(text);
|
|
1198
|
+
} : onInputChange;
|
|
1199
|
+
const showsClear = isClearable && !rest.isDisabled && !rest.isReadOnly && (currentText !== "" || currentSelection != null);
|
|
1200
|
+
const clear = () => {
|
|
1201
|
+
setTypedText("");
|
|
1202
|
+
if (takesOverSelection) setOwnSelection(null);
|
|
1203
|
+
onChange?.(null);
|
|
1204
|
+
onInputChange?.("");
|
|
1205
|
+
};
|
|
1180
1206
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1181
1207
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1182
1208
|
return /* @__PURE__ */ jsxs16(
|
|
@@ -1184,14 +1210,16 @@ function ComboBox({
|
|
|
1184
1210
|
{
|
|
1185
1211
|
className: cx("pire-field", className),
|
|
1186
1212
|
style,
|
|
1187
|
-
selectedKey: value,
|
|
1188
|
-
defaultSelectedKey: defaultValue,
|
|
1213
|
+
selectedKey: takesOverSelection ? ownSelection : value,
|
|
1214
|
+
defaultSelectedKey: takesOverSelection ? void 0 : defaultValue,
|
|
1189
1215
|
onSelectionChange: (k) => {
|
|
1190
1216
|
if (isLoading) return;
|
|
1191
|
-
|
|
1217
|
+
const next = k == null ? null : String(k);
|
|
1218
|
+
if (takesOverSelection) setOwnSelection(next);
|
|
1219
|
+
onChange?.(next);
|
|
1192
1220
|
},
|
|
1193
1221
|
inputValue,
|
|
1194
|
-
onInputChange,
|
|
1222
|
+
onInputChange: handleInputChange,
|
|
1195
1223
|
...collection,
|
|
1196
1224
|
allowsEmptyCollection: isFilteredExternally || isLoading,
|
|
1197
1225
|
menuTrigger: "input",
|
|
@@ -1212,11 +1240,12 @@ function ComboBox({
|
|
|
1212
1240
|
children: [
|
|
1213
1241
|
/* @__PURE__ */ jsx23(Icon, { name: "search", size: 16, className: "pire-leading-icon" }),
|
|
1214
1242
|
/* @__PURE__ */ jsx23(AriaInput2, { className: "pire-input", placeholder: rest.placeholder }),
|
|
1243
|
+
showsClear ? /* @__PURE__ */ jsx23(AriaButton6, { className: "pire-input-clear", slot: null, onPress: clear, children: clearLabel ?? msg.inputClear }) : null,
|
|
1215
1244
|
/* @__PURE__ */ jsx23(AriaButton6, { className: "pire-iconbtn", "data-size": "sm", "aria-label": msg.comboBoxShowSuggestions, style: { width: 20, height: 20 }, children: /* @__PURE__ */ jsx23(Icon, { name: "chevron-down", size: 16 }) })
|
|
1216
1245
|
]
|
|
1217
1246
|
}
|
|
1218
1247
|
),
|
|
1219
|
-
description ? /* @__PURE__ */ jsx23(
|
|
1248
|
+
description ? /* @__PURE__ */ jsx23(Text7, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1220
1249
|
/* @__PURE__ */ jsx23(FieldError5, { className: "pire-field-error", children: errorMessage }),
|
|
1221
1250
|
/* @__PURE__ */ jsx23(Popover2, { className: "pire-popover", children: /* @__PURE__ */ jsx23(
|
|
1222
1251
|
ListBox2,
|
|
@@ -1239,7 +1268,7 @@ function ComboBox({
|
|
|
1239
1268
|
}
|
|
1240
1269
|
|
|
1241
1270
|
// src/components/forms/MultiComboBox.tsx
|
|
1242
|
-
import * as
|
|
1271
|
+
import * as React13 from "react";
|
|
1243
1272
|
import {
|
|
1244
1273
|
ComboBox as AriaComboBox2,
|
|
1245
1274
|
Label as Label6,
|
|
@@ -1250,7 +1279,7 @@ import {
|
|
|
1250
1279
|
Popover as Popover3,
|
|
1251
1280
|
ListBox as ListBox3,
|
|
1252
1281
|
ListBoxItem as ListBoxItem3,
|
|
1253
|
-
Text as
|
|
1282
|
+
Text as Text8,
|
|
1254
1283
|
FieldError as FieldError6,
|
|
1255
1284
|
VisuallyHidden
|
|
1256
1285
|
} from "react-aria-components";
|
|
@@ -1278,15 +1307,15 @@ function MultiComboBox({
|
|
|
1278
1307
|
...rest
|
|
1279
1308
|
}) {
|
|
1280
1309
|
const msg = usePireMessages();
|
|
1281
|
-
const items =
|
|
1310
|
+
const items = React13.useMemo(() => options.map(norm3), [options]);
|
|
1282
1311
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1283
1312
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1284
|
-
const [uncontrolled, setUncontrolled] =
|
|
1285
|
-
const [announcement, setAnnouncement] =
|
|
1286
|
-
const inputRef =
|
|
1313
|
+
const [uncontrolled, setUncontrolled] = React13.useState(defaultValue ?? []);
|
|
1314
|
+
const [announcement, setAnnouncement] = React13.useState("");
|
|
1315
|
+
const inputRef = React13.useRef(null);
|
|
1287
1316
|
const raw = value ?? uncontrolled;
|
|
1288
1317
|
const contentKey = raw.join("\0");
|
|
1289
|
-
const values =
|
|
1318
|
+
const values = React13.useMemo(() => raw, [contentKey]);
|
|
1290
1319
|
const labelOf = (v) => items.find((o) => o.value === v)?.label ?? v;
|
|
1291
1320
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1292
1321
|
const commit = (next) => {
|
|
@@ -1372,7 +1401,7 @@ function MultiComboBox({
|
|
|
1372
1401
|
}
|
|
1373
1402
|
),
|
|
1374
1403
|
/* @__PURE__ */ jsx24(VisuallyHidden, { children: /* @__PURE__ */ jsx24("span", { "aria-live": "polite", children: announcement }) }),
|
|
1375
|
-
description ? /* @__PURE__ */ jsx24(
|
|
1404
|
+
description ? /* @__PURE__ */ jsx24(Text8, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1376
1405
|
/* @__PURE__ */ jsx24(FieldError6, { className: "pire-field-error", children: errorMessage }),
|
|
1377
1406
|
/* @__PURE__ */ jsx24(Popover3, { className: "pire-popover", children: /* @__PURE__ */ jsx24(
|
|
1378
1407
|
ListBox3,
|
|
@@ -1401,10 +1430,23 @@ import {
|
|
|
1401
1430
|
Input as AriaInput4,
|
|
1402
1431
|
Group as Group5,
|
|
1403
1432
|
Button as AriaButton8,
|
|
1404
|
-
Text as
|
|
1405
|
-
FieldError as FieldError7
|
|
1433
|
+
Text as Text9,
|
|
1434
|
+
FieldError as FieldError7,
|
|
1435
|
+
useLocale
|
|
1406
1436
|
} from "react-aria-components";
|
|
1407
1437
|
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1438
|
+
function decimalSeparatorFor(locale) {
|
|
1439
|
+
return new Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".";
|
|
1440
|
+
}
|
|
1441
|
+
function typeIntoInput(el, text) {
|
|
1442
|
+
const start = el.selectionStart ?? el.value.length;
|
|
1443
|
+
const end = el.selectionEnd ?? start;
|
|
1444
|
+
const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
|
1445
|
+
setValue?.call(el, el.value.slice(0, start) + text + el.value.slice(end));
|
|
1446
|
+
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
1447
|
+
const caret = start + text.length;
|
|
1448
|
+
el.setSelectionRange(caret, caret);
|
|
1449
|
+
}
|
|
1408
1450
|
function NumberField({
|
|
1409
1451
|
label,
|
|
1410
1452
|
suffix,
|
|
@@ -1418,6 +1460,25 @@ function NumberField({
|
|
|
1418
1460
|
...rest
|
|
1419
1461
|
}) {
|
|
1420
1462
|
const msg = usePireMessages();
|
|
1463
|
+
const { locale } = useLocale();
|
|
1464
|
+
const handleDecimalKey = (event) => {
|
|
1465
|
+
if (event.key !== "." || event.ctrlKey || event.metaKey || event.altKey) {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
if (rest.isReadOnly || rest.isDisabled) {
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
const separator = decimalSeparatorFor(locale);
|
|
1472
|
+
if (separator === ".") {
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
const { maximumFractionDigits } = new Intl.NumberFormat(locale, rest.formatOptions).resolvedOptions();
|
|
1476
|
+
if (!maximumFractionDigits) {
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
event.preventDefault();
|
|
1480
|
+
typeIntoInput(event.currentTarget, separator);
|
|
1481
|
+
};
|
|
1421
1482
|
return /* @__PURE__ */ jsxs18(AriaNumberField, { className: cx("pire-field", className), style, validationBehavior: "aria", ...rest, children: [
|
|
1422
1483
|
label ? /* @__PURE__ */ jsxs18(Label7, { className: "pire-field-label", children: [
|
|
1423
1484
|
label,
|
|
@@ -1432,7 +1493,7 @@ function NumberField({
|
|
|
1432
1493
|
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1433
1494
|
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1434
1495
|
children: [
|
|
1435
|
-
/* @__PURE__ */ jsx25(AriaInput4, { className: "pire-input", "data-numeric": "true" }),
|
|
1496
|
+
/* @__PURE__ */ jsx25(AriaInput4, { className: "pire-input", "data-numeric": "true", onKeyDown: handleDecimalKey }),
|
|
1436
1497
|
suffix ? /* @__PURE__ */ jsx25("span", { className: "pire-affix", children: suffix }) : null,
|
|
1437
1498
|
hideStepper ? null : /* @__PURE__ */ jsxs18("span", { className: "pire-stepper", children: [
|
|
1438
1499
|
/* @__PURE__ */ jsx25(AriaButton8, { slot: "increment", className: "pire-stepper-btn", "aria-label": msg.numberFieldIncrease, children: /* @__PURE__ */ jsx25(Icon, { name: "plus", size: 10 }) }),
|
|
@@ -1441,7 +1502,7 @@ function NumberField({
|
|
|
1441
1502
|
]
|
|
1442
1503
|
}
|
|
1443
1504
|
),
|
|
1444
|
-
description ? /* @__PURE__ */ jsx25(
|
|
1505
|
+
description ? /* @__PURE__ */ jsx25(Text9, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1445
1506
|
/* @__PURE__ */ jsx25(FieldError7, { className: "pire-field-error", children: errorMessage })
|
|
1446
1507
|
] });
|
|
1447
1508
|
}
|
|
@@ -1463,7 +1524,7 @@ import {
|
|
|
1463
1524
|
CalendarGridBody,
|
|
1464
1525
|
CalendarCell,
|
|
1465
1526
|
Heading as Heading2,
|
|
1466
|
-
Text as
|
|
1527
|
+
Text as Text10,
|
|
1467
1528
|
FieldError as FieldError8
|
|
1468
1529
|
} from "react-aria-components";
|
|
1469
1530
|
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -1497,7 +1558,7 @@ function DatePicker({
|
|
|
1497
1558
|
]
|
|
1498
1559
|
}
|
|
1499
1560
|
),
|
|
1500
|
-
description ? /* @__PURE__ */ jsx26(
|
|
1561
|
+
description ? /* @__PURE__ */ jsx26(Text10, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1501
1562
|
/* @__PURE__ */ jsx26(FieldError8, { className: "pire-field-error", children: errorMessage }),
|
|
1502
1563
|
/* @__PURE__ */ jsx26(Popover4, { className: "pire-popover", children: /* @__PURE__ */ jsx26(AriaDialog, { children: /* @__PURE__ */ jsxs19(Calendar, { className: "pire-calendar", children: [
|
|
1503
1564
|
/* @__PURE__ */ jsxs19("header", { className: "pire-calendar-head", children: [
|
|
@@ -1530,7 +1591,7 @@ import {
|
|
|
1530
1591
|
CalendarGridBody as CalendarGridBody2,
|
|
1531
1592
|
CalendarCell as CalendarCell2,
|
|
1532
1593
|
Heading as Heading3,
|
|
1533
|
-
Text as
|
|
1594
|
+
Text as Text11,
|
|
1534
1595
|
FieldError as FieldError9
|
|
1535
1596
|
} from "react-aria-components";
|
|
1536
1597
|
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
@@ -1594,7 +1655,7 @@ function DateRangePicker({
|
|
|
1594
1655
|
]
|
|
1595
1656
|
}
|
|
1596
1657
|
),
|
|
1597
|
-
description ? /* @__PURE__ */ jsx27(
|
|
1658
|
+
description ? /* @__PURE__ */ jsx27(Text11, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1598
1659
|
/* @__PURE__ */ jsx27(FieldError9, { className: "pire-field-error", children: errorMessage }),
|
|
1599
1660
|
/* @__PURE__ */ jsx27(Popover5, { className: "pire-popover", children: /* @__PURE__ */ jsxs20(AriaDialog2, { className: "pire-daterange-dialog", children: [
|
|
1600
1661
|
presets?.length ? (
|
|
@@ -1646,13 +1707,13 @@ function DateRangePicker({
|
|
|
1646
1707
|
}
|
|
1647
1708
|
|
|
1648
1709
|
// src/components/forms/ValueHelpField.tsx
|
|
1649
|
-
import * as
|
|
1710
|
+
import * as React16 from "react";
|
|
1650
1711
|
|
|
1651
1712
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
1652
|
-
import * as
|
|
1713
|
+
import * as React15 from "react";
|
|
1653
1714
|
|
|
1654
1715
|
// src/components/feedback/Dialog.tsx
|
|
1655
|
-
import * as
|
|
1716
|
+
import * as React14 from "react";
|
|
1656
1717
|
import { ModalOverlay, Modal, Dialog as AriaDialog3, Heading as Heading4 } from "react-aria-components";
|
|
1657
1718
|
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1658
1719
|
function DialogTitle({ children, className }) {
|
|
@@ -1686,8 +1747,8 @@ function Dialog({
|
|
|
1686
1747
|
onClose?.();
|
|
1687
1748
|
onOpenChange?.(false);
|
|
1688
1749
|
};
|
|
1689
|
-
const parts =
|
|
1690
|
-
const slotOf = (type) => parts.find((node) =>
|
|
1750
|
+
const parts = React14.Children.toArray(children);
|
|
1751
|
+
const slotOf = (type) => parts.find((node) => React14.isValidElement(node) && node.type === type);
|
|
1691
1752
|
const titleSlot = slotOf(DialogTitle);
|
|
1692
1753
|
const descriptionSlot = slotOf(DialogDescription);
|
|
1693
1754
|
const bodySlot = slotOf(DialogBody);
|
|
@@ -1791,7 +1852,7 @@ function DataTable({
|
|
|
1791
1852
|
onSortChange,
|
|
1792
1853
|
onRowAction,
|
|
1793
1854
|
stickyHeader = true,
|
|
1794
|
-
emptyLabel
|
|
1855
|
+
emptyLabel,
|
|
1795
1856
|
isLoading,
|
|
1796
1857
|
loadingRowCount,
|
|
1797
1858
|
loadingLabel,
|
|
@@ -1804,6 +1865,8 @@ function DataTable({
|
|
|
1804
1865
|
...rest
|
|
1805
1866
|
}) {
|
|
1806
1867
|
const msg = usePireMessages();
|
|
1868
|
+
const selectionMode = selectable === true || selectable === "multiple" ? "multiple" : selectable === "single" ? "single" : "none";
|
|
1869
|
+
const hasCheckboxColumn = selectionMode === "multiple";
|
|
1807
1870
|
const sortDescriptor = sort ? { column: sort.key, direction: sort.dir === "asc" ? "ascending" : "descending" } : void 0;
|
|
1808
1871
|
const handleSelection = (keys) => {
|
|
1809
1872
|
if (keys === "all") return onSelectionChange?.(rows.map((r) => r.id));
|
|
@@ -1811,14 +1874,14 @@ function DataTable({
|
|
|
1811
1874
|
};
|
|
1812
1875
|
const skeletonRows = loadingRowCount ?? (rows.length || 5);
|
|
1813
1876
|
const skeletonColumns = [
|
|
1814
|
-
...
|
|
1877
|
+
...hasCheckboxColumn ? [{ width: 44 }] : [],
|
|
1815
1878
|
...columns.map((c) => ({ width: c.width, align: c.align, numeric: c.numeric }))
|
|
1816
1879
|
];
|
|
1817
1880
|
const body = isLoading ? [] : rows;
|
|
1818
1881
|
const presentation = new Map(rows.map((row) => [row.id, rowProps?.(row) ?? {}]));
|
|
1819
1882
|
const disabledKeys = rows.filter((row) => presentation.get(row.id)?.isDisabled).map((row) => row.id);
|
|
1820
1883
|
const expanded = new Set((expandedIds ?? []).map(String));
|
|
1821
|
-
const spanAll = columns.length + (
|
|
1884
|
+
const spanAll = columns.length + (hasCheckboxColumn ? 1 : 0);
|
|
1822
1885
|
const expandedKey = (id) => `${id}::__pire_expanded__`;
|
|
1823
1886
|
return /* @__PURE__ */ jsx30(
|
|
1824
1887
|
"div",
|
|
@@ -1835,7 +1898,7 @@ function DataTable({
|
|
|
1835
1898
|
"data-sticky": String(stickyHeader),
|
|
1836
1899
|
"aria-label": rest["aria-label"],
|
|
1837
1900
|
disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
|
|
1838
|
-
selectionMode
|
|
1901
|
+
selectionMode,
|
|
1839
1902
|
selectedKeys: selected ? new Set(selected) : void 0,
|
|
1840
1903
|
onSelectionChange: handleSelection,
|
|
1841
1904
|
sortDescriptor,
|
|
@@ -1846,13 +1909,13 @@ function DataTable({
|
|
|
1846
1909
|
} : void 0,
|
|
1847
1910
|
children: [
|
|
1848
1911
|
/* @__PURE__ */ jsxs22(TableHeader, { className: "pire-thead-row", children: [
|
|
1849
|
-
|
|
1912
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx30(Column, { className: "pire-th", width: 44, children: /* @__PURE__ */ jsx30(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectAll }) }) : null,
|
|
1850
1913
|
columns.map((c, i) => /* @__PURE__ */ jsx30(
|
|
1851
1914
|
Column,
|
|
1852
1915
|
{
|
|
1853
1916
|
id: c.key,
|
|
1854
1917
|
className: "pire-th",
|
|
1855
|
-
isRowHeader: i === 0 && !
|
|
1918
|
+
isRowHeader: i === 0 && !hasCheckboxColumn,
|
|
1856
1919
|
allowsSorting: c.sortable,
|
|
1857
1920
|
width: c.width,
|
|
1858
1921
|
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
@@ -1878,7 +1941,7 @@ function DataTable({
|
|
|
1878
1941
|
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
1879
1942
|
/* @__PURE__ */ jsx30(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
1880
1943
|
))
|
|
1881
|
-
] }) : /* @__PURE__ */ jsx30("div", { className: "pire-table-empty", children: emptyLabel }), children: body.flatMap((row) => {
|
|
1944
|
+
] }) : /* @__PURE__ */ jsx30("div", { className: "pire-table-empty", children: emptyLabel ?? msg.dataTableEmpty }), children: body.flatMap((row) => {
|
|
1882
1945
|
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
1883
1946
|
const record = /* @__PURE__ */ jsxs22(
|
|
1884
1947
|
Row,
|
|
@@ -1887,7 +1950,7 @@ function DataTable({
|
|
|
1887
1950
|
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
1888
1951
|
"data-pressable": onRowAction && !rowIsDisabled ? "true" : void 0,
|
|
1889
1952
|
children: [
|
|
1890
|
-
|
|
1953
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx30(Cell, { className: "pire-td", children: /* @__PURE__ */ jsx30(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
1891
1954
|
columns.map((c) => /* @__PURE__ */ jsx30(
|
|
1892
1955
|
Cell,
|
|
1893
1956
|
{
|
|
@@ -1906,14 +1969,14 @@ function DataTable({
|
|
|
1906
1969
|
return [record, /* @__PURE__ */ jsx30(Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ jsx30(Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))];
|
|
1907
1970
|
}) }),
|
|
1908
1971
|
footer && !isLoading ? /* @__PURE__ */ jsx30(TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ jsxs22(Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
1909
|
-
|
|
1972
|
+
hasCheckboxColumn ? /* @__PURE__ */ jsx30(Cell, { className: "pire-tf" }) : null,
|
|
1910
1973
|
columns.map((c, i) => /* @__PURE__ */ jsx30(
|
|
1911
1974
|
Cell,
|
|
1912
1975
|
{
|
|
1913
1976
|
className: "pire-tf",
|
|
1914
1977
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
1915
1978
|
style: { textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
1916
|
-
children: footer[c.key] ?? (i === 0 && !
|
|
1979
|
+
children: footer[c.key] ?? (i === 0 && !hasCheckboxColumn ? /* @__PURE__ */ jsx30("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
1917
1980
|
},
|
|
1918
1981
|
c.key
|
|
1919
1982
|
))
|
|
@@ -1942,11 +2005,11 @@ function ValueHelpDialog({
|
|
|
1942
2005
|
onClose
|
|
1943
2006
|
}) {
|
|
1944
2007
|
const msg = usePireMessages();
|
|
1945
|
-
const [query, setQuery] =
|
|
1946
|
-
|
|
2008
|
+
const [query, setQuery] = React15.useState("");
|
|
2009
|
+
React15.useEffect(() => {
|
|
1947
2010
|
if (isOpen) setQuery("");
|
|
1948
2011
|
}, [isOpen]);
|
|
1949
|
-
const filtered =
|
|
2012
|
+
const filtered = React15.useMemo(() => {
|
|
1950
2013
|
if (isFilteredExternally) return rows;
|
|
1951
2014
|
const q = query.trim().toLowerCase();
|
|
1952
2015
|
if (!q) return rows;
|
|
@@ -2028,7 +2091,7 @@ function ValueHelpField({
|
|
|
2028
2091
|
style
|
|
2029
2092
|
}) {
|
|
2030
2093
|
const msg = usePireMessages();
|
|
2031
|
-
const [open, setOpen] =
|
|
2094
|
+
const [open, setOpen] = React16.useState(false);
|
|
2032
2095
|
return /* @__PURE__ */ jsxs24("div", { className: cx(className), style, children: [
|
|
2033
2096
|
/* @__PURE__ */ jsx32(
|
|
2034
2097
|
Input,
|
|
@@ -2084,8 +2147,8 @@ function ValueHelpField({
|
|
|
2084
2147
|
}
|
|
2085
2148
|
|
|
2086
2149
|
// src/components/forms/FileUpload.tsx
|
|
2087
|
-
import * as
|
|
2088
|
-
import { FileTrigger, Text as
|
|
2150
|
+
import * as React17 from "react";
|
|
2151
|
+
import { FileTrigger, Text as Text12 } from "react-aria-components";
|
|
2089
2152
|
|
|
2090
2153
|
// src/components/feedback/ProgressBar.tsx
|
|
2091
2154
|
import { ProgressBar as AriaProgressBar, Label as Label10 } from "react-aria-components";
|
|
@@ -2171,13 +2234,14 @@ function FileUpload({
|
|
|
2171
2234
|
isRequired,
|
|
2172
2235
|
fullWidth = true,
|
|
2173
2236
|
className,
|
|
2174
|
-
style
|
|
2237
|
+
style,
|
|
2238
|
+
...rest
|
|
2175
2239
|
}) {
|
|
2176
2240
|
const msg = usePireMessages();
|
|
2177
|
-
const [uncontrolled, setUncontrolled] =
|
|
2241
|
+
const [uncontrolled, setUncontrolled] = React17.useState(defaultValue ?? []);
|
|
2178
2242
|
const files = value ?? uncontrolled;
|
|
2179
|
-
const created =
|
|
2180
|
-
|
|
2243
|
+
const created = React17.useRef([]);
|
|
2244
|
+
React17.useEffect(() => () => {
|
|
2181
2245
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
2182
2246
|
}, []);
|
|
2183
2247
|
const commit = (next) => {
|
|
@@ -2204,6 +2268,7 @@ function FileUpload({
|
|
|
2204
2268
|
style,
|
|
2205
2269
|
"data-full-width": String(fullWidth),
|
|
2206
2270
|
"data-invalid": isInvalid ? "true" : void 0,
|
|
2271
|
+
...rest,
|
|
2207
2272
|
children: [
|
|
2208
2273
|
label ? /* @__PURE__ */ jsxs26("span", { className: "pire-field-label", children: [
|
|
2209
2274
|
label,
|
|
@@ -2233,7 +2298,7 @@ function FileUpload({
|
|
|
2233
2298
|
)
|
|
2234
2299
|
] }, `${file.name}-${file.size}-${file.lastModified}`)) }) : null,
|
|
2235
2300
|
uploadProgress != null ? /* @__PURE__ */ jsx34(ProgressBar, { value: uploadProgress, label: msg.fileUploadUploading }) : null,
|
|
2236
|
-
description ? /* @__PURE__ */ jsx34(
|
|
2301
|
+
description ? /* @__PURE__ */ jsx34(Text12, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
2237
2302
|
isInvalid && errorMessage ? /* @__PURE__ */ jsx34("span", { className: "pire-field-error", children: errorMessage }) : null
|
|
2238
2303
|
]
|
|
2239
2304
|
}
|
|
@@ -2288,7 +2353,7 @@ function ShellBar({
|
|
|
2288
2353
|
}
|
|
2289
2354
|
|
|
2290
2355
|
// src/components/navigation/SideNav.tsx
|
|
2291
|
-
import * as
|
|
2356
|
+
import * as React18 from "react";
|
|
2292
2357
|
import {
|
|
2293
2358
|
Button as AriaButton12,
|
|
2294
2359
|
Disclosure,
|
|
@@ -2388,10 +2453,10 @@ function SideNav({
|
|
|
2388
2453
|
const msg = usePireMessages();
|
|
2389
2454
|
const activeParent = findActiveParent(groups, value);
|
|
2390
2455
|
const isControlled = expandedIds != null;
|
|
2391
|
-
const [ownExpanded, setOwnExpanded] =
|
|
2456
|
+
const [ownExpanded, setOwnExpanded] = React18.useState(
|
|
2392
2457
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
2393
2458
|
);
|
|
2394
|
-
const [lastValue, setLastValue] =
|
|
2459
|
+
const [lastValue, setLastValue] = React18.useState(value);
|
|
2395
2460
|
if (value !== lastValue) {
|
|
2396
2461
|
setLastValue(value);
|
|
2397
2462
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -2655,7 +2720,7 @@ function InlineMessage({ kind = "info", title, action, onClose, children, classN
|
|
|
2655
2720
|
}
|
|
2656
2721
|
|
|
2657
2722
|
// src/components/feedback/Toast.tsx
|
|
2658
|
-
import * as
|
|
2723
|
+
import * as React19 from "react";
|
|
2659
2724
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2660
2725
|
var KIND_ICON2 = {
|
|
2661
2726
|
info: "info",
|
|
@@ -2681,26 +2746,26 @@ function Toast({ kind = "success", onClose, position = "bottom-center", children
|
|
|
2681
2746
|
}
|
|
2682
2747
|
);
|
|
2683
2748
|
}
|
|
2684
|
-
var ToastContext =
|
|
2749
|
+
var ToastContext = React19.createContext(null);
|
|
2685
2750
|
function ToastProvider({ children, timeout = 6e3 }) {
|
|
2686
2751
|
const msg = usePireMessages();
|
|
2687
|
-
const [toasts, setToasts] =
|
|
2688
|
-
const close =
|
|
2689
|
-
const add =
|
|
2752
|
+
const [toasts, setToasts] = React19.useState([]);
|
|
2753
|
+
const close = React19.useCallback((id) => setToasts((t) => t.filter((x) => x.id !== id)), []);
|
|
2754
|
+
const add = React19.useCallback((toast) => {
|
|
2690
2755
|
const id = Math.random().toString(36).slice(2);
|
|
2691
2756
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
2692
2757
|
const ms = toast.timeout ?? timeout;
|
|
2693
2758
|
if (ms > 0) setTimeout(() => close(id), ms);
|
|
2694
2759
|
return id;
|
|
2695
2760
|
}, [close, timeout]);
|
|
2696
|
-
const value =
|
|
2761
|
+
const value = React19.useMemo(() => ({ add, close }), [add, close]);
|
|
2697
2762
|
return /* @__PURE__ */ jsxs34(ToastContext.Provider, { value, children: [
|
|
2698
2763
|
children,
|
|
2699
2764
|
/* @__PURE__ */ jsx42("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ jsx42(Toast, { kind: t.kind, onClose: () => close(t.id), style: { position: "static", transform: "none" }, children: t.message }, t.id)) })
|
|
2700
2765
|
] });
|
|
2701
2766
|
}
|
|
2702
2767
|
function useToast() {
|
|
2703
|
-
const ctx =
|
|
2768
|
+
const ctx = React19.useContext(ToastContext);
|
|
2704
2769
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
2705
2770
|
return ctx;
|
|
2706
2771
|
}
|
|
@@ -3050,14 +3115,14 @@ function BarChart({
|
|
|
3050
3115
|
}
|
|
3051
3116
|
|
|
3052
3117
|
// src/components/data/LineChart.tsx
|
|
3053
|
-
import * as
|
|
3118
|
+
import * as React20 from "react";
|
|
3054
3119
|
import { jsx as jsx50, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3055
3120
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
3056
3121
|
var MARKER_LIMIT = 20;
|
|
3057
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
3122
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React20.useEffect : React20.useLayoutEffect;
|
|
3058
3123
|
function useMeasuredWidth() {
|
|
3059
|
-
const ref =
|
|
3060
|
-
const [width, setWidth] =
|
|
3124
|
+
const ref = React20.useRef(null);
|
|
3125
|
+
const [width, setWidth] = React20.useState(0);
|
|
3061
3126
|
useIsomorphicLayoutEffect2(() => {
|
|
3062
3127
|
const element = ref.current;
|
|
3063
3128
|
if (!element) return;
|
|
@@ -3220,7 +3285,7 @@ function LineChart({
|
|
|
3220
3285
|
}
|
|
3221
3286
|
|
|
3222
3287
|
// src/components/data/DonutChart.tsx
|
|
3223
|
-
import * as
|
|
3288
|
+
import * as React21 from "react";
|
|
3224
3289
|
import { jsx as jsx51, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3225
3290
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
3226
3291
|
function DonutChart({
|
|
@@ -3241,7 +3306,7 @@ function DonutChart({
|
|
|
3241
3306
|
}) {
|
|
3242
3307
|
const label = rest["aria-label"];
|
|
3243
3308
|
const msg = usePireMessages();
|
|
3244
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
3309
|
+
const [hoveredIndex, setHoveredIndex] = React21.useState(null);
|
|
3245
3310
|
warnOnDonutShape(series, categories.length, label);
|
|
3246
3311
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
3247
3312
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -3478,7 +3543,7 @@ function ConfirmDialog({
|
|
|
3478
3543
|
}
|
|
3479
3544
|
|
|
3480
3545
|
// src/components/patterns/CommandPalette.tsx
|
|
3481
|
-
import * as
|
|
3546
|
+
import * as React22 from "react";
|
|
3482
3547
|
import {
|
|
3483
3548
|
Autocomplete,
|
|
3484
3549
|
ModalOverlay as ModalOverlay2,
|
|
@@ -3512,17 +3577,17 @@ function CommandPalette({
|
|
|
3512
3577
|
style
|
|
3513
3578
|
}) {
|
|
3514
3579
|
const msg = usePireMessages();
|
|
3515
|
-
const [query, setQuery] =
|
|
3580
|
+
const [query, setQuery] = React22.useState("");
|
|
3516
3581
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
3517
|
-
|
|
3582
|
+
React22.useEffect(() => {
|
|
3518
3583
|
if (isOpen) setQuery("");
|
|
3519
3584
|
}, [isOpen]);
|
|
3520
|
-
const searchableById =
|
|
3585
|
+
const searchableById = React22.useMemo(() => {
|
|
3521
3586
|
const byId = /* @__PURE__ */ new Map();
|
|
3522
3587
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
3523
3588
|
return byId;
|
|
3524
3589
|
}, [groups]);
|
|
3525
|
-
const filter =
|
|
3590
|
+
const filter = React22.useCallback((textValue, inputValue, node) => {
|
|
3526
3591
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
3527
3592
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
3528
3593
|
}, [contains, searchableById]);
|
|
@@ -3605,9 +3670,9 @@ function CommandPalette({
|
|
|
3605
3670
|
);
|
|
3606
3671
|
}
|
|
3607
3672
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
3608
|
-
const handler =
|
|
3673
|
+
const handler = React22.useRef(onTrigger);
|
|
3609
3674
|
handler.current = onTrigger;
|
|
3610
|
-
|
|
3675
|
+
React22.useEffect(() => {
|
|
3611
3676
|
if (isDisabled) return;
|
|
3612
3677
|
const onKeyDown = (event) => {
|
|
3613
3678
|
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
@@ -3661,7 +3726,7 @@ function EmptyState({ icon = "file-text", title, action, compact, children, clas
|
|
|
3661
3726
|
}
|
|
3662
3727
|
|
|
3663
3728
|
// src/components/patterns/FileDropZone.tsx
|
|
3664
|
-
import * as
|
|
3729
|
+
import * as React23 from "react";
|
|
3665
3730
|
import { DropZone, FileTrigger as FileTrigger2, isFileDropItem } from "react-aria-components";
|
|
3666
3731
|
import { jsx as jsx63, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
3667
3732
|
var isImage2 = (file) => file.type.startsWith("image/");
|
|
@@ -3686,13 +3751,15 @@ function FileDropZone({
|
|
|
3686
3751
|
isRequired,
|
|
3687
3752
|
fullWidth = true,
|
|
3688
3753
|
className,
|
|
3689
|
-
style
|
|
3754
|
+
style,
|
|
3755
|
+
"aria-label": ariaLabel,
|
|
3756
|
+
...rest
|
|
3690
3757
|
}) {
|
|
3691
3758
|
const msg = usePireMessages();
|
|
3692
|
-
const [uncontrolled, setUncontrolled] =
|
|
3759
|
+
const [uncontrolled, setUncontrolled] = React23.useState(defaultValue ?? []);
|
|
3693
3760
|
const files = value ?? uncontrolled;
|
|
3694
|
-
const created =
|
|
3695
|
-
|
|
3761
|
+
const created = React23.useRef([]);
|
|
3762
|
+
React23.useEffect(() => () => {
|
|
3696
3763
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
3697
3764
|
}, []);
|
|
3698
3765
|
const commit = (next) => {
|
|
@@ -3712,7 +3779,7 @@ function FileDropZone({
|
|
|
3712
3779
|
commit(allowsMultiple ? [...files, ...wrapped] : wrapped.slice(0, 1));
|
|
3713
3780
|
};
|
|
3714
3781
|
const remove = (target) => commit(files.filter((f) => f.file !== target));
|
|
3715
|
-
return /* @__PURE__ */ jsxs54("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), children: [
|
|
3782
|
+
return /* @__PURE__ */ jsxs54("div", { className: cx("pire-field", className), style, "data-full-width": String(fullWidth), ...rest, children: [
|
|
3716
3783
|
label ? /* @__PURE__ */ jsxs54("span", { className: "pire-field-label", children: [
|
|
3717
3784
|
label,
|
|
3718
3785
|
isRequired ? /* @__PURE__ */ jsx63("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
@@ -3721,6 +3788,7 @@ function FileDropZone({
|
|
|
3721
3788
|
DropZone,
|
|
3722
3789
|
{
|
|
3723
3790
|
className: "pire-dropzone",
|
|
3791
|
+
"aria-label": ariaLabel,
|
|
3724
3792
|
"data-height": height,
|
|
3725
3793
|
isDisabled: isDisabled || isReadOnly,
|
|
3726
3794
|
onDrop: async (e) => {
|