hys-ui 0.2.0 → 0.4.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 (261) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +68 -59
  3. package/dist/components/HysAlert/HysAlert.vue.js +5 -54
  4. package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
  5. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  6. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +146 -2
  7. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
  8. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
  9. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
  10. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
  11. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
  12. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
  13. package/dist/components/HysButton/HysButton.vue.js +2 -2
  14. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  15. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  16. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  17. package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
  18. package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
  19. package/dist/components/HysCascader/HysCascader.vue.js +2 -2
  20. package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
  21. package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
  22. package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
  23. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  24. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
  25. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
  26. package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
  27. package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
  28. package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
  29. package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
  30. package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
  31. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  32. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
  33. package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
  34. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  35. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
  36. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
  37. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  38. package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
  39. package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
  40. package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
  41. package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
  42. package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
  43. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  44. package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
  45. package/dist/components/HysMention/HysMention.vue.js +1 -1
  46. package/dist/components/HysMention/HysMention2.vue.js +1092 -142
  47. package/dist/components/HysModal/HysModal.vue.js +2 -2
  48. package/dist/components/HysModal/HysModal2.vue.js +491 -85
  49. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  50. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  51. package/dist/components/HysPopover/HysPopover.vue.js +5 -91
  52. package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
  53. package/dist/components/HysProgress/HysProgress.vue.js +2 -2
  54. package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
  55. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  56. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  57. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  58. package/dist/components/HysSelect/HysSelect2.vue.js +755 -590
  59. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  60. package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
  61. package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
  62. package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
  63. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  64. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  65. package/dist/components/HysTable/HysTable.vue.js +2 -2
  66. package/dist/components/HysTable/HysTable2.vue.js +1416 -1127
  67. package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
  68. package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
  69. package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
  70. package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
  71. package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
  72. package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
  73. package/dist/components/HysTour/HysTour.vue.js +291 -63
  74. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  75. package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
  76. package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
  77. package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
  78. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
  79. package/dist/components/HysTree/HysTree.vue.js +2 -2
  80. package/dist/components/HysTree/HysTree2.vue.js +195 -184
  81. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
  82. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
  83. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  84. package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
  85. package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
  86. package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
  87. package/dist/composables/buttonGroup.js +12 -0
  88. package/dist/composables/color.js +97 -0
  89. package/dist/composables/dataGrid.js +68 -0
  90. package/dist/composables/drawer.js +17 -0
  91. package/dist/composables/feedback.js +14 -0
  92. package/dist/composables/floatingPosition.js +18 -0
  93. package/dist/composables/mentionDocument.js +79 -0
  94. package/dist/composables/mentionEditor.js +58 -0
  95. package/dist/composables/menu.js +96 -0
  96. package/dist/composables/modal.js +14 -0
  97. package/dist/composables/overlayManager.js +48 -18
  98. package/dist/composables/progress.js +94 -0
  99. package/dist/composables/selectOptions.js +44 -38
  100. package/dist/composables/splitPaneSizes.js +58 -0
  101. package/dist/composables/table.js +128 -105
  102. package/dist/composables/tagInput.js +16 -0
  103. package/dist/composables/timeline.js +19 -0
  104. package/dist/composables/transfer.js +19 -17
  105. package/dist/composables/upload.js +55 -0
  106. package/dist/composables/uploadRequest.js +58 -0
  107. package/dist/composables/useAlert.js +124 -0
  108. package/dist/composables/useColorPicker.js +402 -0
  109. package/dist/composables/useContextMenu.js +514 -0
  110. package/dist/composables/useDataGridRemote.js +67 -0
  111. package/dist/composables/useDialog.js +86 -43
  112. package/dist/composables/useDrawerPush.js +33 -0
  113. package/dist/composables/useDrawerResize.js +221 -0
  114. package/dist/composables/useFloating.js +118 -80
  115. package/dist/composables/useHysModal.js +185 -0
  116. package/dist/composables/useMentionCaret.js +81 -0
  117. package/dist/composables/useMentionList.js +81 -0
  118. package/dist/composables/useMentionModel.js +90 -0
  119. package/dist/composables/useMentionOptions.js +421 -0
  120. package/dist/composables/useModal.js +295 -0
  121. package/dist/composables/useModalInteraction.js +394 -0
  122. package/dist/composables/usePopupSurface.js +458 -0
  123. package/dist/composables/useSplitPaneDrag.js +52 -0
  124. package/dist/composables/useSplitPaneStorage.js +38 -0
  125. package/dist/composables/useTable.js +344 -312
  126. package/dist/composables/useTableSticky.js +79 -0
  127. package/dist/composables/useTagInput.js +313 -0
  128. package/dist/composables/useTourLayout.js +129 -0
  129. package/dist/composables/useTransferMotion.js +185 -0
  130. package/dist/composables/useUpload.js +472 -0
  131. package/dist/composables/useUploadModel.js +65 -0
  132. package/dist/composables/useUploadRequests.js +266 -0
  133. package/dist/composables/useVirtualTableLayout.js +277 -0
  134. package/dist/composables/virtualTable.js +43 -0
  135. package/dist/config.js +11 -11
  136. package/dist/index.js +175 -153
  137. package/dist/internal/MultiSplitPane.vue.js +305 -0
  138. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  139. package/dist/internal/PopupReference.js +39 -0
  140. package/dist/internal/PopupSurfacePanel.vue.js +7 -0
  141. package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
  142. package/dist/motion/PopupMotion.js +105 -0
  143. package/dist/motion/popup.js +10 -0
  144. package/dist/style.css +1 -1
  145. package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
  146. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +61 -7
  147. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
  148. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
  149. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
  150. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
  151. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  152. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  153. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
  154. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
  155. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  156. package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
  157. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
  158. package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
  159. package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
  160. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
  161. package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
  162. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
  163. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +3 -3
  164. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
  165. package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
  166. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  167. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
  168. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -39
  169. package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
  170. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  171. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  172. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
  173. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
  174. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  175. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
  176. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +45 -7
  177. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +19 -5
  178. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
  179. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
  180. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  181. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  182. package/dist/types/components/HysTable/HysTable.vue.d.ts +1742 -5
  183. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
  184. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
  185. package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
  186. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
  187. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -8
  188. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
  189. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
  190. package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
  191. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
  192. package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
  193. package/dist/types/composables/autocomplete.d.ts +3 -0
  194. package/dist/types/composables/avatar.d.ts +3 -0
  195. package/dist/types/composables/buttonGroup.d.ts +9 -0
  196. package/dist/types/composables/cascader.d.ts +3 -0
  197. package/dist/types/composables/color.d.ts +97 -0
  198. package/dist/types/composables/dataGrid.d.ts +100 -0
  199. package/dist/types/composables/datePicker.d.ts +3 -0
  200. package/dist/types/composables/drawer.d.ts +102 -0
  201. package/dist/types/composables/feedback.d.ts +98 -0
  202. package/dist/types/composables/floatingPosition.d.ts +14 -0
  203. package/dist/types/composables/formContext.d.ts +2 -0
  204. package/dist/types/composables/mention.d.ts +284 -0
  205. package/dist/types/composables/mentionDocument.d.ts +15 -0
  206. package/dist/types/composables/mentionEditor.d.ts +7 -0
  207. package/dist/types/composables/menu.d.ts +183 -0
  208. package/dist/types/composables/modal.d.ts +185 -0
  209. package/dist/types/composables/overlayManager.d.ts +7 -3
  210. package/dist/types/composables/popupSurface.d.ts +83 -0
  211. package/dist/types/composables/progress.d.ts +92 -0
  212. package/dist/types/composables/selectOptions.d.ts +7 -0
  213. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  214. package/dist/types/composables/table.d.ts +119 -6
  215. package/dist/types/composables/tagInput.d.ts +96 -0
  216. package/dist/types/composables/timeline.d.ts +82 -0
  217. package/dist/types/composables/tour.d.ts +68 -0
  218. package/dist/types/composables/transfer.d.ts +7 -0
  219. package/dist/types/composables/tree.d.ts +3 -0
  220. package/dist/types/composables/treeSelect.d.ts +3 -0
  221. package/dist/types/composables/upload.d.ts +202 -0
  222. package/dist/types/composables/uploadRequest.d.ts +3 -0
  223. package/dist/types/composables/useAlert.d.ts +21 -0
  224. package/dist/types/composables/useCascader.d.ts +1 -1
  225. package/dist/types/composables/useColorPicker.d.ts +101 -0
  226. package/dist/types/composables/useContextMenu.d.ts +81 -0
  227. package/dist/types/composables/useDataGridRemote.d.ts +15 -0
  228. package/dist/types/composables/useDialog.d.ts +16 -3
  229. package/dist/types/composables/useDrawerPush.d.ts +6 -0
  230. package/dist/types/composables/useDrawerResize.d.ts +27 -0
  231. package/dist/types/composables/useFloating.d.ts +22 -3
  232. package/dist/types/composables/useHysModal.d.ts +44 -0
  233. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  234. package/dist/types/composables/useMentionList.d.ts +23 -0
  235. package/dist/types/composables/useMentionModel.d.ts +14 -0
  236. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  237. package/dist/types/composables/useModal.d.ts +62 -0
  238. package/dist/types/composables/useModalInteraction.d.ts +27 -0
  239. package/dist/types/composables/usePopupSurface.d.ts +3341 -0
  240. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  241. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  242. package/dist/types/composables/useTable.d.ts +7 -3
  243. package/dist/types/composables/useTableSticky.d.ts +22 -0
  244. package/dist/types/composables/useTagInput.d.ts +66 -0
  245. package/dist/types/composables/useTourLayout.d.ts +33 -0
  246. package/dist/types/composables/useTransferMotion.d.ts +36 -0
  247. package/dist/types/composables/useUpload.d.ts +94 -0
  248. package/dist/types/composables/useUploadModel.d.ts +14 -0
  249. package/dist/types/composables/useUploadRequests.d.ts +38 -0
  250. package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
  251. package/dist/types/composables/virtualTable.d.ts +126 -0
  252. package/dist/types/config.d.ts +1 -0
  253. package/dist/types/index.d.ts +53 -3
  254. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  255. package/dist/types/internal/PopupReference.d.ts +18 -0
  256. package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
  257. package/dist/types/motion/PopupMotion.d.ts +59 -0
  258. package/dist/types/motion/popup.d.ts +12 -0
  259. package/package.json +3 -2
  260. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  261. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -1,56 +1,99 @@
