@juspay/blend-design-system 0.0.35-beta.4 → 0.0.35
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/AvatarV2/AvatarV2.d.ts +18 -0
- package/dist/components/AvatarV2/avatarV2.dark.tokens.d.ts +8 -0
- package/dist/components/AvatarV2/avatarV2.light.tokens.d.ts +8 -0
- package/dist/components/AvatarV2/avatarV2.tokens.d.ts +77 -0
- package/dist/components/AvatarV2/avatarV2.types.d.ts +79 -0
- package/dist/components/AvatarV2/avatarV2.utils.d.ts +25 -0
- package/dist/components/AvatarV2/index.d.ts +5 -0
- package/dist/components/DateRangePicker/CalendarGrid.d.ts +3 -1
- package/dist/components/DateRangePicker/TimeSelector.d.ts +7 -0
- package/dist/components/DateRangePicker/constants.d.ts +1 -1
- package/dist/components/DateRangePicker/types.d.ts +8 -7
- package/dist/components/DateRangePicker/utils.d.ts +40 -36
- package/dist/context/ThemeContext.d.ts +2 -0
- package/dist/context/useComponentToken.d.ts +2 -1
- package/dist/hooks/useDropdownInteractionLock.d.ts +1 -0
- package/dist/main.js +31688 -30828
- package/dist/utils/accessibility/index.d.ts +1 -0
- package/dist/utils/accessibility/visually-hidden.d.ts +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React, ReactElement } from 'react';
|
|
2
|
+
import { AvatarV2Size, AvatarV2Shape } from './avatarV2.types';
|
|
3
|
+
declare const AvatarV2: React.ForwardRefExoticComponent<{
|
|
4
|
+
src?: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
fallbackText?: string;
|
|
7
|
+
size?: AvatarV2Size;
|
|
8
|
+
shape?: AvatarV2Shape;
|
|
9
|
+
status?: import('./avatarV2.types').AvatarV2StatusConfig;
|
|
10
|
+
leftSlot?: ReactElement;
|
|
11
|
+
rightSlot?: ReactElement;
|
|
12
|
+
skeleton?: import('./avatarV2.types').AvatarV2SkeletonConfig;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
onImageError?: (error: Error) => void;
|
|
16
|
+
onImageLoad?: () => void;
|
|
17
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "style" | "className" | "children"> & import('./avatarV2.types').AvatarV2Dimensions & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default AvatarV2;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FoundationTokenType } from '../../tokens/theme.token';
|
|
2
|
+
import { AvatarV2TokensType } from './avatarV2.tokens';
|
|
3
|
+
import { BreakpointType } from '../../breakpoints/breakPoints';
|
|
4
|
+
type ResponsiveAvatarV2Tokens = {
|
|
5
|
+
[key in keyof BreakpointType]: AvatarV2TokensType;
|
|
6
|
+
};
|
|
7
|
+
export declare const getAvatarV2DarkTokens: (foundationToken: FoundationTokenType) => ResponsiveAvatarV2Tokens;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FoundationTokenType } from '../../tokens/theme.token';
|
|
2
|
+
import { AvatarV2TokensType } from './avatarV2.tokens';
|
|
3
|
+
import { BreakpointType } from '../../breakpoints/breakPoints';
|
|
4
|
+
type ResponsiveAvatarV2Tokens = {
|
|
5
|
+
[key in keyof BreakpointType]: AvatarV2TokensType;
|
|
6
|
+
};
|
|
7
|
+
export declare const getAvatarV2LightTokens: (foundationToken: FoundationTokenType) => ResponsiveAvatarV2Tokens;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CSSObject } from 'styled-components';
|
|
2
|
+
import { AvatarV2Size, AvatarV2Shape, AvatarV2Status } from './avatarV2.types';
|
|
3
|
+
import { FoundationTokenType } from '../../tokens/theme.token';
|
|
4
|
+
import { BreakpointType } from '../../breakpoints/breakPoints';
|
|
5
|
+
import { Theme } from '../../context/theme.enum';
|
|
6
|
+
export type AvatarV2TokensType = {
|
|
7
|
+
gap: CSSObject['gap'];
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: CSSObject['backgroundColor'];
|
|
10
|
+
width: {
|
|
11
|
+
[key in AvatarV2Size]: CSSObject['width'];
|
|
12
|
+
};
|
|
13
|
+
height: {
|
|
14
|
+
[key in AvatarV2Size]: CSSObject['height'];
|
|
15
|
+
};
|
|
16
|
+
borderRadius: {
|
|
17
|
+
[key in AvatarV2Shape]: CSSObject['borderRadius'];
|
|
18
|
+
};
|
|
19
|
+
image: {
|
|
20
|
+
border: CSSObject['border'];
|
|
21
|
+
};
|
|
22
|
+
fallbackText: {
|
|
23
|
+
border: CSSObject['border'];
|
|
24
|
+
fontSize: {
|
|
25
|
+
[key in AvatarV2Size]: CSSObject['fontSize'];
|
|
26
|
+
};
|
|
27
|
+
fontWeight: {
|
|
28
|
+
[key in AvatarV2Size]: CSSObject['fontWeight'];
|
|
29
|
+
};
|
|
30
|
+
lineHeight: {
|
|
31
|
+
[key in AvatarV2Size]: CSSObject['lineHeight'];
|
|
32
|
+
};
|
|
33
|
+
color: CSSObject['color'];
|
|
34
|
+
};
|
|
35
|
+
status: {
|
|
36
|
+
width: {
|
|
37
|
+
[key in AvatarV2Size]: CSSObject['width'];
|
|
38
|
+
};
|
|
39
|
+
height: {
|
|
40
|
+
[key in AvatarV2Size]: CSSObject['height'];
|
|
41
|
+
};
|
|
42
|
+
border: {
|
|
43
|
+
[key in AvatarV2Size]: CSSObject['border'];
|
|
44
|
+
};
|
|
45
|
+
borderRadius: CSSObject['borderRadius'];
|
|
46
|
+
backgroundColor: {
|
|
47
|
+
[key in AvatarV2Status]: CSSObject['backgroundColor'];
|
|
48
|
+
};
|
|
49
|
+
boxShadow: CSSObject['boxShadow'];
|
|
50
|
+
position: {
|
|
51
|
+
[key in AvatarV2Shape]: {
|
|
52
|
+
[key in AvatarV2Size]: {
|
|
53
|
+
top?: CSSObject['top'];
|
|
54
|
+
right?: CSSObject['right'];
|
|
55
|
+
bottom?: CSSObject['bottom'];
|
|
56
|
+
left?: CSSObject['left'];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
slot: {
|
|
63
|
+
height: CSSObject['height'];
|
|
64
|
+
width: CSSObject['width'];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type ResponsiveAvatarV2Tokens = {
|
|
68
|
+
[key in keyof BreakpointType]: AvatarV2TokensType;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Get AvatarV2 tokens based on theme
|
|
72
|
+
*
|
|
73
|
+
* @param foundationToken - The foundation theme tokens
|
|
74
|
+
* @param theme - The current theme (light or dark)
|
|
75
|
+
* @returns Responsive AvatarV2 tokens
|
|
76
|
+
*/
|
|
77
|
+
export declare const getAvatarV2Tokens: (foundationToken: FoundationTokenType, theme?: Theme | string) => ResponsiveAvatarV2Tokens;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode, ReactElement } from 'react';
|
|
2
|
+
import { CSSObject } from 'styled-components';
|
|
3
|
+
export declare enum AvatarV2Size {
|
|
4
|
+
SM = "sm",
|
|
5
|
+
REGULAR = "regular",
|
|
6
|
+
MD = "md",
|
|
7
|
+
LG = "lg",
|
|
8
|
+
XL = "xl"
|
|
9
|
+
}
|
|
10
|
+
export declare enum AvatarV2Shape {
|
|
11
|
+
CIRCULAR = "circular",
|
|
12
|
+
ROUNDED = "rounded"
|
|
13
|
+
}
|
|
14
|
+
export declare enum AvatarV2StatusPosition {
|
|
15
|
+
TOP_RIGHT = "topRight",
|
|
16
|
+
BOTTOM_RIGHT = "bottomRight",
|
|
17
|
+
TOP_LEFT = "topLeft",
|
|
18
|
+
BOTTOM_LEFT = "bottomLeft"
|
|
19
|
+
}
|
|
20
|
+
export declare enum AvatarV2Status {
|
|
21
|
+
NONE = "none",
|
|
22
|
+
ONLINE = "online",
|
|
23
|
+
OFFLINE = "offline",
|
|
24
|
+
AWAY = "away",
|
|
25
|
+
BUSY = "busy"
|
|
26
|
+
}
|
|
27
|
+
export declare enum AvatarV2Variant {
|
|
28
|
+
IMAGE = "image",
|
|
29
|
+
TEXT = "text",
|
|
30
|
+
ICON = "icon"
|
|
31
|
+
}
|
|
32
|
+
export type AvatarV2SkeletonConfig = {
|
|
33
|
+
show: boolean;
|
|
34
|
+
variant?: 'pulse' | 'wave';
|
|
35
|
+
};
|
|
36
|
+
export type AvatarV2StatusConfig = {
|
|
37
|
+
type: AvatarV2Status;
|
|
38
|
+
position?: AvatarV2StatusPosition;
|
|
39
|
+
};
|
|
40
|
+
export type AvatarV2Dimensions = {
|
|
41
|
+
width?: CSSObject['width'];
|
|
42
|
+
height?: CSSObject['height'];
|
|
43
|
+
};
|
|
44
|
+
export type AvatarV2Props = {
|
|
45
|
+
src?: string;
|
|
46
|
+
alt?: string;
|
|
47
|
+
fallbackText?: string;
|
|
48
|
+
size?: AvatarV2Size;
|
|
49
|
+
shape?: AvatarV2Shape;
|
|
50
|
+
status?: AvatarV2StatusConfig;
|
|
51
|
+
leftSlot?: ReactElement;
|
|
52
|
+
rightSlot?: ReactElement;
|
|
53
|
+
skeleton?: AvatarV2SkeletonConfig;
|
|
54
|
+
backgroundColor?: string;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
onImageError?: (error: Error) => void;
|
|
57
|
+
onImageLoad?: () => void;
|
|
58
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style'> & AvatarV2Dimensions;
|
|
59
|
+
export type AvatarV2ImageProps = {
|
|
60
|
+
src: string;
|
|
61
|
+
alt: string;
|
|
62
|
+
onError: () => void;
|
|
63
|
+
onLoad?: () => void;
|
|
64
|
+
};
|
|
65
|
+
export type AvatarV2FallbackProps = {
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
backgroundColor?: string;
|
|
68
|
+
};
|
|
69
|
+
export type AvatarV2StatusIndicatorProps = {
|
|
70
|
+
status: AvatarV2Status;
|
|
71
|
+
position: AvatarV2StatusPosition;
|
|
72
|
+
size: AvatarV2Size;
|
|
73
|
+
};
|
|
74
|
+
export type AvatarV2GroupProps = {
|
|
75
|
+
avatars: Omit<AvatarV2Props, 'leadingSlot' | 'trailingSlot'>[];
|
|
76
|
+
max?: number;
|
|
77
|
+
size?: AvatarV2Size;
|
|
78
|
+
spacing?: 'tight' | 'normal' | 'loose';
|
|
79
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AvatarV2StatusPosition, AvatarV2Shape, AvatarV2Size } from './avatarV2.types';
|
|
3
|
+
import { AvatarV2TokensType } from './avatarV2.tokens';
|
|
4
|
+
export declare const DEFAULT_AVATAR_ALT = "Avatar";
|
|
5
|
+
export declare const DEFAULT_FALLBACK_COLOR = "#94A3B8";
|
|
6
|
+
export declare const MAX_INITIALS_LENGTH = 2;
|
|
7
|
+
export declare const DEFAULT_POSITION: {
|
|
8
|
+
readonly top: "0";
|
|
9
|
+
readonly right: "0";
|
|
10
|
+
readonly bottom: "0";
|
|
11
|
+
};
|
|
12
|
+
export declare function getInitialsFromText(text?: string): string;
|
|
13
|
+
export declare function sanitizeTextForLabel(text: string): string;
|
|
14
|
+
export declare function renderFallbackContent(fallbackText?: string, alt?: string): ReactNode;
|
|
15
|
+
export declare function getColorFromText(text: string): string;
|
|
16
|
+
export declare function getAccessibleLabel(alt: string, fallbackText: string | undefined, status: string): string;
|
|
17
|
+
export declare function getAriaLiveValue(status: string): 'polite' | undefined;
|
|
18
|
+
export declare function getStatusPositionStyles(position: AvatarV2StatusPosition, size: AvatarV2Size, shape: AvatarV2Shape, tokens: AvatarV2TokensType): {
|
|
19
|
+
top?: string;
|
|
20
|
+
right?: string;
|
|
21
|
+
bottom?: string;
|
|
22
|
+
left?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function createKeyboardHandler(onClick: ((event: React.MouseEvent<HTMLDivElement>) => void) | undefined): ((e: React.KeyboardEvent<HTMLDivElement>) => void) | undefined;
|
|
25
|
+
export declare function isInteractive(onClick: ((event: React.MouseEvent<HTMLDivElement>) => void) | undefined): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as AvatarV2 } from './AvatarV2';
|
|
2
|
+
export type { AvatarV2Props, AvatarV2SkeletonConfig, AvatarV2StatusConfig, } from './avatarV2.types';
|
|
3
|
+
export { AvatarV2Size, AvatarV2Shape, AvatarV2Status, AvatarV2StatusPosition, AvatarV2Variant, } from './avatarV2.types';
|
|
4
|
+
export * from './avatarV2.tokens';
|
|
5
|
+
export * from './avatarV2.utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateRange, CustomRangeConfig } from './types';
|
|
2
2
|
type CalendarGridProps = {
|
|
3
|
-
selectedRange: DateRange;
|
|
3
|
+
selectedRange: DateRange | undefined;
|
|
4
4
|
onDateSelect: (range: DateRange) => void;
|
|
5
5
|
today: Date;
|
|
6
6
|
allowSingleDateSelection?: boolean;
|
|
@@ -12,6 +12,8 @@ type CalendarGridProps = {
|
|
|
12
12
|
customRangeConfig?: CustomRangeConfig;
|
|
13
13
|
showDateTimePicker?: boolean;
|
|
14
14
|
resetScrollPosition?: number;
|
|
15
|
+
timezone?: string;
|
|
16
|
+
isSingleDatePicker?: boolean;
|
|
15
17
|
};
|
|
16
18
|
declare const CalendarGrid: import('react').ForwardRefExoticComponent<CalendarGridProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
17
19
|
export default CalendarGrid;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { DateRange } from './types';
|
|
2
3
|
type TimeSelectorProps = {
|
|
3
4
|
value: string;
|
|
4
5
|
onChange: (time: string) => void;
|
|
6
|
+
disablePastDates: boolean;
|
|
7
|
+
disableFutureDates: boolean;
|
|
8
|
+
today: Date;
|
|
9
|
+
isStart: boolean;
|
|
10
|
+
selectedRange?: DateRange;
|
|
11
|
+
timezone?: string;
|
|
5
12
|
className?: string;
|
|
6
13
|
autoFocus?: boolean;
|
|
7
14
|
tabIndex?: number;
|
|
@@ -15,7 +15,7 @@ export declare const DATE_RANGE_PICKER_CONSTANTS: {
|
|
|
15
15
|
readonly IMPACT: readonly [15];
|
|
16
16
|
readonly NOTIFICATION: readonly [25, 40, 25];
|
|
17
17
|
};
|
|
18
|
-
readonly MIN_YEAR:
|
|
18
|
+
readonly MIN_YEAR: 1940;
|
|
19
19
|
readonly MAX_YEAR_OFFSET: 10;
|
|
20
20
|
readonly TIME_MINUTE_INCREMENT: 15;
|
|
21
21
|
readonly SCROLL_DEBOUNCE_MS: 80;
|
|
@@ -68,7 +68,7 @@ export declare enum CalendarInteractionMode {
|
|
|
68
68
|
}
|
|
69
69
|
export type DateRange = {
|
|
70
70
|
startDate: Date;
|
|
71
|
-
endDate
|
|
71
|
+
endDate?: Date;
|
|
72
72
|
showTimePicker?: boolean;
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
@@ -257,6 +257,7 @@ export type DateRangePickerProps = {
|
|
|
257
257
|
maxDate?: Date;
|
|
258
258
|
dateFormat?: string;
|
|
259
259
|
allowSingleDateSelection?: boolean;
|
|
260
|
+
isSingleDatePicker?: boolean;
|
|
260
261
|
disableFutureDates?: boolean;
|
|
261
262
|
disablePastDates?: boolean;
|
|
262
263
|
hideFutureDates?: boolean;
|
|
@@ -307,9 +308,9 @@ export type ScrollablePickerProps = {
|
|
|
307
308
|
isDisabled?: boolean;
|
|
308
309
|
};
|
|
309
310
|
export type DatePickerComponentProps = {
|
|
310
|
-
selectedRange
|
|
311
|
-
startTime
|
|
312
|
-
endTime
|
|
311
|
+
selectedRange?: DateRange;
|
|
312
|
+
startTime?: string;
|
|
313
|
+
endTime?: string;
|
|
313
314
|
dateFormat: string;
|
|
314
315
|
handleStartTimeChange: (time: string) => void;
|
|
315
316
|
handleEndTimeChange: (time: string) => void;
|
|
@@ -327,9 +328,9 @@ export type MobileDrawerPresetsProps = {
|
|
|
327
328
|
showPresets: boolean;
|
|
328
329
|
availablePresets: DateRangePreset[];
|
|
329
330
|
activePreset: DateRangePreset;
|
|
330
|
-
selectedRange
|
|
331
|
-
startTime
|
|
332
|
-
endTime
|
|
331
|
+
selectedRange?: DateRange;
|
|
332
|
+
startTime?: string;
|
|
333
|
+
endTime?: string;
|
|
333
334
|
dateFormat: string;
|
|
334
335
|
handlePresetSelect: (preset: DateRangePreset) => void;
|
|
335
336
|
handleStartTimeChange: (time: string) => void;
|
|
@@ -55,7 +55,7 @@ export declare const formatDate: (date: Date, format: string, timezone?: string)
|
|
|
55
55
|
* @param format The format string
|
|
56
56
|
* @returns The parsed date or null if invalid
|
|
57
57
|
*/
|
|
58
|
-
export declare const parseDate: (dateString: string, format: string) => Date | null;
|
|
58
|
+
export declare const parseDate: (dateString: string, format: string, hour: number, minute: number) => Date | null;
|
|
59
59
|
/**
|
|
60
60
|
* Checks if a date is valid
|
|
61
61
|
* @param date The date to check
|
|
@@ -115,6 +115,21 @@ export declare const dateToString: (date: Date, includeTime?: boolean, timeForma
|
|
|
115
115
|
* @returns True if dates are the same day
|
|
116
116
|
*/
|
|
117
117
|
export declare const isSameDay: (date1: Date, date2: Date) => boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if two dates are the same day
|
|
120
|
+
* @param parts1 Contains year, month, day of first date
|
|
121
|
+
* @param parts2 Contains year, month, day of second date
|
|
122
|
+
* @returns True if dates are the same day
|
|
123
|
+
*/
|
|
124
|
+
export declare const isSameParts: (part1: {
|
|
125
|
+
year: number;
|
|
126
|
+
month: number;
|
|
127
|
+
day: number;
|
|
128
|
+
}, part2: {
|
|
129
|
+
year: number;
|
|
130
|
+
month: number;
|
|
131
|
+
day: number;
|
|
132
|
+
}) => boolean;
|
|
118
133
|
/**
|
|
119
134
|
* Checks if a date is within a range
|
|
120
135
|
* @param date The date to check
|
|
@@ -148,23 +163,24 @@ export declare const generateCalendarGrid: (year: number, month: number) => (num
|
|
|
148
163
|
* Checks if a date is the start date of a range
|
|
149
164
|
* @param date The date to check
|
|
150
165
|
* @param selectedRange The selected date range
|
|
166
|
+
* @param timezone The timezone for the date range
|
|
151
167
|
* @returns True if the date is the start date
|
|
152
168
|
*/
|
|
153
|
-
export declare const isStartDate: (date: Date,
|
|
169
|
+
export declare const isStartDate: (date: Date, startDate: Date, timezone?: string) => boolean;
|
|
154
170
|
/**
|
|
155
171
|
* Checks if a date is the end date of a range (but not if it's the same as start date)
|
|
156
172
|
* @param date The date to check
|
|
157
173
|
* @param selectedRange The selected date range
|
|
158
174
|
* @returns True if the date is the end date and different from start date
|
|
159
175
|
*/
|
|
160
|
-
export declare const isEndDate: (date: Date,
|
|
176
|
+
export declare const isEndDate: (date: Date, startDate: Date, endDate: Date, timezone?: string) => boolean;
|
|
161
177
|
/**
|
|
162
178
|
* Checks if a date is within a selected range (not including start/end)
|
|
163
179
|
* @param date The date to check
|
|
164
180
|
* @param selectedRange The selected date range
|
|
165
181
|
* @returns True if the date is in the range
|
|
166
182
|
*/
|
|
167
|
-
export declare const isInSelectedRange: (date: Date, selectedRange: DateRange) => boolean;
|
|
183
|
+
export declare const isInSelectedRange: (date: Date, selectedRange: DateRange, timezone?: string) => boolean;
|
|
168
184
|
/**
|
|
169
185
|
* Checks if a date is today
|
|
170
186
|
* @param date The date to check
|
|
@@ -177,7 +193,7 @@ export declare const isDateToday: (date: Date, today: Date) => boolean;
|
|
|
177
193
|
* @param date The date to create a range for
|
|
178
194
|
* @returns DateRange spanning the entire day (same date, different times)
|
|
179
195
|
*/
|
|
180
|
-
export declare const createSingleDateRange: (date: Date, timezone?: string) => DateRange;
|
|
196
|
+
export declare const createSingleDateRange: (date: Date, timezone?: string, disableFutureDates?: boolean, disablePastDates?: boolean, today?: Date) => DateRange;
|
|
181
197
|
/**
|
|
182
198
|
* Handles date click logic for calendar with clean first click = start, second click = end pattern
|
|
183
199
|
* @param clickedDate The date that was clicked
|
|
@@ -189,7 +205,7 @@ export declare const createSingleDateRange: (date: Date, timezone?: string) => D
|
|
|
189
205
|
* @param isDoubleClick Whether this is a double-click event
|
|
190
206
|
* @returns New date range or null if click should be ignored
|
|
191
207
|
*/
|
|
192
|
-
export declare const handleCalendarDateClick: (clickedDate: Date,
|
|
208
|
+
export declare const handleCalendarDateClick: (clickedDate: Date, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, isDoubleClick?: boolean, timezone?: string, selectedRange?: DateRange, isSingleDatePicker?: boolean) => DateRange | null;
|
|
193
209
|
/**
|
|
194
210
|
* Generates calendar weeks for a specific month with consistent alignment
|
|
195
211
|
* @param year The year
|
|
@@ -305,7 +321,7 @@ export declare const getMonthOffset: (index: number, monthHeight: number) => num
|
|
|
305
321
|
export declare const findCurrentMonthIndex: (months: {
|
|
306
322
|
month: number;
|
|
307
323
|
year: number;
|
|
308
|
-
}[],
|
|
324
|
+
}[], targetMonth: number, targetYear: number) => number;
|
|
309
325
|
/**
|
|
310
326
|
* Scrolls to a specific month
|
|
311
327
|
* @param monthIndex Index of the month to scroll to
|
|
@@ -323,7 +339,7 @@ export declare const getScrollToMonth: (monthIndex: number, monthHeight: number)
|
|
|
323
339
|
* @param customDisableDates Custom function to disable specific dates
|
|
324
340
|
* @returns Object with all date states
|
|
325
341
|
*/
|
|
326
|
-
export declare const getDateCellStates: (date: Date, selectedRange: DateRange, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, customDisableDates?: (date: Date) => boolean) => {
|
|
342
|
+
export declare const getDateCellStates: (date: Date, selectedRange: DateRange | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, customDisableDates?: (date: Date) => boolean, timezone?: string, isSingleDatePicker?: boolean) => {
|
|
327
343
|
isStart: boolean;
|
|
328
344
|
isEnd: boolean;
|
|
329
345
|
isRangeDay: boolean;
|
|
@@ -380,7 +396,7 @@ export type DateRangePickerTokens = {
|
|
|
380
396
|
* @param disablePastDates Whether past dates should be disabled
|
|
381
397
|
* @returns Validation result with specific error type
|
|
382
398
|
*/
|
|
383
|
-
export declare const validateDateInput: (value: string, format: string, disableFutureDates?: boolean, disablePastDates?: boolean) => DateValidationResult;
|
|
399
|
+
export declare const validateDateInput: (value: string, format: string, disableFutureDates?: boolean, disablePastDates?: boolean, timezone?: string) => DateValidationResult;
|
|
384
400
|
/**
|
|
385
401
|
* Formats date input as user types, adding slashes automatically
|
|
386
402
|
* @param value The input value to format
|
|
@@ -401,7 +417,7 @@ export declare const isDateInputComplete: (value: string, format: string) => boo
|
|
|
401
417
|
* @param allowSingleDateSelection Whether single date selection is allowed
|
|
402
418
|
* @returns Formatted display string
|
|
403
419
|
*/
|
|
404
|
-
export declare const formatDateDisplay: (selectedRange: DateRange, allowSingleDateSelection?: boolean, timezone?: string) => string;
|
|
420
|
+
export declare const formatDateDisplay: (selectedRange: DateRange | undefined, allowSingleDateSelection?: boolean, timezone?: string, isSingleDatePicker?: boolean) => string;
|
|
405
421
|
/**
|
|
406
422
|
* Handles date input change with formatting and validation
|
|
407
423
|
* @param value Input value
|
|
@@ -413,7 +429,7 @@ export declare const formatDateDisplay: (selectedRange: DateRange, allowSingleDa
|
|
|
413
429
|
* @param disablePastDates Whether past dates should be disabled
|
|
414
430
|
* @returns Object with formatted value, validation result, and updated range
|
|
415
431
|
*/
|
|
416
|
-
export declare const handleDateInputChange: (value: string, dateFormat: string, currentRange: DateRange, timeValue
|
|
432
|
+
export declare const handleDateInputChange: (value: string, dateFormat: string, currentRange: DateRange | undefined, timeValue?: string, isStartDate?: boolean, disableFutureDates?: boolean, disablePastDates?: boolean, timezone?: string) => {
|
|
417
433
|
formattedValue: string;
|
|
418
434
|
validation: DateValidationResult;
|
|
419
435
|
updatedRange?: DateRange;
|
|
@@ -425,7 +441,7 @@ export declare const handleDateInputChange: (value: string, dateFormat: string,
|
|
|
425
441
|
* @param isStartTime Whether this is start time or end time
|
|
426
442
|
* @returns Updated date range
|
|
427
443
|
*/
|
|
428
|
-
export declare const handleTimeChange: (time: string, currentRange: DateRange, isStartTime?: boolean) => DateRange;
|
|
444
|
+
export declare const handleTimeChange: (time: string, currentRange: DateRange, timezone?: string, isStartTime?: boolean) => DateRange;
|
|
429
445
|
/**
|
|
430
446
|
* Handles date selection from calendar
|
|
431
447
|
* @param range Selected date range from calendar
|
|
@@ -434,10 +450,10 @@ export declare const handleTimeChange: (time: string, currentRange: DateRange, i
|
|
|
434
450
|
* @param dateFormat Date format string
|
|
435
451
|
* @returns Object with updated range and formatted date strings
|
|
436
452
|
*/
|
|
437
|
-
export declare const handleCalendarDateSelect: (range: DateRange, startTime: string,
|
|
453
|
+
export declare const handleCalendarDateSelect: (range: DateRange, startTime: string, dateFormat: string, timezone?: string, endTime?: string) => {
|
|
438
454
|
updatedRange: DateRange;
|
|
439
455
|
formattedStartDate: string;
|
|
440
|
-
formattedEndDate
|
|
456
|
+
formattedEndDate?: string;
|
|
441
457
|
};
|
|
442
458
|
/**
|
|
443
459
|
* Handles preset selection
|
|
@@ -451,19 +467,6 @@ export declare const handlePresetSelection: (preset: DateRangePreset, dateFormat
|
|
|
451
467
|
formattedEndDate: string;
|
|
452
468
|
formattedStartTime: string;
|
|
453
469
|
formattedEndTime: string;
|
|
454
|
-
};
|
|
455
|
-
/**
|
|
456
|
-
* Handles cancel action - resets to original values
|
|
457
|
-
* @param originalValue Original date range value
|
|
458
|
-
* @param dateFormat Date format string
|
|
459
|
-
* @returns Object with reset values
|
|
460
|
-
*/
|
|
461
|
-
export declare const handleCancelAction: (originalValue: DateRange | undefined, dateFormat: string) => {
|
|
462
|
-
resetRange: DateRange;
|
|
463
|
-
formattedStartDate: string;
|
|
464
|
-
formattedEndDate: string;
|
|
465
|
-
formattedStartTime: string;
|
|
466
|
-
formattedEndTime: string;
|
|
467
470
|
} | null;
|
|
468
471
|
/**
|
|
469
472
|
* Handles loading more months in calendar
|
|
@@ -520,7 +523,7 @@ export declare const createCalendarMonthData: (year: number, month: number, mont
|
|
|
520
523
|
* @param customDisableDates Custom function to disable specific dates
|
|
521
524
|
* @returns Day cell props
|
|
522
525
|
*/
|
|
523
|
-
export declare const calculateDayCellProps: (date: Date, selectedRange: DateRange, today: Date, disableFutureDates: boolean, disablePastDates: boolean, calendarToken: CalendarTokenType, customDisableDates?: (date: Date) => boolean) => {
|
|
526
|
+
export declare const calculateDayCellProps: (date: Date, selectedRange: DateRange | undefined, today: Date, disableFutureDates: boolean, disablePastDates: boolean, calendarToken: CalendarTokenType, customDisableDates?: (date: Date) => boolean, timezone?: string, isSingleDatePicker?: boolean) => {
|
|
524
527
|
dateStates: ReturnType<typeof getDateCellStates>;
|
|
525
528
|
styles: Record<string, unknown>;
|
|
526
529
|
textColor: string | unknown;
|
|
@@ -534,7 +537,7 @@ export declare const calculateDayCellProps: (date: Date, selectedRange: DateRang
|
|
|
534
537
|
* @param endTime Current end time
|
|
535
538
|
* @returns Object with picker data for all columns
|
|
536
539
|
*/
|
|
537
|
-
export declare const generatePickerData: (tabType: "start" | "end", selectedRange
|
|
540
|
+
export declare const generatePickerData: (tabType: "start" | "end", selectedRange?: DateRange, startTime?: string, endTime?: string) => {
|
|
538
541
|
years: {
|
|
539
542
|
items: number[];
|
|
540
543
|
selectedIndex: number;
|
|
@@ -565,7 +568,7 @@ export declare const generatePickerData: (tabType: "start" | "end", selectedRang
|
|
|
565
568
|
* @param setEndDate End date setter function
|
|
566
569
|
* @returns Selection handler function
|
|
567
570
|
*/
|
|
568
|
-
export declare const createSelectionHandler: (tabType: "start" | "end", type: "year" | "month" | "date" | "time",
|
|
571
|
+
export declare const createSelectionHandler: (tabType: "start" | "end", type: "year" | "month" | "date" | "time", dateFormat: string, handleStartTimeChange: (time: string) => void, handleEndTimeChange: (time: string) => void, setSelectedRange: (range: DateRange) => void, setStartDate: (date: string) => void, setEndDate: (date: string) => void, selectedRange?: DateRange) => (index: number) => void;
|
|
569
572
|
/**
|
|
570
573
|
* Gets preset display label with custom mappings
|
|
571
574
|
* @param preset The preset to get label for
|
|
@@ -586,7 +589,7 @@ export declare const formatDateRangeWithConfig: (range: DateRange, config?: Date
|
|
|
586
589
|
* @param placeholder Placeholder text when no range is selected
|
|
587
590
|
* @returns Formatted display string for trigger
|
|
588
591
|
*/
|
|
589
|
-
export declare const formatTriggerDisplay: (range: DateRange | undefined, config?: DateFormatConfig, placeholder?: string, timezone?: string) => string;
|
|
592
|
+
export declare const formatTriggerDisplay: (range: DateRange | undefined, config?: DateFormatConfig, isSingleDatePicker?: boolean, placeholder?: string, timezone?: string) => string;
|
|
590
593
|
/**
|
|
591
594
|
* Predefined format configurations for common use cases
|
|
592
595
|
*/
|
|
@@ -717,7 +720,7 @@ export declare const formatTimeInput: (input: string) => string;
|
|
|
717
720
|
* @param allowSingleDateSelection Whether single date selection is allowed
|
|
718
721
|
* @returns Validation result with specific error information
|
|
719
722
|
*/
|
|
720
|
-
export declare const validateDateTimeRange: (range: DateRange) => {
|
|
723
|
+
export declare const validateDateTimeRange: (range: DateRange, isSingleDatePicker: boolean) => {
|
|
721
724
|
isValid: boolean;
|
|
722
725
|
error: "none" | "invalid-time-order" | "missing-dates" | "invalid-single-date";
|
|
723
726
|
message?: string;
|
|
@@ -766,7 +769,7 @@ export declare const validateCustomRangeConfig: (config: CustomRangeConfig) => {
|
|
|
766
769
|
* @param isDoubleClick Whether this is a double-click event
|
|
767
770
|
* @returns New date range or null if click should be ignored
|
|
768
771
|
*/
|
|
769
|
-
export declare const handleCustomRangeCalendarDateClick: (clickedDate: Date,
|
|
772
|
+
export declare const handleCustomRangeCalendarDateClick: (clickedDate: Date, allowSingleDateSelection: boolean | undefined, today: Date, disableFutureDates?: boolean, disablePastDates?: boolean, customRangeConfig?: CustomRangeConfig, isDoubleClick?: boolean, timezone?: string, selectedRange?: DateRange, isSingleDatePicker?: boolean) => DateRange | null;
|
|
770
773
|
/**
|
|
771
774
|
* Checks if two dates represent the same calendar day (ignoring time and timezone)
|
|
772
775
|
*/
|
|
@@ -775,14 +778,15 @@ export declare const isSameCalendarDay: (date1: Date, date2: Date) => boolean;
|
|
|
775
778
|
* Checks if a date range represents a full day in any timezone
|
|
776
779
|
*/
|
|
777
780
|
export declare const isFullDayRange: (startDate: Date, endDate: Date) => boolean;
|
|
781
|
+
export declare const convertLocalDateToTimezoneDate: (date: Date, timezone?: string) => Date;
|
|
778
782
|
/**
|
|
779
783
|
* Checks if a date range matches "Today" preset
|
|
780
784
|
*/
|
|
781
|
-
export declare const matchesTodayPreset: (range: DateRange) => boolean;
|
|
785
|
+
export declare const matchesTodayPreset: (range: DateRange, timezone?: string) => boolean;
|
|
782
786
|
/**
|
|
783
787
|
* Checks if a date range matches "Yesterday" preset
|
|
784
788
|
*/
|
|
785
|
-
export declare const matchesYesterdayPreset: (range: DateRange) => boolean;
|
|
789
|
+
export declare const matchesYesterdayPreset: (range: DateRange, timezone?: string) => boolean;
|
|
786
790
|
/**
|
|
787
791
|
* Checks if a date range matches "Tomorrow" preset
|
|
788
792
|
*/
|
|
@@ -798,7 +802,7 @@ export declare const matchesLastMonthPreset: (range: DateRange) => boolean;
|
|
|
798
802
|
/**
|
|
799
803
|
* Robust preset detection that works with both UTC and local timezone dates
|
|
800
804
|
*/
|
|
801
|
-
export declare const detectPresetFromRange: (range: DateRange) => DateRangePreset;
|
|
805
|
+
export declare const detectPresetFromRange: (range: DateRange, timezone?: string) => DateRangePreset;
|
|
802
806
|
/**
|
|
803
807
|
* Default preset configuration for the DateRangePicker
|
|
804
808
|
*/
|
|
@@ -50,6 +50,7 @@ import { ResponsiveAlertV2Tokens } from '../components/AlertV2/alertV2.tokens';
|
|
|
50
50
|
import { ResponsiveAccordionV2Tokens } from '../components/AccordionV2/accordionV2.tokens';
|
|
51
51
|
import { ResponsiveSnackbarV2Tokens } from '../components/SnackbarV2/snackbarV2.tokens';
|
|
52
52
|
import { ResponsiveSwitchV2Tokens } from '../components/SwitchV2/switchV2.tokens';
|
|
53
|
+
import { ResponsiveAvatarV2Tokens } from '../components/AvatarV2/avatarV2.tokens';
|
|
53
54
|
import { ResponsiveTextInputV2Tokens } from '../components/InputsV2/TextInputV2/TextInputV2.tokens';
|
|
54
55
|
export type ComponentTokenType = {
|
|
55
56
|
TAGS?: ResponsiveTagTokens;
|
|
@@ -101,6 +102,7 @@ export type ComponentTokenType = {
|
|
|
101
102
|
ACCORDIONV2?: ResponsiveAccordionV2Tokens;
|
|
102
103
|
SNACKBARV2?: ResponsiveSnackbarV2Tokens;
|
|
103
104
|
SWITCHV2?: ResponsiveSwitchV2Tokens;
|
|
105
|
+
AVATARV2?: ResponsiveAvatarV2Tokens;
|
|
104
106
|
TEXT_INPUTV2?: ResponsiveTextInputV2Tokens;
|
|
105
107
|
};
|
|
106
108
|
type ThemeContextType = {
|
|
@@ -48,5 +48,6 @@ import { ResponsiveAlertV2Tokens } from '../components/AlertV2';
|
|
|
48
48
|
import { ResponsiveAccordionV2Tokens } from '../components/AccordionV2';
|
|
49
49
|
import { ResponsiveSnackbarV2Tokens } from '../components/SnackbarV2';
|
|
50
50
|
import { ResponsiveSwitchV2Tokens } from '../components/SwitchV2/switchV2.tokens';
|
|
51
|
+
import { ResponsiveAvatarV2Tokens } from '../components/AvatarV2/avatarV2.tokens';
|
|
51
52
|
import { ResponsiveTextInputV2Tokens } from '../components/InputsV2/TextInputV2/TextInputV2.tokens';
|
|
52
|
-
export declare const useComponentToken: (component: keyof ComponentTokenType) => ResponsiveSearchInputTokens | ResponsiveTagTokens | ResponsiveTextAreaTokens | ResponsiveTextInputTokens | ResponsiveNumberInputTokens | ResponsiveAlertTokens | ResponsiveRadioTokens | ResponsiveOTPInputTokens | ResponsiveUnitInputTokens | ResponsiveMultiValueInputTokens | ResponsiveSwitchTokens | ResponsiveCheckboxTokens | ResponsiveTabsTokens | ResponsiveTooltipTokens | ResponsiveDropdownInputTokens | ResponsiveModalTokens | ResponsiveBreadcrumbTokens | ResponsivePopoverTokens | ResponsiveMenuTokensType | ResponsiveMultiSelectTokens | ResponsiveSingleSelectTokens | ResponsiveTableTokens | ResponsiveCalendarTokens | ResponsiveAccordionTokens | ResponsiveStatCardTokens | ResponsiveProgressBarTokens | ResponsiveDrawerTokens | ResponsiveChartTokens | ResponsiveSnackbarTokens | ResponsiveStepperTokens | ResponsiveKeyValuePairTokens | ResponsiveCardTokens | ResponsiveSkeletonTokens | ResponsiveTopbarTokens | ResponsiveAvatarTokens | ResponsiveAvatarGroupTokens | ResponsiveSidebarTokens | ResponsiveUploadTokens | ResponsiveCodeBlockTokens | ResponsiveMobileNavigationTokens | ResponsiveDirectoryTokens | ResponsiveChatInputTokensType | ResponsiveButtonTokens | ResponsiveButtonV2Tokens | ResponsiveChatInputTokensType | ResponsiveTagV2Tokens | ResponsiveAlertV2Tokens | ResponsiveAccordionV2Tokens | ResponsiveSnackbarV2Tokens | ResponsiveSwitchV2Tokens | ResponsiveTextInputV2Tokens;
|
|
53
|
+
export declare const useComponentToken: (component: keyof ComponentTokenType) => ResponsiveSearchInputTokens | ResponsiveTagTokens | ResponsiveTextAreaTokens | ResponsiveTextInputTokens | ResponsiveNumberInputTokens | ResponsiveAlertTokens | ResponsiveRadioTokens | ResponsiveOTPInputTokens | ResponsiveUnitInputTokens | ResponsiveMultiValueInputTokens | ResponsiveSwitchTokens | ResponsiveCheckboxTokens | ResponsiveTabsTokens | ResponsiveTooltipTokens | ResponsiveDropdownInputTokens | ResponsiveModalTokens | ResponsiveBreadcrumbTokens | ResponsivePopoverTokens | ResponsiveMenuTokensType | ResponsiveMultiSelectTokens | ResponsiveSingleSelectTokens | ResponsiveTableTokens | ResponsiveCalendarTokens | ResponsiveAccordionTokens | ResponsiveStatCardTokens | ResponsiveProgressBarTokens | ResponsiveDrawerTokens | ResponsiveChartTokens | ResponsiveSnackbarTokens | ResponsiveStepperTokens | ResponsiveKeyValuePairTokens | ResponsiveCardTokens | ResponsiveSkeletonTokens | ResponsiveTopbarTokens | ResponsiveAvatarTokens | ResponsiveAvatarGroupTokens | ResponsiveSidebarTokens | ResponsiveUploadTokens | ResponsiveCodeBlockTokens | ResponsiveMobileNavigationTokens | ResponsiveDirectoryTokens | ResponsiveChatInputTokensType | ResponsiveButtonTokens | ResponsiveButtonV2Tokens | ResponsiveChatInputTokensType | ResponsiveTagV2Tokens | ResponsiveAlertV2Tokens | ResponsiveAccordionV2Tokens | ResponsiveSnackbarV2Tokens | ResponsiveSwitchV2Tokens | ResponsiveAvatarV2Tokens | ResponsiveTextInputV2Tokens;
|