@pushwoosh/dumb-components 1.1.148 → 1.1.150

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 (323) 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 +7 -0
  27. package/Calendar/CalendarSuperForm/types.d.ts +36 -10
  28. package/Calendar/helpers.d.ts +10 -0
  29. package/Calendar/helpers.js +10 -0
  30. package/Calendar/types.d.ts +16 -1
  31. package/CardMetric/CardMetric.d.ts +7 -0
  32. package/CardMetric/CardMetric.js +7 -0
  33. package/CardMetric/types.d.ts +13 -0
  34. package/Checkbox/Checkbox.d.ts +6 -0
  35. package/Checkbox/Checkbox.js +6 -0
  36. package/Checkbox/types.d.ts +13 -0
  37. package/Chip/Chip.d.ts +7 -0
  38. package/Chip/Chip.js +7 -0
  39. package/Chip/Chip.types.d.ts +9 -0
  40. package/CodeEditor/CodeEditor.d.ts +7 -0
  41. package/CodeEditor/CodeEditor.js +7 -0
  42. package/CodeEditor/languages/html.d.ts +1 -0
  43. package/CodeEditor/languages/html.js +1 -0
  44. package/CodeEditor/languages/json.d.ts +1 -0
  45. package/CodeEditor/languages/json.js +1 -0
  46. package/CodeEditor/languages/liquid.d.ts +1 -0
  47. package/CodeEditor/languages/liquid.js +1 -0
  48. package/CodeEditor/types.d.ts +11 -0
  49. package/CrashScreen/CrashScreen.d.ts +4 -0
  50. package/CrashScreen/CrashScreen.js +4 -0
  51. package/DateTimePicker/components/DatePicker/DatePicker.d.ts +5 -0
  52. package/DateTimePicker/components/DatePicker/DatePicker.js +5 -0
  53. package/DateTimePicker/components/DatePicker/types.d.ts +9 -0
  54. package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +5 -0
  55. package/DateTimePicker/components/DatePickerField/DatePickerField.js +5 -0
  56. package/DateTimePicker/components/DatePickerField/types.d.ts +9 -0
  57. package/DateTimePicker/components/DateTimePicker/DateTimePicker.d.ts +5 -0
  58. package/DateTimePicker/components/DateTimePicker/DateTimePicker.js +5 -0
  59. package/DateTimePicker/components/DateTimePicker/types.d.ts +6 -0
  60. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +5 -0
  61. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +5 -0
  62. package/DateTimePicker/components/DateTimePickerField/types.d.ts +9 -0
  63. package/DateTimePicker/types.d.ts +5 -0
  64. package/Drawer/components/Drawer/Drawer.d.ts +11 -0
  65. package/Drawer/components/Drawer/Drawer.js +12 -1
  66. package/Drawer/components/Drawer/types.d.ts +10 -1
  67. package/Drawer/components/DrawerContent/styles.d.ts +3 -0
  68. package/Drawer/components/DrawerContent/styles.js +3 -0
  69. package/Drawer/components/DrawerDocs/DrawerDocs.d.ts +7 -0
  70. package/Drawer/components/DrawerDocs/DrawerDocs.js +7 -0
  71. package/Drawer/components/DrawerDocs/hooks.d.ts +4 -0
  72. package/Drawer/components/DrawerDocs/hooks.js +4 -0
  73. package/Drawer/components/DrawerDocs/types.d.ts +4 -0
  74. package/DropdownMenu/components/DropdownMenu/DropdownMenu.d.ts +12 -0
  75. package/DropdownMenu/components/DropdownMenu/DropdownMenu.js +12 -0
  76. package/DropdownMenu/components/DropdownMenu/types.d.ts +15 -0
  77. package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.d.ts +8 -0
  78. package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +8 -0
  79. package/DropdownMenu/components/DropdownMenuButton/types.d.ts +16 -0
  80. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.d.ts +7 -0
  81. package/DropdownMenu/components/DropdownMenuItem/DropdownMenuItem.js +7 -0
  82. package/DropdownMenu/components/DropdownMenuItem/types.d.ts +6 -0
  83. package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.d.ts +8 -0
  84. package/DropdownMenu/components/DropdownMenuSection/DropdownMenuSection.js +8 -0
  85. package/DropdownMenu/components/DropdownMenuSection/types.d.ts +3 -0
  86. package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.d.ts +9 -0
  87. package/DropdownMenu/components/DropdownMenuSubmenu/DropdownMenuSubmenu.js +9 -0
  88. package/DropdownMenu/components/DropdownMenuSubmenu/types.d.ts +5 -0
  89. package/EditableField/EditableField.d.ts +9 -0
  90. package/EditableField/EditableField.js +9 -0
  91. package/EditableField/types.d.ts +12 -0
  92. package/EmailTemplatePreview/EmailTemplatePreview.d.ts +7 -0
  93. package/EmailTemplatePreview/EmailTemplatePreview.js +7 -0
  94. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.d.ts +4 -0
  95. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +4 -0
  96. package/EmailTemplatePreview/helpers.d.ts +8 -0
  97. package/EmailTemplatePreview/helpers.js +8 -0
  98. package/EmailTemplatePreview/types.d.ts +7 -0
  99. package/EnhancedInput/EnhancedInput.d.ts +7 -0
  100. package/EnhancedInput/EnhancedInput.js +7 -0
  101. package/EnhancedInput/SearchInput.d.ts +6 -0
  102. package/EnhancedInput/SearchInput.js +6 -0
  103. package/EnhancedInput/types.d.ts +5 -0
  104. package/ExportResult/ExportResult.d.ts +7 -0
  105. package/ExportResult/ExportResult.js +7 -0
  106. package/ExportResult/types.d.ts +7 -0
  107. package/ExternalImagePreview/ExternalImagePreview.d.ts +7 -0
  108. package/ExternalImagePreview/ExternalImagePreview.js +7 -0
  109. package/ExternalImagePreview/types.d.ts +7 -0
  110. package/FieldBox/FieldBox.d.ts +9 -0
  111. package/FieldBox/FieldBox.js +9 -0
  112. package/FieldBox/types.d.ts +10 -0
  113. package/FrequencyCapping/FrequencyCappingEdit.d.ts +7 -0
  114. package/FrequencyCapping/FrequencyCappingEdit.js +7 -0
  115. package/FrequencyCapping/FrequencyCappingInApps.d.ts +7 -0
  116. package/FrequencyCapping/FrequencyCappingInApps.js +7 -0
  117. package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
  118. package/FrequencyCapping/FrequencyCappingReadonly.js +3 -0
  119. package/FrequencyCapping/types.d.ts +37 -0
  120. package/FrequencyCapping/types.js +1 -0
  121. package/GetStartedPage/GetStartedPage.d.ts +7 -0
  122. package/GetStartedPage/GetStartedPage.js +7 -0
  123. package/GetStartedPage/types.d.ts +7 -0
  124. package/InputFile/InputFile.d.ts +7 -0
  125. package/InputFile/InputFile.js +7 -0
  126. package/InputFile/types.d.ts +18 -0
  127. package/Link/Link.d.ts +18 -0
  128. package/Link/types.d.ts +17 -0
  129. package/Modal/components/Modal/Modal.d.ts +11 -0
  130. package/Modal/components/Modal/Modal.js +11 -0
  131. package/Modal/components/Modal/types.d.ts +6 -0
  132. package/Modal/components/ModalConfirm/ModalConfirm.d.ts +8 -0
  133. package/Modal/components/ModalConfirm/ModalConfirm.js +8 -0
  134. package/Modal/components/ModalConfirm/ModalConfirmProvider.d.ts +7 -0
  135. package/Modal/components/ModalConfirm/ModalConfirmProvider.js +7 -0
  136. package/Modal/components/ModalConfirm/hooks.d.ts +8 -0
  137. package/Modal/components/ModalConfirm/hooks.js +8 -0
  138. package/Modal/components/ModalConfirm/types.d.ts +16 -0
  139. package/Modal/components/ModalContent/styles.d.ts +5 -0
  140. package/Modal/components/ModalContent/styles.js +5 -0
  141. package/Modal/components/ModalTitle/ModalTitle.d.ts +6 -0
  142. package/Modal/components/ModalTitle/ModalTitle.js +6 -0
  143. package/Modal/components/ModalTitle/types.d.ts +3 -0
  144. package/NotificationInbox/NotificationBar.d.ts +7 -0
  145. package/NotificationInbox/NotificationBar.js +7 -0
  146. package/NotificationInbox/NotificationBell.d.ts +7 -0
  147. package/NotificationInbox/NotificationBell.js +7 -0
  148. package/NotificationInbox/NotificationInbox.d.ts +7 -0
  149. package/NotificationInbox/NotificationInbox.js +7 -0
  150. package/NotificationInbox/types.d.ts +31 -0
  151. package/NumberPicker/NumberPicker.d.ts +7 -0
  152. package/NumberPicker/NumberPicker.js +7 -0
  153. package/NumberPicker/types.d.ts +12 -0
  154. package/PageHeader/components/AutosizeInput/AutosizeInput.d.ts +7 -0
  155. package/PageHeader/components/AutosizeInput/AutosizeInput.js +7 -0
  156. package/PageHeader/components/AutosizeInput/types.d.ts +7 -0
  157. package/PageHeader/components/PageHeader/PageHeader.d.ts +7 -0
  158. package/PageHeader/components/PageHeader/PageHeader.js +7 -0
  159. package/PageHeader/components/PageHeader/types.d.ts +13 -0
  160. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.d.ts +7 -0
  161. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +7 -0
  162. package/PageHeader/components/PageHeaderEditable/types.d.ts +19 -0
  163. package/Pagination/Pagination.d.ts +7 -0
  164. package/Pagination/Pagination.js +7 -0
  165. package/Pagination/types.d.ts +7 -0
  166. package/Popover/Popover.d.ts +10 -0
  167. package/Popover/Popover.js +10 -0
  168. package/Popover/styles.d.ts +1 -0
  169. package/Popover/styles.js +1 -0
  170. package/Popover/types.d.ts +9 -0
  171. package/ProgressBar/ProgressBar.d.ts +6 -0
  172. package/ProgressBar/ProgressBar.js +6 -0
  173. package/ProgressBar/types.d.ts +7 -0
  174. package/PushPreview/PushPreview.d.ts +7 -0
  175. package/PushPreview/PushPreview.js +7 -0
  176. package/PushPreview/types.d.ts +17 -0
  177. package/Radio/Radio.d.ts +7 -0
  178. package/Radio/Radio.js +7 -0
  179. package/Radio/types.d.ts +14 -0
  180. package/RadioCard/RadioCard.d.ts +7 -0
  181. package/RadioCard/RadioCard.js +7 -0
  182. package/RadioCard/types.d.ts +7 -0
  183. package/ReCaptcha/ReCaptcha.d.ts +8 -0
  184. package/ReCaptcha/ReCaptcha.js +8 -0
  185. package/ReCaptcha/helpers.d.ts +4 -0
  186. package/ReCaptcha/helpers.js +4 -0
  187. package/ReCaptcha/hooks.d.ts +4 -0
  188. package/ReCaptcha/hooks.js +4 -0
  189. package/ReCaptcha/types.d.ts +5 -0
  190. package/RichMessageEditor/RichMessageEditor.d.ts +8 -0
  191. package/RichMessageEditor/RichMessageEditor.js +8 -0
  192. package/RichMessageEditor/RichMessageEditor.types.d.ts +10 -0
  193. package/RichMessageEditor/RichMessageViewer.d.ts +10 -0
  194. package/RichMessageEditor/RichMessageViewer.js +7 -0
  195. package/RichMessageEditor/slate/types.d.ts +5 -0
  196. package/RichMessageEditor/types.d.ts +1 -0
  197. package/RichmediaPreview/RichmediaPreview.d.ts +7 -0
  198. package/RichmediaPreview/RichmediaPreview.js +7 -0
  199. package/RichmediaPreview/hooks.d.ts +4 -0
  200. package/RichmediaPreview/hooks.js +4 -0
  201. package/RichmediaPreview/types.d.ts +13 -0
  202. package/Select/Select.d.ts +22 -0
  203. package/Select/Select.js +22 -0
  204. package/Select/constants.d.ts +1 -0
  205. package/Select/constants.js +1 -0
  206. package/Select/types.d.ts +19 -0
  207. package/SendRate/SendRateEdit.d.ts +7 -0
  208. package/SendRate/SendRateEdit.js +7 -0
  209. package/SendRate/SendRateReadonly.d.ts +3 -0
  210. package/SendRate/SendRateReadonly.js +3 -0
  211. package/SendRate/types.d.ts +20 -0
  212. package/Skeleton/TextSkeleton.d.ts +6 -0
  213. package/Skeleton/TextSkeleton.js +6 -0
  214. package/Skeleton/styles.d.ts +2 -0
  215. package/Skeleton/styles.js +2 -0
  216. package/Skeleton/types.d.ts +11 -0
  217. package/SortButton/SortButton.d.ts +6 -0
  218. package/SortButton/SortButton.js +6 -0
  219. package/SortButton/types.d.ts +11 -0
  220. package/Spinner/Spinner.d.ts +6 -0
  221. package/Spinner/Spinner.js +6 -0
  222. package/Spinner/types.d.ts +4 -0
  223. package/StatisticCard/StatisticCard.d.ts +7 -0
  224. package/StatisticCard/StatisticCard.js +7 -0
  225. package/StatisticCard/types.d.ts +21 -0
  226. package/Switch/Switch.d.ts +6 -0
  227. package/Switch/Switch.js +6 -0
  228. package/Switch/types.d.ts +8 -0
  229. package/Tabs/components/Tab/Tab.d.ts +4 -0
  230. package/Tabs/components/Tab/Tab.js +4 -0
  231. package/Tabs/components/Tab/types.d.ts +6 -0
  232. package/Tabs/components/TabBar/TabBar.d.ts +3 -0
  233. package/Tabs/components/TabBar/TabBar.js +3 -0
  234. package/Tabs/components/TabBar/types.d.ts +2 -0
  235. package/Tabs/components/TabPanel/TabPanel.d.ts +4 -0
  236. package/Tabs/components/TabPanel/TabPanel.js +4 -0
  237. package/Tabs/components/TabPanel/types.d.ts +3 -0
  238. package/Tabs/components/Tabs/Tabs.d.ts +11 -0
  239. package/Tabs/components/Tabs/Tabs.js +11 -0
  240. package/Tabs/components/Tabs/types.d.ts +4 -0
  241. package/Tabs/types.d.ts +4 -0
  242. package/Toast/Toast.d.ts +5 -0
  243. package/Toast/Toast.js +5 -0
  244. package/Toast/ToastProvider.d.ts +7 -0
  245. package/Toast/ToastProvider.js +7 -0
  246. package/Toast/hooks.d.ts +8 -0
  247. package/Toast/hooks.js +8 -0
  248. package/Toast/types.d.ts +24 -0
  249. package/Tooltip/Tooltip.d.ts +7 -0
  250. package/Tooltip/Tooltip.js +7 -0
  251. package/Tooltip/TooltipTrigger.d.ts +13 -0
  252. package/Tooltip/TooltipTrigger.js +7 -0
  253. package/Tooltip/types.d.ts +12 -0
  254. package/hooks/useElementWidth.d.ts +4 -3
  255. package/hooks/useElementWidth.js +4 -3
  256. package/hooks/useLayer.d.ts +7 -0
  257. package/hooks/useLayer.js +7 -0
  258. package/hooks/useOnClickOutside.d.ts +7 -0
  259. package/hooks/useOnClickOutside.js +7 -0
  260. package/native/Input.d.ts +3 -0
  261. package/native/Input.js +1 -0
  262. package/native/NativeTimeInput.d.ts +1 -0
  263. package/native/NativeTimeInput.js +1 -0
  264. package/native/Select.d.ts +1 -0
  265. package/native/Select.js +1 -0
  266. package/native/Textarea.d.ts +1 -0
  267. package/native/Textarea.js +1 -0
  268. package/package.json +2 -3
  269. package/polyglot/react.d.ts +19 -0
  270. package/polyglot/react.js +19 -0
  271. package/polyglot/types.d.ts +4 -0
  272. package/shared/dropdownField/FieldInput.d.ts +1 -0
  273. package/shared/dropdownField/FieldInput.js +1 -0
  274. package/shared/dropdownField/FieldShell.d.ts +4 -0
  275. package/shared/dropdownField/FieldShell.js +4 -0
  276. package/shared/dropdownField/SuggestionsDropdown.d.ts +4 -0
  277. package/shared/dropdownField/SuggestionsDropdown.js +4 -0
  278. package/shared/dropdownField/constants.d.ts +1 -0
  279. package/shared/dropdownField/constants.js +1 -0
  280. package/shared/dropdownField/shared.d.ts +7 -0
  281. package/shared/dropdownField/shared.js +7 -0
  282. package/shared/dropdownField/types.d.ts +7 -0
  283. package/shared/dropdownField/useActiveIndex.d.ts +4 -0
  284. package/shared/dropdownField/useActiveIndex.js +4 -0
  285. package/shared/dropdownField/useAsyncItems.d.ts +4 -0
  286. package/shared/dropdownField/useAsyncItems.js +4 -0
  287. package/shared/dropdownField/useDebouncedValue.d.ts +1 -0
  288. package/shared/dropdownField/useDebouncedValue.js +1 -0
  289. package/shared/dropdownField/useDropdownItems.d.ts +4 -0
  290. package/shared/dropdownField/useDropdownItems.js +4 -0
  291. package/shared/dropdownField/useDropdownPosition.d.ts +4 -0
  292. package/shared/dropdownField/useDropdownPosition.js +4 -0
  293. package/shared/dropdownField/useFieldOpenEffects.d.ts +4 -0
  294. package/shared/dropdownField/useFieldOpenEffects.js +4 -0
  295. package/shared/dropdownField/useListNavigation.d.ts +5 -0
  296. package/shared/dropdownField/useListNavigation.js +5 -0
  297. package/Alert/ai-documentation.md +0 -132
  298. package/Badge/ai-documentation.md +0 -155
  299. package/Banner/ai-documentation.md +0 -285
  300. package/Button/ai-documentation.md +0 -247
  301. package/CardMetric/ai-documentation.md +0 -277
  302. package/Checkbox/ai-documentation.md +0 -231
  303. package/Chip/ai-documentation.md +0 -281
  304. package/CodeEditor/ai-documentation.md +0 -350
  305. package/DateTimePicker/ai-documentation.md +0 -400
  306. package/Drawer/ai-documentation.md +0 -417
  307. package/EnhancedInput/ai-documentation.md +0 -352
  308. package/InputFile/ai-documentation.md +0 -420
  309. package/Modal/ai-documentation.md +0 -285
  310. package/PageHeader/ai-documentation.md +0 -511
  311. package/Pagination/ai-documentation.md +0 -509
  312. package/Popover/ai-documentation.md +0 -625
  313. package/ProgressBar/ai-documentation.md +0 -533
  314. package/Radio/ai-documentation.md +0 -243
  315. package/Select/ai-documentation.md +0 -374
  316. package/Skeleton/ai-documentation.md +0 -574
  317. package/Spinner/ai-documentation.md +0 -607
  318. package/Switch/ai-documentation.md +0 -312
  319. package/Tabs/ai-documentation.md +0 -475
  320. package/Toast/ai-documentation.md +0 -220
  321. package/Tooltip/ai-documentation.md +0 -340
  322. package/ai-documentation.md +0 -124
  323. package/native/ai-documentation.md +0 -485
