@delightui/components 0.1.159 → 0.1.161

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.
@@ -1,4 +1,5 @@
1
1
  import { DateInputProps } from './DateInput.types';
2
+ import { Instance } from 'flatpickr/dist/types/instance';
2
3
  declare const usePresenter: (props: DateInputProps) => {
3
4
  invalid: boolean | undefined;
4
5
  onInputBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -10,5 +11,7 @@ declare const usePresenter: (props: DateInputProps) => {
10
11
  value: import("../DatePickerBase").DatePickerValue | undefined;
11
12
  isTimePickerOnly: boolean | undefined;
12
13
  handleInputReadOnlyState: (value: boolean) => void;
14
+ handleReady: (dates: Date[], dateStr: string, calendarInstance: Instance) => void;
15
+ handleCalendarIconClick: () => void;
13
16
  };
14
17
  export default usePresenter;
@@ -6,37 +6,32 @@ declare const usePresenter: (props: DatePickerBaseProps) => {
6
6
  datePickerRef: import("react").RefObject<DatePicker>;
7
7
  disabled: boolean | undefined;
8
8
  required: boolean | undefined;
9
- mode: "range" | "single";
10
- enableTime: boolean | undefined;
11
- noCalendar: boolean | undefined;
12
- isTimePickerOnly: boolean | undefined;
13
- customPlugin: import("flatpickr/dist/types/options").Plugin[];
14
- handleKeyDown: (_selectedDates: Date[], _dateStr: string, instance: Instance, event: KeyboardEvent) => void;
15
9
  onDateChange: (dates: Date[]) => void;
16
10
  onCloseDatePicker: import("flatpickr/dist/types/options").Hook;
17
11
  onOpenDatePicker: import("flatpickr/dist/types/options").Hook;
18
- calendarVariantProps: {
19
- 'component-variant': string;
20
- };
21
- dayVariantProps: {
22
- 'component-variant': string;
23
- };
24
- isInDialog: boolean;
25
- otherProps: {
12
+ handleDayCreate: (_: Date[], __: string, ___: Instance, dayElem: HTMLElement) => void;
13
+ handleCalendarReady: (dates: Date[], dateStr: string, calendarInstance: Instance) => void;
14
+ flatpickrOptions: {
26
15
  initialValue?: import("./DatePickerBase.types").DatePickerValue | undefined;
27
16
  checked?: boolean;
28
17
  invalid?: boolean;
29
18
  id?: string;
30
- className?: string;
31
19
  minDate?: string | Date;
32
20
  maxDate?: string | Date;
33
21
  defaultDate?: string | Date;
34
22
  dateFormat?: string;
35
- inline?: boolean;
23
+ inline: boolean;
36
24
  position?: "auto" | "above" | "below" | "auto left" | "auto center" | "auto right" | "above left" | "above center" | "above right" | "below left" | "below center" | "below right";
37
25
  parseDate?: (date: string, format?: string) => Date;
38
- allowInput?: boolean;
39
- renderInput?: ((props: Omit<import("react-flatpickr").DateTimePickerProps, "options" | "render">, ref: (node: HTMLInputElement | null) => void) => React.ReactElement) | undefined;
26
+ allowInput: boolean;
27
+ mode: "range" | "single";
28
+ enableTime: boolean | undefined;
29
+ noCalendar: boolean | undefined;
30
+ altInput: boolean | undefined;
31
+ altInputClass: string;
32
+ plugins: import("flatpickr/dist/types/options").Plugin[];
33
+ onKeyDown: (_selectedDates: Date[], _dateStr: string, instance: Instance, event: KeyboardEvent) => void;
34
+ static: boolean;
40
35
  };
41
36
  };
42
37
  export default usePresenter;
@@ -1,6 +1,7 @@
1
1
  import { Plugin } from 'flatpickr/dist/types/options';
2
2
  import FlatPickr, { DateTimePickerProps } from 'react-flatpickr';
3
3
  import { ControlledFormComponentProps } from '../../FormField/FormField.types';
4
+ import { Instance } from 'flatpickr/dist/types/instance';
4
5
  type DatePickerPosition = 'auto' | 'above' | 'below' | 'auto left' | 'auto center' | 'auto right' | 'above left' | 'above center' | 'above right' | 'below left' | 'below center' | 'below right';
5
6
  export type DatePickerValue = string | Date | (string | Date)[];
6
7
  export type DatePickerBaseProps = ControlledFormComponentProps<DatePickerValue> & {
@@ -41,13 +42,20 @@ export type DatePickerBaseProps = ControlledFormComponentProps<DatePickerValue>
41
42
  * @param dates - Array of selected dates.
42
43
  * @param dateStr - String representation of the selected date(s). Will match the date format.
43
44
  */
44
- onOpen?: (dates: Date[], dateStr: string) => void;
45
+ onOpen?: (dates: Date[], dateStr: string, calendarInstance: Instance) => void;
45
46
  /**
46
47
  * Callback function when the date picker is closed.
47
48
  * @param dates - Array of selected dates.
48
49
  * @param dateStr - String representation of the selected date(s). Will match the date format.
49
50
  */
50
- onClose?: (dates: Date[], dateStr: string) => void;
51
+ onClose?: (dates: Date[], dateStr: string, calendarInstance: Instance) => void;
52
+ /**
53
+ * Callback function when the calendar is ready and mounted.
54
+ * @param dates - Array of selected dates.
55
+ * @param dateStr - String representation of the selected date(s). Will match the date format.
56
+ * @param calendarInstance - The Flatpickr instance.
57
+ */
58
+ onReady?: (dates: Date[], dateStr: string, calendarInstance: Instance) => void;
51
59
  /**
52
60
  * render date picker inline
53
61
  */
@@ -0,0 +1,19 @@
1
+ import type { Instance } from 'flatpickr/dist/types/instance';
2
+ /**
3
+ * Applies variant props (theme attributes) to a DOM element
4
+ */
5
+ export declare function applyVariantProps(element: HTMLElement, variantProps: Record<string, string>): void;
6
+ /**
7
+ * Sets up a MutationObserver to sync the 'active' attribute based on the 'selected' class.
8
+ * Returns a cleanup function to disconnect the observer.
9
+ */
10
+ export declare function setupActiveSyncObserver(dayElem: HTMLElement): () => void;
11
+ /**
12
+ * Applies external CSS classes to the calendar container
13
+ */
14
+ export declare function applyExternalClasses(container: HTMLElement, className?: string): void;
15
+ /**
16
+ * Sets up dialog-specific behavior: ensures single-click opens the calendar
17
+ * Returns a cleanup function to remove event listeners.
18
+ */
19
+ export declare function setupDialogBehavior(calendarInstance: Instance): () => void;
@@ -3,6 +3,7 @@ import type { ModalComponentProps } from './ModalContext';
3
3
  interface DemoModalProps extends ModalComponentProps {
4
4
  title?: string;
5
5
  message?: string;
6
+ isLoading?: boolean;
6
7
  }
7
8
  declare const DemoModal: React.FC<DemoModalProps>;
8
9
  export default DemoModal;
@@ -15,7 +15,8 @@ export type ModalInstance = {
15
15
  /** Unique identifier for the modal instance */
16
16
  id: string;
17
17
  /** The rendered React component for the modal */
18
- component: ReactNode;
18
+ component: React.ComponentType<any>;
19
+ props: ModalComponentProps;
19
20
  };
20
21
  /**
21
22
  * The context type that provides modal management functionality.
@@ -43,6 +44,21 @@ export type ModalContextType = {
43
44
  * ```
44
45
  */
45
46
  openModal: <T extends ModalComponentProps>(id: string, Component: ComponentType<T>, props: T) => void;
47
+ /**
48
+ * Updates the props of an existing modal by its unique identifier.
49
+ *
50
+ * @template T - The props type for the modal component (must extend ModalComponentProps)
51
+ * @param id - The unique identifier of the modal to update
52
+ * @param newProps - The new props to merge with the existing props
53
+ * @returns void
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * const { updateModal } = useModalContext();
58
+ * updateModal('confirmation', { title: 'Updated Title' });
59
+ * ```
60
+ */
61
+ updateModal: <T extends ModalComponentProps>(id: string, newProps: Partial<T>) => void;
46
62
  /**
47
63
  * Closes and removes a modal by its unique identifier.
48
64
  *
@@ -84,4 +100,11 @@ export type UseModalReturn<T extends ModalComponentProps> = {
84
100
  closeModal: () => void;
85
101
  /** The unique identifier for this modal instance */
86
102
  modalId: string;
103
+ /**
104
+ * Updates the props of the modal instance managed by this hook.
105
+ *
106
+ * @param newProps - The new props to merge with the existing props
107
+ * @returns void
108
+ */
109
+ updateModal: (newProps: Partial<T>) => void;
87
110
  };
@@ -2062,6 +2062,12 @@ ul.ButtonGroup-module_buttonGroup__s1X98[component-variant=button-group-vertical
2062
2062
  --input-placeholder-line-height: var(--date-input-placeholder-line-height);
2063
2063
  --input-placeholder-color: var(--date-input-placeholder-color);
2064
2064
  }
2065
+ .DateInput-module_dateInput__hYA3X svg {
2066
+ pointer-events: none;
2067
+ }
2068
+ .DateInput-module_clickableWrapper__1zMm4 {
2069
+ cursor: pointer;
2070
+ }
2065
2071
  .flatpickr-calendar {
2066
2072
  background: transparent;
2067
2073
  opacity: 0;