@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,231 +0,0 @@
|
|
|
1
|
-
# Checkbox - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for Checkbox component
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
**Component:** Checkbox
|
|
9
|
-
**Import Path:** `import { Checkbox } from '@pushwoosh/dumb-components'`
|
|
10
|
-
**Files:** Checkbox.tsx, types.ts, styles.ts, maps.ts, index.ts
|
|
11
|
-
**Type:** Form Component / Input Component
|
|
12
|
-
**Description:** Checkbox component with label support, tooltip integration, indeterminate state, and error styling for form inputs
|
|
13
|
-
|
|
14
|
-
## TypeScript Interface
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
type CheckboxType = 'normal' | 'error';
|
|
18
|
-
|
|
19
|
-
interface CheckboxProps {
|
|
20
|
-
label?: ReactNode;
|
|
21
|
-
id?: string;
|
|
22
|
-
name?: string;
|
|
23
|
-
value?: string | number;
|
|
24
|
-
type?: CheckboxType;
|
|
25
|
-
isChecked?: boolean;
|
|
26
|
-
isDisabled?: boolean;
|
|
27
|
-
isIndeterminate?: boolean;
|
|
28
|
-
tooltip?: string;
|
|
29
|
-
activeCheckboxColor?: string;
|
|
30
|
-
onChange?: (checked: boolean) => void;
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Import & Usage
|
|
35
|
-
|
|
36
|
-
**Import:**
|
|
37
|
-
```typescript
|
|
38
|
-
import { Checkbox } from '@pushwoosh/dumb-components';
|
|
39
|
-
import type { CheckboxProps, CheckboxType } from '@pushwoosh/dumb-components';
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Basic Usage:**
|
|
43
|
-
```tsx
|
|
44
|
-
function App() {
|
|
45
|
-
const [isChecked, setIsChecked] = useState(false);
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<Checkbox
|
|
49
|
-
label="Accept terms and conditions"
|
|
50
|
-
isChecked={isChecked}
|
|
51
|
-
onChange={setIsChecked}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Advanced Examples:**
|
|
58
|
-
```tsx
|
|
59
|
-
// Form checkbox with validation
|
|
60
|
-
const [agreedToTerms, setAgreedToTerms] = useState(false);
|
|
61
|
-
const [hasError, setHasError] = useState(false);
|
|
62
|
-
|
|
63
|
-
<Checkbox
|
|
64
|
-
label="I agree to the terms and conditions"
|
|
65
|
-
isChecked={agreedToTerms}
|
|
66
|
-
type={hasError ? 'error' : 'normal'}
|
|
67
|
-
onChange={(checked) => {
|
|
68
|
-
setAgreedToTerms(checked);
|
|
69
|
-
setHasError(false);
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
|
|
73
|
-
// Checkbox with tooltip
|
|
74
|
-
<Checkbox
|
|
75
|
-
label="Enable advanced features"
|
|
76
|
-
isChecked={enableAdvanced}
|
|
77
|
-
tooltip="This will unlock additional configuration options"
|
|
78
|
-
onChange={setEnableAdvanced}
|
|
79
|
-
/>
|
|
80
|
-
|
|
81
|
-
// Indeterminate state (for "select all" scenarios)
|
|
82
|
-
<Checkbox
|
|
83
|
-
label="Select all items"
|
|
84
|
-
isChecked={selectedItems.length === totalItems}
|
|
85
|
-
isIndeterminate={selectedItems.length > 0 && selectedItems.length < totalItems}
|
|
86
|
-
onChange={(checked) => {
|
|
87
|
-
if (checked) {
|
|
88
|
-
selectAllItems();
|
|
89
|
-
} else {
|
|
90
|
-
deselectAllItems();
|
|
91
|
-
}
|
|
92
|
-
}}
|
|
93
|
-
/>
|
|
94
|
-
|
|
95
|
-
// Disabled checkbox
|
|
96
|
-
<Checkbox
|
|
97
|
-
label="This feature is not available"
|
|
98
|
-
isChecked={false}
|
|
99
|
-
isDisabled={true}
|
|
100
|
-
/>
|
|
101
|
-
|
|
102
|
-
// Custom color and form integration
|
|
103
|
-
<form>
|
|
104
|
-
<Checkbox
|
|
105
|
-
name="newsletter"
|
|
106
|
-
value="subscribe"
|
|
107
|
-
label="Subscribe to newsletter"
|
|
108
|
-
isChecked={formData.newsletter}
|
|
109
|
-
activeCheckboxColor="#007bff"
|
|
110
|
-
onChange={(checked) =>
|
|
111
|
-
setFormData(prev => ({ ...prev, newsletter: checked }))
|
|
112
|
-
}
|
|
113
|
-
/>
|
|
114
|
-
</form>
|
|
115
|
-
|
|
116
|
-
// List of checkboxes
|
|
117
|
-
{options.map(option => (
|
|
118
|
-
<Checkbox
|
|
119
|
-
key={option.id}
|
|
120
|
-
label={option.label}
|
|
121
|
-
isChecked={selectedOptions.includes(option.id)}
|
|
122
|
-
onChange={(checked) => handleOptionChange(option.id, checked)}
|
|
123
|
-
/>
|
|
124
|
-
))}
|
|
125
|
-
|
|
126
|
-
// Error state with validation
|
|
127
|
-
<Checkbox
|
|
128
|
-
label="Required field"
|
|
129
|
-
isChecked={isChecked}
|
|
130
|
-
type={showErrors && !isChecked ? 'error' : 'normal'}
|
|
131
|
-
onChange={setIsChecked}
|
|
132
|
-
tooltip={showErrors && !isChecked ? 'This field is required' : undefined}
|
|
133
|
-
/>
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Props Reference
|
|
137
|
-
|
|
138
|
-
| Prop | Type | Default | Description |
|
|
139
|
-
|------|------|---------|-------------|
|
|
140
|
-
| label | ReactNode | undefined | Text or element to display next to checkbox |
|
|
141
|
-
| isChecked | boolean | undefined | Whether checkbox is checked |
|
|
142
|
-
| isDisabled | boolean | false | Whether checkbox is disabled |
|
|
143
|
-
| isIndeterminate | boolean | false | Whether checkbox shows indeterminate state |
|
|
144
|
-
| type | 'normal' \| 'error' | 'normal' | Visual style variant |
|
|
145
|
-
| onChange | (checked: boolean) => void | undefined | Callback when checkbox state changes |
|
|
146
|
-
| id | string | auto-generated | HTML id attribute |
|
|
147
|
-
| name | string | undefined | HTML name attribute for forms |
|
|
148
|
-
| value | string \| number | undefined | HTML value attribute |
|
|
149
|
-
| tooltip | string | undefined | Tooltip text to show with question mark |
|
|
150
|
-
| activeCheckboxColor | string | undefined | Custom color for active state |
|
|
151
|
-
|
|
152
|
-
## AI Agent Guidelines
|
|
153
|
-
|
|
154
|
-
### ✅ Recommended Patterns
|
|
155
|
-
- Always handle `onChange` to make checkbox controllable
|
|
156
|
-
- Use `type="error"` for validation feedback
|
|
157
|
-
- Add `tooltip` for complex or unclear options
|
|
158
|
-
- Use `isIndeterminate` for "select all" scenarios
|
|
159
|
-
- Provide meaningful labels for accessibility
|
|
160
|
-
- Use `name` and `value` props in forms for proper data collection
|
|
161
|
-
|
|
162
|
-
### ❌ Common Mistakes to Avoid
|
|
163
|
-
- Don't forget to handle `onChange` - checkbox won't work without it
|
|
164
|
-
- Avoid very long labels - consider using tooltip for details
|
|
165
|
-
- Don't use disabled state unless absolutely necessary
|
|
166
|
-
- Don't rely only on color for error states - use clear labels
|
|
167
|
-
- Avoid custom colors unless part of consistent design system
|
|
168
|
-
|
|
169
|
-
### Integration Tips
|
|
170
|
-
- Works well with form libraries like react-hook-form
|
|
171
|
-
- Can be grouped for multiple selections
|
|
172
|
-
- Combines effectively with validation libraries
|
|
173
|
-
- Use with consistent spacing in checkbox groups
|
|
174
|
-
- Good for settings panels and preference forms
|
|
175
|
-
|
|
176
|
-
## States and Behavior
|
|
177
|
-
|
|
178
|
-
### Visual States
|
|
179
|
-
- **Normal**: Default unchecked state
|
|
180
|
-
- **Checked**: User selected state
|
|
181
|
-
- **Indeterminate**: Partially selected (mixed state)
|
|
182
|
-
- **Disabled**: Non-interactive state
|
|
183
|
-
- **Error**: Validation error state
|
|
184
|
-
|
|
185
|
-
### Accessibility Features
|
|
186
|
-
- **Auto-generated IDs**: Ensures proper label association
|
|
187
|
-
- **Keyboard Navigation**: Supports space bar and tab navigation
|
|
188
|
-
- **Screen Reader Support**: Proper labeling and state communication
|
|
189
|
-
- **Focus Management**: Visible focus indicators
|
|
190
|
-
|
|
191
|
-
## Common Patterns
|
|
192
|
-
|
|
193
|
-
### Select All Checkbox
|
|
194
|
-
```tsx
|
|
195
|
-
const isAllSelected = selectedItems.length === allItems.length;
|
|
196
|
-
const isIndeterminate = selectedItems.length > 0 && selectedItems.length < allItems.length;
|
|
197
|
-
|
|
198
|
-
<Checkbox
|
|
199
|
-
label="Select all"
|
|
200
|
-
isChecked={isAllSelected}
|
|
201
|
-
isIndeterminate={isIndeterminate}
|
|
202
|
-
onChange={(checked) => {
|
|
203
|
-
if (checked) {
|
|
204
|
-
setSelectedItems([...allItems]);
|
|
205
|
-
} else {
|
|
206
|
-
setSelectedItems([]);
|
|
207
|
-
}
|
|
208
|
-
}}
|
|
209
|
-
/>
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Form Validation
|
|
213
|
-
```tsx
|
|
214
|
-
<Checkbox
|
|
215
|
-
label="I have read and agree to the terms"
|
|
216
|
-
isChecked={agreedToTerms}
|
|
217
|
-
type={submitted && !agreedToTerms ? 'error' : 'normal'}
|
|
218
|
-
onChange={setAgreedToTerms}
|
|
219
|
-
/>
|
|
220
|
-
{submitted && !agreedToTerms && (
|
|
221
|
-
<span>You must agree to the terms to continue</span>
|
|
222
|
-
)}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
## Related Components
|
|
226
|
-
- Radio - for single selection from multiple options
|
|
227
|
-
- Switch - for on/off toggles
|
|
228
|
-
- TooltipTrigger - used internally for tooltip functionality
|
|
229
|
-
- Button - for form submission actions
|
|
230
|
-
|
|
231
|
-
---
|
package/Chip/ai-documentation.md
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
# Chip - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for Chip component
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
**Component:** Chip
|
|
9
|
-
**Import Path:** `import { Chip } from '@pushwoosh/dumb-components'`
|
|
10
|
-
**Files:** Chip.tsx, Chip.types.ts, styles.ts, Chip.constants.ts, index.ts
|
|
11
|
-
**Type:** UI Component / Interactive Tag
|
|
12
|
-
**Description:** Chip component for displaying tags, filters, or removable items with optional close functionality and multiple variants
|
|
13
|
-
|
|
14
|
-
## TypeScript Interface
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
type ChipVariant = 'primary' | 'danger' | 'warning';
|
|
18
|
-
|
|
19
|
-
interface ChipProps extends PropsWithChildren<HTMLAttributes<HTMLDivElement>> {
|
|
20
|
-
$variant?: ChipVariant;
|
|
21
|
-
$selected?: boolean;
|
|
22
|
-
$onClose?: HTMLAttributes<HTMLDivElement>['onClick'];
|
|
23
|
-
$readOnly?: boolean;
|
|
24
|
-
$maxWidth?: string;
|
|
25
|
-
$icon?: ReactNode;
|
|
26
|
-
$tooltip?: ReactNode;
|
|
27
|
-
as?: string;
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Import & Usage
|
|
32
|
-
|
|
33
|
-
**Import:**
|
|
34
|
-
```typescript
|
|
35
|
-
import { Chip } from '@pushwoosh/dumb-components';
|
|
36
|
-
import type { ChipProps, ChipVariant } from '@pushwoosh/dumb-components';
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
**Basic Usage:**
|
|
40
|
-
```tsx
|
|
41
|
-
function App() {
|
|
42
|
-
return (
|
|
43
|
-
<Chip $variant="primary">
|
|
44
|
-
JavaScript
|
|
45
|
-
</Chip>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Advanced Examples:**
|
|
51
|
-
```tsx
|
|
52
|
-
// Basic tags/categories
|
|
53
|
-
<Chip $variant="primary">React</Chip>
|
|
54
|
-
<Chip $variant="primary">TypeScript</Chip>
|
|
55
|
-
<Chip $variant="warning">Beta</Chip>
|
|
56
|
-
|
|
57
|
-
// Selected state for filters
|
|
58
|
-
<Chip
|
|
59
|
-
$variant="primary"
|
|
60
|
-
$selected={selectedTags.includes('react')}
|
|
61
|
-
onClick={() => toggleTag('react')}
|
|
62
|
-
>
|
|
63
|
-
React
|
|
64
|
-
</Chip>
|
|
65
|
-
|
|
66
|
-
// Removable chips with close button
|
|
67
|
-
<Chip
|
|
68
|
-
$variant="primary"
|
|
69
|
-
$onClose={() => removeTag('javascript')}
|
|
70
|
-
>
|
|
71
|
-
JavaScript
|
|
72
|
-
</Chip>
|
|
73
|
-
|
|
74
|
-
// Read-only chips (non-interactive)
|
|
75
|
-
<Chip $variant="warning" $readOnly>
|
|
76
|
-
Deprecated
|
|
77
|
-
</Chip>
|
|
78
|
-
|
|
79
|
-
// Different variants for semantic meaning
|
|
80
|
-
<Chip $variant="danger" $onClose={() => removeError(errorId)}>
|
|
81
|
-
Error: Invalid input
|
|
82
|
-
</Chip>
|
|
83
|
-
<Chip $variant="warning">
|
|
84
|
-
Warning: Slow query
|
|
85
|
-
</Chip>
|
|
86
|
-
<Chip $variant="primary" $selected>
|
|
87
|
-
Active filter
|
|
88
|
-
</Chip>
|
|
89
|
-
|
|
90
|
-
// Filter chips with selection state
|
|
91
|
-
{filters.map(filter => (
|
|
92
|
-
<Chip
|
|
93
|
-
key={filter.id}
|
|
94
|
-
$variant="primary"
|
|
95
|
-
$selected={activeFilters.includes(filter.id)}
|
|
96
|
-
onClick={() => toggleFilter(filter.id)}
|
|
97
|
-
>
|
|
98
|
-
{filter.name}
|
|
99
|
-
</Chip>
|
|
100
|
-
))}
|
|
101
|
-
|
|
102
|
-
// Tag management with removal
|
|
103
|
-
{tags.map(tag => (
|
|
104
|
-
<Chip
|
|
105
|
-
key={tag}
|
|
106
|
-
$variant="primary"
|
|
107
|
-
$onClose={() => handleRemoveTag(tag)}
|
|
108
|
-
>
|
|
109
|
-
{tag}
|
|
110
|
-
</Chip>
|
|
111
|
-
))}
|
|
112
|
-
|
|
113
|
-
// Custom element rendering
|
|
114
|
-
<Chip
|
|
115
|
-
as="a"
|
|
116
|
-
href={`/tags/${tag.slug}`}
|
|
117
|
-
$variant="primary"
|
|
118
|
-
>
|
|
119
|
-
{tag.name}
|
|
120
|
-
</Chip>
|
|
121
|
-
|
|
122
|
-
import { TagIcon } from '@pushwoosh/kit-icons';
|
|
123
|
-
|
|
124
|
-
// Chip with leading icon
|
|
125
|
-
<Chip $variant="primary" $icon={<TagIcon size="small" view="lined" />}>
|
|
126
|
-
Segment
|
|
127
|
-
</Chip>
|
|
128
|
-
|
|
129
|
-
// Icon + removable
|
|
130
|
-
<Chip
|
|
131
|
-
$icon={<TagIcon size="small" view="lined" />}
|
|
132
|
-
$onClose={() => removeTag(tag)}
|
|
133
|
-
>
|
|
134
|
-
{tag}
|
|
135
|
-
</Chip>
|
|
136
|
-
|
|
137
|
-
// Read-only chip with "?" tooltip
|
|
138
|
-
<Chip $readOnly $variant="primary" $tooltip="Explanation for this chip">
|
|
139
|
-
Label
|
|
140
|
-
</Chip>
|
|
141
|
-
|
|
142
|
-
// Status chips
|
|
143
|
-
function getStatusChip(status: string) {
|
|
144
|
-
const variantMap = {
|
|
145
|
-
active: 'primary',
|
|
146
|
-
warning: 'warning',
|
|
147
|
-
error: 'danger'
|
|
148
|
-
} as const;
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<Chip $variant={variantMap[status] || 'primary'}>
|
|
152
|
-
{status.toUpperCase()}
|
|
153
|
-
</Chip>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Props Reference
|
|
159
|
-
|
|
160
|
-
| Prop | Type | Default | Description |
|
|
161
|
-
|------|------|---------|-------------|
|
|
162
|
-
| $variant | 'primary' \| 'danger' \| 'warning' | 'primary' | Visual style variant |
|
|
163
|
-
| $selected | boolean | false | Whether chip appears in selected state |
|
|
164
|
-
| $onClose | onClick handler | undefined | Makes chip removable with close icon |
|
|
165
|
-
| $maxWidth | string | undefined | CSS max-width; truncates label with ellipsis |
|
|
166
|
-
| $icon | ReactNode | undefined | Leading icon slot; pass a kit-icon with size="small" |
|
|
167
|
-
| $tooltip | ReactNode | undefined | Tooltip content; renders a trailing "?" trigger on read-only chips |
|
|
168
|
-
| $readOnly | boolean | false | Whether chip is interactive |
|
|
169
|
-
| as | string | 'div' | HTML element to render as |
|
|
170
|
-
| children | ReactNode | required | Chip content |
|
|
171
|
-
| ...rest | HTMLDivElement props | | All standard div props (onClick, className, etc.) |
|
|
172
|
-
|
|
173
|
-
## Variant Guide
|
|
174
|
-
|
|
175
|
-
| Variant | Usage | Example Use Cases |
|
|
176
|
-
|---------|-------|-------------------|
|
|
177
|
-
| primary | Default, neutral items | Tags, categories, selected filters |
|
|
178
|
-
| danger | Errors, removable warnings | Error messages, dangerous actions |
|
|
179
|
-
| warning | Cautions, temporary states | Beta features, warnings, alerts |
|
|
180
|
-
|
|
181
|
-
## Hover States
|
|
182
|
-
|
|
183
|
-
Each variant darkens its background and tint on hover. Hover is only applied to
|
|
184
|
-
interactive chips — it is intentionally disabled when `$selected` (selected chips
|
|
185
|
-
keep the solid `MAIN` background) or `$readOnly` (non-interactive).
|
|
186
|
-
|
|
187
|
-
| Variant | Background → hover | Tint → hover |
|
|
188
|
-
|---------|--------------------|--------------|
|
|
189
|
-
| primary | BRIGHT_LIGHT → BRIGHT_LIGHT_HOVER | PRIMARY → PRIMARY_HOVER |
|
|
190
|
-
| danger | DANGER_LIGHT → DANGER_LIGHT_HOVER | DANGER → DANGER_HOVER |
|
|
191
|
-
| warning | WARNING_LIGHT → WARNING_LIGHT_HOVER | WARNING → WARNING_HOVER |
|
|
192
|
-
|
|
193
|
-
## AI Agent Guidelines
|
|
194
|
-
|
|
195
|
-
### ✅ Recommended Patterns
|
|
196
|
-
- Use `$variant="primary"` for most tags and filters
|
|
197
|
-
- Add `$onClose` for removable items like user-added tags
|
|
198
|
-
- Use `$selected` state for active filters or selections
|
|
199
|
-
- Keep chip text short and descriptive
|
|
200
|
-
- Use semantic variants (danger for errors, warning for cautions)
|
|
201
|
-
- Group related chips together with consistent spacing
|
|
202
|
-
- When adding a leading icon, always use `size="small"` so it fits the chip's 24px height; pass `view` too if the icon defines one
|
|
203
|
-
- Slots are fixed: leading `$icon` on the left; the right side holds exactly one element — the close button on active chips (`$onClose`), or the `$tooltip` "?" trigger on read-only chips. A read-only chip never shows a close button, and the close button + tooltip are mutually exclusive.
|
|
204
|
-
|
|
205
|
-
### ❌ Common Mistakes to Avoid
|
|
206
|
-
- Don't use chips for very long text content
|
|
207
|
-
- Avoid mixing too many variants in the same group
|
|
208
|
-
- Don't make read-only chips look interactive
|
|
209
|
-
- Avoid using chips for primary navigation
|
|
210
|
-
- Don't nest interactive elements inside chips
|
|
211
|
-
|
|
212
|
-
### Integration Tips
|
|
213
|
-
- Works well in filter interfaces for multi-select options
|
|
214
|
-
- Effective for tag management systems
|
|
215
|
-
- Can be used in search interfaces for search terms
|
|
216
|
-
- Good for displaying categories, skills, or attributes
|
|
217
|
-
- Combines well with input fields for tag creation
|
|
218
|
-
|
|
219
|
-
## Interaction Patterns
|
|
220
|
-
|
|
221
|
-
### Filter Chips
|
|
222
|
-
```tsx
|
|
223
|
-
// Multi-select filter
|
|
224
|
-
{availableFilters.map(filter => (
|
|
225
|
-
<Chip
|
|
226
|
-
key={filter.id}
|
|
227
|
-
$variant="primary"
|
|
228
|
-
$selected={selectedFilters.includes(filter.id)}
|
|
229
|
-
onClick={() => {
|
|
230
|
-
if (selectedFilters.includes(filter.id)) {
|
|
231
|
-
setSelectedFilters(prev => prev.filter(id => id !== filter.id));
|
|
232
|
-
} else {
|
|
233
|
-
setSelectedFilters(prev => [...prev, filter.id]);
|
|
234
|
-
}
|
|
235
|
-
}}
|
|
236
|
-
>
|
|
237
|
-
{filter.name}
|
|
238
|
-
</Chip>
|
|
239
|
-
))}
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### Tag Management
|
|
243
|
-
```tsx
|
|
244
|
-
// Add/remove tags
|
|
245
|
-
const [tags, setTags] = useState(['react', 'typescript']);
|
|
246
|
-
|
|
247
|
-
// Display with remove functionality
|
|
248
|
-
{tags.map(tag => (
|
|
249
|
-
<Chip
|
|
250
|
-
key={tag}
|
|
251
|
-
$onClose={() => setTags(prev => prev.filter(t => t !== tag))}
|
|
252
|
-
>
|
|
253
|
-
{tag}
|
|
254
|
-
</Chip>
|
|
255
|
-
))}
|
|
256
|
-
|
|
257
|
-
// Add new tag
|
|
258
|
-
<input
|
|
259
|
-
onKeyPress={(e) => {
|
|
260
|
-
if (e.key === 'Enter' && e.target.value) {
|
|
261
|
-
setTags(prev => [...prev, e.target.value]);
|
|
262
|
-
e.target.value = '';
|
|
263
|
-
}
|
|
264
|
-
}}
|
|
265
|
-
placeholder="Add tag..."
|
|
266
|
-
/>
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Accessibility Features
|
|
270
|
-
- **Keyboard Navigation**: Supports focus and interaction via keyboard
|
|
271
|
-
- **ARIA Support**: Proper roles and states for screen readers
|
|
272
|
-
- **Focus Management**: Clear focus indicators
|
|
273
|
-
- **Close Button**: Accessible close functionality when removable
|
|
274
|
-
|
|
275
|
-
## Related Components
|
|
276
|
-
- Badge - for status indicators without interaction
|
|
277
|
-
- Button - for more prominent actions
|
|
278
|
-
- Tag - alternative naming for similar functionality
|
|
279
|
-
- Filter components - for complex filtering interfaces
|
|
280
|
-
|
|
281
|
-
---
|