@@ -1,574 +0,0 @@
1
- # Skeleton Components - @pushwoosh/dumb-components
2
-
3
- ## Overview
4
-
5
- - **Component Name**: Skeleton (System)
6
- - **Import Path**: `@pushwoosh/dumb-components`
7
- - **Files**:
8
- - `/src/Skeleton/TextSkeleton.tsx` - Text placeholder component
9
- - `/src/Skeleton/styles.ts` - Styled skeleton components (RectangularSkeleton, CircularSkeleton)
10
- - `/src/Skeleton/types.ts` - TypeScript type definitions
11
- - `/src/Skeleton/index.ts` - Component exports
12
- - **Type**: Loading/Placeholder
13
- - **Description**: A collection of skeleton loading components that provide placeholder UI while content is loading. Includes rectangular, circular, and text skeletons with pulsing animations and customizable styling.
14
-
15
- ## TypeScript Interfaces
16
-
17
- ```typescript
18
- export type SkeletonBorderRadiusProps = {
19
- borderRadius?: number | string;
20
- };
21
-
22
- export type SkeletonCommonProps = {
23
- color?: string;
24
- };
25
-
26
- export type RectangularSkeletonProps = SkeletonCommonProps & SkeletonBorderRadiusProps & {
27
- width: number | string;
28
- height: number | string;
29
- };
30
-
31
- export type CircularSkeletonProps = SkeletonCommonProps & {
32
- diameter: number | string;
33
- };
34
-
35
- export type TextSkeletonProps = SkeletonCommonProps & SkeletonBorderRadiusProps & {
36
- width?: number | string;
37
- };
38
- ```
39
-
40
- ## Import & Usage
41
-
42
- ```typescript
43
- import { TextSkeleton, RectangularSkeleton, CircularSkeleton } from '@pushwoosh/dumb-components';
44
-
45
- // Basic text skeleton
46
- function BasicTextSkeleton() {
47
- return (
48
- <div>
49
- <TextSkeleton width="200px" />
50
- <TextSkeleton width="150px" />
51
- <TextSkeleton width="180px" />
52
- </div>
53
- );
54
- }
55
-
56
- // Profile card skeleton
57
- function ProfileCardSkeleton() {
58
- return (
59
- <div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
60
- <CircularSkeleton diameter="60px" />
61
- <div>
62
- <TextSkeleton width="120px" />
63
- <TextSkeleton width="80px" />
64
- </div>
65
- </div>
66
- );
67
- }
68
-
69
- // Image placeholder
70
- function ImageSkeleton() {
71
- return (
72
- <RectangularSkeleton
73
- width="300px"
74
- height="200px"
75
- borderRadius="8px"
76
- />
77
- );
78
- }
79
- ```
80
-
81
- ## Advanced Examples
82
-
83
- ```typescript
84
- // Article list skeleton
85
- function ArticleListSkeleton() {
86
- const skeletonItems = Array.from({ length: 5 }, (_, index) => (
87
- <div
88
- key={index}
89
- style={{
90
- display: 'flex',
91
- gap: '16px',
92
- padding: '16px',
93
- borderBottom: '1px solid #eee'
94
- }}
95
- >
96
- {/* Article image */}
97
- <RectangularSkeleton
98
- width="120px"
99
- height="80px"
100
- borderRadius="4px"
101
- />
102
-
103
- {/* Article content */}
104
- <div style={{ flex: 1 }}>
105
- <TextSkeleton width="80%" />
106
- <div style={{ margin: '8px 0' }}>
107
- <TextSkeleton width="100%" />
108
- <TextSkeleton width="60%" />
109
- </div>
110
- <div style={{ display: 'flex', gap: '12px' }}>
111
- <TextSkeleton width="80px" />
112
- <TextSkeleton width="60px" />
113
- <TextSkeleton width="100px" />
114
- </div>
115
- </div>
116
- </div>
117
- ));
118
-
119
- return <div>{skeletonItems}</div>;
120
- }
121
-
122
- // Data table skeleton
123
- function TableSkeleton() {
124
- const rows = 8;
125
- const columns = ['Name', 'Email', 'Role', 'Status', 'Actions'];
126
-
127
- return (
128
- <table style={{ width: '100%', borderCollapse: 'collapse' }}>
129
- <thead>
130
- <tr>
131
- {columns.map((column, index) => (
132
- <th
133
- key={index}
134
- style={{
135
- padding: '12px',
136
- textAlign: 'left',
137
- borderBottom: '1px solid #eee'
138
- }}
139
- >
140
- {column}
141
- </th>
142
- ))}
143
- </tr>
144
- </thead>
145
- <tbody>
146
- {Array.from({ length: rows }, (_, rowIndex) => (
147
- <tr key={rowIndex}>
148
- {columns.map((_, colIndex) => (
149
- <td
150
- key={colIndex}
151
- style={{
152
- padding: '12px',
153
- borderBottom: '1px solid #f5f5f5'
154
- }}
155
- >
156
- <TextSkeleton width={
157
- colIndex === 0 ? '120px' :
158
- colIndex === 1 ? '180px' :
159
- colIndex === 2 ? '80px' :
160
- colIndex === 3 ? '60px' : '40px'
161
- } />
162
- </td>
163
- ))}
164
- </tr>
165
- ))}
166
- </tbody>
167
- </table>
168
- );
169
- }
170
-
171
- // Card grid skeleton
172
- function CardGridSkeleton() {
173
- const skeletonCards = Array.from({ length: 12 }, (_, index) => (
174
- <div
175
- key={index}
176
- style={{
177
- border: '1px solid #eee',
178
- borderRadius: '8px',
179
- padding: '16px',
180
- display: 'flex',
181
- flexDirection: 'column',
182
- gap: '12px'
183
- }}
184
- >
185
- <RectangularSkeleton
186
- width="100%"
187
- height="160px"
188
- borderRadius="4px"
189
- />
190
- <TextSkeleton width="80%" />
191
- <TextSkeleton width="100%" />
192
- <TextSkeleton width="60%" />
193
-
194
- <div style={{
195
- display: 'flex',
196
- justifyContent: 'space-between',
197
- alignItems: 'center',
198
- marginTop: '8px'
199
- }}>
200
- <TextSkeleton width="50px" />
201
- <RectangularSkeleton
202
- width="80px"
203
- height="32px"
204
- borderRadius="4px"
205
- />
206
- </div>
207
- </div>
208
- ));
209
-
210
- return (
211
- <div style={{
212
- display: 'grid',
213
- gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))',
214
- gap: '20px'
215
- }}>
216
- {skeletonCards}
217
- </div>
218
- );
219
- }
220
-
221
- // Dashboard skeleton
222
- function DashboardSkeleton() {
223
- return (
224
- <div style={{ padding: '20px' }}>
225
- {/* Header */}
226
- <div style={{ marginBottom: '30px' }}>
227
- <TextSkeleton width="200px" />
228
- <div style={{ marginTop: '8px' }}>
229
- <TextSkeleton width="300px" />
230
- </div>
231
- </div>
232
-
233
- {/* Stats cards */}
234
- <div style={{
235
- display: 'grid',
236
- gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
237
- gap: '20px',
238
- marginBottom: '30px'
239
- }}>
240
- {Array.from({ length: 4 }, (_, index) => (
241
- <div
242
- key={index}
243
- style={{
244
- padding: '20px',
245
- border: '1px solid #eee',
246
- borderRadius: '8px'
247
- }}
248
- >
249
- <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
250
- <TextSkeleton width="80px" />
251
- <CircularSkeleton diameter="40px" />
252
- </div>
253
- <div style={{ marginTop: '16px' }}>
254
- <TextSkeleton width="60px" />
255
- </div>
256
- </div>
257
- ))}
258
- </div>
259
-
260
- {/* Chart area */}
261
- <div style={{
262
- display: 'grid',
263
- gridTemplateColumns: '2fr 1fr',
264
- gap: '20px',
265
- marginBottom: '30px'
266
- }}>
267
- <div style={{
268
- padding: '20px',
269
- border: '1px solid #eee',
270
- borderRadius: '8px'
271
- }}>
272
- <TextSkeleton width="150px" />
273
- <div style={{ marginTop: '16px' }}>
274
- <RectangularSkeleton
275
- width="100%"
276
- height="300px"
277
- borderRadius="4px"
278
- />
279
- </div>
280
- </div>
281
-
282
- <div style={{
283
- padding: '20px',
284
- border: '1px solid #eee',
285
- borderRadius: '8px'
286
- }}>
287
- <TextSkeleton width="120px" />
288
- <div style={{ marginTop: '16px', display: 'flex', flexDirection: 'column', gap: '12px' }}>
289
- {Array.from({ length: 6 }, (_, index) => (
290
- <div key={index} style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
291
- <CircularSkeleton diameter="24px" />
292
- <TextSkeleton width="80px" />
293
- <TextSkeleton width="40px" />
294
- </div>
295
- ))}
296
- </div>
297
- </div>
298
- </div>
299
- </div>
300
- );
301
- }
302
-
303
- // Message list skeleton
304
- function MessageListSkeleton() {
305
- return (
306
- <div style={{ maxWidth: '600px' }}>
307
- {Array.from({ length: 8 }, (_, index) => (
308
- <div
309
- key={index}
310
- style={{
311
- display: 'flex',
312
- gap: '12px',
313
- padding: '16px',
314
- borderBottom: '1px solid #f0f0f0'
315
- }}
316
- >
317
- <CircularSkeleton diameter="48px" />
318
- <div style={{ flex: 1 }}>
319
- <div style={{ display: 'flex', gap: '8px', alignItems: 'center', marginBottom: '4px' }}>
320
- <TextSkeleton width="100px" />
321
- <TextSkeleton width="60px" />
322
- </div>
323
- <TextSkeleton width="100%" />
324
- <TextSkeleton width="80%" />
325
- <div style={{ marginTop: '8px', display: 'flex', gap: '8px' }}>
326
- <TextSkeleton width="40px" />
327
- <TextSkeleton width="50px" />
328
- </div>
329
- </div>
330
- </div>
331
- ))}
332
- </div>
333
- );
334
- }
335
-
336
- // Custom styled skeleton
337
- function CustomStyledSkeleton() {
338
- return (
339
- <div>
340
- <h3>Custom Colors</h3>
341
- <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
342
- <TextSkeleton width="200px" color="#e3f2fd" />
343
- <TextSkeleton width="180px" color="#f3e5f5" />
344
- <TextSkeleton width="220px" color="#e8f5e8" />
345
- </div>
346
-
347
- <h3>Custom Border Radius</h3>
348
- <div style={{ display: 'flex', gap: '16px' }}>
349
- <RectangularSkeleton
350
- width="100px"
351
- height="100px"
352
- borderRadius="0"
353
- color="#ffebee"
354
- />
355
- <RectangularSkeleton
356
- width="100px"
357
- height="100px"
358
- borderRadius="12px"
359
- color="#f1f8e9"
360
- />
361
- <RectangularSkeleton
362
- width="100px"
363
- height="100px"
364
- borderRadius="50%"
365
- color="#e8eaf6"
366
- />
367
- </div>
368
- </div>
369
- );
370
- }
371
-
372
- // Conditional skeleton loading
373
- function ConditionalSkeletonExample() {
374
- const [loading, setLoading] = useState(true);
375
- const [data, setData] = useState(null);
376
-
377
- useEffect(() => {
378
- const timer = setTimeout(() => {
379
- setData({
380
- title: "Sample Article Title",
381
- content: "This is the actual content that was loaded from the server.",
382
- author: "John Doe",
383
- date: "2024-01-15"
384
- });
385
- setLoading(false);
386
- }, 3000);
387
-
388
- return () => clearTimeout(timer);
389
- }, []);
390
-
391
- const toggleLoading = () => {
392
- setLoading(true);
393
- setData(null);
394
-
395
- setTimeout(() => {
396
- setData({
397
- title: "New Article Title",
398
- content: "Updated content after reload.",
399
- author: "Jane Smith",
400
- date: "2024-01-16"
401
- });
402
- setLoading(false);
403
- }, 2000);
404
- };
405
-
406
- return (
407
- <div style={{ maxWidth: '600px' }}>
408
- <button
409
- onClick={toggleLoading}
410
- disabled={loading}
411
- style={{ marginBottom: '20px' }}
412
- >
413
- Reload Content
414
- </button>
415
-
416
- <article style={{
417
- padding: '20px',
418
- border: '1px solid #eee',
419
- borderRadius: '8px'
420
- }}>
421
- {loading ? (
422
- <>
423
- <TextSkeleton width="70%" />
424
- <div style={{ margin: '16px 0' }}>
425
- <TextSkeleton width="100%" />
426
- <TextSkeleton width="100%" />
427
- <TextSkeleton width="80%" />
428
- </div>
429
- <div style={{ display: 'flex', gap: '16px' }}>
430
- <TextSkeleton width="100px" />
431
- <TextSkeleton width="80px" />
432
- </div>
433
- </>
434
- ) : (
435
- <>
436
- <h2>{data?.title}</h2>
437
- <p>{data?.content}</p>
438
- <div style={{ display: 'flex', gap: '16px', color: '#666', fontSize: '14px' }}>
439
- <span>By {data?.author}</span>
440
- <span>{data?.date}</span>
441
- </div>
442
- </>
443
- )}
444
- </article>
445
- </div>
446
- );
447
- }
448
- ```
449
-
450
- ## Props Reference
451
-
452
- ### TextSkeleton
453
-
454
- | Prop | Type | Default | Required | Description |
455
- |------|------|---------|----------|-------------|
456
- | `width` | `number \| string` | `undefined` | No | Width of the skeleton text |
457
- | `color` | `string` | `'#ddd'` | No | Background color of the skeleton |
458
- | `borderRadius` | `number \| string` | `'4px'` | No | Border radius of the skeleton |
459
- | `children` | `ReactNode` | `'-'` | No | Fallback content (usually not needed) |
460
-
461
- ### RectangularSkeleton
462
-
463
- | Prop | Type | Default | Required | Description |
464
- |------|------|---------|----------|-------------|
465
- | `width` | `number \| string` | - | Yes | Width of the skeleton |
466
- | `height` | `number \| string` | - | Yes | Height of the skeleton |
467
- | `color` | `string` | `'#ddd'` | No | Background color of the skeleton |
468
- | `borderRadius` | `number \| string` | `'initial'` | No | Border radius of the skeleton |
469
-
470
- ### CircularSkeleton
471
-
472
- | Prop | Type | Default | Required | Description |
473
- |------|------|---------|----------|-------------|
474
- | `diameter` | `number \| string` | - | Yes | Diameter of the circular skeleton |
475
- | `color` | `string` | `'#ddd'` | No | Background color of the skeleton |
476
-
477
- ## AI Agent Guidelines
478
-
479
- ### Recommended Patterns
480
-
481
- 1. **Match Content Structure**: Skeleton should mirror actual content layout
482
- ```typescript
483
- // Good - matches actual structure
484
- {loading ? (
485
- <div>
486
- <TextSkeleton width="200px" /> {/* Title */}
487
- <TextSkeleton width="100%" /> {/* Paragraph 1 */}
488
- <TextSkeleton width="80%" /> {/* Paragraph 2 */}
489
- </div>
490
- ) : (
491
- <div>
492
- <h2>{data.title}</h2>
493
- <p>{data.paragraph1}</p>
494
- <p>{data.paragraph2}</p>
495
- </div>
496
- )}
497
- ```
498
-
499
- 2. **Use Appropriate Types**: Choose the right skeleton for content type
500
- ```typescript
501
- // Avatars/profile images
502
- <CircularSkeleton diameter="48px" />
503
-
504
- // Images/cards
505
- <RectangularSkeleton width="300px" height="200px" borderRadius="8px" />
506
-
507
- // Text content
508
- <TextSkeleton width="80%" />
509
- ```
510
-
511
- 3. **Consistent Spacing**: Maintain consistent gaps and padding
512
- ```typescript
513
- <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
514
- <TextSkeleton width="70%" />
515
- <TextSkeleton width="100%" />
516
- <TextSkeleton width="60%" />
517
- </div>
518
- ```
519
-
520
- ### Common Mistakes to Avoid
521
-
522
- 1. **Mismatched Layout**: Don't create skeletons that don't match the actual content
523
- 2. **Too Generic**: Avoid using the same skeleton pattern for different content types
524
- 3. **Poor Performance**: Don't render too many skeleton elements unnecessarily
525
- 4. **Missing Animation**: The pulse animation is built-in, don't try to override it
526
- 5. **Wrong Dimensions**: Ensure skeleton dimensions match actual content dimensions
527
-
528
- ### Integration Tips
529
-
530
- 1. **Loading States**: Use with async data loading
531
- ```typescript
532
- const [loading, setLoading] = useState(true);
533
- const [data, setData] = useState(null);
534
-
535
- useEffect(() => {
536
- fetchData().then(result => {
537
- setData(result);
538
- setLoading(false);
539
- });
540
- }, []);
541
-
542
- return loading ? <ArticleSkeleton /> : <Article data={data} />;
543
- ```
544
-
545
- 2. **Reusable Components**: Create skeleton components for common patterns
546
- ```typescript
547
- const ProfileSkeleton = () => (
548
- <div style={{ display: 'flex', gap: '16px' }}>
549
- <CircularSkeleton diameter="60px" />
550
- <div>
551
- <TextSkeleton width="120px" />
552
- <TextSkeleton width="80px" />
553
- </div>
554
- </div>
555
- );
556
- ```
557
-
558
- 3. **Responsive Design**: Use percentage widths for responsive skeletons
559
- ```typescript
560
- <TextSkeleton width="100%" /> // Full width
561
- <TextSkeleton width="75%" /> // 3/4 width
562
- <TextSkeleton width="50%" /> // Half width
563
- ```
564
-
565
- 4. **Progressive Loading**: Show skeletons while data loads progressively
566
- 5. **Error States**: Consider skeleton alternatives for error states
567
-
568
- ## Related Components
569
-
570
- - **Spinner**: Alternative loading indicator
571
- - **ProgressBar**: For progress-based loading
572
- - **Card**: Often used with skeleton versions
573
- - **Avatar**: Often has circular skeleton equivalents
574
- - **Table**: Often needs table-specific skeleton patterns