intergalactic 15.106.0-prerelease.0 → 15.107.0-prerelease.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 (489) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/accordion/lib/cjs/Accordion.js +9 -9
  3. package/accordion/lib/es6/Accordion.js +9 -9
  4. package/accordion/package.json +1 -1
  5. package/animation/lib/cjs/Animation.js +11 -11
  6. package/animation/lib/cjs/Collapse.js +28 -28
  7. package/animation/lib/cjs/FadeInOut.js +28 -28
  8. package/animation/lib/cjs/Scale.js +28 -28
  9. package/animation/lib/cjs/Slide.js +28 -28
  10. package/animation/lib/cjs/Transform.js +28 -28
  11. package/animation/lib/es6/Animation.js +11 -11
  12. package/animation/lib/es6/Collapse.js +28 -28
  13. package/animation/lib/es6/FadeInOut.js +28 -28
  14. package/animation/lib/es6/Scale.js +28 -28
  15. package/animation/lib/es6/Slide.js +28 -28
  16. package/animation/lib/es6/Transform.js +28 -28
  17. package/animation/package.json +1 -1
  18. package/badge/lib/cjs/Badge.js +6 -6
  19. package/badge/lib/es6/Badge.js +6 -6
  20. package/badge/package.json +1 -1
  21. package/base-trigger/lib/cjs/BaseTrigger.js +18 -18
  22. package/base-trigger/lib/cjs/ButtonTrigger.js +3 -3
  23. package/base-trigger/lib/cjs/FilterTrigger.js +7 -7
  24. package/base-trigger/lib/cjs/LinkTrigger.js +12 -12
  25. package/base-trigger/lib/es6/BaseTrigger.js +18 -18
  26. package/base-trigger/lib/es6/ButtonTrigger.js +3 -3
  27. package/base-trigger/lib/es6/FilterTrigger.js +7 -7
  28. package/base-trigger/lib/es6/LinkTrigger.js +12 -12
  29. package/base-trigger/package.json +1 -1
  30. package/breadcrumbs/lib/cjs/Breadcrumbs.js +8 -8
  31. package/breadcrumbs/lib/es6/Breadcrumbs.js +8 -8
  32. package/breadcrumbs/package.json +1 -1
  33. package/breakpoints/package.json +1 -1
  34. package/button/lib/cjs/Button.js +27 -26
  35. package/button/lib/cjs/Button.js.map +1 -1
  36. package/button/lib/cjs/style/button.shadow.css +6 -0
  37. package/button/lib/es6/Button.js +27 -26
  38. package/button/lib/es6/Button.js.map +1 -1
  39. package/button/lib/es6/style/button.shadow.css +6 -0
  40. package/button/package.json +1 -1
  41. package/card/lib/cjs/Card.js +8 -8
  42. package/card/lib/es6/Card.js +8 -8
  43. package/card/package.json +1 -1
  44. package/carousel/lib/cjs/Carousel.js +21 -21
  45. package/carousel/lib/es6/Carousel.js +21 -21
  46. package/carousel/package.json +1 -1
  47. package/checkbox/lib/cjs/Checkbox.js +18 -18
  48. package/checkbox/lib/es6/Checkbox.js +18 -18
  49. package/checkbox/package.json +1 -1
  50. package/color-picker/PaletteManager.d.ts +64 -39
  51. package/color-picker/components/Item.d.ts +2 -1
  52. package/color-picker/lib/cjs/ColorPicker.js +34 -36
  53. package/color-picker/lib/cjs/ColorPicker.js.map +1 -1
  54. package/color-picker/lib/cjs/PaletteManager.js +39 -35
  55. package/color-picker/lib/cjs/PaletteManager.js.map +1 -1
  56. package/color-picker/lib/cjs/components/InputColor.js +24 -23
  57. package/color-picker/lib/cjs/components/InputColor.js.map +1 -1
  58. package/color-picker/lib/cjs/components/Item.js +26 -10
  59. package/color-picker/lib/cjs/components/Item.js.map +1 -1
  60. package/color-picker/lib/cjs/components/colors.js +10 -6
  61. package/color-picker/lib/cjs/components/colors.js.map +1 -1
  62. package/color-picker/lib/cjs/style/color-picker.shadow.css +4 -4
  63. package/color-picker/lib/cjs/translations/de.json +7 -7
  64. package/color-picker/lib/cjs/translations/en.json +7 -7
  65. package/color-picker/lib/cjs/translations/es.json +7 -7
  66. package/color-picker/lib/cjs/translations/fr.json +7 -7
  67. package/color-picker/lib/cjs/translations/it.json +7 -7
  68. package/color-picker/lib/cjs/translations/ja.json +7 -7
  69. package/color-picker/lib/cjs/translations/ko.json +7 -7
  70. package/color-picker/lib/cjs/translations/nl.json +7 -7
  71. package/color-picker/lib/cjs/translations/pl.json +7 -7
  72. package/color-picker/lib/cjs/translations/pt.json +7 -7
  73. package/color-picker/lib/cjs/translations/sv.json +7 -7
  74. package/color-picker/lib/cjs/translations/tr.json +7 -7
  75. package/color-picker/lib/cjs/translations/vi.json +7 -7
  76. package/color-picker/lib/cjs/translations/zh.json +7 -7
  77. package/color-picker/lib/es6/ColorPicker.js +34 -36
  78. package/color-picker/lib/es6/ColorPicker.js.map +1 -1
  79. package/color-picker/lib/es6/PaletteManager.js +39 -35
  80. package/color-picker/lib/es6/PaletteManager.js.map +1 -1
  81. package/color-picker/lib/es6/components/InputColor.js +24 -23
  82. package/color-picker/lib/es6/components/InputColor.js.map +1 -1
  83. package/color-picker/lib/es6/components/Item.js +26 -10
  84. package/color-picker/lib/es6/components/Item.js.map +1 -1
  85. package/color-picker/lib/es6/components/colors.js +11 -7
  86. package/color-picker/lib/es6/components/colors.js.map +1 -1
  87. package/color-picker/lib/es6/style/color-picker.shadow.css +4 -4
  88. package/color-picker/lib/es6/translations/de.json +7 -7
  89. package/color-picker/lib/es6/translations/en.json +7 -7
  90. package/color-picker/lib/es6/translations/es.json +7 -7
  91. package/color-picker/lib/es6/translations/fr.json +7 -7
  92. package/color-picker/lib/es6/translations/it.json +7 -7
  93. package/color-picker/lib/es6/translations/ja.json +7 -7
  94. package/color-picker/lib/es6/translations/ko.json +7 -7
  95. package/color-picker/lib/es6/translations/nl.json +7 -7
  96. package/color-picker/lib/es6/translations/pl.json +7 -7
  97. package/color-picker/lib/es6/translations/pt.json +7 -7
  98. package/color-picker/lib/es6/translations/sv.json +7 -7
  99. package/color-picker/lib/es6/translations/tr.json +7 -7
  100. package/color-picker/lib/es6/translations/vi.json +7 -7
  101. package/color-picker/lib/es6/translations/zh.json +7 -7
  102. package/color-picker/lib/types/PaletteManager.d.ts +64 -39
  103. package/color-picker/lib/types/components/Item.d.ts +2 -1
  104. package/color-picker/lib/types/translations/__intergalactic-dynamic-locales.d.ts +28 -28
  105. package/color-picker/package.json +1 -1
  106. package/color-picker/translations/__intergalactic-dynamic-locales.d.ts +28 -28
  107. package/components.json +73 -73
  108. package/core/package.json +1 -1
  109. package/counter/lib/cjs/Counter.js +11 -11
  110. package/counter/lib/es6/Counter.js +11 -11
  111. package/counter/package.json +1 -1
  112. package/d3-chart/lib/cjs/Area.js +11 -11
  113. package/d3-chart/lib/cjs/Axis.js +14 -14
  114. package/d3-chart/lib/cjs/Bar.js +16 -16
  115. package/d3-chart/lib/cjs/Bubble.js +12 -12
  116. package/d3-chart/lib/cjs/CompactHorizontalBar.js +16 -16
  117. package/d3-chart/lib/cjs/Donut.js +9 -9
  118. package/d3-chart/lib/cjs/Dots.js +8 -8
  119. package/d3-chart/lib/cjs/HorizontalBar.js +16 -16
  120. package/d3-chart/lib/cjs/Hover.js +3 -3
  121. package/d3-chart/lib/cjs/Line.js +9 -9
  122. package/d3-chart/lib/cjs/Plot.js +3 -3
  123. package/d3-chart/lib/cjs/Radar.js +19 -19
  124. package/d3-chart/lib/cjs/RadialTree.js +12 -12
  125. package/d3-chart/lib/cjs/Reference.js +12 -12
  126. package/d3-chart/lib/cjs/ScatterPlot.js +9 -9
  127. package/d3-chart/lib/cjs/Tooltip.js +9 -9
  128. package/d3-chart/lib/cjs/Venn.js +9 -9
  129. package/d3-chart/lib/cjs/a11y/PlotA11yModule.js +2 -2
  130. package/d3-chart/lib/cjs/a11y/PlotA11yView.js +2 -2
  131. package/d3-chart/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  132. package/d3-chart/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  133. package/d3-chart/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  134. package/d3-chart/lib/es6/Area.js +11 -11
  135. package/d3-chart/lib/es6/Axis.js +14 -14
  136. package/d3-chart/lib/es6/Bar.js +16 -16
  137. package/d3-chart/lib/es6/Bubble.js +12 -12
  138. package/d3-chart/lib/es6/CompactHorizontalBar.js +16 -16
  139. package/d3-chart/lib/es6/Donut.js +9 -9
  140. package/d3-chart/lib/es6/Dots.js +8 -8
  141. package/d3-chart/lib/es6/HorizontalBar.js +16 -16
  142. package/d3-chart/lib/es6/Hover.js +3 -3
  143. package/d3-chart/lib/es6/Line.js +9 -9
  144. package/d3-chart/lib/es6/Plot.js +3 -3
  145. package/d3-chart/lib/es6/Radar.js +19 -19
  146. package/d3-chart/lib/es6/RadialTree.js +12 -12
  147. package/d3-chart/lib/es6/Reference.js +12 -12
  148. package/d3-chart/lib/es6/ScatterPlot.js +9 -9
  149. package/d3-chart/lib/es6/Tooltip.js +9 -9
  150. package/d3-chart/lib/es6/Venn.js +9 -9
  151. package/d3-chart/lib/es6/a11y/PlotA11yModule.js +2 -2
  152. package/d3-chart/lib/es6/a11y/PlotA11yView.js +2 -2
  153. package/d3-chart/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  154. package/d3-chart/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  155. package/d3-chart/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  156. package/d3-chart/package.json +1 -1
  157. package/data-table/DataTable.d.ts +10 -0
  158. package/data-table/Head.d.ts +7 -2
  159. package/data-table/lib/cjs/Body.js +7 -8
  160. package/data-table/lib/cjs/Body.js.map +1 -1
  161. package/data-table/lib/cjs/DataTable.js +36 -36
  162. package/data-table/lib/cjs/DataTable.js.map +1 -1
  163. package/data-table/lib/cjs/Head.js +109 -39
  164. package/data-table/lib/cjs/Head.js.map +1 -1
  165. package/data-table/lib/cjs/style/data-table.shadow.css +1 -1
  166. package/data-table/lib/cjs/types.js.map +1 -1
  167. package/data-table/lib/es6/Body.js +7 -8
  168. package/data-table/lib/es6/Body.js.map +1 -1
  169. package/data-table/lib/es6/DataTable.js +36 -36
  170. package/data-table/lib/es6/DataTable.js.map +1 -1
  171. package/data-table/lib/es6/Head.js +109 -39
  172. package/data-table/lib/es6/Head.js.map +1 -1
  173. package/data-table/lib/es6/style/data-table.shadow.css +1 -1
  174. package/data-table/lib/es6/types.js.map +1 -1
  175. package/data-table/lib/types/DataTable.d.ts +10 -0
  176. package/data-table/lib/types/Head.d.ts +7 -2
  177. package/data-table/lib/types/types.d.ts +2 -0
  178. package/data-table/package.json +1 -1
  179. package/data-table/types.d.ts +2 -0
  180. package/date-picker/lib/cjs/components/Calendar.js +21 -21
  181. package/date-picker/lib/cjs/components/DateRangeComparatorAbstract.js +29 -29
  182. package/date-picker/lib/cjs/components/InputTrigger.js +29 -29
  183. package/date-picker/lib/cjs/components/PickerAbstract.js +29 -29
  184. package/date-picker/lib/cjs/components/RangePickerAbstract.js +29 -29
  185. package/date-picker/lib/es6/components/Calendar.js +21 -21
  186. package/date-picker/lib/es6/components/DateRangeComparatorAbstract.js +29 -29
  187. package/date-picker/lib/es6/components/InputTrigger.js +29 -29
  188. package/date-picker/lib/es6/components/PickerAbstract.js +29 -29
  189. package/date-picker/lib/es6/components/RangePickerAbstract.js +29 -29
  190. package/date-picker/package.json +1 -1
  191. package/divider/lib/cjs/Divider.js +10 -10
  192. package/divider/lib/es6/Divider.js +10 -10
  193. package/divider/package.json +1 -1
  194. package/dot/lib/cjs/Dot.js +10 -10
  195. package/dot/lib/es6/Dot.js +10 -10
  196. package/dot/package.json +1 -1
  197. package/drag-and-drop/lib/cjs/DragAndDrop.js +16 -16
  198. package/drag-and-drop/lib/es6/DragAndDrop.js +16 -16
  199. package/drag-and-drop/package.json +1 -1
  200. package/dropdown/lib/cjs/Dropdown.js +4 -4
  201. package/dropdown/lib/cjs/Dropdown.js.map +1 -1
  202. package/dropdown/lib/es6/Dropdown.js +4 -4
  203. package/dropdown/lib/es6/Dropdown.js.map +1 -1
  204. package/dropdown/package.json +1 -1
  205. package/dropdown-menu/index.d.ts +43 -1
  206. package/dropdown-menu/lib/cjs/DropdownMenu.js +449 -413
  207. package/dropdown-menu/lib/cjs/DropdownMenu.js.map +1 -1
  208. package/dropdown-menu/lib/cjs/DropdownMenuOld.js +682 -0
  209. package/dropdown-menu/lib/cjs/DropdownMenuOld.js.map +1 -0
  210. package/dropdown-menu/lib/cjs/index.d.js.map +1 -1
  211. package/dropdown-menu/lib/cjs/index.js +7 -0
  212. package/dropdown-menu/lib/cjs/index.js.map +1 -1
  213. package/dropdown-menu/lib/cjs/style/dropdown-menu-old.shadow.css +224 -0
  214. package/dropdown-menu/lib/cjs/style/dropdown-menu.shadow.css +24 -14
  215. package/dropdown-menu/lib/es6/DropdownMenu.js +453 -414
  216. package/dropdown-menu/lib/es6/DropdownMenu.js.map +1 -1
  217. package/dropdown-menu/lib/es6/DropdownMenuOld.js +683 -0
  218. package/dropdown-menu/lib/es6/DropdownMenuOld.js.map +1 -0
  219. package/dropdown-menu/lib/es6/index.d.js.map +1 -1
  220. package/dropdown-menu/lib/es6/index.js +1 -0
  221. package/dropdown-menu/lib/es6/index.js.map +1 -1
  222. package/dropdown-menu/lib/es6/style/dropdown-menu-old.shadow.css +224 -0
  223. package/dropdown-menu/lib/es6/style/dropdown-menu.shadow.css +24 -14
  224. package/dropdown-menu/lib/types/index.d.ts +43 -1
  225. package/dropdown-menu/package.json +1 -1
  226. package/ellipsis/lib/cjs/Ellipsis.js +10 -10
  227. package/ellipsis/lib/es6/Ellipsis.js +10 -10
  228. package/ellipsis/package.json +1 -1
  229. package/errors/lib/cjs/Error.js +9 -9
  230. package/errors/lib/es6/Error.js +9 -9
  231. package/errors/package.json +1 -1
  232. package/feature-popover/lib/cjs/FeaturePopover.js +11 -11
  233. package/feature-popover/lib/es6/FeaturePopover.js +11 -11
  234. package/feature-popover/package.json +1 -1
  235. package/feedback-form/lib/cjs/FeedbackForm.js +7 -7
  236. package/feedback-form/lib/cjs/component/checkbox-button/CheckboxButton.js +3 -3
  237. package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js +2 -2
  238. package/feedback-form/lib/cjs/component/slider-rating/SliderRating.js +6 -6
  239. package/feedback-form/lib/es6/FeedbackForm.js +7 -7
  240. package/feedback-form/lib/es6/component/checkbox-button/CheckboxButton.js +3 -3
  241. package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js +2 -2
  242. package/feedback-form/lib/es6/component/slider-rating/SliderRating.js +6 -6
  243. package/feedback-form/package.json +1 -1
  244. package/flags/lib/cjs/Flags.js +3 -3
  245. package/flags/lib/es6/Flags.js +3 -3
  246. package/flags/lib/sprites/sprite@1x.css +256 -256
  247. package/flags/lib/sprites/sprite@2x.css +257 -257
  248. package/flags/package.json +1 -1
  249. package/flex-box/lib/cjs/Box/useBox.js +3 -3
  250. package/flex-box/lib/cjs/Flex/useFlex.js +3 -3
  251. package/flex-box/lib/cjs/invalid-state-box/InvalidStateBox.js +2 -2
  252. package/flex-box/lib/es6/Box/useBox.js +3 -3
  253. package/flex-box/lib/es6/Flex/useFlex.js +3 -3
  254. package/flex-box/lib/es6/invalid-state-box/InvalidStateBox.js +2 -2
  255. package/flex-box/package.json +1 -1
  256. package/format-text/lib/cjs/FormatText.js +5 -5
  257. package/format-text/lib/es6/FormatText.js +5 -5
  258. package/format-text/package.json +1 -1
  259. package/fullscreen-modal/lib/cjs/FullscreenModal.js +13 -13
  260. package/fullscreen-modal/lib/es6/FullscreenModal.js +13 -13
  261. package/fullscreen-modal/package.json +1 -1
  262. package/grid/lib/cjs/Grid.js +114 -114
  263. package/grid/lib/es6/Grid.js +114 -114
  264. package/grid/package.json +1 -1
  265. package/i18n-unplugin/package.json +1 -1
  266. package/icon/CursorMove/m/index.js +1 -1
  267. package/icon/CursorMove/m/index.mjs +1 -1
  268. package/icon/color/Confluence/l/index.js +4 -4
  269. package/icon/color/Confluence/l/index.mjs +4 -4
  270. package/icon/color/Confluence/m/index.js +4 -4
  271. package/icon/color/Confluence/m/index.mjs +4 -4
  272. package/icon/color/MicrosoftOffice/l/index.js +10 -10
  273. package/icon/color/MicrosoftOffice/l/index.mjs +10 -10
  274. package/icon/color/MicrosoftOffice/m/index.js +10 -10
  275. package/icon/color/MicrosoftOffice/m/index.mjs +10 -10
  276. package/icon/lib/cjs/Icon.js +6 -6
  277. package/icon/lib/es6/Icon.js +6 -6
  278. package/icon/package.json +1 -1
  279. package/icon/pay/Discover/l/index.js +1 -1
  280. package/icon/pay/Discover/l/index.mjs +1 -1
  281. package/icon/pay/Discover/m/index.js +1 -1
  282. package/icon/pay/Discover/m/index.mjs +1 -1
  283. package/icon/pay/JCB/l/index.js +10 -10
  284. package/icon/pay/JCB/l/index.mjs +10 -10
  285. package/icon/pay/JCB/m/index.js +10 -10
  286. package/icon/pay/JCB/m/index.mjs +10 -10
  287. package/icon/pay/Visa/l/index.js +2 -2
  288. package/icon/pay/Visa/l/index.mjs +2 -2
  289. package/icon/pay/Visa/m/index.js +2 -2
  290. package/icon/pay/Visa/m/index.mjs +2 -2
  291. package/illustration/lib/cjs/index.js +1 -1
  292. package/illustration/lib/es6/index.js +1 -1
  293. package/illustration/package.json +1 -1
  294. package/inline-edit/lib/cjs/InlineEdit.js +4 -4
  295. package/inline-edit/lib/es6/InlineEdit.js +4 -4
  296. package/inline-edit/package.json +1 -1
  297. package/inline-input/lib/cjs/InlineInput.js +14 -14
  298. package/inline-input/lib/es6/InlineInput.js +14 -14
  299. package/inline-input/package.json +1 -1
  300. package/input/lib/cjs/Input.js +17 -17
  301. package/input/lib/es6/Input.js +17 -17
  302. package/input/package.json +1 -1
  303. package/input-mask/lib/cjs/InputMask.js +6 -6
  304. package/input-mask/lib/es6/InputMask.js +6 -6
  305. package/input-mask/package.json +1 -1
  306. package/input-number/lib/cjs/InputNumber.js +9 -9
  307. package/input-number/lib/es6/InputNumber.js +9 -9
  308. package/input-number/package.json +1 -1
  309. package/input-tags/lib/cjs/InputTags.js +12 -12
  310. package/input-tags/lib/es6/InputTags.js +12 -12
  311. package/input-tags/package.json +1 -1
  312. package/link/lib/cjs/Link.js +12 -12
  313. package/link/lib/es6/Link.js +12 -12
  314. package/link/package.json +1 -1
  315. package/mini-chart/lib/cjs/component/score/Donut.js +9 -9
  316. package/mini-chart/lib/cjs/component/score/Line.js +17 -17
  317. package/mini-chart/lib/cjs/component/trend/Bar.js +7 -7
  318. package/mini-chart/lib/cjs/component/trend/Line.js +7 -7
  319. package/mini-chart/lib/es6/component/score/Donut.js +9 -9
  320. package/mini-chart/lib/es6/component/score/Line.js +17 -17
  321. package/mini-chart/lib/es6/component/trend/Bar.js +7 -7
  322. package/mini-chart/lib/es6/component/trend/Line.js +7 -7
  323. package/mini-chart/package.json +1 -1
  324. package/modal/lib/cjs/Modal.js +8 -8
  325. package/modal/lib/es6/Modal.js +8 -8
  326. package/modal/package.json +1 -1
  327. package/neighbor-location/package.json +1 -1
  328. package/notice/index.d.ts +1 -1
  329. package/notice/lib/cjs/Notice.js +14 -14
  330. package/notice/lib/cjs/index.d.js.map +1 -1
  331. package/notice/lib/es6/Notice.js +14 -14
  332. package/notice/lib/es6/index.d.js.map +1 -1
  333. package/notice/lib/types/index.d.ts +1 -1
  334. package/notice/package.json +1 -1
  335. package/notice-bubble/lib/cjs/NoticeBubble.js +15 -15
  336. package/notice-bubble/lib/es6/NoticeBubble.js +15 -15
  337. package/notice-bubble/package.json +1 -1
  338. package/notice-global/index.d.ts +1 -1
  339. package/notice-global/lib/cjs/NoticeGlobal.js +11 -11
  340. package/notice-global/lib/cjs/index.d.js.map +1 -1
  341. package/notice-global/lib/es6/NoticeGlobal.js +11 -11
  342. package/notice-global/lib/es6/index.d.js.map +1 -1
  343. package/notice-global/lib/types/index.d.ts +1 -1
  344. package/notice-global/package.json +1 -1
  345. package/outside-click/package.json +1 -1
  346. package/package.json +1 -1
  347. package/pagination/lib/cjs/Pagination.js +10 -10
  348. package/pagination/lib/es6/Pagination.js +10 -10
  349. package/pagination/package.json +1 -1
  350. package/pills/lib/cjs/Pills.js +13 -13
  351. package/pills/lib/es6/Pills.js +13 -13
  352. package/pills/package.json +1 -1
  353. package/popper/lib/cjs/Popper.js +45 -69
  354. package/popper/lib/cjs/Popper.js.map +1 -1
  355. package/popper/lib/es6/Popper.js +46 -69
  356. package/popper/lib/es6/Popper.js.map +1 -1
  357. package/popper/package.json +1 -1
  358. package/portal/package.json +1 -1
  359. package/product-head/lib/cjs/Info.js +4 -4
  360. package/product-head/lib/cjs/ProductHead.js +5 -5
  361. package/product-head/lib/cjs/Title.js +4 -4
  362. package/product-head/lib/es6/Info.js +4 -4
  363. package/product-head/lib/es6/ProductHead.js +5 -5
  364. package/product-head/lib/es6/Title.js +4 -4
  365. package/product-head/package.json +1 -1
  366. package/progress-bar/lib/cjs/ProgressBar.js +15 -15
  367. package/progress-bar/lib/es6/ProgressBar.js +15 -15
  368. package/progress-bar/package.json +1 -1
  369. package/radio/lib/cjs/Radio.js +16 -16
  370. package/radio/lib/es6/Radio.js +16 -16
  371. package/radio/package.json +1 -1
  372. package/scroll-area/lib/cjs/ScrollArea.js +21 -21
  373. package/scroll-area/lib/cjs/ScrollBar.js +6 -6
  374. package/scroll-area/lib/es6/ScrollArea.js +21 -21
  375. package/scroll-area/lib/es6/ScrollBar.js +6 -6
  376. package/scroll-area/package.json +1 -1
  377. package/select/lib/cjs/InputSearch.js +6 -6
  378. package/select/lib/cjs/Select.js +23 -21
  379. package/select/lib/cjs/Select.js.map +1 -1
  380. package/select/lib/es6/InputSearch.js +6 -6
  381. package/select/lib/es6/Select.js +13 -10
  382. package/select/lib/es6/Select.js.map +1 -1
  383. package/select/package.json +1 -1
  384. package/side-panel/lib/cjs/SidePanel.js +19 -19
  385. package/side-panel/lib/es6/SidePanel.js +19 -19
  386. package/side-panel/package.json +1 -1
  387. package/skeleton/lib/cjs/Charts/Area.js +9 -9
  388. package/skeleton/lib/cjs/Charts/Bar.js +9 -9
  389. package/skeleton/lib/cjs/Charts/Bubble.js +9 -9
  390. package/skeleton/lib/cjs/Charts/CompactHorizontalBar.js +9 -9
  391. package/skeleton/lib/cjs/Charts/Donut.js +9 -9
  392. package/skeleton/lib/cjs/Charts/Histogram.js +9 -9
  393. package/skeleton/lib/cjs/Charts/Line.js +9 -9
  394. package/skeleton/lib/cjs/Charts/RadialTree.js +9 -9
  395. package/skeleton/lib/cjs/Charts/ScatterPlot.js +9 -9
  396. package/skeleton/lib/cjs/Charts/Venn.js +9 -9
  397. package/skeleton/lib/cjs/Skeleton.js +8 -8
  398. package/skeleton/lib/es6/Charts/Area.js +9 -9
  399. package/skeleton/lib/es6/Charts/Bar.js +9 -9
  400. package/skeleton/lib/es6/Charts/Bubble.js +9 -9
  401. package/skeleton/lib/es6/Charts/CompactHorizontalBar.js +9 -9
  402. package/skeleton/lib/es6/Charts/Donut.js +9 -9
  403. package/skeleton/lib/es6/Charts/Histogram.js +9 -9
  404. package/skeleton/lib/es6/Charts/Line.js +9 -9
  405. package/skeleton/lib/es6/Charts/RadialTree.js +9 -9
  406. package/skeleton/lib/es6/Charts/ScatterPlot.js +9 -9
  407. package/skeleton/lib/es6/Charts/Venn.js +9 -9
  408. package/skeleton/lib/es6/Skeleton.js +8 -8
  409. package/skeleton/package.json +1 -1
  410. package/slider/lib/cjs/Slider.js +8 -8
  411. package/slider/lib/es6/Slider.js +8 -8
  412. package/slider/package.json +1 -1
  413. package/spin/lib/cjs/Spin.js +13 -13
  414. package/spin/lib/es6/Spin.js +13 -13
  415. package/spin/package.json +1 -1
  416. package/spin-container/lib/cjs/SpinContainer.js +8 -8
  417. package/spin-container/lib/es6/SpinContainer.js +8 -8
  418. package/spin-container/package.json +1 -1
  419. package/sticky/lib/cjs/Sticky.js +2 -2
  420. package/sticky/lib/es6/Sticky.js +2 -2
  421. package/sticky/package.json +1 -1
  422. package/switch/lib/cjs/Switch.js +21 -21
  423. package/switch/lib/es6/Switch.js +21 -21
  424. package/switch/package.json +1 -1
  425. package/tab-line/lib/cjs/TabLine.js +13 -13
  426. package/tab-line/lib/es6/TabLine.js +13 -13
  427. package/tab-line/package.json +1 -1
  428. package/tab-panel/lib/cjs/TabPanel.js +8 -8
  429. package/tab-panel/lib/es6/TabPanel.js +8 -8
  430. package/tab-panel/package.json +1 -1
  431. package/tag/lib/cjs/Tag.js +23 -23
  432. package/tag/lib/es6/Tag.js +23 -23
  433. package/tag/package.json +1 -1
  434. package/textarea/lib/cjs/Textarea.js +8 -8
  435. package/textarea/lib/es6/Textarea.js +8 -8
  436. package/textarea/package.json +1 -1
  437. package/time-picker/lib/cjs/TimePicker.js +12 -12
  438. package/time-picker/lib/es6/TimePicker.js +12 -12
  439. package/time-picker/package.json +1 -1
  440. package/tooltip/lib/cjs/Tooltip.js +9 -9
  441. package/tooltip/lib/cjs/style/tooltip.shadow.css +0 -5
  442. package/tooltip/lib/es6/Tooltip.js +9 -9
  443. package/tooltip/lib/es6/style/tooltip.shadow.css +0 -5
  444. package/tooltip/package.json +1 -1
  445. package/typography/lib/cjs/Blockquote.js +4 -4
  446. package/typography/lib/cjs/Hint.js +7 -7
  447. package/typography/lib/cjs/List.js +5 -5
  448. package/typography/lib/cjs/Text.js +34 -34
  449. package/typography/lib/es6/Blockquote.js +4 -4
  450. package/typography/lib/es6/Hint.js +7 -7
  451. package/typography/lib/es6/List.js +5 -5
  452. package/typography/lib/es6/Text.js +34 -34
  453. package/typography/package.json +1 -1
  454. package/utils/lib/components/invalid-state-pattern/InvalidStatePattern.js +2 -2
  455. package/utils/lib/components/invalid-state-pattern/InvalidStatePattern.mjs +2 -2
  456. package/utils/lib/enhances/focusSourceEnhance.d.ts +15 -0
  457. package/utils/lib/enhances/focusSourceEnhance.js +75 -0
  458. package/utils/lib/enhances/focusSourceEnhance.js.map +1 -0
  459. package/utils/lib/enhances/focusSourceEnhance.mjs +66 -0
  460. package/utils/lib/enhances/focusSourceEnhance.mjs.map +1 -0
  461. package/utils/lib/enhances/keyboardFocusEnhance.d.ts +2 -1
  462. package/utils/lib/enhances/keyboardFocusEnhance.js +9 -57
  463. package/utils/lib/enhances/keyboardFocusEnhance.js.map +1 -1
  464. package/utils/lib/enhances/keyboardFocusEnhance.mjs +5 -54
  465. package/utils/lib/enhances/keyboardFocusEnhance.mjs.map +1 -1
  466. package/utils/lib/focus-lock/iframeBorders.d.ts +3 -0
  467. package/utils/lib/focus-lock/iframeBorders.js +61 -0
  468. package/utils/lib/focus-lock/iframeBorders.js.map +1 -0
  469. package/utils/lib/focus-lock/iframeBorders.mjs +52 -0
  470. package/utils/lib/focus-lock/iframeBorders.mjs.map +1 -0
  471. package/utils/lib/injectStyle.js +1 -1
  472. package/utils/lib/injectStyle.mjs +1 -1
  473. package/utils/lib/themes/auto.css +4 -0
  474. package/utils/lib/themes/dark.css +2 -0
  475. package/utils/lib/themes/dark.json +1 -0
  476. package/utils/lib/themes/default.css +2 -0
  477. package/utils/lib/themes/default.json +1 -0
  478. package/utils/lib/themes/light.css +2 -0
  479. package/utils/lib/themes/light.json +1 -0
  480. package/utils/lib/use/useFocusLock.js +10 -2
  481. package/utils/lib/use/useFocusLock.js.map +1 -1
  482. package/utils/lib/use/useFocusLock.mjs +10 -2
  483. package/utils/lib/use/useFocusLock.mjs.map +1 -1
  484. package/widget-empty/lib/cjs/WidgetEmpty.js +5 -5
  485. package/widget-empty/lib/es6/WidgetEmpty.js +5 -5
  486. package/widget-empty/package.json +1 -1
  487. package/wizard/lib/cjs/Wizard.js +11 -11
  488. package/wizard/lib/es6/Wizard.js +11 -11
  489. package/wizard/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import assignProps from "../assignProps.mjs";
