@shohojdhara/atomix 0.3.14 → 0.3.15
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/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
2
3
|
import { useState } from 'react';
|
|
3
4
|
import DatePicker from './DatePicker';
|
|
4
5
|
import { DateRange } from './types';
|
|
@@ -12,35 +13,188 @@ const meta = {
|
|
|
12
13
|
layout: 'padded',
|
|
13
14
|
docs: {
|
|
14
15
|
description: {
|
|
15
|
-
component:
|
|
16
|
-
|
|
16
|
+
component: `
|
|
17
|
+
# DatePicker
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
DatePicker provides a user-friendly interface for selecting dates or date ranges. It supports single date selection, date range selection, custom date formatting, and various display options. DatePickers are essential for forms requiring date input and provide calendar-based selection with keyboard navigation.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- Single date and date range selection
|
|
26
|
+
- Custom date formatting
|
|
27
|
+
- Minimum and maximum date constraints
|
|
28
|
+
- Inline and pop-up display modes
|
|
29
|
+
- Glass morphism effect option
|
|
30
|
+
- Week number display
|
|
31
|
+
- Today button option
|
|
32
|
+
- Clearable selection
|
|
33
|
+
- Read-only mode
|
|
34
|
+
- Multiple size options
|
|
35
|
+
|
|
36
|
+
## Accessibility
|
|
37
|
+
|
|
38
|
+
- Keyboard support: Navigate calendar with arrow keys, select with Enter
|
|
39
|
+
- Screen reader: Date selection and calendar navigation announced properly
|
|
40
|
+
- ARIA support: Roles and properties for calendar components
|
|
41
|
+
- Focus management: Maintains focus within the calendar controls
|
|
42
|
+
|
|
43
|
+
## Usage Examples
|
|
44
|
+
|
|
45
|
+
### Basic Usage
|
|
46
|
+
|
|
47
|
+
\`\`\`tsx
|
|
48
|
+
<DatePicker
|
|
49
|
+
placeholder="Select date..."
|
|
50
|
+
value={date}
|
|
51
|
+
onChange={setDate}
|
|
52
|
+
/>
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
### Range Selection
|
|
56
|
+
|
|
57
|
+
\`\`\`tsx
|
|
58
|
+
<DatePicker
|
|
59
|
+
selectionMode="range"
|
|
60
|
+
value={range}
|
|
61
|
+
onChange={setRange}
|
|
62
|
+
/>
|
|
63
|
+
\`\`\`
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### Props
|
|
68
|
+
|
|
69
|
+
| Prop | Type | Default | Description |
|
|
70
|
+
| ---- | ---- | ------- | ----------- |
|
|
71
|
+
| value | Date \\| DateRange \\| null | null | Selected date value or range |
|
|
72
|
+
| selectionMode | 'single' \\| 'range' | 'single' | Selection mode - single date or date range |
|
|
73
|
+
| minDate | Date | - | Minimum selectable date |
|
|
74
|
+
| maxDate | Date | - | Maximum selectable date |
|
|
75
|
+
| format | string | 'MM/dd/yyyy' | Date format string |
|
|
76
|
+
| placeholder | string | 'Select date...' | Placeholder text |
|
|
77
|
+
| disabled | boolean | false | Whether the date picker is disabled |
|
|
78
|
+
| readOnly | boolean | false | Whether the date picker is read-only |
|
|
79
|
+
| clearable | boolean | false | Whether the date can be cleared |
|
|
80
|
+
| showTodayButton | boolean | false | Whether to show a "Today" button |
|
|
81
|
+
| showWeekNumbers | boolean | false | Whether to show week numbers |
|
|
82
|
+
| inline | boolean | false | Whether to display inline (always visible) |
|
|
83
|
+
| size | 'sm' \\| 'md' \\| 'lg' | 'md' | Size of the date picker |
|
|
84
|
+
| placement | Placement | 'bottom-start' | Position of the calendar dropdown |
|
|
85
|
+
| glass | boolean | false | Apply glass morphism effect to the calendar dropdown |
|
|
86
|
+
| onChange | (value: Date \\| DateRange) => void | - | Callback when date selection changes |
|
|
87
|
+
`,
|
|
17
88
|
},
|
|
18
89
|
},
|
|
19
90
|
},
|
|
20
91
|
tags: ['autodocs'],
|
|
21
92
|
argTypes: {
|
|
22
|
-
value: {
|
|
23
|
-
|
|
24
|
-
|
|
93
|
+
value: {
|
|
94
|
+
control: 'date',
|
|
95
|
+
description: 'Selected date value',
|
|
96
|
+
table: {
|
|
97
|
+
type: { summary: 'Date | DateRange | null' },
|
|
98
|
+
defaultValue: { summary: 'null' },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
25
101
|
selectionMode: {
|
|
26
102
|
control: { type: 'radio' },
|
|
27
103
|
options: ['single', 'range'],
|
|
28
104
|
description: 'Selection mode - single date or date range',
|
|
105
|
+
table: {
|
|
106
|
+
type: { summary: '"single" | "range"' },
|
|
107
|
+
defaultValue: { summary: 'single' },
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
minDate: {
|
|
111
|
+
control: 'date',
|
|
112
|
+
description: 'Minimum selectable date',
|
|
113
|
+
table: {
|
|
114
|
+
type: { summary: 'Date' },
|
|
115
|
+
defaultValue: { summary: '-' },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
maxDate: {
|
|
119
|
+
control: 'date',
|
|
120
|
+
description: 'Maximum selectable date',
|
|
121
|
+
table: {
|
|
122
|
+
type: { summary: 'Date' },
|
|
123
|
+
defaultValue: { summary: '-' },
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
format: {
|
|
127
|
+
control: 'text',
|
|
128
|
+
description: 'Date format string',
|
|
129
|
+
table: {
|
|
130
|
+
type: { summary: 'string' },
|
|
131
|
+
defaultValue: { summary: 'MM/dd/yyyy' },
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
placeholder: {
|
|
135
|
+
control: 'text',
|
|
136
|
+
description: 'Placeholder text',
|
|
137
|
+
table: {
|
|
138
|
+
type: { summary: 'string' },
|
|
139
|
+
defaultValue: { summary: 'Select date...' },
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
disabled: {
|
|
143
|
+
control: 'boolean',
|
|
144
|
+
description: 'Whether the date picker is disabled',
|
|
145
|
+
table: {
|
|
146
|
+
type: { summary: 'boolean' },
|
|
147
|
+
defaultValue: { summary: false },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
readOnly: {
|
|
151
|
+
control: 'boolean',
|
|
152
|
+
description: 'Whether the date picker is read-only',
|
|
153
|
+
table: {
|
|
154
|
+
type: { summary: 'boolean' },
|
|
155
|
+
defaultValue: { summary: false },
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
clearable: {
|
|
159
|
+
control: 'boolean',
|
|
160
|
+
description: 'Whether the date can be cleared',
|
|
161
|
+
table: {
|
|
162
|
+
type: { summary: 'boolean' },
|
|
163
|
+
defaultValue: { summary: false },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
showTodayButton: {
|
|
167
|
+
control: 'boolean',
|
|
168
|
+
description: 'Whether to show a "Today" button',
|
|
169
|
+
table: {
|
|
170
|
+
type: { summary: 'boolean' },
|
|
171
|
+
defaultValue: { summary: false },
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
showWeekNumbers: {
|
|
175
|
+
control: 'boolean',
|
|
176
|
+
description: 'Whether to show week numbers',
|
|
177
|
+
table: {
|
|
178
|
+
type: { summary: 'boolean' },
|
|
179
|
+
defaultValue: { summary: false },
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
inline: {
|
|
183
|
+
control: 'boolean',
|
|
184
|
+
description: 'Whether to display inline (always visible)',
|
|
185
|
+
table: {
|
|
186
|
+
type: { summary: 'boolean' },
|
|
187
|
+
defaultValue: { summary: false },
|
|
188
|
+
},
|
|
29
189
|
},
|
|
30
|
-
minDate: { control: 'date', description: 'Minimum selectable date' },
|
|
31
|
-
maxDate: { control: 'date', description: 'Maximum selectable date' },
|
|
32
|
-
format: { control: 'text', description: 'Date format string' },
|
|
33
|
-
placeholder: { control: 'text', description: 'Placeholder text' },
|
|
34
|
-
disabled: { control: 'boolean', description: 'Whether the date picker is disabled' },
|
|
35
|
-
readOnly: { control: 'boolean', description: 'Whether the date picker is read-only' },
|
|
36
|
-
clearable: { control: 'boolean', description: 'Whether the date can be cleared' },
|
|
37
|
-
showTodayButton: { control: 'boolean', description: 'Whether to show a "Today" button' },
|
|
38
|
-
showWeekNumbers: { control: 'boolean', description: 'Whether to show week numbers' },
|
|
39
|
-
inline: { control: 'boolean', description: 'Whether to display inline (always visible)' },
|
|
40
190
|
size: {
|
|
41
191
|
control: { type: 'select' },
|
|
42
192
|
options: SIZES,
|
|
43
193
|
description: 'Size of the date picker',
|
|
194
|
+
table: {
|
|
195
|
+
type: { summary: '"sm" | "md" | "lg"' },
|
|
196
|
+
defaultValue: { summary: 'md' },
|
|
197
|
+
},
|
|
44
198
|
},
|
|
45
199
|
placement: {
|
|
46
200
|
control: { type: 'select' },
|
|
@@ -54,10 +208,23 @@ const meta = {
|
|
|
54
208
|
'right-start',
|
|
55
209
|
'right-end',
|
|
56
210
|
],
|
|
211
|
+
description: 'Position of the calendar dropdown',
|
|
212
|
+
table: {
|
|
213
|
+
type: { summary: 'Placement' },
|
|
214
|
+
defaultValue: { summary: 'bottom-start' },
|
|
215
|
+
},
|
|
57
216
|
},
|
|
58
217
|
glass: {
|
|
59
218
|
control: { type: 'boolean' },
|
|
60
219
|
description: 'Apply glass morphism effect to the calendar dropdown',
|
|
220
|
+
table: {
|
|
221
|
+
type: { summary: 'boolean' },
|
|
222
|
+
defaultValue: { summary: false },
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
onChange: {
|
|
226
|
+
action: 'date changed',
|
|
227
|
+
description: 'Callback when date selection changes',
|
|
61
228
|
},
|
|
62
229
|
},
|
|
63
230
|
} satisfies Meta<typeof DatePicker>;
|
|
@@ -65,7 +232,7 @@ const meta = {
|
|
|
65
232
|
export default meta;
|
|
66
233
|
type Story = StoryObj<typeof meta>;
|
|
67
234
|
|
|
68
|
-
export const
|
|
235
|
+
export const BasicUsage: Story = {
|
|
69
236
|
args: {
|
|
70
237
|
placeholder: 'Select date...',
|
|
71
238
|
format: 'MM/dd/yyyy',
|
|
@@ -79,11 +246,18 @@ export const Default: Story = {
|
|
|
79
246
|
render: args => {
|
|
80
247
|
const [date, setDate] = useState<Date | null>(null);
|
|
81
248
|
return (
|
|
82
|
-
<div
|
|
249
|
+
<div className="u-w-xs u-mt-20 u-mx-auto u-flex u-items-center">
|
|
83
250
|
<DatePicker {...args} value={date} onChange={setDate} />
|
|
84
251
|
</div>
|
|
85
252
|
);
|
|
86
253
|
},
|
|
254
|
+
parameters: {
|
|
255
|
+
docs: {
|
|
256
|
+
description: {
|
|
257
|
+
story: 'Basic DatePicker with default configuration.',
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
87
261
|
};
|
|
88
262
|
|
|
89
263
|
export const WithInitialDate: Story = {
|
|
@@ -94,26 +268,17 @@ export const WithInitialDate: Story = {
|
|
|
94
268
|
const initialDate = new Date();
|
|
95
269
|
const [date, setDate] = useState<Date | null>(initialDate);
|
|
96
270
|
return (
|
|
97
|
-
<div
|
|
271
|
+
<div className="u-w-xs u-mt-20 u-mx-auto u-flex u-items-center">
|
|
98
272
|
<DatePicker {...args} value={date} onChange={setDate} />
|
|
99
273
|
</div>
|
|
100
274
|
);
|
|
101
275
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
selectionMode: 'single',
|
|
109
|
-
},
|
|
110
|
-
render: args => {
|
|
111
|
-
const [date, setDate] = useState<Date | null>(new Date());
|
|
112
|
-
return (
|
|
113
|
-
<div style={{ width: '300px' }} className="u-mt-20 u-mx-auto u-items-center">
|
|
114
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
115
|
-
</div>
|
|
116
|
-
);
|
|
276
|
+
parameters: {
|
|
277
|
+
docs: {
|
|
278
|
+
description: {
|
|
279
|
+
story: 'DatePicker with an initial date value.',
|
|
280
|
+
},
|
|
281
|
+
},
|
|
117
282
|
},
|
|
118
283
|
};
|
|
119
284
|
|
|
@@ -121,1117 +286,211 @@ export const DateRangeSelection: Story = {
|
|
|
121
286
|
args: {
|
|
122
287
|
selectionMode: 'range',
|
|
123
288
|
placeholder: 'Select date range...',
|
|
289
|
+
format: 'MM/dd/yyyy',
|
|
290
|
+
clearable: true,
|
|
291
|
+
showTodayButton: false,
|
|
292
|
+
size: 'md',
|
|
293
|
+
placement: 'bottom-start',
|
|
124
294
|
},
|
|
125
295
|
render: args => {
|
|
126
|
-
const [
|
|
127
|
-
startDate: null,
|
|
128
|
-
endDate: null,
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
const handleRangeChange = (range: DateRange) => {
|
|
132
|
-
setDateRange(range);
|
|
133
|
-
};
|
|
134
|
-
|
|
296
|
+
const [range, setRange] = useState<DateRange | null>(null);
|
|
135
297
|
return (
|
|
136
|
-
<div
|
|
137
|
-
|
|
138
|
-
className="u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center"
|
|
139
|
-
>
|
|
140
|
-
<DatePicker
|
|
141
|
-
{...args}
|
|
142
|
-
startDate={dateRange.startDate}
|
|
143
|
-
endDate={dateRange.endDate}
|
|
144
|
-
onRangeChange={handleRangeChange}
|
|
145
|
-
/>
|
|
146
|
-
<div
|
|
147
|
-
style={{
|
|
148
|
-
marginTop: '1rem',
|
|
149
|
-
padding: '0.75rem',
|
|
150
|
-
backgroundColor: '#f5f5f5',
|
|
151
|
-
borderRadius: '0.25rem',
|
|
152
|
-
}}
|
|
153
|
-
>
|
|
154
|
-
<p>
|
|
155
|
-
Selected range:{' '}
|
|
156
|
-
{dateRange.startDate && dateRange.endDate
|
|
157
|
-
? formatDateRange(dateRange.startDate, dateRange.endDate, 'MM/dd/yyyy')
|
|
158
|
-
: dateRange.startDate
|
|
159
|
-
? formatDateRange(dateRange.startDate, null, 'MM/dd/yyyy')
|
|
160
|
-
: 'No date selected'}
|
|
161
|
-
</p>
|
|
162
|
-
</div>
|
|
298
|
+
<div className="u-w-xs u-mt-20 u-mx-auto u-flex u-items-center">
|
|
299
|
+
<DatePicker {...args} value={range} onChange={setRange} />
|
|
163
300
|
</div>
|
|
164
301
|
);
|
|
165
302
|
},
|
|
303
|
+
parameters: {
|
|
304
|
+
docs: {
|
|
305
|
+
description: {
|
|
306
|
+
story: 'DatePicker in range selection mode.',
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
166
310
|
};
|
|
167
311
|
|
|
168
|
-
|
|
169
|
-
export const GlassEffectBasic: Story = {
|
|
312
|
+
export const WithGlassEffect: Story = {
|
|
170
313
|
args: {
|
|
171
314
|
placeholder: 'Select date...',
|
|
315
|
+
format: 'MM/dd/yyyy',
|
|
172
316
|
clearable: true,
|
|
173
317
|
showTodayButton: true,
|
|
174
|
-
selectionMode: 'single',
|
|
175
318
|
glass: true,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const [date, setDate] = useState<Date | null>(null);
|
|
179
|
-
return (
|
|
180
|
-
<div
|
|
181
|
-
style={{
|
|
182
|
-
background: 'url(https://images.unsplash.com/photo-1518837695005-2083093ee35b?w=1920)',
|
|
183
|
-
backgroundSize: 'cover',
|
|
184
|
-
backgroundPosition: 'center',
|
|
185
|
-
padding: '3rem',
|
|
186
|
-
borderRadius: '12px',
|
|
187
|
-
minHeight: '95vh',
|
|
188
|
-
display: 'flex',
|
|
189
|
-
flexDirection: 'column',
|
|
190
|
-
alignItems: 'center',
|
|
191
|
-
justifyContent: 'center',
|
|
192
|
-
gap: '2rem',
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
<div
|
|
196
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
197
|
-
>
|
|
198
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Glass DatePicker</h3>
|
|
199
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
|
|
200
|
-
DatePicker with glass morphism effect
|
|
201
|
-
</p>
|
|
202
|
-
</div>
|
|
203
|
-
<div style={{ width: '300px' }}>
|
|
204
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
);
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// Glass Mode Variants - Standard
|
|
212
|
-
export const GlassModeStandard: Story = {
|
|
213
|
-
args: {
|
|
214
|
-
placeholder: 'Select date...',
|
|
319
|
+
size: 'md',
|
|
320
|
+
placement: 'bottom-start',
|
|
215
321
|
selectionMode: 'single',
|
|
216
|
-
glass: {
|
|
217
|
-
mode: 'standard',
|
|
218
|
-
displacementScale: 50,
|
|
219
|
-
blurAmount: 3,
|
|
220
|
-
saturation: 160,
|
|
221
|
-
aberrationIntensity: 0,
|
|
222
|
-
overLight: false,
|
|
223
|
-
elasticity: 0,
|
|
224
|
-
} as any,
|
|
225
322
|
},
|
|
226
323
|
render: args => {
|
|
227
324
|
const [date, setDate] = useState<Date | null>(null);
|
|
228
325
|
return (
|
|
229
|
-
<div
|
|
230
|
-
|
|
231
|
-
background: 'url(https://images.unsplash.com/photo-1518837695005-2083093ee35b?w=1920)',
|
|
232
|
-
backgroundSize: 'cover',
|
|
233
|
-
backgroundPosition: 'center',
|
|
234
|
-
padding: '3rem',
|
|
235
|
-
borderRadius: '12px',
|
|
236
|
-
minHeight: '95vh',
|
|
237
|
-
display: 'flex',
|
|
238
|
-
flexDirection: 'column',
|
|
239
|
-
alignItems: 'center',
|
|
240
|
-
justifyContent: 'center',
|
|
241
|
-
gap: '2rem',
|
|
242
|
-
}}
|
|
243
|
-
>
|
|
244
|
-
<div
|
|
245
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
246
|
-
>
|
|
247
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Standard Glass Mode</h3>
|
|
248
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
|
|
249
|
-
Classic glass morphism with blur and displacement
|
|
250
|
-
</p>
|
|
251
|
-
</div>
|
|
252
|
-
<div style={{ width: '300px' }}>
|
|
253
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
254
|
-
</div>
|
|
326
|
+
<div className="u-w-xs u-p-8 u-bg-gradient-to-br u-from-indigo-500 u-via-purple-500 u-to-pink-500 u-min-h-80 u-flex u-items-center u-justify-center u-mt-20 u-mx-auto u-flex u-items-center">
|
|
327
|
+
<DatePicker {...args} value={date} onChange={setDate} />
|
|
255
328
|
</div>
|
|
256
329
|
);
|
|
257
330
|
},
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
selectionMode: 'single',
|
|
265
|
-
glass: {
|
|
266
|
-
mode: 'polar',
|
|
267
|
-
displacementScale: 60,
|
|
268
|
-
blurAmount: 2.5,
|
|
269
|
-
saturation: 180,
|
|
270
|
-
aberrationIntensity: 2,
|
|
271
|
-
} as any,
|
|
272
|
-
},
|
|
273
|
-
render: args => {
|
|
274
|
-
const [date, setDate] = useState<Date | null>(null);
|
|
275
|
-
return (
|
|
276
|
-
<div
|
|
277
|
-
style={{
|
|
278
|
-
background: 'url(https://images.unsplash.com/photo-1557683316-973673baf926?w=1920)',
|
|
279
|
-
backgroundSize: 'cover',
|
|
280
|
-
backgroundPosition: 'center',
|
|
281
|
-
padding: '3rem',
|
|
282
|
-
borderRadius: '12px',
|
|
283
|
-
minHeight: '95vh',
|
|
284
|
-
display: 'flex',
|
|
285
|
-
flexDirection: 'column',
|
|
286
|
-
alignItems: 'center',
|
|
287
|
-
justifyContent: 'center',
|
|
288
|
-
gap: '2rem',
|
|
289
|
-
}}
|
|
290
|
-
>
|
|
291
|
-
<div
|
|
292
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
293
|
-
>
|
|
294
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Polar Glass Mode</h3>
|
|
295
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>Radial distortion effect from center</p>
|
|
296
|
-
</div>
|
|
297
|
-
<div style={{ width: '300px' }}>
|
|
298
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
299
|
-
</div>
|
|
300
|
-
</div>
|
|
301
|
-
);
|
|
331
|
+
parameters: {
|
|
332
|
+
docs: {
|
|
333
|
+
description: {
|
|
334
|
+
story: 'DatePicker with glass morphism effect applied.',
|
|
335
|
+
},
|
|
336
|
+
},
|
|
302
337
|
},
|
|
303
338
|
};
|
|
304
339
|
|
|
305
|
-
|
|
306
|
-
export const GlassModeProminent: Story = {
|
|
340
|
+
export const WithMinMaxDates: Story = {
|
|
307
341
|
args: {
|
|
308
342
|
placeholder: 'Select date...',
|
|
343
|
+
format: 'MM/dd/yyyy',
|
|
344
|
+
clearable: true,
|
|
345
|
+
showTodayButton: true,
|
|
346
|
+
size: 'md',
|
|
309
347
|
selectionMode: 'single',
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
displacementScale: 80,
|
|
313
|
-
blurAmount: 3.5,
|
|
314
|
-
saturation: 200,
|
|
315
|
-
aberrationIntensity: 3,
|
|
316
|
-
} as any,
|
|
348
|
+
minDate: new Date(new Date().getFullYear(), new Date().getMonth(), 1), // First day of current month
|
|
349
|
+
maxDate: new Date(new Date().getFullYear(), new Date().getMonth(), 15), // 15th day of current month
|
|
317
350
|
},
|
|
318
351
|
render: args => {
|
|
319
352
|
const [date, setDate] = useState<Date | null>(null);
|
|
320
353
|
return (
|
|
321
|
-
<div
|
|
322
|
-
|
|
323
|
-
background: 'url(https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=1920)',
|
|
324
|
-
backgroundSize: 'cover',
|
|
325
|
-
backgroundPosition: 'center',
|
|
326
|
-
padding: '3rem',
|
|
327
|
-
borderRadius: '12px',
|
|
328
|
-
minHeight: '95vh',
|
|
329
|
-
display: 'flex',
|
|
330
|
-
flexDirection: 'column',
|
|
331
|
-
alignItems: 'center',
|
|
332
|
-
justifyContent: 'center',
|
|
333
|
-
gap: '2rem',
|
|
334
|
-
}}
|
|
335
|
-
>
|
|
336
|
-
<div
|
|
337
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
338
|
-
>
|
|
339
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Prominent Glass Mode</h3>
|
|
340
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
|
|
341
|
-
Enhanced distortion with maximum depth
|
|
342
|
-
</p>
|
|
343
|
-
</div>
|
|
344
|
-
<div style={{ width: '300px' }}>
|
|
345
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
346
|
-
</div>
|
|
354
|
+
<div className="u-w-xs u-mt-20 u-mx-auto u-flex u-items-center">
|
|
355
|
+
<DatePicker {...args} value={date} onChange={setDate} />
|
|
347
356
|
</div>
|
|
348
357
|
);
|
|
349
358
|
},
|
|
359
|
+
parameters: {
|
|
360
|
+
docs: {
|
|
361
|
+
description: {
|
|
362
|
+
story: 'DatePicker with minimum and maximum date constraints.',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
350
366
|
};
|
|
351
367
|
|
|
352
|
-
|
|
353
|
-
export const GlassModeShader: Story = {
|
|
368
|
+
export const WithWeekNumbers: Story = {
|
|
354
369
|
args: {
|
|
355
370
|
placeholder: 'Select date...',
|
|
371
|
+
format: 'MM/dd/yyyy',
|
|
372
|
+
showWeekNumbers: true,
|
|
373
|
+
size: 'md',
|
|
356
374
|
selectionMode: 'single',
|
|
357
|
-
glass: {
|
|
358
|
-
mode: 'shader',
|
|
359
|
-
shaderVariant: 'liquidGlass',
|
|
360
|
-
displacementScale: 55,
|
|
361
|
-
blurAmount: 2.8,
|
|
362
|
-
saturation: 170,
|
|
363
|
-
} as any,
|
|
364
375
|
},
|
|
365
376
|
render: args => {
|
|
366
377
|
const [date, setDate] = useState<Date | null>(null);
|
|
367
378
|
return (
|
|
368
|
-
<div
|
|
369
|
-
|
|
370
|
-
background: 'url(https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=1920)',
|
|
371
|
-
backgroundSize: 'cover',
|
|
372
|
-
backgroundPosition: 'center',
|
|
373
|
-
padding: '3rem',
|
|
374
|
-
borderRadius: '12px',
|
|
375
|
-
minHeight: '95vh',
|
|
376
|
-
display: 'flex',
|
|
377
|
-
flexDirection: 'column',
|
|
378
|
-
alignItems: 'center',
|
|
379
|
-
justifyContent: 'center',
|
|
380
|
-
gap: '2rem',
|
|
381
|
-
}}
|
|
382
|
-
>
|
|
383
|
-
<div
|
|
384
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
385
|
-
>
|
|
386
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Shader Glass Mode</h3>
|
|
387
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>GPU-accelerated liquid glass effect</p>
|
|
388
|
-
</div>
|
|
389
|
-
<div style={{ width: '300px' }}>
|
|
390
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
391
|
-
</div>
|
|
379
|
+
<div className="u-w-xs u-mt-20 u-mx-auto u-flex u-items-center">
|
|
380
|
+
<DatePicker {...args} value={date} onChange={setDate} />
|
|
392
381
|
</div>
|
|
393
382
|
);
|
|
394
383
|
},
|
|
384
|
+
parameters: {
|
|
385
|
+
docs: {
|
|
386
|
+
description: {
|
|
387
|
+
story: 'DatePicker showing week numbers in the calendar.',
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
},
|
|
395
391
|
};
|
|
396
392
|
|
|
397
|
-
|
|
398
|
-
export const AllGlassModesComparison: Story = {
|
|
393
|
+
export const DifferentSizes: Story = {
|
|
399
394
|
render: () => {
|
|
400
|
-
const [
|
|
401
|
-
const [date2, setDate2] = useState<Date | null>(null);
|
|
402
|
-
const [date3, setDate3] = useState<Date | null>(null);
|
|
403
|
-
const [date4, setDate4] = useState<Date | null>(null);
|
|
404
|
-
|
|
395
|
+
const [date, setDate] = useState<Date | null>(null);
|
|
405
396
|
return (
|
|
406
|
-
<div
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}}
|
|
416
|
-
>
|
|
417
|
-
<div style={{ maxWidth: '1400px', margin: '0 auto' }}>
|
|
418
|
-
<h2
|
|
419
|
-
style={{
|
|
420
|
-
textAlign: 'center',
|
|
421
|
-
color: 'white',
|
|
422
|
-
marginBottom: '3rem',
|
|
423
|
-
fontSize: '2rem',
|
|
424
|
-
textShadow: '0 2px 8px rgba(0,0,0,0.5)',
|
|
425
|
-
}}
|
|
426
|
-
>
|
|
427
|
-
Glass Mode DatePicker Comparison
|
|
428
|
-
</h2>
|
|
429
|
-
|
|
430
|
-
<div
|
|
431
|
-
style={{
|
|
432
|
-
display: 'grid',
|
|
433
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
|
|
434
|
-
gap: '2rem',
|
|
435
|
-
}}
|
|
436
|
-
>
|
|
437
|
-
{/* Standard Mode */}
|
|
438
|
-
<div
|
|
439
|
-
style={{
|
|
440
|
-
background: 'rgba(255,255,255,0.08)',
|
|
441
|
-
padding: '2rem',
|
|
442
|
-
borderRadius: '12px',
|
|
443
|
-
backdropFilter: 'blur(10px)',
|
|
444
|
-
textAlign: 'center',
|
|
445
|
-
}}
|
|
446
|
-
>
|
|
447
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>
|
|
448
|
-
Standard
|
|
449
|
-
</h3>
|
|
450
|
-
<p
|
|
451
|
-
style={{
|
|
452
|
-
color: 'rgba(255,255,255,0.8)',
|
|
453
|
-
fontSize: '0.875rem',
|
|
454
|
-
marginBottom: '1.5rem',
|
|
455
|
-
}}
|
|
456
|
-
>
|
|
457
|
-
Classic blur and displacement
|
|
458
|
-
</p>
|
|
459
|
-
<DatePicker
|
|
460
|
-
placeholder="Select date..."
|
|
461
|
-
value={date1}
|
|
462
|
-
onChange={setDate1}
|
|
463
|
-
glass={
|
|
464
|
-
{
|
|
465
|
-
mode: 'standard',
|
|
466
|
-
displacementScale: 50,
|
|
467
|
-
blurAmount: 3,
|
|
468
|
-
saturation: 160,
|
|
469
|
-
} as any
|
|
470
|
-
}
|
|
471
|
-
/>
|
|
472
|
-
</div>
|
|
473
|
-
|
|
474
|
-
{/* Polar Mode */}
|
|
475
|
-
<div
|
|
476
|
-
style={{
|
|
477
|
-
background: 'rgba(255,255,255,0.08)',
|
|
478
|
-
padding: '2rem',
|
|
479
|
-
borderRadius: '12px',
|
|
480
|
-
backdropFilter: 'blur(10px)',
|
|
481
|
-
textAlign: 'center',
|
|
482
|
-
}}
|
|
483
|
-
>
|
|
484
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>Polar</h3>
|
|
485
|
-
<p
|
|
486
|
-
style={{
|
|
487
|
-
color: 'rgba(255,255,255,0.8)',
|
|
488
|
-
fontSize: '0.875rem',
|
|
489
|
-
marginBottom: '1.5rem',
|
|
490
|
-
}}
|
|
491
|
-
>
|
|
492
|
-
Radial distortion effect
|
|
493
|
-
</p>
|
|
494
|
-
<DatePicker
|
|
495
|
-
placeholder="Select date..."
|
|
496
|
-
value={date2}
|
|
497
|
-
onChange={setDate2}
|
|
498
|
-
glass={
|
|
499
|
-
{
|
|
500
|
-
mode: 'polar',
|
|
501
|
-
displacementScale: 60,
|
|
502
|
-
blurAmount: 2.5,
|
|
503
|
-
saturation: 180,
|
|
504
|
-
} as any
|
|
505
|
-
}
|
|
506
|
-
/>
|
|
507
|
-
</div>
|
|
508
|
-
|
|
509
|
-
{/* Prominent Mode */}
|
|
510
|
-
<div
|
|
511
|
-
style={{
|
|
512
|
-
background: 'rgba(255,255,255,0.08)',
|
|
513
|
-
padding: '2rem',
|
|
514
|
-
borderRadius: '12px',
|
|
515
|
-
backdropFilter: 'blur(10px)',
|
|
516
|
-
textAlign: 'center',
|
|
517
|
-
}}
|
|
518
|
-
>
|
|
519
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>
|
|
520
|
-
Prominent
|
|
521
|
-
</h3>
|
|
522
|
-
<p
|
|
523
|
-
style={{
|
|
524
|
-
color: 'rgba(255,255,255,0.8)',
|
|
525
|
-
fontSize: '0.875rem',
|
|
526
|
-
marginBottom: '1.5rem',
|
|
527
|
-
}}
|
|
528
|
-
>
|
|
529
|
-
Maximum depth and distortion
|
|
530
|
-
</p>
|
|
531
|
-
<DatePicker
|
|
532
|
-
placeholder="Select date..."
|
|
533
|
-
value={date3}
|
|
534
|
-
onChange={setDate3}
|
|
535
|
-
glass={
|
|
536
|
-
{
|
|
537
|
-
mode: 'prominent',
|
|
538
|
-
displacementScale: 80,
|
|
539
|
-
blurAmount: 3.5,
|
|
540
|
-
saturation: 200,
|
|
541
|
-
} as any
|
|
542
|
-
}
|
|
543
|
-
/>
|
|
544
|
-
</div>
|
|
545
|
-
|
|
546
|
-
{/* Shader Mode */}
|
|
547
|
-
<div
|
|
548
|
-
style={{
|
|
549
|
-
background: 'rgba(255,255,255,0.08)',
|
|
550
|
-
padding: '2rem',
|
|
551
|
-
borderRadius: '12px',
|
|
552
|
-
backdropFilter: 'blur(10px)',
|
|
553
|
-
textAlign: 'center',
|
|
554
|
-
}}
|
|
555
|
-
>
|
|
556
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>Shader</h3>
|
|
557
|
-
<p
|
|
558
|
-
style={{
|
|
559
|
-
color: 'rgba(255,255,255,0.8)',
|
|
560
|
-
fontSize: '0.875rem',
|
|
561
|
-
marginBottom: '1.5rem',
|
|
562
|
-
}}
|
|
563
|
-
>
|
|
564
|
-
GPU-accelerated liquid glass
|
|
565
|
-
</p>
|
|
566
|
-
<DatePicker
|
|
567
|
-
placeholder="Select date..."
|
|
568
|
-
value={date4}
|
|
569
|
-
onChange={setDate4}
|
|
570
|
-
glass={
|
|
571
|
-
{
|
|
572
|
-
mode: 'shader',
|
|
573
|
-
shaderVariant: 'liquidGlass',
|
|
574
|
-
displacementScale: 55,
|
|
575
|
-
blurAmount: 2.8,
|
|
576
|
-
} as any
|
|
577
|
-
}
|
|
578
|
-
/>
|
|
579
|
-
</div>
|
|
580
|
-
</div>
|
|
397
|
+
<div className="u-mt-20 u-mx-auto u-flex u-flex-col u-gap-4">
|
|
398
|
+
<div className="u-w-xs">
|
|
399
|
+
<label className="u-block u-mb-2 u-text-sm u-font-medium">Small</label>
|
|
400
|
+
<DatePicker
|
|
401
|
+
value={date}
|
|
402
|
+
onChange={setDate}
|
|
403
|
+
size="sm"
|
|
404
|
+
placeholder="Select date..."
|
|
405
|
+
/>
|
|
581
406
|
</div>
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
selectionMode: 'range',
|
|
591
|
-
placeholder: 'Select date range...',
|
|
592
|
-
glass: true,
|
|
593
|
-
},
|
|
594
|
-
render: args => {
|
|
595
|
-
const [dateRange, setDateRange] = useState<DateRange>({
|
|
596
|
-
startDate: null,
|
|
597
|
-
endDate: null,
|
|
598
|
-
});
|
|
599
|
-
|
|
600
|
-
return (
|
|
601
|
-
<div
|
|
602
|
-
style={{
|
|
603
|
-
background: 'url(https://images.unsplash.com/photo-1519681393784-d120267933ba?w=1920)',
|
|
604
|
-
backgroundSize: 'cover',
|
|
605
|
-
backgroundPosition: 'center',
|
|
606
|
-
padding: '3rem',
|
|
607
|
-
borderRadius: '12px',
|
|
608
|
-
minHeight: '95vh',
|
|
609
|
-
display: 'flex',
|
|
610
|
-
flexDirection: 'column',
|
|
611
|
-
alignItems: 'center',
|
|
612
|
-
justifyContent: 'center',
|
|
613
|
-
gap: '2rem',
|
|
614
|
-
}}
|
|
615
|
-
>
|
|
616
|
-
<div
|
|
617
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
618
|
-
>
|
|
619
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Glass Range DatePicker</h3>
|
|
620
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
|
|
621
|
-
Select date ranges with glass morphism effect
|
|
622
|
-
</p>
|
|
407
|
+
<div className="u-w-xs">
|
|
408
|
+
<label className="u-block u-mb-2 u-text-sm u-font-medium">Medium</label>
|
|
409
|
+
<DatePicker
|
|
410
|
+
value={date}
|
|
411
|
+
onChange={setDate}
|
|
412
|
+
size="md"
|
|
413
|
+
placeholder="Select date..."
|
|
414
|
+
/>
|
|
623
415
|
</div>
|
|
624
|
-
<div
|
|
625
|
-
<
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
416
|
+
<div className="u-w-xs">
|
|
417
|
+
<label className="u-block u-mb-2 u-text-sm u-font-medium">Large</label>
|
|
418
|
+
<DatePicker
|
|
419
|
+
value={date}
|
|
420
|
+
onChange={setDate}
|
|
421
|
+
size="lg"
|
|
422
|
+
placeholder="Select date..."
|
|
630
423
|
/>
|
|
631
|
-
{dateRange.startDate && dateRange.endDate && (
|
|
632
|
-
<div
|
|
633
|
-
style={{
|
|
634
|
-
marginTop: '1rem',
|
|
635
|
-
padding: '1rem',
|
|
636
|
-
background: 'rgba(255,255,255,0.1)',
|
|
637
|
-
backdropFilter: 'blur(10px)',
|
|
638
|
-
borderRadius: '8px',
|
|
639
|
-
color: 'white',
|
|
640
|
-
textAlign: 'center',
|
|
641
|
-
}}
|
|
642
|
-
>
|
|
643
|
-
<p style={{ fontSize: '0.875rem' }}>
|
|
644
|
-
Range: {formatDateRange(dateRange.startDate, dateRange.endDate, 'MM/dd/yyyy')}
|
|
645
|
-
</p>
|
|
646
|
-
</div>
|
|
647
|
-
)}
|
|
648
424
|
</div>
|
|
649
425
|
</div>
|
|
650
426
|
);
|
|
651
427
|
},
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
showWeekNumbers: true,
|
|
659
|
-
selectionMode: 'single',
|
|
660
|
-
glass: {
|
|
661
|
-
mode: 'polar',
|
|
662
|
-
displacementScale: 60,
|
|
663
|
-
blurAmount: 2.5,
|
|
664
|
-
} as any,
|
|
665
|
-
},
|
|
666
|
-
render: args => {
|
|
667
|
-
const [date, setDate] = useState<Date | null>(new Date());
|
|
668
|
-
return (
|
|
669
|
-
<div
|
|
670
|
-
style={{
|
|
671
|
-
background: 'url(https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=1920)',
|
|
672
|
-
backgroundSize: 'cover',
|
|
673
|
-
backgroundPosition: 'center',
|
|
674
|
-
padding: '3rem',
|
|
675
|
-
borderRadius: '12px',
|
|
676
|
-
minHeight: '95vh',
|
|
677
|
-
display: 'flex',
|
|
678
|
-
flexDirection: 'column',
|
|
679
|
-
alignItems: 'center',
|
|
680
|
-
justifyContent: 'center',
|
|
681
|
-
gap: '2rem',
|
|
682
|
-
}}
|
|
683
|
-
>
|
|
684
|
-
<div
|
|
685
|
-
style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}
|
|
686
|
-
>
|
|
687
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Inline Glass DatePicker</h3>
|
|
688
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
|
|
689
|
-
Always visible with glass morphism effect
|
|
690
|
-
</p>
|
|
691
|
-
</div>
|
|
692
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
693
|
-
</div>
|
|
694
|
-
);
|
|
428
|
+
parameters: {
|
|
429
|
+
docs: {
|
|
430
|
+
description: {
|
|
431
|
+
story: 'DatePicker available in different sizes.',
|
|
432
|
+
},
|
|
433
|
+
},
|
|
695
434
|
},
|
|
696
435
|
};
|
|
697
436
|
|
|
698
|
-
|
|
699
|
-
export const GlassShowcase: Story = {
|
|
437
|
+
export const DisabledAndReadOnly: Story = {
|
|
700
438
|
render: () => {
|
|
701
|
-
const [
|
|
702
|
-
const [date2, setDate2] = useState<Date | null>(null);
|
|
703
|
-
const [dateRange, setDateRange] = useState<DateRange>({
|
|
704
|
-
startDate: null,
|
|
705
|
-
endDate: null,
|
|
706
|
-
});
|
|
707
|
-
|
|
439
|
+
const [date, setDate] = useState<Date | null>(new Date());
|
|
708
440
|
return (
|
|
709
|
-
<div
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
}}
|
|
719
|
-
>
|
|
720
|
-
<div style={{ maxWidth: '1400px', margin: '0 auto' }}>
|
|
721
|
-
<h2
|
|
722
|
-
style={{
|
|
723
|
-
textAlign: 'center',
|
|
724
|
-
color: 'white',
|
|
725
|
-
marginBottom: '3rem',
|
|
726
|
-
fontSize: '2rem',
|
|
727
|
-
textShadow: '0 2px 8px rgba(0,0,0,0.5)',
|
|
728
|
-
}}
|
|
729
|
-
>
|
|
730
|
-
Glass DatePicker Showcase
|
|
731
|
-
</h2>
|
|
732
|
-
|
|
733
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '3rem' }}>
|
|
734
|
-
{/* Single Date Selection */}
|
|
735
|
-
<div
|
|
736
|
-
style={{
|
|
737
|
-
background: 'rgba(255,255,255,0.08)',
|
|
738
|
-
padding: '2rem',
|
|
739
|
-
borderRadius: '12px',
|
|
740
|
-
backdropFilter: 'blur(10px)',
|
|
741
|
-
}}
|
|
742
|
-
>
|
|
743
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>Single Date Selection</h3>
|
|
744
|
-
<div
|
|
745
|
-
style={{ display: 'flex', gap: '2rem', flexWrap: 'wrap', justifyContent: 'center' }}
|
|
746
|
-
>
|
|
747
|
-
<div style={{ flex: '1 1 250px', minWidth: '250px' }}>
|
|
748
|
-
<label style={{ color: 'white', display: 'block', marginBottom: '0.5rem' }}>
|
|
749
|
-
Standard Glass
|
|
750
|
-
</label>
|
|
751
|
-
<DatePicker
|
|
752
|
-
placeholder="Select date..."
|
|
753
|
-
value={date1}
|
|
754
|
-
onChange={setDate1}
|
|
755
|
-
glass={true}
|
|
756
|
-
/>
|
|
757
|
-
</div>
|
|
758
|
-
<div style={{ flex: '1 1 250px', minWidth: '250px' }}>
|
|
759
|
-
<label style={{ color: 'white', display: 'block', marginBottom: '0.5rem' }}>
|
|
760
|
-
Polar Glass
|
|
761
|
-
</label>
|
|
762
|
-
<DatePicker
|
|
763
|
-
placeholder="Select date..."
|
|
764
|
-
value={date2}
|
|
765
|
-
onChange={setDate2}
|
|
766
|
-
glass={
|
|
767
|
-
{
|
|
768
|
-
mode: 'polar',
|
|
769
|
-
displacementScale: 60,
|
|
770
|
-
} as any
|
|
771
|
-
}
|
|
772
|
-
/>
|
|
773
|
-
</div>
|
|
774
|
-
</div>
|
|
775
|
-
</div>
|
|
776
|
-
|
|
777
|
-
{/* Range Selection */}
|
|
778
|
-
<div
|
|
779
|
-
style={{
|
|
780
|
-
background: 'rgba(255,255,255,0.08)',
|
|
781
|
-
padding: '2rem',
|
|
782
|
-
borderRadius: '12px',
|
|
783
|
-
backdropFilter: 'blur(10px)',
|
|
784
|
-
}}
|
|
785
|
-
>
|
|
786
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>Range Selection</h3>
|
|
787
|
-
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
788
|
-
<div style={{ width: '300px' }}>
|
|
789
|
-
<DatePicker
|
|
790
|
-
selectionMode="range"
|
|
791
|
-
placeholder="Select date range..."
|
|
792
|
-
startDate={dateRange.startDate}
|
|
793
|
-
endDate={dateRange.endDate}
|
|
794
|
-
onRangeChange={setDateRange}
|
|
795
|
-
glass={
|
|
796
|
-
{
|
|
797
|
-
mode: 'shader',
|
|
798
|
-
shaderVariant: 'liquidGlass',
|
|
799
|
-
} as any
|
|
800
|
-
}
|
|
801
|
-
/>
|
|
802
|
-
</div>
|
|
803
|
-
</div>
|
|
804
|
-
</div>
|
|
805
|
-
|
|
806
|
-
{/* Different Sizes */}
|
|
807
|
-
<div
|
|
808
|
-
style={{
|
|
809
|
-
background: 'rgba(255,255,255,0.08)',
|
|
810
|
-
padding: '2rem',
|
|
811
|
-
borderRadius: '12px',
|
|
812
|
-
backdropFilter: 'blur(10px)',
|
|
813
|
-
}}
|
|
814
|
-
>
|
|
815
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>Different Sizes</h3>
|
|
816
|
-
<div
|
|
817
|
-
style={{
|
|
818
|
-
display: 'flex',
|
|
819
|
-
gap: '2rem',
|
|
820
|
-
flexWrap: 'wrap',
|
|
821
|
-
justifyContent: 'center',
|
|
822
|
-
alignItems: 'center',
|
|
823
|
-
}}
|
|
824
|
-
>
|
|
825
|
-
<div style={{ flex: '1 1 200px', minWidth: '200px' }}>
|
|
826
|
-
<label style={{ color: 'white', display: 'block', marginBottom: '0.5rem' }}>
|
|
827
|
-
Small
|
|
828
|
-
</label>
|
|
829
|
-
<DatePicker placeholder="Select date..." size="sm" glass={true} />
|
|
830
|
-
</div>
|
|
831
|
-
<div style={{ flex: '1 1 250px', minWidth: '250px' }}>
|
|
832
|
-
<label style={{ color: 'white', display: 'block', marginBottom: '0.5rem' }}>
|
|
833
|
-
Medium
|
|
834
|
-
</label>
|
|
835
|
-
<DatePicker placeholder="Select date..." size="md" glass={true} />
|
|
836
|
-
</div>
|
|
837
|
-
<div style={{ flex: '1 1 300px', minWidth: '300px' }}>
|
|
838
|
-
<label style={{ color: 'white', display: 'block', marginBottom: '0.5rem' }}>
|
|
839
|
-
Large
|
|
840
|
-
</label>
|
|
841
|
-
<DatePicker placeholder="Select date..." size="lg" glass={true} />
|
|
842
|
-
</div>
|
|
843
|
-
</div>
|
|
844
|
-
</div>
|
|
845
|
-
</div>
|
|
441
|
+
<div className="u-mt-20 u-mx-auto u-flex u-flex-col u-gap-4">
|
|
442
|
+
<div className="u-w-xs">
|
|
443
|
+
<label className="u-block u-mb-2 u-text-sm u-font-medium">Disabled</label>
|
|
444
|
+
<DatePicker
|
|
445
|
+
value={date}
|
|
446
|
+
onChange={setDate}
|
|
447
|
+
disabled={true}
|
|
448
|
+
placeholder="Select date..."
|
|
449
|
+
/>
|
|
846
450
|
</div>
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
placeholder: 'Select date range...',
|
|
856
|
-
},
|
|
857
|
-
render: args => {
|
|
858
|
-
// Set min date to 7 days ago
|
|
859
|
-
const minDate = new Date();
|
|
860
|
-
minDate.setDate(minDate.getDate() - 7);
|
|
861
|
-
|
|
862
|
-
// Set max date to 14 days from now
|
|
863
|
-
const maxDate = new Date();
|
|
864
|
-
maxDate.setDate(maxDate.getDate() + 14);
|
|
865
|
-
|
|
866
|
-
const [dateRange, setDateRange] = useState<DateRange>({
|
|
867
|
-
startDate: null,
|
|
868
|
-
endDate: null,
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
const handleRangeChange = (range: DateRange) => {
|
|
872
|
-
setDateRange(range);
|
|
873
|
-
};
|
|
874
|
-
|
|
875
|
-
return (
|
|
876
|
-
<div
|
|
877
|
-
style={{ width: '400px' }}
|
|
878
|
-
className="u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center"
|
|
879
|
-
>
|
|
880
|
-
<p className="u-text-info u-px-2 u-py-4 u-bg-info-subtle u-text-xs u-text-center">
|
|
881
|
-
Select a date range between {minDate.toLocaleDateString()} and{' '}
|
|
882
|
-
{maxDate.toLocaleDateString()}
|
|
883
|
-
</p>
|
|
884
|
-
<DatePicker
|
|
885
|
-
{...args}
|
|
886
|
-
startDate={dateRange.startDate}
|
|
887
|
-
endDate={dateRange.endDate}
|
|
888
|
-
onRangeChange={handleRangeChange}
|
|
889
|
-
minDate={minDate}
|
|
890
|
-
maxDate={maxDate}
|
|
891
|
-
/>
|
|
892
|
-
</div>
|
|
893
|
-
);
|
|
894
|
-
},
|
|
895
|
-
};
|
|
896
|
-
|
|
897
|
-
export const InlineRangeSelection: Story = {
|
|
898
|
-
args: {
|
|
899
|
-
selectionMode: 'range',
|
|
900
|
-
inline: true,
|
|
901
|
-
showWeekNumbers: true,
|
|
902
|
-
},
|
|
903
|
-
render: args => {
|
|
904
|
-
const [dateRange, setDateRange] = useState<DateRange>({
|
|
905
|
-
startDate: null,
|
|
906
|
-
endDate: null,
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
const handleRangeChange = (range: DateRange) => {
|
|
910
|
-
setDateRange(range);
|
|
911
|
-
};
|
|
912
|
-
|
|
913
|
-
return (
|
|
914
|
-
<div
|
|
915
|
-
style={{ width: '300px' }}
|
|
916
|
-
className="u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center"
|
|
917
|
-
>
|
|
918
|
-
<DatePicker
|
|
919
|
-
{...args}
|
|
920
|
-
startDate={dateRange.startDate}
|
|
921
|
-
endDate={dateRange.endDate}
|
|
922
|
-
onRangeChange={handleRangeChange}
|
|
923
|
-
/>
|
|
924
|
-
<div
|
|
925
|
-
style={{
|
|
926
|
-
marginTop: '1rem',
|
|
927
|
-
padding: '0.75rem',
|
|
928
|
-
backgroundColor: '#f5f5f5',
|
|
929
|
-
borderRadius: '0.25rem',
|
|
930
|
-
}}
|
|
931
|
-
>
|
|
932
|
-
<p>
|
|
933
|
-
Selected range:{' '}
|
|
934
|
-
{dateRange.startDate && dateRange.endDate
|
|
935
|
-
? formatDateRange(dateRange.startDate, dateRange.endDate, 'MM/dd/yyyy')
|
|
936
|
-
: dateRange.startDate
|
|
937
|
-
? formatDateRange(dateRange.startDate, null, 'MM/dd/yyyy')
|
|
938
|
-
: 'No range selected'}
|
|
939
|
-
</p>
|
|
451
|
+
<div className="u-w-xs">
|
|
452
|
+
<label className="u-block u-mb-2 u-text-sm u-font-medium">Read Only</label>
|
|
453
|
+
<DatePicker
|
|
454
|
+
value={date}
|
|
455
|
+
onChange={setDate}
|
|
456
|
+
readOnly={true}
|
|
457
|
+
placeholder="Select date..."
|
|
458
|
+
/>
|
|
940
459
|
</div>
|
|
941
460
|
</div>
|
|
942
461
|
);
|
|
943
462
|
},
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
return (
|
|
951
|
-
<div
|
|
952
|
-
style={{ width: '300px' }}
|
|
953
|
-
className={'u-flex u-flex-column u-gap-4 u-mt-20 u-mx-auto u-items-center'}
|
|
954
|
-
>
|
|
955
|
-
<DatePicker {...args} size="sm" placeholder="Small (sm)" value={date} onChange={setDate} />
|
|
956
|
-
<DatePicker {...args} size="md" placeholder="Medium (md)" value={date} onChange={setDate} />
|
|
957
|
-
<DatePicker {...args} size="lg" placeholder="Large (lg)" value={date} onChange={setDate} />
|
|
958
|
-
</div>
|
|
959
|
-
);
|
|
960
|
-
},
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
export const Disabled: Story = {
|
|
964
|
-
args: {
|
|
965
|
-
disabled: true,
|
|
966
|
-
placeholder: 'Disabled DatePicker',
|
|
967
|
-
},
|
|
968
|
-
render: args => {
|
|
969
|
-
const [date, setDate] = useState<Date | null>(null);
|
|
970
|
-
return (
|
|
971
|
-
<div style={{ width: '300px' }} className="u-mt-20 u-mx-auto">
|
|
972
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
973
|
-
</div>
|
|
974
|
-
);
|
|
975
|
-
},
|
|
976
|
-
};
|
|
977
|
-
|
|
978
|
-
export const ReadOnly: Story = {
|
|
979
|
-
args: {
|
|
980
|
-
readOnly: true,
|
|
981
|
-
placeholder: 'Read-only DatePicker',
|
|
982
|
-
},
|
|
983
|
-
render: args => {
|
|
984
|
-
const initialDate = new Date();
|
|
985
|
-
const [date, setDate] = useState<Date | null>(initialDate);
|
|
986
|
-
return (
|
|
987
|
-
<div
|
|
988
|
-
className="u-mt-20 u-mx-auto"
|
|
989
|
-
style={{ width: '300px' }}
|
|
990
|
-
data-testid="read-only-datepicker"
|
|
991
|
-
>
|
|
992
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
993
|
-
</div>
|
|
994
|
-
);
|
|
995
|
-
},
|
|
996
|
-
};
|
|
997
|
-
|
|
998
|
-
export const DifferentFormats: Story = {
|
|
999
|
-
render: args => {
|
|
1000
|
-
const initialDate = new Date();
|
|
1001
|
-
const [date1, setDate1] = useState<Date | null>(initialDate);
|
|
1002
|
-
const [date2, setDate2] = useState<Date | null>(initialDate);
|
|
1003
|
-
const [date3, setDate3] = useState<Date | null>(initialDate);
|
|
1004
|
-
|
|
1005
|
-
return (
|
|
1006
|
-
<div className="u-w-75 u-mx-auto u-mt-20 u-flex u-gap-3">
|
|
1007
|
-
<DatePicker
|
|
1008
|
-
{...args}
|
|
1009
|
-
format="MM/dd/yyyy"
|
|
1010
|
-
placeholder="MM/DD/YYYY"
|
|
1011
|
-
value={date1}
|
|
1012
|
-
onChange={setDate1}
|
|
1013
|
-
/>
|
|
1014
|
-
<DatePicker
|
|
1015
|
-
{...args}
|
|
1016
|
-
format="dd/MM/yyyy"
|
|
1017
|
-
placeholder="DD/MM/YYYY"
|
|
1018
|
-
value={date2}
|
|
1019
|
-
onChange={setDate2}
|
|
1020
|
-
/>
|
|
1021
|
-
<DatePicker
|
|
1022
|
-
{...args}
|
|
1023
|
-
format="yyyy-MM-dd"
|
|
1024
|
-
placeholder="YYYY-MM-DD"
|
|
1025
|
-
value={date3}
|
|
1026
|
-
onChange={setDate3}
|
|
1027
|
-
/>
|
|
1028
|
-
</div>
|
|
1029
|
-
);
|
|
1030
|
-
},
|
|
1031
|
-
};
|
|
1032
|
-
|
|
1033
|
-
export const WithGlassEffect: Story = {
|
|
1034
|
-
args: {
|
|
1035
|
-
placeholder: 'Select date...',
|
|
1036
|
-
glass: true,
|
|
1037
|
-
size: 'md',
|
|
1038
|
-
placement: 'bottom-start',
|
|
1039
|
-
selectionMode: 'single',
|
|
1040
|
-
},
|
|
1041
|
-
render: args => {
|
|
1042
|
-
const [date, setDate] = useState<Date | null>(null);
|
|
1043
|
-
return (
|
|
1044
|
-
<div
|
|
1045
|
-
style={{
|
|
1046
|
-
width: '97vw',
|
|
1047
|
-
minHeight: '97vh',
|
|
1048
|
-
background:
|
|
1049
|
-
'url(https://images.unsplash.com/photo-1701341263063-1f3303c759d7?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
1050
|
-
backgroundSize: 'cover',
|
|
1051
|
-
backgroundPosition: 'center',
|
|
1052
|
-
padding: '2rem',
|
|
1053
|
-
borderRadius: '12px',
|
|
1054
|
-
display: 'flex',
|
|
1055
|
-
justifyContent: 'center',
|
|
1056
|
-
}}
|
|
1057
|
-
>
|
|
1058
|
-
<div className="u-mx-auto" style={{ width: '300px' }} data-testid="read-only-datepicker">
|
|
1059
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
1060
|
-
</div>
|
|
1061
|
-
</div>
|
|
1062
|
-
);
|
|
463
|
+
parameters: {
|
|
464
|
+
docs: {
|
|
465
|
+
description: {
|
|
466
|
+
story: 'DatePicker in disabled and read-only states.',
|
|
467
|
+
},
|
|
468
|
+
},
|
|
1063
469
|
},
|
|
1064
470
|
};
|
|
1065
471
|
|
|
1066
|
-
export const
|
|
472
|
+
export const InlineMode: Story = {
|
|
1067
473
|
args: {
|
|
1068
474
|
placeholder: 'Select date...',
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
saturation: 180,
|
|
1073
|
-
aberrationIntensity: 2,
|
|
1074
|
-
overLight: false,
|
|
1075
|
-
mode: 'polar' as const,
|
|
1076
|
-
} as any,
|
|
1077
|
-
size: 'md',
|
|
1078
|
-
placement: 'bottom-start',
|
|
1079
|
-
selectionMode: 'single',
|
|
1080
|
-
},
|
|
1081
|
-
render: args => {
|
|
1082
|
-
const [date, setDate] = useState<Date | null>(null);
|
|
1083
|
-
return (
|
|
1084
|
-
<div
|
|
1085
|
-
style={{
|
|
1086
|
-
width: '98vw',
|
|
1087
|
-
minHeight: '97vh',
|
|
1088
|
-
background:
|
|
1089
|
-
'url(https://images.unsplash.com/photo-1744035522988-08bf64003759?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
1090
|
-
padding: '2rem',
|
|
1091
|
-
borderRadius: '12px',
|
|
1092
|
-
backgroundSize: 'cover',
|
|
1093
|
-
backgroundPosition: 'center',
|
|
1094
|
-
display: 'flex',
|
|
1095
|
-
justifyContent: 'center',
|
|
1096
|
-
}}
|
|
1097
|
-
>
|
|
1098
|
-
<div className="u-mx-auto" data-testid="read-only-datepicker">
|
|
1099
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
1100
|
-
</div>
|
|
1101
|
-
</div>
|
|
1102
|
-
);
|
|
1103
|
-
},
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
export const GlassEffectInline: Story = {
|
|
1107
|
-
args: {
|
|
1108
|
-
glass: true,
|
|
475
|
+
format: 'MM/dd/yyyy',
|
|
476
|
+
clearable: true,
|
|
477
|
+
showTodayButton: true,
|
|
1109
478
|
inline: true,
|
|
1110
|
-
showWeekNumbers: true,
|
|
1111
479
|
selectionMode: 'single',
|
|
1112
480
|
},
|
|
1113
481
|
render: args => {
|
|
1114
|
-
const [date, setDate] = useState<Date | null>(
|
|
1115
|
-
return (
|
|
1116
|
-
<div
|
|
1117
|
-
style={{
|
|
1118
|
-
width: '98vw',
|
|
1119
|
-
minHeight: '97vh',
|
|
1120
|
-
background:
|
|
1121
|
-
'url(https://images.unsplash.com/photo-1497449711066-ecd7e3d6a484?q=80&w=1365&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
1122
|
-
padding: '2rem',
|
|
1123
|
-
borderRadius: '16px',
|
|
1124
|
-
backgroundSize: 'cover',
|
|
1125
|
-
backgroundPosition: 'center',
|
|
1126
|
-
display: 'flex',
|
|
1127
|
-
justifyContent: 'center',
|
|
1128
|
-
}}
|
|
1129
|
-
>
|
|
1130
|
-
<div className="u-mx-auto u-w-50" data-testid="read-only-datepicker">
|
|
1131
|
-
<DatePicker {...args} value={date} onChange={setDate} />
|
|
1132
|
-
</div>
|
|
1133
|
-
</div>
|
|
1134
|
-
);
|
|
1135
|
-
},
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
export const GlassEffectRangeSelection: Story = {
|
|
1139
|
-
args: {
|
|
1140
|
-
selectionMode: 'range',
|
|
1141
|
-
placeholder: 'Select date...',
|
|
1142
|
-
glass: {
|
|
1143
|
-
mode: 'prominent' as const,
|
|
1144
|
-
} as any,
|
|
1145
|
-
},
|
|
1146
|
-
render: args => {
|
|
1147
|
-
const [dateRange, setDateRange] = useState<DateRange>({
|
|
1148
|
-
startDate: null,
|
|
1149
|
-
endDate: null,
|
|
1150
|
-
});
|
|
1151
|
-
|
|
1152
|
-
const handleRangeChange = (range: DateRange) => {
|
|
1153
|
-
setDateRange(range);
|
|
1154
|
-
};
|
|
1155
|
-
|
|
482
|
+
const [date, setDate] = useState<Date | null>(null);
|
|
1156
483
|
return (
|
|
1157
|
-
<div
|
|
1158
|
-
|
|
1159
|
-
width: '98vw',
|
|
1160
|
-
minHeight: '97vh',
|
|
1161
|
-
background:
|
|
1162
|
-
'url(https://images.unsplash.com/photo-1723046833386-5a494bdb6da7?q=80&w=2694&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
|
|
1163
|
-
padding: '2rem',
|
|
1164
|
-
borderRadius: '12px',
|
|
1165
|
-
backgroundSize: 'cover',
|
|
1166
|
-
backgroundPosition: 'center',
|
|
1167
|
-
display: 'flex',
|
|
1168
|
-
justifyContent: 'center',
|
|
1169
|
-
gap: '1rem',
|
|
1170
|
-
}}
|
|
1171
|
-
>
|
|
1172
|
-
<div
|
|
1173
|
-
className="u-mt-20 u-mx-auto"
|
|
1174
|
-
style={{ width: '300px' }}
|
|
1175
|
-
data-testid="read-only-datepicker"
|
|
1176
|
-
>
|
|
1177
|
-
<div
|
|
1178
|
-
style={{
|
|
1179
|
-
padding: '0.75rem',
|
|
1180
|
-
marginBottom: '1rem',
|
|
1181
|
-
background: 'rgba(255, 255, 255, 0.1)',
|
|
1182
|
-
backdropFilter: 'blur(10px)',
|
|
1183
|
-
borderRadius: '0.5rem',
|
|
1184
|
-
border: '1px solid rgba(255, 255, 255, 0.2)',
|
|
1185
|
-
color: 'white',
|
|
1186
|
-
fontSize: '0.875rem',
|
|
1187
|
-
}}
|
|
1188
|
-
>
|
|
1189
|
-
<p>
|
|
1190
|
-
Selected range:{' '}
|
|
1191
|
-
{dateRange.startDate && dateRange.endDate
|
|
1192
|
-
? formatDateRange(dateRange.startDate, dateRange.endDate, 'MM/dd/yyyy')
|
|
1193
|
-
: dateRange.startDate
|
|
1194
|
-
? formatDateRange(dateRange.startDate, null, 'MM/dd/yyyy')
|
|
1195
|
-
: 'No range selected'}
|
|
1196
|
-
</p>
|
|
1197
|
-
</div>
|
|
1198
|
-
<DatePicker
|
|
1199
|
-
{...args}
|
|
1200
|
-
startDate={dateRange.startDate}
|
|
1201
|
-
endDate={dateRange.endDate}
|
|
1202
|
-
onRangeChange={handleRangeChange}
|
|
1203
|
-
/>
|
|
1204
|
-
</div>
|
|
484
|
+
<div className="u-mt-20 u-mx-auto u-items-center">
|
|
485
|
+
<DatePicker {...args} value={date} onChange={setDate} />
|
|
1205
486
|
</div>
|
|
1206
487
|
);
|
|
1207
488
|
},
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
startDate: null,
|
|
1215
|
-
endDate: null,
|
|
1216
|
-
});
|
|
1217
|
-
|
|
1218
|
-
const handleSingleDateChange = (date: Date | null) => {
|
|
1219
|
-
setDate(date);
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
|
-
const handleRangeChange = (range: DateRange) => {
|
|
1223
|
-
setDateRange(range);
|
|
1224
|
-
};
|
|
1225
|
-
|
|
1226
|
-
return args.selectionMode === 'single' ? (
|
|
1227
|
-
<DatePicker {...args} value={date} onChange={handleSingleDateChange} />
|
|
1228
|
-
) : (
|
|
1229
|
-
<DatePicker
|
|
1230
|
-
{...args}
|
|
1231
|
-
startDate={dateRange.startDate}
|
|
1232
|
-
endDate={dateRange.endDate}
|
|
1233
|
-
onRangeChange={handleRangeChange}
|
|
1234
|
-
/>
|
|
1235
|
-
);
|
|
489
|
+
parameters: {
|
|
490
|
+
docs: {
|
|
491
|
+
description: {
|
|
492
|
+
story: 'DatePicker in inline mode (always visible).',
|
|
493
|
+
},
|
|
494
|
+
},
|
|
1236
495
|
},
|
|
1237
|
-
};
|
|
496
|
+
};
|