@lax-wp/design-system 0.3.59 → 0.3.60

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,72 +1,69 @@
1
- /**
2
- * Date range value type
3
- */
4
- export interface DateRangeValue {
5
- /** Start date */
6
- startDate: Date | null;
7
- /** End date */
8
- endDate: Date | null;
9
- }
10
1
  /**
11
2
  * Props for the DateRange component
3
+ * Matches the lax-web-portal implementation for drop-in replacement
12
4
  */
13
- export interface DateRangeProps {
5
+ export type TDateRangeProps = {
14
6
  /** Unique identifier for the date range */
15
7
  id: string;
16
8
  /** Label text to display above the date range */
17
9
  label?: string;
18
- /** Current date range value */
19
- value?: DateRangeValue;
20
- /** Default date range value */
21
- defaultValue?: DateRangeValue;
10
+ /** Start date value (ISO string or formatted date string) */
11
+ startDate: string;
12
+ /** End date value (ISO string or formatted date string) */
13
+ endDate: string;
22
14
  /** Callback function called when date range changes */
23
- onChange: (value: DateRangeValue) => void;
24
- /** Whether the date range is disabled */
25
- disabled?: boolean;
15
+ onChange(data: any): void;
16
+ /** Callback function called when calendar selection changes */
17
+ onCalendarChange?(data: any): void;
26
18
  /** Whether the field is required */
27
19
  required?: boolean;
28
- /** Message to display below the date range */
29
- message?: string;
30
- /** Type of message to display */
31
- messageType?: "success" | "error" | "info" | "default";
32
- /** Additional CSS classes for the wrapper container */
33
- wrapperClassName?: string;
34
- /** Additional CSS classes for the input containers */
35
- inputClassName?: string;
36
- /** Additional CSS classes for the label */
37
- labelClassName?: string;
38
- /** Help text to display below the label */
39
- helpText?: string;
40
- /** Size variant for the inputs */
41
- size?: "small" | "medium" | "large";
42
- /** Date format for display */
20
+ /** Error message to display below the date range */
21
+ errorMessage?: string;
22
+ /** Additional CSS classes for the wrapper */
23
+ className?: string;
24
+ /** Whether the date range is disabled */
25
+ disabled?: boolean;
26
+ /** Custom date format */
43
27
  dateFormat?: string;
44
- /** Minimum date allowed */
45
- minDate?: Date;
46
- /** Maximum date allowed */
47
- maxDate?: Date;
48
- /** Placeholder text for start date */
49
- startPlaceholder?: string;
50
- /** Placeholder text for end date */
51
- endPlaceholder?: string;
52
- /** Whether to allow clearing the selection */
53
- allowClear?: boolean;
54
- /** Additional props to pass to the input elements */
55
- inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
56
- }
28
+ /** Whether popup should render inside parent element */
29
+ shouldPopOnParent?: boolean;
30
+ /** Custom function to get popup container */
31
+ getPopupContainer?: (trigger: HTMLElement | null) => HTMLElement;
32
+ /** Maximum date range in days */
33
+ maxDateRange?: number;
34
+ /** Whether the picker is open */
35
+ open?: boolean;
36
+ /** Callback function called when open state changes */
37
+ onOpenChange?(open: boolean): void;
38
+ /** Placement of the dropdown */
39
+ placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
40
+ /** Whether the component is in dark mode */
41
+ isDarkMode?: boolean;
42
+ };
57
43
  /**
58
- * A highly customizable date range component with label, validation, and styling support.
44
+ * A date range picker component with label, validation, and styling support.
59
45
  * Features proper date handling, validation, and comprehensive prop support.
46
+ * Built on top of Ant Design's RangePicker for advanced functionality.
47
+ *
48
+ * This component is designed as a drop-in replacement for the lax-web-portal
49
+ * DateRange component.
60
50
  *
61
51
  * @example
62
52
  * ```tsx
63
53
  * <DateRange
64
54
  * id="event-dates"
65
55
  * label="Event Duration"
66
- * value={dateRange}
67
- * onChange={(range) => setDateRange(range)}
56
+ * startDate={startDate}
57
+ * endDate={endDate}
58
+ * onChange={(dates) => {
59
+ * setStartDate(dates[0]);
60
+ * setEndDate(dates[1]);
61
+ * }}
68
62
  * required
69
63
  * />
70
64
  * ```
71
65
  */