3
+ var lastFocusSource = 'none';
4
+ var focusSourceListeners = [];
5
+ export var useFocusSource = function useFocusSource() {
6
+ var handleMouseDown = React.useCallback(function () {
7
+ return focusSourceListeners.forEach(function (listener) {
8
+ return listener.setFocusSource('mouse');
9
+ });
10
+ }, []);
11
+ var handleKeyDown = React.useCallback(function () {
12
+ return focusSourceListeners.forEach(function (listener) {
13
+ return listener.setFocusSource('keyboard');
14
+ });
15
+ }, []);
16
+ var focusSourceRef = React.useRef(lastFocusSource);
17
+ var setFocusSource = React.useCallback(function (source) {
18
+ focusSourceRef.current = source;
19
+ lastFocusSource = source;
20
+ }, []);
21
+ var subscribeListeners = React.useCallback(function () {
22
+ document.addEventListener('mousedown', handleMouseDown, {
23
+ capture: true
24
+ });
25
+ document.addEventListener('keydown', handleKeyDown, {
26
+ capture: true
27
+ });
28
+ }, []);
29
+ var unsubscribeListeners = React.useCallback(function () {
30
+ document.removeEventListener('mousedown', handleMouseDown, {
31
+ capture: true
32
+ });
33
+ document.removeEventListener('keydown', handleKeyDown, {
34
+ capture: true
35
+ });
36
+ }, []);
37
+ React.useEffect(function () {
38
+ var needToAddListeners = focusSourceListeners.length === 0;
39
+ var sourceListener = {
40
+ setFocusSource: setFocusSource,
41
+ subscribeListeners: subscribeListeners
42
+ };
43
+ focusSourceListeners.push(sourceListener);
44
+ if (needToAddListeners) subscribeListeners();
45
+ var needToRemoveListeners = needToAddListeners;
46
+ return function () {
47
+ var sourceListenerIndex = focusSourceListeners.indexOf(sourceListener);
48
+ focusSourceListeners.splice(sourceListenerIndex, 1);
49
+ if (needToRemoveListeners) unsubscribeListeners();
50
+ if (needToRemoveListeners && focusSourceListeners.length > 0) {
51
+ focusSourceListeners[0].subscribeListeners();
52
+ }
53
+ };
54
+ }, []);
55
+ return focusSourceRef;
56
+ };
57
+ var focusSourceEnhance = function focusSourceEnhance() {
58
+ return function (props) {
59
+ var focusSourceRef = useFocusSource();
60
+ return assignProps(props, {
61
+ focusSourceRef: focusSourceRef
62
+ });
63
+ };
64
+ };
65
+ export default focusSourceEnhance;
66
+ //# sourceMappingURL=focusSourceEnhance.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusSourceEnhance.mjs","names":["React","assignProps","lastFocusSource","focusSourceListeners","useFocusSource","handleMouseDown","useCallback","forEach","listener","setFocusSource","handleKeyDown","focusSourceRef","useRef","source","current","subscribeListeners","document","addEventListener","capture","unsubscribeListeners","removeEventListener","useEffect","needToAddListeners","length","sourceListener","push","needToRemoveListeners","sourceListenerIndex","indexOf","splice","focusSourceEnhance","props"],"sources":["../../src/enhances/focusSourceEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../assignProps';\n\nlet lastFocusSource: 'mouse' | 'keyboard' | 'none' = 'none';\nconst focusSourceListeners: {\n setFocusSource: (source: 'mouse' | 'keyboard' | 'none') => void;\n subscribeListeners: () => void;\n}[] = [];\nexport const useFocusSource = () => {\n const handleMouseDown = React.useCallback(\n () => focusSourceListeners.forEach((listener) => listener.setFocusSource('mouse')),\n [],\n );\n const handleKeyDown = React.useCallback(\n () => focusSourceListeners.forEach((listener) => listener.setFocusSource('keyboard')),\n [],\n );\n const focusSourceRef = React.useRef<'none' | 'mouse' | 'keyboard'>(lastFocusSource);\n const setFocusSource = React.useCallback((source: 'none' | 'mouse' | 'keyboard') => {\n focusSourceRef.current = source;\n lastFocusSource = source;\n }, []);\n const subscribeListeners = React.useCallback(() => {\n document.addEventListener('mousedown', handleMouseDown, { capture: true });\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n }, []);\n const unsubscribeListeners = React.useCallback(() => {\n document.removeEventListener('mousedown', handleMouseDown, { capture: true });\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, []);\n\n React.useEffect(() => {\n const needToAddListeners = focusSourceListeners.length === 0;\n const sourceListener = { setFocusSource, subscribeListeners };\n focusSourceListeners.push(sourceListener);\n if (needToAddListeners) subscribeListeners();\n const needToRemoveListeners = needToAddListeners;\n\n return () => {\n const sourceListenerIndex = focusSourceListeners.indexOf(sourceListener);\n focusSourceListeners.splice(sourceListenerIndex, 1);\n if (needToRemoveListeners) unsubscribeListeners();\n if (needToRemoveListeners && focusSourceListeners.length > 0) {\n focusSourceListeners[0].subscribeListeners();\n }\n };\n }, []);\n\n return focusSourceRef;\n};\n\nexport type FocusSourceEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst focusSourceEnhance = (): FocusSourceEnhanceHook => {\n return (props) => {\n const focusSourceRef = useFocusSource();\n\n return assignProps(props, {\n focusSourceRef,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} from './focusSourceEnhance';
4
+ export { useFocusSource };
3
5
  /** @deprecated */
