@itilite/lumina-ui 1.1.14 → 1.2.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/AdvancedDateRangePicker-D7xn4So6.d.mts +59 -0
- package/dist/AdvancedDateRangePicker-D7xn4So6.d.ts +59 -0
- package/dist/AdvancedDateRangePicker-D9Sdk4rK.d.mts +64 -0
- package/dist/AdvancedDateRangePicker-D9Sdk4rK.d.ts +64 -0
- package/dist/AdvancedDateRangePicker-DGg-rucL.d.mts +62 -0
- package/dist/AdvancedDateRangePicker-DGg-rucL.d.ts +62 -0
- package/dist/AdvancedDateRangePicker-DOSprRQR.d.mts +52 -0
- package/dist/AdvancedDateRangePicker-DOSprRQR.d.ts +52 -0
- package/dist/AdvancedDateRangePicker-Di3rHxqf.d.mts +64 -0
- package/dist/AdvancedDateRangePicker-Di3rHxqf.d.ts +64 -0
- package/dist/AdvancedDateRangePicker-Dxug2Mcf.d.mts +60 -0
- package/dist/AdvancedDateRangePicker-Dxug2Mcf.d.ts +60 -0
- package/dist/AdvancedDateRangePicker-ozItnkhp.d.mts +57 -0
- package/dist/AdvancedDateRangePicker-ozItnkhp.d.ts +57 -0
- package/dist/Table-BOq-_9Nr.d.mts +121 -0
- package/dist/Table-BOq-_9Nr.d.ts +121 -0
- package/dist/Table-BxaCiQmh.d.mts +82 -0
- package/dist/Table-BxaCiQmh.d.ts +82 -0
- package/dist/Table-DNvoh2P8.d.mts +127 -0
- package/dist/Table-DNvoh2P8.d.ts +127 -0
- package/dist/Table-DSFYzrpU.d.mts +129 -0
- package/dist/Table-DSFYzrpU.d.ts +129 -0
- package/dist/Table-DoCPt3ri.d.mts +129 -0
- package/dist/Table-DoCPt3ri.d.ts +129 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.mts +2 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.ts +2 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.js +1648 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.mjs +15 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.d.mts +17 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.d.ts +17 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.js +370 -0
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.mjs +8 -0
- package/dist/atom/Button/Button.js +1 -1
- package/dist/atom/Button/Button.mjs +1 -1
- package/dist/atom/LoadingSpinner/LoadingSpinner.d.mts +2 -2
- package/dist/atom/LoadingSpinner/LoadingSpinner.d.ts +2 -2
- package/dist/atom/Modal/Modal.js +1 -1
- package/dist/atom/Modal/Modal.mjs +2 -2
- package/dist/atom/RangePicker/RangePicker.mjs +1 -1
- package/dist/atom/Table/Table.d.mts +3 -0
- package/dist/atom/Table/Table.d.ts +3 -0
- package/dist/atom/Table/Table.js +340 -0
- package/dist/atom/Table/Table.mjs +9 -0
- package/dist/chunk-27LRL4RO.mjs +428 -0
- package/dist/chunk-2IT3XM7C.mjs +473 -0
- package/dist/chunk-3HXZIFV6.mjs +438 -0
- package/dist/{chunk-35KDS27M.mjs → chunk-4JX54OKI.mjs} +27 -18
- package/dist/chunk-53O7JM5I.mjs +424 -0
- package/dist/chunk-5JXIJTAS.mjs +448 -0
- package/dist/chunk-5PQ43JFX.mjs +440 -0
- package/dist/chunk-62VAYFZA.mjs +437 -0
- package/dist/chunk-6ON32H2N.mjs +431 -0
- package/dist/chunk-6RIZXTFP.mjs +290 -0
- package/dist/chunk-6XIT27XY.mjs +269 -0
- package/dist/chunk-772C454L.mjs +438 -0
- package/dist/chunk-7L267Y4P.mjs +429 -0
- package/dist/chunk-7WSVCE2C.mjs +269 -0
- package/dist/chunk-ANJI6SPV.mjs +283 -0
- package/dist/chunk-BFFLWW7N.mjs +250 -0
- package/dist/chunk-C5VYFNVC.mjs +441 -0
- package/dist/chunk-DL7BZMGE.mjs +295 -0
- package/dist/chunk-DXPVJNGY.mjs +284 -0
- package/dist/chunk-FPH63V2R.mjs +269 -0
- package/dist/chunk-FTL3PFC2.mjs +438 -0
- package/dist/chunk-G4P6XGQX.mjs +278 -0
- package/dist/chunk-GGWY2SYX.mjs +452 -0
- package/dist/chunk-GZ4P7OL3.mjs +429 -0
- package/dist/chunk-I6GLPWHS.mjs +278 -0
- package/dist/chunk-IPVJEGDI.mjs +476 -0
- package/dist/chunk-J4YYP4IZ.mjs +0 -0
- package/dist/chunk-J5JDQ4R6.mjs +278 -0
- package/dist/chunk-K2A4TWA3.mjs +430 -0
- package/dist/chunk-L3L42SIL.mjs +429 -0
- package/dist/chunk-LRNKIRH3.mjs +289 -0
- package/dist/chunk-MA23J4WQ.mjs +430 -0
- package/dist/chunk-N4DPPZVJ.mjs +269 -0
- package/dist/chunk-PQ3B2FEB.mjs +249 -0
- package/dist/chunk-QRGHJP7U.mjs +437 -0
- package/dist/chunk-QU73KNTT.mjs +452 -0
- package/dist/chunk-RC6IGURJ.mjs +428 -0
- package/dist/chunk-SKPCOHON.mjs +473 -0
- package/dist/chunk-SRKN7WS7.mjs +448 -0
- package/dist/chunk-TQDZWJZP.mjs +269 -0
- package/dist/chunk-UAGSPM3T.mjs +288 -0
- package/dist/chunk-UC4NTBDH.mjs +439 -0
- package/dist/chunk-UPSQTJJ4.mjs +294 -0
- package/dist/chunk-V3CHJHUX.mjs +424 -0
- package/dist/chunk-X3NDICAU.mjs +284 -0
- package/dist/chunk-XECXKSTC.mjs +453 -0
- package/dist/chunk-XIVTXS3Y.mjs +439 -0
- package/dist/chunk-ZGV6QMVM.mjs +437 -0
- package/dist/index.d.mts +16 -14
- package/dist/index.d.ts +16 -14
- package/dist/index.js +1017 -16
- package/dist/index.mjs +23 -14
- package/dist/styles.css +1277 -178
- package/package.json +1 -1
- package/dist/Avatar-DX2JwvAs.d.mts +0 -17
- package/dist/Avatar-DX2JwvAs.d.ts +0 -17
- package/dist/Tag-l7I5oeyk.d.mts +0 -13
- package/dist/Tag-l7I5oeyk.d.ts +0 -13
- package/dist/chunk-3S4X3YO2.mjs +0 -64
- package/dist/chunk-3XUHGVYA.mjs +0 -77
- package/dist/chunk-DLLT6V65.mjs +0 -141
- package/dist/chunk-E4FCLHYA.mjs +0 -678
- package/dist/chunk-HISCHZ5H.mjs +0 -77
- package/dist/chunk-I5VHKSQR.mjs +0 -64
- package/dist/chunk-N355RJGH.mjs +0 -141
- package/dist/chunk-N3YFQDW7.mjs +0 -77
- package/dist/chunk-QWK3MYDM.mjs +0 -64
- package/dist/chunk-SWRFCTJW.mjs +0 -77
- package/dist/chunk-UTMZY37A.mjs +0 -141
- package/dist/chunk-UUEPD2FH.mjs +0 -141
- package/dist/chunk-X76GNSBB.mjs +0 -87
- package/dist/chunk-Y3BIY4DW.mjs +0 -618
- package/dist/chunk-ZGFE3OPJ.mjs +0 -678
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
59
59
|
// src/index.ts
|
|
60
60
|
var index_exports = {};
|
|
61
61
|
__export(index_exports, {
|
|
62
|
+
AdvancedDateRangePicker: () => AdvancedDateRangePicker_default,
|
|
62
63
|
Avatar: () => Avatar_default,
|
|
63
64
|
Button: () => Button_default,
|
|
64
65
|
Checkbox: () => Checkbox_default,
|
|
@@ -69,6 +70,7 @@ __export(index_exports, {
|
|
|
69
70
|
Select: () => Select_default,
|
|
70
71
|
Slider: () => Slider_default,
|
|
71
72
|
Switch: () => Switch_default,
|
|
73
|
+
Table: () => Table_default,
|
|
72
74
|
Tag: () => Tag_default,
|
|
73
75
|
Tooltip: () => Tooltip_default,
|
|
74
76
|
UserProfile: () => UserProfile_default
|
|
@@ -89,7 +91,7 @@ function Button(props) {
|
|
|
89
91
|
type = "primary",
|
|
90
92
|
variant = "default",
|
|
91
93
|
size = "normal",
|
|
92
|
-
shape = "
|
|
94
|
+
shape = "default",
|
|
93
95
|
className = "",
|
|
94
96
|
icon = null,
|
|
95
97
|
children,
|
|
@@ -1938,15 +1940,739 @@ function CustomRangePicker(props) {
|
|
|
1938
1940
|
CustomRangePicker.displayName = "RangePicker";
|
|
1939
1941
|
var RangePicker_default = CustomRangePicker;
|
|
1940
1942
|
|
|
1943
|
+
// src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.tsx
|
|
1944
|
+
var import_react5 = require("react");
|
|
1945
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
1946
|
+
var import_dayjs3 = __toESM(require("dayjs"));
|
|
1947
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
1948
|
+
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore.js"));
|
|
1949
|
+
|
|
1950
|
+
// src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.module.scss
|
|
1951
|
+
var AdvancedDateRangePicker_module_default = { "root": "AdvancedDateRangePicker-module__root___udir8", "singleCalendar": "AdvancedDateRangePicker-module__singleCalendar___qy2-H", "hidePresets": "AdvancedDateRangePicker-module__hidePresets___-m2-P", "inner": "AdvancedDateRangePicker-module__inner___P4OHa", "left": "AdvancedDateRangePicker-module__left___T6E84", "sidebarItem": "AdvancedDateRangePicker-module__sidebarItem___-NXPm", "sidebarItemActive": "AdvancedDateRangePicker-module__sidebarItemActive___5GmBY", "main": "AdvancedDateRangePicker-module__main___G4MU9", "header": "AdvancedDateRangePicker-module__header___mxXEE", "timezoneWrapper": "AdvancedDateRangePicker-module__timezoneWrapper___886Qm", "dateTimeWrapper": "AdvancedDateRangePicker-module__dateTimeWrapper___unDQJ", "headerGroup": "AdvancedDateRangePicker-module__headerGroup___J7mJB", "headerLabel": "AdvancedDateRangePicker-module__headerLabel___Yvhkr", "headerSeparator": "AdvancedDateRangePicker-module__headerSeparator___Vwx6P", "timezoneSelect": "AdvancedDateRangePicker-module__timezoneSelect___f4oln", "timezoneSelectContainer": "AdvancedDateRangePicker-module__timezoneSelectContainer___8SMc4", "timezoneSelectInput": "AdvancedDateRangePicker-module__timezoneSelectInput___ol0-7", "timezoneDisabledBadge": "AdvancedDateRangePicker-module__timezoneDisabledBadge___VBxOd", "inputWrapper": "AdvancedDateRangePicker-module__inputWrapper___bFFNF", "dateTimeColumn": "AdvancedDateRangePicker-module__dateTimeColumn___tdDV3", "dateTimeGroup": "AdvancedDateRangePicker-module__dateTimeGroup___azF09", "dateInput": "AdvancedDateRangePicker-module__dateInput___0t9ww", "inputError": "AdvancedDateRangePicker-module__inputError___A5hid", "timeInput": "AdvancedDateRangePicker-module__timeInput___Jalr9", "errorMessage": "AdvancedDateRangePicker-module__errorMessage___gx7ag", "body": "AdvancedDateRangePicker-module__body___f8XYj", "footer": "AdvancedDateRangePicker-module__footer___rsJ2w", "doneBtn": "AdvancedDateRangePicker-module__doneBtn___mt-Sv" };
|
|
1952
|
+
|
|
1953
|
+
// src/atom/AdvancedDateRangePicker/InternalCalendar.tsx
|
|
1954
|
+
var import_react4 = require("react");
|
|
1955
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1956
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1957
|
+
var InternalCalendar = ({
|
|
1958
|
+
id = "",
|
|
1959
|
+
onChange = () => {
|
|
1960
|
+
},
|
|
1961
|
+
dateRange = ["", ""],
|
|
1962
|
+
showSingleCalendar: showSingleCalendarProp = false,
|
|
1963
|
+
disablePastDates = false,
|
|
1964
|
+
minDate = null,
|
|
1965
|
+
maxDate = null,
|
|
1966
|
+
minYear = 1900,
|
|
1967
|
+
maxYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
|
|
1968
|
+
allowSameDates = false
|
|
1969
|
+
}) => {
|
|
1970
|
+
const onChangeRef = (0, import_react4.useRef)(onChange);
|
|
1971
|
+
(0, import_react4.useEffect)(() => {
|
|
1972
|
+
onChangeRef.current = onChange;
|
|
1973
|
+
}, [onChange]);
|
|
1974
|
+
const getInitialDate = () => {
|
|
1975
|
+
const today2 = /* @__PURE__ */ new Date();
|
|
1976
|
+
today2.setHours(0, 0, 0, 0);
|
|
1977
|
+
if (dateRange[0]) return new Date(dateRange[0]);
|
|
1978
|
+
if (today2.getFullYear() >= minYear && today2.getFullYear() <= maxYear) {
|
|
1979
|
+
return today2;
|
|
1980
|
+
}
|
|
1981
|
+
if (minDate) {
|
|
1982
|
+
const minDateTime = new Date(minDate);
|
|
1983
|
+
minDateTime.setHours(0, 0, 0, 0);
|
|
1984
|
+
return minDateTime;
|
|
1985
|
+
}
|
|
1986
|
+
return today2;
|
|
1987
|
+
};
|
|
1988
|
+
const [currentDate, setCurrentDate] = (0, import_react4.useState)(() => getInitialDate());
|
|
1989
|
+
const [startDate, setStartDate] = (0, import_react4.useState)(
|
|
1990
|
+
dateRange[0] ? new Date(dateRange[0]) : null
|
|
1991
|
+
);
|
|
1992
|
+
const [endDate, setEndDate] = (0, import_react4.useState)(
|
|
1993
|
+
dateRange[0] && dateRange[1] ? new Date(dateRange[1]) : null
|
|
1994
|
+
);
|
|
1995
|
+
const [hoverDate, setHoverDate] = (0, import_react4.useState)(null);
|
|
1996
|
+
const [isSelectingEnd, setIsSelectingEnd] = (0, import_react4.useState)(
|
|
1997
|
+
dateRange[0] && !dateRange[1] ? true : false
|
|
1998
|
+
);
|
|
1999
|
+
const [isMobile, setIsMobile] = (0, import_react4.useState)(false);
|
|
2000
|
+
(0, import_react4.useEffect)(() => {
|
|
2001
|
+
const checkMobile = () => {
|
|
2002
|
+
setIsMobile(window.innerWidth <= 768);
|
|
2003
|
+
};
|
|
2004
|
+
checkMobile();
|
|
2005
|
+
window.addEventListener("resize", checkMobile);
|
|
2006
|
+
return () => window.removeEventListener("resize", checkMobile);
|
|
2007
|
+
}, []);
|
|
2008
|
+
const showSingle = showSingleCalendarProp || isMobile;
|
|
2009
|
+
const prevRangeRef = (0, import_react4.useRef)(dateRange);
|
|
2010
|
+
(0, import_react4.useEffect)(() => {
|
|
2011
|
+
const isSameRange = dateRange[0] === prevRangeRef.current[0] && dateRange[1] === prevRangeRef.current[1];
|
|
2012
|
+
if (isSameRange) return;
|
|
2013
|
+
prevRangeRef.current = dateRange;
|
|
2014
|
+
const nextStart = dateRange[0] ? new Date(dateRange[0]) : null;
|
|
2015
|
+
const nextEnd = dateRange[1] ? new Date(dateRange[1]) : null;
|
|
2016
|
+
setStartDate(nextStart);
|
|
2017
|
+
setEndDate(nextEnd);
|
|
2018
|
+
if (nextStart) {
|
|
2019
|
+
const startMonth = nextStart.getFullYear() * 12 + nextStart.getMonth();
|
|
2020
|
+
const currentMonthVal = currentDate.getFullYear() * 12 + currentDate.getMonth();
|
|
2021
|
+
const isVisibleInFirst = startMonth === currentMonthVal;
|
|
2022
|
+
const isVisibleInSecond = !showSingle && startMonth === currentMonthVal + 1;
|
|
2023
|
+
if (!isVisibleInFirst && !isVisibleInSecond) {
|
|
2024
|
+
setCurrentDate(new Date(nextStart.getFullYear(), nextStart.getMonth(), 1));
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}, [dateRange, showSingle]);
|
|
2028
|
+
const today = /* @__PURE__ */ new Date();
|
|
2029
|
+
today.setHours(0, 0, 0, 0);
|
|
2030
|
+
const firstMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
|
2031
|
+
const secondMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1);
|
|
2032
|
+
const monthNames = [
|
|
2033
|
+
"January",
|
|
2034
|
+
"February",
|
|
2035
|
+
"March",
|
|
2036
|
+
"April",
|
|
2037
|
+
"May",
|
|
2038
|
+
"June",
|
|
2039
|
+
"July",
|
|
2040
|
+
"August",
|
|
2041
|
+
"September",
|
|
2042
|
+
"October",
|
|
2043
|
+
"November",
|
|
2044
|
+
"December"
|
|
2045
|
+
];
|
|
2046
|
+
const dayNames = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
2047
|
+
const generateCalendarDays = (monthDate) => {
|
|
2048
|
+
const year = monthDate.getFullYear();
|
|
2049
|
+
const month = monthDate.getMonth();
|
|
2050
|
+
const firstDay = new Date(year, month, 1);
|
|
2051
|
+
const lastDay = new Date(year, month + 1, 0);
|
|
2052
|
+
const daysInMonth = lastDay.getDate();
|
|
2053
|
+
const startingDayOfWeek = firstDay.getDay();
|
|
2054
|
+
const days = [];
|
|
2055
|
+
for (let i = 0; i < startingDayOfWeek; i++) days.push(null);
|
|
2056
|
+
for (let day = 1; day <= daysInMonth; day++) days.push(new Date(year, month, day));
|
|
2057
|
+
return days;
|
|
2058
|
+
};
|
|
2059
|
+
const isSameDate = (d1, d2) => {
|
|
2060
|
+
if (!d1 || !d2) return false;
|
|
2061
|
+
return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth() && d1.getDate() === d2.getDate();
|
|
2062
|
+
};
|
|
2063
|
+
const isDateDisabled = (date) => {
|
|
2064
|
+
if (!date) return false;
|
|
2065
|
+
const checkDate = new Date(date);
|
|
2066
|
+
checkDate.setHours(0, 0, 0, 0);
|
|
2067
|
+
if (disablePastDates && checkDate < today) return true;
|
|
2068
|
+
if (minDate) {
|
|
2069
|
+
const m = new Date(minDate);
|
|
2070
|
+
m.setHours(0, 0, 0, 0);
|
|
2071
|
+
if (checkDate < m) return true;
|
|
2072
|
+
}
|
|
2073
|
+
if (maxDate) {
|
|
2074
|
+
const m = new Date(maxDate);
|
|
2075
|
+
m.setHours(0, 0, 0, 0);
|
|
2076
|
+
if (checkDate > m) return true;
|
|
2077
|
+
}
|
|
2078
|
+
return false;
|
|
2079
|
+
};
|
|
2080
|
+
const isDateBetweenRange = (date) => {
|
|
2081
|
+
if (!startDate || !date) return false;
|
|
2082
|
+
const comp = endDate || hoverDate;
|
|
2083
|
+
if (!comp) return false;
|
|
2084
|
+
const s = startDate < comp ? startDate : comp;
|
|
2085
|
+
const e = startDate < comp ? comp : startDate;
|
|
2086
|
+
return date > s && date < e;
|
|
2087
|
+
};
|
|
2088
|
+
const isDateInRange = (date) => {
|
|
2089
|
+
if (!startDate || !date) return false;
|
|
2090
|
+
const comp = endDate || hoverDate;
|
|
2091
|
+
if (!comp) return false;
|
|
2092
|
+
const s = startDate < comp ? startDate : comp;
|
|
2093
|
+
const e = startDate < comp ? comp : startDate;
|
|
2094
|
+
return date >= s && date <= e;
|
|
2095
|
+
};
|
|
2096
|
+
const handleDateClick = (date) => {
|
|
2097
|
+
if (isDateDisabled(date)) return;
|
|
2098
|
+
let nextStart = startDate;
|
|
2099
|
+
let nextEnd = endDate;
|
|
2100
|
+
const isSame = startDate && (0, import_dayjs2.default)(date).isSame(startDate, "day");
|
|
2101
|
+
if (!allowSameDates && isSame) {
|
|
2102
|
+
setStartDate(null);
|
|
2103
|
+
setEndDate(null);
|
|
2104
|
+
setIsSelectingEnd(false);
|
|
2105
|
+
onChangeRef.current(["", ""]);
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
if (!startDate || startDate && endDate) {
|
|
2109
|
+
nextStart = date;
|
|
2110
|
+
nextEnd = null;
|
|
2111
|
+
setStartDate(nextStart);
|
|
2112
|
+
setEndDate(nextEnd);
|
|
2113
|
+
setIsSelectingEnd(true);
|
|
2114
|
+
} else {
|
|
2115
|
+
if (date < startDate) {
|
|
2116
|
+
nextEnd = startDate;
|
|
2117
|
+
nextStart = date;
|
|
2118
|
+
} else {
|
|
2119
|
+
nextEnd = date;
|
|
2120
|
+
}
|
|
2121
|
+
setStartDate(nextStart);
|
|
2122
|
+
setEndDate(nextEnd);
|
|
2123
|
+
setIsSelectingEnd(false);
|
|
2124
|
+
}
|
|
2125
|
+
onChangeRef.current([
|
|
2126
|
+
nextStart ? (0, import_dayjs2.default)(nextStart).format("D MMM, YYYY") : "",
|
|
2127
|
+
nextEnd ? (0, import_dayjs2.default)(nextEnd).format("D MMM, YYYY") : ""
|
|
2128
|
+
]);
|
|
2129
|
+
};
|
|
2130
|
+
const handleDateHover = (date) => {
|
|
2131
|
+
if (isDateDisabled(date)) return;
|
|
2132
|
+
if (isSelectingEnd && startDate && !endDate) setHoverDate(date);
|
|
2133
|
+
};
|
|
2134
|
+
const navigateMonth = (direction) => {
|
|
2135
|
+
const newDate = new Date(currentDate);
|
|
2136
|
+
newDate.setMonth(currentDate.getMonth() + direction);
|
|
2137
|
+
setCurrentDate(newDate);
|
|
2138
|
+
};
|
|
2139
|
+
const renderCalendar = (monthDate) => {
|
|
2140
|
+
const days = generateCalendarDays(monthDate);
|
|
2141
|
+
const monthName = monthNames[monthDate.getMonth()];
|
|
2142
|
+
const year = monthDate.getFullYear();
|
|
2143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-flex-1 tw-mb-2", children: [
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-text-center tw-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h3", { className: "tw-typography-footNoteBold tw-text-gray-900 tw-m-0", children: [
|
|
2145
|
+
monthName,
|
|
2146
|
+
" ",
|
|
2147
|
+
year
|
|
2148
|
+
] }) }),
|
|
2149
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-grid tw-grid-cols-7 tw-mb-2", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-py-2 tw-text-center tw-typography-caption2 tw-text-gray-500", children: day }, day)) }),
|
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-grid tw-grid-cols-7", children: days.map((date, index) => {
|
|
2151
|
+
if (!date) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-h-7" }, index);
|
|
2152
|
+
const isStart = isSameDate(date, startDate);
|
|
2153
|
+
const isEnd = isSameDate(date, endDate);
|
|
2154
|
+
const isInRange = isDateBetweenRange(date);
|
|
2155
|
+
const isSelected = isDateInRange(date);
|
|
2156
|
+
const isDisabled = isDateDisabled(date);
|
|
2157
|
+
const isHovering = isSelectingEnd && hoverDate && isSameDate(date, hoverDate);
|
|
2158
|
+
let cellClasses = "tw-relative tw-z-20 tw-h-7 tw-w-7 tw-flex tw-items-center tw-justify-center tw-typography-caption1Bold tw-cursor-pointer tw-transition-all ";
|
|
2159
|
+
if (isDisabled) {
|
|
2160
|
+
cellClasses += "tw-text-gray-300 tw-cursor-not-allowed ";
|
|
2161
|
+
} else if (isStart || isEnd) {
|
|
2162
|
+
cellClasses += "tw-bg-black tw-text-white tw-rounded-full ";
|
|
2163
|
+
} else if (isInRange) {
|
|
2164
|
+
cellClasses += "tw-text-gray-900 ";
|
|
2165
|
+
} else {
|
|
2166
|
+
cellClasses += "tw-text-gray-700 hover:tw-bg-gray-100 tw-rounded-full ";
|
|
2167
|
+
}
|
|
2168
|
+
if (isHovering && !isEnd) {
|
|
2169
|
+
cellClasses += "tw-border-2 tw-border-gray-400 tw-border-dashed ";
|
|
2170
|
+
}
|
|
2171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-relative tw-flex tw-justify-center", children: [
|
|
2172
|
+
isInRange && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-inset-x-0 tw-bg-[#E5E9ED] tw-z-10" }),
|
|
2173
|
+
isStart && endDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-right-0 tw-left-1/2 tw-bg-[#E5E9ED] tw-z-10" }),
|
|
2174
|
+
isEnd && startDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-left-0 tw-right-1/2 tw-bg-[#E5E9ED] tw-z-10" }),
|
|
2175
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2176
|
+
"div",
|
|
2177
|
+
{
|
|
2178
|
+
className: cellClasses,
|
|
2179
|
+
onClick: () => handleDateClick(date),
|
|
2180
|
+
onMouseEnter: () => handleDateHover(date),
|
|
2181
|
+
children: date.getDate()
|
|
2182
|
+
}
|
|
2183
|
+
)
|
|
2184
|
+
] }, date.toISOString());
|
|
2185
|
+
}) })
|
|
2186
|
+
] });
|
|
2187
|
+
};
|
|
2188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-relative tw-bg-white tw-w-full", children: [
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-flex tw-items-center tw-justify-between tw-absolute tw-inset-x-0 tw-top-0 tw-z-30 tw-px-4", children: [
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2191
|
+
"div",
|
|
2192
|
+
{
|
|
2193
|
+
className: "tw-cursor-pointer tw-p-2 tw-rounded-full hover:tw-bg-gray-100",
|
|
2194
|
+
onClick: () => navigateMonth(-1),
|
|
2195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Chevron, { size: "medium" })
|
|
2196
|
+
}
|
|
2197
|
+
),
|
|
2198
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2199
|
+
"div",
|
|
2200
|
+
{
|
|
2201
|
+
className: "tw-cursor-pointer tw-p-2 tw-rounded-full hover:tw-bg-gray-100",
|
|
2202
|
+
onClick: () => navigateMonth(1),
|
|
2203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Chevron, { size: "medium", className: "tw-rotate-180" })
|
|
2204
|
+
}
|
|
2205
|
+
)
|
|
2206
|
+
] }),
|
|
2207
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tw-flex tw-gap-8 tw-pt-2", children: [
|
|
2208
|
+
renderCalendar(firstMonth),
|
|
2209
|
+
!showSingle && renderCalendar(secondMonth)
|
|
2210
|
+
] })
|
|
2211
|
+
] });
|
|
2212
|
+
};
|
|
2213
|
+
var InternalCalendar_default = (0, import_react4.memo)(InternalCalendar);
|
|
2214
|
+
|
|
2215
|
+
// src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.tsx
|
|
2216
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2217
|
+
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
2218
|
+
import_dayjs3.default.extend(import_isSameOrBefore.default);
|
|
2219
|
+
var DEFAULT_TIME = { hour: "12", minute: "00", period: "PM" };
|
|
2220
|
+
function getPresets() {
|
|
2221
|
+
const today = /* @__PURE__ */ new Date();
|
|
2222
|
+
today.setHours(0, 0, 0, 0);
|
|
2223
|
+
return [
|
|
2224
|
+
{
|
|
2225
|
+
label: "Custom",
|
|
2226
|
+
key: "custom",
|
|
2227
|
+
getRange: () => [null, null]
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
label: "Yesterday",
|
|
2231
|
+
key: "yesterday",
|
|
2232
|
+
getRange: () => {
|
|
2233
|
+
const d = new Date(today);
|
|
2234
|
+
d.setDate(d.getDate() - 1);
|
|
2235
|
+
return [d, d];
|
|
2236
|
+
}
|
|
2237
|
+
},
|
|
2238
|
+
{
|
|
2239
|
+
label: "Previous week",
|
|
2240
|
+
key: "previous-week",
|
|
2241
|
+
getRange: () => {
|
|
2242
|
+
const daysToLastSunday = today.getDay() === 0 ? 7 : today.getDay();
|
|
2243
|
+
const lastSunday = new Date(today);
|
|
2244
|
+
lastSunday.setDate(today.getDate() - daysToLastSunday);
|
|
2245
|
+
const monday = new Date(lastSunday);
|
|
2246
|
+
monday.setDate(lastSunday.getDate() - 6);
|
|
2247
|
+
return [monday, lastSunday];
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
label: "This month",
|
|
2252
|
+
key: "this-month",
|
|
2253
|
+
getRange: () => {
|
|
2254
|
+
const start = new Date(today.getFullYear(), today.getMonth(), 1);
|
|
2255
|
+
const end = new Date(today.getFullYear(), today.getMonth() + 1, 0);
|
|
2256
|
+
return [start, end];
|
|
2257
|
+
}
|
|
2258
|
+
},
|
|
2259
|
+
{
|
|
2260
|
+
label: "Previous month",
|
|
2261
|
+
key: "previous-month",
|
|
2262
|
+
getRange: () => {
|
|
2263
|
+
const start = new Date(today.getFullYear(), today.getMonth() - 1, 1);
|
|
2264
|
+
const end = new Date(today.getFullYear(), today.getMonth(), 0);
|
|
2265
|
+
return [start, end];
|
|
2266
|
+
}
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
label: "Previous quarter",
|
|
2270
|
+
key: "previous-quarter",
|
|
2271
|
+
getRange: () => {
|
|
2272
|
+
const month = today.getMonth();
|
|
2273
|
+
const quarter = Math.floor(month / 3);
|
|
2274
|
+
const startMonth = (quarter - 1) * 3;
|
|
2275
|
+
const start = new Date(today.getFullYear(), startMonth, 1);
|
|
2276
|
+
const end = new Date(today.getFullYear(), startMonth + 3, 0);
|
|
2277
|
+
return [start, end];
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
];
|
|
2281
|
+
}
|
|
2282
|
+
function applyDateMask(v, prev) {
|
|
2283
|
+
if (v.length < prev.length) return v;
|
|
2284
|
+
const digits = v.replace(/[^\d]/g, "").slice(0, 8);
|
|
2285
|
+
if (digits.length >= 2) {
|
|
2286
|
+
const d = Number(digits.slice(0, 2));
|
|
2287
|
+
if (d < 1 || d > 31) return prev;
|
|
2288
|
+
}
|
|
2289
|
+
if (digits.length >= 4) {
|
|
2290
|
+
const m = Number(digits.slice(2, 4));
|
|
2291
|
+
if (m < 1 || m > 12) return prev;
|
|
2292
|
+
}
|
|
2293
|
+
let result = "";
|
|
2294
|
+
if (digits.length > 0) result += digits.slice(0, 2);
|
|
2295
|
+
if (digits.length >= 2) result += "-";
|
|
2296
|
+
if (digits.length > 2) result += digits.slice(2, 4);
|
|
2297
|
+
if (digits.length >= 4) result += "-";
|
|
2298
|
+
if (digits.length > 4) result += digits.slice(4, 8);
|
|
2299
|
+
return result.slice(0, 10);
|
|
2300
|
+
}
|
|
2301
|
+
function applyTimeMask(v, prev) {
|
|
2302
|
+
if (v.length < prev.length) return v;
|
|
2303
|
+
const digits = v.replace(/[^\d]/g, "").slice(0, 4);
|
|
2304
|
+
if (digits.length >= 2) {
|
|
2305
|
+
const h = Number(digits.slice(0, 2));
|
|
2306
|
+
if (h < 1 || h > 12) return prev;
|
|
2307
|
+
}
|
|
2308
|
+
if (digits.length >= 4) {
|
|
2309
|
+
const m = Number(digits.slice(2, 4));
|
|
2310
|
+
if (m > 59) return prev;
|
|
2311
|
+
}
|
|
2312
|
+
let result = "";
|
|
2313
|
+
if (digits.length > 0) result += digits.slice(0, 2);
|
|
2314
|
+
if (digits.length >= 2) result += ":";
|
|
2315
|
+
if (digits.length > 2) result += digits.slice(2, 4);
|
|
2316
|
+
if (v.toUpperCase().includes("A")) result += " AM";
|
|
2317
|
+
else if (v.toUpperCase().includes("P")) result += " PM";
|
|
2318
|
+
else if (digits.length === 4) result += " ";
|
|
2319
|
+
return result.slice(0, 8);
|
|
2320
|
+
}
|
|
2321
|
+
function formatForDisplay(date) {
|
|
2322
|
+
if (!date) return "";
|
|
2323
|
+
return (0, import_dayjs3.default)(date).format("DD-MM-YYYY");
|
|
2324
|
+
}
|
|
2325
|
+
function validateDateString(raw) {
|
|
2326
|
+
const regex = /^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}$/;
|
|
2327
|
+
if (!regex.test(raw)) return false;
|
|
2328
|
+
const [d, m, y] = raw.split("-").map(Number);
|
|
2329
|
+
const date = new Date(y, m - 1, d);
|
|
2330
|
+
return date.getFullYear() === y && date.getMonth() === m - 1 && date.getDate() === d;
|
|
2331
|
+
}
|
|
2332
|
+
function validateTimeString(raw) {
|
|
2333
|
+
const regex = /^(0[1-9]|1[0-2]):(0[0-9]|[1-5][0-9])\s(AM|PM)$/i;
|
|
2334
|
+
return regex.test(raw);
|
|
2335
|
+
}
|
|
2336
|
+
function parseDateInput(raw) {
|
|
2337
|
+
if (!validateDateString(raw)) return null;
|
|
2338
|
+
return (0, import_dayjs3.default)(raw, "DD-MM-YYYY", true).toDate();
|
|
2339
|
+
}
|
|
2340
|
+
function parseTimeInput(raw) {
|
|
2341
|
+
if (!validateTimeString(raw)) return null;
|
|
2342
|
+
const match = raw.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);
|
|
2343
|
+
if (!match) return null;
|
|
2344
|
+
return {
|
|
2345
|
+
hour: match[1].padStart(2, "0"),
|
|
2346
|
+
minute: match[2].padStart(2, "0"),
|
|
2347
|
+
period: match[3].toUpperCase()
|
|
2348
|
+
};
|
|
2349
|
+
}
|
|
2350
|
+
function formatTime(t) {
|
|
2351
|
+
return `${t.hour}:${t.minute} ${t.period}`;
|
|
2352
|
+
}
|
|
2353
|
+
var DateTimeInputGroup = (0, import_react5.memo)(function DateTimeInputGroup2({
|
|
2354
|
+
label,
|
|
2355
|
+
dateValue,
|
|
2356
|
+
timeValue,
|
|
2357
|
+
dateError,
|
|
2358
|
+
timeError,
|
|
2359
|
+
onDateChange,
|
|
2360
|
+
onTimeChange
|
|
2361
|
+
}) {
|
|
2362
|
+
const [isDateFocused, setIsDateFocused] = (0, import_react5.useState)(false);
|
|
2363
|
+
const [isTimeFocused, setIsTimeFocused] = (0, import_react5.useState)(false);
|
|
2364
|
+
const showDateError = dateError && !isDateFocused;
|
|
2365
|
+
const showTimeError = timeError && !isTimeFocused;
|
|
2366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.headerGroup, children: [
|
|
2367
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.headerLabel, children: label }),
|
|
2368
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: AdvancedDateRangePicker_module_default.dateTimeColumn, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeGroup, children: [
|
|
2369
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inputWrapper, children: [
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2371
|
+
"input",
|
|
2372
|
+
{
|
|
2373
|
+
type: "text",
|
|
2374
|
+
placeholder: "dd-mm-yyyy",
|
|
2375
|
+
value: dateValue,
|
|
2376
|
+
onFocus: () => setIsDateFocused(true),
|
|
2377
|
+
onBlur: () => setIsDateFocused(false),
|
|
2378
|
+
onChange: (e) => onDateChange(e.target.value),
|
|
2379
|
+
className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.dateInput, { [AdvancedDateRangePicker_module_default.inputError]: showDateError })
|
|
2380
|
+
}
|
|
2381
|
+
),
|
|
2382
|
+
showDateError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.errorMessage, children: "Enter valid date" })
|
|
2383
|
+
] }),
|
|
2384
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inputWrapper, children: [
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2386
|
+
"input",
|
|
2387
|
+
{
|
|
2388
|
+
type: "text",
|
|
2389
|
+
placeholder: "12:00 PM",
|
|
2390
|
+
value: timeValue,
|
|
2391
|
+
onFocus: () => setIsTimeFocused(true),
|
|
2392
|
+
onBlur: () => setIsTimeFocused(false),
|
|
2393
|
+
onChange: (e) => onTimeChange(e.target.value),
|
|
2394
|
+
className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.timeInput, { [AdvancedDateRangePicker_module_default.inputError]: showTimeError })
|
|
2395
|
+
}
|
|
2396
|
+
),
|
|
2397
|
+
showTimeError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.errorMessage, children: "Enter valid time" })
|
|
2398
|
+
] })
|
|
2399
|
+
] }) })
|
|
2400
|
+
] });
|
|
2401
|
+
});
|
|
2402
|
+
function AdvancedDateRangePicker({
|
|
2403
|
+
value,
|
|
2404
|
+
onChange,
|
|
2405
|
+
confirmLabel = "Done",
|
|
2406
|
+
className = "",
|
|
2407
|
+
disabled = false,
|
|
2408
|
+
disablePastDates = false,
|
|
2409
|
+
minDate = null,
|
|
2410
|
+
maxDate = null,
|
|
2411
|
+
showSingleCalendar = false,
|
|
2412
|
+
id = "adv-drp",
|
|
2413
|
+
defaultTimezone = "UTC",
|
|
2414
|
+
isTimezoneDisabled = false,
|
|
2415
|
+
timezoneOptions = [],
|
|
2416
|
+
defaultPreset = "custom",
|
|
2417
|
+
presets,
|
|
2418
|
+
hidePresets = false,
|
|
2419
|
+
hideFooter = false
|
|
2420
|
+
}) {
|
|
2421
|
+
var _a, _b, _c;
|
|
2422
|
+
const PRESETS = (0, import_react5.useMemo)(() => presets || getPresets(), [presets]);
|
|
2423
|
+
const [startDate, setStartDate] = (0, import_react5.useState)((_a = value == null ? void 0 : value.startDate) != null ? _a : null);
|
|
2424
|
+
const [endDate, setEndDate] = (0, import_react5.useState)((_b = value == null ? void 0 : value.endDate) != null ? _b : null);
|
|
2425
|
+
const [timezone, setTimezone] = (0, import_react5.useState)((_c = value == null ? void 0 : value.timezone) != null ? _c : defaultTimezone);
|
|
2426
|
+
const [fromDateStr, setFromDateStr] = (0, import_react5.useState)(formatForDisplay(startDate));
|
|
2427
|
+
const [toDateStr, setToDateStr] = (0, import_react5.useState)(formatForDisplay(endDate));
|
|
2428
|
+
const [fromTimeStr, setFromTimeStr] = (0, import_react5.useState)(
|
|
2429
|
+
(value == null ? void 0 : value.startTime) ? formatTime(value.startTime) : "12:00 PM"
|
|
2430
|
+
);
|
|
2431
|
+
const [toTimeStr, setToTimeStr] = (0, import_react5.useState)(
|
|
2432
|
+
(value == null ? void 0 : value.endTime) ? formatTime(value.endTime) : "12:00 PM"
|
|
2433
|
+
);
|
|
2434
|
+
const [activePreset, setActivePreset] = (0, import_react5.useState)(defaultPreset);
|
|
2435
|
+
const lastReportedValue = (0, import_react5.useRef)("");
|
|
2436
|
+
const isSingle = showSingleCalendar;
|
|
2437
|
+
const fromDateError = (0, import_react5.useMemo)(() => fromDateStr.length > 0 && (fromDateStr.length < 10 || !validateDateString(fromDateStr)), [fromDateStr]);
|
|
2438
|
+
const toDateError = (0, import_react5.useMemo)(() => toDateStr.length > 0 && (toDateStr.length < 10 || !validateDateString(toDateStr)), [toDateStr]);
|
|
2439
|
+
const fromTimeError = (0, import_react5.useMemo)(() => fromTimeStr.length > 0 && (fromTimeStr.length < 8 || !validateTimeString(fromTimeStr)), [fromTimeStr]);
|
|
2440
|
+
const toTimeError = (0, import_react5.useMemo)(() => toTimeStr.length > 0 && (toTimeStr.length < 8 || !validateTimeString(toTimeStr)), [toTimeStr]);
|
|
2441
|
+
const isReady = (0, import_react5.useMemo)(() => {
|
|
2442
|
+
return startDate !== null && endDate !== null && validateDateString(fromDateStr) && validateDateString(toDateStr) && validateTimeString(fromTimeStr) && validateTimeString(toTimeStr) && (0, import_dayjs3.default)(startDate).isSameOrBefore((0, import_dayjs3.default)(endDate), "day");
|
|
2443
|
+
}, [startDate, endDate, fromDateStr, toDateStr, fromTimeStr, toTimeStr]);
|
|
2444
|
+
(0, import_react5.useEffect)(() => {
|
|
2445
|
+
var _a2, _b2, _c2;
|
|
2446
|
+
if (value) {
|
|
2447
|
+
const isSameStart = value.startDate === startDate || value.startDate && startDate && (0, import_dayjs3.default)(value.startDate).isSame((0, import_dayjs3.default)(startDate), "day");
|
|
2448
|
+
const isSameEnd = value.endDate === endDate || value.endDate && endDate && (0, import_dayjs3.default)(value.endDate).isSame((0, import_dayjs3.default)(endDate), "day");
|
|
2449
|
+
const isSameTimezone = value.timezone === timezone;
|
|
2450
|
+
const isSameStartTime = !value.startTime || formatTime(value.startTime) === fromTimeStr;
|
|
2451
|
+
const isSameEndTime = !value.endTime || formatTime(value.endTime) === toTimeStr;
|
|
2452
|
+
const isSamePreset = value.activePreset === activePreset;
|
|
2453
|
+
if (!isSameStart || !isSameEnd || !isSameTimezone || !isSameStartTime || !isSameEndTime || !isSamePreset) {
|
|
2454
|
+
if (!isSameStart) setStartDate((_a2 = value.startDate) != null ? _a2 : null);
|
|
2455
|
+
if (!isSameEnd) setEndDate((_b2 = value.endDate) != null ? _b2 : null);
|
|
2456
|
+
if (!isSameTimezone) setTimezone((_c2 = value.timezone) != null ? _c2 : defaultTimezone);
|
|
2457
|
+
if (value.startTime && !isSameStartTime) setFromTimeStr(formatTime(value.startTime));
|
|
2458
|
+
if (value.endTime && !isSameEndTime) setToTimeStr(formatTime(value.endTime));
|
|
2459
|
+
if (value.activePreset && !isSamePreset) setActivePreset(value.activePreset);
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}, [value, defaultTimezone, PRESETS]);
|
|
2463
|
+
(0, import_react5.useEffect)(() => {
|
|
2464
|
+
setFromDateStr(formatForDisplay(startDate));
|
|
2465
|
+
}, [startDate]);
|
|
2466
|
+
(0, import_react5.useEffect)(() => {
|
|
2467
|
+
var _a2, _b2;
|
|
2468
|
+
if (hideFooter && isReady) {
|
|
2469
|
+
const fromTime = (_a2 = parseTimeInput(fromTimeStr)) != null ? _a2 : DEFAULT_TIME;
|
|
2470
|
+
const toTime = (_b2 = parseTimeInput(toTimeStr)) != null ? _b2 : DEFAULT_TIME;
|
|
2471
|
+
const serialized = `${startDate == null ? void 0 : startDate.toISOString()}_${endDate == null ? void 0 : endDate.toISOString()}_${fromTimeStr}_${toTimeStr}_${timezone}_${activePreset}`;
|
|
2472
|
+
if (serialized !== lastReportedValue.current) {
|
|
2473
|
+
lastReportedValue.current = serialized;
|
|
2474
|
+
onChange == null ? void 0 : onChange({
|
|
2475
|
+
startDate,
|
|
2476
|
+
endDate,
|
|
2477
|
+
startTime: fromTime,
|
|
2478
|
+
endTime: toTime,
|
|
2479
|
+
timezone,
|
|
2480
|
+
activePreset
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}, [hideFooter, isReady, onChange, startDate, endDate, fromTimeStr, toTimeStr, timezone, activePreset]);
|
|
2485
|
+
(0, import_react5.useEffect)(() => {
|
|
2486
|
+
setToDateStr(formatForDisplay(endDate));
|
|
2487
|
+
}, [endDate]);
|
|
2488
|
+
const rangeValue = (0, import_react5.useMemo)(() => [
|
|
2489
|
+
startDate ? startDate.toISOString() : "",
|
|
2490
|
+
endDate ? endDate.toISOString() : ""
|
|
2491
|
+
], [startDate, endDate]);
|
|
2492
|
+
const handleRangeChange = (0, import_react5.useCallback)(
|
|
2493
|
+
(range) => {
|
|
2494
|
+
const [s, e] = range;
|
|
2495
|
+
if (s) {
|
|
2496
|
+
const sDateByDayjs = (0, import_dayjs3.default)(s, "D MMM, YYYY").toDate();
|
|
2497
|
+
setStartDate(sDateByDayjs);
|
|
2498
|
+
} else {
|
|
2499
|
+
setStartDate(null);
|
|
2500
|
+
}
|
|
2501
|
+
if (e) {
|
|
2502
|
+
const eDateByDayjs = (0, import_dayjs3.default)(e, "D MMM, YYYY").toDate();
|
|
2503
|
+
setEndDate(eDateByDayjs);
|
|
2504
|
+
} else {
|
|
2505
|
+
setEndDate(null);
|
|
2506
|
+
}
|
|
2507
|
+
setActivePreset("custom");
|
|
2508
|
+
},
|
|
2509
|
+
[]
|
|
2510
|
+
);
|
|
2511
|
+
const handlePreset = (0, import_react5.useCallback)(
|
|
2512
|
+
(preset) => {
|
|
2513
|
+
const [s, e] = preset.getRange();
|
|
2514
|
+
setStartDate(s);
|
|
2515
|
+
setEndDate(e);
|
|
2516
|
+
setActivePreset(preset.key);
|
|
2517
|
+
},
|
|
2518
|
+
[]
|
|
2519
|
+
);
|
|
2520
|
+
const handleFromDateChange = (0, import_react5.useCallback)((v) => {
|
|
2521
|
+
const masked = applyDateMask(v, fromDateStr);
|
|
2522
|
+
setFromDateStr(masked);
|
|
2523
|
+
setActivePreset("custom");
|
|
2524
|
+
if (masked.length === 10) {
|
|
2525
|
+
const parsed = parseDateInput(masked);
|
|
2526
|
+
if (parsed) {
|
|
2527
|
+
setStartDate(parsed);
|
|
2528
|
+
if (endDate && (0, import_dayjs3.default)(parsed).isAfter((0, import_dayjs3.default)(endDate), "day")) {
|
|
2529
|
+
setEndDate(null);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
}, [fromDateStr, endDate]);
|
|
2534
|
+
const handleToDateChange = (0, import_react5.useCallback)((v) => {
|
|
2535
|
+
const masked = applyDateMask(v, toDateStr);
|
|
2536
|
+
setToDateStr(masked);
|
|
2537
|
+
setActivePreset("custom");
|
|
2538
|
+
if (masked.length === 10) {
|
|
2539
|
+
const parsed = parseDateInput(masked);
|
|
2540
|
+
if (parsed) {
|
|
2541
|
+
setEndDate(parsed);
|
|
2542
|
+
if (startDate && (0, import_dayjs3.default)(parsed).isBefore((0, import_dayjs3.default)(startDate), "day")) {
|
|
2543
|
+
setStartDate(null);
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
}, [toDateStr, startDate]);
|
|
2548
|
+
const handleFromTimeChange = (0, import_react5.useCallback)((v) => {
|
|
2549
|
+
const masked = applyTimeMask(v, fromTimeStr);
|
|
2550
|
+
setFromTimeStr(masked);
|
|
2551
|
+
setActivePreset("custom");
|
|
2552
|
+
}, [fromTimeStr]);
|
|
2553
|
+
const handleToTimeChange = (0, import_react5.useCallback)((v) => {
|
|
2554
|
+
const masked = applyTimeMask(v, toTimeStr);
|
|
2555
|
+
setToTimeStr(masked);
|
|
2556
|
+
setActivePreset("custom");
|
|
2557
|
+
}, [toTimeStr]);
|
|
2558
|
+
const handleDone = (0, import_react5.useCallback)(() => {
|
|
2559
|
+
var _a2, _b2;
|
|
2560
|
+
if (!isReady) return;
|
|
2561
|
+
const fromTime = (_a2 = parseTimeInput(fromTimeStr)) != null ? _a2 : DEFAULT_TIME;
|
|
2562
|
+
const toTime = (_b2 = parseTimeInput(toTimeStr)) != null ? _b2 : DEFAULT_TIME;
|
|
2563
|
+
onChange == null ? void 0 : onChange({
|
|
2564
|
+
startDate,
|
|
2565
|
+
endDate,
|
|
2566
|
+
startTime: fromTime,
|
|
2567
|
+
endTime: toTime,
|
|
2568
|
+
timezone,
|
|
2569
|
+
activePreset
|
|
2570
|
+
});
|
|
2571
|
+
}, [isReady, onChange, startDate, endDate, fromTimeStr, toTimeStr, timezone, activePreset]);
|
|
2572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.root, className, {
|
|
2573
|
+
[AdvancedDateRangePicker_module_default.singleCalendar]: isSingle,
|
|
2574
|
+
[AdvancedDateRangePicker_module_default.hidePresets]: hidePresets
|
|
2575
|
+
}), id, children: [
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inner, children: [
|
|
2577
|
+
!hidePresets && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("aside", { className: AdvancedDateRangePicker_module_default.left, children: PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2578
|
+
"button",
|
|
2579
|
+
{
|
|
2580
|
+
type: "button",
|
|
2581
|
+
onClick: () => handlePreset(p),
|
|
2582
|
+
className: (0, import_clsx10.default)(AdvancedDateRangePicker_module_default.sidebarItem, {
|
|
2583
|
+
[AdvancedDateRangePicker_module_default.sidebarItemActive]: activePreset === p.key
|
|
2584
|
+
}),
|
|
2585
|
+
children: p.label
|
|
2586
|
+
},
|
|
2587
|
+
p.key
|
|
2588
|
+
)) }),
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.main, children: [
|
|
2590
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("header", { className: AdvancedDateRangePicker_module_default.header, children: [
|
|
2591
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.timezoneWrapper, children: [
|
|
2592
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: AdvancedDateRangePicker_module_default.headerLabel, children: "Timezone" }),
|
|
2593
|
+
isTimezoneDisabled ? (
|
|
2594
|
+
/* Disabled state: plain text badge instead of empty dropdown */
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: AdvancedDateRangePicker_module_default.timezoneDisabledBadge, children: timezone })
|
|
2596
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2597
|
+
Select_default,
|
|
2598
|
+
{
|
|
2599
|
+
value: timezone,
|
|
2600
|
+
onChange: (val) => {
|
|
2601
|
+
if (val) setTimezone(String(val));
|
|
2602
|
+
},
|
|
2603
|
+
options: timezoneOptions,
|
|
2604
|
+
size: "small",
|
|
2605
|
+
allowClear: false,
|
|
2606
|
+
enableSearch: false,
|
|
2607
|
+
wrapperClassName: AdvancedDateRangePicker_module_default.timezoneSelectContainer,
|
|
2608
|
+
inputClassName: AdvancedDateRangePicker_module_default.timezoneSelectInput
|
|
2609
|
+
}
|
|
2610
|
+
)
|
|
2611
|
+
] }),
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeWrapper, children: [
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2614
|
+
DateTimeInputGroup,
|
|
2615
|
+
{
|
|
2616
|
+
label: "From",
|
|
2617
|
+
dateValue: fromDateStr,
|
|
2618
|
+
timeValue: fromTimeStr,
|
|
2619
|
+
dateError: fromDateError,
|
|
2620
|
+
timeError: fromTimeError,
|
|
2621
|
+
onDateChange: handleFromDateChange,
|
|
2622
|
+
onTimeChange: handleFromTimeChange
|
|
2623
|
+
}
|
|
2624
|
+
),
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2626
|
+
DateTimeInputGroup,
|
|
2627
|
+
{
|
|
2628
|
+
label: "To",
|
|
2629
|
+
dateValue: toDateStr,
|
|
2630
|
+
timeValue: toTimeStr,
|
|
2631
|
+
dateError: toDateError,
|
|
2632
|
+
timeError: toTimeError,
|
|
2633
|
+
onDateChange: handleToDateChange,
|
|
2634
|
+
onTimeChange: handleToTimeChange
|
|
2635
|
+
}
|
|
2636
|
+
)
|
|
2637
|
+
] })
|
|
2638
|
+
] }),
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: AdvancedDateRangePicker_module_default.body, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2640
|
+
InternalCalendar_default,
|
|
2641
|
+
{
|
|
2642
|
+
id: `${id}-calendar`,
|
|
2643
|
+
dateRange: rangeValue,
|
|
2644
|
+
onChange: handleRangeChange,
|
|
2645
|
+
disablePastDates,
|
|
2646
|
+
minDate,
|
|
2647
|
+
maxDate,
|
|
2648
|
+
showSingleCalendar: isSingle
|
|
2649
|
+
}
|
|
2650
|
+
) })
|
|
2651
|
+
] })
|
|
2652
|
+
] }),
|
|
2653
|
+
!hideFooter && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("footer", { className: AdvancedDateRangePicker_module_default.footer, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2654
|
+
Button_default,
|
|
2655
|
+
{
|
|
2656
|
+
onClick: handleDone,
|
|
2657
|
+
disabled: disabled || !isReady,
|
|
2658
|
+
shape: "round",
|
|
2659
|
+
children: confirmLabel
|
|
2660
|
+
}
|
|
2661
|
+
) })
|
|
2662
|
+
] });
|
|
2663
|
+
}
|
|
2664
|
+
AdvancedDateRangePicker.displayName = "AdvancedDateRangePicker";
|
|
2665
|
+
var AdvancedDateRangePicker_default = AdvancedDateRangePicker;
|
|
2666
|
+
|
|
1941
2667
|
// src/atom/Slider/Slider.tsx
|
|
1942
2668
|
var import_antd9 = require("antd");
|
|
1943
|
-
var
|
|
2669
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
1944
2670
|
|
|
1945
2671
|
// src/atom/Slider/Slider.module.scss
|
|
1946
2672
|
var Slider_module_default = { "label": "Slider-module__label___9Uea-", "slider": "Slider-module__slider___JCS-c", "disableFill": "Slider-module__disableFill___rjbsy" };
|
|
1947
2673
|
|
|
1948
2674
|
// src/atom/Slider/Slider.tsx
|
|
1949
|
-
var
|
|
2675
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1950
2676
|
function Slider(props) {
|
|
1951
2677
|
const {
|
|
1952
2678
|
label = "",
|
|
@@ -1970,12 +2696,12 @@ function Slider(props) {
|
|
|
1970
2696
|
tooltipPlacement,
|
|
1971
2697
|
disableFill = false
|
|
1972
2698
|
} = props;
|
|
1973
|
-
return /* @__PURE__ */ (0,
|
|
1974
|
-
label && /* @__PURE__ */ (0,
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
2699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2700
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: Slider_module_default.label, children: label }),
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1976
2702
|
import_antd9.Slider,
|
|
1977
2703
|
{
|
|
1978
|
-
className: (0,
|
|
2704
|
+
className: (0, import_clsx11.default)(
|
|
1979
2705
|
Slider_module_default.slider,
|
|
1980
2706
|
className,
|
|
1981
2707
|
Slider_module_default[disableFill ? "disableFill" : ""]
|
|
@@ -2007,14 +2733,287 @@ function Slider(props) {
|
|
|
2007
2733
|
Slider.displayName = "Slider";
|
|
2008
2734
|
var Slider_default = Slider;
|
|
2009
2735
|
|
|
2736
|
+
// src/atom/Table/Table.tsx
|
|
2737
|
+
var React5 = __toESM(require("react"));
|
|
2738
|
+
var import_antd10 = require("antd");
|
|
2739
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
2740
|
+
|
|
2741
|
+
// src/atom/Table/Table.module.scss
|
|
2742
|
+
var Table_module_default = { "tableWrapper": "Table-module__tableWrapper___3cqiD", "isAccordion": "Table-module__isAccordion___-uIs6", "isToolbar": "Table-module__isToolbar___LdS-m", "hasCustomHeaderCell": "Table-module__hasCustomHeaderCell___AtCk8", "table": "Table-module__table___5d7g0", "ant-table-selection-column": "Table-module__ant-table-selection-column___H9vtu", "hasCustomBodyCell": "Table-module__hasCustomBodyCell___sf8j8", "firstRow": "Table-module__firstRow___Xq-Hi", "lastRow": "Table-module__lastRow___ahv4g", "showHoverEffect": "Table-module__showHoverEffect___IyKyO", "columnHeader": "Table-module__columnHeader___Unr6d", "columnHeaderLeft": "Table-module__columnHeaderLeft___mp7pK", "columnHeaderSortArea": "Table-module__columnHeaderSortArea___jrIYo", "columnHeaderLabel": "Table-module__columnHeaderLabel___A-mRu", "columnHeaderSortIcon": "Table-module__columnHeaderSortIcon___mWVZN", "columnHeaderSortIconActive": "Table-module__columnHeaderSortIconActive___wHAqC", "columnHeaderFilterWrapper": "Table-module__columnHeaderFilterWrapper___DnSve", "columnHeaderFilterBtn": "Table-module__columnHeaderFilterBtn___NR7DY", "columnHeaderFilterBtnActive": "Table-module__columnHeaderFilterBtnActive___JdO11", "columnHeaderFilterBadge": "Table-module__columnHeaderFilterBadge___-Q2T2", "columnHeaderFilterDropdown": "Table-module__columnHeaderFilterDropdown___M-fD4" };
|
|
2743
|
+
|
|
2744
|
+
// src/atom/Table/Table.tsx
|
|
2745
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2746
|
+
function buildPagination(pagination, overrides = {}) {
|
|
2747
|
+
var _a, _b, _c, _d;
|
|
2748
|
+
if (pagination === false) {
|
|
2749
|
+
return false;
|
|
2750
|
+
}
|
|
2751
|
+
const defaults = {
|
|
2752
|
+
showSizeChanger: true,
|
|
2753
|
+
pageSizeOptions: ["10", "25", "50"],
|
|
2754
|
+
locale: { items_per_page: "" },
|
|
2755
|
+
// Removes "/ page" text
|
|
2756
|
+
showTotal: (total, range) => `${range[0]}\u2013${range[1]} of ${total} items`
|
|
2757
|
+
};
|
|
2758
|
+
const baseConfig = pagination === true || pagination === void 0 ? defaults : __spreadValues(__spreadValues({}, defaults), pagination);
|
|
2759
|
+
return __spreadProps(__spreadValues({}, baseConfig), {
|
|
2760
|
+
total: (_a = overrides.total) != null ? _a : baseConfig.total,
|
|
2761
|
+
current: (_b = overrides.current) != null ? _b : baseConfig.current,
|
|
2762
|
+
pageSize: (_c = overrides.pageSize) != null ? _c : baseConfig.pageSize,
|
|
2763
|
+
onChange: (_d = overrides.onChange) != null ? _d : baseConfig.onChange
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2766
|
+
function nextSortOrder(current) {
|
|
2767
|
+
if (current === void 0) return "ascend";
|
|
2768
|
+
if (current === "ascend") return "descend";
|
|
2769
|
+
return void 0;
|
|
2770
|
+
}
|
|
2771
|
+
function ColumnHeader({
|
|
2772
|
+
label,
|
|
2773
|
+
sortable = false,
|
|
2774
|
+
sortOrder,
|
|
2775
|
+
onSortChange,
|
|
2776
|
+
sortIcon,
|
|
2777
|
+
filterCount = 0,
|
|
2778
|
+
filterIcon,
|
|
2779
|
+
filterContent,
|
|
2780
|
+
className = ""
|
|
2781
|
+
}) {
|
|
2782
|
+
const [filterOpen, setFilterOpen] = React5.useState(false);
|
|
2783
|
+
const wrapperRef = React5.useRef(null);
|
|
2784
|
+
const filterActive = filterCount > 0;
|
|
2785
|
+
const hasFilter = filterContent !== void 0 && filterIcon !== void 0;
|
|
2786
|
+
const hasSort = sortable && sortIcon !== void 0;
|
|
2787
|
+
React5.useEffect(() => {
|
|
2788
|
+
if (!filterOpen) return;
|
|
2789
|
+
const onOutside = (e) => {
|
|
2790
|
+
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
2791
|
+
setFilterOpen(false);
|
|
2792
|
+
}
|
|
2793
|
+
};
|
|
2794
|
+
document.addEventListener("mousedown", onOutside);
|
|
2795
|
+
return () => document.removeEventListener("mousedown", onOutside);
|
|
2796
|
+
}, [filterOpen]);
|
|
2797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: Table_module_default.columnHeader, ref: wrapperRef, children: [
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: Table_module_default.columnHeaderLeft, children: hasSort ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2799
|
+
"button",
|
|
2800
|
+
{
|
|
2801
|
+
type: "button",
|
|
2802
|
+
className: Table_module_default.columnHeaderSortArea,
|
|
2803
|
+
onClick: () => onSortChange == null ? void 0 : onSortChange(nextSortOrder(sortOrder)),
|
|
2804
|
+
"aria-label": typeof label === "string" ? `Sort by ${label}` : "Sort",
|
|
2805
|
+
children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: (0, import_clsx12.default)(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }),
|
|
2807
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2808
|
+
"span",
|
|
2809
|
+
{
|
|
2810
|
+
className: (0, import_clsx12.default)(Table_module_default.columnHeaderSortIcon, {
|
|
2811
|
+
[Table_module_default.columnHeaderSortIconActive]: sortOrder !== void 0
|
|
2812
|
+
}),
|
|
2813
|
+
children: sortIcon
|
|
2814
|
+
}
|
|
2815
|
+
)
|
|
2816
|
+
]
|
|
2817
|
+
}
|
|
2818
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: (0, import_clsx12.default)(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }) }),
|
|
2819
|
+
hasFilter && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: Table_module_default.columnHeaderFilterWrapper, children: [
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2821
|
+
"button",
|
|
2822
|
+
{
|
|
2823
|
+
type: "button",
|
|
2824
|
+
className: (0, import_clsx12.default)(Table_module_default.columnHeaderFilterBtn, {
|
|
2825
|
+
[Table_module_default.columnHeaderFilterBtnActive]: filterActive
|
|
2826
|
+
}),
|
|
2827
|
+
onClick: () => setFilterOpen((v) => !v),
|
|
2828
|
+
"aria-label": typeof label === "string" ? `Filter ${label}` : "Filter",
|
|
2829
|
+
"aria-expanded": filterOpen,
|
|
2830
|
+
"aria-haspopup": "dialog",
|
|
2831
|
+
children: [
|
|
2832
|
+
filterIcon,
|
|
2833
|
+
filterActive && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: Table_module_default.columnHeaderFilterBadge, children: filterCount })
|
|
2834
|
+
]
|
|
2835
|
+
}
|
|
2836
|
+
),
|
|
2837
|
+
filterOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: Table_module_default.columnHeaderFilterDropdown, role: "dialog", children: filterContent })
|
|
2838
|
+
] })
|
|
2839
|
+
] });
|
|
2840
|
+
}
|
|
2841
|
+
function processColumns(columns, headerCellClassName, bodyCellClassName) {
|
|
2842
|
+
if (!columns) return void 0;
|
|
2843
|
+
return columns.map((col) => {
|
|
2844
|
+
const _a = col, { headerProps, title, onHeaderCell, onCell } = _a, rest = __objRest(_a, ["headerProps", "title", "onHeaderCell", "onCell"]);
|
|
2845
|
+
const resolvedOnHeaderCell = (column) => {
|
|
2846
|
+
var _a2;
|
|
2847
|
+
const base = (_a2 = onHeaderCell == null ? void 0 : onHeaderCell(column)) != null ? _a2 : {};
|
|
2848
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
2849
|
+
className: (0, import_clsx12.default)(base.className, headerCellClassName)
|
|
2850
|
+
});
|
|
2851
|
+
};
|
|
2852
|
+
const resolvedOnCell = (record, rowIndex) => {
|
|
2853
|
+
var _a2;
|
|
2854
|
+
const base = (_a2 = onCell == null ? void 0 : onCell(record, rowIndex)) != null ? _a2 : {};
|
|
2855
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
2856
|
+
className: (0, import_clsx12.default)(base.className, bodyCellClassName)
|
|
2857
|
+
});
|
|
2858
|
+
};
|
|
2859
|
+
const processedTitle = headerProps ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColumnHeader, __spreadValues({ label: title }, headerProps)) : title;
|
|
2860
|
+
return __spreadProps(__spreadValues({}, rest), {
|
|
2861
|
+
title: processedTitle,
|
|
2862
|
+
onHeaderCell: resolvedOnHeaderCell,
|
|
2863
|
+
onCell: resolvedOnCell
|
|
2864
|
+
});
|
|
2865
|
+
});
|
|
2866
|
+
}
|
|
2867
|
+
function Table(props) {
|
|
2868
|
+
var _b;
|
|
2869
|
+
const _a = props, {
|
|
2870
|
+
size = "middle",
|
|
2871
|
+
variant = "default",
|
|
2872
|
+
isAccordion = false,
|
|
2873
|
+
isToolbar = false,
|
|
2874
|
+
className = "",
|
|
2875
|
+
pagination,
|
|
2876
|
+
loading,
|
|
2877
|
+
total,
|
|
2878
|
+
current,
|
|
2879
|
+
pageSize,
|
|
2880
|
+
onPaginationChange,
|
|
2881
|
+
columns,
|
|
2882
|
+
rowSelection,
|
|
2883
|
+
rowKey = "key",
|
|
2884
|
+
onRow,
|
|
2885
|
+
dataSource,
|
|
2886
|
+
emptyState,
|
|
2887
|
+
hideHeader,
|
|
2888
|
+
loadingIndicator,
|
|
2889
|
+
style,
|
|
2890
|
+
headerCellClassName,
|
|
2891
|
+
bodyCellClassName,
|
|
2892
|
+
rowClassName
|
|
2893
|
+
} = _a, rest = __objRest(_a, [
|
|
2894
|
+
"size",
|
|
2895
|
+
"variant",
|
|
2896
|
+
"isAccordion",
|
|
2897
|
+
"isToolbar",
|
|
2898
|
+
"className",
|
|
2899
|
+
"pagination",
|
|
2900
|
+
"loading",
|
|
2901
|
+
"total",
|
|
2902
|
+
"current",
|
|
2903
|
+
"pageSize",
|
|
2904
|
+
"onPaginationChange",
|
|
2905
|
+
"columns",
|
|
2906
|
+
"rowSelection",
|
|
2907
|
+
"rowKey",
|
|
2908
|
+
"onRow",
|
|
2909
|
+
"dataSource",
|
|
2910
|
+
"emptyState",
|
|
2911
|
+
"hideHeader",
|
|
2912
|
+
"loadingIndicator",
|
|
2913
|
+
"style",
|
|
2914
|
+
"headerCellClassName",
|
|
2915
|
+
"bodyCellClassName",
|
|
2916
|
+
"rowClassName"
|
|
2917
|
+
]);
|
|
2918
|
+
const resolvedPagination = buildPagination(pagination, {
|
|
2919
|
+
total,
|
|
2920
|
+
current,
|
|
2921
|
+
pageSize,
|
|
2922
|
+
onChange: onPaginationChange
|
|
2923
|
+
});
|
|
2924
|
+
const processedColumns = React5.useMemo(
|
|
2925
|
+
() => processColumns(columns, headerCellClassName, bodyCellClassName),
|
|
2926
|
+
[columns, headerCellClassName, bodyCellClassName]
|
|
2927
|
+
);
|
|
2928
|
+
const resolvedRowSelection = React5.useMemo(() => {
|
|
2929
|
+
if (!rowSelection) return void 0;
|
|
2930
|
+
return __spreadValues({
|
|
2931
|
+
columnWidth: 48
|
|
2932
|
+
}, rowSelection);
|
|
2933
|
+
}, [rowSelection]);
|
|
2934
|
+
const resolvedOnRow = React5.useMemo(() => {
|
|
2935
|
+
const onChange = resolvedRowSelection == null ? void 0 : resolvedRowSelection.onChange;
|
|
2936
|
+
if (variant !== "selectable" || !onChange) return onRow;
|
|
2937
|
+
return (record, index) => {
|
|
2938
|
+
var _a2;
|
|
2939
|
+
const base = (_a2 = onRow == null ? void 0 : onRow(record, index)) != null ? _a2 : {};
|
|
2940
|
+
const getKey = (r, i) => typeof rowKey === "function" ? rowKey(r, i) : r[rowKey];
|
|
2941
|
+
return __spreadProps(__spreadValues({}, base), {
|
|
2942
|
+
style: __spreadValues({ cursor: "pointer" }, base.style),
|
|
2943
|
+
onClick: (e) => {
|
|
2944
|
+
var _a3, _b2;
|
|
2945
|
+
(_a3 = base.onClick) == null ? void 0 : _a3.call(base, e);
|
|
2946
|
+
const key = getKey(record, index);
|
|
2947
|
+
const current2 = (_b2 = resolvedRowSelection.selectedRowKeys) != null ? _b2 : [];
|
|
2948
|
+
const isSelected = current2.some((k) => k === key);
|
|
2949
|
+
const newKeys = isSelected ? current2.filter((k) => k !== key) : [...current2, key];
|
|
2950
|
+
const newRows = (dataSource != null ? dataSource : []).filter(
|
|
2951
|
+
(r, idx) => newKeys.some((k) => k === getKey(r, idx))
|
|
2952
|
+
);
|
|
2953
|
+
onChange(newKeys, newRows, { type: "single" });
|
|
2954
|
+
}
|
|
2955
|
+
});
|
|
2956
|
+
};
|
|
2957
|
+
}, [variant, resolvedRowSelection, rowKey, onRow, dataSource]);
|
|
2958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2959
|
+
"div",
|
|
2960
|
+
{
|
|
2961
|
+
className: (0, import_clsx12.default)(
|
|
2962
|
+
Table_module_default.tableWrapper,
|
|
2963
|
+
Table_module_default.showHoverEffect,
|
|
2964
|
+
{
|
|
2965
|
+
[Table_module_default.isAccordion]: isAccordion,
|
|
2966
|
+
[Table_module_default.isToolbar]: isToolbar,
|
|
2967
|
+
[Table_module_default.hasCustomHeaderCell]: !!headerCellClassName,
|
|
2968
|
+
[Table_module_default.hasCustomBodyCell]: !!bodyCellClassName
|
|
2969
|
+
},
|
|
2970
|
+
className
|
|
2971
|
+
),
|
|
2972
|
+
style,
|
|
2973
|
+
"data-testid": "lumina-table",
|
|
2974
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2975
|
+
import_antd10.Table,
|
|
2976
|
+
__spreadProps(__spreadValues({
|
|
2977
|
+
className: Table_module_default.table,
|
|
2978
|
+
size,
|
|
2979
|
+
pagination: resolvedPagination,
|
|
2980
|
+
columns: processedColumns,
|
|
2981
|
+
rowSelection: resolvedRowSelection,
|
|
2982
|
+
rowKey,
|
|
2983
|
+
onRow: resolvedOnRow,
|
|
2984
|
+
dataSource,
|
|
2985
|
+
showHeader: !hideHeader,
|
|
2986
|
+
locale: {
|
|
2987
|
+
emptyText: loading && loadingIndicator ? loadingIndicator : loading ? " " : emptyState
|
|
2988
|
+
}
|
|
2989
|
+
}, rest), {
|
|
2990
|
+
loading: loadingIndicator ? { spinning: !!loading && ((_b = dataSource == null ? void 0 : dataSource.length) != null ? _b : 0) > 0, indicator: loadingIndicator } : loading,
|
|
2991
|
+
rowClassName: (record, index) => {
|
|
2992
|
+
var _a2;
|
|
2993
|
+
return (0, import_clsx12.default)(
|
|
2994
|
+
{
|
|
2995
|
+
[Table_module_default.firstRow]: index === 0,
|
|
2996
|
+
[Table_module_default.lastRow]: index === ((_a2 = dataSource == null ? void 0 : dataSource.length) != null ? _a2 : 0) - 1
|
|
2997
|
+
},
|
|
2998
|
+
typeof rowClassName === "function" ? rowClassName(record, index) : rowClassName
|
|
2999
|
+
);
|
|
3000
|
+
}
|
|
3001
|
+
})
|
|
3002
|
+
)
|
|
3003
|
+
}
|
|
3004
|
+
);
|
|
3005
|
+
}
|
|
3006
|
+
Table.displayName = "Table";
|
|
3007
|
+
var Table_default = Table;
|
|
3008
|
+
|
|
2010
3009
|
// src/molecules/UserProfile/UserProfile.tsx
|
|
2011
|
-
var
|
|
3010
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
2012
3011
|
|
|
2013
3012
|
// src/molecules/UserProfile/UserProfile.module.scss
|
|
2014
3013
|
var UserProfile_module_default = { "userProfile": "UserProfile-module__userProfile___cRMm9", "profileContent": "UserProfile-module__profileContent___tfy8E", "profileHeader": "UserProfile-module__profileHeader___5qYbt", "profileName": "UserProfile-module__profileName___x8pg-", "profileEmail": "UserProfile-module__profileEmail___ZWKDd" };
|
|
2015
3014
|
|
|
2016
3015
|
// src/molecules/UserProfile/UserProfile.tsx
|
|
2017
|
-
var
|
|
3016
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2018
3017
|
var UserProfile = ({
|
|
2019
3018
|
firstName = "",
|
|
2020
3019
|
lastName = "",
|
|
@@ -2031,8 +3030,8 @@ var UserProfile = ({
|
|
|
2031
3030
|
emailClassName = ""
|
|
2032
3031
|
}) => {
|
|
2033
3032
|
const fullName = `${firstName} ${lastName}`;
|
|
2034
|
-
return /* @__PURE__ */ (0,
|
|
2035
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: (0, import_clsx13.default)(UserProfile_module_default.userProfile, className), children: [
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2036
3035
|
Avatar,
|
|
2037
3036
|
{
|
|
2038
3037
|
img: profileImg,
|
|
@@ -2043,16 +3042,16 @@ var UserProfile = ({
|
|
|
2043
3042
|
size: avatarSize
|
|
2044
3043
|
}
|
|
2045
3044
|
),
|
|
2046
|
-
/* @__PURE__ */ (0,
|
|
2047
|
-
/* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
3045
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: UserProfile_module_default.profileContent, children: [
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: UserProfile_module_default.profileHeader, children: [
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: (0, import_clsx13.default)(nameClassName || (0, import_clsx13.default)(UserProfile_module_default.profileName, "tw-typography-body2Bold")), children: [
|
|
2049
3048
|
firstName,
|
|
2050
3049
|
" ",
|
|
2051
3050
|
lastName
|
|
2052
3051
|
] }),
|
|
2053
|
-
showTag && tagProps && /* @__PURE__ */ (0,
|
|
3052
|
+
showTag && tagProps && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Tag, __spreadValues({}, tagProps))
|
|
2054
3053
|
] }),
|
|
2055
|
-
email && /* @__PURE__ */ (0,
|
|
3054
|
+
email && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: (0, import_clsx13.default)(emailClassName || (0, import_clsx13.default)(UserProfile_module_default.profileEmail, "tw-typography-caption3", "amp-mask")), children: email })
|
|
2056
3055
|
] })
|
|
2057
3056
|
] }, uniqueKey);
|
|
2058
3057
|
};
|
|
@@ -2060,6 +3059,7 @@ UserProfile.displayName = "UserProfile";
|
|
|
2060
3059
|
var UserProfile_default = UserProfile;
|
|
2061
3060
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2062
3061
|
0 && (module.exports = {
|
|
3062
|
+
AdvancedDateRangePicker,
|
|
2063
3063
|
Avatar,
|
|
2064
3064
|
Button,
|
|
2065
3065
|
Checkbox,
|
|
@@ -2070,6 +3070,7 @@ var UserProfile_default = UserProfile;
|
|
|
2070
3070
|
Select,
|
|
2071
3071
|
Slider,
|
|
2072
3072
|
Switch,
|
|
3073
|
+
Table,
|
|
2073
3074
|
Tag,
|
|
2074
3075
|
Tooltip,
|
|
2075
3076
|
UserProfile
|