@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
2
  import { RefObject, ReactNode, FC, PropsWithChildren, ReactElement, ComponentType } from 'react';
3
- import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps } from '@elementor/ui';
3
+ import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps, Grid } from '@elementor/ui';
4
4
  import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, LinkPropValue, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
5
5
  import { StyleDefinitionState } from '@elementor/editor-styles';
6
6
  import * as _elementor_locations from '@elementor/locations';
@@ -136,7 +136,9 @@ type Props$5<TValue> = {
136
136
  value: ExclusiveValue<TValue>;
137
137
  onChange: (value: ExclusiveValue<TValue>) => void;
138
138
  });
139
- declare const ToggleButtonGroupUi: <TValue>({ justify, size, value, onChange, items, maxItems, exclusive, fullWidth, disabled, placeholder, }: Props$5<TValue>) => React$1.JSX.Element;
139
+ declare const ToggleButtonGroupUi: <TValue>(props: Props$5<TValue> & {
140
+ ref?: React$1.Ref<HTMLDivElement>;
141
+ }) => React$1.ReactElement;
140
142
  declare const ControlToggleButtonGroup: <TValue>(props: Props$5<TValue>) => React$1.JSX.Element;
141
143
 
142
144
  type ToggleControlProps<T extends PropValue> = {
@@ -541,6 +543,14 @@ declare function useFloatingActionsBar(): {
541
543
  setOpen: React$1.Dispatch<React$1.SetStateAction<boolean>>;
542
544
  };
543
545
 
546
+ declare const PopoverGridContainer: React$1.ForwardRefExoticComponent<{
547
+ gap?: number;
548
+ alignItems?: React$1.ComponentProps<typeof Grid>["alignItems"];
549
+ flexWrap?: React$1.ComponentProps<typeof Grid>["flexWrap"];
550
+ } & {
551
+ children?: React$1.ReactNode | undefined;
552
+ } & React$1.RefAttributes<unknown>>;
553
+
544
554
  type AnyComponentType = ComponentType<any>;
545
555
  declare const brandSymbol: unique symbol;
546
556
  type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
@@ -616,4 +626,4 @@ type UseInternalStateOptions<TValue> = {
616
626
  };
617
627
  declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue, options?: CreateOptions, meta?: SetValueMeta) => void];
618
628
 
619
- export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
629
+ export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PopoverGridContainer, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
2
  import { RefObject, ReactNode, FC, PropsWithChildren, ReactElement, ComponentType } from 'react';
3
- import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps } from '@elementor/ui';
3
+ import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps, Grid } from '@elementor/ui';
4
4
  import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, LinkPropValue, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
5
5
  import { StyleDefinitionState } from '@elementor/editor-styles';
6
6
  import * as _elementor_locations from '@elementor/locations';
@@ -136,7 +136,9 @@ type Props$5<TValue> = {
136
136
  value: ExclusiveValue<TValue>;
137
137
  onChange: (value: ExclusiveValue<TValue>) => void;
138
138
  });
139
- declare const ToggleButtonGroupUi: <TValue>({ justify, size, value, onChange, items, maxItems, exclusive, fullWidth, disabled, placeholder, }: Props$5<TValue>) => React$1.JSX.Element;
139
+ declare const ToggleButtonGroupUi: <TValue>(props: Props$5<TValue> & {
140
+ ref?: React$1.Ref<HTMLDivElement>;
141
+ }) => React$1.ReactElement;
140
142
  declare const ControlToggleButtonGroup: <TValue>(props: Props$5<TValue>) => React$1.JSX.Element;
141
143
 
142
144
  type ToggleControlProps<T extends PropValue> = {
@@ -541,6 +543,14 @@ declare function useFloatingActionsBar(): {
541
543
  setOpen: React$1.Dispatch<React$1.SetStateAction<boolean>>;
542
544
  };
543
545
 
546
+ declare const PopoverGridContainer: React$1.ForwardRefExoticComponent<{
547
+ gap?: number;
548
+ alignItems?: React$1.ComponentProps<typeof Grid>["alignItems"];
549
+ flexWrap?: React$1.ComponentProps<typeof Grid>["flexWrap"];
550
+ } & {
551
+ children?: React$1.ReactNode | undefined;
552
+ } & React$1.RefAttributes<unknown>>;
553
+
544
554
  type AnyComponentType = ComponentType<any>;
545
555
  declare const brandSymbol: unique symbol;
546
556
  type ControlComponent<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
@@ -616,4 +626,4 @@ type UseInternalStateOptions<TValue> = {
616
626
  };
617
627
  declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhen, fallback, }: UseInternalStateOptions<TValue>) => readonly [TValue, (setter: ((value: TValue) => TValue) | TValue, options?: CreateOptions, meta?: SetValueMeta) => void];
618
628
 
