@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
|
@@ -64,7 +64,7 @@ __export(CalendarRange_exports, {
|
|
|
64
64
|
isWeekend: () => isWeekend
|
|
65
65
|
});
|
|
66
66
|
module.exports = __toCommonJS(CalendarRange_exports);
|
|
67
|
-
var
|
|
67
|
+
var import_clsx38 = __toESM(require("clsx"), 1);
|
|
68
68
|
|
|
69
69
|
// src/classNames.ts
|
|
70
70
|
var import_clsx = __toESM(require("clsx"), 1);
|
|
@@ -233,7 +233,7 @@ function Icon(_a) {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
// src/components/CalendarRange.tsx
|
|
236
|
-
var
|
|
236
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
237
237
|
var import_polyfill = require("@js-temporal/polyfill");
|
|
238
238
|
|
|
239
239
|
// src/components/DataGridCell.tsx
|
|
@@ -3978,7 +3978,7 @@ var Tooltip = ({
|
|
|
3978
3978
|
id,
|
|
3979
3979
|
"data-testid": testid,
|
|
3980
3980
|
ref,
|
|
3981
|
-
className: "relative inline-grid grid-cols-[auto_1fr] items-center",
|
|
3981
|
+
className: "relative inline-grid grid-cols-[auto_1fr] items-center cursor-pointer",
|
|
3982
3982
|
onMouseEnter: handleMouseEnter,
|
|
3983
3983
|
onMouseLeave: handleMouseLeave,
|
|
3984
3984
|
children: [
|
|
@@ -4569,12 +4569,11 @@ var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
|
4569
4569
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4570
4570
|
|
|
4571
4571
|
// src/components/Grid.tsx
|
|
4572
|
-
var import_react27 = require("react");
|
|
4573
4572
|
var import_clsx30 = __toESM(require("clsx"), 1);
|
|
4574
4573
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4575
4574
|
|
|
4576
4575
|
// src/components/ProductImagePreview/ProductPrimaryImage.tsx
|
|
4577
|
-
var
|
|
4576
|
+
var import_react27 = require("react");
|
|
4578
4577
|
|
|
4579
4578
|
// src/components/Spinner.tsx
|
|
4580
4579
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
@@ -4610,7 +4609,7 @@ Spinner.displayName = "Spinner";
|
|
|
4610
4609
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4611
4610
|
|
|
4612
4611
|
// src/components/ProductImagePreview/ZoomWindow.tsx
|
|
4613
|
-
var
|
|
4612
|
+
var import_react28 = require("react");
|
|
4614
4613
|
|
|
4615
4614
|
// src/components/Surface.tsx
|
|
4616
4615
|
var import_clsx31 = __toESM(require("clsx"), 1);
|
|
@@ -4655,17 +4654,17 @@ var import_clsx32 = require("clsx");
|
|
|
4655
4654
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4656
4655
|
|
|
4657
4656
|
// src/components/ProductImagePreview/MobileImageCarousel.tsx
|
|
4658
|
-
var
|
|
4657
|
+
var import_react29 = require("react");
|
|
4659
4658
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4660
4659
|
|
|
4661
4660
|
// src/components/ProductImagePreview/useProductImagePreview.ts
|
|
4662
|
-
var
|
|
4661
|
+
var import_react30 = require("react");
|
|
4663
4662
|
|
|
4664
4663
|
// src/components/ProductImagePreview/index.tsx
|
|
4665
4664
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
4666
4665
|
|
|
4667
4666
|
// src/components/CompactImagesPreview.tsx
|
|
4668
|
-
var
|
|
4667
|
+
var import_react31 = require("react");
|
|
4669
4668
|
var import_clsx33 = __toESM(require("clsx"), 1);
|
|
4670
4669
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
4671
4670
|
|
|
@@ -4673,8 +4672,184 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
|
4673
4672
|
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
4674
4673
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4675
4674
|
|
|
4676
|
-
// src/components/
|
|
4675
|
+
// src/components/PDFViewer/index.tsx
|
|
4676
|
+
var import_react34 = require("react");
|
|
4677
|
+
|
|
4678
|
+
// src/components/PDFViewer/PDFElement.tsx
|
|
4679
|
+
var import_react_pdf2 = require("@mikecousins/react-pdf");
|
|
4680
|
+
var import_react33 = require("react");
|
|
4681
|
+
|
|
4682
|
+
// src/components/PDFViewer/PDFPage.tsx
|
|
4683
|
+
var import_react_pdf = require("@mikecousins/react-pdf");
|
|
4684
|
+
var import_react32 = require("react");
|
|
4677
4685
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4686
|
+
|
|
4687
|
+
// src/components/PDFViewer/PDFElement.tsx
|
|
4688
|
+
var import_clsx35 = __toESM(require("clsx"), 1);
|
|
4689
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4690
|
+
|
|
4691
|
+
// src/components/PDFViewer/DownloadIcon.tsx
|
|
4692
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4693
|
+
|
|
4694
|
+
// src/components/PDFViewer/PDFNavigation.tsx
|
|
4695
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4696
|
+
|
|
4697
|
+
// src/components/PDFViewer/index.tsx
|
|
4698
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4699
|
+
|
|
4700
|
+
// src/components/ListGroup.tsx
|
|
4701
|
+
var import_react35 = require("react");
|
|
4702
|
+
var import_clsx36 = __toESM(require("clsx"), 1);
|
|
4703
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4704
|
+
|
|
4705
|
+
// src/components/Pagination.tsx
|
|
4706
|
+
var import_react36 = require("react");
|
|
4707
|
+
var import_clsx37 = __toESM(require("clsx"), 1);
|
|
4708
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
4709
|
+
var Pagination = ({
|
|
4710
|
+
totalPages,
|
|
4711
|
+
currentPage,
|
|
4712
|
+
onPageChange,
|
|
4713
|
+
id,
|
|
4714
|
+
testid,
|
|
4715
|
+
className,
|
|
4716
|
+
disabled
|
|
4717
|
+
}) => {
|
|
4718
|
+
const goTo = (0, import_react36.useCallback)(
|
|
4719
|
+
(page) => {
|
|
4720
|
+
if (disabled) return;
|
|
4721
|
+
onPageChange(page);
|
|
4722
|
+
},
|
|
4723
|
+
[onPageChange, disabled]
|
|
4724
|
+
);
|
|
4725
|
+
const handleKey = (e) => {
|
|
4726
|
+
if (disabled) return;
|
|
4727
|
+
if (e.key === "ArrowLeft") {
|
|
4728
|
+
e.preventDefault();
|
|
4729
|
+
goTo(currentPage - 1);
|
|
4730
|
+
} else if (e.key === "ArrowRight") {
|
|
4731
|
+
e.preventDefault();
|
|
4732
|
+
goTo(currentPage + 1);
|
|
4733
|
+
}
|
|
4734
|
+
};
|
|
4735
|
+
const pageTokens = (0, import_react36.useMemo)(() => {
|
|
4736
|
+
if (totalPages <= 5) {
|
|
4737
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
4738
|
+
}
|
|
4739
|
+
const pages = /* @__PURE__ */ new Set();
|
|
4740
|
+
pages.add(1);
|
|
4741
|
+
pages.add(totalPages);
|
|
4742
|
+
if (currentPage <= 3) {
|
|
4743
|
+
pages.add(2);
|
|
4744
|
+
pages.add(3);
|
|
4745
|
+
pages.add(4);
|
|
4746
|
+
} else if (currentPage >= totalPages - 2) {
|
|
4747
|
+
pages.add(totalPages - 1);
|
|
4748
|
+
pages.add(totalPages - 2);
|
|
4749
|
+
pages.add(totalPages - 3);
|
|
4750
|
+
} else {
|
|
4751
|
+
pages.add(currentPage - 1);
|
|
4752
|
+
pages.add(currentPage);
|
|
4753
|
+
pages.add(currentPage + 1);
|
|
4754
|
+
}
|
|
4755
|
+
const sorted = Array.from(pages).sort((a, b) => a - b);
|
|
4756
|
+
const tokens = [];
|
|
4757
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
4758
|
+
const value = sorted[i];
|
|
4759
|
+
const prev = sorted[i - 1];
|
|
4760
|
+
if (i > 0) {
|
|
4761
|
+
if (value - prev === 2) {
|
|
4762
|
+
tokens.push(prev + 1);
|
|
4763
|
+
} else if (value - prev > 2) {
|
|
4764
|
+
tokens.push("ellipsis");
|
|
4765
|
+
}
|
|
4766
|
+
}
|
|
4767
|
+
tokens.push(value);
|
|
4768
|
+
}
|
|
4769
|
+
return tokens;
|
|
4770
|
+
}, [totalPages, currentPage]);
|
|
4771
|
+
if (totalPages <= 1) return null;
|
|
4772
|
+
const buttonClass = (0, import_clsx37.default)(
|
|
4773
|
+
"cursor-pointer disabled:cursor-default",
|
|
4774
|
+
paddingUsingComponentGap,
|
|
4775
|
+
"w-8 h-8",
|
|
4776
|
+
"flex items-center justify-center",
|
|
4777
|
+
"bg-transparent",
|
|
4778
|
+
"box-content",
|
|
4779
|
+
"hover:bg-background-grouped-secondary-normal",
|
|
4780
|
+
"focus:bg-background-grouped-secondary-normal focus:outline-0",
|
|
4781
|
+
"disabled:bg-transparent disabled:text-text-action-primary-disabled"
|
|
4782
|
+
);
|
|
4783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
4784
|
+
"nav",
|
|
4785
|
+
{
|
|
4786
|
+
id,
|
|
4787
|
+
"data-testid": testid,
|
|
4788
|
+
"aria-label": "Pagination",
|
|
4789
|
+
onKeyDown: handleKey,
|
|
4790
|
+
className: (0, import_clsx37.default)(
|
|
4791
|
+
"flex items-center",
|
|
4792
|
+
"border border-border-primary-normal",
|
|
4793
|
+
"bg-background-grouped-primary-normal",
|
|
4794
|
+
"rounded-sm",
|
|
4795
|
+
className
|
|
4796
|
+
),
|
|
4797
|
+
children: [
|
|
4798
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4799
|
+
"button",
|
|
4800
|
+
{
|
|
4801
|
+
disabled: disabled || currentPage <= 1,
|
|
4802
|
+
"aria-label": "Previous page",
|
|
4803
|
+
onClick: () => goTo(currentPage - 1),
|
|
4804
|
+
className: (0, import_clsx37.default)(buttonClass, "border-r-1 border-border-primary-normal"),
|
|
4805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: "keyboard_arrow_left" })
|
|
4806
|
+
}
|
|
4807
|
+
),
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: (0, import_clsx37.default)("flex items-center"), children: pageTokens.map((token, index) => {
|
|
4809
|
+
if (token === "ellipsis") {
|
|
4810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4811
|
+
"li",
|
|
4812
|
+
{
|
|
4813
|
+
className: "w-8 h-8 select-none text-text-action-primary-disabled",
|
|
4814
|
+
children: "\u2026"
|
|
4815
|
+
},
|
|
4816
|
+
`ellipsis-${index}`
|
|
4817
|
+
);
|
|
4818
|
+
}
|
|
4819
|
+
const selected = token === currentPage;
|
|
4820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4821
|
+
"button",
|
|
4822
|
+
{
|
|
4823
|
+
"aria-label": `Page ${token}`,
|
|
4824
|
+
"aria-current": selected ? "page" : void 0,
|
|
4825
|
+
disabled,
|
|
4826
|
+
onClick: () => goTo(token),
|
|
4827
|
+
className: (0, import_clsx37.default)(
|
|
4828
|
+
buttonClass,
|
|
4829
|
+
selected && "border-x-1 bg-background-grouped-secondary-normal border-border-primary-normal"
|
|
4830
|
+
),
|
|
4831
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Subheader, { align: "center", weight: "bold", children: token })
|
|
4832
|
+
}
|
|
4833
|
+
) }, token);
|
|
4834
|
+
}) }),
|
|
4835
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4836
|
+
"button",
|
|
4837
|
+
{
|
|
4838
|
+
disabled: disabled || currentPage >= totalPages,
|
|
4839
|
+
"aria-label": "Next page",
|
|
4840
|
+
onClick: () => goTo(currentPage + 1),
|
|
4841
|
+
className: (0, import_clsx37.default)(buttonClass, "border-l-1 border-border-primary-normal"),
|
|
4842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Icon, { name: "keyboard_arrow_right" })
|
|
4843
|
+
}
|
|
4844
|
+
)
|
|
4845
|
+
]
|
|
4846
|
+
}
|
|
4847
|
+
);
|
|
4848
|
+
};
|
|
4849
|
+
Pagination.displayName = "Pagination";
|
|
4850
|
+
|
|
4851
|
+
// src/components/CalendarRange.tsx
|
|
4852
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
4678
4853
|
function isWeekend(date) {
|
|
4679
4854
|
return date.dayOfWeek === 6 || date.dayOfWeek === 7;
|
|
4680
4855
|
}
|
|
@@ -4712,12 +4887,12 @@ function DateCell(_a) {
|
|
|
4712
4887
|
"id",
|
|
4713
4888
|
"testid"
|
|
4714
4889
|
]);
|
|
4715
|
-
return /* @__PURE__ */ (0,
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4716
4891
|
"span",
|
|
4717
4892
|
__spreadProps(__spreadValues({}, props), {
|
|
4718
4893
|
id,
|
|
4719
4894
|
"data-testid": testid,
|
|
4720
|
-
className: (0,
|
|
4895
|
+
className: (0, import_clsx38.default)(
|
|
4721
4896
|
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4722
4897
|
typography.caption,
|
|
4723
4898
|
cellPadding,
|
|
@@ -4787,20 +4962,20 @@ function CalendarRange({
|
|
|
4787
4962
|
const fromDate = parseDate(from);
|
|
4788
4963
|
const toDate = parseDate(to);
|
|
4789
4964
|
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4790
|
-
const [baseMonth, setBaseMonth] = (0,
|
|
4965
|
+
const [baseMonth, setBaseMonth] = (0, import_react37.useState)(
|
|
4791
4966
|
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4792
4967
|
);
|
|
4793
|
-
const [selecting, setSelecting] = (0,
|
|
4794
|
-
const [pendingFrom, setPendingFrom] = (0,
|
|
4795
|
-
const [hoveredDate, setHoveredDate] = (0,
|
|
4796
|
-
(0,
|
|
4968
|
+
const [selecting, setSelecting] = (0, import_react37.useState)("from");
|
|
4969
|
+
const [pendingFrom, setPendingFrom] = (0, import_react37.useState)(void 0);
|
|
4970
|
+
const [hoveredDate, setHoveredDate] = (0, import_react37.useState)(void 0);
|
|
4971
|
+
(0, import_react37.useEffect)(() => {
|
|
4797
4972
|
if (fromDate) {
|
|
4798
4973
|
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4799
4974
|
} else if (toDate) {
|
|
4800
4975
|
setBaseMonth(toDate.with({ day: 1 }));
|
|
4801
4976
|
}
|
|
4802
4977
|
}, [from, to]);
|
|
4803
|
-
(0,
|
|
4978
|
+
(0, import_react37.useEffect)(() => {
|
|
4804
4979
|
if (fromDate && toDate) {
|
|
4805
4980
|
setSelecting("from");
|
|
4806
4981
|
setPendingFrom(void 0);
|
|
@@ -4866,12 +5041,12 @@ function CalendarRange({
|
|
|
4866
5041
|
}
|
|
4867
5042
|
return false;
|
|
4868
5043
|
}
|
|
4869
|
-
return /* @__PURE__ */ (0,
|
|
5044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4870
5045
|
"div",
|
|
4871
5046
|
{
|
|
4872
5047
|
id,
|
|
4873
5048
|
"data-testid": testid,
|
|
4874
|
-
className: (0,
|
|
5049
|
+
className: (0, import_clsx38.default)(
|
|
4875
5050
|
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4876
5051
|
layoutPaddding,
|
|
4877
5052
|
layoutGap,
|
|
@@ -4879,15 +5054,15 @@ function CalendarRange({
|
|
|
4879
5054
|
// baseTransition,
|
|
4880
5055
|
"overflow-hidden"
|
|
4881
5056
|
),
|
|
4882
|
-
children: /* @__PURE__ */ (0,
|
|
5057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4883
5058
|
"div",
|
|
4884
5059
|
{
|
|
4885
|
-
className: (0,
|
|
5060
|
+
className: (0, import_clsx38.default)(
|
|
4886
5061
|
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4887
5062
|
layoutGap
|
|
4888
5063
|
),
|
|
4889
5064
|
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4890
|
-
return /* @__PURE__ */ (0,
|
|
5065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4891
5066
|
CalendarPane,
|
|
4892
5067
|
{
|
|
4893
5068
|
getMonthData,
|
|
@@ -4945,45 +5120,45 @@ function CalendarPane({
|
|
|
4945
5120
|
const years = Array.from({ length: 100 }).map(
|
|
4946
5121
|
(_, i) => baseMonth.year - 50 + i
|
|
4947
5122
|
);
|
|
4948
|
-
const [monthMenuOpen, setMonthMenuOpen] = (0,
|
|
4949
|
-
const [yearMenuOpen, setYearMenuOpen] = (0,
|
|
4950
|
-
const monthMenuRef = (0,
|
|
4951
|
-
const yearMenuRef = (0,
|
|
5123
|
+
const [monthMenuOpen, setMonthMenuOpen] = (0, import_react37.useState)(false);
|
|
5124
|
+
const [yearMenuOpen, setYearMenuOpen] = (0, import_react37.useState)(false);
|
|
5125
|
+
const monthMenuRef = (0, import_react37.useRef)(null);
|
|
5126
|
+
const yearMenuRef = (0, import_react37.useRef)(null);
|
|
4952
5127
|
const month = getMonthData(offset);
|
|
4953
5128
|
const totalCells = 42;
|
|
4954
5129
|
const emptyCells = month.firstDayOffset;
|
|
4955
|
-
return /* @__PURE__ */ (0,
|
|
4956
|
-
/* @__PURE__ */ (0,
|
|
5130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react37.default.Fragment, { children: [
|
|
5131
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4957
5132
|
"div",
|
|
4958
5133
|
{
|
|
4959
|
-
className: (0,
|
|
5134
|
+
className: (0, import_clsx38.default)("flex flex-col"),
|
|
4960
5135
|
children: [
|
|
4961
|
-
/* @__PURE__ */ (0,
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4962
5137
|
"div",
|
|
4963
5138
|
{
|
|
4964
|
-
className: (0,
|
|
5139
|
+
className: (0, import_clsx38.default)(
|
|
4965
5140
|
"flex flex-row items-center justify-between",
|
|
4966
5141
|
typography.label,
|
|
4967
5142
|
"text-text-action-primary-normal"
|
|
4968
5143
|
),
|
|
4969
5144
|
children: [
|
|
4970
|
-
idx === 0 ? /* @__PURE__ */ (0,
|
|
5145
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4971
5146
|
"button",
|
|
4972
5147
|
{
|
|
4973
5148
|
id: id ? `${id}-prev-month-button` : void 0,
|
|
4974
5149
|
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
4975
5150
|
type: "button",
|
|
4976
|
-
className: (0,
|
|
5151
|
+
className: (0, import_clsx38.default)(
|
|
4977
5152
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4978
5153
|
componentPadding
|
|
4979
5154
|
),
|
|
4980
5155
|
"aria-label": "Previous month",
|
|
4981
5156
|
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
4982
|
-
children: /* @__PURE__ */ (0,
|
|
5157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
4983
5158
|
}
|
|
4984
|
-
) : /* @__PURE__ */ (0,
|
|
4985
|
-
/* @__PURE__ */ (0,
|
|
4986
|
-
/* @__PURE__ */ (0,
|
|
5159
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: (0, import_clsx38.default)(componentPadding, "mr-1") }),
|
|
5160
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex gap-desktop-compact-component-padding", children: [
|
|
5161
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4987
5162
|
"button",
|
|
4988
5163
|
{
|
|
4989
5164
|
ref: (el) => {
|
|
@@ -4998,13 +5173,13 @@ function CalendarPane({
|
|
|
4998
5173
|
children: month.name
|
|
4999
5174
|
}
|
|
5000
5175
|
),
|
|
5001
|
-
/* @__PURE__ */ (0,
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5002
5177
|
Menu,
|
|
5003
5178
|
{
|
|
5004
5179
|
show: monthMenuOpen,
|
|
5005
5180
|
positionTo: monthMenuRef,
|
|
5006
5181
|
setShow: () => setMonthMenuOpen(false),
|
|
5007
|
-
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0,
|
|
5182
|
+
children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5008
5183
|
MenuOption,
|
|
5009
5184
|
{
|
|
5010
5185
|
selected: baseMonth.month === x + 1,
|
|
@@ -5018,7 +5193,7 @@ function CalendarPane({
|
|
|
5018
5193
|
))
|
|
5019
5194
|
}
|
|
5020
5195
|
),
|
|
5021
|
-
/* @__PURE__ */ (0,
|
|
5196
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5022
5197
|
"button",
|
|
5023
5198
|
{
|
|
5024
5199
|
ref: (el) => {
|
|
@@ -5033,13 +5208,13 @@ function CalendarPane({
|
|
|
5033
5208
|
children: month.year
|
|
5034
5209
|
}
|
|
5035
5210
|
),
|
|
5036
|
-
/* @__PURE__ */ (0,
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5037
5212
|
Menu,
|
|
5038
5213
|
{
|
|
5039
5214
|
show: yearMenuOpen,
|
|
5040
5215
|
positionTo: yearMenuRef,
|
|
5041
5216
|
setShow: () => setYearMenuOpen(false),
|
|
5042
|
-
children: years.map((y) => /* @__PURE__ */ (0,
|
|
5217
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5043
5218
|
MenuOption,
|
|
5044
5219
|
{
|
|
5045
5220
|
selected: baseMonth.year === y,
|
|
@@ -5054,28 +5229,28 @@ function CalendarPane({
|
|
|
5054
5229
|
}
|
|
5055
5230
|
)
|
|
5056
5231
|
] }),
|
|
5057
|
-
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0,
|
|
5232
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5058
5233
|
"button",
|
|
5059
5234
|
{
|
|
5060
5235
|
id: id ? `${id}-next-month-button` : void 0,
|
|
5061
5236
|
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
5062
5237
|
type: "button",
|
|
5063
|
-
className: (0,
|
|
5238
|
+
className: (0, import_clsx38.default)(
|
|
5064
5239
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
5065
5240
|
componentPadding
|
|
5066
5241
|
),
|
|
5067
5242
|
"aria-label": "Next month",
|
|
5068
5243
|
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
5069
|
-
children: /* @__PURE__ */ (0,
|
|
5244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
5070
5245
|
}
|
|
5071
|
-
) : /* @__PURE__ */ (0,
|
|
5246
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: (0, import_clsx38.default)(componentPadding, "ml-1") })
|
|
5072
5247
|
]
|
|
5073
5248
|
}
|
|
5074
5249
|
),
|
|
5075
|
-
/* @__PURE__ */ (0,
|
|
5250
|
+
/* @__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)(
|
|
5076
5251
|
"span",
|
|
5077
5252
|
{
|
|
5078
|
-
className: (0,
|
|
5253
|
+
className: (0, import_clsx38.default)(
|
|
5079
5254
|
typography.caption,
|
|
5080
5255
|
"text-text-secondary-normal text-center",
|
|
5081
5256
|
"w-10"
|
|
@@ -5084,7 +5259,7 @@ function CalendarPane({
|
|
|
5084
5259
|
},
|
|
5085
5260
|
d
|
|
5086
5261
|
)) }),
|
|
5087
|
-
/* @__PURE__ */ (0,
|
|
5262
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: (0, import_clsx38.default)("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
|
|
5088
5263
|
const day = i - emptyCells + 1;
|
|
5089
5264
|
const date = month.date.with({ day: 1 }).add({
|
|
5090
5265
|
days: i - emptyCells
|
|
@@ -5098,7 +5273,7 @@ function CalendarPane({
|
|
|
5098
5273
|
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
5099
5274
|
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
5100
5275
|
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
5101
|
-
return /* @__PURE__ */ (0,
|
|
5276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5102
5277
|
DateCell,
|
|
5103
5278
|
{
|
|
5104
5279
|
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
@@ -5123,10 +5298,10 @@ function CalendarPane({
|
|
|
5123
5298
|
]
|
|
5124
5299
|
}
|
|
5125
5300
|
),
|
|
5126
|
-
mode === "double" && idx === 0 && /* @__PURE__ */ (0,
|
|
5301
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5127
5302
|
"div",
|
|
5128
5303
|
{
|
|
5129
|
-
className: (0,
|
|
5304
|
+
className: (0, import_clsx38.default)(
|
|
5130
5305
|
"self-stretch bg-border-primary-normal rounded-base",
|
|
5131
5306
|
// 1px width, full height, matches Figma divider
|
|
5132
5307
|
"w-px"
|