@ceed/ads 1.29.1 → 1.30.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/dist/Overview.md +5 -5
- package/dist/components/DatePicker/DatePicker.d.ts +10 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +10 -0
- package/dist/components/data-display/Avatar.md +85 -74
- package/dist/components/data-display/Badge.md +23 -5
- package/dist/components/data-display/Chip.md +49 -35
- package/dist/components/data-display/DataTable.md +93 -0
- package/dist/components/data-display/InfoSign.md +15 -5
- package/dist/components/data-display/Markdown.md +22 -26
- package/dist/components/data-display/Table.md +63 -53
- package/dist/components/data-display/Tooltip.md +70 -58
- package/dist/components/data-display/Typography.md +28 -11
- package/dist/components/feedback/Alert.md +86 -74
- package/dist/components/feedback/CircularProgress.md +20 -5
- package/dist/components/feedback/Dialog.md +8 -12
- package/dist/components/feedback/Modal.md +12 -16
- package/dist/components/feedback/Skeleton.md +20 -5
- package/dist/components/inputs/Autocomplete.md +8 -10
- package/dist/components/inputs/Button.md +107 -87
- package/dist/components/inputs/ButtonGroup.md +20 -5
- package/dist/components/inputs/Calendar.md +25 -5
- package/dist/components/inputs/Checkbox.md +171 -450
- package/dist/components/inputs/CurrencyInput.md +25 -5
- package/dist/components/inputs/DatePicker.md +87 -5
- package/dist/components/inputs/DateRangePicker.md +91 -5
- package/dist/components/inputs/FilterMenu.md +85 -9
- package/dist/components/inputs/FilterableCheckboxGroup.md +23 -8
- package/dist/components/inputs/FormControl.md +34 -6
- package/dist/components/inputs/IconButton.md +21 -5
- package/dist/components/inputs/Input.md +254 -68
- package/dist/components/inputs/MonthPicker.md +28 -5
- package/dist/components/inputs/MonthRangePicker.md +26 -5
- package/dist/components/inputs/PercentageInput.md +28 -5
- package/dist/components/inputs/RadioButton.md +26 -5
- package/dist/components/inputs/RadioList.md +23 -6
- package/dist/components/inputs/RadioTileGroup.md +40 -8
- package/dist/components/inputs/Select.md +59 -5
- package/dist/components/inputs/Slider.md +26 -5
- package/dist/components/inputs/Switch.md +23 -5
- package/dist/components/inputs/Textarea.md +27 -5
- package/dist/components/inputs/Uploader/Uploader.md +24 -5
- package/dist/components/layout/Box.md +66 -58
- package/dist/components/layout/Container.md +9 -13
- package/dist/components/layout/Grid.md +91 -75
- package/dist/components/layout/Stack.md +85 -70
- package/dist/components/navigation/Breadcrumbs.md +23 -14
- package/dist/components/navigation/Dropdown.md +29 -20
- package/dist/components/navigation/IconMenuButton.md +24 -11
- package/dist/components/navigation/InsetDrawer.md +16 -5
- package/dist/components/navigation/Link.md +30 -14
- package/dist/components/navigation/Menu.md +33 -20
- package/dist/components/navigation/MenuButton.md +26 -12
- package/dist/components/navigation/NavigationGroup.md +7 -11
- package/dist/components/navigation/NavigationItem.md +8 -12
- package/dist/components/navigation/Navigator.md +5 -9
- package/dist/components/navigation/Pagination.md +21 -12
- package/dist/components/navigation/ProfileMenu.md +17 -5
- package/dist/components/navigation/Stepper.md +18 -5
- package/dist/components/navigation/Tabs.md +37 -14
- package/dist/components/surfaces/Accordions.md +12 -16
- package/dist/components/surfaces/Card.md +59 -47
- package/dist/components/surfaces/Divider.md +70 -61
- package/dist/components/surfaces/Sheet.md +18 -5
- package/dist/index.browser.js +2 -2
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +173 -6
- package/dist/index.js +173 -6
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -172,9 +172,7 @@ When `useMinorUnit` is true, the component converts between display values and m
|
|
|
172
172
|
<CurrencyInput currency="KRW" useMinorUnit value={10000} />
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
##
|
|
176
|
-
|
|
177
|
-
### Product Price Editor
|
|
175
|
+
## Product Price Editor
|
|
178
176
|
|
|
179
177
|
```tsx
|
|
180
178
|
function ProductPriceEditor() {
|
|
@@ -202,7 +200,7 @@ function ProductPriceEditor() {
|
|
|
202
200
|
}
|
|
203
201
|
```
|
|
204
202
|
|
|
205
|
-
|
|
203
|
+
## Invoice Line Item
|
|
206
204
|
|
|
207
205
|
```tsx
|
|
208
206
|
function InvoiceLineItem({ item, onChange }) {
|
|
@@ -221,7 +219,7 @@ function InvoiceLineItem({ item, onChange }) {
|
|
|
221
219
|
}
|
|
222
220
|
```
|
|
223
221
|
|
|
224
|
-
|
|
222
|
+
## Budget Limit Input
|
|
225
223
|
|
|
226
224
|
```tsx
|
|
227
225
|
function BudgetSetting() {
|
|
@@ -261,6 +259,28 @@ function BudgetSetting() {
|
|
|
261
259
|
|
|
262
260
|
5. **Handle negative values carefully**: CurrencyInput supports negative values. If negatives are not valid for your use case, validate in `onChange`.
|
|
263
261
|
|
|
262
|
+
## Props and Customization
|
|
263
|
+
|
|
264
|
+
### Key Props
|
|
265
|
+
|
|
266
|
+
| Prop | Type | Default | Description |
|
|
267
|
+
| -------------- | -------------------------------------------------------- | ------- | -------------------------------------------------------- |
|
|
268
|
+
| `value` | `number` | - | Currency value (controlled mode) |
|
|
269
|
+
| `defaultValue` | `number` | - | Initial currency value (uncontrolled mode) |
|
|
270
|
+
| `onChange` | `(event: { target: { name?, value?: number } }) => void` | - | Callback when the value changes |
|
|
271
|
+
| `currency` | `'USD' \| 'KRW' \| 'CAD'` | `'USD'` | Currency code (determines symbol and formatting) |
|
|
272
|
+
| `useMinorUnit` | `boolean` | `false` | When true, value is in minor units (e.g., cents for USD) |
|
|
273
|
+
| `max` | `number` | - | Maximum allowed value |
|
|
274
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
275
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
276
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
277
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
278
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
279
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
280
|
+
| `placeholder` | `string` | - | Placeholder text when the input is empty |
|
|
281
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
282
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
283
|
+
|
|
264
284
|
## Accessibility
|
|
265
285
|
|
|
266
286
|
- The input has `role="textbox"` with proper labeling via the `label` prop.
|
|
@@ -256,6 +256,54 @@ Common patterns: `YYYY/MM/DD` (default), `YYYY-MM-DD` (ISO 8601), `MM/DD/YYYY` (
|
|
|
256
256
|
|
|
257
257
|
## Additional Features
|
|
258
258
|
|
|
259
|
+
### Presets
|
|
260
|
+
|
|
261
|
+
Use the `presets` prop to display a list of quick-select options alongside the calendar. This is useful when users frequently select common dates like "Today" or a specific day offset. The preset panel appears to the right of the calendar inside the popup.
|
|
262
|
+
|
|
263
|
+
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
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
<DatePicker {...args} value={value} onChange={e => {
|
|
267
|
+
setValue(e.target.value);
|
|
268
|
+
args.onChange?.(e);
|
|
269
|
+
}} presets={[{
|
|
270
|
+
label: 'Today',
|
|
271
|
+
value: fmt(today)
|
|
272
|
+
}, {
|
|
273
|
+
label: 'Yesterday',
|
|
274
|
+
value: daysAgo(1)
|
|
275
|
+
}, {
|
|
276
|
+
label: '3 days ago',
|
|
277
|
+
value: daysAgo(3)
|
|
278
|
+
}, {
|
|
279
|
+
label: '1 week ago',
|
|
280
|
+
value: daysAgo(7)
|
|
281
|
+
}]} />
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import { DatePicker } from '@ceed/ads';
|
|
286
|
+
|
|
287
|
+
function QuickDateSelect() {
|
|
288
|
+
const [date, setDate] = useState('');
|
|
289
|
+
const today = new Date();
|
|
290
|
+
const fmt = (d: Date) =>
|
|
291
|
+
`${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
<DatePicker
|
|
295
|
+
label="Select Date"
|
|
296
|
+
value={date}
|
|
297
|
+
onChange={(e) => setDate(e.target.value)}
|
|
298
|
+
presets={[
|
|
299
|
+
{ label: 'Today', value: fmt(today) },
|
|
300
|
+
{ label: 'Yesterday', value: fmt(new Date(today.getTime() - 86400000)) },
|
|
301
|
+
]}
|
|
302
|
+
/>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
259
307
|
### Reset Button
|
|
260
308
|
|
|
261
309
|
Pair DatePicker with an external reset button to programmatically clear the value.
|
|
@@ -299,9 +347,7 @@ Multiple DatePicker instances can share the same value for dependent field scena
|
|
|
299
347
|
</Stack>
|
|
300
348
|
```
|
|
301
349
|
|
|
302
|
-
##
|
|
303
|
-
|
|
304
|
-
### Form with Validation
|
|
350
|
+
## Form with Validation
|
|
305
351
|
|
|
306
352
|
```tsx
|
|
307
353
|
function BookingForm() {
|
|
@@ -334,7 +380,7 @@ function BookingForm() {
|
|
|
334
380
|
}
|
|
335
381
|
```
|
|
336
382
|
|
|
337
|
-
|
|
383
|
+
## Custom Date Disabling (Weekdays Only)
|
|
338
384
|
|
|
339
385
|
```tsx
|
|
340
386
|
function AppointmentPicker() {
|
|
@@ -358,7 +404,7 @@ function AppointmentPicker() {
|
|
|
358
404
|
}
|
|
359
405
|
```
|
|
360
406
|
|
|
361
|
-
|
|
407
|
+
## Locale-Aware Display
|
|
362
408
|
|
|
363
409
|
```tsx
|
|
364
410
|
function RegionalDateField({ locale }: { locale: string }) {
|
|
@@ -432,6 +478,42 @@ function RegionalDateField({ locale }: { locale: string }) {
|
|
|
432
478
|
<DatePicker value={invalidDate} />
|
|
433
479
|
```
|
|
434
480
|
|
|
481
|
+
## Props and Customization
|
|
482
|
+
|
|
483
|
+
### Key Props
|
|
484
|
+
|
|
485
|
+
| Prop | Type | Default | Description |
|
|
486
|
+
| ------------------- | ------------------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------- |
|
|
487
|
+
| `value` | `string` | - | Selected date string in `format` (controlled mode) |
|
|
488
|
+
| `defaultValue` | `string` | `''` | Initial date string (uncontrolled mode) |
|
|
489
|
+
| `onChange` | `(event: { target: { name?, value: string } }) => void` | - | Callback when the date changes. Value is in `format` |
|
|
490
|
+
| `format` | `string` | `'YYYY/MM/DD'` | Format of the `value` and `onChange` value. Determines the internal data format |
|
|
491
|
+
| `displayFormat` | `string` | `'YYYY/MM/DD'` | Format displayed in the input field. Can differ from `format` for locale display |
|
|
492
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
493
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
494
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
495
|
+
| `required` | `boolean` | `false` | Marks the field as required (adds asterisk to label) |
|
|
496
|
+
| `disabled` | `boolean` | `false` | Disables the entire component |
|
|
497
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
498
|
+
| `minDate` | `string` | - | Minimum selectable date (in `format`) |
|
|
499
|
+
| `maxDate` | `string` | - | Maximum selectable date (in `format`) |
|
|
500
|
+
| `disableFuture` | `boolean` | `false` | Disables all future dates |
|
|
501
|
+
| `disablePast` | `boolean` | `false` | Disables all past dates |
|
|
502
|
+
| `shouldDisableDate` | `(date: string) => boolean` | - | Custom function to disable specific dates. Receives date in `format`. Return `true` to disable |
|
|
503
|
+
| `inputReadOnly` | `boolean` | `false` | Prevents keyboard typing in the input (users must use the calendar popup) |
|
|
504
|
+
| `hideClearButton` | `boolean` | `false` | Hides the clear button in the calendar popup |
|
|
505
|
+
|
|
506
|
+
### format vs displayFormat
|
|
507
|
+
|
|
508
|
+
| Prop | Controls | Example |
|
|
509
|
+
| --------------- | ------------------------------------------------------ | ------------------------------------------------- |
|
|
510
|
+
| `format` | Value in `onChange`, `value`, and `defaultValue` props | `'YYYY-MM-DD'` → onChange receives `'2024-05-03'` |
|
|
511
|
+
| `displayFormat` | What the user sees in the input field | `'MM/DD/YYYY'` → input shows `05/03/2024` |
|
|
512
|
+
|
|
513
|
+
When both are set, the component converts between formats internally. This lets you keep a consistent API format while showing locale-appropriate display.
|
|
514
|
+
|
|
515
|
+
> **Note**: DatePicker also accepts all Input props (e.g., `size`, `variant`, `color`, `startDecorator`, `placeholder`, `sx`).
|
|
516
|
+
|
|
435
517
|
## Accessibility
|
|
436
518
|
|
|
437
519
|
- **Keyboard navigation**: Tab moves focus between the input and the calendar toggle button. Arrow keys navigate dates within the open calendar. Enter selects the focused date, and Escape closes the calendar popup.
|
|
@@ -339,6 +339,68 @@ Fully read-only state where neither typing nor calendar selection is available.
|
|
|
339
339
|
|
|
340
340
|
## Additional Options
|
|
341
341
|
|
|
342
|
+
### Presets
|
|
343
|
+
|
|
344
|
+
Use the `presets` prop to display quick-select options alongside the calendar, such as "Last 7 days" or "Last 1 month". The preset panel appears to the right of the calendar inside the popup, providing one-click access to commonly used date ranges.
|
|
345
|
+
|
|
346
|
+
Each preset's `value` must match the component's `format` prop and use the `-` separator (e.g., `"2026/03/01 - 2026/04/03"`). 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 range on the calendar.
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
<DateRangePicker {...args} value={value} onChange={e => {
|
|
350
|
+
setValue(e.target.value);
|
|
351
|
+
args.onChange?.(e);
|
|
352
|
+
}} presets={[{
|
|
353
|
+
label: 'Today',
|
|
354
|
+
value: `${fmt(today)} - ${fmt(today)}`
|
|
355
|
+
}, {
|
|
356
|
+
label: 'Last 3 days',
|
|
357
|
+
value: range(3)
|
|
358
|
+
}, {
|
|
359
|
+
label: 'Last 7 days',
|
|
360
|
+
value: range(7)
|
|
361
|
+
}, {
|
|
362
|
+
label: 'Last 1 month',
|
|
363
|
+
value: range(1, 'months')
|
|
364
|
+
}, {
|
|
365
|
+
label: 'Last 3 months',
|
|
366
|
+
value: range(3, 'months')
|
|
367
|
+
}, {
|
|
368
|
+
label: 'Last 6 months',
|
|
369
|
+
value: range(6, 'months')
|
|
370
|
+
}]} />
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
import { DateRangePicker } from '@ceed/ads';
|
|
375
|
+
|
|
376
|
+
function ReportFilter() {
|
|
377
|
+
const [dateRange, setDateRange] = useState('');
|
|
378
|
+
const today = new Date();
|
|
379
|
+
const fmt = (d: Date) =>
|
|
380
|
+
`${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
|
|
381
|
+
const monthsAgo = (n: number) => {
|
|
382
|
+
const d = new Date(today);
|
|
383
|
+
d.setMonth(d.getMonth() - n);
|
|
384
|
+
return `${fmt(d)} - ${fmt(today)}`;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
return (
|
|
388
|
+
<DateRangePicker
|
|
389
|
+
label="Report Period"
|
|
390
|
+
value={dateRange}
|
|
391
|
+
onChange={(e) => setDateRange(e.target.value)}
|
|
392
|
+
disableFuture
|
|
393
|
+
presets={[
|
|
394
|
+
{ label: 'Last 7 days', value: `${fmt(new Date(today.getTime() - 7 * 86400000))} - ${fmt(today)}` },
|
|
395
|
+
{ label: 'Last 1 month', value: monthsAgo(1) },
|
|
396
|
+
{ label: 'Last 3 months', value: monthsAgo(3) },
|
|
397
|
+
{ label: 'Last 6 months', value: monthsAgo(6) },
|
|
398
|
+
]}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
342
404
|
### Hide Clear Button
|
|
343
405
|
|
|
344
406
|
Remove the clear button from the calendar popup using `hideClearButton`.
|
|
@@ -367,9 +429,7 @@ Example of integrating an external reset button to clear the selected date range
|
|
|
367
429
|
</div>
|
|
368
430
|
```
|
|
369
431
|
|
|
370
|
-
##
|
|
371
|
-
|
|
372
|
-
### Booking Form
|
|
432
|
+
## Booking Form
|
|
373
433
|
|
|
374
434
|
```tsx
|
|
375
435
|
function BookingForm() {
|
|
@@ -403,7 +463,7 @@ function BookingForm() {
|
|
|
403
463
|
}
|
|
404
464
|
```
|
|
405
465
|
|
|
406
|
-
|
|
466
|
+
## Report Date Filter
|
|
407
467
|
|
|
408
468
|
```tsx
|
|
409
469
|
function ReportFilters({ onFilter }) {
|
|
@@ -431,7 +491,7 @@ function ReportFilters({ onFilter }) {
|
|
|
431
491
|
}
|
|
432
492
|
```
|
|
433
493
|
|
|
434
|
-
|
|
494
|
+
## Separate API and Display Formats
|
|
435
495
|
|
|
436
496
|
```tsx
|
|
437
497
|
function DataExport() {
|
|
@@ -500,6 +560,32 @@ const getDuration = (value) => {
|
|
|
500
560
|
<DateRangePicker helperText={getDuration(dateRange)} />
|
|
501
561
|
```
|
|
502
562
|
|
|
563
|
+
## Props and Customization
|
|
564
|
+
|
|
565
|
+
### Key Props
|
|
566
|
+
|
|
567
|
+
| Prop | Type | Default | Description |
|
|
568
|
+
| ----------------- | ------------------------------------------------------- | -------------- | -------------------------------------------------------- |
|
|
569
|
+
| `value` | `string` | - | Selected date range string in `format` (controlled mode) |
|
|
570
|
+
| `defaultValue` | `string` | `''` | Initial date range string (uncontrolled mode) |
|
|
571
|
+
| `onChange` | `(event: { target: { name?, value: string } }) => void` | - | Callback when the date range changes |
|
|
572
|
+
| `format` | `string` | `'YYYY/MM/DD'` | Format of the `value` and `onChange` value |
|
|
573
|
+
| `displayFormat` | `string` | `'YYYY/MM/DD'` | Format displayed in the input field |
|
|
574
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
575
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
576
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
577
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
578
|
+
| `disabled` | `boolean` | `false` | Disables the entire component |
|
|
579
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
580
|
+
| `minDate` | `string` | - | Minimum selectable date (in `format`) |
|
|
581
|
+
| `maxDate` | `string` | - | Maximum selectable date (in `format`) |
|
|
582
|
+
| `disableFuture` | `boolean` | `false` | Disables all future dates |
|
|
583
|
+
| `disablePast` | `boolean` | `false` | Disables all past dates |
|
|
584
|
+
| `inputReadOnly` | `boolean` | `false` | Prevents keyboard typing (calendar-only input) |
|
|
585
|
+
| `hideClearButton` | `boolean` | `false` | Hides the clear button in the calendar popup |
|
|
586
|
+
|
|
587
|
+
> **Note**: DateRangePicker also accepts all Input props (e.g., `size`, `variant`, `color`, `sx`).
|
|
588
|
+
|
|
503
589
|
## Accessibility
|
|
504
590
|
|
|
505
591
|
- The input has `role="textbox"` and the calendar button has `aria-label="Toggle Calendar"` for screen reader identification.
|
|
@@ -199,9 +199,7 @@ A searchable single-select filter with autocomplete support.
|
|
|
199
199
|
}
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
##
|
|
203
|
-
|
|
204
|
-
### Controlled Mode
|
|
202
|
+
## Controlled FilterMenu
|
|
205
203
|
|
|
206
204
|
In controlled mode, you manage the filter state externally using `values` (or `defaultValues` with an `onChange` handler).
|
|
207
205
|
|
|
@@ -212,7 +210,7 @@ In controlled mode, you manage the filter state externally using `values` (or `d
|
|
|
212
210
|
}} />
|
|
213
211
|
```
|
|
214
212
|
|
|
215
|
-
|
|
213
|
+
## Uncontrolled FilterMenu
|
|
216
214
|
|
|
217
215
|
In uncontrolled mode, FilterMenu manages its own internal state. This is useful when you only need the final filter values on submission.
|
|
218
216
|
|
|
@@ -220,9 +218,7 @@ In uncontrolled mode, FilterMenu manages its own internal state. This is useful
|
|
|
220
218
|
<FilterMenu />
|
|
221
219
|
```
|
|
222
220
|
|
|
223
|
-
##
|
|
224
|
-
|
|
225
|
-
### Table Filters
|
|
221
|
+
## Table Filters
|
|
226
222
|
|
|
227
223
|
```tsx
|
|
228
224
|
function DataTable() {
|
|
@@ -266,7 +262,7 @@ function DataTable() {
|
|
|
266
262
|
}
|
|
267
263
|
```
|
|
268
264
|
|
|
269
|
-
|
|
265
|
+
## Dashboard Filters
|
|
270
266
|
|
|
271
267
|
```tsx
|
|
272
268
|
function DashboardFilters({ onFilterChange }) {
|
|
@@ -300,7 +296,7 @@ function DashboardFilters({ onFilterChange }) {
|
|
|
300
296
|
}
|
|
301
297
|
```
|
|
302
298
|
|
|
303
|
-
|
|
299
|
+
## Invoice Filters
|
|
304
300
|
|
|
305
301
|
```tsx
|
|
306
302
|
function InvoiceFilters({ onFilterChange }) {
|
|
@@ -372,6 +368,86 @@ filters={[
|
|
|
372
368
|
|
|
373
369
|
5. **Prefer controlled mode for complex state**: When filter values need to be synced with URL parameters, API requests, or other UI elements, use the controlled pattern with `values` and `onChange`.
|
|
374
370
|
|
|
371
|
+
## Props and Customization
|
|
372
|
+
|
|
373
|
+
### FilterMenu Props
|
|
374
|
+
|
|
375
|
+
| Prop | Type | Default | Description |
|
|
376
|
+
| --------------- | --------------------------------------- | ------- | ------------------------------------------------------ |
|
|
377
|
+
| `filters` | `FilterItem[]` | `[]` | Array of filter item configurations |
|
|
378
|
+
| `values` | `Record<string, any>` | - | Controlled filter values (keyed by filter `id`) |
|
|
379
|
+
| `defaultValues` | `Record<string, any>` | - | Initial filter values for uncontrolled mode |
|
|
380
|
+
| `resetValues` | `Record<string, any>` | `{}` | Values applied when Reset/Clear button is clicked |
|
|
381
|
+
| `onChange` | `(values: Record<string, any>) => void` | - | Callback when Apply button is clicked |
|
|
382
|
+
| `onClose` | `() => void` | - | Callback when the filter panel closes |
|
|
383
|
+
| `useReset` | `boolean` | `false` | Show a Reset button (requires 2+ filters) |
|
|
384
|
+
| `useClear` | `boolean` | `false` | Show a Clear button (for single-filter scenarios only) |
|
|
385
|
+
|
|
386
|
+
### FilterItem Union Type
|
|
387
|
+
|
|
388
|
+
All filter items share a base shape with `id`, `label`, `hidden`, `value`, and `onChange`. The `type` field determines the specific filter UI:
|
|
389
|
+
|
|
390
|
+
```tsx
|
|
391
|
+
type FilterItem =
|
|
392
|
+
| FilterCheckboxGroupItem
|
|
393
|
+
| FilterableCheckboxGroupItem
|
|
394
|
+
| FilterRadioGroupItem
|
|
395
|
+
| FilterDateRangeItem
|
|
396
|
+
| FilterCurrencyInputItem
|
|
397
|
+
| FilterCurrencyRangeItem
|
|
398
|
+
| FilterPercentageInputItem
|
|
399
|
+
| FilterPercentageRangeItem
|
|
400
|
+
| FilterAutocompleteItem;
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Filter Item Types Reference
|
|
404
|
+
|
|
405
|
+
| Type | Value Type | Description |
|
|
406
|
+
| ----------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
407
|
+
| `'checkbox-group'` | `(string \| number)[]` | Multi-select with checkboxes |
|
|
408
|
+
| `'filterable-checkbox-group'` | `string[]` | Searchable multi-select with checkboxes. Supports `placeholder` and `maxHeight` |
|
|
409
|
+
| `'radio-group'` | `string \| number` | Single-select with radio buttons |
|
|
410
|
+
| `'date-range'` | `[string, string]` | Date range picker. Supports `displayFormat`, `inputReadOnly`, `hideClearButton`, `minDate`, `maxDate`, `disableFuture`, `disablePast` |
|
|
411
|
+
| `'currency-input'` | `number` | Single currency value. Supports `currency`, `useMinorUnit`, `max`, `placeholder` |
|
|
412
|
+
| `'currency-range'` | `[number, number]` | Currency range (min/max). Supports same props as currency-input |
|
|
413
|
+
| `'percentage-input'` | `number` | Single percentage value. Supports `useMinorUnit`, `maxDecimalScale`, `min`, `max`, `placeholder` |
|
|
414
|
+
| `'percentage-range'` | `[number, number]` | Percentage range (min/max). Supports same props as percentage-input |
|
|
415
|
+
| `'autocomplete'` | `string \| number` | Searchable single-select. Supports `options`, `multiple`, `placeholder` |
|
|
416
|
+
|
|
417
|
+
### Filter Item Common Props
|
|
418
|
+
|
|
419
|
+
| Prop | Type | Default | Description |
|
|
420
|
+
| ---------- | ----------------- | ---------- | ---------------------------------------------------------- |
|
|
421
|
+
| `id` | `string` | (required) | Unique identifier — used as the key in values/onChange |
|
|
422
|
+
| `label` | `string` | (required) | Display label for the filter section |
|
|
423
|
+
| `hidden` | `boolean` | `false` | Hide the filter without removing it from the configuration |
|
|
424
|
+
| `value` | varies by type | - | Controlled value for individual filter |
|
|
425
|
+
| `onChange` | `(value) => void` | - | Individual change handler (only in controlled mode) |
|
|
426
|
+
|
|
427
|
+
### Complete Filter Item Examples
|
|
428
|
+
|
|
429
|
+
```tsx
|
|
430
|
+
// checkbox-group
|
|
431
|
+
{ id: 'status', type: 'checkbox-group', label: 'Status',
|
|
432
|
+
options: [{ label: 'Active', value: 'active' }, { label: 'Inactive', value: 'inactive' }] }
|
|
433
|
+
|
|
434
|
+
// filterable-checkbox-group with maxHeight
|
|
435
|
+
{ id: 'categories', type: 'filterable-checkbox-group', label: 'Categories',
|
|
436
|
+
options: categories, placeholder: 'Search...', maxHeight: 200 }
|
|
437
|
+
|
|
438
|
+
// date-range with display format
|
|
439
|
+
{ id: 'dateRange', type: 'date-range', label: 'Date Range',
|
|
440
|
+
displayFormat: 'MM/DD/YYYY', inputReadOnly: true }
|
|
441
|
+
|
|
442
|
+
// currency-range with minor units
|
|
443
|
+
{ id: 'amount', type: 'currency-range', label: 'Amount',
|
|
444
|
+
currency: 'USD', useMinorUnit: true }
|
|
445
|
+
|
|
446
|
+
// autocomplete
|
|
447
|
+
{ id: 'category', type: 'autocomplete', label: 'Category',
|
|
448
|
+
options: ['Cat 1', 'Cat 2', 'Cat 3'], placeholder: 'Select...' }
|
|
449
|
+
```
|
|
450
|
+
|
|
375
451
|
## Accessibility
|
|
376
452
|
|
|
377
453
|
- Each filter section is labeled with its `label` prop, providing clear context for screen readers.
|
|
@@ -6,10 +6,10 @@ FilterableCheckboxGroup is a multi-select component that combines a search input
|
|
|
6
6
|
|
|
7
7
|
Key capabilities include a "Select all" toggle for bulk selection, automatic sorting (selected items first, then alphabetical), customizable list height, and built-in form integration via `label`, `helperText`, and `required` props. The component accepts options as either simple strings or `{ value, label }` objects.
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **Using built-in props is recommended when building forms**
|
|
10
10
|
>
|
|
11
|
-
>
|
|
12
|
-
>
|
|
11
|
+
> This component provides built-in form-related props such as `label` and `helperText`.
|
|
12
|
+
> When building a form, use the component's built-in props instead of creating separate labels or helper text with Typography.
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
<FilterableCheckboxGroup
|
|
@@ -224,9 +224,7 @@ The component supports both full and partial disabling.
|
|
|
224
224
|
</Stack>
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
##
|
|
228
|
-
|
|
229
|
-
### Filter Panel
|
|
227
|
+
## Filter Panel
|
|
230
228
|
|
|
231
229
|
Use FilterableCheckboxGroup in a sidebar or panel to let users filter a data table or list by multiple criteria.
|
|
232
230
|
|
|
@@ -254,7 +252,7 @@ function FilterPanel({ categories, onFilterChange }) {
|
|
|
254
252
|
}
|
|
255
253
|
```
|
|
256
254
|
|
|
257
|
-
|
|
255
|
+
## User Role Assignment
|
|
258
256
|
|
|
259
257
|
Assign multiple roles to a user from a searchable list.
|
|
260
258
|
|
|
@@ -276,7 +274,7 @@ Assign multiple roles to a user from a searchable list.
|
|
|
276
274
|
/>
|
|
277
275
|
```
|
|
278
276
|
|
|
279
|
-
|
|
277
|
+
## Region / Country Selection
|
|
280
278
|
|
|
281
279
|
When dealing with a large set of options like countries, the search filter and virtual scrolling work together for fast selection.
|
|
282
280
|
|
|
@@ -310,6 +308,23 @@ When dealing with a large set of options like countries, the search filter and v
|
|
|
310
308
|
|
|
311
309
|
5. **Keep option labels concise.** Long labels will be truncated with an ellipsis. If detailed descriptions are needed, consider using a tooltip or a separate detail view.
|
|
312
310
|
|
|
311
|
+
## Props and Customization
|
|
312
|
+
|
|
313
|
+
### Key Props
|
|
314
|
+
|
|
315
|
+
| Prop | Type | Default | Description |
|
|
316
|
+
| ------------- | -------------------------------------------------------- | ---------- | --------------------------------------------------- |
|
|
317
|
+
| `options` | `{ value: string; label: string; disabled?: boolean }[]` | (required) | Array of checkbox options |
|
|
318
|
+
| `value` | `string[]` | - | Selected values (controlled mode) |
|
|
319
|
+
| `onChange` | `(value: string[]) => void` | - | Callback when selection changes |
|
|
320
|
+
| `label` | `ReactNode` | - | Group label displayed above the component |
|
|
321
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the component |
|
|
322
|
+
| `placeholder` | `string` | - | Placeholder text for the search input |
|
|
323
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
324
|
+
| `disabled` | `boolean` | `false` | Disables all checkboxes |
|
|
325
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Component size |
|
|
326
|
+
| `maxHeight` | `string \| number` | `300` | Maximum height of the options list before scrolling |
|
|
327
|
+
|
|
313
328
|
## Accessibility
|
|
314
329
|
|
|
315
330
|
- The search input is labeled by the component's `label` prop, ensuring screen readers announce its purpose.
|
|
@@ -224,9 +224,7 @@ FormHelperText provides supplementary guidance below the input. It automatically
|
|
|
224
224
|
</FormControl>
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
##
|
|
228
|
-
|
|
229
|
-
### Registration Form
|
|
227
|
+
## Registration Form
|
|
230
228
|
|
|
231
229
|
```tsx
|
|
232
230
|
function RegistrationForm() {
|
|
@@ -260,7 +258,7 @@ function RegistrationForm() {
|
|
|
260
258
|
}
|
|
261
259
|
```
|
|
262
260
|
|
|
263
|
-
|
|
261
|
+
## Settings Form with Mixed Controls
|
|
264
262
|
|
|
265
263
|
```tsx
|
|
266
264
|
function SettingsForm() {
|
|
@@ -294,8 +292,8 @@ function SettingsForm() {
|
|
|
294
292
|
|
|
295
293
|
> **Tip: Use built-in form props instead**
|
|
296
294
|
>
|
|
297
|
-
> Input, Select, Textarea, DatePicker
|
|
298
|
-
>
|
|
295
|
+
> Input-family components such as Input, Select, Textarea, and DatePicker support `label` and `helperText` props directly.
|
|
296
|
+
> For simple form fields, using each component's built-in props is more concise.
|
|
299
297
|
>
|
|
300
298
|
> ```tsx
|
|
301
299
|
> // ✅ Simpler: built-in props
|
|
@@ -352,6 +350,36 @@ function SettingsForm() {
|
|
|
352
350
|
|
|
353
351
|
5. **Provide helpful error messages**: When using the error state, always include a FormHelperText explaining what went wrong and how to fix it.
|
|
354
352
|
|
|
353
|
+
## Props and Customization
|
|
354
|
+
|
|
355
|
+
### FormControl Props
|
|
356
|
+
|
|
357
|
+
| Prop | Type | Default | Description |
|
|
358
|
+
| ------------- | -------------------------------------------------------------- | ------------ | ----------------------------------------------------------------- |
|
|
359
|
+
| `children` | `ReactNode` | - | Form field elements (FormLabel, Input, FormHelperText, etc.) |
|
|
360
|
+
| `error` | `boolean` | `false` | Applies error styling to child components |
|
|
361
|
+
| `disabled` | `boolean` | `false` | Disables all child form elements |
|
|
362
|
+
| `required` | `boolean` | `false` | Adds required indicator to FormLabel and `aria-required` to input |
|
|
363
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size applied to child components |
|
|
364
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
365
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'vertical'` | Layout direction |
|
|
366
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
367
|
+
|
|
368
|
+
### FormLabel Props
|
|
369
|
+
|
|
370
|
+
| Prop | Type | Default | Description |
|
|
371
|
+
| ---------- | ----------- | ------- | ------------------------------------------------------- |
|
|
372
|
+
| `children` | `ReactNode` | - | Label text |
|
|
373
|
+
| `required` | `boolean` | - | Shows asterisk (inherited from FormControl when nested) |
|
|
374
|
+
|
|
375
|
+
### FormHelperText Props
|
|
376
|
+
|
|
377
|
+
| Prop | Type | Default | Description |
|
|
378
|
+
| ---------- | ----------- | ------- | ---------------------------- |
|
|
379
|
+
| `children` | `ReactNode` | - | Helper or error message text |
|
|
380
|
+
|
|
381
|
+
> **Note**: FormControl, FormLabel, and FormHelperText accept all their respective Joy UI props.
|
|
382
|
+
|
|
355
383
|
## Accessibility
|
|
356
384
|
|
|
357
385
|
- FormControl automatically associates FormLabel with the input using `htmlFor` and `id`.
|
|
@@ -294,9 +294,7 @@ A practical example of IconButton used for common CRUD operations with distinct
|
|
|
294
294
|
</div>
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
##
|
|
298
|
-
|
|
299
|
-
### Table Row Actions
|
|
297
|
+
## Table Row Actions
|
|
300
298
|
|
|
301
299
|
```tsx
|
|
302
300
|
import { IconButton, Tooltip } from '@ceed/ads';
|
|
@@ -327,7 +325,7 @@ function RowActions({ onView, onEdit, onDelete }) {
|
|
|
327
325
|
}
|
|
328
326
|
```
|
|
329
327
|
|
|
330
|
-
|
|
328
|
+
## Dialog Close Button
|
|
331
329
|
|
|
332
330
|
```tsx
|
|
333
331
|
import CloseIcon from '@mui/icons-material/Close';
|
|
@@ -344,7 +342,7 @@ import CloseIcon from '@mui/icons-material/Close';
|
|
|
344
342
|
</IconButton>
|
|
345
343
|
```
|
|
346
344
|
|
|
347
|
-
|
|
345
|
+
## Navigation Back Button
|
|
348
346
|
|
|
349
347
|
```tsx
|
|
350
348
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
@@ -402,6 +400,24 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
|
402
400
|
|
|
403
401
|
5. **Maintain consistent sizing within the same context.** Use the same `size` and `variant` for all IconButtons in a toolbar or action group to keep the interface clean and predictable.
|
|
404
402
|
|
|
403
|
+
## Props and Customization
|
|
404
|
+
|
|
405
|
+
### Key Props
|
|
406
|
+
|
|
407
|
+
| Prop | Type | Default | Description |
|
|
408
|
+
| ----------- | -------------------------------------------------------------- | ----------- | ---------------------------------------- |
|
|
409
|
+
| `children` | `ReactNode` | - | Icon element to render inside the button |
|
|
410
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'plain'` | Visual style |
|
|
411
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
412
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
413
|
+
| `disabled` | `boolean` | `false` | Disables the button |
|
|
414
|
+
| `loading` | `boolean` | `false` | Shows a loading indicator |
|
|
415
|
+
| `component` | `ElementType` | `'button'` | Root element type (polymorphic) |
|
|
416
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Click event handler |
|
|
417
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
418
|
+
|
|
419
|
+
> **Note**: IconButton also accepts all Joy UI IconButton props and Framer Motion props.
|
|
420
|
+
|
|
405
421
|
## Accessibility
|
|
406
422
|
|
|
407
423
|
- **`aria-label` is essential**: Every IconButton must have either an `aria-label`, `aria-labelledby`, or a wrapping Tooltip with `title` to provide a text alternative for screen readers.
|