@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
|
@@ -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,22 +4654,202 @@ 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
|
|
|
4672
|
-
// src/components/
|
|
4671
|
+
// src/components/SimpleTable.tsx
|
|
4672
|
+
var import_clsx34 = __toESM(require("clsx"), 1);
|
|
4673
4673
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4674
|
+
|
|
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");
|
|
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");
|
|
4674
4853
|
function isWeekend(date) {
|
|
4675
4854
|
return date.dayOfWeek === 6 || date.dayOfWeek === 7;
|
|
4676
4855
|
}
|
|
@@ -4708,12 +4887,12 @@ function DateCell(_a) {
|
|
|
4708
4887
|
"id",
|
|
4709
4888
|
"testid"
|
|
4710
4889
|
]);
|
|
4711
|
-
return /* @__PURE__ */ (0,
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4712
4891
|
"span",
|
|
4713
4892
|
__spreadProps(__spreadValues({}, props), {
|
|
4714
4893
|
id,
|
|
4715
4894
|
"data-testid": testid,
|
|
4716
|
-
className: (0,
|
|
4895
|
+
className: (0, import_clsx38.default)(
|
|
4717
4896
|
"flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
|
|
4718
4897
|
typography.caption,
|
|
4719
4898
|
cellPadding,
|
|
@@ -4783,20 +4962,20 @@ function CalendarRange({
|
|
|
4783
4962
|
const fromDate = parseDate(from);
|
|
4784
4963
|
const toDate = parseDate(to);
|
|
4785
4964
|
const today = import_polyfill.Temporal.Now.plainDateISO();
|
|
4786
|
-
const [baseMonth, setBaseMonth] = (0,
|
|
4965
|
+
const [baseMonth, setBaseMonth] = (0, import_react37.useState)(
|
|
4787
4966
|
fromDate != null ? fromDate : today.with({ day: 1 })
|
|
4788
4967
|
);
|
|
4789
|
-
const [selecting, setSelecting] = (0,
|
|
4790
|
-
const [pendingFrom, setPendingFrom] = (0,
|
|
4791
|
-
const [hoveredDate, setHoveredDate] = (0,
|
|
4792
|
-
(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)(() => {
|
|
4793
4972
|
if (fromDate) {
|
|
4794
4973
|
setBaseMonth(fromDate.with({ day: 1 }));
|
|
4795
4974
|
} else if (toDate) {
|
|
4796
4975
|
setBaseMonth(toDate.with({ day: 1 }));
|
|
4797
4976
|
}
|
|
4798
4977
|
}, [from, to]);
|
|
4799
|
-
(0,
|
|
4978
|
+
(0, import_react37.useEffect)(() => {
|
|
4800
4979
|
if (fromDate && toDate) {
|
|
4801
4980
|
setSelecting("from");
|
|
4802
4981
|
setPendingFrom(void 0);
|
|
@@ -4862,12 +5041,12 @@ function CalendarRange({
|
|
|
4862
5041
|
}
|
|
4863
5042
|
return false;
|
|
4864
5043
|
}
|
|
4865
|
-
return /* @__PURE__ */ (0,
|
|
5044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4866
5045
|
"div",
|
|
4867
5046
|
{
|
|
4868
5047
|
id,
|
|
4869
5048
|
"data-testid": testid,
|
|
4870
|
-
className: (0,
|
|
5049
|
+
className: (0, import_clsx38.default)(
|
|
4871
5050
|
"relative bg-background-grouped-primary-normal rounded-base w-fit",
|
|
4872
5051
|
layoutPaddding,
|
|
4873
5052
|
layoutGap,
|
|
@@ -4875,15 +5054,15 @@ function CalendarRange({
|
|
|
4875
5054
|
// baseTransition,
|
|
4876
5055
|
"overflow-hidden"
|
|
4877
5056
|
),
|
|
4878
|
-
children: /* @__PURE__ */ (0,
|
|
5057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4879
5058
|
"div",
|
|
4880
5059
|
{
|
|
4881
|
-
className: (0,
|
|
5060
|
+
className: (0, import_clsx38.default)(
|
|
4882
5061
|
"flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
|
|
4883
5062
|
layoutGap
|
|
4884
5063
|
),
|
|
4885
5064
|
children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
4886
|
-
return /* @__PURE__ */ (0,
|
|
5065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4887
5066
|
CalendarPane,
|
|
4888
5067
|
{
|
|
4889
5068
|
getMonthData,
|
|
@@ -4941,45 +5120,45 @@ function CalendarPane({
|
|
|
4941
5120
|
const years = Array.from({ length: 100 }).map(
|
|
4942
5121
|
(_, i) => baseMonth.year - 50 + i
|
|
4943
5122
|
);
|
|
4944
|
-
const [monthMenuOpen, setMonthMenuOpen] = (0,
|
|
4945
|
-
const [yearMenuOpen, setYearMenuOpen] = (0,
|
|
4946
|
-
const monthMenuRef = (0,
|
|
4947
|
-
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);
|
|
4948
5127
|
const month = getMonthData(offset);
|
|
4949
5128
|
const totalCells = 42;
|
|
4950
5129
|
const emptyCells = month.firstDayOffset;
|
|
4951
|
-
return /* @__PURE__ */ (0,
|
|
4952
|
-
/* @__PURE__ */ (0,
|
|
5130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_react37.default.Fragment, { children: [
|
|
5131
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4953
5132
|
"div",
|
|
4954
5133
|
{
|
|
4955
|
-
className: (0,
|
|
5134
|
+
className: (0, import_clsx38.default)("flex flex-col"),
|
|
4956
5135
|
children: [
|
|
4957
|
-
/* @__PURE__ */ (0,
|
|
5136
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
4958
5137
|
"div",
|
|
4959
5138
|
{
|
|
4960
|
-
className: (0,
|
|
5139
|
+
className: (0, import_clsx38.default)(
|
|
4961
5140
|
"flex flex-row items-center justify-between",
|
|
4962
5141
|
typography.label,
|
|
4963
5142
|
"text-text-action-primary-normal"
|
|
4964
5143
|
),
|
|
4965
5144
|
children: [
|
|
4966
|
-
idx === 0 ? /* @__PURE__ */ (0,
|
|
5145
|
+
idx === 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4967
5146
|
"button",
|
|
4968
5147
|
{
|
|
4969
5148
|
id: id ? `${id}-prev-month-button` : void 0,
|
|
4970
5149
|
"data-testid": testid ? `${testid}-prev-month-button` : void 0,
|
|
4971
5150
|
type: "button",
|
|
4972
|
-
className: (0,
|
|
5151
|
+
className: (0, import_clsx38.default)(
|
|
4973
5152
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
4974
5153
|
componentPadding
|
|
4975
5154
|
),
|
|
4976
5155
|
"aria-label": "Previous month",
|
|
4977
5156
|
onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
|
|
4978
|
-
children: /* @__PURE__ */ (0,
|
|
5157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_left", size: 24 })
|
|
4979
5158
|
}
|
|
4980
|
-
) : /* @__PURE__ */ (0,
|
|
4981
|
-
/* @__PURE__ */ (0,
|
|
4982
|
-
/* @__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)(
|
|
4983
5162
|
"button",
|
|
4984
5163
|
{
|
|
4985
5164
|
ref: (el) => {
|
|
@@ -4994,13 +5173,13 @@ function CalendarPane({
|
|
|
4994
5173
|
children: month.name
|
|
4995
5174
|
}
|
|
4996
5175
|
),
|
|
4997
|
-
/* @__PURE__ */ (0,
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
4998
5177
|
Menu,
|
|
4999
5178
|
{
|
|
5000
5179
|
show: monthMenuOpen,
|
|
5001
5180
|
positionTo: monthMenuRef,
|
|
5002
5181
|
setShow: () => setMonthMenuOpen(false),
|
|
5003
|
-
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)(
|
|
5004
5183
|
MenuOption,
|
|
5005
5184
|
{
|
|
5006
5185
|
selected: baseMonth.month === x + 1,
|
|
@@ -5014,7 +5193,7 @@ function CalendarPane({
|
|
|
5014
5193
|
))
|
|
5015
5194
|
}
|
|
5016
5195
|
),
|
|
5017
|
-
/* @__PURE__ */ (0,
|
|
5196
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5018
5197
|
"button",
|
|
5019
5198
|
{
|
|
5020
5199
|
ref: (el) => {
|
|
@@ -5029,13 +5208,13 @@ function CalendarPane({
|
|
|
5029
5208
|
children: month.year
|
|
5030
5209
|
}
|
|
5031
5210
|
),
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5033
5212
|
Menu,
|
|
5034
5213
|
{
|
|
5035
5214
|
show: yearMenuOpen,
|
|
5036
5215
|
positionTo: yearMenuRef,
|
|
5037
5216
|
setShow: () => setYearMenuOpen(false),
|
|
5038
|
-
children: years.map((y) => /* @__PURE__ */ (0,
|
|
5217
|
+
children: years.map((y) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5039
5218
|
MenuOption,
|
|
5040
5219
|
{
|
|
5041
5220
|
selected: baseMonth.year === y,
|
|
@@ -5050,28 +5229,28 @@ function CalendarPane({
|
|
|
5050
5229
|
}
|
|
5051
5230
|
)
|
|
5052
5231
|
] }),
|
|
5053
|
-
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0,
|
|
5232
|
+
(mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5054
5233
|
"button",
|
|
5055
5234
|
{
|
|
5056
5235
|
id: id ? `${id}-next-month-button` : void 0,
|
|
5057
5236
|
"data-testid": testid ? `${testid}-next-month-button` : void 0,
|
|
5058
5237
|
type: "button",
|
|
5059
|
-
className: (0,
|
|
5238
|
+
className: (0, import_clsx38.default)(
|
|
5060
5239
|
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
5061
5240
|
componentPadding
|
|
5062
5241
|
),
|
|
5063
5242
|
"aria-label": "Next month",
|
|
5064
5243
|
onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
|
|
5065
|
-
children: /* @__PURE__ */ (0,
|
|
5244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "chevron_right", size: 24 })
|
|
5066
5245
|
}
|
|
5067
|
-
) : /* @__PURE__ */ (0,
|
|
5246
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: (0, import_clsx38.default)(componentPadding, "ml-1") })
|
|
5068
5247
|
]
|
|
5069
5248
|
}
|
|
5070
5249
|
),
|
|
5071
|
-
/* @__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)(
|
|
5072
5251
|
"span",
|
|
5073
5252
|
{
|
|
5074
|
-
className: (0,
|
|
5253
|
+
className: (0, import_clsx38.default)(
|
|
5075
5254
|
typography.caption,
|
|
5076
5255
|
"text-text-secondary-normal text-center",
|
|
5077
5256
|
"w-10"
|
|
@@ -5080,7 +5259,7 @@ function CalendarPane({
|
|
|
5080
5259
|
},
|
|
5081
5260
|
d
|
|
5082
5261
|
)) }),
|
|
5083
|
-
/* @__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) => {
|
|
5084
5263
|
const day = i - emptyCells + 1;
|
|
5085
5264
|
const date = month.date.with({ day: 1 }).add({
|
|
5086
5265
|
days: i - emptyCells
|
|
@@ -5094,7 +5273,7 @@ function CalendarPane({
|
|
|
5094
5273
|
const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && import_polyfill.Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
5095
5274
|
const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
|
|
5096
5275
|
const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
|
|
5097
|
-
return /* @__PURE__ */ (0,
|
|
5276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5098
5277
|
DateCell,
|
|
5099
5278
|
{
|
|
5100
5279
|
id: id ? `${id}-date-${date.toString()}` : void 0,
|
|
@@ -5119,10 +5298,10 @@ function CalendarPane({
|
|
|
5119
5298
|
]
|
|
5120
5299
|
}
|
|
5121
5300
|
),
|
|
5122
|
-
mode === "double" && idx === 0 && /* @__PURE__ */ (0,
|
|
5301
|
+
mode === "double" && idx === 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5123
5302
|
"div",
|
|
5124
5303
|
{
|
|
5125
|
-
className: (0,
|
|
5304
|
+
className: (0, import_clsx38.default)(
|
|
5126
5305
|
"self-stretch bg-border-primary-normal rounded-base",
|
|
5127
5306
|
// 1px width, full height, matches Figma divider
|
|
5128
5307
|
"w-px"
|