@aic-kits/react 0.34.6 → 0.34.9

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.
Files changed (37) hide show
  1. package/dist/components/DatePicker/DatePickerCalendar.d.ts +2 -0
  2. package/dist/components/DatePicker/DatePickerGrid.d.ts +2 -0
  3. package/dist/components/DatePicker/DatePickerHeader.d.ts +8 -0
  4. package/dist/components/DatePicker/DatePickerInput.d.ts +3 -0
  5. package/dist/components/DatePicker/DatePickerMonthPicker.d.ts +13 -0
  6. package/dist/components/DatePicker/DatePickerPopup.d.ts +6 -0
  7. package/dist/components/DatePicker/DatePickerRangeInput.d.ts +26 -0
  8. package/dist/components/DatePicker/DatePickerTimezone.d.ts +2 -0
  9. package/dist/components/DatePicker/DatePickerYearPicker.d.ts +11 -0
  10. package/dist/components/DatePicker/StyledDatePicker.d.ts +26 -0
  11. package/dist/components/DatePicker/constants.d.ts +23 -0
  12. package/dist/components/DatePicker/hooks.d.ts +37 -0
  13. package/dist/components/DatePicker/index.d.ts +4 -0
  14. package/dist/components/DatePicker/types.d.ts +317 -0
  15. package/dist/components/DatePicker/utils.d.ts +203 -0
  16. package/dist/components/Input/types.d.ts +8 -0
  17. package/dist/components/Select/SelectDropdown.d.ts +2 -2
  18. package/dist/components/TimePicker/StyledTimePicker.d.ts +15 -0
  19. package/dist/components/TimePicker/TimePickerInput.d.ts +3 -0
  20. package/dist/components/TimePicker/TimePickerPopup.d.ts +2 -0
  21. package/dist/components/TimePicker/TimePickerRangeInput.d.ts +24 -0
  22. package/dist/components/TimePicker/TimePickerWheel.d.ts +2 -0
  23. package/dist/components/TimePicker/TimePickerWheels.d.ts +2 -0
  24. package/dist/components/TimePicker/constants.d.ts +12 -0
  25. package/dist/components/TimePicker/hooks.d.ts +25 -0
  26. package/dist/components/TimePicker/index.d.ts +3 -0
  27. package/dist/components/TimePicker/types.d.ts +177 -0
  28. package/dist/components/TimePicker/utils.d.ts +73 -0
  29. package/dist/components/index.d.ts +2 -0
  30. package/dist/hooks/index.d.ts +1 -0
  31. package/dist/hooks/usePopupPosition.d.ts +13 -0
  32. package/dist/index.cjs +480 -313
  33. package/dist/index.js +10885 -7698
  34. package/dist/theme/components/datepicker.d.ts +85 -0
  35. package/dist/theme/components/index.d.ts +14 -0
  36. package/dist/theme/components/timepicker.d.ts +50 -0
  37. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ import { DatePickerCalendarProps } from './types';
