eat-js-sdk 2.0.30 → 2.0.31
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/interaction-builder.mjs +35 -14
- package/package.json +1 -1
|
@@ -13649,6 +13649,9 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
13649
13649
|
let itemId = prop($$props, "itemId", 7), itemText = prop($$props, "itemText", 7), containerId = prop($$props, "containerId", 7), mode = prop($$props, "mode", 7), isSelected = prop($$props, "isSelected", 7, false), isLocked = prop($$props, "isLocked", 7, false), resultType = prop($$props, "resultType", 7, ""), hasAnyItemSelected = prop($$props, "hasAnyItemSelected", 7, false), isCurrentMobileItem = prop($$props, "isCurrentMobileItem", 7, true), isClonedItem = prop($$props, "isClonedItem", 7, false), isConsideredItem = prop($$props, "isConsideredItem", 7, false), currentTabContainer = prop($$props, "currentTabContainer", 7, null), additionalClasses = prop($$props, "additionalClasses", 7, ""), onclick = prop($$props, "onclick", 7), onkeydown = prop($$props, "onkeydown", 7);
|
|
13650
13650
|
const ariaWord = useRemoveRichTextHtmlTags(itemText());
|
|
13651
13651
|
const isWordBin = containerId() === CATEGORISE.CONTAINER_WORD_BIN_ID;
|
|
13652
|
+
let touchStartX = /* @__PURE__ */ state(0);
|
|
13653
|
+
let touchStartY = /* @__PURE__ */ state(0);
|
|
13654
|
+
let isDragging2 = /* @__PURE__ */ state(false);
|
|
13652
13655
|
const ariaLabel = /* @__PURE__ */ user_derived(() => () => {
|
|
13653
13656
|
if (resultType() === ANSWER_RESULTS.INCORRECT && isWordBin && !isSelected()) {
|
|
13654
13657
|
return `Skipped answer: ${ariaWord}`;
|
|
@@ -13661,7 +13664,7 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
13661
13664
|
}
|
|
13662
13665
|
return `${isSelected() ? "Selected option" : "Option"}: ${ariaWord}`;
|
|
13663
13666
|
});
|
|
13664
|
-
const
|
|
13667
|
+
const selectItem = (event2) => {
|
|
13665
13668
|
event2.stopPropagation();
|
|
13666
13669
|
if (isLocked()) return;
|
|
13667
13670
|
if (resultType() && mode() !== MODES.INTERACTIVE) return;
|
|
@@ -13670,6 +13673,28 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
13670
13673
|
onclick()();
|
|
13671
13674
|
}
|
|
13672
13675
|
};
|
|
13676
|
+
const handleTouchStart = (event2) => {
|
|
13677
|
+
set(isDragging2, false);
|
|
13678
|
+
if (event2.touches.length > 0) {
|
|
13679
|
+
set(touchStartX, event2.touches[0].clientX, true);
|
|
13680
|
+
set(touchStartY, event2.touches[0].clientY, true);
|
|
13681
|
+
}
|
|
13682
|
+
};
|
|
13683
|
+
const handleTouchMove = (event2) => {
|
|
13684
|
+
if (event2.touches.length > 0) {
|
|
13685
|
+
const deltaX = Math.abs(event2.touches[0].clientX - get$1(touchStartX));
|
|
13686
|
+
const deltaY = Math.abs(event2.touches[0].clientY - get$1(touchStartY));
|
|
13687
|
+
if (deltaX > 10 || deltaY > 10) {
|
|
13688
|
+
set(isDragging2, true);
|
|
13689
|
+
}
|
|
13690
|
+
}
|
|
13691
|
+
};
|
|
13692
|
+
const handleTouchEnd = (event2) => {
|
|
13693
|
+
if (!get$1(isDragging2)) {
|
|
13694
|
+
selectItem(event2);
|
|
13695
|
+
}
|
|
13696
|
+
set(isDragging2, false);
|
|
13697
|
+
};
|
|
13673
13698
|
const handleKeyDown = (event2) => {
|
|
13674
13699
|
if (event2.key === "Enter" || event2.key === "Escape") {
|
|
13675
13700
|
event2.preventDefault();
|
|
@@ -13877,7 +13902,10 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
13877
13902
|
}
|
|
13878
13903
|
};
|
|
13879
13904
|
var button = root$6();
|
|
13880
|
-
button.__click =
|
|
13905
|
+
button.__click = selectItem;
|
|
13906
|
+
button.__touchstart = handleTouchStart;
|
|
13907
|
+
button.__touchmove = handleTouchMove;
|
|
13908
|
+
button.__touchend = handleTouchEnd;
|
|
13881
13909
|
button.__keydown = handleKeyDown;
|
|
13882
13910
|
var span = child(button);
|
|
13883
13911
|
var node = child(span);
|
|
@@ -13991,7 +14019,7 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
13991
14019
|
append($$anchor, button);
|
|
13992
14020
|
return pop($$exports);
|
|
13993
14021
|
}
|
|
13994
|
-
delegate(["click", "keydown"]);
|
|
14022
|
+
delegate(["click", "touchstart", "touchmove", "touchend", "keydown"]);
|
|
13995
14023
|
create_custom_element(
|
|
13996
14024
|
CategoriseItem,
|
|
13997
14025
|
{
|
|
@@ -14116,9 +14144,7 @@ function CategoriseDndContainer($$anchor, $$props) {
|
|
|
14116
14144
|
zoneItemTabIndex: get$1(getZoneItemTabIndex)(),
|
|
14117
14145
|
zoneTabIndex: -1,
|
|
14118
14146
|
autoAriaDisabled: true,
|
|
14119
|
-
keyboardDisabled: true
|
|
14120
|
-
delayTouchStart: 30
|
|
14121
|
-
// 30ms delay - quick enough for dragging, slow enough to detect clicks
|
|
14147
|
+
keyboardDisabled: true
|
|
14122
14148
|
}));
|
|
14123
14149
|
const isEmpty = /* @__PURE__ */ user_derived(() => get$1(dndItems).length === 0);
|
|
14124
14150
|
const isSourceContainer = /* @__PURE__ */ user_derived(() => () => {
|
|
@@ -15259,11 +15285,7 @@ function CategoriseModal($$anchor, $$props) {
|
|
|
15259
15285
|
const handleReset = () => {
|
|
15260
15286
|
if (onreset()) onreset()();
|
|
15261
15287
|
};
|
|
15262
|
-
const modalData = /* @__PURE__ */ user_derived(() => ({
|
|
15263
|
-
isModalOpen: isOpen(),
|
|
15264
|
-
modalAriaLabel: "Reset words",
|
|
15265
|
-
isOpenLastStatus: false
|
|
15266
|
-
}));
|
|
15288
|
+
const modalData = /* @__PURE__ */ user_derived(() => ({ isModalOpen: isOpen(), modalAriaLabel: "Reset words" }));
|
|
15267
15289
|
var $$exports = {
|
|
15268
15290
|
get isOpen() {
|
|
15269
15291
|
return isOpen();
|
|
@@ -15291,9 +15313,8 @@ function CategoriseModal($$anchor, $$props) {
|
|
|
15291
15313
|
get modalData() {
|
|
15292
15314
|
return get$1(modalData);
|
|
15293
15315
|
},
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
modalClass: "bg-charcoal/30",
|
|
15316
|
+
modalClass: "bg-charcoal/30 pointer-events-none",
|
|
15317
|
+
onclose: handleClose,
|
|
15297
15318
|
children: ($$anchor2, $$slotProps) => {
|
|
15298
15319
|
var fragment_1 = root_1$5();
|
|
15299
15320
|
var div = first_child(fragment_1);
|