@elementor/editor-editing-panel 0.11.2 → 0.13.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 +176 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +162 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/control-label.tsx +10 -0
- package/src/components/style-sections/size-section.tsx +4 -4
- package/src/components/style-sections/typography-section.tsx +15 -0
- package/src/components/style-tab.tsx +2 -0
- package/src/controls/control-types/{attachment-control.tsx → image-control.tsx} +22 -39
- package/src/controls/control-types/text-style-control.tsx +90 -0
- package/src/controls/get-control-by-type.ts +2 -2
- package/src/controls/hooks/use-style-control.ts +28 -0
- package/src/controls/settings-control.tsx +5 -10
- package/src/controls/style-control.tsx +8 -36
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.13.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-editing-panel@0.12.0...@elementor/editor-editing-panel@0.13.0) (2024-08-21)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **editor-editing-panel:** add text style control [EDS-329] ([#242](https://github.com/elementor/elementor-packages/issues/242)) ([2cc149b](https://github.com/elementor/elementor-packages/commit/2cc149b7471c31ff9e577f85a1a0269f10ec0169))
|
|
11
|
+
|
|
12
|
+
# [0.12.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-editing-panel@0.11.2...@elementor/editor-editing-panel@0.12.0) (2024-08-20)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **editor-editing-panel:** change attachment control to image control [EDS-370] ([#244](https://github.com/elementor/elementor-packages/issues/244)) ([35d8e1f](https://github.com/elementor/elementor-packages/commit/35d8e1f9592d2d376b21ab1fc53e17865d124066))
|
|
17
|
+
|
|
6
18
|
## [0.11.2](https://github.com/elementor/elementor-packages/compare/@elementor/editor-editing-panel@0.11.1...@elementor/editor-editing-panel@0.11.2) (2024-08-20)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @elementor/editor-editing-panel
|
package/dist/index.js
CHANGED
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
27
27
|
|
|
28
28
|
// src/components/editing-panel.tsx
|
|
29
|
-
var
|
|
30
|
-
var
|
|
29
|
+
var React18 = __toESM(require("react"));
|
|
30
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
31
31
|
|
|
32
32
|
// src/hooks/use-selected-elements.ts
|
|
33
33
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
@@ -107,16 +107,16 @@ function useElementContext() {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// src/components/editing-panel-tabs.tsx
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
var
|
|
110
|
+
var import_ui14 = require("@elementor/ui");
|
|
111
|
+
var React17 = __toESM(require("react"));
|
|
112
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
113
113
|
|
|
114
114
|
// src/components/settings-tab.tsx
|
|
115
|
-
var
|
|
116
|
-
var
|
|
115
|
+
var React9 = __toESM(require("react"));
|
|
116
|
+
var import_ui8 = require("@elementor/ui");
|
|
117
117
|
|
|
118
118
|
// src/controls/settings-control.tsx
|
|
119
|
-
var
|
|
119
|
+
var React3 = __toESM(require("react"));
|
|
120
120
|
|
|
121
121
|
// src/controls/control-context.tsx
|
|
122
122
|
var import_react2 = require("react");
|
|
@@ -130,7 +130,7 @@ function useControl(defaultValue) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// src/controls/settings-control.tsx
|
|
133
|
-
var
|
|
133
|
+
var import_ui2 = require("@elementor/ui");
|
|
134
134
|
|
|
135
135
|
// src/hooks/use-widget-settings.ts
|
|
136
136
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
@@ -167,6 +167,13 @@ var updateSettings = ({ id, props }) => {
|
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
+
// src/components/control-label.tsx
|
|
171
|
+
var React2 = __toESM(require("react"));
|
|
172
|
+
var import_ui = require("@elementor/ui");
|
|
173
|
+
var ControlLabel = ({ children }) => {
|
|
174
|
+
return /* @__PURE__ */ React2.createElement(import_ui.Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
175
|
+
};
|
|
176
|
+
|
|
170
177
|
// src/controls/settings-control.tsx
|
|
171
178
|
var SettingsControlProvider = ({ bind, children }) => {
|
|
172
179
|
const { element } = useElementContext();
|
|
@@ -179,10 +186,10 @@ var SettingsControlProvider = ({ bind, children }) => {
|
|
|
179
186
|
}
|
|
180
187
|
});
|
|
181
188
|
};
|
|
182
|
-
return /* @__PURE__ */
|
|
189
|
+
return /* @__PURE__ */ React3.createElement(ControlContext.Provider, { value: { setValue, value, bind } }, children);
|
|
183
190
|
};
|
|
184
|
-
var SettingsControl = ({ children, bind }) => /* @__PURE__ */
|
|
185
|
-
var StyledStack = (0,
|
|
191
|
+
var SettingsControl = ({ children, bind }) => /* @__PURE__ */ React3.createElement(SettingsControlProvider, { bind }, /* @__PURE__ */ React3.createElement(StyledStack, { gap: 1, direction: "row", alignItems: "center", justifyContent: "space-between", flexWrap: "wrap" }, children));
|
|
192
|
+
var StyledStack = (0, import_ui2.styled)(import_ui2.Stack)`
|
|
186
193
|
& > * {
|
|
187
194
|
flex-grow: 1;
|
|
188
195
|
}
|
|
@@ -191,43 +198,40 @@ var StyledStack = (0, import_ui.styled)(import_ui.Stack)`
|
|
|
191
198
|
min-width: 50%;
|
|
192
199
|
}
|
|
193
200
|
`;
|
|
194
|
-
|
|
195
|
-
return /* @__PURE__ */ React2.createElement(import_ui.Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
196
|
-
};
|
|
197
|
-
SettingsControl.Label = Label;
|
|
201
|
+
SettingsControl.Label = ControlLabel;
|
|
198
202
|
|
|
199
203
|
// src/components/collapsible-section.tsx
|
|
200
|
-
var
|
|
204
|
+
var React4 = __toESM(require("react"));
|
|
201
205
|
var import_react3 = require("react");
|
|
202
|
-
var
|
|
206
|
+
var import_ui3 = require("@elementor/ui");
|
|
203
207
|
var CollapsibleSection = ({ title, children }) => {
|
|
204
208
|
const uid = (0, import_react3.useId)();
|
|
205
209
|
const labelId = `label-${uid}`;
|
|
206
210
|
const contentId = `content-${uid}`;
|
|
207
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ React4.createElement(import_ui3.Accordion, { disableGutters: true, defaultExpanded: true }, /* @__PURE__ */ React4.createElement(import_ui3.AccordionSummary, { "aria-controls": contentId, id: labelId }, /* @__PURE__ */ React4.createElement(import_ui3.AccordionSummaryText, { primaryTypographyProps: { variant: "caption" } }, title)), /* @__PURE__ */ React4.createElement(import_ui3.AccordionDetails, { id: contentId, "aria-labelledby": labelId }, /* @__PURE__ */ React4.createElement(import_ui3.Stack, { gap: 2.5 }, children)));
|
|
208
212
|
};
|
|
209
213
|
|
|
210
214
|
// src/controls/control-types/select-control.tsx
|
|
211
|
-
var
|
|
212
|
-
var
|
|
215
|
+
var React5 = __toESM(require("react"));
|
|
216
|
+
var import_ui4 = require("@elementor/ui");
|
|
213
217
|
var SelectControl = ({ options }) => {
|
|
214
218
|
const { value, setValue } = useControl();
|
|
215
219
|
const handleChange = (event) => {
|
|
216
220
|
setValue(event.target.value);
|
|
217
221
|
};
|
|
218
|
-
return /* @__PURE__ */
|
|
222
|
+
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)));
|
|
219
223
|
};
|
|
220
224
|
|
|
221
225
|
// src/controls/control-types/text-area-control.tsx
|
|
222
|
-
var
|
|
223
|
-
var
|
|
226
|
+
var React6 = __toESM(require("react"));
|
|
227
|
+
var import_ui5 = require("@elementor/ui");
|
|
224
228
|
var TextAreaControl = ({ placeholder }) => {
|
|
225
229
|
const { value, setValue } = useControl("");
|
|
226
230
|
const handleChange = (event) => {
|
|
227
231
|
setValue(event.target.value);
|
|
228
232
|
};
|
|
229
|
-
return /* @__PURE__ */
|
|
230
|
-
|
|
233
|
+
return /* @__PURE__ */ React6.createElement(
|
|
234
|
+
import_ui5.TextField,
|
|
231
235
|
{
|
|
232
236
|
size: "tiny",
|
|
233
237
|
multiline: true,
|
|
@@ -241,59 +245,50 @@ var TextAreaControl = ({ placeholder }) => {
|
|
|
241
245
|
};
|
|
242
246
|
|
|
243
247
|
// src/controls/control-types/text-control.tsx
|
|
244
|
-
var
|
|
245
|
-
var
|
|
248
|
+
var React7 = __toESM(require("react"));
|
|
249
|
+
var import_ui6 = require("@elementor/ui");
|
|
246
250
|
var TextControl = ({ placeholder }) => {
|
|
247
251
|
const { value, setValue } = useControl("");
|
|
248
252
|
const handleChange = (event) => setValue(event.target.value);
|
|
249
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ React7.createElement(import_ui6.TextField, { type: "text", size: "tiny", value, onChange: handleChange, placeholder });
|
|
250
254
|
};
|
|
251
255
|
|
|
252
|
-
// src/controls/control-types/
|
|
253
|
-
var
|
|
254
|
-
var
|
|
256
|
+
// src/controls/control-types/image-control.tsx
|
|
257
|
+
var React8 = __toESM(require("react"));
|
|
258
|
+
var import_ui7 = require("@elementor/ui");
|
|
255
259
|
var import_icons = require("@elementor/icons");
|
|
256
260
|
var import_i18n = require("@wordpress/i18n");
|
|
257
261
|
var import_wp_media = require("@elementor/wp-media");
|
|
258
|
-
var isImageAttachment = (value) => {
|
|
259
|
-
return value?.$$type === "image-attachment";
|
|
260
|
-
};
|
|
261
|
-
var isImageUrl = (value) => {
|
|
262
|
-
return value?.$$type === "image-url";
|
|
263
|
-
};
|
|
264
262
|
var defaultState = {
|
|
265
|
-
$$type: "image
|
|
263
|
+
$$type: "image",
|
|
266
264
|
value: {
|
|
267
265
|
url: "/wp-content/plugins/elementor/assets/images/placeholder.png"
|
|
268
266
|
}
|
|
269
267
|
};
|
|
270
|
-
var
|
|
268
|
+
var ImageControl = () => {
|
|
271
269
|
const { value, setValue } = useControl(defaultState);
|
|
272
|
-
const { data: attachment } = (0, import_wp_media.useWpMediaAttachment)(
|
|
270
|
+
const { data: attachment } = (0, import_wp_media.useWpMediaAttachment)(value?.value?.attachmentId);
|
|
273
271
|
const getImageSrc = () => {
|
|
274
272
|
if (attachment?.url) {
|
|
275
273
|
return attachment.url;
|
|
276
274
|
}
|
|
277
|
-
|
|
278
|
-
return value.value.url;
|
|
279
|
-
}
|
|
280
|
-
return defaultState.value.url;
|
|
275
|
+
return value?.value?.url ?? defaultState.value.url;
|
|
281
276
|
};
|
|
282
277
|
const { open } = (0, import_wp_media.useWpMediaFrame)({
|
|
283
|
-
types:
|
|
278
|
+
types: ["image"],
|
|
284
279
|
multiple: false,
|
|
285
|
-
selected:
|
|
286
|
-
onSelect: (
|
|
280
|
+
selected: value?.value?.attachmentId,
|
|
281
|
+
onSelect: (selectedAttachment) => {
|
|
287
282
|
setValue({
|
|
288
|
-
$$type: "image
|
|
283
|
+
$$type: "image",
|
|
289
284
|
value: {
|
|
290
|
-
|
|
285
|
+
attachmentId: selectedAttachment.id
|
|
291
286
|
}
|
|
292
287
|
});
|
|
293
288
|
}
|
|
294
289
|
});
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
|
|
290
|
+
return /* @__PURE__ */ React8.createElement(import_ui7.Card, { variant: "outlined" }, /* @__PURE__ */ React8.createElement(import_ui7.CardMedia, { image: getImageSrc(), sx: { height: 150 } }), /* @__PURE__ */ React8.createElement(import_ui7.CardOverlay, null, /* @__PURE__ */ React8.createElement(
|
|
291
|
+
import_ui7.Button,
|
|
297
292
|
{
|
|
298
293
|
color: "inherit",
|
|
299
294
|
size: "small",
|
|
@@ -303,13 +298,13 @@ var AttachmentControl = (props) => {
|
|
|
303
298
|
}
|
|
304
299
|
},
|
|
305
300
|
(0, import_i18n.__)("Select Image", "elementor")
|
|
306
|
-
), /* @__PURE__ */
|
|
307
|
-
|
|
301
|
+
), /* @__PURE__ */ React8.createElement(
|
|
302
|
+
import_ui7.Button,
|
|
308
303
|
{
|
|
309
304
|
color: "inherit",
|
|
310
305
|
size: "small",
|
|
311
306
|
variant: "text",
|
|
312
|
-
startIcon: /* @__PURE__ */
|
|
307
|
+
startIcon: /* @__PURE__ */ React8.createElement(import_icons.UploadIcon, null),
|
|
313
308
|
onClick: () => {
|
|
314
309
|
open({ mode: "upload" });
|
|
315
310
|
}
|
|
@@ -320,7 +315,7 @@ var AttachmentControl = (props) => {
|
|
|
320
315
|
|
|
321
316
|
// src/controls/get-control-by-type.ts
|
|
322
317
|
var controlTypes = {
|
|
323
|
-
|
|
318
|
+
image: ImageControl,
|
|
324
319
|
select: SelectControl,
|
|
325
320
|
text: TextControl,
|
|
326
321
|
textarea: TextAreaControl
|
|
@@ -336,14 +331,14 @@ var SettingsTab = () => {
|
|
|
336
331
|
if (!elementType) {
|
|
337
332
|
return null;
|
|
338
333
|
}
|
|
339
|
-
return /* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ React9.createElement(import_ui8.Stack, null, elementType.controls.map(({ type, value }, index) => {
|
|
340
335
|
if (type === "control") {
|
|
341
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: value.bind, control: value });
|
|
342
337
|
}
|
|
343
338
|
if (type === "section") {
|
|
344
|
-
return /* @__PURE__ */
|
|
339
|
+
return /* @__PURE__ */ React9.createElement(CollapsibleSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
345
340
|
if (item.type === "control") {
|
|
346
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: item.value.bind, control: item.value });
|
|
347
342
|
}
|
|
348
343
|
return null;
|
|
349
344
|
}));
|
|
@@ -356,7 +351,7 @@ var Control = ({ control }) => {
|
|
|
356
351
|
if (!ControlComponent) {
|
|
357
352
|
return null;
|
|
358
353
|
}
|
|
359
|
-
return /* @__PURE__ */
|
|
354
|
+
return /* @__PURE__ */ React9.createElement(SettingsControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React9.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React9.createElement(
|
|
360
355
|
ControlComponent,
|
|
361
356
|
{
|
|
362
357
|
...control.props
|
|
@@ -365,17 +360,17 @@ var Control = ({ control }) => {
|
|
|
365
360
|
};
|
|
366
361
|
|
|
367
362
|
// src/components/style-tab.tsx
|
|
368
|
-
var
|
|
363
|
+
var React16 = __toESM(require("react"));
|
|
369
364
|
|
|
370
365
|
// src/contexts/style-context.tsx
|
|
371
|
-
var
|
|
366
|
+
var React10 = __toESM(require("react"));
|
|
372
367
|
var import_react4 = require("react");
|
|
373
368
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
374
369
|
var Context2 = (0, import_react4.createContext)(null);
|
|
375
370
|
function StyleContext({ children, selectedStyleDef }) {
|
|
376
371
|
const breakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
|
|
377
372
|
const selectedMeta = { breakpoint, state: null };
|
|
378
|
-
return /* @__PURE__ */
|
|
373
|
+
return /* @__PURE__ */ React10.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta } }, children);
|
|
379
374
|
}
|
|
380
375
|
function useStyleContext() {
|
|
381
376
|
const context = (0, import_react4.useContext)(Context2);
|
|
@@ -406,37 +401,24 @@ var useElementStyles = (elementID) => {
|
|
|
406
401
|
};
|
|
407
402
|
|
|
408
403
|
// src/components/style-tab.tsx
|
|
409
|
-
var
|
|
404
|
+
var import_ui13 = require("@elementor/ui");
|
|
410
405
|
|
|
411
406
|
// src/components/style-sections/size-section.tsx
|
|
412
|
-
var
|
|
407
|
+
var React13 = __toESM(require("react"));
|
|
413
408
|
|
|
414
409
|
// src/controls/style-control.tsx
|
|
415
|
-
var
|
|
416
|
-
|
|
417
|
-
// src/sync/update-style.ts
|
|
418
|
-
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
419
|
-
var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
|
|
420
|
-
const container = getContainer(elementID);
|
|
421
|
-
(0, import_editor_v1_adapters6.__privateRunCommand)("document/atomic-widgets/styles", {
|
|
422
|
-
container,
|
|
423
|
-
styleDefID,
|
|
424
|
-
bind,
|
|
425
|
-
meta,
|
|
426
|
-
props
|
|
427
|
-
});
|
|
428
|
-
};
|
|
410
|
+
var React11 = __toESM(require("react"));
|
|
429
411
|
|
|
430
412
|
// src/hooks/use-element-style-prop.ts
|
|
431
|
-
var
|
|
413
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
432
414
|
var useElementStyleProp = ({
|
|
433
415
|
elementID,
|
|
434
416
|
styleDefID,
|
|
435
417
|
meta,
|
|
436
418
|
propName
|
|
437
419
|
}) => {
|
|
438
|
-
return (0,
|
|
439
|
-
(0,
|
|
420
|
+
return (0, import_editor_v1_adapters6.__privateUseListenTo)(
|
|
421
|
+
(0, import_editor_v1_adapters6.commandEndEvent)("document/atomic-widgets/styles"),
|
|
440
422
|
() => {
|
|
441
423
|
if (!styleDefID) {
|
|
442
424
|
return null;
|
|
@@ -457,34 +439,49 @@ function getVariantByMeta(styleDef, meta) {
|
|
|
457
439
|
});
|
|
458
440
|
}
|
|
459
441
|
|
|
460
|
-
// src/
|
|
461
|
-
var
|
|
462
|
-
var
|
|
442
|
+
// src/sync/update-style.ts
|
|
443
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
444
|
+
var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
|
|
445
|
+
const container = getContainer(elementID);
|
|
446
|
+
(0, import_editor_v1_adapters7.__privateRunCommand)("document/atomic-widgets/styles", {
|
|
447
|
+
container,
|
|
448
|
+
styleDefID,
|
|
449
|
+
bind,
|
|
450
|
+
meta,
|
|
451
|
+
props
|
|
452
|
+
});
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// src/controls/hooks/use-style-control.ts
|
|
456
|
+
var useStyleControl = (propName) => {
|
|
463
457
|
const { element } = useElementContext();
|
|
464
458
|
const { selectedStyleDef, selectedMeta } = useStyleContext();
|
|
459
|
+
const value = useElementStyleProp({
|
|
460
|
+
elementID: element.id,
|
|
461
|
+
styleDefID: selectedStyleDef?.id,
|
|
462
|
+
meta: selectedMeta,
|
|
463
|
+
propName
|
|
464
|
+
});
|
|
465
465
|
const setValue = (newValue) => {
|
|
466
466
|
updateStyle({
|
|
467
467
|
elementID: element.id,
|
|
468
468
|
styleDefID: selectedStyleDef?.id,
|
|
469
|
-
props: { [
|
|
469
|
+
props: { [propName]: newValue },
|
|
470
470
|
meta: selectedMeta
|
|
471
471
|
});
|
|
472
472
|
};
|
|
473
|
-
|
|
474
|
-
elementID: element.id,
|
|
475
|
-
styleDefID: selectedStyleDef?.id,
|
|
476
|
-
meta: selectedMeta,
|
|
477
|
-
propName: bind
|
|
478
|
-
});
|
|
479
|
-
return /* @__PURE__ */ React10.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
473
|
+
return [value, setValue];
|
|
480
474
|
};
|
|
481
|
-
|
|
482
|
-
|
|
475
|
+
|
|
476
|
+
// src/controls/style-control.tsx
|
|
477
|
+
var StyleControl = ({ bind, children }) => {
|
|
478
|
+
const [value, setValue] = useStyleControl(bind);
|
|
479
|
+
return /* @__PURE__ */ React11.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
483
480
|
};
|
|
484
|
-
StyleControl.Label =
|
|
481
|
+
StyleControl.Label = ControlLabel;
|
|
485
482
|
|
|
486
483
|
// src/controls/control-types/size-control.tsx
|
|
487
|
-
var
|
|
484
|
+
var React12 = __toESM(require("react"));
|
|
488
485
|
var import_ui9 = require("@elementor/ui");
|
|
489
486
|
|
|
490
487
|
// src/controls/hooks/use-sync-external-state.tsx
|
|
@@ -552,7 +549,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
552
549
|
}
|
|
553
550
|
}));
|
|
554
551
|
};
|
|
555
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ React12.createElement(import_ui9.Stack, { direction: "row" }, /* @__PURE__ */ React12.createElement(
|
|
556
553
|
import_ui9.TextField,
|
|
557
554
|
{
|
|
558
555
|
size: "tiny",
|
|
@@ -561,7 +558,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
561
558
|
onChange: handleSizeChange,
|
|
562
559
|
placeholder
|
|
563
560
|
}
|
|
564
|
-
), /* @__PURE__ */
|
|
561
|
+
), /* @__PURE__ */ React12.createElement(
|
|
565
562
|
import_ui9.Select,
|
|
566
563
|
{
|
|
567
564
|
size: "tiny",
|
|
@@ -572,7 +569,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
572
569
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
573
570
|
}
|
|
574
571
|
},
|
|
575
|
-
units2.map((unit) => /* @__PURE__ */
|
|
572
|
+
units2.map((unit) => /* @__PURE__ */ React12.createElement(import_ui9.MenuItem, { key: unit, value: unit }, unit.toUpperCase()))
|
|
576
573
|
));
|
|
577
574
|
};
|
|
578
575
|
|
|
@@ -580,11 +577,82 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
580
577
|
var import_ui10 = require("@elementor/ui");
|
|
581
578
|
var import_i18n2 = require("@wordpress/i18n");
|
|
582
579
|
var SizeSection = () => {
|
|
583
|
-
return /* @__PURE__ */
|
|
580
|
+
return /* @__PURE__ */ React13.createElement(CollapsibleSection, { title: (0, import_i18n2.__)("Size", "elementor") }, /* @__PURE__ */ React13.createElement(import_ui10.Stack, { gap: 1.5 }, /* @__PURE__ */ React13.createElement(import_ui10.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React13.createElement(Control2, { bind: "width", label: (0, import_i18n2.__)("Width", "elementor") }), /* @__PURE__ */ React13.createElement(Control2, { bind: "height", label: (0, import_i18n2.__)("Height", "elementor") })), /* @__PURE__ */ React13.createElement(import_ui10.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React13.createElement(Control2, { bind: "minWidth", label: (0, import_i18n2.__)("Min. Width", "elementor") }), /* @__PURE__ */ React13.createElement(Control2, { bind: "minHeight", label: (0, import_i18n2.__)("Min. Height", "elementor") })), /* @__PURE__ */ React13.createElement(import_ui10.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React13.createElement(Control2, { bind: "maxWidth", label: (0, import_i18n2.__)("Max. Width", "elementor") }), /* @__PURE__ */ React13.createElement(Control2, { bind: "maxHeight", label: (0, import_i18n2.__)("Max. Height", "elementor") }))));
|
|
584
581
|
};
|
|
585
582
|
var units = ["px", "%", "em", "rem", "vw"];
|
|
586
583
|
var Control2 = ({ label, bind }) => {
|
|
587
|
-
return /* @__PURE__ */
|
|
584
|
+
return /* @__PURE__ */ React13.createElement(StyleControl, { bind }, /* @__PURE__ */ React13.createElement(import_ui10.Stack, { gap: 1, sx: { flex: "0 1 50%" } }, /* @__PURE__ */ React13.createElement(StyleControl.Label, null, label), /* @__PURE__ */ React13.createElement(SizeControl, { units })));
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// src/components/style-sections/typography-section.tsx
|
|
588
|
+
var React15 = __toESM(require("react"));
|
|
589
|
+
var import_ui12 = require("@elementor/ui");
|
|
590
|
+
|
|
591
|
+
// src/controls/control-types/text-style-control.tsx
|
|
592
|
+
var React14 = __toESM(require("react"));
|
|
593
|
+
var import_ui11 = require("@elementor/ui");
|
|
594
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
595
|
+
var TextStyleControl = () => {
|
|
596
|
+
const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
|
|
597
|
+
const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
|
|
598
|
+
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
599
|
+
return /* @__PURE__ */ React14.createElement(import_ui11.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React14.createElement(ControlLabel, null, (0, import_i18n3.__)("Style", "elementor")), /* @__PURE__ */ React14.createElement(import_ui11.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React14.createElement(
|
|
600
|
+
ToggleButton,
|
|
601
|
+
{
|
|
602
|
+
value: "italic",
|
|
603
|
+
onChange: (v) => setFontStyle(fontStyle === v ? null : v),
|
|
604
|
+
"aria-label": "italic"
|
|
605
|
+
},
|
|
606
|
+
/* @__PURE__ */ React14.createElement("span", { style: { fontStyle: "italic", fontSize: "12px" } }, "I")
|
|
607
|
+
), /* @__PURE__ */ React14.createElement(
|
|
608
|
+
ShorthandControl,
|
|
609
|
+
{
|
|
610
|
+
value: "line-through",
|
|
611
|
+
currentValues: textDecoration || "",
|
|
612
|
+
updateValues: setTextDecoration,
|
|
613
|
+
"aria-label": "line-through"
|
|
614
|
+
},
|
|
615
|
+
/* @__PURE__ */ React14.createElement("span", { style: { textDecoration: "line-through", fontSize: "12px" } }, "S")
|
|
616
|
+
), /* @__PURE__ */ React14.createElement(
|
|
617
|
+
ShorthandControl,
|
|
618
|
+
{
|
|
619
|
+
value: "underline",
|
|
620
|
+
currentValues: textDecoration || "",
|
|
621
|
+
updateValues: setTextDecoration,
|
|
622
|
+
"aria-label": "underline"
|
|
623
|
+
},
|
|
624
|
+
/* @__PURE__ */ React14.createElement("span", { style: { textDecoration: "underline", fontSize: "12px" } }, "U")
|
|
625
|
+
)));
|
|
626
|
+
};
|
|
627
|
+
var ShorthandControl = ({
|
|
628
|
+
children,
|
|
629
|
+
value,
|
|
630
|
+
currentValues,
|
|
631
|
+
updateValues,
|
|
632
|
+
"aria-label": ariaLabel
|
|
633
|
+
}) => {
|
|
634
|
+
const valuesArr = currentValues.split(" ").filter(Boolean);
|
|
635
|
+
const selected = valuesArr.includes(value);
|
|
636
|
+
const toggleValue = (newValue) => {
|
|
637
|
+
if (selected) {
|
|
638
|
+
updateValues(valuesArr.filter((v) => v !== newValue).join(" ") || null);
|
|
639
|
+
} else {
|
|
640
|
+
updateValues([...valuesArr, newValue].join(" "));
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
return /* @__PURE__ */ React14.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
|
|
644
|
+
};
|
|
645
|
+
var ToggleButton = ({ onChange, ...props }) => {
|
|
646
|
+
const handleChange = (_e, newValue) => {
|
|
647
|
+
onChange(newValue);
|
|
648
|
+
};
|
|
649
|
+
return /* @__PURE__ */ React14.createElement(import_ui11.ToggleButton, { ...props, onChange: handleChange, size: "tiny", sx: { px: 1.5 } });
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
// src/components/style-sections/typography-section.tsx
|
|
653
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
654
|
+
var TypographySection = () => {
|
|
655
|
+
return /* @__PURE__ */ React15.createElement(CollapsibleSection, { title: (0, import_i18n4.__)("Typography", "elementor") }, /* @__PURE__ */ React15.createElement(import_ui12.Stack, { gap: 1.5 }, /* @__PURE__ */ React15.createElement(TextStyleControl, null)));
|
|
588
656
|
};
|
|
589
657
|
|
|
590
658
|
// src/components/style-tab.tsx
|
|
@@ -592,13 +660,13 @@ var StyleTab = () => {
|
|
|
592
660
|
const { element } = useElementContext();
|
|
593
661
|
const elementStyles = useElementStyles(element.id);
|
|
594
662
|
const [selectedStyleDef = null] = Object.values(elementStyles || {});
|
|
595
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ React16.createElement(StyleContext, { selectedStyleDef }, /* @__PURE__ */ React16.createElement(import_ui13.Stack, null, /* @__PURE__ */ React16.createElement(SizeSection, null), /* @__PURE__ */ React16.createElement(TypographySection, null)));
|
|
596
664
|
};
|
|
597
665
|
|
|
598
666
|
// src/components/editing-panel-tabs.tsx
|
|
599
667
|
var EditingPanelTabs = () => {
|
|
600
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = (0,
|
|
601
|
-
return /* @__PURE__ */
|
|
668
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui14.useTabs)("settings");
|
|
669
|
+
return /* @__PURE__ */ React17.createElement(import_ui14.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React17.createElement(import_ui14.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React17.createElement(import_ui14.Tab, { label: (0, import_i18n5.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React17.createElement(import_ui14.Tab, { label: (0, import_i18n5.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React17.createElement(import_ui14.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React17.createElement(SettingsTab, null)), /* @__PURE__ */ React17.createElement(import_ui14.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React17.createElement(StyleTab, null)));
|
|
602
670
|
};
|
|
603
671
|
|
|
604
672
|
// src/components/editing-panel.tsx
|
|
@@ -609,8 +677,8 @@ var EditingPanel = () => {
|
|
|
609
677
|
if (elements.length !== 1 || !elementType) {
|
|
610
678
|
return null;
|
|
611
679
|
}
|
|
612
|
-
const panelTitle = (0,
|
|
613
|
-
return /* @__PURE__ */
|
|
680
|
+
const panelTitle = (0, import_i18n6.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
681
|
+
return /* @__PURE__ */ React18.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React18.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React18.createElement(ElementContext, { element: selectedElement }, /* @__PURE__ */ React18.createElement(EditingPanelTabs, null))));
|
|
614
682
|
};
|
|
615
683
|
|
|
616
684
|
// src/panel.ts
|