@juspay/blend-design-system 0.0.18-beta → 0.0.19-beta

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.
@@ -130,6 +130,7 @@ export type ChartsProps = {
130
130
  xAxis?: XAxisConfig;
131
131
  yAxis?: YAxisConfig;
132
132
  noData?: NoDataProps;
133
+ height?: number;
133
134
  };
134
135
  export type FlattenedDataPoint = {
135
136
  name: string;
@@ -1,5 +1,5 @@
1
1
  import { ColumnManagerProps } from './types';
2
2
  export declare const ColumnManager: {
3
- <T extends Record<string, unknown>>({ columns, visibleColumns, onColumnChange, maxSelections, alwaysSelectedColumns, columnManagerPrimaryAction, columnManagerSecondaryAction, }: ColumnManagerProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ <T extends Record<string, unknown>>({ columns, visibleColumns, onColumnChange, maxSelections, alwaysSelectedColumns, columnManagerPrimaryAction, columnManagerSecondaryAction, multiSelectWidth, }: ColumnManagerProps<T>): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
@@ -21,6 +21,7 @@ export type TableHeaderProps<T extends Record<string, unknown>> = {
21
21
  disabled?: boolean;
22
22
  loading?: boolean;
23
23
  };
24
+ columnManagerWidth?: number;
24
25
  enableRowExpansion?: boolean;
25
26
  enableRowSelection?: boolean;
26
27
  rowActions?: RowActionsConfig<T>;
@@ -99,6 +99,7 @@ export type ColumnManagerProps<T extends Record<string, unknown>> = {
99
99
  disabled?: boolean;
100
100
  loading?: boolean;
101
101
  };
102
+ multiSelectWidth?: number;
102
103
  };
103
104
  export type AdvancedFilterProps = {
104
105
  filters: unknown[];
@@ -247,6 +248,7 @@ export type DataTableProps<T extends Record<string, unknown>> = {
247
248
  disabled?: boolean;
248
249
  loading?: boolean;
249
250
  };
251
+ columnManagerWidth?: number;
250
252
  pagination?: PaginationConfig;
251
253
  serverSidePagination?: boolean;
252
254
  onPageChange?: (page: number) => void;
@@ -1,4 +1,4 @@
1
- import { DateRange } from './types';
1
+ import { DateRange, CustomRangeConfig } from './types';
2
2
  type CalendarGridProps = {
3
3
  selectedRange: DateRange;
4
4
  onDateSelect: (range: DateRange) => void;
@@ -8,6 +8,8 @@ type CalendarGridProps = {
8
8
  disablePastDates?: boolean;
9
9
  hideFutureDates?: boolean;
10
10
  hidePastDates?: boolean;
11
+ customDisableDates?: (date: Date) => boolean;
12
+ customRangeConfig?: CustomRangeConfig;
11
13
  showDateTimePicker?: boolean;
12
14
  };
13
15
  declare const CalendarGrid: import('react').ForwardRefExoticComponent<CalendarGridProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -10,6 +10,7 @@ type QuickRangeSelectorProps = {
10
10
  disablePastDates?: boolean;
11
11
  isDisabled?: boolean;
12
12
  size?: DateRangePickerSize;
13
+ maxMenuHeight?: number;
13
14
  };
14
15
  declare const QuickRangeSelector: import('react').ForwardRefExoticComponent<QuickRangeSelectorProps & import('react').RefAttributes<HTMLDivElement>>;
15
16
  export default QuickRangeSelector;
@@ -0,0 +1,23 @@
1
+ export declare const DATE_RANGE_PICKER_CONSTANTS: {
2
+ readonly DEFAULT_DATE_FORMAT: "dd/MM/yyyy";
3
+ readonly TIME_FORMAT: "HH:mm";
4
+ readonly PRESET_DETECTION_TOLERANCE_MS: number;
5
+ readonly TIMEZONE_TOLERANCE_HOURS: 25;
6
+ readonly CALENDAR_CONTAINER_HEIGHT: 340;
7
+ readonly CALENDAR_LOAD_THRESHOLD: 100;
8
+ readonly MONTH_BUFFER_SIZE: 2;
9
+ readonly MOBILE_PICKER: {
10
+ readonly ITEM_HEIGHT: 44;
11
+ readonly VISIBLE_ITEMS: 3;
12
+ };
13
+ readonly HAPTIC_PATTERNS: {
14
+ readonly SELECTION: readonly [8];
15
+ readonly IMPACT: readonly [15];
16
+ readonly NOTIFICATION: readonly [25, 40, 25];
17
+ };
18
+ readonly MIN_YEAR: 2012;
19
+ readonly MAX_YEAR_OFFSET: 10;
20
+ readonly TIME_MINUTE_INCREMENT: 15;
21
+ readonly SCROLL_DEBOUNCE_MS: 80;
22
+ readonly HAPTIC_COOLDOWN_MS: 50;
23
+ };
@@ -28,6 +28,11 @@ export type CalendarTokenType = {
28
28
  md: CSSObject['fontSize'];
29
29
  lg: CSSObject['fontSize'];
30
30
  };
31
+ disabled: {
32
+ borderLeft: CSSObject['borderLeft'];
33
+ borderTop: CSSObject['borderTop'];
34
+ borderBottom: CSSObject['borderBottom'];
35
+ };
31
36
  };
32
37
  content: {
33
38
  padding: CSSObject['padding'];
@@ -164,6 +169,7 @@ export type CalendarTokenType = {
164
169
  disabled: {
165
170
  opacity: CSSObject['opacity'];
166
171
  cursor: CSSObject['cursor'];
172
+ border: CSSObject['border'];
167
173
  };
168
174
  borderRadiusWithPresets: CSSObject['borderRadius'];
169
175
  borderRadiusWithoutPresets: CSSObject['borderRadius'];
@@ -4,8 +4,10 @@ export declare enum DateRangePreset {
4
4
  TODAY = "today",
5
5
  YESTERDAY = "yesterday",
6
6
  TOMORROW = "tomorrow",
7
+ LAST_30_MINS = "last30Mins",
7
8
  LAST_1_HOUR = "last1Hour",
8
9
  LAST_6_HOURS = "last6Hours",
10
+ LAST_24_HOURS = "last24Hours",
9
11
  LAST_7_DAYS = "last7Days",
10
12
  LAST_30_DAYS = "last30Days",
11
13
  LAST_3_MONTHS = "last3Months",
@@ -20,11 +22,6 @@ export declare enum DateRangePickerSize {
20
22
  MEDIUM = "md",
21
23
  LARGE = "lg"
22
24
  }
23
- export type DateRange = {
24
- startDate: Date;
25
- endDate: Date;
26
- showTimePicker?: boolean;
27
- };
28
25
  /**
29
26
  * Predefined format presets for common date display patterns
30
27
  */
@@ -39,6 +36,39 @@ export declare enum DateFormatPreset {
39
36
  US_RANGE = "us-range",// "09/03/2025 - 09/05/2025"
40
37
  CUSTOM = "custom"
41
38
  }
39
+ /**
40
+ * Haptic feedback types for different interactions
41
+ */
42
+ export declare enum HapticFeedbackType {
43
+ SELECTION = "selection",
44
+ IMPACT = "impact",
45
+ NOTIFICATION = "notification"
46
+ }
47
+ /**
48
+ * Validation error types for date inputs
49
+ */
50
+ export declare enum DateValidationError {
51
+ NONE = "none",
52
+ INVALID_FORMAT = "format",
53
+ INVALID_DATE = "invalid-date",
54
+ OUT_OF_RANGE = "out-of-range",
55
+ INVALID_TIME_ORDER = "invalid-time-order",
56
+ MISSING_DATES = "missing-dates",
57
+ FUTURE_DATE_DISABLED = "future-date-disabled",
58
+ PAST_DATE_DISABLED = "past-date-disabled"
59
+ }
60
+ /**
61
+ * Calendar interaction modes
62
+ */
63
+ export declare enum CalendarInteractionMode {
64
+ SINGLE_DATE = "single-date",
65
+ DATE_RANGE = "date-range"
66
+ }
67
+ export type DateRange = {
68
+ startDate: Date;
69
+ endDate: Date;
70
+ showTimePicker?: boolean;
71
+ };
42
72
  /**
43
73
  * Custom format function type for advanced formatting
44
74
  */
@@ -78,6 +108,107 @@ export type TriggerConfig = {
78
108
  onClick: () => void;
79
109
  }) => ReactNode;
80
110
  };
111
+ /**
112
+ * Date validation result
113
+ */
114
+ export type DateValidationResult = {
115
+ isValid: boolean;
116
+ error: DateValidationError;
117
+ message?: string;
118
+ };
119
+ /**
120
+ * Date range validation result
121
+ */
122
+ export type DateRangeValidationResult = {
123
+ isValid: boolean;
124
+ error: DateValidationError;
125
+ message?: string;
126
+ };
127
+ /**
128
+ * Calendar month data structure
129
+ */
130
+ export type CalendarMonth = {
131
+ month: number;
132
+ year: number;
133
+ index?: number;
134
+ };
135
+ /**
136
+ * Picker column data
137
+ */
138
+ export type PickerColumnData = {
139
+ items: (string | number)[];
140
+ selectedIndex: number;
141
+ };
142
+ /**
143
+ * Function type for custom date disabling logic
144
+ * @param date The date to check
145
+ * @returns true if the date should be disabled, false otherwise
146
+ */
147
+ export type CustomDateDisableFunction = (date: Date) => boolean;
148
+ /**
149
+ * Function type for custom range calculation
150
+ * @param selectedDate The date that was selected
151
+ * @param currentRange The current date range
152
+ * @param isStartDate Whether the selected date is for start or end
153
+ * @returns The new date range or null to use default behavior
154
+ */
155
+ export type CustomRangeCalculationFunction = (selectedDate: Date, currentRange: DateRange, isStartDate: boolean) => DateRange | null;
156
+ /**
157
+ * Configuration for automatic range calculation
158
+ */
159
+ export type AutoRangeConfig = {
160
+ /** Number of days to add to start date for end date */
161
+ rangeDays?: number;
162
+ /** Number of hours to add to start date for end date */
163
+ rangeHours?: number;
164
+ /** Number of minutes to add to start date for end date */
165
+ rangeMinutes?: number;
166
+ /** Whether to include the start date in the range (true) or exclude it (false) */
167
+ includeStartDate?: boolean;
168
+ /** Custom function to calculate the range */
169
+ customCalculation?: CustomRangeCalculationFunction;
170
+ };
171
+ /**
172
+ * Function type for custom range calculation
173
+ * @param startDate The selected start date
174
+ * @param currentRange The current selected range (if any)
175
+ * @returns The calculated end date, or null to use default behavior
176
+ */
177
+ export type CustomRangeCalculatorFunction = (startDate: Date, currentRange?: DateRange) => Date | null;
178
+ /**
179
+ * Configuration for custom range behavior
180
+ */
181
+ export type CustomRangeConfig = {
182
+ /**
183
+ * Function to calculate end date based on start date
184
+ */
185
+ calculateEndDate?: CustomRangeCalculatorFunction;
186
+ /**
187
+ * Fixed number of days for the range (alternative to calculateEndDate)
188
+ */
189
+ fixedDayRange?: number;
190
+ /**
191
+ * Reference date range to use for comparison/duration calculation
192
+ * When provided, the component will calculate a range with the same duration
193
+ */
194
+ referenceRange?: DateRange;
195
+ /**
196
+ * Number of days to go backward for backward ranges (e.g., last 5 days)
197
+ * Used when calculateEndDate returns the same date as clicked date
198
+ * @default 6
199
+ */
200
+ backwardDays?: number;
201
+ /**
202
+ * Whether to allow manual end date selection when using custom range logic
203
+ * @default false
204
+ */
205
+ allowManualEndDateSelection?: boolean;
206
+ /**
207
+ * Whether to apply custom range logic to preset selections
208
+ * @default false
209
+ */
210
+ applyToPresets?: boolean;
211
+ };
81
212
  export type DateRangePickerProps = {
82
213
  value?: DateRange;
83
214
  onChange?: (range: DateRange) => void;
@@ -94,21 +225,16 @@ export type DateRangePickerProps = {
94
225
  disablePastDates?: boolean;
95
226
  hideFutureDates?: boolean;
96
227
  hidePastDates?: boolean;
228
+ customDisableDates?: CustomDateDisableFunction;
229
+ customRangeConfig?: CustomRangeConfig;
97
230
  triggerElement?: ReactNode;
98
231
  useDrawerOnMobile?: boolean;
99
232
  skipQuickFiltersOnMobile?: boolean;
100
233
  size?: DateRangePickerSize;
101
234
  formatConfig?: DateFormatConfig;
102
235
  triggerConfig?: TriggerConfig;
236
+ maxMenuHeight?: number;
103
237
  };
104
- /**
105
- * Haptic feedback types for different interactions
106
- */
107
- export declare enum HapticFeedbackType {
108
- SELECTION = "selection",
109
- IMPACT = "impact",
110
- NOTIFICATION = "notification"
111
- }
112
238
  export type PresetItemProps = {
113
239
  preset: DateRangePreset;
114
240
  isActive: boolean;
@@ -1,4 +1,4 @@
1
- import { DateRange, DateRangePreset, DateFormatConfig, CustomFormatFunction, HapticFeedbackType } from './types';
1
+ import { DateRange, DateRangePreset, DateFormatConfig, CustomFormatFunction, HapticFeedbackType, CustomRangeConfig, CustomRangeCalculatorFunction } from './types';
2
2
  import { CalendarTokenType } from './dateRangePicker.tokens';
3
3
  /**
4
4
  * Formats a date according to the specified format
@@ -277,9 +277,10 @@ export declare const getScrollToMonth: (monthIndex: number, monthHeight: number)
277
277
  * @param today Today's date
278
278
  * @param disableFutureDates Whether future dates are disabled
279
279
  * @param disablePastDates Whether past dates are disabled
280
+ * @param customDisableDates Custom function to disable specific dates
280
281
  * @returns Object with all date states
281
282
  */
282
- export declare const getDateCellStates: (date: Date, selectedRange: DateRange, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean) => {
283
+ export declare const getDateCellStates: (date: Date, selectedRange: DateRange, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, customDisableDates?: (date: Date) => boolean) => {
283
284
  isStart: boolean;
284
285
  isEnd: boolean;
285
286
  isRangeDay: boolean;
@@ -473,9 +474,10 @@ export declare const createCalendarMonthData: (year: number, month: number, mont
473
474
  * @param disableFutureDates Whether future dates are disabled
474
475
  * @param disablePastDates Whether past dates are disabled
475
476
  * @param calendarToken Calendar token for styling
477
+ * @param customDisableDates Custom function to disable specific dates
476
478
  * @returns Day cell props
477
479
  */
478
- export declare const calculateDayCellProps: (date: Date, selectedRange: DateRange, today: Date, disableFutureDates: boolean, disablePastDates: boolean, calendarToken: CalendarTokenType) => {
480
+ export declare const calculateDayCellProps: (date: Date, selectedRange: DateRange, today: Date, disableFutureDates: boolean, disablePastDates: boolean, calendarToken: CalendarTokenType, customDisableDates?: (date: Date) => boolean) => {
479
481
  dateStates: ReturnType<typeof getDateCellStates>;
480
482
  styles: Record<string, unknown>;
481
483
  textColor: string | unknown;
@@ -703,3 +705,124 @@ export declare const shouldHideDateFromCalendar: (date: Date, today: Date, hideF
703
705
  * @returns New date range or null if click should be ignored
704
706
  */
705
707
  export declare const handleEnhancedCalendarDateClick: (clickedDate: Date, selectedRange: DateRange, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, isDoubleClick?: boolean) => DateRange | null;
708
+ /**
709
+ * Checks if two dates represent the same calendar day (ignoring time and timezone)
710
+ */
711
+ export declare const isSameCalendarDay: (date1: Date, date2: Date) => boolean;
712
+ /**
713
+ * Checks if a date range represents a full day in any timezone
714
+ */
715
+ export declare const isFullDayRange: (startDate: Date, endDate: Date) => boolean;
716
+ /**
717
+ * Checks if a date range matches "Today" preset
718
+ */
719
+ export declare const matchesTodayPreset: (range: DateRange) => boolean;
720
+ /**
721
+ * Checks if a date range matches "Yesterday" preset
722
+ */
723
+ export declare const matchesYesterdayPreset: (range: DateRange) => boolean;
724
+ /**
725
+ * Checks if a date range matches "Tomorrow" preset
726
+ */
727
+ export declare const matchesTomorrowPreset: (range: DateRange) => boolean;
728
+ /**
729
+ * Robust preset detection that works with both UTC and local timezone dates
730
+ */
731
+ export declare const detectPresetFromRange: (range: DateRange) => DateRangePreset;
732
+ /**
733
+ * Applies custom range calculation logic to a selected start date
734
+ * @param startDate The selected start date
735
+ * @param customRangeConfig Custom range configuration
736
+ * @param currentRange Current selected range (optional)
737
+ * @returns Calculated range or null to use default behavior
738
+ */
739
+ export declare const applyCustomRangeCalculation: (startDate: Date, customRangeConfig: CustomRangeConfig, currentRange?: DateRange) => DateRange | null;
740
+ /**
741
+ * Enhanced calendar date click handler with custom range calculation support
742
+ * @param clickedDate The date that was clicked
743
+ * @param selectedRange Current selected range
744
+ * @param allowSingleDateSelection Whether single date selection is allowed
745
+ * @param today Today's date for validation
746
+ * @param disableFutureDates Whether future dates are disabled
747
+ * @param disablePastDates Whether past dates are disabled
748
+ * @param customRangeConfig Custom range configuration
749
+ * @param isDoubleClick Whether this is a double-click event
750
+ * @returns New date range or null if click should be ignored
751
+ */
752
+ export declare const handleCustomRangeCalendarDateClick: (clickedDate: Date, selectedRange: DateRange, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, customRangeConfig?: CustomRangeConfig, isDoubleClick?: boolean) => DateRange | null;
753
+ /**
754
+ * Validates custom range configuration
755
+ * @param config Custom range configuration to validate
756
+ * @returns Validation result with error message if invalid
757
+ */
758
+ export declare const validateCustomRangeConfig: (config: CustomRangeConfig) => {
759
+ isValid: boolean;
760
+ error?: string;
761
+ };
762
+ /**
763
+ * Creates common custom range calculation functions
764
+ */
765
+ export declare const createCustomRangeCalculators: {
766
+ /**
767
+ * Creates a calculator for fixed number of days
768
+ * @param days Number of days for the range
769
+ * @returns Custom range calculator function
770
+ */
771
+ fixedDays: (days: number) => CustomRangeCalculatorFunction;
772
+ /**
773
+ * Creates a calculator for business days (excluding weekends)
774
+ * @param businessDays Number of business days
775
+ * @returns Custom range calculator function
776
+ */
777
+ businessDays: (businessDays: number) => CustomRangeCalculatorFunction;
778
+ /**
779
+ * Creates a calculator for end of week (Sunday)
780
+ * @returns Custom range calculator function
781
+ */
782
+ endOfWeek: () => CustomRangeCalculatorFunction;
783
+ /**
784
+ * Creates a calculator for end of month
785
+ * @returns Custom range calculator function
786
+ */
787
+ endOfMonth: () => CustomRangeCalculatorFunction;
788
+ /**
789
+ * Creates a calculator for quarter end
790
+ * @returns Custom range calculator function
791
+ */
792
+ endOfQuarter: () => CustomRangeCalculatorFunction;
793
+ /**
794
+ * Creates a calculator that compares with another date range
795
+ * @param compareRange The range to compare with
796
+ * @returns Custom range calculator function
797
+ */
798
+ compareWithRange: (compareRange: DateRange) => CustomRangeCalculatorFunction;
799
+ };
800
+ /**
801
+ * Helper function to create common custom range configurations
802
+ */
803
+ export declare const createCustomRangeConfigs: {
804
+ /**
805
+ * Fixed 5-day range
806
+ */
807
+ fiveDayRange: () => CustomRangeConfig;
808
+ /**
809
+ * Fixed 7-day range (week)
810
+ */
811
+ weekRange: () => CustomRangeConfig;
812
+ /**
813
+ * Business week (5 business days)
814
+ */
815
+ businessWeek: () => CustomRangeConfig;
816
+ /**
817
+ * Month range (start date to end of month)
818
+ */
819
+ monthRange: () => CustomRangeConfig;
820
+ /**
821
+ * Quarter range (start date to end of quarter)
822
+ */
823
+ quarterRange: () => CustomRangeConfig;
824
+ /**
825
+ * Flexible range with manual override
826
+ */
827
+ flexibleRange: (defaultDays: number) => CustomRangeConfig;
828
+ };
@@ -1,6 +1,6 @@
1
1
  import { PopoverProps } from './types';
2
2
  declare const Popover: {
3
- ({ heading, description, trigger, children, showCloseButton, onOpenChange, open, asModal, primaryAction, secondaryAction, sideOffset, side, align, alignOffset, width, minWidth, maxWidth, height, minHeight, maxHeight, zIndex, size, onClose, shadow, useDrawerOnMobile, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ heading, description, trigger, children, showCloseButton, onOpenChange, open, asModal, primaryAction, secondaryAction, sideOffset, side, align, alignOffset, width, minWidth, maxWidth, height, minHeight, maxHeight, zIndex, size, onClose, shadow, useDrawerOnMobile, avoidCollisions, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default Popover;
@@ -30,4 +30,5 @@ export type PopoverProps = {
30
30
  onClose?: () => void;
31
31
  shadow?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
32
32
  useDrawerOnMobile?: boolean;
33
+ avoidCollisions?: boolean;
33
34
  };