@eightshift/ui-components 1.0.6 → 1.1.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.
- package/README.md +9 -0
- package/dist/{Button-eebLs4cp.js → Button-CbFrFO04.js} +5 -5
- package/dist/{Checkbox-BN0TEda-.js → Checkbox-Cv3pZDHg.js} +12 -16
- package/dist/{ColorSwatch-BrowHhTG.js → ColorSwatch-CNQmCQV8.js} +6 -7
- package/dist/{FieldError-ILxgMZy5.js → FieldError-J1-YPbi6.js} +2 -2
- package/dist/{FocusScope-B9b0VMib.js → FocusScope-Bw-IatMO.js} +79 -153
- package/dist/{GridList-CzpWxJsS.js → GridList-CEzzyr-l.js} +62 -90
- package/dist/{Group-Dkdm2-E7.js → Group-D3Qa6PrV.js} +3 -3
- package/dist/{Input-BJA4rmIo.js → Input-CX_rocyZ.js} +8 -8
- package/dist/{Label-9x5iLJ-Y.js → Label-Bg5O81Wb.js} +1 -1
- package/dist/{ListBox-D3Vr4vvC.js → ListBox-CCWXTj0t.js} +391 -598
- package/dist/{LiveAnnouncer-IsokfWQ5.js → LiveAnnouncer-D8h-3GrG.js} +12 -22
- package/dist/{NumberFormatter-LzoKy975.js → NumberFormatter-U_Gx0UDq.js} +26 -44
- package/dist/{Select-49a62830.esm-CKPmlkza.js → Select-49a62830.esm-BnlXlUnT.js} +92 -166
- package/dist/{SelectionManager-sedvcM-1.js → SelectionManager-XOAt-Ekx.js} +219 -401
- package/dist/{Separator-B6rnDabE.js → Separator-DZeg0KOr.js} +41 -72
- package/dist/{Slider-C5U5N7uM.js → Slider-fULMI0gI.js} +51 -82
- package/dist/{Text-Cyxp9ewv.js → Text-WqetJduR.js} +1 -1
- package/dist/{VisuallyHidden-BPJVSUyp.js → VisuallyHidden-Di1zXprL.js} +8 -11
- package/dist/{ariaHideOutside-ByKBPHmX.js → ariaHideOutside-Zn64-frS.js} +20 -36
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/{button-idVI4jmd.js → button-CD8Q1eok.js} +17 -29
- package/dist/components/animated-visibility/animated-visibility.js +125 -113
- package/dist/components/base-control/base-control.js +3 -9
- package/dist/components/breakpoint-preview/breakpoint-preview.js +51 -108
- package/dist/components/button/button.js +6 -6
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +5 -9
- package/dist/components/color-pickers/gradient-editor.js +15 -29
- package/dist/components/color-pickers/solid-color-picker.js +81 -128
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +4 -11
- package/dist/components/draggable-list/draggable-list-item.js +4 -4
- package/dist/components/draggable-list/draggable-list.js +5 -5
- package/dist/components/expandable/expandable.js +45 -57
- package/dist/components/index.js +3 -3
- package/dist/components/input-field/input-field.js +11 -26
- package/dist/components/layout/hstack.js +2 -12
- package/dist/components/layout/vstack.js +2 -12
- package/dist/components/link-input/link-input.js +36 -53
- package/dist/components/list-box/list-box.js +4 -4
- package/dist/components/matrix-align/matrix-align.js +6 -10
- package/dist/components/menu/menu.js +101 -170
- package/dist/components/notice/notice.js +1 -1
- package/dist/components/number-picker/number-picker.js +15 -15
- package/dist/components/option-select/option-select.js +48 -64
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-placeholder.js +2 -2
- package/dist/components/placeholders/image-placeholder.js +1 -1
- package/dist/components/placeholders/media-placeholder.js +1 -1
- package/dist/components/popover/popover.js +4 -4
- package/dist/components/radio/radio.js +25 -38
- package/dist/components/repeater/repeater-item.js +6 -17
- package/dist/components/repeater/repeater.js +6 -7
- package/dist/components/responsive/responsive-legacy.js +6 -12
- package/dist/components/responsive/responsive.js +21 -48
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +2 -8
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +2 -2
- package/dist/components/select/multi-select-components.js +2 -2
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +9 -9
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +3 -10
- package/dist/components/slider/column-config-slider.js +4 -4
- package/dist/components/slider/slider.js +5 -8
- package/dist/components/slider/utils.js +2 -6
- package/dist/components/spacer/spacer.js +2 -7
- package/dist/components/tabs/tabs.js +29 -50
- package/dist/components/toggle/switch.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +8 -22
- package/dist/components/tooltip/tooltip.js +4 -4
- package/dist/{context-BAcFg5GO.js → context-4oSz1ItD.js} +10 -16
- package/dist/{default-i18n-Bk1GxDHz.js → default-i18n-BqwLkgZv.js} +21 -22
- package/dist/{filterDOMProps-DG2RfOUr.js → filterDOMProps-EDDcM64A.js} +1 -3
- package/dist/{focusSafely-B0hyd-S4.js → focusSafely-BS4dllCW.js} +85 -143
- package/dist/icons/generic-color-swatch.js +105 -13
- package/dist/icons/icons.js +31010 -3447
- package/dist/icons/jsx-svg.js +591 -953
- package/dist/{index-BDk0TPWz.js → index-CAPcSs9K.js} +1504 -2087
- package/dist/{index-a301f526.esm-BzTuHLdr.js → index-a301f526.esm-ByOfDxiG.js} +111 -183
- package/dist/index.js +3 -3
- package/dist/{intlStrings-Ctkp0HDc.js → intlStrings-Dxaeitoh.js} +35 -60
- package/dist/{isScrollable-PcyglExV.js → isScrollable-Dh9D9IOd.js} +1 -2
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/{multi-select-components-nORKdJ-2.js → multi-select-components-7vKCF8dG.js} +3 -3
- package/dist/{number-rWqELA8W.js → number-CHmNj-oR.js} +3 -6
- package/dist/{popover-o2Q28Ljn.js → popover-Dk2o4S7K.js} +70 -112
- package/dist/{react-select-async.esm-CLj9uZTq.js → react-select-async.esm-5zW9Dv9E.js} +7 -11
- package/dist/{react-select.esm-3tyTZmrx.js → react-select.esm-Bi6uzjbT.js} +3 -3
- package/dist/{textSelection-BRZdHY-4.js → textSelection-exP_9srp.js} +5 -9
- package/dist/{tooltip-T6H9uF-Z.js → tooltip-BRQ4tvZL.js} +64 -111
- package/dist/{useButton-D-xACzEY.js → useButton-DbjDV_33.js} +19 -22
- package/dist/{useEvent-XlYPKgwX.js → useEvent-zvxfEnmK.js} +2 -3
- package/dist/{useFocusRing-CRx_hYC4.js → useFocusRing-SPRI0-SN.js} +1 -1
- package/dist/{useFocusable-CHfpEdlE.js → useFocusable-CLmhO94g.js} +5 -8
- package/dist/{useFormReset-aHn6-wRk.js → useFormReset-BVWgcyGO.js} +2 -3
- package/dist/{useFormValidationState-CdYmOaXI.js → useFormValidationState-CthG9Fbc.js} +20 -38
- package/dist/{useHasTabbableChild-domoFB7A.js → useHasTabbableChild--gkWUICh.js} +2 -2
- package/dist/{useLabel-DVhXVhtH.js → useLabel-g836T8kL.js} +3 -4
- package/dist/{useLabels-C7E5SkOi.js → useLabels-CfOtyOe2.js} +3 -5
- package/dist/{useListData-BelKu4kx.js → useListData-BpYQj7kK.js} +18 -32
- package/dist/{useListState-BRsq7O1C.js → useListState-DnWZa__1.js} +6 -12
- package/dist/{useLocalizedStringFormatter-WsEL47qR.js → useLocalizedStringFormatter-BQCMno9k.js} +12 -21
- package/dist/{useNumberFieldState-ZH2Qyyxh.js → useNumberFieldState-BegO5X6F.js} +75 -132
- package/dist/{useNumberFormatter-mhdYLxWQ.js → useNumberFormatter-DhOGEsEK.js} +2 -2
- package/dist/{usePress-B42RawCH.js → usePress-CScNeV3V.js} +92 -175
- package/dist/{useToggle-CExfZM8x.js → useToggle-6LnpaJ7-.js} +6 -7
- package/dist/{useToggleState-DghG5ImG.js → useToggleState-Cymkpac8.js} +3 -5
- package/dist/utilities/array-helpers.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/text-helpers.js +20 -20
- package/dist/{utils-DIBzm1e4.js → utils-Dc35LwuT.js} +49 -90
- package/package.json +96 -90
- package/dist/lite-pbIeT7tm.js +0 -8
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import { f as $880e95eb8b93ba9a$export$ecf600387e221c37, k as $ef06256079686ba0$export$f8aeda7b10753fa1, h as $7135fc7d473fd974$export$8c25dea96356a8b6, i as $7135fc7d473fd974$export$813b5978dd974d8, n as $7135fc7d473fd974$export$6cd28814d92fa9c9, o as $7135fc7d473fd974$export$727c8fc270210f13, j as $7135fc7d473fd974$export$e7c29ae2353b16ea } from "./SelectionManager-
|
|
2
|
-
import { e as $bdb11010cef70236$export$f680877a34711e37, d as $3ef42575df84b30b$export$9d1611c77c2fe928, k as $bdb11010cef70236$export$b4cc09c592e8fdb8, n as $ff5963eb1fccf552$export$e08e3b67e392101e, g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, a as $64fa3d84918910a7$export$29f1550f4b0d4415, t as $64fa3d84918910a7$export$94b6d0abf7d33e8c, c as $64fa3d84918910a7$export$4d86445c2cf5e3, j as $64fa3d84918910a7$export$2881499e37b75b9a, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, m as $5dc95899b306f630$export$c9058316764c140e, l as $df56164dff5785e2$export$4338b53315abf666 } from "./utils-
|
|
1
|
+
import { f as $880e95eb8b93ba9a$export$ecf600387e221c37, k as $ef06256079686ba0$export$f8aeda7b10753fa1, h as $7135fc7d473fd974$export$8c25dea96356a8b6, i as $7135fc7d473fd974$export$813b5978dd974d8, n as $7135fc7d473fd974$export$6cd28814d92fa9c9, o as $7135fc7d473fd974$export$727c8fc270210f13, j as $7135fc7d473fd974$export$e7c29ae2353b16ea } from "./SelectionManager-XOAt-Ekx.js";
|
|
2
|
+
import { e as $bdb11010cef70236$export$f680877a34711e37, d as $3ef42575df84b30b$export$9d1611c77c2fe928, k as $bdb11010cef70236$export$b4cc09c592e8fdb8, n as $ff5963eb1fccf552$export$e08e3b67e392101e, g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, a as $64fa3d84918910a7$export$29f1550f4b0d4415, t as $64fa3d84918910a7$export$94b6d0abf7d33e8c, c as $64fa3d84918910a7$export$4d86445c2cf5e3, j as $64fa3d84918910a7$export$2881499e37b75b9a, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, m as $5dc95899b306f630$export$c9058316764c140e, l as $df56164dff5785e2$export$4338b53315abf666 } from "./utils-Dc35LwuT.js";
|
|
3
3
|
import React__default, { useState, useEffect, useRef, useCallback, useImperativeHandle, useMemo, forwardRef, createContext, useContext } from "react";
|
|
4
|
-
import { d as $9ab94262bd0047c7$export$420e68273165f4ec, o as $c87311424ea30a05$export$9ac100e40613ea10, p as $c87311424ea30a05$export$78551043582a6a98, $ as $6179b936705e76d3$export$ae780daf29e6d456, a as $507fabe10e71c6fb$export$b9b3dfddab17db27, w as $507fabe10e71c6fb$export$98e20ec92f614cfe, t as $507fabe10e71c6fb$export$630ff653c5ada6a9, s as $6a7db85432448f7f$export$60278871457622de, r as $6a7db85432448f7f$export$29bf1b5f2c56cf63, q as $c87311424ea30a05$export$7bef049ce92e4224, j as $c87311424ea30a05$export$fedb369cb70207f1, i as $507fabe10e71c6fb$export$8397ddfc504fdb9a } from "./focusSafely-
|
|
5
|
-
import { $ as $319e236875307eab$export$a9b970dcc4ae71a9 } from "./LiveAnnouncer-
|
|
6
|
-
import { a as $5e3802645cc19319$export$1c3ebcada18427bf, $ as $62d8ded9296f3872$export$cfa2225e87938781 } from "./ariaHideOutside-
|
|
7
|
-
import { r as reactDomExports } from "./index-
|
|
8
|
-
import { $ as $cc38e7bd3fc7b213$export$2bb74740c4e19def } from "./isScrollable-
|
|
9
|
-
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-
|
|
10
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
11
|
-
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-
|
|
12
|
-
import { $ as $982254629710d113$export$b95089534ab7c1fd, b as $453cc9f0df89c0a5$export$77d5aafae4e095b2, f as $325a3faab7a68acd$export$a16aca283550c30d, a as $2a25aae57d74318e$export$a05409b8bb224a5a, c as $431f98aba6844401$export$1ff3c3f08ae963c0, d as $431f98aba6844401$export$6615d83f6de245ce, e as $72a5793c14baf454$export$8b251419efc915eb } from "./Separator-
|
|
13
|
-
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "./Text-
|
|
14
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-
|
|
15
|
-
import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-
|
|
16
|
-
import { $ as $d191a55c9702f145$export$8467354a121f1b9f } from "./useLabel-
|
|
17
|
-
import { a as $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 } from "./usePress-
|
|
18
|
-
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-
|
|
19
|
-
import { $ as $9bf71ea28793e738$export$20e40289641fbbb6 } from "./FocusScope-
|
|
4
|
+
import { d as $9ab94262bd0047c7$export$420e68273165f4ec, o as $c87311424ea30a05$export$9ac100e40613ea10, p as $c87311424ea30a05$export$78551043582a6a98, $ as $6179b936705e76d3$export$ae780daf29e6d456, a as $507fabe10e71c6fb$export$b9b3dfddab17db27, w as $507fabe10e71c6fb$export$98e20ec92f614cfe, t as $507fabe10e71c6fb$export$630ff653c5ada6a9, s as $6a7db85432448f7f$export$60278871457622de, r as $6a7db85432448f7f$export$29bf1b5f2c56cf63, q as $c87311424ea30a05$export$7bef049ce92e4224, j as $c87311424ea30a05$export$fedb369cb70207f1, i as $507fabe10e71c6fb$export$8397ddfc504fdb9a } from "./focusSafely-BS4dllCW.js";
|
|
5
|
+
import { $ as $319e236875307eab$export$a9b970dcc4ae71a9 } from "./LiveAnnouncer-D8h-3GrG.js";
|
|
6
|
+
import { a as $5e3802645cc19319$export$1c3ebcada18427bf, $ as $62d8ded9296f3872$export$cfa2225e87938781 } from "./ariaHideOutside-Zn64-frS.js";
|
|
7
|
+
import { r as reactDomExports } from "./index-CAPcSs9K.js";
|
|
8
|
+
import { $ as $cc38e7bd3fc7b213$export$2bb74740c4e19def } from "./isScrollable-Dh9D9IOd.js";
|
|
9
|
+
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-BQCMno9k.js";
|
|
10
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-4oSz1ItD.js";
|
|
11
|
+
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-exP_9srp.js";
|
|
12
|
+
import { $ as $982254629710d113$export$b95089534ab7c1fd, b as $453cc9f0df89c0a5$export$77d5aafae4e095b2, f as $325a3faab7a68acd$export$a16aca283550c30d, a as $2a25aae57d74318e$export$a05409b8bb224a5a, c as $431f98aba6844401$export$1ff3c3f08ae963c0, d as $431f98aba6844401$export$6615d83f6de245ce, e as $72a5793c14baf454$export$8b251419efc915eb } from "./Separator-DZeg0KOr.js";
|
|
13
|
+
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "./Text-WqetJduR.js";
|
|
14
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
15
|
+
import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-DnWZa__1.js";
|
|
16
|
+
import { $ as $d191a55c9702f145$export$8467354a121f1b9f } from "./useLabel-g836T8kL.js";
|
|
17
|
+
import { a as $ea8dcbcb9ea1b556$export$7e924b3091a3bd18 } from "./usePress-CScNeV3V.js";
|
|
18
|
+
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-SPRI0-SN.js";
|
|
19
|
+
import { $ as $9bf71ea28793e738$export$20e40289641fbbb6 } from "./FocusScope-Bw-IatMO.js";
|
|
20
20
|
const $b1f0cad8af73213b$export$3585ede4d035bf14 = /* @__PURE__ */ new WeakMap();
|
|
21
21
|
function $b1f0cad8af73213b$var$normalizeKey(key) {
|
|
22
|
-
if (typeof key === "string")
|
|
23
|
-
return key.replace(/\s*/g, "");
|
|
22
|
+
if (typeof key === "string") return key.replace(/\s*/g, "");
|
|
24
23
|
return "" + key;
|
|
25
24
|
}
|
|
26
25
|
function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey) {
|
|
27
26
|
let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
|
|
28
|
-
if (!data)
|
|
29
|
-
throw new Error("Unknown list");
|
|
27
|
+
if (!data) throw new Error("Unknown list");
|
|
30
28
|
return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey)}`;
|
|
31
29
|
}
|
|
32
30
|
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
|
|
@@ -210,8 +208,7 @@ const $103790afe9474d1c$export$608ecc6f1b23c35d = {
|
|
|
210
208
|
const $103790afe9474d1c$export$5eacb0769d26d3b2 = $103790afe9474d1c$var$invert($103790afe9474d1c$export$608ecc6f1b23c35d);
|
|
211
209
|
function $103790afe9474d1c$var$invert(object) {
|
|
212
210
|
let res = {};
|
|
213
|
-
for (let key in object)
|
|
214
|
-
res[object[key]] = key;
|
|
211
|
+
for (let key in object) res[object[key]] = key;
|
|
215
212
|
return res;
|
|
216
213
|
}
|
|
217
214
|
const $103790afe9474d1c$export$4a7729b856e9a690 = /* @__PURE__ */ new Set([
|
|
@@ -225,30 +222,23 @@ const $7252cd45fc48c07c$export$dfdf5deeaf27473f = /* @__PURE__ */ new WeakMap();
|
|
|
225
222
|
const $7252cd45fc48c07c$export$990fced5dfac2637 = Symbol();
|
|
226
223
|
function $7252cd45fc48c07c$export$3093291712f09a77(state) {
|
|
227
224
|
let { id } = $7252cd45fc48c07c$export$dfdf5deeaf27473f.get(state);
|
|
228
|
-
if (!id)
|
|
229
|
-
throw new Error("Droppable item outside a droppable collection");
|
|
225
|
+
if (!id) throw new Error("Droppable item outside a droppable collection");
|
|
230
226
|
return id;
|
|
231
227
|
}
|
|
232
228
|
function $7252cd45fc48c07c$export$7e397efd01d3db27(state) {
|
|
233
229
|
let { ref } = $7252cd45fc48c07c$export$dfdf5deeaf27473f.get(state);
|
|
234
|
-
if (!ref)
|
|
235
|
-
throw new Error("Droppable item outside a droppable collection");
|
|
230
|
+
if (!ref) throw new Error("Droppable item outside a droppable collection");
|
|
236
231
|
return ref;
|
|
237
232
|
}
|
|
238
233
|
function $7252cd45fc48c07c$export$e1d41611756c6326(items) {
|
|
239
234
|
let types = /* @__PURE__ */ new Set();
|
|
240
|
-
for (let item of items)
|
|
241
|
-
for (let type of Object.keys(item))
|
|
242
|
-
types.add(type);
|
|
235
|
+
for (let item of items) for (let type of Object.keys(item)) types.add(type);
|
|
243
236
|
return types;
|
|
244
237
|
}
|
|
245
238
|
function $7252cd45fc48c07c$var$mapModality(modality) {
|
|
246
|
-
if (!modality)
|
|
247
|
-
|
|
248
|
-
if (modality === "
|
|
249
|
-
modality = "virtual";
|
|
250
|
-
if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window)
|
|
251
|
-
modality = "touch";
|
|
239
|
+
if (!modality) modality = "virtual";
|
|
240
|
+
if (modality === "pointer") modality = "virtual";
|
|
241
|
+
if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window) modality = "touch";
|
|
252
242
|
return modality;
|
|
253
243
|
}
|
|
254
244
|
function $7252cd45fc48c07c$export$49bac5d6d4b352ea() {
|
|
@@ -263,28 +253,25 @@ function $7252cd45fc48c07c$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
263
253
|
let customData = [];
|
|
264
254
|
for (let item of items) {
|
|
265
255
|
let types = Object.keys(item);
|
|
266
|
-
if (types.length > 1)
|
|
267
|
-
needsCustomData = true;
|
|
256
|
+
if (types.length > 1) needsCustomData = true;
|
|
268
257
|
let dataByType = {};
|
|
269
258
|
for (let type of types) {
|
|
270
259
|
let typeItems = groupedByType.get(type);
|
|
271
260
|
if (!typeItems) {
|
|
272
261
|
typeItems = [];
|
|
273
262
|
groupedByType.set(type, typeItems);
|
|
274
|
-
} else
|
|
275
|
-
needsCustomData = true;
|
|
263
|
+
} else needsCustomData = true;
|
|
276
264
|
let data = item[type];
|
|
277
265
|
dataByType[type] = data;
|
|
278
266
|
typeItems.push(data);
|
|
279
267
|
}
|
|
280
268
|
customData.push(dataByType);
|
|
281
269
|
}
|
|
282
|
-
for (let [type, items2] of groupedByType)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
dataTransfer.items.add(items2[0], type);
|
|
270
|
+
for (let [type, items2] of groupedByType) if ($103790afe9474d1c$export$4a7729b856e9a690.has(type)) {
|
|
271
|
+
let data = items2.join("\n");
|
|
272
|
+
dataTransfer.items.add(data, type);
|
|
273
|
+
} else
|
|
274
|
+
dataTransfer.items.add(items2[0], type);
|
|
288
275
|
if (needsCustomData) {
|
|
289
276
|
let data = JSON.stringify(customData);
|
|
290
277
|
dataTransfer.items.add(data, $103790afe9474d1c$export$fd9f9fc120c5402d);
|
|
@@ -292,41 +279,35 @@ function $7252cd45fc48c07c$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
292
279
|
}
|
|
293
280
|
class $7252cd45fc48c07c$export$7f04ce188c91447c {
|
|
294
281
|
has(type) {
|
|
295
|
-
if (this.includesUnknownTypes || type === $7252cd45fc48c07c$export$990fced5dfac2637 && this.types.has($103790afe9474d1c$export$f8fc6581787339b3))
|
|
296
|
-
return true;
|
|
282
|
+
if (this.includesUnknownTypes || type === $7252cd45fc48c07c$export$990fced5dfac2637 && this.types.has($103790afe9474d1c$export$f8fc6581787339b3)) return true;
|
|
297
283
|
return typeof type === "string" && this.types.has(type);
|
|
298
284
|
}
|
|
299
285
|
constructor(dataTransfer) {
|
|
300
286
|
this.types = /* @__PURE__ */ new Set();
|
|
301
287
|
let hasFiles = false;
|
|
302
|
-
for (let item of dataTransfer.items)
|
|
303
|
-
if (item.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
else
|
|
309
|
-
this.types.add($103790afe9474d1c$export$f8fc6581787339b3);
|
|
310
|
-
}
|
|
288
|
+
for (let item of dataTransfer.items) if (item.type !== $103790afe9474d1c$export$fd9f9fc120c5402d) {
|
|
289
|
+
if (item.kind === "file") hasFiles = true;
|
|
290
|
+
if (item.type) this.types.add(item.type);
|
|
291
|
+
else
|
|
292
|
+
this.types.add($103790afe9474d1c$export$f8fc6581787339b3);
|
|
293
|
+
}
|
|
311
294
|
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes("Files");
|
|
312
295
|
}
|
|
313
296
|
}
|
|
314
297
|
function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
315
298
|
let items = [];
|
|
316
299
|
let hasCustomType = false;
|
|
317
|
-
if (dataTransfer.types.includes($103790afe9474d1c$export$fd9f9fc120c5402d))
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
} catch (e) {
|
|
329
|
-
}
|
|
300
|
+
if (dataTransfer.types.includes($103790afe9474d1c$export$fd9f9fc120c5402d)) try {
|
|
301
|
+
let data = dataTransfer.getData((0, $103790afe9474d1c$export$fd9f9fc120c5402d));
|
|
302
|
+
let parsed = JSON.parse(data);
|
|
303
|
+
for (let item of parsed) items.push({
|
|
304
|
+
kind: "text",
|
|
305
|
+
types: new Set(Object.keys(item)),
|
|
306
|
+
getText: (type) => Promise.resolve(item[type])
|
|
307
|
+
});
|
|
308
|
+
hasCustomType = true;
|
|
309
|
+
} catch (e) {
|
|
310
|
+
}
|
|
330
311
|
if (!hasCustomType) {
|
|
331
312
|
let stringItems = /* @__PURE__ */ new Map();
|
|
332
313
|
for (let item of dataTransfer.items) {
|
|
@@ -335,28 +316,23 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
335
316
|
else if (item.kind === "file") {
|
|
336
317
|
if (typeof item.webkitGetAsEntry === "function") {
|
|
337
318
|
let entry = item.webkitGetAsEntry();
|
|
338
|
-
if (!entry)
|
|
339
|
-
|
|
340
|
-
if (entry.
|
|
341
|
-
items.push($7252cd45fc48c07c$var$createFileItem(item.getAsFile()));
|
|
342
|
-
else if (entry.isDirectory)
|
|
343
|
-
items.push($7252cd45fc48c07c$var$createDirectoryItem(entry));
|
|
319
|
+
if (!entry) continue;
|
|
320
|
+
if (entry.isFile) items.push($7252cd45fc48c07c$var$createFileItem(item.getAsFile()));
|
|
321
|
+
else if (entry.isDirectory) items.push($7252cd45fc48c07c$var$createDirectoryItem(entry));
|
|
344
322
|
} else
|
|
345
323
|
items.push($7252cd45fc48c07c$var$createFileItem(item.getAsFile()));
|
|
346
324
|
}
|
|
347
325
|
}
|
|
348
|
-
if (stringItems.size > 0)
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
});
|
|
326
|
+
if (stringItems.size > 0) items.push({
|
|
327
|
+
kind: "text",
|
|
328
|
+
types: new Set(stringItems.keys()),
|
|
329
|
+
getText: (type) => Promise.resolve(stringItems.get(type))
|
|
330
|
+
});
|
|
354
331
|
}
|
|
355
332
|
return items;
|
|
356
333
|
}
|
|
357
334
|
function $7252cd45fc48c07c$var$blobToString(blob) {
|
|
358
|
-
if (typeof blob.text === "function")
|
|
359
|
-
return blob.text();
|
|
335
|
+
if (typeof blob.text === "function") return blob.text();
|
|
360
336
|
return new Promise((resolve, reject) => {
|
|
361
337
|
let reader = new FileReader();
|
|
362
338
|
reader.onload = () => {
|
|
@@ -393,8 +369,7 @@ async function* $7252cd45fc48c07c$var$getEntries(item) {
|
|
|
393
369
|
if (entry.isFile) {
|
|
394
370
|
let file = await $7252cd45fc48c07c$var$getEntryFile(entry);
|
|
395
371
|
yield $7252cd45fc48c07c$var$createFileItem(file);
|
|
396
|
-
} else if (entry.isDirectory)
|
|
397
|
-
yield $7252cd45fc48c07c$var$createDirectoryItem(entry);
|
|
372
|
+
} else if (entry.isDirectory) yield $7252cd45fc48c07c$var$createDirectoryItem(entry);
|
|
398
373
|
}
|
|
399
374
|
} while (entries.length > 0);
|
|
400
375
|
}
|
|
@@ -452,16 +427,13 @@ function $67560de7c78cb232$export$aef80212ac99c003(item) {
|
|
|
452
427
|
};
|
|
453
428
|
}
|
|
454
429
|
function $67560de7c78cb232$export$549dbcf8649bf3b2(target, stringFormatter) {
|
|
455
|
-
if ($67560de7c78cb232$var$dragSession)
|
|
456
|
-
throw new Error("Cannot begin dragging while already dragging");
|
|
430
|
+
if ($67560de7c78cb232$var$dragSession) throw new Error("Cannot begin dragging while already dragging");
|
|
457
431
|
$67560de7c78cb232$var$dragSession = new $67560de7c78cb232$var$DragSession(target, stringFormatter);
|
|
458
432
|
requestAnimationFrame(() => {
|
|
459
433
|
$67560de7c78cb232$var$dragSession.setup();
|
|
460
|
-
if ($7252cd45fc48c07c$export$1fb2158d224b542c() === "keyboard")
|
|
461
|
-
$67560de7c78cb232$var$dragSession.next();
|
|
434
|
+
if ($7252cd45fc48c07c$export$1fb2158d224b542c() === "keyboard") $67560de7c78cb232$var$dragSession.next();
|
|
462
435
|
});
|
|
463
|
-
for (let cb of $67560de7c78cb232$var$subscriptions)
|
|
464
|
-
cb();
|
|
436
|
+
for (let cb of $67560de7c78cb232$var$subscriptions) cb();
|
|
465
437
|
}
|
|
466
438
|
function $67560de7c78cb232$export$418e185dd3f1b968() {
|
|
467
439
|
let [session, setSession] = useState($67560de7c78cb232$var$dragSession);
|
|
@@ -476,8 +448,7 @@ function $67560de7c78cb232$export$418e185dd3f1b968() {
|
|
|
476
448
|
}
|
|
477
449
|
function $67560de7c78cb232$var$endDragging() {
|
|
478
450
|
$67560de7c78cb232$var$dragSession = null;
|
|
479
|
-
for (let cb of $67560de7c78cb232$var$subscriptions)
|
|
480
|
-
cb();
|
|
451
|
+
for (let cb of $67560de7c78cb232$var$subscriptions) cb();
|
|
481
452
|
}
|
|
482
453
|
const $67560de7c78cb232$var$CANCELED_EVENTS = [
|
|
483
454
|
"pointerdown",
|
|
@@ -518,8 +489,7 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
518
489
|
window.addEventListener("blur", this.onBlur, true);
|
|
519
490
|
document.addEventListener("click", this.onClick, true);
|
|
520
491
|
document.addEventListener("pointerdown", this.onPointerDown, true);
|
|
521
|
-
for (let event of $67560de7c78cb232$var$CANCELED_EVENTS)
|
|
522
|
-
document.addEventListener(event, this.cancelEvent, true);
|
|
492
|
+
for (let event of $67560de7c78cb232$var$CANCELED_EVENTS) document.addEventListener(event, this.cancelEvent, true);
|
|
523
493
|
this.mutationObserver = new MutationObserver(() => this.updateValidDropTargets());
|
|
524
494
|
this.updateValidDropTargets();
|
|
525
495
|
$319e236875307eab$export$a9b970dcc4ae71a9(this.stringFormatter.format($67560de7c78cb232$var$MESSAGES[$7252cd45fc48c07c$export$1fb2158d224b542c()]));
|
|
@@ -531,8 +501,7 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
531
501
|
window.removeEventListener("blur", this.onBlur, true);
|
|
532
502
|
document.removeEventListener("click", this.onClick, true);
|
|
533
503
|
document.removeEventListener("pointerdown", this.onPointerDown, true);
|
|
534
|
-
for (let event of $67560de7c78cb232$var$CANCELED_EVENTS)
|
|
535
|
-
document.removeEventListener(event, this.cancelEvent, true);
|
|
504
|
+
for (let event of $67560de7c78cb232$var$CANCELED_EVENTS) document.removeEventListener(event, this.cancelEvent, true);
|
|
536
505
|
this.mutationObserver.disconnect();
|
|
537
506
|
this.restoreAriaHidden();
|
|
538
507
|
}
|
|
@@ -544,47 +513,35 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
544
513
|
return;
|
|
545
514
|
}
|
|
546
515
|
if (e.key === "Tab" && !(e.metaKey || e.altKey || e.ctrlKey)) {
|
|
547
|
-
if (e.shiftKey)
|
|
548
|
-
|
|
549
|
-
else
|
|
550
|
-
this.next();
|
|
516
|
+
if (e.shiftKey) this.previous();
|
|
517
|
+
else this.next();
|
|
551
518
|
}
|
|
552
|
-
if (typeof ((_this_currentDropTarget = this.currentDropTarget) === null || _this_currentDropTarget === void 0 ? void 0 : _this_currentDropTarget.onKeyDown) === "function")
|
|
553
|
-
this.currentDropTarget.onKeyDown(e, this.dragTarget);
|
|
519
|
+
if (typeof ((_this_currentDropTarget = this.currentDropTarget) === null || _this_currentDropTarget === void 0 ? void 0 : _this_currentDropTarget.onKeyDown) === "function") this.currentDropTarget.onKeyDown(e, this.dragTarget);
|
|
554
520
|
}
|
|
555
521
|
onKeyUp(e) {
|
|
556
522
|
this.cancelEvent(e);
|
|
557
523
|
if (e.key === "Enter") {
|
|
558
|
-
if (e.altKey)
|
|
559
|
-
|
|
560
|
-
else
|
|
561
|
-
this.drop();
|
|
524
|
+
if (e.altKey) this.activate();
|
|
525
|
+
else this.drop();
|
|
562
526
|
}
|
|
563
527
|
}
|
|
564
528
|
onFocus(e) {
|
|
565
|
-
if (e.target !== this.dragTarget.element)
|
|
566
|
-
|
|
567
|
-
if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element)
|
|
568
|
-
return;
|
|
529
|
+
if (e.target !== this.dragTarget.element) this.cancelEvent(e);
|
|
530
|
+
if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) return;
|
|
569
531
|
let dropTarget = this.validDropTargets.find((target) => target.element === e.target) || this.validDropTargets.find((target) => target.element.contains(e.target));
|
|
570
532
|
if (!dropTarget) {
|
|
571
|
-
if (this.currentDropTarget)
|
|
572
|
-
|
|
573
|
-
else
|
|
574
|
-
this.dragTarget.element.focus();
|
|
533
|
+
if (this.currentDropTarget) this.currentDropTarget.element.focus();
|
|
534
|
+
else this.dragTarget.element.focus();
|
|
575
535
|
return;
|
|
576
536
|
}
|
|
577
537
|
let item = $67560de7c78cb232$var$dropItems.get(e.target);
|
|
578
538
|
this.setCurrentDropTarget(dropTarget, item);
|
|
579
539
|
}
|
|
580
540
|
onBlur(e) {
|
|
581
|
-
if (e.target !== this.dragTarget.element)
|
|
582
|
-
this.cancelEvent(e);
|
|
541
|
+
if (e.target !== this.dragTarget.element) this.cancelEvent(e);
|
|
583
542
|
if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {
|
|
584
|
-
if (this.currentDropTarget)
|
|
585
|
-
|
|
586
|
-
else
|
|
587
|
-
this.dragTarget.element.focus();
|
|
543
|
+
if (this.currentDropTarget) this.currentDropTarget.element.focus();
|
|
544
|
+
else this.dragTarget.element.focus();
|
|
588
545
|
}
|
|
589
546
|
}
|
|
590
547
|
onClick(e) {
|
|
@@ -608,19 +565,15 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
608
565
|
}
|
|
609
566
|
cancelEvent(e) {
|
|
610
567
|
var _this_dragTarget;
|
|
611
|
-
if ((e.type === "focusin" || e.type === "focusout") && e.target === ((_this_dragTarget = this.dragTarget) === null || _this_dragTarget === void 0 ? void 0 : _this_dragTarget.element))
|
|
612
|
-
|
|
613
|
-
if (!$67560de7c78cb232$var$CLICK_EVENTS.includes(e.type))
|
|
614
|
-
e.preventDefault();
|
|
568
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target === ((_this_dragTarget = this.dragTarget) === null || _this_dragTarget === void 0 ? void 0 : _this_dragTarget.element)) return;
|
|
569
|
+
if (!$67560de7c78cb232$var$CLICK_EVENTS.includes(e.type)) e.preventDefault();
|
|
615
570
|
e.stopPropagation();
|
|
616
571
|
e.stopImmediatePropagation();
|
|
617
572
|
}
|
|
618
573
|
updateValidDropTargets() {
|
|
619
|
-
if (!this.mutationObserver)
|
|
620
|
-
return;
|
|
574
|
+
if (!this.mutationObserver) return;
|
|
621
575
|
this.mutationObserver.disconnect();
|
|
622
|
-
if (this.restoreAriaHidden)
|
|
623
|
-
this.restoreAriaHidden();
|
|
576
|
+
if (this.restoreAriaHidden) this.restoreAriaHidden();
|
|
624
577
|
this.validDropTargets = $67560de7c78cb232$var$findValidDropTargets(this.dragTarget);
|
|
625
578
|
if (this.validDropTargets.length > 0) {
|
|
626
579
|
let nearestIndex = this.findNearestDropTarget();
|
|
@@ -629,14 +582,12 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
629
582
|
...this.validDropTargets.slice(0, nearestIndex)
|
|
630
583
|
];
|
|
631
584
|
}
|
|
632
|
-
if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget))
|
|
633
|
-
this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
585
|
+
if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
634
586
|
let types = $7252cd45fc48c07c$export$e1d41611756c6326(this.dragTarget.items);
|
|
635
587
|
let validDropItems = [
|
|
636
588
|
...$67560de7c78cb232$var$dropItems.values()
|
|
637
589
|
].filter((item) => {
|
|
638
|
-
if (typeof item.getDropOperation === "function")
|
|
639
|
-
return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== "cancel";
|
|
590
|
+
if (typeof item.getDropOperation === "function") return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== "cancel";
|
|
640
591
|
return true;
|
|
641
592
|
});
|
|
642
593
|
let visibleDropTargets = this.validDropTargets.filter((target) => !validDropItems.some((item) => target.element.contains(item.element)));
|
|
@@ -667,10 +618,8 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
667
618
|
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
668
619
|
this.setCurrentDropTarget(null);
|
|
669
620
|
this.dragTarget.element.focus();
|
|
670
|
-
} else
|
|
671
|
-
|
|
672
|
-
} else
|
|
673
|
-
this.setCurrentDropTarget(this.validDropTargets[index + 1]);
|
|
621
|
+
} else this.setCurrentDropTarget(this.validDropTargets[0]);
|
|
622
|
+
} else this.setCurrentDropTarget(this.validDropTargets[index + 1]);
|
|
674
623
|
}
|
|
675
624
|
previous() {
|
|
676
625
|
if (!this.currentDropTarget) {
|
|
@@ -686,10 +635,8 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
686
635
|
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) {
|
|
687
636
|
this.setCurrentDropTarget(null);
|
|
688
637
|
this.dragTarget.element.focus();
|
|
689
|
-
} else
|
|
690
|
-
|
|
691
|
-
} else
|
|
692
|
-
this.setCurrentDropTarget(this.validDropTargets[index - 1]);
|
|
638
|
+
} else this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);
|
|
639
|
+
} else this.setCurrentDropTarget(this.validDropTargets[index - 1]);
|
|
693
640
|
}
|
|
694
641
|
findNearestDropTarget() {
|
|
695
642
|
let dragTargetRect = this.dragTarget.element.getBoundingClientRect();
|
|
@@ -728,13 +675,11 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
728
675
|
y: rect.top + rect.height / 2
|
|
729
676
|
}, this.dragTarget);
|
|
730
677
|
}
|
|
731
|
-
if (!item)
|
|
732
|
-
dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.element.focus();
|
|
678
|
+
if (!item) dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.element.focus();
|
|
733
679
|
}
|
|
734
680
|
}
|
|
735
681
|
if (item !== this.currentDropItem) {
|
|
736
|
-
if (item && typeof this.currentDropTarget.onDropTargetEnter === "function")
|
|
737
|
-
this.currentDropTarget.onDropTargetEnter(item === null || item === void 0 ? void 0 : item.target);
|
|
682
|
+
if (item && typeof this.currentDropTarget.onDropTargetEnter === "function") this.currentDropTarget.onDropTargetEnter(item === null || item === void 0 ? void 0 : item.target);
|
|
738
683
|
item === null || item === void 0 ? void 0 : item.element.focus();
|
|
739
684
|
this.currentDropItem = item;
|
|
740
685
|
if (!this.initialFocused) {
|
|
@@ -773,8 +718,7 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
773
718
|
cancel() {
|
|
774
719
|
this.setCurrentDropTarget(null);
|
|
775
720
|
this.end();
|
|
776
|
-
if (!this.dragTarget.element.closest('[aria-hidden="true"]'))
|
|
777
|
-
this.dragTarget.element.focus();
|
|
721
|
+
if (!this.dragTarget.element.closest('[aria-hidden="true"]')) this.dragTarget.element.focus();
|
|
778
722
|
$319e236875307eab$export$a9b970dcc4ae71a9(this.stringFormatter.format("dropCanceled"));
|
|
779
723
|
}
|
|
780
724
|
drop(item) {
|
|
@@ -836,10 +780,8 @@ function $67560de7c78cb232$var$findValidDropTargets(options) {
|
|
|
836
780
|
return [
|
|
837
781
|
...$67560de7c78cb232$var$dropTargets.values()
|
|
838
782
|
].filter((target) => {
|
|
839
|
-
if (target.element.closest('[aria-hidden="true"]'))
|
|
840
|
-
|
|
841
|
-
if (typeof target.getDropOperation === "function")
|
|
842
|
-
return target.getDropOperation(types, options.allowedDropOperations) !== "cancel";
|
|
783
|
+
if (target.element.closest('[aria-hidden="true"]')) return false;
|
|
784
|
+
if (typeof target.getDropOperation === "function") return target.getDropOperation(types, options.allowedDropOperations) !== "cancel";
|
|
843
785
|
return true;
|
|
844
786
|
});
|
|
845
787
|
}
|
|
@@ -2345,8 +2287,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2345
2287
|
let modalityOnPointerDown = useRef(null);
|
|
2346
2288
|
let onDragStart = (e) => {
|
|
2347
2289
|
var _options_preview;
|
|
2348
|
-
if (e.defaultPrevented)
|
|
2349
|
-
return;
|
|
2290
|
+
if (e.defaultPrevented) return;
|
|
2350
2291
|
e.stopPropagation();
|
|
2351
2292
|
if (modalityOnPointerDown.current === "virtual") {
|
|
2352
2293
|
e.preventDefault();
|
|
@@ -2354,37 +2295,34 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2354
2295
|
modalityOnPointerDown.current = null;
|
|
2355
2296
|
return;
|
|
2356
2297
|
}
|
|
2357
|
-
if (typeof options.onDragStart === "function")
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
});
|
|
2298
|
+
if (typeof options.onDragStart === "function") options.onDragStart({
|
|
2299
|
+
type: "dragstart",
|
|
2300
|
+
x: e.clientX,
|
|
2301
|
+
y: e.clientY
|
|
2302
|
+
});
|
|
2363
2303
|
let items = options.getItems();
|
|
2364
2304
|
$7252cd45fc48c07c$export$f9c1490890ddd063(e.dataTransfer, items);
|
|
2365
2305
|
let allowed = $103790afe9474d1c$export$60b7b4bcf3903d8e.all;
|
|
2366
2306
|
if (typeof options.getAllowedDropOperations === "function") {
|
|
2367
2307
|
let allowedOperations = options.getAllowedDropOperations();
|
|
2368
2308
|
allowed = $103790afe9474d1c$export$60b7b4bcf3903d8e.none;
|
|
2369
|
-
for (let operation of allowedOperations)
|
|
2370
|
-
allowed |= $103790afe9474d1c$export$60b7b4bcf3903d8e[operation] || $103790afe9474d1c$export$60b7b4bcf3903d8e.none;
|
|
2309
|
+
for (let operation of allowedOperations) allowed |= $103790afe9474d1c$export$60b7b4bcf3903d8e[operation] || $103790afe9474d1c$export$60b7b4bcf3903d8e.none;
|
|
2371
2310
|
}
|
|
2372
2311
|
$7252cd45fc48c07c$export$6539bc8c3a0a2d67(allowed);
|
|
2373
2312
|
e.dataTransfer.effectAllowed = $103790afe9474d1c$export$dd0165308d8bff45[allowed] || "none";
|
|
2374
|
-
if (typeof ((_options_preview = options.preview) === null || _options_preview === void 0 ? void 0 : _options_preview.current) === "function")
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
});
|
|
2313
|
+
if (typeof ((_options_preview = options.preview) === null || _options_preview === void 0 ? void 0 : _options_preview.current) === "function") options.preview.current(items, (node) => {
|
|
2314
|
+
let size = node.getBoundingClientRect();
|
|
2315
|
+
let rect = e.currentTarget.getBoundingClientRect();
|
|
2316
|
+
let x = e.clientX - rect.x;
|
|
2317
|
+
let y = e.clientY - rect.y;
|
|
2318
|
+
if (x > size.width || y > size.height) {
|
|
2319
|
+
x = size.width / 2;
|
|
2320
|
+
y = size.height / 2;
|
|
2321
|
+
}
|
|
2322
|
+
let height = 2 * Math.round(size.height / 2);
|
|
2323
|
+
node.style.height = `${height}px`;
|
|
2324
|
+
e.dataTransfer.setDragImage(node, x, y);
|
|
2325
|
+
});
|
|
2388
2326
|
addGlobalListener(window, "drop", (e2) => {
|
|
2389
2327
|
e2.preventDefault();
|
|
2390
2328
|
e2.stopPropagation();
|
|
@@ -2400,14 +2338,12 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2400
2338
|
};
|
|
2401
2339
|
let onDrag = (e) => {
|
|
2402
2340
|
e.stopPropagation();
|
|
2403
|
-
if (e.clientX === state.x && e.clientY === state.y)
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
y: e.clientY
|
|
2410
|
-
});
|
|
2341
|
+
if (e.clientX === state.x && e.clientY === state.y) return;
|
|
2342
|
+
if (typeof options.onDragMove === "function") options.onDragMove({
|
|
2343
|
+
type: "dragmove",
|
|
2344
|
+
x: e.clientX,
|
|
2345
|
+
y: e.clientY
|
|
2346
|
+
});
|
|
2411
2347
|
state.x = e.clientX;
|
|
2412
2348
|
state.y = e.clientY;
|
|
2413
2349
|
};
|
|
@@ -2420,8 +2356,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2420
2356
|
y: e.clientY,
|
|
2421
2357
|
dropOperation: $103790afe9474d1c$export$608ecc6f1b23c35d[e.dataTransfer.dropEffect]
|
|
2422
2358
|
};
|
|
2423
|
-
if ($7252cd45fc48c07c$export$8e6636520ac15722)
|
|
2424
|
-
event.dropOperation = $103790afe9474d1c$export$608ecc6f1b23c35d[$7252cd45fc48c07c$export$8e6636520ac15722];
|
|
2359
|
+
if ($7252cd45fc48c07c$export$8e6636520ac15722) event.dropOperation = $103790afe9474d1c$export$608ecc6f1b23c35d[$7252cd45fc48c07c$export$8e6636520ac15722];
|
|
2425
2360
|
options.onDragEnd(event);
|
|
2426
2361
|
}
|
|
2427
2362
|
setDragging(false);
|
|
@@ -2450,8 +2385,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2450
2385
|
state
|
|
2451
2386
|
]);
|
|
2452
2387
|
let onPress = (e) => {
|
|
2453
|
-
if (e.pointerType !== "keyboard" && e.pointerType !== "virtual")
|
|
2454
|
-
return;
|
|
2388
|
+
if (e.pointerType !== "keyboard" && e.pointerType !== "virtual") return;
|
|
2455
2389
|
startDragging(e.target);
|
|
2456
2390
|
};
|
|
2457
2391
|
let startDragging = (target) => {
|
|
@@ -2473,8 +2407,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2473
2407
|
],
|
|
2474
2408
|
onDragEnd(e) {
|
|
2475
2409
|
setDragging(false);
|
|
2476
|
-
if (typeof state.options.onDragEnd === "function")
|
|
2477
|
-
state.options.onDragEnd(e);
|
|
2410
|
+
if (typeof state.options.onDragEnd === "function") state.options.onDragEnd(e);
|
|
2478
2411
|
}
|
|
2479
2412
|
}, stringFormatter);
|
|
2480
2413
|
setDragging(true);
|
|
@@ -2498,8 +2431,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2498
2431
|
let centerY = rect.height / 2;
|
|
2499
2432
|
if (Math.abs(offsetX - centerX) <= 0.5 && Math.abs(offsetY - centerY) <= 0.5)
|
|
2500
2433
|
modalityOnPointerDown.current = "virtual";
|
|
2501
|
-
else
|
|
2502
|
-
modalityOnPointerDown.current = e.pointerType;
|
|
2434
|
+
else modalityOnPointerDown.current = e.pointerType;
|
|
2503
2435
|
}
|
|
2504
2436
|
},
|
|
2505
2437
|
onKeyDownCapture(e) {
|
|
@@ -2523,14 +2455,13 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2523
2455
|
}
|
|
2524
2456
|
}
|
|
2525
2457
|
};
|
|
2526
|
-
if (isDisabled)
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
};
|
|
2458
|
+
if (isDisabled) return {
|
|
2459
|
+
dragProps: {
|
|
2460
|
+
draggable: "false"
|
|
2461
|
+
},
|
|
2462
|
+
dragButtonProps: {},
|
|
2463
|
+
isDragging: false
|
|
2464
|
+
};
|
|
2534
2465
|
return {
|
|
2535
2466
|
dragProps: {
|
|
2536
2467
|
...interactions,
|
|
@@ -2634,10 +2565,8 @@ function $5c06e4929e123553$export$ccdee5eaf73cf661(options) {
|
|
|
2634
2565
|
}
|
|
2635
2566
|
state.allowedOperations = allowedOperations;
|
|
2636
2567
|
e.dataTransfer.dropEffect = state.dropEffect;
|
|
2637
|
-
if (state.dropEffect === "none" && prevDropEffect !== "none")
|
|
2638
|
-
|
|
2639
|
-
else if (state.dropEffect !== "none" && prevDropEffect === "none")
|
|
2640
|
-
fireDropEnter(e);
|
|
2568
|
+
if (state.dropEffect === "none" && prevDropEffect !== "none") fireDropExit(e);
|
|
2569
|
+
else if (state.dropEffect !== "none" && prevDropEffect === "none") fireDropEnter(e);
|
|
2641
2570
|
if (typeof options.onDropMove === "function" && state.dropEffect !== "none") {
|
|
2642
2571
|
let rect = e.currentTarget.getBoundingClientRect();
|
|
2643
2572
|
options.onDropMove({
|
|
@@ -2662,8 +2591,7 @@ function $5c06e4929e123553$export$ccdee5eaf73cf661(options) {
|
|
|
2662
2591
|
e.preventDefault();
|
|
2663
2592
|
e.stopPropagation();
|
|
2664
2593
|
state.dragOverElements.add(e.target);
|
|
2665
|
-
if (state.dragOverElements.size > 1)
|
|
2666
|
-
return;
|
|
2594
|
+
if (state.dragOverElements.size > 1) return;
|
|
2667
2595
|
let allowedOperationsBits = $5c06e4929e123553$var$getAllowedOperations(e);
|
|
2668
2596
|
let allowedOperations = $5c06e4929e123553$var$allowedOperationsToArray(allowedOperationsBits);
|
|
2669
2597
|
let dropOperation = allowedOperations[0];
|
|
@@ -2681,20 +2609,15 @@ function $5c06e4929e123553$export$ccdee5eaf73cf661(options) {
|
|
|
2681
2609
|
state.allowedOperations = allowedOperationsBits;
|
|
2682
2610
|
state.dropEffect = $103790afe9474d1c$export$5eacb0769d26d3b2[dropOperation] || "none";
|
|
2683
2611
|
e.dataTransfer.dropEffect = state.dropEffect;
|
|
2684
|
-
if (dropOperation !== "cancel")
|
|
2685
|
-
fireDropEnter(e);
|
|
2612
|
+
if (dropOperation !== "cancel") fireDropEnter(e);
|
|
2686
2613
|
};
|
|
2687
2614
|
let onDragLeave = (e) => {
|
|
2688
2615
|
e.preventDefault();
|
|
2689
2616
|
e.stopPropagation();
|
|
2690
2617
|
state.dragOverElements.delete(e.target);
|
|
2691
|
-
for (let element of state.dragOverElements)
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
if (state.dragOverElements.size > 0)
|
|
2695
|
-
return;
|
|
2696
|
-
if (state.dropEffect !== "none")
|
|
2697
|
-
fireDropExit(e);
|
|
2618
|
+
for (let element of state.dragOverElements) if (!e.currentTarget.contains(element)) state.dragOverElements.delete(element);
|
|
2619
|
+
if (state.dragOverElements.size > 0) return;
|
|
2620
|
+
if (state.dropEffect !== "none") fireDropExit(e);
|
|
2698
2621
|
clearTimeout(state.dropActivateTimer);
|
|
2699
2622
|
};
|
|
2700
2623
|
let onDrop = (e) => {
|
|
@@ -2720,36 +2643,29 @@ function $5c06e4929e123553$export$ccdee5eaf73cf661(options) {
|
|
|
2720
2643
|
state.dragOverElements.clear();
|
|
2721
2644
|
fireDropExit(e);
|
|
2722
2645
|
clearTimeout(state.dropActivateTimer);
|
|
2723
|
-
if (dndStateSnapshot.draggingCollectionRef == null)
|
|
2724
|
-
$7252cd45fc48c07c$export$64f52ed7349ddb84(void 0);
|
|
2646
|
+
if (dndStateSnapshot.draggingCollectionRef == null) $7252cd45fc48c07c$export$64f52ed7349ddb84(void 0);
|
|
2725
2647
|
else
|
|
2726
2648
|
$7252cd45fc48c07c$export$6c10d32b362bfa5f(dndStateSnapshot);
|
|
2727
2649
|
};
|
|
2728
2650
|
let onDropEnter = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e) => {
|
|
2729
|
-
if (typeof options.onDropEnter === "function")
|
|
2730
|
-
options.onDropEnter(e);
|
|
2651
|
+
if (typeof options.onDropEnter === "function") options.onDropEnter(e);
|
|
2731
2652
|
});
|
|
2732
2653
|
let onDropExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e) => {
|
|
2733
|
-
if (typeof options.onDropExit === "function")
|
|
2734
|
-
options.onDropExit(e);
|
|
2654
|
+
if (typeof options.onDropExit === "function") options.onDropExit(e);
|
|
2735
2655
|
});
|
|
2736
2656
|
let onDropActivate = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e) => {
|
|
2737
|
-
if (typeof options.onDropActivate === "function")
|
|
2738
|
-
options.onDropActivate(e);
|
|
2657
|
+
if (typeof options.onDropActivate === "function") options.onDropActivate(e);
|
|
2739
2658
|
});
|
|
2740
2659
|
let onKeyboardDrop = $8ae05eaa5c114e9c$export$7f54fc3180508a52((e) => {
|
|
2741
|
-
if (typeof options.onDrop === "function")
|
|
2742
|
-
options.onDrop(e);
|
|
2660
|
+
if (typeof options.onDrop === "function") options.onDrop(e);
|
|
2743
2661
|
});
|
|
2744
2662
|
let getDropOperationKeyboard = $8ae05eaa5c114e9c$export$7f54fc3180508a52((types, allowedOperations) => {
|
|
2745
|
-
if (options.getDropOperation)
|
|
2746
|
-
return options.getDropOperation(types, allowedOperations);
|
|
2663
|
+
if (options.getDropOperation) return options.getDropOperation(types, allowedOperations);
|
|
2747
2664
|
return allowedOperations[0];
|
|
2748
2665
|
});
|
|
2749
2666
|
let { ref } = options;
|
|
2750
2667
|
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
2751
|
-
if (isDisabled)
|
|
2752
|
-
return;
|
|
2668
|
+
if (isDisabled) return;
|
|
2753
2669
|
return $67560de7c78cb232$export$c28d9fb4a54e471a({
|
|
2754
2670
|
element: ref.current,
|
|
2755
2671
|
getDropOperation: getDropOperationKeyboard,
|
|
@@ -2774,14 +2690,13 @@ function $5c06e4929e123553$export$ccdee5eaf73cf661(options) {
|
|
|
2774
2690
|
onDropActivate
|
|
2775
2691
|
]);
|
|
2776
2692
|
let { dropProps } = $224594fe3e57ff1e$export$62447ad3d2ec7da6();
|
|
2777
|
-
if (isDisabled)
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
};
|
|
2693
|
+
if (isDisabled) return {
|
|
2694
|
+
dropProps: {},
|
|
2695
|
+
dropButtonProps: {
|
|
2696
|
+
isDisabled: true
|
|
2697
|
+
},
|
|
2698
|
+
isDropTarget: false
|
|
2699
|
+
};
|
|
2785
2700
|
return {
|
|
2786
2701
|
dropProps: {
|
|
2787
2702
|
...!hasDropButton && dropProps,
|
|
@@ -2798,36 +2713,25 @@ function $5c06e4929e123553$export$ccdee5eaf73cf661(options) {
|
|
|
2798
2713
|
}
|
|
2799
2714
|
function $5c06e4929e123553$var$getAllowedOperations(e) {
|
|
2800
2715
|
let allowedOperations = $103790afe9474d1c$export$9bbdfc78cf083e16[e.dataTransfer.effectAllowed];
|
|
2801
|
-
if ($7252cd45fc48c07c$export$f0130eb70b6347b8)
|
|
2802
|
-
allowedOperations &= $7252cd45fc48c07c$export$f0130eb70b6347b8;
|
|
2716
|
+
if ($7252cd45fc48c07c$export$f0130eb70b6347b8) allowedOperations &= $7252cd45fc48c07c$export$f0130eb70b6347b8;
|
|
2803
2717
|
let allowedModifiers = $103790afe9474d1c$export$60b7b4bcf3903d8e.none;
|
|
2804
2718
|
if ($c87311424ea30a05$export$9ac100e40613ea10()) {
|
|
2805
|
-
if (e.altKey)
|
|
2806
|
-
|
|
2807
|
-
if (e.
|
|
2808
|
-
allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.link;
|
|
2809
|
-
if (e.metaKey)
|
|
2810
|
-
allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.move;
|
|
2719
|
+
if (e.altKey) allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.copy;
|
|
2720
|
+
if (e.ctrlKey && !$c87311424ea30a05$export$7bef049ce92e4224()) allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.link;
|
|
2721
|
+
if (e.metaKey) allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.move;
|
|
2811
2722
|
} else {
|
|
2812
|
-
if (e.altKey)
|
|
2813
|
-
|
|
2814
|
-
if (e.
|
|
2815
|
-
allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.move;
|
|
2816
|
-
if (e.ctrlKey)
|
|
2817
|
-
allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.copy;
|
|
2723
|
+
if (e.altKey) allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.link;
|
|
2724
|
+
if (e.shiftKey) allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.move;
|
|
2725
|
+
if (e.ctrlKey) allowedModifiers |= $103790afe9474d1c$export$60b7b4bcf3903d8e.copy;
|
|
2818
2726
|
}
|
|
2819
|
-
if (allowedModifiers)
|
|
2820
|
-
return allowedOperations & allowedModifiers;
|
|
2727
|
+
if (allowedModifiers) return allowedOperations & allowedModifiers;
|
|
2821
2728
|
return allowedOperations;
|
|
2822
2729
|
}
|
|
2823
2730
|
function $5c06e4929e123553$var$allowedOperationsToArray(allowedOperationsBits) {
|
|
2824
2731
|
let allowedOperations = [];
|
|
2825
|
-
if (allowedOperationsBits & $103790afe9474d1c$export$60b7b4bcf3903d8e.move)
|
|
2826
|
-
|
|
2827
|
-
if (allowedOperationsBits & $103790afe9474d1c$export$60b7b4bcf3903d8e.
|
|
2828
|
-
allowedOperations.push("copy");
|
|
2829
|
-
if (allowedOperationsBits & $103790afe9474d1c$export$60b7b4bcf3903d8e.link)
|
|
2830
|
-
allowedOperations.push("link");
|
|
2732
|
+
if (allowedOperationsBits & $103790afe9474d1c$export$60b7b4bcf3903d8e.move) allowedOperations.push("move");
|
|
2733
|
+
if (allowedOperationsBits & $103790afe9474d1c$export$60b7b4bcf3903d8e.copy) allowedOperations.push("copy");
|
|
2734
|
+
if (allowedOperationsBits & $103790afe9474d1c$export$60b7b4bcf3903d8e.link) allowedOperations.push("link");
|
|
2831
2735
|
return allowedOperations;
|
|
2832
2736
|
}
|
|
2833
2737
|
function $5c06e4929e123553$var$getDropOperation(allowedOperations, operation) {
|
|
@@ -2865,38 +2769,28 @@ function $80d9daea3067eff3$export$6323452ca4533ed8(ref) {
|
|
|
2865
2769
|
state
|
|
2866
2770
|
]);
|
|
2867
2771
|
let scroll = useCallback(() => {
|
|
2868
|
-
if (scrollableX.current)
|
|
2869
|
-
|
|
2870
|
-
if (
|
|
2871
|
-
scrollableRef.current.scrollTop += state.dy;
|
|
2872
|
-
if (state.timer)
|
|
2873
|
-
state.timer = requestAnimationFrame(scroll);
|
|
2772
|
+
if (scrollableX.current) scrollableRef.current.scrollLeft += state.dx;
|
|
2773
|
+
if (scrollableY.current) scrollableRef.current.scrollTop += state.dy;
|
|
2774
|
+
if (state.timer) state.timer = requestAnimationFrame(scroll);
|
|
2874
2775
|
}, [
|
|
2875
2776
|
scrollableRef,
|
|
2876
2777
|
state
|
|
2877
2778
|
]);
|
|
2878
2779
|
return {
|
|
2879
2780
|
move(x, y) {
|
|
2880
|
-
if (!$c87311424ea30a05$export$78551043582a6a98() || $c87311424ea30a05$export$fedb369cb70207f1() || !scrollableRef.current)
|
|
2881
|
-
return;
|
|
2781
|
+
if (!$c87311424ea30a05$export$78551043582a6a98() || $c87311424ea30a05$export$fedb369cb70207f1() || !scrollableRef.current) return;
|
|
2882
2782
|
let box = scrollableRef.current.getBoundingClientRect();
|
|
2883
2783
|
let left = $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
|
|
2884
2784
|
let top = $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
|
|
2885
2785
|
let bottom = box.height - $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
|
|
2886
2786
|
let right = box.width - $80d9daea3067eff3$var$AUTOSCROLL_AREA_SIZE;
|
|
2887
2787
|
if (x < left || x > right || y < top || y > bottom) {
|
|
2888
|
-
if (x < left)
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
if (
|
|
2893
|
-
|
|
2894
|
-
else if (y > bottom)
|
|
2895
|
-
state.dy = y - bottom;
|
|
2896
|
-
if (!state.timer)
|
|
2897
|
-
state.timer = requestAnimationFrame(scroll);
|
|
2898
|
-
} else
|
|
2899
|
-
this.stop();
|
|
2788
|
+
if (x < left) state.dx = x - left;
|
|
2789
|
+
else if (x > right) state.dx = x - right;
|
|
2790
|
+
if (y < top) state.dy = y - top;
|
|
2791
|
+
else if (y > bottom) state.dy = y - bottom;
|
|
2792
|
+
if (!state.timer) state.timer = requestAnimationFrame(scroll);
|
|
2793
|
+
} else this.stop();
|
|
2900
2794
|
},
|
|
2901
2795
|
stop() {
|
|
2902
2796
|
if (state.timer) {
|
|
@@ -2931,51 +2825,43 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
2931
2825
|
let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
|
|
2932
2826
|
let { target, dropOperation, items } = e;
|
|
2933
2827
|
let filteredItems = items;
|
|
2934
|
-
if (acceptedDragTypes !== "all" || shouldAcceptItemDrop)
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
return true;
|
|
2949
|
-
}
|
|
2950
|
-
return false;
|
|
2951
|
-
});
|
|
2828
|
+
if (acceptedDragTypes !== "all" || shouldAcceptItemDrop) filteredItems = items.filter((item) => {
|
|
2829
|
+
let itemTypes;
|
|
2830
|
+
if (item.kind === "directory") itemTypes = /* @__PURE__ */ new Set([
|
|
2831
|
+
$7252cd45fc48c07c$export$990fced5dfac2637
|
|
2832
|
+
]);
|
|
2833
|
+
else itemTypes = item.kind === "file" ? /* @__PURE__ */ new Set([
|
|
2834
|
+
item.type
|
|
2835
|
+
]) : item.types;
|
|
2836
|
+
if (acceptedDragTypes === "all" || acceptedDragTypes.some((type) => itemTypes.has(type))) {
|
|
2837
|
+
if (target.type === "item" && target.dropPosition === "on" && shouldAcceptItemDrop) return shouldAcceptItemDrop(target, itemTypes);
|
|
2838
|
+
return true;
|
|
2839
|
+
}
|
|
2840
|
+
return false;
|
|
2841
|
+
});
|
|
2952
2842
|
if (filteredItems.length > 0) {
|
|
2953
|
-
if (target.type === "root" && onRootDrop)
|
|
2954
|
-
|
|
2843
|
+
if (target.type === "root" && onRootDrop) await onRootDrop({
|
|
2844
|
+
items: filteredItems,
|
|
2845
|
+
dropOperation
|
|
2846
|
+
});
|
|
2847
|
+
if (target.type === "item") {
|
|
2848
|
+
if (target.dropPosition === "on" && onItemDrop) await onItemDrop({
|
|
2955
2849
|
items: filteredItems,
|
|
2956
|
-
dropOperation
|
|
2850
|
+
dropOperation,
|
|
2851
|
+
isInternal,
|
|
2852
|
+
target
|
|
2957
2853
|
});
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
await onItemDrop({
|
|
2854
|
+
if (target.dropPosition !== "on") {
|
|
2855
|
+
if (!isInternal && onInsert) await onInsert({
|
|
2961
2856
|
items: filteredItems,
|
|
2962
2857
|
dropOperation,
|
|
2963
|
-
isInternal,
|
|
2964
2858
|
target
|
|
2965
2859
|
});
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
target
|
|
2972
|
-
});
|
|
2973
|
-
if (isInternal && onReorder)
|
|
2974
|
-
await onReorder({
|
|
2975
|
-
keys: draggingKeys,
|
|
2976
|
-
dropOperation,
|
|
2977
|
-
target
|
|
2978
|
-
});
|
|
2860
|
+
if (isInternal && onReorder) await onReorder({
|
|
2861
|
+
keys: draggingKeys,
|
|
2862
|
+
dropOperation,
|
|
2863
|
+
target
|
|
2864
|
+
});
|
|
2979
2865
|
}
|
|
2980
2866
|
}
|
|
2981
2867
|
}
|
|
@@ -3032,8 +2918,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3032
2918
|
localState.dropOperation = dropOperation;
|
|
3033
2919
|
}
|
|
3034
2920
|
}
|
|
3035
|
-
if (target && localState.dropOperation !== "cancel" && (ref === null || ref === void 0 ? void 0 : ref.current) !== (dropCollectionRef === null || dropCollectionRef === void 0 ? void 0 : dropCollectionRef.current))
|
|
3036
|
-
$7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
|
|
2921
|
+
if (target && localState.dropOperation !== "cancel" && (ref === null || ref === void 0 ? void 0 : ref.current) !== (dropCollectionRef === null || dropCollectionRef === void 0 ? void 0 : dropCollectionRef.current)) $7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
|
|
3037
2922
|
localState.nextTarget = localState.dropOperation === "cancel" ? null : target;
|
|
3038
2923
|
return localState.dropOperation;
|
|
3039
2924
|
},
|
|
@@ -3044,21 +2929,18 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3044
2929
|
},
|
|
3045
2930
|
onDropActivate(e) {
|
|
3046
2931
|
var _state_target, _state_target1;
|
|
3047
|
-
if (((_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.type) === "item" && ((_state_target1 = state.target) === null || _state_target1 === void 0 ? void 0 : _state_target1.dropPosition) === "on" && typeof props.onDropActivate === "function")
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
});
|
|
2932
|
+
if (((_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.type) === "item" && ((_state_target1 = state.target) === null || _state_target1 === void 0 ? void 0 : _state_target1.dropPosition) === "on" && typeof props.onDropActivate === "function") props.onDropActivate({
|
|
2933
|
+
type: "dropactivate",
|
|
2934
|
+
x: e.x,
|
|
2935
|
+
y: e.y,
|
|
2936
|
+
target: state.target
|
|
2937
|
+
});
|
|
3054
2938
|
},
|
|
3055
2939
|
onDrop(e) {
|
|
3056
2940
|
$7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
|
|
3057
|
-
if (state.target)
|
|
3058
|
-
onDrop(e, state.target);
|
|
2941
|
+
if (state.target) onDrop(e, state.target);
|
|
3059
2942
|
let { draggingCollectionRef } = $7252cd45fc48c07c$export$6ca6700462636d0b;
|
|
3060
|
-
if (draggingCollectionRef == null)
|
|
3061
|
-
$7252cd45fc48c07c$export$70936501603e6c57();
|
|
2943
|
+
if (draggingCollectionRef == null) $7252cd45fc48c07c$export$70936501603e6c57();
|
|
3062
2944
|
}
|
|
3063
2945
|
});
|
|
3064
2946
|
let droppingState = useRef(null);
|
|
@@ -3092,8 +2974,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3092
2974
|
state3.selectionManager.setFocusedKey(target.key);
|
|
3093
2975
|
state3.selectionManager.setFocused(true);
|
|
3094
2976
|
$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
3095
|
-
} else if (!state3.selectionManager.isSelected(focusedKey))
|
|
3096
|
-
$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
2977
|
+
} else if (!state3.selectionManager.isSelected(focusedKey)) $507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
3097
2978
|
droppingState.current = null;
|
|
3098
2979
|
}, 50);
|
|
3099
2980
|
}, [
|
|
@@ -3102,25 +2983,20 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3102
2983
|
]);
|
|
3103
2984
|
useEffect(() => {
|
|
3104
2985
|
return () => {
|
|
3105
|
-
if (droppingState.current)
|
|
3106
|
-
clearTimeout(droppingState.current.timeout);
|
|
2986
|
+
if (droppingState.current) clearTimeout(droppingState.current.timeout);
|
|
3107
2987
|
};
|
|
3108
2988
|
}, []);
|
|
3109
2989
|
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
3110
2990
|
if (droppingState.current && state.selectionManager.isFocused && state.collection.size > droppingState.current.collection.size && state.selectionManager.isSelectionEqual(droppingState.current.selectedKeys)) {
|
|
3111
2991
|
let newKeys = /* @__PURE__ */ new Set();
|
|
3112
|
-
for (let key of state.collection.getKeys())
|
|
3113
|
-
if (!droppingState.current.collection.getItem(key))
|
|
3114
|
-
newKeys.add(key);
|
|
2992
|
+
for (let key of state.collection.getKeys()) if (!droppingState.current.collection.getItem(key)) newKeys.add(key);
|
|
3115
2993
|
state.selectionManager.setSelectedKeys(newKeys);
|
|
3116
2994
|
if (state.selectionManager.focusedKey === droppingState.current.focusedKey) {
|
|
3117
2995
|
let first = newKeys.keys().next().value;
|
|
3118
2996
|
let item = state.collection.getItem(first);
|
|
3119
|
-
if ((item === null || item === void 0 ? void 0 : item.type) === "cell")
|
|
3120
|
-
first = item.parentKey;
|
|
2997
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === "cell") first = item.parentKey;
|
|
3121
2998
|
state.selectionManager.setFocusedKey(first);
|
|
3122
|
-
if (state.selectionManager.selectionMode === "none")
|
|
3123
|
-
$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
2999
|
+
if (state.selectionManager.selectionMode === "none") $507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
|
|
3124
3000
|
}
|
|
3125
3001
|
droppingState.current = null;
|
|
3126
3002
|
}
|
|
@@ -3128,16 +3004,13 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3128
3004
|
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
3129
3005
|
useEffect(() => {
|
|
3130
3006
|
let getNextTarget = (target, wrap = true, horizontal = false) => {
|
|
3131
|
-
if (!target)
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
};
|
|
3007
|
+
if (!target) return {
|
|
3008
|
+
type: "root"
|
|
3009
|
+
};
|
|
3135
3010
|
let { keyboardDelegate } = localState.props;
|
|
3136
3011
|
let nextKey;
|
|
3137
|
-
if ((target === null || target === void 0 ? void 0 : target.type) === "item")
|
|
3138
|
-
|
|
3139
|
-
else
|
|
3140
|
-
nextKey = horizontal && direction === "rtl" ? keyboardDelegate.getLastKey() : keyboardDelegate.getFirstKey();
|
|
3012
|
+
if ((target === null || target === void 0 ? void 0 : target.type) === "item") nextKey = horizontal ? keyboardDelegate.getKeyRightOf(target.key) : keyboardDelegate.getKeyBelow(target.key);
|
|
3013
|
+
else nextKey = horizontal && direction === "rtl" ? keyboardDelegate.getLastKey() : keyboardDelegate.getFirstKey();
|
|
3141
3014
|
let dropPositions = horizontal && direction === "rtl" ? $4b52e4eff84e5217$var$DROP_POSITIONS_RTL : $4b52e4eff84e5217$var$DROP_POSITIONS;
|
|
3142
3015
|
let dropPosition = dropPositions[0];
|
|
3143
3016
|
if (target.type === "item") {
|
|
@@ -3145,22 +3018,18 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3145
3018
|
if (nextKey == null || nextKey === nextCollectionKey) {
|
|
3146
3019
|
let positionIndex = dropPositions.indexOf(target.dropPosition);
|
|
3147
3020
|
let nextDropPosition = dropPositions[positionIndex + 1];
|
|
3148
|
-
if (positionIndex < dropPositions.length - 1 && !(nextDropPosition === dropPositions[2] && nextKey != null))
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
dropPosition = "on";
|
|
3156
|
-
} else
|
|
3157
|
-
dropPosition = target.dropPosition;
|
|
3021
|
+
if (positionIndex < dropPositions.length - 1 && !(nextDropPosition === dropPositions[2] && nextKey != null)) return {
|
|
3022
|
+
type: "item",
|
|
3023
|
+
key: target.key,
|
|
3024
|
+
dropPosition: nextDropPosition
|
|
3025
|
+
};
|
|
3026
|
+
if (target.dropPosition === dropPositions[2]) dropPosition = "on";
|
|
3027
|
+
} else dropPosition = target.dropPosition;
|
|
3158
3028
|
}
|
|
3159
3029
|
if (nextKey == null) {
|
|
3160
|
-
if (wrap)
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
};
|
|
3030
|
+
if (wrap) return {
|
|
3031
|
+
type: "root"
|
|
3032
|
+
};
|
|
3164
3033
|
return null;
|
|
3165
3034
|
}
|
|
3166
3035
|
return {
|
|
@@ -3172,10 +3041,8 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3172
3041
|
let getPreviousTarget = (target, wrap = true, horizontal = false) => {
|
|
3173
3042
|
let { keyboardDelegate } = localState.props;
|
|
3174
3043
|
let nextKey;
|
|
3175
|
-
if ((target === null || target === void 0 ? void 0 : target.type) === "item")
|
|
3176
|
-
|
|
3177
|
-
else
|
|
3178
|
-
nextKey = horizontal && direction === "rtl" ? keyboardDelegate.getFirstKey() : keyboardDelegate.getLastKey();
|
|
3044
|
+
if ((target === null || target === void 0 ? void 0 : target.type) === "item") nextKey = horizontal ? keyboardDelegate.getKeyLeftOf(target.key) : keyboardDelegate.getKeyAbove(target.key);
|
|
3045
|
+
else nextKey = horizontal && direction === "rtl" ? keyboardDelegate.getFirstKey() : keyboardDelegate.getLastKey();
|
|
3179
3046
|
let dropPositions = horizontal && direction === "rtl" ? $4b52e4eff84e5217$var$DROP_POSITIONS_RTL : $4b52e4eff84e5217$var$DROP_POSITIONS;
|
|
3180
3047
|
let dropPosition = !target || target.type === "root" ? dropPositions[2] : "on";
|
|
3181
3048
|
if ((target === null || target === void 0 ? void 0 : target.type) === "item") {
|
|
@@ -3183,22 +3050,18 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3183
3050
|
if (nextKey == null || nextKey === prevCollectionKey) {
|
|
3184
3051
|
let positionIndex = dropPositions.indexOf(target.dropPosition);
|
|
3185
3052
|
let nextDropPosition = dropPositions[positionIndex - 1];
|
|
3186
|
-
if (positionIndex > 0 && nextDropPosition !== dropPositions[2])
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
dropPosition = "on";
|
|
3194
|
-
} else
|
|
3195
|
-
dropPosition = target.dropPosition;
|
|
3053
|
+
if (positionIndex > 0 && nextDropPosition !== dropPositions[2]) return {
|
|
3054
|
+
type: "item",
|
|
3055
|
+
key: target.key,
|
|
3056
|
+
dropPosition: nextDropPosition
|
|
3057
|
+
};
|
|
3058
|
+
if (target.dropPosition === dropPositions[0]) dropPosition = "on";
|
|
3059
|
+
} else dropPosition = target.dropPosition;
|
|
3196
3060
|
}
|
|
3197
3061
|
if (nextKey == null) {
|
|
3198
|
-
if (wrap)
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
};
|
|
3062
|
+
if (wrap) return {
|
|
3063
|
+
type: "root"
|
|
3064
|
+
};
|
|
3202
3065
|
return null;
|
|
3203
3066
|
}
|
|
3204
3067
|
return {
|
|
@@ -3214,8 +3077,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3214
3077
|
let isInternal = $7252cd45fc48c07c$export$78bf638634500fa5(ref);
|
|
3215
3078
|
do {
|
|
3216
3079
|
let nextTarget = getNextTarget2(target, wrap);
|
|
3217
|
-
if (!nextTarget)
|
|
3218
|
-
return null;
|
|
3080
|
+
if (!nextTarget) return null;
|
|
3219
3081
|
target = nextTarget;
|
|
3220
3082
|
operation = localState.state.getDropOperation({
|
|
3221
3083
|
target: nextTarget,
|
|
@@ -3224,11 +3086,9 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3224
3086
|
isInternal,
|
|
3225
3087
|
draggingKeys
|
|
3226
3088
|
});
|
|
3227
|
-
if (target.type === "root")
|
|
3228
|
-
seenRoot++;
|
|
3089
|
+
if (target.type === "root") seenRoot++;
|
|
3229
3090
|
} while (operation === "cancel" && !localState.state.isDropTarget(target) && seenRoot < 2);
|
|
3230
|
-
if (operation === "cancel")
|
|
3231
|
-
return null;
|
|
3091
|
+
if (operation === "cancel") return null;
|
|
3232
3092
|
return target;
|
|
3233
3093
|
};
|
|
3234
3094
|
return $67560de7c78cb232$export$c28d9fb4a54e471a({
|
|
@@ -3256,13 +3116,10 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3256
3116
|
let key = selectionManager.focusedKey;
|
|
3257
3117
|
let dropPosition = "after";
|
|
3258
3118
|
let item = localState.state.collection.getItem(key);
|
|
3259
|
-
if ((item === null || item === void 0 ? void 0 : item.type) === "cell")
|
|
3260
|
-
key = item.parentKey;
|
|
3119
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === "cell") key = item.parentKey;
|
|
3261
3120
|
if (selectionManager.isSelected(key)) {
|
|
3262
|
-
if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key)
|
|
3263
|
-
|
|
3264
|
-
else
|
|
3265
|
-
key = selectionManager.lastSelectedKey;
|
|
3121
|
+
if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) dropPosition = "before";
|
|
3122
|
+
else key = selectionManager.lastSelectedKey;
|
|
3266
3123
|
}
|
|
3267
3124
|
if (key != null) {
|
|
3268
3125
|
target = {
|
|
@@ -3279,11 +3136,9 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3279
3136
|
allowedOperations: drag.allowedDropOperations,
|
|
3280
3137
|
isInternal,
|
|
3281
3138
|
draggingKeys
|
|
3282
|
-
}) === "cancel")
|
|
3283
|
-
target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3139
|
+
}) === "cancel") target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3284
3140
|
}
|
|
3285
|
-
if (!target)
|
|
3286
|
-
target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
3141
|
+
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
3287
3142
|
localState.state.setTarget(target);
|
|
3288
3143
|
},
|
|
3289
3144
|
onDropExit() {
|
|
@@ -3295,18 +3150,16 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3295
3150
|
},
|
|
3296
3151
|
onDropActivate(e) {
|
|
3297
3152
|
var _localState_state_target, _localState_state_target1;
|
|
3298
|
-
if (((_localState_state_target = localState.state.target) === null || _localState_state_target === void 0 ? void 0 : _localState_state_target.type) === "item" && ((_localState_state_target1 = localState.state.target) === null || _localState_state_target1 === void 0 ? void 0 : _localState_state_target1.dropPosition) === "on" && typeof localState.props.onDropActivate === "function")
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
});
|
|
3153
|
+
if (((_localState_state_target = localState.state.target) === null || _localState_state_target === void 0 ? void 0 : _localState_state_target.type) === "item" && ((_localState_state_target1 = localState.state.target) === null || _localState_state_target1 === void 0 ? void 0 : _localState_state_target1.dropPosition) === "on" && typeof localState.props.onDropActivate === "function") localState.props.onDropActivate({
|
|
3154
|
+
type: "dropactivate",
|
|
3155
|
+
x: e.x,
|
|
3156
|
+
y: e.y,
|
|
3157
|
+
target: localState.state.target
|
|
3158
|
+
});
|
|
3305
3159
|
},
|
|
3306
3160
|
onDrop(e, target) {
|
|
3307
3161
|
$7252cd45fc48c07c$export$dac8db29d42db9a1(ref);
|
|
3308
|
-
if (localState.state.target)
|
|
3309
|
-
onDrop(e, target || localState.state.target);
|
|
3162
|
+
if (localState.state.target) onDrop(e, target || localState.state.target);
|
|
3310
3163
|
},
|
|
3311
3164
|
onKeyDown(e, drag) {
|
|
3312
3165
|
let { keyboardDelegate } = localState.props;
|
|
@@ -3351,8 +3204,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3351
3204
|
case "PageDown":
|
|
3352
3205
|
if (keyboardDelegate.getKeyPageBelow) {
|
|
3353
3206
|
let target = localState.state.target;
|
|
3354
|
-
if (!target)
|
|
3355
|
-
target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
3207
|
+
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
3356
3208
|
else {
|
|
3357
3209
|
let nextKey = keyboardDelegate.getKeyPageBelow(target.type === "item" ? target.key : keyboardDelegate.getFirstKey());
|
|
3358
3210
|
let dropPosition = target.type === "item" ? target.dropPosition : "after";
|
|
@@ -3375,23 +3227,19 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3375
3227
|
draggingKeys
|
|
3376
3228
|
});
|
|
3377
3229
|
var _nextValidTarget;
|
|
3378
|
-
if (operation === "cancel")
|
|
3379
|
-
target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3230
|
+
if (operation === "cancel") target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3380
3231
|
}
|
|
3381
3232
|
localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
|
|
3382
3233
|
}
|
|
3383
3234
|
break;
|
|
3384
3235
|
case "PageUp": {
|
|
3385
|
-
if (!keyboardDelegate.getKeyPageAbove)
|
|
3386
|
-
break;
|
|
3236
|
+
if (!keyboardDelegate.getKeyPageAbove) break;
|
|
3387
3237
|
let target = localState.state.target;
|
|
3388
|
-
if (!target)
|
|
3389
|
-
target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
|
|
3238
|
+
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);
|
|
3390
3239
|
else if (target.type === "item") {
|
|
3391
|
-
if (target.key === keyboardDelegate.getFirstKey())
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
};
|
|
3240
|
+
if (target.key === keyboardDelegate.getFirstKey()) target = {
|
|
3241
|
+
type: "root"
|
|
3242
|
+
};
|
|
3395
3243
|
else {
|
|
3396
3244
|
let nextKey = keyboardDelegate.getKeyPageAbove(target.key);
|
|
3397
3245
|
let dropPosition = target.dropPosition;
|
|
@@ -3415,8 +3263,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3415
3263
|
draggingKeys
|
|
3416
3264
|
});
|
|
3417
3265
|
var _nextValidTarget1;
|
|
3418
|
-
if (operation === "cancel")
|
|
3419
|
-
target = (_nextValidTarget1 = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && _nextValidTarget1 !== void 0 ? _nextValidTarget1 : nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);
|
|
3266
|
+
if (operation === "cancel") target = (_nextValidTarget1 = nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && _nextValidTarget1 !== void 0 ? _nextValidTarget1 : nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);
|
|
3420
3267
|
}
|
|
3421
3268
|
localState.state.setTarget(target !== null && target !== void 0 ? target : localState.state.target);
|
|
3422
3269
|
break;
|
|
@@ -3448,22 +3295,21 @@ function $bfaab576ce1c580e$export$f7b0c5d28b66b6a5(options, state, ref) {
|
|
|
3448
3295
|
let { dropProps } = $224594fe3e57ff1e$export$62447ad3d2ec7da6();
|
|
3449
3296
|
let droppableCollectionRef = $7252cd45fc48c07c$export$7e397efd01d3db27(state);
|
|
3450
3297
|
useEffect(() => {
|
|
3451
|
-
if (ref.current)
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
});
|
|
3298
|
+
if (ref.current) return $67560de7c78cb232$export$aef80212ac99c003({
|
|
3299
|
+
element: ref.current,
|
|
3300
|
+
target: options.target,
|
|
3301
|
+
getDropOperation(types, allowedOperations) {
|
|
3302
|
+
let { draggingKeys: draggingKeys2 } = $7252cd45fc48c07c$export$6ca6700462636d0b;
|
|
3303
|
+
let isInternal2 = $7252cd45fc48c07c$export$78bf638634500fa5(droppableCollectionRef);
|
|
3304
|
+
return state.getDropOperation({
|
|
3305
|
+
target: options.target,
|
|
3306
|
+
types,
|
|
3307
|
+
allowedOperations,
|
|
3308
|
+
isInternal: isInternal2,
|
|
3309
|
+
draggingKeys: draggingKeys2
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
3312
|
+
});
|
|
3467
3313
|
}, [
|
|
3468
3314
|
ref,
|
|
3469
3315
|
options.target,
|
|
@@ -3482,8 +3328,7 @@ function $bfaab576ce1c580e$export$f7b0c5d28b66b6a5(options, state, ref) {
|
|
|
3482
3328
|
}) !== "cancel";
|
|
3483
3329
|
let isDropTarget = state.isDropTarget(options.target);
|
|
3484
3330
|
useEffect(() => {
|
|
3485
|
-
if (dragSession && isDropTarget && ref.current)
|
|
3486
|
-
ref.current.focus();
|
|
3331
|
+
if (dragSession && isDropTarget && ref.current) ref.current.focus();
|
|
3487
3332
|
}, [
|
|
3488
3333
|
isDropTarget,
|
|
3489
3334
|
dragSession,
|
|
@@ -3517,34 +3362,26 @@ function $ddf25448c71fc93a$export$8d0e41d2815afac5(props, state, ref) {
|
|
|
3517
3362
|
if (target.type === "root") {
|
|
3518
3363
|
label = stringFormatter.format("dropOnRoot");
|
|
3519
3364
|
labelledBy = `${id} ${$7252cd45fc48c07c$export$3093291712f09a77(state)}`;
|
|
3520
|
-
} else if (target.dropPosition === "on")
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
});
|
|
3365
|
+
} else if (target.dropPosition === "on") label = stringFormatter.format("dropOnItem", {
|
|
3366
|
+
itemText: getText(target.key)
|
|
3367
|
+
});
|
|
3524
3368
|
else {
|
|
3525
3369
|
let before;
|
|
3526
3370
|
let after;
|
|
3527
|
-
if (collection.getFirstKey() === target.key && target.dropPosition === "before")
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
if (
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
if (before
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
label = stringFormatter.format("insertAfter", {
|
|
3542
|
-
itemText: getText(before)
|
|
3543
|
-
});
|
|
3544
|
-
else if (after)
|
|
3545
|
-
label = stringFormatter.format("insertBefore", {
|
|
3546
|
-
itemText: getText(after)
|
|
3547
|
-
});
|
|
3371
|
+
if (collection.getFirstKey() === target.key && target.dropPosition === "before") before = null;
|
|
3372
|
+
else before = target.dropPosition === "before" ? collection.getKeyBefore(target.key) : target.key;
|
|
3373
|
+
if (collection.getLastKey() === target.key && target.dropPosition === "after") after = null;
|
|
3374
|
+
else after = target.dropPosition === "after" ? collection.getKeyAfter(target.key) : target.key;
|
|
3375
|
+
if (before && after) label = stringFormatter.format("insertBetween", {
|
|
3376
|
+
beforeItemText: getText(before),
|
|
3377
|
+
afterItemText: getText(after)
|
|
3378
|
+
});
|
|
3379
|
+
else if (before) label = stringFormatter.format("insertAfter", {
|
|
3380
|
+
itemText: getText(before)
|
|
3381
|
+
});
|
|
3382
|
+
else if (after) label = stringFormatter.format("insertBefore", {
|
|
3383
|
+
itemText: getText(after)
|
|
3384
|
+
});
|
|
3548
3385
|
}
|
|
3549
3386
|
let isDropTarget = state.isDropTarget(target);
|
|
3550
3387
|
let ariaHidden = !dragSession ? "true" : dropProps["aria-hidden"];
|
|
@@ -3618,19 +3455,15 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
|
|
|
3618
3455
|
let modality = $7252cd45fc48c07c$export$49bac5d6d4b352ea();
|
|
3619
3456
|
if (!props.hasDragButton && state.selectionManager.selectionMode !== "none") {
|
|
3620
3457
|
let msg = $fd98cf7cbf233429$var$MESSAGES[modality][isSelected ? "selected" : "notSelected"];
|
|
3621
|
-
if (props.hasAction && modality === "keyboard")
|
|
3622
|
-
|
|
3623
|
-
if (isSelected)
|
|
3624
|
-
description = stringFormatter.format(msg, {
|
|
3625
|
-
count: numKeysForDrag
|
|
3626
|
-
});
|
|
3627
|
-
else
|
|
3628
|
-
description = stringFormatter.format(msg);
|
|
3629
|
-
delete dragProps.onClick;
|
|
3630
|
-
} else if (isSelected)
|
|
3631
|
-
dragButtonLabel = stringFormatter.format("dragSelectedItems", {
|
|
3458
|
+
if (props.hasAction && modality === "keyboard") msg += "Alt";
|
|
3459
|
+
if (isSelected) description = stringFormatter.format(msg, {
|
|
3632
3460
|
count: numKeysForDrag
|
|
3633
3461
|
});
|
|
3462
|
+
else description = stringFormatter.format(msg);
|
|
3463
|
+
delete dragProps.onClick;
|
|
3464
|
+
} else if (isSelected) dragButtonLabel = stringFormatter.format("dragSelectedItems", {
|
|
3465
|
+
count: numKeysForDrag
|
|
3466
|
+
});
|
|
3634
3467
|
else {
|
|
3635
3468
|
var _state_collection_getTextValue, _state_collection;
|
|
3636
3469
|
var _state_collection_getTextValue1, _ref;
|
|
@@ -3640,19 +3473,16 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
|
|
|
3640
3473
|
});
|
|
3641
3474
|
}
|
|
3642
3475
|
let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(description);
|
|
3643
|
-
if (description)
|
|
3644
|
-
Object.assign(dragProps, descriptionProps);
|
|
3476
|
+
if (description) Object.assign(dragProps, descriptionProps);
|
|
3645
3477
|
if (!props.hasDragButton && props.hasAction) {
|
|
3646
3478
|
let { onKeyDownCapture, onKeyUpCapture } = dragProps;
|
|
3647
3479
|
if (modality === "touch")
|
|
3648
3480
|
delete dragProps["aria-describedby"];
|
|
3649
3481
|
dragProps.onKeyDownCapture = (e) => {
|
|
3650
|
-
if (e.altKey)
|
|
3651
|
-
onKeyDownCapture === null || onKeyDownCapture === void 0 ? void 0 : onKeyDownCapture(e);
|
|
3482
|
+
if (e.altKey) onKeyDownCapture === null || onKeyDownCapture === void 0 ? void 0 : onKeyDownCapture(e);
|
|
3652
3483
|
};
|
|
3653
3484
|
dragProps.onKeyUpCapture = (e) => {
|
|
3654
|
-
if (e.altKey)
|
|
3655
|
-
onKeyUpCapture === null || onKeyUpCapture === void 0 ? void 0 : onKeyUpCapture(e);
|
|
3485
|
+
if (e.altKey) onKeyUpCapture === null || onKeyUpCapture === void 0 ? void 0 : onKeyUpCapture(e);
|
|
3656
3486
|
};
|
|
3657
3487
|
}
|
|
3658
3488
|
return {
|
|
@@ -3666,8 +3496,7 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
|
|
|
3666
3496
|
}
|
|
3667
3497
|
function $4ac1fdc3a0fcd564$export$2962a7984b2f0a80(props, state, ref) {
|
|
3668
3498
|
let { draggingCollectionRef } = $7252cd45fc48c07c$export$6ca6700462636d0b;
|
|
3669
|
-
if (state.draggingKeys.size > 0 && (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) !== ref.current)
|
|
3670
|
-
$7252cd45fc48c07c$export$f2be18a910c0caa6(ref);
|
|
3499
|
+
if (state.draggingKeys.size > 0 && (draggingCollectionRef === null || draggingCollectionRef === void 0 ? void 0 : draggingCollectionRef.current) !== ref.current) $7252cd45fc48c07c$export$f2be18a910c0caa6(ref);
|
|
3671
3500
|
}
|
|
3672
3501
|
function $ad0e3f3d9c50e4ba$var$DragPreview(props, ref) {
|
|
3673
3502
|
let render = props.children;
|
|
@@ -3684,8 +3513,7 @@ function $ad0e3f3d9c50e4ba$var$DragPreview(props, ref) {
|
|
|
3684
3513
|
}, [
|
|
3685
3514
|
render
|
|
3686
3515
|
]);
|
|
3687
|
-
if (!children)
|
|
3688
|
-
return null;
|
|
3516
|
+
if (!children) return null;
|
|
3689
3517
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
3690
3518
|
style: {
|
|
3691
3519
|
zIndex: -100,
|
|
@@ -3720,10 +3548,9 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
3720
3548
|
return this.getFlowEnd(rect) - this.getFlowStart(rect);
|
|
3721
3549
|
}
|
|
3722
3550
|
getDropTargetFromPoint(x, y, isValidDropTarget) {
|
|
3723
|
-
if (this.collection.size === 0)
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
};
|
|
3551
|
+
if (this.collection.size === 0) return {
|
|
3552
|
+
type: "root"
|
|
3553
|
+
};
|
|
3727
3554
|
let rect = this.ref.current.getBoundingClientRect();
|
|
3728
3555
|
let primary = this.orientation === "horizontal" ? x : y;
|
|
3729
3556
|
let secondary = this.orientation === "horizontal" ? y : x;
|
|
@@ -3735,9 +3562,7 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
3735
3562
|
let isFlowRTL = this.layout === "stack" ? isPrimaryRTL : isSecondaryRTL;
|
|
3736
3563
|
let elements = this.ref.current.querySelectorAll("[data-key]");
|
|
3737
3564
|
let elementMap = /* @__PURE__ */ new Map();
|
|
3738
|
-
for (let item2 of elements)
|
|
3739
|
-
if (item2 instanceof HTMLElement)
|
|
3740
|
-
elementMap.set(item2.dataset.key, item2);
|
|
3565
|
+
for (let item2 of elements) if (item2 instanceof HTMLElement) elementMap.set(item2.dataset.key, item2);
|
|
3741
3566
|
let items = [
|
|
3742
3567
|
...this.collection
|
|
3743
3568
|
];
|
|
@@ -3749,19 +3574,13 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
3749
3574
|
let element2 = elementMap.get(String(item2.key));
|
|
3750
3575
|
let rect2 = element2.getBoundingClientRect();
|
|
3751
3576
|
let update = (isGreater) => {
|
|
3752
|
-
if (isGreater)
|
|
3753
|
-
|
|
3754
|
-
else
|
|
3755
|
-
high = mid;
|
|
3577
|
+
if (isGreater) low = mid + 1;
|
|
3578
|
+
else high = mid;
|
|
3756
3579
|
};
|
|
3757
|
-
if (primary < this.getPrimaryStart(rect2))
|
|
3758
|
-
|
|
3759
|
-
else if (
|
|
3760
|
-
|
|
3761
|
-
else if (secondary < this.getSecondaryStart(rect2))
|
|
3762
|
-
update(isSecondaryRTL);
|
|
3763
|
-
else if (secondary > this.getSecondaryEnd(rect2))
|
|
3764
|
-
update(!isSecondaryRTL);
|
|
3580
|
+
if (primary < this.getPrimaryStart(rect2)) update(isPrimaryRTL);
|
|
3581
|
+
else if (primary > this.getPrimaryEnd(rect2)) update(!isPrimaryRTL);
|
|
3582
|
+
else if (secondary < this.getSecondaryStart(rect2)) update(isSecondaryRTL);
|
|
3583
|
+
else if (secondary > this.getSecondaryEnd(rect2)) update(!isSecondaryRTL);
|
|
3765
3584
|
else {
|
|
3766
3585
|
let target = {
|
|
3767
3586
|
type: "item",
|
|
@@ -3772,25 +3591,21 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
3772
3591
|
if (flow <= this.getFlowStart(rect2) + 5 && isValidDropTarget({
|
|
3773
3592
|
...target,
|
|
3774
3593
|
dropPosition: "before"
|
|
3775
|
-
}))
|
|
3776
|
-
target.dropPosition = isFlowRTL ? "after" : "before";
|
|
3594
|
+
})) target.dropPosition = isFlowRTL ? "after" : "before";
|
|
3777
3595
|
else if (flow >= this.getFlowEnd(rect2) - 5 && isValidDropTarget({
|
|
3778
3596
|
...target,
|
|
3779
3597
|
dropPosition: "after"
|
|
3780
|
-
}))
|
|
3781
|
-
target.dropPosition = isFlowRTL ? "before" : "after";
|
|
3598
|
+
})) target.dropPosition = isFlowRTL ? "before" : "after";
|
|
3782
3599
|
} else {
|
|
3783
3600
|
let mid2 = this.getFlowStart(rect2) + this.getFlowSize(rect2) / 2;
|
|
3784
3601
|
if (flow <= mid2 && isValidDropTarget({
|
|
3785
3602
|
...target,
|
|
3786
3603
|
dropPosition: "before"
|
|
3787
|
-
}))
|
|
3788
|
-
target.dropPosition = isFlowRTL ? "after" : "before";
|
|
3604
|
+
})) target.dropPosition = isFlowRTL ? "after" : "before";
|
|
3789
3605
|
else if (flow >= mid2 && isValidDropTarget({
|
|
3790
3606
|
...target,
|
|
3791
3607
|
dropPosition: "after"
|
|
3792
|
-
}))
|
|
3793
|
-
target.dropPosition = isFlowRTL ? "before" : "after";
|
|
3608
|
+
})) target.dropPosition = isFlowRTL ? "before" : "after";
|
|
3794
3609
|
}
|
|
3795
3610
|
return target;
|
|
3796
3611
|
}
|
|
@@ -3798,12 +3613,11 @@ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
|
|
|
3798
3613
|
let item = items[Math.min(low, items.length - 1)];
|
|
3799
3614
|
let element = elementMap.get(String(item.key));
|
|
3800
3615
|
rect = element.getBoundingClientRect();
|
|
3801
|
-
if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
};
|
|
3616
|
+
if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) return {
|
|
3617
|
+
type: "item",
|
|
3618
|
+
key: item.key,
|
|
3619
|
+
dropPosition: isFlowRTL ? "after" : "before"
|
|
3620
|
+
};
|
|
3807
3621
|
return {
|
|
3808
3622
|
type: "item",
|
|
3809
3623
|
key: item.key,
|
|
@@ -3855,27 +3669,24 @@ function $b45bbbaf0c3785df$export$29efd034f1d79f81(props) {
|
|
|
3855
3669
|
draggedKey.current = key;
|
|
3856
3670
|
selectionManager.setFocused(false);
|
|
3857
3671
|
setDragging(true);
|
|
3858
|
-
if (typeof onDragStart === "function")
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
});
|
|
3672
|
+
if (typeof onDragStart === "function") onDragStart({
|
|
3673
|
+
...event,
|
|
3674
|
+
keys
|
|
3675
|
+
});
|
|
3863
3676
|
},
|
|
3864
3677
|
moveDrag(event) {
|
|
3865
|
-
if (typeof onDragMove === "function")
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
});
|
|
3678
|
+
if (typeof onDragMove === "function") onDragMove({
|
|
3679
|
+
...event,
|
|
3680
|
+
keys: draggingKeys.current
|
|
3681
|
+
});
|
|
3870
3682
|
},
|
|
3871
3683
|
endDrag(event) {
|
|
3872
3684
|
let { isInternal } = event;
|
|
3873
|
-
if (typeof onDragEnd === "function")
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
});
|
|
3685
|
+
if (typeof onDragEnd === "function") onDragEnd({
|
|
3686
|
+
...event,
|
|
3687
|
+
keys: draggingKeys.current,
|
|
3688
|
+
isInternal
|
|
3689
|
+
});
|
|
3879
3690
|
draggingKeys.current = /* @__PURE__ */ new Set();
|
|
3880
3691
|
draggedKey.current = null;
|
|
3881
3692
|
setDragging(false);
|
|
@@ -3904,8 +3715,7 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
3904
3715
|
}
|
|
3905
3716
|
};
|
|
3906
3717
|
let defaultGetDropOperation = useCallback((e) => {
|
|
3907
|
-
if (isDisabled)
|
|
3908
|
-
return "cancel";
|
|
3718
|
+
if (isDisabled) return "cancel";
|
|
3909
3719
|
let { target: target2, types, allowedOperations, isInternal, draggingKeys } = e;
|
|
3910
3720
|
if (acceptedDragTypes === "all" || acceptedDragTypes.some((type) => types.has(type))) {
|
|
3911
3721
|
let isValidInsert = onInsert && target2.type === "item" && !isInternal && (target2.dropPosition === "before" || target2.dropPosition === "after");
|
|
@@ -3913,10 +3723,8 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
3913
3723
|
let isValidRootDrop = onRootDrop && target2.type === "root" && !isInternal;
|
|
3914
3724
|
let isValidOnItemDrop = onItemDrop && target2.type === "item" && target2.dropPosition === "on" && !(isInternal && draggingKeys.has(target2.key)) && (!shouldAcceptItemDrop || shouldAcceptItemDrop(target2, types));
|
|
3915
3725
|
if (onDrop || isValidInsert || isValidReorder || isValidRootDrop || isValidOnItemDrop) {
|
|
3916
|
-
if (getDropOperation)
|
|
3917
|
-
|
|
3918
|
-
else
|
|
3919
|
-
return allowedOperations[0];
|
|
3726
|
+
if (getDropOperation) return getDropOperation(target2, types, allowedOperations);
|
|
3727
|
+
else return allowedOperations[0];
|
|
3920
3728
|
}
|
|
3921
3729
|
}
|
|
3922
3730
|
return "cancel";
|
|
@@ -3937,32 +3745,27 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
3937
3745
|
isDisabled,
|
|
3938
3746
|
target,
|
|
3939
3747
|
setTarget(newTarget) {
|
|
3940
|
-
if (this.isDropTarget(newTarget))
|
|
3941
|
-
return;
|
|
3748
|
+
if (this.isDropTarget(newTarget)) return;
|
|
3942
3749
|
let target2 = targetRef.current;
|
|
3943
|
-
if (target2 && typeof props.onDropExit === "function")
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
target: newTarget
|
|
3956
|
-
});
|
|
3750
|
+
if (target2 && typeof props.onDropExit === "function") props.onDropExit({
|
|
3751
|
+
type: "dropexit",
|
|
3752
|
+
x: 0,
|
|
3753
|
+
y: 0,
|
|
3754
|
+
target: target2
|
|
3755
|
+
});
|
|
3756
|
+
if (newTarget && typeof onDropEnter === "function") onDropEnter({
|
|
3757
|
+
type: "dropenter",
|
|
3758
|
+
x: 0,
|
|
3759
|
+
y: 0,
|
|
3760
|
+
target: newTarget
|
|
3761
|
+
});
|
|
3957
3762
|
targetRef.current = newTarget;
|
|
3958
3763
|
setTarget(newTarget);
|
|
3959
3764
|
},
|
|
3960
3765
|
isDropTarget(dropTarget) {
|
|
3961
3766
|
let target2 = targetRef.current;
|
|
3962
|
-
if ($e672e8bc247525d1$var$isEqualDropTarget(dropTarget, target2))
|
|
3963
|
-
|
|
3964
|
-
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === "item" && (target2 === null || target2 === void 0 ? void 0 : target2.type) === "item" && dropTarget.key !== target2.key && dropTarget.dropPosition !== target2.dropPosition && dropTarget.dropPosition !== "on" && target2.dropPosition !== "on")
|
|
3965
|
-
return $e672e8bc247525d1$var$isEqualDropTarget(getOppositeTarget(dropTarget), target2) || $e672e8bc247525d1$var$isEqualDropTarget(dropTarget, getOppositeTarget(target2));
|
|
3767
|
+
if ($e672e8bc247525d1$var$isEqualDropTarget(dropTarget, target2)) return true;
|
|
3768
|
+
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === "item" && (target2 === null || target2 === void 0 ? void 0 : target2.type) === "item" && dropTarget.key !== target2.key && dropTarget.dropPosition !== target2.dropPosition && dropTarget.dropPosition !== "on" && target2.dropPosition !== "on") return $e672e8bc247525d1$var$isEqualDropTarget(getOppositeTarget(dropTarget), target2) || $e672e8bc247525d1$var$isEqualDropTarget(dropTarget, getOppositeTarget(target2));
|
|
3966
3769
|
return false;
|
|
3967
3770
|
},
|
|
3968
3771
|
getDropOperation(e) {
|
|
@@ -3971,8 +3774,7 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
3971
3774
|
};
|
|
3972
3775
|
}
|
|
3973
3776
|
function $e672e8bc247525d1$var$isEqualDropTarget(a, b) {
|
|
3974
|
-
if (!a)
|
|
3975
|
-
return !b;
|
|
3777
|
+
if (!a) return !b;
|
|
3976
3778
|
switch (a.type) {
|
|
3977
3779
|
case "root":
|
|
3978
3780
|
return (b === null || b === void 0 ? void 0 : b.type) === "root";
|
|
@@ -4039,14 +3841,12 @@ function $eed445e0843c11d0$var$ListBox(props, ref) {
|
|
|
4039
3841
|
let isHidden = useContext($64fa3d84918910a7$export$94b6d0abf7d33e8c);
|
|
4040
3842
|
let state = useContext($eed445e0843c11d0$export$7c5906fe4f1f2af2);
|
|
4041
3843
|
let document2 = useContext($7135fc7d473fd974$export$8c25dea96356a8b6);
|
|
4042
|
-
if (document2)
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
listBoxRef: ref
|
|
4049
|
-
});
|
|
3844
|
+
if (document2) return /* @__PURE__ */ React__default.createElement($7135fc7d473fd974$export$813b5978dd974d8, props);
|
|
3845
|
+
if (state) return isHidden ? null : /* @__PURE__ */ React__default.createElement($eed445e0843c11d0$var$ListBoxInner, {
|
|
3846
|
+
state,
|
|
3847
|
+
props,
|
|
3848
|
+
listBoxRef: ref
|
|
3849
|
+
});
|
|
4050
3850
|
return /* @__PURE__ */ React__default.createElement($eed445e0843c11d0$var$StandaloneListBox, {
|
|
4051
3851
|
props,
|
|
4052
3852
|
listBoxRef: ref
|
|
@@ -4126,10 +3926,8 @@ function $eed445e0843c11d0$var$ListBoxInner({ state, props, listBoxRef }) {
|
|
|
4126
3926
|
let dragHooksProvided = useRef(isListDraggable);
|
|
4127
3927
|
let dropHooksProvided = useRef(isListDroppable);
|
|
4128
3928
|
useEffect(() => {
|
|
4129
|
-
if (dragHooksProvided.current !== isListDraggable)
|
|
4130
|
-
|
|
4131
|
-
if (dropHooksProvided.current !== isListDroppable)
|
|
4132
|
-
console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.");
|
|
3929
|
+
if (dragHooksProvided.current !== isListDraggable) console.warn("Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.");
|
|
3930
|
+
if (dropHooksProvided.current !== isListDroppable) console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.");
|
|
4133
3931
|
}, [
|
|
4134
3932
|
isListDraggable,
|
|
4135
3933
|
isListDroppable
|
|
@@ -4186,14 +3984,13 @@ function $eed445e0843c11d0$var$ListBoxInner({ state, props, listBoxRef }) {
|
|
|
4186
3984
|
values: renderValues
|
|
4187
3985
|
});
|
|
4188
3986
|
let emptyState = null;
|
|
4189
|
-
if (state.collection.size === 0 && props.renderEmptyState)
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
}, props.renderEmptyState(renderValues));
|
|
3987
|
+
if (state.collection.size === 0 && props.renderEmptyState) emptyState = /* @__PURE__ */ React__default.createElement("div", {
|
|
3988
|
+
// eslint-disable-next-line
|
|
3989
|
+
role: "option",
|
|
3990
|
+
style: {
|
|
3991
|
+
display: "contents"
|
|
3992
|
+
}
|
|
3993
|
+
}, props.renderEmptyState(renderValues));
|
|
4197
3994
|
return /* @__PURE__ */ React__default.createElement($9bf71ea28793e738$export$20e40289641fbbb6, null, /* @__PURE__ */ React__default.createElement("div", {
|
|
4198
3995
|
...$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props),
|
|
4199
3996
|
...$3ef42575df84b30b$export$9d1611c77c2fe928(listBoxProps, focusProps, droppableCollection === null || droppableCollection === void 0 ? void 0 : droppableCollection.collectionProps),
|
|
@@ -4304,19 +4101,17 @@ function $eed445e0843c11d0$var$Option({ item }) {
|
|
|
4304
4101
|
onHoverEnd: item.props.onHoverEnd
|
|
4305
4102
|
});
|
|
4306
4103
|
let draggableItem = null;
|
|
4307
|
-
if (dragState && dragAndDropHooks)
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
}, dragState);
|
|
4104
|
+
if (dragState && dragAndDropHooks) draggableItem = dragAndDropHooks.useDraggableItem({
|
|
4105
|
+
key: item.key
|
|
4106
|
+
}, dragState);
|
|
4311
4107
|
let droppableItem = null;
|
|
4312
|
-
if (dropState && dragAndDropHooks)
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
}, dropState, ref);
|
|
4108
|
+
if (dropState && dragAndDropHooks) droppableItem = dragAndDropHooks.useDroppableItem({
|
|
4109
|
+
target: {
|
|
4110
|
+
type: "item",
|
|
4111
|
+
key: item.key,
|
|
4112
|
+
dropPosition: "on"
|
|
4113
|
+
}
|
|
4114
|
+
}, dropState, ref);
|
|
4320
4115
|
let props = item.props;
|
|
4321
4116
|
let isDragging = dragState && dragState.isDragging(item.key);
|
|
4322
4117
|
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
@@ -4338,8 +4133,7 @@ function $eed445e0843c11d0$var$Option({ item }) {
|
|
|
4338
4133
|
target
|
|
4339
4134
|
}));
|
|
4340
4135
|
useEffect(() => {
|
|
4341
|
-
if (!item.textValue)
|
|
4342
|
-
console.warn("A `textValue` prop is required for <ListBoxItem> elements with non-plain text children in order to support accessibility features such as type to select.");
|
|
4136
|
+
if (!item.textValue) console.warn("A `textValue` prop is required for <ListBoxItem> elements with non-plain text children in order to support accessibility features such as type to select.");
|
|
4343
4137
|
}, [
|
|
4344
4138
|
item.textValue
|
|
4345
4139
|
]);
|
|
@@ -4384,8 +4178,7 @@ function $eed445e0843c11d0$var$ListBoxDropIndicatorWrapper(props, ref) {
|
|
|
4384
4178
|
ref = $df56164dff5785e2$export$4338b53315abf666(ref);
|
|
4385
4179
|
let { dragAndDropHooks, dropState } = useContext($d8f176866e6dc039$export$d188a835a7bc5783);
|
|
4386
4180
|
let { dropIndicatorProps, isHidden, isDropTarget } = dragAndDropHooks.useDropIndicator(props, dropState, ref);
|
|
4387
|
-
if (isHidden)
|
|
4388
|
-
return null;
|
|
4181
|
+
if (isHidden) return null;
|
|
4389
4182
|
return /* @__PURE__ */ React__default.createElement($eed445e0843c11d0$var$ListBoxDropIndicatorForwardRef, {
|
|
4390
4183
|
...props,
|
|
4391
4184
|
dropIndicatorProps,
|