@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.mjs
CHANGED
|
@@ -278,28 +278,27 @@ var useFilteredVariables = (searchValue, propTypeKey) => {
|
|
|
278
278
|
var usePropVariables = (propKey) => {
|
|
279
279
|
return useMemo(() => normalizeVariables(propKey), [propKey]);
|
|
280
280
|
};
|
|
281
|
+
var isNotDeleted = ({ deleted }) => !deleted;
|
|
281
282
|
var normalizeVariables = (propKey) => {
|
|
282
283
|
const variables = service.variables();
|
|
283
|
-
|
|
284
|
-
return Object.entries(variables).filter(([, { type }]) => type === propKey).map(([key, { label, value }]) => ({
|
|
284
|
+
return Object.entries(variables).filter(([, variable]) => variable.type === propKey && isNotDeleted(variable)).map(([key, { label, value }]) => ({
|
|
285
285
|
key,
|
|
286
286
|
label,
|
|
287
287
|
value
|
|
288
288
|
}));
|
|
289
289
|
};
|
|
290
290
|
var createVariable = (newVariable) => {
|
|
291
|
-
return service.create(newVariable).then(({ id
|
|
292
|
-
styleVariablesRepository.update({
|
|
293
|
-
[id]: variable
|
|
294
|
-
});
|
|
291
|
+
return service.create(newVariable).then(({ id }) => {
|
|
295
292
|
return id;
|
|
296
293
|
});
|
|
297
294
|
};
|
|
298
295
|
var updateVariable = (updateId, { value, label }) => {
|
|
299
|
-
return service.update(updateId, { value, label }).then(({ id
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
296
|
+
return service.update(updateId, { value, label }).then(({ id }) => {
|
|
297
|
+
return id;
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
var deleteVariable = (deleteId) => {
|
|
301
|
+
return service.delete(deleteId).then(({ id }) => {
|
|
303
302
|
return id;
|
|
304
303
|
});
|
|
305
304
|
};
|
|
@@ -307,7 +306,8 @@ var updateVariable = (updateId, { value, label }) => {
|
|
|
307
306
|
// src/components/ui/color-indicator.tsx
|
|
308
307
|
import { styled, UnstableColorIndicator } from "@elementor/ui";
|
|
309
308
|
var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
|
|
310
|
-
borderRadius: `${theme.shape.borderRadius / 2}px
|
|
309
|
+
borderRadius: `${theme.shape.borderRadius / 2}px`,
|
|
310
|
+
marginRight: theme.spacing(0.25)
|
|
311
311
|
}));
|
|
312
312
|
|
|
313
313
|
// src/components/variables-repeater-item-slot.tsx
|
|
@@ -329,27 +329,43 @@ var BoxShadowRepeaterColorIndicator = ({ value }) => {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
// src/controls/color-variable-control.tsx
|
|
332
|
-
import * as
|
|
332
|
+
import * as React13 from "react";
|
|
333
333
|
import { useId as useId2, useRef as useRef6 } from "react";
|
|
334
334
|
import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
|
|
335
335
|
import { colorPropTypeUtil } from "@elementor/editor-props";
|
|
336
|
-
import { ColorFilterIcon as
|
|
337
|
-
import {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
336
|
+
import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
|
|
337
|
+
import { bindPopover as bindPopover3, bindTrigger as bindTrigger3, Box as Box4, Popover as Popover3, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
338
|
+
|
|
339
|
+
// src/components/ui/variable-tag.tsx
|
|
340
|
+
import * as React2 from "react";
|
|
341
|
+
import { DetachIcon } from "@elementor/icons";
|
|
342
|
+
import { Box, IconButton, Stack, Typography, UnstableTag as Tag } from "@elementor/ui";
|
|
343
|
+
import { __ } from "@wordpress/i18n";
|
|
344
|
+
var SIZE = "tiny";
|
|
345
|
+
var VariableTag = ({ startIcon, label, onUnlink, ...props }) => {
|
|
346
|
+
const actions = [];
|
|
347
|
+
if (onUnlink) {
|
|
348
|
+
actions.push(
|
|
349
|
+
/* @__PURE__ */ React2.createElement(IconButton, { key: "unlink", size: SIZE, onClick: onUnlink, "aria-label": __("Unlink", "elementor") }, /* @__PURE__ */ React2.createElement(DetachIcon, { fontSize: SIZE }))
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
return /* @__PURE__ */ React2.createElement(
|
|
353
|
+
Tag,
|
|
354
|
+
{
|
|
355
|
+
fullWidth: true,
|
|
356
|
+
showActionsOnHover: true,
|
|
357
|
+
startIcon: /* @__PURE__ */ React2.createElement(Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
|
|
358
|
+
label: /* @__PURE__ */ React2.createElement(Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React2.createElement(Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
|
|
359
|
+
actions,
|
|
360
|
+
...props
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
};
|
|
349
364
|
|
|
350
365
|
// src/components/variable-selection-popover.tsx
|
|
351
|
-
import * as
|
|
366
|
+
import * as React12 from "react";
|
|
352
367
|
import { useRef as useRef5, useState as useState7 } from "react";
|
|
368
|
+
import { Box as Box3 } from "@elementor/ui";
|
|
353
369
|
|
|
354
370
|
// src/prop-types/color-variable-prop-type.ts
|
|
355
371
|
import { createPropUtils } from "@elementor/editor-props";
|
|
@@ -362,9 +378,10 @@ import { z as z2 } from "@elementor/schema";
|
|
|
362
378
|
var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
|
|
363
379
|
|
|
364
380
|
// src/components/color-variable-creation.tsx
|
|
365
|
-
import * as
|
|
381
|
+
import * as React3 from "react";
|
|
366
382
|
import { useRef, useState } from "react";
|
|
367
|
-
import { useBoundProp } from "@elementor/editor-controls";
|
|
383
|
+
import { PopoverContent, useBoundProp } from "@elementor/editor-controls";
|
|
384
|
+
import { PopoverScrollableContent } from "@elementor/editor-editing-panel";
|
|
368
385
|
import { PopoverHeader } from "@elementor/editor-ui";
|
|
369
386
|
import { ArrowLeftIcon, BrushIcon } from "@elementor/icons";
|
|
370
387
|
import {
|
|
@@ -373,18 +390,27 @@ import {
|
|
|
373
390
|
Divider,
|
|
374
391
|
FormLabel,
|
|
375
392
|
Grid,
|
|
376
|
-
IconButton,
|
|
377
|
-
Stack,
|
|
393
|
+
IconButton as IconButton2,
|
|
378
394
|
TextField,
|
|
379
395
|
UnstableColorField
|
|
380
396
|
} from "@elementor/ui";
|
|
381
|
-
import { __ } from "@wordpress/i18n";
|
|
382
|
-
|
|
397
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
398
|
+
|
|
399
|
+
// src/components/variable-selection-popover.context.ts
|
|
400
|
+
import { createContext, useContext } from "react";
|
|
401
|
+
var PopoverContentRefContext = createContext(null);
|
|
402
|
+
var usePopoverContentRef = () => {
|
|
403
|
+
return useContext(PopoverContentRefContext);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// src/components/color-variable-creation.tsx
|
|
407
|
+
var SIZE2 = "tiny";
|
|
383
408
|
var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
384
409
|
const { setValue: setVariable } = useBoundProp(colorVariablePropTypeUtil);
|
|
385
410
|
const [color, setColor] = useState("");
|
|
386
411
|
const [label, setLabel] = useState("");
|
|
387
|
-
const
|
|
412
|
+
const defaultRef = useRef(null);
|
|
413
|
+
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
388
414
|
const resetFields = () => {
|
|
389
415
|
setColor("");
|
|
390
416
|
setLabel("");
|
|
@@ -406,14 +432,14 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
|
406
432
|
const isFormInvalid = () => {
|
|
407
433
|
return !color?.trim() || !label?.trim();
|
|
408
434
|
};
|
|
409
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ React3.createElement(PopoverScrollableContent, { height: "auto" }, /* @__PURE__ */ React3.createElement(
|
|
410
436
|
PopoverHeader,
|
|
411
437
|
{
|
|
412
|
-
icon: /* @__PURE__ */
|
|
413
|
-
title:
|
|
438
|
+
icon: /* @__PURE__ */ React3.createElement(React3.Fragment, null, onGoBack && /* @__PURE__ */ React3.createElement(IconButton2, { size: SIZE2, "aria-label": __2("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React3.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React3.createElement(BrushIcon, { fontSize: SIZE2 })),
|
|
439
|
+
title: __2("Create variable", "elementor"),
|
|
414
440
|
onClose: closePopover
|
|
415
441
|
}
|
|
416
|
-
), /* @__PURE__ */
|
|
442
|
+
), /* @__PURE__ */ React3.createElement(Divider, null), /* @__PURE__ */ React3.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React3.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(FormLabel, { size: "tiny" }, __2("Name", "elementor"))), /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
|
|
417
443
|
TextField,
|
|
418
444
|
{
|
|
419
445
|
size: "tiny",
|
|
@@ -421,7 +447,7 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
|
421
447
|
value: label,
|
|
422
448
|
onChange: (e) => setLabel(e.target.value)
|
|
423
449
|
}
|
|
424
|
-
))), /* @__PURE__ */
|
|
450
|
+
))), /* @__PURE__ */ React3.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(FormLabel, { size: "tiny" }, __2("Value", "elementor"))), /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
|
|
425
451
|
UnstableColorField,
|
|
426
452
|
{
|
|
427
453
|
size: "tiny",
|
|
@@ -436,33 +462,34 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
|
|
|
436
462
|
}
|
|
437
463
|
}
|
|
438
464
|
}
|
|
439
|
-
)))), /* @__PURE__ */
|
|
465
|
+
)))), /* @__PURE__ */ React3.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React3.createElement(Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, __2("Create", "elementor"))));
|
|
440
466
|
};
|
|
441
467
|
|
|
442
468
|
// src/components/color-variable-edit.tsx
|
|
443
|
-
import * as
|
|
469
|
+
import * as React4 from "react";
|
|
444
470
|
import { useRef as useRef2, useState as useState2 } from "react";
|
|
445
|
-
import {
|
|
446
|
-
import {
|
|
471
|
+
import { PopoverContent as PopoverContent2 } from "@elementor/editor-controls";
|
|
472
|
+
import { PopoverHeader as PopoverHeader2, PopoverScrollableContent as PopoverScrollableContent2 } from "@elementor/editor-ui";
|
|
473
|
+
import { ArrowLeftIcon as ArrowLeftIcon2, BrushIcon as BrushIcon2, TrashIcon } from "@elementor/icons";
|
|
447
474
|
import {
|
|
448
475
|
Button as Button2,
|
|
449
476
|
CardActions as CardActions2,
|
|
450
477
|
Divider as Divider2,
|
|
451
478
|
FormLabel as FormLabel2,
|
|
452
479
|
Grid as Grid2,
|
|
453
|
-
IconButton as
|
|
454
|
-
Stack as Stack2,
|
|
480
|
+
IconButton as IconButton3,
|
|
455
481
|
TextField as TextField2,
|
|
456
482
|
UnstableColorField as UnstableColorField2
|
|
457
483
|
} from "@elementor/ui";
|
|
458
|
-
import { __ as
|
|
459
|
-
var
|
|
484
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
485
|
+
var SIZE3 = "tiny";
|
|
460
486
|
var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
461
487
|
const variable = useVariable(editId);
|
|
462
488
|
if (!variable) {
|
|
463
489
|
throw new Error(`Global color variable not found`);
|
|
464
490
|
}
|
|
465
|
-
const
|
|
491
|
+
const defaultRef = useRef2(null);
|
|
492
|
+
const anchorRef = usePopoverContentRef() ?? defaultRef;
|
|
466
493
|
const [color, setColor] = useState2(variable.value);
|
|
467
494
|
const [label, setLabel] = useState2(variable.label);
|
|
468
495
|
const handleUpdate = () => {
|
|
@@ -473,17 +500,27 @@ var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
473
500
|
onSubmit?.();
|
|
474
501
|
});
|
|
475
502
|
};
|
|
503
|
+
const handleDelete = () => {
|
|
504
|
+
deleteVariable(editId).then(() => {
|
|
505
|
+
onSubmit?.();
|
|
506
|
+
});
|
|
507
|
+
};
|
|
476
508
|
const noValueChanged = () => color === variable.value && label === variable.label;
|
|
477
509
|
const hasEmptyValue = () => "" === color.trim() || "" === label.trim();
|
|
478
510
|
const isSaveDisabled = () => noValueChanged() || hasEmptyValue();
|
|
479
|
-
|
|
511
|
+
const actions = [];
|
|
512
|
+
actions.push(
|
|
513
|
+
/* @__PURE__ */ React4.createElement(IconButton3, { key: "delete", size: SIZE3, "aria-label": __3("Delete", "elementor"), onClick: handleDelete }, /* @__PURE__ */ React4.createElement(TrashIcon, { fontSize: SIZE3 }))
|
|
514
|
+
);
|
|
515
|
+
return /* @__PURE__ */ React4.createElement(PopoverScrollableContent2, { height: "auto" }, /* @__PURE__ */ React4.createElement(
|
|
480
516
|
PopoverHeader2,
|
|
481
517
|
{
|
|
482
|
-
title:
|
|
518
|
+
title: __3("Edit variable", "elementor"),
|
|
483
519
|
onClose,
|
|
484
|
-
icon: /* @__PURE__ */
|
|
520
|
+
icon: /* @__PURE__ */ React4.createElement(React4.Fragment, null, onGoBack && /* @__PURE__ */ React4.createElement(IconButton3, { size: SIZE3, "aria-label": __3("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React4.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })), /* @__PURE__ */ React4.createElement(BrushIcon2, { fontSize: SIZE3 })),
|
|
521
|
+
actions
|
|
485
522
|
}
|
|
486
|
-
), /* @__PURE__ */
|
|
523
|
+
), /* @__PURE__ */ React4.createElement(Divider2, null), /* @__PURE__ */ React4.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React4.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(FormLabel2, { size: "tiny" }, __3("Name", "elementor"))), /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(
|
|
487
524
|
TextField2,
|
|
488
525
|
{
|
|
489
526
|
size: "tiny",
|
|
@@ -491,7 +528,7 @@ var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
491
528
|
value: label,
|
|
492
529
|
onChange: (e) => setLabel(e.target.value)
|
|
493
530
|
}
|
|
494
|
-
))), /* @__PURE__ */
|
|
531
|
+
))), /* @__PURE__ */ React4.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(FormLabel2, { size: "tiny" }, __3("Value", "elementor"))), /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(
|
|
495
532
|
UnstableColorField2,
|
|
496
533
|
{
|
|
497
534
|
size: "tiny",
|
|
@@ -506,92 +543,105 @@ var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
506
543
|
}
|
|
507
544
|
}
|
|
508
545
|
}
|
|
509
|
-
)))), /* @__PURE__ */
|
|
546
|
+
)))), /* @__PURE__ */ React4.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React4.createElement(Button2, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, __3("Save", "elementor"))));
|
|
510
547
|
};
|
|
511
548
|
|
|
512
549
|
// src/components/color-variables-selection.tsx
|
|
513
|
-
import * as
|
|
550
|
+
import * as React8 from "react";
|
|
514
551
|
import { useState as useState3 } from "react";
|
|
515
552
|
import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
|
|
553
|
+
import { PopoverScrollableContent as PopoverScrollableContent3 } from "@elementor/editor-editing-panel";
|
|
516
554
|
import { PopoverHeader as PopoverHeader3, PopoverMenuList, PopoverSearch } from "@elementor/editor-ui";
|
|
517
|
-
import {
|
|
518
|
-
import { Divider as Divider3, IconButton as
|
|
519
|
-
import { __ as
|
|
555
|
+
import { BrushIcon as BrushIcon3, ColorFilterIcon, PlusIcon, SettingsIcon } from "@elementor/icons";
|
|
556
|
+
import { Divider as Divider3, IconButton as IconButton5 } from "@elementor/ui";
|
|
557
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
520
558
|
|
|
521
559
|
// src/components/ui/menu-item-content.tsx
|
|
522
|
-
import * as
|
|
560
|
+
import * as React5 from "react";
|
|
561
|
+
import { EllipsisWithTooltip } from "@elementor/editor-ui";
|
|
562
|
+
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
523
563
|
import { EditIcon } from "@elementor/icons";
|
|
524
|
-
import { IconButton as
|
|
525
|
-
import { __ as
|
|
526
|
-
var
|
|
564
|
+
import { Box as Box2, IconButton as IconButton4, ListItemIcon, Typography as Typography2 } from "@elementor/ui";
|
|
565
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
566
|
+
var SIZE4 = "tiny";
|
|
567
|
+
var isVersion330Active = isExperimentActive("e_v_3_30");
|
|
527
568
|
var MenuItemContent = ({ item }) => {
|
|
528
569
|
const onEdit = item.onEdit;
|
|
529
|
-
return /* @__PURE__ */
|
|
530
|
-
|
|
570
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React5.createElement(
|
|
571
|
+
Box2,
|
|
531
572
|
{
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
573
|
+
sx: {
|
|
574
|
+
flex: 1,
|
|
575
|
+
minWidth: 0,
|
|
576
|
+
display: "flex",
|
|
577
|
+
alignItems: "center",
|
|
578
|
+
gap: 1
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
/* @__PURE__ */ React5.createElement(
|
|
582
|
+
EllipsisWithTooltip,
|
|
583
|
+
{
|
|
584
|
+
title: item.label || item.value,
|
|
585
|
+
as: Typography2,
|
|
586
|
+
variant: isVersion330Active ? "caption" : "body2",
|
|
587
|
+
color: isVersion330Active ? "text.primary" : "text.secondary",
|
|
588
|
+
sx: { marginTop: "1px", lineHeight: "2" },
|
|
589
|
+
maxWidth: "50%"
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
item.secondaryText && /* @__PURE__ */ React5.createElement(
|
|
593
|
+
EllipsisWithTooltip,
|
|
594
|
+
{
|
|
595
|
+
title: item.secondaryText,
|
|
596
|
+
as: Typography2,
|
|
547
597
|
variant: "caption",
|
|
548
598
|
color: "text.tertiary",
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
), !!onEdit && /* @__PURE__ */
|
|
554
|
-
|
|
599
|
+
sx: { marginTop: "1px", lineHeight: "1" },
|
|
600
|
+
maxWidth: "50%"
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
), !!onEdit && /* @__PURE__ */ React5.createElement(
|
|
604
|
+
IconButton4,
|
|
555
605
|
{
|
|
556
606
|
sx: { mx: 1, opacity: "0" },
|
|
557
607
|
onClick: (e) => {
|
|
558
608
|
e.stopPropagation();
|
|
559
609
|
onEdit(item.value);
|
|
560
610
|
},
|
|
561
|
-
"aria-label":
|
|
611
|
+
"aria-label": __4("Edit", "elementor")
|
|
562
612
|
},
|
|
563
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ React5.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
|
|
564
614
|
));
|
|
565
615
|
};
|
|
566
616
|
|
|
567
617
|
// src/components/ui/no-search-results.tsx
|
|
568
|
-
import * as
|
|
569
|
-
import {
|
|
570
|
-
import {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
Stack3,
|
|
618
|
+
import * as React6 from "react";
|
|
619
|
+
import { Link, Stack as Stack2, Typography as Typography3 } from "@elementor/ui";
|
|
620
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
621
|
+
var NoSearchResults = ({ searchValue, onClear, icon }) => {
|
|
622
|
+
return /* @__PURE__ */ React6.createElement(
|
|
623
|
+
Stack2,
|
|
575
624
|
{
|
|
576
625
|
gap: 1,
|
|
577
626
|
alignItems: "center",
|
|
578
627
|
justifyContent: "center",
|
|
579
628
|
height: "100%",
|
|
629
|
+
p: 2.5,
|
|
580
630
|
color: "text.secondary",
|
|
581
|
-
sx: {
|
|
631
|
+
sx: { pb: 3.5 }
|
|
582
632
|
},
|
|
583
|
-
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
633
|
+
icon,
|
|
634
|
+
/* @__PURE__ */ React6.createElement(Typography3, { align: "center", variant: "subtitle2" }, __5("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React6.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
635
|
+
/* @__PURE__ */ React6.createElement(Typography3, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __5("Try something else.", "elementor"), /* @__PURE__ */ React6.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __5("Clear & try again", "elementor")))
|
|
586
636
|
);
|
|
587
637
|
};
|
|
588
638
|
|
|
589
639
|
// src/components/ui/no-variables.tsx
|
|
590
|
-
import * as
|
|
591
|
-
import { Button as Button3, Stack as
|
|
592
|
-
import { __ as
|
|
593
|
-
var NoVariables = ({ icon, onAdd }) => /* @__PURE__ */
|
|
594
|
-
|
|
640
|
+
import * as React7 from "react";
|
|
641
|
+
import { Button as Button3, Stack as Stack3, Typography as Typography4 } from "@elementor/ui";
|
|
642
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
643
|
+
var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React7.createElement(
|
|
644
|
+
Stack3,
|
|
595
645
|
{
|
|
596
646
|
gap: 1,
|
|
597
647
|
alignItems: "center",
|
|
@@ -601,9 +651,9 @@ var NoVariables = ({ icon, onAdd }) => /* @__PURE__ */ React6.createElement(
|
|
|
601
651
|
sx: { p: 2.5, pb: 5.5 }
|
|
602
652
|
},
|
|
603
653
|
icon,
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
onAdd && /* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ React7.createElement(Typography4, { align: "center", variant: "subtitle2" }, title),
|
|
655
|
+
/* @__PURE__ */ React7.createElement(Typography4, { align: "center", variant: "caption", maxWidth: "180px" }, __6("Variables are saved attributes that you can apply anywhere on your site.", "elementor")),
|
|
656
|
+
onAdd && /* @__PURE__ */ React7.createElement(Button3, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __6("Create a variable", "elementor"))
|
|
607
657
|
);
|
|
608
658
|
|
|
609
659
|
// src/components/ui/styled-menu-list.tsx
|
|
@@ -639,7 +689,7 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
|
|
|
639
689
|
}));
|
|
640
690
|
|
|
641
691
|
// src/components/color-variables-selection.tsx
|
|
642
|
-
var
|
|
692
|
+
var SIZE5 = "tiny";
|
|
643
693
|
var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
644
694
|
const { value: variable, setValue: setVariable } = useBoundProp2(colorVariablePropTypeUtil);
|
|
645
695
|
const [searchValue, setSearchValue] = useState3("");
|
|
@@ -655,19 +705,19 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
655
705
|
const actions = [];
|
|
656
706
|
if (onAdd) {
|
|
657
707
|
actions.push(
|
|
658
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ React8.createElement(IconButton5, { key: "add", size: SIZE5, onClick: onAdd }, /* @__PURE__ */ React8.createElement(PlusIcon, { fontSize: SIZE5 }))
|
|
659
709
|
);
|
|
660
710
|
}
|
|
661
711
|
if (onSettings) {
|
|
662
712
|
actions.push(
|
|
663
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ React8.createElement(IconButton5, { key: "settings", size: SIZE5, onClick: onSettings }, /* @__PURE__ */ React8.createElement(SettingsIcon, { fontSize: SIZE5 }))
|
|
664
714
|
);
|
|
665
715
|
}
|
|
666
716
|
const items = variables.map(({ value, label, key }) => ({
|
|
667
717
|
type: "item",
|
|
668
718
|
value: key,
|
|
669
719
|
label,
|
|
670
|
-
icon: /* @__PURE__ */
|
|
720
|
+
icon: /* @__PURE__ */ React8.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
|
|
671
721
|
secondaryText: value,
|
|
672
722
|
onEdit: () => onEdit?.(key)
|
|
673
723
|
}));
|
|
@@ -677,22 +727,22 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
677
727
|
const handleClearSearch = () => {
|
|
678
728
|
setSearchValue("");
|
|
679
729
|
};
|
|
680
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
|
|
681
731
|
PopoverHeader3,
|
|
682
732
|
{
|
|
683
|
-
title:
|
|
684
|
-
icon: /* @__PURE__ */
|
|
733
|
+
title: __7("Variables", "elementor"),
|
|
734
|
+
icon: /* @__PURE__ */ React8.createElement(ColorFilterIcon, { fontSize: SIZE5 }),
|
|
685
735
|
onClose: closePopover,
|
|
686
736
|
actions
|
|
687
737
|
}
|
|
688
|
-
), hasVariables && /* @__PURE__ */
|
|
738
|
+
), hasVariables && /* @__PURE__ */ React8.createElement(
|
|
689
739
|
PopoverSearch,
|
|
690
740
|
{
|
|
691
741
|
value: searchValue,
|
|
692
742
|
onSearch: handleSearch,
|
|
693
|
-
placeholder:
|
|
743
|
+
placeholder: __7("Search", "elementor")
|
|
694
744
|
}
|
|
695
|
-
), /* @__PURE__ */
|
|
745
|
+
), /* @__PURE__ */ React8.createElement(Divider3, null), /* @__PURE__ */ React8.createElement(PopoverScrollableContent3, null, hasVariables && hasSearchResults && /* @__PURE__ */ React8.createElement(
|
|
696
746
|
PopoverMenuList,
|
|
697
747
|
{
|
|
698
748
|
items,
|
|
@@ -702,16 +752,30 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
702
752
|
selectedValue: variable,
|
|
703
753
|
"data-testid": "color-variables-list",
|
|
704
754
|
menuListTemplate: VariablesStyledMenuList,
|
|
705
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
755
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React8.createElement(MenuItemContent, { item })
|
|
706
756
|
}
|
|
707
|
-
), !hasSearchResults && hasVariables && /* @__PURE__ */
|
|
757
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React8.createElement(
|
|
758
|
+
NoSearchResults,
|
|
759
|
+
{
|
|
760
|
+
searchValue,
|
|
761
|
+
onClear: handleClearSearch,
|
|
762
|
+
icon: /* @__PURE__ */ React8.createElement(BrushIcon3, { fontSize: "large" })
|
|
763
|
+
}
|
|
764
|
+
), !hasVariables && /* @__PURE__ */ React8.createElement(
|
|
765
|
+
NoVariables,
|
|
766
|
+
{
|
|
767
|
+
title: __7("Create your first color variable", "elementor"),
|
|
768
|
+
icon: /* @__PURE__ */ React8.createElement(BrushIcon3, { fontSize: "large" }),
|
|
769
|
+
onAdd
|
|
770
|
+
}
|
|
771
|
+
)));
|
|
708
772
|
};
|
|
709
773
|
|
|
710
774
|
// src/components/font-variable-creation.tsx
|
|
711
|
-
import * as
|
|
775
|
+
import * as React9 from "react";
|
|
712
776
|
import { useRef as useRef3, useState as useState4 } from "react";
|
|
713
|
-
import { FontFamilySelector, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
714
|
-
import { useFontFamilies } from "@elementor/editor-editing-panel";
|
|
777
|
+
import { FontFamilySelector, PopoverContent as PopoverContent3, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
778
|
+
import { PopoverScrollableContent as PopoverScrollableContent4, useFontFamilies, useSectionWidth } from "@elementor/editor-editing-panel";
|
|
715
779
|
import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
|
|
716
780
|
import { ArrowLeftIcon as ArrowLeftIcon3, ChevronDownIcon, TextIcon } from "@elementor/icons";
|
|
717
781
|
import {
|
|
@@ -722,15 +786,14 @@ import {
|
|
|
722
786
|
Divider as Divider4,
|
|
723
787
|
FormLabel as FormLabel3,
|
|
724
788
|
Grid as Grid3,
|
|
725
|
-
IconButton as
|
|
789
|
+
IconButton as IconButton6,
|
|
726
790
|
Popover,
|
|
727
|
-
Stack as Stack5,
|
|
728
791
|
TextField as TextField3,
|
|
729
792
|
UnstableTag,
|
|
730
793
|
usePopupState
|
|
731
794
|
} from "@elementor/ui";
|
|
732
|
-
import { __ as
|
|
733
|
-
var
|
|
795
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
796
|
+
var SIZE6 = "tiny";
|
|
734
797
|
var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
735
798
|
const fontFamilies = useFontFamilies();
|
|
736
799
|
const { setValue: setVariable } = useBoundProp3(fontVariablePropTypeUtil);
|
|
@@ -759,14 +822,15 @@ var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
|
759
822
|
const isFormInvalid = () => {
|
|
760
823
|
return !fontFamily?.trim() || !label?.trim();
|
|
761
824
|
};
|
|
762
|
-
|
|
825
|
+
const sectionWidth = useSectionWidth();
|
|
826
|
+
return /* @__PURE__ */ React9.createElement(PopoverScrollableContent4, { height: "auto" }, /* @__PURE__ */ React9.createElement(
|
|
763
827
|
PopoverHeader4,
|
|
764
828
|
{
|
|
765
|
-
icon: /* @__PURE__ */
|
|
766
|
-
title:
|
|
829
|
+
icon: /* @__PURE__ */ React9.createElement(React9.Fragment, null, onGoBack && /* @__PURE__ */ React9.createElement(IconButton6, { size: SIZE6, "aria-label": __8("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React9.createElement(ArrowLeftIcon3, { fontSize: SIZE6 })), /* @__PURE__ */ React9.createElement(TextIcon, { fontSize: SIZE6 })),
|
|
830
|
+
title: __8("Create variable", "elementor"),
|
|
767
831
|
onClose: closePopover
|
|
768
832
|
}
|
|
769
|
-
), /* @__PURE__ */
|
|
833
|
+
), /* @__PURE__ */ React9.createElement(Divider4, null), /* @__PURE__ */ React9.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React9.createElement(Grid3, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(FormLabel3, { size: "tiny" }, __8("Name", "elementor"))), /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(
|
|
770
834
|
TextField3,
|
|
771
835
|
{
|
|
772
836
|
size: "tiny",
|
|
@@ -774,16 +838,16 @@ var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
|
774
838
|
value: label,
|
|
775
839
|
onChange: (e) => setLabel(e.target.value)
|
|
776
840
|
}
|
|
777
|
-
))), /* @__PURE__ */
|
|
841
|
+
))), /* @__PURE__ */ React9.createElement(Grid3, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(FormLabel3, { size: "tiny" }, __8("Value", "elementor"))), /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
|
|
778
842
|
UnstableTag,
|
|
779
843
|
{
|
|
780
844
|
variant: "outlined",
|
|
781
845
|
label: fontFamily,
|
|
782
|
-
endIcon: /* @__PURE__ */
|
|
846
|
+
endIcon: /* @__PURE__ */ React9.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
783
847
|
...bindTrigger(fontPopoverState),
|
|
784
848
|
fullWidth: true
|
|
785
849
|
}
|
|
786
|
-
), /* @__PURE__ */
|
|
850
|
+
), /* @__PURE__ */ React9.createElement(
|
|
787
851
|
Popover,
|
|
788
852
|
{
|
|
789
853
|
disablePortal: true,
|
|
@@ -793,25 +857,26 @@ var FontVariableCreation = ({ onClose, onGoBack }) => {
|
|
|
793
857
|
transformOrigin: { vertical: "top", horizontal: -20 },
|
|
794
858
|
...bindPopover(fontPopoverState)
|
|
795
859
|
},
|
|
796
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ React9.createElement(
|
|
797
861
|
FontFamilySelector,
|
|
798
862
|
{
|
|
799
863
|
fontFamilies,
|
|
800
864
|
fontFamily,
|
|
801
865
|
onFontFamilyChange: setFontFamily,
|
|
802
|
-
onClose: fontPopoverState.close
|
|
866
|
+
onClose: fontPopoverState.close,
|
|
867
|
+
sectionWidth
|
|
803
868
|
}
|
|
804
869
|
)
|
|
805
|
-
))))), /* @__PURE__ */
|
|
870
|
+
))))), /* @__PURE__ */ React9.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React9.createElement(Button4, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, __8("Create", "elementor"))));
|
|
806
871
|
};
|
|
807
872
|
|
|
808
873
|
// src/components/font-variable-edit.tsx
|
|
809
|
-
import * as
|
|
874
|
+
import * as React10 from "react";
|
|
810
875
|
import { useId, useRef as useRef4, useState as useState5 } from "react";
|
|
811
|
-
import { FontFamilySelector as FontFamilySelector2 } from "@elementor/editor-controls";
|
|
812
|
-
import { useFontFamilies as useFontFamilies2 } from "@elementor/editor-editing-panel";
|
|
813
|
-
import { PopoverHeader as PopoverHeader5 } from "@elementor/editor-ui";
|
|
814
|
-
import { ArrowLeftIcon as ArrowLeftIcon4, ChevronDownIcon as ChevronDownIcon2, TextIcon as TextIcon2 } from "@elementor/icons";
|
|
876
|
+
import { FontFamilySelector as FontFamilySelector2, PopoverContent as PopoverContent4 } from "@elementor/editor-controls";
|
|
877
|
+
import { useFontFamilies as useFontFamilies2, useSectionWidth as useSectionWidth2 } from "@elementor/editor-editing-panel";
|
|
878
|
+
import { PopoverHeader as PopoverHeader5, PopoverScrollableContent as PopoverScrollableContent5 } from "@elementor/editor-ui";
|
|
879
|
+
import { ArrowLeftIcon as ArrowLeftIcon4, ChevronDownIcon as ChevronDownIcon2, TextIcon as TextIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
815
880
|
import {
|
|
816
881
|
bindPopover as bindPopover2,
|
|
817
882
|
bindTrigger as bindTrigger2,
|
|
@@ -820,15 +885,14 @@ import {
|
|
|
820
885
|
Divider as Divider5,
|
|
821
886
|
FormLabel as FormLabel4,
|
|
822
887
|
Grid as Grid4,
|
|
823
|
-
IconButton as
|
|
888
|
+
IconButton as IconButton7,
|
|
824
889
|
Popover as Popover2,
|
|
825
|
-
Stack as Stack6,
|
|
826
890
|
TextField as TextField4,
|
|
827
891
|
UnstableTag as UnstableTag2,
|
|
828
892
|
usePopupState as usePopupState2
|
|
829
893
|
} from "@elementor/ui";
|
|
830
|
-
import { __ as
|
|
831
|
-
var
|
|
894
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
895
|
+
var SIZE7 = "tiny";
|
|
832
896
|
var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
833
897
|
const variable = useVariable(editId);
|
|
834
898
|
if (!variable) {
|
|
@@ -849,17 +913,28 @@ var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
849
913
|
onSubmit?.();
|
|
850
914
|
});
|
|
851
915
|
};
|
|
916
|
+
const handleDelete = () => {
|
|
917
|
+
deleteVariable(editId).then(() => {
|
|
918
|
+
onSubmit?.();
|
|
919
|
+
});
|
|
920
|
+
};
|
|
852
921
|
const noValueChanged = () => fontFamily === variable.value && label === variable.label;
|
|
853
922
|
const hasEmptyValue = () => "" === fontFamily.trim() || "" === label.trim();
|
|
854
923
|
const isSaveDisabled = () => noValueChanged() || hasEmptyValue();
|
|
855
|
-
|
|
924
|
+
const sectionWidth = useSectionWidth2();
|
|
925
|
+
const actions = [];
|
|
926
|
+
actions.push(
|
|
927
|
+
/* @__PURE__ */ React10.createElement(IconButton7, { key: "delete", size: SIZE7, "aria-label": __9("Delete", "elementor"), onClick: handleDelete }, /* @__PURE__ */ React10.createElement(TrashIcon2, { fontSize: SIZE7 }))
|
|
928
|
+
);
|
|
929
|
+
return /* @__PURE__ */ React10.createElement(PopoverScrollableContent5, { height: "auto" }, /* @__PURE__ */ React10.createElement(
|
|
856
930
|
PopoverHeader5,
|
|
857
931
|
{
|
|
858
|
-
icon: /* @__PURE__ */
|
|
859
|
-
title:
|
|
860
|
-
onClose
|
|
932
|
+
icon: /* @__PURE__ */ React10.createElement(React10.Fragment, null, onGoBack && /* @__PURE__ */ React10.createElement(IconButton7, { size: SIZE7, "aria-label": __9("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React10.createElement(ArrowLeftIcon4, { fontSize: SIZE7 })), /* @__PURE__ */ React10.createElement(TextIcon2, { fontSize: SIZE7 })),
|
|
933
|
+
title: __9("Edit variable", "elementor"),
|
|
934
|
+
onClose,
|
|
935
|
+
actions
|
|
861
936
|
}
|
|
862
|
-
), /* @__PURE__ */
|
|
937
|
+
), /* @__PURE__ */ React10.createElement(Divider5, null), /* @__PURE__ */ React10.createElement(PopoverContent4, { p: 2 }, /* @__PURE__ */ React10.createElement(Grid4, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(FormLabel4, { htmlFor: variableNameId, size: "tiny" }, __9("Name", "elementor"))), /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(
|
|
863
938
|
TextField4,
|
|
864
939
|
{
|
|
865
940
|
id: variableNameId,
|
|
@@ -868,17 +943,17 @@ var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
868
943
|
value: label,
|
|
869
944
|
onChange: (e) => setLabel(e.target.value)
|
|
870
945
|
}
|
|
871
|
-
))), /* @__PURE__ */
|
|
946
|
+
))), /* @__PURE__ */ React10.createElement(Grid4, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(FormLabel4, { htmlFor: variableValueId, size: "tiny" }, __9("Value", "elementor"))), /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
|
|
872
947
|
UnstableTag2,
|
|
873
948
|
{
|
|
874
949
|
id: variableValueId,
|
|
875
950
|
variant: "outlined",
|
|
876
951
|
label: fontFamily,
|
|
877
|
-
endIcon: /* @__PURE__ */
|
|
952
|
+
endIcon: /* @__PURE__ */ React10.createElement(ChevronDownIcon2, { fontSize: "tiny" }),
|
|
878
953
|
...bindTrigger2(fontPopoverState),
|
|
879
954
|
fullWidth: true
|
|
880
955
|
}
|
|
881
|
-
), /* @__PURE__ */
|
|
956
|
+
), /* @__PURE__ */ React10.createElement(
|
|
882
957
|
Popover2,
|
|
883
958
|
{
|
|
884
959
|
disablePortal: true,
|
|
@@ -888,27 +963,29 @@ var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
|
|
|
888
963
|
transformOrigin: { vertical: "top", horizontal: -20 },
|
|
889
964
|
...bindPopover2(fontPopoverState)
|
|
890
965
|
},
|
|
891
|
-
/* @__PURE__ */
|
|
966
|
+
/* @__PURE__ */ React10.createElement(
|
|
892
967
|
FontFamilySelector2,
|
|
893
968
|
{
|
|
894
969
|
fontFamilies,
|
|
895
970
|
fontFamily,
|
|
896
971
|
onFontFamilyChange: setFontFamily,
|
|
897
|
-
onClose: fontPopoverState.close
|
|
972
|
+
onClose: fontPopoverState.close,
|
|
973
|
+
sectionWidth
|
|
898
974
|
}
|
|
899
975
|
)
|
|
900
|
-
))))), /* @__PURE__ */
|
|
976
|
+
))))), /* @__PURE__ */ React10.createElement(CardActions4, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React10.createElement(Button5, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, __9("Save", "elementor"))));
|
|
901
977
|
};
|
|
902
978
|
|
|
903
979
|
// src/components/font-variables-selection.tsx
|
|
904
|
-
import * as
|
|
980
|
+
import * as React11 from "react";
|
|
905
981
|
import { useState as useState6 } from "react";
|
|
906
982
|
import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
|
|
983
|
+
import { PopoverScrollableContent as PopoverScrollableContent6 } from "@elementor/editor-editing-panel";
|
|
907
984
|
import { PopoverHeader as PopoverHeader6, PopoverMenuList as PopoverMenuList2, PopoverSearch as PopoverSearch2 } from "@elementor/editor-ui";
|
|
908
|
-
import { ColorFilterIcon as
|
|
909
|
-
import { Divider as Divider6, IconButton as
|
|
910
|
-
import { __ as
|
|
911
|
-
var
|
|
985
|
+
import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon as SettingsIcon2, TextIcon as TextIcon3 } from "@elementor/icons";
|
|
986
|
+
import { Divider as Divider6, IconButton as IconButton8 } from "@elementor/ui";
|
|
987
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
988
|
+
var SIZE8 = "tiny";
|
|
912
989
|
var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
913
990
|
const { value: variable, setValue: setVariable } = useBoundProp4(fontVariablePropTypeUtil);
|
|
914
991
|
const [searchValue, setSearchValue] = useState6("");
|
|
@@ -924,19 +1001,19 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
924
1001
|
const actions = [];
|
|
925
1002
|
if (onAdd) {
|
|
926
1003
|
actions.push(
|
|
927
|
-
/* @__PURE__ */
|
|
1004
|
+
/* @__PURE__ */ React11.createElement(IconButton8, { key: "add", size: SIZE8, onClick: onAdd }, /* @__PURE__ */ React11.createElement(PlusIcon2, { fontSize: SIZE8 }))
|
|
928
1005
|
);
|
|
929
1006
|
}
|
|
930
1007
|
if (onSettings) {
|
|
931
1008
|
actions.push(
|
|
932
|
-
/* @__PURE__ */
|
|
1009
|
+
/* @__PURE__ */ React11.createElement(IconButton8, { key: "settings", size: SIZE8, onClick: onSettings }, /* @__PURE__ */ React11.createElement(SettingsIcon2, { fontSize: SIZE8 }))
|
|
933
1010
|
);
|
|
934
1011
|
}
|
|
935
1012
|
const items = variables.map(({ value, label, key }) => ({
|
|
936
1013
|
type: "item",
|
|
937
1014
|
value: key,
|
|
938
1015
|
label,
|
|
939
|
-
icon: /* @__PURE__ */
|
|
1016
|
+
icon: /* @__PURE__ */ React11.createElement(TextIcon3, { fontSize: SIZE8 }),
|
|
940
1017
|
secondaryText: value,
|
|
941
1018
|
onEdit: () => onEdit?.(key)
|
|
942
1019
|
}));
|
|
@@ -946,22 +1023,22 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
946
1023
|
const handleClearSearch = () => {
|
|
947
1024
|
setSearchValue("");
|
|
948
1025
|
};
|
|
949
|
-
return /* @__PURE__ */
|
|
1026
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
950
1027
|
PopoverHeader6,
|
|
951
1028
|
{
|
|
952
|
-
title:
|
|
1029
|
+
title: __10("Variables", "elementor"),
|
|
953
1030
|
onClose: closePopover,
|
|
954
|
-
icon: /* @__PURE__ */
|
|
1031
|
+
icon: /* @__PURE__ */ React11.createElement(ColorFilterIcon2, { fontSize: SIZE8 }),
|
|
955
1032
|
actions
|
|
956
1033
|
}
|
|
957
|
-
), hasVariables && /* @__PURE__ */
|
|
1034
|
+
), hasVariables && /* @__PURE__ */ React11.createElement(
|
|
958
1035
|
PopoverSearch2,
|
|
959
1036
|
{
|
|
960
1037
|
value: searchValue,
|
|
961
1038
|
onSearch: handleSearch,
|
|
962
|
-
placeholder:
|
|
1039
|
+
placeholder: __10("Search", "elementor")
|
|
963
1040
|
}
|
|
964
|
-
), /* @__PURE__ */
|
|
1041
|
+
), /* @__PURE__ */ React11.createElement(Divider6, null), /* @__PURE__ */ React11.createElement(PopoverScrollableContent6, null, hasVariables && hasSearchResults && /* @__PURE__ */ React11.createElement(
|
|
965
1042
|
PopoverMenuList2,
|
|
966
1043
|
{
|
|
967
1044
|
items,
|
|
@@ -971,9 +1048,23 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
|
|
|
971
1048
|
selectedValue: variable,
|
|
972
1049
|
"data-testid": "font-variables-list",
|
|
973
1050
|
menuListTemplate: VariablesStyledMenuList,
|
|
974
|
-
menuItemContentTemplate: (item) => /* @__PURE__ */
|
|
1051
|
+
menuItemContentTemplate: (item) => /* @__PURE__ */ React11.createElement(MenuItemContent, { item })
|
|
1052
|
+
}
|
|
1053
|
+
), !hasSearchResults && hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1054
|
+
NoSearchResults,
|
|
1055
|
+
{
|
|
1056
|
+
searchValue,
|
|
1057
|
+
onClear: handleClearSearch,
|
|
1058
|
+
icon: /* @__PURE__ */ React11.createElement(TextIcon3, { fontSize: "large" })
|
|
1059
|
+
}
|
|
1060
|
+
), !hasVariables && /* @__PURE__ */ React11.createElement(
|
|
1061
|
+
NoVariables,
|
|
1062
|
+
{
|
|
1063
|
+
title: __10("Create your first font variable", "elementor"),
|
|
1064
|
+
icon: /* @__PURE__ */ React11.createElement(TextIcon3, { fontSize: "large" }),
|
|
1065
|
+
onAdd
|
|
975
1066
|
}
|
|
976
|
-
)
|
|
1067
|
+
)));
|
|
977
1068
|
};
|
|
978
1069
|
|
|
979
1070
|
// src/components/variable-selection-popover.tsx
|
|
@@ -983,14 +1074,15 @@ var VIEW_EDIT = "edit";
|
|
|
983
1074
|
var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
|
|
984
1075
|
const [currentView, setCurrentView] = useState7(VIEW_LIST);
|
|
985
1076
|
const editIdRef = useRef5("");
|
|
986
|
-
|
|
1077
|
+
const anchorRef = useRef5(null);
|
|
1078
|
+
return /* @__PURE__ */ React12.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React12.createElement(Box3, { ref: anchorRef }, renderStage({
|
|
987
1079
|
propTypeKey,
|
|
988
1080
|
currentView,
|
|
989
1081
|
selectedVariable,
|
|
990
1082
|
editIdRef,
|
|
991
1083
|
setCurrentView,
|
|
992
1084
|
closePopover
|
|
993
|
-
});
|
|
1085
|
+
})));
|
|
994
1086
|
};
|
|
995
1087
|
function renderStage(props) {
|
|
996
1088
|
const handleSubmitOnEdit = () => {
|
|
@@ -1002,7 +1094,7 @@ function renderStage(props) {
|
|
|
1002
1094
|
};
|
|
1003
1095
|
if (fontVariablePropTypeUtil.key === props.propTypeKey) {
|
|
1004
1096
|
if (VIEW_LIST === props.currentView) {
|
|
1005
|
-
return /* @__PURE__ */
|
|
1097
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1006
1098
|
FontVariablesSelection,
|
|
1007
1099
|
{
|
|
1008
1100
|
closePopover: props.closePopover,
|
|
@@ -1017,7 +1109,7 @@ function renderStage(props) {
|
|
|
1017
1109
|
);
|
|
1018
1110
|
}
|
|
1019
1111
|
if (VIEW_ADD === props.currentView) {
|
|
1020
|
-
return /* @__PURE__ */
|
|
1112
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1021
1113
|
FontVariableCreation,
|
|
1022
1114
|
{
|
|
1023
1115
|
onGoBack: () => props.setCurrentView(VIEW_LIST),
|
|
@@ -1026,7 +1118,7 @@ function renderStage(props) {
|
|
|
1026
1118
|
);
|
|
1027
1119
|
}
|
|
1028
1120
|
if (VIEW_EDIT === props.currentView) {
|
|
1029
|
-
return /* @__PURE__ */
|
|
1121
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1030
1122
|
FontVariableEdit,
|
|
1031
1123
|
{
|
|
1032
1124
|
editId: props.editIdRef.current ?? "",
|
|
@@ -1039,7 +1131,7 @@ function renderStage(props) {
|
|
|
1039
1131
|
}
|
|
1040
1132
|
if (colorVariablePropTypeUtil.key === props.propTypeKey) {
|
|
1041
1133
|
if (VIEW_LIST === props.currentView) {
|
|
1042
|
-
return /* @__PURE__ */
|
|
1134
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1043
1135
|
ColorVariablesSelection,
|
|
1044
1136
|
{
|
|
1045
1137
|
closePopover: props.closePopover,
|
|
@@ -1054,7 +1146,7 @@ function renderStage(props) {
|
|
|
1054
1146
|
);
|
|
1055
1147
|
}
|
|
1056
1148
|
if (VIEW_ADD === props.currentView) {
|
|
1057
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1058
1150
|
ColorVariableCreation,
|
|
1059
1151
|
{
|
|
1060
1152
|
onGoBack: () => props.setCurrentView(VIEW_LIST),
|
|
@@ -1063,7 +1155,7 @@ function renderStage(props) {
|
|
|
1063
1155
|
);
|
|
1064
1156
|
}
|
|
1065
1157
|
if (VIEW_EDIT === props.currentView) {
|
|
1066
|
-
return /* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1067
1159
|
ColorVariableEdit,
|
|
1068
1160
|
{
|
|
1069
1161
|
editId: props.editIdRef.current ?? "",
|
|
@@ -1078,7 +1170,6 @@ function renderStage(props) {
|
|
|
1078
1170
|
}
|
|
1079
1171
|
|
|
1080
1172
|
// src/controls/color-variable-control.tsx
|
|
1081
|
-
var SIZE8 = "tiny";
|
|
1082
1173
|
var ColorVariableControl = () => {
|
|
1083
1174
|
const { setValue: setColor } = useBoundProp5();
|
|
1084
1175
|
const { value: variableValue } = useBoundProp5(colorVariablePropTypeUtil);
|
|
@@ -1095,33 +1186,27 @@ var ColorVariableControl = () => {
|
|
|
1095
1186
|
const unlinkVariable = () => {
|
|
1096
1187
|
setColor(colorPropTypeUtil.create(selectedVariable.value));
|
|
1097
1188
|
};
|
|
1098
|
-
return /* @__PURE__ */
|
|
1099
|
-
|
|
1189
|
+
return /* @__PURE__ */ React13.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React13.createElement(
|
|
1190
|
+
VariableTag,
|
|
1100
1191
|
{
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
label: /* @__PURE__ */ React12.createElement(Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React12.createElement(
|
|
1105
|
-
Typography3,
|
|
1106
|
-
{
|
|
1107
|
-
sx: { textOverflow: "ellipsis", overflowX: "hidden", lineHeight: 1 },
|
|
1108
|
-
variant: "caption"
|
|
1109
|
-
},
|
|
1110
|
-
selectedVariable.label
|
|
1111
|
-
)),
|
|
1112
|
-
actions: /* @__PURE__ */ React12.createElement(IconButton8, { size: SIZE8, onClick: unlinkVariable, "aria-label": __10("Unlink", "elementor") }, /* @__PURE__ */ React12.createElement(DetachIcon, { fontSize: SIZE8 })),
|
|
1192
|
+
label: selectedVariable.label,
|
|
1193
|
+
startIcon: /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ColorFilterIcon3, { fontSize: SIZE }), /* @__PURE__ */ React13.createElement(ColorIndicator, { size: "inherit", value: selectedVariable.value, component: "span" })),
|
|
1194
|
+
onUnlink: unlinkVariable,
|
|
1113
1195
|
...bindTrigger3(popupState)
|
|
1114
1196
|
}
|
|
1115
|
-
), /* @__PURE__ */
|
|
1197
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1116
1198
|
Popover3,
|
|
1117
1199
|
{
|
|
1118
1200
|
disableScrollLock: true,
|
|
1119
1201
|
anchorEl: anchorRef.current,
|
|
1120
1202
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1121
1203
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1204
|
+
PaperProps: {
|
|
1205
|
+
sx: { my: 1 }
|
|
1206
|
+
},
|
|
1122
1207
|
...bindPopover3(popupState)
|
|
1123
1208
|
},
|
|
1124
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ React13.createElement(
|
|
1125
1210
|
VariableSelectionPopover,
|
|
1126
1211
|
{
|
|
1127
1212
|
selectedVariable,
|
|
@@ -1133,9 +1218,9 @@ var ColorVariableControl = () => {
|
|
|
1133
1218
|
};
|
|
1134
1219
|
|
|
1135
1220
|
// src/hooks/use-prop-color-variable-action.tsx
|
|
1136
|
-
import * as
|
|
1221
|
+
import * as React14 from "react";
|
|
1137
1222
|
import { useBoundProp as useBoundProp6 } from "@elementor/editor-editing-panel";
|
|
1138
|
-
import { ColorFilterIcon as
|
|
1223
|
+
import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
|
|
1139
1224
|
import { __ as __11 } from "@wordpress/i18n";
|
|
1140
1225
|
|
|
1141
1226
|
// src/utils.ts
|
|
@@ -1158,10 +1243,10 @@ var usePropColorVariableAction = () => {
|
|
|
1158
1243
|
const visible = !!propType && supportsColorVariables(propType);
|
|
1159
1244
|
return {
|
|
1160
1245
|
visible,
|
|
1161
|
-
icon:
|
|
1246
|
+
icon: ColorFilterIcon4,
|
|
1162
1247
|
title: __11("Variables", "elementor"),
|
|
1163
1248
|
content: ({ close: closePopover }) => {
|
|
1164
|
-
return /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ React14.createElement(VariableSelectionPopover, { closePopover, propTypeKey: colorVariablePropTypeUtil.key });
|
|
1165
1250
|
}
|
|
1166
1251
|
};
|
|
1167
1252
|
};
|
|
@@ -1229,24 +1314,12 @@ import { styleTransformersRegistry as styleTransformersRegistry2 } from "@elemen
|
|
|
1229
1314
|
import { controlActionsMenu as controlActionsMenu2, registerControlReplacement as registerControlReplacement2 } from "@elementor/editor-editing-panel";
|
|
1230
1315
|
|
|
1231
1316
|
// src/controls/font-variable-control.tsx
|
|
1232
|
-
import * as
|
|
1317
|
+
import * as React15 from "react";
|
|
1233
1318
|
import { useId as useId3, useRef as useRef7 } from "react";
|
|
1234
1319
|
import { useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
|
|
1235
1320
|
import { stringPropTypeUtil } from "@elementor/editor-props";
|
|
1236
|
-
import { ColorFilterIcon as
|
|
1237
|
-
import {
|
|
1238
|
-
bindPopover as bindPopover4,
|
|
1239
|
-
bindTrigger as bindTrigger4,
|
|
1240
|
-
Box as Box2,
|
|
1241
|
-
IconButton as IconButton9,
|
|
1242
|
-
Popover as Popover4,
|
|
1243
|
-
Stack as Stack8,
|
|
1244
|
-
Typography as Typography4,
|
|
1245
|
-
UnstableTag as Tag2,
|
|
1246
|
-
usePopupState as usePopupState4
|
|
1247
|
-
} from "@elementor/ui";
|
|
1248
|
-
import { __ as __12 } from "@wordpress/i18n";
|
|
1249
|
-
var SIZE9 = "tiny";
|
|
1321
|
+
import { ColorFilterIcon as ColorFilterIcon5 } from "@elementor/icons";
|
|
1322
|
+
import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Box as Box5, Popover as Popover4, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
1250
1323
|
var FontVariableControl = () => {
|
|
1251
1324
|
const { setValue: setFontFamily } = useBoundProp7();
|
|
1252
1325
|
const { value: variableValue } = useBoundProp7(fontVariablePropTypeUtil);
|
|
@@ -1263,33 +1336,27 @@ var FontVariableControl = () => {
|
|
|
1263
1336
|
const unlinkVariable = () => {
|
|
1264
1337
|
setFontFamily(stringPropTypeUtil.create(selectedVariable.value));
|
|
1265
1338
|
};
|
|
1266
|
-
return /* @__PURE__ */
|
|
1267
|
-
|
|
1339
|
+
return /* @__PURE__ */ React15.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React15.createElement(
|
|
1340
|
+
VariableTag,
|
|
1268
1341
|
{
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
label: /* @__PURE__ */ React14.createElement(Box2, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React14.createElement(
|
|
1273
|
-
Typography4,
|
|
1274
|
-
{
|
|
1275
|
-
sx: { textOverflow: "ellipsis", overflowX: "hidden", lineHeight: 1 },
|
|
1276
|
-
variant: "caption"
|
|
1277
|
-
},
|
|
1278
|
-
selectedVariable.label
|
|
1279
|
-
)),
|
|
1280
|
-
actions: /* @__PURE__ */ React14.createElement(IconButton9, { size: SIZE9, onClick: unlinkVariable, "aria-label": __12("Unlink", "elementor") }, /* @__PURE__ */ React14.createElement(DetachIcon2, { fontSize: SIZE9 })),
|
|
1342
|
+
label: selectedVariable.label,
|
|
1343
|
+
startIcon: /* @__PURE__ */ React15.createElement(ColorFilterIcon5, { fontSize: SIZE }),
|
|
1344
|
+
onUnlink: unlinkVariable,
|
|
1281
1345
|
...bindTrigger4(popupState)
|
|
1282
1346
|
}
|
|
1283
|
-
), /* @__PURE__ */
|
|
1347
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1284
1348
|
Popover4,
|
|
1285
1349
|
{
|
|
1286
1350
|
disableScrollLock: true,
|
|
1287
1351
|
anchorEl: anchorRef.current,
|
|
1288
1352
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1289
1353
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1354
|
+
PaperProps: {
|
|
1355
|
+
sx: { my: 1 }
|
|
1356
|
+
},
|
|
1290
1357
|
...bindPopover4(popupState)
|
|
1291
1358
|
},
|
|
1292
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ React15.createElement(
|
|
1293
1360
|
VariableSelectionPopover,
|
|
1294
1361
|
{
|
|
1295
1362
|
selectedVariable,
|
|
@@ -1301,19 +1368,19 @@ var FontVariableControl = () => {
|
|
|
1301
1368
|
};
|
|
1302
1369
|
|
|
1303
1370
|
// src/hooks/use-prop-font-variable-action.tsx
|
|
1304
|
-
import * as
|
|
1371
|
+
import * as React16 from "react";
|
|
1305
1372
|
import { useBoundProp as useBoundProp8 } from "@elementor/editor-editing-panel";
|
|
1306
|
-
import { ColorFilterIcon as
|
|
1307
|
-
import { __ as
|
|
1373
|
+
import { ColorFilterIcon as ColorFilterIcon6 } from "@elementor/icons";
|
|
1374
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1308
1375
|
var usePropFontVariableAction = () => {
|
|
1309
1376
|
const { propType } = useBoundProp8();
|
|
1310
1377
|
const visible = !!propType && supportsFontVariables(propType);
|
|
1311
1378
|
return {
|
|
1312
1379
|
visible,
|
|
1313
|
-
icon:
|
|
1314
|
-
title:
|
|
1380
|
+
icon: ColorFilterIcon6,
|
|
1381
|
+
title: __12("Variables", "elementor"),
|
|
1315
1382
|
content: ({ close: closePopover }) => {
|
|
1316
|
-
return /* @__PURE__ */
|
|
1383
|
+
return /* @__PURE__ */ React16.createElement(VariableSelectionPopover, { closePopover, propTypeKey: fontVariablePropTypeUtil.key });
|
|
1317
1384
|
}
|
|
1318
1385
|
};
|
|
1319
1386
|
};
|
|
@@ -1333,7 +1400,7 @@ function initFontVariables() {
|
|
|
1333
1400
|
}
|
|
1334
1401
|
|
|
1335
1402
|
// src/renderers/style-variables-renderer.tsx
|
|
1336
|
-
import * as
|
|
1403
|
+
import * as React17 from "react";
|
|
1337
1404
|
import { useEffect, useState as useState8 } from "react";
|
|
1338
1405
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
1339
1406
|
import { Portal } from "@elementor/ui";
|
|
@@ -1355,7 +1422,7 @@ function StyleVariablesRenderer() {
|
|
|
1355
1422
|
}
|
|
1356
1423
|
const cssVariables = convertToCssVariables(styleVariables);
|
|
1357
1424
|
const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
|
|
1358
|
-
return /* @__PURE__ */
|
|
1425
|
+
return /* @__PURE__ */ React17.createElement(Portal, { container }, /* @__PURE__ */ React17.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
|
|
1359
1426
|
}
|
|
1360
1427
|
function usePortalContainer() {
|
|
1361
1428
|
return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
|