2
+ export declare const DatePickerCalendar: ({ currentMonth, selectedDate, onDateSelect, onMonthChange, dateConfig, weekStartDay, locale, size, disabled, rangeMarkerDate, }: DatePickerCalendarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { DatePickerGridProps } from './types';
2
+ export declare const DatePickerGrid: ({ currentMonth, selectedDate, onDateClick, dateConfig, weekStartDay, locale, size, disabled, rangeMarkerDate, }: DatePickerGridProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { DatePickerHeaderProps, DatePickerViewMode } from './types';
2
+ interface DatePickerHeaderInternalProps extends DatePickerHeaderProps {
3
+ viewMode: DatePickerViewMode;
4
+ onMonthClick: () => void;
5
+ onYearClick: () => void;
6
+ }
7
+ export declare const DatePickerHeader: ({ currentMonth, onPrevMonth, onNextMonth, locale, size, disabled, dateConfig, viewMode, onMonthClick, onYearClick, }: DatePickerHeaderInternalProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ import { InputHandle } from '../Input/types';
2
+ import { DatePickerInputProps } from './types';
3
+ export declare const DatePickerInput: import('react').ForwardRefExoticComponent<DatePickerInputProps & import('react').RefAttributes<InputHandle>>;
@@ -0,0 +1,13 @@
1
+ import { DatePickerSize, DateConfig } from './types';
2
+ interface DatePickerMonthPickerProps {
3
+ currentYear: number;
4
+ selectedMonth: number | null;
5
+ selectedYear: number | null;
6
+ onSelect: (month: number) => void;
7
+ locale: string;
8
+ size: DatePickerSize;
9
+ dateConfig?: DateConfig;
10
+ disabled?: boolean;
11
+ }
12
+ export declare const DatePickerMonthPicker: ({ currentYear, selectedMonth, selectedYear, onSelect, locale, size, dateConfig, disabled, }: DatePickerMonthPickerProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import { DatePickerPopupProps, DatePickerSize } from './types';
2
+ interface DatePickerPopupInternalProps extends DatePickerPopupProps {
3
+ size: DatePickerSize;
4
+ }
5
+ export declare const DatePickerPopup: ({ isOpen, anchorRef, onClose, children, size: _size, }: DatePickerPopupInternalProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ export interface DatePickerRangeInputProps {
3
+ startValue: string;
4
+ endValue: string;
5
+ onStartChange: (value: string) => void;
6
+ onEndChange: (value: string) => void;
7
+ onStartFocus: () => void;
8
+ onEndFocus: () => void;
9
+ onStartBlur?: () => void;
10
+ onEndBlur?: () => void;
11
+ onStartEnterPress?: () => void;
12
+ onEndEnterPress?: () => void;
13
+ onClear?: () => void;
14
+ hasValue?: boolean;
15
+ disabled?: boolean;
16
+ error?: boolean;
17
+ startPlaceholder?: string;
18
+ endPlaceholder?: string;
19
+ }
20
+ export interface DatePickerRangeInputHandle {
21
+ focusStart: () => void;
22
+ focusEnd: () => void;
23
+ blurStart: () => void;
24
+ blurEnd: () => void;
25
+ }
26
+ export declare const DatePickerRangeInput: React.ForwardRefExoticComponent<DatePickerRangeInputProps & React.RefAttributes<DatePickerRangeInputHandle>>;
@@ -0,0 +1,2 @@
1
+ import { DatePickerTimezoneProps } from './types';
2
+ export declare const DatePickerTimezone: ({ timezones, selectedTimezone, onTimezoneChange, label, size, disabled, }: DatePickerTimezoneProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { DatePickerSize, DateConfig } from './types';
2
+ interface DatePickerYearPickerProps {
3
+ currentYear: number;
4
+ selectedYear: number | null;
5
+ onSelect: (year: number) => void;
6
+ size: DatePickerSize;
7
+ dateConfig?: DateConfig;
8
+ disabled?: boolean;
9
+ }
10
+ export declare const DatePickerYearPicker: ({ currentYear, selectedYear, onSelect, size, dateConfig, disabled, }: DatePickerYearPickerProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,26 @@
1
+ interface StyledDateCellProps {
2
+ $isSelected: boolean;
3
+ $isToday: boolean;
4
+ $isDisabled: boolean;
5
+ $isOutsideMonth: boolean;
6
+ $isRangeMarker: boolean;
7
+ $size: number;
8
+ $fontSize: number;
9
+ }
10
+ export declare const StyledDateCell: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledDateCellProps>> & string;
11
+ interface StyledPickerCellProps {
12
+ $isSelected: boolean;
13
+ $isDisabled: boolean;
14
+ $isCurrent: boolean;
15
+ $height: number;
16
+ $fontSize: number;
17
+ }
18
+ export declare const StyledPickerCell: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledPickerCellProps>> & string;
19
+ interface StyledDateRangeInputBoxProps {
20
+ $isFocused: boolean;
21
+ $isDisabled: boolean;
22
+ $error: boolean;
23
+ }
24
+ export declare const StyledDateRangeInputBox: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledDateRangeInputBoxProps>> & string;
25
+ export declare const StyledDateRangeInput: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
26
+ export {};
@@ -0,0 +1,23 @@
1
+ import { TimezoneOption } from './types';
2
+ /**
3
+ * Get default list of timezones from browser's Intl API
4
+ * Sorted by UTC offset, with current offset displayed
5
+ * Lazy-loaded and cached on first call
6
+ */
7
+ export declare const getDefaultTimezones: () => TimezoneOption[];
8
+ /**
9
+ * @deprecated Use getDefaultTimezones() instead for lazy loading
10
+ */
11
+ export declare const DEFAULT_TIMEZONES: TimezoneOption[];
12
+ /**
13
+ * Default timezone (Vietnam - Ho Chi Minh City)
14
+ */
15
+ export declare const DEFAULT_TIMEZONE = "Asia/Saigon";
16
+ /**
17
+ * Default locale (English - US)
18
+ */
19
+ export declare const DEFAULT_LOCALE = "en-US";
20
+ /**
21
+ * Default week start day (Monday = 1)
22
+ */
23
+ export declare const DEFAULT_WEEK_START_DAY = 1;
@@ -0,0 +1,37 @@
1
+ import { DatePickerValue, DateConfig, TimeFormat, TimeValue } from './types';
2
+ interface UseDatePickerStateParams {
3
+ value?: DatePickerValue;
4
+ onChange?: (value: DatePickerValue) => void;
5
+ onClose?: () => void;
6
+ open?: boolean;
7
+ onOpenChange?: (open: boolean) => void;
8
+ defaultMonth?: Date;
9
+ defaultTimezone?: string;
10
+ disabled?: boolean;
11
+ dateConfig?: DateConfig;
12
+ showTime?: boolean;
13
+ timeFormat?: TimeFormat;
14
+ }
15
+ export declare function useDatePickerState({ value, onChange, onClose, open, onOpenChange, defaultMonth, defaultTimezone, disabled, showTime, }: UseDatePickerStateParams): {
16
+ isOpen: boolean;
17
+ selectedDate: Date | null;
18
+ selectedTime: TimeValue | null;
19
+ selectedTimezone: string | null;
20
+ currentMonth: Date;
21
+ containerRef: import('react').RefObject<HTMLDivElement | null>;
22
+ inputRef: import('react').RefObject<HTMLInputElement | null>;
23
+ handleOpen: () => void;
24
+ handleClose: () => void;
25
+ setIsOpen: (isOpenValue: boolean) => void;
26
+ handleToggle: () => void;
27
+ handleDateSelect: (date: Date | null) => void;
28
+ setSelectedDatePreview: (date: Date | null) => void;
29
+ handleTimeSelect: (time: TimeValue | null) => void;
30
+ setSelectedTimePreview: (time: TimeValue | null) => void;
31
+ handleTimezoneChange: (timezone: string) => void;
32
+ handleMonthChange: (newMonth: Date) => void;
33
+ reset: () => void;
34
+ getValue: () => DatePickerValue;
35
+ focus: () => void;
36
+ };
37
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DatePickerProps, DatePickerHandle } from './types';
2
+ export declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<DatePickerHandle>>;
3
+ export type { DatePickerProps, DatePickerHandle, DatePickerValue, DateConfig, DatePickerSize, DatePickerVariant, DatePickerMode, WeekStartDay, TimeFormat, TimeValue, } from './types';
4
+ export { formatDateTimeForInput, getTimeSlotsForDate, getAllUniqueTimeSlots, getDatesFromSlots, dateHasSlots, createSlotsDateConfig, } from './utils';
@@ -0,0 +1,317 @@
1
+ import { Color, DatePickerSize, DatePickerVariant, TimeFormat } from '../../theme';
2
+ import { BoxProps } from '../Box';
3
+ import { TimeValue } from '../TimePicker/types';
4
+ export type { DatePickerSize, DatePickerVariant, TimeValue, TimeFormat };
5
+ /**
6
+ * Configuration for date constraints
7
+ */
8
+ export interface DateConfig {
9
+ /** Minimum selectable date */
10
+ minDate?: Date;
11
+ /** Maximum selectable date */
12
+ maxDate?: Date;
13
+ /** Specific dates to disable */
14
+ disabledDates?: Date[];
15
+ /** Function to determine if a date should be disabled */
16
+ isDateDisabled?: (date: Date) => boolean;
17
+ /** Days of week to disable (0 = Sunday, 6 = Saturday) */
18
+ disabledDaysOfWeek?: number[];
19
+ }
20
+ /**
21
+ * Represents a timezone option
22
+ */
23
+ export interface TimezoneOption {
24
+ /** Timezone identifier (e.g., "America/New_York") */
25
+ value: string;
26
+ /** Display label (e.g., "Eastern Time - US & Canada") */
27
+ label: string;
28
+ /** UTC offset (e.g., "-05:00") */
29
+ offset: string;
30
+ /** Abbreviated name (e.g., "ET") */
31
+ abbreviation?: string;
32
+ }
33
+ /**
34
+ * Value returned when a date and time are selected
35
+ */
36
+ export interface DatePickerValue {
37
+ /** Selected date */
38
+ date: Date | null;
39
+ /** Selected time (when showTime is enabled) */
40
+ time?: TimeValue | null;
41
+ /** Selected timezone */
42
+ timezone: string | null;
43
+ }
44
+ export type DatePickerMode = 'inline' | 'popup';
45
+ export type WeekStartDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
46
+ export type DatePickerViewMode = 'days' | 'months' | 'years';
47
+ /**
48
+ * Main DatePicker component props
49
+ */
50
+ export interface DatePickerProps extends Omit<BoxProps, 'onChange'> {
51
+ /**
52
+ * Currently selected value (single mode)
53
+ */
54
+ value?: DatePickerValue;
55
+ /**
56
+ * Callback fired when selection changes (single mode)
57
+ */
58
+ onChange?: (value: DatePickerValue) => void;
59
+ /**
60
+ * Callback fired when picker is closed (popup mode only)
61
+ */
62
+ onClose?: () => void;
63
+ /**
64
+ * Enable range mode (two date inputs: start and end)
65
+ * @default false
66
+ */
67
+ range?: boolean;
68
+ /**
69
+ * Start date value (range mode)
70
+ */
71
+ startValue?: DatePickerValue;
72
+ /**
73
+ * End date value (range mode)
74
+ */
75
+ endValue?: DatePickerValue;
76
+ /**
77
+ * Callback when start date changes (range mode)
78
+ */
79
+ onStartChange?: (value: DatePickerValue) => void;
80
+ /**
81
+ * Callback when end date changes (range mode)
82
+ */
83
+ onEndChange?: (value: DatePickerValue) => void;
84
+ /**
85
+ * Display mode: inline (always visible) or popup (triggered by input)
86
+ * @default 'inline'
87
+ */
88
+ mode?: DatePickerMode;
89
+ /**
90
+ * Show input field in inline mode header (for manual date/time entry)
91
+ * @default false
92
+ */
93
+ showInlineInput?: boolean;
94
+ /**
95
+ * Whether the popup is open (controlled mode for popup)
96
+ */
97
+ open?: boolean;
98
+ /**
99
+ * Callback when open state changes
100
+ */
101
+ onOpenChange?: (open: boolean) => void;
102
+ /**
103
+ * Date constraints and disabled dates
104
+ */
105
+ dateConfig?: DateConfig;
106
+ /**
107
+ * Disable selection of dates before today
108
+ * @default false
109
+ */
110
+ disablePastDates?: boolean;
111
+ /**
112
+ * Initial month to display
113
+ */
114
+ defaultMonth?: Date;
115
+ /**
116
+ * First day of week (0 = Sunday, 1 = Monday, etc.)
117
+ * @default 0
118
+ */
119
+ weekStartDay?: WeekStartDay;
120
+ /**
121
+ * Locale for date formatting (e.g., 'en-US', 'fr-FR')
122
+ * @default 'en-US'
123
+ */
124
+ locale?: string;
125
+ /**
126
+ * Time format for display
127
+ * '12h' shows AM/PM (e.g., "9:00am")
128
+ * '24h' shows 24-hour format (e.g., "09:00")
129
+ * @default '12h'
130
+ */
131
+ timeFormat?: TimeFormat;
132
+ /**
133
+ * Show time picker alongside date picker
134
+ * @default false
135
+ */
136
+ showTime?: boolean;
137
+ /**
138
+ * Minute step for time picker wheel
139
+ * @default 1
140
+ */
141
+ minuteStep?: number;
142
+ /**
143
+ * Predefined time slots to choose from (without date restriction).
144
+ * When provided, shows a single wheel with these slots instead of hour/minute wheels.
145
+ * Example: [{ hours: 9, minutes: 0 }, { hours: 12, minutes: 30 }]
146
+ * Note: Use `slots` instead if you need date+time combinations.
147
+ */
148
+ timeSlots?: TimeValue[];
149
+ /**
150
+ * Predefined date+time slots to choose from.
151
+ * When provided, only dates/times in this array can be selected.
152
+ * Time picker will show only available times for the selected date.
153
+ * Example: [
154
+ * { date: new Date('2024-01-15'), time: { hours: 9, minutes: 0 }, timezone: null },
155
+ * { date: new Date('2024-01-15'), time: { hours: 14, minutes: 30 }, timezone: null },
156
+ * { date: new Date('2024-01-16'), time: { hours: 10, minutes: 0 }, timezone: null },
157
+ * ]
158
+ */
159
+ slots?: DatePickerValue[];
160
+ /**
161
+ * Size variant
162
+ * @default 'md'
163
+ */
164
+ size?: DatePickerSize;
165
+ /**
166
+ * Visual variant
167
+ * @default 'outlined'
168
+ */
169
+ variant?: DatePickerVariant;
170
+ /**
171
+ * Primary color for selected states
172
+ * @default 'primary'
173
+ */
174
+ color?: Color;
175
+ /**
176
+ * Label text above the input
177
+ */
178
+ label?: string;
179
+ /**
180
+ * Helper text below the input
181
+ */
182
+ helperText?: string;
183
+ /**
184
+ * Error message (takes precedence over helperText)
185
+ */
186
+ error?: string;
187
+ /**
188
+ * Whether the picker is disabled
189
+ * @default false
190
+ */
191
+ disabled?: boolean;
192
+ /**
193
+ * Whether the picker is in loading state
194
+ * @default false
195
+ */
196
+ loading?: boolean;
197
+ }
198
+ export interface DatePickerCalendarProps {
199
+ /** Currently displayed month */
200
+ currentMonth: Date;
201
+ /** Selected date */
202
+ selectedDate: Date | null;
203
+ /** Callback when date is selected */
204
+ onDateSelect: (date: Date) => void;
205
+ /** Callback when month changes */
206
+ onMonthChange: (date: Date) => void;
207
+ /** Date constraints */
208
+ dateConfig?: DateConfig;
209
+ /** First day of week */
210
+ weekStartDay: WeekStartDay;
211
+ /** Locale for formatting */
212
+ locale: string;
213
+ /** Size variant */
214
+ size: DatePickerSize;
215
+ /** Whether interaction is disabled */
216
+ disabled?: boolean;
217
+ /** Range marker date (shows the other end of range in range mode) */
218
+ rangeMarkerDate?: Date | null;
219
+ }
220
+ export interface DatePickerHeaderProps {
221
+ /** Current month being displayed */
222
+ currentMonth: Date;
223
+ /** Callback to go to previous month */
224
+ onPrevMonth: () => void;
225
+ /** Callback to go to next month */
226
+ onNextMonth: () => void;
227
+ /** Locale for month/year formatting */
228
+ locale: string;
229
+ /** Size variant */
230
+ size: DatePickerSize;
231
+ /** Whether navigation is disabled */
232
+ disabled?: boolean;
233
+ /** Date config for determining if navigation should be disabled */
234
+ dateConfig?: DateConfig;
235
+ }
236
+ export interface DatePickerGridProps {
237
+ /** Current month to display */
238
+ currentMonth: Date;
239
+ /** Selected date */
240
+ selectedDate: Date | null;
241
+ /** Callback when date is clicked */
242
+ onDateClick: (date: Date) => void;
243
+ /** Date constraints */
244
+ dateConfig?: DateConfig;
245
+ /** First day of week */
246
+ weekStartDay: WeekStartDay;
247
+ /** Locale for formatting */
248
+ locale: string;
249
+ /** Size variant */
250
+ size: DatePickerSize;
251
+ /** Whether interaction is disabled */
252
+ disabled?: boolean;
253
+ /** Range marker date (shows the other end of range in range mode) */
254
+ rangeMarkerDate?: Date | null;
255
+ }
256
+ export interface DatePickerTimezoneProps {
257
+ /** Available timezones */
258
+ timezones: TimezoneOption[];
259
+ /** Currently selected timezone */
260
+ selectedTimezone: string | null;
261
+ /** Callback when timezone changes */
262
+ onTimezoneChange: (timezone: string) => void;
263
+ /** Section label */
264
+ label?: string;
265
+ /** Size variant */
266
+ size: DatePickerSize;
267
+ /** Whether interaction is disabled */
268
+ disabled?: boolean;
269
+ }
270
+ export interface DatePickerInputProps {
271
+ /** Input value (formatted date string) */
272
+ value: string;
273
+ /** Callback when input value changes */
274
+ onChange: (value: string) => void;
275
+ /** Callback when input is focused (opens calendar) */
276
+ onFocus: () => void;
277
+ /** Callback when input is blurred */
278
+ onBlur?: () => void;
279
+ /** Callback when Enter key is pressed */
280
+ onEnterPress?: () => void;
281
+ /** Callback when clear button is clicked */
282
+ onClear?: () => void;
283
+ /** Placeholder text */
284
+ placeholder?: string;
285
+ /** Label text */
286
+ label?: string;
287
+ /** Helper text */
288
+ helperText?: string;
289
+ /** Error message */
290
+ error?: string;
291
+ /** Whether input is disabled */
292
+ disabled?: boolean;
293
+ /** Whether input has a value (to show clear button) */
294
+ hasValue: boolean;
295
+ }
296
+ export interface DatePickerPopupProps {
297
+ /** Whether popup is open */
298
+ isOpen: boolean;
299
+ /** Anchor element ref */
300
+ anchorRef: React.RefObject<HTMLDivElement | null>;
301
+ /** Close handler */
302
+ onClose: () => void;
303
+ /** Popup content */
304
+ children: React.ReactNode;
305
+ }
306
+ export interface DatePickerHandle {
307
+ /** Open the picker (popup mode) */
308
+ open: () => void;
309
+ /** Close the picker (popup mode) */
310
+ close: () => void;
311
+ /** Reset to initial value */
312
+ reset: () => void;
313
+ /** Get current value */
314
+ getValue: () => DatePickerValue;
315
+ /** Focus the input (popup mode) */
316
+ focus: () => void;
317
+ }