@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.
- package/dist/types/components/Accordion/Accordion.d.ts +1 -1
- package/dist/types/components/Accordion/constants.d.ts +3 -3
- package/dist/types/components/Accordion/index.d.ts +1 -1
- package/dist/types/components/Accordion/types.d.ts +0 -1
- package/dist/types/components/Alert/Alert.d.ts +1 -1
- package/dist/types/components/Alert/constants.d.ts +1 -1
- package/dist/types/components/Alert/index.d.ts +1 -1
- package/dist/types/components/Alert/types.d.ts +2 -3
- package/dist/types/components/AlertDialog/AlertDialog.d.ts +3 -3
- package/dist/types/components/AlertDialog/constants.d.ts +1 -1
- package/dist/types/components/AlertDialog/index.d.ts +1 -1
- package/dist/types/components/AlertDialog/types.d.ts +3 -4
- package/dist/types/components/Anchor/Anchor.d.ts +1 -1
- package/dist/types/components/Anchor/constant.d.ts +1 -1
- package/dist/types/components/Anchor/index.d.ts +1 -1
- package/dist/types/components/Anchor/types.d.ts +2 -3
- package/dist/types/components/Avatar/Avatar.d.ts +1 -1
- package/dist/types/components/Avatar/constants.d.ts +3 -3
- package/dist/types/components/Avatar/index.d.ts +1 -1
- package/dist/types/components/Avatar/types.d.ts +2 -3
- package/dist/types/components/Badge/Badge.d.ts +1 -1
- package/dist/types/components/Badge/constants.d.ts +1 -1
- package/dist/types/components/Badge/types.d.ts +2 -3
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/types/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/types/components/Breadcrumbs/types.d.ts +0 -1
- package/dist/types/components/Button/Button.d.ts +3 -3
- package/dist/types/components/Button/constants.d.ts +1 -1
- package/dist/types/components/Button/index.d.ts +1 -1
- package/dist/types/components/Button/types.d.ts +3 -3
- package/dist/types/components/Calendar/Calendar.d.ts +1 -1
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Calendar/types.d.ts +1 -2
- package/dist/types/components/Card/Card.d.ts +1 -1
- package/dist/types/components/Card/constants.d.ts +1 -1
- package/dist/types/components/Card/index.d.ts +1 -1
- package/dist/types/components/Card/types.d.ts +3 -3
- package/dist/types/components/Carousel/Carousel.d.ts +11 -12
- package/dist/types/components/Carousel/CarouselContext.d.ts +2 -3
- package/dist/types/components/Carousel/constants.d.ts +4 -4
- package/dist/types/components/Carousel/index.d.ts +1 -1
- package/dist/types/components/Carousel/types.d.ts +1 -2
- package/dist/types/components/Carousel/useCarousel.d.ts +1 -1
- package/dist/types/components/Collapsible/Collapsible.d.ts +3 -4
- package/dist/types/components/Collapsible/index.d.ts +1 -1
- package/dist/types/components/Collapsible/types.d.ts +0 -1
- package/dist/types/components/Combobox/Combobox.d.ts +1 -1
- package/dist/types/components/Combobox/index.d.ts +1 -1
- package/dist/types/components/Command/Command.d.ts +24 -24
- package/dist/types/components/Command/constants.d.ts +11 -11
- package/dist/types/components/Command/index.d.ts +1 -1
- package/dist/types/components/Command/types.d.ts +4 -5
- package/dist/types/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/types/components/DatePicker/DateRangePicker.d.ts +1 -1
- package/dist/types/components/DatePicker/MultipleDatesPicker.d.ts +1 -1
- package/dist/types/components/DatePicker/index.d.ts +3 -3
- package/dist/types/components/DatePicker/types.d.ts +6 -7
- package/dist/types/components/Description/Description.d.ts +1 -1
- package/dist/types/components/Description/index.d.ts +1 -1
- package/dist/types/components/Description/types.d.ts +0 -1
- package/dist/types/components/Dialog/Dialog.d.ts +3 -3
- package/dist/types/components/Dialog/constants.d.ts +7 -7
- package/dist/types/components/Dialog/index.d.ts +1 -1
- package/dist/types/components/Dialog/types.d.ts +2 -3
- package/dist/types/components/Drawer/Drawer.d.ts +15 -20
- package/dist/types/components/Drawer/constants.d.ts +6 -6
- package/dist/types/components/Drawer/index.d.ts +1 -1
- package/dist/types/components/Drawer/types.d.ts +1 -2
- package/dist/types/components/FileUploader/FileUploader.d.ts +4 -5
- package/dist/types/components/FileUploader/FileUploaderContext.d.ts +2 -3
- package/dist/types/components/FileUploader/index.d.ts +1 -1
- package/dist/types/components/FileUploader/types.d.ts +2 -2
- package/dist/types/components/FileUploader/useFileUpload.d.ts +1 -1
- package/dist/types/components/Form/Checkbox/constants.d.ts +1 -1
- package/dist/types/components/Form/Checkbox/index.d.ts +1 -1
- package/dist/types/components/Form/Checkbox/types.d.ts +2 -3
- package/dist/types/components/Form/Input/Input.d.ts +2 -2
- package/dist/types/components/Form/Input/constants.d.ts +1 -1
- package/dist/types/components/Form/Input/index.d.ts +1 -1
- package/dist/types/components/Form/Input/types.d.ts +2 -3
- package/dist/types/components/Form/OtpInput/OtpInput.d.ts +1 -1
- package/dist/types/components/Form/OtpInput/index.d.ts +1 -1
- package/dist/types/components/Form/OtpInput/types.d.ts +2 -2
- package/dist/types/components/Form/Phone/Phone.d.ts +2 -2
- package/dist/types/components/Form/Phone/constants.d.ts +2 -2
- package/dist/types/components/Form/Phone/index.d.ts +1 -1
- package/dist/types/components/Form/Phone/types.d.ts +1 -1
- package/dist/types/components/Form/Radio/constants.d.ts +1 -1
- package/dist/types/components/Form/Radio/index.d.ts +1 -1
- package/dist/types/components/Form/Radio/types.d.ts +2 -3
- package/dist/types/components/Form/Range/Range.d.ts +1 -1
- package/dist/types/components/Form/Range/constants.d.ts +1 -1
- package/dist/types/components/Form/Range/index.d.ts +1 -1
- package/dist/types/components/Form/Range/types.d.ts +2 -3
- package/dist/types/components/Form/Select/Select.d.ts +2 -2
- package/dist/types/components/Form/Select/constants.d.ts +6 -6
- package/dist/types/components/Form/Select/index.d.ts +1 -1
- package/dist/types/components/Form/Select/types.d.ts +2 -3
- package/dist/types/components/Form/Slider/constants.d.ts +4 -4
- package/dist/types/components/Form/Slider/index.d.ts +1 -1
- package/dist/types/components/Form/Slider/types.d.ts +2 -3
- package/dist/types/components/Form/Switch/constants.d.ts +1 -1
- package/dist/types/components/Form/Switch/index.d.ts +1 -1
- package/dist/types/components/Form/Switch/types.d.ts +2 -3
- package/dist/types/components/Form/TextField/TextField.d.ts +3 -3
- package/dist/types/components/Form/TextField/constants.d.ts +1 -1
- package/dist/types/components/Form/TextField/index.d.ts +1 -1
- package/dist/types/components/Form/TextField/types.d.ts +2 -2
- package/dist/types/components/Form/Textarea/Textarea.d.ts +1 -1
- package/dist/types/components/Form/Textarea/constants.d.ts +1 -1
- package/dist/types/components/Form/Textarea/index.d.ts +1 -1
- package/dist/types/components/Form/Textarea/types.d.ts +2 -3
- package/dist/types/components/Form/components/FormControl/FormControl.d.ts +1 -1
- package/dist/types/components/Form/components/FormControl/constants.d.ts +1 -1
- package/dist/types/components/Form/components/FormControl/index.d.ts +1 -1
- package/dist/types/components/Form/components/FormControl/types.d.ts +2 -3
- package/dist/types/components/Form/components/Label/Label.d.ts +1 -1
- package/dist/types/components/Form/components/Label/constants.d.ts +1 -1
- package/dist/types/components/Form/components/Label/index.d.ts +1 -1
- package/dist/types/components/Form/components/Label/types.d.ts +3 -4
- package/dist/types/components/Form/index.d.ts +13 -13
- package/dist/types/components/HoverCard/HoverCard.d.ts +3 -4
- package/dist/types/components/HoverCard/constants.d.ts +1 -1
- package/dist/types/components/HoverCard/index.d.ts +1 -1
- package/dist/types/components/HoverCard/types.d.ts +0 -1
- package/dist/types/components/Loading/Loading.d.ts +1 -1
- package/dist/types/components/Loading/constants.d.ts +1 -1
- package/dist/types/components/Loading/index.d.ts +1 -1
- package/dist/types/components/Loading/types.d.ts +2 -3
- package/dist/types/components/Menu/ContextMenu/ContextMenu.d.ts +19 -20
- package/dist/types/components/Menu/ContextMenu/index.d.ts +1 -1
- package/dist/types/components/Menu/ContextMenu/types.d.ts +2 -3
- package/dist/types/components/Menu/DropdownMenu/DropdownMenu.d.ts +19 -20
- package/dist/types/components/Menu/DropdownMenu/index.d.ts +1 -1
- package/dist/types/components/Menu/DropdownMenu/types.d.ts +2 -3
- package/dist/types/components/Menu/Menubar/constants.d.ts +11 -11
- package/dist/types/components/Menu/Menubar/index.d.ts +1 -1
- package/dist/types/components/Menu/Menubar/types.d.ts +2 -3
- package/dist/types/components/Menu/NavigationMenu/NavigationMenu.d.ts +9 -10
- package/dist/types/components/Menu/NavigationMenu/constants.d.ts +6 -6
- package/dist/types/components/Menu/NavigationMenu/index.d.ts +1 -1
- package/dist/types/components/Menu/NavigationMenu/types.d.ts +2 -3
- package/dist/types/components/Menu/index.d.ts +4 -4
- package/dist/types/components/Pagination/Pagination.d.ts +3 -4
- package/dist/types/components/Pagination/constants.d.ts +5 -5
- package/dist/types/components/Pagination/index.d.ts +1 -1
- package/dist/types/components/Pagination/types.d.ts +2 -3
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/constants.d.ts +1 -1
- package/dist/types/components/Popover/index.d.ts +1 -1
- package/dist/types/components/Popover/types.d.ts +2 -3
- package/dist/types/components/Progress/Progress.d.ts +1 -1
- package/dist/types/components/Progress/constants.d.ts +2 -2
- package/dist/types/components/Progress/index.d.ts +1 -1
- package/dist/types/components/Progress/types.d.ts +2 -3
- package/dist/types/components/ScrollArea/ScrollArea.d.ts +3 -4
- package/dist/types/components/ScrollArea/constants.d.ts +4 -4
- package/dist/types/components/ScrollArea/index.d.ts +1 -1
- package/dist/types/components/ScrollArea/types.d.ts +2 -3
- package/dist/types/components/Separator/Separator.d.ts +1 -1
- package/dist/types/components/Separator/constants.d.ts +1 -1
- package/dist/types/components/Separator/index.d.ts +1 -1
- package/dist/types/components/Separator/types.d.ts +0 -1
- package/dist/types/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/Skeleton/constants.d.ts +1 -1
- package/dist/types/components/Skeleton/index.d.ts +1 -1
- package/dist/types/components/Skeleton/types.d.ts +2 -3
- package/dist/types/components/Slot/Slot.d.ts +1 -1
- package/dist/types/components/Slot/index.d.ts +1 -1
- package/dist/types/components/Sonner/Toaster.d.ts +1 -1
- package/dist/types/components/Sonner/constants.d.ts +2 -2
- package/dist/types/components/Sonner/index.d.ts +2 -2
- package/dist/types/components/Sonner/types.d.ts +3 -4
- package/dist/types/components/Table/Table.d.ts +8 -9
- package/dist/types/components/Table/constants.d.ts +2 -2
- package/dist/types/components/Table/index.d.ts +1 -1
- package/dist/types/components/Table/types.d.ts +2 -3
- package/dist/types/components/Tabs/Tabs.d.ts +1 -1
- package/dist/types/components/Tabs/constants.d.ts +3 -3
- package/dist/types/components/Tabs/index.d.ts +1 -1
- package/dist/types/components/Tabs/types.d.ts +2 -3
- package/dist/types/components/Text/Text.d.ts +1 -1
- package/dist/types/components/Text/constants.d.ts +1 -1
- package/dist/types/components/Text/types.d.ts +2 -3
- package/dist/types/components/ThemeSwitch/ThemeSwitch.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/constants.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/index.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/types.d.ts +1 -2
- package/dist/types/components/Toggle/Toggle.d.ts +1 -1
- package/dist/types/components/Toggle/constants.d.ts +1 -1
- package/dist/types/components/Toggle/index.d.ts +1 -1
- package/dist/types/components/Toggle/types.d.ts +3 -4
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +4 -5
- package/dist/types/components/ToggleGroup/constants.d.ts +1 -1
- package/dist/types/components/ToggleGroup/index.d.ts +1 -1
- package/dist/types/components/ToggleGroup/types.d.ts +1 -2
- package/dist/types/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/types/components/Tooltip/constants.d.ts +2 -2
- package/dist/types/components/Tooltip/index.d.ts +1 -1
- package/dist/types/components/Tooltip/types.d.ts +2 -3
- package/dist/types/index.d.ts +36 -36
- package/dist/types/libs/cva.d.ts +2 -2
- package/dist/types/libs/index.d.ts +1 -1
- package/dist/types/utilities/cn.d.ts +1 -1
- package/dist/types/utilities/getSubpaths/getSubpaths.d.ts +1 -1
- package/dist/types/utilities/getSubpaths/index.d.ts +1 -1
- package/dist/types/utilities/index.d.ts +3 -3
- package/package.json +82 -73
- package/src/components/Accordion/Accordion.tsx +3 -9
- package/src/components/Accordion/types.ts +2 -6
- package/src/components/Alert/Alert.tsx +3 -14
- package/src/components/AlertDialog/AlertDialog.tsx +3 -6
- package/src/components/AlertDialog/types.ts +3 -5
- package/src/components/Anchor/Anchor.tsx +3 -5
- package/src/components/Avatar/Avatar.tsx +5 -25
- package/src/components/Avatar/constants.ts +15 -18
- package/src/components/Avatar/types.ts +1 -5
- package/src/components/Badge/Badge.tsx +2 -12
- package/src/components/Badge/index.ts +1 -1
- package/src/components/Button/Button.tsx +5 -21
- package/src/components/Button/constants.ts +1 -1
- package/src/components/Button/types.ts +1 -1
- package/src/components/Calendar/Calendar.tsx +40 -34
- package/src/components/Card/Card.tsx +4 -14
- package/src/components/Card/types.ts +1 -2
- package/src/components/Carousel/Carousel.tsx +68 -73
- package/src/components/Carousel/constants.ts +10 -13
- package/src/components/Carousel/types.ts +1 -1
- package/src/components/Collapsible/Collapsible.tsx +2 -4
- package/src/components/Collapsible/types.ts +1 -3
- package/src/components/Combobox/Combobox.tsx +3 -8
- package/src/components/Command/Command.tsx +11 -28
- package/src/components/Command/constants.ts +2 -6
- package/src/components/Command/types.ts +3 -7
- package/src/components/DatePicker/DatePicker.tsx +5 -9
- package/src/components/DatePicker/DateRangePicker.tsx +5 -9
- package/src/components/DatePicker/MultipleDatesPicker.tsx +6 -10
- package/src/components/DatePicker/types.ts +12 -23
- package/src/components/Description/Description.tsx +4 -19
- package/src/components/Dialog/Dialog.tsx +5 -9
- package/src/components/Dialog/constants.ts +2 -6
- package/src/components/Dialog/types.ts +5 -15
- package/src/components/Drawer/Drawer.tsx +6 -19
- package/src/components/Drawer/constants.ts +2 -6
- package/src/components/FileUploader/FileUploader.tsx +31 -53
- package/src/components/FileUploader/FileUploaderContext.tsx +1 -2
- package/src/components/FileUploader/types.ts +1 -1
- package/src/components/Form/Checkbox/Checkbox.tsx +2 -2
- package/src/components/Form/Checkbox/types.ts +1 -4
- package/src/components/Form/Input/Input.tsx +3 -9
- package/src/components/Form/Input/constants.ts +47 -50
- package/src/components/Form/Input/types.ts +1 -4
- package/src/components/Form/OtpInput/OtpInput.tsx +5 -12
- package/src/components/Form/Phone/Phone.tsx +6 -15
- package/src/components/Form/Radio/Radio.tsx +2 -2
- package/src/components/Form/Radio/types.ts +1 -4
- package/src/components/Form/Range/Range.tsx +3 -6
- package/src/components/Form/Range/types.ts +1 -4
- package/src/components/Form/Select/Select.tsx +26 -49
- package/src/components/Form/Select/types.ts +3 -9
- package/src/components/Form/Slider/Slider.tsx +39 -25
- package/src/components/Form/Slider/constants.ts +21 -24
- package/src/components/Form/Slider/types.ts +2 -4
- package/src/components/Form/Switch/Switch.tsx +2 -3
- package/src/components/Form/Switch/types.ts +1 -4
- package/src/components/Form/TextField/TextField.tsx +2 -2
- package/src/components/Form/Textarea/Textarea.tsx +2 -5
- package/src/components/Form/Textarea/constants.ts +42 -45
- package/src/components/Form/components/FormControl/FormControl.tsx +1 -1
- package/src/components/Form/components/Label/Label.tsx +2 -5
- package/src/components/Form/components/Label/types.ts +2 -4
- package/src/components/HoverCard/HoverCard.tsx +2 -4
- package/src/components/HoverCard/types.ts +1 -3
- package/src/components/Loading/Loading.tsx +3 -12
- package/src/components/Menu/ContextMenu/ContextMenu.tsx +5 -17
- package/src/components/Menu/ContextMenu/types.ts +1 -3
- package/src/components/Menu/DropdownMenu/DropdownMenu.tsx +7 -21
- package/src/components/Menu/DropdownMenu/types.ts +1 -3
- package/src/components/Menu/Menubar/Menubar.tsx +33 -49
- package/src/components/Menu/Menubar/types.ts +5 -15
- package/src/components/Menu/NavigationMenu/NavigationMenu.tsx +4 -13
- package/src/components/Pagination/Pagination.tsx +18 -42
- package/src/components/Pagination/constants.ts +2 -6
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Popover/types.ts +2 -6
- package/src/components/Progress/Progress.tsx +2 -4
- package/src/components/Progress/constants.ts +38 -44
- package/src/components/ScrollArea/ScrollArea.tsx +4 -16
- package/src/components/ScrollArea/constants.ts +8 -13
- package/src/components/ScrollArea/types.ts +1 -3
- package/src/components/Separator/Separator.tsx +2 -2
- package/src/components/Separator/types.ts +1 -3
- package/src/components/Skeleton/Skeleton.tsx +4 -14
- package/src/components/Sonner/Toaster.tsx +2 -4
- package/src/components/Sonner/constants.ts +10 -20
- package/src/components/Sonner/types.ts +4 -10
- package/src/components/Table/Table.tsx +23 -38
- package/src/components/Tabs/Tabs.tsx +9 -31
- package/src/components/Tabs/types.ts +5 -17
- package/src/components/Text/Text.tsx +3 -6
- package/src/components/Text/index.ts +1 -1
- package/src/components/Text/types.ts +1 -3
- package/src/components/ThemeSwitch/ThemeSwitch.tsx +3 -2
- package/src/components/Toggle/Toggle.tsx +15 -16
- package/src/components/Toggle/types.ts +2 -7
- package/src/components/ToggleGroup/ToggleGroup.tsx +5 -19
- package/src/components/ToggleGroup/constants.ts +1 -3
- package/src/components/ToggleGroup/types.ts +1 -3
- package/src/components/Tooltip/Tooltip.tsx +2 -4
- package/src/components/Tooltip/types.ts +1 -1
- package/src/libs/cva.ts +1 -3
- package/src/typography/TypographyDemo.tsx +119 -188
- package/src/typography/TypographyScale.tsx +7 -8
- package/src/utilities/cn.ts +2 -1
- package/src/utilities/getSubpaths/getSubpaths.ts +2 -4
- package/tsconfig.node.json +1 -1
- package/vitest-setup.ts +17 -1
- package/vitest.config.ts +2 -1
- 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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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're not convinced that simply disabling our
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
look <em>awesome</em>, not awful.
|
|
53
|
+
We hear you, but we're not convinced that simply disabling our base styles is what
|
|
54
|
+
you really want. You don'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
|
-
|
|
66
|
-
|
|
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
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
<
|
|
108
|
-
blocks, block quotes, <em>and even italics</em>.
|
|
109
|
-
</p>
|
|
110
|
-
<p>
|
|
111
|
-
It'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'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'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's the whole point of the plugin.</li>
|
|
116
107
|
<li>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</li>
|
|
120
|
-
<li>
|
|
121
|
-
Here's a third pretend reason though a list with three items
|
|
122
|
-
looks more realistic than a list with two items.
|
|
108
|
+
Here'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're going to try out another header style.</p>
|
|
126
113
|
<h3>Typography should be easy</h3>
|
|
127
114
|
<p>
|
|
128
|
-
So that's a header for you — with any luck if we've done
|
|
129
|
-
|
|
115
|
+
So that's a header for you — with any luck if we'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't want your stuff
|
|
135
|
-
|
|
121
|
+
Typography is pretty important if you don't want your stuff to look like trash.
|
|
122
|
+
Make it good then it won't be bad.
|
|
136
123
|
</p>
|
|
137
124
|
</blockquote>
|
|
138
|
-
<p>
|
|
139
|
-
It's probably important that images look okay here by default
|
|
140
|
-
as well:
|
|
141
|
-
</p>
|
|
125
|
+
<p>It'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&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&q=80"
|
|
145
129
|
alt=""
|
|
146
130
|
/>
|
|
147
131
|
<figcaption>
|
|
148
|
-
Contrary to popular belief, Lorem Ipsum is not simply random text.
|
|
149
|
-
|
|
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'm going to show you an example of an unordered list to
|
|
155
|
-
|
|
137
|
+
Now I'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
|
-
|
|
168
|
-
|
|
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
|
-
|
|
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'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
|
-
|
|
164
|
+
For some reason I think this looks cool which is unfortunate because it'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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
just shouldn'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'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'm doing already in the previous list
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
I've added this second list item so I actually have
|
|
179
|
+
I explained what I'm doing already in the previous list item, but a list
|
|
180
|
+
wouldn't be a list if it only had one item, and we really want this to look
|
|
181
|
+
realistic. That's why I'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's not a bad idea to add a third item either.
|
|
214
|
-
</strong>
|
|
187
|
+
<strong>It's not a bad idea to add a third item either.</strong>
|
|
215
188
|
</p>
|
|
216
189
|
<p>
|
|
217
|
-
I think it probably would've been fine to just use two
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
well include it.
|
|
190
|
+
I think it probably would'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
|
-
|
|
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://
|
|
232
|
-
<
|
|
233
|
-
|
|
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'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's what a default <code>tailwind.config.js</code> file
|
|
238
|
-
|
|
208
|
+
Here'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
|
-
|
|
257
|
-
|
|
258
|
-
making it work.
|
|
226
|
+
Nested lists basically always look bad which is why editors like Medium don'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
|
-
|
|
267
|
-
a gross shape on the screen that is hard to read.
|
|
235
|
+
You might feel like you are being really “organized” 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's another one.
|
|
282
|
-
</strong>
|
|
245
|
+
<strong>Since we need to have more items, here's another one.</strong>
|
|
283
246
|
<ul>
|
|
284
|
-
<li>
|
|
285
|
-
|
|
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'm not sure if we'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't really a list, three is good though.
|
|
297
|
-
</strong>
|
|
253
|
+
<strong>Two items isn't really a list, three is good though.</strong>
|
|
298
254
|
<ul>
|
|
299
255
|
<li>
|
|
300
|
-
Again please don't nest lists if you want people to
|
|
301
|
-
|
|
256
|
+
Again please don'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'm upset that we even have to bother styling this.
|
|
306
|
-
</li>
|
|
260
|
+
<li>I'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><
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
annoying situation too.
|
|
265
|
+
The most annoying thing about lists in Markdown is that <code><li></code> elements
|
|
266
|
+
aren't given a child <code><p></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've added a second line,
|
|
344
|
-
|
|
345
|
-
</p>
|
|
346
|
-
<p>
|
|
347
|
-
This is the second line I'm talking about by the way.
|
|
291
|
+
As you can see here, because I've added a second line, this list item now
|
|
292
|
+
has a <code><p></code> tag.
|
|
348
293
|
</p>
|
|
294
|
+
<p>This is the second line I'm talking about by the way.</p>
|
|
349
295
|
</li>
|
|
350
296
|
<li>
|
|
351
|
-
<p>
|
|
352
|
-
Finally here's another list item so it's more like
|
|
353
|
-
a list.
|
|
354
|
-
</p>
|
|
297
|
+
<p>Finally here's another list item so it'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
|
-
|
|
370
|
-
</a>
|
|
371
|
-
. We almost made them blue but that'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'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
|
-
|
|
414
|
-
|
|
350
|
+
We also need to make sure inline code looks good, like if I wanted to talk about{" "}
|
|
351
|
+
<code><span></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's probably a bad idea, and historically
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
pretty well though really.
|
|
358
|
+
Even though it's probably a bad idea, and historically I've had a hard time
|
|
359
|
+
making it look good. This <em>“wrap the code blocks in backticks”</em> trick
|
|
360
|
+
works pretty well though really.
|
|
424
361
|
</p>
|
|
425
362
|
<p>
|
|
426
|
-
Another thing I've done in the past is put a <code>code</code>
|
|
427
|
-
|
|
363
|
+
Another thing I'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't love that there is an underline below the
|
|
432
|
-
|
|
433
|
-
require to avoid it.
|
|
368
|
+
repository. I don'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't used an <code>h4</code> yet
|
|
437
373
|
</h4>
|
|
438
374
|
<p>
|
|
439
|
-
But now we have. Please don't use <code>h5</code> or
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
<code>before</code> pseudo-element to scream at you if you use an{" "}
|
|
375
|
+
But now we have. Please don'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't style them at all out of the box because
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
<code>h5</code>, make it <em>smaller</em> than the body copy? No
|
|
450
|
-
thanks.
|
|
381
|
+
We don'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's make sure we don't screw that up with
|
|
455
|
-
<code>h4</code> elements, either.
|
|
387
|
+
Let's make sure we don'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
|
-
|
|
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's add a closing paragraph here so things end with a
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
to the end of the document.
|
|
394
|
+
Let's add a closing paragraph here so things end with a decently sized block of
|
|
395
|
+
text. I can't explain why I want things to end that way but I have to assume
|
|
396
|
+
it'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've written here is probably long enough, but adding this
|
|
470
|
-
|
|
400
|
+
What I've written here is probably long enough, but adding this final sentence
|
|
401
|
+
can'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
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>
|
package/src/utilities/cn.ts
CHANGED
|
@@ -12,15 +12,13 @@ const createPathObject = (
|
|
|
12
12
|
|
|
13
13
|
export const getSubpaths = (
|
|
14
14
|
pathname: string,
|
|
15
|
-
pathLabels?: Record<string, string
|
|
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
|
});
|
package/tsconfig.node.json
CHANGED
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",
|