@roqua/quby-frontend 0.10.16 → 0.10.17
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/quby-frontend.es.js +76 -57
- package/dist/quby-frontend.umd.js +119 -96
- package/package.json +1 -1
package/dist/quby-frontend.es.js
CHANGED
|
@@ -19,7 +19,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
19
19
|
};
|
|
20
20
|
var _flatOptions;
|
|
21
21
|
import * as React$1 from "react";
|
|
22
|
-
import React__default, { createContext, useContext, useState, useRef, useEffect, memo } from "react";
|
|
22
|
+
import React__default, { createContext, useContext, useState, useRef, useEffect, createElement, memo } from "react";
|
|
23
23
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
24
24
|
import root from "react-shadow";
|
|
25
25
|
const consoleLogger = {
|
|
@@ -14049,16 +14049,15 @@ var lib = {};
|
|
|
14049
14049
|
var Range$1 = {};
|
|
14050
14050
|
var utils = {};
|
|
14051
14051
|
var types = {};
|
|
14052
|
-
(
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
})(types);
|
|
14052
|
+
Object.defineProperty(types, "__esModule", { value: true });
|
|
14053
|
+
types.Direction = void 0;
|
|
14054
|
+
var Direction;
|
|
14055
|
+
(function(Direction2) {
|
|
14056
|
+
Direction2["Right"] = "to right";
|
|
14057
|
+
Direction2["Left"] = "to left";
|
|
14058
|
+
Direction2["Down"] = "to bottom";
|
|
14059
|
+
Direction2["Up"] = "to top";
|
|
14060
|
+
})(Direction || (types.Direction = Direction = {}));
|
|
14062
14061
|
(function(exports) {
|
|
14063
14062
|
var __spreadArray2 = commonjsGlobal && commonjsGlobal.__spreadArray || function(to, from, pack) {
|
|
14064
14063
|
if (pack || arguments.length === 2)
|
|
@@ -14072,7 +14071,7 @@ var types = {};
|
|
|
14072
14071
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
14073
14072
|
};
|
|
14074
14073
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14075
|
-
exports.useThumbOverlap = exports.assertUnreachable = exports.voidFn = exports.getTrackBackground = exports.replaceAt = exports.schd = exports.translate = exports.getClosestThumbIndex = exports.translateThumbs = exports.getPaddingAndBorder = exports.getMargin = exports.checkInitialOverlap = exports.checkValuesAgainstBoundaries = exports.checkBoundaries = exports.isVertical = exports.relativeValue = exports.normalizeValue = exports.isStepDivisible = exports.isTouchEvent = exports.getStepDecimals = void 0;
|
|
14074
|
+
exports.isIOS = exports.useThumbOverlap = exports.assertUnreachable = exports.voidFn = exports.getTrackBackground = exports.replaceAt = exports.schd = exports.translate = exports.getClosestThumbIndex = exports.translateThumbs = exports.getPaddingAndBorder = exports.getMargin = exports.checkInitialOverlap = exports.checkValuesAgainstBoundaries = exports.checkBoundaries = exports.isVertical = exports.relativeValue = exports.normalizeValue = exports.isStepDivisible = exports.isTouchEvent = exports.getStepDecimals = void 0;
|
|
14076
14075
|
var react_1 = React__default;
|
|
14077
14076
|
var types_12 = types;
|
|
14078
14077
|
var getStepDecimals = function(step) {
|
|
@@ -14352,6 +14351,20 @@ var types = {};
|
|
|
14352
14351
|
var _a = thumbEl.getBoundingClientRect(), left = _a.left, top = _a.top, width = _a.width, height = _a.height;
|
|
14353
14352
|
return isVertical(direction) ? Math.abs(clientY - (top + height / 2)) : Math.abs(clientX - (left + width / 2));
|
|
14354
14353
|
}
|
|
14354
|
+
var isIOS = function() {
|
|
14355
|
+
var _a;
|
|
14356
|
+
var platform = ((_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.platform) || navigator.platform;
|
|
14357
|
+
return [
|
|
14358
|
+
"iPad Simulator",
|
|
14359
|
+
"iPhone Simulator",
|
|
14360
|
+
"iPod Simulator",
|
|
14361
|
+
"iPad",
|
|
14362
|
+
"iPhone",
|
|
14363
|
+
"iPod"
|
|
14364
|
+
].includes(platform) || // iPad on iOS 13 detection
|
|
14365
|
+
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
14366
|
+
};
|
|
14367
|
+
exports.isIOS = isIOS;
|
|
14355
14368
|
})(utils);
|
|
14356
14369
|
var __extends = commonjsGlobal && commonjsGlobal.__extends || function() {
|
|
14357
14370
|
var extendStatics = function(d2, b2) {
|
|
@@ -14443,6 +14456,10 @@ var Range = (
|
|
|
14443
14456
|
_this.getOffsets = function() {
|
|
14444
14457
|
var _a = _this.props, direction = _a.direction, values = _a.values, min = _a.min, max = _a.max;
|
|
14445
14458
|
var trackElement = _this.trackRef.current;
|
|
14459
|
+
if (!trackElement) {
|
|
14460
|
+
console.warn("No track element found.");
|
|
14461
|
+
return [];
|
|
14462
|
+
}
|
|
14446
14463
|
var trackRect = trackElement.getBoundingClientRect();
|
|
14447
14464
|
var trackPadding = (0, utils_1.getPaddingAndBorder)(trackElement);
|
|
14448
14465
|
return _this.getThumbs().map(function(thumb, index) {
|
|
@@ -14506,7 +14523,7 @@ var Range = (
|
|
|
14506
14523
|
};
|
|
14507
14524
|
_this.onMouseDownTrack = function(e2) {
|
|
14508
14525
|
var _a;
|
|
14509
|
-
if (e2.button !== 0)
|
|
14526
|
+
if (e2.button !== 0 || (0, utils_1.isIOS)())
|
|
14510
14527
|
return;
|
|
14511
14528
|
e2.persist();
|
|
14512
14529
|
e2.preventDefault();
|
|
@@ -14852,7 +14869,7 @@ var Range = (
|
|
|
14852
14869
|
};
|
|
14853
14870
|
Range2.prototype.render = function() {
|
|
14854
14871
|
var _this = this;
|
|
14855
|
-
var _a = this.props, renderTrack = _a.renderTrack, renderThumb2 = _a.renderThumb, _b = _a.renderMark, renderMark2 = _b === void 0 ? function() {
|
|
14872
|
+
var _a = this.props, label = _a.label, labelledBy = _a.labelledBy, renderTrack = _a.renderTrack, renderThumb2 = _a.renderThumb, _b = _a.renderMark, renderMark2 = _b === void 0 ? function() {
|
|
14856
14873
|
return null;
|
|
14857
14874
|
} : _b, values = _a.values, min = _a.min, max = _a.max, allowOverlap = _a.allowOverlap, disabled = _a.disabled;
|
|
14858
14875
|
var _c = this.state, draggedThumbIndex = _c.draggedThumbIndex, thumbZIndexes = _c.thumbZIndexes, markOffsets = _c.markOffsets;
|
|
@@ -14911,6 +14928,8 @@ var Range = (
|
|
|
14911
14928
|
"aria-valuenow": value,
|
|
14912
14929
|
draggable: false,
|
|
14913
14930
|
ref: _this.thumbRefs[index],
|
|
14931
|
+
"aria-label": label,
|
|
14932
|
+
"aria-labelledby": labelledBy,
|
|
14914
14933
|
role: "slider",
|
|
14915
14934
|
onKeyDown: disabled ? utils_1.voidFn : _this.onKeyDown,
|
|
14916
14935
|
onKeyUp: disabled ? utils_1.voidFn : _this.onKeyUp
|
|
@@ -14920,6 +14939,8 @@ var Range = (
|
|
|
14920
14939
|
});
|
|
14921
14940
|
};
|
|
14922
14941
|
Range2.defaultProps = {
|
|
14942
|
+
label: "Accessibility label",
|
|
14943
|
+
labelledBy: null,
|
|
14923
14944
|
step: 1,
|
|
14924
14945
|
direction: types_1.Direction.Right,
|
|
14925
14946
|
rtl: false,
|
|
@@ -15004,12 +15025,13 @@ const SliderQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
|
15004
15025
|
};
|
|
15005
15026
|
const renderThumb$1 = ({ props, value, isDragged, blank, showTooltip, startThumbHidden, isActiveQuestion, onFocus }) => {
|
|
15006
15027
|
if (startThumbHidden && blank) {
|
|
15007
|
-
return /* @__PURE__ */
|
|
15028
|
+
return /* @__PURE__ */ createElement("div", { ...props, key: props.key });
|
|
15008
15029
|
}
|
|
15009
|
-
return /* @__PURE__ */
|
|
15030
|
+
return /* @__PURE__ */ createElement(
|
|
15010
15031
|
"div",
|
|
15011
15032
|
{
|
|
15012
15033
|
...props,
|
|
15034
|
+
key: props.key,
|
|
15013
15035
|
style: {
|
|
15014
15036
|
...props.style,
|
|
15015
15037
|
...baseThumbStyles$1,
|
|
@@ -15017,27 +15039,26 @@ const renderThumb$1 = ({ props, value, isDragged, blank, showTooltip, startThumb
|
|
|
15017
15039
|
...isActiveQuestion && activeThumbStyles,
|
|
15018
15040
|
...blank && invalidThumbStyles$1
|
|
15019
15041
|
},
|
|
15020
|
-
onFocus
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
]
|
|
15031
|
-
}
|
|
15042
|
+
onFocus
|
|
15043
|
+
},
|
|
15044
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
15045
|
+
margin: "6px auto",
|
|
15046
|
+
width: "6px",
|
|
15047
|
+
height: "14px",
|
|
15048
|
+
border: "1px solid oklch(var(--foreground))",
|
|
15049
|
+
borderWidth: "0 1px 0 1px"
|
|
15050
|
+
} }),
|
|
15051
|
+
showTooltip && isDragged && /* @__PURE__ */ jsx("div", { style: labelStyles$1, children: value })
|
|
15032
15052
|
);
|
|
15033
15053
|
};
|
|
15034
15054
|
const renderMark$1 = (props, label, { info, setRef }) => {
|
|
15035
15055
|
const top = LABEL_MIN_ARROW_HEIGHT + (info.tops[label.idx] || 0);
|
|
15036
15056
|
const labelBorderRadius = label.first ? "0 4px 4px" : label.last ? "4px 0 4px 4px" : "4px";
|
|
15037
|
-
return /* @__PURE__ */
|
|
15057
|
+
return /* @__PURE__ */ createElement(
|
|
15038
15058
|
"div",
|
|
15039
15059
|
{
|
|
15040
15060
|
...props,
|
|
15061
|
+
key: props.key,
|
|
15041
15062
|
style: {
|
|
15042
15063
|
...props.style,
|
|
15043
15064
|
top: TRACK_HEIGHT - TRACK_BORDER,
|
|
@@ -15045,35 +15066,33 @@ const renderMark$1 = (props, label, { info, setRef }) => {
|
|
|
15045
15066
|
// set by react-range
|
|
15046
15067
|
width: 0
|
|
15047
15068
|
// important so react-range does not add negative margins to center.
|
|
15048
|
-
}
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15056
|
-
}
|
|
15057
|
-
},
|
|
15058
|
-
style: {
|
|
15059
|
-
position: "absolute",
|
|
15060
|
-
top,
|
|
15061
|
-
left: -TRACK_BORDER,
|
|
15062
|
-
width: "max-content",
|
|
15063
|
-
maxWidth: info.maxWidths[label.idx],
|
|
15064
|
-
backgroundColor: "oklch(var(--slider-track))",
|
|
15065
|
-
borderRadius: labelBorderRadius,
|
|
15066
|
-
border: `${LABEL_BORDER}px solid oklch(var(--foreground))`,
|
|
15067
|
-
padding: "0 4px",
|
|
15068
|
-
textAlign: label.first ? "left" : label.last ? "right" : "center",
|
|
15069
|
-
transform: label.first ? void 0 : label.last ? "translateX(-100%)" : "translateX(-50%)"
|
|
15070
|
-
},
|
|
15071
|
-
dangerouslySetInnerHTML: { __html: label.text }
|
|
15069
|
+
}
|
|
15070
|
+
},
|
|
15071
|
+
/* @__PURE__ */ jsx(
|
|
15072
|
+
"div",
|
|
15073
|
+
{
|
|
15074
|
+
ref: (node) => {
|
|
15075
|
+
if (node) {
|
|
15076
|
+
setRef(label.idx, node);
|
|
15072
15077
|
}
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15078
|
+
},
|
|
15079
|
+
style: {
|
|
15080
|
+
position: "absolute",
|
|
15081
|
+
top,
|
|
15082
|
+
left: -TRACK_BORDER,
|
|
15083
|
+
width: "max-content",
|
|
15084
|
+
maxWidth: info.maxWidths[label.idx],
|
|
15085
|
+
backgroundColor: "oklch(var(--slider-track))",
|
|
15086
|
+
borderRadius: labelBorderRadius,
|
|
15087
|
+
border: `${LABEL_BORDER}px solid oklch(var(--foreground))`,
|
|
15088
|
+
padding: "0 4px",
|
|
15089
|
+
textAlign: label.first ? "left" : label.last ? "right" : "center",
|
|
15090
|
+
transform: label.first ? void 0 : label.last ? "translateX(-100%)" : "translateX(-50%)"
|
|
15091
|
+
},
|
|
15092
|
+
dangerouslySetInnerHTML: { __html: label.text }
|
|
15093
|
+
}
|
|
15094
|
+
),
|
|
15095
|
+
/* @__PURE__ */ jsx(LabelArrow, { label, top })
|
|
15077
15096
|
);
|
|
15078
15097
|
};
|
|
15079
15098
|
const LabelArrow = ({ top, label }) => {
|
|
@@ -22,7 +22,10 @@ var __privateAdd = (obj, member, value) => {
|
|
|
22
22
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
|
|
26
|
+
function _interopNamespace(e2) {
|
|
27
|
+
if (e2 && e2.__esModule)
|
|
28
|
+
return e2;
|
|
26
29
|
const n2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
27
30
|
if (e2) {
|
|
28
31
|
for (const k2 in e2) {
|
|
@@ -38,7 +41,8 @@ var __privateAdd = (obj, member, value) => {
|
|
|
38
41
|
n2.default = e2;
|
|
39
42
|
return Object.freeze(n2);
|
|
40
43
|
}
|
|
41
|
-
const React__namespace = /* @__PURE__ */
|
|
44
|
+
const React__namespace = /* @__PURE__ */ _interopNamespace(React$1);
|
|
45
|
+
const root__default = /* @__PURE__ */ _interopDefault(root);
|
|
42
46
|
const consoleLogger = {
|
|
43
47
|
type: "logger",
|
|
44
48
|
log(args) {
|
|
@@ -13339,7 +13343,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13339
13343
|
newLayout: true
|
|
13340
13344
|
};
|
|
13341
13345
|
const defaultSetQuestionRef = (_key, _ref) => null;
|
|
13342
|
-
const QubyContext =
|
|
13346
|
+
const QubyContext = React__namespace.default.createContext({
|
|
13343
13347
|
questionnaire: defaultQuestionnaire,
|
|
13344
13348
|
response: defaultResponse,
|
|
13345
13349
|
setQuestionRef: defaultSetQuestionRef,
|
|
@@ -13536,7 +13540,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13536
13540
|
}
|
|
13537
13541
|
}
|
|
13538
13542
|
function useMightBecomeValid(value, handleChange) {
|
|
13539
|
-
const [localValue, setLocalValue] =
|
|
13543
|
+
const [localValue, setLocalValue] = React__namespace.default.useState(value);
|
|
13540
13544
|
return {
|
|
13541
13545
|
onChange: (event) => {
|
|
13542
13546
|
const result = handleChange(event.target.value);
|
|
@@ -13578,7 +13582,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13578
13582
|
}
|
|
13579
13583
|
}
|
|
13580
13584
|
};
|
|
13581
|
-
|
|
13585
|
+
React__namespace.default.useEffect(() => {
|
|
13582
13586
|
document.addEventListener("keydown", handleKeyDown);
|
|
13583
13587
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
13584
13588
|
});
|
|
@@ -13622,11 +13626,11 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13622
13626
|
] }) });
|
|
13623
13627
|
};
|
|
13624
13628
|
const HtmlItem = ({ item }) => {
|
|
13625
|
-
const interpolateCurlies =
|
|
13629
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
13626
13630
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "item", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose text", dangerouslySetInnerHTML: { __html: interpolateCurlies(item.html) } }) });
|
|
13627
13631
|
};
|
|
13628
13632
|
const MainLabel = ({ question }) => {
|
|
13629
|
-
const interpolateCurlies =
|
|
13633
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
13630
13634
|
if (!question.title)
|
|
13631
13635
|
return null;
|
|
13632
13636
|
const titleText = interpolateCurlies(question.title);
|
|
@@ -13635,7 +13639,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13635
13639
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${mb} main`, children: /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: labelFor, dangerouslySetInnerHTML: { __html: titleText } }) });
|
|
13636
13640
|
};
|
|
13637
13641
|
const QuestionDescription = (props) => {
|
|
13638
|
-
const interpolateCurlies =
|
|
13642
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
13639
13643
|
if (!props.question.description)
|
|
13640
13644
|
return null;
|
|
13641
13645
|
const description = interpolateCurlies(props.question.description);
|
|
@@ -13662,7 +13666,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13662
13666
|
}
|
|
13663
13667
|
const QuestionWrapper = (props) => {
|
|
13664
13668
|
const { question, fieldState, setQuestionRef } = props;
|
|
13665
|
-
const questionRef =
|
|
13669
|
+
const questionRef = React__namespace.default.useRef(null);
|
|
13666
13670
|
setQuestionRef(question.key, questionRef);
|
|
13667
13671
|
const className = classNames("item", "question", question.type, question.presentation, question.questionGroup, question.as, {
|
|
13668
13672
|
errors: fieldState.showErrors,
|
|
@@ -13678,7 +13682,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13678
13682
|
] });
|
|
13679
13683
|
};
|
|
13680
13684
|
const ContextDescriptionItem = ({ html }) => {
|
|
13681
|
-
const interpolateCurlies =
|
|
13685
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
13682
13686
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "context-description prose", dangerouslySetInnerHTML: { __html: interpolateCurlies(html) } });
|
|
13683
13687
|
};
|
|
13684
13688
|
const StringQuestion = ({ question, fieldState, setQuestionRef }) => {
|
|
@@ -13775,7 +13779,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13775
13779
|
] });
|
|
13776
13780
|
};
|
|
13777
13781
|
const ShowDescription$1 = ({ option }) => {
|
|
13778
|
-
const interpolateCurlies =
|
|
13782
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
13779
13783
|
const description = option.label || option.description;
|
|
13780
13784
|
if (!description)
|
|
13781
13785
|
return null;
|
|
@@ -13858,7 +13862,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
13858
13862
|
] });
|
|
13859
13863
|
};
|
|
13860
13864
|
const ShowDescription = ({ option }) => {
|
|
13861
|
-
const interpolateCurlies =
|
|
13865
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
13862
13866
|
if (!option.label && !option.description)
|
|
13863
13867
|
return null;
|
|
13864
13868
|
const label = option.label || option.description;
|
|
@@ -14066,16 +14070,15 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14066
14070
|
var Range$1 = {};
|
|
14067
14071
|
var utils = {};
|
|
14068
14072
|
var types = {};
|
|
14069
|
-
(
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
})(types);
|
|
14073
|
+
Object.defineProperty(types, "__esModule", { value: true });
|
|
14074
|
+
types.Direction = void 0;
|
|
14075
|
+
var Direction;
|
|
14076
|
+
(function(Direction2) {
|
|
14077
|
+
Direction2["Right"] = "to right";
|
|
14078
|
+
Direction2["Left"] = "to left";
|
|
14079
|
+
Direction2["Down"] = "to bottom";
|
|
14080
|
+
Direction2["Up"] = "to top";
|
|
14081
|
+
})(Direction || (types.Direction = Direction = {}));
|
|
14079
14082
|
(function(exports3) {
|
|
14080
14083
|
var __spreadArray2 = commonjsGlobal && commonjsGlobal.__spreadArray || function(to, from, pack) {
|
|
14081
14084
|
if (pack || arguments.length === 2)
|
|
@@ -14089,8 +14092,8 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14089
14092
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
14090
14093
|
};
|
|
14091
14094
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
14092
|
-
exports3.useThumbOverlap = exports3.assertUnreachable = exports3.voidFn = exports3.getTrackBackground = exports3.replaceAt = exports3.schd = exports3.translate = exports3.getClosestThumbIndex = exports3.translateThumbs = exports3.getPaddingAndBorder = exports3.getMargin = exports3.checkInitialOverlap = exports3.checkValuesAgainstBoundaries = exports3.checkBoundaries = exports3.isVertical = exports3.relativeValue = exports3.normalizeValue = exports3.isStepDivisible = exports3.isTouchEvent = exports3.getStepDecimals = void 0;
|
|
14093
|
-
var react_1 =
|
|
14095
|
+
exports3.isIOS = exports3.useThumbOverlap = exports3.assertUnreachable = exports3.voidFn = exports3.getTrackBackground = exports3.replaceAt = exports3.schd = exports3.translate = exports3.getClosestThumbIndex = exports3.translateThumbs = exports3.getPaddingAndBorder = exports3.getMargin = exports3.checkInitialOverlap = exports3.checkValuesAgainstBoundaries = exports3.checkBoundaries = exports3.isVertical = exports3.relativeValue = exports3.normalizeValue = exports3.isStepDivisible = exports3.isTouchEvent = exports3.getStepDecimals = void 0;
|
|
14096
|
+
var react_1 = React__namespace.default;
|
|
14094
14097
|
var types_12 = types;
|
|
14095
14098
|
var getStepDecimals = function(step) {
|
|
14096
14099
|
var decimals = step.toString().split(".")[1];
|
|
@@ -14369,6 +14372,20 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14369
14372
|
var _a = thumbEl.getBoundingClientRect(), left = _a.left, top = _a.top, width = _a.width, height = _a.height;
|
|
14370
14373
|
return isVertical(direction) ? Math.abs(clientY - (top + height / 2)) : Math.abs(clientX - (left + width / 2));
|
|
14371
14374
|
}
|
|
14375
|
+
var isIOS = function() {
|
|
14376
|
+
var _a;
|
|
14377
|
+
var platform = ((_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.platform) || navigator.platform;
|
|
14378
|
+
return [
|
|
14379
|
+
"iPad Simulator",
|
|
14380
|
+
"iPhone Simulator",
|
|
14381
|
+
"iPod Simulator",
|
|
14382
|
+
"iPad",
|
|
14383
|
+
"iPhone",
|
|
14384
|
+
"iPod"
|
|
14385
|
+
].includes(platform) || // iPad on iOS 13 detection
|
|
14386
|
+
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
14387
|
+
};
|
|
14388
|
+
exports3.isIOS = isIOS;
|
|
14372
14389
|
})(utils);
|
|
14373
14390
|
var __extends = commonjsGlobal && commonjsGlobal.__extends || function() {
|
|
14374
14391
|
var extendStatics = function(d2, b2) {
|
|
@@ -14435,7 +14452,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14435
14452
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
14436
14453
|
};
|
|
14437
14454
|
Object.defineProperty(Range$1, "__esModule", { value: true });
|
|
14438
|
-
var React = __importStar(
|
|
14455
|
+
var React = __importStar(React__namespace.default);
|
|
14439
14456
|
var utils_1 = utils;
|
|
14440
14457
|
var types_1 = types;
|
|
14441
14458
|
var INCREASE_KEYS = ["ArrowRight", "ArrowUp", "k", "PageUp"];
|
|
@@ -14460,6 +14477,10 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14460
14477
|
_this.getOffsets = function() {
|
|
14461
14478
|
var _a = _this.props, direction = _a.direction, values = _a.values, min = _a.min, max = _a.max;
|
|
14462
14479
|
var trackElement = _this.trackRef.current;
|
|
14480
|
+
if (!trackElement) {
|
|
14481
|
+
console.warn("No track element found.");
|
|
14482
|
+
return [];
|
|
14483
|
+
}
|
|
14463
14484
|
var trackRect = trackElement.getBoundingClientRect();
|
|
14464
14485
|
var trackPadding = (0, utils_1.getPaddingAndBorder)(trackElement);
|
|
14465
14486
|
return _this.getThumbs().map(function(thumb, index) {
|
|
@@ -14523,7 +14544,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14523
14544
|
};
|
|
14524
14545
|
_this.onMouseDownTrack = function(e2) {
|
|
14525
14546
|
var _a;
|
|
14526
|
-
if (e2.button !== 0)
|
|
14547
|
+
if (e2.button !== 0 || (0, utils_1.isIOS)())
|
|
14527
14548
|
return;
|
|
14528
14549
|
e2.persist();
|
|
14529
14550
|
e2.preventDefault();
|
|
@@ -14869,7 +14890,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14869
14890
|
};
|
|
14870
14891
|
Range2.prototype.render = function() {
|
|
14871
14892
|
var _this = this;
|
|
14872
|
-
var _a = this.props, renderTrack = _a.renderTrack, renderThumb2 = _a.renderThumb, _b = _a.renderMark, renderMark2 = _b === void 0 ? function() {
|
|
14893
|
+
var _a = this.props, label = _a.label, labelledBy = _a.labelledBy, renderTrack = _a.renderTrack, renderThumb2 = _a.renderThumb, _b = _a.renderMark, renderMark2 = _b === void 0 ? function() {
|
|
14873
14894
|
return null;
|
|
14874
14895
|
} : _b, values = _a.values, min = _a.min, max = _a.max, allowOverlap = _a.allowOverlap, disabled = _a.disabled;
|
|
14875
14896
|
var _c = this.state, draggedThumbIndex = _c.draggedThumbIndex, thumbZIndexes = _c.thumbZIndexes, markOffsets = _c.markOffsets;
|
|
@@ -14928,6 +14949,8 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14928
14949
|
"aria-valuenow": value,
|
|
14929
14950
|
draggable: false,
|
|
14930
14951
|
ref: _this.thumbRefs[index],
|
|
14952
|
+
"aria-label": label,
|
|
14953
|
+
"aria-labelledby": labelledBy,
|
|
14931
14954
|
role: "slider",
|
|
14932
14955
|
onKeyDown: disabled ? utils_1.voidFn : _this.onKeyDown,
|
|
14933
14956
|
onKeyUp: disabled ? utils_1.voidFn : _this.onKeyUp
|
|
@@ -14937,6 +14960,8 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14937
14960
|
});
|
|
14938
14961
|
};
|
|
14939
14962
|
Range2.defaultProps = {
|
|
14963
|
+
label: "Accessibility label",
|
|
14964
|
+
labelledBy: null,
|
|
14940
14965
|
step: 1,
|
|
14941
14966
|
direction: types_1.Direction.Right,
|
|
14942
14967
|
rtl: false,
|
|
@@ -14986,7 +15011,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
14986
15011
|
const handleChange = (newValues) => {
|
|
14987
15012
|
fieldState.setValue(newValues[0]);
|
|
14988
15013
|
};
|
|
14989
|
-
const parentRef =
|
|
15014
|
+
const parentRef = React__namespace.default.useRef(null);
|
|
14990
15015
|
const labelPositioning = useLabelPositioning(question.labels, parentRef);
|
|
14991
15016
|
const blank = fieldState.value == null;
|
|
14992
15017
|
const value = fieldState.value ?? question.defaultPosition;
|
|
@@ -15021,12 +15046,13 @@ var __privateAdd = (obj, member, value) => {
|
|
|
15021
15046
|
};
|
|
15022
15047
|
const renderThumb$1 = ({ props, value, isDragged, blank, showTooltip, startThumbHidden, isActiveQuestion, onFocus }) => {
|
|
15023
15048
|
if (startThumbHidden && blank) {
|
|
15024
|
-
return /* @__PURE__ */
|
|
15049
|
+
return /* @__PURE__ */ React$1.createElement("div", { ...props, key: props.key });
|
|
15025
15050
|
}
|
|
15026
|
-
return /* @__PURE__ */
|
|
15051
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
15027
15052
|
"div",
|
|
15028
15053
|
{
|
|
15029
15054
|
...props,
|
|
15055
|
+
key: props.key,
|
|
15030
15056
|
style: {
|
|
15031
15057
|
...props.style,
|
|
15032
15058
|
...baseThumbStyles$1,
|
|
@@ -15034,27 +15060,26 @@ var __privateAdd = (obj, member, value) => {
|
|
|
15034
15060
|
...isActiveQuestion && activeThumbStyles,
|
|
15035
15061
|
...blank && invalidThumbStyles$1
|
|
15036
15062
|
},
|
|
15037
|
-
onFocus
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
|
|
15047
|
-
]
|
|
15048
|
-
}
|
|
15063
|
+
onFocus
|
|
15064
|
+
},
|
|
15065
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
15066
|
+
margin: "6px auto",
|
|
15067
|
+
width: "6px",
|
|
15068
|
+
height: "14px",
|
|
15069
|
+
border: "1px solid oklch(var(--foreground))",
|
|
15070
|
+
borderWidth: "0 1px 0 1px"
|
|
15071
|
+
} }),
|
|
15072
|
+
showTooltip && isDragged && /* @__PURE__ */ jsxRuntime.jsx("div", { style: labelStyles$1, children: value })
|
|
15049
15073
|
);
|
|
15050
15074
|
};
|
|
15051
15075
|
const renderMark$1 = (props, label, { info, setRef }) => {
|
|
15052
15076
|
const top = LABEL_MIN_ARROW_HEIGHT + (info.tops[label.idx] || 0);
|
|
15053
15077
|
const labelBorderRadius = label.first ? "0 4px 4px" : label.last ? "4px 0 4px 4px" : "4px";
|
|
15054
|
-
return /* @__PURE__ */
|
|
15078
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
15055
15079
|
"div",
|
|
15056
15080
|
{
|
|
15057
15081
|
...props,
|
|
15082
|
+
key: props.key,
|
|
15058
15083
|
style: {
|
|
15059
15084
|
...props.style,
|
|
15060
15085
|
top: TRACK_HEIGHT - TRACK_BORDER,
|
|
@@ -15062,35 +15087,33 @@ var __privateAdd = (obj, member, value) => {
|
|
|
15062
15087
|
// set by react-range
|
|
15063
15088
|
width: 0
|
|
15064
15089
|
// important so react-range does not add negative margins to center.
|
|
15065
|
-
}
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
}
|
|
15074
|
-
},
|
|
15075
|
-
style: {
|
|
15076
|
-
position: "absolute",
|
|
15077
|
-
top,
|
|
15078
|
-
left: -TRACK_BORDER,
|
|
15079
|
-
width: "max-content",
|
|
15080
|
-
maxWidth: info.maxWidths[label.idx],
|
|
15081
|
-
backgroundColor: "oklch(var(--slider-track))",
|
|
15082
|
-
borderRadius: labelBorderRadius,
|
|
15083
|
-
border: `${LABEL_BORDER}px solid oklch(var(--foreground))`,
|
|
15084
|
-
padding: "0 4px",
|
|
15085
|
-
textAlign: label.first ? "left" : label.last ? "right" : "center",
|
|
15086
|
-
transform: label.first ? void 0 : label.last ? "translateX(-100%)" : "translateX(-50%)"
|
|
15087
|
-
},
|
|
15088
|
-
dangerouslySetInnerHTML: { __html: label.text }
|
|
15090
|
+
}
|
|
15091
|
+
},
|
|
15092
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15093
|
+
"div",
|
|
15094
|
+
{
|
|
15095
|
+
ref: (node) => {
|
|
15096
|
+
if (node) {
|
|
15097
|
+
setRef(label.idx, node);
|
|
15089
15098
|
}
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15093
|
-
|
|
15099
|
+
},
|
|
15100
|
+
style: {
|
|
15101
|
+
position: "absolute",
|
|
15102
|
+
top,
|
|
15103
|
+
left: -TRACK_BORDER,
|
|
15104
|
+
width: "max-content",
|
|
15105
|
+
maxWidth: info.maxWidths[label.idx],
|
|
15106
|
+
backgroundColor: "oklch(var(--slider-track))",
|
|
15107
|
+
borderRadius: labelBorderRadius,
|
|
15108
|
+
border: `${LABEL_BORDER}px solid oklch(var(--foreground))`,
|
|
15109
|
+
padding: "0 4px",
|
|
15110
|
+
textAlign: label.first ? "left" : label.last ? "right" : "center",
|
|
15111
|
+
transform: label.first ? void 0 : label.last ? "translateX(-100%)" : "translateX(-50%)"
|
|
15112
|
+
},
|
|
15113
|
+
dangerouslySetInnerHTML: { __html: label.text }
|
|
15114
|
+
}
|
|
15115
|
+
),
|
|
15116
|
+
/* @__PURE__ */ jsxRuntime.jsx(LabelArrow, { label, top })
|
|
15094
15117
|
);
|
|
15095
15118
|
};
|
|
15096
15119
|
const LabelArrow = ({ top, label }) => {
|
|
@@ -15151,14 +15174,14 @@ var __privateAdd = (obj, member, value) => {
|
|
|
15151
15174
|
padding: "0 4px"
|
|
15152
15175
|
};
|
|
15153
15176
|
const useLabelPositioning = (labels, parentRef) => {
|
|
15154
|
-
const labelRefs =
|
|
15155
|
-
const [info, setInfo] =
|
|
15156
|
-
const [step, setStep] =
|
|
15177
|
+
const labelRefs = React__namespace.default.useRef([]);
|
|
15178
|
+
const [info, setInfo] = React__namespace.default.useState({ maxWidths: [], rowHeights: [], tops: [], twoRows: false });
|
|
15179
|
+
const [step, setStep] = React__namespace.default.useState("getRefs");
|
|
15157
15180
|
let height = LABEL_MIN_ARROW_HEIGHT + info.rowHeights[0] || 18;
|
|
15158
15181
|
if (info.rowHeights.length == 2) {
|
|
15159
15182
|
height += LABEL_ROW_SPACING + info.rowHeights[1];
|
|
15160
15183
|
}
|
|
15161
|
-
|
|
15184
|
+
React__namespace.default.useLayoutEffect(() => {
|
|
15162
15185
|
if (step === "resize") {
|
|
15163
15186
|
setInfo({ ...info, twoRows: false, maxWidths: Array(labelRefs.current.length).fill(999) });
|
|
15164
15187
|
setStep("setWidths");
|
|
@@ -15170,7 +15193,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
15170
15193
|
setStep("done");
|
|
15171
15194
|
}
|
|
15172
15195
|
}, [step, labels, parentRef, info]);
|
|
15173
|
-
|
|
15196
|
+
React__namespace.default.useLayoutEffect(() => {
|
|
15174
15197
|
if (step !== "done")
|
|
15175
15198
|
return;
|
|
15176
15199
|
const oldRef = parentRef.current;
|
|
@@ -15425,7 +15448,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
15425
15448
|
] });
|
|
15426
15449
|
};
|
|
15427
15450
|
const Option$1 = ({ question, option, fieldState }) => {
|
|
15428
|
-
const interpolateCurlies =
|
|
15451
|
+
const interpolateCurlies = React__namespace.default.useContext(InterpolateCurliesContext);
|
|
15429
15452
|
const value = fieldState.value || /* @__PURE__ */ new Set();
|
|
15430
15453
|
const checked = value.has(option.key) || false;
|
|
15431
15454
|
if (option.hidden && !checked)
|
|
@@ -18405,7 +18428,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18405
18428
|
/* @__PURE__ */ jsxRuntime.jsx(MainLabel, { question }),
|
|
18406
18429
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "description-and-fields", children: [
|
|
18407
18430
|
/* @__PURE__ */ jsxRuntime.jsx(QuestionDescription, { question }),
|
|
18408
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "fields", id: htmlId(question), children: question.units.map((unit) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18431
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "fields", id: htmlId(question), children: question.units.map((unit) => /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.default.Fragment, { children: [
|
|
18409
18432
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18410
18433
|
"input",
|
|
18411
18434
|
{
|
|
@@ -18446,7 +18469,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18446
18469
|
return `answer_${question.key}_input`;
|
|
18447
18470
|
}
|
|
18448
18471
|
const QuestionItem = ({ fieldKey }) => {
|
|
18449
|
-
const { questionnaire, response, setQuestionRef, displayOptions } =
|
|
18472
|
+
const { questionnaire, response, setQuestionRef, displayOptions } = React__namespace.default.useContext(QubyContext);
|
|
18450
18473
|
const question = questionnaire.getField(fieldKey);
|
|
18451
18474
|
switch (question.as) {
|
|
18452
18475
|
case "string": {
|
|
@@ -18697,15 +18720,15 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18697
18720
|
return result;
|
|
18698
18721
|
}
|
|
18699
18722
|
const InfoItem = ({ item }) => {
|
|
18700
|
-
const [open, setOpen] =
|
|
18701
|
-
const [opening, setOpening] =
|
|
18723
|
+
const [open, setOpen] = React__namespace.default.useState(item.startOpen);
|
|
18724
|
+
const [opening, setOpening] = React__namespace.default.useState(false);
|
|
18702
18725
|
const { ref, inView } = useInView({
|
|
18703
18726
|
initialInView: true,
|
|
18704
18727
|
// prevents showing margin animation when it starts visible.
|
|
18705
18728
|
fallbackInView: false
|
|
18706
18729
|
// act as stuck when not supported, instead of raising an error.
|
|
18707
18730
|
});
|
|
18708
|
-
const { response } =
|
|
18731
|
+
const { response } = React__namespace.default.useContext(QubyContext);
|
|
18709
18732
|
const iconClick = (e2) => {
|
|
18710
18733
|
if ("key" in e2 && e2.key !== "Enter")
|
|
18711
18734
|
return;
|
|
@@ -18784,8 +18807,8 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18784
18807
|
};
|
|
18785
18808
|
const buttonsClassName = "buttons bg-slate-100 dark:bg-slate-700 p-panel-padding";
|
|
18786
18809
|
const Paginator = (props) => {
|
|
18787
|
-
const [activeIndex, setActiveIndex] =
|
|
18788
|
-
const topRef =
|
|
18810
|
+
const [activeIndex, setActiveIndex] = React__namespace.default.useState(props.panelLogic.firstPanelIndexToActivate());
|
|
18811
|
+
const topRef = React__namespace.default.useRef(null);
|
|
18789
18812
|
const prevIndex = props.panelLogic.previousPanelIndexToActivate(activeIndex);
|
|
18790
18813
|
const nextIndex = props.panelLogic.nextPanelIndexToActivate(activeIndex);
|
|
18791
18814
|
const navigate = {
|
|
@@ -18815,9 +18838,9 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18815
18838
|
] });
|
|
18816
18839
|
}
|
|
18817
18840
|
case "single_page": {
|
|
18818
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18841
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.default.Fragment, { children: [
|
|
18819
18842
|
/* @__PURE__ */ jsxRuntime.jsx("span", { ref: topRef, tabIndex: -1 }),
|
|
18820
|
-
props.panelLogic.panels.map((panel, index) => !props.panelLogic.allQuestionsHidden(index) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18843
|
+
props.panelLogic.panels.map((panel, index) => !props.panelLogic.allQuestionsHidden(index) && /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.default.Fragment, { children: [
|
|
18821
18844
|
/* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "panel", children: [
|
|
18822
18845
|
/* @__PURE__ */ jsxRuntime.jsx(PanelContent, { panel }),
|
|
18823
18846
|
props.panelLogic.isLastPanel(index) ? /* @__PURE__ */ jsxRuntime.jsx(Buttons, { firstPanel: false, lastPanel: true, navigate }) : null
|
|
@@ -18864,11 +18887,11 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18864
18887
|
const Hotkeys = () => {
|
|
18865
18888
|
return null;
|
|
18866
18889
|
};
|
|
18867
|
-
const InterpolateCurliesContext =
|
|
18890
|
+
const InterpolateCurliesContext = React__namespace.default.createContext((str) => str);
|
|
18868
18891
|
const AnswerPage = ({ questionnaire, response, displayOptions, allowSkipValidation, onSave, onAbort, onPreviousQuestionnaire }) => {
|
|
18869
18892
|
useRerenderOnResponseChange(response);
|
|
18870
18893
|
const [nextSavePressWillOnlyRunMinimalValidations, setNextSavePressWillOnlyRunMinimalValidations] = useNextSavePressWillOnlyRunMinimalValidations(response);
|
|
18871
|
-
const qubyRef =
|
|
18894
|
+
const qubyRef = React__namespace.default.useRef(null);
|
|
18872
18895
|
useQuestionShortkeys(response, questionnaire, qubyRef);
|
|
18873
18896
|
const displayMode = displayOptions.displayMode;
|
|
18874
18897
|
const questionRefs = /* @__PURE__ */ new Map();
|
|
@@ -18938,16 +18961,16 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18938
18961
|
] }) }) });
|
|
18939
18962
|
};
|
|
18940
18963
|
const useRerenderOnResponseChange = (response) => {
|
|
18941
|
-
const [_2, setCounter] =
|
|
18942
|
-
|
|
18964
|
+
const [_2, setCounter] = React__namespace.default.useState(0);
|
|
18965
|
+
React__namespace.default.useEffect(() => {
|
|
18943
18966
|
const handleChange = (_response) => setCounter((number) => number + 1);
|
|
18944
18967
|
response.onChange(handleChange);
|
|
18945
18968
|
return () => response.offChange(handleChange);
|
|
18946
18969
|
});
|
|
18947
18970
|
};
|
|
18948
18971
|
const useNextSavePressWillOnlyRunMinimalValidations = (response) => {
|
|
18949
|
-
const [nextSavePressWillOnlyRunMinimalValidations, setNextSavePressWillOnlyRunMinimalValidations] =
|
|
18950
|
-
|
|
18972
|
+
const [nextSavePressWillOnlyRunMinimalValidations, setNextSavePressWillOnlyRunMinimalValidations] = React__namespace.default.useState(false);
|
|
18973
|
+
React__namespace.default.useEffect(() => {
|
|
18951
18974
|
const handleChange = (_response, type) => {
|
|
18952
18975
|
if (nextSavePressWillOnlyRunMinimalValidations && type === "valueChanged")
|
|
18953
18976
|
setNextSavePressWillOnlyRunMinimalValidations(false);
|
|
@@ -18972,10 +18995,10 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18972
18995
|
const Quby = (props) => {
|
|
18973
18996
|
var _a;
|
|
18974
18997
|
const questionnaire = new Questionnaire(props.questionnaireJson);
|
|
18975
|
-
const [response, _2] =
|
|
18998
|
+
const [response, _2] = React__namespace.default.useState(() => {
|
|
18976
18999
|
return new Response(questionnaire, convertDefaultAndValidateResponseJson(props.responseJson, questionnaire));
|
|
18977
19000
|
});
|
|
18978
|
-
const leavePageNag =
|
|
19001
|
+
const leavePageNag = React__namespace.default.useRef(null);
|
|
18979
19002
|
const newLayout = props.newLayout ?? questionnaire.layoutVersion === "v2";
|
|
18980
19003
|
const darkMode = props.darkMode === void 0 ? (_a = window.matchMedia("(prefers-color-scheme: dark)")) == null ? void 0 : _a.matches : props.darkMode;
|
|
18981
19004
|
const displayOptions = {
|
|
@@ -18996,7 +19019,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
18996
19019
|
callback(response);
|
|
18997
19020
|
} : void 0;
|
|
18998
19021
|
instance.changeLanguage(props.questionnaireJson.language);
|
|
18999
|
-
|
|
19022
|
+
React__namespace.default.useEffect(() => {
|
|
19000
19023
|
if (props.unsavedResponseWarning) {
|
|
19001
19024
|
leavePageNag.current = (e2) => {
|
|
19002
19025
|
if (response.valueHasChanged()) {
|
|
@@ -19011,7 +19034,7 @@ var __privateAdd = (obj, member, value) => {
|
|
|
19011
19034
|
};
|
|
19012
19035
|
}
|
|
19013
19036
|
}, [props.unsavedResponseWarning]);
|
|
19014
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19037
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(root__default.default.qubyRoot, { children: [
|
|
19015
19038
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: newLayout ? styles : oldStyles }),
|
|
19016
19039
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19017
19040
|
AnswerPage,
|