@salesforcedevs/arch-components 1.20.17-alpha1

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 (363) hide show
  1. package/lwc.config.json +7 -0
  2. package/package.json +19 -0
  3. package/src/modules/common/context/context.html +1 -0
  4. package/src/modules/common/context/context.ts +137 -0
  5. package/src/modules/common/effectAdapter/__tests__/effectAdapter.test.ts +12 -0
  6. package/src/modules/common/effectAdapter/effectAdapter.html +1 -0
  7. package/src/modules/common/effectAdapter/effectAdapter.ts +18 -0
  8. package/src/modules/common/reflectedElement/__tests__/modules/test/select/select.html +3 -0
  9. package/src/modules/common/reflectedElement/__tests__/modules/test/select/select.ts +7 -0
  10. package/src/modules/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.html +3 -0
  11. package/src/modules/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.ts +18 -0
  12. package/src/modules/common/reflectedElement/__tests__/reflectedElement.test.ts +75 -0
  13. package/src/modules/common/reflectedElement/reflectedElement.ts +50 -0
  14. package/src/modules/common/slot/__tests__/slot.test.ts +96 -0
  15. package/src/modules/common/slot/slot.ts +20 -0
  16. package/src/modules/sa/coverage/coverage.css +35 -0
  17. package/src/modules/sa/coverage/coverage.html +15 -0
  18. package/src/modules/sa/coverage/coverage.ts +406 -0
  19. package/src/modules/sa/coverage/types.d.ts +26 -0
  20. package/src/modules/sa/expandableSection/expandableSection.css +24 -0
  21. package/src/modules/sa/expandableSection/expandableSection.html +20 -0
  22. package/src/modules/sa/expandableSection/expandableSection.stories.ts +37 -0
  23. package/src/modules/sa/expandableSection/expandableSection.ts +24 -0
  24. package/src/modules/sa/explorer/explorer.css +303 -0
  25. package/src/modules/sa/explorer/explorer.html +403 -0
  26. package/src/modules/sa/explorer/explorer.ts +664 -0
  27. package/src/modules/sa/explorer/types.d.ts +60 -0
  28. package/src/modules/sa/gallery/gallery.css +358 -0
  29. package/src/modules/sa/gallery/gallery.html +65 -0
  30. package/src/modules/sa/gallery/gallery.ts +300 -0
  31. package/src/modules/sa/gallery/types.d.ts +35 -0
  32. package/src/modules/sa/socialShare/socialShare.css +49 -0
  33. package/src/modules/sa/socialShare/socialShare.html +56 -0
  34. package/src/modules/sa/socialShare/socialShare.ts +29 -0
  35. package/src/modules/shared/a11y/a11y.ts +25 -0
  36. package/src/modules/shared/children/children.ts +29 -0
  37. package/src/modules/shared/color/color.ts +52 -0
  38. package/src/modules/shared/debounce/debounce.ts +32 -0
  39. package/src/modules/shared/dialog/dialog.ts +154 -0
  40. package/src/modules/shared/elements/__tests__/overflow.test.ts +39 -0
  41. package/src/modules/shared/elements/overflow.ts +71 -0
  42. package/src/modules/shared/fetch/fetch.ts +52 -0
  43. package/src/modules/shared/helpers/helpers.ts +141 -0
  44. package/src/modules/shared/i18n/i18n.ts +74 -0
  45. package/src/modules/shared/labels/__tests__/helpers.test.ts +107 -0
  46. package/src/modules/shared/labels/__tests__/pointHelpers.test.ts +33 -0
  47. package/src/modules/shared/labels/__tests__/timeHelpers.test.ts +89 -0
  48. package/src/modules/shared/labels/helpers.ts +23 -0
  49. package/src/modules/shared/labels/pointHelpers.ts +47 -0
  50. package/src/modules/shared/labels/timeHelpers.ts +182 -0
  51. package/src/modules/shared/labels/types.d.ts +5 -0
  52. package/src/modules/shared/logger/logger.ts +33 -0
  53. package/src/modules/shared/menu/menu.ts +239 -0
  54. package/src/modules/shared/overflow/__tests__/overflow.test.ts +39 -0
  55. package/src/modules/shared/overflow/overflow.ts +71 -0
  56. package/src/modules/shared/polling-request.ts +97 -0
  57. package/src/modules/shared/testutils.ts +118 -0
  58. package/src/modules/shared/track/track.ts +23 -0
  59. package/src/modules/shared/trailhead.ts +123 -0
  60. package/src/modules/shared/types.d.ts +1 -0
  61. package/src/modules/shared/useEffectAttr.ts +16 -0
  62. package/src/modules/shared/withState.ts +21 -0
  63. package/src/modules/tds/appLauncher/__fixtures__/index.ts +34 -0
  64. package/src/modules/tds/appLauncher/__tests__/appLauncher.test.ts +119 -0
  65. package/src/modules/tds/appLauncher/appLauncher.css +65 -0
  66. package/src/modules/tds/appLauncher/appLauncher.html +38 -0
  67. package/src/modules/tds/appLauncher/appLauncher.stories.ts +39 -0
  68. package/src/modules/tds/appLauncher/appLauncher.ts +79 -0
  69. package/src/modules/tds/appLauncher/types.ts +8 -0
  70. package/src/modules/tds/avatar/__tests__/avatar.test.ts +11 -0
  71. package/src/modules/tds/avatar/avatar.css +77 -0
  72. package/src/modules/tds/avatar/avatar.html +36 -0
  73. package/src/modules/tds/avatar/avatar.stories.ts +64 -0
  74. package/src/modules/tds/avatar/avatar.ts +50 -0
  75. package/src/modules/tds/badge/__tests__/badge.test.js +11 -0
  76. package/src/modules/tds/badge/badge.css +22 -0
  77. package/src/modules/tds/badge/badge.html +5 -0
  78. package/src/modules/tds/badge/badge.stories.ts +10 -0
  79. package/src/modules/tds/badge/badge.ts +9 -0
  80. package/src/modules/tds/button/__tests__/button.test.ts +52 -0
  81. package/src/modules/tds/button/button.css +1 -0
  82. package/src/modules/tds/button/button.html +20 -0
  83. package/src/modules/tds/button/button.stories.js +54 -0
  84. package/src/modules/tds/button/button.ts +59 -0
  85. package/src/modules/tds/buttonIcon/__tests__/buttonIcon.test.ts +17 -0
  86. package/src/modules/tds/buttonIcon/buttonIcon.css +1 -0
  87. package/src/modules/tds/buttonIcon/buttonIcon.html +12 -0
  88. package/src/modules/tds/buttonIcon/buttonIcon.stories.js +38 -0
  89. package/src/modules/tds/buttonIcon/buttonIcon.ts +6 -0
  90. package/src/modules/tds/buttonIconLink/buttonIconLink.css +1 -0
  91. package/src/modules/tds/buttonIconLink/buttonIconLink.html +14 -0
  92. package/src/modules/tds/buttonIconLink/buttonIconLink.stories.ts +32 -0
  93. package/src/modules/tds/buttonIconLink/buttonIconLink.ts +9 -0
  94. package/src/modules/tds/buttonLink/__tests__/buttonLink.test.ts +17 -0
  95. package/src/modules/tds/buttonLink/buttonLink.css +1 -0
  96. package/src/modules/tds/buttonLink/buttonLink.html +19 -0
  97. package/src/modules/tds/buttonLink/buttonLink.stories.js +24 -0
  98. package/src/modules/tds/buttonLink/buttonLink.ts +8 -0
  99. package/src/modules/tds/buttonStyles/buttonStyles.css +232 -0
  100. package/src/modules/tds/childSummary/__tests__/childSummary.test.js +99 -0
  101. package/src/modules/tds/childSummary/childSummary.css +74 -0
  102. package/src/modules/tds/childSummary/childSummary.html +38 -0
  103. package/src/modules/tds/childSummary/childSummary.stories.ts +40 -0
  104. package/src/modules/tds/childSummary/childSummary.ts +63 -0
  105. package/src/modules/tds/childSummary/types.d.ts +10 -0
  106. package/src/modules/tds/contentChildListItem/__tests__/contentChildListItem.test.ts +32 -0
  107. package/src/modules/tds/contentChildListItem/contentChildListItem.css +1 -0
  108. package/src/modules/tds/contentChildListItem/contentChildListItem.html +10 -0
  109. package/src/modules/tds/contentChildListItem/contentChildListItem.stories.ts +46 -0
  110. package/src/modules/tds/contentChildListItem/contentChildListItem.ts +34 -0
  111. package/src/modules/tds/contentIcon/contentIcon.css +47 -0
  112. package/src/modules/tds/contentIcon/contentIcon.html +15 -0
  113. package/src/modules/tds/contentIcon/contentIcon.stories.js +110 -0
  114. package/src/modules/tds/contentIcon/contentIcon.ts +66 -0
  115. package/src/modules/tds/contextAdapter/__tests__/contextAdapter.test.ts +76 -0
  116. package/src/modules/tds/contextAdapter/constants.ts +1 -0
  117. package/src/modules/tds/contextAdapter/contextAdapter.html +1 -0
  118. package/src/modules/tds/contextAdapter/contextAdapter.ts +54 -0
  119. package/src/modules/tds/dialogStyles/dialogStyles.css +90 -0
  120. package/src/modules/tds/footerLinks/__tests__/__snapshots__/footerLinks.test.ts.snap +3 -0
  121. package/src/modules/tds/footerLinks/__tests__/footerLinks.test.ts +142 -0
  122. package/src/modules/tds/footerLinks/footerLinks.css +80 -0
  123. package/src/modules/tds/footerLinks/footerLinks.html +30 -0
  124. package/src/modules/tds/footerLinks/footerLinks.ts +48 -0
  125. package/src/modules/tds/footerLinks/types.ts +11 -0
  126. package/src/modules/tds/footerMfe/footerMfe.html +3 -0
  127. package/src/modules/tds/footerMfe/footerMfe.ts +19 -0
  128. package/src/modules/tds/headerAvatar/__tests__/headerAvatar.test.ts +43 -0
  129. package/src/modules/tds/headerAvatar/headerAvatar.css +45 -0
  130. package/src/modules/tds/headerAvatar/headerAvatar.html +25 -0
  131. package/src/modules/tds/headerAvatar/headerAvatar.ts +15 -0
  132. package/src/modules/tds/headerHelpButton/__tests__/headerHelpButton.test.ts +32 -0
  133. package/src/modules/tds/headerHelpButton/headerHelpButton.css +14 -0
  134. package/src/modules/tds/headerHelpButton/headerHelpButton.html +19 -0
  135. package/src/modules/tds/headerHelpButton/headerHelpButton.ts +12 -0
  136. package/src/modules/tds/heading/__tests__/heading.test.ts +50 -0
  137. package/src/modules/tds/heading/heading.css +1 -0
  138. package/src/modules/tds/heading/heading.html +9 -0
  139. package/src/modules/tds/heading/heading.stories.ts +36 -0
  140. package/src/modules/tds/heading/heading.ts +36 -0
  141. package/src/modules/tds/icon/icon.css +28 -0
  142. package/src/modules/tds/icon/icon.html +17 -0
  143. package/src/modules/tds/icon/icon.stories.js +18 -0
  144. package/src/modules/tds/icon/icon.ts +79 -0
  145. package/src/modules/tds/input/__tests__/input.test.ts +41 -0
  146. package/src/modules/tds/input/input.css +34 -0
  147. package/src/modules/tds/input/input.html +12 -0
  148. package/src/modules/tds/input/input.stories.ts +25 -0
  149. package/src/modules/tds/input/input.ts +41 -0
  150. package/src/modules/tds/instrumentation/instrumentation.css +0 -0
  151. package/src/modules/tds/instrumentation/instrumentation.html +1 -0
  152. package/src/modules/tds/instrumentation/instrumentation.ts +113 -0
  153. package/src/modules/tds/pbCard/pbCard.css +28 -0
  154. package/src/modules/tds/pbCard/pbCard.html +21 -0
  155. package/src/modules/tds/pbCard/pbCard.ts +18 -0
  156. package/src/modules/tds/pill/__tests__/pill.test.ts +56 -0
  157. package/src/modules/tds/pill/pill.css +70 -0
  158. package/src/modules/tds/pill/pill.html +17 -0
  159. package/src/modules/tds/pill/pill.stories.ts +41 -0
  160. package/src/modules/tds/pill/pill.ts +34 -0
  161. package/src/modules/tds/progressBar/__tests__/progressBar.test.js +11 -0
  162. package/src/modules/tds/progressBar/progressBar.css +42 -0
  163. package/src/modules/tds/progressBar/progressBar.html +14 -0
  164. package/src/modules/tds/progressBar/progressBar.stories.ts +24 -0
  165. package/src/modules/tds/progressBar/progressBar.ts +14 -0
  166. package/src/modules/tds/radio/__tests__/radio.test.ts +29 -0
  167. package/src/modules/tds/radio/radio.css +89 -0
  168. package/src/modules/tds/radio/radio.html +17 -0
  169. package/src/modules/tds/radio/radio.stories.ts +31 -0
  170. package/src/modules/tds/radio/radio.ts +32 -0
  171. package/src/modules/tds/reset/reset.css +39 -0
  172. package/src/modules/tds/search/__fixtures__/index.ts +32 -0
  173. package/src/modules/tds/search/__tests__/search.test.ts +235 -0
  174. package/src/modules/tds/search/lib/__tests__/__snapshots__/listbox.test.ts.snap +115 -0
  175. package/src/modules/tds/search/lib/__tests__/listbox.test.ts +192 -0
  176. package/src/modules/tds/search/lib/listbox.ts +209 -0
  177. package/src/modules/tds/search/search.css +122 -0
  178. package/src/modules/tds/search/search.html +21 -0
  179. package/src/modules/tds/search/search.stories.ts +20 -0
  180. package/src/modules/tds/search/search.ts +107 -0
  181. package/src/modules/tds/search/types.d.ts +22 -0
  182. package/src/modules/tds/searchList/searchList.css +120 -0
  183. package/src/modules/tds/searchList/searchList.html +43 -0
  184. package/src/modules/tds/searchList/searchList.stories.ts +10 -0
  185. package/src/modules/tds/searchList/searchList.ts +53 -0
  186. package/src/modules/tds/select/__tests__/select.test.ts +150 -0
  187. package/src/modules/tds/select/select.css +42 -0
  188. package/src/modules/tds/select/select.html +24 -0
  189. package/src/modules/tds/select/select.stories.ts +59 -0
  190. package/src/modules/tds/select/select.ts +60 -0
  191. package/src/modules/tds/spinner/__tests__/spinner.test.ts +11 -0
  192. package/src/modules/tds/spinner/spinner.css +194 -0
  193. package/src/modules/tds/spinner/spinner.html +9 -0
  194. package/src/modules/tds/spinner/spinner.stories.ts +20 -0
  195. package/src/modules/tds/spinner/spinner.ts +15 -0
  196. package/src/modules/tds/styles/styles.css +24 -0
  197. package/src/modules/tds/summary/__tests__/summary.test.ts +135 -0
  198. package/src/modules/tds/summary/summary.css +135 -0
  199. package/src/modules/tds/summary/summary.html +69 -0
  200. package/src/modules/tds/summary/summary.stories.js +148 -0
  201. package/src/modules/tds/summary/summary.ts +95 -0
  202. package/src/modules/tds/tab/__tests__/tab.test.ts +25 -0
  203. package/src/modules/tds/tab/tab.css +3 -0
  204. package/src/modules/tds/tab/tab.html +5 -0
  205. package/src/modules/tds/tab/tab.ts +46 -0
  206. package/src/modules/tds/tabset/__tests__/tabset.test.ts +108 -0
  207. package/src/modules/tds/tabset/tabset.css +112 -0
  208. package/src/modules/tds/tabset/tabset.html +63 -0
  209. package/src/modules/tds/tabset/tabset.stories.ts +32 -0
  210. package/src/modules/tds/tabset/tabset.ts +232 -0
  211. package/src/modules/tds/themeProvider/themeProvider.css +502 -0
  212. package/src/modules/tds/themeProvider/themeProvider.html +3 -0
  213. package/src/modules/tds/themeProvider/themeProvider.ts +37 -0
  214. package/src/modules/tds/tile/tile.css +23 -0
  215. package/src/modules/tds/tile/tile.html +5 -0
  216. package/src/modules/tds/tile/tile.stories.js +14 -0
  217. package/src/modules/tds/tile/tile.ts +12 -0
  218. package/src/modules/tds/xsfMfeEvents/xsfMfeEvents.html +1 -0
  219. package/src/modules/tds/xsfMfeEvents/xsfMfeEvents.ts +47 -0
  220. package/src/modules/th/contextAdapter/__tests__/contextAdapter.test.ts +104 -0
  221. package/src/modules/th/contextAdapter/contextAdapter.html +1 -0
  222. package/src/modules/th/contextAdapter/contextAdapter.ts +49 -0
  223. package/src/modules/th/favoriteButton/__tests__/favoriteButton.test.ts +56 -0
  224. package/src/modules/th/favoriteButton/favoriteButton.css +3 -0
  225. package/src/modules/th/favoriteButton/favoriteButton.html +15 -0
  226. package/src/modules/th/favoriteButton/favoriteButton.stories.js +30 -0
  227. package/src/modules/th/favoriteButton/favoriteButton.ts +84 -0
  228. package/src/modules/th/favoriteButton/mocks/index.ts +12 -0
  229. package/src/modules/th/search/__fixtures__/index.ts +14 -0
  230. package/src/modules/th/search/__tests__/search.test.ts +233 -0
  231. package/src/modules/th/search/constants.ts +2 -0
  232. package/src/modules/th/search/mocks/index.ts +30 -0
  233. package/src/modules/th/search/mocks/responses.ts +54 -0
  234. package/src/modules/th/search/search.css +4 -0
  235. package/src/modules/th/search/search.html +12 -0
  236. package/src/modules/th/search/search.ts +172 -0
  237. package/src/modules/th/search/types.d.ts +29 -0
  238. package/src/modules/th/tbid/__tests__/__snapshots__/tbid.test.ts.snap +3 -0
  239. package/src/modules/th/tbid/__tests__/tbid.test.ts +242 -0
  240. package/src/modules/th/tbid/tbid.html +1 -0
  241. package/src/modules/th/tbid/tbid.stories.mdx +25 -0
  242. package/src/modules/th/tbid/tbid.ts +215 -0
  243. package/src/modules/tm/card/__tests__/card.test.ts +65 -0
  244. package/src/modules/tm/card/card.css +131 -0
  245. package/src/modules/tm/card/card.html +81 -0
  246. package/src/modules/tm/card/card.ts +269 -0
  247. package/src/modules/tm/cardBase/cardBase.css +11 -0
  248. package/src/modules/tm/cardGridA/cardGridA.css +11 -0
  249. package/src/modules/tm/cardGridA/cardGridA.html +21 -0
  250. package/src/modules/tm/cardGridA/cardGridA.stories.js +107 -0
  251. package/src/modules/tm/cardGridA/cardGridA.ts +24 -0
  252. package/src/modules/tm/cardGridB/cardGridB.css +88 -0
  253. package/src/modules/tm/cardGridB/cardGridB.html +20 -0
  254. package/src/modules/tm/cardGridB/cardGridB.stories.js +58 -0
  255. package/src/modules/tm/cardGridB/cardGridB.ts +19 -0
  256. package/src/modules/tm/cardGridC/cardGridC.css +24 -0
  257. package/src/modules/tm/cardGridC/cardGridC.html +22 -0
  258. package/src/modules/tm/cardGridC/cardGridC.stories.js +42 -0
  259. package/src/modules/tm/cardGridC/cardGridC.ts +11 -0
  260. package/src/modules/tm/cardGridD/cardGridD.css +17 -0
  261. package/src/modules/tm/cardGridD/cardGridD.html +20 -0
  262. package/src/modules/tm/cardGridD/cardGridD.stories.js +34 -0
  263. package/src/modules/tm/cardGridD/cardGridD.ts +7 -0
  264. package/src/modules/tm/cardNew/cardNew.css +31 -0
  265. package/src/modules/tm/cardNew/cardNew.html +29 -0
  266. package/src/modules/tm/cardNew/cardNew.ts +66 -0
  267. package/src/modules/tm/content/__fixtures__/index.ts +884 -0
  268. package/src/modules/tm/content/__tests__/content.test.ts +95 -0
  269. package/src/modules/tm/content/content.css +641 -0
  270. package/src/modules/tm/content/content.html +53 -0
  271. package/src/modules/tm/content/content.stories.js +14 -0
  272. package/src/modules/tm/content/content.ts +171 -0
  273. package/src/modules/tm/endCapA/__tests__/endCapA.test.ts +52 -0
  274. package/src/modules/tm/endCapA/endCapA.css +64 -0
  275. package/src/modules/tm/endCapA/endCapA.html +21 -0
  276. package/src/modules/tm/endCapA/endCapA.stories.js +37 -0
  277. package/src/modules/tm/endCapA/endCapA.ts +23 -0
  278. package/src/modules/tm/eventsA/eventsA.css +107 -0
  279. package/src/modules/tm/eventsA/eventsA.html +26 -0
  280. package/src/modules/tm/eventsA/eventsA.stories.js +51 -0
  281. package/src/modules/tm/eventsA/eventsA.ts +48 -0
  282. package/src/modules/tm/faqA/faqA.css +87 -0
  283. package/src/modules/tm/faqA/faqA.html +27 -0
  284. package/src/modules/tm/faqA/faqA.stories.js +25 -0
  285. package/src/modules/tm/faqA/faqA.ts +40 -0
  286. package/src/modules/tm/featureGridA/__tests__/featureGridA.test.ts +116 -0
  287. package/src/modules/tm/featureGridA/featureGridA.css +95 -0
  288. package/src/modules/tm/featureGridA/featureGridA.html +34 -0
  289. package/src/modules/tm/featureGridA/featureGridA.stories.js +45 -0
  290. package/src/modules/tm/featureGridA/featureGridA.ts +59 -0
  291. package/src/modules/tm/footnote/footnote.css +28 -0
  292. package/src/modules/tm/footnote/footnote.html +3 -0
  293. package/src/modules/tm/footnote/footnote.stories.js +29 -0
  294. package/src/modules/tm/footnote/footnote.ts +35 -0
  295. package/src/modules/tm/heroA/__tests__/heroA.test.ts +51 -0
  296. package/src/modules/tm/heroA/heroA.css +116 -0
  297. package/src/modules/tm/heroA/heroA.html +27 -0
  298. package/src/modules/tm/heroA/heroA.stories.js +49 -0
  299. package/src/modules/tm/heroA/heroA.ts +56 -0
  300. package/src/modules/tm/heroB/heroB.css +78 -0
  301. package/src/modules/tm/heroB/heroB.html +26 -0
  302. package/src/modules/tm/heroB/heroB.stories.js +44 -0
  303. package/src/modules/tm/heroB/heroB.ts +26 -0
  304. package/src/modules/tm/page/__tests__/page.test.ts +35 -0
  305. package/src/modules/tm/page/page.css +3 -0
  306. package/src/modules/tm/page/page.html +3 -0
  307. package/src/modules/tm/page/page.stories.js +10 -0
  308. package/src/modules/tm/page/page.ts +3 -0
  309. package/src/modules/tm/pageHeaderA/pageHeaderA.css +82 -0
  310. package/src/modules/tm/pageHeaderA/pageHeaderA.html +24 -0
  311. package/src/modules/tm/pageHeaderA/pageHeaderA.stories.js +18 -0
  312. package/src/modules/tm/pageHeaderA/pageHeaderA.ts +51 -0
  313. package/src/modules/tm/pageNavigationA/pageNavigationA.css +41 -0
  314. package/src/modules/tm/pageNavigationA/pageNavigationA.html +9 -0
  315. package/src/modules/tm/pageNavigationA/pageNavigationA.stories.js +34 -0
  316. package/src/modules/tm/pageNavigationA/pageNavigationA.ts +18 -0
  317. package/src/modules/tm/promoA/__tests__/promoA.test.ts +89 -0
  318. package/src/modules/tm/promoA/promoA.css +95 -0
  319. package/src/modules/tm/promoA/promoA.html +22 -0
  320. package/src/modules/tm/promoA/promoA.stories.js +38 -0
  321. package/src/modules/tm/promoA/promoA.ts +62 -0
  322. package/src/modules/tm/sectionA/sectionA.css +64 -0
  323. package/src/modules/tm/sectionA/sectionA.html +21 -0
  324. package/src/modules/tm/sectionA/sectionA.stories.js +18 -0
  325. package/src/modules/tm/sectionA/sectionA.ts +27 -0
  326. package/src/modules/tm/sectionSpacer/sectionSpacer.css +4 -0
  327. package/src/modules/tm/sectionSpacer/sectionSpacer.html +1 -0
  328. package/src/modules/tm/sectionSpacer/sectionSpacer.ts +3 -0
  329. package/src/modules/tm/skillsCardA/skillsCardA.css +73 -0
  330. package/src/modules/tm/skillsCardA/skillsCardA.html +37 -0
  331. package/src/modules/tm/skillsCardA/skillsCardA.ts +38 -0
  332. package/src/modules/tm/skillsGridA/skillsGridA.css +12 -0
  333. package/src/modules/tm/skillsGridA/skillsGridA.html +5 -0
  334. package/src/modules/tm/skillsGridA/skillsGridA.stories.ts +65 -0
  335. package/src/modules/tm/skillsGridA/skillsGridA.ts +3 -0
  336. package/src/modules/tm/statsA/statsA.css +26 -0
  337. package/src/modules/tm/statsA/statsA.html +10 -0
  338. package/src/modules/tm/statsA/statsA.stories.js +29 -0
  339. package/src/modules/tm/statsA/statsA.ts +20 -0
  340. package/src/modules/tm/textItem/textItem.css +53 -0
  341. package/src/modules/tm/textItem/textItem.html +18 -0
  342. package/src/modules/tm/textItem/textItem.ts +32 -0
  343. package/src/modules/tm/textItemGridA/textItemGridA.css +11 -0
  344. package/src/modules/tm/textItemGridA/textItemGridA.html +15 -0
  345. package/src/modules/tm/textItemGridA/textItemGridA.stories.js +67 -0
  346. package/src/modules/tm/textItemGridA/textItemGridA.ts +20 -0
  347. package/src/modules/tm/threeCardGrid/threeCardGrid.css +6 -0
  348. package/src/modules/tm/threeCardGrid/threeCardGrid.html +5 -0
  349. package/src/modules/tm/threeCardGrid/threeCardGrid.ts +3 -0
  350. package/src/modules/tm/trailblazersA/trailblazersA.css +70 -0
  351. package/src/modules/tm/trailblazersA/trailblazersA.html +42 -0
  352. package/src/modules/tm/trailblazersA/trailblazersA.stories.js +52 -0
  353. package/src/modules/tm/trailblazersA/trailblazersA.ts +43 -0
  354. package/src/modules/tm/utils/utils.ts +18 -0
  355. package/src/modules/tm/youtube/youtube.css +7 -0
  356. package/src/modules/tm/youtube/youtube.html +10 -0
  357. package/src/modules/tm/youtube/youtube.stories.js +15 -0
  358. package/src/modules/tm/youtube/youtube.ts +27 -0
  359. package/src/modules/ui/focusTrap/focusTrap.html +5 -0
  360. package/src/modules/ui/focusTrap/focusTrap.ts +104 -0
  361. package/src/modules/ui/focusVisible/__tests__/focusVisible.test.ts +95 -0
  362. package/src/modules/ui/focusVisible/focusVisible.html +3 -0
  363. package/src/modules/ui/focusVisible/focusVisible.ts +46 -0
