@elementor/editor-controls 4.2.0-beta1 → 4.2.3
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 +22 -23
- package/dist/index.d.ts +22 -23
- package/dist/index.js +97 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/components/size-control/size-input.tsx +4 -4
- package/src/controls/email-form-action-control/email-chips-field.tsx +79 -42
- package/src/controls/email-form-action-control/fields.tsx +38 -13
- package/src/controls/email-form-action-control/index.tsx +2 -4
- package/src/controls/email-form-action-control/utils.ts +6 -0
- package/src/controls/gap-control.tsx +3 -1
- package/src/controls/mention-text-area-control.tsx +2 -2
- package/src/controls/select-control.tsx +47 -10
- package/src/controls/size-control/types.ts +3 -10
- package/src/controls/size-control.tsx +8 -6
- package/src/utils/size-control.ts +15 -10
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, Dispatch, SetStateAction, ComponentType } from 'react';
|
|
3
3
|
import { SxProps, SelectProps, UnstableColorFieldProps, StackProps, ToggleButtonProps, PopupState, Theme, FormLabelProps, Grid, TextFieldProps } from '@elementor/ui';
|
|
4
|
-
import { StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, QueryFilterKeyConfig, TransformablePropValue, PropType, CreateOptions
|
|
4
|
+
import { SizePropValue, StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, QueryFilterKeyConfig, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
5
5
|
import * as _emotion_styled from '@emotion/styled';
|
|
6
6
|
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
7
7
|
import { EditorProps, EditorView } from '@tiptap/pm/view';
|
|
@@ -50,19 +50,19 @@ type Props$c = {
|
|
|
50
50
|
};
|
|
51
51
|
declare const MentionTextAreaControl: ControlComponent$1<({ placeholder, ariaLabel, suggestions: allSuggestions, rows, triggerPosition }: Props$c) => React$1.JSX.Element>;
|
|
52
52
|
|
|
53
|
+
type SizeUnit$1 = SizePropValue['value']['unit'];
|
|
54
|
+
type ExtendedOption = Extract<SizeUnit$1, 'auto' | 'custom'>;
|
|
55
|
+
type Unit = Exclude<SizeUnit$1, ExtendedOption>;
|
|
53
56
|
declare const lengthUnits: readonly ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
54
57
|
declare const angleUnits: readonly ["deg", "rad", "grad", "turn"];
|
|
55
58
|
declare const timeUnits: readonly ["s", "ms"];
|
|
56
|
-
|
|
57
|
-
type
|
|
58
|
-
type
|
|
59
|
-
|
|
60
|
-
type ExtendedOption = (typeof defaultExtendedOptions)[number];
|
|
61
|
-
type Unit$1 = LengthUnit$1 | AngleUnit$1 | TimeUnit$1;
|
|
62
|
-
declare function isUnitExtendedOption(unit: Unit$1 | ExtendedOption): unit is ExtendedOption;
|
|
59
|
+
type LengthUnit = Extract<Unit, (typeof lengthUnits)[number] | 'fr'>;
|
|
60
|
+
type AngleUnit = (typeof angleUnits)[number];
|
|
61
|
+
type TimeUnit = (typeof timeUnits)[number];
|
|
62
|
+
declare function isUnitExtendedOption(unit: SizeUnit$1): unit is ExtendedOption;
|
|
63
63
|
|
|
64
64
|
type SizeVariant$1 = 'length' | 'angle' | 'time';
|
|
65
|
-
type UnitProps<T extends readonly Unit
|
|
65
|
+
type UnitProps<T extends readonly Unit[]> = {
|
|
66
66
|
units?: T;
|
|
67
67
|
defaultUnit?: T[number];
|
|
68
68
|
};
|
|
@@ -77,13 +77,13 @@ type BaseSizeControlProps = {
|
|
|
77
77
|
id?: string;
|
|
78
78
|
ariaLabel?: string;
|
|
79
79
|
};
|
|
80
|
-
type LengthSizeControlProps = BaseSizeControlProps & UnitProps<LengthUnit
|
|
80
|
+
type LengthSizeControlProps = BaseSizeControlProps & UnitProps<LengthUnit[]> & {
|
|
81
81
|
variant: 'length';
|
|
82
82
|
};
|
|
83
|
-
type AngleSizeControlProps = BaseSizeControlProps & UnitProps<AngleUnit
|
|
83
|
+
type AngleSizeControlProps = BaseSizeControlProps & UnitProps<AngleUnit[]> & {
|
|
84
84
|
variant: 'angle';
|
|
85
85
|
};
|
|
86
|
-
type TimeSizeControlProps = BaseSizeControlProps & UnitProps<TimeUnit
|
|
86
|
+
type TimeSizeControlProps = BaseSizeControlProps & UnitProps<TimeUnit[]> & {
|
|
87
87
|
variant: 'time';
|
|
88
88
|
};
|
|
89
89
|
type SizeControlProps = LengthSizeControlProps | AngleSizeControlProps | TimeSizeControlProps;
|
|
@@ -105,13 +105,18 @@ type SelectOption$1 = {
|
|
|
105
105
|
value: StringPropValue['value'];
|
|
106
106
|
disabled?: boolean;
|
|
107
107
|
};
|
|
108
|
-
type
|
|
108
|
+
type SelectOptionGroup = {
|
|
109
|
+
label: string;
|
|
109
110
|
options: SelectOption$1[];
|
|
111
|
+
};
|
|
112
|
+
type SelectControlProps = {
|
|
113
|
+
options?: SelectOption$1[];
|
|
114
|
+
groups?: SelectOptionGroup[];
|
|
110
115
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
111
116
|
MenuProps?: SelectProps['MenuProps'];
|
|
112
117
|
ariaLabel?: string;
|
|
113
118
|
};
|
|
114
|
-
declare const SelectControl: ControlComponent$1<({ options, onChange, MenuProps, ariaLabel }: SelectControlProps) => React$1.JSX.Element>;
|
|
119
|
+
declare const SelectControl: ControlComponent$1<({ options, groups, onChange, MenuProps, ariaLabel }: SelectControlProps) => React$1.JSX.Element>;
|
|
115
120
|
|
|
116
121
|
declare const collectionMethods: {
|
|
117
122
|
readonly 'off-canvas': () => SelectOption$1[];
|
|
@@ -530,12 +535,6 @@ type EnhancedPropKeyContextValue<T, P> = PropKeyContextValue<T, P> & {
|
|
|
530
535
|
declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): EnhancedPropKeyContextValue<T, P>;
|
|
531
536
|
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
532
537
|
|
|
533
|
-
type LengthUnit = 'px' | '%' | 'em' | 'rem' | 'vw' | 'vh' | 'ch';
|
|
534
|
-
type AngleUnit = 'deg' | 'rad' | 'grad' | 'turn';
|
|
535
|
-
type TimeUnit = 's' | 'ms';
|
|
536
|
-
type Unit = LengthUnit | AngleUnit | TimeUnit;
|
|
537
|
-
type ExtendedSizeOption = 'auto' | 'custom';
|
|
538
|
-
type SizeUnit$1 = Unit | ExtendedSizeOption;
|
|
539
538
|
type SizeVariant = 'length' | 'angle' | 'time';
|
|
540
539
|
type SetSizeValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
541
540
|
|
|
@@ -724,8 +723,8 @@ declare const InlineEditorToolbar: ({ editor, elementId, sx }: InlineEditorToolb
|
|
|
724
723
|
|
|
725
724
|
type Props$2<TValue> = {
|
|
726
725
|
value: TValue;
|
|
727
|
-
units: Unit
|
|
728
|
-
defaultUnit?: Unit
|
|
726
|
+
units: Unit[];
|
|
727
|
+
defaultUnit?: Unit;
|
|
729
728
|
onChange: (value: TValue) => void;
|
|
730
729
|
onBlur?: (event: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
731
730
|
disabled?: boolean;
|
|
@@ -884,4 +883,4 @@ declare function useTypingBuffer(options?: UseTypingBufferOptions): {
|
|
|
884
883
|
startsWith: (haystack: string, needle: string) => boolean;
|
|
885
884
|
};
|
|
886
885
|
|
|
887
|
-
export { type AdornmentComponent, type AngleUnit
|
|
886
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, AttachmentTypeControl, AttributesControl, BackgroundControl, BoxShadowRepeaterControl, ChipsControl, ClearIconButton, ColorControl, ControlActions, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateRangeControl, DateTimeControl, DisplayConditionsControl, EmailFormActionControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, GridSpanControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, type InlineEditorToolbarProps, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, MentionTextAreaControl, NumberControl, NumberInput, PopoverContent, PopoverGridContainer, PositionControl, type PromotionTrackingData, PromotionTrigger, type PromotionTriggerRef, PropKeyProvider, PropProvider, type PropProviderProps, QueryChipsControl, QueryControl, QueryFilterRepeaterControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeComponent, SizeControl, StrokeControl, StyledToggleButton, StyledToggleButtonGroup, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, TimeRangeControl, TimeStringControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeControl, UnstableSizeField, UrlControl, type UseTypingBufferOptions, type V4PromotionData, type V4PromotionKey, VideoMediaControl, createControl, createControlReplacementsRegistry, enqueueFont, getControlReplacements, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, isUnitExtendedOption, registerControlReplacement, trackUpgradePromotionClick, trackViewPromotion, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useFontFamilies, useSyncExternalState, useTypingBuffer };
|
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, Dispatch, SetStateAction, ComponentType } from 'react';
|
|
3
3
|
import { SxProps, SelectProps, UnstableColorFieldProps, StackProps, ToggleButtonProps, PopupState, Theme, FormLabelProps, Grid, TextFieldProps } from '@elementor/ui';
|
|
4
|
-
import { StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, QueryFilterKeyConfig, TransformablePropValue, PropType, CreateOptions
|
|
4
|
+
import { SizePropValue, StringPropValue, PropTypeUtil, PropValue, PropKey, LinkPropValue, QueryFilterKeyConfig, TransformablePropValue, PropType, CreateOptions } from '@elementor/editor-props';
|
|
5
5
|
import * as _emotion_styled from '@emotion/styled';
|
|
6
6
|
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
7
7
|
import { EditorProps, EditorView } from '@tiptap/pm/view';
|
|
@@ -50,19 +50,19 @@ type Props$c = {
|
|
|
50
50
|
};
|
|
51
51
|
declare const MentionTextAreaControl: ControlComponent$1<({ placeholder, ariaLabel, suggestions: allSuggestions, rows, triggerPosition }: Props$c) => React$1.JSX.Element>;
|
|
52
52
|
|
|
53
|
+
type SizeUnit$1 = SizePropValue['value']['unit'];
|
|
54
|
+
type ExtendedOption = Extract<SizeUnit$1, 'auto' | 'custom'>;
|
|
55
|
+
type Unit = Exclude<SizeUnit$1, ExtendedOption>;
|
|
53
56
|
declare const lengthUnits: readonly ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
54
57
|
declare const angleUnits: readonly ["deg", "rad", "grad", "turn"];
|
|
55
58
|
declare const timeUnits: readonly ["s", "ms"];
|
|
56
|
-
|
|
57
|
-
type
|
|
58
|
-
type
|
|
59
|
-
|
|
60
|
-
type ExtendedOption = (typeof defaultExtendedOptions)[number];
|
|
61
|
-
type Unit$1 = LengthUnit$1 | AngleUnit$1 | TimeUnit$1;
|
|
62
|
-
declare function isUnitExtendedOption(unit: Unit$1 | ExtendedOption): unit is ExtendedOption;
|
|
59
|
+
type LengthUnit = Extract<Unit, (typeof lengthUnits)[number] | 'fr'>;
|
|
60
|
+
type AngleUnit = (typeof angleUnits)[number];
|
|
61
|
+
type TimeUnit = (typeof timeUnits)[number];
|
|
62
|
+
declare function isUnitExtendedOption(unit: SizeUnit$1): unit is ExtendedOption;
|
|
63
63
|
|
|
64
64
|
type SizeVariant$1 = 'length' | 'angle' | 'time';
|
|
65
|
-
type UnitProps<T extends readonly Unit
|
|
65
|
+
type UnitProps<T extends readonly Unit[]> = {
|
|
66
66
|
units?: T;
|
|
67
67
|
defaultUnit?: T[number];
|
|
68
68
|
};
|
|
@@ -77,13 +77,13 @@ type BaseSizeControlProps = {
|
|
|
77
77
|
id?: string;
|
|
78
78
|
ariaLabel?: string;
|
|
79
79
|
};
|
|
80
|
-
type LengthSizeControlProps = BaseSizeControlProps & UnitProps<LengthUnit
|
|
80
|
+
type LengthSizeControlProps = BaseSizeControlProps & UnitProps<LengthUnit[]> & {
|
|
81
81
|
variant: 'length';
|
|
82
82
|
};
|
|
83
|
-
type AngleSizeControlProps = BaseSizeControlProps & UnitProps<AngleUnit
|
|
83
|
+
type AngleSizeControlProps = BaseSizeControlProps & UnitProps<AngleUnit[]> & {
|
|
84
84
|
variant: 'angle';
|
|
85
85
|
};
|
|
86
|
-
type TimeSizeControlProps = BaseSizeControlProps & UnitProps<TimeUnit
|
|
86
|
+
type TimeSizeControlProps = BaseSizeControlProps & UnitProps<TimeUnit[]> & {
|
|
87
87
|
variant: 'time';
|
|
88
88
|
};
|
|
89
89
|
type SizeControlProps = LengthSizeControlProps | AngleSizeControlProps | TimeSizeControlProps;
|
|
@@ -105,13 +105,18 @@ type SelectOption$1 = {
|
|
|
105
105
|
value: StringPropValue['value'];
|
|
106
106
|
disabled?: boolean;
|
|
107
107
|
};
|
|
108
|
-
type
|
|
108
|
+
type SelectOptionGroup = {
|
|
109
|
+
label: string;
|
|
109
110
|
options: SelectOption$1[];
|
|
111
|
+
};
|
|
112
|
+
type SelectControlProps = {
|
|
113
|
+
options?: SelectOption$1[];
|
|
114
|
+
groups?: SelectOptionGroup[];
|
|
110
115
|
onChange?: (newValue: string | null, previousValue: string | null | undefined) => void;
|
|
111
116
|
MenuProps?: SelectProps['MenuProps'];
|
|
112
117
|
ariaLabel?: string;
|
|
113
118
|
};
|
|
114
|
-
declare const SelectControl: ControlComponent$1<({ options, onChange, MenuProps, ariaLabel }: SelectControlProps) => React$1.JSX.Element>;
|
|
119
|
+
declare const SelectControl: ControlComponent$1<({ options, groups, onChange, MenuProps, ariaLabel }: SelectControlProps) => React$1.JSX.Element>;
|
|
115
120
|
|
|
116
121
|
declare const collectionMethods: {
|
|
117
122
|
readonly 'off-canvas': () => SelectOption$1[];
|
|
@@ -530,12 +535,6 @@ type EnhancedPropKeyContextValue<T, P> = PropKeyContextValue<T, P> & {
|
|
|
530
535
|
declare function useBoundProp<T extends PropValue = PropValue, P extends PropType = PropType>(): EnhancedPropKeyContextValue<T, P>;
|
|
531
536
|
declare function useBoundProp<TKey extends string, TValue extends PropValue>(propTypeUtil: PropTypeUtil<TKey, TValue>): UseBoundProp<TValue>;
|
|
532
537
|
|
|
533
|
-
type LengthUnit = 'px' | '%' | 'em' | 'rem' | 'vw' | 'vh' | 'ch';
|
|
534
|
-
type AngleUnit = 'deg' | 'rad' | 'grad' | 'turn';
|
|
535
|
-
type TimeUnit = 's' | 'ms';
|
|
536
|
-
type Unit = LengthUnit | AngleUnit | TimeUnit;
|
|
537
|
-
type ExtendedSizeOption = 'auto' | 'custom';
|
|
538
|
-
type SizeUnit$1 = Unit | ExtendedSizeOption;
|
|
539
538
|
type SizeVariant = 'length' | 'angle' | 'time';
|
|
540
539
|
type SetSizeValue<T> = (value: T, options?: CreateOptions, meta?: SetValueMeta) => void;
|
|
541
540
|
|
|
@@ -724,8 +723,8 @@ declare const InlineEditorToolbar: ({ editor, elementId, sx }: InlineEditorToolb
|
|
|
724
723
|
|
|
725
724
|
type Props$2<TValue> = {
|
|
726
725
|
value: TValue;
|
|
727
|
-
units: Unit
|
|
728
|
-
defaultUnit?: Unit
|
|
726
|
+
units: Unit[];
|
|
727
|
+
defaultUnit?: Unit;
|
|
729
728
|
onChange: (value: TValue) => void;
|
|
730
729
|
onBlur?: (event: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
731
730
|
disabled?: boolean;
|
|
@@ -884,4 +883,4 @@ declare function useTypingBuffer(options?: UseTypingBufferOptions): {
|
|
|
884
883
|
startsWith: (haystack: string, needle: string) => boolean;
|
|
885
884
|
};
|
|
886
885
|
|
|
887
|
-
export { type AdornmentComponent, type AngleUnit
|
|
886
|
+
export { type AdornmentComponent, type AngleUnit, AspectRatioControl, AttachmentTypeControl, AttributesControl, BackgroundControl, BoxShadowRepeaterControl, ChipsControl, ClearIconButton, ColorControl, ControlActions, type ControlActionsItems, ControlActionsProvider, ControlAdornments, ControlAdornmentsProvider, type ControlComponent$1 as ControlComponent, ControlFormLabel, type ControlReplacement, ControlReplacementsProvider, ControlToggleButtonGroup, DateRangeControl, DateTimeControl, DisplayConditionsControl, EmailFormActionControl, type EqualUnequalItems, EqualUnequalSizesControl, type ExtendedOption, FilterRepeaterControl, type FontCategory, FontFamilyControl, GapControl, GridSpanControl, HtmlTagControl, ImageControl, InlineEditingControl, InlineEditor, InlineEditorToolbar, type InlineEditorToolbarProps, ItemSelector, type ItemsActionPayload, KeyValueControl, type LengthUnit, LinkControl, LinkedDimensionsControl, MentionTextAreaControl, NumberControl, NumberInput, PopoverContent, PopoverGridContainer, PositionControl, type PromotionTrackingData, PromotionTrigger, type PromotionTriggerRef, PropKeyProvider, PropProvider, type PropProviderProps, QueryChipsControl, QueryControl, QueryFilterRepeaterControl, RepeatableControl, Repeater, type RepeaterItem, SelectControl, SelectControlWrapper, type SetRepeaterValuesMeta, type SetValue, type SetValueMeta, SizeComponent, SizeControl, StrokeControl, StyledToggleButton, StyledToggleButtonGroup, SvgMediaControl, SwitchControl, TextAreaControl, TextControl, TimeRangeControl, TimeStringControl, type TimeUnit, type ToggleButtonGroupItem, ToggleButtonGroupUi, ToggleControl, type ToggleControlProps, TransformRepeaterControl, TransformSettingsControl, TransitionRepeaterControl, type Unit, UnstableSizeControl, UnstableSizeField, UrlControl, type UseTypingBufferOptions, type V4PromotionData, type V4PromotionKey, VideoMediaControl, createControl, createControlReplacementsRegistry, enqueueFont, getControlReplacements, injectIntoRepeaterItemActions, injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel, isUnitExtendedOption, registerControlReplacement, trackUpgradePromotionClick, trackViewPromotion, transitionProperties, transitionsItemsList, useBoundProp, useControlActions, useControlReplacement, useFontFamilies, useSyncExternalState, useTypingBuffer };
|
package/dist/index.js
CHANGED
|
@@ -584,14 +584,15 @@ var DEFAULT_MENU_PROPS = {
|
|
|
584
584
|
}
|
|
585
585
|
};
|
|
586
586
|
var SelectControl = createControl(
|
|
587
|
-
({ options, onChange, MenuProps = DEFAULT_MENU_PROPS, ariaLabel }) => {
|
|
587
|
+
({ options = [], groups = [], onChange, MenuProps = DEFAULT_MENU_PROPS, ariaLabel }) => {
|
|
588
588
|
const { value, setValue, disabled, placeholder } = useBoundProp(import_editor_props2.stringPropTypeUtil);
|
|
589
589
|
const handleChange = (event) => {
|
|
590
590
|
const newValue = event.target.value || null;
|
|
591
591
|
onChange?.(newValue, value);
|
|
592
592
|
setValue(newValue);
|
|
593
593
|
};
|
|
594
|
-
const
|
|
594
|
+
const flatOptions = flattenGroupedOptions(options, groups);
|
|
595
|
+
const isDisabled = disabled || flatOptions.length === 0;
|
|
595
596
|
return /* @__PURE__ */ React12.createElement(ControlActions, null, /* @__PURE__ */ React12.createElement(
|
|
596
597
|
import_ui5.Select,
|
|
597
598
|
{
|
|
@@ -600,16 +601,41 @@ var SelectControl = createControl(
|
|
|
600
601
|
size: "tiny",
|
|
601
602
|
MenuProps,
|
|
602
603
|
"aria-label": ariaLabel || placeholder,
|
|
603
|
-
renderValue: (selectedValue) => getSelectRenderValue(
|
|
604
|
+
renderValue: (selectedValue) => getSelectRenderValue(flatOptions, placeholder, selectedValue),
|
|
604
605
|
value: value ?? "",
|
|
605
606
|
onChange: handleChange,
|
|
606
607
|
disabled: isDisabled,
|
|
607
608
|
fullWidth: true
|
|
608
609
|
},
|
|
609
|
-
|
|
610
|
+
groups.length ? groups.flatMap((group) => renderGroup(group)) : options.map((option) => renderOption(option))
|
|
610
611
|
));
|
|
611
612
|
}
|
|
612
613
|
);
|
|
614
|
+
var GROUPED_OPTION_INDENT = 3.5;
|
|
615
|
+
function renderGroup(group) {
|
|
616
|
+
return [
|
|
617
|
+
/* @__PURE__ */ React12.createElement(import_ui5.MenuSubheader, { key: `group-${group.label}`, sx: { fontWeight: 400, color: "text.tertiary" } }, group.label),
|
|
618
|
+
...group.options.map((option) => renderOption(option, true))
|
|
619
|
+
];
|
|
620
|
+
}
|
|
621
|
+
function renderOption({ label, ...props }, isGrouped = false) {
|
|
622
|
+
return /* @__PURE__ */ React12.createElement(
|
|
623
|
+
import_editor_ui2.MenuListItem,
|
|
624
|
+
{
|
|
625
|
+
key: props.value,
|
|
626
|
+
...props,
|
|
627
|
+
value: props.value ?? "",
|
|
628
|
+
sx: isGrouped ? { pl: GROUPED_OPTION_INDENT } : void 0
|
|
629
|
+
},
|
|
630
|
+
label
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
function flattenGroupedOptions(options, groups) {
|
|
634
|
+
if (!groups.length) {
|
|
635
|
+
return options;
|
|
636
|
+
}
|
|
637
|
+
return groups.flatMap((group) => group.options);
|
|
638
|
+
}
|
|
613
639
|
function getSelectRenderValue(options, placeholder, selectedValue) {
|
|
614
640
|
const optionWithValue = (v) => options.find(({ value }) => value === v);
|
|
615
641
|
if (!isUnsetSelectValue(selectedValue)) {
|
|
@@ -902,11 +928,11 @@ function useTypingBuffer(options = {}) {
|
|
|
902
928
|
var lengthUnits = ["px", "%", "em", "rem", "vw", "vh", "ch"];
|
|
903
929
|
var angleUnits = ["deg", "rad", "grad", "turn"];
|
|
904
930
|
var timeUnits = ["s", "ms"];
|
|
905
|
-
var defaultExtendedOptions = ["auto", "custom"];
|
|
906
931
|
var DEFAULT_UNIT = "px";
|
|
907
932
|
var DEFAULT_SIZE = NaN;
|
|
933
|
+
var extendedOptions = ["auto", "custom"];
|
|
908
934
|
function isUnitExtendedOption(unit) {
|
|
909
|
-
return
|
|
935
|
+
return extendedOptions.includes(unit);
|
|
910
936
|
}
|
|
911
937
|
|
|
912
938
|
// src/components/size-control/text-field-inner-selection.tsx
|
|
@@ -1236,13 +1262,13 @@ var TextFieldPopover = (props) => {
|
|
|
1236
1262
|
var import_react12 = require("react");
|
|
1237
1263
|
function useSizeExtendedOptions(options, disableCustom) {
|
|
1238
1264
|
return (0, import_react12.useMemo)(() => {
|
|
1239
|
-
const
|
|
1240
|
-
if (!disableCustom && !
|
|
1241
|
-
|
|
1265
|
+
const extendedOptions2 = [...options];
|
|
1266
|
+
if (!disableCustom && !extendedOptions2.includes("custom")) {
|
|
1267
|
+
extendedOptions2.push("custom");
|
|
1242
1268
|
} else if (options.includes("custom")) {
|
|
1243
|
-
|
|
1269
|
+
extendedOptions2.splice(extendedOptions2.indexOf("custom"), 1);
|
|
1244
1270
|
}
|
|
1245
|
-
return
|
|
1271
|
+
return extendedOptions2;
|
|
1246
1272
|
}, [options, disableCustom]);
|
|
1247
1273
|
}
|
|
1248
1274
|
|
|
@@ -1279,6 +1305,11 @@ var useSyncExternalState = ({
|
|
|
1279
1305
|
return [internal, setInternalValue];
|
|
1280
1306
|
};
|
|
1281
1307
|
|
|
1308
|
+
// src/controls/size-control/utils/settings/get-prop-type-settings.ts
|
|
1309
|
+
var getPropTypeSettings = (propType) => {
|
|
1310
|
+
return propType.settings;
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1282
1313
|
// src/controls/size-control.tsx
|
|
1283
1314
|
var defaultSelectedUnit = {
|
|
1284
1315
|
length: "px",
|
|
@@ -1299,7 +1330,7 @@ var SizeControl = createControl(
|
|
|
1299
1330
|
placeholder,
|
|
1300
1331
|
startIcon,
|
|
1301
1332
|
anchorRef,
|
|
1302
|
-
extendedOptions,
|
|
1333
|
+
extendedOptions: extendedOptions2,
|
|
1303
1334
|
disableCustom,
|
|
1304
1335
|
min = 0,
|
|
1305
1336
|
enablePropTypeUnits = false,
|
|
@@ -1316,7 +1347,7 @@ var SizeControl = createControl(
|
|
|
1316
1347
|
} = useBoundProp(import_editor_props8.sizePropTypeUtil);
|
|
1317
1348
|
const actualDefaultUnit = defaultUnit ?? externalPlaceholder?.unit ?? defaultSelectedUnit[variant];
|
|
1318
1349
|
const activeBreakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
|
|
1319
|
-
const actualExtendedOptions = useSizeExtendedOptions(
|
|
1350
|
+
const actualExtendedOptions = useSizeExtendedOptions(extendedOptions2 || [], disableCustom ?? false);
|
|
1320
1351
|
const actualUnits = resolveUnits(propType, enablePropTypeUnits, variant, units2, actualExtendedOptions);
|
|
1321
1352
|
const popupState = (0, import_ui14.usePopupState)({ variant: "popover" });
|
|
1322
1353
|
const memorizedExternalState = (0, import_react14.useMemo)(
|
|
@@ -1405,7 +1436,7 @@ function resolveUnits(propType, enablePropTypeUnits, variant, externalUnits, act
|
|
|
1405
1436
|
if (!enablePropTypeUnits) {
|
|
1406
1437
|
return [...externalUnits ?? fallback, ...actualExtendedOptions || []];
|
|
1407
1438
|
}
|
|
1408
|
-
return propType
|
|
1439
|
+
return getPropTypeSettings(propType)?.available_units ?? fallback;
|
|
1409
1440
|
}
|
|
1410
1441
|
function formatSize(size, unit) {
|
|
1411
1442
|
if (isUnitExtendedOption(unit)) {
|
|
@@ -3712,11 +3743,6 @@ var resolvePlaceholder = (placeholder) => {
|
|
|
3712
3743
|
return typeof size === "number" ? size.toString() : size;
|
|
3713
3744
|
};
|
|
3714
3745
|
|
|
3715
|
-
// src/controls/size-control/utils/settings/get-prop-type-settings.ts
|
|
3716
|
-
var getPropTypeSettings = (propType) => {
|
|
3717
|
-
return propType.settings;
|
|
3718
|
-
};
|
|
3719
|
-
|
|
3720
3746
|
// src/controls/size-control/utils/settings/get-default-unit.ts
|
|
3721
3747
|
var getDefaultUnit = (propType) => {
|
|
3722
3748
|
return getPropTypeSettings(propType)?.default_unit;
|
|
@@ -5167,7 +5193,7 @@ var GapControl = ({ label }) => {
|
|
|
5167
5193
|
const disabled = sizeDisabled || directionDisabled;
|
|
5168
5194
|
const propProviderProps = {
|
|
5169
5195
|
propType,
|
|
5170
|
-
value: directionValue ?? (!isLinked ? { row:
|
|
5196
|
+
value: directionValue ?? (!isLinked ? { row: directionPlaceholder?.row, column: directionPlaceholder?.column } : null),
|
|
5171
5197
|
setValue: (directions) => {
|
|
5172
5198
|
const entries = Object.entries(directions);
|
|
5173
5199
|
const filtered = entries.filter(([, value]) => Boolean(value));
|
|
@@ -8300,6 +8326,10 @@ var CHIP_TRIGGER_KEYS = /* @__PURE__ */ new Set([" ", ","]);
|
|
|
8300
8326
|
function isValidEmail(email) {
|
|
8301
8327
|
return import_schema.z.string().email().safeParse(email).success;
|
|
8302
8328
|
}
|
|
8329
|
+
var FORM_FIELD_SHORTCODE_PATTERN = /^\[[^[\]]+]$/;
|
|
8330
|
+
function isFormFieldShortcode(value) {
|
|
8331
|
+
return FORM_FIELD_SHORTCODE_PATTERN.test(value);
|
|
8332
|
+
}
|
|
8303
8333
|
var shouldShowMentionsInfo = () => {
|
|
8304
8334
|
if (!(0, import_utils9.hasProInstalled)()) {
|
|
8305
8335
|
return true;
|
|
@@ -8312,14 +8342,26 @@ var shouldShowMentionsInfo = () => {
|
|
|
8312
8342
|
};
|
|
8313
8343
|
|
|
8314
8344
|
// src/controls/email-form-action-control/email-chips-field.tsx
|
|
8315
|
-
var
|
|
8345
|
+
var isValidRecipient = (address) => isValidEmail(address) || isFormFieldShortcode(address);
|
|
8346
|
+
function resolveMention(raw, suggestions) {
|
|
8347
|
+
if (!raw.startsWith("@")) {
|
|
8348
|
+
return raw;
|
|
8349
|
+
}
|
|
8350
|
+
const match = suggestions.find((suggestion) => createMentionPattern(suggestion.value, "start").test(raw));
|
|
8351
|
+
return match ? `[${match.value}]` : raw;
|
|
8352
|
+
}
|
|
8353
|
+
var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
|
|
8316
8354
|
const { value, setValue, disabled } = useBoundProp(import_editor_props65.stringArrayPropTypeUtil);
|
|
8317
8355
|
const [inputValue, setInputValue] = (0, import_react69.useState)("");
|
|
8318
8356
|
const items2 = value || [];
|
|
8319
8357
|
const selectedValues = items2.map((item) => import_editor_props65.stringPropTypeUtil.extract(item)).filter((val) => val !== null);
|
|
8358
|
+
const suggestionOptions = (0, import_react69.useMemo)(
|
|
8359
|
+
() => suggestions.map((suggestion) => `[${suggestion.value}]`),
|
|
8360
|
+
[suggestions]
|
|
8361
|
+
);
|
|
8320
8362
|
const tryAddChip = (raw) => {
|
|
8321
|
-
const address = raw.trim();
|
|
8322
|
-
if (!address || selectedValues.includes(address) || !
|
|
8363
|
+
const address = resolveMention(raw.trim(), suggestions);
|
|
8364
|
+
if (!address || selectedValues.includes(address) || !isValidRecipient(address)) {
|
|
8323
8365
|
return;
|
|
8324
8366
|
}
|
|
8325
8367
|
setValue([...items2, import_editor_props65.stringPropTypeUtil.create(address)]);
|
|
@@ -8328,8 +8370,8 @@ var EmailChipsField = ({ fieldLabel, placeholder }) => {
|
|
|
8328
8370
|
const handleChange = (_, newValue) => {
|
|
8329
8371
|
const updated = [];
|
|
8330
8372
|
for (const entry of newValue) {
|
|
8331
|
-
const address = entry.trim();
|
|
8332
|
-
if (!address || !
|
|
8373
|
+
const address = resolveMention(entry.trim(), suggestions);
|
|
8374
|
+
if (!address || !isValidRecipient(address)) {
|
|
8333
8375
|
continue;
|
|
8334
8376
|
}
|
|
8335
8377
|
updated.push(import_editor_props65.stringPropTypeUtil.create(address));
|
|
@@ -8348,7 +8390,7 @@ var EmailChipsField = ({ fieldLabel, placeholder }) => {
|
|
|
8348
8390
|
tryAddChip(inputValue);
|
|
8349
8391
|
}
|
|
8350
8392
|
};
|
|
8351
|
-
return /* @__PURE__ */ React116.createElement(
|
|
8393
|
+
return /* @__PURE__ */ React116.createElement(ControlActions, null, /* @__PURE__ */ React116.createElement(
|
|
8352
8394
|
import_ui100.Autocomplete,
|
|
8353
8395
|
{
|
|
8354
8396
|
fullWidth: true,
|
|
@@ -8364,15 +8406,21 @@ var EmailChipsField = ({ fieldLabel, placeholder }) => {
|
|
|
8364
8406
|
},
|
|
8365
8407
|
value: selectedValues,
|
|
8366
8408
|
onChange: handleChange,
|
|
8367
|
-
options:
|
|
8409
|
+
options: suggestionOptions,
|
|
8410
|
+
filterOptions: (options, state) => {
|
|
8411
|
+
const query = state.inputValue.trim().replace(/^@/, "").toLowerCase();
|
|
8412
|
+
return query ? options.filter((option) => option.toLowerCase().includes(query)) : options;
|
|
8413
|
+
},
|
|
8414
|
+
filterSelectedOptions: true,
|
|
8368
8415
|
onBlur: handleBlur,
|
|
8369
8416
|
getOptionLabel: (option) => option,
|
|
8370
8417
|
isOptionEqualToValue: (option, val) => option === val,
|
|
8371
8418
|
renderInput: (params) => /* @__PURE__ */ React116.createElement(import_ui100.TextField, { ...params, placeholder, onKeyDown: handleKeyDown }),
|
|
8372
8419
|
renderTags: (tagValues, getTagProps) => /* @__PURE__ */ React116.createElement(ChipsList, { getLabel: (option) => option, getTagProps, values: tagValues })
|
|
8373
8420
|
}
|
|
8374
|
-
))
|
|
8375
|
-
};
|
|
8421
|
+
));
|
|
8422
|
+
});
|
|
8423
|
+
var EmailChipsField = ({ fieldLabel, placeholder, suggestions }) => /* @__PURE__ */ React116.createElement(import_ui100.Grid, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React116.createElement(import_ui100.Grid, { item: true }, /* @__PURE__ */ React116.createElement(ControlFormLabel, null, fieldLabel)), /* @__PURE__ */ React116.createElement(import_ui100.Grid, { item: true }, /* @__PURE__ */ React116.createElement(EmailChipsControl, { placeholder, suggestions })));
|
|
8376
8424
|
|
|
8377
8425
|
// src/controls/email-form-action-control/email-field.tsx
|
|
8378
8426
|
var React117 = __toESM(require("react"));
|
|
@@ -8380,7 +8428,17 @@ var import_ui101 = require("@elementor/ui");
|
|
|
8380
8428
|
var EmailField = ({ bind, label, placeholder }) => /* @__PURE__ */ React117.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React117.createElement(import_ui101.Grid, { container: true, direction: "column", gap: 0.5 }, /* @__PURE__ */ React117.createElement(import_ui101.Grid, { item: true }, /* @__PURE__ */ React117.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ React117.createElement(import_ui101.Grid, { item: true }, /* @__PURE__ */ React117.createElement(TextControl, { placeholder }))));
|
|
8381
8429
|
|
|
8382
8430
|
// src/controls/email-form-action-control/fields.tsx
|
|
8383
|
-
var SendToField = ({ placeholder }) =>
|
|
8431
|
+
var SendToField = ({ placeholder }) => {
|
|
8432
|
+
const suggestions = useFormFieldSuggestions({ inputType: "email" });
|
|
8433
|
+
return /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "to" }, /* @__PURE__ */ React118.createElement(import_ui102.Stack, { gap: 0.5 }, /* @__PURE__ */ React118.createElement(
|
|
8434
|
+
EmailChipsField,
|
|
8435
|
+
{
|
|
8436
|
+
fieldLabel: (0, import_i18n57.__)("Send to", "elementor"),
|
|
8437
|
+
placeholder,
|
|
8438
|
+
suggestions
|
|
8439
|
+
}
|
|
8440
|
+
), shouldShowMentionsInfo() && /* @__PURE__ */ React118.createElement(import_editor_ui15.InfoAlert, null, (0, import_i18n57.__)("Type @ or an email field name to insert its submitted value.", "elementor"))));
|
|
8441
|
+
};
|
|
8384
8442
|
var SubjectField = () => /* @__PURE__ */ React118.createElement(
|
|
8385
8443
|
EmailField,
|
|
8386
8444
|
{
|
|
@@ -8424,8 +8482,14 @@ var ReplyToField = () => {
|
|
|
8424
8482
|
}
|
|
8425
8483
|
))));
|
|
8426
8484
|
};
|
|
8427
|
-
var CcField = () =>
|
|
8428
|
-
|
|
8485
|
+
var CcField = () => {
|
|
8486
|
+
const suggestions = useFormFieldSuggestions({ inputType: "email" });
|
|
8487
|
+
return /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "cc" }, /* @__PURE__ */ React118.createElement(EmailChipsField, { fieldLabel: (0, import_i18n57.__)("Cc", "elementor"), suggestions }));
|
|
8488
|
+
};
|
|
8489
|
+
var BccField = () => {
|
|
8490
|
+
const suggestions = useFormFieldSuggestions({ inputType: "email" });
|
|
8491
|
+
return /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "bcc" }, /* @__PURE__ */ React118.createElement(EmailChipsField, { fieldLabel: (0, import_i18n57.__)("Bcc", "elementor"), suggestions }));
|
|
8492
|
+
};
|
|
8429
8493
|
var MetaDataField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider, { bind: "meta-data" }, /* @__PURE__ */ React118.createElement(import_ui102.Stack, { gap: 0.5 }, /* @__PURE__ */ React118.createElement(ControlFormLabel, null, (0, import_i18n57.__)("Metadata", "elementor")), /* @__PURE__ */ React118.createElement(
|
|
8430
8494
|
ChipsControl,
|
|
8431
8495
|
{
|
|
@@ -8452,7 +8516,7 @@ var SendAsField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider,
|
|
|
8452
8516
|
var EmailFormActionControl = createControl(
|
|
8453
8517
|
({ toPlaceholder, label }) => {
|
|
8454
8518
|
const { value, setValue, ...propContext } = useBoundProp(import_editor_props66.emailsPropTypeUtil);
|
|
8455
|
-
return /* @__PURE__ */ React119.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React119.createElement(import_ui103.Stack, { gap: 2 }, /* @__PURE__ */ React119.createElement(ControlLabel, null, label ? label + " " + (0, import_i18n58.__)("settings", "elementor") : (0, import_i18n58.__)("Email settings", "elementor")), /* @__PURE__ */ React119.createElement(
|
|
8519
|
+
return /* @__PURE__ */ React119.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React119.createElement(import_ui103.Stack, { gap: 2 }, /* @__PURE__ */ React119.createElement(ControlLabel, null, label ? label + " " + (0, import_i18n58.__)("settings", "elementor") : (0, import_i18n58.__)("Email settings", "elementor")), /* @__PURE__ */ React119.createElement(SendToField, { placeholder: toPlaceholder }), /* @__PURE__ */ React119.createElement(SubjectField, null), /* @__PURE__ */ React119.createElement(MessageField, null), /* @__PURE__ */ React119.createElement(FromEmailField, null), /* @__PURE__ */ React119.createElement(AdvancedSettings, null)));
|
|
8456
8520
|
}
|
|
8457
8521
|
);
|
|
8458
8522
|
var AdvancedSettings = () => /* @__PURE__ */ React119.createElement(import_editor_ui16.CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ React119.createElement(import_ui103.Box, { sx: { pt: 2 } }, /* @__PURE__ */ React119.createElement(import_ui103.Stack, { gap: 2 }, /* @__PURE__ */ React119.createElement(FromNameField, null), /* @__PURE__ */ React119.createElement(ReplyToField, null), /* @__PURE__ */ React119.createElement(CcField, null), /* @__PURE__ */ React119.createElement(BccField, null), /* @__PURE__ */ React119.createElement(import_ui103.Divider, null), /* @__PURE__ */ React119.createElement(MetaDataField, null), /* @__PURE__ */ React119.createElement(SendAsField, null))));
|