@orianatech/pire 0.15.0 → 0.17.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/data/DataTable.d.cts +36 -1
- package/dist/components/data/DataTable.d.ts +36 -1
- package/dist/components/data/DataTable.d.ts.map +1 -1
- package/dist/components/feedback/Dialog.d.cts +14 -1
- package/dist/components/feedback/Dialog.d.ts +14 -1
- package/dist/components/feedback/Dialog.d.ts.map +1 -1
- package/dist/components/feedback/Tooltip.d.cts +14 -2
- package/dist/components/feedback/Tooltip.d.ts +14 -2
- package/dist/components/feedback/Tooltip.d.ts.map +1 -1
- package/dist/components/forms/Input.d.cts +20 -2
- package/dist/components/forms/Input.d.ts +20 -2
- package/dist/components/forms/Input.d.ts.map +1 -1
- package/dist/components/patterns/ValueHelpDialog.d.ts.map +1 -1
- package/dist/components.css +48 -10
- package/dist/i18n/messages.d.cts +4 -0
- package/dist/i18n/messages.d.ts +4 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +298 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +340 -240
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,12 +45,17 @@ __export(src_exports, {
|
|
|
45
45
|
DateRangePicker: () => DateRangePicker,
|
|
46
46
|
DescriptionList: () => DescriptionList,
|
|
47
47
|
Dialog: () => Dialog,
|
|
48
|
+
DialogActions: () => DialogActions,
|
|
49
|
+
DialogBody: () => DialogBody,
|
|
50
|
+
DialogDescription: () => DialogDescription,
|
|
51
|
+
DialogTitle: () => DialogTitle,
|
|
48
52
|
DialogTrigger: () => import_react_aria_components34.DialogTrigger,
|
|
49
53
|
DonutChart: () => DonutChart,
|
|
50
54
|
EmptyState: () => EmptyState,
|
|
51
55
|
FileDropZone: () => FileDropZone,
|
|
52
56
|
FileUpload: () => FileUpload,
|
|
53
57
|
FilterBar: () => FilterBar,
|
|
58
|
+
Focusable: () => import_react_aria_components35.Focusable,
|
|
54
59
|
FooterBar: () => FooterBar,
|
|
55
60
|
FormField: () => FormField,
|
|
56
61
|
Heading: () => Heading,
|
|
@@ -524,15 +529,17 @@ var Button = React.forwardRef(function Button2({ children, variant = "secondary"
|
|
|
524
529
|
});
|
|
525
530
|
|
|
526
531
|
// src/components/core/IconButton.tsx
|
|
527
|
-
var
|
|
532
|
+
var React3 = __toESM(require("react"), 1);
|
|
528
533
|
var import_react_aria_components3 = require("react-aria-components");
|
|
529
534
|
|
|
530
535
|
// src/components/feedback/Tooltip.tsx
|
|
536
|
+
var React2 = __toESM(require("react"), 1);
|
|
531
537
|
var import_react_aria_components2 = require("react-aria-components");
|
|
532
538
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
533
539
|
function Tooltip({ label, placement = "top", delay = 500, children }) {
|
|
540
|
+
const target = React2.isValidElement(children) ? React2.cloneElement(children, { className: cx(children.props.className, "pire-tooltip-target") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pire-tooltip-target", children });
|
|
534
541
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_aria_components2.TooltipTrigger, { delay, closeDelay: 0, children: [
|
|
535
|
-
children,
|
|
542
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_aria_components2.Focusable, { children: target }),
|
|
536
543
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_aria_components2.Tooltip, { className: "pire-tooltip", placement, offset: 6, children: [
|
|
537
544
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_aria_components2.OverlayArrow, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {}) }),
|
|
538
545
|
label
|
|
@@ -542,7 +549,7 @@ function Tooltip({ label, placement = "top", delay = 500, children }) {
|
|
|
542
549
|
|
|
543
550
|
// src/components/core/IconButton.tsx
|
|
544
551
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
545
|
-
var IconButton =
|
|
552
|
+
var IconButton = React3.forwardRef(function IconButton2({
|
|
546
553
|
icon,
|
|
547
554
|
label,
|
|
548
555
|
size = "md",
|
|
@@ -630,11 +637,11 @@ function Card({ title, subtitle, icon, actions, footer, interactive, children, c
|
|
|
630
637
|
}
|
|
631
638
|
|
|
632
639
|
// src/components/core/Avatar.tsx
|
|
633
|
-
var
|
|
640
|
+
var React4 = __toESM(require("react"), 1);
|
|
634
641
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
635
642
|
var initials = (name) => name.trim().split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase();
|
|
636
643
|
function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
637
|
-
const [failed, setFailed] =
|
|
644
|
+
const [failed, setFailed] = React4.useState(false);
|
|
638
645
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cx("pire-avatar", className), "data-size": size, role: "img", "aria-label": name, ...rest, children: src && !failed ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
639
646
|
"img",
|
|
640
647
|
{
|
|
@@ -647,7 +654,7 @@ function Avatar({ name, size = "md", src, className, ...rest }) {
|
|
|
647
654
|
}
|
|
648
655
|
|
|
649
656
|
// src/components/core/SegmentedControl.tsx
|
|
650
|
-
var
|
|
657
|
+
var React5 = __toESM(require("react"), 1);
|
|
651
658
|
var import_react_aria_components5 = require("react-aria-components");
|
|
652
659
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
653
660
|
function SegmentedControl({
|
|
@@ -661,7 +668,7 @@ function SegmentedControl({
|
|
|
661
668
|
style,
|
|
662
669
|
...rest
|
|
663
670
|
}) {
|
|
664
|
-
const selected =
|
|
671
|
+
const selected = React5.useMemo(() => new Set(value ? [value] : defaultValue ? [defaultValue] : []), [value, defaultValue]);
|
|
665
672
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
666
673
|
import_react_aria_components5.ToggleButtonGroup,
|
|
667
674
|
{
|
|
@@ -823,145 +830,8 @@ function FormField({ label, htmlFor, isRequired, hint, error, layout = "stacked"
|
|
|
823
830
|
}
|
|
824
831
|
|
|
825
832
|
// src/components/forms/Input.tsx
|
|
833
|
+
var React7 = __toESM(require("react"), 1);
|
|
826
834
|
var import_react_aria_components9 = require("react-aria-components");
|
|
827
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
828
|
-
function Input({
|
|
829
|
-
label,
|
|
830
|
-
icon,
|
|
831
|
-
suffix,
|
|
832
|
-
description,
|
|
833
|
-
errorMessage,
|
|
834
|
-
size = "md",
|
|
835
|
-
numeric,
|
|
836
|
-
fullWidth = true,
|
|
837
|
-
className,
|
|
838
|
-
style,
|
|
839
|
-
inputRef,
|
|
840
|
-
onChange,
|
|
841
|
-
...rest
|
|
842
|
-
}) {
|
|
843
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
844
|
-
import_react_aria_components9.TextField,
|
|
845
|
-
{
|
|
846
|
-
className: cx("pire-field", className),
|
|
847
|
-
style,
|
|
848
|
-
onChange,
|
|
849
|
-
validationBehavior: "aria",
|
|
850
|
-
...rest,
|
|
851
|
-
children: [
|
|
852
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_aria_components9.Label, { className: "pire-field-label", children: [
|
|
853
|
-
label,
|
|
854
|
-
rest.isRequired ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
855
|
-
] }) : null,
|
|
856
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
857
|
-
import_react_aria_components9.Group,
|
|
858
|
-
{
|
|
859
|
-
className: "pire-control",
|
|
860
|
-
"data-size": size,
|
|
861
|
-
"data-full-width": String(fullWidth),
|
|
862
|
-
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
863
|
-
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
864
|
-
children: [
|
|
865
|
-
icon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: icon, size: 16, className: "pire-leading-icon" }) : null,
|
|
866
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components9.Input, { ref: inputRef, className: "pire-input", "data-numeric": numeric ? "true" : void 0 }),
|
|
867
|
-
suffix ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pire-affix", children: suffix }) : null
|
|
868
|
-
]
|
|
869
|
-
}
|
|
870
|
-
),
|
|
871
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components9.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
872
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_aria_components9.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
873
|
-
]
|
|
874
|
-
}
|
|
875
|
-
);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// src/components/forms/TextArea.tsx
|
|
879
|
-
var React5 = __toESM(require("react"), 1);
|
|
880
|
-
var import_react_aria_components10 = require("react-aria-components");
|
|
881
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
882
|
-
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React5.useEffect : React5.useLayoutEffect;
|
|
883
|
-
function TextArea({
|
|
884
|
-
label,
|
|
885
|
-
description,
|
|
886
|
-
errorMessage,
|
|
887
|
-
size = "md",
|
|
888
|
-
rows = 3,
|
|
889
|
-
autoGrow,
|
|
890
|
-
maxRows,
|
|
891
|
-
fullWidth = true,
|
|
892
|
-
className,
|
|
893
|
-
style,
|
|
894
|
-
textAreaRef,
|
|
895
|
-
onChange,
|
|
896
|
-
...rest
|
|
897
|
-
}) {
|
|
898
|
-
const innerRef = React5.useRef(null);
|
|
899
|
-
const ref = React5.useCallback((node) => {
|
|
900
|
-
innerRef.current = node;
|
|
901
|
-
if (typeof textAreaRef === "function") textAreaRef(node);
|
|
902
|
-
else if (textAreaRef) textAreaRef.current = node;
|
|
903
|
-
}, [textAreaRef]);
|
|
904
|
-
const grow = React5.useCallback(() => {
|
|
905
|
-
const el = innerRef.current;
|
|
906
|
-
if (!el || !autoGrow) return;
|
|
907
|
-
const styles = getComputedStyle(el);
|
|
908
|
-
const lineHeight = Number.parseFloat(styles.lineHeight) || Number.parseFloat(styles.fontSize) * 1.5;
|
|
909
|
-
const chrome = el.offsetHeight - el.clientHeight;
|
|
910
|
-
el.style.height = "auto";
|
|
911
|
-
const wanted = maxRows ? Math.min(el.scrollHeight, Math.ceil(lineHeight * maxRows)) : el.scrollHeight;
|
|
912
|
-
const next = `${wanted + chrome}px`;
|
|
913
|
-
if (el.style.height !== next) el.style.height = next;
|
|
914
|
-
}, [autoGrow, maxRows]);
|
|
915
|
-
useIsomorphicLayoutEffect(() => {
|
|
916
|
-
if (!autoGrow) {
|
|
917
|
-
if (innerRef.current) innerRef.current.style.height = "";
|
|
918
|
-
return;
|
|
919
|
-
}
|
|
920
|
-
grow();
|
|
921
|
-
}, [autoGrow, grow, rest.value]);
|
|
922
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
923
|
-
import_react_aria_components10.TextField,
|
|
924
|
-
{
|
|
925
|
-
className: cx("pire-field", className),
|
|
926
|
-
style,
|
|
927
|
-
onChange,
|
|
928
|
-
validationBehavior: "aria",
|
|
929
|
-
...rest,
|
|
930
|
-
children: [
|
|
931
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_aria_components10.Label, { className: "pire-field-label", children: [
|
|
932
|
-
label,
|
|
933
|
-
rest.isRequired ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
934
|
-
] }) : null,
|
|
935
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
936
|
-
import_react_aria_components10.Group,
|
|
937
|
-
{
|
|
938
|
-
className: "pire-control",
|
|
939
|
-
"data-size": size,
|
|
940
|
-
"data-full-width": String(fullWidth),
|
|
941
|
-
"data-multiline": "true",
|
|
942
|
-
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
943
|
-
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
944
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
945
|
-
import_react_aria_components10.TextArea,
|
|
946
|
-
{
|
|
947
|
-
ref,
|
|
948
|
-
rows,
|
|
949
|
-
onInput: autoGrow ? grow : void 0,
|
|
950
|
-
className: cx("pire-input", "pire-textarea"),
|
|
951
|
-
"data-auto-grow": autoGrow ? "true" : void 0
|
|
952
|
-
}
|
|
953
|
-
)
|
|
954
|
-
}
|
|
955
|
-
),
|
|
956
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components10.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
957
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components10.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
958
|
-
]
|
|
959
|
-
}
|
|
960
|
-
);
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
// src/components/forms/Select.tsx
|
|
964
|
-
var import_react_aria_components11 = require("react-aria-components");
|
|
965
835
|
|
|
966
836
|
// src/i18n/PireIntlProvider.tsx
|
|
967
837
|
var React6 = __toESM(require("react"), 1);
|
|
@@ -974,6 +844,7 @@ var enMessages = {
|
|
|
974
844
|
dataTableSelectAll: "Select all rows",
|
|
975
845
|
dataTableSelectRow: "Select row",
|
|
976
846
|
dataTableLoading: "Loading records",
|
|
847
|
+
dataTableSummaryRow: "Summary",
|
|
977
848
|
dialogClose: "Close",
|
|
978
849
|
sidePanelClose: "Close panel",
|
|
979
850
|
inlineMessageDismiss: "Dismiss message",
|
|
@@ -988,6 +859,7 @@ var enMessages = {
|
|
|
988
859
|
dateRangePresetsLabel: "Date range shortcuts",
|
|
989
860
|
numberFieldIncrease: "Increase",
|
|
990
861
|
numberFieldDecrease: "Decrease",
|
|
862
|
+
inputClear: "Clear",
|
|
991
863
|
valueHelpFieldPlaceholder: "Not selected",
|
|
992
864
|
valueHelpFieldClear: "Clear selection",
|
|
993
865
|
valueHelpFieldOpenNamed: "Select {label}",
|
|
@@ -1028,6 +900,7 @@ var esMessages = {
|
|
|
1028
900
|
dataTableSelectAll: "Seleccionar todas las filas",
|
|
1029
901
|
dataTableSelectRow: "Seleccionar fila",
|
|
1030
902
|
dataTableLoading: "Cargando registros",
|
|
903
|
+
dataTableSummaryRow: "Resumen",
|
|
1031
904
|
dialogClose: "Cerrar",
|
|
1032
905
|
sidePanelClose: "Cerrar panel",
|
|
1033
906
|
inlineMessageDismiss: "Descartar mensaje",
|
|
@@ -1042,6 +915,7 @@ var esMessages = {
|
|
|
1042
915
|
dateRangePresetsLabel: "Atajos de rango de fechas",
|
|
1043
916
|
numberFieldIncrease: "Aumentar",
|
|
1044
917
|
numberFieldDecrease: "Disminuir",
|
|
918
|
+
inputClear: "Limpiar",
|
|
1045
919
|
valueHelpFieldPlaceholder: "Sin seleccionar",
|
|
1046
920
|
valueHelpFieldClear: "Limpiar selecci\xF3n",
|
|
1047
921
|
valueHelpFieldOpenNamed: "Seleccionar {label}",
|
|
@@ -1077,14 +951,14 @@ var esMessages = {
|
|
|
1077
951
|
};
|
|
1078
952
|
|
|
1079
953
|
// src/i18n/PireIntlProvider.tsx
|
|
1080
|
-
var
|
|
954
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1081
955
|
var MessagesContext = React6.createContext(enMessages);
|
|
1082
956
|
function PireIntlProvider({ messages, children }) {
|
|
1083
957
|
const value = React6.useMemo(
|
|
1084
958
|
() => messages ? { ...enMessages, ...messages } : enMessages,
|
|
1085
959
|
[messages]
|
|
1086
960
|
);
|
|
1087
|
-
return /* @__PURE__ */ (0,
|
|
961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MessagesContext.Provider, { value, children });
|
|
1088
962
|
}
|
|
1089
963
|
function usePireMessages() {
|
|
1090
964
|
return React6.useContext(MessagesContext);
|
|
@@ -1094,7 +968,160 @@ function useMessage(key, override) {
|
|
|
1094
968
|
return override ?? messages[key];
|
|
1095
969
|
}
|
|
1096
970
|
|
|
971
|
+
// src/components/forms/Input.tsx
|
|
972
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
973
|
+
function Input({
|
|
974
|
+
label,
|
|
975
|
+
icon,
|
|
976
|
+
suffix,
|
|
977
|
+
description,
|
|
978
|
+
errorMessage,
|
|
979
|
+
size = "md",
|
|
980
|
+
numeric,
|
|
981
|
+
isClearable,
|
|
982
|
+
clearLabel,
|
|
983
|
+
fullWidth = true,
|
|
984
|
+
className,
|
|
985
|
+
style,
|
|
986
|
+
inputRef,
|
|
987
|
+
onChange,
|
|
988
|
+
...rest
|
|
989
|
+
}) {
|
|
990
|
+
const msg = usePireMessages();
|
|
991
|
+
const isControlled = rest.value !== void 0;
|
|
992
|
+
const [ownValue, setOwnValue] = React7.useState(rest.defaultValue ?? "");
|
|
993
|
+
const currentValue = isControlled ? rest.value : ownValue;
|
|
994
|
+
const handleChange = (next) => {
|
|
995
|
+
setOwnValue(next);
|
|
996
|
+
onChange?.(next);
|
|
997
|
+
};
|
|
998
|
+
const takesOverValue = isClearable && !isControlled;
|
|
999
|
+
const valueProps = takesOverValue ? { value: ownValue, defaultValue: void 0 } : {};
|
|
1000
|
+
const showsClear = isClearable && currentValue !== "" && !rest.isDisabled && !rest.isReadOnly;
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1002
|
+
import_react_aria_components9.TextField,
|
|
1003
|
+
{
|
|
1004
|
+
className: cx("pire-field", className),
|
|
1005
|
+
style,
|
|
1006
|
+
onChange: handleChange,
|
|
1007
|
+
validationBehavior: "aria",
|
|
1008
|
+
...rest,
|
|
1009
|
+
...valueProps,
|
|
1010
|
+
children: [
|
|
1011
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_aria_components9.Label, { className: "pire-field-label", children: [
|
|
1012
|
+
label,
|
|
1013
|
+
rest.isRequired ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1014
|
+
] }) : null,
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1016
|
+
import_react_aria_components9.Group,
|
|
1017
|
+
{
|
|
1018
|
+
className: "pire-control",
|
|
1019
|
+
"data-size": size,
|
|
1020
|
+
"data-full-width": String(fullWidth),
|
|
1021
|
+
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1022
|
+
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1023
|
+
children: [
|
|
1024
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { name: icon, size: 16, className: "pire-leading-icon" }) : null,
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components9.Input, { ref: inputRef, className: "pire-input", "data-numeric": numeric ? "true" : void 0 }),
|
|
1026
|
+
showsClear ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components9.Button, { className: "pire-input-clear", onPress: () => handleChange(""), children: clearLabel ?? msg.inputClear }) : null,
|
|
1027
|
+
suffix ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "pire-affix", children: suffix }) : null
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
),
|
|
1031
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components9.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_aria_components9.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1033
|
+
]
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// src/components/forms/TextArea.tsx
|
|
1039
|
+
var React8 = __toESM(require("react"), 1);
|
|
1040
|
+
var import_react_aria_components10 = require("react-aria-components");
|
|
1041
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1042
|
+
var useIsomorphicLayoutEffect = typeof document === "undefined" ? React8.useEffect : React8.useLayoutEffect;
|
|
1043
|
+
function TextArea({
|
|
1044
|
+
label,
|
|
1045
|
+
description,
|
|
1046
|
+
errorMessage,
|
|
1047
|
+
size = "md",
|
|
1048
|
+
rows = 3,
|
|
1049
|
+
autoGrow,
|
|
1050
|
+
maxRows,
|
|
1051
|
+
fullWidth = true,
|
|
1052
|
+
className,
|
|
1053
|
+
style,
|
|
1054
|
+
textAreaRef,
|
|
1055
|
+
onChange,
|
|
1056
|
+
...rest
|
|
1057
|
+
}) {
|
|
1058
|
+
const innerRef = React8.useRef(null);
|
|
1059
|
+
const ref = React8.useCallback((node) => {
|
|
1060
|
+
innerRef.current = node;
|
|
1061
|
+
if (typeof textAreaRef === "function") textAreaRef(node);
|
|
1062
|
+
else if (textAreaRef) textAreaRef.current = node;
|
|
1063
|
+
}, [textAreaRef]);
|
|
1064
|
+
const grow = React8.useCallback(() => {
|
|
1065
|
+
const el = innerRef.current;
|
|
1066
|
+
if (!el || !autoGrow) return;
|
|
1067
|
+
const styles = getComputedStyle(el);
|
|
1068
|
+
const lineHeight = Number.parseFloat(styles.lineHeight) || Number.parseFloat(styles.fontSize) * 1.5;
|
|
1069
|
+
const chrome = el.offsetHeight - el.clientHeight;
|
|
1070
|
+
el.style.height = "auto";
|
|
1071
|
+
const wanted = maxRows ? Math.min(el.scrollHeight, Math.ceil(lineHeight * maxRows)) : el.scrollHeight;
|
|
1072
|
+
const next = `${wanted + chrome}px`;
|
|
1073
|
+
if (el.style.height !== next) el.style.height = next;
|
|
1074
|
+
}, [autoGrow, maxRows]);
|
|
1075
|
+
useIsomorphicLayoutEffect(() => {
|
|
1076
|
+
if (!autoGrow) {
|
|
1077
|
+
if (innerRef.current) innerRef.current.style.height = "";
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
grow();
|
|
1081
|
+
}, [autoGrow, grow, rest.value]);
|
|
1082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1083
|
+
import_react_aria_components10.TextField,
|
|
1084
|
+
{
|
|
1085
|
+
className: cx("pire-field", className),
|
|
1086
|
+
style,
|
|
1087
|
+
onChange,
|
|
1088
|
+
validationBehavior: "aria",
|
|
1089
|
+
...rest,
|
|
1090
|
+
children: [
|
|
1091
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_aria_components10.Label, { className: "pire-field-label", children: [
|
|
1092
|
+
label,
|
|
1093
|
+
rest.isRequired ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "pire-field-req", "aria-hidden": "true", children: "*" }) : null
|
|
1094
|
+
] }) : null,
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1096
|
+
import_react_aria_components10.Group,
|
|
1097
|
+
{
|
|
1098
|
+
className: "pire-control",
|
|
1099
|
+
"data-size": size,
|
|
1100
|
+
"data-full-width": String(fullWidth),
|
|
1101
|
+
"data-multiline": "true",
|
|
1102
|
+
"data-invalid": rest.isInvalid ? "true" : void 0,
|
|
1103
|
+
"data-readonly": rest.isReadOnly ? "true" : void 0,
|
|
1104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1105
|
+
import_react_aria_components10.TextArea,
|
|
1106
|
+
{
|
|
1107
|
+
ref,
|
|
1108
|
+
rows,
|
|
1109
|
+
onInput: autoGrow ? grow : void 0,
|
|
1110
|
+
className: cx("pire-input", "pire-textarea"),
|
|
1111
|
+
"data-auto-grow": autoGrow ? "true" : void 0
|
|
1112
|
+
}
|
|
1113
|
+
)
|
|
1114
|
+
}
|
|
1115
|
+
),
|
|
1116
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_aria_components10.Text, { slot: "description", className: "pire-field-hint", children: description }) : null,
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_aria_components10.FieldError, { className: "pire-field-error", children: errorMessage })
|
|
1118
|
+
]
|
|
1119
|
+
}
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1097
1123
|
// src/components/forms/Select.tsx
|
|
1124
|
+
var import_react_aria_components11 = require("react-aria-components");
|
|
1098
1125
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1099
1126
|
var norm = (o) => typeof o === "string" ? { value: o, label: o, isDisabled: false } : o;
|
|
1100
1127
|
function Select({
|
|
@@ -1294,7 +1321,7 @@ function ComboBox({
|
|
|
1294
1321
|
}
|
|
1295
1322
|
|
|
1296
1323
|
// src/components/forms/MultiComboBox.tsx
|
|
1297
|
-
var
|
|
1324
|
+
var React9 = __toESM(require("react"), 1);
|
|
1298
1325
|
var import_react_aria_components16 = require("react-aria-components");
|
|
1299
1326
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1300
1327
|
var norm3 = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
@@ -1320,15 +1347,15 @@ function MultiComboBox({
|
|
|
1320
1347
|
...rest
|
|
1321
1348
|
}) {
|
|
1322
1349
|
const msg = usePireMessages();
|
|
1323
|
-
const items =
|
|
1350
|
+
const items = React9.useMemo(() => options.map(norm3), [options]);
|
|
1324
1351
|
const collection = isFilteredExternally ? { items } : { defaultItems: items };
|
|
1325
1352
|
const showsStatus = isLoading || isFilteredExternally && items.length === 0 && emptyLabel != null;
|
|
1326
|
-
const [uncontrolled, setUncontrolled] =
|
|
1327
|
-
const [announcement, setAnnouncement] =
|
|
1328
|
-
const inputRef =
|
|
1353
|
+
const [uncontrolled, setUncontrolled] = React9.useState(defaultValue ?? []);
|
|
1354
|
+
const [announcement, setAnnouncement] = React9.useState("");
|
|
1355
|
+
const inputRef = React9.useRef(null);
|
|
1329
1356
|
const raw = value ?? uncontrolled;
|
|
1330
1357
|
const contentKey = raw.join("\0");
|
|
1331
|
-
const values =
|
|
1358
|
+
const values = React9.useMemo(() => raw, [contentKey]);
|
|
1332
1359
|
const labelOf = (v) => items.find((o) => o.value === v)?.label ?? v;
|
|
1333
1360
|
const isEditable = !rest.isDisabled && !rest.isReadOnly;
|
|
1334
1361
|
const commit = (next) => {
|
|
@@ -1644,14 +1671,27 @@ function DateRangePicker({
|
|
|
1644
1671
|
}
|
|
1645
1672
|
|
|
1646
1673
|
// src/components/forms/ValueHelpField.tsx
|
|
1647
|
-
var
|
|
1674
|
+
var React12 = __toESM(require("react"), 1);
|
|
1648
1675
|
|
|
1649
1676
|
// src/components/patterns/ValueHelpDialog.tsx
|
|
1650
|
-
var
|
|
1677
|
+
var React11 = __toESM(require("react"), 1);
|
|
1651
1678
|
|
|
1652
1679
|
// src/components/feedback/Dialog.tsx
|
|
1680
|
+
var React10 = __toESM(require("react"), 1);
|
|
1653
1681
|
var import_react_aria_components20 = require("react-aria-components");
|
|
1654
1682
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1683
|
+
function DialogTitle({ children, className }) {
|
|
1684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.Heading, { slot: "title", className: cx("pire-dialog-title", className), children });
|
|
1685
|
+
}
|
|
1686
|
+
function DialogDescription({ children, className }) {
|
|
1687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: cx("pire-dialog-sub", className), style: { margin: 0 }, children });
|
|
1688
|
+
}
|
|
1689
|
+
function DialogBody({ children, className }) {
|
|
1690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cx("pire-dialog-body", className), children });
|
|
1691
|
+
}
|
|
1692
|
+
function DialogActions({ children, className }) {
|
|
1693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("footer", { className: cx("pire-dialog-foot", className), children });
|
|
1694
|
+
}
|
|
1655
1695
|
function Dialog({
|
|
1656
1696
|
isOpen,
|
|
1657
1697
|
onOpenChange,
|
|
@@ -1671,6 +1711,18 @@ function Dialog({
|
|
|
1671
1711
|
onClose?.();
|
|
1672
1712
|
onOpenChange?.(false);
|
|
1673
1713
|
};
|
|
1714
|
+
const parts = React10.Children.toArray(children);
|
|
1715
|
+
const slotOf = (type) => parts.find((node) => React10.isValidElement(node) && node.type === type);
|
|
1716
|
+
const titleSlot = slotOf(DialogTitle);
|
|
1717
|
+
const descriptionSlot = slotOf(DialogDescription);
|
|
1718
|
+
const bodySlot = slotOf(DialogBody);
|
|
1719
|
+
const actionsSlot = slotOf(DialogActions);
|
|
1720
|
+
const slots = [titleSlot, descriptionSlot, bodySlot, actionsSlot];
|
|
1721
|
+
const loose = parts.filter((node) => !slots.includes(node));
|
|
1722
|
+
const heading = titleSlot ?? (title ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.Heading, { slot: "title", className: "pire-dialog-title", children: title }) : null);
|
|
1723
|
+
const description = descriptionSlot ?? (subtitle ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "pire-dialog-sub", style: { margin: 0 }, children: subtitle }) : null);
|
|
1724
|
+
const actions = actionsSlot ?? (footer ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("footer", { className: "pire-dialog-foot", children: footer }) : null);
|
|
1725
|
+
const body = bodySlot ?? (loose.length ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pire-dialog-body", children: loose }) : null);
|
|
1674
1726
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1675
1727
|
import_react_aria_components20.ModalOverlay,
|
|
1676
1728
|
{
|
|
@@ -1681,15 +1733,15 @@ function Dialog({
|
|
|
1681
1733
|
if (!o) close();
|
|
1682
1734
|
},
|
|
1683
1735
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_aria_components20.Modal, { className: cx("pire-modal", className), "data-size": size, style, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react_aria_components20.Dialog, { className: "pire-dialog", children: [
|
|
1684
|
-
|
|
1736
|
+
heading || description ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("header", { className: "pire-dialog-head", children: [
|
|
1685
1737
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1686
|
-
|
|
1687
|
-
|
|
1738
|
+
heading,
|
|
1739
|
+
description
|
|
1688
1740
|
] }),
|
|
1689
1741
|
showClose ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(IconButton, { icon: "x", label: msg.dialogClose, size: "sm", onPress: close }) : null
|
|
1690
1742
|
] }) : null,
|
|
1691
|
-
|
|
1692
|
-
|
|
1743
|
+
body,
|
|
1744
|
+
actions
|
|
1693
1745
|
] }) })
|
|
1694
1746
|
}
|
|
1695
1747
|
);
|
|
@@ -1760,6 +1812,10 @@ function DataTable({
|
|
|
1760
1812
|
isLoading,
|
|
1761
1813
|
loadingRowCount,
|
|
1762
1814
|
loadingLabel,
|
|
1815
|
+
footer,
|
|
1816
|
+
rowProps,
|
|
1817
|
+
renderExpanded,
|
|
1818
|
+
expandedIds,
|
|
1763
1819
|
className,
|
|
1764
1820
|
style,
|
|
1765
1821
|
...rest
|
|
@@ -1776,6 +1832,11 @@ function DataTable({
|
|
|
1776
1832
|
...columns.map((c) => ({ width: c.width, align: c.align, numeric: c.numeric }))
|
|
1777
1833
|
];
|
|
1778
1834
|
const body = isLoading ? [] : rows;
|
|
1835
|
+
const presentation = new Map(rows.map((row) => [row.id, rowProps?.(row) ?? {}]));
|
|
1836
|
+
const disabledKeys = rows.filter((row) => presentation.get(row.id)?.isDisabled).map((row) => row.id);
|
|
1837
|
+
const expanded = new Set((expandedIds ?? []).map(String));
|
|
1838
|
+
const spanAll = columns.length + (selectable ? 1 : 0);
|
|
1839
|
+
const expandedKey = (id) => `${id}::__pire_expanded__`;
|
|
1779
1840
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1780
1841
|
"div",
|
|
1781
1842
|
{
|
|
@@ -1790,6 +1851,7 @@ function DataTable({
|
|
|
1790
1851
|
"data-density": density,
|
|
1791
1852
|
"data-sticky": String(stickyHeader),
|
|
1792
1853
|
"aria-label": rest["aria-label"],
|
|
1854
|
+
disabledKeys: disabledKeys.length ? new Set(disabledKeys) : void 0,
|
|
1793
1855
|
selectionMode: selectable ? "multiple" : "none",
|
|
1794
1856
|
selectedKeys: selected ? new Set(selected) : void 0,
|
|
1795
1857
|
onSelectionChange: handleSelection,
|
|
@@ -1812,7 +1874,7 @@ function DataTable({
|
|
|
1812
1874
|
width: c.width,
|
|
1813
1875
|
"data-align": c.numeric || c.align === "right" ? "right" : c.align,
|
|
1814
1876
|
"data-allows-sorting": c.sortable ? "true" : void 0,
|
|
1815
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "pire-th-inner", children: [
|
|
1877
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: cx("pire-th-inner", c.hideLabel && "pire-sr-only"), children: [
|
|
1816
1878
|
c.label,
|
|
1817
1879
|
c.sortable ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1818
1880
|
Icon,
|
|
@@ -1833,19 +1895,46 @@ function DataTable({
|
|
|
1833
1895
|
// biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows are positional.
|
|
1834
1896
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SkeletonTableRow, { columns: skeletonColumns, density }, i)
|
|
1835
1897
|
))
|
|
1836
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "pire-table-empty", children: emptyLabel }), children: body.
|
|
1837
|
-
|
|
1838
|
-
|
|
1898
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "pire-table-empty", children: emptyLabel }), children: body.flatMap((row) => {
|
|
1899
|
+
const rowIsDisabled = presentation.get(row.id)?.isDisabled;
|
|
1900
|
+
const record = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1901
|
+
import_react_aria_components21.Row,
|
|
1902
|
+
{
|
|
1903
|
+
id: row.id,
|
|
1904
|
+
className: cx("pire-tr", presentation.get(row.id)?.className),
|
|
1905
|
+
"data-pressable": onRowAction && !rowIsDisabled ? "true" : void 0,
|
|
1906
|
+
children: [
|
|
1907
|
+
selectable ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components21.Cell, { className: "pire-td", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Checkbox, { slot: "selection", "aria-label": msg.dataTableSelectRow }) }) : null,
|
|
1908
|
+
columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1909
|
+
import_react_aria_components21.Cell,
|
|
1910
|
+
{
|
|
1911
|
+
className: "pire-td",
|
|
1912
|
+
"data-numeric": c.numeric ? "true" : void 0,
|
|
1913
|
+
style: { textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
1914
|
+
children: c.render ? c.render(row) : row[c.key]
|
|
1915
|
+
},
|
|
1916
|
+
c.key
|
|
1917
|
+
))
|
|
1918
|
+
]
|
|
1919
|
+
},
|
|
1920
|
+
row.id
|
|
1921
|
+
);
|
|
1922
|
+
if (!renderExpanded || !expanded.has(String(row.id))) return [record];
|
|
1923
|
+
return [record, /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components21.Row, { id: expandedKey(row.id), className: "pire-tr-expanded", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components21.Cell, { className: "pire-td-expanded", colSpan: spanAll, children: renderExpanded(row) }) }, expandedKey(row.id))];
|
|
1924
|
+
}) }),
|
|
1925
|
+
footer && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components21.TableFooter, { className: "pire-tfoot", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_aria_components21.Row, { id: "__pire_footer__", className: "pire-tr-footer", children: [
|
|
1926
|
+
selectable ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_aria_components21.Cell, { className: "pire-tf" }) : null,
|
|
1927
|
+
columns.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1839
1928
|
import_react_aria_components21.Cell,
|
|
1840
1929
|
{
|
|
1841
|
-
className: "pire-
|
|
1930
|
+
className: "pire-tf",
|
|
1842
1931
|
"data-numeric": c.numeric ? "true" : void 0,
|
|
1843
1932
|
style: { textAlign: c.align && !c.numeric ? c.align : void 0 },
|
|
1844
|
-
children: c.
|
|
1933
|
+
children: footer[c.key] ?? (i === 0 && !selectable ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pire-sr-only", children: msg.dataTableSummaryRow }) : null)
|
|
1845
1934
|
},
|
|
1846
1935
|
c.key
|
|
1847
1936
|
))
|
|
1848
|
-
] }
|
|
1937
|
+
] }) }) : null
|
|
1849
1938
|
]
|
|
1850
1939
|
}
|
|
1851
1940
|
)
|
|
@@ -1870,11 +1959,11 @@ function ValueHelpDialog({
|
|
|
1870
1959
|
onClose
|
|
1871
1960
|
}) {
|
|
1872
1961
|
const msg = usePireMessages();
|
|
1873
|
-
const [query, setQuery] =
|
|
1874
|
-
|
|
1962
|
+
const [query, setQuery] = React11.useState("");
|
|
1963
|
+
React11.useEffect(() => {
|
|
1875
1964
|
if (isOpen) setQuery("");
|
|
1876
1965
|
}, [isOpen]);
|
|
1877
|
-
const filtered =
|
|
1966
|
+
const filtered = React11.useMemo(() => {
|
|
1878
1967
|
if (isFilteredExternally) return rows;
|
|
1879
1968
|
const q = query.trim().toLowerCase();
|
|
1880
1969
|
if (!q) return rows;
|
|
@@ -1901,6 +1990,7 @@ function ValueHelpDialog({
|
|
|
1901
1990
|
type: "search",
|
|
1902
1991
|
value: query,
|
|
1903
1992
|
onChange: handleSearch,
|
|
1993
|
+
isClearable: true,
|
|
1904
1994
|
placeholder: searchPlaceholder ?? msg.valueHelpDialogSearchPlaceholder,
|
|
1905
1995
|
autoFocus: true
|
|
1906
1996
|
}
|
|
@@ -1955,7 +2045,7 @@ function ValueHelpField({
|
|
|
1955
2045
|
style
|
|
1956
2046
|
}) {
|
|
1957
2047
|
const msg = usePireMessages();
|
|
1958
|
-
const [open, setOpen] =
|
|
2048
|
+
const [open, setOpen] = React12.useState(false);
|
|
1959
2049
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx(className), style, children: [
|
|
1960
2050
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1961
2051
|
Input,
|
|
@@ -2011,7 +2101,7 @@ function ValueHelpField({
|
|
|
2011
2101
|
}
|
|
2012
2102
|
|
|
2013
2103
|
// src/components/forms/FileUpload.tsx
|
|
2014
|
-
var
|
|
2104
|
+
var React13 = __toESM(require("react"), 1);
|
|
2015
2105
|
var import_react_aria_components23 = require("react-aria-components");
|
|
2016
2106
|
|
|
2017
2107
|
// src/components/feedback/ProgressBar.tsx
|
|
@@ -2101,10 +2191,10 @@ function FileUpload({
|
|
|
2101
2191
|
style
|
|
2102
2192
|
}) {
|
|
2103
2193
|
const msg = usePireMessages();
|
|
2104
|
-
const [uncontrolled, setUncontrolled] =
|
|
2194
|
+
const [uncontrolled, setUncontrolled] = React13.useState(defaultValue ?? []);
|
|
2105
2195
|
const files = value ?? uncontrolled;
|
|
2106
|
-
const created =
|
|
2107
|
-
|
|
2196
|
+
const created = React13.useRef([]);
|
|
2197
|
+
React13.useEffect(() => () => {
|
|
2108
2198
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
2109
2199
|
}, []);
|
|
2110
2200
|
const commit = (next) => {
|
|
@@ -2215,7 +2305,7 @@ function ShellBar({
|
|
|
2215
2305
|
}
|
|
2216
2306
|
|
|
2217
2307
|
// src/components/navigation/SideNav.tsx
|
|
2218
|
-
var
|
|
2308
|
+
var React14 = __toESM(require("react"), 1);
|
|
2219
2309
|
var import_react_aria_components26 = require("react-aria-components");
|
|
2220
2310
|
|
|
2221
2311
|
// src/components/navigation/Menu.tsx
|
|
@@ -2302,10 +2392,10 @@ function SideNav({
|
|
|
2302
2392
|
const msg = usePireMessages();
|
|
2303
2393
|
const activeParent = findActiveParent(groups, value);
|
|
2304
2394
|
const isControlled = expandedIds != null;
|
|
2305
|
-
const [ownExpanded, setOwnExpanded] =
|
|
2395
|
+
const [ownExpanded, setOwnExpanded] = React14.useState(
|
|
2306
2396
|
() => new Set(defaultExpandedIds ?? (activeParent ? [activeParent] : []))
|
|
2307
2397
|
);
|
|
2308
|
-
const [lastValue, setLastValue] =
|
|
2398
|
+
const [lastValue, setLastValue] = React14.useState(value);
|
|
2309
2399
|
if (value !== lastValue) {
|
|
2310
2400
|
setLastValue(value);
|
|
2311
2401
|
if (!isControlled && activeParent && !ownExpanded.has(activeParent)) {
|
|
@@ -2569,7 +2659,7 @@ function InlineMessage({ kind = "info", title, action, onClose, children, classN
|
|
|
2569
2659
|
}
|
|
2570
2660
|
|
|
2571
2661
|
// src/components/feedback/Toast.tsx
|
|
2572
|
-
var
|
|
2662
|
+
var React15 = __toESM(require("react"), 1);
|
|
2573
2663
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2574
2664
|
var KIND_ICON2 = {
|
|
2575
2665
|
info: "info",
|
|
@@ -2595,26 +2685,26 @@ function Toast({ kind = "success", onClose, position = "bottom-center", children
|
|
|
2595
2685
|
}
|
|
2596
2686
|
);
|
|
2597
2687
|
}
|
|
2598
|
-
var ToastContext =
|
|
2688
|
+
var ToastContext = React15.createContext(null);
|
|
2599
2689
|
function ToastProvider({ children, timeout = 6e3 }) {
|
|
2600
2690
|
const msg = usePireMessages();
|
|
2601
|
-
const [toasts, setToasts] =
|
|
2602
|
-
const close =
|
|
2603
|
-
const add =
|
|
2691
|
+
const [toasts, setToasts] = React15.useState([]);
|
|
2692
|
+
const close = React15.useCallback((id) => setToasts((t) => t.filter((x) => x.id !== id)), []);
|
|
2693
|
+
const add = React15.useCallback((toast) => {
|
|
2604
2694
|
const id = Math.random().toString(36).slice(2);
|
|
2605
2695
|
setToasts((t) => [...t, { ...toast, id }]);
|
|
2606
2696
|
const ms = toast.timeout ?? timeout;
|
|
2607
2697
|
if (ms > 0) setTimeout(() => close(id), ms);
|
|
2608
2698
|
return id;
|
|
2609
2699
|
}, [close, timeout]);
|
|
2610
|
-
const value =
|
|
2700
|
+
const value = React15.useMemo(() => ({ add, close }), [add, close]);
|
|
2611
2701
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(ToastContext.Provider, { value, children: [
|
|
2612
2702
|
children,
|
|
2613
2703
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "pire-toast-region", role: "region", "aria-label": msg.toastRegionLabel, children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Toast, { kind: t.kind, onClose: () => close(t.id), style: { position: "static", transform: "none" }, children: t.message }, t.id)) })
|
|
2614
2704
|
] });
|
|
2615
2705
|
}
|
|
2616
2706
|
function useToast() {
|
|
2617
|
-
const ctx =
|
|
2707
|
+
const ctx = React15.useContext(ToastContext);
|
|
2618
2708
|
if (!ctx) throw new Error("useToast must be used inside <ToastProvider>");
|
|
2619
2709
|
return ctx;
|
|
2620
2710
|
}
|
|
@@ -2964,14 +3054,14 @@ function BarChart({
|
|
|
2964
3054
|
}
|
|
2965
3055
|
|
|
2966
3056
|
// src/components/data/LineChart.tsx
|
|
2967
|
-
var
|
|
3057
|
+
var React16 = __toESM(require("react"), 1);
|
|
2968
3058
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2969
3059
|
var PLOT_INSET = { top: 10, right: 14, bottom: 24, left: 58 };
|
|
2970
3060
|
var MARKER_LIMIT = 20;
|
|
2971
|
-
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ?
|
|
3061
|
+
var useIsomorphicLayoutEffect2 = typeof window === "undefined" ? React16.useEffect : React16.useLayoutEffect;
|
|
2972
3062
|
function useMeasuredWidth() {
|
|
2973
|
-
const ref =
|
|
2974
|
-
const [width, setWidth] =
|
|
3063
|
+
const ref = React16.useRef(null);
|
|
3064
|
+
const [width, setWidth] = React16.useState(0);
|
|
2975
3065
|
useIsomorphicLayoutEffect2(() => {
|
|
2976
3066
|
const element = ref.current;
|
|
2977
3067
|
if (!element) return;
|
|
@@ -3134,7 +3224,7 @@ function LineChart({
|
|
|
3134
3224
|
}
|
|
3135
3225
|
|
|
3136
3226
|
// src/components/data/DonutChart.tsx
|
|
3137
|
-
var
|
|
3227
|
+
var React17 = __toESM(require("react"), 1);
|
|
3138
3228
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3139
3229
|
var SEGMENT_GAP_DEGREES = 1.5;
|
|
3140
3230
|
function DonutChart({
|
|
@@ -3155,7 +3245,7 @@ function DonutChart({
|
|
|
3155
3245
|
}) {
|
|
3156
3246
|
const label = rest["aria-label"];
|
|
3157
3247
|
const msg = usePireMessages();
|
|
3158
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
3248
|
+
const [hoveredIndex, setHoveredIndex] = React17.useState(null);
|
|
3159
3249
|
warnOnDonutShape(series, categories.length, label);
|
|
3160
3250
|
const values = (series[0]?.values ?? []).slice(0, categories.length);
|
|
3161
3251
|
const segments = categories.map((category, index) => ({ category, index, value: values[index] ?? 0 })).filter((segment) => segment.value > 0);
|
|
@@ -3357,7 +3447,7 @@ function ConfirmDialog({
|
|
|
3357
3447
|
}
|
|
3358
3448
|
|
|
3359
3449
|
// src/components/patterns/CommandPalette.tsx
|
|
3360
|
-
var
|
|
3450
|
+
var React18 = __toESM(require("react"), 1);
|
|
3361
3451
|
var import_react_aria_components31 = require("react-aria-components");
|
|
3362
3452
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3363
3453
|
var RESULTS_SECTION_KEY = "__pire_results__";
|
|
@@ -3380,17 +3470,17 @@ function CommandPalette({
|
|
|
3380
3470
|
style
|
|
3381
3471
|
}) {
|
|
3382
3472
|
const msg = usePireMessages();
|
|
3383
|
-
const [query, setQuery] =
|
|
3473
|
+
const [query, setQuery] = React18.useState("");
|
|
3384
3474
|
const { contains } = (0, import_react_aria_components31.useFilter)({ sensitivity: "base" });
|
|
3385
|
-
|
|
3475
|
+
React18.useEffect(() => {
|
|
3386
3476
|
if (isOpen) setQuery("");
|
|
3387
3477
|
}, [isOpen]);
|
|
3388
|
-
const searchableById =
|
|
3478
|
+
const searchableById = React18.useMemo(() => {
|
|
3389
3479
|
const byId = /* @__PURE__ */ new Map();
|
|
3390
3480
|
for (const group of groups) for (const item of group.items) byId.set(item.id, searchableText(item));
|
|
3391
3481
|
return byId;
|
|
3392
3482
|
}, [groups]);
|
|
3393
|
-
const filter =
|
|
3483
|
+
const filter = React18.useCallback((textValue, inputValue, node) => {
|
|
3394
3484
|
if (node.parentKey === RESULTS_SECTION_KEY) return true;
|
|
3395
3485
|
return contains(searchableById.get(String(node.key)) ?? textValue, inputValue);
|
|
3396
3486
|
}, [contains, searchableById]);
|
|
@@ -3473,9 +3563,9 @@ function CommandPalette({
|
|
|
3473
3563
|
);
|
|
3474
3564
|
}
|
|
3475
3565
|
function useCommandPaletteShortcut(onTrigger, { key = "k", isDisabled } = {}) {
|
|
3476
|
-
const handler =
|
|
3566
|
+
const handler = React18.useRef(onTrigger);
|
|
3477
3567
|
handler.current = onTrigger;
|
|
3478
|
-
|
|
3568
|
+
React18.useEffect(() => {
|
|
3479
3569
|
if (isDisabled) return;
|
|
3480
3570
|
const onKeyDown = (event) => {
|
|
3481
3571
|
if (!(event.metaKey || event.ctrlKey) || event.altKey) return;
|
|
@@ -3529,7 +3619,7 @@ function EmptyState({ icon = "file-text", title, action, compact, children, clas
|
|
|
3529
3619
|
}
|
|
3530
3620
|
|
|
3531
3621
|
// src/components/patterns/FileDropZone.tsx
|
|
3532
|
-
var
|
|
3622
|
+
var React19 = __toESM(require("react"), 1);
|
|
3533
3623
|
var import_react_aria_components33 = require("react-aria-components");
|
|
3534
3624
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3535
3625
|
var isImage2 = (file) => file.type.startsWith("image/");
|
|
@@ -3557,10 +3647,10 @@ function FileDropZone({
|
|
|
3557
3647
|
style
|
|
3558
3648
|
}) {
|
|
3559
3649
|
const msg = usePireMessages();
|
|
3560
|
-
const [uncontrolled, setUncontrolled] =
|
|
3650
|
+
const [uncontrolled, setUncontrolled] = React19.useState(defaultValue ?? []);
|
|
3561
3651
|
const files = value ?? uncontrolled;
|
|
3562
|
-
const created =
|
|
3563
|
-
|
|
3652
|
+
const created = React19.useRef([]);
|
|
3653
|
+
React19.useEffect(() => () => {
|
|
3564
3654
|
for (const url of created.current) URL.revokeObjectURL(url);
|
|
3565
3655
|
}, []);
|
|
3566
3656
|
const commit = (next) => {
|
|
@@ -3634,6 +3724,7 @@ function FileDropZone({
|
|
|
3634
3724
|
|
|
3635
3725
|
// src/index.ts
|
|
3636
3726
|
var import_react_aria_components34 = require("react-aria-components");
|
|
3727
|
+
var import_react_aria_components35 = require("react-aria-components");
|
|
3637
3728
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3638
3729
|
0 && (module.exports = {
|
|
3639
3730
|
Avatar,
|
|
@@ -3651,12 +3742,17 @@ var import_react_aria_components34 = require("react-aria-components");
|
|
|
3651
3742
|
DateRangePicker,
|
|
3652
3743
|
DescriptionList,
|
|
3653
3744
|
Dialog,
|
|
3745
|
+
DialogActions,
|
|
3746
|
+
DialogBody,
|
|
3747
|
+
DialogDescription,
|
|
3748
|
+
DialogTitle,
|
|
3654
3749
|
DialogTrigger,
|
|
3655
3750
|
DonutChart,
|
|
3656
3751
|
EmptyState,
|
|
3657
3752
|
FileDropZone,
|
|
3658
3753
|
FileUpload,
|
|
3659
3754
|
FilterBar,
|
|
3755
|
+
Focusable,
|
|
3660
3756
|
FooterBar,
|
|
3661
3757
|
FormField,
|
|
3662
3758
|
Heading,
|