labellife-design-tool 2.3.3 → 2.3.5
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 +114 -44
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +114 -44
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/esm/canvas/workspace.js +114 -44
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +114 -44
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -11094,6 +11094,10 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
11094
11094
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
11095
11095
|
selectedItems = _useState6[0],
|
|
11096
11096
|
setSelectedItems = _useState6[1];
|
|
11097
|
+
var _useState7 = useState(''),
|
|
11098
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
11099
|
+
customRadioValue = _useState8[0],
|
|
11100
|
+
setCustomRadioValue = _useState8[1];
|
|
11097
11101
|
var config = getInputFieldsConfig();
|
|
11098
11102
|
var custom = field.custom || {};
|
|
11099
11103
|
var inputType = custom.inputType || 'text';
|
|
@@ -11103,7 +11107,7 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
11103
11107
|
var options = custom.options || [];
|
|
11104
11108
|
var minSelections = custom.minSelections || 0;
|
|
11105
11109
|
var maxSelections = custom.maxSelections || options.length;
|
|
11106
|
-
var isSubmitDisabled = inputType === 'list' ? selectedItems.length < minSelections : isRequired && !value;
|
|
11110
|
+
var isSubmitDisabled = inputType === 'list' ? selectedItems.length < minSelections : isRequired && (!value || value === '__custom__' && !customRadioValue.trim());
|
|
11107
11111
|
var logoUrl = config.logoUrl || null;
|
|
11108
11112
|
var headerText = config.headerText || null;
|
|
11109
11113
|
var accentColor = config.accentColor || '#0d83cd';
|
|
@@ -11112,6 +11116,7 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
11112
11116
|
setValue('');
|
|
11113
11117
|
setImagePreview(null);
|
|
11114
11118
|
setSelectedItems([]);
|
|
11119
|
+
setCustomRadioValue('');
|
|
11115
11120
|
}, [field.id]);
|
|
11116
11121
|
var handleImageSelect = function handleImageSelect(e) {
|
|
11117
11122
|
var _e$target$files;
|
|
@@ -11133,6 +11138,8 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
11133
11138
|
onSubmit(field.id, formatted);
|
|
11134
11139
|
} else if (inputType === 'list') {
|
|
11135
11140
|
onSubmit(field.id, selectedItems.join(', '));
|
|
11141
|
+
} else if (inputType === 'radio' && value === '__custom__') {
|
|
11142
|
+
onSubmit(field.id, customRadioValue.trim());
|
|
11136
11143
|
} else {
|
|
11137
11144
|
onSubmit(field.id, value);
|
|
11138
11145
|
}
|
|
@@ -11279,38 +11286,71 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
11279
11286
|
})]
|
|
11280
11287
|
});
|
|
11281
11288
|
case 'radio':
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
flex: 1,
|
|
11286
|
-
minHeight: 0,
|
|
11287
|
-
overflowY: 'auto',
|
|
11288
|
-
pr: 0.5,
|
|
11289
|
-
'&::-webkit-scrollbar': {
|
|
11290
|
-
width: 6
|
|
11291
|
-
},
|
|
11292
|
-
'&::-webkit-scrollbar-track': {
|
|
11293
|
-
background: 'transparent'
|
|
11294
|
-
},
|
|
11295
|
-
'&::-webkit-scrollbar-thumb': {
|
|
11296
|
-
background: '#d0d5dd',
|
|
11297
|
-
borderRadius: 3
|
|
11298
|
-
},
|
|
11299
|
-
'&::-webkit-scrollbar-thumb:hover': {
|
|
11300
|
-
background: '#aaa'
|
|
11301
|
-
}
|
|
11302
|
-
},
|
|
11303
|
-
children: /*#__PURE__*/jsx(RadioGroup, {
|
|
11304
|
-
value: value,
|
|
11305
|
-
onChange: function onChange(e) {
|
|
11306
|
-
return setValue(e.target.value);
|
|
11307
|
-
},
|
|
11289
|
+
{
|
|
11290
|
+
var otherSelected = value === '__custom__';
|
|
11291
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
11308
11292
|
sx: {
|
|
11309
|
-
|
|
11293
|
+
mt: 1,
|
|
11294
|
+
flex: 1,
|
|
11295
|
+
minHeight: 0,
|
|
11296
|
+
overflowY: 'auto',
|
|
11297
|
+
pr: 0.5,
|
|
11298
|
+
'&::-webkit-scrollbar': {
|
|
11299
|
+
width: 6
|
|
11300
|
+
},
|
|
11301
|
+
'&::-webkit-scrollbar-track': {
|
|
11302
|
+
background: 'transparent'
|
|
11303
|
+
},
|
|
11304
|
+
'&::-webkit-scrollbar-thumb': {
|
|
11305
|
+
background: '#d0d5dd',
|
|
11306
|
+
borderRadius: 3
|
|
11307
|
+
},
|
|
11308
|
+
'&::-webkit-scrollbar-thumb:hover': {
|
|
11309
|
+
background: '#aaa'
|
|
11310
|
+
}
|
|
11310
11311
|
},
|
|
11311
|
-
children:
|
|
11312
|
-
|
|
11313
|
-
|
|
11312
|
+
children: [/*#__PURE__*/jsxs(RadioGroup, {
|
|
11313
|
+
value: value,
|
|
11314
|
+
onChange: function onChange(e) {
|
|
11315
|
+
return setValue(e.target.value);
|
|
11316
|
+
},
|
|
11317
|
+
sx: {
|
|
11318
|
+
gap: 1
|
|
11319
|
+
},
|
|
11320
|
+
children: [options.map(function (opt) {
|
|
11321
|
+
return /*#__PURE__*/jsx(FormControlLabel, {
|
|
11322
|
+
value: opt,
|
|
11323
|
+
control: /*#__PURE__*/jsx(Radio, {
|
|
11324
|
+
sx: {
|
|
11325
|
+
color: '#d0d5dd',
|
|
11326
|
+
'&.Mui-checked': {
|
|
11327
|
+
color: accentColor
|
|
11328
|
+
}
|
|
11329
|
+
}
|
|
11330
|
+
}),
|
|
11331
|
+
label: /*#__PURE__*/jsx(Typography, {
|
|
11332
|
+
sx: {
|
|
11333
|
+
fontSize: 18
|
|
11334
|
+
},
|
|
11335
|
+
children: opt
|
|
11336
|
+
}),
|
|
11337
|
+
sx: {
|
|
11338
|
+
m: 0,
|
|
11339
|
+
border: '1px solid',
|
|
11340
|
+
borderColor: value === opt ? accentColor : '#d0d5dd',
|
|
11341
|
+
borderRadius: '8px',
|
|
11342
|
+
px: 2,
|
|
11343
|
+
py: 0.75,
|
|
11344
|
+
transition: 'all 0.15s ease',
|
|
11345
|
+
backgroundColor: value === opt ? 'rgba(13,131,205,0.04)' : 'transparent',
|
|
11346
|
+
'&:hover': {
|
|
11347
|
+
borderColor: accentColor,
|
|
11348
|
+
backgroundColor: 'rgba(13,131,205,0.03)'
|
|
11349
|
+
}
|
|
11350
|
+
}
|
|
11351
|
+
}, opt);
|
|
11352
|
+
}), /*#__PURE__*/jsx(FormControlLabel, {
|
|
11353
|
+
value: "__custom__",
|
|
11314
11354
|
control: /*#__PURE__*/jsx(Radio, {
|
|
11315
11355
|
sx: {
|
|
11316
11356
|
color: '#d0d5dd',
|
|
@@ -11323,26 +11363,56 @@ var SingleFieldDialog = function SingleFieldDialog(_ref) {
|
|
|
11323
11363
|
sx: {
|
|
11324
11364
|
fontSize: 18
|
|
11325
11365
|
},
|
|
11326
|
-
children:
|
|
11366
|
+
children: t('inputFieldsDialog.other', 'Other')
|
|
11327
11367
|
}),
|
|
11328
11368
|
sx: {
|
|
11329
11369
|
m: 0,
|
|
11330
11370
|
border: '1px solid',
|
|
11331
|
-
borderColor:
|
|
11332
|
-
borderRadius: '8px',
|
|
11371
|
+
borderColor: otherSelected ? accentColor : '#d0d5dd',
|
|
11372
|
+
borderRadius: otherSelected ? '8px 8px 0 0' : '8px',
|
|
11373
|
+
borderBottom: otherSelected ? 'none' : undefined,
|
|
11333
11374
|
px: 2,
|
|
11334
11375
|
py: 0.75,
|
|
11335
|
-
transition: '
|
|
11336
|
-
backgroundColor:
|
|
11376
|
+
transition: 'border-color 0.15s ease, border-radius 0.15s ease',
|
|
11377
|
+
backgroundColor: otherSelected ? 'rgba(13,131,205,0.04)' : 'transparent',
|
|
11337
11378
|
'&:hover': {
|
|
11338
11379
|
borderColor: accentColor,
|
|
11339
11380
|
backgroundColor: 'rgba(13,131,205,0.03)'
|
|
11340
11381
|
}
|
|
11341
11382
|
}
|
|
11342
|
-
}
|
|
11343
|
-
})
|
|
11344
|
-
|
|
11345
|
-
|
|
11383
|
+
})]
|
|
11384
|
+
}), otherSelected && /*#__PURE__*/jsx(TextField, {
|
|
11385
|
+
autoFocus: true,
|
|
11386
|
+
fullWidth: true,
|
|
11387
|
+
value: customRadioValue,
|
|
11388
|
+
onChange: function onChange(e) {
|
|
11389
|
+
return setCustomRadioValue(e.target.value);
|
|
11390
|
+
},
|
|
11391
|
+
onKeyDown: function onKeyDown(e) {
|
|
11392
|
+
if (e.key === 'Enter' && customRadioValue.trim()) handleSubmit();
|
|
11393
|
+
},
|
|
11394
|
+
placeholder: t('inputFieldsDialog.otherPlaceholder', 'Type your answer…'),
|
|
11395
|
+
sx: {
|
|
11396
|
+
'& .MuiOutlinedInput-root': {
|
|
11397
|
+
borderRadius: '0 0 8px 8px',
|
|
11398
|
+
fontSize: 18,
|
|
11399
|
+
'& fieldset': {
|
|
11400
|
+
borderColor: accentColor,
|
|
11401
|
+
borderTopColor: 'transparent'
|
|
11402
|
+
},
|
|
11403
|
+
'&:hover fieldset': {
|
|
11404
|
+
borderColor: accentColor,
|
|
11405
|
+
borderTopColor: 'transparent'
|
|
11406
|
+
},
|
|
11407
|
+
'&.Mui-focused fieldset': {
|
|
11408
|
+
borderColor: accentColor,
|
|
11409
|
+
borderTopColor: 'transparent'
|
|
11410
|
+
}
|
|
11411
|
+
}
|
|
11412
|
+
}
|
|
11413
|
+
})]
|
|
11414
|
+
});
|
|
11415
|
+
}
|
|
11346
11416
|
case 'list':
|
|
11347
11417
|
{
|
|
11348
11418
|
var isAtMax = maxSelections > 0 && selectedItems.length >= maxSelections;
|
|
@@ -11634,10 +11704,10 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
11634
11704
|
backTrigger = _ref2$backTrigger === void 0 ? 0 : _ref2$backTrigger;
|
|
11635
11705
|
// displayIndex counts how many fields have been answered (for step indicator only).
|
|
11636
11706
|
// Navigation always uses fields[0] — the first remaining pending field.
|
|
11637
|
-
var
|
|
11638
|
-
|
|
11639
|
-
displayIndex =
|
|
11640
|
-
setDisplayIndex =
|
|
11707
|
+
var _useState9 = useState(0),
|
|
11708
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
11709
|
+
displayIndex = _useState0[0],
|
|
11710
|
+
setDisplayIndex = _useState0[1];
|
|
11641
11711
|
var initialTotalRef = useRef(0);
|
|
11642
11712
|
var completedHistoryRef = useRef([]);
|
|
11643
11713
|
var removedDueToSkipRef = useRef([]);
|