@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.
Files changed (179) hide show
  1. package/dist/MonolithUIProvider/MonolithUIProvider.d.ts +0 -4
  2. package/dist/Tabs/Tab.js +0 -8
  3. package/dist/TagBox/TagBox.d.ts +1 -1
  4. package/dist/TagBox/TagBox.js +135 -35
  5. package/dist/TagBox/types.d.ts +13 -0
  6. package/dist/core/controlSizes.d.ts +0 -26
  7. package/dist/core/controlSizes.js +0 -156
  8. package/dist/core/index.d.ts +1 -0
  9. package/dist/core/index.js +1 -0
  10. package/dist/theme/variants.js +0 -8
  11. package/package.json +1 -1
  12. package/dist/Charts/BarChart/BarChart.d.ts +0 -5
  13. package/dist/Charts/BarChart/BarChart.js +0 -563
  14. package/dist/Charts/BarChart/BarChart.lib.d.ts +0 -31
  15. package/dist/Charts/BarChart/BarChart.lib.js +0 -136
  16. package/dist/Charts/BarChart/BarChart.styled.d.ts +0 -56
  17. package/dist/Charts/BarChart/BarChart.styled.js +0 -119
  18. package/dist/Charts/BarChart/BarChart.types.d.ts +0 -179
  19. package/dist/Charts/BarChart/BarChart.types.js +0 -1
  20. package/dist/Charts/BarChart/index.d.ts +0 -3
  21. package/dist/Charts/BarChart/index.js +0 -2
  22. package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +0 -11
  23. package/dist/Charts/ChartPrimitives/ChartExportControl.js +0 -29
  24. package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +0 -1
  25. package/dist/Charts/ChartPrimitives/chartActions.styled.js +0 -8
  26. package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +0 -12
  27. package/dist/Charts/ChartPrimitives/chartLegend.styled.js +0 -52
  28. package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +0 -19
  29. package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +0 -61
  30. package/dist/Charts/ChartPrimitives/index.d.ts +0 -4
  31. package/dist/Charts/ChartPrimitives/index.js +0 -4
  32. package/dist/Charts/ChartUtils/chartColors.d.ts +0 -8
  33. package/dist/Charts/ChartUtils/chartColors.js +0 -65
  34. package/dist/Charts/ChartUtils/chartExport.d.ts +0 -47
  35. package/dist/Charts/ChartUtils/chartExport.js +0 -311
  36. package/dist/Charts/ChartUtils/chartMath.d.ts +0 -3
  37. package/dist/Charts/ChartUtils/chartMath.js +0 -3
  38. package/dist/Charts/ChartUtils/chartSizing.d.ts +0 -20
  39. package/dist/Charts/ChartUtils/chartSizing.js +0 -83
  40. package/dist/Charts/ChartUtils/index.d.ts +0 -4
  41. package/dist/Charts/ChartUtils/index.js +0 -4
  42. package/dist/Charts/HeatMap/HeatMap.d.ts +0 -5
  43. package/dist/Charts/HeatMap/HeatMap.js +0 -233
  44. package/dist/Charts/HeatMap/HeatMap.lib.d.ts +0 -30
  45. package/dist/Charts/HeatMap/HeatMap.lib.js +0 -115
  46. package/dist/Charts/HeatMap/HeatMap.styled.d.ts +0 -41
  47. package/dist/Charts/HeatMap/HeatMap.styled.js +0 -94
  48. package/dist/Charts/HeatMap/HeatMap.types.d.ts +0 -86
  49. package/dist/Charts/HeatMap/HeatMap.types.js +0 -1
  50. package/dist/Charts/HeatMap/index.d.ts +0 -3
  51. package/dist/Charts/HeatMap/index.js +0 -2
  52. package/dist/Charts/LineChart/LineChart.d.ts +0 -5
  53. package/dist/Charts/LineChart/LineChart.js +0 -548
  54. package/dist/Charts/LineChart/LineChart.lib.d.ts +0 -24
  55. package/dist/Charts/LineChart/LineChart.lib.js +0 -132
  56. package/dist/Charts/LineChart/LineChart.styled.d.ts +0 -64
  57. package/dist/Charts/LineChart/LineChart.styled.js +0 -151
  58. package/dist/Charts/LineChart/LineChart.types.d.ts +0 -201
  59. package/dist/Charts/LineChart/LineChart.types.js +0 -1
  60. package/dist/Charts/LineChart/index.d.ts +0 -3
  61. package/dist/Charts/LineChart/index.js +0 -2
  62. package/dist/Charts/PieChart/PieChart.d.ts +0 -4
  63. package/dist/Charts/PieChart/PieChart.js +0 -214
  64. package/dist/Charts/PieChart/PieChart.lib.d.ts +0 -5
  65. package/dist/Charts/PieChart/PieChart.lib.js +0 -19
  66. package/dist/Charts/PieChart/PieChart.styled.d.ts +0 -56
  67. package/dist/Charts/PieChart/PieChart.styled.js +0 -168
  68. package/dist/Charts/PieChart/PieChart.types.d.ts +0 -104
  69. package/dist/Charts/PieChart/PieChart.types.js +0 -1
  70. package/dist/Charts/PieChart/index.d.ts +0 -2
  71. package/dist/Charts/PieChart/index.js +0 -1
  72. package/dist/Charts/index.d.ts +0 -5
  73. package/dist/Charts/index.js +0 -4
  74. package/dist/QueryFilter/QueryFilter.constants.d.ts +0 -134
  75. package/dist/QueryFilter/QueryFilter.constants.js +0 -39
  76. package/dist/QueryFilter/QueryFilter.lib.d.ts +0 -14
  77. package/dist/QueryFilter/QueryFilter.lib.js +0 -84
  78. package/dist/QueryFilter/QueryFilter.styled.d.ts +0 -89
  79. package/dist/QueryFilter/QueryFilter.styled.js +0 -184
  80. package/dist/QueryFilter/QueryFilter.types.d.ts +0 -61
  81. package/dist/QueryFilter/QueryFilter.types.js +0 -1
  82. package/dist/QueryFilter/components/MultiSelectEditor.d.ts +0 -7
  83. package/dist/QueryFilter/components/MultiSelectEditor.js +0 -44
  84. package/dist/QueryFilter/components/RuleChip.d.ts +0 -8
  85. package/dist/QueryFilter/components/RuleChip.js +0 -37
  86. package/dist/QueryFilter/components/Rules.d.ts +0 -11
  87. package/dist/QueryFilter/components/Rules.js +0 -41
  88. package/dist/QueryFilter/components/UnavailableRuleChip.d.ts +0 -5
  89. package/dist/QueryFilter/components/UnavailableRuleChip.js +0 -7
  90. package/dist/QueryFilter/components/ValueEditor.d.ts +0 -7
  91. package/dist/QueryFilter/components/ValueEditor.js +0 -45
  92. package/dist/QueryFilter/components/ValueSelector.d.ts +0 -7
  93. package/dist/QueryFilter/components/ValueSelector.js +0 -34
  94. package/dist/QueryFilter/components/index.d.ts +0 -6
  95. package/dist/QueryFilter/components/index.js +0 -6
  96. package/dist/RichTextEditor/Components/CodeBlockBaseButton.d.ts +0 -18
  97. package/dist/RichTextEditor/Components/CodeBlockBaseButton.js +0 -6
  98. package/dist/RichTextEditor/Components/CodeBlockCopyButton.d.ts +0 -9
  99. package/dist/RichTextEditor/Components/CodeBlockCopyButton.js +0 -42
  100. package/dist/RichTextEditor/Components/CodeBlockFormatButton.d.ts +0 -10
  101. package/dist/RichTextEditor/Components/CodeBlockFormatButton.js +0 -60
  102. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.d.ts +0 -9
  103. package/dist/RichTextEditor/Components/CodeBlockLanguageSelect.js +0 -30
  104. package/dist/RichTextEditor/Components/CodeBlockNodeView.d.ts +0 -3
  105. package/dist/RichTextEditor/Components/CodeBlockNodeView.js +0 -28
  106. package/dist/RichTextEditor/Components/CodeBlockWrapButton.d.ts +0 -10
  107. package/dist/RichTextEditor/Components/CodeBlockWrapButton.js +0 -17
  108. package/dist/RichTextEditor/Components/LinkEditor.d.ts +0 -8
  109. package/dist/RichTextEditor/Components/LinkEditor.js +0 -94
  110. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.d.ts +0 -2
  111. package/dist/RichTextEditor/Components/TableTools/TableCornerMenu.js +0 -19
  112. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.d.ts +0 -2
  113. package/dist/RichTextEditor/Components/TableTools/TableInsertControls.js +0 -24
  114. package/dist/RichTextEditor/Components/TableTools/TableRails.d.ts +0 -2
  115. package/dist/RichTextEditor/Components/TableTools/TableRails.js +0 -180
  116. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.d.ts +0 -5
  117. package/dist/RichTextEditor/Components/TableTools/TableToolMenu.js +0 -6
  118. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.d.ts +0 -5
  119. package/dist/RichTextEditor/Components/TableTools/TableTools.actions.js +0 -183
  120. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.d.ts +0 -16
  121. package/dist/RichTextEditor/Components/TableTools/TableTools.commands.js +0 -217
  122. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.d.ts +0 -8
  123. package/dist/RichTextEditor/Components/TableTools/TableTools.constants.js +0 -11
  124. package/dist/RichTextEditor/Components/TableTools/TableTools.d.ts +0 -3
  125. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.d.ts +0 -23
  126. package/dist/RichTextEditor/Components/TableTools/TableTools.geometry.js +0 -75
  127. package/dist/RichTextEditor/Components/TableTools/TableTools.js +0 -3
  128. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.d.ts +0 -16
  129. package/dist/RichTextEditor/Components/TableTools/TableTools.selectors.js +0 -53
  130. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.d.ts +0 -40
  131. package/dist/RichTextEditor/Components/TableTools/TableTools.styled.js +0 -167
  132. package/dist/RichTextEditor/Components/TableTools/TableTools.types.d.ts +0 -76
  133. package/dist/RichTextEditor/Components/TableTools/TableTools.types.js +0 -1
  134. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.d.ts +0 -4
  135. package/dist/RichTextEditor/Components/TableTools/TableTools.utils.js +0 -4
  136. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.d.ts +0 -2
  137. package/dist/RichTextEditor/Components/TableTools/TableToolsPopover.js +0 -12
  138. package/dist/RichTextEditor/Components/TableTools/index.d.ts +0 -3
  139. package/dist/RichTextEditor/Components/TableTools/index.js +0 -2
  140. package/dist/RichTextEditor/Enums/HighlightColors.d.ts +0 -9
  141. package/dist/RichTextEditor/Enums/HighlightColors.js +0 -10
  142. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.d.ts +0 -3
  143. package/dist/RichTextEditor/Plugins/ImageActionsPlugin.js +0 -238
  144. package/dist/RichTextEditor/Utils/codeBlockUtils.d.ts +0 -20
  145. package/dist/RichTextEditor/Utils/codeBlockUtils.js +0 -137
  146. package/dist/RichTextEditor/Utils/codeUtils.d.ts +0 -3
  147. package/dist/RichTextEditor/Utils/codeUtils.js +0 -12
  148. package/dist/RichTextEditor/Utils/linkUtils.d.ts +0 -19
  149. package/dist/RichTextEditor/Utils/linkUtils.js +0 -57
  150. package/dist/RichTextEditor/Utils/tableUtils.d.ts +0 -1
  151. package/dist/RichTextEditor/Utils/tableUtils.js +0 -1
  152. package/dist/SuperDatePicker/SuperDatePicker.constants.d.ts +0 -24
  153. package/dist/SuperDatePicker/SuperDatePicker.constants.js +0 -30
  154. package/dist/SuperDatePicker/SuperDatePicker.d.ts +0 -3
  155. package/dist/SuperDatePicker/SuperDatePicker.js +0 -31
  156. package/dist/SuperDatePicker/SuperDatePicker.lib.d.ts +0 -17
  157. package/dist/SuperDatePicker/SuperDatePicker.lib.js +0 -206
  158. package/dist/SuperDatePicker/SuperDatePicker.styled.d.ts +0 -60
  159. package/dist/SuperDatePicker/SuperDatePicker.styled.js +0 -256
  160. package/dist/SuperDatePicker/SuperDatePicker.types.d.ts +0 -48
  161. package/dist/SuperDatePicker/SuperDatePicker.types.js +0 -1
  162. package/dist/SuperDatePicker/components/CommonPresetGroups.d.ts +0 -7
  163. package/dist/SuperDatePicker/components/CommonPresetGroups.js +0 -6
  164. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.d.ts +0 -10
  165. package/dist/SuperDatePicker/components/EndpointCalendarDropdown.js +0 -9
  166. package/dist/SuperDatePicker/components/EndpointDateInput.d.ts +0 -16
  167. package/dist/SuperDatePicker/components/EndpointDateInput.js +0 -26
  168. package/dist/SuperDatePicker/components/EndpointPopover.d.ts +0 -18
  169. package/dist/SuperDatePicker/components/EndpointPopover.js +0 -11
  170. package/dist/SuperDatePicker/components/QuickRangeDropdown.d.ts +0 -14
  171. package/dist/SuperDatePicker/components/QuickRangeDropdown.js +0 -19
  172. package/dist/SuperDatePicker/components/QuickRangePopover.d.ts +0 -18
  173. package/dist/SuperDatePicker/components/QuickRangePopover.js +0 -12
  174. package/dist/SuperDatePicker/components/index.d.ts +0 -6
  175. package/dist/SuperDatePicker/components/index.js +0 -6
  176. package/dist/SuperDatePicker/index.d.ts +0 -3
  177. package/dist/SuperDatePicker/index.js +0 -3
  178. package/dist/SuperDatePicker/useSuperDatePicker.d.ts +0 -32
  179. 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,3 +0,0 @@
1
- export { default } from "./SuperDatePicker";
2
- export * from "./SuperDatePicker";
3
- export * from "./SuperDatePicker.types";
@@ -1,3 +0,0 @@
1
- export { default } from "./SuperDatePicker";
2
- export * from "./SuperDatePicker";
3
- export * from "./SuperDatePicker.types";
@@ -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;