@elementor/editor-controls 0.15.0 → 0.16.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 +12 -0
- package/dist/index.js +197 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/controls/background-control/background-gradient-color-control.tsx +101 -0
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +43 -5
- package/src/controls/background-control/background-overlay/use-background-tabs-history.ts +29 -2
- package/src/controls/font-family-control/font-family-control.tsx +28 -12
package/dist/index.mjs
CHANGED
|
@@ -1277,7 +1277,7 @@ var Control3 = ({
|
|
|
1277
1277
|
import * as React28 from "react";
|
|
1278
1278
|
import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
|
|
1279
1279
|
import { stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-props";
|
|
1280
|
-
import { ChevronDownIcon,
|
|
1280
|
+
import { ChevronDownIcon, SearchIcon, TextIcon, XIcon as XIcon2 } from "@elementor/icons";
|
|
1281
1281
|
import {
|
|
1282
1282
|
bindPopover as bindPopover3,
|
|
1283
1283
|
bindTrigger as bindTrigger3,
|
|
@@ -1356,7 +1356,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1356
1356
|
...bindPopover3(popoverState),
|
|
1357
1357
|
onClose: handleClose
|
|
1358
1358
|
},
|
|
1359
|
-
/* @__PURE__ */ React28.createElement(Stack8, null, /* @__PURE__ */ React28.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React28.createElement(
|
|
1359
|
+
/* @__PURE__ */ React28.createElement(Stack8, null, /* @__PURE__ */ React28.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React28.createElement(TextIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React28.createElement(Typography4, { variant: "subtitle2" }, __8("Font Family", "elementor")), /* @__PURE__ */ React28.createElement(IconButton2, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React28.createElement(XIcon2, { fontSize: SIZE2 }))), /* @__PURE__ */ React28.createElement(Box2, { px: 1.5, pb: 1 }, /* @__PURE__ */ React28.createElement(
|
|
1360
1360
|
TextField5,
|
|
1361
1361
|
{
|
|
1362
1362
|
fullWidth: true,
|
|
@@ -1376,7 +1376,27 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1376
1376
|
handleClose,
|
|
1377
1377
|
fontFamily
|
|
1378
1378
|
}
|
|
1379
|
-
) : /* @__PURE__ */ React28.createElement(Box2, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React28.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React28.createElement(
|
|
1379
|
+
) : /* @__PURE__ */ React28.createElement(Box2, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React28.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5, overflow: "hidden" }, /* @__PURE__ */ React28.createElement(TextIcon, { fontSize: "large" }), /* @__PURE__ */ React28.createElement(Box2, { sx: { maxWidth: 160, overflow: "hidden" } }, /* @__PURE__ */ React28.createElement(Typography4, { align: "center", variant: "subtitle2", color: "text.secondary" }, __8("Sorry, nothing matched", "elementor")), /* @__PURE__ */ React28.createElement(
|
|
1380
|
+
Typography4,
|
|
1381
|
+
{
|
|
1382
|
+
variant: "subtitle2",
|
|
1383
|
+
color: "text.secondary",
|
|
1384
|
+
sx: {
|
|
1385
|
+
display: "flex",
|
|
1386
|
+
width: "100%",
|
|
1387
|
+
justifyContent: "center"
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
/* @__PURE__ */ React28.createElement("span", null, "\u201C"),
|
|
1391
|
+
/* @__PURE__ */ React28.createElement(
|
|
1392
|
+
"span",
|
|
1393
|
+
{
|
|
1394
|
+
style: { maxWidth: "80%", overflow: "hidden", textOverflow: "ellipsis" }
|
|
1395
|
+
},
|
|
1396
|
+
searchValue
|
|
1397
|
+
),
|
|
1398
|
+
/* @__PURE__ */ React28.createElement("span", null, "\u201D.")
|
|
1399
|
+
)), /* @__PURE__ */ React28.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, __8("Try something else.", "elementor"), /* @__PURE__ */ React28.createElement(
|
|
1380
1400
|
Link,
|
|
1381
1401
|
{
|
|
1382
1402
|
color: "secondary",
|
|
@@ -1384,8 +1404,8 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1384
1404
|
component: "button",
|
|
1385
1405
|
onClick: () => setSearchValue("")
|
|
1386
1406
|
},
|
|
1387
|
-
__8("Clear
|
|
1388
|
-
)
|
|
1407
|
+
__8("Clear & try again", "elementor")
|
|
1408
|
+
)))))
|
|
1389
1409
|
));
|
|
1390
1410
|
});
|
|
1391
1411
|
var LIST_ITEM_HEIGHT = 36;
|
|
@@ -1939,13 +1959,13 @@ var SvgMediaControl = createControl(() => {
|
|
|
1939
1959
|
});
|
|
1940
1960
|
|
|
1941
1961
|
// src/controls/background-control/background-control.tsx
|
|
1942
|
-
import * as
|
|
1962
|
+
import * as React40 from "react";
|
|
1943
1963
|
import { backgroundPropTypeUtil } from "@elementor/editor-props";
|
|
1944
1964
|
import { Grid as Grid14 } from "@elementor/ui";
|
|
1945
1965
|
import { __ as __17 } from "@wordpress/i18n";
|
|
1946
1966
|
|
|
1947
1967
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
1948
|
-
import * as
|
|
1968
|
+
import * as React39 from "react";
|
|
1949
1969
|
import {
|
|
1950
1970
|
backgroundColorOverlayPropTypeUtil as backgroundColorOverlayPropTypeUtil2,
|
|
1951
1971
|
backgroundImageOverlayPropTypeUtil as backgroundImageOverlayPropTypeUtil2,
|
|
@@ -1959,8 +1979,80 @@ import { __ as __16 } from "@wordpress/i18n";
|
|
|
1959
1979
|
import { parseEnv } from "@elementor/env";
|
|
1960
1980
|
var { env } = parseEnv("@elementor/editor-controls");
|
|
1961
1981
|
|
|
1962
|
-
// src/controls/background-control/background-
|
|
1982
|
+
// src/controls/background-control/background-gradient-color-control.tsx
|
|
1963
1983
|
import * as React34 from "react";
|
|
1984
|
+
import {
|
|
1985
|
+
backgroundGradientOverlayPropTypeUtil,
|
|
1986
|
+
colorPropTypeUtil as colorPropTypeUtil2,
|
|
1987
|
+
colorStopPropTypeUtil,
|
|
1988
|
+
gradientColorStopPropTypeUtil,
|
|
1989
|
+
numberPropTypeUtil as numberPropTypeUtil3,
|
|
1990
|
+
stringPropTypeUtil as stringPropTypeUtil8
|
|
1991
|
+
} from "@elementor/editor-props";
|
|
1992
|
+
import { UnstableGradientBox } from "@elementor/ui";
|
|
1993
|
+
var BackgroundGradientColorControl = createControl(() => {
|
|
1994
|
+
const { value, setValue } = useBoundProp(backgroundGradientOverlayPropTypeUtil);
|
|
1995
|
+
const handleChange = (newValue) => {
|
|
1996
|
+
const transformedValue = createTransformableValue(newValue);
|
|
1997
|
+
if (transformedValue.positions) {
|
|
1998
|
+
transformedValue.positions = stringPropTypeUtil8.create(newValue.positions.join(" "));
|
|
1999
|
+
}
|
|
2000
|
+
setValue(transformedValue);
|
|
2001
|
+
};
|
|
2002
|
+
const createTransformableValue = (newValue) => ({
|
|
2003
|
+
...newValue,
|
|
2004
|
+
type: stringPropTypeUtil8.create(newValue.type),
|
|
2005
|
+
angle: numberPropTypeUtil3.create(newValue.angle),
|
|
2006
|
+
stops: gradientColorStopPropTypeUtil.create(
|
|
2007
|
+
newValue.stops.map(
|
|
2008
|
+
({ color, offset }) => colorStopPropTypeUtil.create({
|
|
2009
|
+
color: colorPropTypeUtil2.create(color),
|
|
2010
|
+
offset: numberPropTypeUtil3.create(offset)
|
|
2011
|
+
})
|
|
2012
|
+
)
|
|
2013
|
+
)
|
|
2014
|
+
});
|
|
2015
|
+
const normalizeValue = () => {
|
|
2016
|
+
if (!value) {
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
const { type, angle, stops, positions } = value;
|
|
2020
|
+
return {
|
|
2021
|
+
type: type.value,
|
|
2022
|
+
angle: angle.value,
|
|
2023
|
+
stops: stops.value.map(({ value: { color, offset } }) => ({
|
|
2024
|
+
color: color.value,
|
|
2025
|
+
offset: offset.value
|
|
2026
|
+
})),
|
|
2027
|
+
positions: positions?.value.split(" ")
|
|
2028
|
+
};
|
|
2029
|
+
};
|
|
2030
|
+
return /* @__PURE__ */ React34.createElement(ControlActions, null, /* @__PURE__ */ React34.createElement(
|
|
2031
|
+
UnstableGradientBox,
|
|
2032
|
+
{
|
|
2033
|
+
sx: { width: "auto", padding: 1.5 },
|
|
2034
|
+
value: normalizeValue(),
|
|
2035
|
+
onChange: handleChange
|
|
2036
|
+
}
|
|
2037
|
+
));
|
|
2038
|
+
});
|
|
2039
|
+
var initialBackgroundGradientOverlay = backgroundGradientOverlayPropTypeUtil.create({
|
|
2040
|
+
type: stringPropTypeUtil8.create("linear"),
|
|
2041
|
+
angle: numberPropTypeUtil3.create(180),
|
|
2042
|
+
stops: gradientColorStopPropTypeUtil.create([
|
|
2043
|
+
colorStopPropTypeUtil.create({
|
|
2044
|
+
color: stringPropTypeUtil8.create("var(--primary-color)"),
|
|
2045
|
+
offset: numberPropTypeUtil3.create(0)
|
|
2046
|
+
}),
|
|
2047
|
+
colorStopPropTypeUtil.create({
|
|
2048
|
+
color: colorPropTypeUtil2.create("rgb(255,255,255)"),
|
|
2049
|
+
offset: numberPropTypeUtil3.create(100)
|
|
2050
|
+
})
|
|
2051
|
+
])
|
|
2052
|
+
});
|
|
2053
|
+
|
|
2054
|
+
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx
|
|
2055
|
+
import * as React35 from "react";
|
|
1964
2056
|
import { PinIcon, PinnedOffIcon } from "@elementor/icons";
|
|
1965
2057
|
import { Grid as Grid9 } from "@elementor/ui";
|
|
1966
2058
|
import { __ as __12 } from "@wordpress/i18n";
|
|
@@ -1968,23 +2060,23 @@ var attachmentControlOptions = [
|
|
|
1968
2060
|
{
|
|
1969
2061
|
value: "fixed",
|
|
1970
2062
|
label: __12("Fixed", "elementor"),
|
|
1971
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2063
|
+
renderContent: ({ size }) => /* @__PURE__ */ React35.createElement(PinIcon, { fontSize: size }),
|
|
1972
2064
|
showTooltip: true
|
|
1973
2065
|
},
|
|
1974
2066
|
{
|
|
1975
2067
|
value: "scroll",
|
|
1976
2068
|
label: __12("Scroll", "elementor"),
|
|
1977
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2069
|
+
renderContent: ({ size }) => /* @__PURE__ */ React35.createElement(PinnedOffIcon, { fontSize: size }),
|
|
1978
2070
|
showTooltip: true
|
|
1979
2071
|
}
|
|
1980
2072
|
];
|
|
1981
2073
|
var BackgroundImageOverlayAttachment = () => {
|
|
1982
|
-
return /* @__PURE__ */
|
|
2074
|
+
return /* @__PURE__ */ React35.createElement(PopoverGridContainer, null, /* @__PURE__ */ React35.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __12("Attachment", "elementor"))), /* @__PURE__ */ React35.createElement(Grid9, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React35.createElement(ToggleControl, { options: attachmentControlOptions })));
|
|
1983
2075
|
};
|
|
1984
2076
|
|
|
1985
2077
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
1986
|
-
import * as
|
|
1987
|
-
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as
|
|
2078
|
+
import * as React36 from "react";
|
|
2079
|
+
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil9 } from "@elementor/editor-props";
|
|
1988
2080
|
import { LetterXIcon, LetterYIcon } from "@elementor/icons";
|
|
1989
2081
|
import { Grid as Grid10, MenuItem as MenuItem3, Select as Select2 } from "@elementor/ui";
|
|
1990
2082
|
import { __ as __13 } from "@wordpress/i18n";
|
|
@@ -2002,7 +2094,7 @@ var backgroundPositionOptions = [
|
|
|
2002
2094
|
];
|
|
2003
2095
|
var BackgroundImageOverlayPosition = () => {
|
|
2004
2096
|
const backgroundImageOffsetContext = useBoundProp(backgroundImagePositionOffsetPropTypeUtil);
|
|
2005
|
-
const stringPropContext = useBoundProp(
|
|
2097
|
+
const stringPropContext = useBoundProp(stringPropTypeUtil9);
|
|
2006
2098
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
2007
2099
|
const handlePositionChange = (event) => {
|
|
2008
2100
|
const value = event.target.value || null;
|
|
@@ -2012,7 +2104,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2012
2104
|
stringPropContext.setValue(value);
|
|
2013
2105
|
}
|
|
2014
2106
|
};
|
|
2015
|
-
return /* @__PURE__ */
|
|
2107
|
+
return /* @__PURE__ */ React36.createElement(Grid10, { container: true, spacing: 1.5 }, /* @__PURE__ */ React36.createElement(Grid10, { item: true, xs: 12 }, /* @__PURE__ */ React36.createElement(PopoverGridContainer, null, /* @__PURE__ */ React36.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React36.createElement(ControlLabel, null, __13("Position", "elementor"))), /* @__PURE__ */ React36.createElement(Grid10, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React36.createElement(
|
|
2016
2108
|
Select2,
|
|
2017
2109
|
{
|
|
2018
2110
|
size: "tiny",
|
|
@@ -2020,12 +2112,12 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2020
2112
|
onChange: handlePositionChange,
|
|
2021
2113
|
fullWidth: true
|
|
2022
2114
|
},
|
|
2023
|
-
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */
|
|
2024
|
-
)))), isCustom ? /* @__PURE__ */
|
|
2115
|
+
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React36.createElement(MenuItem3, { key: value, value: value ?? "" }, label))
|
|
2116
|
+
)))), isCustom ? /* @__PURE__ */ React36.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React36.createElement(Grid10, { item: true, xs: 12 }, /* @__PURE__ */ React36.createElement(Grid10, { container: true, spacing: 1.5 }, /* @__PURE__ */ React36.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React36.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React36.createElement(SizeControl, { startIcon: /* @__PURE__ */ React36.createElement(LetterXIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React36.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React36.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ React36.createElement(SizeControl, { startIcon: /* @__PURE__ */ React36.createElement(LetterYIcon, { fontSize: "tiny" }) })))))) : null);
|
|
2025
2117
|
};
|
|
2026
2118
|
|
|
2027
2119
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx
|
|
2028
|
-
import * as
|
|
2120
|
+
import * as React37 from "react";
|
|
2029
2121
|
import { DotsHorizontalIcon, DotsVerticalIcon, GridDotsIcon, XIcon as XIcon4 } from "@elementor/icons";
|
|
2030
2122
|
import { Grid as Grid11 } from "@elementor/ui";
|
|
2031
2123
|
import { __ as __14 } from "@wordpress/i18n";
|
|
@@ -2033,35 +2125,35 @@ var repeatControlOptions = [
|
|
|
2033
2125
|
{
|
|
2034
2126
|
value: "repeat",
|
|
2035
2127
|
label: __14("Repeat", "elementor"),
|
|
2036
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2128
|
+
renderContent: ({ size }) => /* @__PURE__ */ React37.createElement(GridDotsIcon, { fontSize: size }),
|
|
2037
2129
|
showTooltip: true
|
|
2038
2130
|
},
|
|
2039
2131
|
{
|
|
2040
2132
|
value: "repeat-x",
|
|
2041
2133
|
label: __14("Repeat-x", "elementor"),
|
|
2042
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2134
|
+
renderContent: ({ size }) => /* @__PURE__ */ React37.createElement(DotsHorizontalIcon, { fontSize: size }),
|
|
2043
2135
|
showTooltip: true
|
|
2044
2136
|
},
|
|
2045
2137
|
{
|
|
2046
2138
|
value: "repeat-y",
|
|
2047
2139
|
label: __14("Repeat-y", "elementor"),
|
|
2048
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2140
|
+
renderContent: ({ size }) => /* @__PURE__ */ React37.createElement(DotsVerticalIcon, { fontSize: size }),
|
|
2049
2141
|
showTooltip: true
|
|
2050
2142
|
},
|
|
2051
2143
|
{
|
|
2052
2144
|
value: "no-repeat",
|
|
2053
2145
|
label: __14("No-repeat", "elementor"),
|
|
2054
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2146
|
+
renderContent: ({ size }) => /* @__PURE__ */ React37.createElement(XIcon4, { fontSize: size }),
|
|
2055
2147
|
showTooltip: true
|
|
2056
2148
|
}
|
|
2057
2149
|
];
|
|
2058
2150
|
var BackgroundImageOverlayRepeat = () => {
|
|
2059
|
-
return /* @__PURE__ */
|
|
2151
|
+
return /* @__PURE__ */ React37.createElement(PopoverGridContainer, null, /* @__PURE__ */ React37.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(ControlLabel, null, __14("Repeat", "elementor"))), /* @__PURE__ */ React37.createElement(Grid11, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React37.createElement(ToggleControl, { options: repeatControlOptions })));
|
|
2060
2152
|
};
|
|
2061
2153
|
|
|
2062
2154
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
2063
|
-
import * as
|
|
2064
|
-
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as
|
|
2155
|
+
import * as React38 from "react";
|
|
2156
|
+
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil10 } from "@elementor/editor-props";
|
|
2065
2157
|
import {
|
|
2066
2158
|
ArrowBarBothIcon,
|
|
2067
2159
|
ArrowsMaximizeIcon,
|
|
@@ -2076,31 +2168,31 @@ var sizeControlOptions = [
|
|
|
2076
2168
|
{
|
|
2077
2169
|
value: "auto",
|
|
2078
2170
|
label: __15("Auto", "elementor"),
|
|
2079
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2171
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(LetterAIcon, { fontSize: size }),
|
|
2080
2172
|
showTooltip: true
|
|
2081
2173
|
},
|
|
2082
2174
|
{
|
|
2083
2175
|
value: "cover",
|
|
2084
2176
|
label: __15("Cover", "elementor"),
|
|
2085
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2177
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(ArrowsMaximizeIcon, { fontSize: size }),
|
|
2086
2178
|
showTooltip: true
|
|
2087
2179
|
},
|
|
2088
2180
|
{
|
|
2089
2181
|
value: "contain",
|
|
2090
2182
|
label: __15("Contain", "elementor"),
|
|
2091
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2183
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(ArrowBarBothIcon, { fontSize: size }),
|
|
2092
2184
|
showTooltip: true
|
|
2093
2185
|
},
|
|
2094
2186
|
{
|
|
2095
2187
|
value: "custom",
|
|
2096
2188
|
label: __15("Custom", "elementor"),
|
|
2097
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2189
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(PencilIcon, { fontSize: size }),
|
|
2098
2190
|
showTooltip: true
|
|
2099
2191
|
}
|
|
2100
2192
|
];
|
|
2101
2193
|
var BackgroundImageOverlaySize = () => {
|
|
2102
2194
|
const backgroundImageScaleContext = useBoundProp(backgroundImageSizeScalePropTypeUtil);
|
|
2103
|
-
const stringPropContext = useBoundProp(
|
|
2195
|
+
const stringPropContext = useBoundProp(stringPropTypeUtil10);
|
|
2104
2196
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
2105
2197
|
const handleSizeChange = (size) => {
|
|
2106
2198
|
if (size === "custom") {
|
|
@@ -2109,7 +2201,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2109
2201
|
stringPropContext.setValue(size);
|
|
2110
2202
|
}
|
|
2111
2203
|
};
|
|
2112
|
-
return /* @__PURE__ */
|
|
2204
|
+
return /* @__PURE__ */ React38.createElement(Grid12, { container: true, spacing: 1.5 }, /* @__PURE__ */ React38.createElement(Grid12, { item: true, xs: 12 }, /* @__PURE__ */ React38.createElement(PopoverGridContainer, null, /* @__PURE__ */ React38.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(ControlLabel, null, __15("Size", "elementor"))), /* @__PURE__ */ React38.createElement(Grid12, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React38.createElement(
|
|
2113
2205
|
ControlToggleButtonGroup,
|
|
2114
2206
|
{
|
|
2115
2207
|
exclusive: true,
|
|
@@ -2117,16 +2209,16 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2117
2209
|
value: backgroundImageScaleContext.value ? "custom" : stringPropContext.value,
|
|
2118
2210
|
onChange: handleSizeChange
|
|
2119
2211
|
}
|
|
2120
|
-
)))), isCustom ? /* @__PURE__ */
|
|
2212
|
+
)))), isCustom ? /* @__PURE__ */ React38.createElement(PropProvider, { ...backgroundImageScaleContext }, /* @__PURE__ */ React38.createElement(Grid12, { item: true, xs: 12 }, /* @__PURE__ */ React38.createElement(PopoverGridContainer, null, /* @__PURE__ */ React38.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(PropKeyProvider, { bind: "width" }, /* @__PURE__ */ React38.createElement(
|
|
2121
2213
|
SizeControl,
|
|
2122
2214
|
{
|
|
2123
|
-
startIcon: /* @__PURE__ */
|
|
2215
|
+
startIcon: /* @__PURE__ */ React38.createElement(ArrowsMoveHorizontalIcon, { fontSize: "tiny" }),
|
|
2124
2216
|
extendedValues: ["auto"]
|
|
2125
2217
|
}
|
|
2126
|
-
))), /* @__PURE__ */
|
|
2218
|
+
))), /* @__PURE__ */ React38.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(PropKeyProvider, { bind: "height" }, /* @__PURE__ */ React38.createElement(
|
|
2127
2219
|
SizeControl,
|
|
2128
2220
|
{
|
|
2129
|
-
startIcon: /* @__PURE__ */
|
|
2221
|
+
startIcon: /* @__PURE__ */ React38.createElement(ArrowsMoveVerticalIcon, { fontSize: "tiny" }),
|
|
2130
2222
|
extendedValues: ["auto"]
|
|
2131
2223
|
}
|
|
2132
2224
|
)))))) : null);
|
|
@@ -2136,19 +2228,32 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2136
2228
|
import { useRef as useRef4 } from "react";
|
|
2137
2229
|
import {
|
|
2138
2230
|
backgroundColorOverlayPropTypeUtil,
|
|
2231
|
+
backgroundGradientOverlayPropTypeUtil as backgroundGradientOverlayPropTypeUtil2,
|
|
2139
2232
|
backgroundImageOverlayPropTypeUtil
|
|
2140
2233
|
} from "@elementor/editor-props";
|
|
2141
2234
|
import { useTabs } from "@elementor/ui";
|
|
2142
2235
|
var useBackgroundTabsHistory = ({
|
|
2143
2236
|
color: initialBackgroundColorOverlay2,
|
|
2144
|
-
image: initialBackgroundImageOverlay
|
|
2237
|
+
image: initialBackgroundImageOverlay,
|
|
2238
|
+
gradient: initialBackgroundGradientOverlay2
|
|
2145
2239
|
}) => {
|
|
2146
2240
|
const { value: imageValue, setValue: setImageValue } = useBoundProp(backgroundImageOverlayPropTypeUtil);
|
|
2147
2241
|
const { value: colorValue, setValue: setColorValue } = useBoundProp(backgroundColorOverlayPropTypeUtil);
|
|
2148
|
-
const {
|
|
2242
|
+
const { value: gradientValue, setValue: setGradientValue } = useBoundProp(backgroundGradientOverlayPropTypeUtil2);
|
|
2243
|
+
const getCurrentOverlayType = () => {
|
|
2244
|
+
if (colorValue) {
|
|
2245
|
+
return "color";
|
|
2246
|
+
}
|
|
2247
|
+
if (gradientValue) {
|
|
2248
|
+
return "gradient";
|
|
2249
|
+
}
|
|
2250
|
+
return "image";
|
|
2251
|
+
};
|
|
2252
|
+
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs(getCurrentOverlayType());
|
|
2149
2253
|
const valuesHistory = useRef4({
|
|
2150
2254
|
image: initialBackgroundImageOverlay,
|
|
2151
|
-
color: initialBackgroundColorOverlay2
|
|
2255
|
+
color: initialBackgroundColorOverlay2,
|
|
2256
|
+
gradient: initialBackgroundGradientOverlay2
|
|
2152
2257
|
});
|
|
2153
2258
|
const saveToHistory = (key, value) => {
|
|
2154
2259
|
if (value) {
|
|
@@ -2160,10 +2265,17 @@ var useBackgroundTabsHistory = ({
|
|
|
2160
2265
|
case "image":
|
|
2161
2266
|
setImageValue(valuesHistory.current.image);
|
|
2162
2267
|
saveToHistory("color", colorValue);
|
|
2268
|
+
saveToHistory("gradient", gradientValue);
|
|
2269
|
+
break;
|
|
2270
|
+
case "gradient":
|
|
2271
|
+
setGradientValue(valuesHistory.current.gradient);
|
|
2272
|
+
saveToHistory("color", colorValue);
|
|
2273
|
+
saveToHistory("image", imageValue);
|
|
2163
2274
|
break;
|
|
2164
2275
|
case "color":
|
|
2165
2276
|
setColorValue(valuesHistory.current.color);
|
|
2166
2277
|
saveToHistory("image", imageValue);
|
|
2278
|
+
saveToHistory("gradient", gradientValue);
|
|
2167
2279
|
}
|
|
2168
2280
|
return getTabsProps().onChange(e, tabName);
|
|
2169
2281
|
};
|
|
@@ -2211,7 +2323,7 @@ var backgroundResolutionOptions = [
|
|
|
2211
2323
|
];
|
|
2212
2324
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
2213
2325
|
const { propType, value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
|
|
2214
|
-
return /* @__PURE__ */
|
|
2326
|
+
return /* @__PURE__ */ React39.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React39.createElement(
|
|
2215
2327
|
Repeater,
|
|
2216
2328
|
{
|
|
2217
2329
|
values: overlayValues ?? [],
|
|
@@ -2227,58 +2339,73 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
2227
2339
|
));
|
|
2228
2340
|
});
|
|
2229
2341
|
var ItemContent2 = ({ bind }) => {
|
|
2230
|
-
return /* @__PURE__ */
|
|
2342
|
+
return /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React39.createElement(Content2, null));
|
|
2231
2343
|
};
|
|
2232
2344
|
var Content2 = () => {
|
|
2233
2345
|
const { getTabsProps, getTabProps, getTabPanelProps } = useBackgroundTabsHistory({
|
|
2234
2346
|
image: getInitialBackgroundOverlay().value,
|
|
2235
|
-
color: initialBackgroundColorOverlay.value
|
|
2347
|
+
color: initialBackgroundColorOverlay.value,
|
|
2348
|
+
gradient: initialBackgroundGradientOverlay.value
|
|
2236
2349
|
});
|
|
2237
|
-
return /* @__PURE__ */
|
|
2350
|
+
return /* @__PURE__ */ React39.createElement(Box4, { sx: { width: "100%" } }, /* @__PURE__ */ React39.createElement(Box4, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React39.createElement(Tabs, { ...getTabsProps(), "aria-label": __16("Background Overlay", "elementor") }, /* @__PURE__ */ React39.createElement(Tab, { label: __16("Image", "elementor"), ...getTabProps("image") }), /* @__PURE__ */ React39.createElement(Tab, { label: __16("Gradient", "elementor"), ...getTabProps("gradient") }), /* @__PURE__ */ React39.createElement(Tab, { label: __16("Color", "elementor"), ...getTabProps("color") }))), /* @__PURE__ */ React39.createElement(TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React39.createElement(PopoverContent, null, /* @__PURE__ */ React39.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React39.createElement(TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React39.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React39.createElement(TabPanel, { ...getTabPanelProps("color"), sx: { p: 1.5 } }, /* @__PURE__ */ React39.createElement(ColorControl, { propTypeUtil: backgroundColorOverlayPropTypeUtil2 })));
|
|
2238
2351
|
};
|
|
2239
2352
|
var ItemIcon2 = ({ value }) => {
|
|
2240
2353
|
switch (value.$$type) {
|
|
2241
2354
|
case "background-image-overlay":
|
|
2242
|
-
return /* @__PURE__ */
|
|
2355
|
+
return /* @__PURE__ */ React39.createElement(ItemIconImage, { value });
|
|
2243
2356
|
case "background-color-overlay":
|
|
2244
|
-
return /* @__PURE__ */
|
|
2357
|
+
return /* @__PURE__ */ React39.createElement(ItemIconColor, { value });
|
|
2358
|
+
case "background-gradient-overlay":
|
|
2359
|
+
return /* @__PURE__ */ React39.createElement(ItemIconGradient, { value });
|
|
2245
2360
|
default:
|
|
2246
2361
|
return null;
|
|
2247
2362
|
}
|
|
2248
2363
|
};
|
|
2249
2364
|
var ItemIconColor = ({ value }) => {
|
|
2250
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ React39.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
|
|
2251
2366
|
};
|
|
2252
2367
|
var ItemIconImage = ({ value }) => {
|
|
2253
2368
|
const { imageUrl } = useImage(value);
|
|
2254
|
-
return /* @__PURE__ */
|
|
2369
|
+
return /* @__PURE__ */ React39.createElement(CardMedia3, { image: imageUrl, sx: { height: 13, width: 13, borderRadius: "4px" } });
|
|
2370
|
+
};
|
|
2371
|
+
var ItemIconGradient = ({ value }) => {
|
|
2372
|
+
const gradient = getGradientValue(value);
|
|
2373
|
+
return /* @__PURE__ */ React39.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: gradient });
|
|
2255
2374
|
};
|
|
2256
2375
|
var ItemLabel2 = ({ value }) => {
|
|
2257
2376
|
switch (value.$$type) {
|
|
2258
2377
|
case "background-image-overlay":
|
|
2259
|
-
return /* @__PURE__ */
|
|
2378
|
+
return /* @__PURE__ */ React39.createElement(ItemLabelImage, { value });
|
|
2260
2379
|
case "background-color-overlay":
|
|
2261
|
-
return /* @__PURE__ */
|
|
2380
|
+
return /* @__PURE__ */ React39.createElement(ItemLabelColor, { value });
|
|
2381
|
+
case "background-gradient-overlay":
|
|
2382
|
+
return /* @__PURE__ */ React39.createElement(ItemLabelGradient, { value });
|
|
2262
2383
|
default:
|
|
2263
2384
|
return null;
|
|
2264
2385
|
}
|
|
2265
2386
|
};
|
|
2266
2387
|
var ItemLabelColor = ({ value }) => {
|
|
2267
|
-
return /* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ React39.createElement("span", null, value.value);
|
|
2268
2389
|
};
|
|
2269
2390
|
var ItemLabelImage = ({ value }) => {
|
|
2270
2391
|
const { imageTitle } = useImage(value);
|
|
2271
|
-
return /* @__PURE__ */
|
|
2392
|
+
return /* @__PURE__ */ React39.createElement("span", null, imageTitle);
|
|
2393
|
+
};
|
|
2394
|
+
var ItemLabelGradient = ({ value }) => {
|
|
2395
|
+
if (value.value.type.value === "linear") {
|
|
2396
|
+
return /* @__PURE__ */ React39.createElement("span", null, __16("Linear Gradient", "elementor"));
|
|
2397
|
+
}
|
|
2398
|
+
return /* @__PURE__ */ React39.createElement("span", null, __16("Radial Gradient", "elementor"));
|
|
2272
2399
|
};
|
|
2273
2400
|
var ImageOverlayContent = () => {
|
|
2274
2401
|
const propContext = useBoundProp(backgroundImageOverlayPropTypeUtil2);
|
|
2275
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ React39.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "image" }, /* @__PURE__ */ React39.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React39.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(
|
|
2276
2403
|
ImageControl,
|
|
2277
2404
|
{
|
|
2278
2405
|
resolutionLabel: __16("Resolution", "elementor"),
|
|
2279
2406
|
sizes: backgroundResolutionOptions
|
|
2280
2407
|
}
|
|
2281
|
-
)))), /* @__PURE__ */
|
|
2408
|
+
)))), /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "position" }, /* @__PURE__ */ React39.createElement(BackgroundImageOverlayPosition, null)), /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "repeat" }, /* @__PURE__ */ React39.createElement(BackgroundImageOverlayRepeat, null)), /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React39.createElement(BackgroundImageOverlaySize, null)), /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "attachment" }, /* @__PURE__ */ React39.createElement(BackgroundImageOverlayAttachment, null)));
|
|
2282
2409
|
};
|
|
2283
2410
|
var useImage = (image) => {
|
|
2284
2411
|
let imageTitle, imageUrl = null;
|
|
@@ -2294,11 +2421,19 @@ var useImage = (image) => {
|
|
|
2294
2421
|
}
|
|
2295
2422
|
return { imageTitle, imageUrl };
|
|
2296
2423
|
};
|
|
2424
|
+
var getGradientValue = (value) => {
|
|
2425
|
+
const gradient = value.value;
|
|
2426
|
+
const stops = gradient.stops.value?.map(({ value: { color, offset } }) => `${color.value} ${offset.value ?? 0}%`)?.join(",");
|
|
2427
|
+
if (gradient.type.value === "linear") {
|
|
2428
|
+
return `linear-gradient(${gradient.angle.value}deg, ${stops})`;
|
|
2429
|
+
}
|
|
2430
|
+
return `radial-gradient(circle at ${gradient.positions.value}, ${stops})`;
|
|
2431
|
+
};
|
|
2297
2432
|
|
|
2298
2433
|
// src/controls/background-control/background-control.tsx
|
|
2299
2434
|
var BackgroundControl = createControl(() => {
|
|
2300
2435
|
const propContext = useBoundProp(backgroundPropTypeUtil);
|
|
2301
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ React40.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React40.createElement(SectionContent, null, /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React40.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React40.createElement(Grid14, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React40.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React40.createElement(ControlLabel, null, __17("Color", "elementor"))), /* @__PURE__ */ React40.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React40.createElement(ColorControl, null))))));
|
|
2302
2437
|
});
|
|
2303
2438
|
export {
|
|
2304
2439
|
BackgroundControl,
|