@j2-health/design-system 0.6.4 → 0.6.6
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/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/index.cjs +12 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -3
- package/dist/index2.js +8 -3
- package/dist/src/AppConfigProvider.cjs +1 -2
- package/dist/src/AppConfigProvider.js +1 -2
- package/dist/src/appTheme.cjs +8 -2
- package/dist/src/appTheme.cjs.map +1 -1
- package/dist/src/appTheme.js +8 -2
- package/dist/src/appTheme.js.map +1 -1
- package/dist/src/components/alert/Alert.cjs +1 -2
- package/dist/src/components/alert/Alert.js +1 -2
- package/dist/src/components/alert/Alert.module.css.cjs +1 -2
- package/dist/src/components/alert/Alert.module.css.js +1 -2
- package/dist/src/components/barchart/BarChart.cjs +1 -2
- package/dist/src/components/barchart/BarChart.js +1 -2
- package/dist/src/components/barchart/chart.module.css.cjs +1 -2
- package/dist/src/components/barchart/chart.module.css.js +1 -2
- package/dist/src/components/bareButton/BareButton.cjs +1 -2
- package/dist/src/components/bareButton/BareButton.js +1 -2
- package/dist/src/components/breadcrumb/Breadcrumb.cjs +1 -2
- package/dist/src/components/breadcrumb/Breadcrumb.js +1 -2
- package/dist/src/components/bulkActionBar/BulkActionBar.cjs +1 -2
- package/dist/src/components/bulkActionBar/BulkActionBar.js +1 -2
- package/dist/src/components/button/Button.cjs +1 -2
- package/dist/src/components/button/Button.js +1 -2
- package/dist/src/components/callout/Callout.cjs +35 -0
- package/dist/src/components/callout/Callout.cjs.map +1 -0
- package/dist/src/components/callout/Callout.d.ts +18 -0
- package/dist/src/components/callout/Callout.js +33 -0
- package/dist/src/components/callout/Callout.js.map +1 -0
- package/dist/src/components/callout/index.d.ts +1 -0
- package/dist/src/components/card/Card.cjs +1 -2
- package/dist/src/components/card/Card.js +1 -2
- package/dist/src/components/changeChip/ChangeChip.cjs +1 -2
- package/dist/src/components/changeChip/ChangeChip.js +1 -2
- package/dist/src/components/checkbox/Checkbox.cjs +1 -2
- package/dist/src/components/checkbox/Checkbox.js +1 -2
- package/dist/src/components/checkboxTree/CheckboxTree.cjs +1 -2
- package/dist/src/components/checkboxTree/CheckboxTree.js +1 -2
- package/dist/src/components/checkboxTree/TreeNode.cjs +1 -2
- package/dist/src/components/checkboxTree/TreeNode.js +1 -2
- package/dist/src/components/checkboxTree/utils.cjs +1 -2
- package/dist/src/components/checkboxTree/utils.js +1 -2
- package/dist/src/components/collapse/Collapse.cjs +1 -2
- package/dist/src/components/collapse/Collapse.js +1 -2
- package/dist/src/components/collapse/Collapse.module.css.cjs +1 -2
- package/dist/src/components/collapse/Collapse.module.css.js +1 -2
- package/dist/src/components/drawer/Drawer.cjs +1 -2
- package/dist/src/components/drawer/Drawer.js +1 -2
- package/dist/src/components/dropdown/Dropdown.cjs +1 -2
- package/dist/src/components/dropdown/Dropdown.js +1 -2
- package/dist/src/components/emptyState/EmptyState.cjs +1 -2
- package/dist/src/components/emptyState/EmptyState.js +1 -2
- package/dist/src/components/fileDropzone/FileDropzone.cjs +296 -0
- package/dist/src/components/fileDropzone/FileDropzone.cjs.map +1 -0
- package/dist/src/components/fileDropzone/FileDropzone.d.ts +68 -0
- package/dist/src/components/fileDropzone/FileDropzone.js +293 -0
- package/dist/src/components/fileDropzone/FileDropzone.js.map +1 -0
- package/dist/src/components/fileDropzone/index.d.ts +1 -0
- package/dist/src/components/filterform/FilterGroup.cjs +1 -2
- package/dist/src/components/filterform/FilterGroup.js +1 -2
- package/dist/src/components/filterform/FilterInput.cjs +1 -2
- package/dist/src/components/filterform/FilterInput.js +1 -2
- package/dist/src/components/filterform/FiltersForm.cjs +1 -2
- package/dist/src/components/filterform/FiltersForm.js +1 -2
- package/dist/src/components/filterform/FiltersForm.module.css.cjs +1 -2
- package/dist/src/components/filterform/FiltersForm.module.css.js +1 -2
- package/dist/src/components/filterform/filterHelpers.cjs +1 -2
- package/dist/src/components/filterform/filterHelpers.js +1 -2
- package/dist/src/components/filterform/useFilterField.cjs +1 -2
- package/dist/src/components/filterform/useFilterField.js +1 -2
- package/dist/src/components/filterform/useFiltersForm.cjs +1 -2
- package/dist/src/components/filterform/useFiltersForm.js +1 -2
- package/dist/src/components/form/Form.cjs +1 -2
- package/dist/src/components/form/Form.js +1 -2
- package/dist/src/components/form/FormItem.cjs +1 -2
- package/dist/src/components/form/FormItem.js +1 -2
- package/dist/src/components/form/FormItemFieldContext.cjs +1 -2
- package/dist/src/components/form/FormItemFieldContext.cjs.map +1 -1
- package/dist/src/components/form/FormItemFieldContext.js +1 -2
- package/dist/src/components/form/FormikField.cjs +1 -2
- package/dist/src/components/form/FormikField.js +1 -2
- package/dist/src/components/input/AntdInput.cjs +1 -2
- package/dist/src/components/input/AntdInput.d.ts +1 -1
- package/dist/src/components/input/AntdInput.js +1 -2
- package/dist/src/components/input/AntdSearchInput.cjs +1 -2
- package/dist/src/components/input/AntdSearchInput.d.ts +1 -1
- package/dist/src/components/input/AntdSearchInput.js +1 -2
- package/dist/src/components/input/AntdTextArea.cjs +15 -0
- package/dist/src/components/input/AntdTextArea.cjs.map +1 -0
- package/dist/src/components/input/AntdTextArea.d.ts +347 -0
- package/dist/src/components/input/AntdTextArea.js +15 -0
- package/dist/src/components/input/AntdTextArea.js.map +1 -0
- package/dist/src/components/input/Input.cjs +1 -2
- package/dist/src/components/input/Input.js +1 -2
- package/dist/src/components/input/index.d.ts +1 -0
- package/dist/src/components/inputnumber/InputNumber.cjs +1 -2
- package/dist/src/components/inputnumber/InputNumber.js +1 -2
- package/dist/src/components/inputnumber/InputNumber.module.css.cjs +1 -2
- package/dist/src/components/inputnumber/InputNumber.module.css.js +1 -2
- package/dist/src/components/legacyNavMenu/LegacyNavMenu.cjs +1 -2
- package/dist/src/components/legacyNavMenu/LegacyNavMenu.js +1 -2
- package/dist/src/components/legacyNavMenu/LegacyNavMenu.module.css.cjs +1 -2
- package/dist/src/components/legacyNavMenu/LegacyNavMenu.module.css.js +1 -2
- package/dist/src/components/legacyNavMenu/UserProfile.cjs +1 -2
- package/dist/src/components/legacyNavMenu/UserProfile.js +1 -2
- package/dist/src/components/legacyNavMenu/UserProfile.module.css.cjs +1 -2
- package/dist/src/components/legacyNavMenu/UserProfile.module.css.js +1 -2
- package/dist/src/components/listRow/ListRow.cjs +1 -2
- package/dist/src/components/listRow/ListRow.js +1 -2
- package/dist/src/components/listpopover/ListPopover.cjs +1 -2
- package/dist/src/components/listpopover/ListPopover.js +1 -2
- package/dist/src/components/listpopover/ListPopover.module.css.cjs +1 -2
- package/dist/src/components/listpopover/ListPopover.module.css.js +1 -2
- package/dist/src/components/manageColumns/ManageColumnsItem.cjs +1 -2
- package/dist/src/components/manageColumns/ManageColumnsItem.js +1 -2
- package/dist/src/components/manageColumns/ManageColumnsPanel.cjs +1 -2
- package/dist/src/components/manageColumns/ManageColumnsPanel.js +1 -2
- package/dist/src/components/manageColumns/SelectAll.cjs +1 -2
- package/dist/src/components/manageColumns/SelectAll.js +1 -2
- package/dist/src/components/menu/Menu.cjs +1 -2
- package/dist/src/components/menu/Menu.js +1 -2
- package/dist/src/components/menu/Menu.module.css.cjs +1 -2
- package/dist/src/components/menu/Menu.module.css.js +1 -2
- package/dist/src/components/message/Message.module.css.cjs +1 -2
- package/dist/src/components/message/Message.module.css.js +1 -2
- package/dist/src/components/message/useMessage.cjs +1 -2
- package/dist/src/components/message/useMessage.js +1 -2
- package/dist/src/components/modal/Modal.cjs +1 -2
- package/dist/src/components/modal/Modal.js +1 -2
- package/dist/src/components/navMenu/NavMenu.cjs +1 -2
- package/dist/src/components/navMenu/NavMenu.js +1 -2
- package/dist/src/components/navMenu/NavMenu.module.css.cjs +1 -2
- package/dist/src/components/navMenu/NavMenu.module.css.js +1 -2
- package/dist/src/components/notification/Notification.module.css.cjs +1 -2
- package/dist/src/components/notification/Notification.module.css.js +1 -2
- package/dist/src/components/notification/useNotification.cjs +1 -2
- package/dist/src/components/notification/useNotification.js +1 -2
- package/dist/src/components/notificationModal/NotifcationModal.module.css.cjs +1 -2
- package/dist/src/components/notificationModal/NotifcationModal.module.css.js +1 -2
- package/dist/src/components/notificationModal/NotificationModal.cjs +1 -2
- package/dist/src/components/notificationModal/NotificationModal.js +1 -2
- package/dist/src/components/pagination/Pagination.cjs +1 -2
- package/dist/src/components/pagination/Pagination.js +1 -2
- package/dist/src/components/pagination/Pagination.module.css.cjs +1 -2
- package/dist/src/components/pagination/Pagination.module.css.js +1 -2
- package/dist/src/components/popover/Popover.cjs +1 -2
- package/dist/src/components/popover/Popover.js +1 -2
- package/dist/src/components/popover/Popover.module.css.cjs +1 -2
- package/dist/src/components/popover/Popover.module.css.js +1 -2
- package/dist/src/components/progress/Progress.cjs +1 -2
- package/dist/src/components/progress/Progress.js +1 -2
- package/dist/src/components/radio/Radio.cjs +1 -2
- package/dist/src/components/radio/Radio.js +1 -2
- package/dist/src/components/radioCardGroup/RadioCardGroup.cjs +78 -0
- package/dist/src/components/radioCardGroup/RadioCardGroup.cjs.map +1 -0
- package/dist/src/components/radioCardGroup/RadioCardGroup.d.ts +26 -0
- package/dist/src/components/radioCardGroup/RadioCardGroup.js +76 -0
- package/dist/src/components/radioCardGroup/RadioCardGroup.js.map +1 -0
- package/dist/src/components/radioCardGroup/index.d.ts +1 -0
- package/dist/src/components/rate/Rate.cjs +1 -2
- package/dist/src/components/rate/Rate.js +1 -2
- package/dist/src/components/select/AntdSelect.cjs +1 -2
- package/dist/src/components/select/AntdSelect.js +1 -2
- package/dist/src/components/select/Select.cjs +1 -2
- package/dist/src/components/select/Select.js +1 -2
- package/dist/src/components/select/SummarizedSelect.cjs +1 -2
- package/dist/src/components/select/SummarizedSelect.js +1 -2
- package/dist/src/components/select/SummarizedSelect.module.css.cjs +1 -2
- package/dist/src/components/select/SummarizedSelect.module.css.js +1 -2
- package/dist/src/components/skeleton/Skeleton.cjs +1 -2
- package/dist/src/components/skeleton/Skeleton.js +1 -2
- package/dist/src/components/slider/Slider.cjs +21 -0
- package/dist/src/components/slider/Slider.cjs.map +1 -0
- package/dist/src/components/slider/Slider.d.ts +7 -0
- package/dist/src/components/slider/Slider.js +19 -0
- package/dist/src/components/slider/Slider.js.map +1 -0
- package/dist/src/components/slider/index.d.ts +1 -0
- package/dist/src/components/spinner/Spinner.cjs +1 -2
- package/dist/src/components/spinner/Spinner.js +1 -2
- package/dist/src/components/statusPill/StatusPill.cjs +1 -2
- package/dist/src/components/statusPill/StatusPill.js +1 -2
- package/dist/src/components/statusPill/StatusPill.module.css.cjs +1 -2
- package/dist/src/components/statusPill/StatusPill.module.css.js +1 -2
- package/dist/src/components/stepDrawer/StepDrawer.cjs +1 -2
- package/dist/src/components/stepDrawer/StepDrawer.js +1 -2
- package/dist/src/components/steps/Steps.cjs +1 -2
- package/dist/src/components/steps/Steps.js +1 -2
- package/dist/src/components/steps/useSteps.cjs +1 -2
- package/dist/src/components/steps/useSteps.js +1 -2
- package/dist/src/components/swatch/Swatch.cjs +1 -2
- package/dist/src/components/swatch/Swatch.js +1 -2
- package/dist/src/components/swatchStrip/SwatchStrip.cjs +1 -2
- package/dist/src/components/swatchStrip/SwatchStrip.js +1 -2
- package/dist/src/components/switch/Switch.cjs +1 -2
- package/dist/src/components/switch/Switch.js +1 -2
- package/dist/src/components/table/Table.cjs +2 -3
- package/dist/src/components/table/Table.js +2 -3
- package/dist/src/components/table/Table.module.css.cjs +1 -2
- package/dist/src/components/table/Table.module.css.js +1 -2
- package/dist/src/components/tabs/Tabs.cjs +1 -2
- package/dist/src/components/tabs/Tabs.js +1 -2
- package/dist/src/components/tabs/Tabs.module.css.cjs +1 -2
- package/dist/src/components/tabs/Tabs.module.css.js +1 -2
- package/dist/src/components/tag/Tag.cjs +1 -2
- package/dist/src/components/tag/Tag.js +1 -2
- package/dist/src/components/thresholdBar/ThresholdBar.cjs +1 -2
- package/dist/src/components/thresholdBar/ThresholdBar.js +1 -2
- package/dist/src/components/thresholdBar/ThresholdBar.module.css.cjs +1 -2
- package/dist/src/components/thresholdBar/ThresholdBar.module.css.js +1 -2
- package/dist/src/components/tooltip/Tooltip.cjs +1 -2
- package/dist/src/components/tooltip/Tooltip.js +1 -2
- package/dist/src/components/vennDiagram/VennDiagram.cjs +1 -2
- package/dist/src/components/vennDiagram/VennDiagram.js +1 -2
- package/dist/src/svgs/ProgressCircle.svg.cjs +1 -2
- package/dist/src/svgs/ProgressCircle.svg.js +1 -2
- package/dist/src/svgs/j2-logo-menu-collapse.svg.cjs +1 -2
- package/dist/src/svgs/j2-logo-menu-collapse.svg.js +1 -2
- package/dist/src/svgs/j2-logo-menu.svg.cjs +1 -2
- package/dist/src/svgs/j2-logo-menu.svg.js +1 -2
- package/dist/src/svgs/menu-sidebar-collapse.svg.cjs +1 -2
- package/dist/src/svgs/menu-sidebar-collapse.svg.js +1 -2
- package/dist/src/svgs/menu-sidebar-expand.svg.cjs +1 -2
- package/dist/src/svgs/menu-sidebar-expand.svg.js +1 -2
- package/dist/src/utils/useRender.cjs +1 -2
- package/dist/src/utils/useRender.js +1 -2
- package/dist/style.css +78 -78
- package/dist/tailwind.cjs +1 -2
- package/dist/tailwind.js +1 -2
- package/package.json +13 -13
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { Button } from "../button/Button.js";
|
|
2
|
+
import { Modal } from "../modal/Modal.js";
|
|
3
|
+
import { Spinner } from "../spinner/Spinner.js";
|
|
4
|
+
import { useCallback, useImperativeHandle, useRef, useState } from "react";
|
|
5
|
+
import { CheckCircleIcon, DownloadSimpleIcon, FileCsvIcon, UploadSimpleIcon } from "@phosphor-icons/react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import cx from "classnames";
|
|
8
|
+
// src/components/fileDropzone/FileDropzone.tsx
|
|
9
|
+
function ViewIssuesButton({ onClick }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
11
|
+
type: "link",
|
|
12
|
+
size: "small",
|
|
13
|
+
className: "h-auto p-0 text-sm font-medium",
|
|
14
|
+
onClick: (event) => {
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
onClick?.();
|
|
17
|
+
},
|
|
18
|
+
children: "View & Fix Issues"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A file upload: an optional label, a full-width Download Template bar, and a
|
|
23
|
+
* dashed dropzone that shows the prompt, a spinner while the file is checked,
|
|
24
|
+
* or the uploaded file with a Replace link. Error and warning banners tuck
|
|
25
|
+
* under the dropzone. Click, keyboard or drag and drop all upload; with
|
|
26
|
+
* `replaceConfirm` set, replacing an existing file asks first.
|
|
27
|
+
*
|
|
28
|
+
* Presentational: the caller checks the file and passes the result back as
|
|
29
|
+
* `status` and the counts.
|
|
30
|
+
*/
|
|
31
|
+
function FileDropzone({ status, fileName, label, accept = ".csv", errorRowCount, warningRowCount, missingHeaders, templateUrl, onDownloadTemplate, uploadDisabled = false, onFileSelected, onViewIssues, errorMessage, replaceConfirm, hasExistingUpload = false, successExtra, handleRef, className }) {
|
|
32
|
+
const fileInputRef = useRef(null);
|
|
33
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
34
|
+
const [dragError, setDragError] = useState(null);
|
|
35
|
+
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
36
|
+
const pendingDropRef = useRef(null);
|
|
37
|
+
const isUploading = status === "validating";
|
|
38
|
+
const hasHeaderError = status === "header-error";
|
|
39
|
+
const hasRowErrors = status === "success-with-errors";
|
|
40
|
+
const hasRowWarnings = status === "success-with-warnings";
|
|
41
|
+
const isUploaded = status === "success" || hasRowErrors || hasRowWarnings;
|
|
42
|
+
const disabled = uploadDisabled || isUploading;
|
|
43
|
+
const acceptLabel = accept.replace(/^\./, "").toUpperCase();
|
|
44
|
+
const needsReplaceConfirm = Boolean(replaceConfirm) && (isUploaded || hasExistingUpload);
|
|
45
|
+
const handleFile = useCallback((file) => {
|
|
46
|
+
if (!file) return;
|
|
47
|
+
setDragError(null);
|
|
48
|
+
onFileSelected(file);
|
|
49
|
+
}, [onFileSelected]);
|
|
50
|
+
const handleFileChange = (event) => {
|
|
51
|
+
handleFile(event.target.files?.[0] ?? null);
|
|
52
|
+
event.target.value = "";
|
|
53
|
+
};
|
|
54
|
+
const openPicker = () => fileInputRef.current?.click();
|
|
55
|
+
const requestUpload = () => {
|
|
56
|
+
if (disabled) return;
|
|
57
|
+
if (needsReplaceConfirm) {
|
|
58
|
+
pendingDropRef.current = null;
|
|
59
|
+
setConfirmOpen(true);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
openPicker();
|
|
63
|
+
};
|
|
64
|
+
useImperativeHandle(handleRef, () => ({ requestUpload }));
|
|
65
|
+
const confirmReplace = () => {
|
|
66
|
+
setConfirmOpen(false);
|
|
67
|
+
const droppedFile = pendingDropRef.current;
|
|
68
|
+
pendingDropRef.current = null;
|
|
69
|
+
if (droppedFile) handleFile(droppedFile);
|
|
70
|
+
else openPicker();
|
|
71
|
+
};
|
|
72
|
+
const cancelReplace = () => {
|
|
73
|
+
pendingDropRef.current = null;
|
|
74
|
+
setConfirmOpen(false);
|
|
75
|
+
};
|
|
76
|
+
const handleDragOver = (event) => {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
if (!disabled) setIsDragOver(true);
|
|
80
|
+
};
|
|
81
|
+
const handleDragLeave = (event) => {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
setIsDragOver(false);
|
|
85
|
+
};
|
|
86
|
+
const handleDrop = (event) => {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
setIsDragOver(false);
|
|
90
|
+
if (disabled) return;
|
|
91
|
+
const file = event.dataTransfer.files?.[0] ?? null;
|
|
92
|
+
if (!file) return;
|
|
93
|
+
if (!file.name.toLowerCase().endsWith(accept.toLowerCase())) {
|
|
94
|
+
setDragError(`Only ${acceptLabel} files are supported`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
setDragError(null);
|
|
98
|
+
if (needsReplaceConfirm) {
|
|
99
|
+
pendingDropRef.current = file;
|
|
100
|
+
setConfirmOpen(true);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
handleFile(file);
|
|
104
|
+
};
|
|
105
|
+
const templateClass = cx("mt-2 flex w-full items-center justify-center gap-2 rounded-j2 border-0 bg-j2-gray-3 px-4 py-1.5 text-sm text-j2-primary no-underline transition-colors", uploadDisabled ? "cursor-not-allowed opacity-60" : "cursor-pointer hover:bg-j2-gray-4");
|
|
106
|
+
const templateBar = onDownloadTemplate || !templateUrl || uploadDisabled ? /* @__PURE__ */ jsxs("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
disabled: uploadDisabled || !onDownloadTemplate,
|
|
109
|
+
onClick: onDownloadTemplate,
|
|
110
|
+
className: templateClass,
|
|
111
|
+
children: [/* @__PURE__ */ jsx(DownloadSimpleIcon, {
|
|
112
|
+
size: 16,
|
|
113
|
+
weight: "regular"
|
|
114
|
+
}), "Download Template"]
|
|
115
|
+
}) : /* @__PURE__ */ jsxs("a", {
|
|
116
|
+
href: templateUrl,
|
|
117
|
+
download: true,
|
|
118
|
+
className: templateClass,
|
|
119
|
+
children: [/* @__PURE__ */ jsx(DownloadSimpleIcon, {
|
|
120
|
+
size: 16,
|
|
121
|
+
weight: "regular"
|
|
122
|
+
}), "Download Template"]
|
|
123
|
+
});
|
|
124
|
+
const renderContent = () => {
|
|
125
|
+
if (isUploading) return /* @__PURE__ */ jsxs("div", {
|
|
126
|
+
className: "flex flex-col items-center gap-2 py-4",
|
|
127
|
+
children: [/* @__PURE__ */ jsx(Spinner, { size: 32 }), /* @__PURE__ */ jsx("p", {
|
|
128
|
+
className: "m-0 text-sm text-j2-text-secondary",
|
|
129
|
+
children: "Checking file..."
|
|
130
|
+
})]
|
|
131
|
+
});
|
|
132
|
+
if (fileName && isUploaded) return /* @__PURE__ */ jsxs("div", {
|
|
133
|
+
className: "flex flex-col items-center gap-4 py-8",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
136
|
+
size: 32,
|
|
137
|
+
weight: "regular",
|
|
138
|
+
className: "text-j2-green-9"
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ jsxs("div", {
|
|
141
|
+
className: "flex flex-col items-center gap-1",
|
|
142
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
143
|
+
className: "m-0 text-base font-normal text-j2-text",
|
|
144
|
+
children: "File Uploaded"
|
|
145
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
146
|
+
className: "inline-flex items-center gap-1 rounded-j2-sm border border-solid border-j2-border px-2 py-1 text-xs text-j2-text",
|
|
147
|
+
children: [/* @__PURE__ */ jsx(FileCsvIcon, {
|
|
148
|
+
size: 14,
|
|
149
|
+
weight: "regular"
|
|
150
|
+
}), fileName.replace(new RegExp(`\\${accept}$`, "i"), "")]
|
|
151
|
+
})]
|
|
152
|
+
}),
|
|
153
|
+
successExtra && /* @__PURE__ */ jsx("div", {
|
|
154
|
+
className: "flex w-full cursor-default justify-center",
|
|
155
|
+
onClick: (event) => event.stopPropagation(),
|
|
156
|
+
children: successExtra
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx("button", {
|
|
159
|
+
type: "button",
|
|
160
|
+
disabled,
|
|
161
|
+
onClick: (event) => {
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
requestUpload();
|
|
164
|
+
},
|
|
165
|
+
className: cx("border-none bg-transparent p-0 text-sm font-medium", disabled ? "cursor-not-allowed text-j2-text-tertiary" : "cursor-pointer text-j2-blue-10 hover:underline"),
|
|
166
|
+
children: "Replace"
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
});
|
|
170
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
171
|
+
className: "flex flex-col items-center gap-4 py-8",
|
|
172
|
+
children: [/* @__PURE__ */ jsx(UploadSimpleIcon, {
|
|
173
|
+
size: 32,
|
|
174
|
+
weight: "regular",
|
|
175
|
+
className: "text-j2-blue-9"
|
|
176
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
177
|
+
className: "flex flex-col items-center gap-1",
|
|
178
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
179
|
+
className: "m-0 text-base font-normal text-j2-text",
|
|
180
|
+
children: ["Upload ", acceptLabel]
|
|
181
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
182
|
+
className: "m-0 text-sm text-j2-text-secondary",
|
|
183
|
+
children: "Structure your file according to the provided template"
|
|
184
|
+
})]
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
189
|
+
className,
|
|
190
|
+
children: [
|
|
191
|
+
label && /* @__PURE__ */ jsx("label", {
|
|
192
|
+
className: "mb-1 block text-sm font-semibold",
|
|
193
|
+
children: label
|
|
194
|
+
}),
|
|
195
|
+
templateBar,
|
|
196
|
+
/* @__PURE__ */ jsx("input", {
|
|
197
|
+
ref: fileInputRef,
|
|
198
|
+
type: "file",
|
|
199
|
+
accept,
|
|
200
|
+
onChange: handleFileChange,
|
|
201
|
+
className: "hidden",
|
|
202
|
+
"data-testid": "file-dropzone-input"
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ jsx("div", {
|
|
205
|
+
role: "button",
|
|
206
|
+
tabIndex: 0,
|
|
207
|
+
"aria-disabled": disabled,
|
|
208
|
+
"aria-label": `Upload ${acceptLabel} file`,
|
|
209
|
+
onClick: disabled ? void 0 : requestUpload,
|
|
210
|
+
onKeyDown: (event) => {
|
|
211
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
if (!disabled) requestUpload();
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
onDragOver: handleDragOver,
|
|
217
|
+
onDragLeave: handleDragLeave,
|
|
218
|
+
onDrop: handleDrop,
|
|
219
|
+
className: cx("mt-2 rounded-j2-lg border-2 border-dashed transition-colors", isDragOver ? "border-j2-blue-7 bg-j2-blue-2" : cx("border-j2-gray-6 bg-j2-gray-1", !disabled && "hover:border-j2-gray-8"), disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"),
|
|
220
|
+
children: renderContent()
|
|
221
|
+
}),
|
|
222
|
+
hasHeaderError && (missingHeaders?.length ?? 0) > 0 && /* @__PURE__ */ jsx("div", {
|
|
223
|
+
className: "mx-4 flex items-start justify-between gap-3 rounded-b-xl border-x border-b border-solid border-j2-error bg-j2-red-2 px-3 py-2 text-sm",
|
|
224
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
|
|
225
|
+
className: "font-medium text-j2-primary",
|
|
226
|
+
children: [
|
|
227
|
+
"Missing required",
|
|
228
|
+
" ",
|
|
229
|
+
missingHeaders.length === 1 ? "column" : "columns",
|
|
230
|
+
":",
|
|
231
|
+
" ",
|
|
232
|
+
missingHeaders.map((header) => `"${header}"`).join(", ")
|
|
233
|
+
]
|
|
234
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
235
|
+
className: "m-0 text-xs text-j2-text-secondary",
|
|
236
|
+
children: [
|
|
237
|
+
"Header names are case-sensitive. Add the missing",
|
|
238
|
+
" ",
|
|
239
|
+
missingHeaders.length === 1 ? "column" : "columns",
|
|
240
|
+
" and re-upload."
|
|
241
|
+
]
|
|
242
|
+
})] })
|
|
243
|
+
}),
|
|
244
|
+
hasRowErrors && (errorRowCount ?? 0) > 0 && /* @__PURE__ */ jsxs("div", {
|
|
245
|
+
className: "mx-4 flex items-center justify-between rounded-b-xl border-x border-b border-solid border-j2-error bg-j2-red-2 px-3 py-2 text-sm",
|
|
246
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
247
|
+
className: "font-medium text-j2-primary",
|
|
248
|
+
children: [
|
|
249
|
+
errorRowCount.toLocaleString(),
|
|
250
|
+
" ",
|
|
251
|
+
errorRowCount === 1 ? "row" : "rows",
|
|
252
|
+
" will not be ingested"
|
|
253
|
+
]
|
|
254
|
+
}), /* @__PURE__ */ jsx(ViewIssuesButton, { onClick: onViewIssues })]
|
|
255
|
+
}),
|
|
256
|
+
hasRowWarnings && /* @__PURE__ */ jsxs("div", {
|
|
257
|
+
className: "mx-4 flex items-center justify-between rounded-b-xl border-x border-b border-solid border-j2-warning bg-j2-warning-bg px-3 py-2 text-sm",
|
|
258
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
259
|
+
className: "font-medium text-j2-primary",
|
|
260
|
+
children: (warningRowCount ?? 0) > 0 ? `${warningRowCount.toLocaleString()} ${warningRowCount === 1 ? "row has" : "rows have"} warnings` : "This file has warnings"
|
|
261
|
+
}), /* @__PURE__ */ jsx(ViewIssuesButton, { onClick: onViewIssues })]
|
|
262
|
+
}),
|
|
263
|
+
(dragError || errorMessage) && /* @__PURE__ */ jsx("p", {
|
|
264
|
+
className: "m-0 mt-1 text-xs text-j2-error",
|
|
265
|
+
children: dragError || errorMessage
|
|
266
|
+
}),
|
|
267
|
+
replaceConfirm && /* @__PURE__ */ jsxs(Modal, {
|
|
268
|
+
open: confirmOpen,
|
|
269
|
+
width: 460,
|
|
270
|
+
title: "Replace this file?",
|
|
271
|
+
onCancel: cancelReplace,
|
|
272
|
+
footer: null,
|
|
273
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
274
|
+
className: "text-sm text-j2-text",
|
|
275
|
+
children: replaceConfirm
|
|
276
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
277
|
+
className: "mt-6 flex justify-end gap-2",
|
|
278
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
279
|
+
onClick: cancelReplace,
|
|
280
|
+
children: "Cancel"
|
|
281
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
282
|
+
type: "primary",
|
|
283
|
+
onClick: confirmReplace,
|
|
284
|
+
children: "Replace"
|
|
285
|
+
})]
|
|
286
|
+
})]
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
export { FileDropzone };
|
|
292
|
+
|
|
293
|
+
//# sourceMappingURL=FileDropzone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropzone.js","names":[],"sources":["../../../../src/components/fileDropzone/FileDropzone.tsx"],"sourcesContent":["import {\n useCallback,\n useImperativeHandle,\n useRef,\n useState,\n type ReactNode,\n type Ref,\n} from 'react'\nimport cx from 'classnames'\nimport {\n CheckCircleIcon,\n DownloadSimpleIcon,\n FileCsvIcon,\n UploadSimpleIcon,\n} from '@phosphor-icons/react'\n\nimport { Button } from '../button'\nimport { Modal } from '../modal'\nimport { Spinner } from '../spinner'\n\nexport type FileDropzoneStatus =\n | 'idle'\n /** The file is being checked; the dropzone shows a spinner. */\n | 'validating'\n /** A file-level failure: the dropzone returns to its idle prompt and the\n * caller shows the details (usually in a results dialog). */\n | 'file-error'\n /** Required columns are missing; `missingHeaders` names them. */\n | 'header-error'\n | 'success'\n /** Uploaded, with rows that will not be ingested (`errorRowCount`). */\n | 'success-with-errors'\n /** Uploaded, with rows to review (`warningRowCount`). */\n | 'success-with-warnings'\n\n/** Lets a caller start an upload from outside the dropzone, such as a results\n * dialog's Re-upload. It goes through the same replace confirm as a click. */\nexport type FileDropzoneHandle = { requestUpload: () => void }\n\nexport type FileDropzoneProps = {\n status: FileDropzoneStatus\n /** Shown in a chip once a file is uploaded. */\n fileName?: string | null\n /** Bold label above the Download Template bar. Omit when the caller renders\n * its own section header. */\n label?: ReactNode\n /** Accepted file extension, for the picker and the drag-and-drop guard. */\n accept?: string\n errorRowCount?: number\n warningRowCount?: number\n missingHeaders?: string[]\n /** Static template URL for an `<a download>`. */\n templateUrl?: string\n /** Generates the template at runtime; takes precedence over `templateUrl`. */\n onDownloadTemplate?: () => void\n /** Greys out the template bar and the dropzone, e.g. until a choice the\n * upload depends on has been made. */\n uploadDisabled?: boolean\n onFileSelected: (file: File) => void\n /** Opens the caller's results dialog from an error or warning banner. */\n onViewIssues?: () => void\n /** A request that failed before the file was checked, shown under the\n * dropzone. */\n errorMessage?: ReactNode\n /** Body of a blocking \"Replace this file?\" confirm. When set and a file\n * already exists, every attempt to upload (click, Replace, keyboard or a\n * drop) asks first. When omitted, uploads proceed with no confirm. */\n replaceConfirm?: ReactNode\n /** True when a stored upload would be replaced even though the dropzone\n * looks idle. Defaults to the visible uploaded state. */\n hasExistingUpload?: boolean\n /** Read-only content in the uploaded state, between the file name and the\n * Replace link (a summary of what the file holds). Clicks inside it do not\n * start a replace. */\n successExtra?: ReactNode\n handleRef?: Ref<FileDropzoneHandle>\n className?: string\n}\n\nfunction ViewIssuesButton({ onClick }: { onClick?: () => void }) {\n return (\n <Button\n type=\"link\"\n size=\"small\"\n className=\"h-auto p-0 text-sm font-medium\"\n onClick={(event) => {\n event.stopPropagation()\n onClick?.()\n }}\n >\n View & Fix Issues\n </Button>\n )\n}\n\n/**\n * A file upload: an optional label, a full-width Download Template bar, and a\n * dashed dropzone that shows the prompt, a spinner while the file is checked,\n * or the uploaded file with a Replace link. Error and warning banners tuck\n * under the dropzone. Click, keyboard or drag and drop all upload; with\n * `replaceConfirm` set, replacing an existing file asks first.\n *\n * Presentational: the caller checks the file and passes the result back as\n * `status` and the counts.\n */\nexport function FileDropzone({\n status,\n fileName,\n label,\n accept = '.csv',\n errorRowCount,\n warningRowCount,\n missingHeaders,\n templateUrl,\n onDownloadTemplate,\n uploadDisabled = false,\n onFileSelected,\n onViewIssues,\n errorMessage,\n replaceConfirm,\n hasExistingUpload = false,\n successExtra,\n handleRef,\n className,\n}: FileDropzoneProps) {\n const fileInputRef = useRef<HTMLInputElement>(null)\n const [isDragOver, setIsDragOver] = useState(false)\n const [dragError, setDragError] = useState<string | null>(null)\n const [confirmOpen, setConfirmOpen] = useState(false)\n // A file dropped onto an uploaded dropzone waits here until the confirm\n // resolves; a picker request leaves it null.\n const pendingDropRef = useRef<File | null>(null)\n\n const isUploading = status === 'validating'\n const hasHeaderError = status === 'header-error'\n const hasRowErrors = status === 'success-with-errors'\n const hasRowWarnings = status === 'success-with-warnings'\n const isUploaded = status === 'success' || hasRowErrors || hasRowWarnings\n\n const disabled = uploadDisabled || isUploading\n const acceptLabel = accept.replace(/^\\./, '').toUpperCase()\n // The first upload overwrites nothing, so only a replace asks first.\n const needsReplaceConfirm =\n Boolean(replaceConfirm) && (isUploaded || hasExistingUpload)\n\n const handleFile = useCallback(\n (file: File | null) => {\n if (!file) return\n setDragError(null)\n onFileSelected(file)\n },\n [onFileSelected]\n )\n\n const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n handleFile(event.target.files?.[0] ?? null)\n event.target.value = ''\n }\n\n const openPicker = () => fileInputRef.current?.click()\n\n // Every upload attempt routes through here, so a replace always confirms.\n const requestUpload = () => {\n if (disabled) return\n if (needsReplaceConfirm) {\n pendingDropRef.current = null\n setConfirmOpen(true)\n return\n }\n openPicker()\n }\n\n useImperativeHandle(handleRef, () => ({ requestUpload }))\n\n const confirmReplace = () => {\n setConfirmOpen(false)\n const droppedFile = pendingDropRef.current\n pendingDropRef.current = null\n if (droppedFile) handleFile(droppedFile)\n else openPicker()\n }\n\n const cancelReplace = () => {\n pendingDropRef.current = null\n setConfirmOpen(false)\n }\n\n // Drag events are always cancelled, even while disabled: otherwise the\n // browser's own drop opens the file in place of the page.\n const handleDragOver = (event: React.DragEvent) => {\n event.preventDefault()\n event.stopPropagation()\n if (!disabled) setIsDragOver(true)\n }\n\n const handleDragLeave = (event: React.DragEvent) => {\n event.preventDefault()\n event.stopPropagation()\n setIsDragOver(false)\n }\n\n const handleDrop = (event: React.DragEvent) => {\n event.preventDefault()\n event.stopPropagation()\n setIsDragOver(false)\n if (disabled) return\n const file = event.dataTransfer.files?.[0] ?? null\n if (!file) return\n if (!file.name.toLowerCase().endsWith(accept.toLowerCase())) {\n setDragError(`Only ${acceptLabel} files are supported`)\n return\n }\n setDragError(null)\n // Dropping onto an existing upload is still a replace: confirm first.\n if (needsReplaceConfirm) {\n pendingDropRef.current = file\n setConfirmOpen(true)\n return\n }\n handleFile(file)\n }\n\n const templateClass = cx(\n 'mt-2 flex w-full items-center justify-center gap-2 rounded-j2 border-0 bg-j2-gray-3 px-4 py-1.5 text-sm text-j2-primary no-underline transition-colors',\n uploadDisabled\n ? 'cursor-not-allowed opacity-60'\n : 'cursor-pointer hover:bg-j2-gray-4'\n )\n\n // While disabled, the URL form renders as the disabled button too, so the\n // template can't be downloaded before the upload is available.\n const templateBar =\n onDownloadTemplate || !templateUrl || uploadDisabled ? (\n <button\n type=\"button\"\n disabled={uploadDisabled || !onDownloadTemplate}\n onClick={onDownloadTemplate}\n className={templateClass}\n >\n <DownloadSimpleIcon size={16} weight=\"regular\" />\n Download Template\n </button>\n ) : (\n <a href={templateUrl} download className={templateClass}>\n <DownloadSimpleIcon size={16} weight=\"regular\" />\n Download Template\n </a>\n )\n\n const renderContent = () => {\n if (isUploading) {\n return (\n <div className=\"flex flex-col items-center gap-2 py-4\">\n <Spinner size={32} />\n <p className=\"m-0 text-sm text-j2-text-secondary\">Checking file...</p>\n </div>\n )\n }\n\n if (fileName && isUploaded) {\n return (\n <div className=\"flex flex-col items-center gap-4 py-8\">\n <CheckCircleIcon\n size={32}\n weight=\"regular\"\n className=\"text-j2-green-9\"\n />\n <div className=\"flex flex-col items-center gap-1\">\n <p className=\"m-0 text-base font-normal text-j2-text\">\n File Uploaded\n </p>\n <span className=\"inline-flex items-center gap-1 rounded-j2-sm border border-solid border-j2-border px-2 py-1 text-xs text-j2-text\">\n <FileCsvIcon size={14} weight=\"regular\" />\n {fileName.replace(new RegExp(`\\\\${accept}$`, 'i'), '')}\n </span>\n </div>\n {successExtra && (\n // Read-only content, not part of the click-to-replace target.\n <div\n className=\"flex w-full cursor-default justify-center\"\n onClick={(event) => event.stopPropagation()}\n >\n {successExtra}\n </div>\n )}\n <button\n type=\"button\"\n disabled={disabled}\n onClick={(event) => {\n event.stopPropagation()\n requestUpload()\n }}\n className={cx(\n 'border-none bg-transparent p-0 text-sm font-medium',\n disabled\n ? 'cursor-not-allowed text-j2-text-tertiary'\n : 'cursor-pointer text-j2-blue-10 hover:underline'\n )}\n >\n Replace\n </button>\n </div>\n )\n }\n\n return (\n <div className=\"flex flex-col items-center gap-4 py-8\">\n <UploadSimpleIcon\n size={32}\n weight=\"regular\"\n className=\"text-j2-blue-9\"\n />\n <div className=\"flex flex-col items-center gap-1\">\n <p className=\"m-0 text-base font-normal text-j2-text\">\n Upload {acceptLabel}\n </p>\n <p className=\"m-0 text-sm text-j2-text-secondary\">\n Structure your file according to the provided template\n </p>\n </div>\n </div>\n )\n }\n\n return (\n <div className={className}>\n {label && (\n <label className=\"mb-1 block text-sm font-semibold\">{label}</label>\n )}\n\n {templateBar}\n\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept}\n onChange={handleFileChange}\n className=\"hidden\"\n data-testid=\"file-dropzone-input\"\n />\n\n <div\n role=\"button\"\n tabIndex={0}\n aria-disabled={disabled}\n aria-label={`Upload ${acceptLabel} file`}\n onClick={disabled ? undefined : requestUpload}\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n if (!disabled) requestUpload()\n }\n }}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n className={cx(\n 'mt-2 rounded-j2-lg border-2 border-dashed transition-colors',\n isDragOver\n ? 'border-j2-blue-7 bg-j2-blue-2'\n : cx(\n 'border-j2-gray-6 bg-j2-gray-1',\n !disabled && 'hover:border-j2-gray-8'\n ),\n disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'\n )}\n >\n {renderContent()}\n </div>\n\n {hasHeaderError && (missingHeaders?.length ?? 0) > 0 && (\n <div className=\"mx-4 flex items-start justify-between gap-3 rounded-b-xl border-x border-b border-solid border-j2-error bg-j2-red-2 px-3 py-2 text-sm\">\n <div>\n <span className=\"font-medium text-j2-primary\">\n Missing required{' '}\n {missingHeaders!.length === 1 ? 'column' : 'columns'}:{' '}\n {missingHeaders!.map((header) => `\"${header}\"`).join(', ')}\n </span>\n <p className=\"m-0 text-xs text-j2-text-secondary\">\n Header names are case-sensitive. Add the missing{' '}\n {missingHeaders!.length === 1 ? 'column' : 'columns'} and\n re-upload.\n </p>\n </div>\n </div>\n )}\n\n {hasRowErrors && (errorRowCount ?? 0) > 0 && (\n <div className=\"mx-4 flex items-center justify-between rounded-b-xl border-x border-b border-solid border-j2-error bg-j2-red-2 px-3 py-2 text-sm\">\n <span className=\"font-medium text-j2-primary\">\n {errorRowCount!.toLocaleString()}{' '}\n {errorRowCount === 1 ? 'row' : 'rows'} will not be ingested\n </span>\n <ViewIssuesButton onClick={onViewIssues} />\n </div>\n )}\n\n {hasRowWarnings && (\n <div className=\"mx-4 flex items-center justify-between rounded-b-xl border-x border-b border-solid border-j2-warning bg-j2-warning-bg px-3 py-2 text-sm\">\n <span className=\"font-medium text-j2-primary\">\n {(warningRowCount ?? 0) > 0\n ? `${warningRowCount!.toLocaleString()} ${\n warningRowCount === 1 ? 'row has' : 'rows have'\n } warnings`\n : 'This file has warnings'}\n </span>\n <ViewIssuesButton onClick={onViewIssues} />\n </div>\n )}\n\n {(dragError || errorMessage) && (\n <p className=\"m-0 mt-1 text-xs text-j2-error\">\n {dragError || errorMessage}\n </p>\n )}\n\n {replaceConfirm && (\n <Modal\n open={confirmOpen}\n width={460}\n title=\"Replace this file?\"\n onCancel={cancelReplace}\n footer={null}\n >\n <div className=\"text-sm text-j2-text\">{replaceConfirm}</div>\n <div className=\"mt-6 flex justify-end gap-2\">\n <Button onClick={cancelReplace}>Cancel</Button>\n <Button type=\"primary\" onClick={confirmReplace}>\n Replace\n </Button>\n </div>\n </Modal>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;AA+EA,SAAS,iBAAiB,EAAE,WAAqC;CAC/D,OACE,oBAAC,QAAD;EACE,MAAK;EACL,MAAK;EACL,WAAU;EACV,UAAU,UAAU;GAClB,MAAM,gBAAgB;GACtB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D,EAAkB,SAAS,aAAe,CAAA,CACvC;;IAGL,aAAa,iBACb,oBAAC,KAAD;IAAG,WAAU;IACV,UAAA,aAAa;GACb,CAAA;GAGJ,kBACC,qBAAC,OAAD;IACE,MAAM;IACN,OAAO;IACP,OAAM;IACN,UAAU;IACV,QAAQ;IALV,UAAA,CAOE,oBAAC,OAAD;KAAK,WAAU;KAAwB,UAAA;IAAoB,CAAA,GAC3D,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,QAAD;MAAQ,SAAS;MAAe,UAAA;KAAc,CAAA,GAC9C,oBAAC,QAAD;MAAQ,MAAK;MAAU,SAAS;MAAgB,UAAA;KAExC,CAAA,CACL;IACA,CAAA,CAAA;;EAEN;;AAET"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileDropzone, type FileDropzoneHandle, type FileDropzoneProps, type FileDropzoneStatus, } from './FileDropzone.js';
|
|
@@ -7,7 +7,7 @@ _phosphor_icons_react = require_runtime.__toESM(_phosphor_icons_react, 1);
|
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let classnames = require("classnames");
|
|
9
9
|
classnames = require_runtime.__toESM(classnames, 1);
|
|
10
|
-
|
|
10
|
+
// src/components/filterform/FilterGroup.tsx
|
|
11
11
|
var FilterGroup = ({ filterGroup, groupIndex, filterConfigs, className, onRemove, onChange, onDone }) => {
|
|
12
12
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
13
13
|
className: (0, classnames.default)("flex flex-col gap-4", {
|
|
@@ -38,7 +38,6 @@ var FilterGroup = ({ filterGroup, groupIndex, filterConfigs, className, onRemove
|
|
|
38
38
|
}, `${groupIndex}:${filterIndex}-input-container`))
|
|
39
39
|
}, filterGroup.field);
|
|
40
40
|
};
|
|
41
|
-
//#endregion
|
|
42
41
|
exports.FilterGroup = FilterGroup;
|
|
43
42
|
|
|
44
43
|
//# sourceMappingURL=FilterGroup.cjs.map
|
|
@@ -4,7 +4,7 @@ import { FilterInput } from "./FilterInput.js";
|
|
|
4
4
|
import { TrashIcon } from "@phosphor-icons/react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import cx from "classnames";
|
|
7
|
-
|
|
7
|
+
// src/components/filterform/FilterGroup.tsx
|
|
8
8
|
var FilterGroup = ({ filterGroup, groupIndex, filterConfigs, className, onRemove, onChange, onDone }) => {
|
|
9
9
|
return /* @__PURE__ */ jsx("div", {
|
|
10
10
|
className: cx("flex flex-col gap-4", {
|
|
@@ -35,7 +35,6 @@ var FilterGroup = ({ filterGroup, groupIndex, filterConfigs, className, onRemove
|
|
|
35
35
|
}, `${groupIndex}:${filterIndex}-input-container`))
|
|
36
36
|
}, filterGroup.field);
|
|
37
37
|
};
|
|
38
|
-
//#endregion
|
|
39
38
|
export { FilterGroup };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=FilterGroup.js.map
|
|
@@ -8,7 +8,7 @@ let antd = require("antd");
|
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let classnames = require("classnames");
|
|
10
10
|
classnames = require_runtime.__toESM(classnames, 1);
|
|
11
|
-
|
|
11
|
+
// src/components/filterform/FilterInput.tsx
|
|
12
12
|
var FilterInput = ({ value, filterConfigs, onChange, onBlur, className, size = "middle" }) => {
|
|
13
13
|
const { filter, operatorOptions, valueInputConfig, handleFieldChange, handleOperatorChange, handleValuesChange } = require_useFilterField.useFilterField({
|
|
14
14
|
filterConfigs,
|
|
@@ -167,7 +167,6 @@ var MultiValueTextInput = ({ values, maxValues, onChange, onBlur, size }) => {
|
|
|
167
167
|
})]
|
|
168
168
|
});
|
|
169
169
|
};
|
|
170
|
-
//#endregion
|
|
171
170
|
exports.FilterInput = FilterInput;
|
|
172
171
|
exports.MULTI_VALUE_TOKEN_SEPARATORS = MULTI_VALUE_TOKEN_SEPARATORS;
|
|
173
172
|
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Input, InputNumber, Select, Typography } from "antd";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import cx from "classnames";
|
|
7
|
-
|
|
7
|
+
// src/components/filterform/FilterInput.tsx
|
|
8
8
|
var FilterInput = ({ value, filterConfigs, onChange, onBlur, className, size = "middle" }) => {
|
|
9
9
|
const { filter, operatorOptions, valueInputConfig, handleFieldChange, handleOperatorChange, handleValuesChange } = useFilterField({
|
|
10
10
|
filterConfigs,
|
|
@@ -163,7 +163,6 @@ var MultiValueTextInput = ({ values, maxValues, onChange, onBlur, size }) => {
|
|
|
163
163
|
})]
|
|
164
164
|
});
|
|
165
165
|
};
|
|
166
|
-
//#endregion
|
|
167
166
|
export { FilterInput, MULTI_VALUE_TOKEN_SEPARATORS };
|
|
168
167
|
|
|
169
168
|
//# sourceMappingURL=FilterInput.js.map
|
|
@@ -11,7 +11,7 @@ _phosphor_icons_react = require_runtime.__toESM(_phosphor_icons_react, 1);
|
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
let classnames = require("classnames");
|
|
13
13
|
classnames = require_runtime.__toESM(classnames, 1);
|
|
14
|
-
|
|
14
|
+
// src/components/filterform/FiltersForm.tsx
|
|
15
15
|
var FiltersForm = ({ title, filterConfigs, onSubmit, initialValues, maxFiltersPerField = 5 }) => {
|
|
16
16
|
const { dispatch, filterGroups, newFilter, isNewFilterInputOpen, isValid, isEmpty } = require_useFiltersForm.useFiltersForm({ initialValues });
|
|
17
17
|
const handleSubmit = () => {
|
|
@@ -141,7 +141,6 @@ var FiltersForm = ({ title, filterConfigs, onSubmit, initialValues, maxFiltersPe
|
|
|
141
141
|
})]
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
-
//#endregion
|
|
145
144
|
exports.FiltersForm = FiltersForm;
|
|
146
145
|
|
|
147
146
|
//# sourceMappingURL=FiltersForm.cjs.map
|
|
@@ -8,7 +8,7 @@ import { useMemo } from "react";
|
|
|
8
8
|
import { PlusCircleIcon, TrashIcon } from "@phosphor-icons/react";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import cx from "classnames";
|
|
11
|
-
|
|
11
|
+
// src/components/filterform/FiltersForm.tsx
|
|
12
12
|
var FiltersForm = ({ title, filterConfigs, onSubmit, initialValues, maxFiltersPerField = 5 }) => {
|
|
13
13
|
const { dispatch, filterGroups, newFilter, isNewFilterInputOpen, isValid, isEmpty } = useFiltersForm({ initialValues });
|
|
14
14
|
const handleSubmit = () => {
|
|
@@ -138,7 +138,6 @@ var FiltersForm = ({ title, filterConfigs, onSubmit, initialValues, maxFiltersPe
|
|
|
138
138
|
})]
|
|
139
139
|
});
|
|
140
140
|
};
|
|
141
|
-
//#endregion
|
|
142
141
|
export { FiltersForm };
|
|
143
142
|
|
|
144
143
|
//# sourceMappingURL=FiltersForm.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/filterform/FiltersForm.module.css
|
|
2
2
|
var j2FilterForm = "_j2FilterForm_rdja9_1";
|
|
3
3
|
var filterFormTitle = "_filterFormTitle_rdja9_2";
|
|
4
4
|
var filterFormConjunction = "_filterFormConjunction_rdja9_6";
|
|
@@ -11,7 +11,6 @@ var FiltersForm_module_default = {
|
|
|
11
11
|
filterFormFieldsContainer,
|
|
12
12
|
filterFormGroupContainer
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
exports.default = FiltersForm_module_default;
|
|
16
15
|
exports.filterFormConjunction = filterFormConjunction;
|
|
17
16
|
exports.filterFormFieldsContainer = filterFormFieldsContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/filterform/FiltersForm.module.css
|
|
2
2
|
var j2FilterForm = "_j2FilterForm_rdja9_1";
|
|
3
3
|
var filterFormTitle = "_filterFormTitle_rdja9_2";
|
|
4
4
|
var filterFormConjunction = "_filterFormConjunction_rdja9_6";
|
|
@@ -11,7 +11,6 @@ var FiltersForm_module_default = {
|
|
|
11
11
|
filterFormFieldsContainer,
|
|
12
12
|
filterFormGroupContainer
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
14
|
export { FiltersForm_module_default as default, filterFormConjunction, filterFormFieldsContainer, filterFormGroupContainer, filterFormTitle, j2FilterForm };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=FiltersForm.module.css.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/filterform/filterHelpers.ts
|
|
2
2
|
var isMultiValueTextOperator = (operator) => operator === "isAnyOf" || operator === "isNoneOf";
|
|
3
3
|
/**
|
|
4
4
|
* Normalize a chip list: trim, drop empties, dedupe case-insensitively (the
|
|
@@ -50,7 +50,6 @@ var validateFormFilter = (filter, limits) => {
|
|
|
50
50
|
var isFilter = (filter) => {
|
|
51
51
|
return filter.operator !== void 0 && filter.field !== void 0 && filter.type !== void 0;
|
|
52
52
|
};
|
|
53
|
-
//#endregion
|
|
54
53
|
exports.isEmptyFilter = isEmptyFilter;
|
|
55
54
|
exports.isEmptyFormFilter = isEmptyFormFilter;
|
|
56
55
|
exports.isFilter = isFilter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/filterform/filterHelpers.ts
|
|
2
2
|
var isMultiValueTextOperator = (operator) => operator === "isAnyOf" || operator === "isNoneOf";
|
|
3
3
|
/**
|
|
4
4
|
* Normalize a chip list: trim, drop empties, dedupe case-insensitively (the
|
|
@@ -50,7 +50,6 @@ var validateFormFilter = (filter, limits) => {
|
|
|
50
50
|
var isFilter = (filter) => {
|
|
51
51
|
return filter.operator !== void 0 && filter.field !== void 0 && filter.type !== void 0;
|
|
52
52
|
};
|
|
53
|
-
//#endregion
|
|
54
53
|
export { isEmptyFilter, isEmptyFormFilter, isFilter, isMultiValueTextOperator, normalizeMultiValues, tooManyValuesMessage, validateFormFilter };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=filterHelpers.js.map
|
|
@@ -3,7 +3,7 @@ const require_filterHelpers = require("./filterHelpers.cjs");
|
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let react$1 = require_runtime.__toESM(react, 1);
|
|
5
5
|
react = require_runtime.__toESM(react);
|
|
6
|
-
|
|
6
|
+
// src/components/filterform/useFilterField.tsx
|
|
7
7
|
var TypeToOperatorOptions = {
|
|
8
8
|
select: [
|
|
9
9
|
{
|
|
@@ -268,7 +268,6 @@ var useFilterField = ({ filterConfigs, filter: initialFilter }) => {
|
|
|
268
268
|
handleValuesChange
|
|
269
269
|
};
|
|
270
270
|
};
|
|
271
|
-
//#endregion
|
|
272
271
|
exports.MultiValueTextOperatorOptions = MultiValueTextOperatorOptions;
|
|
273
272
|
exports.TypeToOperatorOptions = TypeToOperatorOptions;
|
|
274
273
|
exports.operatorOptionsFor = operatorOptionsFor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isMultiValueTextOperator, normalizeMultiValues, validateFormFilter } from "./filterHelpers.js";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
|
|
3
|
+
// src/components/filterform/useFilterField.tsx
|
|
4
4
|
var TypeToOperatorOptions = {
|
|
5
5
|
select: [
|
|
6
6
|
{
|
|
@@ -265,7 +265,6 @@ var useFilterField = ({ filterConfigs, filter: initialFilter }) => {
|
|
|
265
265
|
handleValuesChange
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
|
-
//#endregion
|
|
269
268
|
export { MultiValueTextOperatorOptions, TypeToOperatorOptions, operatorOptionsFor, useFilterField };
|
|
270
269
|
|
|
271
270
|
//# sourceMappingURL=useFilterField.js.map
|
|
@@ -3,7 +3,7 @@ const require_filterHelpers = require("./filterHelpers.cjs");
|
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let lodash_cloneDeep_js = require("lodash/cloneDeep.js");
|
|
5
5
|
lodash_cloneDeep_js = require_runtime.__toESM(lodash_cloneDeep_js, 1);
|
|
6
|
-
|
|
6
|
+
// src/components/filterform/useFiltersForm.ts
|
|
7
7
|
var copyFilterGroups = (filterGroups) => {
|
|
8
8
|
return (0, lodash_cloneDeep_js.default)(filterGroups);
|
|
9
9
|
};
|
|
@@ -120,7 +120,6 @@ var useFiltersForm = ({ initialValues }) => {
|
|
|
120
120
|
isEmpty: filterGroups.length === 0 && (newFilter ? require_filterHelpers.isEmptyFormFilter(newFilter) : true)
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
|
-
//#endregion
|
|
124
123
|
exports.useFiltersForm = useFiltersForm;
|
|
125
124
|
|
|
126
125
|
//# sourceMappingURL=useFiltersForm.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isEmptyFormFilter } from "./filterHelpers.js";
|
|
2
2
|
import { useReducer } from "react";
|
|
3
3
|
import cloneDeep from "lodash/cloneDeep.js";
|
|
4
|
-
|
|
4
|
+
// src/components/filterform/useFiltersForm.ts
|
|
5
5
|
var copyFilterGroups = (filterGroups) => {
|
|
6
6
|
return cloneDeep(filterGroups);
|
|
7
7
|
};
|
|
@@ -118,7 +118,6 @@ var useFiltersForm = ({ initialValues }) => {
|
|
|
118
118
|
isEmpty: filterGroups.length === 0 && (newFilter ? isEmptyFormFilter(newFilter) : true)
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
|
-
//#endregion
|
|
122
121
|
export { useFiltersForm };
|
|
123
122
|
|
|
124
123
|
//# sourceMappingURL=useFiltersForm.js.map
|
|
@@ -3,7 +3,7 @@ const require_FormItem = require("./FormItem.cjs");
|
|
|
3
3
|
let antd = require("antd");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
let formik = require("formik");
|
|
6
|
-
|
|
6
|
+
// src/components/form/Form.tsx
|
|
7
7
|
var Form = ({ children, onFinish, onReset, ...props }) => {
|
|
8
8
|
const { handleSubmit, handleReset } = (0, formik.useFormikContext)();
|
|
9
9
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form, {
|
|
@@ -20,7 +20,6 @@ var Form = ({ children, onFinish, onReset, ...props }) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
Form.Item = require_FormItem.FormItem;
|
|
23
|
-
//#endregion
|
|
24
23
|
exports.Form = Form;
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=Form.cjs.map
|
|
@@ -3,7 +3,7 @@ import { FormItem } from "./FormItem.js";
|
|
|
3
3
|
import { Form } from "antd";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useFormikContext } from "formik";
|
|
6
|
-
|
|
6
|
+
// src/components/form/Form.tsx
|
|
7
7
|
var Form$1 = ({ children, onFinish, onReset, ...props }) => {
|
|
8
8
|
const { handleSubmit, handleReset } = useFormikContext();
|
|
9
9
|
return /* @__PURE__ */ jsx(Form, {
|
|
@@ -20,7 +20,6 @@ var Form$1 = ({ children, onFinish, onReset, ...props }) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
Form$1.Item = FormItem;
|
|
23
|
-
//#endregion
|
|
24
23
|
export { Form$1 as Form };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=Form.js.map
|
|
@@ -3,7 +3,7 @@ const require_FormikField = require("./FormikField.cjs");
|
|
|
3
3
|
let antd = require("antd");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
let formik = require("formik");
|
|
6
|
-
|
|
6
|
+
// src/components/form/FormItem.tsx
|
|
7
7
|
var FormItem = ({ name, validate, children, showValidateSuccess, showInitialErrorAfterTouched = false, ...props }) => {
|
|
8
8
|
const form = (0, formik.useFormikContext)();
|
|
9
9
|
const error = (0, formik.getIn)(form.errors, name);
|
|
@@ -31,7 +31,6 @@ var FormItem = ({ name, validate, children, showValidateSuccess, showInitialErro
|
|
|
31
31
|
})
|
|
32
32
|
}) : item;
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
exports.FormItem = FormItem;
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=FormItem.cjs.map
|
|
@@ -3,7 +3,7 @@ import { FormikField } from "./FormikField.js";
|
|
|
3
3
|
import { Form } from "antd";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { getIn, useFormikContext } from "formik";
|
|
6
|
-
|
|
6
|
+
// src/components/form/FormItem.tsx
|
|
7
7
|
var FormItem = ({ name, validate, children, showValidateSuccess, showInitialErrorAfterTouched = false, ...props }) => {
|
|
8
8
|
const form = useFormikContext();
|
|
9
9
|
const error = getIn(form.errors, name);
|
|
@@ -31,7 +31,6 @@ var FormItem = ({ name, validate, children, showValidateSuccess, showInitialErro
|
|
|
31
31
|
})
|
|
32
32
|
}) : item;
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
export { FormItem };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=FormItem.js.map
|