4
6
  export interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {
5
7
  }
@@ -12,7 +14,6 @@ export type KeyboardFocusProps = {
12
14
  autoFocus?: boolean;
13
15
  };
14
16
  export declare const enforcedKeyboardFocusEnhanceContext: React.Context<boolean>;
15
- export declare const useFocusSource: () => React.MutableRefObject<"none" | "mouse" | "keyboard">;
16
17
  export type KeyboardFocusEnhanceHook = (props: {
17
18
  tabIndex?: number;
18
19
  disabled?: boolean;
@@ -4,67 +4,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useFocusSource = exports.enforcedKeyboardFocusEnhanceContext = exports["default"] = void 0;
7
+ exports.enforcedKeyboardFocusEnhanceContext = exports["default"] = void 0;
8
+ Object.defineProperty(exports, "useFocusSource", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _focusSourceEnhance.useFocusSource;
12
+ }
13
+ });
8
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
15
  var _react = _interopRequireDefault(require("react"));
10
16
  var _assignProps = _interopRequireDefault(require("../assignProps"));
17
+ var _focusSourceEnhance = require("./focusSourceEnhance");
11
18
  var enforcedKeyboardFocusEnhanceContext = /*#__PURE__*/_react["default"].createContext(false);
12
19
  exports.enforcedKeyboardFocusEnhanceContext = enforcedKeyboardFocusEnhanceContext;
