@kaizen/components 1.30.0 → 1.32.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 (94) hide show
  1. package/dist/cjs/ErrorPage/hooks/useErrorMessages.cjs +13 -1
  2. package/dist/cjs/ErrorPage/hooks/useErrorMessages.cjs.map +1 -1
  3. package/dist/cjs/Icon/CloseIcon.cjs +5 -8
  4. package/dist/cjs/Icon/CloseIcon.cjs.map +1 -1
  5. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.cjs +146 -0
  6. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.cjs.map +1 -0
  7. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.module.scss.cjs +27 -0
  8. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.module.scss.cjs.map +1 -0
  9. package/dist/cjs/LikertScaleLegacy/utils/determineSelectionFromKeyPress.cjs +50 -0
  10. package/dist/cjs/LikertScaleLegacy/utils/determineSelectionFromKeyPress.cjs.map +1 -0
  11. package/dist/cjs/ProgressBar/ProgressBar.cjs +59 -0
  12. package/dist/cjs/ProgressBar/ProgressBar.cjs.map +1 -0
  13. package/dist/cjs/ProgressBar/ProgressBar.module.scss.cjs +15 -0
  14. package/dist/cjs/ProgressBar/ProgressBar.module.scss.cjs.map +1 -0
  15. package/dist/cjs/ProgressBar/subcomponents/Label/Label.cjs +23 -0
  16. package/dist/cjs/ProgressBar/subcomponents/Label/Label.cjs.map +1 -0
  17. package/dist/cjs/ProgressBar/subcomponents/Label/Label.module.scss.cjs +7 -0
  18. package/dist/cjs/ProgressBar/subcomponents/Label/Label.module.scss.cjs.map +1 -0
  19. package/dist/cjs/ProgressBar/utils/calculatePercentage.cjs +9 -0
  20. package/dist/cjs/ProgressBar/utils/calculatePercentage.cjs.map +1 -0
  21. package/dist/cjs/dts/ErrorPage/hooks/useErrorMessages.d.ts +1 -1
  22. package/dist/cjs/dts/LikertScaleLegacy/LikertScaleLegacy.d.ts +20 -0
  23. package/dist/cjs/dts/LikertScaleLegacy/index.d.ts +1 -0
  24. package/dist/cjs/dts/LikertScaleLegacy/types.d.ts +6 -0
  25. package/dist/cjs/dts/LikertScaleLegacy/utils/determineSelectionFromKeyPress.d.ts +3 -0
  26. package/dist/cjs/dts/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.d.ts +2 -0
  27. package/dist/cjs/dts/Notification/ToastNotification/ToastNotification.d.ts +14 -0
  28. package/dist/cjs/dts/Notification/ToastNotification/index.d.ts +3 -0
  29. package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/ToastNotificationManager.d.ts +7 -0
  30. package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/index.d.ts +1 -0
  31. package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsList/ToastNotificationsList.d.ts +11 -0
  32. package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsList/index.d.ts +1 -0
  33. package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/ToastNotificationsListContainer.d.ts +7 -0
  34. package/dist/cjs/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/index.d.ts +1 -0
  35. package/dist/cjs/dts/Notification/ToastNotification/types.d.ts +23 -0
  36. package/dist/cjs/dts/ProgressBar/ProgressBar.d.ts +24 -0
  37. package/dist/cjs/dts/ProgressBar/index.d.ts +1 -0
  38. package/dist/cjs/dts/ProgressBar/subcomponents/Label/Label.d.ts +10 -0
  39. package/dist/cjs/dts/ProgressBar/subcomponents/Label/index.d.ts +1 -0
  40. package/dist/cjs/dts/ProgressBar/utils/calculatePercentage.d.ts +4 -0
  41. package/dist/cjs/dts/index.d.ts +2 -0
  42. package/dist/cjs/index.cjs +4 -0
  43. package/dist/cjs/index.cjs.map +1 -1
  44. package/dist/cjs/index.css +3 -0
  45. package/dist/esm/ErrorPage/hooks/useErrorMessages.mjs +13 -1
  46. package/dist/esm/ErrorPage/hooks/useErrorMessages.mjs.map +1 -1
  47. package/dist/esm/Icon/CloseIcon.mjs +5 -8
  48. package/dist/esm/Icon/CloseIcon.mjs.map +1 -1
  49. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.mjs +144 -0
  50. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.mjs.map +1 -0
  51. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.module.scss.mjs +25 -0
  52. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.module.scss.mjs.map +1 -0
  53. package/dist/esm/LikertScaleLegacy/utils/determineSelectionFromKeyPress.mjs +48 -0
  54. package/dist/esm/LikertScaleLegacy/utils/determineSelectionFromKeyPress.mjs.map +1 -0
  55. package/dist/esm/ProgressBar/ProgressBar.mjs +57 -0
  56. package/dist/esm/ProgressBar/ProgressBar.mjs.map +1 -0
  57. package/dist/esm/ProgressBar/ProgressBar.module.scss.mjs +13 -0
  58. package/dist/esm/ProgressBar/ProgressBar.module.scss.mjs.map +1 -0
  59. package/dist/esm/ProgressBar/subcomponents/Label/Label.mjs +21 -0
  60. package/dist/esm/ProgressBar/subcomponents/Label/Label.mjs.map +1 -0
  61. package/dist/esm/ProgressBar/subcomponents/Label/Label.module.scss.mjs +5 -0
  62. package/dist/esm/ProgressBar/subcomponents/Label/Label.module.scss.mjs.map +1 -0
  63. package/dist/esm/ProgressBar/utils/calculatePercentage.mjs +7 -0
  64. package/dist/esm/ProgressBar/utils/calculatePercentage.mjs.map +1 -0
  65. package/dist/esm/dts/ErrorPage/hooks/useErrorMessages.d.ts +1 -1
  66. package/dist/esm/dts/LikertScaleLegacy/LikertScaleLegacy.d.ts +20 -0
  67. package/dist/esm/dts/LikertScaleLegacy/index.d.ts +1 -0
  68. package/dist/esm/dts/LikertScaleLegacy/types.d.ts +6 -0
  69. package/dist/esm/dts/LikertScaleLegacy/utils/determineSelectionFromKeyPress.d.ts +3 -0
  70. package/dist/esm/dts/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.d.ts +2 -0
  71. package/dist/esm/dts/Notification/ToastNotification/ToastNotification.d.ts +14 -0
  72. package/dist/esm/dts/Notification/ToastNotification/index.d.ts +3 -0
  73. package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/ToastNotificationManager.d.ts +7 -0
  74. package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationManager/index.d.ts +1 -0
  75. package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsList/ToastNotificationsList.d.ts +11 -0
  76. package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsList/index.d.ts +1 -0
  77. package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/ToastNotificationsListContainer.d.ts +7 -0
  78. package/dist/esm/dts/Notification/ToastNotification/subcomponents/ToastNotificationsListContainer/index.d.ts +1 -0
  79. package/dist/esm/dts/Notification/ToastNotification/types.d.ts +23 -0
  80. package/dist/esm/dts/ProgressBar/ProgressBar.d.ts +24 -0
  81. package/dist/esm/dts/ProgressBar/index.d.ts +1 -0
  82. package/dist/esm/dts/ProgressBar/subcomponents/Label/Label.d.ts +10 -0
  83. package/dist/esm/dts/ProgressBar/subcomponents/Label/index.d.ts +1 -0
  84. package/dist/esm/dts/ProgressBar/utils/calculatePercentage.d.ts +4 -0
  85. package/dist/esm/dts/index.d.ts +2 -0
  86. package/dist/esm/index.css +4 -1
  87. package/dist/esm/index.mjs +2 -0
  88. package/dist/esm/index.mjs.map +1 -1
  89. package/dist/index.d.ts +53 -4
  90. package/dist/styles.css +1 -1
  91. package/locales/en.json +13 -5
  92. package/locales/mi.json +1 -1
  93. package/locales/si-LK.json +0 -4
  94. package/package.json +1 -1
