PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.1.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.1.0
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / modules / gutenberg / src / components / responsive-border / index.js

index.js in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.1.0, at modules/gutenberg/src/components/responsive-border/index.js

344 lines 8.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Border component.
3 *
4 */
5 import { __ } from '@wordpress/i18n';
6 import AdvancedPopColorControl from '@Components/color-control/advanced-pop-color-control.js';
7 import UAGSelectControl from '@Components/select-control';
8 import UAGTabsControl from '@Components/tabs';
9 import SpacingControl from '@Components/spacing-control';
10 import React from 'react';
11 import PropTypes from 'prop-types';
12
13 const propTypes = {
14 prefix: PropTypes.string,
15 borderStyleLabel: PropTypes.string,
16 borderWidthLabel: PropTypes.string,
17 borderRadiusLabel: PropTypes.string,
18 borderColorLabel: PropTypes.string,
19 };
20
21 const defaultProps = {
22 borderStyleLabel: __( 'Style', 'ultimate-addons-for-gutenberg' ),
23 borderWidthLabel: __( 'Width', 'ultimate-addons-for-gutenberg' ),
24 borderRadiusLabel: __( 'Radius', 'ultimate-addons-for-gutenberg' ),
25 borderColorLabel: __( 'Color', 'ultimate-addons-for-gutenberg' ),
26 borderHoverColorLabel:__(
27 'Hover Color',
28 'ultimate-addons-for-gutenberg'
29 )
30 };
31
32 const ResponsiveBorder = ( props ) => {
33 const {
34 attributes,
35 setAttributes,
36 disabledBorderTitle,
37 disableBottomSeparator = false,
38 deviceType,
39
40 prefix,
41 borderStyleLabel,
42 borderWidthLabel,
43 borderRadiusLabel,
44 borderColorLabel,
45 borderHoverColorLabel,
46 showWidth,
47 label = __( 'Border', 'ultimate-addons-for-gutenberg' ),
48 normalTabLabel = __(
49 'Normal',
50 'ultimate-addons-for-gutenberg'
51 ),
52 hoverTabLabel = __(
53 'Hover',
54 'ultimate-addons-for-gutenberg'
55 ),
56 borderRadiusHelp,
57 } = props;
58
59 const tabsToUse = [ {
60 name: 'normal',
61 title: normalTabLabel,
62 } ];
63
64 tabsToUse.push( {
65 name: 'hover',
66 title: hoverTabLabel,
67 } );
68
69 const borderStyle = attributes[prefix + 'BorderStyle'];
70
71 const tabOutputNormal = (
72 <AdvancedPopColorControl
73 label={ borderColorLabel }
74 colorValue={
75 attributes[prefix + 'BorderColor'] ? attributes[prefix + 'BorderColor'] : ''
76 }
77 data={ {
78 value: attributes[prefix + 'BorderColor'],
79 label: prefix + 'BorderColor',
80 } }
81 setAttributes={ setAttributes }
82 />
83 );
84 const tabOutputHover = (
85 <AdvancedPopColorControl
86 label={ borderHoverColorLabel }
87 colorValue={
88 attributes[prefix + 'BorderHColor'] ? attributes[prefix + 'BorderHColor'] : ''
89 }
90 data={ {
91 value: attributes[prefix + 'BorderHColor'],
92 label: prefix + 'BorderHColor',
93 } }
94 setAttributes={ setAttributes }
95 />
96 );
97
98 const advancedControls = (
99 <>
100 { ! disabledBorderTitle && (
101 <h2>{ label }</h2>
102 ) }
103 <UAGSelectControl
104 label={ borderStyleLabel }
105 data={ {
106 value: borderStyle,
107 label: prefix + 'BorderStyle',
108 } }
109 setAttributes={ setAttributes }
110 options={ [
111 {
112 value: 'none',
113 label: __(
114 'None',
115 'ultimate-addons-for-gutenberg'
116 ),
117 },
118 {
119 value: 'solid',
120 label: __(
121 'Solid',
122 'ultimate-addons-for-gutenberg'
123 ),
124 },
125 {
126 value: 'dotted',
127 label: __(
128 'Dotted',
129 'ultimate-addons-for-gutenberg'
130 ),
131 },
132 {
133 value: 'dashed',
134 label: __(
135 'Dashed',
136 'ultimate-addons-for-gutenberg'
137 ),
138 },
139 {
140 value: 'double',
141 label: __(
142 'Double',
143 'ultimate-addons-for-gutenberg'
144 ),
145 },
146 {
147 value: 'groove',
148 label: __(
149 'Groove',
150 'ultimate-addons-for-gutenberg'
151 ),
152 },
153 {
154 value: 'inset',
155 label: __(
156 'Inset',
157 'ultimate-addons-for-gutenberg'
158 ),
159 },
160 {
161 value: 'outset',
162 label: __(
163 'Outset',
164 'ultimate-addons-for-gutenberg'
165 ),
166 },
167 {
168 value: 'ridge',
169 label: __(
170 'Ridge',
171 'ultimate-addons-for-gutenberg'
172 ),
173 },
174 ] }
175 />
176 { '' !== borderStyle && 'none' !== borderStyle && (
177 showWidth !== false &&
178 <SpacingControl
179 label={ borderWidthLabel }
180 valueTop={ {
181 value: attributes[prefix + 'BorderTopWidth'],
182 label: prefix + 'BorderTopWidth',
183 } }
184 valueRight={ {
185 value: attributes[prefix + 'BorderRightWidth'],
186 label: prefix + 'BorderRightWidth',
187 } }
188 valueBottom={ {
189 value: attributes[prefix + 'BorderBottomWidth'],
190 label: prefix + 'BorderBottomWidth',
191 } }
192 valueLeft={ {
193 value: attributes[prefix + 'BorderLeftWidth'],
194 label: prefix + 'BorderLeftWidth',
195 } }
196 valueTopTablet={ {
197 value: attributes[prefix + 'BorderTopWidthTablet'],
198 label: prefix + 'BorderTopWidthTablet',
199 } }
200 valueRightTablet={ {
201 value: attributes[prefix + 'BorderRightWidthTablet'],
202 label: prefix + 'BorderRightWidthTablet',
203 } }
204 valueBottomTablet={ {
205 value: attributes[prefix + 'BorderBottomWidthTablet'],
206 label: prefix + 'BorderBottomWidthTablet',
207 } }
208 valueLeftTablet={ {
209 value: attributes[prefix + 'BorderLeftWidthTablet'],
210 label: prefix + 'BorderLeftWidthTablet',
211 } }
212 valueTopMobile={ {
213 value: attributes[prefix + 'BorderTopWidthMobile'],
214 label: prefix + 'BorderTopWidthMobile',
215 } }
216 valueRightMobile={ {
217 value: attributes[prefix + 'BorderRightWidthMobile'],
218 label: prefix + 'BorderRightWidthMobile',
219 } }
220 valueBottomMobile={ {
221 value: attributes[prefix + 'BorderBottomWidthMobile'],
222 label: prefix + 'BorderBottomWidthMobile',
223 } }
224 valueLeftMobile={ {
225 value: attributes[prefix + 'BorderLeftWidthMobile'],
226 label: prefix + 'BorderLeftWidthMobile',
227 } }
228 disableUnits={true}
229 deviceType={ deviceType }
230 attributes={ attributes }
231 setAttributes={ setAttributes }
232 link={ {
233 value: attributes[prefix + 'BorderLink'],
234 label: prefix + 'BorderLink',
235 } }
236 />
237 ) }
238 <SpacingControl
239 label={ borderRadiusLabel }
240 valueTop={ {
241 value: attributes[prefix + 'BorderTopLeftRadius'],
242 label: prefix + 'BorderTopLeftRadius',
243 } }
244 valueRight={ {
245 value: attributes[prefix + 'BorderTopRightRadius'],
246 label: prefix + 'BorderTopRightRadius',
247 } }
248 valueBottom={ {
249 value: attributes[prefix + 'BorderBottomRightRadius'],
250 label: prefix + 'BorderBottomRightRadius',
251 } }
252 valueLeft={ {
253 value: attributes[prefix + 'BorderBottomLeftRadius'],
254 label: prefix + 'BorderBottomLeftRadius',
255 } }
256 valueTopTablet={{
257 value: attributes[prefix + 'BorderTopLeftRadiusTablet'],
258 label: prefix + 'BorderTopLeftRadiusTablet',
259 } }
260 valueRightTablet={ {
261 value: attributes[prefix + 'BorderTopRightRadiusTablet'],
262 label: prefix + 'BorderTopRightRadiusTablet',
263 } }
264 valueBottomTablet={{
265 value: attributes[prefix + 'BorderBottomRightRadiusTablet'],
266 label: prefix + 'BorderBottomRightRadiusTablet',
267 } }
268 valueLeftTablet={ {
269 value: attributes[prefix + 'BorderBottomLeftRadiusTablet'],
270 label: prefix + 'BorderBottomLeftRadiusTablet',
271 } }
272 valueTopMobile={ {
273 value: attributes[prefix + 'BorderTopLeftRadiusMobile'],
274 label: prefix + 'BorderTopLeftRadiusMobile',
275 } }
276 valueRightMobile={ {
277 value: attributes[prefix + 'BorderTopRightRadiusMobile'],
278 label: prefix + 'BorderTopRightRadiusMobile',
279 } }
280 valueBottomMobile={ {
281 value: attributes[prefix + 'BorderBottomRightRadiusMobile'],
282 label: prefix + 'BorderBottomRightRadiusMobile',
283 } }
284 valueLeftMobile={ {
285 value: attributes[prefix + 'BorderBottomLeftRadiusMobile'],
286 label: prefix + 'BorderBottomLeftRadiusMobile',
287 } }
288 units={ [
289 {
290 name: __(
291 'Pixel',
292 'ultimate-addons-for-gutenberg'
293 ),
294 unitValue: 'px',
295 },
296 {
297 name: __(
298 '%',
299 'ultimate-addons-for-gutenberg'
300 ),
301 unitValue: '%',
302 },
303 ] }
304 unit={{
305 value: attributes[prefix + 'BorderRadiusUnit'],
306 label: prefix + 'BorderRadiusUnit',
307 }}
308 mUnit={{
309 value: attributes[prefix + 'BorderRadiusUnitMobile'],
310 label: prefix + 'BorderRadiusUnitMobile',
311 }}
312 tUnit={{
313 value: attributes[prefix + 'BorderRadiusUnitTablet'],
314 label: prefix + 'BorderRadiusUnitTablet',
315 }}
316 deviceType={ deviceType }
317 attributes={ attributes }
318 setAttributes={ setAttributes }
319 link={ {
320 value: attributes[prefix + 'BorderRadiusLink'],
321 label: prefix + 'BorderRadiusLink',
322 } }
323 help={ borderRadiusHelp ? borderRadiusHelp : false }
324 />
325 { 'none' !== borderStyle && (
326 <UAGTabsControl
327 tabs={ tabsToUse }
328 normal={ tabOutputNormal }
329 hover={ tabOutputHover }
330 active={ '' }
331 disableBottomSeparator={ disableBottomSeparator }
332 />
333 ) }
334 </>
335 );
336
337 return ( advancedControls );
338 };
339
340 export default ResponsiveBorder;
341
342 ResponsiveBorder.propTypes = propTypes;
343 ResponsiveBorder.defaultProps = defaultProps;
344