@onereach/ui-components 4.2.0-beta.2548.0 → 4.2.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 (458) hide show
  1. package/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.js +145 -0
  2. package/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +91 -0
  3. package/dist/bundled/v2/components/OrCheckboxGroupV3/index.d.ts +1 -0
  4. package/dist/bundled/v2/components/OrCheckboxGroupV3/index.js +31 -0
  5. package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +226 -0
  6. package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +91 -0
  7. package/dist/bundled/v2/components/OrCheckboxTreeV3/index.d.ts +2 -0
  8. package/dist/bundled/v2/components/OrCheckboxTreeV3/index.js +23 -0
  9. package/dist/bundled/v2/components/OrCheckboxTreeV3/styles.d.ts +2 -0
  10. package/dist/bundled/v2/components/OrCheckboxTreeV3/styles.js +10 -0
  11. package/dist/bundled/v2/components/OrCheckboxTreeV3/types.d.ts +8 -0
  12. package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.js +37 -39
  13. package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.vue.d.ts +18 -16
  14. package/dist/bundled/v2/components/OrCheckboxV3/index.js +1 -0
  15. package/dist/bundled/v2/components/OrCode/OrCode.js +3727 -6
  16. package/dist/bundled/v2/components/OrCode/index.js +2 -6
  17. package/dist/bundled/v2/components/OrCode/lang.js +3 -3897
  18. package/dist/bundled/v2/components/OrCode/theme.js +1 -2
  19. package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +0 -1
  20. package/dist/bundled/v2/components/OrConfirm/index.js +0 -1
  21. package/dist/bundled/v2/components/OrFormGroupV3/OrFormGroup.js +127 -0
  22. package/dist/bundled/v2/components/OrFormGroupV3/OrFormGroup.vue.d.ts +87 -0
  23. package/dist/bundled/v2/components/OrFormGroupV3/index.d.ts +2 -0
  24. package/dist/bundled/v2/components/OrFormGroupV3/index.js +12 -0
  25. package/dist/bundled/v2/components/OrFormGroupV3/props.d.ts +4 -0
  26. package/dist/bundled/v2/components/OrFormGroupV3/props.js +7 -0
  27. package/dist/bundled/v2/components/OrFormGroupV3/styles.d.ts +5 -0
  28. package/dist/bundled/v2/components/OrFormGroupV3/styles.js +17 -0
  29. package/dist/bundled/v2/components/OrModal/OrModal.js +1266 -3
  30. package/dist/bundled/v2/components/OrModal/index.js +0 -1
  31. package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.js +132 -0
  32. package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +110 -0
  33. package/dist/bundled/v2/components/OrRadioGroupV3/index.d.ts +1 -0
  34. package/dist/bundled/v2/components/OrRadioGroupV3/index.js +19 -0
  35. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +1 -1
  36. package/dist/bundled/v2/components/OrSelectV3/index.js +1 -1
  37. package/dist/bundled/v2/components/OrTooltipContent/OrTooltipContent.js +2 -2
  38. package/dist/bundled/v2/components/index.d.ts +0 -1
  39. package/dist/bundled/v2/components/index.js +2 -15
  40. package/dist/bundled/v2/{index-f5487f12.js → index-6976c52a.js} +115 -3
  41. package/dist/bundled/v2/index.d.ts +1 -0
  42. package/dist/bundled/v2/index.js +8 -20
  43. package/dist/bundled/v2/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
  44. package/dist/bundled/v2/utils/functions/flattenDeep.d.ts +2 -0
  45. package/dist/bundled/v2/utils/functions/flattenDeep.js +5 -0
  46. package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-29e8ad0e.js → OrAvatar.vue_vue_type_script_lang-6511e348.js} +1 -1
  47. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-a4a16fe5.js → OrButton.vue_vue_type_script_lang-da7f7ed0.js} +1 -1
  48. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-c1d83552.js → OrCardCollection.vue_vue_type_script_lang-7a2e1332.js} +3 -3
  49. package/dist/bundled/v3/{OrCarousel.vue_vue_type_script_lang-0e87c56b.js → OrCarousel.vue_vue_type_script_lang-6976844a.js} +1 -1
  50. package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-6ff51af9.js → OrCheckbox.vue_vue_type_script_lang-11b16d93.js} +1 -1
  51. package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-60cefcbd.js → OrCheckbox.vue_vue_type_script_lang-b274a5ee.js} +27 -11
  52. package/dist/bundled/v3/OrCheckboxTree.vue_vue_type_script_lang-f9807b75.js +115 -0
  53. package/dist/bundled/v3/{OrChip.vue_vue_type_script_lang-ceebbd82.js → OrChip.vue_vue_type_script_lang-5a390853.js} +1 -1
  54. package/dist/bundled/v3/{OrChips.vue_vue_type_script_lang-94b456c7.js → OrChips.vue_vue_type_script_lang-d4bb44eb.js} +1 -1
  55. package/dist/bundled/{v2/index-16aee5bc.js → v3/OrCode.vue_vue_type_script_lang-5397df6a.js} +234 -14
  56. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-36318ca2.js → OrConfirm.vue_vue_type_script_lang-89febea7.js} +2 -2
  57. package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-5c1a5d4a.js → OrDateTimePicker.vue_vue_type_script_lang-8ff54abd.js} +1 -1
  58. package/dist/bundled/v3/OrFormGroup.vue_vue_type_script_lang-1c6844d6.js +63 -0
  59. package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-5d204461.js → OrIconButton.vue_vue_type_script_lang-96cb5b59.js} +2 -2
  60. package/dist/bundled/v3/{OrInlineTextEdit.vue_vue_type_script_lang-424e2c26.js → OrInlineTextEdit.vue_vue_type_script_lang-45987769.js} +1 -1
  61. package/dist/bundled/v3/{OrList.vue_vue_type_script_lang-c65271b9.js → OrList.vue_vue_type_script_lang-2c7537cc.js} +3 -3
  62. package/dist/bundled/v3/{OrListOfInputs.vue_vue_type_script_lang-d3dce7b8.js → OrListOfInputs.vue_vue_type_script_lang-009f62a5.js} +3 -3
  63. package/dist/bundled/v3/{useFocusTrap-9567b3c8.js → OrModal.vue_vue_type_script_lang-c53617ae.js} +105 -3
  64. package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-ef4f2661.js → OrNotification.vue_vue_type_script_lang-efb05bb2.js} +2 -2
  65. package/dist/bundled/v3/{OrOverflowMenu.vue_vue_type_script_lang-0c461991.js → OrOverflowMenu.vue_vue_type_script_lang-ba50133f.js} +2 -2
  66. package/dist/bundled/v3/{OrPassword.vue_vue_type_script_lang-3d308fef.js → OrPassword.vue_vue_type_script_lang-37f52611.js} +1 -1
  67. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-86f4f5c7.js → OrSearch.vue_vue_type_script_lang-bcb935c3.js} +1 -1
  68. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-f7601423.js → OrSelect.vue_vue_type_script_lang-098ea3ab.js} +1 -1
  69. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-d2fecd97.js → OrSelect.vue_vue_type_script_lang-c82d8f58.js} +3 -3
  70. package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-900036a2.js → OrSlider.vue_vue_type_script_lang-45ecddbe.js} +1 -1
  71. package/dist/bundled/v3/{OrStepper.vue_vue_type_script_lang-2821c496.js → OrStepper.vue_vue_type_script_lang-975a4df6.js} +1 -1
  72. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-f06b54a2.js → OrTag.vue_vue_type_script_lang-621e9307.js} +1 -1
  73. package/dist/bundled/v3/{OrTextbox.vue_vue_type_script_lang-b8d5341b.js → OrTextbox.vue_vue_type_script_lang-812f302d.js} +1 -1
  74. package/dist/bundled/v3/components/OrAvatar/OrAvatar.js +3 -3
  75. package/dist/bundled/v3/components/OrAvatar/index.js +2 -2
  76. package/dist/bundled/v3/components/OrButtonV2/OrButton.js +3 -3
  77. package/dist/bundled/v3/components/OrButtonV2/index.js +4 -4
  78. package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.js +6 -6
  79. package/dist/bundled/v3/components/OrCardCollection/index.js +5 -5
  80. package/dist/bundled/v3/components/OrCarousel/OrCarousel.js +3 -3
  81. package/dist/bundled/v3/components/OrCarousel/index.js +2 -2
  82. package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.js +3 -3
  83. package/dist/bundled/v3/components/OrCheckbox/index.js +2 -2
  84. package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +121 -0
  85. package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +91 -0
  86. package/dist/bundled/v3/components/OrCheckboxGroupV3/index.d.ts +1 -0
  87. package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +40 -0
  88. package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +90 -0
  89. package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +91 -0
  90. package/dist/bundled/v3/components/OrCheckboxTreeV3/index.d.ts +2 -0
  91. package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +28 -0
  92. package/dist/bundled/v3/components/OrCheckboxTreeV3/styles.d.ts +2 -0
  93. package/dist/bundled/v3/components/OrCheckboxTreeV3/styles.js +10 -0
  94. package/dist/bundled/v3/components/OrCheckboxTreeV3/types.d.ts +8 -0
  95. package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.js +12 -9
  96. package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.vue.d.ts +18 -16
  97. package/dist/bundled/v3/components/OrCheckboxV3/index.js +2 -1
  98. package/dist/bundled/v3/components/OrChip/OrChip.js +3 -3
  99. package/dist/bundled/v3/components/OrChip/index.js +2 -2
  100. package/dist/bundled/v3/components/OrChips/OrChips.js +4 -4
  101. package/dist/bundled/v3/components/OrChips/index.js +3 -3
  102. package/dist/bundled/v3/components/OrCode/OrCode.js +9 -13
  103. package/dist/bundled/v3/components/OrCode/index.js +7 -11
  104. package/dist/bundled/v3/components/OrCode/lang.js +3 -3897
  105. package/dist/bundled/v3/components/OrCode/theme.js +1 -2
  106. package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +7 -8
  107. package/dist/bundled/v3/components/OrConfirm/index.js +6 -7
  108. package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.js +5 -5
  109. package/dist/bundled/v3/components/OrDateTimePicker/index.js +4 -4
  110. package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.js +59 -0
  111. package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.vue.d.ts +87 -0
  112. package/dist/bundled/v3/components/OrFormGroupV3/index.d.ts +2 -0
  113. package/dist/bundled/v3/components/OrFormGroupV3/index.js +15 -0
  114. package/dist/bundled/v3/components/OrFormGroupV3/props.d.ts +4 -0
  115. package/dist/bundled/v3/components/OrFormGroupV3/props.js +7 -0
  116. package/dist/bundled/v3/components/OrFormGroupV3/styles.d.ts +5 -0
  117. package/dist/bundled/v3/components/OrFormGroupV3/styles.js +17 -0
  118. package/dist/bundled/v3/components/OrIcon/OrIcon.js +2 -2
  119. package/dist/bundled/v3/components/OrIcon/index.js +1 -1
  120. package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.js +4 -4
  121. package/dist/bundled/v3/components/OrIconButtonV2/index.js +3 -3
  122. package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +5 -5
  123. package/dist/bundled/v3/components/OrInlineTextEdit/index.js +4 -4
  124. package/dist/bundled/v3/components/OrList/OrList.js +6 -6
  125. package/dist/bundled/v3/components/OrList/index.js +5 -5
  126. package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.js +7 -7
  127. package/dist/bundled/v3/components/OrListOfInputs/index.js +6 -6
  128. package/dist/bundled/v3/components/OrModal/OrModal.js +5 -6
  129. package/dist/bundled/v3/components/OrModal/index.js +4 -5
  130. package/dist/bundled/v3/components/OrNotification/OrNotification.js +5 -5
  131. package/dist/bundled/v3/components/OrNotification/index.js +4 -4
  132. package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.js +6 -6
  133. package/dist/bundled/v3/components/OrOverflowMenu/index.js +5 -5
  134. package/dist/bundled/v3/components/OrPassword/OrPassword.js +5 -5
  135. package/dist/bundled/v3/components/OrPassword/index.js +4 -4
  136. package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.js +104 -0
  137. package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +110 -0
  138. package/dist/bundled/v3/components/OrRadioGroupV3/index.d.ts +1 -0
  139. package/dist/bundled/v3/components/OrRadioGroupV3/index.js +24 -0
  140. package/dist/bundled/v3/components/OrSearch/OrSearch.js +5 -5
  141. package/dist/bundled/v3/components/OrSearch/index.js +4 -4
  142. package/dist/bundled/v3/components/OrSelect/OrSelect.js +5 -5
  143. package/dist/bundled/v3/components/OrSelect/index.js +4 -4
  144. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +4 -4
  145. package/dist/bundled/v3/components/OrSelectV3/index.js +3 -3
  146. package/dist/bundled/v3/components/OrSlider/OrSlider.js +3 -3
  147. package/dist/bundled/v3/components/OrSlider/index.js +2 -2
  148. package/dist/bundled/v3/components/OrStepper/OrStepper.js +4 -4
  149. package/dist/bundled/v3/components/OrStepper/index.js +3 -3
  150. package/dist/bundled/v3/components/OrTag/OrTag.js +3 -3
  151. package/dist/bundled/v3/components/OrTag/index.js +2 -2
  152. package/dist/bundled/v3/components/OrTextbox/OrTextbox.js +5 -5
  153. package/dist/bundled/v3/components/OrTextbox/index.js +4 -4
  154. package/dist/bundled/v3/components/OrToast/OrToast.js +3 -3
  155. package/dist/bundled/v3/components/OrToast/index.js +4 -4
  156. package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +5 -5
  157. package/dist/bundled/v3/components/OrToastContainer/index.js +4 -4
  158. package/dist/bundled/v3/components/OrTooltip/OrTooltip.js +2 -2
  159. package/dist/bundled/v3/components/OrTooltip/index.js +1 -1
  160. package/dist/bundled/v3/components/OrTooltipContent/OrTooltipContent.js +1 -1
  161. package/dist/bundled/v3/components/index.d.ts +0 -1
  162. package/dist/bundled/v3/components/index.js +31 -45
  163. package/dist/bundled/v3/{index-f5487f12.js → index-6976c52a.js} +115 -3
  164. package/dist/bundled/v3/index.d.ts +1 -0
  165. package/dist/bundled/v3/index.js +39 -53
  166. package/dist/bundled/v3/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
  167. package/dist/bundled/v3/utils/functions/flattenDeep.d.ts +2 -0
  168. package/dist/bundled/v3/utils/functions/flattenDeep.js +5 -0
  169. package/dist/esm/v2/{OrAvatar-da5cba16.js → OrAvatar-7c024521.js} +1 -1
  170. package/dist/esm/v2/{OrButton-bdddd8d4.js → OrButton-4e532ddb.js} +1 -1
  171. package/dist/esm/v2/{OrButton.vue_rollup-plugin-vue_styles.0-3dbd90b4.js → OrButton.vue_rollup-plugin-vue_styles.0-48c5883e.js} +2 -2
  172. package/dist/esm/v2/{OrCardCollection-4e014d25.js → OrCardCollection-9bf513b7.js} +5 -5
  173. package/dist/esm/v2/{OrCarousel-3c809a13.js → OrCarousel-e0c2e387.js} +1 -1
  174. package/dist/esm/v2/{OrCheckbox-dc587ec9.js → OrCheckbox-39c94019.js} +37 -40
  175. package/dist/esm/v2/{OrCheckbox-bf34eb0f.js → OrCheckbox-7b98fc08.js} +1 -1
  176. package/dist/esm/v2/OrCheckboxTree-7b81e76c.js +220 -0
  177. package/dist/esm/v2/{OrChip-416e848e.js → OrChip-8a1abfc5.js} +1 -1
  178. package/dist/esm/v2/{OrChips-77e789e9.js → OrChips-a01d8520.js} +1 -1
  179. package/dist/esm/v2/{OrChips.vue_rollup-plugin-vue_styles.0-e05c5ca8.js → OrChips.vue_rollup-plugin-vue_styles.0-3cbb0871.js} +1 -1
  180. package/dist/esm/v2/{OrCode-dcb0132a.js → OrCode-e54e09f7.js} +4 -4
  181. package/dist/esm/v2/{OrConfirm-497cd260.js → OrConfirm-5d5dd9bc.js} +3 -3
  182. package/dist/esm/v2/{OrDateTimePicker-c88ca716.js → OrDateTimePicker-6e2853ec.js} +3 -3
  183. package/dist/esm/v2/OrFormGroup-29a514db.js +141 -0
  184. package/dist/esm/v2/{OrIcon-8a6d663a.js → OrIcon-a40e60af.js} +2 -2
  185. package/dist/esm/v2/{OrIconButton-97bfd51d.js → OrIconButton-23972f7d.js} +1 -1
  186. package/dist/esm/v2/{OrIconButton.vue_rollup-plugin-vue_styles.0-e3806cef.js → OrIconButton.vue_rollup-plugin-vue_styles.0-277ce06c.js} +3 -3
  187. package/dist/esm/v2/{OrInlineTextEdit-e8414fb6.js → OrInlineTextEdit-9541b625.js} +3 -3
  188. package/dist/esm/v2/{OrList-a46d6306.js → OrList-61c7b8ea.js} +4 -4
  189. package/dist/esm/v2/{OrListOfInputs-33a7bf87.js → OrListOfInputs-e1b09290.js} +5 -5
  190. package/dist/esm/v2/{OrModal-6d84829c.js → OrModal-b9cfb8ec.js} +3 -3
  191. package/dist/esm/v2/{OrNotification-7945568d.js → OrNotification-fdb88eec.js} +4 -4
  192. package/dist/esm/v2/{OrOverflowMenu-5ce7171b.js → OrOverflowMenu-83540c76.js} +4 -4
  193. package/dist/esm/v2/{OrPassword-3597153d.js → OrPassword-022e10fd.js} +3 -3
  194. package/dist/esm/v2/{OrSearch-49ceaac4.js → OrSearch-620d5d76.js} +3 -3
  195. package/dist/esm/v2/{OrSelect-40183874.js → OrSelect-1865c781.js} +1 -1
  196. package/dist/esm/v2/{OrSelect-eb5cc918.js → OrSelect-d887118b.js} +4 -4
  197. package/dist/esm/v2/{OrSlider-32a14ca4.js → OrSlider-c0a7f9cf.js} +1 -1
  198. package/dist/esm/v2/{OrStepper-462bc9e6.js → OrStepper-b00f7531.js} +2 -2
  199. package/dist/esm/v2/{OrTag-a1fff567.js → OrTag-6349049b.js} +1 -1
  200. package/dist/esm/v2/{OrTextbox-0a89a533.js → OrTextbox-0373bd6a.js} +3 -3
  201. package/dist/esm/v2/{OrToastContainer-5ce15a5b.js → OrToastContainer-1625b803.js} +3 -3
  202. package/dist/esm/v2/{OrTooltip-cfb56e8f.js → OrTooltip-97a42707.js} +1 -1
  203. package/dist/esm/v2/{OrTooltip.vue_rollup-plugin-vue_styles.0-122f7804.js → OrTooltip.vue_rollup-plugin-vue_styles.0-a256ac18.js} +1 -1
  204. package/dist/esm/v2/{OrTooltipContent-c9540548.js → OrTooltipContent-d85e1071.js} +2 -2
  205. package/dist/esm/v2/components/index.d.ts +0 -1
  206. package/dist/esm/v2/components/index.js +34 -58
  207. package/dist/esm/v2/components/or-avatar/index.js +4 -4
  208. package/dist/esm/v2/components/or-button-v2/index.js +8 -8
  209. package/dist/esm/v2/components/or-card-collection/index.js +9 -9
  210. package/dist/esm/v2/components/or-carousel/index.js +4 -4
  211. package/dist/esm/v2/components/or-checkbox/index.js +4 -4
  212. package/dist/esm/v2/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +91 -0
  213. package/dist/esm/v2/components/or-checkbox-group-v3/index.d.ts +1 -0
  214. package/dist/esm/v2/components/or-checkbox-group-v3/index.js +130 -0
  215. package/dist/esm/v2/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +91 -0
  216. package/dist/esm/v2/components/or-checkbox-tree-v3/index.d.ts +2 -0
  217. package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +12 -0
  218. package/dist/esm/v2/components/or-checkbox-tree-v3/styles.d.ts +2 -0
  219. package/dist/esm/v2/components/or-checkbox-tree-v3/types.d.ts +8 -0
  220. package/dist/esm/v2/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -16
  221. package/dist/esm/v2/components/or-checkbox-v3/index.js +2 -2
  222. package/dist/esm/v2/components/or-chips/index.js +6 -6
  223. package/dist/esm/v2/components/or-chips/or-chip/index.js +4 -4
  224. package/dist/esm/v2/components/or-code/index.js +9 -9
  225. package/dist/esm/v2/components/or-confirm/index.js +10 -10
  226. package/dist/esm/v2/components/or-date-time-picker/index.js +8 -8
  227. package/dist/esm/v2/components/or-form-group-v3/OrFormGroup.vue.d.ts +87 -0
  228. package/dist/esm/v2/components/or-form-group-v3/index.d.ts +2 -0
  229. package/dist/esm/v2/components/or-form-group-v3/index.js +6 -0
  230. package/dist/esm/v2/components/or-form-group-v3/props.d.ts +4 -0
  231. package/dist/esm/v2/components/or-form-group-v3/styles.d.ts +5 -0
  232. package/dist/esm/v2/components/or-icon/index.js +3 -3
  233. package/dist/esm/v2/components/or-icon-button-v2/index.js +6 -6
  234. package/dist/esm/v2/components/or-inline-text-edit/index.js +8 -8
  235. package/dist/esm/v2/components/or-list/index.js +9 -9
  236. package/dist/esm/v2/components/or-list-of-inputs/index.js +10 -10
  237. package/dist/esm/v2/components/or-modal/index.js +8 -8
  238. package/dist/esm/v2/components/or-notification/index.js +8 -8
  239. package/dist/esm/v2/components/or-overflow-menu/index.js +9 -9
  240. package/dist/esm/v2/components/or-password/index.js +8 -8
  241. package/dist/esm/v2/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +110 -0
  242. package/dist/esm/v2/components/or-radio-group-v3/index.d.ts +1 -0
  243. package/dist/esm/v2/components/or-radio-group-v3/index.js +124 -0
  244. package/dist/esm/v2/components/or-search/index.js +8 -8
  245. package/dist/esm/v2/components/or-select/index.js +7 -7
  246. package/dist/esm/v2/components/or-select-v3/index.js +2 -2
  247. package/dist/esm/v2/components/or-slider/index.js +4 -4
  248. package/dist/esm/v2/components/or-stepper/index.js +8 -8
  249. package/dist/esm/v2/components/or-tag/index.js +4 -4
  250. package/dist/esm/v2/components/or-textbox/index.js +8 -8
  251. package/dist/esm/v2/components/or-toast/index.js +8 -8
  252. package/dist/esm/v2/components/or-toast/or-toast-container/index.js +8 -8
  253. package/dist/esm/v2/components/or-tooltip/index.js +3 -3
  254. package/dist/esm/v2/components/or-tooltip/or-tooltip-content/index.js +1 -1
  255. package/dist/esm/v2/flattenDeep-e7a8b995.js +5 -0
  256. package/dist/esm/v2/index.d.ts +1 -0
  257. package/dist/esm/v2/index.js +35 -58
  258. package/dist/esm/v2/utils/functions/flattenDeep.d.ts +2 -0
  259. package/dist/esm/v3/{OrAvatar-b18f2208.js → OrAvatar-14a5c5f0.js} +1 -1
  260. package/dist/esm/v3/{OrButton-170b493f.js → OrButton-f8b10d79.js} +2 -2
  261. package/dist/esm/v3/{OrCardCollection-dc158967.js → OrCardCollection-ffbb9eda.js} +4 -4
  262. package/dist/esm/v3/{OrCarousel-8de5d65b.js → OrCarousel-03597740.js} +1 -1
  263. package/dist/esm/v3/{OrCheckbox-56f849f7.js → OrCheckbox-488b6915.js} +36 -19
  264. package/dist/esm/v3/{OrCheckbox-c2d9cf53.js → OrCheckbox-7efd5f26.js} +1 -1
  265. package/dist/esm/v3/OrCheckboxTree-87d0528b.js +182 -0
  266. package/dist/esm/v3/{OrChip-ccd4b331.js → OrChip-97a85e10.js} +1 -1
  267. package/dist/esm/v3/{OrChips-9a19aa03.js → OrChips-64b86761.js} +1 -1
  268. package/dist/esm/v3/{OrCode-b0b514ab.js → OrCode-6f2e4d99.js} +3 -3
  269. package/dist/esm/v3/{OrConfirm-1ffb7ed6.js → OrConfirm-ab04201f.js} +3 -3
  270. package/dist/esm/v3/{OrDateTimePicker-02c6de49.js → OrDateTimePicker-014f7819.js} +2 -2
  271. package/dist/esm/v3/OrFormGroup-9f581536.js +122 -0
  272. package/dist/esm/v3/{OrIcon-9b3d24cc.js → OrIcon-925c5413.js} +2 -2
  273. package/dist/esm/v3/{OrIconButton-9d08aa44.js → OrIconButton-5387fd59.js} +3 -3
  274. package/dist/esm/v3/{OrInlineTextEdit-8cfde85c.js → OrInlineTextEdit-6f97629f.js} +2 -2
  275. package/dist/esm/v3/{OrList-d3e330be.js → OrList-b8799cf4.js} +3 -3
  276. package/dist/esm/v3/{OrListOfInputs-3c8eaf97.js → OrListOfInputs-16ba8358.js} +4 -4
  277. package/dist/esm/v3/{OrModal-f8ae7146.js → OrModal-e6513e8c.js} +2 -2
  278. package/dist/esm/v3/{OrNotification-24192897.js → OrNotification-4c56f7ea.js} +3 -3
  279. package/dist/esm/v3/{OrOverflowMenu-a7568f8d.js → OrOverflowMenu-fe77e22c.js} +2 -2
  280. package/dist/esm/v3/{OrPassword-88a67993.js → OrPassword-9c8a458d.js} +2 -2
  281. package/dist/esm/v3/{OrSearch-fb2dd591.js → OrSearch-c4caf04e.js} +2 -2
  282. package/dist/esm/v3/{OrSelect-5502d82d.js → OrSelect-35b41c3f.js} +1 -1
  283. package/dist/esm/v3/{OrSelect-3d923250.js → OrSelect-d8a78242.js} +4 -4
  284. package/dist/esm/v3/{OrSlider-ae7b8a11.js → OrSlider-80e0f2e6.js} +1 -1
  285. package/dist/esm/v3/{OrStepper-446007c5.js → OrStepper-3a586401.js} +2 -2
  286. package/dist/esm/v3/{OrTag-38d1ba92.js → OrTag-e7adb078.js} +1 -1
  287. package/dist/esm/v3/{OrTextbox-7de2b10c.js → OrTextbox-f7388a30.js} +2 -2
  288. package/dist/esm/v3/{OrToastContainer-c3ecb1c8.js → OrToastContainer-94ba2803.js} +2 -2
  289. package/dist/esm/v3/{OrTooltip-be7209e5.js → OrTooltip-618ce7c9.js} +1 -1
  290. package/dist/esm/v3/{OrTooltipContent-68c34911.js → OrTooltipContent-37a5f562.js} +1 -1
  291. package/dist/esm/v3/components/index.d.ts +0 -1
  292. package/dist/esm/v3/components/index.js +30 -54
  293. package/dist/esm/v3/components/or-avatar/index.js +4 -4
  294. package/dist/esm/v3/components/or-button-v2/index.js +5 -5
  295. package/dist/esm/v3/components/or-card-collection/index.js +7 -7
  296. package/dist/esm/v3/components/or-carousel/index.js +4 -4
  297. package/dist/esm/v3/components/or-checkbox/index.js +4 -4
  298. package/dist/esm/v3/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +91 -0
  299. package/dist/esm/v3/components/or-checkbox-group-v3/index.d.ts +1 -0
  300. package/dist/esm/v3/components/or-checkbox-group-v3/index.js +97 -0
  301. package/dist/esm/v3/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +91 -0
  302. package/dist/esm/v3/components/or-checkbox-tree-v3/index.d.ts +2 -0
  303. package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +12 -0
  304. package/dist/esm/v3/components/or-checkbox-tree-v3/styles.d.ts +2 -0
  305. package/dist/esm/v3/components/or-checkbox-tree-v3/types.d.ts +8 -0
  306. package/dist/esm/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +18 -16
  307. package/dist/esm/v3/components/or-checkbox-v3/index.js +2 -2
  308. package/dist/esm/v3/components/or-chips/index.js +5 -5
  309. package/dist/esm/v3/components/or-chips/or-chip/index.js +4 -4
  310. package/dist/esm/v3/components/or-code/index.js +7 -7
  311. package/dist/esm/v3/components/or-confirm/index.js +7 -7
  312. package/dist/esm/v3/components/or-date-time-picker/index.js +6 -6
  313. package/dist/esm/v3/components/or-form-group-v3/OrFormGroup.vue.d.ts +87 -0
  314. package/dist/esm/v3/components/or-form-group-v3/index.d.ts +2 -0
  315. package/dist/esm/v3/components/or-form-group-v3/index.js +6 -0
  316. package/dist/esm/v3/components/or-form-group-v3/props.d.ts +4 -0
  317. package/dist/esm/v3/components/or-form-group-v3/styles.d.ts +5 -0
  318. package/dist/esm/v3/components/or-icon/index.js +3 -3
  319. package/dist/esm/v3/components/or-icon-button-v2/index.js +4 -4
  320. package/dist/esm/v3/components/or-inline-text-edit/index.js +6 -6
  321. package/dist/esm/v3/components/or-list/index.js +6 -6
  322. package/dist/esm/v3/components/or-list-of-inputs/index.js +7 -7
  323. package/dist/esm/v3/components/or-modal/index.js +6 -6
  324. package/dist/esm/v3/components/or-notification/index.js +6 -6
  325. package/dist/esm/v3/components/or-overflow-menu/index.js +6 -6
  326. package/dist/esm/v3/components/or-password/index.js +6 -6
  327. package/dist/esm/v3/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +110 -0
  328. package/dist/esm/v3/components/or-radio-group-v3/index.d.ts +1 -0
  329. package/dist/esm/v3/components/or-radio-group-v3/index.js +91 -0
  330. package/dist/esm/v3/components/or-search/index.js +6 -6
  331. package/dist/esm/v3/components/or-select/index.js +7 -7
  332. package/dist/esm/v3/components/or-select-v3/index.js +2 -2
  333. package/dist/esm/v3/components/or-slider/index.js +4 -4
  334. package/dist/esm/v3/components/or-stepper/index.js +6 -6
  335. package/dist/esm/v3/components/or-tag/index.js +4 -4
  336. package/dist/esm/v3/components/or-textbox/index.js +6 -6
  337. package/dist/esm/v3/components/or-toast/index.js +6 -6
  338. package/dist/esm/v3/components/or-toast/or-toast-container/index.js +6 -6
  339. package/dist/esm/v3/components/or-tooltip/index.js +2 -2
  340. package/dist/esm/v3/components/or-tooltip/or-tooltip-content/index.js +1 -1
  341. package/dist/esm/v3/flattenDeep-e7a8b995.js +5 -0
  342. package/dist/esm/v3/index.d.ts +1 -0
  343. package/dist/esm/v3/index.js +31 -54
  344. package/dist/esm/v3/utils/functions/flattenDeep.d.ts +2 -0
  345. package/package.json +5 -25
  346. package/src/components/index.ts +0 -1
  347. package/src/components/or-checkbox-group-v3/OrCheckboxGroup.docs.mdx +7 -0
  348. package/src/components/or-checkbox-group-v3/OrCheckboxGroup.stories3.ts +373 -0
  349. package/src/components/or-checkbox-group-v3/OrCheckboxGroup.vue +80 -0
  350. package/src/components/or-checkbox-group-v3/index.ts +1 -0
  351. package/src/components/or-checkbox-tree-v3/OrCheckboxTree.docs.mdx +7 -0
  352. package/src/components/or-checkbox-tree-v3/OrCheckboxTree.stories3.ts +112 -0
  353. package/src/components/or-checkbox-tree-v3/OrCheckboxTree.vue +192 -0
  354. package/src/components/or-checkbox-tree-v3/index.ts +2 -0
  355. package/src/components/or-checkbox-tree-v3/styles.ts +15 -0
  356. package/src/components/or-checkbox-tree-v3/types.ts +8 -0
  357. package/src/components/or-checkbox-v3/OrCheckbox.vue +33 -13
  358. package/src/components/or-form-group-v3/OrFormGroup.stories3.ts +114 -0
  359. package/src/components/or-form-group-v3/OrFormGroup.vue +116 -0
  360. package/src/components/or-form-group-v3/index.ts +2 -0
  361. package/src/components/or-form-group-v3/props.ts +4 -0
  362. package/src/components/or-form-group-v3/styles.ts +33 -0
  363. package/src/components/or-radio-group-v3/OrRadioGroup.stories3.ts +81 -0
  364. package/src/components/or-radio-group-v3/OrRadioGroup.vue +80 -0
  365. package/src/components/or-radio-group-v3/index.ts +1 -0
  366. package/src/components/or-radio-v3/OrRadio.stories3.ts +1 -1
  367. package/src/components/or-tooltip/or-tooltip-content/OrTooltipContent.vue +0 -1
  368. package/src/index.ts +1 -0
  369. package/src/utils/functions/flattenDeep.ts +5 -0
  370. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -1990
  371. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -170
  372. package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +0 -1
  373. package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +0 -68
  374. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -6
  375. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +0 -38
  376. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
  377. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
  378. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
  379. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
  380. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
  381. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
  382. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
  383. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
  384. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
  385. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
  386. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +0 -5
  387. package/dist/bundled/v2/index-62c3221b.js +0 -6956
  388. package/dist/bundled/v2/index.es-3f39f316.js +0 -115
  389. package/dist/bundled/v2/markdown-516daba9.js +0 -18737
  390. package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +0 -9360
  391. package/dist/bundled/v2/useFocusTrap-9567b3c8.js +0 -1268
  392. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f6f74339.js +0 -236
  393. package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-af0c4288.js +0 -107
  394. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-fec87993.js +0 -1765
  395. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -228
  396. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -170
  397. package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +0 -1
  398. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +0 -84
  399. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -6
  400. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +0 -38
  401. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
  402. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
  403. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
  404. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
  405. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
  406. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
  407. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
  408. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
  409. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
  410. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
  411. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +0 -5
  412. package/dist/bundled/v3/index-16aee5bc.js +0 -3740
  413. package/dist/bundled/v3/index-62c3221b.js +0 -6956
  414. package/dist/bundled/v3/index.es-3f39f316.js +0 -115
  415. package/dist/bundled/v3/markdown-516daba9.js +0 -18737
  416. package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +0 -9360
  417. package/dist/esm/v2/OrRichTextEditor-e19e74f4.js +0 -724
  418. package/dist/esm/v2/codemirrorView-be2c7423.js +0 -353
  419. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -170
  420. package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
  421. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +0 -59
  422. package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -6
  423. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
  424. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
  425. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
  426. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
  427. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
  428. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
  429. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
  430. package/dist/esm/v3/OrRichTextEditor-f5c54d46.js +0 -687
  431. package/dist/esm/v3/codemirrorView-be2c7423.js +0 -353
  432. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -170
  433. package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
  434. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +0 -57
  435. package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -6
  436. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
  437. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
  438. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
  439. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
  440. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
  441. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
  442. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
  443. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -7
  444. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -102
  445. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -624
  446. package/src/components/or-rich-text-editor-v3/index.ts +0 -1
  447. package/src/components/or-rich-text-editor-v3/styles.ts +0 -64
  448. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +0 -40
  449. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +0 -254
  450. package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +0 -1
  451. package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +0 -213
  452. package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +0 -22
  453. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +0 -117
  454. /package/dist/bundled/v2/components/{OrRichTextEditorV3/utils/codemirror → OrCheckboxTreeV3}/types.js +0 -0
  455. /package/dist/bundled/v3/{OrIcon.vue_vue_type_script_lang-e3152dc5.js → OrIcon.vue_vue_type_script_lang-e5349e49.js} +0 -0
  456. /package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-0811fd48.js → OrToastContainer.vue_vue_type_script_lang-70cc38be.js} +0 -0
  457. /package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-b8594f7e.js → OrTooltip.vue_vue_type_script_lang-76a6b7f4.js} +0 -0
  458. /package/dist/bundled/v3/components/{OrRichTextEditorV3/utils/codemirror → OrCheckboxTreeV3}/types.js +0 -0
