@urbint/cl 1.0.1
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/.cursor/rules +313 -0
- package/.rnstorybook/index.ts +11 -0
- package/.rnstorybook/main.ts +8 -0
- package/.rnstorybook/preview.tsx +14 -0
- package/.rnstorybook/storybook.requires.ts +49 -0
- package/.storybook/main.ts +16 -0
- package/.storybook/preview.ts +32 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/App.tsx +422 -0
- package/README.md +229 -0
- package/app.json +33 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash-icon.png +0 -0
- package/babel.config.js +16 -0
- package/docs/components/CodeBlock.tsx +80 -0
- package/docs/components/PropTable.tsx +93 -0
- package/docs/components/Sidebar.tsx +199 -0
- package/docs/components/index.ts +8 -0
- package/docs/data/colorTokens.ts +70 -0
- package/docs/data/componentData.tsx +1685 -0
- package/docs/data/index.ts +7 -0
- package/docs/index.ts +19 -0
- package/docs/navigation.ts +94 -0
- package/docs/pages/ColorsPage.tsx +226 -0
- package/docs/pages/ComponentPage.tsx +235 -0
- package/docs/pages/InstallationPage.tsx +232 -0
- package/docs/pages/IntroductionPage.tsx +163 -0
- package/docs/pages/ThemingPage.tsx +251 -0
- package/docs/pages/index.ts +10 -0
- package/docs/theme.ts +64 -0
- package/docs/types.ts +54 -0
- package/index.ts +8 -0
- package/llms.txt +1893 -0
- package/mcp-config.example.json +10 -0
- package/mcp-server/README.md +192 -0
- package/mcp-server/package-lock.json +1707 -0
- package/mcp-server/package.json +38 -0
- package/mcp-server/src/index.ts +1136 -0
- package/mcp-server/src/registry/components.ts +1446 -0
- package/mcp-server/src/registry/index.ts +3 -0
- package/mcp-server/src/registry/tokens.ts +256 -0
- package/mcp-server/tsconfig.json +19 -0
- package/package.json +92 -0
- package/src/components/Accordion/Accordion.stories.tsx +226 -0
- package/src/components/Accordion/Accordion.tsx +255 -0
- package/src/components/Accordion/index.ts +12 -0
- package/src/components/ActionSheet/ActionSheet.stories.tsx +393 -0
- package/src/components/ActionSheet/ActionSheet.tsx +258 -0
- package/src/components/ActionSheet/index.ts +2 -0
- package/src/components/Alert/Alert.stories.tsx +165 -0
- package/src/components/Alert/Alert.tsx +164 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/AlertDialog/AlertDialog.stories.tsx +330 -0
- package/src/components/AlertDialog/AlertDialog.tsx +234 -0
- package/src/components/AlertDialog/index.ts +2 -0
- package/src/components/Avatar/Avatar.stories.tsx +154 -0
- package/src/components/Avatar/Avatar.tsx +219 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Badge/Badge.stories.tsx +146 -0
- package/src/components/Badge/Badge.tsx +125 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Box/Box.stories.tsx +192 -0
- package/src/components/Box/Box.tsx +184 -0
- package/src/components/Box/index.ts +2 -0
- package/src/components/Button/Button.stories.tsx +157 -0
- package/src/components/Button/Button.tsx +180 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +145 -0
- package/src/components/Card/Card.tsx +169 -0
- package/src/components/Card/index.ts +11 -0
- package/src/components/Center/Center.stories.tsx +215 -0
- package/src/components/Center/Center.tsx +29 -0
- package/src/components/Center/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +94 -0
- package/src/components/Checkbox/Checkbox.tsx +242 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +623 -0
- package/src/components/DatePicker/DatePicker.tsx +1228 -0
- package/src/components/DatePicker/index.ts +8 -0
- package/src/components/Divider/Divider.stories.tsx +224 -0
- package/src/components/Divider/Divider.tsx +73 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Drawer/Drawer.stories.tsx +414 -0
- package/src/components/Drawer/Drawer.tsx +342 -0
- package/src/components/Drawer/index.ts +11 -0
- package/src/components/Fab/Fab.stories.tsx +360 -0
- package/src/components/Fab/Fab.tsx +185 -0
- package/src/components/Fab/index.ts +2 -0
- package/src/components/FormControl/FormControl.stories.tsx +276 -0
- package/src/components/FormControl/FormControl.tsx +185 -0
- package/src/components/FormControl/index.ts +12 -0
- package/src/components/Grid/Grid.stories.tsx +244 -0
- package/src/components/Grid/Grid.tsx +93 -0
- package/src/components/Grid/index.ts +2 -0
- package/src/components/HStack/HStack.stories.tsx +230 -0
- package/src/components/HStack/HStack.tsx +80 -0
- package/src/components/HStack/index.ts +2 -0
- package/src/components/Heading/Heading.stories.tsx +111 -0
- package/src/components/Heading/Heading.tsx +85 -0
- package/src/components/Heading/index.ts +2 -0
- package/src/components/Icon/Icon.stories.tsx +320 -0
- package/src/components/Icon/Icon.tsx +117 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Image/Image.stories.tsx +357 -0
- package/src/components/Image/Image.tsx +168 -0
- package/src/components/Image/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +164 -0
- package/src/components/Input/Input.tsx +274 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Link/Link.stories.tsx +187 -0
- package/src/components/Link/Link.tsx +104 -0
- package/src/components/Link/index.ts +2 -0
- package/src/components/Menu/Menu.stories.tsx +363 -0
- package/src/components/Menu/Menu.tsx +238 -0
- package/src/components/Menu/index.ts +2 -0
- package/src/components/Modal/Modal.stories.tsx +156 -0
- package/src/components/Modal/Modal.tsx +280 -0
- package/src/components/Modal/index.ts +11 -0
- package/src/components/Popover/Popover.stories.tsx +330 -0
- package/src/components/Popover/Popover.tsx +315 -0
- package/src/components/Popover/index.ts +11 -0
- package/src/components/Portal/Portal.stories.tsx +376 -0
- package/src/components/Portal/Portal.tsx +100 -0
- package/src/components/Portal/index.ts +2 -0
- package/src/components/Pressable/Pressable.stories.tsx +338 -0
- package/src/components/Pressable/Pressable.tsx +71 -0
- package/src/components/Pressable/index.ts +2 -0
- package/src/components/Progress/Progress.stories.tsx +131 -0
- package/src/components/Progress/Progress.tsx +219 -0
- package/src/components/Progress/index.ts +2 -0
- package/src/components/Radio/Radio.stories.tsx +101 -0
- package/src/components/Radio/Radio.tsx +234 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/Select/Select.stories.tsx +908 -0
- package/src/components/Select/Select.tsx +659 -0
- package/src/components/Select/index.ts +8 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +154 -0
- package/src/components/Skeleton/Skeleton.tsx +192 -0
- package/src/components/Skeleton/index.ts +8 -0
- package/src/components/Slider/Slider.stories.tsx +363 -0
- package/src/components/Slider/Slider.tsx +209 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/Spinner/Spinner.stories.tsx +108 -0
- package/src/components/Spinner/Spinner.tsx +121 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Switch/Switch.stories.tsx +116 -0
- package/src/components/Switch/Switch.tsx +172 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Table/Table.stories.tsx +417 -0
- package/src/components/Table/Table.tsx +233 -0
- package/src/components/Table/index.ts +2 -0
- package/src/components/Text/Text.stories.tsx +93 -0
- package/src/components/Text/Text.tsx +119 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Textarea/Textarea.stories.tsx +280 -0
- package/src/components/Textarea/Textarea.tsx +212 -0
- package/src/components/Textarea/index.ts +2 -0
- package/src/components/Toast/Toast.stories.tsx +446 -0
- package/src/components/Toast/Toast.tsx +221 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +354 -0
- package/src/components/Tooltip/Tooltip.tsx +261 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/VStack/VStack.stories.tsx +183 -0
- package/src/components/VStack/VStack.tsx +76 -0
- package/src/components/VStack/index.ts +2 -0
- package/src/components/index.ts +62 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useControllableState.ts +41 -0
- package/src/hooks/useDisclosure.ts +51 -0
- package/src/index.ts +22 -0
- package/src/stories/Button.stories.tsx +53 -0
- package/src/stories/Button.tsx +101 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.tsx +33 -0
- package/src/stories/Header.tsx +75 -0
- package/src/stories/Page.stories.tsx +25 -0
- package/src/stories/Page.tsx +154 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/styles/index.ts +7 -0
- package/src/styles/tokens.ts +318 -0
- package/src/styles/unistyles.ts +254 -0
- package/src/utils/createContext.tsx +25 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/mergeRefs.ts +21 -0
- package/tsconfig.json +26 -0
- package/urbint-cl-1.0.0.tgz +0 -0
- package/vitest.config.ts +37 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,1228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DatePicker Component
|
|
3
|
+
* A comprehensive date and time picker with multiple modes
|
|
4
|
+
* Supports: date only, time only, date and time selection (side by side)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { forwardRef, useState, useRef, useCallback, useMemo } from 'react';
|
|
8
|
+
import {
|
|
9
|
+
View,
|
|
10
|
+
ViewProps,
|
|
11
|
+
Pressable,
|
|
12
|
+
Text,
|
|
13
|
+
Modal,
|
|
14
|
+
ScrollView,
|
|
15
|
+
StyleSheet,
|
|
16
|
+
Platform,
|
|
17
|
+
LayoutRectangle,
|
|
18
|
+
} from 'react-native';
|
|
19
|
+
import Svg, { Path } from 'react-native-svg';
|
|
20
|
+
import { colors, spacing, borderRadius, typography } from '../../styles/tokens';
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Types
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
26
|
+
export type DatePickerMode = 'date' | 'time' | 'datetime';
|
|
27
|
+
export type DatePickerSize = 'sm' | 'md' | 'lg';
|
|
28
|
+
export type DatePickerVariant = 'outline' | 'filled';
|
|
29
|
+
|
|
30
|
+
export interface DatePickerProps extends Omit<ViewProps, 'children'> {
|
|
31
|
+
/** Picker mode */
|
|
32
|
+
mode?: DatePickerMode;
|
|
33
|
+
/** Selected date/time value */
|
|
34
|
+
value?: Date;
|
|
35
|
+
/** Default date/time value */
|
|
36
|
+
defaultValue?: Date;
|
|
37
|
+
/** On change handler */
|
|
38
|
+
onChange?: (date: Date) => void;
|
|
39
|
+
/** Placeholder text */
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/** Label text */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Helper text */
|
|
44
|
+
helperText?: string;
|
|
45
|
+
/** Error message */
|
|
46
|
+
errorMessage?: string;
|
|
47
|
+
/** Is invalid */
|
|
48
|
+
isInvalid?: boolean;
|
|
49
|
+
/** Is disabled */
|
|
50
|
+
isDisabled?: boolean;
|
|
51
|
+
/** Is required */
|
|
52
|
+
isRequired?: boolean;
|
|
53
|
+
/** Minimum selectable date */
|
|
54
|
+
minDate?: Date;
|
|
55
|
+
/** Maximum selectable date */
|
|
56
|
+
maxDate?: Date;
|
|
57
|
+
/** Picker size */
|
|
58
|
+
size?: DatePickerSize;
|
|
59
|
+
/** Picker variant */
|
|
60
|
+
variant?: DatePickerVariant;
|
|
61
|
+
/** Date format display function */
|
|
62
|
+
formatDate?: (date: Date, mode: DatePickerMode) => string;
|
|
63
|
+
/** Use 24-hour format for time */
|
|
64
|
+
use24HourFormat?: boolean;
|
|
65
|
+
/** First day of week (0 = Sunday, 1 = Monday) */
|
|
66
|
+
firstDayOfWeek?: 0 | 1;
|
|
67
|
+
/** Show "Now" button to select current date/time */
|
|
68
|
+
showNowButton?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Helper Functions
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
const MONTHS = [
|
|
76
|
+
'January', 'February', 'March', 'April', 'May', 'June',
|
|
77
|
+
'July', 'August', 'September', 'October', 'November', 'December',
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
const MONTHS_SHORT = [
|
|
81
|
+
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
|
82
|
+
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
const WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
86
|
+
const WEEKDAYS_MONDAY_FIRST = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];
|
|
87
|
+
|
|
88
|
+
const getDaysInMonth = (year: number, month: number): number => {
|
|
89
|
+
return new Date(year, month + 1, 0).getDate();
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const getFirstDayOfMonth = (year: number, month: number): number => {
|
|
93
|
+
return new Date(year, month, 1).getDay();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const isSameDay = (date1: Date, date2: Date): boolean => {
|
|
97
|
+
return (
|
|
98
|
+
date1.getFullYear() === date2.getFullYear() &&
|
|
99
|
+
date1.getMonth() === date2.getMonth() &&
|
|
100
|
+
date1.getDate() === date2.getDate()
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const isDateDisabled = (date: Date, minDate?: Date, maxDate?: Date): boolean => {
|
|
105
|
+
if (minDate) {
|
|
106
|
+
const min = new Date(minDate);
|
|
107
|
+
min.setHours(0, 0, 0, 0);
|
|
108
|
+
if (date < min) return true;
|
|
109
|
+
}
|
|
110
|
+
if (maxDate) {
|
|
111
|
+
const max = new Date(maxDate);
|
|
112
|
+
max.setHours(23, 59, 59, 999);
|
|
113
|
+
if (date > max) return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const defaultFormatDate = (date: Date, mode: DatePickerMode): string => {
|
|
119
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
120
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
121
|
+
const year = date.getFullYear();
|
|
122
|
+
const hours = date.getHours();
|
|
123
|
+
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
124
|
+
const ampm = hours >= 12 ? 'PM' : 'AM';
|
|
125
|
+
const hour12 = hours % 12 || 12;
|
|
126
|
+
|
|
127
|
+
switch (mode) {
|
|
128
|
+
case 'date':
|
|
129
|
+
return `${month}/${day}/${year}`;
|
|
130
|
+
case 'time':
|
|
131
|
+
return `${hour12}:${minutes} ${ampm}`;
|
|
132
|
+
case 'datetime':
|
|
133
|
+
return `${month}/${day}/${year} ${hour12}:${minutes} ${ampm}`;
|
|
134
|
+
default:
|
|
135
|
+
return `${month}/${day}/${year}`;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// ============================================================================
|
|
140
|
+
// Icons
|
|
141
|
+
// ============================================================================
|
|
142
|
+
|
|
143
|
+
const CalendarIcon = ({ color, size = 20 }: { color: string; size?: number }) => (
|
|
144
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
145
|
+
<Path
|
|
146
|
+
d="M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
147
|
+
stroke={color}
|
|
148
|
+
strokeWidth={2}
|
|
149
|
+
strokeLinecap="round"
|
|
150
|
+
strokeLinejoin="round"
|
|
151
|
+
/>
|
|
152
|
+
</Svg>
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const ClockIcon = ({ color, size = 20 }: { color: string; size?: number }) => (
|
|
156
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
157
|
+
<Path
|
|
158
|
+
d="M12 6v6l4 2M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"
|
|
159
|
+
stroke={color}
|
|
160
|
+
strokeWidth={2}
|
|
161
|
+
strokeLinecap="round"
|
|
162
|
+
strokeLinejoin="round"
|
|
163
|
+
/>
|
|
164
|
+
</Svg>
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const ChevronLeftIcon = ({ color, size = 16 }: { color: string; size?: number }) => (
|
|
168
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
169
|
+
<Path
|
|
170
|
+
d="M15 18l-6-6 6-6"
|
|
171
|
+
stroke={color}
|
|
172
|
+
strokeWidth={2}
|
|
173
|
+
strokeLinecap="round"
|
|
174
|
+
strokeLinejoin="round"
|
|
175
|
+
/>
|
|
176
|
+
</Svg>
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const ChevronRightIcon = ({ color, size = 16 }: { color: string; size?: number }) => (
|
|
180
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
181
|
+
<Path
|
|
182
|
+
d="M9 18l6-6-6-6"
|
|
183
|
+
stroke={color}
|
|
184
|
+
strokeWidth={2}
|
|
185
|
+
strokeLinecap="round"
|
|
186
|
+
strokeLinejoin="round"
|
|
187
|
+
/>
|
|
188
|
+
</Svg>
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
// ============================================================================
|
|
192
|
+
// Component
|
|
193
|
+
// ============================================================================
|
|
194
|
+
|
|
195
|
+
export const DatePicker = forwardRef<View, DatePickerProps>(
|
|
196
|
+
(
|
|
197
|
+
{
|
|
198
|
+
style,
|
|
199
|
+
mode = 'date',
|
|
200
|
+
value: controlledValue,
|
|
201
|
+
defaultValue,
|
|
202
|
+
onChange,
|
|
203
|
+
placeholder,
|
|
204
|
+
label,
|
|
205
|
+
helperText,
|
|
206
|
+
errorMessage,
|
|
207
|
+
isInvalid = false,
|
|
208
|
+
isDisabled = false,
|
|
209
|
+
isRequired = false,
|
|
210
|
+
minDate,
|
|
211
|
+
maxDate,
|
|
212
|
+
size = 'md',
|
|
213
|
+
variant = 'outline',
|
|
214
|
+
formatDate = defaultFormatDate,
|
|
215
|
+
use24HourFormat = false,
|
|
216
|
+
firstDayOfWeek = 0,
|
|
217
|
+
showNowButton = true,
|
|
218
|
+
...props
|
|
219
|
+
},
|
|
220
|
+
ref
|
|
221
|
+
) => {
|
|
222
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
223
|
+
const [internalValue, setInternalValue] = useState<Date | undefined>(defaultValue);
|
|
224
|
+
const [dropdownPosition, setDropdownPosition] = useState<LayoutRectangle | null>(null);
|
|
225
|
+
const [viewDate, setViewDate] = useState(controlledValue || defaultValue || new Date());
|
|
226
|
+
const pickerRef = useRef<View>(null);
|
|
227
|
+
|
|
228
|
+
const isControlled = controlledValue !== undefined;
|
|
229
|
+
const selectedDate = isControlled ? controlledValue : internalValue;
|
|
230
|
+
const hasError = isInvalid || !!errorMessage;
|
|
231
|
+
|
|
232
|
+
const defaultPlaceholder = useMemo(() => {
|
|
233
|
+
switch (mode) {
|
|
234
|
+
case 'date':
|
|
235
|
+
return 'Select date';
|
|
236
|
+
case 'time':
|
|
237
|
+
return 'Select time';
|
|
238
|
+
case 'datetime':
|
|
239
|
+
return 'Select date & time';
|
|
240
|
+
default:
|
|
241
|
+
return 'Select';
|
|
242
|
+
}
|
|
243
|
+
}, [mode]);
|
|
244
|
+
|
|
245
|
+
const weekdays = firstDayOfWeek === 1 ? WEEKDAYS_MONDAY_FIRST : WEEKDAYS;
|
|
246
|
+
|
|
247
|
+
// Generate calendar days including previous/next month days
|
|
248
|
+
const calendarDays = useMemo(() => {
|
|
249
|
+
const year = viewDate.getFullYear();
|
|
250
|
+
const month = viewDate.getMonth();
|
|
251
|
+
const daysInMonth = getDaysInMonth(year, month);
|
|
252
|
+
const daysInPrevMonth = getDaysInMonth(year, month - 1);
|
|
253
|
+
const firstDay = getFirstDayOfMonth(year, month);
|
|
254
|
+
const adjustedFirstDay = firstDayOfWeek === 1 ? (firstDay === 0 ? 6 : firstDay - 1) : firstDay;
|
|
255
|
+
|
|
256
|
+
const days: { day: number; isCurrentMonth: boolean; isPrevMonth: boolean; isNextMonth: boolean }[] = [];
|
|
257
|
+
|
|
258
|
+
// Add days from previous month
|
|
259
|
+
for (let i = adjustedFirstDay - 1; i >= 0; i--) {
|
|
260
|
+
days.push({
|
|
261
|
+
day: daysInPrevMonth - i,
|
|
262
|
+
isCurrentMonth: false,
|
|
263
|
+
isPrevMonth: true,
|
|
264
|
+
isNextMonth: false,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Add days of the current month
|
|
269
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
270
|
+
days.push({
|
|
271
|
+
day: i,
|
|
272
|
+
isCurrentMonth: true,
|
|
273
|
+
isPrevMonth: false,
|
|
274
|
+
isNextMonth: false,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Add days from next month to fill the grid (6 rows)
|
|
279
|
+
const remainingDays = 42 - days.length;
|
|
280
|
+
for (let i = 1; i <= remainingDays; i++) {
|
|
281
|
+
days.push({
|
|
282
|
+
day: i,
|
|
283
|
+
isCurrentMonth: false,
|
|
284
|
+
isPrevMonth: false,
|
|
285
|
+
isNextMonth: true,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return days;
|
|
290
|
+
}, [viewDate, firstDayOfWeek]);
|
|
291
|
+
|
|
292
|
+
// Generate hours
|
|
293
|
+
const hours = useMemo(() => {
|
|
294
|
+
if (use24HourFormat) {
|
|
295
|
+
return Array.from({ length: 24 }, (_, i) => i);
|
|
296
|
+
}
|
|
297
|
+
return Array.from({ length: 12 }, (_, i) => i === 0 ? 12 : i);
|
|
298
|
+
}, [use24HourFormat]);
|
|
299
|
+
|
|
300
|
+
// Generate minutes
|
|
301
|
+
const minutes = useMemo(() => {
|
|
302
|
+
return Array.from({ length: 60 }, (_, i) => i);
|
|
303
|
+
}, []);
|
|
304
|
+
|
|
305
|
+
const handleOpen = useCallback(() => {
|
|
306
|
+
if (isDisabled) return;
|
|
307
|
+
|
|
308
|
+
pickerRef.current?.measureInWindow((x, y, width, height) => {
|
|
309
|
+
setDropdownPosition({ x, y, width, height });
|
|
310
|
+
setIsOpen(true);
|
|
311
|
+
if (selectedDate) {
|
|
312
|
+
setViewDate(selectedDate);
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}, [isDisabled, selectedDate]);
|
|
316
|
+
|
|
317
|
+
const handleClose = () => {
|
|
318
|
+
setIsOpen(false);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const updateValue = (newDate: Date) => {
|
|
322
|
+
if (!isControlled) {
|
|
323
|
+
setInternalValue(newDate);
|
|
324
|
+
}
|
|
325
|
+
onChange?.(newDate);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
const handleDateSelect = (day: number, isPrevMonth: boolean, isNextMonth: boolean) => {
|
|
329
|
+
let newDate = new Date(viewDate);
|
|
330
|
+
|
|
331
|
+
if (isPrevMonth) {
|
|
332
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
333
|
+
} else if (isNextMonth) {
|
|
334
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
newDate.setDate(day);
|
|
338
|
+
|
|
339
|
+
if (selectedDate) {
|
|
340
|
+
newDate.setHours(selectedDate.getHours());
|
|
341
|
+
newDate.setMinutes(selectedDate.getMinutes());
|
|
342
|
+
} else {
|
|
343
|
+
const now = new Date();
|
|
344
|
+
newDate.setHours(now.getHours());
|
|
345
|
+
newDate.setMinutes(now.getMinutes());
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (isDateDisabled(newDate, minDate, maxDate)) return;
|
|
349
|
+
|
|
350
|
+
updateValue(newDate);
|
|
351
|
+
|
|
352
|
+
// Update view if clicked on prev/next month
|
|
353
|
+
if (isPrevMonth || isNextMonth) {
|
|
354
|
+
setViewDate(newDate);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (mode === 'date') {
|
|
358
|
+
setIsOpen(false);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
const handleTimeSelect = (hour: number, minute: number, isPM?: boolean) => {
|
|
363
|
+
const newDate = selectedDate ? new Date(selectedDate) : new Date();
|
|
364
|
+
|
|
365
|
+
let adjustedHour = hour;
|
|
366
|
+
if (!use24HourFormat) {
|
|
367
|
+
if (isPM && hour !== 12) {
|
|
368
|
+
adjustedHour = hour + 12;
|
|
369
|
+
} else if (!isPM && hour === 12) {
|
|
370
|
+
adjustedHour = 0;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
newDate.setHours(adjustedHour);
|
|
375
|
+
newDate.setMinutes(minute);
|
|
376
|
+
|
|
377
|
+
updateValue(newDate);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const handleMonthChange = (direction: -1 | 1) => {
|
|
381
|
+
const newDate = new Date(viewDate);
|
|
382
|
+
newDate.setMonth(newDate.getMonth() + direction);
|
|
383
|
+
setViewDate(newDate);
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const handleYearChange = (direction: -1 | 1) => {
|
|
387
|
+
const newDate = new Date(viewDate);
|
|
388
|
+
newDate.setFullYear(newDate.getFullYear() + direction);
|
|
389
|
+
setViewDate(newDate);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const handleNowPress = () => {
|
|
393
|
+
const now = new Date();
|
|
394
|
+
updateValue(now);
|
|
395
|
+
setViewDate(now);
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const handleOkPress = () => {
|
|
399
|
+
setIsOpen(false);
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const getIcon = () => {
|
|
403
|
+
const iconColor = isDisabled ? colors.text.disabled : colors.text.secondary;
|
|
404
|
+
if (mode === 'time') {
|
|
405
|
+
return <ClockIcon color={iconColor} />;
|
|
406
|
+
}
|
|
407
|
+
return <CalendarIcon color={iconColor} />;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
const currentHour = selectedDate?.getHours() ?? new Date().getHours();
|
|
411
|
+
const currentMinute = selectedDate?.getMinutes() ?? 0;
|
|
412
|
+
const currentIsPM = currentHour >= 12;
|
|
413
|
+
const displayHour = use24HourFormat ? currentHour : (currentHour % 12 || 12);
|
|
414
|
+
|
|
415
|
+
// Calculate dropdown width based on mode
|
|
416
|
+
const getDropdownMinWidth = () => {
|
|
417
|
+
if (mode === 'datetime') return 420;
|
|
418
|
+
if (mode === 'time') return 200;
|
|
419
|
+
return 260;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
return (
|
|
423
|
+
<View ref={ref} style={[styles.container, style]} {...props}>
|
|
424
|
+
{label && (
|
|
425
|
+
<Text style={[styles.label, isDisabled && styles.labelDisabled]}>
|
|
426
|
+
{label}
|
|
427
|
+
{isRequired && <Text style={styles.required}> *</Text>}
|
|
428
|
+
</Text>
|
|
429
|
+
)}
|
|
430
|
+
|
|
431
|
+
<Pressable
|
|
432
|
+
ref={pickerRef}
|
|
433
|
+
onPress={handleOpen}
|
|
434
|
+
style={({ hovered }: any) => [
|
|
435
|
+
styles.picker,
|
|
436
|
+
styles[variant],
|
|
437
|
+
styles[size],
|
|
438
|
+
hasError && styles.error,
|
|
439
|
+
isDisabled && styles.disabled,
|
|
440
|
+
isOpen && styles.pickerOpen,
|
|
441
|
+
Platform.OS === 'web' && hovered && !isDisabled && styles.pickerHovered,
|
|
442
|
+
]}
|
|
443
|
+
>
|
|
444
|
+
<Text
|
|
445
|
+
style={[
|
|
446
|
+
styles.pickerText,
|
|
447
|
+
!selectedDate && styles.placeholder,
|
|
448
|
+
isDisabled && styles.disabledText,
|
|
449
|
+
]}
|
|
450
|
+
numberOfLines={1}
|
|
451
|
+
>
|
|
452
|
+
{selectedDate ? formatDate(selectedDate, mode) : (placeholder || defaultPlaceholder)}
|
|
453
|
+
</Text>
|
|
454
|
+
{getIcon()}
|
|
455
|
+
</Pressable>
|
|
456
|
+
|
|
457
|
+
{(helperText || errorMessage) && (
|
|
458
|
+
<Text style={[styles.helperText, hasError && styles.errorText]}>
|
|
459
|
+
{errorMessage || helperText}
|
|
460
|
+
</Text>
|
|
461
|
+
)}
|
|
462
|
+
|
|
463
|
+
<Modal
|
|
464
|
+
visible={isOpen}
|
|
465
|
+
transparent
|
|
466
|
+
animationType="fade"
|
|
467
|
+
onRequestClose={handleClose}
|
|
468
|
+
>
|
|
469
|
+
<Pressable style={styles.modalOverlay} onPress={handleClose}>
|
|
470
|
+
<View
|
|
471
|
+
style={[
|
|
472
|
+
styles.dropdown,
|
|
473
|
+
dropdownPosition && {
|
|
474
|
+
position: 'absolute',
|
|
475
|
+
top: dropdownPosition.y + dropdownPosition.height + 4,
|
|
476
|
+
left: dropdownPosition.x,
|
|
477
|
+
minWidth: getDropdownMinWidth(),
|
|
478
|
+
},
|
|
479
|
+
]}
|
|
480
|
+
onStartShouldSetResponder={() => true}
|
|
481
|
+
>
|
|
482
|
+
{/* DateTime Mode - Side by Side Layout */}
|
|
483
|
+
{mode === 'datetime' && (
|
|
484
|
+
<View style={styles.datetimeContainer}>
|
|
485
|
+
{/* Calendar Section */}
|
|
486
|
+
<View style={styles.calendarSection}>
|
|
487
|
+
{/* Month/Year Header */}
|
|
488
|
+
<View style={styles.calendarHeader}>
|
|
489
|
+
<Pressable
|
|
490
|
+
onPress={() => handleYearChange(-1)}
|
|
491
|
+
style={({ hovered }: any) => [
|
|
492
|
+
styles.navButton,
|
|
493
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
494
|
+
]}
|
|
495
|
+
>
|
|
496
|
+
<Text style={styles.navButtonText}>«</Text>
|
|
497
|
+
</Pressable>
|
|
498
|
+
<Pressable
|
|
499
|
+
onPress={() => handleMonthChange(-1)}
|
|
500
|
+
style={({ hovered }: any) => [
|
|
501
|
+
styles.navButton,
|
|
502
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
503
|
+
]}
|
|
504
|
+
>
|
|
505
|
+
<Text style={styles.navButtonText}>‹</Text>
|
|
506
|
+
</Pressable>
|
|
507
|
+
<Text style={styles.calendarTitle}>
|
|
508
|
+
{MONTHS_SHORT[viewDate.getMonth()]} {viewDate.getFullYear()}
|
|
509
|
+
</Text>
|
|
510
|
+
<Pressable
|
|
511
|
+
onPress={() => handleMonthChange(1)}
|
|
512
|
+
style={({ hovered }: any) => [
|
|
513
|
+
styles.navButton,
|
|
514
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
515
|
+
]}
|
|
516
|
+
>
|
|
517
|
+
<Text style={styles.navButtonText}>›</Text>
|
|
518
|
+
</Pressable>
|
|
519
|
+
<Pressable
|
|
520
|
+
onPress={() => handleYearChange(1)}
|
|
521
|
+
style={({ hovered }: any) => [
|
|
522
|
+
styles.navButton,
|
|
523
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
524
|
+
]}
|
|
525
|
+
>
|
|
526
|
+
<Text style={styles.navButtonText}>»</Text>
|
|
527
|
+
</Pressable>
|
|
528
|
+
</View>
|
|
529
|
+
|
|
530
|
+
{/* Weekday Headers */}
|
|
531
|
+
<View style={styles.weekdaysRow}>
|
|
532
|
+
{weekdays.map((day) => (
|
|
533
|
+
<View key={day} style={styles.weekdayCell}>
|
|
534
|
+
<Text style={styles.weekdayText}>{day}</Text>
|
|
535
|
+
</View>
|
|
536
|
+
))}
|
|
537
|
+
</View>
|
|
538
|
+
|
|
539
|
+
{/* Calendar Grid */}
|
|
540
|
+
<View style={styles.calendarGrid}>
|
|
541
|
+
{calendarDays.map((dayInfo, index) => {
|
|
542
|
+
const { day, isCurrentMonth, isPrevMonth, isNextMonth } = dayInfo;
|
|
543
|
+
|
|
544
|
+
let dateToCheck: Date;
|
|
545
|
+
if (isPrevMonth) {
|
|
546
|
+
dateToCheck = new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, day);
|
|
547
|
+
} else if (isNextMonth) {
|
|
548
|
+
dateToCheck = new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, day);
|
|
549
|
+
} else {
|
|
550
|
+
dateToCheck = new Date(viewDate.getFullYear(), viewDate.getMonth(), day);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
const isSelected = selectedDate && isSameDay(dateToCheck, selectedDate);
|
|
554
|
+
const isToday = isSameDay(dateToCheck, new Date());
|
|
555
|
+
const isDisabledDay = isDateDisabled(dateToCheck, minDate, maxDate);
|
|
556
|
+
|
|
557
|
+
return (
|
|
558
|
+
<Pressable
|
|
559
|
+
key={`${isPrevMonth ? 'prev' : isNextMonth ? 'next' : 'curr'}-${day}-${index}`}
|
|
560
|
+
onPress={() => !isDisabledDay && handleDateSelect(day, isPrevMonth, isNextMonth)}
|
|
561
|
+
style={({ hovered }: any) => [
|
|
562
|
+
styles.dayCell,
|
|
563
|
+
isSelected && styles.dayCellSelected,
|
|
564
|
+
isToday && !isSelected && styles.dayCellToday,
|
|
565
|
+
isDisabledDay && styles.dayCellDisabled,
|
|
566
|
+
Platform.OS === 'web' && hovered && !isDisabledDay && !isSelected && styles.dayCellHovered,
|
|
567
|
+
]}
|
|
568
|
+
>
|
|
569
|
+
<Text
|
|
570
|
+
style={[
|
|
571
|
+
styles.dayText,
|
|
572
|
+
!isCurrentMonth && styles.dayTextOtherMonth,
|
|
573
|
+
isSelected && styles.dayTextSelected,
|
|
574
|
+
isToday && !isSelected && styles.dayTextToday,
|
|
575
|
+
isDisabledDay && styles.dayTextDisabled,
|
|
576
|
+
]}
|
|
577
|
+
>
|
|
578
|
+
{day}
|
|
579
|
+
</Text>
|
|
580
|
+
</Pressable>
|
|
581
|
+
);
|
|
582
|
+
})}
|
|
583
|
+
</View>
|
|
584
|
+
</View>
|
|
585
|
+
|
|
586
|
+
{/* Divider */}
|
|
587
|
+
<View style={styles.verticalDivider} />
|
|
588
|
+
|
|
589
|
+
{/* Time Section */}
|
|
590
|
+
<View style={styles.timeSection}>
|
|
591
|
+
<View style={styles.timeSectionColumns}>
|
|
592
|
+
{/* Hours */}
|
|
593
|
+
<View style={styles.timeColumnCompact}>
|
|
594
|
+
<ScrollView
|
|
595
|
+
style={styles.timeScrollCompact}
|
|
596
|
+
showsVerticalScrollIndicator={false}
|
|
597
|
+
contentContainerStyle={styles.timeScrollContent}
|
|
598
|
+
>
|
|
599
|
+
{hours.map((hour) => {
|
|
600
|
+
const isSelected = hour === displayHour;
|
|
601
|
+
return (
|
|
602
|
+
<Pressable
|
|
603
|
+
key={hour}
|
|
604
|
+
onPress={() => handleTimeSelect(hour, currentMinute, currentIsPM)}
|
|
605
|
+
style={({ hovered }: any) => [
|
|
606
|
+
styles.timeItemCompact,
|
|
607
|
+
isSelected && styles.timeItemCompactSelected,
|
|
608
|
+
Platform.OS === 'web' && hovered && !isSelected && styles.timeItemHovered,
|
|
609
|
+
]}
|
|
610
|
+
>
|
|
611
|
+
<Text style={[styles.timeItemTextCompact, isSelected && styles.timeItemTextSelected]}>
|
|
612
|
+
{hour.toString().padStart(2, '0')}
|
|
613
|
+
</Text>
|
|
614
|
+
</Pressable>
|
|
615
|
+
);
|
|
616
|
+
})}
|
|
617
|
+
</ScrollView>
|
|
618
|
+
</View>
|
|
619
|
+
|
|
620
|
+
{/* Minutes */}
|
|
621
|
+
<View style={styles.timeColumnCompact}>
|
|
622
|
+
<ScrollView
|
|
623
|
+
style={styles.timeScrollCompact}
|
|
624
|
+
showsVerticalScrollIndicator={false}
|
|
625
|
+
contentContainerStyle={styles.timeScrollContent}
|
|
626
|
+
>
|
|
627
|
+
{minutes.map((minute) => {
|
|
628
|
+
const isSelected = minute === currentMinute;
|
|
629
|
+
return (
|
|
630
|
+
<Pressable
|
|
631
|
+
key={minute}
|
|
632
|
+
onPress={() => handleTimeSelect(displayHour, minute, currentIsPM)}
|
|
633
|
+
style={({ hovered }: any) => [
|
|
634
|
+
styles.timeItemCompact,
|
|
635
|
+
isSelected && styles.timeItemCompactSelected,
|
|
636
|
+
Platform.OS === 'web' && hovered && !isSelected && styles.timeItemHovered,
|
|
637
|
+
]}
|
|
638
|
+
>
|
|
639
|
+
<Text style={[styles.timeItemTextCompact, isSelected && styles.timeItemTextSelected]}>
|
|
640
|
+
{minute.toString().padStart(2, '0')}
|
|
641
|
+
</Text>
|
|
642
|
+
</Pressable>
|
|
643
|
+
);
|
|
644
|
+
})}
|
|
645
|
+
</ScrollView>
|
|
646
|
+
</View>
|
|
647
|
+
|
|
648
|
+
{/* AM/PM */}
|
|
649
|
+
{!use24HourFormat && (
|
|
650
|
+
<View style={styles.timeColumnCompact}>
|
|
651
|
+
<View style={styles.ampmContainerCompact}>
|
|
652
|
+
<Pressable
|
|
653
|
+
onPress={() => handleTimeSelect(displayHour, currentMinute, false)}
|
|
654
|
+
style={({ hovered }: any) => [
|
|
655
|
+
styles.timeItemCompact,
|
|
656
|
+
!currentIsPM && styles.timeItemCompactSelected,
|
|
657
|
+
Platform.OS === 'web' && hovered && currentIsPM && styles.timeItemHovered,
|
|
658
|
+
]}
|
|
659
|
+
>
|
|
660
|
+
<Text style={[styles.timeItemTextCompact, !currentIsPM && styles.timeItemTextSelected]}>
|
|
661
|
+
AM
|
|
662
|
+
</Text>
|
|
663
|
+
</Pressable>
|
|
664
|
+
<Pressable
|
|
665
|
+
onPress={() => handleTimeSelect(displayHour, currentMinute, true)}
|
|
666
|
+
style={({ hovered }: any) => [
|
|
667
|
+
styles.timeItemCompact,
|
|
668
|
+
currentIsPM && styles.timeItemCompactSelected,
|
|
669
|
+
Platform.OS === 'web' && hovered && !currentIsPM && styles.timeItemHovered,
|
|
670
|
+
]}
|
|
671
|
+
>
|
|
672
|
+
<Text style={[styles.timeItemTextCompact, currentIsPM && styles.timeItemTextSelected]}>
|
|
673
|
+
PM
|
|
674
|
+
</Text>
|
|
675
|
+
</Pressable>
|
|
676
|
+
</View>
|
|
677
|
+
</View>
|
|
678
|
+
)}
|
|
679
|
+
</View>
|
|
680
|
+
</View>
|
|
681
|
+
</View>
|
|
682
|
+
)}
|
|
683
|
+
|
|
684
|
+
{/* Date Only Mode */}
|
|
685
|
+
{mode === 'date' && (
|
|
686
|
+
<View style={styles.calendarContainer}>
|
|
687
|
+
{/* Month/Year Header */}
|
|
688
|
+
<View style={styles.calendarHeader}>
|
|
689
|
+
<Pressable
|
|
690
|
+
onPress={() => handleYearChange(-1)}
|
|
691
|
+
style={({ hovered }: any) => [
|
|
692
|
+
styles.navButton,
|
|
693
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
694
|
+
]}
|
|
695
|
+
>
|
|
696
|
+
<Text style={styles.navButtonText}>«</Text>
|
|
697
|
+
</Pressable>
|
|
698
|
+
<Pressable
|
|
699
|
+
onPress={() => handleMonthChange(-1)}
|
|
700
|
+
style={({ hovered }: any) => [
|
|
701
|
+
styles.navButton,
|
|
702
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
703
|
+
]}
|
|
704
|
+
>
|
|
705
|
+
<Text style={styles.navButtonText}>‹</Text>
|
|
706
|
+
</Pressable>
|
|
707
|
+
<Text style={styles.calendarTitle}>
|
|
708
|
+
{MONTHS_SHORT[viewDate.getMonth()]} {viewDate.getFullYear()}
|
|
709
|
+
</Text>
|
|
710
|
+
<Pressable
|
|
711
|
+
onPress={() => handleMonthChange(1)}
|
|
712
|
+
style={({ hovered }: any) => [
|
|
713
|
+
styles.navButton,
|
|
714
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
715
|
+
]}
|
|
716
|
+
>
|
|
717
|
+
<Text style={styles.navButtonText}>›</Text>
|
|
718
|
+
</Pressable>
|
|
719
|
+
<Pressable
|
|
720
|
+
onPress={() => handleYearChange(1)}
|
|
721
|
+
style={({ hovered }: any) => [
|
|
722
|
+
styles.navButton,
|
|
723
|
+
Platform.OS === 'web' && hovered && styles.navButtonHovered,
|
|
724
|
+
]}
|
|
725
|
+
>
|
|
726
|
+
<Text style={styles.navButtonText}>»</Text>
|
|
727
|
+
</Pressable>
|
|
728
|
+
</View>
|
|
729
|
+
|
|
730
|
+
{/* Weekday Headers */}
|
|
731
|
+
<View style={styles.weekdaysRow}>
|
|
732
|
+
{weekdays.map((day) => (
|
|
733
|
+
<View key={day} style={styles.weekdayCell}>
|
|
734
|
+
<Text style={styles.weekdayText}>{day}</Text>
|
|
735
|
+
</View>
|
|
736
|
+
))}
|
|
737
|
+
</View>
|
|
738
|
+
|
|
739
|
+
{/* Calendar Grid */}
|
|
740
|
+
<View style={styles.calendarGrid}>
|
|
741
|
+
{calendarDays.map((dayInfo, index) => {
|
|
742
|
+
const { day, isCurrentMonth, isPrevMonth, isNextMonth } = dayInfo;
|
|
743
|
+
|
|
744
|
+
let dateToCheck: Date;
|
|
745
|
+
if (isPrevMonth) {
|
|
746
|
+
dateToCheck = new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, day);
|
|
747
|
+
} else if (isNextMonth) {
|
|
748
|
+
dateToCheck = new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, day);
|
|
749
|
+
} else {
|
|
750
|
+
dateToCheck = new Date(viewDate.getFullYear(), viewDate.getMonth(), day);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
const isSelected = selectedDate && isSameDay(dateToCheck, selectedDate);
|
|
754
|
+
const isToday = isSameDay(dateToCheck, new Date());
|
|
755
|
+
const isDisabledDay = isDateDisabled(dateToCheck, minDate, maxDate);
|
|
756
|
+
|
|
757
|
+
return (
|
|
758
|
+
<Pressable
|
|
759
|
+
key={`${isPrevMonth ? 'prev' : isNextMonth ? 'next' : 'curr'}-${day}-${index}`}
|
|
760
|
+
onPress={() => !isDisabledDay && handleDateSelect(day, isPrevMonth, isNextMonth)}
|
|
761
|
+
style={({ hovered }: any) => [
|
|
762
|
+
styles.dayCell,
|
|
763
|
+
isSelected && styles.dayCellSelected,
|
|
764
|
+
isToday && !isSelected && styles.dayCellToday,
|
|
765
|
+
isDisabledDay && styles.dayCellDisabled,
|
|
766
|
+
Platform.OS === 'web' && hovered && !isDisabledDay && !isSelected && styles.dayCellHovered,
|
|
767
|
+
]}
|
|
768
|
+
>
|
|
769
|
+
<Text
|
|
770
|
+
style={[
|
|
771
|
+
styles.dayText,
|
|
772
|
+
!isCurrentMonth && styles.dayTextOtherMonth,
|
|
773
|
+
isSelected && styles.dayTextSelected,
|
|
774
|
+
isToday && !isSelected && styles.dayTextToday,
|
|
775
|
+
isDisabledDay && styles.dayTextDisabled,
|
|
776
|
+
]}
|
|
777
|
+
>
|
|
778
|
+
{day}
|
|
779
|
+
</Text>
|
|
780
|
+
</Pressable>
|
|
781
|
+
);
|
|
782
|
+
})}
|
|
783
|
+
</View>
|
|
784
|
+
</View>
|
|
785
|
+
)}
|
|
786
|
+
|
|
787
|
+
{/* Time Only Mode */}
|
|
788
|
+
{mode === 'time' && (
|
|
789
|
+
<View style={styles.timeContainer}>
|
|
790
|
+
<View style={styles.timeColumns}>
|
|
791
|
+
{/* Hours */}
|
|
792
|
+
<View style={styles.timeColumn}>
|
|
793
|
+
<ScrollView style={styles.timeScroll} showsVerticalScrollIndicator={false}>
|
|
794
|
+
{hours.map((hour) => {
|
|
795
|
+
const isSelected = hour === displayHour;
|
|
796
|
+
return (
|
|
797
|
+
<Pressable
|
|
798
|
+
key={hour}
|
|
799
|
+
onPress={() => handleTimeSelect(hour, currentMinute, currentIsPM)}
|
|
800
|
+
style={({ hovered }: any) => [
|
|
801
|
+
styles.timeItem,
|
|
802
|
+
isSelected && styles.timeItemSelected,
|
|
803
|
+
Platform.OS === 'web' && hovered && !isSelected && styles.timeItemHovered,
|
|
804
|
+
]}
|
|
805
|
+
>
|
|
806
|
+
<Text style={[styles.timeItemText, isSelected && styles.timeItemTextSelected]}>
|
|
807
|
+
{hour.toString().padStart(2, '0')}
|
|
808
|
+
</Text>
|
|
809
|
+
</Pressable>
|
|
810
|
+
);
|
|
811
|
+
})}
|
|
812
|
+
</ScrollView>
|
|
813
|
+
</View>
|
|
814
|
+
|
|
815
|
+
{/* Minutes */}
|
|
816
|
+
<View style={styles.timeColumn}>
|
|
817
|
+
<ScrollView style={styles.timeScroll} showsVerticalScrollIndicator={false}>
|
|
818
|
+
{minutes.map((minute) => {
|
|
819
|
+
const isSelected = minute === currentMinute;
|
|
820
|
+
return (
|
|
821
|
+
<Pressable
|
|
822
|
+
key={minute}
|
|
823
|
+
onPress={() => handleTimeSelect(displayHour, minute, currentIsPM)}
|
|
824
|
+
style={({ hovered }: any) => [
|
|
825
|
+
styles.timeItem,
|
|
826
|
+
isSelected && styles.timeItemSelected,
|
|
827
|
+
Platform.OS === 'web' && hovered && !isSelected && styles.timeItemHovered,
|
|
828
|
+
]}
|
|
829
|
+
>
|
|
830
|
+
<Text style={[styles.timeItemText, isSelected && styles.timeItemTextSelected]}>
|
|
831
|
+
{minute.toString().padStart(2, '0')}
|
|
832
|
+
</Text>
|
|
833
|
+
</Pressable>
|
|
834
|
+
);
|
|
835
|
+
})}
|
|
836
|
+
</ScrollView>
|
|
837
|
+
</View>
|
|
838
|
+
|
|
839
|
+
{/* AM/PM */}
|
|
840
|
+
{!use24HourFormat && (
|
|
841
|
+
<View style={styles.timeColumn}>
|
|
842
|
+
<View style={styles.ampmContainer}>
|
|
843
|
+
<Pressable
|
|
844
|
+
onPress={() => handleTimeSelect(displayHour, currentMinute, false)}
|
|
845
|
+
style={({ hovered }: any) => [
|
|
846
|
+
styles.timeItem,
|
|
847
|
+
!currentIsPM && styles.timeItemSelected,
|
|
848
|
+
Platform.OS === 'web' && hovered && currentIsPM && styles.timeItemHovered,
|
|
849
|
+
]}
|
|
850
|
+
>
|
|
851
|
+
<Text style={[styles.timeItemText, !currentIsPM && styles.timeItemTextSelected]}>
|
|
852
|
+
AM
|
|
853
|
+
</Text>
|
|
854
|
+
</Pressable>
|
|
855
|
+
<Pressable
|
|
856
|
+
onPress={() => handleTimeSelect(displayHour, currentMinute, true)}
|
|
857
|
+
style={({ hovered }: any) => [
|
|
858
|
+
styles.timeItem,
|
|
859
|
+
currentIsPM && styles.timeItemSelected,
|
|
860
|
+
Platform.OS === 'web' && hovered && !currentIsPM && styles.timeItemHovered,
|
|
861
|
+
]}
|
|
862
|
+
>
|
|
863
|
+
<Text style={[styles.timeItemText, currentIsPM && styles.timeItemTextSelected]}>
|
|
864
|
+
PM
|
|
865
|
+
</Text>
|
|
866
|
+
</Pressable>
|
|
867
|
+
</View>
|
|
868
|
+
</View>
|
|
869
|
+
)}
|
|
870
|
+
</View>
|
|
871
|
+
</View>
|
|
872
|
+
)}
|
|
873
|
+
|
|
874
|
+
{/* Footer with Now and OK buttons */}
|
|
875
|
+
{(mode === 'datetime' || mode === 'time') && (
|
|
876
|
+
<View style={styles.footer}>
|
|
877
|
+
{showNowButton && (
|
|
878
|
+
<Pressable
|
|
879
|
+
onPress={handleNowPress}
|
|
880
|
+
style={({ hovered }: any) => [
|
|
881
|
+
styles.footerButton,
|
|
882
|
+
Platform.OS === 'web' && hovered && styles.footerButtonHovered,
|
|
883
|
+
]}
|
|
884
|
+
>
|
|
885
|
+
<Text style={styles.footerButtonText}>Now</Text>
|
|
886
|
+
</Pressable>
|
|
887
|
+
)}
|
|
888
|
+
<View style={styles.footerSpacer} />
|
|
889
|
+
<Pressable
|
|
890
|
+
onPress={handleOkPress}
|
|
891
|
+
style={({ hovered }: any) => [
|
|
892
|
+
styles.okButton,
|
|
893
|
+
Platform.OS === 'web' && hovered && styles.okButtonHovered,
|
|
894
|
+
]}
|
|
895
|
+
>
|
|
896
|
+
<Text style={styles.okButtonText}>OK</Text>
|
|
897
|
+
</Pressable>
|
|
898
|
+
</View>
|
|
899
|
+
)}
|
|
900
|
+
</View>
|
|
901
|
+
</Pressable>
|
|
902
|
+
</Modal>
|
|
903
|
+
</View>
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
);
|
|
907
|
+
|
|
908
|
+
DatePicker.displayName = 'DatePicker';
|
|
909
|
+
|
|
910
|
+
// ============================================================================
|
|
911
|
+
// Styles
|
|
912
|
+
// ============================================================================
|
|
913
|
+
|
|
914
|
+
const styles = StyleSheet.create({
|
|
915
|
+
container: {
|
|
916
|
+
width: '100%',
|
|
917
|
+
},
|
|
918
|
+
label: {
|
|
919
|
+
fontSize: typography.fontSize.componentLabel,
|
|
920
|
+
fontWeight: typography.fontWeight.semiBold,
|
|
921
|
+
color: colors.text.default,
|
|
922
|
+
marginBottom: spacing.base,
|
|
923
|
+
},
|
|
924
|
+
labelDisabled: {
|
|
925
|
+
color: colors.text.disabled,
|
|
926
|
+
},
|
|
927
|
+
required: {
|
|
928
|
+
color: colors.feedback.error.content,
|
|
929
|
+
},
|
|
930
|
+
picker: {
|
|
931
|
+
flexDirection: 'row',
|
|
932
|
+
alignItems: 'center',
|
|
933
|
+
justifyContent: 'space-between',
|
|
934
|
+
borderRadius: borderRadius.md,
|
|
935
|
+
},
|
|
936
|
+
pickerOpen: {
|
|
937
|
+
borderColor: colors.brand.blue,
|
|
938
|
+
},
|
|
939
|
+
pickerHovered: {
|
|
940
|
+
borderColor: colors.brand.blue,
|
|
941
|
+
backgroundColor: colors.background.hover,
|
|
942
|
+
},
|
|
943
|
+
outline: {
|
|
944
|
+
borderWidth: 1,
|
|
945
|
+
borderColor: colors.border.default,
|
|
946
|
+
backgroundColor: colors.background.default,
|
|
947
|
+
},
|
|
948
|
+
filled: {
|
|
949
|
+
backgroundColor: colors.background.secondary,
|
|
950
|
+
},
|
|
951
|
+
sm: {
|
|
952
|
+
height: 32,
|
|
953
|
+
paddingHorizontal: spacing['2x'],
|
|
954
|
+
},
|
|
955
|
+
md: {
|
|
956
|
+
height: 40,
|
|
957
|
+
paddingHorizontal: spacing['3x'],
|
|
958
|
+
},
|
|
959
|
+
lg: {
|
|
960
|
+
height: 48,
|
|
961
|
+
paddingHorizontal: spacing['4x'],
|
|
962
|
+
},
|
|
963
|
+
error: {
|
|
964
|
+
borderColor: colors.border.danger,
|
|
965
|
+
},
|
|
966
|
+
disabled: {
|
|
967
|
+
backgroundColor: colors.background.secondary,
|
|
968
|
+
borderColor: colors.border.disabled,
|
|
969
|
+
},
|
|
970
|
+
pickerText: {
|
|
971
|
+
flex: 1,
|
|
972
|
+
color: colors.text.default,
|
|
973
|
+
fontSize: typography.fontSize.body,
|
|
974
|
+
},
|
|
975
|
+
placeholder: {
|
|
976
|
+
color: colors.text.disabled,
|
|
977
|
+
},
|
|
978
|
+
disabledText: {
|
|
979
|
+
color: colors.text.disabled,
|
|
980
|
+
},
|
|
981
|
+
helperText: {
|
|
982
|
+
fontSize: typography.fontSize.caption,
|
|
983
|
+
color: colors.text.secondary,
|
|
984
|
+
marginTop: spacing.base,
|
|
985
|
+
},
|
|
986
|
+
errorText: {
|
|
987
|
+
color: colors.feedback.error.content,
|
|
988
|
+
},
|
|
989
|
+
modalOverlay: {
|
|
990
|
+
flex: 1,
|
|
991
|
+
backgroundColor: 'transparent',
|
|
992
|
+
},
|
|
993
|
+
dropdown: {
|
|
994
|
+
backgroundColor: colors.background.default,
|
|
995
|
+
borderRadius: borderRadius.lg,
|
|
996
|
+
borderWidth: 1,
|
|
997
|
+
borderColor: colors.border.default,
|
|
998
|
+
...Platform.select({
|
|
999
|
+
ios: {
|
|
1000
|
+
shadowColor: colors.black,
|
|
1001
|
+
shadowOffset: { width: 0, height: 4 },
|
|
1002
|
+
shadowOpacity: 0.15,
|
|
1003
|
+
shadowRadius: 12,
|
|
1004
|
+
},
|
|
1005
|
+
android: {
|
|
1006
|
+
elevation: 8,
|
|
1007
|
+
},
|
|
1008
|
+
web: {
|
|
1009
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
|
1010
|
+
} as any,
|
|
1011
|
+
}),
|
|
1012
|
+
},
|
|
1013
|
+
|
|
1014
|
+
// DateTime Side-by-Side Layout
|
|
1015
|
+
datetimeContainer: {
|
|
1016
|
+
flexDirection: 'row',
|
|
1017
|
+
},
|
|
1018
|
+
calendarSection: {
|
|
1019
|
+
flex: 1,
|
|
1020
|
+
padding: spacing['2x'],
|
|
1021
|
+
},
|
|
1022
|
+
verticalDivider: {
|
|
1023
|
+
width: 1,
|
|
1024
|
+
backgroundColor: colors.border.disabled,
|
|
1025
|
+
},
|
|
1026
|
+
timeSection: {
|
|
1027
|
+
width: 120,
|
|
1028
|
+
padding: spacing['2x'],
|
|
1029
|
+
},
|
|
1030
|
+
timeSectionColumns: {
|
|
1031
|
+
flexDirection: 'row',
|
|
1032
|
+
height: 220,
|
|
1033
|
+
},
|
|
1034
|
+
timeColumnCompact: {
|
|
1035
|
+
flex: 1,
|
|
1036
|
+
},
|
|
1037
|
+
timeScrollCompact: {
|
|
1038
|
+
flex: 1,
|
|
1039
|
+
},
|
|
1040
|
+
timeScrollContent: {
|
|
1041
|
+
paddingVertical: spacing.base,
|
|
1042
|
+
},
|
|
1043
|
+
ampmContainerCompact: {
|
|
1044
|
+
flex: 1,
|
|
1045
|
+
justifyContent: 'flex-start',
|
|
1046
|
+
paddingTop: spacing.base,
|
|
1047
|
+
},
|
|
1048
|
+
timeItemCompact: {
|
|
1049
|
+
paddingVertical: spacing.base,
|
|
1050
|
+
paddingHorizontal: spacing.base,
|
|
1051
|
+
alignItems: 'center',
|
|
1052
|
+
borderRadius: borderRadius.sm,
|
|
1053
|
+
marginVertical: 1,
|
|
1054
|
+
},
|
|
1055
|
+
timeItemCompactSelected: {
|
|
1056
|
+
backgroundColor: colors.brand.blue,
|
|
1057
|
+
},
|
|
1058
|
+
timeItemTextCompact: {
|
|
1059
|
+
fontSize: typography.fontSize.componentLabel,
|
|
1060
|
+
color: colors.text.default,
|
|
1061
|
+
},
|
|
1062
|
+
|
|
1063
|
+
// Calendar
|
|
1064
|
+
calendarContainer: {
|
|
1065
|
+
padding: spacing['2x'],
|
|
1066
|
+
},
|
|
1067
|
+
calendarHeader: {
|
|
1068
|
+
flexDirection: 'row',
|
|
1069
|
+
alignItems: 'center',
|
|
1070
|
+
justifyContent: 'center',
|
|
1071
|
+
marginBottom: spacing['2x'],
|
|
1072
|
+
gap: 2,
|
|
1073
|
+
},
|
|
1074
|
+
calendarTitle: {
|
|
1075
|
+
fontSize: typography.fontSize.componentLabel,
|
|
1076
|
+
fontWeight: typography.fontWeight.medium,
|
|
1077
|
+
color: colors.text.default,
|
|
1078
|
+
minWidth: 80,
|
|
1079
|
+
textAlign: 'center',
|
|
1080
|
+
},
|
|
1081
|
+
navButton: {
|
|
1082
|
+
padding: spacing.base,
|
|
1083
|
+
borderRadius: borderRadius.sm,
|
|
1084
|
+
},
|
|
1085
|
+
navButtonHovered: {
|
|
1086
|
+
backgroundColor: colors.background.hover,
|
|
1087
|
+
},
|
|
1088
|
+
navButtonText: {
|
|
1089
|
+
fontSize: typography.fontSize.componentLabel,
|
|
1090
|
+
color: colors.text.secondary,
|
|
1091
|
+
fontWeight: typography.fontWeight.medium,
|
|
1092
|
+
},
|
|
1093
|
+
weekdaysRow: {
|
|
1094
|
+
flexDirection: 'row',
|
|
1095
|
+
marginBottom: spacing.base,
|
|
1096
|
+
},
|
|
1097
|
+
weekdayCell: {
|
|
1098
|
+
flex: 1,
|
|
1099
|
+
alignItems: 'center',
|
|
1100
|
+
paddingVertical: 2,
|
|
1101
|
+
},
|
|
1102
|
+
weekdayText: {
|
|
1103
|
+
fontSize: typography.fontSize.small,
|
|
1104
|
+
fontWeight: typography.fontWeight.medium,
|
|
1105
|
+
color: colors.text.secondary,
|
|
1106
|
+
},
|
|
1107
|
+
calendarGrid: {
|
|
1108
|
+
flexDirection: 'row',
|
|
1109
|
+
flexWrap: 'wrap',
|
|
1110
|
+
},
|
|
1111
|
+
dayCell: {
|
|
1112
|
+
width: '14.28%',
|
|
1113
|
+
height: 28,
|
|
1114
|
+
alignItems: 'center',
|
|
1115
|
+
justifyContent: 'center',
|
|
1116
|
+
borderRadius: borderRadius.sm,
|
|
1117
|
+
},
|
|
1118
|
+
dayCellSelected: {
|
|
1119
|
+
backgroundColor: colors.brand.blue,
|
|
1120
|
+
},
|
|
1121
|
+
dayCellToday: {
|
|
1122
|
+
borderWidth: 1,
|
|
1123
|
+
borderColor: colors.brand.blue,
|
|
1124
|
+
},
|
|
1125
|
+
dayCellHovered: {
|
|
1126
|
+
backgroundColor: colors.background.hover,
|
|
1127
|
+
},
|
|
1128
|
+
dayCellDisabled: {
|
|
1129
|
+
opacity: 0.4,
|
|
1130
|
+
},
|
|
1131
|
+
dayText: {
|
|
1132
|
+
fontSize: typography.fontSize.componentLabel,
|
|
1133
|
+
color: colors.text.default,
|
|
1134
|
+
},
|
|
1135
|
+
dayTextOtherMonth: {
|
|
1136
|
+
color: colors.text.disabled,
|
|
1137
|
+
},
|
|
1138
|
+
dayTextSelected: {
|
|
1139
|
+
color: colors.white,
|
|
1140
|
+
fontWeight: typography.fontWeight.medium,
|
|
1141
|
+
},
|
|
1142
|
+
dayTextToday: {
|
|
1143
|
+
color: colors.brand.blue,
|
|
1144
|
+
fontWeight: typography.fontWeight.medium,
|
|
1145
|
+
},
|
|
1146
|
+
dayTextDisabled: {
|
|
1147
|
+
color: colors.text.disabled,
|
|
1148
|
+
},
|
|
1149
|
+
|
|
1150
|
+
// Time Picker (standalone)
|
|
1151
|
+
timeContainer: {
|
|
1152
|
+
padding: spacing['3x'],
|
|
1153
|
+
},
|
|
1154
|
+
timeColumns: {
|
|
1155
|
+
flexDirection: 'row',
|
|
1156
|
+
gap: spacing['2x'],
|
|
1157
|
+
height: 200,
|
|
1158
|
+
},
|
|
1159
|
+
timeColumn: {
|
|
1160
|
+
flex: 1,
|
|
1161
|
+
},
|
|
1162
|
+
timeScroll: {
|
|
1163
|
+
flex: 1,
|
|
1164
|
+
},
|
|
1165
|
+
ampmContainer: {
|
|
1166
|
+
gap: spacing['2x'],
|
|
1167
|
+
},
|
|
1168
|
+
timeItem: {
|
|
1169
|
+
paddingVertical: spacing['2x'],
|
|
1170
|
+
paddingHorizontal: spacing['3x'],
|
|
1171
|
+
alignItems: 'center',
|
|
1172
|
+
borderRadius: borderRadius.md,
|
|
1173
|
+
marginBottom: spacing.base,
|
|
1174
|
+
},
|
|
1175
|
+
timeItemSelected: {
|
|
1176
|
+
backgroundColor: colors.brand.blue,
|
|
1177
|
+
},
|
|
1178
|
+
timeItemHovered: {
|
|
1179
|
+
backgroundColor: colors.background.hover,
|
|
1180
|
+
},
|
|
1181
|
+
timeItemText: {
|
|
1182
|
+
fontSize: typography.fontSize.body,
|
|
1183
|
+
color: colors.text.default,
|
|
1184
|
+
},
|
|
1185
|
+
timeItemTextSelected: {
|
|
1186
|
+
color: colors.white,
|
|
1187
|
+
fontWeight: typography.fontWeight.medium,
|
|
1188
|
+
},
|
|
1189
|
+
|
|
1190
|
+
// Footer
|
|
1191
|
+
footer: {
|
|
1192
|
+
flexDirection: 'row',
|
|
1193
|
+
alignItems: 'center',
|
|
1194
|
+
paddingHorizontal: spacing['2x'],
|
|
1195
|
+
paddingVertical: spacing['2x'],
|
|
1196
|
+
borderTopWidth: 1,
|
|
1197
|
+
borderTopColor: colors.border.disabled,
|
|
1198
|
+
},
|
|
1199
|
+
footerSpacer: {
|
|
1200
|
+
flex: 1,
|
|
1201
|
+
},
|
|
1202
|
+
footerButton: {
|
|
1203
|
+
paddingVertical: spacing.base,
|
|
1204
|
+
paddingHorizontal: spacing['2x'],
|
|
1205
|
+
borderRadius: borderRadius.md,
|
|
1206
|
+
},
|
|
1207
|
+
footerButtonHovered: {
|
|
1208
|
+
backgroundColor: colors.background.hover,
|
|
1209
|
+
},
|
|
1210
|
+
footerButtonText: {
|
|
1211
|
+
fontSize: typography.fontSize.componentLabel,
|
|
1212
|
+
color: colors.text.secondary,
|
|
1213
|
+
},
|
|
1214
|
+
okButton: {
|
|
1215
|
+
paddingVertical: spacing.base,
|
|
1216
|
+
paddingHorizontal: spacing['3x'],
|
|
1217
|
+
borderRadius: borderRadius.md,
|
|
1218
|
+
backgroundColor: colors.background.secondary,
|
|
1219
|
+
},
|
|
1220
|
+
okButtonHovered: {
|
|
1221
|
+
backgroundColor: colors.background.tertiary,
|
|
1222
|
+
},
|
|
1223
|
+
okButtonText: {
|
|
1224
|
+
fontSize: typography.fontSize.componentLabel,
|
|
1225
|
+
color: colors.text.secondary,
|
|
1226
|
+
fontWeight: typography.fontWeight.medium,
|
|
1227
|
+
},
|
|
1228
|
+
});
|