@mbao01/common 0.0.41 → 0.0.43

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 (319) hide show
  1. package/dist/types/components/Accordion/Accordion.d.ts +1 -1
  2. package/dist/types/components/Accordion/constants.d.ts +3 -3
  3. package/dist/types/components/Accordion/index.d.ts +1 -1
  4. package/dist/types/components/Accordion/types.d.ts +0 -1
  5. package/dist/types/components/Alert/Alert.d.ts +1 -1
  6. package/dist/types/components/Alert/constants.d.ts +1 -1
  7. package/dist/types/components/Alert/index.d.ts +1 -1
  8. package/dist/types/components/Alert/types.d.ts +2 -3
  9. package/dist/types/components/AlertDialog/AlertDialog.d.ts +3 -3
  10. package/dist/types/components/AlertDialog/constants.d.ts +1 -1
  11. package/dist/types/components/AlertDialog/index.d.ts +1 -1
  12. package/dist/types/components/AlertDialog/types.d.ts +3 -4
  13. package/dist/types/components/Anchor/Anchor.d.ts +1 -1
  14. package/dist/types/components/Anchor/constant.d.ts +1 -1
  15. package/dist/types/components/Anchor/index.d.ts +1 -1
  16. package/dist/types/components/Anchor/types.d.ts +2 -3
  17. package/dist/types/components/Avatar/Avatar.d.ts +1 -1
  18. package/dist/types/components/Avatar/constants.d.ts +3 -3
  19. package/dist/types/components/Avatar/index.d.ts +1 -1
  20. package/dist/types/components/Avatar/types.d.ts +2 -3
  21. package/dist/types/components/Badge/Badge.d.ts +1 -1
  22. package/dist/types/components/Badge/constants.d.ts +1 -1
  23. package/dist/types/components/Badge/types.d.ts +2 -3
  24. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  25. package/dist/types/components/Breadcrumbs/index.d.ts +1 -1
  26. package/dist/types/components/Breadcrumbs/types.d.ts +0 -1
  27. package/dist/types/components/Button/Button.d.ts +3 -3
  28. package/dist/types/components/Button/constants.d.ts +1 -1
  29. package/dist/types/components/Button/index.d.ts +1 -1
  30. package/dist/types/components/Button/types.d.ts +3 -3
  31. package/dist/types/components/Calendar/Calendar.d.ts +1 -1
  32. package/dist/types/components/Calendar/index.d.ts +1 -1
  33. package/dist/types/components/Calendar/types.d.ts +1 -2
  34. package/dist/types/components/Card/Card.d.ts +1 -1
  35. package/dist/types/components/Card/constants.d.ts +1 -1
  36. package/dist/types/components/Card/index.d.ts +1 -1
  37. package/dist/types/components/Card/types.d.ts +3 -3
  38. package/dist/types/components/Carousel/Carousel.d.ts +11 -12
  39. package/dist/types/components/Carousel/CarouselContext.d.ts +2 -3
  40. package/dist/types/components/Carousel/constants.d.ts +4 -4
  41. package/dist/types/components/Carousel/index.d.ts +1 -1
  42. package/dist/types/components/Carousel/types.d.ts +1 -2
  43. package/dist/types/components/Carousel/useCarousel.d.ts +1 -1
  44. package/dist/types/components/Collapsible/Collapsible.d.ts +3 -4
  45. package/dist/types/components/Collapsible/index.d.ts +1 -1
  46. package/dist/types/components/Collapsible/types.d.ts +0 -1
  47. package/dist/types/components/Combobox/Combobox.d.ts +1 -1
  48. package/dist/types/components/Combobox/index.d.ts +1 -1
  49. package/dist/types/components/Command/Command.d.ts +24 -24
  50. package/dist/types/components/Command/constants.d.ts +11 -11
  51. package/dist/types/components/Command/index.d.ts +1 -1
  52. package/dist/types/components/Command/types.d.ts +4 -5
  53. package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
  54. package/dist/types/components/DatePicker/DateRangePicker.d.ts +1 -1
  55. package/dist/types/components/DatePicker/MultipleDatesPicker.d.ts +1 -1
  56. package/dist/types/components/DatePicker/index.d.ts +3 -3
  57. package/dist/types/components/DatePicker/types.d.ts +6 -7
  58. package/dist/types/components/Description/Description.d.ts +1 -1
  59. package/dist/types/components/Description/index.d.ts +1 -1
  60. package/dist/types/components/Description/types.d.ts +0 -1
  61. package/dist/types/components/Dialog/Dialog.d.ts +3 -3
  62. package/dist/types/components/Dialog/constants.d.ts +7 -7
  63. package/dist/types/components/Dialog/index.d.ts +1 -1
  64. package/dist/types/components/Dialog/types.d.ts +2 -3
  65. package/dist/types/components/Drawer/Drawer.d.ts +15 -20
  66. package/dist/types/components/Drawer/constants.d.ts +6 -6
  67. package/dist/types/components/Drawer/index.d.ts +1 -1
  68. package/dist/types/components/Drawer/types.d.ts +1 -2
  69. package/dist/types/components/FileUploader/FileUploader.d.ts +4 -5
  70. package/dist/types/components/FileUploader/FileUploaderContext.d.ts +2 -3
  71. package/dist/types/components/FileUploader/index.d.ts +1 -1
  72. package/dist/types/components/FileUploader/types.d.ts +2 -2
  73. package/dist/types/components/FileUploader/useFileUpload.d.ts +1 -1
  74. package/dist/types/components/Form/Checkbox/constants.d.ts +1 -1
  75. package/dist/types/components/Form/Checkbox/index.d.ts +1 -1
  76. package/dist/types/components/Form/Checkbox/types.d.ts +2 -3
  77. package/dist/types/components/Form/Input/Input.d.ts +2 -2
  78. package/dist/types/components/Form/Input/constants.d.ts +1 -1
  79. package/dist/types/components/Form/Input/index.d.ts +1 -1
  80. package/dist/types/components/Form/Input/types.d.ts +2 -3
  81. package/dist/types/components/Form/OtpInput/OtpInput.d.ts +1 -1
  82. package/dist/types/components/Form/OtpInput/index.d.ts +1 -1
  83. package/dist/types/components/Form/OtpInput/types.d.ts +2 -2
  84. package/dist/types/components/Form/Phone/Phone.d.ts +2 -2
  85. package/dist/types/components/Form/Phone/constants.d.ts +2 -2
  86. package/dist/types/components/Form/Phone/index.d.ts +1 -1
  87. package/dist/types/components/Form/Phone/types.d.ts +1 -1
  88. package/dist/types/components/Form/Radio/constants.d.ts +1 -1
  89. package/dist/types/components/Form/Radio/index.d.ts +1 -1
  90. package/dist/types/components/Form/Radio/types.d.ts +2 -3
  91. package/dist/types/components/Form/Range/Range.d.ts +1 -1
  92. package/dist/types/components/Form/Range/constants.d.ts +1 -1
  93. package/dist/types/components/Form/Range/index.d.ts +1 -1
  94. package/dist/types/components/Form/Range/types.d.ts +2 -3
  95. package/dist/types/components/Form/Select/Select.d.ts +2 -2
  96. package/dist/types/components/Form/Select/constants.d.ts +6 -6
  97. package/dist/types/components/Form/Select/index.d.ts +1 -1
  98. package/dist/types/components/Form/Select/types.d.ts +2 -3
  99. package/dist/types/components/Form/Slider/constants.d.ts +4 -4
  100. package/dist/types/components/Form/Slider/index.d.ts +1 -1
  101. package/dist/types/components/Form/Slider/types.d.ts +2 -3
  102. package/dist/types/components/Form/Switch/constants.d.ts +1 -1
  103. package/dist/types/components/Form/Switch/index.d.ts +1 -1
  104. package/dist/types/components/Form/Switch/types.d.ts +2 -3
  105. package/dist/types/components/Form/TextField/TextField.d.ts +3 -3
  106. package/dist/types/components/Form/TextField/constants.d.ts +1 -1
  107. package/dist/types/components/Form/TextField/index.d.ts +1 -1
  108. package/dist/types/components/Form/TextField/types.d.ts +2 -2
  109. package/dist/types/components/Form/Textarea/Textarea.d.ts +1 -1
  110. package/dist/types/components/Form/Textarea/constants.d.ts +1 -1
  111. package/dist/types/components/Form/Textarea/index.d.ts +1 -1
  112. package/dist/types/components/Form/Textarea/types.d.ts +2 -3
  113. package/dist/types/components/Form/components/FormControl/FormControl.d.ts +1 -1
  114. package/dist/types/components/Form/components/FormControl/constants.d.ts +1 -1
  115. package/dist/types/components/Form/components/FormControl/index.d.ts +1 -1
  116. package/dist/types/components/Form/components/FormControl/types.d.ts +2 -3
  117. package/dist/types/components/Form/components/Label/Label.d.ts +1 -1
  118. package/dist/types/components/Form/components/Label/constants.d.ts +1 -1
  119. package/dist/types/components/Form/components/Label/index.d.ts +1 -1
  120. package/dist/types/components/Form/components/Label/types.d.ts +3 -4
  121. package/dist/types/components/Form/index.d.ts +13 -13
  122. package/dist/types/components/HoverCard/HoverCard.d.ts +3 -4
  123. package/dist/types/components/HoverCard/constants.d.ts +1 -1
  124. package/dist/types/components/HoverCard/index.d.ts +1 -1
  125. package/dist/types/components/HoverCard/types.d.ts +0 -1
  126. package/dist/types/components/Loading/Loading.d.ts +1 -1
  127. package/dist/types/components/Loading/constants.d.ts +1 -1
  128. package/dist/types/components/Loading/index.d.ts +1 -1
  129. package/dist/types/components/Loading/types.d.ts +2 -3
  130. package/dist/types/components/Menu/ContextMenu/ContextMenu.d.ts +19 -20
  131. package/dist/types/components/Menu/ContextMenu/index.d.ts +1 -1
  132. package/dist/types/components/Menu/ContextMenu/types.d.ts +2 -3
  133. package/dist/types/components/Menu/DropdownMenu/DropdownMenu.d.ts +19 -20
  134. package/dist/types/components/Menu/DropdownMenu/index.d.ts +1 -1
  135. package/dist/types/components/Menu/DropdownMenu/types.d.ts +2 -3
  136. package/dist/types/components/Menu/Menubar/constants.d.ts +11 -11
  137. package/dist/types/components/Menu/Menubar/index.d.ts +1 -1
  138. package/dist/types/components/Menu/Menubar/types.d.ts +2 -3
  139. package/dist/types/components/Menu/NavigationMenu/NavigationMenu.d.ts +9 -10
  140. package/dist/types/components/Menu/NavigationMenu/constants.d.ts +6 -6
  141. package/dist/types/components/Menu/NavigationMenu/index.d.ts +1 -1
  142. package/dist/types/components/Menu/NavigationMenu/types.d.ts +2 -3
  143. package/dist/types/components/Menu/index.d.ts +4 -4
  144. package/dist/types/components/Pagination/Pagination.d.ts +3 -4
  145. package/dist/types/components/Pagination/constants.d.ts +5 -5
  146. package/dist/types/components/Pagination/index.d.ts +1 -1
  147. package/dist/types/components/Pagination/types.d.ts +2 -3
  148. package/dist/types/components/Popover/Popover.d.ts +1 -1
  149. package/dist/types/components/Popover/constants.d.ts +1 -1
  150. package/dist/types/components/Popover/index.d.ts +1 -1
  151. package/dist/types/components/Popover/types.d.ts +2 -3
  152. package/dist/types/components/Progress/Progress.d.ts +1 -1
  153. package/dist/types/components/Progress/constants.d.ts +2 -2
  154. package/dist/types/components/Progress/index.d.ts +1 -1
  155. package/dist/types/components/Progress/types.d.ts +2 -3
  156. package/dist/types/components/ScrollArea/ScrollArea.d.ts +3 -4
  157. package/dist/types/components/ScrollArea/constants.d.ts +4 -4
  158. package/dist/types/components/ScrollArea/index.d.ts +1 -1
  159. package/dist/types/components/ScrollArea/types.d.ts +2 -3
  160. package/dist/types/components/Separator/Separator.d.ts +1 -1
  161. package/dist/types/components/Separator/constants.d.ts +1 -1
  162. package/dist/types/components/Separator/index.d.ts +1 -1
  163. package/dist/types/components/Separator/types.d.ts +0 -1
  164. package/dist/types/components/Skeleton/Skeleton.d.ts +1 -1
  165. package/dist/types/components/Skeleton/constants.d.ts +1 -1
  166. package/dist/types/components/Skeleton/index.d.ts +1 -1
  167. package/dist/types/components/Skeleton/types.d.ts +2 -3
  168. package/dist/types/components/Slot/Slot.d.ts +1 -1
  169. package/dist/types/components/Slot/index.d.ts +1 -1
  170. package/dist/types/components/Sonner/Toaster.d.ts +1 -1
  171. package/dist/types/components/Sonner/constants.d.ts +2 -2
  172. package/dist/types/components/Sonner/index.d.ts +2 -2
  173. package/dist/types/components/Sonner/types.d.ts +3 -4
  174. package/dist/types/components/Table/Table.d.ts +8 -9
  175. package/dist/types/components/Table/constants.d.ts +2 -2
  176. package/dist/types/components/Table/index.d.ts +1 -1
  177. package/dist/types/components/Table/types.d.ts +2 -3
  178. package/dist/types/components/Tabs/Tabs.d.ts +1 -1
  179. package/dist/types/components/Tabs/constants.d.ts +3 -3
  180. package/dist/types/components/Tabs/index.d.ts +1 -1
  181. package/dist/types/components/Tabs/types.d.ts +2 -3
  182. package/dist/types/components/Text/Text.d.ts +1 -1
  183. package/dist/types/components/Text/constants.d.ts +1 -1
  184. package/dist/types/components/Text/types.d.ts +2 -3
  185. package/dist/types/components/ThemeSwitch/ThemeSwitch.d.ts +1 -1
  186. package/dist/types/components/ThemeSwitch/constants.d.ts +1 -1
  187. package/dist/types/components/ThemeSwitch/index.d.ts +1 -1
  188. package/dist/types/components/ThemeSwitch/types.d.ts +1 -2
  189. package/dist/types/components/Toggle/Toggle.d.ts +1 -1
  190. package/dist/types/components/Toggle/constants.d.ts +1 -1
  191. package/dist/types/components/Toggle/index.d.ts +1 -1
  192. package/dist/types/components/Toggle/types.d.ts +3 -4
  193. package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +4 -5
  194. package/dist/types/components/ToggleGroup/constants.d.ts +1 -1
  195. package/dist/types/components/ToggleGroup/index.d.ts +1 -1
  196. package/dist/types/components/ToggleGroup/types.d.ts +1 -2
  197. package/dist/types/components/Tooltip/Tooltip.d.ts +2 -2
  198. package/dist/types/components/Tooltip/constants.d.ts +2 -2
  199. package/dist/types/components/Tooltip/index.d.ts +1 -1
  200. package/dist/types/components/Tooltip/types.d.ts +2 -3
  201. package/dist/types/index.d.ts +36 -36
  202. package/dist/types/libs/cva.d.ts +2 -2
  203. package/dist/types/libs/index.d.ts +1 -1
  204. package/dist/types/utilities/cn.d.ts +1 -1
  205. package/dist/types/utilities/getSubpaths/getSubpaths.d.ts +1 -1
  206. package/dist/types/utilities/getSubpaths/index.d.ts +1 -1
  207. package/dist/types/utilities/index.d.ts +3 -3
  208. package/package.json +82 -73
  209. package/src/components/Accordion/Accordion.tsx +3 -9
  210. package/src/components/Accordion/types.ts +2 -6
  211. package/src/components/Alert/Alert.tsx +3 -14
  212. package/src/components/AlertDialog/AlertDialog.tsx +3 -6
  213. package/src/components/AlertDialog/types.ts +3 -5
  214. package/src/components/Anchor/Anchor.tsx +3 -5
  215. package/src/components/Avatar/Avatar.tsx +5 -25
  216. package/src/components/Avatar/constants.ts +15 -18
  217. package/src/components/Avatar/types.ts +1 -5
  218. package/src/components/Badge/Badge.tsx +2 -12
  219. package/src/components/Badge/index.ts +1 -1
  220. package/src/components/Button/Button.tsx +5 -21
  221. package/src/components/Button/constants.ts +1 -1
  222. package/src/components/Button/types.ts +1 -1
  223. package/src/components/Calendar/Calendar.tsx +40 -34
  224. package/src/components/Card/Card.tsx +4 -14
  225. package/src/components/Card/types.ts +1 -2
  226. package/src/components/Carousel/Carousel.tsx +68 -73
  227. package/src/components/Carousel/constants.ts +10 -13
  228. package/src/components/Carousel/types.ts +1 -1
  229. package/src/components/Collapsible/Collapsible.tsx +2 -4
  230. package/src/components/Collapsible/types.ts +1 -3
  231. package/src/components/Combobox/Combobox.tsx +3 -8
  232. package/src/components/Command/Command.tsx +11 -28
  233. package/src/components/Command/constants.ts +2 -6
  234. package/src/components/Command/types.ts +3 -7
  235. package/src/components/DatePicker/DatePicker.tsx +5 -9
  236. package/src/components/DatePicker/DateRangePicker.tsx +5 -9
  237. package/src/components/DatePicker/MultipleDatesPicker.tsx +6 -10
  238. package/src/components/DatePicker/types.ts +12 -23
  239. package/src/components/Description/Description.tsx +4 -19
  240. package/src/components/Dialog/Dialog.tsx +5 -9
  241. package/src/components/Dialog/constants.ts +2 -6
  242. package/src/components/Dialog/types.ts +5 -15
  243. package/src/components/Drawer/Drawer.tsx +6 -19
  244. package/src/components/Drawer/constants.ts +2 -6
  245. package/src/components/FileUploader/FileUploader.tsx +31 -53
  246. package/src/components/FileUploader/FileUploaderContext.tsx +1 -2
  247. package/src/components/FileUploader/types.ts +1 -1
  248. package/src/components/Form/Checkbox/Checkbox.tsx +2 -2
  249. package/src/components/Form/Checkbox/types.ts +1 -4
  250. package/src/components/Form/Input/Input.tsx +3 -9
  251. package/src/components/Form/Input/constants.ts +47 -50
  252. package/src/components/Form/Input/types.ts +1 -4
  253. package/src/components/Form/OtpInput/OtpInput.tsx +5 -12
  254. package/src/components/Form/Phone/Phone.tsx +6 -15
  255. package/src/components/Form/Radio/Radio.tsx +2 -2
  256. package/src/components/Form/Radio/types.ts +1 -4
  257. package/src/components/Form/Range/Range.tsx +3 -6
  258. package/src/components/Form/Range/types.ts +1 -4
  259. package/src/components/Form/Select/Select.tsx +26 -49
  260. package/src/components/Form/Select/types.ts +3 -9
  261. package/src/components/Form/Slider/Slider.tsx +39 -25
  262. package/src/components/Form/Slider/constants.ts +21 -24
  263. package/src/components/Form/Slider/types.ts +2 -4
  264. package/src/components/Form/Switch/Switch.tsx +2 -3
  265. package/src/components/Form/Switch/types.ts +1 -4
  266. package/src/components/Form/TextField/TextField.tsx +2 -2
  267. package/src/components/Form/Textarea/Textarea.tsx +2 -5
  268. package/src/components/Form/Textarea/constants.ts +42 -45
  269. package/src/components/Form/components/FormControl/FormControl.tsx +1 -1
  270. package/src/components/Form/components/Label/Label.tsx +2 -5
  271. package/src/components/Form/components/Label/types.ts +2 -4
  272. package/src/components/HoverCard/HoverCard.tsx +2 -4
  273. package/src/components/HoverCard/types.ts +1 -3
  274. package/src/components/Loading/Loading.tsx +3 -12
  275. package/src/components/Menu/ContextMenu/ContextMenu.tsx +5 -17
  276. package/src/components/Menu/ContextMenu/types.ts +1 -3
  277. package/src/components/Menu/DropdownMenu/DropdownMenu.tsx +7 -21
  278. package/src/components/Menu/DropdownMenu/types.ts +1 -3
  279. package/src/components/Menu/Menubar/Menubar.tsx +33 -49
  280. package/src/components/Menu/Menubar/types.ts +5 -15
  281. package/src/components/Menu/NavigationMenu/NavigationMenu.tsx +4 -13
  282. package/src/components/Pagination/Pagination.tsx +18 -42
  283. package/src/components/Pagination/constants.ts +2 -6
  284. package/src/components/Popover/Popover.tsx +1 -1
  285. package/src/components/Popover/types.ts +2 -6
  286. package/src/components/Progress/Progress.tsx +2 -4
  287. package/src/components/Progress/constants.ts +38 -44
  288. package/src/components/ScrollArea/ScrollArea.tsx +4 -16
  289. package/src/components/ScrollArea/constants.ts +8 -13
  290. package/src/components/ScrollArea/types.ts +1 -3
  291. package/src/components/Separator/Separator.tsx +2 -2
  292. package/src/components/Separator/types.ts +1 -3
  293. package/src/components/Skeleton/Skeleton.tsx +4 -14
  294. package/src/components/Sonner/Toaster.tsx +2 -4
  295. package/src/components/Sonner/constants.ts +10 -20
  296. package/src/components/Sonner/types.ts +4 -10
  297. package/src/components/Table/Table.tsx +23 -38
  298. package/src/components/Tabs/Tabs.tsx +9 -31
  299. package/src/components/Tabs/types.ts +5 -17
  300. package/src/components/Text/Text.tsx +3 -6
  301. package/src/components/Text/index.ts +1 -1
  302. package/src/components/Text/types.ts +1 -3
  303. package/src/components/ThemeSwitch/ThemeSwitch.tsx +3 -2
  304. package/src/components/Toggle/Toggle.tsx +15 -16
  305. package/src/components/Toggle/types.ts +2 -7
  306. package/src/components/ToggleGroup/ToggleGroup.tsx +5 -19
  307. package/src/components/ToggleGroup/constants.ts +1 -3
  308. package/src/components/ToggleGroup/types.ts +1 -3
  309. package/src/components/Tooltip/Tooltip.tsx +2 -4
  310. package/src/components/Tooltip/types.ts +1 -1
  311. package/src/libs/cva.ts +1 -3
  312. package/src/typography/TypographyDemo.tsx +119 -188
  313. package/src/typography/TypographyScale.tsx +7 -8
  314. package/src/utilities/cn.ts +2 -1
  315. package/src/utilities/getSubpaths/getSubpaths.ts +2 -4
  316. package/tsconfig.node.json +1 -1
  317. package/vitest-setup.ts +17 -1
  318. package/vitest.config.ts +2 -1
  319. package/dist/types/components/Menu/Menubar/Menubar.d.ts +0 -43
