@gravityforms/components 6.2.0 → 6.2.2
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/css/admin/kanban.css +12 -7
- package/css/admin/repeater.css +240 -101
- package/dist/css/admin/kanban.css +20 -7
- package/dist/css/admin/kanban.css.map +1 -1
- package/dist/css/admin/repeater.css +227 -89
- package/dist/css/admin/repeater.css.map +1 -1
- package/dist/js/968.9c3fa3386ebd16656f1d.min.js +1 -0
- package/dist/js/admin-components.asset.php +1 -1
- package/dist/js/admin-components.js +43 -43
- package/dist/js/admin-components.min.asset.php +1 -1
- package/dist/js/admin-components.min.js +1 -1
- package/dist/js/components_react_admin_modules_Chart_AreaChart_index_js.9435f12f3e93d5d6b1b5.js +1 -1
- package/dist/js/components_react_admin_modules_Phone_PhoneComponent_js.ca87da6c1ccaf970cf6d.js +1 -1
- package/dist/js/vendors-node_modules_libphonenumber-js_examples_mobile_json_js-node_modules_libphonenumber-js-a6c76f.b0815a9e2e1e5cfbd5db.js +2 -2
- package/dist/js/{vendors-node_modules_recharts_es6_cartesian_CartesianGrid_js-node_modules_recharts_es6_chart_-d9f675.b98474c20a2c3508fc94.js → vendors-node_modules_recharts_es6_cartesian_CartesianGrid_js-node_modules_recharts_es6_chart_-d9f675.846956e222cf4f63a114.js} +243 -243
- package/dist/mappings/admin.js +50 -50
- package/package.json +2 -2
- package/react/admin/modules/Repeater/RepeaterItem.js +82 -64
- package/react/admin/modules/Repeater/index.js +4 -0
- package/react/admin/modules/Repeater/use-repeater-state.js +3 -3
- package/dist/js/968.f427e8d56e0fd9cca5a8.min.js +0 -1
- /package/dist/js/{653.c5a3f4ea5996f84cb182.min.js → 653.61e7ebba89a62bd48408.min.js} +0 -0
- /package/dist/js/{881.9cb8ff2be86b51fa386c.min.js → 881.a04b7065f7b02b55f8bd.min.js} +0 -0
- /package/dist/js/{91.5577381a87a6ada339c1.min.js → 91.d1d4dd50cbd0b889c78b.min.js} +0 -0
package/dist/mappings/admin.js
CHANGED
|
@@ -20,14 +20,6 @@ module.exports = [
|
|
|
20
20
|
"importPath": "html/admin/modules/",
|
|
21
21
|
"externalPath": "components.admin.html.modules"
|
|
22
22
|
},
|
|
23
|
-
{
|
|
24
|
-
"defaultExport": "Textarea",
|
|
25
|
-
"namedExports": [
|
|
26
|
-
"textareaTemplate"
|
|
27
|
-
],
|
|
28
|
-
"importPath": "html/admin/elements/",
|
|
29
|
-
"externalPath": "components.admin.html.elements"
|
|
30
|
-
},
|
|
31
23
|
{
|
|
32
24
|
"defaultExport": "Text",
|
|
33
25
|
"namedExports": [
|
|
@@ -36,14 +28,6 @@ module.exports = [
|
|
|
36
28
|
"importPath": "html/admin/elements/",
|
|
37
29
|
"externalPath": "components.admin.html.elements"
|
|
38
30
|
},
|
|
39
|
-
{
|
|
40
|
-
"defaultExport": "Toggle",
|
|
41
|
-
"namedExports": [
|
|
42
|
-
"toggleTemplate"
|
|
43
|
-
],
|
|
44
|
-
"importPath": "html/admin/elements/",
|
|
45
|
-
"externalPath": "components.admin.html.elements"
|
|
46
|
-
},
|
|
47
31
|
{
|
|
48
32
|
"defaultExport": "StatusIndicator",
|
|
49
33
|
"namedExports": [
|
|
@@ -108,6 +92,22 @@ module.exports = [
|
|
|
108
92
|
"importPath": "html/admin/elements/",
|
|
109
93
|
"externalPath": "components.admin.html.elements"
|
|
110
94
|
},
|
|
95
|
+
{
|
|
96
|
+
"defaultExport": "Textarea",
|
|
97
|
+
"namedExports": [
|
|
98
|
+
"textareaTemplate"
|
|
99
|
+
],
|
|
100
|
+
"importPath": "html/admin/elements/",
|
|
101
|
+
"externalPath": "components.admin.html.elements"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"defaultExport": "Toggle",
|
|
105
|
+
"namedExports": [
|
|
106
|
+
"toggleTemplate"
|
|
107
|
+
],
|
|
108
|
+
"importPath": "html/admin/elements/",
|
|
109
|
+
"externalPath": "components.admin.html.elements"
|
|
110
|
+
},
|
|
111
111
|
{
|
|
112
112
|
"defaultExport": "Heading",
|
|
113
113
|
"namedExports": [
|
|
@@ -181,12 +181,12 @@ module.exports = [
|
|
|
181
181
|
"externalPath": "components.admin.react.modules"
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
|
-
"defaultExport": "
|
|
184
|
+
"defaultExport": "Phone",
|
|
185
185
|
"importPath": "react/admin/modules/",
|
|
186
186
|
"externalPath": "components.admin.react.modules"
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
"defaultExport": "
|
|
189
|
+
"defaultExport": "Pagination",
|
|
190
190
|
"importPath": "react/admin/modules/",
|
|
191
191
|
"externalPath": "components.admin.react.modules"
|
|
192
192
|
},
|
|
@@ -255,6 +255,11 @@ module.exports = [
|
|
|
255
255
|
"importPath": "react/admin/modules/",
|
|
256
256
|
"externalPath": "components.admin.react.modules"
|
|
257
257
|
},
|
|
258
|
+
{
|
|
259
|
+
"defaultExport": "DataGrid",
|
|
260
|
+
"importPath": "react/admin/modules/",
|
|
261
|
+
"externalPath": "components.admin.react.modules"
|
|
262
|
+
},
|
|
258
263
|
{
|
|
259
264
|
"defaultExport": "ColorPicker",
|
|
260
265
|
"importPath": "react/admin/modules/",
|
|
@@ -285,18 +290,13 @@ module.exports = [
|
|
|
285
290
|
"importPath": "react/admin/modules/",
|
|
286
291
|
"externalPath": "components.admin.react.modules"
|
|
287
292
|
},
|
|
288
|
-
{
|
|
289
|
-
"defaultExport": "Alert",
|
|
290
|
-
"importPath": "react/admin/modules/",
|
|
291
|
-
"externalPath": "components.admin.react.modules"
|
|
292
|
-
},
|
|
293
293
|
{
|
|
294
294
|
"defaultExport": "Address",
|
|
295
295
|
"importPath": "react/admin/modules/",
|
|
296
296
|
"externalPath": "components.admin.react.modules"
|
|
297
297
|
},
|
|
298
298
|
{
|
|
299
|
-
"defaultExport": "
|
|
299
|
+
"defaultExport": "Alert",
|
|
300
300
|
"importPath": "react/admin/modules/",
|
|
301
301
|
"externalPath": "components.admin.react.modules"
|
|
302
302
|
},
|
|
@@ -336,7 +336,7 @@ module.exports = [
|
|
|
336
336
|
"externalPath": "components.admin.react.elements"
|
|
337
337
|
},
|
|
338
338
|
{
|
|
339
|
-
"defaultExport": "
|
|
339
|
+
"defaultExport": "Pill",
|
|
340
340
|
"importPath": "react/admin/elements/",
|
|
341
341
|
"externalPath": "components.admin.react.elements"
|
|
342
342
|
},
|
|
@@ -346,7 +346,7 @@ module.exports = [
|
|
|
346
346
|
"externalPath": "components.admin.react.elements"
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
|
-
"defaultExport": "
|
|
349
|
+
"defaultExport": "Radio",
|
|
350
350
|
"importPath": "react/admin/elements/",
|
|
351
351
|
"externalPath": "components.admin.react.elements"
|
|
352
352
|
},
|
|
@@ -438,6 +438,16 @@ module.exports = [
|
|
|
438
438
|
"importPath": "react/admin/modules/Loaders/",
|
|
439
439
|
"externalPath": "components.admin.react.modules"
|
|
440
440
|
},
|
|
441
|
+
{
|
|
442
|
+
"defaultExport": "RightSidebar",
|
|
443
|
+
"importPath": "react/admin/modules/Layouts/",
|
|
444
|
+
"externalPath": "components.admin.react.modules"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"defaultExport": "ModularSidebar",
|
|
448
|
+
"importPath": "react/admin/modules/Layouts/",
|
|
449
|
+
"externalPath": "components.admin.react.modules"
|
|
450
|
+
},
|
|
441
451
|
{
|
|
442
452
|
"defaultExport": "IconIndicator",
|
|
443
453
|
"importPath": "react/admin/modules/Indicators/",
|
|
@@ -473,16 +483,6 @@ module.exports = [
|
|
|
473
483
|
"importPath": "react/admin/modules/Cards/",
|
|
474
484
|
"externalPath": "components.admin.react.modules"
|
|
475
485
|
},
|
|
476
|
-
{
|
|
477
|
-
"defaultExport": "ModularSidebar",
|
|
478
|
-
"importPath": "react/admin/modules/Layouts/",
|
|
479
|
-
"externalPath": "components.admin.react.modules"
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
"defaultExport": "RightSidebar",
|
|
483
|
-
"importPath": "react/admin/modules/Layouts/",
|
|
484
|
-
"externalPath": "components.admin.react.modules"
|
|
485
|
-
},
|
|
486
486
|
{
|
|
487
487
|
"defaultExport": "ZohoLogo",
|
|
488
488
|
"importPath": "react/admin/elements/Svgs/",
|
|
@@ -493,6 +493,11 @@ module.exports = [
|
|
|
493
493
|
"importPath": "react/admin/elements/Svgs/",
|
|
494
494
|
"externalPath": "components.admin.react.elements"
|
|
495
495
|
},
|
|
496
|
+
{
|
|
497
|
+
"defaultExport": "WordPressLogo",
|
|
498
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
499
|
+
"externalPath": "components.admin.react.elements"
|
|
500
|
+
},
|
|
496
501
|
{
|
|
497
502
|
"defaultExport": "WhatsAppLogo",
|
|
498
503
|
"importPath": "react/admin/elements/Svgs/",
|
|
@@ -509,12 +514,12 @@ module.exports = [
|
|
|
509
514
|
"externalPath": "components.admin.react.elements"
|
|
510
515
|
},
|
|
511
516
|
{
|
|
512
|
-
"defaultExport": "
|
|
517
|
+
"defaultExport": "SparkPostLogo",
|
|
513
518
|
"importPath": "react/admin/elements/Svgs/",
|
|
514
519
|
"externalPath": "components.admin.react.elements"
|
|
515
520
|
},
|
|
516
521
|
{
|
|
517
|
-
"defaultExport": "
|
|
522
|
+
"defaultExport": "TelegramLogo",
|
|
518
523
|
"importPath": "react/admin/elements/Svgs/",
|
|
519
524
|
"externalPath": "components.admin.react.elements"
|
|
520
525
|
},
|
|
@@ -524,12 +529,12 @@ module.exports = [
|
|
|
524
529
|
"externalPath": "components.admin.react.elements"
|
|
525
530
|
},
|
|
526
531
|
{
|
|
527
|
-
"defaultExport": "
|
|
532
|
+
"defaultExport": "SendGridLogo",
|
|
528
533
|
"importPath": "react/admin/elements/Svgs/",
|
|
529
534
|
"externalPath": "components.admin.react.elements"
|
|
530
535
|
},
|
|
531
536
|
{
|
|
532
|
-
"defaultExport": "
|
|
537
|
+
"defaultExport": "SlackLogo",
|
|
533
538
|
"importPath": "react/admin/elements/Svgs/",
|
|
534
539
|
"externalPath": "components.admin.react.elements"
|
|
535
540
|
},
|
|
@@ -599,12 +604,12 @@ module.exports = [
|
|
|
599
604
|
"externalPath": "components.admin.react.elements"
|
|
600
605
|
},
|
|
601
606
|
{
|
|
602
|
-
"defaultExport": "
|
|
607
|
+
"defaultExport": "MandrillLogo",
|
|
603
608
|
"importPath": "react/admin/elements/Svgs/",
|
|
604
609
|
"externalPath": "components.admin.react.elements"
|
|
605
610
|
},
|
|
606
611
|
{
|
|
607
|
-
"defaultExport": "
|
|
612
|
+
"defaultExport": "MicrosoftAltLogo",
|
|
608
613
|
"importPath": "react/admin/elements/Svgs/",
|
|
609
614
|
"externalPath": "components.admin.react.elements"
|
|
610
615
|
},
|
|
@@ -619,12 +624,12 @@ module.exports = [
|
|
|
619
624
|
"externalPath": "components.admin.react.elements"
|
|
620
625
|
},
|
|
621
626
|
{
|
|
622
|
-
"defaultExport": "
|
|
627
|
+
"defaultExport": "MailgunFullLogo",
|
|
623
628
|
"importPath": "react/admin/elements/Svgs/",
|
|
624
629
|
"externalPath": "components.admin.react.elements"
|
|
625
630
|
},
|
|
626
631
|
{
|
|
627
|
-
"defaultExport": "
|
|
632
|
+
"defaultExport": "MailgunLogo",
|
|
628
633
|
"importPath": "react/admin/elements/Svgs/",
|
|
629
634
|
"externalPath": "components.admin.react.elements"
|
|
630
635
|
},
|
|
@@ -663,11 +668,6 @@ module.exports = [
|
|
|
663
668
|
"importPath": "react/admin/elements/Svgs/",
|
|
664
669
|
"externalPath": "components.admin.react.elements"
|
|
665
670
|
},
|
|
666
|
-
{
|
|
667
|
-
"defaultExport": "MailFailed",
|
|
668
|
-
"importPath": "react/admin/elements/Svgs/",
|
|
669
|
-
"externalPath": "components.admin.react.elements"
|
|
670
|
-
},
|
|
671
671
|
{
|
|
672
672
|
"defaultExport": "GravitySMTPTextLogo",
|
|
673
673
|
"importPath": "react/admin/elements/Svgs/",
|
|
@@ -779,7 +779,7 @@ module.exports = [
|
|
|
779
779
|
"externalPath": "components.admin.react.elements"
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
|
-
"defaultExport": "
|
|
782
|
+
"defaultExport": "MailFailed",
|
|
783
783
|
"importPath": "react/admin/elements/Svgs/",
|
|
784
784
|
"externalPath": "components.admin.react.elements"
|
|
785
785
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravityforms/components",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.2",
|
|
4
4
|
"description": "UI components for use in Gravity Forms development. Both React and vanilla js flavors.",
|
|
5
5
|
"author": "Rocketgenius",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.26.0",
|
|
33
|
-
"@gravityforms/components": "^6.2.
|
|
33
|
+
"@gravityforms/components": "^6.2.2",
|
|
34
34
|
"@gravityforms/libraries": "^6.0.0",
|
|
35
35
|
"@gravityforms/react-utils": "^5.1.7",
|
|
36
36
|
"@gravityforms/request": "^6.1.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { React, ReactDND, PropTypes, classnames } from '@gravityforms/libraries';
|
|
2
|
-
import { ConditionalWrapper } from '@gravityforms/react-utils';
|
|
3
2
|
import { spacerClasses, sprintf } from '@gravityforms/utils';
|
|
4
|
-
import { UP, DOWN,
|
|
3
|
+
import { UP, DOWN, INLINE } from './constants';
|
|
5
4
|
import { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, TAB } from '../../utils/keymap';
|
|
6
5
|
import itemTypes from './item-types';
|
|
7
6
|
import Button from '../../elements/Button';
|
|
@@ -58,6 +57,7 @@ const RepeaterItem = ( {
|
|
|
58
57
|
speak = () => {},
|
|
59
58
|
style = 'regular',
|
|
60
59
|
type = INLINE,
|
|
60
|
+
useBlockLayoutOnMobile = true,
|
|
61
61
|
upButtonAttributes = {},
|
|
62
62
|
upButtonClasses = [],
|
|
63
63
|
} ) => {
|
|
@@ -274,7 +274,7 @@ const RepeaterItem = ( {
|
|
|
274
274
|
};
|
|
275
275
|
|
|
276
276
|
const blockHeaderProps = {
|
|
277
|
-
|
|
277
|
+
customClasses: classnames( [
|
|
278
278
|
'gform-repeater-item__block-header',
|
|
279
279
|
], blockHeaderClasses ),
|
|
280
280
|
size: 'text-sm',
|
|
@@ -290,14 +290,16 @@ const RepeaterItem = ( {
|
|
|
290
290
|
buttonType = 'icon-white';
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
const renderActionButtons = () => {
|
|
293
|
+
const renderActionButtons = ( context = 'block' ) => {
|
|
294
|
+
const actionButtonType = context === 'block' ? 'white' : buttonType;
|
|
295
|
+
const size = context === 'block' ? 'size-height-m' : inlineButtonSize;
|
|
294
296
|
return actionButtons.length ? actionButtons.map( ( button, idx ) => {
|
|
295
297
|
const { icon, label, onClick, ...rest } = button;
|
|
296
298
|
return (
|
|
297
299
|
<Button
|
|
298
300
|
key={ `action-button-${ idx }` }
|
|
299
|
-
size={
|
|
300
|
-
type={
|
|
301
|
+
size={ size }
|
|
302
|
+
type={ actionButtonType }
|
|
301
303
|
icon={ icon }
|
|
302
304
|
iconPosition="leading"
|
|
303
305
|
iconPrefix="gravity-component-icon"
|
|
@@ -316,42 +318,52 @@ const RepeaterItem = ( {
|
|
|
316
318
|
} ) : null;
|
|
317
319
|
};
|
|
318
320
|
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
321
|
+
const renderDeleteButton = ( context = 'block' ) => {
|
|
322
|
+
const deleteButtonType = context === 'block' ? 'white' : buttonType;
|
|
323
|
+
const size = context === 'block' ? 'size-height-m' : inlineButtonSize;
|
|
324
|
+
const deleteButtonProps = {
|
|
325
|
+
size,
|
|
326
|
+
type: deleteButtonType,
|
|
327
|
+
icon: 'trash',
|
|
328
|
+
iconPosition: 'leading',
|
|
329
|
+
iconPrefix: 'gravity-component-icon',
|
|
330
|
+
label: i18n.deleteLabel,
|
|
331
|
+
onClick: handleDelete,
|
|
332
|
+
disabled: minItems > 0 && itemCount <= minItems,
|
|
333
|
+
customAttributes: {
|
|
334
|
+
type: 'button',
|
|
335
|
+
},
|
|
336
|
+
customClasses: classnames( [
|
|
337
|
+
'gform-repeater-item__delete',
|
|
338
|
+
'gform-repeater-item__action-control',
|
|
339
|
+
], deleteButtonClasses ),
|
|
340
|
+
...deleteButtonAttributes,
|
|
341
|
+
};
|
|
342
|
+
return <Button { ...deleteButtonProps } />;
|
|
336
343
|
};
|
|
337
344
|
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
345
|
+
const renderAddButton = ( context = 'block' ) => {
|
|
346
|
+
const addButtonType = context === 'block' ? 'white' : buttonType;
|
|
347
|
+
const size = context === 'block' ? 'size-height-m' : inlineButtonSize;
|
|
348
|
+
const addButtonProps = {
|
|
349
|
+
size,
|
|
350
|
+
type: addButtonType,
|
|
351
|
+
icon: 'plus-regular',
|
|
352
|
+
iconAttributes: addButtonAttributes?.iconAttributes || {},
|
|
353
|
+
iconPosition: 'leading',
|
|
354
|
+
iconPrefix: 'gravity-component-icon',
|
|
355
|
+
label: i18n.addLabel,
|
|
356
|
+
onClick: addItem,
|
|
357
|
+
disabled: !! ( maxItems && itemCount >= maxItems ) || addButtonAttributes?.disabled,
|
|
358
|
+
customAttributes: {
|
|
359
|
+
type: 'button',
|
|
360
|
+
},
|
|
361
|
+
customClasses: classnames( [
|
|
362
|
+
'gform-repeater-item__add',
|
|
363
|
+
'gform-repeater-item__action-control',
|
|
364
|
+
], addButtonClasses ),
|
|
365
|
+
};
|
|
366
|
+
return <Button { ...addButtonProps } />;
|
|
355
367
|
};
|
|
356
368
|
|
|
357
369
|
const collapsibleButtonProps = {
|
|
@@ -374,7 +386,6 @@ const RepeaterItem = ( {
|
|
|
374
386
|
};
|
|
375
387
|
|
|
376
388
|
const blockContentProps = {
|
|
377
|
-
'aria-hidden': isCollapsed,
|
|
378
389
|
'aria-labelledby': `${ id }-collapsible-button`,
|
|
379
390
|
className: 'gform-repeater-item__block-content',
|
|
380
391
|
id: `${ id }-block-content`,
|
|
@@ -386,16 +397,18 @@ const RepeaterItem = ( {
|
|
|
386
397
|
'gform-repeater-item': true,
|
|
387
398
|
[ `gform-repeater-item--style-${ style }` ]: true,
|
|
388
399
|
[ `gform-repeater-item--type-${ type }` ]: type,
|
|
389
|
-
'gform-repeater-item--show-actions-on-hover': showActionsOnHover,
|
|
400
|
+
'gform-repeater-item--show-actions-on-hover': type === INLINE && showActionsOnHover,
|
|
390
401
|
'gform-repeater-item--has-arrows': showArrows && isSortable,
|
|
391
402
|
'gform-repeater-item--has-drag-handle': showDragHandle && isDraggable && isSortable,
|
|
392
403
|
'gform-repeater-item--is-draggable': isDraggable && isSortable,
|
|
393
404
|
'gform-repeater-item--is-sortable': isSortable,
|
|
405
|
+
'gform-repeater-item--is-collapsible': collapsible,
|
|
394
406
|
'gform-repeater-item--is-collapsed': isCollapsed,
|
|
395
407
|
'gform-repeater-item--is-dragging': isDragging,
|
|
396
408
|
'gform-repeater-item--fill-content': fillContent,
|
|
397
409
|
'gform-repeater-item--disable-item-drag': ! itemDraggable,
|
|
398
410
|
'gform-repeater-item--is-keyboard-nav': keyboardDragActive,
|
|
411
|
+
'gform-repeater-item--use-inline-layout-mobile': type === INLINE && ! useBlockLayoutOnMobile,
|
|
399
412
|
...spacerClasses( itemSpacing ),
|
|
400
413
|
}, itemClasses ),
|
|
401
414
|
'data-index': index,
|
|
@@ -404,32 +417,37 @@ const RepeaterItem = ( {
|
|
|
404
417
|
...itemAttributes,
|
|
405
418
|
};
|
|
406
419
|
|
|
420
|
+
const useBlockLayout = type === 'block' || ( type === INLINE && useBlockLayoutOnMobile );
|
|
421
|
+
const noControls = ( ! showArrows && ( ! showDragHandle || ! isDraggable ) ) || ! isSortable;
|
|
422
|
+
|
|
407
423
|
return (
|
|
408
424
|
<div { ...componentProps } ref={ ref }>
|
|
409
|
-
|
|
410
|
-
{
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
{ showAdd && type === INLINE && <Button { ...addButtonProps } /> }
|
|
420
|
-
{ showActions && type === INLINE && renderActionButtons() }
|
|
421
|
-
{ showDelete && type === INLINE && <Button { ...deleteButtonProps } /> }
|
|
422
|
-
</ConditionalWrapper>
|
|
423
|
-
{ collapsible && type === BLOCK && <Button { ...collapsibleButtonProps } /> }
|
|
424
|
-
</div>
|
|
425
|
-
{ type === BLOCK && (
|
|
425
|
+
{ ( ! noControls || useBlockLayout ) && (
|
|
426
|
+
<div { ...itemWrapperProps }>
|
|
427
|
+
{ renderControls() }
|
|
428
|
+
{ useBlockLayout && blockContentTitle && (
|
|
429
|
+
<Text { ...blockHeaderProps }>{ blockContentTitle }</Text>
|
|
430
|
+
) }
|
|
431
|
+
{ useBlockLayout && collapsible && <Button { ...collapsibleButtonProps } /> }
|
|
432
|
+
</div>
|
|
433
|
+
) }
|
|
434
|
+
{ (
|
|
426
435
|
<div { ...blockContentProps }>
|
|
427
436
|
{ children }
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
437
|
+
{ ( showAdd || showActions || showDelete ) && type === INLINE && (
|
|
438
|
+
<div className="gform-repeater-item__minimal-actions">
|
|
439
|
+
{ showAdd && renderAddButton( 'inline' ) }
|
|
440
|
+
{ showActions && renderActionButtons( 'inline' ) }
|
|
441
|
+
{ showDelete && renderDeleteButton( 'inline' ) }
|
|
442
|
+
</div>
|
|
443
|
+
) }
|
|
444
|
+
{ useBlockLayout && (
|
|
445
|
+
<div className="gform-repeater-item__block-content-footer">
|
|
446
|
+
{ showAdd && inlineAdd && renderAddButton( 'block' ) }
|
|
447
|
+
{ showActions && renderActionButtons( 'block' ) }
|
|
448
|
+
{ showDelete && renderDeleteButton( 'block' ) }
|
|
449
|
+
</div>
|
|
450
|
+
) }
|
|
433
451
|
</div>
|
|
434
452
|
) }
|
|
435
453
|
</div>
|
|
@@ -60,6 +60,7 @@ const { useState } = React;
|
|
|
60
60
|
* @param {string|number|Array|object} props.spacing The spacing for the component, as a string, number, array, or object.
|
|
61
61
|
* @param {string} props.style The style of the repeater.
|
|
62
62
|
* @param {string} props.type The type of the repeater.
|
|
63
|
+
* @param {boolean} props.useBlockOnSmallScreen If the block type styles should be used for inline type repeaters on small screens.
|
|
63
64
|
* @param {object} props.upButtonAttributes Custom attributes for the up button.
|
|
64
65
|
* @param {string|Array|object} props.upButtonClasses Custom classes for the up button.
|
|
65
66
|
*
|
|
@@ -124,6 +125,7 @@ const Repeater = ( {
|
|
|
124
125
|
spacing = '',
|
|
125
126
|
style = 'regular',
|
|
126
127
|
type = INLINE,
|
|
128
|
+
useBlockLayoutOnMobile = false,
|
|
127
129
|
upButtonAttributes = {},
|
|
128
130
|
upButtonClasses = [],
|
|
129
131
|
} ) => {
|
|
@@ -300,6 +302,7 @@ const Repeater = ( {
|
|
|
300
302
|
speak={ setScreenReaderText }
|
|
301
303
|
style={ style }
|
|
302
304
|
type={ type }
|
|
305
|
+
useBlockLayoutOnMobile={ useBlockLayoutOnMobile }
|
|
303
306
|
upButtonAttributes={ upButtonAttributes }
|
|
304
307
|
upButtonClasses={ upButtonClasses }
|
|
305
308
|
>
|
|
@@ -406,6 +409,7 @@ Repeater.propTypes = {
|
|
|
406
409
|
] ),
|
|
407
410
|
style: PropTypes.string,
|
|
408
411
|
type: PropTypes.oneOf( [ BLOCK, INLINE ] ),
|
|
412
|
+
useBlockLayoutOnMobile: PropTypes.bool,
|
|
409
413
|
upButtonAttributes: PropTypes.object,
|
|
410
414
|
upButtonClasses: PropTypes.oneOfType( [
|
|
411
415
|
PropTypes.element,
|
|
@@ -9,7 +9,7 @@ const resolvePath = ( path, base = window ) => {
|
|
|
9
9
|
return path.split( '.' ).reduce( ( acc, part ) => acc && acc[ part ], base );
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const useRepeaterState = ( initialStateOrPath, syncWithWindow = false, titleKey = '',
|
|
12
|
+
const useRepeaterState = ( initialStateOrPath, syncWithWindow = false, titleKey = '', titlePrefix = '' ) => {
|
|
13
13
|
const isPath = typeof initialStateOrPath === 'string';
|
|
14
14
|
const initialState = isPath ? deepClone( resolvePath( initialStateOrPath ) || [] ) : deepClone( initialStateOrPath );
|
|
15
15
|
const [ items, setItems ] = useState( initialState );
|
|
@@ -37,14 +37,14 @@ const useRepeaterState = ( initialStateOrPath, syncWithWindow = false, titleKey
|
|
|
37
37
|
[ key ]: value,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
if ( titleKey &&
|
|
40
|
+
if ( titleKey && key === titleKey ) {
|
|
41
41
|
updatedItems[ index ].repeater_item_block_content_title = titlePrefix ? sprintf( titlePrefix, value ) : value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
updateExternalState( updatedItems );
|
|
45
45
|
return updatedItems;
|
|
46
46
|
} );
|
|
47
|
-
}, [
|
|
47
|
+
}, [ titleKey, titlePrefix, syncWithWindow, initialStateOrPath ] );
|
|
48
48
|
|
|
49
49
|
return { items, handleChange, onChange };
|
|
50
50
|
};
|