@delightui/components 0.1.144 → 0.1.145

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 (42) hide show
  1. package/dist/cjs/components/molecules/DatePicker/DateInput/DateInput.d.ts +3 -0
  2. package/dist/cjs/components/molecules/DatePicker/DateInput/DateInput.presenter.d.ts +14 -0
  3. package/dist/cjs/components/molecules/DatePicker/DateInput/DateInput.types.d.ts +15 -0
  4. package/dist/cjs/components/molecules/DatePicker/DateInput/index.d.ts +4 -0
  5. package/dist/cjs/components/molecules/DatePicker/DatePicker.d.ts +1 -4
  6. package/dist/cjs/components/molecules/DatePicker/DatePicker.types.d.ts +2 -111
  7. package/dist/cjs/components/molecules/DatePicker/DatePickerBase/DatePickerBase.constants.d.ts +10 -0
  8. package/dist/cjs/components/molecules/DatePicker/DatePickerBase/DatePickerBase.d.ts +5 -0
  9. package/dist/cjs/components/molecules/DatePicker/{DatePicker.presenter.d.ts → DatePickerBase/DatePickerBase.presenter.d.ts} +6 -12
  10. package/dist/cjs/components/molecules/DatePicker/DatePickerBase/DatePickerBase.types.d.ts +116 -0
  11. package/dist/{esm/components/molecules/DatePicker → cjs/components/molecules/DatePicker/DatePickerBase}/Plugins/customTimeSelector.d.ts +1 -1
  12. package/dist/{esm/components/molecules/DatePicker → cjs/components/molecules/DatePicker/DatePickerBase}/Plugins/dateTimeSelector.d.ts +1 -1
  13. package/dist/{esm/components/molecules/DatePicker → cjs/components/molecules/DatePicker/DatePickerBase}/Plugins/timeSelector.d.ts +1 -1
  14. package/dist/cjs/components/molecules/DatePicker/DatePickerBase/index.d.ts +3 -0
  15. package/dist/cjs/components/molecules/DatePicker/index.d.ts +4 -2
  16. package/dist/cjs/library.css +257 -131
  17. package/dist/cjs/library.js +3 -3
  18. package/dist/cjs/library.js.map +1 -1
  19. package/dist/esm/components/molecules/DatePicker/DateInput/DateInput.d.ts +3 -0
  20. package/dist/esm/components/molecules/DatePicker/DateInput/DateInput.presenter.d.ts +14 -0
  21. package/dist/esm/components/molecules/DatePicker/DateInput/DateInput.types.d.ts +15 -0
  22. package/dist/esm/components/molecules/DatePicker/DateInput/index.d.ts +4 -0
  23. package/dist/esm/components/molecules/DatePicker/DatePicker.d.ts +1 -4
  24. package/dist/esm/components/molecules/DatePicker/DatePicker.types.d.ts +2 -111
  25. package/dist/esm/components/molecules/DatePicker/DatePickerBase/DatePickerBase.constants.d.ts +10 -0
  26. package/dist/esm/components/molecules/DatePicker/DatePickerBase/DatePickerBase.d.ts +5 -0
  27. package/dist/esm/components/molecules/DatePicker/{DatePicker.presenter.d.ts → DatePickerBase/DatePickerBase.presenter.d.ts} +6 -12
  28. package/dist/esm/components/molecules/DatePicker/DatePickerBase/DatePickerBase.types.d.ts +116 -0
  29. package/dist/{cjs/components/molecules/DatePicker → esm/components/molecules/DatePicker/DatePickerBase}/Plugins/customTimeSelector.d.ts +1 -1
  30. package/dist/{cjs/components/molecules/DatePicker → esm/components/molecules/DatePicker/DatePickerBase}/Plugins/dateTimeSelector.d.ts +1 -1
  31. package/dist/{cjs/components/molecules/DatePicker → esm/components/molecules/DatePicker/DatePickerBase}/Plugins/timeSelector.d.ts +1 -1
  32. package/dist/esm/components/molecules/DatePicker/DatePickerBase/index.d.ts +3 -0
  33. package/dist/esm/components/molecules/DatePicker/index.d.ts +4 -2
  34. package/dist/esm/library.css +257 -131
  35. package/dist/esm/library.js +2 -2
  36. package/dist/esm/library.js.map +1 -1
  37. package/dist/index.d.ts +30 -8
  38. package/package.json +1 -1
  39. /package/dist/cjs/components/molecules/DatePicker/{Plugins → DatePickerBase/Plugins}/utils.d.ts +0 -0
  40. /package/dist/cjs/components/molecules/DatePicker/{Plugins → DatePickerBase/Plugins}/utils.test.d.ts +0 -0
  41. /package/dist/esm/components/molecules/DatePicker/{Plugins → DatePickerBase/Plugins}/utils.d.ts +0 -0
  42. /package/dist/esm/components/molecules/DatePicker/{Plugins → DatePickerBase/Plugins}/utils.test.d.ts +0 -0
