@x15ventures/x15-ui-library 3.16.1 → 3.18.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 (270) hide show
  1. package/dist/cjs/autoGenerated/libraryThemes.js +12 -12
  2. package/dist/cjs/autoGenerated/libraryThemes.js.map +1 -1
  3. package/dist/cjs/autoGenerated/libraryThemes.json +12 -12
  4. package/dist/cjs/components/design/accordion/Accordion.js +7 -23
  5. package/dist/cjs/components/design/accordion/Accordion.js.map +1 -1
  6. package/dist/cjs/components/design/banners/pageBanner/PageBanner.js +2 -4
  7. package/dist/cjs/components/design/banners/pageBanner/PageBanner.js.map +1 -1
  8. package/dist/cjs/components/design/card/cardContent/CardContentLine.js +2 -2
  9. package/dist/cjs/components/design/card/cardContent/CardContentLine.js.map +1 -1
  10. package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js +2 -2
  11. package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
  12. package/dist/cjs/components/design/dialog/Dialog.js +3 -1
  13. package/dist/cjs/components/design/dialog/Dialog.js.map +1 -1
  14. package/dist/cjs/components/design/dialog/dialog.css +5 -0
  15. package/dist/cjs/components/design/headerBar/HeaderBar.js +3 -3
  16. package/dist/cjs/components/design/headerBar/HeaderBar.js.map +1 -1
  17. package/dist/cjs/components/design/icons/notificationIcon/NotificationIcon.js +4 -5
  18. package/dist/cjs/components/design/icons/notificationIcon/NotificationIcon.js.map +1 -1
  19. package/dist/cjs/components/design/paginators/Paginator.js +4 -12
  20. package/dist/cjs/components/design/paginators/Paginator.js.map +1 -1
  21. package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js +89 -0
  22. package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js.map +1 -0
  23. package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/circularProgressIndicator.css +301 -0
  24. package/dist/cjs/components/design/revealMore/RevealMoreBelow.js +1 -3
  25. package/dist/cjs/components/design/revealMore/RevealMoreBelow.js.map +1 -1
  26. package/dist/cjs/components/design/revealMore/RevealMoreInline.js +3 -5
  27. package/dist/cjs/components/design/revealMore/RevealMoreInline.js.map +1 -1
  28. package/dist/cjs/components/design/revealMore/types/revealMoreTypes.js.map +1 -1
  29. package/dist/cjs/components/design/sidePanel/SidePanel.js +3 -5
  30. package/dist/cjs/components/design/sidePanel/SidePanel.js.map +1 -1
  31. package/dist/cjs/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js +6 -11
  32. package/dist/cjs/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js.map +1 -1
  33. package/dist/cjs/components/design/tabs/Tabs.js +2 -2
  34. package/dist/cjs/components/design/tabs/Tabs.js.map +1 -1
  35. package/dist/cjs/components/design/themeLoader/ThemeLoader.js +2 -2
  36. package/dist/cjs/components/design/themeLoader/ThemeLoader.js.map +1 -1
  37. package/dist/cjs/components/design/tooltip/Tooltip.js +43 -13
  38. package/dist/cjs/components/design/tooltip/Tooltip.js.map +1 -1
  39. package/dist/cjs/components/design/tooltip/index.js +6 -0
  40. package/dist/cjs/components/design/tooltip/index.js.map +1 -1
  41. package/dist/cjs/components/design/tooltip/tooltip.css +18 -7
  42. package/dist/cjs/components/form/buttons/SimpleButton.js +3 -3
  43. package/dist/cjs/components/form/buttons/SimpleButton.js.map +1 -1
  44. package/dist/cjs/components/form/buttons/button.interface.js.map +1 -1
  45. package/dist/cjs/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
  46. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +5 -5
  47. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
  48. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js +176 -0
  49. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js.map +1 -0
  50. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/_checkboxSwitchVariables.css +0 -0
  51. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitch.css +306 -0
  52. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js +6 -0
  53. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js.map +1 -0
  54. package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
  55. package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +3 -5
  56. package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
  57. package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js +12 -22
  58. package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js.map +1 -1
  59. package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileInputProps.js.map +1 -1
  60. package/dist/cjs/components/index.js +14 -0
  61. package/dist/cjs/components/index.js.map +1 -1
  62. package/dist/cjs/components/navigation/menu/Menu.interfaces.js.map +1 -1
  63. package/dist/cjs/components/navigation/menu/menuItemContent/MenuItemIcon.js +19 -31
  64. package/dist/cjs/components/navigation/menu/menuItemContent/MenuItemIcon.js.map +1 -1
  65. package/dist/cjs/helpers/iconHelpers.js +83 -0
  66. package/dist/cjs/helpers/iconHelpers.js.map +1 -0
  67. package/dist/cjs/helpers/index.js +43 -0
  68. package/dist/cjs/helpers/index.js.map +1 -1
  69. package/dist/cjs/helpers/objectHelpers.js +9 -2
  70. package/dist/cjs/helpers/objectHelpers.js.map +1 -1
  71. package/dist/cjs/hooks/InteractiveHostFocus.js +62 -0
  72. package/dist/cjs/hooks/InteractiveHostFocus.js.map +1 -0
  73. package/dist/cjs/hooks/index.js +7 -0
  74. package/dist/cjs/hooks/index.js.map +1 -1
  75. package/dist/cjs/index.js +79 -0
  76. package/dist/cjs/index.js.map +1 -1
  77. package/dist/cjs/interfaces/headerText.interface.js.map +1 -1
  78. package/dist/cjs/package.json +16 -28
  79. package/dist/cjs/styles/index.css +61 -0
  80. package/dist/cjs/styles/storybook/storybook.css +7 -0
  81. package/dist/cjs/styles/variables/cssVars/_darkModeVariables.css +21 -0
  82. package/dist/cjs/styles/variables/cssVars/_formVariables.css +40 -0
  83. package/dist/cjs/widgets/index.js +14 -0
  84. package/dist/cjs/widgets/index.js.map +1 -0
  85. package/dist/cjs/widgets/processLauncher/ProcessLauncher.js +272 -0
  86. package/dist/cjs/widgets/processLauncher/ProcessLauncher.js.map +1 -0
  87. package/dist/cjs/widgets/processLauncher/index.js +13 -0
  88. package/dist/cjs/widgets/processLauncher/index.js.map +1 -0
  89. package/dist/cjs/widgets/processLauncher/processLauncher.interfaces.js +6 -0
  90. package/dist/cjs/widgets/processLauncher/processLauncher.interfaces.js.map +1 -0
  91. package/dist/components/design/accordion/Accordion.d.ts +3 -2
  92. package/dist/components/design/accordion/Accordion.d.ts.map +1 -1
  93. package/dist/components/design/banners/pageBanner/PageBanner.d.ts +2 -1
  94. package/dist/components/design/banners/pageBanner/PageBanner.d.ts.map +1 -1
  95. package/dist/components/design/card/cardContent/CardContentLine.d.ts +2 -2
  96. package/dist/components/design/card/cardContent/CardContentLine.d.ts.map +1 -1
  97. package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts +2 -2
  98. package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts.map +1 -1
  99. package/dist/components/design/dialog/Dialog.d.ts.map +1 -1
  100. package/dist/components/design/headerBar/HeaderBar.d.ts.map +1 -1
  101. package/dist/components/design/icons/notificationIcon/NotificationIcon.d.ts +2 -2
  102. package/dist/components/design/icons/notificationIcon/NotificationIcon.d.ts.map +1 -1
  103. package/dist/components/design/paginators/Paginator.d.ts +3 -2
  104. package/dist/components/design/paginators/Paginator.d.ts.map +1 -1
  105. package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.d.ts +18 -0
  106. package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.d.ts.map +1 -0
  107. package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts +5 -0
  108. package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts.map +1 -0
  109. package/dist/components/design/revealMore/RevealMoreBelow.d.ts.map +1 -1
  110. package/dist/components/design/revealMore/RevealMoreInline.d.ts.map +1 -1
  111. package/dist/components/design/revealMore/types/revealMoreTypes.d.ts +3 -2
  112. package/dist/components/design/revealMore/types/revealMoreTypes.d.ts.map +1 -1
  113. package/dist/components/design/sidePanel/SidePanel.d.ts +3 -2
  114. package/dist/components/design/sidePanel/SidePanel.d.ts.map +1 -1
  115. package/dist/components/design/statusIndicators/statusIconLabel/StatusIconLabel.d.ts +2 -2
  116. package/dist/components/design/statusIndicators/statusIconLabel/StatusIconLabel.d.ts.map +1 -1
  117. package/dist/components/design/tabs/Tabs.d.ts +3 -3
  118. package/dist/components/design/tabs/Tabs.d.ts.map +1 -1
  119. package/dist/components/design/tooltip/Tooltip.d.ts +17 -3
  120. package/dist/components/design/tooltip/Tooltip.d.ts.map +1 -1
  121. package/dist/components/design/tooltip/Tooltip.test.d.ts +1 -1
  122. package/dist/components/design/tooltip/Tooltip.test.d.ts.map +1 -1
  123. package/dist/components/design/tooltip/index.d.ts +1 -1
  124. package/dist/components/design/tooltip/index.d.ts.map +1 -1
  125. package/dist/components/form/buttons/SimpleButton.test.d.ts +5 -0
  126. package/dist/components/form/buttons/SimpleButton.test.d.ts.map +1 -0
  127. package/dist/components/form/buttons/button.interface.d.ts +3 -3
  128. package/dist/components/form/buttons/button.interface.d.ts.map +1 -1
  129. package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +2 -1
  130. package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
  131. package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.d.ts +29 -0
  132. package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.d.ts.map +1 -0
  133. package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts +5 -0
  134. package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts.map +1 -0
  135. package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.d.ts +52 -0
  136. package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.d.ts.map +1 -0
  137. package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts +3 -3
  138. package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts.map +1 -1
  139. package/dist/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.d.ts.map +1 -1
  140. package/dist/components/form/formFields/subComponents/inputs/file/fileInputProps.d.ts +4 -3
  141. package/dist/components/form/formFields/subComponents/inputs/file/fileInputProps.d.ts.map +1 -1
  142. package/dist/components/index.d.ts +4 -0
  143. package/dist/components/index.d.ts.map +1 -1
  144. package/dist/components/navigation/menu/Menu.interfaces.d.ts +4 -3
  145. package/dist/components/navigation/menu/Menu.interfaces.d.ts.map +1 -1
  146. package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.d.ts +2 -1
  147. package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.d.ts.map +1 -1
  148. package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts +5 -0
  149. package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts.map +1 -0
  150. package/dist/esm/autoGenerated/libraryThemes.js +12 -12
  151. package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
  152. package/dist/esm/autoGenerated/libraryThemes.json +12 -12
  153. package/dist/esm/components/design/accordion/Accordion.js +7 -23
  154. package/dist/esm/components/design/accordion/Accordion.js.map +1 -1
  155. package/dist/esm/components/design/banners/pageBanner/PageBanner.js +2 -4
  156. package/dist/esm/components/design/banners/pageBanner/PageBanner.js.map +1 -1
  157. package/dist/esm/components/design/card/cardContent/CardContentLine.js +2 -2
  158. package/dist/esm/components/design/card/cardContent/CardContentLine.js.map +1 -1
  159. package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js +2 -2
  160. package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
  161. package/dist/esm/components/design/dialog/Dialog.js +3 -1
  162. package/dist/esm/components/design/dialog/Dialog.js.map +1 -1
  163. package/dist/esm/components/design/dialog/dialog.css +5 -0
  164. package/dist/esm/components/design/headerBar/HeaderBar.js +3 -3
  165. package/dist/esm/components/design/headerBar/HeaderBar.js.map +1 -1
  166. package/dist/esm/components/design/icons/notificationIcon/NotificationIcon.js +4 -5
  167. package/dist/esm/components/design/icons/notificationIcon/NotificationIcon.js.map +1 -1
  168. package/dist/esm/components/design/paginators/Paginator.js +4 -12
  169. package/dist/esm/components/design/paginators/Paginator.js.map +1 -1
  170. package/dist/esm/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js +82 -0
  171. package/dist/esm/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js.map +1 -0
  172. package/dist/esm/components/design/progressIndicators/circularProgressIndicator/circularProgressIndicator.css +301 -0
  173. package/dist/esm/components/design/revealMore/RevealMoreBelow.js +1 -3
  174. package/dist/esm/components/design/revealMore/RevealMoreBelow.js.map +1 -1
  175. package/dist/esm/components/design/revealMore/RevealMoreInline.js +2 -4
  176. package/dist/esm/components/design/revealMore/RevealMoreInline.js.map +1 -1
  177. package/dist/esm/components/design/revealMore/types/revealMoreTypes.js.map +1 -1
  178. package/dist/esm/components/design/sidePanel/SidePanel.js +3 -5
  179. package/dist/esm/components/design/sidePanel/SidePanel.js.map +1 -1
  180. package/dist/esm/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js +6 -11
  181. package/dist/esm/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js.map +1 -1
  182. package/dist/esm/components/design/tabs/Tabs.js +2 -2
  183. package/dist/esm/components/design/tabs/Tabs.js.map +1 -1
  184. package/dist/esm/components/design/themeLoader/ThemeLoader.js +1 -1
  185. package/dist/esm/components/design/themeLoader/ThemeLoader.js.map +1 -1
  186. package/dist/esm/components/design/tooltip/Tooltip.js +41 -12
  187. package/dist/esm/components/design/tooltip/Tooltip.js.map +1 -1
  188. package/dist/esm/components/design/tooltip/index.js +1 -1
  189. package/dist/esm/components/design/tooltip/index.js.map +1 -1
  190. package/dist/esm/components/design/tooltip/tooltip.css +18 -7
  191. package/dist/esm/components/form/buttons/SimpleButton.js +3 -3
  192. package/dist/esm/components/form/buttons/SimpleButton.js.map +1 -1
  193. package/dist/esm/components/form/buttons/button.interface.js.map +1 -1
  194. package/dist/esm/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
  195. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +5 -5
  196. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
  197. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js +167 -0
  198. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js.map +1 -0
  199. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/_checkboxSwitchVariables.css +0 -0
  200. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitch.css +306 -0
  201. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js +2 -0
  202. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js.map +1 -0
  203. package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
  204. package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +3 -5
  205. package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
  206. package/dist/esm/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js +12 -22
  207. package/dist/esm/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js.map +1 -1
  208. package/dist/esm/components/form/formFields/subComponents/inputs/file/fileInputProps.js.map +1 -1
  209. package/dist/esm/components/index.js +2 -0
  210. package/dist/esm/components/index.js.map +1 -1
  211. package/dist/esm/components/navigation/menu/Menu.interfaces.js.map +1 -1
  212. package/dist/esm/components/navigation/menu/menuItemContent/MenuItemIcon.js +17 -30
  213. package/dist/esm/components/navigation/menu/menuItemContent/MenuItemIcon.js.map +1 -1
  214. package/dist/esm/helpers/iconHelpers.js +73 -0
  215. package/dist/esm/helpers/iconHelpers.js.map +1 -0
  216. package/dist/esm/helpers/index.js +2 -1
  217. package/dist/esm/helpers/index.js.map +1 -1
  218. package/dist/esm/helpers/objectHelpers.js +7 -3
  219. package/dist/esm/helpers/objectHelpers.js.map +1 -1
  220. package/dist/esm/hooks/InteractiveHostFocus.js +56 -0
  221. package/dist/esm/hooks/InteractiveHostFocus.js.map +1 -0
  222. package/dist/esm/hooks/index.js +1 -0
  223. package/dist/esm/hooks/index.js.map +1 -1
  224. package/dist/esm/index.js +5 -4
  225. package/dist/esm/index.js.map +1 -1
  226. package/dist/esm/interfaces/headerText.interface.js.map +1 -1
  227. package/dist/esm/package.json +16 -28
  228. package/dist/esm/styles/index.css +61 -0
  229. package/dist/esm/styles/storybook/storybook.css +7 -0
  230. package/dist/esm/styles/variables/cssVars/_darkModeVariables.css +21 -0
  231. package/dist/esm/styles/variables/cssVars/_formVariables.css +40 -0
  232. package/dist/esm/widgets/index.js +4 -0
  233. package/dist/esm/widgets/index.js.map +1 -0
  234. package/dist/esm/widgets/processLauncher/ProcessLauncher.js +263 -0
  235. package/dist/esm/widgets/processLauncher/ProcessLauncher.js.map +1 -0
  236. package/dist/esm/widgets/processLauncher/index.js +2 -0
  237. package/dist/esm/widgets/processLauncher/index.js.map +1 -0
  238. package/dist/esm/widgets/processLauncher/processLauncher.interfaces.js +2 -0
  239. package/dist/esm/widgets/processLauncher/processLauncher.interfaces.js.map +1 -0
  240. package/dist/helpers/iconHelpers.d.ts +30 -0
  241. package/dist/helpers/iconHelpers.d.ts.map +1 -0
  242. package/dist/helpers/iconHelpers.test.d.ts +5 -0
  243. package/dist/helpers/iconHelpers.test.d.ts.map +1 -0
  244. package/dist/helpers/index.d.ts +4 -1
  245. package/dist/helpers/index.d.ts.map +1 -1
  246. package/dist/helpers/objectHelpers.d.ts +10 -3
  247. package/dist/helpers/objectHelpers.d.ts.map +1 -1
  248. package/dist/hooks/InteractiveHostFocus.d.ts +12 -0
  249. package/dist/hooks/InteractiveHostFocus.d.ts.map +1 -0
  250. package/dist/hooks/InteractiveHostFocus.test.d.ts +5 -0
  251. package/dist/hooks/InteractiveHostFocus.test.d.ts.map +1 -0
  252. package/dist/hooks/index.d.ts +1 -0
  253. package/dist/hooks/index.d.ts.map +1 -1
  254. package/dist/index.d.ts +9 -4
  255. package/dist/index.d.ts.map +1 -1
  256. package/dist/interfaces/headerText.interface.d.ts +3 -3
  257. package/dist/interfaces/headerText.interface.d.ts.map +1 -1
  258. package/dist/package.json +16 -28
  259. package/dist/widgets/index.d.ts +3 -0
  260. package/dist/widgets/index.d.ts.map +1 -0
  261. package/dist/widgets/processLauncher/ProcessLauncher.d.ts +21 -0
  262. package/dist/widgets/processLauncher/ProcessLauncher.d.ts.map +1 -0
  263. package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts +5 -0
  264. package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts.map +1 -0
  265. package/dist/widgets/processLauncher/index.d.ts +4 -0
  266. package/dist/widgets/processLauncher/index.d.ts.map +1 -0
  267. package/dist/widgets/processLauncher/processLauncher.interfaces.d.ts +45 -0
  268. package/dist/widgets/processLauncher/processLauncher.interfaces.d.ts.map +1 -0
  269. package/package.json +16 -28
  270. package/readme.md +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.js","names":["React","useCallback","useEffect","useRef","useState","Icon","SidePanel","id","panelLabel","size","position","positionRefNode","animation","icons","onClose","onOpen","isOpen","allowOverflow","isFloating","customCssClass","customControlButtonCssClass","children","isOpenState","setIsOpenState","panelElement","TOGGLE_TEXT","panelCloseButton","TogglePanelOpenState","newStateIsOpen","getIconCssClass","closed","open","PanelCloseButton","createElement","ref","className","title","type","onClick","icon","panelCssClass","getParentNode","current","document","body","parentNode","classList","add","remove","tabIndex"],"sources":["../../../../../src/components/design/sidePanel/SidePanel.tsx"],"sourcesContent":["'use client';\n\nimport React, {\n ReactNode, useCallback, useEffect, useRef, useState\n} from 'react';\nimport { GenericFunction } from '../../../interfaces';\nimport { Icon } from '../icons/basicIcon/Icon';\n\nimport './sidePanel.scss';\n\nexport interface SidePanelInterface {\n id: string;\n panelLabel?: string;\n size?: 's' | 'm' | 'l';\n position?: 'left' | 'right' | 'top' | 'bottom';\n positionRefNode?: HTMLElement | React.RefObject<HTMLElement>;\n animation?: 'none' | 'slide';\n icons?: {\n open: string;\n closed: string;\n }\n onClose?: GenericFunction;\n onOpen?: GenericFunction;\n isOpen?: boolean;\n allowOverflow?: boolean;\n isFloating?: boolean;\n customCssClass?: string;\n customControlButtonCssClass?: string;\n children: ReactNode;\n}\n\nexport const SidePanel: React.FC<SidePanelInterface> = (\n {\n id,\n panelLabel = 'side panel',\n size = 'm',\n position = 'right',\n positionRefNode,\n animation = 'slide',\n icons,\n onClose = () => {},\n onOpen = () => {},\n isOpen = false,\n allowOverflow = false,\n isFloating = true,\n customCssClass,\n customControlButtonCssClass = '',\n children\n }\n) => {\n const [isOpenState, setIsOpenState] = useState(isOpen);\n const panelElement = useRef<HTMLDivElement>(null);\n\n const TOGGLE_TEXT = `Open and close ${ panelLabel }`;\n const panelCloseButton = useRef(null);\n\n const TogglePanelOpenState = useCallback(() => {\n const newStateIsOpen = !isOpenState;\n setIsOpenState(newStateIsOpen);\n if (newStateIsOpen) {\n onOpen();\n } else {\n onClose();\n }\n }, [isOpenState, onClose, onOpen]);\n\n const getIconCssClass = () => {\n if (icons) {\n return isOpenState ? icons.closed : icons.open;\n }\n\n if (isOpenState) {\n return 'close';\n }\n\n switch (position) {\n case 'left':\n return 'chevronRightSelect';\n case 'top':\n return 'chevronDownSelect';\n case 'bottom':\n return 'chevronUpSelect';\n default:\n return 'chevronLeftSelect';\n }\n };\n\n const PanelCloseButton: React.FC = () => (\n <button\n ref={ panelCloseButton }\n className={ `sidePanelClose ${ customControlButtonCssClass }` }\n title={ TOGGLE_TEXT }\n type=\"button\"\n onClick={ () => TogglePanelOpenState() }\n >\n <Icon icon={ getIconCssClass() } />\n <span className=\"sr-only\">Open and close panel</span>\n </button>\n );\n\n const panelCssClass = useCallback(() =>\n `sidePanel \n ${ isOpenState ? 'isOpen' : '' }\n ${ allowOverflow ? 'allowOverflow' : '' }\n ${ isFloating ? 'isFloating' : '' }\n sidePanelSize_${ size }\n sidePanelPosition_${ position }\n sidePanelAnimation_${ animation }\n ${ customCssClass || '' }`,\n [isOpenState, isFloating, size, position, animation, customCssClass]);\n\n useEffect(() => {\n setIsOpenState(isOpen);\n }, [isOpen]);\n\n const getParentNode = () => {\n if (positionRefNode) {\n if ('current' in positionRefNode) {\n return positionRefNode.current ? positionRefNode.current : document.body;\n }\n return positionRefNode;\n }\n return document.body;\n };\n\n useEffect(() => {\n const parentNode = getParentNode();\n\n parentNode.classList.add('withSidePanels');\n if (isOpenState) {\n parentNode.classList.add(`sidePanel_${ size }_${ position }`);\n } else {\n parentNode.classList.remove(`sidePanel_${ size }_${ position }`);\n }\n return () =>{\n parentNode.classList.remove(`sidePanel_${ size }_${ position }`);\n };\n }, [animation, isOpenState, position, size]);\n\n return (\n <div ref={ panelElement } title={ panelLabel } id={ id } className={ panelCssClass() }>\n { animation === 'slide' && <PanelCloseButton /> }\n { /* eslint-disable-next-line jsxA11y/no-noninteractive-tabindex */ }\n <div className=\"sidePanelContent\" tabIndex={ 0 }>\n { children }\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IACCC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAC9C,OAAO;AAEd,SAASC,IAAI,QAAQ,yBAAyB;AAE9C,OAAO,kBAAkB;AAuBzB,OAAO,MAAMC,SAAuC,GAAGA,CACrD;EACEC,EAAE;EACFC,UAAU,GAAG,YAAY;EACzBC,IAAI,GAAG,GAAG;EACVC,QAAQ,GAAG,OAAO;EAClBC,eAAe;EACfC,SAAS,GAAG,OAAO;EACnBC,KAAK;EACLC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClBC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;EACjBC,MAAM,GAAG,KAAK;EACdC,aAAa,GAAG,KAAK;EACrBC,UAAU,GAAG,IAAI;EACjBC,cAAc;EACdC,2BAA2B,GAAG,EAAE;EAChCC;AACF,CAAC,KACE;EACH,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGnB,QAAQ,CAACY,MAAM,CAAC;EACtD,MAAMQ,YAAY,GAAGrB,MAAM,CAAiB,IAAI,CAAC;EAEjD,MAAMsB,WAAW,GAAG,kBAAmBjB,UAAU,EAAG;EACpD,MAAMkB,gBAAgB,GAAGvB,MAAM,CAAC,IAAI,CAAC;EAErC,MAAMwB,oBAAoB,GAAG1B,WAAW,CAAC,MAAM;IAC7C,MAAM2B,cAAc,GAAG,CAACN,WAAW;IACnCC,cAAc,CAACK,cAAc,CAAC;IAC9B,IAAIA,cAAc,EAAE;MAClBb,MAAM,CAAC,CAAC;IACV,CAAC,MAAM;MACLD,OAAO,CAAC,CAAC;IACX;EACF,CAAC,EAAE,CAACQ,WAAW,EAAER,OAAO,EAAEC,MAAM,CAAC,C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"version":3,"file":"SidePanel.js","names":["React","useCallback","useEffect","useRef","useState","renderIcon","SidePanel","id","panelLabel","size","position","positionRefNode","animation","icons","onClose","onOpen","isOpen","allowOverflow","isFloating","customCssClass","customControlButtonCssClass","children","isOpenState","setIsOpenState","panelElement","TOGGLE_TEXT","panelCloseButton","TogglePanelOpenState","newStateIsOpen","getToggleIcon","closed","open","PanelCloseButton","createElement","ref","className","title","type","onClick","panelCssClass","getParentNode","current","document","body","parentNode","classList","add","remove","tabIndex"],"sources":["../../../../../src/components/design/sidePanel/SidePanel.tsx"],"sourcesContent":["'use client';\n\nimport React, {\n ReactNode, useCallback, useEffect, useRef, useState\n} from 'react';\nimport { GenericFunction } from '../../../interfaces';\nimport { IconSource, renderIcon } from '../../../helpers/iconHelpers';\n\nimport './sidePanel.scss';\n\nexport interface SidePanelInterface {\n id: string;\n panelLabel?: string;\n size?: 's' | 'm' | 'l';\n position?: 'left' | 'right' | 'top' | 'bottom';\n positionRefNode?: HTMLElement | React.RefObject<HTMLElement>;\n animation?: 'none' | 'slide';\n icons?: {\n open: IconSource;\n closed: IconSource;\n }\n onClose?: GenericFunction;\n onOpen?: GenericFunction;\n isOpen?: boolean;\n allowOverflow?: boolean;\n isFloating?: boolean;\n customCssClass?: string;\n customControlButtonCssClass?: string;\n children: ReactNode;\n}\n\nexport const SidePanel: React.FC<SidePanelInterface> = (\n {\n id,\n panelLabel = 'side panel',\n size = 'm',\n position = 'right',\n positionRefNode,\n animation = 'slide',\n icons,\n onClose = () => {},\n onOpen = () => {},\n isOpen = false,\n allowOverflow = false,\n isFloating = true,\n customCssClass,\n customControlButtonCssClass = '',\n children\n }\n) => {\n const [isOpenState, setIsOpenState] = useState(isOpen);\n const panelElement = useRef<HTMLDivElement>(null);\n\n const TOGGLE_TEXT = `Open and close ${ panelLabel }`;\n const panelCloseButton = useRef(null);\n\n const TogglePanelOpenState = useCallback(() => {\n const newStateIsOpen = !isOpenState;\n setIsOpenState(newStateIsOpen);\n if (newStateIsOpen) {\n onOpen();\n } else {\n onClose();\n }\n }, [isOpenState, onClose, onOpen]);\n\n const getToggleIcon = (): IconSource => {\n if (icons) {\n return isOpenState ? icons.closed : icons.open;\n }\n\n if (isOpenState) {\n return 'close';\n }\n\n switch (position) {\n case 'left':\n return 'chevronRightSelect';\n case 'top':\n return 'chevronDownSelect';\n case 'bottom':\n return 'chevronUpSelect';\n default:\n return 'chevronLeftSelect';\n }\n };\n\n const PanelCloseButton: React.FC = () => (\n <button\n ref={ panelCloseButton }\n className={ `sidePanelClose ${ customControlButtonCssClass }` }\n title={ TOGGLE_TEXT }\n type=\"button\"\n onClick={ () => TogglePanelOpenState() }\n >\n { renderIcon(getToggleIcon()) }\n <span className=\"sr-only\">Open and close panel</span>\n </button>\n );\n\n const panelCssClass = useCallback(() =>\n `sidePanel \n ${ isOpenState ? 'isOpen' : '' }\n ${ allowOverflow ? 'allowOverflow' : '' }\n ${ isFloating ? 'isFloating' : '' }\n sidePanelSize_${ size }\n sidePanelPosition_${ position }\n sidePanelAnimation_${ animation }\n ${ customCssClass || '' }`,\n [isOpenState, isFloating, size, position, animation, customCssClass]);\n\n useEffect(() => {\n setIsOpenState(isOpen);\n }, [isOpen]);\n\n const getParentNode = () => {\n if (positionRefNode) {\n if ('current' in positionRefNode) {\n return positionRefNode.current ? positionRefNode.current : document.body;\n }\n return positionRefNode;\n }\n return document.body;\n };\n\n useEffect(() => {\n const parentNode = getParentNode();\n\n parentNode.classList.add('withSidePanels');\n if (isOpenState) {\n parentNode.classList.add(`sidePanel_${ size }_${ position }`);\n } else {\n parentNode.classList.remove(`sidePanel_${ size }_${ position }`);\n }\n return () =>{\n parentNode.classList.remove(`sidePanel_${ size }_${ position }`);\n };\n }, [animation, isOpenState, position, size]);\n\n return (\n <div ref={ panelElement } title={ panelLabel } id={ id } className={ panelCssClass() }>\n { animation === 'slide' && <PanelCloseButton /> }\n { /* eslint-disable-next-line jsxA11y/no-noninteractive-tabindex */ }\n <div className=\"sidePanelContent\" tab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ChC,OAAOA,eAAe,CAAC8B,OAAO,GAAG9B,eAAe,CAAC8B,OAAO,GAAGC,QAAQ,CAACC,IAAI;MAC1E;MACA,OAAOhC,eAAe;IACxB;IACA,OAAO+B,QAAQ,CAACC,IAAI;EACtB,CAAC;EAEDzC,SAAS,CAAC,MAAM;IACd,MAAM0C,UAAU,GAAGJ,aAAa,CAAC,CAAC;IAElCI,UAAU,CAACC,SAAS,CAACC,GAAG,CAAC,gBAAgB,CAAC;IAC1C,IAAIxB,WAAW,EAAE;MACfsB,UAAU,CAACC,SAAS,CAACC,GAAG,CAAC,aAAcrC,IAAI,IAAMC,QAAQ,EAAG,CAAC;IAC/D,CAAC,MAAM;MACLkC,UAAU,CAACC,SAAS,CAACE,MAAM,CAAC,aAActC,IAAI,IAAMC,QAAQ,EAAG,CAAC;IAClE;IACA,OAAO,MAAK;MACVkC,UAAU,CAACC,SAAS,CAACE,MAAM,CAAC,aAActC,IAAI,IAAMC,QAAQ,EAAG,CAAC;IAClE,CAAC;EACH,CAAC,EAAE,CAACE,SAAS,EAAEU,WAAW,EAAEZ,QAAQ,EAAED,IAAI,CAAC,CAAC;EAE5C,oBACET,KAAA,CAAAiC,aAAA;IAAKC,GAAG,EAAGV,YAAc;IAACY,KAAK,EAAG5B,UAAY;IAACD,EAAE,EAAGA,EAAI;IAAC4B,SAAS,EAAGI,aAAa,CAAC;EAAG,GAClF3B,SAAS,KAAK,OAAO,iBAAIZ,KAAA,CAAAiC,aAAA,CAACD,gBAAgB,MAAE,CAAC,eAE/ChC,KAAA,CAAAiC,aAAA;IAAKE,SAAS,EAAC,kBAAkB;IAACa,QAAQ,EAAG;EAAG,GAC5C3B,QACC,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React from 'react';
4
4
  import { dateToShortReadableDateTime } from '../../../../helpers/dateHelpers';
5
- import { Icon } from '../../icons/basicIcon/Icon';
5
+ import { renderIcon } from '../../../../helpers/iconHelpers';
6
6
  import './statusIconLabel.css';
7
7
  export const StatusIconLabel = ({
8
8
  description,
@@ -23,20 +23,15 @@ export const StatusIconLabel = ({
23
23
  defCon3: 'fire',
24
24
  success: 'info'
25
25
  };
26
- const StatusIcon = () => {
27
- if (customIcon) {
28
- return /*#__PURE__*/React.createElement(Icon, customIcon);
29
- }
30
- return /*#__PURE__*/React.createElement(Icon, {
31
- icon: iconMap[indicator]
32
- });
33
- };
26
+ const statusIcon = renderIcon(customIcon, {
27
+ fallback: iconMap[indicator]
28
+ });
34
29
  return /*#__PURE__*/React.createElement("span", {
35
30
  className: `statusIconLabel ${indicator} ${customCssClass}`,
36
31
  title: `${status} ${description ? ': ' + description : ''}${dueAt ? '. Due at ' + formattedDueDateTime : ''}`
37
- }, iconPosition === 'left' && /*#__PURE__*/React.createElement(StatusIcon, null), /*#__PURE__*/React.createElement("span", {
32
+ }, iconPosition === 'left' && statusIcon, /*#__PURE__*/React.createElement("span", {
38
33
  className: hideLabel ? 'sr-only' : ''
39
- }, label), iconPosition !== 'left' && /*#__PURE__*/React.createElement(StatusIcon, null));
34
+ }, label), iconPosition !== 'left' && statusIcon);
40
35
  };
41
36
  export default StatusIconLabel;
42
37
  //# sourceMappingURL=StatusIconLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusIconLabel.js","names":["React","dateToShortReadableDateTime","Icon","StatusIconLabel","description","status","label","hideLabel","indicator","dueAt","customIcon","customCssClass","iconPosition","formattedDueDateTime","iconMap","info","alert","warn","defCon3","success","StatusIcon","createElement","icon","className","title"],"sources":["../../../../../../src/components/design/statusIndicators/statusIconLabel/StatusIconLabel.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode } from 'react';\nimport { StatusInterface } from '../statusIndicators.interface';\nimport { dateToShortReadableDateTime } from '../../../../helpers/dateHelpers';\nimport { Icon, IconProps } from '../../icons/basicIcon/Icon';\n\nimport './statusIconLabel.scss';\n\nexport interface StatusIconLabelInterface extends Omit<StatusInterface, 'onClick'> {\n customIcon?: IconProps;\n iconPosition?: 'left' | 'right';\n label: string | ReactNode;\n hideLabel?: boolean;\n customCssClass?: string;\n}\n\nexport const StatusIconLabel: React.FC<StatusIconLabelInterface> = (\n {\n description,\n status,\n label,\n hideLabel = false,\n indicator = 'info',\n dueAt,\n customIcon,\n customCssClass = '',\n iconPosition = 'left'\n }\n) => {\n const formattedDueDateTime = dueAt ? dateToShortReadableDateTime(dueAt) : 'TBD';\n\n const iconMap: { [index: string]: string } = {\n info: 'info',\n alert: 'notification',\n warn: 'warning',\n defCon3: 'fire',\n success: 'info'\n };\n\n const StatusIcon = () => {\n if (customIcon) {\n return <Icon { ...customIcon } />;\n }\n return <Icon icon={ iconMap[indicator] } />;\n };\n\n return (\n <span\n className={ `statusIconLabel ${ indicator } ${ customCssClass }` }\n title={ `${ status } ${ description ? ': ' + description : '' }${ dueAt ? '. Due at ' + formattedDueDateTime : '' }` }\n >\n {\n iconPosition === 'left' &&\n <StatusIcon />\n }\n <span className={ hideLabel ? 'sr-only' : '' }>{ label }</span>\n {\n iconPosition !== 'left' &&\n <StatusIcon />\n }\n </span>\n );\n};\n\nexport default StatusIconLabel;\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,MAAqB,OAAO;AAExC,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,IAAI,QAAmB,4BAA4B;AAE5D,OAAO,wBAAwB;AAU/B,OAAO,MAAMC,eAAmD,GAAGA,CACjE;EACEC,WAAW;EACXC,MAAM;EACNC,KAAK;EACLC,SAAS,GAAG,KAAK;EACjBC,SAAS,GAAG,MAAM;EAClBC,KAAK;EACLC,UAAU;EACVC,cAAc,GAAG,EAAE;EACnBC,YAAY,GAAG;AACjB,CAAC,KACE;EACH,MAAMC,oBAAoB,GAAGJ,KAAK,GAAGR,2BAA2B,CAACQ,KAAK,CAAC,GAAG,KAAK;EAE/E,MAAMK,OAAoC,GAAG;IAC3CC,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,cAAc;IACrBC,IAAI,EAAE,SAAS;IACfC,OAAO,EAAE,MAAM;IACfC,OAAO,EAAE;EACX,CAAC;EAED,MAAMC,UAAU,GAAGA,CAAA,KAAM;IACvB,IAAIV,UAAU,EAAE;MACd,oBAAOV,KAAA,CAAAqB,aAAA,CAACnB,IAAI,EAAMQ,UAAc,CAAC;IACnC;IACA,oBAAOV,KAAA,CAAAqB,aAAA,CAACnB,IAAI;MAACoB,IAAI,EAAGR,OAAO,CAACN,SAAS;IAAG,CAAE,CAAC;EAC7C,CAAC;EAED,oBACER,KAAA,CAAAqB,aAAA;IACEE,SAAS,EAAG,mBAAoBf,SAAS,IAAMG,cAAc,EAAK;IAClEa,KAAK,EAAG,GAAInB,MAAM,IAAMD,WAAW,GAAG,IAAI,GAAGA,WAAW,GAAG,EAAE,GAAKK,KAAK,GAAG,WAAW,GAAGI,oBAAoB,GAAG,EAAE;EAAK,GAGpHD,YAAY,KAAK,MAAM,iBACvBZ,KAAA,CAAAqB,aAAA,CAACD,UAAU,MAAE,CAAC,eAEhBpB,KAAA,CAAAqB,aAAA;IAAME,SAAS,EAAGhB,SAAS,GAAG,SAAS,GAAG;EAAI,GAAGD,KAAa,CAAC,EAE7DM,YAAY,KAAK,MAAM,iBACvBZ,KAAA,CAAAqB,aAAA,CAACD,UAAU,MAAE,CAEX,CAAC;AAEX,CAAC;AAED,eAAejB,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"StatusIconLabel.js","names":["React","dateToShortReadableDateTime","renderIcon","StatusIconLabel","description","status","label","hideLabel","indicator","dueAt","customIcon","customCssClass","iconPosition","formattedDueDateTime","iconMap","info","alert","warn","defCon3","success","statusIcon","fallback","createElement","className","title"],"sources":["../../../../../../src/components/design/statusIndicators/statusIconLabel/StatusIconLabel.tsx"],"sourcesContent":["'use client';\n\nimport React, { ReactNode } from 'react';\nimport { StatusInterface } from '../statusIndicators.interface';\nimport { dateToShortReadableDateTime } from '../../../../helpers/dateHelpers';\nimport { IconSource, renderIcon } from '../../../../helpers/iconHelpers';\n\nimport './statusIconLabel.scss';\n\nexport interface StatusIconLabelInterface extends Omit<StatusInterface, 'onClick'> {\n customIcon?: IconSource;\n iconPosition?: 'left' | 'right';\n label: string | ReactNode;\n hideLabel?: boolean;\n customCssClass?: string;\n}\n\nexport const StatusIconLabel: React.FC<StatusIconLabelInterface> = (\n {\n description,\n status,\n label,\n hideLabel = false,\n indicator = 'info',\n dueAt,\n customIcon,\n customCssClass = '',\n iconPosition = 'left'\n }\n) => {\n const formattedDueDateTime = dueAt ? dateToShortReadableDateTime(dueAt) : 'TBD';\n\n const iconMap: { [index: string]: string } = {\n info: 'info',\n alert: 'notification',\n warn: 'warning',\n defCon3: 'fire',\n success: 'info'\n };\n\n const statusIcon = renderIcon(customIcon, { fallback: iconMap[indicator] });\n\n return (\n <span\n className={ `statusIconLabel ${ indicator } ${ customCssClass }` }\n title={ `${ status } ${ description ? ': ' + description : '' }${ dueAt ? '. Due at ' + formattedDueDateTime : '' }` }\n >\n { iconPosition === 'left' && statusIcon }\n <span className={ hideLabel ? 'sr-only' : '' }>{ label }</span>\n { iconPosition !== 'left' && statusIcon }\n </span>\n );\n};\n\nexport default StatusIconLabel;\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,MAAqB,OAAO;AAExC,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAAqBC,UAAU,QAAQ,iCAAiC;AAExE,OAAO,wBAAwB;AAU/B,OAAO,MAAMC,eAAmD,GAAGA,CACjE;EACEC,WAAW;EACXC,MAAM;EACNC,KAAK;EACLC,SAAS,GAAG,KAAK;EACjBC,SAAS,GAAG,MAAM;EAClBC,KAAK;EACLC,UAAU;EACVC,cAAc,GAAG,EAAE;EACnBC,YAAY,GAAG;AACjB,CAAC,KACE;EACH,MAAMC,oBAAoB,GAAGJ,KAAK,GAAGR,2BAA2B,CAACQ,KAAK,CAAC,GAAG,KAAK;EAE/E,MAAMK,OAAoC,GAAG;IAC3CC,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,cAAc;IACrBC,IAAI,EAAE,SAAS;IACfC,OAAO,EAAE,MAAM;IACfC,OAAO,EAAE;EACX,CAAC;EAED,MAAMC,UAAU,GAAGlB,UAAU,CAACQ,UAAU,EAAE;IAAEW,QAAQ,EAAEP,OAAO,CAACN,SAAS;EAAE,CAAC,CAAC;EAE3E,oBACER,KAAA,CAAAsB,aAAA;IACEC,SAAS,EAAG,mBAAoBf,SAAS,IAAMG,cAAc,EAAK;IAClEa,KAAK,EAAG,GAAInB,MAAM,IAAMD,WAAW,GAAG,IAAI,GAAGA,WAAW,GAAG,EAAE,GAAKK,KAAK,GAAG,WAAW,GAAGI,oBAAoB,GAAG,EAAE;EAAK,GAEpHD,YAAY,KAAK,MAAM,IAAIQ,UAAU,eACvCpB,KAAA,CAAAsB,aAAA;IAAMC,SAAS,EAAGhB,SAAS,GAAG,SAAS,GAAG;EAAI,GAAGD,KAAa,CAAC,EAC7DM,YAAY,KAAK,MAAM,IAAIQ,UACzB,CAAC;AAEX,CAAC;AAED,eAAejB,eAAe","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import React, { useState } from 'react';
4
- import Icon from '../icons/basicIcon/Icon';
4
+ import { renderIcon } from '../../../helpers/iconHelpers';
5
5
  import NotificationIcon from '../icons/notificationIcon/NotificationIcon';
6
6
  import './tabs.css';
7
7
  export const Tabs = ({
@@ -43,7 +43,7 @@ export const Tabs = ({
43
43
  type: "button",
44
44
  onClick: () => setActiveTab(index),
45
45
  className: `button tabControl ${notificationIcon ? 'withNotification' : ''} ${index === activeTab ? 'active' : ''}`
46
- }, leftIcon && /*#__PURE__*/React.createElement(Icon, leftIcon), text, rightIcon && /*#__PURE__*/React.createElement(Icon, rightIcon), notificationIcon && /*#__PURE__*/React.createElement(NotificationIcon, notificationIcon));
46
+ }, renderIcon(leftIcon), text, renderIcon(rightIcon), notificationIcon && /*#__PURE__*/React.createElement(NotificationIcon, notificationIcon));
47
47
  })), /*#__PURE__*/React.createElement("div", {
48
48
  className: "tabPanels"
49
49
  }, tabs.map((tab, index) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","names":["React","useState","Icon","NotificationIcon","Tabs","tabs","activeTabIndex","activeTab","setActiveTab","getIds","id","controlId","panelId","createElement","className","role","map","tab","index","control","text","leftIcon","rightIcon","notificationIcon","key","tabIndex","type","onClick","content"],"sources":["../../../../../src/components/design/tabs/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport Icon, { IconProps } from '../icons/basicIcon/Icon';\nimport NotificationIcon, { NotificationIconProps } from '../icons/notificationIcon/NotificationIcon';\n\nimport './tabs.scss';\n\ninterface TabProps {\n id: string;\n control: {\n text: string;\n leftIcon?: IconProps;\n rightIcon?: IconProps;\n notificationIcon?: NotificationIconProps;\n },\n content: React.ReactNode | React.ReactElement\n}\n\ninterface TabsProps {\n tabs: TabProps[];\n activeTabIndex?: number;\n}\n\nexport const Tabs: React.FC<TabsProps> = (\n {\n tabs,\n activeTabIndex = 0\n }\n) => {\n const [activeTab, setActiveTab] = useState(activeTabIndex);\n\n const getIds = (id: string) => ({\n controlId: `tabControl_${ id }`,\n panelId: `tabPanel_${ id }`\n });\n\n return (\n <div className=\"tabGroup\">\n <div className=\"tabControls\" role=\"tablist\">\n {\n tabs.map((tab, index) => {\n const { id, control } = tab;\n const {\n text, leftIcon, rightIcon, notificationIcon\n } = control;\n\n const { controlId, panelId } = getIds(id);\n\n return (\n <button key={ controlId }\n role=\"tab\"\n id={ controlId }\n aria-controls={ panelId }\n aria-selected={ index === activeTab }\n tabIndex={ index === activeTab ? 0 : -1 }\n type=\"button\"\n onClick={ () => setActiveTab(index) }\n className={ `button tabControl ${ notificationIcon ? 'withNotification' : '' } ${ index === activeTab ? 'active' : '' }` }\n >\n {\n leftIcon && <Icon { ...leftIcon } />\n }\n\n { text }\n\n {\n rightIcon && <Icon { ...rightIcon } />\n }\n\n {\n notificationIcon && <NotificationIcon { ...notificationIcon } />\n }\n </button>\n );\n })\n }\n </div>\n\n <div className=\"tabPanels\">\n {\n tabs.map((tab, index) => {\n const { id, content } = tab;\n\n const { controlId, panelId } = getIds(id);\n\n return (\n <div key={ panelId }\n aria-labelledby={ controlId }\n role=\"tabpanel\"\n tabIndex={ index === activeTab ? 0 : -1 }\n id={ panelId }\n className={ `tabPanel ${ index === activeTab ? 'active' : '' }` }\n >\n { content }\n </div>\n );\n })\n }\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,IAAI,MAAqB,yBAAyB;AACzD,OAAOC,gBAAgB,MAAiC,4CAA4C;AAEpG,OAAO,aAAa;AAkBpB,OAAO,MAAMC,IAAyB,GAAGA,CACvC;EACEC,IAAI;EACJC,cAAc,GAAG;AACnB,CAAC,KACE;EACH,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGP,QAAQ,CAACK,cAAc,CAAC;EAE1D,MAAMG,MAAM,GAAIC,EAAU,KAAM;IAC9BC,SAAS,EAAE,cAAeD,EAAE,EAAG;IAC/BE,OAAO,EAAE,YAAaF,EAAE;EAC1B,CAAC,CAAC;EAEF,oBACEV,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC;EAAU,gBACvBd,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC,aAAa;IAACC,IAAI,EAAC;EAAS,GAEvCV,IAAI,CAACW,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACvB,MAAM;MAAER,EAAE;MAAES;IAAQ,CAAC,GAAGF,GAAG;IAC3B,MAAM;MACJG,IAAI;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAC7B,CAAC,GAAGJ,OAAO;IAEX,MAAM;MAAER,SAAS;MAAEC;IAAQ,CAAC,GAAGH,MAAM,CAACC,EAAE,CAAC;IAEzC,oBACEV,KAAA,CAAAa,aAAA;MAAQW,GAAG,EAAGb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CAAC,CAEA,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Tabs.js","names":["React","useState","renderIcon","NotificationIcon","Tabs","tabs","activeTabIndex","activeTab","setActiveTab","getIds","id","controlId","panelId","createElement","className","role","map","tab","index","control","text","leftIcon","rightIcon","notificationIcon","key","tabIndex","type","onClick","content"],"sources":["../../../../../src/components/design/tabs/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { IconSource, renderIcon } from '../../../helpers/iconHelpers';\nimport NotificationIcon, { NotificationIconProps } from '../icons/notificationIcon/NotificationIcon';\n\nimport './tabs.scss';\n\ninterface TabProps {\n id: string;\n control: {\n text: string;\n leftIcon?: IconSource;\n rightIcon?: IconSource;\n notificationIcon?: NotificationIconProps;\n },\n content: React.ReactNode | React.ReactElement\n}\n\ninterface TabsProps {\n tabs: TabProps[];\n activeTabIndex?: number;\n}\n\nexport const Tabs: React.FC<TabsProps> = (\n {\n tabs,\n activeTabIndex = 0\n }\n) => {\n const [activeTab, setActiveTab] = useState(activeTabIndex);\n\n const getIds = (id: string) => ({\n controlId: `tabControl_${ id }`,\n panelId: `tabPanel_${ id }`\n });\n\n return (\n <div className=\"tabGroup\">\n <div className=\"tabControls\" role=\"tablist\">\n {\n tabs.map((tab, index) => {\n const { id, control } = tab;\n const {\n text, leftIcon, rightIcon, notificationIcon\n } = control;\n\n const { controlId, panelId } = getIds(id);\n\n return (\n <button key={ controlId }\n role=\"tab\"\n id={ controlId }\n aria-controls={ panelId }\n aria-selected={ index === activeTab }\n tabIndex={ index === activeTab ? 0 : -1 }\n type=\"button\"\n onClick={ () => setActiveTab(index) }\n className={ `button tabControl ${ notificationIcon ? 'withNotification' : '' } ${ index === activeTab ? 'active' : '' }` }\n >\n { renderIcon(leftIcon) }\n\n { text }\n\n { renderIcon(rightIcon) }\n\n {\n notificationIcon && <NotificationIcon { ...notificationIcon } />\n }\n </button>\n );\n })\n }\n </div>\n\n <div className=\"tabPanels\">\n {\n tabs.map((tab, index) => {\n const { id, content } = tab;\n\n const { controlId, panelId } = getIds(id);\n\n return (\n <div key={ panelId }\n aria-labelledby={ controlId }\n role=\"tabpanel\"\n tabIndex={ index === activeTab ? 0 : -1 }\n id={ panelId }\n className={ `tabPanel ${ index === activeTab ? 'active' : '' }` }\n >\n { content }\n </div>\n );\n })\n }\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAAqBC,UAAU,QAAQ,8BAA8B;AACrE,OAAOC,gBAAgB,MAAiC,4CAA4C;AAEpG,OAAO,aAAa;AAkBpB,OAAO,MAAMC,IAAyB,GAAGA,CACvC;EACEC,IAAI;EACJC,cAAc,GAAG;AACnB,CAAC,KACE;EACH,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGP,QAAQ,CAACK,cAAc,CAAC;EAE1D,MAAMG,MAAM,GAAIC,EAAU,KAAM;IAC9BC,SAAS,EAAE,cAAeD,EAAE,EAAG;IAC/BE,OAAO,EAAE,YAAaF,EAAE;EAC1B,CAAC,CAAC;EAEF,oBACEV,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC;EAAU,gBACvBd,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC,aAAa;IAACC,IAAI,EAAC;EAAS,GAEvCV,IAAI,CAACW,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACvB,MAAM;MAAER,EAAE;MAAES;IAAQ,CAAC,GAAGF,GAAG;IAC3B,MAAM;MACJG,IAAI;MAAEC,QAAQ;MAAEC,SAAS;MAAEC;IAC7B,CAAC,GAAGJ,OAAO;IAEX,MAAM;MAAER,SAAS;MAAEC;IAAQ,CAAC,GAAGH,MAAM,CAACC,EAAE,CAAC;IAEzC,oBACEV,KAAA,CAAAa,aAAA;MAAQW,GAAG,EAAGb,SAAW;MACvBI,IAAI,EAAC,KAAK;MACVL,EAAE,EAAGC,SAAW;MAChB,iBAAgBC,OAAS;MACzB,iBAAgBM,KAAK,KAAKX,SAAW;MACrCkB,QAAQ,EAAGP,KAAK,KAAKX,SAAS,GAAG,CAAC,GAAG,CAAC,CAAG;MACzCmB,IAAI,EAAC,QAAQ;MACbC,OAAO,EAAGA,CAAA,KAAMnB,YAAY,CAACU,KAAK,CAAG;MACrCJ,SAAS,EAAG,qBAAsBS,gBAAgB,GAAG,kBAAkB,GAAG,EAAE,IAAML,KAAK,KAAKX,SAAS,GAAG,QAAQ,GAAG,EAAE;IAAK,GAExHL,UAAU,CAACmB,QAAQ,CAAC,EAEpBD,IAAI,EAEJlB,UAAU,CAACoB,SAAS,CAAC,EAGrBC,gBAAgB,iBAAIvB,KAAA,CAAAa,aAAA,CAACV,gBAAgB,EAAMoB,gBAAoB,CAE3D,CAAC;EAEb,CAAC,CAEA,CAAC,eAENvB,KAAA,CAAAa,aAAA;IAAKC,SAAS,EAAC;EAAW,GAEtBT,IAAI,CAACW,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IACvB,MAAM;MAAER,EAAE;MAAEkB;IAAQ,CAAC,GAAGX,GAAG;IAE3B,MAAM;MAAEN,SAAS;MAAEC;IAAQ,CAAC,GAAGH,MAAM,CAACC,EAAE,CAAC;IAEzC,oBACEV,KAAA,CAAAa,aAAA;MAAKW,GAAG,EAAGZ,OAAS;MAClB,mBAAkBD,SAAW;MAC7BI,IAAI,EAAC,UAAU;MACfU,QAAQ,EAAGP,KAAK,KAAKX,SAAS,GAAG,CAAC,GAAG,CAAC,CAAG;MACzCG,EAAE,EAAGE,OAAS;MACdE,SAAS,EAAG,YAAaI,KAAK,KAAKX,SAAS,GAAG,QAAQ,GAAG,EAAE;IAAK,GAE/DqB,OACC,CAAC;EAEV,CAAC,CAEA,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -4,7 +4,7 @@ import React, { useContext, useEffect, useRef, useMemo } from 'react';
4
4
  import libraryThemes from '../../../autoGenerated/libraryThemes';
5
5
  import { AppContext } from '../../../contextProviders/appContext/AppContextProvider';
6
6
  import { CURRENT_DOMAIN } from '../../../constants/appEnvironment';
7
- import { LIBRARY_CDN_DEV_BASE_URL, LIBRARY_CDN_PROD_BASE_URL, LIBRARY_VERSION } from '../../../constants';
7
+ import { LIBRARY_CDN_DEV_BASE_URL, LIBRARY_CDN_PROD_BASE_URL, LIBRARY_VERSION } from '../../../constants/libraryCDN';
8
8
  const themes = libraryThemes || {};
9
9
  export const ThemeLoader = ({
10
10
  useMin = false,
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeLoader.js","names":["React","useContext","useEffect","useRef","useMemo","libraryThemes","AppContext","CURRENT_DOMAIN","LIBRARY_CDN_DEV_BASE_URL","LIBRARY_CDN_PROD_BASE_URL","LIBRARY_VERSION","themes","ThemeLoader","useMin","forceProd","forceCacheBusting","userTheme","useLatest","baseCssLink","themeCssLink","appContextProvider","appTheme","appContext","theme","activeTheme","publicLibraryDomain","env","process","NODE_ENV","isProduction","isDevelopment","cdnBaseUrl","getThemeCss","console","warn","buildPath","dev","min","versioned","cssFile","css","cacheBuster","Date","getTime","libraryDomain","baseCss","themeCss","current","href","createElement","Fragment","ref","rel","as"],"sources":["../../../../../src/components/design/themeLoader/ThemeLoader.tsx"],"sourcesContent":["'use client';\n\nimport React, { useContext, useEffect, useRef, useMemo } from 'react';\n\nimport libraryThemes from '../../../autoGenerated/libraryThemes';\nimport { AppContext } from '../../../contextProviders/appContext/AppContextProvider';\nimport { CURRENT_DOMAIN } from '../../../constants/appEnvironment';\nimport { LIBRARY_CDN_DEV_BASE_URL, LIBRARY_CDN_PROD_BASE_URL, LIBRARY_VERSION } from '../../../constants';\n\nexport type ThemeStructure = {\n buildPath: string;\n dev: {\n css: string;\n map: string;\n };\n min: {\n css: string;\n map: string;\n };\n versioned: {\n css: string;\n map: string;\n };\n};\n\ntype AvailableThemes = {\n [themeName: string]: ThemeStructure;\n};\n\ntype themeLoaderProps = {\n useMin?: boolean,\n forceProd?: boolean,\n forceCacheBusting?: boolean,\n userTheme?: string;\n useLatest?: boolean;\n};\n\nconst themes: AvailableThemes = libraryThemes || {};\n\nexport const ThemeLoader: React.FC<themeLoaderProps> = (\n {\n useMin = false,\n forceProd = false,\n forceCacheBusting = false,\n userTheme,\n useLatest = true,\n }\n) => {\n const baseCssLink = useRef<HTMLLinkElement>(null);\n const themeCssLink = useRef<HTMLLinkElement>(null);\n\n const appContextProvider = useContext(AppContext);\n const appTheme = appContextProvider?.appContext?.theme;\n\n const activeTheme = userTheme || appTheme;\n const publicLibraryDomain = appContextProvider?.appContext?.publicLibraryDomain || '';\n\n const env = process.env.NODE_ENV;\n const isProduction = env === 'production' || env === 'prod';\n const isDevelopment = env === 'development' || env === 'dev';\n\n const cdnBaseUrl = `${ isProduction ? LIBRARY_CDN_PROD_BASE_URL : LIBRARY_CDN_DEV_BASE_URL }/${ useLatest ? 'latest' : LIBRARY_VERSION }`;\n\n const getThemeCss = (theme: string | undefined) => {\n if (!theme || !themes[theme]) {\n console.warn(`Theme \"${ theme }\" not found. Using default variables instead.`);\n return null;\n }\n\n const {\n buildPath, dev, min, versioned\n } = themes[theme];\n\n const cssFile = () => {\n if (forceProd) {\n return versioned.css;\n }\n\n if (isProduction) {\n return useMin ? versioned.css : min.css;\n }\n\n if (isDevelopment) {\n return useMin ? min.css : dev.css;\n }\n\n return dev.css;\n };\n\n const cacheBuster = CURRENT_DOMAIN === 'localhost' || forceCacheBusting ? `?v=${ new Date().getTime() }` : '';\n const libraryDomain = publicLibraryDomain !== '' ? `${ publicLibraryDomain }` : cdnBaseUrl;\n\n return `${ libraryDomain }/${ buildPath }/${ cssFile() }${ cacheBuster }`;\n };\n\n const baseCss = useMemo(() => getThemeCss('base'), [activeTheme, useMin, forceProd, forceCacheBusting]);\n const themeCss = useMemo(() => getThemeCss(activeTheme), [activeTheme, useMin, forceProd, forceCacheBusting]);\n\n useEffect(() => {\n if (baseCss && baseCssLink.current) {\n baseCssLink.current.href = baseCss;\n }\n if (themeCss && themeCssLink.current) {\n themeCssLink.current.href = themeCss;\n }\n }, [activeTheme]);\n\n return (\n <>\n <link ref={ baseCssLink } rel=\"stylesheet\" as=\"style\" />\n <link ref={ themeCssLink } rel=\"stylesheet\" as=\"style\" />\n </>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAErE,OAAOC,aAAa,MAAM,sCAAsC;AAChE,SAASC,UAAU,QAAQ,yDAAyD;AACpF,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,wBAAwB,EAAEC,yBAAyB,EAAEC,eAAe,QAAQ,oBAAoB;AA8BzG,MAAMC,MAAuB,GAAGN,aAAa,IAAI,CAAC,CAAC;AAEnD,OAAO,MAAMO,WAAuC,GAAGA,CACrD;EACEC,MAAM,GAAG,KAAK;EACdC,SAAS,GAAG,KAAK;EACjBC,iBAAiB,GAAG,KAAK;EACzBC,SAAS;EACTC,SAAS,GAAG;AACd,CAAC,KACE;EACH,MAAMC,WAAW,GAAGf,MAAM,CAAkB,IAAI,CAAC;EACjD,MAAMgB,YAAY,GAAGhB,MAAM,CAAkB,IAAI,CAAC;EAElD,MAAMiB,kBAAkB,GAAGnB,UAAU,CAACK,UAAU,CAAC;EACjD,MAAMe,QAAQ,GAAGD,kBAAkB,EAAEE,UAAU,EAAEC,KAAK;EAEtD,MAAMC,WAAW,GAAGR,SAAS,IAAIK,QAAQ;EACzC,MAAMI,mBAAmB,GAAGL,kBAAkB,EAAEE,UAAU,EAAEG,mBAAmB,IAAI,EAAE;EAErF,MAAMC,GAAG,GAAGC,OAAO,CAACD,GAAG,CAACE,QAAQ;EAChC,MAAMC,YAAY,GAAGH,GAAG,KAAK,YAAY,IAAIA,GAAG,KAAK,MAAM;EAC3D,MAAMI,aAAa,GAAGJ,GAAG,KAAK,aAAa,IAAIA,GAAG,KAAK,KAAK;EAE5D,MAAMK,UAAU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AAM+B,QAAQ,GAAG1C,OAAO,CAAC,MAAM4B,WAAW,CAACR,WAAW,CAAC,EAAE,CAACA,WAAW,EAAEX,MAAM,EAAEC,SAAS,EAAEC,iBAAiB,CAAC,CAAC;EAE7Gb,SAAS,CAAC,MAAM;IACd,IAAI2C,OAAO,IAAI3B,WAAW,CAAC6B,OAAO,EAAE;MAClC7B,WAAW,CAAC6B,OAAO,CAACC,IAAI,GAAGH,OAAO;IACpC;IACA,IAAIC,QAAQ,IAAI3B,YAAY,CAAC4B,OAAO,EAAE;MACpC5B,YAAY,CAAC4B,OAAO,CAACC,IAAI,GAAGF,QAAQ;IACtC;EACF,CAAC,EAAE,CAACtB,WAAW,CAAC,CAAC;EAEjB,oBACExB,KAAA,CAAAiD,aAAA,CAAAjD,KAAA,CAAAkD,QAAA,qBACElD,KAAA,CAAAiD,aAAA;IAAME,GAAG,EAAGjC,WAAa;IAACkC,GAAG,EAAC,YAAY;IAACC,EAAE,EAAC;EAAO,CAAE,CAAC,eACxDrD,KAAA,CAAAiD,aAAA;IAAME,GAAG,EAAGhC,YAAc;IAACiC,GAAG,EAAC,YAAY;IAACC,EAAE,EAAC;EAAO,CAAE,CACxD,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ThemeLoader.js","names":["React","useContext","useEffect","useRef","useMemo","libraryThemes","AppContext","CURRENT_DOMAIN","LIBRARY_CDN_DEV_BASE_URL","LIBRARY_CDN_PROD_BASE_URL","LIBRARY_VERSION","themes","ThemeLoader","useMin","forceProd","forceCacheBusting","userTheme","useLatest","baseCssLink","themeCssLink","appContextProvider","appTheme","appContext","theme","activeTheme","publicLibraryDomain","env","process","NODE_ENV","isProduction","isDevelopment","cdnBaseUrl","getThemeCss","console","warn","buildPath","dev","min","versioned","cssFile","css","cacheBuster","Date","getTime","libraryDomain","baseCss","themeCss","current","href","createElement","Fragment","ref","rel","as"],"sources":["../../../../../src/components/design/themeLoader/ThemeLoader.tsx"],"sourcesContent":["'use client';\n\nimport React, { useContext, useEffect, useRef, useMemo } from 'react';\n\nimport libraryThemes from '../../../autoGenerated/libraryThemes';\nimport { AppContext } from '../../../contextProviders/appContext/AppContextProvider';\nimport { CURRENT_DOMAIN } from '../../../constants/appEnvironment';\nimport { LIBRARY_CDN_DEV_BASE_URL, LIBRARY_CDN_PROD_BASE_URL, LIBRARY_VERSION } from '../../../constants/libraryCDN';\n\nexport type ThemeStructure = {\n buildPath: string;\n dev: {\n css: string;\n map: string;\n };\n min: {\n css: string;\n map: string;\n };\n versioned: {\n css: string;\n map: string;\n };\n};\n\ntype AvailableThemes = {\n [themeName: string]: ThemeStructure;\n};\n\ntype themeLoaderProps = {\n useMin?: boolean,\n forceProd?: boolean,\n forceCacheBusting?: boolean,\n userTheme?: string;\n useLatest?: boolean;\n};\n\nconst themes: AvailableThemes = libraryThemes || {};\n\nexport const ThemeLoader: React.FC<themeLoaderProps> = (\n {\n useMin = false,\n forceProd = false,\n forceCacheBusting = false,\n userTheme,\n useLatest = true,\n }\n) => {\n const baseCssLink = useRef<HTMLLinkElement>(null);\n const themeCssLink = useRef<HTMLLinkElement>(null);\n\n const appContextProvider = useContext(AppContext);\n const appTheme = appContextProvider?.appContext?.theme;\n\n const activeTheme = userTheme || appTheme;\n const publicLibraryDomain = appContextProvider?.appContext?.publicLibraryDomain || '';\n\n const env = process.env.NODE_ENV;\n const isProduction = env === 'production' || env === 'prod';\n const isDevelopment = env === 'development' || env === 'dev';\n\n const cdnBaseUrl = `${ isProduction ? LIBRARY_CDN_PROD_BASE_URL : LIBRARY_CDN_DEV_BASE_URL }/${ useLatest ? 'latest' : LIBRARY_VERSION }`;\n\n const getThemeCss = (theme: string | undefined) => {\n if (!theme || !themes[theme]) {\n console.warn(`Theme \"${ theme }\" not found. Using default variables instead.`);\n return null;\n }\n\n const {\n buildPath, dev, min, versioned\n } = themes[theme];\n\n const cssFile = () => {\n if (forceProd) {\n return versioned.css;\n }\n\n if (isProduction) {\n return useMin ? versioned.css : min.css;\n }\n\n if (isDevelopment) {\n return useMin ? min.css : dev.css;\n }\n\n return dev.css;\n };\n\n const cacheBuster = CURRENT_DOMAIN === 'localhost' || forceCacheBusting ? `?v=${ new Date().getTime() }` : '';\n const libraryDomain = publicLibraryDomain !== '' ? `${ publicLibraryDomain }` : cdnBaseUrl;\n\n return `${ libraryDomain }/${ buildPath }/${ cssFile() }${ cacheBuster }`;\n };\n\n const baseCss = useMemo(() => getThemeCss('base'), [activeTheme, useMin, forceProd, forceCacheBusting]);\n const themeCss = useMemo(() => getThemeCss(activeTheme), [activeTheme, useMin, forceProd, forceCacheBusting]);\n\n useEffect(() => {\n if (baseCss && baseCssLink.current) {\n baseCssLink.current.href = baseCss;\n }\n if (themeCss && themeCssLink.current) {\n themeCssLink.current.href = themeCss;\n }\n }, [activeTheme]);\n\n return (\n <>\n <link ref={ baseCssLink } rel=\"stylesheet\" as=\"style\" />\n <link ref={ themeCssLink } rel=\"stylesheet\" as=\"style\" />\n </>\n );\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAErE,OAAOC,aAAa,MAAM,sCAAsC;AAChE,SAASC,UAAU,QAAQ,yDAAyD;AACpF,SAASC,cAAc,QAAQ,mCAAmC;AAClE,SAASC,wBAAwB,EAAEC,yBAAyB,EAAEC,eAAe,QAAQ,+BAA+B;AA8BpH,MAAMC,MAAuB,GAAGN,aAAa,IAAI,CAAC,CAAC;AAEnD,OAAO,MAAMO,WAAuC,GAAGA,CACrD;EACEC,MAAM,GAAG,KAAK;EACdC,SAAS,GAAG,KAAK;EACjBC,iBAAiB,GAAG,KAAK;EACzBC,SAAS;EACTC,SAAS,GAAG;AACd,CAAC,KACE;EACH,MAAMC,WAAW,GAAGf,MAAM,CAAkB,IAAI,CAAC;EACjD,MAAMgB,YAAY,GAAGhB,MAAM,CAAkB,IAAI,CAAC;EAElD,MAAMiB,kBAAkB,GA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ends from "@babel/runtime/helpers/extends";
4
4
  import React, { useState, useRef, useEffect, useCallback } from 'react';
5
5
  import { useOnClickOutside } from '../../../hooks/ClickOutside';
6
- import { Icon } from '../icons/basicIcon/Icon';
6
+ import { renderIcon } from '../../../helpers/iconHelpers';
7
7
  import { useOnEdgeProximityDetect } from '../../../hooks/EdgeProximityDetect';
8
+ import { useOnInteractiveHostFocus } from '../../../hooks/InteractiveHostFocus';
8
9
  import './tooltip.css';
9
10
 
10
11
  // Define the props for Tooltip
11
12
 
13
+ export const getTooltipContentId = triggerId => `${triggerId}_content`;
12
14
  export const Tooltip = props => {
13
15
  const {
14
16
  triggerId,
@@ -19,7 +21,8 @@ export const Tooltip = props => {
19
21
  children,
20
22
  label = 'Toggle tooltip open state',
21
23
  showPointer = true,
22
- hoverDelay
24
+ hoverDelay,
25
+ passiveTrigger = false
23
26
  // visualIndicators will be handled below
24
27
  } = props;
25
28
 
@@ -34,7 +37,6 @@ export const Tooltip = props => {
34
37
  const triggerElement = useRef(null);
35
38
  const contentElement = useRef(null);
36
39
  const hoverTimer = useRef(null);
37
- const iconIsElement = /*#__PURE__*/React.isValidElement(icon);
38
40
 
39
41
  // Hover is handled in css by default. It is only taken over by js when a delay is requested.
40
42
  const hasHoverDelay = typeof hoverDelay === 'number' && hoverDelay > 0;
@@ -81,7 +83,13 @@ export const Tooltip = props => {
81
83
  onMouseEnter: handleMouseEnter,
82
84
  onMouseLeave: handleMouseLeave
83
85
  } : {};
84
- useOnClickOutside(tooltipElement, dismiss);
86
+
87
+ // Passive mode closes on host blur; focusin on the host would otherwise count as "outside".
88
+ useOnClickOutside(tooltipElement, () => {
89
+ if (!passiveTrigger) {
90
+ dismiss();
91
+ }
92
+ });
85
93
  useOnEdgeProximityDetect({
86
94
  triggerRef: triggerElement,
87
95
  wrapperRef: tooltipElement,
@@ -97,12 +105,37 @@ export const Tooltip = props => {
97
105
  }, [dismiss]);
98
106
  useEffect(() => {
99
107
  const wrapper = tooltipElement.current;
100
- if (!wrapper) {
108
+ if (!wrapper || passiveTrigger) {
101
109
  return undefined;
102
110
  }
103
111
  wrapper.addEventListener('keydown', handleSpecialKeyPresses);
104
112
  return () => wrapper.removeEventListener('keydown', handleSpecialKeyPresses);
105
- }, [handleSpecialKeyPresses]);
113
+ }, [handleSpecialKeyPresses, passiveTrigger]);
114
+
115
+ // Passive triggers can't take focus, so open/close follows focus of the interactive host instead.
116
+ const {
117
+ isDismissed
118
+ } = useOnInteractiveHostFocus({
119
+ wrapperRef: tooltipElement,
120
+ setIsOpen,
121
+ enabled: passiveTrigger
122
+ });
123
+ const triggerIcon = renderIcon(icon);
124
+ if (passiveTrigger) {
125
+ return /*#__PURE__*/React.createElement("span", {
126
+ ref: tooltipElement,
127
+ className: `tooltip passive ${isOpen ? 'isOpen' : ''} ${isDismissed ? 'isDismissed' : ''} ${customCssClass || ''}`
128
+ }, /*#__PURE__*/React.createElement("span", {
129
+ ref: triggerElement,
130
+ className: "icon_only",
131
+ "aria-hidden": "true"
132
+ }, triggerIcon), /*#__PURE__*/React.createElement("span", {
133
+ role: "tooltip",
134
+ ref: contentElement,
135
+ className: `content ${showPointer ? 'showPointer' : ''}`,
136
+ id: getTooltipContentId(triggerId)
137
+ }, children));
138
+ }
106
139
  if (containsBlockElements) {
107
140
  return /*#__PURE__*/React.createElement("div", _extends({
108
141
  role: "tooltip",
@@ -118,9 +151,7 @@ export const Tooltip = props => {
118
151
  'aria-describedby': `${triggerId}_content`
119
152
  } : {}, triggerStyle === 'icon' ? {
120
153
  'aria-label': typeof label === 'string' ? label : undefined
121
- } : {}), triggerStyle === 'icon' && (iconIsElement ? icon : /*#__PURE__*/React.createElement(Icon, {
122
- icon: icon.toString()
123
- })), triggerStyle === 'text' && /*#__PURE__*/React.createElement("span", {
154
+ } : {}), triggerStyle === 'icon' && triggerIcon, triggerStyle === 'text' && /*#__PURE__*/React.createElement("span", {
124
155
  className: "labelText"
125
156
  }, label)), /*#__PURE__*/React.createElement("div", _extends({
126
157
  ref: contentElement,
@@ -141,9 +172,7 @@ export const Tooltip = props => {
141
172
  id: triggerId
142
173
  } : {}, triggerStyle === 'icon' ? {
143
174
  'aria-label': typeof label === 'string' ? label : undefined
144
- } : {}), triggerStyle === 'icon' && (iconIsElement ? icon : /*#__PURE__*/React.createElement(Icon, {
145
- icon: icon.toString()
146
- })), triggerStyle === 'text' && /*#__PURE__*/React.createElement("span", {
175
+ } : {}), triggerStyle === 'icon' && triggerIcon, triggerStyle === 'text' && /*#__PURE__*/React.createElement("span", {
147
176
  className: "labelText"
148
177
  }, label)), /*#__PURE__*/React.createElement("span", _extends({
149
178
  "aria-hidden": true,
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","names":["_extends","React","useState","useRef","useEffect","useCallback","useOnClickOutside","Icon","useOnEdgeProximityDetect","Tooltip","props","triggerId","triggerStyle","icon","customCssClass","containsBlockElements","children","label","showPointer","hoverDelay","visualIndicators","underline","colouredText","undefined","isOpen","setIsOpen","isHovered","setIsHovered","tooltipElement","triggerElement","contentElement","hoverTimer","iconIsElement","isValidElement","hasHoverDelay","isVisible","clearHoverTimer","current","clearTimeout","handleMouseEnter","setTimeout","handleMouseLeave","dismiss","handleTriggerClick","hoverHandlers","onMouseEnter","onMouseLeave","triggerRef","wrapperRef","contentRef","requiresRecalc","handleSpecialKeyPresses","event","key","keyCode","wrapper","addEventListener","removeEventListener","createElement","role","ref","className","type","onClick","toString","id"],"sources":["../../../../../src/components/design/tooltip/Tooltip.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState, useRef, useEffect, useCallback, ReactNode, ReactElement } from 'react';\nimport { useOnClickOutside } from '../../../hooks/ClickOutside';\nimport { Icon } from '../icons/basicIcon/Icon';\nimport { useOnEdgeProximityDetect } from '../../../hooks/EdgeProximityDetect';\nimport './tooltip.scss';\n\n// Define the props for Tooltip\nexport type TooltipProps =\n {\n triggerId?: string;\n icon?: ReactElement | string;\n customCssClass?: string;\n children: ReactNode;\n containsBlockElements?: boolean;\n triggerStyle?: 'icon';\n label?: string | ReactNode;\n showPointer?: boolean;\n hoverDelay?: number;\n }\n | {\n triggerId?: string;\n icon?: ReactElement | string;\n customCssClass?: string;\n children: ReactNode;\n containsBlockElements?: boolean;\n triggerStyle: 'text';\n label?: string | ReactNode;\n showPointer?: boolean;\n hoverDelay?: number;\n visualIndicators?: { underline?: boolean; colouredText?: boolean };\n };\n\nexport const Tooltip: React.FC<TooltipProps> = (props) => {\n const {\n triggerId,\n triggerStyle = 'icon',\n icon = 'info',\n customCssClass,\n containsBlockElements = false,\n children,\n label = 'Toggle tooltip open state',\n showPointer = true,\n hoverDelay,\n // visualIndicators will be handled below\n } = props as any;\n\n // Only use visualIndicators if triggerStyle is 'text'\n const visualIndicators =\n triggerStyle === 'text'\n ? (props as { visualIndicators?: { underline?: boolean; colouredText?: boolean } }).visualIndicators ?? { underline: true, colouredText: true }\n : undefined;\n const [isOpen, setIsOpen] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const tooltipElement = useRef<HTMLDivElement | HTMLSpanElement>(null);\n const triggerElement = useRef<HTMLButtonElement>(null);\n const contentElement = useRef<HTMLDivElement | HTMLSpanElement>(null);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const iconIsElement = React.isValidElement(icon);\n\n // Hover is handled in css by default. It is only taken over by js when a delay is requested.\n const hasHoverDelay = typeof hoverDelay === 'number' && hoverDelay > 0;\n const isVisible = isOpen || isHovered;\n\n const clearHoverTimer = useCallback(() => {\n if (hoverTimer.current) {\n clearTimeout(hoverTimer.current);\n hoverTimer.current = null;\n }\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n clearHoverTimer();\n hoverTimer.current = setTimeout(() => setIsHovered(true), hoverDelay);\n }, [clearHoverTimer, hoverDelay]);\n\n const handleMouseLeave = useCallback(() => {\n clearHoverTimer();\n setIsHovered(false);\n }, [clearHoverTimer]);\n\n // Single dismissal path, so every close route clears both the click and hover state\n const dismiss = useCallback(() => {\n clearHoverTimer();\n setIsHovered(false);\n setIsOpen(false);\n }, [clearHoverTimer]);\n\n const handleTriggerClick = useCallback(() => {\n if (isVisible) {\n dismiss();\n return;\n }\n clearHoverTimer();\n setIsOpen(true);\n }, [isVisible, dismiss, clearHoverTimer]);\n\n // Releasing the delay detaches the mouse handlers, so reset any hover state they left behind\n useEffect(() => {\n if (!hasHoverDelay) {\n clearHoverTimer();\n setIsHovered(false);\n }\n }, [hasHoverDelay, clearHoverTimer]);\n\n useEffect(() => clearHoverTimer, [clearHoverTimer]);\n\n const hoverHandlers = hasHoverDelay\n ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }\n : {};\n\n useOnClickOutside(tooltipElement, dismiss);\n\n useOnEdgeProximityDetect({\n triggerRef: triggerElement,\n wrapperRef: tooltipElement,\n contentRef: contentElement,\n requiresRecalc: isVisible,\n });\n\n // Handle special key presses\n const handleSpecialKeyPresses = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape' || event.keyCode === 27) {\n dismiss();\n }\n },\n [dismiss],\n );\n\n useEffect(() => {\n const wrapper = tooltipElement.current;\n if (!wrapper) {\n return undefined;\n }\n wrapper.addEventListener('keydown', handleSpecialKeyPresses as EventListener);\n return () => wrapper.removeEventListener('keydown', handleSpecialKeyPresses as EventListener);\n }, [handleSpecialKeyPresses]);\n\n if (containsBlockElements) {\n return (\n <div\n role=\"tooltip\"\n ref={ tooltipElement as React.RefObject<HTMLDivElement> }\n className={ `tooltip tooltip_block ${ isVisible ? 'isOpen' : '' } ${ hasHoverDelay ? 'hoverDelayed' : '' } ${ triggerStyle === 'text' ? 'textDisplay' : '' } ${ customCssClass || '' }` }\n { ...hoverHandlers }\n >\n <button\n ref={ triggerElement }\n type=\"button\"\n onClick={ handleTriggerClick }\n className={ `button ${ triggerStyle === 'text' ? 'text_only' : 'icon_only' } ${ triggerStyle === 'text' && !visualIndicators?.underline ? 'underline_off' : '' } ${ triggerStyle === 'text' && !visualIndicators?.colouredText ? 'colouredText_off' : '' }` }\n { ...(triggerId ? { 'id': triggerId, 'aria-describedby': `${ triggerId }_content` } : {}) }\n { ...(triggerStyle === 'icon' ? { 'aria-label': typeof label === 'string' ? label : undefined } : {}) }\n >\n { triggerStyle === 'icon' && (iconIsElement ? icon : <Icon icon={ icon.toString() } />) }\n { triggerStyle === 'text' && <span className=\"labelText\">{ label }</span> }\n </button>\n <div\n ref={ contentElement as React.RefObject<HTMLDivElement> }\n className={ `content ${ showPointer ? 'showPointer' : '' }` }\n { ...(triggerId ? { id: `${ triggerId }_content` } : {}) }\n >\n { children }\n </div>\n </div>\n );\n }\n\n return (\n <span\n ref={ tooltipElement as React.RefObject<HTMLSpanElement> }\n className={ `tooltip ${ isVisible ? 'isOpen' : '' } ${ hasHoverDelay ? 'hoverDelayed' : '' } ${ triggerStyle === 'text' ? 'textDisplay' : '' } ${ customCssClass || '' }` }\n { ...hoverHandlers }\n >\n <button\n ref={ triggerElement }\n type=\"button\"\n onClick={ handleTriggerClick }\n className={ `button ${ triggerStyle === 'text' ? 'text_only' : 'icon_only' } ${ triggerStyle === 'text' && !visualIndicators?.underline ? 'underline_off' : '' } ${ triggerStyle === 'text' && !visualIndicators?.colouredText ? 'colouredText_off' : '' }` }\n { ...(triggerId ? { id: triggerId } : {}) }\n { ...(triggerStyle === 'icon' ? { 'aria-label': typeof label === 'string' ? label : undefined } : {}) }\n >\n { triggerStyle === 'icon' && (iconIsElement ? icon : <Icon icon={ icon.toString() } />) }\n { triggerStyle === 'text' && <span className=\"labelText\">{ label }</span> }\n </button>\n <span\n aria-hidden\n role=\"presentation\"\n ref={ contentElement as React.RefObject<HTMLSpanElement> }\n className={ `content ${ showPointer ? 'showPointer' : '' }` }\n { ...(triggerId ? { id: `${ triggerId }_content` } : {}) }\n >\n { children }\n </span>\n </span>\n );\n};\n\nexport default Tooltip;\n"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;AAEb,OAAOC,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,EAAE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+ {"version":3,"file":"Tooltip.js","names":["_extends","React","useState","useRef","useEffect","useCallback","useOnClickOutside","renderIcon","useOnEdgeProximityDetect","useOnInteractiveHostFocus","getTooltipContentId","triggerId","Tooltip","props","triggerStyle","icon","customCssClass","containsBlockElements","children","label","showPointer","hoverDelay","passiveTrigger","visualIndicators","underline","colouredText","undefined","isOpen","setIsOpen","isHovered","setIsHovered","tooltipElement","triggerElement","contentElement","hoverTimer","hasHoverDelay","isVisible","clearHoverTimer","current","clearTimeout","handleMouseEnter","setTimeout","handleMouseLeave","dismiss","handleTriggerClick","hoverHandlers","onMouseEnter","onMouseLeave","triggerRef","wrapperRef","contentRef","requiresRecalc","handleSpecialKeyPresses","event","key","keyCode","wrapper","addEventListener","removeEventListener","isDismissed","enabled","triggerIcon","createElement","ref","className","role","id","type","onClick"],"sources":["../../../../../src/components/design/tooltip/Tooltip.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState, useRef, useEffect, useCallback, ReactNode } from 'react';\nimport { useOnClickOutside } from '../../../hooks/ClickOutside';\nimport { IconSource, renderIcon } from '../../../helpers/iconHelpers';\nimport { useOnEdgeProximityDetect } from '../../../hooks/EdgeProximityDetect';\nimport { useOnInteractiveHostFocus } from '../../../hooks/InteractiveHostFocus';\nimport './tooltip.scss';\n\n// Define the props for Tooltip\nexport type TooltipProps =\n {\n triggerId?: string;\n icon?: IconSource;\n customCssClass?: string;\n children: ReactNode;\n containsBlockElements?: boolean;\n triggerStyle?: 'icon';\n label?: string | ReactNode;\n showPointer?: boolean;\n hoverDelay?: number;\n passiveTrigger?: false;\n }\n | {\n /**\n * Renders a non-focusable trigger for use inside another interactive element (e.g. a button).\n */\n passiveTrigger: true;\n triggerId: string;\n icon?: IconSource;\n customCssClass?: string;\n children: ReactNode;\n showPointer?: boolean;\n }\n | {\n triggerId?: string;\n icon?: IconSource;\n customCssClass?: string;\n children: ReactNode;\n containsBlockElements?: boolean;\n triggerStyle: 'text';\n label?: string | ReactNode;\n showPointer?: boolean;\n hoverDelay?: number;\n visualIndicators?: { underline?: boolean; colouredText?: boolean };\n passiveTrigger?: false;\n };\n\nexport const getTooltipContentId = (triggerId: string) => `${ triggerId }_content`;\n\nexport const Tooltip: React.FC<TooltipProps> = (props) => {\n const {\n triggerId,\n triggerStyle = 'icon',\n icon = 'info',\n customCssClass,\n containsBlockElements = false,\n children,\n label = 'Toggle tooltip open state',\n showPointer = true,\n hoverDelay,\n passiveTrigger = false,\n // visualIndicators will be handled below\n } = props as any;\n\n // Only use visualIndicators if triggerStyle is 'text'\n const visualIndicators =\n triggerStyle === 'text'\n ? (props as { visualIndicators?: { underline?: boolean; colouredText?: boolean } }).visualIndicators ?? { underline: true, colouredText: true }\n : undefined;\n const [isOpen, setIsOpen] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const tooltipElement = useRef<HTMLDivElement | HTMLSpanElement>(null);\n const triggerElement = useRef<HTMLButtonElement | HTMLSpanElement>(null);\n const contentElement = useRef<HTMLDivElement | HTMLSpanElement>(null);\n const hoverTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n // Hover is handled in css by default. It is only taken over by js when a delay is requested.\n const hasHoverDelay = typeof hoverDelay === 'number' && hoverDelay > 0;\n const isVisible = isOpen || isHovered;\n\n const clearHoverTimer = useCallback(() => {\n if (hoverTimer.current) {\n clearTimeout(hoverTimer.current);\n hoverTimer.current = null;\n }\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n clearHoverTimer();\n hoverTimer.current = setTimeout(() => setIsHovered(true), hoverDelay);\n }, [clearHoverTimer, hoverDelay]);\n\n const handleMouseLeave = useCallback(() => {\n clearHoverTimer();\n setIsHovered(false);\n }, [clearHoverTimer]);\n\n // Single dismissal path, so every close route clears both the click and hover state\n const dismiss = useCallback(() => {\n clearHoverTimer();\n setIsHovered(false);\n setIsOpen(false);\n }, [clearHoverTimer]);\n\n const handleTriggerClick = useCallback(() => {\n if (isVisible) {\n dismiss();\n return;\n }\n clearHoverTimer();\n setIsOpen(true);\n }, [isVisible, dismiss, clearHoverTimer]);\n\n // Releasing the delay detaches the mouse handlers, so reset any hover state they left behind\n useEffect(() => {\n if (!hasHoverDelay) {\n clearHoverTimer();\n setIsHovered(false);\n }\n }, [hasHoverDelay, clearHoverTimer]);\n\n useEffect(() => clearHoverTimer, [clearHoverTimer]);\n\n const hoverHandlers = hasHoverDelay\n ? { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }\n : {};\n\n // Passive mode closes on host blur; focusin on the host would otherwise count as \"outside\".\n useOnClickOutside(tooltipElement, () => {\n if (!passiveTrigger) {\n dismiss();\n }\n });\n\n useOnEdgeProximityDetect({\n triggerRef: triggerElement,\n wrapperRef: tooltipElement,\n contentRef: contentElement,\n requiresRecalc: isVisible,\n });\n\n // Handle special key presses\n const handleSpecialKeyPresses = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Escape' || event.keyCode === 27) {\n dismiss();\n }\n },\n [dismiss],\n );\n\n useEffect(() => {\n const wrapper = tooltipElement.current;\n if (!wrapper || passiveTrigger) {\n return undefined;\n }\n wrapper.addEventListener('keydown', handleSpecialKeyPresses as EventListener);\n return () => wrapper.removeEventListener('keydown', handleSpecialKeyPresses as EventListener);\n }, [handleSpecialKeyPresses, passiveTrigger]);\n\n // Passive triggers can't take focus, so open/close follows focus of the interactive host instead.\n const { isDismissed } = useOnInteractiveHostFocus({\n wrapperRef: tooltipElement,\n setIsOpen,\n enabled: passiveTrigger,\n });\n\n const triggerIcon = renderIcon(icon);\n\n if (passiveTrigger) {\n return (\n <span\n ref={ tooltipElement as React.RefObject<HTMLSpanElement> }\n className={ `tooltip passive ${ isOpen ? 'isOpen' : '' } ${ isDismissed ? 'isDismissed' : '' } ${ customCssClass || '' }` }\n >\n <span\n ref={ triggerElement as React.RefObject<HTMLSpanElement> }\n className=\"icon_only\"\n aria-hidden=\"true\"\n >\n { triggerIcon }\n </span>\n <span\n role=\"tooltip\"\n ref={ contentElement as React.RefObject<HTMLSpanElement> }\n className={ `content ${ showPointer ? 'showPointer' : '' }` }\n id={ getTooltipContentId(triggerId) }\n >\n { children }\n </span>\n </span>\n );\n }\n\n if (containsBlockElements) {\n return (\n <div\n role=\"tooltip\"\n ref={ tooltipElement as React.RefObject<HTMLDivElement> }\n className={ `tooltip tooltip_block ${ isVisible ? 'isOpen' : '' } ${ hasHoverDelay ? 'hoverDelayed' : '' } ${ triggerStyle === 'text' ? 'textDisplay' : '' } ${ customCssClass || '' }` }\n { ...hoverHandlers }\n >\n <button\n ref={ triggerElement as React.RefObject<HTMLButtonElement> }\n type=\"button\"\n onClick={ handleTriggerClick }\n className={ `button ${ triggerStyle === 'text' ? 'text_only' : 'icon_only' } ${ triggerStyle === 'text' && !visualIndicators?.underline ? 'underline_off' : '' } ${ triggerStyle === 'text' && !visualIndicators?.colouredText ? 'colouredText_off' : '' }` }\n { ...(triggerId ? { 'id': triggerId, 'aria-describedby': `${ triggerId }_content` } : {}) }\n { ...(triggerStyle === 'icon' ? { 'aria-label': typeof label === 'string' ? label : undefined } : {}) }\n >\n { triggerStyle === 'icon' && triggerIcon }\n { triggerStyle === 'text' && <span className=\"labelText\">{ label }</span> }\n </button>\n <div\n ref={ contentElement as React.RefObject<HTMLDivElement> }\n className={ `content ${ showPointer ? 'showPointer' : '' }` }\n { ...(triggerId ? { id: `${ triggerId }_content` } : {}) }\n >\n { children }\n </div>\n </div>\n );\n }\n\n return (\n <span\n ref={ tooltipElement as React.RefObject<HTMLSpanElement> }\n className={ `tooltip ${ isVisible ? 'isOpen' : '' } ${ hasHoverDelay ? 'hoverDelayed' : '' } ${ triggerStyle === 'text' ? 'textDisplay' : '' } ${ customCssClass || '' }` }\n { ...hoverHandlers }\n >\n <button\n ref={ triggerElement as React.RefObject<HTMLButtonElement> }\n type=\"button\"\n onClick={ handleTriggerClick }\n className={ `button ${ triggerStyle === 'text' ? 'text_only' : 'icon_only' } ${ triggerStyle === 'text' && !visualIndicators?.underline ? 'underline_off' : '' } ${ triggerStyle === 'text' && !visualIndicators?.colouredText ? 'colouredText_off' : '' }` }\n { ...(triggerId ? { id: triggerId } : {}) }\n { ...(triggerStyle === 'icon' ? { 'aria-label': typeof label === 'string' ? label : undefined } : {}) }\n >\n { triggerStyle === 'icon' && triggerIcon }\n { triggerStyle === 'text' && <span className=\"labelText\">{ label }</span> }\n </button>\n <span\n aria-hidden\n role=\"presentation\"\n ref={ contentElement as React.RefObject<HTMLSpanElement> }\n className={ `content ${ showPointer ? 'showPointer' : '' }` }\n { ...(triggerId ? { id: `${ triggerId }_content` } : {}) }\n >\n { children }\n </span>\n </span>\n );\n};\n\nexport default Tooltip;\n"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;AAEb,OAAOC,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,EAAEC,WAAW,QAAmB,OAAO;AAClF,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,SAAqBC,UAAU,QAAQ,8BAA8B;AACrE,SAASC,wBAAwB,QAAQ,oCAAoC;AAC7E,SAASC,yBAAyB,QAAQ,qCAAqC;AAC/E,OAAO,gBAAgB;;AAEvB;;AAuCA,OAAO,MAAMC,mBAAmB,GAAIC,SAAiB,IAAK,GAAIA,SAAS,UAAW;AAElF,OAAO,MAAMC,OAA+B,GAAIC,KAAK,IAAK;EACxD,MAAM;IACJF,SAAS;IACTG,YAAY,GAAG,MAAM;IACrBC,IAAI,GAAG,MAAM;IACbC,cAAc;IACdC,qBAAqB,GAAG,KAAK;IAC7BC,QAAQ;IACRC,KAAK,GAAG,2BAA2B;IACnCC,WAAW,GAAG,IAAI;IAClBC,UAAU;IACVC,cAAc,GAAG;IACjB;EACF,CAAC,GAAGT,KAAY;;EAEhB;EACA,MAAMU,gBAAgB,GACpBT,YAAY,KAAK,MAAM,GAClBD,KAAK,CAA4EU,gBAAgB,IAAI;IAAEC,SAAS,EAAE,IAAI;IAAEC,YAAY,EAAE;EAAK,CAAC,GAC7IC,SAAS;EACf,MAAM,CAACC,MAAM,EAA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getTooltipContentId } from './Tooltip';
2
2
  export { EllipsisTooltip } from './ellipsisTooltip/EllipsisTooltip';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Tooltip","EllipsisTooltip"],"sources":["../../../../../src/components/design/tooltip/index.ts"],"sourcesContent":["export { Tooltip } from './Tooltip';\nexport type { TooltipProps } from './Tooltip';\n\nexport { EllipsisTooltip } from './ellipsisTooltip/EllipsisTooltip';\nexport type { EllipsisTooltipProps } from './ellipsisTooltip/EllipsisTooltip';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,WAAW;AAGnC,SAASC,eAAe,QAAQ,mCAAmC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Tooltip","getTooltipContentId","EllipsisTooltip"],"sources":["../../../../../src/components/design/tooltip/index.ts"],"sourcesContent":["export { Tooltip, getTooltipContentId } from './Tooltip';\nexport type { TooltipProps } from './Tooltip';\n\nexport { EllipsisTooltip } from './ellipsisTooltip/EllipsisTooltip';\nexport type { EllipsisTooltipProps } from './ellipsisTooltip/EllipsisTooltip';\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,mBAAmB,QAAQ,WAAW;AAGxD,SAASC,eAAe,QAAQ,mCAAmC","ignoreList":[]}
@@ -6,7 +6,8 @@
6
6
  height: 1em;
7
7
  margin: var(--tooltipMargin, 0 5px);
8
8
  }
9
- .tooltip > button.icon_only {
9
+ .tooltip > button.icon_only,
10
+ .tooltip > span.icon_only {
10
11
  background: none;
11
12
  border: none;
12
13
  border-radius: 100%;
@@ -20,12 +21,15 @@
20
21
  left: 0;
21
22
  top: -2px;
22
23
  }
23
- .tooltip > button.icon_only:hover {
24
+ .tooltip > button.icon_only:hover,
25
+ .tooltip > span.icon_only:hover {
24
26
  border: none;
25
27
  background: none;
26
28
  }
27
29
  .tooltip > button.icon_only .icon,
28
- .tooltip > button.icon_only svg[data-icon] {
30
+ .tooltip > button.icon_only svg[data-icon],
31
+ .tooltip > span.icon_only .icon,
32
+ .tooltip > span.icon_only svg[data-icon] {
29
33
  text-align: center;
30
34
  height: var(--tooltipIconSize, 22px);
31
35
  width: var(--tooltipIconSize, 22px);
@@ -34,26 +38,30 @@
34
38
  align-items: center;
35
39
  justify-content: center;
36
40
  }
37
- .tooltip > button.icon_only svg[data-icon] {
41
+ .tooltip > button.icon_only svg[data-icon],
42
+ .tooltip > span.icon_only svg[data-icon] {
38
43
  height: var(--tooltipSvgIconSize, 22px);
39
44
  width: var(--tooltipSvgIconSize, 22px);
40
45
  line-height: var(--tooltipSvgIconSize, 22px);
41
46
  }
42
- .tooltip > button.icon_only .icon {
47
+ .tooltip > button.icon_only .icon,
48
+ .tooltip > span.icon_only .icon {
43
49
  color: var(--tooltipIconFgColor, #222);
44
50
  background: var(--tooltipIconBg, #c2d0d9);
45
51
  border-radius: 100%;
46
52
  border: var(--tooltipIconBorder, none);
47
53
  line-height: normal;
48
54
  }
49
- .tooltip > button.icon_only .icon.icon-info:before {
55
+ .tooltip > button.icon_only .icon.icon-info:before,
56
+ .tooltip > span.icon_only .icon.icon-info:before {
50
57
  content: "i";
51
58
  color: var(--tooltipIconFgColor, #222);
52
59
  font-style: normal;
53
60
  font-size: calc(var(--tooltipIconSize, 22px) - 4px);
54
61
  font-weight: bold;
55
62
  }
56
- .tooltip > button.icon_only svg[data-icon] {
63
+ .tooltip > button.icon_only svg[data-icon],
64
+ .tooltip > span.icon_only svg[data-icon] {
57
65
  color: var(--tooltipIconBg, #c2d0d9);
58
66
  }
59
67
  .tooltip > button.text_only {
@@ -96,6 +104,9 @@
96
104
  .tooltip:not(.hoverDelayed):hover .content, .tooltip.isOpen .content {
97
105
  display: block;
98
106
  }
107
+ .tooltip.isDismissed .content {
108
+ display: none;
109
+ }
99
110
  .tooltip.measuring .content {
100
111
  opacity: 1;
101
112
  display: block;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import React, { useMemo, forwardRef } from 'react';
5
- import { Icon } from '../../design/icons/basicIcon/Icon';
5
+ import { renderIcon } from '../../../helpers/iconHelpers';
6
6
  import { generateButtonClass } from './button.helpers';
7
7
  export const SimpleButton = /*#__PURE__*/forwardRef(({
8
8
  buttonType = 'button',
@@ -45,9 +45,9 @@ export const SimpleButton = /*#__PURE__*/forwardRef(({
45
45
  disabled: disabled
46
46
  }, disabled && {
47
47
  'aria-describedby': disabledMessageId
48
- }), leftIcon && /*#__PURE__*/React.createElement(Icon, leftIcon), /*#__PURE__*/React.createElement("span", {
48
+ }), renderIcon(leftIcon), /*#__PURE__*/React.createElement("span", {
49
49
  className: `${hideLabel ? 'sr-only' : 'labelText'}`
50
- }, label), children, rightIcon && /*#__PURE__*/React.createElement(Icon, rightIcon)), disabled && /*#__PURE__*/React.createElement("span", {
50
+ }, label), children, renderIcon(rightIcon)), disabled && /*#__PURE__*/React.createElement("span", {
51
51
  id: disabledMessageId,
52
52
  className: "sr-only"
53
53
  }, disabledMessage));
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleButton.js","names":["_extends","React","useMemo","forwardRef","Icon","generateButtonClass","SimpleButton","buttonType","leftIcon","rightIcon","hideLabel","label","title","id","cssClass","disabled","disabledMessage","onClickHandler","buttonStyle","children","ref","buttonCssClass","disabledMessageId","buttonHoverTitle","createElement","Fragment","className","type","onClick","Button"],"sources":["../../../../../src/components/form/buttons/SimpleButton.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo, forwardRef } from 'react';\nimport { ButtonProps } from './button.interface';\nimport { Icon } from '../../design/icons/basicIcon/Icon';\nimport { generateButtonClass } from './button.helpers';\n\nexport const SimpleButton = forwardRef<HTMLButtonElement, ButtonProps>((\n {\n buttonType = 'button',\n leftIcon,\n rightIcon,\n hideLabel = false,\n label = 'A button',\n title,\n id = 'buttonIdRequired',\n cssClass = 'button primary',\n disabled = false,\n disabledMessage = 'This button has been disabled temporarily. There is likely an issue elsewhere on your form that needs to be resolved first.',\n onClickHandler = () => { },\n buttonStyle,\n children\n },\n ref\n) => {\n \n const buttonCssClass = useMemo(() => {\n return generateButtonClass({ cssClass, buttonStyle, hideLabel });\n }, [cssClass, buttonStyle, hideLabel]);\n\n const disabledMessageId = `${ id }-disabledMessage`;\n\n const buttonHoverTitle = () => {\n if (title) {\n return title;\n }\n if (hideLabel && typeof label === 'string') {\n return label;\n }\n };\n\n return (\n <>\n <button\n ref={ ref }\n id={ id }\n title={ buttonHoverTitle() }\n className={ buttonCssClass }\n type={ buttonType }\n onClick={ onClickHandler }\n disabled={ disabled }\n { ...(disabled && { 'aria-describedby': disabledMessageId }) }\n >\n { leftIcon && <Icon { ...leftIcon } /> }\n\n <span className={ `${ hideLabel ? 'sr-only' : 'labelText' }` }>{ label }</span>\n\n { children }\n\n { rightIcon && <Icon { ...rightIcon } /> }\n </button>\n {\n disabled && (\n <span id={ disabledMessageId } className=\"sr-only\">\n {\n disabledMessage\n }\n </span>\n )\n }\n </>\n );\n});\n\nexport default SimpleButton;\n\nexport { SimpleButton as Button };"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;AAEb,OAAOC,KAAK,IAAIC,OAAO,EAAEC,UAAU,QAAQ,OAAO;AAElD,SAASC,IAAI,QAAQ,mCAAmC;AACxD,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtD,OAAO,MAAMC,YAAY,gBAAGH,UAAU,CAAiC,CACrE;EACEI,UAAU,GAAG,QAAQ;EACrBC,QAAQ;EACRC,SAAS;EACTC,SAAS,GAAG,KAAK;EACjBC,KAAK,GAAG,UAAU;EAClBC,KAAK;EACLC,EAAE,GAAG,kBAAkB;EACvBC,QAAQ,GAAG,gBAAgB;EAC3BC,QAAQ,GAAG,KAAK;EAChBC,eAAe,GAAG,6HAA6H;EAC/IC,cAAc,GAAGA,CAAA,KAAM,CAAE,CAAC;EAC1BC,WAAW;EACXC;AACF,CAAC,EACDC,GAAG,KACA;EAEH,MAAMC,cAAc,GAAGnB,OAAO,CAAC,MAAM;IACnC,OAAOG,mBAAmB,CAAC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.js","names":["_extends","React","useMemo","forwardRef","renderIcon","generateButtonClass","SimpleButton","buttonType","leftIcon","rightIcon","hideLabel","label","title","id","cssClass","disabled","disabledMessage","onClickHandler","buttonStyle","children","ref","buttonCssClass","disabledMessageId","buttonHoverTitle","createElement","Fragment","className","type","onClick","Button"],"sources":["../../../../../src/components/form/buttons/SimpleButton.tsx"],"sourcesContent":["'use client';\n\nimport React, { useMemo, forwardRef } from 'react';\nimport { ButtonProps } from './button.interface';\nimport { renderIcon } from '../../../helpers/iconHelpers';\nimport { generateButtonClass } from './button.helpers';\n\nexport const SimpleButton = forwardRef<HTMLButtonElement, ButtonProps>((\n {\n buttonType = 'button',\n leftIcon,\n rightIcon,\n hideLabel = false,\n label = 'A button',\n title,\n id = 'buttonIdRequired',\n cssClass = 'button primary',\n disabled = false,\n disabledMessage = 'This button has been disabled temporarily. There is likely an issue elsewhere on your form that needs to be resolved first.',\n onClickHandler = () => { },\n buttonStyle,\n children\n },\n ref\n) => {\n \n const buttonCssClass = useMemo(() => {\n return generateButtonClass({ cssClass, buttonStyle, hideLabel });\n }, [cssClass, buttonStyle, hideLabel]);\n\n const disabledMessageId = `${ id }-disabledMessage`;\n\n const buttonHoverTitle = () => {\n if (title) {\n return title;\n }\n if (hideLabel && typeof label === 'string') {\n return label;\n }\n };\n\n return (\n <>\n <button\n ref={ ref }\n id={ id }\n title={ buttonHoverTitle() }\n className={ buttonCssClass }\n type={ buttonType }\n onClick={ onClickHandler }\n disabled={ disabled }\n { ...(disabled && { 'aria-describedby': disabledMessageId }) }\n >\n { renderIcon(leftIcon) }\n\n <span className={ `${ hideLabel ? 'sr-only' : 'labelText' }` }>{ label }</span>\n\n { children }\n\n { renderIcon(rightIcon) }\n </button>\n {\n disabled && (\n <span id={ disabledMessageId } className=\"sr-only\">\n {\n disabledMessage\n }\n </span>\n )\n }\n </>\n );\n});\n\nexport default SimpleButton;\n\nexport { SimpleButton as Button };"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;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;EAAU,GACfA,QAAQ,IAAI;IAAE,kBAAkB,EAAEO;EAAkB,CAAC,GAEzDlB,UAAU,CAACI,QAAQ,CAAC,eAEtBP,KAAA,CAAAuB,aAAA;IAAME,SAAS,EAAG,GAAIhB,SAAS,GAAG,SAAS,GAAG,WAAW;EAAK,GAAGC,KAAa,CAAC,EAE7EQ,QAAQ,EAERf,UAAU,CAACK,SAAS,CAChB,CAAC,EAEPM,QAAQ,iBACNd,KAAA,CAAAuB,aAAA;IAAMX,EAAE,EAAGS,iBAAmB;IAACI,SAAS,EAAC;EAAS,GAE9CV,eAEE,CAGV,CAAC;AAEP,CAAC,CAAC;AAEF,eAAeV,YAAY;AAE3B,SAASA,YAAY,IAAIuB,MAAM","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"button.interface.js","names":[],"sources":["../../../../../src/components/form/buttons/button.interface.ts"],"sourcesContent":["import { ReactElement, ReactNode, RefObject } from 'react';\nimport { IconProps } from '../../design/icons/basicIcon/Icon';\nimport { GenericFunction } from '../../../interfaces/generic.interface';\nimport { ButtonClassCombination } from './buttonVariations';\n\nexport interface ButtonStyles {\n color?: 'primary' | 'secondary' | 'tertiary';\n variant?: 'solid' | 'outline' | 'text-only' | 'icon-only';\n size?: 'default' | 'compact';\n}\n\nexport interface ButtonProps {\n label: string | ReactNode;\n id: string;\n title?: string;\n cssClass?: string | ButtonClassCombination;\n onClickHandler?: GenericFunction;\n buttonType?: 'button' | 'submit' | 'reset';\n buttonStyle?: ButtonStyles;\n leftIcon?: IconProps;\n rightIcon?: IconProps;\n hideLabel?: boolean;\n children?: ReactNode | ReactElement;\n disabled?: boolean;\n disabledMessage?: string;\n ref?: RefObject<HTMLButtonElement>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"button.interface.js","names":[],"sources":["../../../../../src/components/form/buttons/button.interface.ts"],"sourcesContent":["import { ReactElement, ReactNode, RefObject } from 'react';\nimport { IconSource } from '../../../helpers/iconHelpers';\nimport { GenericFunction } from '../../../interfaces/generic.interface';\nimport { ButtonClassCombination } from './buttonVariations';\n\nexport interface ButtonStyles {\n color?: 'primary' | 'secondary' | 'tertiary';\n variant?: 'solid' | 'outline' | 'text-only' | 'icon-only';\n size?: 'default' | 'compact';\n}\n\nexport interface ButtonProps {\n label: string | ReactNode;\n id: string;\n title?: string;\n cssClass?: string | ButtonClassCombination;\n onClickHandler?: GenericFunction;\n buttonType?: 'button' | 'submit' | 'reset';\n buttonStyle?: ButtonStyles;\n leftIcon?: IconSource;\n rightIcon?: IconSource;\n hideLabel?: boolean;\n children?: ReactNode | ReactElement;\n disabled?: boolean;\n disabledMessage?: string;\n ref?: RefObject<HTMLButtonElement>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"formFieldProps.js","names":[],"sources":["../../../../../../src/components/form/formFields/formFieldWrapper/formFieldProps.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\n\nimport {\n ChangeEvent,\n ChangeEventHandler,\n FormEventHandler,\n KeyboardEvent,\n ReactElement,\n ReactEventHandler,\n ReactNode,\n} from 'react';\n\nimport type {\n InputHTMLAttributes,\n SelectHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react';\n\nimport {\n FieldValues,\n Message,\n UseFormReturn,\n Validate,\n ValidationRule\n} from 'react-hook-form';\nimport { GenericFunction } from '../../../../interfaces';\nimport { KeyboardEventHandler } from '../../../../interfaces/generic.interface';\n\n/**\n * Custom content props for additional elements around the label or field.\n */\nexport interface CustomContentProps {\n /** Element or text to display before the label. */\n preLabel?: ReactElement | string;\n /** Element or text to display after the label. */\n postLabel?: ReactElement | string;\n /** Element or text to display before the field. */\n preField?: ReactElement | string;\n /** Element or text to display after the field. */\n postField?: ReactElement | string;\n}\n\n/**\n * Props for the label element.\n */\nexport interface LabelProps {\n /** Text or element for the label. */\n text: string | ReactNode | ReactElement;\n /** The ID of the input the label is associated with. */\n inputId?: string;\n /** The ID of the label element. */\n labelId?: string;\n /** Whether to hide the label visually. */\n hide?: boolean;\n /** Position of the label relative to the field. */\n position?: 'inset' | 'left' | 'right' | string;\n /** Tooltip for the label. */\n labelTooltip?: {\n /** Text for the tooltip. */\n text: string;\n /** Optional icon for the tooltip. */\n icon?: ReactElement | string;\n };\n /** Screen reader instructions for the label. */\n srInstruction?: string;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Custom content for the label. */\n customContent?: CustomContentProps;\n}\n\n/**\n * Type for a single select option.\n */\nexport type SelectOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n};\n\n/**\n * Type for select options, which can be an object or string.\n */\nexport type SelectOptionType = SelectOptionObjectType | string;\n\n/**\n * Type for a single combobox (autocomplete) option.\n */\nexport type ComboboxOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n /** Additional data associated with the option. */\n data?: Record<string, unknown>;\n};\n\nexport type ComboboxOption = ComboboxOptionObjectType | string;\n\n// Everything we want to *override* with our own definitions in FieldProps\nexport type OverriddenKeys =\n | 'type'\n | 'id'\n | 'name'\n | 'placeholder'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onInput'\n | 'onKeyDown'\n | 'disabled'\n | 'readOnly'\n | 'min'\n | 'max';\n\n// All the native props we want to mix in, minus the ones we override\nexport type NativeFieldProps =\n & Omit<InputHTMLAttributes<HTMLInputElement>, OverriddenKeys>\n & Omit<SelectHTMLAttributes<HTMLSelectElement>, OverriddenKeys>\n & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, OverriddenKeys>;\n\n/**\n * Props for the field element.\n */\nexport interface FieldProps extends NativeFieldProps {\n /** The type of the input field. */\n type: string;\n /** The ID of the input field. */\n id: string;\n /** The name of the input field. */\n name: string;\n /** Placeholder text for the input field. */\n placeholder?: string;\n /** Default value for the input field. */\n defaultValue?: string | number | readonly string[];\n /** Handler for the change event. */\n onChange?: ChangeEventHandler | ((\n event: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for the blur event. */\n onBlur?: GenericFunction;\n /** Handler for the input event. */\n onInput?: FormEventHandler<\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n >;\n /** Handler for the keydown event. */\n onKeyDown?: KeyboardEventHandler | ((\n event: KeyboardEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for marking the field as touched. */\n onTouched?: GenericFunction;\n /** Whether to include an empty option in a dropdown. */\n includeEmptyOption?: boolean;\n /** Label for the empty option. */\n emptyOptionLabel?: string;\n /** Options for a dropdown field. */\n options?: SelectOptionType[] | ComboboxOption[];\n /** Auto-complete behaviour for the field. */\n autoComplete?: string;\n /** Whether the field allows editing and interaction. Note: Setting this to true makes it invisible to screen reader users. */\n disabled?: boolean;\n /** Setting to true prevents editing and interaction whilst still making the value visible to screen reader users. */\n readonly?: boolean;\n /** Minimum value or length. */\n min?: string | number;\n /** Maximum value or length. */\n max?: string | number;\n /**\n * Whether to enforce grapheme-aware max-length handling (used by textarea).\n * Uses `field.maxLength` (native field prop) as the source for the UI/input limit.\n * Keep `field.maxLength` and `validation.maxLength` aligned to avoid mixed UX/validation behaviour.\n */\n enforceMaxLength?: boolean;\n}\n\n/**\n * Validation rules for fields.\n */\nexport type CustomValidate<TFieldValue> = (\n value: TFieldValue,\n formValues?: unknown\n) => boolean | string | Promise<boolean | string>;\n\n/**\n * Props for validation rules.\n */\n\nexport type MinMaxRule<T> = T extends boolean\n ? ValidationRule<boolean>\n : ValidationRule<number | string>;\n\nexport interface ValidationProps<\n TFieldValue = unknown | string | boolean,\n TFormValues = unknown\n> {\n /** Whether the field is required. */\n required?: Message | ValidationRule<boolean>;\n /** Minimum value or length. */\n min?: MinMaxRule<TFieldValue>;\n /** Maximum value or length. */\n max?: MinMaxRule<TFieldValue>;\n /**\n * Maximum length validation rule.\n * Used for validation outcome/messages, while textarea UI/input limiting is driven by `field.maxLength`.\n * If both are provided, keep them equal.\n */\n maxLength?: ValidationRule<number>;\n /** Minimum length of the field. */\n minLength?: ValidationRule<number>;\n /** Regex pattern for validation. */\n pattern?: ValidationRule<RegExp>;\n /** Custom validation logic. */\n validate?: CustomValidate<TFieldValue> | Record<string, CustomValidate<TFieldValue>> | Validate<TFieldValue, TFormValues>;\n}\n\nexport type ValidationKey = keyof ValidationProps<unknown, unknown>; // Restrict to known keys\n\n/**\n * Custom CSS classes for the field components.\n */\nexport interface CustomFieldCssClassesProps {\n /** CSS class for the label. */\n label?: string;\n /** CSS class for the input field. */\n input?: string;\n /** CSS class for the wrapper. */\n wrapper?: string;\n}\n\n/**\n * Props for a form field component.\n */\nexport interface FormFieldProps {\n /** Props for the label. */\n label: LabelProps;\n /** Props for the field. */\n field: FieldProps;\n /** Layout style of the form field. */\n layout?: 'stacked' | 'horizontal' | string;\n /** Validation rules for the field. */\n validation?: ValidationProps;\n /** Whether to show a spinner. */\n showSpinner?: boolean;\n /** Custom CSS classes for the field. */\n customCssClasses?: CustomFieldCssClassesProps;\n /** Custom content for the field. */\n customContent?: CustomContentProps;\n /** Override the default nesting of the input inside the label. */\n separateLabelAndField?: boolean;\n /** An existing form context to use when React context cannot reach this field, e.g. across a Next.js client boundary. */\n formContext?: UseFormReturn<FieldValues, any, FieldValues>;\n}\n\nexport type TextareaFieldProps = Omit<FieldProps, 'onSelect'> & {\n onSelect?: ReactEventHandler<HTMLTextAreaElement>;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"formFieldProps.js","names":[],"sources":["../../../../../../src/components/form/formFields/formFieldWrapper/formFieldProps.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\n\nimport {\n ChangeEvent,\n ChangeEventHandler,\n FormEventHandler,\n KeyboardEvent,\n ReactElement,\n ReactEventHandler,\n ReactNode,\n} from 'react';\n\nimport type {\n InputHTMLAttributes,\n SelectHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react';\n\nimport {\n FieldValues,\n Message,\n UseFormReturn,\n Validate,\n ValidationRule\n} from 'react-hook-form';\nimport { GenericFunction } from '../../../../interfaces';\nimport { KeyboardEventHandler } from '../../../../interfaces/generic.interface';\nimport { IconSource } from '../../../../helpers/iconHelpers';\n\n/**\n * Custom content props for additional elements around the label or field.\n */\nexport interface CustomContentProps {\n /** Element or text to display before the label. */\n preLabel?: ReactElement | string;\n /** Element or text to display after the label. */\n postLabel?: ReactElement | string;\n /** Element or text to display before the field. */\n preField?: ReactElement | string;\n /** Element or text to display after the field. */\n postField?: ReactElement | string;\n}\n\n/**\n * Props for the label element.\n */\nexport interface LabelProps {\n /** Text or element for the label. */\n text: string | ReactNode | ReactElement;\n /** The ID of the input the label is associated with. */\n inputId?: string;\n /** The ID of the label element. */\n labelId?: string;\n /** Whether to hide the label visually. */\n hide?: boolean;\n /** Position of the label relative to the field. */\n position?: 'inset' | 'left' | 'right' | string;\n /** Tooltip for the label. */\n labelTooltip?: {\n /** Text for the tooltip. */\n text: string;\n /** Optional icon for the tooltip. */\n icon?: IconSource;\n };\n /** Screen reader instructions for the label. */\n srInstruction?: string;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Custom content for the label. */\n customContent?: CustomContentProps;\n}\n\n/**\n * Type for a single select option.\n */\nexport type SelectOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n};\n\n/**\n * Type for select options, which can be an object or string.\n */\nexport type SelectOptionType = SelectOptionObjectType | string;\n\n/**\n * Type for a single combobox (autocomplete) option.\n */\nexport type ComboboxOptionObjectType = {\n /** Label of the option. */\n label: string;\n /** Value of the option. */\n value: string | number | boolean;\n /** Additional data associated with the option. */\n data?: Record<string, unknown>;\n};\n\nexport type ComboboxOption = ComboboxOptionObjectType | string;\n\n// Everything we want to *override* with our own definitions in FieldProps\nexport type OverriddenKeys =\n | 'type'\n | 'id'\n | 'name'\n | 'placeholder'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onInput'\n | 'onKeyDown'\n | 'disabled'\n | 'readOnly'\n | 'min'\n | 'max';\n\n// All the native props we want to mix in, minus the ones we override\nexport type NativeFieldProps =\n & Omit<InputHTMLAttributes<HTMLInputElement>, OverriddenKeys>\n & Omit<SelectHTMLAttributes<HTMLSelectElement>, OverriddenKeys>\n & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, OverriddenKeys>;\n\n/**\n * Props for the field element.\n */\nexport interface FieldProps extends NativeFieldProps {\n /** The type of the input field. */\n type: string;\n /** The ID of the input field. */\n id: string;\n /** The name of the input field. */\n name: string;\n /** Placeholder text for the input field. */\n placeholder?: string;\n /** Default value for the input field. */\n defaultValue?: string | number | readonly string[];\n /** Handler for the change event. */\n onChange?: ChangeEventHandler | ((\n event: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for the blur event. */\n onBlur?: GenericFunction;\n /** Handler for the input event. */\n onInput?: FormEventHandler<\n HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n >;\n /** Handler for the keydown event. */\n onKeyDown?: KeyboardEventHandler | ((\n event: KeyboardEvent<HTMLInputElement> | KeyboardEvent<HTMLSelectElement> | KeyboardEvent<HTMLTextAreaElement>\n ) => void | GenericFunction);\n /** Handler for marking the field as touched. */\n onTouched?: GenericFunction;\n /** Whether to include an empty option in a dropdown. */\n includeEmptyOption?: boolean;\n /** Label for the empty option. */\n emptyOptionLabel?: string;\n /** Options for a dropdown field. */\n options?: SelectOptionType[] | ComboboxOption[];\n /** Auto-complete behaviour for the field. */\n autoComplete?: string;\n /** Whether the field allows editing and interaction. Note: Setting this to true makes it invisible to screen reader users. */\n disabled?: boolean;\n /** Setting to true prevents editing and interaction whilst still making the value visible to screen reader users. */\n readonly?: boolean;\n /** Minimum value or length. */\n min?: string | number;\n /** Maximum value or length. */\n max?: string | number;\n /**\n * Whether to enforce grapheme-aware max-length handling (used by textarea).\n * Uses `field.maxLength` (native field prop) as the source for the UI/input limit.\n * Keep `field.maxLength` and `validation.maxLength` aligned to avoid mixed UX/validation behaviour.\n */\n enforceMaxLength?: boolean;\n}\n\n/**\n * Validation rules for fields.\n */\nexport type CustomValidate<TFieldValue> = (\n value: TFieldValue,\n formValues?: unknown\n) => boolean | string | Promise<boolean | string>;\n\n/**\n * Props for validation rules.\n */\n\nexport type MinMaxRule<T> = T extends boolean\n ? ValidationRule<boolean>\n : ValidationRule<number | string>;\n\nexport interface ValidationProps<\n TFieldValue = unknown | string | boolean,\n TFormValues = unknown\n> {\n /** Whether the field is required. */\n required?: Message | ValidationRule<boolean>;\n /** Minimum value or length. */\n min?: MinMaxRule<TFieldValue>;\n /** Maximum value or length. */\n max?: MinMaxRule<TFieldValue>;\n /**\n * Maximum length validation rule.\n * Used for validation outcome/messages, while textarea UI/input limiting is driven by `field.maxLength`.\n * If both are provided, keep them equal.\n */\n maxLength?: ValidationRule<number>;\n /** Minimum length of the field. */\n minLength?: ValidationRule<number>;\n /** Regex pattern for validation. */\n pattern?: ValidationRule<RegExp>;\n /** Custom validation logic. */\n validate?: CustomValidate<TFieldValue> | Record<string, CustomValidate<TFieldValue>> | Validate<TFieldValue, TFormValues>;\n}\n\nexport type ValidationKey = keyof ValidationProps<unknown, unknown>; // Restrict to known keys\n\n/**\n * Custom CSS classes for the field components.\n */\nexport interface CustomFieldCssClassesProps {\n /** CSS class for the label. */\n label?: string;\n /** CSS class for the input field. */\n input?: string;\n /** CSS class for the wrapper. */\n wrapper?: string;\n}\n\n/**\n * Props for a form field component.\n */\nexport interface FormFieldProps {\n /** Props for the label. */\n label: LabelProps;\n /** Props for the field. */\n field: FieldProps;\n /** Layout style of the form field. */\n layout?: 'stacked' | 'horizontal' | string;\n /** Validation rules for the field. */\n validation?: ValidationProps;\n /** Whether to show a spinner. */\n showSpinner?: boolean;\n /** Custom CSS classes for the field. */\n customCssClasses?: CustomFieldCssClassesProps;\n /** Custom content for the field. */\n customContent?: CustomContentProps;\n /** Override the default nesting of the input inside the label. */\n separateLabelAndField?: boolean;\n /** An existing form context to use when React context cannot reach this field, e.g. across a Next.js client boundary. */\n formContext?: UseFormReturn<FieldValues, any, FieldValues>;\n}\n\nexport type TextareaFieldProps = Omit<FieldProps, 'onSelect'> & {\n onSelect?: ReactEventHandler<HTMLTextAreaElement>;\n};\n"],"mappings":"","ignoreList":[]}