@4alldigital/foundation-ui--core 3.0.0

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 (470) hide show
  1. package/LICENSE.txt +21 -0
  2. package/package.json +35 -0
  3. package/src/__mocks__/_examples/cnbc.ts +146 -0
  4. package/src/__mocks__/_examples/nrg.ts +222 -0
  5. package/src/__mocks__/empty-module.js +0 -0
  6. package/src/__mocks__/fileMock.js +3 -0
  7. package/src/__mocks__/fileTransformer.js +8 -0
  8. package/src/__mocks__/mockSearchData.js +511 -0
  9. package/src/__mocks__/nrglogo.svg +74 -0
  10. package/src/__mocks__/styleMock.js +3 -0
  11. package/src/__mocks__/tempPolyFills.js +5 -0
  12. package/src/components/Accordion/Accordion.stories.tsx +33 -0
  13. package/src/components/Accordion/Accordion.tsx +53 -0
  14. package/src/components/Accordion/Accordion.types.ts +8 -0
  15. package/src/components/Accordion/index.ts +1 -0
  16. package/src/components/AnimationCounter/AnimationCounter.stories.tsx +22 -0
  17. package/src/components/AnimationCounter/AnimationCounter.tsx +51 -0
  18. package/src/components/AnimationCounter/AnimationCounter.types.ts +10 -0
  19. package/src/components/AnimationCounter/index.ts +1 -0
  20. package/src/components/AnimationSet1/AnimationSet1.stories.tsx +36 -0
  21. package/src/components/AnimationSet1/AnimationSet1.tsx +107 -0
  22. package/src/components/AnimationSet1/AnimationSet1.types.ts +12 -0
  23. package/src/components/AnimationSet1/index.ts +1 -0
  24. package/src/components/Authenticator/Authenticator.stories.tsx +37 -0
  25. package/src/components/Authenticator/Authenticator.tsx +84 -0
  26. package/src/components/Authenticator/Authenticator.types.ts +7 -0
  27. package/src/components/Authenticator/index.ts +1 -0
  28. package/src/components/Avatar/Avatar.stories.tsx +26 -0
  29. package/src/components/Avatar/Avatar.tsx +88 -0
  30. package/src/components/Avatar/Avatar.types.ts +8 -0
  31. package/src/components/Avatar/index.ts +1 -0
  32. package/src/components/Banner/Banner.stories.tsx +59 -0
  33. package/src/components/Banner/Banner.tsx +60 -0
  34. package/src/components/Banner/Banner.types.ts +9 -0
  35. package/src/components/Banner/index.ts +1 -0
  36. package/src/components/Blockquote/Blockquote.stories.tsx +20 -0
  37. package/src/components/Blockquote/Blockquote.tsx +32 -0
  38. package/src/components/Blockquote/Blockquote.types.ts +8 -0
  39. package/src/components/Blockquote/index.ts +1 -0
  40. package/src/components/Button/Button.stories.tsx +50 -0
  41. package/src/components/Button/Button.tsx +117 -0
  42. package/src/components/Button/Button.types.ts +43 -0
  43. package/src/components/Button/index.ts +1 -0
  44. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +59 -0
  45. package/src/components/ButtonGroup/ButtonGroup.tsx +35 -0
  46. package/src/components/ButtonGroup/ButtonGroup.types.ts +5 -0
  47. package/src/components/ButtonGroup/index.ts +1 -0
  48. package/src/components/Calendar/Calendar.stories.tsx +100 -0
  49. package/src/components/Calendar/Calendar.tsx +91 -0
  50. package/src/components/Calendar/Calendar.types.ts +10 -0
  51. package/src/components/Calendar/index.ts +2 -0
  52. package/src/components/Card/Card.stories.tsx +487 -0
  53. package/src/components/Card/Card.tsx +32 -0
  54. package/src/components/Card/Card.types.ts +79 -0
  55. package/src/components/Card/constants/index.ts +8 -0
  56. package/src/components/Card/index.ts +1 -0
  57. package/src/components/Card/types/CardBasic/CardBasic.tsx +262 -0
  58. package/src/components/Card/types/CardBasic/CardBasic.types.ts +7 -0
  59. package/src/components/Card/types/CardBasic/index.ts +1 -0
  60. package/src/components/Card/types/CardData/CardData.tsx +68 -0
  61. package/src/components/Card/types/CardData/CardData.types.ts +21 -0
  62. package/src/components/Card/types/CardData/index.ts +1 -0
  63. package/src/components/Card/types/CardHorz/CardHorz.tsx +80 -0
  64. package/src/components/Card/types/CardHorz/CardHorz.types.ts +8 -0
  65. package/src/components/Card/types/CardHorz/index.ts +1 -0
  66. package/src/components/Card/types/CardIcon/CardIcon.tsx +76 -0
  67. package/src/components/Card/types/CardIcon/CardIcon.types.ts +8 -0
  68. package/src/components/Card/types/CardIcon/index.ts +1 -0
  69. package/src/components/Card/types/CardMedia/CardMedia.tsx +277 -0
  70. package/src/components/Card/types/CardMedia/CardMedia.types.ts +5 -0
  71. package/src/components/Card/types/CardMedia/index.ts +1 -0
  72. package/src/components/Card/types/CardVideo/CardVideo.tsx +262 -0
  73. package/src/components/Card/types/CardVideo/CardVideo.types.ts +11 -0
  74. package/src/components/Card/types/CardVideo/index.ts +1 -0
  75. package/src/components/CardGrid/CardGrid.stories.tsx +122 -0
  76. package/src/components/CardGrid/CardGrid.tsx +25 -0
  77. package/src/components/CardGrid/CardGrid.types.ts +7 -0
  78. package/src/components/CardGrid/index.ts +1 -0
  79. package/src/components/Carousel/Carousel.stories.tsx +351 -0
  80. package/src/components/Carousel/Carousel.tsx +174 -0
  81. package/src/components/Carousel/Carousel.types.ts +32 -0
  82. package/src/components/Carousel/MIGRATION.md +156 -0
  83. package/src/components/Carousel/index.ts +1 -0
  84. package/src/components/Cart/Cart.stories.tsx +92 -0
  85. package/src/components/Cart/Cart.tsx +194 -0
  86. package/src/components/Cart/Cart.types.ts +4 -0
  87. package/src/components/Cart/index.ts +1 -0
  88. package/src/components/Checkbox/Checkbox.stories.tsx +18 -0
  89. package/src/components/Checkbox/Checkbox.tsx +38 -0
  90. package/src/components/Checkbox/Checkbox.types.ts +15 -0
  91. package/src/components/Checkbox/index.ts +1 -0
  92. package/src/components/Chip/Chip.stories.tsx +37 -0
  93. package/src/components/Chip/Chip.tsx +104 -0
  94. package/src/components/Chip/Chip.types.ts +13 -0
  95. package/src/components/Chip/index.ts +1 -0
  96. package/src/components/Collapsible/Collapsible.stories.tsx +139 -0
  97. package/src/components/Collapsible/Collapsible.tsx +75 -0
  98. package/src/components/Collapsible/Collapsible.types.ts +14 -0
  99. package/src/components/Collapsible/index.ts +3 -0
  100. package/src/components/Container/Container.stories.tsx +17 -0
  101. package/src/components/Container/Container.tsx +51 -0
  102. package/src/components/Container/Container.types.ts +17 -0
  103. package/src/components/Container/index.ts +1 -0
  104. package/src/components/ContentPageLayout/ContentPageLayout.stories.tsx +17 -0
  105. package/src/components/ContentPageLayout/ContentPageLayout.tsx +38 -0
  106. package/src/components/ContentPageLayout/ContentPageLayout.types.ts +17 -0
  107. package/src/components/ContentPageLayout/index.ts +1 -0
  108. package/src/components/ContentRowsLayout/ContentRowsLayout.stories.tsx +19 -0
  109. package/src/components/ContentRowsLayout/ContentRowsLayout.tsx +30 -0
  110. package/src/components/ContentRowsLayout/ContentRowsLayout.types.ts +15 -0
  111. package/src/components/ContentRowsLayout/index.ts +1 -0
  112. package/src/components/Copy/Copy.stories.tsx +28 -0
  113. package/src/components/Copy/Copy.tsx +43 -0
  114. package/src/components/Copy/Copy.types.tsx +53 -0
  115. package/src/components/Copy/index.tsx +1 -0
  116. package/src/components/DisplayHeading/DisplayHeading.stories.tsx +17 -0
  117. package/src/components/DisplayHeading/DisplayHeading.tsx +43 -0
  118. package/src/components/DisplayHeading/DisplayHeading.types.ts +8 -0
  119. package/src/components/DisplayHeading/index.ts +1 -0
  120. package/src/components/FileUpload/FileUpload.stories.tsx +18 -0
  121. package/src/components/FileUpload/FileUpload.tsx +41 -0
  122. package/src/components/FileUpload/FileUpload.types.ts +9 -0
  123. package/src/components/FileUpload/index.ts +1 -0
  124. package/src/components/Footer/Footer.stories.tsx +17 -0
  125. package/src/components/Footer/Footer.tsx +78 -0
  126. package/src/components/Footer/Footer.types.ts +4 -0
  127. package/src/components/Footer/index.ts +1 -0
  128. package/src/components/Form/Form.stories.tsx +81 -0
  129. package/src/components/Form/Form.tsx +98 -0
  130. package/src/components/Form/Form.types.ts +34 -0
  131. package/src/components/Form/index.ts +1 -0
  132. package/src/components/FormField/FormField.stories.tsx +205 -0
  133. package/src/components/FormField/FormField.tsx +258 -0
  134. package/src/components/FormField/FormField.types.ts +89 -0
  135. package/src/components/FormField/index.ts +1 -0
  136. package/src/components/FormSelect/FormSelect.stories.tsx +27 -0
  137. package/src/components/FormSelect/FormSelect.tsx +46 -0
  138. package/src/components/FormSelect/FormSelect.types.ts +45 -0
  139. package/src/components/FormSelect/index.ts +1 -0
  140. package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.stories.tsx +18 -0
  141. package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.tsx +26 -0
  142. package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.types.ts +6 -0
  143. package/src/components/FullContentBackgroundImage/index.ts +1 -0
  144. package/src/components/FullScreenVideoModal/FullScreenVideoModal.stories.tsx +34 -0
  145. package/src/components/FullScreenVideoModal/FullScreenVideoModal.tsx +41 -0
  146. package/src/components/FullScreenVideoModal/FullScreenVideoModal.types.ts +9 -0
  147. package/src/components/FullScreenVideoModal/index.ts +1 -0
  148. package/src/components/Header/Header.stories.tsx +51 -0
  149. package/src/components/Header/Header.tsx +170 -0
  150. package/src/components/Header/Header.types.ts +11 -0
  151. package/src/components/Header/index.ts +1 -0
  152. package/src/components/Heading/Heading.stories.tsx +57 -0
  153. package/src/components/Heading/Heading.tsx +47 -0
  154. package/src/components/Heading/Heading.types.ts +35 -0
  155. package/src/components/Heading/index.ts +1 -0
  156. package/src/components/Hero/Hero.stories.tsx +17 -0
  157. package/src/components/Hero/Hero.tsx +28 -0
  158. package/src/components/Hero/Hero.types.ts +17 -0
  159. package/src/components/Hero/index.ts +1 -0
  160. package/src/components/Hr/Hr.stories.tsx +13 -0
  161. package/src/components/Hr/Hr.tsx +16 -0
  162. package/src/components/Hr/Hr.types.ts +3 -0
  163. package/src/components/Hr/index.ts +1 -0
  164. package/src/components/HtmlContent/HtmlContent.stories.tsx +29 -0
  165. package/src/components/HtmlContent/HtmlContent.tsx +36 -0
  166. package/src/components/HtmlContent/HtmlContent.types.ts +6 -0
  167. package/src/components/HtmlContent/index.ts +1 -0
  168. package/src/components/Icon/Icon.stories.tsx +26 -0
  169. package/src/components/Icon/Icon.tsx +24 -0
  170. package/src/components/Icon/Icon.types.ts +8 -0
  171. package/src/components/Icon/index.ts +2 -0
  172. package/src/components/Image/Image.stories.tsx +32 -0
  173. package/src/components/Image/Image.tsx +71 -0
  174. package/src/components/Image/Image.types.ts +20 -0
  175. package/src/components/Image/index.ts +1 -0
  176. package/src/components/Label/Label.stories.tsx +18 -0
  177. package/src/components/Label/Label.tsx +17 -0
  178. package/src/components/Label/Label.types.ts +9 -0
  179. package/src/components/Label/index.ts +1 -0
  180. package/src/components/Link/Link.stories.tsx +25 -0
  181. package/src/components/Link/Link.tsx +85 -0
  182. package/src/components/Link/Link.types.ts +14 -0
  183. package/src/components/Link/index.ts +1 -0
  184. package/src/components/List/List.stories.tsx +38 -0
  185. package/src/components/List/List.tsx +17 -0
  186. package/src/components/List/List.types.ts +27 -0
  187. package/src/components/List/index.ts +1 -0
  188. package/src/components/ListItem/ListItem.stories.tsx +61 -0
  189. package/src/components/ListItem/ListItem.tsx +53 -0
  190. package/src/components/ListItem/ListItem.types.ts +10 -0
  191. package/src/components/ListItem/index.ts +1 -0
  192. package/src/components/Loader/Loader.stories.tsx +17 -0
  193. package/src/components/Loader/Loader.tsx +34 -0
  194. package/src/components/Loader/Loader.types.ts +5 -0
  195. package/src/components/Loader/index.ts +1 -0
  196. package/src/components/Logo/Logo.stories.tsx +17 -0
  197. package/src/components/Logo/Logo.tsx +17 -0
  198. package/src/components/Logo/Logo.types.ts +6 -0
  199. package/src/components/Logo/index.ts +1 -0
  200. package/src/components/Menu/Menu.stories.tsx +37 -0
  201. package/src/components/Menu/Menu.tsx +45 -0
  202. package/src/components/Menu/Menu.types.ts +15 -0
  203. package/src/components/Menu/index.ts +1 -0
  204. package/src/components/Notice/Notice.stories.tsx +49 -0
  205. package/src/components/Notice/Notice.tsx +63 -0
  206. package/src/components/Notice/Notice.types.ts +11 -0
  207. package/src/components/Notice/index.ts +1 -0
  208. package/src/components/OTPInput/OTPInput.stories.tsx +18 -0
  209. package/src/components/OTPInput/OTPInput.tsx +80 -0
  210. package/src/components/OTPInput/OTPInput.types.ts +8 -0
  211. package/src/components/OTPInput/index.ts +1 -0
  212. package/src/components/PanelCards/PanelCards.stories.tsx +125 -0
  213. package/src/components/PanelCards/PanelCards.tsx +81 -0
  214. package/src/components/PanelCards/PanelCards.types.ts +11 -0
  215. package/src/components/PanelCards/index.ts +1 -0
  216. package/src/components/PanelCustom/PanelCustom.stories.tsx +18 -0
  217. package/src/components/PanelCustom/PanelCustom.tsx +39 -0
  218. package/src/components/PanelCustom/PanelCustom.types.ts +20 -0
  219. package/src/components/PanelCustom/index.ts +1 -0
  220. package/src/components/PanelFeature/PanelFeature.stories.tsx +46 -0
  221. package/src/components/PanelFeature/PanelFeature.tsx +83 -0
  222. package/src/components/PanelFeature/PanelFeature.types.ts +27 -0
  223. package/src/components/PanelFeature/index.ts +1 -0
  224. package/src/components/PanelHero/PanelHero.stories.tsx +126 -0
  225. package/src/components/PanelHero/PanelHero.tsx +184 -0
  226. package/src/components/PanelHero/PanelHero.types.ts +19 -0
  227. package/src/components/PanelHero/index.ts +1 -0
  228. package/src/components/PanelIntro/PanelIntro.stories.tsx +38 -0
  229. package/src/components/PanelIntro/PanelIntro.tsx +139 -0
  230. package/src/components/PanelIntro/PanelIntro.types.ts +19 -0
  231. package/src/components/PanelIntro/index.ts +1 -0
  232. package/src/components/PanelProduct/PanelProduct.stories.tsx +24 -0
  233. package/src/components/PanelProduct/PanelProduct.tsx +87 -0
  234. package/src/components/PanelProduct/PanelProduct.types.ts +14 -0
  235. package/src/components/PanelProduct/index.ts +1 -0
  236. package/src/components/PanelScroller/PanelScroller.stories.tsx +81 -0
  237. package/src/components/PanelScroller/PanelScroller.tsx +58 -0
  238. package/src/components/PanelScroller/PanelScroller.types.ts +8 -0
  239. package/src/components/PanelScroller/index.ts +1 -0
  240. package/src/components/PanelVideo/PanelVideo.stories.tsx +42 -0
  241. package/src/components/PanelVideo/PanelVideo.tsx +81 -0
  242. package/src/components/PanelVideo/PanelVideo.types.ts +11 -0
  243. package/src/components/PanelVideo/index.ts +1 -0
  244. package/src/components/Radio/Radio.stories.tsx +24 -0
  245. package/src/components/Radio/Radio.tsx +44 -0
  246. package/src/components/Radio/Radio.types.ts +13 -0
  247. package/src/components/Radio/index.ts +1 -0
  248. package/src/components/Schedule/Schedule.stories.tsx +96 -0
  249. package/src/components/Schedule/Schedule.tsx +118 -0
  250. package/src/components/Schedule/Schedule.types.ts +64 -0
  251. package/src/components/Schedule/index.ts +1 -0
  252. package/src/components/ScheduleItem/ScheduleItem.stories.tsx +21 -0
  253. package/src/components/ScheduleItem/ScheduleItem.tsx +77 -0
  254. package/src/components/ScheduleItem/ScheduleItem.types.ts +8 -0
  255. package/src/components/ScheduleItem/index.ts +1 -0
  256. package/src/components/Screen/Screen.stories.tsx +27 -0
  257. package/src/components/Screen/Screen.tsx +63 -0
  258. package/src/components/Screen/Screen.types.ts +16 -0
  259. package/src/components/Screen/index.ts +1 -0
  260. package/src/components/ShadcnButton/ShadcnButton.tsx +57 -0
  261. package/src/components/ShadcnButton/index.ts +2 -0
  262. package/src/components/ShadcnCarousel/ShadcnCarousel.tsx +261 -0
  263. package/src/components/ShadcnCarousel/index.ts +9 -0
  264. package/src/components/Share/Share.stories.tsx +17 -0
  265. package/src/components/Share/Share.tsx +60 -0
  266. package/src/components/Share/Share.types.ts +12 -0
  267. package/src/components/Share/index.ts +1 -0
  268. package/src/components/SubscriptionManager/SubscriptionManager.stories.tsx +177 -0
  269. package/src/components/SubscriptionManager/SubscriptionManager.tsx +369 -0
  270. package/src/components/SubscriptionManager/SubscriptionManager.types.ts +36 -0
  271. package/src/components/SubscriptionManager/index.ts +1 -0
  272. package/src/components/Switch/Switch.stories.tsx +20 -0
  273. package/src/components/Switch/Switch.tsx +30 -0
  274. package/src/components/Switch/Switch.types.ts +7 -0
  275. package/src/components/Switch/index.ts +1 -0
  276. package/src/components/Tabs/Tabs.stories.tsx +34 -0
  277. package/src/components/Tabs/Tabs.tsx +42 -0
  278. package/src/components/Tabs/Tabs.types.ts +8 -0
  279. package/src/components/Tabs/index.ts +1 -0
  280. package/src/components/TextInput/TextInput.stories.tsx +18 -0
  281. package/src/components/TextInput/TextInput.tsx +78 -0
  282. package/src/components/TextInput/TextInput.types.ts +81 -0
  283. package/src/components/TextInput/index.ts +1 -0
  284. package/src/components/Video/Video.stories.tsx +75 -0
  285. package/src/components/Video/Video.tsx +280 -0
  286. package/src/components/Video/Video.types.ts +147 -0
  287. package/src/components/Video/index.ts +1 -0
  288. package/src/components/VisitUs/VisitUs.stories.tsx +32 -0
  289. package/src/components/VisitUs/VisitUs.tsx +56 -0
  290. package/src/components/VisitUs/VisitUs.types.ts +13 -0
  291. package/src/components/VisitUs/index.ts +1 -0
  292. package/src/components/index.ts +143 -0
  293. package/src/constants/index.ts +6 -0
  294. package/src/context/Amplify/index.tsx +65 -0
  295. package/src/context/App/index.tsx +93 -0
  296. package/src/context/Cart/index.tsx +64 -0
  297. package/src/context/ExampleContext/index.tsx +34 -0
  298. package/src/context/Theme/index.tsx +37 -0
  299. package/src/context/index.ts +18 -0
  300. package/src/features/Search/Search.stories.tsx +395 -0
  301. package/src/features/Search/Search.tsx +204 -0
  302. package/src/features/Search/Search.types.ts +41 -0
  303. package/src/features/Search/config/config-helper.ts +219 -0
  304. package/src/features/Search/index.ts +1 -0
  305. package/src/features/Search/view-helpers/appendClassName.ts +14 -0
  306. package/src/features/Search/view-helpers/formatResult.ts +97 -0
  307. package/src/features/Search/view-helpers/getFilterValueDisplay.ts +10 -0
  308. package/src/features/Search/view-helpers/getUrlSanitizer.ts +23 -0
  309. package/src/features/Search/view-helpers/index.ts +4 -0
  310. package/src/features/Search/views/Layout/Layout.tsx +50 -0
  311. package/src/features/Search/views/Layout/Layout.types.ts +13 -0
  312. package/src/features/Search/views/Layout/index.ts +1 -0
  313. package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.tsx +85 -0
  314. package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.types.ts +5 -0
  315. package/src/features/Search/views/MultiCheckboxFacet/index.ts +1 -0
  316. package/src/features/Search/views/Paging/Paging.tsx +35 -0
  317. package/src/features/Search/views/Paging/Paging.types.ts +24 -0
  318. package/src/features/Search/views/Paging/index.ts +1 -0
  319. package/src/features/Search/views/PagingInfo/PagingInfo.tsx +34 -0
  320. package/src/features/Search/views/PagingInfo/PagingInfo.types.ts +26 -0
  321. package/src/features/Search/views/PagingInfo/index.ts +1 -0
  322. package/src/features/Search/views/Result/Result.tsx +84 -0
  323. package/src/features/Search/views/Result/Result.types.ts +47 -0
  324. package/src/features/Search/views/Result/index.ts +1 -0
  325. package/src/features/Search/views/Results/Results.tsx +16 -0
  326. package/src/features/Search/views/Results/Results.types.ts +24 -0
  327. package/src/features/Search/views/Results/index.ts +1 -0
  328. package/src/features/Search/views/ResultsPerPage/ResultsPerPage.tsx +32 -0
  329. package/src/features/Search/views/ResultsPerPage/ResultsPerPage.types.ts +26 -0
  330. package/src/features/Search/views/ResultsPerPage/index.ts +1 -0
  331. package/src/features/Search/views/SearchBox/SearchBox.tsx +51 -0
  332. package/src/features/Search/views/SearchBox/SearchBox.types.ts +10 -0
  333. package/src/features/Search/views/SearchBox/index.ts +1 -0
  334. package/src/features/Search/views/Sidebar/Sidebar.tsx +14 -0
  335. package/src/features/Search/views/Sidebar/Sidebar.types.ts +3 -0
  336. package/src/features/Search/views/Sidebar/index.ts +1 -0
  337. package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.tsx +62 -0
  338. package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.types.ts +5 -0
  339. package/src/features/Search/views/SingleLinksFacet/index.ts +1 -0
  340. package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.tsx +34 -0
  341. package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.types.ts +5 -0
  342. package/src/features/Search/views/SingleSelectFacet/index.ts +1 -0
  343. package/src/features/Search/views/Sorting/Sorting.tsx +24 -0
  344. package/src/features/Search/views/Sorting/Sorting.types.ts +25 -0
  345. package/src/features/Search/views/Sorting/index.ts +1 -0
  346. package/src/features/index.ts +11 -0
  347. package/src/forms/ForgotPasswordForm/ForgotPasswordForm.stories.tsx +19 -0
  348. package/src/forms/ForgotPasswordForm/ForgotPasswordForm.tsx +28 -0
  349. package/src/forms/ForgotPasswordForm/ForgotPasswordForm.types.ts +3 -0
  350. package/src/forms/ForgotPasswordForm/index.ts +1 -0
  351. package/src/forms/LoginForm/LoginForm.stories.tsx +67 -0
  352. package/src/forms/LoginForm/LoginForm.tsx +112 -0
  353. package/src/forms/LoginForm/LoginForm.types.ts +7 -0
  354. package/src/forms/LoginForm/index.ts +1 -0
  355. package/src/forms/ProfileForm/ProfileForm.stories.tsx +23 -0
  356. package/src/forms/ProfileForm/ProfileForm.tsx +40 -0
  357. package/src/forms/ProfileForm/ProfileForm.types.ts +6 -0
  358. package/src/forms/ProfileForm/index.ts +1 -0
  359. package/src/forms/PromoCodeForm/PromoCodeForm.stories.tsx +19 -0
  360. package/src/forms/PromoCodeForm/PromoCodeForm.tsx +22 -0
  361. package/src/forms/PromoCodeForm/PromoCodeForm.types.ts +4 -0
  362. package/src/forms/PromoCodeForm/index.ts +1 -0
  363. package/src/forms/RegisterForm/RegisterForm.stories.tsx +85 -0
  364. package/src/forms/RegisterForm/RegisterForm.tsx +108 -0
  365. package/src/forms/RegisterForm/RegisterForm.types.ts +6 -0
  366. package/src/forms/RegisterForm/index.ts +1 -0
  367. package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.stories.tsx +23 -0
  368. package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.tsx +39 -0
  369. package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.types.ts +3 -0
  370. package/src/forms/ResetPasswordAuthForm/index.ts +1 -0
  371. package/src/forms/ResetPasswordForm/ResetPasswordForm.stories.tsx +23 -0
  372. package/src/forms/ResetPasswordForm/ResetPasswordForm.tsx +30 -0
  373. package/src/forms/ResetPasswordForm/ResetPasswordForm.types.ts +3 -0
  374. package/src/forms/ResetPasswordForm/index.ts +1 -0
  375. package/src/forms/SubscriptionForm/SubscriptionForm.stories.tsx +31 -0
  376. package/src/forms/SubscriptionForm/SubscriptionForm.tsx +46 -0
  377. package/src/forms/SubscriptionForm/SubscriptionForm.types.ts +6 -0
  378. package/src/forms/SubscriptionForm/index.ts +1 -0
  379. package/src/forms/constants/index.ts +13 -0
  380. package/src/forms/index.ts +17 -0
  381. package/src/forms/validations/index.ts +39 -0
  382. package/src/hooks/index.ts +2 -0
  383. package/src/hooks/useLanguage.ts +18 -0
  384. package/src/hooks/useTheme.ts +6 -0
  385. package/src/index.ts +8 -0
  386. package/src/react-app-env.d.ts +1 -0
  387. package/src/setupTests.ts +5 -0
  388. package/src/templates/AccountScreen/AccountScreen.stories.tsx +67 -0
  389. package/src/templates/AccountScreen/AccountScreen.tsx +78 -0
  390. package/src/templates/AccountScreen/AccountScreen.types.ts +31 -0
  391. package/src/templates/AccountScreen/index.ts +1 -0
  392. package/src/templates/AuthScreen/AuthScreen.stories.tsx +33 -0
  393. package/src/templates/AuthScreen/AuthScreen.tsx +21 -0
  394. package/src/templates/AuthScreen/AuthScreen.types.ts +8 -0
  395. package/src/templates/AuthScreen/index.ts +1 -0
  396. package/src/templates/CardGridScreen/CardGridScreen.stories.tsx +95 -0
  397. package/src/templates/CardGridScreen/CardGridScreen.tsx +43 -0
  398. package/src/templates/CardGridScreen/CardGridScreen.types.ts +11 -0
  399. package/src/templates/CardGridScreen/index.ts +1 -0
  400. package/src/templates/CatalogueScreen/CatalogueScreen.stories.tsx +31 -0
  401. package/src/templates/CatalogueScreen/CatalogueScreen.tsx +21 -0
  402. package/src/templates/CatalogueScreen/CatalogueScreen.types.ts +8 -0
  403. package/src/templates/CatalogueScreen/index.ts +1 -0
  404. package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.stories.tsx +171 -0
  405. package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.tsx +36 -0
  406. package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.types.ts +9 -0
  407. package/src/templates/ChallengeLibraryScreen/index.ts +1 -0
  408. package/src/templates/ChallengeScreen/ChallengeScreen.stories.tsx +65 -0
  409. package/src/templates/ChallengeScreen/ChallengeScreen.tsx +88 -0
  410. package/src/templates/ChallengeScreen/ChallengeScreen.types.ts +22 -0
  411. package/src/templates/ChallengeScreen/index.ts +1 -0
  412. package/src/templates/ContentScreen/ContentScreen.stories.tsx +71 -0
  413. package/src/templates/ContentScreen/ContentScreen.tsx +55 -0
  414. package/src/templates/ContentScreen/ContentScreen.types.ts +9 -0
  415. package/src/templates/ContentScreen/index.ts +1 -0
  416. package/src/templates/DashboardScreen/DashboardScreen.stories.tsx +490 -0
  417. package/src/templates/DashboardScreen/DashboardScreen.tsx +156 -0
  418. package/src/templates/DashboardScreen/DashboardScreen.types.ts +28 -0
  419. package/src/templates/DashboardScreen/index.ts +1 -0
  420. package/src/templates/FAQScreen/FAQScreen.stories.tsx +278 -0
  421. package/src/templates/FAQScreen/FAQScreen.tsx +32 -0
  422. package/src/templates/FAQScreen/FAQScreen.types.ts +14 -0
  423. package/src/templates/FAQScreen/index.ts +1 -0
  424. package/src/templates/HomeScreen/HomeScreen.stories.tsx +315 -0
  425. package/src/templates/HomeScreen/HomeScreen.tsx +50 -0
  426. package/src/templates/HomeScreen/HomeScreen.types.ts +23 -0
  427. package/src/templates/HomeScreen/index.ts +1 -0
  428. package/src/templates/LogoutScreen/LogoutScreen.stories.tsx +20 -0
  429. package/src/templates/LogoutScreen/LogoutScreen.tsx +25 -0
  430. package/src/templates/LogoutScreen/LogoutScreen.types.ts +4 -0
  431. package/src/templates/LogoutScreen/index.ts +1 -0
  432. package/src/templates/MenuScreen/MenuScreen.stories.tsx +36 -0
  433. package/src/templates/MenuScreen/MenuScreen.tsx +32 -0
  434. package/src/templates/MenuScreen/MenuScreen.types.ts +11 -0
  435. package/src/templates/MenuScreen/index.ts +1 -0
  436. package/src/templates/NotFoundScreen/NotFoundScreen.stories.tsx +20 -0
  437. package/src/templates/NotFoundScreen/NotFoundScreen.tsx +31 -0
  438. package/src/templates/NotFoundScreen/NotFoundScreen.types.ts +5 -0
  439. package/src/templates/NotFoundScreen/index.ts +1 -0
  440. package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.stories.tsx +27 -0
  441. package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.tsx +20 -0
  442. package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.types.ts +6 -0
  443. package/src/templates/PasswordResetAuthScreen/index.ts +1 -0
  444. package/src/templates/PasswordResetScreen/PasswordResetScreen.stories.tsx +22 -0
  445. package/src/templates/PasswordResetScreen/PasswordResetScreen.tsx +19 -0
  446. package/src/templates/PasswordResetScreen/PasswordResetScreen.types.ts +6 -0
  447. package/src/templates/PasswordResetScreen/index.ts +1 -0
  448. package/src/templates/ProfileScreen/ProfileScreen.stories.tsx +41 -0
  449. package/src/templates/ProfileScreen/ProfileScreen.tsx +30 -0
  450. package/src/templates/ProfileScreen/ProfileScreen.types.ts +24 -0
  451. package/src/templates/ProfileScreen/index.ts +1 -0
  452. package/src/templates/ScheduleScreen/ScheduleScreen.stories.tsx +174 -0
  453. package/src/templates/ScheduleScreen/ScheduleScreen.tsx +29 -0
  454. package/src/templates/ScheduleScreen/ScheduleScreen.types.ts +9 -0
  455. package/src/templates/ScheduleScreen/index.ts +1 -0
  456. package/src/templates/SubscriptionScreen/SubscriptionScreen.stories.tsx +98 -0
  457. package/src/templates/SubscriptionScreen/SubscriptionScreen.tsx +49 -0
  458. package/src/templates/SubscriptionScreen/SubscriptionScreen.types.ts +28 -0
  459. package/src/templates/SubscriptionScreen/index.ts +1 -0
  460. package/src/templates/WorkoutScreen/WorkoutScreen.stories.tsx +173 -0
  461. package/src/templates/WorkoutScreen/WorkoutScreen.tsx +230 -0
  462. package/src/templates/WorkoutScreen/WorkoutScreen.types.ts +34 -0
  463. package/src/templates/WorkoutScreen/index.ts +1 -0
  464. package/src/templates/index.ts +40 -0
  465. package/src/translations/en.ts +777 -0
  466. package/src/translations/fr.ts +182 -0
  467. package/src/translations/index.ts +2 -0
  468. package/src/utils/htmlParser/index.tsx +22 -0
  469. package/src/utils/index.ts +38 -0
  470. package/src/utils/parseDuration/index.ts +94 -0