@@ -48,7 +48,19 @@ var useErrorMessages = function (code) {
48
48
  }),
49
49
  message: formatMessage({
50
50
  id: "kzErrorPage.404.message",
51
- defaultMessage: "Sorry but we can't fing the page you're looking for. Go back and try again, or head to Home",
51
+ defaultMessage: "Sorry but we can't find the page you're looking for. Go back and try again, or head to Home",
52
+ description: "Call to action instructions for the user"
53
+ })
54
+ },
55
+ 413: {
56
+ title: formatMessage({
57
+ id: "kzErrorPage.413.title",
58
+ defaultMessage: "Something's gone wrong on our side",
59
+ description: "Main title of page"
60
+ }),
61
+ message: formatMessage({
62
+ id: "kzErrorPage.413",
63
+ defaultMessage: "Sorry there's an issue with our system and this page can't be displayed. Go back and try again, or head to Home",
52
64
  description: "Call to action instructions for the user"
53
65
  })
54
66
  },
@@ -1 +1 @@
1
- {"version":3,"file":"useErrorMessages.cjs","sources":["../../../../src/ErrorPage/hooks/useErrorMessages.ts"],"sourcesContent":["import { useIntl } from \"@cultureamp/i18n-react-intl\"\nexport const statusCodes = [\n \"400\",\n \"401\",\n \"403\",\n \"404\",\n \"422\",\n \"500\",\n \"502\",\n \"503\",\n \"504\",\n] as const\n\nexport type ErrorStatuses = (typeof statusCodes)[number]\ntype TranslationMap = Record<ErrorStatuses, { title: string; message: string }>\n\nexport const useErrorMessages = (\n code: ErrorStatuses\n): TranslationMap[ErrorStatuses] => {\n const { formatMessage } = useIntl()\n\n const translationsMap: TranslationMap = {\n 400: {\n title: formatMessage({\n id: \"kzErrorPage.400.title\",\n defaultMessage: \"Your request has slipped into the void\",\n description: \"Heading for page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.400.message\",\n defaultMessage:\n \"Sorry but your request couldn’t be completed. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 401: {\n title: formatMessage({\n id: \"kzErrorPage.401.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title for page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.401.message\",\n defaultMessage:\n \"Sorry but we can't verify if you're able to view this page. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 403: {\n title: formatMessage({\n id: \"kzErrorPage.403.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title for page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.403.message\",\n defaultMessage:\n \"Sorry but it looks like you don’t have permission to view this page. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 404: {\n title: formatMessage({\n id: \"kzErrorPage.404.title\",\n defaultMessage: \"Missing pages are one of life's mysteries\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.404.message\",\n defaultMessage:\n \"Sorry but we can't fing the page you're looking for. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 422: {\n title: formatMessage({\n id: \"kzErrorPage.422.title\",\n defaultMessage: \"Change never comes easy\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.422.message\",\n defaultMessage:\n \"Sorry but your change couldn't be made. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 500: {\n title: formatMessage({\n id: \"kzErrorPage.500.title\",\n defaultMessage: \"Something's gone wrong on our side\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.500\",\n defaultMessage:\n \"Sorry there's an issue with our system and this page can't be displayed. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 502: {\n title: formatMessage({\n id: \"kzErrorPage.502.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.502.message\",\n defaultMessage:\n \"Sorry about this. The best thing to do is go back and try again.\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 503: {\n title: formatMessage({\n id: \"kzErrorPage.503.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.503.message\",\n defaultMessage:\n \"Sorry about this. The best thing to do is go back and try again.\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 504: {\n title: formatMessage({\n id: \"kzErrorPage.504.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.504.message\",\n defaultMessage:\n \"Sorry about this. The best thing to do is go back and try again.\",\n description: \"Call to action instructions for the user\",\n }),\n },\n }\n\n return (\n translationsMap[code] || {\n title: \"\",\n message: \"\",\n }\n )\n}\n"],"names":["useErrorMessages","code","formatMessage","useIntl","translationsMap","title","id","defaultMessage","description","message"],"mappings":";;;AAgBO,IAAMA,gBAAgB,GAAG,SAAAA,CAC9BC,IAAmB,EAAA;EAEX,IAAAC,aAAa,GAAKC,qBAAO,CAAE,CAAA,cAAd;EAErB,IAAMC,eAAe,GAAmB;IACtC,GAAG,EAAE;MACHC,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,wCAAwC;QACxDC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,sFAAsF;QACxFC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,oGAAoG;QACtGC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,6GAA6G;QAC/GC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,2CAA2C;QAC3DC,WAAW,EAAE;OACd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AAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,kEAAkE;QACpEC,WAAW,EAAE;OACd;IACF;GACF;EAED,OACEJ,eAAe,CAACH,IAAI,CAAC,IAAI;IACvBI,KAAK,EAAE,EAAE;IACTI,OAAO,EAAE;EACV,CAAA;AAEL,CAAA;"}
1
+ {"version":3,"file":"useErrorMessages.cjs","sources":["../../../../src/ErrorPage/hooks/useErrorMessages.ts"],"sourcesContent":["import { useIntl } from \"@cultureamp/i18n-react-intl\"\nexport const statusCodes = [\n \"400\",\n \"401\",\n \"403\",\n \"404\",\n \"413\",\n \"422\",\n \"500\",\n \"502\",\n \"503\",\n \"504\",\n] as const\n\nexport type ErrorStatuses = (typeof statusCodes)[number]\ntype TranslationMap = Record<ErrorStatuses, { title: string; message: string }>\n\nexport const useErrorMessages = (\n code: ErrorStatuses\n): TranslationMap[ErrorStatuses] => {\n const { formatMessage } = useIntl()\n\n const translationsMap: TranslationMap = {\n 400: {\n title: formatMessage({\n id: \"kzErrorPage.400.title\",\n defaultMessage: \"Your request has slipped into the void\",\n description: \"Heading for page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.400.message\",\n defaultMessage:\n \"Sorry but your request couldn’t be completed. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 401: {\n title: formatMessage({\n id: \"kzErrorPage.401.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title for page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.401.message\",\n defaultMessage:\n \"Sorry but we can't verify if you're able to view this page. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 403: {\n title: formatMessage({\n id: \"kzErrorPage.403.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title for page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.403.message\",\n defaultMessage:\n \"Sorry but it looks like you don’t have permission to view this page. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 404: {\n title: formatMessage({\n id: \"kzErrorPage.404.title\",\n defaultMessage: \"Missing pages are one of life's mysteries\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.404.message\",\n defaultMessage:\n \"Sorry but we can't find the page you're looking for. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 413: {\n title: formatMessage({\n id: \"kzErrorPage.413.title\",\n defaultMessage: \"Something's gone wrong on our side\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.413\",\n defaultMessage:\n \"Sorry there's an issue with our system and this page can't be displayed. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 422: {\n title: formatMessage({\n id: \"kzErrorPage.422.title\",\n defaultMessage: \"Change never comes easy\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.422.message\",\n defaultMessage:\n \"Sorry but your change couldn't be made. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 500: {\n title: formatMessage({\n id: \"kzErrorPage.500.title\",\n defaultMessage: \"Something's gone wrong on our side\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.500\",\n defaultMessage:\n \"Sorry there's an issue with our system and this page can't be displayed. Go back and try again, or head to Home\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 502: {\n title: formatMessage({\n id: \"kzErrorPage.502.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.502.message\",\n defaultMessage:\n \"Sorry about this. The best thing to do is go back and try again.\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 503: {\n title: formatMessage({\n id: \"kzErrorPage.503.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.503.message\",\n defaultMessage:\n \"Sorry about this. The best thing to do is go back and try again.\",\n description: \"Call to action instructions for the user\",\n }),\n },\n 504: {\n title: formatMessage({\n id: \"kzErrorPage.504.title\",\n defaultMessage: \"You can't view this page\",\n description: \"Main title of page\",\n }),\n message: formatMessage({\n id: \"kzErrorPage.504.message\",\n defaultMessage:\n \"Sorry about this. The best thing to do is go back and try again.\",\n description: \"Call to action instructions for the user\",\n }),\n },\n }\n\n return (\n translationsMap[code] || {\n title: \"\",\n message: \"\",\n }\n )\n}\n"],"names":["useErrorMessages","code","formatMessage","useIntl","translationsMap","title","id","defaultMessage","description","message"],"mappings":";;;AAiBO,IAAMA,gBAAgB,GAAG,SAAAA,CAC9BC,IAAmB,EAAA;EAEX,IAAAC,aAAa,GAAKC,qBAAO,CAAE,CAAA,cAAd;EAErB,IAAMC,eAAe,GAAmB;IACtC,GAAG,EAAE;MACHC,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,wCAAwC;QACxDC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,sFAAsF;QACxFC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,oGAAoG;QACtGC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAA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ACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,kEAAkE;QACpEC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,kEAAkE;QACpEC,WAAW,EAAE;OACd;IACF,CAAA;IACD,GAAG,EAAE;MACHH,KAAK,EAAEH,aAAa,CAAC;QACnBI,EAAE,EAAE,uBAAuB;QAC3BC,cAAc,EAAE,0BAA0B;QAC1CC,WAAW,EAAE;OACd,CAAC;MACFC,OAAO,EAAEP,aAAa,CAAC;QACrBI,EAAE,EAAE,yBAAyB;QAC7BC,cAAc,EACZ,kEAAkE;QACpEC,WAAW,EAAE;OACd;IACF;GACF;EAED,OACEJ,eAAe,CAACH,IAAI,CAAC,IAAI;IACvBI,KAAK,EAAE,EAAE;IACTI,OAAO,EAAE;EACV,CAAA;AAEL,CAAA;"}
@@ -2,19 +2,16 @@
2
2
 
