@juspay/blend-design-system 0.0.17 → 0.0.18

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.
@@ -9,7 +9,7 @@ export declare function transformScatterData(data: NewNestedDataPoint[], selecte
9
9
  export declare function lightenHexColor(hex: string, amount?: number): string;
10
10
  export declare const formatNumber: (value: number | string) => string;
11
11
  export declare const capitaliseCamelCase: (text: string) => string;
12
- export declare const createSmartDateTimeFormatter: (timeZone?: string, hour12?: boolean) => ((value: string | number) => string);
13
- export declare const getAxisFormatterWithConfig: (axisType: AxisType, dateOnly?: boolean, smart?: boolean, timeZone?: string, hour12?: boolean) => ((value: string | number) => string);
12
+ export declare const createSmartDateTimeFormatter: (timeZone?: string, hour12?: boolean, showYear?: boolean) => ((value: string | number) => string);
13
+ export declare const getAxisFormatterWithConfig: (axisType: AxisType, dateOnly?: boolean, smart?: boolean, timeZone?: string, hour12?: boolean, showYear?: boolean, forTooltip?: boolean) => ((value: string | number) => string);
14
14
  export declare const createStableSmartFormatter: (xAxisConfig: XAxisConfig, flattenedData: FlattenedDataPoint[]) => ((value: string | number) => string) | undefined;
15
15
  export declare const getAxisFormatter: (axisType: AxisType, timeZone?: string, hour12?: boolean) => ((value: string | number) => string);
@@ -70,6 +70,7 @@ export type AxisConfig = {
70
70
  smart?: boolean;
71
71
  timeZone?: string;
72
72
  hour12?: boolean;
73
+ showYear?: boolean;
73
74
  };
74
75
  export type XAxisConfig = AxisConfig;
75
76
  export type YAxisConfig = AxisConfig;
@@ -129,6 +130,7 @@ export type ChartsProps = {
129
130
  xAxis?: XAxisConfig;
130
131
  yAxis?: YAxisConfig;
131
132
  noData?: NoDataProps;
133
+ height?: number;
132
134
  };
133
135
  export type FlattenedDataPoint = {
134
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, }: 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
  };
