@amboss/design-system 1.15.2 → 1.15.4

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 (344) hide show
  1. package/build/cjs/build-tokens/_breakpoints.json.js +10 -0
  2. package/build/cjs/build-tokens/_icon_sizes_map.json.js +5 -0
  3. package/build/cjs/build-tokens/_zindex.json.js +10 -0
  4. package/build/cjs/build-tokens/assets/icons.json.js +82 -0
  5. package/build/cjs/build-tokens/assets/icons16.json.js +87 -0
  6. package/build/cjs/build-tokens/assets/logo.json.js +7 -0
  7. package/build/cjs/build-tokens/visualConfig.js +1329 -0
  8. package/build/cjs/scss/themes/dark.scss +111 -0
  9. package/build/cjs/scss/themes/light.scss +111 -0
  10. package/build/cjs/src/components/Badge/Badge.js +63 -0
  11. package/build/cjs/src/components/Box/Box.js +89 -0
  12. package/build/cjs/src/components/Button/Button.js +290 -0
  13. package/build/cjs/src/components/Callout/Callout.js +102 -0
  14. package/build/cjs/src/components/Card/Card.js +69 -0
  15. package/build/cjs/src/components/Card/CardBox.js +23 -0
  16. package/build/cjs/src/components/Card/CardHeader/CardHeader.js +59 -0
  17. package/build/cjs/src/components/Collapsible/Collapsible.js +117 -0
  18. package/build/cjs/src/components/Column/Columns.js +147 -0
  19. package/build/cjs/src/components/Container/Container.js +63 -0
  20. package/build/cjs/src/components/DataTable/DataTable.js +187 -0
  21. package/build/cjs/src/components/DataTable/TableBody.js +161 -0
  22. package/build/cjs/src/components/DataTable/TableCell.js +45 -0
  23. package/build/cjs/src/components/DataTable/TableHeader.js +194 -0
  24. package/build/cjs/src/components/DataTable/useDataTableSort.js +42 -0
  25. package/build/cjs/src/components/Divider/Divider.js +68 -0
  26. package/build/cjs/src/components/DropdownMenu/DropdownMenu.js +227 -0
  27. package/build/cjs/src/components/DropdownMenu/MenuItem.js +103 -0
  28. package/build/cjs/src/components/Form/Checkbox/Checkbox.js +148 -0
  29. package/build/cjs/src/components/Form/FormErrorMessages/FormErrorMessages.js +27 -0
  30. package/build/cjs/src/components/Form/FormField/FormField.js +58 -0
  31. package/build/cjs/src/components/Form/FormFieldGroup/FormFieldGroup.js +55 -0
  32. package/build/cjs/src/components/Form/FormLabelText/FormLabelText.js +42 -0
  33. package/build/cjs/src/components/Form/Input/Input.js +187 -0
  34. package/build/cjs/src/components/Form/PasswordInput/PasswordInput.js +227 -0
  35. package/build/cjs/src/components/Form/Radio/Radio.js +139 -0
  36. package/build/cjs/src/components/Form/RadioButton/RadioButton.js +124 -0
  37. package/build/cjs/src/components/Form/SegmentedControl/SegmentedControl.js +131 -0
  38. package/build/cjs/src/components/Form/SegmentedControl/SegmentedControlOption.js +216 -0
  39. package/build/cjs/src/components/Form/Select/Select.js +291 -0
  40. package/build/cjs/src/components/Form/Textarea/Textarea.js +94 -0
  41. package/build/cjs/src/components/Form/Toggle/Toggle.js +180 -0
  42. package/build/cjs/src/components/Form/ToggleButton/ToggleButton.js +144 -0
  43. package/build/cjs/src/components/Icon/Icon.js +110 -0
  44. package/build/cjs/src/components/Inline/Inline.js +113 -0
  45. package/build/cjs/src/components/Link/Link.js +77 -0
  46. package/build/cjs/src/components/LoadingSpinner/LoadingSpinner.js +84 -0
  47. package/build/cjs/src/components/Logo/Logo.js +44 -0
  48. package/build/cjs/src/components/MediaItem/MediaItem.js +120 -0
  49. package/build/cjs/src/components/MediaViewerBar/MediaViewerBar.js +73 -0
  50. package/build/cjs/src/components/Notification/Notification.js +108 -0
  51. package/build/cjs/src/components/Pagination/Pagination.js +91 -0
  52. package/build/cjs/src/components/Patterns/ButtonGroup/ButtonGroup.js +52 -0
  53. package/build/cjs/src/components/Patterns/Modal/Modal.js +221 -0
  54. package/build/cjs/src/components/PictogramButton/PictogramButton.js +150 -0
  55. package/build/cjs/src/components/Portal/Portal.js +22 -0
  56. package/build/cjs/src/components/ProgressBar/ProgressBar.js +38 -0
  57. package/build/cjs/src/components/RoundButton/RoundButton.js +140 -0
  58. package/build/cjs/src/components/SearchResult/SearchResult.js +184 -0
  59. package/build/cjs/src/components/SegmentedProgressBar/SegmentedProgressBar.js +110 -0
  60. package/build/cjs/src/components/SegmentedProgressBar/SegmentedProgressBarUtil.js +42 -0
  61. package/build/cjs/src/components/Stack/Stack.js +80 -0
  62. package/build/cjs/src/components/SubThemeProvider/SubThemeProvider.js +55 -0
  63. package/build/cjs/src/components/Tabs/Tabs.js +137 -0
  64. package/build/cjs/src/components/Tag/Tag.js +90 -0
  65. package/build/cjs/src/components/Tooltip/Tooltip.js +275 -0
  66. package/build/cjs/src/components/Tooltip/utils.js +81 -0
  67. package/build/cjs/src/components/Typography/Header/Header.js +140 -0
  68. package/build/cjs/src/components/Typography/StyledText/StyledText.js +168 -0
  69. package/build/cjs/src/components/Typography/Text/Text.js +71 -0
  70. package/build/cjs/src/components/Typography/TextClamped/TextClamped.js +54 -0
  71. package/build/cjs/src/components/VirtualScrollList/VirtualScrollList.js +116 -0
  72. package/build/cjs/src/components/VirtualScrollList/VirtualScrollListReducer.js +131 -0
  73. package/build/cjs/src/index.js +136 -0
  74. package/build/cjs/src/shared/ScreenReaderText.js +26 -0
  75. package/build/cjs/src/shared/flattenChildren.js +33 -0
  76. package/build/cjs/src/shared/informDeprecation.js +12 -0
  77. package/build/cjs/src/shared/mediaQueries.js +68 -0
  78. package/build/cjs/src/shared/useAutoPosition.js +42 -0
  79. package/build/cjs/src/shared/useDocument.js +7 -0
  80. package/build/cjs/src/shared/useHover.js +26 -0
  81. package/build/cjs/src/shared/useKeyboard.js +43 -0
  82. package/build/cjs/src/shared/useOnEscapePress.js +52 -0
  83. package/build/cjs/src/shared/useOutsideClick.js +33 -0
  84. package/build/cjs/src/shared/useWindow.js +7 -0
  85. package/build/esm/build-tokens/_breakpoints.json +17 -0
  86. package/build/esm/build-tokens/_breakpoints.json.js +4 -0
  87. package/build/esm/build-tokens/_breakpoints.json.js.map +1 -0
  88. package/build/esm/build-tokens/_colors.json +918 -0
  89. package/build/esm/build-tokens/_icon_sizes_map.json +7 -0
  90. package/build/esm/build-tokens/_icon_sizes_map.json.js +4 -0
  91. package/build/esm/build-tokens/_icon_sizes_map.json.js.map +1 -0
  92. package/build/esm/build-tokens/_sizes.json +782 -0
  93. package/build/esm/build-tokens/_subThemeType.d.ts +1 -0
  94. package/build/esm/build-tokens/_zindex.json +17 -0
  95. package/build/esm/build-tokens/_zindex.json.js +4 -0
  96. package/build/esm/build-tokens/_zindex.json.js.map +1 -0
  97. package/build/esm/build-tokens/assets/icons.json +142 -0
  98. package/build/esm/build-tokens/assets/icons.json.js +4 -0
  99. package/build/esm/build-tokens/assets/icons.json.js.map +1 -0
  100. package/build/esm/build-tokens/assets/icons16.json +153 -0
  101. package/build/esm/build-tokens/assets/icons16.json.js +4 -0
  102. package/build/esm/build-tokens/assets/icons16.json.js.map +1 -0
  103. package/build/esm/build-tokens/assets/logo.json +3 -0
  104. package/build/esm/build-tokens/assets/logo.json.js +4 -0
  105. package/build/esm/build-tokens/assets/logo.json.js.map +1 -0
  106. package/build/esm/build-tokens/visualConfig.d.ts +767 -0
  107. package/build/esm/build-tokens/visualConfig.js +1328 -0
  108. package/build/esm/build-tokens/visualConfig.js.map +1 -0
  109. package/build/esm/scss/themes/dark.scss +111 -0
  110. package/build/esm/scss/themes/light.scss +111 -0
  111. package/build/esm/src/components/Badge/Badge.d.ts +11 -0
  112. package/build/esm/src/components/Badge/Badge.js +57 -0
  113. package/build/esm/src/components/Badge/Badge.js.map +1 -0
  114. package/build/esm/src/components/Box/Box.d.ts +35 -0
  115. package/build/esm/src/components/Box/Box.js +82 -0
  116. package/build/esm/src/components/Box/Box.js.map +1 -0
  117. package/build/esm/src/components/Button/Button.d.ts +33 -0
  118. package/build/esm/src/components/Button/Button.js +282 -0
  119. package/build/esm/src/components/Button/Button.js.map +1 -0
  120. package/build/esm/src/components/Callout/Callout.d.ts +14 -0
  121. package/build/esm/src/components/Callout/Callout.js +96 -0
  122. package/build/esm/src/components/Callout/Callout.js.map +1 -0
  123. package/build/esm/src/components/Card/Card.d.ts +16 -0
  124. package/build/esm/src/components/Card/Card.js +63 -0
  125. package/build/esm/src/components/Card/Card.js.map +1 -0
  126. package/build/esm/src/components/Card/CardBox.d.ts +6 -0
  127. package/build/esm/src/components/Card/CardBox.js +18 -0
  128. package/build/esm/src/components/Card/CardBox.js.map +1 -0
  129. package/build/esm/src/components/Card/CardHeader/CardHeader.d.ts +12 -0
  130. package/build/esm/src/components/Card/CardHeader/CardHeader.js +52 -0
  131. package/build/esm/src/components/Card/CardHeader/CardHeader.js.map +1 -0
  132. package/build/esm/src/components/Collapsible/Collapsible.d.ts +15 -0
  133. package/build/esm/src/components/Collapsible/Collapsible.js +110 -0
  134. package/build/esm/src/components/Collapsible/Collapsible.js.map +1 -0
  135. package/build/esm/src/components/Column/Columns.d.ts +45 -0
  136. package/build/esm/src/components/Column/Columns.js +141 -0
  137. package/build/esm/src/components/Column/Columns.js.map +1 -0
  138. package/build/esm/src/components/Container/Container.d.ts +11 -0
  139. package/build/esm/src/components/Container/Container.js +57 -0
  140. package/build/esm/src/components/Container/Container.js.map +1 -0
  141. package/build/esm/src/components/DataTable/DataTable.d.ts +58 -0
  142. package/build/esm/src/components/DataTable/DataTable.js +180 -0
  143. package/build/esm/src/components/DataTable/DataTable.js.map +1 -0
  144. package/build/esm/src/components/DataTable/TableBody.d.ts +9 -0
  145. package/build/esm/src/components/DataTable/TableBody.js +153 -0
  146. package/build/esm/src/components/DataTable/TableBody.js.map +1 -0
  147. package/build/esm/src/components/DataTable/TableCell.d.ts +15 -0
  148. package/build/esm/src/components/DataTable/TableCell.js +38 -0
  149. package/build/esm/src/components/DataTable/TableCell.js.map +1 -0
  150. package/build/esm/src/components/DataTable/TableHeader.d.ts +9 -0
  151. package/build/esm/src/components/DataTable/TableHeader.js +185 -0
  152. package/build/esm/src/components/DataTable/TableHeader.js.map +1 -0
  153. package/build/esm/src/components/DataTable/index.d.ts +4 -0
  154. package/build/esm/src/components/DataTable/types.d.ts +15 -0
  155. package/build/esm/src/components/DataTable/useDataTableSort.d.ts +14 -0
  156. package/build/esm/src/components/DataTable/useDataTableSort.js +41 -0
  157. package/build/esm/src/components/DataTable/useDataTableSort.js.map +1 -0
  158. package/build/esm/src/components/Divider/Divider.d.ts +6 -0
  159. package/build/esm/src/components/Divider/Divider.js +62 -0
  160. package/build/esm/src/components/Divider/Divider.js.map +1 -0
  161. package/build/esm/src/components/DropdownMenu/DropdownMenu.d.ts +35 -0
  162. package/build/esm/src/components/DropdownMenu/DropdownMenu.js +221 -0
  163. package/build/esm/src/components/DropdownMenu/DropdownMenu.js.map +1 -0
  164. package/build/esm/src/components/DropdownMenu/MenuItem.d.ts +19 -0
  165. package/build/esm/src/components/DropdownMenu/MenuItem.js +97 -0
  166. package/build/esm/src/components/DropdownMenu/MenuItem.js.map +1 -0
  167. package/build/esm/src/components/Form/Checkbox/Checkbox.d.ts +26 -0
  168. package/build/esm/src/components/Form/Checkbox/Checkbox.js +141 -0
  169. package/build/esm/src/components/Form/Checkbox/Checkbox.js.map +1 -0
  170. package/build/esm/src/components/Form/FormErrorMessages/FormErrorMessages.d.ts +6 -0
  171. package/build/esm/src/components/Form/FormErrorMessages/FormErrorMessages.js +22 -0
  172. package/build/esm/src/components/Form/FormErrorMessages/FormErrorMessages.js.map +1 -0
  173. package/build/esm/src/components/Form/FormField/FormField.d.ts +15 -0
  174. package/build/esm/src/components/Form/FormField/FormField.js +52 -0
  175. package/build/esm/src/components/Form/FormField/FormField.js.map +1 -0
  176. package/build/esm/src/components/Form/FormFieldGroup/FormFieldGroup.d.ts +11 -0
  177. package/build/esm/src/components/Form/FormFieldGroup/FormFieldGroup.js +49 -0
  178. package/build/esm/src/components/Form/FormFieldGroup/FormFieldGroup.js.map +1 -0
  179. package/build/esm/src/components/Form/FormLabelText/FormLabelText.d.ts +7 -0
  180. package/build/esm/src/components/Form/FormLabelText/FormLabelText.js +36 -0
  181. package/build/esm/src/components/Form/FormLabelText/FormLabelText.js.map +1 -0
  182. package/build/esm/src/components/Form/Input/Input.d.ts +78 -0
  183. package/build/esm/src/components/Form/Input/Input.js +179 -0
  184. package/build/esm/src/components/Form/Input/Input.js.map +1 -0
  185. package/build/esm/src/components/Form/Input/index.d.ts +2 -0
  186. package/build/esm/src/components/Form/PasswordInput/PasswordInput.d.ts +76 -0
  187. package/build/esm/src/components/Form/PasswordInput/PasswordInput.js +219 -0
  188. package/build/esm/src/components/Form/PasswordInput/PasswordInput.js.map +1 -0
  189. package/build/esm/src/components/Form/PasswordInput/index.d.ts +2 -0
  190. package/build/esm/src/components/Form/Radio/Radio.d.ts +24 -0
  191. package/build/esm/src/components/Form/Radio/Radio.js +132 -0
  192. package/build/esm/src/components/Form/Radio/Radio.js.map +1 -0
  193. package/build/esm/src/components/Form/RadioButton/RadioButton.d.ts +17 -0
  194. package/build/esm/src/components/Form/RadioButton/RadioButton.js +117 -0
  195. package/build/esm/src/components/Form/RadioButton/RadioButton.js.map +1 -0
  196. package/build/esm/src/components/Form/SegmentedControl/SegmentedControl.d.ts +31 -0
  197. package/build/esm/src/components/Form/SegmentedControl/SegmentedControl.js +124 -0
  198. package/build/esm/src/components/Form/SegmentedControl/SegmentedControl.js.map +1 -0
  199. package/build/esm/src/components/Form/SegmentedControl/SegmentedControlOption.d.ts +8 -0
  200. package/build/esm/src/components/Form/SegmentedControl/SegmentedControlOption.js +210 -0
  201. package/build/esm/src/components/Form/SegmentedControl/SegmentedControlOption.js.map +1 -0
  202. package/build/esm/src/components/Form/Select/Select.d.ts +23 -0
  203. package/build/esm/src/components/Form/Select/Select.js +284 -0
  204. package/build/esm/src/components/Form/Select/Select.js.map +1 -0
  205. package/build/esm/src/components/Form/Textarea/Textarea.d.ts +48 -0
  206. package/build/esm/src/components/Form/Textarea/Textarea.js +87 -0
  207. package/build/esm/src/components/Form/Textarea/Textarea.js.map +1 -0
  208. package/build/esm/src/components/Form/Toggle/Toggle.d.ts +32 -0
  209. package/build/esm/src/components/Form/Toggle/Toggle.js +173 -0
  210. package/build/esm/src/components/Form/Toggle/Toggle.js.map +1 -0
  211. package/build/esm/src/components/Form/ToggleButton/ToggleButton.d.ts +26 -0
  212. package/build/esm/src/components/Form/ToggleButton/ToggleButton.js +137 -0
  213. package/build/esm/src/components/Form/ToggleButton/ToggleButton.js.map +1 -0
  214. package/build/esm/src/components/Icon/Icon.d.ts +22 -0
  215. package/build/esm/src/components/Icon/Icon.js +104 -0
  216. package/build/esm/src/components/Icon/Icon.js.map +1 -0
  217. package/build/esm/src/components/Inline/Inline.d.ts +30 -0
  218. package/build/esm/src/components/Inline/Inline.js +107 -0
  219. package/build/esm/src/components/Inline/Inline.js.map +1 -0
  220. package/build/esm/src/components/Link/Link.d.ts +14 -0
  221. package/build/esm/src/components/Link/Link.js +70 -0
  222. package/build/esm/src/components/Link/Link.js.map +1 -0
  223. package/build/esm/src/components/LoadingSpinner/LoadingSpinner.d.ts +11 -0
  224. package/build/esm/src/components/LoadingSpinner/LoadingSpinner.js +78 -0
  225. package/build/esm/src/components/LoadingSpinner/LoadingSpinner.js.map +1 -0
  226. package/build/esm/src/components/Logo/Logo.d.ts +8 -0
  227. package/build/esm/src/components/Logo/Logo.js +38 -0
  228. package/build/esm/src/components/Logo/Logo.js.map +1 -0
  229. package/build/esm/src/components/MediaItem/MediaItem.d.ts +14 -0
  230. package/build/esm/src/components/MediaItem/MediaItem.js +114 -0
  231. package/build/esm/src/components/MediaItem/MediaItem.js.map +1 -0
  232. package/build/esm/src/components/MediaViewerBar/MediaViewerBar.d.ts +7 -0
  233. package/build/esm/src/components/MediaViewerBar/MediaViewerBar.js +67 -0
  234. package/build/esm/src/components/MediaViewerBar/MediaViewerBar.js.map +1 -0
  235. package/build/esm/src/components/Notification/ExpandedContent.d.ts +2 -0
  236. package/build/esm/src/components/Notification/Notification.d.ts +16 -0
  237. package/build/esm/src/components/Notification/Notification.js +102 -0
  238. package/build/esm/src/components/Notification/Notification.js.map +1 -0
  239. package/build/esm/src/components/Pagination/Pagination.d.ts +17 -0
  240. package/build/esm/src/components/Pagination/Pagination.js +86 -0
  241. package/build/esm/src/components/Pagination/Pagination.js.map +1 -0
  242. package/build/esm/src/components/Patterns/ButtonGroup/ButtonGroup.d.ts +14 -0
  243. package/build/esm/src/components/Patterns/ButtonGroup/ButtonGroup.js +46 -0
  244. package/build/esm/src/components/Patterns/ButtonGroup/ButtonGroup.js.map +1 -0
  245. package/build/esm/src/components/Patterns/Modal/Modal.d.ts +28 -0
  246. package/build/esm/src/components/Patterns/Modal/Modal.js +214 -0
  247. package/build/esm/src/components/Patterns/Modal/Modal.js.map +1 -0
  248. package/build/esm/src/components/PictogramButton/PictogramButton.d.ts +15 -0
  249. package/build/esm/src/components/PictogramButton/PictogramButton.js +143 -0
  250. package/build/esm/src/components/PictogramButton/PictogramButton.js.map +1 -0
  251. package/build/esm/src/components/Portal/Portal.d.ts +7 -0
  252. package/build/esm/src/components/Portal/Portal.js +16 -0
  253. package/build/esm/src/components/Portal/Portal.js.map +1 -0
  254. package/build/esm/src/components/ProgressBar/ProgressBar.d.ts +15 -0
  255. package/build/esm/src/components/ProgressBar/ProgressBar.js +33 -0
  256. package/build/esm/src/components/ProgressBar/ProgressBar.js.map +1 -0
  257. package/build/esm/src/components/RoundButton/RoundButton.d.ts +12 -0
  258. package/build/esm/src/components/RoundButton/RoundButton.js +133 -0
  259. package/build/esm/src/components/RoundButton/RoundButton.js.map +1 -0
  260. package/build/esm/src/components/SearchResult/SearchResult.d.ts +43 -0
  261. package/build/esm/src/components/SearchResult/SearchResult.js +178 -0
  262. package/build/esm/src/components/SearchResult/SearchResult.js.map +1 -0
  263. package/build/esm/src/components/SegmentedProgressBar/SegmentedProgressBar.d.ts +28 -0
  264. package/build/esm/src/components/SegmentedProgressBar/SegmentedProgressBar.js +104 -0
  265. package/build/esm/src/components/SegmentedProgressBar/SegmentedProgressBar.js.map +1 -0
  266. package/build/esm/src/components/SegmentedProgressBar/SegmentedProgressBarUtil.d.ts +10 -0
  267. package/build/esm/src/components/SegmentedProgressBar/SegmentedProgressBarUtil.js +40 -0
  268. package/build/esm/src/components/SegmentedProgressBar/SegmentedProgressBarUtil.js.map +1 -0
  269. package/build/esm/src/components/ShadowWebComponent/ShadowWebComponent.d.ts +13 -0
  270. package/build/esm/src/components/Stack/Stack.d.ts +20 -0
  271. package/build/esm/src/components/Stack/Stack.js +74 -0
  272. package/build/esm/src/components/Stack/Stack.js.map +1 -0
  273. package/build/esm/src/components/SubThemeProvider/SubThemeProvider.d.ts +8 -0
  274. package/build/esm/src/components/SubThemeProvider/SubThemeProvider.js +50 -0
  275. package/build/esm/src/components/SubThemeProvider/SubThemeProvider.js.map +1 -0
  276. package/build/esm/src/components/Tabs/Tabs.d.ts +28 -0
  277. package/build/esm/src/components/Tabs/Tabs.js +130 -0
  278. package/build/esm/src/components/Tabs/Tabs.js.map +1 -0
  279. package/build/esm/src/components/Tag/Tag.d.ts +18 -0
  280. package/build/esm/src/components/Tag/Tag.js +84 -0
  281. package/build/esm/src/components/Tag/Tag.js.map +1 -0
  282. package/build/esm/src/components/Tooltip/Tooltip.d.ts +23 -0
  283. package/build/esm/src/components/Tooltip/Tooltip.js +269 -0
  284. package/build/esm/src/components/Tooltip/Tooltip.js.map +1 -0
  285. package/build/esm/src/components/Tooltip/utils.d.ts +11 -0
  286. package/build/esm/src/components/Tooltip/utils.js +75 -0
  287. package/build/esm/src/components/Tooltip/utils.js.map +1 -0
  288. package/build/esm/src/components/Typography/Header/Header.d.ts +36 -0
  289. package/build/esm/src/components/Typography/Header/Header.js +130 -0
  290. package/build/esm/src/components/Typography/Header/Header.js.map +1 -0
  291. package/build/esm/src/components/Typography/StyledText/StyledText.d.ts +11 -0
  292. package/build/esm/src/components/Typography/StyledText/StyledText.js +161 -0
  293. package/build/esm/src/components/Typography/StyledText/StyledText.js.map +1 -0
  294. package/build/esm/src/components/Typography/Text/Text.d.ts +21 -0
  295. package/build/esm/src/components/Typography/Text/Text.js +65 -0
  296. package/build/esm/src/components/Typography/Text/Text.js.map +1 -0
  297. package/build/esm/src/components/Typography/TextClamped/TextClamped.d.ts +10 -0
  298. package/build/esm/src/components/Typography/TextClamped/TextClamped.js +47 -0
  299. package/build/esm/src/components/Typography/TextClamped/TextClamped.js.map +1 -0
  300. package/build/esm/src/components/VirtualScrollList/VirtualScrollList.d.ts +11 -0
  301. package/build/esm/src/components/VirtualScrollList/VirtualScrollList.js +110 -0
  302. package/build/esm/src/components/VirtualScrollList/VirtualScrollList.js.map +1 -0
  303. package/build/esm/src/components/VirtualScrollList/VirtualScrollListReducer.d.ts +36 -0
  304. package/build/esm/src/components/VirtualScrollList/VirtualScrollListReducer.js +130 -0
  305. package/build/esm/src/components/VirtualScrollList/VirtualScrollListReducer.js.map +1 -0
  306. package/build/esm/src/index.d.ts +53 -0
  307. package/build/esm/src/index.js +60 -0
  308. package/build/esm/src/index.js.map +1 -0
  309. package/build/esm/src/shared/ScreenReaderText.d.ts +5 -0
  310. package/build/esm/src/shared/ScreenReaderText.js +21 -0
  311. package/build/esm/src/shared/ScreenReaderText.js.map +1 -0
  312. package/build/esm/src/shared/flattenChildren.d.ts +11 -0
  313. package/build/esm/src/shared/flattenChildren.js +32 -0
  314. package/build/esm/src/shared/flattenChildren.js.map +1 -0
  315. package/build/esm/src/shared/informDeprecation.d.ts +1 -0
  316. package/build/esm/src/shared/informDeprecation.js +11 -0
  317. package/build/esm/src/shared/informDeprecation.js.map +1 -0
  318. package/build/esm/src/shared/mediaQueries.d.ts +14 -0
  319. package/build/esm/src/shared/mediaQueries.js +66 -0
  320. package/build/esm/src/shared/mediaQueries.js.map +1 -0
  321. package/build/esm/src/shared/replaceDeprecated.d.ts +1 -0
  322. package/build/esm/src/shared/useAutoPosition.d.ts +5 -0
  323. package/build/esm/src/shared/useAutoPosition.js +41 -0
  324. package/build/esm/src/shared/useAutoPosition.js.map +1 -0
  325. package/build/esm/src/shared/useDocument.d.ts +1 -0
  326. package/build/esm/src/shared/useDocument.js +6 -0
  327. package/build/esm/src/shared/useDocument.js.map +1 -0
  328. package/build/esm/src/shared/useHover.d.ts +2 -0
  329. package/build/esm/src/shared/useHover.js +25 -0
  330. package/build/esm/src/shared/useHover.js.map +1 -0
  331. package/build/esm/src/shared/useKeyboard.d.ts +17 -0
  332. package/build/esm/src/shared/useKeyboard.js +42 -0
  333. package/build/esm/src/shared/useKeyboard.js.map +1 -0
  334. package/build/esm/src/shared/useOnEscapePress.d.ts +2 -0
  335. package/build/esm/src/shared/useOnEscapePress.js +51 -0
  336. package/build/esm/src/shared/useOnEscapePress.js.map +1 -0
  337. package/build/esm/src/shared/useOutsideClick.d.ts +11 -0
  338. package/build/esm/src/shared/useOutsideClick.js +32 -0
  339. package/build/esm/src/shared/useOutsideClick.js.map +1 -0
  340. package/build/esm/src/shared/useWindow.d.ts +1 -0
  341. package/build/esm/src/shared/useWindow.js +6 -0
  342. package/build/esm/src/shared/useWindow.js.map +1 -0
  343. package/build/esm/src/types/index.d.ts +57 -0
  344. package/package.json +2 -2
