@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.
Files changed (325) hide show
  1. package/AccessForbidden/AccessForbidden.d.ts +3 -0
  2. package/AccessForbidden/AccessForbidden.js +3 -0
  3. package/Alert/Alert.d.ts +7 -0
  4. package/Alert/Alert.js +7 -0
  5. package/Alert/types.d.ts +6 -0
  6. package/ApplicationPreloader/ApplicationPreloader.d.ts +8 -0
  7. package/ApplicationPreloader/ApplicationPreloader.js +6 -0
  8. package/Badge/Badge.d.ts +6 -0
  9. package/Badge/Badge.js +6 -0
  10. package/Badge/types.d.ts +6 -0
  11. package/Banner/Banner.d.ts +7 -0
  12. package/Banner/Banner.js +7 -0
  13. package/Banner/types.d.ts +16 -0
  14. package/Button/Button.d.ts +19 -0
  15. package/Button/GhostButton.d.ts +1 -0
  16. package/Button/GhostButton.js +1 -0
  17. package/Button/RemoveButton.d.ts +6 -0
  18. package/Button/RemoveButton.js +6 -0
  19. package/Button/types.d.ts +21 -0
  20. package/Calendar/CalendarDropdown/CalendarDropdown.d.ts +12 -0
  21. package/Calendar/CalendarDropdown/CalendarDropdown.js +12 -0
  22. package/Calendar/CalendarDropdown/helpers.d.ts +4 -0
  23. package/Calendar/CalendarDropdown/helpers.js +4 -0
  24. package/Calendar/CalendarDropdown/types.d.ts +33 -0
  25. package/Calendar/CalendarSuperForm/CalendarSuperForm.d.ts +7 -0
  26. package/Calendar/CalendarSuperForm/CalendarSuperForm.js +10 -1
  27. package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.d.ts +1 -0
  28. package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.js +3 -2
  29. package/Calendar/CalendarSuperForm/types.d.ts +37 -9
  30. package/Calendar/helpers.d.ts +10 -0
  31. package/Calendar/helpers.js +10 -0
  32. package/Calendar/types.d.ts +16 -1
  33. package/CardMetric/CardMetric.d.ts +7 -0
  34. package/CardMetric/CardMetric.js +7 -0
  35. package/CardMetric/types.d.ts +13 -0
  36. package/Checkbox/Checkbox.d.ts +6 -0
  37. package/Checkbox/Checkbox.js +6 -0
  38. package/Checkbox/types.d.ts +13 -0
  39. package/Chip/Chip.d.ts +7 -0
  40. package/Chip/Chip.js +7 -0
  41. package/Chip/Chip.types.d.ts +9 -0
  42. package/CodeEditor/CodeEditor.d.ts +7 -0
  43. package/CodeEditor/CodeEditor.js +7 -0
  44. package/CodeEditor/languages/html.d.ts +1 -0
  45. package/CodeEditor/languages/html.js +1 -0
  46. package/CodeEditor/languages/json.d.ts +1 -0
  47. package/CodeEditor/languages/json.js +1 -0
  48. package/CodeEditor/languages/liquid.d.ts +1 -0
  49. package/CodeEditor/languages/liquid.js +1 -0
  50. package/CodeEditor/types.d.ts +11 -0
  51. package/CrashScreen/CrashScreen.d.ts +4 -0
  52. package/CrashScreen/CrashScreen.js +4 -0
  53. package/DateTimePicker/components/DatePicker/DatePicker.d.ts +5 -0
  54. package/DateTimePicker/components/DatePicker/DatePicker.js +5 -0
  55. package/DateTimePicker/components/DatePicker/types.d.ts +9 -0
  56. package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +5 -0
  57. package/DateTimePicker/components/DatePickerField/DatePickerField.js +5 -0
  58. package/DateTimePicker/components/DatePickerField/types.d.ts +9 -0
  59. package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +5 -0
  60. package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +5 -0
  61. package/DateTimePicker/components/DateTimePicker/types.d.ts +6 -0
  62. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +5 -0
  63. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +5 -0
  64. package/DateTimePicker/components/DateTimePickerField/types.d.ts +9 -0
  65. package/DateTimePicker/types.d.ts +5 -0
  66. package/Drawer/components/Drawer/Drawer.d.ts +11 -0
  67. package/Drawer/components/Drawer/Drawer.js +11 -0
  68. package/Drawer/components/Drawer/types.d.ts +9 -0
  69. package/Drawer/components/DrawerContent/styles.d.ts +3 -0
  70. package/Drawer/components/DrawerContent/styles.js +3 -0
  71. package/Drawer/components/DrawerDocs/DrawerDocs.d.ts +7 -0
  72. package/Drawer/components/DrawerDocs/DrawerDocs.js +7 -0
  73. package/Drawer/components/DrawerDocs/hooks.d.ts +4 -0
  74. package/Drawer/components/DrawerDocs/hooks.js +4 -0
  75. package/Drawer/components/DrawerDocs/types.d.ts +4 -0
  76. package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +12 -0
  77. package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +12 -0
  78. package/DropdownMenu/components/DropdownMenu/types.d.ts +15 -0
  79. package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +8 -0
  80. package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -0
  81. package/DropdownMenu/components/DropdownMenuButton/types.d.ts +16 -0
  82. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
  83. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +7 -0
  84. package/DropdownMenu/components/DropdownMenuItem/types.d.ts +6 -0
  85. package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +8 -0
  86. package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +8 -0
  87. package/DropdownMenu/components/DropdownMenuSection/types.d.ts +3 -0
  88. package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +9 -0
  89. package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +9 -0
  90. package/DropdownMenu/components/DropdownMenuSubmenu/types.d.ts +5 -0
  91. package/EditableField/EditableField.d.ts +9 -0
  92. package/EditableField/EditableField.js +9 -0
  93. package/EditableField/types.d.ts +12 -0
  94. package/EmailTemplatePreview/EmailTemplatePreview.d.ts +7 -0
  95. package/EmailTemplatePreview/EmailTemplatePreview.js +7 -0
  96. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +4 -0
  97. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +4 -0
  98. package/EmailTemplatePreview/helpers.d.ts +8 -0
  99. package/EmailTemplatePreview/helpers.js +8 -0
  100. package/EmailTemplatePreview/types.d.ts +7 -0
  101. package/EnhancedInput/EnhancedInput.d.ts +7 -0
  102. package/EnhancedInput/EnhancedInput.js +7 -0
  103. package/EnhancedInput/SearchInput.d.ts +6 -0
  104. package/EnhancedInput/SearchInput.js +6 -0
  105. package/EnhancedInput/types.d.ts +5 -0
  106. package/ExportResult/ExportResult.d.ts +7 -0
  107. package/ExportResult/ExportResult.js +7 -0
  108. package/ExportResult/types.d.ts +7 -0
  109. package/ExternalImagePreview/ExternalImagePreview.d.ts +7 -0
  110. package/ExternalImagePreview/ExternalImagePreview.js +7 -0
  111. package/ExternalImagePreview/types.d.ts +7 -0
  112. package/FieldBox/FieldBox.d.ts +9 -0
  113. package/FieldBox/FieldBox.js +9 -0
  114. package/FieldBox/types.d.ts +10 -0
  115. package/FrequencyCapping/FrequencyCappingEdit.d.ts +7 -0
  116. package/FrequencyCapping/FrequencyCappingEdit.js +7 -0
  117. package/FrequencyCapping/FrequencyCappingInApps.d.ts +7 -0
  118. package/FrequencyCapping/FrequencyCappingInApps.js +7 -0
  119. package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
  120. package/FrequencyCapping/FrequencyCappingReadonly.js +3 -0
  121. package/FrequencyCapping/types.d.ts +37 -0
  122. package/FrequencyCapping/types.js +1 -0
  123. package/GetStartedPage/GetStartedPage.d.ts +7 -0
  124. package/GetStartedPage/GetStartedPage.js +7 -0
  125. package/GetStartedPage/types.d.ts +7 -0
  126. package/InputFile/InputFile.d.ts +7 -0
  127. package/InputFile/InputFile.js +7 -0
  128. package/InputFile/types.d.ts +18 -0
  129. package/Link/Link.d.ts +18 -0
  130. package/Link/types.d.ts +17 -0
  131. package/Modal/components/Modal/Modal.d.ts +11 -0
  132. package/Modal/components/Modal/Modal.js +11 -0
  133. package/Modal/components/Modal/types.d.ts +6 -0
  134. package/Modal/components/ModalConfirm/ModalConfirm.d.ts +8 -0
  135. package/Modal/components/ModalConfirm/ModalConfirm.js +8 -0
  136. package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +7 -0
  137. package/Modal/components/ModalConfirm/ModalConfirmProvider.js +7 -0
  138. package/Modal/components/ModalConfirm/hooks.d.ts +8 -0
  139. package/Modal/components/ModalConfirm/hooks.js +8 -0
  140. package/Modal/components/ModalConfirm/types.d.ts +16 -0
  141. package/Modal/components/ModalContent/styles.d.ts +5 -0
  142. package/Modal/components/ModalContent/styles.js +5 -0
  143. package/Modal/components/ModalTitle/ModalTitle.d.ts +6 -0
  144. package/Modal/components/ModalTitle/ModalTitle.js +6 -0
  145. package/Modal/components/ModalTitle/types.d.ts +3 -0
  146. package/NotificationInbox/NotificationBar.d.ts +7 -0
  147. package/NotificationInbox/NotificationBar.js +7 -0
  148. package/NotificationInbox/NotificationBell.d.ts +7 -0
  149. package/NotificationInbox/NotificationBell.js +7 -0
  150. package/NotificationInbox/NotificationInbox.d.ts +7 -0
  151. package/NotificationInbox/NotificationInbox.js +7 -0
  152. package/NotificationInbox/types.d.ts +31 -0
  153. package/NumberPicker/NumberPicker.d.ts +7 -0
  154. package/NumberPicker/NumberPicker.js +7 -0
  155. package/NumberPicker/types.d.ts +12 -0
  156. package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +7 -0
  157. package/PageHeader/components/AutosizeInput/AutosizeInput.js +7 -0
  158. package/PageHeader/components/AutosizeInput/types.d.ts +7 -0
  159. package/PageHeader/components/PageHeader/PageHeader.d.ts +7 -0
  160. package/PageHeader/components/PageHeader/PageHeader.js +7 -0
  161. package/PageHeader/components/PageHeader/types.d.ts +13 -0
  162. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +7 -0
  163. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +7 -0
  164. package/PageHeader/components/PageHeaderEditable/types.d.ts +19 -0
  165. package/Pagination/Pagination.d.ts +7 -0
  166. package/Pagination/Pagination.js +7 -0
  167. package/Pagination/types.d.ts +7 -0
  168. package/Popover/Popover.d.ts +10 -0
  169. package/Popover/Popover.js +10 -0
  170. package/Popover/styles.d.ts +1 -0
  171. package/Popover/styles.js +1 -0
  172. package/Popover/types.d.ts +9 -0
  173. package/ProgressBar/ProgressBar.d.ts +6 -0
  174. package/ProgressBar/ProgressBar.js +6 -0
  175. package/ProgressBar/types.d.ts +7 -0
  176. package/PushPreview/PushPreview.d.ts +7 -0
  177. package/PushPreview/PushPreview.js +7 -0
  178. package/PushPreview/types.d.ts +17 -0
  179. package/Radio/Radio.d.ts +7 -0
  180. package/Radio/Radio.js +7 -0
  181. package/Radio/types.d.ts +14 -0
  182. package/RadioCard/RadioCard.d.ts +7 -0
  183. package/RadioCard/RadioCard.js +7 -0
  184. package/RadioCard/types.d.ts +7 -0
  185. package/ReCaptcha/ReCaptcha.d.ts +8 -0
  186. package/ReCaptcha/ReCaptcha.js +8 -0
  187. package/ReCaptcha/helpers.d.ts +4 -0
  188. package/ReCaptcha/helpers.js +4 -0
  189. package/ReCaptcha/hooks.d.ts +4 -0
  190. package/ReCaptcha/hooks.js +4 -0
  191. package/ReCaptcha/types.d.ts +5 -0
  192. package/RichMessageEditor/RichMessageEditor.d.ts +8 -0
  193. package/RichMessageEditor/RichMessageEditor.js +8 -0
  194. package/RichMessageEditor/RichMessageEditor.types.d.ts +10 -0
  195. package/RichMessageEditor/RichMessageViewer.d.ts +10 -0
  196. package/RichMessageEditor/RichMessageViewer.js +7 -0
  197. package/RichMessageEditor/slate/types.d.ts +5 -0
  198. package/RichMessageEditor/types.d.ts +1 -0
  199. package/RichmediaPreview/RichmediaPreview.d.ts +7 -0
  200. package/RichmediaPreview/RichmediaPreview.js +7 -0
  201. package/RichmediaPreview/hooks.d.ts +4 -0
  202. package/RichmediaPreview/hooks.js +4 -0
  203. package/RichmediaPreview/types.d.ts +13 -0
  204. package/Select/Select.d.ts +22 -0
  205. package/Select/Select.js +22 -0
  206. package/Select/constants.d.ts +1 -0
  207. package/Select/constants.js +1 -0
  208. package/Select/types.d.ts +19 -0
  209. package/SendRate/SendRateEdit.d.ts +7 -0
  210. package/SendRate/SendRateEdit.js +7 -0
  211. package/SendRate/SendRateReadonly.d.ts +3 -0
  212. package/SendRate/SendRateReadonly.js +3 -0
  213. package/SendRate/types.d.ts +20 -0
  214. package/Skeleton/TextSkeleton.d.ts +6 -0
  215. package/Skeleton/TextSkeleton.js +6 -0
  216. package/Skeleton/styles.d.ts +2 -0
  217. package/Skeleton/styles.js +2 -0
  218. package/Skeleton/types.d.ts +11 -0
  219. package/SortButton/SortButton.d.ts +6 -0
  220. package/SortButton/SortButton.js +6 -0
  221. package/SortButton/types.d.ts +11 -0
  222. package/Spinner/Spinner.d.ts +6 -0
  223. package/Spinner/Spinner.js +6 -0
  224. package/Spinner/types.d.ts +4 -0
  225. package/StatisticCard/StatisticCard.d.ts +7 -0
  226. package/StatisticCard/StatisticCard.js +7 -0
  227. package/StatisticCard/types.d.ts +21 -0
  228. package/Switch/Switch.d.ts +6 -0
  229. package/Switch/Switch.js +6 -0
  230. package/Switch/types.d.ts +8 -0
  231. package/Tabs/components/Tab/Tab.d.ts +4 -0
  232. package/Tabs/components/Tab/Tab.js +4 -0
  233. package/Tabs/components/Tab/types.d.ts +6 -0
  234. package/Tabs/components/TabBar/TabBar.d.ts +3 -0
  235. package/Tabs/components/TabBar/TabBar.js +3 -0
  236. package/Tabs/components/TabBar/types.d.ts +2 -0
  237. package/Tabs/components/TabPanel/TabPanel.d.ts +4 -0
  238. package/Tabs/components/TabPanel/TabPanel.js +4 -0
  239. package/Tabs/components/TabPanel/types.d.ts +3 -0
  240. package/Tabs/components/Tabs/Tabs.d.ts +11 -0
  241. package/Tabs/components/Tabs/Tabs.js +11 -0
  242. package/Tabs/components/Tabs/types.d.ts +4 -0
  243. package/Tabs/types.d.ts +4 -0
  244. package/Toast/Toast.d.ts +5 -0
  245. package/Toast/Toast.js +5 -0
  246. package/Toast/ToastProvider.d.ts +7 -0
  247. package/Toast/ToastProvider.js +7 -0
  248. package/Toast/hooks.d.ts +8 -0
  249. package/Toast/hooks.js +8 -0
  250. package/Toast/types.d.ts +24 -0
  251. package/Tooltip/Tooltip.d.ts +7 -0
  252. package/Tooltip/Tooltip.js +7 -0
  253. package/Tooltip/TooltipTrigger.d.ts +13 -0
  254. package/Tooltip/TooltipTrigger.js +7 -0
  255. package/Tooltip/types.d.ts +12 -0
  256. package/hooks/useElementWidth.d.ts +4 -3
  257. package/hooks/useElementWidth.js +4 -3
  258. package/hooks/useLayer.d.ts +7 -0
  259. package/hooks/useLayer.js +7 -0
  260. package/hooks/useOnClickOutside.d.ts +7 -0
  261. package/hooks/useOnClickOutside.js +7 -0
  262. package/native/Input.d.ts +3 -0
  263. package/native/Input.js +1 -0
  264. package/native/NativeTimeInput.d.ts +1 -0
  265. package/native/NativeTimeInput.js +1 -0
  266. package/native/Select.d.ts +1 -0
  267. package/native/Select.js +1 -0
  268. package/native/Textarea.d.ts +1 -0
  269. package/native/Textarea.js +1 -0
  270. package/package.json +2 -3
  271. package/polyglot/react.d.ts +19 -0
  272. package/polyglot/react.js +19 -0
  273. package/polyglot/types.d.ts +4 -0
  274. package/shared/dropdownField/FieldInput.d.ts +1 -0
  275. package/shared/dropdownField/FieldInput.js +1 -0
  276. package/shared/dropdownField/FieldShell.d.ts +4 -0
  277. package/shared/dropdownField/FieldShell.js +4 -0
  278. package/shared/dropdownField/SuggestionsDropdown.d.ts +4 -0
  279. package/shared/dropdownField/SuggestionsDropdown.js +4 -0
  280. package/shared/dropdownField/constants.d.ts +1 -0
  281. package/shared/dropdownField/constants.js +1 -0
  282. package/shared/dropdownField/shared.d.ts +7 -0
  283. package/shared/dropdownField/shared.js +7 -0
  284. package/shared/dropdownField/types.d.ts +7 -0
  285. package/shared/dropdownField/useActiveIndex.d.ts +4 -0
  286. package/shared/dropdownField/useActiveIndex.js +4 -0
  287. package/shared/dropdownField/useAsyncItems.d.ts +4 -0
  288. package/shared/dropdownField/useAsyncItems.js +4 -0
  289. package/shared/dropdownField/useDebouncedValue.d.ts +1 -0
  290. package/shared/dropdownField/useDebouncedValue.js +1 -0
  291. package/shared/dropdownField/useDropdownItems.d.ts +4 -0
  292. package/shared/dropdownField/useDropdownItems.js +4 -0
  293. package/shared/dropdownField/useDropdownPosition.d.ts +4 -0
  294. package/shared/dropdownField/useDropdownPosition.js +4 -0
  295. package/shared/dropdownField/useFieldOpenEffects.d.ts +4 -0
  296. package/shared/dropdownField/useFieldOpenEffects.js +4 -0
  297. package/shared/dropdownField/useListNavigation.d.ts +5 -0
  298. package/shared/dropdownField/useListNavigation.js +5 -0
  299. package/Alert/ai-documentation.md +0 -132
  300. package/Badge/ai-documentation.md +0 -155
  301. package/Banner/ai-documentation.md +0 -285
  302. package/Button/ai-documentation.md +0 -247
  303. package/CardMetric/ai-documentation.md +0 -277
  304. package/Checkbox/ai-documentation.md +0 -231
  305. package/Chip/ai-documentation.md +0 -281
  306. package/CodeEditor/ai-documentation.md +0 -350
  307. package/DateTimePicker/ai-documentation.md +0 -400
  308. package/Drawer/ai-documentation.md +0 -417
  309. package/EnhancedInput/ai-documentation.md +0 -352
  310. package/InputFile/ai-documentation.md +0 -420
  311. package/Modal/ai-documentation.md +0 -285
  312. package/PageHeader/ai-documentation.md +0 -511
  313. package/Pagination/ai-documentation.md +0 -509
  314. package/Popover/ai-documentation.md +0 -625
  315. package/ProgressBar/ai-documentation.md +0 -533
  316. package/Radio/ai-documentation.md +0 -243
  317. package/Select/ai-documentation.md +0 -374
  318. package/Skeleton/ai-documentation.md +0 -574
  319. package/Spinner/ai-documentation.md +0 -607
  320. package/Switch/ai-documentation.md +0 -312
  321. package/Tabs/ai-documentation.md +0 -475
  322. package/Toast/ai-documentation.md +0 -220
  323. package/Tooltip/ai-documentation.md +0 -340
  324. package/ai-documentation.md +0 -124
  325. package/native/ai-documentation.md +0 -485
