@elementor/editor-controls 3.32.0-28 → 3.32.0-30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +274 -282
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +235 -242
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/components/unstable-repeater/actions/disable-item-action.tsx +2 -2
- package/src/components/unstable-repeater/actions/duplicate-item-action.tsx +3 -3
- package/src/components/unstable-repeater/actions/tooltip-add-item-action.tsx +66 -0
- package/src/components/unstable-repeater/context/repeater-context.tsx +52 -67
- package/src/components/unstable-repeater/header/header.tsx +2 -2
- package/src/components/unstable-repeater/index.ts +1 -1
- package/src/components/unstable-repeater/items/edit-item-popover.tsx +28 -12
- package/src/components/unstable-repeater/items/item.tsx +15 -19
- package/src/components/unstable-repeater/items/items-container.tsx +17 -15
- package/src/components/unstable-repeater/types.ts +2 -12
- package/src/components/unstable-repeater/unstable-repeater.tsx +5 -3
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +25 -23
- package/src/controls/transform-control/functions/move.tsx +1 -1
- package/src/controls/transform-control/functions/rotate.tsx +1 -1
- package/src/controls/transform-control/functions/scale.tsx +1 -1
- package/src/controls/transform-control/functions/skew.tsx +1 -1
- package/src/controls/transform-control/transform-content.tsx +2 -12
- package/src/controls/transform-control/transform-icon.tsx +1 -1
- package/src/controls/transform-control/transform-label.tsx +1 -1
- package/src/controls/transform-control/transform-repeater-control.tsx +49 -17
- package/src/controls/transform-control/use-transform-tabs-history.tsx +12 -2
- package/src/index.ts +0 -1
- package/src/components/unstable-repeater/actions/add-item-action.tsx +0 -50
- package/src/components/unstable-repeater/items/use-popover.tsx +0 -26
- package/src/controls/unstable-transform-control/unstable-transform-repeater-control.tsx +0 -35
- /package/src/controls/transform-control/{types.ts → initial-values.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -66,7 +66,6 @@ __export(index_exports, {
|
|
|
66
66
|
ToggleControl: () => ToggleControl,
|
|
67
67
|
TransformRepeaterControl: () => TransformRepeaterControl,
|
|
68
68
|
TransitionRepeaterControl: () => TransitionRepeaterControl,
|
|
69
|
-
UnstableTransformRepeaterControl: () => UnstableTransformRepeaterControl,
|
|
70
69
|
UrlControl: () => UrlControl,
|
|
71
70
|
createControlReplacementsRegistry: () => createControlReplacementsRegistry,
|
|
72
71
|
enqueueFont: () => enqueueFont,
|
|
@@ -1952,7 +1951,7 @@ var ControlToggleButtonGroup = ({
|
|
|
1952
1951
|
width: `100%`
|
|
1953
1952
|
}
|
|
1954
1953
|
},
|
|
1955
|
-
fixedItems.map(({ label, value: buttonValue, renderContent:
|
|
1954
|
+
fixedItems.map(({ label, value: buttonValue, renderContent: Content4, showTooltip }) => {
|
|
1956
1955
|
const isPlaceholder = placeholderArray.length > 0 && placeholderArray.includes(buttonValue) && (shouldShowExclusivePlaceholder || shouldShowNonExclusivePlaceholder);
|
|
1957
1956
|
return /* @__PURE__ */ React32.createElement(
|
|
1958
1957
|
ConditionalTooltip,
|
|
@@ -1970,7 +1969,7 @@ var ControlToggleButtonGroup = ({
|
|
|
1970
1969
|
fullWidth,
|
|
1971
1970
|
isPlaceholder
|
|
1972
1971
|
},
|
|
1973
|
-
/* @__PURE__ */ React32.createElement(
|
|
1972
|
+
/* @__PURE__ */ React32.createElement(Content4, { size })
|
|
1974
1973
|
)
|
|
1975
1974
|
);
|
|
1976
1975
|
}),
|
|
@@ -3332,15 +3331,16 @@ var import_ui55 = require("@elementor/ui");
|
|
|
3332
3331
|
var import_wp_media3 = require("@elementor/wp-media");
|
|
3333
3332
|
var import_i18n28 = require("@wordpress/i18n");
|
|
3334
3333
|
|
|
3335
|
-
// src/components/unstable-repeater/actions/add-item-action.tsx
|
|
3334
|
+
// src/components/unstable-repeater/actions/tooltip-add-item-action.tsx
|
|
3336
3335
|
var React50 = __toESM(require("react"));
|
|
3337
3336
|
var import_icons15 = require("@elementor/icons");
|
|
3338
|
-
var
|
|
3337
|
+
var import_ui42 = require("@elementor/ui");
|
|
3339
3338
|
var import_i18n19 = require("@wordpress/i18n");
|
|
3340
3339
|
|
|
3341
3340
|
// src/components/unstable-repeater/context/repeater-context.tsx
|
|
3342
3341
|
var React49 = __toESM(require("react"));
|
|
3343
3342
|
var import_react30 = require("react");
|
|
3343
|
+
var import_ui41 = require("@elementor/ui");
|
|
3344
3344
|
var RepeaterContext = (0, import_react30.createContext)(null);
|
|
3345
3345
|
var EMPTY_OPEN_ITEM2 = -1;
|
|
3346
3346
|
var useRepeaterContext = () => {
|
|
@@ -3348,28 +3348,12 @@ var useRepeaterContext = () => {
|
|
|
3348
3348
|
if (!context) {
|
|
3349
3349
|
throw new Error("useRepeaterContext must be used within a RepeaterContextProvider");
|
|
3350
3350
|
}
|
|
3351
|
-
return
|
|
3352
|
-
isOpen: context.isOpen,
|
|
3353
|
-
openItem: context.openItem,
|
|
3354
|
-
setOpenItem: context.setOpenItem,
|
|
3355
|
-
items: context.items,
|
|
3356
|
-
setItems: context.setItems,
|
|
3357
|
-
uniqueKeys: context.uniqueKeys,
|
|
3358
|
-
setUniqueKeys: context.setUniqueKeys,
|
|
3359
|
-
initial: context.initial,
|
|
3360
|
-
isSortable: context.isSortable,
|
|
3361
|
-
generateNextKey: context.generateNextKey,
|
|
3362
|
-
sortItemsByKeys: context.sortItemsByKeys,
|
|
3363
|
-
addItem: context.addItem,
|
|
3364
|
-
updateItem: context.updateItem,
|
|
3365
|
-
removeItem: context.removeItem
|
|
3366
|
-
};
|
|
3351
|
+
return context;
|
|
3367
3352
|
};
|
|
3368
3353
|
var RepeaterContextProvider = ({
|
|
3369
3354
|
children,
|
|
3370
3355
|
initial,
|
|
3371
|
-
propTypeUtil
|
|
3372
|
-
isSortable = true
|
|
3356
|
+
propTypeUtil
|
|
3373
3357
|
}) => {
|
|
3374
3358
|
const { value: repeaterValues, setValue: setRepeaterValues } = useBoundProp(propTypeUtil);
|
|
3375
3359
|
const [items2, setItems] = useSyncExternalState({
|
|
@@ -3378,52 +3362,51 @@ var RepeaterContextProvider = ({
|
|
|
3378
3362
|
setExternal: setRepeaterValues,
|
|
3379
3363
|
persistWhen: () => true
|
|
3380
3364
|
});
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
const
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
const index = uniqueKeys.indexOf(key);
|
|
3389
|
-
return prevItems[index];
|
|
3390
|
-
})
|
|
3391
|
-
);
|
|
3365
|
+
const itemWithKeysState = (0, import_react30.useState)(
|
|
3366
|
+
items2?.map((item, index) => ({ key: index, item })) ?? []
|
|
3367
|
+
);
|
|
3368
|
+
const itemsWithKeys = itemWithKeysState[0];
|
|
3369
|
+
const setItemsWithKeys = (newItems) => {
|
|
3370
|
+
itemWithKeysState[1](newItems);
|
|
3371
|
+
setItems(newItems.map(({ item }) => item));
|
|
3392
3372
|
};
|
|
3393
|
-
const
|
|
3373
|
+
const [openItemIndex, setOpenItemIndex] = (0, import_react30.useState)(EMPTY_OPEN_ITEM2);
|
|
3374
|
+
const [rowRef, setRowRef] = (0, import_react30.useState)(null);
|
|
3375
|
+
const isOpen = openItemIndex !== EMPTY_OPEN_ITEM2;
|
|
3376
|
+
const popoverState = (0, import_ui41.usePopupState)({ variant: "popover" });
|
|
3377
|
+
const addItem = (ev, config) => {
|
|
3394
3378
|
const item = config?.item ?? initial;
|
|
3395
|
-
const
|
|
3396
|
-
const
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3379
|
+
const newIndex = config?.index ?? items2.length;
|
|
3380
|
+
const newKey = generateNextKey(itemsWithKeys.map(({ key }) => key));
|
|
3381
|
+
const newItemsWithKeys = [...itemsWithKeys];
|
|
3382
|
+
newItemsWithKeys.splice(newIndex, 0, { item, key: newKey });
|
|
3383
|
+
setItemsWithKeys(newItemsWithKeys);
|
|
3384
|
+
setOpenItemIndex(newIndex);
|
|
3385
|
+
popoverState.open(rowRef ?? ev);
|
|
3401
3386
|
};
|
|
3402
3387
|
const removeItem = (index) => {
|
|
3403
|
-
|
|
3404
|
-
setUniqueKeys((prevKeys) => prevKeys.slice(0, -1));
|
|
3388
|
+
setItemsWithKeys(itemsWithKeys.filter((_, pos) => pos !== index));
|
|
3405
3389
|
};
|
|
3406
3390
|
const updateItem = (updatedItem, index) => {
|
|
3407
|
-
|
|
3391
|
+
const item = itemsWithKeys[index];
|
|
3392
|
+
setItemsWithKeys(itemsWithKeys.toSpliced(index, 1, { ...item, item: updatedItem }));
|
|
3408
3393
|
};
|
|
3409
3394
|
return /* @__PURE__ */ React49.createElement(
|
|
3410
3395
|
RepeaterContext.Provider,
|
|
3411
3396
|
{
|
|
3412
3397
|
value: {
|
|
3413
3398
|
isOpen,
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
items:
|
|
3417
|
-
setItems,
|
|
3399
|
+
openItemIndex,
|
|
3400
|
+
setOpenItemIndex,
|
|
3401
|
+
items: itemsWithKeys ?? [],
|
|
3402
|
+
setItems: setItemsWithKeys,
|
|
3403
|
+
popoverState,
|
|
3418
3404
|
initial,
|
|
3419
|
-
uniqueKeys,
|
|
3420
|
-
setUniqueKeys,
|
|
3421
|
-
isSortable,
|
|
3422
|
-
generateNextKey,
|
|
3423
|
-
sortItemsByKeys,
|
|
3424
|
-
addItem,
|
|
3425
3405
|
updateItem,
|
|
3426
|
-
|
|
3406
|
+
addItem,
|
|
3407
|
+
removeItem,
|
|
3408
|
+
rowRef,
|
|
3409
|
+
setRowRef
|
|
3427
3410
|
}
|
|
3428
3411
|
},
|
|
3429
3412
|
children
|
|
@@ -3433,83 +3416,96 @@ var generateNextKey = (source) => {
|
|
|
3433
3416
|
return 1 + Math.max(0, ...source);
|
|
3434
3417
|
};
|
|
3435
3418
|
|
|
3436
|
-
// src/components/unstable-repeater/actions/add-item-action.tsx
|
|
3419
|
+
// src/components/unstable-repeater/actions/tooltip-add-item-action.tsx
|
|
3437
3420
|
var SIZE4 = "tiny";
|
|
3438
|
-
var
|
|
3421
|
+
var TooltipAddItemAction = ({
|
|
3439
3422
|
disabled = false,
|
|
3440
|
-
|
|
3423
|
+
enableTooltip = false,
|
|
3441
3424
|
tooltipContent = null,
|
|
3442
3425
|
newItemIndex
|
|
3443
3426
|
}) => {
|
|
3444
3427
|
const { addItem } = useRepeaterContext();
|
|
3445
|
-
const
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
import_ui41.IconButton,
|
|
3428
|
+
const onClick = (ev) => addItem(ev, { index: newItemIndex });
|
|
3429
|
+
return /* @__PURE__ */ React50.createElement(ConditionalToolTip, { content: tooltipContent, enable: enableTooltip }, /* @__PURE__ */ React50.createElement(import_ui42.Box, { sx: { ml: "auto" } }, /* @__PURE__ */ React50.createElement(
|
|
3430
|
+
import_ui42.IconButton,
|
|
3449
3431
|
{
|
|
3450
3432
|
size: SIZE4,
|
|
3451
|
-
sx: { ml: "auto" },
|
|
3452
3433
|
disabled,
|
|
3453
3434
|
onClick,
|
|
3454
3435
|
"aria-label": (0, import_i18n19.__)("Add item", "elementor")
|
|
3455
3436
|
},
|
|
3456
3437
|
/* @__PURE__ */ React50.createElement(import_icons15.PlusIcon, { fontSize: SIZE4 })
|
|
3457
|
-
));
|
|
3438
|
+
)));
|
|
3458
3439
|
};
|
|
3459
3440
|
var ConditionalToolTip = ({
|
|
3460
3441
|
children,
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
}) =>
|
|
3464
|
-
|
|
3465
|
-
|
|
3442
|
+
enable,
|
|
3443
|
+
content
|
|
3444
|
+
}) => enable && content ? /* @__PURE__ */ React50.createElement(
|
|
3445
|
+
import_ui42.Infotip,
|
|
3446
|
+
{
|
|
3447
|
+
placement: "right",
|
|
3448
|
+
content: /* @__PURE__ */ React50.createElement(
|
|
3449
|
+
import_ui42.Box,
|
|
3450
|
+
{
|
|
3451
|
+
component: "span",
|
|
3452
|
+
"aria-label": void 0,
|
|
3453
|
+
sx: { display: "flex", gap: 0.5, p: 2, width: 320, borderRadius: 1 }
|
|
3454
|
+
},
|
|
3455
|
+
content
|
|
3456
|
+
)
|
|
3457
|
+
},
|
|
3458
|
+
children
|
|
3459
|
+
) : children;
|
|
3466
3460
|
|
|
3467
3461
|
// src/components/unstable-repeater/header/header.tsx
|
|
3468
3462
|
var React51 = __toESM(require("react"));
|
|
3469
|
-
var
|
|
3463
|
+
var import_ui43 = require("@elementor/ui");
|
|
3470
3464
|
var Header = ({ label, children }) => {
|
|
3471
3465
|
const { value } = useBoundProp();
|
|
3472
|
-
return /* @__PURE__ */ React51.createElement(
|
|
3466
|
+
return /* @__PURE__ */ React51.createElement(import_ui43.Stack, { direction: "row", justifyContent: "start", alignItems: "center", gap: 1, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React51.createElement(import_ui43.Typography, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React51.createElement(RepeaterHeaderActionsSlot, { value }), /* @__PURE__ */ React51.createElement(SlotChildren, { whitelist: [TooltipAddItemAction] }, children), /* @__PURE__ */ React51.createElement(ControlAdornments, null));
|
|
3473
3467
|
};
|
|
3474
3468
|
|
|
3475
3469
|
// src/components/unstable-repeater/items/items-container.tsx
|
|
3476
3470
|
var React52 = __toESM(require("react"));
|
|
3477
3471
|
var ItemsContainer = ({
|
|
3478
3472
|
itemTemplate,
|
|
3473
|
+
isSortable = true,
|
|
3479
3474
|
children
|
|
3480
3475
|
}) => {
|
|
3481
|
-
const { items: items2,
|
|
3476
|
+
const { items: items2, setItems } = useRepeaterContext();
|
|
3477
|
+
const keys = items2.map(({ key }) => key);
|
|
3482
3478
|
if (!itemTemplate) {
|
|
3483
3479
|
return null;
|
|
3484
3480
|
}
|
|
3485
|
-
const onChangeOrder = (
|
|
3486
|
-
|
|
3481
|
+
const onChangeOrder = (newKeys) => {
|
|
3482
|
+
setItems(
|
|
3483
|
+
newKeys.map((key) => {
|
|
3484
|
+
const index = items2.findIndex((item) => item.key === key);
|
|
3485
|
+
return items2[index];
|
|
3486
|
+
})
|
|
3487
|
+
);
|
|
3487
3488
|
};
|
|
3488
|
-
return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(SortableProvider, { value:
|
|
3489
|
-
const value = items2
|
|
3490
|
-
if (!value) {
|
|
3491
|
-
return null;
|
|
3492
|
-
}
|
|
3489
|
+
return /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement(SortableProvider, { value: keys, onChange: onChangeOrder }, keys.map((key, index) => {
|
|
3490
|
+
const value = items2[index].item;
|
|
3493
3491
|
return /* @__PURE__ */ React52.createElement(SortableItem, { id: key, key: `sortable-${key}`, disabled: !isSortable }, React52.isValidElement(itemTemplate) ? React52.cloneElement(itemTemplate, {
|
|
3494
3492
|
key,
|
|
3495
3493
|
value,
|
|
3496
3494
|
index,
|
|
3497
|
-
openOnMount: key === openItem,
|
|
3498
3495
|
children
|
|
3499
3496
|
}) : null);
|
|
3500
3497
|
})));
|
|
3501
3498
|
};
|
|
3502
3499
|
|
|
3503
3500
|
// src/components/unstable-repeater/items/item.tsx
|
|
3504
|
-
var
|
|
3505
|
-
var
|
|
3506
|
-
var import_ui48 = require("@elementor/ui");
|
|
3501
|
+
var React56 = __toESM(require("react"));
|
|
3502
|
+
var import_ui47 = require("@elementor/ui");
|
|
3507
3503
|
var import_i18n23 = require("@wordpress/i18n");
|
|
3508
3504
|
|
|
3509
3505
|
// src/components/unstable-repeater/actions/disable-item-action.tsx
|
|
3510
3506
|
var React53 = __toESM(require("react"));
|
|
3511
3507
|
var import_icons16 = require("@elementor/icons");
|
|
3512
|
-
var
|
|
3508
|
+
var import_ui44 = require("@elementor/ui");
|
|
3513
3509
|
var import_i18n20 = require("@wordpress/i18n");
|
|
3514
3510
|
var SIZE5 = "tiny";
|
|
3515
3511
|
var DisableItemAction = ({ index = -1 }) => {
|
|
@@ -3517,23 +3513,23 @@ var DisableItemAction = ({ index = -1 }) => {
|
|
|
3517
3513
|
if (index === -1) {
|
|
3518
3514
|
return null;
|
|
3519
3515
|
}
|
|
3520
|
-
const propDisabled = items2[index]
|
|
3516
|
+
const propDisabled = items2[index].item.disabled ?? false;
|
|
3521
3517
|
const toggleLabel = propDisabled ? (0, import_i18n20.__)("Show", "elementor") : (0, import_i18n20.__)("Hide", "elementor");
|
|
3522
3518
|
const onClick = () => {
|
|
3523
|
-
const self = structuredClone(items2[index]);
|
|
3519
|
+
const self = structuredClone(items2[index].item);
|
|
3524
3520
|
self.disabled = !self.disabled;
|
|
3525
3521
|
if (!self.disabled) {
|
|
3526
3522
|
delete self.disabled;
|
|
3527
3523
|
}
|
|
3528
3524
|
updateItem(self, index);
|
|
3529
3525
|
};
|
|
3530
|
-
return /* @__PURE__ */ React53.createElement(
|
|
3526
|
+
return /* @__PURE__ */ React53.createElement(import_ui44.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React53.createElement(import_ui44.IconButton, { size: SIZE5, onClick, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React53.createElement(import_icons16.EyeOffIcon, { fontSize: SIZE5 }) : /* @__PURE__ */ React53.createElement(import_icons16.EyeIcon, { fontSize: SIZE5 })));
|
|
3531
3527
|
};
|
|
3532
3528
|
|
|
3533
3529
|
// src/components/unstable-repeater/actions/duplicate-item-action.tsx
|
|
3534
3530
|
var React54 = __toESM(require("react"));
|
|
3535
3531
|
var import_icons17 = require("@elementor/icons");
|
|
3536
|
-
var
|
|
3532
|
+
var import_ui45 = require("@elementor/ui");
|
|
3537
3533
|
var import_i18n21 = require("@wordpress/i18n");
|
|
3538
3534
|
var SIZE6 = "tiny";
|
|
3539
3535
|
var DuplicateItemAction = ({ index = -1 }) => {
|
|
@@ -3542,17 +3538,17 @@ var DuplicateItemAction = ({ index = -1 }) => {
|
|
|
3542
3538
|
return null;
|
|
3543
3539
|
}
|
|
3544
3540
|
const duplicateLabel = (0, import_i18n21.__)("Duplicate", "elementor");
|
|
3545
|
-
const onClick = () => {
|
|
3546
|
-
const newItem = structuredClone(items2[index]);
|
|
3547
|
-
addItem({ item: newItem, index: index + 1 });
|
|
3541
|
+
const onClick = (ev) => {
|
|
3542
|
+
const newItem = structuredClone(items2[index]?.item);
|
|
3543
|
+
addItem(ev, { item: newItem, index: index + 1 });
|
|
3548
3544
|
};
|
|
3549
|
-
return /* @__PURE__ */ React54.createElement(
|
|
3545
|
+
return /* @__PURE__ */ React54.createElement(import_ui45.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React54.createElement(import_ui45.IconButton, { size: SIZE6, onClick, "aria-label": duplicateLabel }, /* @__PURE__ */ React54.createElement(import_icons17.CopyIcon, { fontSize: SIZE6 })));
|
|
3550
3546
|
};
|
|
3551
3547
|
|
|
3552
3548
|
// src/components/unstable-repeater/actions/remove-item-action.tsx
|
|
3553
3549
|
var React55 = __toESM(require("react"));
|
|
3554
3550
|
var import_icons18 = require("@elementor/icons");
|
|
3555
|
-
var
|
|
3551
|
+
var import_ui46 = require("@elementor/ui");
|
|
3556
3552
|
var import_i18n22 = require("@wordpress/i18n");
|
|
3557
3553
|
var SIZE7 = "tiny";
|
|
3558
3554
|
var RemoveItemAction = ({ index = -1 }) => {
|
|
@@ -3562,80 +3558,39 @@ var RemoveItemAction = ({ index = -1 }) => {
|
|
|
3562
3558
|
}
|
|
3563
3559
|
const removeLabel = (0, import_i18n22.__)("Remove", "elementor");
|
|
3564
3560
|
const onClick = () => removeItem(index);
|
|
3565
|
-
return /* @__PURE__ */ React55.createElement(
|
|
3566
|
-
};
|
|
3567
|
-
|
|
3568
|
-
// src/components/unstable-repeater/items/edit-item-popover.tsx
|
|
3569
|
-
var React56 = __toESM(require("react"));
|
|
3570
|
-
var import_ui46 = require("@elementor/ui");
|
|
3571
|
-
var EditItemPopover = ({ children, anchorRef, setAnchorEl, popoverProps }) => {
|
|
3572
|
-
return /* @__PURE__ */ React56.createElement(
|
|
3573
|
-
import_ui46.Popover,
|
|
3574
|
-
{
|
|
3575
|
-
disablePortal: true,
|
|
3576
|
-
slotProps: {
|
|
3577
|
-
paper: {
|
|
3578
|
-
ref: setAnchorEl,
|
|
3579
|
-
sx: { mt: 0.5, width: anchorRef?.offsetWidth }
|
|
3580
|
-
}
|
|
3581
|
-
},
|
|
3582
|
-
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
3583
|
-
anchorEl: anchorRef,
|
|
3584
|
-
...popoverProps
|
|
3585
|
-
},
|
|
3586
|
-
/* @__PURE__ */ React56.createElement(import_ui46.Box, null, children)
|
|
3587
|
-
);
|
|
3588
|
-
};
|
|
3589
|
-
|
|
3590
|
-
// src/components/unstable-repeater/items/use-popover.tsx
|
|
3591
|
-
var import_react31 = require("react");
|
|
3592
|
-
var import_ui47 = require("@elementor/ui");
|
|
3593
|
-
var usePopover2 = (openOnMount, onOpen) => {
|
|
3594
|
-
const [ref, setRef] = (0, import_react31.useState)(null);
|
|
3595
|
-
const popoverState = (0, import_ui47.usePopupState)({ variant: "popover" });
|
|
3596
|
-
const popoverProps = (0, import_ui47.bindPopover)(popoverState);
|
|
3597
|
-
(0, import_react31.useEffect)(() => {
|
|
3598
|
-
if (openOnMount && ref) {
|
|
3599
|
-
popoverState.open(ref);
|
|
3600
|
-
onOpen?.();
|
|
3601
|
-
}
|
|
3602
|
-
}, [ref]);
|
|
3603
|
-
return {
|
|
3604
|
-
popoverState,
|
|
3605
|
-
ref,
|
|
3606
|
-
setRef,
|
|
3607
|
-
popoverProps
|
|
3608
|
-
};
|
|
3561
|
+
return /* @__PURE__ */ React55.createElement(import_ui46.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React55.createElement(import_ui46.IconButton, { size: SIZE7, onClick, "aria-label": removeLabel }, /* @__PURE__ */ React55.createElement(import_icons18.XIcon, { fontSize: SIZE7 })));
|
|
3609
3562
|
};
|
|
3610
3563
|
|
|
3611
3564
|
// src/components/unstable-repeater/items/item.tsx
|
|
3612
3565
|
var Item = ({
|
|
3613
3566
|
Label: Label3,
|
|
3614
3567
|
Icon,
|
|
3615
|
-
Content: Content6,
|
|
3616
|
-
key,
|
|
3617
3568
|
value,
|
|
3618
|
-
index,
|
|
3619
|
-
openOnMount,
|
|
3569
|
+
index = -1,
|
|
3620
3570
|
children
|
|
3621
3571
|
}) => {
|
|
3622
|
-
const
|
|
3623
|
-
const
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3572
|
+
const { items: items2, popoverState, setRowRef, openItemIndex, setOpenItemIndex } = useRepeaterContext();
|
|
3573
|
+
const triggerProps = (0, import_ui47.bindTrigger)(popoverState);
|
|
3574
|
+
const key = items2[index].key ?? -1;
|
|
3575
|
+
const onClick = (ev) => {
|
|
3576
|
+
triggerProps.onClick(ev);
|
|
3577
|
+
setOpenItemIndex(index);
|
|
3578
|
+
};
|
|
3579
|
+
return /* @__PURE__ */ React56.createElement(React56.Fragment, null, /* @__PURE__ */ React56.createElement(
|
|
3580
|
+
import_ui47.UnstableTag,
|
|
3627
3581
|
{
|
|
3628
3582
|
key,
|
|
3629
3583
|
disabled: false,
|
|
3630
|
-
label: /* @__PURE__ */
|
|
3584
|
+
label: /* @__PURE__ */ React56.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ React56.createElement(Label3, { value })),
|
|
3631
3585
|
showActionsOnHover: true,
|
|
3632
3586
|
fullWidth: true,
|
|
3633
|
-
ref:
|
|
3587
|
+
ref: (ref) => ref && openItemIndex === index && setRowRef(ref),
|
|
3634
3588
|
variant: "outlined",
|
|
3635
3589
|
"aria-label": (0, import_i18n23.__)("Open item", "elementor"),
|
|
3636
|
-
...
|
|
3637
|
-
|
|
3638
|
-
|
|
3590
|
+
...triggerProps,
|
|
3591
|
+
onClick,
|
|
3592
|
+
startIcon: /* @__PURE__ */ React56.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ React56.createElement(Icon, { value })),
|
|
3593
|
+
actions: /* @__PURE__ */ React56.createElement(React56.Fragment, null, /* @__PURE__ */ React56.createElement(RepeaterItemActionsSlot, { index: index ?? -1 }), /* @__PURE__ */ React56.createElement(
|
|
3639
3594
|
SlotChildren,
|
|
3640
3595
|
{
|
|
3641
3596
|
whitelist: [DuplicateItemAction, DisableItemAction, RemoveItemAction],
|
|
@@ -3645,17 +3600,52 @@ var Item = ({
|
|
|
3645
3600
|
children
|
|
3646
3601
|
))
|
|
3647
3602
|
}
|
|
3648
|
-
)
|
|
3603
|
+
));
|
|
3649
3604
|
};
|
|
3650
3605
|
|
|
3651
3606
|
// src/components/unstable-repeater/unstable-repeater.tsx
|
|
3652
3607
|
var React58 = __toESM(require("react"));
|
|
3608
|
+
|
|
3609
|
+
// src/components/unstable-repeater/items/edit-item-popover.tsx
|
|
3610
|
+
var React57 = __toESM(require("react"));
|
|
3611
|
+
var import_ui48 = require("@elementor/ui");
|
|
3612
|
+
var EditItemPopover = ({ children }) => {
|
|
3613
|
+
const { popoverState, openItemIndex, isOpen, rowRef, setOpenItemIndex, setRowRef, items: items2 } = useRepeaterContext();
|
|
3614
|
+
const popoverProps = (0, import_ui48.bindPopover)(popoverState);
|
|
3615
|
+
if (!isOpen || !rowRef) {
|
|
3616
|
+
return null;
|
|
3617
|
+
}
|
|
3618
|
+
const bind = items2[openItemIndex].item.$$type;
|
|
3619
|
+
const onClose = () => {
|
|
3620
|
+
popoverProps.onClose?.();
|
|
3621
|
+
setRowRef(null);
|
|
3622
|
+
setOpenItemIndex(EMPTY_OPEN_ITEM2);
|
|
3623
|
+
};
|
|
3624
|
+
return /* @__PURE__ */ React57.createElement(
|
|
3625
|
+
import_ui48.Popover,
|
|
3626
|
+
{
|
|
3627
|
+
disablePortal: true,
|
|
3628
|
+
slotProps: {
|
|
3629
|
+
paper: {
|
|
3630
|
+
sx: { mt: 0.5, width: rowRef.offsetWidth }
|
|
3631
|
+
}
|
|
3632
|
+
},
|
|
3633
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
3634
|
+
...popoverProps,
|
|
3635
|
+
anchorEl: rowRef,
|
|
3636
|
+
onClose
|
|
3637
|
+
},
|
|
3638
|
+
/* @__PURE__ */ React57.createElement(PropKeyProvider, { bind: String(openItemIndex) }, /* @__PURE__ */ React57.createElement(import_ui48.Box, null, React57.isValidElement(children) && React57.cloneElement(children, { bind, index: openItemIndex })))
|
|
3639
|
+
);
|
|
3640
|
+
};
|
|
3641
|
+
|
|
3642
|
+
// src/components/unstable-repeater/unstable-repeater.tsx
|
|
3653
3643
|
var UnstableRepeater = ({
|
|
3654
3644
|
children,
|
|
3655
3645
|
initial,
|
|
3656
3646
|
propTypeUtil
|
|
3657
3647
|
}) => {
|
|
3658
|
-
return /* @__PURE__ */ React58.createElement(SectionContent, null, /* @__PURE__ */ React58.createElement(RepeaterContextProvider, { initial, propTypeUtil }, /* @__PURE__ */ React58.createElement(SlotChildren, { whitelist: [Header, ItemsContainer], sorted: true }, children)));
|
|
3648
|
+
return /* @__PURE__ */ React58.createElement(SectionContent, null, /* @__PURE__ */ React58.createElement(RepeaterContextProvider, { initial, propTypeUtil }, /* @__PURE__ */ React58.createElement(SlotChildren, { whitelist: [Header, ItemsContainer, EditItemPopover], sorted: true }, children)));
|
|
3659
3649
|
};
|
|
3660
3650
|
|
|
3661
3651
|
// src/env.ts
|
|
@@ -3752,7 +3742,7 @@ var BackgroundImageOverlayAttachment = () => {
|
|
|
3752
3742
|
|
|
3753
3743
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
3754
3744
|
var React61 = __toESM(require("react"));
|
|
3755
|
-
var
|
|
3745
|
+
var import_react31 = require("react");
|
|
3756
3746
|
var import_editor_props26 = require("@elementor/editor-props");
|
|
3757
3747
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
3758
3748
|
var import_icons20 = require("@elementor/icons");
|
|
@@ -3774,7 +3764,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
3774
3764
|
const backgroundImageOffsetContext = useBoundProp(import_editor_props26.backgroundImagePositionOffsetPropTypeUtil);
|
|
3775
3765
|
const stringPropContext = useBoundProp(import_editor_props26.stringPropTypeUtil);
|
|
3776
3766
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
3777
|
-
const rowRef = (0,
|
|
3767
|
+
const rowRef = (0, import_react31.useRef)(null);
|
|
3778
3768
|
const handlePositionChange = (event) => {
|
|
3779
3769
|
const value = event.target.value || null;
|
|
3780
3770
|
if (value === "custom") {
|
|
@@ -3845,7 +3835,7 @@ var BackgroundImageOverlayRepeat = () => {
|
|
|
3845
3835
|
|
|
3846
3836
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
3847
3837
|
var React63 = __toESM(require("react"));
|
|
3848
|
-
var
|
|
3838
|
+
var import_react32 = require("react");
|
|
3849
3839
|
var import_editor_props27 = require("@elementor/editor-props");
|
|
3850
3840
|
var import_icons22 = require("@elementor/icons");
|
|
3851
3841
|
var import_ui53 = require("@elementor/ui");
|
|
@@ -3880,7 +3870,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
3880
3870
|
const backgroundImageScaleContext = useBoundProp(import_editor_props27.backgroundImageSizeScalePropTypeUtil);
|
|
3881
3871
|
const stringPropContext = useBoundProp(import_editor_props27.stringPropTypeUtil);
|
|
3882
3872
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
3883
|
-
const rowRef = (0,
|
|
3873
|
+
const rowRef = (0, import_react32.useRef)(null);
|
|
3884
3874
|
const handleSizeChange = (size) => {
|
|
3885
3875
|
if (size === "custom") {
|
|
3886
3876
|
backgroundImageScaleContext.setValue({ width: null, height: null });
|
|
@@ -3915,7 +3905,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
3915
3905
|
};
|
|
3916
3906
|
|
|
3917
3907
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
3918
|
-
var
|
|
3908
|
+
var import_react33 = require("react");
|
|
3919
3909
|
var import_editor_props28 = require("@elementor/editor-props");
|
|
3920
3910
|
var import_ui54 = require("@elementor/ui");
|
|
3921
3911
|
var useBackgroundTabsHistory = ({
|
|
@@ -3936,7 +3926,7 @@ var useBackgroundTabsHistory = ({
|
|
|
3936
3926
|
return "image";
|
|
3937
3927
|
};
|
|
3938
3928
|
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui54.useTabs)(getCurrentOverlayType());
|
|
3939
|
-
const valuesHistory = (0,
|
|
3929
|
+
const valuesHistory = (0, import_react33.useRef)({
|
|
3940
3930
|
image: initialBackgroundImageOverlay,
|
|
3941
3931
|
color: initialBackgroundColorOverlay2,
|
|
3942
3932
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -4010,18 +4000,25 @@ var backgroundResolutionOptions = [
|
|
|
4010
4000
|
{ label: (0, import_i18n28.__)("Full", "elementor"), value: "full" }
|
|
4011
4001
|
];
|
|
4012
4002
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
4013
|
-
const { propType, value:
|
|
4014
|
-
return /* @__PURE__ */ React64.createElement(PropProvider, { propType, value:
|
|
4003
|
+
const { propType, value: overlayValues, setValue } = useBoundProp(import_editor_props29.backgroundOverlayPropTypeUtil);
|
|
4004
|
+
return /* @__PURE__ */ React64.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React64.createElement(
|
|
4005
|
+
UnstableRepeater,
|
|
4006
|
+
{
|
|
4007
|
+
initial: getInitialBackgroundOverlay(),
|
|
4008
|
+
propTypeUtil: import_editor_props29.backgroundOverlayPropTypeUtil
|
|
4009
|
+
},
|
|
4010
|
+
/* @__PURE__ */ React64.createElement(Header, { label: (0, import_i18n28.__)("Overlay", "elementor") }, /* @__PURE__ */ React64.createElement(TooltipAddItemAction, { newItemIndex: 0 })),
|
|
4011
|
+
/* @__PURE__ */ React64.createElement(ItemsContainer, { itemTemplate: /* @__PURE__ */ React64.createElement(Item, { Icon: ItemIcon3, Label: ItemLabel3 }) }, /* @__PURE__ */ React64.createElement(DuplicateItemAction, null), /* @__PURE__ */ React64.createElement(DisableItemAction, null), /* @__PURE__ */ React64.createElement(RemoveItemAction, null)),
|
|
4012
|
+
/* @__PURE__ */ React64.createElement(EditItemPopover, null, /* @__PURE__ */ React64.createElement(ItemContent3, null))
|
|
4013
|
+
));
|
|
4015
4014
|
});
|
|
4016
|
-
var ItemContent3 = (
|
|
4017
|
-
return /* @__PURE__ */ React64.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React64.createElement(Content3, { anchorEl }));
|
|
4018
|
-
};
|
|
4019
|
-
var Content3 = ({ anchorEl }) => {
|
|
4015
|
+
var ItemContent3 = () => {
|
|
4020
4016
|
const { getTabsProps, getTabProps, getTabPanelProps } = useBackgroundTabsHistory({
|
|
4021
4017
|
image: getInitialBackgroundOverlay().value,
|
|
4022
4018
|
color: initialBackgroundColorOverlay.value,
|
|
4023
4019
|
gradient: initialBackgroundGradientOverlay.value
|
|
4024
4020
|
});
|
|
4021
|
+
const { rowRef } = useRepeaterContext();
|
|
4025
4022
|
return /* @__PURE__ */ React64.createElement(import_ui55.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React64.createElement(import_ui55.Box, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React64.createElement(
|
|
4026
4023
|
import_ui55.Tabs,
|
|
4027
4024
|
{
|
|
@@ -4033,7 +4030,7 @@ var Content3 = ({ anchorEl }) => {
|
|
|
4033
4030
|
/* @__PURE__ */ React64.createElement(import_ui55.Tab, { label: (0, import_i18n28.__)("Image", "elementor"), ...getTabProps("image") }),
|
|
4034
4031
|
/* @__PURE__ */ React64.createElement(import_ui55.Tab, { label: (0, import_i18n28.__)("Gradient", "elementor"), ...getTabProps("gradient") }),
|
|
4035
4032
|
/* @__PURE__ */ React64.createElement(import_ui55.Tab, { label: (0, import_i18n28.__)("Color", "elementor"), ...getTabProps("color") })
|
|
4036
|
-
)), /* @__PURE__ */ React64.createElement(import_ui55.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React64.createElement(PopoverContent, null, /* @__PURE__ */ React64.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React64.createElement(import_ui55.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React64.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React64.createElement(import_ui55.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("color") }, /* @__PURE__ */ React64.createElement(PopoverContent, null, /* @__PURE__ */ React64.createElement(ColorOverlayContent, { anchorEl }))));
|
|
4033
|
+
)), /* @__PURE__ */ React64.createElement(import_ui55.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React64.createElement(PopoverContent, null, /* @__PURE__ */ React64.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React64.createElement(import_ui55.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React64.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React64.createElement(import_ui55.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("color") }, /* @__PURE__ */ React64.createElement(PopoverContent, null, /* @__PURE__ */ React64.createElement(ColorOverlayContent, { anchorEl: rowRef }))));
|
|
4037
4034
|
};
|
|
4038
4035
|
var ItemIcon3 = ({ value }) => {
|
|
4039
4036
|
switch (value.$$type) {
|
|
@@ -4152,15 +4149,15 @@ var BackgroundControl = createControl(() => {
|
|
|
4152
4149
|
|
|
4153
4150
|
// src/controls/repeatable-control.tsx
|
|
4154
4151
|
var React66 = __toESM(require("react"));
|
|
4155
|
-
var
|
|
4152
|
+
var import_react35 = require("react");
|
|
4156
4153
|
var import_editor_props31 = require("@elementor/editor-props");
|
|
4157
4154
|
var import_ui57 = require("@elementor/ui");
|
|
4158
4155
|
|
|
4159
4156
|
// src/hooks/use-repeatable-control-context.ts
|
|
4160
|
-
var
|
|
4161
|
-
var RepeatableControlContext = (0,
|
|
4157
|
+
var import_react34 = require("react");
|
|
4158
|
+
var RepeatableControlContext = (0, import_react34.createContext)(void 0);
|
|
4162
4159
|
var useRepeatableControlContext = () => {
|
|
4163
|
-
const context = (0,
|
|
4160
|
+
const context = (0, import_react34.useContext)(RepeatableControlContext);
|
|
4164
4161
|
if (!context) {
|
|
4165
4162
|
throw new Error("useRepeatableControlContext must be used within RepeatableControl");
|
|
4166
4163
|
}
|
|
@@ -4184,11 +4181,11 @@ var RepeatableControl = createControl(
|
|
|
4184
4181
|
if (!childPropTypeUtil) {
|
|
4185
4182
|
return null;
|
|
4186
4183
|
}
|
|
4187
|
-
const childArrayPropTypeUtil = (0,
|
|
4184
|
+
const childArrayPropTypeUtil = (0, import_react35.useMemo)(
|
|
4188
4185
|
() => (0, import_editor_props31.createArrayPropUtils)(childPropTypeUtil.key, childPropTypeUtil.schema, propKey),
|
|
4189
4186
|
[childPropTypeUtil.key, childPropTypeUtil.schema, propKey]
|
|
4190
4187
|
);
|
|
4191
|
-
const contextValue = (0,
|
|
4188
|
+
const contextValue = (0, import_react35.useMemo)(
|
|
4192
4189
|
() => ({
|
|
4193
4190
|
...childControlConfig,
|
|
4194
4191
|
placeholder: placeholder || "",
|
|
@@ -4218,10 +4215,10 @@ var RepeatableControl = createControl(
|
|
|
4218
4215
|
}
|
|
4219
4216
|
);
|
|
4220
4217
|
var ItemContent4 = ({ bind }) => {
|
|
4221
|
-
return /* @__PURE__ */ React66.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React66.createElement(
|
|
4218
|
+
return /* @__PURE__ */ React66.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React66.createElement(Content3, null));
|
|
4222
4219
|
};
|
|
4223
4220
|
var ItemIcon4 = () => /* @__PURE__ */ React66.createElement(React66.Fragment, null);
|
|
4224
|
-
var
|
|
4221
|
+
var Content3 = () => {
|
|
4225
4222
|
const { component: ChildControl, props = {} } = useRepeatableControlContext();
|
|
4226
4223
|
return /* @__PURE__ */ React66.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React66.createElement(PopoverGridContainer, null, /* @__PURE__ */ React66.createElement(ChildControl, { ...props })));
|
|
4227
4224
|
};
|
|
@@ -4294,21 +4291,21 @@ var getAllProperties = (pattern) => {
|
|
|
4294
4291
|
|
|
4295
4292
|
// src/controls/key-value-control.tsx
|
|
4296
4293
|
var React67 = __toESM(require("react"));
|
|
4297
|
-
var
|
|
4294
|
+
var import_react36 = require("react");
|
|
4298
4295
|
var import_editor_props32 = require("@elementor/editor-props");
|
|
4299
4296
|
var import_ui58 = require("@elementor/ui");
|
|
4300
4297
|
var import_i18n30 = require("@wordpress/i18n");
|
|
4301
4298
|
var KeyValueControl = createControl((props = {}) => {
|
|
4302
4299
|
const { value, setValue, ...propContext } = useBoundProp(import_editor_props32.keyValuePropTypeUtil);
|
|
4303
|
-
const [keyError, setKeyError] = (0,
|
|
4304
|
-
const [valueError, setValueError] = (0,
|
|
4305
|
-
const [sessionState, setSessionState] = (0,
|
|
4300
|
+
const [keyError, setKeyError] = (0, import_react36.useState)("");
|
|
4301
|
+
const [valueError, setValueError] = (0, import_react36.useState)("");
|
|
4302
|
+
const [sessionState, setSessionState] = (0, import_react36.useState)({
|
|
4306
4303
|
key: value?.key?.value || "",
|
|
4307
4304
|
value: value?.value?.value || ""
|
|
4308
4305
|
});
|
|
4309
4306
|
const keyLabel = props.keyName || (0, import_i18n30.__)("Key", "elementor");
|
|
4310
4307
|
const valueLabel = props.valueName || (0, import_i18n30.__)("Value", "elementor");
|
|
4311
|
-
const [keyRegex, valueRegex, errMsg] = (0,
|
|
4308
|
+
const [keyRegex, valueRegex, errMsg] = (0, import_react36.useMemo)(
|
|
4312
4309
|
() => [
|
|
4313
4310
|
props.regexKey ? new RegExp(props.regexKey) : void 0,
|
|
4314
4311
|
props.regexValue ? new RegExp(props.regexValue) : void 0,
|
|
@@ -4418,22 +4415,11 @@ var PositionControl = () => {
|
|
|
4418
4415
|
// src/controls/transform-control/transform-repeater-control.tsx
|
|
4419
4416
|
var React78 = __toESM(require("react"));
|
|
4420
4417
|
var import_editor_props40 = require("@elementor/editor-props");
|
|
4418
|
+
var import_icons29 = require("@elementor/icons");
|
|
4419
|
+
var import_ui69 = require("@elementor/ui");
|
|
4421
4420
|
var import_i18n38 = require("@wordpress/i18n");
|
|
4422
4421
|
|
|
4423
|
-
// src/controls/transform-control/
|
|
4424
|
-
var React75 = __toESM(require("react"));
|
|
4425
|
-
var import_ui67 = require("@elementor/ui");
|
|
4426
|
-
var import_i18n36 = require("@wordpress/i18n");
|
|
4427
|
-
|
|
4428
|
-
// src/controls/transform-control/functions/move.tsx
|
|
4429
|
-
var React70 = __toESM(require("react"));
|
|
4430
|
-
var import_react39 = require("react");
|
|
4431
|
-
var import_editor_props35 = require("@elementor/editor-props");
|
|
4432
|
-
var import_icons24 = require("@elementor/icons");
|
|
4433
|
-
var import_ui61 = require("@elementor/ui");
|
|
4434
|
-
var import_i18n32 = require("@wordpress/i18n");
|
|
4435
|
-
|
|
4436
|
-
// src/controls/transform-control/types.ts
|
|
4422
|
+
// src/controls/transform-control/initial-values.ts
|
|
4437
4423
|
var import_editor_props34 = require("@elementor/editor-props");
|
|
4438
4424
|
var TransformFunctionKeys = {
|
|
4439
4425
|
move: "transform-move",
|
|
@@ -4479,6 +4465,19 @@ var initialSkewValue = import_editor_props34.skewTransformPropTypeUtil.create({
|
|
|
4479
4465
|
y: { $$type: "size", value: { size: defaultValues.skew.size, unit: defaultValues.skew.unit } }
|
|
4480
4466
|
});
|
|
4481
4467
|
|
|
4468
|
+
// src/controls/transform-control/transform-content.tsx
|
|
4469
|
+
var React75 = __toESM(require("react"));
|
|
4470
|
+
var import_ui67 = require("@elementor/ui");
|
|
4471
|
+
var import_i18n36 = require("@wordpress/i18n");
|
|
4472
|
+
|
|
4473
|
+
// src/controls/transform-control/functions/move.tsx
|
|
4474
|
+
var React70 = __toESM(require("react"));
|
|
4475
|
+
var import_react37 = require("react");
|
|
4476
|
+
var import_editor_props35 = require("@elementor/editor-props");
|
|
4477
|
+
var import_icons24 = require("@elementor/icons");
|
|
4478
|
+
var import_ui61 = require("@elementor/ui");
|
|
4479
|
+
var import_i18n32 = require("@wordpress/i18n");
|
|
4480
|
+
|
|
4482
4481
|
// src/controls/transform-control/functions/axis-row.tsx
|
|
4483
4482
|
var React69 = __toESM(require("react"));
|
|
4484
4483
|
var import_ui60 = require("@elementor/ui");
|
|
@@ -4506,13 +4505,13 @@ var moveAxisControls = [
|
|
|
4506
4505
|
];
|
|
4507
4506
|
var Move = () => {
|
|
4508
4507
|
const context = useBoundProp(import_editor_props35.moveTransformPropTypeUtil);
|
|
4509
|
-
const rowRef = (0,
|
|
4508
|
+
const rowRef = (0, import_react37.useRef)(null);
|
|
4510
4509
|
return /* @__PURE__ */ React70.createElement(import_ui61.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React70.createElement(PropProvider, { ...context }, /* @__PURE__ */ React70.createElement(PropKeyProvider, { bind: TransformFunctionKeys.move }, moveAxisControls.map((control) => /* @__PURE__ */ React70.createElement(AxisRow, { key: control.bindValue, ...control, anchorRef: rowRef })))));
|
|
4511
4510
|
};
|
|
4512
4511
|
|
|
4513
4512
|
// src/controls/transform-control/functions/rotate.tsx
|
|
4514
4513
|
var React71 = __toESM(require("react"));
|
|
4515
|
-
var
|
|
4514
|
+
var import_react38 = require("react");
|
|
4516
4515
|
var import_editor_props36 = require("@elementor/editor-props");
|
|
4517
4516
|
var import_icons25 = require("@elementor/icons");
|
|
4518
4517
|
var import_ui62 = require("@elementor/ui");
|
|
@@ -4537,13 +4536,13 @@ var rotateAxisControls = [
|
|
|
4537
4536
|
var rotateUnits = ["deg", "rad", "grad", "turn"];
|
|
4538
4537
|
var Rotate = () => {
|
|
4539
4538
|
const context = useBoundProp(import_editor_props36.rotateTransformPropTypeUtil);
|
|
4540
|
-
const rowRef = (0,
|
|
4539
|
+
const rowRef = (0, import_react38.useRef)(null);
|
|
4541
4540
|
return /* @__PURE__ */ React71.createElement(import_ui62.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React71.createElement(PropProvider, { ...context }, /* @__PURE__ */ React71.createElement(PropKeyProvider, { bind: TransformFunctionKeys.rotate }, rotateAxisControls.map((control) => /* @__PURE__ */ React71.createElement(AxisRow, { key: control.bindValue, ...control, anchorRef: rowRef, units: rotateUnits })))));
|
|
4542
4541
|
};
|
|
4543
4542
|
|
|
4544
4543
|
// src/controls/transform-control/functions/scale.tsx
|
|
4545
4544
|
var React73 = __toESM(require("react"));
|
|
4546
|
-
var
|
|
4545
|
+
var import_react39 = require("react");
|
|
4547
4546
|
var import_editor_props37 = require("@elementor/editor-props");
|
|
4548
4547
|
var import_icons26 = require("@elementor/icons");
|
|
4549
4548
|
var import_ui64 = require("@elementor/ui");
|
|
@@ -4576,13 +4575,13 @@ var scaleAxisControls = [
|
|
|
4576
4575
|
];
|
|
4577
4576
|
var Scale = () => {
|
|
4578
4577
|
const context = useBoundProp(import_editor_props37.scaleTransformPropTypeUtil);
|
|
4579
|
-
const rowRef = (0,
|
|
4578
|
+
const rowRef = (0, import_react39.useRef)(null);
|
|
4580
4579
|
return /* @__PURE__ */ React73.createElement(import_ui64.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React73.createElement(PropProvider, { ...context }, /* @__PURE__ */ React73.createElement(PropKeyProvider, { bind: TransformFunctionKeys.scale }, scaleAxisControls.map((control) => /* @__PURE__ */ React73.createElement(ScaleAxisRow, { key: control.bindValue, ...control, anchorRef: rowRef })))));
|
|
4581
4580
|
};
|
|
4582
4581
|
|
|
4583
4582
|
// src/controls/transform-control/functions/skew.tsx
|
|
4584
4583
|
var React74 = __toESM(require("react"));
|
|
4585
|
-
var
|
|
4584
|
+
var import_react40 = require("react");
|
|
4586
4585
|
var import_editor_props38 = require("@elementor/editor-props");
|
|
4587
4586
|
var import_icons27 = require("@elementor/icons");
|
|
4588
4587
|
var import_ui65 = require("@elementor/ui");
|
|
@@ -4602,12 +4601,12 @@ var skewAxisControls = [
|
|
|
4602
4601
|
var skewUnits = ["deg", "rad", "grad", "turn"];
|
|
4603
4602
|
var Skew = () => {
|
|
4604
4603
|
const context = useBoundProp(import_editor_props38.skewTransformPropTypeUtil);
|
|
4605
|
-
const rowRef = (0,
|
|
4604
|
+
const rowRef = (0, import_react40.useRef)(null);
|
|
4606
4605
|
return /* @__PURE__ */ React74.createElement(import_ui65.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React74.createElement(PropProvider, { ...context }, /* @__PURE__ */ React74.createElement(PropKeyProvider, { bind: TransformFunctionKeys.skew }, skewAxisControls.map((control) => /* @__PURE__ */ React74.createElement(AxisRow, { key: control.bindValue, ...control, anchorRef: rowRef, units: skewUnits })))));
|
|
4607
4606
|
};
|
|
4608
4607
|
|
|
4609
4608
|
// src/controls/transform-control/use-transform-tabs-history.tsx
|
|
4610
|
-
var
|
|
4609
|
+
var import_react41 = require("react");
|
|
4611
4610
|
var import_editor_props39 = require("@elementor/editor-props");
|
|
4612
4611
|
var import_ui66 = require("@elementor/ui");
|
|
4613
4612
|
var useTransformTabsHistory = ({
|
|
@@ -4620,6 +4619,7 @@ var useTransformTabsHistory = ({
|
|
|
4620
4619
|
const { value: scaleValue, setValue: setScaleValue } = useBoundProp(import_editor_props39.scaleTransformPropTypeUtil);
|
|
4621
4620
|
const { value: rotateValue, setValue: setRotateValue } = useBoundProp(import_editor_props39.rotateTransformPropTypeUtil);
|
|
4622
4621
|
const { value: skewValue, setValue: setSkewValue } = useBoundProp(import_editor_props39.skewTransformPropTypeUtil);
|
|
4622
|
+
const { openItemIndex, items: items2 } = useRepeaterContext();
|
|
4623
4623
|
const getCurrentTransformType = () => {
|
|
4624
4624
|
switch (true) {
|
|
4625
4625
|
case !!scaleValue:
|
|
@@ -4633,7 +4633,7 @@ var useTransformTabsHistory = ({
|
|
|
4633
4633
|
}
|
|
4634
4634
|
};
|
|
4635
4635
|
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui66.useTabs)(getCurrentTransformType());
|
|
4636
|
-
const valuesHistory = (0,
|
|
4636
|
+
const valuesHistory = (0, import_react41.useRef)({
|
|
4637
4637
|
move: initialMove,
|
|
4638
4638
|
scale: initialScale,
|
|
4639
4639
|
rotate: initialRotate,
|
|
@@ -4673,18 +4673,21 @@ var useTransformTabsHistory = ({
|
|
|
4673
4673
|
}
|
|
4674
4674
|
return getTabsProps().onChange(e, tabName);
|
|
4675
4675
|
};
|
|
4676
|
+
const isTabDisabled = (tabKey) => {
|
|
4677
|
+
return !!items2.find(({ item: { $$type: key } }, pos) => tabKey === key && pos !== openItemIndex);
|
|
4678
|
+
};
|
|
4676
4679
|
return {
|
|
4677
|
-
getTabProps
|
|
4680
|
+
getTabProps: (value) => ({
|
|
4681
|
+
...getTabProps(value),
|
|
4682
|
+
disabled: isTabDisabled(value)
|
|
4683
|
+
}),
|
|
4678
4684
|
getTabPanelProps,
|
|
4679
4685
|
getTabsProps: () => ({ ...getTabsProps(), onChange: onTabChange })
|
|
4680
4686
|
};
|
|
4681
4687
|
};
|
|
4682
4688
|
|
|
4683
4689
|
// src/controls/transform-control/transform-content.tsx
|
|
4684
|
-
var TransformContent = (
|
|
4685
|
-
return /* @__PURE__ */ React75.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React75.createElement(Content5, null));
|
|
4686
|
-
};
|
|
4687
|
-
var Content5 = () => {
|
|
4690
|
+
var TransformContent = () => {
|
|
4688
4691
|
const { getTabsProps, getTabProps, getTabPanelProps } = useTransformTabsHistory({
|
|
4689
4692
|
move: initialTransformValue.value,
|
|
4690
4693
|
scale: initialScaleValue.value,
|
|
@@ -4770,25 +4773,31 @@ var Label2 = ({ label, value }) => {
|
|
|
4770
4773
|
|
|
4771
4774
|
// src/controls/transform-control/transform-repeater-control.tsx
|
|
4772
4775
|
var TransformRepeaterControl = createControl(() => {
|
|
4773
|
-
const { propType, value: transformValues, setValue
|
|
4776
|
+
const { propType, value: transformValues, setValue } = useBoundProp(import_editor_props40.transformPropTypeUtil);
|
|
4777
|
+
const availableValues = [initialTransformValue, initialScaleValue, initialRotateValue, initialSkewValue];
|
|
4778
|
+
const getInitialValue = () => {
|
|
4779
|
+
return availableValues.find((value) => !transformValues?.some((item) => item.$$type === value.$$type));
|
|
4780
|
+
};
|
|
4781
|
+
const shouldDisableAddItem = !getInitialValue();
|
|
4774
4782
|
return /* @__PURE__ */ React78.createElement(PropProvider, { propType, value: transformValues, setValue }, /* @__PURE__ */ React78.createElement(
|
|
4775
|
-
|
|
4783
|
+
UnstableRepeater,
|
|
4776
4784
|
{
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
Content: TransformContent,
|
|
4787
|
-
initialValues: initialTransformValue
|
|
4785
|
+
initial: getInitialValue() ?? initialTransformValue,
|
|
4786
|
+
propTypeUtil: import_editor_props40.transformPropTypeUtil
|
|
4787
|
+
},
|
|
4788
|
+
/* @__PURE__ */ React78.createElement(Header, { label: (0, import_i18n38.__)("Transform", "elementor") }, /* @__PURE__ */ React78.createElement(
|
|
4789
|
+
TooltipAddItemAction,
|
|
4790
|
+
{
|
|
4791
|
+
disabled: shouldDisableAddItem,
|
|
4792
|
+
tooltipContent: ToolTip,
|
|
4793
|
+
enableTooltip: shouldDisableAddItem
|
|
4788
4794
|
}
|
|
4789
|
-
|
|
4795
|
+
)),
|
|
4796
|
+
/* @__PURE__ */ React78.createElement(ItemsContainer, { itemTemplate: /* @__PURE__ */ React78.createElement(Item, { Icon: TransformIcon, Label: TransformLabel }) }, /* @__PURE__ */ React78.createElement(DisableItemAction, null), /* @__PURE__ */ React78.createElement(RemoveItemAction, null)),
|
|
4797
|
+
/* @__PURE__ */ React78.createElement(EditItemPopover, null, /* @__PURE__ */ React78.createElement(TransformContent, null))
|
|
4790
4798
|
));
|
|
4791
4799
|
});
|
|
4800
|
+
var ToolTip = /* @__PURE__ */ React78.createElement(React78.Fragment, null, /* @__PURE__ */ React78.createElement(import_icons29.InfoCircleFilledIcon, { sx: { color: "secondary.main" } }), /* @__PURE__ */ React78.createElement(import_ui69.Typography, { variant: "body2", color: "text.secondary", fontSize: "14px" }, (0, import_i18n38.__)("You can use each kind of transform only once per element.", "elementor")));
|
|
4792
4801
|
|
|
4793
4802
|
// src/controls/transition-control/transition-repeater-control.tsx
|
|
4794
4803
|
var React81 = __toESM(require("react"));
|
|
@@ -4797,14 +4806,14 @@ var import_i18n40 = require("@wordpress/i18n");
|
|
|
4797
4806
|
|
|
4798
4807
|
// src/controls/selection-size-control.tsx
|
|
4799
4808
|
var React79 = __toESM(require("react"));
|
|
4800
|
-
var
|
|
4809
|
+
var import_react42 = require("react");
|
|
4801
4810
|
var import_editor_props41 = require("@elementor/editor-props");
|
|
4802
|
-
var
|
|
4811
|
+
var import_ui70 = require("@elementor/ui");
|
|
4803
4812
|
var SelectionSizeControl = createControl(
|
|
4804
4813
|
({ selectionLabel, sizeLabel, selectionConfig, sizeConfigMap }) => {
|
|
4805
4814
|
const { value, setValue, propType } = useBoundProp(import_editor_props41.selectionSizePropTypeUtil);
|
|
4806
|
-
const rowRef = (0,
|
|
4807
|
-
const currentSizeConfig = (0,
|
|
4815
|
+
const rowRef = (0, import_react42.useRef)(null);
|
|
4816
|
+
const currentSizeConfig = (0, import_react42.useMemo)(() => {
|
|
4808
4817
|
switch (value.selection.$$type) {
|
|
4809
4818
|
case "key-value":
|
|
4810
4819
|
return sizeConfigMap[value?.selection?.value.value.value || ""];
|
|
@@ -4815,7 +4824,7 @@ var SelectionSizeControl = createControl(
|
|
|
4815
4824
|
}
|
|
4816
4825
|
}, [value, sizeConfigMap]);
|
|
4817
4826
|
const SelectionComponent = selectionConfig.component;
|
|
4818
|
-
return /* @__PURE__ */ React79.createElement(PropProvider, { value, setValue, propType }, /* @__PURE__ */ React79.createElement(
|
|
4827
|
+
return /* @__PURE__ */ React79.createElement(PropProvider, { value, setValue, propType }, /* @__PURE__ */ React79.createElement(import_ui70.Grid, { container: true, spacing: 1.5, ref: rowRef }, /* @__PURE__ */ React79.createElement(import_ui70.Grid, { item: true, xs: 6, sx: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React79.createElement(ControlFormLabel, null, selectionLabel)), /* @__PURE__ */ React79.createElement(import_ui70.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React79.createElement(PropKeyProvider, { bind: "selection" }, /* @__PURE__ */ React79.createElement(SelectionComponent, { ...selectionConfig.props }))), currentSizeConfig && /* @__PURE__ */ React79.createElement(React79.Fragment, null, /* @__PURE__ */ React79.createElement(import_ui70.Grid, { item: true, xs: 6, sx: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React79.createElement(ControlFormLabel, null, sizeLabel)), /* @__PURE__ */ React79.createElement(import_ui70.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React79.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React79.createElement(
|
|
4819
4828
|
SizeControl,
|
|
4820
4829
|
{
|
|
4821
4830
|
anchorRef: rowRef,
|
|
@@ -4852,10 +4861,10 @@ var transitionsItemsList = transitionProperties.map((category) => ({
|
|
|
4852
4861
|
|
|
4853
4862
|
// src/controls/transition-control/transition-selector.tsx
|
|
4854
4863
|
var React80 = __toESM(require("react"));
|
|
4855
|
-
var
|
|
4864
|
+
var import_react43 = require("react");
|
|
4856
4865
|
var import_editor_props42 = require("@elementor/editor-props");
|
|
4857
|
-
var
|
|
4858
|
-
var
|
|
4866
|
+
var import_icons30 = require("@elementor/icons");
|
|
4867
|
+
var import_ui71 = require("@elementor/ui");
|
|
4859
4868
|
var import_i18n39 = require("@wordpress/i18n");
|
|
4860
4869
|
var toTransitionSelectorValue = (label) => {
|
|
4861
4870
|
for (const category of transitionProperties) {
|
|
@@ -4883,8 +4892,8 @@ var TransitionSelector = ({ recentlyUsedList }) => {
|
|
|
4883
4892
|
value: { value: transitionValue },
|
|
4884
4893
|
key: { value: transitionLabel }
|
|
4885
4894
|
} = value;
|
|
4886
|
-
const defaultRef = (0,
|
|
4887
|
-
const popoverState = (0,
|
|
4895
|
+
const defaultRef = (0, import_react43.useRef)(null);
|
|
4896
|
+
const popoverState = (0, import_ui71.usePopupState)({ variant: "popover" });
|
|
4888
4897
|
const getItemList = () => {
|
|
4889
4898
|
const recentItems = recentlyUsedList.map((item) => findByValue(item)).filter((item) => !!item);
|
|
4890
4899
|
const filteredItems = transitionsItemsList.map((category) => {
|
|
@@ -4922,21 +4931,21 @@ var TransitionSelector = ({ recentlyUsedList }) => {
|
|
|
4922
4931
|
left: rect.right + 36
|
|
4923
4932
|
};
|
|
4924
4933
|
};
|
|
4925
|
-
return /* @__PURE__ */ React80.createElement(
|
|
4926
|
-
|
|
4934
|
+
return /* @__PURE__ */ React80.createElement(import_ui71.Box, { ref: defaultRef }, /* @__PURE__ */ React80.createElement(
|
|
4935
|
+
import_ui71.UnstableTag,
|
|
4927
4936
|
{
|
|
4928
4937
|
variant: "outlined",
|
|
4929
4938
|
label: transitionLabel,
|
|
4930
|
-
endIcon: /* @__PURE__ */ React80.createElement(
|
|
4931
|
-
...(0,
|
|
4939
|
+
endIcon: /* @__PURE__ */ React80.createElement(import_icons30.ChevronDownIcon, { fontSize: "tiny" }),
|
|
4940
|
+
...(0, import_ui71.bindTrigger)(popoverState),
|
|
4932
4941
|
fullWidth: true
|
|
4933
4942
|
}
|
|
4934
4943
|
), /* @__PURE__ */ React80.createElement(
|
|
4935
|
-
|
|
4944
|
+
import_ui71.Popover,
|
|
4936
4945
|
{
|
|
4937
4946
|
disablePortal: true,
|
|
4938
4947
|
disableScrollLock: true,
|
|
4939
|
-
...(0,
|
|
4948
|
+
...(0, import_ui71.bindPopover)(popoverState),
|
|
4940
4949
|
anchorReference: "anchorPosition",
|
|
4941
4950
|
anchorPosition: getAnchorPosition(),
|
|
4942
4951
|
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
@@ -4951,7 +4960,7 @@ var TransitionSelector = ({ recentlyUsedList }) => {
|
|
|
4951
4960
|
onClose: popoverState.close,
|
|
4952
4961
|
sectionWidth: 268,
|
|
4953
4962
|
title: (0, import_i18n39.__)("Transition Property", "elementor"),
|
|
4954
|
-
icon:
|
|
4963
|
+
icon: import_icons30.VariationsIcon
|
|
4955
4964
|
}
|
|
4956
4965
|
)
|
|
4957
4966
|
));
|
|
@@ -5010,31 +5019,15 @@ var TransitionRepeaterControl = createControl((props) => {
|
|
|
5010
5019
|
);
|
|
5011
5020
|
});
|
|
5012
5021
|
|
|
5013
|
-
// src/controls/unstable-transform-control/unstable-transform-repeater-control.tsx
|
|
5014
|
-
var React82 = __toESM(require("react"));
|
|
5015
|
-
var import_editor_props44 = require("@elementor/editor-props");
|
|
5016
|
-
var import_i18n41 = require("@wordpress/i18n");
|
|
5017
|
-
var UnstableTransformRepeaterControl = createControl(() => {
|
|
5018
|
-
const { propType, value: transformValues, setValue } = useBoundProp(import_editor_props44.transformPropTypeUtil);
|
|
5019
|
-
return /* @__PURE__ */ React82.createElement(PropProvider, { propType, value: transformValues, setValue }, /* @__PURE__ */ React82.createElement(UnstableRepeater, { initial: initialTransformValue, propTypeUtil: import_editor_props44.transformPropTypeUtil }, /* @__PURE__ */ React82.createElement(Header, { label: (0, import_i18n41.__)("Transform", "elementor") }, /* @__PURE__ */ React82.createElement(AddItemAction, null)), /* @__PURE__ */ React82.createElement(
|
|
5020
|
-
ItemsContainer,
|
|
5021
|
-
{
|
|
5022
|
-
itemTemplate: /* @__PURE__ */ React82.createElement(Item, { Icon: TransformIcon, Label: TransformLabel, Content: TransformContent })
|
|
5023
|
-
},
|
|
5024
|
-
/* @__PURE__ */ React82.createElement(DisableItemAction, null),
|
|
5025
|
-
/* @__PURE__ */ React82.createElement(RemoveItemAction, null)
|
|
5026
|
-
)));
|
|
5027
|
-
});
|
|
5028
|
-
|
|
5029
5022
|
// src/components/css-code-editor/css-editor.tsx
|
|
5030
|
-
var
|
|
5023
|
+
var React83 = __toESM(require("react"));
|
|
5031
5024
|
var import_editor_responsive2 = require("@elementor/editor-responsive");
|
|
5032
|
-
var
|
|
5033
|
-
var
|
|
5025
|
+
var import_ui73 = require("@elementor/ui");
|
|
5026
|
+
var import_react44 = require("@monaco-editor/react");
|
|
5034
5027
|
|
|
5035
5028
|
// src/components/css-code-editor/css-editor.styles.ts
|
|
5036
|
-
var
|
|
5037
|
-
var EditorWrapper = (0,
|
|
5029
|
+
var import_ui72 = require("@elementor/ui");
|
|
5030
|
+
var EditorWrapper = (0, import_ui72.styled)(import_ui72.Box)`
|
|
5038
5031
|
border: 1px solid var( --e-a-border-color );
|
|
5039
5032
|
border-radius: 8px;
|
|
5040
5033
|
padding: 10px 12px;
|
|
@@ -5045,7 +5038,7 @@ var EditorWrapper = (0, import_ui71.styled)(import_ui71.Box)`
|
|
|
5045
5038
|
z-index: 99999999 !important;
|
|
5046
5039
|
}
|
|
5047
5040
|
`;
|
|
5048
|
-
var ResizeHandle = (0,
|
|
5041
|
+
var ResizeHandle = (0, import_ui72.styled)(import_ui72.Button)`
|
|
5049
5042
|
position: absolute;
|
|
5050
5043
|
bottom: 0;
|
|
5051
5044
|
left: 0;
|
|
@@ -5078,25 +5071,25 @@ var ResizeHandle = (0, import_ui71.styled)(import_ui71.Button)`
|
|
|
5078
5071
|
`;
|
|
5079
5072
|
|
|
5080
5073
|
// src/components/css-code-editor/css-validation.ts
|
|
5081
|
-
var
|
|
5074
|
+
var import_i18n41 = require("@wordpress/i18n");
|
|
5082
5075
|
var forbiddenPatterns = [
|
|
5083
5076
|
{
|
|
5084
5077
|
pattern: ":hover",
|
|
5085
|
-
message: (0,
|
|
5078
|
+
message: (0, import_i18n41.__)(
|
|
5086
5079
|
"The use of pseudo-states is not permitted. Instead, switch to the desired pseudo state and add your custom code there.",
|
|
5087
5080
|
"elementor"
|
|
5088
5081
|
)
|
|
5089
5082
|
},
|
|
5090
5083
|
{
|
|
5091
5084
|
pattern: ":active",
|
|
5092
|
-
message: (0,
|
|
5085
|
+
message: (0, import_i18n41.__)(
|
|
5093
5086
|
"The use of pseudo-states is not permitted. Instead, switch to the desired pseudo state and add your custom code there.",
|
|
5094
5087
|
"elementor"
|
|
5095
5088
|
)
|
|
5096
5089
|
},
|
|
5097
5090
|
{
|
|
5098
5091
|
pattern: "@media",
|
|
5099
|
-
message: (0,
|
|
5092
|
+
message: (0, import_i18n41.__)(
|
|
5100
5093
|
"The use of @media is not permitted. Instead, switch to the desired breakpoint and add your custom code there.",
|
|
5101
5094
|
"elementor"
|
|
5102
5095
|
)
|
|
@@ -5135,9 +5128,9 @@ function validate(editor, monaco) {
|
|
|
5135
5128
|
}
|
|
5136
5129
|
|
|
5137
5130
|
// src/components/css-code-editor/resize-handle.tsx
|
|
5138
|
-
var
|
|
5131
|
+
var React82 = __toESM(require("react"));
|
|
5139
5132
|
var ResizeHandleComponent = ({ onResize, containerRef, onHeightChange }) => {
|
|
5140
|
-
const handleResizeMove =
|
|
5133
|
+
const handleResizeMove = React82.useCallback(
|
|
5141
5134
|
(e) => {
|
|
5142
5135
|
const container = containerRef.current;
|
|
5143
5136
|
if (!container) {
|
|
@@ -5150,11 +5143,11 @@ var ResizeHandleComponent = ({ onResize, containerRef, onHeightChange }) => {
|
|
|
5150
5143
|
},
|
|
5151
5144
|
[containerRef, onResize, onHeightChange]
|
|
5152
5145
|
);
|
|
5153
|
-
const handleResizeEnd =
|
|
5146
|
+
const handleResizeEnd = React82.useCallback(() => {
|
|
5154
5147
|
document.removeEventListener("mousemove", handleResizeMove);
|
|
5155
5148
|
document.removeEventListener("mouseup", handleResizeEnd);
|
|
5156
5149
|
}, [handleResizeMove]);
|
|
5157
|
-
const handleResizeStart =
|
|
5150
|
+
const handleResizeStart = React82.useCallback(
|
|
5158
5151
|
(e) => {
|
|
5159
5152
|
e.preventDefault();
|
|
5160
5153
|
e.stopPropagation();
|
|
@@ -5163,13 +5156,13 @@ var ResizeHandleComponent = ({ onResize, containerRef, onHeightChange }) => {
|
|
|
5163
5156
|
},
|
|
5164
5157
|
[handleResizeMove, handleResizeEnd]
|
|
5165
5158
|
);
|
|
5166
|
-
|
|
5159
|
+
React82.useEffect(() => {
|
|
5167
5160
|
return () => {
|
|
5168
5161
|
document.removeEventListener("mousemove", handleResizeMove);
|
|
5169
5162
|
document.removeEventListener("mouseup", handleResizeEnd);
|
|
5170
5163
|
};
|
|
5171
5164
|
}, [handleResizeMove, handleResizeEnd]);
|
|
5172
|
-
return /* @__PURE__ */
|
|
5165
|
+
return /* @__PURE__ */ React82.createElement(
|
|
5173
5166
|
ResizeHandle,
|
|
5174
5167
|
{
|
|
5175
5168
|
onMouseDown: handleResizeStart,
|
|
@@ -5252,22 +5245,22 @@ var createEditorDidMountHandler = (editorRef, monacoRef, debounceTimer, onChange
|
|
|
5252
5245
|
};
|
|
5253
5246
|
};
|
|
5254
5247
|
var CssEditor = ({ value, onChange }) => {
|
|
5255
|
-
const theme = (0,
|
|
5256
|
-
const containerRef =
|
|
5257
|
-
const editorRef =
|
|
5258
|
-
const monacoRef =
|
|
5259
|
-
const debounceTimer =
|
|
5248
|
+
const theme = (0, import_ui73.useTheme)();
|
|
5249
|
+
const containerRef = React83.useRef(null);
|
|
5250
|
+
const editorRef = React83.useRef(null);
|
|
5251
|
+
const monacoRef = React83.useRef(null);
|
|
5252
|
+
const debounceTimer = React83.useRef(null);
|
|
5260
5253
|
const activeBreakpoint = (0, import_editor_responsive2.useActiveBreakpoint)();
|
|
5261
|
-
const handleResize =
|
|
5254
|
+
const handleResize = React83.useCallback(() => {
|
|
5262
5255
|
editorRef.current?.layout();
|
|
5263
5256
|
}, []);
|
|
5264
|
-
const handleHeightChange =
|
|
5257
|
+
const handleHeightChange = React83.useCallback((height) => {
|
|
5265
5258
|
if (containerRef.current) {
|
|
5266
5259
|
containerRef.current.style.height = `${height}px`;
|
|
5267
5260
|
}
|
|
5268
5261
|
}, []);
|
|
5269
5262
|
const handleEditorDidMount = createEditorDidMountHandler(editorRef, monacoRef, debounceTimer, onChange);
|
|
5270
|
-
|
|
5263
|
+
React83.useEffect(() => {
|
|
5271
5264
|
const timerRef = debounceTimer;
|
|
5272
5265
|
return () => {
|
|
5273
5266
|
const timer = timerRef.current;
|
|
@@ -5276,8 +5269,8 @@ var CssEditor = ({ value, onChange }) => {
|
|
|
5276
5269
|
}
|
|
5277
5270
|
};
|
|
5278
5271
|
}, []);
|
|
5279
|
-
return /* @__PURE__ */
|
|
5280
|
-
|
|
5272
|
+
return /* @__PURE__ */ React83.createElement(EditorWrapper, { ref: containerRef }, /* @__PURE__ */ React83.createElement(
|
|
5273
|
+
import_react44.Editor,
|
|
5281
5274
|
{
|
|
5282
5275
|
key: activeBreakpoint,
|
|
5283
5276
|
height: "100%",
|
|
@@ -5297,7 +5290,7 @@ var CssEditor = ({ value, onChange }) => {
|
|
|
5297
5290
|
fixedOverflowWidgets: true
|
|
5298
5291
|
}
|
|
5299
5292
|
}
|
|
5300
|
-
), /* @__PURE__ */
|
|
5293
|
+
), /* @__PURE__ */ React83.createElement(
|
|
5301
5294
|
ResizeHandleComponent,
|
|
5302
5295
|
{
|
|
5303
5296
|
onResize: handleResize,
|
|
@@ -5344,7 +5337,6 @@ var CssEditor = ({ value, onChange }) => {
|
|
|
5344
5337
|
ToggleControl,
|
|
5345
5338
|
TransformRepeaterControl,
|
|
5346
5339
|
TransitionRepeaterControl,
|
|
5347
|
-
UnstableTransformRepeaterControl,
|
|
5348
5340
|
UrlControl,
|
|
5349
5341
|
createControlReplacementsRegistry,
|
|
5350
5342
|
enqueueFont,
|