@@ -0,0 +1,143 @@
1
+ // ATOMS
2
+ export { default as AnimationCounter } from './AnimationCounter';
3
+ export { default as Blockquote } from './Blockquote';
4
+ export { default as Button } from './Button';
5
+ export { default as Checkbox } from './Checkbox';
6
+ export { default as Chip } from './Chip';
7
+ export { default as Calendar } from './Calendar';
8
+ export { default as Collapsible } from './Collapsible';
9
+ export { default as Copy } from './Copy';
10
+ export { default as FileUpload } from './FileUpload';
11
+ export { default as Heading } from './Heading';
12
+ export { default as Hr } from './Hr';
13
+ export { default as Icon } from './Icon';
14
+ export { default as Image } from './Image';
15
+ export { default as Label } from './Label';
16
+ export { default as Link } from './Link';
17
+ export { default as List } from './List';
18
+ export { default as Logo } from './Logo';
19
+ export { default as ListItem } from './ListItem';
20
+ export { default as Notice } from './Notice';
21
+ export { default as Radio } from './Radio';
22
+ export { default as Switch } from './Switch';
23
+ export { default as TextInput } from './TextInput';
24
+ export { default as Avatar } from './Avatar';
25
+ export { default as Banner } from './Banner';
26
+
27
+ // MOLECULES
28
+ export { default as ButtonGroup } from './ButtonGroup';
29
+ export { default as Card } from './Card';
30
+ export { default as DisplayHeading } from './DisplayHeading';
31
+ export { default as Form } from './Form';
32
+ export { default as FormField } from './FormField';
33
+ export { default as FormSelect } from './FormSelect';
34
+ export { default as Share } from './Share';
35
+ export { default as Tabs } from './Tabs';
36
+ export { default as VisitUs } from './VisitUs';
37
+ export { default as Menu } from './Menu';
38
+ export { default as Hero } from './Hero';
39
+ export { default as HtmlContent } from './HtmlContent';
40
+
41
+ // ORGANISMS
42
+ export { default as AnimationSet1 } from './AnimationSet1';
43
+ export { default as Authenticator } from './Authenticator';
44
+ export { default as Carousel } from './Carousel';
45
+ export { default as PanelCards } from './PanelCards';
46
+ export { default as PanelFeature } from './PanelFeature';
47
+ export { default as PanelHero } from './PanelHero';
48
+ export { default as PanelProduct } from './PanelProduct';
49
+ export { default as PanelVideo } from './PanelVideo';
50
+ export { default as PanelIntro } from './PanelIntro';
51
+ export { default as PanelCustom } from './PanelCustom';
52
+ export { default as PanelScroller } from './PanelScroller';
53
+ export { default as CardGrid } from './CardGrid';
54
+ export { default as Screen } from './Screen';
55
+ export { default as Accordion } from './Accordion';
56
+ export { default as SubscriptionManager } from './SubscriptionManager';
57
+
58
+ // LAYOUTS
59
+ export { default as Container } from './Container';
60
+ export { default as ContentPageLayout } from './ContentPageLayout';
61
+ export { default as ContentRowsLayout } from './ContentRowsLayout';
62
+ export { default as Footer } from './Footer';
63
+ export { default as Header } from './Header';
64
+
65
+ // UI
66
+ export { default as Loader } from './Loader';
67
+ export { default as Video } from './Video';
68
+ export { default as OTPInput } from './OTPInput';
69
+ export { default as FullScreenVideoModal } from './FullScreenVideoModal';
70
+ export { default as Cart } from './Cart';
71
+ export { default as FullContentBackgroundImage } from './FullContentBackgroundImage';
72
+
73
+ // TYPES
74
+ export type { Props as BlockquoteProps } from './Blockquote/Blockquote.types';
75
+ export type { Props as ButtonProps } from './Button/Button.types';
76
+ export { BTN_TYPES, BTN_VARIANTS, BTN_SIZES } from './Button/Button.types';
77
+ export type { Props as CopyProps } from './Copy/Copy.types';
78
+ export { COPY_ALIGN, COPY_TRANSFORM, COPY_CONTEXTUAL, COPY_SIZE, COPY_TAG } from './Copy/Copy.types';
79
+ export type { Props as HeadingProps } from './Heading/Heading.types';
80
+ export { HEADING_TAGS, HEADING_ALIGN, HEADING_TRANSFORM } from './Heading/Heading.types';
81
+ export type { Props as IconProps } from './Icon/Icon.types';
82
+ export type { Props as ImageProps } from './Image/Image.types';
83
+ export type { Props as LinkProps } from './Link/Link.types';
84
+ export type { Props as ListProps, VariantsTypes } from './List/List.types';
85
+ export { Variants, ListTag } from './List/List.types';
86
+ export type { Props as ListItemProps } from './ListItem/ListItem.types';
87
+ export type { Props as NoticeProps } from './Notice/Notice.types';
88
+ export type { Props as LoaderProps } from './Loader/Loader.types';
89
+ export type { Props as ContainerProps } from './Container/Container.types';
90
+ export type { Props as ContentPageLayoutProps } from './ContentPageLayout/ContentPageLayout.types';
91
+ export { CPL_SPACING } from './ContentPageLayout/ContentPageLayout.types';
92
+ export type { Props as ContentRowsLayoutProps } from './ContentRowsLayout/ContentRowsLayout.types';
93
+ export { CRL_SIZE } from './ContentRowsLayout/ContentRowsLayout.types';
94
+ export type { Props as FormProps } from './Form/Form.types';
95
+ export type { Props as FormFieldProps } from './FormField/FormField.types';
96
+ export { FIELD_TYPES } from './FormField/FormField.types';
97
+ export type { Props as CardProps } from './Card/Card.types';
98
+ export { CardVariant } from './Card/Card.types';
99
+ export type { Props as PanelCardsProps } from './PanelCards/PanelCards.types';
100
+ export type { Props as PanelFeatureProps } from './PanelFeature/PanelFeature.types';
101
+ export type { Props as PanelHeroProps } from './PanelHero/PanelHero.types';
102
+ export type { Props as PanelProductProps } from './PanelProduct/PanelProduct.types';
103
+ export type { Props as PanelVideoProps } from './PanelVideo/PanelVideo.types';
104
+ export type { Props as PanelIntroProps } from './PanelIntro/PanelIntro.types';
105
+ export type { Props as PanelCustomProps } from './PanelCustom/PanelCustom.types';
106
+ export type { Props as PanelScrollerProps } from './PanelScroller/PanelScroller.types';
107
+ export type { Props as ShareProps } from './Share/Share.types';
108
+ export type { Props as TabsProps } from './Tabs/Tabs.types';
109
+ export type { Props as VisitUsProps } from './VisitUs/VisitUs.types';
110
+ export type { Props as MenuProps } from './Menu/Menu.types';
111
+ export type { Props as CheckboxProps } from './Checkbox/Checkbox.types';
112
+ export type { Props as RadioProps } from './Radio/Radio.types';
113
+ export type { Props as SwitchProps } from './Switch/Switch.types';
114
+ export type { Props as TextInputProps } from './TextInput/TextInput.types';
115
+ export type { Props as AnimationCounterProps } from './AnimationCounter/AnimationCounter.types';
116
+ export type { Props as ButtonGroupProps } from './ButtonGroup/ButtonGroup.types';
117
+ export type { Props as LogoProps } from './Logo/Logo.types';
118
+ export type { Props as FormSelectProps } from './FormSelect/FormSelect.types';
119
+ export type { Props as AuthenticatorProps } from './Authenticator/Authenticator.types';
120
+ export type { Props as DisplayHeadingProps } from './DisplayHeading/DisplayHeading.types';
121
+ export type { Props as AnimationSet1Props } from './AnimationSet1/AnimationSet1.types';
122
+ export type { Props as FileUploadProps } from './FileUpload/FileUpload.types';
123
+ export type { Props as HrProps } from './Hr/Hr.types';
124
+ export type { Props as FooterProps } from './Footer/Footer.types';
125
+ export type { Props as VideoProps } from './Video/Video.types';
126
+ export type { Props as ChipProps } from './Chip/Chip.types';
127
+ export type { CalendarProps } from './Calendar/Calendar.types';
128
+ export type { CollapsibleRootProps, CollapsibleTriggerProps, CollapsibleContentProps } from './Collapsible/Collapsible.types';
129
+ export type { Props as AvatarProps } from './Avatar/Avatar.types';
130
+ export type { Props as BannerProps } from './Banner/Banner.types';
131
+ export type { Props as OTPInputProps } from './OTPInput/OTPInput.types';
132
+ export type { Props as HeroProps } from './Hero/Hero.types';
133
+ export { SPACING } from './Hero/Hero.types';
134
+ export type { Props as HtmlContentProps } from './HtmlContent/HtmlContent.types';
135
+ export type { Props as CardGridProps } from './CardGrid/CardGrid.types';
136
+ export type { Props as ScreenProps } from './Screen/Screen.types';
137
+ export type { Props as CarouselProps } from './Carousel/Carousel.types';
138
+ export type { Props as AccordionProps } from './Accordion/Accordion.types';
139
+ export type { Props as SubscriptionManagerProps } from './SubscriptionManager/SubscriptionManager.types';
140
+ export type { Props as FullScreenVideoModalProps } from './FullScreenVideoModal/FullScreenVideoModal.types';
141
+ export type { Props as CartProps } from './Cart/Cart.types';
142
+ export type { Props as FullContentBackgroundImageProps } from './FullContentBackgroundImage/FullContentBackgroundImage.types';
143
+ export type { Props as HeaderProps } from './Header/Header.types';
@@ -0,0 +1,6 @@
1
+ // Date only
2
+ export const DATE_FORMAT = 'MMMM dd, yyyy';
3
+ // date with time
4
+ export const DATE_TIME_FORMAT = 'MMMM dd, yyyy HH:mm';
5
+ // TIme only
6
+ export const TIME_FORMAT = 'HH:mm';
@@ -0,0 +1,65 @@
1
+ import React, { createContext, ReactNode, useEffect } from 'react';
2
+ import { Amplify } from 'aws-amplify';
3
+
4
+ interface AmplifyContextProps {
5
+ config: {
6
+ region?: string;
7
+ userPoolId?: string;
8
+ userPoolWebClientId?: string;
9
+ signUpVerificationMethod?: string;
10
+ oauth: {
11
+ domain?: string;
12
+ scope?: string[];
13
+ redirectSignIn?: string;
14
+ redirectSignOut?: string;
15
+ responseType?: string;
16
+ };
17
+ cookieStorage: {
18
+ domain?: string;
19
+ secure?: boolean;
20
+ };
21
+ };
22
+ }
23
+
24
+ export const AmplifyContext = createContext<AmplifyContextProps>({
25
+ config: {
26
+ region: 'eu-west-1',
27
+ oauth: {},
28
+ cookieStorage: {},
29
+ },
30
+ });
31
+
32
+ interface AmplifyProviderProps {
33
+ children: ReactNode;
34
+ value: AmplifyContextProps;
35
+ }
36
+
37
+ export const AmplifyProvider = ({ children, value }: AmplifyProviderProps) => {
38
+ useEffect(() => {
39
+ if (value.config) {
40
+ Amplify.configure({
41
+ Auth: {
42
+ region: value?.config?.region,
43
+ userPoolId: value?.config?.userPoolId,
44
+ userPoolWebClientId: value?.config?.userPoolWebClientId,
45
+ signUpVerificationMethod: value?.config?.signUpVerificationMethod || 'code', // 'code' | 'link'
46
+ oauth: {
47
+ domain: value?.config?.oauth?.domain,
48
+ scope: value?.config?.oauth?.scope || ['email', 'profile', 'openid', 'aws.cognito.signin.user.admin'],
49
+ redirectSignIn: value?.config?.oauth?.redirectSignIn,
50
+ redirectSignOut: value?.config?.oauth?.redirectSignOut,
51
+ responseType: value?.config?.oauth?.responseType || 'code', // or 'token', note that REFRESH token will only be generated when the responseType is code
52
+ },
53
+ cookieStorage: {
54
+ domain: value?.config?.cookieStorage?.domain,
55
+ secure: process.env.NODE_ENV === 'production' ? true : value?.config?.cookieStorage?.secure,
56
+ },
57
+ },
58
+ });
59
+ }
60
+ }, [value.config]);
61
+
62
+ return <AmplifyContext.Provider value={value}>{children}</AmplifyContext.Provider>;
63
+ };
64
+
65
+ export default AmplifyProvider;
@@ -0,0 +1,93 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ import { ShareProps } from '../../components/VisitUs/VisitUs.types';
3
+
4
+ interface AppContextProps {
5
+ brand?: {
6
+ logo: string;
7
+ logoAspectRatio: string;
8
+ name: string;
9
+ tagline?: string;
10
+ logoOnly?: boolean;
11
+ };
12
+ header?: {
13
+ authNav?: {
14
+ id: string;
15
+ title: string;
16
+ url: string;
17
+ }[];
18
+ anonNav?: {
19
+ id: string;
20
+ title: string;
21
+ url: string;
22
+ }[];
23
+ profile?: {
24
+ id: string;
25
+ title: string;
26
+ url: string;
27
+ }[];
28
+ };
29
+ footer?: {
30
+ about?: string;
31
+ visitUs?: {
32
+ facebook?: ShareProps;
33
+ instagram?: ShareProps;
34
+ linkedin?: ShareProps;
35
+ twitter?: ShareProps;
36
+ youtube?: ShareProps;
37
+ };
38
+ menus?: {
39
+ title: string;
40
+ links: {
41
+ id: string;
42
+ title: string;
43
+ url: string;
44
+ icon?: string;
45
+ }[];
46
+ }[];
47
+ custom: React.ReactNode;
48
+ };
49
+ locale?: {
50
+ lang?: string;
51
+ currency?: string;
52
+ country?: string;
53
+ };
54
+ images?: {
55
+ banner: string[];
56
+ placeholder: string;
57
+ };
58
+ app?: {
59
+ loginCallback?: () => void;
60
+ logoutCallback?: () => void;
61
+ isAuthenticated?: boolean;
62
+ showCart?: boolean;
63
+ };
64
+ }
65
+
66
+ export const AppContext = createContext<AppContextProps>({
67
+ brand: undefined,
68
+ header: undefined,
69
+ footer: undefined,
70
+ locale: undefined,
71
+ app: undefined,
72
+ images: undefined,
73
+ });
74
+
75
+ interface AppProviderProps {
76
+ children: React.ReactNode;
77
+ value: AppContextProps;
78
+ }
79
+
80
+ export const AppProvider = ({ children, value }: AppProviderProps) => {
81
+ return <AppContext.Provider value={value}>{children}</AppContext.Provider>;
82
+ };
83
+
84
+ // Custom hook for easier access to the context
85
+ export const useAppContext = (): AppContextProps => {
86
+ const context = useContext(AppContext);
87
+ if (context === undefined) {
88
+ throw new Error('useAppContext must be used within a AppProvider');
89
+ }
90
+ return context;
91
+ };
92
+
93
+ export default AppProvider;
@@ -0,0 +1,64 @@
1
+ import { createContext, useContext, ReactNode } from 'react';
2
+
3
+ // Define the context props (you can add more properties depending on your requirements)
4
+ interface ContextProps {
5
+ value: {
6
+ items?: {
7
+ uuid: string;
8
+ title: string;
9
+ image: string;
10
+ options?: {
11
+ usage?: string | null;
12
+ selectedPrice?: number | null;
13
+ selectedLicense?: string | null;
14
+ };
15
+ }[];
16
+ taxRate?: {
17
+ country: string;
18
+ percentage: number;
19
+ };
20
+ taxAmount?: number;
21
+ promoCode?: {
22
+ code: string;
23
+ name: string;
24
+ discount: string;
25
+ discountedAmount: number;
26
+ };
27
+ currency?: {
28
+ symbol: string;
29
+ code: string;
30
+ showCode?: boolean;
31
+ };
32
+ cartTotal?: string;
33
+ };
34
+ handleRemoveFromCart?: (uuid: string) => void;
35
+ handleAddPromoCode?: (code: string) => void;
36
+ handleRemovePromoCode?: (code: string) => void;
37
+ handleCheckout?: () => void;
38
+ handleItemClick?: (uuid: string) => void;
39
+ }
40
+
41
+ // Create the context with a default value
42
+ const CartContext = createContext<ContextProps | undefined>(undefined);
43
+
44
+ // Provider component that will wrap your app or specific part of it
45
+ interface CartProviderProps {
46
+ children: ReactNode;
47
+ data: ContextProps;
48
+ }
49
+
50
+ // SImple Provider context from app for component data UI render.
51
+ export const CartProvider = ({ children, data }: CartProviderProps) => {
52
+ return <CartContext.Provider value={data}>{children}</CartContext.Provider>;
53
+ };
54
+
55
+ // Custom hook for easier access to the context
56
+ export const useCartContext = (): ContextProps => {
57
+ const context = useContext(CartContext);
58
+ if (context === undefined) {
59
+ throw new Error('useCartContext must be used within a CartProvider');
60
+ }
61
+ return context;
62
+ };
63
+
64
+ export default CartProvider;
@@ -0,0 +1,34 @@
1
+ import React, { createContext, useContext, useState, ReactNode } from 'react';
2
+
3
+ // Define the context props (you can add more properties depending on your requirements)
4
+ interface ContextProps {
5
+ someState: string;
6
+ setSomeState: React.Dispatch<React.SetStateAction<string>>;
7
+ value: any;
8
+ }
9
+
10
+ // Create the context with a default value
11
+ const ExampleContext = createContext<ContextProps | undefined>(undefined);
12
+
13
+ // Provider component that will wrap your app or specific part of it
14
+ interface ExampleProviderProps {
15
+ children: ReactNode;
16
+ value: ContextProps;
17
+ }
18
+
19
+ export const ExampleProvider = ({ children, value }: ExampleProviderProps) => {
20
+ // Define your state here
21
+ const [someState, setSomeState] = useState<string>('default value');
22
+
23
+ // Pass the state and setter through the context provider
24
+ return <ExampleContext.Provider value={{ someState, setSomeState, value }}>{children}</ExampleContext.Provider>;
25
+ };
26
+
27
+ // Custom hook for easier access to the context
28
+ export const useMyContext = (): ContextProps => {
29
+ const context = useContext(ExampleContext);
30
+ if (context === undefined) {
31
+ throw new Error('useMyContext must be used within a ExampleProvider');
32
+ }
33
+ return context;
34
+ };
@@ -0,0 +1,37 @@
1
+ // State management for theme with Context API
2
+ // Theme provider for the application
3
+ // keeps track of the current theme selected by user
4
+ import React, { useContext } from 'react';
5
+ interface ThemeContextProps {
6
+ isDarkTheme: boolean;
7
+ toggleTheme: () => void;
8
+ theme?: any;
9
+ }
10
+
11
+ export const defaultTheme: ThemeContextProps = {
12
+ isDarkTheme: false,
13
+ toggleTheme: () => {},
14
+ theme: undefined,
15
+ };
16
+
17
+ export const ThemeContext = React.createContext<ThemeContextProps>(defaultTheme);
18
+
19
+ interface ThemeProviderProps {
20
+ children: React.ReactNode;
21
+ theme: ThemeContextProps;
22
+ }
23
+
24
+ export const ThemeProvider = ({ children, theme }: ThemeProviderProps) => {
25
+ return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
26
+ };
27
+
28
+ // Custom hook for easier access to the context
29
+ export const useThemeContext = (): ThemeContextProps => {
30
+ const context = useContext(ThemeContext);
31
+ if (context === undefined) {
32
+ throw new Error('useThemeContext must be used within a ThemeProvider');
33
+ }
34
+ return context;
35
+ };
36
+
37
+ export default ThemeProvider;
@@ -0,0 +1,18 @@
1
+ // export { default as ThemeContext } from './Theme';
2
+ // export { default as AppContext } from './AppContext';
3
+
4
+ // Theme
5
+ export * from './Theme';
6
+ export { default as ThemeProvider } from './Theme';
7
+
8
+ // App
9
+ export * from './App';
10
+ export { default as AppProvider } from './App';
11
+
12
+ // Amplify
13
+ export * from './Amplify';
14
+ export { default as AmplifyProvider } from './Amplify';
15
+
16
+ // Cart
17
+ export * from './Cart';
18
+ export { default as CartProvider } from './Cart';