@pushwoosh/dumb-components 1.1.148 → 1.1.149
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/AccessForbidden/AccessForbidden.d.ts +3 -0
- package/AccessForbidden/AccessForbidden.js +3 -0
- package/Alert/Alert.d.ts +7 -0
- package/Alert/Alert.js +7 -0
- package/Alert/types.d.ts +6 -0
- package/ApplicationPreloader/ApplicationPreloader.d.ts +8 -0
- package/ApplicationPreloader/ApplicationPreloader.js +6 -0
- package/Badge/Badge.d.ts +6 -0
- package/Badge/Badge.js +6 -0
- package/Badge/types.d.ts +6 -0
- package/Banner/Banner.d.ts +7 -0
- package/Banner/Banner.js +7 -0
- package/Banner/types.d.ts +16 -0
- package/Button/Button.d.ts +19 -0
- package/Button/GhostButton.d.ts +1 -0
- package/Button/GhostButton.js +1 -0
- package/Button/RemoveButton.d.ts +6 -0
- package/Button/RemoveButton.js +6 -0
- package/Button/types.d.ts +21 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.d.ts +12 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.js +12 -0
- package/Calendar/CalendarDropdown/helpers.d.ts +4 -0
- package/Calendar/CalendarDropdown/helpers.js +4 -0
- package/Calendar/CalendarDropdown/types.d.ts +33 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.d.ts +7 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.js +7 -0
- package/Calendar/CalendarSuperForm/types.d.ts +36 -10
- package/Calendar/helpers.d.ts +10 -0
- package/Calendar/helpers.js +10 -0
- package/Calendar/types.d.ts +16 -1
- package/CardMetric/CardMetric.d.ts +7 -0
- package/CardMetric/CardMetric.js +7 -0
- package/CardMetric/types.d.ts +13 -0
- package/Checkbox/Checkbox.d.ts +6 -0
- package/Checkbox/Checkbox.js +6 -0
- package/Checkbox/types.d.ts +13 -0
- package/Chip/Chip.d.ts +7 -0
- package/Chip/Chip.js +7 -0
- package/Chip/Chip.types.d.ts +9 -0
- package/CodeEditor/CodeEditor.d.ts +7 -0
- package/CodeEditor/CodeEditor.js +7 -0
- package/CodeEditor/languages/html.d.ts +1 -0
- package/CodeEditor/languages/html.js +1 -0
- package/CodeEditor/languages/json.d.ts +1 -0
- package/CodeEditor/languages/json.js +1 -0
- package/CodeEditor/languages/liquid.d.ts +1 -0
- package/CodeEditor/languages/liquid.js +1 -0
- package/CodeEditor/types.d.ts +11 -0
- package/CrashScreen/CrashScreen.d.ts +4 -0
- package/CrashScreen/CrashScreen.js +4 -0
- package/DateTimePicker/components/DatePicker/DatePicker.d.ts +5 -0
- package/DateTimePicker/components/DatePicker/DatePicker.js +5 -0
- package/DateTimePicker/components/DatePicker/types.d.ts +9 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +5 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +5 -0
- package/DateTimePicker/components/DatePickerField/types.d.ts +9 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +5 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +5 -0
- package/DateTimePicker/components/DateTimePicker/types.d.ts +6 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +5 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +5 -0
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +9 -0
- package/DateTimePicker/types.d.ts +5 -0
- package/Drawer/components/Drawer/Drawer.d.ts +11 -0
- package/Drawer/components/Drawer/Drawer.js +11 -0
- package/Drawer/components/Drawer/types.d.ts +9 -0
- package/Drawer/components/DrawerContent/styles.d.ts +3 -0
- package/Drawer/components/DrawerContent/styles.js +3 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.d.ts +7 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.js +7 -0
- package/Drawer/components/DrawerDocs/hooks.d.ts +4 -0
- package/Drawer/components/DrawerDocs/hooks.js +4 -0
- package/Drawer/components/DrawerDocs/types.d.ts +4 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +12 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +12 -0
- package/DropdownMenu/components/DropdownMenu/types.d.ts +15 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -0
- package/DropdownMenu/components/DropdownMenuButton/types.d.ts +16 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +7 -0
- package/DropdownMenu/components/DropdownMenuItem/types.d.ts +6 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +8 -0
- package/DropdownMenu/components/DropdownMenuSection/types.d.ts +3 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/types.d.ts +5 -0
- package/EditableField/EditableField.d.ts +9 -0
- package/EditableField/EditableField.js +9 -0
- package/EditableField/types.d.ts +12 -0
- package/EmailTemplatePreview/EmailTemplatePreview.d.ts +7 -0
- package/EmailTemplatePreview/EmailTemplatePreview.js +7 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +4 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +4 -0
- package/EmailTemplatePreview/helpers.d.ts +8 -0
- package/EmailTemplatePreview/helpers.js +8 -0
- package/EmailTemplatePreview/types.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.js +7 -0
- package/EnhancedInput/SearchInput.d.ts +6 -0
- package/EnhancedInput/SearchInput.js +6 -0
- package/EnhancedInput/types.d.ts +5 -0
- package/ExportResult/ExportResult.d.ts +7 -0
- package/ExportResult/ExportResult.js +7 -0
- package/ExportResult/types.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.js +7 -0
- package/ExternalImagePreview/types.d.ts +7 -0
- package/FieldBox/FieldBox.d.ts +9 -0
- package/FieldBox/FieldBox.js +9 -0
- package/FieldBox/types.d.ts +10 -0
- package/FrequencyCapping/FrequencyCappingEdit.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingEdit.js +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.js +7 -0
- package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
- package/FrequencyCapping/FrequencyCappingReadonly.js +3 -0
- package/FrequencyCapping/types.d.ts +37 -0
- package/FrequencyCapping/types.js +1 -0
- package/GetStartedPage/GetStartedPage.d.ts +7 -0
- package/GetStartedPage/GetStartedPage.js +7 -0
- package/GetStartedPage/types.d.ts +7 -0
- package/InputFile/InputFile.d.ts +7 -0
- package/InputFile/InputFile.js +7 -0
- package/InputFile/types.d.ts +18 -0
- package/Link/Link.d.ts +18 -0
- package/Link/types.d.ts +17 -0
- package/Modal/components/Modal/Modal.d.ts +11 -0
- package/Modal/components/Modal/Modal.js +11 -0
- package/Modal/components/Modal/types.d.ts +6 -0
- package/Modal/components/ModalConfirm/ModalConfirm.d.ts +8 -0
- package/Modal/components/ModalConfirm/ModalConfirm.js +8 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +7 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.js +7 -0
- package/Modal/components/ModalConfirm/hooks.d.ts +8 -0
- package/Modal/components/ModalConfirm/hooks.js +8 -0
- package/Modal/components/ModalConfirm/types.d.ts +16 -0
- package/Modal/components/ModalContent/styles.d.ts +5 -0
- package/Modal/components/ModalContent/styles.js +5 -0
- package/Modal/components/ModalTitle/ModalTitle.d.ts +6 -0
- package/Modal/components/ModalTitle/ModalTitle.js +6 -0
- package/Modal/components/ModalTitle/types.d.ts +3 -0
- package/NotificationInbox/NotificationBar.d.ts +7 -0
- package/NotificationInbox/NotificationBar.js +7 -0
- package/NotificationInbox/NotificationBell.d.ts +7 -0
- package/NotificationInbox/NotificationBell.js +7 -0
- package/NotificationInbox/NotificationInbox.d.ts +7 -0
- package/NotificationInbox/NotificationInbox.js +7 -0
- package/NotificationInbox/types.d.ts +31 -0
- package/NumberPicker/NumberPicker.d.ts +7 -0
- package/NumberPicker/NumberPicker.js +7 -0
- package/NumberPicker/types.d.ts +12 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +7 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.js +7 -0
- package/PageHeader/components/AutosizeInput/types.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.js +7 -0
- package/PageHeader/components/PageHeader/types.d.ts +13 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +7 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +7 -0
- package/PageHeader/components/PageHeaderEditable/types.d.ts +19 -0
- package/Pagination/Pagination.d.ts +7 -0
- package/Pagination/Pagination.js +7 -0
- package/Pagination/types.d.ts +7 -0
- package/Popover/Popover.d.ts +10 -0
- package/Popover/Popover.js +10 -0
- package/Popover/styles.d.ts +1 -0
- package/Popover/styles.js +1 -0
- package/Popover/types.d.ts +9 -0
- package/ProgressBar/ProgressBar.d.ts +6 -0
- package/ProgressBar/ProgressBar.js +6 -0
- package/ProgressBar/types.d.ts +7 -0
- package/PushPreview/PushPreview.d.ts +7 -0
- package/PushPreview/PushPreview.js +7 -0
- package/PushPreview/types.d.ts +17 -0
- package/Radio/Radio.d.ts +7 -0
- package/Radio/Radio.js +7 -0
- package/Radio/types.d.ts +14 -0
- package/RadioCard/RadioCard.d.ts +7 -0
- package/RadioCard/RadioCard.js +7 -0
- package/RadioCard/types.d.ts +7 -0
- package/ReCaptcha/ReCaptcha.d.ts +8 -0
- package/ReCaptcha/ReCaptcha.js +8 -0
- package/ReCaptcha/helpers.d.ts +4 -0
- package/ReCaptcha/helpers.js +4 -0
- package/ReCaptcha/hooks.d.ts +4 -0
- package/ReCaptcha/hooks.js +4 -0
- package/ReCaptcha/types.d.ts +5 -0
- package/RichMessageEditor/RichMessageEditor.d.ts +8 -0
- package/RichMessageEditor/RichMessageEditor.js +8 -0
- package/RichMessageEditor/RichMessageEditor.types.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.js +7 -0
- package/RichMessageEditor/slate/types.d.ts +5 -0
- package/RichMessageEditor/types.d.ts +1 -0
- package/RichmediaPreview/RichmediaPreview.d.ts +7 -0
- package/RichmediaPreview/RichmediaPreview.js +7 -0
- package/RichmediaPreview/hooks.d.ts +4 -0
- package/RichmediaPreview/hooks.js +4 -0
- package/RichmediaPreview/types.d.ts +13 -0
- package/Select/Select.d.ts +22 -0
- package/Select/Select.js +22 -0
- package/Select/constants.d.ts +1 -0
- package/Select/constants.js +1 -0
- package/Select/types.d.ts +19 -0
- package/SendRate/SendRateEdit.d.ts +7 -0
- package/SendRate/SendRateEdit.js +7 -0
- package/SendRate/SendRateReadonly.d.ts +3 -0
- package/SendRate/SendRateReadonly.js +3 -0
- package/SendRate/types.d.ts +20 -0
- package/Skeleton/TextSkeleton.d.ts +6 -0
- package/Skeleton/TextSkeleton.js +6 -0
- package/Skeleton/styles.d.ts +2 -0
- package/Skeleton/styles.js +2 -0
- package/Skeleton/types.d.ts +11 -0
- package/SortButton/SortButton.d.ts +6 -0
- package/SortButton/SortButton.js +6 -0
- package/SortButton/types.d.ts +11 -0
- package/Spinner/Spinner.d.ts +6 -0
- package/Spinner/Spinner.js +6 -0
- package/Spinner/types.d.ts +4 -0
- package/StatisticCard/StatisticCard.d.ts +7 -0
- package/StatisticCard/StatisticCard.js +7 -0
- package/StatisticCard/types.d.ts +21 -0
- package/Switch/Switch.d.ts +6 -0
- package/Switch/Switch.js +6 -0
- package/Switch/types.d.ts +8 -0
- package/Tabs/components/Tab/Tab.d.ts +4 -0
- package/Tabs/components/Tab/Tab.js +4 -0
- package/Tabs/components/Tab/types.d.ts +6 -0
- package/Tabs/components/TabBar/TabBar.d.ts +3 -0
- package/Tabs/components/TabBar/TabBar.js +3 -0
- package/Tabs/components/TabBar/types.d.ts +2 -0
- package/Tabs/components/TabPanel/TabPanel.d.ts +4 -0
- package/Tabs/components/TabPanel/TabPanel.js +4 -0
- package/Tabs/components/TabPanel/types.d.ts +3 -0
- package/Tabs/components/Tabs/Tabs.d.ts +11 -0
- package/Tabs/components/Tabs/Tabs.js +11 -0
- package/Tabs/components/Tabs/types.d.ts +4 -0
- package/Tabs/types.d.ts +4 -0
- package/Toast/Toast.d.ts +5 -0
- package/Toast/Toast.js +5 -0
- package/Toast/ToastProvider.d.ts +7 -0
- package/Toast/ToastProvider.js +7 -0
- package/Toast/hooks.d.ts +8 -0
- package/Toast/hooks.js +8 -0
- package/Toast/types.d.ts +24 -0
- package/Tooltip/Tooltip.d.ts +7 -0
- package/Tooltip/Tooltip.js +7 -0
- package/Tooltip/TooltipTrigger.d.ts +13 -0
- package/Tooltip/TooltipTrigger.js +7 -0
- package/Tooltip/types.d.ts +12 -0
- package/hooks/useElementWidth.d.ts +4 -3
- package/hooks/useElementWidth.js +4 -3
- package/hooks/useLayer.d.ts +7 -0
- package/hooks/useLayer.js +7 -0
- package/hooks/useOnClickOutside.d.ts +7 -0
- package/hooks/useOnClickOutside.js +7 -0
- package/native/Input.d.ts +3 -0
- package/native/Input.js +1 -0
- package/native/NativeTimeInput.d.ts +1 -0
- package/native/NativeTimeInput.js +1 -0
- package/native/Select.d.ts +1 -0
- package/native/Select.js +1 -0
- package/native/Textarea.d.ts +1 -0
- package/native/Textarea.js +1 -0
- package/package.json +2 -3
- package/polyglot/react.d.ts +19 -0
- package/polyglot/react.js +19 -0
- package/polyglot/types.d.ts +4 -0
- package/shared/dropdownField/FieldInput.d.ts +1 -0
- package/shared/dropdownField/FieldInput.js +1 -0
- package/shared/dropdownField/FieldShell.d.ts +4 -0
- package/shared/dropdownField/FieldShell.js +4 -0
- package/shared/dropdownField/SuggestionsDropdown.d.ts +4 -0
- package/shared/dropdownField/SuggestionsDropdown.js +4 -0
- package/shared/dropdownField/constants.d.ts +1 -0
- package/shared/dropdownField/constants.js +1 -0
- package/shared/dropdownField/shared.d.ts +7 -0
- package/shared/dropdownField/shared.js +7 -0
- package/shared/dropdownField/types.d.ts +7 -0
- package/shared/dropdownField/useActiveIndex.d.ts +4 -0
- package/shared/dropdownField/useActiveIndex.js +4 -0
- package/shared/dropdownField/useAsyncItems.d.ts +4 -0
- package/shared/dropdownField/useAsyncItems.js +4 -0
- package/shared/dropdownField/useDebouncedValue.d.ts +1 -0
- package/shared/dropdownField/useDebouncedValue.js +1 -0
- package/shared/dropdownField/useDropdownItems.d.ts +4 -0
- package/shared/dropdownField/useDropdownItems.js +4 -0
- package/shared/dropdownField/useDropdownPosition.d.ts +4 -0
- package/shared/dropdownField/useDropdownPosition.js +4 -0
- package/shared/dropdownField/useFieldOpenEffects.d.ts +4 -0
- package/shared/dropdownField/useFieldOpenEffects.js +4 -0
- package/shared/dropdownField/useListNavigation.d.ts +5 -0
- package/shared/dropdownField/useListNavigation.js +5 -0
- package/Alert/ai-documentation.md +0 -132
- package/Badge/ai-documentation.md +0 -155
- package/Banner/ai-documentation.md +0 -285
- package/Button/ai-documentation.md +0 -247
- package/CardMetric/ai-documentation.md +0 -277
- package/Checkbox/ai-documentation.md +0 -231
- package/Chip/ai-documentation.md +0 -281
- package/CodeEditor/ai-documentation.md +0 -350
- package/DateTimePicker/ai-documentation.md +0 -400
- package/Drawer/ai-documentation.md +0 -417
- package/EnhancedInput/ai-documentation.md +0 -352
- package/InputFile/ai-documentation.md +0 -420
- package/Modal/ai-documentation.md +0 -285
- package/PageHeader/ai-documentation.md +0 -511
- package/Pagination/ai-documentation.md +0 -509
- package/Popover/ai-documentation.md +0 -625
- package/ProgressBar/ai-documentation.md +0 -533
- package/Radio/ai-documentation.md +0 -243
- package/Select/ai-documentation.md +0 -374
- package/Skeleton/ai-documentation.md +0 -574
- package/Spinner/ai-documentation.md +0 -607
- package/Switch/ai-documentation.md +0 -312
- package/Tabs/ai-documentation.md +0 -475
- package/Toast/ai-documentation.md +0 -220
- package/Tooltip/ai-documentation.md +0 -340
- package/ai-documentation.md +0 -124
- package/native/ai-documentation.md +0 -485
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
# DateTimePicker - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for DateTimePicker component system
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
**Components:** DateTimePicker, DatePicker, DatePickerField, DateTimePickerField
|
|
9
|
-
**Import Path:** `import { DateTimePicker, DatePicker, DatePickerField, DateTimePickerField } from '@pushwoosh/dumb-components'`
|
|
10
|
-
**Files:** Complex nested structure with multiple components, helpers, and styles
|
|
11
|
-
**Type:** Form Component / Date Input Component
|
|
12
|
-
**Description:** Comprehensive date and time picking system with multiple components for different use cases
|
|
13
|
-
|
|
14
|
-
## TypeScript Interfaces
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
// Main DateTimePicker
|
|
18
|
-
interface DateTimePickerProps {
|
|
19
|
-
value: string;
|
|
20
|
-
userInputDay?: string;
|
|
21
|
-
onChange: (day: string) => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// DatePickerField for form inputs
|
|
25
|
-
interface DatePickerFieldProps {
|
|
26
|
-
value: string;
|
|
27
|
-
error?: boolean;
|
|
28
|
-
allowedPlacements?: Placement[];
|
|
29
|
-
zIndex?: number;
|
|
30
|
-
closeOnSelect?: boolean;
|
|
31
|
-
onChange: (day: string) => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Common types
|
|
35
|
-
type Period = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
|
|
36
|
-
|
|
37
|
-
interface RangeOptions {
|
|
38
|
-
value: Date;
|
|
39
|
-
minDate?: Date | string;
|
|
40
|
-
maxDate?: Date | string;
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Import & Usage
|
|
45
|
-
|
|
46
|
-
**Import:**
|
|
47
|
-
```typescript
|
|
48
|
-
import {
|
|
49
|
-
DateTimePicker,
|
|
50
|
-
DatePicker,
|
|
51
|
-
DatePickerField,
|
|
52
|
-
DateTimePickerField
|
|
53
|
-
} from '@pushwoosh/dumb-components';
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Basic Usage:**
|
|
57
|
-
```tsx
|
|
58
|
-
function App() {
|
|
59
|
-
const [dateTime, setDateTime] = useState('');
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<DateTimePicker
|
|
63
|
-
value={dateTime}
|
|
64
|
-
onChange={setDateTime}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Component Variants
|
|
71
|
-
|
|
72
|
-
### 1. DateTimePicker - Full Date and Time Selection
|
|
73
|
-
```tsx
|
|
74
|
-
// Complete date and time picker with hours, minutes, seconds
|
|
75
|
-
<DateTimePicker
|
|
76
|
-
value={dateTimeString}
|
|
77
|
-
onChange={(utcString) => setDateTime(utcString)}
|
|
78
|
-
userInputDay="2024-12-13"
|
|
79
|
-
/>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### 2. DatePicker - Date Only Selection
|
|
83
|
-
```tsx
|
|
84
|
-
// Date selection without time
|
|
85
|
-
<DatePicker
|
|
86
|
-
value={dateString}
|
|
87
|
-
onChange={(date) => setDate(date)}
|
|
88
|
-
/>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### 3. DatePickerField - Form Input Field
|
|
92
|
-
```tsx
|
|
93
|
-
// Input field that opens date picker on click
|
|
94
|
-
<DatePickerField
|
|
95
|
-
value={selectedDate}
|
|
96
|
-
onChange={setSelectedDate}
|
|
97
|
-
error={hasValidationError}
|
|
98
|
-
closeOnSelect={true}
|
|
99
|
-
/>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### 4. DateTimePickerField - Form Input for DateTime
|
|
103
|
-
```tsx
|
|
104
|
-
// Input field for date and time selection
|
|
105
|
-
<DateTimePickerField
|
|
106
|
-
value={selectedDateTime}
|
|
107
|
-
onChange={setSelectedDateTime}
|
|
108
|
-
zIndex={2000}
|
|
109
|
-
/>
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Advanced Examples
|
|
113
|
-
|
|
114
|
-
```tsx
|
|
115
|
-
// Form integration with validation
|
|
116
|
-
function DateForm() {
|
|
117
|
-
const [startDate, setStartDate] = useState('');
|
|
118
|
-
const [endDate, setEndDate] = useState('');
|
|
119
|
-
const [errors, setErrors] = useState({});
|
|
120
|
-
|
|
121
|
-
const validateDates = () => {
|
|
122
|
-
const newErrors = {};
|
|
123
|
-
if (!startDate) newErrors.startDate = true;
|
|
124
|
-
if (!endDate) newErrors.endDate = true;
|
|
125
|
-
if (startDate && endDate && new Date(startDate) > new Date(endDate)) {
|
|
126
|
-
newErrors.dateRange = true;
|
|
127
|
-
}
|
|
128
|
-
setErrors(newErrors);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<form>
|
|
133
|
-
<div>
|
|
134
|
-
<label>Start Date:</label>
|
|
135
|
-
<DatePickerField
|
|
136
|
-
value={startDate}
|
|
137
|
-
onChange={setStartDate}
|
|
138
|
-
error={errors.startDate}
|
|
139
|
-
closeOnSelect={true}
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<div>
|
|
144
|
-
<label>End Date:</label>
|
|
145
|
-
<DatePickerField
|
|
146
|
-
value={endDate}
|
|
147
|
-
onChange={setEndDate}
|
|
148
|
-
error={errors.endDate || errors.dateRange}
|
|
149
|
-
closeOnSelect={true}
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<Button onClick={validateDates}>Validate</Button>
|
|
154
|
-
</form>
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Event scheduling with precise time
|
|
159
|
-
function EventScheduler() {
|
|
160
|
-
const [eventDateTime, setEventDateTime] = useState('');
|
|
161
|
-
|
|
162
|
-
return (
|
|
163
|
-
<div>
|
|
164
|
-
<h3>Schedule Event</h3>
|
|
165
|
-
<DateTimePicker
|
|
166
|
-
value={eventDateTime}
|
|
167
|
-
onChange={(dateTime) => {
|
|
168
|
-
setEventDateTime(dateTime);
|
|
169
|
-
console.log('Event scheduled for:', new Date(dateTime));
|
|
170
|
-
}}
|
|
171
|
-
/>
|
|
172
|
-
</div>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Date range selector
|
|
177
|
-
function DateRangePicker() {
|
|
178
|
-
const [startDate, setStartDate] = useState('');
|
|
179
|
-
const [endDate, setEndDate] = useState('');
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
|
|
183
|
-
<DatePickerField
|
|
184
|
-
value={startDate}
|
|
185
|
-
onChange={setStartDate}
|
|
186
|
-
closeOnSelect={true}
|
|
187
|
-
/>
|
|
188
|
-
<span>to</span>
|
|
189
|
-
<DatePickerField
|
|
190
|
-
value={endDate}
|
|
191
|
-
onChange={setEndDate}
|
|
192
|
-
closeOnSelect={true}
|
|
193
|
-
/>
|
|
194
|
-
</div>
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// With custom positioning
|
|
199
|
-
<DatePickerField
|
|
200
|
-
value={date}
|
|
201
|
-
onChange={setDate}
|
|
202
|
-
allowedPlacements={['top-start', 'top-end']}
|
|
203
|
-
zIndex={9999}
|
|
204
|
-
/>
|
|
205
|
-
|
|
206
|
-
// DateTime with specific format handling
|
|
207
|
-
function AppointmentBooking() {
|
|
208
|
-
const [appointmentTime, setAppointmentTime] = useState('');
|
|
209
|
-
|
|
210
|
-
const handleTimeChange = (utcString: string) => {
|
|
211
|
-
// Convert UTC to local time for display
|
|
212
|
-
const localDate = new Date(utcString);
|
|
213
|
-
setAppointmentTime(utcString);
|
|
214
|
-
|
|
215
|
-
// You can format for display
|
|
216
|
-
const displayTime = localDate.toLocaleString();
|
|
217
|
-
console.log('Appointment set for:', displayTime);
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<DateTimePicker
|
|
222
|
-
value={appointmentTime}
|
|
223
|
-
onChange={handleTimeChange}
|
|
224
|
-
/>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## Props Reference
|
|
230
|
-
|
|
231
|
-
### DateTimePicker
|
|
232
|
-
| Prop | Type | Default | Description |
|
|
233
|
-
|------|------|---------|-------------|
|
|
234
|
-
| value | string | required | Date/time value in UTC string format |
|
|
235
|
-
| onChange | (day: string) => void | required | Callback when date/time changes |
|
|
236
|
-
| userInputDay | string | undefined | Specific day input for user interaction |
|
|
237
|
-
|
|
238
|
-
### DatePickerField
|
|
239
|
-
| Prop | Type | Default | Description |
|
|
240
|
-
|------|------|---------|-------------|
|
|
241
|
-
| value | string | required | Selected date string |
|
|
242
|
-
| onChange | (day: string) => void | required | Date selection callback |
|
|
243
|
-
| error | boolean | false | Whether field shows error state |
|
|
244
|
-
| closeOnSelect | boolean | false | Whether picker closes after selection |
|
|
245
|
-
| allowedPlacements | Placement[] | bottom/top positions | Floating UI placement options |
|
|
246
|
-
| zIndex | number | 1000 | Z-index for picker overlay |
|
|
247
|
-
|
|
248
|
-
## Date Format Handling
|
|
249
|
-
|
|
250
|
-
The components work with UTC strings and provide utilities for formatting:
|
|
251
|
-
|
|
252
|
-
```tsx
|
|
253
|
-
// Working with different date formats
|
|
254
|
-
function DateUtils() {
|
|
255
|
-
const [date, setDate] = useState('');
|
|
256
|
-
|
|
257
|
-
const handleDateChange = (utcString: string) => {
|
|
258
|
-
setDate(utcString);
|
|
259
|
-
|
|
260
|
-
// Convert to different formats as needed
|
|
261
|
-
const dateObj = new Date(utcString);
|
|
262
|
-
const localString = dateObj.toLocaleString();
|
|
263
|
-
const isoString = dateObj.toISOString();
|
|
264
|
-
const timestamp = dateObj.getTime();
|
|
265
|
-
|
|
266
|
-
console.log({
|
|
267
|
-
utc: utcString,
|
|
268
|
-
local: localString,
|
|
269
|
-
iso: isoString,
|
|
270
|
-
timestamp
|
|
271
|
-
});
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
return (
|
|
275
|
-
<DateTimePicker
|
|
276
|
-
value={date}
|
|
277
|
-
onChange={handleDateChange}
|
|
278
|
-
/>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
## AI Agent Guidelines
|
|
284
|
-
|
|
285
|
-
### ✅ Recommended Patterns
|
|
286
|
-
- Use `DatePickerField` for form inputs that need date selection
|
|
287
|
-
- Use `DateTimePicker` when precise time is needed
|
|
288
|
-
- Handle UTC strings properly - convert to local time for display
|
|
289
|
-
- Set `closeOnSelect={true}` for better UX in forms
|
|
290
|
-
- Use error states for validation feedback
|
|
291
|
-
- Consider `zIndex` when used in modals or overlays
|
|
292
|
-
|
|
293
|
-
### ❌ Common Mistakes to Avoid
|
|
294
|
-
- Don't forget to handle UTC vs local time conversion
|
|
295
|
-
- Don't use DateTimePicker when only date is needed (use DatePicker)
|
|
296
|
-
- Avoid missing onChange handlers - components won't work without them
|
|
297
|
-
- Don't ignore error states in forms
|
|
298
|
-
- Avoid hardcoded zIndex values in complex layouts
|
|
299
|
-
|
|
300
|
-
### Integration Tips
|
|
301
|
-
- Works well with form libraries like react-hook-form
|
|
302
|
-
- Can be combined with validation libraries
|
|
303
|
-
- Good for booking systems, scheduling interfaces
|
|
304
|
-
- Use consistent date formatting across your app
|
|
305
|
-
- Consider timezone handling for global applications
|
|
306
|
-
|
|
307
|
-
## Common Use Cases
|
|
308
|
-
|
|
309
|
-
### 1. Event Booking System
|
|
310
|
-
```tsx
|
|
311
|
-
function EventBooking() {
|
|
312
|
-
const [eventDate, setEventDate] = useState('');
|
|
313
|
-
const [bookingData, setBookingData] = useState({});
|
|
314
|
-
|
|
315
|
-
return (
|
|
316
|
-
<form>
|
|
317
|
-
<h3>Book Event</h3>
|
|
318
|
-
<DateTimePickerField
|
|
319
|
-
value={eventDate}
|
|
320
|
-
onChange={(date) => {
|
|
321
|
-
setEventDate(date);
|
|
322
|
-
setBookingData(prev => ({ ...prev, eventDate: date }));
|
|
323
|
-
}}
|
|
324
|
-
/>
|
|
325
|
-
{/* Other booking fields */}
|
|
326
|
-
</form>
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### 2. Date Range Filtering
|
|
332
|
-
```tsx
|
|
333
|
-
function DataFilter() {
|
|
334
|
-
const [startDate, setStartDate] = useState('');
|
|
335
|
-
const [endDate, setEndDate] = useState('');
|
|
336
|
-
|
|
337
|
-
const applyFilter = () => {
|
|
338
|
-
// Filter data between dates
|
|
339
|
-
const filtered = data.filter(item => {
|
|
340
|
-
const itemDate = new Date(item.date);
|
|
341
|
-
return itemDate >= new Date(startDate) && itemDate <= new Date(endDate);
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
return (
|
|
346
|
-
<div>
|
|
347
|
-
<DatePickerField value={startDate} onChange={setStartDate} />
|
|
348
|
-
<DatePickerField value={endDate} onChange={setEndDate} />
|
|
349
|
-
<Button onClick={applyFilter}>Apply Filter</Button>
|
|
350
|
-
</div>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### 3. Scheduling Interface
|
|
356
|
-
```tsx
|
|
357
|
-
function ScheduleManager() {
|
|
358
|
-
const [schedules, setSchedules] = useState([]);
|
|
359
|
-
|
|
360
|
-
const addSchedule = () => {
|
|
361
|
-
setSchedules(prev => [...prev, {
|
|
362
|
-
id: Date.now(),
|
|
363
|
-
dateTime: '',
|
|
364
|
-
title: ''
|
|
365
|
-
}]);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
return (
|
|
369
|
-
<div>
|
|
370
|
-
{schedules.map(schedule => (
|
|
371
|
-
<div key={schedule.id}>
|
|
372
|
-
<input
|
|
373
|
-
placeholder="Event title"
|
|
374
|
-
onChange={(e) => updateSchedule(schedule.id, 'title', e.target.value)}
|
|
375
|
-
/>
|
|
376
|
-
<DateTimePicker
|
|
377
|
-
value={schedule.dateTime}
|
|
378
|
-
onChange={(date) => updateSchedule(schedule.id, 'dateTime', date)}
|
|
379
|
-
/>
|
|
380
|
-
</div>
|
|
381
|
-
))}
|
|
382
|
-
<Button onClick={addSchedule}>Add Schedule</Button>
|
|
383
|
-
</div>
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
## Accessibility Features
|
|
389
|
-
- **Keyboard Navigation**: Full keyboard support for date selection
|
|
390
|
-
- **Screen Reader Support**: Proper ARIA labels and announcements
|
|
391
|
-
- **Focus Management**: Logical tab order and focus handling
|
|
392
|
-
- **High Contrast**: Works with high contrast themes
|
|
393
|
-
|
|
394
|
-
## Related Components
|
|
395
|
-
- Input - for simple date text input
|
|
396
|
-
- Button - for picker actions
|
|
397
|
-
- Modal - often contains date pickers
|
|
398
|
-
- Popover - similar floating behavior
|
|
399
|
-
|
|
400
|
-
---
|