@elementor/editor-editing-panel 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +327 -263
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +309 -259
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/editing-panel.tsx +1 -1
- package/src/components/settings-tab.tsx +6 -17
- package/src/components/style-sections/size-section.tsx +5 -6
- package/src/components/style-sections/typography-section/font-size-control.tsx +16 -0
- package/src/components/style-sections/typography-section/font-weight-control.tsx +24 -0
- package/src/{controls/control-types → components/style-sections/typography-section}/text-style-control.tsx +16 -14
- package/src/components/style-sections/typography-section/typography-section.tsx +20 -0
- package/src/components/style-tab.tsx +1 -1
- package/src/contexts/element-context.tsx +5 -3
- package/src/controls/components/control-container.tsx +18 -0
- package/src/controls/control-replacement.ts +26 -0
- package/src/controls/control-types/image-control.tsx +3 -18
- package/src/controls/control-types/size-control.tsx +4 -2
- package/src/controls/control-types/text-area-control.tsx +1 -1
- package/src/controls/control.tsx +50 -0
- package/src/controls/{get-control-by-type.ts → controls-registry.tsx} +13 -9
- package/src/controls/settings-control.tsx +8 -21
- package/src/hooks/use-dynamic-tags-config.ts +35 -0
- package/src/hooks/use-element-type.ts +5 -0
- package/src/index.ts +3 -0
- package/src/sync/get-atomic-dynamic-tags.ts +14 -0
- package/src/sync/get-elementor-config.ts +7 -0
- package/src/sync/types.ts +15 -1
- package/src/types.ts +14 -0
- package/LICENSE +0 -674
- package/src/components/style-sections/typography-section.tsx +0 -15
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
8
12
|
var __copyProps = (to, from, except, desc) => {
|
|
9
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
14
|
for (let key of __getOwnPropNames(from))
|
|
@@ -21,13 +25,47 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
replaceControl: () => replaceControl,
|
|
34
|
+
useControl: () => useControl
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
|
|
38
|
+
// src/controls/control-replacement.ts
|
|
39
|
+
var controlReplacement;
|
|
40
|
+
var replaceControl = ({ component, condition }) => {
|
|
41
|
+
controlReplacement = { component, condition };
|
|
42
|
+
};
|
|
43
|
+
var getControlReplacement = ({ value }) => {
|
|
44
|
+
let shouldReplace = false;
|
|
45
|
+
try {
|
|
46
|
+
shouldReplace = !!controlReplacement?.condition({ value });
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
return shouldReplace ? controlReplacement?.component : void 0;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/controls/control-context.tsx
|
|
53
|
+
var import_react = require("react");
|
|
54
|
+
var ControlContext = (0, import_react.createContext)(null);
|
|
55
|
+
function useControl(defaultValue) {
|
|
56
|
+
const controlContext = (0, import_react.useContext)(ControlContext);
|
|
57
|
+
if (!controlContext) {
|
|
58
|
+
throw new Error("useControl must be used within a ControlContext");
|
|
59
|
+
}
|
|
60
|
+
return { ...controlContext, value: controlContext.value ?? defaultValue };
|
|
61
|
+
}
|
|
24
62
|
|
|
25
63
|
// src/panel.ts
|
|
26
64
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
27
65
|
|
|
28
66
|
// src/components/editing-panel.tsx
|
|
29
|
-
var
|
|
30
|
-
var
|
|
67
|
+
var React23 = __toESM(require("react"));
|
|
68
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
31
69
|
|
|
32
70
|
// src/hooks/use-selected-elements.ts
|
|
33
71
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
@@ -78,9 +116,13 @@ function useElementType(type) {
|
|
|
78
116
|
if (!elementType?.atomic_controls) {
|
|
79
117
|
return null;
|
|
80
118
|
}
|
|
119
|
+
if (!elementType?.atomic_props_schema) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
81
122
|
return {
|
|
82
123
|
key: type,
|
|
83
124
|
controls: elementType.atomic_controls,
|
|
125
|
+
propsSchema: elementType.atomic_props_schema,
|
|
84
126
|
title: elementType.title
|
|
85
127
|
};
|
|
86
128
|
},
|
|
@@ -93,13 +135,13 @@ var import_editor_panels = require("@elementor/editor-panels");
|
|
|
93
135
|
|
|
94
136
|
// src/contexts/element-context.tsx
|
|
95
137
|
var React = __toESM(require("react"));
|
|
96
|
-
var
|
|
97
|
-
var Context = (0,
|
|
98
|
-
function ElementContext({ children, element }) {
|
|
99
|
-
return /* @__PURE__ */ React.createElement(Context.Provider, { value: { element } }, children);
|
|
138
|
+
var import_react2 = require("react");
|
|
139
|
+
var Context = (0, import_react2.createContext)(null);
|
|
140
|
+
function ElementContext({ children, element, elementType }) {
|
|
141
|
+
return /* @__PURE__ */ React.createElement(Context.Provider, { value: { element, elementType } }, children);
|
|
100
142
|
}
|
|
101
143
|
function useElementContext() {
|
|
102
|
-
const context = (0,
|
|
144
|
+
const context = (0, import_react2.useContext)(Context);
|
|
103
145
|
if (!context) {
|
|
104
146
|
throw new Error("useElementContext must be used within a ElementContextProvider");
|
|
105
147
|
}
|
|
@@ -108,29 +150,15 @@ function useElementContext() {
|
|
|
108
150
|
|
|
109
151
|
// src/components/editing-panel-tabs.tsx
|
|
110
152
|
var import_ui15 = require("@elementor/ui");
|
|
111
|
-
var
|
|
112
|
-
var
|
|
153
|
+
var React22 = __toESM(require("react"));
|
|
154
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
113
155
|
|
|
114
156
|
// src/components/settings-tab.tsx
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
// src/controls/settings-control.tsx
|
|
119
|
-
var React3 = __toESM(require("react"));
|
|
120
|
-
|
|
121
|
-
// src/controls/control-context.tsx
|
|
122
|
-
var import_react2 = require("react");
|
|
123
|
-
var ControlContext = (0, import_react2.createContext)(null);
|
|
124
|
-
function useControl(defaultValue) {
|
|
125
|
-
const controlContext = (0, import_react2.useContext)(ControlContext);
|
|
126
|
-
if (!controlContext) {
|
|
127
|
-
throw new Error("useControl must be used within a ControlContext");
|
|
128
|
-
}
|
|
129
|
-
return { ...controlContext, value: controlContext.value ?? defaultValue };
|
|
130
|
-
}
|
|
157
|
+
var React12 = __toESM(require("react"));
|
|
158
|
+
var import_ui9 = require("@elementor/ui");
|
|
131
159
|
|
|
132
160
|
// src/controls/settings-control.tsx
|
|
133
|
-
var
|
|
161
|
+
var React4 = __toESM(require("react"));
|
|
134
162
|
|
|
135
163
|
// src/hooks/use-widget-settings.ts
|
|
136
164
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
@@ -174,10 +202,28 @@ var ControlLabel = ({ children }) => {
|
|
|
174
202
|
return /* @__PURE__ */ React2.createElement(import_ui.Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
175
203
|
};
|
|
176
204
|
|
|
205
|
+
// src/controls/components/control-container.tsx
|
|
206
|
+
var React3 = __toESM(require("react"));
|
|
207
|
+
var import_ui2 = require("@elementor/ui");
|
|
208
|
+
var StyledStack = (0, import_ui2.styled)(import_ui2.Stack)(({ theme, gap, direction }) => ({
|
|
209
|
+
"> :only-child": {
|
|
210
|
+
width: "100%"
|
|
211
|
+
},
|
|
212
|
+
"&:where( :has( > :nth-child( 2 ):last-child ) ) > :where( * )": {
|
|
213
|
+
width: direction === "column" ? "100%" : `calc( 50% - ${theme.spacing(gap / 2)})`
|
|
214
|
+
},
|
|
215
|
+
"&:where( :has( > :nth-child( 3 ):last-child ) ) > :where( * )": {
|
|
216
|
+
width: direction === "column" ? "100%" : `calc( 33.3333% - ${theme.spacing(gap * 2)} / 3)`
|
|
217
|
+
}
|
|
218
|
+
}));
|
|
219
|
+
var ControlContainer = (props) => /* @__PURE__ */ React3.createElement(StyledStack, { gap: 1, direction: "row", alignItems: "center", justifyContent: "space-between", ...props });
|
|
220
|
+
|
|
177
221
|
// src/controls/settings-control.tsx
|
|
178
222
|
var SettingsControlProvider = ({ bind, children }) => {
|
|
179
|
-
const { element } = useElementContext();
|
|
180
|
-
const
|
|
223
|
+
const { element, elementType } = useElementContext();
|
|
224
|
+
const defaultValue = elementType.propsSchema[bind]?.default;
|
|
225
|
+
const settingsValue = useWidgetSettings({ id: element.id, bind });
|
|
226
|
+
const value = settingsValue ?? defaultValue ?? null;
|
|
181
227
|
const setValue = (newValue) => {
|
|
182
228
|
updateSettings({
|
|
183
229
|
id: element.id,
|
|
@@ -186,97 +232,36 @@ var SettingsControlProvider = ({ bind, children }) => {
|
|
|
186
232
|
}
|
|
187
233
|
});
|
|
188
234
|
};
|
|
189
|
-
return /* @__PURE__ */
|
|
190
|
-
};
|
|
191
|
-
var SettingsControl = ({ children, bind }) => /* @__PURE__ */
|
|
192
|
-
var StyledStack = (0, import_ui2.styled)(import_ui2.Stack)(({ theme }) => {
|
|
193
|
-
const gap = theme.spacing(1);
|
|
194
|
-
return {
|
|
195
|
-
gap,
|
|
196
|
-
"& > *": {
|
|
197
|
-
width: `calc(50% - ${gap} / 2)`
|
|
198
|
-
},
|
|
199
|
-
"& > label": {
|
|
200
|
-
flexShrink: 0
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
});
|
|
235
|
+
return /* @__PURE__ */ React4.createElement(ControlContext.Provider, { value: { setValue, value, bind } }, children);
|
|
236
|
+
};
|
|
237
|
+
var SettingsControl = ({ children, bind }) => /* @__PURE__ */ React4.createElement(SettingsControlProvider, { bind }, /* @__PURE__ */ React4.createElement(ControlContainer, { flexWrap: "wrap" }, children));
|
|
204
238
|
SettingsControl.Label = ControlLabel;
|
|
205
239
|
|
|
206
240
|
// src/components/accordion-section.tsx
|
|
207
|
-
var
|
|
241
|
+
var React5 = __toESM(require("react"));
|
|
208
242
|
var import_react3 = require("react");
|
|
209
243
|
var import_ui3 = require("@elementor/ui");
|
|
210
244
|
var AccordionSection = ({ title, children }) => {
|
|
211
245
|
const uid = (0, import_react3.useId)();
|
|
212
246
|
const labelId = `label-${uid}`;
|
|
213
247
|
const contentId = `content-${uid}`;
|
|
214
|
-
return /* @__PURE__ */
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
// src/controls/control-types/select-control.tsx
|
|
218
|
-
var React5 = __toESM(require("react"));
|
|
219
|
-
var import_ui4 = require("@elementor/ui");
|
|
220
|
-
var SelectControl = ({ options }) => {
|
|
221
|
-
const { value, setValue } = useControl();
|
|
222
|
-
const handleChange = (event) => {
|
|
223
|
-
setValue(event.target.value);
|
|
224
|
-
};
|
|
225
|
-
return /* @__PURE__ */ React5.createElement(import_ui4.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options.map(({ label, ...props }) => /* @__PURE__ */ React5.createElement(import_ui4.MenuItem, { key: props.value, ...props }, label)));
|
|
248
|
+
return /* @__PURE__ */ React5.createElement(import_ui3.Accordion, { disableGutters: true, defaultExpanded: true }, /* @__PURE__ */ React5.createElement(import_ui3.AccordionSummary, { "aria-controls": contentId, id: labelId }, /* @__PURE__ */ React5.createElement(import_ui3.AccordionSummaryText, { primaryTypographyProps: { variant: "caption" } }, title)), /* @__PURE__ */ React5.createElement(import_ui3.AccordionDetails, { id: contentId, "aria-labelledby": labelId }, /* @__PURE__ */ React5.createElement(import_ui3.Stack, { gap: 2.5 }, children)));
|
|
226
249
|
};
|
|
227
250
|
|
|
228
|
-
// src/controls/control
|
|
229
|
-
var
|
|
230
|
-
var
|
|
231
|
-
var TextAreaControl = ({ placeholder }) => {
|
|
232
|
-
const { value, setValue } = useControl("");
|
|
233
|
-
const handleChange = (event) => {
|
|
234
|
-
setValue(event.target.value);
|
|
235
|
-
};
|
|
236
|
-
return /* @__PURE__ */ React6.createElement(
|
|
237
|
-
import_ui5.TextField,
|
|
238
|
-
{
|
|
239
|
-
size: "tiny",
|
|
240
|
-
multiline: true,
|
|
241
|
-
fullWidth: true,
|
|
242
|
-
rows: 5,
|
|
243
|
-
value,
|
|
244
|
-
onChange: handleChange,
|
|
245
|
-
placeholder
|
|
246
|
-
}
|
|
247
|
-
);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
// src/controls/control-types/text-control.tsx
|
|
251
|
-
var React7 = __toESM(require("react"));
|
|
252
|
-
var import_ui6 = require("@elementor/ui");
|
|
253
|
-
var TextControl = ({ placeholder }) => {
|
|
254
|
-
const { value, setValue } = useControl("");
|
|
255
|
-
const handleChange = (event) => setValue(event.target.value);
|
|
256
|
-
return /* @__PURE__ */ React7.createElement(import_ui6.TextField, { type: "text", size: "tiny", value, onChange: handleChange, placeholder });
|
|
257
|
-
};
|
|
251
|
+
// src/controls/control.tsx
|
|
252
|
+
var React11 = __toESM(require("react"));
|
|
253
|
+
var import_utils = require("@elementor/utils");
|
|
258
254
|
|
|
259
255
|
// src/controls/control-types/image-control.tsx
|
|
260
|
-
var
|
|
261
|
-
var
|
|
256
|
+
var React6 = __toESM(require("react"));
|
|
257
|
+
var import_ui4 = require("@elementor/ui");
|
|
262
258
|
var import_icons = require("@elementor/icons");
|
|
263
259
|
var import_i18n = require("@wordpress/i18n");
|
|
264
260
|
var import_wp_media = require("@elementor/wp-media");
|
|
265
|
-
var defaultState = {
|
|
266
|
-
$$type: "image",
|
|
267
|
-
value: {
|
|
268
|
-
url: "/wp-content/plugins/elementor/assets/images/placeholder.png"
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
261
|
var ImageControl = () => {
|
|
272
|
-
const { value, setValue } = useControl(
|
|
262
|
+
const { value, setValue } = useControl();
|
|
273
263
|
const { data: attachment } = (0, import_wp_media.useWpMediaAttachment)(value?.value?.attachmentId);
|
|
274
|
-
const
|
|
275
|
-
if (attachment?.url) {
|
|
276
|
-
return attachment.url;
|
|
277
|
-
}
|
|
278
|
-
return value?.value?.url ?? defaultState.value.url;
|
|
279
|
-
};
|
|
264
|
+
const src = attachment?.url ?? value?.value?.url;
|
|
280
265
|
const { open } = (0, import_wp_media.useWpMediaFrame)({
|
|
281
266
|
types: ["image"],
|
|
282
267
|
multiple: false,
|
|
@@ -290,8 +275,8 @@ var ImageControl = () => {
|
|
|
290
275
|
});
|
|
291
276
|
}
|
|
292
277
|
});
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
|
|
278
|
+
return /* @__PURE__ */ React6.createElement(import_ui4.Card, { variant: "outlined" }, /* @__PURE__ */ React6.createElement(import_ui4.CardMedia, { image: src, sx: { height: 150 } }), /* @__PURE__ */ React6.createElement(import_ui4.CardOverlay, null, /* @__PURE__ */ React6.createElement(
|
|
279
|
+
import_ui4.Button,
|
|
295
280
|
{
|
|
296
281
|
color: "inherit",
|
|
297
282
|
size: "small",
|
|
@@ -301,13 +286,13 @@ var ImageControl = () => {
|
|
|
301
286
|
}
|
|
302
287
|
},
|
|
303
288
|
(0, import_i18n.__)("Select Image", "elementor")
|
|
304
|
-
), /* @__PURE__ */
|
|
305
|
-
|
|
289
|
+
), /* @__PURE__ */ React6.createElement(
|
|
290
|
+
import_ui4.Button,
|
|
306
291
|
{
|
|
307
292
|
color: "inherit",
|
|
308
293
|
size: "small",
|
|
309
294
|
variant: "text",
|
|
310
|
-
startIcon: /* @__PURE__ */
|
|
295
|
+
startIcon: /* @__PURE__ */ React6.createElement(import_icons.UploadIcon, null),
|
|
311
296
|
onClick: () => {
|
|
312
297
|
open({ mode: "upload" });
|
|
313
298
|
}
|
|
@@ -316,32 +301,180 @@ var ImageControl = () => {
|
|
|
316
301
|
)));
|
|
317
302
|
};
|
|
318
303
|
|
|
319
|
-
// src/controls/
|
|
304
|
+
// src/controls/control-types/text-control.tsx
|
|
305
|
+
var React7 = __toESM(require("react"));
|
|
306
|
+
var import_ui5 = require("@elementor/ui");
|
|
307
|
+
var TextControl = ({ placeholder }) => {
|
|
308
|
+
const { value, setValue } = useControl("");
|
|
309
|
+
const handleChange = (event) => setValue(event.target.value);
|
|
310
|
+
return /* @__PURE__ */ React7.createElement(import_ui5.TextField, { type: "text", size: "tiny", value, onChange: handleChange, placeholder });
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// src/controls/control-types/text-area-control.tsx
|
|
314
|
+
var React8 = __toESM(require("react"));
|
|
315
|
+
var import_ui6 = require("@elementor/ui");
|
|
316
|
+
var TextAreaControl = ({ placeholder }) => {
|
|
317
|
+
const { value, setValue } = useControl();
|
|
318
|
+
const handleChange = (event) => {
|
|
319
|
+
setValue(event.target.value);
|
|
320
|
+
};
|
|
321
|
+
return /* @__PURE__ */ React8.createElement(
|
|
322
|
+
import_ui6.TextField,
|
|
323
|
+
{
|
|
324
|
+
size: "tiny",
|
|
325
|
+
multiline: true,
|
|
326
|
+
fullWidth: true,
|
|
327
|
+
rows: 5,
|
|
328
|
+
value,
|
|
329
|
+
onChange: handleChange,
|
|
330
|
+
placeholder
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// src/controls/control-types/size-control.tsx
|
|
336
|
+
var React9 = __toESM(require("react"));
|
|
337
|
+
var import_ui7 = require("@elementor/ui");
|
|
338
|
+
|
|
339
|
+
// src/controls/hooks/use-sync-external-state.tsx
|
|
340
|
+
var import_react4 = require("react");
|
|
341
|
+
var useSyncExternalState = ({
|
|
342
|
+
external,
|
|
343
|
+
setExternal,
|
|
344
|
+
persistWhen,
|
|
345
|
+
fallback
|
|
346
|
+
}) => {
|
|
347
|
+
function toExternal(internalValue) {
|
|
348
|
+
if (persistWhen(internalValue)) {
|
|
349
|
+
return internalValue;
|
|
350
|
+
}
|
|
351
|
+
return void 0;
|
|
352
|
+
}
|
|
353
|
+
function toInternal(externalValue, internalValue) {
|
|
354
|
+
if (!externalValue) {
|
|
355
|
+
return fallback(internalValue);
|
|
356
|
+
}
|
|
357
|
+
return externalValue;
|
|
358
|
+
}
|
|
359
|
+
const [internal, setInternal] = (0, import_react4.useState)(toInternal(external, void 0));
|
|
360
|
+
(0, import_react4.useEffect)(() => {
|
|
361
|
+
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
362
|
+
}, [external]);
|
|
363
|
+
const setInternalValue = (setter) => {
|
|
364
|
+
const setterFn = typeof setter === "function" ? setter : () => setter;
|
|
365
|
+
const updated = setterFn(internal);
|
|
366
|
+
setInternal(updated);
|
|
367
|
+
setExternal(toExternal(updated));
|
|
368
|
+
};
|
|
369
|
+
return [internal, setInternalValue];
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
// src/controls/control-types/size-control.tsx
|
|
373
|
+
var defaultUnits = ["px", "%", "em", "rem", "vw"];
|
|
374
|
+
var SizeControl = ({ units = defaultUnits, placeholder }) => {
|
|
375
|
+
const { value, setValue } = useControl();
|
|
376
|
+
const [state, setState] = useSyncExternalState({
|
|
377
|
+
external: value,
|
|
378
|
+
setExternal: setValue,
|
|
379
|
+
persistWhen: (controlValue) => !!controlValue?.value.size || controlValue?.value.size === 0,
|
|
380
|
+
fallback: (controlValue) => ({
|
|
381
|
+
$$type: "size",
|
|
382
|
+
value: { unit: controlValue?.value.unit || "px", size: NaN }
|
|
383
|
+
})
|
|
384
|
+
});
|
|
385
|
+
const handleUnitChange = (event) => {
|
|
386
|
+
const unit = event.target.value;
|
|
387
|
+
setState((prev) => ({
|
|
388
|
+
...prev,
|
|
389
|
+
value: {
|
|
390
|
+
...prev.value,
|
|
391
|
+
unit
|
|
392
|
+
}
|
|
393
|
+
}));
|
|
394
|
+
};
|
|
395
|
+
const handleSizeChange = (event) => {
|
|
396
|
+
const { value: size } = event.target;
|
|
397
|
+
setState((prev) => ({
|
|
398
|
+
...prev,
|
|
399
|
+
value: {
|
|
400
|
+
...prev.value,
|
|
401
|
+
size: size || size === "0" ? parseFloat(size) : NaN
|
|
402
|
+
}
|
|
403
|
+
}));
|
|
404
|
+
};
|
|
405
|
+
return /* @__PURE__ */ React9.createElement(import_ui7.Stack, { direction: "row" }, /* @__PURE__ */ React9.createElement(
|
|
406
|
+
import_ui7.TextField,
|
|
407
|
+
{
|
|
408
|
+
size: "tiny",
|
|
409
|
+
type: "number",
|
|
410
|
+
value: Number.isNaN(state.value.size) ? "" : state.value.size,
|
|
411
|
+
onChange: handleSizeChange,
|
|
412
|
+
placeholder
|
|
413
|
+
}
|
|
414
|
+
), /* @__PURE__ */ React9.createElement(
|
|
415
|
+
import_ui7.Select,
|
|
416
|
+
{
|
|
417
|
+
size: "tiny",
|
|
418
|
+
value: state.value.unit,
|
|
419
|
+
onChange: handleUnitChange,
|
|
420
|
+
MenuProps: {
|
|
421
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
422
|
+
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
units.map((unit) => /* @__PURE__ */ React9.createElement(import_ui7.MenuItem, { key: unit, value: unit }, unit.toUpperCase()))
|
|
426
|
+
));
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
// src/controls/control-types/select-control.tsx
|
|
430
|
+
var React10 = __toESM(require("react"));
|
|
431
|
+
var import_ui8 = require("@elementor/ui");
|
|
432
|
+
var SelectControl = ({ options }) => {
|
|
433
|
+
const { value, setValue } = useControl();
|
|
434
|
+
const handleChange = (event) => {
|
|
435
|
+
setValue(event.target.value);
|
|
436
|
+
};
|
|
437
|
+
return /* @__PURE__ */ React10.createElement(import_ui8.Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(import_ui8.MenuItem, { key: props.value, ...props }, label)));
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
// src/controls/controls-registry.tsx
|
|
320
441
|
var controlTypes = {
|
|
321
442
|
image: ImageControl,
|
|
322
|
-
select: SelectControl,
|
|
323
443
|
text: TextControl,
|
|
324
|
-
textarea: TextAreaControl
|
|
444
|
+
textarea: TextAreaControl,
|
|
445
|
+
size: SizeControl,
|
|
446
|
+
select: SelectControl
|
|
325
447
|
};
|
|
326
|
-
var getControlByType = (type) =>
|
|
327
|
-
|
|
448
|
+
var getControlByType = (type) => controlTypes[type];
|
|
449
|
+
|
|
450
|
+
// src/controls/control.tsx
|
|
451
|
+
var ControlTypeError = (0, import_utils.createError)({
|
|
452
|
+
code: "CONTROL_TYPE_NOT_FOUND",
|
|
453
|
+
message: `Control type not found.`
|
|
454
|
+
});
|
|
455
|
+
var Control = ({ props, type }) => {
|
|
456
|
+
const { value } = useControl();
|
|
457
|
+
const ControlByType = getControlByType(type);
|
|
458
|
+
if (!ControlByType) {
|
|
459
|
+
throw new ControlTypeError({
|
|
460
|
+
context: { type }
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
const ControlComponent = getControlReplacement({ value }) || ControlByType;
|
|
464
|
+
return /* @__PURE__ */ React11.createElement(ControlComponent, { ...props });
|
|
328
465
|
};
|
|
329
466
|
|
|
330
467
|
// src/components/settings-tab.tsx
|
|
331
468
|
var SettingsTab = () => {
|
|
332
|
-
const {
|
|
333
|
-
|
|
334
|
-
if (!elementType) {
|
|
335
|
-
return null;
|
|
336
|
-
}
|
|
337
|
-
return /* @__PURE__ */ React9.createElement(import_ui8.Stack, null, elementType.controls.map(({ type, value }, index) => {
|
|
469
|
+
const { elementType } = useElementContext();
|
|
470
|
+
return /* @__PURE__ */ React12.createElement(import_ui9.Stack, null, elementType.controls.map(({ type, value }, index) => {
|
|
338
471
|
if (type === "control") {
|
|
339
|
-
return /* @__PURE__ */
|
|
472
|
+
return /* @__PURE__ */ React12.createElement(Control2, { key: value.bind, control: value });
|
|
340
473
|
}
|
|
341
474
|
if (type === "section") {
|
|
342
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ React12.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
343
476
|
if (item.type === "control") {
|
|
344
|
-
return /* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ React12.createElement(Control2, { key: item.value.bind, control: item.value });
|
|
345
478
|
}
|
|
346
479
|
return null;
|
|
347
480
|
}));
|
|
@@ -349,34 +482,28 @@ var SettingsTab = () => {
|
|
|
349
482
|
return null;
|
|
350
483
|
}));
|
|
351
484
|
};
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
if (!ControlComponent) {
|
|
485
|
+
var Control2 = ({ control }) => {
|
|
486
|
+
if (!getControlByType(control.type)) {
|
|
355
487
|
return null;
|
|
356
488
|
}
|
|
357
|
-
return /* @__PURE__ */
|
|
358
|
-
ControlComponent,
|
|
359
|
-
{
|
|
360
|
-
...control.props
|
|
361
|
-
}
|
|
362
|
-
));
|
|
489
|
+
return /* @__PURE__ */ React12.createElement(SettingsControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React12.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React12.createElement(Control, { type: control.type, props: control.props }));
|
|
363
490
|
};
|
|
364
491
|
|
|
365
492
|
// src/components/style-tab.tsx
|
|
366
|
-
var
|
|
493
|
+
var React21 = __toESM(require("react"));
|
|
367
494
|
|
|
368
495
|
// src/contexts/style-context.tsx
|
|
369
|
-
var
|
|
370
|
-
var
|
|
496
|
+
var React13 = __toESM(require("react"));
|
|
497
|
+
var import_react5 = require("react");
|
|
371
498
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
372
|
-
var Context2 = (0,
|
|
499
|
+
var Context2 = (0, import_react5.createContext)(null);
|
|
373
500
|
function StyleContext({ children, selectedStyleDef }) {
|
|
374
501
|
const breakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
|
|
375
502
|
const selectedMeta = { breakpoint, state: null };
|
|
376
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ React13.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta } }, children);
|
|
377
504
|
}
|
|
378
505
|
function useStyleContext() {
|
|
379
|
-
const context = (0,
|
|
506
|
+
const context = (0, import_react5.useContext)(Context2);
|
|
380
507
|
if (!context) {
|
|
381
508
|
throw new Error("UseStyleContext must be used within a StyleContextProvider");
|
|
382
509
|
}
|
|
@@ -407,10 +534,10 @@ var useElementStyles = (elementID) => {
|
|
|
407
534
|
var import_ui14 = require("@elementor/ui");
|
|
408
535
|
|
|
409
536
|
// src/components/style-sections/size-section.tsx
|
|
410
|
-
var
|
|
537
|
+
var React16 = __toESM(require("react"));
|
|
411
538
|
|
|
412
539
|
// src/controls/style-control.tsx
|
|
413
|
-
var
|
|
540
|
+
var React14 = __toESM(require("react"));
|
|
414
541
|
|
|
415
542
|
// src/hooks/use-element-style-prop.ts
|
|
416
543
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
@@ -479,35 +606,35 @@ var useStyleControl = (propName) => {
|
|
|
479
606
|
// src/controls/style-control.tsx
|
|
480
607
|
var StyleControl = ({ bind, children }) => {
|
|
481
608
|
const [value, setValue] = useStyleControl(bind);
|
|
482
|
-
return /* @__PURE__ */
|
|
609
|
+
return /* @__PURE__ */ React14.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
483
610
|
};
|
|
484
611
|
StyleControl.Label = ControlLabel;
|
|
485
612
|
|
|
486
613
|
// src/components/collapsible-content.tsx
|
|
487
|
-
var
|
|
488
|
-
var
|
|
614
|
+
var React15 = __toESM(require("react"));
|
|
615
|
+
var import_react6 = require("react");
|
|
489
616
|
var import_icons2 = require("@elementor/icons");
|
|
490
|
-
var
|
|
617
|
+
var import_ui10 = require("@elementor/ui");
|
|
491
618
|
var import_i18n2 = require("@wordpress/i18n");
|
|
492
619
|
var CollapsibleContent = ({ children, defaultOpen = false }) => {
|
|
493
|
-
const [open, setOpen] = (0,
|
|
620
|
+
const [open, setOpen] = (0, import_react6.useState)(defaultOpen);
|
|
494
621
|
const handleToggle = () => {
|
|
495
622
|
setOpen((prevOpen) => !prevOpen);
|
|
496
623
|
};
|
|
497
|
-
return /* @__PURE__ */
|
|
498
|
-
|
|
624
|
+
return /* @__PURE__ */ React15.createElement(import_ui10.Stack, { sx: { py: 0.5 } }, /* @__PURE__ */ React15.createElement(
|
|
625
|
+
import_ui10.Button,
|
|
499
626
|
{
|
|
500
627
|
fullWidth: true,
|
|
501
628
|
size: "small",
|
|
502
629
|
color: "secondary",
|
|
503
630
|
variant: "outlined",
|
|
504
631
|
onClick: handleToggle,
|
|
505
|
-
endIcon: /* @__PURE__ */
|
|
632
|
+
endIcon: /* @__PURE__ */ React15.createElement(ChevronIcon, { open })
|
|
506
633
|
},
|
|
507
634
|
open ? (0, import_i18n2.__)("Show less", "elementor") : (0, import_i18n2.__)("Show more", "elementor")
|
|
508
|
-
), /* @__PURE__ */
|
|
635
|
+
), /* @__PURE__ */ React15.createElement(import_ui10.Collapse, { in: open, timeout: "auto" }, children));
|
|
509
636
|
};
|
|
510
|
-
var ChevronIcon = (0,
|
|
637
|
+
var ChevronIcon = (0, import_ui10.styled)(import_icons2.ChevronDownIcon, {
|
|
511
638
|
shouldForwardProp: (prop) => prop !== "open"
|
|
512
639
|
})(({ theme, open }) => ({
|
|
513
640
|
transform: open ? "rotate(180deg)" : "rotate(0)",
|
|
@@ -516,131 +643,40 @@ var ChevronIcon = (0, import_ui9.styled)(import_icons2.ChevronDownIcon, {
|
|
|
516
643
|
})
|
|
517
644
|
}));
|
|
518
645
|
|
|
519
|
-
// src/controls/control-types/size-control.tsx
|
|
520
|
-
var React13 = __toESM(require("react"));
|
|
521
|
-
var import_ui10 = require("@elementor/ui");
|
|
522
|
-
|
|
523
|
-
// src/controls/hooks/use-sync-external-state.tsx
|
|
524
|
-
var import_react6 = require("react");
|
|
525
|
-
var useSyncExternalState = ({
|
|
526
|
-
external,
|
|
527
|
-
setExternal,
|
|
528
|
-
persistWhen,
|
|
529
|
-
fallback
|
|
530
|
-
}) => {
|
|
531
|
-
function toExternal(internalValue) {
|
|
532
|
-
if (persistWhen(internalValue)) {
|
|
533
|
-
return internalValue;
|
|
534
|
-
}
|
|
535
|
-
return void 0;
|
|
536
|
-
}
|
|
537
|
-
function toInternal(externalValue, internalValue) {
|
|
538
|
-
if (!externalValue) {
|
|
539
|
-
return fallback(internalValue);
|
|
540
|
-
}
|
|
541
|
-
return externalValue;
|
|
542
|
-
}
|
|
543
|
-
const [internal, setInternal] = (0, import_react6.useState)(toInternal(external, void 0));
|
|
544
|
-
(0, import_react6.useEffect)(() => {
|
|
545
|
-
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
546
|
-
}, [external]);
|
|
547
|
-
const setInternalValue = (setter) => {
|
|
548
|
-
const setterFn = typeof setter === "function" ? setter : () => setter;
|
|
549
|
-
const updated = setterFn(internal);
|
|
550
|
-
setInternal(updated);
|
|
551
|
-
setExternal(toExternal(updated));
|
|
552
|
-
};
|
|
553
|
-
return [internal, setInternalValue];
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// src/controls/control-types/size-control.tsx
|
|
557
|
-
var SizeControl = ({ units: units2, placeholder }) => {
|
|
558
|
-
const { value, setValue } = useControl();
|
|
559
|
-
const [state, setState] = useSyncExternalState({
|
|
560
|
-
external: value,
|
|
561
|
-
setExternal: setValue,
|
|
562
|
-
persistWhen: (controlValue) => !!controlValue?.value.size || controlValue?.value.size === 0,
|
|
563
|
-
fallback: (controlValue) => ({
|
|
564
|
-
$$type: "size",
|
|
565
|
-
value: { unit: controlValue?.value.unit || "px", size: NaN }
|
|
566
|
-
})
|
|
567
|
-
});
|
|
568
|
-
const handleUnitChange = (event) => {
|
|
569
|
-
const unit = event.target.value;
|
|
570
|
-
setState((prev) => ({
|
|
571
|
-
...prev,
|
|
572
|
-
value: {
|
|
573
|
-
...prev.value,
|
|
574
|
-
unit
|
|
575
|
-
}
|
|
576
|
-
}));
|
|
577
|
-
};
|
|
578
|
-
const handleSizeChange = (event) => {
|
|
579
|
-
const { value: size } = event.target;
|
|
580
|
-
setState((prev) => ({
|
|
581
|
-
...prev,
|
|
582
|
-
value: {
|
|
583
|
-
...prev.value,
|
|
584
|
-
size: size || size === "0" ? parseFloat(size) : NaN
|
|
585
|
-
}
|
|
586
|
-
}));
|
|
587
|
-
};
|
|
588
|
-
return /* @__PURE__ */ React13.createElement(import_ui10.Stack, { direction: "row" }, /* @__PURE__ */ React13.createElement(
|
|
589
|
-
import_ui10.TextField,
|
|
590
|
-
{
|
|
591
|
-
size: "tiny",
|
|
592
|
-
type: "number",
|
|
593
|
-
value: Number.isNaN(state.value.size) ? "" : state.value.size,
|
|
594
|
-
onChange: handleSizeChange,
|
|
595
|
-
placeholder
|
|
596
|
-
}
|
|
597
|
-
), /* @__PURE__ */ React13.createElement(
|
|
598
|
-
import_ui10.Select,
|
|
599
|
-
{
|
|
600
|
-
size: "tiny",
|
|
601
|
-
value: state.value.unit,
|
|
602
|
-
onChange: handleUnitChange,
|
|
603
|
-
MenuProps: {
|
|
604
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
605
|
-
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
units2.map((unit) => /* @__PURE__ */ React13.createElement(import_ui10.MenuItem, { key: unit, value: unit }, unit.toUpperCase()))
|
|
609
|
-
));
|
|
610
|
-
};
|
|
611
|
-
|
|
612
646
|
// src/components/style-sections/size-section.tsx
|
|
613
647
|
var import_ui11 = require("@elementor/ui");
|
|
614
648
|
var import_i18n3 = require("@wordpress/i18n");
|
|
615
649
|
var SizeSection = () => {
|
|
616
|
-
return /* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ React16.createElement(AccordionSection, { title: (0, import_i18n3.__)("Size", "elementor") }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "width", label: (0, import_i18n3.__)("Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "height", label: (0, import_i18n3.__)("Height", "elementor") })), /* @__PURE__ */ React16.createElement(CollapsibleContent, null, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "minWidth", label: (0, import_i18n3.__)("Min. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "minHeight", label: (0, import_i18n3.__)("Min. Height", "elementor") })), /* @__PURE__ */ React16.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React16.createElement(Control3, { bind: "maxWidth", label: (0, import_i18n3.__)("Max. Width", "elementor") }), /* @__PURE__ */ React16.createElement(Control3, { bind: "maxHeight", label: (0, import_i18n3.__)("Max. Height", "elementor") }))))));
|
|
617
651
|
};
|
|
618
|
-
var
|
|
619
|
-
|
|
620
|
-
return /* @__PURE__ */ React14.createElement(StyleControl, { bind }, /* @__PURE__ */ React14.createElement(import_ui11.Stack, { gap: 1, sx: { flex: "0 1 50%" } }, /* @__PURE__ */ React14.createElement(StyleControl.Label, null, label), /* @__PURE__ */ React14.createElement(SizeControl, { units })));
|
|
652
|
+
var Control3 = ({ label, bind }) => {
|
|
653
|
+
return /* @__PURE__ */ React16.createElement(StyleControl, { bind }, /* @__PURE__ */ React16.createElement(ControlContainer, { direction: "column" }, /* @__PURE__ */ React16.createElement(StyleControl.Label, null, label), /* @__PURE__ */ React16.createElement(Control, { type: "size" })));
|
|
621
654
|
};
|
|
622
655
|
|
|
623
|
-
// src/components/style-sections/typography-section.tsx
|
|
624
|
-
var
|
|
656
|
+
// src/components/style-sections/typography-section/typography-section.tsx
|
|
657
|
+
var React20 = __toESM(require("react"));
|
|
625
658
|
var import_ui13 = require("@elementor/ui");
|
|
626
659
|
|
|
627
|
-
// src/
|
|
628
|
-
var
|
|
660
|
+
// src/components/style-sections/typography-section/text-style-control.tsx
|
|
661
|
+
var React17 = __toESM(require("react"));
|
|
629
662
|
var import_ui12 = require("@elementor/ui");
|
|
663
|
+
var import_icons3 = require("@elementor/icons");
|
|
630
664
|
var import_i18n4 = require("@wordpress/i18n");
|
|
665
|
+
var buttonSize = "tiny";
|
|
631
666
|
var TextStyleControl = () => {
|
|
632
667
|
const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
|
|
633
668
|
const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
|
|
634
669
|
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
635
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ React17.createElement(ControlContainer, null, /* @__PURE__ */ React17.createElement(ControlLabel, null, (0, import_i18n4.__)("Style", "elementor")), /* @__PURE__ */ React17.createElement(import_ui12.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React17.createElement(
|
|
636
671
|
ToggleButton,
|
|
637
672
|
{
|
|
638
673
|
value: "italic",
|
|
639
674
|
onChange: (v) => setFontStyle(fontStyle === v ? null : v),
|
|
640
|
-
"aria-label": "italic"
|
|
675
|
+
"aria-label": "italic",
|
|
676
|
+
sx: { marginLeft: "auto" }
|
|
641
677
|
},
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
), /* @__PURE__ */
|
|
678
|
+
/* @__PURE__ */ React17.createElement(import_icons3.ItalicIcon, { fontSize: buttonSize })
|
|
679
|
+
), /* @__PURE__ */ React17.createElement(
|
|
644
680
|
ShorthandControl,
|
|
645
681
|
{
|
|
646
682
|
value: "line-through",
|
|
@@ -648,8 +684,8 @@ var TextStyleControl = () => {
|
|
|
648
684
|
updateValues: setTextDecoration,
|
|
649
685
|
"aria-label": "line-through"
|
|
650
686
|
},
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
), /* @__PURE__ */
|
|
687
|
+
/* @__PURE__ */ React17.createElement(import_icons3.StrikethroughIcon, { fontSize: buttonSize })
|
|
688
|
+
), /* @__PURE__ */ React17.createElement(
|
|
653
689
|
ShorthandControl,
|
|
654
690
|
{
|
|
655
691
|
value: "underline",
|
|
@@ -657,7 +693,7 @@ var TextStyleControl = () => {
|
|
|
657
693
|
updateValues: setTextDecoration,
|
|
658
694
|
"aria-label": "underline"
|
|
659
695
|
},
|
|
660
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ React17.createElement(import_icons3.UnderlineIcon, { fontSize: buttonSize })
|
|
661
697
|
)));
|
|
662
698
|
};
|
|
663
699
|
var ShorthandControl = ({
|
|
@@ -676,19 +712,42 @@ var ShorthandControl = ({
|
|
|
676
712
|
updateValues([...valuesArr, newValue].join(" "));
|
|
677
713
|
}
|
|
678
714
|
};
|
|
679
|
-
return /* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ React17.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
|
|
680
716
|
};
|
|
681
717
|
var ToggleButton = ({ onChange, ...props }) => {
|
|
682
718
|
const handleChange = (_e, newValue) => {
|
|
683
719
|
onChange(newValue);
|
|
684
720
|
};
|
|
685
|
-
return /* @__PURE__ */
|
|
721
|
+
return /* @__PURE__ */ React17.createElement(import_ui12.ToggleButton, { ...props, onChange: handleChange, size: buttonSize });
|
|
686
722
|
};
|
|
687
723
|
|
|
688
|
-
// src/components/style-sections/typography-section.tsx
|
|
724
|
+
// src/components/style-sections/typography-section/typography-section.tsx
|
|
725
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
726
|
+
|
|
727
|
+
// src/components/style-sections/typography-section/font-size-control.tsx
|
|
728
|
+
var React18 = __toESM(require("react"));
|
|
689
729
|
var import_i18n5 = require("@wordpress/i18n");
|
|
730
|
+
var FontSizeControl = () => {
|
|
731
|
+
return /* @__PURE__ */ React18.createElement(StyleControl, { bind: "font-size" }, /* @__PURE__ */ React18.createElement(ControlContainer, null, /* @__PURE__ */ React18.createElement(StyleControl.Label, null, (0, import_i18n5.__)("Font Size", "elementor")), /* @__PURE__ */ React18.createElement(SizeControl, null)));
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
// src/components/style-sections/typography-section/font-weight-control.tsx
|
|
735
|
+
var React19 = __toESM(require("react"));
|
|
736
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
737
|
+
var fontWeightOptions = [
|
|
738
|
+
{ label: (0, import_i18n6.__)("Light - 400", "elementor"), value: 400 },
|
|
739
|
+
{ label: (0, import_i18n6.__)("Regular - 500", "elementor"), value: 500 },
|
|
740
|
+
{ label: (0, import_i18n6.__)("Semi Bold - 600", "elementor"), value: 600 },
|
|
741
|
+
{ label: (0, import_i18n6.__)("Bold - 700", "elementor"), value: 700 },
|
|
742
|
+
{ label: (0, import_i18n6.__)("Black - 900", "elementor"), value: 900 }
|
|
743
|
+
];
|
|
744
|
+
var FontWeightControl = () => {
|
|
745
|
+
return /* @__PURE__ */ React19.createElement(StyleControl, { bind: "fontWeight" }, /* @__PURE__ */ React19.createElement(ControlContainer, null, /* @__PURE__ */ React19.createElement(StyleControl.Label, null, (0, import_i18n6.__)("Font Weight", "elementor")), /* @__PURE__ */ React19.createElement(SelectControl, { options: fontWeightOptions })));
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
// src/components/style-sections/typography-section/typography-section.tsx
|
|
690
749
|
var TypographySection = () => {
|
|
691
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React20.createElement(AccordionSection, { title: (0, import_i18n7.__)("Typography", "elementor") }, /* @__PURE__ */ React20.createElement(import_ui13.Stack, { gap: 1.5 }, /* @__PURE__ */ React20.createElement(FontWeightControl, null), /* @__PURE__ */ React20.createElement(FontSizeControl, null), /* @__PURE__ */ React20.createElement(import_ui13.Divider, null), /* @__PURE__ */ React20.createElement(TextStyleControl, null)));
|
|
692
751
|
};
|
|
693
752
|
|
|
694
753
|
// src/components/style-tab.tsx
|
|
@@ -696,13 +755,13 @@ var StyleTab = () => {
|
|
|
696
755
|
const { element } = useElementContext();
|
|
697
756
|
const elementStyles = useElementStyles(element.id);
|
|
698
757
|
const [selectedStyleDef = null] = Object.values(elementStyles || {});
|
|
699
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ React21.createElement(StyleContext, { selectedStyleDef }, /* @__PURE__ */ React21.createElement(import_ui14.Stack, null, /* @__PURE__ */ React21.createElement(SizeSection, null), /* @__PURE__ */ React21.createElement(TypographySection, null)));
|
|
700
759
|
};
|
|
701
760
|
|
|
702
761
|
// src/components/editing-panel-tabs.tsx
|
|
703
762
|
var EditingPanelTabs = () => {
|
|
704
763
|
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui15.useTabs)("settings");
|
|
705
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ React22.createElement(import_ui15.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React22.createElement(import_ui15.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React22.createElement(import_ui15.Tab, { label: (0, import_i18n8.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React22.createElement(import_ui15.Tab, { label: (0, import_i18n8.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React22.createElement(import_ui15.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React22.createElement(SettingsTab, null)), /* @__PURE__ */ React22.createElement(import_ui15.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React22.createElement(StyleTab, null)));
|
|
706
765
|
};
|
|
707
766
|
|
|
708
767
|
// src/components/editing-panel.tsx
|
|
@@ -713,8 +772,8 @@ var EditingPanel = () => {
|
|
|
713
772
|
if (elements.length !== 1 || !elementType) {
|
|
714
773
|
return null;
|
|
715
774
|
}
|
|
716
|
-
const panelTitle = (0,
|
|
717
|
-
return /* @__PURE__ */
|
|
775
|
+
const panelTitle = (0, import_i18n9.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
776
|
+
return /* @__PURE__ */ React23.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React23.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React23.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React23.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React23.createElement(ElementContext, { element: selectedElement, elementType }, /* @__PURE__ */ React23.createElement(EditingPanelTabs, null))));
|
|
718
777
|
};
|
|
719
778
|
|
|
720
779
|
// src/panel.ts
|
|
@@ -776,4 +835,9 @@ var blockV1Panel = () => {
|
|
|
776
835
|
|
|
777
836
|
// src/index.ts
|
|
778
837
|
init();
|
|
838
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
839
|
+
0 && (module.exports = {
|
|
840
|
+
replaceControl,
|
|
841
|
+
useControl
|
|
842
|
+
});
|
|
779
843
|
//# sourceMappingURL=index.js.map
|