@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/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 React19 from "react";
|
|
6
|
+
import { __ as __7 } 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 Stack10, Tabs, Tab, TabPanel, useTabs } from "@elementor/ui";
|
|
87
|
+
import * as React18 from "react";
|
|
88
|
+
import { __ as __6 } 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
|
-
// src/components/
|
|
176
|
-
import * as
|
|
179
|
+
// src/components/accordion-section.tsx
|
|
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
|
-
var
|
|
183
|
+
var AccordionSection = ({ 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,16 +221,16 @@ 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
232
|
// src/controls/control-types/image-control.tsx
|
|
229
|
-
import * as
|
|
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";
|
|
@@ -259,7 +263,7 @@ var ImageControl = () => {
|
|
|
259
263
|
});
|
|
260
264
|
}
|
|
261
265
|
});
|
|
262
|
-
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(
|
|
263
267
|
Button,
|
|
264
268
|
{
|
|
265
269
|
color: "inherit",
|
|
@@ -270,13 +274,13 @@ var ImageControl = () => {
|
|
|
270
274
|
}
|
|
271
275
|
},
|
|
272
276
|
__("Select Image", "elementor")
|
|
273
|
-
), /* @__PURE__ */
|
|
277
|
+
), /* @__PURE__ */ React8.createElement(
|
|
274
278
|
Button,
|
|
275
279
|
{
|
|
276
280
|
color: "inherit",
|
|
277
281
|
size: "small",
|
|
278
282
|
variant: "text",
|
|
279
|
-
startIcon: /* @__PURE__ */
|
|
283
|
+
startIcon: /* @__PURE__ */ React8.createElement(UploadIcon, null),
|
|
280
284
|
onClick: () => {
|
|
281
285
|
open({ mode: "upload" });
|
|
282
286
|
}
|
|
@@ -303,14 +307,14 @@ var SettingsTab = () => {
|
|
|
303
307
|
if (!elementType) {
|
|
304
308
|
return null;
|
|
305
309
|
}
|
|
306
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ React9.createElement(Stack3, null, elementType.controls.map(({ type, value }, index) => {
|
|
307
311
|
if (type === "control") {
|
|
308
|
-
return /* @__PURE__ */
|
|
312
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: value.bind, control: value });
|
|
309
313
|
}
|
|
310
314
|
if (type === "section") {
|
|
311
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ React9.createElement(AccordionSection, { key: type + "." + index, title: value.label }, value.items?.map((item) => {
|
|
312
316
|
if (item.type === "control") {
|
|
313
|
-
return /* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ React9.createElement(Control, { key: item.value.bind, control: item.value });
|
|
314
318
|
}
|
|
315
319
|
return null;
|
|
316
320
|
}));
|
|
@@ -323,7 +327,7 @@ var Control = ({ control }) => {
|
|
|
323
327
|
if (!ControlComponent) {
|
|
324
328
|
return null;
|
|
325
329
|
}
|
|
326
|
-
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(
|
|
327
331
|
ControlComponent,
|
|
328
332
|
{
|
|
329
333
|
...control.props
|
|
@@ -332,17 +336,17 @@ var Control = ({ control }) => {
|
|
|
332
336
|
};
|
|
333
337
|
|
|
334
338
|
// src/components/style-tab.tsx
|
|
335
|
-
import * as
|
|
339
|
+
import * as React17 from "react";
|
|
336
340
|
|
|
337
341
|
// src/contexts/style-context.tsx
|
|
338
|
-
import * as
|
|
342
|
+
import * as React10 from "react";
|
|
339
343
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
340
344
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
341
345
|
var Context2 = createContext3(null);
|
|
342
346
|
function StyleContext({ children, selectedStyleDef }) {
|
|
343
347
|
const breakpoint = useActiveBreakpoint();
|
|
344
348
|
const selectedMeta = { breakpoint, state: null };
|
|
345
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ React10.createElement(Context2.Provider, { value: { selectedStyleDef, selectedMeta } }, children);
|
|
346
350
|
}
|
|
347
351
|
function useStyleContext() {
|
|
348
352
|
const context = useContext3(Context2);
|
|
@@ -373,26 +377,13 @@ var useElementStyles = (elementID) => {
|
|
|
373
377
|
};
|
|
374
378
|
|
|
375
379
|
// src/components/style-tab.tsx
|
|
376
|
-
import { Stack as
|
|
380
|
+
import { Stack as Stack9 } from "@elementor/ui";
|
|
377
381
|
|
|
378
382
|
// src/components/style-sections/size-section.tsx
|
|
379
|
-
import * as
|
|
383
|
+
import * as React14 from "react";
|
|
380
384
|
|
|
381
385
|
// src/controls/style-control.tsx
|
|
382
|
-
import * as
|
|
383
|
-
|
|
384
|
-
// src/sync/update-style.ts
|
|
385
|
-
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
386
|
-
var updateStyle = ({ elementID, styleDefID, meta, props, bind = "classes" }) => {
|
|
387
|
-
const container = getContainer(elementID);
|
|
388
|
-
runCommand2("document/atomic-widgets/styles", {
|
|
389
|
-
container,
|
|
390
|
-
styleDefID,
|
|
391
|
-
bind,
|
|
392
|
-
meta,
|
|
393
|
-
props
|
|
394
|
-
});
|
|
395
|
-
};
|
|
386
|
+
import * as React11 from "react";
|
|
396
387
|
|
|
397
388
|
// src/hooks/use-element-style-prop.ts
|
|
398
389
|
import { commandEndEvent as commandEndEvent5, __privateUseListenTo as useListenTo5 } from "@elementor/editor-v1-adapters";
|
|
@@ -424,38 +415,86 @@ function getVariantByMeta(styleDef, meta) {
|
|
|
424
415
|
});
|
|
425
416
|
}
|
|
426
417
|
|
|
427
|
-
// src/
|
|
428
|
-
import {
|
|
429
|
-
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) => {
|
|
430
433
|
const { element } = useElementContext();
|
|
431
434
|
const { selectedStyleDef, selectedMeta } = useStyleContext();
|
|
435
|
+
const value = useElementStyleProp({
|
|
436
|
+
elementID: element.id,
|
|
437
|
+
styleDefID: selectedStyleDef?.id,
|
|
438
|
+
meta: selectedMeta,
|
|
439
|
+
propName
|
|
440
|
+
});
|
|
432
441
|
const setValue = (newValue) => {
|
|
433
442
|
updateStyle({
|
|
434
443
|
elementID: element.id,
|
|
435
444
|
styleDefID: selectedStyleDef?.id,
|
|
436
|
-
props: { [
|
|
445
|
+
props: { [propName]: newValue },
|
|
437
446
|
meta: selectedMeta
|
|
438
447
|
});
|
|
439
448
|
};
|
|
440
|
-
|
|
441
|
-
elementID: element.id,
|
|
442
|
-
styleDefID: selectedStyleDef?.id,
|
|
443
|
-
meta: selectedMeta,
|
|
444
|
-
propName: bind
|
|
445
|
-
});
|
|
446
|
-
return /* @__PURE__ */ React10.createElement(ControlContext.Provider, { value: { bind, value, setValue } }, children);
|
|
449
|
+
return [value, setValue];
|
|
447
450
|
};
|
|
448
|
-
|
|
449
|
-
|
|
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);
|
|
450
456
|
};
|
|
451
|
-
StyleControl.Label =
|
|
457
|
+
StyleControl.Label = ControlLabel;
|
|
458
|
+
|
|
459
|
+
// src/components/collapsible-section.tsx
|
|
460
|
+
import * as React12 from "react";
|
|
461
|
+
import { useState } from "react";
|
|
462
|
+
import { ChevronDownIcon } from "@elementor/icons";
|
|
463
|
+
import { Button as Button2, Collapse, Stack as Stack4, styled as styled2 } from "@elementor/ui";
|
|
464
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
465
|
+
var CollapsibleSection = ({ children, defaultOpen = false }) => {
|
|
466
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
467
|
+
const handleToggle = () => {
|
|
468
|
+
setOpen((prevOpen) => !prevOpen);
|
|
469
|
+
};
|
|
470
|
+
return /* @__PURE__ */ React12.createElement(Stack4, { sx: { py: 0.5 } }, /* @__PURE__ */ React12.createElement(
|
|
471
|
+
Button2,
|
|
472
|
+
{
|
|
473
|
+
fullWidth: true,
|
|
474
|
+
size: "small",
|
|
475
|
+
color: "secondary",
|
|
476
|
+
variant: "outlined",
|
|
477
|
+
onClick: handleToggle,
|
|
478
|
+
endIcon: /* @__PURE__ */ React12.createElement(ChevronIcon, { open })
|
|
479
|
+
},
|
|
480
|
+
open ? __2("Show less", "elementor") : __2("Show more", "elementor")
|
|
481
|
+
), /* @__PURE__ */ React12.createElement(Collapse, { in: open, timeout: "auto" }, children));
|
|
482
|
+
};
|
|
483
|
+
var ChevronIcon = styled2(ChevronDownIcon, {
|
|
484
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
485
|
+
})(({ theme, open }) => ({
|
|
486
|
+
transform: open ? "rotate(180deg)" : "rotate(0)",
|
|
487
|
+
transition: theme.transitions.create("transform", {
|
|
488
|
+
duration: theme.transitions.duration.standard
|
|
489
|
+
})
|
|
490
|
+
}));
|
|
452
491
|
|
|
453
492
|
// src/controls/control-types/size-control.tsx
|
|
454
|
-
import * as
|
|
455
|
-
import { MenuItem as MenuItem2, Select as Select2, Stack as
|
|
493
|
+
import * as React13 from "react";
|
|
494
|
+
import { MenuItem as MenuItem2, Select as Select2, Stack as Stack5, TextField as TextField3 } from "@elementor/ui";
|
|
456
495
|
|
|
457
496
|
// src/controls/hooks/use-sync-external-state.tsx
|
|
458
|
-
import { useEffect, useState } from "react";
|
|
497
|
+
import { useEffect, useState as useState2 } from "react";
|
|
459
498
|
var useSyncExternalState = ({
|
|
460
499
|
external,
|
|
461
500
|
setExternal,
|
|
@@ -474,7 +513,7 @@ var useSyncExternalState = ({
|
|
|
474
513
|
}
|
|
475
514
|
return externalValue;
|
|
476
515
|
}
|
|
477
|
-
const [internal, setInternal] =
|
|
516
|
+
const [internal, setInternal] = useState2(toInternal(external, void 0));
|
|
478
517
|
useEffect(() => {
|
|
479
518
|
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
480
519
|
}, [external]);
|
|
@@ -519,7 +558,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
519
558
|
}
|
|
520
559
|
}));
|
|
521
560
|
};
|
|
522
|
-
return /* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ React13.createElement(Stack5, { direction: "row" }, /* @__PURE__ */ React13.createElement(
|
|
523
562
|
TextField3,
|
|
524
563
|
{
|
|
525
564
|
size: "tiny",
|
|
@@ -528,7 +567,7 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
528
567
|
onChange: handleSizeChange,
|
|
529
568
|
placeholder
|
|
530
569
|
}
|
|
531
|
-
), /* @__PURE__ */
|
|
570
|
+
), /* @__PURE__ */ React13.createElement(
|
|
532
571
|
Select2,
|
|
533
572
|
{
|
|
534
573
|
size: "tiny",
|
|
@@ -539,19 +578,90 @@ var SizeControl = ({ units: units2, placeholder }) => {
|
|
|
539
578
|
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
540
579
|
}
|
|
541
580
|
},
|
|
542
|
-
units2.map((unit) => /* @__PURE__ */
|
|
581
|
+
units2.map((unit) => /* @__PURE__ */ React13.createElement(MenuItem2, { key: unit, value: unit }, unit.toUpperCase()))
|
|
543
582
|
));
|
|
544
583
|
};
|
|
545
584
|
|
|
546
585
|
// src/components/style-sections/size-section.tsx
|
|
547
|
-
import { Stack as
|
|
548
|
-
import { __ as
|
|
586
|
+
import { Stack as Stack6 } from "@elementor/ui";
|
|
587
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
549
588
|
var SizeSection = () => {
|
|
550
|
-
return /* @__PURE__ */
|
|
589
|
+
return /* @__PURE__ */ React14.createElement(AccordionSection, { title: __3("Size", "elementor") }, /* @__PURE__ */ React14.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 2 }, /* @__PURE__ */ React14.createElement(Control2, { bind: "width", label: __3("Width", "elementor") }), /* @__PURE__ */ React14.createElement(Control2, { bind: "height", label: __3("Height", "elementor") })), /* @__PURE__ */ React14.createElement(CollapsibleSection, null, /* @__PURE__ */ React14.createElement(Stack6, { gap: 1.5, sx: { pt: 1.5 } }, /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 2 }, /* @__PURE__ */ React14.createElement(Control2, { bind: "minWidth", label: __3("Min. Width", "elementor") }), /* @__PURE__ */ React14.createElement(Control2, { bind: "minHeight", label: __3("Min. Height", "elementor") })), /* @__PURE__ */ React14.createElement(Stack6, { direction: "row", gap: 2 }, /* @__PURE__ */ React14.createElement(Control2, { bind: "maxWidth", label: __3("Max. Width", "elementor") }), /* @__PURE__ */ React14.createElement(Control2, { bind: "maxHeight", label: __3("Max. Height", "elementor") }))))));
|
|
551
590
|
};
|
|
552
591
|
var units = ["px", "%", "em", "rem", "vw"];
|
|
553
592
|
var Control2 = ({ label, bind }) => {
|
|
554
|
-
return /* @__PURE__ */
|
|
593
|
+
return /* @__PURE__ */ React14.createElement(StyleControl, { bind }, /* @__PURE__ */ React14.createElement(Stack6, { gap: 1, sx: { flex: "0 1 50%" } }, /* @__PURE__ */ React14.createElement(StyleControl.Label, null, label), /* @__PURE__ */ React14.createElement(SizeControl, { units })));
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
// src/components/style-sections/typography-section.tsx
|
|
597
|
+
import * as React16 from "react";
|
|
598
|
+
import { Stack as Stack8 } from "@elementor/ui";
|
|
599
|
+
|
|
600
|
+
// src/controls/control-types/text-style-control.tsx
|
|
601
|
+
import * as React15 from "react";
|
|
602
|
+
import { Stack as Stack7, ToggleButton as ToggleButtonBase, ToggleButtonGroup } from "@elementor/ui";
|
|
603
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
604
|
+
var TextStyleControl = () => {
|
|
605
|
+
const [fontStyle, setFontStyle] = useStyleControl("fontStyle");
|
|
606
|
+
const [textDecoration, setTextDecoration] = useStyleControl("textDecoration");
|
|
607
|
+
const formats = [fontStyle, ...(textDecoration || "").split(" ")];
|
|
608
|
+
return /* @__PURE__ */ React15.createElement(Stack7, { direction: "row", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React15.createElement(ControlLabel, null, __4("Style", "elementor")), /* @__PURE__ */ React15.createElement(ToggleButtonGroup, { value: formats }, /* @__PURE__ */ React15.createElement(
|
|
609
|
+
ToggleButton,
|
|
610
|
+
{
|
|
611
|
+
value: "italic",
|
|
612
|
+
onChange: (v) => setFontStyle(fontStyle === v ? null : v),
|
|
613
|
+
"aria-label": "italic"
|
|
614
|
+
},
|
|
615
|
+
/* @__PURE__ */ React15.createElement("span", { style: { fontStyle: "italic", fontSize: "12px" } }, "I")
|
|
616
|
+
), /* @__PURE__ */ React15.createElement(
|
|
617
|
+
ShorthandControl,
|
|
618
|
+
{
|
|
619
|
+
value: "line-through",
|
|
620
|
+
currentValues: textDecoration || "",
|
|
621
|
+
updateValues: setTextDecoration,
|
|
622
|
+
"aria-label": "line-through"
|
|
623
|
+
},
|
|
624
|
+
/* @__PURE__ */ React15.createElement("span", { style: { textDecoration: "line-through", fontSize: "12px" } }, "S")
|
|
625
|
+
), /* @__PURE__ */ React15.createElement(
|
|
626
|
+
ShorthandControl,
|
|
627
|
+
{
|
|
628
|
+
value: "underline",
|
|
629
|
+
currentValues: textDecoration || "",
|
|
630
|
+
updateValues: setTextDecoration,
|
|
631
|
+
"aria-label": "underline"
|
|
632
|
+
},
|
|
633
|
+
/* @__PURE__ */ React15.createElement("span", { style: { textDecoration: "underline", fontSize: "12px" } }, "U")
|
|
634
|
+
)));
|
|
635
|
+
};
|
|
636
|
+
var ShorthandControl = ({
|
|
637
|
+
children,
|
|
638
|
+
value,
|
|
639
|
+
currentValues,
|
|
640
|
+
updateValues,
|
|
641
|
+
"aria-label": ariaLabel
|
|
642
|
+
}) => {
|
|
643
|
+
const valuesArr = currentValues.split(" ").filter(Boolean);
|
|
644
|
+
const selected = valuesArr.includes(value);
|
|
645
|
+
const toggleValue = (newValue) => {
|
|
646
|
+
if (selected) {
|
|
647
|
+
updateValues(valuesArr.filter((v) => v !== newValue).join(" ") || null);
|
|
648
|
+
} else {
|
|
649
|
+
updateValues([...valuesArr, newValue].join(" "));
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
return /* @__PURE__ */ React15.createElement(ToggleButton, { value, onChange: toggleValue, selected, "aria-label": ariaLabel }, children);
|
|
653
|
+
};
|
|
654
|
+
var ToggleButton = ({ onChange, ...props }) => {
|
|
655
|
+
const handleChange = (_e, newValue) => {
|
|
656
|
+
onChange(newValue);
|
|
657
|
+
};
|
|
658
|
+
return /* @__PURE__ */ React15.createElement(ToggleButtonBase, { ...props, onChange: handleChange, size: "tiny", sx: { px: 1.5 } });
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
// src/components/style-sections/typography-section.tsx
|
|
662
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
663
|
+
var TypographySection = () => {
|
|
664
|
+
return /* @__PURE__ */ React16.createElement(AccordionSection, { title: __5("Typography", "elementor") }, /* @__PURE__ */ React16.createElement(Stack8, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(TextStyleControl, null)));
|
|
555
665
|
};
|
|
556
666
|
|
|
557
667
|
// src/components/style-tab.tsx
|
|
@@ -559,13 +669,13 @@ var StyleTab = () => {
|
|
|
559
669
|
const { element } = useElementContext();
|
|
560
670
|
const elementStyles = useElementStyles(element.id);
|
|
561
671
|
const [selectedStyleDef = null] = Object.values(elementStyles || {});
|
|
562
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ React17.createElement(StyleContext, { selectedStyleDef }, /* @__PURE__ */ React17.createElement(Stack9, null, /* @__PURE__ */ React17.createElement(SizeSection, null), /* @__PURE__ */ React17.createElement(TypographySection, null)));
|
|
563
673
|
};
|
|
564
674
|
|
|
565
675
|
// src/components/editing-panel-tabs.tsx
|
|
566
676
|
var EditingPanelTabs = () => {
|
|
567
677
|
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs("settings");
|
|
568
|
-
return /* @__PURE__ */
|
|
678
|
+
return /* @__PURE__ */ React18.createElement(Stack10, { direction: "column", sx: { width: "100%" } }, /* @__PURE__ */ React18.createElement(Tabs, { variant: "fullWidth", indicatorColor: "secondary", textColor: "inherit", ...getTabsProps() }, /* @__PURE__ */ React18.createElement(Tab, { label: __6("General", "elementor"), ...getTabProps("settings") }), /* @__PURE__ */ React18.createElement(Tab, { label: __6("Style", "elementor"), ...getTabProps("style") })), /* @__PURE__ */ React18.createElement(TabPanel, { ...getTabPanelProps("settings"), disablePadding: true }, /* @__PURE__ */ React18.createElement(SettingsTab, null)), /* @__PURE__ */ React18.createElement(TabPanel, { ...getTabPanelProps("style"), disablePadding: true }, /* @__PURE__ */ React18.createElement(StyleTab, null)));
|
|
569
679
|
};
|
|
570
680
|
|
|
571
681
|
// src/components/editing-panel.tsx
|
|
@@ -576,8 +686,8 @@ var EditingPanel = () => {
|
|
|
576
686
|
if (elements.length !== 1 || !elementType) {
|
|
577
687
|
return null;
|
|
578
688
|
}
|
|
579
|
-
const panelTitle =
|
|
580
|
-
return /* @__PURE__ */
|
|
689
|
+
const panelTitle = __7("Edit %s", "elementor").replace("%s", elementType.title);
|
|
690
|
+
return /* @__PURE__ */ React19.createElement(Panel, null, /* @__PURE__ */ React19.createElement(PanelHeader, null, /* @__PURE__ */ React19.createElement(PanelHeaderTitle, null, panelTitle)), /* @__PURE__ */ React19.createElement(PanelBody, null, /* @__PURE__ */ React19.createElement(ElementContext, { element: selectedElement }, /* @__PURE__ */ React19.createElement(EditingPanelTabs, null))));
|
|
581
691
|
};
|
|
582
692
|
|
|
583
693
|
// src/panel.ts
|