@@ -29,46 +29,41 @@ export const TypographyDemo = () => {
29
29
  </div>
30
30
  <div className="mt-8 prose prose-slate mx-auto lg:prose-lg">
31
31
  <p className="lead">
32
- Until now, trying to style an article, document, or blog post with
33
- Tailwind has been a tedious task that required a keen eye for
34
- typography and a lot of complex custom CSS.
32
+ Until now, trying to style an article, document, or blog post with Tailwind has been a
33
+ tedious task that required a keen eye for typography and a lot of complex custom CSS.
35
34
  </p>
36
35
  <p>
37
- By default, Tailwind removes all of the default browser styling from
38
- paragraphs, headings, lists and more. This ends up being really
39
- useful for building application UIs because you spend less time
40
- undoing user-agent styles, but when you <em>really are</em> just
41
- trying to style some content that came from a rich-text editor in a
42
- CMS or a markdown file, it can be surprising and unintuitive.
36
+ By default, Tailwind removes all of the default browser styling from paragraphs,
37
+ headings, lists and more. This ends up being really useful for building application UIs
38
+ because you spend less time undoing user-agent styles, but when you <em>really are</em>{" "}
39
+ just trying to style some content that came from a rich-text editor in a CMS or a
40
+ markdown file, it can be surprising and unintuitive.
43
41
  </p>
44
42
  <p>
45
- We get lots of complaints about it actually, with people regularly
46
- asking us things like:
43
+ We get lots of complaints about it actually, with people regularly asking us things
44
+ like:
47
45
  </p>
48
46
  <blockquote>
49
47
  <p>
50
- Why is Tailwind removing the default styles on my <code>h1</code>{" "}
51
- elements? How do I disable this? What do you mean I lose all the
52
- other base styles too?
48
+ Why is Tailwind removing the default styles on my <code>h1</code> elements? How do I
49
+ disable this? What do you mean I lose all the other base styles too?
53
50
  </p>
54
51
  </blockquote>
55
52
  <p>
56
- We hear you, but we&apos;re not convinced that simply disabling our
57
- base styles is what you really want. You don&apos;t want to have to
58
- remove annoying margins every time you use a <code>p</code> element
59
- in a piece of your dashboard UI. And I doubt you really want your
60
- blog posts to use the user-agent styles either — you want them to
61
- look <em>awesome</em>, not awful.
53
+ We hear you, but we&apos;re not convinced that simply disabling our base styles is what
54
+ you really want. You don&apos;t want to have to remove annoying margins every time you
55
+ use a <code>p</code> element in a piece of your dashboard UI. And I doubt you really
56
+ want your blog posts to use the user-agent styles either you want them to look{" "}
57
+ <em>awesome</em>, not awful.
62
58
  </p>
63
59
  <p>
64
- The <code>@tailwindcss/typography</code> plugin is our attempt to
65
- give you what you <em>actually</em> want, without any of the
66
- downsides of doing something stupid like disabling our base styles.
60
+ The <code>@tailwindcss/typography</code> plugin is our attempt to give you what you{" "}
61
+ <em>actually</em> want, without any of the downsides of doing something stupid like
62
+ disabling our base styles.
67
63
  </p>
68
64
  <p>
69
- It adds a new <code>prose</code> class that you can slap on any
70
- block of vanilla HTML content and turn it into a beautiful,
71
- well-formatted document:
65
+ It adds a new <code>prose</code> class that you can slap on any block of vanilla HTML
66
+ content and turn it into a beautiful, well-formatted document:
72
67
  </p>
73
68
  <pre>
74
69
  <code
@@ -91,8 +86,7 @@ export const TypographyDemo = () => {
91
86
  />
92
87
  </pre>
93
88
  <p>
94
- For more information about how to use the plugin and the features it
95
- includes,{" "}
89
+ For more information about how to use the plugin and the features it includes,{" "}
96
90
  <a href="https://github.com/tailwindcss/typography/blob/master/README.md">
97
91
  read the documentation
98
92
  </a>
@@ -101,58 +95,47 @@ export const TypographyDemo = () => {
101
95
  <hr />
102
96
  <h2>What to expect from here on out</h2>
103
97
  <p>
104
- What follows from here is just a bunch of absolute nonsense
105
- I&apos;ve written to dogfood the plugin itself. It includes every
106
- sensible typographic element I could think of, like{" "}
107
- <strong>bold text</strong>, unordered lists, ordered lists, code
108
- blocks, block quotes, <em>and even italics</em>.
109
- </p>
110
- <p>
111
- It&apos;s important to cover all of these use cases for a few
112
- reasons:
98
+ What follows from here is just a bunch of absolute nonsense I&apos;ve written to dogfood
99
+ the plugin itself. It includes every sensible typographic element I could think of, like{" "}
100
+ <strong>bold text</strong>, unordered lists, ordered lists, code blocks, block quotes,{" "}
101
+ <em>and even italics</em>.
113
102
  </p>
103
+ <p>It&apos;s important to cover all of these use cases for a few reasons:</p>
114
104
  <ol>
115
105
  <li>We want everything to look good out of the box.</li>
106
+ <li>Really just the first reason, that&apos;s the whole point of the plugin.</li>
116
107
  <li>
117
- Really just the first reason, that&apos;s the whole point of the
118
- plugin.
119
- </li>
120
- <li>
121
- Here&apos;s a third pretend reason though a list with three items
122
- looks more realistic than a list with two items.
108
+ Here&apos;s a third pretend reason though a list with three items looks more realistic
109
+ than a list with two items.
123
110
  </li>
124
111
  </ol>
125
112
  <p>Now we&apos;re going to try out another header style.</p>
126
113
  <h3>Typography should be easy</h3>
127
114
  <p>
128
- So that&apos;s a header for you — with any luck if we&apos;ve done
129
- our job correctly that will look pretty reasonable.
115
+ So that&apos;s a header for you — with any luck if we&apos;ve done our job correctly
116
+ that will look pretty reasonable.
130
117
  </p>
131
118
  <p>Something a wise person once told me about typography is:</p>
132
119
  <blockquote>
133
120
  <p>
134
- Typography is pretty important if you don&apos;t want your stuff
135
- to look like trash. Make it good then it won&apos;t be bad.
121
+ Typography is pretty important if you don&apos;t want your stuff to look like trash.
122
+ Make it good then it won&apos;t be bad.
136
123
  </p>
137
124
  </blockquote>
138
- <p>
139
- It&apos;s probably important that images look okay here by default
140
- as well:
141
- </p>
125
+ <p>It&apos;s probably important that images look okay here by default as well:</p>
142
126
  <figure>
143
127
  <img
144
128
  src="https://images.unsplash.com/photo-1556740758-90de374c12ad?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=1000&amp;q=80"
145
129
  alt=""
146
130
  />
147
131
  <figcaption>
148
- Contrary to popular belief, Lorem Ipsum is not simply random text.
149
- It has roots in a piece of classical Latin literature from 45 BC,
150
- making it over 2000 years old.
132
+ Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a
133
+ piece of classical Latin literature from 45 BC, making it over 2000 years old.
151
134
  </figcaption>
152
135
  </figure>
153
136
  <p>
154
- Now I&apos;m going to show you an example of an unordered list to
155
- make sure that looks good, too:
137
+ Now I&apos;m going to show you an example of an unordered list to make sure that looks
138
+ good, too:
156
139
  </p>
157
140
  <ul>
158
141
  <li>So here is the first item in this list.</li>
@@ -163,79 +146,67 @@ export const TypographyDemo = () => {
163
146
  <h2>What if we stack headings?</h2>
164
147
  <h3>We should make sure that looks good, too.</h3>
165
148
  <p>
166
- Sometimes you have headings directly underneath each other. In those
167
- cases you often have to undo the top margin on the second heading
168
- because it usually looks better for the headings to be closer
169
- together than a paragraph followed by a heading should be.
149
+ Sometimes you have headings directly underneath each other. In those cases you often
150
+ have to undo the top margin on the second heading because it usually looks better for
151
+ the headings to be closer together than a paragraph followed by a heading should be.
170
152
  </p>
171
153
  <h3>When a heading comes after a paragraph …</h3>
172
154
  <p>
173
- When a heading comes after a paragraph, we need a bit more space,
174
- like I already mentioned above. Now let&apos;s see what a more
175
- complex list would look like.
155
+ When a heading comes after a paragraph, we need a bit more space, like I already
156
+ mentioned above. Now let&apos;s see what a more complex list would look like.
176
157
  </p>
177
158
  <ul>
178
159
  <li>
179
160
  <p>
180
- <strong>
181
- I often do this thing where list items have headings.
182
- </strong>
161
+ <strong>I often do this thing where list items have headings.</strong>
183
162
  </p>
184
163
  <p>
185
- For some reason I think this looks cool which is unfortunate
186
- because it&apos;s pretty annoying to get the styles right.
164
+ For some reason I think this looks cool which is unfortunate because it&apos;s
165
+ pretty annoying to get the styles right.
187
166
  </p>
188
167
  <p>
189
- I often have two or three paragraphs in these list items, too,
190
- so the hard part is getting the spacing between the paragraphs,
191
- list item heading, and separate list items to all make sense.
192
- Pretty tough honestly, you could make a strong argument that you
193
- just shouldn&apos;t write this way.
168
+ I often have two or three paragraphs in these list items, too, so the hard part is
169
+ getting the spacing between the paragraphs, list item heading, and separate list
170
+ items to all make sense. Pretty tough honestly, you could make a strong argument
171
+ that you just shouldn&apos;t write this way.
194
172
  </p>
195
173
  </li>
196
174
  <li>
197
175
  <p>
198
- <strong>
199
- Since this is a list, I need at least two items.
200
- </strong>
176
+ <strong>Since this is a list, I need at least two items.</strong>
201
177
  </p>
202
178
  <p>
203
- I explained what I&apos;m doing already in the previous list
204
- item, but a list wouldn&apos;t be a list if it only had one
205
- item, and we really want this to look realistic. That&apos;s why
206
- I&apos;ve added this second list item so I actually have
179
+ I explained what I&apos;m doing already in the previous list item, but a list
180
+ wouldn&apos;t be a list if it only had one item, and we really want this to look
181
+ realistic. That&apos;s why I&apos;ve added this second list item so I actually have
207
182
  something to look at when writing the styles.
208
183
  </p>
209
184
  </li>
210
185
  <li>
211
186
  <p>
212
- <strong>
213
- It&apos;s not a bad idea to add a third item either.
214
- </strong>
187
+ <strong>It&apos;s not a bad idea to add a third item either.</strong>
215
188
  </p>
216
189
  <p>
217
- I think it probably would&apos;ve been fine to just use two
218
- items but three is definitely not worse, and since I seem to be
219
- having no trouble making up arbitrary things to type, I might as
220
- well include it.
190
+ I think it probably would&apos;ve been fine to just use two items but three is
191
+ definitely not worse, and since I seem to be having no trouble making up arbitrary
192
+ things to type, I might as well include it.
221
193
  </p>
222
194
  </li>
223
195
  </ul>
224
196
  <p>
225
- After this sort of list I usually have a closing statement or
226
- paragraph, because it kinda looks weird jumping right to a heading.
197
+ After this sort of list I usually have a closing statement or paragraph, because it
198
+ kinda looks weird jumping right to a heading.
227
199
  </p>
228
200
  <h2>Code should look okay by default.</h2>
229
201
  <p>
230
- I think most people are going to use{" "}
231
- <a href="https://highlightjs.org/">highlight.js</a> or{" "}
232
- <a href="https://prismjs.com/">Prism</a> or something if they want
233
- to style their code blocks but it wouldn&apos;t hurt to make them
234
- look <em>okay</em> out of the box, even with no syntax highlighting.
202
+ I think most people are going to use <a href="https://highlightjs.org/">highlight.js</a>{" "}
203
+ or <a href="https://prismjs.com/">Prism</a> or something if they want to style their
204
+ code blocks but it wouldn&apos;t hurt to make them look <em>okay</em> out of the box,
205
+ even with no syntax highlighting.
235
206
  </p>
236
207
  <p>
237
- Here&apos;s what a default <code>tailwind.config.js</code> file
238
- looks like at the time of writing:
208
+ Here&apos;s what a default <code>tailwind.config.js</code> file looks like at the time
209
+ of writing:
239
210
  </p>
240
211
  <pre>
241
212
  <code className="language-js">
@@ -252,67 +223,49 @@ export const TypographyDemo = () => {
252
223
  <p>Hopefully that looks good enough to you.</p>
253
224
  <h3>What about nested lists?</h3>
254
225
  <p>
255
- Nested lists basically always look bad which is why editors like
256
- Medium don&apos;t even let you do it, but I guess since some of you
257
- goofballs are going to do it we have to carry the burden of at least
258
- making it work.
226
+ Nested lists basically always look bad which is why editors like Medium don&apos;t even
227
+ let you do it, but I guess since some of you goofballs are going to do it we have to
228
+ carry the burden of at least making it work.
259
229
  </p>
260
230
  <ol>
261
231
  <li>
262
232
  <strong>Nested lists are rarely a good idea.</strong>
263
233
  <ul>
264
234
  <li>
265
- You might feel like you are being really
266
- &ldquo;organized&rdquo; or something but you are just creating
267
- a gross shape on the screen that is hard to read.
235
+ You might feel like you are being really &ldquo;organized&rdquo; or something but
236
+ you are just creating a gross shape on the screen that is hard to read.
268
237
  </li>
269
238
  <li>
270
- Nested navigation in UIs is a bad idea too, keep things as
271
- flat as possible.
272
- </li>
273
- <li>
274
- Nesting tons of folders in your source code is also not
275
- helpful.
239
+ Nested navigation in UIs is a bad idea too, keep things as flat as possible.
276
240
  </li>
241
+ <li>Nesting tons of folders in your source code is also not helpful.</li>
277
242
  </ul>
278
243
  </li>
279
244
  <li>
280
- <strong>
281
- Since we need to have more items, here&apos;s another one.
282
- </strong>
245
+ <strong>Since we need to have more items, here&apos;s another one.</strong>
283
246
  <ul>
284
- <li>
285
- I&apos;m not sure if we&apos;ll bother styling more than two
286
- levels deep.
287
- </li>
288
- <li>
289
- Two is already too much, three is guaranteed to be a bad idea.
290
- </li>
247
+ <li>I&apos;m not sure if we&apos;ll bother styling more than two levels deep.</li>
248
+ <li>Two is already too much, three is guaranteed to be a bad idea.</li>
291
249
  <li>If you nest four levels deep you belong in prison.</li>
292
250
  </ul>
293
251
  </li>
294
252
  <li>
295
- <strong>
296
- Two items isn&apos;t really a list, three is good though.
297
- </strong>
253
+ <strong>Two items isn&apos;t really a list, three is good though.</strong>
298
254
  <ul>
299
255
  <li>
300
- Again please don&apos;t nest lists if you want people to
301
- actually read your content.
256
+ Again please don&apos;t nest lists if you want people to actually read your
257
+ content.
302
258
  </li>
303
259
  <li>Nobody wants to look at this.</li>
304
- <li>
305
- I&apos;m upset that we even have to bother styling this.
306
- </li>
260
+ <li>I&apos;m upset that we even have to bother styling this.</li>
307
261
  </ul>
308
262
  </li>
309
263
  </ol>
310
264
  <p>
311
- The most annoying thing about lists in Markdown is that{" "}
312
- <code>&lt;li&gt;</code> elements aren&apos;t given a child{" "}
313
- <code>&lt;p&gt;</code> tag unless there are multiple paragraphs in
314
- the list item. That means I have to worry about styling that
315
- annoying situation too.
265
+ The most annoying thing about lists in Markdown is that <code>&lt;li&gt;</code> elements
266
+ aren&apos;t given a child <code>&lt;p&gt;</code> tag unless there are multiple
267
+ paragraphs in the list item. That means I have to worry about styling that annoying
268
+ situation too.
316
269
  </p>
317
270
  <ul>
318
271
  <li>
@@ -329,47 +282,32 @@ export const TypographyDemo = () => {
329
282
  </li>
330
283
  <li>
331
284
  <p>
332
- <strong>
333
- But in this second top-level list item, they will.
334
- </strong>
335
- </p>
336
- <p>
337
- This is especially annoying because of the spacing on this
338
- paragraph.
285
+ <strong>But in this second top-level list item, they will.</strong>
339
286
  </p>
287
+ <p>This is especially annoying because of the spacing on this paragraph.</p>
340
288
  <ul>
341
289
  <li>
342
290
  <p>
343
- As you can see here, because I&apos;ve added a second line,
344
- this list item now has a <code>&lt;p&gt;</code> tag.
345
- </p>
346
- <p>
347
- This is the second line I&apos;m talking about by the way.
291
+ As you can see here, because I&apos;ve added a second line, this list item now
292
+ has a <code>&lt;p&gt;</code> tag.
348
293
  </p>
294
+ <p>This is the second line I&apos;m talking about by the way.</p>
349
295
  </li>
350
296
  <li>
351
- <p>
352
- Finally here&apos;s another list item so it&apos;s more like
353
- a list.
354
- </p>
297
+ <p>Finally here&apos;s another list item so it&apos;s more like a list.</p>
355
298
  </li>
356
299
  </ul>
357
300
  </li>
358
301
  <li>
359
- <p>
360
- A closing list item, but with no nested list, because why not?
361
- </p>
302
+ <p>A closing list item, but with no nested list, because why not?</p>
362
303
  </li>
363
304
  </ul>
364
305
  <p>And finally a sentence to close off this section.</p>
365
306
  <h2>There are other elements we need to style</h2>
366
307
  <p>
367
308
  I almost forgot to mention links, like{" "}
368
- <a href="https://tailwindcss.com">
369
- this link to the Tailwind CSS website
370
- </a>
371
- . We almost made them blue but that&apos;s so yesterday, so we went
372
- with dark gray, feels edgier.
309
+ <a href="https://tailwindcss.com">this link to the Tailwind CSS website</a>. We almost
310
+ made them blue but that&apos;s so yesterday, so we went with dark gray, feels edgier.
373
311
  </p>
374
312
  <p>We even included table styles, check it out:</p>
375
313
  <table>
@@ -409,65 +347,58 @@ export const TypographyDemo = () => {
409
347
  </tbody>
410
348
  </table>
411
349
  <p>
412
- We also need to make sure inline code looks good, like if I wanted
413
- to talk about <code>&lt;span&gt;</code> elements or tell you the
414
- good news about <code>@tailwindcss/typography</code>.
350
+ We also need to make sure inline code looks good, like if I wanted to talk about{" "}
351
+ <code>&lt;span&gt;</code> elements or tell you the good news about{" "}
352
+ <code>@tailwindcss/typography</code>.
415
353
  </p>
416
354
  <h3>
417
355
  Sometimes I even use <code>code</code> in headings
418
356
  </h3>
419
357
  <p>
420
- Even though it&apos;s probably a bad idea, and historically
421
- I&apos;ve had a hard time making it look good. This{" "}
422
- <em>&ldquo;wrap the code blocks in backticks&rdquo;</em> trick works
423
- pretty well though really.
358
+ Even though it&apos;s probably a bad idea, and historically I&apos;ve had a hard time
359
+ making it look good. This <em>&ldquo;wrap the code blocks in backticks&rdquo;</em> trick
360
+ works pretty well though really.
424
361
  </p>
425
362
  <p>
426
- Another thing I&apos;ve done in the past is put a <code>code</code>{" "}
427
- tag inside of a link, like if I wanted to tell you about the{" "}
363
+ Another thing I&apos;ve done in the past is put a <code>code</code> tag inside of a
364
+ link, like if I wanted to tell you about the{" "}
428
365
  <a href="https://github.com/tailwindcss/docs">
429
366
  <code>tailwindcss/docs</code>
430
367
  </a>{" "}
431
- repository. I don&apos;t love that there is an underline below the
432
- backticks but it is absolutely not worth the madness it would
433
- require to avoid it.
368
+ repository. I don&apos;t love that there is an underline below the backticks but it is
369
+ absolutely not worth the madness it would require to avoid it.
434
370
  </p>
435
371
  <h4>
436
372
  We haven&apos;t used an <code>h4</code> yet
437
373
  </h4>
438
374
  <p>
439
- But now we have. Please don&apos;t use <code>h5</code> or{" "}
440
- <code>h6</code> in your content, Medium only supports two heading
441
- levels for a reason, you animals. I honestly considered using a{" "}
442
- <code>before</code> pseudo-element to scream at you if you use an{" "}
375
+ But now we have. Please don&apos;t use <code>h5</code> or <code>h6</code> in your
376
+ content, Medium only supports two heading levels for a reason, you animals. I honestly
377
+ considered using a <code>before</code> pseudo-element to scream at you if you use an{" "}
443
378
  <code>h5</code> or <code>h6</code>.
444
379
  </p>
445
380
  <p>
446
- We don&apos;t style them at all out of the box because{" "}
447
- <code>h4</code> elements are already so small that they are the same
448
- size as the body copy. What are we supposed to do with an{" "}
449
- <code>h5</code>, make it <em>smaller</em> than the body copy? No
450
- thanks.
381
+ We don&apos;t style them at all out of the box because <code>h4</code> elements are
382
+ already so small that they are the same size as the body copy. What are we supposed to
383
+ do with an <code>h5</code>, make it <em>smaller</em> than the body copy? No thanks.
451
384
  </p>
452
385
  <h3>We still need to think about stacked headings though.</h3>
453
386
  <h4>
454
- Let&apos;s make sure we don&apos;t screw that up with{" "}
455
- <code>h4</code> elements, either.
387
+ Let&apos;s make sure we don&apos;t screw that up with <code>h4</code> elements, either.
456
388
  </h4>
457
389
  <p>
458
- Phew, with any luck we have styled the headings above this text and
459
- they look pretty good.
390
+ Phew, with any luck we have styled the headings above this text and they look pretty
391
+ good.
460
392
  </p>
461
393
  <p>
462
- Let&apos;s add a closing paragraph here so things end with a
463
- decently sized block of text. I can&apos;t explain why I want things
464
- to end that way but I have to assume it&apos;s because I think
465
- things will look weird or unbalanced if there is a heading too close
466
- to the end of the document.
394
+ Let&apos;s add a closing paragraph here so things end with a decently sized block of
395
+ text. I can&apos;t explain why I want things to end that way but I have to assume
396
+ it&apos;s because I think things will look weird or unbalanced if there is a heading too
397
+ close to the end of the document.
467
398
  </p>
468
399
  <p>
469
- What I&apos;ve written here is probably long enough, but adding this
470
- final sentence can&apos;t hurt.
400
+ What I&apos;ve written here is probably long enough, but adding this final sentence
401
+ can&apos;t hurt.
471
402
  </p>
472
403
  </div>
473
404
  </div>
@@ -11,22 +11,21 @@ export const TypographyScale = () => {
11
11
  <sub>subscript text</sub>
12
12
 
13
13
  <p>
14
- Paragraph. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
15
- Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore
16
- consectetur, neque doloribus, cupiditate numquam dignissimos laborum
17
- fugiat deleniti? Eum quasi quidem quibusdam.
14
+ Paragraph. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur
15
+ unde suscipit, quam beatae rerum inventore consectetur, neque doloribus, cupiditate numquam
16
+ dignissimos laborum fugiat deleniti? Eum quasi quidem quibusdam.
18
17
  </p>
19
18
 
20
19
  <button type="button">Primary button text</button>
21
20
  <blockquote>
22
- Blockquote: Lorem ipsum dolor sit amet, consectetur adipisicing elit.
23
- Quos blanditiis tenetur unde suscipit, quam beatae
21
+ Blockquote: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis
22
+ tenetur unde suscipit, quam beatae
24
23
  </blockquote>
25
24
  <dl>
26
25
  <dt>Description term</dt>
27
26
  <dd>
28
- Description detail: Lorem ipsum dolor sit amet, consectetur
29
- adipisicing elit. Quos blanditiis tenetur unde suscipit, quam beatae
27
+ Description detail: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
28
+ blanditiis tenetur unde suscipit, quam beatae
30
29
  </dd>
31
30
  </dl>
32
31
  </div>
@@ -1,4 +1,5 @@
1
- import { type ClassValue, clsx } from "clsx";
1
+ import type { ClassValue } from "clsx";
2
+ import { clsx } from "clsx";
2
3
  import { twMerge } from "tailwind-merge";
3
4
 
4
5
  export function cn(...inputs: ClassValue[]) {
@@ -12,15 +12,13 @@ const createPathObject = (
12
12
 
13
13
  export const getSubpaths = (
14
14
  pathname: string,
15
- pathLabels?: Record<string, string> | undefined,
15
+ pathLabels?: Record<string, string>,
16
16
  includeRoot?: boolean
17
17
  ) => {
18
18
  const segments = pathname?.split(PATH_SEPARATOR).filter(Boolean);
19
19
 
20
20
  const breadcrumbs = segments.map((segment, index) => {
21
- const path = `${PATH_SEPARATOR}${segments
22
- .slice(0, index + 1)
23
- .join(PATH_SEPARATOR)}`;
21
+ const path = `${PATH_SEPARATOR}${segments.slice(0, index + 1).join(PATH_SEPARATOR)}`;
24
22
 
25
23
  return createPathObject(segment, path, pathLabels);
26
24
  });
@@ -6,5 +6,5 @@
6
6
  "moduleResolution": "bundler",
7
7
  "allowSyntheticDefaultImports": true
8
8
  },
9
- "include": ["vite.config.ts", ".storybook"]
9
+ "include": ["vite*.config.ts", ".storybook"]
10
10
  }
package/vitest-setup.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { afterEach, vi } from "vitest";
2
1
  import { cleanup } from "@testing-library/react";
2
+ import { afterEach, vi } from "vitest";
3
3
  import "@testing-library/jest-dom/vitest";
4
4
 
5
5
  // Mock the ResizeObserver
@@ -15,6 +15,22 @@ vi.stubGlobal("ResizeObserver", ResizeObserverMock);
15
15
  // Mock the scrollTo method
16
16
  vi.stubGlobal("scrollTo", vi.fn());
17
17
 
18
+ window.HTMLElement.prototype.scrollIntoView = vi.fn();
19
+
20
+ Object.defineProperty(window, "matchMedia", {
21
+ writable: true,
22
+ value: vi.fn().mockImplementation((query: MediaQueryList) => ({
23
+ matches: false,
24
+ media: query,
25
+ onchange: null,
26
+ addListener: vi.fn(),
27
+ removeListener: vi.fn(),
28
+ addEventListener: vi.fn(),
29
+ removeEventListener: vi.fn(),
30
+ dispatchEvent: vi.fn(),
31
+ })),
32
+ });
33
+
18
34
  // runs a cleanup after each test case (e.g. clearing jsdom)
19
35
  afterEach(() => {
20
36
  cleanup();
package/vitest.config.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { defineConfig } from "vitest/config";
2
1
  import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vitest/config";
3
3
 
4
4
  export default defineConfig({
5
5
  plugins: [react()],
@@ -10,6 +10,7 @@ export default defineConfig({
10
10
  coverage: {
11
11
  all: false,
12
12
  enabled: true,
13
+ ignoreEmptyLines: true,
13
14
  provider: "v8",
14
15
  reporter: ["text", "html", "clover", "json"],
15
16
  reportsDirectory: "coverage",