@elementor/editor-variables 3.35.0-441 → 3.35.0-443
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/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/fields/label-field.tsx +4 -1
- package/src/components/variable-creation.tsx +10 -1
- package/src/components/variable-edit.tsx +10 -1
- package/src/components/variable-restore.tsx +10 -1
- package/src/variables-registry/create-variable-type-registry.ts +8 -1
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { PropType } from '@elementor/editor-props';
|
|
|
3
3
|
import { z } from '@elementor/schema';
|
|
4
4
|
import * as _elementor_editor_canvas from '@elementor/editor-canvas';
|
|
5
5
|
import * as react from 'react';
|
|
6
|
-
import { RefObject } from 'react';
|
|
6
|
+
import { RefObject, KeyboardEvent } from 'react';
|
|
7
7
|
import * as _mui_material from '@mui/material';
|
|
8
8
|
|
|
9
9
|
declare function init(): void;
|
|
@@ -105,6 +105,7 @@ type ValueFieldProps = {
|
|
|
105
105
|
message: string;
|
|
106
106
|
};
|
|
107
107
|
ref?: RefObject<HTMLElement | null>;
|
|
108
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PropType } from '@elementor/editor-props';
|
|
|
3
3
|
import { z } from '@elementor/schema';
|
|
4
4
|
import * as _elementor_editor_canvas from '@elementor/editor-canvas';
|
|
5
5
|
import * as react from 'react';
|
|
6
|
-
import { RefObject } from 'react';
|
|
6
|
+
import { RefObject, KeyboardEvent } from 'react';
|
|
7
7
|
import * as _mui_material from '@mui/material';
|
|
8
8
|
|
|
9
9
|
declare function init(): void;
|
|
@@ -105,6 +105,7 @@ type ValueFieldProps = {
|
|
|
105
105
|
message: string;
|
|
106
106
|
};
|
|
107
107
|
ref?: RefObject<HTMLElement | null>;
|
|
108
|
+
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
|
|
108
109
|
};
|
|
109
110
|
|
|
110
111
|
declare const registerVariableType: ({ key, icon, startIcon, valueField, propTypeUtil, variableType, defaultValue, selectionFilter, valueTransformer, styleTransformer, fallbackPropTypeUtil, isCompatible, emptyState, }: {
|
package/dist/index.js
CHANGED
|
@@ -1230,7 +1230,8 @@ var LabelField = ({
|
|
|
1230
1230
|
focusOnShow = false,
|
|
1231
1231
|
selectOnShow = false,
|
|
1232
1232
|
showWarningInfotip = false,
|
|
1233
|
-
variables
|
|
1233
|
+
variables,
|
|
1234
|
+
onKeyDown
|
|
1234
1235
|
}) => {
|
|
1235
1236
|
const [label, setLabel] = (0, import_react7.useState)(value);
|
|
1236
1237
|
const [errorMessage, setErrorMessage] = (0, import_react7.useState)("");
|
|
@@ -1260,7 +1261,8 @@ var LabelField = ({
|
|
|
1260
1261
|
inputProps: {
|
|
1261
1262
|
maxLength: VARIABLE_LABEL_MAX_LENGTH,
|
|
1262
1263
|
...selectOnShow && { onFocus: (e) => e.target.select() },
|
|
1263
|
-
"aria-label": "Name"
|
|
1264
|
+
"aria-label": "Name",
|
|
1265
|
+
onKeyDown
|
|
1264
1266
|
},
|
|
1265
1267
|
autoFocus: focusOnShow
|
|
1266
1268
|
}
|
|
@@ -2180,6 +2182,12 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2180
2182
|
return !!errorMessage;
|
|
2181
2183
|
};
|
|
2182
2184
|
const isSubmitDisabled = hasEmptyFields() || hasErrors();
|
|
2185
|
+
const handleKeyDown = (event) => {
|
|
2186
|
+
if (event.key === "Enter" && !isSubmitDisabled) {
|
|
2187
|
+
event.preventDefault();
|
|
2188
|
+
handleCreateAndTrack();
|
|
2189
|
+
}
|
|
2190
|
+
};
|
|
2183
2191
|
return /* @__PURE__ */ React15.createElement(import_editor_editing_panel2.PopoverBody, { height: "auto" }, /* @__PURE__ */ React15.createElement(
|
|
2184
2192
|
import_editor_ui6.PopoverHeader,
|
|
2185
2193
|
{
|
|
@@ -2210,7 +2218,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2210
2218
|
value: label,
|
|
2211
2219
|
message: errorMsg
|
|
2212
2220
|
});
|
|
2213
|
-
}
|
|
2221
|
+
},
|
|
2222
|
+
onKeyDown: handleKeyDown
|
|
2214
2223
|
}
|
|
2215
2224
|
)
|
|
2216
2225
|
), ValueField && /* @__PURE__ */ React15.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n10.__)("Value", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "h5", id: "variable-value-wrapper" }, /* @__PURE__ */ React15.createElement(
|
|
@@ -2224,7 +2233,8 @@ var VariableCreation = ({ onGoBack, onClose }) => {
|
|
|
2224
2233
|
setValueFieldError("");
|
|
2225
2234
|
},
|
|
2226
2235
|
onValidationChange: setValueFieldError,
|
|
2227
|
-
propType
|
|
2236
|
+
propType,
|
|
2237
|
+
onKeyDown: handleKeyDown
|
|
2228
2238
|
}
|
|
2229
2239
|
))), errorMessage && /* @__PURE__ */ React15.createElement(import_ui15.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React15.createElement(import_ui15.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React15.createElement(
|
|
2230
2240
|
import_ui15.Button,
|
|
@@ -2390,6 +2400,12 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2390
2400
|
return !!errorMessage;
|
|
2391
2401
|
};
|
|
2392
2402
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
2403
|
+
const handleKeyDown = (event) => {
|
|
2404
|
+
if (event.key === "Enter" && !isSubmitDisabled) {
|
|
2405
|
+
event.preventDefault();
|
|
2406
|
+
handleUpdate();
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2393
2409
|
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(import_editor_editing_panel3.PopoverBody, { height: "auto" }, /* @__PURE__ */ React17.createElement(
|
|
2394
2410
|
import_editor_ui7.PopoverHeader,
|
|
2395
2411
|
{
|
|
@@ -2429,7 +2445,8 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2429
2445
|
value: label,
|
|
2430
2446
|
message: errorMsg
|
|
2431
2447
|
});
|
|
2432
|
-
}
|
|
2448
|
+
},
|
|
2449
|
+
onKeyDown: handleKeyDown
|
|
2433
2450
|
}
|
|
2434
2451
|
)
|
|
2435
2452
|
), ValueField && /* @__PURE__ */ React17.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n12.__)("Value", "elementor") }, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "h5" }, /* @__PURE__ */ React17.createElement(
|
|
@@ -2443,6 +2460,7 @@ var VariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
2443
2460
|
setErrorMessage("");
|
|
2444
2461
|
setValueFieldError("");
|
|
2445
2462
|
},
|
|
2463
|
+
onKeyDown: handleKeyDown,
|
|
2446
2464
|
onValidationChange: setValueFieldError,
|
|
2447
2465
|
propType
|
|
2448
2466
|
}
|
|
@@ -2949,6 +2967,12 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2949
2967
|
return !!errorMessage;
|
|
2950
2968
|
};
|
|
2951
2969
|
const isSubmitDisabled = noValueChanged() || hasEmptyFields() || hasErrors();
|
|
2970
|
+
const handleKeyDown = (event) => {
|
|
2971
|
+
if (event.key === "Enter" && !isSubmitDisabled) {
|
|
2972
|
+
event.preventDefault();
|
|
2973
|
+
handleRestore();
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2952
2976
|
return /* @__PURE__ */ React23.createElement(PopoverContentRefContextProvider, null, /* @__PURE__ */ React23.createElement(import_editor_editing_panel5.PopoverBody, { height: "auto" }, /* @__PURE__ */ React23.createElement(
|
|
2953
2977
|
import_editor_ui10.PopoverHeader,
|
|
2954
2978
|
{
|
|
@@ -2979,7 +3003,8 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2979
3003
|
value: label,
|
|
2980
3004
|
message: errorMsg
|
|
2981
3005
|
});
|
|
2982
|
-
}
|
|
3006
|
+
},
|
|
3007
|
+
onKeyDown: handleKeyDown
|
|
2983
3008
|
}
|
|
2984
3009
|
)
|
|
2985
3010
|
), ValueField && /* @__PURE__ */ React23.createElement(FormField, { errorMsg: valueFieldError, label: (0, import_i18n16.__)("Value", "elementor") }, /* @__PURE__ */ React23.createElement(import_ui23.Typography, { variant: "h5" }, /* @__PURE__ */ React23.createElement(
|
|
@@ -2994,7 +3019,8 @@ var VariableRestore = ({ variableId, onClose, onSubmit }) => {
|
|
|
2994
3019
|
setValueFieldError("");
|
|
2995
3020
|
},
|
|
2996
3021
|
onValidationChange: setValueFieldError,
|
|
2997
|
-
propType
|
|
3022
|
+
propType,
|
|
3023
|
+
onKeyDown: handleKeyDown
|
|
2998
3024
|
}
|
|
2999
3025
|
))), errorMessage && /* @__PURE__ */ React23.createElement(import_ui23.FormHelperText, { error: true }, errorMessage)), /* @__PURE__ */ React23.createElement(import_ui23.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React23.createElement(import_ui23.Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleRestore }, (0, import_i18n16.__)("Restore", "elementor")))));
|
|
3000
3026
|
};
|