@@ -0,0 +1,66 @@
1
+ import breakpoints from '../../build-tokens/_breakpoints.json.js';
2
+
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+
5
+ /*
6
+ Although, mq implementation supports any property type, the following types are specified to provide type safety. If you need support for a new type, add it here.
7
+ */
8
+
9
+ // this thing probably deserves to be a separate library, like facepaint for emotion
10
+ function getMq(breakpointRules) {
11
+ const keys = breakpointRules;
12
+ return rules => {
13
+ const res = {};
14
+ keys.forEach(key => {
15
+ res[key] = {};
16
+ });
17
+ res[`@media screen`] = {};
18
+
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ Object.entries(rules).forEach(_ref => {
21
+ let [cssProperty, [prop, map]] = _ref;
22
+ if (Array.isArray(prop)) {
23
+ const sm = prop[0];
24
+ const md = prop[1] || prop[0];
25
+ const lg = prop[2] || prop[1] || prop[0];
26
+ const [s, m, l] = keys;
27
+ res[s][cssProperty] = map[sm];
28
+ res[m][cssProperty] = map[md];
29
+ res[l][cssProperty] = map[lg];
30
+ } else {
31
+ res[`@media screen`][cssProperty] = map[prop];
32
+ }
33
+ });
34
+ return res;
35
+ };
36
+ }
37
+ const mq = getMq([`@media (max-width: ${breakpoints.medium.value}px)`, `@media (min-width: ${breakpoints.medium.value}px) and (max-width: ${breakpoints.large.value}px)`, `@media (min-width: ${breakpoints.large.value}px)`]);
38
+ function getMqValue(breakpointRules) {
39
+ const keys = breakpointRules;
40
+ return rules => {
41
+ const res = {};
42
+ keys.forEach(key => {
43
+ res[key] = {};
44
+ });
45
+ res[`@media screen`] = {};
46
+ Object.entries(rules).forEach(_ref2 => {
47
+ let [cssProperty, cssValues] = _ref2;
48
+ if (Array.isArray(cssValues)) {
49
+ breakpointRules.forEach((breakpoint, index) => {
50
+ let i = index;
51
+ while (!cssValues[i] && i !== 0) {
52
+ i -= 1;
53
+ }
54
+ res[breakpoint][cssProperty] = cssValues[i];
55
+ });
56
+ } else {
57
+ res[`@media screen`][cssProperty] = cssValues;
58
+ }
59
+ });
60
+ return res;
61
+ };
62
+ }
63
+ const mqValue = getMqValue([`@media (max-width: ${breakpoints.medium.value}px)`, `@media (min-width: ${breakpoints.medium.value}px) and (max-width: ${breakpoints.large.value}px)`, `@media (min-width: ${breakpoints.large.value}px)`]);
64
+
65
+ export { mq, mqValue };
66
+ //# sourceMappingURL=mediaQueries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQueries.js","sources":["../../../../src/shared/mediaQueries.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport {\n ColumnSizes,\n HorizontalAlignment,\n MQ,\n SpaceSizes,\n TextAlignment,\n VerticalAlignment,\n Order,\n ColumnAlignment,\n Hyphens,\n} from \"../types\";\nimport breakpoints from \"../../build-tokens/_breakpoints.json\";\n\ntype MqProp<T> = [\n T | MQ<T>,\n Record<T extends string ? T : never, string | number>\n];\n\n/*\n Although, mq implementation supports any property type, the following types are specified to provide type safety. If you need support for a new type, add it here.\n*/\ntype MqRules = Record<\n string,\n | MqProp<TextAlignment>\n | MqProp<SpaceSizes>\n | MqProp<HorizontalAlignment>\n | MqProp<VerticalAlignment>\n | MqProp<ColumnSizes>\n | MqProp<Order>\n | MqProp<ColumnAlignment>\n | MqProp<Hyphens>\n>;\n\ntype EmotionCssPropertyName = string;\ntype EmotionCssValue = string | number;\ntype EmotionCssDescription = Record<EmotionCssPropertyName, EmotionCssValue>;\ntype MqFunc = (\n rules: MqRules\n) => Record<string, EmotionCssValue | EmotionCssDescription>;\n\n// this thing probably deserves to be a separate library, like facepaint for emotion\nfunction getMq(breakpointRules: string[]): MqFunc {\n const keys = breakpointRules;\n\n return (rules) => {\n const res: Record<string, EmotionCssValue | EmotionCssDescription> = {};\n\n keys.forEach((key: string) => {\n res[key] = {};\n });\n res[`@media screen`] = {};\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(rules).forEach(([cssProperty, [prop, map]]: any) => {\n if (Array.isArray(prop)) {\n const sm = prop[0];\n const md = prop[1] || prop[0];\n const lg = prop[2] || prop[1] || prop[0];\n const [s, m, l]: string[] = keys;\n\n (res[s] as EmotionCssDescription)[cssProperty] = map[sm];\n (res[m] as EmotionCssDescription)[cssProperty] = map[md];\n (res[l] as EmotionCssDescription)[cssProperty] = map[lg];\n } else {\n (res[`@media screen`] as EmotionCssDescription)[cssProperty] = map[\n prop as string\n ] as string;\n }\n });\n\n return res;\n };\n}\n\nexport const mq = getMq([\n `@media (max-width: ${breakpoints.medium.value}px)`,\n `@media (min-width: ${breakpoints.medium.value}px) and (max-width: ${breakpoints.large.value}px)`,\n `@media (min-width: ${breakpoints.large.value}px)`,\n]);\n\nfunction getMqValue(breakpointRules: string[]) {\n const keys = breakpointRules;\n return (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n rules: Record<EmotionCssPropertyName, EmotionCssValue[] | EmotionCssValue>\n ): Record<string, EmotionCssValue | EmotionCssDescription> => {\n const res: Record<string, EmotionCssValue | EmotionCssDescription> = {};\n keys.forEach((key: string) => {\n res[key] = {};\n });\n res[`@media screen`] = {};\n\n Object.entries(rules).forEach(([cssProperty, cssValues]) => {\n if (Array.isArray(cssValues)) {\n breakpointRules.forEach((breakpoint, index) => {\n let i = index;\n while (!cssValues[i] && i !== 0) {\n i -= 1;\n }\n\n (res[breakpoint] as EmotionCssDescription)[cssProperty] =\n cssValues[i];\n });\n } else {\n (res[`@media screen`] as EmotionCssDescription)[cssProperty] =\n cssValues;\n }\n });\n\n return res;\n };\n}\n\nexport const mqValue = getMqValue([\n `@media (max-width: ${breakpoints.medium.value}px)`,\n `@media (min-width: ${breakpoints.medium.value}px) and (max-width: ${breakpoints.large.value}px)`,\n `@media (min-width: ${breakpoints.large.value}px)`,\n]);\n\nexport function getMediaQueryClasses<T>(\n s: T | MQ<T> | undefined,\n styles: Record<string, string>,\n prefix = \"\"\n): string[] {\n if (s === undefined) return [];\n\n let res;\n if (Array.isArray(s)) {\n const sm = s[0];\n const md = s[1] || s[0];\n const lg = s[2] || s[1] || s[0];\n\n res = [`${sm}-small`, `${md}-medium`, `${lg}-large`];\n } else {\n res = [s as unknown as string];\n }\n\n return res.map((cl) => `${prefix}${cl}`).map((cl) => styles[cl]);\n}\n"],"names":["getMq","breakpointRules","keys","rules","res","forEach","key","Object","entries","_ref","cssProperty","prop","map","Array","isArray","sm","md","lg","s","m","l","mq","breakpoints","medium","value","large","getMqValue","_ref2","cssValues","breakpoint","index","i","mqValue"],"mappings":";;AAAA;;AAoBA;AACA;AACA;;AAoBA;AACA,SAASA,KAAKA,CAACC,eAAyB,EAAU;EAChD,MAAMC,IAAI,GAAGD,eAAe,CAAA;AAE5B,EAAA,OAAQE,KAAK,IAAK;IAChB,MAAMC,GAA4D,GAAG,EAAE,CAAA;AAEvEF,IAAAA,IAAI,CAACG,OAAO,CAAEC,GAAW,IAAK;AAC5BF,MAAAA,GAAG,CAACE,GAAG,CAAC,GAAG,EAAE,CAAA;AACf,KAAC,CAAC,CAAA;AACFF,IAAAA,GAAG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A;AACF,KAAC,CAAC,CAAA;AAEF,IAAA,OAAOxB,GAAG,CAAA;GACX,CAAA;AACH,CAAA;MAEa4B,OAAO,GAAGN,UAAU,CAAC,CAC/B,CAAqBJ,mBAAAA,EAAAA,WAAW,CAACC,MAAM,CAACC,KAAM,CAAA,GAAA,CAAI,EAClD,CAAA,mBAAA,EAAqBF,WAAW,CAACC,MAAM,CAACC,KAAM,uBAAsBF,WAAW,CAACG,KAAK,CAACD,KAAM,CAAI,GAAA,CAAA,EAChG,CAAqBF,mBAAAA,EAAAA,WAAW,CAACG,KAAK,CAACD,KAAM,CAAA,GAAA,CAAI,CACnD;;;;"}
@@ -0,0 +1 @@
1
+ export declare const replaceDeprecated: (property: unknown, from: unknown, to: unknown, location: string, details?: string) => unknown;
@@ -0,0 +1,5 @@
1
+ import { RefObject } from "react";
2
+ export declare type VerticalPosition = "up" | "down";
3
+ export declare type HorizontalPosition = "left" | "right";
4
+ export declare type Position = [VerticalPosition, HorizontalPosition];
5
+ export declare const useAutoPosition: (anchorRef: RefObject<HTMLElement>, contentRef: RefObject<HTMLElement>, isActive: boolean) => Position;
@@ -0,0 +1,41 @@
1
+ import { useState, useLayoutEffect } from 'react';
2
+ import { useWindow } from './useWindow.js';
3
+ import { useDocument } from './useDocument.js';
4
+
5
+ const useAutoPosition = (anchorRef, contentRef, isActive) => {
6
+ const [verticalPosition, setVerticalPosition] = useState("down");
7
+ const [horizontalPosition, setHorizontalPosition] = useState("left");
8
+ const document = useDocument();
9
+ const window = useWindow();
10
+ useLayoutEffect(() => {
11
+ if (!contentRef) return;
12
+ if (isActive) {
13
+ const maxHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
14
+ const rect = contentRef.current.getBoundingClientRect();
15
+ const anchorHeight = anchorRef.current.getBoundingClientRect().height;
16
+ const anchorX = anchorRef.current.getBoundingClientRect().x;
17
+ const screenWidth = window.innerWidth;
18
+ const isUp = rect.top + rect.height > maxHeight;
19
+ const isDown = rect.top - anchorHeight < rect.height;
20
+ const isLeft = anchorX > screenWidth / 2;
21
+ const isRight = anchorX < screenWidth / 2;
22
+ if (isUp) {
23
+ setVerticalPosition("up");
24
+ } else if (isDown) {
25
+ setVerticalPosition("down");
26
+ }
27
+ if (isLeft) {
28
+ setHorizontalPosition("left");
29
+ } else if (isRight) {
30
+ setHorizontalPosition("right");
31
+ }
32
+ } else {
33
+ setVerticalPosition("down");
34
+ setHorizontalPosition("left");
35
+ }
36
+ }, [anchorRef, contentRef, document.documentElement.clientHeight, isActive, window.innerHeight, window.innerWidth]);
37
+ return [verticalPosition, horizontalPosition];
38
+ };
39
+
40
+ export { useAutoPosition };
41
+ //# sourceMappingURL=useAutoPosition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAutoPosition.js","sources":["../../../../src/shared/useAutoPosition.ts"],"sourcesContent":["import { useState, useLayoutEffect, RefObject } from \"react\";\n\nimport { useWindow } from \"./useWindow\";\nimport { useDocument } from \"./useDocument\";\n\nexport type VerticalPosition = \"up\" | \"down\";\nexport type HorizontalPosition = \"left\" | \"right\";\nexport type Position = [VerticalPosition, HorizontalPosition];\n\nexport const useAutoPosition = (\n anchorRef: RefObject<HTMLElement>,\n contentRef: RefObject<HTMLElement>,\n isActive: boolean\n): Position => {\n const [verticalPosition, setVerticalPosition] = useState(\n \"down\" as VerticalPosition\n );\n const [horizontalPosition, setHorizontalPosition] = useState(\n \"left\" as HorizontalPosition\n );\n const document = useDocument();\n const window = useWindow();\n\n useLayoutEffect(() => {\n if (!contentRef) return;\n\n if (isActive) {\n const maxHeight = Math.max(\n document.documentElement.clientHeight || 0,\n window.innerHeight || 0\n );\n\n const rect: DOMRect = contentRef.current.getBoundingClientRect();\n const anchorHeight = anchorRef.current.getBoundingClientRect().height;\n const anchorX = anchorRef.current.getBoundingClientRect().x;\n const screenWidth = window.innerWidth;\n\n const isUp = rect.top + rect.height > maxHeight;\n const isDown = rect.top - anchorHeight < rect.height;\n const isLeft = anchorX > screenWidth / 2;\n const isRight = anchorX < screenWidth / 2;\n\n if (isUp) {\n setVerticalPosition(\"up\");\n } else if (isDown) {\n setVerticalPosition(\"down\");\n }\n\n if (isLeft) {\n setHorizontalPosition(\"left\");\n } else if (isRight) {\n setHorizontalPosition(\"right\");\n }\n } else {\n setVerticalPosition(\"down\");\n setHorizontalPosition(\"left\");\n }\n }, [\n anchorRef,\n contentRef,\n document.documentElement.clientHeight,\n isActive,\n window.innerHeight,\n window.innerWidth,\n ]);\n\n return [verticalPosition, horizontalPosition];\n};\n"],"names":["useAutoPosition","anchorRef","contentRef","isActive","verticalPosition","setVerticalPosition","useState","horizontalPosition","setHorizontalPosition","document","useDocument","window","useWindow","useLayoutEffect","maxHeight","Math","max","documentElement","clientHeight","innerHeight","rect","current","getBoundingClientRect","anchorHeight","height","anchorX","x","screenWidth","innerWidth","isUp","top","isDown","isLeft","isRight"],"mappings":";;;;AASO,MAAMA,eAAe,GAAGA,CAC7BC,SAAiC,EACjCC,UAAkC,EAClCC,QAAiB,KACJ;EACb,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,QAAQ,CACtD,MACF,CAAC,CAAA;EACD,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGF,QAAQ,CAC1D,MACF,CAAC,CAAA;AACD,EAAA,MAAMG,QAAQ,GAAGC,WAAW,EAAE,CAAA;AAC9B,EAAA,MAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;AAE1BC,EAAAA,eAAe,CAAC,MAAM;IACpB,IAAI,CAACX,UAAU,EAAE,OAAA;AAEjB,IAAA,IAAIC,QAAQ,EAAE;AACZ,MAAA,MAAMW,SAAS,GAAGC,IAAI,CAACC,GAAG,CACxBP,QAAQ,CAACQ,eAAe,CAACC,YAAY,IAAI,CAAC,EAC1CP,MAAM,CAACQ,WAAW,IAAI,CACxB,CAAC,CAAA;MAED,MAAMC,IAAa,GAAGlB,UAAU,CAACmB,OAAO,CAACC,qBAAqB,EAAE,CAAA;MAChE,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declare function useDocument(): Document;
@@ -0,0 +1,6 @@
1
+ function useDocument() {
2
+ return document;
3
+ }
4
+
5
+ export { useDocument };
6
+ //# sourceMappingURL=useDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocument.js","sources":["../../../../src/shared/useDocument.ts"],"sourcesContent":["export function useDocument(): Document {\n return document;\n}\n"],"names":["useDocument","document"],"mappings":"AAAO,SAASA,WAAWA,GAAa;AACtC,EAAA,OAAOC,QAAQ,CAAA;AACjB;;;;"}
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare function useHover(ref: React.MutableRefObject<any>): boolean;
@@ -0,0 +1,25 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ function useHover(ref) {
4
+ const [hovered, setHovered] = useState(false);
5
+ const handleMouseOver = () => setHovered(true);
6
+ const handleMouseOut = () => setHovered(false);
7
+ useEffect(() => {
8
+ if (!ref) return undefined;
9
+ const node = ref.current;
10
+ if (node) {
11
+ node.addEventListener("mouseover", handleMouseOver);
12
+ node.addEventListener("mouseout", handleMouseOut);
13
+ return () => {
14
+ node.removeEventListener("mouseover", handleMouseOver);
15
+ node.removeEventListener("mouseout", handleMouseOut);
16
+ };
17
+ }
18
+ return undefined;
19
+ }, [ref]);
20
+ if (!ref) return null;
21
+ return hovered;
22
+ }
23
+
24
+ export { useHover };
25
+ //# sourceMappingURL=useHover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHover.js","sources":["../../../../src/shared/useHover.ts"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\n\nexport function useHover(ref: React.MutableRefObject<any>): boolean {\n const [hovered, setHovered] = useState(false);\n\n const handleMouseOver = () => setHovered(true);\n const handleMouseOut = () => setHovered(false);\n\n useEffect(() => {\n if (!ref) return undefined;\n const node = ref.current;\n if (node) {\n node.addEventListener(\"mouseover\", handleMouseOver);\n node.addEventListener(\"mouseout\", handleMouseOut);\n\n return () => {\n node.removeEventListener(\"mouseover\", handleMouseOver);\n node.removeEventListener(\"mouseout\", handleMouseOut);\n };\n }\n return undefined;\n }, [ref]);\n\n if (!ref) return null;\n return hovered;\n}\n"],"names":["useHover","ref","hovered","setHovered","useState","handleMouseOver","handleMouseOut","useEffect","undefined","node","current","addEventListener","removeEventListener"],"mappings":";;AAEO,SAASA,QAAQA,CAACC,GAAgC,EAAW;EAClE,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAE7C,EAAA,MAAMC,eAAe,GAAGA,MAAMF,UAAU,CAAC,IAAI,CAAC,CAAA;AAC9C,EAAA,MAAMG,cAAc,GAAGA,MAAMH,UAAU,CAAC,KAAK,CAAC,CAAA;AAE9CI,EAAAA,SAAS,CAAC,MAAM;AACd,IAAA,IAAI,CAACN,GAAG,EAAE,OAAOO,SAAS,CAAA;AAC1B,IAAA,MAAMC,IAAI,GAAGR,GAAG,CAACS,OAAO,CAAA;AACxB,IAAA,IAAID,IAAI,EAAE;AACRA,MAAAA,IAAI,CAACE,gBAAgB,CAAC,WAAW,EAAEN,eAAe,CAAC,CAAA;AACnDI,MAAAA,IAAI,CAACE,gBAAgB,CAAC,UAAU,EAAEL,cAAc,CAAC,CAAA;AAEjD,MAAA,OAAO,MAAM;AACXG,QAAAA,IAAI,CAACG,mBAAmB,CAAC,WAAW,EAAEP,eAAe,CAAC,CAAA;AACtDI,QAAAA,IAAI,CAACG,mBAAmB,CAAC,UAAU,EAAEN,cAAc,CAAC,CAAA;OACrD,CAAA;AACH,KAAA;AACA,IAAA,OAAOE,SAAS,CAAA;AAClB,GAAC,EAAE,CAACP,GAAG,CAAC,CAAC,CAAA;AAET,EAAA,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI,CAAA;AACrB,EAAA,OAAOC,OAAO,CAAA;AAChB;;;;"}
@@ -0,0 +1,17 @@
1
+ import { RefObject } from "react";
2
+ /**
3
+ * useKeyboard handles activation of keyboard hotkeys on a given element.
4
+ * @param {Record<string, (e: KeyboardEvent) => {}} config - A map of keyboardEvent code to function.
5
+ * @param {RefObject} ref - The element which the keyboard config has to apply on.
6
+ * @param {boolean} isActive - A flag to determine when the keyboard config has to be applied.
7
+ *
8
+ * Example:
9
+ * useKeyboard({
10
+ * Escape: closeMenu,
11
+ * ArrowUp: () => { doSomething() },
12
+ * KeyB: () => { console.log("bagi") },
13
+ * }, menuRef, menuOpen)
14
+ *
15
+ * This mean that these keyboard shortcuts will be applied on menuRef when the menu is opened.
16
+ */
17
+ export declare function useKeyboard(config: Record<string, (e: KeyboardEvent) => void | boolean>, ref: RefObject<any>, isActive: boolean): void;
@@ -0,0 +1,42 @@
1
+ import { useEffect } from 'react';
2
+ import { useDocument } from './useDocument.js';
3
+
4
+ /**
5
+ * useKeyboard handles activation of keyboard hotkeys on a given element.
6
+ * @param {Record<string, (e: KeyboardEvent) => {}} config - A map of keyboardEvent code to function.
7
+ * @param {RefObject} ref - The element which the keyboard config has to apply on.
8
+ * @param {boolean} isActive - A flag to determine when the keyboard config has to be applied.
9
+ *
10
+ * Example:
11
+ * useKeyboard({
12
+ * Escape: closeMenu,
13
+ * ArrowUp: () => { doSomething() },
14
+ * KeyB: () => { console.log("bagi") },
15
+ * }, menuRef, menuOpen)
16
+ *
17
+ * This mean that these keyboard shortcuts will be applied on menuRef when the menu is opened.
18
+ */
19
+
20
+ function useKeyboard(config, ref, isActive) {
21
+ const document = useDocument();
22
+ const handleKeyboard = event => {
23
+ if (!isActive) return;
24
+ if (document.activeElement !== ref.current && !ref.current.contains(document.activeElement)) return;
25
+ const targetConfigKey = Object.keys(config).find(targetKeys => targetKeys.split(" ").includes(event.code));
26
+ if (!targetConfigKey) return;
27
+ event.preventDefault();
28
+ const res = config[targetConfigKey](event);
29
+ if (res === false) {
30
+ event.stopPropagation();
31
+ }
32
+ };
33
+ useEffect(() => {
34
+ document.addEventListener("keydown", handleKeyboard);
35
+ return () => {
36
+ document.removeEventListener("keydown", handleKeyboard);
37
+ };
38
+ });
39
+ }
40
+
41
+ export { useKeyboard };
42
+ //# sourceMappingURL=useKeyboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyboard.js","sources":["../../../../src/shared/useKeyboard.ts"],"sourcesContent":["import { useEffect, RefObject } from \"react\";\nimport { useDocument } from \"./useDocument\";\n\n/**\n * useKeyboard handles activation of keyboard hotkeys on a given element.\n * @param {Record<string, (e: KeyboardEvent) => {}} config - A map of keyboardEvent code to function.\n * @param {RefObject} ref - The element which the keyboard config has to apply on.\n * @param {boolean} isActive - A flag to determine when the keyboard config has to be applied.\n *\n * Example:\n * useKeyboard({\n * Escape: closeMenu,\n * ArrowUp: () => { doSomething() },\n * KeyB: () => { console.log(\"bagi\") },\n * }, menuRef, menuOpen)\n *\n * This mean that these keyboard shortcuts will be applied on menuRef when the menu is opened.\n */\n\nexport function useKeyboard(\n config: Record<string, (e: KeyboardEvent) => void | boolean>,\n ref: RefObject<any>,\n isActive: boolean\n): void {\n const document = useDocument();\n const handleKeyboard = (event: KeyboardEvent) => {\n if (!isActive) return;\n\n if (\n document.activeElement !== ref.current &&\n !ref.current.contains(document.activeElement)\n )\n return;\n\n const targetConfigKey = Object.keys(config).find((targetKeys: string) =>\n targetKeys.split(\" \").includes(event.code)\n );\n if (!targetConfigKey) return;\n\n event.preventDefault();\n const res = config[targetConfigKey](event);\n if (res === false) {\n event.stopPropagation();\n }\n };\n\n useEffect(() => {\n document.addEventListener(\"keydown\", handleKeyboard);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyboard);\n };\n });\n}\n"],"names":["useKeyboard","config","ref","isActive","document","useDocument","handleKeyboard","event","activeElement","current","contains","targetConfigKey","Object","keys","find","targetKeys","split","includes","code","preventDefault","res","stopPropagation","useEffect","addEventListener","removeEventListener"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASA,WAAWA,CACzBC,MAA4D,EAC5DC,GAAmB,EACnBC,QAAiB,EACX;AACN,EAAA,MAAMC,QAAQ,GAAGC,WAAW,EAAE,CAAA;EAC9B,MAAMC,cAAc,GAAIC,KAAoB,IAAK;IAC/C,IAAI,CAACJ,QAAQ,EAAE,OAAA;AAEf,IAAA,IACEC,QAAQ,CAACI,aAAa,KAAKN,GAAG,CAACO,OAAO,IACtC,CAACP,GAAG,CAACO,OAAO,CAACC,QAAQ,CAACN,QAAQ,CAACI,aAAa,CAAC,EAE7C,OAAA;IAEF,MAAMG,eAAe,GAAGC,MAAM,CAACC,IAAI,CAACZ,MAAM,CAAC,CAACa,IAAI,CAAEC,UAAkB,IAClEA,UAAU,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,QAAQ,CAACV,KAAK,CAACW,IAAI,CAC3C,CAAC,CAAA;IACD,IAAI,CAACP,eAAe,EAAE,OAAA;IAEtBJ,KAAK,CAACY,cAAc,EAAE,CAAA;IACtB,MAAMC,GAAG,GAAGnB,MAAM,CAACU,eAAe,CAAC,CAACJ,KAAK,CAAC,CAAA;IAC1C,IAAIa,GAAG,KAAK,KAAK,EAAE;MACjBb,KAAK,CAACc,eAAe,EAAE,CAAA;AACzB,KAAA;GACD,CAAA;AAEDC,EAAAA,SAAS,CAAC,MAAM;AACdlB,IAAAA,QAAQ,CAACmB,gBAAgB,CAAC,SAAS,EAAEjB,cAAc,CAAC,CAAA;AAEpD,IAAA,OAAO,MAAM;AACXF,MAAAA,QAAQ,CAACoB,mBAAmB,CAAC,SAAS,EAAElB,cAAc,CAAC,CAAA;KACxD,CAAA;AACH,GAAC,CAAC,CAAA;AACJ;;;;"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const useOnEscapePress: (onEscape: (e: KeyboardEvent) => void, callbackDependencies?: import("react").DependencyList) => void;
@@ -0,0 +1,51 @@
1
+ import { useCallback, useMemo, useEffect } from 'react';
2
+ import { useDocument } from './useDocument.js';
3
+
4
+ const registry = {};
5
+ const handleEscape = event => {
6
+ if (!event.defaultPrevented) {
7
+ const handlers = Object.values(registry).reverse();
8
+ for (let i = 0; i < handlers.length; i += 1) {
9
+ const handler = handlers[i];
10
+ handler(event);
11
+ if (event.defaultPrevented) break;
12
+ }
13
+ }
14
+ };
15
+ const register = (id, handler) => {
16
+ registry[id] = handler;
17
+ };
18
+ const deregister = id => {
19
+ delete registry[id];
20
+ };
21
+
22
+ // For auto-incrementing unique identifiers for registered different handlers.
23
+ let handlerId = 0;
24
+ const useOnEscapePress = function (onEscape) {
25
+ let callbackDependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [onEscape];
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ const escapeCallback = useCallback(onEscape, callbackDependencies);
28
+ const document = useDocument();
29
+ const handler = useCallback(event => {
30
+ if (event.key === "Escape") escapeCallback(event);
31
+ }, [escapeCallback]);
32
+ const id = useMemo(() => {
33
+ handlerId += 1;
34
+ return handlerId;
35
+ }, []);
36
+ useEffect(() => {
37
+ if (Object.keys(registry).length === 0) {
38
+ document.addEventListener("keydown", handleEscape);
39
+ }
40
+ register(id, handler);
41
+ return () => {
42
+ deregister(id);
43
+ if (Object.keys(registry).length === 0) {
44
+ document.removeEventListener("keydown", handleEscape);
45
+ }
46
+ };
47
+ }, [id, handler, document]);
48
+ };
49
+
50
+ export { useOnEscapePress };
51
+ //# sourceMappingURL=useOnEscapePress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOnEscapePress.js","sources":["../../../../src/shared/useOnEscapePress.ts"],"sourcesContent":["import { useEffect, useCallback, useMemo } from \"react\";\nimport { useDocument } from \"./useDocument\";\n\ntype KeyboardEventCallback = (event: KeyboardEvent) => void;\n\nconst registry: { [id: number]: KeyboardEventCallback } = {};\n\nconst handleEscape = (event: KeyboardEvent) => {\n if (!event.defaultPrevented) {\n const handlers = Object.values(registry).reverse();\n\n for (let i = 0; i < handlers.length; i += 1) {\n const handler = handlers[i];\n\n handler(event);\n\n if (event.defaultPrevented) break;\n }\n }\n};\n\nconst register = (id: number, handler: KeyboardEventCallback): void => {\n registry[id] = handler;\n};\n\nconst deregister = (id: number) => {\n delete registry[id];\n};\n\n// For auto-incrementing unique identifiers for registered different handlers.\nlet handlerId = 0;\n\nexport const useOnEscapePress = (\n onEscape: (e: KeyboardEvent) => void,\n callbackDependencies: React.DependencyList = [onEscape]\n): void => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const escapeCallback = useCallback(onEscape, callbackDependencies);\n const document = useDocument();\n\n const handler = useCallback<KeyboardEventCallback>(\n (event) => {\n if (event.key === \"Escape\") escapeCallback(event);\n },\n [escapeCallback]\n );\n\n const id = useMemo(() => {\n handlerId += 1;\n return handlerId;\n }, []);\n\n useEffect(() => {\n if (Object.keys(registry).length === 0) {\n document.addEventListener(\"keydown\", handleEscape);\n }\n register(id, handler);\n\n return () => {\n deregister(id);\n if (Object.keys(registry).length === 0) {\n document.removeEventListener(\"keydown\", handleEscape);\n }\n };\n }, [id, handler, document]);\n};\n"],"names":["registry","handleEscape","event","defaultPrevented","handlers","Object","values","reverse","i","length","handler","register","id","deregister","handlerId","useOnEscapePress","onEscape","callbackDependencies","arguments","undefined","escapeCallback","useCallback","document","useDocument","key","useMemo","useEffect","keys","addEventListener","removeEventListener"],"mappings":";;;AAKA,MAAMA,QAAiD,GAAG,EAAE,CAAA;AAE5D,MAAMC,YAAY,GAAIC,KAAoB,IAAK;AAC7C,EAAA,IAAI,CAACA,KAAK,CAACC,gBAAgB,EAAE;IAC3B,MAAMC,QAAQ,GAAGC,MAAM,CAACC,MAAM,CAACN,QAAQ,CAAC,CAACO,OAAO,EAAE,CAAA;AAElD,IAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,QAAQ,CAACK,MAAM,EAAED,CAAC,IAAI,CAAC,EAAE;AAC3C,MAAA,MAAME,OAAO,GAAGN,QAAQ,CAACI,CAAC,CAAC,CAAA;MAE3BE,OAAO,CAACR,KAAK,CAAC,CAAA;MAEd,IAAIA,KAAK,CAACC,gBAAgB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AA;AACAU,IAAAA,QAAQ,CAACC,EAAE,EAAEF,OAAO,CAAC,CAAA;AAErB,IAAA,OAAO,MAAM;MACXG,UAAU,CAACD,EAAE,CAAC,CAAA;MACd,IAAIP,MAAM,CAACsB,IAAI,CAAC3B,QAAQ,CAAC,CAACS,MAAM,KAAK,CAAC,EAAE;AACtCa,QAAAA,QAAQ,CAACO,mBAAmB,CAAC,SAAS,EAAE5B,YAAY,CAAC,CAAA;AACvD,OAAA;KACD,CAAA;GACF,EAAE,CAACW,EAAE,EAAEF,OAAO,EAAEY,QAAQ,CAAC,CAAC,CAAA;AAC7B;;;;"}
@@ -0,0 +1,11 @@
1
+ import { RefObject } from "react";
2
+ /**
3
+ * useOutsideClick handles outside click of a given element.
4
+ * @param {RefObject} ref - Reference to a DOM element.
5
+ * @param {e: Event) => void} handler - Function invoked when a click is triggered outside the referenced element.
6
+ * @param {boolean} isActive - A flag to determine when the outside click event needs to be applied.
7
+ *
8
+ * Example: useOutsideClick(menuRef, closeMenu, menuIsOpen)
9
+ * Means that when a menu is opened, clicking outside of the menu will close the mneu.
10
+ */
11
+ export declare const useOutsideClick: (ref: RefObject<any>, handler: (e: Event) => void, isActive: boolean) => void;
@@ -0,0 +1,32 @@
1
+ import { useCallback, useEffect } from 'react';
2
+ import { useWindow } from './useWindow.js';
3
+
4
+ /**
5
+ * useOutsideClick handles outside click of a given element.
6
+ * @param {RefObject} ref - Reference to a DOM element.
7
+ * @param {e: Event) => void} handler - Function invoked when a click is triggered outside the referenced element.
8
+ * @param {boolean} isActive - A flag to determine when the outside click event needs to be applied.
9
+ *
10
+ * Example: useOutsideClick(menuRef, closeMenu, menuIsOpen)
11
+ * Means that when a menu is opened, clicking outside of the menu will close the mneu.
12
+ */
13
+
14
+ const useOutsideClick = (ref, handler, isActive) => {
15
+ const window = useWindow();
16
+ const outsideClickEvent = useCallback(e => {
17
+ if (ref && ref.current && !ref.current.contains(e.target)) {
18
+ handler(e);
19
+ }
20
+ }, [handler, ref]);
21
+ useEffect(() => {
22
+ if (isActive) {
23
+ window.addEventListener("click", outsideClickEvent);
24
+ }
25
+ return () => {
26
+ window.removeEventListener("click", outsideClickEvent);
27
+ };
28
+ }, [isActive, window, outsideClickEvent]);
29
+ };
30
+
31
+ export { useOutsideClick };
32
+ //# sourceMappingURL=useOutsideClick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOutsideClick.js","sources":["../../../../src/shared/useOutsideClick.ts"],"sourcesContent":["import { useEffect, useCallback, RefObject } from \"react\";\n\nimport { useWindow } from \"./useWindow\";\n\n/**\n * useOutsideClick handles outside click of a given element.\n * @param {RefObject} ref - Reference to a DOM element.\n * @param {e: Event) => void} handler - Function invoked when a click is triggered outside the referenced element.\n * @param {boolean} isActive - A flag to determine when the outside click event needs to be applied.\n *\n * Example: useOutsideClick(menuRef, closeMenu, menuIsOpen)\n * Means that when a menu is opened, clicking outside of the menu will close the mneu.\n */\n\nexport const useOutsideClick = (\n ref: RefObject<any>,\n handler: (e: Event) => void,\n isActive: boolean\n): void => {\n const window = useWindow();\n\n const outsideClickEvent = useCallback(\n (e: Event) => {\n if (ref && ref.current && !ref.current.contains(e.target)) {\n handler(e);\n }\n },\n [handler, ref]\n );\n\n useEffect(() => {\n if (isActive) {\n window.addEventListener(\"click\", outsideClickEvent);\n }\n\n return () => {\n window.removeEventListener(\"click\", outsideClickEvent);\n };\n }, [isActive, window, outsideClickEvent]);\n};\n"],"names":["useOutsideClick","ref","handler","isActive","window","useWindow","outsideClickEvent","useCallback","e","current","contains","target","useEffect","addEventListener","removeEventListener"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,eAAe,GAAGA,CAC7BC,GAAmB,EACnBC,OAA2B,EAC3BC,QAAiB,KACR;AACT,EAAA,MAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;AAE1B,EAAA,MAAMC,iBAAiB,GAAGC,WAAW,CAClCC,CAAQ,IAAK;AACZ,IAAA,IAAIP,GAAG,IAAIA,GAAG,CAACQ,OAAO,IAAI,CAACR,GAAG,CAACQ,OAAO,CAACC,QAAQ,CAACF,CAAC,CAACG,MAAM,CAAC,EAAE;MACzDT,OAAO,CAACM,CAAC,CAAC,CAAA;AACZ,KAAA;AACF,GAAC,EACD,CAACN,OAAO,EAAED,GAAG,CACf,CAAC,CAAA;AAEDW,EAAAA,SAAS,CAAC,MAAM;AACd,IAAA,IAAIT,QAAQ,EAAE;AACZC,MAAAA,MAAM,CAACS,gBAAgB,CAAC,OAAO,EAAEP,iBAAiB,CAAC,CAAA;AACrD,KAAA;AAEA,IAAA,OAAO,MAAM;AACXF,MAAAA,MAAM,CAACU,mBAAmB,CAAC,OAAO,EAAER,iBAAiB,CAAC,CAAA;KACvD,CAAA;GACF,EAAE,CAACH,QAAQ,EAAEC,MAAM,EAAEE,iBAAiB,CAAC,CAAC,CAAA;AAC3C;;;;"}
@@ -0,0 +1 @@
1
+ export declare function useWindow(): Window;
@@ -0,0 +1,6 @@
1
+ function useWindow() {
2
+ return window;
3
+ }
4
+
5
+ export { useWindow };
6
+ //# sourceMappingURL=useWindow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWindow.js","sources":["../../../../src/shared/useWindow.ts"],"sourcesContent":["export function useWindow(): Window {\n return window;\n}\n"],"names":["useWindow","window"],"mappings":"AAAO,SAASA,SAASA,GAAW;AAClC,EAAA,OAAOC,MAAM,CAAA;AACf;;;;"}
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" />
2
+ import { Literal, Union, Static } from "runtypes";
3
+ export declare const LinkTextSizeRuntype: Union<[Literal<"xs">, Literal<"s">, Literal<"m">, Literal<"l">]>;
4
+ export declare type LinkTextSize = Static<typeof LinkTextSizeRuntype>;
5
+ export declare const TextSizeRuntype: Union<[Literal<"xs">, Literal<"s">, Literal<"m">]>;
6
+ export declare type TextSize = Static<typeof TextSizeRuntype>;
7
+ export declare const BorderRadiusRuntype: Union<[Literal<"xs">, Literal<"s">, Literal<"m">]>;
8
+ export declare type BorderRadius = Static<typeof BorderRadiusRuntype>;
9
+ export declare const TextAlignmentRuntype: Union<[Literal<"left">, Literal<"right">, Literal<"center">]>;
10
+ export declare type TextAlignment = Static<typeof TextAlignmentRuntype>;
11
+ export declare const HorizontalAlignmentRuntype: Union<[Literal<"left">, Literal<"right">, Literal<"center">, Literal<"spaceBetween">]>;
12
+ export declare type HorizontalAlignment = Static<typeof HorizontalAlignmentRuntype>;
13
+ export declare const VerticalAlignmentRuntype: Union<[Literal<"top">, Literal<"bottom">, Literal<"center">, Literal<"stretch">]>;
14
+ export declare type VerticalAlignment = Static<typeof VerticalAlignmentRuntype>;
15
+ export declare const SpaceSizesRuntype: Union<[Literal<"zero">, Literal<"xxs">, Literal<"xs">, Literal<"s">, Literal<"m">, Literal<"l">, Literal<"xl">, Literal<"xxl">]>;
16
+ export declare type SpaceSizes = Static<typeof SpaceSizesRuntype>;
17
+ export declare const ColumsSizesRuntype: Union<[Literal<1>, Literal<2>, Literal<3>, Literal<4>, Literal<5>, Literal<6>, Literal<7>, Literal<8>, Literal<9>, Literal<10>, Literal<11>, Literal<12>, Literal<"auto">, Literal<"narrow">, Literal<"fill">]>;
18
+ export declare type ColumnSizes = Static<typeof ColumsSizesRuntype>;
19
+ export declare const ColumnAlignmentRunType: Union<[Literal<"auto">, Literal<"start">, Literal<"center">, Literal<"end">]>;
20
+ export declare type ColumnAlignment = Static<typeof ColumnAlignmentRunType>;
21
+ export declare const OrderRuntype: Union<[Literal<"first">, Literal<"last">, Literal<"unset">]>;
22
+ export declare type Order = Static<typeof OrderRuntype>;
23
+ export declare const BaseVariationsRuntype: Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>;
24
+ export declare const BaseColorsRuntype: Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>, Literal<"accent">]>;
25
+ export declare type BaseVariations = Static<typeof BaseVariationsRuntype>;
26
+ export declare type BaseColors = Static<typeof BaseColorsRuntype>;
27
+ declare const TextColorsRuntype: Union<[Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>, Literal<"accent">]>, Literal<"info">, Literal<"error">, Literal<"warning">]>;
28
+ export declare type TextColors = Static<typeof TextColorsRuntype>;
29
+ declare const TextVariationsRuntype: Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>, Literal<"info">, Literal<"error">, Literal<"warning">]>;
30
+ export declare type TextVariations = Static<typeof TextVariationsRuntype>;
31
+ declare const IconsColorsRuntime: Union<[Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>, Literal<"accent">]>, Literal<"info">, Literal<"error">, Literal<"warning">, Literal<"inherit">, Literal<"brand">, Literal<"quaternary">]>;
32
+ export declare type IconsColors = Static<typeof IconsColorsRuntime>;
33
+ declare const IconsVariationsRuntype: Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>, Literal<"info">, Literal<"error">, Literal<"warning">, Literal<"inherit">, Literal<"brand">]>;
34
+ export declare type IconsVariations = Static<typeof IconsVariationsRuntype>;
35
+ declare const CalloutVariationsRuntype: Union<[Literal<"info">, Literal<"success">, Literal<"error">, Literal<"warning">]>;
36
+ export declare type CalloutVariations = Static<typeof CalloutVariationsRuntype>;
37
+ declare const LinkVariationsRuntype: Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>]>;
38
+ export declare type LinkVariations = Static<typeof LinkVariationsRuntype>;
39
+ declare const LinkColorsRuntype: Union<[Union<[Union<[Literal<"primary">, Literal<"secondary">, Literal<"tertiary">]>, Literal<"accent">]>]>;
40
+ export declare type LinkColors = Static<typeof LinkColorsRuntype>;
41
+ export declare type MQ<T> = [T, T?, T?];
42
+ declare const ButtonSizeRuntype: Union<[Literal<"s">, Literal<"m">, Literal<"l">]>;
43
+ export declare type ButtonSize = Static<typeof ButtonSizeRuntype>;
44
+ export declare const HyphensRuntype: Union<[Literal<"auto">, Literal<"none">, Literal<"manual">]>;
45
+ export declare type Hyphens = Static<typeof HyphensRuntype>;
46
+ export declare const ToggleSizeRuntype: Union<[Literal<"s">, Literal<"m">]>;
47
+ export declare type ToggleSize = Static<typeof ToggleSizeRuntype>;
48
+ export declare type AsProp<C extends React.ElementType> = {
49
+ as?: C;
50
+ };
51
+ declare type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
52
+ export declare type PolymorphicComponentProps<C extends React.ElementType, Props> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
53
+ export declare type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>["ref"];
54
+ export declare type PolymorphicComponentPropsWithRef<C extends React.ElementType, Props> = PolymorphicComponentProps<C, Props> & {
55
+ ref?: PolymorphicRef<C>;
56
+ };
57
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amboss/design-system",
3
- "version": "1.15.2",
3
+ "version": "1.15.4",
4
4
  "description": "the design system for AMBOSS products",
5
5
  "author": "Bagrat Gobedashvili",
6
6
  "license": "ISC",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "engines": {
52
52
  "npm": ">=8.10.0",
53
- "node": "16.x.x"
53
+ "node": ">=16"
54
54
  },
55
55
  "scripts": {
56
56
  "clean": "rimraf build build-tokens",