@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
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { SuperDatePickerProps } from "../SuperDatePicker.types";
|
|
2
|
-
type EndpointPopoverProps = {
|
|
3
|
-
opened: boolean;
|
|
4
|
-
disabled: boolean;
|
|
5
|
-
label: string;
|
|
6
|
-
value?: string | null;
|
|
7
|
-
onOpenChange: (opened: boolean) => void;
|
|
8
|
-
onInputChange: (value?: string | null) => void;
|
|
9
|
-
onCalendarChange: (date: Date | null) => void;
|
|
10
|
-
format: NonNullable<SuperDatePickerProps["format"]>;
|
|
11
|
-
size: NonNullable<SuperDatePickerProps["size"]>;
|
|
12
|
-
utc: boolean;
|
|
13
|
-
min?: Date;
|
|
14
|
-
max?: Date;
|
|
15
|
-
timeIntervalMinutes?: number;
|
|
16
|
-
};
|
|
17
|
-
declare const EndpointPopover: ({ opened, disabled, label, value, onOpenChange, onInputChange, onCalendarChange, format, size, utc, min, max, timeIntervalMinutes, }: EndpointPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export default EndpointPopover;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Popover } from "../../Popover";
|
|
3
|
-
import EndpointCalendarDropdown from "./EndpointCalendarDropdown";
|
|
4
|
-
import EndpointDateInput from "./EndpointDateInput";
|
|
5
|
-
const EndpointPopover = ({ opened, disabled, label, value, onOpenChange, onInputChange, onCalendarChange, format, size, utc, min, max, timeIntervalMinutes, }) => {
|
|
6
|
-
return (_jsxs(Popover, { opened: opened, onChange: (nextOpened) => onOpenChange(!disabled && nextOpened), position: "bottom-start", offset: 5, withinPortal: true, children: [_jsx(Popover.Target, { children: _jsx(EndpointDateInput, { active: opened, ariaLabel: label, value: value, onChange: onInputChange, onOpen: () => onOpenChange(true), format: format, size: size, disabled: disabled, utc: utc, min: min, max: max }) }), _jsx(Popover.Dropdown, { style: {
|
|
7
|
-
border: "none",
|
|
8
|
-
padding: 0,
|
|
9
|
-
}, children: _jsx(EndpointCalendarDropdown, { value: value, onChange: onCalendarChange, min: min, max: max, timeIntervalMinutes: timeIntervalMinutes, utc: utc }) })] }));
|
|
10
|
-
};
|
|
11
|
-
export default EndpointPopover;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CommonRangeGroupConfig, QuickDirection, QuickUnit, SuperDatePickerPreset } from "../SuperDatePicker.types";
|
|
2
|
-
type QuickRangeDropdownProps = {
|
|
3
|
-
commonRangeGroups: CommonRangeGroupConfig[];
|
|
4
|
-
quickDirection: QuickDirection;
|
|
5
|
-
quickAmount: string;
|
|
6
|
-
quickUnit: QuickUnit;
|
|
7
|
-
onQuickDirectionChange: (direction: QuickDirection) => void;
|
|
8
|
-
onQuickAmountChange: (amount: string) => void;
|
|
9
|
-
onQuickAmountSubmit: () => void;
|
|
10
|
-
onQuickUnitChange: (unit: QuickUnit) => void;
|
|
11
|
-
onPresetClick: (preset: SuperDatePickerPreset) => void;
|
|
12
|
-
};
|
|
13
|
-
declare const QuickRangeDropdown: ({ commonRangeGroups, quickDirection, quickAmount, quickUnit, onQuickDirectionChange, onQuickAmountChange, onQuickAmountSubmit, onQuickUnitChange, onPresetClick, }: QuickRangeDropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export default QuickRangeDropdown;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SelectBox } from "../../SelectBox";
|
|
3
|
-
import { TextInput } from "../../TextInput";
|
|
4
|
-
import { StyledContent } from "../../core";
|
|
5
|
-
import { QUICK_DIRECTION_OPTIONS, QUICK_UNITS, } from "../SuperDatePicker.constants";
|
|
6
|
-
import { CommonRangesSection, PanelTitle, QuickRangePanel, QuickRangeSection, QuickSelectRow, } from "../SuperDatePicker.styled";
|
|
7
|
-
import CommonPresetGroups from "./CommonPresetGroups";
|
|
8
|
-
const QuickRangeDropdown = ({ commonRangeGroups, quickDirection, quickAmount, quickUnit, onQuickDirectionChange, onQuickAmountChange, onQuickAmountSubmit, onQuickUnitChange, onPresetClick, }) => {
|
|
9
|
-
const handleAmountKeyDown = (event) => {
|
|
10
|
-
if (event.key === "Enter") {
|
|
11
|
-
onQuickAmountSubmit();
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const handleAmountChange = (event) => {
|
|
15
|
-
onQuickAmountChange(event.target.value);
|
|
16
|
-
};
|
|
17
|
-
return (_jsx(StyledContent, { maxDropdownHeight: "fit-content", children: _jsxs(QuickRangePanel, { children: [_jsxs(QuickRangeSection, { children: [_jsx(PanelTitle, { children: "Quick select" }), _jsxs(QuickSelectRow, { children: [_jsx(SelectBox, { data: QUICK_DIRECTION_OPTIONS, value: quickDirection, onChange: (value) => onQuickDirectionChange(value), size: "xs", variant: "outlined", width: "100%", openOnFocus: false, arrow: true }), _jsx(TextInput, { type: "number", min: 1, value: quickAmount, onChange: handleAmountChange, onKeyDown: handleAmountKeyDown, size: "xs", variant: "outlined" }), _jsx(SelectBox, { data: QUICK_UNITS, value: quickUnit, onChange: (value) => onQuickUnitChange(value), size: "xs", variant: "outlined", width: "100%", openOnFocus: false, arrow: true })] })] }), _jsxs(CommonRangesSection, { children: [_jsx(PanelTitle, { children: "Presets" }), _jsx(CommonPresetGroups, { groups: commonRangeGroups, onPresetClick: onPresetClick })] })] }) }));
|
|
18
|
-
};
|
|
19
|
-
export default QuickRangeDropdown;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CommonRangeGroupConfig, QuickDirection, QuickUnit, SuperDatePickerPreset, SuperDatePickerProps } from "../SuperDatePicker.types";
|
|
2
|
-
type QuickRangePopoverProps = {
|
|
3
|
-
opened: boolean;
|
|
4
|
-
disabled: boolean;
|
|
5
|
-
size: NonNullable<SuperDatePickerProps["size"]>;
|
|
6
|
-
commonRangeGroups: CommonRangeGroupConfig[];
|
|
7
|
-
quickDirection: QuickDirection;
|
|
8
|
-
quickAmount: string;
|
|
9
|
-
quickUnit: QuickUnit;
|
|
10
|
-
onOpenChange: (opened: boolean) => void;
|
|
11
|
-
onQuickDirectionChange: (direction: QuickDirection) => void;
|
|
12
|
-
onQuickAmountChange: (amount: string) => void;
|
|
13
|
-
onQuickAmountSubmit: () => void;
|
|
14
|
-
onQuickUnitChange: (unit: QuickUnit) => void;
|
|
15
|
-
onPresetClick: (preset: SuperDatePickerPreset) => void;
|
|
16
|
-
};
|
|
17
|
-
declare const QuickRangePopover: ({ opened, disabled, size, commonRangeGroups, quickDirection, quickAmount, quickUnit, onOpenChange, onQuickDirectionChange, onQuickAmountChange, onQuickAmountSubmit, onQuickUnitChange, onPresetClick, }: QuickRangePopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export default QuickRangePopover;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CalendarDaysIcon } from "lucide-react";
|
|
3
|
-
import { Popover } from "../../Popover";
|
|
4
|
-
import { SegmentButton, TriggerIcon, } from "../SuperDatePicker.styled";
|
|
5
|
-
import QuickRangeDropdown from "./QuickRangeDropdown";
|
|
6
|
-
const QuickRangePopover = ({ opened, disabled, size, commonRangeGroups, quickDirection, quickAmount, quickUnit, onOpenChange, onQuickDirectionChange, onQuickAmountChange, onQuickAmountSubmit, onQuickUnitChange, onPresetClick, }) => {
|
|
7
|
-
return (_jsxs(Popover, { opened: opened, onChange: (nextOpened) => onOpenChange(!disabled && nextOpened), position: "bottom-start", offset: 5, withinPortal: true, children: [_jsx(Popover.Target, { children: _jsx(SegmentButton, { type: "button", size: size, "$iconOnly": true, disabled: disabled, "aria-label": "Open quick date ranges", title: "Open quick date ranges", "data-active": opened, children: _jsx(TriggerIcon, { size: size, children: _jsx(CalendarDaysIcon, {}) }) }) }), _jsx(Popover.Dropdown, { style: {
|
|
8
|
-
border: "none",
|
|
9
|
-
padding: 0,
|
|
10
|
-
}, children: _jsx(QuickRangeDropdown, { commonRangeGroups: commonRangeGroups, quickDirection: quickDirection, quickAmount: quickAmount, quickUnit: quickUnit, onQuickDirectionChange: onQuickDirectionChange, onQuickAmountChange: onQuickAmountChange, onQuickAmountSubmit: onQuickAmountSubmit, onQuickUnitChange: onQuickUnitChange, onPresetClick: onPresetClick }) })] }));
|
|
11
|
-
};
|
|
12
|
-
export default QuickRangePopover;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as CommonPresetGroups } from "./CommonPresetGroups";
|
|
2
|
-
export { default as EndpointCalendarDropdown } from "./EndpointCalendarDropdown";
|
|
3
|
-
export { default as EndpointDateInput } from "./EndpointDateInput";
|
|
4
|
-
export { default as EndpointPopover } from "./EndpointPopover";
|
|
5
|
-
export { default as QuickRangeDropdown } from "./QuickRangeDropdown";
|
|
6
|
-
export { default as QuickRangePopover } from "./QuickRangePopover";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as CommonPresetGroups } from "./CommonPresetGroups";
|
|
2
|
-
export { default as EndpointCalendarDropdown } from "./EndpointCalendarDropdown";
|
|
3
|
-
export { default as EndpointDateInput } from "./EndpointDateInput";
|
|
4
|
-
export { default as EndpointPopover } from "./EndpointPopover";
|
|
5
|
-
export { default as QuickRangeDropdown } from "./QuickRangeDropdown";
|
|
6
|
-
export { default as QuickRangePopover } from "./QuickRangePopover";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { MouseEvent } from "react";
|
|
2
|
-
import type { CommonRangeGroupConfig, Endpoint, OpenSegment, QuickDirection, QuickUnit, SuperDatePickerPreset, SuperDatePickerProps, SuperDatePickerValue } from "./SuperDatePicker.types";
|
|
3
|
-
type UseSuperDatePickerOptions = {
|
|
4
|
-
defaultValue: SuperDatePickerValue;
|
|
5
|
-
value?: SuperDatePickerValue;
|
|
6
|
-
onChange: NonNullable<SuperDatePickerProps["onChange"]>;
|
|
7
|
-
disabled: boolean;
|
|
8
|
-
min?: Date;
|
|
9
|
-
max?: Date;
|
|
10
|
-
utc: boolean;
|
|
11
|
-
presets?: SuperDatePickerPreset[];
|
|
12
|
-
};
|
|
13
|
-
declare const useSuperDatePicker: ({ defaultValue, value, onChange, disabled, min, max, utc, presets, }: UseSuperDatePickerOptions) => {
|
|
14
|
-
value: SuperDatePickerValue;
|
|
15
|
-
openSegment: OpenSegment;
|
|
16
|
-
quickDirection: QuickDirection;
|
|
17
|
-
quickAmount: string;
|
|
18
|
-
quickUnit: QuickUnit;
|
|
19
|
-
commonRangeGroups: CommonRangeGroupConfig[];
|
|
20
|
-
handleOpenSegmentChange: (segment: Endpoint | "quick", opened: boolean) => void;
|
|
21
|
-
handleClear: (event?: MouseEvent) => void;
|
|
22
|
-
handlePreset: (preset: SuperDatePickerPreset) => void;
|
|
23
|
-
handleQuickDirectionChange: (nextDirection: QuickDirection) => void;
|
|
24
|
-
handleQuickAmountChange: (nextAmount: string) => void;
|
|
25
|
-
handleQuickAmountSubmit: () => void;
|
|
26
|
-
handleQuickUnitChange: (nextUnit: QuickUnit) => void;
|
|
27
|
-
handleEndpointChange: (endpoint: Endpoint, nextValue?: string | null) => void;
|
|
28
|
-
handleCalendarChange: (endpoint: Endpoint, date: Date | null) => void;
|
|
29
|
-
getEndpointMin: (endpoint: Endpoint) => Date | undefined;
|
|
30
|
-
getEndpointMax: (endpoint: Endpoint) => Date | undefined;
|
|
31
|
-
};
|
|
32
|
-
export default useSuperDatePicker;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { DEFAULT_QUICK_AMOUNT, DEFAULT_QUICK_DIRECTION, DEFAULT_QUICK_UNIT, } from "./SuperDatePicker.constants";
|
|
3
|
-
import { calendarDateToMoment, createRange, getAdditionalCommonRangeGroups, getDefaultCommonRangeGroups, parseRangeMoment, resolveNow, serializeMoment, } from "./SuperDatePicker.lib";
|
|
4
|
-
const useSuperDatePicker = ({ defaultValue, value, onChange, disabled, min, max, utc, presets, }) => {
|
|
5
|
-
const isControlled = useRef(value !== undefined);
|
|
6
|
-
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
7
|
-
const pickerValue = isControlled.current ? value || {} : uncontrolledValue;
|
|
8
|
-
const [openSegment, setOpenSegment] = useState(null);
|
|
9
|
-
const [quickDirection, setQuickDirection] = useState(DEFAULT_QUICK_DIRECTION);
|
|
10
|
-
const [quickAmount, setQuickAmount] = useState(DEFAULT_QUICK_AMOUNT);
|
|
11
|
-
const [quickUnit, setQuickUnit] = useState(DEFAULT_QUICK_UNIT);
|
|
12
|
-
const commonRangeGroups = useMemo(() => presets
|
|
13
|
-
? [
|
|
14
|
-
{
|
|
15
|
-
label: "Presets",
|
|
16
|
-
ranges: presets,
|
|
17
|
-
},
|
|
18
|
-
]
|
|
19
|
-
: [
|
|
20
|
-
...getDefaultCommonRangeGroups(utc),
|
|
21
|
-
...getAdditionalCommonRangeGroups(utc),
|
|
22
|
-
], [presets, utc]);
|
|
23
|
-
const commitValue = useCallback((nextValue, meta) => {
|
|
24
|
-
if (!isControlled.current) {
|
|
25
|
-
setUncontrolledValue(nextValue);
|
|
26
|
-
}
|
|
27
|
-
onChange(nextValue, meta);
|
|
28
|
-
}, [onChange]);
|
|
29
|
-
const commitPartial = (patch, source) => {
|
|
30
|
-
commitValue(Object.assign(Object.assign({}, pickerValue), patch), { source });
|
|
31
|
-
};
|
|
32
|
-
const commitQuickRange = (direction = quickDirection, amountInput = quickAmount, unit = quickUnit) => {
|
|
33
|
-
if (disabled)
|
|
34
|
-
return;
|
|
35
|
-
const amount = Number(amountInput);
|
|
36
|
-
if (!Number.isFinite(amount) || amount <= 0)
|
|
37
|
-
return;
|
|
38
|
-
const now = resolveNow(utc);
|
|
39
|
-
const nextValue = direction === "last"
|
|
40
|
-
? createRange(now.clone().subtract(amount, unit), now, utc)
|
|
41
|
-
: createRange(now, now.clone().add(amount, unit), utc);
|
|
42
|
-
commitValue(nextValue, { source: "apply" });
|
|
43
|
-
};
|
|
44
|
-
const handleOpenSegmentChange = (segment, opened) => {
|
|
45
|
-
setOpenSegment((currentSegment) => {
|
|
46
|
-
if (opened)
|
|
47
|
-
return segment;
|
|
48
|
-
return currentSegment === segment ? null : currentSegment;
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
const handleClear = (event) => {
|
|
52
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
53
|
-
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
54
|
-
commitValue({ start: null, end: null }, { source: "clear" });
|
|
55
|
-
setOpenSegment(null);
|
|
56
|
-
};
|
|
57
|
-
const handlePreset = (preset) => {
|
|
58
|
-
if (disabled)
|
|
59
|
-
return;
|
|
60
|
-
const nextValue = preset.getRange();
|
|
61
|
-
commitValue(nextValue, { source: "preset", preset });
|
|
62
|
-
setOpenSegment(null);
|
|
63
|
-
};
|
|
64
|
-
const handleQuickDirectionChange = (nextDirection) => {
|
|
65
|
-
setQuickDirection(nextDirection);
|
|
66
|
-
commitQuickRange(nextDirection);
|
|
67
|
-
};
|
|
68
|
-
const handleQuickAmountChange = (nextAmount) => {
|
|
69
|
-
setQuickAmount(nextAmount);
|
|
70
|
-
commitQuickRange(quickDirection, nextAmount, quickUnit);
|
|
71
|
-
};
|
|
72
|
-
const handleQuickAmountSubmit = () => {
|
|
73
|
-
commitQuickRange();
|
|
74
|
-
};
|
|
75
|
-
const handleQuickUnitChange = (nextUnit) => {
|
|
76
|
-
setQuickUnit(nextUnit);
|
|
77
|
-
commitQuickRange(quickDirection, quickAmount, nextUnit);
|
|
78
|
-
};
|
|
79
|
-
const handleEndpointChange = (endpoint, nextValue) => {
|
|
80
|
-
if (disabled)
|
|
81
|
-
return;
|
|
82
|
-
commitPartial({ [endpoint]: nextValue }, "apply");
|
|
83
|
-
};
|
|
84
|
-
const handleCalendarChange = (endpoint, date) => {
|
|
85
|
-
if (disabled)
|
|
86
|
-
return;
|
|
87
|
-
if (!date) {
|
|
88
|
-
handleEndpointChange(endpoint, null);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
handleEndpointChange(endpoint, serializeMoment(calendarDateToMoment(date, utc), utc));
|
|
92
|
-
};
|
|
93
|
-
const getEndpointMin = (endpoint) => {
|
|
94
|
-
var _a;
|
|
95
|
-
return endpoint === "end"
|
|
96
|
-
? ((_a = parseRangeMoment(pickerValue.start, utc)) === null || _a === void 0 ? void 0 : _a.toDate()) || min
|
|
97
|
-
: min;
|
|
98
|
-
};
|
|
99
|
-
const getEndpointMax = (endpoint) => {
|
|
100
|
-
var _a;
|
|
101
|
-
return endpoint === "start"
|
|
102
|
-
? ((_a = parseRangeMoment(pickerValue.end, utc)) === null || _a === void 0 ? void 0 : _a.toDate()) || max
|
|
103
|
-
: max;
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
value: pickerValue,
|
|
107
|
-
openSegment,
|
|
108
|
-
quickDirection,
|
|
109
|
-
quickAmount,
|
|
110
|
-
quickUnit,
|
|
111
|
-
commonRangeGroups,
|
|
112
|
-
handleOpenSegmentChange,
|
|
113
|
-
handleClear,
|
|
114
|
-
handlePreset,
|
|
115
|
-
handleQuickDirectionChange,
|
|
116
|
-
handleQuickAmountChange,
|
|
117
|
-
handleQuickAmountSubmit,
|
|
118
|
-
handleQuickUnitChange,
|
|
119
|
-
handleEndpointChange,
|
|
120
|
-
handleCalendarChange,
|
|
121
|
-
getEndpointMin,
|
|
122
|
-
getEndpointMax,
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
export default useSuperDatePicker;
|
|
File without changes
|