@ceed/cds 1.24.1-next.3 → 1.26.0
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/chunks/rehype-accent-FZRUD7VI.js +39 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/DataTable/components.d.ts +2 -1
- package/dist/components/DataTable/hooks.d.ts +1 -1
- package/dist/components/DataTable/styled.d.ts +3 -1
- package/dist/components/DataTable/types.d.ts +11 -0
- package/dist/components/DataTable/utils.d.ts +2 -2
- package/dist/components/RadioTileGroup/RadioTileGroup.d.ts +56 -0
- package/dist/components/RadioTileGroup/index.d.ts +3 -0
- package/dist/components/data-display/DataTable.md +177 -1
- package/dist/components/data-display/InfoSign.md +74 -91
- package/dist/components/data-display/Typography.md +411 -94
- package/dist/components/feedback/CircularProgress.md +257 -0
- package/dist/components/feedback/Dialog.md +76 -62
- package/dist/components/feedback/Modal.md +430 -138
- package/dist/components/feedback/Skeleton.md +280 -0
- package/dist/components/feedback/llms.txt +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/inputs/Autocomplete.md +356 -107
- package/dist/components/inputs/ButtonGroup.md +115 -104
- package/dist/components/inputs/CurrencyInput.md +183 -5
- package/dist/components/inputs/DatePicker.md +108 -431
- package/dist/components/inputs/DateRangePicker.md +131 -492
- package/dist/components/inputs/FilterableCheckboxGroup.md +145 -19
- package/dist/components/inputs/FormControl.md +361 -0
- package/dist/components/inputs/IconButton.md +137 -88
- package/dist/components/inputs/Input.md +204 -73
- package/dist/components/inputs/MonthPicker.md +95 -422
- package/dist/components/inputs/MonthRangePicker.md +89 -466
- package/dist/components/inputs/PercentageInput.md +185 -16
- package/dist/components/inputs/RadioButton.md +163 -35
- package/dist/components/inputs/RadioList.md +241 -0
- package/dist/components/inputs/RadioTileGroup.md +507 -0
- package/dist/components/inputs/Select.md +222 -326
- package/dist/components/inputs/Slider.md +334 -0
- package/dist/components/inputs/Switch.md +143 -376
- package/dist/components/inputs/Textarea.md +213 -10
- package/dist/components/inputs/Uploader/Uploader.md +145 -66
- package/dist/components/inputs/llms.txt +4 -0
- package/dist/components/navigation/Breadcrumbs.md +57 -308
- package/dist/components/navigation/Drawer.md +180 -0
- package/dist/components/navigation/Dropdown.md +98 -215
- package/dist/components/navigation/IconMenuButton.md +40 -502
- package/dist/components/navigation/InsetDrawer.md +281 -650
- package/dist/components/navigation/Link.md +31 -348
- package/dist/components/navigation/Menu.md +92 -285
- package/dist/components/navigation/MenuButton.md +55 -448
- package/dist/components/navigation/Pagination.md +47 -338
- package/dist/components/navigation/Stepper.md +160 -28
- package/dist/components/navigation/Tabs.md +57 -316
- package/dist/components/surfaces/Accordions.md +49 -804
- package/dist/components/surfaces/Card.md +97 -157
- package/dist/components/surfaces/Divider.md +83 -234
- package/dist/components/surfaces/Sheet.md +153 -328
- package/dist/guides/ThemeProvider.md +89 -0
- package/dist/guides/llms.txt +9 -0
- package/dist/index.browser.js +224 -0
- package/dist/index.browser.js.map +7 -0
- package/dist/index.cjs +726 -425
- package/dist/index.d.ts +1 -1
- package/dist/index.js +641 -396
- package/dist/llms.txt +9 -0
- package/framer/index.js +1 -163
- package/package.json +22 -17
package/dist/index.js
CHANGED
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function __init() {
|
|
4
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
-
};
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// src/libs/rehype-accent/index.ts
|
|
12
|
-
var rehype_accent_exports = {};
|
|
13
|
-
__export(rehype_accent_exports, {
|
|
14
|
-
rehypeAccent: () => rehypeAccent
|
|
15
|
-
});
|
|
16
|
-
import { visit } from "unist-util-visit";
|
|
17
|
-
function rehypeAccent(options) {
|
|
18
|
-
const { accentColor } = options;
|
|
19
|
-
return (tree) => {
|
|
20
|
-
visit(tree, "text", (node, index, parent) => {
|
|
21
|
-
const value = node.value;
|
|
22
|
-
const regex = /\|\|.*?\|\|/g;
|
|
23
|
-
let match;
|
|
24
|
-
let lastIndex = 0;
|
|
25
|
-
const newNodes = [];
|
|
26
|
-
while ((match = regex.exec(value)) !== null) {
|
|
27
|
-
if (match.index > lastIndex) {
|
|
28
|
-
newNodes.push({
|
|
29
|
-
type: "text",
|
|
30
|
-
value: value.slice(lastIndex, match.index)
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const innerText = match[0].split("||")[1];
|
|
34
|
-
newNodes.push({
|
|
35
|
-
type: "element",
|
|
36
|
-
tagName: "span",
|
|
37
|
-
properties: { textColor: accentColor },
|
|
38
|
-
children: [{ type: "text", value: innerText }]
|
|
39
|
-
});
|
|
40
|
-
lastIndex = match.index + match[0].length;
|
|
41
|
-
}
|
|
42
|
-
if (lastIndex < value.length) {
|
|
43
|
-
newNodes.push({ type: "text", value: value.slice(lastIndex) });
|
|
44
|
-
}
|
|
45
|
-
if (newNodes.length) {
|
|
46
|
-
parent.children.splice(index, 1, ...newNodes);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
var init_rehype_accent = __esm({
|
|
52
|
-
"src/libs/rehype-accent/index.ts"() {
|
|
53
|
-
"use strict";
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
1
|
// src/index.ts
|
|
58
2
|
import {
|
|
59
3
|
useTheme as useTheme2,
|
|
@@ -71,7 +15,7 @@ import {
|
|
|
71
15
|
menuButtonClasses,
|
|
72
16
|
menuItemClasses,
|
|
73
17
|
optionClasses,
|
|
74
|
-
radioClasses,
|
|
18
|
+
radioClasses as radioClasses2,
|
|
75
19
|
radioGroupClasses,
|
|
76
20
|
selectClasses,
|
|
77
21
|
switchClasses as switchClasses2,
|
|
@@ -83,7 +27,7 @@ import {
|
|
|
83
27
|
formHelperTextClasses,
|
|
84
28
|
gridClasses,
|
|
85
29
|
stackClasses,
|
|
86
|
-
sheetClasses,
|
|
30
|
+
sheetClasses as sheetClasses2,
|
|
87
31
|
modalClasses,
|
|
88
32
|
modalCloseClasses,
|
|
89
33
|
modalDialogClasses,
|
|
@@ -152,7 +96,7 @@ import {
|
|
|
152
96
|
stepperClasses,
|
|
153
97
|
Skeleton as Skeleton2,
|
|
154
98
|
skeletonClasses,
|
|
155
|
-
styled as
|
|
99
|
+
styled as styled31
|
|
156
100
|
} from "@mui/joy";
|
|
157
101
|
|
|
158
102
|
// src/components/Accordions/Accordions.tsx
|
|
@@ -759,11 +703,24 @@ Button.displayName = "Button";
|
|
|
759
703
|
var Button_default = Button;
|
|
760
704
|
|
|
761
705
|
// src/components/Calendar/Calendar.tsx
|
|
762
|
-
import
|
|
706
|
+
import React12, { Fragment, forwardRef as forwardRef4, useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo4, useRef as useRef3, useState as useState4 } from "react";
|
|
763
707
|
import { styled as styled5 } from "@mui/joy";
|
|
764
708
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
765
709
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
766
|
-
import { AnimatePresence, motion as
|
|
710
|
+
import { AnimatePresence, motion as motion13 } from "framer-motion";
|
|
711
|
+
|
|
712
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
713
|
+
import React10 from "react";
|
|
714
|
+
import { Tooltip as JoyTooltip } from "@mui/joy";
|
|
715
|
+
import { motion as motion12 } from "framer-motion";
|
|
716
|
+
var MotionTooltip = motion12(JoyTooltip);
|
|
717
|
+
var Tooltip = (props) => {
|
|
718
|
+
return /* @__PURE__ */ React10.createElement(MotionTooltip, { ...props });
|
|
719
|
+
};
|
|
720
|
+
Tooltip.displayName = "Tooltip";
|
|
721
|
+
|
|
722
|
+
// src/components/Tooltip/index.ts
|
|
723
|
+
var Tooltip_default = Tooltip;
|
|
767
724
|
|
|
768
725
|
// src/components/Calendar/utils/index.ts
|
|
769
726
|
var getCalendarDates = (date) => {
|
|
@@ -1122,6 +1079,12 @@ var useCalendar = (ownerState) => {
|
|
|
1122
1079
|
};
|
|
1123
1080
|
|
|
1124
1081
|
// src/components/Calendar/Calendar.tsx
|
|
1082
|
+
var MONTH_VIEW_HINT_MESSAGE = "Click the month title to view all months.";
|
|
1083
|
+
var MONTH_NAV_CLICK_WINDOW_MS = 1200;
|
|
1084
|
+
var MONTH_NAV_CLICK_THRESHOLD = 3;
|
|
1085
|
+
var MONTH_VIEW_HINT_DURATION_MS = 5e3;
|
|
1086
|
+
var MONTH_VIEW_HINT_COOLDOWN_MS = 3e4;
|
|
1087
|
+
var lastMonthViewAssistHintShownAt = 0;
|
|
1125
1088
|
var CalendarRoot = styled5("div", {
|
|
1126
1089
|
name: "Calendar",
|
|
1127
1090
|
slot: "root"
|
|
@@ -1148,7 +1111,7 @@ var CalendarViewContainer = styled5("div", {
|
|
|
1148
1111
|
overflow: "hidden",
|
|
1149
1112
|
minHeight: calendarType === "datePicker" ? "250px" : "unset"
|
|
1150
1113
|
}));
|
|
1151
|
-
var CalendarViewTable = styled5(
|
|
1114
|
+
var CalendarViewTable = styled5(motion13.table, {
|
|
1152
1115
|
name: "Calendar",
|
|
1153
1116
|
slot: "viewTable"
|
|
1154
1117
|
})(({ theme }) => ({
|
|
@@ -1328,7 +1291,7 @@ var PickerDays = (props) => {
|
|
|
1328
1291
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1329
1292
|
const calendarDates = useMemo4(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1330
1293
|
const weekdayNames = useMemo4(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1331
|
-
return /* @__PURE__ */
|
|
1294
|
+
return /* @__PURE__ */ React12.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React12.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React12.createElement(
|
|
1332
1295
|
CalendarViewTable,
|
|
1333
1296
|
{
|
|
1334
1297
|
key: `${ownerState.viewMonth.toString()}_${ownerState.direction}`,
|
|
@@ -1357,10 +1320,10 @@ var PickerDays = (props) => {
|
|
|
1357
1320
|
}
|
|
1358
1321
|
}
|
|
1359
1322
|
},
|
|
1360
|
-
/* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
(date, i) => date ? /* @__PURE__ */
|
|
1363
|
-
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ React12.createElement(CalendarWeekHeaderContainer, null, /* @__PURE__ */ React12.createElement("tr", null, weekdayNames.map((name, i) => /* @__PURE__ */ React12.createElement(Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` }, /* @__PURE__ */ React12.createElement("th", null, /* @__PURE__ */ React12.createElement(Typography_default, { level: "body-xs", textAlign: "center" }, name)), i < 6 && /* @__PURE__ */ React12.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" }))))),
|
|
1324
|
+
/* @__PURE__ */ React12.createElement(CalendarDayPickerContainer, null, calendarDates.map((weekDates, rowIndex) => /* @__PURE__ */ React12.createElement(Fragment, { key: `${ownerState.viewMonth}_${rowIndex}` }, /* @__PURE__ */ React12.createElement("tr", null, weekDates.map(
|
|
1325
|
+
(date, i) => date ? /* @__PURE__ */ React12.createElement(Fragment, { key: `${ownerState.viewMonth}_${date}_${i}` }, /* @__PURE__ */ React12.createElement(CalendarDayCell, { ...getDayCellProps(date) }, /* @__PURE__ */ React12.createElement(CalendarDay, { size: "sm", variant: "plain", color: "neutral", ...getPickerDayProps(date) }, date)), i < 6 && /* @__PURE__ */ React12.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })) : /* @__PURE__ */ React12.createElement(Fragment, { key: `${ownerState.viewMonth}_${i}` }, /* @__PURE__ */ React12.createElement("td", null), i < 6 && /* @__PURE__ */ React12.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))
|
|
1326
|
+
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React12.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React12.createElement("td", { colSpan: 13, style: { height: 4 } })))))
|
|
1364
1327
|
)));
|
|
1365
1328
|
};
|
|
1366
1329
|
var PickerMonths = (props) => {
|
|
@@ -1377,7 +1340,7 @@ var PickerMonths = (props) => {
|
|
|
1377
1340
|
[[]]
|
|
1378
1341
|
);
|
|
1379
1342
|
const isMonthPicker = !ownerState.views?.find((view) => view === "day");
|
|
1380
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ React12.createElement(CalendarViewContainer, { calendarType: isMonthPicker ? "monthPicker" : "datePicker" }, /* @__PURE__ */ React12.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React12.createElement(
|
|
1381
1344
|
CalendarViewTable,
|
|
1382
1345
|
{
|
|
1383
1346
|
key: `${ownerState.viewMonth.getFullYear()}_${ownerState.direction}`,
|
|
@@ -1406,7 +1369,7 @@ var PickerMonths = (props) => {
|
|
|
1406
1369
|
}
|
|
1407
1370
|
}
|
|
1408
1371
|
},
|
|
1409
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ React12.createElement("tbody", null, chunkedMonths.map((months, i) => /* @__PURE__ */ React12.createElement(Fragment, { key: months.join("_") }, /* @__PURE__ */ React12.createElement("tr", null, months.map((monthIndex, j) => /* @__PURE__ */ React12.createElement(Fragment, { key: monthIndex }, /* @__PURE__ */ React12.createElement(CalendarMonthCell, { ...getMonthCellProps(monthIndex) }, /* @__PURE__ */ React12.createElement(CalendarMonth, { size: "sm", variant: "plain", color: "neutral", ...getPickerMonthProps(monthIndex) }, getMonthNameFromIndex(monthIndex, ownerState.locale))), j < 3 && /* @__PURE__ */ React12.createElement("td", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" })))), i < chunkedMonths.length - 1 && /* @__PURE__ */ React12.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React12.createElement("td", { colSpan: 7, style: { height: 4 } })))))
|
|
1410
1373
|
)));
|
|
1411
1374
|
};
|
|
1412
1375
|
var Calendar = forwardRef4((inProps, ref) => {
|
|
@@ -1428,17 +1391,96 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1428
1391
|
...others
|
|
1429
1392
|
} = props;
|
|
1430
1393
|
const { calendarTitle, onPrev, onNext } = useCalendar(ownerState);
|
|
1431
|
-
|
|
1432
|
-
|
|
1394
|
+
const [isMonthViewAssistHintOpen, setIsMonthViewAssistHintOpen] = useState4(false);
|
|
1395
|
+
const monthNavClickTimestampsRef = useRef3([]);
|
|
1396
|
+
const monthViewAssistHintShownInSessionRef = useRef3(false);
|
|
1397
|
+
const monthViewAssistHintTimeoutRef = useRef3(null);
|
|
1398
|
+
const hasEndDate = Boolean(value?.[1]);
|
|
1399
|
+
const isRangeHintEligible = Boolean(rangeSelection && !hasEndDate);
|
|
1400
|
+
const isHintEligible = Boolean(view === "day" && (!rangeSelection || isRangeHintEligible));
|
|
1401
|
+
const monthViewHintMessage = MONTH_VIEW_HINT_MESSAGE;
|
|
1402
|
+
useEffect3(() => {
|
|
1403
|
+
if (!isHintEligible) {
|
|
1404
|
+
monthNavClickTimestampsRef.current = [];
|
|
1405
|
+
setIsMonthViewAssistHintOpen(false);
|
|
1406
|
+
}
|
|
1407
|
+
}, [isHintEligible]);
|
|
1408
|
+
useEffect3(() => {
|
|
1409
|
+
return () => {
|
|
1410
|
+
if (monthViewAssistHintTimeoutRef.current) {
|
|
1411
|
+
clearTimeout(monthViewAssistHintTimeoutRef.current);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
}, []);
|
|
1415
|
+
const closeMonthViewAssistHint = useCallback5(() => {
|
|
1416
|
+
if (monthViewAssistHintTimeoutRef.current) {
|
|
1417
|
+
clearTimeout(monthViewAssistHintTimeoutRef.current);
|
|
1418
|
+
monthViewAssistHintTimeoutRef.current = null;
|
|
1419
|
+
}
|
|
1420
|
+
setIsMonthViewAssistHintOpen(false);
|
|
1421
|
+
}, []);
|
|
1422
|
+
const showMonthViewAssistHint = useCallback5(() => {
|
|
1423
|
+
const now = Date.now();
|
|
1424
|
+
if (monthViewAssistHintShownInSessionRef.current) return;
|
|
1425
|
+
if (now - lastMonthViewAssistHintShownAt < MONTH_VIEW_HINT_COOLDOWN_MS) return;
|
|
1426
|
+
monthViewAssistHintShownInSessionRef.current = true;
|
|
1427
|
+
lastMonthViewAssistHintShownAt = now;
|
|
1428
|
+
setIsMonthViewAssistHintOpen(true);
|
|
1429
|
+
if (monthViewAssistHintTimeoutRef.current) {
|
|
1430
|
+
clearTimeout(monthViewAssistHintTimeoutRef.current);
|
|
1431
|
+
}
|
|
1432
|
+
monthViewAssistHintTimeoutRef.current = setTimeout(() => {
|
|
1433
|
+
setIsMonthViewAssistHintOpen(false);
|
|
1434
|
+
monthViewAssistHintTimeoutRef.current = null;
|
|
1435
|
+
}, MONTH_VIEW_HINT_DURATION_MS);
|
|
1436
|
+
}, []);
|
|
1437
|
+
const trackFastMonthNavigation = useCallback5(() => {
|
|
1438
|
+
if (!isHintEligible) return;
|
|
1439
|
+
const now = Date.now();
|
|
1440
|
+
monthNavClickTimestampsRef.current = [
|
|
1441
|
+
...monthNavClickTimestampsRef.current.filter((timestamp) => now - timestamp <= MONTH_NAV_CLICK_WINDOW_MS),
|
|
1442
|
+
now
|
|
1443
|
+
];
|
|
1444
|
+
if (monthNavClickTimestampsRef.current.length >= MONTH_NAV_CLICK_THRESHOLD) {
|
|
1445
|
+
showMonthViewAssistHint();
|
|
1446
|
+
}
|
|
1447
|
+
}, [isHintEligible, showMonthViewAssistHint]);
|
|
1448
|
+
const handlePrevClick = useCallback5(() => {
|
|
1449
|
+
onPrev();
|
|
1450
|
+
trackFastMonthNavigation();
|
|
1451
|
+
}, [onPrev, trackFastMonthNavigation]);
|
|
1452
|
+
const handleNextClick = useCallback5(() => {
|
|
1453
|
+
onNext();
|
|
1454
|
+
trackFastMonthNavigation();
|
|
1455
|
+
}, [onNext, trackFastMonthNavigation]);
|
|
1456
|
+
const handleSwitchViewClick = useCallback5(() => {
|
|
1457
|
+
closeMonthViewAssistHint();
|
|
1458
|
+
onViewChange?.();
|
|
1459
|
+
}, [closeMonthViewAssistHint, onViewChange]);
|
|
1460
|
+
return /* @__PURE__ */ React12.createElement(CalendarRoot, { ref, ...others }, /* @__PURE__ */ React12.createElement(CalendarHeader, null, /* @__PURE__ */ React12.createElement(IconButton_default, { size: "sm", onClick: handlePrevClick, "aria-label": `Previous ${view === "day" ? "Month" : "Year"}` }, /* @__PURE__ */ React12.createElement(ChevronLeftIcon, null)), /* @__PURE__ */ React12.createElement(
|
|
1461
|
+
Tooltip_default,
|
|
1433
1462
|
{
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1463
|
+
title: monthViewHintMessage,
|
|
1464
|
+
arrow: true,
|
|
1465
|
+
open: isMonthViewAssistHintOpen,
|
|
1466
|
+
placement: "bottom",
|
|
1467
|
+
disableFocusListener: true,
|
|
1468
|
+
disableHoverListener: true,
|
|
1469
|
+
disableTouchListener: true,
|
|
1470
|
+
variant: "solid"
|
|
1439
1471
|
},
|
|
1440
|
-
|
|
1441
|
-
|
|
1472
|
+
/* @__PURE__ */ React12.createElement(
|
|
1473
|
+
CalendarSwitchViewButton,
|
|
1474
|
+
{
|
|
1475
|
+
ownerState,
|
|
1476
|
+
variant: "plain",
|
|
1477
|
+
color: "neutral",
|
|
1478
|
+
onClick: handleSwitchViewClick,
|
|
1479
|
+
"aria-label": "Switch Calendar View"
|
|
1480
|
+
},
|
|
1481
|
+
calendarTitle
|
|
1482
|
+
)
|
|
1483
|
+
), /* @__PURE__ */ React12.createElement(IconButton_default, { size: "sm", onClick: handleNextClick, "aria-label": `Next ${view === "day" ? "Month" : "Year"}` }, /* @__PURE__ */ React12.createElement(ChevronRightIcon, null))), view === "day" && /* @__PURE__ */ React12.createElement(PickerDays, { ownerState }), view === "month" && /* @__PURE__ */ React12.createElement(PickerMonths, { ownerState }));
|
|
1442
1484
|
});
|
|
1443
1485
|
Calendar.displayName = "Calendar";
|
|
1444
1486
|
|
|
@@ -1453,30 +1495,30 @@ import {
|
|
|
1453
1495
|
CardActions as JoyCardActions,
|
|
1454
1496
|
CardOverflow as JoyCardOverflow
|
|
1455
1497
|
} from "@mui/joy";
|
|
1456
|
-
import { motion as
|
|
1457
|
-
var MotionCard =
|
|
1498
|
+
import { motion as motion14 } from "framer-motion";
|
|
1499
|
+
var MotionCard = motion14(JoyCard);
|
|
1458
1500
|
var Card = MotionCard;
|
|
1459
1501
|
Card.displayName = "Card";
|
|
1460
|
-
var MotionCardContent =
|
|
1502
|
+
var MotionCardContent = motion14(JoyCardContent);
|
|
1461
1503
|
var CardContent = MotionCardContent;
|
|
1462
1504
|
CardContent.displayName = "CardContent";
|
|
1463
|
-
var MotionCardCover =
|
|
1505
|
+
var MotionCardCover = motion14(JoyCardCover);
|
|
1464
1506
|
var CardCover = MotionCardCover;
|
|
1465
1507
|
CardCover.displayName = "CardCover";
|
|
1466
|
-
var MotionCardActions =
|
|
1508
|
+
var MotionCardActions = motion14(JoyCardActions);
|
|
1467
1509
|
var CardActions = MotionCardActions;
|
|
1468
1510
|
CardActions.displayName = "CardActions";
|
|
1469
|
-
var MotionCardOverflow =
|
|
1511
|
+
var MotionCardOverflow = motion14(JoyCardOverflow);
|
|
1470
1512
|
var CardOverflow = MotionCardOverflow;
|
|
1471
1513
|
CardOverflow.displayName = "CardOverflow";
|
|
1472
1514
|
|
|
1473
1515
|
// src/components/Checkbox/Checkbox.tsx
|
|
1474
|
-
import
|
|
1516
|
+
import React13 from "react";
|
|
1475
1517
|
import { Checkbox as JoyCheckbox } from "@mui/joy";
|
|
1476
|
-
import { motion as
|
|
1477
|
-
var MotionCheckbox =
|
|
1518
|
+
import { motion as motion15 } from "framer-motion";
|
|
1519
|
+
var MotionCheckbox = motion15(JoyCheckbox);
|
|
1478
1520
|
var Checkbox = (props) => {
|
|
1479
|
-
return /* @__PURE__ */
|
|
1521
|
+
return /* @__PURE__ */ React13.createElement(MotionCheckbox, { ...props });
|
|
1480
1522
|
};
|
|
1481
1523
|
Checkbox.displayName = "Checkbox";
|
|
1482
1524
|
|
|
@@ -1485,7 +1527,7 @@ var Checkbox_default = Checkbox;
|
|
|
1485
1527
|
|
|
1486
1528
|
// src/components/Container/Container.tsx
|
|
1487
1529
|
import { styled as styled6 } from "@mui/joy";
|
|
1488
|
-
import
|
|
1530
|
+
import React14, { forwardRef as forwardRef5 } from "react";
|
|
1489
1531
|
var ContainerRoot = styled6("div", {
|
|
1490
1532
|
name: "Container",
|
|
1491
1533
|
slot: "root",
|
|
@@ -1512,24 +1554,23 @@ var ContainerRoot = styled6("div", {
|
|
|
1512
1554
|
} : null
|
|
1513
1555
|
]);
|
|
1514
1556
|
var Container = forwardRef5(function Container2(props, ref) {
|
|
1515
|
-
return /* @__PURE__ */
|
|
1557
|
+
return /* @__PURE__ */ React14.createElement(ContainerRoot, { ref, ...props });
|
|
1516
1558
|
});
|
|
1517
1559
|
Container.displayName = "Container";
|
|
1518
1560
|
|
|
1519
1561
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1520
|
-
import
|
|
1521
|
-
import { IntlMessageFormat as IntlMessageFormat2 } from "intl-messageformat";
|
|
1562
|
+
import React16, { useCallback as useCallback7, useMemo as useMemo5, useState as useState6 } from "react";
|
|
1522
1563
|
import { NumericFormat } from "react-number-format";
|
|
1523
1564
|
|
|
1524
1565
|
// src/components/Input/Input.tsx
|
|
1525
|
-
import
|
|
1566
|
+
import React15, { useCallback as useCallback6, useState as useState5 } from "react";
|
|
1526
1567
|
import { Input as JoyInput } from "@mui/joy";
|
|
1527
|
-
import { motion as
|
|
1568
|
+
import { motion as motion16 } from "framer-motion";
|
|
1528
1569
|
import ClearIcon from "@mui/icons-material/Close";
|
|
1529
1570
|
import VisibilityIcon from "@mui/icons-material/Visibility";
|
|
1530
1571
|
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
1531
|
-
var MotionInput =
|
|
1532
|
-
var Input =
|
|
1572
|
+
var MotionInput = motion16(JoyInput);
|
|
1573
|
+
var Input = React15.forwardRef((props, ref) => {
|
|
1533
1574
|
const {
|
|
1534
1575
|
label,
|
|
1535
1576
|
helperText,
|
|
@@ -1552,11 +1593,11 @@ var Input = React14.forwardRef((props, ref) => {
|
|
|
1552
1593
|
if (type === "password" && innerProps.endDecorator) {
|
|
1553
1594
|
console.warn('Input: endDecorator is not supported when type="password"');
|
|
1554
1595
|
}
|
|
1555
|
-
const [passwordVisible, setPasswordVisible] =
|
|
1596
|
+
const [passwordVisible, setPasswordVisible] = useState5(false);
|
|
1556
1597
|
const [value, setValue] = useControlledState(
|
|
1557
1598
|
props.value,
|
|
1558
1599
|
props.defaultValue,
|
|
1559
|
-
|
|
1600
|
+
useCallback6(
|
|
1560
1601
|
(value2) => {
|
|
1561
1602
|
onChange?.({
|
|
1562
1603
|
/**
|
|
@@ -1582,7 +1623,7 @@ var Input = React14.forwardRef((props, ref) => {
|
|
|
1582
1623
|
const actualType = type === "password" && passwordVisible ? "text" : type;
|
|
1583
1624
|
const isPasswordType = type === "password";
|
|
1584
1625
|
const showPasswordToggle = isPasswordType && !disableTogglePasswordButton;
|
|
1585
|
-
const input = /* @__PURE__ */
|
|
1626
|
+
const input = /* @__PURE__ */ React15.createElement(
|
|
1586
1627
|
MotionInput,
|
|
1587
1628
|
{
|
|
1588
1629
|
value,
|
|
@@ -1597,7 +1638,7 @@ var Input = React14.forwardRef((props, ref) => {
|
|
|
1597
1638
|
...innerProps.slotProps
|
|
1598
1639
|
},
|
|
1599
1640
|
...innerProps,
|
|
1600
|
-
endDecorator: isPasswordType ? showPasswordToggle ? /* @__PURE__ */
|
|
1641
|
+
endDecorator: isPasswordType ? showPasswordToggle ? /* @__PURE__ */ React15.createElement(Stack_default, { gap: 1, direction: "row" }, /* @__PURE__ */ React15.createElement(
|
|
1601
1642
|
IconButton_default,
|
|
1602
1643
|
{
|
|
1603
1644
|
onMouseDown: (e) => e.preventDefault(),
|
|
@@ -1605,19 +1646,19 @@ var Input = React14.forwardRef((props, ref) => {
|
|
|
1605
1646
|
disabled,
|
|
1606
1647
|
"aria-label": passwordVisible ? "Hide password" : "Show password"
|
|
1607
1648
|
},
|
|
1608
|
-
passwordVisible ? /* @__PURE__ */
|
|
1609
|
-
)) : null : enableClearable ? /* @__PURE__ */
|
|
1649
|
+
passwordVisible ? /* @__PURE__ */ React15.createElement(VisibilityOffIcon, null) : /* @__PURE__ */ React15.createElement(VisibilityIcon, null)
|
|
1650
|
+
)) : null : enableClearable ? /* @__PURE__ */ React15.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator, value && /* @__PURE__ */ React15.createElement(
|
|
1610
1651
|
IconButton_default,
|
|
1611
1652
|
{
|
|
1612
1653
|
onMouseDown: (e) => e.preventDefault(),
|
|
1613
1654
|
onClick: handleClear,
|
|
1614
1655
|
"aria-label": "Clear"
|
|
1615
1656
|
},
|
|
1616
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ React15.createElement(ClearIcon, null)
|
|
1617
1658
|
)) : innerProps.endDecorator
|
|
1618
1659
|
}
|
|
1619
1660
|
);
|
|
1620
|
-
return /* @__PURE__ */
|
|
1661
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1621
1662
|
FormControl_default,
|
|
1622
1663
|
{
|
|
1623
1664
|
required,
|
|
@@ -1628,9 +1669,9 @@ var Input = React14.forwardRef((props, ref) => {
|
|
|
1628
1669
|
sx,
|
|
1629
1670
|
className
|
|
1630
1671
|
},
|
|
1631
|
-
label && /* @__PURE__ */
|
|
1672
|
+
label && /* @__PURE__ */ React15.createElement(FormLabel_default, null, label),
|
|
1632
1673
|
input,
|
|
1633
|
-
helperText && /* @__PURE__ */
|
|
1674
|
+
helperText && /* @__PURE__ */ React15.createElement(FormHelperText_default, null, helperText)
|
|
1634
1675
|
);
|
|
1635
1676
|
});
|
|
1636
1677
|
Input.displayName = "Input";
|
|
@@ -1642,7 +1683,6 @@ var Input_default = Input;
|
|
|
1642
1683
|
import { styled as styled7, useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
1643
1684
|
|
|
1644
1685
|
// src/components/CurrencyInput/hooks/use-currency-setting.ts
|
|
1645
|
-
import IntlMessageFormat from "intl-messageformat";
|
|
1646
1686
|
var CURRENCY_DECIMAL_MAP = {
|
|
1647
1687
|
AED: 2,
|
|
1648
1688
|
ALL: 2,
|
|
@@ -1787,9 +1827,10 @@ var CURRENCY_DECIMAL_MAP = {
|
|
|
1787
1827
|
};
|
|
1788
1828
|
var useCurrencySetting = (props) => {
|
|
1789
1829
|
const { currency = "USD", placeholder } = props;
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1792
|
-
|
|
1830
|
+
const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
|
|
1831
|
+
const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
|
|
1832
|
+
const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1833
|
+
const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1793
1834
|
const decimalScale = CURRENCY_DECIMAL_MAP[currency];
|
|
1794
1835
|
return {
|
|
1795
1836
|
symbol: `${symbol} `,
|
|
@@ -1802,9 +1843,9 @@ var useCurrencySetting = (props) => {
|
|
|
1802
1843
|
};
|
|
1803
1844
|
|
|
1804
1845
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1805
|
-
var TextMaskAdapter =
|
|
1846
|
+
var TextMaskAdapter = React16.forwardRef(function TextMaskAdapter2(props, ref) {
|
|
1806
1847
|
const { onChange, ...innerProps } = props;
|
|
1807
|
-
return /* @__PURE__ */
|
|
1848
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1808
1849
|
NumericFormat,
|
|
1809
1850
|
{
|
|
1810
1851
|
...innerProps,
|
|
@@ -1824,7 +1865,7 @@ var CurrencyInputRoot = styled7(Input_default, {
|
|
|
1824
1865
|
slot: "root",
|
|
1825
1866
|
overridesResolver: (props, styles) => styles.root
|
|
1826
1867
|
})({});
|
|
1827
|
-
var CurrencyInput =
|
|
1868
|
+
var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
1828
1869
|
const props = useThemeProps3({ props: inProps, name: "CurrencyInput" });
|
|
1829
1870
|
const {
|
|
1830
1871
|
currency = "USD",
|
|
@@ -1845,7 +1886,7 @@ var CurrencyInput = React15.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1845
1886
|
const [_value, setValue] = useControlledState(
|
|
1846
1887
|
props.value,
|
|
1847
1888
|
props.defaultValue,
|
|
1848
|
-
|
|
1889
|
+
useCallback7((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
1849
1890
|
);
|
|
1850
1891
|
const value = useMemo5(() => {
|
|
1851
1892
|
if (_value && useMinorUnit) {
|
|
@@ -1859,14 +1900,14 @@ var CurrencyInput = React15.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1859
1900
|
}
|
|
1860
1901
|
return props.max;
|
|
1861
1902
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
1862
|
-
const [isOverLimit, setIsOverLimit] =
|
|
1863
|
-
const handleChange =
|
|
1903
|
+
const [isOverLimit, setIsOverLimit] = useState6(!!max && !!value && value > max);
|
|
1904
|
+
const handleChange = useCallback7(
|
|
1864
1905
|
(event) => {
|
|
1865
1906
|
if (event.target.value === "") {
|
|
1866
1907
|
setValue(void 0);
|
|
1867
1908
|
return;
|
|
1868
1909
|
}
|
|
1869
|
-
const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
|
|
1910
|
+
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
1870
1911
|
if (!!max && Number(event.target.value) > max) {
|
|
1871
1912
|
setIsOverLimit(true);
|
|
1872
1913
|
} else {
|
|
@@ -1876,7 +1917,7 @@ var CurrencyInput = React15.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1876
1917
|
},
|
|
1877
1918
|
[decimalSeparator, max, useMinorUnit, setValue]
|
|
1878
1919
|
);
|
|
1879
|
-
return /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1880
1921
|
CurrencyInputRoot,
|
|
1881
1922
|
{
|
|
1882
1923
|
...innerProps,
|
|
@@ -1889,9 +1930,7 @@ var CurrencyInput = React15.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1889
1930
|
required,
|
|
1890
1931
|
color: error || isOverLimit ? "danger" : props.color,
|
|
1891
1932
|
label,
|
|
1892
|
-
helperText: isOverLimit ?
|
|
1893
|
-
amount: max
|
|
1894
|
-
}) : helperText,
|
|
1933
|
+
helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
|
|
1895
1934
|
slotProps: {
|
|
1896
1935
|
input: {
|
|
1897
1936
|
component: TextMaskAdapter,
|
|
@@ -1916,9 +1955,9 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
1916
1955
|
|
|
1917
1956
|
// src/components/DataTable/DataTable.tsx
|
|
1918
1957
|
import React25, {
|
|
1919
|
-
useCallback as
|
|
1958
|
+
useCallback as useCallback12,
|
|
1920
1959
|
useMemo as useMemo10,
|
|
1921
|
-
useRef as
|
|
1960
|
+
useRef as useRef7,
|
|
1922
1961
|
useId,
|
|
1923
1962
|
forwardRef as forwardRef7,
|
|
1924
1963
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -1971,14 +2010,15 @@ function reorderColumnsByGroupingModel(columns, columnGroupingModel) {
|
|
|
1971
2010
|
}
|
|
1972
2011
|
return reorderedColumns;
|
|
1973
2012
|
}
|
|
1974
|
-
function flattenColumnGroups(items, groupPath = [], columnIndex = { current: 0 }) {
|
|
2013
|
+
function flattenColumnGroups(items, groupPath = [], columnIndex = { current: 0 }, visibleFields) {
|
|
1975
2014
|
const result = [];
|
|
1976
2015
|
for (const item of items) {
|
|
1977
2016
|
if ("groupId" in item) {
|
|
1978
2017
|
const newPath = [...groupPath, item.groupId];
|
|
1979
2018
|
const children = Array.isArray(item.children) ? item.children : [item.children];
|
|
1980
|
-
result.push(...flattenColumnGroups(children, newPath, columnIndex));
|
|
2019
|
+
result.push(...flattenColumnGroups(children, newPath, columnIndex, visibleFields));
|
|
1981
2020
|
} else {
|
|
2021
|
+
if (visibleFields && !visibleFields.has(item.field)) continue;
|
|
1982
2022
|
result.push({
|
|
1983
2023
|
...item,
|
|
1984
2024
|
groupPath,
|
|
@@ -1988,9 +2028,9 @@ function flattenColumnGroups(items, groupPath = [], columnIndex = { current: 0 }
|
|
|
1988
2028
|
}
|
|
1989
2029
|
return result;
|
|
1990
2030
|
}
|
|
1991
|
-
function calculateColumnGroups(columnGroupingModel, columns) {
|
|
2031
|
+
function calculateColumnGroups(columnGroupingModel, columns, visibleFields) {
|
|
1992
2032
|
const fieldsInGroupingModel = extractFieldsFromGroupingModel(columnGroupingModel);
|
|
1993
|
-
const flattenedColumns = flattenColumnGroups(columnGroupingModel);
|
|
2033
|
+
const flattenedColumns = flattenColumnGroups(columnGroupingModel, [], { current: 0 }, visibleFields);
|
|
1994
2034
|
const columnIndexMap = new Map(flattenedColumns.map((col) => [col.field, col.columnIndex]));
|
|
1995
2035
|
const processedGroups = /* @__PURE__ */ new Map();
|
|
1996
2036
|
const groupsByLevel = [];
|
|
@@ -2038,7 +2078,9 @@ function calculateColumnGroups(columnGroupingModel, columns) {
|
|
|
2038
2078
|
groupsByLevel.forEach((level) => {
|
|
2039
2079
|
level.sort((a, b) => a.startIndex - b.startIndex);
|
|
2040
2080
|
});
|
|
2041
|
-
|
|
2081
|
+
const filteredGroupsByLevel = groupsByLevel.map((level) => level.filter((g) => g.colspan > 0)).filter((level) => level.length > 0);
|
|
2082
|
+
const correctedMaxLevel = filteredGroupsByLevel.length > 0 ? filteredGroupsByLevel.length - 1 : -1;
|
|
2083
|
+
return { groups: filteredGroupsByLevel, maxLevel: correctedMaxLevel, fieldsInGroupingModel };
|
|
2042
2084
|
}
|
|
2043
2085
|
function getTextAlign(props) {
|
|
2044
2086
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
@@ -2046,18 +2088,28 @@ function getTextAlign(props) {
|
|
|
2046
2088
|
var numberFormatter = (value) => "Intl" in window ? new Intl.NumberFormat().format(value) : value;
|
|
2047
2089
|
|
|
2048
2090
|
// src/components/DataTable/styled.tsx
|
|
2049
|
-
import
|
|
2091
|
+
import React17 from "react";
|
|
2050
2092
|
import { styled as styled8, LinearProgress, buttonClasses, iconButtonClasses } from "@mui/joy";
|
|
2051
|
-
import { motion as
|
|
2093
|
+
import { motion as motion17 } from "framer-motion";
|
|
2052
2094
|
import SortIcon from "@mui/icons-material/ArrowUpwardRounded";
|
|
2053
2095
|
var EllipsisDiv = styled8("div", {
|
|
2054
2096
|
name: "DataTable",
|
|
2055
|
-
slot: "textEllipsis"
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2097
|
+
slot: "textEllipsis",
|
|
2098
|
+
shouldForwardProp: (prop) => prop !== "lineClamp"
|
|
2099
|
+
})(
|
|
2100
|
+
({ lineClamp }) => lineClamp && lineClamp > 1 ? {
|
|
2101
|
+
overflow: "hidden",
|
|
2102
|
+
display: "-webkit-box !important",
|
|
2103
|
+
WebkitBoxOrient: "vertical",
|
|
2104
|
+
WebkitLineClamp: lineClamp,
|
|
2105
|
+
whiteSpace: "normal",
|
|
2106
|
+
overflowWrap: "anywhere"
|
|
2107
|
+
} : {
|
|
2108
|
+
overflow: "hidden",
|
|
2109
|
+
textOverflow: "ellipsis",
|
|
2110
|
+
whiteSpace: "nowrap"
|
|
2111
|
+
}
|
|
2112
|
+
);
|
|
2061
2113
|
var OverlayWrapper = styled8("tr", {
|
|
2062
2114
|
name: "DataTable",
|
|
2063
2115
|
slot: "overlayWrapper"
|
|
@@ -2122,7 +2174,7 @@ var Asterisk = styled8("span", {
|
|
|
2122
2174
|
color: "var(--ceed-palette-danger-500)",
|
|
2123
2175
|
marginLeft: theme.spacing(0.5)
|
|
2124
2176
|
}));
|
|
2125
|
-
var StyledTh = styled8(
|
|
2177
|
+
var StyledTh = styled8(motion17.th)(({ theme }) => ({
|
|
2126
2178
|
boxShadow: "1px 0 var(--TableCell-borderColor)"
|
|
2127
2179
|
}));
|
|
2128
2180
|
var StyledTd = styled8("td")(({ theme }) => ({
|
|
@@ -2141,9 +2193,9 @@ var StyledTd = styled8("td")(({ theme }) => ({
|
|
|
2141
2193
|
}
|
|
2142
2194
|
}
|
|
2143
2195
|
}));
|
|
2144
|
-
var MotionSortIcon =
|
|
2145
|
-
var DefaultLoadingOverlay = () => /* @__PURE__ */
|
|
2146
|
-
var Resizer = (ref, targetRef = ref) => /* @__PURE__ */
|
|
2196
|
+
var MotionSortIcon = motion17(SortIcon);
|
|
2197
|
+
var DefaultLoadingOverlay = () => /* @__PURE__ */ React17.createElement(LinearProgress, { value: 8, variant: "plain" });
|
|
2198
|
+
var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ React17.createElement(
|
|
2147
2199
|
Box_default,
|
|
2148
2200
|
{
|
|
2149
2201
|
sx: {
|
|
@@ -2176,12 +2228,12 @@ var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ React16.createElement(
|
|
|
2176
2228
|
|
|
2177
2229
|
// src/components/DataTable/components.tsx
|
|
2178
2230
|
import React22, {
|
|
2179
|
-
useRef as
|
|
2180
|
-
useState as
|
|
2231
|
+
useRef as useRef5,
|
|
2232
|
+
useState as useState8,
|
|
2181
2233
|
useLayoutEffect,
|
|
2182
2234
|
useMemo as useMemo8,
|
|
2183
|
-
useCallback as
|
|
2184
|
-
useEffect as
|
|
2235
|
+
useCallback as useCallback9,
|
|
2236
|
+
useEffect as useEffect5,
|
|
2185
2237
|
memo,
|
|
2186
2238
|
createElement
|
|
2187
2239
|
} from "react";
|
|
@@ -2189,7 +2241,7 @@ import { styled as styled12, useTheme } from "@mui/joy";
|
|
|
2189
2241
|
import { AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2190
2242
|
|
|
2191
2243
|
// src/components/DatePicker/DatePicker.tsx
|
|
2192
|
-
import
|
|
2244
|
+
import React18, { forwardRef as forwardRef6, useCallback as useCallback8, useEffect as useEffect4, useImperativeHandle, useRef as useRef4, useState as useState7 } from "react";
|
|
2193
2245
|
import { IMaskInput, IMask } from "react-imask";
|
|
2194
2246
|
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
2195
2247
|
import { styled as styled10, useThemeProps as useThemeProps4 } from "@mui/joy";
|
|
@@ -2204,8 +2256,8 @@ var Sheet_default = Sheet;
|
|
|
2204
2256
|
|
|
2205
2257
|
// src/components/DialogActions/DialogActions.tsx
|
|
2206
2258
|
import { DialogActions as JoyDialogActions, styled as styled9 } from "@mui/joy";
|
|
2207
|
-
import { motion as
|
|
2208
|
-
var MotionDialogActions =
|
|
2259
|
+
import { motion as motion18 } from "framer-motion";
|
|
2260
|
+
var MotionDialogActions = motion18(JoyDialogActions);
|
|
2209
2261
|
var StyledDialogActions = styled9(MotionDialogActions)(({ theme }) => ({
|
|
2210
2262
|
padding: theme.spacing(2),
|
|
2211
2263
|
gap: theme.spacing(2),
|
|
@@ -2301,9 +2353,9 @@ function parseDate(dateString, format) {
|
|
|
2301
2353
|
var formatToPattern = (format) => {
|
|
2302
2354
|
return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/DD/g, "D").replace(/[^YMD\s]/g, (match) => `${match}\``);
|
|
2303
2355
|
};
|
|
2304
|
-
var TextMaskAdapter3 =
|
|
2356
|
+
var TextMaskAdapter3 = React18.forwardRef(function TextMaskAdapter4(props, ref) {
|
|
2305
2357
|
const { onChange, format, ...other } = props;
|
|
2306
|
-
return /* @__PURE__ */
|
|
2358
|
+
return /* @__PURE__ */ React18.createElement(
|
|
2307
2359
|
IMaskInput,
|
|
2308
2360
|
{
|
|
2309
2361
|
...other,
|
|
@@ -2363,24 +2415,24 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2363
2415
|
shouldDisableDate,
|
|
2364
2416
|
...innerProps
|
|
2365
2417
|
} = props;
|
|
2366
|
-
const innerRef =
|
|
2367
|
-
const buttonRef =
|
|
2418
|
+
const innerRef = useRef4(null);
|
|
2419
|
+
const buttonRef = useRef4(null);
|
|
2368
2420
|
const [value, setValue] = useControlledState(
|
|
2369
2421
|
props.value,
|
|
2370
2422
|
props.defaultValue || "",
|
|
2371
|
-
|
|
2423
|
+
useCallback8((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
2372
2424
|
);
|
|
2373
|
-
const [displayValue, setDisplayValue] =
|
|
2425
|
+
const [displayValue, setDisplayValue] = useState7(
|
|
2374
2426
|
() => value ? formatValueString(parseDate(value, format), displayFormat) : ""
|
|
2375
2427
|
);
|
|
2376
|
-
const [anchorEl, setAnchorEl] =
|
|
2428
|
+
const [anchorEl, setAnchorEl] = useState7(null);
|
|
2377
2429
|
const open = Boolean(anchorEl);
|
|
2378
|
-
|
|
2430
|
+
useEffect4(() => {
|
|
2379
2431
|
if (!anchorEl) {
|
|
2380
2432
|
innerRef.current?.blur();
|
|
2381
2433
|
}
|
|
2382
2434
|
}, [anchorEl, innerRef]);
|
|
2383
|
-
|
|
2435
|
+
useEffect4(() => {
|
|
2384
2436
|
if (value === "") {
|
|
2385
2437
|
setDisplayValue("");
|
|
2386
2438
|
return;
|
|
@@ -2391,7 +2443,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2391
2443
|
}
|
|
2392
2444
|
}, [displayFormat, displayValue, format, value]);
|
|
2393
2445
|
useImperativeHandle(ref, () => innerRef.current, [innerRef]);
|
|
2394
|
-
const handleChange =
|
|
2446
|
+
const handleChange = useCallback8(
|
|
2395
2447
|
(event) => {
|
|
2396
2448
|
const value2 = event.target.value;
|
|
2397
2449
|
setDisplayValue(value2 ? formatValueString(parseDate(value2, format), displayFormat) : value2);
|
|
@@ -2399,7 +2451,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2399
2451
|
},
|
|
2400
2452
|
[displayFormat, format, setValue]
|
|
2401
2453
|
);
|
|
2402
|
-
const handleDisplayInputChange =
|
|
2454
|
+
const handleDisplayInputChange = useCallback8(
|
|
2403
2455
|
(event) => {
|
|
2404
2456
|
if (event.target.value === "") {
|
|
2405
2457
|
handleChange({
|
|
@@ -2424,7 +2476,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2424
2476
|
},
|
|
2425
2477
|
[displayFormat, format, handleChange, props.name]
|
|
2426
2478
|
);
|
|
2427
|
-
const handleCalendarToggle =
|
|
2479
|
+
const handleCalendarToggle = useCallback8(
|
|
2428
2480
|
(event) => {
|
|
2429
2481
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
2430
2482
|
setTimeout(() => {
|
|
@@ -2433,7 +2485,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2433
2485
|
},
|
|
2434
2486
|
[anchorEl, setAnchorEl, innerRef]
|
|
2435
2487
|
);
|
|
2436
|
-
const handleInputMouseDown =
|
|
2488
|
+
const handleInputMouseDown = useCallback8(
|
|
2437
2489
|
(event) => {
|
|
2438
2490
|
if (inputReadOnly) {
|
|
2439
2491
|
event.preventDefault();
|
|
@@ -2442,7 +2494,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2442
2494
|
},
|
|
2443
2495
|
[inputReadOnly, buttonRef]
|
|
2444
2496
|
);
|
|
2445
|
-
return /* @__PURE__ */
|
|
2497
|
+
return /* @__PURE__ */ React18.createElement(DatePickerRoot, null, /* @__PURE__ */ React18.createElement(FocusTrap, { open: true }, /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
2446
2498
|
Input_default,
|
|
2447
2499
|
{
|
|
2448
2500
|
...innerProps,
|
|
@@ -2470,7 +2522,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2470
2522
|
},
|
|
2471
2523
|
className,
|
|
2472
2524
|
sx,
|
|
2473
|
-
endDecorator: /* @__PURE__ */
|
|
2525
|
+
endDecorator: /* @__PURE__ */ React18.createElement(
|
|
2474
2526
|
CalendarButton,
|
|
2475
2527
|
{
|
|
2476
2528
|
ref: buttonRef,
|
|
@@ -2482,13 +2534,13 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2482
2534
|
"aria-expanded": open,
|
|
2483
2535
|
disabled
|
|
2484
2536
|
},
|
|
2485
|
-
/* @__PURE__ */
|
|
2537
|
+
/* @__PURE__ */ React18.createElement(CalendarTodayIcon, null)
|
|
2486
2538
|
),
|
|
2487
2539
|
label,
|
|
2488
2540
|
helperText,
|
|
2489
2541
|
readOnly: readOnly || inputReadOnly
|
|
2490
2542
|
}
|
|
2491
|
-
), open && /* @__PURE__ */
|
|
2543
|
+
), open && /* @__PURE__ */ React18.createElement(ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ React18.createElement(
|
|
2492
2544
|
StyledPopper,
|
|
2493
2545
|
{
|
|
2494
2546
|
id: "date-picker-popper",
|
|
@@ -2507,7 +2559,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2507
2559
|
"aria-label": "Calendar Tooltip",
|
|
2508
2560
|
"aria-expanded": open
|
|
2509
2561
|
},
|
|
2510
|
-
/* @__PURE__ */
|
|
2562
|
+
/* @__PURE__ */ React18.createElement(CalendarSheet, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ React18.createElement(
|
|
2511
2563
|
Calendar_default,
|
|
2512
2564
|
{
|
|
2513
2565
|
value: value && !Number.isNaN(parseDate(value, format).getTime()) ? [parseDate(value, format), void 0] : void 0,
|
|
@@ -2526,14 +2578,14 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2526
2578
|
disablePast,
|
|
2527
2579
|
shouldDisableDate: shouldDisableDate ? (date) => shouldDisableDate(formatValueString(date, format)) : void 0
|
|
2528
2580
|
}
|
|
2529
|
-
), !hideClearButton && /* @__PURE__ */
|
|
2581
|
+
), !hideClearButton && /* @__PURE__ */ React18.createElement(
|
|
2530
2582
|
DialogActions_default,
|
|
2531
2583
|
{
|
|
2532
2584
|
sx: {
|
|
2533
2585
|
p: 1
|
|
2534
2586
|
}
|
|
2535
2587
|
},
|
|
2536
|
-
/* @__PURE__ */
|
|
2588
|
+
/* @__PURE__ */ React18.createElement(
|
|
2537
2589
|
Button_default,
|
|
2538
2590
|
{
|
|
2539
2591
|
size,
|
|
@@ -2559,10 +2611,10 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2559
2611
|
var DatePicker_default = DatePicker;
|
|
2560
2612
|
|
|
2561
2613
|
// src/components/Textarea/Textarea.tsx
|
|
2562
|
-
import
|
|
2614
|
+
import React19 from "react";
|
|
2563
2615
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
2564
|
-
import { motion as
|
|
2565
|
-
var MotionTextarea =
|
|
2616
|
+
import { motion as motion19 } from "framer-motion";
|
|
2617
|
+
var MotionTextarea = motion19(JoyTextarea);
|
|
2566
2618
|
var Textarea = (props) => {
|
|
2567
2619
|
const {
|
|
2568
2620
|
label,
|
|
@@ -2579,7 +2631,7 @@ var Textarea = (props) => {
|
|
|
2579
2631
|
className,
|
|
2580
2632
|
...innerProps
|
|
2581
2633
|
} = props;
|
|
2582
|
-
const textarea = /* @__PURE__ */
|
|
2634
|
+
const textarea = /* @__PURE__ */ React19.createElement(
|
|
2583
2635
|
MotionTextarea,
|
|
2584
2636
|
{
|
|
2585
2637
|
required,
|
|
@@ -2591,7 +2643,7 @@ var Textarea = (props) => {
|
|
|
2591
2643
|
...innerProps
|
|
2592
2644
|
}
|
|
2593
2645
|
);
|
|
2594
|
-
return /* @__PURE__ */
|
|
2646
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2595
2647
|
FormControl_default,
|
|
2596
2648
|
{
|
|
2597
2649
|
required,
|
|
@@ -2602,9 +2654,9 @@ var Textarea = (props) => {
|
|
|
2602
2654
|
sx,
|
|
2603
2655
|
className
|
|
2604
2656
|
},
|
|
2605
|
-
label && /* @__PURE__ */
|
|
2657
|
+
label && /* @__PURE__ */ React19.createElement(FormLabel_default, null, label),
|
|
2606
2658
|
textarea,
|
|
2607
|
-
helperText && /* @__PURE__ */
|
|
2659
|
+
helperText && /* @__PURE__ */ React19.createElement(FormHelperText_default, null, helperText)
|
|
2608
2660
|
);
|
|
2609
2661
|
};
|
|
2610
2662
|
Textarea.displayName = "Textarea";
|
|
@@ -2613,10 +2665,10 @@ Textarea.displayName = "Textarea";
|
|
|
2613
2665
|
var Textarea_default = Textarea;
|
|
2614
2666
|
|
|
2615
2667
|
// src/components/Select/Select.tsx
|
|
2616
|
-
import
|
|
2668
|
+
import React20, { useMemo as useMemo7 } from "react";
|
|
2617
2669
|
import { Select as JoySelect, Option as JoyOption, ListItemContent as ListItemContent2, Typography as Typography3 } from "@mui/joy";
|
|
2618
|
-
import { motion as
|
|
2619
|
-
var MotionOption =
|
|
2670
|
+
import { motion as motion20 } from "framer-motion";
|
|
2671
|
+
var MotionOption = motion20(JoyOption);
|
|
2620
2672
|
var Option = MotionOption;
|
|
2621
2673
|
var secondaryTextLevelMap2 = {
|
|
2622
2674
|
sm: "body-xs",
|
|
@@ -2671,7 +2723,7 @@ function Select(props) {
|
|
|
2671
2723
|
});
|
|
2672
2724
|
return map;
|
|
2673
2725
|
}, [options]);
|
|
2674
|
-
const select = /* @__PURE__ */
|
|
2726
|
+
const select = /* @__PURE__ */ React20.createElement(
|
|
2675
2727
|
JoySelect,
|
|
2676
2728
|
{
|
|
2677
2729
|
...innerProps,
|
|
@@ -2688,9 +2740,9 @@ function Select(props) {
|
|
|
2688
2740
|
return optionMap.get(selected.value)?.label;
|
|
2689
2741
|
}
|
|
2690
2742
|
},
|
|
2691
|
-
options.map((option) => /* @__PURE__ */
|
|
2743
|
+
options.map((option) => /* @__PURE__ */ React20.createElement(Option, { key: option.value, value: option.value, disabled: option.disabled }, option.secondaryText ? /* @__PURE__ */ React20.createElement(ListItemContent2, { sx: { gap: 0.5 } }, /* @__PURE__ */ React20.createElement(Typography3, { level: "inherit" }, option.label), /* @__PURE__ */ React20.createElement(Typography3, { level: secondaryTextLevelMap2[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : option.label))
|
|
2692
2744
|
);
|
|
2693
|
-
return /* @__PURE__ */
|
|
2745
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2694
2746
|
FormControl_default,
|
|
2695
2747
|
{
|
|
2696
2748
|
required,
|
|
@@ -2701,9 +2753,9 @@ function Select(props) {
|
|
|
2701
2753
|
sx,
|
|
2702
2754
|
className
|
|
2703
2755
|
},
|
|
2704
|
-
label && /* @__PURE__ */
|
|
2756
|
+
label && /* @__PURE__ */ React20.createElement(FormLabel_default, null, label),
|
|
2705
2757
|
select,
|
|
2706
|
-
helperText && /* @__PURE__ */
|
|
2758
|
+
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
2707
2759
|
);
|
|
2708
2760
|
}
|
|
2709
2761
|
Select.displayName = "Select";
|
|
@@ -2714,19 +2766,6 @@ var Select_default = Select;
|
|
|
2714
2766
|
// src/components/DataTable/components.tsx
|
|
2715
2767
|
import { Link } from "@mui/joy";
|
|
2716
2768
|
|
|
2717
|
-
// src/components/Tooltip/Tooltip.tsx
|
|
2718
|
-
import React20 from "react";
|
|
2719
|
-
import { Tooltip as JoyTooltip } from "@mui/joy";
|
|
2720
|
-
import { motion as motion20 } from "framer-motion";
|
|
2721
|
-
var MotionTooltip = motion20(JoyTooltip);
|
|
2722
|
-
var Tooltip = (props) => {
|
|
2723
|
-
return /* @__PURE__ */ React20.createElement(MotionTooltip, { ...props });
|
|
2724
|
-
};
|
|
2725
|
-
Tooltip.displayName = "Tooltip";
|
|
2726
|
-
|
|
2727
|
-
// src/components/Tooltip/index.ts
|
|
2728
|
-
var Tooltip_default = Tooltip;
|
|
2729
|
-
|
|
2730
2769
|
// src/components/InfoSign/InfoSign.tsx
|
|
2731
2770
|
import React21 from "react";
|
|
2732
2771
|
import { styled as styled11, tooltipClasses } from "@mui/joy";
|
|
@@ -2761,25 +2800,26 @@ function InfoSign(props) {
|
|
|
2761
2800
|
var InfoSign_default = InfoSign;
|
|
2762
2801
|
|
|
2763
2802
|
// src/components/DataTable/components.tsx
|
|
2764
|
-
var TextEllipsis = ({ children }) => {
|
|
2765
|
-
const textRef =
|
|
2766
|
-
const [showTooltip, setShowTooltip] =
|
|
2803
|
+
var TextEllipsis = ({ children, lineClamp }) => {
|
|
2804
|
+
const textRef = useRef5(null);
|
|
2805
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
2767
2806
|
useLayoutEffect(() => {
|
|
2768
2807
|
const element = textRef.current;
|
|
2769
|
-
if (element)
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2808
|
+
if (!element) return;
|
|
2809
|
+
const checkTruncation = () => {
|
|
2810
|
+
const isTruncated = lineClamp && lineClamp > 1 ? element.scrollHeight > element.clientHeight + 1 : element.scrollWidth > element.clientWidth;
|
|
2811
|
+
setShowTooltip(isTruncated);
|
|
2812
|
+
};
|
|
2813
|
+
checkTruncation();
|
|
2814
|
+
const ro = new ResizeObserver(checkTruncation);
|
|
2815
|
+
ro.observe(element);
|
|
2816
|
+
return () => ro.disconnect();
|
|
2817
|
+
}, [children, lineClamp]);
|
|
2818
|
+
return /* @__PURE__ */ React22.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React22.createElement(EllipsisDiv, { ref: textRef, lineClamp }, children));
|
|
2779
2819
|
};
|
|
2780
2820
|
var CellTextEllipsis = ({ children }) => {
|
|
2781
|
-
const textRef =
|
|
2782
|
-
const [showTooltip, setShowTooltip] =
|
|
2821
|
+
const textRef = useRef5(null);
|
|
2822
|
+
const [showTooltip, setShowTooltip] = useState8(false);
|
|
2783
2823
|
useLayoutEffect(() => {
|
|
2784
2824
|
const element = textRef.current;
|
|
2785
2825
|
if (element) {
|
|
@@ -2826,12 +2866,13 @@ var HeadCell = (props) => {
|
|
|
2826
2866
|
pinnedEndPosition,
|
|
2827
2867
|
headerRef,
|
|
2828
2868
|
tableColRef,
|
|
2829
|
-
headerClassName
|
|
2869
|
+
headerClassName,
|
|
2870
|
+
headerLineClamp
|
|
2830
2871
|
} = props;
|
|
2831
2872
|
const theme = useTheme();
|
|
2832
2873
|
const ref = headerRef;
|
|
2833
2874
|
const colRef = tableColRef;
|
|
2834
|
-
const [isHovered, setIsHovered] =
|
|
2875
|
+
const [isHovered, setIsHovered] = useState8(false);
|
|
2835
2876
|
const sortable = type === "actions" ? false : _sortable;
|
|
2836
2877
|
const headId = useMemo8(
|
|
2837
2878
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
@@ -2910,7 +2951,7 @@ var HeadCell = (props) => {
|
|
|
2910
2951
|
ref,
|
|
2911
2952
|
key: field,
|
|
2912
2953
|
style,
|
|
2913
|
-
onClick:
|
|
2954
|
+
onClick: useCallback9(
|
|
2914
2955
|
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
2915
2956
|
[field, onSortChange, sort, sortable]
|
|
2916
2957
|
),
|
|
@@ -2920,7 +2961,7 @@ var HeadCell = (props) => {
|
|
|
2920
2961
|
initial: "initial",
|
|
2921
2962
|
className: computedHeaderClassName
|
|
2922
2963
|
},
|
|
2923
|
-
/* @__PURE__ */ React22.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center" }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ React22.createElement(TextEllipsis,
|
|
2964
|
+
/* @__PURE__ */ React22.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center", sx: { minWidth: 0 } }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ React22.createElement(TextEllipsis, { lineClamp: headerLineClamp }, headerName ?? field, editMode && required && /* @__PURE__ */ React22.createElement(Asterisk, null, "*")), textAlign === "start" && infoSign, textAlign === "start" && sortIcon),
|
|
2924
2965
|
resizer
|
|
2925
2966
|
);
|
|
2926
2967
|
};
|
|
@@ -2945,8 +2986,8 @@ var BodyCell = (props) => {
|
|
|
2945
2986
|
onCellEditStop
|
|
2946
2987
|
} = props;
|
|
2947
2988
|
const theme = useTheme();
|
|
2948
|
-
const [value, setValue] =
|
|
2949
|
-
const cellRef =
|
|
2989
|
+
const [value, setValue] = useState8(row[field]);
|
|
2990
|
+
const cellRef = useRef5(null);
|
|
2950
2991
|
const params = useMemo8(
|
|
2951
2992
|
() => ({
|
|
2952
2993
|
row,
|
|
@@ -3091,7 +3132,7 @@ var BodyCell = (props) => {
|
|
|
3091
3132
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3092
3133
|
[cellClassName, params]
|
|
3093
3134
|
);
|
|
3094
|
-
|
|
3135
|
+
useEffect5(() => {
|
|
3095
3136
|
setValue(row[field]);
|
|
3096
3137
|
}, [row, field]);
|
|
3097
3138
|
return /* @__PURE__ */ React22.createElement(
|
|
@@ -3161,10 +3202,10 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3161
3202
|
});
|
|
3162
3203
|
|
|
3163
3204
|
// src/components/DataTable/hooks.ts
|
|
3164
|
-
import { useState as
|
|
3205
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo9, useCallback as useCallback10, useEffect as useEffect6, createRef } from "react";
|
|
3165
3206
|
function useColumnWidths(columnsByField) {
|
|
3166
|
-
const [widths, setWidths] =
|
|
3167
|
-
const roRef =
|
|
3207
|
+
const [widths, setWidths] = useState9({});
|
|
3208
|
+
const roRef = useRef6();
|
|
3168
3209
|
useLayoutEffect2(() => {
|
|
3169
3210
|
if (roRef.current) roRef.current.disconnect();
|
|
3170
3211
|
roRef.current = new ResizeObserver((entries) => {
|
|
@@ -3212,28 +3253,53 @@ function useDataTableRenderer({
|
|
|
3212
3253
|
getId: _getId,
|
|
3213
3254
|
isTotalSelected: _isTotalSelected,
|
|
3214
3255
|
isRowSelectable,
|
|
3215
|
-
columnGroupingModel
|
|
3256
|
+
columnGroupingModel,
|
|
3257
|
+
columnVisibilityModel,
|
|
3258
|
+
onColumnVisibilityModelChange
|
|
3216
3259
|
}) {
|
|
3217
3260
|
if (pinnedColumns && columnGroupingModel) {
|
|
3218
3261
|
throw new Error(
|
|
3219
3262
|
"You cannot use both `pinnedColumns` and `columnGroupingModel` at the same time. Please choose one of them."
|
|
3220
3263
|
);
|
|
3221
3264
|
}
|
|
3222
|
-
const onSelectionModelChangeRef =
|
|
3265
|
+
const onSelectionModelChangeRef = useRef6(onSelectionModelChange);
|
|
3223
3266
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3224
|
-
const [focusedRowId, setFocusedRowId] =
|
|
3225
|
-
const [selectionAnchor, setSelectionAnchor] =
|
|
3267
|
+
const [focusedRowId, setFocusedRowId] = useState9(null);
|
|
3268
|
+
const [selectionAnchor, setSelectionAnchor] = useState9(null);
|
|
3226
3269
|
const [sortModel, setSortModel] = useControlledState(
|
|
3227
3270
|
controlledSortModel,
|
|
3228
3271
|
initialState?.sorting?.sortModel ?? [],
|
|
3229
|
-
|
|
3272
|
+
useCallback10((sortModel2) => onSortModelChange?.(sortModel2), [onSortModelChange])
|
|
3273
|
+
);
|
|
3274
|
+
const [visibilityModel] = useControlledState(
|
|
3275
|
+
columnVisibilityModel,
|
|
3276
|
+
initialState?.columns?.columnVisibilityModel ?? {},
|
|
3277
|
+
useCallback10(
|
|
3278
|
+
(model) => onColumnVisibilityModelChange?.(model),
|
|
3279
|
+
[onColumnVisibilityModelChange]
|
|
3280
|
+
)
|
|
3230
3281
|
);
|
|
3231
3282
|
const reorderedColumns = useMemo9(() => {
|
|
3232
3283
|
if (!columnGroupingModel) return columnsProp;
|
|
3233
3284
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3234
3285
|
}, [columnsProp, columnGroupingModel]);
|
|
3235
|
-
const
|
|
3286
|
+
const visibleColumns = useMemo9(
|
|
3287
|
+
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3288
|
+
[reorderedColumns, visibilityModel]
|
|
3289
|
+
);
|
|
3290
|
+
const visibleFieldSet = useMemo9(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3291
|
+
const allColumnsByField = useMemo9(
|
|
3236
3292
|
() => reorderedColumns.reduce(
|
|
3293
|
+
(acc, curr) => ({
|
|
3294
|
+
...acc,
|
|
3295
|
+
[curr.field]: curr
|
|
3296
|
+
}),
|
|
3297
|
+
{}
|
|
3298
|
+
),
|
|
3299
|
+
[reorderedColumns]
|
|
3300
|
+
);
|
|
3301
|
+
const visibleColumnsByField = useMemo9(
|
|
3302
|
+
() => visibleColumns.reduce(
|
|
3237
3303
|
(acc, curr) => ({
|
|
3238
3304
|
...acc,
|
|
3239
3305
|
[curr.field]: {
|
|
@@ -3244,15 +3310,16 @@ function useDataTableRenderer({
|
|
|
3244
3310
|
}),
|
|
3245
3311
|
{}
|
|
3246
3312
|
),
|
|
3247
|
-
[
|
|
3313
|
+
[visibleColumns]
|
|
3248
3314
|
);
|
|
3249
|
-
const sortComparator =
|
|
3315
|
+
const sortComparator = useCallback10(
|
|
3250
3316
|
(rowA, rowB) => {
|
|
3251
3317
|
for (const sort of sortModel) {
|
|
3252
3318
|
const { field, sort: direction } = sort;
|
|
3253
3319
|
const a = rowA[field];
|
|
3254
3320
|
const b = rowB[field];
|
|
3255
|
-
const column =
|
|
3321
|
+
const column = allColumnsByField[field];
|
|
3322
|
+
if (!column) continue;
|
|
3256
3323
|
let comparison = 0;
|
|
3257
3324
|
if (column.sortComparator) {
|
|
3258
3325
|
comparison = column.sortComparator({
|
|
@@ -3272,7 +3339,7 @@ function useDataTableRenderer({
|
|
|
3272
3339
|
}
|
|
3273
3340
|
return 0;
|
|
3274
3341
|
},
|
|
3275
|
-
[sortModel,
|
|
3342
|
+
[sortModel, allColumnsByField]
|
|
3276
3343
|
);
|
|
3277
3344
|
const rows = useMemo9(
|
|
3278
3345
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
@@ -3282,9 +3349,9 @@ function useDataTableRenderer({
|
|
|
3282
3349
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3283
3350
|
[_sortOrder]
|
|
3284
3351
|
);
|
|
3285
|
-
const [page, setPage] =
|
|
3352
|
+
const [page, setPage] = useState9(paginationModel?.page || 1);
|
|
3286
3353
|
const pageSize = paginationModel?.pageSize || 20;
|
|
3287
|
-
const getId =
|
|
3354
|
+
const getId = useCallback10(
|
|
3288
3355
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3289
3356
|
[_getId, page, pageSize]
|
|
3290
3357
|
);
|
|
@@ -3300,7 +3367,7 @@ function useDataTableRenderer({
|
|
|
3300
3367
|
}),
|
|
3301
3368
|
[dataInPage, isRowSelectable, getId]
|
|
3302
3369
|
);
|
|
3303
|
-
const handleRangeSelection =
|
|
3370
|
+
const handleRangeSelection = useCallback10(
|
|
3304
3371
|
(anchor, targetIndex) => {
|
|
3305
3372
|
const startIndex = Math.min(anchor.rowIndex, targetIndex);
|
|
3306
3373
|
const endIndex = Math.max(anchor.rowIndex, targetIndex);
|
|
@@ -3336,61 +3403,71 @@ function useDataTableRenderer({
|
|
|
3336
3403
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
3337
3404
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
3338
3405
|
);
|
|
3339
|
-
const columnWidths = useColumnWidths(
|
|
3340
|
-
const getWidth =
|
|
3341
|
-
(f) => columnWidths[f] ??
|
|
3342
|
-
|
|
3343
|
-
[columnWidths,
|
|
3406
|
+
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
3407
|
+
const getWidth = useCallback10(
|
|
3408
|
+
(f) => columnWidths[f] ?? allColumnsByField[f]?.width ?? // Column prop 으로 지정된 width
|
|
3409
|
+
allColumnsByField[f]?.minWidth ?? 0,
|
|
3410
|
+
[columnWidths, allColumnsByField]
|
|
3344
3411
|
);
|
|
3345
3412
|
const processedColumnGroups = useMemo9(() => {
|
|
3346
3413
|
if (!columnGroupingModel) return null;
|
|
3347
|
-
return calculateColumnGroups(columnGroupingModel,
|
|
3348
|
-
}, [columnGroupingModel,
|
|
3414
|
+
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
3415
|
+
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
3416
|
+
const effectivePinnedLeft = useMemo9(
|
|
3417
|
+
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
3418
|
+
[pinnedColumns?.left, visibleFieldSet]
|
|
3419
|
+
);
|
|
3420
|
+
const effectivePinnedRight = useMemo9(
|
|
3421
|
+
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
3422
|
+
[pinnedColumns?.right, visibleFieldSet]
|
|
3423
|
+
);
|
|
3349
3424
|
const columns = useMemo9(() => {
|
|
3350
|
-
const baseColumns =
|
|
3425
|
+
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : Object.keys(rows[0] || {}).map((key) => ({
|
|
3351
3426
|
field: key
|
|
3352
3427
|
}));
|
|
3353
3428
|
return baseColumns.map((column) => {
|
|
3354
|
-
const isLeftPinned =
|
|
3355
|
-
const isRightPinned =
|
|
3429
|
+
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
3430
|
+
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
3356
3431
|
const isPinned = isLeftPinned || isRightPinned;
|
|
3357
3432
|
return {
|
|
3358
3433
|
...column,
|
|
3359
|
-
headerRef:
|
|
3360
|
-
tableColRef:
|
|
3434
|
+
headerRef: visibleColumnsByField[column.field]?.headerRef,
|
|
3435
|
+
tableColRef: visibleColumnsByField[column.field]?.tableColRef,
|
|
3361
3436
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
3362
3437
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
3363
|
-
sortOrder:
|
|
3438
|
+
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
3364
3439
|
isPinned,
|
|
3365
|
-
isLastStartPinnedColumn: isLeftPinned && [...
|
|
3366
|
-
isLastEndPinnedColumn: isRightPinned && (
|
|
3367
|
-
pinnedStartPosition:
|
|
3368
|
-
pinnedEndPosition:
|
|
3440
|
+
isLastStartPinnedColumn: isLeftPinned && [...effectivePinnedLeft || []].pop() === column.field,
|
|
3441
|
+
isLastEndPinnedColumn: isRightPinned && (effectivePinnedRight?.[0] ?? null) === column.field,
|
|
3442
|
+
pinnedStartPosition: effectivePinnedLeft?.slice(0, isLeftPinned ? effectivePinnedLeft.indexOf(column.field) : effectivePinnedLeft.length).reduce((acc, curr) => acc + getWidth(curr), 0),
|
|
3443
|
+
pinnedEndPosition: effectivePinnedRight?.slice(isRightPinned ? effectivePinnedRight.indexOf(column.field) + 1 : 0).reduce((acc, curr) => acc + getWidth(curr), 0)
|
|
3369
3444
|
};
|
|
3370
3445
|
});
|
|
3371
3446
|
}, [
|
|
3447
|
+
visibleColumns,
|
|
3372
3448
|
reorderedColumns,
|
|
3373
3449
|
rows,
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3450
|
+
effectivePinnedLeft,
|
|
3451
|
+
effectivePinnedRight,
|
|
3452
|
+
visibleColumnsByField,
|
|
3453
|
+
allColumnsByField,
|
|
3377
3454
|
editMode,
|
|
3378
3455
|
sortModel,
|
|
3379
3456
|
sortOrder,
|
|
3380
3457
|
getWidth
|
|
3381
3458
|
]);
|
|
3382
|
-
const handlePageChange =
|
|
3459
|
+
const handlePageChange = useCallback10(
|
|
3383
3460
|
(newPage) => {
|
|
3384
3461
|
setPage(newPage);
|
|
3385
3462
|
onPaginationModelChange?.({ page: newPage, pageSize });
|
|
3386
3463
|
},
|
|
3387
3464
|
[onPaginationModelChange, pageSize]
|
|
3388
3465
|
);
|
|
3389
|
-
const handleSortChange =
|
|
3466
|
+
const handleSortChange = useCallback10(
|
|
3390
3467
|
(props) => {
|
|
3391
3468
|
const { field, currentSort, multiple } = props;
|
|
3392
|
-
const column =
|
|
3393
|
-
const columnSortOrder = column
|
|
3469
|
+
const column = allColumnsByField[field];
|
|
3470
|
+
const columnSortOrder = column?.sortOrder || sortOrder;
|
|
3394
3471
|
if (currentSort !== void 0) {
|
|
3395
3472
|
const currentOrderIndex = columnSortOrder.indexOf(currentSort);
|
|
3396
3473
|
const nextSortOrderIndex = (currentOrderIndex + 1) % columnSortOrder.length;
|
|
@@ -3407,25 +3484,25 @@ function useDataTableRenderer({
|
|
|
3407
3484
|
setSortModel(newSortModel);
|
|
3408
3485
|
}
|
|
3409
3486
|
},
|
|
3410
|
-
[sortOrder,
|
|
3487
|
+
[sortOrder, allColumnsByField, sortModel, setSortModel]
|
|
3411
3488
|
);
|
|
3412
|
-
|
|
3489
|
+
useEffect6(() => {
|
|
3413
3490
|
if (!paginationModel) {
|
|
3414
3491
|
handlePageChange(1);
|
|
3415
3492
|
}
|
|
3416
3493
|
}, [rowCount, handlePageChange, paginationModel]);
|
|
3417
|
-
|
|
3494
|
+
useEffect6(() => {
|
|
3418
3495
|
const lastPage = Math.max(1, Math.ceil(rowCount / pageSize));
|
|
3419
3496
|
if (page > lastPage) {
|
|
3420
3497
|
handlePageChange(lastPage);
|
|
3421
3498
|
}
|
|
3422
3499
|
}, [page, rowCount, pageSize, handlePageChange]);
|
|
3423
|
-
|
|
3500
|
+
useEffect6(() => {
|
|
3424
3501
|
onSelectionModelChangeRef.current?.([]);
|
|
3425
3502
|
setSelectionAnchor(null);
|
|
3426
3503
|
}, [page]);
|
|
3427
|
-
const prevRowsRef =
|
|
3428
|
-
|
|
3504
|
+
const prevRowsRef = useRef6(_rows);
|
|
3505
|
+
useEffect6(() => {
|
|
3429
3506
|
if (prevRowsRef.current !== _rows) {
|
|
3430
3507
|
setSelectionAnchor(null);
|
|
3431
3508
|
prevRowsRef.current = _rows;
|
|
@@ -3444,8 +3521,8 @@ function useDataTableRenderer({
|
|
|
3444
3521
|
handleSortChange,
|
|
3445
3522
|
isAllSelected,
|
|
3446
3523
|
isTotalSelected,
|
|
3447
|
-
isSelectedRow:
|
|
3448
|
-
isRowSelectable:
|
|
3524
|
+
isSelectedRow: useCallback10((model) => selectedModelSet.has(model), [selectedModelSet]),
|
|
3525
|
+
isRowSelectable: useCallback10(
|
|
3449
3526
|
(rowId, row) => {
|
|
3450
3527
|
if (!isRowSelectable) return true;
|
|
3451
3528
|
return isRowSelectable({ row, id: rowId });
|
|
@@ -3453,13 +3530,13 @@ function useDataTableRenderer({
|
|
|
3453
3530
|
[isRowSelectable]
|
|
3454
3531
|
),
|
|
3455
3532
|
focusedRowId,
|
|
3456
|
-
onRowFocus:
|
|
3533
|
+
onRowFocus: useCallback10((rowId) => {
|
|
3457
3534
|
setFocusedRowId(rowId);
|
|
3458
3535
|
}, []),
|
|
3459
|
-
onAllCheckboxChange:
|
|
3536
|
+
onAllCheckboxChange: useCallback10(() => {
|
|
3460
3537
|
onSelectionModelChange?.(isAllSelected ? [] : selectableDataInPage.map(getId));
|
|
3461
3538
|
}, [isAllSelected, selectableDataInPage, onSelectionModelChange, getId]),
|
|
3462
|
-
onCheckboxChange:
|
|
3539
|
+
onCheckboxChange: useCallback10(
|
|
3463
3540
|
(event, selectedModel) => {
|
|
3464
3541
|
const isShiftClick = "shiftKey" in event && event.shiftKey;
|
|
3465
3542
|
const rowIndex = dataInPage.findIndex((row, i) => getId(row, i) === selectedModel);
|
|
@@ -3492,7 +3569,7 @@ function useDataTableRenderer({
|
|
|
3492
3569
|
),
|
|
3493
3570
|
columns,
|
|
3494
3571
|
processedColumnGroups,
|
|
3495
|
-
onTotalSelect:
|
|
3572
|
+
onTotalSelect: useCallback10(() => {
|
|
3496
3573
|
const selectableRows = rows.filter((row, i) => {
|
|
3497
3574
|
if (!isRowSelectable) return true;
|
|
3498
3575
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -3577,7 +3654,7 @@ function TableBody(props) {
|
|
|
3577
3654
|
TableBody.displayName = "TableBody";
|
|
3578
3655
|
|
|
3579
3656
|
// src/components/Pagination/Pagination.tsx
|
|
3580
|
-
import React24, { useCallback as
|
|
3657
|
+
import React24, { useCallback as useCallback11, useEffect as useEffect7 } from "react";
|
|
3581
3658
|
import PreviousIcon from "@mui/icons-material/ChevronLeftRounded";
|
|
3582
3659
|
import NextIcon from "@mui/icons-material/ChevronRightRounded";
|
|
3583
3660
|
import FirstPageIcon from "@mui/icons-material/FirstPageRounded";
|
|
@@ -3646,7 +3723,7 @@ function Pagination(props) {
|
|
|
3646
3723
|
const [paginationModel, setPaginationModel] = useControlledState(
|
|
3647
3724
|
_paginationModel,
|
|
3648
3725
|
defaultPaginationModel,
|
|
3649
|
-
|
|
3726
|
+
useCallback11(
|
|
3650
3727
|
(newPage) => {
|
|
3651
3728
|
onPageChange(newPage.page);
|
|
3652
3729
|
},
|
|
@@ -3662,7 +3739,7 @@ function Pagination(props) {
|
|
|
3662
3739
|
const afterPages = [paginationModel.page + 1, paginationModel.page + 2].filter((p) => p <= lastPage - 1);
|
|
3663
3740
|
const isMoreAfterPages = lastPage > 1 && paginationModel.page < lastPage - 3;
|
|
3664
3741
|
const isMoreBeforePages = lastPage > 1 && paginationModel.page > 4;
|
|
3665
|
-
|
|
3742
|
+
useEffect7(() => {
|
|
3666
3743
|
if (paginationModel.page > lastPage) {
|
|
3667
3744
|
setPaginationModel({ ...paginationModel, page: lastPage });
|
|
3668
3745
|
}
|
|
@@ -3833,6 +3910,10 @@ function Component(props, apiRef) {
|
|
|
3833
3910
|
loading,
|
|
3834
3911
|
columnGroupingModel: _________________,
|
|
3835
3912
|
// columnGroupingModel is used in useDataTableRenderer
|
|
3913
|
+
columnVisibilityModel: __________________,
|
|
3914
|
+
// columnVisibilityModel is used in useDataTableRenderer
|
|
3915
|
+
onColumnVisibilityModelChange: ___________________,
|
|
3916
|
+
// onColumnVisibilityModelChange is used in useDataTableRenderer
|
|
3836
3917
|
slots: {
|
|
3837
3918
|
checkbox: RenderCheckbox = Checkbox_default,
|
|
3838
3919
|
toolbar: Toolbar,
|
|
@@ -3845,8 +3926,8 @@ function Component(props, apiRef) {
|
|
|
3845
3926
|
...innerProps
|
|
3846
3927
|
} = props;
|
|
3847
3928
|
const tableId = useId();
|
|
3848
|
-
const parentRef =
|
|
3849
|
-
const tableBodyRef =
|
|
3929
|
+
const parentRef = useRef7(null);
|
|
3930
|
+
const tableBodyRef = useRef7(null);
|
|
3850
3931
|
const {
|
|
3851
3932
|
columns,
|
|
3852
3933
|
processedColumnGroups,
|
|
@@ -3883,20 +3964,20 @@ function Component(props, apiRef) {
|
|
|
3883
3964
|
const paginationModel = useMemo10(() => ({ page, pageSize }), [page, pageSize]);
|
|
3884
3965
|
const totalSize = virtualizer.getTotalSize();
|
|
3885
3966
|
const virtualizedItems = virtualizer.getVirtualItems();
|
|
3886
|
-
const getRowClickHandler =
|
|
3967
|
+
const getRowClickHandler = useCallback12(
|
|
3887
3968
|
(row, rowId) => (e) => {
|
|
3888
3969
|
onRowClick?.({ row, rowId }, e);
|
|
3889
3970
|
checkboxSelection && !disableSelectionOnClick && isRowSelectableCheck(rowId, row) && onCheckboxChange(e, rowId);
|
|
3890
3971
|
},
|
|
3891
3972
|
[onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange, isRowSelectableCheck]
|
|
3892
3973
|
);
|
|
3893
|
-
const getRowFocusHandler =
|
|
3974
|
+
const getRowFocusHandler = useCallback12(
|
|
3894
3975
|
(rowId) => () => {
|
|
3895
3976
|
onRowFocus(rowId);
|
|
3896
3977
|
},
|
|
3897
3978
|
[onRowFocus]
|
|
3898
3979
|
);
|
|
3899
|
-
const getCheckboxClickHandler =
|
|
3980
|
+
const getCheckboxClickHandler = useCallback12(
|
|
3900
3981
|
(rowId, row) => (e) => {
|
|
3901
3982
|
e.stopPropagation();
|
|
3902
3983
|
if (isRowSelectableCheck(rowId, row)) {
|
|
@@ -3906,7 +3987,7 @@ function Component(props, apiRef) {
|
|
|
3906
3987
|
},
|
|
3907
3988
|
[onCheckboxChange, isRowSelectableCheck, onRowFocus]
|
|
3908
3989
|
);
|
|
3909
|
-
const handleTableKeyDown =
|
|
3990
|
+
const handleTableKeyDown = useCallback12(
|
|
3910
3991
|
(e) => {
|
|
3911
3992
|
const supportedKeys = ["ArrowUp", "ArrowDown", " ", "Home", "End", "PageUp", "PageDown"];
|
|
3912
3993
|
if (!supportedKeys.includes(e.key)) return;
|
|
@@ -4072,7 +4153,7 @@ function Component(props, apiRef) {
|
|
|
4072
4153
|
width: c.width
|
|
4073
4154
|
}
|
|
4074
4155
|
}
|
|
4075
|
-
))), /* @__PURE__ */ React25.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ React25.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ React25.createElement(
|
|
4156
|
+
))), /* @__PURE__ */ React25.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.length > 0 && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ React25.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ React25.createElement(
|
|
4076
4157
|
"th",
|
|
4077
4158
|
{
|
|
4078
4159
|
rowSpan: processedColumnGroups.maxLevel + 2,
|
|
@@ -4092,7 +4173,7 @@ function Component(props, apiRef) {
|
|
|
4092
4173
|
...checkboxProps
|
|
4093
4174
|
}
|
|
4094
4175
|
)
|
|
4095
|
-
), level > 0 && Array.from({ length: levelGroups[0]?.startIndex || 0 }).map((_2, i) => /* @__PURE__ */ React25.createElement("th", { key: `empty-${level}-${i}` })), levelGroups.map((group, groupIndex) => {
|
|
4176
|
+
), level > 0 && Array.from({ length: levelGroups[0]?.startIndex || 0 }).map((_2, i) => /* @__PURE__ */ React25.createElement("th", { key: `empty-${level}-${i}` })), levelGroups.filter((g) => g.colspan > 0).map((group, groupIndex) => {
|
|
4096
4177
|
const nextGroup = levelGroups[groupIndex + 1];
|
|
4097
4178
|
const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
|
|
4098
4179
|
const params = { groupId: group.groupId };
|
|
@@ -4110,7 +4191,7 @@ function Component(props, apiRef) {
|
|
|
4110
4191
|
},
|
|
4111
4192
|
group.headerName ?? group.groupId
|
|
4112
4193
|
), emptyCells > 0 && Array.from({ length: emptyCells }).map((_2, i) => /* @__PURE__ */ React25.createElement("th", { key: `empty-between-${level}-${groupIndex}-${i}`, colSpan: 1 })));
|
|
4113
|
-
}))), /* @__PURE__ */ React25.createElement("tr", null, !processedColumnGroups && checkboxSelection && /* @__PURE__ */ React25.createElement(
|
|
4194
|
+
}))), /* @__PURE__ */ React25.createElement("tr", null, (!processedColumnGroups || processedColumnGroups.groups.length === 0) && checkboxSelection && /* @__PURE__ */ React25.createElement(
|
|
4114
4195
|
"th",
|
|
4115
4196
|
{
|
|
4116
4197
|
style: {
|
|
@@ -4248,7 +4329,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4248
4329
|
DataTable.displayName = "DataTable";
|
|
4249
4330
|
|
|
4250
4331
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4251
|
-
import React26, { forwardRef as forwardRef8, useCallback as
|
|
4332
|
+
import React26, { forwardRef as forwardRef8, useCallback as useCallback13, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo11, useRef as useRef8, useState as useState10 } from "react";
|
|
4252
4333
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4253
4334
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4254
4335
|
import { styled as styled14, useThemeProps as useThemeProps5 } from "@mui/joy";
|
|
@@ -4409,23 +4490,23 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
4409
4490
|
readOnly,
|
|
4410
4491
|
...innerProps
|
|
4411
4492
|
} = props;
|
|
4412
|
-
const innerRef =
|
|
4413
|
-
const buttonRef =
|
|
4493
|
+
const innerRef = useRef8(null);
|
|
4494
|
+
const buttonRef = useRef8(null);
|
|
4414
4495
|
const [value, setValue] = useControlledState(
|
|
4415
4496
|
props.value,
|
|
4416
4497
|
props.defaultValue || "",
|
|
4417
|
-
|
|
4498
|
+
useCallback13((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
4418
4499
|
);
|
|
4419
|
-
const [displayValue, setDisplayValue] =
|
|
4500
|
+
const [displayValue, setDisplayValue] = useState10(
|
|
4420
4501
|
() => value ? formatValueString2(parseDates(value, format), displayFormat) : ""
|
|
4421
4502
|
);
|
|
4422
|
-
const [anchorEl, setAnchorEl] =
|
|
4503
|
+
const [anchorEl, setAnchorEl] = useState10(null);
|
|
4423
4504
|
const open = Boolean(anchorEl);
|
|
4424
4505
|
const calendarValue = useMemo11(
|
|
4425
4506
|
() => value ? parseDates(value, format) : void 0,
|
|
4426
4507
|
[value, format]
|
|
4427
4508
|
);
|
|
4428
|
-
|
|
4509
|
+
useEffect8(() => {
|
|
4429
4510
|
if (value) {
|
|
4430
4511
|
try {
|
|
4431
4512
|
const dates = parseDates(value, format);
|
|
@@ -4437,13 +4518,13 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
4437
4518
|
setDisplayValue("");
|
|
4438
4519
|
}
|
|
4439
4520
|
}, [displayFormat, value, format]);
|
|
4440
|
-
|
|
4521
|
+
useEffect8(() => {
|
|
4441
4522
|
if (!anchorEl) {
|
|
4442
4523
|
innerRef.current?.blur();
|
|
4443
4524
|
}
|
|
4444
4525
|
}, [anchorEl, innerRef]);
|
|
4445
4526
|
useImperativeHandle3(ref, () => innerRef.current, [innerRef]);
|
|
4446
|
-
const handleChange =
|
|
4527
|
+
const handleChange = useCallback13(
|
|
4447
4528
|
(event) => {
|
|
4448
4529
|
const value2 = event.target.value;
|
|
4449
4530
|
setDisplayValue(value2 ? formatValueString2(parseDates(value2, format), displayFormat) : value2);
|
|
@@ -4451,7 +4532,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
4451
4532
|
},
|
|
4452
4533
|
[displayFormat, format, setValue]
|
|
4453
4534
|
);
|
|
4454
|
-
const handleDisplayInputChange =
|
|
4535
|
+
const handleDisplayInputChange = useCallback13(
|
|
4455
4536
|
(event) => {
|
|
4456
4537
|
if (event.target.value === "") {
|
|
4457
4538
|
handleChange({
|
|
@@ -4476,14 +4557,14 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
4476
4557
|
},
|
|
4477
4558
|
[displayFormat, format, handleChange, props.name]
|
|
4478
4559
|
);
|
|
4479
|
-
const handleCalendarToggle =
|
|
4560
|
+
const handleCalendarToggle = useCallback13(
|
|
4480
4561
|
(event) => {
|
|
4481
4562
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
4482
4563
|
innerRef.current?.focus();
|
|
4483
4564
|
},
|
|
4484
4565
|
[anchorEl, setAnchorEl, innerRef]
|
|
4485
4566
|
);
|
|
4486
|
-
const handleCalendarChange =
|
|
4567
|
+
const handleCalendarChange = useCallback13(
|
|
4487
4568
|
([date1, date2]) => {
|
|
4488
4569
|
if (!date1 || !date2) return;
|
|
4489
4570
|
const formattedValue = formatValueString2([date1, date2], format);
|
|
@@ -4497,7 +4578,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
4497
4578
|
},
|
|
4498
4579
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat]
|
|
4499
4580
|
);
|
|
4500
|
-
const handleInputMouseDown =
|
|
4581
|
+
const handleInputMouseDown = useCallback13(
|
|
4501
4582
|
(event) => {
|
|
4502
4583
|
if (inputReadOnly) {
|
|
4503
4584
|
event.preventDefault();
|
|
@@ -4729,13 +4810,13 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
4729
4810
|
}));
|
|
4730
4811
|
|
|
4731
4812
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
4732
|
-
import React31, { useCallback as
|
|
4813
|
+
import React31, { useCallback as useCallback14, useEffect as useEffect9, useMemo as useMemo12, useRef as useRef9, useState as useState11 } from "react";
|
|
4733
4814
|
import SearchIcon from "@mui/icons-material/Search";
|
|
4734
4815
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
4735
4816
|
function LabelWithTooltip(props) {
|
|
4736
4817
|
const { label, size } = props;
|
|
4737
|
-
const labelContentRef =
|
|
4738
|
-
const [isOverflowing, setIsOverflowing] =
|
|
4818
|
+
const labelContentRef = useRef9(null);
|
|
4819
|
+
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
4739
4820
|
const labelContent = /* @__PURE__ */ React31.createElement(
|
|
4740
4821
|
"span",
|
|
4741
4822
|
{
|
|
@@ -4752,7 +4833,7 @@ function LabelWithTooltip(props) {
|
|
|
4752
4833
|
},
|
|
4753
4834
|
label
|
|
4754
4835
|
);
|
|
4755
|
-
|
|
4836
|
+
useEffect9(() => {
|
|
4756
4837
|
const element = labelContentRef.current;
|
|
4757
4838
|
if (element) {
|
|
4758
4839
|
setIsOverflowing(element.scrollWidth > element.clientWidth);
|
|
@@ -4776,16 +4857,16 @@ function FilterableCheckboxGroup(props) {
|
|
|
4776
4857
|
maxHeight = 300,
|
|
4777
4858
|
disabled
|
|
4778
4859
|
} = props;
|
|
4779
|
-
const [searchTerm, setSearchTerm] =
|
|
4780
|
-
const [sortedOptions, setSortedOptions] =
|
|
4860
|
+
const [searchTerm, setSearchTerm] = useState11("");
|
|
4861
|
+
const [sortedOptions, setSortedOptions] = useState11(options);
|
|
4781
4862
|
const [internalValue, setInternalValue] = useControlledState(
|
|
4782
4863
|
value,
|
|
4783
4864
|
value ?? [],
|
|
4784
|
-
|
|
4865
|
+
useCallback14((newValue) => onChange?.(newValue), [onChange])
|
|
4785
4866
|
);
|
|
4786
|
-
const parentRef =
|
|
4787
|
-
const isInitialSortRef =
|
|
4788
|
-
const prevOptionsRef =
|
|
4867
|
+
const parentRef = useRef9(null);
|
|
4868
|
+
const isInitialSortRef = useRef9(false);
|
|
4869
|
+
const prevOptionsRef = useRef9([...options]);
|
|
4789
4870
|
const filteredOptions = useMemo12(() => {
|
|
4790
4871
|
if (!searchTerm) return sortedOptions;
|
|
4791
4872
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
@@ -4808,7 +4889,7 @@ function FilterableCheckboxGroup(props) {
|
|
|
4808
4889
|
overscan: 5
|
|
4809
4890
|
});
|
|
4810
4891
|
const items = virtualizer.getVirtualItems();
|
|
4811
|
-
|
|
4892
|
+
useEffect9(() => {
|
|
4812
4893
|
const optionsChanged = prevOptionsRef.current.length !== options.length || prevOptionsRef.current.some(
|
|
4813
4894
|
(prevOption, index) => prevOption.value !== options[index]?.value || prevOption.label !== options[index]?.label || prevOption.disabled !== options[index]?.disabled
|
|
4814
4895
|
);
|
|
@@ -4834,13 +4915,13 @@ function FilterableCheckboxGroup(props) {
|
|
|
4834
4915
|
}
|
|
4835
4916
|
}
|
|
4836
4917
|
}, [options, value]);
|
|
4837
|
-
|
|
4918
|
+
useEffect9(() => {
|
|
4838
4919
|
virtualizer.measure();
|
|
4839
4920
|
}, [virtualizer, filteredOptions, size]);
|
|
4840
|
-
const handleSearchChange =
|
|
4921
|
+
const handleSearchChange = useCallback14((event) => {
|
|
4841
4922
|
setSearchTerm(event.target.value);
|
|
4842
4923
|
}, []);
|
|
4843
|
-
const handleCheckboxChange =
|
|
4924
|
+
const handleCheckboxChange = useCallback14(
|
|
4844
4925
|
(optionValue) => (event) => {
|
|
4845
4926
|
const checked = event.target.checked;
|
|
4846
4927
|
const newValue = checked ? [...internalValue, optionValue] : internalValue.filter((v) => v !== optionValue);
|
|
@@ -4848,7 +4929,7 @@ function FilterableCheckboxGroup(props) {
|
|
|
4848
4929
|
},
|
|
4849
4930
|
[internalValue, setInternalValue]
|
|
4850
4931
|
);
|
|
4851
|
-
const handleSelectAll =
|
|
4932
|
+
const handleSelectAll = useCallback14(
|
|
4852
4933
|
(event) => {
|
|
4853
4934
|
const checked = event.target.checked;
|
|
4854
4935
|
const enabledOptions = filteredOptions.filter((option) => !option.disabled);
|
|
@@ -5005,16 +5086,16 @@ function IconMenuButton(props) {
|
|
|
5005
5086
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5006
5087
|
|
|
5007
5088
|
// src/components/Markdown/Markdown.tsx
|
|
5008
|
-
import React33, { lazy, Suspense, useEffect as
|
|
5089
|
+
import React33, { lazy, Suspense, useEffect as useEffect10, useState as useState12 } from "react";
|
|
5009
5090
|
import { Skeleton } from "@mui/joy";
|
|
5010
5091
|
import { Link as Link2 } from "@mui/joy";
|
|
5011
5092
|
import remarkGfm from "remark-gfm";
|
|
5012
5093
|
var LazyReactMarkdown = lazy(() => import("react-markdown"));
|
|
5013
5094
|
var Markdown = (props) => {
|
|
5014
|
-
const [
|
|
5015
|
-
|
|
5095
|
+
const [rehypeAccent, setRehypeAccent] = useState12(null);
|
|
5096
|
+
useEffect10(() => {
|
|
5016
5097
|
const loadRehypeAccent = async () => {
|
|
5017
|
-
const module = await
|
|
5098
|
+
const module = await import("./chunks/rehype-accent-FZRUD7VI.js");
|
|
5018
5099
|
setRehypeAccent(() => module.rehypeAccent);
|
|
5019
5100
|
};
|
|
5020
5101
|
loadRehypeAccent();
|
|
@@ -5031,7 +5112,7 @@ var Markdown = (props) => {
|
|
|
5031
5112
|
fallback,
|
|
5032
5113
|
...innerProps
|
|
5033
5114
|
} = props;
|
|
5034
|
-
if (!
|
|
5115
|
+
if (!rehypeAccent) {
|
|
5035
5116
|
return null;
|
|
5036
5117
|
}
|
|
5037
5118
|
return /* @__PURE__ */ React33.createElement(Typography, { component: "div", color, textColor, level: defaultLevel, ...innerProps }, /* @__PURE__ */ React33.createElement(
|
|
@@ -5044,7 +5125,7 @@ var Markdown = (props) => {
|
|
|
5044
5125
|
{
|
|
5045
5126
|
...markdownOptions,
|
|
5046
5127
|
children: content,
|
|
5047
|
-
rehypePlugins: [[
|
|
5128
|
+
rehypePlugins: [[rehypeAccent, { accentColor }]],
|
|
5048
5129
|
remarkPlugins: [remarkGfm],
|
|
5049
5130
|
components: {
|
|
5050
5131
|
a: ({ children, href }) => /* @__PURE__ */ React33.createElement(Link2, { href, target: defaultLinkAction }, children),
|
|
@@ -5186,7 +5267,7 @@ function MenuButton(props) {
|
|
|
5186
5267
|
MenuButton.displayName = "MenuButton";
|
|
5187
5268
|
|
|
5188
5269
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
5189
|
-
import React35, { forwardRef as forwardRef9, useCallback as
|
|
5270
|
+
import React35, { forwardRef as forwardRef9, useCallback as useCallback15, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef10, useState as useState13 } from "react";
|
|
5190
5271
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
5191
5272
|
import { styled as styled21, useThemeProps as useThemeProps6 } from "@mui/joy";
|
|
5192
5273
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -5268,14 +5349,14 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
5268
5349
|
locale,
|
|
5269
5350
|
...innerProps
|
|
5270
5351
|
} = props;
|
|
5271
|
-
const innerRef =
|
|
5272
|
-
const buttonRef =
|
|
5352
|
+
const innerRef = useRef10(null);
|
|
5353
|
+
const buttonRef = useRef10(null);
|
|
5273
5354
|
const [value, setValue, isControlled] = useControlledState(
|
|
5274
5355
|
props.value,
|
|
5275
5356
|
props.defaultValue || "",
|
|
5276
|
-
|
|
5357
|
+
useCallback15((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
5277
5358
|
);
|
|
5278
|
-
const getFormattedDisplayValue =
|
|
5359
|
+
const getFormattedDisplayValue = useCallback15(
|
|
5279
5360
|
(inputValue) => {
|
|
5280
5361
|
if (!inputValue) return "";
|
|
5281
5362
|
try {
|
|
@@ -5286,19 +5367,19 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
5286
5367
|
},
|
|
5287
5368
|
[format, displayFormat, locale]
|
|
5288
5369
|
);
|
|
5289
|
-
const [displayValue, setDisplayValue] =
|
|
5290
|
-
const [anchorEl, setAnchorEl] =
|
|
5370
|
+
const [displayValue, setDisplayValue] = useState13(() => getFormattedDisplayValue(value));
|
|
5371
|
+
const [anchorEl, setAnchorEl] = useState13(null);
|
|
5291
5372
|
const open = Boolean(anchorEl);
|
|
5292
|
-
|
|
5373
|
+
useEffect11(() => {
|
|
5293
5374
|
if (!anchorEl) {
|
|
5294
5375
|
innerRef.current?.blur();
|
|
5295
5376
|
}
|
|
5296
5377
|
}, [anchorEl, innerRef]);
|
|
5297
5378
|
useImperativeHandle4(ref, () => innerRef.current, [innerRef]);
|
|
5298
|
-
|
|
5379
|
+
useEffect11(() => {
|
|
5299
5380
|
setDisplayValue(getFormattedDisplayValue(value));
|
|
5300
5381
|
}, [value, getFormattedDisplayValue]);
|
|
5301
|
-
const handleChange =
|
|
5382
|
+
const handleChange = useCallback15(
|
|
5302
5383
|
(event) => {
|
|
5303
5384
|
const newValue = event.target.value;
|
|
5304
5385
|
setValue(newValue);
|
|
@@ -5308,14 +5389,14 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
5308
5389
|
},
|
|
5309
5390
|
[setValue, getFormattedDisplayValue, isControlled]
|
|
5310
5391
|
);
|
|
5311
|
-
const handleCalendarToggle =
|
|
5392
|
+
const handleCalendarToggle = useCallback15(
|
|
5312
5393
|
(event) => {
|
|
5313
5394
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
5314
5395
|
innerRef.current?.focus();
|
|
5315
5396
|
},
|
|
5316
5397
|
[anchorEl, setAnchorEl, innerRef]
|
|
5317
5398
|
);
|
|
5318
|
-
const handleInputMouseDown =
|
|
5399
|
+
const handleInputMouseDown = useCallback15(
|
|
5319
5400
|
(event) => {
|
|
5320
5401
|
event.preventDefault();
|
|
5321
5402
|
buttonRef.current?.focus();
|
|
@@ -5439,7 +5520,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
5439
5520
|
});
|
|
5440
5521
|
|
|
5441
5522
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
5442
|
-
import React36, { forwardRef as forwardRef10, useCallback as
|
|
5523
|
+
import React36, { forwardRef as forwardRef10, useCallback as useCallback16, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo13, useRef as useRef11, useState as useState14 } from "react";
|
|
5443
5524
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
5444
5525
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
5445
5526
|
import { styled as styled22, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5547,35 +5628,35 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
5547
5628
|
size,
|
|
5548
5629
|
...innerProps
|
|
5549
5630
|
} = props;
|
|
5550
|
-
const innerRef =
|
|
5631
|
+
const innerRef = useRef11(null);
|
|
5551
5632
|
const [value, setValue] = useControlledState(
|
|
5552
5633
|
props.value,
|
|
5553
5634
|
props.defaultValue || "",
|
|
5554
|
-
|
|
5635
|
+
useCallback16((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
5555
5636
|
);
|
|
5556
|
-
const [anchorEl, setAnchorEl] =
|
|
5637
|
+
const [anchorEl, setAnchorEl] = useState14(null);
|
|
5557
5638
|
const open = Boolean(anchorEl);
|
|
5558
5639
|
const calendarValue = useMemo13(() => value ? parseDates2(value) : void 0, [value]);
|
|
5559
|
-
|
|
5640
|
+
useEffect12(() => {
|
|
5560
5641
|
if (!anchorEl) {
|
|
5561
5642
|
innerRef.current?.blur();
|
|
5562
5643
|
}
|
|
5563
5644
|
}, [anchorEl, innerRef]);
|
|
5564
5645
|
useImperativeHandle5(ref, () => innerRef.current, [innerRef]);
|
|
5565
|
-
const handleChange =
|
|
5646
|
+
const handleChange = useCallback16(
|
|
5566
5647
|
(event) => {
|
|
5567
5648
|
setValue(event.target.value);
|
|
5568
5649
|
},
|
|
5569
5650
|
[setValue]
|
|
5570
5651
|
);
|
|
5571
|
-
const handleCalendarToggle =
|
|
5652
|
+
const handleCalendarToggle = useCallback16(
|
|
5572
5653
|
(event) => {
|
|
5573
5654
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
5574
5655
|
innerRef.current?.focus();
|
|
5575
5656
|
},
|
|
5576
5657
|
[anchorEl, setAnchorEl, innerRef]
|
|
5577
5658
|
);
|
|
5578
|
-
const handleCalendarChange =
|
|
5659
|
+
const handleCalendarChange = useCallback16(
|
|
5579
5660
|
([date1, date2]) => {
|
|
5580
5661
|
if (!date1 || !date2) return;
|
|
5581
5662
|
setValue(formatValueString4([date1, date2], format));
|
|
@@ -5802,7 +5883,7 @@ function Navigator(props) {
|
|
|
5802
5883
|
Navigator.displayName = "Navigator";
|
|
5803
5884
|
|
|
5804
5885
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
5805
|
-
import React40, { useCallback as
|
|
5886
|
+
import React40, { useCallback as useCallback17, useMemo as useMemo14, useState as useState15 } from "react";
|
|
5806
5887
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
5807
5888
|
import { styled as styled25, useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5808
5889
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -5859,9 +5940,9 @@ var PercentageInput = React40.forwardRef(
|
|
|
5859
5940
|
const [_value, setValue] = useControlledState(
|
|
5860
5941
|
props.value,
|
|
5861
5942
|
props.defaultValue,
|
|
5862
|
-
|
|
5943
|
+
useCallback17((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
5863
5944
|
);
|
|
5864
|
-
const [internalError, setInternalError] =
|
|
5945
|
+
const [internalError, setInternalError] = useState15(
|
|
5865
5946
|
max && _value && _value > max || min && _value && _value < min
|
|
5866
5947
|
);
|
|
5867
5948
|
const value = useMemo14(() => {
|
|
@@ -5870,7 +5951,7 @@ var PercentageInput = React40.forwardRef(
|
|
|
5870
5951
|
}
|
|
5871
5952
|
return _value;
|
|
5872
5953
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
5873
|
-
const handleChange =
|
|
5954
|
+
const handleChange = useCallback17(
|
|
5874
5955
|
(event) => {
|
|
5875
5956
|
if (event.target.value === "") {
|
|
5876
5957
|
setValue(void 0);
|
|
@@ -5927,31 +6008,194 @@ var MotionRadioGroup = motion26(JoyRadioGroup);
|
|
|
5927
6008
|
var RadioGroup = MotionRadioGroup;
|
|
5928
6009
|
RadioGroup.displayName = "RadioGroup";
|
|
5929
6010
|
|
|
5930
|
-
// src/components/
|
|
6011
|
+
// src/components/RadioTileGroup/RadioTileGroup.tsx
|
|
5931
6012
|
import React41 from "react";
|
|
6013
|
+
import { styled as styled26, radioClasses, sheetClasses } from "@mui/joy";
|
|
6014
|
+
var RadioTileGroupRoot = styled26(RadioGroup, {
|
|
6015
|
+
name: "RadioTileGroup",
|
|
6016
|
+
slot: "root",
|
|
6017
|
+
shouldForwardProp: (prop) => prop !== "flex" && prop !== "columns"
|
|
6018
|
+
})(({ theme, flex, columns }) => ({
|
|
6019
|
+
flexDirection: "row",
|
|
6020
|
+
gap: theme.spacing(2),
|
|
6021
|
+
...flex && { flex: 1 },
|
|
6022
|
+
...columns && {
|
|
6023
|
+
display: "grid",
|
|
6024
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`
|
|
6025
|
+
},
|
|
6026
|
+
[`& .${sheetClasses.root}.${radioClasses.disabled}`]: {
|
|
6027
|
+
borderColor: theme.palette.neutral.outlinedDisabledBorder
|
|
6028
|
+
},
|
|
6029
|
+
[`& .${radioClasses.root}`]: {
|
|
6030
|
+
[`& .${radioClasses.action}`]: {
|
|
6031
|
+
borderRadius: theme.radius.md
|
|
6032
|
+
},
|
|
6033
|
+
[`&.${radioClasses.checked}`]: {
|
|
6034
|
+
[`& .${radioClasses.action}`]: {
|
|
6035
|
+
inset: -1,
|
|
6036
|
+
border: "2px solid",
|
|
6037
|
+
borderColor: theme.palette.primary.outlinedColor
|
|
6038
|
+
},
|
|
6039
|
+
[`&.${radioClasses.disabled}`]: {
|
|
6040
|
+
[`& .${radioClasses.action}`]: {
|
|
6041
|
+
borderColor: theme.palette.neutral.outlinedBorder
|
|
6042
|
+
}
|
|
6043
|
+
}
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
}));
|
|
6047
|
+
var RadioTileSheet = styled26(Sheet, {
|
|
6048
|
+
name: "RadioTileGroup",
|
|
6049
|
+
slot: "tile",
|
|
6050
|
+
shouldForwardProp: (prop) => prop !== "disabled" && prop !== "size" && prop !== "flex" && prop !== "textAlign"
|
|
6051
|
+
})(({
|
|
6052
|
+
theme,
|
|
6053
|
+
disabled,
|
|
6054
|
+
size = "sm",
|
|
6055
|
+
flex,
|
|
6056
|
+
textAlign
|
|
6057
|
+
}) => {
|
|
6058
|
+
const px = { sm: theme.spacing(3), md: theme.spacing(3), lg: theme.spacing(4) }[size];
|
|
6059
|
+
const py = { sm: theme.spacing(3), md: theme.spacing(4), lg: theme.spacing(4) }[size];
|
|
6060
|
+
return {
|
|
6061
|
+
borderRadius: theme.radius.md,
|
|
6062
|
+
display: "flex",
|
|
6063
|
+
gap: { sm: theme.spacing(2), md: theme.spacing(3), lg: theme.spacing(4) }[size],
|
|
6064
|
+
padding: `${py} ${px}`,
|
|
6065
|
+
// NOTE: Radio에도 Label과의 정렬을 맞추기 위해 중복 코드가 있지만 Icon과 RadioButton 의 정렬도 일치시켜야 해서 코드가 중복으로 존재할수밖에 없다.
|
|
6066
|
+
flexDirection: textAlign === "start" ? "row-reverse" : "column-reverse",
|
|
6067
|
+
justifyContent: textAlign === "start" ? "space-between" : "center",
|
|
6068
|
+
alignItems: "center",
|
|
6069
|
+
...flex ? { flex: 1 } : {},
|
|
6070
|
+
...disabled ? { borderColor: theme.palette.neutral.outlinedDisabledBorder } : {
|
|
6071
|
+
":hover": {
|
|
6072
|
+
backgroundColor: theme.palette.neutral.outlinedHoverBg
|
|
6073
|
+
},
|
|
6074
|
+
":active": {
|
|
6075
|
+
backgroundColor: theme.palette.neutral.outlinedActiveBg
|
|
6076
|
+
}
|
|
6077
|
+
}
|
|
6078
|
+
};
|
|
6079
|
+
});
|
|
6080
|
+
function RadioTileGroup(props) {
|
|
6081
|
+
const {
|
|
6082
|
+
options,
|
|
6083
|
+
value,
|
|
6084
|
+
defaultValue,
|
|
6085
|
+
onChange,
|
|
6086
|
+
name,
|
|
6087
|
+
disabled: allDisabled,
|
|
6088
|
+
sx,
|
|
6089
|
+
className,
|
|
6090
|
+
useIndicator,
|
|
6091
|
+
textAlign = "center",
|
|
6092
|
+
size = "sm",
|
|
6093
|
+
flex,
|
|
6094
|
+
columns,
|
|
6095
|
+
label,
|
|
6096
|
+
helperText,
|
|
6097
|
+
error,
|
|
6098
|
+
required
|
|
6099
|
+
} = props;
|
|
6100
|
+
const radioGroup = /* @__PURE__ */ React41.createElement(
|
|
6101
|
+
RadioTileGroupRoot,
|
|
6102
|
+
{
|
|
6103
|
+
overlay: true,
|
|
6104
|
+
name,
|
|
6105
|
+
value,
|
|
6106
|
+
defaultValue,
|
|
6107
|
+
onChange,
|
|
6108
|
+
flex,
|
|
6109
|
+
columns
|
|
6110
|
+
},
|
|
6111
|
+
options.map((option) => /* @__PURE__ */ React41.createElement(
|
|
6112
|
+
RadioTileSheet,
|
|
6113
|
+
{
|
|
6114
|
+
key: option.value,
|
|
6115
|
+
variant: "outlined",
|
|
6116
|
+
disabled: allDisabled ?? option.disabled,
|
|
6117
|
+
size,
|
|
6118
|
+
flex,
|
|
6119
|
+
textAlign
|
|
6120
|
+
},
|
|
6121
|
+
/* @__PURE__ */ React41.createElement(
|
|
6122
|
+
Radio,
|
|
6123
|
+
{
|
|
6124
|
+
id: `${option.value}`,
|
|
6125
|
+
value: option.value,
|
|
6126
|
+
label: option.label,
|
|
6127
|
+
disableIcon: !useIndicator,
|
|
6128
|
+
disabled: allDisabled ?? option.disabled,
|
|
6129
|
+
size,
|
|
6130
|
+
slotProps: {
|
|
6131
|
+
root: {
|
|
6132
|
+
sx: {
|
|
6133
|
+
width: "100%",
|
|
6134
|
+
flexDirection: textAlign === "start" ? "row-reverse" : "column-reverse",
|
|
6135
|
+
justifyContent: textAlign === "start" ? "space-between" : "center",
|
|
6136
|
+
alignItems: "center",
|
|
6137
|
+
gap: { sm: 2, md: 3, lg: 4 }[size]
|
|
6138
|
+
}
|
|
6139
|
+
},
|
|
6140
|
+
label: ({ disabled }) => ({
|
|
6141
|
+
sx: (theme) => ({
|
|
6142
|
+
...theme.typography[{ sm: "body-sm", md: "body-md", lg: "body-lg" }[size]],
|
|
6143
|
+
color: disabled ? theme.palette.neutral.outlinedDisabledColor : theme.palette.neutral.outlinedColor
|
|
6144
|
+
})
|
|
6145
|
+
})
|
|
6146
|
+
}
|
|
6147
|
+
}
|
|
6148
|
+
),
|
|
6149
|
+
option.startDecorator && /* @__PURE__ */ React41.createElement(
|
|
6150
|
+
Box_default,
|
|
6151
|
+
{
|
|
6152
|
+
sx: {
|
|
6153
|
+
zIndex: 2,
|
|
6154
|
+
// HACK: Radio의 overlay가 decorator를 덮어버리기 때문에 문제 예방을 위해 적용해야 한다.
|
|
6155
|
+
width: { sm: "20px", md: "24px", lg: "24px" }[size],
|
|
6156
|
+
height: { sm: "20px", md: "24px", lg: "24px" }[size],
|
|
6157
|
+
color: "inherit",
|
|
6158
|
+
"& > .MuiSvgIcon-root": {
|
|
6159
|
+
width: "inherit",
|
|
6160
|
+
height: "inherit",
|
|
6161
|
+
fill: "currentColor",
|
|
6162
|
+
color: "inherit"
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
},
|
|
6166
|
+
option.startDecorator
|
|
6167
|
+
)
|
|
6168
|
+
))
|
|
6169
|
+
);
|
|
6170
|
+
return /* @__PURE__ */ React41.createElement(FormControl_default, { required, disabled: allDisabled, error, size, sx, className }, label && /* @__PURE__ */ React41.createElement(FormLabel_default, null, label), radioGroup, helperText && /* @__PURE__ */ React41.createElement(FormHelperText_default, null, helperText));
|
|
6171
|
+
}
|
|
6172
|
+
RadioTileGroup.displayName = "RadioTileGroup";
|
|
6173
|
+
|
|
6174
|
+
// src/components/RadioList/RadioList.tsx
|
|
6175
|
+
import React42 from "react";
|
|
5932
6176
|
function RadioList(props) {
|
|
5933
6177
|
const { items, ...innerProps } = props;
|
|
5934
|
-
return /* @__PURE__ */
|
|
6178
|
+
return /* @__PURE__ */ React42.createElement(RadioGroup, { ...innerProps }, items.map((item) => /* @__PURE__ */ React42.createElement(Radio, { key: `${item.value}`, value: item.value, label: item.label })));
|
|
5935
6179
|
}
|
|
5936
6180
|
RadioList.displayName = "RadioList";
|
|
5937
6181
|
|
|
5938
6182
|
// src/components/Stepper/Stepper.tsx
|
|
5939
|
-
import
|
|
6183
|
+
import React43 from "react";
|
|
5940
6184
|
import {
|
|
5941
6185
|
Stepper as JoyStepper,
|
|
5942
6186
|
Step as JoyStep,
|
|
5943
6187
|
StepIndicator as JoyStepIndicator,
|
|
5944
6188
|
stepClasses,
|
|
5945
6189
|
stepIndicatorClasses,
|
|
5946
|
-
styled as
|
|
6190
|
+
styled as styled27
|
|
5947
6191
|
} from "@mui/joy";
|
|
5948
6192
|
import CheckIcon from "@mui/icons-material/Check";
|
|
5949
6193
|
import { motion as motion27 } from "framer-motion";
|
|
5950
|
-
var Step =
|
|
6194
|
+
var Step = styled27(JoyStep)({});
|
|
5951
6195
|
Step.displayName = "Step";
|
|
5952
|
-
var StepIndicator =
|
|
6196
|
+
var StepIndicator = styled27(JoyStepIndicator)({});
|
|
5953
6197
|
StepIndicator.displayName = "StepIndicator";
|
|
5954
|
-
var StyledStepper =
|
|
6198
|
+
var StyledStepper = styled27(JoyStepper)(({ theme }) => ({
|
|
5955
6199
|
"--StepIndicator-size": "24px",
|
|
5956
6200
|
"--Step-gap": theme.spacing(2),
|
|
5957
6201
|
"--joy-palette-success-solidBg": "var(--joy-palette-success-400)",
|
|
@@ -5972,7 +6216,7 @@ function Stepper(props) {
|
|
|
5972
6216
|
stepOrientation = "horizontal"
|
|
5973
6217
|
} = props;
|
|
5974
6218
|
const effectiveStepOrientation = orientation === "vertical" ? "horizontal" : stepOrientation;
|
|
5975
|
-
return /* @__PURE__ */
|
|
6219
|
+
return /* @__PURE__ */ React43.createElement(
|
|
5976
6220
|
MotionStepper,
|
|
5977
6221
|
{
|
|
5978
6222
|
orientation,
|
|
@@ -6011,23 +6255,23 @@ function Stepper(props) {
|
|
|
6011
6255
|
const completed = activeStep > i + 1;
|
|
6012
6256
|
const disabled = activeStep < i + 1;
|
|
6013
6257
|
const hasContent = step.label || step.extraContent;
|
|
6014
|
-
return /* @__PURE__ */
|
|
6258
|
+
return /* @__PURE__ */ React43.createElement(
|
|
6015
6259
|
Step,
|
|
6016
6260
|
{
|
|
6017
6261
|
key: `step-${i}`,
|
|
6018
|
-
indicator: /* @__PURE__ */
|
|
6262
|
+
indicator: /* @__PURE__ */ React43.createElement(StepIndicator, { variant: disabled ? "outlined" : "solid", color: disabled ? "neutral" : "primary" }, completed ? /* @__PURE__ */ React43.createElement(CheckIcon, null) : step.indicatorContent),
|
|
6019
6263
|
active,
|
|
6020
6264
|
completed,
|
|
6021
6265
|
disabled,
|
|
6022
6266
|
orientation: effectiveStepOrientation
|
|
6023
6267
|
},
|
|
6024
|
-
hasContent && /* @__PURE__ */
|
|
6268
|
+
hasContent && /* @__PURE__ */ React43.createElement(
|
|
6025
6269
|
Stack_default,
|
|
6026
6270
|
{
|
|
6027
6271
|
sx: orientation === "horizontal" && effectiveStepOrientation === "vertical" ? { alignItems: "center" } : {}
|
|
6028
6272
|
},
|
|
6029
|
-
step.label && /* @__PURE__ */
|
|
6030
|
-
step.extraContent && /* @__PURE__ */
|
|
6273
|
+
step.label && /* @__PURE__ */ React43.createElement(Typography_default, { level: "title-sm" }, step.label),
|
|
6274
|
+
step.extraContent && /* @__PURE__ */ React43.createElement(Typography_default, { level: "body-xs" }, step.extraContent)
|
|
6031
6275
|
)
|
|
6032
6276
|
);
|
|
6033
6277
|
})
|
|
@@ -6036,11 +6280,11 @@ function Stepper(props) {
|
|
|
6036
6280
|
Stepper.displayName = "Stepper";
|
|
6037
6281
|
|
|
6038
6282
|
// src/components/Switch/Switch.tsx
|
|
6039
|
-
import
|
|
6040
|
-
import { Switch as JoySwitch, styled as
|
|
6283
|
+
import React44 from "react";
|
|
6284
|
+
import { Switch as JoySwitch, styled as styled28, switchClasses } from "@mui/joy";
|
|
6041
6285
|
import { motion as motion28 } from "framer-motion";
|
|
6042
6286
|
var MotionSwitch = motion28(JoySwitch);
|
|
6043
|
-
var StyledThumb =
|
|
6287
|
+
var StyledThumb = styled28(motion28.div)({
|
|
6044
6288
|
"--Icon-fontSize": "calc(var(--Switch-thumbSize) * 0.75)",
|
|
6045
6289
|
display: "inline-flex",
|
|
6046
6290
|
justifyContent: "center",
|
|
@@ -6058,14 +6302,14 @@ var StyledThumb = styled27(motion28.div)({
|
|
|
6058
6302
|
right: "var(--Switch-thumbOffset)"
|
|
6059
6303
|
}
|
|
6060
6304
|
});
|
|
6061
|
-
var Thumb = (props) => /* @__PURE__ */
|
|
6305
|
+
var Thumb = (props) => /* @__PURE__ */ React44.createElement(StyledThumb, { ...props, layout: true, transition: spring });
|
|
6062
6306
|
var spring = {
|
|
6063
6307
|
type: "spring",
|
|
6064
6308
|
stiffness: 700,
|
|
6065
6309
|
damping: 30
|
|
6066
6310
|
};
|
|
6067
6311
|
var Switch = (props) => {
|
|
6068
|
-
return /* @__PURE__ */
|
|
6312
|
+
return /* @__PURE__ */ React44.createElement(
|
|
6069
6313
|
MotionSwitch,
|
|
6070
6314
|
{
|
|
6071
6315
|
...props,
|
|
@@ -6079,21 +6323,21 @@ var Switch = (props) => {
|
|
|
6079
6323
|
Switch.displayName = "Switch";
|
|
6080
6324
|
|
|
6081
6325
|
// src/components/Tabs/Tabs.tsx
|
|
6082
|
-
import
|
|
6326
|
+
import React45, { forwardRef as forwardRef11 } from "react";
|
|
6083
6327
|
import {
|
|
6084
6328
|
Tabs as JoyTabs,
|
|
6085
6329
|
Tab as JoyTab,
|
|
6086
6330
|
TabList as JoyTabList,
|
|
6087
6331
|
TabPanel as JoyTabPanel,
|
|
6088
|
-
styled as
|
|
6332
|
+
styled as styled29,
|
|
6089
6333
|
tabClasses
|
|
6090
6334
|
} from "@mui/joy";
|
|
6091
|
-
var StyledTabs =
|
|
6335
|
+
var StyledTabs = styled29(JoyTabs)(({ theme }) => ({
|
|
6092
6336
|
backgroundColor: theme.palette.background.body
|
|
6093
6337
|
}));
|
|
6094
6338
|
var Tabs = StyledTabs;
|
|
6095
6339
|
Tabs.displayName = "Tabs";
|
|
6096
|
-
var StyledTab =
|
|
6340
|
+
var StyledTab = styled29(JoyTab)(({ theme }) => ({
|
|
6097
6341
|
gap: theme.spacing(2),
|
|
6098
6342
|
[`&:not(.${tabClasses.selected})`]: {
|
|
6099
6343
|
color: theme.palette.neutral[700]
|
|
@@ -6103,14 +6347,14 @@ var StyledTab = styled28(JoyTab)(({ theme }) => ({
|
|
|
6103
6347
|
}
|
|
6104
6348
|
}));
|
|
6105
6349
|
var Tab = forwardRef11(function Tab2({ startDecorator, endDecorator, children, ...props }, ref) {
|
|
6106
|
-
return /* @__PURE__ */
|
|
6350
|
+
return /* @__PURE__ */ React45.createElement(StyledTab, { ...props, ref }, startDecorator, children, endDecorator);
|
|
6107
6351
|
});
|
|
6108
6352
|
Tab.displayName = "Tab";
|
|
6109
6353
|
var TabList = JoyTabList;
|
|
6110
6354
|
var TabPanel = JoyTabPanel;
|
|
6111
6355
|
|
|
6112
6356
|
// src/components/ThemeProvider/ThemeProvider.tsx
|
|
6113
|
-
import
|
|
6357
|
+
import React46 from "react";
|
|
6114
6358
|
import {
|
|
6115
6359
|
CssBaseline,
|
|
6116
6360
|
CssVarsProvider,
|
|
@@ -6366,13 +6610,13 @@ var defaultTheme = extendTheme({
|
|
|
6366
6610
|
});
|
|
6367
6611
|
function ThemeProvider(props) {
|
|
6368
6612
|
const theme = props.theme || defaultTheme;
|
|
6369
|
-
return /* @__PURE__ */
|
|
6613
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(CssVarsProvider, { theme }, /* @__PURE__ */ React46.createElement(CssBaseline, null), props.children));
|
|
6370
6614
|
}
|
|
6371
6615
|
ThemeProvider.displayName = "ThemeProvider";
|
|
6372
6616
|
|
|
6373
6617
|
// src/components/Uploader/Uploader.tsx
|
|
6374
|
-
import
|
|
6375
|
-
import { styled as
|
|
6618
|
+
import React47, { useCallback as useCallback18, useEffect as useEffect13, useMemo as useMemo15, useRef as useRef12, useState as useState16 } from "react";
|
|
6619
|
+
import { styled as styled30, Input as Input2 } from "@mui/joy";
|
|
6376
6620
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
6377
6621
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
6378
6622
|
import MuiClearIcon from "@mui/icons-material/ClearRounded";
|
|
@@ -6394,7 +6638,7 @@ var esmFiles = {
|
|
|
6394
6638
|
"@atlaskit/pragmatic-drag-and-drop/dist/esm/entry-point/prevent-unhandled.js"
|
|
6395
6639
|
)
|
|
6396
6640
|
};
|
|
6397
|
-
var VisuallyHiddenInput =
|
|
6641
|
+
var VisuallyHiddenInput = styled30(Input2)({
|
|
6398
6642
|
width: "1px",
|
|
6399
6643
|
height: "1px",
|
|
6400
6644
|
overflow: "hidden",
|
|
@@ -6403,18 +6647,18 @@ var VisuallyHiddenInput = styled29(Input2)({
|
|
|
6403
6647
|
clipPath: "inset(50%)",
|
|
6404
6648
|
position: "absolute"
|
|
6405
6649
|
});
|
|
6406
|
-
var PreviewRoot =
|
|
6650
|
+
var PreviewRoot = styled30(Stack_default, {
|
|
6407
6651
|
name: "Uploader",
|
|
6408
6652
|
slot: "PreviewRoot"
|
|
6409
6653
|
})({});
|
|
6410
|
-
var UploadCard =
|
|
6654
|
+
var UploadCard = styled30(Card, {
|
|
6411
6655
|
name: "Uploader",
|
|
6412
6656
|
slot: "UploadCard"
|
|
6413
6657
|
})(({ theme }) => ({
|
|
6414
6658
|
padding: theme.spacing(2.5),
|
|
6415
6659
|
border: `1px solid ${theme.palette.neutral.outlinedBorder}`
|
|
6416
6660
|
}));
|
|
6417
|
-
var UploadFileIcon =
|
|
6661
|
+
var UploadFileIcon = styled30(MuiUploadFileIcon, {
|
|
6418
6662
|
name: "Uploader",
|
|
6419
6663
|
slot: "UploadFileIcon"
|
|
6420
6664
|
})(({ theme }) => ({
|
|
@@ -6422,7 +6666,7 @@ var UploadFileIcon = styled29(MuiUploadFileIcon, {
|
|
|
6422
6666
|
width: "32px",
|
|
6423
6667
|
height: "32px"
|
|
6424
6668
|
}));
|
|
6425
|
-
var ClearIcon2 =
|
|
6669
|
+
var ClearIcon2 = styled30(MuiClearIcon, {
|
|
6426
6670
|
name: "Uploader",
|
|
6427
6671
|
slot: "ClearIcon"
|
|
6428
6672
|
})(({ theme }) => ({
|
|
@@ -6448,7 +6692,7 @@ var getFileSize = (n) => {
|
|
|
6448
6692
|
};
|
|
6449
6693
|
var Preview = (props) => {
|
|
6450
6694
|
const { files, uploaded, onDelete } = props;
|
|
6451
|
-
return /* @__PURE__ */
|
|
6695
|
+
return /* @__PURE__ */ React47.createElement(PreviewRoot, { gap: 1 }, [...uploaded, ...files].map((file) => /* @__PURE__ */ React47.createElement(UploadCard, { key: file.name, size: "sm", color: "neutral" }, /* @__PURE__ */ React47.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2 }, /* @__PURE__ */ React47.createElement(UploadFileIcon, null), /* @__PURE__ */ React47.createElement(Stack_default, { flex: "1", sx: { overflow: "hidden" } }, /* @__PURE__ */ React47.createElement(
|
|
6452
6696
|
Typography_default,
|
|
6453
6697
|
{
|
|
6454
6698
|
level: "body-sm",
|
|
@@ -6460,15 +6704,15 @@ var Preview = (props) => {
|
|
|
6460
6704
|
}
|
|
6461
6705
|
},
|
|
6462
6706
|
file.name
|
|
6463
|
-
), !!file.size && /* @__PURE__ */
|
|
6707
|
+
), !!file.size && /* @__PURE__ */ React47.createElement(Typography_default, { level: "body-xs", fontWeight: "300", lineHeight: "1.33", textColor: "text.tertiary" }, getFileSize(file.size))), /* @__PURE__ */ React47.createElement(IconButton_default, { onClick: () => onDelete?.(file) }, /* @__PURE__ */ React47.createElement(ClearIcon2, null))))));
|
|
6464
6708
|
};
|
|
6465
|
-
var UploaderRoot =
|
|
6709
|
+
var UploaderRoot = styled30(Stack_default, {
|
|
6466
6710
|
name: "Uploader",
|
|
6467
6711
|
slot: "root"
|
|
6468
6712
|
})(({ theme }) => ({
|
|
6469
6713
|
gap: theme.spacing(2)
|
|
6470
6714
|
}));
|
|
6471
|
-
var FileDropZone =
|
|
6715
|
+
var FileDropZone = styled30(Sheet_default, {
|
|
6472
6716
|
name: "Uploader",
|
|
6473
6717
|
slot: "dropZone",
|
|
6474
6718
|
shouldForwardProp: (prop) => prop !== "error" && prop !== "disabled"
|
|
@@ -6489,7 +6733,7 @@ var FileDropZone = styled29(Sheet_default, {
|
|
|
6489
6733
|
}
|
|
6490
6734
|
})
|
|
6491
6735
|
);
|
|
6492
|
-
var UploaderIcon =
|
|
6736
|
+
var UploaderIcon = styled30(MuiFileUploadIcon, {
|
|
6493
6737
|
name: "Uploader",
|
|
6494
6738
|
slot: "iconContainer",
|
|
6495
6739
|
shouldForwardProp: (prop) => prop !== "error" && prop !== "disabled"
|
|
@@ -6503,7 +6747,7 @@ var UploaderIcon = styled29(MuiFileUploadIcon, {
|
|
|
6503
6747
|
}
|
|
6504
6748
|
})
|
|
6505
6749
|
);
|
|
6506
|
-
var Uploader =
|
|
6750
|
+
var Uploader = React47.memo(
|
|
6507
6751
|
(props) => {
|
|
6508
6752
|
const {
|
|
6509
6753
|
accept,
|
|
@@ -6520,12 +6764,12 @@ var Uploader = React46.memo(
|
|
|
6520
6764
|
error: errorProp,
|
|
6521
6765
|
helperText: helperTextProp
|
|
6522
6766
|
} = props;
|
|
6523
|
-
const dropZoneRef =
|
|
6524
|
-
const inputRef =
|
|
6525
|
-
const [errorText, setErrorText] =
|
|
6526
|
-
const [files, setFiles] =
|
|
6527
|
-
const [uploaded, setUploaded] =
|
|
6528
|
-
const [previewState, setPreviewState] =
|
|
6767
|
+
const dropZoneRef = useRef12(null);
|
|
6768
|
+
const inputRef = useRef12(null);
|
|
6769
|
+
const [errorText, setErrorText] = useState16();
|
|
6770
|
+
const [files, setFiles] = useState16([]);
|
|
6771
|
+
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
6772
|
+
const [previewState, setPreviewState] = useState16("idle");
|
|
6529
6773
|
const accepts = useMemo15(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6530
6774
|
const parsedAccepts = useMemo15(
|
|
6531
6775
|
() => accepts.flatMap((type) => {
|
|
@@ -6571,7 +6815,7 @@ var Uploader = React46.memo(
|
|
|
6571
6815
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
6572
6816
|
[files, maxCount, uploaded]
|
|
6573
6817
|
);
|
|
6574
|
-
const addFiles =
|
|
6818
|
+
const addFiles = useCallback18(
|
|
6575
6819
|
(uploads) => {
|
|
6576
6820
|
try {
|
|
6577
6821
|
const types = parsedAccepts.map((type) => type.replace(".", "")) || [];
|
|
@@ -6616,7 +6860,7 @@ var Uploader = React46.memo(
|
|
|
6616
6860
|
},
|
|
6617
6861
|
[files, uploaded, maxCount, parsedAccepts, maxFileSize, maxFileTotalSize, name, onChange]
|
|
6618
6862
|
);
|
|
6619
|
-
|
|
6863
|
+
useEffect13(() => {
|
|
6620
6864
|
if (!dropZoneRef.current || disabled) {
|
|
6621
6865
|
return;
|
|
6622
6866
|
}
|
|
@@ -6654,7 +6898,7 @@ var Uploader = React46.memo(
|
|
|
6654
6898
|
);
|
|
6655
6899
|
return () => cleanup?.();
|
|
6656
6900
|
}, [disabled, addFiles]);
|
|
6657
|
-
|
|
6901
|
+
useEffect13(() => {
|
|
6658
6902
|
if (inputRef.current && minCount) {
|
|
6659
6903
|
if (files.length < minCount) {
|
|
6660
6904
|
inputRef.current.setCustomValidity(`At least ${minCount} files are required.`);
|
|
@@ -6663,14 +6907,14 @@ var Uploader = React46.memo(
|
|
|
6663
6907
|
}
|
|
6664
6908
|
}
|
|
6665
6909
|
}, [inputRef, files, minCount]);
|
|
6666
|
-
const handleFileChanged =
|
|
6910
|
+
const handleFileChanged = useCallback18(
|
|
6667
6911
|
(event) => {
|
|
6668
6912
|
const files2 = Array.from(event.target.files || []);
|
|
6669
6913
|
addFiles(files2);
|
|
6670
6914
|
},
|
|
6671
6915
|
[addFiles]
|
|
6672
6916
|
);
|
|
6673
|
-
const handleDeleteFile =
|
|
6917
|
+
const handleDeleteFile = useCallback18(
|
|
6674
6918
|
(deletedFile) => {
|
|
6675
6919
|
if (deletedFile instanceof File) {
|
|
6676
6920
|
setFiles((current) => {
|
|
@@ -6690,10 +6934,10 @@ var Uploader = React46.memo(
|
|
|
6690
6934
|
},
|
|
6691
6935
|
[name, onChange, onDelete]
|
|
6692
6936
|
);
|
|
6693
|
-
const handleUploaderButtonClick =
|
|
6937
|
+
const handleUploaderButtonClick = useCallback18(() => {
|
|
6694
6938
|
inputRef.current?.click();
|
|
6695
6939
|
}, []);
|
|
6696
|
-
const uploader = /* @__PURE__ */
|
|
6940
|
+
const uploader = /* @__PURE__ */ React47.createElement(
|
|
6697
6941
|
FileDropZone,
|
|
6698
6942
|
{
|
|
6699
6943
|
state: previewState,
|
|
@@ -6702,8 +6946,8 @@ var Uploader = React46.memo(
|
|
|
6702
6946
|
ref: dropZoneRef,
|
|
6703
6947
|
onClick: handleUploaderButtonClick
|
|
6704
6948
|
},
|
|
6705
|
-
/* @__PURE__ */
|
|
6706
|
-
/* @__PURE__ */
|
|
6949
|
+
/* @__PURE__ */ React47.createElement(Stack_default, { alignItems: "center", gap: 1 }, /* @__PURE__ */ React47.createElement(UploaderIcon, { state: previewState, error: !!(error || errorText), disabled })),
|
|
6950
|
+
/* @__PURE__ */ React47.createElement(
|
|
6707
6951
|
VisuallyHiddenInput,
|
|
6708
6952
|
{
|
|
6709
6953
|
disabled,
|
|
@@ -6726,7 +6970,7 @@ var Uploader = React46.memo(
|
|
|
6726
6970
|
}
|
|
6727
6971
|
)
|
|
6728
6972
|
);
|
|
6729
|
-
return /* @__PURE__ */
|
|
6973
|
+
return /* @__PURE__ */ React47.createElement(UploaderRoot, null, showDropZone && /* @__PURE__ */ React47.createElement(FormControl_default, { size, error: !!(error || errorText), disabled, required: !!minCount }, label && /* @__PURE__ */ React47.createElement(FormLabel_default, null, label), uploader, /* @__PURE__ */ React47.createElement(FormHelperText_default, null, /* @__PURE__ */ React47.createElement(Stack_default, null, errorText && /* @__PURE__ */ React47.createElement("div", null, errorText), /* @__PURE__ */ React47.createElement("div", null, helperText)))), [...uploaded, ...files].length > 0 && /* @__PURE__ */ React47.createElement(Preview, { files, uploaded, onDelete: handleDeleteFile }));
|
|
6730
6974
|
}
|
|
6731
6975
|
);
|
|
6732
6976
|
Uploader.displayName = "Uploader";
|
|
@@ -6807,6 +7051,7 @@ export {
|
|
|
6807
7051
|
Radio,
|
|
6808
7052
|
RadioGroup,
|
|
6809
7053
|
RadioList,
|
|
7054
|
+
RadioTileGroup,
|
|
6810
7055
|
Select,
|
|
6811
7056
|
Sheet,
|
|
6812
7057
|
Skeleton2 as Skeleton,
|
|
@@ -6881,17 +7126,17 @@ export {
|
|
|
6881
7126
|
modalDialogClasses,
|
|
6882
7127
|
modalOverflowClasses,
|
|
6883
7128
|
optionClasses,
|
|
6884
|
-
radioClasses,
|
|
7129
|
+
radioClasses2 as radioClasses,
|
|
6885
7130
|
radioGroupClasses,
|
|
6886
7131
|
selectClasses,
|
|
6887
|
-
sheetClasses,
|
|
7132
|
+
sheetClasses2 as sheetClasses,
|
|
6888
7133
|
skeletonClasses,
|
|
6889
7134
|
sliderClasses,
|
|
6890
7135
|
stackClasses,
|
|
6891
7136
|
stepButtonClasses,
|
|
6892
7137
|
stepClasses2 as stepClasses,
|
|
6893
7138
|
stepperClasses,
|
|
6894
|
-
|
|
7139
|
+
styled31 as styled,
|
|
6895
7140
|
switchClasses2 as switchClasses,
|
|
6896
7141
|
tabListClasses,
|
|
6897
7142
|
tabPanelClasses,
|