13
- var lastFocusSource = 'none';
14
- var focusSourceListeners = [];
15
- var useFocusSource = function useFocusSource() {
16
- var handleMouseDown = _react["default"].useCallback(function () {
17
- return focusSourceListeners.forEach(function (listener) {
18
- return listener.setFocusSource('mouse');
19
- });
20
- }, []);
21
- var handleKeyDown = _react["default"].useCallback(function () {
22
- return focusSourceListeners.forEach(function (listener) {
23
- return listener.setFocusSource('keyboard');
24
- });
25
- }, []);
26
- var focusSourceRef = _react["default"].useRef(lastFocusSource);
27
- var setFocusSource = _react["default"].useCallback(function (source) {
28
- focusSourceRef.current = source;
29
- lastFocusSource = source;
30
- }, []);
31
- var subscribeListeners = _react["default"].useCallback(function () {
32
- document.addEventListener('mousedown', handleMouseDown, {
33
- capture: true
34
- });
35
- document.addEventListener('keydown', handleKeyDown, {
36
- capture: true
37
- });
38
- }, []);
39
- var unsubscribeListeners = _react["default"].useCallback(function () {
40
- document.removeEventListener('mousedown', handleMouseDown, {
41
- capture: true
42
- });
43
- document.removeEventListener('keydown', handleKeyDown, {
44
- capture: true
45
- });
46
- }, []);
47
- _react["default"].useEffect(function () {
48
- var needToAddListeners = focusSourceListeners.length === 0;
49
- var sourceListener = {
50
- setFocusSource: setFocusSource,
51
- subscribeListeners: subscribeListeners
52
- };
53
- focusSourceListeners.push(sourceListener);
54
- if (needToAddListeners) subscribeListeners();
55
- var needToRemoveListeners = needToAddListeners;
56
- return function () {
57
- var sourceListenerIndex = focusSourceListeners.indexOf(sourceListener);
58
- focusSourceListeners.splice(sourceListenerIndex, 1);
59
- if (needToRemoveListeners) unsubscribeListeners();
60
- if (needToRemoveListeners && focusSourceListeners.length > 0) {
61
- focusSourceListeners[0].subscribeListeners();
62
- }
63
- };
64
- }, []);
65
- return focusSourceRef;
66
- };
67
- exports.useFocusSource = useFocusSource;
68
20
  var keyboardFocusEnhance = function keyboardFocusEnhance() {
69
21
  var makeFocusable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
70
22
  return function (props) {
@@ -76,7 +28,7 @@ var keyboardFocusEnhance = function keyboardFocusEnhance() {
76
28
  _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
77
29
  keyboardFocused = _React$useState2[0],
78
30
  setKeyboardFocused = _React$useState2[1];
79
- var focusSourceRef = useFocusSource();
31
+ var focusSourceRef = (0, _focusSourceEnhance.useFocusSource)();
80
32
  var ref = _react["default"].useRef(null);
81
33
  var handleFocus = _react["default"].useCallback(function (event) {
82
34
  if (event.isTrusted === true) {
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardFocusEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","enforcedKeyboardFocusEnhanceContext","React","createContext","exports","lastFocusSource","focusSourceListeners","useFocusSource","handleMouseDown","useCallback","forEach","listener","setFocusSource","handleKeyDown","focusSourceRef","useRef","source","current","subscribeListeners","document","addEventListener","capture","unsubscribeListeners","removeEventListener","useEffect","needToAddListeners","length","sourceListener","push","needToRemoveListeners","sourceListenerIndex","indexOf","splice","keyboardFocusEnhance","makeFocusable","arguments","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray2","keyboardFocused","setKeyboardFocused","ref","handleFocus","event","isTrusted","handlerBlur","timer","setTimeout","_ref$current","focus","clearTimeout","enforcedKeyboardFocus","useContext","assignProps","onFocus","onBlur","_default"],"sources":["../../src/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../core';\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nlet lastFocusSource: 'mouse' | 'keyboard' | 'none' = 'none';\nconst focusSourceListeners: {\n setFocusSource: (source: 'mouse' | 'keyboard' | 'none') => void;\n subscribeListeners: () => void;\n}[] = [];\nexport const useFocusSource = () => {\n const handleMouseDown = React.useCallback(\n () => focusSourceListeners.forEach((listener) => listener.setFocusSource('mouse')),\n [],\n );\n const handleKeyDown = React.useCallback(\n () => focusSourceListeners.forEach((listener) => listener.setFocusSource('keyboard')),\n [],\n );\n const focusSourceRef = React.useRef<'none' | 'mouse' | 'keyboard'>(lastFocusSource);\n const setFocusSource = React.useCallback((source: 'none' | 'mouse' | 'keyboard') => {\n focusSourceRef.current = source;\n lastFocusSource = source;\n }, []);\n const subscribeListeners = React.useCallback(() => {\n document.addEventListener('mousedown', handleMouseDown, { capture: true });\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n }, []);\n const unsubscribeListeners = React.useCallback(() => {\n document.removeEventListener('mousedown', handleMouseDown, { capture: true });\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, []);\n\n React.useEffect(() => {\n const needToAddListeners = focusSourceListeners.length === 0;\n const sourceListener = { setFocusSource, subscribeListeners };\n focusSourceListeners.push(sourceListener);\n if (needToAddListeners) subscribeListeners();\n const needToRemoveListeners = needToAddListeners;\n\n return () => {\n const sourceListenerIndex = focusSourceListeners.indexOf(sourceListener);\n focusSourceListeners.splice(sourceListenerIndex, 1);\n if (needToRemoveListeners) unsubscribeListeners();\n if (needToRemoveListeners && focusSourceListeners.length > 0) {\n focusSourceListeners[0].subscribeListeners();\n }\n };\n }, []);\n\n return focusSourceRef;\n};\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const focusSourceRef = useFocusSource();\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (focusSourceRef.current !== 'keyboard') return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAeO,IAAME,mCAAmC,gBAAGC,iBAAK,CAACC,aAAa,CAAC,KAAK,CAAC;AAACC,OAAA,CAAAH,mCAAA,GAAAA,mCAAA;AAE9E,IAAII,eAA8C,GAAG,MAAM;AAC3D,IAAMC,oBAGH,GAAG,EAAE;AACD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAClC,IAAMC,eAAe,GAAGN,iBAAK,CAACO,WAAW,CACvC;IAAA,OAAMH,oBAAoB,CAACI,OAAO,CAAC,UAACC,QAAQ;MAAA,OAAKA,QAAQ,CAACC,cAAc,CAAC,OAAO,CAAC;IAAA,EAAC;EAAA,GAClF,EAAE,CACH;EACD,IAAMC,aAAa,GAAGX,iBAAK,CAACO,WAAW,CACrC;IAAA,OAAMH,oBAAoB,CAACI,OAAO,CAAC,UAACC,QAAQ;MAAA,OAAKA,QAAQ,CAACC,cAAc,CAAC,UAAU,CAAC;IAAA,EAAC;EAAA,GACrF,EAAE,CACH;EACD,IAAME,cAAc,GAAGZ,iBAAK,CAACa,MAAM,CAAgCV,eAAe,CAAC;EACnF,IAAMO,cAAc,GAAGV,iBAAK,CAACO,WAAW,CAAC,UAACO,MAAqC,EAAK;IAClFF,cAAc,CAACG,OAAO,G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kB,CAAC,KAAK,CAAC;IAAA,GAAE,EAAE,CAAC;IAC1E9C,iBAAK,CAACsB,SAAS,CAAC,YAAM;MACpB,IAAI,OAAOe,SAAS,KAAK,QAAQ,IAAI,CAACA,SAAS,EAAE;MACjD,IAAMe,KAAK,GAAGC,UAAU,CAAC,YAAM;QAAA,IAAAC,YAAA;QAC7B,CAAAA,YAAA,GAAAP,GAAG,CAAChC,OAAO,cAAAuC,YAAA,uBAAXA,YAAA,CAAaC,KAAK,EAAE;QACpBT,kBAAkB,CAAC,IAAI,CAAC;MAC1B,CAAC,EAAE,CAAC,CAAC;MACL,OAAO,YAAM;QACXU,YAAY,CAACJ,KAAK,CAAC;MACrB,CAAC;IACH,CAAC,EAAE,CAACf,SAAS,CAAC,CAAC;IACfrC,iBAAK,CAACsB,SAAS,CAAC,YAAM;MACpB,IAAIgB,QAAQ,EAAE;QACZQ,kBAAkB,CAAC,KAAK,CAAC;MAC3B;IACF,CAAC,EAAE,CAACR,QAAQ,CAAC,CAAC;IAEd,IAAMmB,qBAAqB,GAAGzD,iBAAK,CAAC0D,UAAU,CAAC3D,mCAAmC,CAAC;IAEnF,OAAO,IAAA4D,uBAAW,EAACxB,KAAK,EAAE;MACxBK,QAAQ,EAAEF,QAAQ,GAAG,CAAC,CAAC,GAAGE,QAAQ;MAClCK,eAAe,EAAE,CAACA,eAAe,IAAIY,qBAAqB,KAAK,CAACnB,QAAQ;MACxEsB,OAAO,EAAEZ,WAAW;MACpBa,MAAM,EAAEV,WAAW;MACnBJ,GAAG,EAAHA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAe,QAAA,GAEa/B,oBAAoB;AAAA7B,OAAA,cAAA4D,QAAA"}
1
+ {"version":3,"file":"keyboardFocusEnhance.js","names":["_react","_interopRequireDefault","require","_assignProps","_focusSourceEnhance","enforcedKeyboardFocusEnhanceContext","React","createContext","exports","keyboardFocusEnhance","makeFocusable","arguments","length","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray2","keyboardFocused","setKeyboardFocused","focusSourceRef","useFocusSource","ref","useRef","handleFocus","useCallback","event","isTrusted","current","handlerBlur","useEffect","timer","setTimeout","_ref$current","focus","clearTimeout","enforcedKeyboardFocus","useContext","assignProps","onFocus","onBlur","_default"],"sources":["../../src/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../core';\nimport { useFocusSource } from './focusSourceEnhance';\nexport { useFocusSource };\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const focusSourceRef = useFocusSource();\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (focusSourceRef.current !== 'keyboard') return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,mBAAA,GAAAF,OAAA;AAeO,IAAMG,mCAAmC,gBAAGC,iBAAK,CAACC,aAAa,CAAC,KAAK,CAAC;AAACC,OAAA,CAAAH,mCAAA,GAAAA,mCAAA;AAc9E,IAAMI,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAA,EAAuD;EAAA,IAAnDC,aAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAChD,OAAO,UAACG,KAAK,EAAK;IAAA,IAAAC,eAAA;IAChB,IAAQC,SAAS,GAAKF,KAAK,CAAnBE,SAAS;IACjB,IAAMC,QAAQ,GAAGH,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,OAAO;IAChD,IAAMC,QAAQ,IAAAJ,eAAA,GAAGD,KAAK,CAACK,QAAQ,cAAAJ,eAAA,cAAAA,eAAA,GAAKL,aAAa,GAAG,CAAC,GAAGG,SAAU;IAClE,IAAAO,eAAA,GAA8Cd,iBAAK,CAACe,QAAQ,CAAC,KAAK,CAAC;MAAAC,gBAAA,OAAAC,eAAA,aAAAH,eAAA;MAA5DI,eAAe,GAAAF,gBAAA;MAAEG,kBAAkB,GAAAH,gBAAA;IAC1C,IAAMI,cAAc,GAAG,IAAAC,kCAAc,GAAE;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kB,qBAAqB,KAAK,CAACzB,QAAQ;MACxE4B,OAAO,EAAEf,WAAW;MACpBgB,MAAM,EAAEX,WAAW;MACnBP,GAAG,EAAHA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAAC,IAAAmB,QAAA,GAEatC,oBAAoB;AAAAD,OAAA,cAAAuC,QAAA"}
@@ -1,61 +1,12 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React from 'react';
3
3
  import assignProps from "../assignProps.mjs";
4
+ import { useFocusSource } from "./focusSourceEnhance.mjs";
5
+ export { useFocusSource };
6
+
7
+ /** @deprecated */
8
+
4
9
  export var enforcedKeyboardFocusEnhanceContext = /*#__PURE__*/React.createContext(false);
5
- var lastFocusSource = 'none';
6
- var focusSourceListeners = [];
7
- export var useFocusSource = function useFocusSource() {
8
- var handleMouseDown = React.useCallback(function () {
9
- return focusSourceListeners.forEach(function (listener) {
10
- return listener.setFocusSource('mouse');
11
- });
12
- }, []);
13
- var handleKeyDown = React.useCallback(function () {
14
- return focusSourceListeners.forEach(function (listener) {
15
- return listener.setFocusSource('keyboard');
16
- });
17
- }, []);
18
- var focusSourceRef = React.useRef(lastFocusSource);
19
- var setFocusSource = React.useCallback(function (source) {
20
- focusSourceRef.current = source;
21
- lastFocusSource = source;
22
- }, []);
23
- var subscribeListeners = React.useCallback(function () {
24
- document.addEventListener('mousedown', handleMouseDown, {
25
- capture: true
26
- });
27
- document.addEventListener('keydown', handleKeyDown, {
28
- capture: true
29
- });
30
- }, []);
31
- var unsubscribeListeners = React.useCallback(function () {
32
- document.removeEventListener('mousedown', handleMouseDown, {
33
- capture: true
34
- });
35
- document.removeEventListener('keydown', handleKeyDown, {
36
- capture: true
37
- });
38
- }, []);
39
- React.useEffect(function () {
40
- var needToAddListeners = focusSourceListeners.length === 0;
41
- var sourceListener = {
42
- setFocusSource: setFocusSource,
43
- subscribeListeners: subscribeListeners
44
- };
45
- focusSourceListeners.push(sourceListener);
46
- if (needToAddListeners) subscribeListeners();
47
- var needToRemoveListeners = needToAddListeners;
48
- return function () {
49
- var sourceListenerIndex = focusSourceListeners.indexOf(sourceListener);
50
- focusSourceListeners.splice(sourceListenerIndex, 1);
51
- if (needToRemoveListeners) unsubscribeListeners();
52
- if (needToRemoveListeners && focusSourceListeners.length > 0) {
53
- focusSourceListeners[0].subscribeListeners();
54
- }
55
- };
56
- }, []);
57
- return focusSourceRef;
58
- };
59
10
  var keyboardFocusEnhance = function keyboardFocusEnhance() {
60
11
  var makeFocusable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
61
12
  return function (props) {
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardFocusEnhance.mjs","names":["React","assignProps","enforcedKeyboardFocusEnhanceContext","createContext","lastFocusSource","focusSourceListeners","useFocusSource","handleMouseDown","useCallback","forEach","listener","setFocusSource","handleKeyDown","focusSourceRef","useRef","source","current","subscribeListeners","document","addEventListener","capture","unsubscribeListeners","removeEventListener","useEffect","needToAddListeners","length","sourceListener","push","needToRemoveListeners","sourceListenerIndex","indexOf","splice","keyboardFocusEnhance","makeFocusable","arguments","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray","keyboardFocused","setKeyboardFocused","ref","handleFocus","event","isTrusted","handlerBlur","timer","setTimeout","_ref$current","focus","clearTimeout","enforcedKeyboardFocus","useContext","onFocus","onBlur"],"sources":["../../src/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../core';\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nlet lastFocusSource: 'mouse' | 'keyboard' | 'none' = 'none';\nconst focusSourceListeners: {\n setFocusSource: (source: 'mouse' | 'keyboard' | 'none') => void;\n subscribeListeners: () => void;\n}[] = [];\nexport const useFocusSource = () => {\n const handleMouseDown = React.useCallback(\n () => focusSourceListeners.forEach((listener) => listener.setFocusSource('mouse')),\n [],\n );\n const handleKeyDown = React.useCallback(\n () => focusSourceListeners.forEach((listener) => listener.setFocusSource('keyboard')),\n [],\n );\n const focusSourceRef = React.useRef<'none' | 'mouse' | 'keyboard'>(lastFocusSource);\n const setFocusSource = React.useCallback((source: 'none' | 'mouse' | 'keyboard') => {\n focusSourceRef.current = source;\n lastFocusSource = source;\n }, []);\n const subscribeListeners = React.useCallback(() => {\n document.addEventListener('mousedown', handleMouseDown, { capture: true });\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n }, []);\n const unsubscribeListeners = React.useCallback(() => {\n document.removeEventListener('mousedown', handleMouseDown, { capture: true });\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n }, []);\n\n React.useEffect(() => {\n const needToAddListeners = focusSourceListeners.length === 0;\n const sourceListener = { setFocusSource, subscribeListeners };\n focusSourceListeners.push(sourceListener);\n if (needToAddListeners) subscribeListeners();\n const needToRemoveListeners = needToAddListeners;\n\n return () => {\n const sourceListenerIndex = focusSourceListeners.indexOf(sourceListener);\n focusSourceListeners.splice(sourceListenerIndex, 1);\n if (needToRemoveListeners) unsubscribeListeners();\n if (needToRemoveListeners && focusSourceListeners.length > 0) {\n focusSourceListeners[0].subscribeListeners();\n }\n };\n }, []);\n\n return focusSourceRef;\n};\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const focusSourceRef = useFocusSource();\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (focusSourceRef.current !== 'keyboard') return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,oBAAgB;AAexC,OAAO,IAAMC,mCAAmC,gBAAGF,KAAK,CAACG,aAAa,CAAC,KAAK,CAAC;AAE7E,IAAIC,eAA8C,GAAG,MAAM;AAC3D,IAAMC,oBAGH,GAAG,EAAE;AACR,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAClC,IAAMC,eAAe,GAAGP,KAAK,CAACQ,WAAW,CACvC;IAAA,OAAMH,oBAAoB,CAACI,OAAO,CAAC,UAACC,QAAQ;MAAA,OAAKA,QAAQ,CAACC,cAAc,CAAC,OAAO,CAAC;IAAA,EAAC;EAAA,GAClF,EAAE,CACH;EACD,IAAMC,aAAa,GAAGZ,KAAK,CAACQ,WAAW,CACrC;IAAA,OAAMH,oBAAo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oB"}
1
+ {"version":3,"file":"keyboardFocusEnhance.mjs","names":["React","assignProps","useFocusSource","enforcedKeyboardFocusEnhanceContext","createContext","keyboardFocusEnhance","makeFocusable","arguments","length","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray","keyboardFocused","setKeyboardFocused","focusSourceRef","ref","useRef","handleFocus","useCallback","event","isTrusted","current","handlerBlur","useEffect","timer","setTimeout","_ref$current","focus","clearTimeout","enforcedKeyboardFocus","useContext","onFocus","onBlur"],"sources":["../../src/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../core';\nimport { useFocusSource } from './focusSourceEnhance';\nexport { useFocusSource };\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const focusSourceRef = useFocusSource();\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (focusSourceRef.current !== 'keyboard') return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,oBAAgB;AAExC,SAASC,cAAc,QAAQ,0BAAsB;AACrD,SAASA,cAAc;;AAEvB;;AAYA,OAAO,IAAMC,mCAAmC,gBAAGH,KAAK,CAACI,aAAa,CAAC,KAAK,CAAC;AAc7E,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAA,EAAuD;EAAA,IAAnDC,aAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAChD,OAAO,UAACG,KAAK,EAAK;IAAA,IAAAC,eAAA;IAChB,IAAQC,SAAS,GAAKF,KAAK,CAAnBE,SAAS;IACjB,IAAMC,QAAQ,GAAGH,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,OAAO;IAChD,IAAMC,QAAQ,IAAAJ,eAAA,GAAGD,KAAK,CAACK,QAAQ,cAAAJ,eAAA,cAAAA,eAAA,GAAKL,aAAa,GAAG,CAAC,GAAGG,SAAU;IAClE,IAAAO,eAAA,GAA8ChB,KAAK,CAACiB,QAAQ,CAAC,KAAK,CAAC;MAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAAA;MAA5DI,eAAe,GAAAF,gBAA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,CAAC,GAAGE,QAAQ;MAClCK,eAAe,EAAE,CAACA,eAAe,IAAIiB,qBAAqB,KAAK,CAACxB,QAAQ;MACxE0B,OAAO,EAAEd,WAAW;MACpBe,MAAM,EAAEV,WAAW;MACnBP,GAAG,EAAHA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAelB,oBAAoB"}
@@ -0,0 +1,3 @@
1
+ export declare const addIframeBorders: () => void;
2
+ export declare const removeIframeBorders: () => void;
3
+ export declare const areIframeBordersPlacedCorrectly: () => boolean;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.removeIframeBorders = exports.areIframeBordersPlacedCorrectly = exports.addIframeBorders = void 0;
7
+ var iframeBorders = new Set();
8
+ var addIframeBorders = function addIframeBorders() {
9
+ var iframes = document.querySelectorAll('iframe');
10
+ iframes.forEach(function (iframe) {
11
+ var iframeBefore = document.createElement('div');
12
+ iframeBefore.style.position = 'fixed';
13
+ iframeBefore.setAttribute('tabindex', '0');
14
+ var iframeAfter = document.createElement('div');
15
+ iframeAfter.style.position = 'fixed';
16
+ iframeAfter.setAttribute('tabindex', '0');
17
+ iframeBefore.addEventListener('focus', function (event) {
18
+ Promise.resolve().then(function () {
19
+ if (document.activeElement === iframeBefore && event.relatedTarget !== iframeAfter &&
20
+ // prevent loop
21
+ event.relatedTarget // prevent initial focus
22
+ ) {
23
+ iframeAfter === null || iframeAfter === void 0 ? void 0 : iframeAfter.focus();
24
+ }
25
+ });
26
+ });
27
+ iframeAfter.addEventListener('focus', function (event) {
28
+ Promise.resolve().then(function () {
29
+ if (document.activeElement === iframeAfter && event.relatedTarget !== iframeBefore &&
30
+ // prevent loop
31
+ event.relatedTarget // prevent initial focus
32
+ ) {
33
+ iframeBefore === null || iframeBefore === void 0 ? void 0 : iframeBefore.focus();
34
+ }
35
+ });
36
+ });
37
+ iframe.before(iframeBefore);
38
+ iframe.after(iframeAfter);
39
+ iframeBorders.add(iframeBefore);
40
+ iframeBorders.add(iframeAfter);
41
+ });
42
+ };
43
+ exports.addIframeBorders = addIframeBorders;
44
+ var removeIframeBorders = function removeIframeBorders() {
45
+ iframeBorders.forEach(function (node) {
46
+ return node === null || node === void 0 ? void 0 : node.remove();
47
+ });
48
+ iframeBorders.clear();
49
+ };
50
+ exports.removeIframeBorders = removeIframeBorders;
51
+ var areIframeBordersPlacedCorrectly = function areIframeBordersPlacedCorrectly() {
52
+ var iframes = Array.from(document.querySelectorAll('iframe'));
53
+ if (iframes.length * 2 === iframeBorders.size) return false;
54
+ return iframes.every(function (iframe) {
55
+ var nodeBeforeIframe = iframe.previousSibling;
56
+ var nodeAfterIframe = iframe.nextSibling;
57
+ return iframeBorders.has(nodeBeforeIframe) && iframeBorders.has(nodeAfterIframe);
58
+ });
59
+ };
60
+ exports.areIframeBordersPlacedCorrectly = areIframeBordersPlacedCorrectly;
61
+ //# sourceMappingURL=iframeBorders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframeBorders.js","names":["iframeBorders","Set","addIframeBorders","iframes","document","querySelectorAll","forEach","iframe","iframeBefore","createElement","style","position","setAttribute","iframeAfter","addEventListener","event","Promise","resolve","then","activeElement","relatedTarget","focus","before","after","add","exports","removeIframeBorders","node","remove","clear","areIframeBordersPlacedCorrectly","Array","from","length","size","every","nodeBeforeIframe","previousSibling","nodeAfterIframe","nextSibling","has"],"sources":["../../src/focus-lock/iframeBorders.ts"],"sourcesContent":["const iframeBorders = new Set<HTMLElement>();\n\nexport const addIframeBorders = () => {\n const iframes = document.querySelectorAll('iframe');\n iframes.forEach((iframe) => {\n const iframeBefore = document.createElement('div');\n iframeBefore.style.position = 'fixed';\n iframeBefore.setAttribute('tabindex', '0');\n const iframeAfter = document.createElement('div');\n iframeAfter.style.position = 'fixed';\n iframeAfter.setAttribute('tabindex', '0');\n iframeBefore.addEventListener('focus', (event) => {\n Promise.resolve().then(() => {\n if (\n document.activeElement === iframeBefore &&\n event.relatedTarget !== iframeAfter && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n iframeAfter?.focus();\n }\n });\n });\n iframeAfter.addEventListener('focus', (event) => {\n Promise.resolve().then(() => {\n if (\n document.activeElement === iframeAfter &&\n event.relatedTarget !== iframeBefore && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n iframeBefore?.focus();\n }\n });\n });\n iframe.before(iframeBefore);\n iframe.after(iframeAfter);\n iframeBorders.add(iframeBefore);\n iframeBorders.add(iframeAfter);\n });\n};\nexport const removeIframeBorders = () => {\n iframeBorders.forEach((node) => node?.remove());\n iframeBorders.clear();\n};\nexport const areIframeBordersPlacedCorrectly = () => {\n const iframes = Array.from(document.querySelectorAll('iframe'));\n\n if (iframes.length * 2 === iframeBorders.size) return false;\n\n return iframes.every((iframe) => {\n const nodeBeforeIframe = iframe.previousSibling as any;\n const nodeAfterIframe = iframe.nextSibling as any;\n\n return iframeBorders.has(nodeBeforeIframe) && iframeBorders.has(nodeAfterIframe);\n });\n};\n"],"mappings":";;;;;;AAAA,IAAMA,aAAa,GAAG,IAAIC,GAAG,EAAe;AAErC,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA,EAAS;EACpC,IAAMC,OAAO,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,QAAQ,CAAC;EACnDF,OAAO,CAACG,OAAO,CAAC,UAACC,MAAM,EAAK;IAC1B,IAAMC,YAAY,GAAGJ,QAAQ,CAACK,aAAa,CAAC,KAAK,CAAC;IAClDD,YAAY,CAACE,KAAK,CAACC,QAAQ,GAAG,OAAO;IACrCH,YAAY,CAACI,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IAC1C,IAAMC,WAAW,GAAGT,QAAQ,CAACK,aAAa,CAAC,KAAK,CAAC;IACjDI,WAAW,CAACH,KAAK,CAACC,QAAQ,GAAG,OAAO;IACpCE,WAAW,CAACD,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IACzCJ,YAAY,CAACM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B,GAAG,SAAlCA,+BAA+BA,CAAA,EAAS;EACnD,IAAM3B,OAAO,GAAG4B,KAAK,CAACC,IAAI,CAAC5B,QAAQ,CAACC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;EAE/D,IAAIF,OAAO,CAAC8B,MAAM,GAAG,CAAC,KAAKjC,aAAa,CAACkC,IAAI,EAAE,OAAO,KAAK;EAE3D,OAAO/B,OAAO,CAACgC,KAAK,CAAC,UAAC5B,MAAM,EAAK;IAC/B,IAAM6B,gBAAgB,GAAG7B,MAAM,CAAC8B,eAAsB;IACtD,IAAMC,eAAe,GAAG/B,MAAM,CAACgC,WAAkB;IAEjD,OAAOvC,aAAa,CAACwC,GAAG,CAACJ,gBAAgB,CAAC,IAAIpC,aAAa,CAACwC,GAAG,CAACF,eAAe,CAAC;EAClF,CAAC,CAAC;AACJ,CAAC;AAACb,OAAA,CAAAK,+BAAA,GAAAA,+BAAA"}
@@ -0,0 +1,52 @@
1
+ var iframeBorders = new Set();
2
+ export var addIframeBorders = function addIframeBorders() {
3
+ var iframes = document.querySelectorAll('iframe');
4
+ iframes.forEach(function (iframe) {
5
+ var iframeBefore = document.createElement('div');
6
+ iframeBefore.style.position = 'fixed';
7
+ iframeBefore.setAttribute('tabindex', '0');
8
+ var iframeAfter = document.createElement('div');
9
+ iframeAfter.style.position = 'fixed';
10
+ iframeAfter.setAttribute('tabindex', '0');
11
+ iframeBefore.addEventListener('focus', function (event) {
12
+ Promise.resolve().then(function () {
13
+ if (document.activeElement === iframeBefore && event.relatedTarget !== iframeAfter &&
14
+ // prevent loop
15
+ event.relatedTarget // prevent initial focus
16
+ ) {
17
+ iframeAfter === null || iframeAfter === void 0 ? void 0 : iframeAfter.focus();
18
+ }
19
+ });
20
+ });
21
+ iframeAfter.addEventListener('focus', function (event) {
22
+ Promise.resolve().then(function () {
23
+ if (document.activeElement === iframeAfter && event.relatedTarget !== iframeBefore &&
24
+ // prevent loop
25
+ event.relatedTarget // prevent initial focus
26
+ ) {
27
+ iframeBefore === null || iframeBefore === void 0 ? void 0 : iframeBefore.focus();
28
+ }
29
+ });
30
+ });
31
+ iframe.before(iframeBefore);
32
+ iframe.after(iframeAfter);
33
+ iframeBorders.add(iframeBefore);
34
+ iframeBorders.add(iframeAfter);
35
+ });
36
+ };
37
+ export var removeIframeBorders = function removeIframeBorders() {
38
+ iframeBorders.forEach(function (node) {
39
+ return node === null || node === void 0 ? void 0 : node.remove();
40
+ });
41
+ iframeBorders.clear();
42
+ };
43
+ export var areIframeBordersPlacedCorrectly = function areIframeBordersPlacedCorrectly() {
44
+ var iframes = Array.from(document.querySelectorAll('iframe'));
45
+ if (iframes.length * 2 === iframeBorders.size) return false;
46
+ return iframes.every(function (iframe) {
47
+ var nodeBeforeIframe = iframe.previousSibling;
48
+ var nodeAfterIframe = iframe.nextSibling;
49
+ return iframeBorders.has(nodeBeforeIframe) && iframeBorders.has(nodeAfterIframe);
50
+ });
51
+ };
52
+ //# sourceMappingURL=iframeBorders.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframeBorders.mjs","names":["iframeBorders","Set","addIframeBorders","iframes","document","querySelectorAll","forEach","iframe","iframeBefore","createElement","style","position","setAttribute","iframeAfter","addEventListener","event","Promise","resolve","then","activeElement","relatedTarget","focus","before","after","add","removeIframeBorders","node","remove","clear","areIframeBordersPlacedCorrectly","Array","from","length","size","every","nodeBeforeIframe","previousSibling","nodeAfterIframe","nextSibling","has"],"sources":["../../src/focus-lock/iframeBorders.ts"],"sourcesContent":["const iframeBorders = new Set<HTMLElement>();\n\nexport const addIframeBorders = () => {\n const iframes = document.querySelectorAll('iframe');\n iframes.forEach((iframe) => {\n const iframeBefore = document.createElement('div');\n iframeBefore.style.position = 'fixed';\n iframeBefore.setAttribute('tabindex', '0');\n const iframeAfter = document.createElement('div');\n iframeAfter.style.position = 'fixed';\n iframeAfter.setAttribute('tabindex', '0');\n iframeBefore.addEventListener('focus', (event) => {\n Promise.resolve().then(() => {\n if (\n document.activeElement === iframeBefore &&\n event.relatedTarget !== iframeAfter && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n iframeAfter?.focus();\n }\n });\n });\n iframeAfter.addEventListener('focus', (event) => {\n Promise.resolve().then(() => {\n if (\n document.activeElement === iframeAfter &&\n event.relatedTarget !== iframeBefore && // prevent loop\n event.relatedTarget // prevent initial focus\n ) {\n iframeBefore?.focus();\n }\n });\n });\n iframe.before(iframeBefore);\n iframe.after(iframeAfter);\n iframeBorders.add(iframeBefore);\n iframeBorders.add(iframeAfter);\n });\n};\nexport const removeIframeBorders = () => {\n iframeBorders.forEach((node) => node?.remove());\n iframeBorders.clear();\n};\nexport const areIframeBordersPlacedCorrectly = () => {\n const iframes = Array.from(document.querySelectorAll('iframe'));\n\n if (iframes.length * 2 === iframeBorders.size) return false;\n\n return iframes.every((iframe) => {\n const nodeBeforeIframe = iframe.previousSibling as any;\n const nodeAfterIframe = iframe.nextSibling as any;\n\n return iframeBorders.has(nodeBeforeIframe) && iframeBorders.has(nodeAfterIframe);\n });\n};\n"],"mappings":"AAAA,IAAMA,aAAa,GAAG,IAAIC,GAAG,EAAe;AAE5C,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA,EAAS;EACpC,IAAMC,OAAO,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,QAAQ,CAAC;EACnDF,OAAO,CAACG,OAAO,CAAC,UAACC,MAAM,EAAK;IAC1B,IAAMC,YAAY,GAAGJ,QAAQ,CAACK,aAAa,CAAC,KAAK,CAAC;IAClDD,YAAY,CAACE,KAAK,CAACC,QAAQ,GAAG,OAAO;IACrCH,YAAY,CAACI,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IAC1C,IAAMC,WAAW,GAAGT,QAAQ,CAACK,aAAa,CAAC,KAAK,CAAC;IACjDI,WAAW,CAACH,KAAK,CAACC,QAAQ,GAAG,OAAO;IACpCE,WAAW,CAACD,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;IACzCJ,YAAY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KAAK,CAACC,IAAI,CAAC3B,QAAQ,CAACC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;EAE/D,IAAIF,OAAO,CAAC6B,MAAM,GAAG,CAAC,KAAKhC,aAAa,CAACiC,IAAI,EAAE,OAAO,KAAK;EAE3D,OAAO9B,OAAO,CAAC+B,KAAK,CAAC,UAAC3B,MAAM,EAAK;IAC/B,IAAM4B,gBAAgB,GAAG5B,MAAM,CAAC6B,eAAsB;IACtD,IAAMC,eAAe,GAAG9B,MAAM,CAAC+B,WAAkB;IAEjD,OAAOtC,aAAa,CAACuC,GAAG,CAACJ,gBAAgB,CAAC,IAAInC,aAAa,CAACuC,GAAG,CAACF,eAAe,CAAC;EAClF,CAAC,CAAC;AACJ,CAAC"}
@@ -30,7 +30,7 @@ function injectStyle(css) {
30
30
  sh = prevSh;
31
31
  } else {
32
32
  // @ts-ignore
33
- var version = "4.32.2";
33
+ var version = "4.35.0";
34
34
  sh = document.createElement('style');
35
35
  sh.setAttribute('data-ui-v', version);
36
36
  sh.classList.add(selectorClass);
@@ -23,7 +23,7 @@ function injectStyle(css) {
23
23
  sh = prevSh;
24
24
  } else {
25
25
  // @ts-ignore
26
- var version = "4.32.2";
26
+ var version = "4.35.0";
27
27
  sh = document.createElement('style');
28
28
  sh.setAttribute('data-ui-v', version);
29
29
  sh.classList.add(selectorClass);
@@ -456,6 +456,8 @@
456
456
  --intergalactic-compact: 0.3;
457
457
  /* Base denominator of the design system. */
458
458
  --intergalactic-scale-indent: 4px;
459
+ /* Small size of the controls. Use it for small interactive addons. Avoid using it with the main actions. */
460
+ --intergalactic-form-control-s: 20px;
459
461
  /* Default size of the controls. */
460
462
  --intergalactic-form-control-m: 28px;
461
463
  /* Large size of the controls. */
@@ -1163,6 +1165,8 @@
1163
1165
  --intergalactic-compact: 0.3;
1164
1166
  /* Base denominator of the design system. */
1165
1167
  --intergalactic-scale-indent: 4px;
1168
+ /* Small size of the controls. Use it for small interactive addons. Avoid using it with the main actions. */
1169
+ --intergalactic-form-control-s: 20px;
1166
1170
  /* Default size of the controls. */
1167
1171
  --intergalactic-form-control-m: 28px;
1168
1172
  /* Large size of the controls. */
@@ -436,6 +436,8 @@
436
436
  --intergalactic-compact: 0.3;
437
437
  /* Base denominator of the design system. */
438
438
  --intergalactic-scale-indent: 4px;
439
+ /* Small size of the controls. Use it for small interactive addons. Avoid using it with the main actions. */
440
+ --intergalactic-form-control-s: 20px;
439
441
  /* Default size of the controls. */
440
442
  --intergalactic-form-control-m: 28px;
441
443
  /* Large size of the controls. */
@@ -222,6 +222,7 @@
222
222
  "--intergalactic-fs-800": "48px",
223
223
  "--intergalactic-compact": "0.3",
224
224
  "--intergalactic-scale-indent": "4px",
225
+ "--intergalactic-form-control-s": "20px",
225
226
  "--intergalactic-form-control-m": "28px",
226
227
  "--intergalactic-form-control-l": "40px",
227
228
  "--intergalactic-spacing-05x": "2px",
@@ -456,6 +456,8 @@
456
456
  --intergalactic-compact: 0.3;
457
457
  /* Base denominator of the design system. */
458
458
  --intergalactic-scale-indent: 4px;
459
+ /* Small size of the controls. Use it for small interactive addons. Avoid using it with the main actions. */
460
+ --intergalactic-form-control-s: 20px;
459
461
  /* Default size of the controls. */
460
462
  --intergalactic-form-control-m: 28px;
461
463
  /* Large size of the controls. */
@@ -231,6 +231,7 @@
231
231
  "--intergalactic-fs-800": "48px",
232
232
  "--intergalactic-compact": "0.3",
233
233
  "--intergalactic-scale-indent": "4px",
234
+ "--intergalactic-form-control-s": "20px",
234
235
  "--intergalactic-form-control-m": "28px",
235
236
  "--intergalactic-form-control-l": "40px",
236
237
  "--intergalactic-spacing-05x": "2px",
@@ -456,6 +456,8 @@
456
456
  --intergalactic-compact: 0.3;
457
457
  /* Base denominator of the design system. */
458
458
  --intergalactic-scale-indent: 4px;
459
+ /* Small size of the controls. Use it for small interactive addons. Avoid using it with the main actions. */
460
+ --intergalactic-form-control-s: 20px;
459
461
  /* Default size of the controls. */
460
462
  --intergalactic-form-control-m: 28px;
461
463
  /* Large size of the controls. */
@@ -231,6 +231,7 @@
231
231
  "--intergalactic-fs-800": "48px",
232
232
  "--intergalactic-compact": "0.3",
233
233
  "--intergalactic-scale-indent": "4px",
234
+ "--intergalactic-form-control-s": "20px",
234
235
  "--intergalactic-form-control-m": "28px",
235
236
  "--intergalactic-form-control-l": "40px",
236
237
  "--intergalactic-spacing-05x": "2px",
@@ -27,6 +27,7 @@ var _isFocusInside = require("../focus-lock/isFocusInside");
27
27
  var _setFocus = require("../focus-lock/setFocus");
28
28
  var _getFocusableIn = require("../focus-lock/getFocusableIn");
29
29
  var _focusBorders = require("../focus-lock/focusBorders");
30
+ var _iframeBorders = require("../focus-lock/iframeBorders");
30
31
  var focusBordersConsumers = new Set();
31
32
  var syntheticEvents = {
32
33
  blur: 'focusout-intergalactic-focus-lock-synthetic',
@@ -65,10 +66,17 @@ var useFocusBorders = function useFocusBorders(React, disabled) {
65
66
  focusBordersConsumers.add(id);
66
67
  }
67
68
  if (!(0, _focusBorders.areFocusBordersPlacedCorrectly)()) (0, _focusBorders.removeFocusBorders)();
68
- if (focusBordersConsumers.size > 0) (0, _focusBorders.addFocusBorders)();
69
+ if (!(0, _iframeBorders.areIframeBordersPlacedCorrectly)()) (0, _iframeBorders.removeIframeBorders)();
70
+ if (focusBordersConsumers.size > 0) {
71
+ (0, _focusBorders.addFocusBorders)();
72
+ (0, _iframeBorders.addIframeBorders)();
73
+ }
69
74
  return function () {
70
75
  focusBordersConsumers["delete"](id);
71
- if (focusBordersConsumers.size === 0) (0, _focusBorders.removeFocusBorders)();
76
+ if (focusBordersConsumers.size === 0) {
77
+ (0, _focusBorders.removeFocusBorders)();
78
+ (0, _iframeBorders.removeIframeBorders)();
79
+ }
72
80
  };
73
81
  }, [disabled]);
74
82
  };