@ceed/cds 1.34.1 → 1.35.0
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/dist/components/Accordions/Accordions.d.ts +1 -0
- package/dist/components/Alert/Alert.d.ts +5 -5
- package/dist/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/components/Avatar/Avatar.d.ts +7 -17
- package/dist/components/Box/Box.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -5
- package/dist/components/Button/Button.d.ts +3 -2
- package/dist/components/Calendar/Calendar.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +1 -0
- package/dist/components/Container/Container.d.ts +6 -1
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/DialogActions/DialogActions.d.ts +1 -0
- package/dist/components/DialogContent/DialogContent.d.ts +1 -0
- package/dist/components/DialogFrame/DialogFrame.d.ts +1 -1
- package/dist/components/DialogTitle/DialogTitle.d.ts +1 -0
- package/dist/components/Divider/Divider.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +28 -1
- package/dist/components/FormControl/FormControl.d.ts +1 -0
- package/dist/components/FormHelperText/FormHelperText.d.ts +1 -0
- package/dist/components/FormLabel/FormLabel.d.ts +1 -0
- package/dist/components/Grid/Grid.d.ts +1 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -2
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +7 -6
- package/dist/components/InfoSign/InfoSign.d.ts +3 -2
- package/dist/components/Input/Input.d.ts +8 -22
- package/dist/components/InsetDrawer/InsetDrawer.d.ts +1 -0
- package/dist/components/Markdown/Markdown.d.ts +9 -24
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/MenuButton/MenuButton.d.ts +10 -8
- package/dist/components/Modal/Modal.d.ts +4 -2
- package/dist/components/NavigationGroup/NavigationGroup.d.ts +3 -2
- package/dist/components/NavigationItem/NavigationItem.d.ts +3 -2
- package/dist/components/Navigator/Navigator.d.ts +5 -4
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -0
- package/dist/components/RadioList/RadioList.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +12 -10
- package/dist/components/Sheet/Sheet.d.ts +1 -0
- package/dist/components/Stack/Stack.d.ts +1 -0
- package/dist/components/Stepper/Stepper.d.ts +2 -1
- package/dist/components/Switch/Switch.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +7 -5
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -20
- package/dist/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +1 -0
- package/dist/components/Uploader/Uploader.d.ts +18 -17
- package/dist/components/data-display/Avatar.md +60 -72
- package/dist/components/data-display/Badge.md +197 -181
- package/dist/components/data-display/Chip.md +164 -142
- package/dist/components/data-display/DataTable.md +843 -338
- package/dist/components/data-display/InfoSign.md +1 -3
- package/dist/components/data-display/Markdown.md +93 -125
- package/dist/components/data-display/Table.md +1453 -1007
- package/dist/components/data-display/Typography.md +113 -116
- package/dist/components/feedback/Alert.md +80 -86
- package/dist/components/feedback/CircularProgress.md +32 -36
- package/dist/components/feedback/Dialog.md +25 -17
- package/dist/components/feedback/Modal.md +296 -264
- package/dist/components/feedback/Skeleton.md +125 -89
- package/dist/components/index.d.ts +62 -2
- package/dist/components/inputs/Autocomplete.md +191 -95
- package/dist/components/inputs/Button.md +83 -83
- package/dist/components/inputs/ButtonGroup.md +195 -185
- package/dist/components/inputs/Calendar.md +25 -28
- package/dist/components/inputs/Checkbox.md +11 -29
- package/dist/components/inputs/CurrencyInput.md +4 -4
- package/dist/components/inputs/DatePicker.md +229 -110
- package/dist/components/inputs/DateRangePicker.md +248 -137
- package/dist/components/inputs/FilterableCheckboxGroup.md +115 -55
- package/dist/components/inputs/FormControl.md +75 -69
- package/dist/components/inputs/IconButton.md +229 -205
- package/dist/components/inputs/Input.md +131 -98
- package/dist/components/inputs/MonthPicker.md +186 -84
- package/dist/components/inputs/MonthRangePicker.md +73 -49
- package/dist/components/inputs/PercentageInput.md +15 -31
- package/dist/components/inputs/RadioButton.md +320 -256
- package/dist/components/inputs/RadioList.md +66 -50
- package/dist/components/inputs/RadioTileGroup.md +287 -170
- package/dist/components/inputs/SearchBar.md +82 -60
- package/dist/components/inputs/Select.md +106 -95
- package/dist/components/inputs/Slider.md +153 -102
- package/dist/components/inputs/Switch.md +193 -138
- package/dist/components/inputs/Textarea.md +15 -20
- package/dist/components/inputs/Uploader/Uploader.md +68 -39
- package/dist/components/layout/Box.md +841 -662
- package/dist/components/layout/Container.md +3 -11
- package/dist/components/layout/Grid.md +480 -394
- package/dist/components/layout/Stack.md +739 -566
- package/dist/components/navigation/Breadcrumbs.md +4 -4
- package/dist/components/navigation/Drawer.md +34 -25
- package/dist/components/navigation/Dropdown.md +745 -408
- package/dist/components/navigation/IconMenuButton.md +14 -6
- package/dist/components/navigation/InsetDrawer.md +8 -13
- package/dist/components/navigation/Link.md +1 -2
- package/dist/components/navigation/Menu.md +623 -502
- package/dist/components/navigation/MenuButton.md +18 -10
- package/dist/components/navigation/NavigationGroup.md +19 -50
- package/dist/components/navigation/NavigationItem.md +6 -6
- package/dist/components/navigation/Navigator.md +26 -28
- package/dist/components/navigation/Pagination.md +86 -75
- package/dist/components/navigation/Stepper.md +2 -12
- package/dist/components/navigation/Tabs.md +48 -36
- package/dist/components/surfaces/Accordions.md +89 -172
- package/dist/components/surfaces/Card.md +1094 -709
- package/dist/components/surfaces/Divider.md +562 -412
- package/dist/components/surfaces/Sheet.md +700 -518
- package/dist/guides/ThemeProvider.md +8 -8
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +1059 -1032
- package/dist/index.d.ts +2 -1
- package/dist/index.js +705 -670
- package/framer/index.js +1 -1
- package/package.json +32 -35
|
@@ -78,10 +78,10 @@ CurrencyInput supports three sizes: `sm`, `md` (default), and `lg`.
|
|
|
78
78
|
|
|
79
79
|
```tsx
|
|
80
80
|
<Stack gap={2}>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
</Stack>
|
|
81
|
+
<CurrencyInput size="sm" label="Small" defaultValue={1000} />
|
|
82
|
+
<CurrencyInput size="md" label="Medium" defaultValue={1000} />
|
|
83
|
+
<CurrencyInput size="lg" label="Large" defaultValue={1000} />
|
|
84
|
+
</Stack>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
## Form Features
|
|
@@ -36,13 +36,7 @@ import { DatePicker } from '@ceed/cds';
|
|
|
36
36
|
function DateForm() {
|
|
37
37
|
const [date, setDate] = useState('');
|
|
38
38
|
|
|
39
|
-
return (
|
|
40
|
-
<DatePicker
|
|
41
|
-
label="Select Date"
|
|
42
|
-
value={date}
|
|
43
|
-
onChange={(e) => setDate(e.target.value)}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
39
|
+
return <DatePicker label="Select Date" value={date} onChange={(e) => setDate(e.target.value)} />;
|
|
46
40
|
}
|
|
47
41
|
```
|
|
48
42
|
|
|
@@ -57,10 +51,10 @@ DatePicker supports three sizes (`sm`, `md`, `lg`) to fit different layout densi
|
|
|
57
51
|
|
|
58
52
|
```tsx
|
|
59
53
|
<Stack gap={2}>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</Stack>
|
|
54
|
+
<DatePicker {...args} size="sm" />
|
|
55
|
+
<DatePicker {...args} size="md" />
|
|
56
|
+
<DatePicker {...args} size="lg" />
|
|
57
|
+
</Stack>
|
|
64
58
|
```
|
|
65
59
|
|
|
66
60
|
## Label and Helper Text
|
|
@@ -177,18 +171,20 @@ DatePicker works in both controlled mode (you manage `value` via state) and unco
|
|
|
177
171
|
|
|
178
172
|
```tsx
|
|
179
173
|
<Stack gap={2}>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
174
|
+
<DatePicker {...args} value={value} onChange={(e) => setValue(e.target.value)} />
|
|
175
|
+
<Button
|
|
176
|
+
onClick={() => {
|
|
177
|
+
const currentValue = new Date(value);
|
|
178
|
+
currentValue.setDate(currentValue.getDate() + 1);
|
|
179
|
+
const year = currentValue.getFullYear();
|
|
180
|
+
const month = String(currentValue.getMonth() + 1).padStart(2, "0");
|
|
181
|
+
const day = String(currentValue.getDate()).padStart(2, "0");
|
|
182
|
+
setValue(`${year}/${month}/${day}`);
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
Next Day
|
|
186
|
+
</Button>
|
|
187
|
+
</Stack>
|
|
192
188
|
```
|
|
193
189
|
|
|
194
190
|
```tsx
|
|
@@ -206,42 +202,126 @@ The `format` prop determines the shape of the value emitted through `onChange`,
|
|
|
206
202
|
|
|
207
203
|
```tsx
|
|
208
204
|
<Stack gap={2}>
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
<DatePicker
|
|
206
|
+
{...args}
|
|
207
|
+
value={value["YYYY.MM.DD"]}
|
|
208
|
+
label="YYYY.MM.DD"
|
|
209
|
+
name="YYYY.MM.DD"
|
|
210
|
+
format="YYYY.MM.DD"
|
|
211
|
+
onChange={handleChange}
|
|
212
|
+
/>
|
|
213
|
+
<DatePicker
|
|
214
|
+
{...args}
|
|
215
|
+
value={value["YYYY/MM/DD"]}
|
|
216
|
+
label="YYYY/MM/DD"
|
|
217
|
+
name="YYYY/MM/DD"
|
|
218
|
+
format="YYYY/MM/DD"
|
|
219
|
+
onChange={handleChange}
|
|
220
|
+
/>
|
|
221
|
+
<DatePicker
|
|
222
|
+
{...args}
|
|
223
|
+
value={value["MM/DD/YYYY"]}
|
|
224
|
+
label="MM/DD/YYYY"
|
|
225
|
+
name="MM/DD/YYYY"
|
|
226
|
+
format="MM/DD/YYYY"
|
|
227
|
+
onChange={handleChange}
|
|
228
|
+
/>
|
|
229
|
+
<DatePicker
|
|
230
|
+
{...args}
|
|
231
|
+
value={value["YYYY-MM-DD"]}
|
|
232
|
+
label="YYYY-MM-DD"
|
|
233
|
+
name="YYYY-MM-DD"
|
|
234
|
+
format="YYYY-MM-DD"
|
|
235
|
+
onChange={handleChange}
|
|
236
|
+
/>
|
|
237
|
+
<DatePicker
|
|
238
|
+
{...args}
|
|
239
|
+
value={value["DD/MM/YYYY"]}
|
|
240
|
+
label="DD/MM/YYYY"
|
|
241
|
+
name="DD/MM/YYYY"
|
|
242
|
+
format="DD/MM/YYYY"
|
|
243
|
+
onChange={handleChange}
|
|
244
|
+
/>
|
|
245
|
+
<DatePicker
|
|
246
|
+
{...args}
|
|
247
|
+
value={value["DD.MM.YYYY"]}
|
|
248
|
+
label="DD.MM.YYYY"
|
|
249
|
+
name="DD.MM.YYYY"
|
|
250
|
+
format="DD.MM.YYYY"
|
|
251
|
+
onChange={handleChange}
|
|
252
|
+
/>
|
|
253
|
+
</Stack>
|
|
216
254
|
```
|
|
217
255
|
|
|
218
256
|
```tsx
|
|
219
257
|
<Stack gap={2}>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
258
|
+
<DatePicker
|
|
259
|
+
{...args}
|
|
260
|
+
value={value1}
|
|
261
|
+
label="YYYY.MM.DD"
|
|
262
|
+
name="YYYY.MM.DD"
|
|
263
|
+
displayFormat="YYYY.MM.DD"
|
|
264
|
+
onChange={(e) => {
|
|
265
|
+
setValue1(e.target.value);
|
|
266
|
+
args.onChange?.(e);
|
|
267
|
+
}}
|
|
268
|
+
/>
|
|
269
|
+
<DatePicker
|
|
270
|
+
{...args}
|
|
271
|
+
value={value2}
|
|
272
|
+
label="YYYY/MM/DD"
|
|
273
|
+
name="YYYY/MM/DD"
|
|
274
|
+
displayFormat="YYYY/MM/DD"
|
|
275
|
+
onChange={(e) => {
|
|
276
|
+
setValue2(e.target.value);
|
|
277
|
+
args.onChange?.(e);
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
<DatePicker
|
|
281
|
+
{...args}
|
|
282
|
+
value={value3}
|
|
283
|
+
label="MM/DD/YYYY"
|
|
284
|
+
name="MM/DD/YYYY"
|
|
285
|
+
displayFormat="MM/DD/YYYY"
|
|
286
|
+
onChange={(e) => {
|
|
287
|
+
setValue3(e.target.value);
|
|
288
|
+
args.onChange?.(e);
|
|
289
|
+
}}
|
|
290
|
+
/>
|
|
291
|
+
<DatePicker
|
|
292
|
+
{...args}
|
|
293
|
+
value={value4}
|
|
294
|
+
label="YYYY-MM-DD"
|
|
295
|
+
name="YYYY-MM-DD"
|
|
296
|
+
displayFormat="YYYY-MM-DD"
|
|
297
|
+
onChange={(e) => {
|
|
298
|
+
setValue4(e.target.value);
|
|
299
|
+
args.onChange?.(e);
|
|
300
|
+
}}
|
|
301
|
+
/>
|
|
302
|
+
<DatePicker
|
|
303
|
+
{...args}
|
|
304
|
+
value={value5}
|
|
305
|
+
label="DD/MM/YYYY"
|
|
306
|
+
name="DD/MM/YYYY"
|
|
307
|
+
displayFormat="DD/MM/YYYY"
|
|
308
|
+
onChange={(e) => {
|
|
309
|
+
setValue5(e.target.value);
|
|
310
|
+
args.onChange?.(e);
|
|
311
|
+
}}
|
|
312
|
+
/>
|
|
313
|
+
<DatePicker
|
|
314
|
+
{...args}
|
|
315
|
+
value={value6}
|
|
316
|
+
label="DD.MM.YYYY"
|
|
317
|
+
name="DD.MM.YYYY"
|
|
318
|
+
displayFormat="DD.MM.YYYY"
|
|
319
|
+
onChange={(e) => {
|
|
320
|
+
setValue6(e.target.value);
|
|
321
|
+
args.onChange?.(e);
|
|
322
|
+
}}
|
|
323
|
+
/>
|
|
324
|
+
</Stack>
|
|
245
325
|
```
|
|
246
326
|
|
|
247
327
|
**Supported format tokens:**
|
|
@@ -263,22 +343,32 @@ Use the `presets` prop to display a list of quick-select options alongside the c
|
|
|
263
343
|
Each preset's `value` must match the component's `format` prop. When the current value matches a preset, that preset is automatically highlighted -- regardless of whether the value was set via the preset button or by selecting the same date on the calendar.
|
|
264
344
|
|
|
265
345
|
```tsx
|
|
266
|
-
<DatePicker
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
346
|
+
<DatePicker
|
|
347
|
+
{...args}
|
|
348
|
+
value={value}
|
|
349
|
+
onChange={(e) => {
|
|
350
|
+
setValue(e.target.value);
|
|
351
|
+
args.onChange?.(e);
|
|
352
|
+
}}
|
|
353
|
+
presets={[
|
|
354
|
+
{
|
|
355
|
+
label: "Today",
|
|
356
|
+
value: fmt(today)
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
label: "Yesterday",
|
|
360
|
+
value: daysAgo(1)
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
label: "3 days ago",
|
|
364
|
+
value: daysAgo(3)
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
label: "1 week ago",
|
|
368
|
+
value: daysAgo(7)
|
|
369
|
+
}
|
|
370
|
+
]}
|
|
371
|
+
/>
|
|
282
372
|
```
|
|
283
373
|
|
|
284
374
|
```tsx
|
|
@@ -309,16 +399,22 @@ function QuickDateSelect() {
|
|
|
309
399
|
Pair DatePicker with an external reset button to programmatically clear the value.
|
|
310
400
|
|
|
311
401
|
```tsx
|
|
312
|
-
<div
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
402
|
+
<div
|
|
403
|
+
style={{
|
|
404
|
+
display: "flex",
|
|
405
|
+
gap: "10px"
|
|
406
|
+
}}
|
|
407
|
+
>
|
|
408
|
+
<DatePicker
|
|
409
|
+
{...props}
|
|
410
|
+
value={value}
|
|
411
|
+
onChange={(event) => {
|
|
412
|
+
onChange?.(event);
|
|
413
|
+
setValue(event.target.value);
|
|
414
|
+
}}
|
|
415
|
+
/>
|
|
416
|
+
<Button onClick={() => setValue("")}>Reset</Button>
|
|
417
|
+
</div>
|
|
322
418
|
```
|
|
323
419
|
|
|
324
420
|
### Hide Clear Button
|
|
@@ -339,12 +435,17 @@ Multiple DatePicker instances can share the same value for dependent field scena
|
|
|
339
435
|
|
|
340
436
|
```tsx
|
|
341
437
|
<Stack gap={2}>
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
438
|
+
<DatePicker
|
|
439
|
+
label="Select Date"
|
|
440
|
+
value={value}
|
|
441
|
+
inputReadOnly
|
|
442
|
+
onChange={(e) => {
|
|
443
|
+
setValue(e.target.value);
|
|
444
|
+
setValue2(e.target.value);
|
|
445
|
+
}}
|
|
446
|
+
/>
|
|
447
|
+
<DatePicker label="Synchronized" value={value2} disabled />
|
|
448
|
+
</Stack>
|
|
348
449
|
```
|
|
349
450
|
|
|
350
451
|
## Form with Validation
|
|
@@ -410,9 +511,7 @@ function AppointmentPicker() {
|
|
|
410
511
|
function RegionalDateField({ locale }: { locale: string }) {
|
|
411
512
|
const [date, setDate] = useState('');
|
|
412
513
|
|
|
413
|
-
const displayFormat = locale === 'en-US' ? 'MM/DD/YYYY'
|
|
414
|
-
: locale === 'en-GB' ? 'DD/MM/YYYY'
|
|
415
|
-
: 'YYYY-MM-DD';
|
|
514
|
+
const displayFormat = locale === 'en-US' ? 'MM/DD/YYYY' : locale === 'en-GB' ? 'DD/MM/YYYY' : 'YYYY-MM-DD';
|
|
416
515
|
|
|
417
516
|
return (
|
|
418
517
|
<DatePicker
|
|
@@ -431,51 +530,71 @@ function RegionalDateField({ locale }: { locale: string }) {
|
|
|
431
530
|
1. **Always provide a label**
|
|
432
531
|
|
|
433
532
|
```tsx
|
|
434
|
-
{
|
|
435
|
-
|
|
533
|
+
{
|
|
534
|
+
/* Do */
|
|
535
|
+
}
|
|
536
|
+
<DatePicker label="Birth Date" />;
|
|
436
537
|
|
|
437
|
-
{
|
|
438
|
-
|
|
538
|
+
{
|
|
539
|
+
/* Don't */
|
|
540
|
+
}
|
|
541
|
+
<DatePicker placeholder="Birth Date" />;
|
|
439
542
|
```
|
|
440
543
|
|
|
441
544
|
2. **Keep value format consistent with the `format` prop**
|
|
442
545
|
|
|
443
546
|
```tsx
|
|
444
|
-
{
|
|
445
|
-
|
|
547
|
+
{
|
|
548
|
+
/* Do */
|
|
549
|
+
}
|
|
550
|
+
<DatePicker format="YYYY/MM/DD" value="2024/04/15" />;
|
|
446
551
|
|
|
447
|
-
{
|
|
448
|
-
|
|
552
|
+
{
|
|
553
|
+
/* Don't -- mismatched format causes unexpected behavior */
|
|
554
|
+
}
|
|
555
|
+
<DatePicker format="YYYY/MM/DD" value="04/15/2024" />;
|
|
449
556
|
```
|
|
450
557
|
|
|
451
558
|
3. **Use `displayFormat` to separate API format from UI format**
|
|
452
559
|
|
|
453
560
|
```tsx
|
|
454
|
-
{
|
|
455
|
-
|
|
561
|
+
{
|
|
562
|
+
/* Do -- consistent API format, locale-appropriate display */
|
|
563
|
+
}
|
|
564
|
+
<DatePicker format="YYYY-MM-DD" displayFormat="MM/DD/YYYY" />;
|
|
456
565
|
|
|
457
|
-
{
|
|
458
|
-
|
|
566
|
+
{
|
|
567
|
+
/* Don't -- changing format just for display affects onChange values */
|
|
568
|
+
}
|
|
569
|
+
<DatePicker format="MM/DD/YYYY" />;
|
|
459
570
|
```
|
|
460
571
|
|
|
461
572
|
4. **Set appropriate date boundaries for your use case**
|
|
462
573
|
|
|
463
574
|
```tsx
|
|
464
|
-
{
|
|
465
|
-
|
|
575
|
+
{
|
|
576
|
+
/* Do */
|
|
577
|
+
}
|
|
578
|
+
<DatePicker label="Birth Date" disableFuture minDate="1900/01/01" />;
|
|
466
579
|
|
|
467
|
-
{
|
|
468
|
-
|
|
580
|
+
{
|
|
581
|
+
/* Don't -- unrestricted date range for a birth date field */
|
|
582
|
+
}
|
|
583
|
+
<DatePicker label="Birth Date" />;
|
|
469
584
|
```
|
|
470
585
|
|
|
471
586
|
5. **Show validation feedback with error and helperText**
|
|
472
587
|
|
|
473
588
|
```tsx
|
|
474
|
-
{
|
|
475
|
-
|
|
589
|
+
{
|
|
590
|
+
/* Do */
|
|
591
|
+
}
|
|
592
|
+
<DatePicker error={!isValid} helperText={errorMessage} />;
|
|
476
593
|
|
|
477
|
-
{
|
|
478
|
-
|
|
594
|
+
{
|
|
595
|
+
/* Don't -- silently ignore invalid state */
|
|
596
|
+
}
|
|
597
|
+
<DatePicker value={invalidDate} />;
|
|
479
598
|
```
|
|
480
599
|
|
|
481
600
|
## Props and Customization
|