PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.17
UiCore Elements – Free widgets and templates for Elementor v1.3.17
1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 41 releases
← All changes | includes/widgets/counter.php +1197 -1180 1.0.161.3.17 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace UiCoreElements;
3 4
4 5 use Elementor\Controls_Manager;
5 6 use Elementor\Icons_Manager;
@@ -21,31 +22,31 @@
21 22
22 23 class Counter extends UiCoreWidget
23 24 {
24 25
25 - public function get_name()
26 - {
27 - return 'uicore-counter';
28 - }
29 - public function get_title()
30 - {
31 - return __( 'Counter', 'uicore-elements' );
32 - }
33 - public function get_icon()
34 - {
35 - return 'eicon-counter ui-e-widget';
36 - }
26 + public function get_name()
27 + {
28 + return 'uicore-counter';
29 + }
30 + public function get_title()
31 + {
32 + return __('Counter', 'uicore-elements');
33 + }
34 + public function get_icon()
35 + {
36 + return 'eicon-counter ui-e-widget';
37 + }
37 38 public function get_keywords()
38 39 {
39 40 return ['counter', 'count', 'number'];
40 41 }
41 - public function get_categories()
42 - {
43 - return [ 'uicore' ];
44 - }
45 - public function get_styles()
46 - {
47 - return [
42 + public function get_categories()
43 + {
44 + return ['uicore'];
45 + }
46 + public function get_styles()
47 + {
48 + return [
48 49 'counter',
49 50 'counter-motion' => [
50 51 'condition' => [
51 52 'counter_animation' => 'motion',
@@ -51,432 +52,434 @@
51 52 'counter_animation' => 'motion',
52 53 ],
53 54 ],
54 55 ];
55 - }
56 + }
56 57 public function get_scripts()
57 - {
58 - return [
59 - 'counter',
60 - 'odometer' => [
61 - 'condition' => [
62 - 'counter_animation' => 'odometer',
63 - ],
64 - ]
65 - ];
66 - }
67 - protected function register_controls()
68 - {
58 + {
59 + return [
60 + 'counter',
61 + 'odometer' => [
62 + 'condition' => [
63 + 'counter_animation' => 'odometer',
64 + ],
65 + ]
66 + ];
67 + }
68 + protected function register_controls()
69 + {
69 70
70 71 $this->start_controls_section(
71 72 'content_section',
72 73 [
73 - 'label' => __( 'Counter', 'uicore-elements' ),
74 + 'label' => __('Counter', 'uicore-elements'),
74 75 'tab' => Controls_Manager::TAB_CONTENT,
75 76 ]
76 77 );
77 78
78 - $this->add_control(
79 - 'show_icon',
80 - [
81 - 'label' => esc_html__( 'Show Icon', 'uicore-elements' ),
82 - 'type' => Controls_Manager::SWITCHER,
83 - 'label_on' => esc_html__( 'Show', 'uicore-elements' ),
84 - 'label_off' => esc_html__( 'Hide', 'uicore-elements' ),
85 - 'return_value' => 'true',
86 - 'prefix_class' => 'ui-e-counter-media-',
87 - 'render_type' => 'template',
88 - ]
89 - );
79 + $this->add_control(
80 + 'show_icon',
81 + [
82 + 'label' => esc_html__('Show Icon', 'uicore-elements'),
83 + 'type' => Controls_Manager::SWITCHER,
84 + 'label_on' => esc_html__('Show', 'uicore-elements'),
85 + 'label_off' => esc_html__('Hide', 'uicore-elements'),
86 + 'return_value' => 'true',
87 + 'prefix_class' => 'ui-e-counter-media-',
88 + 'render_type' => 'template',
89 + ]
90 + );
90 91
91 - $this->add_control(
92 - 'icon_type',
93 - [
94 - 'label' => esc_html__( 'Icon Type', 'uicore-elements' ),
95 - 'type' => Controls_Manager::CHOOSE,
96 - 'options' => [
97 - 'icon' => [
98 - 'title' => esc_html__( 'Icon', 'uicore-elements' ),
99 - 'icon' => 'eicon-star',
100 - ],
101 - 'image' => [
102 - 'title' => esc_html__( 'Image', 'uicore-elements' ),
103 - 'icon' => 'eicon-image-bold',
104 - ],
105 -
92 + $this->add_control(
93 + 'icon_type',
94 + [
95 + 'label' => esc_html__('Icon Type', 'uicore-elements'),
96 + 'type' => Controls_Manager::CHOOSE,
97 + 'options' => [
98 + 'icon' => [
99 + 'title' => esc_html__('Icon', 'uicore-elements'),
100 + 'icon' => 'eicon-star',
106 101 ],
107 - 'default' => 'icon',
108 - 'toggle' => false,
109 - 'condition' => [
110 - 'show_icon' => 'true',
102 + 'image' => [
103 + 'title' => esc_html__('Image', 'uicore-elements'),
104 + 'icon' => 'eicon-image-bold',
111 105 ],
112 - ]
113 - );
114 106
115 - $this->add_control(
116 - 'selected_icon',
117 - [
118 - 'label' => esc_html__( 'Choose icon', 'uicore-elements' ),
119 - 'type' => Controls_Manager::ICONS,
120 - 'condition' => [
121 - 'show_icon' => 'true',
122 - 'icon_type' => 'icon',
123 - ],
124 - ]
125 - );
107 + ],
108 + 'default' => 'icon',
109 + 'toggle' => false,
110 + 'condition' => [
111 + 'show_icon' => 'true',
112 + ],
113 + ]
114 + );
126 115
127 - $this->add_control(
128 - 'image',
129 - [
130 - 'label' => esc_html__( 'Choose Image', 'uicore-elements' ),
131 - 'type' => Controls_Manager::MEDIA,
132 - 'condition' => [
133 - 'show_icon' => 'true',
134 - 'icon_type' => 'image',
135 - ],
136 - 'dynamic' => [
137 - 'active' => true,
138 - ],
139 - ]
140 - );
116 + $this->add_control(
117 + 'selected_icon',
118 + [
119 + 'label' => esc_html__('Choose icon', 'uicore-elements'),
120 + 'type' => Controls_Manager::ICONS,
121 + 'condition' => [
122 + 'show_icon' => 'true',
123 + 'icon_type' => 'icon',
124 + ],
125 + ]
126 + );
141 127
142 - $this->add_control(
143 - 'count_start',
144 - [
145 - 'label' => esc_html__( 'Starting number', 'uicore-elements' ),
146 - 'type' => Controls_Manager::NUMBER,
147 - 'step' => 1,
148 - 'default' => 10,
149 - 'frontend_available' => true,
150 - 'dynamic' => [
151 - 'active' => true,
152 - ],
153 - 'condition' =>[
154 - 'counter_animation!' => ['motion'],
155 - ],
156 - ]
157 - );
128 + $this->add_control(
129 + 'image',
130 + [
131 + 'label' => esc_html__('Choose Image', 'uicore-elements'),
132 + 'type' => Controls_Manager::MEDIA,
133 + 'condition' => [
134 + 'show_icon' => 'true',
135 + 'icon_type' => 'image',
136 + ],
137 + 'dynamic' => [
138 + 'active' => true,
139 + ],
140 + ]
141 + );
158 142
159 - $this->add_control(
160 - 'count_end',
161 - [
162 - 'label' => esc_html__( 'Ending number', 'uicore-elements' ),
163 - 'type' => Controls_Manager::NUMBER,
164 - 'step' => 1,
165 - 'default' => 120,
166 - 'frontend_available' => true,
167 - 'dynamic' => [
168 - 'active' => true,
169 - ],
170 - 'condition' =>[
171 - 'counter_animation!' => ['motion'],
172 - ],
173 - ]
174 - );
143 + $this->add_control(
144 + 'count_start',
145 + [
146 + 'label' => esc_html__('Starting number', 'uicore-elements'),
147 + 'type' => Controls_Manager::NUMBER,
148 + 'step' => 1,
149 + 'default' => 10,
150 + 'frontend_available' => true,
151 + 'dynamic' => [
152 + 'active' => true,
153 + ],
154 + 'condition' => [
155 + 'counter_animation!' => ['motion'],
156 + ],
157 + ]
158 + );
175 159
176 - $this->add_control(
177 - 'count_number',
178 - [
179 - 'label' => esc_html__( 'Number', 'uicore-elements' ),
180 - 'type' => Controls_Manager::TEXT,
181 - 'default' => '120,00',
182 - 'frontend_available' => true,
183 - 'label_block' => true,
184 - 'dynamic' => [
185 - 'active' => true,
186 - ],
187 - 'condition' =>[
188 - 'counter_animation' => ['motion'],
189 - ],
190 - ]
191 - );
160 + $this->add_control(
161 + 'count_end',
162 + [
163 + 'label' => esc_html__('Ending number', 'uicore-elements'),
164 + 'type' => Controls_Manager::NUMBER,
165 + 'step' => 1,
166 + 'default' => 120,
167 + 'frontend_available' => true,
168 + 'dynamic' => [
169 + 'active' => true,
170 + ],
171 + 'condition' => [
172 + 'counter_animation!' => ['motion'],
173 + ],
174 + ]
175 + );
192 176
193 - $this->add_control(
194 - 'counter_html_tag',
195 - [
196 - 'label' => esc_html__( 'Number HTML class', 'uicore-elements' ),
197 - 'type' => Controls_Manager::SELECT,
198 - 'default' => 'h1',
199 - 'options' => [
200 - 'h1' => esc_html__( 'H1', 'uicore-elements' ),
201 - 'h2' => esc_html__( 'H2', 'uicore-elements' ),
202 - 'h3' => esc_html__( 'H3', 'uicore-elements' ),
203 - 'h4' => esc_html__( 'H4', 'uicore-elements' ),
204 - 'h5' => esc_html__( 'H5', 'uicore-elements' ),
205 - 'h6' => esc_html__( 'H6', 'uicore-elements' ),
206 - 'p' => esc_html__( 'p', 'uicore-elements' ),
207 - 'span' => esc_html__( 'span', 'uicore-elements' ),
208 - ],
209 - ]
210 - );
177 + $this->add_control(
178 + 'count_number',
179 + [
180 + 'label' => esc_html__('Number', 'uicore-elements'),
181 + 'type' => Controls_Manager::TEXT,
182 + 'default' => '120,00',
183 + 'frontend_available' => true,
184 + 'label_block' => true,
185 + 'dynamic' => [
186 + 'active' => true,
187 + ],
188 + 'condition' => [
189 + 'counter_animation' => ['motion'],
190 + ],
191 + ]
192 + );
211 193
212 - $this->add_control(
213 - 'content_text',
214 - [
215 - 'label' => esc_html__( 'Title', 'uicore-elements' ),
216 - 'type' => Controls_Manager::TEXT,
217 - 'default' => esc_html__( 'Awesome number', 'uicore-elements' ),
218 - 'placeholder' => esc_html__( 'Type your title here', 'uicore-elements' ),
219 - 'separator' => 'before',
220 - 'label_block' => true,
221 - 'dynamic' => [
222 - 'active' => true,
223 - ],
224 - ]
225 - );
194 + $this->add_control(
195 + 'counter_html_tag',
196 + [
197 + 'label' => esc_html__('Number HTML class', 'uicore-elements'),
198 + 'type' => Controls_Manager::SELECT,
199 + 'default' => 'h1',
200 + 'options' => [
201 + 'h1' => esc_html__('H1', 'uicore-elements'),
202 + 'h2' => esc_html__('H2', 'uicore-elements'),
203 + 'h3' => esc_html__('H3', 'uicore-elements'),
204 + 'h4' => esc_html__('H4', 'uicore-elements'),
205 + 'h5' => esc_html__('H5', 'uicore-elements'),
206 + 'h6' => esc_html__('H6', 'uicore-elements'),
207 + 'p' => esc_html__('p', 'uicore-elements'),
208 + 'span' => esc_html__('span', 'uicore-elements'),
209 + ],
210 + ]
211 + );
226 212
227 - $this->add_control(
228 - 'content_html_tag',
229 - [
230 - 'label' => esc_html__( 'Title HTML tag', 'uicore-elements' ),
231 - 'type' => Controls_Manager::SELECT,
232 - 'default' => 'p',
233 - 'options' => [
234 - 'H1' => esc_html__( 'H1', 'uicore-elements' ),
235 - 'H2' => esc_html__( 'H2', 'uicore-elements' ),
236 - 'H3' => esc_html__( 'H3', 'uicore-elements' ),
237 - 'H4' => esc_html__( 'H4', 'uicore-elements' ),
238 - 'H5' => esc_html__( 'H5', 'uicore-elements' ),
239 - 'H6' => esc_html__( 'H6', 'uicore-elements' ),
240 - 'p' => esc_html__( 'p', 'uicore-elements' ),
241 - 'span' => esc_html__( 'span', 'uicore-elements' ),
242 - ],
243 - ]
244 - );
213 + $this->add_control(
214 + 'content_text',
215 + [
216 + 'label' => esc_html__('Title', 'uicore-elements'),
217 + 'type' => Controls_Manager::TEXT,
218 + 'default' => esc_html__('Awesome number', 'uicore-elements'),
219 + 'placeholder' => esc_html__('Type your title here', 'uicore-elements'),
220 + 'separator' => 'before',
221 + 'label_block' => true,
222 + 'dynamic' => [
223 + 'active' => true,
224 + ],
225 + ]
226 + );
245 227
246 - $this->add_control(
247 - 'counter_text_inline',
248 - [
249 - 'label' => esc_html__( 'Text inline', 'uicore-elements' ),
250 - 'type' => Controls_Manager::SWITCHER,
251 - 'label_on' => esc_html__( 'True', 'uicore-elements' ),
252 - 'label_off' => esc_html__( 'False', 'uicore-elements' ),
253 - 'return_value' => 'true',
254 - 'prefix_class' => 'ui-e-inline-',
255 - 'render_type' => 'template',
256 - 'default' => false,
257 - ]
258 - );
228 + $this->add_control(
229 + 'content_html_tag',
230 + [
231 + 'label' => esc_html__('Title HTML tag', 'uicore-elements'),
232 + 'type' => Controls_Manager::SELECT,
233 + 'default' => 'p',
234 + 'options' => [
235 + 'H1' => esc_html__('H1', 'uicore-elements'),
236 + 'H2' => esc_html__('H2', 'uicore-elements'),
237 + 'H3' => esc_html__('H3', 'uicore-elements'),
238 + 'H4' => esc_html__('H4', 'uicore-elements'),
239 + 'H5' => esc_html__('H5', 'uicore-elements'),
240 + 'H6' => esc_html__('H6', 'uicore-elements'),
241 + 'p' => esc_html__('p', 'uicore-elements'),
242 + 'span' => esc_html__('span', 'uicore-elements'),
243 + ],
244 + ]
245 + );
259 246
260 - $this->add_control(
261 - 'icon_position',
262 - [
263 - 'label' => esc_html__( 'Icon position', 'uicore-elements' ),
264 - 'type' => Controls_Manager::CHOOSE,
265 - 'options' => [
266 - 'left' => [
267 - 'title' => esc_html__( 'Left', 'uicore-elements' ),
268 - 'icon' => 'eicon-h-align-left',
269 - ],
270 - 'top' => [
271 - 'title' => esc_html__( 'Top', 'uicore-elements' ),
272 - 'icon' => 'eicon-v-align-top',
273 - ],
274 - 'right' => [
275 - 'title' => esc_html__( 'Right', 'uicore-elements' ),
276 - 'icon' => 'eicon-h-align-right',
277 - ],
247 + $this->add_control(
248 + 'counter_text_inline',
249 + [
250 + 'label' => esc_html__('Text inline', 'uicore-elements'),
251 + 'type' => Controls_Manager::SWITCHER,
252 + 'label_on' => esc_html__('True', 'uicore-elements'),
253 + 'label_off' => esc_html__('False', 'uicore-elements'),
254 + 'return_value' => 'true',
255 + 'prefix_class' => 'ui-e-inline-',
256 + 'render_type' => 'template',
257 + 'default' => false,
258 + ]
259 + );
260 +
261 + $this->add_control(
262 + 'icon_position',
263 + [
264 + 'label' => esc_html__('Icon position', 'uicore-elements'),
265 + 'type' => Controls_Manager::CHOOSE,
266 + 'options' => [
267 + 'left' => [
268 + 'title' => esc_html__('Left', 'uicore-elements'),
269 + 'icon' => 'eicon-h-align-left',
278 270 ],
279 - 'default' => 'top',
280 - 'toggle' => false,
281 - 'condition' =>[
282 - 'show_icon' => 'true',
283 - 'counter_text_inline!' => 'true',
271 + 'top' => [
272 + 'title' => esc_html__('Top', 'uicore-elements'),
273 + 'icon' => 'eicon-v-align-top',
284 274 ],
285 - 'prefix_class' => 'ui-e-',
286 - 'render_type' => 'template',
287 - ]
288 - );
275 + 'right' => [
276 + 'title' => esc_html__('Right', 'uicore-elements'),
277 + 'icon' => 'eicon-h-align-right',
278 + ],
279 + ],
280 + 'default' => 'top',
281 + 'toggle' => false,
282 + 'condition' => [
283 + 'show_icon' => 'true',
284 + 'counter_text_inline!' => 'true',
285 + ],
286 + 'prefix_class' => 'ui-e-',
287 + 'render_type' => 'template',
288 + ]
289 + );
289 290
290 - $this->add_control(
291 - 'icon_position_inline',
292 - [
293 - 'label' => esc_html__( 'Icon position', 'uicore-elements' ),
294 - 'type' => Controls_Manager::CHOOSE,
295 - 'options' => [
296 - 'left' => [
297 - 'title' => esc_html__( 'Left', 'uicore-elements' ),
298 - 'icon' => 'eicon-h-align-left',
299 - ],
300 - 'right' => [
301 - 'title' => esc_html__( 'Right', 'uicore-elements' ),
302 - 'icon' => 'eicon-h-align-right',
303 - ],
291 + $this->add_control(
292 + 'icon_position_inline',
293 + [
294 + 'label' => esc_html__('Icon position', 'uicore-elements'),
295 + 'type' => Controls_Manager::CHOOSE,
296 + 'options' => [
297 + 'left' => [
298 + 'title' => esc_html__('Left', 'uicore-elements'),
299 + 'icon' => 'eicon-h-align-left',
304 300 ],
305 - 'default' => 'left',
306 - 'toggle' => false,
307 - 'condition' =>[
308 - 'show_icon' => 'true',
309 - 'counter_text_inline' => 'true',
301 + 'right' => [
302 + 'title' => esc_html__('Right', 'uicore-elements'),
303 + 'icon' => 'eicon-h-align-right',
310 304 ],
311 - 'prefix_class' => 'ui-e-',
312 - 'render_type' => 'template',
313 - ]
314 - );
305 + ],
306 + 'default' => 'left',
307 + 'toggle' => false,
308 + 'condition' => [
309 + 'show_icon' => 'true',
310 + 'counter_text_inline' => 'true',
311 + ],
312 + 'prefix_class' => 'ui-e-',
313 + 'render_type' => 'template',
314 + ]
315 + );
315 316
316 - $this->add_control(
317 - 'vertical_align',
318 - [
319 - 'label' => esc_html__( 'Vertical position', 'uicore-elements' ),
320 - 'type' => Controls_Manager::CHOOSE,
321 - 'options' => [
322 - 'start' => [
323 - 'title' => esc_html__( 'Top', 'uicore-elements' ),
324 - 'icon' => 'eicon-v-align-top',
325 - ],
326 - 'center' => [
327 - 'title' => esc_html__( 'Center', 'uicore-elements' ),
328 - 'icon' => 'eicon-v-align-middle',
329 - ],
330 - 'end' => [
331 - 'title' => esc_html__( 'Bottom', 'uicore-elements' ),
332 - 'icon' => 'eicon-v-align-bottom',
333 - ],
317 + $this->add_control(
318 + 'vertical_align',
319 + [
320 + 'label' => esc_html__('Vertical position', 'uicore-elements'),
321 + 'type' => Controls_Manager::CHOOSE,
322 + 'options' => [
323 + 'start' => [
324 + 'title' => esc_html__('Top', 'uicore-elements'),
325 + 'icon' => 'eicon-v-align-top',
334 326 ],
335 - 'default' => 'center',
336 - 'toggle' => false,
337 - 'selectors' => [
338 - '{{WRAPPER}} > div' => 'align-items: {{VALUE}};',
327 + 'center' => [
328 + 'title' => esc_html__('Center', 'uicore-elements'),
329 + 'icon' => 'eicon-v-align-middle',
339 330 ],
340 - 'condition' => [
341 - 'icon_position!' => ['top'],
342 - 'counter_text_inline!' => ['true'],
331 + 'end' => [
332 + 'title' => esc_html__('Bottom', 'uicore-elements'),
333 + 'icon' => 'eicon-v-align-bottom',
343 334 ],
344 - ]
345 - );
335 + ],
336 + 'default' => 'center',
337 + 'toggle' => false,
338 + 'selectors' => [
339 + '{{WRAPPER}} > div' => 'align-items: {{VALUE}};',
340 + ],
341 + 'condition' => [
342 + 'icon_position!' => ['top'],
343 + 'counter_text_inline!' => ['true'],
344 + ],
345 + ]
346 + );
346 347
347 - $this->add_control(
348 - 'vertical_align_inline',
349 - [
350 - 'label' => esc_html__( 'Vertical position', 'uicore-elements' ),
351 - 'type' => Controls_Manager::CHOOSE,
352 - 'options' => [
353 - 'start' => [
354 - 'title' => esc_html__( 'Top', 'uicore-elements' ),
355 - 'icon' => 'eicon-v-align-top',
356 - ],
357 - 'center' => [
358 - 'title' => esc_html__( 'Center', 'uicore-elements' ),
359 - 'icon' => 'eicon-v-align-middle',
360 - ],
361 - 'end' => [
362 - 'title' => esc_html__( 'Bottom', 'uicore-elements' ),
363 - 'icon' => 'eicon-v-align-bottom',
364 - ],
348 + $this->add_control(
349 + 'vertical_align_inline',
350 + [
351 + 'label' => esc_html__('Vertical position', 'uicore-elements'),
352 + 'type' => Controls_Manager::CHOOSE,
353 + 'options' => [
354 + 'start' => [
355 + 'title' => esc_html__('Top', 'uicore-elements'),
356 + 'icon' => 'eicon-v-align-top',
365 357 ],
366 - 'default' => 'center',
367 - 'toggle' => false,
368 - 'selectors' => [
369 - '{{WRAPPER}} > div' => 'align-items: {{VALUE}};',
358 + 'center' => [
359 + 'title' => esc_html__('Center', 'uicore-elements'),
360 + 'icon' => 'eicon-v-align-middle',
370 361 ],
371 - 'condition' => [
372 - 'counter_text_inline' => ['true'],
362 + 'end' => [
363 + 'title' => esc_html__('Bottom', 'uicore-elements'),
364 + 'icon' => 'eicon-v-align-bottom',
373 365 ],
374 - ]
375 - );
366 + ],
367 + 'default' => 'center',
368 + 'toggle' => false,
369 + 'selectors' => [
370 + '{{WRAPPER}} > div' => 'align-items: {{VALUE}};',
371 + ],
372 + 'condition' => [
373 + 'counter_text_inline' => ['true'],
374 + ],
375 + ]
376 + );
376 377
377 - $this->add_control(
378 - 'text_align',
379 - [
380 - 'label' => esc_html__( 'Text Align', 'uicore-elements' ),
381 - 'type' => Controls_Manager::CHOOSE,
382 - 'options' => [
383 - 'left' => [
384 - 'title' => esc_html__( 'Left', 'uicore-elements' ),
385 - 'icon' => 'eicon-text-align-left',
386 - ],
387 - 'center' => [
388 - 'title' => esc_html__( 'Center', 'uicore-elements' ),
389 - 'icon' => 'eicon-text-align-center',
390 - ],
391 - 'right' => [
392 - 'title' => esc_html__( 'Right', 'uicore-elements' ),
393 - 'icon' => 'eicon-text-align-right',
394 - ],
378 + $this->add_responsive_control(
379 + 'text_align',
380 + [
381 + 'label' => esc_html__('Text Align', 'uicore-elements'),
382 + 'type' => Controls_Manager::CHOOSE,
383 + 'options' => [
384 + 'left' => [
385 + 'title' => esc_html__('Left', 'uicore-elements'),
386 + 'icon' => 'eicon-text-align-left',
395 387 ],
396 - 'toggle' => false,
397 - 'default' => 'center',
398 - 'prefix_class' => 'ui-e-align-',
399 - 'selectors' => [
400 - '{{WRAPPER}} .ui-e-title' => 'text-align: {{VALUE}};',
401 - '{{WRAPPER}} .ui-e-ico' => 'text-align: {{VALUE}};',
388 + 'center' => [
389 + 'title' => esc_html__('Center', 'uicore-elements'),
390 + 'icon' => 'eicon-text-align-center',
402 391 ],
392 + 'right' => [
393 + 'title' => esc_html__('Right', 'uicore-elements'),
394 + 'icon' => 'eicon-text-align-right',
395 + ],
396 + ],
397 + 'toggle' => false,
398 + 'default' => 'center',
399 + 'tablet_default' => 'center',
400 + 'mobile_default' => 'center',
401 + 'prefix_class' => 'ui-e-align-%s-',
402 + 'selectors' => [
403 + '{{WRAPPER}} .ui-e-title' => 'text-align: {{VALUE}};',
404 + '{{WRAPPER}} .ui-e-ico' => 'text-align: {{VALUE}};',
405 + ],
403 406
404 - ]
405 - );
407 + ]
408 + );
406 409
407 - $this->add_control(
408 - 'icon_offset_toggle',
409 - [
410 - 'label' => esc_html__( 'Icon Offset', 'uicore-elements' ),
411 - 'type' => Controls_Manager::POPOVER_TOGGLE,
412 - 'label_off' => esc_html__( 'Default', 'uicore-elements' ),
413 - 'label_on' => esc_html__( 'Custom', 'uicore-elements' ),
414 - 'return_value' => 'yes',
415 - 'condition' => [
416 - 'show_icon' => 'true',
417 - 'counter_text_inline!' => 'true',
418 - ],
419 - ]
420 - );
410 + $this->add_control(
411 + 'icon_offset_toggle',
412 + [
413 + 'label' => esc_html__('Icon Offset', 'uicore-elements'),
414 + 'type' => Controls_Manager::POPOVER_TOGGLE,
415 + 'label_off' => esc_html__('Default', 'uicore-elements'),
416 + 'label_on' => esc_html__('Custom', 'uicore-elements'),
417 + 'return_value' => 'yes',
418 + 'condition' => [
419 + 'show_icon' => 'true',
420 + 'counter_text_inline!' => 'true',
421 + ],
422 + ]
423 + );
421 424
422 - $this->start_popover();
425 + $this->start_popover();
423 426
424 - $this->add_responsive_control(
425 - 'icon_vertical_offset',
426 - [
427 - 'label' => esc_html__( 'Vertical offset', 'uicore-elements' ),
428 - 'type' => Controls_Manager::SLIDER,
429 - 'size_units' => ['px'],
430 - 'range' => [
431 - 'px' => [
432 - 'min' => -100,
433 - 'max' => 100,
434 - 'step' => 1,
435 - ],
436 - ],
437 - 'default' => [
438 - 'unit' => 'px',
439 - 'size' => 0,
440 - ],
441 - 'condition' => [
442 - 'counter_text_inline!' => 'true',
443 - 'icon_offset_toggle' => 'yes',
444 - ],
445 - 'selectors' => [
446 - '{{WRAPPER}}' => '--ui-e-ico-vertical-off: {{SIZE}}{{UNIT}};',
447 - ],
448 - ]
449 - );
427 + $this->add_responsive_control(
428 + 'icon_vertical_offset',
429 + [
430 + 'label' => esc_html__('Vertical offset', 'uicore-elements'),
431 + 'type' => Controls_Manager::SLIDER,
432 + 'size_units' => ['px'],
433 + 'range' => [
434 + 'px' => [
435 + 'min' => -100,
436 + 'max' => 100,
437 + 'step' => 1,
438 + ],
439 + ],
440 + 'default' => [
441 + 'unit' => 'px',
442 + 'size' => 0,
443 + ],
444 + 'condition' => [
445 + 'counter_text_inline!' => 'true',
446 + 'icon_offset_toggle' => 'yes',
447 + ],
448 + 'selectors' => [
449 + '{{WRAPPER}}' => '--ui-e-ico-vertical-off: {{SIZE}}{{UNIT}};',
450 + ],
451 + ]
452 + );
450 453
451 - $this->add_responsive_control(
452 - 'icon_horizontal_offset',
453 - [
454 - 'label' => esc_html__( 'Horizontal offset', 'uicore-elements' ),
455 - 'type' => Controls_Manager::SLIDER,
456 - 'size_units' => ['px'],
457 - 'range' => [
458 - 'px' => [
459 - 'min' => -100,
460 - 'max' => 100,
461 - 'step' => 1,
462 - ],
463 - ],
464 - 'default' => [
465 - 'unit' => 'px',
466 - 'size' => 0,
467 - ],
468 - 'condition' => [
469 - 'counter_text_inline!' => 'true',
470 - 'icon_offset_toggle' => 'yes',
471 - ],
472 - 'selectors' => [
473 - '{{WRAPPER}}' => '--ui-e-ico-horizontal-off: {{SIZE}}{{UNIT}};',
474 - ],
475 - ]
476 - );
454 + $this->add_responsive_control(
455 + 'icon_horizontal_offset',
456 + [
457 + 'label' => esc_html__('Horizontal offset', 'uicore-elements'),
458 + 'type' => Controls_Manager::SLIDER,
459 + 'size_units' => ['px'],
460 + 'range' => [
461 + 'px' => [
462 + 'min' => -100,
463 + 'max' => 100,
464 + 'step' => 1,
465 + ],
466 + ],
467 + 'default' => [
468 + 'unit' => 'px',
469 + 'size' => 0,
470 + ],
471 + 'condition' => [
472 + 'counter_text_inline!' => 'true',
473 + 'icon_offset_toggle' => 'yes',
474 + ],
475 + 'selectors' => [
476 + '{{WRAPPER}}' => '--ui-e-ico-horizontal-off: {{SIZE}}{{UNIT}};',
477 + ],
478 + ]
479 + );
477 480
478 - $this->end_popover();
481 + $this->end_popover();
479 482
480 483 $this->end_controls_section();
481 484
482 485 $this->start_controls_section(
@@ -481,107 +484,107 @@
481 484
482 485 $this->start_controls_section(
483 486 'add_op_section',
484 487 [
485 - 'label' => __( 'Additional Options', 'uicore-elements' ),
488 + 'label' => __('Additional Options', 'uicore-elements'),
486 489 'tab' => Controls_Manager::TAB_CONTENT,
487 490 ]
488 491 );
489 492
490 - $this->add_control(
491 - 'use_grouping',
492 - [
493 - 'label' => esc_html__( 'Use Grouping', 'uicore-elements' ),
494 - 'type' => Controls_Manager::SWITCHER,
495 - 'label_on' => esc_html__( 'True', 'uicore-elements' ),
496 - 'label_off' => esc_html__( 'False', 'uicore-elements' ),
497 - 'return_value' => 'true',
498 - 'default' => 'true',
499 - 'frontend_available' => true,
500 - 'condition' =>[
501 - 'counter_animation!' => ['motion'],
502 - ],
503 - ]
504 - );
493 + $this->add_control(
494 + 'use_grouping',
495 + [
496 + 'label' => esc_html__('Use Grouping', 'uicore-elements'),
497 + 'type' => Controls_Manager::SWITCHER,
498 + 'label_on' => esc_html__('True', 'uicore-elements'),
499 + 'label_off' => esc_html__('False', 'uicore-elements'),
500 + 'return_value' => 'true',
501 + 'default' => 'true',
502 + 'frontend_available' => true,
503 + 'condition' => [
504 + 'counter_animation!' => ['motion'],
505 + ],
506 + ]
507 + );
505 508
506 - $this->add_control(
507 - 'counter_separator',
508 - [
509 - 'label' => esc_html__( 'Thousand symbol', 'uicore-elements' ),
510 - 'type' => Controls_Manager::TEXT,
511 - 'default' => esc_html__( ',', 'uicore-elements' ),
512 - 'condition' =>[
513 - 'use_grouping' => 'true',
514 - 'counter_animation!' => ['motion'],
515 - ],
516 - 'ai' => [
517 - 'active' => false,
518 - ],
519 - 'frontend_available' => true,
520 - ]
521 - );
509 + $this->add_control(
510 + 'counter_separator',
511 + [
512 + 'label' => esc_html__('Thousand symbol', 'uicore-elements'),
513 + 'type' => Controls_Manager::TEXT,
514 + 'default' => esc_html__(',', 'uicore-elements'),
515 + 'condition' => [
516 + 'use_grouping' => 'true',
517 + 'counter_animation!' => ['motion'],
518 + ],
519 + 'ai' => [
520 + 'active' => false,
521 + ],
522 + 'frontend_available' => true,
523 + ]
524 + );
522 525
523 - $this->add_control(
524 - 'decimal_places',
525 - [
526 - 'label' => esc_html__( 'Decimal Places', 'uicore-elements' ),
527 - 'type' => Controls_Manager::NUMBER,
528 - 'min' => 0,
529 - 'max' => 4,
530 - 'step' => 1,
531 - 'default' => 0,
532 - 'ai' => [
533 - 'active' => false,
534 - ],
535 - 'frontend_available' => true,
536 - 'condition' => [
537 - 'counter_animation!' => ['motion'],
538 - ],
539 - ]
540 - );
526 + $this->add_control(
527 + 'decimal_places',
528 + [
529 + 'label' => esc_html__('Decimal Places', 'uicore-elements'),
530 + 'type' => Controls_Manager::NUMBER,
531 + 'min' => 0,
532 + 'max' => 4,
533 + 'step' => 1,
534 + 'default' => 0,
535 + 'ai' => [
536 + 'active' => false,
537 + ],
538 + 'frontend_available' => true,
539 + 'condition' => [
540 + 'counter_animation!' => ['motion'],
541 + ],
542 + ]
543 + );
541 544
542 - $this->add_control(
543 - 'decimal_symbol',
544 - [
545 - 'label' => esc_html__( 'Decimal Symbol', 'uicore-elements' ),
546 - 'type' => Controls_Manager::TEXT,
547 - 'default' => esc_html__( '.', 'uicore-elements' ),
548 - 'condition' =>[
549 - 'counter_animation!' => ['motion'],
550 - ],
551 - 'ai' => [
552 - 'active' => false,
553 - ],
554 - 'frontend_available' => true,
555 - ]
556 - );
545 + $this->add_control(
546 + 'decimal_symbol',
547 + [
548 + 'label' => esc_html__('Decimal Symbol', 'uicore-elements'),
549 + 'type' => Controls_Manager::TEXT,
550 + 'default' => esc_html__('.', 'uicore-elements'),
551 + 'condition' => [
552 + 'counter_animation!' => ['motion'],
553 + ],
554 + 'ai' => [
555 + 'active' => false,
556 + ],
557 + 'frontend_available' => true,
558 + ]
559 + );
557 560
558 - $this->add_control(
559 - 'counter_prefix',
560 - [
561 - 'label' => esc_html__( 'Counter Prefix', 'uicore-elements' ),
562 - 'type' => Controls_Manager::TEXT,
563 - 'default' => esc_html__( '', 'uicore-elements' ),
564 - 'placeholder' => esc_html__( '$', 'uicore-elements' ),
565 - 'ai' => [
566 - 'active' => false,
567 - ],
568 - ]
569 - );
561 + $this->add_control(
562 + 'counter_prefix',
563 + [
564 + 'label' => esc_html__('Counter Prefix', 'uicore-elements'),
565 + 'type' => Controls_Manager::TEXT,
566 + 'default' => '',
567 + 'placeholder' => esc_html__('$', 'uicore-elements'),
568 + 'ai' => [
569 + 'active' => false,
570 + ],
571 + ]
572 + );
570 573
571 - $this->add_control(
572 - 'counter_suffix',
573 - [
574 - 'label' => esc_html__( 'Counter Suffix', 'uicore-elements' ),
575 - 'type' => Controls_Manager::TEXT,
576 - 'default' => esc_html__( '', 'uicore-elements' ),
577 - 'placeholder' => esc_html__( '+', 'uicore-elements' ),
578 - 'ai' => [
579 - 'active' => false,
580 - ],
581 - 'frontend_available' => true,
582 - ]
583 - );
574 + $this->add_control(
575 + 'counter_suffix',
576 + [
577 + 'label' => esc_html__('Counter Suffix', 'uicore-elements'),
578 + 'type' => Controls_Manager::TEXT,
579 + 'default' => '',
580 + 'placeholder' => esc_html__('+', 'uicore-elements'),
581 + 'ai' => [
582 + 'active' => false,
583 + ],
584 + 'frontend_available' => true,
585 + ]
586 + );
584 587
585 588 $this->end_controls_section();
586 589
587 590 $this->start_controls_section(
@@ -586,280 +589,280 @@
586 589
587 590 $this->start_controls_section(
588 591 'icon_image_section',
589 592 [
590 - 'label' => __( 'Icon/Image', 'uicore-elements' ),
593 + 'label' => __('Icon/Image', 'uicore-elements'),
591 594 'tab' => Controls_Manager::TAB_STYLE,
592 595 'condition' => [
593 - 'show_icon' => 'true',
596 + 'show_icon' => 'true',
594 597 ],
595 598 ]
596 599 );
597 600
598 - $this->start_controls_tabs(
599 - 'style_tabs'
600 - );
601 + $this->start_controls_tabs(
602 + 'style_tabs'
603 + );
601 604
602 - $this->start_controls_tab(
603 - 'icon_colors',
604 - [
605 - 'label' => esc_html__( 'Normal', 'uicore-elements' ),
606 - ]
607 - );
605 + $this->start_controls_tab(
606 + 'icon_colors',
607 + [
608 + 'label' => esc_html__('Normal', 'uicore-elements'),
609 + ]
610 + );
608 611
609 - $this->add_control(
610 - 'icon_color',
611 - [
612 - 'label' => esc_html__( 'Icon color', 'uicore-elements' ),
613 - 'type' => Controls_Manager::COLOR,
614 - 'condition' => [
615 - 'icon_type!' => 'image',
616 - ],
617 - 'selectors' => [
618 - '{{WRAPPER}} .ui-e-offset > svg' => 'fill:{{VALUE}};',
619 - '{{WRAPPER}} .ui-e-offset > i' => 'color: {{VALUE}};',
620 - ],
612 + $this->add_control(
613 + 'icon_color',
614 + [
615 + 'label' => esc_html__('Icon color', 'uicore-elements'),
616 + 'type' => Controls_Manager::COLOR,
617 + 'condition' => [
618 + 'icon_type!' => 'image',
619 + ],
620 + 'selectors' => [
621 + '{{WRAPPER}} .ui-e-offset > svg' => 'fill:{{VALUE}};',
622 + '{{WRAPPER}} .ui-e-offset > i' => 'color: {{VALUE}};',
623 + ],
621 624
622 - ]
623 - );
625 + ]
626 + );
624 627
625 - $this->add_group_control(
626 - Group_Control_Background::get_type(),
627 - [
628 - 'name' => 'icon_background',
629 - 'types' => [ 'classic', 'gradient', 'video' ],
630 - 'selector' => '{{WRAPPER}} .ui-e-ico .ui-e-offset',
631 - ]
632 - );
628 + $this->add_group_control(
629 + Group_Control_Background::get_type(),
630 + [
631 + 'name' => 'icon_background',
632 + 'types' => ['classic', 'gradient', 'video'],
633 + 'selector' => '{{WRAPPER}} .ui-e-ico .ui-e-offset',
634 + ]
635 + );
633 636
634 - $this->end_controls_tab();
637 + $this->end_controls_tab();
635 638
636 - $this->start_controls_tab(
637 - 'icon_colors_hover',
638 - [
639 - 'label' => esc_html__( 'Hover', 'uicore-elements' ),
640 - ]
641 - );
639 + $this->start_controls_tab(
640 + 'icon_colors_hover',
641 + [
642 + 'label' => esc_html__('Hover', 'uicore-elements'),
643 + ]
644 + );
642 645
643 - $this->add_control(
644 - 'icon_color_hover',
645 - [
646 - 'label' => esc_html__( 'Icon color', 'uicore-elements' ),
647 - 'type' => Controls_Manager::COLOR,
648 - 'condition' => [
649 - 'icon_type!' => 'image',
650 - ],
651 - 'selectors' => [
652 - '{{WRAPPER}} > div:hover .ui-e-offset > svg' => 'fill:{{VALUE}};',
653 - '{{WRAPPER}} > div:hover .ui-e-offset > i' => 'color: {{VALUE}};',
654 - ],
646 + $this->add_control(
647 + 'icon_color_hover',
648 + [
649 + 'label' => esc_html__('Icon color', 'uicore-elements'),
650 + 'type' => Controls_Manager::COLOR,
651 + 'condition' => [
652 + 'icon_type!' => 'image',
653 + ],
654 + 'selectors' => [
655 + '{{WRAPPER}} > div:hover .ui-e-offset > svg' => 'fill:{{VALUE}};',
656 + '{{WRAPPER}} > div:hover .ui-e-offset > i' => 'color: {{VALUE}};',
657 + ],
655 658
656 - ]
657 - );
659 + ]
660 + );
658 661
659 - $this->add_group_control(
660 - Group_Control_Background::get_type(),
661 - [
662 - 'name' => 'icon_background_hover',
663 - 'types' => [ 'classic', 'gradient', 'video' ],
664 - 'selector' => '{{WRAPPER}} > div:hover .ui-e-offset',
662 + $this->add_group_control(
663 + Group_Control_Background::get_type(),
664 + [
665 + 'name' => 'icon_background_hover',
666 + 'types' => ['classic', 'gradient', 'video'],
667 + 'selector' => '{{WRAPPER}} > div:hover .ui-e-offset',
665 668
666 - ]
667 - );
669 + ]
670 + );
668 671
669 - $this->add_control(
670 - 'border_color_hover',
671 - [
672 - 'label' => esc_html__( 'Border Color', 'uicore-elements' ),
673 - 'type' => Controls_Manager::COLOR,
674 - 'selectors' => [
675 - '{{WRAPPER}} > div:hover .ui-e-offset' => 'border-color: {{VALUE}}',
676 - ],
677 - ]
678 - );
672 + $this->add_control(
673 + 'border_color_hover',
674 + [
675 + 'label' => esc_html__('Border Color', 'uicore-elements'),
676 + 'type' => Controls_Manager::COLOR,
677 + 'selectors' => [
678 + '{{WRAPPER}} > div:hover .ui-e-offset' => 'border-color: {{VALUE}}',
679 + ],
680 + ]
681 + );
679 682
680 - $this->end_controls_tab();
683 + $this->end_controls_tab();
681 684
682 - $this->end_controls_tabs();
685 + $this->end_controls_tabs();
683 686
684 - $this->add_control(
685 - 'hr',
686 - [
687 - 'type' => Controls_Manager::DIVIDER,
688 - ]
689 - );
687 + $this->add_control(
688 + 'hr',
689 + [
690 + 'type' => Controls_Manager::DIVIDER,
691 + ]
692 + );
690 693
691 - $this->add_responsive_control(
692 - 'icon_padding',
693 - [
694 - 'label' => esc_html__( 'Padding', 'uicore-elements' ),
695 - 'type' => Controls_Manager::DIMENSIONS,
696 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
697 - 'range' => [
698 - 'px' => [
699 - 'min' => 0,
700 - 'max' => 10,
701 - 'step' => 1,
702 - ],
703 - '%' => [
704 - 'min' => 0,
705 - 'max' => 20,
706 - ],
694 + $this->add_responsive_control(
695 + 'icon_padding',
696 + [
697 + 'label' => esc_html__('Padding', 'uicore-elements'),
698 + 'type' => Controls_Manager::DIMENSIONS,
699 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
700 + 'range' => [
701 + 'px' => [
702 + 'min' => 0,
703 + 'max' => 10,
704 + 'step' => 1,
707 705 ],
708 - 'default' => [
709 - 'unit' => 'px',
710 - 'size' => 25,
706 + '%' => [
707 + 'min' => 0,
708 + 'max' => 20,
711 709 ],
712 - 'selectors' => [
713 - '{{WRAPPER}} .ui-e-offset' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
714 - ],
710 + ],
711 + 'default' => [
712 + 'unit' => 'px',
713 + 'size' => 25,
714 + ],
715 + 'selectors' => [
716 + '{{WRAPPER}} .ui-e-offset' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
717 + ],
715 718
716 - ]
717 - );
719 + ]
720 + );
718 721
719 - $this->add_group_control(
720 - Group_Control_Border::get_type(),
721 - [
722 - 'name' => 'icon_border',
723 - 'selector' => '{{WRAPPER}} .ui-e-offset',
722 + $this->add_group_control(
723 + Group_Control_Border::get_type(),
724 + [
725 + 'name' => 'icon_border',
726 + 'selector' => '{{WRAPPER}} .ui-e-offset',
724 727
725 - ]
726 - );
728 + ]
729 + );
727 730
728 - $this->add_responsive_control(
729 - 'icon_radius',
730 - [
731 - 'label' => esc_html__( 'Border Radius', 'uicore-elements' ),
732 - 'type' => Controls_Manager::DIMENSIONS,
733 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
734 - 'default' => [
735 - 'unit' => 'px',
736 - 'size' => 100,
737 - ],
738 - 'selectors' => [
739 - '{{WRAPPER}} .ui-e-offset' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius:{{RIGHT}}{{UNIT}}; border-bottom-right-radius:{{BOTTOM}}{{UNIT}}; border-bottom-left-radius:{{LEFT}}{{UNIT}};',
740 - ],
731 + $this->add_responsive_control(
732 + 'icon_radius',
733 + [
734 + 'label' => esc_html__('Border Radius', 'uicore-elements'),
735 + 'type' => Controls_Manager::DIMENSIONS,
736 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
737 + 'default' => [
738 + 'unit' => 'px',
739 + 'size' => 100,
740 + ],
741 + 'selectors' => [
742 + '{{WRAPPER}} .ui-e-offset' => 'border-top-left-radius: {{TOP}}{{UNIT}}; border-top-right-radius:{{RIGHT}}{{UNIT}}; border-bottom-right-radius:{{BOTTOM}}{{UNIT}}; border-bottom-left-radius:{{LEFT}}{{UNIT}};',
743 + ],
741 744
742 - ]
743 - );
745 + ]
746 + );
744 747
745 - $this->add_group_control(
746 - Group_Control_Box_Shadow::get_type(),
747 - [
748 - 'name' => 'icon_shadow',
749 - 'selector' => '{{WRAPPER}} .ui-e-offset',
748 + $this->add_group_control(
749 + Group_Control_Box_Shadow::get_type(),
750 + [
751 + 'name' => 'icon_shadow',
752 + 'selector' => '{{WRAPPER}} .ui-e-offset',
750 753
751 - ]
752 - );
754 + ]
755 + );
753 756
754 - $this->add_responsive_control(
755 - 'icon_space',
756 - [
757 - 'label' => esc_html__( 'Icon Space', 'uicore-elements' ),
758 - 'type' => Controls_Manager::SLIDER,
759 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
760 - 'range' => [
761 - 'px' => [
762 - 'min' => 0,
763 - 'max' => 60,
764 - 'step' => 1,
765 - ],
766 - '%' => [
767 - 'min' => 0,
768 - 'max' => 20,
769 - ],
757 + $this->add_responsive_control(
758 + 'icon_space',
759 + [
760 + 'label' => esc_html__('Icon Space', 'uicore-elements'),
761 + 'type' => Controls_Manager::SLIDER,
762 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
763 + 'range' => [
764 + 'px' => [
765 + 'min' => 0,
766 + 'max' => 60,
767 + 'step' => 1,
770 768 ],
771 - 'default' => [
772 - 'unit' => 'px',
773 - 'size' => 8,
769 + '%' => [
770 + 'min' => 0,
771 + 'max' => 20,
774 772 ],
775 - 'selectors' => [
776 - '{{WRAPPER}}' => '--ui-e-ico-spacing: {{SIZE}}{{UNIT}}',
777 - ],
773 + ],
774 + 'default' => [
775 + 'unit' => 'px',
776 + 'size' => 8,
777 + ],
778 + 'selectors' => [
779 + '{{WRAPPER}}' => '--ui-e-ico-spacing: {{SIZE}}{{UNIT}}',
780 + ],
778 781
779 - ]
780 - );
782 + ]
783 + );
781 784
782 - $this->add_control(
783 - 'image_fullwidth',
784 - [
785 - 'label' => esc_html__( 'Image fullwidth', 'uicore-elements' ),
786 - 'type' => Controls_Manager::SWITCHER,
787 - 'label_on' => esc_html__( 'True', 'uicore-elements' ),
788 - 'label_off' => esc_html__( 'False', 'uicore-elements' ),
789 - 'return_value' => 'true',
790 - 'default' => 'false',
791 - 'condition' => [
792 - 'icon_type' => 'image',
793 - ],
794 - 'selectors' => [
795 - '{{WRAPPER}} .ui-e-offset > *' => 'width: 100%;',
785 + $this->add_control(
786 + 'image_fullwidth',
787 + [
788 + 'label' => esc_html__('Image fullwidth', 'uicore-elements'),
789 + 'type' => Controls_Manager::SWITCHER,
790 + 'label_on' => esc_html__('True', 'uicore-elements'),
791 + 'label_off' => esc_html__('False', 'uicore-elements'),
792 + 'return_value' => 'true',
793 + 'default' => 'false',
794 + 'condition' => [
795 + 'icon_type' => 'image',
796 + ],
797 + 'selectors' => [
798 + '{{WRAPPER}} .ui-e-offset > *' => 'width: 100%;',
796 799
797 - ],
798 - ]
799 - );
800 + ],
801 + ]
802 + );
800 803
801 - $this->add_responsive_control(
802 - 'image_size',
803 - [
804 - 'label' => esc_html__( 'Image Size', 'uicore-elements' ),
805 - 'type' => Controls_Manager::SLIDER,
806 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
807 - 'range' => [
808 - 'px' => [
809 - 'min' => 0,
810 - 'max' => 991,
811 - 'step' => 1,
812 - ],
813 - '%' => [
814 - 'min' => 0,
815 - 'max' => 100,
816 - ],
804 + $this->add_responsive_control(
805 + 'image_size',
806 + [
807 + 'label' => esc_html__('Image Size', 'uicore-elements'),
808 + 'type' => Controls_Manager::SLIDER,
809 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
810 + 'range' => [
811 + 'px' => [
812 + 'min' => 0,
813 + 'max' => 991,
814 + 'step' => 1,
817 815 ],
818 - 'default' => [
819 - 'unit' => 'px',
820 - 'size' => 120,
816 + '%' => [
817 + 'min' => 0,
818 + 'max' => 100,
821 819 ],
822 - 'condition' => [
823 - 'icon_type' => 'image',
824 - 'image_fullwidth!' => 'true',
825 - ],
826 - 'selectors' => [
827 - '{{WRAPPER}} .ui-e-offset > *' => 'width: {{SIZE}}{{UNIT}};',
820 + ],
821 + 'default' => [
822 + 'unit' => 'px',
823 + 'size' => 120,
824 + ],
825 + 'condition' => [
826 + 'icon_type' => 'image',
827 + 'image_fullwidth!' => 'true',
828 + ],
829 + 'selectors' => [
830 + '{{WRAPPER}} .ui-e-offset > *' => 'width: {{SIZE}}{{UNIT}};',
828 831
829 - ],
830 - ]
831 - );
832 + ],
833 + ]
834 + );
832 835
833 - $this->add_responsive_control(
834 - 'icon_size',
835 - [
836 - 'label' => esc_html__( 'Icon Size', 'uicore-elements' ),
837 - 'type' => Controls_Manager::SLIDER,
838 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
839 - 'range' => [
840 - 'px' => [
841 - 'min' => 8,
842 - 'max' => 160,
843 - 'step' => 1,
844 - ],
845 - '%' => [
846 - 'min' => 0,
847 - 'max' => 100,
848 - ],
836 + $this->add_responsive_control(
837 + 'icon_size',
838 + [
839 + 'label' => esc_html__('Icon Size', 'uicore-elements'),
840 + 'type' => Controls_Manager::SLIDER,
841 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
842 + 'range' => [
843 + 'px' => [
844 + 'min' => 8,
845 + 'max' => 160,
846 + 'step' => 1,
849 847 ],
850 - 'default' => [
851 - 'unit' => 'px',
852 - 'size' => 40,
848 + '%' => [
849 + 'min' => 0,
850 + 'max' => 100,
853 851 ],
854 - 'condition' => [
855 - 'icon_type' => 'icon',
856 - ],
857 - 'selectors' => [
858 - '{{WRAPPER}}' => '--ui-e-icon-size:{{SIZE}}{{UNIT}}',
859 - ],
860 - ]
861 - );
852 + ],
853 + 'default' => [
854 + 'unit' => 'px',
855 + 'size' => 40,
856 + ],
857 + 'condition' => [
858 + 'icon_type' => 'icon',
859 + ],
860 + 'selectors' => [
861 + '{{WRAPPER}}' => '--ui-e-icon-size:{{SIZE}}{{UNIT}}',
862 + ],
863 + ]
864 + );
862 865
863 866 $this->end_controls_section();
864 867
865 868 $this->start_controls_section(
@@ -864,95 +867,95 @@
864 867
865 868 $this->start_controls_section(
866 869 'counter_number_section',
867 870 [
868 - 'label' => __( 'Number', 'uicore-elements' ),
871 + 'label' => __('Number', 'uicore-elements'),
869 872 'tab' => Controls_Manager::TAB_STYLE,
870 873 ]
871 874 );
872 875
873 - $this->add_responsive_control(
874 - 'counter_number_space',
875 - [
876 - 'label' => esc_html__( 'Number space', 'uicore-elements' ),
877 - 'type' => Controls_Manager::SLIDER,
878 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
879 - 'range' => [
880 - 'px' => [
881 - 'min' => 0,
882 - 'max' => 100,
883 - 'step' => 1,
884 - ],
885 - '%' => [
886 - 'min' => 0,
887 - 'max' => 100,
888 - ],
876 + $this->add_responsive_control(
877 + 'counter_number_space',
878 + [
879 + 'label' => esc_html__('Number space', 'uicore-elements'),
880 + 'type' => Controls_Manager::SLIDER,
881 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
882 + 'range' => [
883 + 'px' => [
884 + 'min' => 0,
885 + 'max' => 100,
886 + 'step' => 1,
889 887 ],
890 - 'default' => [
891 - 'unit' => 'px',
892 - 'size' => 0,
888 + '%' => [
889 + 'min' => 0,
890 + 'max' => 100,
893 891 ],
894 - 'selectors' => [
895 - '{{WRAPPER}}' => '--ui-e-num-spacing: {{SIZE}}{{UNIT}};',
896 - ],
892 + ],
893 + 'default' => [
894 + 'unit' => 'px',
895 + 'size' => 0,
896 + ],
897 + 'selectors' => [
898 + '{{WRAPPER}}' => '--ui-e-num-spacing: {{SIZE}}{{UNIT}};',
899 + ],
897 900
898 - ]
899 - );
901 + ]
902 + );
900 903
901 - $this->start_controls_tabs(
902 - 'counter_tabs'
903 - );
904 + $this->start_controls_tabs(
905 + 'counter_tabs'
906 + );
904 907
905 - $this->start_controls_tab(
906 - 'counter_color_normal',
907 - [
908 - 'label' => esc_html__( 'Normal', 'uicore-elements' ),
909 - ]
910 - );
908 + $this->start_controls_tab(
909 + 'counter_color_normal',
910 + [
911 + 'label' => esc_html__('Normal', 'uicore-elements'),
912 + ]
913 + );
911 914
912 - $this->add_control(
913 - 'counter_number_color',
914 - [
915 - 'label' => esc_html__( 'Number Color', 'uicore-elements' ),
916 - 'type' => Controls_Manager::COLOR,
917 - 'selectors' => [
918 - '{{WRAPPER}} .ui-e-num' => 'color: {{VALUE}}',
919 - '{{WRAPPER}}' => '--ui-e-num-color: {{VALUE}}',
920 - ],
921 - ]
922 - );
915 + $this->add_control(
916 + 'counter_number_color',
917 + [
918 + 'label' => esc_html__('Number Color', 'uicore-elements'),
919 + 'type' => Controls_Manager::COLOR,
920 + 'selectors' => [
921 + '{{WRAPPER}} .ui-e-num' => 'color: {{VALUE}}',
922 + '{{WRAPPER}}' => '--ui-e-num-color: {{VALUE}}',
923 + ],
924 + ]
925 + );
923 926
924 - $this->end_controls_tab();
927 + $this->end_controls_tab();
925 928
926 - $this->start_controls_tab(
927 - 'counter_color_hover',
928 - [
929 - 'label' => esc_html__( 'Hover', 'uicore-elements' ),
930 - ]
931 - );
929 + $this->start_controls_tab(
930 + 'counter_color_hover',
931 + [
932 + 'label' => esc_html__('Hover', 'uicore-elements'),
933 + ]
934 + );
932 935
933 - $this->add_control(
934 - 'counter_number_color_hover',
935 - [
936 - 'label' => esc_html__( 'Number Color', 'uicore-elements' ),
937 - 'type' => Controls_Manager::COLOR,
938 - 'selectors' => [
939 - '{{WRAPPER}} > div:hover .ui-e-num' => 'color: {{VALUE}}',
940 - ],
941 - ]
942 - );
936 + $this->add_control(
937 + 'counter_number_color_hover',
938 + [
939 + 'label' => esc_html__('Number Color', 'uicore-elements'),
940 + 'type' => Controls_Manager::COLOR,
941 + 'selectors' => [
942 + '{{WRAPPER}} > div:hover .ui-e-num' => 'color: {{VALUE}}',
943 + ],
944 + ]
945 + );
943 946
944 - $this->end_controls_tab();
947 + $this->end_controls_tab();
945 948
946 - $this->end_controls_tabs();
949 + $this->end_controls_tabs();
947 950
948 - $this->add_group_control(
949 - Group_Control_Typography::get_type(),
950 - [
951 - 'name' => 'counter_number_typography',
952 - 'selector' => '{{WRAPPER}} .ui-e-num',
953 - ]
954 - );
951 + $this->add_group_control(
952 + Group_Control_Typography::get_type(),
953 + [
954 + 'name' => 'counter_number_typography',
955 + 'selector' => '{{WRAPPER}} .ui-e-num',
956 + ]
957 + );
955 958
956 959 $this->end_controls_section();
957 960
958 961 $this->start_controls_section(
@@ -957,218 +960,227 @@
957 960
958 961 $this->start_controls_section(
959 962 'suffix_prefix_section',
960 963 [
961 - 'label' => __( 'Suffix/Prefix', 'uicore-elements' ),
964 + 'label' => __('Prefix', 'uicore-elements'),
962 965 'tab' => Controls_Manager::TAB_STYLE,
963 966 ]
964 967 );
965 968
966 - $this->add_control(
967 - 'suffix_prefix_color',
968 - [
969 - 'label' => esc_html__( 'Color', 'uicore-elements' ),
970 - 'type' => Controls_Manager::COLOR,
971 - 'selectors' => [
972 - '{{WRAPPER}} .ui-e-prefix, {{WRAPPER}} .ui-e-suffix' => 'color: {{VALUE}}',
969 + // TODO: Prefix colors are also applied to suffix to compatibility purposes,
970 + // so the prefix/suffix color and typo styles split dont affect existent widgets.
971 + // Due to a lack of a better method to proper handle this styles split, we should
972 + // keep the current implementation as is for now.
973 + $this->add_control(
974 + 'suffix_prefix_color',
975 + [
976 + 'label' => esc_html__('Color', 'uicore-elements'),
977 + 'type' => Controls_Manager::COLOR,
978 + 'selectors' => [
979 + '{{WRAPPER}} .ui-e-prefix, {{WRAPPER}} .ui-e-suffix' => 'color: {{VALUE}}',
980 + ],
981 + ]
982 + );
983 + $this->add_group_control(
984 + Group_Control_Typography::get_type(),
985 + [
986 + 'name' => 'suffix_prefix_typography',
987 + 'selector' => '{{WRAPPER}} .ui-e-prefix, {{WRAPPER}} .ui-e-suffix',
988 + ]
989 + );
990 +
991 + $this->add_responsive_control(
992 + 'prefix_h_offset',
993 + [
994 + 'label' => esc_html__('Horizontal Offset', 'uicore-elements'),
995 + 'type' => Controls_Manager::SLIDER,
996 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
997 + 'range' => [
998 + 'px' => [
999 + 'min' => -200,
1000 + 'max' => 200,
1001 + 'step' => 1,
973 1002 ],
974 - ]
975 - );
976 - $this->add_group_control(
977 - Group_Control_Typography::get_type(),
978 - [
979 - 'name' => 'suffix_prefix_typography',
980 - 'selector' => '{{WRAPPER}} .ui-e-prefix, {{WRAPPER}} .ui-e-suffix',
981 - ]
982 - );
1003 + '%' => [
1004 + 'min' => -100,
1005 + 'max' => 100,
1006 + ],
1007 + ],
1008 + 'default' => [
1009 + 'unit' => 'px',
1010 + 'size' => 0,
1011 + ],
1012 + ]
1013 + );
1014 + $this->add_responsive_control(
1015 + 'prefix_v_offset',
1016 + [
1017 + 'label' => esc_html__('Vertical Offset', 'uicore-elements'),
1018 + 'type' => Controls_Manager::SLIDER,
1019 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
1020 + 'range' => [
1021 + 'px' => [
1022 + 'min' => -80,
1023 + 'max' => 80,
1024 + 'step' => 1,
1025 + ],
1026 + '%' => [
1027 + 'min' => -100,
1028 + 'max' => 100,
1029 + ],
1030 + ],
1031 + 'default' => [
1032 + 'unit' => 'px',
1033 + 'size' => 0,
1034 + ],
1035 + 'selectors' => [
1036 + '{{WRAPPER}} .ui-e-prefix' => 'transform: translate3d( {{prefix_h_offset.SIZE}}{{prefix_h_offset.UNIT}}, {{SIZE}}{{UNIT}}, 0);',
1037 + ],
1038 + ]
1039 + );
983 1040
984 - $this->start_controls_tabs(
985 - 'prefix_suffix_tabs'
986 - );
1041 + $this->end_controls_section();
987 1042
988 - $this->start_controls_tab(
989 - 'prefix_tab',
990 - [
991 - 'label' => esc_html__( 'Prefix', 'uicore-elements' ),
992 - ]
993 - );
1043 + $this->start_controls_section(
1044 + 'suffix_section',
1045 + [
1046 + 'label' => __('Suffix', 'uicore-elements'),
1047 + 'tab' => Controls_Manager::TAB_STYLE,
1048 + ]
1049 + );
994 1050
995 - $this->add_responsive_control(
996 - 'prefix_h_offset',
997 - [
998 - 'label' => esc_html__( 'Horizontal Offset', 'uicore-elements' ),
999 - 'type' => Controls_Manager::SLIDER,
1000 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1001 - 'range' => [
1002 - 'px' => [
1003 - 'min' => -200,
1004 - 'max' => 200,
1005 - 'step' => 1,
1006 - ],
1007 - '%' => [
1008 - 'min' => -100,
1009 - 'max' => 100,
1010 - ],
1011 - ],
1012 - 'default' => [
1013 - 'unit' => 'px',
1014 - 'size' => 0,
1015 - ],
1016 - ]
1017 - );
1018 - $this->add_responsive_control(
1019 - 'prefix_v_offset',
1020 - [
1021 - 'label' => esc_html__( 'Vertical Offset', 'uicore-elements' ),
1022 - 'type' => Controls_Manager::SLIDER,
1023 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1024 - 'range' => [
1025 - 'px' => [
1026 - 'min' => -80,
1027 - 'max' => 80,
1028 - 'step' => 1,
1029 - ],
1030 - '%' => [
1031 - 'min' => -100,
1032 - 'max' => 100,
1033 - ],
1034 - ],
1035 - 'default' => [
1036 - 'unit' => 'px',
1037 - 'size' => 0,
1038 - ],
1039 - 'selectors' => [
1040 - '{{WRAPPER}} .ui-e-prefix' => 'transform: translate3d( {{prefix_h_offset.SIZE}}{{prefix_h_offset.UNIT}}, {{SIZE}}{{UNIT}}, 0);',
1041 - ],
1042 - ]
1043 - );
1051 + $this->add_control(
1052 + 'suffix_color',
1053 + [
1054 + 'label' => esc_html__('Color', 'uicore-elements'),
1055 + 'type' => Controls_Manager::COLOR,
1056 + 'selectors' => [
1057 + '{{WRAPPER}} .ui-e-suffix' => 'color: {{VALUE}} !important;',
1058 + ],
1059 + 'default' => ''
1060 + ]
1061 + );
1062 + $this->add_group_control(
1063 + Group_Control_Typography::get_type(),
1064 + [
1065 + 'name' => 'suffix_typography',
1066 + 'selector' => '{{WRAPPER}} .ui-e-suffix',
1067 + ]
1068 + );
1044 1069
1045 - $this->end_controls_tab();
1070 + $this->add_responsive_control(
1071 + 'suffix_h_offset',
1072 + [
1073 + 'label' => esc_html__('Horizontal Offset', 'uicore-elements'),
1074 + 'type' => Controls_Manager::SLIDER,
1075 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
1076 + 'range' => [
1077 + 'px' => [
1078 + 'min' => -200,
1079 + 'max' => 200,
1080 + 'step' => 1,
1081 + ],
1082 + '%' => [
1083 + 'min' => -100,
1084 + 'max' => 100,
1085 + ],
1086 + ],
1087 + 'default' => [
1088 + 'unit' => 'px',
1089 + 'size' => 0,
1090 + ],
1091 + ]
1092 + );
1093 + $this->add_responsive_control(
1094 + 'suffix_v_offset',
1095 + [
1096 + 'label' => esc_html__('Vertical Offset', 'uicore-elements'),
1097 + 'type' => Controls_Manager::SLIDER,
1098 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
1099 + 'range' => [
1100 + 'px' => [
1101 + 'min' => -80,
1102 + 'max' => 80,
1103 + 'step' => 1,
1104 + ],
1105 + '%' => [
1106 + 'min' => -100,
1107 + 'max' => 100,
1108 + ],
1109 + ],
1110 + 'default' => [
1111 + 'unit' => 'px',
1112 + 'size' => 0,
1113 + ],
1114 + 'selectors' => [
1115 + '{{WRAPPER}} .ui-e-suffix' => 'transform: translate3d( {{suffix_h_offset.SIZE}}{{suffix_h_offset.UNIT}}, {{SIZE}}{{UNIT}}, 0);',
1116 + ],
1117 + ]
1118 + );
1046 1119
1047 - $this->start_controls_tab(
1048 - 'suffix_tab',
1049 - [
1050 - 'label' => esc_html__( 'Suffix', 'uicore-elements' ),
1051 - ]
1052 - );
1053 -
1054 - $this->add_responsive_control(
1055 - 'suffix_h_offset',
1056 - [
1057 - 'label' => esc_html__( 'Horizontal Offset', 'uicore-elements' ),
1058 - 'type' => Controls_Manager::SLIDER,
1059 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1060 - 'range' => [
1061 - 'px' => [
1062 - 'min' => -200,
1063 - 'max' => 200,
1064 - 'step' => 1,
1065 - ],
1066 - '%' => [
1067 - 'min' => -100,
1068 - 'max' => 100,
1069 - ],
1070 - ],
1071 - 'default' => [
1072 - 'unit' => 'px',
1073 - 'size' => 0,
1074 - ],
1075 - ]
1076 - );
1077 - $this->add_responsive_control(
1078 - 'suffix_v_offset',
1079 - [
1080 - 'label' => esc_html__( 'Vertical Offset', 'uicore-elements' ),
1081 - 'type' => Controls_Manager::SLIDER,
1082 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1083 - 'range' => [
1084 - 'px' => [
1085 - 'min' => -80,
1086 - 'max' => 80,
1087 - 'step' => 1,
1088 - ],
1089 - '%' => [
1090 - 'min' => -100,
1091 - 'max' => 100,
1092 - ],
1093 - ],
1094 - 'default' => [
1095 - 'unit' => 'px',
1096 - 'size' => 0,
1097 - ],
1098 - 'selectors' => [
1099 - '{{WRAPPER}} .ui-e-suffix' => 'transform: translate3d( {{suffix_h_offset.SIZE}}{{suffix_h_offset.UNIT}}, {{SIZE}}{{UNIT}}, 0);',
1100 - ],
1101 - ]
1102 - );
1103 -
1104 - $this->end_controls_tab();
1105 -
1106 - $this->end_controls_tabs();
1107 -
1108 1120 $this->end_controls_section();
1109 1121
1110 1122 $this->start_controls_section(
1111 1123 'content_text_section',
1112 1124 [
1113 - 'label' => __( 'Text', 'uicore-elements' ),
1125 + 'label' => __('Text', 'uicore-elements'),
1114 1126 'tab' => Controls_Manager::TAB_STYLE,
1115 1127 ]
1116 1128 );
1117 1129
1118 - $this->start_controls_tabs(
1119 - 'content_text_tabs'
1120 - );
1130 + $this->start_controls_tabs(
1131 + 'content_text_tabs'
1132 + );
1121 1133
1122 - $this->start_controls_tab(
1123 - 'content_text_normal',
1124 - [
1125 - 'label' => esc_html__( 'Normal', 'uicore-elements' ),
1126 - ]
1127 - );
1134 + $this->start_controls_tab(
1135 + 'content_text_normal',
1136 + [
1137 + 'label' => esc_html__('Normal', 'uicore-elements'),
1138 + ]
1139 + );
1128 1140
1129 - $this->add_control(
1130 - 'content_text_color',
1131 - [
1132 - 'label' => esc_html__( 'Text Color', 'uicore-elements' ),
1133 - 'type' => Controls_Manager::COLOR,
1134 - 'selectors' => [
1135 - '{{WRAPPER}} .ui-e-title' => 'color: {{VALUE}}',
1136 - ],
1137 - ]
1138 - );
1141 + $this->add_control(
1142 + 'content_text_color',
1143 + [
1144 + 'label' => esc_html__('Text Color', 'uicore-elements'),
1145 + 'type' => Controls_Manager::COLOR,
1146 + 'selectors' => [
1147 + '{{WRAPPER}} .ui-e-title' => 'color: {{VALUE}}',
1148 + ],
1149 + ]
1150 + );
1139 1151
1140 - $this->end_controls_tab();
1152 + $this->end_controls_tab();
1141 1153
1142 - $this->start_controls_tab(
1143 - 'content_text_hover',
1144 - [
1145 - 'label' => esc_html__( 'Hover', 'uicore-elements' ),
1146 - ]
1147 - );
1154 + $this->start_controls_tab(
1155 + 'content_text_hover',
1156 + [
1157 + 'label' => esc_html__('Hover', 'uicore-elements'),
1158 + ]
1159 + );
1148 1160
1149 - $this->add_control(
1150 - 'content_text_color_hover',
1151 - [
1152 - 'label' => esc_html__( 'Text Color', 'uicore-elements' ),
1153 - 'type' => Controls_Manager::COLOR,
1154 - 'selectors' => [
1155 - '{{WRAPPER}} > div:hover .ui-e-title' => 'color: {{VALUE}}',
1156 - ],
1157 - ]
1158 - );
1161 + $this->add_control(
1162 + 'content_text_color_hover',
1163 + [
1164 + 'label' => esc_html__('Text Color', 'uicore-elements'),
1165 + 'type' => Controls_Manager::COLOR,
1166 + 'selectors' => [
1167 + '{{WRAPPER}} > div:hover .ui-e-title' => 'color: {{VALUE}}',
1168 + ],
1169 + ]
1170 + );
1159 1171
1160 - $this->end_controls_tab();
1172 + $this->end_controls_tab();
1161 1173
1162 - $this->end_controls_tabs();
1174 + $this->end_controls_tabs();
1163 1175
1164 - $this->add_group_control(
1165 - Group_Control_Typography::get_type(),
1166 - [
1167 - 'name' => 'content_text_typography',
1168 - 'selector' => '{{WRAPPER}} .ui-e-title',
1169 - ]
1170 - );
1176 + $this->add_group_control(
1177 + Group_Control_Typography::get_type(),
1178 + [
1179 + 'name' => 'content_text_typography',
1180 + 'selector' => '{{WRAPPER}} .ui-e-title',
1181 + ]
1182 + );
1171 1183
1172 1184 $this->end_controls_section();
1173 1185
1174 1186 $this->start_controls_section(
@@ -1173,39 +1185,39 @@
1173 1185
1174 1186 $this->start_controls_section(
1175 1187 'additional_section',
1176 1188 [
1177 - 'label' => __( 'Additional', 'uicore-elements' ),
1189 + 'label' => __('Additional', 'uicore-elements'),
1178 1190 'tab' => Controls_Manager::TAB_STYLE,
1179 1191 ]
1180 1192 );
1181 1193
1182 - $this->add_responsive_control(
1183 - 'content_padding',
1184 - [
1185 - 'label' => esc_html__( 'Content Padding', 'uicore-elements' ),
1186 - 'type' => Controls_Manager::DIMENSIONS,
1187 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1188 - 'range' => [
1189 - 'px' => [
1190 - 'min' => 0,
1191 - 'max' => 80,
1192 - 'step' => 5,
1193 - ],
1194 - '%' => [
1195 - 'min' => 0,
1196 - 'max' => 100,
1197 - ],
1194 + $this->add_responsive_control(
1195 + 'content_padding',
1196 + [
1197 + 'label' => esc_html__('Content Padding', 'uicore-elements'),
1198 + 'type' => Controls_Manager::DIMENSIONS,
1199 + 'size_units' => ['px', '%', 'em', 'rem', 'custom'],
1200 + 'range' => [
1201 + 'px' => [
1202 + 'min' => 0,
1203 + 'max' => 80,
1204 + 'step' => 5,
1198 1205 ],
1199 - 'default' => [
1200 - 'unit' => 'px',
1201 - 'size' => 15,
1206 + '%' => [
1207 + 'min' => 0,
1208 + 'max' => 100,
1202 1209 ],
1203 - 'selectors' => [
1204 - '{{WRAPPER}} > div' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1205 - ],
1206 - ]
1207 - );
1210 + ],
1211 + 'default' => [
1212 + 'unit' => 'px',
1213 + 'size' => 15,
1214 + ],
1215 + 'selectors' => [
1216 + '{{WRAPPER}} > div' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1217 + ],
1218 + ]
1219 + );
1208 1220
1209 1221 $this->end_controls_section();
1210 1222
1211 1223 $this->start_controls_section(
@@ -1210,218 +1222,223 @@
1210 1222
1211 1223 $this->start_controls_section(
1212 1224 'animation_section',
1213 1225 [
1214 - 'label' => __( 'Animations', 'uicore-elements' ),
1226 + 'label' => __('Animations', 'uicore-elements'),
1215 1227 'tab' => Controls_Manager::TAB_STYLE,
1216 1228 ]
1217 1229 );
1218 1230
1219 - $this->add_control(
1220 - 'counter_animation',
1221 - [
1222 - 'label' => esc_html__( 'Number animation', 'uicore-elements' ),
1223 - 'type' => Controls_Manager::SELECT,
1224 - 'default' => 'simple',
1225 - 'options' => [
1226 - 'simple' => esc_html__( 'Simple', 'uicore-elements' ),
1227 - 'odometer' => esc_html__( 'Odometer', 'uicore-elements' ),
1228 - 'motion' => esc_html__( 'Motion Blur', 'uicore-elements' ),
1229 - ],
1230 - 'frontend_available' => true,
1231 - 'prefix_class' => 'ui-e-counter-',
1232 - 'render_type' => 'template',
1233 - ]
1234 - );
1235 - $this->add_control(
1236 - 'duration',
1237 - [
1238 - 'label' => esc_html__( 'Duration (in seconds)', 'uicore-elements' ),
1239 - 'type' => Controls_Manager::NUMBER,
1240 - 'min' => 0.1,
1241 - 'max' => 8.0,
1242 - 'step' => 0.1,
1243 - 'default' => 2.5,
1244 - 'condition' => [
1245 - 'counter_animation!' => 'motion',
1246 - ],
1247 - 'frontend_available' => true,
1248 - ]
1249 - );
1250 - $this->add_control(
1251 - 'motion_heading',
1252 - [
1253 - 'label' => esc_html__( 'Motion Durations (in ms)', 'textdomain' ),
1254 - 'type' => Controls_Manager::HEADING,
1255 - 'condition' => [
1256 - 'counter_animation' => 'motion',
1257 - ],
1258 - 'separator' => 'before',
1259 - ]
1260 - );
1261 - $this->add_control(
1262 - 'motion_translate_duration',
1263 - [
1264 - 'label' => esc_html__( 'Numbers translate', 'uicore-elements' ),
1265 - 'type' => Controls_Manager::NUMBER,
1266 - 'min' => 0.1,
1267 - 'max' => 8.0,
1268 - 'step' => 0.1,
1269 - 'default' => 0.32,
1270 - 'condition' => [
1271 - 'counter_animation' => 'motion',
1272 - ],
1273 - 'selectors' => [
1274 - '{{WRAPPER}}' => '--ui-e-motion-translate: {{VALUE}}s;',
1275 - ],
1276 - ]
1277 - );
1278 - $this->add_control(
1279 - 'motion_opacity_duration',
1280 - [
1281 - 'label' => esc_html__( 'Numbers opacity', 'uicore-elements' ),
1282 - 'type' => Controls_Manager::NUMBER,
1283 - 'min' => 0.1,
1284 - 'max' => 8.0,
1285 - 'step' => 0.1,
1286 - 'default' => 0.2,
1287 - 'condition' => [
1288 - 'counter_animation' => 'motion',
1289 - ],
1290 - 'selectors' => [
1291 - '{{WRAPPER}}' => '--ui-e-motion-opacity: {{VALUE}}s;',
1292 - ],
1293 - ]
1294 - );
1295 - $this->add_control(
1296 - 'motion_blur_duration',
1297 - [
1298 - 'label' => esc_html__( 'Blur effect', 'uicore-elements' ),
1299 - 'type' => Controls_Manager::NUMBER,
1300 - 'min' => 0.1,
1301 - 'max' => 8.0,
1302 - 'step' => 0.1,
1303 - 'default' => 0.36,
1304 - 'condition' => [
1305 - 'counter_animation' => 'motion',
1306 - ],
1307 - 'selectors' => [
1308 - '{{WRAPPER}}' => '--ui-e-motion-blur: {{VALUE}}s;',
1309 - ],
1310 - ]
1311 - );
1312 - $this->add_control(
1313 - 'motion_delay',
1314 - [
1315 - 'label' => esc_html__( 'Delay between numbers', 'uicore-elements' ),
1316 - 'type' => Controls_Manager::NUMBER,
1317 - 'min' => 0.1,
1318 - 'max' => 8.0,
1319 - 'step' => 0.1,
1320 - 'default' => 0.2,
1321 - 'condition' => [
1322 - 'counter_animation' => 'motion',
1323 - ],
1324 - 'selectors' => [
1325 - '{{WRAPPER}}' => '--ui-e-motion-delay: {{VALUE}}s;',
1326 - ],
1327 - ]
1328 - );
1329 - $this->add_control(
1330 - 'animate_suffix',
1331 - [
1332 - 'label' => esc_html__( 'Animate suffix', 'uicore-elements' ),
1333 - 'type' => Controls_Manager::SWITCHER,
1334 - 'label_on' => esc_html__( 'True', 'uicore-elements' ),
1335 - 'label_off' => esc_html__( 'False', 'uicore-elements' ),
1336 - 'return_value' => 'true',
1337 - 'frontend_available' => true,
1338 - 'description' => esc_html__('Add the suffix to the Odometer animation, but removes any suffix custom styling.', 'uicore-elements' ),
1339 - 'condition' =>[
1340 - 'counter_animation' => ['odometer'],
1341 - ],
1342 - ]
1343 - );
1231 + $this->add_control(
1232 + 'counter_animation',
1233 + [
1234 + 'label' => esc_html__('Number animation', 'uicore-elements'),
1235 + 'type' => Controls_Manager::SELECT,
1236 + 'default' => 'simple',
1237 + 'options' => [
1238 + 'simple' => esc_html__('Simple', 'uicore-elements'),
1239 + 'odometer' => esc_html__('Odometer', 'uicore-elements'),
1240 + 'motion' => esc_html__('Motion Blur', 'uicore-elements'),
1241 + ],
1242 + 'frontend_available' => true,
1243 + 'prefix_class' => 'ui-e-counter-',
1244 + 'render_type' => 'template',
1245 + ]
1246 + );
1247 + $this->add_control(
1248 + 'duration',
1249 + [
1250 + 'label' => esc_html__('Duration (in seconds)', 'uicore-elements'),
1251 + 'type' => Controls_Manager::NUMBER,
1252 + 'min' => 0.1,
1253 + 'max' => 8.0,
1254 + 'step' => 0.1,
1255 + 'default' => 2.5,
1256 + 'condition' => [
1257 + 'counter_animation!' => 'motion',
1258 + ],
1259 + 'frontend_available' => true,
1260 + ]
1261 + );
1262 + $this->add_control(
1263 + 'motion_heading',
1264 + [
1265 + 'label' => esc_html__('Motion Durations (in ms)', 'uicore-elements'),
1266 + 'type' => Controls_Manager::HEADING,
1267 + 'condition' => [
1268 + 'counter_animation' => 'motion',
1269 + ],
1270 + 'separator' => 'before',
1271 + ]
1272 + );
1273 + $this->add_control(
1274 + 'motion_translate_duration',
1275 + [
1276 + 'label' => esc_html__('Numbers translate', 'uicore-elements'),
1277 + 'type' => Controls_Manager::NUMBER,
1278 + 'min' => 0.1,
1279 + 'max' => 8.0,
1280 + 'step' => 0.1,
1281 + 'default' => 0.32,
1282 + 'condition' => [
1283 + 'counter_animation' => 'motion',
1284 + ],
1285 + 'selectors' => [
1286 + '{{WRAPPER}}' => '--ui-e-motion-translate: {{VALUE}}s;',
1287 + ],
1288 + ]
1289 + );
1290 + $this->add_control(
1291 + 'motion_opacity_duration',
1292 + [
1293 + 'label' => esc_html__('Numbers opacity', 'uicore-elements'),
1294 + 'type' => Controls_Manager::NUMBER,
1295 + 'min' => 0.1,
1296 + 'max' => 8.0,
1297 + 'step' => 0.1,
1298 + 'default' => 0.2,
1299 + 'condition' => [
1300 + 'counter_animation' => 'motion',
1301 + ],
1302 + 'selectors' => [
1303 + '{{WRAPPER}}' => '--ui-e-motion-opacity: {{VALUE}}s;',
1304 + ],
1305 + ]
1306 + );
1307 + $this->add_control(
1308 + 'motion_blur_duration',
1309 + [
1310 + 'label' => esc_html__('Blur effect', 'uicore-elements'),
1311 + 'type' => Controls_Manager::NUMBER,
1312 + 'min' => 0.1,
1313 + 'max' => 8.0,
1314 + 'step' => 0.1,
1315 + 'default' => 0.36,
1316 + 'condition' => [
1317 + 'counter_animation' => 'motion',
1318 + ],
1319 + 'selectors' => [
1320 + '{{WRAPPER}}' => '--ui-e-motion-blur: {{VALUE}}s;',
1321 + ],
1322 + ]
1323 + );
1324 + $this->add_control(
1325 + 'motion_delay',
1326 + [
1327 + 'label' => esc_html__('Delay between numbers', 'uicore-elements'),
1328 + 'type' => Controls_Manager::NUMBER,
1329 + 'min' => 0.1,
1330 + 'max' => 8.0,
1331 + 'step' => 0.1,
1332 + 'default' => 0.2,
1333 + 'condition' => [
1334 + 'counter_animation' => 'motion',
1335 + ],
1336 + 'selectors' => [
1337 + '{{WRAPPER}}' => '--ui-e-motion-delay: {{VALUE}}s;',
1338 + ],
1339 + ]
1340 + );
1341 + $this->add_control(
1342 + 'animate_suffix',
1343 + [
1344 + 'label' => esc_html__('Animate suffix', 'uicore-elements'),
1345 + 'type' => Controls_Manager::SWITCHER,
1346 + 'label_on' => esc_html__('True', 'uicore-elements'),
1347 + 'label_off' => esc_html__('False', 'uicore-elements'),
1348 + 'return_value' => 'true',
1349 + 'frontend_available' => true,
1350 + 'description' => esc_html__('Add the suffix to the Odometer animation, but removes any suffix custom styling.', 'uicore-elements'),
1351 + 'condition' => [
1352 + 'counter_animation' => ['odometer'],
1353 + ],
1354 + ]
1355 + );
1344 1356
1345 1357 $this->end_controls_section();
1346 - }
1347 - protected function render()
1348 - {
1358 + }
1359 + protected function render()
1360 + {
1349 1361
1350 - $settings = $this->get_settings_for_display();
1362 + $settings = $this->get_settings_for_display();
1351 1363
1352 - $icon_type = $settings['icon_type'];
1353 - $num_tag = $settings['counter_html_tag'];
1354 - $txt_tag = $settings['content_html_tag'];
1355 - $prefix = $settings['counter_prefix'];
1356 - $suffix = $settings['counter_suffix'];
1357 - $media = $settings['show_icon'] ? true : false; // Check if media is enabled,
1364 + $icon_type = $settings['icon_type'];
1365 + $num_tag = $settings['counter_html_tag'];
1366 + $txt_tag = $settings['content_html_tag'];
1367 + $prefix = $settings['counter_prefix'];
1368 + $suffix = $settings['counter_suffix'];
1369 + $media = $settings['show_icon'] ? true : false; // Check if media is enabled,
1358 1370
1359 - if ($media) {
1360 - switch($icon_type){
1361 - case 'icon' : $icon = $settings['selected_icon']; break;
1362 - case 'image' : $icon = $settings['image']; break;
1363 - }
1364 - $icon_width = ($icon_type == 'image' && $settings['image_fullwidth'] == 'true') ? esc_attr('large') : esc_attr('thumbnail');
1365 - }
1371 + if ($media) {
1372 + switch ($icon_type) {
1373 + case 'icon':
1374 + $icon = $settings['selected_icon'];
1375 + break;
1376 + case 'image':
1377 + $icon = $settings['image'];
1378 + break;
1379 + }
1380 + $icon_width = ($icon_type === 'image' && $this->is_option('image_fullwidth', 'true'))
1381 + ? esc_attr('large')
1382 + : esc_attr('thumbnail');
1383 + }
1366 1384
1367 - $stack = $settings['counter_text_inline'] ? false : true; // If text inline, no stack wrapper between elements is needed
1368 - $title = !empty($settings['content_text']) ?
1369 - '<' . esc_html($txt_tag) . ' class="ui-e-title">' . wp_kses_data($settings['content_text']) . '</' . esc_html($txt_tag) . '>' :
1370 - "<!-- no title -->";
1371 - $html = '<' . esc_html($num_tag) . ' class="ui-e-num">';
1385 + $stack = $settings['counter_text_inline'] ? false : true; // If text inline, no stack wrapper between elements is needed
1386 + $title = !empty($settings['content_text']) ?
1387 + '<' . Helper::esc_tag($txt_tag) . ' class="ui-e-title">' . wp_kses_data($settings['content_text']) . '</' . esc_html($txt_tag) . '>' :
1388 + "<!-- no title -->";
1389 + $html = '<' . Helper::esc_tag($num_tag) . ' class="ui-e-num">';
1372 1390
1373 1391 // Motion animation markup
1374 - if ($settings['counter_animation'] == 'motion'){
1375 - $value = $settings['count_number'];
1376 - $numbers = str_split($value);
1392 + if ($settings['counter_animation'] == 'motion') {
1393 + $value = $settings['count_number'];
1394 + $numbers = str_split($value);
1377 1395
1378 - foreach ($numbers as $n => $value) {
1396 + foreach ($numbers as $n => $value) {
1379 1397 $index = 'style="--index:' . $n . '"';
1380 1398
1381 1399 // prefix
1382 - if ( $n === 0 && !empty($prefix) ) {
1400 + if ($n === 0 && !empty($prefix)) {
1383 1401 $html .= '<span class="ui-e-prefix" ' . $index . '>' . esc_html($prefix) . '</span>';
1384 1402 }
1385 1403
1386 1404 // number
1387 - $html .= '<span ' . $index . '>' . esc_html($value). ' </span>';
1405 + $html .= '<span ' . $index . '>' . esc_html($value) . ' </span>';
1388 1406
1389 1407 // suffix
1390 1408 if ($n === count($numbers) - 1 && !empty($suffix)) {
1391 1409 $html .= '<span class="ui-e-suffix" ' . $index . '>' . esc_html($suffix) . '</span>';
1392 1410 }
1393 - }
1411 + }
1394 1412
1395 - // Default markup
1396 - }else{
1413 + // Default markup
1414 + } else {
1397 1415 $html .= '<span class="ui-e-prefix">' . $prefix . '</span>';
1398 - $html .= '<span class="value"> 0 </span>';
1416 + $html .= '<span class="value"> 0 </span>';
1399 1417 $html .= $settings['animate_suffix'] == 'true' ? '' : '<span class="ui-e-suffix">' . $suffix . '</span>'; // Suffix might be animated by Odometer animation
1400 - }
1418 + }
1401 1419
1402 - $html .= '</' . esc_html($num_tag) . '>';
1420 + $html .= '</' . esc_html($num_tag) . '>';
1403 1421
1404 - // Build the widget HTML
1405 - if($media) : ?>
1406 - <div class="ui-e-ico">
1407 - <div class="ui-e-offset">
1408 - <?php if($icon_type == 'icon') {
1409 - Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] );
1410 - } else {
1411 - echo wp_get_attachment_image( $icon['id'], $icon_width );
1412 - } ?>
1413 - </div>
1414 - </div>
1415 - <?php endif;
1422 + // Build the widget HTML
1423 + if ($media) : ?>
1424 + <div class="ui-e-ico">
1425 + <div class="ui-e-offset">
1426 + <?php if ($icon_type === 'icon') {
1427 + Icons_Manager::render_icon($icon, ['aria-hidden' => 'true']);
1428 + } else {
1429 + echo wp_get_attachment_image($icon['id'], $icon_width);
1430 + } ?>
1431 + </div>
1432 + </div>
1433 + <?php endif;
1416 1434
1417 - if($stack) {
1418 - ?> <div class="ui-e-wrp"> <?php
1419 - }
1420 - echo wp_kses_post($html . $title);
1421 - if($stack) {
1422 - ?> </div> <?php
1423 - }
1424 - }
1425 -
1426 -}
1427 -\Elementor\Plugin::instance()->widgets_manager->register(new Counter());
1435 + if ($stack) {
1436 + ?> <div class="ui-e-wrp"> <?php
1437 + }
1438 + echo wp_kses_post($html . $title);
1439 + if ($stack) {
1440 + ?> </div> <?php
1441 + }
1442 + }
1443 + }
1444 + \Elementor\Plugin::instance()->widgets_manager->register(new Counter());