@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,623 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { DatePicker } from './DatePicker';
|
|
4
|
+
import { VStack } from '../VStack';
|
|
5
|
+
import { HStack } from '../HStack';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
import { View } from 'react-native';
|
|
8
|
+
import { spacing } from '../../styles/tokens';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof DatePicker> = {
|
|
11
|
+
title: 'Forms/DatePicker',
|
|
12
|
+
component: DatePicker,
|
|
13
|
+
argTypes: {
|
|
14
|
+
mode: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['date', 'time', 'datetime'],
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['outline', 'filled'],
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
options: ['sm', 'md', 'lg'],
|
|
25
|
+
},
|
|
26
|
+
isInvalid: { control: 'boolean' },
|
|
27
|
+
isDisabled: { control: 'boolean' },
|
|
28
|
+
isRequired: { control: 'boolean' },
|
|
29
|
+
use24HourFormat: { control: 'boolean' },
|
|
30
|
+
showNowButton: { control: 'boolean' },
|
|
31
|
+
firstDayOfWeek: {
|
|
32
|
+
control: 'select',
|
|
33
|
+
options: [0, 1],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
mode: 'date',
|
|
38
|
+
variant: 'outline',
|
|
39
|
+
size: 'md',
|
|
40
|
+
showNowButton: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default meta;
|
|
45
|
+
|
|
46
|
+
type Story = StoryObj<typeof DatePicker>;
|
|
47
|
+
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// BASIC STORIES
|
|
50
|
+
// ============================================================================
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {
|
|
53
|
+
render: (args) => (
|
|
54
|
+
<View style={{ width: 300 }}>
|
|
55
|
+
<DatePicker {...args} />
|
|
56
|
+
</View>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const WithLabel: Story = {
|
|
61
|
+
render: () => (
|
|
62
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
63
|
+
<DatePicker
|
|
64
|
+
label="Date of Birth"
|
|
65
|
+
placeholder="Select your birth date"
|
|
66
|
+
mode="date"
|
|
67
|
+
/>
|
|
68
|
+
<DatePicker
|
|
69
|
+
label="Appointment Time"
|
|
70
|
+
placeholder="Select time"
|
|
71
|
+
mode="time"
|
|
72
|
+
/>
|
|
73
|
+
<DatePicker
|
|
74
|
+
label="Event Date & Time"
|
|
75
|
+
placeholder="Select date and time"
|
|
76
|
+
mode="datetime"
|
|
77
|
+
/>
|
|
78
|
+
</VStack>
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// MODE VARIANTS
|
|
84
|
+
// ============================================================================
|
|
85
|
+
|
|
86
|
+
export const DateOnly: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
89
|
+
<Text weight="semiBold">Date Picker Only</Text>
|
|
90
|
+
<DatePicker
|
|
91
|
+
label="Select Date"
|
|
92
|
+
mode="date"
|
|
93
|
+
placeholder="Choose a date..."
|
|
94
|
+
helperText="Select any date from the calendar"
|
|
95
|
+
/>
|
|
96
|
+
</VStack>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const TimeOnly: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
103
|
+
<Text weight="semiBold">Time Picker Only</Text>
|
|
104
|
+
<DatePicker
|
|
105
|
+
label="Select Time"
|
|
106
|
+
mode="time"
|
|
107
|
+
placeholder="Choose a time..."
|
|
108
|
+
helperText="Select hour and minute"
|
|
109
|
+
/>
|
|
110
|
+
</VStack>
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const DateTime: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
size: "sm"
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
render: () => (
|
|
120
|
+
<VStack space={16} style={{ width: 400 }}>
|
|
121
|
+
<Text weight="semiBold">Date & Time Picker</Text>
|
|
122
|
+
<Text size="caption" color="secondary">
|
|
123
|
+
Calendar and time picker shown side by side for easy selection
|
|
124
|
+
</Text>
|
|
125
|
+
<DatePicker
|
|
126
|
+
label="Select Date & Time"
|
|
127
|
+
mode="datetime"
|
|
128
|
+
placeholder="Choose date and time..."
|
|
129
|
+
helperText="Click 'Now' to select current date/time, 'OK' to confirm"
|
|
130
|
+
/>
|
|
131
|
+
</VStack>
|
|
132
|
+
)
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// ============================================================================
|
|
136
|
+
// VARIANTS
|
|
137
|
+
// ============================================================================
|
|
138
|
+
|
|
139
|
+
export const Variants: Story = {
|
|
140
|
+
render: () => (
|
|
141
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
142
|
+
<Text weight="semiBold">DatePicker Variants</Text>
|
|
143
|
+
<DatePicker
|
|
144
|
+
label="Outline"
|
|
145
|
+
variant="outline"
|
|
146
|
+
mode="date"
|
|
147
|
+
placeholder="Select date..."
|
|
148
|
+
/>
|
|
149
|
+
<DatePicker
|
|
150
|
+
label="Filled"
|
|
151
|
+
variant="filled"
|
|
152
|
+
mode="date"
|
|
153
|
+
placeholder="Select date..."
|
|
154
|
+
/>
|
|
155
|
+
</VStack>
|
|
156
|
+
),
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// ============================================================================
|
|
160
|
+
// SIZES
|
|
161
|
+
// ============================================================================
|
|
162
|
+
|
|
163
|
+
export const Sizes: Story = {
|
|
164
|
+
render: () => (
|
|
165
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
166
|
+
<Text weight="semiBold">DatePicker Sizes</Text>
|
|
167
|
+
<DatePicker
|
|
168
|
+
label="Small"
|
|
169
|
+
size="sm"
|
|
170
|
+
mode="date"
|
|
171
|
+
placeholder="Small picker..."
|
|
172
|
+
/>
|
|
173
|
+
<DatePicker
|
|
174
|
+
label="Medium"
|
|
175
|
+
size="md"
|
|
176
|
+
mode="date"
|
|
177
|
+
placeholder="Medium picker..."
|
|
178
|
+
/>
|
|
179
|
+
<DatePicker
|
|
180
|
+
label="Large"
|
|
181
|
+
size="lg"
|
|
182
|
+
mode="date"
|
|
183
|
+
placeholder="Large picker..."
|
|
184
|
+
/>
|
|
185
|
+
</VStack>
|
|
186
|
+
),
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// ============================================================================
|
|
190
|
+
// STATES
|
|
191
|
+
// ============================================================================
|
|
192
|
+
|
|
193
|
+
export const States: Story = {
|
|
194
|
+
render: () => (
|
|
195
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
196
|
+
<Text weight="semiBold">DatePicker States</Text>
|
|
197
|
+
<DatePicker
|
|
198
|
+
label="Normal"
|
|
199
|
+
mode="date"
|
|
200
|
+
placeholder="Select date..."
|
|
201
|
+
/>
|
|
202
|
+
<DatePicker
|
|
203
|
+
label="With Default Value"
|
|
204
|
+
mode="date"
|
|
205
|
+
defaultValue={new Date()}
|
|
206
|
+
/>
|
|
207
|
+
<DatePicker
|
|
208
|
+
label="Disabled"
|
|
209
|
+
mode="date"
|
|
210
|
+
placeholder="Select date..."
|
|
211
|
+
isDisabled
|
|
212
|
+
/>
|
|
213
|
+
<DatePicker
|
|
214
|
+
label="Required"
|
|
215
|
+
mode="date"
|
|
216
|
+
placeholder="Select date..."
|
|
217
|
+
isRequired
|
|
218
|
+
/>
|
|
219
|
+
</VStack>
|
|
220
|
+
),
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const Validation: Story = {
|
|
224
|
+
render: () => (
|
|
225
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
226
|
+
<Text weight="semiBold">Validation States</Text>
|
|
227
|
+
<DatePicker
|
|
228
|
+
label="Valid Date"
|
|
229
|
+
mode="date"
|
|
230
|
+
defaultValue={new Date()}
|
|
231
|
+
helperText="Date has been saved"
|
|
232
|
+
/>
|
|
233
|
+
<DatePicker
|
|
234
|
+
label="Invalid Date"
|
|
235
|
+
mode="date"
|
|
236
|
+
placeholder="Select date..."
|
|
237
|
+
isInvalid
|
|
238
|
+
errorMessage="Please select a valid date"
|
|
239
|
+
/>
|
|
240
|
+
</VStack>
|
|
241
|
+
),
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// ============================================================================
|
|
245
|
+
// DATE CONSTRAINTS
|
|
246
|
+
// ============================================================================
|
|
247
|
+
|
|
248
|
+
export const WithMinMaxDate: Story = {
|
|
249
|
+
render: () => {
|
|
250
|
+
const today = new Date();
|
|
251
|
+
const minDate = new Date(today);
|
|
252
|
+
minDate.setDate(today.getDate() - 7);
|
|
253
|
+
const maxDate = new Date(today);
|
|
254
|
+
maxDate.setDate(today.getDate() + 30);
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
258
|
+
<Text weight="semiBold">Date Constraints</Text>
|
|
259
|
+
<DatePicker
|
|
260
|
+
label="Limited Date Range"
|
|
261
|
+
mode="date"
|
|
262
|
+
minDate={minDate}
|
|
263
|
+
maxDate={maxDate}
|
|
264
|
+
helperText="Select a date within the next 30 days (past 7 days available)"
|
|
265
|
+
/>
|
|
266
|
+
</VStack>
|
|
267
|
+
);
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export const FutureDatesOnly: Story = {
|
|
272
|
+
render: () => (
|
|
273
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
274
|
+
<Text weight="semiBold">Future Dates Only</Text>
|
|
275
|
+
<DatePicker
|
|
276
|
+
label="Appointment Date"
|
|
277
|
+
mode="date"
|
|
278
|
+
minDate={new Date()}
|
|
279
|
+
helperText="Only future dates can be selected"
|
|
280
|
+
/>
|
|
281
|
+
</VStack>
|
|
282
|
+
),
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const PastDatesOnly: Story = {
|
|
286
|
+
render: () => (
|
|
287
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
288
|
+
<Text weight="semiBold">Past Dates Only</Text>
|
|
289
|
+
<DatePicker
|
|
290
|
+
label="Birth Date"
|
|
291
|
+
mode="date"
|
|
292
|
+
maxDate={new Date()}
|
|
293
|
+
helperText="Only past dates can be selected"
|
|
294
|
+
/>
|
|
295
|
+
</VStack>
|
|
296
|
+
),
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// ============================================================================
|
|
300
|
+
// TIME FORMATS
|
|
301
|
+
// ============================================================================
|
|
302
|
+
|
|
303
|
+
export const TimeFormats: Story = {
|
|
304
|
+
render: () => (
|
|
305
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
306
|
+
<Text weight="semiBold">Time Formats</Text>
|
|
307
|
+
<DatePicker
|
|
308
|
+
label="12-Hour Format (Default)"
|
|
309
|
+
mode="time"
|
|
310
|
+
placeholder="Select time..."
|
|
311
|
+
use24HourFormat={false}
|
|
312
|
+
/>
|
|
313
|
+
<DatePicker
|
|
314
|
+
label="24-Hour Format"
|
|
315
|
+
mode="time"
|
|
316
|
+
placeholder="Select time..."
|
|
317
|
+
use24HourFormat={true}
|
|
318
|
+
/>
|
|
319
|
+
</VStack>
|
|
320
|
+
),
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// ============================================================================
|
|
324
|
+
// FIRST DAY OF WEEK
|
|
325
|
+
// ============================================================================
|
|
326
|
+
|
|
327
|
+
export const FirstDayOfWeek: Story = {
|
|
328
|
+
render: () => (
|
|
329
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
330
|
+
<Text weight="semiBold">First Day of Week</Text>
|
|
331
|
+
<DatePicker
|
|
332
|
+
label="Sunday First (Default)"
|
|
333
|
+
mode="date"
|
|
334
|
+
firstDayOfWeek={0}
|
|
335
|
+
/>
|
|
336
|
+
<DatePicker
|
|
337
|
+
label="Monday First"
|
|
338
|
+
mode="date"
|
|
339
|
+
firstDayOfWeek={1}
|
|
340
|
+
/>
|
|
341
|
+
</VStack>
|
|
342
|
+
),
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// ============================================================================
|
|
346
|
+
// CONTROLLED
|
|
347
|
+
// ============================================================================
|
|
348
|
+
|
|
349
|
+
export const ControlledDate: Story = {
|
|
350
|
+
render: () => {
|
|
351
|
+
const [date, setDate] = useState<Date | undefined>(new Date());
|
|
352
|
+
|
|
353
|
+
return (
|
|
354
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
355
|
+
<Text weight="semiBold">Controlled Date Picker</Text>
|
|
356
|
+
<DatePicker
|
|
357
|
+
label="Select Date"
|
|
358
|
+
mode="date"
|
|
359
|
+
value={date}
|
|
360
|
+
onChange={setDate}
|
|
361
|
+
/>
|
|
362
|
+
<Text size="caption" color="secondary">
|
|
363
|
+
Selected: {date ? date.toLocaleDateString() : 'None'}
|
|
364
|
+
</Text>
|
|
365
|
+
</VStack>
|
|
366
|
+
);
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export const ControlledTime: Story = {
|
|
371
|
+
render: () => {
|
|
372
|
+
const [time, setTime] = useState<Date | undefined>(new Date());
|
|
373
|
+
|
|
374
|
+
return (
|
|
375
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
376
|
+
<Text weight="semiBold">Controlled Time Picker</Text>
|
|
377
|
+
<DatePicker
|
|
378
|
+
label="Select Time"
|
|
379
|
+
mode="time"
|
|
380
|
+
value={time}
|
|
381
|
+
onChange={setTime}
|
|
382
|
+
/>
|
|
383
|
+
<Text size="caption" color="secondary">
|
|
384
|
+
Selected: {time ? time.toLocaleTimeString() : 'None'}
|
|
385
|
+
</Text>
|
|
386
|
+
</VStack>
|
|
387
|
+
);
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export const ControlledDateTime: Story = {
|
|
392
|
+
render: () => {
|
|
393
|
+
const [datetime, setDatetime] = useState<Date | undefined>(new Date());
|
|
394
|
+
|
|
395
|
+
return (
|
|
396
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
397
|
+
<Text weight="semiBold">Controlled DateTime Picker</Text>
|
|
398
|
+
<DatePicker
|
|
399
|
+
label="Select Date & Time"
|
|
400
|
+
mode="datetime"
|
|
401
|
+
value={datetime}
|
|
402
|
+
onChange={setDatetime}
|
|
403
|
+
/>
|
|
404
|
+
<Text size="caption" color="secondary">
|
|
405
|
+
Selected: {datetime ? datetime.toLocaleString() : 'None'}
|
|
406
|
+
</Text>
|
|
407
|
+
</VStack>
|
|
408
|
+
);
|
|
409
|
+
},
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// ============================================================================
|
|
413
|
+
// CUSTOM FORMAT
|
|
414
|
+
// ============================================================================
|
|
415
|
+
|
|
416
|
+
export const CustomFormat: Story = {
|
|
417
|
+
render: () => (
|
|
418
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
419
|
+
<Text weight="semiBold">Custom Date Format</Text>
|
|
420
|
+
<DatePicker
|
|
421
|
+
label="European Format (DD/MM/YYYY)"
|
|
422
|
+
mode="date"
|
|
423
|
+
defaultValue={new Date()}
|
|
424
|
+
formatDate={(date) => {
|
|
425
|
+
const day = date.getDate().toString().padStart(2, '0');
|
|
426
|
+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
427
|
+
const year = date.getFullYear();
|
|
428
|
+
return `${day}/${month}/${year}`;
|
|
429
|
+
}}
|
|
430
|
+
/>
|
|
431
|
+
<DatePicker
|
|
432
|
+
label="Long Format"
|
|
433
|
+
mode="date"
|
|
434
|
+
defaultValue={new Date()}
|
|
435
|
+
formatDate={(date) => {
|
|
436
|
+
return date.toLocaleDateString('en-US', {
|
|
437
|
+
weekday: 'long',
|
|
438
|
+
year: 'numeric',
|
|
439
|
+
month: 'long',
|
|
440
|
+
day: 'numeric',
|
|
441
|
+
});
|
|
442
|
+
}}
|
|
443
|
+
/>
|
|
444
|
+
<DatePicker
|
|
445
|
+
label="ISO Format"
|
|
446
|
+
mode="date"
|
|
447
|
+
defaultValue={new Date()}
|
|
448
|
+
formatDate={(date) => date.toISOString().split('T')[0]}
|
|
449
|
+
/>
|
|
450
|
+
</VStack>
|
|
451
|
+
),
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
// ============================================================================
|
|
455
|
+
// FORM EXAMPLES
|
|
456
|
+
// ============================================================================
|
|
457
|
+
|
|
458
|
+
export const BookingForm: Story = {
|
|
459
|
+
render: () => {
|
|
460
|
+
const [checkIn, setCheckIn] = useState<Date | undefined>();
|
|
461
|
+
const [checkOut, setCheckOut] = useState<Date | undefined>();
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
465
|
+
<Text weight="semiBold">Hotel Booking</Text>
|
|
466
|
+
<DatePicker
|
|
467
|
+
label="Check-in Date"
|
|
468
|
+
mode="date"
|
|
469
|
+
value={checkIn}
|
|
470
|
+
onChange={setCheckIn}
|
|
471
|
+
minDate={new Date()}
|
|
472
|
+
isRequired
|
|
473
|
+
placeholder="Select check-in date"
|
|
474
|
+
/>
|
|
475
|
+
<DatePicker
|
|
476
|
+
label="Check-out Date"
|
|
477
|
+
mode="date"
|
|
478
|
+
value={checkOut}
|
|
479
|
+
onChange={setCheckOut}
|
|
480
|
+
minDate={checkIn || new Date()}
|
|
481
|
+
isRequired
|
|
482
|
+
placeholder="Select check-out date"
|
|
483
|
+
isDisabled={!checkIn}
|
|
484
|
+
helperText={!checkIn ? 'Select check-in date first' : undefined}
|
|
485
|
+
/>
|
|
486
|
+
</VStack>
|
|
487
|
+
);
|
|
488
|
+
},
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export const AppointmentForm: Story = {
|
|
492
|
+
render: () => {
|
|
493
|
+
const [appointmentDate, setAppointmentDate] = useState<Date | undefined>();
|
|
494
|
+
const [appointmentTime, setAppointmentTime] = useState<Date | undefined>();
|
|
495
|
+
|
|
496
|
+
return (
|
|
497
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
498
|
+
<Text weight="semiBold">Schedule Appointment</Text>
|
|
499
|
+
<DatePicker
|
|
500
|
+
label="Appointment Date"
|
|
501
|
+
mode="date"
|
|
502
|
+
value={appointmentDate}
|
|
503
|
+
onChange={setAppointmentDate}
|
|
504
|
+
minDate={new Date()}
|
|
505
|
+
isRequired
|
|
506
|
+
/>
|
|
507
|
+
<DatePicker
|
|
508
|
+
label="Appointment Time"
|
|
509
|
+
mode="time"
|
|
510
|
+
value={appointmentTime}
|
|
511
|
+
onChange={setAppointmentTime}
|
|
512
|
+
isRequired
|
|
513
|
+
isDisabled={!appointmentDate}
|
|
514
|
+
/>
|
|
515
|
+
{appointmentDate && appointmentTime && (
|
|
516
|
+
<Text size="caption" color="secondary">
|
|
517
|
+
Appointment scheduled for:{'\n'}
|
|
518
|
+
{appointmentDate.toLocaleDateString()} at {appointmentTime.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
|
|
519
|
+
</Text>
|
|
520
|
+
)}
|
|
521
|
+
</VStack>
|
|
522
|
+
);
|
|
523
|
+
},
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
export const EventForm: Story = {
|
|
527
|
+
render: () => {
|
|
528
|
+
const [startDateTime, setStartDateTime] = useState<Date | undefined>();
|
|
529
|
+
const [endDateTime, setEndDateTime] = useState<Date | undefined>();
|
|
530
|
+
|
|
531
|
+
return (
|
|
532
|
+
<VStack space={16} style={{ width: 300 }}>
|
|
533
|
+
<Text weight="semiBold">Create Event</Text>
|
|
534
|
+
<DatePicker
|
|
535
|
+
label="Start Date & Time"
|
|
536
|
+
mode="datetime"
|
|
537
|
+
value={startDateTime}
|
|
538
|
+
onChange={setStartDateTime}
|
|
539
|
+
minDate={new Date()}
|
|
540
|
+
isRequired
|
|
541
|
+
/>
|
|
542
|
+
<DatePicker
|
|
543
|
+
label="End Date & Time"
|
|
544
|
+
mode="datetime"
|
|
545
|
+
value={endDateTime}
|
|
546
|
+
onChange={setEndDateTime}
|
|
547
|
+
minDate={startDateTime || new Date()}
|
|
548
|
+
isRequired
|
|
549
|
+
isDisabled={!startDateTime}
|
|
550
|
+
/>
|
|
551
|
+
</VStack>
|
|
552
|
+
);
|
|
553
|
+
},
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// ============================================================================
|
|
557
|
+
// ALL MODES COMPARISON
|
|
558
|
+
// ============================================================================
|
|
559
|
+
|
|
560
|
+
export const AllModes: Story = {
|
|
561
|
+
render: () => (
|
|
562
|
+
<VStack space={24} style={{ width: 400 }}>
|
|
563
|
+
<Text weight="semiBold">All DatePicker Modes</Text>
|
|
564
|
+
|
|
565
|
+
<VStack space={8}>
|
|
566
|
+
<Text size="caption" weight="medium">Date Only</Text>
|
|
567
|
+
<DatePicker
|
|
568
|
+
mode="date"
|
|
569
|
+
placeholder="Select date..."
|
|
570
|
+
defaultValue={new Date()}
|
|
571
|
+
/>
|
|
572
|
+
</VStack>
|
|
573
|
+
|
|
574
|
+
<VStack space={8}>
|
|
575
|
+
<Text size="caption" weight="medium">Time Only</Text>
|
|
576
|
+
<DatePicker
|
|
577
|
+
mode="time"
|
|
578
|
+
placeholder="Select time..."
|
|
579
|
+
defaultValue={new Date()}
|
|
580
|
+
/>
|
|
581
|
+
</VStack>
|
|
582
|
+
|
|
583
|
+
<VStack space={8}>
|
|
584
|
+
<Text size="caption" weight="medium">Date & Time (Side by Side)</Text>
|
|
585
|
+
<DatePicker
|
|
586
|
+
mode="datetime"
|
|
587
|
+
placeholder="Select date & time..."
|
|
588
|
+
defaultValue={new Date()}
|
|
589
|
+
/>
|
|
590
|
+
</VStack>
|
|
591
|
+
</VStack>
|
|
592
|
+
),
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
export const DateTimeWithoutNowButton: Story = {
|
|
596
|
+
render: () => (
|
|
597
|
+
<VStack space={16} style={{ width: 400 }}>
|
|
598
|
+
<Text weight="semiBold">DateTime without Now Button</Text>
|
|
599
|
+
<DatePicker
|
|
600
|
+
label="Select Date & Time"
|
|
601
|
+
mode="datetime"
|
|
602
|
+
showNowButton={false}
|
|
603
|
+
placeholder="Choose date and time..."
|
|
604
|
+
/>
|
|
605
|
+
</VStack>
|
|
606
|
+
),
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
export const DateTime24Hour: Story = {
|
|
610
|
+
render: () => (
|
|
611
|
+
<VStack space={16} style={{ width: 400 }}>
|
|
612
|
+
<Text weight="semiBold">DateTime with 24-Hour Format</Text>
|
|
613
|
+
<DatePicker
|
|
614
|
+
label="Select Date & Time"
|
|
615
|
+
mode="datetime"
|
|
616
|
+
use24HourFormat={true}
|
|
617
|
+
placeholder="Choose date and time..."
|
|
618
|
+
helperText="Time displayed in 24-hour format"
|
|
619
|
+
/>
|
|
620
|
+
</VStack>
|
|
621
|
+
),
|
|
622
|
+
};
|
|
623
|
+
|