@dmsi/wedgekit-react 0.0.414 → 0.0.417
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/chunk-3HBYDOYE.js +114 -0
- package/dist/{chunk-JIMJIJOF.js → chunk-5TGP5EFM.js} +2 -2
- package/dist/{chunk-2HMCS25C.js → chunk-6LHBY2IH.js} +1 -1
- package/dist/{chunk-6I5LZ2ZC.js → chunk-7AXHAWJX.js} +3 -3
- package/dist/{chunk-MQX7GFLX.js → chunk-CAQWLY5V.js} +24 -6
- package/dist/{chunk-QQ5G773N.js → chunk-DCLNAUC4.js} +1 -1
- package/dist/{chunk-GB4ZTUQV.js → chunk-DTW7JCBR.js} +36 -0
- package/dist/{chunk-OBY5EH47.js → chunk-HYJIDHAK.js} +6 -6
- package/dist/{chunk-LZGYABCX.js → chunk-IMOIZFJZ.js} +8 -8
- package/dist/chunk-KBJZUVLM.js +65 -0
- package/dist/{chunk-AA6GE3TH.js → chunk-LUPHOXAQ.js} +1 -1
- package/dist/chunk-NRNWEQD7.js +66 -0
- package/dist/{chunk-44TDIHUP.js → chunk-P3MIP2FD.js} +1 -1
- package/dist/chunk-PQWWVBSR.js +61 -0
- package/dist/{chunk-ERW5DEIO.js → chunk-RQLWSLVE.js} +1 -1
- package/dist/chunk-TYAQWVIM.js +159 -0
- package/dist/{chunk-KZZKQLKF.js → chunk-W55J2KJZ.js} +1 -1
- package/dist/chunk-Y2GK27RX.js +79 -0
- package/dist/components/Accordion.cjs +74 -2
- package/dist/components/Accordion.js +3 -3
- package/dist/components/CalendarRange.cjs +232 -53
- package/dist/components/CalendarRange.css +178 -65
- package/dist/components/CalendarRange.js +25 -17
- package/dist/components/Card.cjs +38 -2
- package/dist/components/Card.js +1 -1
- package/dist/components/CompactImagesPreview.cjs +59 -5
- package/dist/components/CompactImagesPreview.js +2 -2
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +190 -11
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +178 -65
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +25 -17
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +200 -21
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +178 -65
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +25 -17
- package/dist/components/DataGrid/PinnedColumns.cjs +215 -36
- package/dist/components/DataGrid/PinnedColumns.css +178 -65
- package/dist/components/DataGrid/PinnedColumns.js +25 -17
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +191 -12
- package/dist/components/DataGrid/TableBody/LoadingCell.css +178 -65
- package/dist/components/DataGrid/TableBody/LoadingCell.js +25 -17
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +197 -18
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +178 -65
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +25 -17
- package/dist/components/DataGrid/TableBody/index.cjs +212 -33
- package/dist/components/DataGrid/TableBody/index.css +178 -65
- package/dist/components/DataGrid/TableBody/index.js +25 -17
- package/dist/components/DataGrid/index.cjs +301 -122
- package/dist/components/DataGrid/index.css +178 -65
- package/dist/components/DataGrid/index.js +25 -17
- package/dist/components/DataGrid/utils.cjs +191 -12
- package/dist/components/DataGrid/utils.css +178 -65
- package/dist/components/DataGrid/utils.js +25 -17
- package/dist/components/DateInput.cjs +251 -72
- package/dist/components/DateInput.css +178 -65
- package/dist/components/DateInput.js +25 -17
- package/dist/components/DateRangeInput.cjs +251 -72
- package/dist/components/DateRangeInput.css +178 -65
- package/dist/components/DateRangeInput.js +25 -17
- package/dist/components/Grid.cjs +81 -76
- package/dist/components/Grid.js +1 -1
- package/dist/components/ListGroup.cjs +553 -0
- package/dist/components/ListGroup.js +11 -0
- package/dist/components/MobileDataGrid/ColumnList.cjs +36 -0
- package/dist/components/MobileDataGrid/ColumnList.js +3 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +198 -19
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +178 -65
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +25 -17
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.cjs +36 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +242 -27
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +178 -65
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +25 -17
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.cjs +36 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +2 -2
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +36 -0
- package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +5 -5
- package/dist/components/MobileDataGrid/index.cjs +742 -527
- package/dist/components/MobileDataGrid/index.css +178 -65
- package/dist/components/MobileDataGrid/index.js +25 -17
- package/dist/components/Modal.js +2 -2
- package/dist/components/Notification.cjs +36 -0
- package/dist/components/Notification.js +1 -1
- package/dist/components/PDFViewer/PDFElement.cjs +36 -0
- package/dist/components/PDFViewer/PDFElement.js +2 -2
- package/dist/components/PDFViewer/PDFNavigation.cjs +36 -0
- package/dist/components/PDFViewer/PDFNavigation.js +2 -2
- package/dist/components/PDFViewer/index.cjs +36 -0
- package/dist/components/PDFViewer/index.js +8 -111
- package/dist/components/Pagination.cjs +427 -0
- package/dist/components/Pagination.js +10 -0
- package/dist/components/ProductImagePreview/index.cjs +139 -127
- package/dist/components/ProductImagePreview/index.js +5 -5
- package/dist/components/SideMenuGroup.cjs +36 -0
- package/dist/components/SideMenuGroup.js +1 -1
- package/dist/components/SideMenuItem.cjs +36 -0
- package/dist/components/SideMenuItem.js +1 -1
- package/dist/components/SimpleTable.cjs +521 -0
- package/dist/components/SimpleTable.js +10 -0
- package/dist/components/Stack.cjs +36 -0
- package/dist/components/Stack.js +1 -1
- package/dist/components/Swatch.cjs +36 -0
- package/dist/components/Swatch.js +1 -1
- package/dist/components/Time.cjs +36 -0
- package/dist/components/Time.js +1 -1
- package/dist/components/Tooltip.cjs +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Upload.cjs +36 -0
- package/dist/components/Upload.js +1 -1
- package/dist/components/index.cjs +739 -131
- package/dist/components/index.css +178 -65
- package/dist/components/index.js +37 -17
- package/dist/index.css +178 -65
- package/package.json +1 -1
- package/src/components/Card.tsx +60 -2
- package/src/components/CompactImagesPreview.tsx +54 -30
- package/src/components/Grid.tsx +59 -91
- package/src/components/ListGroup.tsx +82 -0
- package/src/components/Pagination.tsx +182 -0
- package/src/components/SimpleTable.tsx +77 -0
- package/src/components/Stack.tsx +76 -0
- package/src/components/Tooltip.tsx +4 -3
- package/src/components/index.ts +4 -0
- package/dist/chunk-ER6RCOH3.js +0 -97
- package/dist/chunk-EZCH4PQS.js +0 -29
- package/dist/{chunk-D6YCMQPO.js → chunk-SBCFBHNG.js} +3 -3
|
@@ -62,7 +62,7 @@ __export(DateInput_exports, {
|
|
|
62
62
|
DateInput: () => DateInput
|
|
63
63
|
});
|
|
64
64
|
module.exports = __toCommonJS(DateInput_exports);
|
|
65
|
-
var
|
|
65
|
+
var import_react38 = require("react");
|
|
66
66
|
var import_react_dom4 = require("react-dom");
|
|
67
67
|
|
|
68
68
|
// src/components/Input.tsx
|
|
@@ -716,8 +716,8 @@ Currency.displayName = "Currency";
|
|
|
716
716
|
Percentage.displayName = "Percentage";
|
|
717
717
|
|
|
718
718
|
// src/components/CalendarRange.tsx
|
|
719
|
-
var
|
|
720
|
-
var
|
|
719
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
720
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
721
721
|
var import_polyfill = require("@js-temporal/polyfill");
|
|
722
722
|
|
|
723
723
|
// src/components/DataGridCell.tsx
|
|
@@ -4048,7 +4048,7 @@ var Tooltip = ({
|
|
|
4048
4048
|
id,
|
|
4049
4049
|
"data-testid": testid,
|
|
4050
4050
|
ref,
|
|
4051
|
-
className: "relative inline-grid grid-cols-[auto_1fr] items-center",
|
|
4051
|
+
className: "relative inline-grid grid-cols-[auto_1fr] items-center cursor-pointer",
|
|
4052
4052
|
onMouseEnter: handleMouseEnter,
|
|
4053
4053
|
onMouseLeave: handleMouseLeave,
|
|
4054
4054
|
children: [
|
|
@@ -4639,12 +4639,11 @@ var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
|
4639
4639
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4640
4640
|
|
|
4641
4641
|
// src/components/Grid.tsx
|
|
4642
|
-
var import_react27 = require("react");
|
|
4643
4642
|
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
4644
4643
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4645
4644
|
|
|
4646
4645
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
4647
|
-
var
|
|
4646
|
+
var import_react27 = require("react");
|
|
4648
4647
|
|
|
4649
4648
|
// src/components/Spinner.tsx
|
|
4650
4649
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
@@ -4680,7 +4679,7 @@ Spinner.displayName = "Spinner";
|
|
|
4680
4679
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4681
4680
|
|
|
4682
4681
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4683
|
-
var
|
|
4682
|
+
var import_react28 = require("react");
|
|
4684
4683
|
|
|
4685
4684
|
// src/components/Surface.tsx
|
|
4686
4685
|
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
@@ -4725,22 +4724,202 @@ var import_clsx32 = require("clsx");
|
|
|
4725
4724
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4726
4725
|
|
|
4727
4726
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
4728
|
-
var
|
|
4727
|
+
var import_react29 = require("react");
|
|
4729
4728
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4730
4729
|
|
|
4731
4730
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
4732
|
-
var
|
|
4731
|
+
var import_react30 = require("react");
|
|
4733
4732
|
|
|
4734
4733
|
// src/components/ProductImagePreview/index.tsx
|
|
4735
4734
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4736
4735
|
|
|
4737
4736
|
// src/components/CompactImagesPreview.tsx
|
|
4738
|
-
var
|
|
4737
|
+
var import_react31 = require("react");
|
|
4739
4738
|
var import_clsx33 = __toESM(require("clsx"), 1);
|
|
4740
4739
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4741
4740
|
|
|
4742
|
-
// src/components/
|
|
4741
|
+
// src/components/SimpleTable.tsx
|
|
4742
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
4743
4743
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4744
|
+
|
|
4745
|
+
// src/components/PDFViewer/index.tsx
|
|
4746
|
+
var import_react34 = require("react");
|
|
4747
|
+
|
|
4748
|
+
// src/components/PDFViewer/PDFElement.tsx
|
|
4749
|
+
var import_react_pdf2 = require("@mikecousins/react-pdf");
|
|
4750
|
+
var import_react33 = require("react");
|
|
4751
|
+
|
|
4752
|
+
// src/components/PDFViewer/PDFPage.tsx
|
|
4753
|
+
var import_react_pdf = require("@mikecousins/react-pdf");
|
|
4754
|
+
var import_react32 = require("react");
|
|
4755
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4756
|
+
|
|
4757
|
+
// src/components/PDFViewer/PDFElement.tsx
|
|
4758
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
4759
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4760
|
+
|
|
4761
|
+
// src/components/PDFViewer/DownloadIcon.tsx
|
|
4762
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4763
|
+
|
|
4764
|
+
// src/components/PDFViewer/PDFNavigation.tsx
|
|
4765
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4766
|
+
|
|
4767
|
+
// src/components/PDFViewer/index.tsx
|
|
4768
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4769
|
+
|
|
4770
|
+
// src/components/ListGroup.tsx
|
|
4771
|
+
var import_react35 = require("react");
|
|
4772
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
4773
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4774
|
+
|
|
4775
|
+
// src/components/Pagination.tsx
|
|
4776
|
+
var import_react36 = require("react");
|
|
4777
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
4778
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4779
|
+
var Pagination = ({
|
|
4780
|
+
totalPages,
|
|
4781
|
+
currentPage,
|
|
4782
|
+
onPageChange,
|
|
4783
|
+
id,
|
|
4784
|
+
testid,
|
|
4785
|
+
className,
|
|
4786
|
+
disabled
|
|
4787
|
+
}) => {
|
|
4788
|
+
const goTo = (0, import_react36.useCallback)(
|
|
4789
|
+
(page) => {
|
|
4790
|
+
if (disabled) return;
|
|
4791
|
+
onPageChange(page);
|
|
4792
|
+
},
|
|
4793
|
+
[onPageChange, disabled]
|
|
4794
|
+
);
|
|
4795
|
+
const handleKey = (e) => {
|
|
4796
|
+
if (disabled) return;
|
|
4797
|
+
if (e.key === "ArrowLeft") {
|
|
4798
|
+
e.preventDefault();
|
|
4799
|
+
goTo(currentPage - 1);
|
|
4800
|
+
} else if (e.key === "ArrowRight") {
|
|
4801
|
+
e.preventDefault();
|
|
4802
|
+
goTo(currentPage + 1);
|
|
4803
|
+
}
|
|
4804
|
+
};
|
|
4805
|
+
const pageTokens = (0, import_react36.useMemo)(() => {
|
|
4806
|
+
if (totalPages <= 5) {
|
|
4807
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
4808
|
+
}
|
|
4809
|
+
const pages = /* @__PURE__ */ new Set();
|
|
4810
|
+
pages.add(1);
|
|
4811
|
+
pages.add(totalPages);
|
|
4812
|
+
if (currentPage <= 3) {
|
|
4813
|
+
pages.add(2);
|
|
4814
|
+
pages.add(3);
|
|
4815
|
+
pages.add(4);
|
|
4816
|
+
} else if (currentPage >= totalPages - 2) {
|
|
4817
|
+
pages.add(totalPages - 1);
|
|
4818
|
+
pages.add(totalPages - 2);
|
|
4819
|
+
pages.add(totalPages - 3);
|
|
4820
|
+
} else {
|
|
4821
|
+
pages.add(currentPage - 1);
|
|
4822
|
+
pages.add(currentPage);
|
|
4823
|
+
pages.add(currentPage + 1);
|
|
4824
|
+
}
|
|
4825
|
+
const sorted = Array.from(pages).sort((a, b) => a - b);
|
|
4826
|
+
const tokens = [];
|
|
4827
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
4828
|
+
const value = sorted[i];
|
|
4829
|
+
const prev = sorted[i - 1];
|
|
4830
|
+
if (i > 0) {
|
|
4831
|
+
if (value - prev === 2) {
|
|
4832
|
+
tokens.push(prev + 1);
|
|
4833
|
+
} else if (value - prev > 2) {
|
|
4834
|
+
tokens.push("ellipsis");
|
|
4835
|
+
}
|
|
4836
|
+
}
|
|
4837
|
+
tokens.push(value);
|
|
4838
|
+
}
|
|
4839
|
+
return tokens;
|
|
4840
|
+
}, [totalPages, currentPage]);
|
|
4841
|
+
if (totalPages <= 1) return null;
|
|
4842
|
+
const buttonClass = (0, import_clsx37.default)(
|
|
4843
|
+
"cursor-pointer disabled:cursor-default",
|
|
4844
|
+
paddingUsingComponentGap,
|
|
4845
|
+
"w-8 h-8",
|
|
4846
|
+
"flex items-center justify-center",
|
|
4847
|
+
"bg-transparent",
|
|
4848
|
+
"box-content",
|
|
4849
|
+
"hover:bg-background-grouped-secondary-normal",
|
|
4850
|
+
"focus:bg-background-grouped-secondary-normal focus:outline-0",
|
|
4851
|
+
"disabled:bg-transparent disabled:text-text-action-primary-disabled"
|
|
4852
|
+
);
|
|
4853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
4854
|
+
"nav",
|
|
4855
|
+
{
|
|
4856
|
+
id,
|
|
4857
|
+
"data-testid": testid,
|
|
4858
|
+
"aria-label": "Pagination",
|
|
4859
|
+
onKeyDown: handleKey,
|
|
4860
|
+
className: (0, import_clsx37.default)(
|
|
4861
|
+
"flex items-center",
|
|
4862
|
+
"border border-border-primary-normal",
|
|
4863
|
+
"bg-background-grouped-primary-normal",
|
|
4864
|
+
"rounded-sm",
|
|
4865
|
+
className
|
|
4866
|
+
),
|
|
4867
|
+
children: [
|
|
4868
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4869
|
+
"button",
|
|
4870
|
+
{
|
|
4871
|
+
disabled: disabled || currentPage <= 1,
|
|
4872
|
+
"aria-label": "Previous page",
|
|
4873
|
+
onClick: () => goTo(currentPage - 1),
|
|
4874
|
+
className: (0, import_clsx37.default)(buttonClass, "border-r-1 border-border-primary-normal"),
|
|
4875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: "keyboard_arrow_left" })
|
|
4876
|
+
}
|
|
4877
|
+
),
|
|
4878
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: (0, import_clsx37.default)("flex items-center"), children: pageTokens.map((token, index) => {
|
|
4879
|
+
if (token === "ellipsis") {
|
|
4880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4881
|
+
"li",
|
|
4882
|
+
{
|
|
4883
|
+
className: "w-8 h-8 select-none text-text-action-primary-disabled",
|
|
4884
|
+
children: "\u2026"
|
|
4885
|
+
},
|
|
4886
|
+
`ellipsis-${index}`
|
|
4887
|
+
);
|
|
4888
|
+
}
|
|
4889
|
+
const selected = token === currentPage;
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4891
|
+
"button",
|
|
4892
|
+
{
|
|
4893
|
+
"aria-label": `Page ${token}`,
|
|
4894
|
+
"aria-current": selected ? "page" : void 0,
|
|
4895
|
+
disabled,
|
|
4896
|
+
onClick: () => goTo(token),
|
|
4897
|
+
className: (0, import_clsx37.default)(
|
|
4898
|
+
buttonClass,
|
|
4899
|
+
selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
|
|
4900
|
+
),
|
|
4901
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Subheader, { align: "center", weight: "bold", children: token })
|
|
4902
|
+
}
|
|
4903
|
+
) }, token);
|
|
4904
|
+
}) }),
|
|
4905
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4906
|
+
"button",
|
|
4907
|
+
{
|
|
4908
|
+
disabled: disabled || currentPage >= totalPages,
|
|
4909
|
+
"aria-label": "Next page",
|
|
4910
|
+
onClick: () => goTo(currentPage + 1),
|
|
4911
|
+
className: (0, import_clsx37.default)(buttonClass, "border-l-1 border-border-primary-normal"),
|
|
4912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: "keyboard_arrow_right" })
|
|
4913
|
+
}
|
|
4914
|
+
)
|
|
4915
|
+
]
|
|
4916
|
+
}
|
|
4917
|
+
);
|
|
4918
|
+
};
|
|
4919
|
+
Pagination.displayName = "Pagination";
|
|
4920
|
+
|
|
4921
|
+
// src/components/CalendarRange.tsx
|
|
4922
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4744
4923
|
function DateCell(_a) {
|
|
4745
4924
|
var _b = _a, {
|
|
4746
4925
|
date,
|
|
@@ -4775,12 +4954,12 @@ function DateCell(_a) {
|
|
|
4775
4954
|
"id",
|
|
4776
4955
|
"testid"
|
|
4777
4956
|
]);
|
|
4778
|
-
return /* @__PURE__ */ (0,
|
|
4957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4779
4958
|
"span",
|
|
4780
4959
|
__spreadProps(__spreadValues({}, props), {
|
|
4781
4960
|
id,
|
|
4782
4961
|
"data-testid": testid,
|
|
4783
|
-
className: (0,
|
|
4962
|
+
className: (0, import_clsx38.default)(
|
|
4784
4963
|
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4785
4964
|
typography.caption,
|
|
4786
4965
|
cellPadding,
|
|
@@ -4850,20 +5029,20 @@ function CalendarRange({
|
|
|
4850
5029
|
const fromDate = parseDate(from);
|
|
4851
5030
|
const toDate = parseDate(to);
|
|
4852
5031
|
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4853
|
-
const [baseMonth, setBaseMonth] = (0,
|
|
5032
|
+
const [baseMonth, setBaseMonth] = (0, import_react37.useState)(
|
|
4854
5033
|
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4855
5034
|
);
|
|
4856
|
-
const [selecting, setSelecting] = (0,
|
|
4857
|
-
const [pendingFrom, setPendingFrom] = (0,
|
|
4858
|
-
const [hoveredDate, setHoveredDate] = (0,
|
|
4859
|
-
(0,
|
|
5035
|
+
const [selecting, setSelecting] = (0, import_react37.useState)("from");
|
|
5036
|
+
const [pendingFrom, setPendingFrom] = (0, import_react37.useState)(void 0);
|
|
5037
|
+
const [hoveredDate, setHoveredDate] = (0, import_react37.useState)(void 0);
|
|
5038
|
+
(0, import_react37.useEffect)(() => {
|
|
4860
5039
|
if (fromDate) {
|
|
4861
5040
|
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4862
5041
|
} else if (toDate) {
|
|
4863
5042
|
setBaseMonth(toDate.with({ day: 1 }));
|
|
4864
5043
|
}
|
|
4865
5044
|
}, [from, to]);
|
|
4866
|
-
(0,
|
|
5045
|
+
(0, import_react37.useEffect)(() => {
|
|
4867
5046
|
if (fromDate && toDate) {
|
|
4868
5047
|
setSelecting("from");
|
|
4869
5048
|
setPendingFrom(void 0);
|
|
@@ -4929,12 +5108,12 @@ function CalendarRange({
|
|
|
4929
5108
|
}
|
|
4930
5109
|
return false;
|
|
4931
5110
|
}
|
|
4932
|
-
return /* @__PURE__ */ (0,
|
|
5111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4933
5112
|
"div",
|
|
4934
5113
|
{
|
|
4935
5114
|
id,
|
|
4936
5115
|
"data-testid": testid,
|
|
4937
|
-
className: (0,
|
|
5116
|
+
className: (0, import_clsx38.default)(
|
|
4938
5117
|
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4939
5118
|
layoutPaddding,
|
|
4940
5119
|
layoutGap,
|
|
@@ -4942,15 +5121,15 @@ function CalendarRange({
|
|
|
4942
5121
|
// baseTransition,
|
|
4943
5122
|
"overflow-hidden"
|
|
4944
5123
|
),
|
|
4945
|
-
children: /* @__PURE__ */ (0,
|
|
5124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4946
5125
|
"div",
|
|
4947
5126
|
{
|
|
4948
|
-
className: (0,
|
|
5127
|
+
className: (0, import_clsx38.default)(
|
|
4949
5128
|
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4950
5129
|
layoutGap
|
|
4951
5130
|
),
|
|
4952
5131
|
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4953
|
-
return /* @__PURE__ */ (0,
|
|
5132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4954
5133
|
CalendarPane,
|
|
4955
5134
|
{
|
|
4956
5135
|
getMonthData,
|
|
@@ -5008,45 +5187,45 @@ function CalendarPane({
|
|
|
5008
5187
|
const years = Array.from({ length: 100 }).map(
|
|
5009
5188
|
(_, i) => baseMonth.year - 50 + i
|
|
5010
5189
|
);
|
|
5011
|
-
const [monthMenuOpen, setMonthMenuOpen] = (0,
|
|
5012
|
-
const [yearMenuOpen, setYearMenuOpen] = (0,
|
|
5013
|
-
const monthMenuRef = (0,
|
|
5014
|
-
const yearMenuRef = (0,
|
|
5190
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react37.useState)(false);
|
|
5191
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react37.useState)(false);
|
|
5192
|
+
const monthMenuRef = (0, import_react37.useRef)(null);
|
|
5193
|
+
const yearMenuRef = (0, import_react37.useRef)(null);
|
|
5015
5194
|
const month = getMonthData(offset);
|
|
5016
5195
|
const totalCells = 42;
|
|
5017
5196
|
const emptyCells = month.firstDayOffset;
|
|
5018
|
-
return /* @__PURE__ */ (0,
|
|
5019
|
-
/* @__PURE__ */ (0,
|
|
5197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react37.default.Fragment, { children: [
|
|
5198
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5020
5199
|
"div",
|
|
5021
5200
|
{
|
|
5022
|
-
className: (0,
|
|
5201
|
+
className: (0, import_clsx38.default)("flex flex-col"),
|
|
5023
5202
|
children: [
|
|
5024
|
-
/* @__PURE__ */ (0,
|
|
5203
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5025
5204
|
"div",
|
|
5026
5205
|
{
|
|
5027
|
-
className: (0,
|
|
5206
|
+
className: (0, import_clsx38.default)(
|
|
5028
5207
|
"flex flex-row items-center justify-between",
|
|
5029
5208
|
typography.label,
|
|
5030
5209
|
"text-text-action-primary-normal"
|
|
5031
5210
|
),
|
|
5032
5211
|
children: [
|
|
5033
|
-
idx === 0 ? /* @__PURE__ */ (0,
|
|
5212
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5034
5213
|
"button",
|
|
5035
5214
|
{
|
|
5036
5215
|
id: id ? `${id}-prev-month-button` : void 0,
|
|
5037
5216
|
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
5038
5217
|
type: "button",
|
|
5039
|
-
className: (0,
|
|
5218
|
+
className: (0, import_clsx38.default)(
|
|
5040
5219
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
5041
5220
|
componentPadding
|
|
5042
5221
|
),
|
|
5043
5222
|
"aria-label": "Previous month",
|
|
5044
5223
|
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
5045
|
-
children: /* @__PURE__ */ (0,
|
|
5224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
5046
5225
|
}
|
|
5047
|
-
) : /* @__PURE__ */ (0,
|
|
5048
|
-
/* @__PURE__ */ (0,
|
|
5049
|
-
/* @__PURE__ */ (0,
|
|
5226
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: (0, import_clsx38.default)(componentPadding, "mr-1") }),
|
|
5227
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex gap-desktop-compact-component-padding", children: [
|
|
5228
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5050
5229
|
"button",
|
|
5051
5230
|
{
|
|
5052
5231
|
ref: (el) => {
|
|
@@ -5061,13 +5240,13 @@ function CalendarPane({
|
|
|
5061
5240
|
children: month.name
|
|
5062
5241
|
}
|
|
5063
5242
|
),
|
|
5064
|
-
/* @__PURE__ */ (0,
|
|
5243
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5065
5244
|
Menu,
|
|
5066
5245
|
{
|
|
5067
5246
|
show: monthMenuOpen,
|
|
5068
5247
|
positionTo: monthMenuRef,
|
|
5069
5248
|
setShow: () => setMonthMenuOpen(false),
|
|
5070
|
-
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0,
|
|
5249
|
+
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5071
5250
|
MenuOption,
|
|
5072
5251
|
{
|
|
5073
5252
|
selected: baseMonth.month === x + 1,
|
|
@@ -5081,7 +5260,7 @@ function CalendarPane({
|
|
|
5081
5260
|
))
|
|
5082
5261
|
}
|
|
5083
5262
|
),
|
|
5084
|
-
/* @__PURE__ */ (0,
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5085
5264
|
"button",
|
|
5086
5265
|
{
|
|
5087
5266
|
ref: (el) => {
|
|
@@ -5096,13 +5275,13 @@ function CalendarPane({
|
|
|
5096
5275
|
children: month.year
|
|
5097
5276
|
}
|
|
5098
5277
|
),
|
|
5099
|
-
/* @__PURE__ */ (0,
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5100
5279
|
Menu,
|
|
5101
5280
|
{
|
|
5102
5281
|
show: yearMenuOpen,
|
|
5103
5282
|
positionTo: yearMenuRef,
|
|
5104
5283
|
setShow: () => setYearMenuOpen(false),
|
|
5105
|
-
children: years.map((y) => /* @__PURE__ */ (0,
|
|
5284
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5106
5285
|
MenuOption,
|
|
5107
5286
|
{
|
|
5108
5287
|
selected: baseMonth.year === y,
|
|
@@ -5117,28 +5296,28 @@ function CalendarPane({
|
|
|
5117
5296
|
}
|
|
5118
5297
|
)
|
|
5119
5298
|
] }),
|
|
5120
|
-
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0,
|
|
5299
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5121
5300
|
"button",
|
|
5122
5301
|
{
|
|
5123
5302
|
id: id ? `${id}-next-month-button` : void 0,
|
|
5124
5303
|
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
5125
5304
|
type: "button",
|
|
5126
|
-
className: (0,
|
|
5305
|
+
className: (0, import_clsx38.default)(
|
|
5127
5306
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
5128
5307
|
componentPadding
|
|
5129
5308
|
),
|
|
5130
5309
|
"aria-label": "Next month",
|
|
5131
5310
|
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
5132
|
-
children: /* @__PURE__ */ (0,
|
|
5311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
5133
5312
|
}
|
|
5134
|
-
) : /* @__PURE__ */ (0,
|
|
5313
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: (0, import_clsx38.default)(componentPadding, "ml-1") })
|
|
5135
5314
|
]
|
|
5136
5315
|
}
|
|
5137
5316
|
),
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5317
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: (0, import_clsx38.default)("grid grid-cols-7"), children: weekDays.map((d) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5139
5318
|
"span",
|
|
5140
5319
|
{
|
|
5141
|
-
className: (0,
|
|
5320
|
+
className: (0, import_clsx38.default)(
|
|
5142
5321
|
typography.caption,
|
|
5143
5322
|
"text-text-secondary-normal text-center",
|
|
5144
5323
|
"w-10"
|
|
@@ -5147,7 +5326,7 @@ function CalendarPane({
|
|
|
5147
5326
|
},
|
|
5148
5327
|
d
|
|
5149
5328
|
)) }),
|
|
5150
|
-
/* @__PURE__ */ (0,
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: (0, import_clsx38.default)("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
|
|
5151
5330
|
const day = i - emptyCells + 1;
|
|
5152
5331
|
const date = month.date.with({ day: 1 }).add({
|
|
5153
5332
|
days: i - emptyCells
|
|
@@ -5161,7 +5340,7 @@ function CalendarPane({
|
|
|
5161
5340
|
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
5162
5341
|
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
5163
5342
|
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
5164
|
-
return /* @__PURE__ */ (0,
|
|
5343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5165
5344
|
DateCell,
|
|
5166
5345
|
{
|
|
5167
5346
|
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
@@ -5186,10 +5365,10 @@ function CalendarPane({
|
|
|
5186
5365
|
]
|
|
5187
5366
|
}
|
|
5188
5367
|
),
|
|
5189
|
-
mode === "double" && idx === 0 && /* @__PURE__ */ (0,
|
|
5368
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5190
5369
|
"div",
|
|
5191
5370
|
{
|
|
5192
|
-
className: (0,
|
|
5371
|
+
className: (0, import_clsx38.default)(
|
|
5193
5372
|
"self-stretch bg-border-primary-normal rounded-base",
|
|
5194
5373
|
// 1px width, full height, matches Figma divider
|
|
5195
5374
|
"w-px"
|
|
@@ -5200,7 +5379,7 @@ function CalendarPane({
|
|
|
5200
5379
|
}
|
|
5201
5380
|
|
|
5202
5381
|
// src/components/DateInput.tsx
|
|
5203
|
-
var
|
|
5382
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5204
5383
|
var DateInput = (_a) => {
|
|
5205
5384
|
var _b = _a, {
|
|
5206
5385
|
id,
|
|
@@ -5221,24 +5400,24 @@ var DateInput = (_a) => {
|
|
|
5221
5400
|
"readOnly",
|
|
5222
5401
|
"label"
|
|
5223
5402
|
]);
|
|
5224
|
-
const [visible, setVisible] = (0,
|
|
5225
|
-
const [inputValue, setInputValue] = (0,
|
|
5226
|
-
const [isTyping, setIsTyping] = (0,
|
|
5227
|
-
const popoverRef = (0,
|
|
5228
|
-
const triggerRef = (0,
|
|
5229
|
-
const rootRef = (0,
|
|
5230
|
-
const [calendarPosition, setCalendarPosition] = (0,
|
|
5403
|
+
const [visible, setVisible] = (0, import_react38.useState)(false);
|
|
5404
|
+
const [inputValue, setInputValue] = (0, import_react38.useState)("");
|
|
5405
|
+
const [isTyping, setIsTyping] = (0, import_react38.useState)(false);
|
|
5406
|
+
const popoverRef = (0, import_react38.useRef)(null);
|
|
5407
|
+
const triggerRef = (0, import_react38.useRef)(null);
|
|
5408
|
+
const rootRef = (0, import_react38.useRef)(null);
|
|
5409
|
+
const [calendarPosition, setCalendarPosition] = (0, import_react38.useState)({
|
|
5231
5410
|
top: 0,
|
|
5232
5411
|
left: 0,
|
|
5233
5412
|
width: 0
|
|
5234
5413
|
});
|
|
5235
5414
|
const [from, to] = [value, ""];
|
|
5236
|
-
(0,
|
|
5415
|
+
(0, import_react38.useEffect)(() => {
|
|
5237
5416
|
if (!isTyping) {
|
|
5238
5417
|
setInputValue(formatDisplayValue(from));
|
|
5239
5418
|
}
|
|
5240
5419
|
}, [from, isTyping]);
|
|
5241
|
-
(0,
|
|
5420
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
5242
5421
|
if (visible) {
|
|
5243
5422
|
updatePosition();
|
|
5244
5423
|
}
|
|
@@ -5253,7 +5432,7 @@ var DateInput = (_a) => {
|
|
|
5253
5432
|
});
|
|
5254
5433
|
}
|
|
5255
5434
|
};
|
|
5256
|
-
(0,
|
|
5435
|
+
(0, import_react38.useEffect)(() => {
|
|
5257
5436
|
updatePosition();
|
|
5258
5437
|
const resizeObserver = new ResizeObserver(updatePosition);
|
|
5259
5438
|
if (triggerRef.current) {
|
|
@@ -5265,7 +5444,7 @@ var DateInput = (_a) => {
|
|
|
5265
5444
|
window.removeEventListener("scroll", updatePosition);
|
|
5266
5445
|
};
|
|
5267
5446
|
}, []);
|
|
5268
|
-
(0,
|
|
5447
|
+
(0, import_react38.useEffect)(() => {
|
|
5269
5448
|
const handleKeyDown2 = (event) => {
|
|
5270
5449
|
var _a2;
|
|
5271
5450
|
if (event.key === "Escape" && popoverRef.current) {
|
|
@@ -5278,7 +5457,7 @@ var DateInput = (_a) => {
|
|
|
5278
5457
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
5279
5458
|
};
|
|
5280
5459
|
});
|
|
5281
|
-
(0,
|
|
5460
|
+
(0, import_react38.useEffect)(() => {
|
|
5282
5461
|
const handleClickOutside = (event) => {
|
|
5283
5462
|
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
5284
5463
|
setVisible(false);
|
|
@@ -5359,8 +5538,8 @@ var DateInput = (_a) => {
|
|
|
5359
5538
|
}
|
|
5360
5539
|
}
|
|
5361
5540
|
};
|
|
5362
|
-
return /* @__PURE__ */ (0,
|
|
5363
|
-
/* @__PURE__ */ (0,
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "relative", children: [
|
|
5542
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5364
5543
|
InputBase,
|
|
5365
5544
|
__spreadProps(__spreadValues({
|
|
5366
5545
|
id,
|
|
@@ -5374,7 +5553,7 @@ var DateInput = (_a) => {
|
|
|
5374
5553
|
placeholder,
|
|
5375
5554
|
disabled,
|
|
5376
5555
|
readOnly,
|
|
5377
|
-
after: /* @__PURE__ */ (0,
|
|
5556
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: "calendar_month" }),
|
|
5378
5557
|
onFocus: handleFocus,
|
|
5379
5558
|
onClick: handleClick,
|
|
5380
5559
|
onChange: handleInputChange,
|
|
@@ -5385,7 +5564,7 @@ var DateInput = (_a) => {
|
|
|
5385
5564
|
})
|
|
5386
5565
|
),
|
|
5387
5566
|
visible && !readOnly && (0, import_react_dom4.createPortal)(
|
|
5388
|
-
/* @__PURE__ */ (0,
|
|
5567
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5389
5568
|
"div",
|
|
5390
5569
|
{
|
|
5391
5570
|
ref: (el) => {
|
|
@@ -5397,7 +5576,7 @@ var DateInput = (_a) => {
|
|
|
5397
5576
|
left: `${calendarPosition.left}px`,
|
|
5398
5577
|
minWidth: `${calendarPosition.width}px`
|
|
5399
5578
|
},
|
|
5400
|
-
children: /* @__PURE__ */ (0,
|
|
5579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5401
5580
|
CalendarRange,
|
|
5402
5581
|
{
|
|
5403
5582
|
id: id ? `${id}-calendar` : void 0,
|