@decisiv/ui-components 2.0.1-alpha.226 → 2.0.1-alpha.227
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/lib/components/Wizard/index.d.ts +2 -1
- package/lib/components/Wizard/index.d.ts.map +1 -1
- package/lib/components/Wizard/index.js +6 -4
- package/lib/components/Wizard/index.test.js +236 -16
- package/lib/components/Wizard/schema.d.ts.map +1 -1
- package/lib/components/Wizard/schema.js +4 -1
- package/package.json +1 -1
|
@@ -14,7 +14,8 @@ export interface WizardProps extends Pick<ModalProps, 'id' | 'visible' | 'zIndex
|
|
|
14
14
|
steps: Step[];
|
|
15
15
|
activeStep: number;
|
|
16
16
|
submitButtonProps?: ButtonProps;
|
|
17
|
-
|
|
17
|
+
cancelButtonProps?: ButtonProps;
|
|
18
|
+
onCancel?: ModalProps['onClose'];
|
|
18
19
|
renderActions?: (context: {
|
|
19
20
|
step: Step;
|
|
20
21
|
stepIndex: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Wizard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAO1D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAa5C,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC/B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Wizard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAO1D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAa5C,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC/B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;QACxB,IAAI,EAAE,IAAI,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;QACpB,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC;KACjC,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AA8ID,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,eAQ1D;kBARQ,YAAY;;;;AAiBrB,eAAe,YAAY,CAAC"}
|
|
@@ -61,6 +61,7 @@ var Wizard = function Wizard(_ref) {
|
|
|
61
61
|
wizardTitle = _ref.title,
|
|
62
62
|
currentStepNumber = _ref.activeStep,
|
|
63
63
|
submitButtonProps = _ref.submitButtonProps,
|
|
64
|
+
cancelButtonProps = _ref.cancelButtonProps,
|
|
64
65
|
_ref$size = _ref.size,
|
|
65
66
|
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
66
67
|
steps = _ref.steps,
|
|
@@ -103,13 +104,14 @@ var Wizard = function Wizard(_ref) {
|
|
|
103
104
|
text: translate('Back', 'wizard.actions.back'),
|
|
104
105
|
kind: "secondary",
|
|
105
106
|
icon: _ArrowLeft.default
|
|
106
|
-
}, previousButtonProps))), _react.default.createElement(_.Button, {
|
|
107
|
+
}, previousButtonProps))), (onCancel || cancelButtonProps) && _react.default.createElement(_.Button, _extends({
|
|
107
108
|
text: translate('Cancel', 'wizard.actions.cancel'),
|
|
108
109
|
kind: "secondary",
|
|
109
110
|
variant: "ghost",
|
|
110
|
-
onClick: onCancel
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
onClick: onCancel,
|
|
112
|
+
disabled: cancelButtonProps ? !cancelButtonProps.onClick : !onCancel
|
|
113
|
+
}, cancelButtonProps)));
|
|
114
|
+
}, [breakpoint, showSubmit, translate, submitButtonProps, showNext, nextButtonProps, showPrevious, previousButtonProps, onCancel, cancelButtonProps]);
|
|
113
115
|
return _react.default.createElement(_ResponsiveModalWrapper.default, {
|
|
114
116
|
id: id,
|
|
115
117
|
size: sizeMapping[size],
|
|
@@ -59,6 +59,9 @@ describe('Wizard', function () {
|
|
|
59
59
|
title: "Wizard Title",
|
|
60
60
|
visible: true,
|
|
61
61
|
activeStep: 1,
|
|
62
|
+
onCancel: function onCancel() {
|
|
63
|
+
return null;
|
|
64
|
+
},
|
|
62
65
|
submitButtonProps: {
|
|
63
66
|
onClick: function onClick() {
|
|
64
67
|
return null;
|
|
@@ -395,6 +398,223 @@ describe('Wizard', function () {
|
|
|
395
398
|
expect(onCancelMock).toHaveBeenCalled();
|
|
396
399
|
});
|
|
397
400
|
});
|
|
401
|
+
describe('cancelButtonProps', function () {
|
|
402
|
+
var steps = [{
|
|
403
|
+
title: 'First Step',
|
|
404
|
+
content: _react.default.createElement(StepContent, {
|
|
405
|
+
text: "Step 1 Content"
|
|
406
|
+
})
|
|
407
|
+
}, {
|
|
408
|
+
title: 'Second Step',
|
|
409
|
+
content: _react.default.createElement(StepContent, {
|
|
410
|
+
text: "Step 2 Content"
|
|
411
|
+
})
|
|
412
|
+
}, {
|
|
413
|
+
title: 'Third Step',
|
|
414
|
+
content: _react.default.createElement(StepContent, {
|
|
415
|
+
text: "Step 3 Content"
|
|
416
|
+
})
|
|
417
|
+
}];
|
|
418
|
+
it('passes additional props to the cancel button', function () {
|
|
419
|
+
var _render10 = render(_react.default.createElement(_.default, {
|
|
420
|
+
title: "Wizard Title",
|
|
421
|
+
visible: true,
|
|
422
|
+
activeStep: 1,
|
|
423
|
+
submitButtonProps: {
|
|
424
|
+
onClick: function onClick() {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
steps: steps,
|
|
429
|
+
cancelButtonProps: {
|
|
430
|
+
disabled: true
|
|
431
|
+
}
|
|
432
|
+
})),
|
|
433
|
+
getByRole = _render10.getByRole;
|
|
434
|
+
|
|
435
|
+
var modal = getByRole('dialog');
|
|
436
|
+
expect(modal).toBeInTheDocument();
|
|
437
|
+
expect((0, _react2.within)(modal).getByText(/cancel/i, {
|
|
438
|
+
selector: 'button'
|
|
439
|
+
})).toBeDisabled();
|
|
440
|
+
});
|
|
441
|
+
it('allows overriding the cancel button text', function () {
|
|
442
|
+
var _render11 = render(_react.default.createElement(_.default, {
|
|
443
|
+
title: "Wizard Title",
|
|
444
|
+
visible: true,
|
|
445
|
+
activeStep: 1,
|
|
446
|
+
submitButtonProps: {
|
|
447
|
+
onClick: function onClick() {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
steps: steps,
|
|
452
|
+
cancelButtonProps: {
|
|
453
|
+
text: 'Dismiss'
|
|
454
|
+
}
|
|
455
|
+
})),
|
|
456
|
+
getByRole = _render11.getByRole;
|
|
457
|
+
|
|
458
|
+
var modal = getByRole('dialog');
|
|
459
|
+
expect(modal).toBeInTheDocument();
|
|
460
|
+
expect((0, _react2.within)(modal).getByText(/dismiss/i, {
|
|
461
|
+
selector: 'button'
|
|
462
|
+
})).toBeInTheDocument();
|
|
463
|
+
});
|
|
464
|
+
it('allows overriding onClick, replacing onCancel', function () {
|
|
465
|
+
var onCancelMock = jest.fn();
|
|
466
|
+
var cancelButtonOnClickMock = jest.fn();
|
|
467
|
+
|
|
468
|
+
var _render12 = render(_react.default.createElement(_.default, {
|
|
469
|
+
title: "Wizard Title",
|
|
470
|
+
visible: true,
|
|
471
|
+
onCancel: onCancelMock,
|
|
472
|
+
activeStep: 1,
|
|
473
|
+
submitButtonProps: {
|
|
474
|
+
onClick: function onClick() {
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
steps: steps,
|
|
479
|
+
cancelButtonProps: {
|
|
480
|
+
onClick: cancelButtonOnClickMock
|
|
481
|
+
}
|
|
482
|
+
})),
|
|
483
|
+
getByRole = _render12.getByRole;
|
|
484
|
+
|
|
485
|
+
var modal = getByRole('dialog');
|
|
486
|
+
expect(modal).toBeInTheDocument();
|
|
487
|
+
|
|
488
|
+
_react2.fireEvent.click((0, _react2.within)(modal).getByText(/cancel/i, {
|
|
489
|
+
selector: 'button'
|
|
490
|
+
}));
|
|
491
|
+
|
|
492
|
+
expect(cancelButtonOnClickMock).toHaveBeenCalled();
|
|
493
|
+
expect(onCancelMock).not.toHaveBeenCalled();
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
describe('when onCancel is not provided', function () {
|
|
497
|
+
var steps = [{
|
|
498
|
+
title: 'First Step',
|
|
499
|
+
content: _react.default.createElement(StepContent, {
|
|
500
|
+
text: "Step 1 Content"
|
|
501
|
+
})
|
|
502
|
+
}, {
|
|
503
|
+
title: 'Second Step',
|
|
504
|
+
content: _react.default.createElement(StepContent, {
|
|
505
|
+
text: "Step 2 Content"
|
|
506
|
+
})
|
|
507
|
+
}, {
|
|
508
|
+
title: 'Third Step',
|
|
509
|
+
content: _react.default.createElement(StepContent, {
|
|
510
|
+
text: "Step 3 Content"
|
|
511
|
+
})
|
|
512
|
+
}];
|
|
513
|
+
it('does not render the Cancel button when neither onCancel nor cancelButtonProps are provided', function () {
|
|
514
|
+
var _render13 = render(_react.default.createElement(_.default, {
|
|
515
|
+
title: "Wizard Title",
|
|
516
|
+
visible: true,
|
|
517
|
+
activeStep: 1,
|
|
518
|
+
submitButtonProps: {
|
|
519
|
+
onClick: function onClick() {
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
steps: steps
|
|
524
|
+
})),
|
|
525
|
+
getByRole = _render13.getByRole;
|
|
526
|
+
|
|
527
|
+
var modal = getByRole('dialog');
|
|
528
|
+
expect(modal).toBeInTheDocument();
|
|
529
|
+
expect((0, _react2.within)(modal).queryByText(/cancel/i, {
|
|
530
|
+
selector: 'button'
|
|
531
|
+
})).not.toBeInTheDocument();
|
|
532
|
+
});
|
|
533
|
+
it('does not call onCancel when Esc is pressed', function () {
|
|
534
|
+
var onCancelMock = jest.fn();
|
|
535
|
+
render(_react.default.createElement(_.default, {
|
|
536
|
+
title: "Wizard Title",
|
|
537
|
+
visible: true,
|
|
538
|
+
activeStep: 1,
|
|
539
|
+
submitButtonProps: {
|
|
540
|
+
onClick: function onClick() {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
steps: steps
|
|
545
|
+
}));
|
|
546
|
+
|
|
547
|
+
_react2.fireEvent.keyDown(document, {
|
|
548
|
+
key: 'Escape'
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
expect(onCancelMock).not.toHaveBeenCalled();
|
|
552
|
+
});
|
|
553
|
+
it('renders the Cancel button (disabled) when cancelButtonProps is provided without onClick', function () {
|
|
554
|
+
var _render14 = render(_react.default.createElement(_.default, {
|
|
555
|
+
title: "Wizard Title",
|
|
556
|
+
visible: true,
|
|
557
|
+
activeStep: 1,
|
|
558
|
+
submitButtonProps: {
|
|
559
|
+
onClick: function onClick() {
|
|
560
|
+
return null;
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
steps: steps,
|
|
564
|
+
cancelButtonProps: {
|
|
565
|
+
text: 'Cancel'
|
|
566
|
+
}
|
|
567
|
+
})),
|
|
568
|
+
getByRole = _render14.getByRole;
|
|
569
|
+
|
|
570
|
+
var modal = getByRole('dialog');
|
|
571
|
+
expect(modal).toBeInTheDocument();
|
|
572
|
+
expect((0, _react2.within)(modal).getByText(/cancel/i, {
|
|
573
|
+
selector: 'button'
|
|
574
|
+
})).toBeDisabled();
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
describe('when only onCancel is provided', function () {
|
|
578
|
+
var steps = [{
|
|
579
|
+
title: 'First Step',
|
|
580
|
+
content: _react.default.createElement(StepContent, {
|
|
581
|
+
text: "Step 1 Content"
|
|
582
|
+
})
|
|
583
|
+
}, {
|
|
584
|
+
title: 'Second Step',
|
|
585
|
+
content: _react.default.createElement(StepContent, {
|
|
586
|
+
text: "Step 2 Content"
|
|
587
|
+
})
|
|
588
|
+
}, {
|
|
589
|
+
title: 'Third Step',
|
|
590
|
+
content: _react.default.createElement(StepContent, {
|
|
591
|
+
text: "Step 3 Content"
|
|
592
|
+
})
|
|
593
|
+
}];
|
|
594
|
+
it('renders the Cancel button in an enabled state', function () {
|
|
595
|
+
var onCancelMock = jest.fn();
|
|
596
|
+
|
|
597
|
+
var _render15 = render(_react.default.createElement(_.default, {
|
|
598
|
+
title: "Wizard Title",
|
|
599
|
+
visible: true,
|
|
600
|
+
onCancel: onCancelMock,
|
|
601
|
+
activeStep: 1,
|
|
602
|
+
submitButtonProps: {
|
|
603
|
+
onClick: function onClick() {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
steps: steps
|
|
608
|
+
})),
|
|
609
|
+
getByRole = _render15.getByRole;
|
|
610
|
+
|
|
611
|
+
var modal = getByRole('dialog');
|
|
612
|
+
expect(modal).toBeInTheDocument();
|
|
613
|
+
expect((0, _react2.within)(modal).getByText(/cancel/i, {
|
|
614
|
+
selector: 'button'
|
|
615
|
+
})).toBeEnabled();
|
|
616
|
+
});
|
|
617
|
+
});
|
|
398
618
|
describe('Continue action', function () {
|
|
399
619
|
it('doesnt render the button if nextButtonProps is not provided to the step', function () {
|
|
400
620
|
var steps = [{
|
|
@@ -414,7 +634,7 @@ describe('Wizard', function () {
|
|
|
414
634
|
})
|
|
415
635
|
}];
|
|
416
636
|
|
|
417
|
-
var
|
|
637
|
+
var _render16 = render(_react.default.createElement(_.default, {
|
|
418
638
|
title: "Wizard Title",
|
|
419
639
|
visible: true,
|
|
420
640
|
activeStep: 1,
|
|
@@ -425,7 +645,7 @@ describe('Wizard', function () {
|
|
|
425
645
|
},
|
|
426
646
|
steps: steps
|
|
427
647
|
})),
|
|
428
|
-
getByRole =
|
|
648
|
+
getByRole = _render16.getByRole;
|
|
429
649
|
|
|
430
650
|
var modal = getByRole('dialog');
|
|
431
651
|
expect(modal).toBeInTheDocument();
|
|
@@ -456,7 +676,7 @@ describe('Wizard', function () {
|
|
|
456
676
|
}
|
|
457
677
|
}];
|
|
458
678
|
|
|
459
|
-
var
|
|
679
|
+
var _render17 = render(_react.default.createElement(_.default, {
|
|
460
680
|
title: "Wizard Title",
|
|
461
681
|
visible: true,
|
|
462
682
|
activeStep: steps.length,
|
|
@@ -467,7 +687,7 @@ describe('Wizard', function () {
|
|
|
467
687
|
},
|
|
468
688
|
steps: steps
|
|
469
689
|
})),
|
|
470
|
-
getByRole =
|
|
690
|
+
getByRole = _render17.getByRole;
|
|
471
691
|
|
|
472
692
|
var modal = getByRole('dialog');
|
|
473
693
|
expect(modal).toBeInTheDocument();
|
|
@@ -500,7 +720,7 @@ describe('Wizard', function () {
|
|
|
500
720
|
})
|
|
501
721
|
}];
|
|
502
722
|
it('calls the onClick from the continueProps of the active step', function () {
|
|
503
|
-
var
|
|
723
|
+
var _render18 = render(_react.default.createElement(_.default, {
|
|
504
724
|
title: "Wizard Title",
|
|
505
725
|
visible: true,
|
|
506
726
|
activeStep: 1,
|
|
@@ -511,7 +731,7 @@ describe('Wizard', function () {
|
|
|
511
731
|
},
|
|
512
732
|
steps: steps
|
|
513
733
|
})),
|
|
514
|
-
getByRole =
|
|
734
|
+
getByRole = _render18.getByRole;
|
|
515
735
|
|
|
516
736
|
var modal = getByRole('dialog');
|
|
517
737
|
expect(modal).toBeInTheDocument();
|
|
@@ -550,7 +770,7 @@ describe('Wizard', function () {
|
|
|
550
770
|
})
|
|
551
771
|
}];
|
|
552
772
|
|
|
553
|
-
var
|
|
773
|
+
var _render19 = render(_react.default.createElement(_.default, {
|
|
554
774
|
title: "Wizard Title",
|
|
555
775
|
visible: true,
|
|
556
776
|
activeStep: 2,
|
|
@@ -561,7 +781,7 @@ describe('Wizard', function () {
|
|
|
561
781
|
},
|
|
562
782
|
steps: steps
|
|
563
783
|
})),
|
|
564
|
-
getByRole =
|
|
784
|
+
getByRole = _render19.getByRole;
|
|
565
785
|
|
|
566
786
|
var modal = getByRole('dialog');
|
|
567
787
|
expect(modal).toBeInTheDocument();
|
|
@@ -592,7 +812,7 @@ describe('Wizard', function () {
|
|
|
592
812
|
})
|
|
593
813
|
}];
|
|
594
814
|
|
|
595
|
-
var
|
|
815
|
+
var _render20 = render(_react.default.createElement(_.default, {
|
|
596
816
|
title: "Wizard Title",
|
|
597
817
|
visible: true,
|
|
598
818
|
activeStep: 1,
|
|
@@ -603,7 +823,7 @@ describe('Wizard', function () {
|
|
|
603
823
|
},
|
|
604
824
|
steps: steps
|
|
605
825
|
})),
|
|
606
|
-
getByRole =
|
|
826
|
+
getByRole = _render20.getByRole;
|
|
607
827
|
|
|
608
828
|
var modal = getByRole('dialog');
|
|
609
829
|
expect(modal).toBeInTheDocument();
|
|
@@ -637,7 +857,7 @@ describe('Wizard', function () {
|
|
|
637
857
|
}
|
|
638
858
|
}];
|
|
639
859
|
it('calls the onClick from the continueProps of the active step', function () {
|
|
640
|
-
var
|
|
860
|
+
var _render21 = render(_react.default.createElement(_.default, {
|
|
641
861
|
title: "Wizard Title",
|
|
642
862
|
visible: true,
|
|
643
863
|
activeStep: 2,
|
|
@@ -648,7 +868,7 @@ describe('Wizard', function () {
|
|
|
648
868
|
},
|
|
649
869
|
steps: steps
|
|
650
870
|
})),
|
|
651
|
-
getByRole =
|
|
871
|
+
getByRole = _render21.getByRole;
|
|
652
872
|
|
|
653
873
|
var modal = getByRole('dialog');
|
|
654
874
|
expect(modal).toBeInTheDocument();
|
|
@@ -683,7 +903,7 @@ describe('Wizard', function () {
|
|
|
683
903
|
it('doesnt render if im not in the last step', function () {
|
|
684
904
|
var submitCallbackMock = jest.fn();
|
|
685
905
|
|
|
686
|
-
var
|
|
906
|
+
var _render22 = render(_react.default.createElement(_.default, {
|
|
687
907
|
title: "Wizard Title",
|
|
688
908
|
visible: true,
|
|
689
909
|
activeStep: 1,
|
|
@@ -692,7 +912,7 @@ describe('Wizard', function () {
|
|
|
692
912
|
},
|
|
693
913
|
steps: steps
|
|
694
914
|
})),
|
|
695
|
-
getByRole =
|
|
915
|
+
getByRole = _render22.getByRole;
|
|
696
916
|
|
|
697
917
|
var modal = getByRole('dialog');
|
|
698
918
|
expect((0, _react2.within)(modal).queryByText(/submit/i)).not.toBeInTheDocument();
|
|
@@ -700,7 +920,7 @@ describe('Wizard', function () {
|
|
|
700
920
|
it('renders if im in the last step', function () {
|
|
701
921
|
var submitCallbackMock = jest.fn();
|
|
702
922
|
|
|
703
|
-
var
|
|
923
|
+
var _render23 = render(_react.default.createElement(_.default, {
|
|
704
924
|
title: "Wizard Title",
|
|
705
925
|
visible: true,
|
|
706
926
|
activeStep: steps.length,
|
|
@@ -709,7 +929,7 @@ describe('Wizard', function () {
|
|
|
709
929
|
},
|
|
710
930
|
steps: steps
|
|
711
931
|
})),
|
|
712
|
-
getByRole =
|
|
932
|
+
getByRole = _render23.getByRole;
|
|
713
933
|
|
|
714
934
|
var modal = getByRole('dialog');
|
|
715
935
|
expect((0, _react2.within)(modal).getByText(/submit/i)).toBeInTheDocument();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Wizard/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Wizard/schema.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,KAAsC,CAAC;AAsDnD,eAAe,MAAM,CAAC"}
|
|
@@ -15,7 +15,7 @@ schema.propTypes = {
|
|
|
15
15
|
id: _reactDesc.PropTypes.string.description('A unique identifier for the modal.'),
|
|
16
16
|
size: _reactDesc.PropTypes.oneOf(['normal', 'extraLarge']).description('Define the max width size of the modal').defaultValue('normal'),
|
|
17
17
|
title: _reactDesc.PropTypes.string.description('The text for rendering in the H2 at the top of the modal').isRequired,
|
|
18
|
-
onCancel: _reactDesc.PropTypes.func.description('The event handler called
|
|
18
|
+
onCancel: _reactDesc.PropTypes.func.description('The event handler called when the Cancel button is clicked or the Esc key is pressed. If not provided, the Cancel button will be disabled and pressing Esc will not close the modal.'),
|
|
19
19
|
visible: _reactDesc.PropTypes.bool.description('A boolean value used to control whether the modal is visible or not').defaultValue('false'),
|
|
20
20
|
zIndex: _reactDesc.PropTypes.number.description('Sets the z-index value for the modal & overlay.'),
|
|
21
21
|
activeStep: _reactDesc.PropTypes.number.description('The currently active step in the wizard. This has to be handled by the user').isRequired,
|
|
@@ -33,6 +33,9 @@ schema.propTypes = {
|
|
|
33
33
|
submitButtonProps: _reactDesc.PropTypes.shape({
|
|
34
34
|
onClick: _reactDesc.PropTypes.func.isRequired
|
|
35
35
|
}).description('the props to pass to the submit button, this button is rendered by default in the last stesp'),
|
|
36
|
+
cancelButtonProps: _reactDesc.PropTypes.shape({
|
|
37
|
+
onClick: _reactDesc.PropTypes.func
|
|
38
|
+
}).description('The props to pass to the cancel button. These props are spread after the defaults, so they can override the default text, kind, variant, and onClick.'),
|
|
36
39
|
renderActions: _reactDesc.PropTypes.func.description('Function to render custom action buttons. It receives an object with the current step, step index, isFirstStep, isLastStep and the default actions as parameters')
|
|
37
40
|
};
|
|
38
41
|
var _default = schema;
|