@monolith-forensics/monolith-ui 1.7.1 → 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/Tabs/Tab.js +8 -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
|
@@ -10,10 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import moment from "moment";
|
|
12
12
|
import { useFloating, flip, offset, FloatingPortal, useDismiss, useInteractions, autoUpdate, } from "@floating-ui/react";
|
|
13
|
-
import {
|
|
13
|
+
import { CalendarDaysIcon } from "lucide-react";
|
|
14
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
14
15
|
import styled from "styled-components";
|
|
15
16
|
import { FieldLabel, Calendar } from "..";
|
|
16
|
-
import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton, } from "../core";
|
|
17
|
+
import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton, getControlSizeTokens, } from "../core";
|
|
17
18
|
import parseTimestamp from "../Utilities/parseTimestamp";
|
|
18
19
|
const StyledContainer = styled.div.attrs({
|
|
19
20
|
className: "mfui-DateInput",
|
|
@@ -53,45 +54,19 @@ const StyledInputContainer = styled.div `
|
|
|
53
54
|
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
54
55
|
|
|
55
56
|
color: ${(props) => props.theme.palette.text.primary};
|
|
56
|
-
font-size: ${({ size }) => size
|
|
57
|
-
? "11px"
|
|
58
|
-
: size === "sm"
|
|
59
|
-
? "13px"
|
|
60
|
-
: size === "md"
|
|
61
|
-
? "15px"
|
|
62
|
-
: size === "lg"
|
|
63
|
-
? "17px"
|
|
64
|
-
: size === "xl"
|
|
65
|
-
? "19px"
|
|
66
|
-
: "11px"};
|
|
57
|
+
font-size: ${({ size }) => `${getControlSizeTokens(size).fontSize}px`};
|
|
67
58
|
|
|
68
59
|
width: 100%;
|
|
69
|
-
height: ${({ size }) => size
|
|
70
|
-
? "26px"
|
|
71
|
-
: size === "sm"
|
|
72
|
-
? "30px"
|
|
73
|
-
: size === "md"
|
|
74
|
-
? "36px"
|
|
75
|
-
: size === "lg"
|
|
76
|
-
? "42px"
|
|
77
|
-
: size === "xl"
|
|
78
|
-
? "50px"
|
|
79
|
-
: "26px"};
|
|
60
|
+
height: ${({ size }) => `${getControlSizeTokens(size).height}px`};
|
|
80
61
|
|
|
81
|
-
padding: ${({ size }) => size
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
? "0px 12px"
|
|
87
|
-
: size === "lg"
|
|
88
|
-
? "0px 14px"
|
|
89
|
-
: size === "xl"
|
|
90
|
-
? "0px 16px"
|
|
91
|
-
: "0px 8px"};
|
|
62
|
+
padding: ${({ size }) => `0px ${getControlSizeTokens(size).inputPaddingX}px`};
|
|
63
|
+
|
|
64
|
+
&[data-button-left="true"] {
|
|
65
|
+
padding-left: ${({ size }) => `${getControlSizeTokens(size).adornmentWidth}px`};
|
|
66
|
+
}
|
|
92
67
|
|
|
93
68
|
&[data-button-right="true"] {
|
|
94
|
-
padding-right:
|
|
69
|
+
padding-right: ${({ size }) => `${getControlSizeTokens(size).adornmentWidth}px`};
|
|
95
70
|
}
|
|
96
71
|
|
|
97
72
|
background-color: ${({ theme, variant }) => {
|
|
@@ -151,6 +126,44 @@ const StyledInputContainer = styled.div `
|
|
|
151
126
|
}
|
|
152
127
|
}
|
|
153
128
|
`;
|
|
129
|
+
const CalendarTriggerButton = styled.button `
|
|
130
|
+
position: absolute;
|
|
131
|
+
left: 0;
|
|
132
|
+
height: 100%;
|
|
133
|
+
width: ${({ size }) => `${getControlSizeTokens(size).adornmentWidth}px`};
|
|
134
|
+
background: none;
|
|
135
|
+
border: none;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
margin: 0;
|
|
138
|
+
outline: none;
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
143
|
+
transition:
|
|
144
|
+
color 0.15s ease-in-out,
|
|
145
|
+
background-color 0.15s ease-in-out,
|
|
146
|
+
transform 0.1s ease-in-out;
|
|
147
|
+
|
|
148
|
+
&:hover {
|
|
149
|
+
color: ${(props) => props.theme.palette.text.primary};
|
|
150
|
+
background: ${(props) => props.theme.palette.action.hover};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&:active {
|
|
154
|
+
transform: scale(0.95);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:focus-visible {
|
|
158
|
+
color: ${(props) => props.theme.palette.primary.main};
|
|
159
|
+
background: ${(props) => props.theme.palette.action.hover};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
svg {
|
|
163
|
+
width: ${({ size }) => `${getControlSizeTokens(size).iconSize}px`};
|
|
164
|
+
height: ${({ size }) => `${getControlSizeTokens(size).iconSize}px`};
|
|
165
|
+
}
|
|
166
|
+
`;
|
|
154
167
|
const InputSegment = styled.div `
|
|
155
168
|
user-select: none;
|
|
156
169
|
display: flex;
|
|
@@ -161,17 +174,7 @@ const InputSegment = styled.div `
|
|
|
161
174
|
border: none;
|
|
162
175
|
padding: 0;
|
|
163
176
|
|
|
164
|
-
height: ${({ size }) => size
|
|
165
|
-
? "22px"
|
|
166
|
-
: size === "sm"
|
|
167
|
-
? "26px"
|
|
168
|
-
: size === "md"
|
|
169
|
-
? "32px"
|
|
170
|
-
: size === "lg"
|
|
171
|
-
? "38px"
|
|
172
|
-
: size === "xl"
|
|
173
|
-
? "46px"
|
|
174
|
-
: "22px"};
|
|
177
|
+
height: ${({ size }) => `${getControlSizeTokens(size).height}px`};
|
|
175
178
|
|
|
176
179
|
height: 100%;
|
|
177
180
|
|
|
@@ -179,17 +182,7 @@ const InputSegment = styled.div `
|
|
|
179
182
|
color: ${(props) => props.theme.palette.text.primary};
|
|
180
183
|
|
|
181
184
|
::placeholder {
|
|
182
|
-
font-size: ${({ size }) => size
|
|
183
|
-
? "10px"
|
|
184
|
-
: size === "sm"
|
|
185
|
-
? "12px"
|
|
186
|
-
: size === "md"
|
|
187
|
-
? "14px"
|
|
188
|
-
: size === "lg"
|
|
189
|
-
? "16px"
|
|
190
|
-
: size === "xl"
|
|
191
|
-
? "18px"
|
|
192
|
-
: "10px"};
|
|
185
|
+
font-size: ${({ size }) => `${getControlSizeTokens(size).placeholderFontSize}px`};
|
|
193
186
|
}
|
|
194
187
|
`;
|
|
195
188
|
const DateInput = forwardRef(({ className, style = {}, defaultValue, value, format = "YYYY-MM-DD HH:mm:ss", label, description, arrow = true, size = "sm", variant = "outlined", clearable = false, required = false, onChange = () => { }, min, max, error, enableCalendar = false, utc = false, closeOnSelect = true, disabled = false, }, _ref) => {
|
|
@@ -212,23 +205,83 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
212
205
|
middleware: [flip(), offset(5)],
|
|
213
206
|
whileElementsMounted: autoUpdate,
|
|
214
207
|
});
|
|
215
|
-
const dismiss = useDismiss(context
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
208
|
+
const dismiss = useDismiss(context, {
|
|
209
|
+
outsidePress: (event) => {
|
|
210
|
+
var _a, _b;
|
|
211
|
+
const target = event.target;
|
|
212
|
+
if (((_a = target === null || target === void 0 ? void 0 : target.closest) === null || _a === void 0 ? void 0 : _a.call(target, ".mfui-DropDownMenu")) ||
|
|
213
|
+
((_b = target === null || target === void 0 ? void 0 : target.closest) === null || _b === void 0 ? void 0 : _b.call(target, ".Menu"))) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
return true;
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);
|
|
220
|
+
const parseValue = useCallback((input) => {
|
|
221
|
+
if (!input)
|
|
222
|
+
return null;
|
|
223
|
+
const parsed = utc ? moment.utc(input) : moment(input);
|
|
224
|
+
return parsed.isValid() ? parsed : null;
|
|
225
|
+
}, [utc]);
|
|
226
|
+
const getEditableMoment = useCallback((input) => {
|
|
227
|
+
var _a;
|
|
228
|
+
return (_a = parseValue(input)) !== null && _a !== void 0 ? _a : (utc ? moment.utc() : moment());
|
|
229
|
+
}, [parseValue, utc]);
|
|
230
|
+
const serializeMoment = useCallback((nextMoment) => {
|
|
231
|
+
return isDateOnly
|
|
232
|
+
? nextMoment.format("YYYY-MM-DD")
|
|
233
|
+
: nextMoment.toISOString();
|
|
234
|
+
}, [isDateOnly]);
|
|
235
|
+
const commitValue = useCallback((nextValue) => {
|
|
236
|
+
if (!isControlled.current) {
|
|
237
|
+
setUncontrolledValue(nextValue);
|
|
238
|
+
}
|
|
239
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
240
|
+
}, [onChange]);
|
|
241
|
+
const segments = useMemo(() => parseTimestamp(_value || "", format, utc), [_value, format, utc]);
|
|
242
|
+
const checkValidRange = useCallback((value) => {
|
|
219
243
|
if (!value)
|
|
220
244
|
return false;
|
|
221
|
-
|
|
245
|
+
const parsed = parseValue(value);
|
|
246
|
+
if (!parsed)
|
|
247
|
+
return false;
|
|
248
|
+
if (min && parsed.isBefore(min))
|
|
222
249
|
return false;
|
|
223
|
-
if (max &&
|
|
250
|
+
if (max && parsed.isAfter(max))
|
|
224
251
|
return false;
|
|
225
252
|
return true;
|
|
226
|
-
};
|
|
253
|
+
}, [parseValue, min, max]);
|
|
254
|
+
const getCalendarValue = useCallback(() => {
|
|
255
|
+
const parsed = parseValue(_value);
|
|
256
|
+
if (!parsed)
|
|
257
|
+
return undefined;
|
|
258
|
+
if (!utc) {
|
|
259
|
+
return parsed.toDate();
|
|
260
|
+
}
|
|
261
|
+
// Convert UTC date parts into a local Date so the Calendar highlights
|
|
262
|
+
// the same wall-clock day the input is displaying.
|
|
263
|
+
return new Date(parsed.year(), parsed.month(), parsed.date(), parsed.hour(), parsed.minute(), parsed.second(), parsed.millisecond());
|
|
264
|
+
}, [_value, parseValue, utc]);
|
|
265
|
+
const updateValue = useCallback((updater) => {
|
|
266
|
+
const currentMoment = getEditableMoment(_value);
|
|
267
|
+
const nextMoment = updater(_value, currentMoment.clone());
|
|
268
|
+
if (!nextMoment || !nextMoment.isValid())
|
|
269
|
+
return;
|
|
270
|
+
const nextValue = serializeMoment(nextMoment);
|
|
271
|
+
if (!checkValidRange(nextValue))
|
|
272
|
+
return;
|
|
273
|
+
commitValue(nextValue);
|
|
274
|
+
}, [
|
|
275
|
+
_value,
|
|
276
|
+
getEditableMoment,
|
|
277
|
+
serializeMoment,
|
|
278
|
+
checkValidRange,
|
|
279
|
+
commitValue,
|
|
280
|
+
]);
|
|
227
281
|
const handleClear = (e) => {
|
|
228
282
|
e.preventDefault();
|
|
229
283
|
e.stopPropagation();
|
|
230
|
-
|
|
231
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
284
|
+
commitValue(null);
|
|
232
285
|
setIsOpen(false);
|
|
233
286
|
};
|
|
234
287
|
const handleSegmentClick = (e, segment) => {
|
|
@@ -256,6 +309,18 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
256
309
|
setIsOpen(true);
|
|
257
310
|
setSelectedSegment(segments[0]);
|
|
258
311
|
};
|
|
312
|
+
const handleCalendarTriggerClick = (e) => {
|
|
313
|
+
e.stopPropagation();
|
|
314
|
+
e.preventDefault();
|
|
315
|
+
if (mainRef === null || mainRef === void 0 ? void 0 : mainRef.current) {
|
|
316
|
+
const input = mainRef.current.querySelector("div[data-type='input']");
|
|
317
|
+
if (input) {
|
|
318
|
+
input.focus();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
setIsOpen((prev) => !prev);
|
|
322
|
+
setSelectedSegment(segments[0]);
|
|
323
|
+
};
|
|
259
324
|
const nextSegment = () => {
|
|
260
325
|
setSelectedSegment((prev) => {
|
|
261
326
|
if (!prev)
|
|
@@ -302,34 +367,18 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
302
367
|
// Up Arrow
|
|
303
368
|
if (e.key === "ArrowUp") {
|
|
304
369
|
e.preventDefault();
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (!checkValidRange(newValue))
|
|
310
|
-
return;
|
|
311
|
-
if (isDateOnly) {
|
|
312
|
-
newValue = moment(newValue).format("YYYY-MM-DD");
|
|
313
|
-
}
|
|
314
|
-
setUncontrolledValue(newValue);
|
|
315
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
316
|
-
}
|
|
370
|
+
const segmentType = selectedSegment.type;
|
|
371
|
+
if (segmentType === "separator")
|
|
372
|
+
return;
|
|
373
|
+
updateValue((_, currentMoment) => currentMoment.add(1, segmentType));
|
|
317
374
|
}
|
|
318
375
|
// Down Arrow
|
|
319
376
|
if (e.key === "ArrowDown") {
|
|
320
377
|
e.preventDefault();
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (!checkValidRange(newValue))
|
|
326
|
-
return;
|
|
327
|
-
if (isDateOnly) {
|
|
328
|
-
newValue = moment(newValue).format("YYYY-MM-DD");
|
|
329
|
-
}
|
|
330
|
-
setUncontrolledValue(newValue);
|
|
331
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
332
|
-
}
|
|
378
|
+
const segmentType = selectedSegment.type;
|
|
379
|
+
if (segmentType === "separator")
|
|
380
|
+
return;
|
|
381
|
+
updateValue((_, currentMoment) => currentMoment.subtract(1, segmentType));
|
|
333
382
|
}
|
|
334
383
|
// handle paste
|
|
335
384
|
if (e.key === "v" && (e.metaKey || e.ctrlKey)) {
|
|
@@ -348,10 +397,7 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
348
397
|
setUncontrolledValue((prev) => {
|
|
349
398
|
if (!(selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.momentType))
|
|
350
399
|
return prev;
|
|
351
|
-
|
|
352
|
-
const momentValue = utc
|
|
353
|
-
? moment.utc(prev || undefined)
|
|
354
|
-
: moment(prev || undefined);
|
|
400
|
+
const momentValue = getEditableMoment(prev);
|
|
355
401
|
let newValue = moment(momentValue)
|
|
356
402
|
.set(selectedSegment.momentType, parseInt(tempValue, 10) -
|
|
357
403
|
(selectedSegment.type === "month" ? 1 : 0))
|
|
@@ -359,7 +405,13 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
359
405
|
if (!checkValidRange(newValue))
|
|
360
406
|
return prev;
|
|
361
407
|
if (isDateOnly) {
|
|
362
|
-
newValue =
|
|
408
|
+
newValue = utc
|
|
409
|
+
? moment.utc(newValue).format("YYYY-MM-DD")
|
|
410
|
+
: moment(newValue).format("YYYY-MM-DD");
|
|
411
|
+
}
|
|
412
|
+
if (isControlled.current) {
|
|
413
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
414
|
+
return prev;
|
|
363
415
|
}
|
|
364
416
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
365
417
|
return newValue;
|
|
@@ -374,66 +426,65 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
374
426
|
if (!selectedSegment) {
|
|
375
427
|
return;
|
|
376
428
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (isDateOnly) {
|
|
384
|
-
newValue = moment(newValue).format("YYYY-MM-DD");
|
|
385
|
-
}
|
|
386
|
-
setUncontrolledValue(newValue);
|
|
387
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
388
|
-
}
|
|
429
|
+
const segmentType = selectedSegment.type;
|
|
430
|
+
if (segmentType === "separator")
|
|
431
|
+
return;
|
|
432
|
+
updateValue((_, currentMoment) => e.deltaY > 0
|
|
433
|
+
? currentMoment.subtract(1, segmentType)
|
|
434
|
+
: currentMoment.add(1, segmentType));
|
|
389
435
|
};
|
|
390
436
|
const handlePaste = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
391
437
|
const pastedText = yield window.navigator.clipboard.readText();
|
|
392
|
-
let
|
|
438
|
+
let parsedMoment = null;
|
|
393
439
|
if (!pastedText)
|
|
394
440
|
return; // do nothing if clipboard is empty
|
|
395
441
|
// check for unix timestamp in seconds
|
|
396
442
|
else if (pastedText.match(/^\d{10}$/)) {
|
|
397
|
-
|
|
443
|
+
parsedMoment = moment.unix(parseInt(pastedText, 10));
|
|
398
444
|
}
|
|
399
445
|
// check for unix timestamp in seconds with fractional seconds
|
|
400
446
|
else if (pastedText.match(/^\d{10}\.\d{1,6}$/)) {
|
|
401
|
-
|
|
447
|
+
parsedMoment = moment.unix(parseFloat(pastedText));
|
|
402
448
|
}
|
|
403
449
|
// check for unix timestamp in milliseconds
|
|
404
450
|
else if (pastedText.match(/^\d{13}$/)) {
|
|
405
|
-
|
|
406
|
-
.unix(parseInt(pastedText, 10) / 1000)
|
|
407
|
-
.toISOString();
|
|
451
|
+
parsedMoment = moment.unix(parseInt(pastedText, 10) / 1000);
|
|
408
452
|
}
|
|
409
453
|
// check for windows ldap or filetime timestamp
|
|
410
454
|
else if (pastedText.match(/^\d{18}$/)) {
|
|
411
|
-
|
|
412
|
-
.unix((parseInt(pastedText, 10) - 116444736000000000) / 10000000)
|
|
413
|
-
.toISOString();
|
|
455
|
+
parsedMoment = moment.unix((parseInt(pastedText, 10) - 116444736000000000) / 10000000);
|
|
414
456
|
}
|
|
415
457
|
// check for YMD ldap timestamp in format YYYYMMDDHHMMSSZ
|
|
416
458
|
else if (pastedText.match(/^\d{14}Z$/)) {
|
|
417
|
-
|
|
418
|
-
.utc(pastedText, "YYYYMMDDHHmmssZ")
|
|
419
|
-
.toISOString();
|
|
459
|
+
parsedMoment = moment.utc(pastedText, "YYYYMMDDHHmmssZ");
|
|
420
460
|
}
|
|
421
461
|
// check if pasted text is any other valid timestamp
|
|
422
462
|
else if (!moment(pastedText).isValid())
|
|
423
463
|
return;
|
|
424
464
|
else {
|
|
425
|
-
|
|
465
|
+
parsedMoment = utc ? moment.utc(pastedText) : moment(pastedText);
|
|
466
|
+
}
|
|
467
|
+
if (!(parsedMoment === null || parsedMoment === void 0 ? void 0 : parsedMoment.isValid()))
|
|
468
|
+
return;
|
|
469
|
+
if (utc) {
|
|
470
|
+
parsedMoment = parsedMoment.clone().utc();
|
|
426
471
|
}
|
|
427
|
-
|
|
428
|
-
|
|
472
|
+
const parsedTimestamp = serializeMoment(parsedMoment);
|
|
473
|
+
if (!checkValidRange(parsedTimestamp))
|
|
474
|
+
return;
|
|
475
|
+
commitValue(parsedTimestamp);
|
|
429
476
|
});
|
|
430
477
|
// Close on outside click
|
|
431
478
|
useEffect(() => {
|
|
432
479
|
const close = (e) => {
|
|
433
|
-
var _a, _b;
|
|
480
|
+
var _a, _b, _c, _d;
|
|
434
481
|
const target = e.target;
|
|
435
482
|
const referenceElement = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
|
|
436
483
|
const floatingElement = (_b = refs === null || refs === void 0 ? void 0 : refs.floating) === null || _b === void 0 ? void 0 : _b.current;
|
|
484
|
+
if (((_c = target === null || target === void 0 ? void 0 : target.closest) === null || _c === void 0 ? void 0 : _c.call(target, ".mfui-DropDownMenu")) ||
|
|
485
|
+
((_d = target === null || target === void 0 ? void 0 : target.closest) === null || _d === void 0 ? void 0 : _d.call(target, ".Menu"))) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
437
488
|
if (floatingElement && // Check if the floating element exists
|
|
438
489
|
e.target !== referenceElement && // Check if the target is not the reference (input)
|
|
439
490
|
!referenceElement.contains(target) && // Check if the target is not inside the reference (input)
|
|
@@ -446,18 +497,18 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
446
497
|
document.addEventListener("click", close);
|
|
447
498
|
return () => document.removeEventListener("click", close);
|
|
448
499
|
}, [refs.floating]);
|
|
449
|
-
return (_jsxs(StyledContainer, { ref: (ref) => {
|
|
500
|
+
return (_jsxs(StyledContainer, Object.assign({ ref: (ref) => {
|
|
450
501
|
if (typeof _ref === "function") {
|
|
451
502
|
_ref(ref);
|
|
452
503
|
}
|
|
453
504
|
mainRef.current = ref;
|
|
454
505
|
refs.setReference(ref);
|
|
455
|
-
}, onWheel: (e) => handleWheelEvent(e), className: className, children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { className: "input-container", onClick: handleContainerClick, onMouseDown: handleMouseDown, onKeyDown: handleKeyDown, onFocus: (e) => {
|
|
506
|
+
}, onWheel: (e) => handleWheelEvent(e), className: className }, getReferenceProps(), { children: [label && (_jsx(FieldLabel, { error: error, asterisk: required, size: size, description: description, children: label })), _jsxs(StyledInputContainer, { className: "input-container", onClick: handleContainerClick, onMouseDown: handleMouseDown, onKeyDown: handleKeyDown, onFocus: (e) => {
|
|
456
507
|
e.preventDefault();
|
|
457
508
|
setSelectedSegment(segments[0]);
|
|
458
509
|
}, onBlur: () => {
|
|
459
510
|
setSelectedSegment(null);
|
|
460
|
-
}, "data-empty": !_value, "data-disabled": disabled, role: "textbox", size: size, variant: variant, "data-button-right": arrow || clearable, style: style, children: [segments.map((segment, i) => {
|
|
511
|
+
}, "data-empty": !_value, "data-disabled": disabled, role: "textbox", size: size, variant: variant, "data-button-left": enableCalendar, "data-button-right": arrow || clearable, style: style, children: [enableCalendar && (_jsx(CalendarTriggerButton, { size: size, type: "button", "aria-label": "Toggle calendar", onClick: handleCalendarTriggerClick, "data-default-btn": true, children: _jsx(CalendarDaysIcon, {}) })), segments.map((segment, i) => {
|
|
461
512
|
if (segment.type === "separator") {
|
|
462
513
|
return (_jsx("div", { className: "separator", tabIndex: -1, onClick: (e) => {
|
|
463
514
|
e.preventDefault();
|
|
@@ -465,21 +516,25 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
465
516
|
}, onFocus: (e) => e.preventDefault(), onPointerDown: (e) => e.preventDefault(), "data-type": "separator", "data-identifier": segment.type, "data-has-space": segment.text.includes(" "), "data-placeholder": segment.placeholder, "data-value": segment.value, children: segment.text }, i));
|
|
466
517
|
}
|
|
467
518
|
return (_jsx(InputSegment, { className: "input", tabIndex: i === 0 ? 0 : -1, onClick: (e) => handleSegmentClick(e, segment), "data-type": "input", size: size, "data-identifier": segment.type, "data-has-space": segment.text.includes(" "), "data-placeholder": segment.placeholder, "data-value": segment.value, "data-selected": (selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.index) === segment.index, children: _value ? segment.text : segment.placeholder }, i));
|
|
468
|
-
}), utc && _jsx("div", { style: { marginLeft: 5 }, children: "UTC" }), clearable && _value ? (_jsx(ClearButton, { onClick: handleClear })) : arrow ? (_jsx(ArrowButton, {})) : null] }), !disabled && enableCalendar && isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(StyledFloatContainer, Object.assign({ ref: refs.setFloating, style: floatingStyles },
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
519
|
+
}), utc && _jsx("div", { style: { marginLeft: 5 }, children: "UTC" }), clearable && _value ? (_jsx(ClearButton, { size: size, onClick: handleClear })) : arrow ? (_jsx(ArrowButton, { size: size })) : null] }), !disabled && enableCalendar && isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(StyledFloatContainer, Object.assign({ ref: refs.setFloating, style: floatingStyles }, getFloatingProps(), { children: _jsx(StyledContent, { maxDropdownHeight: "fit-content", children: _jsx("div", { children: _jsx(Calendar, { value: getCalendarValue(), clearable: false, min: min, max: max, onChange: (date, meta) => {
|
|
520
|
+
if (!date) {
|
|
521
|
+
commitValue(null);
|
|
522
|
+
setIsOpen((meta === null || meta === void 0 ? void 0 : meta.source) === "month" || (meta === null || meta === void 0 ? void 0 : meta.source) === "year"
|
|
523
|
+
? true
|
|
524
|
+
: closeOnSelect
|
|
525
|
+
? false
|
|
526
|
+
: true);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
updateValue((_, currentMoment) => currentMoment
|
|
530
|
+
.year(date.getFullYear())
|
|
531
|
+
.month(date.getMonth())
|
|
532
|
+
.date(date.getDate()));
|
|
533
|
+
setIsOpen((meta === null || meta === void 0 ? void 0 : meta.source) === "month" || (meta === null || meta === void 0 ? void 0 : meta.source) === "year"
|
|
534
|
+
? true
|
|
535
|
+
: closeOnSelect
|
|
536
|
+
? false
|
|
537
|
+
: true);
|
|
538
|
+
}, includeTime: false }, 1) }) }) })) }))] })));
|
|
484
539
|
});
|
|
485
540
|
export default DateInput;
|
|
@@ -13,6 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { forwardRef, useContext, useEffect, useRef, useState } from "react";
|
|
14
14
|
import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useHover, useInteractions, useListItem, useListNavigation, useMergeRefs, useRole, useTypeahead, } from "@floating-ui/react";
|
|
15
15
|
import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
|
|
16
|
+
import { getControlSizeTokens } from "../../core";
|
|
16
17
|
import { MenuContext } from "./MenuContext";
|
|
17
18
|
import { StyledFloatContainer } from "./StyledFloatContainer";
|
|
18
19
|
import { StyledContent } from "./StyledContent";
|
|
@@ -107,7 +108,7 @@ export const MenuComponent = forwardRef((_a, forwardedRef) => {
|
|
|
107
108
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
108
109
|
setHasFocusInside(false);
|
|
109
110
|
parent.setHasFocusInside(true);
|
|
110
|
-
} }))), { rightSection: arrow ? (_jsx(ChevronDownIcon, { size:
|
|
111
|
+
} }))), { rightSection: arrow ? (_jsx(ChevronDownIcon, { size: getControlSizeTokens(buttonSize).iconSize })) : isNested ? (_jsx(ChevronRightIcon, { size: getControlSizeTokens(buttonSize).iconSize })) : null, size: buttonSize, variant: variant, selected: isOpen, nested: isNested }, buttonProps, { children: label })), _jsx(MenuContext.Provider, { value: {
|
|
111
112
|
activeIndex,
|
|
112
113
|
setActiveIndex,
|
|
113
114
|
getItemProps,
|
|
@@ -13,6 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { forwardRef, useContext } from "react";
|
|
14
14
|
import styled from "styled-components";
|
|
15
15
|
import { Button } from "../../Button";
|
|
16
|
+
import { getControlSizeTokens } from "../../core";
|
|
16
17
|
import { useFloatingTree, useListItem, useMergeRefs } from "@floating-ui/react";
|
|
17
18
|
import { MenuContext } from "./MenuContext";
|
|
18
19
|
import Tooltip from "../../Tooltip";
|
|
@@ -43,12 +44,12 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
|
|
|
43
44
|
border-radius: 3px;
|
|
44
45
|
display: flex;
|
|
45
46
|
flex-direction: row;
|
|
46
|
-
gap:
|
|
47
|
+
gap: ${({ size = "sm" }) => `${getControlSizeTokens(size).iconGap}px`};
|
|
47
48
|
align-items: center;
|
|
48
|
-
min-height:
|
|
49
|
+
min-height: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuRowHeight}px`};
|
|
49
50
|
width: 100%;
|
|
50
51
|
min-width: 100%;
|
|
51
|
-
height:
|
|
52
|
+
height: ${({ size = "sm" }) => `${getControlSizeTokens(size).menuRowHeight}px`};
|
|
52
53
|
position: relative;
|
|
53
54
|
user-select: none;
|
|
54
55
|
outline: none;
|
|
@@ -65,17 +66,7 @@ export const MenuItem = styled(forwardRef((_a, forwardedRef) => {
|
|
|
65
66
|
font-weight: normal;
|
|
66
67
|
letter-spacing: normal;
|
|
67
68
|
|
|
68
|
-
padding: ${({ size }) => size
|
|
69
|
-
? "2px 8px"
|
|
70
|
-
: size === "sm"
|
|
71
|
-
? "4px 10px"
|
|
72
|
-
: size === "md"
|
|
73
|
-
? "4px 12px"
|
|
74
|
-
: size === "lg"
|
|
75
|
-
? "5px 14px"
|
|
76
|
-
: size === "xl"
|
|
77
|
-
? "6px 16px"
|
|
78
|
-
: "2px 8px"};
|
|
69
|
+
padding: ${({ size = "sm" }) => `0px ${getControlSizeTokens(size).menuItemPaddingX}px`};
|
|
79
70
|
|
|
80
71
|
&[data-disabled="true"] {
|
|
81
72
|
opacity: 0.5;
|
|
@@ -15,6 +15,7 @@ import styled from "styled-components";
|
|
|
15
15
|
import { FixedSizeList } from "react-window";
|
|
16
16
|
import { Plus } from "lucide-react";
|
|
17
17
|
import CheckBox from "../../CheckBox";
|
|
18
|
+
import { getControlSizeTokens } from "../../core";
|
|
18
19
|
import { DropDownMenu } from "../DropDownMenu";
|
|
19
20
|
import { MenuItem } from "./MenuItem";
|
|
20
21
|
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
@@ -62,28 +63,9 @@ const GroupHeader = styled.div `
|
|
|
62
63
|
color: ${(props) => props.theme.palette.text.secondary};
|
|
63
64
|
font-weight: 500;
|
|
64
65
|
user-select: none;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
? "4px 10px"
|
|
69
|
-
: $size === "md"
|
|
70
|
-
? "4px 12px"
|
|
71
|
-
: $size === "lg"
|
|
72
|
-
? "5px 14px"
|
|
73
|
-
: $size === "xl"
|
|
74
|
-
? "6px 16px"
|
|
75
|
-
: "2px 8px"};
|
|
76
|
-
font-size: ${({ $size }) => $size === "xs"
|
|
77
|
-
? "10px"
|
|
78
|
-
: $size === "sm"
|
|
79
|
-
? "11px"
|
|
80
|
-
: $size === "md"
|
|
81
|
-
? "13px"
|
|
82
|
-
: $size === "lg"
|
|
83
|
-
? "15px"
|
|
84
|
-
: $size === "xl"
|
|
85
|
-
? "17px"
|
|
86
|
-
: "10px"};
|
|
66
|
+
min-height: ${({ $size = "sm" }) => `${getControlSizeTokens($size).menuRowHeight}px`};
|
|
67
|
+
padding: ${({ $size = "sm" }) => `0px ${getControlSizeTokens($size).menuItemPaddingX}px`};
|
|
68
|
+
font-size: ${({ $size = "sm" }) => `${getControlSizeTokens($size).menuGroupFontSize}px`};
|
|
87
69
|
|
|
88
70
|
.group-line {
|
|
89
71
|
border-top: 1px solid ${(props) => props.theme.palette.divider};
|
|
@@ -197,7 +179,8 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, se
|
|
|
197
179
|
}
|
|
198
180
|
}, [targetElm.current, isLoading]);
|
|
199
181
|
const overscanCount = 10;
|
|
200
|
-
const
|
|
182
|
+
const sizeTokens = getControlSizeTokens(size || "sm");
|
|
183
|
+
const itemHeight = sizeTokens.menuRowHeight;
|
|
201
184
|
const itemCount = (displayItems === null || displayItems === void 0 ? void 0 : displayItems.length) || 0;
|
|
202
185
|
const height = viewPortDimensions.height
|
|
203
186
|
? viewPortDimensions.height
|
|
@@ -218,7 +201,7 @@ export const MenuItemList = ({ menuItems, searchable, onSearch, manualSearch, se
|
|
|
218
201
|
alignItems: "center",
|
|
219
202
|
height: "100%",
|
|
220
203
|
padding: "10px 0",
|
|
221
|
-
}, children: [_jsx("div", { style: { fontSize:
|
|
204
|
+
}, children: [_jsx("div", { style: { fontSize: `${sizeTokens.supportingFontSize}px` }, children: "Loading..." }), _jsx(Loader, {})] })), !isLoading && (_jsx(ListViewPort, { ref: targetElm, children: _jsx(FixedSizeList, { itemData: displayItems, overscanCount: overscanCount, height: height, width: width, itemCount: itemCount, itemSize: itemHeight, outerRef: listElm, children: ({ data, index, style }) => {
|
|
222
205
|
const item = data === null || data === void 0 ? void 0 : data[index];
|
|
223
206
|
if (!item)
|
|
224
207
|
return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
4
|
+
import { getControlSizeTokens } from "../core";
|
|
4
5
|
export const InfoComponent = styled(({ className, children, description, label }) => {
|
|
5
6
|
if (!description)
|
|
6
7
|
return children;
|
|
@@ -56,17 +57,8 @@ const FieldLabel = styled(({ className, children, error, description, size = "sm
|
|
|
56
57
|
margin-left: 8px;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
font-size: ${({ size = "sm" }) => size
|
|
60
|
-
|
|
61
|
-
: size === "sm"
|
|
62
|
-
? "12px"
|
|
63
|
-
: size === "md"
|
|
64
|
-
? "14px"
|
|
65
|
-
: size === "lg"
|
|
66
|
-
? "16px"
|
|
67
|
-
: size === "xl"
|
|
68
|
-
? "18px"
|
|
69
|
-
: "12px"};
|
|
60
|
+
font-size: ${({ size = "sm" }) => `${getControlSizeTokens(size).labelFontSize}px`};
|
|
61
|
+
line-height: 1.3;
|
|
70
62
|
|
|
71
63
|
transition: all 0.2s ease;
|
|
72
64
|
color: ${({ theme, error }) => theme.palette.text.secondary};
|
|
@@ -92,7 +84,7 @@ const FieldLabel = styled(({ className, children, error, description, size = "sm
|
|
|
92
84
|
transition: all 0.2s ease;
|
|
93
85
|
cursor: pointer;
|
|
94
86
|
color: ${({ theme }) => theme.palette.error.main};
|
|
95
|
-
font-size:
|
|
87
|
+
font-size: ${({ size = "sm" }) => `${getControlSizeTokens(size).supportingFontSize}px`};
|
|
96
88
|
max-width: 85%;
|
|
97
89
|
white-space: nowrap;
|
|
98
90
|
overflow: hidden;
|