3
3
  var tslib = require('tslib');
4
4
  var React = require('react');
5
- var uuid = require('uuid');
6
5
  var SVG = require('./subcomponents/SVG/SVG.cjs');
7
6
 
8
7
  // This file is autogenerated by wrapSVGs.ts
9
8
  // Changes to this file will be overwritten
10
9
  var CloseIcon = function (props) {
11
- var uniqueId = uuid.v4();
12
- var svgContent = React.createElement(React.Fragment, null, React.createElement("defs", null, React.createElement("path", {
13
- id: uniqueId,
14
- d: "M14.654 4.167 10 8.82 5.346 4.167l-1.18 1.18L8.823 10l-4.655 4.655 1.179 1.178L10 11.18l4.654 4.654 1.18-1.178L11.18 10l4.655-4.653z"
15
- })), React.createElement("use", {
16
- href: "#".concat(uniqueId),
17
- fillRule: "evenodd"
10
+ var svgContent = React.createElement(React.Fragment, null, React.createElement("path", {
11
+ fill: "currentColor",
12
+ d: "M14.654 4.167 10 8.82 5.346 4.167l-1.18 1.18L8.823 10l-4.655 4.655 1.179 1.178L10 11.18l4.654 4.654 1.18-1.178L11.18 10l4.655-4.653-1.18-1.18Z",
13
+ fillRule: "evenodd",
14
+ clipRule: "evenodd"
18
15
  }));
19
16
  return React.createElement(SVG.SVG, tslib.__assign({}, props), svgContent);
20
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CloseIcon.cjs","sources":["../../../src/Icon/CloseIcon.tsx"],"sourcesContent":["// This file is autogenerated by wrapSVGs.ts\n// Changes to this file will be overwritten\n\nimport React from \"react\"\nimport { v4 as uuidv4 } from \"uuid\"\nimport { SVG, IconProps } from \"~components/Icon/subcomponents/SVG\"\n\nexport const CloseIcon = (props: IconProps): JSX.Element => {\n const uniqueId = uuidv4()\n const svgContent = (\n <>\n <defs>\n <path\n id={uniqueId}\n d=\"M14.654 4.167 10 8.82 5.346 4.167l-1.18 1.18L8.823 10l-4.655 4.655 1.179 1.178L10 11.18l4.654 4.654 1.18-1.178L11.18 10l4.655-4.653z\"\n />\n </defs>\n <use href={`#${uniqueId}`} fillRule=\"evenodd\" />\n </>\n )\n return <SVG {...props}>{svgContent}</SVG>\n}\n"],"names":["CloseIcon","props","uniqueId","uuidv4","svgContent","React","createElement","Fragment","id","d","href","concat","fillRule","SVG","__assign"],"mappings":";;;;;;;AAAA;AACA;AAMO,IAAMA,SAAS,GAAG,SAAAA,CAACC,KAAgB,EAAA;EACxC,IAAMC,QAAQ,GAAGC,IAAAA,CAAAA,EAAM,EAAE;EACzB,IAAMC,UAAU,GACdC,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EAAA,IAAA,EACEF,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA,IAAA,EACED,KACE,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAE,EAAE,EAAEN,QAAQ;IACZO,CAAC,EAAC;EAAsI,EACxI,CACG,EACPJ,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;IAAKI,IAAI,EAAE,GAAI,CAAAC,MAAA,CAAAT,QAAQ,CAAE;IAAEU,QAAQ,EAAC;EAAS,CAAA,CAAG,CAEnD;EACD,OAAOP,oBAACQ,OAAG,EAAAC,KAAAA,CAAAA,QAAA,CAAA,CAAA,CAAA,EAAKb,KAAK,CAAG,EAAAG,UAAU,CAAO;AAC3C,CAAA;"}
1
+ {"version":3,"file":"CloseIcon.cjs","sources":["../../../src/Icon/CloseIcon.tsx"],"sourcesContent":["// This file is autogenerated by wrapSVGs.ts\n// Changes to this file will be overwritten\n\nimport React from \"react\"\n\nimport { SVG, IconProps } from \"~components/Icon/subcomponents/SVG\"\n\nexport const CloseIcon = (props: IconProps): JSX.Element => {\n const svgContent = (\n <>\n <path\n fill=\"currentColor\"\n d=\"M14.654 4.167 10 8.82 5.346 4.167l-1.18 1.18L8.823 10l-4.655 4.655 1.179 1.178L10 11.18l4.654 4.654 1.18-1.178L11.18 10l4.655-4.653-1.18-1.18Z\"\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n />\n </>\n )\n return <SVG {...props}>{svgContent}</SVG>\n}\n"],"names":["CloseIcon","props","svgContent","React","createElement","Fragment","fill","d","fillRule","clipRule","SVG","__assign"],"mappings":";;;;;;AAAA;AACA;AAMO,IAAMA,SAAS,GAAG,SAAAA,CAACC,KAAgB,EAAA;EACxC,IAAMC,UAAU,GACdC,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EAAA,IAAA,EACEF,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;IACEE,IAAI,EAAC,cAAc;IACnBC,CAAC,EAAC,gJAAgJ;IAClJC,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC;EACT,CAAA,CAAA,CAEL;EACD,OAAON,oBAACO,OAAG,EAAAC,KAAAA,CAAAA,QAAA,CAAA,CAAA,CAAA,EAAKV,KAAK,CAAG,EAAAC,UAAU,CAAO;AAC3C,CAAA;"}
@@ -0,0 +1,146 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var classnames = require('classnames');
5
+ var FieldMessage = require('../FieldMessage/FieldMessage.cjs');
6
+ require('tslib');
7
+ require('uuid');
8
+ require('../Icon/subcomponents/SVG/SVG.cjs');
9
+ var CheckIcon = require('../Icon/CheckIcon.cjs');
10
+ var Text = require('../Text/Text.cjs');
11
+ var determineSelectionFromKeyPress = require('./utils/determineSelectionFromKeyPress.cjs');
12
+ var LikertScaleLegacy_module = require('./LikertScaleLegacy.module.scss.cjs');
13
+ var SelectedItemIcon = function () {
14
+ return React.createElement(CheckIcon.CheckIcon, {
15
+ role: "presentation",
16
+ classNameOverride: LikertScaleLegacy_module.check
17
+ });
18
+ };
19
+ /**
20
+ * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060201/Likert+Scale Guidance} |
21
+ * {@link https://cultureamp.design/?path=/docs/components-likertscalelegacy--docs Storybook}
22
+ */
23
+ var LikertScaleLegacy = function (_a) {
24
+ var scale = _a.scale,
25
+ selectedItem = _a.selectedItem,
26
+ reversed = _a.reversed,
27
+ dataTestId = _a["data-testid"],
28
+ onSelect = _a.onSelect,
29
+ validationMessage = _a.validationMessage,
30
+ status = _a.status,
31
+ labelId = _a.labelId;
32
+ var _b = React.useState(null),
33
+ hoveredItem = _b[0],
34
+ setHoveredItem = _b[1];
35
+ var itemRefs = scale.map(function (s) {
36
+ return {
37
+ value: s.value,
38
+ ref: React.createRef()
39
+ };
40
+ });
41
+ var handleRadioClick = function (item) {
42
+ // Is this a click on the item that is currently selected?
43
+ var isClickOnSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value) === item.value;
44
+ // Grab "Not rated" state item from the scale, its value is -1
45
+ var notYetRated = scale.find(function (s) {
46
+ return s.value === -1;
47
+ }) || null;
48
+ // Clear or set new selection
49
+ var newItem = isClickOnSelectedItem ? notYetRated : item;
50
+ onSelect(newItem);
51
+ setHoveredItem(null);
52
+ };
53
+ /**
54
+ * Because the radios have been built with divs, we need to add the keyboard functionality manually
55
+ */
56
+ var handleKeyDown = function (event, focusedItem) {
57
+ var newPosition = determineSelectionFromKeyPress(event.keyCode, selectedItem, focusedItem);
58
+ if (newPosition) {
59
+ event.preventDefault();
60
+ onSelect(scale.find(function (s) {
61
+ return s.value === newPosition;
62
+ }) || null);
63
+ // Update focus
64
+ var itemRef = itemRefs.find(function (item) {
65
+ return item.value === newPosition;
66
+ });
67
+ itemRef && itemRef.ref.current && itemRef.ref.current.focus();
68
+ }
69
+ };
70
+ var legend = (hoveredItem === null || hoveredItem === void 0 ? void 0 : hoveredItem.label) || (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label) || "Not rated";
71
+ var shouldDisplayValidationMessage = status !== "default" && validationMessage !== undefined;
72
+ var validationMessageId = shouldDisplayValidationMessage ? "".concat(labelId, "-field-validation-message") : undefined;
73
+ var isRated = selectedItem && selectedItem.value > 0;
74
+ return React.createElement("div", {
75
+ className: classnames(LikertScaleLegacy_module.container, isRated && LikertScaleLegacy_module.rated, reversed && [LikertScaleLegacy_module.reversed], hoveredItem !== null && LikertScaleLegacy_module.hovered),
76
+ "aria-labelledby": labelId,
77
+ role: "radiogroup",
78
+ tabIndex: -1,
79
+ "aria-describedby": validationMessageId,
80
+ "data-testid": dataTestId
81
+ }, React.createElement("div", {
82
+ className: LikertScaleLegacy_module.legend,
83
+ "data-testid": dataTestId && "".concat(dataTestId, "-legend")
84
+ }, React.createElement(Text.Text, {
85
+ variant: "small",
86
+ color: reversed ? "white" : "dark"
87
+ }, legend)), React.createElement("div", {
88
+ className: classnames(LikertScaleLegacy_module.itemContainer, isRated && LikertScaleLegacy_module.rated, reversed && LikertScaleLegacy_module.reversed)
89
+ }, scale.map(function (item) {
90
+ if (item.value <= 0) {
91
+ return;
92
+ }
93
+ var isSelectedItem = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value) === item.value;
94
+ var itemRef = itemRefs.find(function (i) {
95
+ return item.value === i.value;
96
+ });
97
+ // Make control tabbable
98
+ var tabIndex = 0;
99
+ // Unless.. there's an item selected and it's not this one
100
+ if (selectedItem && selectedItem.value > 0 && selectedItem.value !== item.value) {
101
+ tabIndex = -1;
102
+ }
103
+ var isSelected = selectedItem && item.value <= (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value) && !hoveredItem;
104
+ var isSuggested = hoveredItem && hoveredItem.value >= item.value;
105
+ var isUnselected = selectedItem && selectedItem.value < item.value;
106
+ return React.createElement("div", {
107
+ className: classnames(LikertScaleLegacy_module.likertItem, LikertScaleLegacy_module["likertItem".concat(item.value)], isSelected && LikertScaleLegacy_module.selected, isSuggested && LikertScaleLegacy_module.suggested, isUnselected && LikertScaleLegacy_module.unselected),
108
+ key: item.value,
109
+ "data-testid": dataTestId && "".concat(dataTestId, "-item-").concat(item.value),
110
+ onClick: function () {
111
+ return handleRadioClick(item);
112
+ },
113
+ onMouseEnter: function () {
114
+ return setHoveredItem(item);
115
+ },
116
+ onMouseLeave: function () {
117
+ return setHoveredItem(null);
118
+ },
119
+ onKeyDown: function (event) {
120
+ return handleKeyDown(event, item);
121
+ },
122
+ onFocus: function () {
123
+ return setHoveredItem(item);
124
+ },
125
+ onBlur: function () {
126
+ return setHoveredItem(null);
127
+ },
128
+ role: "radio",
129
+ "aria-label": item.label,
130
+ "aria-checked": isSelectedItem,
131
+ "aria-posinset": item.value,
132
+ "aria-setsize": 5,
133
+ tabIndex: tabIndex,
134
+ ref: itemRef && itemRef.ref
135
+ }, React.createElement("div", {
136
+ className: classnames(LikertScaleLegacy_module.likertItemFill, LikertScaleLegacy_module["field".concat(item.value)], isSelectedItem && LikertScaleLegacy_module.pop)
137
+ }), isSelectedItem ? React.createElement(SelectedItemIcon, null) : null);
138
+ })), shouldDisplayValidationMessage && React.createElement(FieldMessage.FieldMessage, {
139
+ id: validationMessageId,
140
+ message: validationMessage,
141
+ status: status,
142
+ reversed: reversed
143
+ }));
144
+ };
145
+ exports.LikertScaleLegacy = LikertScaleLegacy;
146
+ //# sourceMappingURL=LikertScaleLegacy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LikertScaleLegacy.cjs","sources":["../../../src/LikertScaleLegacy/LikertScaleLegacy.tsx"],"sourcesContent":["import React, { createRef, useState } from \"react\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport { CheckIcon } from \"~components/Icon\"\nimport { Text } from \"~components/Text\"\nimport { ScaleValue, Scale, ScaleItem } from \"./types\"\nimport determineSelectionFromKeyPress from \"./utils/determineSelectionFromKeyPress\"\nimport styles from \"./LikertScaleLegacy.module.scss\"\n\ntype ItemRefs = Array<{\n value: ScaleValue\n ref: { current: null | HTMLDivElement }\n}>\n\nexport type LikertScaleProps = {\n labelId: string\n scale: Scale\n selectedItem: ScaleItem | null\n /**\n * @deprecated Please use data-testid instead\n */\n automationId?: string\n \"data-testid\"?: string\n reversed?: boolean\n validationMessage?: string\n status?: \"default\" | \"error\"\n onSelect: (value: ScaleItem | null) => void\n}\n\nconst SelectedItemIcon = (): JSX.Element => (\n <CheckIcon role=\"presentation\" classNameOverride={styles.check} />\n)\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060201/Likert+Scale Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-likertscalelegacy--docs Storybook}\n */\nexport const LikertScaleLegacy = ({\n scale,\n selectedItem,\n reversed,\n \"data-testid\": dataTestId,\n onSelect,\n validationMessage,\n status,\n labelId,\n}: LikertScaleProps): JSX.Element => {\n const [hoveredItem, setHoveredItem] = useState<ScaleItem | null>(null)\n const itemRefs: ItemRefs = scale.map(s => ({\n value: s.value,\n ref: createRef<HTMLDivElement>(),\n }))\n\n const handleRadioClick = (item: ScaleItem): void => {\n // Is this a click on the item that is currently selected?\n const isClickOnSelectedItem = selectedItem?.value === item.value\n\n // Grab \"Not rated\" state item from the scale, its value is -1\n const notYetRated = scale.find(s => s.value === -1) || null\n\n // Clear or set new selection\n const newItem = isClickOnSelectedItem ? notYetRated : item\n\n onSelect(newItem)\n setHoveredItem(null)\n }\n\n /**\n * Because the radios have been built with divs, we need to add the keyboard functionality manually\n */\n const handleKeyDown = (\n event: React.KeyboardEvent<HTMLDivElement>,\n focusedItem: ScaleItem\n ): void => {\n const newPosition = determineSelectionFromKeyPress(\n event.keyCode,\n selectedItem,\n focusedItem\n )\n if (newPosition) {\n event.preventDefault()\n\n onSelect(scale.find(s => s.value === newPosition) || null)\n\n // Update focus\n const itemRef = itemRefs.find(item => item.value === newPosition)\n itemRef && itemRef.ref.current && itemRef.ref.current.focus()\n }\n }\n\n const legend = hoveredItem?.label || selectedItem?.label || \"Not rated\"\n\n const shouldDisplayValidationMessage =\n status !== \"default\" && validationMessage !== undefined\n\n const validationMessageId = shouldDisplayValidationMessage\n ? `${labelId}-field-validation-message`\n : undefined\n\n const isRated = selectedItem && selectedItem.value > 0\n\n return (\n <div\n className={classnames(\n styles.container,\n isRated && styles.rated,\n reversed && [styles.reversed],\n hoveredItem !== null && styles.hovered\n )}\n aria-labelledby={labelId}\n role=\"radiogroup\"\n tabIndex={-1}\n aria-describedby={validationMessageId}\n data-testid={dataTestId}\n >\n <div\n className={styles.legend}\n data-testid={dataTestId && `${dataTestId}-legend`}\n >\n <Text variant=\"small\" color={reversed ? \"white\" : \"dark\"}>\n {legend}\n </Text>\n </div>\n <div\n className={classnames(\n styles.itemContainer,\n isRated && styles.rated,\n reversed && styles.reversed\n )}\n >\n {scale.map((item: ScaleItem) => {\n if (item.value <= 0) {\n return\n }\n\n const isSelectedItem = selectedItem?.value === item.value\n const itemRef = itemRefs.find(i => item.value === i.value)\n\n // Make control tabbable\n let tabIndex = 0\n // Unless.. there's an item selected and it's not this one\n if (\n selectedItem &&\n selectedItem.value > 0 &&\n selectedItem.value !== item.value\n ) {\n tabIndex = -1\n }\n\n const isSelected =\n selectedItem && item.value <= selectedItem?.value && !hoveredItem\n const isSuggested = hoveredItem && hoveredItem.value >= item.value\n const isUnselected = selectedItem && selectedItem.value < item.value\n\n return (\n <div\n className={classnames(\n styles.likertItem,\n styles[`likertItem${item.value}`],\n isSelected && styles.selected,\n isSuggested && styles.suggested,\n isUnselected && styles.unselected\n )}\n key={item.value}\n data-testid={dataTestId && `${dataTestId}-item-${item.value}`}\n onClick={(): void => handleRadioClick(item)}\n onMouseEnter={(): void => setHoveredItem(item)}\n onMouseLeave={(): void => setHoveredItem(null)}\n onKeyDown={(event): void => handleKeyDown(event, item)}\n onFocus={(): void => setHoveredItem(item)}\n onBlur={(): void => setHoveredItem(null)}\n role=\"radio\"\n aria-label={item.label}\n aria-checked={isSelectedItem}\n aria-posinset={item.value}\n aria-setsize={5}\n tabIndex={tabIndex}\n ref={itemRef && itemRef.ref}\n >\n <div\n className={classnames(\n styles.likertItemFill,\n styles[`field${item.value}`],\n isSelectedItem && styles.pop\n )}\n />\n {isSelectedItem ? <SelectedItemIcon /> : null}\n </div>\n )\n })}\n </div>\n {shouldDisplayValidationMessage && (\n <FieldMessage\n id={validationMessageId}\n message={validationMessage}\n status={status}\n reversed={reversed}\n />\n )}\n </div>\n )\n}\n"],"names":["SelectedItemIcon","React","createElement","CheckIcon","role","classNameOverride","styles","check","LikertScaleLegacy","_a","scale","selectedItem","reversed","dataTestId","onSelect","validationMessage","status","labelId","_b","useState","hoveredItem","setHoveredItem","itemRefs","map","s","value","ref","createRef","handleRadioClick","item","isClickOnSelectedItem","notYetRated","find","newItem","handleKeyDown","event","focusedItem","newPosition","determineSelectionFromKeyPress","keyCode","preventDefault","itemRef","current","focus","legend","label","shouldDisplayValidationMessage","undefined","validationMessageId","concat","isRated","className","classnames","container","rated","hovered","tabIndex","Text","variant","color","itemContainer","isSelectedItem","i","isSelected","isSuggested","isUnselected","likertItem","selected","suggested","unselected","key","onClick","onMouseEnter","onMouseLeave","onKeyDown","onFocus","onBlur","likertItemFill","pop","FieldMessage","id","message"],"mappings":";;;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AO,EAAElE,iBAAiB;IAC1BC,MAAM,EAAEA,MAAM;IACdJ,QAAQ,EAAEA;EACV,CAAA,CACH,CACG;AAEV,CAAA;"}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "container": "LikertScaleLegacy-module_container__5wjIJ",
5
+ "rated": "LikertScaleLegacy-module_rated__KXpzU",
6
+ "likertItem": "LikertScaleLegacy-module_likertItem__LwX2w",
7
+ "unselected": "LikertScaleLegacy-module_unselected__nP5p9",
8
+ "likertItemFill": "LikertScaleLegacy-module_likertItemFill__yj0tC",
9
+ "reversed": "LikertScaleLegacy-module_reversed__qrwrP",
10
+ "likertItem4": "LikertScaleLegacy-module_likertItem4__0SWtD",
11
+ "likertItem5": "LikertScaleLegacy-module_likertItem5__ZF0By",
12
+ "check": "LikertScaleLegacy-module_check__3wQsx",
13
+ "suggested": "LikertScaleLegacy-module_suggested__0xk0D",
14
+ "itemContainer": "LikertScaleLegacy-module_itemContainer__9Vfq0",
15
+ "legend": "LikertScaleLegacy-module_legend__HYNg-",
16
+ "field1": "LikertScaleLegacy-module_field1__TDRE-",
17
+ "selected": "LikertScaleLegacy-module_selected__MVmcb",
18
+ "field2": "LikertScaleLegacy-module_field2__s-CD7",
19
+ "field3": "LikertScaleLegacy-module_field3__xp5eQ",
20
+ "field4": "LikertScaleLegacy-module_field4__IVK7E",
21
+ "field5": "LikertScaleLegacy-module_field5__9sETV",
22
+ "pop": "LikertScaleLegacy-module_pop__hTH48",
23
+ "likertItem1": "LikertScaleLegacy-module_likertItem1__cYmY6",
24
+ "hovered": "LikertScaleLegacy-module_hovered__vVUN6"
25
+ };
26
+ module.exports = styles;
27
+ //# sourceMappingURL=LikertScaleLegacy.module.scss.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LikertScaleLegacy.module.scss.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Takes a keypress on a div that's imitating a radio and determines where the selection should go.
5
+ * Uses the following as a guide, with one modification - allowing space press on a selected item to unselect:
6
+ * https://www.w3.org/TR/wai-aria-practices/examples/radio/radio-1/radio-1.html
7
+ */
8
+ var SCALE_VALUE_RESPONSE = new Map([[-1, -1], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]]);
9
+ var determineSelectionFromKeyPress = function (keyCode, currentSelection, focusedItem) {
10
+ var supportedKeyCodes = [32, 37, 38, 39, 40];
11
+ if (supportedKeyCodes.indexOf(keyCode) === -1) {
12
+ return null;
13
+ }
14
+ var spacePressed = keyCode === 32;
15
+ var backPressed = keyCode === 37 || keyCode === 38;
16
+ var forwardPressed = keyCode === 39 || keyCode === 40;
17
+ var noCurrentSelection = !currentSelection || currentSelection.value <= 0;
18
+ if (spacePressed) {
19
+ return noCurrentSelection ? focusedItem.value : -1;
20
+ }
21
+ if (noCurrentSelection || !currentSelection) {
22
+ if (backPressed) {
23
+ return oneSelectionBackward(focusedItem.value);
24
+ }
25
+ return oneSelectionForward(focusedItem.value);
26
+ }
27
+ if (backPressed) {
28
+ return oneSelectionBackward(currentSelection.value);
29
+ }
30
+ if (forwardPressed) {
31
+ return oneSelectionForward(currentSelection.value);
32
+ }
33
+ return null;
34
+ };
35
+ var oneSelectionForward = function (value) {
36
+ if (value === 5) {
37
+ return 1;
38
+ }
39
+ var calculatedPosition = SCALE_VALUE_RESPONSE.get(value + 1);
40
+ return calculatedPosition || null;
41
+ };
42
+ var oneSelectionBackward = function (value) {
43
+ if (value === 1) {
44
+ return 5;
45
+ }
46
+ var calculatedPosition = SCALE_VALUE_RESPONSE.get(value - 1);
47
+ return calculatedPosition || null;
48
+ };
49
+ module.exports = determineSelectionFromKeyPress;
50
+ //# sourceMappingURL=determineSelectionFromKeyPress.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determineSelectionFromKeyPress.cjs","sources":["../../../../src/LikertScaleLegacy/utils/determineSelectionFromKeyPress.ts"],"sourcesContent":["import { ScaleValue, ScaleItem } from \"../types\"\n\n/**\n * Takes a keypress on a div that's imitating a radio and determines where the selection should go.\n * Uses the following as a guide, with one modification - allowing space press on a selected item to unselect:\n * https://www.w3.org/TR/wai-aria-practices/examples/radio/radio-1/radio-1.html\n */\n\nconst SCALE_VALUE_RESPONSE = new Map<number, ScaleValue>([\n [-1, -1],\n [1, 1],\n [2, 2],\n [3, 3],\n [4, 4],\n [5, 5],\n])\n\nconst determineSelectionFromKeyPress = (\n keyCode: number,\n currentSelection: ScaleItem | null,\n focusedItem: ScaleItem\n): null | ScaleValue => {\n const supportedKeyCodes = [32, 37, 38, 39, 40]\n if (supportedKeyCodes.indexOf(keyCode) === -1) {\n return null\n }\n\n const spacePressed = keyCode === 32\n const backPressed = keyCode === 37 || keyCode === 38\n const forwardPressed = keyCode === 39 || keyCode === 40\n const noCurrentSelection = !currentSelection || currentSelection.value <= 0\n\n if (spacePressed) {\n return noCurrentSelection ? focusedItem.value : -1\n }\n\n if (noCurrentSelection || !currentSelection) {\n if (backPressed) {\n return oneSelectionBackward(focusedItem.value)\n }\n return oneSelectionForward(focusedItem.value)\n }\n\n if (backPressed) {\n return oneSelectionBackward(currentSelection.value)\n }\n\n if (forwardPressed) {\n return oneSelectionForward(currentSelection.value)\n }\n\n return null\n}\n\nconst oneSelectionForward = (value: ScaleValue): ScaleValue | null => {\n if (value === 5) {\n return 1\n }\n const calculatedPosition = SCALE_VALUE_RESPONSE.get(value + 1)\n return calculatedPosition || null\n}\n\nconst oneSelectionBackward = (value: ScaleValue): ScaleValue | null => {\n if (value === 1) {\n return 5\n }\n const calculatedPosition = SCALE_VALUE_RESPONSE.get(value - 1)\n return calculatedPosition || null\n}\n\nexport default determineSelectionFromKeyPress\n"],"names":["SCALE_VALUE_RESPONSE","Map","determineSelectionFromKeyPress","keyCode","currentSelection","focusedItem","supportedKeyCodes","indexOf","spacePressed","backPressed","forwardPressed","noCurrentSelection","value","oneSelectionBackward","o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AK,CAAC;EACpD;EAED,IAAIF,cAAc,EAAE;IAClB,OAAOI,mBAAmB,CAACV,gBAAgB,CAACQ,KAAK,CAAC;EACnD;EAED,OAAO,IAAI;AACb,CAAC;AAED,IAAME,mBAAmB,GAAG,SAAAA,CAACF,KAAiB,EAAA;EAC5C,IAAIA,KAAK,KAAK,CAAC,EAAE;IACf,OAAO,CAAC;EACT;EACD,IAAMG,kBAAkB,GAAGf,oBAAoB,CAACgB,GAAG,CAACJ,KAAK,GAAG,CAAC,CAAC;EAC9D,OAAOG,kBAAkB,IAAI,IAAI;AACnC,CAAC;AAED,IAAMF,oBAAoB,GAAG,SAAAA,CAACD,KAAiB,EAAA;EAC7C,IAAIA,KAAK,KAAK,CAAC,EAAE;IACf,OAAO,CAAC;EACT;EACD,IAAMG,kBAAkB,GAAGf,oBAAoB,CAACgB,GAAG,CAACJ,KAAK,GAAG,CAAC,CAAC;EAC9D,OAAOG,kBAAkB,IAAI,IAAI;AACnC,CAAC;"}
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var React = require('react');
5
+ var classnames = require('classnames');
6
+ var Heading = require('../Heading/Heading.cjs');
7
+ var Label = require('./subcomponents/Label/Label.cjs');
8
+ var calculatePercentage = require('./utils/calculatePercentage.cjs');
9
+ var ProgressBar_module = require('./ProgressBar.module.scss.cjs');
10
+
11
+ /**
12
+ * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896891/Progress+Bar Guidance} |
13
+ * {@link https://cultureamp.design/?path=/docs/components-progress-bar--docs Storybook}
14
+ */
15
+ const ProgressBar = /*#__PURE__*/function () {
16
+ const ProgressBar = function (_a) {
17
+ var value = _a.value,
18
+ max = _a.max,
19
+ isAnimating = _a.isAnimating,
20
+ mood = _a.mood,
21
+ subtext = _a.subtext,
22
+ label = _a.label,
23
+ classNameOverride = _a.classNameOverride,
24
+ _b = _a.isReversed,
25
+ isReversed = _b === void 0 ? false : _b,
26
+ restProps = tslib.__rest(_a, ["value", "max", "isAnimating", "mood", "subtext", "label", "classNameOverride", "isReversed"]);
27
+ var percentage = calculatePercentage.calculatePercentage({
28
+ value: value,
29
+ max: max
30
+ });
31
+ return React.createElement("div", tslib.__assign({
32
+ role: "progressbar",
33
+ "aria-valuenow": percentage,
34
+ "aria-valuemin": 0,
35
+ "aria-valuemax": 100,
36
+ className: classNameOverride
37
+ }, restProps), label && React.createElement(Label.Label, {
38
+ content: label,
39
+ isReversed: isReversed
40
+ }), React.createElement("div", {
41
+ className: ProgressBar_module.progressBackground
42
+ }, React.createElement("div", {
43
+ className: classnames(ProgressBar_module[mood], isAnimating && ProgressBar_module.isAnimating),
44
+ style: {
45
+ transform: "translateX(-".concat(100 - percentage, "%")
46
+ }
47
+ })), subtext && React.createElement("div", {
48
+ className: ProgressBar_module.subtext
49
+ }, React.createElement(Heading.Heading, {
50
+ variant: "heading-6",
51
+ tag: "p",
52
+ color: isReversed ? "white" : "dark"
53
+ }, subtext)));
54
+ };
55
+ ProgressBar.displayName = "ProgressBar";
56
+ return ProgressBar;
57
+ }();
58
+ exports.ProgressBar = ProgressBar;
59
+ //# sourceMappingURL=ProgressBar.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.cjs","sources":["../../../src/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport classnames from \"classnames\"\nimport { Heading } from \"~components/Heading\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { Label } from \"./subcomponents/Label\"\nimport { calculatePercentage } from \"./utils/calculatePercentage\"\nimport styles from \"./ProgressBar.module.scss\"\n\nexport type ProgressBarProps = {\n /** A value that represents completed progress */\n value: number\n /** A value that sets the maximum progress that can be achieved */\n max: number\n /** Adds an animated state to indicate loading progress */\n isAnimating: boolean\n mood: Mood\n subtext?: string\n label?: string\n isReversed: boolean\n} & OverrideClassName<HTMLAttributes<HTMLDivElement>>\n\ntype Mood = \"positive\" | \"informative\" | \"negative\" | \"cautionary\"\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896891/Progress+Bar Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-progress-bar--docs Storybook}\n */\nexport const ProgressBar = ({\n value,\n max,\n isAnimating,\n mood,\n subtext,\n label,\n classNameOverride,\n isReversed = false,\n ...restProps\n}: ProgressBarProps): JSX.Element => {\n const percentage = calculatePercentage({ value, max })\n return (\n <div\n role=\"progressbar\"\n aria-valuenow={percentage}\n aria-valuemin={0}\n aria-valuemax={100}\n className={classNameOverride}\n {...restProps}\n >\n {label && <Label content={label} isReversed={isReversed} />}\n <div className={styles.progressBackground}>\n <div\n className={classnames(\n styles[mood],\n isAnimating && styles.isAnimating\n )}\n style={{ transform: `translateX(-${100 - percentage}%` }}\n />\n </div>\n {subtext && (\n <div className={styles.subtext}>\n <Heading\n variant=\"heading-6\"\n tag=\"p\"\n color={isReversed ? \"white\" : \"dark\"}\n >\n {subtext}\n </Heading>\n </div>\n )}\n </div>\n )\n}\n\nProgressBar.displayName = \"ProgressBar\"\n"],"names":["ProgressBar","_a","value","max","isAnimating","mood","subtext","label","classNameOverride","_b","isReversed","restProps","__rest","percentage","calculatePercentage","React","createElement","__assign","role","className","Label","content","styles","progressBackground","classnames","style","transform","concat","Heading","variant","tag","color","displayName"],"mappings":";;;;;;;;;;AAuBA;;;AAGG;AAHH,MAIaA,WAAW;EAAA,MAAXA,WAAW,GAAG,SAAAA,CAACC,EAUT,EAAA;IATjB,IAAAC,KAAK,GAAAD,EAAA,CAAAC,KAAA;MACLC,GAAG,GAAAF,EAAA,CAAAE,GAAA;MACHC,WAAW,GAAAH,EAAA,CAAAG,WAAA;MACXC,IAAI,GAAAJ,EAAA,CAAAI,IAAA;MACJC,OAAO,GAAAL,EAAA,CAAAK,OAAA;MACPC,KAAK,GAAAN,EAAA,CAAAM,KAAA;MACLC,iBAAiB,GAAAP,EAAA,CAAAO,iBAAA;MACjBC,kBAAkB;MAAl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,OAAO,CACA,CAEb,CACG;EAEV,CAAC;EAEDN,WAAW,CAACgC,WAAW,GAAG,aAAa;EAAA,OA9C1BhC,WAAW;AAAA;"}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "subtext": "ProgressBar-module_subtext__eizyu",
5
+ "progressBackground": "ProgressBar-module_progressBackground__5qzp5",
6
+ "progress": "ProgressBar-module_progress__X1IHw",
7
+ "positive": "ProgressBar-module_positive__12oA1 ProgressBar-module_progress__X1IHw",
8
+ "informative": "ProgressBar-module_informative__lrVDM ProgressBar-module_progress__X1IHw",
9
+ "cautionary": "ProgressBar-module_cautionary__f56gH ProgressBar-module_progress__X1IHw",
10
+ "negative": "ProgressBar-module_negative__EVWBt ProgressBar-module_progress__X1IHw",
11
+ "isAnimating": "ProgressBar-module_isAnimating__F6AxQ",
12
+ "pulse": "ProgressBar-module_pulse__RGaQm"
13
+ };
14
+ module.exports = styles;
15
+ //# sourceMappingURL=ProgressBar.module.scss.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressBar.module.scss.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var Heading = require('../../../Heading/Heading.cjs');
5
+ var Label_module = require('./Label.module.scss.cjs');
6
+ const Label = /*#__PURE__*/function () {
7
+ const Label = function (_a) {
8
+ var content = _a.content,
9
+ _b = _a.isReversed,
10
+ isReversed = _b === void 0 ? false : _b;
11
+ return React.createElement("div", {
12
+ className: Label_module.label
13
+ }, React.createElement(Heading.Heading, {
14
+ variant: "heading-4",
15
+ tag: "p",
16
+ color: isReversed ? "white" : "dark"
17
+ }, content));
18
+ };
19
+ Label.displayName = "Label";
20
+ return Label;
21
+ }();
22
+ exports.Label = Label;
23
+ //# sourceMappingURL=Label.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.cjs","sources":["../../../../../src/ProgressBar/subcomponents/Label/Label.tsx"],"sourcesContent":["import React, { ReactNode } from \"react\"\nimport { Heading } from \"~components/Heading\"\nimport styles from \"./Label.module.scss\"\n\ntype Label = {\n content: ReactNode\n isReversed: boolean\n}\n\nexport const Label = ({ content, isReversed = false }: Label): JSX.Element => (\n <div className={styles.label}>\n <Heading variant=\"heading-4\" tag=\"p\" color={isReversed ? \"white\" : \"dark\"}>\n {content}\n </Heading>\n </div>\n)\n\nLabel.displayName = \"Label\"\n"],"names":["Label","_a","content","_b","isReversed","React","createElement","className","styles","label","Heading","variant","tag","color","displayName"],"mappings":";;;;;MASaA,KAAK;EAAA,MAALA,KAAK,GAAG,SAAAA,CAACC,EAAsC,EAAA;IAApC,IAAAC,OAAO,aAAA;MAAEC,EAAA,GAAAF,EAAA,CAAAG,UAAkB;MAAlBA,UAAU,GAAAD,EAAA,KAAA,KAAA,CAAA,GAAG,KAAK,GAAAA,EAAA;IAA2B,OAC5EE,KAAK,CAAAC,aAAA,CAAA,KAAA,EAAA;MAAAC,SAAS,EAAEC,YAAM,CAACC;IAAK,CAAA,EAC1BJ,KAAC,CAAAC,aAAA,CAAAI,OAAAA,CAAAA,OAAO,EAAC;MAAAC,OAAO,EAAC,WAAW;MAACC,GAAG,EAAC,GAAG;MAACC,KAAK,EAAET,UAAU,GAAG,OAAO,GAAG;IAAM,CACtE,EAAAF,OAAO,CACA,CACN;EALsE,CAM7E;EAEDF,KAAK,CAACc,WAAW,GAAG,OAAO;EAAA,OARdd,KAAK;AAAA;"}
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "label": "Label-module_label__zqjpR"
5
+ };
6
+ module.exports = styles;
7
+ //# sourceMappingURL=Label.module.scss.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.module.scss.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var calculatePercentage = function (_a) {
4
+ var value = _a.value,
5
+ max = _a.max;
6
+ return value / max * 100.0;
7
+ };
8
+ exports.calculatePercentage = calculatePercentage;
9
+ //# sourceMappingURL=calculatePercentage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculatePercentage.cjs","sources":["../../../../src/ProgressBar/utils/calculatePercentage.ts"],"sourcesContent":["export const calculatePercentage = ({\n value,\n max,\n}: {\n value: number\n max: number\n}): number => (value / max) * 100.0\n"],"names":["calculatePercentage","_a","value","max"],"mappings":";;AAAO,IAAMA,mBAAmB,GAAG,SAAAA,CAACC,EAMnC,EAAA;MALCC,KAAK,GAAAD,EAAA,CAAAC,KAAA;IACLC,GAAG,GAAAF,EAAA,CAAAE,GAAA;EAIS,OAACD,KAAK,GAAGC,GAAG,GAAI,KAAK;AAArB,CAAA;"}
@@ -1,4 +1,4 @@
1
- export declare const statusCodes: readonly ["400", "401", "403", "404", "422", "500", "502", "503", "504"];
1
+ export declare const statusCodes: readonly ["400", "401", "403", "404", "413", "422", "500", "502", "503", "504"];
2
2
  export type ErrorStatuses = (typeof statusCodes)[number];