@@ -1,1268 +0,0 @@
1
- import { unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
- import { ref, watch } from 'vue-demi';
3
-
4
- /*!
5
- * tabbable 6.0.1
6
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
7
- */
8
- var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
9
- var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
10
- var NoElement = typeof Element === 'undefined';
11
- var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
12
- var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
13
- return element.getRootNode();
14
- } : function (element) {
15
- return element.ownerDocument;
16
- };
17
-
18
- /**
19
- * @param {Element} el container to check in
20
- * @param {boolean} includeContainer add container to check
21
- * @param {(node: Element) => boolean} filter filter candidates
22
- * @returns {Element[]}
23
- */
24
- var getCandidates = function getCandidates(el, includeContainer, filter) {
25
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
26
- if (includeContainer && matches.call(el, candidateSelector)) {
27
- candidates.unshift(el);
28
- }
29
- candidates = candidates.filter(filter);
30
- return candidates;
31
- };
32
-
33
- /**
34
- * @callback GetShadowRoot
35
- * @param {Element} element to check for shadow root
36
- * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
37
- */
38
-
39
- /**
40
- * @callback ShadowRootFilter
41
- * @param {Element} shadowHostNode the element which contains shadow content
42
- * @returns {boolean} true if a shadow root could potentially contain valid candidates.
43
- */
44
-
45
- /**
46
- * @typedef {Object} CandidateScope
47
- * @property {Element} scopeParent contains inner candidates
48
- * @property {Element[]} candidates list of candidates found in the scope parent
49
- */
50
-
51
- /**
52
- * @typedef {Object} IterativeOptions
53
- * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
54
- * if a function, implies shadow support is enabled and either returns the shadow root of an element
55
- * or a boolean stating if it has an undisclosed shadow root
56
- * @property {(node: Element) => boolean} filter filter candidates
57
- * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
58
- * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
59
- */
60
-
61
- /**
62
- * @param {Element[]} elements list of element containers to match candidates from
63
- * @param {boolean} includeContainer add container list to check
64
- * @param {IterativeOptions} options
65
- * @returns {Array.<Element|CandidateScope>}
66
- */
67
- var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
68
- var candidates = [];
69
- var elementsToCheck = Array.from(elements);
70
- while (elementsToCheck.length) {
71
- var element = elementsToCheck.shift();
72
- if (element.tagName === 'SLOT') {
73
- // add shadow dom slot scope (slot itself cannot be focusable)
74
- var assigned = element.assignedElements();
75
- var content = assigned.length ? assigned : element.children;
76
- var nestedCandidates = getCandidatesIteratively(content, true, options);
77
- if (options.flatten) {
78
- candidates.push.apply(candidates, nestedCandidates);
79
- } else {
80
- candidates.push({
81
- scopeParent: element,
82
- candidates: nestedCandidates
83
- });
84
- }
85
- } else {
86
- // check candidate element
87
- var validCandidate = matches.call(element, candidateSelector);
88
- if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
89
- candidates.push(element);
90
- }
91
-
92
- // iterate over shadow content if possible
93
- var shadowRoot = element.shadowRoot ||
94
- // check for an undisclosed shadow
95
- typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
96
- var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
97
- if (shadowRoot && validShadowRoot) {
98
- // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
99
- // shadow exists, so look at light dom children as fallback BUT create a scope for any
100
- // child candidates found because they're likely slotted elements (elements that are
101
- // children of the web component element (which has the shadow), in the light dom, but
102
- // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
103
- // _after_ we return from this recursive call
104
- var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
105
- if (options.flatten) {
106
- candidates.push.apply(candidates, _nestedCandidates);
107
- } else {
108
- candidates.push({
109
- scopeParent: element,
110
- candidates: _nestedCandidates
111
- });
112
- }
113
- } else {
114
- // there's not shadow so just dig into the element's (light dom) children
115
- // __without__ giving the element special scope treatment
116
- elementsToCheck.unshift.apply(elementsToCheck, element.children);
117
- }
118
- }
119
- }
120
- return candidates;
121
- };
122
- var getTabindex = function getTabindex(node, isScope) {
123
- if (node.tabIndex < 0) {
124
- // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
125
- // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
126
- // yet they are still part of the regular tab order; in FF, they get a default
127
- // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
128
- // order, consider their tab index to be 0.
129
- // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
130
- // so if they don't have a tabindex attribute specifically set, assume it's 0.
131
- //
132
- // isScope is positive for custom element with shadow root or slot that by default
133
- // have tabIndex -1, but need to be sorted by document order in order for their
134
- // content to be inserted in the correct position
135
- if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
136
- return 0;
137
- }
138
- }
139
- return node.tabIndex;
140
- };
141
- var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
142
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
143
- };
144
- var isInput = function isInput(node) {
145
- return node.tagName === 'INPUT';
146
- };
147
- var isHiddenInput = function isHiddenInput(node) {
148
- return isInput(node) && node.type === 'hidden';
149
- };
150
- var isDetailsWithSummary = function isDetailsWithSummary(node) {
151
- var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
152
- return child.tagName === 'SUMMARY';
153
- });
154
- return r;
155
- };
156
- var getCheckedRadio = function getCheckedRadio(nodes, form) {
157
- for (var i = 0; i < nodes.length; i++) {
158
- if (nodes[i].checked && nodes[i].form === form) {
159
- return nodes[i];
160
- }
161
- }
162
- };
163
- var isTabbableRadio = function isTabbableRadio(node) {
164
- if (!node.name) {
165
- return true;
166
- }
167
- var radioScope = node.form || getRootNode(node);
168
- var queryRadios = function queryRadios(name) {
169
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
170
- };
171
- var radioSet;
172
- if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
173
- radioSet = queryRadios(window.CSS.escape(node.name));
174
- } else {
175
- try {
176
- radioSet = queryRadios(node.name);
177
- } catch (err) {
178
- // eslint-disable-next-line no-console
179
- console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
180
- return false;
181
- }
182
- }
183
- var checked = getCheckedRadio(radioSet, node.form);
184
- return !checked || checked === node;
185
- };
186
- var isRadio = function isRadio(node) {
187
- return isInput(node) && node.type === 'radio';
188
- };
189
- var isNonTabbableRadio = function isNonTabbableRadio(node) {
190
- return isRadio(node) && !isTabbableRadio(node);
191
- };
192
-
193
- // determines if a node is ultimately attached to the window's document
194
- var isNodeAttached = function isNodeAttached(node) {
195
- var _nodeRootHost;
196
- // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
197
- // (but NOT _the_ document; see second 'If' comment below for more).
198
- // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
199
- // is attached, and the one we need to check if it's in the document or not (because the
200
- // shadow, and all nodes it contains, is never considered in the document since shadows
201
- // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,
202
- // is hidden, or is not in the document itself but is detached, it will affect the shadow's
203
- // visibility, including all the nodes it contains). The host could be any normal node,
204
- // or a custom element (i.e. web component). Either way, that's the one that is considered
205
- // part of the document, not the shadow root, nor any of its children (i.e. the node being
206
- // tested).
207
- // To further complicate things, we have to look all the way up until we find a shadow HOST
208
- // that is attached (or find none) because the node might be in nested shadows...
209
- // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the
210
- // document (per the docs) and while it's a Document-type object, that document does not
211
- // appear to be the same as the node's `ownerDocument` for some reason, so it's safer
212
- // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
213
- // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
214
- // node is actually detached.
215
- var nodeRootHost = getRootNode(node).host;
216
- var attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && _nodeRootHost.ownerDocument.contains(nodeRootHost) || node.ownerDocument.contains(node));
217
- while (!attached && nodeRootHost) {
218
- var _nodeRootHost2;
219
- // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
220
- // which means we need to get the host's host and check if that parent host is contained
221
- // in (i.e. attached to) the document
222
- nodeRootHost = getRootNode(nodeRootHost).host;
223
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && _nodeRootHost2.ownerDocument.contains(nodeRootHost));
224
- }
225
- return attached;
226
- };
227
- var isZeroArea = function isZeroArea(node) {
228
- var _node$getBoundingClie = node.getBoundingClientRect(),
229
- width = _node$getBoundingClie.width,
230
- height = _node$getBoundingClie.height;
231
- return width === 0 && height === 0;
232
- };
233
- var isHidden = function isHidden(node, _ref) {
234
- var displayCheck = _ref.displayCheck,
235
- getShadowRoot = _ref.getShadowRoot;
236
- // NOTE: visibility will be `undefined` if node is detached from the document
237
- // (see notes about this further down), which means we will consider it visible
238
- // (this is legacy behavior from a very long way back)
239
- // NOTE: we check this regardless of `displayCheck="none"` because this is a
240
- // _visibility_ check, not a _display_ check
241
- if (getComputedStyle(node).visibility === 'hidden') {
242
- return true;
243
- }
244
- var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
245
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
246
- if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
247
- return true;
248
- }
249
- if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
250
- if (typeof getShadowRoot === 'function') {
251
- // figure out if we should consider the node to be in an undisclosed shadow and use the
252
- // 'non-zero-area' fallback
253
- var originalNode = node;
254
- while (node) {
255
- var parentElement = node.parentElement;
256
- var rootNode = getRootNode(node);
257
- if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
258
- ) {
259
- // node has an undisclosed shadow which means we can only treat it as a black box, so we
260
- // fall back to a non-zero-area test
261
- return isZeroArea(node);
262
- } else if (node.assignedSlot) {
263
- // iterate up slot
264
- node = node.assignedSlot;
265
- } else if (!parentElement && rootNode !== node.ownerDocument) {
266
- // cross shadow boundary
267
- node = rootNode.host;
268
- } else {
269
- // iterate up normal dom
270
- node = parentElement;
271
- }
272
- }
273
- node = originalNode;
274
- }
275
- // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
276
- // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
277
- // it might be a falsy value, which means shadow DOM support is disabled
278
-
279
- // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)
280
- // now we can just test to see if it would normally be visible or not, provided it's
281
- // attached to the main document.
282
- // NOTE: We must consider case where node is inside a shadow DOM and given directly to
283
- // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.
284
-
285
- if (isNodeAttached(node)) {
286
- // this works wherever the node is: if there's at least one client rect, it's
287
- // somehow displayed; it also covers the CSS 'display: contents' case where the
288
- // node itself is hidden in place of its contents; and there's no need to search
289
- // up the hierarchy either
290
- return !node.getClientRects().length;
291
- }
292
-
293
- // Else, the node isn't attached to the document, which means the `getClientRects()`
294
- // API will __always__ return zero rects (this can happen, for example, if React
295
- // is used to render nodes onto a detached tree, as confirmed in this thread:
296
- // https://github.com/facebook/react/issues/9117#issuecomment-284228870)
297
- //
298
- // It also means that even window.getComputedStyle(node).display will return `undefined`
299
- // because styles are only computed for nodes that are in the document.
300
- //
301
- // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable
302
- // somehow. Though it was never stated officially, anyone who has ever used tabbable
303
- // APIs on nodes in detached containers has actually implicitly used tabbable in what
304
- // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially
305
- // considering __everything__ to be visible because of the innability to determine styles.
306
- //
307
- // v6.0.0: As of this major release, the default 'full' option __no longer treats detached
308
- // nodes as visible with the 'none' fallback.__
309
- if (displayCheck !== 'legacy-full') {
310
- return true; // hidden
311
- }
312
- // else, fallback to 'none' mode and consider the node visible
313
- } else if (displayCheck === 'non-zero-area') {
314
- // NOTE: Even though this tests that the node's client rect is non-zero to determine
315
- // whether it's displayed, and that a detached node will __always__ have a zero-area
316
- // client rect, we don't special-case for whether the node is attached or not. In
317
- // this mode, we do want to consider nodes that have a zero area to be hidden at all
318
- // times, and that includes attached or not.
319
- return isZeroArea(node);
320
- }
321
-
322
- // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
323
- // it's visible
324
- return false;
325
- };
326
-
327
- // form fields (nested) inside a disabled fieldset are not focusable/tabbable
328
- // unless they are in the _first_ <legend> element of the top-most disabled
329
- // fieldset
330
- var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
331
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
332
- var parentNode = node.parentElement;
333
- // check if `node` is contained in a disabled <fieldset>
334
- while (parentNode) {
335
- if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
336
- // look for the first <legend> among the children of the disabled <fieldset>
337
- for (var i = 0; i < parentNode.children.length; i++) {
338
- var child = parentNode.children.item(i);
339
- // when the first <legend> (in document order) is found
340
- if (child.tagName === 'LEGEND') {
341
- // if its parent <fieldset> is not nested in another disabled <fieldset>,
342
- // return whether `node` is a descendant of its first <legend>
343
- return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
344
- }
345
- }
346
- // the disabled <fieldset> containing `node` has no <legend>
347
- return true;
348
- }
349
- parentNode = parentNode.parentElement;
350
- }
351
- }
352
-
353
- // else, node's tabbable/focusable state should not be affected by a fieldset's
354
- // enabled/disabled state
355
- return false;
356
- };
357
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
358
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
359
- // For a details element with a summary, the summary element gets the focus
360
- isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
361
- return false;
362
- }
363
- return true;
364
- };
365
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
366
- if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
367
- return false;
368
- }
369
- return true;
370
- };
371
- var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
372
- var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
373
- if (isNaN(tabIndex) || tabIndex >= 0) {
374
- return true;
375
- }
376
- // If a custom element has an explicit negative tabindex,
377
- // browsers will not allow tab targeting said element's children.
378
- return false;
379
- };
380
-
381
- /**
382
- * @param {Array.<Element|CandidateScope>} candidates
383
- * @returns Element[]
384
- */
385
- var sortByOrder = function sortByOrder(candidates) {
386
- var regularTabbables = [];
387
- var orderedTabbables = [];
388
- candidates.forEach(function (item, i) {
389
- var isScope = !!item.scopeParent;
390
- var element = isScope ? item.scopeParent : item;
391
- var candidateTabindex = getTabindex(element, isScope);
392
- var elements = isScope ? sortByOrder(item.candidates) : element;
393
- if (candidateTabindex === 0) {
394
- isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
395
- } else {
396
- orderedTabbables.push({
397
- documentOrder: i,
398
- tabIndex: candidateTabindex,
399
- item: item,
400
- isScope: isScope,
401
- content: elements
402
- });
403
- }
404
- });
405
- return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
406
- sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
407
- return acc;
408
- }, []).concat(regularTabbables);
409
- };
410
- var tabbable = function tabbable(el, options) {
411
- options = options || {};
412
- var candidates;
413
- if (options.getShadowRoot) {
414
- candidates = getCandidatesIteratively([el], options.includeContainer, {
415
- filter: isNodeMatchingSelectorTabbable.bind(null, options),
416
- flatten: false,
417
- getShadowRoot: options.getShadowRoot,
418
- shadowRootFilter: isValidShadowRootTabbable
419
- });
420
- } else {
421
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
422
- }
423
- return sortByOrder(candidates);
424
- };
425
- var focusable = function focusable(el, options) {
426
- options = options || {};
427
- var candidates;
428
- if (options.getShadowRoot) {
429
- candidates = getCandidatesIteratively([el], options.includeContainer, {
430
- filter: isNodeMatchingSelectorFocusable.bind(null, options),
431
- flatten: true,
432
- getShadowRoot: options.getShadowRoot
433
- });
434
- } else {
435
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
436
- }
437
- return candidates;
438
- };
439
- var isTabbable = function isTabbable(node, options) {
440
- options = options || {};
441
- if (!node) {
442
- throw new Error('No node provided');
443
- }
444
- if (matches.call(node, candidateSelector) === false) {
445
- return false;
446
- }
447
- return isNodeMatchingSelectorTabbable(options, node);
448
- };
449
- var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
450
- var isFocusable = function isFocusable(node, options) {
451
- options = options || {};
452
- if (!node) {
453
- throw new Error('No node provided');
454
- }
455
- if (matches.call(node, focusableCandidateSelector) === false) {
456
- return false;
457
- }
458
- return isNodeMatchingSelectorFocusable(options, node);
459
- };
460
-
461
- /*!
462
- * focus-trap 7.2.0
463
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
464
- */
465
- function ownKeys(object, enumerableOnly) {
466
- var keys = Object.keys(object);
467
- if (Object.getOwnPropertySymbols) {
468
- var symbols = Object.getOwnPropertySymbols(object);
469
- enumerableOnly && (symbols = symbols.filter(function (sym) {
470
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
471
- })), keys.push.apply(keys, symbols);
472
- }
473
- return keys;
474
- }
475
- function _objectSpread2(target) {
476
- for (var i = 1; i < arguments.length; i++) {
477
- var source = null != arguments[i] ? arguments[i] : {};
478
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
479
- _defineProperty(target, key, source[key]);
480
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
481
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
482
- });
483
- }
484
- return target;
485
- }
486
- function _defineProperty(obj, key, value) {
487
- key = _toPropertyKey(key);
488
- if (key in obj) {
489
- Object.defineProperty(obj, key, {
490
- value: value,
491
- enumerable: true,
492
- configurable: true,
493
- writable: true
494
- });
495
- } else {
496
- obj[key] = value;
497
- }
498
- return obj;
499
- }
500
- function _toPrimitive(input, hint) {
501
- if (typeof input !== "object" || input === null) return input;
502
- var prim = input[Symbol.toPrimitive];
503
- if (prim !== undefined) {
504
- var res = prim.call(input, hint || "default");
505
- if (typeof res !== "object") return res;
506
- throw new TypeError("@@toPrimitive must return a primitive value.");
507
- }
508
- return (hint === "string" ? String : Number)(input);
509
- }
510
- function _toPropertyKey(arg) {
511
- var key = _toPrimitive(arg, "string");
512
- return typeof key === "symbol" ? key : String(key);
513
- }
514
- var activeFocusTraps = {
515
- activateTrap: function activateTrap(trapStack, trap) {
516
- if (trapStack.length > 0) {
517
- var activeTrap = trapStack[trapStack.length - 1];
518
- if (activeTrap !== trap) {
519
- activeTrap.pause();
520
- }
521
- }
522
- var trapIndex = trapStack.indexOf(trap);
523
- if (trapIndex === -1) {
524
- trapStack.push(trap);
525
- } else {
526
- // move this existing trap to the front of the queue
527
- trapStack.splice(trapIndex, 1);
528
- trapStack.push(trap);
529
- }
530
- },
531
- deactivateTrap: function deactivateTrap(trapStack, trap) {
532
- var trapIndex = trapStack.indexOf(trap);
533
- if (trapIndex !== -1) {
534
- trapStack.splice(trapIndex, 1);
535
- }
536
- if (trapStack.length > 0) {
537
- trapStack[trapStack.length - 1].unpause();
538
- }
539
- }
540
- };
541
- var isSelectableInput = function isSelectableInput(node) {
542
- return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
543
- };
544
- var isEscapeEvent = function isEscapeEvent(e) {
545
- return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
546
- };
547
- var isTabEvent = function isTabEvent(e) {
548
- return e.key === 'Tab' || e.keyCode === 9;
549
- };
550
-
551
- // checks for TAB by default
552
- var isKeyForward = function isKeyForward(e) {
553
- return isTabEvent(e) && !e.shiftKey;
554
- };
555
-
556
- // checks for SHIFT+TAB by default
557
- var isKeyBackward = function isKeyBackward(e) {
558
- return isTabEvent(e) && e.shiftKey;
559
- };
560
- var delay = function delay(fn) {
561
- return setTimeout(fn, 0);
562
- };
563
-
564
- // Array.find/findIndex() are not supported on IE; this replicates enough
565
- // of Array.findIndex() for our needs
566
- var findIndex = function findIndex(arr, fn) {
567
- var idx = -1;
568
- arr.every(function (value, i) {
569
- if (fn(value)) {
570
- idx = i;
571
- return false; // break
572
- }
573
-
574
- return true; // next
575
- });
576
-
577
- return idx;
578
- };
579
-
580
- /**
581
- * Get an option's value when it could be a plain value, or a handler that provides
582
- * the value.
583
- * @param {*} value Option's value to check.
584
- * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
585
- * @returns {*} The `value`, or the handler's returned value.
586
- */
587
- var valueOrHandler = function valueOrHandler(value) {
588
- for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
589
- params[_key - 1] = arguments[_key];
590
- }
591
- return typeof value === 'function' ? value.apply(void 0, params) : value;
592
- };
593
- var getActualTarget = function getActualTarget(event) {
594
- // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
595
- // shadow host. However, event.target.composedPath() will be an array of
596
- // nodes "clicked" from inner-most (the actual element inside the shadow) to
597
- // outer-most (the host HTML document). If we have access to composedPath(),
598
- // then use its first element; otherwise, fall back to event.target (and
599
- // this only works for an _open_ shadow DOM; otherwise,
600
- // composedPath()[0] === event.target always).
601
- return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
602
- };
603
-
604
- // NOTE: this must be _outside_ `createFocusTrap()` to make sure all traps in this
605
- // current instance use the same stack if `userOptions.trapStack` isn't specified
606
- var internalTrapStack = [];
607
- var createFocusTrap = function createFocusTrap(elements, userOptions) {
608
- // SSR: a live trap shouldn't be created in this type of environment so this
609
- // should be safe code to execute if the `document` option isn't specified
610
- var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
611
- var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack;
612
- var config = _objectSpread2({
613
- returnFocusOnDeactivate: true,
614
- escapeDeactivates: true,
615
- delayInitialFocus: true,
616
- isKeyForward: isKeyForward,
617
- isKeyBackward: isKeyBackward
618
- }, userOptions);
619
- var state = {
620
- // containers given to createFocusTrap()
621
- // @type {Array<HTMLElement>}
622
- containers: [],
623
- // list of objects identifying tabbable nodes in `containers` in the trap
624
- // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
625
- // is active, but the trap should never get to a state where there isn't at least one group
626
- // with at least one tabbable node in it (that would lead to an error condition that would
627
- // result in an error being thrown)
628
- // @type {Array<{
629
- // container: HTMLElement,
630
- // tabbableNodes: Array<HTMLElement>, // empty if none
631
- // focusableNodes: Array<HTMLElement>, // empty if none
632
- // firstTabbableNode: HTMLElement|null,
633
- // lastTabbableNode: HTMLElement|null,
634
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
635
- // }>}
636
- containerGroups: [],
637
- // same order/length as `containers` list
638
-
639
- // references to objects in `containerGroups`, but only those that actually have
640
- // tabbable nodes in them
641
- // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
642
- // the same length
643
- tabbableGroups: [],
644
- nodeFocusedBeforeActivation: null,
645
- mostRecentlyFocusedNode: null,
646
- active: false,
647
- paused: false,
648
- // timer ID for when delayInitialFocus is true and initial focus in this trap
649
- // has been delayed during activation
650
- delayInitialFocusTimer: undefined
651
- };
652
- var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
653
-
654
- /**
655
- * Gets a configuration option value.
656
- * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,
657
- * value will be taken from this object. Otherwise, value will be taken from base configuration.
658
- * @param {string} optionName Name of the option whose value is sought.
659
- * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
660
- * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
661
- */
662
- var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
663
- return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
664
- };
665
-
666
- /**
667
- * Finds the index of the container that contains the element.
668
- * @param {HTMLElement} element
669
- * @returns {number} Index of the container in either `state.containers` or
670
- * `state.containerGroups` (the order/length of these lists are the same); -1
671
- * if the element isn't found.
672
- */
673
- var findContainerIndex = function findContainerIndex(element) {
674
- // NOTE: search `containerGroups` because it's possible a group contains no tabbable
675
- // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
676
- // and we still need to find the element in there
677
- return state.containerGroups.findIndex(function (_ref) {
678
- var container = _ref.container,
679
- tabbableNodes = _ref.tabbableNodes;
680
- return container.contains(element) ||
681
- // fall back to explicit tabbable search which will take into consideration any
682
- // web components if the `tabbableOptions.getShadowRoot` option was used for
683
- // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
684
- // look inside web components even if open)
685
- tabbableNodes.find(function (node) {
686
- return node === element;
687
- });
688
- });
689
- };
690
-
691
- /**
692
- * Gets the node for the given option, which is expected to be an option that
693
- * can be either a DOM node, a string that is a selector to get a node, `false`
694
- * (if a node is explicitly NOT given), or a function that returns any of these
695
- * values.
696
- * @param {string} optionName
697
- * @returns {undefined | false | HTMLElement | SVGElement} Returns
698
- * `undefined` if the option is not specified; `false` if the option
699
- * resolved to `false` (node explicitly not given); otherwise, the resolved
700
- * DOM node.
701
- * @throws {Error} If the option is set, not `false`, and is not, or does not
702
- * resolve to a node.
703
- */
704
- var getNodeForOption = function getNodeForOption(optionName) {
705
- var optionValue = config[optionName];
706
- if (typeof optionValue === 'function') {
707
- for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
708
- params[_key2 - 1] = arguments[_key2];
709
- }
710
- optionValue = optionValue.apply(void 0, params);
711
- }
712
- if (optionValue === true) {
713
- optionValue = undefined; // use default value
714
- }
715
-
716
- if (!optionValue) {
717
- if (optionValue === undefined || optionValue === false) {
718
- return optionValue;
719
- }
720
- // else, empty string (invalid), null (invalid), 0 (invalid)
721
-
722
- throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
723
- }
724
- var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
725
-
726
- if (typeof optionValue === 'string') {
727
- node = doc.querySelector(optionValue); // resolve to node, or null if fails
728
- if (!node) {
729
- throw new Error("`".concat(optionName, "` as selector refers to no known node"));
730
- }
731
- }
732
- return node;
733
- };
734
- var getInitialFocusNode = function getInitialFocusNode() {
735
- var node = getNodeForOption('initialFocus');
736
-
737
- // false explicitly indicates we want no initialFocus at all
738
- if (node === false) {
739
- return false;
740
- }
741
- if (node === undefined) {
742
- // option not specified: use fallback options
743
- if (findContainerIndex(doc.activeElement) >= 0) {
744
- node = doc.activeElement;
745
- } else {
746
- var firstTabbableGroup = state.tabbableGroups[0];
747
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
748
-
749
- // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
750
- node = firstTabbableNode || getNodeForOption('fallbackFocus');
751
- }
752
- }
753
- if (!node) {
754
- throw new Error('Your focus-trap needs to have at least one focusable element');
755
- }
756
- return node;
757
- };
758
- var updateTabbableNodes = function updateTabbableNodes() {
759
- state.containerGroups = state.containers.map(function (container) {
760
- var tabbableNodes = tabbable(container, config.tabbableOptions);
761
-
762
- // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
763
- // are a superset of tabbable nodes
764
- var focusableNodes = focusable(container, config.tabbableOptions);
765
- return {
766
- container: container,
767
- tabbableNodes: tabbableNodes,
768
- focusableNodes: focusableNodes,
769
- firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
770
- lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
771
- /**
772
- * Finds the __tabbable__ node that follows the given node in the specified direction,
773
- * in this container, if any.
774
- * @param {HTMLElement} node
775
- * @param {boolean} [forward] True if going in forward tab order; false if going
776
- * in reverse.
777
- * @returns {HTMLElement|undefined} The next tabbable node, if any.
778
- */
779
- nextTabbableNode: function nextTabbableNode(node) {
780
- var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
781
- // NOTE: If tabindex is positive (in order to manipulate the tab order separate
782
- // from the DOM order), this __will not work__ because the list of focusableNodes,
783
- // while it contains tabbable nodes, does not sort its nodes in any order other
784
- // than DOM order, because it can't: Where would you place focusable (but not
785
- // tabbable) nodes in that order? They have no order, because they aren't tabbale...
786
- // Support for positive tabindex is already broken and hard to manage (possibly
787
- // not supportable, TBD), so this isn't going to make things worse than they
788
- // already are, and at least makes things better for the majority of cases where
789
- // tabindex is either 0/unset or negative.
790
- // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
791
- var nodeIdx = focusableNodes.findIndex(function (n) {
792
- return n === node;
793
- });
794
- if (nodeIdx < 0) {
795
- return undefined;
796
- }
797
- if (forward) {
798
- return focusableNodes.slice(nodeIdx + 1).find(function (n) {
799
- return isTabbable(n, config.tabbableOptions);
800
- });
801
- }
802
- return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
803
- return isTabbable(n, config.tabbableOptions);
804
- });
805
- }
806
- };
807
- });
808
- state.tabbableGroups = state.containerGroups.filter(function (group) {
809
- return group.tabbableNodes.length > 0;
810
- });
811
-
812
- // throw if no groups have tabbable nodes and we don't have a fallback focus node either
813
- if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
814
- ) {
815
- throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
816
- }
817
- };
818
- var tryFocus = function tryFocus(node) {
819
- if (node === false) {
820
- return;
821
- }
822
- if (node === doc.activeElement) {
823
- return;
824
- }
825
- if (!node || !node.focus) {
826
- tryFocus(getInitialFocusNode());
827
- return;
828
- }
829
- node.focus({
830
- preventScroll: !!config.preventScroll
831
- });
832
- state.mostRecentlyFocusedNode = node;
833
- if (isSelectableInput(node)) {
834
- node.select();
835
- }
836
- };
837
- var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
838
- var node = getNodeForOption('setReturnFocus', previousActiveElement);
839
- return node ? node : node === false ? false : previousActiveElement;
840
- };
841
-
842
- // This needs to be done on mousedown and touchstart instead of click
843
- // so that it precedes the focus event.
844
- var checkPointerDown = function checkPointerDown(e) {
845
- var target = getActualTarget(e);
846
- if (findContainerIndex(target) >= 0) {
847
- // allow the click since it ocurred inside the trap
848
- return;
849
- }
850
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
851
- // immediately deactivate the trap
852
- trap.deactivate({
853
- // if, on deactivation, we should return focus to the node originally-focused
854
- // when the trap was activated (or the configured `setReturnFocus` node),
855
- // then assume it's also OK to return focus to the outside node that was
856
- // just clicked, causing deactivation, as long as that node is focusable;
857
- // if it isn't focusable, then return focus to the original node focused
858
- // on activation (or the configured `setReturnFocus` node)
859
- // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
860
- // which will result in the outside click setting focus to the node
861
- // that was clicked, whether it's focusable or not; by setting
862
- // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
863
- // on activation (or the configured `setReturnFocus` node)
864
- returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
865
- });
866
- return;
867
- }
868
-
869
- // This is needed for mobile devices.
870
- // (If we'll only let `click` events through,
871
- // then on mobile they will be blocked anyways if `touchstart` is blocked.)
872
- if (valueOrHandler(config.allowOutsideClick, e)) {
873
- // allow the click outside the trap to take place
874
- return;
875
- }
876
-
877
- // otherwise, prevent the click
878
- e.preventDefault();
879
- };
880
-
881
- // In case focus escapes the trap for some strange reason, pull it back in.
882
- var checkFocusIn = function checkFocusIn(e) {
883
- var target = getActualTarget(e);
884
- var targetContained = findContainerIndex(target) >= 0;
885
-
886
- // In Firefox when you Tab out of an iframe the Document is briefly focused.
887
- if (targetContained || target instanceof Document) {
888
- if (targetContained) {
889
- state.mostRecentlyFocusedNode = target;
890
- }
891
- } else {
892
- // escaped! pull it back in to where it just left
893
- e.stopImmediatePropagation();
894
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
895
- }
896
- };
897
-
898
- // Hijack key nav events on the first and last focusable nodes of the trap,
899
- // in order to prevent focus from escaping. If it escapes for even a
900
- // moment it can end up scrolling the page and causing confusion so we
901
- // kind of need to capture the action at the keydown phase.
902
- var checkKeyNav = function checkKeyNav(event) {
903
- var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
904
- var target = getActualTarget(event);
905
- updateTabbableNodes();
906
- var destinationNode = null;
907
- if (state.tabbableGroups.length > 0) {
908
- // make sure the target is actually contained in a group
909
- // NOTE: the target may also be the container itself if it's focusable
910
- // with tabIndex='-1' and was given initial focus
911
- var containerIndex = findContainerIndex(target);
912
- var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
913
- if (containerIndex < 0) {
914
- // target not found in any group: quite possible focus has escaped the trap,
915
- // so bring it back into...
916
- if (isBackward) {
917
- // ...the last node in the last group
918
- destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
919
- } else {
920
- // ...the first node in the first group
921
- destinationNode = state.tabbableGroups[0].firstTabbableNode;
922
- }
923
- } else if (isBackward) {
924
- // REVERSE
925
-
926
- // is the target the first tabbable node in a group?
927
- var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
928
- var firstTabbableNode = _ref2.firstTabbableNode;
929
- return target === firstTabbableNode;
930
- });
931
- if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
932
- // an exception case where the target is either the container itself, or
933
- // a non-tabbable node that was given focus (i.e. tabindex is negative
934
- // and user clicked on it or node was programmatically given focus)
935
- // and is not followed by any other tabbable node, in which
936
- // case, we should handle shift+tab as if focus were on the container's
937
- // first tabbable node, and go to the last tabbable node of the LAST group
938
- startOfGroupIndex = containerIndex;
939
- }
940
- if (startOfGroupIndex >= 0) {
941
- // YES: then shift+tab should go to the last tabbable node in the
942
- // previous group (and wrap around to the last tabbable node of
943
- // the LAST group if it's the first tabbable node of the FIRST group)
944
- var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
945
- var destinationGroup = state.tabbableGroups[destinationGroupIndex];
946
- destinationNode = destinationGroup.lastTabbableNode;
947
- } else if (!isTabEvent(event)) {
948
- // user must have customized the nav keys so we have to move focus manually _within_
949
- // the active group: do this based on the order determined by tabbable()
950
- destinationNode = containerGroup.nextTabbableNode(target, false);
951
- }
952
- } else {
953
- // FORWARD
954
-
955
- // is the target the last tabbable node in a group?
956
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
957
- var lastTabbableNode = _ref3.lastTabbableNode;
958
- return target === lastTabbableNode;
959
- });
960
- if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
961
- // an exception case where the target is the container itself, or
962
- // a non-tabbable node that was given focus (i.e. tabindex is negative
963
- // and user clicked on it or node was programmatically given focus)
964
- // and is not followed by any other tabbable node, in which
965
- // case, we should handle tab as if focus were on the container's
966
- // last tabbable node, and go to the first tabbable node of the FIRST group
967
- lastOfGroupIndex = containerIndex;
968
- }
969
- if (lastOfGroupIndex >= 0) {
970
- // YES: then tab should go to the first tabbable node in the next
971
- // group (and wrap around to the first tabbable node of the FIRST
972
- // group if it's the last tabbable node of the LAST group)
973
- var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
974
- var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
975
- destinationNode = _destinationGroup.firstTabbableNode;
976
- } else if (!isTabEvent(event)) {
977
- // user must have customized the nav keys so we have to move focus manually _within_
978
- // the active group: do this based on the order determined by tabbable()
979
- destinationNode = containerGroup.nextTabbableNode(target);
980
- }
981
- }
982
- } else {
983
- // no groups available
984
- // NOTE: the fallbackFocus option does not support returning false to opt-out
985
- destinationNode = getNodeForOption('fallbackFocus');
986
- }
987
- if (destinationNode) {
988
- if (isTabEvent(event)) {
989
- // since tab natively moves focus, we wouldn't have a destination node unless we
990
- // were on the edge of a container and had to move to the next/previous edge, in
991
- // which case we want to prevent default to keep the browser from moving focus
992
- // to where it normally would
993
- event.preventDefault();
994
- }
995
- tryFocus(destinationNode);
996
- }
997
- // else, let the browser take care of [shift+]tab and move the focus
998
- };
999
-
1000
- var checkKey = function checkKey(event) {
1001
- if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
1002
- event.preventDefault();
1003
- trap.deactivate();
1004
- return;
1005
- }
1006
- if (config.isKeyForward(event) || config.isKeyBackward(event)) {
1007
- checkKeyNav(event, config.isKeyBackward(event));
1008
- }
1009
- };
1010
- var checkClick = function checkClick(e) {
1011
- var target = getActualTarget(e);
1012
- if (findContainerIndex(target) >= 0) {
1013
- return;
1014
- }
1015
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
1016
- return;
1017
- }
1018
- if (valueOrHandler(config.allowOutsideClick, e)) {
1019
- return;
1020
- }
1021
- e.preventDefault();
1022
- e.stopImmediatePropagation();
1023
- };
1024
-
1025
- //
1026
- // EVENT LISTENERS
1027
- //
1028
-
1029
- var addListeners = function addListeners() {
1030
- if (!state.active) {
1031
- return;
1032
- }
1033
-
1034
- // There can be only one listening focus trap at a time
1035
- activeFocusTraps.activateTrap(trapStack, trap);
1036
-
1037
- // Delay ensures that the focused element doesn't capture the event
1038
- // that caused the focus trap activation.
1039
- state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
1040
- tryFocus(getInitialFocusNode());
1041
- }) : tryFocus(getInitialFocusNode());
1042
- doc.addEventListener('focusin', checkFocusIn, true);
1043
- doc.addEventListener('mousedown', checkPointerDown, {
1044
- capture: true,
1045
- passive: false
1046
- });
1047
- doc.addEventListener('touchstart', checkPointerDown, {
1048
- capture: true,
1049
- passive: false
1050
- });
1051
- doc.addEventListener('click', checkClick, {
1052
- capture: true,
1053
- passive: false
1054
- });
1055
- doc.addEventListener('keydown', checkKey, {
1056
- capture: true,
1057
- passive: false
1058
- });
1059
- return trap;
1060
- };
1061
- var removeListeners = function removeListeners() {
1062
- if (!state.active) {
1063
- return;
1064
- }
1065
- doc.removeEventListener('focusin', checkFocusIn, true);
1066
- doc.removeEventListener('mousedown', checkPointerDown, true);
1067
- doc.removeEventListener('touchstart', checkPointerDown, true);
1068
- doc.removeEventListener('click', checkClick, true);
1069
- doc.removeEventListener('keydown', checkKey, true);
1070
- return trap;
1071
- };
1072
-
1073
- //
1074
- // TRAP DEFINITION
1075
- //
1076
-
1077
- trap = {
1078
- get active() {
1079
- return state.active;
1080
- },
1081
- get paused() {
1082
- return state.paused;
1083
- },
1084
- activate: function activate(activateOptions) {
1085
- if (state.active) {
1086
- return this;
1087
- }
1088
- var onActivate = getOption(activateOptions, 'onActivate');
1089
- var onPostActivate = getOption(activateOptions, 'onPostActivate');
1090
- var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
1091
- if (!checkCanFocusTrap) {
1092
- updateTabbableNodes();
1093
- }
1094
- state.active = true;
1095
- state.paused = false;
1096
- state.nodeFocusedBeforeActivation = doc.activeElement;
1097
- if (onActivate) {
1098
- onActivate();
1099
- }
1100
- var finishActivation = function finishActivation() {
1101
- if (checkCanFocusTrap) {
1102
- updateTabbableNodes();
1103
- }
1104
- addListeners();
1105
- if (onPostActivate) {
1106
- onPostActivate();
1107
- }
1108
- };
1109
- if (checkCanFocusTrap) {
1110
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
1111
- return this;
1112
- }
1113
- finishActivation();
1114
- return this;
1115
- },
1116
- deactivate: function deactivate(deactivateOptions) {
1117
- if (!state.active) {
1118
- return this;
1119
- }
1120
- var options = _objectSpread2({
1121
- onDeactivate: config.onDeactivate,
1122
- onPostDeactivate: config.onPostDeactivate,
1123
- checkCanReturnFocus: config.checkCanReturnFocus
1124
- }, deactivateOptions);
1125
- clearTimeout(state.delayInitialFocusTimer); // noop if undefined
1126
- state.delayInitialFocusTimer = undefined;
1127
- removeListeners();
1128
- state.active = false;
1129
- state.paused = false;
1130
- activeFocusTraps.deactivateTrap(trapStack, trap);
1131
- var onDeactivate = getOption(options, 'onDeactivate');
1132
- var onPostDeactivate = getOption(options, 'onPostDeactivate');
1133
- var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
1134
- var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
1135
- if (onDeactivate) {
1136
- onDeactivate();
1137
- }
1138
- var finishDeactivation = function finishDeactivation() {
1139
- delay(function () {
1140
- if (returnFocus) {
1141
- tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
1142
- }
1143
- if (onPostDeactivate) {
1144
- onPostDeactivate();
1145
- }
1146
- });
1147
- };
1148
- if (returnFocus && checkCanReturnFocus) {
1149
- checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
1150
- return this;
1151
- }
1152
- finishDeactivation();
1153
- return this;
1154
- },
1155
- pause: function pause() {
1156
- if (state.paused || !state.active) {
1157
- return this;
1158
- }
1159
- state.paused = true;
1160
- removeListeners();
1161
- return this;
1162
- },
1163
- unpause: function unpause() {
1164
- if (!state.paused || !state.active) {
1165
- return this;
1166
- }
1167
- state.paused = false;
1168
- updateTabbableNodes();
1169
- addListeners();
1170
- return this;
1171
- },
1172
- updateContainerElements: function updateContainerElements(containerElements) {
1173
- var elementsAsArray = [].concat(containerElements).filter(Boolean);
1174
- state.containers = elementsAsArray.map(function (element) {
1175
- return typeof element === 'string' ? doc.querySelector(element) : element;
1176
- });
1177
- if (state.active) {
1178
- updateTabbableNodes();
1179
- }
1180
- return this;
1181
- }
1182
- };
1183
-
1184
- // initialize container elements
1185
- trap.updateContainerElements(elements);
1186
- return trap;
1187
- };
1188
-
1189
- var __defProp = Object.defineProperty;
1190
- var __defProps = Object.defineProperties;
1191
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1192
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1193
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1194
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
1195
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1196
- var __spreadValues = (a, b) => {
1197
- for (var prop in b || (b = {}))
1198
- if (__hasOwnProp.call(b, prop))
1199
- __defNormalProp(a, prop, b[prop]);
1200
- if (__getOwnPropSymbols)
1201
- for (var prop of __getOwnPropSymbols(b)) {
1202
- if (__propIsEnum.call(b, prop))
1203
- __defNormalProp(a, prop, b[prop]);
1204
- }
1205
- return a;
1206
- };
1207
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1208
- var __objRest = (source, exclude) => {
1209
- var target = {};
1210
- for (var prop in source)
1211
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
1212
- target[prop] = source[prop];
1213
- if (source != null && __getOwnPropSymbols)
1214
- for (var prop of __getOwnPropSymbols(source)) {
1215
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
1216
- target[prop] = source[prop];
1217
- }
1218
- return target;
1219
- };
1220
- function useFocusTrap(target, options = {}) {
1221
- let trap;
1222
- const _a = options, { immediate } = _a, focusTrapOptions = __objRest(_a, ["immediate"]);
1223
- const hasFocus = ref(false);
1224
- const isPaused = ref(false);
1225
- const activate = (opts) => trap && trap.activate(opts);
1226
- const deactivate = (opts) => trap && trap.deactivate(opts);
1227
- const pause = () => {
1228
- if (trap) {
1229
- trap.pause();
1230
- isPaused.value = true;
1231
- }
1232
- };
1233
- const unpause = () => {
1234
- if (trap) {
1235
- trap.unpause();
1236
- isPaused.value = false;
1237
- }
1238
- };
1239
- watch(() => unrefElement(target), (el) => {
1240
- if (!el)
1241
- return;
1242
- trap = createFocusTrap(el, __spreadProps(__spreadValues({}, focusTrapOptions), {
1243
- onActivate() {
1244
- hasFocus.value = true;
1245
- if (options.onActivate)
1246
- options.onActivate();
1247
- },
1248
- onDeactivate() {
1249
- hasFocus.value = false;
1250
- if (options.onDeactivate)
1251
- options.onDeactivate();
1252
- }
1253
- }));
1254
- if (immediate)
1255
- activate();
1256
- }, { flush: "post" });
1257
- tryOnScopeDispose(() => deactivate());
1258
- return {
1259
- hasFocus,
1260
- isPaused,
1261
- activate,
1262
- deactivate,
1263
- pause,
1264
- unpause
1265
- };
1266
- }
1267
-
1268
- export { useFocusTrap as u };