@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.
Files changed (215) hide show
  1. package/assets/cable.jpg +0 -0
  2. package/assets/card-1.jpg +0 -0
  3. package/assets/cat-logo.png +0 -0
  4. package/assets/item.jpg +0 -0
  5. package/assets/map.png +0 -0
  6. package/coverage/base.css +224 -0
  7. package/coverage/block-navigation.js +87 -0
  8. package/coverage/clover.xml +953 -0
  9. package/coverage/coverage-final.json +74 -0
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +551 -0
  12. package/coverage/prettify.css +1 -0
  13. package/coverage/prettify.js +2 -0
  14. package/coverage/sort-arrow-sprite.png +0 -0
  15. package/coverage/sorter.js +196 -0
  16. package/coverage/toga-blox-npm/index.html +131 -0
  17. package/coverage/toga-blox-npm/postcss.config.js.html +103 -0
  18. package/coverage/toga-blox-npm/src/components/Badge/Badge.stories.tsx.html +793 -0
  19. package/coverage/toga-blox-npm/src/components/Badge/Badge.tsx.html +247 -0
  20. package/coverage/toga-blox-npm/src/components/Badge/index.html +131 -0
  21. package/coverage/toga-blox-npm/src/components/Card/Card.stories.tsx.html +787 -0
  22. package/coverage/toga-blox-npm/src/components/Card/Card.tsx.html +163 -0
  23. package/coverage/toga-blox-npm/src/components/Card/index.html +131 -0
  24. package/coverage/toga-blox-npm/src/components/Card/templates/CategoryCardTemplate.tsx.html +343 -0
  25. package/coverage/toga-blox-npm/src/components/Card/templates/CompassCardTemplate.tsx.html +259 -0
  26. package/coverage/toga-blox-npm/src/components/Card/templates/CounterContentCardTemplate.tsx.html +685 -0
  27. package/coverage/toga-blox-npm/src/components/Card/templates/HorizontalCardTemplate.tsx.html +637 -0
  28. package/coverage/toga-blox-npm/src/components/Card/templates/ItemCardTemplate.tsx.html +550 -0
  29. package/coverage/toga-blox-npm/src/components/Card/templates/KitContentCardTemplate.tsx.html +469 -0
  30. package/coverage/toga-blox-npm/src/components/Card/templates/ShippingAddressCardTemplate.tsx.html +418 -0
  31. package/coverage/toga-blox-npm/src/components/Card/templates/VerticalCardTemplate.tsx.html +592 -0
  32. package/coverage/toga-blox-npm/src/components/Card/templates/index.html +221 -0
  33. package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.stories.tsx.html +358 -0
  34. package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.tsx.html +385 -0
  35. package/coverage/toga-blox-npm/src/components/CounterButton/index.html +131 -0
  36. package/coverage/toga-blox-npm/src/components/Description/Description.stories.tsx.html +286 -0
  37. package/coverage/toga-blox-npm/src/components/Description/Description.tsx.html +124 -0
  38. package/coverage/toga-blox-npm/src/components/Description/index.html +131 -0
  39. package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.stories.tsx.html +676 -0
  40. package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.tsx.html +346 -0
  41. package/coverage/toga-blox-npm/src/components/DropDownIconButton/index.html +131 -0
  42. package/coverage/toga-blox-npm/src/components/Footer/ContactInfoItem.tsx.html +139 -0
  43. package/coverage/toga-blox-npm/src/components/Footer/Footer.stories.tsx.html +934 -0
  44. package/coverage/toga-blox-npm/src/components/Footer/Footer.tsx.html +373 -0
  45. package/coverage/toga-blox-npm/src/components/Footer/index.html +146 -0
  46. package/coverage/toga-blox-npm/src/components/FormButton/FormButton.stories.tsx.html +952 -0
  47. package/coverage/toga-blox-npm/src/components/FormButton/FormButton.tsx.html +343 -0
  48. package/coverage/toga-blox-npm/src/components/FormButton/index.html +131 -0
  49. package/coverage/toga-blox-npm/src/components/GenericList/GenericList.stories.tsx.html +376 -0
  50. package/coverage/toga-blox-npm/src/components/GenericList/GenericList.tsx.html +520 -0
  51. package/coverage/toga-blox-npm/src/components/GenericList/index.html +131 -0
  52. package/coverage/toga-blox-npm/src/components/GenericList/templates/DummyDataList.tsx.html +154 -0
  53. package/coverage/toga-blox-npm/src/components/GenericList/templates/DynamicIconList.tsx.html +250 -0
  54. package/coverage/toga-blox-npm/src/components/GenericList/templates/index.html +131 -0
  55. package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.stories.tsx.html +325 -0
  56. package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.tsx.html +262 -0
  57. package/coverage/toga-blox-npm/src/components/GetSupport/index.html +131 -0
  58. package/coverage/toga-blox-npm/src/components/HamburgerButton/Hamburger.stories.tsx.html +760 -0
  59. package/coverage/toga-blox-npm/src/components/HamburgerButton/HamburgerButton.tsx.html +232 -0
  60. package/coverage/toga-blox-npm/src/components/HamburgerButton/index.html +131 -0
  61. package/coverage/toga-blox-npm/src/components/Header/Header.stories.tsx.html +1633 -0
  62. package/coverage/toga-blox-npm/src/components/Header/Header.tsx.html +814 -0
  63. package/coverage/toga-blox-npm/src/components/Header/headerContext.tsx.html +460 -0
  64. package/coverage/toga-blox-npm/src/components/Header/index.html +146 -0
  65. package/coverage/toga-blox-npm/src/components/Hero/Hero.stories.tsx.html +289 -0
  66. package/coverage/toga-blox-npm/src/components/Hero/Hero.tsx.html +259 -0
  67. package/coverage/toga-blox-npm/src/components/Hero/index.html +131 -0
  68. package/coverage/toga-blox-npm/src/components/IconButton/IconButton.stories.tsx.html +673 -0
  69. package/coverage/toga-blox-npm/src/components/IconButton/IconButton.tsx.html +313 -0
  70. package/coverage/toga-blox-npm/src/components/IconButton/index.html +131 -0
  71. package/coverage/toga-blox-npm/src/components/Image/Image.stories.tsx.html +322 -0
  72. package/coverage/toga-blox-npm/src/components/Image/Image.tsx.html +226 -0
  73. package/coverage/toga-blox-npm/src/components/Image/index.html +131 -0
  74. package/coverage/toga-blox-npm/src/components/Input/Input.stories.tsx.html +1621 -0
  75. package/coverage/toga-blox-npm/src/components/Input/Input.tsx.html +568 -0
  76. package/coverage/toga-blox-npm/src/components/Input/InputMemoTypes.tsx.html +181 -0
  77. package/coverage/toga-blox-npm/src/components/Input/index.html +146 -0
  78. package/coverage/toga-blox-npm/src/components/MobileMenu/MobileMenu.tsx.html +208 -0
  79. package/coverage/toga-blox-npm/src/components/MobileMenu/index.html +116 -0
  80. package/coverage/toga-blox-npm/src/components/Nav/Nav.stories.tsx.html +628 -0
  81. package/coverage/toga-blox-npm/src/components/Nav/Nav.tsx.html +622 -0
  82. package/coverage/toga-blox-npm/src/components/Nav/index.html +131 -0
  83. package/coverage/toga-blox-npm/src/components/Page/TableDataDummy.tsx.html +733 -0
  84. package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.stories.tsx.html +1714 -0
  85. package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.tsx.html +115 -0
  86. package/coverage/toga-blox-npm/src/components/Page/index.html +146 -0
  87. package/coverage/toga-blox-npm/src/components/PageSection/PageSection.stories.tsx.html +433 -0
  88. package/coverage/toga-blox-npm/src/components/PageSection/PageSection.tsx.html +121 -0
  89. package/coverage/toga-blox-npm/src/components/PageSection/index.html +131 -0
  90. package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.stories.tsx.html +517 -0
  91. package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.tsx.html +325 -0
  92. package/coverage/toga-blox-npm/src/components/SearchInput/index.html +131 -0
  93. package/coverage/toga-blox-npm/src/components/Slider/Slider.stories.tsx.html +349 -0
  94. package/coverage/toga-blox-npm/src/components/Slider/Slider.tsx.html +502 -0
  95. package/coverage/toga-blox-npm/src/components/Slider/index.html +131 -0
  96. package/coverage/toga-blox-npm/src/components/Submenus/AdminSubmenu.tsx.html +136 -0
  97. package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenu.tsx.html +253 -0
  98. package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenuItem.tsx.html +202 -0
  99. package/coverage/toga-blox-npm/src/components/Submenus/index.html +146 -0
  100. package/coverage/toga-blox-npm/src/components/Text/Text.stories.tsx.html +235 -0
  101. package/coverage/toga-blox-npm/src/components/Text/Text.tsx.html +172 -0
  102. package/coverage/toga-blox-npm/src/components/Text/index.html +131 -0
  103. package/coverage/toga-blox-npm/src/components/Toaster/Toaster.stories.tsx.html +445 -0
  104. package/coverage/toga-blox-npm/src/components/Toaster/Toaster.tsx.html +301 -0
  105. package/coverage/toga-blox-npm/src/components/Toaster/index.html +131 -0
  106. package/coverage/toga-blox-npm/src/hoc/styling/index.html +116 -0
  107. package/coverage/toga-blox-npm/src/hoc/styling/withStoryBook.tsx.html +142 -0
  108. package/coverage/toga-blox-npm/src/userHoc/index.html +116 -0
  109. package/coverage/toga-blox-npm/src/userHoc/withMemo.tsx.html +145 -0
  110. package/coverage/toga-blox-npm/src/utils/assertTagName.tsx.html +106 -0
  111. package/coverage/toga-blox-npm/src/utils/generateAccordionItem.tsx.html +373 -0
  112. package/coverage/toga-blox-npm/src/utils/generateFooterContacts.tsx.html +295 -0
  113. package/coverage/toga-blox-npm/src/utils/generateNavMenu.tsx.html +247 -0
  114. package/coverage/toga-blox-npm/src/utils/generateSocialList.tsx.html +187 -0
  115. package/coverage/toga-blox-npm/src/utils/getFontAwesomeIcon.tsx.html +145 -0
  116. package/coverage/toga-blox-npm/src/utils/index.html +206 -0
  117. package/coverage/toga-blox-npm/src/utils/inputValidation.tsx.html +163 -0
  118. package/coverage/toga-blox-npm/tailwind.config.js.html +205 -0
  119. package/declarations.d.ts +1 -1
  120. package/package.json +7 -7
  121. package/src/components/Badge/Badge.stories.tsx +110 -207
  122. package/src/components/Badge/Badge.test.tsx +40 -41
  123. package/src/components/Badge/Badge.tsx +29 -99
  124. package/src/components/Badge/Badge.types.tsx +12 -23
  125. package/src/components/Card/Card.stories.tsx +166 -22
  126. package/src/components/Card/Card.test.tsx +3 -3
  127. package/src/components/Card/Card.tsx +12 -16
  128. package/src/components/Card/DUMMYPRODUCTDATA.json +381 -225
  129. package/src/components/Card/templates/CategoryCardTemplate.tsx +86 -0
  130. package/src/components/Card/templates/CompassCardTemplate.tsx +1 -1
  131. package/src/components/Card/templates/CounterContentCardTemplate.tsx +200 -0
  132. package/src/components/Card/templates/ItemCardTemplate.tsx +155 -0
  133. package/src/components/Card/templates/KitContentCardTemplate.tsx +128 -0
  134. package/src/components/Card/templates/ShippingAddressCardTemplate.tsx +111 -0
  135. package/src/components/Card/templates/VerticalCardTemplate.tsx +100 -85
  136. package/src/components/CounterButton/CounterButton.tsx +1 -1
  137. package/src/components/Description/Description.stories.tsx +67 -0
  138. package/src/components/Description/Description.tsx +13 -0
  139. package/src/components/Description/Description.types.ts +9 -0
  140. package/src/components/DropDownIconButton/DropDownIconButton.stories.tsx +197 -0
  141. package/src/components/DropDownIconButton/DropDownIconButton.test.tsx +90 -0
  142. package/src/components/DropDownIconButton/DropDownIconButton.tsx +87 -0
  143. package/src/components/DropDownIconButton/DropDownIconButton.types.ts +21 -0
  144. package/src/components/DropDownIconButton/index.ts +2 -0
  145. package/src/components/Footer/ContactInfoItem.tsx +8 -10
  146. package/src/components/Footer/Footer.stories.tsx +13 -22
  147. package/src/components/Footer/Footer.tsx +25 -88
  148. package/src/components/Footer/Footer.types.tsx +2 -2
  149. package/src/components/FormButton/FormButton.stories.tsx +101 -226
  150. package/src/components/FormButton/FormButton.test.tsx +1 -1
  151. package/src/components/FormButton/FormButton.tsx +34 -42
  152. package/src/components/FormButton/FormButton.types.ts +7 -13
  153. package/src/components/GenericList/GenericList.stories.tsx +5 -12
  154. package/src/components/GenericList/GenericList.tsx +91 -92
  155. package/src/components/GenericList/templates/DynamicIconList.tsx +45 -64
  156. package/src/components/GetSupport/GetSupport.stories.tsx +80 -0
  157. package/src/components/GetSupport/GetSupport.test.tsx +62 -0
  158. package/src/components/GetSupport/GetSupport.tsx +59 -0
  159. package/src/components/GetSupport/GetSupport.types.ts +11 -0
  160. package/src/components/HamburgerButton/Hamburger.stories.tsx +225 -0
  161. package/src/components/HamburgerButton/HamburgerButton.tsx +37 -56
  162. package/src/components/HamburgerButton/HamburgerButton.types.tsx +2 -1
  163. package/src/components/Header/Header.stories.tsx +3 -5
  164. package/src/components/Header/Header.tsx +37 -83
  165. package/src/components/Hero/Hero.stories.tsx +1 -2
  166. package/src/components/IconButton/IconButton.stories.tsx +196 -0
  167. package/src/components/{Icon/Icon.test.tsx → IconButton/IconButton.test.tsx} +3 -4
  168. package/src/components/IconButton/IconButton.tsx +76 -0
  169. package/src/components/IconButton/IconButton.types.ts +28 -0
  170. package/src/components/IconButton/index.ts +2 -0
  171. package/src/components/Image/Image.tsx +1 -1
  172. package/src/components/Input/Input.stories.tsx +10 -12
  173. package/src/components/Input/Input.test.tsx +2 -3
  174. package/src/components/Input/Input.tsx +41 -104
  175. package/src/components/MobileMenu/MobileMenu.types.tsx +0 -2
  176. package/src/components/Nav/DUMMYNAVDATA.json +4 -4
  177. package/src/components/Nav/Nav.tsx +49 -112
  178. package/src/components/Nav/Nav.types.tsx +14 -2
  179. package/src/components/Page/ViewPageTemplate.stories.tsx +2 -2
  180. package/src/components/Page/ViewPageTemplate.test.tsx +1 -1
  181. package/src/components/Page/ViewPageTemplate.types.ts +1 -1
  182. package/src/components/PageSection/PageSection.stories.tsx +3 -1
  183. package/src/components/PageSection/PageSections.test.tsx +2 -1
  184. package/src/components/SearchInput/SearchInput.stories.tsx +144 -0
  185. package/src/components/SearchInput/SearchInput.tsx +81 -0
  186. package/src/components/SearchInput/SearchInput.types.ts +28 -0
  187. package/src/components/Slider/Slider.stories.tsx +88 -0
  188. package/src/components/Slider/Slider.tsx +139 -0
  189. package/src/components/Slider/Slider.types.ts +21 -0
  190. package/src/components/Submenus/AdminSubmenu.tsx +17 -0
  191. package/src/components/Submenus/AlertSubmenu.tsx +56 -0
  192. package/src/components/Submenus/AlertSubmenuItem.tsx +39 -0
  193. package/src/components/Submenus/types.tsx +32 -0
  194. package/src/components/Toaster/Toaster.stories.tsx +4 -6
  195. package/src/components/Toaster/Toaster.test.tsx +3 -4
  196. package/src/components/Toaster/Toaster.tsx +9 -17
  197. package/src/components/Toaster/Toaster.types.ts +2 -2
  198. package/src/utils/assertTagName.tsx +1 -1
  199. package/src/utils/generateAccordionItem.tsx +7 -13
  200. package/src/utils/generateFooterContacts.tsx +4 -9
  201. package/src/utils/getFontAwesomeIcon.tsx +8 -13
  202. package/tailwind.config.js +11 -3
  203. package/src/components/Badge/badgeClassNames.tsx +0 -173
  204. package/src/components/Card/cardClassNames.ts +0 -49
  205. package/src/components/Footer/footerClassNames.tsx +0 -57
  206. package/src/components/FormButton/formButtonClassNames.tsx +0 -153
  207. package/src/components/GenericList/genericListClassNames.tsx +0 -8
  208. package/src/components/Header/headerClassNames.tsx +0 -50
  209. package/src/components/Icon/Icon.stories.tsx +0 -227
  210. package/src/components/Icon/Icon.tsx +0 -208
  211. package/src/components/Icon/Icon.types.ts +0 -24
  212. package/src/components/Icon/iconClassNames.ts +0 -79
  213. package/src/components/Icon/index.ts +0 -2
  214. package/src/components/Input/inputClassNames.tsx +0 -169
  215. 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
