@monolith-forensics/monolith-ui 1.8.1 → 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/MonolithUIProvider/MonolithUIProvider.d.ts +0 -4
- package/dist/Tabs/Tab.js +0 -8
- package/dist/TagBox/TagBox.d.ts +1 -1
- package/dist/TagBox/TagBox.js +135 -35
- package/dist/TagBox/types.d.ts +13 -0
- package/dist/core/controlSizes.d.ts +0 -26
- package/dist/core/controlSizes.js +0 -156
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/theme/variants.js +0 -8
- package/package.json +1 -1
- package/dist/Charts/BarChart/BarChart.d.ts +0 -5
- package/dist/Charts/BarChart/BarChart.js +0 -563
- 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 -56
- package/dist/Charts/BarChart/BarChart.styled.js +0 -119
- package/dist/Charts/BarChart/BarChart.types.d.ts +0 -179
- package/dist/Charts/BarChart/BarChart.types.js +0 -1
- 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/chartSizing.d.ts +0 -20
- package/dist/Charts/ChartUtils/chartSizing.js +0 -83
- package/dist/Charts/ChartUtils/index.d.ts +0 -4
- package/dist/Charts/ChartUtils/index.js +0 -4
- package/dist/Charts/HeatMap/HeatMap.d.ts +0 -5
- package/dist/Charts/HeatMap/HeatMap.js +0 -233
- 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 -41
- package/dist/Charts/HeatMap/HeatMap.styled.js +0 -94
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +0 -86
- 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 -548
- 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 -64
- package/dist/Charts/LineChart/LineChart.styled.js +0 -151
- package/dist/Charts/LineChart/LineChart.types.d.ts +0 -201
- 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 -214
- 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 -56
- package/dist/Charts/PieChart/PieChart.styled.js +0 -168
- package/dist/Charts/PieChart/PieChart.types.d.ts +0 -104
- 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.d.ts +0 -61
- 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/Components/CodeBlockBaseButton.d.ts +0 -18
- package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +0 -6
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +0 -9
- package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +0 -42
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +0 -10
- package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +0 -60
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +0 -9
- package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +0 -30
- package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +0 -3
- package/dist/RichTextEditor/Components/CodeBlockNodeView.js +0 -28
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +0 -10
- package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +0 -17
- package/dist/RichTextEditor/Components/LinkEditor.d.ts +0 -8
- package/dist/RichTextEditor/Components/LinkEditor.js +0 -94
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +0 -2
- package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +0 -19
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +0 -2
- package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +0 -24
- package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +0 -2
- package/dist/RichTextEditor/Components/TableTools/TableRails.js +0 -180
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +0 -5
- package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +0 -6
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +0 -5
- package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +0 -183
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +0 -16
- package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +0 -217
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +0 -8
- package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +0 -11
- package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +0 -3
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +0 -23
- package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +0 -75
- package/dist/RichTextEditor/Components/TableTools/TableTools.js +0 -3
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +0 -16
- package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +0 -53
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +0 -40
- package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +0 -167
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +0 -76
- package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +0 -1
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +0 -4
- package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +0 -4
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +0 -2
- package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +0 -12
- package/dist/RichTextEditor/Components/TableTools/index.d.ts +0 -3
- package/dist/RichTextEditor/Components/TableTools/index.js +0 -2
- package/dist/RichTextEditor/Enums/HighlightColors.d.ts +0 -9
- package/dist/RichTextEditor/Enums/HighlightColors.js +0 -10
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.d.ts +0 -3
- package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +0 -238
- package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +0 -20
- package/dist/RichTextEditor/Utils/codeBlockUtils.js +0 -137
- package/dist/RichTextEditor/Utils/codeUtils.d.ts +0 -3
- package/dist/RichTextEditor/Utils/codeUtils.js +0 -12
- package/dist/RichTextEditor/Utils/linkUtils.d.ts +0 -19
- package/dist/RichTextEditor/Utils/linkUtils.js +0 -57
- package/dist/RichTextEditor/Utils/tableUtils.d.ts +0 -1
- package/dist/RichTextEditor/Utils/tableUtils.js +0 -1
- 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
|
@@ -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;
|