@@ -9,6 +9,19 @@ export type TableHeaderProps<T extends Record<string, unknown>> = {
9
9
  enableColumnManager?: boolean;
10
10
  columnManagerMaxSelections?: number;
11
11
  columnManagerAlwaysSelected?: string[];
12
+ columnManagerPrimaryAction?: {
13
+ text: string;
14
+ onClick: (selectedColumns: string[]) => void;
15
+ disabled?: boolean;
16
+ loading?: boolean;
17
+ };
18
+ columnManagerSecondaryAction?: {
19
+ text: string;
20
+ onClick: () => void;
21
+ disabled?: boolean;
22
+ loading?: boolean;
23
+ };
24
+ columnManagerWidth?: number;
12
25
  enableRowExpansion?: boolean;
13
26
  enableRowSelection?: boolean;
14
27
  rowActions?: RowActionsConfig<T>;
@@ -87,6 +87,19 @@ export type ColumnManagerProps<T extends Record<string, unknown>> = {
87
87
  onColumnChange: (columns: ColumnDefinition<T>[]) => void;
88
88
  maxSelections?: number;
89
89
  alwaysSelectedColumns?: string[];
90
+ columnManagerPrimaryAction?: {
91
+ text: string;
92
+ onClick: (selectedColumns: string[]) => void;
93
+ disabled?: boolean;
94
+ loading?: boolean;
95
+ };
96
+ columnManagerSecondaryAction?: {
97
+ text: string;
98
+ onClick: () => void;
99
+ disabled?: boolean;
100
+ loading?: boolean;
101
+ };
102
+ multiSelectWidth?: number;
90
103
  };
91
104
  export type AdvancedFilterProps = {
92
105
  filters: unknown[];
@@ -223,6 +236,19 @@ export type DataTableProps<T extends Record<string, unknown>> = {
223
236
  enableColumnManager?: boolean;
224
237
  columnManagerMaxSelections?: number;
225
238
  columnManagerAlwaysSelected?: (keyof T)[];
239
+ columnManagerPrimaryAction?: {
240
+ text: string;
241
+ onClick: (selectedColumns: string[]) => void;
242
+ disabled?: boolean;
243
+ loading?: boolean;
244
+ };
245
+ columnManagerSecondaryAction?: {
246
+ text: string;
247
+ onClick: () => void;
248
+ disabled?: boolean;
249
+ loading?: boolean;
250
+ };
251
+ columnManagerWidth?: number;
226
252
  pagination?: PaginationConfig;
227
253
  serverSidePagination?: boolean;
228
254
  onPageChange?: (page: number) => void;
@@ -6,6 +6,8 @@ type CalendarGridProps = {
6
6
  allowSingleDateSelection?: boolean;
7
7
  disableFutureDates?: boolean;
8
8
  disablePastDates?: boolean;
9
+ hideFutureDates?: boolean;
10
+ hidePastDates?: boolean;
9
11
  showDateTimePicker?: boolean;
10
12
  };
11
13
  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
+ };
@@ -20,11 +20,6 @@ export declare enum DateRangePickerSize {
20
20
  MEDIUM = "md",
21
21
  LARGE = "lg"
22
22
  }
23
- export type DateRange = {
24
- startDate: Date;
25
- endDate: Date;
26
- showTimePicker?: boolean;
27
- };
28
23
  /**
29
24
  * Predefined format presets for common date display patterns
30
25
  */
@@ -39,6 +34,39 @@ export declare enum DateFormatPreset {
39
34
  US_RANGE = "us-range",// "09/03/2025 - 09/05/2025"
40
35
  CUSTOM = "custom"
41
36
  }
37
+ /**
38
+ * Haptic feedback types for different interactions
39
+ */
40
+ export declare enum HapticFeedbackType {
41
+ SELECTION = "selection",
42
+ IMPACT = "impact",
43
+ NOTIFICATION = "notification"
44
+ }
45
+ /**
46
+ * Validation error types for date inputs
47
+ */
48
+ export declare enum DateValidationError {
49
+ NONE = "none",
50
+ INVALID_FORMAT = "format",
51
+ INVALID_DATE = "invalid-date",
52
+ OUT_OF_RANGE = "out-of-range",
53
+ INVALID_TIME_ORDER = "invalid-time-order",
54
+ MISSING_DATES = "missing-dates",
55
+ FUTURE_DATE_DISABLED = "future-date-disabled",
56
+ PAST_DATE_DISABLED = "past-date-disabled"
57
+ }
58
+ /**
59
+ * Calendar interaction modes
60
+ */
61
+ export declare enum CalendarInteractionMode {
62
+ SINGLE_DATE = "single-date",
63
+ DATE_RANGE = "date-range"
64
+ }
65
+ export type DateRange = {
66
+ startDate: Date;
67
+ endDate: Date;
68
+ showTimePicker?: boolean;
69
+ };
42
70
  /**
43
71
  * Custom format function type for advanced formatting
44
72
  */
@@ -78,6 +106,37 @@ export type TriggerConfig = {
78
106
  onClick: () => void;
79
107
  }) => ReactNode;
80
108
  };