619
- export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
629
+ export { type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent, ControlFormLabel, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, NumberControl, PopoverContent, PopoverGridContainer, PositionControl, PropKeyProvider, PropProvider, type PropProviderProps, QueryControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeControl, StrokeControl, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useFloatingActionsBar, useSyncExternalState };
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ __export(index_exports, {
57
57
  LinkedDimensionsControl: () => LinkedDimensionsControl,
58
58
  NumberControl: () => NumberControl,
59
59
  PopoverContent: () => PopoverContent,
60
+ PopoverGridContainer: () => PopoverGridContainer,
60
61
  PositionControl: () => PositionControl,
61
62
  PropKeyProvider: () => PropKeyProvider,
62
63
  PropProvider: () => PropProvider,
@@ -2340,99 +2341,102 @@ var StyledToggleButton = (0, import_ui38.styled)(import_ui38.ToggleButton, {
2340
2341
  }
2341
2342
  `}
2342
2343
  `;
2343
- var ToggleButtonGroupUi = ({
2344
- justify = "end",
2345
- size = "tiny",
2346
- value,
2347
- onChange,
2348
- items: items2,
2349
- maxItems,
2350
- exclusive = false,
2351
- fullWidth = false,
2352
- disabled,
2353
- placeholder
2354
- }) => {
2355
- const shouldSliceItems = exclusive && maxItems !== void 0 && items2.length > maxItems;
2356
- const menuItems = shouldSliceItems ? items2.slice(maxItems - 1) : [];
2357
- const fixedItems = shouldSliceItems ? items2.slice(0, maxItems - 1) : items2;
2358
- const theme = (0, import_ui38.useTheme)();
2359
- const isRtl = "rtl" === theme.direction;
2360
- const handleChange = (_, newValue) => {
2361
- onChange(newValue);
2362
- };
2363
- const getGridTemplateColumns = (0, import_react27.useMemo)(() => {
2364
- const isOffLimits = menuItems?.length;
2365
- const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
2366
- const templateColumnsSuffix = isOffLimits ? "auto" : "";
2367
- return `repeat(${itemsCount}, minmax(0, 25%)) ${templateColumnsSuffix}`;
2368
- }, [menuItems?.length, fixedItems.length]);
2369
- const shouldShowExclusivePlaceholder = exclusive && (value === null || value === void 0 || value === "");
2370
- const nonExclusiveSelectedValues = !exclusive && Array.isArray(value) ? value.map((v) => typeof v === "string" ? v : "").join(" ").trim().split(/\s+/).filter(Boolean) : [];
2371
- const shouldShowNonExclusivePlaceholder = !exclusive && nonExclusiveSelectedValues.length === 0;
2372
- const getPlaceholderArray = (placeholderValue) => {
2373
- if (Array.isArray(placeholderValue)) {
2374
- return placeholderValue.flatMap((p) => {
2375
- if (typeof p === "string") {
2376
- return p.trim().split(/\s+/).filter(Boolean);
2377
- }
2378
- return [];
2379
- });
2380
- }
2381
- if (typeof placeholderValue === "string") {
2382
- return placeholderValue.trim().split(/\s+/).filter(Boolean);
2383
- }
2384
- return [];
2385
- };
2386
- const placeholderArray = getPlaceholderArray(placeholder);
2387
- return /* @__PURE__ */ React51.createElement(
2388
- StyledToggleButtonGroup,
2389
- {
2390
- justify,
2391
- value,
2392
- onChange: handleChange,
2393
- exclusive,
2394
- disabled,
2395
- sx: {
2396
- direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */",
2397
- display: "grid",
2398
- gridTemplateColumns: getGridTemplateColumns,
2399
- width: `100%`
2344
+ var ToggleButtonGroupUi = React51.forwardRef(
2345
+ ({
2346
+ justify = "end",
2347
+ size = "tiny",
2348
+ value,
2349
+ onChange,
2350
+ items: items2,
2351
+ maxItems,
2352
+ exclusive = false,
2353
+ fullWidth = false,
2354
+ disabled,
2355
+ placeholder
2356
+ }, ref) => {
2357
+ const shouldSliceItems = exclusive && maxItems !== void 0 && items2.length > maxItems;
2358
+ const menuItems = shouldSliceItems ? items2.slice(maxItems - 1) : [];
2359
+ const fixedItems = shouldSliceItems ? items2.slice(0, maxItems - 1) : items2;
2360
+ const theme = (0, import_ui38.useTheme)();
2361
+ const isRtl = "rtl" === theme.direction;
2362
+ const handleChange = (_, newValue) => {
2363
+ onChange(newValue);
2364
+ };
2365
+ const getGridTemplateColumns = (0, import_react27.useMemo)(() => {
2366
+ const isOffLimits = menuItems?.length;
2367
+ const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
2368
+ const templateColumnsSuffix = isOffLimits ? "auto" : "";
2369
+ return `repeat(${itemsCount}, minmax(0, 25%)) ${templateColumnsSuffix}`;
2370
+ }, [menuItems?.length, fixedItems.length]);
2371
+ const shouldShowExclusivePlaceholder = exclusive && (value === null || value === void 0 || value === "");
2372
+ const nonExclusiveSelectedValues = !exclusive && Array.isArray(value) ? value.map((v) => typeof v === "string" ? v : "").join(" ").trim().split(/\s+/).filter(Boolean) : [];
2373
+ const shouldShowNonExclusivePlaceholder = !exclusive && nonExclusiveSelectedValues.length === 0;
2374
+ const getPlaceholderArray = (placeholderValue) => {
2375
+ if (Array.isArray(placeholderValue)) {
2376
+ return placeholderValue.flatMap((p) => {
2377
+ if (typeof p === "string") {
2378
+ return p.trim().split(/\s+/).filter(Boolean);
2379
+ }
2380
+ return [];
2381
+ });
2400
2382
  }
2401
- },
2402
- fixedItems.map(({ label, value: buttonValue, renderContent: Content3, showTooltip }) => {
2403
- const isPlaceholder = placeholderArray.length > 0 && placeholderArray.includes(buttonValue) && (shouldShowExclusivePlaceholder || shouldShowNonExclusivePlaceholder);
2404
- return /* @__PURE__ */ React51.createElement(
2405
- ConditionalTooltip,
2406
- {
2407
- key: buttonValue,
2408
- label,
2409
- showTooltip: showTooltip || false
2410
- },
2411
- /* @__PURE__ */ React51.createElement(
2412
- StyledToggleButton,
2383
+ if (typeof placeholderValue === "string") {
2384
+ return placeholderValue.trim().split(/\s+/).filter(Boolean);
2385
+ }
2386
+ return [];
2387
+ };
2388
+ const placeholderArray = getPlaceholderArray(placeholder);
2389
+ return /* @__PURE__ */ React51.createElement(
2390
+ StyledToggleButtonGroup,
2391
+ {
2392
+ ref,
2393
+ justify,
2394
+ value,
2395
+ onChange: handleChange,
2396
+ exclusive,
2397
+ disabled,
2398
+ sx: {
2399
+ direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */",
2400
+ display: "grid",
2401
+ gridTemplateColumns: getGridTemplateColumns,
2402
+ width: `100%`
2403
+ }
2404
+ },
2405
+ fixedItems.map(({ label, value: buttonValue, renderContent: Content3, showTooltip }) => {
2406
+ const isPlaceholder = placeholderArray.length > 0 && placeholderArray.includes(buttonValue) && (shouldShowExclusivePlaceholder || shouldShowNonExclusivePlaceholder);
2407
+ return /* @__PURE__ */ React51.createElement(
2408
+ ConditionalTooltip,
2413
2409
  {
2414
- value: buttonValue,
2415
- "aria-label": label,
2416
- size,
2417
- fullWidth,
2418
- isPlaceholder
2410
+ key: buttonValue,
2411
+ label,
2412
+ showTooltip: showTooltip || false
2419
2413
  },
2420
- /* @__PURE__ */ React51.createElement(Content3, { size })
2421
- )
2422
- );
2423
- }),
2424
- menuItems.length && exclusive && /* @__PURE__ */ React51.createElement(
2425
- SplitButtonGroup,
2426
- {
2427
- size,
2428
- value: value || null,
2429
- onChange,
2430
- items: menuItems,
2431
- fullWidth
2432
- }
2433
- )
2434
- );
2435
- };
2414
+ /* @__PURE__ */ React51.createElement(
2415
+ StyledToggleButton,
2416
+ {
2417
+ value: buttonValue,
2418
+ "aria-label": label,
2419
+ size,
2420
+ fullWidth,
2421
+ isPlaceholder
2422
+ },
2423
+ /* @__PURE__ */ React51.createElement(Content3, { size })
2424
+ )
2425
+ );
2426
+ }),
2427
+ menuItems.length && exclusive && /* @__PURE__ */ React51.createElement(
2428
+ SplitButtonGroup,
2429
+ {
2430
+ size,
2431
+ value: value || null,
2432
+ onChange,
2433
+ items: menuItems,
2434
+ fullWidth
2435
+ }
2436
+ )
2437
+ );
2438
+ }
2439
+ );
2436
2440
  var ControlToggleButtonGroup = (props) => {
2437
2441
  return /* @__PURE__ */ React51.createElement(ControlActions, null, /* @__PURE__ */ React51.createElement(ToggleButtonGroupUi, { ...props }));
2438
2442
  };
@@ -2468,8 +2472,7 @@ var SplitButtonGroup = ({
2468
2472
  onClick: (ev) => {
2469
2473
  ev.preventDefault();
2470
2474
  onMenuItemClick(previewButton.value);
2471
- },
2472
- ref: menuButtonRef
2475
+ }
2473
2476
  },
2474
2477
  previewButton.renderContent({ size })
2475
2478
  ), /* @__PURE__ */ React51.createElement(
@@ -6207,6 +6210,7 @@ var usePopover = (openOnMount, onOpen) => {
6207
6210
  LinkedDimensionsControl,
6208
6211
  NumberControl,
6209
6212
  PopoverContent,
6213
+ PopoverGridContainer,
6210
6214
  PositionControl,
6211
6215
  PropKeyProvider,
6212
6216
  PropProvider,