1
- import { ref as k, computed as D, onActivated as w, onDeactivated as x, watch as L, nextTick as b, onBeforeUnmount as S } from "vue";
2
- import { lockBodyScroll as T, registerOverlay as A } from "./overlayManager.js";
3
- const C = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
4
- function B(h, t, m) {
5
- const o = k(!0), s = D(() => h.value && o.value);
6
- w(() => {
7
- o.value = !0;
8
- }), x(() => {
9
- o.value = !1, c++, f();
10
- });
11
- let d = null, i, u, c = 0;
12
- function v() {
1
+ import { ref as O, inject as P, computed as b, provide as R, shallowRef as g, watch as D, nextTick as x, onActivated as B, onDeactivated as H, onBeforeUnmount as M } from "vue";
2
+ import { overlayOwnerKey as A, registerOverlay as j, lockBodyScroll as N } from "./overlayManager.js";
3
+ const U = 'a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
4
+ function J(z, r, T, u = {}) {
5
+ const o = O(!0), h = P(A, void 0), s = b(() => o.value && (h == null ? void 0 : h.value) !== !1), i = b(() => z.value && s.value);
6
+ R(
7
+ A,
8
+ b(() => {
9
+ var e;
10
+ return i.value && ((e = u.childVisible) == null ? void 0 : e.call(u)) !== !1;
11
+ })
12
+ );
13
+ const d = g(), k = b(
14
+ () => {
15
+ var e, t;
16
+ return ((e = d.value) == null ? void 0 : e.zIndex.value) ?? ((t = u.zIndex) == null ? void 0 : t.call(u)) ?? 100;
17
+ }
18
+ );
19
+ let E = null, a, m = 0;
20
+ function S() {
21
+ var e;
22
+ return Array.from(
23
+ ((e = r.value) == null ? void 0 : e.querySelectorAll(U)) ?? []
24
+ ).filter(
25
+ (t) => t.tabIndex >= 0 && t.getClientRects().length > 0 && getComputedStyle(t).visibility !== "hidden" && !t.closest('[inert],[aria-hidden="true"]')
26
+ );
27
+ }
28
+ function w() {
13
29
  var e;
14
- return Array.from(((e = t.value) == null ? void 0 : e.querySelectorAll(C)) ?? []).filter((n) => n.getClientRects().length > 0 && getComputedStyle(n).visibility !== "hidden");
30
+ (e = S()[0] ?? r.value) == null || e.focus({ preventScroll: !0 });
15
31
  }
16
- function y(e) {
17
- if (!s.value || !(u != null && u()) || !t.value) return;
32
+ function C(e) {
33
+ var n, f;
34
+ if (!i.value || !((n = d.value) != null && n.isTop()) || !r.value) return;
18
35
  if (e.key === "Escape") {
19
- e.preventDefault(), e.stopImmediatePropagation(), m();
36
+ e.preventDefault(), e.stopImmediatePropagation(), T();
20
37
  return;
21
38
  }
22
- if (e.key !== "Tab") return;
23
- const n = v();
24
- if (!n.length) {
25
- e.preventDefault(), t.value.focus();
39
+ if (e.key !== "Tab" || ((f = u.trapFocus) == null ? void 0 : f.call(u)) === !1) return;
40
+ const t = S();
41
+ if (!t.length) {
42
+ e.preventDefault(), r.value.focus({ preventScroll: !0 });
26
43
  return;
27
44
  }
28
- const l = n[0], r = n[n.length - 1];
29
- e.shiftKey && (document.activeElement === l || document.activeElement === t.value || !t.value.contains(document.activeElement)) ? (e.preventDefault(), r.focus()) : !e.shiftKey && (document.activeElement === r || !t.value.contains(document.activeElement)) && (e.preventDefault(), l.focus());
45
+ const l = t[0], c = t[t.length - 1];
46
+ e.shiftKey && (document.activeElement === l || document.activeElement === r.value || !r.value.contains(document.activeElement)) ? (e.preventDefault(), c.focus({ preventScroll: !0 })) : !e.shiftKey && (document.activeElement === c || !r.value.contains(document.activeElement)) && (e.preventDefault(), l.focus({ preventScroll: !0 }));
47
+ }
48
+ function F(e) {
49
+ var t, l, c;
50
+ i.value && ((t = d.value) != null && t.isTop()) && ((l = u.trapFocus) == null ? void 0 : l.call(u)) !== !1 && e.target instanceof Node && !((c = r.value) != null && c.contains(e.target)) && w();
30
51
  }
31
- function p(e) {
32
- !s.value || !(u != null && u()) || !t.value || e.target instanceof Node && !t.value.contains(e.target) && (v()[0] ?? t.value).focus();
52
+ function I() {
53
+ var e;
54
+ i.value && ((e = u.lockScroll) == null ? void 0 : e.call(u)) !== !1 ? a ?? (a = N()) : (a == null || a(), a = void 0);
33
55
  }
34
- function f() {
35
- i == null || i(), i = void 0, u = void 0, document.removeEventListener("keydown", y, !0), document.removeEventListener("focusin", p, !0);
56
+ function y() {
57
+ var t, l;
58
+ const e = ((t = d.value) == null ? void 0 : t.isTop()) ?? !1;
59
+ return (l = d.value) == null || l.unregister(), d.value = void 0, a == null || a(), a = void 0, document.removeEventListener("keydown", C, !0), document.removeEventListener("focusin", F, !0), e;
36
60
  }
37
- return L(s, async (e) => {
38
- var l, r;
39
- const n = ++c;
40
- if (e) {
41
- f(), d = document.activeElement instanceof HTMLElement ? document.activeElement : null;
42
- const a = T(), E = A("dialog", m);
43
- u = E.isTop, i = () => {
44
- E.unregister(), a();
45
- }, document.addEventListener("keydown", y, !0), document.addEventListener("focusin", p, !0), await b(), n === c && s.value && ((r = ((l = t.value) == null ? void 0 : l.querySelector("[autofocus]")) ?? v()[0] ?? t.value) == null || r.focus());
46
- } else {
47
- const a = d;
48
- f(), await b(), n === c && o.value && (a != null && a.isConnected) && a.focus();
49
- }
50
- }, { immediate: !0, flush: "post" }), S(() => {
51
- o.value = !1, c++, f();
52
- }), { active: o };
61
+ function q(e, t, l) {
62
+ x(() => {
63
+ var n, f;
64
+ if (t !== m || !s.value || !l || ((n = u.restoreFocus) == null ? void 0 : n.call(u)) === !1)
65
+ return;
66
+ const c = new Event("hys-ui-close-auto-focus", { cancelable: !0 });
67
+ (f = u.onCloseAutoFocus) == null || f.call(u, c), !c.defaultPrevented && (e != null && e.isConnected) && e.focus({ preventScroll: !0 });
68
+ });
69
+ }
70
+ return typeof document > "u" ? { active: s, zIndex: k, focus: w } : (D(
71
+ i,
72
+ async (e) => {
73
+ var l, c, n, f;
74
+ const t = ++m;
75
+ if (e) {
76
+ if (y(), E = document.activeElement instanceof HTMLElement ? document.activeElement : null, d.value = j("dialog", T, u.zIndex), I(), document.addEventListener("keydown", C, !0), document.addEventListener("focusin", F, !0), await x(), t !== m || !i.value) return;
77
+ const L = new Event("hys-ui-open-auto-focus", { cancelable: !0 });
78
+ (l = u.onOpenAutoFocus) == null || l.call(u, L);
79
+ const v = (c = u.initialFocus) == null ? void 0 : c.call(u), K = v instanceof HTMLElement && v.isConnected && v.getClientRects().length > 0 && getComputedStyle(v).visibility !== "hidden" && !v.closest('[inert],[aria-hidden="true"]') && !v.disabled ? v : void 0;
80
+ !L.defaultPrevented && v !== !1 && ((f = K ?? ((n = r.value) == null ? void 0 : n.querySelector("[autofocus]")) ?? S()[0] ?? r.value) == null || f.focus({ preventScroll: !0 }));
81
+ } else q(E, t, y());
82
+ },
83
+ { immediate: !0, flush: "post" }
84
+ ), D(() => {
85
+ var e;
86
+ return (e = u.lockScroll) == null ? void 0 : e.call(u);
87
+ }, I), B(() => o.value = !0), H(() => {
88
+ o.value = !1, m++, y();
89
+ }), M(() => {
90
+ var c;
91
+ const e = E, t = y(), l = s.value && ((c = u.restoreFocus) == null ? void 0 : c.call(u)) !== !1;
92
+ o.value = !1, m++, l && t && x(() => {
93
+ e != null && e.isConnected && e.focus({ preventScroll: !0 });
94
+ });
95
+ }), { active: s, zIndex: k, focus: w });
53
96
  }
54
97
  export {
55
- B as useDialog
98
+ J as useDialog
56
99
  };
@@ -0,0 +1,33 @@
1
+ import { inject as y, shallowRef as f, provide as w, onMounted as b, onActivated as g, onDeactivated as M, onBeforeUnmount as j, computed as v } from "vue";
2
+ const p = Symbol("hys-ui-drawer-parent");
3
+ function S(t, r, m) {
4
+ const c = y(p, void 0), a = f(/* @__PURE__ */ new Map()), h = Symbol("drawer-child");
5
+ w(p, {
6
+ register(e, l) {
7
+ return a.value = new Map(a.value).set(e, l), () => {
8
+ const u = new Map(a.value);
9
+ u.delete(e), a.value = u;
10
+ };
11
+ }
12
+ });
13
+ let n;
14
+ const i = () => {
15
+ n ?? (n = c == null ? void 0 : c.register(h, r));
16
+ }, s = () => {
17
+ n == null || n(), n = void 0;
18
+ };
19
+ b(i), g(i), M(s), j(s);
20
+ const o = v(
21
+ () => !!t.push && r.value && !m.value && [...a.value.values()].some((e) => e.value)
22
+ ), x = v(() => {
23
+ const e = typeof t.push == "object" ? t.push.distance : 160, l = typeof e == "number" ? Number.isFinite(e) ? Math.max(0, e) + "px" : "160px" : e || "160px", u = o.value ? l : "0px", d = o.value ? `calc(-1 * ${l})` : "0px";
24
+ return {
25
+ "--hys-ui-drawer-push-x": t.placement === "left" ? u : t.placement === "right" ? d : "0px",
26
+ "--hys-ui-drawer-push-y": t.placement === "top" ? u : t.placement === "bottom" ? d : "0px"
27
+ };
28
+ });
29
+ return { pushed: o, style: x };
30
+ }
31
+ export {
32
+ S as useDrawerPush
33
+ };
@@ -0,0 +1,221 @@
1
+ import { ref as C, computed as S, watch as x, nextTick as K, onMounted as te, onActivated as ie, onDeactivated as ne, onBeforeUnmount as ae } from "vue";
2
+ import { useChoiceModel as re } from "./choiceModel.js";
3
+ import { drawerVertical as ue } from "./drawer.js";
4
+ function ce(i, V, c, M, $, G, d) {
5
+ const w = re(
6
+ {
7
+ get modelValue() {
8
+ return i.resizeValue;
9
+ }
10
+ },
11
+ () => Number.isFinite(i.defaultResizeValue) ? Math.max(0, i.defaultResizeValue) : null
12
+ ), D = C(!1), P = C(0), F = C(0), N = C(), f = S(() => ue(i.placement)), T = S(() => {
13
+ const e = w.current.value;
14
+ if (typeof e != "number" || !Number.isFinite(e)) return;
15
+ const t = A();
16
+ return Math.max(t.min, Math.min(t.max, e));
17
+ }), h = S(() => T.value ?? P.value), z = S(
18
+ () => typeof i.resizable == "object" ? i.resizable : {}
19
+ ), v = S(
20
+ () => M.value && !$.value && !G.value
21
+ );
22
+ let r = !0, y = 0, g = 0, l, s;
23
+ function I(e, t) {
24
+ if (typeof e == "number")
25
+ return Number.isFinite(e) ? e : void 0;
26
+ if (typeof e != "string" || !/^\s*\d+(?:\.\d+)?(?:px|%)?\s*$/.test(e))
27
+ return;
28
+ const n = parseFloat(e);
29
+ return e.trim().endsWith("%") ? t * n / 100 : n;
30
+ }
31
+ function R() {
32
+ var n;
33
+ const e = (n = V.value) == null ? void 0 : n.getBoundingClientRect(), t = f.value ? e == null ? void 0 : e.height : e == null ? void 0 : e.width;
34
+ return Math.max(
35
+ 1,
36
+ (t && t > 0 ? t : void 0) ?? (f.value ? document.documentElement.clientHeight || window.innerHeight : document.documentElement.clientWidth || window.innerWidth)
37
+ );
38
+ }
39
+ function A(e = F.value || R()) {
40
+ const t = Math.max(
41
+ 1,
42
+ Math.min(
43
+ e,
44
+ I(z.value.maxSize, e) ?? e
45
+ )
46
+ );
47
+ return { min: Math.min(
48
+ t,
49
+ Math.max(1, I(z.value.minSize, e) ?? 160)
50
+ ), max: t };
51
+ }
52
+ function L() {
53
+ if (!r || !M.value || s || !c.value) return;
54
+ F.value = R();
55
+ const e = c.value.getBoundingClientRect();
56
+ P.value = f.value ? e.height : e.width;
57
+ }
58
+ function p() {
59
+ g && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
60
+ g = 0, L();
61
+ });
62
+ }
63
+ function J() {
64
+ var t;
65
+ y = 0;
66
+ const e = s;
67
+ !e || !e.activated || !c.value || e.last !== e.value && (e.last = e.value, c.value.style[e.axis] = e.value + "px", (t = N.value) == null || t.setAttribute("aria-valuenow", String(Math.round(e.value))), d("resize", e.value));
68
+ }
69
+ function Q() {
70
+ window.removeEventListener("pointermove", U), window.removeEventListener("pointerup", W), window.removeEventListener("pointercancel", a), window.removeEventListener("blur", a), window.removeEventListener("keydown", O, !0);
71
+ }
72
+ async function B(e) {
73
+ return !r || !v.value ? !1 : e === w.current.value ? !0 : await w.commit(
74
+ e,
75
+ (n) => d("update:resizeValue", n),
76
+ () => {
77
+ }
78
+ ) && r && v.value;
79
+ }
80
+ async function b(e = !1) {
81
+ var o, m;
82
+ const t = s;
83
+ if (!t) return !1;
84
+ y && cancelAnimationFrame(y), y = 0;
85
+ const n = !e && t.activated && t.last !== t.value;
86
+ s = void 0, D.value = !1, Q(), document.documentElement.style.cursor = t.cursor, document.documentElement.style.userSelect = t.selection;
87
+ try {
88
+ (m = (o = t.target).hasPointerCapture) != null && m.call(o, t.id) && t.target.releasePointerCapture(t.id);
89
+ } catch {
90
+ }
91
+ c.value && (c.value.style[t.axis] = t.style), n && d("resize", t.value);
92
+ const u = !e && t.activated ? await B(t.value) : !1;
93
+ return t.activated && (await K(), r && (L(), d("resizeEnd", e || !u ? h.value : t.value, {
94
+ placement: i.placement ?? "right",
95
+ cancelled: e,
96
+ accepted: u
97
+ }))), u;
98
+ }
99
+ function a() {
100
+ b(!0);
101
+ }
102
+ function O(e) {
103
+ e.key === "Escape" ? (e.preventDefault(), e.stopImmediatePropagation(), a()) : e.key === "Tab" && a();
104
+ }
105
+ function U(e) {
106
+ const t = s;
107
+ if (!t || e.pointerId !== t.id) return;
108
+ const n = ((t.axis === "width" ? e.clientX : e.clientY) - t.start) * t.sign;
109
+ !t.activated && (Math.abs(n) < 4 || (t.activated = !0, D.value = !0, d("resizeStart", t.size), s !== t)) || (t.value = Math.max(t.min, Math.min(t.max, t.size + n)), y || (y = requestAnimationFrame(J)));
110
+ }
111
+ function W(e) {
112
+ s && e.pointerId === s.id && b(!1);
113
+ }
114
+ function Z(e) {
115
+ if (!i.resizable || !v.value || !r || e.button !== 0 || e.isPrimary === !1 || !c.value)
116
+ return;
117
+ e.preventDefault(), e.stopPropagation(), b(!0);
118
+ const t = R(), n = A(t), u = c.value.getBoundingClientRect(), o = f.value ? "height" : "width", m = e.currentTarget, E = o === "width" ? u.width : u.height;
119
+ F.value = t, P.value = E, s = {
120
+ id: e.pointerId,
121
+ start: o === "width" ? e.clientX : e.clientY,
122
+ size: E,
123
+ value: E,
124
+ last: E,
125
+ ...n,
126
+ axis: o,
127
+ sign: i.placement === "right" || i.placement === "bottom" ? -1 : 1,
128
+ target: m,
129
+ style: c.value.style[o],
130
+ cursor: document.documentElement.style.cursor,
131
+ selection: document.documentElement.style.userSelect,
132
+ activated: !1
133
+ }, m.focus({ preventScroll: !0 });
134
+ try {
135
+ m.setPointerCapture(e.pointerId);
136
+ } catch {
137
+ }
138
+ document.documentElement.style.cursor = f.value ? "ns-resize" : "ew-resize", document.documentElement.style.userSelect = "none", window.addEventListener("pointermove", U), window.addEventListener("pointerup", W), window.addEventListener("pointercancel", a), window.addEventListener("blur", a), window.addEventListener("keydown", O, !0);
139
+ }
140
+ async function q(e) {
141
+ if (!r || !v.value) return !1;
142
+ const t = R(), n = I(e, t);
143
+ if (n === void 0) return !1;
144
+ const u = A(t), o = Math.max(u.min, Math.min(u.max, n));
145
+ return F.value = t, B(o);
146
+ }
147
+ async function _() {
148
+ return s && await b(!0), B(null);
149
+ }
150
+ async function ee(e) {
151
+ if (!i.resizable || !v.value || e.isComposing || e.ctrlKey || e.metaKey || e.altKey || ![...f.value ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"], "Home", "End"].includes(e.key)) return;
152
+ e.preventDefault(), e.stopPropagation(), L();
153
+ const n = A(), u = Number.isFinite(z.value.step) ? Math.max(1, z.value.step) : 10, o = i.placement === "left" ? "ArrowRight" : i.placement === "right" ? "ArrowLeft" : i.placement === "top" ? "ArrowDown" : "ArrowUp", m = e.key === "Home" ? n.min : e.key === "End" ? n.max : h.value + (e.key === o ? 1 : -1) * u * (e.shiftKey ? 10 : 1);
154
+ d("resizeStart", h.value);
155
+ const E = await q(m);
156
+ r && (L(), d("resize", h.value), d("resizeEnd", h.value, {
157
+ placement: i.placement ?? "right",
158
+ cancelled: !1,
159
+ accepted: E
160
+ }));
161
+ }
162
+ function k() {
163
+ a(), p();
164
+ }
165
+ function X() {
166
+ l == null || l.disconnect(), l = void 0, r && M.value && typeof ResizeObserver < "u" && V.value && i.contained && (l = new ResizeObserver(k), l.observe(V.value));
167
+ }
168
+ function H() {
169
+ var e;
170
+ !r || !M.value || (window.addEventListener("resize", k), (e = window.visualViewport) == null || e.addEventListener("resize", k), X(), p());
171
+ }
172
+ function Y() {
173
+ var e;
174
+ l == null || l.disconnect(), l = void 0, window.removeEventListener("resize", k), (e = window.visualViewport) == null || e.removeEventListener("resize", k), cancelAnimationFrame(g), g = 0;
175
+ }
176
+ function j() {
177
+ r = !1, b(!0), Y();
178
+ }
179
+ return x(
180
+ () => [i.placement, i.width, i.height, i.size],
181
+ () => {
182
+ a(), i.resizeValue === void 0 && w.reset(), K(p);
183
+ }
184
+ ), x(
185
+ () => i.resizeValue,
186
+ () => {
187
+ a(), p();
188
+ }
189
+ ), x([v, () => i.resizable], () => {
190
+ (!v.value || !i.resizable) && a();
191
+ }), x(
192
+ () => [z.value.minSize, z.value.maxSize],
193
+ () => {
194
+ a(), p();
195
+ }
196
+ ), x(M, (e) => {
197
+ e ? K(H) : (a(), Y());
198
+ }), x([V, () => i.contained], X, { flush: "post" }), te(H), ie(() => {
199
+ r = !0, H();
200
+ }), ne(j), ae(j), {
201
+ handle: N,
202
+ resizing: D,
203
+ size: h,
204
+ vertical: f,
205
+ limits: A,
206
+ model: w,
207
+ resolvedSize: T,
208
+ start: Z,
209
+ stop: b,
210
+ keyboard: ee,
211
+ resizeTo: q,
212
+ reset: _,
213
+ measure: L,
214
+ resetAfterClose: () => {
215
+ i.resetSizeOnClose !== !1 && i.resizeValue === void 0 && w.reset();
216
+ }
217
+ };
218
+ }
219
+ export {
220
+ ce as useDrawerResize
221
+ };
@@ -1,128 +1,166 @@
1
- import { ref as E, watch as I, onDeactivated as S, onBeforeUnmount as K, nextTick as P } from "vue";
2
- import { useHysControlState as T } from "./formContext.js";
3
- import { registerOverlay as U } from "./overlayManager.js";
4
- function J(m, r, i = {}) {
5
- const { disabled: C } = T({}), d = E(!1), M = E(!1), L = E({
1
+ import { inject as T, ref as E, shallowRef as Y, watch as D, onDeactivated as U, onBeforeUnmount as V, computed as X, nextTick as G } from "vue";
2
+ import { useHysControlState as J } from "./formContext.js";
3
+ import { popupSize as Q } from "../motion/popup.js";
4
+ import { positionFloating as Z } from "./floatingPosition.js";
5
+ import { overlayOwnerKey as _, registerOverlay as ee } from "./overlayManager.js";
6
+ function re(v, n, e = {}) {
7
+ const { disabled: k } = J({}), m = T(_, void 0), c = E(!1), W = Y(), p = E(!1), L = E({
6
8
  position: "fixed",
7
9
  top: "0px",
8
10
  left: "0px",
9
11
  visibility: "hidden"
10
- }), F = E(i.placement ?? "bottom-start"), v = i.gap ?? 8, o = i.padding ?? 10;
11
- let $ = 0, w, h, b = 0;
12
- function k() {
13
- var R;
14
- if (!d.value || !m.value || !r.value) return;
15
- const t = m.value.getBoundingClientRect();
12
+ });
13
+ function A() {
14
+ return typeof e.placement == "function" ? e.placement() : e.placement ?? "bottom-start";
15
+ }
16
+ const C = E(A());
17
+ let $ = 0, w, r, y = 0;
18
+ function F() {
19
+ var R, S, H;
20
+ if (!c.value || !v.value || !n.value) return;
21
+ const t = v.value.getBoundingClientRect();
16
22
  if (!t.width && !t.height) {
17
- s();
23
+ u();
18
24
  return;
19
25
  }
20
- const e = document.documentElement.clientWidth, a = document.documentElement.clientHeight, l = Math.min(t.width, Math.max(0, e - 2 * o)), u = typeof i.matchWidth == "function" ? i.matchWidth() : i.matchWidth, f = (R = i.width) == null ? void 0 : R.call(i), x = typeof f == "number" ? Math.max(0, f) + "px" : f;
21
- x !== void 0 ? (r.value.style.width = x, r.value.style.minWidth = "0", r.value.style.maxWidth = `calc(100vw - ${o * 2}px)`) : u === !0 && (r.value.style.width = `${l}px`, r.value.style.minWidth = "0", r.value.style.maxWidth = `${l}px`), x === void 0 && u === "min" && (r.value.style.width = "max-content", r.value.style.minWidth = `${l}px`, r.value.style.maxWidth = `calc(100vw - ${o * 2}px)`);
22
- const H = r.value.getBoundingClientRect(), g = Math.min(H.width, Math.max(0, e - 2 * o)), y = Math.min(H.height, Math.max(0, a - 2 * o));
23
- let n = i.placement ?? "bottom-start";
24
- const z = a - t.bottom - v, A = t.top - v;
25
- n.startsWith("bottom") && z < y && A > z ? n = n.replace("bottom", "top") : n.startsWith("top") && A < y && z > A ? n = n.replace("top", "bottom") : n === "right" && e - t.right - v < g && t.left > e - t.right ? n = "left" : n === "left" && t.left - v < g && e - t.right > t.left && (n = "right");
26
- let p = n.endsWith("end") ? t.right - g : t.left, W = n.startsWith("top") ? t.top - y - v : t.bottom + v;
27
- (n === "right" || n === "left") && (p = n === "right" ? t.right + v : t.left - g - v, W = t.top + (t.height - y) / 2), p = Math.max(o, Math.min(p, e - g - o)), W = Math.max(o, Math.min(W, a - y - o)), F.value = n, L.value = {
28
- ...x !== void 0 ? { width: x, minWidth: "0" } : u === !0 ? { width: `${l}px`, minWidth: "0" } : u === "min" ? { width: "max-content", minWidth: `${l}px` } : {},
29
- position: "fixed",
30
- left: `${Math.round(p)}px`,
31
- top: `${Math.round(W)}px`,
26
+ const a = Number.isFinite(e.gap) ? e.gap : 8, i = Number.isFinite(e.padding) ? Math.max(0, e.padding) : 10, l = document.documentElement.clientWidth, o = document.documentElement.clientHeight, d = Math.min(t.width, Math.max(0, l - 2 * i)), g = typeof e.matchWidth == "function" ? e.matchWidth() : e.matchWidth, h = (R = e.maxWidth) == null ? void 0 : R.call(e), P = h !== void 0 && (typeof h != "number" || Number.isFinite(h)) ? `min(${typeof h == "number" ? Math.max(0, h) + "px" : h},calc(100vw - ${i * 2}px))` : `calc(100vw - ${i * 2}px)`, b = (S = e.width) == null ? void 0 : S.call(e), x = typeof b == "number" ? Number.isFinite(b) ? Math.max(0, b) + "px" : void 0 : b;
27
+ x !== void 0 ? (n.value.style.width = x, n.value.style.minWidth = "0", n.value.style.maxWidth = P) : g === !0 && (n.value.style.width = `${d}px`, n.value.style.minWidth = "0", n.value.style.maxWidth = `${d}px`), x === void 0 && g === "min" && (n.value.style.width = "max-content", n.value.style.minWidth = `${d}px`, n.value.style.maxWidth = `calc(100vw - ${i * 2}px)`);
28
+ const z = Z(
29
+ t,
30
+ Q(n.value),
31
+ { width: l, height: o },
32
+ A(),
33
+ a,
34
+ i,
35
+ e.autoAdjustOverflow !== !1
36
+ );
37
+ let { x: O, y: M } = z;
38
+ if (C.value = z.placement, (H = e.onPosition) == null || H.call(e, { anchor: t, ...z }), e.strategy === "absolute") {
39
+ n.value.style.position = "absolute";
40
+ const f = n.value.offsetParent;
41
+ if (f && f !== document.body && f !== document.documentElement) {
42
+ const j = f.getBoundingClientRect();
43
+ O += f.scrollLeft - j.left - f.clientLeft, M += f.scrollTop - j.top - f.clientTop;
44
+ } else
45
+ O += window.scrollX, M += window.scrollY;
46
+ }
47
+ L.value = {
48
+ ...x !== void 0 ? { width: x, minWidth: "0" } : g === !0 ? { width: `${d}px`, minWidth: "0" } : g === "min" ? { width: "max-content", minWidth: `${d}px` } : {},
49
+ position: e.strategy ?? "fixed",
50
+ left: `${Math.round(O)}px`,
51
+ top: `${Math.round(M)}px`,
32
52
  visibility: "visible",
33
53
  zIndex: "1200",
34
- maxWidth: `calc(100vw - ${o * 2}px)`,
35
- maxHeight: `calc(100vh - ${o * 2}px)`,
54
+ maxWidth: P,
55
+ maxHeight: `calc(100vh - ${i * 2}px)`,
36
56
  overflowY: "auto",
37
57
  overscrollBehavior: "contain"
38
58
  };
39
59
  }
40
- function c() {
41
- cancelAnimationFrame($), $ = requestAnimationFrame(k);
60
+ function s() {
61
+ cancelAnimationFrame($), $ = requestAnimationFrame(F);
42
62
  }
43
- function q(t) {
44
- var e, a;
45
- h != null && h() && !((e = m.value) != null && e.contains(t.target)) && !((a = r.value) != null && a.contains(t.target)) && s();
63
+ function I(t) {
64
+ var a, i;
65
+ !(r != null && r()) || e.closeOnOutside === !1 || !((a = v.value) != null && a.contains(t.target)) && !((i = n.value) != null && i.contains(t.target)) && u();
46
66
  }
47
- function B(t) {
48
- var e, a;
49
- if (!(!d.value || !(h != null && h()))) {
50
- if (t.key === "Escape")
51
- t.preventDefault(), t.stopImmediatePropagation(), s(!0);
52
- else if (t.key === "Tab" && i.closeOnTab !== !1) {
67
+ function q(t) {
68
+ var a, i;
69
+ if (!(!c.value || !(r != null && r()))) {
70
+ if (t.key === "Escape" && e.closeOnEscape !== !1)
71
+ t.preventDefault(), t.stopImmediatePropagation(), u(!0);
72
+ else if (t.key === "Tab" && e.closeOnTab !== !1) {
53
73
  const l = document.activeElement;
54
- if ((e = m.value) != null && e.contains(l)) {
55
- s();
74
+ if ((a = v.value) != null && a.contains(l)) {
75
+ u();
56
76
  return;
57
77
  }
58
- if ((a = r.value) != null && a.contains(l)) {
59
- const u = Array.from(
60
- r.value.querySelectorAll(
78
+ if ((i = n.value) != null && i.contains(l)) {
79
+ const o = Array.from(
80
+ n.value.querySelectorAll(
61
81
  'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])'
62
82
  )
63
83
  ).filter(
64
- (f) => f.getClientRects().length && !f.closest("[inert]")
84
+ (d) => d.getClientRects().length && !d.closest("[inert]")
65
85
  );
66
- (!u.length || l === (t.shiftKey ? u[0] : u.at(-1))) && s(!0);
86
+ (!o.length || l === (t.shiftKey ? o[0] : o.at(-1))) && u(!0);
67
87
  }
68
88
  }
69
89
  }
70
90
  }
71
- function O() {
72
- var t, e;
73
- document.removeEventListener("pointerdown", q, !0), document.removeEventListener("keydown", B, !0), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", c), (e = window.visualViewport) == null || e.removeEventListener("scroll", c), cancelAnimationFrame($), w == null || w(), w = void 0, h = void 0;
91
+ function B() {
92
+ var t, a;
93
+ document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", q, !0), window.removeEventListener("resize", s), window.removeEventListener("scroll", s, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", s), (a = window.visualViewport) == null || a.removeEventListener("scroll", s), cancelAnimationFrame($), w == null || w(), w = void 0, W.value = void 0, r = void 0;
74
94
  }
75
- function s(t = !1, e = !1) {
76
- var a, l;
77
- if (!(!e && d.value && ((a = i.requestOpen) == null ? void 0 : a.call(i, !1, t)) === !1) && (b++, !!d.value && (d.value = !1, O(), t && ((l = m.value) != null && l.isConnected)))) {
78
- M.value = !0;
95
+ function u(t = !1, a = !1) {
96
+ var i, l;
97
+ if (!(!a && c.value && ((i = e.requestOpen) == null ? void 0 : i.call(e, !1, t)) === !1) && (y++, !!c.value && (c.value = !1, B(), t && ((l = v.value) != null && l.isConnected)))) {
98
+ p.value = !0;
79
99
  try {
80
- m.value.focus();
100
+ v.value.focus();
81
101
  } finally {
82
- M.value = !1;
102
+ p.value = !1;
83
103
  }
84
104
  }
85
105
  }
86
- async function V(t = !1) {
87
- var l, u, f;
88
- if (C.value) return;
89
- if (d.value) {
90
- c();
106
+ async function N(t = !1) {
107
+ var l, o, d;
108
+ if (k.value || (m == null ? void 0 : m.value) === !1) return;
109
+ if (c.value) {
110
+ s();
91
111
  return;
92
112
  }
93
- if (!t && ((l = i.requestOpen) == null ? void 0 : l.call(i, !0)) === !1) return;
94
- const e = ++b;
95
- if (d.value = !0, L.value = {
113
+ if (!t && ((l = e.requestOpen) == null ? void 0 : l.call(e, !0)) === !1) return;
114
+ const a = ++y;
115
+ if (c.value = !0, L.value = {
96
116
  position: "fixed",
97
117
  top: "0px",
98
118
  left: "0px",
99
119
  visibility: "hidden"
100
- }, await P(), e !== b || !d.value) return;
101
- const a = U("floating", () => s(!0));
102
- w = a.unregister, h = a.isTop, k(), document.addEventListener("pointerdown", q, !0), document.addEventListener("keydown", B, !0), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), (u = window.visualViewport) == null || u.addEventListener("resize", c), (f = window.visualViewport) == null || f.addEventListener("scroll", c);
120
+ }, await G(), a !== y || !c.value) return;
121
+ const i = ee(
122
+ "floating",
123
+ () => u(!0),
124
+ e.zIndex
125
+ );
126
+ W.value = i, w = i.unregister, r = i.isTop, F(), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", q, !0), window.addEventListener("resize", s), window.addEventListener("scroll", s, !0), (o = window.visualViewport) == null || o.addEventListener("resize", s), (d = window.visualViewport) == null || d.addEventListener("scroll", s);
103
127
  }
104
- function D() {
105
- return d.value ? s() : V();
128
+ function K() {
129
+ return c.value ? u() : N();
106
130
  }
107
- return I(
108
- C,
131
+ return D(
132
+ k,
133
+ (t) => {
134
+ t && u(!1, !0);
135
+ },
136
+ { flush: "sync" }
137
+ ), U(() => u(!1, !0)), D(
138
+ () => m == null ? void 0 : m.value,
109
139
  (t) => {
110
- t && s(!1, !0);
140
+ t === !1 && u(!1, !0);
111
141
  },
112
142
  { flush: "sync" }
113
- ), S(() => s(!1, !0)), K(() => {
114
- b++, O();
143
+ ), V(() => {
144
+ y++, B();
115
145
  }), {
116
- open: d,
117
- style: L,
118
- placement: F,
119
- update: k,
120
- show: V,
121
- close: s,
122
- toggle: D,
123
- restoringFocus: M
146
+ open: c,
147
+ style: X(() => {
148
+ var t;
149
+ return {
150
+ ...L.value,
151
+ zIndex: String(((t = W.value) == null ? void 0 : t.zIndex.value) ?? 1200)
152
+ };
153
+ }),
154
+ placement: C,
155
+ update: F,
156
+ show: N,
157
+ close: u,
158
+ toggle: K,
159
+ restoringFocus: p,
160
+ schedule: s,
161
+ isTop: () => (r == null ? void 0 : r()) ?? !1
124
162
  };
125
163
  }
126
164
  export {
127
- J as useFloating
165
+ re as useFloating
128
166
  };