@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/dist/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { __createPanel as createPanel } from "@elementor/editor-panels";
|
|
3
3
|
|
|
4
4
|
// src/components/editing-panel.tsx
|
|
5
|
-
import * as
|
|
6
|
-
import { __ as
|
|
5
|
+
import * as React18 from "react";
|
|
6
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
7
7
|
|
|
8
8
|
// src/hooks/use-selected-elements.ts
|
|
9
9
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
@@ -83,16 +83,16 @@ function useElementContext() {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// src/components/editing-panel-tabs.tsx
|
|
86
|
-
import { Stack as
|
|
87
|
-
import * as
|
|
88
|
-
import { __ as
|
|
86
|
+
import { Stack as Stack9, Tabs, Tab, TabPanel, useTabs } from "@elementor/ui";
|
|
87
|
+
import * as React17 from "react";
|
|
88
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
89
89
|
|
|
90
90
|
// src/components/settings-tab.tsx
|
|
91
|
-
import * as
|
|
91
|
+
import * as React9 from "react";
|
|
92
92
|
import { Stack as Stack3 } from "@elementor/ui";
|
|
93
93
|
|
|
94
94
|
// src/controls/settings-control.tsx
|
|
95
|
-
import * as
|
|
95
|
+
import * as React3 from "react";
|
|
96
96
|
|
|
97
97
|
// src/controls/control-context.tsx
|
|
98
98
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -106,7 +106,7 @@ function useControl(defaultValue) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// src/controls/settings-control.tsx
|
|
109
|
-
import { Stack, styled
|
|
109
|
+
import { Stack, styled } from "@elementor/ui";
|
|
110
110
|
|
|
111
111
|
// src/hooks/use-widget-settings.ts
|
|
112
112
|
import { commandEndEvent as commandEndEvent3, __privateUseListenTo as useListenTo3 } from "@elementor/editor-v1-adapters";
|
|
@@ -143,6 +143,13 @@ var updateSettings = ({ id, props }) => {
|
|
|
143
143
|
});
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
+
// src/components/control-label.tsx
|
|
147
|
+
import * as React2 from "react";
|
|
148
|
+
import { Typography } from "@elementor/ui";
|
|
149
|
+
var ControlLabel = ({ children }) => {
|
|
150
|
+
return /* @__PURE__ */ React2.createElement(Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
151
|
+
};
|
|
152
|
+
|
|
146
153
|
// src/controls/settings-control.tsx
|
|
147
154
|
var SettingsControlProvider = ({ bind, children }) => {
|
|
148
155
|
const { element } = useElementContext();
|
|
@@ -155,9 +162,9 @@ var SettingsControlProvider = ({ bind, children }) => {
|
|
|
155
162
|
}
|
|
156
163
|
});
|
|
157
164
|
};
|
|
158
|
-
return /* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ React3.createElement(ControlContext.Provider, { value: { setValue, value, bind } }, children);
|
|
159
166
|
};
|
|
160
|
-
var SettingsControl = ({ children, bind }) => /* @__PURE__ */
|
|
167
|
+
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));
|
|
161
168
|
var StyledStack = styled(Stack)`
|
|
162
169
|
& > * {
|
|
163
170
|
flex-grow: 1;
|
|
@@ -167,42 +174,39 @@ var StyledStack = styled(Stack)`
|
|
|
167
174
|
min-width: 50%;
|
|
168
175
|
}
|
|
169
176
|
`;
|
|
170
|
-
|
|
171
|
-
return /* @__PURE__ */ React2.createElement(Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
172
|
-
};
|
|
173
|
-
SettingsControl.Label = Label;
|
|
177
|
+
SettingsControl.Label = ControlLabel;
|
|
174
178
|
|
|
175
179
|
// src/components/collapsible-section.tsx
|
|
176
|
-
import * as
|
|
180
|
+
import * as React4 from "react";
|
|
177
181
|
import { useId } from "react";
|
|
178
182
|
import { Accordion, AccordionSummary, AccordionDetails, AccordionSummaryText, Stack as Stack2 } from "@elementor/ui";
|
|
179
183
|
var CollapsibleSection = ({ title, children }) => {
|
|
180
184
|
const uid = useId();
|
|
181
185
|
const labelId = `label-${uid}`;
|
|
182
186
|
const contentId = `content-${uid}`;
|
|
183
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ React4.createElement(Accordion, { disableGutters: true, defaultExpanded: true }, /* @__PURE__ */ React4.createElement(AccordionSummary, { "aria-controls": contentId, id: labelId }, /* @__PURE__ */ React4.createElement(AccordionSummaryText, { primaryTypographyProps: { variant: "caption" } }, title)), /* @__PURE__ */ React4.createElement(AccordionDetails, { id: contentId, "aria-labelledby": labelId }, /* @__PURE__ */ React4.createElement(Stack2, { gap: 2.5 }, children)));
|
|
184
188
|
};
|
|
185
189
|
|
|
186
190
|
// src/controls/control-types/select-control.tsx
|
|
187
|
-
import * as
|
|
191
|
+
import * as React5 from "react";
|
|
188
192
|
import { MenuItem, Select } from "@elementor/ui";
|
|
189
193
|
var SelectControl = ({ options }) => {
|
|
190
194
|
const { value, setValue } = useControl();
|
|
191
195
|
const handleChange = (event) => {
|
|
192
196
|
setValue(event.target.value);
|
|
193
197
|
};
|
|
194
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ React5.createElement(Select, { size: "tiny", value: value ?? "", onChange: handleChange }, options.map(({ label, ...props }) => /* @__PURE__ */ React5.createElement(MenuItem, { key: props.value, ...props }, label)));
|
|
195
199
|
};
|
|
196
200
|
|
|
197
201
|
// src/controls/control-types/text-area-control.tsx
|
|
198
|
-
import * as
|
|
202
|
+
import * as React6 from "react";
|
|
199
203
|
import { TextField } from "@elementor/ui";
|
|
200
204
|
var TextAreaControl = ({ placeholder }) => {
|
|
201
205
|
const { value, setValue } = useControl("");
|
|
202
206
|
const handleChange = (event) => {
|
|
203
207
|
setValue(event.target.value);
|
|
204
208
|
};
|
|
205
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ React6.createElement(
|
|
206
210
|
TextField,
|
|
207
211
|
{
|
|
208
212
|
size: "tiny",
|
|
@@ -217,58 +221,49 @@ var TextAreaControl = ({ placeholder }) => {
|
|
|
217
221
|
};
|
|
218
222
|
|
|
219
223
|
// src/controls/control-types/text-control.tsx
|
|
220
|
-
import * as
|
|
224
|
+
import * as React7 from "react";
|
|
221
225
|
import { TextField as TextField2 } from "@elementor/ui";
|
|
222
226
|
var TextControl = ({ placeholder }) => {
|
|
223
227
|
const { value, setValue } = useControl("");
|
|
224
228
|
const handleChange = (event) => setValue(event.target.value);
|
|
225
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ React7.createElement(TextField2, { type: "text", size: "tiny", value, onChange: handleChange, placeholder });
|
|
226
230
|
};
|
|
227
231
|
|
|
228
|
-
// src/controls/control-types/
|
|
229
|
-
import * as
|
|
232
|
+
// src/controls/control-types/image-control.tsx
|
|
233
|
+
import * as React8 from "react";
|
|
230
234
|
import { Button, Card, CardMedia, CardOverlay } from "@elementor/ui";
|
|
231
235
|
import { UploadIcon } from "@elementor/icons";
|
|
232
236
|
import { __ } from "@wordpress/i18n";
|
|
233
237
|
import { useWpMediaAttachment, useWpMediaFrame } from "@elementor/wp-media";
|
|
234
|
-
var isImageAttachment = (value) => {
|
|
235
|
-
return value?.$$type === "image-attachment";
|
|
236
|
-
};
|
|
237
|
-
var isImageUrl = (value) => {
|
|
238
|
-
return value?.$$type === "image-url";
|
|
239
|
-
};
|
|
240
238
|
var defaultState = {
|
|
241
|
-
$$type: "image
|
|
239
|
+
$$type: "image",
|
|
242
240
|
value: {
|
|
243
241
|
url: "/wp-content/plugins/elementor/assets/images/placeholder.png"
|
|
244
242
|
}
|
|
245
243
|
};
|
|
246
|
-
var
|
|
244
|
+
var ImageControl = () => {
|
|
247
245
|
const { value, setValue } = useControl(defaultState);
|
|
248
|
-
const { data: attachment } = useWpMediaAttachment(
|
|
246
|
+
const { data: attachment } = useWpMediaAttachment(value?.value?.attachmentId);
|
|
249
247
|
const getImageSrc = () => {
|
|
250
248
|
if (attachment?.url) {
|
|
251
249
|
return attachment.url;
|
|
252
250
|
}
|
|
253
|
-
|
|
254
|
-
return value.value.url;
|
|
255
|
-
}
|
|
256
|
-
return defaultState.value.url;
|
|
251
|
+
return value?.value?.url ?? defaultState.value.url;
|
|
257
252
|
};
|
|
258
253
|
const { open } = useWpMediaFrame({
|
|
259
|
-
types:
|
|
254
|
+
types: ["image"],
|
|
260
255
|
multiple: false,
|
|
261
|
-
selected:
|
|
262
|
-
onSelect: (
|
|
256
|
+
selected: value?.value?.attachmentId,
|
|
257
|
+
onSelect: (selectedAttachment) => {
|
|
263
258
|
setValue({
|
|
264
|
-
$$type: "image
|
|
259
|
+
$$type: "image",
|
|
265
260
|
value: {
|
|
266
|
-
|
|
261
|
+
attachmentId: selectedAttachment.id
|
|
267
262
|
}
|
|
268
263
|
});
|
|
269
264
|
}
|
|
270
265
|
});
|
|
271
|
-
return /* @__PURE__ */
|
|
266
|
+
return /* @__PURE__ */ React8.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React8.createElement(CardMedia, { image: getImageSrc(), sx: { height: 150 } }), /* @__PURE__ */ React8.createElement(CardOverlay, null, /* @__PURE__ */ React8.createElement(
|
|
272
267
|
Button,
|
|
273
268
|
{
|
|
274
269
|
color: "inherit",
|
|
@@ -279,13 +274,13 @@ var AttachmentControl = (props) => {
|
|
|
279
274
|
}
|
|
280
275
|
},
|
|
281
276
|
__("Select Image", "elementor")
|
|
282
|
-
), /* @__PURE__ */
|
|
277
|
+
), /* @__PURE__ */ React8.createElement(
|
|
283
278
|
Button,
|
|
284
279
|
{
|
|
285
280
|
color: "inherit",
|
|
286
281
|
size: "small",
|
|
287
282
|
variant: "text",
|
|
288
|
-
startIcon: /* @__PURE__ */
|
|
283
|
+
startIcon: /* @__PURE__ */ React8.createElement(UploadIcon, null),
|
|
289
284
|
onClick: () => {
|
|
290
285
|
open({ mode: "upload" });
|
|
291
286
|
}
|
|
@@ -296,7 +291,7 @@ var AttachmentControl = (props) => {
|
|
|
296
291
|
|
|
297
292
|
// src/controls/get-control-by-type.ts
|
|
298
293
|
var controlTypes = {
|
|
299
|
-
|
|
294
|
+
image: ImageControl,
|
|
300
295
|
select: SelectControl,
|
|
301
296
|
text: TextControl,
|
|
302
297
|
textarea: TextAreaControl
|
|
@@ -312,14 +307,14 @@ var SettingsTab = () => {
|
|
|
312
307
|
if (!elementType) {
|
|
313
308
|
return null;
|
|
314
309
|
}
|
|
315
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ React9.createElement(Stack3, null, elementType.controls.map(({ type, value }, index) => {
|
|
316
311
|
if (type === "control") {
|
|
317
|
-
return /* @__PURE__ */
|
|
312
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: value.bind, control: value });
|
|
318
313
|
}
|
|
319
314
|
if (type === "section") {
|
|
320
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ React9.createElement(CollapsibleSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
321
316
|
if (item.type === "control") {
|
|
322
|
-
return /* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: item.value.bind, control: item.value });
|
|
323
318
|
}
|
|
324
319
|
return null;
|
|
325
320
|
}));
|
|
@@ -332,7 +327,7 @@ var Control = ({ control }) => {
|
|
|
332
327
|
if (!ControlComponent) {
|
|
333
328
|
return null;
|
|
334
329
|
}
|
|
335
|
-
return /* @__PURE__ */
|
|
330
|
+
return /* @__PURE__ */ React9.createElement(SettingsControl, { bind: control.bind }, control.label ? /* @__PURE__ */ React9.createElement(SettingsControl.Label, null, control.label) : null, /* @__PURE__ */ React9.createElement(
|
|
336
331
|
ControlComponent,
|
|
337
332
|
{
|
|
338
333
|
...control.props
|
|
@@ -341,17 +336,17 @@ var Control = ({ control }) => {
|
|
|
341
336
|
};
|
|
342
337
|
|
|
343
338
|
// src/components/style-tab.tsx
|
|
344
|
-
import * as
|
|
339
|
+
import * as React16 from "react";
|
|
345
340
|
|
|
346
341
|
// src/contexts/style-context.tsx
|
|
347
|
-
import * as
|
|
342
|
+
import * as React10 from "react";
|
|
348
343
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
349
344
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
350
345
|
var Context2 = createContext3(null);
|
|
351
346
|
function StyleContext({ children, selectedStyleDef }) {
|
|
352
347
|
const breakpoint = useActiveBreakpoint();
|
|
353
348
|
const selectedMeta = { breakpoint, state: null };
|
|
354
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ React10.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta } }, children);
|
|
355
350
|
}
|
|
356
351
|
function useStyleContext() {
|
|
357
352
|
const context = useContext3(Context2);
|
|
@@ -382,26 +377,13 @@ var useElementStyles = (elementID) => {
|
|
|
382
377
|
};
|
|
383
378
|
|
|
384
379
|
// src/components/style-tab.tsx
|
|
385
|
-
import { Stack as
|
|
380
|
+
import { Stack as Stack8 } from "@elementor/ui";
|
|
386
381
|
|
|
387
382
|
// src/components/style-sections/size-section.tsx
|
|
388
|
-
import * as
|
|
383
|
+
import * as React13 from "react";
|
|
389
384
|
|
|
390
385
|
// src/controls/style-control.tsx
|
|
391
|
-
import * as
|
|
392
|
-
|
|
393
|
-
// src/sync/update-style.ts
|
|
394
|
-
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
395
|
-
var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
|
|
396
|
-
const container = getContainer(elementID);
|
|
397
|
-
runCommand2("document/atomic-widgets/styles", {
|
|
398
|
-
container,
|
|
399
|
-
styleDefID,
|
|
400
|
-
bind,
|
|
401
|
-
meta,
|
|
402
|
-
props
|
|
403
|
-
});
|
|
404
|
-
};
|
|
386
|
+
import * as React11 from "react";
|
|
405
387
|
|
|
406
388
|
// src/hooks/use-element-style-prop.ts
|
|
407
389
|
import { commandEndEvent as commandEndEvent5, __privateUseListenTo as useListenTo5 } from "@elementor/editor-v1-adapters";
|
|
@@ -433,34 +415,49 @@ function getVariantByMeta(styleDef, meta) {
|
|
|
433
415
|
});
|
|
434
416
|
}
|
|
435
417
|
|
|
436
|
-
// src/
|
|
437
|
-
import {
|
|
438
|
-
var
|
|
418
|
+
// src/sync/update-style.ts
|
|
419
|
+
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
420
|
+
var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
|
|
421
|
+
const container = getContainer(elementID);
|
|
422
|
+
runCommand2("document/atomic-widgets/styles", {
|
|
423
|
+
container,
|
|
424
|
+
styleDefID,
|
|
425
|
+
bind,
|
|
426
|
+
meta,
|
|
427
|
+
props
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/controls/hooks/use-style-control.ts
|
|
432
|
+
var useStyleControl = (propName) => {
|
|
439
433
|
const { element } = useElementContext();
|
|
440
434
|
const { selectedStyleDef, selectedMeta } = useStyleContext();
|
|
435
|
+
const value = useElementStyleProp({
|
|
436
|
+
elementID: element.id,
|
|
437
|
+
styleDefID: selectedStyleDef?.id,
|
|
438
|
+
meta: selectedMeta,
|
|
439
|
+
propName
|
|
440
|
+
});
|
|
441
441
|
const setValue = (newValue) => {
|
|
442
442
|
updateStyle({
|
|
443
443
|
elementID: element.id,
|
|
444
444
|
styleDefID: selectedStyleDef?.id,
|
|
445
|
-
props: { [
|
|
445
|
+
props: { [propName]: newValue },
|
|
446
446
|
meta: selectedMeta
|
|
447
447
|
});
|
|
448
448
|
};
|
|
449
|
-
|
|
450
|
-
elementID: element.id,
|
|
451
|
-
styleDefID: selectedStyleDef?.id,
|
|
452
|
-
meta: selectedMeta,
|
|
453
|
-
propName: bind
|
|
454
|
-
});
|
|
455
|
-
return /* @__PURE__ */ React10.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
449
|
+
return [value, setValue];
|
|
456
450
|
};
|
|
457
|
-
|
|
458
|
-
|
|
451
|
+
|
|
452
|
+
// src/controls/style-control.tsx
|
|
453
|
+
var StyleControl = ({ bind, children }) => {
|
|
454
|
+
const [value, setValue] = useStyleControl(bind);
|
|
455
|
+
return /* @__PURE__ */ React11.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
459
456
|
};
|
|
460
|
-
StyleControl.Label =
|
|
457
|
+
StyleControl.Label = ControlLabel;
|
|
461
458
|
|
|
462
459
|
// src/controls/control-types/size-control.tsx
|
|
463
|
-
import * as
|
|
460
|
+
import * as React12 from "react";
|
|
464
461
|
import { MenuItem as MenuItem2, Select as Select2, Stack as Stack4, TextField as TextField3 } from "@elementor/ui";
|
|
465
462
|
|
|
466
463
|
// src/controls/hooks/use-sync-external-state.tsx
|
|
@@ -528,7 +525,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
528
525
|
}
|
|
529
526
|
}));
|
|
530
527
|
};
|
|
531
|
-
return /* @__PURE__ */
|
|
528
|
+
return /* @__PURE__ */ React12.createElement(Stack4, { direction: "row" }, /* @__PURE__ */ React12.createElement(
|
|
532
529
|
TextField3,
|
|
533
530
|
{
|
|
534
531
|
size: "tiny",
|
|
@@ -537,7 +534,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
537
534
|
onChange: handleSizeChange,
|
|
538
535
|
placeholder
|
|
539
536
|
}
|
|
540
|
-
), /* @__PURE__ */
|
|
537
|
+
), /* @__PURE__ */ React12.createElement(
|
|
541
538
|
Select2,
|
|
542
539
|
{
|
|
543
540
|
size: "tiny",
|
|
@@ -548,7 +545,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
548
545
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
549
546
|
}
|
|
550
547
|
},
|
|
551
|
-
units2.map((unit) => /* @__PURE__ */
|
|
548
|
+
units2.map((unit) => /* @__PURE__ */ React12.createElement(MenuItem2, { key: unit, value: unit }, unit.toUpperCase()))
|
|
552
549
|
));
|
|
553
550
|
};
|
|
554
551
|
|
|
@@ -556,11 +553,82 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
556
553
|
import { Stack as Stack5 } from "@elementor/ui";
|
|
557
554
|
import { __ as __2 } from "@wordpress/i18n";
|
|
558
555
|
var SizeSection = () => {
|
|
559
|
-
return /* @__PURE__ */
|
|
556
|
+
return /* @__PURE__ */ React13.createElement(CollapsibleSection, { title: __2("Size", "elementor") }, /* @__PURE__ */ React13.createElement(Stack5, { gap: 1.5 }, /* @__PURE__ */ React13.createElement(Stack5, { direction: "row", gap: 2 }, /* @__PURE__ */ React13.createElement(Control2, { bind: "width", label: __2("Width", "elementor") }), /* @__PURE__ */ React13.createElement(Control2, { bind: "height", label: __2("Height", "elementor") })), /* @__PURE__ */ React13.createElement(Stack5, { direction: "row", gap: 2 }, /* @__PURE__ */ React13.createElement(Control2, { bind: "minWidth", label: __2("Min. Width", "elementor") }), /* @__PURE__ */ React13.createElement(Control2, { bind: "minHeight", label: __2("Min. Height", "elementor") })), /* @__PURE__ */ React13.createElement(Stack5, { direction: "row", gap: 2 }, /* @__PURE__ */ React13.createElement(Control2, { bind: "maxWidth", label: __2("Max. Width", "elementor") }), /* @__PURE__ */ React13.createElement(Control2, { bind: "maxHeight", label: __2("Max. Height", "elementor") }))));
|
|
560
557
|
};
|
|
561
558
|
var units = ["px", "%", "em", "rem", "vw"];
|
|
562
559
|
var Control2 = ({ label, bind }) => {
|
|
563
|
-
return /* @__PURE__ */
|
|
560
|
+
return /* @__PURE__ */ React13.createElement(StyleControl, { bind }, /* @__PURE__ */ React13.createElement(Stack5, { gap: 1, sx: { flex: "0 1 50%" } }, /* @__PURE__ */ React13.createElement(StyleControl.Label, null, label), /* @__PURE__ */ React13.createElement(SizeControl, { units })));
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
// src/components/style-sections/typography-section.tsx
|
|
564
|
+
import * as React15 from "react";
|
|
565
|
+
import { Stack as Stack7 } from "@elementor/ui";
|
|
566
|
+
|
|
567
|
+
// src/controls/control-types/text-style-control.tsx
|
|
568
|
+
import * as React14 from "react";
|
|
569
|
+
import { Stack as Stack6, ToggleButton as ToggleButtonBase, ToggleButtonGroup } from "@elementor/ui";
|
|
570
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
571
|
+
var TextStyleControl = () => {
|
|
572
|
+
const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
|
|
573
|
+
const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
|
|
574
|
+
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
575
|
+
return /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React14.createElement(ControlLabel, null, __3("Style", "elementor")), /* @__PURE__ */ React14.createElement(ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React14.createElement(
|
|
576
|
+
ToggleButton,
|
|
577
|
+
{
|
|
578
|
+
value: "italic",
|
|
579
|
+
onChange: (v) => setFontStyle(fontStyle === v ? null : v),
|
|
580
|
+
"aria-label": "italic"
|
|
581
|
+
},
|
|
582
|
+
/* @__PURE__ */ React14.createElement("span", { style: { fontStyle: "italic", fontSize: "12px" } }, "I")
|
|
583
|
+
), /* @__PURE__ */ React14.createElement(
|
|
584
|
+
ShorthandControl,
|
|
585
|
+
{
|
|
586
|
+
value: "line-through",
|
|
587
|
+
currentValues: textDecoration || "",
|
|
588
|
+
updateValues: setTextDecoration,
|
|
589
|
+
"aria-label": "line-through"
|
|
590
|
+
},
|
|
591
|
+
/* @__PURE__ */ React14.createElement("span", { style: { textDecoration: "line-through", fontSize: "12px" } }, "S")
|
|
592
|
+
), /* @__PURE__ */ React14.createElement(
|
|
593
|
+
ShorthandControl,
|
|
594
|
+
{
|
|
595
|
+
value: "underline",
|
|
596
|
+
currentValues: textDecoration || "",
|
|
597
|
+
updateValues: setTextDecoration,
|
|
598
|
+
"aria-label": "underline"
|
|
599
|
+
},
|
|
600
|
+
/* @__PURE__ */ React14.createElement("span", { style: { textDecoration: "underline", fontSize: "12px" } }, "U")
|
|
601
|
+
)));
|
|
602
|
+
};
|
|
603
|
+
var ShorthandControl = ({
|
|
604
|
+
children,
|
|
605
|
+
value,
|
|
606
|
+
currentValues,
|
|
607
|
+
updateValues,
|
|
608
|
+
"aria-label": ariaLabel
|
|
609
|
+
}) => {
|
|
610
|
+
const valuesArr = currentValues.split(" ").filter(Boolean);
|
|
611
|
+
const selected = valuesArr.includes(value);
|
|
612
|
+
const toggleValue = (newValue) => {
|
|
613
|
+
if (selected) {
|
|
614
|
+
updateValues(valuesArr.filter((v) => v !== newValue).join(" ") || null);
|
|
615
|
+
} else {
|
|
616
|
+
updateValues([...valuesArr, newValue].join(" "));
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
return /* @__PURE__ */ React14.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
|
|
620
|
+
};
|
|
621
|
+
var ToggleButton = ({ onChange, ...props }) => {
|
|
622
|
+
const handleChange = (_e, newValue) => {
|
|
623
|
+
onChange(newValue);
|
|
624
|
+
};
|
|
625
|
+
return /* @__PURE__ */ React14.createElement(ToggleButtonBase, { ...props, onChange: handleChange, size: "tiny", sx: { px: 1.5 } });
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
// src/components/style-sections/typography-section.tsx
|
|
629
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
630
|
+
var TypographySection = () => {
|
|
631
|
+
return /* @__PURE__ */ React15.createElement(CollapsibleSection, { title: __4("Typography", "elementor") }, /* @__PURE__ */ React15.createElement(Stack7, { gap: 1.5 }, /* @__PURE__ */ React15.createElement(TextStyleControl, null)));
|
|
564
632
|
};
|
|
565
633
|
|
|
566
634
|
// src/components/style-tab.tsx
|
|
@@ -568,13 +636,13 @@ var StyleTab = () => {
|
|
|
568
636
|
const { element } = useElementContext();
|
|
569
637
|
const elementStyles = useElementStyles(element.id);
|
|
570
638
|
const [selectedStyleDef = null] = Object.values(elementStyles || {});
|
|
571
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ React16.createElement(StyleContext, { selectedStyleDef }, /* @__PURE__ */ React16.createElement(Stack8, null, /* @__PURE__ */ React16.createElement(SizeSection, null), /* @__PURE__ */ React16.createElement(TypographySection, null)));
|
|
572
640
|
};
|
|
573
641
|
|
|
574
642
|
// src/components/editing-panel-tabs.tsx
|
|
575
643
|
var EditingPanelTabs = () => {
|
|
576
644
|
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
577
|
-
return /* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ React17.createElement(Stack9, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React17.createElement(Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React17.createElement(Tab, { label: __5("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React17.createElement(Tab, { label: __5("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React17.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React17.createElement(SettingsTab, null)), /* @__PURE__ */ React17.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React17.createElement(StyleTab, null)));
|
|
578
646
|
};
|
|
579
647
|
|
|
580
648
|
// src/components/editing-panel.tsx
|
|
@@ -585,8 +653,8 @@ var EditingPanel = () => {
|
|
|
585
653
|
if (elements.length !== 1 || !elementType) {
|
|
586
654
|
return null;
|
|
587
655
|
}
|
|
588
|
-
const panelTitle =
|
|
589
|
-
return /* @__PURE__ */
|
|
656
|
+
const panelTitle = __6("Edit %s", "elementor").replace("%s", elementType.title);
|
|
657
|
+
return /* @__PURE__ */ React18.createElement(Panel, null, /* @__PURE__ */ React18.createElement(PanelHeader, null, /* @__PURE__ */ React18.createElement(PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React18.createElement(PanelBody, null, /* @__PURE__ */ React18.createElement(ElementContext, { element: selectedElement }, /* @__PURE__ */ React18.createElement(EditingPanelTabs, null))));
|
|
590
658
|
};
|
|
591
659
|
|
|
592
660
|
// src/panel.ts
|