@agilant/toga-blox 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/cable.jpg +0 -0
- package/assets/card-1.jpg +0 -0
- package/assets/cat-logo.png +0 -0
- package/assets/item.jpg +0 -0
- package/assets/map.png +0 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +953 -0
- package/coverage/coverage-final.json +74 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +551 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/toga-blox-npm/index.html +131 -0
- package/coverage/toga-blox-npm/postcss.config.js.html +103 -0
- package/coverage/toga-blox-npm/src/components/Badge/Badge.stories.tsx.html +793 -0
- package/coverage/toga-blox-npm/src/components/Badge/Badge.tsx.html +247 -0
- package/coverage/toga-blox-npm/src/components/Badge/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Card/Card.stories.tsx.html +787 -0
- package/coverage/toga-blox-npm/src/components/Card/Card.tsx.html +163 -0
- package/coverage/toga-blox-npm/src/components/Card/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CategoryCardTemplate.tsx.html +343 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CompassCardTemplate.tsx.html +259 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CounterContentCardTemplate.tsx.html +685 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/HorizontalCardTemplate.tsx.html +637 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/ItemCardTemplate.tsx.html +550 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/KitContentCardTemplate.tsx.html +469 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/ShippingAddressCardTemplate.tsx.html +418 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/VerticalCardTemplate.tsx.html +592 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/index.html +221 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.stories.tsx.html +358 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.tsx.html +385 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Description/Description.stories.tsx.html +286 -0
- package/coverage/toga-blox-npm/src/components/Description/Description.tsx.html +124 -0
- package/coverage/toga-blox-npm/src/components/Description/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.stories.tsx.html +676 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.tsx.html +346 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Footer/ContactInfoItem.tsx.html +139 -0
- package/coverage/toga-blox-npm/src/components/Footer/Footer.stories.tsx.html +934 -0
- package/coverage/toga-blox-npm/src/components/Footer/Footer.tsx.html +373 -0
- package/coverage/toga-blox-npm/src/components/Footer/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.stories.tsx.html +952 -0
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.tsx.html +343 -0
- package/coverage/toga-blox-npm/src/components/FormButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.stories.tsx.html +376 -0
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.tsx.html +520 -0
- package/coverage/toga-blox-npm/src/components/GenericList/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DummyDataList.tsx.html +154 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DynamicIconList.tsx.html +250 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.stories.tsx.html +325 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.tsx.html +262 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/Hamburger.stories.tsx.html +760 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/HamburgerButton.tsx.html +232 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Header/Header.stories.tsx.html +1633 -0
- package/coverage/toga-blox-npm/src/components/Header/Header.tsx.html +814 -0
- package/coverage/toga-blox-npm/src/components/Header/headerContext.tsx.html +460 -0
- package/coverage/toga-blox-npm/src/components/Header/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/Hero/Hero.stories.tsx.html +289 -0
- package/coverage/toga-blox-npm/src/components/Hero/Hero.tsx.html +259 -0
- package/coverage/toga-blox-npm/src/components/Hero/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.stories.tsx.html +673 -0
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.tsx.html +313 -0
- package/coverage/toga-blox-npm/src/components/IconButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Image/Image.stories.tsx.html +322 -0
- package/coverage/toga-blox-npm/src/components/Image/Image.tsx.html +226 -0
- package/coverage/toga-blox-npm/src/components/Image/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Input/Input.stories.tsx.html +1621 -0
- package/coverage/toga-blox-npm/src/components/Input/Input.tsx.html +568 -0
- package/coverage/toga-blox-npm/src/components/Input/InputMemoTypes.tsx.html +181 -0
- package/coverage/toga-blox-npm/src/components/Input/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/MobileMenu/MobileMenu.tsx.html +208 -0
- package/coverage/toga-blox-npm/src/components/MobileMenu/index.html +116 -0
- package/coverage/toga-blox-npm/src/components/Nav/Nav.stories.tsx.html +628 -0
- package/coverage/toga-blox-npm/src/components/Nav/Nav.tsx.html +622 -0
- package/coverage/toga-blox-npm/src/components/Nav/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Page/TableDataDummy.tsx.html +733 -0
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.stories.tsx.html +1714 -0
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.tsx.html +115 -0
- package/coverage/toga-blox-npm/src/components/Page/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.stories.tsx.html +433 -0
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.tsx.html +121 -0
- package/coverage/toga-blox-npm/src/components/PageSection/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.stories.tsx.html +517 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.tsx.html +325 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Slider/Slider.stories.tsx.html +349 -0
- package/coverage/toga-blox-npm/src/components/Slider/Slider.tsx.html +502 -0
- package/coverage/toga-blox-npm/src/components/Slider/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AdminSubmenu.tsx.html +136 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenu.tsx.html +253 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenuItem.tsx.html +202 -0
- package/coverage/toga-blox-npm/src/components/Submenus/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/Text/Text.stories.tsx.html +235 -0
- package/coverage/toga-blox-npm/src/components/Text/Text.tsx.html +172 -0
- package/coverage/toga-blox-npm/src/components/Text/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.stories.tsx.html +445 -0
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.tsx.html +301 -0
- package/coverage/toga-blox-npm/src/components/Toaster/index.html +131 -0
- package/coverage/toga-blox-npm/src/hoc/styling/index.html +116 -0
- package/coverage/toga-blox-npm/src/hoc/styling/withStoryBook.tsx.html +142 -0
- package/coverage/toga-blox-npm/src/userHoc/index.html +116 -0
- package/coverage/toga-blox-npm/src/userHoc/withMemo.tsx.html +145 -0
- package/coverage/toga-blox-npm/src/utils/assertTagName.tsx.html +106 -0
- package/coverage/toga-blox-npm/src/utils/generateAccordionItem.tsx.html +373 -0
- package/coverage/toga-blox-npm/src/utils/generateFooterContacts.tsx.html +295 -0
- package/coverage/toga-blox-npm/src/utils/generateNavMenu.tsx.html +247 -0
- package/coverage/toga-blox-npm/src/utils/generateSocialList.tsx.html +187 -0
- package/coverage/toga-blox-npm/src/utils/getFontAwesomeIcon.tsx.html +145 -0
- package/coverage/toga-blox-npm/src/utils/index.html +206 -0
- package/coverage/toga-blox-npm/src/utils/inputValidation.tsx.html +163 -0
- package/coverage/toga-blox-npm/tailwind.config.js.html +205 -0
- package/declarations.d.ts +1 -1
- package/package.json +7 -7
- package/src/components/Badge/Badge.stories.tsx +110 -207
- package/src/components/Badge/Badge.test.tsx +40 -41
- package/src/components/Badge/Badge.tsx +29 -99
- package/src/components/Badge/Badge.types.tsx +12 -23
- package/src/components/Card/Card.stories.tsx +166 -22
- package/src/components/Card/Card.test.tsx +3 -3
- package/src/components/Card/Card.tsx +12 -16
- package/src/components/Card/DUMMYPRODUCTDATA.json +381 -225
- package/src/components/Card/templates/CategoryCardTemplate.tsx +86 -0
- package/src/components/Card/templates/CompassCardTemplate.tsx +1 -1
- package/src/components/Card/templates/CounterContentCardTemplate.tsx +200 -0
- package/src/components/Card/templates/ItemCardTemplate.tsx +155 -0
- package/src/components/Card/templates/KitContentCardTemplate.tsx +128 -0
- package/src/components/Card/templates/ShippingAddressCardTemplate.tsx +111 -0
- package/src/components/Card/templates/VerticalCardTemplate.tsx +100 -85
- package/src/components/CounterButton/CounterButton.tsx +1 -1
- package/src/components/Description/Description.stories.tsx +67 -0
- package/src/components/Description/Description.tsx +13 -0
- package/src/components/Description/Description.types.ts +9 -0
- package/src/components/DropDownIconButton/DropDownIconButton.stories.tsx +197 -0
- package/src/components/DropDownIconButton/DropDownIconButton.test.tsx +90 -0
- package/src/components/DropDownIconButton/DropDownIconButton.tsx +87 -0
- package/src/components/DropDownIconButton/DropDownIconButton.types.ts +21 -0
- package/src/components/DropDownIconButton/index.ts +2 -0
- package/src/components/Footer/ContactInfoItem.tsx +8 -10
- package/src/components/Footer/Footer.stories.tsx +13 -22
- package/src/components/Footer/Footer.tsx +25 -88
- package/src/components/Footer/Footer.types.tsx +2 -2
- package/src/components/FormButton/FormButton.stories.tsx +101 -226
- package/src/components/FormButton/FormButton.test.tsx +1 -1
- package/src/components/FormButton/FormButton.tsx +34 -42
- package/src/components/FormButton/FormButton.types.ts +7 -13
- package/src/components/GenericList/GenericList.stories.tsx +5 -12
- package/src/components/GenericList/GenericList.tsx +91 -92
- package/src/components/GenericList/templates/DynamicIconList.tsx +45 -64
- package/src/components/GetSupport/GetSupport.stories.tsx +80 -0
- package/src/components/GetSupport/GetSupport.test.tsx +62 -0
- package/src/components/GetSupport/GetSupport.tsx +59 -0
- package/src/components/GetSupport/GetSupport.types.ts +11 -0
- package/src/components/HamburgerButton/Hamburger.stories.tsx +225 -0
- package/src/components/HamburgerButton/HamburgerButton.tsx +37 -56
- package/src/components/HamburgerButton/HamburgerButton.types.tsx +2 -1
- package/src/components/Header/Header.stories.tsx +3 -5
- package/src/components/Header/Header.tsx +37 -83
- package/src/components/Hero/Hero.stories.tsx +1 -2
- package/src/components/IconButton/IconButton.stories.tsx +196 -0
- package/src/components/{Icon/Icon.test.tsx → IconButton/IconButton.test.tsx} +3 -4
- package/src/components/IconButton/IconButton.tsx +76 -0
- package/src/components/IconButton/IconButton.types.ts +28 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/Image/Image.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +10 -12
- package/src/components/Input/Input.test.tsx +2 -3
- package/src/components/Input/Input.tsx +41 -104
- package/src/components/MobileMenu/MobileMenu.types.tsx +0 -2
- package/src/components/Nav/DUMMYNAVDATA.json +4 -4
- package/src/components/Nav/Nav.tsx +49 -112
- package/src/components/Nav/Nav.types.tsx +14 -2
- package/src/components/Page/ViewPageTemplate.stories.tsx +2 -2
- package/src/components/Page/ViewPageTemplate.test.tsx +1 -1
- package/src/components/Page/ViewPageTemplate.types.ts +1 -1
- package/src/components/PageSection/PageSection.stories.tsx +3 -1
- package/src/components/PageSection/PageSections.test.tsx +2 -1
- package/src/components/SearchInput/SearchInput.stories.tsx +144 -0
- package/src/components/SearchInput/SearchInput.tsx +81 -0
- package/src/components/SearchInput/SearchInput.types.ts +28 -0
- package/src/components/Slider/Slider.stories.tsx +88 -0
- package/src/components/Slider/Slider.tsx +139 -0
- package/src/components/Slider/Slider.types.ts +21 -0
- package/src/components/Submenus/AdminSubmenu.tsx +17 -0
- package/src/components/Submenus/AlertSubmenu.tsx +56 -0
- package/src/components/Submenus/AlertSubmenuItem.tsx +39 -0
- package/src/components/Submenus/types.tsx +32 -0
- package/src/components/Toaster/Toaster.stories.tsx +4 -6
- package/src/components/Toaster/Toaster.test.tsx +3 -4
- package/src/components/Toaster/Toaster.tsx +9 -17
- package/src/components/Toaster/Toaster.types.ts +2 -2
- package/src/utils/assertTagName.tsx +1 -1
- package/src/utils/generateAccordionItem.tsx +7 -13
- package/src/utils/generateFooterContacts.tsx +4 -9
- package/src/utils/getFontAwesomeIcon.tsx +8 -13
- package/tailwind.config.js +11 -3
- package/src/components/Badge/badgeClassNames.tsx +0 -173
- package/src/components/Card/cardClassNames.ts +0 -49
- package/src/components/Footer/footerClassNames.tsx +0 -57
- package/src/components/FormButton/formButtonClassNames.tsx +0 -153
- package/src/components/GenericList/genericListClassNames.tsx +0 -8
- package/src/components/Header/headerClassNames.tsx +0 -50
- package/src/components/Icon/Icon.stories.tsx +0 -227
- package/src/components/Icon/Icon.tsx +0 -208
- package/src/components/Icon/Icon.types.ts +0 -24
- package/src/components/Icon/iconClassNames.ts +0 -79
- package/src/components/Icon/index.ts +0 -2
- package/src/components/Input/inputClassNames.tsx +0 -169
- package/src/components/Nav/navClassNames.tsx +0 -192
|
@@ -8,229 +8,116 @@ export default {
|
|
|
8
8
|
title: "Components/Badge",
|
|
9
9
|
component: Badge,
|
|
10
10
|
argTypes: {
|
|
11
|
-
|
|
12
|
-
control: "none",
|
|
13
|
-
options: ["small", "medium", "large"],
|
|
14
|
-
table: {
|
|
15
|
-
disable: true,
|
|
16
|
-
},
|
|
17
|
-
description:
|
|
18
|
-
"The size of the badge (small, medium, or large). *Storybook prop only.",
|
|
19
|
-
},
|
|
20
|
-
width: {
|
|
21
|
-
control: "none",
|
|
22
|
-
table: {
|
|
23
|
-
disable: true,
|
|
24
|
-
},
|
|
25
|
-
description:
|
|
26
|
-
"Custom width for the badge. Use Tailwind CSS width classes.",
|
|
27
|
-
},
|
|
28
|
-
height: {
|
|
11
|
+
borderColor: {
|
|
29
12
|
control: "none",
|
|
30
|
-
|
|
31
|
-
disable: true,
|
|
32
|
-
},
|
|
33
|
-
description:
|
|
34
|
-
"Custom height for the badge. Use Tailwind CSS height classes.",
|
|
13
|
+
description: "Sets the border color of the badge using Tailwind CSS classes. Example: `border-gray-300`.",
|
|
35
14
|
},
|
|
36
|
-
|
|
15
|
+
borderWidth: {
|
|
37
16
|
control: "none",
|
|
38
|
-
|
|
39
|
-
disable: true,
|
|
40
|
-
},
|
|
41
|
-
options: [
|
|
42
|
-
"red",
|
|
43
|
-
"blue",
|
|
44
|
-
"green",
|
|
45
|
-
"black",
|
|
46
|
-
"white",
|
|
47
|
-
"orange",
|
|
48
|
-
"purple",
|
|
49
|
-
"none",
|
|
50
|
-
],
|
|
51
|
-
description:
|
|
52
|
-
"The background color of the badge. Use Tailwind CSS color classes. *Storybook prop only.",
|
|
17
|
+
description: "Sets the border width of the badge using Tailwind CSS classes. Example: `border-2`.",
|
|
53
18
|
},
|
|
54
|
-
|
|
19
|
+
borderRadius: {
|
|
55
20
|
control: "none",
|
|
56
|
-
|
|
57
|
-
"red",
|
|
58
|
-
"blue",
|
|
59
|
-
"green",
|
|
60
|
-
"black",
|
|
61
|
-
"orange",
|
|
62
|
-
"purple",
|
|
63
|
-
"none",
|
|
64
|
-
],
|
|
65
|
-
description:
|
|
66
|
-
"The color of the badge's border. Use Tailwind CSS color classes.",
|
|
21
|
+
description: "Sets the border radius of the badge using Tailwind CSS classes. Example: `rounded-full`.",
|
|
67
22
|
},
|
|
68
|
-
|
|
23
|
+
backgroundColor: {
|
|
69
24
|
control: "none",
|
|
70
|
-
|
|
71
|
-
disable: true,
|
|
72
|
-
},
|
|
73
|
-
description:
|
|
74
|
-
"The text color on the badge. Use Tailwind CSS color classes. *Storybook prop only.",
|
|
25
|
+
description: "Sets the background color of the badge using Tailwind CSS classes. Example: `bg-gray-100`.",
|
|
75
26
|
},
|
|
76
|
-
|
|
27
|
+
badgeContainerClasses: {
|
|
77
28
|
control: "none",
|
|
78
|
-
|
|
79
|
-
description:
|
|
80
|
-
"The background color of the badge when hovered. Use Tailwind CSS color classes.",
|
|
29
|
+
description: "Additional Tailwind CSS classes for the badge container. Example: `p-2`.",
|
|
81
30
|
},
|
|
82
|
-
|
|
31
|
+
iconSize: {
|
|
83
32
|
control: "none",
|
|
84
|
-
description: "
|
|
85
|
-
},
|
|
86
|
-
image: {
|
|
87
|
-
table: {
|
|
88
|
-
disable: true,
|
|
89
|
-
},
|
|
90
|
-
description: "The image to display in the badge.",
|
|
91
|
-
},
|
|
92
|
-
to: {
|
|
93
|
-
table: {
|
|
94
|
-
disable: true,
|
|
95
|
-
},
|
|
96
|
-
description: "The link to redirect to when the badge is clicked.",
|
|
97
|
-
},
|
|
98
|
-
text: {
|
|
99
|
-
table: {
|
|
100
|
-
disable: true,
|
|
101
|
-
},
|
|
102
|
-
description: "The text to display inside the badge.",
|
|
33
|
+
description: "Sets the size of the icon inside the badge using Tailwind CSS classes. Example: `h-6 w-6`.",
|
|
103
34
|
},
|
|
104
35
|
hasMobileStyle: {
|
|
105
36
|
control: "none",
|
|
106
|
-
description:
|
|
107
|
-
"Whether the badge uses responsive styles for mobile view.",
|
|
37
|
+
description: "Indicates whether mobile-specific styles should be applied to the badge.",
|
|
108
38
|
},
|
|
109
39
|
mobileIcon: {
|
|
110
|
-
table: {
|
|
111
|
-
disable: true,
|
|
112
|
-
},
|
|
113
40
|
control: "none",
|
|
114
|
-
description:
|
|
115
|
-
"The icon to display in the badge when viewed on mobile.",
|
|
41
|
+
description: "The icon to be displayed in mobile view.",
|
|
116
42
|
},
|
|
117
43
|
mobileIconLabel: {
|
|
118
|
-
table: {
|
|
119
|
-
disable: true,
|
|
120
|
-
},
|
|
121
44
|
control: "none",
|
|
122
|
-
description: "
|
|
45
|
+
description: "ARIA label for the mobile icon, used for accessibility.",
|
|
123
46
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
},
|
|
47
|
+
hasLeftIcon: {
|
|
48
|
+
control: "none",
|
|
49
|
+
description: "Determines if an icon should be displayed on the left side of the badge.",
|
|
128
50
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
51
|
+
hasRightIcon: {
|
|
52
|
+
control: "none",
|
|
53
|
+
description: "Determines if an icon should be displayed on the right side of the badge.",
|
|
133
54
|
},
|
|
134
55
|
icon: {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
description: "The icon to display in the badge.",
|
|
56
|
+
control: "none",
|
|
57
|
+
description: "The icon to be displayed inside the badge.",
|
|
139
58
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
59
|
+
image: {
|
|
60
|
+
control: "none",
|
|
61
|
+
description: "An image to be displayed inside the badge.",
|
|
144
62
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
63
|
+
text: {
|
|
64
|
+
control: "none",
|
|
65
|
+
description: "The text or content to be displayed inside the badge.",
|
|
149
66
|
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
description: "Test ID for the badge component.",
|
|
67
|
+
borderHoverColor: {
|
|
68
|
+
control: "none",
|
|
69
|
+
description: "Sets the border hover color of the badge using Tailwind CSS classes. Example: `border-gray-400`.",
|
|
155
70
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
},
|
|
71
|
+
cursorPointer: {
|
|
72
|
+
control: "none",
|
|
73
|
+
description: "Determines if the badge should have a pointer cursor.",
|
|
160
74
|
},
|
|
161
|
-
|
|
75
|
+
type: {
|
|
162
76
|
control: "none",
|
|
163
|
-
|
|
164
|
-
"text-xs",
|
|
165
|
-
"text-sm",
|
|
166
|
-
"text-base",
|
|
167
|
-
"text-lg",
|
|
168
|
-
"text-xl",
|
|
169
|
-
"text-2xl",
|
|
170
|
-
"text-3xl",
|
|
171
|
-
"text-4xl",
|
|
172
|
-
"text-5xl",
|
|
173
|
-
"text-6xl",
|
|
174
|
-
],
|
|
175
|
-
table: {
|
|
176
|
-
disable: true,
|
|
177
|
-
},
|
|
178
|
-
description:
|
|
179
|
-
"The size of the text inside the badge. Use Tailwind CSS text size classes.",
|
|
77
|
+
description: "Determines the type of element the badge should render as.",
|
|
180
78
|
},
|
|
181
|
-
|
|
79
|
+
hoverColor: {
|
|
182
80
|
control: "none",
|
|
183
|
-
description:
|
|
184
|
-
"The width of the badge's border. Use Tailwind CSS width classes.",
|
|
81
|
+
description: "Sets the hover color of the badge using Tailwind CSS classes. Example: `hover:bg-gray-200`.",
|
|
185
82
|
},
|
|
186
|
-
|
|
83
|
+
to: {
|
|
187
84
|
control: "none",
|
|
188
|
-
description:
|
|
189
|
-
"The border color of the badge when hovered. Use Tailwind CSS color classes.",
|
|
85
|
+
description: "The URL to navigate to when the badge is clicked.",
|
|
190
86
|
},
|
|
191
|
-
|
|
87
|
+
href: {
|
|
192
88
|
control: "none",
|
|
193
|
-
description:
|
|
194
|
-
"The size of the icon inside the badge. Use Tailwind CSS size classes.",
|
|
89
|
+
description: "The URL to navigate to when the badge is clicked.",
|
|
195
90
|
},
|
|
196
|
-
|
|
91
|
+
color: {
|
|
197
92
|
control: "none",
|
|
198
|
-
description:
|
|
199
|
-
"Whether the badge should display an icon on the left side.",
|
|
93
|
+
description: "Sets the text color of the badge using Tailwind CSS classes. Example: `text-gray-800`.",
|
|
200
94
|
},
|
|
201
|
-
|
|
95
|
+
badgeSize: {
|
|
202
96
|
control: "none",
|
|
203
|
-
description:
|
|
204
|
-
"Whether the badge should display an icon on the right side.",
|
|
97
|
+
description: "Sets the size of the badge using Tailwind CSS classes. Example: `h-8 w-8`.",
|
|
205
98
|
},
|
|
206
|
-
|
|
207
|
-
table: {
|
|
208
|
-
disable: true,
|
|
209
|
-
},
|
|
99
|
+
iconOrder: {
|
|
210
100
|
control: "none",
|
|
211
|
-
description: "
|
|
101
|
+
description: "Determines the order of the icon inside the badge.",
|
|
212
102
|
},
|
|
213
|
-
|
|
103
|
+
testId: {
|
|
214
104
|
control: "none",
|
|
215
|
-
description:
|
|
216
|
-
"Additional classes for the badge container for custom styling. Provide a string with Tailwind CSS classes.",
|
|
105
|
+
description: "Test ID for the badge component.",
|
|
217
106
|
},
|
|
218
|
-
|
|
107
|
+
textSize: {
|
|
219
108
|
control: "none",
|
|
220
|
-
description:
|
|
221
|
-
"The background color of the badge. Use Tailwind CSS color classes.",
|
|
109
|
+
description: "Sets the size of the text inside the badge using Tailwind CSS classes. Example: `text-sm`.",
|
|
222
110
|
},
|
|
223
|
-
|
|
111
|
+
fontFamily: {
|
|
224
112
|
control: "none",
|
|
225
|
-
description:
|
|
226
|
-
"The border radius of the badge. Use Tailwind CSS border radius classes.",
|
|
113
|
+
description: "Sets the font family of the text inside the badge using Tailwind CSS classes. Example: `font-serif`.",
|
|
227
114
|
},
|
|
228
|
-
|
|
115
|
+
additionalClasses: {
|
|
229
116
|
control: "none",
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
description: "
|
|
117
|
+
description: "Additional Tailwind CSS classes for the badge. Example: `mb-2`.",
|
|
118
|
+
},
|
|
119
|
+
fontColor: {
|
|
120
|
+
control: "none", description: "Sets the text color of the badge using Tailwind CSS classes. Example: `text-gray-800`.",
|
|
234
121
|
},
|
|
235
122
|
},
|
|
236
123
|
tags: ["autodocs"],
|
|
@@ -243,91 +130,107 @@ const Template: StoryFn<BadgeTypes> = (args) => <Badge {...args} />;
|
|
|
243
130
|
|
|
244
131
|
export const Default = Template.bind({});
|
|
245
132
|
Default.args = {
|
|
246
|
-
type: "span",
|
|
247
|
-
cursorPointer: false,
|
|
248
|
-
hasMobileStyle: true,
|
|
249
133
|
backgroundColor: "bg-[#DBEAFE]",
|
|
250
|
-
|
|
251
|
-
borderColor: "",
|
|
252
|
-
borderRadius: "rounded",
|
|
134
|
+
borderRadius: "rounded-md",
|
|
253
135
|
badgeContainerClasses: "px-3 py-1",
|
|
136
|
+
hasMobileStyle: true,
|
|
137
|
+
mobileIconLabel: "Default Badge",
|
|
254
138
|
text: (
|
|
255
139
|
<Text
|
|
256
140
|
color="text-black"
|
|
257
141
|
fontFamily="font-serif"
|
|
258
142
|
text="Required"
|
|
259
|
-
tag="
|
|
143
|
+
tag="span"
|
|
260
144
|
additionalClasses="font-bold"
|
|
261
145
|
size="text-sm"
|
|
262
146
|
/>
|
|
263
147
|
),
|
|
264
148
|
};
|
|
149
|
+
Default.parameters = {
|
|
150
|
+
docs: {
|
|
151
|
+
description: {
|
|
152
|
+
story: "The default badge component with basic styling, including text and optional mobile-specific styling.",
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
265
156
|
|
|
266
157
|
export const BadgeWithLeftIcon = Template.bind({});
|
|
267
158
|
BadgeWithLeftIcon.args = {
|
|
268
|
-
|
|
269
|
-
|
|
159
|
+
backgroundColor: "bg-[#DAF8E6]",
|
|
160
|
+
borderRadius: "rounded-md",
|
|
161
|
+
badgeContainerClasses: "px-3 py-1",
|
|
270
162
|
hasMobileStyle: true,
|
|
271
163
|
mobileIconLabel: "Complete",
|
|
272
|
-
backgroundColor: "bg-[#DAF8E6]",
|
|
273
|
-
borderRadius: "rounded",
|
|
274
|
-
badgeContainerClasses: "px-3 py-[3px]",
|
|
275
164
|
mobileIcon: getFontAwesomeIcon("check"),
|
|
165
|
+
icon: getFontAwesomeIcon("check"),
|
|
166
|
+
hasLeftIcon: true,
|
|
167
|
+
iconSize: "text-sm",
|
|
276
168
|
text: (
|
|
277
169
|
<Text
|
|
278
170
|
color="text-black"
|
|
279
171
|
fontFamily="font-serif"
|
|
280
172
|
text="Complete"
|
|
281
|
-
tag="
|
|
173
|
+
tag="span"
|
|
282
174
|
size="text-sm"
|
|
283
175
|
/>
|
|
284
176
|
),
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
177
|
+
};
|
|
178
|
+
BadgeWithLeftIcon.parameters = {
|
|
179
|
+
docs: {
|
|
180
|
+
description: {
|
|
181
|
+
story: "A badge with an icon on the left side, typically used to indicate completion or success.",
|
|
182
|
+
},
|
|
183
|
+
},
|
|
288
184
|
};
|
|
289
185
|
|
|
290
186
|
export const BadgeWithRightIcon = Template.bind({});
|
|
291
187
|
BadgeWithRightIcon.args = {
|
|
292
|
-
|
|
293
|
-
|
|
188
|
+
backgroundColor: "bg-red-100",
|
|
189
|
+
borderRadius: "rounded-md",
|
|
190
|
+
badgeContainerClasses: "px-3 py-1",
|
|
294
191
|
hasMobileStyle: true,
|
|
295
192
|
mobileIconLabel: "Incomplete",
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
193
|
+
mobileIcon: getFontAwesomeIcon("xmark"),
|
|
194
|
+
icon: getFontAwesomeIcon("xmark"),
|
|
195
|
+
hasRightIcon: true,
|
|
196
|
+
iconSize: "text-sm",
|
|
300
197
|
text: (
|
|
301
198
|
<Text
|
|
302
199
|
color="text-black"
|
|
303
200
|
fontFamily="font-serif"
|
|
304
201
|
text="Incomplete"
|
|
305
|
-
tag="
|
|
202
|
+
tag="span"
|
|
306
203
|
size="text-sm"
|
|
307
204
|
/>
|
|
308
205
|
),
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
206
|
+
};
|
|
207
|
+
BadgeWithRightIcon.parameters = {
|
|
208
|
+
docs: {
|
|
209
|
+
description: {
|
|
210
|
+
story: "A badge with an icon on the right side, typically used to indicate an incomplete or failed status.",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
312
213
|
};
|
|
313
214
|
|
|
314
215
|
export const CommerceBadge = Template.bind({});
|
|
315
216
|
CommerceBadge.args = {
|
|
316
|
-
cursorPointer: false,
|
|
317
|
-
hasMobileStyle: false,
|
|
318
|
-
mobileIconLabel: "Commerce Badge",
|
|
319
217
|
backgroundColor: "bg-[#DAF8E6]",
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
borderRadius: "rounded",
|
|
218
|
+
borderRadius: "rounded-md",
|
|
219
|
+
badgeContainerClasses: "px-3 py-1",
|
|
323
220
|
text: (
|
|
324
221
|
<Text
|
|
325
222
|
color="text-black"
|
|
326
223
|
fontFamily="font-serif"
|
|
327
224
|
text="In Stock"
|
|
328
|
-
tag="
|
|
225
|
+
tag="span"
|
|
329
226
|
size="text-sm"
|
|
330
227
|
/>
|
|
331
228
|
),
|
|
332
|
-
|
|
229
|
+
};
|
|
230
|
+
CommerceBadge.parameters = {
|
|
231
|
+
docs: {
|
|
232
|
+
description: {
|
|
233
|
+
story: "A badge used in e-commerce contexts to indicate that an item is in stock, with a custom background color and rounded borders.",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
333
236
|
};
|
|
@@ -2,24 +2,37 @@ import { render, screen } from "@testing-library/react";
|
|
|
2
2
|
import { describe, expect, beforeEach, test } from "vitest";
|
|
3
3
|
import Badge from "./Badge";
|
|
4
4
|
import Text from "../Text/Text";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
6
|
+
|
|
7
|
+
describe("FontAwesome Icon Rendering", () => {
|
|
8
|
+
test("renders exclamation-circle icon", () => {
|
|
9
|
+
render(getFontAwesomeIcon("exclamationCircle"));
|
|
10
|
+
const icon = screen.getByTestId("icon");
|
|
11
|
+
expect(icon).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test("renders check icon", () => {
|
|
15
|
+
render(getFontAwesomeIcon("check"));
|
|
16
|
+
const icon = screen.getByTestId("icon");
|
|
17
|
+
expect(icon).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("renders xmark icon", () => {
|
|
21
|
+
render(getFontAwesomeIcon("xmark"));
|
|
22
|
+
const icon = screen.getByTestId("icon");
|
|
23
|
+
expect(icon).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
11
26
|
|
|
12
27
|
describe("<Badge />", () => {
|
|
13
28
|
beforeEach(() => {
|
|
14
29
|
render(
|
|
15
30
|
<Badge
|
|
16
31
|
type="span"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
hoverColor="none"
|
|
20
|
-
badgeSize="large"
|
|
32
|
+
borderColor="border-red-500"
|
|
33
|
+
hoverColor="hover:bg-none"
|
|
21
34
|
testId="priority-badge"
|
|
22
|
-
mobileIcon={
|
|
35
|
+
mobileIcon={getFontAwesomeIcon("exclamationCircle")}
|
|
23
36
|
mobileIconLabel="Priority"
|
|
24
37
|
text={
|
|
25
38
|
<Text
|
|
@@ -41,17 +54,12 @@ describe("<Badge />", () => {
|
|
|
41
54
|
});
|
|
42
55
|
|
|
43
56
|
test("has correct text", () => {
|
|
44
|
-
expect(screen.getByTestId("
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("has correct background color", () => {
|
|
48
|
-
const badge = screen.getByTestId("priority-badge");
|
|
49
|
-
expect(badge).toHaveClass("bg-red");
|
|
57
|
+
expect(screen.getByTestId("badge-text")).toHaveTextContent("Priority");
|
|
50
58
|
});
|
|
51
59
|
|
|
52
60
|
test("has correct border color", () => {
|
|
53
61
|
const badge = screen.getByTestId("priority-badge");
|
|
54
|
-
expect(badge).toHaveClass("border-red");
|
|
62
|
+
expect(badge).toHaveClass("border-red-500");
|
|
55
63
|
});
|
|
56
64
|
});
|
|
57
65
|
|
|
@@ -60,14 +68,12 @@ describe("<Badge /> with icon", () => {
|
|
|
60
68
|
render(
|
|
61
69
|
<Badge
|
|
62
70
|
type="span"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
hoverColor="none"
|
|
66
|
-
badgeSize="large"
|
|
71
|
+
borderColor="border-green-500"
|
|
72
|
+
hoverColor="hover:bg-none"
|
|
67
73
|
testId="icon-badge"
|
|
68
74
|
cursorPointer={false}
|
|
69
|
-
icon={
|
|
70
|
-
mobileIcon={
|
|
75
|
+
icon={getFontAwesomeIcon("check")}
|
|
76
|
+
mobileIcon={getFontAwesomeIcon("check")}
|
|
71
77
|
mobileIconLabel="Complete"
|
|
72
78
|
text={
|
|
73
79
|
<Text
|
|
@@ -89,21 +95,16 @@ describe("<Badge /> with icon", () => {
|
|
|
89
95
|
});
|
|
90
96
|
|
|
91
97
|
test("has correct text", () => {
|
|
92
|
-
expect(screen.getByTestId("
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test("has correct background color", () => {
|
|
96
|
-
const badge = screen.getByTestId("icon-badge");
|
|
97
|
-
expect(badge).toHaveClass("bg-green");
|
|
98
|
+
expect(screen.getByTestId("badge-text")).toHaveTextContent("Complete");
|
|
98
99
|
});
|
|
99
100
|
|
|
100
101
|
test("has correct border color", () => {
|
|
101
102
|
const badge = screen.getByTestId("icon-badge");
|
|
102
|
-
expect(badge).toHaveClass("border-green");
|
|
103
|
+
expect(badge).toHaveClass("border-green-500");
|
|
103
104
|
});
|
|
104
105
|
|
|
105
106
|
test("has correct icon", () => {
|
|
106
|
-
const icon = screen.getByTestId("
|
|
107
|
+
const icon = screen.getByTestId("icon");
|
|
107
108
|
expect(icon).toBeInTheDocument();
|
|
108
109
|
});
|
|
109
110
|
});
|
|
@@ -114,13 +115,12 @@ describe("<Badge /> with pill style", () => {
|
|
|
114
115
|
<Badge
|
|
115
116
|
type="href"
|
|
116
117
|
href="#"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
hoverColor="blue"
|
|
118
|
+
borderColor="border-none"
|
|
119
|
+
hoverColor="hover:bg-blue-500"
|
|
120
120
|
testId="pill-badge"
|
|
121
121
|
cursorPointer={false}
|
|
122
|
-
icon={
|
|
123
|
-
mobileIcon={
|
|
122
|
+
icon={getFontAwesomeIcon("check")}
|
|
123
|
+
mobileIcon={getFontAwesomeIcon("check")}
|
|
124
124
|
mobileIconLabel="Complete"
|
|
125
125
|
text={
|
|
126
126
|
<>
|
|
@@ -143,11 +143,10 @@ describe("<Badge /> with pill style", () => {
|
|
|
143
143
|
</>
|
|
144
144
|
}
|
|
145
145
|
image={
|
|
146
|
-
<
|
|
146
|
+
<img
|
|
147
147
|
src="../../../assets/contact-image.png"
|
|
148
148
|
alt=""
|
|
149
|
-
|
|
150
|
-
additionalClasses="flex justify-center w-12 h-12 max-md:hidden"
|
|
149
|
+
className="flex justify-center w-12 h-12 max-md:hidden"
|
|
151
150
|
/>
|
|
152
151
|
}
|
|
153
152
|
/>
|
|
@@ -166,7 +165,7 @@ describe("<Badge /> with pill style", () => {
|
|
|
166
165
|
|
|
167
166
|
test("has correct background color", () => {
|
|
168
167
|
const pill = screen.getByTestId("pill-badge");
|
|
169
|
-
expect(pill).toHaveClass("bg-blue");
|
|
168
|
+
expect(pill).toHaveClass("hover:bg-blue-500");
|
|
170
169
|
});
|
|
171
170
|
|
|
172
171
|
test("has correct image", () => {
|