@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,247 +0,0 @@
|
|
|
1
|
-
# Button - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for Button component
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
**Component:** Button, GhostButton, RemoveButton
|
|
9
|
-
**Import Path:** `import { Button, GhostButton, RemoveButton } from '@pushwoosh/dumb-components'`
|
|
10
|
-
**Files:** Button.tsx, GhostButton.tsx, RemoveButton.tsx, types.ts, styles.ts, maps.ts, index.ts
|
|
11
|
-
**Type:** UI Component / Form Component
|
|
12
|
-
**Description:** Versatile button component with loading states, icons, and multiple styling variants. Also includes a minimal GhostButton for unstyled interactions and a RemoveButton for compact "close/remove" affordances.
|
|
13
|
-
|
|
14
|
-
## TypeScript Interface
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
type RequiredButtonProps = {
|
|
18
|
-
readonly boxRef?: any;
|
|
19
|
-
readonly color: 'primary' | 'secondary' | 'danger';
|
|
20
|
-
readonly size?: 'field' | 'compact';
|
|
21
|
-
readonly view?: 'shape' | 'ghost';
|
|
22
|
-
readonly className?: string;
|
|
23
|
-
readonly isDisabled?: boolean;
|
|
24
|
-
readonly isLoading?: boolean;
|
|
25
|
-
readonly isOpen?: boolean;
|
|
26
|
-
readonly icon?: ReactNode;
|
|
27
|
-
readonly rightIcon?: ReactNode;
|
|
28
|
-
readonly children?: ReactNode;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// Main button props extending HTML button
|
|
32
|
-
type ButtonPropsWithoutAs = Omit<JSX.IntrinsicElements['button'], 'ref'> & RequiredButtonProps & {
|
|
33
|
-
readonly boxRef?: Ref<HTMLButtonElement>;
|
|
34
|
-
readonly type?: 'button' | 'submit';
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Can be rendered as different HTML elements
|
|
38
|
-
type ButtonPropsWithAsTag<AS extends keyof HTMLElementTagNameMap> =
|
|
39
|
-
Omit<JSX.IntrinsicElements[AS], 'ref'> & RequiredButtonProps & {
|
|
40
|
-
readonly boxRef?: Ref<HTMLElementTagNameMap[AS]>;
|
|
41
|
-
readonly as?: AS;
|
|
42
|
-
};
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Import & Usage
|
|
46
|
-
|
|
47
|
-
**Import:**
|
|
48
|
-
```typescript
|
|
49
|
-
import { Button, GhostButton, RemoveButton } from '@pushwoosh/dumb-components';
|
|
50
|
-
import type {
|
|
51
|
-
ButtonPropsWithoutAs,
|
|
52
|
-
ButtonPropsWithAsTag,
|
|
53
|
-
RequiredButtonProps
|
|
54
|
-
} from '@pushwoosh/dumb-components';
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**Basic Usage:**
|
|
58
|
-
```tsx
|
|
59
|
-
function App() {
|
|
60
|
-
return (
|
|
61
|
-
<Button color="primary">
|
|
62
|
-
Click me
|
|
63
|
-
</Button>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Advanced Examples:**
|
|
69
|
-
```tsx
|
|
70
|
-
// Primary action button
|
|
71
|
-
<Button
|
|
72
|
-
color="primary"
|
|
73
|
-
size="field"
|
|
74
|
-
onClick={() => handleSave()}
|
|
75
|
-
>
|
|
76
|
-
Save Changes
|
|
77
|
-
</Button>
|
|
78
|
-
|
|
79
|
-
// Secondary button with icon
|
|
80
|
-
// Note: kit-icons require `size` and `view`. Match icon size to Button size:
|
|
81
|
-
// Button size="field" (default) → icon size="medium"
|
|
82
|
-
// Button size="compact" → icon size="small"
|
|
83
|
-
<Button
|
|
84
|
-
color="secondary"
|
|
85
|
-
icon={<PlusIcon size="medium" view="lined" />}
|
|
86
|
-
onClick={() => handleAdd()}
|
|
87
|
-
>
|
|
88
|
-
Add Item
|
|
89
|
-
</Button>
|
|
90
|
-
|
|
91
|
-
// Danger button with loading state
|
|
92
|
-
<Button
|
|
93
|
-
color="danger"
|
|
94
|
-
isLoading={isDeleting}
|
|
95
|
-
onClick={() => handleDelete()}
|
|
96
|
-
>
|
|
97
|
-
{isDeleting ? 'Deleting...' : 'Delete'}
|
|
98
|
-
</Button>
|
|
99
|
-
|
|
100
|
-
// Compact button with right icon (size="small" matches size="compact")
|
|
101
|
-
<Button
|
|
102
|
-
color="primary"
|
|
103
|
-
size="compact"
|
|
104
|
-
rightIcon={<ArrowIcon size="small" view="lined" />}
|
|
105
|
-
>
|
|
106
|
-
Next
|
|
107
|
-
</Button>
|
|
108
|
-
|
|
109
|
-
// Ghost view button
|
|
110
|
-
<Button
|
|
111
|
-
color="primary"
|
|
112
|
-
view="ghost"
|
|
113
|
-
icon={<EditIcon size="medium" view="lined" />}
|
|
114
|
-
>
|
|
115
|
-
Edit
|
|
116
|
-
</Button>
|
|
117
|
-
|
|
118
|
-
// Icon-only button
|
|
119
|
-
<Button
|
|
120
|
-
color="secondary"
|
|
121
|
-
icon={<SearchIcon size="medium" view="lined" />}
|
|
122
|
-
onClick={() => handleSearch()}
|
|
123
|
-
/>
|
|
124
|
-
|
|
125
|
-
// Submit button for forms
|
|
126
|
-
<Button
|
|
127
|
-
type="submit"
|
|
128
|
-
color="primary"
|
|
129
|
-
isDisabled={!isFormValid}
|
|
130
|
-
>
|
|
131
|
-
Submit Form
|
|
132
|
-
</Button>
|
|
133
|
-
|
|
134
|
-
// Button as different element (link)
|
|
135
|
-
<Button
|
|
136
|
-
as="a"
|
|
137
|
-
href="/dashboard"
|
|
138
|
-
color="primary"
|
|
139
|
-
>
|
|
140
|
-
Go to Dashboard
|
|
141
|
-
</Button>
|
|
142
|
-
|
|
143
|
-
// With loading overlay
|
|
144
|
-
<Button
|
|
145
|
-
color="primary"
|
|
146
|
-
isLoading={isSubmitting}
|
|
147
|
-
onClick={handleAsyncSubmit}
|
|
148
|
-
>
|
|
149
|
-
Submit
|
|
150
|
-
</Button>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## GhostButton Usage
|
|
154
|
-
|
|
155
|
-
```tsx
|
|
156
|
-
// Minimal unstyled button
|
|
157
|
-
<GhostButton onClick={() => handleClick()}>
|
|
158
|
-
<CustomIcon />
|
|
159
|
-
</GhostButton>
|
|
160
|
-
|
|
161
|
-
// For custom styled buttons
|
|
162
|
-
const CustomButton = styled(GhostButton)`
|
|
163
|
-
/* Your custom styles */
|
|
164
|
-
padding: 8px 16px;
|
|
165
|
-
color: blue;
|
|
166
|
-
`;
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## RemoveButton Usage
|
|
170
|
-
|
|
171
|
-
A compact icon-only button with a built-in `CloseIcon` intended for "remove" / "dismiss" affordances. It has fixed `16x16` size and switches its color to `DANGER_HOVER` / `DANGER_PRESSED` on interaction.
|
|
172
|
-
|
|
173
|
-
**Props:** accepts all native `<button>` props except `ref` and `children` (the icon is rendered internally).
|
|
174
|
-
|
|
175
|
-
```tsx
|
|
176
|
-
<RemoveButton
|
|
177
|
-
type="button"
|
|
178
|
-
aria-label="Remove item"
|
|
179
|
-
onClick={() => handleRemove(item.id)}
|
|
180
|
-
/>
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## Props Reference
|
|
184
|
-
|
|
185
|
-
| Prop | Type | Default | Description |
|
|
186
|
-
|------|------|---------|-------------|
|
|
187
|
-
| color | 'primary' \| 'secondary' \| 'danger' | required | Button color scheme |
|
|
188
|
-
| size | 'field' \| 'compact' | 'field' | Button size variant |
|
|
189
|
-
| view | 'shape' \| 'ghost' | 'shape' | Button visual style |
|
|
190
|
-
| type | 'button' \| 'submit' | 'button' | HTML button type |
|
|
191
|
-
| isDisabled | boolean | false | Whether button is disabled |
|
|
192
|
-
| isLoading | boolean | false | Whether button shows loading state |
|
|
193
|
-
| isOpen | boolean | false | Whether button appears in "open" state |
|
|
194
|
-
| icon | ReactNode | undefined | Left icon element. For `@pushwoosh/kit-icons` icons, pass `size` and `view` explicitly (both required). Match icon `size` to Button `size`: `size="medium"` for `field` (default), `size="small"` for `compact`. |
|
|
195
|
-
| rightIcon | ReactNode | undefined | Right icon element. Same icon size/view rules as `icon`. |
|
|
196
|
-
| children | ReactNode | undefined | Button text content |
|
|
197
|
-
| boxRef | Ref | undefined | Ref to button element |
|
|
198
|
-
| as | string \| Component | undefined | Render as different element/component |
|
|
199
|
-
|
|
200
|
-
## Color Guide
|
|
201
|
-
|
|
202
|
-
| Color | Usage | Example Use Cases |
|
|
203
|
-
|-------|--------|-------------------|
|
|
204
|
-
| primary | Main actions, primary CTA | "Save", "Submit", "Continue" |
|
|
205
|
-
| secondary | Secondary actions, alternatives | "Cancel", "Back", "Skip" |
|
|
206
|
-
| danger | Destructive actions | "Delete", "Remove", "Clear" |
|
|
207
|
-
|
|
208
|
-
## AI Agent Guidelines
|
|
209
|
-
|
|
210
|
-
### ✅ Recommended Patterns
|
|
211
|
-
- Always provide `color` prop (required)
|
|
212
|
-
- Use `color="primary"` for main actions, `"secondary"` for alternatives
|
|
213
|
-
- Use `color="danger"` for destructive actions like delete
|
|
214
|
-
- Combine `isLoading` with async operations
|
|
215
|
-
- Use `size="compact"` in space-constrained layouts
|
|
216
|
-
- Add icons to improve recognition and usability
|
|
217
|
-
- Use `type="submit"` in forms for proper form submission
|
|
218
|
-
|
|
219
|
-
### ❌ Common Mistakes to Avoid
|
|
220
|
-
- Missing required `color` prop will render nothing and log error
|
|
221
|
-
- Don't use loading state without showing loading text to user
|
|
222
|
-
- Avoid putting buttons inside other interactive elements
|
|
223
|
-
- Don't use `isDisabled` with `isLoading` simultaneously
|
|
224
|
-
- Don't pass icons without `size` and `view` — they are required on `@pushwoosh/kit-icons` and TypeScript won't catch it (Button's `icon` is typed as `ReactNode`)
|
|
225
|
-
- Don't mismatch icon size to button size: `size="small"` icons belong only in `size="compact"` buttons; `field`-sized buttons need `size="medium"` icons
|
|
226
|
-
- Avoid very long button text - keep concise
|
|
227
|
-
|
|
228
|
-
### Integration Tips
|
|
229
|
-
- Works seamlessly with form libraries like react-hook-form
|
|
230
|
-
- Loading state automatically shows spinner overlay
|
|
231
|
-
- Can render as links or other elements using `as` prop
|
|
232
|
-
- Icon-only buttons should have proper aria-labels
|
|
233
|
-
- Combine with Tooltip for additional context when needed
|
|
234
|
-
|
|
235
|
-
## Loading Behavior
|
|
236
|
-
- **With icon**: Replaces icon with spinner
|
|
237
|
-
- **Text only**: Shows overlay spinner while hiding text
|
|
238
|
-
- **Ghost view**: Shows inline spinner, no overlay
|
|
239
|
-
- **Icon + text**: Icon becomes spinner, text remains visible
|
|
240
|
-
|
|
241
|
-
## Related Components
|
|
242
|
-
- GhostButton - for unstyled button base
|
|
243
|
-
- Link - for navigation actions
|
|
244
|
-
- IconButton - specialized icon-only buttons
|
|
245
|
-
- Spinner - used internally for loading states
|
|
246
|
-
|
|
247
|
-
---
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
# CardMetric - AI Documentation
|
|
2
|
-
|
|
3
|
-
> Auto-generated AI agent documentation for CardMetric component
|
|
4
|
-
> Part of @pushwoosh/dumb-components library
|
|
5
|
-
|
|
6
|
-
## Overview
|
|
7
|
-
|
|
8
|
-
**Component:** CardMetric
|
|
9
|
-
**Import Path:** `import { CardMetric } from '@pushwoosh/dumb-components'`
|
|
10
|
-
**Files:** CardMetric.tsx, CardChildren.tsx, CardCollapse.tsx, types.ts, styles.tsx, index.ts
|
|
11
|
-
**Type:** Data Display Component / Dashboard Component
|
|
12
|
-
**Description:** Card component for displaying metrics and data with optional collapsible content, loading states, and tooltips
|
|
13
|
-
|
|
14
|
-
## TypeScript Interface
|
|
15
|
-
|
|
16
|
-
```typescript
|
|
17
|
-
interface CardMetricProps {
|
|
18
|
-
view?: 'rounded' | 'stacking';
|
|
19
|
-
focus?: boolean;
|
|
20
|
-
title?: string | ReactElement;
|
|
21
|
-
tooltip?: string;
|
|
22
|
-
loading?: boolean;
|
|
23
|
-
collapse?: {
|
|
24
|
-
isCollapsed: boolean;
|
|
25
|
-
};
|
|
26
|
-
description?: string;
|
|
27
|
-
metric?: string | number;
|
|
28
|
-
extraMetric?: string | number;
|
|
29
|
-
extraMetricColor?: string;
|
|
30
|
-
headerExtra?: ReactElement;
|
|
31
|
-
children?: ReactNode;
|
|
32
|
-
[key: string]: any; // Additional HTML props
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Import & Usage
|
|
37
|
-
|
|
38
|
-
**Import:**
|
|
39
|
-
```typescript
|
|
40
|
-
import { CardMetric } from '@pushwoosh/dumb-components';
|
|
41
|
-
import type { CardMetricProps } from '@pushwoosh/dumb-components';
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**Basic Usage:**
|
|
45
|
-
```tsx
|
|
46
|
-
function App() {
|
|
47
|
-
return (
|
|
48
|
-
<CardMetric
|
|
49
|
-
title="Total Users"
|
|
50
|
-
metric="1,234"
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Advanced Examples:**
|
|
57
|
-
```tsx
|
|
58
|
-
// Basic metric card
|
|
59
|
-
<CardMetric
|
|
60
|
-
title="Revenue"
|
|
61
|
-
metric="$45,678"
|
|
62
|
-
extraMetric="+12%"
|
|
63
|
-
extraMetricColor="#22c55e"
|
|
64
|
-
/>
|
|
65
|
-
|
|
66
|
-
// Card with tooltip
|
|
67
|
-
<CardMetric
|
|
68
|
-
title="Conversion Rate"
|
|
69
|
-
tooltip="Percentage of visitors who completed a purchase"
|
|
70
|
-
metric="3.4%"
|
|
71
|
-
extraMetric="+0.2%"
|
|
72
|
-
/>
|
|
73
|
-
|
|
74
|
-
// Card with children content
|
|
75
|
-
<CardMetric
|
|
76
|
-
title="Monthly Sales"
|
|
77
|
-
metric="$125,000"
|
|
78
|
-
>
|
|
79
|
-
<div>
|
|
80
|
-
<p>Last month: $118,000</p>
|
|
81
|
-
<p>Growth: 5.9%</p>
|
|
82
|
-
</div>
|
|
83
|
-
</CardMetric>
|
|
84
|
-
|
|
85
|
-
// Collapsible card
|
|
86
|
-
<CardMetric
|
|
87
|
-
title="Detailed Analytics"
|
|
88
|
-
metric="98.5%"
|
|
89
|
-
collapse={{ isCollapsed: false }}
|
|
90
|
-
>
|
|
91
|
-
<div>
|
|
92
|
-
<h4>Performance Breakdown:</h4>
|
|
93
|
-
<ul>
|
|
94
|
-
<li>Page Load: 2.3s</li>
|
|
95
|
-
<li>Time to Interactive: 3.1s</li>
|
|
96
|
-
<li>First Paint: 1.8s</li>
|
|
97
|
-
</ul>
|
|
98
|
-
</div>
|
|
99
|
-
</CardMetric>
|
|
100
|
-
|
|
101
|
-
// Loading state
|
|
102
|
-
<CardMetric
|
|
103
|
-
title="Loading Data..."
|
|
104
|
-
loading={isLoading}
|
|
105
|
-
>
|
|
106
|
-
<p>Please wait while we fetch the latest metrics.</p>
|
|
107
|
-
</CardMetric>
|
|
108
|
-
|
|
109
|
-
// Stacking view with header extra
|
|
110
|
-
<CardMetric
|
|
111
|
-
view="stacking"
|
|
112
|
-
title="User Engagement"
|
|
113
|
-
metric="2,156"
|
|
114
|
-
headerExtra={<Button size="compact">View Details</Button>}
|
|
115
|
-
>
|
|
116
|
-
<p>Daily active users for the past 30 days</p>
|
|
117
|
-
</CardMetric>
|
|
118
|
-
|
|
119
|
-
// Focused card (highlighted)
|
|
120
|
-
<CardMetric
|
|
121
|
-
view="rounded"
|
|
122
|
-
focus={true}
|
|
123
|
-
title="Key Metric"
|
|
124
|
-
metric="87%"
|
|
125
|
-
extraMetric="Target: 90%"
|
|
126
|
-
description="This is the most important metric to track"
|
|
127
|
-
/>
|
|
128
|
-
|
|
129
|
-
// Dashboard grid
|
|
130
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '16px' }}>
|
|
131
|
-
<CardMetric title="Orders" metric="1,428" extraMetric="+15%" />
|
|
132
|
-
<CardMetric title="Revenue" metric="$89,204" extraMetric="+8.2%" />
|
|
133
|
-
<CardMetric title="Customers" metric="892" extraMetric="+23%" />
|
|
134
|
-
<CardMetric title="Conversion" metric="4.2%" extraMetric="-0.1%" />
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
// With custom content and description
|
|
138
|
-
<CardMetric
|
|
139
|
-
title="Server Status"
|
|
140
|
-
metric="99.9%"
|
|
141
|
-
description="Uptime for the last 30 days"
|
|
142
|
-
>
|
|
143
|
-
<div>
|
|
144
|
-
<div style={{ display: 'flex', gap: '8px', marginBottom: '8px' }}>
|
|
145
|
-
<Badge color="green">Healthy</Badge>
|
|
146
|
-
<Badge color="orange">2 Warnings</Badge>
|
|
147
|
-
</div>
|
|
148
|
-
<p>Last incident: 3 days ago</p>
|
|
149
|
-
</div>
|
|
150
|
-
</CardMetric>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Props Reference
|
|
154
|
-
|
|
155
|
-
| Prop | Type | Default | Description |
|
|
156
|
-
|------|------|---------|-------------|
|
|
157
|
-
| title | string \| ReactElement | '' | Card title text or element |
|
|
158
|
-
| metric | string \| number | undefined | Main metric value to display |
|
|
159
|
-
| extraMetric | string \| number | undefined | Additional metric (e.g., change percentage) |
|
|
160
|
-
| extraMetricColor | string | Color.MAIN | Color for extra metric text |
|
|
161
|
-
| view | 'rounded' \| 'stacking' | 'rounded' | Card visual style |
|
|
162
|
-
| focus | boolean | false | Whether card should appear highlighted |
|
|
163
|
-
| loading | boolean | false | Whether to show loading spinner |
|
|
164
|
-
| tooltip | string | '' | Tooltip text for info icon |
|
|
165
|
-
| description | string | '' | Description text at bottom of card |
|
|
166
|
-
| collapse | { isCollapsed: boolean } | undefined | Collapsible functionality config |
|
|
167
|
-
| headerExtra | ReactElement | undefined | Extra content in header (buttons, etc.) |
|
|
168
|
-
| children | ReactNode | undefined | Main card content |
|
|
169
|
-
|
|
170
|
-
## View Types
|
|
171
|
-
|
|
172
|
-
| View | Description | Best Used For |
|
|
173
|
-
|------|-------------|---------------|
|
|
174
|
-
| rounded | Standard rounded corners | Most dashboard cards, metrics |
|
|
175
|
-
| stacking | Stackable layout style | Dense layouts, card groups |
|
|
176
|
-
|
|
177
|
-
## AI Agent Guidelines
|
|
178
|
-
|
|
179
|
-
### ✅ Recommended Patterns
|
|
180
|
-
- Use meaningful titles that clearly describe the metric
|
|
181
|
-
- Include `extraMetric` to show trends or comparisons
|
|
182
|
-
- Add `tooltip` for complex metrics that need explanation
|
|
183
|
-
- Use `loading={true}` during data fetching
|
|
184
|
-
- Group related metrics using consistent `view` types
|
|
185
|
-
- Use `focus={true}` to highlight the most important metric
|
|
186
|
-
|
|
187
|
-
### ❌ Common Mistakes to Avoid
|
|
188
|
-
- Don't show raw loading states without proper loading prop
|
|
189
|
-
- Avoid very long titles - keep them concise
|
|
190
|
-
- Don't mix view types randomly in the same layout
|
|
191
|
-
- Don't use collapse for simple content that doesn't need hiding
|
|
192
|
-
- Avoid putting too much content in children - keep it focused
|
|
193
|
-
|
|
194
|
-
### Integration Tips
|
|
195
|
-
- Works well in dashboard grid layouts
|
|
196
|
-
- Combine with charts and graphs in children content
|
|
197
|
-
- Use consistent color schemes for extraMetric across related cards
|
|
198
|
-
- Good for KPI displays and analytics dashboards
|
|
199
|
-
- Can contain other components like charts, lists, or buttons
|
|
200
|
-
|
|
201
|
-
## Color Coding for Extra Metrics
|
|
202
|
-
|
|
203
|
-
```tsx
|
|
204
|
-
// Semantic colors for trends
|
|
205
|
-
const getTrendColor = (value: number) => {
|
|
206
|
-
if (value > 0) return '#22c55e'; // Green for positive
|
|
207
|
-
if (value < 0) return '#ef4444'; // Red for negative
|
|
208
|
-
return '#64748b'; // Gray for neutral
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
<CardMetric
|
|
212
|
-
title="Sales Growth"
|
|
213
|
-
metric="$45,000"
|
|
214
|
-
extraMetric={`${trend > 0 ? '+' : ''}${trend}%`}
|
|
215
|
-
extraMetricColor={getTrendColor(trend)}
|
|
216
|
-
/>
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## Common Patterns
|
|
220
|
-
|
|
221
|
-
### Dashboard Grid
|
|
222
|
-
```tsx
|
|
223
|
-
function Dashboard() {
|
|
224
|
-
const metrics = [
|
|
225
|
-
{ title: 'Total Sales', value: '$125,400', change: '+12%', positive: true },
|
|
226
|
-
{ title: 'New Customers', value: '1,234', change: '+8%', positive: true },
|
|
227
|
-
{ title: 'Bounce Rate', value: '32%', change: '-2%', positive: true },
|
|
228
|
-
{ title: 'Avg. Order', value: '$89', change: '+5%', positive: true },
|
|
229
|
-
];
|
|
230
|
-
|
|
231
|
-
return (
|
|
232
|
-
<div className="dashboard-grid">
|
|
233
|
-
{metrics.map(metric => (
|
|
234
|
-
<CardMetric
|
|
235
|
-
key={metric.title}
|
|
236
|
-
title={metric.title}
|
|
237
|
-
metric={metric.value}
|
|
238
|
-
extraMetric={metric.change}
|
|
239
|
-
extraMetricColor={metric.positive ? '#22c55e' : '#ef4444'}
|
|
240
|
-
/>
|
|
241
|
-
))}
|
|
242
|
-
</div>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Detailed Analytics Card
|
|
248
|
-
```tsx
|
|
249
|
-
<CardMetric
|
|
250
|
-
title="Website Performance"
|
|
251
|
-
metric="98.2%"
|
|
252
|
-
extraMetric="Last 24h"
|
|
253
|
-
collapse={{ isCollapsed: false }}
|
|
254
|
-
tooltip="Overall website performance score based on speed, accessibility, and SEO"
|
|
255
|
-
>
|
|
256
|
-
<div>
|
|
257
|
-
<div style={{ marginBottom: '12px' }}>
|
|
258
|
-
<strong>Performance Breakdown:</strong>
|
|
259
|
-
</div>
|
|
260
|
-
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '8px' }}>
|
|
261
|
-
<div>Speed: 95%</div>
|
|
262
|
-
<div>Accessibility: 100%</div>
|
|
263
|
-
<div>SEO: 98%</div>
|
|
264
|
-
<div>Best Practices: 100%</div>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
</CardMetric>
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Related Components
|
|
271
|
-
- StatisticCard - alternative metric display component
|
|
272
|
-
- Badge - for status indicators within cards
|
|
273
|
-
- Spinner - used internally for loading states
|
|
274
|
-
- Tooltip - used internally for info tooltips
|
|
275
|
-
- Button - commonly used in headerExtra
|
|
276
|
-
|
|
277
|
-
---
|