109
+ /**
110
+ * Date validation result
111
+ */
112
+ export type DateValidationResult = {
113
+ isValid: boolean;
114
+ error: DateValidationError;
115
+ message?: string;
116
+ };
117
+ /**
118
+ * Date range validation result
119
+ */
120
+ export type DateRangeValidationResult = {
121
+ isValid: boolean;
122
+ error: DateValidationError;
123
+ message?: string;
124
+ };
125
+ /**
126
+ * Calendar month data structure
127
+ */
128
+ export type CalendarMonth = {
129
+ month: number;
130
+ year: number;
131
+ index?: number;
132
+ };
133
+ /**
134
+ * Picker column data
135
+ */
136
+ export type PickerColumnData = {
137
+ items: (string | number)[];
138
+ selectedIndex: number;
139
+ };
81
140
  export type DateRangePickerProps = {
82
141
  value?: DateRange;
83
142
  onChange?: (range: DateRange) => void;
@@ -92,21 +151,16 @@ export type DateRangePickerProps = {
92
151
  allowSingleDateSelection?: boolean;
93
152
  disableFutureDates?: boolean;
94
153
  disablePastDates?: boolean;
154
+ hideFutureDates?: boolean;
155
+ hidePastDates?: boolean;
95
156
  triggerElement?: ReactNode;
96
157
  useDrawerOnMobile?: boolean;
97
158
  skipQuickFiltersOnMobile?: boolean;
98
159
  size?: DateRangePickerSize;
99
160
  formatConfig?: DateFormatConfig;
100
161
  triggerConfig?: TriggerConfig;
162
+ maxMenuHeight?: number;
101
163
  };
102
- /**
103
- * Haptic feedback types for different interactions
104
- */
105
- export declare enum HapticFeedbackType {
106
- SELECTION = "selection",
107
- IMPACT = "impact",
108
- NOTIFICATION = "notification"
109
- }
110
164
  export type PresetItemProps = {
111
165
  preset: DateRangePreset;
112
166
  isActive: boolean;
@@ -120,6 +174,8 @@ export type ActionButtonsProps = {
120
174
  onCancel: () => void;
121
175
  onApply: () => void;
122
176
  isDisabled?: boolean;
177
+ isApplyDisabled?: boolean;
178
+ applyDisabledMessage?: string;
123
179
  };
124
180
  export type ScrollablePickerProps = {
125
181
  items: (string | number)[];
@@ -140,6 +196,8 @@ export type DatePickerComponentProps = {
140
196
  setStartDate: (date: string) => void;
141
197
  setEndDate: (date: string) => void;
142
198
  isDisabled?: boolean;
199
+ disableFutureDates?: boolean;
200
+ disablePastDates?: boolean;
143
201
  };
144
202
  export type MobileDrawerPresetsProps = {
145
203
  drawerOpen: boolean;
@@ -162,4 +220,8 @@ export type MobileDrawerPresetsProps = {
162
220
  handleApply: () => void;
163
221
  showCustomDropdownOnly?: boolean;
164
222
  isDisabled?: boolean;
223
+ isApplyDisabled?: boolean;
224
+ applyDisabledMessage?: string;
225
+ disableFutureDates?: boolean;
226
+ disablePastDates?: boolean;
165
227
  };
@@ -109,10 +109,10 @@ export declare const generateCalendarGrid: (year: number, month: number) => (num
109
109
  */
110
110
  export declare const isStartDate: (date: Date, selectedRange: DateRange) => boolean;
111
111
  /**
112
- * Checks if a date is the end date of a range
112
+ * Checks if a date is the end date of a range (but not if it's the same as start date)
113
113
  * @param date The date to check
114
114
  * @param selectedRange The selected date range
115
- * @returns True if the date is the end date
115
+ * @returns True if the date is the end date and different from start date
116
116
  */
117
117
  export declare const isEndDate: (date: Date, selectedRange: DateRange) => boolean;
118
118
  /**
@@ -130,7 +130,13 @@ export declare const isInSelectedRange: (date: Date, selectedRange: DateRange) =
130
130
  */
131
131
  export declare const isDateToday: (date: Date, today: Date) => boolean;
132
132
  /**
133
- * Handles date click logic for calendar
133
+ * Creates a proper single date range (24-hour selection within the same day)
134
+ * @param date The date to create a range for
135
+ * @returns DateRange spanning the entire day (same date, different times)
136
+ */
137
+ export declare const createSingleDateRange: (date: Date) => DateRange;
138
+ /**
139
+ * Handles date click logic for calendar with clean first click = start, second click = end pattern
134
140
  * @param clickedDate The date that was clicked
135
141
  * @param selectedRange Current selected range
136
142
  * @param allowSingleDateSelection Whether single date selection is allowed
@@ -326,9 +332,11 @@ export type DateRangePickerTokens = {
326
332
  * Validates date format and date values
327
333
  * @param value The input value to validate
328
334
  * @param format The expected format (e.g., 'dd/MM/yyyy')
335
+ * @param disableFutureDates Whether future dates should be disabled
336
+ * @param disablePastDates Whether past dates should be disabled
329
337
  * @returns Validation result with specific error type
330
338
  */
331
- export declare const validateDateInput: (value: string, format: string) => DateValidationResult;
339
+ export declare const validateDateInput: (value: string, format: string, disableFutureDates?: boolean, disablePastDates?: boolean) => DateValidationResult;
332
340
  /**
333
341
  * Formats date input as user types, adding slashes automatically
334
342
  * @param value The input value to format
@@ -356,9 +364,12 @@ export declare const formatDateDisplay: (selectedRange: DateRange, allowSingleDa
356
364
  * @param dateFormat Date format string
357
365
  * @param currentRange Current selected range
358
366
  * @param timeValue Current time value (HH:mm)
367
+ * @param isStartDate Whether this is start date or end date
368
+ * @param disableFutureDates Whether future dates should be disabled
369
+ * @param disablePastDates Whether past dates should be disabled
359
370
  * @returns Object with formatted value, validation result, and updated range
360
371
  */
361
- export declare const handleDateInputChange: (value: string, dateFormat: string, currentRange: DateRange, timeValue: string, isStartDate?: boolean) => {
372
+ export declare const handleDateInputChange: (value: string, dateFormat: string, currentRange: DateRange, timeValue: string, isStartDate?: boolean, disableFutureDates?: boolean, disablePastDates?: boolean) => {
362
373
  formattedValue: string;
363
374
  validation: DateValidationResult;
364
375
  updatedRange?: DateRange;
@@ -658,3 +669,61 @@ export declare const isValidTimeInput: (input: string) => boolean;
658
669
  * @returns Formatted time string
659
670
  */
660
671
  export declare const formatTimeInput: (input: string) => string;
672
+ /**
673
+ * Validates if a date range has valid date/time combinations
674
+ * @param range The date range to validate
675
+ * @param allowSingleDateSelection Whether single date selection is allowed
676
+ * @returns Validation result with specific error information
677
+ */
678
+ export declare const validateDateTimeRange: (range: DateRange) => {
679
+ isValid: boolean;
680
+ error: "none" | "invalid-time-order" | "missing-dates" | "invalid-single-date";
681
+ message?: string;
682
+ };
683
+ /**
684
+ * Checks if a date should be hidden from calendar view
685
+ * @param date The date to check
686
+ * @param today Today's date
687
+ * @param disableFutureDates Whether future dates should be hidden
688
+ * @param disablePastDates Whether past dates should be hidden
689
+ * @param hideFutureDates Whether to completely hide future dates (not just disable)
690
+ * @param hidePastDates Whether to completely hide past dates (not just disable)
691
+ * @returns True if the date should be hidden
692
+ */
693
+ export declare const shouldHideDateFromCalendar: (date: Date, today: Date, hideFutureDates?: boolean, hidePastDates?: boolean) => boolean;
694
+ /**
695
+ * Enhanced calendar date click handler with proper single date selection
696
+ * @param clickedDate The date that was clicked
697
+ * @param selectedRange Current selected range
698
+ * @param allowSingleDateSelection Whether single date selection is allowed
699
+ * @param today Today's date for validation
700
+ * @param disableFutureDates Whether future dates are disabled
701
+ * @param disablePastDates Whether past dates are disabled
702
+ * @param isDoubleClick Whether this is a double-click event
703
+ * @returns New date range or null if click should be ignored
704
+ */
705
+ export declare const handleEnhancedCalendarDateClick: (clickedDate: Date, selectedRange: DateRange, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, isDoubleClick?: boolean) => DateRange | null;
706
+ /**
707
+ * Checks if two dates represent the same calendar day (ignoring time and timezone)
708
+ */
709
+ export declare const isSameCalendarDay: (date1: Date, date2: Date) => boolean;
710
+ /**
711
+ * Checks if a date range represents a full day in any timezone
712
+ */
713
+ export declare const isFullDayRange: (startDate: Date, endDate: Date) => boolean;
714
+ /**
715
+ * Checks if a date range matches "Today" preset
716
+ */
717
+ export declare const matchesTodayPreset: (range: DateRange) => boolean;
718
+ /**
719
+ * Checks if a date range matches "Yesterday" preset
720
+ */
721
+ export declare const matchesYesterdayPreset: (range: DateRange) => boolean;
722
+ /**
723
+ * Checks if a date range matches "Tomorrow" preset
724
+ */
725
+ export declare const matchesTomorrowPreset: (range: DateRange) => boolean;
726
+ /**
727
+ * Robust preset detection that works with both UTC and local timezone dates
728
+ */
729
+ export declare const detectPresetFromRange: (range: DateRange) => DateRangePreset;
@@ -91,7 +91,7 @@ export type MultiSelectProps = {
91
91
  showActionButtons?: boolean;
92
92
  primaryAction?: {
93
93
  text: string;
94
- onClick: () => void;
94
+ onClick: (selectedValues: string[]) => void;
95
95
  disabled?: boolean;
96
96
  loading?: boolean;
97
97
  };
@@ -129,7 +129,7 @@ export type MultiSelectMenuProps = {
129
129
  showActionButtons?: boolean;
130
130
  primaryAction?: {
131
131
  text: string;
132
- onClick: () => void;
132
+ onClick: (selectedValues: string[]) => void;
133
133
  disabled?: boolean;
134
134
  loading?: boolean;
135
135
  };
@@ -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
  };