- badgeSize: {
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
- table: {
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
- color: {
15
+ borderWidth: {
37
16
  control: "none",
38
- table: {
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
- borderColor: {
19
+ borderRadius: {
55
20
  control: "none",
56
- options: [
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
- fontColor: {
23
+ backgroundColor: {
69
24
  control: "none",
70
- table: {
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
- hoverColor: {
27
+ badgeContainerClasses: {
77
28
  control: "none",
78
- options: ["red", "green", "blue", "orange", "purple", "none"],
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
- cursorPointer: {
31
+ iconSize: {
83
32
  control: "none",
84
- description: "Whether the badge should have a pointer cursor.",
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: "Aria-label for the mobile icon.",
45
+ description: "ARIA label for the mobile icon, used for accessibility.",
123
46
  },
124
- href: {
125
- table: {
126
- disable: true,
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
- additionalClasses: {
130
- table: {
131
- disable: true,
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
- table: {
136
- disable: true,
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
- as: {
141
- table: {
142
- disable: true,
143
- },
59
+ image: {
60
+ control: "none",
61
+ description: "An image to be displayed inside the badge.",
144
62
  },
145
- type: {
146
- table: {
147
- disable: true,
148
- },
63
+ text: {
64
+ control: "none",
65
+ description: "The text or content to be displayed inside the badge.",
149
66
  },
150
- testId: {
151
- table: {
152
- disable: true,
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
- onClick: {
157
- table: {
158
- disable: true,
159
- },
71
+ cursorPointer: {
72
+ control: "none",
73
+ description: "Determines if the badge should have a pointer cursor.",
160
74
  },
161
- textSize: {
75
+ type: {
162
76
  control: "none",
163
- options: [
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
- borderWidth: {
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
- borderHoverColor: {
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
- iconSize: {
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
- hasLeftIcon: {
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
- hasRightIcon: {
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
- style: {
207
- table: {
208
- disable: true,
209
- },
99
+ iconOrder: {
210
100
  control: "none",
211
- description: "Custom inline styles for the badge component.",
101
+ description: "Determines the order of the icon inside the badge.",
212
102
  },
213
- badgeContainerClasses: {
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
- backgroundColor: {
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
- borderRadius: {
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
- iconOrder: {
115
+ additionalClasses: {
229
116
  control: "none",
230
- table: {
231
- disable: true,
232
- },
233
- description: "The order of the icon in the badge.",
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
- mobileIconLabel: "Default Badge",
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="p"
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
- type: "span",
269
- cursorPointer: false,
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="p"
173
+ tag="span"
282
174
  size="text-sm"
283
175
  />
284
176
  ),
285
- icon: getFontAwesomeIcon("check"),
286
- hasLeftIcon: true,
287
- iconSize: "text-sm pr-2",
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
- type: "span",
293
- cursorPointer: false,
188
+ backgroundColor: "bg-red-100",
189
+ borderRadius: "rounded-md",
190
+ badgeContainerClasses: "px-3 py-1",
294
191
  hasMobileStyle: true,
295
192
  mobileIconLabel: "Incomplete",
296
- backgroundColor: "bg-red-100",
297
- borderRadius: "rounded",
298
- badgeContainerClasses: "px-3 py-[3px]",
299
- mobileIcon: getFontAwesomeIcon("check"),
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="p"
202
+ tag="span"
306
203
  size="text-sm"
307
204
  />
308
205
  ),
309
- icon: getFontAwesomeIcon("Xmark"),
310
- hasRightIcon: true,
311
- iconSize: "text-sm pl-2",
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
- borderColor: "",
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="p"
225
+ tag="span"
329
226
  size="text-sm"
330
227
  />
331
228
  ),
332
- badgeContainerClasses: "px-3 py-[3px]",
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 Image from "../Image/Image";
6
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
7
- import {
8
- faCircleExclamation,
9
- faCheck,
10
- } from "@fortawesome/free-solid-svg-icons";
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
- color="red"
18
- borderColor="red"
19
- hoverColor="none"
20
- badgeSize="large"
32
+ borderColor="border-red-500"
33
+ hoverColor="hover:bg-none"
21
34
  testId="priority-badge"
22
- mobileIcon={<FontAwesomeIcon icon={faCircleExclamation} />}
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("priority-badge")).toHaveTextContent("Priority");
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
- color="green"
64
- borderColor="green"
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={<FontAwesomeIcon icon={faCheck} />}
70
- mobileIcon={<FontAwesomeIcon icon={faCheck} />}
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("icon-badge")).toHaveTextContent("Complete");
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("badge-icon");
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
- color="blue"
118
- borderColor="none"
119
- hoverColor="blue"
118
+ borderColor="border-none"
119
+ hoverColor="hover:bg-blue-500"
120
120
  testId="pill-badge"
121
121
  cursorPointer={false}
122
- icon={<FontAwesomeIcon icon={faCheck} />}
123
- mobileIcon={<FontAwesomeIcon icon={faCheck} />}
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
- <Image
146
+ <img
147
147
  src="../../../assets/contact-image.png"
148
148
  alt=""
149
- background={false}
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", () => {