@@ -0,0 +1,3 @@
1
+ import { DateInputProps } from './DateInput.types';
2
+ declare const DateInput: (props: DateInputProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default DateInput;
@@ -0,0 +1,14 @@
1
+ import { DateInputProps } from './DateInput.types';
2
+ declare const usePresenter: (props: DateInputProps) => {
3
+ invalid: boolean | undefined;
4
+ onInputBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
5
+ inputLeadingIcon: false | import("react/jsx-runtime").JSX.Element | undefined;
6
+ readOnly: boolean;
7
+ inputVariantProps: {
8
+ 'component-variant': string;
9
+ };
10
+ value: import("../DatePickerBase").DatePickerValue | undefined;
11
+ isTimePickerOnly: boolean | undefined;
12
+ handleInputReadOnlyState: (value: boolean) => void;
13
+ };
14
+ export default usePresenter;
@@ -0,0 +1,15 @@
1
+ import { DatePickerBaseSharedProps } from '../DatePickerBase';
2
+ export type DateInputProps = DatePickerBaseSharedProps & {
3
+ /**
4
+ * Placeholder text for the date picker input
5
+ */
6
+ placeholder?: string;
7
+ /**
8
+ * Icon to be displayed before the input.
9
+ */
10
+ leadingIcon?: React.ReactNode;
11
+ /**
12
+ * Icon to be displayed after the input.
13
+ */
14
+ trailingIcon?: React.ReactNode;
15
+ };
@@ -0,0 +1,4 @@
1
+ import DateInput from './DateInput';
2
+ import type { DateInputProps } from './DateInput.types';
3
+ export type { DateInputProps };
4
+ export default DateInput;
@@ -1,6 +1,3 @@
1
- import 'flatpickr/dist/flatpickr.css';
2
- import 'flatpickr/dist/flatpickr.css';
3
- import type { DatePickerProps } from './DatePicker.types';
4
- import './Flatpickr.custom.scss';
1
+ import { DatePickerProps } from './DatePicker.types';
5
2
  declare const DatePicker: (props: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
6
3
  export default DatePicker;
@@ -1,111 +1,2 @@
1
- import { Plugin } from 'flatpickr/dist/types/options';
2
- import FlatPickr from 'react-flatpickr';
3
- import { ControlledFormComponentProps } from '../FormField/FormField.types';
4
- type DatePickerPosition = 'auto' | 'above' | 'below' | 'auto left' | 'auto center' | 'auto right' | 'above left' | 'above center' | 'above right' | 'below left' | 'below center' | 'below right';
5
- export type DatePickerValue = string | Date | (string | Date)[];
6
- export type DatePickerProps = ControlledFormComponentProps<DatePickerValue> & {
7
- /**
8
- * Additional class for styling.
9
- */
10
- className?: string;
11
- /**
12
- * The minimum selectable date.
13
- */
14
- minDate?: string | Date;
15
- /**
16
- * The maximum selectable date.
17
- */
18
- maxDate?: string | Date;
19
- /**
20
- * Enable time selection in the date picker.
21
- * @default false
22
- */
23
- enableTime?: boolean;
24
- /**
25
- * Enable selecting a start and end date.
26
- * @default false
27
- */
28
- enableRange?: boolean;
29
- /**
30
- * The date that is initially displayed.
31
- */
32
- defaultDate?: string | Date;
33
- /**
34
- * The format of the date to be displayed.
35
- * @remark
36
- * For info about what formats exist, refer to the flatpickr documentation
37
- */
38
- dateFormat?: string;
39
- /**
40
- * Callback function when the date picker is opened.
41
- * @param dates - Array of selected dates.
42
- * @param dateStr - String representation of the selected date(s). Will match the date format.
43
- */
44
- onOpen?: (dates: Date[], dateStr: string) => void;
45
- /**
46
- * Callback function when the date picker is closed.
47
- * @param dates - Array of selected dates.
48
- * @param dateStr - String representation of the selected date(s). Will match the date format.
49
- */
50
- onClose?: (dates: Date[], dateStr: string) => void;
51
- /**
52
- * render date picker inline
53
- */
54
- inline?: boolean;
55
- /**
56
- * Hide calendar for only time picker.
57
- * @default false
58
- */
59
- noCalendar?: boolean;
60
- /**
61
- * The Flatpickr ref.
62
- */
63
- datePickerRef?: React.RefObject<FlatPickr>;
64
- /**
65
- * Datepicker position
66
- */
67
- position?: DatePickerPosition;
68
- /**
69
- * Function to parse date strings into Date objects.
70
- * Used for parsing both the initial date string and any date strings entered in the input field.
71
- * @param date - The date value to parse, can be a string
72
- * @param format - Optional format string to use when parsing date strings
73
- * @returns A Date object representing the parsed date
74
- */
75
- parseDate?: (date: string, format?: string) => Date;
76
- /**
77
- * Allow user to type date/time in input.
78
- * @default false
79
- */
80
- allowInput?: boolean;
81
- /**
82
- * Custom time picker plugin
83
- */
84
- customTimePickerPlugin?: (config: CustomTimePickerConfig) => Plugin;
85
- /**
86
- * Custom time picker plugin
87
- */
88
- customDateTimePickerPlugin?: (config: CustomTimePickerConfig) => Plugin;
89
- /**
90
- * Use custom time input same as date picker input
91
- * This is useful when the datepicker is inline and is re-added to the DOM after closing
92
- * For example using this inside a Popover as content
93
- */
94
- useCustomTimeInputForTimePicker?: boolean;
95
- /**
96
- * Placeholder text for the date picker input
97
- */
98
- placeholder?: string;
99
- /**
100
- * Icon to be displayed before the input.
101
- */
102
- leadingIcon?: React.ReactNode;
103
- /**
104
- * Icon to be displayed after the input.
105
- */
106
- trailingIcon?: React.ReactNode;
107
- };
108
- export type CustomTimePickerConfig = {
109
- minuteStep: number;
110
- };
111
- export {};
1
+ import { DatePickerBaseSharedProps } from './DatePickerBase';
2
+ export type DatePickerProps = Omit<DatePickerBaseSharedProps, 'noCalendar' | 'inline'> & {};
@@ -0,0 +1,10 @@
1
+ export declare const customLocale: {
2
+ weekdays: {
3
+ shorthand: string[];
4
+ longhand: string[];
5
+ };
6
+ months: {
7
+ shorthand: [string, string, string, string, string, string, string, string, string, string, string, string];
8
+ longhand: [string, string, string, string, string, string, string, string, string, string, string, string];
9
+ };
10
+ };
@@ -0,0 +1,5 @@
1
+ import 'flatpickr/dist/flatpickr.css';
2
+ import type { DatePickerBaseProps } from './DatePickerBase.types';
3
+ import './Flatpickr.custom.scss';
4
+ declare const DatePickerBase: (props: DatePickerBaseProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default DatePickerBase;
@@ -1,10 +1,10 @@
1
1
  import { Instance } from 'flatpickr/dist/types/instance';
2
- import { DatePickerProps } from './DatePicker.types';
3
- declare const usePresenter: (props: DatePickerProps) => {
2
+ import { DatePickerBaseProps } from './DatePickerBase.types';
3
+ declare const usePresenter: (props: DatePickerBaseProps) => {
4
+ value: import("./DatePickerBase.types").DatePickerValue | undefined;
4
5
  datePickerRef: import("react").RefObject<import("react-flatpickr").default> | undefined;
5
6
  disabled: boolean | undefined;
6
7
  required: boolean | undefined;
7
- invalid: boolean | undefined;
8
8
  mode: "range" | "single";
9
9
  enableTime: boolean | undefined;
10
10
  noCalendar: boolean | undefined;
@@ -12,7 +12,7 @@ declare const usePresenter: (props: DatePickerProps) => {
12
12
  customPlugin: import("flatpickr/dist/types/options").Plugin[];
13
13
  handleKeyDown: (_selectedDates: Date[], _dateStr: string, instance: Instance, event: KeyboardEvent) => void;
14
14
  otherProps: {
15
- initialValue?: import("./DatePicker.types").DatePickerValue | undefined;
15
+ initialValue?: import("./DatePickerBase.types").DatePickerValue | undefined;
16
16
  checked?: boolean;
17
17
  id?: string;
18
18
  minDate?: string | Date;
@@ -23,22 +23,16 @@ declare const usePresenter: (props: DatePickerProps) => {
23
23
  position?: "auto" | "above" | "below" | "auto left" | "auto center" | "auto right" | "above left" | "above center" | "above right" | "below left" | "below center" | "below right";
24
24
  parseDate?: (date: string, format?: string) => Date;
25
25
  allowInput?: boolean;
26
- placeholder?: string;
27
- leadingIcon?: React.ReactNode;
28
- trailingIcon?: React.ReactNode;
26
+ renderInput?: ((props: Omit<import("react-flatpickr").DateTimePickerProps, "options" | "render">, ref: (node: HTMLInputElement | null) => void) => React.ReactElement) | undefined;
29
27
  };
30
- onInputBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
31
- inputLeadingIcon: false | import("react/jsx-runtime").JSX.Element | undefined;
32
- readOnly: boolean;
33
28
  onDateChange: (dates: Date[]) => void;
34
29
  onCloseDatePicker: import("flatpickr/dist/types/options").Hook;
35
30
  onOpenDatePicker: import("flatpickr/dist/types/options").Hook;
36
- variantProps: {
31
+ calendarVariantProps: {
37
32
  'component-variant': string;
38
33
  };
39
34
  dayVariantProps: {
40
35
  'component-variant': string;
41
36
  };
42
- value: import("./DatePicker.types").DatePickerValue | undefined;
43
37
  };
44
38
  export default usePresenter;
@@ -0,0 +1,116 @@
1
+ import { Plugin } from 'flatpickr/dist/types/options';
2
+ import FlatPickr, { DateTimePickerProps } from 'react-flatpickr';
3
+ import { ControlledFormComponentProps } from '../../FormField/FormField.types';
4
+ type DatePickerPosition = 'auto' | 'above' | 'below' | 'auto left' | 'auto center' | 'auto right' | 'above left' | 'above center' | 'above right' | 'below left' | 'below center' | 'below right';
5
+ export type DatePickerValue = string | Date | (string | Date)[];
6
+ export type DatePickerBaseProps = ControlledFormComponentProps<DatePickerValue> & {
7
+ /**
8
+ * Additional class for styling.
9
+ */
10
+ className?: string;
11
+ /**
12
+ * The minimum selectable date.
13
+ */
14
+ minDate?: string | Date;
15
+ /**
16
+ * The maximum selectable date.
17
+ */
18
+ maxDate?: string | Date;
19
+ /**
20
+ * Enable time selection in the date picker.
21
+ * @default false
22
+ */
23
+ enableTime?: boolean;
24
+ /**
25
+ * Enable selecting a start and end date.
26
+ * @default false
27
+ */
28
+ enableRange?: boolean;
29
+ /**
30
+ * The date that is initially displayed.
31
+ */
32
+ defaultDate?: string | Date;
33
+ /**
34
+ * The format of the date to be displayed.
35
+ * @remark
36
+ * For info about what formats exist, refer to the flatpickr documentation
37
+ */
38
+ dateFormat?: string;
39
+ /**
40
+ * Callback function when the date picker is opened.
41
+ * @param dates - Array of selected dates.
42
+ * @param dateStr - String representation of the selected date(s). Will match the date format.
43
+ */
44
+ onOpen?: (dates: Date[], dateStr: string) => void;
45
+ /**
46
+ * Callback function when the date picker is closed.
47
+ * @param dates - Array of selected dates.
48
+ * @param dateStr - String representation of the selected date(s). Will match the date format.
49
+ */
50
+ onClose?: (dates: Date[], dateStr: string) => void;
51
+ /**
52
+ * render date picker inline
53
+ */
54
+ inline?: boolean;
55
+ /**
56
+ * Hide calendar for only time picker.
57
+ * @default false
58
+ */
59
+ noCalendar?: boolean;
60
+ /**
61
+ * The Flatpickr ref.
62
+ */
63
+ datePickerRef?: React.RefObject<FlatPickr>;
64
+ /**
65
+ * Datepicker position
66
+ */
67
+ position?: DatePickerPosition;
68
+ /**
69
+ * Function to parse date strings into Date objects.
70
+ * Used for parsing both the initial date string and any date strings entered in the input field.
71
+ * @param date - The date value to parse, can be a string
72
+ * @param format - Optional format string to use when parsing date strings
73
+ * @returns A Date object representing the parsed date
74
+ */
75
+ parseDate?: (date: string, format?: string) => Date;
76
+ /**
77
+ * Allow user to type date/time in input.
78
+ * @default false
79
+ */
80
+ allowInput?: boolean;
81
+ /**
82
+ * Custom time picker plugin
83
+ */
84
+ customTimePickerPlugin?: (config: CustomTimePickerConfig) => Plugin;
85
+ /**
86
+ * Custom time picker plugin
87
+ */
88
+ customDateTimePickerPlugin?: (config: CustomTimePickerConfig) => Plugin;
89
+ /**
90
+ * Use custom time input same as date picker input
91
+ * This is useful when the datepicker is inline and is re-added to the DOM after closing
92
+ * For example using this inside a Popover as content
93
+ */
94
+ useCustomTimeInputForTimePicker?: boolean;
95
+ /**
96
+ * Custom renderer for the input element used by Flatpickr.
97
+ * Use this to supply your own input (e.g., shared Input atom) while still
98
+ * letting Flatpickr control it via the provided ref.
99
+ *
100
+ * - props: Forwarded props that ReactFlatPickr would apply to its default input
101
+ * - ref: Must be attached to your input so Flatpickr can bind events
102
+ */
103
+ renderInput?: ((props: Omit<DateTimePickerProps, 'options' | 'render'>, ref: (node: HTMLInputElement | null) => void) => React.ReactElement) | undefined;
104
+ /**
105
+ * Callback to toggle the input's readOnly state when the calendar opens/closes.
106
+ * Prevents soft keyboards/unwanted edits while the popup is active.
107
+ *
108
+ * - value: true to set readOnly, false to restore editability
109
+ */
110
+ handleInputReadOnlyState?: (value: boolean) => void;
111
+ };
112
+ export type CustomTimePickerConfig = {
113
+ minuteStep: number;
114
+ };
115
+ export type DatePickerBaseSharedProps = Omit<DatePickerBaseProps, 'renderInput' | 'handleInputReadOnlyState'>;
116
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { Plugin } from "flatpickr/dist/types/options";
2
- import { CustomTimePickerConfig } from '../DatePicker.types';
2
+ import { CustomTimePickerConfig } from '../DatePickerBase.types';
3
3
  declare const timeDropdownPlugin: (config: CustomTimePickerConfig) => Plugin;
4
4
  export default timeDropdownPlugin;
@@ -1,4 +1,4 @@
1
1
  import { Plugin } from "flatpickr/dist/types/options";
2
- import { CustomTimePickerConfig } from "../DatePicker.types";
2
+ import { CustomTimePickerConfig } from "../DatePickerBase.types";
3
3
  declare const dateTimeDropdownPlugin: (config: CustomTimePickerConfig) => Plugin;
4
4
  export default dateTimeDropdownPlugin;
@@ -1,4 +1,4 @@
1
1
  import { Plugin } from "flatpickr/dist/types/options";
2
- import { CustomTimePickerConfig } from "../DatePicker.types";
2
+ import { CustomTimePickerConfig } from "../DatePickerBase.types";
3
3
  declare const timeDropdownPlugin: (config: CustomTimePickerConfig) => Plugin;
4
4
  export default timeDropdownPlugin;
@@ -0,0 +1,3 @@
1
+ import DatePickerBase from './DatePickerBase';
2
+ export default DatePickerBase;
3
+ export * from './DatePickerBase.types';
@@ -1,4 +1,6 @@
1
1
  import DatePicker from './DatePicker';
2
- import type { DatePickerProps, CustomTimePickerConfig } from './DatePicker.types';
3
- export type { DatePickerProps, CustomTimePickerConfig };
2
+ import type { CustomTimePickerConfig } from './DatePickerBase/DatePickerBase.types';
3
+ export type { CustomTimePickerConfig };
4
4
  export default DatePicker;
5
+ export * from './DatePicker.types';
6
+ export * from './DateInput';