@elementor/editor-controls 0.20.0 → 0.24.0
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/CHANGELOG.md +48 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +373 -290
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +307 -224
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/control-form-label.tsx +6 -0
- package/src/components/control-label.tsx +12 -3
- package/src/components/repeater.tsx +18 -8
- package/src/components/sortable.tsx +6 -6
- package/src/components/text-field-inner-selection.tsx +3 -3
- package/src/controls/background-control/background-control.tsx +2 -2
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx +2 -2
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx +2 -2
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx +2 -2
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx +2 -2
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +30 -5
- package/src/controls/color-control.tsx +1 -1
- package/src/controls/equal-unequal-sizes-control.tsx +2 -1
- package/src/controls/font-family-control/font-family-control.tsx +2 -0
- package/src/controls/gap-control.tsx +3 -2
- package/src/controls/image-control.tsx +3 -3
- package/src/controls/link-control.tsx +99 -27
- package/src/controls/linked-dimensions-control.tsx +7 -6
- package/src/controls/stroke-control.tsx +2 -2
- package/src/controls/svg-media-control.tsx +2 -2
- package/src/index.ts +2 -1
- package/src/control-adornments/control-label-with-adornments.tsx +0 -15
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-controls",
|
|
3
3
|
"description": "This package contains the controls model and utils for the Elementor editor",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@elementor/editor-current-user": "0.3.0",
|
|
44
|
-
"@elementor/editor-elements": "0.
|
|
44
|
+
"@elementor/editor-elements": "0.8.0",
|
|
45
45
|
"@elementor/editor-props": "0.11.1",
|
|
46
|
-
"@elementor/editor-ui": "0.
|
|
46
|
+
"@elementor/editor-ui": "0.7.0",
|
|
47
47
|
"@elementor/env": "0.3.5",
|
|
48
48
|
"@elementor/http": "0.1.4",
|
|
49
49
|
"@elementor/icons": "1.37.0",
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type PropsWithChildren } from 'react';
|
|
3
|
+
import { Stack } from '@elementor/ui';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { ControlAdornments } from '../control-adornments/control-adornments';
|
|
6
|
+
import { ControlFormLabel } from './control-form-label';
|
|
7
|
+
|
|
8
|
+
export const ControlLabel = ( { children }: PropsWithChildren< object > ) => {
|
|
9
|
+
return (
|
|
10
|
+
<Stack direction="row" alignItems="center" justifyItems="start" gap={ 1 }>
|
|
11
|
+
<ControlFormLabel>{ children }</ControlFormLabel>
|
|
12
|
+
<ControlAdornments />
|
|
13
|
+
</Stack>
|
|
14
|
+
);
|
|
6
15
|
};
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from '@elementor/ui';
|
|
18
18
|
import { __ } from '@wordpress/i18n';
|
|
19
19
|
|
|
20
|
+
import { ControlAdornments } from '../control-adornments/control-adornments';
|
|
20
21
|
import { useSyncExternalState } from '../hooks/use-sync-external-state';
|
|
21
22
|
import { SectionContent } from './section-content';
|
|
22
23
|
import { SortableItem, SortableProvider } from './sortable';
|
|
@@ -47,6 +48,8 @@ type RepeaterProps< T > = {
|
|
|
47
48
|
};
|
|
48
49
|
};
|
|
49
50
|
|
|
51
|
+
const EMPTY_OPEN_ITEM = -1;
|
|
52
|
+
|
|
50
53
|
export const Repeater = < T, >( {
|
|
51
54
|
label,
|
|
52
55
|
itemSettings,
|
|
@@ -55,7 +58,7 @@ export const Repeater = < T, >( {
|
|
|
55
58
|
values: repeaterValues = [],
|
|
56
59
|
setValues: setRepeaterValues,
|
|
57
60
|
}: RepeaterProps< Item< T > > ) => {
|
|
58
|
-
const [ openItem, setOpenItem ] = useState(
|
|
61
|
+
const [ openItem, setOpenItem ] = useState( EMPTY_OPEN_ITEM );
|
|
59
62
|
|
|
60
63
|
const [ items, setItems ] = useSyncExternalState( {
|
|
61
64
|
external: repeaterValues,
|
|
@@ -139,11 +142,17 @@ export const Repeater = < T, >( {
|
|
|
139
142
|
|
|
140
143
|
return (
|
|
141
144
|
<SectionContent>
|
|
142
|
-
<Stack direction="row" justifyContent="
|
|
145
|
+
<Stack direction="row" justifyContent="start" alignItems="center" gap={ 1 }>
|
|
143
146
|
<Typography component="label" variant="caption" color="text.secondary">
|
|
144
147
|
{ label }
|
|
145
148
|
</Typography>
|
|
146
|
-
<
|
|
149
|
+
<ControlAdornments />
|
|
150
|
+
<IconButton
|
|
151
|
+
sx={ { ml: 'auto' } }
|
|
152
|
+
size={ SIZE }
|
|
153
|
+
onClick={ addRepeaterItem }
|
|
154
|
+
aria-label={ __( 'Add item', 'elementor' ) }
|
|
155
|
+
>
|
|
147
156
|
<PlusIcon fontSize={ SIZE } />
|
|
148
157
|
</IconButton>
|
|
149
158
|
</Stack>
|
|
@@ -159,7 +168,6 @@ export const Repeater = < T, >( {
|
|
|
159
168
|
return (
|
|
160
169
|
<SortableItem id={ key } key={ `sortable-${ key }` }>
|
|
161
170
|
<RepeaterItem
|
|
162
|
-
bind={ String( index ) }
|
|
163
171
|
disabled={ value?.disabled }
|
|
164
172
|
label={ <itemSettings.Label value={ value } /> }
|
|
165
173
|
startIcon={ <itemSettings.Icon value={ value } /> }
|
|
@@ -167,6 +175,7 @@ export const Repeater = < T, >( {
|
|
|
167
175
|
duplicateItem={ () => duplicateRepeaterItem( index ) }
|
|
168
176
|
toggleDisableItem={ () => toggleDisableRepeaterItem( index ) }
|
|
169
177
|
openOnMount={ openOnAdd && openItem === key }
|
|
178
|
+
onOpen={ () => setOpenItem( EMPTY_OPEN_ITEM ) }
|
|
170
179
|
>
|
|
171
180
|
{ ( props ) => (
|
|
172
181
|
<itemSettings.Content { ...props } value={ value } bind={ String( index ) } />
|
|
@@ -183,7 +192,6 @@ export const Repeater = < T, >( {
|
|
|
183
192
|
|
|
184
193
|
type RepeaterItemProps = {
|
|
185
194
|
label: React.ReactNode;
|
|
186
|
-
bind: string;
|
|
187
195
|
disabled?: boolean;
|
|
188
196
|
startIcon: UnstableTagProps[ 'startIcon' ];
|
|
189
197
|
removeItem: () => void;
|
|
@@ -191,6 +199,7 @@ type RepeaterItemProps = {
|
|
|
191
199
|
toggleDisableItem: () => void;
|
|
192
200
|
children: ( { anchorEl }: { anchorEl: AnchorEl } ) => React.ReactNode;
|
|
193
201
|
openOnMount: boolean;
|
|
202
|
+
onOpen: () => void;
|
|
194
203
|
};
|
|
195
204
|
|
|
196
205
|
const RepeaterItem = ( {
|
|
@@ -202,9 +211,10 @@ const RepeaterItem = ( {
|
|
|
202
211
|
duplicateItem,
|
|
203
212
|
toggleDisableItem,
|
|
204
213
|
openOnMount,
|
|
214
|
+
onOpen,
|
|
205
215
|
}: RepeaterItemProps ) => {
|
|
206
216
|
const [ anchorEl, setAnchorEl ] = useState< AnchorEl >( null );
|
|
207
|
-
const { popoverState, popoverProps, ref, setRef } = usePopover( openOnMount );
|
|
217
|
+
const { popoverState, popoverProps, ref, setRef } = usePopover( openOnMount, onOpen );
|
|
208
218
|
|
|
209
219
|
const duplicateLabel = __( 'Duplicate', 'elementor' );
|
|
210
220
|
const toggleLabel = disabled ? __( 'Show', 'elementor' ) : __( 'Hide', 'elementor' );
|
|
@@ -240,7 +250,6 @@ const RepeaterItem = ( {
|
|
|
240
250
|
</Tooltip>
|
|
241
251
|
</>
|
|
242
252
|
}
|
|
243
|
-
sx={ { backgroundColor: 'background.paper' } }
|
|
244
253
|
/>
|
|
245
254
|
<Popover
|
|
246
255
|
disablePortal
|
|
@@ -260,7 +269,7 @@ const RepeaterItem = ( {
|
|
|
260
269
|
);
|
|
261
270
|
};
|
|
262
271
|
|
|
263
|
-
const usePopover = ( openOnMount: boolean ) => {
|
|
272
|
+
const usePopover = ( openOnMount: boolean, onOpen: () => void ) => {
|
|
264
273
|
const [ ref, setRef ] = useState< HTMLElement | null >( null );
|
|
265
274
|
|
|
266
275
|
const popoverState = usePopupState( { variant: 'popover' } );
|
|
@@ -270,6 +279,7 @@ const usePopover = ( openOnMount: boolean ) => {
|
|
|
270
279
|
useEffect( () => {
|
|
271
280
|
if ( openOnMount && ref ) {
|
|
272
281
|
popoverState.open( ref );
|
|
282
|
+
onOpen?.();
|
|
273
283
|
}
|
|
274
284
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
275
285
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -34,16 +34,11 @@ export const SortableItem = ( { id, children }: SortableItemProps ): React.React
|
|
|
34
34
|
triggerProps,
|
|
35
35
|
itemStyle,
|
|
36
36
|
triggerStyle,
|
|
37
|
-
isDragOverlay,
|
|
38
37
|
showDropIndication,
|
|
39
38
|
dropIndicationStyle,
|
|
40
39
|
}: UnstableSortableItemRenderProps ) => {
|
|
41
40
|
return (
|
|
42
|
-
<StyledListItem
|
|
43
|
-
{ ...itemProps }
|
|
44
|
-
style={ itemStyle }
|
|
45
|
-
sx={ { backgroundColor: isDragOverlay ? 'background.paper' : undefined } }
|
|
46
|
-
>
|
|
41
|
+
<StyledListItem { ...itemProps } style={ itemStyle }>
|
|
47
42
|
<SortableTrigger { ...triggerProps } style={ triggerStyle } />
|
|
48
43
|
{ children }
|
|
49
44
|
{ showDropIndication && <StyledDivider style={ dropIndicationStyle } /> }
|
|
@@ -72,6 +67,11 @@ const StyledListItem = styled( ListItem )`
|
|
|
72
67
|
transform: translate( -75%, -50% );
|
|
73
68
|
}
|
|
74
69
|
|
|
70
|
+
&[aria-describedby=''] > .MuiTag-root {
|
|
71
|
+
background-color: ${ ( { theme } ) => theme.palette.background.paper };
|
|
72
|
+
box-shadow: ${ ( { theme } ) => theme.shadows[ 3 ] };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
75
|
&:hover {
|
|
76
76
|
& .class-item-sortable-trigger {
|
|
77
77
|
visibility: visible;
|
|
@@ -58,11 +58,11 @@ export const SelectionEndAdornment = < T extends string >( {
|
|
|
58
58
|
<InputAdornment position="end">
|
|
59
59
|
<Button
|
|
60
60
|
size="small"
|
|
61
|
-
color="
|
|
62
|
-
sx={ { font: 'inherit', minWidth: 'initial' } }
|
|
61
|
+
color="secondary"
|
|
62
|
+
sx={ { font: 'inherit', minWidth: 'initial', textTransform: 'uppercase' } }
|
|
63
63
|
{ ...bindTrigger( popupState ) }
|
|
64
64
|
>
|
|
65
|
-
{ value
|
|
65
|
+
{ value }
|
|
66
66
|
</Button>
|
|
67
67
|
|
|
68
68
|
<Menu MenuListProps={ { dense: true } } { ...bindMenu( popupState ) }>
|
|
@@ -4,7 +4,7 @@ import { Grid } from '@elementor/ui';
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
6
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../../bound-prop-context';
|
|
7
|
-
import {
|
|
7
|
+
import { ControlFormLabel } from '../../components/control-form-label';
|
|
8
8
|
import { SectionContent } from '../../components/section-content';
|
|
9
9
|
import { createControl } from '../../create-control';
|
|
10
10
|
import { ColorControl } from '../color-control';
|
|
@@ -22,7 +22,7 @@ export const BackgroundControl = createControl( () => {
|
|
|
22
22
|
<PropKeyProvider bind="color">
|
|
23
23
|
<Grid container gap={ 2 } alignItems="center" flexWrap="nowrap">
|
|
24
24
|
<Grid item xs={ 6 }>
|
|
25
|
-
<
|
|
25
|
+
<ControlFormLabel>{ __( 'Color', 'elementor' ) }</ControlFormLabel>
|
|
26
26
|
</Grid>
|
|
27
27
|
<Grid item xs={ 6 }>
|
|
28
28
|
<ColorControl />
|
|
@@ -3,7 +3,7 @@ import { PinIcon, PinnedOffIcon } from '@elementor/icons';
|
|
|
3
3
|
import { Grid } from '@elementor/ui';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ControlFormLabel } from '../../../../components/control-form-label';
|
|
7
7
|
import { type ToggleButtonGroupItem } from '../../../../components/control-toggle-button-group';
|
|
8
8
|
import { PopoverGridContainer } from '../../../../components/popover-grid-container';
|
|
9
9
|
import { ToggleControl } from '../../../toggle-control';
|
|
@@ -29,7 +29,7 @@ export const BackgroundImageOverlayAttachment = () => {
|
|
|
29
29
|
return (
|
|
30
30
|
<PopoverGridContainer>
|
|
31
31
|
<Grid item xs={ 6 }>
|
|
32
|
-
<
|
|
32
|
+
<ControlFormLabel>{ __( 'Attachment', 'elementor' ) }</ControlFormLabel>
|
|
33
33
|
</Grid>
|
|
34
34
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end', overflow: 'hidden' } }>
|
|
35
35
|
<ToggleControl options={ attachmentControlOptions } />
|
|
@@ -6,7 +6,7 @@ import { Grid, Select, type SelectChangeEvent } from '@elementor/ui';
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
8
8
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../../../../bound-prop-context';
|
|
9
|
-
import {
|
|
9
|
+
import { ControlFormLabel } from '../../../../components/control-form-label';
|
|
10
10
|
import { PopoverGridContainer } from '../../../../components/popover-grid-container';
|
|
11
11
|
import { SizeControl } from '../../../size-control';
|
|
12
12
|
|
|
@@ -56,7 +56,7 @@ export const BackgroundImageOverlayPosition = () => {
|
|
|
56
56
|
<Grid item xs={ 12 }>
|
|
57
57
|
<PopoverGridContainer>
|
|
58
58
|
<Grid item xs={ 6 }>
|
|
59
|
-
<
|
|
59
|
+
<ControlFormLabel>{ __( 'Position', 'elementor' ) }</ControlFormLabel>
|
|
60
60
|
</Grid>
|
|
61
61
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end', overflow: 'hidden' } }>
|
|
62
62
|
<Select
|
|
@@ -3,7 +3,7 @@ import { DotsHorizontalIcon, DotsVerticalIcon, GridDotsIcon, XIcon } from '@elem
|
|
|
3
3
|
import { Grid } from '@elementor/ui';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ControlFormLabel } from '../../../../components/control-form-label';
|
|
7
7
|
import { type ToggleButtonGroupItem } from '../../../../components/control-toggle-button-group';
|
|
8
8
|
import { PopoverGridContainer } from '../../../../components/popover-grid-container';
|
|
9
9
|
import { ToggleControl } from '../../../toggle-control';
|
|
@@ -41,7 +41,7 @@ export const BackgroundImageOverlayRepeat = () => {
|
|
|
41
41
|
return (
|
|
42
42
|
<PopoverGridContainer>
|
|
43
43
|
<Grid item xs={ 6 }>
|
|
44
|
-
<
|
|
44
|
+
<ControlFormLabel>{ __( 'Repeat', 'elementor' ) }</ControlFormLabel>
|
|
45
45
|
</Grid>
|
|
46
46
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
47
47
|
<ToggleControl options={ repeatControlOptions } />
|
|
@@ -12,7 +12,7 @@ import { Grid } from '@elementor/ui';
|
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../../../../bound-prop-context';
|
|
15
|
-
import {
|
|
15
|
+
import { ControlFormLabel } from '../../../../components/control-form-label';
|
|
16
16
|
import {
|
|
17
17
|
ControlToggleButtonGroup,
|
|
18
18
|
type ToggleButtonGroupItem,
|
|
@@ -68,7 +68,7 @@ export const BackgroundImageOverlaySize = () => {
|
|
|
68
68
|
<Grid item xs={ 12 }>
|
|
69
69
|
<PopoverGridContainer>
|
|
70
70
|
<Grid item xs={ 6 }>
|
|
71
|
-
<
|
|
71
|
+
<ControlFormLabel>{ __( 'Size', 'elementor' ) }</ControlFormLabel>
|
|
72
72
|
</Grid>
|
|
73
73
|
<Grid item xs={ 6 } sx={ { display: 'flex', justifyContent: 'flex-end' } }>
|
|
74
74
|
<ControlToggleButtonGroup
|
package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
colorPropTypeUtil,
|
|
8
8
|
type PropKey,
|
|
9
9
|
} from '@elementor/editor-props';
|
|
10
|
-
import { Box, CardMedia, Grid, Tab, TabPanel, Tabs, UnstableColorIndicator } from '@elementor/ui';
|
|
10
|
+
import { Box, CardMedia, Grid, styled, Tab, TabPanel, Tabs, type Theme, UnstableColorIndicator } from '@elementor/ui';
|
|
11
11
|
import { useWpMediaAttachment } from '@elementor/wp-media';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
@@ -160,19 +160,29 @@ const extractColorFrom = ( prop: BackgroundOverlayItemPropValue ) => {
|
|
|
160
160
|
|
|
161
161
|
const ItemIconColor = ( { value: prop }: { value: BackgroundOverlayItemPropValue } ) => {
|
|
162
162
|
const color = extractColorFrom( prop );
|
|
163
|
-
return <
|
|
163
|
+
return <StyledUnstableColorIndicator size="inherit" component="span" value={ color } />;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
166
|
const ItemIconImage = ( { value }: { value: BackgroundImageOverlay } ) => {
|
|
167
167
|
const { imageUrl } = useImage( value );
|
|
168
168
|
|
|
169
|
-
return
|
|
169
|
+
return (
|
|
170
|
+
<CardMedia
|
|
171
|
+
image={ imageUrl }
|
|
172
|
+
sx={ ( theme: Theme ) => ( {
|
|
173
|
+
height: '1em',
|
|
174
|
+
width: '1em',
|
|
175
|
+
borderRadius: `${ theme.shape.borderRadius / 2 }px`,
|
|
176
|
+
outline: `1px solid ${ theme.palette.action.disabled }`,
|
|
177
|
+
} ) }
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
170
180
|
};
|
|
171
181
|
|
|
172
182
|
const ItemIconGradient = ( { value }: { value: BackgroundOverlayItemPropValue } ) => {
|
|
173
183
|
const gradient = getGradientValue( value );
|
|
174
184
|
|
|
175
|
-
return <
|
|
185
|
+
return <StyledUnstableColorIndicator size="inherit" component="span" value={ gradient } />;
|
|
176
186
|
};
|
|
177
187
|
|
|
178
188
|
const ItemLabel = ( { value }: { value: BackgroundOverlayItemPropValue } ) => {
|
|
@@ -249,6 +259,10 @@ const ImageOverlayContent = () => {
|
|
|
249
259
|
);
|
|
250
260
|
};
|
|
251
261
|
|
|
262
|
+
const StyledUnstableColorIndicator = styled( UnstableColorIndicator )( ( { theme } ) => ( {
|
|
263
|
+
borderRadius: `${ theme.shape.borderRadius / 2 }px`,
|
|
264
|
+
} ) );
|
|
265
|
+
|
|
252
266
|
const useImage = ( image: BackgroundImageOverlay ) => {
|
|
253
267
|
let imageTitle,
|
|
254
268
|
imageUrl: string | null = null;
|
|
@@ -257,7 +271,7 @@ const useImage = ( image: BackgroundImageOverlay ) => {
|
|
|
257
271
|
const { data: attachment } = useWpMediaAttachment( imageSrc.id?.value || null );
|
|
258
272
|
|
|
259
273
|
if ( imageSrc.id ) {
|
|
260
|
-
const imageFileTypeExtension = attachment?.
|
|
274
|
+
const imageFileTypeExtension = getFileExtensionFromFilename( attachment?.filename );
|
|
261
275
|
imageTitle = `${ attachment?.title }${ imageFileTypeExtension }` || null;
|
|
262
276
|
imageUrl = attachment?.url || null;
|
|
263
277
|
} else if ( imageSrc.url ) {
|
|
@@ -268,6 +282,17 @@ const useImage = ( image: BackgroundImageOverlay ) => {
|
|
|
268
282
|
return { imageTitle, imageUrl };
|
|
269
283
|
};
|
|
270
284
|
|
|
285
|
+
const getFileExtensionFromFilename = ( filename?: string ) => {
|
|
286
|
+
if ( ! filename ) {
|
|
287
|
+
return '';
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// get the substring after the last . in the filename
|
|
291
|
+
const extension = filename.substring( filename.lastIndexOf( '.' ) + 1 );
|
|
292
|
+
|
|
293
|
+
return `.${ extension }`;
|
|
294
|
+
};
|
|
295
|
+
|
|
271
296
|
const getGradientValue = ( value: BackgroundOverlayItemPropValue ) => {
|
|
272
297
|
const gradient = value.value;
|
|
273
298
|
|
|
@@ -14,7 +14,7 @@ export const ColorControl = createControl( ( { propTypeUtil = colorPropTypeUtil,
|
|
|
14
14
|
const { value, setValue } = useBoundProp( propTypeUtil );
|
|
15
15
|
|
|
16
16
|
const handleChange = ( selectedColor: string ) => {
|
|
17
|
-
setValue( selectedColor );
|
|
17
|
+
setValue( selectedColor || null );
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
return (
|
|
@@ -5,6 +5,7 @@ import { bindPopover, bindToggle, Grid, Popover, Stack, ToggleButton, Tooltip, u
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
|
|
8
|
+
import { ControlFormLabel } from '../components/control-form-label';
|
|
8
9
|
import { ControlLabel } from '../components/control-label';
|
|
9
10
|
import { PopoverContent } from '../components/popover-content';
|
|
10
11
|
import { PopoverGridContainer } from '../components/popover-grid-container';
|
|
@@ -160,7 +161,7 @@ const MultiSizeValueControl = ( { item }: { item: Item } ) => (
|
|
|
160
161
|
<Grid item xs={ 6 }>
|
|
161
162
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
162
163
|
<Grid item xs={ 12 }>
|
|
163
|
-
<
|
|
164
|
+
<ControlFormLabel>{ item.label }</ControlFormLabel>
|
|
164
165
|
</Grid>
|
|
165
166
|
<Grid item xs={ 12 }>
|
|
166
167
|
<SizeControl startIcon={ item.icon } />
|
|
@@ -5,6 +5,7 @@ import { Grid, Stack, ToggleButton, Tooltip } from '@elementor/ui';
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
|
|
8
|
+
import { ControlFormLabel } from '../components/control-form-label';
|
|
8
9
|
import { ControlLabel } from '../components/control-label';
|
|
9
10
|
import { createControl } from '../create-control';
|
|
10
11
|
import { SizeControl } from './size-control';
|
|
@@ -61,7 +62,7 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
61
62
|
<Stack direction="row" gap={ 2 } flexWrap="nowrap">
|
|
62
63
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
63
64
|
<Grid item xs={ 12 }>
|
|
64
|
-
<
|
|
65
|
+
<ControlFormLabel>{ __( 'Column', 'elementor' ) }</ControlFormLabel>
|
|
65
66
|
</Grid>
|
|
66
67
|
<Grid item xs={ 12 }>
|
|
67
68
|
<Control bind={ 'column' } isLinked={ isLinked } />
|
|
@@ -69,7 +70,7 @@ export const GapControl = createControl( ( { label }: { label: string } ) => {
|
|
|
69
70
|
</Grid>
|
|
70
71
|
<Grid container gap={ 0.75 } alignItems="center">
|
|
71
72
|
<Grid item xs={ 12 }>
|
|
72
|
-
<
|
|
73
|
+
<ControlFormLabel>{ __( 'Row', 'elementor' ) }</ControlFormLabel>
|
|
73
74
|
</Grid>
|
|
74
75
|
<Grid item xs={ 12 }>
|
|
75
76
|
<Control bind={ 'row' } isLinked={ isLinked } />
|
|
@@ -5,7 +5,7 @@ import { type MediaType } from '@elementor/wp-media';
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
|
|
8
|
-
import {
|
|
8
|
+
import { ControlFormLabel } from '../components/control-form-label';
|
|
9
9
|
import { createControl } from '../create-control';
|
|
10
10
|
import { useUnfilteredFilesUpload } from '../hooks/use-unfiltered-files-upload';
|
|
11
11
|
import { ImageMediaControl } from './image-media-control';
|
|
@@ -27,13 +27,13 @@ export const ImageControl = createControl(
|
|
|
27
27
|
<PropProvider { ...propContext }>
|
|
28
28
|
<Stack gap={ 1.5 }>
|
|
29
29
|
<PropKeyProvider bind={ 'src' }>
|
|
30
|
-
<
|
|
30
|
+
<ControlFormLabel> { __( 'Image', 'elementor' ) } </ControlFormLabel>
|
|
31
31
|
<ImageMediaControl mediaTypes={ mediaTypes } />
|
|
32
32
|
</PropKeyProvider>
|
|
33
33
|
<PropKeyProvider bind={ 'size' }>
|
|
34
34
|
<Grid container gap={ 1.5 } alignItems="center" flexWrap="nowrap">
|
|
35
35
|
<Grid item xs={ 6 }>
|
|
36
|
-
<
|
|
36
|
+
<ControlFormLabel> { resolutionLabel } </ControlFormLabel>
|
|
37
37
|
</Grid>
|
|
38
38
|
<Grid item xs={ 6 } sx={ { overflow: 'hidden' } }>
|
|
39
39
|
<SelectControl options={ sizes } />
|