@agilant/toga-blox 1.0.8 → 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 +5 -6
  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
@@ -1,5 +1,3 @@
1
- import { DUMMYICONCOMPASSDATA, DUMMYICONTOGADATA } from "../Header/DUMMYICONDATA.json";
2
- import { TagName } from "../Text";
3
1
 
4
2
 
5
3
  export interface MobileMenuTypes {
@@ -32,7 +32,7 @@
32
32
  ]
33
33
  },
34
34
  {
35
- "id": 2,
35
+ "id": "2",
36
36
  "title": "Projects",
37
37
  "to": "",
38
38
  "links": [
@@ -87,7 +87,7 @@
87
87
  ]
88
88
  },
89
89
  {
90
- "id": 3,
90
+ "id": "3",
91
91
  "title": "Community",
92
92
  "to": "fake link",
93
93
  "links": [
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  },
120
120
  {
121
- "id": 4,
121
+ "id": "4",
122
122
  "title": "Store",
123
123
  "to": "",
124
124
  "links": [
@@ -176,7 +176,7 @@
176
176
  ]
177
177
  },
178
178
  {
179
- "id": 2,
179
+ "id": "2",
180
180
  "title": "Kits",
181
181
  "to": "",
182
182
  "links": [
@@ -1,97 +1,51 @@
1
1
  import React, { useState } from "react";
2
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3
- import { faChevronDown } from "@fortawesome/free-solid-svg-icons";
4
- import { DUMMYNAVDATA } from "./DUMMYNAVDATA.json";
2
+ import data from "./DUMMYNAVDATA.json";
5
3
  import Image from "../Image/Image";
6
-
7
4
  import { Accordion } from "../../utils/generateAccordionItem";
8
- import {
9
- getParentHoverClassNames,
10
- getParentHoverTextClassNames,
11
- getParentStyleClasses,
12
- getParentTextSizeClasses,
13
- getParentTextColorClasses,
14
- getSubmenuClasses,
15
- getSubmenuHoverClasses,
16
- getSubmenuTextSizeClasses,
17
- getSubmenuTextColorClasses,
18
- getNavBackgroundColor,
19
- getMobileHiddenBreakpoint,
20
- getMobileFlexBreakpoint,
21
- } from "./navClassNames";
22
- import { NavTypes } from ".";
5
+ import { NavTypes, NavItem } from "./Nav.types";
6
+ import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
7
+
8
+ const DUMMYNAVDATA = data.DUMMYNAVDATA as NavItem[];
23
9
 
24
10
  const Nav: React.FC<NavTypes> = ({
25
11
  navData = DUMMYNAVDATA,
26
- navBackgroundColor,
12
+ navBackgroundColor = "bg-white",
27
13
 
28
- parentBackground,
29
- parentBorderColor,
30
- parentShape,
31
- parentTextColor,
32
- parentTextSize,
14
+ parentBackground = "bg-white",
15
+ parentBorderColor = "border-gray-200",
16
+ parentShape = "rounded-md",
17
+ parentTextColor = "text-gray-800",
18
+ parentTextSize = "text-base",
33
19
 
34
- parentHoverBackground,
35
- parentHoverFontColor,
36
- parentHoverUnderline,
37
- parentHoverBorderColor,
20
+ parentHoverBackground = "hover:bg-gray-200",
21
+ parentHoverFontColor = "hover:text-black",
22
+ parentHoverUnderline = "hover:underline",
23
+ parentHoverBorderColor = "hover:border-gray-400",
38
24
 
39
- submenuBackgroundColor,
40
- submenuTextColor,
41
- submenuTextSize,
25
+ submenuBackgroundColor = "bg-white",
26
+ submenuTextColor = "text-gray-800",
27
+ submenuTextSize = "text-sm",
42
28
 
43
- includeSubmenuImages,
44
- submenuHoverBackground,
45
- submenuHoverTextColor,
46
- submenuHoverBorderStyle,
47
- submenuHoverBorderColor,
29
+ includeSubmenuImages = false,
30
+ submenuHoverBackground = "hover:bg-gray-200",
31
+ submenuHoverTextColor = "hover:text-black",
32
+ submenuHoverBorderStyle = "hover:border-gray-400",
33
+ submenuHoverBorderColor = "hover:border-gray-400",
48
34
 
49
- mobileBreakpoint,
35
+ mobileBreakpoint = "max-xl",
50
36
 
51
37
  accordionParentStyle = "border-b border-black p-2 w-full",
52
38
  accordionExpandedStyle = "w-full py-3",
53
39
  }) => {
54
40
  const [navExpanded, setNavExpanded] = useState<Record<string, boolean>>(
55
41
  navData.reduce(
56
- (acc, _, index) => ({ ...acc, [index.toString()]: false }),
42
+ (acc: Record<string, boolean>, _: NavItem, index: number) => ({
43
+ ...acc,
44
+ [index.toString()]: false,
45
+ }),
57
46
  {}
58
47
  )
59
48
  );
60
- let navBackgroundColorClasses = getNavBackgroundColor(navBackgroundColor);
61
-
62
- let hoverClasses = getParentHoverClassNames(
63
- parentHoverBackground,
64
- parentHoverBorderColor
65
- );
66
-
67
- let parentHoverTextClasses = getParentHoverTextClassNames(
68
- parentHoverFontColor,
69
- parentHoverUnderline
70
- );
71
-
72
- let parentStyleClasses = getParentStyleClasses(
73
- parentBackground,
74
- parentBorderColor,
75
- parentShape
76
- );
77
-
78
- let parentTextSizeClasses = getParentTextSizeClasses(parentTextSize);
79
- let parentTextColorClasses = getParentTextColorClasses(parentTextColor);
80
-
81
- let submenuStyleClasses = getSubmenuClasses(submenuBackgroundColor);
82
- let submenuHoverClasses = getSubmenuHoverClasses(
83
- submenuHoverBackground,
84
- submenuHoverTextColor,
85
- submenuHoverBorderStyle,
86
- submenuHoverBorderColor
87
- );
88
-
89
- let submenuTextSizeClasses = getSubmenuTextSizeClasses(submenuTextSize);
90
- let submenuTextColorClasses = getSubmenuTextColorClasses(submenuTextColor);
91
-
92
- let mobileHiddenBreakpointClasses =
93
- getMobileHiddenBreakpoint(mobileBreakpoint);
94
- let mobileFlexBreakpointClasses = getMobileFlexBreakpoint(mobileBreakpoint);
95
49
 
96
50
  const toggleNav = (index: number) => {
97
51
  setNavExpanded((prevState) => ({
@@ -119,19 +73,16 @@ const Nav: React.FC<NavTypes> = ({
119
73
 
120
74
  return (
121
75
  <nav
122
- className={`flex justify-around ${navBackgroundColorClasses} `}
76
+ className={`flex justify-around ${navBackgroundColor}`}
123
77
  data-testid="nav"
124
78
  >
125
79
  <ul
126
- className={`flex w-full items-center ${mobileHiddenBreakpointClasses}`}
80
+ className={`flex w-full items-center ${mobileBreakpoint}:hidden`}
127
81
  aria-label="Main Menu"
128
82
  data-testid="main-menu"
129
83
  >
130
- {navData.map((item, index: number) => (
131
- <div
132
- className={`flex w-full justify-center`}
133
- key={item.title}
134
- >
84
+ {navData.map((item: NavItem, index: number) => (
85
+ <div className={`flex w-full justify-center`} key={item.title}>
135
86
  {item.to === "" ? (
136
87
  <li
137
88
  className={`flex w-auto cursor-pointer relative`}
@@ -139,54 +90,42 @@ const Nav: React.FC<NavTypes> = ({
139
90
  onClick={() => handleParentClick(index)}
140
91
  aria-expanded={navExpanded[index]}
141
92
  tabIndex={0}
142
- onKeyDown={(event) =>
143
- handleKeyDown(event, index)
144
- }
93
+ onKeyDown={(event) => handleKeyDown(event, index)}
145
94
  data-testid="parent-menu-item"
146
95
  >
147
96
  <div
148
- className={`flex w-full items-center border-2 h-10 ${hoverClasses} ${parentStyleClasses} `}
97
+ className={`flex w-full items-center border-2 h-10 ${parentHoverBackground} ${parentHoverBorderColor} ${parentShape} ${parentBackground}`}
149
98
  data-testid={`parent-button-${item.title}`}
150
99
  >
151
100
  <div
152
- className={`flex w-full p-4 justify-between items-center ${parentTextSizeClasses} ${parentTextColorClasses} ${parentHoverTextClasses}`}
101
+ className={`flex w-full p-4 justify-between items-center ${parentTextSize} ${parentTextColor} ${parentHoverFontColor} ${parentHoverUnderline}`}
153
102
  >
154
103
  <div className="px-2">{item.title}</div>
155
- <FontAwesomeIcon
156
- className={`text-xs transition-transform duration-300 transform ${
157
- navExpanded[index]
158
- ? "rotate-180"
159
- : ""
160
- }`}
161
- icon={faChevronDown}
162
- />
104
+ {getFontAwesomeIcon(
105
+ "chevron-down",
106
+ `text-xs transition-transform duration-300 transform ${navExpanded[index] ? "rotate-180" : ""
107
+ }`
108
+ )}
163
109
  </div>
164
110
  </div>
165
111
 
166
112
  <div
167
- className={`absolute min-w-navDropDown top-16 overflow-x-scroll transition-[max-height] duration-500 ease-in-out ${submenuStyleClasses} ${
168
- navExpanded[index]
169
- ? "max-h-60"
170
- : "max-h-0"
171
- }`}
113
+ className={`absolute min-w-navDropDown top-16 overflow-x-scroll transition-[max-height] duration-500 ease-in-out ${submenuBackgroundColor} ${navExpanded[index] ? "max-h-60" : "max-h-0"
114
+ }`}
172
115
  aria-hidden={!navExpanded[index]}
173
116
  tabIndex={-1}
174
117
  >
175
- <ul className={`w-full `}>
118
+ <ul className="w-full">
176
119
  {item.links.map((link) => (
177
120
  <li
178
121
  key={link.menuItem}
179
- className={`flex py-2 border-4 border-transparent w-auto align-center ${submenuStyleClasses} ${submenuHoverClasses} ${submenuTextSizeClasses} ${submenuTextColorClasses}`}
122
+ className={`flex py-2 border-4 border-transparent w-auto align-center ${submenuBackgroundColor} ${submenuHoverBackground} ${submenuHoverBorderStyle} ${submenuHoverBorderColor} ${submenuTextSize} ${submenuTextColor}`}
180
123
  >
181
124
  <a
182
125
  href={link.link}
183
126
  className="flex hover:underline w-full justify-start items-center pl-1"
184
127
  data-testid={link.menuItem}
185
- tabIndex={
186
- navExpanded[index]
187
- ? 0
188
- : -1
189
- }
128
+ tabIndex={navExpanded[index] ? 0 : -1}
190
129
  >
191
130
  {includeSubmenuImages && (
192
131
  <Image
@@ -207,14 +146,12 @@ const Nav: React.FC<NavTypes> = ({
207
146
  ) : (
208
147
  <li
209
148
  className="w-auto"
210
- onKeyDown={(event) =>
211
- handleKeyDown(event, index)
212
- }
213
- data-testid={`parent-menu-item`}
149
+ onKeyDown={(event) => handleKeyDown(event, index)}
150
+ data-testid="parent-menu-item"
214
151
  >
215
152
  <a
216
153
  href={item.to}
217
- className={`flex flex-col p-4 w-full border-2 relative items-center h-10 justify-center ${hoverClasses} ${parentHoverTextClasses} ${parentStyleClasses} ${parentTextSizeClasses} ${parentTextColorClasses}`}
154
+ className={`flex flex-col p-4 w-full border-2 relative items-center h-10 justify-center ${parentHoverBackground} ${parentHoverFontColor} ${parentHoverUnderline} ${parentBackground} ${parentBorderColor} ${parentShape} ${parentTextSize} ${parentTextColor}`}
218
155
  tabIndex={0}
219
156
  data-testid={`parent-link-${item.title}`}
220
157
  >
@@ -226,7 +163,7 @@ const Nav: React.FC<NavTypes> = ({
226
163
  ))}
227
164
  </ul>
228
165
  <div
229
- className={`hidden w-full items-center ${mobileFlexBreakpointClasses}`}
166
+ className={`hidden w-full items-center ${mobileBreakpoint}:flex`}
230
167
  data-testid="accordion-nav"
231
168
  >
232
169
  <Accordion
@@ -1,7 +1,19 @@
1
- import { DUMMYNAVDATA } from "./DUMMYNAVDATA.json";
1
+ export interface NavLink {
2
+ menuItem: string;
3
+ link: string;
4
+ src: string | null;
5
+ alt: string;
6
+ }
7
+
8
+ export interface NavItem {
9
+ id: string | number;
10
+ title: string;
11
+ to: string;
12
+ links: NavLink[];
13
+ }
2
14
 
3
15
  export interface NavTypes {
4
- navData?: typeof DUMMYNAVDATA;
16
+ navData?: NavItem[];
5
17
  navBackgroundColor?: string;
6
18
 
7
19
  parentHoverBackground?: string;
@@ -211,7 +211,7 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
211
211
  cardBoxShadow={item.cardBoxShadow}
212
212
  key={item.id}
213
213
  >
214
- <CompassCardTemplate data={item} />
214
+ <CompassCardTemplate data={{ ...item, title: "" }} />
215
215
  </Card>
216
216
  )}
217
217
  />
@@ -435,7 +435,7 @@ CompassPageView.args = {
435
435
  cardBoxShadow={item.cardBoxShadow}
436
436
  key={item.id}
437
437
  >
438
- <CompassCardTemplate data={item} />
438
+ <CompassCardTemplate data={{ ...item, title: "" }} />
439
439
  </Card>
440
440
  )}
441
441
  />
@@ -77,7 +77,6 @@ describe("<ViewTemplatePage />", () => {
77
77
  color="green"
78
78
  hoverColor="green"
79
79
  borderColor="none"
80
- tagStyle={false}
81
80
  mobileIcon={getFontAwesomeIcon("phone")}
82
81
  mobileIconLabel="Contact Us"
83
82
  onClick={() =>
@@ -191,6 +190,7 @@ describe("<ViewTemplatePage />", () => {
191
190
  <div className="w-3/4 grid grid-cols-4 gap-8 h-[100%] max-xl:gap-1 max-lg:grid-cols-2 max-lg:gap-y-24 max-lg:justify-items-center">
192
191
  <GenericList
193
192
  data={DUMMYCOMPASSPRODUCTDATA}
193
+ listType="none"
194
194
  renderItem={(item) => (
195
195
  <Card
196
196
  containerClasses={"w-3/4"}
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from "react";
1
+ import { ReactNode } from "react";
2
2
 
3
3
  export interface ViewPageTemplateTypes {
4
4
  children: ReactNode;
@@ -58,6 +58,7 @@ HorizontalCardsSection.args = {
58
58
  />
59
59
  <GenericList
60
60
  data={DUMMYPRODUCTDATA}
61
+ listType="none"
61
62
  renderItem={(item) => (
62
63
  <Card
63
64
  containerClasses={
@@ -93,10 +94,11 @@ CompassCardsSection.args = {
93
94
  />
94
95
  <GenericList
95
96
  data={DUMMYCOMPASSPRODUCTDATA}
97
+ listType="none"
96
98
  containerClasses="w-full grid grid-cols-4 gap-y-12 gap-x-8 h-full max-lg:grid-cols-2 max-lg:gap-y-12 max-lg:gap-x-2 max-md:gap-12 max-sm:w-[90%] max-sm:gap-8 justify-items-center"
97
99
  renderItem={(item) => (
98
100
  <Card
99
- containerClasses={
101
+ containerClasses={
100
102
  "w-full h-full shadow-md overflow-hidden rounded-md transition ease-in-out delay-150 hover:-translate-y-1 hover:scale-110 duration-300 max-lg:transition-none max-lg:hover:transform-none max-w-72"
101
103
  }
102
104
  cardBackgroundColor={item.cardBackgroundColor}
@@ -1,4 +1,4 @@
1
- import { describe, it, expect, beforeEach, test } from "vitest";
1
+ import { describe, it, expect, beforeEach } from "vitest";
2
2
  import { render, screen } from "@testing-library/react";
3
3
  import Section from "./PageSection";
4
4
  import Text from "../Text/Text";
@@ -56,6 +56,7 @@ describe("<Section /> with compass cards", () => {
56
56
  <div className="grid grid-cols-4 gap-8 h-[100%] max-xl:gap-1 max-lg:grid-cols-2 max-lg:gap-y-24 max-lg:justify-items-center">
57
57
  <GenericList
58
58
  data={DUMMYCOMPASSPRODUCTDATA}
59
+ listType="none"
59
60
  renderItem={(item) => (
60
61
  <Card
61
62
  containerClasses={"w-3/4"}
@@ -0,0 +1,144 @@
1
+ import { Meta, StoryFn } from "@storybook/react";
2
+ import SearchInput from "./SearchInput";
3
+ import { SearchInputProps } from "./SearchInput.types";
4
+ import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
5
+
6
+ export default {
7
+ title: "Components/SearchInput",
8
+ component: SearchInput,
9
+ tags: ["autodocs"],
10
+ argTypes: {
11
+ onButtonClick: { control: "none", table: { disable: true } },
12
+ inputType: { control: "none", table: { disable: true } },
13
+ inputName: { control: "none", table: { disable: true } },
14
+ placeholder: { control: "none" },
15
+ hasPlaceholder: { control: "none" },
16
+ inputTextSize: { control: "none" },
17
+ inputShape: { control: "none" },
18
+ backgroundColor: { control: "none" },
19
+ inputWidth: { control: "none" },
20
+ inputBorderClasses: { control: "none" },
21
+ buttonText: { control: "none", table: { disable: true } },
22
+ buttonIcon: { control: "none", table: { disable: true } },
23
+ buttonIconClasses: { control: "none" },
24
+ buttonClasses: { control: "none" },
25
+ containerClasses: { control: "none" },
26
+ },
27
+ parameters: { layout: "centered" },
28
+ } as Meta;
29
+
30
+ const Template: StoryFn<SearchInputProps> = (args) => <SearchInput {...args} />;
31
+
32
+ export const Default = Template.bind({});
33
+ Default.args = {
34
+ inputType: "text",
35
+ inputName: "default",
36
+ hasPlaceholder: true,
37
+ placeholder: "Type something...",
38
+ inputTextSize: "text-base",
39
+ inputShape: "rounded-md",
40
+ backgroundColor: "bg-white",
41
+ inputWidth: "w-80",
42
+ inputBorderClasses: "border border-gray-300",
43
+ buttonText: <span>Search</span>,
44
+ buttonClasses: "bg-blue-500 text-white px-4 py-2 rounded-md",
45
+ buttonIcon: getFontAwesomeIcon("search"),
46
+ buttonIconClasses: "text-white",
47
+ containerClasses: "flex items-center space-x-2",
48
+ onButtonClick: (value) => alert(`Button clicked with input: ${value}`),
49
+ };
50
+
51
+ export const CommerceSearchInput = Template.bind({});
52
+ CommerceSearchInput.args = {
53
+ inputType: "search",
54
+ inputName: "commerceSearch",
55
+ hasPlaceholder: true,
56
+ placeholder: "Search for product...",
57
+ inputTextSize: "text-sm",
58
+ inputShape: "",
59
+ backgroundColor: "bg-gray-50",
60
+ inputWidth: "w-full",
61
+ inputBorderClasses: "border border-gray-300 focus:outline-none rounded-l-md",
62
+ buttonIcon: getFontAwesomeIcon("search"),
63
+ buttonIconClasses: "text-white",
64
+ buttonClasses: "bg-teal-600 p-2 rounded-r-md hover:bg-teal-700",
65
+ containerClasses: "flex items-center shadow-sm overflow-hidden",
66
+ onButtonClick: (value) => console.log(`Searching for: ${value}`),
67
+ };
68
+
69
+
70
+ export const WithIconButton = Template.bind({});
71
+ WithIconButton.args = {
72
+ inputType: "search",
73
+ inputName: "searchIcon",
74
+ hasPlaceholder: true,
75
+ placeholder: "Search...",
76
+ inputTextSize: "text-md",
77
+ inputShape: "rounded-full",
78
+ backgroundColor: "bg-gray-50",
79
+ inputWidth: "w-64",
80
+ inputBorderClasses: "border border-gray-400",
81
+ buttonIcon: getFontAwesomeIcon("magnifying-glass"),
82
+ buttonIconClasses: "text-blue-500",
83
+ buttonClasses: "p-2",
84
+ containerClasses: "flex items-center",
85
+ onButtonClick: (value) => console.log(`Searching for: ${value}`),
86
+ };
87
+
88
+ export const WithoutButton = Template.bind({});
89
+ WithoutButton.args = {
90
+ inputType: "text",
91
+ inputName: "withoutButton",
92
+ hasPlaceholder: true,
93
+ placeholder: "No button here...",
94
+ inputTextSize: "text-sm",
95
+ inputShape: "rounded",
96
+ backgroundColor: "bg-gray-100",
97
+ inputWidth: "w-full",
98
+ inputBorderClasses: "border border-gray-300",
99
+ containerClasses: "flex items-center",
100
+ onButtonClick: () => { },
101
+ };
102
+
103
+ export const CustomizedButton = Template.bind({});
104
+ CustomizedButton.args = {
105
+ inputType: "text",
106
+ inputName: "customButton",
107
+ hasPlaceholder: true,
108
+ placeholder: "Enter your query...",
109
+ inputTextSize: "text-lg",
110
+ inputShape: "rounded-lg",
111
+ backgroundColor: "bg-white",
112
+ inputWidth: "w-96",
113
+ inputBorderClasses: "border border-blue-500",
114
+ buttonText: (
115
+ <span className="flex items-center space-x-1">
116
+ {getFontAwesomeIcon("arrow-right")}
117
+ <span>Go</span>
118
+ </span>
119
+ ),
120
+ buttonClasses:
121
+ "bg-green-600 text-white hover:bg-green-700 transition-colors rounded-full px-5 py-2",
122
+ buttonIcon: null,
123
+ containerClasses: "flex items-center space-x-3",
124
+ onButtonClick: (value) => alert(`Navigating with: ${value}`),
125
+ };
126
+
127
+ export const DisabledInput = Template.bind({});
128
+ DisabledInput.args = {
129
+ inputType: "text",
130
+ inputName: "disabledInput",
131
+ hasPlaceholder: true,
132
+ placeholder: "Disabled...",
133
+ inputTextSize: "text-sm",
134
+ inputShape: "rounded",
135
+ backgroundColor: "bg-gray-200",
136
+ inputWidth: "w-72",
137
+ inputBorderClasses: "border border-gray-400 cursor-not-allowed",
138
+ buttonText: <span>Disabled</span>,
139
+ buttonClasses: "bg-gray-500 text-gray-300 px-4 py-2 rounded",
140
+ buttonIcon: getFontAwesomeIcon("ban"),
141
+ buttonIconClasses: "text-gray-400",
142
+ containerClasses: "flex items-center",
143
+ onButtonClick: () => alert("Button is disabled."),
144
+ };
@@ -0,0 +1,81 @@
1
+ import React, { useState } from "react";
2
+ import FormButton from "../FormButton/FormButton";
3
+ import { SearchInputProps } from "./SearchInput.types";
4
+
5
+ const SearchInput: React.FC<SearchInputProps> = ({
6
+ label,
7
+ inputName,
8
+ inputType,
9
+ hasPlaceholder,
10
+ placeholder,
11
+ inputTextSize,
12
+ inputShape,
13
+ backgroundColor,
14
+ inputWidth,
15
+ inputBorderClasses,
16
+ buttonClasses,
17
+ buttonText,
18
+ buttonIcon,
19
+ buttonIconClasses,
20
+ containerClasses,
21
+ onButtonClick,
22
+ role,
23
+ ariaLabel,
24
+ }) => {
25
+ const [inputValue, setInputValue] = useState<string>("");
26
+
27
+ const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
28
+ setInputValue(e.target.value);
29
+ };
30
+
31
+ const handleButtonClick = (
32
+ event: React.MouseEvent<
33
+ HTMLButtonElement | HTMLAnchorElement,
34
+ MouseEvent
35
+ >
36
+ ) => {
37
+ event.preventDefault();
38
+ if (event.currentTarget instanceof HTMLButtonElement) {
39
+ onButtonClick(inputValue);
40
+ }
41
+ };
42
+
43
+ return (
44
+ <div className={containerClasses} role={role} aria-label={ariaLabel}>
45
+ <form className="w-full">
46
+ <label htmlFor={inputName} className={`sr-only`}>
47
+ {label}
48
+ </label>
49
+ <div className="flex w-full">
50
+ <div className="flex w-full">
51
+ <input
52
+ type={inputType}
53
+ placeholder={
54
+ hasPlaceholder ? placeholder : undefined
55
+ }
56
+ name={inputName}
57
+ id={inputName}
58
+ value={inputValue}
59
+ onChange={handleInputChange}
60
+ className={`flex p-2 ${inputTextSize} ${inputShape} ${backgroundColor} ${inputWidth} ${inputBorderClasses}`}
61
+ />
62
+ <div
63
+ className={`flex items-center justify-center h-full`}
64
+ >
65
+ <FormButton
66
+ text={buttonText}
67
+ icon={buttonIcon}
68
+ iconClasses={buttonIconClasses}
69
+ as="button"
70
+ additionalClasses={buttonClasses}
71
+ onClick={handleButtonClick}
72
+ />
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </form>
77
+ </div>
78
+ );
79
+ };
80
+
81
+ export default SearchInput;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+
3
+ export interface SearchInputProps {
4
+ onChange?: (
5
+ e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>
6
+ ) => void;
7
+ value?: string;
8
+ label: React.ReactNode;
9
+ role?: string;
10
+ ariaLabel?: string;
11
+ inputType: string;
12
+ inputName: string;
13
+ hasPlaceholder: boolean;
14
+ placeholder: string;
15
+ containerClasses?: string;
16
+ inputTextSize?: string;
17
+ inputWidth?: string;
18
+ inputShape?: string;
19
+ borderColor?: string;
20
+ backgroundColor?: string;
21
+ inputBorderClasses?: string;
22
+ additionalClasses?: string;
23
+ buttonText?: JSX.Element;
24
+ buttonClasses?: string;
25
+ buttonIcon?: JSX.Element | null;
26
+ buttonIconClasses?: string;
27
+ onButtonClick: (inputValue: string) => void;
28
+ }