@cognite/aura 0.1.7 → 0.3.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/DESIGN.md +34 -92
- package/README.md +33 -0
- package/dist/colors.css +471 -214
- package/dist/components/index.d.ts +17 -33
- package/dist/components/index.js +315 -281
- package/dist/components/ui/core/accordion/accordion.d.ts +7 -7
- package/dist/components/ui/core/accordion/accordion.js +64 -62
- package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +41 -0
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +176 -0
- package/dist/components/ui/core/alert/alert.d.ts +23 -12
- package/dist/components/ui/core/alert/alert.js +123 -120
- package/dist/components/ui/core/avatar/avatar.d.ts +12 -8
- package/dist/components/ui/core/avatar/avatar.js +10 -10
- package/dist/components/ui/core/badge/badge.d.ts +11 -8
- package/dist/components/ui/core/badge/badge.js +13 -13
- package/dist/components/ui/core/banner/banner.d.ts +18 -28
- package/dist/components/ui/core/banner/banner.js +6 -6
- package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +200 -0
- package/dist/components/ui/core/button/button.d.ts +8 -5
- package/dist/components/ui/core/button/button.js +22 -19
- package/dist/components/ui/core/button-group/button-group.d.ts +7 -6
- package/dist/components/ui/core/card/card.d.ts +18 -14
- package/dist/components/ui/core/card/card.js +131 -87
- package/dist/components/ui/core/chart/chart.d.ts +69 -0
- package/dist/components/ui/core/chart/chart.js +215 -0
- package/dist/components/ui/core/chart/index.d.ts +2 -0
- package/dist/components/ui/core/chart/index.js +8 -0
- package/dist/components/ui/core/checkbox/checkbox.d.ts +17 -0
- package/dist/components/ui/core/checkbox/checkbox.js +133 -0
- package/dist/components/ui/core/{badge/badge.metadata.d.ts → checkbox/checkbox.metadata.d.ts} +1 -1
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +8 -0
- package/dist/components/ui/core/code-block/code-block.d.ts +6 -9
- package/dist/components/ui/core/code-block/code-block.js +52 -48
- package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -3
- package/dist/components/ui/core/combobox/combobox.d.ts +2 -2
- package/dist/components/ui/core/command/command.d.ts +11 -78
- package/dist/components/ui/core/command/command.js +53 -52
- package/dist/components/ui/core/count/count.d.ts +9 -0
- package/dist/components/ui/core/count/count.js +32 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +15 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +99 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +25 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +82 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +17 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +190 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +42 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +161 -0
- package/dist/components/ui/core/date-time-pickers/index.d.ts +6 -0
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +7 -0
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +57 -0
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.d.ts +13 -0
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +119 -0
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.d.ts +10 -0
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +93 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +20 -0
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +14 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +19 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +99 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +12 -0
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +68 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +12 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +40 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +29 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +63 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +8 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +19 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +17 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +34 -0
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +8 -0
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +7 -0
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -0
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +31 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +10 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +52 -0
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.d.ts +48 -0
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +52 -0
- package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +26 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +37 -0
- package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +34 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +43 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +15 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +23 -0
- package/dist/components/ui/core/dialog/dialog.d.ts +10 -10
- package/dist/components/ui/core/dialog/dialog.js +12 -3
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +24 -47
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +125 -123
- package/dist/components/ui/core/empty-state/empty-state.context.d.ts +10 -0
- package/dist/components/ui/core/empty-state/empty-state.context.js +8 -0
- package/dist/components/ui/core/empty-state/empty-state.d.ts +18 -0
- package/dist/components/ui/core/empty-state/empty-state.js +139 -0
- package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -5
- package/dist/components/ui/core/hover-card/hover-card.d.ts +5 -7
- package/dist/components/ui/core/hover-card/hover-card.js +26 -25
- package/dist/components/ui/core/inline-citation/inline-citation.d.ts +10 -10
- package/dist/components/ui/core/inline-citation/inline-citation.js +65 -57
- package/dist/components/ui/core/input/input.d.ts +2 -1
- package/dist/components/ui/core/input-group/input-group.d.ts +17 -13
- package/dist/components/ui/core/input-group/input-group.js +35 -36
- package/dist/components/ui/core/kbd/kbd.d.ts +4 -0
- package/dist/components/ui/core/kbd/kbd.js +36 -0
- package/dist/components/ui/core/label/label.d.ts +3 -2
- package/dist/components/ui/core/loader/loader.d.ts +11 -3
- package/dist/components/ui/core/loader/loader.js +106 -107
- package/dist/components/ui/core/message/message.d.ts +18 -17
- package/dist/components/ui/core/message/message.js +15 -13
- package/dist/components/ui/core/pagination/pagination-size-context.d.ts +5 -0
- package/dist/components/ui/core/pagination/pagination-size-context.js +6 -0
- package/dist/components/ui/core/pagination/pagination-teleport.d.ts +11 -0
- package/dist/components/ui/core/pagination/pagination-teleport.js +108 -0
- package/dist/components/ui/core/pagination/pagination-teleport.utils.d.ts +1 -0
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +7 -0
- package/dist/components/ui/core/pagination/pagination.d.ts +41 -0
- package/dist/components/ui/core/pagination/pagination.js +335 -0
- package/dist/components/ui/core/popover/popover.d.ts +12 -16
- package/dist/components/ui/core/popover/popover.js +52 -51
- package/dist/components/ui/core/progress/progress.d.ts +7 -4
- package/dist/components/ui/core/prompt-input/prompt-input.d.ts +36 -103
- package/dist/components/ui/core/prompt-input/prompt-input.js +193 -180
- package/dist/components/ui/core/radio-group/radio-group.d.ts +20 -0
- package/dist/components/ui/core/radio-group/radio-group.js +113 -0
- package/dist/components/ui/core/reasoning/reasoning.d.ts +5 -5
- package/dist/components/ui/core/reasoning/reasoning.js +1 -1
- package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -2
- package/dist/components/ui/core/search/search.d.ts +10 -0
- package/dist/components/ui/core/search/search.js +99 -0
- package/dist/components/ui/core/segmented-control/segmented-control.d.ts +20 -0
- package/dist/components/ui/core/segmented-control/segmented-control.js +172 -0
- package/dist/components/ui/core/select/select.d.ts +13 -13
- package/dist/components/ui/core/select/select.js +13 -10
- package/dist/components/ui/core/separator/separator.d.ts +2 -4
- package/dist/components/ui/core/separator/separator.js +4 -5
- package/dist/components/ui/core/shimmer/shimmer.d.ts +3 -5
- package/dist/components/ui/core/shimmer/shimmer.js +25 -26
- package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -1
- package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +4 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +48 -0
- package/dist/components/ui/core/sources/sources.d.ts +3 -3
- package/dist/components/ui/core/sources/sources.js +6 -1
- package/dist/components/ui/core/switch/switch.d.ts +11 -0
- package/dist/components/ui/core/{button/button.metadata.d.ts → switch/switch.metadata.d.ts} +1 -1
- package/dist/components/ui/core/tabs/tabs.d.ts +27 -0
- package/dist/components/ui/core/tabs/tabs.js +224 -0
- package/dist/components/ui/core/tabs/tabs.utils.d.ts +2 -0
- package/dist/components/ui/core/tabs/tabs.utils.js +9 -0
- package/dist/components/ui/core/textarea/textarea.d.ts +2 -1
- package/dist/components/ui/core/textarea/textarea.js +20 -18
- package/dist/components/ui/core/tool/tool.d.ts +7 -6
- package/dist/components/ui/core/tool/tool.js +48 -44
- package/dist/components/ui/core/tooltip/tooltip.d.ts +6 -5
- package/dist/components/ui/core/tooltip/tooltip.js +10 -8
- package/dist/components/ui/core/topbar/topbar.d.ts +28 -0
- package/dist/components/ui/core/topbar/topbar.js +190 -0
- package/dist/eslint/index.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +298 -273
- package/dist/lib/portal-container-context.d.ts +2 -1
- package/dist/lib/portal-container-context.js +1 -3
- package/dist/lib/utils.d.ts +11 -0
- package/dist/lib/utils.js +40 -29
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +75 -8
- package/package.json +26 -5
- package/dist/components/ui/core/accordion/accordion.metadata.d.ts +0 -2
- package/dist/components/ui/core/accordion/accordion.metadata.js +0 -9
- package/dist/components/ui/core/alert/alert.metadata.d.ts +0 -2
- package/dist/components/ui/core/alert/alert.metadata.js +0 -9
- package/dist/components/ui/core/avatar/avatar.metadata.d.ts +0 -8
- package/dist/components/ui/core/avatar/avatar.metadata.js +0 -9
- package/dist/components/ui/core/badge/badge.metadata.js +0 -8
- package/dist/components/ui/core/banner/banner.metadata.d.ts +0 -2
- package/dist/components/ui/core/banner/banner.metadata.js +0 -9
- package/dist/components/ui/core/button/button.metadata.js +0 -9
- package/dist/components/ui/core/button-group/button-group.metadata.d.ts +0 -2
- package/dist/components/ui/core/button-group/button-group.metadata.js +0 -8
- package/dist/components/ui/core/card/card.metadata.d.ts +0 -8
- package/dist/components/ui/core/card/card.metadata.js +0 -9
- package/dist/components/ui/core/code-block/code-block.metadata.d.ts +0 -2
- package/dist/components/ui/core/code-block/code-block.metadata.js +0 -8
- package/dist/components/ui/core/collapsible/collapsible.metadata.d.ts +0 -2
- package/dist/components/ui/core/collapsible/collapsible.metadata.js +0 -9
- package/dist/components/ui/core/combobox/combobox.metadata.d.ts +0 -2
- package/dist/components/ui/core/command/command.metadata.d.ts +0 -2
- package/dist/components/ui/core/command/command.metadata.js +0 -9
- package/dist/components/ui/core/dialog/dialog.metadata.d.ts +0 -2
- package/dist/components/ui/core/dialog/dialog.metadata.js +0 -9
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.metadata.d.ts +0 -2
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.metadata.js +0 -9
- package/dist/components/ui/core/helper-text/helper-text.metadata.d.ts +0 -2
- package/dist/components/ui/core/helper-text/helper-text.metadata.js +0 -9
- package/dist/components/ui/core/hover-card/hover-card.metadata.d.ts +0 -2
- package/dist/components/ui/core/hover-card/hover-card.metadata.js +0 -8
- package/dist/components/ui/core/inline-citation/inline-citation.metadata.d.ts +0 -2
- package/dist/components/ui/core/inline-citation/inline-citation.metadata.js +0 -8
- package/dist/components/ui/core/input/input.metadata.d.ts +0 -2
- package/dist/components/ui/core/input/input.metadata.js +0 -9
- package/dist/components/ui/core/input-group/input-group.metadata.d.ts +0 -2
- package/dist/components/ui/core/input-group/input-group.metadata.js +0 -9
- package/dist/components/ui/core/label/label.metadata.d.ts +0 -2
- package/dist/components/ui/core/label/label.metadata.js +0 -9
- package/dist/components/ui/core/loader/loader.metadata.d.ts +0 -2
- package/dist/components/ui/core/loader/loader.metadata.js +0 -9
- package/dist/components/ui/core/message/message.metadata.d.ts +0 -2
- package/dist/components/ui/core/popover/popover.metadata.d.ts +0 -2
- package/dist/components/ui/core/popover/popover.metadata.js +0 -9
- package/dist/components/ui/core/progress/progress.metadata.d.ts +0 -2
- package/dist/components/ui/core/progress/progress.metadata.js +0 -9
- package/dist/components/ui/core/prompt-input/prompt-input.metadata.d.ts +0 -2
- package/dist/components/ui/core/prompt-input/prompt-input.metadata.js +0 -9
- package/dist/components/ui/core/reasoning/reasoning.metadata.d.ts +0 -2
- package/dist/components/ui/core/reasoning/reasoning.metadata.js +0 -8
- package/dist/components/ui/core/scroll-area/scroll-area.metadata.d.ts +0 -2
- package/dist/components/ui/core/scroll-area/scroll-area.metadata.js +0 -9
- package/dist/components/ui/core/select/select.metadata.d.ts +0 -2
- package/dist/components/ui/core/select/select.metadata.js +0 -9
- package/dist/components/ui/core/separator/separator.metadata.d.ts +0 -2
- package/dist/components/ui/core/separator/separator.metadata.js +0 -8
- package/dist/components/ui/core/shimmer/shimmer.metadata.d.ts +0 -2
- package/dist/components/ui/core/shimmer/shimmer.metadata.js +0 -9
- package/dist/components/ui/core/skeleton/skeleton.metadata.d.ts +0 -2
- package/dist/components/ui/core/skeleton/skeleton.metadata.js +0 -9
- package/dist/components/ui/core/sources/sources.metadata.d.ts +0 -2
- package/dist/components/ui/core/textarea/textarea.metadata.d.ts +0 -2
- package/dist/components/ui/core/textarea/textarea.metadata.js +0 -9
- package/dist/components/ui/core/tool/tool.metadata.d.ts +0 -2
- package/dist/components/ui/core/tool/tool.metadata.js +0 -8
- package/dist/components/ui/core/tooltip/tooltip.metadata.d.ts +0 -8
- package/dist/components/ui/core/tooltip/tooltip.metadata.js +0 -9
|
@@ -1,86 +1,19 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode } from 'react';
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes, ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
3
|
import { Dialog } from '../dialog/dialog';
|
|
3
|
-
declare const Command:
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
} & Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
6
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
7
|
-
} & {
|
|
8
|
-
asChild?: boolean;
|
|
9
|
-
}, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
10
|
-
label?: string;
|
|
11
|
-
shouldFilter?: boolean;
|
|
12
|
-
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
13
|
-
defaultValue?: string;
|
|
14
|
-
value?: string;
|
|
15
|
-
onValueChange?: (value: string) => void;
|
|
16
|
-
loop?: boolean;
|
|
17
|
-
disablePointerSelection?: boolean;
|
|
18
|
-
vimBindings?: boolean;
|
|
19
|
-
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const Command: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive>, 'ref'> & RefAttributes<HTMLDivElement>>;
|
|
20
5
|
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: Omit<ComponentProps<typeof Dialog>, 'children'> & {
|
|
21
6
|
children?: ReactNode;
|
|
22
7
|
title?: string;
|
|
23
8
|
description?: string;
|
|
24
9
|
className?: string;
|
|
25
10
|
showCloseButton?: boolean;
|
|
26
|
-
}):
|
|
27
|
-
declare
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
declare const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, "key" | keyof import('react').InputHTMLAttributes<HTMLInputElement> | "asChild">, "onChange" | "value" | "type"> & {
|
|
35
|
-
value?: string;
|
|
36
|
-
onValueChange?: (search: string) => void;
|
|
37
|
-
} & import('react').RefAttributes<HTMLInputElement>, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
38
|
-
declare const CommandList: import('react').ForwardRefExoticComponent<Omit<{
|
|
39
|
-
children?: React.ReactNode;
|
|
40
|
-
} & Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
41
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
42
|
-
} & {
|
|
43
|
-
asChild?: boolean;
|
|
44
|
-
}, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
45
|
-
label?: string;
|
|
46
|
-
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
47
|
-
declare const CommandEmpty: import('react').ForwardRefExoticComponent<Omit<{
|
|
48
|
-
children?: React.ReactNode;
|
|
49
|
-
} & Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
50
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
51
|
-
} & {
|
|
52
|
-
asChild?: boolean;
|
|
53
|
-
}, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
54
|
-
declare const CommandGroup: import('react').ForwardRefExoticComponent<Omit<{
|
|
55
|
-
children?: React.ReactNode;
|
|
56
|
-
} & Omit<Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
57
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
58
|
-
} & {
|
|
59
|
-
asChild?: boolean;
|
|
60
|
-
}, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
|
|
61
|
-
heading?: React.ReactNode;
|
|
62
|
-
value?: string;
|
|
63
|
-
forceMount?: boolean;
|
|
64
|
-
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
65
|
-
declare const CommandSeparator: import('react').ForwardRefExoticComponent<Omit<Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
66
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
67
|
-
} & {
|
|
68
|
-
asChild?: boolean;
|
|
69
|
-
}, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
70
|
-
alwaysRender?: boolean;
|
|
71
|
-
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
72
|
-
declare const CommandItem: import('react').ForwardRefExoticComponent<Omit<{
|
|
73
|
-
children?: React.ReactNode;
|
|
74
|
-
} & Omit<Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
75
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
76
|
-
} & {
|
|
77
|
-
asChild?: boolean;
|
|
78
|
-
}, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "value" | "disabled"> & {
|
|
79
|
-
disabled?: boolean;
|
|
80
|
-
onSelect?: (value: string) => void;
|
|
81
|
-
value?: string;
|
|
82
|
-
keywords?: string[];
|
|
83
|
-
forceMount?: boolean;
|
|
84
|
-
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
85
|
-
declare const CommandShortcut: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
}): ReactNode;
|
|
12
|
+
declare const CommandInput: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive.Input>, 'ref'> & RefAttributes<HTMLInputElement>>;
|
|
13
|
+
declare const CommandList: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive.List>, 'ref'> & RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const CommandEmpty: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive.Empty>, 'ref'> & RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const CommandGroup: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive.Group>, 'ref'> & RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const CommandSeparator: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive.Separator>, 'ref'> & RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const CommandItem: ForwardRefExoticComponent<Omit<ComponentProps<typeof CommandPrimitive.Item>, 'ref'> & RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const CommandShortcut: ForwardRefExoticComponent<ComponentProps<'span'> & RefAttributes<HTMLSpanElement>>;
|
|
86
19
|
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -4,23 +4,23 @@ import { IconSearch as p } from "@tabler/icons-react";
|
|
|
4
4
|
import { Command as r } from "cmdk";
|
|
5
5
|
import { cn as m } from "../../../../lib/utils.js";
|
|
6
6
|
import { Dialog as u, DialogHeader as g, DialogTitle as h, DialogDescription as f, DialogContent as x } from "../dialog/dialog.js";
|
|
7
|
-
const s = d(({ className: e, ...
|
|
7
|
+
const s = d(({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
8
8
|
r,
|
|
9
9
|
{
|
|
10
|
-
ref:
|
|
10
|
+
ref: a,
|
|
11
11
|
"data-slot": "command",
|
|
12
12
|
className: m(
|
|
13
13
|
"rounded-lg bg-background text-muted-foreground flex h-full w-full flex-col overflow-hidden",
|
|
14
14
|
e
|
|
15
15
|
),
|
|
16
|
-
...
|
|
16
|
+
...t
|
|
17
17
|
}
|
|
18
18
|
));
|
|
19
19
|
s.displayName = "Command";
|
|
20
|
-
function
|
|
20
|
+
function G({
|
|
21
21
|
title: e = "Command Palette",
|
|
22
|
-
description:
|
|
23
|
-
children:
|
|
22
|
+
description: t = "Search for a command to run...",
|
|
23
|
+
children: a,
|
|
24
24
|
className: l,
|
|
25
25
|
showCloseButton: c = !0,
|
|
26
26
|
...i
|
|
@@ -28,7 +28,7 @@ function y({
|
|
|
28
28
|
return /* @__PURE__ */ n(u, { ...i, children: [
|
|
29
29
|
/* @__PURE__ */ n(g, { className: "sr-only rounded-lg", children: [
|
|
30
30
|
/* @__PURE__ */ o(h, { children: e }),
|
|
31
|
-
/* @__PURE__ */ o(f, { children:
|
|
31
|
+
/* @__PURE__ */ o(f, { children: t })
|
|
32
32
|
] }),
|
|
33
33
|
/* @__PURE__ */ o(
|
|
34
34
|
x,
|
|
@@ -36,13 +36,12 @@ function y({
|
|
|
36
36
|
"data-slot": "command-dialog",
|
|
37
37
|
className: m("overflow-hidden p-0", l),
|
|
38
38
|
showCloseButton: c,
|
|
39
|
-
children: /* @__PURE__ */ o(s, { className: "**:[[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children:
|
|
39
|
+
children: /* @__PURE__ */ o(s, { className: "**:[[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: a })
|
|
40
40
|
}
|
|
41
41
|
)
|
|
42
42
|
] });
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
const k = d(({ className: e, ...a }, t) => /* @__PURE__ */ n(
|
|
44
|
+
const k = d(({ className: e, ...t }, a) => /* @__PURE__ */ n(
|
|
46
45
|
"div",
|
|
47
46
|
{
|
|
48
47
|
"data-slot": "command-input-wrapper",
|
|
@@ -52,99 +51,101 @@ const k = d(({ className: e, ...a }, t) => /* @__PURE__ */ n(
|
|
|
52
51
|
/* @__PURE__ */ o(
|
|
53
52
|
r.Input,
|
|
54
53
|
{
|
|
55
|
-
ref:
|
|
54
|
+
ref: a,
|
|
56
55
|
"data-slot": "command-input",
|
|
57
56
|
className: m(
|
|
58
57
|
"placeholder:text-muted-foreground flex h-10 w-full rounded-lg bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
59
58
|
e
|
|
60
59
|
),
|
|
61
|
-
...
|
|
60
|
+
...t
|
|
62
61
|
}
|
|
63
62
|
)
|
|
64
63
|
]
|
|
65
64
|
}
|
|
66
65
|
));
|
|
67
66
|
k.displayName = "CommandInput";
|
|
68
|
-
const
|
|
67
|
+
const y = d(({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
69
68
|
r.List,
|
|
70
69
|
{
|
|
71
|
-
ref:
|
|
70
|
+
ref: a,
|
|
72
71
|
"data-slot": "command-list",
|
|
73
72
|
className: m(
|
|
74
73
|
"max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
75
74
|
e
|
|
76
75
|
),
|
|
77
|
-
...
|
|
76
|
+
...t
|
|
78
77
|
}
|
|
79
78
|
));
|
|
80
|
-
|
|
81
|
-
const
|
|
79
|
+
y.displayName = "CommandList";
|
|
80
|
+
const C = d(({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
82
81
|
r.Empty,
|
|
83
82
|
{
|
|
84
|
-
ref:
|
|
83
|
+
ref: a,
|
|
85
84
|
"data-slot": "command-empty",
|
|
86
85
|
className: m("py-6 text-center text-sm", e),
|
|
87
|
-
...
|
|
86
|
+
...t
|
|
88
87
|
}
|
|
89
88
|
));
|
|
90
|
-
|
|
91
|
-
const
|
|
89
|
+
C.displayName = "CommandEmpty";
|
|
90
|
+
const N = d(({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
92
91
|
r.Group,
|
|
93
92
|
{
|
|
94
|
-
ref:
|
|
93
|
+
ref: a,
|
|
95
94
|
"data-slot": "command-group",
|
|
96
95
|
className: m(
|
|
97
96
|
"text-foreground font-normal **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-medium",
|
|
98
97
|
e
|
|
99
98
|
),
|
|
100
|
-
...
|
|
99
|
+
...t
|
|
101
100
|
}
|
|
102
101
|
));
|
|
103
|
-
|
|
104
|
-
const
|
|
102
|
+
N.displayName = "CommandGroup";
|
|
103
|
+
const v = d(({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
105
104
|
r.Separator,
|
|
106
105
|
{
|
|
107
|
-
ref:
|
|
106
|
+
ref: a,
|
|
108
107
|
"data-slot": "command-separator",
|
|
109
108
|
className: m("bg-border -mx-1 h-px", e),
|
|
110
|
-
...
|
|
109
|
+
...t
|
|
111
110
|
}
|
|
112
111
|
));
|
|
113
|
-
|
|
114
|
-
const
|
|
112
|
+
v.displayName = "CommandSeparator";
|
|
113
|
+
const w = d(({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
115
114
|
r.Item,
|
|
116
115
|
{
|
|
117
|
-
ref:
|
|
116
|
+
ref: a,
|
|
118
117
|
"data-slot": "command-item",
|
|
119
118
|
className: m(
|
|
120
119
|
"data-[selected=true]:bg-accent-background data-[selected=true]:text-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
121
120
|
e
|
|
122
121
|
),
|
|
123
|
-
...
|
|
122
|
+
...t
|
|
124
123
|
}
|
|
125
124
|
));
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
125
|
+
w.displayName = "CommandItem";
|
|
126
|
+
const _ = d(
|
|
127
|
+
({ className: e, ...t }, a) => /* @__PURE__ */ o(
|
|
128
|
+
"span",
|
|
129
|
+
{
|
|
130
|
+
ref: a,
|
|
131
|
+
"data-slot": "command-shortcut",
|
|
132
|
+
className: m(
|
|
133
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
134
|
+
e
|
|
135
|
+
),
|
|
136
|
+
...t
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
_.displayName = "CommandShortcut";
|
|
140
141
|
export {
|
|
141
142
|
s as Command,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
G as CommandDialog,
|
|
144
|
+
C as CommandEmpty,
|
|
145
|
+
N as CommandGroup,
|
|
145
146
|
k as CommandInput,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
w as CommandItem,
|
|
148
|
+
y as CommandList,
|
|
149
|
+
v as CommandSeparator,
|
|
150
|
+
_ as CommandShortcut
|
|
150
151
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes, ComponentProps } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { ClassProp } from 'class-variance-authority/types';
|
|
4
|
+
interface CountVariantProps {
|
|
5
|
+
variant?: 'default' | 'warning' | 'critical' | null;
|
|
6
|
+
}
|
|
7
|
+
declare const countVariants: (props?: (CountVariantProps & ClassProp) | undefined) => string;
|
|
8
|
+
declare const Count: ForwardRefExoticComponent<ComponentProps<'output'> & VariantProps<typeof countVariants> & RefAttributes<HTMLOutputElement>>;
|
|
9
|
+
export { Count, countVariants };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as o } from "react";
|
|
3
|
+
import { cva as i } from "class-variance-authority";
|
|
4
|
+
import { cn as u } from "../../../../lib/utils.js";
|
|
5
|
+
const c = i(
|
|
6
|
+
"flex min-h-9 min-w-9 flex-col items-center justify-center rounded-sm px-0.5 text-3xl font-medium leading-8 tracking-tightest",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-neutral-background text-neutral-foreground-on-neutral",
|
|
11
|
+
warning: "bg-warning-background text-warning-foreground-on-warning",
|
|
12
|
+
critical: "bg-destructive-background text-destructive-foreground-on-critical"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
), d = o(({ className: t, variant: r, ...n }, a) => /* @__PURE__ */ e(
|
|
20
|
+
"output",
|
|
21
|
+
{
|
|
22
|
+
ref: a,
|
|
23
|
+
"data-slot": "count",
|
|
24
|
+
className: u(c({ variant: r }), t),
|
|
25
|
+
...n
|
|
26
|
+
}
|
|
27
|
+
));
|
|
28
|
+
d.displayName = "Count";
|
|
29
|
+
export {
|
|
30
|
+
d as Count,
|
|
31
|
+
c as countVariants
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Dayjs } from 'dayjs';
|
|
3
|
+
import { ShortcutItem } from '../shared/shortcuts-panel/shortcuts-panel';
|
|
4
|
+
export type { ShortcutItem };
|
|
5
|
+
export interface DateRangePickerProps {
|
|
6
|
+
value: [Dayjs | null, Dayjs | null];
|
|
7
|
+
onChange: (range: [Dayjs | null, Dayjs | null]) => void;
|
|
8
|
+
format?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
displayWeekNumber?: boolean;
|
|
11
|
+
shortcuts?: ShortcutItem[];
|
|
12
|
+
defaultDate?: Dayjs;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DateRangePicker: FC<DateRangePickerProps>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { cn as N } from "../../../../../lib/utils.js";
|
|
3
|
+
import { Popover as w, PopoverTrigger as Y, PopoverContent as T } from "../../popover/popover.js";
|
|
4
|
+
import { Calendar as j } from "../shared/calendar/calendar.js";
|
|
5
|
+
import { DateTimeInput as y } from "../shared/date-time-input/date-time-input.js";
|
|
6
|
+
import { ShortcutsPanel as H } from "../shared/shortcuts-panel/shortcuts-panel.js";
|
|
7
|
+
import { useDateRangePicker as O } from "./use-date-range-picker.js";
|
|
8
|
+
const F = ({
|
|
9
|
+
value: t,
|
|
10
|
+
onChange: d,
|
|
11
|
+
format: p = "DD/MM/YYYY",
|
|
12
|
+
placeholder: c,
|
|
13
|
+
displayWeekNumber: h = !1,
|
|
14
|
+
shortcuts: n,
|
|
15
|
+
defaultDate: m,
|
|
16
|
+
className: s
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
isOpen: a,
|
|
20
|
+
step: o,
|
|
21
|
+
displayedMonth: v,
|
|
22
|
+
tempStart: r,
|
|
23
|
+
tempEnd: l,
|
|
24
|
+
hoverDate: f,
|
|
25
|
+
handleTogglePopover: g,
|
|
26
|
+
handleCancel: C,
|
|
27
|
+
handleDateClick: D,
|
|
28
|
+
handleMonthChange: u,
|
|
29
|
+
handleDateHover: k,
|
|
30
|
+
handleSetStep: P,
|
|
31
|
+
handleApplyShortcut: R,
|
|
32
|
+
inputRef: x,
|
|
33
|
+
popoverRef: S
|
|
34
|
+
} = O({ value: t, onChange: d, defaultDate: m });
|
|
35
|
+
return /* @__PURE__ */ e(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "date-range-picker",
|
|
39
|
+
className: N("relative w-full", s),
|
|
40
|
+
children: /* @__PURE__ */ i(
|
|
41
|
+
w,
|
|
42
|
+
{
|
|
43
|
+
open: a,
|
|
44
|
+
onOpenChange: (M) => {
|
|
45
|
+
M || C();
|
|
46
|
+
},
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ e(Y, { render: /* @__PURE__ */ e("div", { ref: x, className: "w-full" }), children: /* @__PURE__ */ e(
|
|
49
|
+
y,
|
|
50
|
+
{
|
|
51
|
+
value: a ? [r, l] : t,
|
|
52
|
+
format: p,
|
|
53
|
+
placeholder: c,
|
|
54
|
+
onClick: g,
|
|
55
|
+
isOpen: a,
|
|
56
|
+
variant: "date",
|
|
57
|
+
activeRangePart: a ? o : void 0,
|
|
58
|
+
onRangePartClick: a ? P : void 0
|
|
59
|
+
}
|
|
60
|
+
) }),
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
T,
|
|
63
|
+
{
|
|
64
|
+
ref: S,
|
|
65
|
+
className: "rounded-xl w-auto p-0",
|
|
66
|
+
side: "bottom",
|
|
67
|
+
align: "start",
|
|
68
|
+
children: /* @__PURE__ */ i("div", { "data-slot": "date-range-picker-content", className: "flex flex-row", children: [
|
|
69
|
+
n && n.length > 0 && /* @__PURE__ */ e(
|
|
70
|
+
H,
|
|
71
|
+
{
|
|
72
|
+
shortcuts: n,
|
|
73
|
+
onShortcutClick: R
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(
|
|
77
|
+
j,
|
|
78
|
+
{
|
|
79
|
+
displayedMonth: v,
|
|
80
|
+
selectedRange: [r, l],
|
|
81
|
+
hoverDate: o === "end" ? f : null,
|
|
82
|
+
displayWeekNumber: h,
|
|
83
|
+
onDateClick: D,
|
|
84
|
+
onMonthChange: u,
|
|
85
|
+
onDateHover: k
|
|
86
|
+
}
|
|
87
|
+
) })
|
|
88
|
+
] })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
F as DateRangePicker
|
|
99
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import { RangeSelectionStep } from '../shared/hooks/use-range-step-manager';
|
|
3
|
+
export type { RangeSelectionStep };
|
|
4
|
+
export interface UseDateRangePickerProps {
|
|
5
|
+
value: [Dayjs | null, Dayjs | null];
|
|
6
|
+
onChange: (range: [Dayjs | null, Dayjs | null]) => void;
|
|
7
|
+
defaultDate?: Dayjs;
|
|
8
|
+
}
|
|
9
|
+
export interface UseDateRangePickerReturn {
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
step: RangeSelectionStep;
|
|
12
|
+
displayedMonth: Dayjs;
|
|
13
|
+
tempStart: Dayjs | null;
|
|
14
|
+
tempEnd: Dayjs | null;
|
|
15
|
+
hoverDate: Dayjs | null;
|
|
16
|
+
handleTogglePopover: () => void;
|
|
17
|
+
handleCancel: () => void;
|
|
18
|
+
handleDateClick: (date: Dayjs) => void;
|
|
19
|
+
handleMonthChange: (month: Dayjs) => void;
|
|
20
|
+
handleDateHover: (date: Dayjs | null) => void;
|
|
21
|
+
handleSetStep: (step: RangeSelectionStep) => void;
|
|
22
|
+
handleApplyShortcut: (range: Dayjs | [Dayjs, Dayjs] | [Dayjs | null, Dayjs | null]) => void;
|
|
23
|
+
inputRef: React.RefObject<HTMLDivElement>;
|
|
24
|
+
popoverRef: React.RefObject<HTMLDivElement>;
|
|
25
|
+
}
|
package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RangeSelectionStep } from '../shared/hooks/use-range-step-manager';
|
|
2
|
+
import { UseDateRangePickerProps, UseDateRangePickerReturn } from './types';
|
|
3
|
+
export type { RangeSelectionStep, UseDateRangePickerProps, UseDateRangePickerReturn, };
|
|
4
|
+
export declare const useDateRangePicker: ({ value, onChange, defaultDate, }: UseDateRangePickerProps) => UseDateRangePickerReturn;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useRef as k, useCallback as s, useEffect as g } from "react";
|
|
2
|
+
import b from "dayjs";
|
|
3
|
+
import { usePopoverState as j } from "../shared/hooks/use-popover-state.js";
|
|
4
|
+
import { useRangeDateState as H } from "../shared/hooks/use-range-date-state.js";
|
|
5
|
+
import { useRangeStepManager as I } from "../shared/hooks/use-range-step-manager.js";
|
|
6
|
+
const U = ({
|
|
7
|
+
value: r,
|
|
8
|
+
onChange: t,
|
|
9
|
+
defaultDate: D = b()
|
|
10
|
+
}) => {
|
|
11
|
+
const d = k(() => {
|
|
12
|
+
}), f = k(() => {
|
|
13
|
+
}), {
|
|
14
|
+
isOpen: i,
|
|
15
|
+
setIsOpen: a,
|
|
16
|
+
popoverRef: R,
|
|
17
|
+
inputRef: v,
|
|
18
|
+
handleTogglePopover: y
|
|
19
|
+
} = j({
|
|
20
|
+
onClose: s(() => d.current(), []),
|
|
21
|
+
onBackspace: s(() => f.current(), [])
|
|
22
|
+
}), A = I(), { step: o, handleBack: c, handleNext: h, resetStep: n } = A, C = H({
|
|
23
|
+
value: r,
|
|
24
|
+
defaultDate: D,
|
|
25
|
+
onEndDateSelected: s(
|
|
26
|
+
(e, p) => {
|
|
27
|
+
t([e, p]), a(!1), n();
|
|
28
|
+
},
|
|
29
|
+
[t, a, n]
|
|
30
|
+
)
|
|
31
|
+
}), {
|
|
32
|
+
tempStart: P,
|
|
33
|
+
tempEnd: B,
|
|
34
|
+
displayedMonth: M,
|
|
35
|
+
hoverDate: E,
|
|
36
|
+
handleDateClick: T,
|
|
37
|
+
handleDateHover: x,
|
|
38
|
+
handleMonthChange: O,
|
|
39
|
+
clearActiveSegment: u,
|
|
40
|
+
resetDates: S
|
|
41
|
+
} = C, l = s(() => {
|
|
42
|
+
S(r), n();
|
|
43
|
+
}, [S, n, r]), m = s(() => {
|
|
44
|
+
const e = u(o);
|
|
45
|
+
e === null ? c() : e[0] === null && e[1] === null && t(e);
|
|
46
|
+
}, [u, o, c, t]);
|
|
47
|
+
return g(() => {
|
|
48
|
+
d.current = l;
|
|
49
|
+
}, [l]), g(() => {
|
|
50
|
+
f.current = m;
|
|
51
|
+
}, [m]), {
|
|
52
|
+
isOpen: i,
|
|
53
|
+
step: o,
|
|
54
|
+
displayedMonth: M,
|
|
55
|
+
tempStart: P,
|
|
56
|
+
tempEnd: B,
|
|
57
|
+
hoverDate: E,
|
|
58
|
+
handleTogglePopover: () => {
|
|
59
|
+
i || l(), y();
|
|
60
|
+
},
|
|
61
|
+
handleCancel: () => {
|
|
62
|
+
l(), a(!1);
|
|
63
|
+
},
|
|
64
|
+
handleDateClick: (e) => {
|
|
65
|
+
T(e, o), o === "start" && h();
|
|
66
|
+
},
|
|
67
|
+
handleMonthChange: O,
|
|
68
|
+
handleDateHover: x,
|
|
69
|
+
handleSetStep: (e) => {
|
|
70
|
+
e === "start" ? c() : h();
|
|
71
|
+
},
|
|
72
|
+
handleApplyShortcut: (e) => {
|
|
73
|
+
const p = Array.isArray(e) ? e : [e, e];
|
|
74
|
+
t(p), a(!1), n();
|
|
75
|
+
},
|
|
76
|
+
inputRef: v,
|
|
77
|
+
popoverRef: R
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
U as useDateRangePicker
|
|
82
|
+
};
|
package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Dayjs } from 'dayjs';
|
|
3
|
+
import { ShortcutItem } from '../shared/shortcuts-panel/shortcuts-panel';
|
|
4
|
+
import { TimeFormat } from '../utils/format-utils';
|
|
5
|
+
export type { ShortcutItem };
|
|
6
|
+
export interface DateTimeRangePickerProps {
|
|
7
|
+
value: [Dayjs | null, Dayjs | null];
|
|
8
|
+
onChange: (range: [Dayjs | null, Dayjs | null]) => void;
|
|
9
|
+
format?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
displayWeekNumber?: boolean;
|
|
12
|
+
shortcuts?: ShortcutItem[];
|
|
13
|
+
timeFormat?: TimeFormat;
|
|
14
|
+
defaultDate?: Dayjs;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const DateTimeRangePicker: FC<DateTimeRangePickerProps>;
|