@ceed/ads 1.30.0 → 1.31.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/Overview.md +5 -5
- package/dist/components/Calendar/utils/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/MonthRangePicker/MonthRangePicker.d.ts +8 -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 +59 -5
- package/dist/components/inputs/DateRangePicker.md +46 -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 +59 -5
- package/dist/components/inputs/MonthRangePicker.md +44 -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 +4 -4
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +99 -39
- package/dist/index.js +99 -39
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -194,9 +194,7 @@ When `useMinorUnit` is `true`, the component converts between display values and
|
|
|
194
194
|
<PercentageInput useMinorUnit={false} maxDecimalScale={2} value={20.12} />
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
##
|
|
198
|
-
|
|
199
|
-
### Discount Configuration
|
|
197
|
+
## Discount Configuration
|
|
200
198
|
|
|
201
199
|
```tsx
|
|
202
200
|
function DiscountSetting() {
|
|
@@ -215,7 +213,7 @@ function DiscountSetting() {
|
|
|
215
213
|
}
|
|
216
214
|
```
|
|
217
215
|
|
|
218
|
-
|
|
216
|
+
## Tax Rate Settings
|
|
219
217
|
|
|
220
218
|
```tsx
|
|
221
219
|
function TaxRateForm() {
|
|
@@ -240,7 +238,7 @@ function TaxRateForm() {
|
|
|
240
238
|
}
|
|
241
239
|
```
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
## Progress / Completion Tracker
|
|
244
242
|
|
|
245
243
|
```tsx
|
|
246
244
|
function CompletionTracker({ value, onChange }) {
|
|
@@ -277,6 +275,31 @@ function CompletionTracker({ value, onChange }) {
|
|
|
277
275
|
|
|
278
276
|
5. **Handle edge cases**: Consider what happens at boundary values (0%, 100%) and negative percentages if allowed.
|
|
279
277
|
|
|
278
|
+
## Props and Customization
|
|
279
|
+
|
|
280
|
+
### Key Props
|
|
281
|
+
|
|
282
|
+
| Prop | Type | Default | Description |
|
|
283
|
+
| ----------------- | -------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
284
|
+
| `value` | `number` | - | Percentage value (controlled mode) |
|
|
285
|
+
| `defaultValue` | `number` | - | Initial percentage value (uncontrolled mode) |
|
|
286
|
+
| `onChange` | `(event: { target: { name?, value?: number } }) => void` | - | Callback when the value changes |
|
|
287
|
+
| `useMinorUnit` | `boolean` | `false` | When true, value is in basis points (e.g., 1000 = 10%) |
|
|
288
|
+
| `maxDecimalScale` | `number` | `0` | Maximum number of decimal places |
|
|
289
|
+
| `min` | `number` | - | Minimum allowed percentage value |
|
|
290
|
+
| `max` | `number` | - | Maximum allowed percentage value |
|
|
291
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
292
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
293
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
294
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
295
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
296
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
297
|
+
| `placeholder` | `string` | - | Placeholder text when the input is empty |
|
|
298
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
299
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
300
|
+
|
|
301
|
+
> **Note**: PercentageInput also accepts all Input props and Framer Motion props.
|
|
302
|
+
|
|
280
303
|
## Accessibility
|
|
281
304
|
|
|
282
305
|
- The input has proper labeling via the `label` prop, linked with `aria-labelledby`.
|
|
@@ -336,9 +336,7 @@ Size
|
|
|
336
336
|
</Box>
|
|
337
337
|
```
|
|
338
338
|
|
|
339
|
-
##
|
|
340
|
-
|
|
341
|
-
### Survey / Questionnaire Form
|
|
339
|
+
## Survey Questionnaire Form
|
|
342
340
|
|
|
343
341
|
```tsx
|
|
344
342
|
function SurveyQuestion() {
|
|
@@ -363,7 +361,7 @@ function SurveyQuestion() {
|
|
|
363
361
|
}
|
|
364
362
|
```
|
|
365
363
|
|
|
366
|
-
|
|
364
|
+
## Payment Method Selection
|
|
367
365
|
|
|
368
366
|
```tsx
|
|
369
367
|
function PaymentMethodSelector() {
|
|
@@ -407,7 +405,7 @@ function PaymentMethodSelector() {
|
|
|
407
405
|
}
|
|
408
406
|
```
|
|
409
407
|
|
|
410
|
-
|
|
408
|
+
## Shipping Speed Selection
|
|
411
409
|
|
|
412
410
|
```tsx
|
|
413
411
|
function ShippingOptions() {
|
|
@@ -470,6 +468,29 @@ function ShippingOptions() {
|
|
|
470
468
|
|
|
471
469
|
5. **Use vertical layout by default**: Vertical lists are easier to scan. Only use horizontal (`orientation="horizontal"`) when options are very short (e.g., segmented controls).
|
|
472
470
|
|
|
471
|
+
## Props and Customization
|
|
472
|
+
|
|
473
|
+
### Key Props
|
|
474
|
+
|
|
475
|
+
| Prop | Type | Default | Description |
|
|
476
|
+
| ---------------- | -------------------------------------------------------------- | ------------ | --------------------------------------------- |
|
|
477
|
+
| `checked` | `boolean` | - | Whether the radio is selected (controlled) |
|
|
478
|
+
| `defaultChecked` | `boolean` | `false` | Initial selected state (uncontrolled) |
|
|
479
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when the state changes |
|
|
480
|
+
| `label` | `ReactNode` | - | Label content displayed next to the radio |
|
|
481
|
+
| `value` | `string` | - | Value attribute for form submission |
|
|
482
|
+
| `name` | `string` | - | Groups radios together for mutual exclusivity |
|
|
483
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
484
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Radio button size |
|
|
485
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'outlined'` | Visual style |
|
|
486
|
+
| `disabled` | `boolean` | `false` | Disables the radio button |
|
|
487
|
+
| `overlay` | `boolean` | `false` | Extends clickable area to parent container |
|
|
488
|
+
| `disableIcon` | `boolean` | `false` | Hides the radio icon |
|
|
489
|
+
| `checkedIcon` | `ReactNode` | - | Custom icon for the checked state |
|
|
490
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
491
|
+
|
|
492
|
+
> **Note**: RadioButton also accepts all Joy UI Radio props and Framer Motion props.
|
|
493
|
+
|
|
473
494
|
## Accessibility
|
|
474
495
|
|
|
475
496
|
- **Keyboard navigation**: Users can move between options using `Arrow Up` / `Arrow Down` (vertical) or `Arrow Left` / `Arrow Right` (horizontal). `Space` selects the focused option.
|
|
@@ -151,9 +151,7 @@ Five semantic colors are available via the `color` prop.
|
|
|
151
151
|
</Stack>
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
##
|
|
155
|
-
|
|
156
|
-
### Settings Selection
|
|
154
|
+
## Settings Selection
|
|
157
155
|
|
|
158
156
|
```tsx
|
|
159
157
|
function LanguageSetting() {
|
|
@@ -165,7 +163,7 @@ function LanguageSetting() {
|
|
|
165
163
|
<RadioList
|
|
166
164
|
items={[
|
|
167
165
|
{ label: 'English', value: 'en' },
|
|
168
|
-
{ label: '
|
|
166
|
+
{ label: 'Korean', value: 'ko' },
|
|
169
167
|
{ label: '日本語', value: 'ja' },
|
|
170
168
|
]}
|
|
171
169
|
value={language}
|
|
@@ -176,7 +174,7 @@ function LanguageSetting() {
|
|
|
176
174
|
}
|
|
177
175
|
```
|
|
178
176
|
|
|
179
|
-
|
|
177
|
+
## Survey Options
|
|
180
178
|
|
|
181
179
|
```tsx
|
|
182
180
|
function SatisfactionSurvey() {
|
|
@@ -198,7 +196,7 @@ function SatisfactionSurvey() {
|
|
|
198
196
|
}
|
|
199
197
|
```
|
|
200
198
|
|
|
201
|
-
|
|
199
|
+
## Dynamic Options from API
|
|
202
200
|
|
|
203
201
|
```tsx
|
|
204
202
|
function RoleSelector({ roles }: { roles: { id: string; name: string }[] }) {
|
|
@@ -233,6 +231,25 @@ function RoleSelector({ roles }: { roles: { id: string; name: string }[] }) {
|
|
|
233
231
|
|
|
234
232
|
5. **Use horizontal layout sparingly**: Horizontal orientation works well for 2–4 short options. For longer lists, vertical is more readable.
|
|
235
233
|
|
|
234
|
+
## Props and Customization
|
|
235
|
+
|
|
236
|
+
### Key Props
|
|
237
|
+
|
|
238
|
+
| Prop | Type | Default | Description |
|
|
239
|
+
| -------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------ |
|
|
240
|
+
| `items` | `{ label: ReactNode; value: string }[]` | (required) | Array of radio options |
|
|
241
|
+
| `value` | `string` | - | Selected value (controlled mode) |
|
|
242
|
+
| `defaultValue` | `string` | - | Initial selected value (uncontrolled mode) |
|
|
243
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when selection changes |
|
|
244
|
+
| `name` | `string` | - | Groups radios together for form submission |
|
|
245
|
+
| `disabled` | `boolean` | `false` | Disables all radio buttons |
|
|
246
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'vertical'` | Layout orientation |
|
|
247
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Radio button size |
|
|
248
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
249
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
250
|
+
|
|
251
|
+
> **Note**: RadioList also accepts all Joy UI RadioGroup props.
|
|
252
|
+
|
|
236
253
|
## Accessibility
|
|
237
254
|
|
|
238
255
|
- RadioList renders a `<RadioGroup>` with `role="radiogroup"`, and each option is a `<Radio>` with `role="radio"`.
|
|
@@ -6,10 +6,10 @@ RadioTileGroup is a selection component that displays radio options as visually
|
|
|
6
6
|
|
|
7
7
|
The component supports flexible layouts (horizontal, grid, vertical), icons via `startDecorator`, three sizes, and built-in form integration with `label`, `helperText`, `error`, and `required` props. It works in both controlled and uncontrolled modes.
|
|
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
|
<RadioTileGroup
|
|
@@ -363,9 +363,7 @@ Combine `required`, `error`, and `helperText` to build a complete form validatio
|
|
|
363
363
|
</Stack>
|
|
364
364
|
```
|
|
365
365
|
|
|
366
|
-
##
|
|
367
|
-
|
|
368
|
-
### Shipping Method Selection
|
|
366
|
+
## Shipping Method Selection
|
|
369
367
|
|
|
370
368
|
Display delivery options with icons so users can choose intuitively.
|
|
371
369
|
|
|
@@ -411,7 +409,7 @@ import BusinessIcon from '@mui/icons-material/Business';
|
|
|
411
409
|
</Box>
|
|
412
410
|
```
|
|
413
411
|
|
|
414
|
-
|
|
412
|
+
## Survey / Preference Selection
|
|
415
413
|
|
|
416
414
|
Present survey options with icons in a multi-column grid for a clear, scannable layout.
|
|
417
415
|
|
|
@@ -456,7 +454,7 @@ Present survey options with icons in a multi-column grid for a clear, scannable
|
|
|
456
454
|
</Box>
|
|
457
455
|
```
|
|
458
456
|
|
|
459
|
-
|
|
457
|
+
## Pricing Plan Picker
|
|
460
458
|
|
|
461
459
|
Use a vertical layout with `columns={1}` for plan or tier selection.
|
|
462
460
|
|
|
@@ -499,6 +497,40 @@ Use a vertical layout with `columns={1}` for plan or tier selection.
|
|
|
499
497
|
|
|
500
498
|
5. **Always provide an error message.** When `error` is true, update `helperText` to explain the validation issue so users know how to fix it.
|
|
501
499
|
|
|
500
|
+
## Props and Customization
|
|
501
|
+
|
|
502
|
+
### Key Props
|
|
503
|
+
|
|
504
|
+
| Prop | Type | Default | Description |
|
|
505
|
+
| -------------- | ------------------------------------------------ | ---------- | ------------------------------------------ |
|
|
506
|
+
| `options` | `RadioTileOption[]` | (required) | Array of radio tile options |
|
|
507
|
+
| `value` | `T` | - | Selected value (controlled mode) |
|
|
508
|
+
| `defaultValue` | `T` | - | Initial selected value (uncontrolled mode) |
|
|
509
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when selection changes |
|
|
510
|
+
| `name` | `string` | - | Groups radios together for form submission |
|
|
511
|
+
| `label` | `ReactNode` | - | Group label displayed above the tiles |
|
|
512
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the tiles |
|
|
513
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
514
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
515
|
+
| `disabled` | `boolean` | `false` | Disables all radio tiles |
|
|
516
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Tile size |
|
|
517
|
+
| `flex` | `boolean` | `false` | Tiles stretch to fill available width |
|
|
518
|
+
| `columns` | `number` | - | Fixed number of columns in grid layout |
|
|
519
|
+
| `textAlign` | `'start' \| 'center'` | `'center'` | Text alignment within tiles |
|
|
520
|
+
| `useIndicator` | `boolean` | `false` | Shows a radio indicator on each tile |
|
|
521
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
522
|
+
|
|
523
|
+
### RadioTileOption
|
|
524
|
+
|
|
525
|
+
```tsx
|
|
526
|
+
interface RadioTileOption<T = string> {
|
|
527
|
+
value: T;
|
|
528
|
+
label: ReactNode;
|
|
529
|
+
disabled?: boolean;
|
|
530
|
+
startDecorator?: ReactNode;
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
502
534
|
## Accessibility
|
|
503
535
|
|
|
504
536
|
- RadioTileGroup renders a `<fieldset>` with a `<legend>` derived from the `label` prop, providing proper grouping for screen readers.
|
|
@@ -362,9 +362,7 @@ const numericOptions = [
|
|
|
362
362
|
<Select options={numericOptions} defaultValue={1} />
|
|
363
363
|
```
|
|
364
364
|
|
|
365
|
-
##
|
|
366
|
-
|
|
367
|
-
### Form with Validation
|
|
365
|
+
## Form with Validation
|
|
368
366
|
|
|
369
367
|
```tsx
|
|
370
368
|
import { useState } from 'react';
|
|
@@ -406,7 +404,7 @@ function UserForm() {
|
|
|
406
404
|
}
|
|
407
405
|
```
|
|
408
406
|
|
|
409
|
-
|
|
407
|
+
## Filter Bar
|
|
410
408
|
|
|
411
409
|
```tsx
|
|
412
410
|
import { Select, Stack } from '@ceed/ads';
|
|
@@ -448,7 +446,7 @@ function ProductFilter({ onFilterChange }) {
|
|
|
448
446
|
}
|
|
449
447
|
```
|
|
450
448
|
|
|
451
|
-
|
|
449
|
+
## Dependent Selects
|
|
452
450
|
|
|
453
451
|
```tsx
|
|
454
452
|
import { useState, useMemo } from 'react';
|
|
@@ -544,6 +542,62 @@ function LocationSelect() {
|
|
|
544
542
|
</FormControl>
|
|
545
543
|
```
|
|
546
544
|
|
|
545
|
+
## Props and Customization
|
|
546
|
+
|
|
547
|
+
### Key Props
|
|
548
|
+
|
|
549
|
+
| Prop | Type | Default | Description |
|
|
550
|
+
| ---------------- | ---------------------------------------------------------------- | ----------------- | ---------------------------------------------------- |
|
|
551
|
+
| `options` | `OptionType[]` | `[]` | Array of options (objects or primitives) |
|
|
552
|
+
| `value` | `InferOptionValue<OptionType> \| InferOptionValue<OptionType>[]` | - | Selected value(s) for controlled mode |
|
|
553
|
+
| `defaultValue` | `InferOptionValue<OptionType> \| InferOptionValue<OptionType>[]` | - | Initial value for uncontrolled mode |
|
|
554
|
+
| `onChange` | `(event: { target: { name?, value } }, newValue) => void` | - | Callback when selection changes |
|
|
555
|
+
| `multiple` | `boolean` | `false` | Allow multiple selections (value becomes an array) |
|
|
556
|
+
| `label` | `string` | - | Form label displayed above the select |
|
|
557
|
+
| `helperText` | `string` | - | Helper text displayed below the select |
|
|
558
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
559
|
+
| `required` | `boolean` | `false` | Marks the field as required (adds asterisk to label) |
|
|
560
|
+
| `disabled` | `boolean` | `false` | Disables the select |
|
|
561
|
+
| `placeholder` | `string` | `'Choose one...'` | Placeholder text when no value is selected |
|
|
562
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Select size |
|
|
563
|
+
| `variant` | `'outlined' \| 'plain' \| 'solid' \| 'soft'` | `'outlined'` | Visual style variant |
|
|
564
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
565
|
+
| `startDecorator` | `ReactNode` | - | Content rendered before the select trigger text |
|
|
566
|
+
| `endDecorator` | `ReactNode` | - | Content rendered after the select trigger text |
|
|
567
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
568
|
+
|
|
569
|
+
### Option Type
|
|
570
|
+
|
|
571
|
+
Options can be objects or primitives:
|
|
572
|
+
|
|
573
|
+
```tsx
|
|
574
|
+
type OptionType =
|
|
575
|
+
| { label: string; value: string | number; disabled?: boolean; secondaryText?: string }
|
|
576
|
+
| string
|
|
577
|
+
| number;
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Generic Type Support
|
|
581
|
+
|
|
582
|
+
Select supports TypeScript generics for type-safe value handling:
|
|
583
|
+
|
|
584
|
+
```tsx
|
|
585
|
+
// Type-safe with object options
|
|
586
|
+
const options = [
|
|
587
|
+
{ value: 1, label: 'Option 1' },
|
|
588
|
+
{ value: 2, label: 'Option 2' },
|
|
589
|
+
] as const;
|
|
590
|
+
|
|
591
|
+
<Select<typeof options[number], false>
|
|
592
|
+
options={options}
|
|
593
|
+
onChange={(e, val) => {
|
|
594
|
+
// val is typed as number
|
|
595
|
+
}}
|
|
596
|
+
/>
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
> **Note**: Select also accepts all Joy UI Select props.
|
|
600
|
+
|
|
547
601
|
## Accessibility
|
|
548
602
|
|
|
549
603
|
- **Label association**: When you use the `label` prop, the component automatically connects the label to the select element via `aria-labelledby`. Always provide a label for screen reader users.
|
|
@@ -232,9 +232,7 @@ Set `disabled` to prevent user interaction.
|
|
|
232
232
|
</Box>
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
##
|
|
236
|
-
|
|
237
|
-
### Controlled Slider
|
|
235
|
+
## Controlled Slider
|
|
238
236
|
|
|
239
237
|
```tsx
|
|
240
238
|
function VolumeControl() {
|
|
@@ -254,7 +252,7 @@ function VolumeControl() {
|
|
|
254
252
|
}
|
|
255
253
|
```
|
|
256
254
|
|
|
257
|
-
|
|
255
|
+
## Price Range Filter
|
|
258
256
|
|
|
259
257
|
```tsx
|
|
260
258
|
function PriceRangeFilter() {
|
|
@@ -278,7 +276,7 @@ function PriceRangeFilter() {
|
|
|
278
276
|
}
|
|
279
277
|
```
|
|
280
278
|
|
|
281
|
-
|
|
279
|
+
## Temperature Setting
|
|
282
280
|
|
|
283
281
|
```tsx
|
|
284
282
|
function TemperatureSetting() {
|
|
@@ -326,6 +324,29 @@ function TemperatureSetting() {
|
|
|
326
324
|
|
|
327
325
|
5. **Set a reasonable `step`**: For large ranges (0–1000), use a step > 1 to prevent overwhelming precision. For small ranges (0–1), use decimal steps.
|
|
328
326
|
|
|
327
|
+
## Props and Customization
|
|
328
|
+
|
|
329
|
+
### Key Props
|
|
330
|
+
|
|
331
|
+
| Prop | Type | Default | Description |
|
|
332
|
+
| ------------------- | -------------------------------------------------------------- | -------------- | --------------------------------------------------- |
|
|
333
|
+
| `value` | `number \| number[]` | - | Current value (controlled). Array for range sliders |
|
|
334
|
+
| `defaultValue` | `number \| number[]` | `0` | Initial value (uncontrolled) |
|
|
335
|
+
| `onChange` | `(event: Event, value: number \| number[]) => void` | - | Callback when the value changes |
|
|
336
|
+
| `min` | `number` | `0` | Minimum allowed value |
|
|
337
|
+
| `max` | `number` | `100` | Maximum allowed value |
|
|
338
|
+
| `step` | `number` | `1` | Step increment between values |
|
|
339
|
+
| `marks` | `boolean \| { value: number; label?: string }[]` | `false` | Show marks on the slider track |
|
|
340
|
+
| `valueLabelDisplay` | `'on' \| 'off' \| 'auto'` | `'auto'` | When to display the value label |
|
|
341
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Slider orientation |
|
|
342
|
+
| `disabled` | `boolean` | `false` | Disables the slider |
|
|
343
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Slider size |
|
|
344
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
345
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
346
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
347
|
+
|
|
348
|
+
> **Note**: Slider also accepts all Joy UI Slider props.
|
|
349
|
+
|
|
329
350
|
## Accessibility
|
|
330
351
|
|
|
331
352
|
- Slider renders with `role="slider"` and appropriate `aria-valuemin`, `aria-valuemax`, and `aria-valuenow` attributes.
|
|
@@ -190,9 +190,7 @@ Label
|
|
|
190
190
|
</Stack>
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
##
|
|
194
|
-
|
|
195
|
-
### Settings Panel
|
|
193
|
+
## Settings Panel
|
|
196
194
|
|
|
197
195
|
```tsx
|
|
198
196
|
function SettingsPanel() {
|
|
@@ -238,7 +236,7 @@ function SettingsPanel() {
|
|
|
238
236
|
}
|
|
239
237
|
```
|
|
240
238
|
|
|
241
|
-
|
|
239
|
+
## Theme Toggle
|
|
242
240
|
|
|
243
241
|
```tsx
|
|
244
242
|
function ThemeToggle() {
|
|
@@ -259,7 +257,7 @@ function ThemeToggle() {
|
|
|
259
257
|
}
|
|
260
258
|
```
|
|
261
259
|
|
|
262
|
-
|
|
260
|
+
## Feature Flag with Status Text
|
|
263
261
|
|
|
264
262
|
```tsx
|
|
265
263
|
function FeatureToggle() {
|
|
@@ -329,6 +327,26 @@ function FeatureToggle() {
|
|
|
329
327
|
|
|
330
328
|
5. **Group related switches logically**: Place related switches under a shared heading and use consistent spacing to create a scannable settings layout.
|
|
331
329
|
|
|
330
|
+
## Props and Customization
|
|
331
|
+
|
|
332
|
+
### Key Props
|
|
333
|
+
|
|
334
|
+
| Prop | Type | Default | Description |
|
|
335
|
+
| ---------------- | -------------------------------------------------------------- | ----------- | ------------------------------------- |
|
|
336
|
+
| `checked` | `boolean` | - | Whether the switch is on (controlled) |
|
|
337
|
+
| `defaultChecked` | `boolean` | `false` | Initial state (uncontrolled) |
|
|
338
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when the state changes |
|
|
339
|
+
| `disabled` | `boolean` | `false` | Disables the switch |
|
|
340
|
+
| `readOnly` | `boolean` | `false` | Makes the switch read-only |
|
|
341
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme when checked |
|
|
342
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Switch size |
|
|
343
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
344
|
+
| `startDecorator` | `ReactNode` | - | Content rendered before the switch |
|
|
345
|
+
| `endDecorator` | `ReactNode` | - | Content rendered after the switch |
|
|
346
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
347
|
+
|
|
348
|
+
> **Note**: Switch also accepts all Joy UI Switch props and Framer Motion props.
|
|
349
|
+
|
|
332
350
|
## Accessibility
|
|
333
351
|
|
|
334
352
|
- **Role and state**: The Switch renders an `<input type="checkbox" role="switch">` with `aria-checked` reflecting the current state. Screen readers announce it as a switch, not a checkbox.
|
|
@@ -131,9 +131,7 @@ Use the `required`, `label`, and `helperText` props together to build complete f
|
|
|
131
131
|
/>
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
##
|
|
135
|
-
|
|
136
|
-
### Feedback Form
|
|
134
|
+
## Feedback Form
|
|
137
135
|
|
|
138
136
|
```tsx
|
|
139
137
|
import { Textarea, Button, Stack } from '@ceed/ads';
|
|
@@ -160,7 +158,7 @@ function FeedbackForm() {
|
|
|
160
158
|
}
|
|
161
159
|
```
|
|
162
160
|
|
|
163
|
-
|
|
161
|
+
## Textarea Validation Error State
|
|
164
162
|
|
|
165
163
|
```tsx
|
|
166
164
|
import { Textarea } from '@ceed/ads';
|
|
@@ -183,7 +181,7 @@ function ValidatedTextarea() {
|
|
|
183
181
|
}
|
|
184
182
|
```
|
|
185
183
|
|
|
186
|
-
|
|
184
|
+
## Disabled Read-Only Textarea
|
|
187
185
|
|
|
188
186
|
```tsx
|
|
189
187
|
import { Textarea } from '@ceed/ads';
|
|
@@ -259,6 +257,30 @@ function ReadOnlyNotes() {
|
|
|
259
257
|
<Textarea placeholder="Type here" />
|
|
260
258
|
```
|
|
261
259
|
|
|
260
|
+
## Props and Customization
|
|
261
|
+
|
|
262
|
+
### Key Props
|
|
263
|
+
|
|
264
|
+
| Prop | Type | Default | Description |
|
|
265
|
+
| -------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
|
266
|
+
| `label` | `string` | - | Form label displayed above the textarea |
|
|
267
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the textarea |
|
|
268
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
269
|
+
| `minRows` | `number` | `2` | Minimum number of visible text rows |
|
|
270
|
+
| `maxRows` | `number` | `4` | Maximum number of rows before scrolling |
|
|
271
|
+
| `value` | `string` | - | Textarea value for controlled mode |
|
|
272
|
+
| `defaultValue` | `string` | - | Initial value for uncontrolled mode |
|
|
273
|
+
| `onChange` | `(event: ChangeEvent<HTMLTextAreaElement>) => void` | - | Callback when the value changes |
|
|
274
|
+
| `placeholder` | `string` | - | Placeholder text when the textarea is empty |
|
|
275
|
+
| `disabled` | `boolean` | `false` | Disables the textarea |
|
|
276
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
277
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Textarea size |
|
|
278
|
+
| `variant` | `'outlined' \| 'solid' \| 'soft' \| 'plain'` | `'outlined'` | Visual style variant |
|
|
279
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
280
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
281
|
+
|
|
282
|
+
> **Note**: Textarea also accepts all Joy UI Textarea props and Framer Motion props.
|
|
283
|
+
|
|
262
284
|
## Accessibility
|
|
263
285
|
|
|
264
286
|
- The component automatically associates the `label` with the textarea element through FormControl, ensuring screen readers announce the label when the field receives focus.
|
|
@@ -229,9 +229,7 @@ The Uploader can be disabled to prevent file selection and drag-and-drop interac
|
|
|
229
229
|
/>
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
##
|
|
233
|
-
|
|
234
|
-
### Profile Photo Upload
|
|
232
|
+
## Profile Photo Upload
|
|
235
233
|
|
|
236
234
|
```tsx
|
|
237
235
|
import { Uploader } from '@ceed/ads';
|
|
@@ -250,7 +248,7 @@ function ProfilePhotoUpload() {
|
|
|
250
248
|
}
|
|
251
249
|
```
|
|
252
250
|
|
|
253
|
-
|
|
251
|
+
## Document Attachment in a Form
|
|
254
252
|
|
|
255
253
|
```tsx
|
|
256
254
|
import { Uploader, Stack, Button } from '@ceed/ads';
|
|
@@ -274,7 +272,7 @@ function DocumentForm() {
|
|
|
274
272
|
}
|
|
275
273
|
```
|
|
276
274
|
|
|
277
|
-
|
|
275
|
+
## Multi-Image Gallery Upload
|
|
278
276
|
|
|
279
277
|
```tsx
|
|
280
278
|
import { Uploader } from '@ceed/ads';
|
|
@@ -309,6 +307,27 @@ function GalleryUpload({ existingImages }) {
|
|
|
309
307
|
|
|
310
308
|
- **Use `minCount` with form validation.** The minimum count check triggers on form submission, not on file selection. Make sure the Uploader is inside a `<form>` element for this validation to work.
|
|
311
309
|
|
|
310
|
+
## Props and Customization
|
|
311
|
+
|
|
312
|
+
### Key Props
|
|
313
|
+
|
|
314
|
+
| Prop | Type | Default | Description |
|
|
315
|
+
| ------------------ | --------------------------------------------------------- | ---------- | ----------------------------------------------------------- |
|
|
316
|
+
| `accept` | `string` | (required) | Accepted file types (e.g., `'image/*'`, `'.pdf,.doc'`) |
|
|
317
|
+
| `maxFileTotalSize` | `number` | (required) | Maximum total size of all files in bytes |
|
|
318
|
+
| `onChange` | `(event: { target: { name?, value: File[] } }) => void` | - | Callback when files are added |
|
|
319
|
+
| `onDelete` | `(deletedFile: UserUpload) => void` | - | Callback when an uploaded file is removed |
|
|
320
|
+
| `uploaded` | `{ id: string \| number; name: string; size?: number }[]` | - | Pre-existing uploaded files to display |
|
|
321
|
+
| `maxFileSize` | `number` | - | Maximum size per individual file in bytes |
|
|
322
|
+
| `maxCount` | `number` | - | Maximum number of files allowed |
|
|
323
|
+
| `minCount` | `number` | - | Minimum number of files required (validated on form submit) |
|
|
324
|
+
| `label` | `string` | - | Label displayed above the uploader |
|
|
325
|
+
| `helperText` | `string` | - | Helper text displayed below the uploader |
|
|
326
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
327
|
+
| `disabled` | `boolean` | `false` | Disables the uploader |
|
|
328
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
329
|
+
| `size` | `'sm' \| 'md'` | `'md'` | Uploader size |
|
|
330
|
+
|
|
312
331
|
## Accessibility
|
|
313
332
|
|
|
314
333
|
- The dropzone is keyboard-accessible and can be activated via **Enter** or **Space** to open the file browser.
|