@monolith-forensics/monolith-ui 1.8.1-dev.3 → 1.8.1
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/Charts/BarChart/BarChart.js +28 -14
- package/dist/Charts/BarChart/BarChart.styled.d.ts +7 -2
- package/dist/Charts/BarChart/BarChart.styled.js +5 -1
- package/dist/Charts/BarChart/BarChart.types.d.ts +13 -5
- package/dist/Charts/ChartUtils/chartSizing.d.ts +20 -0
- package/dist/Charts/ChartUtils/chartSizing.js +83 -0
- package/dist/Charts/ChartUtils/index.d.ts +1 -0
- package/dist/Charts/ChartUtils/index.js +1 -0
- package/dist/Charts/HeatMap/HeatMap.js +28 -7
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +6 -2
- package/dist/Charts/HeatMap/HeatMap.styled.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +7 -1
- package/dist/Charts/LineChart/LineChart.js +34 -15
- package/dist/Charts/LineChart/LineChart.styled.d.ts +7 -2
- package/dist/Charts/LineChart/LineChart.styled.js +5 -1
- package/dist/Charts/LineChart/LineChart.types.d.ts +13 -5
- package/dist/Charts/PieChart/PieChart.js +48 -33
- package/dist/Charts/PieChart/PieChart.styled.d.ts +7 -2
- package/dist/Charts/PieChart/PieChart.styled.js +6 -1
- package/dist/Charts/PieChart/PieChart.types.d.ts +7 -3
- 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 +4 -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 -1
- package/dist/QueryFilter/DefaultOperators.js +21 -1
- 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/types.d.ts +52 -1
- package/dist/QueryFilter/types.js +1 -1
- package/dist/QueryFilter/useQueryFilter.d.ts +1 -1
- package/dist/QueryFilter/useQueryFilter.js +19 -23
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +18 -0
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +6 -0
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +9 -0
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +42 -0
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +10 -0
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +60 -0
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +9 -0
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +30 -0
- package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +3 -0
- package/dist/RichTextEditor/Components/CodeBlockNodeView.js +28 -0
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +10 -0
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +17 -0
- package/dist/RichTextEditor/Components/LinkEditor.d.ts +8 -0
- package/dist/RichTextEditor/Components/LinkEditor.js +94 -0
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +19 -0
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +24 -0
- package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableRails.js +180 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +5 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +6 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +5 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +183 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +16 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +217 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +8 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +11 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +3 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +23 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +75 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.js +3 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +16 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +53 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +40 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +167 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +76 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +1 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +4 -0
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +4 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +2 -0
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +12 -0
- package/dist/RichTextEditor/Components/TableTools/index.d.ts +3 -0
- package/dist/RichTextEditor/Components/TableTools/index.js +2 -0
- package/dist/RichTextEditor/Enums/HighlightColors.d.ts +9 -0
- package/dist/RichTextEditor/Enums/HighlightColors.js +10 -0
- package/dist/RichTextEditor/Extensions/getTiptapExtensions.js +15 -5
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +4 -7
- 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 -302
- package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +20 -0
- package/dist/RichTextEditor/Utils/codeBlockUtils.js +137 -0
- package/dist/RichTextEditor/Utils/codeUtils.d.ts +3 -0
- package/dist/RichTextEditor/Utils/codeUtils.js +12 -0
- package/dist/RichTextEditor/Utils/linkUtils.d.ts +19 -0
- package/dist/RichTextEditor/Utils/linkUtils.js +57 -0
- package/dist/RichTextEditor/Utils/tableUtils.d.ts +1 -0
- package/dist/RichTextEditor/Utils/tableUtils.js +1 -0
- 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/types.d.ts +19 -70
- package/dist/TagBox/TagBox.d.ts +1 -1
- package/dist/TagBox/TagBox.js +80 -22
- package/dist/TagBox/types.d.ts +0 -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.js +9 -9
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -2
- package/dist/theme/variants.js +8 -2
- package/package.json +18 -26
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -41
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -363
- package/dist/DateTimeRangePicker/index.d.ts +0 -2
- package/dist/DateTimeRangePicker/index.js +0 -2
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StyledChartActions } from "../ChartPrimitives";
|
|
2
|
-
export declare const StyledContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").
|
|
3
|
-
|
|
2
|
+
export declare const StyledContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
$fillAvailableWidth: boolean;
|
|
4
|
+
}>> & string;
|
|
5
|
+
export declare const StyledChartWrap: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
|
+
$width?: string;
|
|
7
|
+
$height?: string;
|
|
8
|
+
}>> & string;
|
|
4
9
|
export { StyledChartActions };
|
|
5
10
|
export declare const StyledSvg: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGProps<SVGSVGElement>, never>> & string;
|
|
6
11
|
export declare const StyledSlice: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").SVGProps<SVGPathElement>, {
|
|
@@ -11,7 +11,7 @@ export const StyledContainer = styled.div `
|
|
|
11
11
|
align-items: center;
|
|
12
12
|
flex-wrap: wrap;
|
|
13
13
|
gap: 20px;
|
|
14
|
-
width: fit-content;
|
|
14
|
+
width: ${({ $fillAvailableWidth }) => $fillAvailableWidth ? "100%" : "fit-content"};
|
|
15
15
|
max-width: 100%;
|
|
16
16
|
color: ${({ theme }) => theme.palette.text.primary};
|
|
17
17
|
box-sizing: border-box;
|
|
@@ -24,6 +24,10 @@ export const StyledChartWrap = styled.div `
|
|
|
24
24
|
align-items: stretch;
|
|
25
25
|
justify-content: center;
|
|
26
26
|
flex: 0 0 auto;
|
|
27
|
+
width: ${({ $width }) => $width !== null && $width !== void 0 ? $width : "auto"};
|
|
28
|
+
height: ${({ $height }) => $height !== null && $height !== void 0 ? $height : "auto"};
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
box-sizing: border-box;
|
|
27
31
|
`;
|
|
28
32
|
export { StyledChartActions };
|
|
29
33
|
export const StyledSvg = styled.svg `
|
|
@@ -146,6 +150,7 @@ export const StyledEmptyState = styled.div `
|
|
|
146
150
|
justify-content: center;
|
|
147
151
|
width: ${({ $size }) => $size}px;
|
|
148
152
|
height: ${({ $size }) => $size}px;
|
|
153
|
+
box-sizing: border-box;
|
|
149
154
|
border: 1px dashed ${({ theme }) => theme.palette.divider};
|
|
150
155
|
border-radius: 50%;
|
|
151
156
|
background: radial-gradient(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
2
|
import { PieArcDatum } from "d3-shape";
|
|
3
|
-
import type { ChartExportOptions } from "../ChartUtils";
|
|
3
|
+
import type { ChartDimension, ChartExportOptions } from "../ChartUtils";
|
|
4
4
|
export type PieChartDatum<TData = unknown> = {
|
|
5
5
|
/** Stable identifier for the slice. Falls back to label and index when omitted. */
|
|
6
6
|
id?: string | number;
|
|
@@ -26,8 +26,12 @@ string[]
|
|
|
26
26
|
export type PieChartProps<TData = unknown> = HTMLAttributes<HTMLDivElement> & ChartExportOptions & {
|
|
27
27
|
/** Slice data rendered by the chart. Only positive finite values are displayed. */
|
|
28
28
|
data: PieChartDatum<TData>[];
|
|
29
|
-
/** SVG width and height in pixels. Defaults to 220. */
|
|
30
|
-
size?:
|
|
29
|
+
/** SVG width and height in pixels or any CSS length measured from the chart frame. Defaults to 220. */
|
|
30
|
+
size?: ChartDimension;
|
|
31
|
+
/** Measures the chart frame and fits the square SVG to its available width. Defaults to false. */
|
|
32
|
+
responsive?: boolean;
|
|
33
|
+
/** Minimum rendered SVG size in pixels. Defaults to 120. */
|
|
34
|
+
minSize?: number;
|
|
31
35
|
/** Inner radius in pixels. Set to 0 for a solid pie. Defaults to 58. */
|
|
32
36
|
innerRadius?: number;
|
|
33
37
|
/** Outer radius in pixels. Defaults to half the size minus chart padding. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { FaCheckSquare, FaRegSquare, FaRegMinusSquare } from "react-icons/fa";
|
|
5
5
|
const CheckBox = styled(({ className, defaultValue = false, value, partialCheck = false, onChange = () => { }, }) => {
|
|
6
6
|
const [checkedState, setCheckedState] = useState(defaultValue);
|
|
7
7
|
const handleChange = (e) => {
|
|
@@ -14,47 +14,30 @@ const CheckBox = styled(({ className, defaultValue = false, value, partialCheck
|
|
|
14
14
|
setCheckedState(value);
|
|
15
15
|
}, [value]);
|
|
16
16
|
const _checked = value === undefined ? checkedState : value;
|
|
17
|
-
return (_jsx("div", { className: className, onClick: handleChange, children: partialCheck === true ? (_jsx(
|
|
17
|
+
return (_jsx("div", { className: className, onClick: handleChange, children: partialCheck === true ? (_jsx(FaRegMinusSquare, { className: "checkbox partial" })) : _checked === true ? (_jsx(FaCheckSquare, { className: "checkbox checked" })) : (_jsx(FaRegSquare, { className: "checkbox unchecked" })) }));
|
|
18
18
|
}) `
|
|
19
19
|
display: flex;
|
|
20
20
|
align-items: center;
|
|
21
21
|
cursor: pointer;
|
|
22
22
|
|
|
23
23
|
.checkbox {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
content: "";
|
|
42
|
-
position: absolute;
|
|
43
|
-
left: 50%;
|
|
44
|
-
top: 45%;
|
|
45
|
-
width: 32%;
|
|
46
|
-
height: 56%;
|
|
47
|
-
border: solid #fff;
|
|
48
|
-
border-width: 0 2px 2px 0;
|
|
49
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
50
|
-
transform-origin: center;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.partial::after {
|
|
54
|
-
content: "";
|
|
55
|
-
width: 60%;
|
|
56
|
-
height: 2px;
|
|
57
|
-
background-color: #fff;
|
|
24
|
+
color: ${(props) => props.theme.palette.primary.main};
|
|
25
|
+
font-size: ${({ size }) => {
|
|
26
|
+
switch (size) {
|
|
27
|
+
case "xxs":
|
|
28
|
+
return "12px";
|
|
29
|
+
case "xs":
|
|
30
|
+
return "14px";
|
|
31
|
+
case "sm":
|
|
32
|
+
return "16px";
|
|
33
|
+
case "md":
|
|
34
|
+
return "18px";
|
|
35
|
+
case "lg":
|
|
36
|
+
return "20px";
|
|
37
|
+
default:
|
|
38
|
+
return "14px";
|
|
39
|
+
}
|
|
40
|
+
}};
|
|
58
41
|
}
|
|
59
42
|
`;
|
|
60
43
|
export default CheckBox;
|
|
@@ -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;
|