3
3
  type TranslationMap = Record<ErrorStatuses, {
4
4
  title: string;
@@ -0,0 +1,20 @@
1
+ import { Scale, ScaleItem } from "./types";
2
+ export type LikertScaleProps = {
3
+ labelId: string;
4
+ scale: Scale;
5
+ selectedItem: ScaleItem | null;
6
+ /**
7
+ * @deprecated Please use data-testid instead
8
+ */
9
+ automationId?: string;
10
+ "data-testid"?: string;
11
+ reversed?: boolean;
12
+ validationMessage?: string;
13
+ status?: "default" | "error";
14
+ onSelect: (value: ScaleItem | null) => void;
15
+ };
16
+ /**
17
+ * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060201/Likert+Scale Guidance} |
18
+ * {@link https://cultureamp.design/?path=/docs/components-likertscalelegacy--docs Storybook}
19
+ */
20
+ export declare const LikertScaleLegacy: ({ scale, selectedItem, reversed, "data-testid": dataTestId, onSelect, validationMessage, status, labelId, }: LikertScaleProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./LikertScaleLegacy";
@@ -0,0 +1,6 @@
1
+ export type ScaleValue = -1 | 1 | 2 | 3 | 4 | 5;
2
+ export type ScaleItem = {
3
+ value: ScaleValue;
4
+ label: string;
5
+ };
6
+ export type Scale = ScaleItem[];
@@ -0,0 +1,3 @@
1
+ import { ScaleValue, ScaleItem } from "../types";
2
+ declare const determineSelectionFromKeyPress: (keyCode: number, currentSelection: ScaleItem | null, focusedItem: ScaleItem) => null | ScaleValue;
3
+ export default determineSelectionFromKeyPress;
@@ -7,6 +7,7 @@ export type MultiSelectToggleProps = {
7
7
  ["aria-controls"]: string;
8
8
  selectedOptions: MultiSelectOption[];
9
9
  isOpen?: boolean;
10
+ onRemoveOption: (optionValue: MultiSelectOption["value"]) => void;
10
11
  } & OverrideClassName<HTMLAttributes<HTMLDivElement>>;
11
12
  export declare const MultiSelectToggle: React.ForwardRefExoticComponent<{
12
13
  onClick: React.MouseEventHandler;
@@ -14,6 +15,7 @@ export declare const MultiSelectToggle: React.ForwardRefExoticComponent<{
14
15
  "aria-controls": string;
15
16
  selectedOptions: MultiSelectOption[];
16
17
  isOpen?: boolean | undefined;
18
+ onRemoveOption: (optionValue: MultiSelectOption["value"]) => void;
17
19
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
18
20
  classNameOverride?: string | undefined;
19
21
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { ToastNotificationWithOptionals } from "./types";
3
+ export type ToastNotificationProps = Omit<ToastNotificationWithOptionals, "message" | "persistent"> & {
4
+ /**
5
+ * Removes the dismiss trigger. functions the same as `persistent` in `addToastNotification`. If this is true you will need to manage the removal of notifications manually.
6
+ * @default false
7
+ */
8
+ hideCloseIcon?: boolean;
9
+ children: React.ReactNode;
10
+ };
11
+ export declare const ToastNotification: {
12
+ ({ id: propsId, hideCloseIcon, type, title, onHide, children, ...restProps }: ToastNotificationProps): null;
13
+ displayName: string;
14
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./ToastNotification";
2
+ export * from "./subcomponents/ToastNotificationManager";
3
+ export * from "./subcomponents/ToastNotificationsList";
@@ -0,0 +1,7 @@
1
+ import { AddToastNotification, ClearToastNotifications, RemoveToastNotification } from "../../types";
2
+ /**
3
+ * Export the curried API methods
4
+ */
5
+ export declare const addToastNotification: AddToastNotification;
6
+ export declare const clearToastNotifications: ClearToastNotifications;
7
+ export declare const removeToastNotification: RemoveToastNotification;
@@ -0,0 +1 @@
1
+ export * from "./ToastNotificationManager";