@dmsi/wedgekit-react 0.0.415 → 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-BK7SPR6Y.js → chunk-HYJIDHAK.js} +6 -6
- package/dist/{chunk-ZHZIIVJN.js → chunk-IMOIZFJZ.js} +5 -5
- 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-7ULLUUVJ.js → chunk-PQWWVBSR.js} +1 -1
- 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 +228 -53
- package/dist/components/CalendarRange.css +169 -65
- package/dist/components/CalendarRange.js +23 -16
- 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 +186 -11
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +169 -65
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +23 -16
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +195 -20
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +169 -65
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +23 -16
- package/dist/components/DataGrid/PinnedColumns.cjs +211 -36
- package/dist/components/DataGrid/PinnedColumns.css +169 -65
- package/dist/components/DataGrid/PinnedColumns.js +23 -16
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +187 -12
- package/dist/components/DataGrid/TableBody/LoadingCell.css +169 -65
- package/dist/components/DataGrid/TableBody/LoadingCell.js +23 -16
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +193 -18
- package/dist/components/DataGrid/TableBody/TableBodyRow.css +169 -65
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +23 -16
- package/dist/components/DataGrid/TableBody/index.cjs +208 -33
- package/dist/components/DataGrid/TableBody/index.css +169 -65
- package/dist/components/DataGrid/TableBody/index.js +23 -16
- package/dist/components/DataGrid/index.cjs +297 -122
- package/dist/components/DataGrid/index.css +169 -65
- package/dist/components/DataGrid/index.js +23 -16
- package/dist/components/DataGrid/utils.cjs +187 -12
- package/dist/components/DataGrid/utils.css +169 -65
- package/dist/components/DataGrid/utils.js +23 -16
- package/dist/components/DateInput.cjs +247 -72
- package/dist/components/DateInput.css +169 -65
- package/dist/components/DateInput.js +23 -16
- package/dist/components/DateRangeInput.cjs +247 -72
- package/dist/components/DateRangeInput.css +169 -65
- package/dist/components/DateRangeInput.js +23 -16
- 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 +194 -19
- package/dist/components/MobileDataGrid/ColumnSelector/index.css +169 -65
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +23 -16
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.cjs +36 -0
- package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +2 -2
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +238 -27
- package/dist/components/MobileDataGrid/MobileDataGridHeader.css +169 -65
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +23 -16
- 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 +740 -529
- package/dist/components/MobileDataGrid/index.css +169 -65
- package/dist/components/MobileDataGrid/index.js +23 -16
- 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 +4 -4
- 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 +36 -0
- package/dist/components/SimpleTable.js +2 -2
- 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 +686 -131
- package/dist/components/index.css +169 -65
- package/dist/components/index.js +33 -17
- package/dist/index.css +169 -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/Stack.tsx +76 -0
- package/src/components/Tooltip.tsx +4 -3
- package/src/components/index.ts +3 -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,17 +4724,17 @@ 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
|
|
|
@@ -4743,8 +4742,184 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
|
4743
4742
|
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
4744
4743
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4745
4744
|
|
|
4746
|
-
// src/components/
|
|
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");
|
|
4747
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");
|
|
4748
4923
|
function DateCell(_a) {
|
|
4749
4924
|
var _b = _a, {
|
|
4750
4925
|
date,
|
|
@@ -4779,12 +4954,12 @@ function DateCell(_a) {
|
|
|
4779
4954
|
"id",
|
|
4780
4955
|
"testid"
|
|
4781
4956
|
]);
|
|
4782
|
-
return /* @__PURE__ */ (0,
|
|
4957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4783
4958
|
"span",
|
|
4784
4959
|
__spreadProps(__spreadValues({}, props), {
|
|
4785
4960
|
id,
|
|
4786
4961
|
"data-testid": testid,
|
|
4787
|
-
className: (0,
|
|
4962
|
+
className: (0, import_clsx38.default)(
|
|
4788
4963
|
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4789
4964
|
typography.caption,
|
|
4790
4965
|
cellPadding,
|
|
@@ -4854,20 +5029,20 @@ function CalendarRange({
|
|
|
4854
5029
|
const fromDate = parseDate(from);
|
|
4855
5030
|
const toDate = parseDate(to);
|
|
4856
5031
|
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4857
|
-
const [baseMonth, setBaseMonth] = (0,
|
|
5032
|
+
const [baseMonth, setBaseMonth] = (0, import_react37.useState)(
|
|
4858
5033
|
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4859
5034
|
);
|
|
4860
|
-
const [selecting, setSelecting] = (0,
|
|
4861
|
-
const [pendingFrom, setPendingFrom] = (0,
|
|
4862
|
-
const [hoveredDate, setHoveredDate] = (0,
|
|
4863
|
-
(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)(() => {
|
|
4864
5039
|
if (fromDate) {
|
|
4865
5040
|
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4866
5041
|
} else if (toDate) {
|
|
4867
5042
|
setBaseMonth(toDate.with({ day: 1 }));
|
|
4868
5043
|
}
|
|
4869
5044
|
}, [from, to]);
|
|
4870
|
-
(0,
|
|
5045
|
+
(0, import_react37.useEffect)(() => {
|
|
4871
5046
|
if (fromDate && toDate) {
|
|
4872
5047
|
setSelecting("from");
|
|
4873
5048
|
setPendingFrom(void 0);
|
|
@@ -4933,12 +5108,12 @@ function CalendarRange({
|
|
|
4933
5108
|
}
|
|
4934
5109
|
return false;
|
|
4935
5110
|
}
|
|
4936
|
-
return /* @__PURE__ */ (0,
|
|
5111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4937
5112
|
"div",
|
|
4938
5113
|
{
|
|
4939
5114
|
id,
|
|
4940
5115
|
"data-testid": testid,
|
|
4941
|
-
className: (0,
|
|
5116
|
+
className: (0, import_clsx38.default)(
|
|
4942
5117
|
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4943
5118
|
layoutPaddding,
|
|
4944
5119
|
layoutGap,
|
|
@@ -4946,15 +5121,15 @@ function CalendarRange({
|
|
|
4946
5121
|
// baseTransition,
|
|
4947
5122
|
"overflow-hidden"
|
|
4948
5123
|
),
|
|
4949
|
-
children: /* @__PURE__ */ (0,
|
|
5124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4950
5125
|
"div",
|
|
4951
5126
|
{
|
|
4952
|
-
className: (0,
|
|
5127
|
+
className: (0, import_clsx38.default)(
|
|
4953
5128
|
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4954
5129
|
layoutGap
|
|
4955
5130
|
),
|
|
4956
5131
|
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4957
|
-
return /* @__PURE__ */ (0,
|
|
5132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4958
5133
|
CalendarPane,
|
|
4959
5134
|
{
|
|
4960
5135
|
getMonthData,
|
|
@@ -5012,45 +5187,45 @@ function CalendarPane({
|
|
|
5012
5187
|
const years = Array.from({ length: 100 }).map(
|
|
5013
5188
|
(_, i) => baseMonth.year - 50 + i
|
|
5014
5189
|
);
|
|
5015
|
-
const [monthMenuOpen, setMonthMenuOpen] = (0,
|
|
5016
|
-
const [yearMenuOpen, setYearMenuOpen] = (0,
|
|
5017
|
-
const monthMenuRef = (0,
|
|
5018
|
-
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);
|
|
5019
5194
|
const month = getMonthData(offset);
|
|
5020
5195
|
const totalCells = 42;
|
|
5021
5196
|
const emptyCells = month.firstDayOffset;
|
|
5022
|
-
return /* @__PURE__ */ (0,
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react37.default.Fragment, { children: [
|
|
5198
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5024
5199
|
"div",
|
|
5025
5200
|
{
|
|
5026
|
-
className: (0,
|
|
5201
|
+
className: (0, import_clsx38.default)("flex flex-col"),
|
|
5027
5202
|
children: [
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5203
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5029
5204
|
"div",
|
|
5030
5205
|
{
|
|
5031
|
-
className: (0,
|
|
5206
|
+
className: (0, import_clsx38.default)(
|
|
5032
5207
|
"flex flex-row items-center justify-between",
|
|
5033
5208
|
typography.label,
|
|
5034
5209
|
"text-text-action-primary-normal"
|
|
5035
5210
|
),
|
|
5036
5211
|
children: [
|
|
5037
|
-
idx === 0 ? /* @__PURE__ */ (0,
|
|
5212
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5038
5213
|
"button",
|
|
5039
5214
|
{
|
|
5040
5215
|
id: id ? `${id}-prev-month-button` : void 0,
|
|
5041
5216
|
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
5042
5217
|
type: "button",
|
|
5043
|
-
className: (0,
|
|
5218
|
+
className: (0, import_clsx38.default)(
|
|
5044
5219
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
5045
5220
|
componentPadding
|
|
5046
5221
|
),
|
|
5047
5222
|
"aria-label": "Previous month",
|
|
5048
5223
|
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
5049
|
-
children: /* @__PURE__ */ (0,
|
|
5224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
5050
5225
|
}
|
|
5051
|
-
) : /* @__PURE__ */ (0,
|
|
5052
|
-
/* @__PURE__ */ (0,
|
|
5053
|
-
/* @__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)(
|
|
5054
5229
|
"button",
|
|
5055
5230
|
{
|
|
5056
5231
|
ref: (el) => {
|
|
@@ -5065,13 +5240,13 @@ function CalendarPane({
|
|
|
5065
5240
|
children: month.name
|
|
5066
5241
|
}
|
|
5067
5242
|
),
|
|
5068
|
-
/* @__PURE__ */ (0,
|
|
5243
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5069
5244
|
Menu,
|
|
5070
5245
|
{
|
|
5071
5246
|
show: monthMenuOpen,
|
|
5072
5247
|
positionTo: monthMenuRef,
|
|
5073
5248
|
setShow: () => setMonthMenuOpen(false),
|
|
5074
|
-
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)(
|
|
5075
5250
|
MenuOption,
|
|
5076
5251
|
{
|
|
5077
5252
|
selected: baseMonth.month === x + 1,
|
|
@@ -5085,7 +5260,7 @@ function CalendarPane({
|
|
|
5085
5260
|
))
|
|
5086
5261
|
}
|
|
5087
5262
|
),
|
|
5088
|
-
/* @__PURE__ */ (0,
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5089
5264
|
"button",
|
|
5090
5265
|
{
|
|
5091
5266
|
ref: (el) => {
|
|
@@ -5100,13 +5275,13 @@ function CalendarPane({
|
|
|
5100
5275
|
children: month.year
|
|
5101
5276
|
}
|
|
5102
5277
|
),
|
|
5103
|
-
/* @__PURE__ */ (0,
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5104
5279
|
Menu,
|
|
5105
5280
|
{
|
|
5106
5281
|
show: yearMenuOpen,
|
|
5107
5282
|
positionTo: yearMenuRef,
|
|
5108
5283
|
setShow: () => setYearMenuOpen(false),
|
|
5109
|
-
children: years.map((y) => /* @__PURE__ */ (0,
|
|
5284
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5110
5285
|
MenuOption,
|
|
5111
5286
|
{
|
|
5112
5287
|
selected: baseMonth.year === y,
|
|
@@ -5121,28 +5296,28 @@ function CalendarPane({
|
|
|
5121
5296
|
}
|
|
5122
5297
|
)
|
|
5123
5298
|
] }),
|
|
5124
|
-
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0,
|
|
5299
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5125
5300
|
"button",
|
|
5126
5301
|
{
|
|
5127
5302
|
id: id ? `${id}-next-month-button` : void 0,
|
|
5128
5303
|
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
5129
5304
|
type: "button",
|
|
5130
|
-
className: (0,
|
|
5305
|
+
className: (0, import_clsx38.default)(
|
|
5131
5306
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
5132
5307
|
componentPadding
|
|
5133
5308
|
),
|
|
5134
5309
|
"aria-label": "Next month",
|
|
5135
5310
|
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
5136
|
-
children: /* @__PURE__ */ (0,
|
|
5311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
5137
5312
|
}
|
|
5138
|
-
) : /* @__PURE__ */ (0,
|
|
5313
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: (0, import_clsx38.default)(componentPadding, "ml-1") })
|
|
5139
5314
|
]
|
|
5140
5315
|
}
|
|
5141
5316
|
),
|
|
5142
|
-
/* @__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)(
|
|
5143
5318
|
"span",
|
|
5144
5319
|
{
|
|
5145
|
-
className: (0,
|
|
5320
|
+
className: (0, import_clsx38.default)(
|
|
5146
5321
|
typography.caption,
|
|
5147
5322
|
"text-text-secondary-normal text-center",
|
|
5148
5323
|
"w-10"
|
|
@@ -5151,7 +5326,7 @@ function CalendarPane({
|
|
|
5151
5326
|
},
|
|
5152
5327
|
d
|
|
5153
5328
|
)) }),
|
|
5154
|
-
/* @__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) => {
|
|
5155
5330
|
const day = i - emptyCells + 1;
|
|
5156
5331
|
const date = month.date.with({ day: 1 }).add({
|
|
5157
5332
|
days: i - emptyCells
|
|
@@ -5165,7 +5340,7 @@ function CalendarPane({
|
|
|
5165
5340
|
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
5166
5341
|
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
5167
5342
|
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
5168
|
-
return /* @__PURE__ */ (0,
|
|
5343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5169
5344
|
DateCell,
|
|
5170
5345
|
{
|
|
5171
5346
|
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
@@ -5190,10 +5365,10 @@ function CalendarPane({
|
|
|
5190
5365
|
]
|
|
5191
5366
|
}
|
|
5192
5367
|
),
|
|
5193
|
-
mode === "double" && idx === 0 && /* @__PURE__ */ (0,
|
|
5368
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5194
5369
|
"div",
|
|
5195
5370
|
{
|
|
5196
|
-
className: (0,
|
|
5371
|
+
className: (0, import_clsx38.default)(
|
|
5197
5372
|
"self-stretch bg-border-primary-normal rounded-base",
|
|
5198
5373
|
// 1px width, full height, matches Figma divider
|
|
5199
5374
|
"w-px"
|
|
@@ -5204,7 +5379,7 @@ function CalendarPane({
|
|
|
5204
5379
|
}
|
|
5205
5380
|
|
|
5206
5381
|
// src/components/DateInput.tsx
|
|
5207
|
-
var
|
|
5382
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5208
5383
|
var DateInput = (_a) => {
|
|
5209
5384
|
var _b = _a, {
|
|
5210
5385
|
id,
|
|
@@ -5225,24 +5400,24 @@ var DateInput = (_a) => {
|
|
|
5225
5400
|
"readOnly",
|
|
5226
5401
|
"label"
|
|
5227
5402
|
]);
|
|
5228
|
-
const [visible, setVisible] = (0,
|
|
5229
|
-
const [inputValue, setInputValue] = (0,
|
|
5230
|
-
const [isTyping, setIsTyping] = (0,
|
|
5231
|
-
const popoverRef = (0,
|
|
5232
|
-
const triggerRef = (0,
|
|
5233
|
-
const rootRef = (0,
|
|
5234
|
-
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)({
|
|
5235
5410
|
top: 0,
|
|
5236
5411
|
left: 0,
|
|
5237
5412
|
width: 0
|
|
5238
5413
|
});
|
|
5239
5414
|
const [from, to] = [value, ""];
|
|
5240
|
-
(0,
|
|
5415
|
+
(0, import_react38.useEffect)(() => {
|
|
5241
5416
|
if (!isTyping) {
|
|
5242
5417
|
setInputValue(formatDisplayValue(from));
|
|
5243
5418
|
}
|
|
5244
5419
|
}, [from, isTyping]);
|
|
5245
|
-
(0,
|
|
5420
|
+
(0, import_react38.useLayoutEffect)(() => {
|
|
5246
5421
|
if (visible) {
|
|
5247
5422
|
updatePosition();
|
|
5248
5423
|
}
|
|
@@ -5257,7 +5432,7 @@ var DateInput = (_a) => {
|
|
|
5257
5432
|
});
|
|
5258
5433
|
}
|
|
5259
5434
|
};
|
|
5260
|
-
(0,
|
|
5435
|
+
(0, import_react38.useEffect)(() => {
|
|
5261
5436
|
updatePosition();
|
|
5262
5437
|
const resizeObserver = new ResizeObserver(updatePosition);
|
|
5263
5438
|
if (triggerRef.current) {
|
|
@@ -5269,7 +5444,7 @@ var DateInput = (_a) => {
|
|
|
5269
5444
|
window.removeEventListener("scroll", updatePosition);
|
|
5270
5445
|
};
|
|
5271
5446
|
}, []);
|
|
5272
|
-
(0,
|
|
5447
|
+
(0, import_react38.useEffect)(() => {
|
|
5273
5448
|
const handleKeyDown2 = (event) => {
|
|
5274
5449
|
var _a2;
|
|
5275
5450
|
if (event.key === "Escape" && popoverRef.current) {
|
|
@@ -5282,7 +5457,7 @@ var DateInput = (_a) => {
|
|
|
5282
5457
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
5283
5458
|
};
|
|
5284
5459
|
});
|
|
5285
|
-
(0,
|
|
5460
|
+
(0, import_react38.useEffect)(() => {
|
|
5286
5461
|
const handleClickOutside = (event) => {
|
|
5287
5462
|
if (popoverRef.current && !popoverRef.current.contains(event.target) && triggerRef.current && !triggerRef.current.contains(event.target)) {
|
|
5288
5463
|
setVisible(false);
|
|
@@ -5363,8 +5538,8 @@ var DateInput = (_a) => {
|
|
|
5363
5538
|
}
|
|
5364
5539
|
}
|
|
5365
5540
|
};
|
|
5366
|
-
return /* @__PURE__ */ (0,
|
|
5367
|
-
/* @__PURE__ */ (0,
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "relative", children: [
|
|
5542
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5368
5543
|
InputBase,
|
|
5369
5544
|
__spreadProps(__spreadValues({
|
|
5370
5545
|
id,
|
|
@@ -5378,7 +5553,7 @@ var DateInput = (_a) => {
|
|
|
5378
5553
|
placeholder,
|
|
5379
5554
|
disabled,
|
|
5380
5555
|
readOnly,
|
|
5381
|
-
after: /* @__PURE__ */ (0,
|
|
5556
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Icon, { name: "calendar_month" }),
|
|
5382
5557
|
onFocus: handleFocus,
|
|
5383
5558
|
onClick: handleClick,
|
|
5384
5559
|
onChange: handleInputChange,
|
|
@@ -5389,7 +5564,7 @@ var DateInput = (_a) => {
|
|
|
5389
5564
|
})
|
|
5390
5565
|
),
|
|
5391
5566
|
visible && !readOnly && (0, import_react_dom4.createPortal)(
|
|
5392
|
-
/* @__PURE__ */ (0,
|
|
5567
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5393
5568
|
"div",
|
|
5394
5569
|
{
|
|
5395
5570
|
ref: (el) => {
|
|
@@ -5401,7 +5576,7 @@ var DateInput = (_a) => {
|
|
|
5401
5576
|
left: `${calendarPosition.left}px`,
|
|
5402
5577
|
minWidth: `${calendarPosition.width}px`
|
|
5403
5578
|
},
|
|
5404
|
-
children: /* @__PURE__ */ (0,
|
|
5579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5405
5580
|
CalendarRange,
|
|
5406
5581
|
{
|
|
5407
5582
|
id: id ? `${id}-calendar` : void 0,
|