@elementor/editor-editing-panel 4.1.0-beta1 → 4.1.0-beta2
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/dist/index.mjs
CHANGED
|
@@ -158,10 +158,12 @@ import {
|
|
|
158
158
|
validateStyleLabel as validateStyleLabel2
|
|
159
159
|
} from "@elementor/editor-styles-repository";
|
|
160
160
|
import { InfoAlert, WarningInfotip } from "@elementor/editor-ui";
|
|
161
|
+
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
161
162
|
import { ColorSwatchIcon, MapPinIcon } from "@elementor/icons";
|
|
162
163
|
import { createLocation as createLocation2 } from "@elementor/locations";
|
|
163
164
|
import {
|
|
164
165
|
Box as Box2,
|
|
166
|
+
Button,
|
|
165
167
|
Chip as Chip3,
|
|
166
168
|
FormLabel,
|
|
167
169
|
Link,
|
|
@@ -374,14 +376,20 @@ function useCreateOption(params) {
|
|
|
374
376
|
|
|
375
377
|
// src/components/creatable-autocomplete/use-filter-options.ts
|
|
376
378
|
import { createFilterOptions } from "@elementor/ui";
|
|
379
|
+
var STRIP_NON_CLASS_CHARS = /[^a-zA-Z0-9_-]/g;
|
|
380
|
+
function normalizeClassSearch(value) {
|
|
381
|
+
return value.replace(STRIP_NON_CLASS_CHARS, "").toLowerCase();
|
|
382
|
+
}
|
|
377
383
|
function useFilterOptions(parameters) {
|
|
378
384
|
const { options: options13, selected, onCreate, entityName } = parameters;
|
|
379
|
-
const filter = createFilterOptions(
|
|
385
|
+
const filter = createFilterOptions({
|
|
386
|
+
matchFrom: "any"
|
|
387
|
+
});
|
|
380
388
|
const filterOptions = (optionList, params) => {
|
|
381
389
|
const selectedValues = selected.map((option) => option.value);
|
|
382
390
|
const filteredOptions = filter(
|
|
383
391
|
optionList.filter((option) => !selectedValues.includes(option.value)),
|
|
384
|
-
params
|
|
392
|
+
{ ...params, inputValue: normalizeClassSearch(params.inputValue) }
|
|
385
393
|
);
|
|
386
394
|
const isExisting = options13.some((option) => params.inputValue === option.label);
|
|
387
395
|
const allowCreate = Boolean(onCreate) && params.inputValue !== "" && !selectedValues.includes(params.inputValue) && !isExisting;
|
|
@@ -1240,6 +1248,19 @@ var validateLabel = (newLabel) => {
|
|
|
1240
1248
|
// src/components/css-classes/css-class-selector.tsx
|
|
1241
1249
|
var ID = "elementor-css-class-selector";
|
|
1242
1250
|
var TAGS_LIMIT = 50;
|
|
1251
|
+
var EVENT_OPEN_GLOBAL_CLASSES_MANAGER = "elementor/open-global-classes-manager";
|
|
1252
|
+
var EVENT_TOGGLE_DESIGN_SYSTEM = "elementor/toggle-design-system";
|
|
1253
|
+
function openClassManagerPanel() {
|
|
1254
|
+
if (isExperimentActive("e_editor_design_system_panel")) {
|
|
1255
|
+
window.dispatchEvent(
|
|
1256
|
+
new CustomEvent(EVENT_TOGGLE_DESIGN_SYSTEM, {
|
|
1257
|
+
detail: { tab: "classes" }
|
|
1258
|
+
})
|
|
1259
|
+
);
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
window.dispatchEvent(new CustomEvent(EVENT_OPEN_GLOBAL_CLASSES_MANAGER));
|
|
1263
|
+
}
|
|
1243
1264
|
var EMPTY_OPTION = {
|
|
1244
1265
|
label: __6("local", "elementor"),
|
|
1245
1266
|
value: null,
|
|
@@ -1255,7 +1276,7 @@ function CssClassSelector() {
|
|
|
1255
1276
|
const autocompleteRef = useRef(null);
|
|
1256
1277
|
const [renameError, setRenameError] = useState4(null);
|
|
1257
1278
|
const handleSelect = useHandleSelect();
|
|
1258
|
-
const { create, validate, entityName } = useCreateAction();
|
|
1279
|
+
const { create, validate, entityName, isAtLimit, limitCount } = useCreateAction();
|
|
1259
1280
|
const appliedOptions = useAppliedOptions(options13);
|
|
1260
1281
|
const active = appliedOptions.find((option) => option.value === activeId) ?? EMPTY_OPTION;
|
|
1261
1282
|
const showPlaceholder = appliedOptions.every(({ fixed }) => fixed);
|
|
@@ -1284,7 +1305,7 @@ function CssClassSelector() {
|
|
|
1284
1305
|
onCreate: create ?? void 0,
|
|
1285
1306
|
validate: validate ?? void 0,
|
|
1286
1307
|
limitTags: TAGS_LIMIT,
|
|
1287
|
-
renderEmptyState: EmptyState,
|
|
1308
|
+
renderEmptyState: isAtLimit && typeof limitCount === "number" ? (props) => /* @__PURE__ */ React11.createElement(LimitReachedEmptyState, { limitCount, onClear: props.onClear }) : EmptyState,
|
|
1288
1309
|
getLimitTagsText: (more) => /* @__PURE__ */ React11.createElement(Chip3, { size: "tiny", variant: "standard", label: `+${more}`, clickable: true }),
|
|
1289
1310
|
renderTags: (values, getTagProps) => values.map((value, index) => {
|
|
1290
1311
|
const chipProps = getTagProps({ index });
|
|
@@ -1323,7 +1344,7 @@ function CssClassSelector() {
|
|
|
1323
1344
|
)
|
|
1324
1345
|
), !canEdit && /* @__PURE__ */ React11.createElement(InfoAlert, { sx: { mt: 1 } }, __6("With your current role, you can use existing classes but can\u2019t modify them.", "elementor")));
|
|
1325
1346
|
}
|
|
1326
|
-
var
|
|
1347
|
+
var EmptyStateLayout = ({ searchValue, onClear, children }) => /* @__PURE__ */ React11.createElement(Box2, { sx: { py: 4 } }, /* @__PURE__ */ React11.createElement(
|
|
1327
1348
|
Stack3,
|
|
1328
1349
|
{
|
|
1329
1350
|
gap: 1,
|
|
@@ -1334,9 +1355,54 @@ var EmptyState = ({ searchValue, onClear }) => /* @__PURE__ */ React11.createEle
|
|
|
1334
1355
|
},
|
|
1335
1356
|
/* @__PURE__ */ React11.createElement(ColorSwatchIcon, { sx: { transform: "rotate(90deg)" }, fontSize: "large" }),
|
|
1336
1357
|
/* @__PURE__ */ React11.createElement(Typography3, { align: "center", variant: "subtitle2" }, __6("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React11.createElement("br", null), "\u201C", searchValue, "\u201D."),
|
|
1337
|
-
|
|
1358
|
+
children,
|
|
1338
1359
|
/* @__PURE__ */ React11.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __6("Clear & try again", "elementor"))
|
|
1339
1360
|
));
|
|
1361
|
+
var EmptyState = (props) => /* @__PURE__ */ React11.createElement(EmptyStateLayout, { ...props }, /* @__PURE__ */ React11.createElement(Typography3, { align: "center", variant: "caption", sx: { mb: 2 } }, __6("With your current role,", "elementor"), /* @__PURE__ */ React11.createElement("br", null), __6("you can only use existing classes.", "elementor")));
|
|
1362
|
+
var LimitReachedEmptyState = ({
|
|
1363
|
+
limitCount,
|
|
1364
|
+
onClear
|
|
1365
|
+
}) => /* @__PURE__ */ React11.createElement(Box2, { sx: { py: 4 } }, /* @__PURE__ */ React11.createElement(
|
|
1366
|
+
Stack3,
|
|
1367
|
+
{
|
|
1368
|
+
gap: 1,
|
|
1369
|
+
alignItems: "center",
|
|
1370
|
+
color: "text.secondary",
|
|
1371
|
+
justifyContent: "center",
|
|
1372
|
+
sx: { px: 1, m: "auto", maxWidth: "260px" }
|
|
1373
|
+
},
|
|
1374
|
+
/* @__PURE__ */ React11.createElement(ColorSwatchIcon, { sx: { transform: "rotate(90deg)" }, fontSize: "large" }),
|
|
1375
|
+
/* @__PURE__ */ React11.createElement(
|
|
1376
|
+
Typography3,
|
|
1377
|
+
{ align: "center", variant: "subtitle2" },
|
|
1378
|
+
/* translators: %s is the maximum number of classes */
|
|
1379
|
+
__6("Limit of %s classes reached", "elementor").replace("%s", String(limitCount))
|
|
1380
|
+
),
|
|
1381
|
+
/* @__PURE__ */ React11.createElement(Typography3, { align: "center", variant: "caption", component: "div" }, __6("Remove a class to create a new one.", "elementor"), " ", /* @__PURE__ */ React11.createElement(
|
|
1382
|
+
Link,
|
|
1383
|
+
{
|
|
1384
|
+
color: "inherit",
|
|
1385
|
+
variant: "caption",
|
|
1386
|
+
component: "button",
|
|
1387
|
+
onClick: onClear,
|
|
1388
|
+
sx: { verticalAlign: "baseline" }
|
|
1389
|
+
},
|
|
1390
|
+
__6("Clear", "elementor")
|
|
1391
|
+
)),
|
|
1392
|
+
/* @__PURE__ */ React11.createElement(
|
|
1393
|
+
Button,
|
|
1394
|
+
{
|
|
1395
|
+
variant: "outlined",
|
|
1396
|
+
color: "secondary",
|
|
1397
|
+
size: "small",
|
|
1398
|
+
onClick: () => {
|
|
1399
|
+
openClassManagerPanel();
|
|
1400
|
+
onClear();
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
__6("Class Manager", "elementor")
|
|
1404
|
+
)
|
|
1405
|
+
));
|
|
1340
1406
|
var updateClassByProvider = (provider, data) => {
|
|
1341
1407
|
if (!provider) {
|
|
1342
1408
|
return;
|
|
@@ -1379,6 +1445,11 @@ function useCreateAction() {
|
|
|
1379
1445
|
if (!provider || !createAction) {
|
|
1380
1446
|
return {};
|
|
1381
1447
|
}
|
|
1448
|
+
const entityName = provider.labels.singular && provider.labels.plural ? provider.labels : void 0;
|
|
1449
|
+
const validate = (newClassLabel, event) => validateStyleLabel2(newClassLabel, event);
|
|
1450
|
+
if (hasReachedLimit(provider)) {
|
|
1451
|
+
return { entityName, isAtLimit: true, limitCount: provider.limit, validate };
|
|
1452
|
+
}
|
|
1382
1453
|
const create = (classLabel) => {
|
|
1383
1454
|
const { createdId } = createAction({ classLabel });
|
|
1384
1455
|
trackStyles(provider.getKey() ?? "", "classCreated", {
|
|
@@ -1387,21 +1458,7 @@ function useCreateAction() {
|
|
|
1387
1458
|
classId: createdId
|
|
1388
1459
|
});
|
|
1389
1460
|
};
|
|
1390
|
-
|
|
1391
|
-
if (hasReachedLimit(provider)) {
|
|
1392
|
-
return {
|
|
1393
|
-
isValid: false,
|
|
1394
|
-
/* translators: %s is the maximum number of classes */
|
|
1395
|
-
errorMessage: __6(
|
|
1396
|
-
"You\u2019ve reached the limit of %s classes. Please remove an existing one to create a new class.",
|
|
1397
|
-
"elementor"
|
|
1398
|
-
).replace("%s", provider.limit.toString())
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
return validateStyleLabel2(newClassLabel, event);
|
|
1402
|
-
};
|
|
1403
|
-
const entityName = provider.labels.singular && provider.labels.plural ? provider.labels : void 0;
|
|
1404
|
-
return { create, validate, entityName };
|
|
1461
|
+
return { create, validate, entityName, isAtLimit: false };
|
|
1405
1462
|
}
|
|
1406
1463
|
function hasReachedLimit(provider) {
|
|
1407
1464
|
return provider.actions.all().length >= provider.limit;
|
|
@@ -1832,7 +1889,7 @@ function EditorPanelErrorFallback() {
|
|
|
1832
1889
|
import { Fragment as Fragment9 } from "react";
|
|
1833
1890
|
import * as React86 from "react";
|
|
1834
1891
|
import { getWidgetsCache as getWidgetsCache2 } from "@elementor/editor-elements";
|
|
1835
|
-
import { isExperimentActive as
|
|
1892
|
+
import { isExperimentActive as isExperimentActive4 } from "@elementor/editor-v1-adapters";
|
|
1836
1893
|
import { Divider as Divider6, Stack as Stack13, Tab, TabPanel, Tabs, useTabs } from "@elementor/ui";
|
|
1837
1894
|
import { __ as __60 } from "@wordpress/i18n";
|
|
1838
1895
|
|
|
@@ -3394,7 +3451,7 @@ var EffectsSection = () => {
|
|
|
3394
3451
|
import * as React55 from "react";
|
|
3395
3452
|
import { ControlFormLabel as ControlFormLabel2 } from "@elementor/editor-controls";
|
|
3396
3453
|
import { useParentElement } from "@elementor/editor-elements";
|
|
3397
|
-
import { isExperimentActive as
|
|
3454
|
+
import { isExperimentActive as isExperimentActive3 } from "@elementor/editor-v1-adapters";
|
|
3398
3455
|
import { __ as __33 } from "@wordpress/i18n";
|
|
3399
3456
|
|
|
3400
3457
|
// src/hooks/use-computed-style.ts
|
|
@@ -3717,7 +3774,7 @@ var getOptions2 = (parentStyleDirection) => {
|
|
|
3717
3774
|
import * as React44 from "react";
|
|
3718
3775
|
import { useMemo as useMemo9 } from "react";
|
|
3719
3776
|
import { ToggleControl as ToggleControl6 } from "@elementor/editor-controls";
|
|
3720
|
-
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
3777
|
+
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
3721
3778
|
import { __ as __22 } from "@wordpress/i18n";
|
|
3722
3779
|
var DISPLAY_LABEL = __22("Display", "elementor");
|
|
3723
3780
|
var displayFieldItems = [
|
|
@@ -3760,7 +3817,7 @@ var displayFieldItems = [
|
|
|
3760
3817
|
];
|
|
3761
3818
|
var DisplayField = () => {
|
|
3762
3819
|
const placeholder = useDisplayPlaceholderValue();
|
|
3763
|
-
const isGridActive =
|
|
3820
|
+
const isGridActive = isExperimentActive2("e_css_grid");
|
|
3764
3821
|
const items3 = useMemo9(
|
|
3765
3822
|
() => isGridActive ? displayFieldItems : displayFieldItems.filter((item) => item.value !== "grid"),
|
|
3766
3823
|
[isGridActive]
|
|
@@ -4390,7 +4447,7 @@ var LayoutSection = () => {
|
|
|
4390
4447
|
history: { propDisplayName: DISPLAY_LABEL2 }
|
|
4391
4448
|
});
|
|
4392
4449
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
4393
|
-
const isGridExperimentActive =
|
|
4450
|
+
const isGridExperimentActive = isExperimentActive3("e_css_grid");
|
|
4394
4451
|
const isDisplayFlex = shouldDisplayFlexFields(display, displayPlaceholder);
|
|
4395
4452
|
const isDisplayGrid = "grid" === (display?.value ?? displayPlaceholder?.value);
|
|
4396
4453
|
const { element } = useElement();
|
|
@@ -5382,7 +5439,7 @@ var PanelTabContent = () => {
|
|
|
5382
5439
|
const { element } = useElement();
|
|
5383
5440
|
const editorDefaults = useDefaultPanelSettings();
|
|
5384
5441
|
const defaultComponentTab = editorDefaults.defaultTab;
|
|
5385
|
-
const isInteractionsActive =
|
|
5442
|
+
const isInteractionsActive = isExperimentActive4("e_interactions");
|
|
5386
5443
|
const isPromotedElement = !!getWidgetsCache2()?.[element.type]?.meta?.is_pro_promotion;
|
|
5387
5444
|
const [storedTab, setCurrentTab] = useStateByElement("tab", defaultComponentTab);
|
|
5388
5445
|
const currentTab = isPromotedElement && storedTab === "settings" ? "style" : storedTab;
|