@bspk/ui 1.3.8 → 1.3.9

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 (364) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +19 -3
  2. package/dist/components/Accordion/Accordion.js +20 -3
  3. package/dist/components/Accordion/Accordion.js.map +1 -1
  4. package/dist/components/Avatar/Avatar.d.ts +13 -14
  5. package/dist/components/Avatar/Avatar.js +13 -14
  6. package/dist/components/Avatar/Avatar.js.map +1 -1
  7. package/dist/components/AvatarGroup/AvatarGroup.d.ts +29 -12
  8. package/dist/components/AvatarGroup/AvatarGroup.js +29 -12
  9. package/dist/components/AvatarGroup/AvatarGroup.js.map +1 -1
  10. package/dist/components/Badge/Badge.d.ts +1 -3
  11. package/dist/components/Badge/Badge.js +1 -3
  12. package/dist/components/Badge/Badge.js.map +1 -1
  13. package/dist/components/BadgeDot/BadgeDot.d.ts +4 -4
  14. package/dist/components/BadgeDot/BadgeDot.js +5 -4
  15. package/dist/components/BadgeDot/BadgeDot.js.map +1 -1
  16. package/dist/components/BannerAlert/BannerAlert.d.ts +11 -12
  17. package/dist/components/BannerAlert/BannerAlert.js +11 -12
  18. package/dist/components/BannerAlert/BannerAlert.js.map +1 -1
  19. package/dist/components/BottomNavigation/BottomNavigation.d.ts +6 -3
  20. package/dist/components/BottomNavigation/BottomNavigation.js +6 -3
  21. package/dist/components/BottomNavigation/BottomNavigation.js.map +1 -1
  22. package/dist/components/BottomNavigation/BottomNavigationExample.js +31 -36
  23. package/dist/components/BottomNavigation/BottomNavigationExample.js.map +1 -1
  24. package/dist/components/BottomNavigation/bottom-navigation.css +8 -1
  25. package/dist/components/BottomNavigation/bottom-navigation.css.js +8 -1
  26. package/dist/components/Breadcrumb/Breadcrumb.d.ts +17 -18
  27. package/dist/components/Breadcrumb/Breadcrumb.js +17 -18
  28. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  29. package/dist/components/Button/Button.d.ts +1 -11
  30. package/dist/components/Button/Button.js +1 -11
  31. package/dist/components/Button/Button.js.map +1 -1
  32. package/dist/components/Button/ButtonExample.js +1 -3
  33. package/dist/components/Button/ButtonExample.js.map +1 -1
  34. package/dist/components/ButtonDock/ButtonDock.d.ts +10 -14
  35. package/dist/components/ButtonDock/ButtonDock.js +10 -14
  36. package/dist/components/ButtonDock/ButtonDock.js.map +1 -1
  37. package/dist/components/Card/Card.d.ts +8 -10
  38. package/dist/components/Card/Card.js +6 -10
  39. package/dist/components/Card/Card.js.map +1 -1
  40. package/dist/components/Carousel/Carousel.d.ts +9 -13
  41. package/dist/components/Carousel/Carousel.js +9 -13
  42. package/dist/components/Carousel/Carousel.js.map +1 -1
  43. package/dist/components/Carousel/CarouselExample.js +14 -14
  44. package/dist/components/Carousel/CarouselExample.js.map +1 -1
  45. package/dist/components/Checkbox/Checkbox.d.ts +7 -4
  46. package/dist/components/Checkbox/Checkbox.js +7 -4
  47. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  48. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +3 -3
  49. package/dist/components/CheckboxGroup/CheckboxGroup.js +3 -3
  50. package/dist/components/CheckboxOption/CheckboxOption.d.ts +4 -4
  51. package/dist/components/CheckboxOption/CheckboxOption.js +4 -4
  52. package/dist/components/Chip/Chip.d.ts +3 -7
  53. package/dist/components/Chip/Chip.js +3 -7
  54. package/dist/components/Chip/Chip.js.map +1 -1
  55. package/dist/components/Chip/ChipExample.js +50 -3
  56. package/dist/components/Chip/ChipExample.js.map +1 -1
  57. package/dist/components/ChipGroup/ChipGroup.d.ts +21 -10
  58. package/dist/components/ChipGroup/ChipGroup.js +21 -10
  59. package/dist/components/ChipGroup/ChipGroup.js.map +1 -1
  60. package/dist/components/ChipGroup/ChipGroupExample.js +1 -0
  61. package/dist/components/ChipGroup/ChipGroupExample.js.map +1 -1
  62. package/dist/components/DatePicker/DatePicker.d.ts +13 -12
  63. package/dist/components/DatePicker/DatePicker.js +13 -12
  64. package/dist/components/DatePicker/DatePicker.js.map +1 -1
  65. package/dist/components/Dialog/Dialog.d.ts +11 -6
  66. package/dist/components/Dialog/Dialog.js +11 -6
  67. package/dist/components/Dialog/Dialog.js.map +1 -1
  68. package/dist/components/Divider/Divider.d.ts +5 -9
  69. package/dist/components/Divider/Divider.js +5 -9
  70. package/dist/components/Divider/Divider.js.map +1 -1
  71. package/dist/components/Divider/DividerExample.js +16 -1
  72. package/dist/components/Divider/DividerExample.js.map +1 -1
  73. package/dist/components/Drawer/Drawer.d.ts +3 -3
  74. package/dist/components/Drawer/Drawer.js +3 -3
  75. package/dist/components/EmptyState/EmptyState.d.ts +3 -7
  76. package/dist/components/EmptyState/EmptyState.js +3 -7
  77. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  78. package/dist/components/Fab/Fab.d.ts +4 -5
  79. package/dist/components/Fab/Fab.js +4 -6
  80. package/dist/components/Fab/Fab.js.map +1 -1
  81. package/dist/components/Fab/FabExample.d.ts +2 -1
  82. package/dist/components/Fab/FabExample.js +20 -2
  83. package/dist/components/Fab/FabExample.js.map +1 -1
  84. package/dist/components/Field/Field.d.ts +4 -5
  85. package/dist/components/Field/Field.js +4 -5
  86. package/dist/components/Field/Field.js.map +1 -1
  87. package/dist/components/FileUpload/FileUpload.d.ts +3 -3
  88. package/dist/components/FileUpload/FileUpload.js +3 -3
  89. package/dist/components/FileUploadItem/FileUploadItem.d.ts +6 -10
  90. package/dist/components/FileUploadItem/FileUploadItem.js +6 -10
  91. package/dist/components/FileUploadItem/FileUploadItem.js.map +1 -1
  92. package/dist/components/FormField/FormField.d.ts +5 -16
  93. package/dist/components/FormField/FormField.js +5 -16
  94. package/dist/components/FormField/FormField.js.map +1 -1
  95. package/dist/components/Img/Img.d.ts +1 -3
  96. package/dist/components/Img/Img.js +1 -3
  97. package/dist/components/Img/Img.js.map +1 -1
  98. package/dist/components/InlineAlert/InlineAlert.d.ts +1 -3
  99. package/dist/components/InlineAlert/InlineAlert.js +1 -3
  100. package/dist/components/InlineAlert/InlineAlert.js.map +1 -1
  101. package/dist/components/Input/Input.d.ts +13 -13
  102. package/dist/components/Input/Input.js +13 -13
  103. package/dist/components/Input/InputElement.d.ts +11 -5
  104. package/dist/components/Input/InputElement.js +11 -5
  105. package/dist/components/Input/InputElement.js.map +1 -1
  106. package/dist/components/InputNumber/InputNumber.d.ts +20 -20
  107. package/dist/components/InputNumber/InputNumber.js +20 -20
  108. package/dist/components/InputPhone/InputPhone.d.ts +21 -16
  109. package/dist/components/InputPhone/InputPhone.js +21 -16
  110. package/dist/components/InputPhone/InputPhone.js.map +1 -1
  111. package/dist/components/Layout/Layout.d.ts +1 -3
  112. package/dist/components/Layout/Layout.js +1 -3
  113. package/dist/components/Layout/Layout.js.map +1 -1
  114. package/dist/components/Link/Link.d.ts +1 -3
  115. package/dist/components/Link/Link.js +1 -3
  116. package/dist/components/Link/Link.js.map +1 -1
  117. package/dist/components/ListItem/ListItem.d.ts +22 -21
  118. package/dist/components/ListItem/ListItem.js +19 -16
  119. package/dist/components/ListItem/ListItem.js.map +1 -1
  120. package/dist/components/Menu/Menu.d.ts +5 -9
  121. package/dist/components/Menu/Menu.js +5 -9
  122. package/dist/components/Menu/Menu.js.map +1 -1
  123. package/dist/components/Modal/Modal.d.ts +4 -4
  124. package/dist/components/Modal/Modal.js +4 -4
  125. package/dist/components/Modal/Modal.js.map +1 -1
  126. package/dist/components/Modal/modal.css +12 -1
  127. package/dist/components/Modal/modal.css.js +12 -1
  128. package/dist/components/OTPInput/OTPInput.d.ts +1 -3
  129. package/dist/components/OTPInput/OTPInput.js +1 -3
  130. package/dist/components/OTPInput/OTPInput.js.map +1 -1
  131. package/dist/components/PageControl/PageControl.d.ts +1 -3
  132. package/dist/components/PageControl/PageControl.js +1 -3
  133. package/dist/components/PageControl/PageControl.js.map +1 -1
  134. package/dist/components/Pagination/Pagination.d.ts +6 -7
  135. package/dist/components/Pagination/Pagination.js +28 -15
  136. package/dist/components/Pagination/Pagination.js.map +1 -1
  137. package/dist/components/Pagination/pagination.css +5 -14
  138. package/dist/components/Pagination/pagination.css.js +5 -14
  139. package/dist/components/Password/Password.d.ts +19 -20
  140. package/dist/components/Password/Password.js +19 -20
  141. package/dist/components/Password/Password.js.map +1 -1
  142. package/dist/components/Popover/Popover.d.ts +11 -20
  143. package/dist/components/Popover/Popover.js +11 -20
  144. package/dist/components/Popover/Popover.js.map +1 -1
  145. package/dist/components/Popover/PopoverExample.js +1 -1
  146. package/dist/components/Popover/PopoverExample.js.map +1 -1
  147. package/dist/components/ProgressBar/ProgressBar.d.ts +1 -3
  148. package/dist/components/ProgressBar/ProgressBar.js +1 -3
  149. package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
  150. package/dist/components/ProgressCircle/ProgressCircle.d.ts +1 -3
  151. package/dist/components/ProgressCircle/ProgressCircle.js +1 -3
  152. package/dist/components/ProgressCircle/ProgressCircle.js.map +1 -1
  153. package/dist/components/ProgressionStepper/ProgressionStepper.d.ts +1 -3
  154. package/dist/components/ProgressionStepper/ProgressionStepper.js +1 -3
  155. package/dist/components/ProgressionStepper/ProgressionStepper.js.map +1 -1
  156. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  157. package/dist/components/RadioGroup/RadioGroup.js +2 -2
  158. package/dist/components/Rating/Rating.d.ts +2 -4
  159. package/dist/components/Rating/Rating.js +8 -6
  160. package/dist/components/Rating/Rating.js.map +1 -1
  161. package/dist/components/Rating/RatingExample.js +17 -1
  162. package/dist/components/Rating/RatingExample.js.map +1 -1
  163. package/dist/components/SearchBar/SearchBar.d.ts +2 -2
  164. package/dist/components/SearchBar/SearchBar.js +2 -2
  165. package/dist/components/SegmentedControl/SegmentedControl.d.ts +3 -3
  166. package/dist/components/SegmentedControl/SegmentedControl.js +3 -3
  167. package/dist/components/SegmentedControl/SegmentedControlExample.js +10 -12
  168. package/dist/components/SegmentedControl/SegmentedControlExample.js.map +1 -1
  169. package/dist/components/Select/Select.d.ts +24 -25
  170. package/dist/components/Select/Select.js +24 -25
  171. package/dist/components/Select/Select.js.map +1 -1
  172. package/dist/components/Skeleton/Skeleton.d.ts +10 -14
  173. package/dist/components/Skeleton/Skeleton.js +10 -14
  174. package/dist/components/Skeleton/Skeleton.js.map +1 -1
  175. package/dist/components/Skeleton/SkeletonExample.js +4 -3
  176. package/dist/components/Skeleton/SkeletonExample.js.map +1 -1
  177. package/dist/components/SkeletonText/SkeletonText.d.ts +5 -9
  178. package/dist/components/SkeletonText/SkeletonText.js +5 -9
  179. package/dist/components/SkeletonText/SkeletonText.js.map +1 -1
  180. package/dist/components/Slider/Slider.d.ts +2 -2
  181. package/dist/components/Slider/Slider.js +2 -2
  182. package/dist/components/Slider/SliderExample.js +40 -18
  183. package/dist/components/Slider/SliderExample.js.map +1 -1
  184. package/dist/components/Snackbar/Manager.d.ts +29 -0
  185. package/dist/components/Snackbar/Manager.js +35 -0
  186. package/dist/components/Snackbar/Manager.js.map +1 -0
  187. package/dist/components/Snackbar/Snackbar.d.ts +23 -5
  188. package/dist/components/Snackbar/Snackbar.js +23 -4
  189. package/dist/components/Snackbar/Snackbar.js.map +1 -1
  190. package/dist/components/Snackbar/SnackbarExample.js +8 -1
  191. package/dist/components/Snackbar/SnackbarExample.js.map +1 -1
  192. package/dist/components/Snackbar/index.d.ts +1 -0
  193. package/dist/components/Snackbar/index.js +1 -0
  194. package/dist/components/Snackbar/index.js.map +1 -1
  195. package/dist/components/StylesProviderDemo/StylesProviderDemo.d.ts +1 -3
  196. package/dist/components/StylesProviderDemo/StylesProviderDemo.js +1 -3
  197. package/dist/components/StylesProviderDemo/StylesProviderDemo.js.map +1 -1
  198. package/dist/components/Switch/Switch.d.ts +2 -2
  199. package/dist/components/Switch/Switch.js +2 -2
  200. package/dist/components/TabGroup/TabGroup.d.ts +2 -2
  201. package/dist/components/TabGroup/TabGroup.js +2 -2
  202. package/dist/components/TabGroup/TabGroupExample.js +5 -11
  203. package/dist/components/TabGroup/TabGroupExample.js.map +1 -1
  204. package/dist/components/TabGroup/tab-group.css +1 -0
  205. package/dist/components/TabGroup/tab-group.css.js +1 -0
  206. package/dist/components/TabList/TabList.d.ts +2 -2
  207. package/dist/components/TabList/TabList.js +2 -2
  208. package/dist/components/TabList/tab-list.css +0 -1
  209. package/dist/components/TabList/tab-list.css.js +0 -1
  210. package/dist/components/Table/Table.d.ts +53 -16
  211. package/dist/components/Table/Table.js +53 -16
  212. package/dist/components/Table/Table.js.map +1 -1
  213. package/dist/components/Table/table.css +0 -1
  214. package/dist/components/Table/table.css.js +0 -1
  215. package/dist/components/Tag/Tag.d.ts +1 -3
  216. package/dist/components/Tag/Tag.js +1 -3
  217. package/dist/components/Tag/Tag.js.map +1 -1
  218. package/dist/components/Textarea/Textarea.d.ts +13 -13
  219. package/dist/components/Textarea/Textarea.js +13 -13
  220. package/dist/components/TimePicker/TimePicker.d.ts +14 -14
  221. package/dist/components/TimePicker/TimePicker.js +14 -14
  222. package/dist/components/ToggleOption/ToggleOption.js +1 -1
  223. package/dist/components/ToggleOption/ToggleOption.js.map +1 -1
  224. package/dist/components/ToggleOption/toggle-option.css +2 -49
  225. package/dist/components/ToggleOption/toggle-option.css.js +2 -49
  226. package/dist/components/Tooltip/Tooltip.d.ts +3 -7
  227. package/dist/components/Tooltip/Tooltip.js +3 -7
  228. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  229. package/dist/components/Tooltip/TooltipExample.js +23 -3
  230. package/dist/components/Tooltip/TooltipExample.js.map +1 -1
  231. package/dist/components/Txt/Txt.d.ts +1 -3
  232. package/dist/components/Txt/Txt.js +1 -3
  233. package/dist/components/Txt/Txt.js.map +1 -1
  234. package/dist/components/UIProvider/AriaLiveMessageHandler.js +3 -2
  235. package/dist/components/UIProvider/AriaLiveMessageHandler.js.map +1 -1
  236. package/dist/hooks/useAddEventListener.d.ts +1 -2
  237. package/dist/hooks/useAddEventListener.js.map +1 -1
  238. package/dist/hooks/useRadioState.d.ts +1 -1
  239. package/dist/hooks/useTimeout.d.ts +1 -2
  240. package/dist/hooks/useTimeout.js +20 -4
  241. package/dist/hooks/useTimeout.js.map +1 -1
  242. package/dist/types/common.d.ts +3 -0
  243. package/dist/types/common.js.map +1 -1
  244. package/dist/types/meta.d.ts +1 -0
  245. package/dist/types/meta.js.map +1 -1
  246. package/dist/utils/createCustomEvent.d.ts +17 -0
  247. package/dist/utils/createCustomEvent.js +21 -0
  248. package/dist/utils/createCustomEvent.js.map +1 -0
  249. package/dist/utils/createExampleChildElement.js +3 -3
  250. package/dist/utils/createExampleChildElement.js.map +1 -1
  251. package/dist/utils/demo.d.ts +18 -26
  252. package/dist/utils/demo.js.map +1 -1
  253. package/meta.ts +6 -1
  254. package/package.json +1 -1
  255. package/src/components/Accordion/Accordion.tsx +20 -3
  256. package/src/components/Avatar/Avatar.tsx +13 -14
  257. package/src/components/AvatarGroup/AvatarGroup.tsx +30 -13
  258. package/src/components/Badge/Badge.tsx +1 -3
  259. package/src/components/BadgeDot/BadgeDot.tsx +6 -4
  260. package/src/components/BannerAlert/BannerAlert.tsx +11 -12
  261. package/src/components/BottomNavigation/BottomNavigation.tsx +6 -3
  262. package/src/components/BottomNavigation/BottomNavigationExample.tsx +31 -36
  263. package/src/components/BottomNavigation/bottom-navigation.scss +10 -1
  264. package/src/components/Breadcrumb/Breadcrumb.tsx +17 -18
  265. package/src/components/Button/Button.tsx +1 -11
  266. package/src/components/Button/ButtonExample.tsx +1 -2
  267. package/src/components/ButtonDock/ButtonDock.tsx +10 -14
  268. package/src/components/Card/Card.tsx +9 -11
  269. package/src/components/Carousel/Carousel.tsx +9 -13
  270. package/src/components/Carousel/CarouselExample.tsx +25 -25
  271. package/src/components/Checkbox/Checkbox.tsx +7 -4
  272. package/src/components/CheckboxGroup/CheckboxGroup.tsx +3 -3
  273. package/src/components/CheckboxOption/CheckboxOption.tsx +4 -4
  274. package/src/components/Chip/Chip.tsx +3 -7
  275. package/src/components/Chip/ChipExample.tsx +52 -3
  276. package/src/components/ChipGroup/ChipGroup.tsx +21 -10
  277. package/src/components/ChipGroup/ChipGroupExample.tsx +1 -1
  278. package/src/components/DatePicker/DatePicker.tsx +13 -12
  279. package/src/components/Dialog/Dialog.tsx +11 -6
  280. package/src/components/Divider/Divider.tsx +5 -9
  281. package/src/components/Divider/DividerExample.tsx +18 -1
  282. package/src/components/Drawer/Drawer.tsx +3 -3
  283. package/src/components/EmptyState/EmptyState.tsx +3 -7
  284. package/src/components/Fab/Fab.tsx +8 -5
  285. package/src/components/Fab/FabExample.tsx +22 -3
  286. package/src/components/Field/Field.tsx +4 -5
  287. package/src/components/FileUpload/FileUpload.tsx +3 -3
  288. package/src/components/FileUploadItem/FileUploadItem.tsx +6 -10
  289. package/src/components/FormField/FormField.tsx +5 -16
  290. package/src/components/Img/Img.tsx +1 -3
  291. package/src/components/InlineAlert/InlineAlert.tsx +1 -3
  292. package/src/components/Input/Input.tsx +13 -13
  293. package/src/components/Input/InputElement.tsx +11 -5
  294. package/src/components/InputNumber/InputNumber.tsx +20 -20
  295. package/src/components/InputPhone/InputPhone.tsx +21 -16
  296. package/src/components/Layout/Layout.tsx +1 -3
  297. package/src/components/Link/Link.tsx +1 -3
  298. package/src/components/ListItem/ListItem.tsx +22 -20
  299. package/src/components/Menu/Menu.tsx +5 -9
  300. package/src/components/Modal/Modal.tsx +10 -5
  301. package/src/components/Modal/modal.scss +13 -1
  302. package/src/components/OTPInput/OTPInput.tsx +1 -3
  303. package/src/components/PageControl/PageControl.tsx +1 -3
  304. package/src/components/Pagination/Pagination.tsx +50 -24
  305. package/src/components/Pagination/pagination.scss +7 -17
  306. package/src/components/Password/Password.tsx +19 -20
  307. package/src/components/Popover/Popover.tsx +11 -20
  308. package/src/components/Popover/PopoverExample.tsx +1 -1
  309. package/src/components/ProgressBar/ProgressBar.tsx +1 -3
  310. package/src/components/ProgressCircle/ProgressCircle.tsx +1 -3
  311. package/src/components/ProgressionStepper/ProgressionStepper.tsx +1 -3
  312. package/src/components/RadioGroup/RadioGroup.tsx +2 -2
  313. package/src/components/Rating/Rating.tsx +34 -14
  314. package/src/components/Rating/RatingExample.tsx +18 -1
  315. package/src/components/SearchBar/SearchBar.tsx +2 -2
  316. package/src/components/SegmentedControl/SegmentedControl.tsx +3 -3
  317. package/src/components/SegmentedControl/SegmentedControlExample.tsx +10 -12
  318. package/src/components/Select/Select.tsx +24 -25
  319. package/src/components/Skeleton/Skeleton.tsx +10 -14
  320. package/src/components/Skeleton/SkeletonExample.tsx +5 -3
  321. package/src/components/SkeletonText/SkeletonText.tsx +5 -9
  322. package/src/components/Slider/Slider.tsx +2 -2
  323. package/src/components/Slider/SliderExample.tsx +42 -17
  324. package/src/components/Snackbar/Manager.tsx +64 -0
  325. package/src/components/Snackbar/Snackbar.tsx +23 -6
  326. package/src/components/Snackbar/SnackbarExample.tsx +28 -6
  327. package/src/components/Snackbar/index.tsx +1 -0
  328. package/src/components/StylesProviderDemo/StylesProviderDemo.tsx +1 -3
  329. package/src/components/Switch/Switch.tsx +2 -2
  330. package/src/components/TabGroup/TabGroup.tsx +2 -2
  331. package/src/components/TabGroup/TabGroupExample.tsx +5 -11
  332. package/src/components/TabGroup/tab-group.scss +1 -0
  333. package/src/components/TabList/TabList.tsx +2 -2
  334. package/src/components/TabList/tab-list.scss +0 -1
  335. package/src/components/Table/Table.tsx +53 -16
  336. package/src/components/Table/table.scss +0 -1
  337. package/src/components/Tag/Tag.tsx +1 -3
  338. package/src/components/Textarea/Textarea.tsx +13 -13
  339. package/src/components/TimePicker/TimePicker.tsx +14 -14
  340. package/src/components/ToggleOption/ToggleOption.tsx +1 -0
  341. package/src/components/ToggleOption/toggle-option.scss +2 -61
  342. package/src/components/Tooltip/Tooltip.tsx +3 -7
  343. package/src/components/Tooltip/TooltipExample.tsx +23 -11
  344. package/src/components/Txt/Txt.tsx +1 -3
  345. package/src/components/UIProvider/AriaLiveMessageHandler.tsx +4 -2
  346. package/src/hooks/useAddEventListener.ts +1 -3
  347. package/src/hooks/useTimeout.ts +1 -5
  348. package/src/types/common.ts +4 -0
  349. package/src/types/meta.ts +1 -0
  350. package/src/utils/createCustomEvent.ts +35 -0
  351. package/src/utils/createExampleChildElement.tsx +3 -8
  352. package/src/utils/demo.ts +24 -27
  353. package/dist/components/ListItem/ListItemButton.d.ts +0 -2
  354. package/dist/components/ListItem/ListItemButton.js +0 -7
  355. package/dist/components/ListItem/ListItemButton.js.map +0 -1
  356. package/dist/components/Pagination/PageInput.d.ts +0 -4
  357. package/dist/components/Pagination/PageInput.js +0 -36
  358. package/dist/components/Pagination/PageInput.js.map +0 -1
  359. package/dist/hooks/usePaginationState.d.ts +0 -4
  360. package/dist/hooks/usePaginationState.js +0 -22
  361. package/dist/hooks/usePaginationState.js.map +0 -1
  362. package/src/components/ListItem/ListItemButton.tsx +0 -6
  363. package/src/components/Pagination/PageInput.tsx +0 -65
  364. package/src/hooks/usePaginationState.tsx +0 -24
