@pushwoosh/dumb-components 1.1.147 → 1.1.149
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/AccessForbidden/AccessForbidden.d.ts +3 -0
- package/AccessForbidden/AccessForbidden.js +3 -0
- package/Alert/Alert.d.ts +7 -0
- package/Alert/Alert.js +7 -0
- package/Alert/types.d.ts +6 -0
- package/ApplicationPreloader/ApplicationPreloader.d.ts +8 -0
- package/ApplicationPreloader/ApplicationPreloader.js +6 -0
- package/Badge/Badge.d.ts +6 -0
- package/Badge/Badge.js +6 -0
- package/Badge/types.d.ts +6 -0
- package/Banner/Banner.d.ts +7 -0
- package/Banner/Banner.js +7 -0
- package/Banner/types.d.ts +16 -0
- package/Button/Button.d.ts +19 -0
- package/Button/GhostButton.d.ts +1 -0
- package/Button/GhostButton.js +1 -0
- package/Button/RemoveButton.d.ts +6 -0
- package/Button/RemoveButton.js +6 -0
- package/Button/types.d.ts +21 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.d.ts +12 -0
- package/Calendar/CalendarDropdown/CalendarDropdown.js +12 -0
- package/Calendar/CalendarDropdown/helpers.d.ts +4 -0
- package/Calendar/CalendarDropdown/helpers.js +4 -0
- package/Calendar/CalendarDropdown/types.d.ts +33 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.d.ts +7 -0
- package/Calendar/CalendarSuperForm/CalendarSuperForm.js +10 -1
- package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.d.ts +1 -0
- package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.js +3 -2
- package/Calendar/CalendarSuperForm/types.d.ts +37 -9
- package/Calendar/helpers.d.ts +10 -0
- package/Calendar/helpers.js +10 -0
- package/Calendar/types.d.ts +16 -1
- package/CardMetric/CardMetric.d.ts +7 -0
- package/CardMetric/CardMetric.js +7 -0
- package/CardMetric/types.d.ts +13 -0
- package/Checkbox/Checkbox.d.ts +6 -0
- package/Checkbox/Checkbox.js +6 -0
- package/Checkbox/types.d.ts +13 -0
- package/Chip/Chip.d.ts +7 -0
- package/Chip/Chip.js +7 -0
- package/Chip/Chip.types.d.ts +9 -0
- package/CodeEditor/CodeEditor.d.ts +7 -0
- package/CodeEditor/CodeEditor.js +7 -0
- package/CodeEditor/languages/html.d.ts +1 -0
- package/CodeEditor/languages/html.js +1 -0
- package/CodeEditor/languages/json.d.ts +1 -0
- package/CodeEditor/languages/json.js +1 -0
- package/CodeEditor/languages/liquid.d.ts +1 -0
- package/CodeEditor/languages/liquid.js +1 -0
- package/CodeEditor/types.d.ts +11 -0
- package/CrashScreen/CrashScreen.d.ts +4 -0
- package/CrashScreen/CrashScreen.js +4 -0
- package/DateTimePicker/components/DatePicker/DatePicker.d.ts +5 -0
- package/DateTimePicker/components/DatePicker/DatePicker.js +5 -0
- package/DateTimePicker/components/DatePicker/types.d.ts +9 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +5 -0
- package/DateTimePicker/components/DatePickerField/DatePickerField.js +5 -0
- package/DateTimePicker/components/DatePickerField/types.d.ts +9 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +5 -0
- package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +5 -0
- package/DateTimePicker/components/DateTimePicker/types.d.ts +6 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +5 -0
- package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +5 -0
- package/DateTimePicker/components/DateTimePickerField/types.d.ts +9 -0
- package/DateTimePicker/types.d.ts +5 -0
- package/Drawer/components/Drawer/Drawer.d.ts +11 -0
- package/Drawer/components/Drawer/Drawer.js +11 -0
- package/Drawer/components/Drawer/types.d.ts +9 -0
- package/Drawer/components/DrawerContent/styles.d.ts +3 -0
- package/Drawer/components/DrawerContent/styles.js +3 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.d.ts +7 -0
- package/Drawer/components/DrawerDocs/DrawerDocs.js +7 -0
- package/Drawer/components/DrawerDocs/hooks.d.ts +4 -0
- package/Drawer/components/DrawerDocs/hooks.js +4 -0
- package/Drawer/components/DrawerDocs/types.d.ts +4 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +12 -0
- package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +12 -0
- package/DropdownMenu/components/DropdownMenu/types.d.ts +15 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -0
- package/DropdownMenu/components/DropdownMenuButton/types.d.ts +16 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
- package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +7 -0
- package/DropdownMenu/components/DropdownMenuItem/types.d.ts +6 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +8 -0
- package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +8 -0
- package/DropdownMenu/components/DropdownMenuSection/types.d.ts +3 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +9 -0
- package/DropdownMenu/components/DropdownMenuSubmenu/types.d.ts +5 -0
- package/EditableField/EditableField.d.ts +9 -0
- package/EditableField/EditableField.js +9 -0
- package/EditableField/types.d.ts +12 -0
- package/EmailTemplatePreview/EmailTemplatePreview.d.ts +7 -0
- package/EmailTemplatePreview/EmailTemplatePreview.js +7 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +4 -0
- package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +4 -0
- package/EmailTemplatePreview/helpers.d.ts +8 -0
- package/EmailTemplatePreview/helpers.js +8 -0
- package/EmailTemplatePreview/types.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.d.ts +7 -0
- package/EnhancedInput/EnhancedInput.js +7 -0
- package/EnhancedInput/SearchInput.d.ts +6 -0
- package/EnhancedInput/SearchInput.js +6 -0
- package/EnhancedInput/types.d.ts +5 -0
- package/ExportResult/ExportResult.d.ts +7 -0
- package/ExportResult/ExportResult.js +7 -0
- package/ExportResult/types.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.d.ts +7 -0
- package/ExternalImagePreview/ExternalImagePreview.js +7 -0
- package/ExternalImagePreview/types.d.ts +7 -0
- package/FieldBox/FieldBox.d.ts +9 -0
- package/FieldBox/FieldBox.js +9 -0
- package/FieldBox/types.d.ts +10 -0
- package/FrequencyCapping/FrequencyCappingEdit.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingEdit.js +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.d.ts +7 -0
- package/FrequencyCapping/FrequencyCappingInApps.js +7 -0
- package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
- package/FrequencyCapping/FrequencyCappingReadonly.js +3 -0
- package/FrequencyCapping/types.d.ts +37 -0
- package/FrequencyCapping/types.js +1 -0
- package/GetStartedPage/GetStartedPage.d.ts +7 -0
- package/GetStartedPage/GetStartedPage.js +7 -0
- package/GetStartedPage/types.d.ts +7 -0
- package/InputFile/InputFile.d.ts +7 -0
- package/InputFile/InputFile.js +7 -0
- package/InputFile/types.d.ts +18 -0
- package/Link/Link.d.ts +18 -0
- package/Link/types.d.ts +17 -0
- package/Modal/components/Modal/Modal.d.ts +11 -0
- package/Modal/components/Modal/Modal.js +11 -0
- package/Modal/components/Modal/types.d.ts +6 -0
- package/Modal/components/ModalConfirm/ModalConfirm.d.ts +8 -0
- package/Modal/components/ModalConfirm/ModalConfirm.js +8 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +7 -0
- package/Modal/components/ModalConfirm/ModalConfirmProvider.js +7 -0
- package/Modal/components/ModalConfirm/hooks.d.ts +8 -0
- package/Modal/components/ModalConfirm/hooks.js +8 -0
- package/Modal/components/ModalConfirm/types.d.ts +16 -0
- package/Modal/components/ModalContent/styles.d.ts +5 -0
- package/Modal/components/ModalContent/styles.js +5 -0
- package/Modal/components/ModalTitle/ModalTitle.d.ts +6 -0
- package/Modal/components/ModalTitle/ModalTitle.js +6 -0
- package/Modal/components/ModalTitle/types.d.ts +3 -0
- package/NotificationInbox/NotificationBar.d.ts +7 -0
- package/NotificationInbox/NotificationBar.js +7 -0
- package/NotificationInbox/NotificationBell.d.ts +7 -0
- package/NotificationInbox/NotificationBell.js +7 -0
- package/NotificationInbox/NotificationInbox.d.ts +7 -0
- package/NotificationInbox/NotificationInbox.js +7 -0
- package/NotificationInbox/types.d.ts +31 -0
- package/NumberPicker/NumberPicker.d.ts +7 -0
- package/NumberPicker/NumberPicker.js +7 -0
- package/NumberPicker/types.d.ts +12 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +7 -0
- package/PageHeader/components/AutosizeInput/AutosizeInput.js +7 -0
- package/PageHeader/components/AutosizeInput/types.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.d.ts +7 -0
- package/PageHeader/components/PageHeader/PageHeader.js +7 -0
- package/PageHeader/components/PageHeader/types.d.ts +13 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +7 -0
- package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +7 -0
- package/PageHeader/components/PageHeaderEditable/types.d.ts +19 -0
- package/Pagination/Pagination.d.ts +7 -0
- package/Pagination/Pagination.js +7 -0
- package/Pagination/types.d.ts +7 -0
- package/Popover/Popover.d.ts +10 -0
- package/Popover/Popover.js +10 -0
- package/Popover/styles.d.ts +1 -0
- package/Popover/styles.js +1 -0
- package/Popover/types.d.ts +9 -0
- package/ProgressBar/ProgressBar.d.ts +6 -0
- package/ProgressBar/ProgressBar.js +6 -0
- package/ProgressBar/types.d.ts +7 -0
- package/PushPreview/PushPreview.d.ts +7 -0
- package/PushPreview/PushPreview.js +7 -0
- package/PushPreview/types.d.ts +17 -0
- package/Radio/Radio.d.ts +7 -0
- package/Radio/Radio.js +7 -0
- package/Radio/types.d.ts +14 -0
- package/RadioCard/RadioCard.d.ts +7 -0
- package/RadioCard/RadioCard.js +7 -0
- package/RadioCard/types.d.ts +7 -0
- package/ReCaptcha/ReCaptcha.d.ts +8 -0
- package/ReCaptcha/ReCaptcha.js +8 -0
- package/ReCaptcha/helpers.d.ts +4 -0
- package/ReCaptcha/helpers.js +4 -0
- package/ReCaptcha/hooks.d.ts +4 -0
- package/ReCaptcha/hooks.js +4 -0
- package/ReCaptcha/types.d.ts +5 -0
- package/RichMessageEditor/RichMessageEditor.d.ts +8 -0
- package/RichMessageEditor/RichMessageEditor.js +8 -0
- package/RichMessageEditor/RichMessageEditor.types.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.d.ts +10 -0
- package/RichMessageEditor/RichMessageViewer.js +7 -0
- package/RichMessageEditor/slate/types.d.ts +5 -0
- package/RichMessageEditor/types.d.ts +1 -0
- package/RichmediaPreview/RichmediaPreview.d.ts +7 -0
- package/RichmediaPreview/RichmediaPreview.js +7 -0
- package/RichmediaPreview/hooks.d.ts +4 -0
- package/RichmediaPreview/hooks.js +4 -0
- package/RichmediaPreview/types.d.ts +13 -0
- package/Select/Select.d.ts +22 -0
- package/Select/Select.js +22 -0
- package/Select/constants.d.ts +1 -0
- package/Select/constants.js +1 -0
- package/Select/types.d.ts +19 -0
- package/SendRate/SendRateEdit.d.ts +7 -0
- package/SendRate/SendRateEdit.js +7 -0
- package/SendRate/SendRateReadonly.d.ts +3 -0
- package/SendRate/SendRateReadonly.js +3 -0
- package/SendRate/types.d.ts +20 -0
- package/Skeleton/TextSkeleton.d.ts +6 -0
- package/Skeleton/TextSkeleton.js +6 -0
- package/Skeleton/styles.d.ts +2 -0
- package/Skeleton/styles.js +2 -0
- package/Skeleton/types.d.ts +11 -0
- package/SortButton/SortButton.d.ts +6 -0
- package/SortButton/SortButton.js +6 -0
- package/SortButton/types.d.ts +11 -0
- package/Spinner/Spinner.d.ts +6 -0
- package/Spinner/Spinner.js +6 -0
- package/Spinner/types.d.ts +4 -0
- package/StatisticCard/StatisticCard.d.ts +7 -0
- package/StatisticCard/StatisticCard.js +7 -0
- package/StatisticCard/types.d.ts +21 -0
- package/Switch/Switch.d.ts +6 -0
- package/Switch/Switch.js +6 -0
- package/Switch/types.d.ts +8 -0
- package/Tabs/components/Tab/Tab.d.ts +4 -0
- package/Tabs/components/Tab/Tab.js +4 -0
- package/Tabs/components/Tab/types.d.ts +6 -0
- package/Tabs/components/TabBar/TabBar.d.ts +3 -0
- package/Tabs/components/TabBar/TabBar.js +3 -0
- package/Tabs/components/TabBar/types.d.ts +2 -0
- package/Tabs/components/TabPanel/TabPanel.d.ts +4 -0
- package/Tabs/components/TabPanel/TabPanel.js +4 -0
- package/Tabs/components/TabPanel/types.d.ts +3 -0
- package/Tabs/components/Tabs/Tabs.d.ts +11 -0
- package/Tabs/components/Tabs/Tabs.js +11 -0
- package/Tabs/components/Tabs/types.d.ts +4 -0
- package/Tabs/types.d.ts +4 -0
- package/Toast/Toast.d.ts +5 -0
- package/Toast/Toast.js +5 -0
- package/Toast/ToastProvider.d.ts +7 -0
- package/Toast/ToastProvider.js +7 -0
- package/Toast/hooks.d.ts +8 -0
- package/Toast/hooks.js +8 -0
- package/Toast/types.d.ts +24 -0
- package/Tooltip/Tooltip.d.ts +7 -0
- package/Tooltip/Tooltip.js +7 -0
- package/Tooltip/TooltipTrigger.d.ts +13 -0
- package/Tooltip/TooltipTrigger.js +7 -0
- package/Tooltip/types.d.ts +12 -0
- package/hooks/useElementWidth.d.ts +4 -3
- package/hooks/useElementWidth.js +4 -3
- package/hooks/useLayer.d.ts +7 -0
- package/hooks/useLayer.js +7 -0
- package/hooks/useOnClickOutside.d.ts +7 -0
- package/hooks/useOnClickOutside.js +7 -0
- package/native/Input.d.ts +3 -0
- package/native/Input.js +1 -0
- package/native/NativeTimeInput.d.ts +1 -0
- package/native/NativeTimeInput.js +1 -0
- package/native/Select.d.ts +1 -0
- package/native/Select.js +1 -0
- package/native/Textarea.d.ts +1 -0
- package/native/Textarea.js +1 -0
- package/package.json +2 -3
- package/polyglot/react.d.ts +19 -0
- package/polyglot/react.js +19 -0
- package/polyglot/types.d.ts +4 -0
- package/shared/dropdownField/FieldInput.d.ts +1 -0
- package/shared/dropdownField/FieldInput.js +1 -0
- package/shared/dropdownField/FieldShell.d.ts +4 -0
- package/shared/dropdownField/FieldShell.js +4 -0
- package/shared/dropdownField/SuggestionsDropdown.d.ts +4 -0
- package/shared/dropdownField/SuggestionsDropdown.js +4 -0
- package/shared/dropdownField/constants.d.ts +1 -0
- package/shared/dropdownField/constants.js +1 -0
- package/shared/dropdownField/shared.d.ts +7 -0
- package/shared/dropdownField/shared.js +7 -0
- package/shared/dropdownField/types.d.ts +7 -0
- package/shared/dropdownField/useActiveIndex.d.ts +4 -0
- package/shared/dropdownField/useActiveIndex.js +4 -0
- package/shared/dropdownField/useAsyncItems.d.ts +4 -0
- package/shared/dropdownField/useAsyncItems.js +4 -0
- package/shared/dropdownField/useDebouncedValue.d.ts +1 -0
- package/shared/dropdownField/useDebouncedValue.js +1 -0
- package/shared/dropdownField/useDropdownItems.d.ts +4 -0
- package/shared/dropdownField/useDropdownItems.js +4 -0
- package/shared/dropdownField/useDropdownPosition.d.ts +4 -0
- package/shared/dropdownField/useDropdownPosition.js +4 -0
- package/shared/dropdownField/useFieldOpenEffects.d.ts +4 -0
- package/shared/dropdownField/useFieldOpenEffects.js +4 -0
- package/shared/dropdownField/useListNavigation.d.ts +5 -0
- package/shared/dropdownField/useListNavigation.js +5 -0
- package/Alert/ai-documentation.md +0 -132
- package/Badge/ai-documentation.md +0 -155
- package/Banner/ai-documentation.md +0 -285
- package/Button/ai-documentation.md +0 -247
- package/CardMetric/ai-documentation.md +0 -277
- package/Checkbox/ai-documentation.md +0 -231
- package/Chip/ai-documentation.md +0 -281
- package/CodeEditor/ai-documentation.md +0 -350
- package/DateTimePicker/ai-documentation.md +0 -400
- package/Drawer/ai-documentation.md +0 -417
- package/EnhancedInput/ai-documentation.md +0 -352
- package/InputFile/ai-documentation.md +0 -420
- package/Modal/ai-documentation.md +0 -285
- package/PageHeader/ai-documentation.md +0 -511
- package/Pagination/ai-documentation.md +0 -509
- package/Popover/ai-documentation.md +0 -625
- package/ProgressBar/ai-documentation.md +0 -533
- package/Radio/ai-documentation.md +0 -243
- package/Select/ai-documentation.md +0 -374
- package/Skeleton/ai-documentation.md +0 -574
- package/Spinner/ai-documentation.md +0 -607
- package/Switch/ai-documentation.md +0 -312
- package/Tabs/ai-documentation.md +0 -475
- package/Toast/ai-documentation.md +0 -220
- package/Tooltip/ai-documentation.md +0 -340
- package/ai-documentation.md +0 -124
- package/native/ai-documentation.md +0 -485
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
# Radio Component - @pushwoosh/dumb-components
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
- **Component Name**: Radio
|
|
6
|
-
- **Import Path**: `@pushwoosh/dumb-components`
|
|
7
|
-
- **Files**:
|
|
8
|
-
- `/src/Radio/Radio.tsx` - Main component implementation
|
|
9
|
-
- `/src/Radio/types.ts` - TypeScript type definitions
|
|
10
|
-
- `/src/Radio/styles.ts` - Styled components
|
|
11
|
-
- `/src/Radio/mappers.ts` - Color mapping utilities
|
|
12
|
-
- `/src/Radio/index.ts` - Component exports
|
|
13
|
-
- **Type**: Form Control
|
|
14
|
-
- **Description**: A radio button input component with label, tooltip support, and customizable styling. Supports both regular and compact sizes with normal and error states.
|
|
15
|
-
|
|
16
|
-
## TypeScript Interfaces
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
export type RadioType = 'normal' | 'error';
|
|
20
|
-
|
|
21
|
-
export type RadioSize = 'regular' | 'compact';
|
|
22
|
-
|
|
23
|
-
export type RadioProps = {
|
|
24
|
-
label?: string;
|
|
25
|
-
id?: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
value?: string;
|
|
28
|
-
type?: RadioType;
|
|
29
|
-
isChecked?: boolean;
|
|
30
|
-
isDisabled?: boolean;
|
|
31
|
-
size?: RadioSize;
|
|
32
|
-
tooltip?: string;
|
|
33
|
-
onChange?: (checked: string | number) => void;
|
|
34
|
-
onBlur?: () => void;
|
|
35
|
-
};
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Import & Usage
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
import { Radio } from '@pushwoosh/dumb-components';
|
|
42
|
-
|
|
43
|
-
// Basic usage
|
|
44
|
-
function MyComponent() {
|
|
45
|
-
const [selected, setSelected] = useState('');
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Radio
|
|
49
|
-
label="Option 1"
|
|
50
|
-
name="options"
|
|
51
|
-
value="option1"
|
|
52
|
-
isChecked={selected === 'option1'}
|
|
53
|
-
onChange={(value) => setSelected(value)}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Radio group
|
|
59
|
-
function RadioGroup() {
|
|
60
|
-
const [selected, setSelected] = useState('option1');
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div>
|
|
64
|
-
<Radio
|
|
65
|
-
label="First Option"
|
|
66
|
-
name="radioGroup"
|
|
67
|
-
value="option1"
|
|
68
|
-
isChecked={selected === 'option1'}
|
|
69
|
-
onChange={setSelected}
|
|
70
|
-
/>
|
|
71
|
-
<Radio
|
|
72
|
-
label="Second Option"
|
|
73
|
-
name="radioGroup"
|
|
74
|
-
value="option2"
|
|
75
|
-
isChecked={selected === 'option2'}
|
|
76
|
-
onChange={setSelected}
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Advanced Examples
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
// Radio with tooltip
|
|
87
|
-
function RadioWithTooltip() {
|
|
88
|
-
return (
|
|
89
|
-
<Radio
|
|
90
|
-
label="Advanced Setting"
|
|
91
|
-
name="settings"
|
|
92
|
-
value="advanced"
|
|
93
|
-
tooltip="This enables advanced configuration options"
|
|
94
|
-
onChange={(value) => console.log(value)}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Error state radio
|
|
100
|
-
function ErrorStateRadio() {
|
|
101
|
-
return (
|
|
102
|
-
<Radio
|
|
103
|
-
label="Invalid Option"
|
|
104
|
-
name="validation"
|
|
105
|
-
value="invalid"
|
|
106
|
-
type="error"
|
|
107
|
-
onChange={(value) => console.log(value)}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Disabled radio
|
|
113
|
-
function DisabledRadio() {
|
|
114
|
-
return (
|
|
115
|
-
<Radio
|
|
116
|
-
label="Unavailable Option"
|
|
117
|
-
name="options"
|
|
118
|
-
value="unavailable"
|
|
119
|
-
isDisabled
|
|
120
|
-
onChange={(value) => console.log(value)}
|
|
121
|
-
/>
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Compact size radio
|
|
126
|
-
function CompactRadio() {
|
|
127
|
-
return (
|
|
128
|
-
<Radio
|
|
129
|
-
label="Compact Option"
|
|
130
|
-
name="compact"
|
|
131
|
-
value="compact"
|
|
132
|
-
size="compact"
|
|
133
|
-
onChange={(value) => console.log(value)}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Custom form integration
|
|
139
|
-
function FormRadio() {
|
|
140
|
-
const [formData, setFormData] = useState({ preference: '' });
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<form>
|
|
144
|
-
<fieldset>
|
|
145
|
-
<legend>Preferences</legend>
|
|
146
|
-
<Radio
|
|
147
|
-
label="Email Notifications"
|
|
148
|
-
name="preference"
|
|
149
|
-
value="email"
|
|
150
|
-
isChecked={formData.preference === 'email'}
|
|
151
|
-
onChange={(value) => setFormData(prev => ({ ...prev, preference: value }))}
|
|
152
|
-
/>
|
|
153
|
-
<Radio
|
|
154
|
-
label="SMS Notifications"
|
|
155
|
-
name="preference"
|
|
156
|
-
value="sms"
|
|
157
|
-
isChecked={formData.preference === 'sms'}
|
|
158
|
-
onChange={(value) => setFormData(prev => ({ ...prev, preference: value }))}
|
|
159
|
-
/>
|
|
160
|
-
</fieldset>
|
|
161
|
-
</form>
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Props Reference
|
|
167
|
-
|
|
168
|
-
| Prop | Type | Default | Required | Description |
|
|
169
|
-
|------|------|---------|----------|-------------|
|
|
170
|
-
| `label` | `string` | `undefined` | No | Text label displayed next to the radio button |
|
|
171
|
-
| `id` | `string` | auto-generated | No | Unique identifier for the input element |
|
|
172
|
-
| `name` | `string` | `undefined` | No | Name attribute for grouping radio buttons |
|
|
173
|
-
| `value` | `string` | `undefined` | No | Value of the radio button when selected |
|
|
174
|
-
| `type` | `'normal' \| 'error'` | `'normal'` | No | Visual state of the radio button |
|
|
175
|
-
| `isChecked` | `boolean` | `undefined` | No | Whether the radio button is selected |
|
|
176
|
-
| `isDisabled` | `boolean` | `undefined` | No | Whether the radio button is disabled |
|
|
177
|
-
| `size` | `'regular' \| 'compact'` | `'regular'` | No | Size variant of the radio button |
|
|
178
|
-
| `tooltip` | `string` | `undefined` | No | Tooltip content shown on hover |
|
|
179
|
-
| `onChange` | `(checked: string \| number) => void` | `undefined` | No | Callback fired when radio is selected |
|
|
180
|
-
| `onBlur` | `() => void` | `undefined` | No | Callback fired when radio loses focus |
|
|
181
|
-
|
|
182
|
-
## AI Agent Guidelines
|
|
183
|
-
|
|
184
|
-
### Recommended Patterns
|
|
185
|
-
|
|
186
|
-
1. **Radio Groups**: Always use the same `name` attribute for related radio buttons
|
|
187
|
-
```typescript
|
|
188
|
-
// Correct - same name for grouped options
|
|
189
|
-
<Radio name="theme" value="light" />
|
|
190
|
-
<Radio name="theme" value="dark" />
|
|
191
|
-
|
|
192
|
-
// Incorrect - different names break grouping
|
|
193
|
-
<Radio name="theme1" value="light" />
|
|
194
|
-
<Radio name="theme2" value="dark" />
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
2. **State Management**: Use controlled components with proper state handling
|
|
198
|
-
```typescript
|
|
199
|
-
const [selectedValue, setSelectedValue] = useState('');
|
|
200
|
-
|
|
201
|
-
<Radio
|
|
202
|
-
name="options"
|
|
203
|
-
value="option1"
|
|
204
|
-
isChecked={selectedValue === 'option1'}
|
|
205
|
-
onChange={setSelectedValue}
|
|
206
|
-
/>
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
3. **Form Integration**: Integrate properly with form libraries
|
|
210
|
-
```typescript
|
|
211
|
-
// With React Hook Form
|
|
212
|
-
const { register, watch } = useForm();
|
|
213
|
-
const selectedValue = watch('radioField');
|
|
214
|
-
|
|
215
|
-
<Radio
|
|
216
|
-
{...register('radioField')}
|
|
217
|
-
value="option1"
|
|
218
|
-
isChecked={selectedValue === 'option1'}
|
|
219
|
-
/>
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Common Mistakes to Avoid
|
|
223
|
-
|
|
224
|
-
1. **Missing Name Attribute**: Don't forget the `name` prop for radio groups
|
|
225
|
-
2. **Inconsistent State**: Ensure only one radio in a group is checked
|
|
226
|
-
3. **Missing onChange**: Always provide an `onChange` handler for interactive radios
|
|
227
|
-
4. **Wrong Value Type**: The `onChange` callback receives a string, not a boolean
|
|
228
|
-
|
|
229
|
-
### Integration Tips
|
|
230
|
-
|
|
231
|
-
1. **Accessibility**: Component automatically generates IDs and associates labels
|
|
232
|
-
2. **Keyboard Navigation**: Native radio behavior is preserved for keyboard users
|
|
233
|
-
3. **Styling**: Use `type="error"` for validation states
|
|
234
|
-
4. **Tooltips**: Add contextual help with the `tooltip` prop
|
|
235
|
-
5. **Responsive**: Use `size="compact"` for mobile or dense layouts
|
|
236
|
-
|
|
237
|
-
## Related Components
|
|
238
|
-
|
|
239
|
-
- **Checkbox**: For multiple selection scenarios
|
|
240
|
-
- **Switch**: For boolean toggle controls
|
|
241
|
-
- **Select**: For dropdown selection lists
|
|
242
|
-
- **Button**: For action-based selections
|
|
243
|
-
- **Tooltip**: Used internally for tooltip functionality
|
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
# Select - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for Select component
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
**Component:** Select, SelectAsync, CreatableSelect
|
|
8
|
-
**Import Path:** `import { Select, SelectAsync, CreatableSelect } from '@pushwoosh/dumb-components'`
|
|
9
|
-
**Files:**
|
|
10
|
-
- `Select/Select.tsx` - Main select components
|
|
11
|
-
- `Select/types.ts` - TypeScript interfaces
|
|
12
|
-
- `Select/styles.ts` - Styled components wrapper
|
|
13
|
-
- `Select/constants.ts` - Configuration constants
|
|
14
|
-
**Type:** Form Component / Input
|
|
15
|
-
**Description:** Advanced select components built on react-select library. Provides standard select, async loading select, and creatable select variants with consistent Pushwoosh styling.
|
|
16
|
-
|
|
17
|
-
## TypeScript Interfaces
|
|
18
|
-
|
|
19
|
-
### SelectOption
|
|
20
|
-
```typescript
|
|
21
|
-
interface SelectOption {
|
|
22
|
-
label: string; // Display text
|
|
23
|
-
value: string; // Option value
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### SelectBase
|
|
28
|
-
```typescript
|
|
29
|
-
interface SelectBase {
|
|
30
|
-
width?: string; // Custom width
|
|
31
|
-
$isErrored?: boolean; // Error state styling
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### SelectProps
|
|
36
|
-
```typescript
|
|
37
|
-
type SelectProps<Option, IsMulti extends boolean = false> =
|
|
38
|
-
ReactSelectProps<Option, IsMulti> & SelectBase;
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### SelectAsyncProps
|
|
42
|
-
```typescript
|
|
43
|
-
type SelectAsyncProps<Option, IsMulti extends boolean = false> =
|
|
44
|
-
SelectProps<Option, IsMulti> & AsyncProps<Option, IsMulti> & SelectBase;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### SelectCreatableProps
|
|
48
|
-
```typescript
|
|
49
|
-
type SelectCreatableProps<Option, IsMulti extends boolean = false> =
|
|
50
|
-
SelectProps<Option, IsMulti> & CreatableProps<Option, IsMulti> & SelectBase;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Import & Usage
|
|
54
|
-
|
|
55
|
-
### Basic Select
|
|
56
|
-
```tsx
|
|
57
|
-
import { Select } from '@pushwoosh/dumb-components';
|
|
58
|
-
|
|
59
|
-
const options = [
|
|
60
|
-
{ value: 'apple', label: 'Apple' },
|
|
61
|
-
{ value: 'banana', label: 'Banana' },
|
|
62
|
-
{ value: 'orange', label: 'Orange' }
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
function BasicExample() {
|
|
66
|
-
const [selected, setSelected] = useState(null);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Select
|
|
70
|
-
options={options}
|
|
71
|
-
value={selected}
|
|
72
|
-
onChange={setSelected}
|
|
73
|
-
placeholder="Select a fruit..."
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Multi-Select
|
|
80
|
-
```tsx
|
|
81
|
-
import { Select, MultiSelectOptions } from '@pushwoosh/dumb-components';
|
|
82
|
-
|
|
83
|
-
function MultiSelectExample() {
|
|
84
|
-
const [selected, setSelected] = useState<MultiSelectOptions>([]);
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<Select
|
|
88
|
-
isMulti
|
|
89
|
-
options={options}
|
|
90
|
-
value={selected}
|
|
91
|
-
onChange={setSelected}
|
|
92
|
-
placeholder="Select fruits..."
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Async Select
|
|
99
|
-
```tsx
|
|
100
|
-
import { SelectAsync } from '@pushwoosh/dumb-components';
|
|
101
|
-
|
|
102
|
-
function AsyncExample() {
|
|
103
|
-
const [selected, setSelected] = useState(null);
|
|
104
|
-
|
|
105
|
-
const loadOptions = async (inputValue: string) => {
|
|
106
|
-
const response = await fetch(`/api/search?q=${inputValue}`);
|
|
107
|
-
const data = await response.json();
|
|
108
|
-
return data.map(item => ({
|
|
109
|
-
value: item.id,
|
|
110
|
-
label: item.name
|
|
111
|
-
}));
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<SelectAsync
|
|
116
|
-
loadOptions={loadOptions}
|
|
117
|
-
value={selected}
|
|
118
|
-
onChange={setSelected}
|
|
119
|
-
placeholder="Search..."
|
|
120
|
-
cacheOptions
|
|
121
|
-
defaultOptions
|
|
122
|
-
/>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Creatable Select
|
|
128
|
-
```tsx
|
|
129
|
-
import { CreatableSelect } from '@pushwoosh/dumb-components';
|
|
130
|
-
|
|
131
|
-
function CreatableExample() {
|
|
132
|
-
const [options, setOptions] = useState([
|
|
133
|
-
{ value: 'red', label: 'Red' },
|
|
134
|
-
{ value: 'blue', label: 'Blue' }
|
|
135
|
-
]);
|
|
136
|
-
const [selected, setSelected] = useState(null);
|
|
137
|
-
|
|
138
|
-
const handleCreate = (inputValue: string) => {
|
|
139
|
-
const newOption = { value: inputValue.toLowerCase(), label: inputValue };
|
|
140
|
-
setOptions([...options, newOption]);
|
|
141
|
-
setSelected(newOption);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<CreatableSelect
|
|
146
|
-
options={options}
|
|
147
|
-
value={selected}
|
|
148
|
-
onChange={setSelected}
|
|
149
|
-
onCreateOption={handleCreate}
|
|
150
|
-
placeholder="Select or create..."
|
|
151
|
-
/>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Advanced Examples
|
|
157
|
-
|
|
158
|
-
### Select with Error State
|
|
159
|
-
```tsx
|
|
160
|
-
function FormSelect({ error, ...props }) {
|
|
161
|
-
return (
|
|
162
|
-
<div>
|
|
163
|
-
<Select
|
|
164
|
-
{...props}
|
|
165
|
-
$isErrored={!!error}
|
|
166
|
-
width="300px"
|
|
167
|
-
/>
|
|
168
|
-
{error && <span style={{ color: 'red' }}>{error}</span>}
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Grouped Options
|
|
175
|
-
```tsx
|
|
176
|
-
const groupedOptions = [
|
|
177
|
-
{
|
|
178
|
-
label: 'Fruits',
|
|
179
|
-
options: [
|
|
180
|
-
{ value: 'apple', label: 'Apple' },
|
|
181
|
-
{ value: 'banana', label: 'Banana' }
|
|
182
|
-
]
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
label: 'Vegetables',
|
|
186
|
-
options: [
|
|
187
|
-
{ value: 'carrot', label: 'Carrot' },
|
|
188
|
-
{ value: 'potato', label: 'Potato' }
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
];
|
|
192
|
-
|
|
193
|
-
function GroupedSelect() {
|
|
194
|
-
return (
|
|
195
|
-
<Select
|
|
196
|
-
options={groupedOptions}
|
|
197
|
-
placeholder="Select item..."
|
|
198
|
-
/>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Custom Option Rendering
|
|
204
|
-
```tsx
|
|
205
|
-
import { components } from 'react-select';
|
|
206
|
-
|
|
207
|
-
const CustomOption = (props) => (
|
|
208
|
-
<components.Option {...props}>
|
|
209
|
-
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
210
|
-
<img src={props.data.icon} width={20} height={20} />
|
|
211
|
-
<span style={{ marginLeft: 10 }}>{props.data.label}</span>
|
|
212
|
-
</div>
|
|
213
|
-
</components.Option>
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
function SelectWithIcons() {
|
|
217
|
-
const options = [
|
|
218
|
-
{ value: 'js', label: 'JavaScript', icon: '/icons/js.png' },
|
|
219
|
-
{ value: 'py', label: 'Python', icon: '/icons/py.png' }
|
|
220
|
-
];
|
|
221
|
-
|
|
222
|
-
return (
|
|
223
|
-
<Select
|
|
224
|
-
options={options}
|
|
225
|
-
components={{ Option: CustomOption }}
|
|
226
|
-
placeholder="Select language..."
|
|
227
|
-
/>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Async Select with Debounce
|
|
233
|
-
```tsx
|
|
234
|
-
import { useMemo } from 'react';
|
|
235
|
-
import debounce from 'lodash/debounce';
|
|
236
|
-
|
|
237
|
-
function DebouncedAsyncSelect() {
|
|
238
|
-
const loadOptions = useMemo(
|
|
239
|
-
() => debounce(async (inputValue: string, callback: (options: any[]) => void) => {
|
|
240
|
-
const response = await fetch(`/api/users?search=${inputValue}`);
|
|
241
|
-
const users = await response.json();
|
|
242
|
-
callback(users.map(u => ({ value: u.id, label: u.name })));
|
|
243
|
-
}, 300),
|
|
244
|
-
[]
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
return (
|
|
248
|
-
<SelectAsync
|
|
249
|
-
loadOptions={loadOptions}
|
|
250
|
-
placeholder="Search users..."
|
|
251
|
-
noOptionsMessage={() => "No users found"}
|
|
252
|
-
loadingMessage={() => "Searching..."}
|
|
253
|
-
/>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Controlled Select with Form
|
|
259
|
-
```tsx
|
|
260
|
-
function UserForm() {
|
|
261
|
-
const [formData, setFormData] = useState({
|
|
262
|
-
name: '',
|
|
263
|
-
country: null,
|
|
264
|
-
skills: []
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
const countries = [
|
|
268
|
-
{ value: 'us', label: 'United States' },
|
|
269
|
-
{ value: 'uk', label: 'United Kingdom' },
|
|
270
|
-
{ value: 'ca', label: 'Canada' }
|
|
271
|
-
];
|
|
272
|
-
|
|
273
|
-
const skills = [
|
|
274
|
-
{ value: 'react', label: 'React' },
|
|
275
|
-
{ value: 'node', label: 'Node.js' },
|
|
276
|
-
{ value: 'python', label: 'Python' }
|
|
277
|
-
];
|
|
278
|
-
|
|
279
|
-
return (
|
|
280
|
-
<form>
|
|
281
|
-
<Select
|
|
282
|
-
options={countries}
|
|
283
|
-
value={formData.country}
|
|
284
|
-
onChange={(value) => setFormData({ ...formData, country: value })}
|
|
285
|
-
placeholder="Select country..."
|
|
286
|
-
isClearable
|
|
287
|
-
/>
|
|
288
|
-
|
|
289
|
-
<Select
|
|
290
|
-
isMulti
|
|
291
|
-
options={skills}
|
|
292
|
-
value={formData.skills}
|
|
293
|
-
onChange={(value) => setFormData({ ...formData, skills: value })}
|
|
294
|
-
placeholder="Select skills..."
|
|
295
|
-
closeMenuOnSelect={false}
|
|
296
|
-
/>
|
|
297
|
-
</form>
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Props Reference
|
|
303
|
-
|
|
304
|
-
### Common Props (All Variants)
|
|
305
|
-
| Prop | Type | Required | Default | Description |
|
|
306
|
-
|------|------|----------|---------|-------------|
|
|
307
|
-
| `options` | `Option[]` | - | - | Array of options |
|
|
308
|
-
| `value` | `Option \| Option[] \| null` | - | - | Selected value(s) |
|
|
309
|
-
| `onChange` | `(value: Option) => void` | - | - | Change handler |
|
|
310
|
-
| `placeholder` | `string` | - | `'Select...'` | Placeholder text |
|
|
311
|
-
| `isMulti` | `boolean` | - | `false` | Enable multi-select |
|
|
312
|
-
| `isDisabled` | `boolean` | - | `false` | Disable the select |
|
|
313
|
-
| `isLoading` | `boolean` | - | `false` | Show loading state |
|
|
314
|
-
| `isClearable` | `boolean` | - | `false` | Show clear button |
|
|
315
|
-
| `isSearchable` | `boolean` | - | `true` | Enable search |
|
|
316
|
-
| `width` | `string` | - | - | Custom width |
|
|
317
|
-
| `$isErrored` | `boolean` | - | `false` | Error state styling |
|
|
318
|
-
| `menuIsOpen` | `boolean` | - | - | Control menu visibility |
|
|
319
|
-
| `closeMenuOnSelect` | `boolean` | - | `true` | Close menu on selection |
|
|
320
|
-
| `classNamePrefix` | `string` | - | `'kit-select'` | CSS class prefix |
|
|
321
|
-
|
|
322
|
-
### SelectAsync Additional Props
|
|
323
|
-
| Prop | Type | Required | Default | Description |
|
|
324
|
-
|------|------|----------|---------|-------------|
|
|
325
|
-
| `loadOptions` | `(inputValue: string) => Promise<Option[]>` | ✓ | - | Async options loader |
|
|
326
|
-
| `cacheOptions` | `boolean` | - | `false` | Cache loaded options |
|
|
327
|
-
| `defaultOptions` | `boolean \| Option[]` | - | `false` | Initial options or load on mount |
|
|
328
|
-
| `loadingMessage` | `() => string` | - | `'Loading...'` | Loading message |
|
|
329
|
-
| `noOptionsMessage` | `() => string` | - | `'No options'` | No options message |
|
|
330
|
-
|
|
331
|
-
### CreatableSelect Additional Props
|
|
332
|
-
| Prop | Type | Required | Default | Description |
|
|
333
|
-
|------|------|----------|---------|-------------|
|
|
334
|
-
| `onCreateOption` | `(inputValue: string) => void` | - | - | Handler for creating new options |
|
|
335
|
-
| `formatCreateLabel` | `(inputValue: string) => string` | - | `'Create "{input}"'` | Format create option label |
|
|
336
|
-
| `isValidNewOption` | `(inputValue: string) => boolean` | - | - | Validate new option |
|
|
337
|
-
| `getNewOptionData` | `(inputValue: string, label: string) => Option` | - | - | Format new option data |
|
|
338
|
-
|
|
339
|
-
## AI Agent Guidelines
|
|
340
|
-
|
|
341
|
-
### ✅ Recommended Patterns
|
|
342
|
-
- Always provide both `value` and `onChange` for controlled components
|
|
343
|
-
- Use `SelectOption` type for consistent option structure
|
|
344
|
-
- Enable `isClearable` for optional fields
|
|
345
|
-
- Use `isMulti` for multiple selections
|
|
346
|
-
- Implement proper loading states with `SelectAsync`
|
|
347
|
-
- Cache options in async selects when appropriate
|
|
348
|
-
- Use `placeholder` to guide user input
|
|
349
|
-
- Handle empty states with `noOptionsMessage`
|
|
350
|
-
|
|
351
|
-
### ❌ Common Mistakes to Avoid
|
|
352
|
-
- Don't forget to handle `null` values in onChange
|
|
353
|
-
- Don't use inline option arrays - define outside render
|
|
354
|
-
- Avoid not handling loading/error states in async selects
|
|
355
|
-
- Don't forget `defaultOptions` for initial load in async
|
|
356
|
-
- Avoid complex objects as values - use simple strings/numbers
|
|
357
|
-
- Don't modify options array directly - use state
|
|
358
|
-
- Avoid missing `key` props in custom components
|
|
359
|
-
|
|
360
|
-
### Integration Tips
|
|
361
|
-
- Select is built on react-select v5
|
|
362
|
-
- All react-select props are supported
|
|
363
|
-
- Custom styling via `classNamePrefix` and styled-components
|
|
364
|
-
- Clear indicator uses CloseIcon from kit-icons
|
|
365
|
-
- Works with form libraries (react-hook-form, formik)
|
|
366
|
-
- Supports keyboard navigation and accessibility
|
|
367
|
-
- Menu portal can be used for overflow issues
|
|
368
|
-
|
|
369
|
-
## Related Components
|
|
370
|
-
- **EnhancedInput** - For text input fields
|
|
371
|
-
- **Checkbox** - For multiple boolean options
|
|
372
|
-
- **Radio** - For single choice from few options
|
|
373
|
-
- **Button** - For form submission
|
|
374
|
-
- **DateTimePicker** - For date/time selection
|