72
- export declare const DateRange: import("react").ForwardRefExoticComponent<DateRangeProps & import("react").RefAttributes<HTMLDivElement>>;
66
+ export declare const DateRange: {
67
+ ({ onCalendarChange, onChange, required, label, startDate, endDate, errorMessage, className, id, disabled, dateFormat, shouldPopOnParent, getPopupContainer: customGetPopupContainer, maxDateRange, open, onOpenChange, placement, isDarkMode, }: TDateRangeProps): import("react/jsx-runtime").JSX.Element;
68
+ displayName: string;
69
+ };
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Date range value type
3
+ */
4
+ export interface DateRangeValue {
5
+ /** Start date */
6
+ startDate: Date | null;
7
+ /** End date */
8
+ endDate: Date | null;
9
+ }
10
+ /**
11
+ * Props for the DateRange component
12
+ */
13
+ export interface DateRangeProps {
14
+ /** Unique identifier for the date range */
15
+ id: string;
16
+ /** Label text to display above the date range */
17
+ label?: string;
18
+ /** Current date range value */
19
+ value?: DateRangeValue;
20
+ /** Default date range value */
21
+ defaultValue?: DateRangeValue;
22
+ /** Callback function called when date range changes */
23
+ onChange: (value: DateRangeValue) => void;
24
+ /** Whether the date range is disabled */
25
+ disabled?: boolean;
26
+ /** Whether the field is required */
27
+ required?: boolean;
28
+ /** Message to display below the date range */
29
+ message?: string;
30
+ /** Type of message to display */
31
+ messageType?: "success" | "error" | "info" | "default";
32
+ /** Additional CSS classes for the wrapper container */
33
+ wrapperClassName?: string;
34
+ /** Additional CSS classes for the input containers */
35
+ inputClassName?: string;
36
+ /** Additional CSS classes for the label */
37
+ labelClassName?: string;
38
+ /** Help text to display below the label */
39
+ helpText?: string;
40
+ /** Size variant for the inputs */
41
+ size?: "small" | "medium" | "large";
42
+ /** Date format for display */
43
+ dateFormat?: string;
44
+ /** Minimum date allowed */
45
+ minDate?: Date;
46
+ /** Maximum date allowed */
47
+ maxDate?: Date;
48
+ /** Placeholder text for start date */
49
+ startPlaceholder?: string;
50
+ /** Placeholder text for end date */
51
+ endPlaceholder?: string;
52
+ /** Whether to allow clearing the selection */
53
+ allowClear?: boolean;
54
+ /** Additional props to pass to the input elements */
55
+ inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
56
+ }
57
+ /**
58
+ * A highly customizable date range component with label, validation, and styling support.
59
+ * Features proper date handling, validation, and comprehensive prop support.
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * <DateRange
64
+ * id="event-dates"
65
+ * label="Event Duration"
66
+ * value={dateRange}
67
+ * onChange={(range) => setDateRange(range)}
68
+ * required
69
+ * />
70
+ * ```
71
+ */
72
+ export declare const DateRange2: import("react").ForwardRefExoticComponent<DateRangeProps & import("react").RefAttributes<HTMLDivElement>>;
package/dist/index.d.ts CHANGED
@@ -24,8 +24,10 @@ export type { CustomizableSelectFieldProps, CustomizableSelectOption, OptionConf
24
24
  export { CurrencyInputField } from "./components/forms/currency-input/CurrencyInputField";
25
25
  export type { CurrencyInputFieldProps, RiskDetails as CurrencyInputFieldRiskDetails, RiskDetailsCardProps as CurrencyInputFieldRiskDetailsCardProps, } from "./components/forms/currency-input/CurrencyInputField";
26
26
  export { CURRENCIES, CURRENCY_SYMBOLS } from "./components/forms/currency-input/currency.constant";
27
+ export { DateRange2 } from "./components/forms/date-range/DateRange2";
28
+ export type { DateRangeProps, DateRangeValue, } from "./components/forms/date-range/DateRange2";
27
29
  export { DateRange } from "./components/forms/date-range/DateRange";
28
- export type { DateRangeProps, DateRangeValue, } from "./components/forms/date-range/DateRange";
30
+ export type { TDateRangeProps } from "./components/forms/date-range/DateRange";
29
31
  export { DateTimeField, UNIVERSAL_DATE_FORMAT, UNIVERSAL_DATETIME_FORMAT, } from "./components/forms/date-time-field/DateTimeField";
30
32
  export type { DateTimeFieldProps, RiskDetails as DateTimeFieldRiskDetails, RiskDetailsCardProps as DateTimeFieldRiskDetailsCardProps, } from "./components/forms/date-time-field/DateTimeField";
31
33
  export { DebounceInputField } from "./components/forms/debounce-input/DebounceInputField";