labellife-design-tool 2.4.1 → 2.4.2
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/cjs/canvas/workspace.js +321 -92
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +374 -65
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/side-panel/side-panel.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +538 -31
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +265 -36
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +375 -67
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/side-panel/side-panel.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +540 -33
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRef, useEffect, useState, Fragment, useCallback } from 'react';
|
|
2
|
-
import { Group, Image, Rect, Transformer, Text, Arrow, Path, RegularPolygon, Star, Circle, Line,
|
|
1
|
+
import React, { useRef, useEffect, useState, Fragment, useCallback } from 'react';
|
|
2
|
+
import { Group, Image, Rect, Transformer, Shape, Text, Arrow, Path, RegularPolygon, Star, Circle, Line, Stage, Layer } from 'react-konva';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import { Box, Typography, IconButton, Button, TextField, FormGroup, FormControlLabel, Checkbox, RadioGroup, Radio } from '@mui/material';
|
|
5
5
|
import CloseIcon from '@mui/icons-material/Close';
|
|
@@ -1016,6 +1016,203 @@ var ImageElementComponent = observer(function (_ref) {
|
|
|
1016
1016
|
});
|
|
1017
1017
|
ImageElementComponent.displayName = 'ImageElement';
|
|
1018
1018
|
|
|
1019
|
+
// Composes a canvas/Konva font-style string (e.g. "italic bold") from the
|
|
1020
|
+
// element model's separate fontStyle/fontWeight fields. Shared by
|
|
1021
|
+
// text-element.js (KonvaText) and curved-text.js (custom Shape), which
|
|
1022
|
+
// both need to build a canvas `ctx.font` / Konva fontStyle string the same
|
|
1023
|
+
// way.
|
|
1024
|
+
function composeFontStyle(fontStyle, fontWeight) {
|
|
1025
|
+
var parts = [];
|
|
1026
|
+
var style = String(fontStyle || '').trim();
|
|
1027
|
+
var weight = String(fontWeight || '').trim();
|
|
1028
|
+
if (style === 'italic' || style.includes('italic')) parts.push('italic');
|
|
1029
|
+
if (weight && weight !== 'normal') parts.push(weight);
|
|
1030
|
+
return parts.length > 0 ? parts.join(' ') : 'normal';
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// src/canvas/curved-text-geometry.js
|
|
1034
|
+
//
|
|
1035
|
+
// Pure, framework-free geometry math for the curved-text effect.
|
|
1036
|
+
// Deliberately authored as CommonJS (not ESM like the rest of src/canvas)
|
|
1037
|
+
// so this one file can be unit-tested with plain `node`, no jest/babel
|
|
1038
|
+
// required — this repo has no test framework installed. Rollup's
|
|
1039
|
+
// commonjs() plugin (already in rollup.config.mjs) interops this into the
|
|
1040
|
+
// ESM build correctly when curved-text.js imports it with `import`.
|
|
1041
|
+
|
|
1042
|
+
// At curvePower = 100 (max), the radius is this many multiples of
|
|
1043
|
+
// fontSize. Tuned empirically: 3x let realistic multi-word labels wrap
|
|
1044
|
+
// into a nearly-closed loop well before the slider reached 100 (e.g. a
|
|
1045
|
+
// ~500px-wide line swept ~341° — individual glyphs rotate past horizontal
|
|
1046
|
+
// once a line wraps past ~180°, which read as "letters rotating wrong").
|
|
1047
|
+
// 6x keeps the same line under ~170° at max curvePower, a clearly-open arc.
|
|
1048
|
+
// Adjust this constant (and re-run curved-text-geometry.test.js, which
|
|
1049
|
+
// exercises it) if the on-screen result needs to be tighter/looser.
|
|
1050
|
+
var MAX_RADIUS_FONT_MULTIPLIER = 6;
|
|
1051
|
+
|
|
1052
|
+
// Maps curvePower (-100..100) to a positive radius magnitude in px.
|
|
1053
|
+
// Direction (smile vs frown) is NOT encoded here — callers apply
|
|
1054
|
+
// Math.sign(curvePower) separately (see curved-text.js). curvePower = 0
|
|
1055
|
+
// returns Infinity (a "straight line" radius) for defensiveness, though
|
|
1056
|
+
// callers should treat curvePower === 0 as "don't curve at all" before
|
|
1057
|
+
// reaching here (falls back to plain KonvaText).
|
|
1058
|
+
function computeArcRadius(curvePower, fontSize) {
|
|
1059
|
+
var power = Math.abs(curvePower);
|
|
1060
|
+
if (power === 0) return Infinity;
|
|
1061
|
+
return fontSize * MAX_RADIUS_FONT_MULTIPLIER / (power / 100);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// Computes the radius for line `lineIndex` (0-based, top to bottom) of a
|
|
1065
|
+
// multi-line curved text block, so all lines share one arc center
|
|
1066
|
+
// (concentric) and stack in normal reading order.
|
|
1067
|
+
//
|
|
1068
|
+
// For curvePower > 0 ("smile", center below the text), later lines move
|
|
1069
|
+
// closer to the center (smaller radius). For curvePower < 0 ("frown",
|
|
1070
|
+
// center above the text), later lines move away from the center (larger
|
|
1071
|
+
// radius).
|
|
1072
|
+
function computeLineRadius(baseRadius, lineIndex, lineHeight, curvePower) {
|
|
1073
|
+
var direction = curvePower > 0 ? -1 : 1;
|
|
1074
|
+
return baseRadius + lineIndex * lineHeight * direction;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// Distributes characters of one line along an arc of the given radius,
|
|
1078
|
+
// centered so the line's midpoint sits at angle 0 — i.e. center-aligned.
|
|
1079
|
+
//
|
|
1080
|
+
// charWidths: array of per-glyph advance widths (px), in reading order.
|
|
1081
|
+
// radius: positive, finite radius magnitude (px) for this line.
|
|
1082
|
+
//
|
|
1083
|
+
// Returns an array, one entry per character, each: { angle } — the angle
|
|
1084
|
+
// (radians) from the arc's center-line, in reading order. Callers convert
|
|
1085
|
+
// `angle` + `radius` into an (x, y) position and a tangent rotation for
|
|
1086
|
+
// drawing (see curved-text.js).
|
|
1087
|
+
function layoutCharsOnArc(charWidths, radius) {
|
|
1088
|
+
if (!Number.isFinite(radius) || radius <= 0) {
|
|
1089
|
+
throw new Error('layoutCharsOnArc requires a finite, positive radius');
|
|
1090
|
+
}
|
|
1091
|
+
var totalWidth = charWidths.reduce(function (sum, w) {
|
|
1092
|
+
return sum + w;
|
|
1093
|
+
}, 0);
|
|
1094
|
+
var totalAngle = totalWidth / radius;
|
|
1095
|
+
var cumBefore = 0;
|
|
1096
|
+
return charWidths.map(function (w) {
|
|
1097
|
+
var cumMid = cumBefore + w / 2;
|
|
1098
|
+
cumBefore += w;
|
|
1099
|
+
var angleFromStart = cumMid / radius;
|
|
1100
|
+
return {
|
|
1101
|
+
angle: angleFromStart - totalAngle / 2
|
|
1102
|
+
};
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
var curvedTextGeometry = {
|
|
1106
|
+
computeArcRadius: computeArcRadius,
|
|
1107
|
+
computeLineRadius: computeLineRadius,
|
|
1108
|
+
layoutCharsOnArc: layoutCharsOnArc
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
var CurvedText = observer(/*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1112
|
+
var element = _ref.element,
|
|
1113
|
+
displayText = _ref.displayText,
|
|
1114
|
+
width = _ref.width;
|
|
1115
|
+
var fontStyleStr = composeFontStyle(element.fontStyle, element.fontWeight);
|
|
1116
|
+
var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
|
|
1117
|
+
var lineHeightPx = element.fontSize * lineHeightMultiplier;
|
|
1118
|
+
var letterSpacing = element.letterSpacing || 0;
|
|
1119
|
+
var curvePower = element.curvePower;
|
|
1120
|
+
|
|
1121
|
+
// Precondition: caller must not mount this component with curvePower === 0.
|
|
1122
|
+
// Defensive guard to avoid passing Infinity to layoutCharsOnArc.
|
|
1123
|
+
if (curvePower === 0) return null;
|
|
1124
|
+
var direction = curvePower > 0 ? 1 : -1;
|
|
1125
|
+
var baseRadius = curvedTextGeometry.computeArcRadius(curvePower, element.fontSize);
|
|
1126
|
+
var lines = (displayText || '').split('\n');
|
|
1127
|
+
|
|
1128
|
+
// Shared per-character geometry: walks every line/character and invokes
|
|
1129
|
+
// `draw(ctx, ch, x, y, angle)` inside the same save/translate/rotate/
|
|
1130
|
+
// restore frame. Used by both sceneFunc (real glyph fill/stroke) and
|
|
1131
|
+
// hitFunc (hit-region rects) so the clickable area always matches what's
|
|
1132
|
+
// actually painted — duplicating this math between the two would risk
|
|
1133
|
+
// them drifting apart.
|
|
1134
|
+
var forEachChar = function forEachChar(ctx, draw) {
|
|
1135
|
+
var centerX = width / 2;
|
|
1136
|
+
lines.forEach(function (lineText, lineIndex) {
|
|
1137
|
+
var chars = Array.from(lineText);
|
|
1138
|
+
if (chars.length === 0) return;
|
|
1139
|
+
var charWidths = chars.map(function (ch) {
|
|
1140
|
+
return ctx.measureText(ch).width + letterSpacing;
|
|
1141
|
+
});
|
|
1142
|
+
var lineRadius = curvedTextGeometry.computeLineRadius(baseRadius, lineIndex, lineHeightPx, curvePower);
|
|
1143
|
+
var signedRadius = direction * lineRadius;
|
|
1144
|
+
var baselineY = lineIndex * lineHeightPx + element.fontSize;
|
|
1145
|
+
var centerY = baselineY + signedRadius;
|
|
1146
|
+
var layout = curvedTextGeometry.layoutCharsOnArc(charWidths, lineRadius);
|
|
1147
|
+
chars.forEach(function (ch, idx) {
|
|
1148
|
+
var angle = layout[idx].angle;
|
|
1149
|
+
var x = centerX + lineRadius * Math.sin(angle);
|
|
1150
|
+
var y = centerY - signedRadius * Math.cos(angle);
|
|
1151
|
+
draw(ctx, ch, x, y, angle, charWidths[idx]);
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1155
|
+
return /*#__PURE__*/jsx(Shape, {
|
|
1156
|
+
ref: ref,
|
|
1157
|
+
width: width,
|
|
1158
|
+
height: lines.length * lineHeightPx,
|
|
1159
|
+
sceneFunc: function sceneFunc(ctx) {
|
|
1160
|
+
ctx.font = "".concat(fontStyleStr, " ").concat(element.fontSize, "px \"").concat(element.fontFamily, "\"");
|
|
1161
|
+
ctx.textAlign = 'center';
|
|
1162
|
+
ctx.textBaseline = 'alphabetic';
|
|
1163
|
+
forEachChar(ctx, function (c, ch, x, y, angle) {
|
|
1164
|
+
c.save();
|
|
1165
|
+
c.translate(x, y);
|
|
1166
|
+
c.rotate(direction * angle);
|
|
1167
|
+
if (element.strokeWidth > 0) {
|
|
1168
|
+
c.strokeStyle = element.stroke || '#000000';
|
|
1169
|
+
c.lineWidth = element.strokeWidth;
|
|
1170
|
+
c.strokeText(ch, 0, 0);
|
|
1171
|
+
}
|
|
1172
|
+
c.fillStyle = element.fill;
|
|
1173
|
+
c.fillText(ch, 0, 0);
|
|
1174
|
+
c.restore();
|
|
1175
|
+
});
|
|
1176
|
+
},
|
|
1177
|
+
hitFunc: function hitFunc(ctx, shape) {
|
|
1178
|
+
ctx.font = "".concat(fontStyleStr, " ").concat(element.fontSize, "px \"").concat(element.fontFamily, "\"");
|
|
1179
|
+
ctx.textAlign = 'center';
|
|
1180
|
+
ctx.textBaseline = 'alphabetic';
|
|
1181
|
+
ctx.beginPath();
|
|
1182
|
+
forEachChar(ctx, function (c, ch, x, y, angle, charWidth) {
|
|
1183
|
+
c.save();
|
|
1184
|
+
c.translate(x, y);
|
|
1185
|
+
c.rotate(direction * angle);
|
|
1186
|
+
c.rect(-charWidth / 2, -element.fontSize * 0.8, charWidth, element.fontSize * 1.1);
|
|
1187
|
+
c.restore();
|
|
1188
|
+
});
|
|
1189
|
+
ctx.fillStrokeShape(shape);
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
}));
|
|
1193
|
+
CurvedText.displayName = 'CurvedText';
|
|
1194
|
+
|
|
1195
|
+
function computeCurvedCacheBounds(element) {
|
|
1196
|
+
var lineCount = (element.text || element.placeholder || '').split('\n').length;
|
|
1197
|
+
var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
|
|
1198
|
+
var lineHeightPx = element.fontSize * lineHeightMultiplier;
|
|
1199
|
+
var baseRadius = curvedTextGeometry.computeArcRadius(element.curvePower, element.fontSize);
|
|
1200
|
+
var halfChord = element.width / 2;
|
|
1201
|
+
var maxSagitta = 0;
|
|
1202
|
+
for (var lineIndex = 0; lineIndex < lineCount; lineIndex++) {
|
|
1203
|
+
var lineRadius = curvedTextGeometry.computeLineRadius(baseRadius, lineIndex, lineHeightPx, element.curvePower);
|
|
1204
|
+
var sagitta = halfChord >= lineRadius ? lineRadius : lineRadius - Math.sqrt(lineRadius * lineRadius - halfChord * halfChord);
|
|
1205
|
+
if (sagitta > maxSagitta) maxSagitta = sagitta;
|
|
1206
|
+
}
|
|
1207
|
+
var declaredHeight = lineCount * lineHeightPx;
|
|
1208
|
+
var xPad = maxSagitta / 2;
|
|
1209
|
+
return {
|
|
1210
|
+
x: -xPad,
|
|
1211
|
+
y: -maxSagitta,
|
|
1212
|
+
width: element.width + xPad * 2,
|
|
1213
|
+
height: declaredHeight + maxSagitta * 2
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1019
1216
|
var TextElementComponent = observer(function (_ref) {
|
|
1020
1217
|
var _element$backgroundOp;
|
|
1021
1218
|
var element = _ref.element;
|
|
@@ -1030,13 +1227,24 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1030
1227
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1031
1228
|
textHeight = _useState2[0],
|
|
1032
1229
|
setTextHeight = _useState2[1];
|
|
1230
|
+
var isCurved = element.curveEnabled && element.curvePower !== 0;
|
|
1033
1231
|
|
|
1034
1232
|
// Force Konva to recalculate text layout when fonts finish loading.
|
|
1035
1233
|
useEffect(function () {
|
|
1036
1234
|
var onFontLoaded = function onFontLoaded() {
|
|
1037
|
-
var _node$
|
|
1235
|
+
var _node$getLayer2;
|
|
1038
1236
|
var node = textRef.current;
|
|
1039
1237
|
if (!node) return;
|
|
1238
|
+
|
|
1239
|
+
// CurvedText's sceneFunc re-measures glyphs via ctx.measureText on
|
|
1240
|
+
// every draw (no internal cached layout like Konva.Text has), so
|
|
1241
|
+
// there's no stale-layout workaround needed — just repaint.
|
|
1242
|
+
if (element.curveEnabled && element.curvePower !== 0) {
|
|
1243
|
+
var _node$getLayer;
|
|
1244
|
+
if (element.blurEnabled) node.cache(computeCurvedCacheBounds(element));
|
|
1245
|
+
(_node$getLayer = node.getLayer()) === null || _node$getLayer === void 0 || _node$getLayer.batchDraw();
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1040
1248
|
var f = node.fontFamily();
|
|
1041
1249
|
node.fontFamily('serif');
|
|
1042
1250
|
node.fontFamily(f);
|
|
@@ -1051,7 +1259,7 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1051
1259
|
if (element.blurEnabled && node) {
|
|
1052
1260
|
node.cache();
|
|
1053
1261
|
}
|
|
1054
|
-
(_node$
|
|
1262
|
+
(_node$getLayer2 = node.getLayer()) === null || _node$getLayer2 === void 0 || _node$getLayer2.batchDraw();
|
|
1055
1263
|
};
|
|
1056
1264
|
document.fonts.addEventListener('loadingdone', onFontLoaded);
|
|
1057
1265
|
return function () {
|
|
@@ -1060,7 +1268,10 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1060
1268
|
}, []);
|
|
1061
1269
|
|
|
1062
1270
|
// Sync Konva auto-sized height back to element model after text reflows
|
|
1271
|
+
// (straight text only — curved text's height is computed synchronously
|
|
1272
|
+
// below, since it doesn't width-wrap and doesn't need a measured node).
|
|
1063
1273
|
useEffect(function () {
|
|
1274
|
+
if (element.curveEnabled && element.curvePower !== 0) return;
|
|
1064
1275
|
var node = textRef.current;
|
|
1065
1276
|
if (!node) return;
|
|
1066
1277
|
var frame = requestAnimationFrame(function () {
|
|
@@ -1075,23 +1286,40 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1075
1286
|
return function () {
|
|
1076
1287
|
return cancelAnimationFrame(frame);
|
|
1077
1288
|
};
|
|
1078
|
-
}, [element.text, element.fontSize, element.fontFamily, element.fontWeight, element.width]);
|
|
1289
|
+
}, [element.text, element.fontSize, element.fontFamily, element.fontWeight, element.width, element.curveEnabled, element.curvePower]);
|
|
1290
|
+
|
|
1291
|
+
// Curved text: height is deterministic from line count (no width-based
|
|
1292
|
+
// wrapping), so sync it directly without waiting on Konva measurement.
|
|
1293
|
+
useEffect(function () {
|
|
1294
|
+
if (!(element.curveEnabled && element.curvePower !== 0)) return;
|
|
1295
|
+
var lineCount = (element.text || element.placeholder || '').split('\n').length;
|
|
1296
|
+
var lineHeightMultiplier = typeof element.lineHeight === 'number' ? element.lineHeight : parseFloat(element.lineHeight) || 1.2;
|
|
1297
|
+
var h = lineCount * element.fontSize * lineHeightMultiplier;
|
|
1298
|
+
setTextHeight(h);
|
|
1299
|
+
if (Math.abs(h - element.height) > 1) element.set({
|
|
1300
|
+
height: h
|
|
1301
|
+
});
|
|
1302
|
+
}, [element.text, element.placeholder, element.fontSize, element.lineHeight, element.curveEnabled, element.curvePower]);
|
|
1079
1303
|
|
|
1080
1304
|
// Apply blur filter: cache the text node when blur is enabled
|
|
1081
1305
|
useEffect(function () {
|
|
1082
|
-
var _node$
|
|
1306
|
+
var _node$getLayer3;
|
|
1083
1307
|
var node = textRef.current;
|
|
1084
1308
|
if (!node) return;
|
|
1085
1309
|
if (element.blurEnabled) {
|
|
1086
1310
|
node.filters([Konva.Filters.Blur]);
|
|
1087
1311
|
node.blurRadius(element.blurRadius);
|
|
1088
|
-
|
|
1312
|
+
if (isCurved) {
|
|
1313
|
+
node.cache(computeCurvedCacheBounds(element));
|
|
1314
|
+
} else {
|
|
1315
|
+
node.cache();
|
|
1316
|
+
}
|
|
1089
1317
|
} else {
|
|
1090
1318
|
node.filters([]);
|
|
1091
1319
|
node.clearCache();
|
|
1092
1320
|
}
|
|
1093
|
-
(_node$
|
|
1094
|
-
}, [element.blurEnabled, element.blurRadius, element.text, element.fontSize, element.width]);
|
|
1321
|
+
(_node$getLayer3 = node.getLayer()) === null || _node$getLayer3 === void 0 || _node$getLayer3.batchDraw();
|
|
1322
|
+
}, [element.blurEnabled, element.blurRadius, element.text, element.fontSize, element.width, isCurved, element.curvePower, element.lineHeight]);
|
|
1095
1323
|
if (!element.visible) return null;
|
|
1096
1324
|
var handleDragEnd = function handleDragEnd(e) {
|
|
1097
1325
|
element.set({
|
|
@@ -1116,7 +1344,9 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1116
1344
|
var tNode = textRef.current;
|
|
1117
1345
|
if (tNode) {
|
|
1118
1346
|
tNode.width(newWidth);
|
|
1119
|
-
tNode.fontSize
|
|
1347
|
+
if (typeof tNode.fontSize === 'function') {
|
|
1348
|
+
tNode.fontSize(newFontSize);
|
|
1349
|
+
}
|
|
1120
1350
|
}
|
|
1121
1351
|
node.scaleX(1);
|
|
1122
1352
|
node.scaleY(1);
|
|
@@ -1230,14 +1460,7 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1230
1460
|
return c.toUpperCase();
|
|
1231
1461
|
});
|
|
1232
1462
|
}
|
|
1233
|
-
var fontStyleStr =
|
|
1234
|
-
var parts = [];
|
|
1235
|
-
var style = String(element.fontStyle || '').trim();
|
|
1236
|
-
var weight = String(element.fontWeight || '').trim();
|
|
1237
|
-
if (style === 'italic' || style.includes('italic')) parts.push('italic');
|
|
1238
|
-
if (weight && weight !== 'normal') parts.push(weight);
|
|
1239
|
-
return parts.length > 0 ? parts.join(' ') : 'normal';
|
|
1240
|
-
}();
|
|
1463
|
+
var fontStyleStr = composeFontStyle(element.fontStyle, element.fontWeight);
|
|
1241
1464
|
var pad = element.backgroundEnabled ? element.backgroundPadding || 0 : 0;
|
|
1242
1465
|
return /*#__PURE__*/jsxs(Group, {
|
|
1243
1466
|
ref: groupRef,
|
|
@@ -1271,7 +1494,12 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1271
1494
|
opacity: (_element$backgroundOp = element.backgroundOpacity) !== null && _element$backgroundOp !== void 0 ? _element$backgroundOp : 1,
|
|
1272
1495
|
cornerRadius: element.backgroundCornerRadius || 0,
|
|
1273
1496
|
listening: false
|
|
1274
|
-
}), /*#__PURE__*/jsx(
|
|
1497
|
+
}), isCurved ? /*#__PURE__*/jsx(CurvedText, {
|
|
1498
|
+
ref: textRef,
|
|
1499
|
+
element: element,
|
|
1500
|
+
displayText: displayText,
|
|
1501
|
+
width: element.width
|
|
1502
|
+
}) : /*#__PURE__*/jsx(Text, {
|
|
1275
1503
|
ref: textRef,
|
|
1276
1504
|
text: displayText,
|
|
1277
1505
|
width: element.width,
|
|
@@ -1857,9 +2085,19 @@ function parseDateFromFormat(dateStr, format) {
|
|
|
1857
2085
|
return new Date();
|
|
1858
2086
|
}
|
|
1859
2087
|
|
|
2088
|
+
// Shared sizing for the popup's action row (Back / Continue / Do it later),
|
|
2089
|
+
// exported so a custom `PopupActions` component can visually match them.
|
|
2090
|
+
var popupActionButtonSx = {
|
|
2091
|
+
textTransform: 'none',
|
|
2092
|
+
fontSize: 21,
|
|
2093
|
+
py: 1.65,
|
|
2094
|
+
borderRadius: '10px'
|
|
2095
|
+
};
|
|
2096
|
+
|
|
1860
2097
|
// ── Default single-field dialog (full-page overlay) ──────────────────
|
|
1861
2098
|
var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
1862
2099
|
var field = _ref.field,
|
|
2100
|
+
store = _ref.store,
|
|
1863
2101
|
onSubmit = _ref.onSubmit,
|
|
1864
2102
|
onSkip = _ref.onSkip,
|
|
1865
2103
|
onBack = _ref.onBack,
|
|
@@ -2420,36 +2658,30 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
2420
2658
|
mt: 4.5,
|
|
2421
2659
|
flexShrink: 0
|
|
2422
2660
|
},
|
|
2423
|
-
children: [
|
|
2661
|
+
children: [config.PopupActions && /*#__PURE__*/jsx(config.PopupActions, {
|
|
2662
|
+
store: store
|
|
2663
|
+
}), canGoBack && /*#__PURE__*/jsx(Button, {
|
|
2424
2664
|
variant: "outlined",
|
|
2425
2665
|
onClick: onBack,
|
|
2426
2666
|
startIcon: /*#__PURE__*/jsx(ArrowBackIcon, {}),
|
|
2427
|
-
sx: {
|
|
2428
|
-
textTransform: 'none',
|
|
2667
|
+
sx: _objectSpread2(_objectSpread2({}, popupActionButtonSx), {}, {
|
|
2429
2668
|
fontWeight: 500,
|
|
2430
|
-
fontSize: 21,
|
|
2431
2669
|
px: 3,
|
|
2432
|
-
py: 1.65,
|
|
2433
|
-
borderRadius: '10px',
|
|
2434
2670
|
color: '#555',
|
|
2435
2671
|
borderColor: '#d0d5dd',
|
|
2436
2672
|
'&:hover': {
|
|
2437
2673
|
borderColor: '#aaa',
|
|
2438
2674
|
backgroundColor: 'rgba(0,0,0,0.02)'
|
|
2439
2675
|
}
|
|
2440
|
-
},
|
|
2676
|
+
}),
|
|
2441
2677
|
children: t('inputFieldsDialog.back', 'Back')
|
|
2442
2678
|
}), /*#__PURE__*/jsx(Button, {
|
|
2443
2679
|
variant: "contained",
|
|
2444
2680
|
onClick: handleSubmit,
|
|
2445
2681
|
disabled: isSubmitDisabled,
|
|
2446
|
-
sx: _objectSpread2({
|
|
2447
|
-
textTransform: 'none',
|
|
2682
|
+
sx: _objectSpread2(_objectSpread2({}, popupActionButtonSx), {}, {
|
|
2448
2683
|
fontWeight: 600,
|
|
2449
|
-
fontSize: 21,
|
|
2450
2684
|
px: 5,
|
|
2451
|
-
py: 1.65,
|
|
2452
|
-
borderRadius: '10px',
|
|
2453
2685
|
backgroundColor: accentColor,
|
|
2454
2686
|
boxShadow: 'none',
|
|
2455
2687
|
'&:hover': {
|
|
@@ -2463,13 +2695,9 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
2463
2695
|
onClick: function onClick() {
|
|
2464
2696
|
return onSkip(field.id);
|
|
2465
2697
|
},
|
|
2466
|
-
sx: _objectSpread2({
|
|
2467
|
-
textTransform: 'none',
|
|
2698
|
+
sx: _objectSpread2(_objectSpread2({}, popupActionButtonSx), {}, {
|
|
2468
2699
|
fontWeight: 500,
|
|
2469
|
-
fontSize: 21,
|
|
2470
2700
|
px: 4.5,
|
|
2471
|
-
py: 1.65,
|
|
2472
|
-
borderRadius: '10px',
|
|
2473
2701
|
color: '#555',
|
|
2474
2702
|
borderColor: '#d0d5dd',
|
|
2475
2703
|
'&:hover': {
|
|
@@ -2712,6 +2940,7 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2712
2940
|
}
|
|
2713
2941
|
return /*#__PURE__*/jsx(SingleFieldDialog, {
|
|
2714
2942
|
field: currentField,
|
|
2943
|
+
store: store,
|
|
2715
2944
|
onSubmit: handleSubmit,
|
|
2716
2945
|
onSkip: handleSkip,
|
|
2717
2946
|
onBack: handleBack,
|