@elementor/editor-controls 3.33.0-285 → 3.33.0-287
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.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +96 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-toggle-button-group.tsx +121 -116
- package/src/index.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -2280,99 +2280,102 @@ var StyledToggleButton = styled6(ToggleButton, {
|
|
|
2280
2280
|
}
|
|
2281
2281
|
`}
|
|
2282
2282
|
`;
|
|
2283
|
-
var ToggleButtonGroupUi = (
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
const
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
if (typeof placeholderValue === "string") {
|
|
2322
|
-
return placeholderValue.trim().split(/\s+/).filter(Boolean);
|
|
2323
|
-
}
|
|
2324
|
-
return [];
|
|
2325
|
-
};
|
|
2326
|
-
const placeholderArray = getPlaceholderArray(placeholder);
|
|
2327
|
-
return /* @__PURE__ */ React51.createElement(
|
|
2328
|
-
StyledToggleButtonGroup,
|
|
2329
|
-
{
|
|
2330
|
-
justify,
|
|
2331
|
-
value,
|
|
2332
|
-
onChange: handleChange,
|
|
2333
|
-
exclusive,
|
|
2334
|
-
disabled,
|
|
2335
|
-
sx: {
|
|
2336
|
-
direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */",
|
|
2337
|
-
display: "grid",
|
|
2338
|
-
gridTemplateColumns: getGridTemplateColumns,
|
|
2339
|
-
width: `100%`
|
|
2283
|
+
var ToggleButtonGroupUi = React51.forwardRef(
|
|
2284
|
+
({
|
|
2285
|
+
justify = "end",
|
|
2286
|
+
size = "tiny",
|
|
2287
|
+
value,
|
|
2288
|
+
onChange,
|
|
2289
|
+
items: items2,
|
|
2290
|
+
maxItems,
|
|
2291
|
+
exclusive = false,
|
|
2292
|
+
fullWidth = false,
|
|
2293
|
+
disabled,
|
|
2294
|
+
placeholder
|
|
2295
|
+
}, ref) => {
|
|
2296
|
+
const shouldSliceItems = exclusive && maxItems !== void 0 && items2.length > maxItems;
|
|
2297
|
+
const menuItems = shouldSliceItems ? items2.slice(maxItems - 1) : [];
|
|
2298
|
+
const fixedItems = shouldSliceItems ? items2.slice(0, maxItems - 1) : items2;
|
|
2299
|
+
const theme = useTheme();
|
|
2300
|
+
const isRtl = "rtl" === theme.direction;
|
|
2301
|
+
const handleChange = (_, newValue) => {
|
|
2302
|
+
onChange(newValue);
|
|
2303
|
+
};
|
|
2304
|
+
const getGridTemplateColumns = useMemo5(() => {
|
|
2305
|
+
const isOffLimits = menuItems?.length;
|
|
2306
|
+
const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
|
|
2307
|
+
const templateColumnsSuffix = isOffLimits ? "auto" : "";
|
|
2308
|
+
return `repeat(${itemsCount}, minmax(0, 25%)) ${templateColumnsSuffix}`;
|
|
2309
|
+
}, [menuItems?.length, fixedItems.length]);
|
|
2310
|
+
const shouldShowExclusivePlaceholder = exclusive && (value === null || value === void 0 || value === "");
|
|
2311
|
+
const nonExclusiveSelectedValues = !exclusive && Array.isArray(value) ? value.map((v) => typeof v === "string" ? v : "").join(" ").trim().split(/\s+/).filter(Boolean) : [];
|
|
2312
|
+
const shouldShowNonExclusivePlaceholder = !exclusive && nonExclusiveSelectedValues.length === 0;
|
|
2313
|
+
const getPlaceholderArray = (placeholderValue) => {
|
|
2314
|
+
if (Array.isArray(placeholderValue)) {
|
|
2315
|
+
return placeholderValue.flatMap((p) => {
|
|
2316
|
+
if (typeof p === "string") {
|
|
2317
|
+
return p.trim().split(/\s+/).filter(Boolean);
|
|
2318
|
+
}
|
|
2319
|
+
return [];
|
|
2320
|
+
});
|
|
2340
2321
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
return
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2322
|
+
if (typeof placeholderValue === "string") {
|
|
2323
|
+
return placeholderValue.trim().split(/\s+/).filter(Boolean);
|
|
2324
|
+
}
|
|
2325
|
+
return [];
|
|
2326
|
+
};
|
|
2327
|
+
const placeholderArray = getPlaceholderArray(placeholder);
|
|
2328
|
+
return /* @__PURE__ */ React51.createElement(
|
|
2329
|
+
StyledToggleButtonGroup,
|
|
2330
|
+
{
|
|
2331
|
+
ref,
|
|
2332
|
+
justify,
|
|
2333
|
+
value,
|
|
2334
|
+
onChange: handleChange,
|
|
2335
|
+
exclusive,
|
|
2336
|
+
disabled,
|
|
2337
|
+
sx: {
|
|
2338
|
+
direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */",
|
|
2339
|
+
display: "grid",
|
|
2340
|
+
gridTemplateColumns: getGridTemplateColumns,
|
|
2341
|
+
width: `100%`
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
fixedItems.map(({ label, value: buttonValue, renderContent: Content3, showTooltip }) => {
|
|
2345
|
+
const isPlaceholder = placeholderArray.length > 0 && placeholderArray.includes(buttonValue) && (shouldShowExclusivePlaceholder || shouldShowNonExclusivePlaceholder);
|
|
2346
|
+
return /* @__PURE__ */ React51.createElement(
|
|
2347
|
+
ConditionalTooltip,
|
|
2353
2348
|
{
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
fullWidth,
|
|
2358
|
-
isPlaceholder
|
|
2349
|
+
key: buttonValue,
|
|
2350
|
+
label,
|
|
2351
|
+
showTooltip: showTooltip || false
|
|
2359
2352
|
},
|
|
2360
|
-
/* @__PURE__ */ React51.createElement(
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2353
|
+
/* @__PURE__ */ React51.createElement(
|
|
2354
|
+
StyledToggleButton,
|
|
2355
|
+
{
|
|
2356
|
+
value: buttonValue,
|
|
2357
|
+
"aria-label": label,
|
|
2358
|
+
size,
|
|
2359
|
+
fullWidth,
|
|
2360
|
+
isPlaceholder
|
|
2361
|
+
},
|
|
2362
|
+
/* @__PURE__ */ React51.createElement(Content3, { size })
|
|
2363
|
+
)
|
|
2364
|
+
);
|
|
2365
|
+
}),
|
|
2366
|
+
menuItems.length && exclusive && /* @__PURE__ */ React51.createElement(
|
|
2367
|
+
SplitButtonGroup,
|
|
2368
|
+
{
|
|
2369
|
+
size,
|
|
2370
|
+
value: value || null,
|
|
2371
|
+
onChange,
|
|
2372
|
+
items: menuItems,
|
|
2373
|
+
fullWidth
|
|
2374
|
+
}
|
|
2375
|
+
)
|
|
2376
|
+
);
|
|
2377
|
+
}
|
|
2378
|
+
);
|
|
2376
2379
|
var ControlToggleButtonGroup = (props) => {
|
|
2377
2380
|
return /* @__PURE__ */ React51.createElement(ControlActions, null, /* @__PURE__ */ React51.createElement(ToggleButtonGroupUi, { ...props }));
|
|
2378
2381
|
};
|
|
@@ -2408,8 +2411,7 @@ var SplitButtonGroup = ({
|
|
|
2408
2411
|
onClick: (ev) => {
|
|
2409
2412
|
ev.preventDefault();
|
|
2410
2413
|
onMenuItemClick(previewButton.value);
|
|
2411
|
-
}
|
|
2412
|
-
ref: menuButtonRef
|
|
2414
|
+
}
|
|
2413
2415
|
},
|
|
2414
2416
|
previewButton.renderContent({ size })
|
|
2415
2417
|
), /* @__PURE__ */ React51.createElement(
|
|
@@ -3192,7 +3194,7 @@ import { __ as __22 } from "@wordpress/i18n";
|
|
|
3192
3194
|
|
|
3193
3195
|
// src/components/autocomplete.tsx
|
|
3194
3196
|
import * as React62 from "react";
|
|
3195
|
-
import { forwardRef as
|
|
3197
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
3196
3198
|
import { XIcon as XIcon2 } from "@elementor/icons";
|
|
3197
3199
|
import {
|
|
3198
3200
|
Autocomplete as AutocompleteBase,
|
|
@@ -3201,7 +3203,7 @@ import {
|
|
|
3201
3203
|
InputAdornment as InputAdornment4,
|
|
3202
3204
|
TextField as TextField6
|
|
3203
3205
|
} from "@elementor/ui";
|
|
3204
|
-
var Autocomplete =
|
|
3206
|
+
var Autocomplete = forwardRef8((props, ref) => {
|
|
3205
3207
|
const {
|
|
3206
3208
|
options,
|
|
3207
3209
|
onOptionChange,
|
|
@@ -6209,6 +6211,7 @@ export {
|
|
|
6209
6211
|
LinkedDimensionsControl,
|
|
6210
6212
|
NumberControl,
|
|
6211
6213
|
PopoverContent,
|
|
6214
|
+
PopoverGridContainer,
|
|
6212
6215
|
PositionControl,
|
|
6213
6216
|
PropKeyProvider,
|
|
6214
6217
|
PropProvider,
|