@@ -0,0 +1,154 @@
1
+ import {
2
+ Instance as PopperInstance,
3
+ Placement as PopperPlacement
4
+ } from '@popperjs/core';
5
+
6
+ export type DialogState = {
7
+ isOpen?: boolean;
8
+ };
9
+
10
+ export type Placement =
11
+ | 'top'
12
+ | 'top left'
13
+ | 'top right'
14
+ | 'right'
15
+ | 'right top'
16
+ | 'right bottom'
17
+ | 'bottom'
18
+ | 'bottom left'
19
+ | 'bottom right'
20
+ | 'left'
21
+ | 'left top'
22
+ | 'left bottom';
23
+
24
+ const DEFAULT_PLACEMENT = 'top';
25
+ const NUBBIN_SIZE = 14;
26
+
27
+ export class Dialog {
28
+ constructor(
29
+ private trigger: HTMLElement,
30
+ private dialog: HTMLElement,
31
+ private options: {
32
+ placement?: Placement;
33
+ onChange?: (Partial: DialogState) => void;
34
+ } = {}
35
+ ) {
36
+ this.create();
37
+ }
38
+
39
+ popper: PopperInstance | null = null;
40
+
41
+ private _state: DialogState = { isOpen: false };
42
+
43
+ get state(): DialogState {
44
+ return this._state;
45
+ }
46
+
47
+ set state(nextState: DialogState) {
48
+ this._state = { ...this._state, ...nextState };
49
+
50
+ if (this.options.onChange) {
51
+ this.options.onChange(this.state);
52
+ }
53
+ }
54
+
55
+ private async create() {
56
+ const modifiers = [
57
+ {
58
+ name: 'flip',
59
+ options: {
60
+ padding: NUBBIN_SIZE
61
+ }
62
+ },
63
+ {
64
+ name: 'hide',
65
+ enabled: false
66
+ },
67
+ {
68
+ name: 'preventOverflow',
69
+ options: {
70
+ padding: {
71
+ top: 2,
72
+ bottom: 2,
73
+ left: 5,
74
+ right: 5
75
+ }
76
+ }
77
+ },
78
+ {
79
+ name: 'offset',
80
+ options: {
81
+ offset: ({ placement, reference }: any) => {
82
+ if (placement.match(/^(top|bottom)/)) {
83
+ return [0, NUBBIN_SIZE];
84
+ }
85
+
86
+ if (placement.match(/end?/)) {
87
+ return [(reference.height / 2) * 1, NUBBIN_SIZE];
88
+ }
89
+
90
+ if (placement.match(/start?/)) {
91
+ return [(reference.height / 2) * -1, NUBBIN_SIZE];
92
+ }
93
+
94
+ return [0, NUBBIN_SIZE];
95
+ }
96
+ }
97
+ }
98
+ ];
99
+ const { createPopper } = await import('@popperjs/core');
100
+
101
+ this.popper = createPopper(this.trigger, this.dialog, {
102
+ placement: this.getPlacement(this.options.placement),
103
+ modifiers
104
+ });
105
+
106
+ // Show
107
+ this.trigger.addEventListener('mouseenter', this.show.bind(this));
108
+ this.trigger.addEventListener('focusin', this.show.bind(this));
109
+
110
+ // Hide
111
+ this.trigger.addEventListener('mouseleave', this.hide.bind(this));
112
+ this.trigger.addEventListener('focusout', this.hide.bind(this));
113
+ }
114
+
115
+ destroy() {
116
+ this.popper!.destroy();
117
+ this.popper = null;
118
+ }
119
+
120
+ private async show() {
121
+ await this.popper!.update();
122
+ this.state = { isOpen: true };
123
+ }
124
+
125
+ private hide() {
126
+ this.state = { isOpen: false };
127
+ }
128
+
129
+ // Map the "placement" property used by SLDS to the correct Popper "placement"
130
+ private getPlacement(
131
+ placement: Placement = DEFAULT_PLACEMENT
132
+ ): PopperPlacement {
133
+ switch (placement) {
134
+ case 'top left':
135
+ return 'top-start';
136
+ case 'top right':
137
+ return 'top-end';
138
+ case 'right top':
139
+ return 'right-start';
140
+ case 'right bottom':
141
+ return 'right-end';
142
+ case 'bottom left':
143
+ return 'bottom-start';
144
+ case 'bottom right':
145
+ return 'bottom-end';
146
+ case 'left top':
147
+ return 'left-start';
148
+ case 'left bottom':
149
+ return 'left-end';
150
+ default:
151
+ return placement;
152
+ }
153
+ }
154
+ }
@@ -0,0 +1,39 @@
1
+ import { calculateOverflow } from '../overflow';
2
+
3
+ describe('calculateOverflow()', () => {
4
+ const ITEMS = [
5
+ { active: false, width: 100 },
6
+ { active: false, width: 200 },
7
+ { active: false, width: 100 }
8
+ ];
9
+
10
+ it('returns visibleItems and overflowItems', () => {
11
+ const { visibleItems, overflowItems } = calculateOverflow(
12
+ ITEMS,
13
+ 360,
14
+ 50
15
+ );
16
+ expect(visibleItems).toHaveLength(2);
17
+ expect(overflowItems).toHaveLength(1);
18
+ });
19
+
20
+ it('ensures an active item is always visible', () => {
21
+ const { visibleItems, overflowItems } = calculateOverflow(
22
+ [...ITEMS, { active: true, width: 300 }],
23
+ 360,
24
+ 50
25
+ );
26
+ expect(visibleItems.find((i) => i.width === 300)).toBeTruthy();
27
+ expect(overflowItems).toHaveLength(3);
28
+ });
29
+
30
+ it('handles bad input', () => {
31
+ const badItems = calculateOverflow([], 360, 50);
32
+ expect(badItems.visibleItems).toHaveLength(0);
33
+ expect(badItems.overflowItems).toHaveLength(0);
34
+
35
+ const badWidths = calculateOverflow(ITEMS);
36
+ expect(badWidths.visibleItems).toHaveLength(ITEMS.length);
37
+ expect(badWidths.overflowItems).toHaveLength(0);
38
+ });
39
+ });
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @file Utilities for dealing with element overflows (execeeding container width)
3
+ * Based on https://sfdc.co/uOYl6
4
+ */
5
+
6
+ export type CalculateOverflowItem = {
7
+ active: boolean;
8
+ value?: string;
9
+ width: number;
10
+ };
11
+
12
+ export function calculateOverflow(
13
+ items: CalculateOverflowItem[],
14
+ containerWidth: number = 0,
15
+ overflowWidth: number = 0
16
+ ) {
17
+ const visibleItems: CalculateOverflowItem[] = [];
18
+ const overflowItems: CalculateOverflowItem[] = [];
19
+
20
+ const allItemsWidth = items.reduce(
21
+ (totalWidth, item) => totalWidth + item.width,
22
+ 0
23
+ );
24
+
25
+ // If total items width is less than containerwidth or if the containerwidth is
26
+ // less than zero in cases where container is not yet rendered and we subtract the threshold
27
+ // return all items as visibleItems and overflowItems empty
28
+ if (allItemsWidth <= containerWidth || containerWidth <= 0) {
29
+ return { visibleItems: items, overflowItems };
30
+ }
31
+
32
+ // Not all items fit, an overflow is needed
33
+ let totalWidth = overflowWidth;
34
+
35
+ // Find the active item if it exists
36
+ const activeItem = items.find((i) => i.active);
37
+
38
+ // The active item is always shown, so reserve space for it
39
+ if (activeItem) {
40
+ totalWidth += activeItem.width;
41
+ }
42
+
43
+ let activeItemFitsWithoutRearrangement = false;
44
+
45
+ items.forEach((item) => {
46
+ if (item.active) {
47
+ activeItemFitsWithoutRearrangement = overflowItems.length === 0;
48
+ if (activeItemFitsWithoutRearrangement) {
49
+ visibleItems.push(item);
50
+ }
51
+ } else {
52
+ const itemFits = item.width + totalWidth <= containerWidth;
53
+ if (itemFits && overflowItems.length === 0) {
54
+ totalWidth += item.width;
55
+ visibleItems.push(item);
56
+ } else {
57
+ overflowItems.push(item);
58
+ }
59
+ }
60
+ });
61
+
62
+ // Place the active item at the end
63
+ if (activeItem && !activeItemFitsWithoutRearrangement) {
64
+ visibleItems.push(activeItem);
65
+ }
66
+
67
+ return {
68
+ visibleItems,
69
+ overflowItems
70
+ };
71
+ }
@@ -0,0 +1,52 @@
1
+ export function csrfHeader(token: string = '') {
2
+ return {
3
+ 'X-CSRF-Token': token
4
+ };
5
+ }
6
+
7
+ export function fetch(url: string, { ...options }: RequestInit = {}) {
8
+ return window.fetch(url, {
9
+ ...options,
10
+ credentials: 'same-origin'
11
+ });
12
+ }
13
+
14
+ export function fetchJSON<T>(
15
+ url: string,
16
+ { headers, ...options }: RequestInit = {}
17
+ ) {
18
+ return fetch(url, {
19
+ ...options,
20
+ headers: {
21
+ ...headers,
22
+ Accept: 'application/json; charset=utf-8'
23
+ }
24
+ }).then(async (response) => {
25
+ if (response.ok) return response.json() as Promise<T>;
26
+ if (/json/.test(String(response.headers.get('Content-Type'))))
27
+ return response
28
+ .json()
29
+ .then((errorJSON) => Promise.reject(errorJSON));
30
+ throw new Error(
31
+ `Application error code ${response.status} for "${url}"`
32
+ );
33
+ });
34
+ }
35
+
36
+ export { fetchJSON as getJSON };
37
+
38
+ export function postJSON<T>(
39
+ url: string,
40
+ body?: object,
41
+ { headers, method = 'POST', ...options }: RequestInit = {}
42
+ ) {
43
+ return fetchJSON<T>(url, {
44
+ ...options,
45
+ method,
46
+ headers: {
47
+ ...headers,
48
+ 'Content-Type': 'application/json; charset=utf-8'
49
+ },
50
+ body: typeof body === 'string' ? body : JSON.stringify(body)
51
+ });
52
+ }
@@ -0,0 +1,141 @@
1
+ export function attrToBool(attr: any) {
2
+ if (typeof attr === 'boolean') {
3
+ return attr;
4
+ }
5
+ if (typeof attr === 'string') {
6
+ return attr === 'true' || attr === '';
7
+ }
8
+ return !!attr;
9
+ }
10
+
11
+ export function hash(value: string) {
12
+ let hash = 0;
13
+ for (let i = 0; i < value.length; i++) {
14
+ let char = value.charCodeAt(i);
15
+ hash = (hash << 5) - hash + char;
16
+ hash |= 0;
17
+ }
18
+ return hash;
19
+ }
20
+
21
+ export function createImageUrl(image: string, hash: string) {
22
+ if (image.startsWith('/assets')) {
23
+ const segments = image.split('/');
24
+ return `/1/asset/immutable/s/${hash}/$assetsDir/images/${
25
+ segments[segments.length - 1]
26
+ }`;
27
+ }
28
+ return image;
29
+ }
30
+
31
+ export const InteractionEventTypes = Object.freeze({
32
+ CLICK: 'CLICK',
33
+ PAGE_VIEW: 'PAGE_VIEW',
34
+ INPUT_CHANGE: 'INPUT_CHANGE',
35
+ FILE_DOWNLOAD: 'FILE_DOWNLOAD',
36
+ IMAGE_DOWNLOAD: 'IMAGE_DOWNLOAD', //used with CDN
37
+ IMAGE_CLICK: 'IMAGE_CLICK',
38
+ DROPDOWN_CHANGE: 'DROPDOWN_CHANGE'
39
+ });
40
+ const channelActions = Object.freeze({
41
+ DOWNLOAD: 'DOWNLOAD',
42
+ VIEW: 'VIEW'
43
+ });
44
+ const channelActionsStatus = Object.freeze({
45
+ SUCCESS: 'SUCCESS',
46
+ FAILURE: 'FAILURE'
47
+ });
48
+ export function sendInteractionEvent(name: string, type: string, event: any, target?: any) {
49
+ const element = target || event.currentTarget;
50
+ let text: string = '';
51
+ let eventValue: string = '';
52
+ let channelAction: string = '';
53
+ let channelActionStatus: string = channelActionsStatus.SUCCESS;
54
+ const pageUrl = new URL(document.location.href);
55
+ const searchTitle = pageUrl.searchParams.get('keywords') || '';
56
+ if (
57
+ type === InteractionEventTypes.IMAGE_CLICK ||
58
+ type === InteractionEventTypes.FILE_DOWNLOAD
59
+ ) {
60
+ eventValue = element.href || element.src;
61
+ const url = new URL(
62
+ eventValue,
63
+ window.location.protocol + '//' + window.location.host
64
+ );
65
+ text = url.pathname.substr(url.pathname.lastIndexOf('/') + 1);
66
+ channelAction = channelActions.DOWNLOAD;
67
+ }
68
+ if (type === InteractionEventTypes.CLICK) {
69
+ eventValue = element.href || '';
70
+
71
+ let textNode = element;
72
+ if (element.firstChild.localName === 'slot') {
73
+ textNode = element.firstChild
74
+ .assignedNodes()
75
+ .find((child: any) => child.textContent !== '');
76
+ }
77
+ text = element.ariaLabel || textNode.textContent || textNode.innerText;
78
+
79
+ if (eventValue.includes('/view/')) {
80
+ type = InteractionEventTypes.IMAGE_CLICK;
81
+ const imgSrc = target.getElementsByTagName('img')[0].src;
82
+ channelAction = channelActions.VIEW;
83
+
84
+ if (imgSrc) {
85
+ const url = new URL(
86
+ imgSrc,
87
+ window.location.protocol + '//' + window.location.host
88
+ );
89
+ text = url.pathname.substr(url.pathname.lastIndexOf('/') + 1);
90
+ }
91
+ }
92
+ if (eventValue.includes('/cms/delivery/media')) {
93
+ type = InteractionEventTypes.IMAGE_DOWNLOAD;
94
+ channelAction = channelActions.DOWNLOAD;
95
+ }
96
+ }
97
+ if (type === InteractionEventTypes.DROPDOWN_CHANGE) {
98
+ text = element.id;
99
+ eventValue = element.value;
100
+ }
101
+ if (type === InteractionEventTypes.INPUT_CHANGE) {
102
+ text = element.ariaLabel;
103
+ eventValue = element.value;
104
+ }
105
+ let env = 'DEV';
106
+ if (window.location.host === 'architect.salesforce.com') {
107
+ env = 'PRD';
108
+ }
109
+ if (window.location.host.includes('site-staging')) {
110
+ env = 'STG';
111
+ }
112
+ text = text.replace(/^\s+|\s+$/g, '');
113
+ const pathNameArray = window.location.pathname.split('/');
114
+ const interaction = {
115
+ name: name,
116
+ eventType: 'websiteInteractionEvent',
117
+ topLevelLocation: pathNameArray[1] || '/',
118
+ secondLevelLocation: pathNameArray[2],
119
+ page: pathNameArray[3],
120
+ params: window.location.search || window.location.hash,
121
+ interactionType: type,
122
+ interactionElement: element
123
+ ? `${element.localName}/${element.name}/${text}`
124
+ : '',
125
+ eventValue: eventValue,
126
+ env: env,
127
+ gaClientId: localStorage.getItem('ga_client_id'),
128
+ elementId: element.id,
129
+ elementLabel: text,
130
+ channelAction: channelAction,
131
+ channelActionStatus: channelActionStatus,
132
+ testSend: env === 'PRD' ? 'false' : 'true',
133
+ pageId: pathNameArray[pathNameArray.length - 1],
134
+ pageTitle: document.title,
135
+ searchTitle: pathNameArray[1] === 'search' ? searchTitle : '',
136
+ domainName: window.location.hostname
137
+ };
138
+ (window as any).SalesforceInteractions?.sendEvent({
139
+ interaction: interaction
140
+ });
141
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @file Provides a localization service
3
+ */
4
+ import i18n from 'i18n-js';
5
+
6
+ export type Locale = 'de' | 'en' | 'es-MX' | 'fr' | 'ja' | 'pt-BR';
7
+
8
+ type Labels = {
9
+ [key: string]: string;
10
+ };
11
+
12
+ type Locales = {
13
+ [locale in Locale]?: {
14
+ [key: string]: Labels | string;
15
+ };
16
+ };
17
+
18
+ type Scope = {
19
+ [scopeName: string]: Locales;
20
+ };
21
+
22
+ i18n.defaultLocale = 'en';
23
+ i18n.fallbacks = true;
24
+
25
+ export function toLocaleKey(value: string) {
26
+ return value.replace(
27
+ /([a-z]{2,3})(?:[_-])?([A-Z]{2})/g,
28
+ (_, lang, country) => `${lang}-${country.toUpperCase()}`
29
+ );
30
+ }
31
+
32
+ let guid = 0;
33
+
34
+ /**
35
+ * @class I18n
36
+ * @example
37
+ * import { I18n } from "shared/i18n";
38
+ * import labels from "./locales";
39
+ * const i18n = new I18n({ scopeName: labels });
40
+ * i18n.t("en", "scopeName", "foo.bar");
41
+ */
42
+ export class I18n {
43
+ private id = guid++;
44
+
45
+ constructor(scope?: Scope) {
46
+ if (scope) this.addScope(scope);
47
+ }
48
+
49
+ t(
50
+ locale: string,
51
+ scope: string,
52
+ key: string,
53
+ options?: any
54
+ ) {
55
+ // i18n-js is a singleton, so setting locale on each call is required to
56
+ // avoid overriding the locale of other components' call to this function
57
+ i18n.locale = locale;
58
+ return i18n.t(`${scope}_${this.id}.${key}`, options);
59
+ }
60
+
61
+ addScope(scope: Scope) {
62
+ for (const [scopeName, locales] of Object.entries(scope)) {
63
+ for (const [locale, labels] of Object.entries(locales)) {
64
+ // Modules can only export indentifiers, so we transform the key
65
+ // "esMX" => "es-MX"
66
+ const localeKey = toLocaleKey(locale);
67
+ i18n.translations[localeKey] = {
68
+ ...i18n.translations[localeKey],
69
+ [`${scopeName}_${this.id}`]: labels
70
+ };
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,107 @@
1
+ import { label } from '../helpers';
2
+ import { LabelsDict } from '../types';
3
+
4
+ const dict: LabelsDict = {
5
+ en: {
6
+ foo: 'foon',
7
+ points: '%{n} points',
8
+ attempts: '%{n} attempts'
9
+ },
10
+ es: {
11
+ foo: 'fol',
12
+ fooNoRegion: 'fooNoRegionValue',
13
+ faa: 'faa'
14
+ },
15
+ 'es-MX': {
16
+ foo: 'foll',
17
+ points: '%{n} puntos'
18
+ }
19
+ };
20
+
21
+ describe('label', () => {
22
+ describe('default language', () => {
23
+ let lang = 'en';
24
+
25
+ describe('known keys', () => {
26
+ it('finds key and returns the value', () => {
27
+ expect(label(lang, dict, 'foo')).toEqual('foon');
28
+ });
29
+
30
+ it('finds key and substitutes values', () => {
31
+ expect(label(lang, dict, 'points', [300])).toEqual(
32
+ '300 points'
33
+ );
34
+ });
35
+
36
+ it('finds key and substitutes values, and ignores overloading', () => {
37
+ expect(label(lang, dict, 'points', [300, 100])).toEqual(
38
+ '300 points'
39
+ );
40
+ });
41
+
42
+ it('finds key and does not substitue missing values', () => {
43
+ expect(label(lang, dict, 'points')).toEqual('%{n} points');
44
+ });
45
+ });
46
+
47
+ describe('fallbacks', () => {
48
+ it('fails to find key and returns the label', () => {
49
+ expect(label(lang, dict, 'nf')).toEqual('nf');
50
+ });
51
+ });
52
+ });
53
+
54
+ describe('language with region', () => {
55
+ let lang = 'es-MX';
56
+
57
+ describe('known keys', () => {
58
+ it('finds key and returns the value', () => {
59
+ expect(label(lang, dict, 'foo')).toEqual('foll');
60
+ });
61
+
62
+ it('finds key and substitutes values', () => {
63
+ expect(label(lang, dict, 'points', [300])).toEqual(
64
+ '300 puntos'
65
+ );
66
+ });
67
+ });
68
+
69
+ describe('fallbacks', () => {
70
+ it('fails to find key and falls back to language', () => {
71
+ expect(label(lang, dict, 'fooNoRegion')).toEqual(
72
+ 'fooNoRegionValue'
73
+ );
74
+ });
75
+
76
+ it('fails to find key and falls back to english', () => {
77
+ expect(label(lang, dict, 'attempts', [3])).toEqual(
78
+ '3 attempts'
79
+ );
80
+ });
81
+
82
+ it('fails to find key and returns the label', () => {
83
+ expect(label(lang, dict, 'nf')).toEqual('nf');
84
+ });
85
+ });
86
+ });
87
+
88
+ describe('language not found', () => {
89
+ let lang = 'de';
90
+
91
+ describe('fallbacks', () => {
92
+ it('fails to find key and falls back to english', () => {
93
+ expect(label(lang, dict, 'faa')).toEqual('faa');
94
+ });
95
+
96
+ it('fails to find key and falls back to english', () => {
97
+ expect(label(lang, dict, 'attempts', [3])).toEqual(
98
+ '3 attempts'
99
+ );
100
+ });
101
+
102
+ it('fails to find key and returns the label', () => {
103
+ expect(label(lang, dict, 'nf')).toEqual('nf');
104
+ });
105
+ });
106
+ });
107
+ });
@@ -0,0 +1,33 @@
1
+ import { pointLabel } from '../pointHelpers';
2
+
3
+ describe('pointLabel', () => {
4
+ describe('en', () => {
5
+ let lang = 'en';
6
+
7
+ it('returns correct values', () => {
8
+ expect(pointLabel(lang, 0)).toEqual('0 Points');
9
+ expect(pointLabel(lang, 1)).toEqual('+1 Point');
10
+ expect(pointLabel(lang, 10)).toEqual('+10 Points');
11
+ });
12
+ });
13
+
14
+ describe('es-MX', () => {
15
+ let lang = 'es-MX';
16
+
17
+ it('returns correct values', () => {
18
+ expect(pointLabel(lang, 0)).toEqual('0 puntos');
19
+ expect(pointLabel(lang, 1)).toEqual('+1 punto');
20
+ expect(pointLabel(lang, 10)).toEqual('+10 puntos');
21
+ });
22
+ });
23
+
24
+ describe('fj', () => {
25
+ let lang = 'fj';
26
+
27
+ it('returns correct values', () => {
28
+ expect(pointLabel(lang, 0)).toEqual('0 Points');
29
+ expect(pointLabel(lang, 1)).toEqual('+1 Point');
30
+ expect(pointLabel(lang, 10)).toEqual('+10 Points');
31
+ });
32
+ });
33
+ });