@elementor/editor-editing-panel 0.12.0 → 0.14.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 +210 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +191 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/accordion-section.tsx +25 -0
- package/src/components/collapsible-section.tsx +37 -17
- package/src/components/control-label.tsx +10 -0
- package/src/components/settings-tab.tsx +3 -3
- package/src/components/style-sections/size-section.tsx +16 -11
- package/src/components/style-sections/typography-section.tsx +15 -0
- package/src/components/style-tab.tsx +2 -0
- package/src/controls/control-types/text-style-control.tsx +90 -0
- 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.14.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-editing-panel@0.13.0...@elementor/editor-editing-panel@0.14.0) (2024-08-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **editor-editing-panel:** add collapsible section [EDS-345] ([#248](https://github.com/elementor/elementor-packages/issues/248)) ([8e362a6](https://github.com/elementor/elementor-packages/commit/8e362a6176d03f6ba89dda0aef5d4f888c7afe44))
|
|
11
|
+
|
|
12
|
+
# [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)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **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))
|
|
17
|
+
|
|
6
18
|
# [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)
|
|
7
19
|
|
|
8
20
|
### Features
|
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 React19 = __toESM(require("react"));
|
|
30
|
+
var import_i18n7 = 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_ui15 = require("@elementor/ui");
|
|
111
|
+
var React18 = __toESM(require("react"));
|
|
112
|
+
var import_i18n6 = 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
|
-
// src/components/
|
|
200
|
-
var
|
|
203
|
+
// src/components/accordion-section.tsx
|
|
204
|
+
var React4 = __toESM(require("react"));
|
|
201
205
|
var import_react3 = require("react");
|
|
202
|
-
var
|
|
203
|
-
var
|
|
206
|
+
var import_ui3 = require("@elementor/ui");
|
|
207
|
+
var AccordionSection = ({ 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,17 +245,17 @@ 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
256
|
// src/controls/control-types/image-control.tsx
|
|
253
|
-
var
|
|
254
|
-
var
|
|
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");
|
|
@@ -283,8 +287,8 @@ var ImageControl = () => {
|
|
|
283
287
|
});
|
|
284
288
|
}
|
|
285
289
|
});
|
|
286
|
-
return /* @__PURE__ */
|
|
287
|
-
|
|
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,
|
|
288
292
|
{
|
|
289
293
|
color: "inherit",
|
|
290
294
|
size: "small",
|
|
@@ -294,13 +298,13 @@ var ImageControl = () => {
|
|
|
294
298
|
}
|
|
295
299
|
},
|
|
296
300
|
(0, import_i18n.__)("Select Image", "elementor")
|
|
297
|
-
), /* @__PURE__ */
|
|
298
|
-
|
|
301
|
+
), /* @__PURE__ */ React8.createElement(
|
|
302
|
+
import_ui7.Button,
|
|
299
303
|
{
|
|
300
304
|
color: "inherit",
|
|
301
305
|
size: "small",
|
|
302
306
|
variant: "text",
|
|
303
|
-
startIcon: /* @__PURE__ */
|
|
307
|
+
startIcon: /* @__PURE__ */ React8.createElement(import_icons.UploadIcon, null),
|
|
304
308
|
onClick: () => {
|
|
305
309
|
open({ mode: "upload" });
|
|
306
310
|
}
|
|
@@ -327,14 +331,14 @@ var SettingsTab = () => {
|
|
|
327
331
|
if (!elementType) {
|
|
328
332
|
return null;
|
|
329
333
|
}
|
|
330
|
-
return /* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ React9.createElement(import_ui8.Stack, null, elementType.controls.map(({ type, value }, index) => {
|
|
331
335
|
if (type === "control") {
|
|
332
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: value.bind, control: value });
|
|
333
337
|
}
|
|
334
338
|
if (type === "section") {
|
|
335
|
-
return /* @__PURE__ */
|
|
339
|
+
return /* @__PURE__ */ React9.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
336
340
|
if (item.type === "control") {
|
|
337
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: item.value.bind, control: item.value });
|
|
338
342
|
}
|
|
339
343
|
return null;
|
|
340
344
|
}));
|
|
@@ -347,7 +351,7 @@ var Control = ({ control }) => {
|
|
|
347
351
|
if (!ControlComponent) {
|
|
348
352
|
return null;
|
|
349
353
|
}
|
|
350
|
-
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(
|
|
351
355
|
ControlComponent,
|
|
352
356
|
{
|
|
353
357
|
...control.props
|
|
@@ -356,17 +360,17 @@ var Control = ({ control }) => {
|
|
|
356
360
|
};
|
|
357
361
|
|
|
358
362
|
// src/components/style-tab.tsx
|
|
359
|
-
var
|
|
363
|
+
var React17 = __toESM(require("react"));
|
|
360
364
|
|
|
361
365
|
// src/contexts/style-context.tsx
|
|
362
|
-
var
|
|
366
|
+
var React10 = __toESM(require("react"));
|
|
363
367
|
var import_react4 = require("react");
|
|
364
368
|
var import_editor_responsive = require("@elementor/editor-responsive");
|
|
365
369
|
var Context2 = (0, import_react4.createContext)(null);
|
|
366
370
|
function StyleContext({ children, selectedStyleDef }) {
|
|
367
371
|
const breakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
|
|
368
372
|
const selectedMeta = { breakpoint, state: null };
|
|
369
|
-
return /* @__PURE__ */
|
|
373
|
+
return /* @__PURE__ */ React10.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta } }, children);
|
|
370
374
|
}
|
|
371
375
|
function useStyleContext() {
|
|
372
376
|
const context = (0, import_react4.useContext)(Context2);
|
|
@@ -397,37 +401,24 @@ var useElementStyles = (elementID) => {
|
|
|
397
401
|
};
|
|
398
402
|
|
|
399
403
|
// src/components/style-tab.tsx
|
|
400
|
-
var
|
|
404
|
+
var import_ui14 = require("@elementor/ui");
|
|
401
405
|
|
|
402
406
|
// src/components/style-sections/size-section.tsx
|
|
403
|
-
var
|
|
407
|
+
var React14 = __toESM(require("react"));
|
|
404
408
|
|
|
405
409
|
// src/controls/style-control.tsx
|
|
406
|
-
var
|
|
407
|
-
|
|
408
|
-
// src/sync/update-style.ts
|
|
409
|
-
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
410
|
-
var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
|
|
411
|
-
const container = getContainer(elementID);
|
|
412
|
-
(0, import_editor_v1_adapters6.__privateRunCommand)("document/atomic-widgets/styles", {
|
|
413
|
-
container,
|
|
414
|
-
styleDefID,
|
|
415
|
-
bind,
|
|
416
|
-
meta,
|
|
417
|
-
props
|
|
418
|
-
});
|
|
419
|
-
};
|
|
410
|
+
var React11 = __toESM(require("react"));
|
|
420
411
|
|
|
421
412
|
// src/hooks/use-element-style-prop.ts
|
|
422
|
-
var
|
|
413
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
423
414
|
var useElementStyleProp = ({
|
|
424
415
|
elementID,
|
|
425
416
|
styleDefID,
|
|
426
417
|
meta,
|
|
427
418
|
propName
|
|
428
419
|
}) => {
|
|
429
|
-
return (0,
|
|
430
|
-
(0,
|
|
420
|
+
return (0, import_editor_v1_adapters6.__privateUseListenTo)(
|
|
421
|
+
(0, import_editor_v1_adapters6.commandEndEvent)("document/atomic-widgets/styles"),
|
|
431
422
|
() => {
|
|
432
423
|
if (!styleDefID) {
|
|
433
424
|
return null;
|
|
@@ -448,38 +439,86 @@ function getVariantByMeta(styleDef, meta) {
|
|
|
448
439
|
});
|
|
449
440
|
}
|
|
450
441
|
|
|
451
|
-
// src/
|
|
452
|
-
var
|
|
453
|
-
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) => {
|
|
454
457
|
const { element } = useElementContext();
|
|
455
458
|
const { selectedStyleDef, selectedMeta } = useStyleContext();
|
|
459
|
+
const value = useElementStyleProp({
|
|
460
|
+
elementID: element.id,
|
|
461
|
+
styleDefID: selectedStyleDef?.id,
|
|
462
|
+
meta: selectedMeta,
|
|
463
|
+
propName
|
|
464
|
+
});
|
|
456
465
|
const setValue = (newValue) => {
|
|
457
466
|
updateStyle({
|
|
458
467
|
elementID: element.id,
|
|
459
468
|
styleDefID: selectedStyleDef?.id,
|
|
460
|
-
props: { [
|
|
469
|
+
props: { [propName]: newValue },
|
|
461
470
|
meta: selectedMeta
|
|
462
471
|
});
|
|
463
472
|
};
|
|
464
|
-
|
|
465
|
-
elementID: element.id,
|
|
466
|
-
styleDefID: selectedStyleDef?.id,
|
|
467
|
-
meta: selectedMeta,
|
|
468
|
-
propName: bind
|
|
469
|
-
});
|
|
470
|
-
return /* @__PURE__ */ React10.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
473
|
+
return [value, setValue];
|
|
471
474
|
};
|
|
472
|
-
|
|
473
|
-
|
|
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);
|
|
474
480
|
};
|
|
475
|
-
StyleControl.Label =
|
|
481
|
+
StyleControl.Label = ControlLabel;
|
|
476
482
|
|
|
477
|
-
// src/
|
|
478
|
-
var
|
|
483
|
+
// src/components/collapsible-section.tsx
|
|
484
|
+
var React12 = __toESM(require("react"));
|
|
485
|
+
var import_react5 = require("react");
|
|
486
|
+
var import_icons2 = require("@elementor/icons");
|
|
479
487
|
var import_ui9 = require("@elementor/ui");
|
|
488
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
489
|
+
var CollapsibleSection = ({ children, defaultOpen = false }) => {
|
|
490
|
+
const [open, setOpen] = (0, import_react5.useState)(defaultOpen);
|
|
491
|
+
const handleToggle = () => {
|
|
492
|
+
setOpen((prevOpen) => !prevOpen);
|
|
493
|
+
};
|
|
494
|
+
return /* @__PURE__ */ React12.createElement(import_ui9.Stack, { sx: { py: 0.5 } }, /* @__PURE__ */ React12.createElement(
|
|
495
|
+
import_ui9.Button,
|
|
496
|
+
{
|
|
497
|
+
fullWidth: true,
|
|
498
|
+
size: "small",
|
|
499
|
+
color: "secondary",
|
|
500
|
+
variant: "outlined",
|
|
501
|
+
onClick: handleToggle,
|
|
502
|
+
endIcon: /* @__PURE__ */ React12.createElement(ChevronIcon, { open })
|
|
503
|
+
},
|
|
504
|
+
open ? (0, import_i18n2.__)("Show less", "elementor") : (0, import_i18n2.__)("Show more", "elementor")
|
|
505
|
+
), /* @__PURE__ */ React12.createElement(import_ui9.Collapse, { in: open, timeout: "auto" }, children));
|
|
506
|
+
};
|
|
507
|
+
var ChevronIcon = (0, import_ui9.styled)(import_icons2.ChevronDownIcon, {
|
|
508
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
509
|
+
})(({ theme, open }) => ({
|
|
510
|
+
transform: open ? "rotate(180deg)" : "rotate(0)",
|
|
511
|
+
transition: theme.transitions.create("transform", {
|
|
512
|
+
duration: theme.transitions.duration.standard
|
|
513
|
+
})
|
|
514
|
+
}));
|
|
515
|
+
|
|
516
|
+
// src/controls/control-types/size-control.tsx
|
|
517
|
+
var React13 = __toESM(require("react"));
|
|
518
|
+
var import_ui10 = require("@elementor/ui");
|
|
480
519
|
|
|
481
520
|
// src/controls/hooks/use-sync-external-state.tsx
|
|
482
|
-
var
|
|
521
|
+
var import_react6 = require("react");
|
|
483
522
|
var useSyncExternalState = ({
|
|
484
523
|
external,
|
|
485
524
|
setExternal,
|
|
@@ -498,8 +537,8 @@ var useSyncExternalState = ({
|
|
|
498
537
|
}
|
|
499
538
|
return externalValue;
|
|
500
539
|
}
|
|
501
|
-
const [internal, setInternal] = (0,
|
|
502
|
-
(0,
|
|
540
|
+
const [internal, setInternal] = (0, import_react6.useState)(toInternal(external, void 0));
|
|
541
|
+
(0, import_react6.useEffect)(() => {
|
|
503
542
|
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
504
543
|
}, [external]);
|
|
505
544
|
const setInternalValue = (setter) => {
|
|
@@ -543,8 +582,8 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
543
582
|
}
|
|
544
583
|
}));
|
|
545
584
|
};
|
|
546
|
-
return /* @__PURE__ */
|
|
547
|
-
|
|
585
|
+
return /* @__PURE__ */ React13.createElement(import_ui10.Stack, { direction: "row" }, /* @__PURE__ */ React13.createElement(
|
|
586
|
+
import_ui10.TextField,
|
|
548
587
|
{
|
|
549
588
|
size: "tiny",
|
|
550
589
|
type: "number",
|
|
@@ -552,8 +591,8 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
552
591
|
onChange: handleSizeChange,
|
|
553
592
|
placeholder
|
|
554
593
|
}
|
|
555
|
-
), /* @__PURE__ */
|
|
556
|
-
|
|
594
|
+
), /* @__PURE__ */ React13.createElement(
|
|
595
|
+
import_ui10.Select,
|
|
557
596
|
{
|
|
558
597
|
size: "tiny",
|
|
559
598
|
value: state.value.unit,
|
|
@@ -563,19 +602,90 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
563
602
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
564
603
|
}
|
|
565
604
|
},
|
|
566
|
-
units2.map((unit) => /* @__PURE__ */
|
|
605
|
+
units2.map((unit) => /* @__PURE__ */ React13.createElement(import_ui10.MenuItem, { key: unit, value: unit }, unit.toUpperCase()))
|
|
567
606
|
));
|
|
568
607
|
};
|
|
569
608
|
|
|
570
609
|
// src/components/style-sections/size-section.tsx
|
|
571
|
-
var
|
|
572
|
-
var
|
|
610
|
+
var import_ui11 = require("@elementor/ui");
|
|
611
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
573
612
|
var SizeSection = () => {
|
|
574
|
-
return /* @__PURE__ */
|
|
613
|
+
return /* @__PURE__ */ React14.createElement(AccordionSection, { title: (0, import_i18n3.__)("Size", "elementor") }, /* @__PURE__ */ React14.createElement(import_ui11.Stack, { gap: 1.5 }, /* @__PURE__ */ React14.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React14.createElement(Control2, { bind: "width", label: (0, import_i18n3.__)("Width", "elementor") }), /* @__PURE__ */ React14.createElement(Control2, { bind: "height", label: (0, import_i18n3.__)("Height", "elementor") })), /* @__PURE__ */ React14.createElement(CollapsibleSection, null, /* @__PURE__ */ React14.createElement(import_ui11.Stack, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React14.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React14.createElement(Control2, { bind: "minWidth", label: (0, import_i18n3.__)("Min. Width", "elementor") }), /* @__PURE__ */ React14.createElement(Control2, { bind: "minHeight", label: (0, import_i18n3.__)("Min. Height", "elementor") })), /* @__PURE__ */ React14.createElement(import_ui11.Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React14.createElement(Control2, { bind: "maxWidth", label: (0, import_i18n3.__)("Max. Width", "elementor") }), /* @__PURE__ */ React14.createElement(Control2, { bind: "maxHeight", label: (0, import_i18n3.__)("Max. Height", "elementor") }))))));
|
|
575
614
|
};
|
|
576
615
|
var units = ["px", "%", "em", "rem", "vw"];
|
|
577
616
|
var Control2 = ({ label, bind }) => {
|
|
578
|
-
return /* @__PURE__ */
|
|
617
|
+
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 })));
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
// src/components/style-sections/typography-section.tsx
|
|
621
|
+
var React16 = __toESM(require("react"));
|
|
622
|
+
var import_ui13 = require("@elementor/ui");
|
|
623
|
+
|
|
624
|
+
// src/controls/control-types/text-style-control.tsx
|
|
625
|
+
var React15 = __toESM(require("react"));
|
|
626
|
+
var import_ui12 = require("@elementor/ui");
|
|
627
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
628
|
+
var TextStyleControl = () => {
|
|
629
|
+
const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
|
|
630
|
+
const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
|
|
631
|
+
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
632
|
+
return /* @__PURE__ */ React15.createElement(import_ui12.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React15.createElement(ControlLabel, null, (0, import_i18n4.__)("Style", "elementor")), /* @__PURE__ */ React15.createElement(import_ui12.ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React15.createElement(
|
|
633
|
+
ToggleButton,
|
|
634
|
+
{
|
|
635
|
+
value: "italic",
|
|
636
|
+
onChange: (v) => setFontStyle(fontStyle === v ? null : v),
|
|
637
|
+
"aria-label": "italic"
|
|
638
|
+
},
|
|
639
|
+
/* @__PURE__ */ React15.createElement("span", { style: { fontStyle: "italic", fontSize: "12px" } }, "I")
|
|
640
|
+
), /* @__PURE__ */ React15.createElement(
|
|
641
|
+
ShorthandControl,
|
|
642
|
+
{
|
|
643
|
+
value: "line-through",
|
|
644
|
+
currentValues: textDecoration || "",
|
|
645
|
+
updateValues: setTextDecoration,
|
|
646
|
+
"aria-label": "line-through"
|
|
647
|
+
},
|
|
648
|
+
/* @__PURE__ */ React15.createElement("span", { style: { textDecoration: "line-through", fontSize: "12px" } }, "S")
|
|
649
|
+
), /* @__PURE__ */ React15.createElement(
|
|
650
|
+
ShorthandControl,
|
|
651
|
+
{
|
|
652
|
+
value: "underline",
|
|
653
|
+
currentValues: textDecoration || "",
|
|
654
|
+
updateValues: setTextDecoration,
|
|
655
|
+
"aria-label": "underline"
|
|
656
|
+
},
|
|
657
|
+
/* @__PURE__ */ React15.createElement("span", { style: { textDecoration: "underline", fontSize: "12px" } }, "U")
|
|
658
|
+
)));
|
|
659
|
+
};
|
|
660
|
+
var ShorthandControl = ({
|
|
661
|
+
children,
|
|
662
|
+
value,
|
|
663
|
+
currentValues,
|
|
664
|
+
updateValues,
|
|
665
|
+
"aria-label": ariaLabel
|
|
666
|
+
}) => {
|
|
667
|
+
const valuesArr = currentValues.split(" ").filter(Boolean);
|
|
668
|
+
const selected = valuesArr.includes(value);
|
|
669
|
+
const toggleValue = (newValue) => {
|
|
670
|
+
if (selected) {
|
|
671
|
+
updateValues(valuesArr.filter((v) => v !== newValue).join(" ") || null);
|
|
672
|
+
} else {
|
|
673
|
+
updateValues([...valuesArr, newValue].join(" "));
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
return /* @__PURE__ */ React15.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
|
|
677
|
+
};
|
|
678
|
+
var ToggleButton = ({ onChange, ...props }) => {
|
|
679
|
+
const handleChange = (_e, newValue) => {
|
|
680
|
+
onChange(newValue);
|
|
681
|
+
};
|
|
682
|
+
return /* @__PURE__ */ React15.createElement(import_ui12.ToggleButton, { ...props, onChange: handleChange, size: "tiny", sx: { px: 1.5 } });
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// src/components/style-sections/typography-section.tsx
|
|
686
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
687
|
+
var TypographySection = () => {
|
|
688
|
+
return /* @__PURE__ */ React16.createElement(AccordionSection, { title: (0, import_i18n5.__)("Typography", "elementor") }, /* @__PURE__ */ React16.createElement(import_ui13.Stack, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(TextStyleControl, null)));
|
|
579
689
|
};
|
|
580
690
|
|
|
581
691
|
// src/components/style-tab.tsx
|
|
@@ -583,13 +693,13 @@ var StyleTab = () => {
|
|
|
583
693
|
const { element } = useElementContext();
|
|
584
694
|
const elementStyles = useElementStyles(element.id);
|
|
585
695
|
const [selectedStyleDef = null] = Object.values(elementStyles || {});
|
|
586
|
-
return /* @__PURE__ */
|
|
696
|
+
return /* @__PURE__ */ React17.createElement(StyleContext, { selectedStyleDef }, /* @__PURE__ */ React17.createElement(import_ui14.Stack, null, /* @__PURE__ */ React17.createElement(SizeSection, null), /* @__PURE__ */ React17.createElement(TypographySection, null)));
|
|
587
697
|
};
|
|
588
698
|
|
|
589
699
|
// src/components/editing-panel-tabs.tsx
|
|
590
700
|
var EditingPanelTabs = () => {
|
|
591
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = (0,
|
|
592
|
-
return /* @__PURE__ */
|
|
701
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = (0, import_ui15.useTabs)("settings");
|
|
702
|
+
return /* @__PURE__ */ React18.createElement(import_ui15.Stack, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React18.createElement(import_ui15.Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React18.createElement(import_ui15.Tab, { label: (0, import_i18n6.__)("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React18.createElement(import_ui15.Tab, { label: (0, import_i18n6.__)("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React18.createElement(import_ui15.TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React18.createElement(SettingsTab, null)), /* @__PURE__ */ React18.createElement(import_ui15.TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React18.createElement(StyleTab, null)));
|
|
593
703
|
};
|
|
594
704
|
|
|
595
705
|
// src/components/editing-panel.tsx
|
|
@@ -600,8 +710,8 @@ var EditingPanel = () => {
|
|
|
600
710
|
if (elements.length !== 1 || !elementType) {
|
|
601
711
|
return null;
|
|
602
712
|
}
|
|
603
|
-
const panelTitle = (0,
|
|
604
|
-
return /* @__PURE__ */
|
|
713
|
+
const panelTitle = (0, import_i18n7.__)("Edit %s", "elementor").replace("%s", elementType.title);
|
|
714
|
+
return /* @__PURE__ */ React19.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React19.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React19.createElement(import_editor_panels.PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React19.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React19.createElement(ElementContext, { element: selectedElement }, /* @__PURE__ */ React19.createElement(EditingPanelTabs, null))));
|
|
605
715
|
};
|
|
606
716
|
|
|
607
717
|
// src/panel.ts
|
|
@@ -624,11 +734,11 @@ var shouldUseV2Panel = () => {
|
|
|
624
734
|
};
|
|
625
735
|
|
|
626
736
|
// src/hooks/use-open-editor-panel.ts
|
|
627
|
-
var
|
|
737
|
+
var import_react7 = require("react");
|
|
628
738
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
629
739
|
var useOpenEditorPanel = () => {
|
|
630
740
|
const { open } = usePanelActions();
|
|
631
|
-
(0,
|
|
741
|
+
(0, import_react7.useEffect)(() => {
|
|
632
742
|
return (0, import_editor_v1_adapters8.__privateListenTo)((0, import_editor_v1_adapters8.commandStartEvent)("panel/editor/open"), () => {
|
|
633
743
|
if (shouldUseV2Panel()) {
|
|
634
744
|
open();
|