@pushwoosh/dumb-components 1.1.148 → 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 +7 -0
- package/Calendar/CalendarSuperForm/types.d.ts +36 -10
- 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,352 +0,0 @@
|
|
|
1
|
-
# EnhancedInput - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for EnhancedInput component
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
**Component:** EnhancedInput, SearchInput
|
|
8
|
-
**Import Path:** `import { EnhancedInput, SearchInput } from '@pushwoosh/dumb-components'`
|
|
9
|
-
**Files:**
|
|
10
|
-
- `EnhancedInput/EnhancedInput.tsx` - Main enhanced input component
|
|
11
|
-
- `EnhancedInput/SearchInput.tsx` - Search input variant
|
|
12
|
-
- `EnhancedInput/types.ts` - TypeScript interfaces
|
|
13
|
-
- `EnhancedInput/styles.ts` - Styled components wrapper
|
|
14
|
-
**Type:** Form Component / Input
|
|
15
|
-
**Description:** Enhanced text input component with icon support and clear functionality. Built on top of NativeInput with additional features like prefix icons and clear buttons. SearchInput is a pre-configured variant with search icon.
|
|
16
|
-
|
|
17
|
-
## TypeScript Interfaces
|
|
18
|
-
|
|
19
|
-
### EnhancedInputProps
|
|
20
|
-
```typescript
|
|
21
|
-
interface EnhancedInputProps extends InputHTMLAttributes<HTMLInputElement>, NativeInputProps {
|
|
22
|
-
$icon?: ReactNode; // Prefix icon element
|
|
23
|
-
$onClear?: () => void; // Clear button handler
|
|
24
|
-
$isErrored?: boolean; // Error state styling (from NativeInputProps)
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### SearchInputProps
|
|
29
|
-
```typescript
|
|
30
|
-
type SearchInputProps = Omit<EnhancedInputProps, '$icon'>;
|
|
31
|
-
// SearchInput automatically includes search icon
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### NativeInputProps (inherited)
|
|
35
|
-
```typescript
|
|
36
|
-
interface NativeInputProps {
|
|
37
|
-
$isErrored?: boolean; // Error state styling
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Import & Usage
|
|
42
|
-
|
|
43
|
-
### Basic EnhancedInput
|
|
44
|
-
```tsx
|
|
45
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
46
|
-
|
|
47
|
-
function BasicExample() {
|
|
48
|
-
const [value, setValue] = useState('');
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<EnhancedInput
|
|
52
|
-
value={value}
|
|
53
|
-
onChange={(e) => setValue(e.target.value)}
|
|
54
|
-
placeholder="Enter text..."
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### EnhancedInput with Icon
|
|
61
|
-
```tsx
|
|
62
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
63
|
-
import { UserIcon } from '@pushwoosh/kit-icons';
|
|
64
|
-
|
|
65
|
-
function InputWithIcon() {
|
|
66
|
-
const [username, setUsername] = useState('');
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<EnhancedInput
|
|
70
|
-
$icon={<UserIcon size="small" />}
|
|
71
|
-
value={username}
|
|
72
|
-
onChange={(e) => setUsername(e.target.value)}
|
|
73
|
-
placeholder="Username"
|
|
74
|
-
/>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### EnhancedInput with Clear Button
|
|
80
|
-
```tsx
|
|
81
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
82
|
-
|
|
83
|
-
function ClearableInput() {
|
|
84
|
-
const [value, setValue] = useState('');
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<EnhancedInput
|
|
88
|
-
value={value}
|
|
89
|
-
onChange={(e) => setValue(e.target.value)}
|
|
90
|
-
$onClear={() => setValue('')}
|
|
91
|
-
placeholder="Clearable input..."
|
|
92
|
-
/>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### SearchInput
|
|
98
|
-
```tsx
|
|
99
|
-
import { SearchInput } from '@pushwoosh/dumb-components';
|
|
100
|
-
|
|
101
|
-
function SearchExample() {
|
|
102
|
-
const [searchTerm, setSearchTerm] = useState('');
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<SearchInput
|
|
106
|
-
value={searchTerm}
|
|
107
|
-
onChange={(e) => setSearchTerm(e.target.value)}
|
|
108
|
-
$onClear={() => setSearchTerm('')}
|
|
109
|
-
placeholder="Search..."
|
|
110
|
-
/>
|
|
111
|
-
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## Advanced Examples
|
|
117
|
-
|
|
118
|
-
### Form with Validation
|
|
119
|
-
```tsx
|
|
120
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
121
|
-
import { EmailIcon } from '@pushwoosh/kit-icons';
|
|
122
|
-
|
|
123
|
-
function EmailInput() {
|
|
124
|
-
const [email, setEmail] = useState('');
|
|
125
|
-
const [error, setError] = useState('');
|
|
126
|
-
|
|
127
|
-
const validateEmail = (value: string) => {
|
|
128
|
-
const isValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
129
|
-
setError(isValid ? '' : 'Invalid email address');
|
|
130
|
-
return isValid;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
134
|
-
const value = e.target.value;
|
|
135
|
-
setEmail(value);
|
|
136
|
-
if (value) validateEmail(value);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<div>
|
|
141
|
-
<EnhancedInput
|
|
142
|
-
$icon={<EmailIcon size="small" />}
|
|
143
|
-
type="email"
|
|
144
|
-
value={email}
|
|
145
|
-
onChange={handleChange}
|
|
146
|
-
$isErrored={!!error}
|
|
147
|
-
$onClear={() => {
|
|
148
|
-
setEmail('');
|
|
149
|
-
setError('');
|
|
150
|
-
}}
|
|
151
|
-
placeholder="Email address"
|
|
152
|
-
/>
|
|
153
|
-
{error && <span style={{ color: 'red', fontSize: '12px' }}>{error}</span>}
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Password Input with Toggle
|
|
160
|
-
```tsx
|
|
161
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
162
|
-
import { LockIcon, EyeIcon, EyeClosedIcon } from '@pushwoosh/kit-icons';
|
|
163
|
-
|
|
164
|
-
function PasswordInput() {
|
|
165
|
-
const [password, setPassword] = useState('');
|
|
166
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<EnhancedInput
|
|
170
|
-
$icon={<LockIcon size="small" />}
|
|
171
|
-
type={showPassword ? 'text' : 'password'}
|
|
172
|
-
value={password}
|
|
173
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
174
|
-
placeholder="Password"
|
|
175
|
-
$onClear={() => setPassword('')}
|
|
176
|
-
// Custom action icon instead of clear
|
|
177
|
-
endAdornment={
|
|
178
|
-
<button onClick={() => setShowPassword(!showPassword)}>
|
|
179
|
-
{showPassword ? <EyeClosedIcon /> : <EyeIcon />}
|
|
180
|
-
</button>
|
|
181
|
-
}
|
|
182
|
-
/>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Debounced Search
|
|
188
|
-
```tsx
|
|
189
|
-
import { SearchInput } from '@pushwoosh/dumb-components';
|
|
190
|
-
import { useEffect, useState } from 'react';
|
|
191
|
-
|
|
192
|
-
function DebouncedSearch({ onSearch }) {
|
|
193
|
-
const [value, setValue] = useState('');
|
|
194
|
-
const [debouncedValue, setDebouncedValue] = useState('');
|
|
195
|
-
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
const timer = setTimeout(() => {
|
|
198
|
-
setDebouncedValue(value);
|
|
199
|
-
}, 300);
|
|
200
|
-
|
|
201
|
-
return () => clearTimeout(timer);
|
|
202
|
-
}, [value]);
|
|
203
|
-
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
if (debouncedValue) {
|
|
206
|
-
onSearch(debouncedValue);
|
|
207
|
-
}
|
|
208
|
-
}, [debouncedValue, onSearch]);
|
|
209
|
-
|
|
210
|
-
return (
|
|
211
|
-
<SearchInput
|
|
212
|
-
value={value}
|
|
213
|
-
onChange={(e) => setValue(e.target.value)}
|
|
214
|
-
$onClear={() => {
|
|
215
|
-
setValue('');
|
|
216
|
-
setDebouncedValue('');
|
|
217
|
-
onSearch('');
|
|
218
|
-
}}
|
|
219
|
-
placeholder="Search (debounced)..."
|
|
220
|
-
/>
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
### Controlled Input with Character Limit
|
|
226
|
-
```tsx
|
|
227
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
228
|
-
|
|
229
|
-
function LimitedInput({ maxLength = 50 }) {
|
|
230
|
-
const [value, setValue] = useState('');
|
|
231
|
-
|
|
232
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
233
|
-
const newValue = e.target.value;
|
|
234
|
-
if (newValue.length <= maxLength) {
|
|
235
|
-
setValue(newValue);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
return (
|
|
240
|
-
<div>
|
|
241
|
-
<EnhancedInput
|
|
242
|
-
value={value}
|
|
243
|
-
onChange={handleChange}
|
|
244
|
-
$onClear={() => setValue('')}
|
|
245
|
-
placeholder={`Max ${maxLength} characters`}
|
|
246
|
-
/>
|
|
247
|
-
<span style={{ fontSize: '12px', color: '#666' }}>
|
|
248
|
-
{value.length}/{maxLength}
|
|
249
|
-
</span>
|
|
250
|
-
</div>
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Input with Loading State
|
|
256
|
-
```tsx
|
|
257
|
-
import { EnhancedInput } from '@pushwoosh/dumb-components';
|
|
258
|
-
import { Spinner } from '@pushwoosh/dumb-components';
|
|
259
|
-
|
|
260
|
-
function AsyncInput() {
|
|
261
|
-
const [value, setValue] = useState('');
|
|
262
|
-
const [loading, setLoading] = useState(false);
|
|
263
|
-
|
|
264
|
-
const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
265
|
-
const newValue = e.target.value;
|
|
266
|
-
setValue(newValue);
|
|
267
|
-
|
|
268
|
-
if (newValue) {
|
|
269
|
-
setLoading(true);
|
|
270
|
-
// Simulate async validation
|
|
271
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
272
|
-
setLoading(false);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
return (
|
|
277
|
-
<EnhancedInput
|
|
278
|
-
value={value}
|
|
279
|
-
onChange={handleChange}
|
|
280
|
-
placeholder="Type to validate..."
|
|
281
|
-
disabled={loading}
|
|
282
|
-
$icon={loading ? <Spinner size="small" /> : null}
|
|
283
|
-
$onClear={() => setValue('')}
|
|
284
|
-
/>
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
## Props Reference
|
|
290
|
-
|
|
291
|
-
### EnhancedInput Props
|
|
292
|
-
| Prop | Type | Required | Default | Description |
|
|
293
|
-
|------|------|----------|---------|-------------|
|
|
294
|
-
| `$icon` | `ReactNode` | - | - | Icon element to display at start of input |
|
|
295
|
-
| `$onClear` | `() => void` | - | - | Shows clear button and handles clear action |
|
|
296
|
-
| `$isErrored` | `boolean` | - | `false` | Error state styling (red border) |
|
|
297
|
-
| `value` | `string \| number` | - | - | Input value |
|
|
298
|
-
| `onChange` | `(e: ChangeEvent) => void` | - | - | Change handler |
|
|
299
|
-
| `placeholder` | `string` | - | - | Placeholder text |
|
|
300
|
-
| `type` | `string` | - | `'text'` | Input type (text, email, password, etc.) |
|
|
301
|
-
| `disabled` | `boolean` | - | `false` | Disable input |
|
|
302
|
-
| `readOnly` | `boolean` | - | `false` | Make input read-only |
|
|
303
|
-
| `autoFocus` | `boolean` | - | `false` | Auto-focus on mount |
|
|
304
|
-
| `autoComplete` | `string` | - | - | Browser autocomplete hint |
|
|
305
|
-
| `maxLength` | `number` | - | - | Maximum character length |
|
|
306
|
-
| `pattern` | `string` | - | - | Validation pattern |
|
|
307
|
-
| `required` | `boolean` | - | `false` | Mark as required field |
|
|
308
|
-
| `ref` | `Ref<HTMLInputElement>` | - | - | Forward ref to input element |
|
|
309
|
-
|
|
310
|
-
### SearchInput Props
|
|
311
|
-
| Prop | Type | Required | Default | Description |
|
|
312
|
-
|------|------|----------|---------|-------------|
|
|
313
|
-
| All EnhancedInput props except `$icon` | - | - | - | SearchInput automatically includes search icon |
|
|
314
|
-
|
|
315
|
-
## AI Agent Guidelines
|
|
316
|
-
|
|
317
|
-
### ✅ Recommended Patterns
|
|
318
|
-
- Use `SearchInput` for search functionality (includes icon automatically)
|
|
319
|
-
- Always handle both `value` and `onChange` for controlled inputs
|
|
320
|
-
- Provide `$onClear` for better UX when input has value
|
|
321
|
-
- Use `$isErrored` prop for validation feedback
|
|
322
|
-
- Combine with icons from `@pushwoosh/kit-icons` for context
|
|
323
|
-
- Use `ref` forwarding when needed for focus management
|
|
324
|
-
- Implement debouncing for search/filter inputs
|
|
325
|
-
- Show character limits for restricted inputs
|
|
326
|
-
|
|
327
|
-
### ❌ Common Mistakes to Avoid
|
|
328
|
-
- Don't use `$icon` prop with `SearchInput` (it's preset)
|
|
329
|
-
- Don't forget to handle empty state in `$onClear`
|
|
330
|
-
- Avoid inline function definitions for `$onClear`
|
|
331
|
-
- Don't mix controlled and uncontrolled patterns
|
|
332
|
-
- Avoid complex logic in onChange - extract to separate function
|
|
333
|
-
- Don't forget to clear errors when clearing input
|
|
334
|
-
- Avoid using native HTML validation with custom error states
|
|
335
|
-
|
|
336
|
-
### Integration Tips
|
|
337
|
-
- Component uses forwardRef for ref access
|
|
338
|
-
- Built on styled-components with Pushwoosh design tokens
|
|
339
|
-
- Clear button uses CloseIcon from kit-icons
|
|
340
|
-
- Works with all native input attributes
|
|
341
|
-
- Wrapper handles icon and clear button positioning
|
|
342
|
-
- Supports all HTML5 input types
|
|
343
|
-
- Compatible with form libraries (react-hook-form, formik)
|
|
344
|
-
|
|
345
|
-
## Related Components
|
|
346
|
-
- **NativeInput** - Base input component (used internally)
|
|
347
|
-
- **Select** - For dropdown selections
|
|
348
|
-
- **DateTimePicker** - For date/time inputs
|
|
349
|
-
- **Button** - For form submission
|
|
350
|
-
- **Checkbox** - For boolean inputs
|
|
351
|
-
- **Radio** - For single choice inputs
|
|
352
|
-
- **Toast** - For input action feedback
|