@@ -1,12 +1,28 @@
1
1
  import { useRef, useEffect, useMemo } from 'react';
2
- export function useTimeout(initialCallback, durationMs = 1000) {
2
+ /**
3
+ * A hook that creates a timeout that is automatically cleared when the component is unmounted.
4
+ *
5
+ * @example
6
+ * import { useTimeout } from '@bspk/ui/hooks/useTimeout';
7
+ * import { useEffect } from 'react';
8
+ *
9
+ * function MyComponent() {
10
+ * const timeout = useTimeout();
11
+ *
12
+ * const handleClick = () => {
13
+ * timeout.set(() => console.log('Timeout triggered'), 1000);
14
+ * };
15
+ *
16
+ * return <Button onClick={handleClick}>Click here then check the console.</Button>;
17
+ * }
18
+ *
19
+ * @returns A ref object that can be used to store a timeout id.
20
+ */
21
+ export function useTimeout(durationMs = 1000) {
3
22
  const timeoutRef = useRef(null);
4
23
  useEffect(() => {
5
24
  if (timeoutRef.current)
6
25
  clearTimeout(timeoutRef.current);
7
- if (initialCallback)
8
- timeoutRef.current = setTimeout(initialCallback, durationMs);
9
- // eslint-disable-next-line react-hooks/exhaustive-deps -- only run at mount
10
26
  }, []);
11
27
  return useMemo(() => ({
12
28
  clear: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"useTimeout.js","sourceRoot":"","sources":["../../src/hooks/useTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AA6BnD,MAAM,UAAU,UAAU,CAAC,eAA4B,EAAE,UAAU,GAAG,IAAI;IACtE,MAAM,UAAU,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IAEtE,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,CAAC,OAAO;YAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,eAAe;YAAE,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QAClF,4EAA4E;IAChF,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CACV,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,GAAG,EAAE;YACR,IAAI,UAAU,CAAC,OAAO;gBAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;QACD,GAAG,EAAE,CAAC,QAAoB,EAAE,EAAE,GAAG,UAAU,EAAE,EAAE;YAC3C,IAAI,UAAU,CAAC,OAAO;gBAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACzD,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,GAAG,EAAE,UAAU;KAClB,CAAC,EACF,CAAC,UAAU,CAAC,CACf,CAAC;AACN,CAAC;AAED,sDAAsD"}
1
+ {"version":3,"file":"useTimeout.js","sourceRoot":"","sources":["../../src/hooks/useTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CAAC,UAAU,GAAG,IAAI;IACxC,MAAM,UAAU,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAC;IAEtE,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,CAAC,OAAO;YAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CACV,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,GAAG,EAAE;YACR,IAAI,UAAU,CAAC,OAAO;gBAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;QACD,GAAG,EAAE,CAAC,QAAoB,EAAE,EAAE,GAAG,UAAU,EAAE,EAAE;YAC3C,IAAI,UAAU,CAAC,OAAO;gBAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACzD,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,GAAG,EAAE,UAAU;KAClB,CAAC,EACF,CAAC,UAAU,CAAC,CACf,CAAC;AACN,CAAC;AAED,sDAAsD"}
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * @bspk/ui/Txt".
7
7
  */
8
+ import { IconName } from '@bspk/icons';
8
9
  import { JSXElementConstructor, ReactNode, ComponentPropsWithoutRef, AriaRole, ChangeEvent, KeyboardEvent, CSSProperties } from 'react';
9
10
  export type AlertVariant = 'error' | 'informational' | 'success' | 'warning';
10
11
  /** Sets a ref to the given element. */
@@ -17,6 +18,8 @@ export type CSSWithVariables = CSSProperties | (CSSProperties & {
17
18
  });
18
19
  export type DataProps = Record<`data-${string}`, string>;
19
20
  export type ButtonSize = 'large' | 'medium' | 'small' | 'x-small';
21
+ /** The name of an icon in the Bspk icon library. */
22
+ export type BspkIcon = IconName;
20
23
  export type CallToActionButton = {
21
24
  /**
22
25
  * The label of the call to action button.
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAyKH,sDAAsD"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AA6KH,sDAAsD"}
@@ -33,6 +33,7 @@ export type TypeProperty = {
33
33
  minimum?: number;
34
34
  maximum?: number;
35
35
  example?: string;
36
+ arrayType?: string;
36
37
  };
37
38
  export type ComponentMeta = BaseMeta & {
38
39
  slug: string;
@@ -1 +1 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/types/meta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACnD,SAAS,EAAE,qDAAqD;IAChE,SAAS,EAAE,mDAAmD;IAC9D,KAAK,EAAE,+CAA+C;IACtD,UAAU,EAAE,mCAAmC;IAC/C,QAAQ,EAAE,mBAAmB;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAOzB;IACA,OAAO,EAAE;QACL,KAAK,EAAE,SAAS;QAChB,EAAE,EAAE,SAAS;QACb,WAAW,EACP,4IAA4I;KACnJ;IACD,GAAG,EAAE;QACD,KAAK,EAAE,aAAa;QACpB,EAAE,EAAE,KAAK;QACT,WAAW,EACP,+JAA+J;KACtK;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,WAAW;QAClB,EAAE,EAAE,UAAU;QACd,WAAW,EACP,+LAA+L;KACtM;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,QAAQ;QACf,EAAE,EAAE,QAAQ;QACZ,WAAW,EACP,sJAAsJ;KAC7J;IACD,OAAO,EAAE;QACL,KAAK,EAAE,SAAS;QAChB,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,mEAAmE;KACnF;CACJ,CAAC;AAmDF,sDAAsD"}
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/types/meta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACnD,SAAS,EAAE,qDAAqD;IAChE,SAAS,EAAE,mDAAmD;IAC9D,KAAK,EAAE,+CAA+C;IACtD,UAAU,EAAE,mCAAmC;IAC/C,QAAQ,EAAE,mBAAmB;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAOzB;IACA,OAAO,EAAE;QACL,KAAK,EAAE,SAAS;QAChB,EAAE,EAAE,SAAS;QACb,WAAW,EACP,4IAA4I;KACnJ;IACD,GAAG,EAAE;QACD,KAAK,EAAE,aAAa;QACpB,EAAE,EAAE,KAAK;QACT,WAAW,EACP,+JAA+J;KACtK;IACD,QAAQ,EAAE;QACN,KAAK,EAAE,WAAW;QAClB,EAAE,EAAE,UAAU;QACd,WAAW,EACP,+LAA+L;KACtM;IACD,MAAM,EAAE;QACJ,KAAK,EAAE,QAAQ;QACf,EAAE,EAAE,QAAQ;QACZ,WAAW,EACP,sJAAsJ;KAC7J;IACD,OAAO,EAAE;QACL,KAAK,EAAE,SAAS;QAChB,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,mEAAmE;KACnF;CACJ,CAAC;AAoDF,sDAAsD"}
@@ -0,0 +1,17 @@
1
+ export type CustomEventDetail = Array<CustomEventDetail> | Function | boolean | number | string | {
2
+ [key: string]: CustomEventDetail;
3
+ } | null | undefined;
4
+ export type CustomEventHandler<TDetail extends CustomEventDetail> = (detail: TDetail) => void;
5
+ /**
6
+ * Like React.createContext but for custom events using the DOM's CustomEvent system.
7
+ *
8
+ * This allows for communication between components without using React.Context, which can cause unnecessary re-renders.
9
+ *
10
+ * This generator ensures only safe detail types are used. !important;
11
+ */
12
+ export declare function createCustomEvent<TDetail extends CustomEventDetail>(
13
+ /** The name of the custom event to create. Prefix with 'bspk-' to avoid conflicts. */
14
+ eventName: string): {
15
+ send(detail: TDetail): void;
16
+ useEventListener(listener: CustomEventHandler<TDetail>): void;
17
+ };
@@ -0,0 +1,21 @@
1
+ import { useEventListener } from '../hooks/useAddEventListener';
2
+ /**
3
+ * Like React.createContext but for custom events using the DOM's CustomEvent system.
4
+ *
5
+ * This allows for communication between components without using React.Context, which can cause unnecessary re-renders.
6
+ *
7
+ * This generator ensures only safe detail types are used. !important;
8
+ */
9
+ export function createCustomEvent(
10
+ /** The name of the custom event to create. Prefix with 'bspk-' to avoid conflicts. */
11
+ eventName) {
12
+ return {
13
+ send(detail) {
14
+ document.dispatchEvent(new CustomEvent(eventName, { detail }));
15
+ },
16
+ useEventListener(listener) {
17
+ useEventListener(eventName, (event) => listener(event.detail), document);
18
+ },
19
+ };
20
+ }
21
+ //# sourceMappingURL=createCustomEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCustomEvent.js","sourceRoot":"","sources":["../../src/utils/createCustomEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAe/D;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;AAC7B,sFAAsF;AACtF,SAAiB;IAEjB,OAAO;QACH,IAAI,CAAC,MAAe;YAChB,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAU,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAC5E,CAAC;QACD,gBAAgB,CAAC,QAAqC;YAClD,gBAAgB,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAE,KAA8B,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QACvG,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */ import { SvgContentCopy } from '@bspk/icons/ContentCopy';
3
3
  import { SvgDiamond } from '@bspk/icons/Diamond';
4
4
  import { Avatar } from '../components/Avatar';
5
+ import { Button } from '../components/Button';
5
6
  import { Checkbox } from '../components/Checkbox';
6
7
  import { Img } from '../components/Img';
7
- import { ListItem } from '../components/ListItem';
8
8
  import { Radio } from '../components/Radio';
9
9
  import { Switch } from '../components/Switch';
10
10
  import { Tag } from '../components/Tag';
@@ -29,9 +29,9 @@ export function createExampleChildElement({ exampleState, name, setState, action
29
29
  componentName,
30
30
  };
31
31
  }
32
- if (componentName === 'ListItemButton')
32
+ if (componentName === 'Button')
33
33
  return {
34
- element: (_jsx(ListItem.Button, { icon: _jsx(SvgContentCopy, {}), label: "LI Button", onClick: () => action('ListItem button clicked') })),
34
+ element: (_jsx(Button, { icon: _jsx(SvgContentCopy, {}), label: "LI Button", onClick: () => action('ListItem button clicked') })),
35
35
  componentName,
36
36
  };
37
37
  if (componentName === 'Img')
@@ -1 +1 @@
1
- {"version":3,"file":"createExampleChildElement.js","sourceRoot":"","sources":["../../src/utils/createExampleChildElement.tsx"],"names":[],"mappings":";AAAA,uDAAuD,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACjH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAUvC;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAA4B;IAI5G,MAAM,aAAa,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,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AAG,IAAC,GAAG,EAAC,aAAa,EAAC,GAAG,EAAC,kBAAkB,GAAG,EAAE,CAAC;IAElG,IAAI,aAAa,KAAK,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,KAAC,MAAM,IAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAC,WAAW,GAAG,EAAE,CAAC;IAEpG,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,EAAE,OAAO,EAAE,KAAC,GAAG,IAAC,KAAK,EAAC,KAAK,GAAG,EAAE,CAAC;IAC5C,CAAC;IAED,IAAI,aAAa,KAAK,KAAK;QAAE,OAAO,EAAE,OAAO,EAAE,KAAC,GAAG,uBAAW,EAAE,CAAC;IAEjE,IAAI,aAAa,KAAK,MAAM;QAAE,OAAO,EAAE,OAAO,EAAE,KAAC,UAAU,KAAG,EAAE,CAAC;IAEjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC7B,CAAC"}
@@ -1,20 +1,6 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  import { AlertVariant, DataProps } from '-/types/common';
3
- import { ComponentMeta } from '-/types/meta';
4
- export type TypeProperty = {
5
- name: string;
6
- description?: string;
7
- type?: string[] | string;
8
- default?: unknown;
9
- required?: boolean;
10
- options?: number[] | string[];
11
- variants?: string[];
12
- references?: string[];
13
- minimum?: number;
14
- maximum?: number;
15
- example?: string;
16
- exampleType?: string;
17
- };
3
+ import { ComponentMeta, TypeProperty } from '-/types/meta';
18
4
  export type DemoAction = (message: string, variant?: AlertVariant) => void;
19
5
  export type DemoSetState<Props = Record<string, unknown>> = (next: Partial<Props> | ((prev: Props) => Partial<Props>)) => void;
20
6
  export type TypePropertyDemo = Omit<TypeProperty, 'example'> & {
@@ -45,8 +31,18 @@ export type ComponentVariantOverride<Props> = {
45
31
  options: Props[K][];
46
32
  };
47
33
  };
34
+ export type ComponentPageSection<Props = Record<string, unknown>> = {
35
+ title: string;
36
+ content: (params: {
37
+ Component?: React.ComponentType<Props>;
38
+ props: Props;
39
+ CodeExample: CodeExample;
40
+ Syntax: Syntax;
41
+ }) => React.ReactNode;
42
+ location?: 'afterDemo' | 'beforeDemo';
43
+ };
48
44
  export type ComponentVariantOverrides<Props = Record<string, unknown>, PropName extends keyof Props = keyof Props> = {
49
- [Key in PropName]?: ComponentVariantOverride<Props> | false | ((props: Props) => ComponentVariantOverride<Props>);
45
+ [Key in PropName]?: ComponentVariantOverride<Props> | false;
50
46
  };
51
47
  export type ComponentExample<Props = Record<string, unknown>, PropName extends keyof Props = keyof Props> = {
52
48
  /**
@@ -91,16 +87,7 @@ export type ComponentExample<Props = Record<string, unknown>, PropName extends k
91
87
  */
92
88
  disableProps?: PropName[] | true;
93
89
  /** The sections of the example. */
94
- sections?: {
95
- title: string;
96
- content: (params: {
97
- Component: React.ComponentType<Props>;
98
- props: Props;
99
- CodeExample: CodeExample;
100
- Syntax: Syntax;
101
- }) => React.ReactNode;
102
- location?: 'afterDemo' | 'beforeDemo';
103
- }[];
90
+ sections?: ComponentPageSection<Props>[];
104
91
  };
105
92
  export type Syntax = (params: {
106
93
  code: string;
@@ -125,6 +112,11 @@ export type ComponentExampleFn<Props = Record<string, unknown>> = (params: {
125
112
  }) => ComponentExample<Props>;
126
113
  export type OnHandlers = `on${string}`;
127
114
  export type Preset<Props> = {
115
+ /**
116
+ * A description of the design pattern this preset demonstrates. When applied, it showcases the specific use case or
117
+ * behavior of the component.
118
+ */
119
+ designPattern?: string;
128
120
  /** The name of the preset. This is used to display the preset in the UI. */
129
121
  label: string;
130
122
  /** The props of the component. This is used to set props of the component. These values can't be changed in the UI. */
@@ -1 +1 @@
1
- {"version":3,"file":"demo.js","sourceRoot":"","sources":["../../src/utils/demo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAiKvD,MAAM,UAAU,SAAS,CAAC,SAAiB,KAAK;IAC5C,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC"}
1
+ {"version":3,"file":"demo.js","sourceRoot":"","sources":["../../src/utils/demo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AA8JvD,MAAM,UAAU,SAAS,CAAC,SAAiB,KAAK;IAC5C,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC"}
package/meta.ts CHANGED
@@ -332,17 +332,22 @@ function generateTypes() {
332
332
  ? context.componentFile?.jsDocs?.find(({ id }) => id === kebabCase(definition.description!))
333
333
  : undefined;
334
334
 
335
+ const type = definition.type?.toString();
336
+
337
+ const arrayType = type?.match(/Array<(.+)>/)?.[1];
338
+
335
339
  const next: TypeProperty = {
336
340
  name,
337
341
  required: required?.includes(name),
338
342
  description: jsDoc?.description || definition.description,
339
343
  default: definition.default === 'undefined' ? undefined : definition.default,
340
- type: definition.type?.toString(),
344
+ type,
341
345
  exampleType: jsDoc?.exampleType,
342
346
  minimum: definition.minimum,
343
347
  maximum: definition.maximum,
344
348
  options: jsDoc?.options?.split(',').map((o) => o.trim()),
345
349
  example: jsDoc?.example,
350
+ arrayType,
346
351
  };
347
352
 
348
353
  if (next.name.match(/^on[A-Z]/)) next.type = 'function';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bspk/ui",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "license": "CC-BY-4.0",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @cspell/spellchecker */
1
2
  import './accordion.scss';
2
3
  import { SvgKeyboardArrowDown } from '@bspk/icons/KeyboardArrowDown';
3
4
  import { SvgKeyboardArrowUp } from '@bspk/icons/KeyboardArrowUp';
@@ -68,9 +69,25 @@ export type AccordionProps = {
68
69
  * @example
69
70
  * import { Accordion } from '@bspk/ui/Accordion';
70
71
  *
71
- * function Example() {
72
- * return <Accordion items={[{ id: 1, title: 'Section', children: 'Example content' }]} />;
73
- * }
72
+ * <Accordion
73
+ * singleOpen={true}
74
+ * items={[
75
+ * {
76
+ * id: 1,
77
+ * title: 'Lawrence Welk',
78
+ * subtitle: 'The Champagne Music Maker',
79
+ * children:
80
+ * 'Lawrence Welk was an American accordionist, bandleader, and television impresario, who hosted The Lawrence Welk Show from 1951 to 1982.',
81
+ * },
82
+ * {
83
+ * id: 2,
84
+ * title: 'Myron Floren',
85
+ * subtitle: 'The Happy Norwegian',
86
+ * children:
87
+ * 'Myron Floren was an American accordionist best known as the featured accordionist on The Lawrence Welk Show.',
88
+ * },
89
+ * ]}
90
+ * />;
74
91
  *
75
92
  * @name Accordion
76
93
  * @phase UXReview
@@ -85,21 +85,20 @@ export type AvatarProps = CommonProps<'disabled'> & {
85
85
  *
86
86
  * @example
87
87
  * import { Avatar } from '@bspk/ui/Avatar';
88
- * import { SvgPerson } from '@bspk/icons/Person';
89
88
  *
90
- * function Example() {
91
- * return (
92
- * <Avatar
93
- * color="blue"
94
- * icon={<SvgPerson />}
95
- * image="/avatar-01.png"
96
- * initials="AR"
97
- * name="Andre Giant"
98
- * showTooltip
99
- * size="large"
100
- * />
101
- * );
102
- * }
89
+ * <Avatar
90
+ * color="blue"
91
+ * showIcon
92
+ * image="/avatar-01.png"
93
+ * initials="AR"
94
+ * name="Andre Giant"
95
+ * hideTooltip
96
+ * size="large"
97
+ * disabled={false}
98
+ * onClick={() => action('Launch avatar popover')}
99
+ * showIcon={false}
100
+ * hideTooltip={true}
101
+ * />;
103
102
  *
104
103
  * @exampleDescription The image if provided is displayed first, followed by the icon if provided, and finally the initials. If no initials are provided, the first two letters of the name will be used as initials.
105
104
  *
@@ -42,7 +42,7 @@ export type AvatarGroupProps = CommonProps<'style'> & {
42
42
  /**
43
43
  * The variant of the avatar group.
44
44
  *
45
- * @default auto
45
+ * @default stacked
46
46
  */
47
47
  variant?: 'spread' | 'stacked';
48
48
  };
@@ -53,22 +53,39 @@ export type AvatarGroupProps = CommonProps<'style'> & {
53
53
  * @example
54
54
  * import { AvatarGroup } from '@bspk/ui/AvatarGroup';
55
55
  *
56
- * function Example() {
57
- * return (
58
- * <AvatarGroup
59
- * items={[
60
- * { name: 'Andre Giant', image: '/path/to/image.jpg' },
61
- * { name: 'John Smith', initials: 'JS' },
62
- * { name: 'Princess Buttercup' },
63
- * ]}
64
- * />
65
- * );
66
- * }
56
+ * <AvatarGroup
57
+ * style={{ marginLeft: 'var(--spacing-sizing-12)' }}
58
+ * size="medium"
59
+ * max={4}
60
+ * variant="stacked"
61
+ * items={[
62
+ * {
63
+ * name: 'Alice Johnson',
64
+ * image: '/avatar-01.png',
65
+ * },
66
+ * {
67
+ * name: 'Bob Smith',
68
+ * image: '/avatar-02.png',
69
+ * },
70
+ * {
71
+ * name: 'Charlie Brown',
72
+ * image: '/avatar-03.png',
73
+ * },
74
+ * {
75
+ * name: 'Diana Prince',
76
+ * image: '/avatar-04.png',
77
+ * },
78
+ * {
79
+ * name: 'Ethan Hunt',
80
+ * image: '/avatar-05.png',
81
+ * },
82
+ * ]}
83
+ * />;
67
84
  *
68
85
  * @name AvatarGroup
69
86
  * @phase UXReview
70
87
  */
71
- export function AvatarGroup({ items, size = 'small', max: maxProp = 5, variant = 'spread', style }: AvatarGroupProps) {
88
+ export function AvatarGroup({ items, size = 'small', max: maxProp = 5, variant = 'stacked', style }: AvatarGroupProps) {
72
89
  const max = maxProp > items.length ? items.length : maxProp;
73
90
  const overflowItems = items.slice(max);
74
91
 
@@ -49,9 +49,7 @@ export type BadgeProps = {
49
49
  * @example
50
50
  * import { Badge } from '@bspk/ui/Badge';
51
51
  *
52
- * function Example() {
53
- * return <Badge count={5} size="small" color="primary" />;
54
- * }
52
+ * <Badge count={5} size="small" color="primary" surfaceBorder={true} />;
55
53
  *
56
54
  * @exampleDescription This example shows a badge with a count of 5, size small, and primary variant.
57
55
  *
@@ -44,16 +44,18 @@ export type BadgeDotProps = {
44
44
  * @example
45
45
  * import { BadgeDot } from '@bspk/ui/BadgeDot';
46
46
  *
47
- * function Example() {
48
- * return <BadgeDot color="primary" />;
49
- * }
47
+ * <BadgeDot color="secondary" size={12} outline={true}>
48
+ * <Button>Messages</Button>
49
+ * </BadgeDot>;
50
50
  *
51
51
  * @exampleDescription This example shows a badge-dot with a count of 5, size small, and primary variant.
52
52
  *
53
53
  * @name BadgeDot
54
54
  * @phase UXReview
55
55
  */
56
- export function BadgeDot({ children, color = 'primary', size = 6, outline = false }: BadgeDotProps) {
56
+ export function BadgeDot({ children, color = 'primary', size: sizeProp = 6, outline = false }: BadgeDotProps) {
57
+ const size = sizeProp in OUTLINE_WIDTHS ? sizeProp : 6;
58
+
57
59
  const badgeDot = (
58
60
  <sup
59
61
  data-attachment={!!children || undefined}
@@ -54,18 +54,17 @@ export type BannerAlertProps = {
54
54
  * @example
55
55
  * import { BannerAlert } from '@bspk/ui/BannerAlert';
56
56
  *
57
- * function Example() {
58
- * <BannerAlert
59
- * variant="error"
60
- * header="Error"
61
- * body="There was an error processing your request."
62
- * onClose={() => console.log('Alert closed')}
63
- * callToAction={{
64
- * label = 'Click me',
65
- * onClick = () => action('Call to action clicked!'),
66
- * }}
67
- * />;
68
- * }
57
+ * <BannerAlert
58
+ * elevated={true}
59
+ * variant="error"
60
+ * header="Error"
61
+ * body="There was an error processing your request."
62
+ * onClose={() => sendSnackbar('Alert closed')}
63
+ * callToAction={{
64
+ * label = 'Click me',
65
+ * onClick = () => action('Call to action clicked!'),
66
+ * }}
67
+ * />;
69
68
  *
70
69
  * @exampleDescription This example shows how to use the BannerAlert component with an error variant, a header, and a body message.
71
70
  *
@@ -23,13 +23,16 @@ export type BottomNavigationProps = Pick<TabListProps, 'label' | 'onChange' | 'o
23
23
  * import { BottomNavigation } from '@bspk/ui/BottomNavigation';
24
24
  * import { useState } from 'react';
25
25
  *
26
- * function Example() {
26
+ * () => {
27
27
  * const [value, setValue] = useState<string>('1');
28
28
  *
29
29
  * return (
30
30
  * <BottomNavigation
31
+ * variant="elevated"
32
+ * mode="inline"
33
+ * label="Bottom Navigation Example"
31
34
  * value={value}
32
- * onChange={onChange}
35
+ * onChange={(next) => setValue(next)}
33
36
  * options={[
34
37
  * {
35
38
  * value: '1',
@@ -46,7 +49,7 @@ export type BottomNavigationProps = Pick<TabListProps, 'label' | 'onChange' | 'o
46
49
  * ]}
47
50
  * />
48
51
  * );
49
- * }
52
+ * };
50
53
  *
51
54
  * @name BottomNavigation
52
55
  * @phase Dev
@@ -1,13 +1,3 @@
1
- import { SvgCloud } from '@bspk/icons/Cloud';
2
- import { SvgCloudFill } from '@bspk/icons/CloudFill';
3
- import { SvgEvent } from '@bspk/icons/Event';
4
- import { SvgEventFill } from '@bspk/icons/EventFill';
5
- import { SvgPerson } from '@bspk/icons/Person';
6
- import { SvgPersonFill } from '@bspk/icons/PersonFill';
7
- import { SvgSettings } from '@bspk/icons/Settings';
8
- import { SvgSettingsFill } from '@bspk/icons/SettingsFill';
9
- import { SvgSmartphone } from '@bspk/icons/Smartphone';
10
- import { SvgSmartphoneFill } from '@bspk/icons/SmartphoneFill';
11
1
  import { BottomNavigationProps } from '.';
12
2
  import { ComponentExample, Preset } from '-/utils/demo';
13
3
 
@@ -19,20 +9,20 @@ export const presets: Preset<BottomNavigationProps>[] = [
19
9
  {
20
10
  value: '1',
21
11
  label: 'Item 1',
22
- icon: <SvgSettings />,
23
- iconSelected: <SvgSettingsFill />,
12
+ icon: 'Settings',
13
+ iconSelected: 'SettingsFill',
24
14
  },
25
15
  {
26
16
  value: '2',
27
17
  label: 'Item 2',
28
- icon: <SvgCloud />,
29
- iconSelected: <SvgCloudFill />,
18
+ icon: 'Cloud',
19
+ iconSelected: 'CloudFill',
30
20
  },
31
21
  {
32
22
  value: '3',
33
23
  label: 'Item 3',
34
- icon: <SvgSmartphone />,
35
- iconSelected: <SvgSmartphoneFill />,
24
+ icon: 'Smartphone',
25
+ iconSelected: 'SmartphoneFill',
36
26
  },
37
27
  ],
38
28
  value: '1',
@@ -45,33 +35,33 @@ export const presets: Preset<BottomNavigationProps>[] = [
45
35
  options: [
46
36
  {
47
37
  value: '1',
48
- label: 'Item 1',
49
- icon: <SvgSettings />,
50
- iconSelected: <SvgSettingsFill />,
38
+ label: 'Item 1 With Longer Label',
39
+ icon: 'Settings',
40
+ iconSelected: 'SettingsFill',
51
41
  },
52
42
  {
53
43
  value: '2',
54
- label: 'Item 2',
55
- icon: <SvgCloud />,
56
- iconSelected: <SvgCloudFill />,
44
+ label: 'Item 2 With Longer Label',
45
+ icon: 'Cloud',
46
+ iconSelected: 'CloudFill',
57
47
  },
58
48
  {
59
49
  value: '3',
60
- label: 'Item 3',
61
- icon: <SvgSmartphone />,
62
- iconSelected: <SvgSmartphoneFill />,
50
+ label: 'Item 3 With Longer Label',
51
+ icon: 'Smartphone',
52
+ iconSelected: 'SmartphoneFill',
63
53
  },
64
54
  {
65
55
  value: '4',
66
- label: 'Item 4',
67
- icon: <SvgEvent />,
68
- iconSelected: <SvgEventFill />,
56
+ label: 'Item 4 With Longer Label',
57
+ icon: 'Event',
58
+ iconSelected: 'EventFill',
69
59
  },
70
60
  {
71
61
  value: '5',
72
- label: 'Item 5',
73
- icon: <SvgPerson />,
74
- iconSelected: <SvgPersonFill />,
62
+ label: 'Item 5 With Longer Label',
63
+ icon: 'Person',
64
+ iconSelected: 'PersonFill',
75
65
  },
76
66
  ],
77
67
  value: '1',
@@ -85,14 +75,14 @@ export const presets: Preset<BottomNavigationProps>[] = [
85
75
  {
86
76
  value: '1',
87
77
  label: 'Item 1',
88
- icon: <SvgSettings />,
89
- iconSelected: <SvgSettingsFill />,
78
+ icon: 'Settings',
79
+ iconSelected: 'SettingsFill',
90
80
  },
91
81
  {
92
82
  value: '2',
93
83
  label: 'Item 2',
94
- icon: <SvgCloud />,
95
- iconSelected: <SvgCloudFill />,
84
+ icon: 'Cloud',
85
+ iconSelected: 'CloudFill',
96
86
  disabled: true,
97
87
  },
98
88
  ],
@@ -111,7 +101,12 @@ export const BottomNavigationExample: ComponentExample<BottomNavigationProps> =
111
101
  },
112
102
  defaultState: {
113
103
  value: '1',
114
- options: presets[0].propState.options,
104
+ options: presets[0].propState.options.map((option) => ({
105
+ ...option,
106
+ icon: undefined,
107
+ iconSelected: undefined,
108
+ })),
109
+ label: 'Single Icon',
115
110
  },
116
111
  disableProps: [],
117
112
  presets,