@juspay/blend-design-system 0.0.19-beta → 0.0.20-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.
- package/dist/components/Charts/ChartUtils.d.ts +92 -5
- package/dist/components/Charts/DateTimeFormatter.d.ts +151 -0
- package/dist/components/Charts/types.d.ts +7 -3
- package/dist/components/DateRangePicker/QuickRangeSelector.d.ts +3 -1
- package/dist/components/DateRangePicker/types.d.ts +39 -1
- package/dist/components/DateRangePicker/utils.d.ts +70 -75
- package/dist/components/Menu/Menu.d.ts +1 -1
- package/dist/components/Menu/types.d.ts +4 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelectMenu.d.ts +1 -1
- package/dist/components/MultiSelect/types.d.ts +16 -0
- package/dist/components/SingleSelect/SingleSelect.d.ts +1 -1
- package/dist/components/SingleSelect/SingleSelectMenu.d.ts +9 -1
- package/dist/components/SingleSelect/types.d.ts +8 -0
- package/dist/components/StatCard/types.d.ts +5 -3
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/types.d.ts +1 -0
- package/dist/components/VirtualList/VirtualList.d.ts +4 -0
- package/dist/components/VirtualList/index.d.ts +3 -0
- package/dist/components/VirtualList/types.d.ts +79 -0
- package/dist/components/VirtualList/utils.d.ts +30 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +16099 -14985
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NewNestedDataPoint, FlattenedDataPoint,
|
|
1
|
+
import { NewNestedDataPoint, FlattenedDataPoint, AxisConfig } from './types';
|
|
2
2
|
export declare function transformNestedData(data: NewNestedDataPoint[], selectedKeys?: string[]): FlattenedDataPoint[];
|
|
3
3
|
export declare function transformScatterData(data: NewNestedDataPoint[], selectedKeys?: string[]): Array<{
|
|
4
4
|
name: string;
|
|
@@ -9,7 +9,94 @@ 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
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export type DateTimeFormatterOptions = {
|
|
13
|
+
useUTC?: boolean;
|
|
14
|
+
formatString?: string;
|
|
15
|
+
dateOnly?: boolean;
|
|
16
|
+
timeOnly?: boolean;
|
|
17
|
+
showYear?: boolean;
|
|
18
|
+
smartDateTimeFormat?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a DateTime formatter with custom options
|
|
22
|
+
* @param options - Configuration options for the formatter
|
|
23
|
+
* @param options.useUTC - Whether to use UTC timezone (default: true)
|
|
24
|
+
* @param options.formatString - Optional custom format string
|
|
25
|
+
* @param options.dateOnly - Show only dates (e.g., "1. Oct", "2. Oct")
|
|
26
|
+
* @param options.timeOnly - Show only times (e.g., "12:00", "13:00")
|
|
27
|
+
* @param options.showYear - Include year in the output (works with dateOnly and default mode)
|
|
28
|
+
* @param options.smartDateTimeFormat - Alternates between date and time like Highcharts
|
|
29
|
+
* @returns A formatter function that handles timestamps from any timezone
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Date only without year: "1. Oct" "2. Oct" "3. Oct"
|
|
33
|
+
* createDateTimeFormatter({ dateOnly: true, showYear: false })
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Date only with year: "1. Oct 2024" "2. Oct 2024"
|
|
37
|
+
* createDateTimeFormatter({ dateOnly: true, showYear: true })
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Time only: "00:00" "06:00" "12:00"
|
|
41
|
+
* createDateTimeFormatter({ timeOnly: true })
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Smart format (alternates): "1. Oct" "12:00" "2. Oct" "12:00"
|
|
45
|
+
* createDateTimeFormatter({ smartDateTimeFormat: true })
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Default with year: "1 Oct 2024, 12:00"
|
|
49
|
+
* createDateTimeFormatter({ showYear: true })
|
|
50
|
+
*/
|
|
51
|
+
export declare const createDateTimeFormatter: (options?: DateTimeFormatterOptions) => ((value: string | number) => string);
|
|
52
|
+
/**
|
|
53
|
+
* Get a formatter function based on axis type with optional DateTime customization
|
|
54
|
+
* @param axisType - The type of axis (DATE_TIME, CURRENCY, PERCENTAGE, NUMBER)
|
|
55
|
+
* @param dateTimeOptions - Options for DateTime formatting (only used when axisType is DATE_TIME)
|
|
56
|
+
* @returns A formatter function for the specified axis type
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Simple usage with default UTC
|
|
60
|
+
* getAxisFormatter(AxisType.DATE_TIME)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Date only without year
|
|
64
|
+
* getAxisFormatter(AxisType.DATE_TIME, { dateOnly: true })
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Date only with year
|
|
68
|
+
* getAxisFormatter(AxisType.DATE_TIME, { dateOnly: true, showYear: true })
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Time only
|
|
72
|
+
* getAxisFormatter(AxisType.DATE_TIME, { timeOnly: true })
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* // Local timezone instead of UTC
|
|
76
|
+
* getAxisFormatter(AxisType.DATE_TIME, { useUTC: false })
|
|
77
|
+
*/
|
|
78
|
+
export declare const getAxisFormatter: (finalAxis: AxisConfig) => ((value: string | number) => string);
|
|
79
|
+
/**
|
|
80
|
+
* Suggests an optimal tick interval based on the data range
|
|
81
|
+
* Automatically determines whether to use minutes, hours, days, etc.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getSuggestedTickInterval(data: NewNestedDataPoint[], maxTicks?: number): {
|
|
84
|
+
interval: number;
|
|
85
|
+
description: string;
|
|
86
|
+
unit: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Generates consistent, evenly-spaced tick values for datetime axes
|
|
90
|
+
* This mimics Highcharts behavior where ticks are at regular intervals
|
|
91
|
+
*
|
|
92
|
+
* @param data - Chart data with timestamps in 'name' field
|
|
93
|
+
* @param options - Configuration options
|
|
94
|
+
* @returns Object containing tick array (as strings to match data format) and formatter function
|
|
95
|
+
*/
|
|
96
|
+
export declare function generateConsistentDateTimeTicks(data: NewNestedDataPoint[], options?: DateTimeFormatterOptions & {
|
|
97
|
+
maxTicks?: number;
|
|
98
|
+
customInterval?: number;
|
|
99
|
+
}): {
|
|
100
|
+
ticks: string[];
|
|
101
|
+
formatter: (value: string | number) => string;
|
|
102
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Highcharts-style DateTime Formatter Utility for Charts (Functional)
|
|
3
|
+
*
|
|
4
|
+
* This utility provides Highcharts-compatible datetime formatting for charts.
|
|
5
|
+
* It intelligently formats timestamps based on the data range and supports
|
|
6
|
+
* custom format strings similar to Highcharts' dateTimeLabelFormats.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TIME_UNITS: {
|
|
9
|
+
readonly millisecond: 1;
|
|
10
|
+
readonly second: 1000;
|
|
11
|
+
readonly minute: 60000;
|
|
12
|
+
readonly hour: 3600000;
|
|
13
|
+
readonly day: 86400000;
|
|
14
|
+
readonly week: 604800000;
|
|
15
|
+
readonly month: 2592000000;
|
|
16
|
+
readonly year: 31536000000;
|
|
17
|
+
};
|
|
18
|
+
export type TimeUnit = keyof typeof TIME_UNITS;
|
|
19
|
+
export declare const DEFAULT_DATE_TIME_FORMATS: Record<TimeUnit, string>;
|
|
20
|
+
export interface DateTimeFormatterConfig {
|
|
21
|
+
useUTC?: boolean;
|
|
22
|
+
customFormats?: Partial<Record<TimeUnit, string>>;
|
|
23
|
+
startOfWeek?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Parse and validate a timestamp value
|
|
27
|
+
* Handles: numbers, numeric strings, ISO strings, seconds vs milliseconds
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseTimestamp(value: string | number): number | null;
|
|
30
|
+
/**
|
|
31
|
+
* Determines the most appropriate time unit based on data range
|
|
32
|
+
*/
|
|
33
|
+
export declare function getTimeUnit(dataRange: number): TimeUnit;
|
|
34
|
+
/**
|
|
35
|
+
* Get time unit from an array of timestamps
|
|
36
|
+
*/
|
|
37
|
+
export declare function getTimeUnitFromData(timestamps: number[]): TimeUnit;
|
|
38
|
+
/**
|
|
39
|
+
* Normalize timestamp to the nearest time unit boundary
|
|
40
|
+
* This ensures consistent tick positioning like Highcharts
|
|
41
|
+
*/
|
|
42
|
+
export declare function normalizeTimestamp(timestamp: number, timeUnit: TimeUnit, config?: DateTimeFormatterConfig): number;
|
|
43
|
+
/**
|
|
44
|
+
* Formats a timestamp according to a format string (Highcharts-style)
|
|
45
|
+
*
|
|
46
|
+
* Format tokens:
|
|
47
|
+
* - %Y: 4-digit year (2024)
|
|
48
|
+
* - %y: 2-digit year (24)
|
|
49
|
+
* - %m: 2-digit month (01-12)
|
|
50
|
+
* - %b: Short month name (Jan)
|
|
51
|
+
* - %B: Full month name (January)
|
|
52
|
+
* - %d: 2-digit day (01-31)
|
|
53
|
+
* - %e: Day without leading zero (1-31)
|
|
54
|
+
* - %H: 2-digit hour 24h (00-23)
|
|
55
|
+
* - %I: 2-digit hour 12h (01-12)
|
|
56
|
+
* - %M: 2-digit minute (00-59)
|
|
57
|
+
* - %S: 2-digit second (00-59)
|
|
58
|
+
* - %L: Milliseconds (000-999)
|
|
59
|
+
* - %p: AM/PM
|
|
60
|
+
* - %A: Full weekday name (Monday)
|
|
61
|
+
* - %a: Short weekday name (Mon)
|
|
62
|
+
* - %%: Literal % character
|
|
63
|
+
*/
|
|
64
|
+
export declare function dateFormat(formatString: string, timestamp: number, config?: DateTimeFormatterConfig): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get the appropriate date format for a given time unit
|
|
67
|
+
*/
|
|
68
|
+
export declare function getDateFormat(timeUnit: TimeUnit, config?: DateTimeFormatterConfig): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get optimal tick interval to prevent cluttered axes
|
|
71
|
+
* Returns recommended number of milliseconds between ticks
|
|
72
|
+
*/
|
|
73
|
+
export declare function getOptimalTickInterval(dataRange: number, maxTicks?: number): {
|
|
74
|
+
interval: number;
|
|
75
|
+
unit: TimeUnit;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Generate evenly spaced tick values for a time range
|
|
79
|
+
* This prevents cluttered axes by ensuring consistent spacing
|
|
80
|
+
*/
|
|
81
|
+
export declare function generateTickValues(minTimestamp: number, maxTimestamp: number, maxTicks?: number, config?: DateTimeFormatterConfig): number[];
|
|
82
|
+
/**
|
|
83
|
+
* Generate ticks at a custom interval (in milliseconds)
|
|
84
|
+
* Useful for forcing specific tick spacing (e.g., every 6 hours)
|
|
85
|
+
*/
|
|
86
|
+
export declare function generateTicksAtInterval(minTimestamp: number, maxTimestamp: number, intervalMs: number, timeUnit?: TimeUnit, config?: DateTimeFormatterConfig): number[];
|
|
87
|
+
/**
|
|
88
|
+
* Create a basic formatter function for a specific time unit
|
|
89
|
+
*/
|
|
90
|
+
export declare function createFormatter(timeUnit: TimeUnit, config?: DateTimeFormatterConfig): (value: number) => string;
|
|
91
|
+
/**
|
|
92
|
+
* Create a formatter function for chart axes with auto time unit detection
|
|
93
|
+
*/
|
|
94
|
+
export declare function createAxisFormatter(timestamps: number[], config?: DateTimeFormatterConfig): (value: number) => string;
|
|
95
|
+
/**
|
|
96
|
+
* Create a smart formatter that shows date on day change, time otherwise
|
|
97
|
+
* Similar to Highcharts' smart datetime formatting
|
|
98
|
+
*/
|
|
99
|
+
export declare function createSmartFormatter(timestamps: number[], showYear?: boolean, config?: DateTimeFormatterConfig): (value: number) => string;
|
|
100
|
+
/**
|
|
101
|
+
* Create an alternating date/time formatter
|
|
102
|
+
* Shows date on even ticks, time on odd ticks (e.g., "1 Oct", "12:00", "2 Oct", "12:00")
|
|
103
|
+
*/
|
|
104
|
+
export declare function createAlternatingFormatter(ticks: number[], dateFormatStr?: string, timeFormatStr?: string, config?: DateTimeFormatterConfig): (value: number) => string;
|
|
105
|
+
/**
|
|
106
|
+
* Format multiple timestamps
|
|
107
|
+
*/
|
|
108
|
+
export declare function formatMultiple(timestamps: number[], timeUnit?: TimeUnit, config?: DateTimeFormatterConfig): string[];
|
|
109
|
+
/**
|
|
110
|
+
* Generate date-only ticks (for Charts dateOnly mode)
|
|
111
|
+
* Returns ticks at day boundaries with date-only labels
|
|
112
|
+
*/
|
|
113
|
+
export declare function createDateOnlyTicksAndFormatter(minTimestamp: number, maxTimestamp: number, maxTicks?: number, showYear?: boolean, config?: DateTimeFormatterConfig): {
|
|
114
|
+
ticks: number[];
|
|
115
|
+
formatter: (value: number) => string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Generate time-only ticks spanning the entire data range
|
|
119
|
+
* Shows times at regular intervals (e.g., every 15 minutes, 1 hour, etc.)
|
|
120
|
+
*/
|
|
121
|
+
export declare function createTimeOnlyTicksAndFormatter(minTimestamp: number, maxTimestamp: number, intervalMinutes?: number, maxTicks?: number, config?: DateTimeFormatterConfig): {
|
|
122
|
+
ticks: number[];
|
|
123
|
+
formatter: (value: number) => string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Generate ticks with alternating date and time labels
|
|
127
|
+
* Pattern: Date, Time, Date, Time, etc.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createDateTimeAlternatingTicksAndFormatter(minTimestamp: number, maxTimestamp: number, intervalMs?: number, showYear?: boolean, maxTicks?: number, config?: DateTimeFormatterConfig): {
|
|
130
|
+
ticks: number[];
|
|
131
|
+
formatter: (value: number) => string;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* All-in-one helper: Generate ticks and create alternating formatter
|
|
135
|
+
*/
|
|
136
|
+
export declare function createAlternatingTicksAndFormatter(minTimestamp: number, maxTimestamp: number, intervalMs: number, options?: {
|
|
137
|
+
timeUnit?: TimeUnit;
|
|
138
|
+
dateFormat?: string;
|
|
139
|
+
timeFormat?: string;
|
|
140
|
+
}, config?: DateTimeFormatterConfig): {
|
|
141
|
+
ticks: number[];
|
|
142
|
+
formatter: (value: number) => string;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Create a dynamic tick generator that adapts to available width
|
|
146
|
+
* This prevents tick collision by adjusting density based on chart width
|
|
147
|
+
*/
|
|
148
|
+
export declare function createResponsiveTicksAndFormatter(minTimestamp: number, maxTimestamp: number, chartWidthPx: number, avgLabelWidthPx?: number, mode?: 'dateOnly' | 'timeOnly' | 'alternating' | 'smart', showYear?: boolean, config?: DateTimeFormatterConfig): {
|
|
149
|
+
ticks: number[];
|
|
150
|
+
formatter: (value: number) => string;
|
|
151
|
+
};
|
|
@@ -67,10 +67,14 @@ export type AxisConfig = {
|
|
|
67
67
|
tickFormatter?: (value: string | number) => string;
|
|
68
68
|
customTick?: React.ComponentType<TickProps>;
|
|
69
69
|
dateOnly?: boolean;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
useUTC?: boolean;
|
|
71
|
+
formatString?: string;
|
|
72
|
+
timeOnly?: boolean;
|
|
73
73
|
showYear?: boolean;
|
|
74
|
+
ticks?: (number | string)[];
|
|
75
|
+
autoConsistentTicks?: boolean;
|
|
76
|
+
maxTicks?: number;
|
|
77
|
+
smartDateTimeFormat?: boolean;
|
|
74
78
|
};
|
|
75
79
|
export type XAxisConfig = AxisConfig;
|
|
76
80
|
export type YAxisConfig = AxisConfig;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { DateRangePreset, DateRangePickerSize } from './types';
|
|
1
|
+
import { DateRangePreset, DateRangePickerSize, CustomPresetConfig } from './types';
|
|
2
2
|
type QuickRangeSelectorProps = {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
onToggle: () => void;
|
|
5
5
|
activePreset: DateRangePreset;
|
|
6
6
|
onPresetSelect: (preset: DateRangePreset) => void;
|
|
7
7
|
excludeCustom?: boolean;
|
|
8
|
+
customPresets?: CustomPresetConfig[];
|
|
8
9
|
className?: string;
|
|
9
10
|
disableFutureDates?: boolean;
|
|
10
11
|
disablePastDates?: boolean;
|
|
11
12
|
isDisabled?: boolean;
|
|
12
13
|
size?: DateRangePickerSize;
|
|
13
14
|
maxMenuHeight?: number;
|
|
15
|
+
isStandalone?: boolean;
|
|
14
16
|
};
|
|
15
17
|
declare const QuickRangeSelector: import('react').ForwardRefExoticComponent<QuickRangeSelectorProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
18
|
export default QuickRangeSelector;
|
|
@@ -4,12 +4,14 @@ export declare enum DateRangePreset {
|
|
|
4
4
|
TODAY = "today",
|
|
5
5
|
YESTERDAY = "yesterday",
|
|
6
6
|
TOMORROW = "tomorrow",
|
|
7
|
-
|
|
7
|
+
LAST_30_MINUTES = "last30Minutes",
|
|
8
8
|
LAST_1_HOUR = "last1Hour",
|
|
9
9
|
LAST_6_HOURS = "last6Hours",
|
|
10
10
|
LAST_24_HOURS = "last24Hours",
|
|
11
11
|
LAST_7_DAYS = "last7Days",
|
|
12
12
|
LAST_30_DAYS = "last30Days",
|
|
13
|
+
THIS_MONTH = "thisMonth",
|
|
14
|
+
LAST_MONTH = "lastMonth",
|
|
13
15
|
LAST_3_MONTHS = "last3Months",
|
|
14
16
|
LAST_12_MONTHS = "last12Months",
|
|
15
17
|
NEXT_7_DAYS = "next7Days",
|
|
@@ -139,6 +141,27 @@ export type PickerColumnData = {
|
|
|
139
141
|
items: (string | number)[];
|
|
140
142
|
selectedIndex: number;
|
|
141
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Custom preset configuration for predefined presets
|
|
146
|
+
*/
|
|
147
|
+
export type CustomPresetConfig = {
|
|
148
|
+
preset: DateRangePreset;
|
|
149
|
+
label?: string;
|
|
150
|
+
visible?: boolean;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Custom preset definition for truly custom presets
|
|
154
|
+
*/
|
|
155
|
+
export type CustomPresetDefinition = {
|
|
156
|
+
id: string;
|
|
157
|
+
label: string;
|
|
158
|
+
getDateRange: () => DateRange;
|
|
159
|
+
visible?: boolean;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Presets configuration - can be predefined presets, custom configs, or custom definitions
|
|
163
|
+
*/
|
|
164
|
+
export type PresetsConfig = DateRangePreset[] | CustomPresetConfig[] | CustomPresetDefinition[] | (DateRangePreset | CustomPresetConfig | CustomPresetDefinition)[];
|
|
142
165
|
/**
|
|
143
166
|
* Function type for custom date disabling logic
|
|
144
167
|
* @param date The date to check
|
|
@@ -209,11 +232,25 @@ export type CustomRangeConfig = {
|
|
|
209
232
|
*/
|
|
210
233
|
applyToPresets?: boolean;
|
|
211
234
|
};
|
|
235
|
+
/**
|
|
236
|
+
* Preset selection callback data
|
|
237
|
+
*/
|
|
238
|
+
export type PresetSelectionData = {
|
|
239
|
+
preset: DateRangePreset;
|
|
240
|
+
label: string;
|
|
241
|
+
dateRange: DateRange;
|
|
242
|
+
formattedStartDate: string;
|
|
243
|
+
formattedEndDate: string;
|
|
244
|
+
formattedStartTime: string;
|
|
245
|
+
formattedEndTime: string;
|
|
246
|
+
};
|
|
212
247
|
export type DateRangePickerProps = {
|
|
213
248
|
value?: DateRange;
|
|
214
249
|
onChange?: (range: DateRange) => void;
|
|
250
|
+
onPresetSelection?: (data: PresetSelectionData) => void;
|
|
215
251
|
showDateTimePicker?: boolean;
|
|
216
252
|
showPresets?: boolean;
|
|
253
|
+
customPresets?: PresetsConfig;
|
|
217
254
|
placeholder?: string;
|
|
218
255
|
isDisabled?: boolean;
|
|
219
256
|
icon?: ReactNode;
|
|
@@ -234,6 +271,7 @@ export type DateRangePickerProps = {
|
|
|
234
271
|
formatConfig?: DateFormatConfig;
|
|
235
272
|
triggerConfig?: TriggerConfig;
|
|
236
273
|
maxMenuHeight?: number;
|
|
274
|
+
showPreset?: boolean;
|
|
237
275
|
};
|
|
238
276
|
export type PresetItemProps = {
|
|
239
277
|
preset: DateRangePreset;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateRange, DateRangePreset, DateFormatConfig, CustomFormatFunction, HapticFeedbackType,
|
|
1
|
+
import { DateRange, DateRangePreset, DateFormatConfig, CustomFormatFunction, HapticFeedbackType, CustomPresetConfig, CustomPresetDefinition, PresetsConfig, CustomRangeConfig } from './types';
|
|
2
2
|
import { CalendarTokenType } from './dateRangePicker.tokens';
|
|
3
3
|
/**
|
|
4
4
|
* Formats a date according to the specified format
|
|
@@ -705,6 +705,28 @@ export declare const shouldHideDateFromCalendar: (date: Date, today: Date, hideF
|
|
|
705
705
|
* @returns New date range or null if click should be ignored
|
|
706
706
|
*/
|
|
707
707
|
export declare const handleEnhancedCalendarDateClick: (clickedDate: Date, selectedRange: DateRange, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, isDoubleClick?: boolean) => DateRange | null;
|
|
708
|
+
/**
|
|
709
|
+
* Validates custom range configuration
|
|
710
|
+
* @param config The custom range configuration to validate
|
|
711
|
+
* @returns Validation result
|
|
712
|
+
*/
|
|
713
|
+
export declare const validateCustomRangeConfig: (config: CustomRangeConfig) => {
|
|
714
|
+
isValid: boolean;
|
|
715
|
+
error?: string;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* Handles calendar date click with custom range configuration support
|
|
719
|
+
* @param clickedDate The date that was clicked
|
|
720
|
+
* @param selectedRange Current selected range
|
|
721
|
+
* @param allowSingleDateSelection Whether single date selection is allowed
|
|
722
|
+
* @param today Today's date for validation
|
|
723
|
+
* @param disableFutureDates Whether future dates are disabled
|
|
724
|
+
* @param disablePastDates Whether past dates are disabled
|
|
725
|
+
* @param customRangeConfig Custom range configuration
|
|
726
|
+
* @param isDoubleClick Whether this is a double-click event
|
|
727
|
+
* @returns New date range or null if click should be ignored
|
|
728
|
+
*/
|
|
729
|
+
export declare const handleCustomRangeCalendarDateClick: (clickedDate: Date, selectedRange: DateRange, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, customRangeConfig?: CustomRangeConfig, isDoubleClick?: boolean) => DateRange | null;
|
|
708
730
|
/**
|
|
709
731
|
* Checks if two dates represent the same calendar day (ignoring time and timezone)
|
|
710
732
|
*/
|
|
@@ -730,99 +752,72 @@ export declare const matchesTomorrowPreset: (range: DateRange) => boolean;
|
|
|
730
752
|
*/
|
|
731
753
|
export declare const detectPresetFromRange: (range: DateRange) => DateRangePreset;
|
|
732
754
|
/**
|
|
733
|
-
*
|
|
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
|
|
755
|
+
* Default preset configuration for the DateRangePicker
|
|
738
756
|
*/
|
|
739
|
-
export declare const
|
|
757
|
+
export declare const DEFAULT_PRESET_CONFIG: DateRangePreset[];
|
|
740
758
|
/**
|
|
741
|
-
*
|
|
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
|
|
759
|
+
* Get custom preset definition by ID
|
|
751
760
|
*/
|
|
752
|
-
export declare const
|
|
761
|
+
export declare const getCustomPresetDefinition: (id: string) => CustomPresetDefinition | undefined;
|
|
753
762
|
/**
|
|
754
|
-
*
|
|
755
|
-
* @param
|
|
756
|
-
* @returns
|
|
763
|
+
* Processes custom presets configuration and returns normalized preset configs
|
|
764
|
+
* @param customPresets User-provided presets configuration
|
|
765
|
+
* @returns Array of normalized CustomPresetConfig objects
|
|
757
766
|
*/
|
|
758
|
-
export declare const
|
|
759
|
-
isValid: boolean;
|
|
760
|
-
error?: string;
|
|
761
|
-
};
|
|
767
|
+
export declare const processCustomPresets: (customPresets?: PresetsConfig) => CustomPresetConfig[];
|
|
762
768
|
/**
|
|
763
|
-
*
|
|
769
|
+
* Filters presets based on visibility and other criteria
|
|
770
|
+
* @param presetConfigs Array of preset configurations
|
|
771
|
+
* @param disableFutureDates Whether future date presets should be excluded
|
|
772
|
+
* @param disablePastDates Whether past date presets should be excluded
|
|
773
|
+
* @returns Array of visible and enabled presets
|
|
764
774
|
*/
|
|
765
|
-
export declare const
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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
|
-
};
|
|
775
|
+
export declare const getFilteredPresets: (presetConfigs: CustomPresetConfig[], disableFutureDates?: boolean, disablePastDates?: boolean) => DateRangePreset[];
|
|
776
|
+
/**
|
|
777
|
+
* Gets the label for a preset, using custom label if provided
|
|
778
|
+
* @param preset The preset to get label for
|
|
779
|
+
* @param presetConfigs Array of preset configurations with potential custom labels
|
|
780
|
+
* @returns The label for the preset
|
|
781
|
+
*/
|
|
782
|
+
export declare const getPresetLabelWithCustom: (preset: DateRangePreset, presetConfigs?: CustomPresetConfig[]) => string;
|
|
800
783
|
/**
|
|
801
|
-
*
|
|
784
|
+
* Creates a preset configuration with custom label and visibility
|
|
785
|
+
* @param preset The preset enum value
|
|
786
|
+
* @param label Optional custom label
|
|
787
|
+
* @param visible Whether the preset should be visible (default: true)
|
|
788
|
+
* @returns CustomPresetConfig object
|
|
802
789
|
*/
|
|
803
|
-
export declare const
|
|
790
|
+
export declare const createPresetConfig: (preset: DateRangePreset, label?: string, visible?: boolean) => CustomPresetConfig;
|
|
791
|
+
/**
|
|
792
|
+
* Helper function to create common preset configurations
|
|
793
|
+
*/
|
|
794
|
+
export declare const PRESET_HELPERS: {
|
|
795
|
+
/**
|
|
796
|
+
* Creates a configuration for time-based presets only
|
|
797
|
+
*/
|
|
798
|
+
timeBasedOnly: () => CustomPresetConfig[];
|
|
804
799
|
/**
|
|
805
|
-
*
|
|
800
|
+
* Creates a configuration for day-based presets only
|
|
806
801
|
*/
|
|
807
|
-
|
|
802
|
+
dayBasedOnly: () => CustomPresetConfig[];
|
|
808
803
|
/**
|
|
809
|
-
*
|
|
804
|
+
* Creates a configuration for month-based presets only
|
|
810
805
|
*/
|
|
811
|
-
|
|
806
|
+
monthBasedOnly: () => CustomPresetConfig[];
|
|
812
807
|
/**
|
|
813
|
-
*
|
|
808
|
+
* Creates a minimal preset configuration
|
|
814
809
|
*/
|
|
815
|
-
|
|
810
|
+
minimal: () => CustomPresetConfig[];
|
|
816
811
|
/**
|
|
817
|
-
*
|
|
812
|
+
* Creates a comprehensive preset configuration
|
|
818
813
|
*/
|
|
819
|
-
|
|
814
|
+
comprehensive: () => CustomPresetConfig[];
|
|
820
815
|
/**
|
|
821
|
-
*
|
|
816
|
+
* Creates a configuration with custom labels
|
|
822
817
|
*/
|
|
823
|
-
|
|
818
|
+
withCustomLabels: () => CustomPresetConfig[];
|
|
824
819
|
/**
|
|
825
|
-
*
|
|
820
|
+
* Creates a configuration with some presets hidden
|
|
826
821
|
*/
|
|
827
|
-
|
|
822
|
+
selectiveVisibility: () => CustomPresetConfig[];
|
|
828
823
|
};
|
|
@@ -2,7 +2,7 @@ import { CSSObject } from 'styled-components';
|
|
|
2
2
|
import { MenuV2Props } from './types';
|
|
3
3
|
export declare const contentBaseStyle: CSSObject;
|
|
4
4
|
declare const Menu: {
|
|
5
|
-
({ trigger, items, asModal, alignment, side, sideOffset, alignOffset, collisonBoundaryRef, maxHeight, enableSearch, searchPlaceholder, minWidth, maxWidth, open, onOpenChange, }: MenuV2Props): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
({ trigger, items, asModal, alignment, side, sideOffset, alignOffset, collisonBoundaryRef, maxHeight, enableSearch, searchPlaceholder, minWidth, maxWidth, open, onOpenChange, enableVirtualScrolling, virtualItemHeight, virtualOverscan, virtualScrollThreshold, }: MenuV2Props): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
8
8
|
export default Menu;
|
|
@@ -19,6 +19,10 @@ export type MenuV2Props = {
|
|
|
19
19
|
minWidth?: number;
|
|
20
20
|
enableSearch?: boolean;
|
|
21
21
|
searchPlaceholder?: string;
|
|
22
|
+
enableVirtualScrolling?: boolean;
|
|
23
|
+
virtualItemHeight?: number | ((item: MenuItemV2Type, index: number) => number);
|
|
24
|
+
virtualOverscan?: number;
|
|
25
|
+
virtualScrollThreshold?: number;
|
|
22
26
|
open?: boolean;
|
|
23
27
|
onOpenChange?: (open: boolean) => void;
|
|
24
28
|
asModal?: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MultiSelectProps } from './types';
|
|
2
|
-
declare const MultiSelect: ({ selectedValues, onChange, items, label, sublabel, disabled, helpIconHintText, name, required, variant, selectionTagType, slot, hintText, placeholder, size, enableSearch, searchPlaceholder, enableSelectAll, selectAllText, maxSelections, customTrigger, useDrawerOnMobile, minMenuWidth, maxMenuWidth, maxMenuHeight, alignment, side, sideOffset, alignOffset, inline, onBlur, onFocus, error, errorMessage, showActionButtons, primaryAction, secondaryAction, showItemDividers, showHeaderBorder, fullWidth, }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const MultiSelect: ({ selectedValues, onChange, items, label, sublabel, disabled, helpIconHintText, name, required, variant, selectionTagType, slot, hintText, placeholder, size, enableSearch, searchPlaceholder, enableSelectAll, selectAllText, maxSelections, customTrigger, useDrawerOnMobile, minMenuWidth, maxMenuWidth, maxMenuHeight, alignment, side, sideOffset, alignOffset, inline, onBlur, onFocus, error, errorMessage, showActionButtons, primaryAction, secondaryAction, showItemDividers, showHeaderBorder, fullWidth, enableVirtualization, virtualListItemHeight, virtualListOverscan, itemsToRender, onEndReached, endReachedThreshold, hasMore, loadingComponent, }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default MultiSelect;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MultiSelectMenuProps } from './types';
|
|
2
|
-
declare const MultiSelectMenu: ({ items, selected, onSelect, trigger, minMenuWidth, maxMenuWidth, maxMenuHeight, disabled, enableSearch, searchPlaceholder, enableSelectAll, selectAllText, maxSelections, onSelectAll, alignment, side, sideOffset, alignOffset, open, onOpenChange, showActionButtons, primaryAction, secondaryAction, }: MultiSelectMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const MultiSelectMenu: ({ items, selected, onSelect, trigger, minMenuWidth, maxMenuWidth, maxMenuHeight, disabled, enableSearch, searchPlaceholder, enableSelectAll, selectAllText, maxSelections, onSelectAll, alignment, side, sideOffset, alignOffset, open, onOpenChange, showActionButtons, primaryAction, secondaryAction, enableVirtualization, virtualListItemHeight, virtualListOverscan, itemsToRender, onEndReached, endReachedThreshold, hasMore, loadingComponent, }: MultiSelectMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default MultiSelectMenu;
|
|
@@ -104,6 +104,14 @@ export type MultiSelectProps = {
|
|
|
104
104
|
showItemDividers?: boolean;
|
|
105
105
|
showHeaderBorder?: boolean;
|
|
106
106
|
fullWidth?: boolean;
|
|
107
|
+
enableVirtualization?: boolean;
|
|
108
|
+
virtualListItemHeight?: number;
|
|
109
|
+
virtualListOverscan?: number;
|
|
110
|
+
itemsToRender?: number;
|
|
111
|
+
onEndReached?: () => void;
|
|
112
|
+
endReachedThreshold?: number;
|
|
113
|
+
hasMore?: boolean;
|
|
114
|
+
loadingComponent?: React.ReactNode;
|
|
107
115
|
};
|
|
108
116
|
export type MultiSelectMenuProps = {
|
|
109
117
|
items: MultiSelectMenuGroupType[];
|
|
@@ -139,4 +147,12 @@ export type MultiSelectMenuProps = {
|
|
|
139
147
|
disabled?: boolean;
|
|
140
148
|
loading?: boolean;
|
|
141
149
|
};
|
|
150
|
+
enableVirtualization?: boolean;
|
|
151
|
+
virtualListItemHeight?: number;
|
|
152
|
+
virtualListOverscan?: number;
|
|
153
|
+
itemsToRender?: number;
|
|
154
|
+
onEndReached?: () => void;
|
|
155
|
+
endReachedThreshold?: number;
|
|
156
|
+
hasMore?: boolean;
|
|
157
|
+
loadingComponent?: React.ReactNode;
|
|
142
158
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SingleSelectProps } from './types';
|
|
2
|
-
declare const SingleSelect: ({ label, subLabel, hintText, required, helpIconText, placeholder, error, errorMessage, size, items, name, variant, disabled, selected, onSelect, enableSearch, searchPlaceholder, slot, customTrigger, useDrawerOnMobile, alignment, side, sideOffset, alignOffset, minMenuWidth, maxMenuWidth, maxMenuHeight, onBlur, onFocus, inline, fullWidth, }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const SingleSelect: ({ label, subLabel, hintText, required, helpIconText, placeholder, error, errorMessage, size, items, name, variant, disabled, selected, onSelect, enableSearch, searchPlaceholder, slot, customTrigger, useDrawerOnMobile, alignment, side, sideOffset, alignOffset, minMenuWidth, maxMenuWidth, maxMenuHeight, onBlur, onFocus, inline, fullWidth, enableVirtualization, virtualListItemHeight, virtualListOverscan, itemsToRender, onEndReached, endReachedThreshold, hasMore, loadingComponent, }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default SingleSelect;
|
|
@@ -17,6 +17,14 @@ type SingleSelectMenuProps = {
|
|
|
17
17
|
alignOffset?: number;
|
|
18
18
|
open: boolean;
|
|
19
19
|
onOpenChange: (open: boolean) => void;
|
|
20
|
+
enableVirtualization?: boolean;
|
|
21
|
+
virtualListItemHeight?: number;
|
|
22
|
+
virtualListOverscan?: number;
|
|
23
|
+
itemsToRender?: number;
|
|
24
|
+
onEndReached?: () => void;
|
|
25
|
+
endReachedThreshold?: number;
|
|
26
|
+
hasMore?: boolean;
|
|
27
|
+
loadingComponent?: React.ReactNode;
|
|
20
28
|
};
|
|
21
|
-
declare const SingleSelectMenu: ({ items, selected, onSelect, trigger, minMenuWidth, maxMenuWidth, maxMenuHeight, enableSearch, searchPlaceholder, disabled, alignment, side, sideOffset, alignOffset, open, onOpenChange, }: SingleSelectMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare const SingleSelectMenu: ({ items, selected, onSelect, trigger, minMenuWidth, maxMenuWidth, maxMenuHeight, enableSearch, searchPlaceholder, disabled, alignment, side, sideOffset, alignOffset, open, onOpenChange, enableVirtualization, virtualListItemHeight, virtualListOverscan, itemsToRender, onEndReached, endReachedThreshold, hasMore, loadingComponent, }: SingleSelectMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
30
|
export default SingleSelectMenu;
|
|
@@ -95,4 +95,12 @@ export type SingleSelectProps = {
|
|
|
95
95
|
error?: boolean;
|
|
96
96
|
errorMessage?: string;
|
|
97
97
|
fullWidth?: boolean;
|
|
98
|
+
enableVirtualization?: boolean;
|
|
99
|
+
virtualListItemHeight?: number;
|
|
100
|
+
virtualListOverscan?: number;
|
|
101
|
+
itemsToRender?: number;
|
|
102
|
+
onEndReached?: () => void;
|
|
103
|
+
endReachedThreshold?: number;
|
|
104
|
+
hasMore?: boolean;
|
|
105
|
+
loadingComponent?: React.ReactNode;
|
|
98
106
|
};
|