@monolith-forensics/monolith-ui 1.8.1-dev.4 → 1.9.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/Button/Button.js +58 -9
- package/dist/Calendar/Calendar.d.ts +2 -7
- package/dist/Calendar/Calendar.js +49 -226
- package/dist/Calendar/CalendarStyles.d.ts +2 -6
- package/dist/Calendar/CalendarStyles.js +33 -153
- package/dist/Calendar/calendarHelpers.d.ts +2 -6
- package/dist/Calendar/calendarHelpers.js +5 -13
- package/dist/CheckBox/CheckBox.js +19 -36
- package/dist/DateInput/DateInput.js +143 -198
- package/dist/DropDownMenu/DropDownMenu.js +15 -25
- package/dist/DropDownMenu/components/MenuComponent.js +2 -8
- package/dist/DropDownMenu/components/MenuItem.d.ts +0 -2
- package/dist/DropDownMenu/components/MenuItem.js +21 -25
- package/dist/DropDownMenu/components/MenuItemList.d.ts +0 -3
- package/dist/DropDownMenu/components/MenuItemList.js +86 -192
- package/dist/DropDownMenu/components/StyledContent.js +2 -1
- package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
- package/dist/DropDownMenu/types.d.ts +0 -3
- package/dist/FieldLabel/FieldLabel.js +12 -4
- package/dist/FileInputField/FileInputField.js +23 -4
- package/dist/FileViewer/viewers/ImageViewer.js +18 -75
- package/dist/FormSection/FormSection.js +25 -5
- package/dist/IconButton/IconButton.js +16 -2
- package/dist/Input/Input.js +56 -7
- package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +0 -1
- package/dist/Pill/Pill.js +79 -8
- package/dist/Popover/Popover.context.d.ts +1 -2
- package/dist/Popover/Popover.js +2 -5
- package/dist/Popover/Popover.styles.d.ts +6 -1
- package/dist/Popover/Popover.styles.js +28 -11
- package/dist/Popover/Popover.transitions.d.ts +2 -4
- package/dist/Popover/Popover.transitions.js +49 -23
- package/dist/Popover/PopoverDropdown.js +8 -6
- package/dist/Popover/PopoverTarget.js +3 -6
- package/dist/QueryFilter/DefaultOperators.d.ts +76 -0
- package/dist/QueryFilter/DefaultOperators.js +21 -0
- package/dist/QueryFilter/QueryFilter.d.ts +1 -1
- package/dist/QueryFilter/QueryFilter.js +303 -3
- package/dist/QueryFilter/index.d.ts +2 -3
- package/dist/QueryFilter/index.js +2 -3
- package/dist/QueryFilter/{QueryFilter.types.d.ts → types.d.ts} +2 -11
- package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
- package/dist/QueryFilter/useQueryFilter.js +19 -23
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.d.ts +0 -15
- package/dist/RichTextEditor/Plugins/UploadImagesPlugin.js +51 -115
- package/dist/RichTextEditor/Plugins/index.d.ts +0 -1
- package/dist/RichTextEditor/Plugins/index.js +0 -1
- package/dist/RichTextEditor/RichTextEditor.d.ts +2 -3
- package/dist/RichTextEditor/RichTextEditor.js +35 -309
- package/dist/RichTextEditor/Toolbar/Toolbar.js +2 -14
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControl.utils.js +30 -3
- package/dist/SelectBox/SelectBox.js +5 -5
- package/dist/SelectBox/select-box.styled-components.d.ts +1 -4
- package/dist/SelectBox/select-box.styled-components.js +48 -11
- package/dist/SelectBox/types.d.ts +0 -1
- package/dist/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +83 -18
- package/dist/Table/ColumnResizer.d.ts +9 -6
- package/dist/Table/ColumnResizer.js +10 -30
- package/dist/Table/StateStorage.d.ts +0 -4
- package/dist/Table/StateStorage.js +0 -13
- package/dist/Table/Table.js +12 -160
- package/dist/Table/TableComponents.d.ts +0 -10
- package/dist/Table/TableComponents.js +10 -71
- package/dist/Table/TableDefaults.d.ts +0 -7
- package/dist/Table/TableDefaults.js +0 -7
- package/dist/Table/TableHeader.js +16 -31
- package/dist/Table/TableMenu/TableMenu.js +1 -1
- package/dist/Table/TableProvider.js +75 -354
- package/dist/Table/TableRow.js +16 -28
- package/dist/Table/Utils/index.d.ts +1 -0
- package/dist/Table/Utils/index.js +1 -0
- package/dist/Table/Utils/resizeHandler.d.ts +3 -0
- package/dist/Table/Utils/resizeHandler.js +84 -0
- package/dist/Table/types.d.ts +19 -70
- package/dist/Tabs/Tab.js +0 -8
- package/dist/TagBox/TagBox.d.ts +1 -1
- package/dist/TagBox/TagBox.js +208 -50
- package/dist/TagBox/types.d.ts +13 -1
- package/dist/TextArea/TextArea.js +23 -9
- package/dist/TextInput/TextInput.js +6 -12
- package/dist/Utilities/parseTimestamp.js +6 -11
- package/dist/core/ArrowButton.d.ts +0 -2
- package/dist/core/ArrowButton.js +3 -7
- package/dist/core/ClearButton.d.ts +0 -2
- package/dist/core/ClearButton.js +3 -7
- package/dist/core/controlSizes.d.ts +0 -26
- package/dist/core/controlSizes.js +0 -156
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -2
- package/dist/theme/variants.js +0 -2
- package/package.json +18 -26
- package/dist/Charts/BarChart/BarChart.d.ts +0 -5
- package/dist/Charts/BarChart/BarChart.js +0 -549
- package/dist/Charts/BarChart/BarChart.lib.d.ts +0 -31
- package/dist/Charts/BarChart/BarChart.lib.js +0 -136
- package/dist/Charts/BarChart/BarChart.styled.d.ts +0 -51
- package/dist/Charts/BarChart/BarChart.styled.js +0 -115
- package/dist/Charts/BarChart/BarChart.types.d.ts +0 -171
- package/dist/Charts/BarChart/index.d.ts +0 -3
- package/dist/Charts/BarChart/index.js +0 -2
- package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +0 -11
- package/dist/Charts/ChartPrimitives/ChartExportControl.js +0 -29
- package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +0 -1
- package/dist/Charts/ChartPrimitives/chartActions.styled.js +0 -8
- package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +0 -12
- package/dist/Charts/ChartPrimitives/chartLegend.styled.js +0 -52
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +0 -19
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +0 -61
- package/dist/Charts/ChartPrimitives/index.d.ts +0 -4
- package/dist/Charts/ChartPrimitives/index.js +0 -4
- package/dist/Charts/ChartUtils/chartColors.d.ts +0 -8
- package/dist/Charts/ChartUtils/chartColors.js +0 -65
- package/dist/Charts/ChartUtils/chartExport.d.ts +0 -47
- package/dist/Charts/ChartUtils/chartExport.js +0 -311
- package/dist/Charts/ChartUtils/chartMath.d.ts +0 -3
- package/dist/Charts/ChartUtils/chartMath.js +0 -3
- package/dist/Charts/ChartUtils/index.d.ts +0 -3
- package/dist/Charts/ChartUtils/index.js +0 -3
- package/dist/Charts/HeatMap/HeatMap.d.ts +0 -5
- package/dist/Charts/HeatMap/HeatMap.js +0 -212
- package/dist/Charts/HeatMap/HeatMap.lib.d.ts +0 -30
- package/dist/Charts/HeatMap/HeatMap.lib.js +0 -115
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +0 -37
- package/dist/Charts/HeatMap/HeatMap.styled.js +0 -91
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +0 -80
- package/dist/Charts/HeatMap/HeatMap.types.js +0 -1
- package/dist/Charts/HeatMap/index.d.ts +0 -3
- package/dist/Charts/HeatMap/index.js +0 -2
- package/dist/Charts/LineChart/LineChart.d.ts +0 -5
- package/dist/Charts/LineChart/LineChart.js +0 -529
- package/dist/Charts/LineChart/LineChart.lib.d.ts +0 -24
- package/dist/Charts/LineChart/LineChart.lib.js +0 -132
- package/dist/Charts/LineChart/LineChart.styled.d.ts +0 -59
- package/dist/Charts/LineChart/LineChart.styled.js +0 -147
- package/dist/Charts/LineChart/LineChart.types.d.ts +0 -193
- package/dist/Charts/LineChart/LineChart.types.js +0 -1
- package/dist/Charts/LineChart/index.d.ts +0 -3
- package/dist/Charts/LineChart/index.js +0 -2
- package/dist/Charts/PieChart/PieChart.d.ts +0 -4
- package/dist/Charts/PieChart/PieChart.js +0 -199
- package/dist/Charts/PieChart/PieChart.lib.d.ts +0 -5
- package/dist/Charts/PieChart/PieChart.lib.js +0 -19
- package/dist/Charts/PieChart/PieChart.styled.d.ts +0 -51
- package/dist/Charts/PieChart/PieChart.styled.js +0 -163
- package/dist/Charts/PieChart/PieChart.types.d.ts +0 -100
- package/dist/Charts/PieChart/PieChart.types.js +0 -1
- package/dist/Charts/PieChart/index.d.ts +0 -2
- package/dist/Charts/PieChart/index.js +0 -1
- package/dist/Charts/index.d.ts +0 -5
- package/dist/Charts/index.js +0 -4
- package/dist/QueryFilter/QueryFilter.constants.d.ts +0 -134
- package/dist/QueryFilter/QueryFilter.constants.js +0 -39
- package/dist/QueryFilter/QueryFilter.lib.d.ts +0 -14
- package/dist/QueryFilter/QueryFilter.lib.js +0 -84
- package/dist/QueryFilter/QueryFilter.styled.d.ts +0 -89
- package/dist/QueryFilter/QueryFilter.styled.js +0 -184
- package/dist/QueryFilter/QueryFilter.types.js +0 -1
- package/dist/QueryFilter/components/MultiSelectEditor.d.ts +0 -7
- package/dist/QueryFilter/components/MultiSelectEditor.js +0 -44
- package/dist/QueryFilter/components/RuleChip.d.ts +0 -8
- package/dist/QueryFilter/components/RuleChip.js +0 -37
- package/dist/QueryFilter/components/Rules.d.ts +0 -11
- package/dist/QueryFilter/components/Rules.js +0 -41
- package/dist/QueryFilter/components/UnavailableRuleChip.d.ts +0 -5
- package/dist/QueryFilter/components/UnavailableRuleChip.js +0 -7
- package/dist/QueryFilter/components/ValueEditor.d.ts +0 -7
- package/dist/QueryFilter/components/ValueEditor.js +0 -45
- package/dist/QueryFilter/components/ValueSelector.d.ts +0 -7
- package/dist/QueryFilter/components/ValueSelector.js +0 -34
- package/dist/QueryFilter/components/index.d.ts +0 -6
- package/dist/QueryFilter/components/index.js +0 -6
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.d.ts +0 -3
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +0 -241
- package/dist/SuperDatePicker/SuperDatePicker.constants.d.ts +0 -24
- package/dist/SuperDatePicker/SuperDatePicker.constants.js +0 -30
- package/dist/SuperDatePicker/SuperDatePicker.d.ts +0 -3
- package/dist/SuperDatePicker/SuperDatePicker.js +0 -31
- package/dist/SuperDatePicker/SuperDatePicker.lib.d.ts +0 -17
- package/dist/SuperDatePicker/SuperDatePicker.lib.js +0 -206
- package/dist/SuperDatePicker/SuperDatePicker.styled.d.ts +0 -60
- package/dist/SuperDatePicker/SuperDatePicker.styled.js +0 -256
- package/dist/SuperDatePicker/SuperDatePicker.types.d.ts +0 -48
- package/dist/SuperDatePicker/SuperDatePicker.types.js +0 -1
- package/dist/SuperDatePicker/components/CommonPresetGroups.d.ts +0 -7
- package/dist/SuperDatePicker/components/CommonPresetGroups.js +0 -6
- package/dist/SuperDatePicker/components/EndpointCalendarDropdown.d.ts +0 -10
- package/dist/SuperDatePicker/components/EndpointCalendarDropdown.js +0 -9
- package/dist/SuperDatePicker/components/EndpointDateInput.d.ts +0 -16
- package/dist/SuperDatePicker/components/EndpointDateInput.js +0 -26
- package/dist/SuperDatePicker/components/EndpointPopover.d.ts +0 -18
- package/dist/SuperDatePicker/components/EndpointPopover.js +0 -11
- package/dist/SuperDatePicker/components/QuickRangeDropdown.d.ts +0 -14
- package/dist/SuperDatePicker/components/QuickRangeDropdown.js +0 -19
- package/dist/SuperDatePicker/components/QuickRangePopover.d.ts +0 -18
- package/dist/SuperDatePicker/components/QuickRangePopover.js +0 -12
- package/dist/SuperDatePicker/components/index.d.ts +0 -6
- package/dist/SuperDatePicker/components/index.js +0 -6
- package/dist/SuperDatePicker/index.d.ts +0 -3
- package/dist/SuperDatePicker/index.js +0 -3
- package/dist/SuperDatePicker/useSuperDatePicker.d.ts +0 -32
- package/dist/SuperDatePicker/useSuperDatePicker.js +0 -125
- /package/dist/{Charts/BarChart/BarChart.types.js → QueryFilter/types.js} +0 -0
|
@@ -10,11 +10,10 @@ 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 {
|
|
14
|
-
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
13
|
+
import { forwardRef, useEffect, useMemo, useRef, useState, } from "react";
|
|
15
14
|
import styled from "styled-components";
|
|
16
15
|
import { FieldLabel, Calendar } from "..";
|
|
17
|
-
import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton,
|
|
16
|
+
import { StyledContent, StyledFloatContainer, ArrowButton, ClearButton, } from "../core";
|
|
18
17
|
import parseTimestamp from "../Utilities/parseTimestamp";
|
|
19
18
|
const StyledContainer = styled.div.attrs({
|
|
20
19
|
className: "mfui-DateInput",
|
|
@@ -54,19 +53,45 @@ const StyledInputContainer = styled.div `
|
|
|
54
53
|
font-family: ${({ theme }) => theme.typography.fontFamily};
|
|
55
54
|
|
|
56
55
|
color: ${(props) => props.theme.palette.text.primary};
|
|
57
|
-
font-size: ${({ size }) =>
|
|
56
|
+
font-size: ${({ size }) => size === "xs"
|
|
57
|
+
? "11px"
|
|
58
|
+
: size === "sm"
|
|
59
|
+
? "13px"
|
|
60
|
+
: size === "md"
|
|
61
|
+
? "15px"
|
|
62
|
+
: size === "lg"
|
|
63
|
+
? "17px"
|
|
64
|
+
: size === "xl"
|
|
65
|
+
? "19px"
|
|
66
|
+
: "11px"};
|
|
58
67
|
|
|
59
68
|
width: 100%;
|
|
60
|
-
height: ${({ size }) =>
|
|
69
|
+
height: ${({ size }) => size === "xs"
|
|
70
|
+
? "26px"
|
|
71
|
+
: size === "sm"
|
|
72
|
+
? "30px"
|
|
73
|
+
: size === "md"
|
|
74
|
+
? "36px"
|
|
75
|
+
: size === "lg"
|
|
76
|
+
? "42px"
|
|
77
|
+
: size === "xl"
|
|
78
|
+
? "50px"
|
|
79
|
+
: "26px"};
|
|
61
80
|
|
|
62
|
-
padding: ${({ size }) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
padding: ${({ size }) => size === "xs"
|
|
82
|
+
? "0px 8px"
|
|
83
|
+
: size === "sm"
|
|
84
|
+
? "0px 10px"
|
|
85
|
+
: size === "md"
|
|
86
|
+
? "0px 12px"
|
|
87
|
+
: size === "lg"
|
|
88
|
+
? "0px 14px"
|
|
89
|
+
: size === "xl"
|
|
90
|
+
? "0px 16px"
|
|
91
|
+
: "0px 8px"};
|
|
67
92
|
|
|
68
93
|
&[data-button-right="true"] {
|
|
69
|
-
padding-right:
|
|
94
|
+
padding-right: 36px;
|
|
70
95
|
}
|
|
71
96
|
|
|
72
97
|
background-color: ${({ theme, variant }) => {
|
|
@@ -126,44 +151,6 @@ const StyledInputContainer = styled.div `
|
|
|
126
151
|
}
|
|
127
152
|
}
|
|
128
153
|
`;
|
|
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
|
-
`;
|
|
167
154
|
const InputSegment = styled.div `
|
|
168
155
|
user-select: none;
|
|
169
156
|
display: flex;
|
|
@@ -174,7 +161,17 @@ const InputSegment = styled.div `
|
|
|
174
161
|
border: none;
|
|
175
162
|
padding: 0;
|
|
176
163
|
|
|
177
|
-
height: ${({ size }) =>
|
|
164
|
+
height: ${({ size }) => size === "xs"
|
|
165
|
+
? "22px"
|
|
166
|
+
: size === "sm"
|
|
167
|
+
? "26px"
|
|
168
|
+
: size === "md"
|
|
169
|
+
? "32px"
|
|
170
|
+
: size === "lg"
|
|
171
|
+
? "38px"
|
|
172
|
+
: size === "xl"
|
|
173
|
+
? "46px"
|
|
174
|
+
: "22px"};
|
|
178
175
|
|
|
179
176
|
height: 100%;
|
|
180
177
|
|
|
@@ -182,7 +179,17 @@ const InputSegment = styled.div `
|
|
|
182
179
|
color: ${(props) => props.theme.palette.text.primary};
|
|
183
180
|
|
|
184
181
|
::placeholder {
|
|
185
|
-
font-size: ${({ size }) =>
|
|
182
|
+
font-size: ${({ size }) => size === "xs"
|
|
183
|
+
? "10px"
|
|
184
|
+
: size === "sm"
|
|
185
|
+
? "12px"
|
|
186
|
+
: size === "md"
|
|
187
|
+
? "14px"
|
|
188
|
+
: size === "lg"
|
|
189
|
+
? "16px"
|
|
190
|
+
: size === "xl"
|
|
191
|
+
? "18px"
|
|
192
|
+
: "10px"};
|
|
186
193
|
}
|
|
187
194
|
`;
|
|
188
195
|
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) => {
|
|
@@ -205,83 +212,23 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
205
212
|
middleware: [flip(), offset(5)],
|
|
206
213
|
whileElementsMounted: autoUpdate,
|
|
207
214
|
});
|
|
208
|
-
const dismiss = useDismiss(context
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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) => {
|
|
215
|
+
const dismiss = useDismiss(context);
|
|
216
|
+
const { getReferenceProps } = useInteractions([dismiss]);
|
|
217
|
+
const segments = useMemo(() => parseTimestamp(moment(_value).toISOString(), format, utc), [_value, format, utc]);
|
|
218
|
+
const checkValidRange = (value) => {
|
|
243
219
|
if (!value)
|
|
244
220
|
return false;
|
|
245
|
-
|
|
246
|
-
if (!parsed)
|
|
247
|
-
return false;
|
|
248
|
-
if (min && parsed.isBefore(min))
|
|
221
|
+
if (min && moment(value).isBefore(min))
|
|
249
222
|
return false;
|
|
250
|
-
if (max &&
|
|
223
|
+
if (max && moment(value).isAfter(max))
|
|
251
224
|
return false;
|
|
252
225
|
return true;
|
|
253
|
-
}
|
|
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
|
-
]);
|
|
226
|
+
};
|
|
281
227
|
const handleClear = (e) => {
|
|
282
228
|
e.preventDefault();
|
|
283
229
|
e.stopPropagation();
|
|
284
|
-
|
|
230
|
+
setUncontrolledValue(null);
|
|
231
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
285
232
|
setIsOpen(false);
|
|
286
233
|
};
|
|
287
234
|
const handleSegmentClick = (e, segment) => {
|
|
@@ -309,18 +256,6 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
309
256
|
setIsOpen(true);
|
|
310
257
|
setSelectedSegment(segments[0]);
|
|
311
258
|
};
|
|
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
|
-
};
|
|
324
259
|
const nextSegment = () => {
|
|
325
260
|
setSelectedSegment((prev) => {
|
|
326
261
|
if (!prev)
|
|
@@ -367,18 +302,34 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
367
302
|
// Up Arrow
|
|
368
303
|
if (e.key === "ArrowUp") {
|
|
369
304
|
e.preventDefault();
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
305
|
+
if (selectedSegment.type !== "separator") {
|
|
306
|
+
let newValue = _value
|
|
307
|
+
? moment(_value).add(1, selectedSegment.type).toISOString()
|
|
308
|
+
: moment().toISOString();
|
|
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
|
+
}
|
|
374
317
|
}
|
|
375
318
|
// Down Arrow
|
|
376
319
|
if (e.key === "ArrowDown") {
|
|
377
320
|
e.preventDefault();
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
321
|
+
if (selectedSegment.type !== "separator") {
|
|
322
|
+
let newValue = _value
|
|
323
|
+
? moment(_value).subtract(1, selectedSegment.type).toISOString()
|
|
324
|
+
: moment().toISOString();
|
|
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
|
+
}
|
|
382
333
|
}
|
|
383
334
|
// handle paste
|
|
384
335
|
if (e.key === "v" && (e.metaKey || e.ctrlKey)) {
|
|
@@ -397,7 +348,10 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
397
348
|
setUncontrolledValue((prev) => {
|
|
398
349
|
if (!(selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.momentType))
|
|
399
350
|
return prev;
|
|
400
|
-
|
|
351
|
+
// if prev is null, use undefined - passing null to moment returns a null moment value
|
|
352
|
+
const momentValue = utc
|
|
353
|
+
? moment.utc(prev || undefined)
|
|
354
|
+
: moment(prev || undefined);
|
|
401
355
|
let newValue = moment(momentValue)
|
|
402
356
|
.set(selectedSegment.momentType, parseInt(tempValue, 10) -
|
|
403
357
|
(selectedSegment.type === "month" ? 1 : 0))
|
|
@@ -405,13 +359,7 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
405
359
|
if (!checkValidRange(newValue))
|
|
406
360
|
return prev;
|
|
407
361
|
if (isDateOnly) {
|
|
408
|
-
newValue =
|
|
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;
|
|
362
|
+
newValue = moment(newValue).format("YYYY-MM-DD");
|
|
415
363
|
}
|
|
416
364
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
417
365
|
return newValue;
|
|
@@ -426,65 +374,66 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
426
374
|
if (!selectedSegment) {
|
|
427
375
|
return;
|
|
428
376
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
377
|
+
if (selectedSegment.type !== "separator") {
|
|
378
|
+
let newValue = e.deltaY > 0
|
|
379
|
+
? moment(_value).subtract(1, selectedSegment.type).toISOString()
|
|
380
|
+
: moment(_value).add(1, selectedSegment.type).toISOString();
|
|
381
|
+
if (!checkValidRange(newValue))
|
|
382
|
+
return;
|
|
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
|
+
}
|
|
435
389
|
};
|
|
436
390
|
const handlePaste = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
437
391
|
const pastedText = yield window.navigator.clipboard.readText();
|
|
438
|
-
let
|
|
392
|
+
let parsedTimestamp = null;
|
|
439
393
|
if (!pastedText)
|
|
440
394
|
return; // do nothing if clipboard is empty
|
|
441
395
|
// check for unix timestamp in seconds
|
|
442
396
|
else if (pastedText.match(/^\d{10}$/)) {
|
|
443
|
-
|
|
397
|
+
parsedTimestamp = moment.unix(parseInt(pastedText, 10)).toISOString();
|
|
444
398
|
}
|
|
445
399
|
// check for unix timestamp in seconds with fractional seconds
|
|
446
400
|
else if (pastedText.match(/^\d{10}\.\d{1,6}$/)) {
|
|
447
|
-
|
|
401
|
+
parsedTimestamp = moment.unix(parseFloat(pastedText)).toISOString();
|
|
448
402
|
}
|
|
449
403
|
// check for unix timestamp in milliseconds
|
|
450
404
|
else if (pastedText.match(/^\d{13}$/)) {
|
|
451
|
-
|
|
405
|
+
parsedTimestamp = moment
|
|
406
|
+
.unix(parseInt(pastedText, 10) / 1000)
|
|
407
|
+
.toISOString();
|
|
452
408
|
}
|
|
453
409
|
// check for windows ldap or filetime timestamp
|
|
454
410
|
else if (pastedText.match(/^\d{18}$/)) {
|
|
455
|
-
|
|
411
|
+
parsedTimestamp = moment
|
|
412
|
+
.unix((parseInt(pastedText, 10) - 116444736000000000) / 10000000)
|
|
413
|
+
.toISOString();
|
|
456
414
|
}
|
|
457
415
|
// check for YMD ldap timestamp in format YYYYMMDDHHMMSSZ
|
|
458
416
|
else if (pastedText.match(/^\d{14}Z$/)) {
|
|
459
|
-
|
|
417
|
+
parsedTimestamp = moment
|
|
418
|
+
.utc(pastedText, "YYYYMMDDHHmmssZ")
|
|
419
|
+
.toISOString();
|
|
460
420
|
}
|
|
461
421
|
// check if pasted text is any other valid timestamp
|
|
462
422
|
else if (!moment(pastedText).isValid())
|
|
463
423
|
return;
|
|
464
424
|
else {
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
if (!(parsedMoment === null || parsedMoment === void 0 ? void 0 : parsedMoment.isValid()))
|
|
468
|
-
return;
|
|
469
|
-
if (utc) {
|
|
470
|
-
parsedMoment = parsedMoment.clone().utc();
|
|
425
|
+
parsedTimestamp = moment.utc(pastedText).toISOString();
|
|
471
426
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
return;
|
|
475
|
-
commitValue(parsedTimestamp);
|
|
427
|
+
setUncontrolledValue(parsedTimestamp);
|
|
428
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(parsedTimestamp);
|
|
476
429
|
});
|
|
477
430
|
// Close on outside click
|
|
478
431
|
useEffect(() => {
|
|
479
432
|
const close = (e) => {
|
|
480
|
-
var _a, _b
|
|
433
|
+
var _a, _b;
|
|
481
434
|
const target = e.target;
|
|
482
435
|
const referenceElement = (_a = refs === null || refs === void 0 ? void 0 : refs.reference) === null || _a === void 0 ? void 0 : _a.current;
|
|
483
436
|
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
|
-
}
|
|
488
437
|
if (floatingElement && // Check if the floating element exists
|
|
489
438
|
e.target !== referenceElement && // Check if the target is not the reference (input)
|
|
490
439
|
!referenceElement.contains(target) && // Check if the target is not inside the reference (input)
|
|
@@ -497,18 +446,18 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
497
446
|
document.addEventListener("click", close);
|
|
498
447
|
return () => document.removeEventListener("click", close);
|
|
499
448
|
}, [refs.floating]);
|
|
500
|
-
return (_jsxs(StyledContainer,
|
|
449
|
+
return (_jsxs(StyledContainer, { ref: (ref) => {
|
|
501
450
|
if (typeof _ref === "function") {
|
|
502
451
|
_ref(ref);
|
|
503
452
|
}
|
|
504
453
|
mainRef.current = ref;
|
|
505
454
|
refs.setReference(ref);
|
|
506
|
-
}, onWheel: (e) => handleWheelEvent(e), className: className
|
|
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) => {
|
|
507
456
|
e.preventDefault();
|
|
508
457
|
setSelectedSegment(segments[0]);
|
|
509
458
|
}, onBlur: () => {
|
|
510
459
|
setSelectedSegment(null);
|
|
511
|
-
}, "data-empty": !_value, "data-disabled": disabled, role: "textbox", size: size, variant: variant, "data-button-
|
|
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) => {
|
|
512
461
|
if (segment.type === "separator") {
|
|
513
462
|
return (_jsx("div", { className: "separator", tabIndex: -1, onClick: (e) => {
|
|
514
463
|
e.preventDefault();
|
|
@@ -516,25 +465,21 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
|
|
|
516
465
|
}, 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));
|
|
517
466
|
}
|
|
518
467
|
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));
|
|
519
|
-
}), utc && _jsx("div", { style: { marginLeft: 5 }, children: "UTC" }), clearable && _value ? (_jsx(ClearButton, {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
: closeOnSelect
|
|
536
|
-
? false
|
|
537
|
-
: true);
|
|
538
|
-
}, includeTime: false }, 1) }) }) })) }))] })));
|
|
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 }, getReferenceProps(), { children: _jsx(StyledContent, { maxDropdownHeight: "fit-content", children: _jsx("div", { children: _jsx(Calendar, { value: _value ? moment(_value).toDate() : undefined, clearable: false, min: min, max: max, onChange: (date) => {
|
|
469
|
+
setUncontrolledValue((prev) => {
|
|
470
|
+
// make copy of prev variable
|
|
471
|
+
const oldValue = moment(prev).toISOString();
|
|
472
|
+
const result = `${moment(date).format("YYYY-MM-DD")}T${moment(prev || undefined).format("HH:mm:ss")}`;
|
|
473
|
+
let isoResult = moment(result).toISOString();
|
|
474
|
+
if (!checkValidRange(result))
|
|
475
|
+
return oldValue;
|
|
476
|
+
if (isDateOnly) {
|
|
477
|
+
isoResult = moment(result).format("YYYY-MM-DD");
|
|
478
|
+
}
|
|
479
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(isoResult);
|
|
480
|
+
setIsOpen(closeOnSelect ? false : true);
|
|
481
|
+
return isoResult;
|
|
482
|
+
});
|
|
483
|
+
}, includeTime: false }, 1) }) }) })) }))] }));
|
|
539
484
|
});
|
|
540
485
|
export default DateInput;
|
|
@@ -1,39 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { Menu, MenuItemList, StyledInnerItemContainer } from "./components";
|
|
4
|
-
export const DropDownMenu = ({ data, children, defaultValue,
|
|
4
|
+
export const DropDownMenu = ({ data, children, defaultValue, variant, arrow, size, searchable, grouped, onAddNew, loading, onScroll, onScrollToTop, onScrollToBottom, onSearch, manualSearch, multiselect, renderOption, onItemSelect, onChange, buttonProps, TooltipContent, dropDownProps, query, disabled, }) => {
|
|
5
5
|
var _a;
|
|
6
6
|
const isObjectArray = (_a = Object.keys((data === null || data === void 0 ? void 0 : data[0]) || {})) === null || _a === void 0 ? void 0 : _a.includes("label");
|
|
7
|
-
const [
|
|
8
|
-
const isControlled = value !== undefined;
|
|
9
|
-
const selected = isControlled ? value || [] : internalSelected;
|
|
10
|
-
const updateSelected = (newSelected, diff) => {
|
|
11
|
-
if (!isControlled) {
|
|
12
|
-
setInternalSelected(newSelected);
|
|
13
|
-
}
|
|
14
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
15
|
-
};
|
|
16
|
-
const isSameItem = (a, b) => isObjectArray ? (a === null || a === void 0 ? void 0 : a.value) === (b === null || b === void 0 ? void 0 : b.value) : a === b;
|
|
7
|
+
const [selected, setSelected] = useState(defaultValue || []);
|
|
17
8
|
const handleAddItem = (item) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
: [...selected, item];
|
|
25
|
-
updateSelected(nextSelected, [item]);
|
|
9
|
+
setSelected((prev) => {
|
|
10
|
+
let newSelected = [...prev, item];
|
|
11
|
+
const diff = [item];
|
|
12
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
13
|
+
return newSelected;
|
|
14
|
+
});
|
|
26
15
|
};
|
|
27
16
|
const handleRemoveItem = (item) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
setSelected((prev) => {
|
|
18
|
+
let newSelected = prev.filter((i) => isObjectArray ? (i === null || i === void 0 ? void 0 : i.value) !== (item === null || item === void 0 ? void 0 : item.value) : i !== item);
|
|
19
|
+
const diff = [item];
|
|
20
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newSelected, diff);
|
|
21
|
+
return newSelected;
|
|
22
|
+
});
|
|
33
23
|
};
|
|
34
24
|
const handleMenuClose = () => { };
|
|
35
25
|
const handleScrollToBottom = (e) => {
|
|
36
26
|
onScrollToBottom === null || onScrollToBottom === void 0 ? void 0 : onScrollToBottom(e);
|
|
37
27
|
};
|
|
38
|
-
return (_jsx(Menu, { label: children, disabled: disabled, arrow: arrow, buttonSize: size, variant: variant, multiselect: multiselect, buttonProps: buttonProps, onMenuClose: handleMenuClose, dropDownProps: dropDownProps, children: _jsxs(StyledInnerItemContainer, { children: [loading && _jsx("div", { children: "Loading..." }), !loading && (_jsx(MenuItemList, { menuItems: data, searchable: searchable, grouped: grouped, onAddNew: onAddNew, onSearch: onSearch, manualSearch: manualSearch,
|
|
28
|
+
return (_jsx(Menu, { label: children, disabled: disabled, arrow: arrow, buttonSize: size, variant: variant, multiselect: multiselect, buttonProps: buttonProps, onMenuClose: handleMenuClose, dropDownProps: dropDownProps, children: _jsxs(StyledInnerItemContainer, { children: [loading && _jsx("div", { children: "Loading..." }), !loading && (_jsx(MenuItemList, { menuItems: data, searchable: searchable, grouped: grouped, onAddNew: onAddNew, onSearch: onSearch, manualSearch: manualSearch, selected: selected, TooltipContent: TooltipContent, multiselect: multiselect, size: size, handleAddItem: handleAddItem, handleRemoveItem: handleRemoveItem, onItemSelect: onItemSelect, renderOption: renderOption, onScroll: onScroll, onScrollToTop: onScrollToTop, onScrollToBottom: handleScrollToBottom, query: query }))] }) }));
|
|
39
29
|
};
|
|
@@ -11,9 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { forwardRef, useContext, useEffect, useRef, useState } from "react";
|
|
14
|
-
import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, offset, safePolygon, shift,
|
|
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";
|
|
17
16
|
import { MenuContext } from "./MenuContext";
|
|
18
17
|
import { StyledFloatContainer } from "./StyledFloatContainer";
|
|
19
18
|
import { StyledContent } from "./StyledContent";
|
|
@@ -43,11 +42,6 @@ export const MenuComponent = forwardRef((_a, forwardedRef) => {
|
|
|
43
42
|
}),
|
|
44
43
|
flip(),
|
|
45
44
|
shift(),
|
|
46
|
-
floatingSize({
|
|
47
|
-
apply({ rects, elements }) {
|
|
48
|
-
elements.floating.style.setProperty("--mfui-dropdown-reference-width", `${rects.reference.width}px`);
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
45
|
],
|
|
52
46
|
whileElementsMounted: autoUpdate,
|
|
53
47
|
});
|
|
@@ -113,7 +107,7 @@ export const MenuComponent = forwardRef((_a, forwardedRef) => {
|
|
|
113
107
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
114
108
|
setHasFocusInside(false);
|
|
115
109
|
parent.setHasFocusInside(true);
|
|
116
|
-
} }))), { rightSection: arrow ? (_jsx(ChevronDownIcon, { size:
|
|
110
|
+
} }))), { rightSection: arrow ? (_jsx(ChevronDownIcon, { size: 12 })) : isNested ? (_jsx(ChevronRightIcon, { size: 12 })) : null, size: buttonSize, variant: variant, selected: isOpen, nested: isNested }, buttonProps, { children: label })), _jsx(MenuContext.Provider, { value: {
|
|
117
111
|
activeIndex,
|
|
118
112
|
setActiveIndex,
|
|
119
113
|
getItemProps,
|
|
@@ -19,7 +19,6 @@ export declare const MenuItem: import("styled-components/dist/types").IStyledCom
|
|
|
19
19
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
20
|
} & {
|
|
21
21
|
multiselect?: boolean;
|
|
22
|
-
$dynamicHeight?: boolean;
|
|
23
22
|
}, "ref"> & import("react").RefAttributes<unknown>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<MenuProps & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
24
23
|
ref?: RefObject<HTMLButtonElement>;
|
|
25
24
|
children?: import("react").ReactNode | string;
|
|
@@ -39,5 +38,4 @@ export declare const MenuItem: import("styled-components/dist/types").IStyledCom
|
|
|
39
38
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
40
39
|
} & {
|
|
41
40
|
multiselect?: boolean;
|
|
42
|
-
$dynamicHeight?: boolean;
|
|
43
41
|
}, "ref"> & import("react").RefAttributes<unknown>>, keyof import("react").Component<any, {}, any>>;
|