@elementor/editor-controls 4.0.0-498 → 4.0.0-499
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 +28 -19
- package/dist/index.d.ts +28 -19
- package/dist/index.js +165 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +164 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/size/unit-select.tsx +69 -0
- package/src/components/size/unstable-size-field.tsx +63 -0
- package/src/components/size/unstable-size-input.tsx +46 -0
- package/src/hooks/use-size-value.ts +49 -0
- package/src/index.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { RefObject, ReactNode, FC, PropsWithChildren, ComponentProps, ReactElement, ComponentType } from 'react';
|
|
3
3
|
import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps, Grid } from '@elementor/ui';
|
|
4
|
-
import { StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
4
|
+
import { StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, TransformablePropValue, PropType, CreateOptions, SizePropValue } from '@elementor/editor-props';
|
|
5
5
|
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
6
6
|
import { ElementID } from '@elementor/editor-elements';
|
|
7
7
|
import { Editor } from '@tiptap/react';
|
|
@@ -26,11 +26,11 @@ declare const TextControl: ControlComponent$1<({ placeholder, error, inputValue,
|
|
|
26
26
|
ariaLabel?: string;
|
|
27
27
|
}) => React$1.JSX.Element>;
|
|
28
28
|
|
|
29
|
-
type Props$
|
|
29
|
+
type Props$9 = {
|
|
30
30
|
placeholder?: string;
|
|
31
31
|
ariaLabel?: string;
|
|
32
32
|
};
|
|
33
|
-
declare const TextAreaControl: ControlComponent$1<({ placeholder, ariaLabel }: Props$
|
|
33
|
+
declare const TextAreaControl: ControlComponent$1<({ placeholder, ariaLabel }: Props$9) => React$1.JSX.Element>;
|
|
34
34
|
|
|
35
35
|
declare const lengthUnits: readonly ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
36
36
|
declare const angleUnits: readonly ["deg", "rad", "grad", "turn"];
|
|
@@ -102,12 +102,12 @@ type SelectControlWrapperProps = Parameters<typeof SelectControl>[0] & {
|
|
|
102
102
|
};
|
|
103
103
|
declare const SelectControlWrapper: ControlComponent$1<({ collectionId, options, ...props }: SelectControlWrapperProps) => React$1.JSX.Element>;
|
|
104
104
|
|
|
105
|
-
type Props$
|
|
105
|
+
type Props$8 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
106
106
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
107
107
|
anchorEl?: HTMLElement | null;
|
|
108
108
|
id?: string;
|
|
109
109
|
};
|
|
110
|
-
declare const ColorControl: ControlComponent$1<({ propTypeUtil, anchorEl, slotProps, id, ...props }: Props$
|
|
110
|
+
declare const ColorControl: ControlComponent$1<({ propTypeUtil, anchorEl, slotProps, id, ...props }: Props$8) => React$1.JSX.Element>;
|
|
111
111
|
|
|
112
112
|
type RenderContentProps = {
|
|
113
113
|
size: ToggleButtonProps['size'];
|
|
@@ -120,7 +120,7 @@ type ToggleButtonGroupItem<TValue> = {
|
|
|
120
120
|
};
|
|
121
121
|
type ExclusiveValue<TValue> = TValue;
|
|
122
122
|
type NonExclusiveValue<TValue> = TValue[];
|
|
123
|
-
type Props$
|
|
123
|
+
type Props$7<TValue> = {
|
|
124
124
|
disabled?: boolean;
|
|
125
125
|
justify?: StackProps['justifyContent'];
|
|
126
126
|
size?: ToggleButtonProps['size'];
|
|
@@ -137,10 +137,10 @@ type Props$6<TValue> = {
|
|
|
137
137
|
value: ExclusiveValue<TValue>;
|
|
138
138
|
onChange: (value: ExclusiveValue<TValue>) => void;
|
|
139
139
|
});
|
|
140
|
-
declare const ToggleButtonGroupUi: <TValue>(props: Props$
|
|
140
|
+
declare const ToggleButtonGroupUi: <TValue>(props: Props$7<TValue> & {
|
|
141
141
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
142
142
|
}) => React$1.ReactElement;
|
|
143
|
-
declare const ControlToggleButtonGroup: <TValue>(props: Props$
|
|
143
|
+
declare const ControlToggleButtonGroup: <TValue>(props: Props$7<TValue>) => React$1.JSX.Element;
|
|
144
144
|
|
|
145
145
|
type ToggleControlProps<T extends PropValue> = {
|
|
146
146
|
options: Array<ToggleButtonGroupItem<T> & {
|
|
@@ -171,22 +171,22 @@ type Item$1 = {
|
|
|
171
171
|
bind: PropKey;
|
|
172
172
|
};
|
|
173
173
|
type EqualUnequalItems = [Item$1, Item$1, Item$1, Item$1];
|
|
174
|
-
type Props$
|
|
174
|
+
type Props$6<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
175
175
|
label: string;
|
|
176
176
|
icon: ReactNode;
|
|
177
177
|
tooltipLabel: string;
|
|
178
178
|
items: EqualUnequalItems;
|
|
179
179
|
multiSizePropTypeUtil: PropTypeUtil<TMultiPropType, TPropValue>;
|
|
180
180
|
};
|
|
181
|
-
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$
|
|
181
|
+
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$6<TMultiPropType, TPropValue>): React$1.JSX.Element;
|
|
182
182
|
|
|
183
|
-
type Props$
|
|
183
|
+
type Props$5 = {
|
|
184
184
|
label: string;
|
|
185
185
|
isSiteRtl?: boolean;
|
|
186
186
|
extendedOptions?: ExtendedOption[];
|
|
187
187
|
min?: number;
|
|
188
188
|
};
|
|
189
|
-
declare const LinkedDimensionsControl: ({ label, isSiteRtl, extendedOptions, min }: Props$
|
|
189
|
+
declare const LinkedDimensionsControl: ({ label, isSiteRtl, extendedOptions, min }: Props$5) => React$1.JSX.Element;
|
|
190
190
|
|
|
191
191
|
type FontCategory = {
|
|
192
192
|
label: string;
|
|
@@ -239,7 +239,7 @@ type ControlProps<TControlProps = unknown> = TControlProps & {
|
|
|
239
239
|
};
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
type Props$
|
|
242
|
+
type Props$4 = ControlProps<{
|
|
243
243
|
queryOptions: {
|
|
244
244
|
params: Record<string, unknown>;
|
|
245
245
|
url: string;
|
|
@@ -251,21 +251,21 @@ type Props$3 = ControlProps<{
|
|
|
251
251
|
ariaLabel?: string;
|
|
252
252
|
}>;
|
|
253
253
|
type DestinationProp = LinkPropValue['value']['destination'];
|
|
254
|
-
declare const LinkControl: ControlComponent$1<(props: Props$
|
|
254
|
+
declare const LinkControl: ControlComponent$1<(props: Props$4) => React$1.JSX.Element>;
|
|
255
255
|
|
|
256
256
|
type SelectOption = {
|
|
257
257
|
label: string;
|
|
258
258
|
value: StringPropValue['value'];
|
|
259
259
|
disabled?: boolean;
|
|
260
260
|
};
|
|
261
|
-
type Props$
|
|
261
|
+
type Props$3 = {
|
|
262
262
|
options: SelectOption[];
|
|
263
263
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
264
264
|
fallbackLabels?: Record<string, string>;
|
|
265
265
|
};
|
|
266
|
-
declare const HtmlTagControl: ControlComponent$1<({ options, onChange, fallbackLabels }: Props$
|
|
266
|
+
declare const HtmlTagControl: ControlComponent$1<({ options, onChange, fallbackLabels }: Props$3) => React$1.JSX.Element>;
|
|
267
267
|
|
|
268
|
-
type Props$
|
|
268
|
+
type Props$2 = {
|
|
269
269
|
queryOptions: {
|
|
270
270
|
params: Record<string, unknown>;
|
|
271
271
|
url: string;
|
|
@@ -276,7 +276,7 @@ type Props$1 = {
|
|
|
276
276
|
onSetValue?: (value: DestinationProp | null) => void;
|
|
277
277
|
ariaLabel?: string;
|
|
278
278
|
};
|
|
279
|
-
declare const QueryControl: ControlComponent$1<(props: Props$
|
|
279
|
+
declare const QueryControl: ControlComponent$1<(props: Props$2) => React$1.JSX.Element>;
|
|
280
280
|
|
|
281
281
|
declare const GapControl: ({ label }: {
|
|
282
282
|
label: string;
|
|
@@ -580,6 +580,15 @@ type InlineEditorToolbarProps = {
|
|
|
580
580
|
};
|
|
581
581
|
declare const InlineEditorToolbar: ({ editor, elementId }: InlineEditorToolbarProps) => React$1.JSX.Element;
|
|
582
582
|
|
|
583
|
+
type Props$1<TValue> = {
|
|
584
|
+
units: Unit[];
|
|
585
|
+
value: TValue;
|
|
586
|
+
defaultValue?: Partial<TValue>;
|
|
587
|
+
onChange: (value: TValue) => void;
|
|
588
|
+
onBlur?: (event: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
589
|
+
};
|
|
590
|
+
declare const UnstableSizeField: <T extends SizePropValue["value"]>({ value, defaultValue, onChange, onBlur, units, }: Props$1<T>) => React$1.JSX.Element;
|
|
591
|
+
|
|
583
592
|
type AnyComponentType = ComponentType<any>;
|
|
584
593
|
declare const brandSymbol: unique symbol;
|
|
585
594
|
type ControlComponent$1<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
|
|
@@ -671,4 +680,4 @@ declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhe
|
|
|
671
680
|
|
|
672
681
|
declare const useElementCanHaveChildren: () => boolean;
|
|
673
682
|
|
|
674
|
-
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, 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, useControlReplacement, useElementCanHaveChildren, useFloatingActionsBar, useSyncExternalState };
|
|
683
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, 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, UnstableSizeField, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useElementCanHaveChildren, useFloatingActionsBar, useSyncExternalState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { RefObject, ReactNode, FC, PropsWithChildren, ComponentProps, ReactElement, ComponentType } from 'react';
|
|
3
3
|
import { SxProps, SelectProps, UnstableColorFieldProps, ToggleButtonProps, StackProps, PopupState, Theme, FormLabelProps, Grid } from '@elementor/ui';
|
|
4
|
-
import { StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
4
|
+
import { StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, TransformablePropValue, PropType, CreateOptions, SizePropValue } from '@elementor/editor-props';
|
|
5
5
|
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
6
6
|
import { ElementID } from '@elementor/editor-elements';
|
|
7
7
|
import { Editor } from '@tiptap/react';
|
|
@@ -26,11 +26,11 @@ declare const TextControl: ControlComponent$1<({ placeholder, error, inputValue,
|
|
|
26
26
|
ariaLabel?: string;
|
|
27
27
|
}) => React$1.JSX.Element>;
|
|
28
28
|
|
|
29
|
-
type Props$
|
|
29
|
+
type Props$9 = {
|
|
30
30
|
placeholder?: string;
|
|
31
31
|
ariaLabel?: string;
|
|
32
32
|
};
|
|
33
|
-
declare const TextAreaControl: ControlComponent$1<({ placeholder, ariaLabel }: Props$
|
|
33
|
+
declare const TextAreaControl: ControlComponent$1<({ placeholder, ariaLabel }: Props$9) => React$1.JSX.Element>;
|
|
34
34
|
|
|
35
35
|
declare const lengthUnits: readonly ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
36
36
|
declare const angleUnits: readonly ["deg", "rad", "grad", "turn"];
|
|
@@ -102,12 +102,12 @@ type SelectControlWrapperProps = Parameters<typeof SelectControl>[0] & {
|
|
|
102
102
|
};
|
|
103
103
|
declare const SelectControlWrapper: ControlComponent$1<({ collectionId, options, ...props }: SelectControlWrapperProps) => React$1.JSX.Element>;
|
|
104
104
|
|
|
105
|
-
type Props$
|
|
105
|
+
type Props$8 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
106
106
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
107
107
|
anchorEl?: HTMLElement | null;
|
|
108
108
|
id?: string;
|
|
109
109
|
};
|
|
110
|
-
declare const ColorControl: ControlComponent$1<({ propTypeUtil, anchorEl, slotProps, id, ...props }: Props$
|
|
110
|
+
declare const ColorControl: ControlComponent$1<({ propTypeUtil, anchorEl, slotProps, id, ...props }: Props$8) => React$1.JSX.Element>;
|
|
111
111
|
|
|
112
112
|
type RenderContentProps = {
|
|
113
113
|
size: ToggleButtonProps['size'];
|
|
@@ -120,7 +120,7 @@ type ToggleButtonGroupItem<TValue> = {
|
|
|
120
120
|
};
|
|
121
121
|
type ExclusiveValue<TValue> = TValue;
|
|
122
122
|
type NonExclusiveValue<TValue> = TValue[];
|
|
123
|
-
type Props$
|
|
123
|
+
type Props$7<TValue> = {
|
|
124
124
|
disabled?: boolean;
|
|
125
125
|
justify?: StackProps['justifyContent'];
|
|
126
126
|
size?: ToggleButtonProps['size'];
|
|
@@ -137,10 +137,10 @@ type Props$6<TValue> = {
|
|
|
137
137
|
value: ExclusiveValue<TValue>;
|
|
138
138
|
onChange: (value: ExclusiveValue<TValue>) => void;
|
|
139
139
|
});
|
|
140
|
-
declare const ToggleButtonGroupUi: <TValue>(props: Props$
|
|
140
|
+
declare const ToggleButtonGroupUi: <TValue>(props: Props$7<TValue> & {
|
|
141
141
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
142
142
|
}) => React$1.ReactElement;
|
|
143
|
-
declare const ControlToggleButtonGroup: <TValue>(props: Props$
|
|
143
|
+
declare const ControlToggleButtonGroup: <TValue>(props: Props$7<TValue>) => React$1.JSX.Element;
|
|
144
144
|
|
|
145
145
|
type ToggleControlProps<T extends PropValue> = {
|
|
146
146
|
options: Array<ToggleButtonGroupItem<T> & {
|
|
@@ -171,22 +171,22 @@ type Item$1 = {
|
|
|
171
171
|
bind: PropKey;
|
|
172
172
|
};
|
|
173
173
|
type EqualUnequalItems = [Item$1, Item$1, Item$1, Item$1];
|
|
174
|
-
type Props$
|
|
174
|
+
type Props$6<TMultiPropType extends string, TPropValue extends MultiSizePropValue> = {
|
|
175
175
|
label: string;
|
|
176
176
|
icon: ReactNode;
|
|
177
177
|
tooltipLabel: string;
|
|
178
178
|
items: EqualUnequalItems;
|
|
179
179
|
multiSizePropTypeUtil: PropTypeUtil<TMultiPropType, TPropValue>;
|
|
180
180
|
};
|
|
181
|
-
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$
|
|
181
|
+
declare function EqualUnequalSizesControl<TMultiPropType extends string, TPropValue extends MultiSizePropValue>({ label, icon, tooltipLabel, items, multiSizePropTypeUtil, }: Props$6<TMultiPropType, TPropValue>): React$1.JSX.Element;
|
|
182
182
|
|
|
183
|
-
type Props$
|
|
183
|
+
type Props$5 = {
|
|
184
184
|
label: string;
|
|
185
185
|
isSiteRtl?: boolean;
|
|
186
186
|
extendedOptions?: ExtendedOption[];
|
|
187
187
|
min?: number;
|
|
188
188
|
};
|
|
189
|
-
declare const LinkedDimensionsControl: ({ label, isSiteRtl, extendedOptions, min }: Props$
|
|
189
|
+
declare const LinkedDimensionsControl: ({ label, isSiteRtl, extendedOptions, min }: Props$5) => React$1.JSX.Element;
|
|
190
190
|
|
|
191
191
|
type FontCategory = {
|
|
192
192
|
label: string;
|
|
@@ -239,7 +239,7 @@ type ControlProps<TControlProps = unknown> = TControlProps & {
|
|
|
239
239
|
};
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
type Props$
|
|
242
|
+
type Props$4 = ControlProps<{
|
|
243
243
|
queryOptions: {
|
|
244
244
|
params: Record<string, unknown>;
|
|
245
245
|
url: string;
|
|
@@ -251,21 +251,21 @@ type Props$3 = ControlProps<{
|
|
|
251
251
|
ariaLabel?: string;
|
|
252
252
|
}>;
|
|
253
253
|
type DestinationProp = LinkPropValue['value']['destination'];
|
|
254
|
-
declare const LinkControl: ControlComponent$1<(props: Props$
|
|
254
|
+
declare const LinkControl: ControlComponent$1<(props: Props$4) => React$1.JSX.Element>;
|
|
255
255
|
|
|
256
256
|
type SelectOption = {
|
|
257
257
|
label: string;
|
|
258
258
|
value: StringPropValue['value'];
|
|
259
259
|
disabled?: boolean;
|
|
260
260
|
};
|
|
261
|
-
type Props$
|
|
261
|
+
type Props$3 = {
|
|
262
262
|
options: SelectOption[];
|
|
263
263
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
264
264
|
fallbackLabels?: Record<string, string>;
|
|
265
265
|
};
|
|
266
|
-
declare const HtmlTagControl: ControlComponent$1<({ options, onChange, fallbackLabels }: Props$
|
|
266
|
+
declare const HtmlTagControl: ControlComponent$1<({ options, onChange, fallbackLabels }: Props$3) => React$1.JSX.Element>;
|
|
267
267
|
|
|
268
|
-
type Props$
|
|
268
|
+
type Props$2 = {
|
|
269
269
|
queryOptions: {
|
|
270
270
|
params: Record<string, unknown>;
|
|
271
271
|
url: string;
|
|
@@ -276,7 +276,7 @@ type Props$1 = {
|
|
|
276
276
|
onSetValue?: (value: DestinationProp | null) => void;
|
|
277
277
|
ariaLabel?: string;
|
|
278
278
|
};
|
|
279
|
-
declare const QueryControl: ControlComponent$1<(props: Props$
|
|
279
|
+
declare const QueryControl: ControlComponent$1<(props: Props$2) => React$1.JSX.Element>;
|
|
280
280
|
|
|
281
281
|
declare const GapControl: ({ label }: {
|
|
282
282
|
label: string;
|
|
@@ -580,6 +580,15 @@ type InlineEditorToolbarProps = {
|
|
|
580
580
|
};
|
|
581
581
|
declare const InlineEditorToolbar: ({ editor, elementId }: InlineEditorToolbarProps) => React$1.JSX.Element;
|
|
582
582
|
|
|
583
|
+
type Props$1<TValue> = {
|
|
584
|
+
units: Unit[];
|
|
585
|
+
value: TValue;
|
|
586
|
+
defaultValue?: Partial<TValue>;
|
|
587
|
+
onChange: (value: TValue) => void;
|
|
588
|
+
onBlur?: (event: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
589
|
+
};
|
|
590
|
+
declare const UnstableSizeField: <T extends SizePropValue["value"]>({ value, defaultValue, onChange, onBlur, units, }: Props$1<T>) => React$1.JSX.Element;
|
|
591
|
+
|
|
583
592
|
type AnyComponentType = ComponentType<any>;
|
|
584
593
|
declare const brandSymbol: unique symbol;
|
|
585
594
|
type ControlComponent$1<TComponent extends AnyComponentType = AnyComponentType> = TComponent & {
|
|
@@ -671,4 +680,4 @@ declare const useSyncExternalState: <TValue>({ external, setExternal, persistWhe
|
|
|
671
680
|
|
|
672
681
|
declare const useElementCanHaveChildren: () => boolean;
|
|
673
682
|
|
|
674
|
-
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, 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, useControlReplacement, useElementCanHaveChildren, useFloatingActionsBar, useSyncExternalState };
|
|
683
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, BackgroundControl, BoxShadowRepeaterControl, ClearIconButton, ColorControl, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateTimeControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, FloatingActionsBar, type FontCategory, FontFamilyControl, GapControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, 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, UnstableSizeField, UrlControl, createControl, createControlReplacementsRegistry, enqueueFont, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useElementCanHaveChildren, useFloatingActionsBar, useSyncExternalState };
|
package/dist/index.js
CHANGED
|
@@ -78,6 +78,7 @@ __export(index_exports, {
|
|
|
78
78
|
TransformRepeaterControl: () => TransformRepeaterControl,
|
|
79
79
|
TransformSettingsControl: () => TransformSettingsControl,
|
|
80
80
|
TransitionRepeaterControl: () => TransitionRepeaterControl,
|
|
81
|
+
UnstableSizeField: () => UnstableSizeField,
|
|
81
82
|
UrlControl: () => UrlControl,
|
|
82
83
|
createControl: () => createControl,
|
|
83
84
|
createControlReplacementsRegistry: () => createControlReplacementsRegistry,
|
|
@@ -732,14 +733,14 @@ var TextFieldInnerSelection = (0, import_react9.forwardRef)(
|
|
|
732
733
|
id
|
|
733
734
|
}, ref) => {
|
|
734
735
|
const { placeholder: boundPropPlaceholder } = useBoundProp(import_editor_props6.sizePropTypeUtil);
|
|
735
|
-
const
|
|
736
|
+
const getCursorStyle2 = () => ({
|
|
736
737
|
input: { cursor: InputProps.readOnly ? "default !important" : void 0 }
|
|
737
738
|
});
|
|
738
739
|
return /* @__PURE__ */ React18.createElement(
|
|
739
740
|
NumberInput,
|
|
740
741
|
{
|
|
741
742
|
ref,
|
|
742
|
-
sx:
|
|
743
|
+
sx: getCursorStyle2(),
|
|
743
744
|
size: "tiny",
|
|
744
745
|
fullWidth: true,
|
|
745
746
|
type,
|
|
@@ -6978,6 +6979,167 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
6978
6979
|
popoverProps
|
|
6979
6980
|
};
|
|
6980
6981
|
};
|
|
6982
|
+
|
|
6983
|
+
// src/components/size/unstable-size-field.tsx
|
|
6984
|
+
var React107 = __toESM(require("react"));
|
|
6985
|
+
var import_ui92 = require("@elementor/ui");
|
|
6986
|
+
|
|
6987
|
+
// src/hooks/use-size-value.ts
|
|
6988
|
+
var useSizeValue = (externalValue, onChange, defaultValue) => {
|
|
6989
|
+
const [sizeValue, setSizeValue] = useSyncExternalState({
|
|
6990
|
+
external: externalValue,
|
|
6991
|
+
setExternal: (newState) => {
|
|
6992
|
+
if (newState !== null) {
|
|
6993
|
+
onChange(newState);
|
|
6994
|
+
}
|
|
6995
|
+
},
|
|
6996
|
+
persistWhen: (newState) => differsFromExternal(newState, externalValue),
|
|
6997
|
+
fallback: () => defaultValue
|
|
6998
|
+
});
|
|
6999
|
+
const setSize = (value) => {
|
|
7000
|
+
const newState = {
|
|
7001
|
+
...sizeValue,
|
|
7002
|
+
size: value.trim() === "" ? null : Number(value)
|
|
7003
|
+
};
|
|
7004
|
+
setSizeValue(newState);
|
|
7005
|
+
};
|
|
7006
|
+
const setUnit = (unit) => {
|
|
7007
|
+
const newState = {
|
|
7008
|
+
...sizeValue,
|
|
7009
|
+
unit
|
|
7010
|
+
};
|
|
7011
|
+
setSizeValue(newState);
|
|
7012
|
+
};
|
|
7013
|
+
return {
|
|
7014
|
+
size: sizeValue.size,
|
|
7015
|
+
unit: sizeValue.unit,
|
|
7016
|
+
setSize,
|
|
7017
|
+
setUnit
|
|
7018
|
+
};
|
|
7019
|
+
};
|
|
7020
|
+
var differsFromExternal = (newState, externalState) => {
|
|
7021
|
+
return newState.size !== externalState.size || newState.unit !== externalState.unit;
|
|
7022
|
+
};
|
|
7023
|
+
|
|
7024
|
+
// src/components/size/unit-select.tsx
|
|
7025
|
+
var React105 = __toESM(require("react"));
|
|
7026
|
+
var import_react59 = require("react");
|
|
7027
|
+
var import_editor_ui12 = require("@elementor/editor-ui");
|
|
7028
|
+
var import_ui91 = require("@elementor/ui");
|
|
7029
|
+
var menuItemContentStyles = {
|
|
7030
|
+
display: "flex",
|
|
7031
|
+
flexDirection: "column",
|
|
7032
|
+
justifyContent: "center"
|
|
7033
|
+
};
|
|
7034
|
+
var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
|
|
7035
|
+
const popupState = (0, import_ui91.usePopupState)({
|
|
7036
|
+
variant: "popover",
|
|
7037
|
+
popupId: (0, import_react59.useId)()
|
|
7038
|
+
});
|
|
7039
|
+
const handleMenuItemClick = (index) => {
|
|
7040
|
+
onClick(options[index]);
|
|
7041
|
+
popupState.close();
|
|
7042
|
+
};
|
|
7043
|
+
return /* @__PURE__ */ React105.createElement(React105.Fragment, null, /* @__PURE__ */ React105.createElement(StyledButton2, { isPrimaryColor: showPrimaryColor, size: "small", ...(0, import_ui91.bindTrigger)(popupState) }, value), /* @__PURE__ */ React105.createElement(import_ui91.Menu, { MenuListProps: { dense: true }, ...(0, import_ui91.bindMenu)(popupState) }, options.map((option, index) => /* @__PURE__ */ React105.createElement(
|
|
7044
|
+
import_editor_ui12.MenuListItem,
|
|
7045
|
+
{
|
|
7046
|
+
key: option,
|
|
7047
|
+
onClick: () => handleMenuItemClick(index),
|
|
7048
|
+
primaryTypographyProps: {
|
|
7049
|
+
variant: "caption",
|
|
7050
|
+
sx: {
|
|
7051
|
+
...menuItemContentStyles,
|
|
7052
|
+
lineHeight: "1"
|
|
7053
|
+
}
|
|
7054
|
+
},
|
|
7055
|
+
menuItemTextProps: {
|
|
7056
|
+
sx: menuItemContentStyles
|
|
7057
|
+
}
|
|
7058
|
+
},
|
|
7059
|
+
option.toUpperCase()
|
|
7060
|
+
))));
|
|
7061
|
+
};
|
|
7062
|
+
var StyledButton2 = (0, import_ui91.styled)(import_ui91.Button, {
|
|
7063
|
+
shouldForwardProp: (prop) => prop !== "isPrimaryColor"
|
|
7064
|
+
})(({ isPrimaryColor, theme }) => ({
|
|
7065
|
+
color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
|
|
7066
|
+
font: "inherit",
|
|
7067
|
+
minWidth: "initial",
|
|
7068
|
+
textTransform: "uppercase"
|
|
7069
|
+
}));
|
|
7070
|
+
|
|
7071
|
+
// src/components/size/unstable-size-input.tsx
|
|
7072
|
+
var React106 = __toESM(require("react"));
|
|
7073
|
+
var import_react60 = require("react");
|
|
7074
|
+
var UnstableSizeInput = (0, import_react60.forwardRef)(
|
|
7075
|
+
({ type, value, onChange, onKeyDown, onKeyUp, InputProps, onBlur, focused, disabled }, ref) => {
|
|
7076
|
+
return /* @__PURE__ */ React106.createElement(
|
|
7077
|
+
NumberInput,
|
|
7078
|
+
{
|
|
7079
|
+
ref,
|
|
7080
|
+
size: "tiny",
|
|
7081
|
+
fullWidth: true,
|
|
7082
|
+
type,
|
|
7083
|
+
value,
|
|
7084
|
+
onKeyUp,
|
|
7085
|
+
focused,
|
|
7086
|
+
disabled,
|
|
7087
|
+
onKeyDown,
|
|
7088
|
+
onInput: onChange,
|
|
7089
|
+
onBlur,
|
|
7090
|
+
InputProps,
|
|
7091
|
+
sx: getCursorStyle(InputProps?.readOnly ?? false)
|
|
7092
|
+
}
|
|
7093
|
+
);
|
|
7094
|
+
}
|
|
7095
|
+
);
|
|
7096
|
+
var getCursorStyle = (readOnly) => ({
|
|
7097
|
+
input: { cursor: readOnly ? "default !important" : void 0 }
|
|
7098
|
+
});
|
|
7099
|
+
|
|
7100
|
+
// src/components/size/unstable-size-field.tsx
|
|
7101
|
+
var DEFAULT_VALUE = {
|
|
7102
|
+
unit: "px",
|
|
7103
|
+
size: 0
|
|
7104
|
+
};
|
|
7105
|
+
var UnstableSizeField = ({
|
|
7106
|
+
value,
|
|
7107
|
+
defaultValue,
|
|
7108
|
+
onChange,
|
|
7109
|
+
onBlur,
|
|
7110
|
+
units: units2
|
|
7111
|
+
}) => {
|
|
7112
|
+
const { size, unit, setSize, setUnit } = useSizeValue(value, onChange, {
|
|
7113
|
+
...DEFAULT_VALUE,
|
|
7114
|
+
...defaultValue
|
|
7115
|
+
});
|
|
7116
|
+
const shouldHighlightUnit = () => {
|
|
7117
|
+
return hasValue(size);
|
|
7118
|
+
};
|
|
7119
|
+
return /* @__PURE__ */ React107.createElement(
|
|
7120
|
+
UnstableSizeInput,
|
|
7121
|
+
{
|
|
7122
|
+
type: "number",
|
|
7123
|
+
value: size ?? "",
|
|
7124
|
+
onBlur,
|
|
7125
|
+
onChange: (event) => setSize(event.target.value),
|
|
7126
|
+
InputProps: {
|
|
7127
|
+
endAdornment: /* @__PURE__ */ React107.createElement(import_ui92.InputAdornment, { position: "end" }, /* @__PURE__ */ React107.createElement(
|
|
7128
|
+
UnitSelect,
|
|
7129
|
+
{
|
|
7130
|
+
options: units2,
|
|
7131
|
+
value: unit,
|
|
7132
|
+
onClick: setUnit,
|
|
7133
|
+
showPrimaryColor: shouldHighlightUnit()
|
|
7134
|
+
}
|
|
7135
|
+
))
|
|
7136
|
+
}
|
|
7137
|
+
}
|
|
7138
|
+
);
|
|
7139
|
+
};
|
|
7140
|
+
var hasValue = (value) => {
|
|
7141
|
+
return value !== null && value !== "";
|
|
7142
|
+
};
|
|
6981
7143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6982
7144
|
0 && (module.exports = {
|
|
6983
7145
|
AspectRatioControl,
|
|
@@ -7028,6 +7190,7 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7028
7190
|
TransformRepeaterControl,
|
|
7029
7191
|
TransformSettingsControl,
|
|
7030
7192
|
TransitionRepeaterControl,
|
|
7193
|
+
UnstableSizeField,
|
|
7031
7194
|
UrlControl,
|
|
7032
7195
|
createControl,
|
|
7033
7196
|
createControlReplacementsRegistry,
|