@eightshift/ui-components 8.1.0 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Autocomplete-BUU44AuW.js → Autocomplete-CO9aIsTe.js} +29 -25
- package/dist/{Button-_E2Z5G2l.js → Button-DO3oQfCq.js} +15 -9
- package/dist/{Dialog-3XLIaepk.js → Dialog-Bdqjmtt2.js} +293 -160
- package/dist/{Disclosure-Dh0z_DEQ.js → Disclosure-BTSsPhG9.js} +33 -29
- package/dist/{FocusScope-BKGWN6UK.js → FocusScope-Cj6cUR6X.js} +8 -6
- package/dist/{Heading-BWTs9ckA.js → Heading-BQje2nS2.js} +1 -1
- package/dist/{I18nProvider-BskRMK8G.js → I18nProvider-R_4IDnf9.js} +1 -1
- package/dist/{Label-UpU4cKPh.js → Label-C4bJkVti.js} +1 -1
- package/dist/{ListBox-DepY-52g.js → ListBox-CBvtIFuB.js} +20 -16
- package/dist/{NumberFormatter-WKBRKiEA.js → NumberFormatter-Bwdv413k.js} +4 -2
- package/dist/{RadioGroup-Br9Mn9QJ.js → RadioGroup-Dxzko0ma.js} +35 -35
- package/dist/{SearchField-q2Fj0L9K.js → SearchField-zY9JqR1c.js} +29 -26
- package/dist/{Slider-B8icnyOo.js → Slider-BXc72kE0.js} +55 -44
- package/dist/{Text-D4y19vs8.js → Text-i-ZK4MiL.js} +1 -1
- package/dist/{VisuallyHidden-B_LZ_kn7.js → VisuallyHidden-CsM0VnV1.js} +2 -2
- package/dist/{animation-DpSgtWyu.js → animation-COc9P6ap.js} +2 -4
- package/dist/assets/{image-analysis-worker-BuHru-CI.js → image-analysis-worker-CBOB71mx.js} +1 -1
- package/dist/assets/style-admin.css +1 -1
- package/dist/assets/style-editor.css +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/{button-XSk_8UW7.js → button-C7mc6eS1.js} +15 -12
- package/dist/{checkbox-BYaS9tQ5.js → checkbox-DlG5DILl.js} +8 -8
- package/dist/{color-swatch-6ZEIXej3.js → color-swatch-D6xMLGU-.js} +14 -15
- package/dist/components/animated-visibility/animated-visibility.js +5 -3
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/base-control/container.d.ts +4 -30
- package/dist/components/base-control/container.js +5 -32
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +7 -7
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +1 -1
- package/dist/components/component-toggle/component-toggle.js +3 -3
- package/dist/components/container-panel/container-panel.js +11 -11
- package/dist/components/contextual-help/contextual-help.js +2 -2
- package/dist/components/draggable/draggable.d.ts +3 -3
- package/dist/components/draggable/draggable.js +1 -1
- package/dist/components/draggable-list/draggable-list.d.ts +3 -3
- package/dist/components/draggable-list/draggable-list.js +8 -8
- package/dist/components/expandable/expandable.js +3 -3
- package/dist/components/index.js +16 -16
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.d.ts +3 -28
- package/dist/components/item-collection/item-collection.js +6 -6
- package/dist/components/link-input/link-input.d.ts +0 -2
- package/dist/components/link-input/link-input.js +1 -1
- package/dist/components/matrix-align/matrix-align.js +4 -3
- package/dist/components/menu/menu.js +10 -7
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/notice/notice.js +8 -8
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.d.ts +1 -1
- package/dist/components/option-select/option-select.js +21 -15
- package/dist/components/options-panel/options-panel.js +4 -4
- package/dist/components/placeholders/file-picker-shell.js +4 -3
- package/dist/components/placeholders/file-placeholder.js +2 -1
- package/dist/components/popover/popover.js +3 -3
- package/dist/components/portal-provider/portal-provider.js +2 -1
- package/dist/components/radio/radio.js +2 -2
- package/dist/components/repeater/repeater-context.d.ts +0 -1
- package/dist/components/repeater/repeater-item.js +1 -1
- package/dist/components/repeater/repeater.d.ts +5 -38
- package/dist/components/repeater/repeater.js +7 -10
- package/dist/components/responsive/mini-responsive.d.ts +0 -1
- package/dist/components/responsive/mini-responsive.js +30 -30
- package/dist/components/responsive/responsive-legacy.d.ts +0 -1
- package/dist/components/responsive/responsive-legacy.js +12 -10
- package/dist/components/responsive/responsive.d.ts +0 -1
- package/dist/components/responsive/responsive.js +28 -28
- package/dist/components/responsive-preview/responsive-preview.js +3 -3
- package/dist/components/select/async-multi-select.d.ts +12 -13
- package/dist/components/select/async-multi-select.js +39 -20
- package/dist/components/select/async-select.d.ts +12 -13
- package/dist/components/select/async-select.js +38 -20
- package/dist/components/select/multi-select.d.ts +2 -8
- package/dist/components/select/multi-select.js +19 -19
- package/dist/components/select/shared.d.ts +5 -9
- package/dist/components/select/shared.js +2 -2
- package/dist/components/select/single-select.d.ts +2 -8
- package/dist/components/select/single-select.js +16 -16
- package/dist/components/slider/column-config-slider.js +7 -5
- package/dist/components/slider/slider.js +15 -11
- package/dist/components/smart-image/smart-image.d.ts +0 -1
- package/dist/components/smart-image/smart-image.js +52 -50
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +2 -2
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/{draggable-9MfdTVWP.js → draggable-BUfOpGSZ.js} +129 -124
- package/dist/{es-dash-DunirOmV.js → es-dash-DPtJSRjw.js} +23 -52
- package/dist/{gradient-editor-yqSw0uPA.js → gradient-editor-_q3XF10i.js} +38 -29
- package/dist/icons/block-icon.js +1 -1
- package/dist/icons/icon.d.ts +3 -3
- package/dist/icons/icon.js +21 -9
- package/dist/icons/icons.d.ts +210 -1
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.d.ts +5 -4
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +16 -16
- package/dist/{input-field-nN6BO0oz.js → input-field-QzBpjm-m.js} +8 -8
- package/dist/{jsx-svg-BjGQUBLh.js → jsx-svg-DRwJdRpA.js} +171 -129
- package/dist/{keyboard-g5Amam-c.js → keyboard-BxnnQA2Z.js} +1 -1
- package/dist/{link-input-BhlPElU8.js → link-input-CElQp3lP.js} +145 -87
- package/dist/{modal-B5axB0Fc.js → modal-BeacK9N_.js} +14 -13
- package/dist/{number-picker-nnOf0XnN.js → number-picker-CK_OHBXw.js} +9 -9
- package/dist/{react-y40Dt3ab.js → react-C6Y6cCOx.js} +194 -215
- package/dist/{shared-Ba_bt4s9.js → shared-DBCipn_m.js} +59 -43
- package/dist/{solid-color-picker-CsosgTVa.js → solid-color-picker-2-X3ridX.js} +58 -53
- package/dist/{switch-BJ4_OyUm.js → switch-B87lQ1V0.js} +6 -6
- package/dist/{tabs-wAe0AAyu.js → tabs-DgkJUkIX.js} +33 -28
- package/dist/{text-helpers-2j9DuxP1.js → text-helpers-QrwKKaOh.js} +3 -2
- package/dist/{textSelection-B_Nv6Jz3.js → textSelection-5Qk8tLtm.js} +3 -3
- package/dist/{toggle-button-BLJdEp8V.js → toggle-button-B2-f2rU6.js} +8 -7
- package/dist/{tooltip-BW9nj5-V.js → tooltip-AzOLps8g.js} +68 -62
- package/dist/{useAsyncList-B3-uyJgA.js → useAsyncList-CjKVLGN0.js} +8 -4
- package/dist/{useButton-CPMVLXoX.js → useButton-BIrfoiY8.js} +3 -3
- package/dist/{useCollection-PzY6FI39.js → useCollection-LQlZnc1u.js} +267 -180
- package/dist/{useEvent-CzuFZ2HT.js → useEvent-Bih8lvtM.js} +1 -1
- package/dist/{useField-DrfR8j9h.js → useField-B_ibsWst.js} +2 -2
- package/dist/{useFilter-CiCjo6Na.js → useFilter-BFaOw4yi.js} +1 -1
- package/dist/{useFocusRing-CrYHpV7C.js → useFocusRing-ZXFsftJJ.js} +1 -1
- package/dist/{useFormReset-U6c35PHq.js → useFormReset-DDJhIIfG.js} +1 -1
- package/dist/{useFormValidation-B2q2MGWN.js → useFormValidation-BfnJKcdX.js} +2 -2
- package/dist/{useHover-CNsbAR0V.js → useHover-CbyH227W.js} +216 -39
- package/dist/{useLabel-DuxAjaic.js → useLabel-gfFDE4bn.js} +2 -2
- package/dist/{useLabels-NUsp5IW3.js → useLabels-Dcg-cEyM.js} +1 -1
- package/dist/{useListState-FLxa7R_U.js → useListState-I22DfnmE.js} +4 -2
- package/dist/{useLocalizedStringFormatter-Ccm8EL_u.js → useLocalizedStringFormatter-CTCqjYu4.js} +6 -1
- package/dist/{useNumberFieldState-DWvm7CXu.js → useNumberFieldState-C1gD0RuW.js} +79 -62
- package/dist/{useNumberFormatter-B0_D7a_o.js → useNumberFormatter-DbAt_fC_.js} +2 -2
- package/dist/{useOverlayTriggerState-zZ7homyI.js → useOverlayTriggerState-Cpc_IbQf.js} +12 -9
- package/dist/{usePress-DRoujMNm.js → usePress-BF7otjax.js} +30 -19
- package/dist/{useSlot-pRz-v9kC.js → useSlot-CnQHcvd4.js} +1 -1
- package/dist/{useTextField-e8jIFT3s.js → useTextField-CnTuCBMs.js} +6 -6
- package/dist/{useToggle-CR_ZKvr_.js → useToggle-Cgv5UXaB.js} +6 -6
- package/dist/{useToggleState-ButQxGrJ.js → useToggleState-Cy1E36QZ.js} +1 -1
- package/dist/utilities/array-helpers.d.ts +1 -1
- package/dist/utilities/array-helpers.js +4 -3
- package/dist/utilities/debounce-throttle.d.ts +9 -2
- package/dist/utilities/es-dash.d.ts +11 -8
- package/dist/utilities/es-dash.js +1 -1
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/text-helpers.js +1 -1
- package/dist/utilities/web-workers.d.ts +7 -7
- package/dist/utilities/web-workers.js +5 -5
- package/dist/{utils-Czi6q2Ub.js → utils-ClM91CuL.js} +30 -19
- package/package.json +21 -25
|
@@ -14,20 +14,23 @@ function arrayMove$1(array, from, to) {
|
|
|
14
14
|
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
|
|
15
15
|
var i = Symbol.for("preact-signals");
|
|
16
16
|
function t() {
|
|
17
|
-
if (!(
|
|
17
|
+
if (!(v > 1)) {
|
|
18
18
|
var i, t = !1;
|
|
19
19
|
(function() {
|
|
20
20
|
var i = c;
|
|
21
21
|
c = void 0;
|
|
22
22
|
while (void 0 !== i) {
|
|
23
|
-
|
|
23
|
+
var t = i.S;
|
|
24
|
+
if (t.v === i.v) {
|
|
25
|
+
for (var n = t.t; void 0 !== n; n = n.x) if (n.i === i.i) n.i = t.i;
|
|
26
|
+
}
|
|
24
27
|
i = i.o;
|
|
25
28
|
}
|
|
26
29
|
})();
|
|
27
30
|
while (void 0 !== h) {
|
|
28
31
|
var n = h;
|
|
29
32
|
h = void 0;
|
|
30
|
-
|
|
33
|
+
s++;
|
|
31
34
|
while (void 0 !== n) {
|
|
32
35
|
var r = n.u;
|
|
33
36
|
n.u = void 0;
|
|
@@ -43,67 +46,69 @@ function t() {
|
|
|
43
46
|
n = r;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
s = 0;
|
|
50
|
+
v--;
|
|
48
51
|
if (t) throw i;
|
|
49
|
-
} else
|
|
52
|
+
} else v--;
|
|
50
53
|
}
|
|
51
54
|
function n(i) {
|
|
52
|
-
if (
|
|
55
|
+
if (v > 0) return i();
|
|
53
56
|
e = ++u;
|
|
54
|
-
|
|
57
|
+
v++;
|
|
55
58
|
try {
|
|
56
59
|
return i();
|
|
57
60
|
} finally {
|
|
58
61
|
t();
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
var r
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
var r;
|
|
65
|
+
var o = void 0;
|
|
66
|
+
function f(i) {
|
|
67
|
+
var t = o, n = r;
|
|
68
|
+
o = void 0;
|
|
64
69
|
r = void 0;
|
|
65
70
|
try {
|
|
66
71
|
return i();
|
|
67
72
|
} finally {
|
|
68
|
-
|
|
73
|
+
o = t;
|
|
74
|
+
r = n;
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
|
-
var f;
|
|
72
77
|
var h = void 0;
|
|
73
|
-
var s = 0;
|
|
74
78
|
var v = 0;
|
|
79
|
+
var s = 0;
|
|
75
80
|
var u = 0;
|
|
76
81
|
var e = 0;
|
|
77
82
|
var c = void 0;
|
|
78
83
|
var d = 0;
|
|
79
84
|
function a(i) {
|
|
80
|
-
if (void 0 !==
|
|
85
|
+
if (void 0 !== o) {
|
|
81
86
|
var t = i.n;
|
|
82
|
-
if (void 0 === t || t.t !==
|
|
87
|
+
if (void 0 === t || t.t !== o) {
|
|
83
88
|
t = {
|
|
84
89
|
i: 0,
|
|
85
90
|
S: i,
|
|
86
|
-
p:
|
|
91
|
+
p: o.s,
|
|
87
92
|
n: void 0,
|
|
88
|
-
t:
|
|
93
|
+
t: o,
|
|
89
94
|
e: void 0,
|
|
90
95
|
x: void 0,
|
|
91
96
|
r: t
|
|
92
97
|
};
|
|
93
|
-
if (void 0 !==
|
|
94
|
-
|
|
98
|
+
if (void 0 !== o.s) o.s.n = t;
|
|
99
|
+
o.s = t;
|
|
95
100
|
i.n = t;
|
|
96
|
-
if (32 &
|
|
101
|
+
if (32 & o.f) i.S(t);
|
|
97
102
|
return t;
|
|
98
103
|
} else if (-1 === t.i) {
|
|
99
104
|
t.i = 0;
|
|
100
105
|
if (void 0 !== t.n) {
|
|
101
106
|
t.n.p = t.p;
|
|
102
107
|
if (void 0 !== t.p) t.p.n = t.n;
|
|
103
|
-
t.p =
|
|
108
|
+
t.p = o.s;
|
|
104
109
|
t.n = void 0;
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
o.s.n = t;
|
|
111
|
+
o.s = t;
|
|
107
112
|
}
|
|
108
113
|
return t;
|
|
109
114
|
}
|
|
@@ -129,7 +134,7 @@ l.prototype.S = function(i) {
|
|
|
129
134
|
i.x = n;
|
|
130
135
|
this.t = i;
|
|
131
136
|
if (void 0 !== n) n.e = i;
|
|
132
|
-
else
|
|
137
|
+
else f(function() {
|
|
133
138
|
var i;
|
|
134
139
|
null == (i = t.W) || i.call(t);
|
|
135
140
|
});
|
|
@@ -149,7 +154,7 @@ l.prototype.U = function(i) {
|
|
|
149
154
|
}
|
|
150
155
|
if (i === this.t) {
|
|
151
156
|
this.t = r;
|
|
152
|
-
if (void 0 === r)
|
|
157
|
+
if (void 0 === r) f(function() {
|
|
153
158
|
var i;
|
|
154
159
|
null == (i = t.Z) || i.call(t);
|
|
155
160
|
});
|
|
@@ -159,13 +164,10 @@ l.prototype.U = function(i) {
|
|
|
159
164
|
l.prototype.subscribe = function(i) {
|
|
160
165
|
var t = this;
|
|
161
166
|
return j(function() {
|
|
162
|
-
var n = t.value
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
} finally {
|
|
167
|
-
r = o;
|
|
168
|
-
}
|
|
167
|
+
var n = t.value;
|
|
168
|
+
f(function() {
|
|
169
|
+
return i(n);
|
|
170
|
+
});
|
|
169
171
|
}, { name: "sub" });
|
|
170
172
|
};
|
|
171
173
|
l.prototype.valueOf = function() {
|
|
@@ -178,13 +180,10 @@ l.prototype.toJSON = function() {
|
|
|
178
180
|
return this.value;
|
|
179
181
|
};
|
|
180
182
|
l.prototype.peek = function() {
|
|
181
|
-
var i =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} finally {
|
|
186
|
-
r = i;
|
|
187
|
-
}
|
|
183
|
+
var i = this;
|
|
184
|
+
return f(function() {
|
|
185
|
+
return i.value;
|
|
186
|
+
});
|
|
188
187
|
};
|
|
189
188
|
Object.defineProperty(l.prototype, "value", {
|
|
190
189
|
get: function() {
|
|
@@ -194,9 +193,9 @@ Object.defineProperty(l.prototype, "value", {
|
|
|
194
193
|
},
|
|
195
194
|
set: function(i) {
|
|
196
195
|
if (i !== this.v) {
|
|
197
|
-
if (
|
|
196
|
+
if (s > 100) throw new Error("Cycle detected");
|
|
198
197
|
(function(i) {
|
|
199
|
-
if (0 !==
|
|
198
|
+
if (0 !== v && 0 === s) {
|
|
200
199
|
if (i.l !== e) {
|
|
201
200
|
i.l = e;
|
|
202
201
|
c = {
|
|
@@ -211,7 +210,7 @@ Object.defineProperty(l.prototype, "value", {
|
|
|
211
210
|
this.v = i;
|
|
212
211
|
this.i++;
|
|
213
212
|
d++;
|
|
214
|
-
|
|
213
|
+
v++;
|
|
215
214
|
try {
|
|
216
215
|
for (var n = this.t; void 0 !== n; n = n.x) n.t.N();
|
|
217
216
|
} finally {
|
|
@@ -255,14 +254,11 @@ function b(i) {
|
|
|
255
254
|
i.s = n;
|
|
256
255
|
}
|
|
257
256
|
function p(i, t) {
|
|
258
|
-
l.call(this, void 0);
|
|
257
|
+
l.call(this, void 0, t);
|
|
259
258
|
this.x = i;
|
|
260
259
|
this.s = void 0;
|
|
261
260
|
this.g = d - 1;
|
|
262
261
|
this.f = 4;
|
|
263
|
-
this.W = null == t ? void 0 : t.watched;
|
|
264
|
-
this.Z = null == t ? void 0 : t.unwatched;
|
|
265
|
-
this.name = null == t ? void 0 : t.name;
|
|
266
262
|
}
|
|
267
263
|
p.prototype = new l();
|
|
268
264
|
p.prototype.h = function() {
|
|
@@ -277,10 +273,10 @@ p.prototype.h = function() {
|
|
|
277
273
|
this.f &= -2;
|
|
278
274
|
return !0;
|
|
279
275
|
}
|
|
280
|
-
var i =
|
|
276
|
+
var i = o;
|
|
281
277
|
try {
|
|
282
278
|
_(this);
|
|
283
|
-
|
|
279
|
+
o = this;
|
|
284
280
|
var t = this.x();
|
|
285
281
|
if (16 & this.f || this.v !== t || 0 === this.i) {
|
|
286
282
|
this.v = t;
|
|
@@ -292,7 +288,7 @@ p.prototype.h = function() {
|
|
|
292
288
|
this.f |= 16;
|
|
293
289
|
this.i++;
|
|
294
290
|
}
|
|
295
|
-
|
|
291
|
+
o = i;
|
|
296
292
|
b(this);
|
|
297
293
|
this.f &= -2;
|
|
298
294
|
return !0;
|
|
@@ -334,9 +330,9 @@ function S(i) {
|
|
|
334
330
|
var n = i.m;
|
|
335
331
|
i.m = void 0;
|
|
336
332
|
if ("function" == typeof n) {
|
|
337
|
-
|
|
338
|
-
var
|
|
339
|
-
|
|
333
|
+
v++;
|
|
334
|
+
var r = o;
|
|
335
|
+
o = void 0;
|
|
340
336
|
try {
|
|
341
337
|
n();
|
|
342
338
|
} catch (t) {
|
|
@@ -345,7 +341,7 @@ function S(i) {
|
|
|
345
341
|
m(i);
|
|
346
342
|
throw t;
|
|
347
343
|
} finally {
|
|
348
|
-
|
|
344
|
+
o = r;
|
|
349
345
|
t();
|
|
350
346
|
}
|
|
351
347
|
}
|
|
@@ -357,9 +353,9 @@ function m(i) {
|
|
|
357
353
|
S(i);
|
|
358
354
|
}
|
|
359
355
|
function x(i) {
|
|
360
|
-
if (
|
|
356
|
+
if (o !== this) throw new Error("Out-of-order effect");
|
|
361
357
|
b(this);
|
|
362
|
-
|
|
358
|
+
o = i;
|
|
363
359
|
this.f &= -2;
|
|
364
360
|
if (8 & this.f) m(this);
|
|
365
361
|
t();
|
|
@@ -371,7 +367,7 @@ function E(i, t) {
|
|
|
371
367
|
this.u = void 0;
|
|
372
368
|
this.f = 32;
|
|
373
369
|
this.name = null == t ? void 0 : t.name;
|
|
374
|
-
if (
|
|
370
|
+
if (r) r.push(this);
|
|
375
371
|
}
|
|
376
372
|
E.prototype.c = function() {
|
|
377
373
|
var i = this.S();
|
|
@@ -390,9 +386,9 @@ E.prototype.S = function() {
|
|
|
390
386
|
this.f &= -9;
|
|
391
387
|
S(this);
|
|
392
388
|
_(this);
|
|
393
|
-
|
|
394
|
-
var i =
|
|
395
|
-
|
|
389
|
+
v++;
|
|
390
|
+
var i = o;
|
|
391
|
+
o = this;
|
|
396
392
|
return x.bind(this, i);
|
|
397
393
|
};
|
|
398
394
|
E.prototype.N = function() {
|
|
@@ -637,7 +633,7 @@ var ValueHistory = class {
|
|
|
637
633
|
}
|
|
638
634
|
/** Set the current value */
|
|
639
635
|
set current(value) {
|
|
640
|
-
const current =
|
|
636
|
+
const current = f(() => __privateGet$6(this, _ValueHistory_instances, current_get));
|
|
641
637
|
if (value && current && this.equals(current, value)) return;
|
|
642
638
|
n(() => {
|
|
643
639
|
if (!__privateGet$6(this, _ValueHistory_instances, initial_get)) __privateSet$6(this, _ValueHistory_instances, value, initial_set);
|
|
@@ -667,7 +663,7 @@ __decorateElement$5(_init$5, 2, "initial", _initial_dec, ValueHistory);
|
|
|
667
663
|
__decorateElement$5(_init$5, 2, "previous", _previous_dec, ValueHistory);
|
|
668
664
|
__decoratorMetadata$5(_init$5, ValueHistory);
|
|
669
665
|
function snapshot(value) {
|
|
670
|
-
return
|
|
666
|
+
return f(() => {
|
|
671
667
|
const output = {};
|
|
672
668
|
for (const key in value) output[key] = value[key];
|
|
673
669
|
return output;
|
|
@@ -1210,7 +1206,7 @@ var Plugin = class {
|
|
|
1210
1206
|
* This method does not trigger effects when accessed.
|
|
1211
1207
|
*/
|
|
1212
1208
|
isDisabled() {
|
|
1213
|
-
return
|
|
1209
|
+
return f(() => {
|
|
1214
1210
|
return this.disabled;
|
|
1215
1211
|
});
|
|
1216
1212
|
}
|
|
@@ -1394,7 +1390,7 @@ var CollisionObserver = class extends Plugin {
|
|
|
1394
1390
|
__privateSet$4(this, _collisions, y(DEFAULT_VALUE));
|
|
1395
1391
|
this.destroy = effects(() => {
|
|
1396
1392
|
const collisions = this.computeCollisions();
|
|
1397
|
-
const coordinates =
|
|
1393
|
+
const coordinates = f(() => this.manager.dragOperation.position.current);
|
|
1398
1394
|
if (collisions !== DEFAULT_VALUE) {
|
|
1399
1395
|
const previousCoordinates = __privateGet$4(this, _previousCoordinates);
|
|
1400
1396
|
__privateSet$4(this, _previousCoordinates, coordinates);
|
|
@@ -1412,7 +1408,7 @@ var CollisionObserver = class extends Plugin {
|
|
|
1412
1408
|
* @param immediate - If true, updates collisions immediately. If false, resets previous coordinates.
|
|
1413
1409
|
*/
|
|
1414
1410
|
forceUpdate(immediate = true) {
|
|
1415
|
-
|
|
1411
|
+
f(() => {
|
|
1416
1412
|
if (immediate) __privateGet$4(this, _collisions).value = this.computeCollisions();
|
|
1417
1413
|
else __privateSet$4(this, _previousCoordinates, void 0);
|
|
1418
1414
|
});
|
|
@@ -1437,7 +1433,7 @@ var CollisionObserver = class extends Plugin {
|
|
|
1437
1433
|
if (!detectCollision) continue;
|
|
1438
1434
|
potentialTargets.push(entry);
|
|
1439
1435
|
entry.shape;
|
|
1440
|
-
const collision =
|
|
1436
|
+
const collision = f(() => detectCollision({
|
|
1441
1437
|
droppable: entry,
|
|
1442
1438
|
dragOperation
|
|
1443
1439
|
}));
|
|
@@ -1894,7 +1890,7 @@ var CollisionNotifier = class extends CorePlugin {
|
|
|
1894
1890
|
if (isEqual(collisions, previousCollisions)) return;
|
|
1895
1891
|
else previousCollisions = collisions;
|
|
1896
1892
|
const [firstCollision] = collisions;
|
|
1897
|
-
|
|
1893
|
+
f(() => {
|
|
1898
1894
|
var _a;
|
|
1899
1895
|
if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a = manager.dragOperation.target) == null ? void 0 : _a.id)) {
|
|
1900
1896
|
collisionObserver.disable();
|
|
@@ -1998,7 +1994,7 @@ var DragActions = class {
|
|
|
1998
1994
|
* @returns A promise that resolves to true if the drop was prevented
|
|
1999
1995
|
*/
|
|
2000
1996
|
setDropTarget(identifier) {
|
|
2001
|
-
return
|
|
1997
|
+
return f(() => {
|
|
2002
1998
|
const { dragOperation } = this.manager;
|
|
2003
1999
|
const id = identifier != null ? identifier : null;
|
|
2004
2000
|
if (dragOperation.targetIdentifier === id) return Promise.resolve(false);
|
|
@@ -2019,7 +2015,7 @@ var DragActions = class {
|
|
|
2019
2015
|
* @throws {Error} If there is no drag source or another operation is active
|
|
2020
2016
|
*/
|
|
2021
2017
|
start(args) {
|
|
2022
|
-
return
|
|
2018
|
+
return f(() => {
|
|
2023
2019
|
const { dragOperation } = this.manager;
|
|
2024
2020
|
if (args.source != null) this.setDragSource(args.source);
|
|
2025
2021
|
if (!dragOperation.source) throw new Error("Cannot start a drag operation without a drag source");
|
|
@@ -2069,7 +2065,7 @@ var DragActions = class {
|
|
|
2069
2065
|
* @param args.propagate - Whether to dispatch dragmove events
|
|
2070
2066
|
*/
|
|
2071
2067
|
move(args) {
|
|
2072
|
-
return
|
|
2068
|
+
return f(() => {
|
|
2073
2069
|
var _a, _b;
|
|
2074
2070
|
const { dragOperation } = this.manager;
|
|
2075
2071
|
const { status, controller } = dragOperation;
|
|
@@ -2105,7 +2101,7 @@ var DragActions = class {
|
|
|
2105
2101
|
* - Handles cleanup of the operation state
|
|
2106
2102
|
*/
|
|
2107
2103
|
stop(args = {}) {
|
|
2108
|
-
return
|
|
2104
|
+
return f(() => {
|
|
2109
2105
|
var _a, _b;
|
|
2110
2106
|
const { dragOperation } = this.manager;
|
|
2111
2107
|
const { controller } = dragOperation;
|
|
@@ -2126,7 +2122,7 @@ var DragActions = class {
|
|
|
2126
2122
|
const end = () => {
|
|
2127
2123
|
this.manager.renderer.rendering.then(() => {
|
|
2128
2124
|
dragOperation.status.set("dropped");
|
|
2129
|
-
const dropping =
|
|
2125
|
+
const dropping = f(() => {
|
|
2130
2126
|
var _a2;
|
|
2131
2127
|
return ((_a2 = dragOperation.source) == null ? void 0 : _a2.status) === "dropping";
|
|
2132
2128
|
});
|
|
@@ -2386,7 +2382,7 @@ var DragOperation = class {
|
|
|
2386
2382
|
* @returns An immutable snapshot of the current operation state
|
|
2387
2383
|
*/
|
|
2388
2384
|
snapshot() {
|
|
2389
|
-
return
|
|
2385
|
+
return f(() => ({
|
|
2390
2386
|
source: this.source,
|
|
2391
2387
|
target: this.target,
|
|
2392
2388
|
activatorEvent: this.activatorEvent,
|
|
@@ -2489,7 +2485,7 @@ var DragDropManager$1 = class {
|
|
|
2489
2485
|
const { destroy } = this;
|
|
2490
2486
|
const cleanup = effects(() => {
|
|
2491
2487
|
var _a2, _b, _c3;
|
|
2492
|
-
const currentModifiers =
|
|
2488
|
+
const currentModifiers = f(() => this.dragOperation.modifiers);
|
|
2493
2489
|
const managerModifiers = this.modifiers;
|
|
2494
2490
|
for (const modifier of currentModifiers) if (!managerModifiers.includes(modifier)) modifier.destroy();
|
|
2495
2491
|
this.dragOperation.modifiers = (_c3 = (_b = (_a2 = this.dragOperation.source) == null ? void 0 : _a2.modifiers) == null ? void 0 : _b.map((modifier) => {
|
|
@@ -3527,15 +3523,19 @@ function scrollIntoViewIfNeeded(el, { block = "nearest", inline = "nearest" } =
|
|
|
3527
3523
|
}
|
|
3528
3524
|
if (block !== "none") {
|
|
3529
3525
|
const overTop = adjustedTop < ancestor.scrollTop;
|
|
3530
|
-
if (overTop !== adjustedTop + el.offsetHeight > ancestor.scrollTop + ancestor.clientHeight)
|
|
3531
|
-
|
|
3532
|
-
|
|
3526
|
+
if (overTop !== adjustedTop + el.offsetHeight > ancestor.scrollTop + ancestor.clientHeight) {
|
|
3527
|
+
if (block === "center") ancestor.scrollTop = adjustedTop - ancestor.clientHeight / 2 + el.offsetHeight / 2;
|
|
3528
|
+
else if (overTop) ancestor.scrollTop = adjustedTop;
|
|
3529
|
+
else ancestor.scrollTop = adjustedTop + el.offsetHeight - ancestor.clientHeight;
|
|
3530
|
+
}
|
|
3533
3531
|
}
|
|
3534
3532
|
if (inline !== "none") {
|
|
3535
3533
|
const overLeft = adjustedLeft < ancestor.scrollLeft;
|
|
3536
|
-
if (overLeft !== adjustedLeft + el.offsetWidth > ancestor.scrollLeft + ancestor.clientWidth)
|
|
3537
|
-
|
|
3538
|
-
|
|
3534
|
+
if (overLeft !== adjustedLeft + el.offsetWidth > ancestor.scrollLeft + ancestor.clientWidth) {
|
|
3535
|
+
if (inline === "center") ancestor.scrollLeft = adjustedLeft - ancestor.clientWidth / 2 + el.offsetWidth / 2;
|
|
3536
|
+
else if (overLeft) ancestor.scrollLeft = adjustedLeft;
|
|
3537
|
+
else ancestor.scrollLeft = adjustedLeft + el.offsetWidth - ancestor.clientWidth;
|
|
3538
|
+
}
|
|
3539
3539
|
}
|
|
3540
3540
|
processedAncestors.push(ancestor);
|
|
3541
3541
|
}
|
|
@@ -3858,7 +3858,9 @@ var _RestrictToElement = class _RestrictToElement extends Modifier {
|
|
|
3858
3858
|
if (!boundingRectangle) return transform;
|
|
3859
3859
|
const { initial, current } = shape;
|
|
3860
3860
|
const { height, width } = current.boundingRectangle;
|
|
3861
|
-
|
|
3861
|
+
const left = initial.center.x - width / 2;
|
|
3862
|
+
const top = initial.center.y - height / 2;
|
|
3863
|
+
return restrictShapeToBoundingRectangle(new Rectangle(left, top, width, height), transform, boundingRectangle);
|
|
3862
3864
|
}
|
|
3863
3865
|
};
|
|
3864
3866
|
_RestrictToElement.configure = configurator(_RestrictToElement);
|
|
@@ -4211,13 +4213,13 @@ var _StyleInjector = class _StyleInjector extends (_a$1 = CorePlugin, _additiona
|
|
|
4211
4213
|
* Returns a cleanup function that removes the root.
|
|
4212
4214
|
*/
|
|
4213
4215
|
addRoot(root) {
|
|
4214
|
-
|
|
4216
|
+
f(() => {
|
|
4215
4217
|
const roots = new Set(this.additionalRoots);
|
|
4216
4218
|
roots.add(root);
|
|
4217
4219
|
this.additionalRoots = roots;
|
|
4218
4220
|
});
|
|
4219
4221
|
return () => {
|
|
4220
|
-
|
|
4222
|
+
f(() => {
|
|
4221
4223
|
const roots = new Set(this.additionalRoots);
|
|
4222
4224
|
roots.delete(root);
|
|
4223
4225
|
this.additionalRoots = roots;
|
|
@@ -4431,7 +4433,7 @@ var CSS_RULES = `
|
|
|
4431
4433
|
}
|
|
4432
4434
|
`.replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
|
|
4433
4435
|
function createPlaceholder(source, type = "hidden") {
|
|
4434
|
-
return
|
|
4436
|
+
return f(() => {
|
|
4435
4437
|
const { element, manager } = source;
|
|
4436
4438
|
if (!element || !manager) return;
|
|
4437
4439
|
const containedDroppables = findContainedDroppables(element, manager.registry.droppables);
|
|
@@ -4740,7 +4742,7 @@ render_fn = function() {
|
|
|
4740
4742
|
const widthOffset = contentBox ? parseInt(paddingInlineStart) + parseInt(paddingInlineEnd) + parseInt(borderInlineStartWidth) + parseInt(borderInlineEndWidth) : 0;
|
|
4741
4743
|
const heightOffset = contentBox ? parseInt(paddingBlockStart) + parseInt(paddingBlockEnd) + parseInt(borderBlockStartWidth) + parseInt(borderBlockEndWidth) : 0;
|
|
4742
4744
|
const placeholder = feedback !== "move" && !this.overlay ? createPlaceholder(source, clone ? "clone" : "hidden") : null;
|
|
4743
|
-
const isKeyboardOperation =
|
|
4745
|
+
const isKeyboardOperation = f(() => isKeyboardEvent(manager.dragOperation.activatorEvent));
|
|
4744
4746
|
if (!initial.translate) {
|
|
4745
4747
|
if (this.overlay && parsedTransform) initial.translate = {
|
|
4746
4748
|
x: parsedTransform.x,
|
|
@@ -4752,7 +4754,7 @@ render_fn = function() {
|
|
|
4752
4754
|
}
|
|
4753
4755
|
}
|
|
4754
4756
|
if (!initial.transformOrigin) {
|
|
4755
|
-
const current =
|
|
4757
|
+
const current = f(() => position.current);
|
|
4756
4758
|
const visualLeft = left + ((_d2 = parsedTransform == null ? void 0 : parsedTransform.x) != null ? _d2 : 0);
|
|
4757
4759
|
const visualTop = top + ((_e = parsedTransform == null ? void 0 : parsedTransform.y) != null ? _e : 0);
|
|
4758
4760
|
initial.transformOrigin = {
|
|
@@ -4797,7 +4799,7 @@ render_fn = function() {
|
|
|
4797
4799
|
top: top + delta.y
|
|
4798
4800
|
};
|
|
4799
4801
|
feedbackElement.setAttribute(ATTRIBUTE, "true");
|
|
4800
|
-
const transform =
|
|
4802
|
+
const transform = f(() => dragOperation.transform);
|
|
4801
4803
|
const initialTranslate = (_f = initial.translate) != null ? _f : {
|
|
4802
4804
|
x: 0,
|
|
4803
4805
|
y: 0
|
|
@@ -4851,14 +4853,14 @@ render_fn = function() {
|
|
|
4851
4853
|
}
|
|
4852
4854
|
});
|
|
4853
4855
|
const initialShape = new DOMRectangle(feedbackElement);
|
|
4854
|
-
|
|
4856
|
+
f(() => dragOperation.shape = initialShape);
|
|
4855
4857
|
const feedbackWindow = getWindow(feedbackElement);
|
|
4856
4858
|
const handleWindowResize = (event) => {
|
|
4857
4859
|
this.manager.actions.stop({ event });
|
|
4858
4860
|
};
|
|
4859
4861
|
const reducedMotion = prefersReducedMotion(feedbackWindow);
|
|
4860
4862
|
if (isKeyboardOperation) feedbackWindow.addEventListener("resize", handleWindowResize);
|
|
4861
|
-
if (
|
|
4863
|
+
if (f(() => source.status) === "idle") requestAnimationFrame(() => source.status = "dragging");
|
|
4862
4864
|
if (placeholder) {
|
|
4863
4865
|
resizeObserver.observe(placeholder);
|
|
4864
4866
|
elementMutationObserver = createElementMutationObserver(element, placeholder, clone);
|
|
@@ -4914,8 +4916,8 @@ render_fn = function() {
|
|
|
4914
4916
|
y: transform2.y / frameTransform.scaleY + initialTranslate2.y
|
|
4915
4917
|
};
|
|
4916
4918
|
const previousTranslate = state.current.translate;
|
|
4917
|
-
const modifiers =
|
|
4918
|
-
const currentShape =
|
|
4919
|
+
const modifiers = f(() => dragOperation.modifiers);
|
|
4920
|
+
const currentShape = f(() => {
|
|
4919
4921
|
var _a7;
|
|
4920
4922
|
return (_a7 = dragOperation.shape) == null ? void 0 : _a7.current;
|
|
4921
4923
|
});
|
|
@@ -5423,12 +5425,10 @@ var _KeyboardSensor = class _KeyboardSensor extends Sensor {
|
|
|
5423
5425
|
y: 0
|
|
5424
5426
|
};
|
|
5425
5427
|
break;
|
|
5426
|
-
case "right":
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
};
|
|
5431
|
-
break;
|
|
5428
|
+
case "right": by = {
|
|
5429
|
+
x: offset.x * factor,
|
|
5430
|
+
y: 0
|
|
5431
|
+
};
|
|
5432
5432
|
}
|
|
5433
5433
|
if (by.x || by.y) {
|
|
5434
5434
|
event.preventDefault();
|
|
@@ -5488,9 +5488,7 @@ var DistanceConstraint = class extends ActivationConstraint {
|
|
|
5488
5488
|
}
|
|
5489
5489
|
if (exceedsDistance(delta, this.options.value)) this.activate(event);
|
|
5490
5490
|
break;
|
|
5491
|
-
case "pointerup":
|
|
5492
|
-
this.abort();
|
|
5493
|
-
break;
|
|
5491
|
+
case "pointerup": this.abort();
|
|
5494
5492
|
}
|
|
5495
5493
|
}
|
|
5496
5494
|
abort() {
|
|
@@ -5515,14 +5513,13 @@ var DelayConstraint = class extends ActivationConstraint {
|
|
|
5515
5513
|
case "pointermove":
|
|
5516
5514
|
if (!__privateGet$2(this, _coordinates2)) return;
|
|
5517
5515
|
const { x, y } = getEventCoordinates(event);
|
|
5518
|
-
|
|
5516
|
+
const delta = {
|
|
5519
5517
|
x: x - __privateGet$2(this, _coordinates2).x,
|
|
5520
5518
|
y: y - __privateGet$2(this, _coordinates2).y
|
|
5521
|
-
}
|
|
5522
|
-
|
|
5523
|
-
case "pointerup":
|
|
5524
|
-
this.abort();
|
|
5519
|
+
};
|
|
5520
|
+
if (exceedsDistance(delta, this.options.tolerance)) this.abort();
|
|
5525
5521
|
break;
|
|
5522
|
+
case "pointerup": this.abort();
|
|
5526
5523
|
}
|
|
5527
5524
|
}
|
|
5528
5525
|
abort() {
|
|
@@ -5605,8 +5602,10 @@ var _PointerSensor = class _PointerSensor extends Sensor {
|
|
|
5605
5602
|
if (isPointerEvent(event)) this.handlePointerDown(event, source, options);
|
|
5606
5603
|
};
|
|
5607
5604
|
let targets = [(_a5 = source.handle) != null ? _a5 : source.element];
|
|
5608
|
-
if (options == null ? void 0 : options.activatorElements)
|
|
5609
|
-
|
|
5605
|
+
if (options == null ? void 0 : options.activatorElements) {
|
|
5606
|
+
if (Array.isArray(options.activatorElements)) targets = options.activatorElements;
|
|
5607
|
+
else targets = options.activatorElements(source);
|
|
5608
|
+
}
|
|
5610
5609
|
for (const target of targets) {
|
|
5611
5610
|
if (!target) continue;
|
|
5612
5611
|
patchWindow(target.ownerDocument.defaultView);
|
|
@@ -5868,7 +5867,7 @@ var Droppable = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _p
|
|
|
5868
5867
|
}
|
|
5869
5868
|
if (!manager2) return;
|
|
5870
5869
|
const updatedShape = new DOMRectangle(element2);
|
|
5871
|
-
const shape =
|
|
5870
|
+
const shape = f(() => this.shape);
|
|
5872
5871
|
if (updatedShape && (shape == null ? void 0 : shape.equals(updatedShape))) return shape;
|
|
5873
5872
|
this.shape = updatedShape;
|
|
5874
5873
|
return updatedShape;
|
|
@@ -5958,7 +5957,7 @@ function useDeepSignal(target, synchronous) {
|
|
|
5958
5957
|
let sync = false;
|
|
5959
5958
|
for (const entry of tracked.current) {
|
|
5960
5959
|
const [key] = entry;
|
|
5961
|
-
const value =
|
|
5960
|
+
const value = f(() => entry[1]);
|
|
5962
5961
|
const latestValue = target[key];
|
|
5963
5962
|
if (value !== latestValue) {
|
|
5964
5963
|
stale = true;
|
|
@@ -5966,8 +5965,10 @@ function useDeepSignal(target, synchronous) {
|
|
|
5966
5965
|
sync = (_a = synchronous == null ? void 0 : synchronous(key, value, latestValue)) != null ? _a : false;
|
|
5967
5966
|
}
|
|
5968
5967
|
}
|
|
5969
|
-
if (stale)
|
|
5970
|
-
|
|
5968
|
+
if (stale) {
|
|
5969
|
+
if (sync) queueMicrotask(() => flushSync(forceUpdate));
|
|
5970
|
+
else forceUpdate();
|
|
5971
|
+
}
|
|
5971
5972
|
});
|
|
5972
5973
|
}, [target]);
|
|
5973
5974
|
return useMemo(() => target ? new Proxy(target, { get(target2, key) {
|
|
@@ -6019,7 +6020,8 @@ var __objRest$1 = (source, exclude) => {
|
|
|
6019
6020
|
}
|
|
6020
6021
|
return target;
|
|
6021
6022
|
};
|
|
6022
|
-
var
|
|
6023
|
+
var defaultManager = new DragDropManager();
|
|
6024
|
+
var DragDropContext = createContext(defaultManager);
|
|
6023
6025
|
var Renderer = memo(forwardRef(({ children }, ref) => {
|
|
6024
6026
|
const [transitionCount, setTransitionCount] = useState(0);
|
|
6025
6027
|
const rendering = useRef(null);
|
|
@@ -6854,7 +6856,7 @@ var Sortable2 = class {
|
|
|
6854
6856
|
var _a2, _b2, _c;
|
|
6855
6857
|
const status = (_a2 = this.manager) == null ? void 0 : _a2.dragOperation.status;
|
|
6856
6858
|
if ((status == null ? void 0 : status.initializing) && this.id === ((_c = (_b2 = this.manager) == null ? void 0 : _b2.dragOperation.source) == null ? void 0 : _c.id)) store.clear(this.manager);
|
|
6857
|
-
if (status == null ? void 0 : status.dragging) store.set(this.manager, this.id,
|
|
6859
|
+
if (status == null ? void 0 : status.dragging) store.set(this.manager, this.id, f(() => ({
|
|
6858
6860
|
initialIndex: this.index,
|
|
6859
6861
|
initialGroup: this.group
|
|
6860
6862
|
})));
|
|
@@ -6898,7 +6900,7 @@ var Sortable2 = class {
|
|
|
6898
6900
|
return (_b = (_a = store.get(this.manager, this.id)) == null ? void 0 : _a.initialGroup) != null ? _b : this.group;
|
|
6899
6901
|
}
|
|
6900
6902
|
animate() {
|
|
6901
|
-
|
|
6903
|
+
f(() => {
|
|
6902
6904
|
const { manager, transition } = this;
|
|
6903
6905
|
const { shape } = this.droppable;
|
|
6904
6906
|
if (!manager) return;
|
|
@@ -7208,10 +7210,15 @@ function shouldUpdateSynchronously(key, oldValue, newValue) {
|
|
|
7208
7210
|
}
|
|
7209
7211
|
//#endregion
|
|
7210
7212
|
//#region lib/components/draggable/draggable.tsx
|
|
7213
|
+
var isNumberValue = (value) => Object.prototype.toString.call(value) === "[object Number]";
|
|
7214
|
+
var mergeItem = (item, newValue) => ({
|
|
7215
|
+
...item,
|
|
7216
|
+
...newValue
|
|
7217
|
+
});
|
|
7211
7218
|
var getSortableIndexes = (event) => {
|
|
7212
7219
|
const oldIndex = event.operation?.source?.sortable?.initialIndex;
|
|
7213
7220
|
const newIndex = event.operation?.source?.sortable?.index;
|
|
7214
|
-
if (
|
|
7221
|
+
if (!isNumberValue(oldIndex) || !isNumberValue(newIndex)) return null;
|
|
7215
7222
|
return {
|
|
7216
7223
|
oldIndex,
|
|
7217
7224
|
newIndex
|
|
@@ -7270,12 +7277,14 @@ var SortableItem = ({ id, index, disabled, children, axis }) => {
|
|
|
7270
7277
|
var Draggable = (props) => {
|
|
7271
7278
|
const { children, items, onChange, noReorder, axis = "both", className, onAfterItemRemove, hidden, ...rest } = props;
|
|
7272
7279
|
const normalizedItems = useMemo(() => Array.isArray(items) ? items : [], [items]);
|
|
7273
|
-
if (
|
|
7280
|
+
if (items === void 0 || items === null || !Array.isArray(items)) console.warn(__("Draggable: 'items' are not an array or are undefined!", "eightshift-ui-components"));
|
|
7274
7281
|
const [internalIds, setInternalIds] = useState(normalizedItems.map((_, itemIndex) => itemIndex));
|
|
7275
7282
|
useEffect(() => {
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7283
|
+
queueMicrotask(() => {
|
|
7284
|
+
setInternalIds((currentIds) => {
|
|
7285
|
+
if (normalizedItems.length === currentIds.length) return currentIds;
|
|
7286
|
+
return normalizedItems.map((_, itemIndex) => itemIndex);
|
|
7287
|
+
});
|
|
7279
7288
|
});
|
|
7280
7289
|
}, [normalizedItems]);
|
|
7281
7290
|
if (hidden) return null;
|
|
@@ -7305,11 +7314,7 @@ var Draggable = (props) => {
|
|
|
7305
7314
|
children: children({
|
|
7306
7315
|
...item,
|
|
7307
7316
|
updateData: (newValue) => {
|
|
7308
|
-
const updated =
|
|
7309
|
-
updated[itemIndex] = {
|
|
7310
|
-
...updated[itemIndex],
|
|
7311
|
-
...newValue
|
|
7312
|
-
};
|
|
7317
|
+
const updated = normalizedItems.map((currentItem, index) => index === itemIndex ? mergeItem(currentItem, newValue) : currentItem);
|
|
7313
7318
|
onChange(updated);
|
|
7314
7319
|
},
|
|
7315
7320
|
itemIndex,
|