@elementor/editor-variables 0.14.0 → 0.15.0
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/CHANGELOG.md +38 -0
- package/dist/index.js +397 -306
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +305 -238
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/components/color-variable-creation.tsx +12 -10
- package/src/components/color-variable-edit.tsx +29 -13
- package/src/components/color-variables-selection.tsx +33 -20
- package/src/components/font-variable-creation.tsx +12 -10
- package/src/components/font-variable-edit.tsx +30 -13
- package/src/components/font-variables-selection.tsx +33 -20
- package/src/components/ui/color-indicator.tsx +1 -0
- package/src/components/ui/menu-item-content.tsx +32 -23
- package/src/components/ui/no-search-results.tsx +6 -8
- package/src/components/ui/no-variables.tsx +3 -2
- package/src/components/ui/variable-tag.tsx +43 -0
- package/src/components/variable-selection-popover.context.ts +7 -0
- package/src/components/variable-selection-popover.tsx +17 -8
- package/src/controls/color-variable-control.tsx +12 -36
- package/src/controls/font-variable-control.tsx +10 -38
- package/src/hooks/use-prop-variables.ts +12 -18
package/dist/index.js
CHANGED
|
@@ -39,8 +39,8 @@ var import_editor = require("@elementor/editor");
|
|
|
39
39
|
|
|
40
40
|
// src/init-color-variables.ts
|
|
41
41
|
var import_editor_canvas2 = require("@elementor/editor-canvas");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
42
|
+
var import_editor_controls8 = require("@elementor/editor-controls");
|
|
43
|
+
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
44
44
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
45
45
|
|
|
46
46
|
// src/components/variables-repeater-item-slot.tsx
|
|
@@ -314,28 +314,27 @@ var useFilteredVariables = (searchValue, propTypeKey) => {
|
|
|
314
314
|
var usePropVariables = (propKey) => {
|
|
315
315
|
return (0, import_react.useMemo)(() => normalizeVariables(propKey), [propKey]);
|
|
316
316
|
};
|
|
317
|
+
var isNotDeleted = ({ deleted }) => !deleted;
|
|
317
318
|
var normalizeVariables = (propKey) => {
|
|
318
319
|
const variables = service.variables();
|
|
319
|
-
|
|
320
|
-
return Object.entries(variables).filter(([, { type }]) => type === propKey).map(([key, { label, value }]) => ({
|
|
320
|
+
return Object.entries(variables).filter(([, variable]) => variable.type === propKey && isNotDeleted(variable)).map(([key, { label, value }]) => ({
|
|
321
321
|
key,
|
|
322
322
|
label,
|
|
323
323
|
value
|
|
324
324
|
}));
|
|
325
325
|
};
|
|
326
326
|
var createVariable = (newVariable) => {
|
|
327
|
-
return service.create(newVariable).then(({ id
|
|
328
|
-
styleVariablesRepository.update({
|
|
329
|
-
[id]: variable
|
|
330
|
-
});
|
|
327
|
+
return service.create(newVariable).then(({ id }) => {
|
|
331
328
|
return id;
|
|
332
329
|
});
|
|
333
330
|
};
|
|
334
331
|
var updateVariable = (updateId, { value, label }) => {
|
|
335
|
-
return service.update(updateId, { value, label }).then(({ id
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
332
|
+
return service.update(updateId, { value, label }).then(({ id }) => {
|
|
333
|
+
return id;
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
var deleteVariable = (deleteId) => {
|
|
337
|
+
return service.delete(deleteId).then(({ id }) => {
|
|
339
338
|
return id;
|
|
340
339
|
});
|
|
341
340
|
};
|
|
@@ -343,7 +342,8 @@ var updateVariable = (updateId, { value, label }) => {
|
|
|
343
342
|
// src/components/ui/color-indicator.tsx
|
|
344
343
|
var import_ui = require("@elementor/ui");
|
|
345
344
|
var ColorIndicator = (0, import_ui.styled)(import_ui.UnstableColorIndicator)(({ theme }) => ({
|
|
346
|
-
borderRadius: `${theme.shape.borderRadius / 2}px
|
|
345
|
+
borderRadius: `${theme.shape.borderRadius / 2}px`,
|
|
346
|
+
marginRight: theme.spacing(0.25)
|
|
347
347
|
}));
|
|
348
348
|
|
|
349
349
|
// src/components/variables-repeater-item-slot.tsx
|
|
@@ -365,17 +365,43 @@ var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
|
365
365
|
};
|
|
366
366
|
|
|
367
367
|
// src/controls/color-variable-control.tsx
|
|
368
|
-
var
|
|
369
|
-
var
|
|
370
|
-
var
|
|
368
|
+
var React13 = __toESM(require("react"));
|
|
369
|
+
var import_react10 = require("react");
|
|
370
|
+
var import_editor_controls7 = require("@elementor/editor-controls");
|
|
371
371
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
372
372
|
var import_icons9 = require("@elementor/icons");
|
|
373
|
-
var
|
|
374
|
-
|
|
373
|
+
var import_ui14 = require("@elementor/ui");
|
|
374
|
+
|
|
375
|
+
// src/components/ui/variable-tag.tsx
|
|
376
|
+
var React2 = __toESM(require("react"));
|
|
377
|
+
var import_icons = require("@elementor/icons");
|
|
378
|
+
var import_ui2 = require("@elementor/ui");
|
|
379
|
+
var import_i18n = require("@wordpress/i18n");
|
|
380
|
+
var SIZE = "tiny";
|
|
381
|
+
var VariableTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
382
|
+
const actions = [];
|
|
383
|
+
if (onUnlink) {
|
|
384
|
+
actions.push(
|
|
385
|
+
/* @__PURE__ */ React2.createElement(import_ui2.IconButton, { key: "unlink", size: SIZE, onClick: onUnlink, "aria-label": (0, import_i18n.__)("Unlink", "elementor") }, /* @__PURE__ */ React2.createElement(import_icons.DetachIcon, { fontSize: SIZE }))
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
return /* @__PURE__ */ React2.createElement(
|
|
389
|
+
import_ui2.UnstableTag,
|
|
390
|
+
{
|
|
391
|
+
fullWidth: true,
|
|
392
|
+
showActionsOnHover: true,
|
|
393
|
+
startIcon: /* @__PURE__ */ React2.createElement(import_ui2.Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
394
|
+
label: /* @__PURE__ */ React2.createElement(import_ui2.Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React2.createElement(import_ui2.Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
395
|
+
actions,
|
|
396
|
+
...props
|
|
397
|
+
}
|
|
398
|
+
);
|
|
399
|
+
};
|
|
375
400
|
|
|
376
401
|
// src/components/variable-selection-popover.tsx
|
|
377
|
-
var
|
|
378
|
-
var
|
|
402
|
+
var React12 = __toESM(require("react"));
|
|
403
|
+
var import_react9 = require("react");
|
|
404
|
+
var import_ui13 = require("@elementor/ui");
|
|
379
405
|
|
|
380
406
|
// src/prop-types/color-variable-prop-type.ts
|
|
381
407
|
var import_editor_props = require("@elementor/editor-props");
|
|
@@ -388,19 +414,30 @@ var import_schema2 = require("@elementor/schema");
|
|
|
388
414
|
var fontVariablePropTypeUtil = (0, import_editor_props2.createPropUtils)("global-font-variable", import_schema2.z.string());
|
|
389
415
|
|
|
390
416
|
// src/components/color-variable-creation.tsx
|
|
391
|
-
var
|
|
392
|
-
var
|
|
417
|
+
var React3 = __toESM(require("react"));
|
|
418
|
+
var import_react3 = require("react");
|
|
393
419
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
420
|
+
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
394
421
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
395
|
-
var
|
|
396
|
-
var
|
|
397
|
-
var
|
|
398
|
-
|
|
422
|
+
var import_icons2 = require("@elementor/icons");
|
|
423
|
+
var import_ui3 = require("@elementor/ui");
|
|
424
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
425
|
+
|
|
426
|
+
// src/components/variable-selection-popover.context.ts
|
|
427
|
+
var import_react2 = require("react");
|
|
428
|
+
var PopoverContentRefContext = (0, import_react2.createContext)(null);
|
|
429
|
+
var usePopoverContentRef = () => {
|
|
430
|
+
return (0, import_react2.useContext)(PopoverContentRefContext);
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// src/components/color-variable-creation.tsx
|
|
434
|
+
var SIZE2 = "tiny";
|
|
399
435
|
var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
400
436
|
const { setValue: setVariable } = (0, import_editor_controls.useBoundProp)(colorVariablePropTypeUtil);
|
|
401
|
-
const [color, setColor] = (0,
|
|
402
|
-
const [label, setLabel] = (0,
|
|
403
|
-
const
|
|
437
|
+
const [color, setColor] = (0, import_react3.useState)("");
|
|
438
|
+
const [label, setLabel] = (0, import_react3.useState)("");
|
|
439
|
+
const defaultRef = (0, import_react3.useRef)(null);
|
|
440
|
+
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
404
441
|
const resetFields = () => {
|
|
405
442
|
setColor("");
|
|
406
443
|
setLabel("");
|
|
@@ -422,23 +459,23 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
|
422
459
|
const isFormInvalid = () => {
|
|
423
460
|
return !color?.trim() || !label?.trim();
|
|
424
461
|
};
|
|
425
|
-
return /* @__PURE__ */
|
|
462
|
+
return /* @__PURE__ */ React3.createElement(import_editor_editing_panel.PopoverScrollableContent, { height: "auto" }, /* @__PURE__ */ React3.createElement(
|
|
426
463
|
import_editor_ui.PopoverHeader,
|
|
427
464
|
{
|
|
428
|
-
icon: /* @__PURE__ */
|
|
429
|
-
title: (0,
|
|
465
|
+
icon: /* @__PURE__ */ React3.createElement(React3.Fragment, null, onGoBack && /* @__PURE__ */ React3.createElement(import_ui3.IconButton, { size: SIZE2, "aria-label": (0, import_i18n2.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React3.createElement(import_icons2.ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React3.createElement(import_icons2.BrushIcon, { fontSize: SIZE2 })),
|
|
466
|
+
title: (0, import_i18n2.__)("Create variable", "elementor"),
|
|
430
467
|
onClose: closePopover
|
|
431
468
|
}
|
|
432
|
-
), /* @__PURE__ */
|
|
433
|
-
|
|
469
|
+
), /* @__PURE__ */ React3.createElement(import_ui3.Divider, null), /* @__PURE__ */ React3.createElement(import_editor_controls.PopoverContent, { p: 2 }, /* @__PURE__ */ React3.createElement(import_ui3.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(import_ui3.FormLabel, { size: "tiny" }, (0, import_i18n2.__)("Name", "elementor"))), /* @__PURE__ */ React3.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
|
|
470
|
+
import_ui3.TextField,
|
|
434
471
|
{
|
|
435
472
|
size: "tiny",
|
|
436
473
|
fullWidth: true,
|
|
437
474
|
value: label,
|
|
438
475
|
onChange: (e) => setLabel(e.target.value)
|
|
439
476
|
}
|
|
440
|
-
))), /* @__PURE__ */
|
|
441
|
-
|
|
477
|
+
))), /* @__PURE__ */ React3.createElement(import_ui3.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(import_ui3.FormLabel, { size: "tiny" }, (0, import_i18n2.__)("Value", "elementor"))), /* @__PURE__ */ React3.createElement(import_ui3.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
|
|
478
|
+
import_ui3.UnstableColorField,
|
|
442
479
|
{
|
|
443
480
|
size: "tiny",
|
|
444
481
|
fullWidth: true,
|
|
@@ -452,25 +489,27 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
|
452
489
|
}
|
|
453
490
|
}
|
|
454
491
|
}
|
|
455
|
-
)))), /* @__PURE__ */
|
|
492
|
+
)))), /* @__PURE__ */ React3.createElement(import_ui3.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React3.createElement(import_ui3.Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, (0, import_i18n2.__)("Create", "elementor"))));
|
|
456
493
|
};
|
|
457
494
|
|
|
458
495
|
// src/components/color-variable-edit.tsx
|
|
459
|
-
var
|
|
460
|
-
var
|
|
496
|
+
var React4 = __toESM(require("react"));
|
|
497
|
+
var import_react4 = require("react");
|
|
498
|
+
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
461
499
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
462
|
-
var
|
|
463
|
-
var
|
|
464
|
-
var
|
|
465
|
-
var
|
|
500
|
+
var import_icons3 = require("@elementor/icons");
|
|
501
|
+
var import_ui4 = require("@elementor/ui");
|
|
502
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
503
|
+
var SIZE3 = "tiny";
|
|
466
504
|
var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
467
505
|
const variable = useVariable(editId);
|
|
468
506
|
if (!variable) {
|
|
469
507
|
throw new Error(`Global color variable not found`);
|
|
470
508
|
}
|
|
471
|
-
const
|
|
472
|
-
const
|
|
473
|
-
const [
|
|
509
|
+
const defaultRef = (0, import_react4.useRef)(null);
|
|
510
|
+
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
511
|
+
const [color, setColor] = (0, import_react4.useState)(variable.value);
|
|
512
|
+
const [label, setLabel] = (0, import_react4.useState)(variable.label);
|
|
474
513
|
const handleUpdate = () => {
|
|
475
514
|
updateVariable(editId, {
|
|
476
515
|
value: color,
|
|
@@ -479,26 +518,36 @@ var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
479
518
|
onSubmit?.();
|
|
480
519
|
});
|
|
481
520
|
};
|
|
521
|
+
const handleDelete = () => {
|
|
522
|
+
deleteVariable(editId).then(() => {
|
|
523
|
+
onSubmit?.();
|
|
524
|
+
});
|
|
525
|
+
};
|
|
482
526
|
const noValueChanged = () => color === variable.value && label === variable.label;
|
|
483
527
|
const hasEmptyValue = () => "" === color.trim() || "" === label.trim();
|
|
484
528
|
const isSaveDisabled = () => noValueChanged() || hasEmptyValue();
|
|
485
|
-
|
|
529
|
+
const actions = [];
|
|
530
|
+
actions.push(
|
|
531
|
+
/* @__PURE__ */ React4.createElement(import_ui4.IconButton, { key: "delete", size: SIZE3, "aria-label": (0, import_i18n3.__)("Delete", "elementor"), onClick: handleDelete }, /* @__PURE__ */ React4.createElement(import_icons3.TrashIcon, { fontSize: SIZE3 }))
|
|
532
|
+
);
|
|
533
|
+
return /* @__PURE__ */ React4.createElement(import_editor_ui2.PopoverScrollableContent, { height: "auto" }, /* @__PURE__ */ React4.createElement(
|
|
486
534
|
import_editor_ui2.PopoverHeader,
|
|
487
535
|
{
|
|
488
|
-
title: (0,
|
|
536
|
+
title: (0, import_i18n3.__)("Edit variable", "elementor"),
|
|
489
537
|
onClose,
|
|
490
|
-
icon: /* @__PURE__ */
|
|
538
|
+
icon: /* @__PURE__ */ React4.createElement(React4.Fragment, null, onGoBack && /* @__PURE__ */ React4.createElement(import_ui4.IconButton, { size: SIZE3, "aria-label": (0, import_i18n3.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React4.createElement(import_icons3.ArrowLeftIcon, { fontSize: SIZE3 })), /* @__PURE__ */ React4.createElement(import_icons3.BrushIcon, { fontSize: SIZE3 })),
|
|
539
|
+
actions
|
|
491
540
|
}
|
|
492
|
-
), /* @__PURE__ */
|
|
493
|
-
|
|
541
|
+
), /* @__PURE__ */ React4.createElement(import_ui4.Divider, null), /* @__PURE__ */ React4.createElement(import_editor_controls2.PopoverContent, { p: 2 }, /* @__PURE__ */ React4.createElement(import_ui4.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React4.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(import_ui4.FormLabel, { size: "tiny" }, (0, import_i18n3.__)("Name", "elementor"))), /* @__PURE__ */ React4.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(
|
|
542
|
+
import_ui4.TextField,
|
|
494
543
|
{
|
|
495
544
|
size: "tiny",
|
|
496
545
|
fullWidth: true,
|
|
497
546
|
value: label,
|
|
498
547
|
onChange: (e) => setLabel(e.target.value)
|
|
499
548
|
}
|
|
500
|
-
))), /* @__PURE__ */
|
|
501
|
-
|
|
549
|
+
))), /* @__PURE__ */ React4.createElement(import_ui4.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React4.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(import_ui4.FormLabel, { size: "tiny" }, (0, import_i18n3.__)("Value", "elementor"))), /* @__PURE__ */ React4.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(
|
|
550
|
+
import_ui4.UnstableColorField,
|
|
502
551
|
{
|
|
503
552
|
size: "tiny",
|
|
504
553
|
fullWidth: true,
|
|
@@ -512,92 +561,105 @@ var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
512
561
|
}
|
|
513
562
|
}
|
|
514
563
|
}
|
|
515
|
-
)))), /* @__PURE__ */
|
|
564
|
+
)))), /* @__PURE__ */ React4.createElement(import_ui4.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React4.createElement(import_ui4.Button, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, (0, import_i18n3.__)("Save", "elementor"))));
|
|
516
565
|
};
|
|
517
566
|
|
|
518
567
|
// src/components/color-variables-selection.tsx
|
|
519
|
-
var
|
|
520
|
-
var
|
|
521
|
-
var
|
|
522
|
-
var
|
|
568
|
+
var React8 = __toESM(require("react"));
|
|
569
|
+
var import_react5 = require("react");
|
|
570
|
+
var import_editor_controls3 = require("@elementor/editor-controls");
|
|
571
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
572
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
523
573
|
var import_icons5 = require("@elementor/icons");
|
|
524
|
-
var
|
|
525
|
-
var
|
|
574
|
+
var import_ui9 = require("@elementor/ui");
|
|
575
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
526
576
|
|
|
527
577
|
// src/components/ui/menu-item-content.tsx
|
|
528
|
-
var
|
|
529
|
-
var
|
|
530
|
-
var
|
|
531
|
-
var
|
|
532
|
-
var
|
|
578
|
+
var React5 = __toESM(require("react"));
|
|
579
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
580
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
581
|
+
var import_icons4 = require("@elementor/icons");
|
|
582
|
+
var import_ui5 = require("@elementor/ui");
|
|
583
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
584
|
+
var SIZE4 = "tiny";
|
|
585
|
+
var isVersion330Active = (0, import_editor_v1_adapters.isExperimentActive)("e_v_3_30");
|
|
533
586
|
var MenuItemContent = ({ item }) => {
|
|
534
587
|
const onEdit = item.onEdit;
|
|
535
|
-
return /* @__PURE__ */
|
|
536
|
-
|
|
588
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(import_ui5.ListItemIcon, null, item.icon), /* @__PURE__ */ React5.createElement(
|
|
589
|
+
import_ui5.Box,
|
|
537
590
|
{
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
591
|
+
sx: {
|
|
592
|
+
flex: 1,
|
|
593
|
+
minWidth: 0,
|
|
594
|
+
display: "flex",
|
|
595
|
+
alignItems: "center",
|
|
596
|
+
gap: 1
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
/* @__PURE__ */ React5.createElement(
|
|
600
|
+
import_editor_ui3.EllipsisWithTooltip,
|
|
601
|
+
{
|
|
602
|
+
title: item.label || item.value,
|
|
603
|
+
as: import_ui5.Typography,
|
|
604
|
+
variant: isVersion330Active ? "caption" : "body2",
|
|
605
|
+
color: isVersion330Active ? "text.primary" : "text.secondary",
|
|
606
|
+
sx: { marginTop: "1px", lineHeight: "2" },
|
|
607
|
+
maxWidth: "50%"
|
|
608
|
+
}
|
|
609
|
+
),
|
|
610
|
+
item.secondaryText && /* @__PURE__ */ React5.createElement(
|
|
611
|
+
import_editor_ui3.EllipsisWithTooltip,
|
|
612
|
+
{
|
|
613
|
+
title: item.secondaryText,
|
|
614
|
+
as: import_ui5.Typography,
|
|
553
615
|
variant: "caption",
|
|
554
616
|
color: "text.tertiary",
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
), !!onEdit && /* @__PURE__ */
|
|
560
|
-
|
|
617
|
+
sx: { marginTop: "1px", lineHeight: "1" },
|
|
618
|
+
maxWidth: "50%"
|
|
619
|
+
}
|
|
620
|
+
)
|
|
621
|
+
), !!onEdit && /* @__PURE__ */ React5.createElement(
|
|
622
|
+
import_ui5.IconButton,
|
|
561
623
|
{
|
|
562
624
|
sx: { mx: 1, opacity: "0" },
|
|
563
625
|
onClick: (e) => {
|
|
564
626
|
e.stopPropagation();
|
|
565
627
|
onEdit(item.value);
|
|
566
628
|
},
|
|
567
|
-
"aria-label": (0,
|
|
629
|
+
"aria-label": (0, import_i18n4.__)("Edit", "elementor")
|
|
568
630
|
},
|
|
569
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ React5.createElement(import_icons4.EditIcon, { color: "action", fontSize: SIZE4 })
|
|
570
632
|
));
|
|
571
633
|
};
|
|
572
634
|
|
|
573
635
|
// src/components/ui/no-search-results.tsx
|
|
574
|
-
var
|
|
575
|
-
var
|
|
576
|
-
var
|
|
577
|
-
var
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
import_ui5.Stack,
|
|
636
|
+
var React6 = __toESM(require("react"));
|
|
637
|
+
var import_ui6 = require("@elementor/ui");
|
|
638
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
639
|
+
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
640
|
+
return /* @__PURE__ */ React6.createElement(
|
|
641
|
+
import_ui6.Stack,
|
|
581
642
|
{
|
|
582
643
|
gap: 1,
|
|
583
644
|
alignItems: "center",
|
|
584
645
|
justifyContent: "center",
|
|
585
646
|
height: "100%",
|
|
647
|
+
p: 2.5,
|
|
586
648
|
color: "text.secondary",
|
|
587
|
-
sx: {
|
|
649
|
+
sx: { pb: 3.5 }
|
|
588
650
|
},
|
|
589
|
-
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
/* @__PURE__ */
|
|
651
|
+
icon,
|
|
652
|
+
/* @__PURE__ */ React6.createElement(import_ui6.Typography, { align: "center", variant: "subtitle2" }, (0, import_i18n5.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React6.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
653
|
+
/* @__PURE__ */ React6.createElement(import_ui6.Typography, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, (0, import_i18n5.__)("Try something else.", "elementor"), /* @__PURE__ */ React6.createElement(import_ui6.Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n5.__)("Clear & try again", "elementor")))
|
|
592
654
|
);
|
|
593
655
|
};
|
|
594
656
|
|
|
595
657
|
// src/components/ui/no-variables.tsx
|
|
596
|
-
var
|
|
597
|
-
var
|
|
598
|
-
var
|
|
599
|
-
var NoVariables = ({ icon, onAdd }) => /* @__PURE__ */
|
|
600
|
-
|
|
658
|
+
var React7 = __toESM(require("react"));
|
|
659
|
+
var import_ui7 = require("@elementor/ui");
|
|
660
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
661
|
+
var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React7.createElement(
|
|
662
|
+
import_ui7.Stack,
|
|
601
663
|
{
|
|
602
664
|
gap: 1,
|
|
603
665
|
alignItems: "center",
|
|
@@ -607,14 +669,14 @@ var NoVariables = ({ icon, onAdd }) => /* @__PURE__ */ React6.createElement(
|
|
|
607
669
|
sx: { p: 2.5, pb: 5.5 }
|
|
608
670
|
},
|
|
609
671
|
icon,
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */
|
|
612
|
-
onAdd && /* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ React7.createElement(import_ui7.Typography, { align: "center", variant: "subtitle2" }, title),
|
|
673
|
+
/* @__PURE__ */ React7.createElement(import_ui7.Typography, { align: "center", variant: "caption", maxWidth: "180px" }, (0, import_i18n6.__)("Variables are saved attributes that you can apply anywhere on your site.", "elementor")),
|
|
674
|
+
onAdd && /* @__PURE__ */ React7.createElement(import_ui7.Button, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, (0, import_i18n6.__)("Create a variable", "elementor"))
|
|
613
675
|
);
|
|
614
676
|
|
|
615
677
|
// src/components/ui/styled-menu-list.tsx
|
|
616
|
-
var
|
|
617
|
-
var VariablesStyledMenuList = (0,
|
|
678
|
+
var import_ui8 = require("@elementor/ui");
|
|
679
|
+
var VariablesStyledMenuList = (0, import_ui8.styled)(import_ui8.MenuList)(({ theme }) => ({
|
|
618
680
|
"& > li": {
|
|
619
681
|
height: 32,
|
|
620
682
|
width: "100%",
|
|
@@ -645,10 +707,10 @@ var VariablesStyledMenuList = (0, import_ui7.styled)(import_ui7.MenuList)(({ the
|
|
|
645
707
|
}));
|
|
646
708
|
|
|
647
709
|
// src/components/color-variables-selection.tsx
|
|
648
|
-
var
|
|
710
|
+
var SIZE5 = "tiny";
|
|
649
711
|
var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
650
|
-
const { value: variable, setValue: setVariable } = (0,
|
|
651
|
-
const [searchValue, setSearchValue] = (0,
|
|
712
|
+
const { value: variable, setValue: setVariable } = (0, import_editor_controls3.useBoundProp)(colorVariablePropTypeUtil);
|
|
713
|
+
const [searchValue, setSearchValue] = (0, import_react5.useState)("");
|
|
652
714
|
const {
|
|
653
715
|
list: variables,
|
|
654
716
|
hasMatches: hasSearchResults,
|
|
@@ -661,19 +723,19 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
661
723
|
const actions = [];
|
|
662
724
|
if (onAdd) {
|
|
663
725
|
actions.push(
|
|
664
|
-
/* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ React8.createElement(import_ui9.IconButton, { key: "add", size: SIZE5, onClick: onAdd }, /* @__PURE__ */ React8.createElement(import_icons5.PlusIcon, { fontSize: SIZE5 }))
|
|
665
727
|
);
|
|
666
728
|
}
|
|
667
729
|
if (onSettings) {
|
|
668
730
|
actions.push(
|
|
669
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ React8.createElement(import_ui9.IconButton, { key: "settings", size: SIZE5, onClick: onSettings }, /* @__PURE__ */ React8.createElement(import_icons5.SettingsIcon, { fontSize: SIZE5 }))
|
|
670
732
|
);
|
|
671
733
|
}
|
|
672
734
|
const items = variables.map(({ value, label, key }) => ({
|
|
673
735
|
type: "item",
|
|
674
736
|
value: key,
|
|
675
737
|
label,
|
|
676
|
-
icon: /* @__PURE__ */
|
|
738
|
+
icon: /* @__PURE__ */ React8.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
677
739
|
secondaryText: value,
|
|
678
740
|
onEdit: () => onEdit?.(key)
|
|
679
741
|
}));
|
|
@@ -683,23 +745,23 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
683
745
|
const handleClearSearch = () => {
|
|
684
746
|
setSearchValue("");
|
|
685
747
|
};
|
|
686
|
-
return /* @__PURE__ */
|
|
687
|
-
|
|
748
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
|
|
749
|
+
import_editor_ui4.PopoverHeader,
|
|
688
750
|
{
|
|
689
|
-
title: (0,
|
|
690
|
-
icon: /* @__PURE__ */
|
|
751
|
+
title: (0, import_i18n7.__)("Variables", "elementor"),
|
|
752
|
+
icon: /* @__PURE__ */ React8.createElement(import_icons5.ColorFilterIcon, { fontSize: SIZE5 }),
|
|
691
753
|
onClose: closePopover,
|
|
692
754
|
actions
|
|
693
755
|
}
|
|
694
|
-
), hasVariables && /* @__PURE__ */
|
|
695
|
-
|
|
756
|
+
), hasVariables && /* @__PURE__ */ React8.createElement(
|
|
757
|
+
import_editor_ui4.PopoverSearch,
|
|
696
758
|
{
|
|
697
759
|
value: searchValue,
|
|
698
760
|
onSearch: handleSearch,
|
|
699
|
-
placeholder: (0,
|
|
761
|
+
placeholder: (0, import_i18n7.__)("Search", "elementor")
|
|
700
762
|
}
|
|
701
|
-
), /* @__PURE__ */
|
|
702
|
-
|
|
763
|
+
), /* @__PURE__ */ React8.createElement(import_ui9.Divider, null), /* @__PURE__ */ React8.createElement(import_editor_editing_panel2.PopoverScrollableContent, null, hasVariables && hasSearchResults && /* @__PURE__ */ React8.createElement(
|
|
764
|
+
import_editor_ui4.PopoverMenuList,
|
|
703
765
|
{
|
|
704
766
|
items,
|
|
705
767
|
onSelect: handleSetColorVariable,
|
|
@@ -708,28 +770,42 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
708
770
|
selectedValue: variable,
|
|
709
771
|
"data-testid": "color-variables-list",
|
|
710
772
|
menuListTemplate: VariablesStyledMenuList,
|
|
711
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
773
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React8.createElement(MenuItemContent, { item })
|
|
774
|
+
}
|
|
775
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React8.createElement(
|
|
776
|
+
NoSearchResults,
|
|
777
|
+
{
|
|
778
|
+
searchValue,
|
|
779
|
+
onClear: handleClearSearch,
|
|
780
|
+
icon: /* @__PURE__ */ React8.createElement(import_icons5.BrushIcon, { fontSize: "large" })
|
|
781
|
+
}
|
|
782
|
+
), !hasVariables && /* @__PURE__ */ React8.createElement(
|
|
783
|
+
NoVariables,
|
|
784
|
+
{
|
|
785
|
+
title: (0, import_i18n7.__)("Create your first color variable", "elementor"),
|
|
786
|
+
icon: /* @__PURE__ */ React8.createElement(import_icons5.BrushIcon, { fontSize: "large" }),
|
|
787
|
+
onAdd
|
|
712
788
|
}
|
|
713
|
-
)
|
|
789
|
+
)));
|
|
714
790
|
};
|
|
715
791
|
|
|
716
792
|
// src/components/font-variable-creation.tsx
|
|
717
|
-
var
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
var
|
|
721
|
-
var
|
|
793
|
+
var React9 = __toESM(require("react"));
|
|
794
|
+
var import_react6 = require("react");
|
|
795
|
+
var import_editor_controls4 = require("@elementor/editor-controls");
|
|
796
|
+
var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
|
|
797
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
722
798
|
var import_icons6 = require("@elementor/icons");
|
|
723
|
-
var
|
|
724
|
-
var
|
|
725
|
-
var
|
|
799
|
+
var import_ui10 = require("@elementor/ui");
|
|
800
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
801
|
+
var SIZE6 = "tiny";
|
|
726
802
|
var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
727
|
-
const fontFamilies = (0,
|
|
728
|
-
const { setValue: setVariable } = (0,
|
|
729
|
-
const [fontFamily, setFontFamily] = (0,
|
|
730
|
-
const [label, setLabel] = (0,
|
|
731
|
-
const anchorRef = (0,
|
|
732
|
-
const fontPopoverState = (0,
|
|
803
|
+
const fontFamilies = (0, import_editor_editing_panel3.useFontFamilies)();
|
|
804
|
+
const { setValue: setVariable } = (0, import_editor_controls4.useBoundProp)(fontVariablePropTypeUtil);
|
|
805
|
+
const [fontFamily, setFontFamily] = (0, import_react6.useState)("");
|
|
806
|
+
const [label, setLabel] = (0, import_react6.useState)("");
|
|
807
|
+
const anchorRef = (0, import_react6.useRef)(null);
|
|
808
|
+
const fontPopoverState = (0, import_ui10.usePopupState)({ variant: "popover" });
|
|
733
809
|
const resetFields = () => {
|
|
734
810
|
setFontFamily("");
|
|
735
811
|
setLabel("");
|
|
@@ -751,74 +827,76 @@ var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
|
751
827
|
const isFormInvalid = () => {
|
|
752
828
|
return !fontFamily?.trim() || !label?.trim();
|
|
753
829
|
};
|
|
754
|
-
|
|
755
|
-
|
|
830
|
+
const sectionWidth = (0, import_editor_editing_panel3.useSectionWidth)();
|
|
831
|
+
return /* @__PURE__ */ React9.createElement(import_editor_editing_panel3.PopoverScrollableContent, { height: "auto" }, /* @__PURE__ */ React9.createElement(
|
|
832
|
+
import_editor_ui5.PopoverHeader,
|
|
756
833
|
{
|
|
757
|
-
icon: /* @__PURE__ */
|
|
758
|
-
title: (0,
|
|
834
|
+
icon: /* @__PURE__ */ React9.createElement(React9.Fragment, null, onGoBack && /* @__PURE__ */ React9.createElement(import_ui10.IconButton, { size: SIZE6, "aria-label": (0, import_i18n8.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React9.createElement(import_icons6.ArrowLeftIcon, { fontSize: SIZE6 })), /* @__PURE__ */ React9.createElement(import_icons6.TextIcon, { fontSize: SIZE6 })),
|
|
835
|
+
title: (0, import_i18n8.__)("Create variable", "elementor"),
|
|
759
836
|
onClose: closePopover
|
|
760
837
|
}
|
|
761
|
-
), /* @__PURE__ */
|
|
762
|
-
|
|
838
|
+
), /* @__PURE__ */ React9.createElement(import_ui10.Divider, null), /* @__PURE__ */ React9.createElement(import_editor_controls4.PopoverContent, { p: 2 }, /* @__PURE__ */ React9.createElement(import_ui10.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React9.createElement(import_ui10.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(import_ui10.FormLabel, { size: "tiny" }, (0, import_i18n8.__)("Name", "elementor"))), /* @__PURE__ */ React9.createElement(import_ui10.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(
|
|
839
|
+
import_ui10.TextField,
|
|
763
840
|
{
|
|
764
841
|
size: "tiny",
|
|
765
842
|
fullWidth: true,
|
|
766
843
|
value: label,
|
|
767
844
|
onChange: (e) => setLabel(e.target.value)
|
|
768
845
|
}
|
|
769
|
-
))), /* @__PURE__ */
|
|
770
|
-
|
|
846
|
+
))), /* @__PURE__ */ React9.createElement(import_ui10.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React9.createElement(import_ui10.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(import_ui10.FormLabel, { size: "tiny" }, (0, import_i18n8.__)("Value", "elementor"))), /* @__PURE__ */ React9.createElement(import_ui10.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
|
|
847
|
+
import_ui10.UnstableTag,
|
|
771
848
|
{
|
|
772
849
|
variant: "outlined",
|
|
773
850
|
label: fontFamily,
|
|
774
|
-
endIcon: /* @__PURE__ */
|
|
775
|
-
...(0,
|
|
851
|
+
endIcon: /* @__PURE__ */ React9.createElement(import_icons6.ChevronDownIcon, { fontSize: "tiny" }),
|
|
852
|
+
...(0, import_ui10.bindTrigger)(fontPopoverState),
|
|
776
853
|
fullWidth: true
|
|
777
854
|
}
|
|
778
|
-
), /* @__PURE__ */
|
|
779
|
-
|
|
855
|
+
), /* @__PURE__ */ React9.createElement(
|
|
856
|
+
import_ui10.Popover,
|
|
780
857
|
{
|
|
781
858
|
disablePortal: true,
|
|
782
859
|
disableScrollLock: true,
|
|
783
860
|
anchorEl: anchorRef.current,
|
|
784
861
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
785
862
|
transformOrigin: { vertical: "top", horizontal: -20 },
|
|
786
|
-
...(0,
|
|
863
|
+
...(0, import_ui10.bindPopover)(fontPopoverState)
|
|
787
864
|
},
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
|
|
865
|
+
/* @__PURE__ */ React9.createElement(
|
|
866
|
+
import_editor_controls4.FontFamilySelector,
|
|
790
867
|
{
|
|
791
868
|
fontFamilies,
|
|
792
869
|
fontFamily,
|
|
793
870
|
onFontFamilyChange: setFontFamily,
|
|
794
|
-
onClose: fontPopoverState.close
|
|
871
|
+
onClose: fontPopoverState.close,
|
|
872
|
+
sectionWidth
|
|
795
873
|
}
|
|
796
874
|
)
|
|
797
|
-
))))), /* @__PURE__ */
|
|
875
|
+
))))), /* @__PURE__ */ React9.createElement(import_ui10.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React9.createElement(import_ui10.Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, (0, import_i18n8.__)("Create", "elementor"))));
|
|
798
876
|
};
|
|
799
877
|
|
|
800
878
|
// src/components/font-variable-edit.tsx
|
|
801
|
-
var
|
|
802
|
-
var
|
|
803
|
-
var
|
|
804
|
-
var
|
|
805
|
-
var
|
|
879
|
+
var React10 = __toESM(require("react"));
|
|
880
|
+
var import_react7 = require("react");
|
|
881
|
+
var import_editor_controls5 = require("@elementor/editor-controls");
|
|
882
|
+
var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
|
|
883
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
806
884
|
var import_icons7 = require("@elementor/icons");
|
|
807
|
-
var
|
|
808
|
-
var
|
|
809
|
-
var
|
|
885
|
+
var import_ui11 = require("@elementor/ui");
|
|
886
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
887
|
+
var SIZE7 = "tiny";
|
|
810
888
|
var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
811
889
|
const variable = useVariable(editId);
|
|
812
890
|
if (!variable) {
|
|
813
891
|
throw new Error(`Global font variable "${editId}" not found`);
|
|
814
892
|
}
|
|
815
|
-
const [fontFamily, setFontFamily] = (0,
|
|
816
|
-
const [label, setLabel] = (0,
|
|
817
|
-
const variableNameId = (0,
|
|
818
|
-
const variableValueId = (0,
|
|
819
|
-
const anchorRef = (0,
|
|
820
|
-
const fontPopoverState = (0,
|
|
821
|
-
const fontFamilies = (0,
|
|
893
|
+
const [fontFamily, setFontFamily] = (0, import_react7.useState)(variable.value);
|
|
894
|
+
const [label, setLabel] = (0, import_react7.useState)(variable.label);
|
|
895
|
+
const variableNameId = (0, import_react7.useId)();
|
|
896
|
+
const variableValueId = (0, import_react7.useId)();
|
|
897
|
+
const anchorRef = (0, import_react7.useRef)(null);
|
|
898
|
+
const fontPopoverState = (0, import_ui11.usePopupState)({ variant: "popover" });
|
|
899
|
+
const fontFamilies = (0, import_editor_editing_panel4.useFontFamilies)();
|
|
822
900
|
const handleUpdate = () => {
|
|
823
901
|
updateVariable(editId, {
|
|
824
902
|
value: fontFamily,
|
|
@@ -827,18 +905,29 @@ var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
827
905
|
onSubmit?.();
|
|
828
906
|
});
|
|
829
907
|
};
|
|
908
|
+
const handleDelete = () => {
|
|
909
|
+
deleteVariable(editId).then(() => {
|
|
910
|
+
onSubmit?.();
|
|
911
|
+
});
|
|
912
|
+
};
|
|
830
913
|
const noValueChanged = () => fontFamily === variable.value && label === variable.label;
|
|
831
914
|
const hasEmptyValue = () => "" === fontFamily.trim() || "" === label.trim();
|
|
832
915
|
const isSaveDisabled = () => noValueChanged() || hasEmptyValue();
|
|
833
|
-
|
|
834
|
-
|
|
916
|
+
const sectionWidth = (0, import_editor_editing_panel4.useSectionWidth)();
|
|
917
|
+
const actions = [];
|
|
918
|
+
actions.push(
|
|
919
|
+
/* @__PURE__ */ React10.createElement(import_ui11.IconButton, { key: "delete", size: SIZE7, "aria-label": (0, import_i18n9.__)("Delete", "elementor"), onClick: handleDelete }, /* @__PURE__ */ React10.createElement(import_icons7.TrashIcon, { fontSize: SIZE7 }))
|
|
920
|
+
);
|
|
921
|
+
return /* @__PURE__ */ React10.createElement(import_editor_ui6.PopoverScrollableContent, { height: "auto" }, /* @__PURE__ */ React10.createElement(
|
|
922
|
+
import_editor_ui6.PopoverHeader,
|
|
835
923
|
{
|
|
836
|
-
icon: /* @__PURE__ */
|
|
837
|
-
title: (0,
|
|
838
|
-
onClose
|
|
924
|
+
icon: /* @__PURE__ */ React10.createElement(React10.Fragment, null, onGoBack && /* @__PURE__ */ React10.createElement(import_ui11.IconButton, { size: SIZE7, "aria-label": (0, import_i18n9.__)("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React10.createElement(import_icons7.ArrowLeftIcon, { fontSize: SIZE7 })), /* @__PURE__ */ React10.createElement(import_icons7.TextIcon, { fontSize: SIZE7 })),
|
|
925
|
+
title: (0, import_i18n9.__)("Edit variable", "elementor"),
|
|
926
|
+
onClose,
|
|
927
|
+
actions
|
|
839
928
|
}
|
|
840
|
-
), /* @__PURE__ */
|
|
841
|
-
|
|
929
|
+
), /* @__PURE__ */ React10.createElement(import_ui11.Divider, null), /* @__PURE__ */ React10.createElement(import_editor_controls5.PopoverContent, { p: 2 }, /* @__PURE__ */ React10.createElement(import_ui11.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui11.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(import_ui11.FormLabel, { htmlFor: variableNameId, size: "tiny" }, (0, import_i18n9.__)("Name", "elementor"))), /* @__PURE__ */ React10.createElement(import_ui11.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(
|
|
930
|
+
import_ui11.TextField,
|
|
842
931
|
{
|
|
843
932
|
id: variableNameId,
|
|
844
933
|
size: "tiny",
|
|
@@ -846,50 +935,52 @@ var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
846
935
|
value: label,
|
|
847
936
|
onChange: (e) => setLabel(e.target.value)
|
|
848
937
|
}
|
|
849
|
-
))), /* @__PURE__ */
|
|
850
|
-
|
|
938
|
+
))), /* @__PURE__ */ React10.createElement(import_ui11.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(import_ui11.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(import_ui11.FormLabel, { htmlFor: variableValueId, size: "tiny" }, (0, import_i18n9.__)("Value", "elementor"))), /* @__PURE__ */ React10.createElement(import_ui11.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
|
|
939
|
+
import_ui11.UnstableTag,
|
|
851
940
|
{
|
|
852
941
|
id: variableValueId,
|
|
853
942
|
variant: "outlined",
|
|
854
943
|
label: fontFamily,
|
|
855
|
-
endIcon: /* @__PURE__ */
|
|
856
|
-
...(0,
|
|
944
|
+
endIcon: /* @__PURE__ */ React10.createElement(import_icons7.ChevronDownIcon, { fontSize: "tiny" }),
|
|
945
|
+
...(0, import_ui11.bindTrigger)(fontPopoverState),
|
|
857
946
|
fullWidth: true
|
|
858
947
|
}
|
|
859
|
-
), /* @__PURE__ */
|
|
860
|
-
|
|
948
|
+
), /* @__PURE__ */ React10.createElement(
|
|
949
|
+
import_ui11.Popover,
|
|
861
950
|
{
|
|
862
951
|
disablePortal: true,
|
|
863
952
|
disableScrollLock: true,
|
|
864
953
|
anchorEl: anchorRef.current,
|
|
865
954
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
866
955
|
transformOrigin: { vertical: "top", horizontal: -20 },
|
|
867
|
-
...(0,
|
|
956
|
+
...(0, import_ui11.bindPopover)(fontPopoverState)
|
|
868
957
|
},
|
|
869
|
-
/* @__PURE__ */
|
|
870
|
-
|
|
958
|
+
/* @__PURE__ */ React10.createElement(
|
|
959
|
+
import_editor_controls5.FontFamilySelector,
|
|
871
960
|
{
|
|
872
961
|
fontFamilies,
|
|
873
962
|
fontFamily,
|
|
874
963
|
onFontFamilyChange: setFontFamily,
|
|
875
|
-
onClose: fontPopoverState.close
|
|
964
|
+
onClose: fontPopoverState.close,
|
|
965
|
+
sectionWidth
|
|
876
966
|
}
|
|
877
967
|
)
|
|
878
|
-
))))), /* @__PURE__ */
|
|
968
|
+
))))), /* @__PURE__ */ React10.createElement(import_ui11.CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React10.createElement(import_ui11.Button, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, (0, import_i18n9.__)("Save", "elementor"))));
|
|
879
969
|
};
|
|
880
970
|
|
|
881
971
|
// src/components/font-variables-selection.tsx
|
|
882
|
-
var
|
|
883
|
-
var
|
|
884
|
-
var
|
|
885
|
-
var
|
|
972
|
+
var React11 = __toESM(require("react"));
|
|
973
|
+
var import_react8 = require("react");
|
|
974
|
+
var import_editor_controls6 = require("@elementor/editor-controls");
|
|
975
|
+
var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
|
|
976
|
+
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
886
977
|
var import_icons8 = require("@elementor/icons");
|
|
887
|
-
var
|
|
888
|
-
var
|
|
889
|
-
var
|
|
978
|
+
var import_ui12 = require("@elementor/ui");
|
|
979
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
980
|
+
var SIZE8 = "tiny";
|
|
890
981
|
var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
891
|
-
const { value: variable, setValue: setVariable } = (0,
|
|
892
|
-
const [searchValue, setSearchValue] = (0,
|
|
982
|
+
const { value: variable, setValue: setVariable } = (0, import_editor_controls6.useBoundProp)(fontVariablePropTypeUtil);
|
|
983
|
+
const [searchValue, setSearchValue] = (0, import_react8.useState)("");
|
|
893
984
|
const {
|
|
894
985
|
list: variables,
|
|
895
986
|
hasMatches: hasSearchResults,
|
|
@@ -902,19 +993,19 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
902
993
|
const actions = [];
|
|
903
994
|
if (onAdd) {
|
|
904
995
|
actions.push(
|
|
905
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ React11.createElement(import_ui12.IconButton, { key: "add", size: SIZE8, onClick: onAdd }, /* @__PURE__ */ React11.createElement(import_icons8.PlusIcon, { fontSize: SIZE8 }))
|
|
906
997
|
);
|
|
907
998
|
}
|
|
908
999
|
if (onSettings) {
|
|
909
1000
|
actions.push(
|
|
910
|
-
/* @__PURE__ */
|
|
1001
|
+
/* @__PURE__ */ React11.createElement(import_ui12.IconButton, { key: "settings", size: SIZE8, onClick: onSettings }, /* @__PURE__ */ React11.createElement(import_icons8.SettingsIcon, { fontSize: SIZE8 }))
|
|
911
1002
|
);
|
|
912
1003
|
}
|
|
913
1004
|
const items = variables.map(({ value, label, key }) => ({
|
|
914
1005
|
type: "item",
|
|
915
1006
|
value: key,
|
|
916
1007
|
label,
|
|
917
|
-
icon: /* @__PURE__ */
|
|
1008
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons8.TextIcon, { fontSize: SIZE8 }),
|
|
918
1009
|
secondaryText: value,
|
|
919
1010
|
onEdit: () => onEdit?.(key)
|
|
920
1011
|
}));
|
|
@@ -924,23 +1015,23 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
924
1015
|
const handleClearSearch = () => {
|
|
925
1016
|
setSearchValue("");
|
|
926
1017
|
};
|
|
927
|
-
return /* @__PURE__ */
|
|
928
|
-
|
|
1018
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1019
|
+
import_editor_ui7.PopoverHeader,
|
|
929
1020
|
{
|
|
930
|
-
title: (0,
|
|
1021
|
+
title: (0, import_i18n10.__)("Variables", "elementor"),
|
|
931
1022
|
onClose: closePopover,
|
|
932
|
-
icon: /* @__PURE__ */
|
|
1023
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons8.ColorFilterIcon, { fontSize: SIZE8 }),
|
|
933
1024
|
actions
|
|
934
1025
|
}
|
|
935
|
-
), hasVariables && /* @__PURE__ */
|
|
936
|
-
|
|
1026
|
+
), hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1027
|
+
import_editor_ui7.PopoverSearch,
|
|
937
1028
|
{
|
|
938
1029
|
value: searchValue,
|
|
939
1030
|
onSearch: handleSearch,
|
|
940
|
-
placeholder: (0,
|
|
1031
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor")
|
|
941
1032
|
}
|
|
942
|
-
), /* @__PURE__ */
|
|
943
|
-
|
|
1033
|
+
), /* @__PURE__ */ React11.createElement(import_ui12.Divider, null), /* @__PURE__ */ React11.createElement(import_editor_editing_panel5.PopoverScrollableContent, null, hasVariables && hasSearchResults && /* @__PURE__ */ React11.createElement(
|
|
1034
|
+
import_editor_ui7.PopoverMenuList,
|
|
944
1035
|
{
|
|
945
1036
|
items,
|
|
946
1037
|
onSelect: handleSetVariable,
|
|
@@ -949,9 +1040,23 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
949
1040
|
selectedValue: variable,
|
|
950
1041
|
"data-testid": "font-variables-list",
|
|
951
1042
|
menuListTemplate: VariablesStyledMenuList,
|
|
952
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
1043
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React11.createElement(MenuItemContent, { item })
|
|
953
1044
|
}
|
|
954
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
1045
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1046
|
+
NoSearchResults,
|
|
1047
|
+
{
|
|
1048
|
+
searchValue,
|
|
1049
|
+
onClear: handleClearSearch,
|
|
1050
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons8.TextIcon, { fontSize: "large" })
|
|
1051
|
+
}
|
|
1052
|
+
), !hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1053
|
+
NoVariables,
|
|
1054
|
+
{
|
|
1055
|
+
title: (0, import_i18n10.__)("Create your first font variable", "elementor"),
|
|
1056
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons8.TextIcon, { fontSize: "large" }),
|
|
1057
|
+
onAdd
|
|
1058
|
+
}
|
|
1059
|
+
)));
|
|
955
1060
|
};
|
|
956
1061
|
|
|
957
1062
|
// src/components/variable-selection-popover.tsx
|
|
@@ -959,16 +1064,17 @@ var VIEW_LIST = "list";
|
|
|
959
1064
|
var VIEW_ADD = "add";
|
|
960
1065
|
var VIEW_EDIT = "edit";
|
|
961
1066
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
962
|
-
const [currentView, setCurrentView] = (0,
|
|
963
|
-
const editIdRef = (0,
|
|
964
|
-
|
|
1067
|
+
const [currentView, setCurrentView] = (0, import_react9.useState)(VIEW_LIST);
|
|
1068
|
+
const editIdRef = (0, import_react9.useRef)("");
|
|
1069
|
+
const anchorRef = (0, import_react9.useRef)(null);
|
|
1070
|
+
return /* @__PURE__ */ React12.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React12.createElement(import_ui13.Box, { ref: anchorRef }, renderStage({
|
|
965
1071
|
propTypeKey,
|
|
966
1072
|
currentView,
|
|
967
1073
|
selectedVariable,
|
|
968
1074
|
editIdRef,
|
|
969
1075
|
setCurrentView,
|
|
970
1076
|
closePopover
|
|
971
|
-
});
|
|
1077
|
+
})));
|
|
972
1078
|
};
|
|
973
1079
|
function renderStage(props) {
|
|
974
1080
|
const handleSubmitOnEdit = () => {
|
|
@@ -980,7 +1086,7 @@ function renderStage(props) {
|
|
|
980
1086
|
};
|
|
981
1087
|
if (fontVariablePropTypeUtil.key === props.propTypeKey) {
|
|
982
1088
|
if (VIEW_LIST === props.currentView) {
|
|
983
|
-
return /* @__PURE__ */
|
|
1089
|
+
return /* @__PURE__ */ React12.createElement(
|
|
984
1090
|
FontVariablesSelection,
|
|
985
1091
|
{
|
|
986
1092
|
closePopover: props.closePopover,
|
|
@@ -995,7 +1101,7 @@ function renderStage(props) {
|
|
|
995
1101
|
);
|
|
996
1102
|
}
|
|
997
1103
|
if (VIEW_ADD === props.currentView) {
|
|
998
|
-
return /* @__PURE__ */
|
|
1104
|
+
return /* @__PURE__ */ React12.createElement(
|
|
999
1105
|
FontVariableCreation,
|
|
1000
1106
|
{
|
|
1001
1107
|
onGoBack: () => props.setCurrentView(VIEW_LIST),
|
|
@@ -1004,7 +1110,7 @@ function renderStage(props) {
|
|
|
1004
1110
|
);
|
|
1005
1111
|
}
|
|
1006
1112
|
if (VIEW_EDIT === props.currentView) {
|
|
1007
|
-
return /* @__PURE__ */
|
|
1113
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1008
1114
|
FontVariableEdit,
|
|
1009
1115
|
{
|
|
1010
1116
|
editId: props.editIdRef.current ?? "",
|
|
@@ -1017,7 +1123,7 @@ function renderStage(props) {
|
|
|
1017
1123
|
}
|
|
1018
1124
|
if (colorVariablePropTypeUtil.key === props.propTypeKey) {
|
|
1019
1125
|
if (VIEW_LIST === props.currentView) {
|
|
1020
|
-
return /* @__PURE__ */
|
|
1126
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1021
1127
|
ColorVariablesSelection,
|
|
1022
1128
|
{
|
|
1023
1129
|
closePopover: props.closePopover,
|
|
@@ -1032,7 +1138,7 @@ function renderStage(props) {
|
|
|
1032
1138
|
);
|
|
1033
1139
|
}
|
|
1034
1140
|
if (VIEW_ADD === props.currentView) {
|
|
1035
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1036
1142
|
ColorVariableCreation,
|
|
1037
1143
|
{
|
|
1038
1144
|
onGoBack: () => props.setCurrentView(VIEW_LIST),
|
|
@@ -1041,7 +1147,7 @@ function renderStage(props) {
|
|
|
1041
1147
|
);
|
|
1042
1148
|
}
|
|
1043
1149
|
if (VIEW_EDIT === props.currentView) {
|
|
1044
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1045
1151
|
ColorVariableEdit,
|
|
1046
1152
|
{
|
|
1047
1153
|
editId: props.editIdRef.current ?? "",
|
|
@@ -1056,13 +1162,12 @@ function renderStage(props) {
|
|
|
1056
1162
|
}
|
|
1057
1163
|
|
|
1058
1164
|
// src/controls/color-variable-control.tsx
|
|
1059
|
-
var SIZE8 = "tiny";
|
|
1060
1165
|
var ColorVariableControl = () => {
|
|
1061
|
-
const { setValue: setColor } = (0,
|
|
1062
|
-
const { value: variableValue } = (0,
|
|
1063
|
-
const anchorRef = (0,
|
|
1064
|
-
const popupId = (0,
|
|
1065
|
-
const popupState = (0,
|
|
1166
|
+
const { setValue: setColor } = (0, import_editor_controls7.useBoundProp)();
|
|
1167
|
+
const { value: variableValue } = (0, import_editor_controls7.useBoundProp)(colorVariablePropTypeUtil);
|
|
1168
|
+
const anchorRef = (0, import_react10.useRef)(null);
|
|
1169
|
+
const popupId = (0, import_react10.useId)();
|
|
1170
|
+
const popupState = (0, import_ui14.usePopupState)({
|
|
1066
1171
|
variant: "popover",
|
|
1067
1172
|
popupId: `elementor-variables-list-${popupId}`
|
|
1068
1173
|
});
|
|
@@ -1073,33 +1178,27 @@ var ColorVariableControl = () => {
|
|
|
1073
1178
|
const unlinkVariable = () => {
|
|
1074
1179
|
setColor(import_editor_props3.colorPropTypeUtil.create(selectedVariable.value));
|
|
1075
1180
|
};
|
|
1076
|
-
return /* @__PURE__ */
|
|
1077
|
-
|
|
1181
|
+
return /* @__PURE__ */ React13.createElement(import_ui14.Box, { ref: anchorRef }, /* @__PURE__ */ React13.createElement(
|
|
1182
|
+
VariableTag,
|
|
1078
1183
|
{
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
import_ui12.Typography,
|
|
1084
|
-
{
|
|
1085
|
-
sx: { textOverflow: "ellipsis", overflowX: "hidden", lineHeight: 1 },
|
|
1086
|
-
variant: "caption"
|
|
1087
|
-
},
|
|
1088
|
-
selectedVariable.label
|
|
1089
|
-
)),
|
|
1090
|
-
actions: /* @__PURE__ */ React12.createElement(import_ui12.IconButton, { size: SIZE8, onClick: unlinkVariable, "aria-label": (0, import_i18n10.__)("Unlink", "elementor") }, /* @__PURE__ */ React12.createElement(import_icons9.DetachIcon, { fontSize: SIZE8 })),
|
|
1091
|
-
...(0, import_ui12.bindTrigger)(popupState)
|
|
1184
|
+
label: selectedVariable.label,
|
|
1185
|
+
startIcon: /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(import_icons9.ColorFilterIcon, { fontSize: SIZE }), /* @__PURE__ */ React13.createElement(ColorIndicator, { size: "inherit", value: selectedVariable.value, component: "span" })),
|
|
1186
|
+
onUnlink: unlinkVariable,
|
|
1187
|
+
...(0, import_ui14.bindTrigger)(popupState)
|
|
1092
1188
|
}
|
|
1093
|
-
), /* @__PURE__ */
|
|
1094
|
-
|
|
1189
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1190
|
+
import_ui14.Popover,
|
|
1095
1191
|
{
|
|
1096
1192
|
disableScrollLock: true,
|
|
1097
1193
|
anchorEl: anchorRef.current,
|
|
1098
1194
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1099
1195
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1100
|
-
|
|
1196
|
+
PaperProps: {
|
|
1197
|
+
sx: { my: 1 }
|
|
1198
|
+
},
|
|
1199
|
+
...(0, import_ui14.bindPopover)(popupState)
|
|
1101
1200
|
},
|
|
1102
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ React13.createElement(
|
|
1103
1202
|
VariableSelectionPopover,
|
|
1104
1203
|
{
|
|
1105
1204
|
selectedVariable,
|
|
@@ -1111,8 +1210,8 @@ var ColorVariableControl = () => {
|
|
|
1111
1210
|
};
|
|
1112
1211
|
|
|
1113
1212
|
// src/hooks/use-prop-color-variable-action.tsx
|
|
1114
|
-
var
|
|
1115
|
-
var
|
|
1213
|
+
var React14 = __toESM(require("react"));
|
|
1214
|
+
var import_editor_editing_panel6 = require("@elementor/editor-editing-panel");
|
|
1116
1215
|
var import_icons10 = require("@elementor/icons");
|
|
1117
1216
|
var import_i18n11 = require("@wordpress/i18n");
|
|
1118
1217
|
|
|
@@ -1132,14 +1231,14 @@ var supportsFontVariables = (propType) => {
|
|
|
1132
1231
|
|
|
1133
1232
|
// src/hooks/use-prop-color-variable-action.tsx
|
|
1134
1233
|
var usePropColorVariableAction = () => {
|
|
1135
|
-
const { propType } = (0,
|
|
1234
|
+
const { propType } = (0, import_editor_editing_panel6.useBoundProp)();
|
|
1136
1235
|
const visible = !!propType && supportsColorVariables(propType);
|
|
1137
1236
|
return {
|
|
1138
1237
|
visible,
|
|
1139
1238
|
icon: import_icons10.ColorFilterIcon,
|
|
1140
1239
|
title: (0, import_i18n11.__)("Variables", "elementor"),
|
|
1141
1240
|
content: ({ close: closePopover }) => {
|
|
1142
|
-
return /* @__PURE__ */
|
|
1241
|
+
return /* @__PURE__ */ React14.createElement(VariableSelectionPopover, { closePopover, propTypeKey: colorVariablePropTypeUtil.key });
|
|
1143
1242
|
}
|
|
1144
1243
|
};
|
|
1145
1244
|
};
|
|
@@ -1154,7 +1253,7 @@ var variableTransformer = (0, import_editor_canvas.createTransformer)((value) =>
|
|
|
1154
1253
|
});
|
|
1155
1254
|
|
|
1156
1255
|
// src/init-color-variables.ts
|
|
1157
|
-
var { registerPopoverAction } =
|
|
1256
|
+
var { registerPopoverAction } = import_editor_editing_panel7.controlActionsMenu;
|
|
1158
1257
|
var conditions = {
|
|
1159
1258
|
backgroundOverlay: ({ value: prop }) => {
|
|
1160
1259
|
return hasAssignedColorVariable(import_editor_props4.backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
|
|
@@ -1164,7 +1263,7 @@ var conditions = {
|
|
|
1164
1263
|
}
|
|
1165
1264
|
};
|
|
1166
1265
|
function registerControlsAndActions() {
|
|
1167
|
-
(0,
|
|
1266
|
+
(0, import_editor_editing_panel7.registerControlReplacement)({
|
|
1168
1267
|
component: ColorVariableControl,
|
|
1169
1268
|
condition: ({ value }) => hasAssignedColorVariable(value)
|
|
1170
1269
|
});
|
|
@@ -1174,19 +1273,19 @@ function registerControlsAndActions() {
|
|
|
1174
1273
|
});
|
|
1175
1274
|
}
|
|
1176
1275
|
function registerRepeaterItemIcons() {
|
|
1177
|
-
(0,
|
|
1276
|
+
(0, import_editor_controls8.injectIntoRepeaterItemIcon)({
|
|
1178
1277
|
id: "color-variables-background-icon",
|
|
1179
1278
|
component: BackgroundRepeaterColorIndicator,
|
|
1180
1279
|
condition: conditions.backgroundOverlay
|
|
1181
1280
|
});
|
|
1182
|
-
(0,
|
|
1281
|
+
(0, import_editor_controls8.injectIntoRepeaterItemIcon)({
|
|
1183
1282
|
id: "color-variables-icon",
|
|
1184
1283
|
component: BoxShadowRepeaterColorIndicator,
|
|
1185
1284
|
condition: conditions.boxShadow
|
|
1186
1285
|
});
|
|
1187
1286
|
}
|
|
1188
1287
|
function registerRepeaterItemLabels() {
|
|
1189
|
-
(0,
|
|
1288
|
+
(0, import_editor_controls8.injectIntoRepeaterItemLabel)({
|
|
1190
1289
|
id: "color-variables-label",
|
|
1191
1290
|
component: BackgroundRepeaterLabel,
|
|
1192
1291
|
condition: conditions.backgroundOverlay
|
|
@@ -1204,23 +1303,21 @@ function initColorVariables() {
|
|
|
1204
1303
|
|
|
1205
1304
|
// src/init-font-variables.ts
|
|
1206
1305
|
var import_editor_canvas3 = require("@elementor/editor-canvas");
|
|
1207
|
-
var
|
|
1306
|
+
var import_editor_editing_panel9 = require("@elementor/editor-editing-panel");
|
|
1208
1307
|
|
|
1209
1308
|
// src/controls/font-variable-control.tsx
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1212
|
-
var
|
|
1309
|
+
var React15 = __toESM(require("react"));
|
|
1310
|
+
var import_react11 = require("react");
|
|
1311
|
+
var import_editor_controls9 = require("@elementor/editor-controls");
|
|
1213
1312
|
var import_editor_props5 = require("@elementor/editor-props");
|
|
1214
1313
|
var import_icons11 = require("@elementor/icons");
|
|
1215
|
-
var
|
|
1216
|
-
var import_i18n12 = require("@wordpress/i18n");
|
|
1217
|
-
var SIZE9 = "tiny";
|
|
1314
|
+
var import_ui15 = require("@elementor/ui");
|
|
1218
1315
|
var FontVariableControl = () => {
|
|
1219
|
-
const { setValue: setFontFamily } = (0,
|
|
1220
|
-
const { value: variableValue } = (0,
|
|
1221
|
-
const anchorRef = (0,
|
|
1222
|
-
const popupId = (0,
|
|
1223
|
-
const popupState = (0,
|
|
1316
|
+
const { setValue: setFontFamily } = (0, import_editor_controls9.useBoundProp)();
|
|
1317
|
+
const { value: variableValue } = (0, import_editor_controls9.useBoundProp)(fontVariablePropTypeUtil);
|
|
1318
|
+
const anchorRef = (0, import_react11.useRef)(null);
|
|
1319
|
+
const popupId = (0, import_react11.useId)();
|
|
1320
|
+
const popupState = (0, import_ui15.usePopupState)({
|
|
1224
1321
|
variant: "popover",
|
|
1225
1322
|
popupId: `elementor-variables-list-${popupId}`
|
|
1226
1323
|
});
|
|
@@ -1231,33 +1328,27 @@ var FontVariableControl = () => {
|
|
|
1231
1328
|
const unlinkVariable = () => {
|
|
1232
1329
|
setFontFamily(import_editor_props5.stringPropTypeUtil.create(selectedVariable.value));
|
|
1233
1330
|
};
|
|
1234
|
-
return /* @__PURE__ */
|
|
1235
|
-
|
|
1331
|
+
return /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: anchorRef }, /* @__PURE__ */ React15.createElement(
|
|
1332
|
+
VariableTag,
|
|
1236
1333
|
{
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
import_ui13.Typography,
|
|
1242
|
-
{
|
|
1243
|
-
sx: { textOverflow: "ellipsis", overflowX: "hidden", lineHeight: 1 },
|
|
1244
|
-
variant: "caption"
|
|
1245
|
-
},
|
|
1246
|
-
selectedVariable.label
|
|
1247
|
-
)),
|
|
1248
|
-
actions: /* @__PURE__ */ React14.createElement(import_ui13.IconButton, { size: SIZE9, onClick: unlinkVariable, "aria-label": (0, import_i18n12.__)("Unlink", "elementor") }, /* @__PURE__ */ React14.createElement(import_icons11.DetachIcon, { fontSize: SIZE9 })),
|
|
1249
|
-
...(0, import_ui13.bindTrigger)(popupState)
|
|
1334
|
+
label: selectedVariable.label,
|
|
1335
|
+
startIcon: /* @__PURE__ */ React15.createElement(import_icons11.ColorFilterIcon, { fontSize: SIZE }),
|
|
1336
|
+
onUnlink: unlinkVariable,
|
|
1337
|
+
...(0, import_ui15.bindTrigger)(popupState)
|
|
1250
1338
|
}
|
|
1251
|
-
), /* @__PURE__ */
|
|
1252
|
-
|
|
1339
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1340
|
+
import_ui15.Popover,
|
|
1253
1341
|
{
|
|
1254
1342
|
disableScrollLock: true,
|
|
1255
1343
|
anchorEl: anchorRef.current,
|
|
1256
1344
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1257
1345
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1258
|
-
|
|
1346
|
+
PaperProps: {
|
|
1347
|
+
sx: { my: 1 }
|
|
1348
|
+
},
|
|
1349
|
+
...(0, import_ui15.bindPopover)(popupState)
|
|
1259
1350
|
},
|
|
1260
|
-
/* @__PURE__ */
|
|
1351
|
+
/* @__PURE__ */ React15.createElement(
|
|
1261
1352
|
VariableSelectionPopover,
|
|
1262
1353
|
{
|
|
1263
1354
|
selectedVariable,
|
|
@@ -1269,27 +1360,27 @@ var FontVariableControl = () => {
|
|
|
1269
1360
|
};
|
|
1270
1361
|
|
|
1271
1362
|
// src/hooks/use-prop-font-variable-action.tsx
|
|
1272
|
-
var
|
|
1273
|
-
var
|
|
1363
|
+
var React16 = __toESM(require("react"));
|
|
1364
|
+
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
1274
1365
|
var import_icons12 = require("@elementor/icons");
|
|
1275
|
-
var
|
|
1366
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1276
1367
|
var usePropFontVariableAction = () => {
|
|
1277
|
-
const { propType } = (0,
|
|
1368
|
+
const { propType } = (0, import_editor_editing_panel8.useBoundProp)();
|
|
1278
1369
|
const visible = !!propType && supportsFontVariables(propType);
|
|
1279
1370
|
return {
|
|
1280
1371
|
visible,
|
|
1281
1372
|
icon: import_icons12.ColorFilterIcon,
|
|
1282
|
-
title: (0,
|
|
1373
|
+
title: (0, import_i18n12.__)("Variables", "elementor"),
|
|
1283
1374
|
content: ({ close: closePopover }) => {
|
|
1284
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ React16.createElement(VariableSelectionPopover, { closePopover, propTypeKey: fontVariablePropTypeUtil.key });
|
|
1285
1376
|
}
|
|
1286
1377
|
};
|
|
1287
1378
|
};
|
|
1288
1379
|
|
|
1289
1380
|
// src/init-font-variables.ts
|
|
1290
|
-
var { registerPopoverAction: registerPopoverAction2 } =
|
|
1381
|
+
var { registerPopoverAction: registerPopoverAction2 } = import_editor_editing_panel9.controlActionsMenu;
|
|
1291
1382
|
function initFontVariables() {
|
|
1292
|
-
(0,
|
|
1383
|
+
(0, import_editor_editing_panel9.registerControlReplacement)({
|
|
1293
1384
|
component: FontVariableControl,
|
|
1294
1385
|
condition: ({ value }) => hasAssignedFontVariable(value)
|
|
1295
1386
|
});
|
|
@@ -1301,10 +1392,10 @@ function initFontVariables() {
|
|
|
1301
1392
|
}
|
|
1302
1393
|
|
|
1303
1394
|
// src/renderers/style-variables-renderer.tsx
|
|
1304
|
-
var
|
|
1305
|
-
var
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1395
|
+
var React17 = __toESM(require("react"));
|
|
1396
|
+
var import_react12 = require("react");
|
|
1397
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1398
|
+
var import_ui16 = require("@elementor/ui");
|
|
1308
1399
|
|
|
1309
1400
|
// src/sync/get-canvas-iframe-document.ts
|
|
1310
1401
|
function getCanvasIframeDocument() {
|
|
@@ -1323,14 +1414,14 @@ function StyleVariablesRenderer() {
|
|
|
1323
1414
|
}
|
|
1324
1415
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
1325
1416
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
1326
|
-
return /* @__PURE__ */
|
|
1417
|
+
return /* @__PURE__ */ React17.createElement(import_ui16.Portal, { container }, /* @__PURE__ */ React17.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
1327
1418
|
}
|
|
1328
1419
|
function usePortalContainer() {
|
|
1329
|
-
return (0,
|
|
1420
|
+
return (0, import_editor_v1_adapters2.__privateUseListenTo)((0, import_editor_v1_adapters2.commandEndEvent)("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|
|
1330
1421
|
}
|
|
1331
1422
|
function useStyleVariables() {
|
|
1332
|
-
const [variables, setVariables] = (0,
|
|
1333
|
-
(0,
|
|
1423
|
+
const [variables, setVariables] = (0, import_react12.useState)({});
|
|
1424
|
+
(0, import_react12.useEffect)(() => {
|
|
1334
1425
|
const unsubscribe = styleVariablesRepository.subscribe(setVariables);
|
|
1335
1426
|
return () => {
|
|
1336
1427
|
unsubscribe();
|