@decisiv/ui-components 2.0.1-alpha.71 → 2.0.1-alpha.75
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/atoms/BooleanInput/index.d.ts.map +1 -1
- package/lib/atoms/BooleanInput/index.js +19 -2
- package/lib/atoms/BooleanInput/index.test.js +17 -6
- package/lib/atoms/BooleanInput/types.d.ts +2 -0
- package/lib/atoms/BooleanInput/types.d.ts.map +1 -1
- package/lib/atoms/InputField/index.js +1 -1
- package/lib/atoms/OptionsList/Option.js +2 -2
- package/lib/atoms/OptionsList/index.test.js +77 -14
- package/lib/atoms/RequiredIcon.d.ts +9 -0
- package/lib/atoms/RequiredIcon.d.ts.map +1 -0
- package/lib/atoms/{InputField/RequiredIcon.js → RequiredIcon.js} +7 -3
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Checkbox/index.js +3 -1
- package/lib/components/Checkbox/schema.d.ts.map +1 -1
- package/lib/components/Checkbox/schema.js +2 -0
- package/lib/components/Combobox/index.d.ts.map +1 -1
- package/lib/components/Combobox/index.js +27 -18
- package/lib/components/Combobox/index.test.js +172 -52
- package/lib/components/Filter/IconWrapper/index.d.ts +197 -0
- package/lib/components/Filter/IconWrapper/index.d.ts.map +1 -0
- package/lib/components/Filter/IconWrapper/index.js +35 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts +31 -0
- package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -0
- package/lib/components/Filter/SimplePrimary/index.js +58 -0
- package/lib/components/Filter/SimplePrimary/index.test.js +34 -0
- package/lib/components/Filter/StyledFilter.d.ts +4 -0
- package/lib/components/Filter/StyledFilter.d.ts.map +1 -0
- package/lib/components/Filter/StyledFilter.js +39 -0
- package/lib/components/Filter/StyledLabel/index.d.ts +8 -0
- package/lib/components/Filter/StyledLabel/index.d.ts.map +1 -0
- package/lib/components/Filter/StyledLabel/index.js +30 -0
- package/lib/components/Filter/index.d.ts +27 -0
- package/lib/components/Filter/index.d.ts.map +1 -0
- package/lib/components/Filter/index.js +95 -0
- package/lib/components/Filter/index.test.js +41 -0
- package/lib/components/Filter/kind.d.ts +6 -0
- package/lib/components/Filter/kind.d.ts.map +1 -0
- package/lib/components/Filter/kind.js +45 -0
- package/lib/components/Filter/schema.d.ts +9 -0
- package/lib/components/Filter/schema.d.ts.map +1 -0
- package/lib/components/Filter/schema.js +32 -0
- package/lib/components/Filter/types.d.ts +17 -0
- package/lib/components/Filter/types.d.ts.map +1 -0
- package/lib/components/Filter/types.js +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +9 -0
- package/lib/providers/ConfigProvider/index.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/index.js +5 -1
- package/package.json +2 -2
- package/lib/atoms/InputField/RequiredIcon.d.ts +0 -4
- package/lib/atoms/InputField/RequiredIcon.d.ts.map +0 -1
|
@@ -429,6 +429,54 @@ describe('Combobox', function () {
|
|
|
429
429
|
}));
|
|
430
430
|
expect(queryByLabelText('test')).toHaveValue(defaultOptions[0].label);
|
|
431
431
|
});
|
|
432
|
+
describe('with first element disabled', function () {
|
|
433
|
+
it('selects the first element that is not disabled', function () {
|
|
434
|
+
var onChangeValue = jest.fn();
|
|
435
|
+
var options = [{
|
|
436
|
+
id: '0',
|
|
437
|
+
label: 'option 0',
|
|
438
|
+
value: 'option 0',
|
|
439
|
+
disabled: true
|
|
440
|
+
}, {
|
|
441
|
+
id: '1',
|
|
442
|
+
label: 'option 1',
|
|
443
|
+
value: 'option 1'
|
|
444
|
+
}, {
|
|
445
|
+
id: '2',
|
|
446
|
+
label: 'option 2',
|
|
447
|
+
value: 'option 2'
|
|
448
|
+
}];
|
|
449
|
+
|
|
450
|
+
var _render14 = render(_react.default.createElement(_.default, {
|
|
451
|
+
label: "test",
|
|
452
|
+
onChangeValue: onChangeValue,
|
|
453
|
+
options: options
|
|
454
|
+
})),
|
|
455
|
+
baseElement = _render14.baseElement,
|
|
456
|
+
queryByText = _render14.queryByText,
|
|
457
|
+
queryByLabelText = _render14.queryByLabelText;
|
|
458
|
+
|
|
459
|
+
_react2.fireEvent.click(queryByText('test'));
|
|
460
|
+
|
|
461
|
+
_react2.fireEvent.change(queryByLabelText('test'), {
|
|
462
|
+
target: {
|
|
463
|
+
value: 'value'
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
expect((0, _react2.queryByText)(baseElement, options[1].label)).toBeInTheDocument();
|
|
468
|
+
|
|
469
|
+
_react2.fireEvent.keyDown(queryByLabelText('test'), {
|
|
470
|
+
key: 'Enter',
|
|
471
|
+
keyCode: 13
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
expect(onChangeValue).toHaveBeenCalledWith(options[1].id, expect.objectContaining({
|
|
475
|
+
removed: false
|
|
476
|
+
}));
|
|
477
|
+
expect(queryByLabelText('test')).toHaveValue(options[1].label);
|
|
478
|
+
});
|
|
479
|
+
});
|
|
432
480
|
});
|
|
433
481
|
describe('when pressing the TAB key', function () {
|
|
434
482
|
it('closes the dropdown, advances focus', function () {
|
|
@@ -437,14 +485,14 @@ describe('Combobox', function () {
|
|
|
437
485
|
|
|
438
486
|
var chevronDownPathD = chevronDownContainer.querySelector('svg path').getAttribute('d');
|
|
439
487
|
|
|
440
|
-
var
|
|
488
|
+
var _render15 = render(_react.default.createElement(_.default, {
|
|
441
489
|
label: "test",
|
|
442
490
|
options: defaultOptions
|
|
443
491
|
})),
|
|
444
|
-
baseElement =
|
|
445
|
-
container =
|
|
446
|
-
queryByText =
|
|
447
|
-
queryByLabelText =
|
|
492
|
+
baseElement = _render15.baseElement,
|
|
493
|
+
container = _render15.container,
|
|
494
|
+
queryByText = _render15.queryByText,
|
|
495
|
+
queryByLabelText = _render15.queryByLabelText;
|
|
448
496
|
|
|
449
497
|
_react2.fireEvent.click(queryByText('test'));
|
|
450
498
|
|
|
@@ -473,12 +521,12 @@ describe('Combobox', function () {
|
|
|
473
521
|
it('preserves the typed text, does NOT make a selection', function () {
|
|
474
522
|
var onChangeValue = jest.fn();
|
|
475
523
|
|
|
476
|
-
var
|
|
524
|
+
var _render16 = render(_react.default.createElement(_.default, {
|
|
477
525
|
label: "test",
|
|
478
526
|
onChangeValue: onChangeValue,
|
|
479
527
|
options: defaultOptions
|
|
480
528
|
})),
|
|
481
|
-
queryByLabelText =
|
|
529
|
+
queryByLabelText = _render16.queryByLabelText;
|
|
482
530
|
|
|
483
531
|
var value = 'value';
|
|
484
532
|
|
|
@@ -506,20 +554,20 @@ describe('Combobox', function () {
|
|
|
506
554
|
var onChangeInputValue = jest.fn();
|
|
507
555
|
var onChangeValue = jest.fn();
|
|
508
556
|
|
|
509
|
-
var
|
|
557
|
+
var _render17 = render(_react.default.createElement(_.default, {
|
|
510
558
|
label: "test",
|
|
511
559
|
onChangeInputValue: onChangeInputValue,
|
|
512
560
|
onChangeValue: onChangeValue,
|
|
513
561
|
options: defaultOptions
|
|
514
562
|
})),
|
|
515
|
-
baseElement =
|
|
516
|
-
queryByLabelText =
|
|
563
|
+
baseElement = _render17.baseElement,
|
|
564
|
+
queryByLabelText = _render17.queryByLabelText; // You can not fire an event on the input in the UI unless you are already focused on it.
|
|
517
565
|
// This click focuses on the input.
|
|
518
566
|
|
|
519
567
|
|
|
520
568
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
521
569
|
|
|
522
|
-
expect((0, _react2.queryByText)(baseElement, defaultOptions[0].label)).toBeInTheDocument(); // The first element should be "active" by default.
|
|
570
|
+
expect((0, _react2.queryByText)(baseElement, defaultOptions[0].label)).toBeInTheDocument(); // The first element should be "active" by default if it's not disabled.
|
|
523
571
|
|
|
524
572
|
expect((0, _react2.queryByText)(baseElement, defaultOptions[0].label).parentElement.parentElement).toHaveStyle("\n background: ".concat((0, _toColorString.default)(_color.default.interaction.pacificOcean15), ";\n color: ").concat((0, _toColorString.default)(_color.default.interaction.pacificOcean), ";\n ")); // The focus should always remain on the input. The "active" item is kind of a fake.
|
|
525
573
|
|
|
@@ -545,16 +593,88 @@ describe('Combobox', function () {
|
|
|
545
593
|
expect(onChangeInputValue).not.toHaveBeenCalled();
|
|
546
594
|
expect(onChangeValue).not.toHaveBeenCalled();
|
|
547
595
|
});
|
|
596
|
+
describe('with a disabled option', function () {
|
|
597
|
+
it('expands and navigates through the dropdown list, keeps focus on the input', function () {
|
|
598
|
+
var onChangeInputValue = jest.fn();
|
|
599
|
+
var onChangeValue = jest.fn();
|
|
600
|
+
var enabledElements = ['enabled 1', 'enabled 2'];
|
|
601
|
+
var options = [{
|
|
602
|
+
id: enabledElements[0],
|
|
603
|
+
label: enabledElements[0],
|
|
604
|
+
value: 'option 0'
|
|
605
|
+
}, {
|
|
606
|
+
id: '1',
|
|
607
|
+
label: 'option 1',
|
|
608
|
+
value: 'option 1',
|
|
609
|
+
disabled: true
|
|
610
|
+
}, {
|
|
611
|
+
label: 'category 0',
|
|
612
|
+
items: [{
|
|
613
|
+
id: 'cat0Opt0',
|
|
614
|
+
label: 'category 0 option 0',
|
|
615
|
+
value: 'category 0 option 0',
|
|
616
|
+
disabled: true
|
|
617
|
+
}, {
|
|
618
|
+
id: enabledElements[1],
|
|
619
|
+
label: enabledElements[1],
|
|
620
|
+
value: 'category 0 option 1'
|
|
621
|
+
}]
|
|
622
|
+
}];
|
|
623
|
+
|
|
624
|
+
var _render18 = render(_react.default.createElement(_.default, {
|
|
625
|
+
label: "test",
|
|
626
|
+
onChangeInputValue: onChangeInputValue,
|
|
627
|
+
onChangeValue: onChangeValue,
|
|
628
|
+
options: options
|
|
629
|
+
})),
|
|
630
|
+
baseElement = _render18.baseElement,
|
|
631
|
+
queryByLabelText = _render18.queryByLabelText; // You can not fire an event on the input in the UI unless you are already focused on it.
|
|
632
|
+
// This click focuses on the input.
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
_react2.fireEvent.click(queryByLabelText('test'));
|
|
636
|
+
|
|
637
|
+
expect((0, _react2.queryByText)(baseElement, enabledElements[0])).toBeInTheDocument(); // The first element should be "active" by default if it's not disabled.
|
|
638
|
+
|
|
639
|
+
expect((0, _react2.queryByText)(baseElement, enabledElements[0]).parentElement.parentElement).toHaveStyle("\n background: ".concat((0, _toColorString.default)(_color.default.interaction.pacificOcean15), ";\n color: ").concat((0, _toColorString.default)(_color.default.interaction.pacificOcean), ";\n ")); // The focus should always remain on the input. The "active" item is kind of a fake.
|
|
640
|
+
|
|
641
|
+
expect(queryByLabelText('test')).toHaveFocus();
|
|
642
|
+
|
|
643
|
+
_react2.fireEvent.keyDown(queryByLabelText('test'), {
|
|
644
|
+
key: 'ArrowDown',
|
|
645
|
+
keyCode: 40
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
expect((0, _react2.queryByText)(baseElement, enabledElements[0]).parentElement.parentElement).not.toHaveStyle("\n background: ".concat((0, _toColorString.default)(_color.default.interaction.pacificOcean15), ";\n color: ").concat((0, _toColorString.default)(_color.default.interaction.pacificOcean), ";\n ")); // The next active element should be the next element in the list
|
|
649
|
+
// that is not marked as disabled
|
|
650
|
+
|
|
651
|
+
expect((0, _react2.queryByText)(baseElement, enabledElements[1]).parentElement.parentElement).toHaveStyle("\n background: ".concat((0, _toColorString.default)(_color.default.interaction.pacificOcean15), ";\n color: ").concat((0, _toColorString.default)(_color.default.interaction.pacificOcean), ";\n "));
|
|
652
|
+
expect(queryByLabelText('test')).toHaveFocus();
|
|
653
|
+
|
|
654
|
+
_react2.fireEvent.keyDown(queryByLabelText('test'), {
|
|
655
|
+
key: 'ArrowUp',
|
|
656
|
+
keyCode: 38
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
expect((0, _react2.queryByText)(baseElement, enabledElements[1]).parentElement.parentElement).not.toHaveStyle("\n background: ".concat((0, _toColorString.default)(_color.default.interaction.pacificOcean15), ";\n color: ").concat((0, _toColorString.default)(_color.default.interaction.pacificOcean), ";\n ")); // The next active element should be the previous element in the list
|
|
660
|
+
// that is not marked as disabled
|
|
661
|
+
|
|
662
|
+
expect((0, _react2.queryByText)(baseElement, enabledElements[0]).parentElement.parentElement).toHaveStyle("\n background: ".concat((0, _toColorString.default)(_color.default.interaction.pacificOcean15), ";\n color: ").concat((0, _toColorString.default)(_color.default.interaction.pacificOcean), ";\n "));
|
|
663
|
+
expect(queryByLabelText('test')).toHaveFocus();
|
|
664
|
+
expect(onChangeInputValue).not.toHaveBeenCalled();
|
|
665
|
+
expect(onChangeValue).not.toHaveBeenCalled();
|
|
666
|
+
});
|
|
667
|
+
});
|
|
548
668
|
});
|
|
549
669
|
describe('when pressing the ESCAPE key', function () {
|
|
550
670
|
it('closes the dropdown, keeps focus on input', function () {
|
|
551
|
-
var
|
|
671
|
+
var _render19 = render(_react.default.createElement(_.default, {
|
|
552
672
|
label: "test",
|
|
553
673
|
options: defaultOptions
|
|
554
674
|
})),
|
|
555
|
-
baseElement =
|
|
556
|
-
queryByLabelText =
|
|
557
|
-
queryByText =
|
|
675
|
+
baseElement = _render19.baseElement,
|
|
676
|
+
queryByLabelText = _render19.queryByLabelText,
|
|
677
|
+
queryByText = _render19.queryByText;
|
|
558
678
|
|
|
559
679
|
_react2.fireEvent.click(queryByText('test'));
|
|
560
680
|
|
|
@@ -572,13 +692,13 @@ describe('Combobox', function () {
|
|
|
572
692
|
it('preserves the typed text, does NOT make a selection', function () {
|
|
573
693
|
var onChangeValue = jest.fn();
|
|
574
694
|
|
|
575
|
-
var
|
|
695
|
+
var _render20 = render(_react.default.createElement(_.default, {
|
|
576
696
|
label: "test",
|
|
577
697
|
options: defaultOptions,
|
|
578
698
|
onChangeValue: onChangeValue
|
|
579
699
|
})),
|
|
580
|
-
queryByLabelText =
|
|
581
|
-
queryByText =
|
|
700
|
+
queryByLabelText = _render20.queryByLabelText,
|
|
701
|
+
queryByText = _render20.queryByText;
|
|
582
702
|
|
|
583
703
|
var value = 'value';
|
|
584
704
|
|
|
@@ -604,18 +724,18 @@ describe('Combobox', function () {
|
|
|
604
724
|
});
|
|
605
725
|
describe('when the input field has text', function () {
|
|
606
726
|
it('renders the "clear" button', function () {
|
|
607
|
-
var
|
|
608
|
-
timesContainer =
|
|
727
|
+
var _render21 = render(_react.default.createElement(_Times.default, null)),
|
|
728
|
+
timesContainer = _render21.container;
|
|
609
729
|
|
|
610
730
|
var timesPathD = timesContainer.querySelector('svg path').getAttribute('d');
|
|
611
731
|
|
|
612
|
-
var
|
|
732
|
+
var _render22 = render(_react.default.createElement(_.default, {
|
|
613
733
|
defaultInputValue: "value",
|
|
614
734
|
label: "test",
|
|
615
735
|
options: defaultOptions
|
|
616
736
|
})),
|
|
617
|
-
container =
|
|
618
|
-
queryByLabelText =
|
|
737
|
+
container = _render22.container,
|
|
738
|
+
queryByLabelText = _render22.queryByLabelText;
|
|
619
739
|
|
|
620
740
|
expect(queryByLabelText('test')).toHaveValue('value');
|
|
621
741
|
expect(container.querySelectorAll('svg path')[0]).toHaveAttribute('d', timesPathD);
|
|
@@ -627,12 +747,12 @@ describe('Combobox', function () {
|
|
|
627
747
|
inputValue = event ? event.target.value : '';
|
|
628
748
|
});
|
|
629
749
|
|
|
630
|
-
var
|
|
750
|
+
var _render23 = render(_react.default.createElement(_.default, {
|
|
631
751
|
label: "test",
|
|
632
752
|
onChangeInputValue: onChangeInputValue
|
|
633
753
|
})),
|
|
634
|
-
container =
|
|
635
|
-
queryByLabelText =
|
|
754
|
+
container = _render23.container,
|
|
755
|
+
queryByLabelText = _render23.queryByLabelText;
|
|
636
756
|
|
|
637
757
|
var value = 'value';
|
|
638
758
|
|
|
@@ -658,13 +778,13 @@ describe('Combobox', function () {
|
|
|
658
778
|
it('updates the input value with the label of the selection', function () {
|
|
659
779
|
var onChangeValue = jest.fn();
|
|
660
780
|
|
|
661
|
-
var
|
|
781
|
+
var _render24 = render(_react.default.createElement(_.default, {
|
|
662
782
|
label: "test",
|
|
663
783
|
options: defaultOptions,
|
|
664
784
|
onChangeValue: onChangeValue
|
|
665
785
|
})),
|
|
666
|
-
baseElement =
|
|
667
|
-
queryByLabelText =
|
|
786
|
+
baseElement = _render24.baseElement,
|
|
787
|
+
queryByLabelText = _render24.queryByLabelText;
|
|
668
788
|
|
|
669
789
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
670
790
|
|
|
@@ -678,13 +798,13 @@ describe('Combobox', function () {
|
|
|
678
798
|
expect((0, _react2.queryByText)(baseElement, defaultOptions[0].label)).not.toBeInTheDocument();
|
|
679
799
|
});
|
|
680
800
|
it('shows the selected tag when multiple select is enabled', function () {
|
|
681
|
-
var
|
|
801
|
+
var _render25 = render(_react.default.createElement(_.default, {
|
|
682
802
|
label: "test",
|
|
683
803
|
multiple: true,
|
|
684
804
|
options: defaultOptions
|
|
685
805
|
})),
|
|
686
|
-
baseElement =
|
|
687
|
-
queryByLabelText =
|
|
806
|
+
baseElement = _render25.baseElement,
|
|
807
|
+
queryByLabelText = _render25.queryByLabelText;
|
|
688
808
|
|
|
689
809
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
690
810
|
|
|
@@ -693,12 +813,12 @@ describe('Combobox', function () {
|
|
|
693
813
|
expect((0, _react2.queryByText)(baseElement, defaultOptions[1].label)).toBeInTheDocument();
|
|
694
814
|
});
|
|
695
815
|
it('renders as "selected" in the dropdown list', function () {
|
|
696
|
-
var
|
|
816
|
+
var _render26 = render(_react.default.createElement(_.default, {
|
|
697
817
|
label: "test",
|
|
698
818
|
options: defaultOptions
|
|
699
819
|
})),
|
|
700
|
-
baseElement =
|
|
701
|
-
queryByLabelText =
|
|
820
|
+
baseElement = _render26.baseElement,
|
|
821
|
+
queryByLabelText = _render26.queryByLabelText;
|
|
702
822
|
|
|
703
823
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
704
824
|
|
|
@@ -716,14 +836,14 @@ describe('Combobox', function () {
|
|
|
716
836
|
it('does NOT update the selection automatically', function () {
|
|
717
837
|
var onChangeValue = jest.fn();
|
|
718
838
|
|
|
719
|
-
var
|
|
839
|
+
var _render27 = render(_react.default.createElement(_.default, {
|
|
720
840
|
label: "test",
|
|
721
841
|
options: defaultOptions,
|
|
722
842
|
onChangeValue: onChangeValue
|
|
723
843
|
})),
|
|
724
|
-
baseElement =
|
|
725
|
-
queryByLabelText =
|
|
726
|
-
queryByText =
|
|
844
|
+
baseElement = _render27.baseElement,
|
|
845
|
+
queryByLabelText = _render27.queryByLabelText,
|
|
846
|
+
queryByText = _render27.queryByText;
|
|
727
847
|
|
|
728
848
|
_react2.fireEvent.click(queryByText('test'));
|
|
729
849
|
|
|
@@ -750,13 +870,13 @@ describe('Combobox', function () {
|
|
|
750
870
|
it('clears the selection', function () {
|
|
751
871
|
var onChangeValue = jest.fn();
|
|
752
872
|
|
|
753
|
-
var
|
|
873
|
+
var _render28 = render(_react.default.createElement(_.default, {
|
|
754
874
|
label: "test",
|
|
755
875
|
options: defaultOptions,
|
|
756
876
|
onChangeValue: onChangeValue
|
|
757
877
|
})),
|
|
758
|
-
baseElement =
|
|
759
|
-
queryByLabelText =
|
|
878
|
+
baseElement = _render28.baseElement,
|
|
879
|
+
queryByLabelText = _render28.queryByLabelText;
|
|
760
880
|
|
|
761
881
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
762
882
|
|
|
@@ -781,7 +901,7 @@ describe('Combobox', function () {
|
|
|
781
901
|
var onChangeInputValue = jest.fn();
|
|
782
902
|
var onChangeValue = jest.fn();
|
|
783
903
|
|
|
784
|
-
var
|
|
904
|
+
var _render29 = render(_react.default.createElement(_.default, {
|
|
785
905
|
label: "test",
|
|
786
906
|
options: defaultOptions,
|
|
787
907
|
defaultInputValue: "value",
|
|
@@ -789,9 +909,9 @@ describe('Combobox', function () {
|
|
|
789
909
|
onChangeInputValue: onChangeInputValue,
|
|
790
910
|
onChangeValue: onChangeValue
|
|
791
911
|
})),
|
|
792
|
-
baseElement =
|
|
793
|
-
queryByLabelText =
|
|
794
|
-
rerender =
|
|
912
|
+
baseElement = _render29.baseElement,
|
|
913
|
+
queryByLabelText = _render29.queryByLabelText,
|
|
914
|
+
rerender = _render29.rerender;
|
|
795
915
|
|
|
796
916
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
797
917
|
|
|
@@ -814,7 +934,7 @@ describe('Combobox', function () {
|
|
|
814
934
|
});
|
|
815
935
|
describe('when a controlled component', function () {
|
|
816
936
|
it('initializes with and prefers prop values', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
817
|
-
var newInputValue, onChangeInputValue, onChangeValue,
|
|
937
|
+
var newInputValue, onChangeInputValue, onChangeValue, _render30, baseElement, queryByLabelText, rerender;
|
|
818
938
|
|
|
819
939
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
820
940
|
while (1) {
|
|
@@ -824,7 +944,7 @@ describe('Combobox', function () {
|
|
|
824
944
|
newInputValue = event ? event.target.value : '';
|
|
825
945
|
});
|
|
826
946
|
onChangeValue = jest.fn();
|
|
827
|
-
|
|
947
|
+
_render30 = render(_react.default.createElement(_.default, {
|
|
828
948
|
label: "test",
|
|
829
949
|
options: defaultOptions,
|
|
830
950
|
inputValue: "value",
|
|
@@ -833,7 +953,7 @@ describe('Combobox', function () {
|
|
|
833
953
|
onChangeValue: onChangeValue,
|
|
834
954
|
autoComplete: "auto-complete-test",
|
|
835
955
|
type: "search"
|
|
836
|
-
})), baseElement =
|
|
956
|
+
})), baseElement = _render30.baseElement, queryByLabelText = _render30.queryByLabelText, rerender = _render30.rerender;
|
|
837
957
|
|
|
838
958
|
_react2.fireEvent.click(queryByLabelText('test'));
|
|
839
959
|
|
|
@@ -891,7 +1011,7 @@ describe('Combobox', function () {
|
|
|
891
1011
|
it('calls the onChangeValue prop with removed: true', function () {
|
|
892
1012
|
var onChangeValue = jest.fn();
|
|
893
1013
|
|
|
894
|
-
var
|
|
1014
|
+
var _render31 = render(_react.default.createElement(_.default, {
|
|
895
1015
|
label: "test",
|
|
896
1016
|
options: defaultOptions,
|
|
897
1017
|
inputValue: "",
|
|
@@ -899,8 +1019,8 @@ describe('Combobox', function () {
|
|
|
899
1019
|
onChangeValue: onChangeValue,
|
|
900
1020
|
multiple: true
|
|
901
1021
|
})),
|
|
902
|
-
queryByText =
|
|
903
|
-
queryByLabelText =
|
|
1022
|
+
queryByText = _render31.queryByText,
|
|
1023
|
+
queryByLabelText = _render31.queryByLabelText;
|
|
904
1024
|
|
|
905
1025
|
expect(queryByText(defaultOptions[1].label)).toBeInTheDocument();
|
|
906
1026
|
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FilterProps } from '../types';
|
|
3
|
+
declare const IconWrapper: import("styled-components").StyledComponent<"div", any, Partial<{
|
|
4
|
+
readonly alignContent?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
5
|
+
readonly XS: "XS";
|
|
6
|
+
readonly SM: "SM";
|
|
7
|
+
readonly MD: "MD";
|
|
8
|
+
readonly LG: "LG";
|
|
9
|
+
readonly XL: "XL";
|
|
10
|
+
}> | undefined;
|
|
11
|
+
readonly alignItems?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
12
|
+
readonly XS: "XS";
|
|
13
|
+
readonly SM: "SM";
|
|
14
|
+
readonly MD: "MD";
|
|
15
|
+
readonly LG: "LG";
|
|
16
|
+
readonly XL: "XL";
|
|
17
|
+
}> | undefined;
|
|
18
|
+
readonly alignSelf?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
19
|
+
readonly XS: "XS";
|
|
20
|
+
readonly SM: "SM";
|
|
21
|
+
readonly MD: "MD";
|
|
22
|
+
readonly LG: "LG";
|
|
23
|
+
readonly XL: "XL";
|
|
24
|
+
}> | undefined;
|
|
25
|
+
readonly flex?: string | number | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("react").ReactText, {
|
|
26
|
+
readonly XS: "XS";
|
|
27
|
+
readonly SM: "SM";
|
|
28
|
+
readonly MD: "MD";
|
|
29
|
+
readonly LG: "LG";
|
|
30
|
+
readonly XL: "XL";
|
|
31
|
+
}> | undefined;
|
|
32
|
+
readonly flexBasis?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
33
|
+
readonly XS: "XS";
|
|
34
|
+
readonly SM: "SM";
|
|
35
|
+
readonly MD: "MD";
|
|
36
|
+
readonly LG: "LG";
|
|
37
|
+
readonly XL: "XL";
|
|
38
|
+
}> | undefined;
|
|
39
|
+
readonly flexDirection?: "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "row" | "column" | "column-reverse" | "row-reverse" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").FlexDirectionProperty, {
|
|
40
|
+
readonly XS: "XS";
|
|
41
|
+
readonly SM: "SM";
|
|
42
|
+
readonly MD: "MD";
|
|
43
|
+
readonly LG: "LG";
|
|
44
|
+
readonly XL: "XL";
|
|
45
|
+
}> | undefined;
|
|
46
|
+
readonly flexGrow?: number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").GlobalsNumber, {
|
|
47
|
+
readonly XS: "XS";
|
|
48
|
+
readonly SM: "SM";
|
|
49
|
+
readonly MD: "MD";
|
|
50
|
+
readonly LG: "LG";
|
|
51
|
+
readonly XL: "XL";
|
|
52
|
+
}> | undefined;
|
|
53
|
+
readonly flexShrink?: number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").GlobalsNumber, {
|
|
54
|
+
readonly XS: "XS";
|
|
55
|
+
readonly SM: "SM";
|
|
56
|
+
readonly MD: "MD";
|
|
57
|
+
readonly LG: "LG";
|
|
58
|
+
readonly XL: "XL";
|
|
59
|
+
}> | undefined;
|
|
60
|
+
readonly flexWrap?: "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "nowrap" | "wrap" | "wrap-reverse" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").FlexWrapProperty, {
|
|
61
|
+
readonly XS: "XS";
|
|
62
|
+
readonly SM: "SM";
|
|
63
|
+
readonly MD: "MD";
|
|
64
|
+
readonly LG: "LG";
|
|
65
|
+
readonly XL: "XL";
|
|
66
|
+
}> | undefined;
|
|
67
|
+
readonly justifyContent?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
68
|
+
readonly XS: "XS";
|
|
69
|
+
readonly SM: "SM";
|
|
70
|
+
readonly MD: "MD";
|
|
71
|
+
readonly LG: "LG";
|
|
72
|
+
readonly XL: "XL";
|
|
73
|
+
}> | undefined;
|
|
74
|
+
readonly justifyItems?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
75
|
+
readonly XS: "XS";
|
|
76
|
+
readonly SM: "SM";
|
|
77
|
+
readonly MD: "MD";
|
|
78
|
+
readonly LG: "LG";
|
|
79
|
+
readonly XL: "XL";
|
|
80
|
+
}> | undefined;
|
|
81
|
+
readonly justifySelf?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
|
|
82
|
+
readonly XS: "XS";
|
|
83
|
+
readonly SM: "SM";
|
|
84
|
+
readonly MD: "MD";
|
|
85
|
+
readonly LG: "LG";
|
|
86
|
+
readonly XL: "XL";
|
|
87
|
+
}> | undefined;
|
|
88
|
+
readonly order?: number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").GlobalsNumber, {
|
|
89
|
+
readonly XS: "XS";
|
|
90
|
+
readonly SM: "SM";
|
|
91
|
+
readonly MD: "MD";
|
|
92
|
+
readonly LG: "LG";
|
|
93
|
+
readonly XL: "XL";
|
|
94
|
+
}> | undefined;
|
|
95
|
+
readonly size?: "XS" | "SM" | "MD" | "LG" | "XL" | undefined;
|
|
96
|
+
}> & Partial<{
|
|
97
|
+
readonly margin: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
98
|
+
readonly XS: "XS";
|
|
99
|
+
readonly SM: "SM";
|
|
100
|
+
readonly MD: "MD";
|
|
101
|
+
readonly LG: "LG";
|
|
102
|
+
readonly XL: "XL";
|
|
103
|
+
}>;
|
|
104
|
+
readonly marginBottom: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
105
|
+
readonly XS: "XS";
|
|
106
|
+
readonly SM: "SM";
|
|
107
|
+
readonly MD: "MD";
|
|
108
|
+
readonly LG: "LG";
|
|
109
|
+
readonly XL: "XL";
|
|
110
|
+
}>;
|
|
111
|
+
readonly marginLeft: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
112
|
+
readonly XS: "XS";
|
|
113
|
+
readonly SM: "SM";
|
|
114
|
+
readonly MD: "MD";
|
|
115
|
+
readonly LG: "LG";
|
|
116
|
+
readonly XL: "XL";
|
|
117
|
+
}>;
|
|
118
|
+
readonly marginRight: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
119
|
+
readonly XS: "XS";
|
|
120
|
+
readonly SM: "SM";
|
|
121
|
+
readonly MD: "MD";
|
|
122
|
+
readonly LG: "LG";
|
|
123
|
+
readonly XL: "XL";
|
|
124
|
+
}>;
|
|
125
|
+
readonly marginTop: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
126
|
+
readonly XS: "XS";
|
|
127
|
+
readonly SM: "SM";
|
|
128
|
+
readonly MD: "MD";
|
|
129
|
+
readonly LG: "LG";
|
|
130
|
+
readonly XL: "XL";
|
|
131
|
+
}>;
|
|
132
|
+
readonly marginX: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
133
|
+
readonly XS: "XS";
|
|
134
|
+
readonly SM: "SM";
|
|
135
|
+
readonly MD: "MD";
|
|
136
|
+
readonly LG: "LG";
|
|
137
|
+
readonly XL: "XL";
|
|
138
|
+
}>;
|
|
139
|
+
readonly marginY: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
140
|
+
readonly XS: "XS";
|
|
141
|
+
readonly SM: "SM";
|
|
142
|
+
readonly MD: "MD";
|
|
143
|
+
readonly LG: "LG";
|
|
144
|
+
readonly XL: "XL";
|
|
145
|
+
}>;
|
|
146
|
+
readonly padding: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
147
|
+
readonly XS: "XS";
|
|
148
|
+
readonly SM: "SM";
|
|
149
|
+
readonly MD: "MD";
|
|
150
|
+
readonly LG: "LG";
|
|
151
|
+
readonly XL: "XL";
|
|
152
|
+
}>;
|
|
153
|
+
readonly paddingBottom: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
154
|
+
readonly XS: "XS";
|
|
155
|
+
readonly SM: "SM";
|
|
156
|
+
readonly MD: "MD";
|
|
157
|
+
readonly LG: "LG";
|
|
158
|
+
readonly XL: "XL";
|
|
159
|
+
}>;
|
|
160
|
+
readonly paddingLeft: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
161
|
+
readonly XS: "XS";
|
|
162
|
+
readonly SM: "SM";
|
|
163
|
+
readonly MD: "MD";
|
|
164
|
+
readonly LG: "LG";
|
|
165
|
+
readonly XL: "XL";
|
|
166
|
+
}>;
|
|
167
|
+
readonly paddingRight: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
168
|
+
readonly XS: "XS";
|
|
169
|
+
readonly SM: "SM";
|
|
170
|
+
readonly MD: "MD";
|
|
171
|
+
readonly LG: "LG";
|
|
172
|
+
readonly XL: "XL";
|
|
173
|
+
}>;
|
|
174
|
+
readonly paddingTop: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
175
|
+
readonly XS: "XS";
|
|
176
|
+
readonly SM: "SM";
|
|
177
|
+
readonly MD: "MD";
|
|
178
|
+
readonly LG: "LG";
|
|
179
|
+
readonly XL: "XL";
|
|
180
|
+
}>;
|
|
181
|
+
readonly paddingX: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
182
|
+
readonly XS: "XS";
|
|
183
|
+
readonly SM: "SM";
|
|
184
|
+
readonly MD: "MD";
|
|
185
|
+
readonly LG: "LG";
|
|
186
|
+
readonly XL: "XL";
|
|
187
|
+
}>;
|
|
188
|
+
readonly paddingY: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
|
|
189
|
+
readonly XS: "XS";
|
|
190
|
+
readonly SM: "SM";
|
|
191
|
+
readonly MD: "MD";
|
|
192
|
+
readonly LG: "LG";
|
|
193
|
+
readonly XL: "XL";
|
|
194
|
+
}>;
|
|
195
|
+
}> & Pick<FilterProps, "badgeColor">, never>;
|
|
196
|
+
export default IconWrapper;
|
|
197
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Filter/IconWrapper/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAgBvC,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAOhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
|
|
11
|
+
|
|
12
|
+
var _spacing = _interopRequireDefault(require("@decisiv/design-tokens/lib/spacing"));
|
|
13
|
+
|
|
14
|
+
var _Flex = _interopRequireDefault(require("../../Flex"));
|
|
15
|
+
|
|
16
|
+
var _color = _interopRequireDefault(require("../../../modifiers/color"));
|
|
17
|
+
|
|
18
|
+
var _utils = require("../../../utils");
|
|
19
|
+
|
|
20
|
+
var _commonUIColors = require("../../../utils/commonUIColors");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
25
|
+
|
|
26
|
+
var colorModifiers = (0, _utils.applyDynamicModifiers)('badgeColor', function (_ref) {
|
|
27
|
+
var badgeColor = _ref.badgeColor;
|
|
28
|
+
return (0, _styledComponents.css)(["", ";"], badgeColor && badgeColor in _commonUIColors.commonUIColors && (0, _color.default)(_commonUIColors.commonUIColors[badgeColor]));
|
|
29
|
+
});
|
|
30
|
+
var IconWrapper = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
31
|
+
displayName: "IconWrapper",
|
|
32
|
+
componentId: "sc-1e8ws53-0"
|
|
33
|
+
})(["width:", ";height:", ";padding:", ";border-radius:2px;", ";", ";"], (0, _rem.default)(_spacing.default.base * 2), (0, _rem.default)(_spacing.default.base * 2), (0, _rem.default)(_spacing.default.base * 0.4), (0, _color.default)(_commonUIColors.commonUIColors.information), colorModifiers);
|
|
34
|
+
var _default = IconWrapper;
|
|
35
|
+
exports.default = _default;
|