@monolith-forensics/monolith-ui 1.8.0 → 1.8.1-dev.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/BarChart/BarChart.d.ts +3 -0
- package/dist/BarChart/BarChart.js +511 -0
- package/dist/BarChart/BarChart.lib.d.ts +31 -0
- package/dist/BarChart/BarChart.lib.js +136 -0
- package/dist/BarChart/BarChart.styled.d.ts +49 -0
- package/dist/BarChart/BarChart.styled.js +111 -0
- package/dist/BarChart/BarChart.types.d.ts +170 -0
- package/dist/BarChart/BarChart.types.js +1 -0
- package/dist/BarChart/index.d.ts +3 -0
- package/dist/BarChart/index.js +2 -0
- package/dist/Button/Button.js +9 -58
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.js +134 -33
- package/dist/Calendar/CalendarStyles.d.ts +3 -0
- package/dist/Calendar/CalendarStyles.js +92 -14
- package/dist/Calendar/calendarHelpers.d.ts +5 -1
- package/dist/Calendar/calendarHelpers.js +13 -5
- package/dist/ChartPrimitives/chartLegend.styled.d.ts +12 -0
- package/dist/ChartPrimitives/chartLegend.styled.js +52 -0
- package/dist/ChartPrimitives/chartTooltip.styled.d.ts +19 -0
- package/dist/ChartPrimitives/chartTooltip.styled.js +61 -0
- package/dist/ChartPrimitives/index.d.ts +2 -0
- package/dist/ChartPrimitives/index.js +2 -0
- package/dist/ChartUtils/chartColors.d.ts +8 -0
- package/dist/ChartUtils/chartColors.js +65 -0
- package/dist/ChartUtils/chartMath.d.ts +3 -0
- package/dist/ChartUtils/chartMath.js +3 -0
- package/dist/ChartUtils/index.d.ts +2 -0
- package/dist/ChartUtils/index.js +2 -0
- package/dist/Charts/BarChart/BarChart.d.ts +5 -0
- package/dist/Charts/BarChart/BarChart.js +549 -0
- package/dist/Charts/BarChart/BarChart.lib.d.ts +31 -0
- package/dist/Charts/BarChart/BarChart.lib.js +136 -0
- package/dist/Charts/BarChart/BarChart.styled.d.ts +51 -0
- package/dist/Charts/BarChart/BarChart.styled.js +115 -0
- package/dist/Charts/BarChart/BarChart.types.d.ts +171 -0
- package/dist/Charts/BarChart/BarChart.types.js +1 -0
- package/dist/Charts/BarChart/index.d.ts +3 -0
- package/dist/Charts/BarChart/index.js +2 -0
- package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +11 -0
- package/dist/Charts/ChartPrimitives/ChartExportControl.js +29 -0
- package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +1 -0
- package/dist/Charts/ChartPrimitives/chartActions.styled.js +8 -0
- package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +12 -0
- package/dist/Charts/ChartPrimitives/chartLegend.styled.js +52 -0
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +19 -0
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +61 -0
- package/dist/Charts/ChartPrimitives/index.d.ts +4 -0
- package/dist/Charts/ChartPrimitives/index.js +4 -0
- package/dist/Charts/ChartUtils/chartColors.d.ts +8 -0
- package/dist/Charts/ChartUtils/chartColors.js +65 -0
- package/dist/Charts/ChartUtils/chartExport.d.ts +47 -0
- package/dist/Charts/ChartUtils/chartExport.js +311 -0
- package/dist/Charts/ChartUtils/chartMath.d.ts +3 -0
- package/dist/Charts/ChartUtils/chartMath.js +3 -0
- package/dist/Charts/ChartUtils/index.d.ts +3 -0
- package/dist/Charts/ChartUtils/index.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.d.ts +5 -0
- package/dist/Charts/HeatMap/HeatMap.js +212 -0
- package/dist/Charts/HeatMap/HeatMap.lib.d.ts +30 -0
- package/dist/Charts/HeatMap/HeatMap.lib.js +115 -0
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +37 -0
- package/dist/Charts/HeatMap/HeatMap.styled.js +91 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +80 -0
- package/dist/Charts/HeatMap/HeatMap.types.js +1 -0
- package/dist/Charts/HeatMap/index.d.ts +3 -0
- package/dist/Charts/HeatMap/index.js +2 -0
- package/dist/Charts/LineChart/LineChart.d.ts +5 -0
- package/dist/Charts/LineChart/LineChart.js +529 -0
- package/dist/Charts/LineChart/LineChart.lib.d.ts +24 -0
- package/dist/Charts/LineChart/LineChart.lib.js +132 -0
- package/dist/Charts/LineChart/LineChart.styled.d.ts +59 -0
- package/dist/Charts/LineChart/LineChart.styled.js +147 -0
- package/dist/Charts/LineChart/LineChart.types.d.ts +193 -0
- package/dist/Charts/LineChart/LineChart.types.js +1 -0
- package/dist/Charts/LineChart/index.d.ts +3 -0
- package/dist/Charts/LineChart/index.js +2 -0
- package/dist/Charts/PieChart/PieChart.d.ts +4 -0
- package/dist/Charts/PieChart/PieChart.js +199 -0
- package/dist/Charts/PieChart/PieChart.lib.d.ts +5 -0
- package/dist/Charts/PieChart/PieChart.lib.js +19 -0
- package/dist/Charts/PieChart/PieChart.styled.d.ts +51 -0
- package/dist/Charts/PieChart/PieChart.styled.js +163 -0
- package/dist/Charts/PieChart/PieChart.types.d.ts +100 -0
- package/dist/Charts/PieChart/PieChart.types.js +1 -0
- package/dist/Charts/PieChart/index.d.ts +2 -0
- package/dist/Charts/PieChart/index.js +1 -0
- package/dist/Charts/index.d.ts +5 -0
- package/dist/Charts/index.js +4 -0
- package/dist/CheckBox/CheckBox.js +2 -16
- package/dist/DateInput/DateInput.js +198 -143
- package/dist/DropDownMenu/components/MenuComponent.js +2 -1
- package/dist/DropDownMenu/components/MenuItem.js +5 -14
- package/dist/DropDownMenu/components/MenuItemList.js +7 -24
- package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
- package/dist/FieldLabel/FieldLabel.js +4 -12
- package/dist/FileInputField/FileInputField.js +4 -23
- package/dist/FormSection/FormSection.js +5 -25
- package/dist/HeatMap/HeatMap.d.ts +3 -0
- package/dist/HeatMap/HeatMap.js +174 -0
- package/dist/HeatMap/HeatMap.lib.d.ts +30 -0
- package/dist/HeatMap/HeatMap.lib.js +115 -0
- package/dist/HeatMap/HeatMap.styled.d.ts +34 -0
- package/dist/HeatMap/HeatMap.styled.js +83 -0
- package/dist/HeatMap/HeatMap.types.d.ts +79 -0
- package/dist/HeatMap/HeatMap.types.js +1 -0
- package/dist/HeatMap/index.d.ts +3 -0
- package/dist/HeatMap/index.js +2 -0
- package/dist/IconButton/IconButton.js +2 -16
- package/dist/Input/Input.js +7 -56
- package/dist/LineChart/LineChart.d.ts +3 -0
- package/dist/LineChart/LineChart.js +491 -0
- package/dist/LineChart/LineChart.lib.d.ts +24 -0
- package/dist/LineChart/LineChart.lib.js +132 -0
- package/dist/LineChart/LineChart.styled.d.ts +57 -0
- package/dist/LineChart/LineChart.styled.js +150 -0
- package/dist/LineChart/LineChart.types.d.ts +192 -0
- package/dist/LineChart/LineChart.types.js +1 -0
- package/dist/LineChart/index.d.ts +3 -0
- package/dist/LineChart/index.js +2 -0
- package/dist/PieChart/PieChart.d.ts +2 -0
- package/dist/PieChart/PieChart.js +161 -0
- package/dist/PieChart/PieChart.lib.d.ts +5 -0
- package/dist/PieChart/PieChart.lib.js +19 -0
- package/dist/PieChart/PieChart.styled.d.ts +49 -0
- package/dist/PieChart/PieChart.styled.js +161 -0
- package/dist/PieChart/PieChart.types.d.ts +99 -0
- package/dist/PieChart/PieChart.types.js +1 -0
- package/dist/PieChart/index.d.ts +2 -0
- package/dist/PieChart/index.js +1 -0
- package/dist/Pill/Pill.js +8 -79
- package/dist/Popover/Popover.context.d.ts +2 -1
- package/dist/Popover/Popover.js +5 -2
- package/dist/Popover/Popover.styles.d.ts +1 -6
- package/dist/Popover/Popover.styles.js +11 -28
- package/dist/Popover/Popover.transitions.d.ts +4 -2
- package/dist/Popover/Popover.transitions.js +23 -49
- package/dist/Popover/PopoverDropdown.js +6 -8
- package/dist/Popover/PopoverTarget.js +6 -3
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControl.utils.js +3 -30
- package/dist/SelectBox/SelectBox.js +3 -3
- package/dist/SelectBox/select-box.styled-components.d.ts +3 -1
- package/dist/SelectBox/select-box.styled-components.js +10 -48
- package/dist/SuperDatePicker/SuperDatePicker.d.ts +74 -0
- package/dist/SuperDatePicker/SuperDatePicker.js +557 -0
- package/dist/SuperDatePicker/index.d.ts +2 -0
- package/dist/SuperDatePicker/index.js +2 -0
- package/dist/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +18 -83
- package/dist/Table/StateStorage.d.ts +4 -0
- package/dist/Table/StateStorage.js +13 -0
- package/dist/Table/Table.js +160 -12
- package/dist/Table/TableComponents.d.ts +10 -0
- package/dist/Table/TableComponents.js +57 -0
- package/dist/Table/TableDefaults.d.ts +7 -0
- package/dist/Table/TableDefaults.js +7 -0
- package/dist/Table/TableProvider.js +263 -71
- package/dist/Table/TableRow.js +15 -10
- package/dist/Table/types.d.ts +64 -0
- package/dist/TagBox/TagBox.js +18 -76
- package/dist/TextArea/TextArea.js +4 -23
- package/dist/TextInput/TextInput.js +12 -6
- package/dist/Utilities/parseTimestamp.js +11 -6
- package/dist/core/ArrowButton.d.ts +2 -0
- package/dist/core/ArrowButton.js +7 -3
- package/dist/core/ClearButton.d.ts +2 -0
- package/dist/core/ClearButton.js +7 -3
- package/dist/core/controlSizes.d.ts +34 -0
- package/dist/core/controlSizes.js +190 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
4
|
-
import { CalendarContainer, CalendarHeader, CalendarGrid, CalendarMonth, CalendarDay, CalendarDate, HighlightedCalendarDate, TodayCalendarDate, TimeContainer, MainContainer, TimePickerContainer, TimeHourSelect, TimeHeader, TimeMinuteSelect, TimeItem, TimeItemActive, NoValueButton, } from "./CalendarStyles";
|
|
5
|
-
import
|
|
4
|
+
import { CalendarContainer, CalendarHeader, CalendarHeaderControls, CalendarHeaderSelect, CalendarNavButton, CalendarGrid, CalendarMonth, CalendarDay, CalendarDate, HighlightedCalendarDate, TodayCalendarDate, TimeContainer, MainContainer, TimePickerContainer, TimeHourSelect, TimeHeader, TimeMinuteSelect, TimeItem, TimeItemActive, NoValueButton, } from "./CalendarStyles";
|
|
5
|
+
import { DropDownMenu } from "../DropDownMenu";
|
|
6
|
+
import calendar, { createLocalDate, isDate, isSameDay, isSameMonth, getDateISO, getMonthDays, getNextMonth, getPreviousMonth, WEEK_DAYS, CALENDAR_MONTHS, HOURS24, HOURS12, MINUTES, } from "./calendarHelpers";
|
|
6
7
|
import moment from "moment";
|
|
7
8
|
const checkValidRange = (value, min, max) => {
|
|
8
9
|
if (min && moment(value).startOf("day").isBefore(moment(min).startOf("day")))
|
|
@@ -20,6 +21,10 @@ const resolveValue = (value) => {
|
|
|
20
21
|
minutes: safeValue.getMinutes(),
|
|
21
22
|
};
|
|
22
23
|
};
|
|
24
|
+
const MONTH_OPTIONS = Object.keys(CALENDAR_MONTHS).map((monthName, index) => ({
|
|
25
|
+
label: monthName,
|
|
26
|
+
value: index + 1,
|
|
27
|
+
}));
|
|
23
28
|
const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hourFormat = "24", includeTime = true, clearable = true, min, max, }) => {
|
|
24
29
|
const isControlled = useRef(value !== undefined);
|
|
25
30
|
const [valueState, setValueState] = useState(defaultValue);
|
|
@@ -33,16 +38,44 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
|
|
|
33
38
|
let pressureTimer;
|
|
34
39
|
let pressureTimeout;
|
|
35
40
|
let dayTimeout;
|
|
41
|
+
const syncCalendarState = (date) => {
|
|
42
|
+
setCalendarState({
|
|
43
|
+
month: +date.getMonth() + 1,
|
|
44
|
+
year: date.getFullYear(),
|
|
45
|
+
hours: date.getHours(),
|
|
46
|
+
minutes: date.getMinutes(),
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const commitDate = (date, source = "date") => {
|
|
50
|
+
if (date && isDate(date)) {
|
|
51
|
+
if (!isControlled.current) {
|
|
52
|
+
setValueState(date);
|
|
53
|
+
}
|
|
54
|
+
syncCalendarState(date);
|
|
55
|
+
onChange(date, { source });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!isControlled.current) {
|
|
59
|
+
setValueState(null);
|
|
60
|
+
}
|
|
61
|
+
onChange(null, { source: "clear" });
|
|
62
|
+
};
|
|
63
|
+
const getWorkingDate = () => {
|
|
64
|
+
if (_value && isDate(_value)) {
|
|
65
|
+
return _value;
|
|
66
|
+
}
|
|
67
|
+
const fallbackDay = Math.min(today.getDate(), getMonthDays(calendarState.month, calendarState.year));
|
|
68
|
+
const fallbackDate = createLocalDate(calendarState.year, calendarState.month, fallbackDay);
|
|
69
|
+
fallbackDate.setHours(calendarState.hours, calendarState.minutes, 0, 0);
|
|
70
|
+
return fallbackDate;
|
|
71
|
+
};
|
|
36
72
|
const addDateToState = (date) => {
|
|
37
73
|
const isDateObject = isDate(date);
|
|
38
74
|
const _date = isDateObject ? date : new Date();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
hours: _date.getHours(),
|
|
44
|
-
minutes: _date.getMinutes(),
|
|
45
|
-
});
|
|
75
|
+
if (!isControlled.current) {
|
|
76
|
+
setValueState(_date);
|
|
77
|
+
}
|
|
78
|
+
syncCalendarState(_date);
|
|
46
79
|
};
|
|
47
80
|
const getCalendarDates = () => {
|
|
48
81
|
const { month, year } = calendarState;
|
|
@@ -50,37 +83,87 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
|
|
|
50
83
|
const calendarYear = year || (_value === null || _value === void 0 ? void 0 : _value.getFullYear()) || new Date().getFullYear();
|
|
51
84
|
return calendar(calendarMonth, calendarYear);
|
|
52
85
|
};
|
|
53
|
-
|
|
86
|
+
const setCalendarView = (nextMonth, nextYear) => {
|
|
87
|
+
setCalendarState((prev) => (Object.assign(Object.assign({}, prev), { month: nextMonth, year: nextYear })));
|
|
88
|
+
};
|
|
89
|
+
const commitMonthOrYearSelection = (nextMonth, nextYear, source) => {
|
|
90
|
+
const workingDate = getWorkingDate();
|
|
91
|
+
const clampedDay = Math.min(workingDate.getDate(), getMonthDays(nextMonth, nextYear));
|
|
92
|
+
const nextDate = createLocalDate(nextYear, nextMonth, clampedDay);
|
|
93
|
+
nextDate.setHours(workingDate.getHours(), workingDate.getMinutes(), 0, 0);
|
|
94
|
+
commitDate(nextDate, source);
|
|
95
|
+
};
|
|
96
|
+
const getYearOptions = () => {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
const currentYear = calendarState.year;
|
|
99
|
+
const minYear = (_a = min === null || min === void 0 ? void 0 : min.getFullYear()) !== null && _a !== void 0 ? _a : currentYear - 50;
|
|
100
|
+
const maxYear = (_b = max === null || max === void 0 ? void 0 : max.getFullYear()) !== null && _b !== void 0 ? _b : currentYear + 50;
|
|
101
|
+
return Array.from({ length: maxYear - minYear + 1 }, (_, index) => {
|
|
102
|
+
const optionYear = minYear + index;
|
|
103
|
+
return {
|
|
104
|
+
label: `${optionYear}`,
|
|
105
|
+
value: optionYear,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
};
|
|
54
109
|
const renderMonthAndYear = () => {
|
|
55
110
|
const { month, year } = calendarState;
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
return (_jsxs(CalendarHeader, { children: [_jsx(
|
|
111
|
+
const monthName = Object.keys(CALENDAR_MONTHS)[Math.max(0, Math.min(month - 1, 11))];
|
|
112
|
+
const yearOptions = getYearOptions();
|
|
113
|
+
return (_jsxs(CalendarHeader, { children: [_jsx(CalendarNavButton, { type: "button", onClick: handlePrevious, onMouseUp: clearPressureTimer, "aria-label": "Go to previous month", title: "Previous month. Hold Shift to jump by year.", children: _jsx(ChevronLeftIcon, { "aria-hidden": "true" }) }), _jsxs(CalendarHeaderControls, { children: [_jsx(CalendarHeaderSelect, { children: _jsx(DropDownMenu, { data: MONTH_OPTIONS, variant: "outlined", size: "xs", arrow: true, onItemSelect: (item) => commitMonthOrYearSelection(Number(item.value), year, "month"), dropDownProps: {
|
|
114
|
+
style: { width: 75, maxHeight: 260 },
|
|
115
|
+
}, buttonProps: {
|
|
116
|
+
title: "Select month",
|
|
117
|
+
size: "xxs",
|
|
118
|
+
style: { minWidth: 95 },
|
|
119
|
+
}, children: _jsx(CalendarMonth, { children: monthName }) }) }), _jsx(CalendarHeaderSelect, { children: _jsx(DropDownMenu, { data: yearOptions, variant: "outlined", size: "xs", arrow: true, searchable: true, onItemSelect: (item) => commitMonthOrYearSelection(month, Number(item.value), "year"), dropDownProps: {
|
|
120
|
+
style: { width: 120, maxHeight: 260 },
|
|
121
|
+
}, buttonProps: {
|
|
122
|
+
title: "Select year",
|
|
123
|
+
size: "xxs",
|
|
124
|
+
style: { minWidth: 50 },
|
|
125
|
+
}, children: _jsx(CalendarMonth, { children: year }) }) })] }), _jsx(CalendarNavButton, { type: "button", onClick: handleNext, onMouseUp: clearPressureTimer, "aria-label": "Go to next month", title: "Next month. Hold Shift to jump by year.", children: _jsx(ChevronRightIcon, { "aria-hidden": "true" }) })] }));
|
|
126
|
+
};
|
|
127
|
+
const handleActionKeyDown = (action) => (evt) => {
|
|
128
|
+
if (evt.key === "Enter" || evt.key === " ") {
|
|
129
|
+
evt.preventDefault();
|
|
130
|
+
action();
|
|
131
|
+
}
|
|
59
132
|
};
|
|
60
133
|
// Render the label for day of the week
|
|
61
134
|
// This method is used as a map callback as seen in render()
|
|
62
135
|
const renderDayLabel = (day, index) => {
|
|
63
136
|
// Resolve the day of the week label from the WEEK_DAYS object map
|
|
64
137
|
const daylabel = WEEK_DAYS[day];
|
|
65
|
-
return (_jsx(CalendarDay, { index: index, children: daylabel }, daylabel));
|
|
138
|
+
return (_jsx(CalendarDay, { index: index, role: "columnheader", children: daylabel }, daylabel));
|
|
66
139
|
};
|
|
67
140
|
// Render a calendar date as returned from the calendar builder function
|
|
68
141
|
// This method is used as a map callback as seen in render()
|
|
69
142
|
const renderCalendarDate = (date, index) => {
|
|
143
|
+
const [dateYear, dateMonth, dateDay] = date.map(Number);
|
|
70
144
|
const { month, year } = calendarState;
|
|
71
|
-
const _date =
|
|
145
|
+
const _date = createLocalDate(dateYear, dateMonth, dateDay);
|
|
72
146
|
// Check if calendar date is same day as today
|
|
73
147
|
const isToday = isSameDay(_date, today);
|
|
74
148
|
// Check if calendar date is same day as currently selected date
|
|
75
149
|
const isCurrent = _value && isSameDay(_date, _value);
|
|
76
150
|
// Check if calendar date is in the same month as the state month and year
|
|
77
|
-
const inMonth = month && year && isSameMonth(_date,
|
|
151
|
+
const inMonth = month && year && isSameMonth(_date, createLocalDate(year, month, 1));
|
|
152
|
+
const isDisabled = !checkValidRange(getDateISO(_date), min || null, max || null);
|
|
153
|
+
const ariaCurrent = isToday ? "date" : undefined;
|
|
78
154
|
// The click handler
|
|
79
155
|
const props = {
|
|
80
|
-
"data-disabled":
|
|
156
|
+
"data-disabled": isDisabled,
|
|
157
|
+
"aria-current": ariaCurrent,
|
|
158
|
+
"aria-disabled": isDisabled,
|
|
159
|
+
"aria-label": `${isCurrent ? "Selected" : "Select"} ${_date.toDateString()}`,
|
|
160
|
+
"aria-pressed": Boolean(isCurrent),
|
|
81
161
|
index,
|
|
82
162
|
key: getDateISO(_date),
|
|
83
163
|
onClick: gotoDate(_date),
|
|
164
|
+
onKeyDown: handleActionKeyDown(() => gotoDate(_date)(undefined)),
|
|
165
|
+
role: "button",
|
|
166
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
84
167
|
title: _date.toDateString(),
|
|
85
168
|
inMonth,
|
|
86
169
|
};
|
|
@@ -92,28 +175,42 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
|
|
|
92
175
|
const hoursArray = hourFormat === "24" ? HOURS24 : HOURS12;
|
|
93
176
|
return hoursArray.map((hour, index) => {
|
|
94
177
|
const HourComponent = hour.value === hours ? TimeItemActive : TimeItem;
|
|
95
|
-
return (_jsx(HourComponent, {
|
|
178
|
+
return (_jsx(HourComponent, { role: "button", tabIndex: 0, "aria-label": `Select ${hour.label}`, "aria-pressed": hour.value === hours,
|
|
96
179
|
// value={hour.value}
|
|
97
180
|
onClick: (e) => {
|
|
98
|
-
const newTime = moment(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
181
|
+
const newTime = moment(getWorkingDate())
|
|
182
|
+
.hours(hour.value)
|
|
183
|
+
.minutes(calendarState.minutes)
|
|
184
|
+
.toDate();
|
|
185
|
+
commitDate(newTime, "time");
|
|
186
|
+
}, onKeyDown: handleActionKeyDown(() => {
|
|
187
|
+
const newTime = moment(getWorkingDate())
|
|
188
|
+
.hours(hour.value)
|
|
189
|
+
.minutes(calendarState.minutes)
|
|
190
|
+
.toDate();
|
|
191
|
+
commitDate(newTime, "time");
|
|
192
|
+
}), children: hour.label }, hour.value));
|
|
103
193
|
});
|
|
104
194
|
};
|
|
105
195
|
const renderMinutes = () => {
|
|
106
196
|
const { minutes } = calendarState;
|
|
107
197
|
return MINUTES.map((minute) => {
|
|
108
|
-
const MinuteComponent = minute === minutes ? TimeItemActive : TimeItem;
|
|
109
|
-
return (_jsx(MinuteComponent, {
|
|
198
|
+
const MinuteComponent = minute.value === minutes ? TimeItemActive : TimeItem;
|
|
199
|
+
return (_jsx(MinuteComponent, { role: "button", tabIndex: 0, "aria-label": `Select ${minute.label} minutes`, "aria-pressed": minute.value === minutes,
|
|
110
200
|
// value={minute}
|
|
111
201
|
onClick: (e) => {
|
|
112
|
-
const newTime = moment(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
202
|
+
const newTime = moment(getWorkingDate())
|
|
203
|
+
.hours(calendarState.hours)
|
|
204
|
+
.minutes(minute.value)
|
|
205
|
+
.toDate();
|
|
206
|
+
commitDate(newTime, "time");
|
|
207
|
+
}, onKeyDown: handleActionKeyDown(() => {
|
|
208
|
+
const newTime = moment(getWorkingDate())
|
|
209
|
+
.hours(calendarState.hours)
|
|
210
|
+
.minutes(minute.value)
|
|
211
|
+
.toDate();
|
|
212
|
+
commitDate(newTime, "time");
|
|
213
|
+
}), children: minute.label }, minute.value));
|
|
117
214
|
});
|
|
118
215
|
};
|
|
119
216
|
// new 2
|
|
@@ -124,8 +221,12 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
|
|
|
124
221
|
.hours(includeTime ? calendarState.hours : 0)
|
|
125
222
|
.minutes(includeTime ? calendarState.minutes : 0)
|
|
126
223
|
.toDate();
|
|
127
|
-
!(_value && isSameDay(newTime, _value))
|
|
128
|
-
|
|
224
|
+
if (!(_value && isSameDay(newTime, _value))) {
|
|
225
|
+
commitDate(newTime, "date");
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
syncCalendarState(newTime);
|
|
229
|
+
onChange(newTime, { source: "date" });
|
|
129
230
|
};
|
|
130
231
|
const gotoPreviousMonth = () => {
|
|
131
232
|
const { month, year } = calendarState;
|
|
@@ -202,7 +303,7 @@ const Calendar = ({ defaultValue = new Date(), value, onChange = () => { }, hour
|
|
|
202
303
|
// const clearDayTimeout = () => {
|
|
203
304
|
// dayTimeout && clearTimeout(dayTimeout);
|
|
204
305
|
// };
|
|
205
|
-
return (_jsxs(MainContainer, { children: [_jsxs(CalendarContainer, { children: [renderMonthAndYear(), _jsxs(CalendarGrid, { children: [_jsx(Fragment, { children: Object.keys(WEEK_DAYS).map(renderDayLabel) }), _jsx(Fragment, { children: getCalendarDates().map(renderCalendarDate) })] }), clearable && (_jsx("div", { style: { textAlign: "center", marginTop: 3 }, children: _jsx(NoValueButton, { onClick: () =>
|
|
306
|
+
return (_jsxs(MainContainer, { children: [_jsxs(CalendarContainer, { children: [renderMonthAndYear(), _jsxs(CalendarGrid, { role: "grid", "aria-label": `Calendar view for ${Object.keys(CALENDAR_MONTHS)[calendarState.month - 1]} ${calendarState.year}`, children: [_jsx(Fragment, { children: Object.keys(WEEK_DAYS).map(renderDayLabel) }), _jsx(Fragment, { children: getCalendarDates().map(renderCalendarDate) })] }), clearable && (_jsx("div", { style: { textAlign: "center", marginTop: 3 }, children: _jsx(NoValueButton, { type: "button", onClick: () => commitDate(null, "clear"), "aria-label": "Clear selected date", children: "Clear Date" }) }))] }), includeTime && (_jsxs(TimeContainer, { children: [_jsx(TimeHeader, { children: "Select Time" }), _jsxs(TimePickerContainer, { children: [_jsx(TimeHourSelect, { children: renderHours() }), _jsx(TimeMinuteSelect, { children: renderMinutes() })] })] }))] }));
|
|
206
307
|
};
|
|
207
308
|
Calendar.displayName = "Calendar";
|
|
208
309
|
export default Calendar;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export declare const MainContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
2
|
export declare const CalendarContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
3
|
export declare const CalendarHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const CalendarHeaderControls: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const CalendarNavButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
4
6
|
export declare const CalendarGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
7
|
export declare const CalendarMonth: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
export declare const CalendarHeaderSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
9
|
interface CalendarCellProps {
|
|
7
10
|
index?: number;
|
|
8
11
|
inMonth?: boolean | 0;
|
|
@@ -1,70 +1,133 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
export const MainContainer = styled.div `
|
|
3
3
|
display: flex;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
gap: 8px;
|
|
4
6
|
`;
|
|
5
7
|
export const CalendarContainer = styled.div `
|
|
6
|
-
|
|
7
|
-
width: 250px;
|
|
8
|
+
width: 264px;
|
|
8
9
|
border-radius: 4px;
|
|
9
10
|
overflow: hidden;
|
|
11
|
+
box-sizing: border-box;
|
|
10
12
|
`;
|
|
11
13
|
export const CalendarHeader = styled.div `
|
|
12
14
|
display: flex;
|
|
13
15
|
align-items: center;
|
|
14
16
|
justify-content: space-between;
|
|
17
|
+
gap: 4px;
|
|
18
|
+
padding: 0 2px 6px;
|
|
19
|
+
`;
|
|
20
|
+
export const CalendarHeaderControls = styled.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
gap: 4px;
|
|
25
|
+
flex: 1;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
`;
|
|
28
|
+
export const CalendarNavButton = styled.button `
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
padding: 4px;
|
|
33
|
+
border: none;
|
|
34
|
+
border-radius: 4px;
|
|
35
|
+
background: transparent;
|
|
36
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transition: background 0.2s ease-out;
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
background: ${(props) => props.theme.palette.action.hover};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:focus-visible {
|
|
45
|
+
outline: 2px solid ${(props) => props.theme.palette.primary.main};
|
|
46
|
+
outline-offset: 2px;
|
|
47
|
+
}
|
|
15
48
|
`;
|
|
16
49
|
export const CalendarGrid = styled.div `
|
|
17
50
|
display: grid;
|
|
18
51
|
grid-template: repeat(7, auto) / repeat(7, auto);
|
|
52
|
+
gap: 3px;
|
|
19
53
|
`;
|
|
20
54
|
export const CalendarMonth = styled.div `
|
|
21
55
|
font-weight: 500;
|
|
22
56
|
font-size: 12px;
|
|
23
57
|
color: ${(props) => props.theme.palette.text.primary};
|
|
24
58
|
text-align: center;
|
|
25
|
-
padding:
|
|
59
|
+
padding: 8px 4px;
|
|
26
60
|
word-spacing: 5px;
|
|
27
61
|
user-select: none;
|
|
62
|
+
flex: 1;
|
|
63
|
+
`;
|
|
64
|
+
export const CalendarHeaderSelect = styled.div `
|
|
65
|
+
.mfui-DropDownMenu {
|
|
66
|
+
min-width: 0;
|
|
67
|
+
}
|
|
28
68
|
`;
|
|
29
69
|
export const CalendarCell = styled.div `
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
30
73
|
text-align: center;
|
|
31
74
|
align-self: center;
|
|
32
75
|
letter-spacing: 0.1rem;
|
|
33
|
-
|
|
76
|
+
min-width: 32px;
|
|
77
|
+
min-height: 32px;
|
|
78
|
+
padding: 6px 4px;
|
|
34
79
|
user-select: none;
|
|
35
80
|
border-radius: 5px;
|
|
36
81
|
border: 1px solid transparent;
|
|
82
|
+
box-sizing: border-box;
|
|
37
83
|
grid-column: ${({ index = 0 }) => (index % 7) + 1} / span 1;
|
|
38
84
|
`;
|
|
39
85
|
export const CalendarDay = styled(CalendarCell) `
|
|
40
86
|
font-weight: bold;
|
|
41
|
-
font-size:
|
|
87
|
+
font-size: 11px;
|
|
42
88
|
border-radius: 0px;
|
|
43
89
|
color: ${(props) => props.theme.palette.text.secondary};
|
|
90
|
+
min-height: 24px;
|
|
44
91
|
`;
|
|
45
92
|
export const CalendarDate = styled(CalendarCell) `
|
|
46
93
|
font-weight: ${(props) => (props.inMonth ? 500 : 300)};
|
|
47
|
-
font-size:
|
|
94
|
+
font-size: 11px;
|
|
95
|
+
line-height: 1.1;
|
|
48
96
|
cursor: pointer;
|
|
49
97
|
|
|
50
98
|
color: ${({ inMonth, theme }) => inMonth ? theme.palette.text.primary : theme.palette.text.secondary};
|
|
99
|
+
background: transparent;
|
|
100
|
+
opacity: ${({ inMonth }) => (inMonth ? 1 : 0.65)};
|
|
51
101
|
grid-row: ${({ index }) => Math.floor((index || 0) / 7) + 2} / span 1;
|
|
52
102
|
transition: all 0.2s ease-out;
|
|
53
103
|
border-radius: 5px;
|
|
54
104
|
&:hover {
|
|
55
105
|
background: ${({ theme }) => theme.palette.action.hover};
|
|
106
|
+
opacity: 1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&:focus-visible {
|
|
110
|
+
outline: 2px solid ${({ theme }) => theme.palette.primary.main};
|
|
111
|
+
outline-offset: 1px;
|
|
56
112
|
}
|
|
57
113
|
|
|
58
114
|
&[data-disabled="true"] {
|
|
59
115
|
pointer-events: none;
|
|
60
116
|
color: ${({ theme }) => theme.palette.text.disabled};
|
|
117
|
+
background: ${({ theme }) => `${theme.palette.action.hover}99`};
|
|
118
|
+
opacity: 0.45;
|
|
119
|
+
border-style: dashed;
|
|
61
120
|
}
|
|
62
121
|
`;
|
|
63
122
|
export const HighlightedCalendarDate = styled(CalendarDate) `
|
|
64
123
|
color: white !important;
|
|
65
124
|
background: ${(props) => props.theme.palette.primary.main} !important;
|
|
66
125
|
border: 1px solid ${(props) => props.theme.palette.primary.main} !important;
|
|
126
|
+
font-weight: 700;
|
|
127
|
+
opacity: 1;
|
|
67
128
|
position: relative;
|
|
129
|
+
box-shadow: inset 0 0 0 1px ${(props) => props.theme.palette.primary.main},
|
|
130
|
+
0 4px 10px ${(props) => `${props.theme.palette.primary.main}33`};
|
|
68
131
|
::before {
|
|
69
132
|
content: "";
|
|
70
133
|
position: absolute;
|
|
@@ -76,24 +139,29 @@ export const HighlightedCalendarDate = styled(CalendarDate) `
|
|
|
76
139
|
`;
|
|
77
140
|
export const TodayCalendarDate = styled(HighlightedCalendarDate) `
|
|
78
141
|
color: ${(props) => props.theme.palette.text.primary} !important;
|
|
79
|
-
background:
|
|
142
|
+
background: ${(props) => `${props.theme.palette.primary.main}14`} !important;
|
|
143
|
+
border: 1px dashed ${(props) => props.theme.palette.primary.main} !important;
|
|
144
|
+
box-shadow: none;
|
|
145
|
+
font-weight: 600;
|
|
80
146
|
::after {
|
|
81
147
|
content: "";
|
|
82
148
|
position: absolute;
|
|
83
|
-
|
|
84
|
-
bottom:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
border-
|
|
149
|
+
left: 50%;
|
|
150
|
+
bottom: 3px;
|
|
151
|
+
width: 4px;
|
|
152
|
+
height: 4px;
|
|
153
|
+
border-radius: 999px;
|
|
154
|
+
background: ${(props) => props.theme.palette.primary.main};
|
|
155
|
+
transform: translateX(-50%);
|
|
88
156
|
}
|
|
89
157
|
:hover {
|
|
90
158
|
color: ${(props) => props.theme.palette.text.primary} !important;
|
|
91
|
-
background: ${(props) => props.theme.palette.
|
|
159
|
+
background: ${(props) => `${props.theme.palette.primary.main}20`} !important;
|
|
92
160
|
}
|
|
93
161
|
`;
|
|
94
162
|
export const TimeContainer = styled.div `
|
|
95
163
|
font-size: 12px;
|
|
96
|
-
width:
|
|
164
|
+
width: 152px;
|
|
97
165
|
height: 100%;
|
|
98
166
|
border: 1px solid ${(props) => props.theme.palette.divider};
|
|
99
167
|
border-left: none;
|
|
@@ -138,6 +206,11 @@ export const TimeItem = styled.div `
|
|
|
138
206
|
:hover {
|
|
139
207
|
background: ${(props) => props.theme.palette.action.hover};
|
|
140
208
|
}
|
|
209
|
+
|
|
210
|
+
&:focus-visible {
|
|
211
|
+
outline: 2px solid ${(props) => props.theme.palette.primary.main};
|
|
212
|
+
outline-offset: -2px;
|
|
213
|
+
}
|
|
141
214
|
`;
|
|
142
215
|
export const TimeItemActive = styled(TimeItem) `
|
|
143
216
|
background: ${(props) => props.theme.palette.primary.main};
|
|
@@ -161,4 +234,9 @@ export const NoValueButton = styled.button `
|
|
|
161
234
|
:hover {
|
|
162
235
|
background: ${(props) => props.theme.palette.action.hover};
|
|
163
236
|
}
|
|
237
|
+
|
|
238
|
+
&:focus-visible {
|
|
239
|
+
outline: 2px solid ${(props) => props.theme.palette.primary.main};
|
|
240
|
+
outline-offset: 2px;
|
|
241
|
+
}
|
|
164
242
|
`;
|
|
@@ -8,7 +8,10 @@ export declare const HOURS12: {
|
|
|
8
8
|
value: number;
|
|
9
9
|
label: string;
|
|
10
10
|
}[];
|
|
11
|
-
export declare const MINUTES:
|
|
11
|
+
export declare const MINUTES: {
|
|
12
|
+
value: number;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
12
15
|
export declare const WEEK_DAYS: {
|
|
13
16
|
Sunday: string;
|
|
14
17
|
Monday: string;
|
|
@@ -35,6 +38,7 @@ export declare const CALENDAR_MONTHS: {
|
|
|
35
38
|
};
|
|
36
39
|
export declare const CALENDAR_WEEKS = 6;
|
|
37
40
|
export declare const zeroPad: (value: number, length: number) => string;
|
|
41
|
+
export declare const createLocalDate: (year: number, month: number, day: number) => Date;
|
|
38
42
|
export declare const getMonthDays: (month?: number, year?: number) => 28 | 29 | 30 | 31;
|
|
39
43
|
export declare const getMonthFirstDay: (month?: number, year?: number) => number;
|
|
40
44
|
export declare const isDate: (date: Date) => boolean;
|
|
@@ -12,20 +12,25 @@ export const HOURS24 = [...new Array(24)].map((n, index) => {
|
|
|
12
12
|
});
|
|
13
13
|
export const HOURS12 = [
|
|
14
14
|
...[...new Array(12)].map((n, index) => {
|
|
15
|
+
const displayHour = index === 0 ? 12 : index;
|
|
15
16
|
return {
|
|
16
17
|
value: index,
|
|
17
|
-
label:
|
|
18
|
+
label: displayHour < 10 ? `0${displayHour} AM` : `${displayHour} AM`,
|
|
18
19
|
};
|
|
19
20
|
}),
|
|
20
21
|
...[...new Array(12)].map((n, index) => {
|
|
22
|
+
const displayHour = index === 0 ? 12 : index;
|
|
21
23
|
return {
|
|
22
24
|
value: index + 12,
|
|
23
|
-
label:
|
|
25
|
+
label: displayHour < 10 ? `0${displayHour} PM` : `${displayHour} PM`,
|
|
24
26
|
};
|
|
25
27
|
}),
|
|
26
28
|
];
|
|
27
29
|
export const MINUTES = new Array(60).fill(0).map((n, index) => {
|
|
28
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
value: index,
|
|
32
|
+
label: index < 10 ? `0${index}` : `${index}`,
|
|
33
|
+
};
|
|
29
34
|
});
|
|
30
35
|
export const WEEK_DAYS = {
|
|
31
36
|
Sunday: "Su",
|
|
@@ -58,10 +63,13 @@ export const CALENDAR_WEEKS = 6;
|
|
|
58
63
|
export const zeroPad = (value, length) => {
|
|
59
64
|
return `${value}`.padStart(length, "0");
|
|
60
65
|
};
|
|
66
|
+
export const createLocalDate = (year, month, day) => {
|
|
67
|
+
return new Date(year, month - 1, day);
|
|
68
|
+
};
|
|
61
69
|
// (int) Number days in a month for a given year from 28 - 31
|
|
62
70
|
export const getMonthDays = (month = THIS_MONTH, year = THIS_YEAR) => {
|
|
63
71
|
const months30 = [4, 6, 9, 11];
|
|
64
|
-
const leapYear = year % 4 === 0;
|
|
72
|
+
const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
65
73
|
return month === 2
|
|
66
74
|
? leapYear
|
|
67
75
|
? 29
|
|
@@ -73,7 +81,7 @@ export const getMonthDays = (month = THIS_MONTH, year = THIS_YEAR) => {
|
|
|
73
81
|
// (int) First day of the month for a given year from 1 - 7
|
|
74
82
|
// 1 => Sunday, 7 => Saturday
|
|
75
83
|
export const getMonthFirstDay = (month = THIS_MONTH, year = THIS_YEAR) => {
|
|
76
|
-
return
|
|
84
|
+
return createLocalDate(year, month, 1).getDay() + 1;
|
|
77
85
|
};
|
|
78
86
|
// (bool) Checks if a value is a date - this is just a simple check
|
|
79
87
|
export const isDate = (date) => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const StyledChartLegend: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const sharedLegendItemStyles: import("styled-components").RuleSet<{
|
|
3
|
+
$active: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const StyledChartLegendLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
6
|
+
export declare const StyledChartLegendValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
7
|
+
export declare const StyledChartLegendSwatch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
8
|
+
$color: string;
|
|
9
|
+
$width?: number;
|
|
10
|
+
$height?: number;
|
|
11
|
+
$radius?: number;
|
|
12
|
+
}>> & string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
export const StyledChartLegend = styled.div `
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
min-width: 168px;
|
|
6
|
+
max-width: 280px;
|
|
7
|
+
gap: 6px;
|
|
8
|
+
`;
|
|
9
|
+
export const sharedLegendItemStyles = css `
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
user-select: none;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 10px;
|
|
14
|
+
min-height: 30px;
|
|
15
|
+
padding: 5px 7px;
|
|
16
|
+
border: 1px solid transparent;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
transition:
|
|
20
|
+
background-color 0.16s ease,
|
|
21
|
+
border-color 0.16s ease;
|
|
22
|
+
|
|
23
|
+
&:hover,
|
|
24
|
+
&:focus-visible {
|
|
25
|
+
border-color: ${({ theme }) => theme.palette.divider};
|
|
26
|
+
background-color: ${({ theme }) => theme.palette.action.hover};
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
${({ $active, theme }) => $active &&
|
|
31
|
+
`
|
|
32
|
+
border-color: ${theme.palette.divider};
|
|
33
|
+
background-color: ${theme.palette.action.hover};
|
|
34
|
+
`}
|
|
35
|
+
`;
|
|
36
|
+
export const StyledChartLegendLabel = styled.span `
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
41
|
+
`;
|
|
42
|
+
export const StyledChartLegendValue = styled.span `
|
|
43
|
+
font-variant-numeric: tabular-nums;
|
|
44
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
`;
|
|
47
|
+
export const StyledChartLegendSwatch = styled.span `
|
|
48
|
+
width: ${({ $width = 4 }) => $width}px;
|
|
49
|
+
height: ${({ $height = 22 }) => $height}px;
|
|
50
|
+
border-radius: ${({ $radius = 2 }) => $radius}px;
|
|
51
|
+
background: ${({ $color }) => $color};
|
|
52
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const StyledChartTooltip: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
|
+
$minWidth?: number;
|
|
3
|
+
$maxWidth?: number;
|
|
4
|
+
$transform?: string;
|
|
5
|
+
}>> & string;
|
|
6
|
+
export declare const StyledChartTooltipHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const StyledChartTooltipSwatch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
8
|
+
$color: string;
|
|
9
|
+
$radius?: string;
|
|
10
|
+
}>> & string;
|
|
11
|
+
export declare const StyledChartTooltipLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
12
|
+
export declare const StyledChartTooltipMeta: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
13
|
+
$marginTop?: number;
|
|
14
|
+
$direction?: "row" | "column";
|
|
15
|
+
$gap?: number;
|
|
16
|
+
}>> & string;
|
|
17
|
+
export declare const StyledChartTooltipList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
|
+
export declare const StyledChartTooltipRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
|
+
export declare const StyledChartTooltipValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|