@elementor/editor-controls 3.32.0-67 → 3.32.0-68

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
@@ -2,6 +2,7 @@ import * as React$1 from 'react';
2
2
  import { RefObject, ReactNode, FC, PropsWithChildren, ComponentType } from 'react';
3
3
  import { SxProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, FormLabelProps } from '@elementor/ui';
4
4
  import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, PropType, CreateOptions } from '@elementor/editor-props';
5
+ import { StyleDefinitionState } from '@elementor/editor-styles';
5
6
  import * as _elementor_locations from '@elementor/locations';
6
7
 
7
8
  type ImageControlProps = {
@@ -230,6 +231,13 @@ declare const BackgroundControl: ControlComponent<() => React$1.JSX.Element>;
230
231
 
231
232
  declare const SwitchControl: ControlComponent<() => React$1.JSX.Element>;
232
233
 
234
+ type TooltipAddItemActionProps = {
235
+ disabled?: boolean;
236
+ enableTooltip?: boolean;
237
+ tooltipContent?: React$1.ReactNode;
238
+ newItemIndex?: number;
239
+ };
240
+
233
241
  type ChildControlConfig = {
234
242
  component: React.ComponentType;
235
243
  props?: Record<string, unknown>;
@@ -247,8 +255,9 @@ type RepeatableControlProps = {
247
255
  patternLabel?: string;
248
256
  placeholder?: string;
249
257
  propKey?: string;
258
+ addItemTooltipProps?: TooltipAddItemActionProps;
250
259
  };
251
- declare const RepeatableControl: ControlComponent<({ repeaterLabel, childControlConfig, showDuplicate, showToggle, initialValues, patternLabel, placeholder, propKey, }: RepeatableControlProps) => React$1.JSX.Element | null>;
260
+ declare const RepeatableControl: ControlComponent<({ repeaterLabel, childControlConfig, showDuplicate, showToggle, initialValues, patternLabel, placeholder, propKey, addItemTooltipProps, }: RepeatableControlProps) => React$1.JSX.Element | null>;
252
261
 
253
262
  type KeyValueControlProps = {
254
263
  keyName?: string;
@@ -271,8 +280,9 @@ declare const TransformBaseControl: ({ anchorRef }: {
271
280
  anchorRef: React$1.RefObject<HTMLDivElement | null>;
272
281
  }) => React$1.JSX.Element;
273
282
 
274
- declare const TransitionRepeaterControl: ControlComponent<(props: {
283
+ declare const TransitionRepeaterControl: ControlComponent<({ recentlyUsedList, currentStyleState, }: {
275
284
  recentlyUsedList: string[];
285
+ currentStyleState: StyleDefinitionState;
276
286
  }) => React$1.JSX.Element>;
277
287
 
278
288
  declare const PopoverContent: FC<PropsWithChildren<StackProps>>;
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as React$1 from 'react';
2
2
  import { RefObject, ReactNode, FC, PropsWithChildren, ComponentType } from 'react';
3
3
  import { SxProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, FormLabelProps } from '@elementor/ui';
4
4
  import { StringPropValue, PropTypeUtil, PropValue, PropKey, SizePropValue, PropType, CreateOptions } from '@elementor/editor-props';
5
+ import { StyleDefinitionState } from '@elementor/editor-styles';
5
6
  import * as _elementor_locations from '@elementor/locations';
6
7
 
7
8
  type ImageControlProps = {
@@ -230,6 +231,13 @@ declare const BackgroundControl: ControlComponent<() => React$1.JSX.Element>;
230
231
 
231
232
  declare const SwitchControl: ControlComponent<() => React$1.JSX.Element>;
232
233
 
234
+ type TooltipAddItemActionProps = {
235
+ disabled?: boolean;
236
+ enableTooltip?: boolean;
237
+ tooltipContent?: React$1.ReactNode;
238
+ newItemIndex?: number;
239
+ };
240
+
233
241
  type ChildControlConfig = {
234
242
  component: React.ComponentType;
235
243
  props?: Record<string, unknown>;
@@ -247,8 +255,9 @@ type RepeatableControlProps = {
247
255
  patternLabel?: string;
248
256
  placeholder?: string;
249
257
  propKey?: string;
258
+ addItemTooltipProps?: TooltipAddItemActionProps;
250
259
  };
251
- declare const RepeatableControl: ControlComponent<({ repeaterLabel, childControlConfig, showDuplicate, showToggle, initialValues, patternLabel, placeholder, propKey, }: RepeatableControlProps) => React$1.JSX.Element | null>;
260
+ declare const RepeatableControl: ControlComponent<({ repeaterLabel, childControlConfig, showDuplicate, showToggle, initialValues, patternLabel, placeholder, propKey, addItemTooltipProps, }: RepeatableControlProps) => React$1.JSX.Element | null>;
252
261
 
253
262
  type KeyValueControlProps = {
254
263
  keyName?: string;
@@ -271,8 +280,9 @@ declare const TransformBaseControl: ({ anchorRef }: {
271
280
  anchorRef: React$1.RefObject<HTMLDivElement | null>;
272
281
  }) => React$1.JSX.Element;
273
282
 
274
- declare const TransitionRepeaterControl: ControlComponent<(props: {
283
+ declare const TransitionRepeaterControl: ControlComponent<({ recentlyUsedList, currentStyleState, }: {
275
284
  recentlyUsedList: string[];
285
+ currentStyleState: StyleDefinitionState;
276
286
  }) => React$1.JSX.Element>;
277
287
 
278
288
  declare const PopoverContent: FC<PropsWithChildren<StackProps>>;
package/dist/index.js CHANGED
@@ -3458,7 +3458,7 @@ var TooltipAddItemAction = ({
3458
3458
  }) => {
3459
3459
  const { addItem } = useRepeaterContext();
3460
3460
  const onClick = (ev) => addItem(ev, { index: newItemIndex });
3461
- return /* @__PURE__ */ React50.createElement(ConditionalToolTip, { content: tooltipContent, enable: enableTooltip }, /* @__PURE__ */ React50.createElement(import_ui42.Box, { sx: { ml: "auto" } }, /* @__PURE__ */ React50.createElement(
3461
+ return /* @__PURE__ */ React50.createElement(ConditionalToolTip, { content: tooltipContent, enable: enableTooltip }, /* @__PURE__ */ React50.createElement(import_ui42.Box, { sx: { ml: "auto", cursor: disabled ? "not-allowed" : "pointer" } }, /* @__PURE__ */ React50.createElement(
3462
3462
  import_ui42.IconButton,
3463
3463
  {
3464
3464
  size: SIZE4,
@@ -3473,22 +3473,7 @@ var ConditionalToolTip = ({
3473
3473
  children,
3474
3474
  enable,
3475
3475
  content
3476
- }) => enable && content ? /* @__PURE__ */ React50.createElement(
3477
- import_ui42.Infotip,
3478
- {
3479
- placement: "right",
3480
- content: /* @__PURE__ */ React50.createElement(
3481
- import_ui42.Box,
3482
- {
3483
- component: "span",
3484
- "aria-label": void 0,
3485
- sx: { display: "flex", gap: 0.5, p: 2, width: 320, borderRadius: 1 }
3486
- },
3487
- content
3488
- )
3489
- },
3490
- children
3491
- ) : children;
3476
+ }) => enable && content ? /* @__PURE__ */ React50.createElement(import_ui42.Infotip, { placement: "right", color: "secondary", content }, children) : children;
3492
3477
 
3493
3478
  // src/components/unstable-repeater/header/header.tsx
3494
3479
  var React54 = __toESM(require("react"));
@@ -4354,7 +4339,8 @@ var RepeatableControl = createControl(
4354
4339
  initialValues,
4355
4340
  patternLabel,
4356
4341
  placeholder,
4357
- propKey
4342
+ propKey,
4343
+ addItemTooltipProps
4358
4344
  }) => {
4359
4345
  const { propTypeUtil: childPropTypeUtil } = childControlConfig;
4360
4346
  if (!childPropTypeUtil) {
@@ -4379,7 +4365,7 @@ var RepeatableControl = createControl(
4379
4365
  initial: childPropTypeUtil.create(initialValues || null),
4380
4366
  propTypeUtil: childArrayPropTypeUtil
4381
4367
  },
4382
- /* @__PURE__ */ React69.createElement(Header, { label: repeaterLabel }, /* @__PURE__ */ React69.createElement(TooltipAddItemAction, { newItemIndex: 0 })),
4368
+ /* @__PURE__ */ React69.createElement(Header, { label: repeaterLabel }, /* @__PURE__ */ React69.createElement(TooltipAddItemAction, { ...addItemTooltipProps, newItemIndex: 0 })),
4383
4369
  /* @__PURE__ */ React69.createElement(
4384
4370
  ItemsContainer,
4385
4371
  {
@@ -4994,7 +4980,16 @@ var TransformRepeaterControl = createControl(() => {
4994
4980
  const context = useBoundProp(import_editor_props42.transformPropTypeUtil);
4995
4981
  return /* @__PURE__ */ React81.createElement(PropProvider, { ...context }, /* @__PURE__ */ React81.createElement(PropKeyProvider, { bind: "transform-functions" }, /* @__PURE__ */ React81.createElement(Repeater2, null)));
4996
4982
  });
4997
- var ToolTip = /* @__PURE__ */ React81.createElement(React81.Fragment, null, /* @__PURE__ */ React81.createElement(import_icons30.InfoCircleFilledIcon, { sx: { color: "secondary.main" } }), /* @__PURE__ */ React81.createElement(import_ui72.Typography, { variant: "body2", color: "text.secondary", fontSize: "14px" }, (0, import_i18n41.__)("You can use each kind of transform only once per element.", "elementor")));
4983
+ var ToolTip = /* @__PURE__ */ React81.createElement(
4984
+ import_ui72.Box,
4985
+ {
4986
+ component: "span",
4987
+ "aria-label": void 0,
4988
+ sx: { display: "flex", gap: 0.5, p: 2, width: 320, borderRadius: 1 }
4989
+ },
4990
+ /* @__PURE__ */ React81.createElement(import_icons30.InfoCircleFilledIcon, { sx: { color: "secondary.main" } }),
4991
+ /* @__PURE__ */ React81.createElement(import_ui72.Typography, { variant: "body2", color: "text.secondary", fontSize: "14px" }, (0, import_i18n41.__)("You can use each kind of transform only once per element.", "elementor"))
4992
+ );
4998
4993
  var Repeater2 = () => {
4999
4994
  const transformFunctionsContext = useBoundProp(import_editor_props42.transformFunctionsPropTypeUtil);
5000
4995
  const availableValues = [initialTransformValue, initialScaleValue, initialRotateValue, initialSkewValue];
@@ -5025,6 +5020,8 @@ var Repeater2 = () => {
5025
5020
  // src/controls/transition-control/transition-repeater-control.tsx
5026
5021
  var React84 = __toESM(require("react"));
5027
5022
  var import_editor_props45 = require("@elementor/editor-props");
5023
+ var import_icons32 = require("@elementor/icons");
5024
+ var import_ui75 = require("@elementor/ui");
5028
5025
  var import_i18n44 = require("@wordpress/i18n");
5029
5026
 
5030
5027
  // src/controls/selection-size-control.tsx
@@ -5228,32 +5225,56 @@ function getChildControlConfig(recentlyUsedList) {
5228
5225
  props: getSelectionSizeProps(recentlyUsedList)
5229
5226
  };
5230
5227
  }
5231
- var TransitionRepeaterControl = createControl((props) => {
5232
- return /* @__PURE__ */ React84.createElement(
5233
- RepeatableControl,
5234
- {
5235
- label: (0, import_i18n44.__)("Transitions", "elementor"),
5236
- repeaterLabel: (0, import_i18n44.__)("Transitions", "elementor"),
5237
- patternLabel: "${value.selection.value.key.value}: ${value.size.value.size}${value.size.value.unit}",
5238
- placeholder: (0, import_i18n44.__)("Empty Transition", "elementor"),
5239
- showDuplicate: false,
5240
- showToggle: true,
5241
- initialValues: initialTransitionValue,
5242
- childControlConfig: getChildControlConfig(props.recentlyUsedList),
5243
- propKey: "transition"
5244
- }
5245
- );
5246
- });
5228
+ var disableAddItemTooltipContent = /* @__PURE__ */ React84.createElement(
5229
+ import_ui75.Alert,
5230
+ {
5231
+ sx: {
5232
+ width: 280,
5233
+ gap: 0.5
5234
+ },
5235
+ color: "secondary",
5236
+ icon: /* @__PURE__ */ React84.createElement(import_icons32.InfoCircleFilledIcon, null)
5237
+ },
5238
+ /* @__PURE__ */ React84.createElement(import_ui75.AlertTitle, null, (0, import_i18n44.__)("Transitions", "elementor")),
5239
+ /* @__PURE__ */ React84.createElement(import_ui75.Box, { component: "span" }, /* @__PURE__ */ React84.createElement(import_ui75.Typography, { variant: "body2" }, (0, import_i18n44.__)("Switch to 'Normal' state to add a transition.", "elementor")))
5240
+ );
5241
+ var TransitionRepeaterControl = createControl(
5242
+ ({
5243
+ recentlyUsedList,
5244
+ currentStyleState
5245
+ }) => {
5246
+ const currentStyleIsNormal = currentStyleState === null;
5247
+ return /* @__PURE__ */ React84.createElement(
5248
+ RepeatableControl,
5249
+ {
5250
+ label: (0, import_i18n44.__)("Transitions", "elementor"),
5251
+ repeaterLabel: (0, import_i18n44.__)("Transitions", "elementor"),
5252
+ patternLabel: "${value.selection.value.key.value}: ${value.size.value.size}${value.size.value.unit}",
5253
+ placeholder: (0, import_i18n44.__)("Empty Transition", "elementor"),
5254
+ showDuplicate: false,
5255
+ showToggle: true,
5256
+ initialValues: initialTransitionValue,
5257
+ childControlConfig: getChildControlConfig(recentlyUsedList),
5258
+ propKey: "transition",
5259
+ addItemTooltipProps: {
5260
+ disabled: !currentStyleIsNormal,
5261
+ enableTooltip: !currentStyleIsNormal,
5262
+ tooltipContent: disableAddItemTooltipContent
5263
+ }
5264
+ }
5265
+ );
5266
+ }
5267
+ );
5247
5268
 
5248
5269
  // src/components/css-code-editor/css-editor.tsx
5249
5270
  var React86 = __toESM(require("react"));
5250
5271
  var import_editor_responsive2 = require("@elementor/editor-responsive");
5251
- var import_ui76 = require("@elementor/ui");
5272
+ var import_ui77 = require("@elementor/ui");
5252
5273
  var import_react45 = require("@monaco-editor/react");
5253
5274
 
5254
5275
  // src/components/css-code-editor/css-editor.styles.ts
5255
- var import_ui75 = require("@elementor/ui");
5256
- var EditorWrapper = (0, import_ui75.styled)(import_ui75.Box)`
5276
+ var import_ui76 = require("@elementor/ui");
5277
+ var EditorWrapper = (0, import_ui76.styled)(import_ui76.Box)`
5257
5278
  border: 1px solid var( --e-a-border-color );
5258
5279
  border-radius: 8px;
5259
5280
  padding: 10px 12px;
@@ -5264,7 +5285,7 @@ var EditorWrapper = (0, import_ui75.styled)(import_ui75.Box)`
5264
5285
  z-index: 99999999 !important;
5265
5286
  }
5266
5287
  `;
5267
- var ResizeHandle = (0, import_ui75.styled)(import_ui75.Button)`
5288
+ var ResizeHandle = (0, import_ui76.styled)(import_ui76.Button)`
5268
5289
  position: absolute;
5269
5290
  bottom: 0;
5270
5291
  left: 0;
@@ -5471,7 +5492,7 @@ var createEditorDidMountHandler = (editorRef, monacoRef, debounceTimer, onChange
5471
5492
  };
5472
5493
  };
5473
5494
  var CssEditor = ({ value, onChange }) => {
5474
- const theme = (0, import_ui76.useTheme)();
5495
+ const theme = (0, import_ui77.useTheme)();
5475
5496
  const containerRef = React86.useRef(null);
5476
5497
  const editorRef = React86.useRef(null);
5477
5498
  const monacoRef = React86.useRef(null);