@@ -1,475 +0,0 @@
1
- # Tabs Component System - @pushwoosh/dumb-components
2
-
3
- ## Overview
4
-
5
- - **Component Name**: Tabs (System)
6
- - **Import Path**: `@pushwoosh/dumb-components`
7
- - **Files**:
8
- - `/src/Tabs/index.tsx` - Main exports
9
- - `/src/Tabs/types.ts` - Core type definitions
10
- - `/src/Tabs/context.tsx` - React context for tab state
11
- - `/src/Tabs/helpers.tsx` - Helper utilities
12
- - `/src/Tabs/components/Tabs/` - Main Tabs container
13
- - `/src/Tabs/components/Tab/` - Individual Tab component
14
- - `/src/Tabs/components/TabBar/` - Tab navigation bar
15
- - `/src/Tabs/components/TabPanel/` - Tab content panel
16
- - `/src/Tabs/components/TabBase/` - Base tab styling
17
- - `/src/Tabs/components/TabBarScrollableFrame/` - Scrollable tab container
18
- - **Type**: Navigation/Layout
19
- - **Description**: A complete tab system with multiple components for creating tabbed interfaces. Supports controlled state management, custom containers, icons, disabled states, and new item indicators.
20
-
21
- ## TypeScript Interfaces
22
-
23
- ```typescript
24
- export type TabCode = string | number;
25
-
26
- export type TabContextType = {
27
- activeTabCode: TabCode;
28
- setActiveTabCode: (code: TabCode) => void;
29
- };
30
-
31
- // Main Tabs container
32
- export type TabsProps = PropsWithChildren<Readonly<{
33
- activeCode: TabCode;
34
- onChange: (code: TabCode) => void;
35
- container?: ElementType;
36
- }>>;
37
-
38
- // Individual Tab
39
- export type TabProps = Omit<JSX.IntrinsicElements['div'], 'ref' | 'onClick'> & Readonly<{
40
- code: TabCode;
41
- onActivate?: (code: TabCode) => void;
42
- isDisabled?: boolean;
43
- isNew?: boolean;
44
- icon?: ReactNode;
45
- }>;
46
-
47
- // Tab Bar (navigation container)
48
- export type TabBarProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & Readonly<{
49
- title?: ReactNode;
50
- }>;
51
-
52
- // Tab Panel (content container)
53
- export type TabPanelProps = PropsWithChildren<Readonly<{
54
- code: TabCode;
55
- container?: ElementType;
56
- }>>;
57
- ```
58
-
59
- ## Import & Usage
60
-
61
- ```typescript
62
- import { Tabs, Tab, TabBar, TabPanel } from '@pushwoosh/dumb-components';
63
-
64
- // Basic usage
65
- function MyTabs() {
66
- const [activeTab, setActiveTab] = useState('tab1');
67
-
68
- return (
69
- <Tabs activeCode={activeTab} onChange={setActiveTab}>
70
- <TabBar>
71
- <Tab code="tab1">First Tab</Tab>
72
- <Tab code="tab2">Second Tab</Tab>
73
- <Tab code="tab3">Third Tab</Tab>
74
- </TabBar>
75
-
76
- <TabPanel code="tab1">
77
- <h3>First Panel</h3>
78
- <p>Content for the first tab</p>
79
- </TabPanel>
80
-
81
- <TabPanel code="tab2">
82
- <h3>Second Panel</h3>
83
- <p>Content for the second tab</p>
84
- </TabPanel>
85
-
86
- <TabPanel code="tab3">
87
- <h3>Third Panel</h3>
88
- <p>Content for the third tab</p>
89
- </TabPanel>
90
- </Tabs>
91
- );
92
- }
93
-
94
- // With tab bar title
95
- function TitledTabs() {
96
- const [activeTab, setActiveTab] = useState('overview');
97
-
98
- return (
99
- <Tabs activeCode={activeTab} onChange={setActiveTab}>
100
- <TabBar title="Dashboard Settings">
101
- <Tab code="overview">Overview</Tab>
102
- <Tab code="users">Users</Tab>
103
- <Tab code="billing">Billing</Tab>
104
- </TabBar>
105
-
106
- <TabPanel code="overview">Overview content</TabPanel>
107
- <TabPanel code="users">User management</TabPanel>
108
- <TabPanel code="billing">Billing information</TabPanel>
109
- </Tabs>
110
- );
111
- }
112
- ```
113
-
114
- ## Advanced Examples
115
-
116
- ```typescript
117
- // Tabs with icons and states
118
- function AdvancedTabs() {
119
- const [activeTab, setActiveTab] = useState('dashboard');
120
-
121
- return (
122
- <Tabs activeCode={activeTab} onChange={setActiveTab}>
123
- <TabBar title="Application">
124
- <Tab
125
- code="dashboard"
126
- icon={<DashboardIcon />}
127
- >
128
- Dashboard
129
- </Tab>
130
-
131
- <Tab
132
- code="notifications"
133
- icon={<BellIcon />}
134
- isNew={true}
135
- >
136
- Notifications
137
- </Tab>
138
-
139
- <Tab
140
- code="settings"
141
- icon={<SettingsIcon />}
142
- >
143
- Settings
144
- </Tab>
145
-
146
- <Tab
147
- code="archive"
148
- icon={<ArchiveIcon />}
149
- isDisabled={true}
150
- >
151
- Archive
152
- </Tab>
153
- </TabBar>
154
-
155
- <TabPanel code="dashboard">
156
- <div>Dashboard content with charts and metrics</div>
157
- </TabPanel>
158
-
159
- <TabPanel code="notifications">
160
- <div>New notification system</div>
161
- </TabPanel>
162
-
163
- <TabPanel code="settings">
164
- <div>Application settings</div>
165
- </TabPanel>
166
-
167
- <TabPanel code="archive">
168
- <div>Archived items (disabled)</div>
169
- </TabPanel>
170
- </Tabs>
171
- );
172
- }
173
-
174
- // Dynamic tabs with add/remove functionality
175
- function DynamicTabs() {
176
- const [tabs, setTabs] = useState([
177
- { code: 'tab-1', title: 'Tab 1', content: 'Content 1' },
178
- { code: 'tab-2', title: 'Tab 2', content: 'Content 2' },
179
- ]);
180
- const [activeTab, setActiveTab] = useState('tab-1');
181
- const [counter, setCounter] = useState(3);
182
-
183
- const addTab = () => {
184
- const newTab = {
185
- code: `tab-${counter}`,
186
- title: `Tab ${counter}`,
187
- content: `Content for tab ${counter}`,
188
- };
189
- setTabs(prev => [...prev, newTab]);
190
- setActiveTab(newTab.code);
191
- setCounter(prev => prev + 1);
192
- };
193
-
194
- const removeTab = (codeToRemove: string) => {
195
- setTabs(prev => prev.filter(tab => tab.code !== codeToRemove));
196
-
197
- // Switch to first tab if active tab is removed
198
- if (activeTab === codeToRemove && tabs.length > 1) {
199
- const remainingTabs = tabs.filter(tab => tab.code !== codeToRemove);
200
- setActiveTab(remainingTabs[0].code);
201
- }
202
- };
203
-
204
- return (
205
- <div>
206
- <button onClick={addTab}>Add Tab</button>
207
-
208
- <Tabs activeCode={activeTab} onChange={setActiveTab}>
209
- <TabBar>
210
- {tabs.map(tab => (
211
- <Tab
212
- key={tab.code}
213
- code={tab.code}
214
- style={{ display: 'flex', alignItems: 'center', gap: '8px' }}
215
- >
216
- {tab.title}
217
- {tabs.length > 1 && (
218
- <button
219
- onClick={(e) => {
220
- e.stopPropagation();
221
- removeTab(tab.code);
222
- }}
223
- style={{
224
- marginLeft: '8px',
225
- padding: '2px 4px',
226
- fontSize: '12px'
227
- }}
228
- >
229
- ×
230
- </button>
231
- )}
232
- </Tab>
233
- ))}
234
- </TabBar>
235
-
236
- {tabs.map(tab => (
237
- <TabPanel key={tab.code} code={tab.code}>
238
- <div>{tab.content}</div>
239
- </TabPanel>
240
- ))}
241
- </Tabs>
242
- </div>
243
- );
244
- }
245
-
246
- // Form tabs with validation states
247
- function FormTabs() {
248
- const [activeTab, setActiveTab] = useState('personal');
249
- const [formErrors, setFormErrors] = useState<{[key: string]: boolean}>({});
250
-
251
- const hasErrors = (tabCode: string) => formErrors[tabCode];
252
-
253
- return (
254
- <Tabs activeCode={activeTab} onChange={setActiveTab}>
255
- <TabBar title="User Profile">
256
- <Tab
257
- code="personal"
258
- style={{
259
- color: hasErrors('personal') ? '#dc3545' : undefined
260
- }}
261
- >
262
- Personal Info
263
- {hasErrors('personal') && <span style={{color: '#dc3545'}}>*</span>}
264
- </Tab>
265
-
266
- <Tab
267
- code="contact"
268
- style={{
269
- color: hasErrors('contact') ? '#dc3545' : undefined
270
- }}
271
- >
272
- Contact Details
273
- {hasErrors('contact') && <span style={{color: '#dc3545'}}>*</span>}
274
- </Tab>
275
-
276
- <Tab code="preferences">
277
- Preferences
278
- </Tab>
279
- </TabBar>
280
-
281
- <TabPanel code="personal">
282
- <form>
283
- <input placeholder="First Name" required />
284
- <input placeholder="Last Name" required />
285
- <input placeholder="Date of Birth" type="date" />
286
- </form>
287
- </TabPanel>
288
-
289
- <TabPanel code="contact">
290
- <form>
291
- <input placeholder="Email" type="email" required />
292
- <input placeholder="Phone" type="tel" />
293
- <textarea placeholder="Address"></textarea>
294
- </form>
295
- </TabPanel>
296
-
297
- <TabPanel code="preferences">
298
- <form>
299
- <label>
300
- <input type="checkbox" /> Email notifications
301
- </label>
302
- <label>
303
- <input type="checkbox" /> SMS notifications
304
- </label>
305
- </form>
306
- </TabPanel>
307
- </Tabs>
308
- );
309
- }
310
-
311
- // Custom containers and styling
312
- function CustomStyledTabs() {
313
- const [activeTab, setActiveTab] = useState('code');
314
-
315
- const CustomTabsContainer = styled.div`
316
- background: #f8f9fa;
317
- border-radius: 8px;
318
- padding: 16px;
319
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
320
- `;
321
-
322
- const CustomPanelContainer = styled.div`
323
- background: white;
324
- padding: 24px;
325
- border-radius: 4px;
326
- min-height: 200px;
327
- `;
328
-
329
- return (
330
- <Tabs
331
- activeCode={activeTab}
332
- onChange={setActiveTab}
333
- container={CustomTabsContainer}
334
- >
335
- <TabBar title="Code Editor">
336
- <Tab code="code" icon={<CodeIcon />}>Code</Tab>
337
- <Tab code="preview" icon={<EyeIcon />}>Preview</Tab>
338
- <Tab code="console" icon={<TerminalIcon />}>Console</Tab>
339
- </TabBar>
340
-
341
- <TabPanel code="code" container={CustomPanelContainer}>
342
- <pre><code>function hello() {`\n`} console.log('Hello World!');{`\n`}}</code></pre>
343
- </TabPanel>
344
-
345
- <TabPanel code="preview" container={CustomPanelContainer}>
346
- <iframe src="/preview" style={{width: '100%', height: '300px'}}></iframe>
347
- </TabPanel>
348
-
349
- <TabPanel code="console" container={CustomPanelContainer}>
350
- <div style={{fontFamily: 'monospace', background: '#000', color: '#fff', padding: '12px'}}>
351
- > Hello World!
352
- </div>
353
- </TabPanel>
354
- </Tabs>
355
- );
356
- }
357
- ```
358
-
359
- ## Props Reference
360
-
361
- ### Tabs (Main Container)
362
-
363
- | Prop | Type | Default | Required | Description |
364
- |------|------|---------|----------|-------------|
365
- | `activeCode` | `TabCode` | - | Yes | Currently active tab code |
366
- | `onChange` | `(code: TabCode) => void` | - | Yes | Callback when active tab changes |
367
- | `container` | `ElementType` | `TabsContainer` | No | Custom container component |
368
- | `children` | `ReactNode` | - | Yes | Tab bar and panels |
369
-
370
- ### Tab (Individual Tab)
371
-
372
- | Prop | Type | Default | Required | Description |
373
- |------|------|---------|----------|-------------|
374
- | `code` | `TabCode` | - | Yes | Unique identifier for the tab |
375
- | `onActivate` | `(code: TabCode) => void` | `undefined` | No | Callback when tab is activated |
376
- | `isDisabled` | `boolean` | `false` | No | Whether the tab is disabled |
377
- | `isNew` | `boolean` | `false` | No | Whether to show "new" indicator |
378
- | `icon` | `ReactNode` | `undefined` | No | Icon to display in the tab |
379
- | `children` | `ReactNode` | - | Yes | Tab label content |
380
-
381
- ### TabBar (Navigation Container)
382
-
383
- | Prop | Type | Default | Required | Description |
384
- |------|------|---------|----------|-------------|
385
- | `title` | `ReactNode` | `undefined` | No | Optional title above tabs |
386
- | `children` | `ReactNode` | - | Yes | Tab components |
387
-
388
- ### TabPanel (Content Panel)
389
-
390
- | Prop | Type | Default | Required | Description |
391
- |------|------|---------|----------|-------------|
392
- | `code` | `TabCode` | - | Yes | Tab code this panel belongs to |
393
- | `container` | `ElementType` | `TabPanelContainer` | No | Custom container component |
394
- | `children` | `ReactNode` | - | Yes | Panel content |
395
-
396
- ## AI Agent Guidelines
397
-
398
- ### Recommended Patterns
399
-
400
- 1. **Controlled State**: Always use controlled tab state
401
- ```typescript
402
- const [activeTab, setActiveTab] = useState('defaultTab');
403
-
404
- <Tabs activeCode={activeTab} onChange={setActiveTab}>
405
- {/* tabs and panels */}
406
- </Tabs>
407
- ```
408
-
409
- 2. **Consistent Codes**: Use consistent, meaningful tab codes
410
- ```typescript
411
- // Good - descriptive codes
412
- <Tab code="user-profile">Profile</Tab>
413
- <Tab code="account-settings">Settings</Tab>
414
-
415
- // Avoid - generic or unclear codes
416
- <Tab code="1">Profile</Tab>
417
- <Tab code="tab2">Settings</Tab>
418
- ```
419
-
420
- 3. **Panel Matching**: Ensure every Tab has a matching TabPanel
421
- ```typescript
422
- <TabBar>
423
- <Tab code="overview">Overview</Tab>
424
- <Tab code="details">Details</Tab>
425
- </TabBar>
426
-
427
- <TabPanel code="overview">...</TabPanel>
428
- <TabPanel code="details">...</TabPanel>
429
- ```
430
-
431
- ### Common Mistakes to Avoid
432
-
433
- 1. **Missing TabBar**: Don't put Tab components directly in Tabs without TabBar
434
- 2. **Mismatched Codes**: Ensure Tab and TabPanel codes match exactly
435
- 3. **Missing onChange**: Always provide an onChange handler
436
- 4. **Uncontrolled State**: Don't mix controlled and uncontrolled patterns
437
- 5. **Invalid HTML**: Tab content should be properly structured HTML
438
-
439
- ### Integration Tips
440
-
441
- 1. **State Management**: Works well with global state management
442
- ```typescript
443
- // Redux integration
444
- const activeTab = useSelector(state => state.ui.activeTab);
445
- const dispatch = useDispatch();
446
-
447
- <Tabs
448
- activeCode={activeTab}
449
- onChange={(code) => dispatch(setActiveTab(code))}
450
- >
451
- ```
452
-
453
- 2. **Routing Integration**: Sync tabs with URL routing
454
- ```typescript
455
- const navigate = useNavigate();
456
- const location = useLocation();
457
-
458
- const activeTab = location.pathname.split('/').pop() || 'overview';
459
-
460
- <Tabs
461
- activeCode={activeTab}
462
- onChange={(code) => navigate(`/dashboard/${code}`)}
463
- >
464
- ```
465
-
466
- 3. **Form Integration**: Use tabs for multi-step forms
467
- 4. **Accessibility**: Components handle ARIA attributes and keyboard navigation automatically
468
- 5. **Performance**: TabPanels only render when active (conditional rendering)
469
-
470
- ## Related Components
471
-
472
- - **Button**: For tab-like button groups
473
- - **Modal**: For modal dialogs with tabbed content
474
- - **Accordion**: Alternative for collapsible content sections
475
- - **Drawer**: For side navigation with tab-like behavior
@@ -1,220 +0,0 @@
1
- # Toast Component Documentation
2
-
3
- ## Component Overview
4
-
5
- The Toast component provides a notification system with provider/context pattern for global toast management. It displays temporary messages to users with different types (info, success, warning, error) and supports custom content.
6
-
7
- ## Component Structure
8
-
9
- - `Toast.tsx` - Main toast component with portal rendering
10
- - `ToastProvider.tsx` - Context provider for global toast management
11
- - `hooks.ts` - useToast hook for consuming toast context
12
- - `types.ts` - TypeScript interfaces and type definitions
13
- - `constants.ts` - Default values and type color mappings
14
- - `styles.ts` - Styled components for toast styling
15
-
16
- ## TypeScript Interfaces
17
-
18
- ```typescript
19
- export type ToastType = 'info' | 'success' | 'warning' | 'error';
20
-
21
- export type ToastParams = {
22
- title: string;
23
- description?: ReactNode;
24
- duration: number | false;
25
- type: ToastType;
26
- };
27
-
28
- export type OpenToastParams = {
29
- title: string;
30
- description?: ReactNode;
31
- duration?: number;
32
- type?: ToastType;
33
- };
34
-
35
- export interface ToastContextProps {
36
- openToast: (params: OpenToastParams) => void;
37
- closeToast: () => void;
38
- }
39
-
40
- export interface ToastProviderProps {
41
- children: ReactNode;
42
- }
43
-
44
- export interface ToastProps {
45
- open: boolean;
46
- toast: ToastParams;
47
- onClose: () => void;
48
- }
49
- ```
50
-
51
- ## Usage Examples
52
-
53
- ### Basic Setup with Provider
54
-
55
- ```tsx
56
- import { ToastProvider } from '@pushwoosh/dumb-components';
57
-
58
- function App() {
59
- return (
60
- <ToastProvider>
61
- <YourAppContent />
62
- </ToastProvider>
63
- );
64
- }
65
- ```
66
-
67
- ### Using Toast Hook
68
-
69
- ```tsx
70
- import { useToast } from '@pushwoosh/dumb-components';
71
-
72
- function MyComponent() {
73
- const { openToast, closeToast } = useToast();
74
-
75
- const handleSuccess = () => {
76
- openToast({
77
- title: 'Success!',
78
- description: 'Your action was completed successfully.',
79
- type: 'success',
80
- duration: 3000,
81
- });
82
- };
83
-
84
- const handleError = () => {
85
- openToast({
86
- title: 'Error occurred',
87
- description: 'Please try again later.',
88
- type: 'error',
89
- duration: 5000,
90
- });
91
- };
92
-
93
- return (
94
- <div>
95
- <button onClick={handleSuccess}>Show Success</button>
96
- <button onClick={handleError}>Show Error</button>
97
- <button onClick={closeToast}>Close Toast</button>
98
- </div>
99
- );
100
- }
101
- ```
102
-
103
- ### Toast with Custom Content
104
-
105
- ```tsx
106
- import { useToast } from '@pushwoosh/dumb-components';
107
-
108
- function ComponentWithCustomToast() {
109
- const { openToast } = useToast();
110
-
111
- const handleCustomToast = () => {
112
- openToast({
113
- title: 'Custom Toast',
114
- description: 'This toast has additional content.',
115
- type: 'info',
116
- });
117
- };
118
-
119
- return <button onClick={handleCustomToast}>Show Custom Toast</button>;
120
- }
121
- ```
122
-
123
- ## Props Reference
124
-
125
- ### ToastProvider Props
126
-
127
- | Prop | Type | Required | Description |
128
- |------|------|----------|-------------|
129
- | children | ReactNode | Yes | Child components that can access toast context |
130
-
131
- ### useToast Hook Returns
132
-
133
- | Property | Type | Description |
134
- |----------|------|-------------|
135
- | openToast | (params: OpenToastParams) => void | Function to open a new toast |
136
- | closeToast | () => void | Function to close current toast |
137
-
138
- ### OpenToastParams
139
-
140
- | Prop | Type | Required | Default | Description |
141
- |------|------|----------|---------|-------------|
142
- | title | string | Yes | - | Main toast title |
143
- | description | ReactNode | No | - | Optional description content |
144
- | duration | number | No | 3000 | Toast display duration in milliseconds |
145
- | type | ToastType | No | 'info' | Toast type affecting icon and color |
146
-
147
- ### Toast Types
148
-
149
- - `'info'` - Blue info icon with bright color
150
- - `'success'` - Green checkmark icon
151
- - `'warning'` - Orange warning icon
152
- - `'error'` - Red danger triangle icon
153
-
154
- ## Features
155
-
156
- ### Auto-dismissal
157
- Toasts automatically close after the specified duration (default 3000ms).
158
-
159
- ### Manual Dismissal
160
- Users can manually close toasts using the close button or the closeToast function.
161
-
162
- ### Portal Rendering
163
- Toasts are rendered using React portals to document.body for proper z-index layering.
164
-
165
- ### Global State Management
166
- Single toast instance managed through React Context for application-wide access.
167
-
168
- ### Type-based Styling
169
- Different toast types have distinct icons and border colors for visual differentiation.
170
-
171
- ## Constants
172
-
173
- ```typescript
174
- export const DEFAULT_DURATION = 3000;
175
-
176
- export const TypeColorMap = {
177
- info: Color.BRIGHT,
178
- success: Color.SUCCESS,
179
- warning: Color.WARNING,
180
- error: Color.DANGER,
181
- };
182
- ```
183
-
184
- ## Styling
185
-
186
- The toast uses a fixed positioning system:
187
- - Positioned at top center of the viewport (50px from top when open)
188
- - 380px width with responsive design
189
- - Slide animation from top (-250px when closed)
190
- - High z-index (999999999) for overlay display
191
- - Border color matches toast type
192
- - Large shadow for elevation
193
-
194
- ## AI Agent Guidelines
195
-
196
- When working with the Toast component:
197
-
198
- 1. **Provider Setup**: Always ensure ToastProvider wraps the application root for global access
199
- 2. **Hook Usage**: Use useToast hook only within components wrapped by ToastProvider
200
- 3. **Error Handling**: The hook throws an error if used outside of provider context
201
- 4. **Duration Management**: Consider appropriate duration based on toast importance and content length
202
- 5. **Type Selection**: Choose appropriate toast type based on user action outcome
203
- 7. **Accessibility**: Toast messages should be descriptive for screen readers
204
- 8. **Portal Rendering**: Remember that toasts render to document.body, not inline
205
- 9. **Single Instance**: Only one toast displays at a time; new toasts replace current ones
206
- 10. **Manual Control**: Provide manual close options for important messages or longer durations
207
-
208
- ### Common Use Cases
209
- - Success confirmations after form submissions
210
- - Error messages for failed operations
211
- - Information notices about system changes
212
- - Warning messages before destructive actions
213
- - Progress notifications with custom action buttons
214
-
215
- ### Best Practices
216
- - Keep titles concise and descriptive
217
- - Use descriptions for additional context
218
- - Choose appropriate durations (3s for success, 5s+ for errors)
219
- - Provide manual close for critical messages
220
- - Test toast behavior in different viewport sizes