pebble-web 2.25.2 → 2.26.1-alpha.0
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/dist/components/typings/Button.d.ts +1 -0
- package/dist/components/typings/Calendar.d.ts +1 -0
- package/dist/components/typings/CheckboxGroup.d.ts +1 -0
- package/dist/components/typings/Control.d.ts +1 -0
- package/dist/components/typings/DateInput.d.ts +1 -0
- package/dist/components/typings/Dropdown.d.ts +1 -0
- package/dist/components/typings/Input.d.ts +1 -0
- package/dist/components/typings/Loader.d.ts +1 -0
- package/dist/components/typings/Message.d.ts +1 -0
- package/dist/components/typings/OptionGroup.d.ts +1 -0
- package/dist/components/typings/OptionGroupCheckBox.d.ts +1 -0
- package/dist/components/typings/OptionGroupRadio.d.ts +1 -0
- package/dist/components/typings/PhoneNumberInput.d.ts +1 -0
- package/dist/components/typings/PopUp.d.ts +1 -0
- package/dist/components/typings/RadioGroup.d.ts +1 -0
- package/dist/components/typings/Search.d.ts +1 -0
- package/dist/components/typings/SecondaryInput.d.ts +1 -0
- package/dist/components/typings/Select.d.ts +1 -0
- package/dist/components/typings/Text.d.ts +1 -0
- package/dist/components/typings/Typeahead.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/pebble-web.dev.js +358 -164
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +239 -70
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +233 -64
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +352 -158
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +347 -165
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +341 -159
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +360 -166
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +354 -160
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/testIds.d.ts +65 -0
- package/package.json +3 -2
- package/src/components/Button.tsx +3 -1
- package/src/components/Calendar.tsx +28 -4
- package/src/components/CheckboxGroup.tsx +13 -3
- package/src/components/DateInput.tsx +3 -1
- package/src/components/DropDown.tsx +3 -1
- package/src/components/Input.tsx +15 -3
- package/src/components/Loader.tsx +3 -1
- package/src/components/Message.tsx +3 -1
- package/src/components/NativeDateInput.tsx +2 -1
- package/src/components/OptionGroupCheckBox.tsx +14 -2
- package/src/components/PhoneNumberInput.tsx +7 -1
- package/src/components/PopUp.tsx +7 -1
- package/src/components/RadioGroup.tsx +20 -3
- package/src/components/Search.tsx +3 -1
- package/src/components/SecondaryInput.tsx +9 -2
- package/src/components/Select.tsx +13 -1
- package/src/components/Tabs.tsx +1 -1
- package/src/components/Text.tsx +7 -2
- package/src/components/TimePicker.tsx +2 -2
- package/src/components/Toast.tsx +2 -2
- package/src/components/TypeAhead.tsx +14 -3
- package/src/components/__tests__/__snapshots__/checkboxGroup.test.tsx.snap +88 -0
- package/src/components/__tests__/__snapshots__/optionGroup.test.tsx.snap +0 -3
- package/src/components/__tests__/__snapshots__/select.test.tsx.snap +3 -0
- package/src/components/__tests__/__snapshots__/timepicker.test.tsx.snap +18 -18
- package/src/components/__tests__/calendar.test.tsx +6 -24
- package/src/components/__tests__/checkboxGroup.test.tsx +39 -8
- package/src/components/__tests__/select.test.tsx +19 -30
- package/src/components/__tests__/timepicker.test.tsx +4 -14
- package/src/components/shared/Control.tsx +3 -1
- package/src/components/shared/OptionGroup.tsx +23 -5
- package/src/components/typings/Button.ts +1 -0
- package/src/components/typings/Calendar.ts +1 -0
- package/src/components/typings/CheckboxGroup.ts +1 -0
- package/src/components/typings/Control.ts +1 -0
- package/src/components/typings/DateInput.ts +1 -0
- package/src/components/typings/Dropdown.ts +1 -0
- package/src/components/typings/Input.ts +1 -0
- package/src/components/typings/Loader.ts +1 -0
- package/src/components/typings/Message.ts +1 -0
- package/src/components/typings/OptionGroup.ts +1 -0
- package/src/components/typings/OptionGroupCheckBox.ts +1 -0
- package/src/components/typings/OptionGroupRadio.ts +1 -0
- package/src/components/typings/PhoneNumberInput.ts +1 -0
- package/src/components/typings/PopUp.ts +1 -0
- package/src/components/typings/RadioGroup.ts +1 -0
- package/src/components/typings/Search.ts +1 -0
- package/src/components/typings/SecondaryInput.ts +1 -0
- package/src/components/typings/Select.ts +1 -0
- package/src/components/typings/Text.ts +1 -0
- package/src/components/typings/Typeahead.ts +1 -0
- package/src/index.ts +1 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/testIds.ts +119 -0
package/dist/pebble-web.es.js
CHANGED
|
@@ -431,7 +431,8 @@ const spinnerStyle = /*#__PURE__*/css({ ...flexSpaceBetween,
|
|
|
431
431
|
const Loader = ({
|
|
432
432
|
color = colors.gray.darker,
|
|
433
433
|
scale = 1,
|
|
434
|
-
className
|
|
434
|
+
className,
|
|
435
|
+
testId
|
|
435
436
|
}) => {
|
|
436
437
|
const style = {
|
|
437
438
|
backgroundColor: color
|
|
@@ -440,7 +441,8 @@ const Loader = ({
|
|
|
440
441
|
className: cx(spinnerStyle, className),
|
|
441
442
|
style: {
|
|
442
443
|
transform: `scale(${scale})`
|
|
443
|
-
}
|
|
444
|
+
},
|
|
445
|
+
"data-testid": testId
|
|
444
446
|
}, /*#__PURE__*/createElement("div", {
|
|
445
447
|
style: style
|
|
446
448
|
}), /*#__PURE__*/createElement("div", {
|
|
@@ -462,7 +464,8 @@ const Button = ({
|
|
|
462
464
|
loading,
|
|
463
465
|
outline,
|
|
464
466
|
size = "small",
|
|
465
|
-
buttonProps
|
|
467
|
+
buttonProps,
|
|
468
|
+
testId
|
|
466
469
|
}) => {
|
|
467
470
|
const disableAction = disabled || loading;
|
|
468
471
|
const _outline = size === "x-small" || !!outline;
|
|
@@ -473,7 +476,8 @@ const Button = ({
|
|
|
473
476
|
style: {
|
|
474
477
|
width
|
|
475
478
|
},
|
|
476
|
-
disabled: disabled
|
|
479
|
+
disabled: disabled,
|
|
480
|
+
"data-testid": testId
|
|
477
481
|
}, buttonProps), loading ? /*#__PURE__*/createElement(Loader, {
|
|
478
482
|
color: colors.white.base,
|
|
479
483
|
scale: 0.4
|
|
@@ -621,6 +625,76 @@ const buttonsWrapper = /*#__PURE__*/css({ ...flexSpaceBetween,
|
|
|
621
625
|
marginTop: 20
|
|
622
626
|
}, ";label:buttonsWrapper;" + ( "" ));
|
|
623
627
|
|
|
628
|
+
function getTestIds(id, builder) {
|
|
629
|
+
return id ? builder(id) : {};
|
|
630
|
+
}
|
|
631
|
+
function getOptionTestId(id, index) {
|
|
632
|
+
return `${id}-${index}`;
|
|
633
|
+
}
|
|
634
|
+
function getRadioGroupTestIds(id) {
|
|
635
|
+
return {
|
|
636
|
+
optionId: `${id}-option`
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
function getOptionGroupTestIds(id) {
|
|
640
|
+
return {
|
|
641
|
+
searchBoxId: `${id}-search`,
|
|
642
|
+
optionId: `${id}-option`,
|
|
643
|
+
selectVisibleId: `${id}-select-visible`,
|
|
644
|
+
clearVisibleId: `${id}-clear-visible`
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
const getOptionGroupRadioTestIds = id => getOptionGroupTestIds(id);
|
|
648
|
+
function getOptionGroupCheckBoxTestIds(id) {
|
|
649
|
+
return {
|
|
650
|
+
applyButtonId: `${id}-apply-btn`,
|
|
651
|
+
clearButtonId: `${id}-clear-btn`,
|
|
652
|
+
...getOptionGroupTestIds(id)
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function getPhoneNumberInputTestIds(id) {
|
|
656
|
+
return {
|
|
657
|
+
phoneId: `${id}-phone`,
|
|
658
|
+
countryId: `${id}-country`,
|
|
659
|
+
countryInputIds: getSelectInputTestIds(`${id}-country`)
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
function getMessageTestId(id) {
|
|
663
|
+
return `${id}-message`;
|
|
664
|
+
}
|
|
665
|
+
function getSelectInputTestIds(id, multiSelect = false) {
|
|
666
|
+
const optionGroupId = `${id}-option-group`;
|
|
667
|
+
const baseIds = {
|
|
668
|
+
inputId: `${id}-input`,
|
|
669
|
+
optionGroupId
|
|
670
|
+
};
|
|
671
|
+
return { ...(multiSelect ? getOptionGroupCheckBoxTestIds(optionGroupId) : getOptionGroupRadioTestIds(optionGroupId)),
|
|
672
|
+
...baseIds
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function getTypeaheadTestIds(id) {
|
|
676
|
+
const optionGroupId = `${id}-option-group`;
|
|
677
|
+
return {
|
|
678
|
+
optionGroupId,
|
|
679
|
+
...getOptionGroupRadioTestIds(optionGroupId)
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function getCalendarTestIds(id) {
|
|
683
|
+
return {
|
|
684
|
+
leftIconId: `${id}-left-icon`,
|
|
685
|
+
rightIconId: `${id}-right-icon`,
|
|
686
|
+
applyButtonId: `${id}-apply-btn`,
|
|
687
|
+
clearButtonId: `${id}-clear-btn`
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function getPopUpTestIds(id) {
|
|
691
|
+
return {
|
|
692
|
+
closeButtonId: `${id}-close-btn`,
|
|
693
|
+
approveButtonId: `${id}-approve-btn`,
|
|
694
|
+
rejectButtonId: `${id}-reject-btn`
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
|
|
624
698
|
class Calendar extends PureComponent {
|
|
625
699
|
constructor() {
|
|
626
700
|
super(...arguments);
|
|
@@ -734,11 +808,18 @@ class Calendar extends PureComponent {
|
|
|
734
808
|
onClear,
|
|
735
809
|
maxDate,
|
|
736
810
|
minDate,
|
|
811
|
+
testId,
|
|
737
812
|
...rest
|
|
738
813
|
} = this.props;
|
|
739
814
|
const {
|
|
740
815
|
maxRangeDates
|
|
741
816
|
} = this.state;
|
|
817
|
+
const {
|
|
818
|
+
leftIconId,
|
|
819
|
+
rightIconId,
|
|
820
|
+
clearButtonId,
|
|
821
|
+
applyButtonId
|
|
822
|
+
} = getTestIds(testId, id => getCalendarTestIds(id));
|
|
742
823
|
return /*#__PURE__*/createElement("div", {
|
|
743
824
|
className: cx(wrapperStyle, {
|
|
744
825
|
[/*#__PURE__*/css( {
|
|
@@ -763,13 +844,15 @@ class Calendar extends PureComponent {
|
|
|
763
844
|
style: {
|
|
764
845
|
fontSize: 14
|
|
765
846
|
},
|
|
766
|
-
className: "pi pi-chevron-left"
|
|
847
|
+
className: "pi pi-chevron-left",
|
|
848
|
+
"data-testid": leftIconId
|
|
767
849
|
}),
|
|
768
850
|
nextLabel: /*#__PURE__*/createElement("i", {
|
|
769
851
|
style: {
|
|
770
852
|
fontSize: 14
|
|
771
853
|
},
|
|
772
|
-
className: "pi pi-arrow-right"
|
|
854
|
+
className: "pi pi-arrow-right",
|
|
855
|
+
"data-testid": rightIconId
|
|
773
856
|
}),
|
|
774
857
|
maxDate: maxDate || maxRangeDates && maxRangeDates.future,
|
|
775
858
|
minDate: minDate || maxRangeDates && maxRangeDates.past
|
|
@@ -777,9 +860,11 @@ class Calendar extends PureComponent {
|
|
|
777
860
|
className: buttonsWrapper
|
|
778
861
|
}, onClear && /*#__PURE__*/createElement(Button, {
|
|
779
862
|
onClick: this.onClear,
|
|
780
|
-
type: "secondary"
|
|
863
|
+
type: "secondary",
|
|
864
|
+
testId: clearButtonId
|
|
781
865
|
}, "Clear"), onApply && /*#__PURE__*/createElement(Button, {
|
|
782
|
-
onClick: this.onApply
|
|
866
|
+
onClick: this.onApply,
|
|
867
|
+
testId: applyButtonId
|
|
783
868
|
}, "Apply")));
|
|
784
869
|
}
|
|
785
870
|
}
|
|
@@ -817,7 +902,8 @@ function Control(props) {
|
|
|
817
902
|
children = ControlView,
|
|
818
903
|
type,
|
|
819
904
|
className,
|
|
820
|
-
indeterminate
|
|
905
|
+
indeterminate,
|
|
906
|
+
testId
|
|
821
907
|
} = props;
|
|
822
908
|
return /*#__PURE__*/createElement("div", {
|
|
823
909
|
className: cx(controlStyle, className),
|
|
@@ -830,7 +916,8 @@ function Control(props) {
|
|
|
830
916
|
onClick: !disabled ? e => onChange && onChange({
|
|
831
917
|
value,
|
|
832
918
|
checked: !checked
|
|
833
|
-
}, e) : undefined
|
|
919
|
+
}, e) : undefined,
|
|
920
|
+
"data-testid": testId
|
|
834
921
|
}, children(props));
|
|
835
922
|
}
|
|
836
923
|
const ControlView = ({
|
|
@@ -906,14 +993,17 @@ class CheckboxGroup extends PureComponent {
|
|
|
906
993
|
selected,
|
|
907
994
|
className,
|
|
908
995
|
name,
|
|
909
|
-
disabled
|
|
996
|
+
disabled,
|
|
997
|
+
testId
|
|
910
998
|
} = this.props;
|
|
911
|
-
const _children = Children.map(children, _checkbox => {
|
|
999
|
+
const _children = Children.map(children, (_checkbox, i) => {
|
|
1000
|
+
const index = typeof i === "number" ? i : 0;
|
|
912
1001
|
const checkbox = _checkbox;
|
|
913
1002
|
return cloneElement(checkbox, {
|
|
914
1003
|
onChange: this.handleChange,
|
|
915
1004
|
checked: selected.indexOf(checkbox.props.value) >= 0,
|
|
916
|
-
disabled
|
|
1005
|
+
disabled,
|
|
1006
|
+
testId: testId ? getOptionTestId(testId, index) : undefined
|
|
917
1007
|
});
|
|
918
1008
|
});
|
|
919
1009
|
return /*#__PURE__*/createElement("div", {
|
|
@@ -1031,7 +1121,8 @@ class DropDown extends PureComponent {
|
|
|
1031
1121
|
disabled,
|
|
1032
1122
|
labelClassName,
|
|
1033
1123
|
controlled,
|
|
1034
|
-
onOutsideClick
|
|
1124
|
+
onOutsideClick,
|
|
1125
|
+
testId
|
|
1035
1126
|
} = this.props;
|
|
1036
1127
|
const _isDropDownOpen = controlled ? !!this.props.isOpen : this.state.isOpen;
|
|
1037
1128
|
return /*#__PURE__*/createElement(OutsideClick, {
|
|
@@ -1059,7 +1150,8 @@ class DropDown extends PureComponent {
|
|
|
1059
1150
|
isOpen: _isDropDownOpen,
|
|
1060
1151
|
onClick: this.toggleDropdown,
|
|
1061
1152
|
disabled: disabled,
|
|
1062
|
-
className: labelClassName
|
|
1153
|
+
className: labelClassName,
|
|
1154
|
+
testId: testId
|
|
1063
1155
|
}, buttonLabel))), /*#__PURE__*/createElement(MountTransition, {
|
|
1064
1156
|
visible: _isDropDownOpen
|
|
1065
1157
|
}, transitionStyles => /*#__PURE__*/createElement(animated.div, {
|
|
@@ -1267,7 +1359,8 @@ class Input extends PureComponent {
|
|
|
1267
1359
|
onClick,
|
|
1268
1360
|
loading,
|
|
1269
1361
|
leftElement,
|
|
1270
|
-
rightElement
|
|
1362
|
+
rightElement,
|
|
1363
|
+
testId
|
|
1271
1364
|
} = this.props;
|
|
1272
1365
|
const {
|
|
1273
1366
|
isFocused
|
|
@@ -1307,9 +1400,13 @@ class Input extends PureComponent {
|
|
|
1307
1400
|
onClick: onClick
|
|
1308
1401
|
}, /*#__PURE__*/createElement("div", {
|
|
1309
1402
|
className: _inputWrapperClassName
|
|
1310
|
-
}, leftElement === null || leftElement === void 0 ? void 0 : leftElement(), this.props.textArea ? /*#__PURE__*/createElement("textarea", Object.assign({}, _inputProps, this.props.inputProps
|
|
1403
|
+
}, leftElement === null || leftElement === void 0 ? void 0 : leftElement(), this.props.textArea ? /*#__PURE__*/createElement("textarea", Object.assign({}, _inputProps, this.props.inputProps, {
|
|
1404
|
+
"data-testid": testId
|
|
1405
|
+
})) : /*#__PURE__*/createElement("input", Object.assign({
|
|
1311
1406
|
type: type
|
|
1312
|
-
}, _inputProps, this.props.inputProps
|
|
1407
|
+
}, _inputProps, this.props.inputProps, {
|
|
1408
|
+
"data-testid": testId
|
|
1409
|
+
})), loading && /*#__PURE__*/createElement(Loader, {
|
|
1313
1410
|
color: colors.violet.base,
|
|
1314
1411
|
scale: 0.6,
|
|
1315
1412
|
className: _loadingStyle
|
|
@@ -1326,6 +1423,7 @@ class Input extends PureComponent {
|
|
|
1326
1423
|
}
|
|
1327
1424
|
}), _message && /*#__PURE__*/createElement("div", {
|
|
1328
1425
|
className: messageStyle,
|
|
1426
|
+
"data-testid": testId ? getMessageTestId(testId) : undefined,
|
|
1329
1427
|
style: {
|
|
1330
1428
|
color: getColor(errorMessage, successMessage)
|
|
1331
1429
|
}
|
|
@@ -1350,7 +1448,8 @@ class NativeDateInput extends PureComponent {
|
|
|
1350
1448
|
inputProps,
|
|
1351
1449
|
placeholder,
|
|
1352
1450
|
value,
|
|
1353
|
-
disabled
|
|
1451
|
+
disabled,
|
|
1452
|
+
testId
|
|
1354
1453
|
} = this.props;
|
|
1355
1454
|
return /*#__PURE__*/createElement(Input, Object.assign({
|
|
1356
1455
|
onChange: this.onDateInputChange,
|
|
@@ -1360,7 +1459,8 @@ class NativeDateInput extends PureComponent {
|
|
|
1360
1459
|
placeholder: placeholder,
|
|
1361
1460
|
fixLabelAtTop: true
|
|
1362
1461
|
}, inputProps, {
|
|
1363
|
-
disabled: disabled
|
|
1462
|
+
disabled: disabled,
|
|
1463
|
+
testId: testId
|
|
1364
1464
|
}));
|
|
1365
1465
|
}
|
|
1366
1466
|
}
|
|
@@ -1449,7 +1549,8 @@ class DateInput extends PureComponent {
|
|
|
1449
1549
|
initiallyOpen,
|
|
1450
1550
|
onOutsideClick,
|
|
1451
1551
|
controlled,
|
|
1452
|
-
isOpen
|
|
1552
|
+
isOpen,
|
|
1553
|
+
testId
|
|
1453
1554
|
} = this.props;
|
|
1454
1555
|
const _wrapperClassName = cx(wrapperStyle$3, wrapperClassName);
|
|
1455
1556
|
const _dropDownClassName = cx(dropDownClassName, this.props.dropDownClassName);
|
|
@@ -1481,7 +1582,8 @@ class DateInput extends PureComponent {
|
|
|
1481
1582
|
onChange
|
|
1482
1583
|
},
|
|
1483
1584
|
className: cx(inputStyle$1, inputProps && inputProps.className),
|
|
1484
|
-
disabled: disabled
|
|
1585
|
+
disabled: disabled,
|
|
1586
|
+
testId: testId
|
|
1485
1587
|
}))),
|
|
1486
1588
|
className: _wrapperClassName,
|
|
1487
1589
|
placement: placement,
|
|
@@ -1748,11 +1850,11 @@ class Toast extends PureComponent {
|
|
|
1748
1850
|
emitter.emit("hideToast");
|
|
1749
1851
|
}
|
|
1750
1852
|
componentDidMount() {
|
|
1751
|
-
emitter.on("showToast", this.show);
|
|
1853
|
+
emitter.on("showToast", e => e && this.show(e));
|
|
1752
1854
|
emitter.on("hideToast", this.hide);
|
|
1753
1855
|
}
|
|
1754
1856
|
componentWillUnmount() {
|
|
1755
|
-
emitter.off("showToast", this.show);
|
|
1857
|
+
emitter.off("showToast", e => e && this.show(e));
|
|
1756
1858
|
emitter.off("hideToast", this.hide);
|
|
1757
1859
|
}
|
|
1758
1860
|
render() {
|
|
@@ -1809,7 +1911,8 @@ const messageWrapper = /*#__PURE__*/css({
|
|
|
1809
1911
|
const Message = ({
|
|
1810
1912
|
intent,
|
|
1811
1913
|
className,
|
|
1812
|
-
text
|
|
1914
|
+
text,
|
|
1915
|
+
testId
|
|
1813
1916
|
}) => {
|
|
1814
1917
|
const bColor = _colors[intent];
|
|
1815
1918
|
const iconClass = cx("pi", {
|
|
@@ -1820,7 +1923,8 @@ const Message = ({
|
|
|
1820
1923
|
className: cx(messageWrapper, className),
|
|
1821
1924
|
style: {
|
|
1822
1925
|
backgroundColor: bColor
|
|
1823
|
-
}
|
|
1926
|
+
},
|
|
1927
|
+
"data-testid": testId
|
|
1824
1928
|
}, /*#__PURE__*/createElement("i", {
|
|
1825
1929
|
className: iconClass
|
|
1826
1930
|
}), text);
|
|
@@ -2035,7 +2139,8 @@ class Search extends PureComponent {
|
|
|
2035
2139
|
className,
|
|
2036
2140
|
clearable,
|
|
2037
2141
|
value,
|
|
2038
|
-
loading
|
|
2142
|
+
loading,
|
|
2143
|
+
testId
|
|
2039
2144
|
} = this.props;
|
|
2040
2145
|
const wrapperClassName = cx(searchWrapperStyle, {
|
|
2041
2146
|
__pebble__search__small: type === "small",
|
|
@@ -2056,7 +2161,9 @@ class Search extends PureComponent {
|
|
|
2056
2161
|
},
|
|
2057
2162
|
ref: this.searchInputRef,
|
|
2058
2163
|
value: value
|
|
2059
|
-
}, inputProps
|
|
2164
|
+
}, inputProps, {
|
|
2165
|
+
"data-testid": testId
|
|
2166
|
+
})), loading && /*#__PURE__*/createElement(Loader, {
|
|
2060
2167
|
scale: 0.4,
|
|
2061
2168
|
color: colors.violet.base
|
|
2062
2169
|
}), clearable && /*#__PURE__*/createElement("div", {
|
|
@@ -2199,12 +2306,14 @@ class OptionGroup extends PureComponent {
|
|
|
2199
2306
|
className,
|
|
2200
2307
|
isSelected,
|
|
2201
2308
|
handleChange,
|
|
2202
|
-
searchBoxProps
|
|
2309
|
+
searchBoxProps,
|
|
2310
|
+
testId
|
|
2203
2311
|
} = this.props;
|
|
2204
2312
|
const {
|
|
2205
2313
|
isScrolled,
|
|
2206
2314
|
highlighted
|
|
2207
2315
|
} = this.state;
|
|
2316
|
+
const testIds = getTestIds(testId, getOptionGroupTestIds);
|
|
2208
2317
|
const _children = Children.map(children, (_option, i) => {
|
|
2209
2318
|
const option = _option;
|
|
2210
2319
|
let ref = this.optionsRefsSet.get(i);
|
|
@@ -2217,7 +2326,8 @@ class OptionGroup extends PureComponent {
|
|
|
2217
2326
|
isActive: highlighted === i,
|
|
2218
2327
|
isSelected: isSelected(option.props.value),
|
|
2219
2328
|
multiSelect,
|
|
2220
|
-
ref
|
|
2329
|
+
ref,
|
|
2330
|
+
testId: testIds.optionId ? getOptionTestId(testIds.optionId, i) : undefined
|
|
2221
2331
|
});
|
|
2222
2332
|
});
|
|
2223
2333
|
const searchBoxClassName = cx(searchBoxWrapper, {
|
|
@@ -2232,7 +2342,8 @@ class OptionGroup extends PureComponent {
|
|
|
2232
2342
|
inputProps: { ...(searchBoxProps && searchBoxProps.inputProps),
|
|
2233
2343
|
onKeyDown: this.handleKeyPress,
|
|
2234
2344
|
autoFocus: true
|
|
2235
|
-
}
|
|
2345
|
+
},
|
|
2346
|
+
testId: testIds.searchBoxId
|
|
2236
2347
|
}))), !!Children.count(children) && /*#__PURE__*/createElement("div", {
|
|
2237
2348
|
ref: this.optionRef,
|
|
2238
2349
|
style: {
|
|
@@ -2240,14 +2351,16 @@ class OptionGroup extends PureComponent {
|
|
|
2240
2351
|
},
|
|
2241
2352
|
className: cx(optionsWrapper, className),
|
|
2242
2353
|
role: multiSelect ? "group" : "radiogroup",
|
|
2243
|
-
"data-
|
|
2354
|
+
"data-testid": testId,
|
|
2244
2355
|
"aria-label": searchBoxProps && searchBoxProps.placeholder
|
|
2245
2356
|
}, advancedOptions && advancedOptionsProps && /*#__PURE__*/createElement("div", {
|
|
2246
2357
|
className: _class
|
|
2247
2358
|
}, /*#__PURE__*/createElement("div", {
|
|
2248
|
-
onClick: advancedOptionsProps.selectVisible
|
|
2359
|
+
onClick: advancedOptionsProps.selectVisible,
|
|
2360
|
+
"data-testid": testIds.selectVisibleId
|
|
2249
2361
|
}, "Select Visible"), /*#__PURE__*/createElement("div", {
|
|
2250
|
-
onClick: advancedOptionsProps.clearVisible
|
|
2362
|
+
onClick: advancedOptionsProps.clearVisible,
|
|
2363
|
+
"data-testid": testIds.clearVisibleId
|
|
2251
2364
|
}, "Clear Visible")), _children));
|
|
2252
2365
|
}
|
|
2253
2366
|
}
|
|
@@ -2312,6 +2425,7 @@ class OptionGroupCheckBox extends PureComponent {
|
|
|
2312
2425
|
onClear,
|
|
2313
2426
|
isSelected,
|
|
2314
2427
|
onChange,
|
|
2428
|
+
testId,
|
|
2315
2429
|
...rest
|
|
2316
2430
|
} = this.props;
|
|
2317
2431
|
const advancedOptionsProps = {
|
|
@@ -2319,20 +2433,24 @@ class OptionGroupCheckBox extends PureComponent {
|
|
|
2319
2433
|
clearVisible: this.clearVisible,
|
|
2320
2434
|
...this.props.advancedOptionsProps
|
|
2321
2435
|
};
|
|
2436
|
+
const testIds = getTestIds(testId, getOptionGroupCheckBoxTestIds);
|
|
2322
2437
|
return /*#__PURE__*/createElement("div", {
|
|
2323
2438
|
className: cx(optionGroupCheckBoxWrap, wrapClassName)
|
|
2324
2439
|
}, /*#__PURE__*/createElement(OptionGroup, Object.assign({}, rest, {
|
|
2325
2440
|
advancedOptionsProps: advancedOptionsProps,
|
|
2326
2441
|
isSelected: isSelected || this.isSelected,
|
|
2327
2442
|
handleChange: this.handleChange,
|
|
2328
|
-
multiSelect: true
|
|
2443
|
+
multiSelect: true,
|
|
2444
|
+
testId: testId
|
|
2329
2445
|
})), (onApply || onClear) && /*#__PURE__*/createElement("div", {
|
|
2330
2446
|
className: optionGroupCheckBoxButtonWrap
|
|
2331
2447
|
}, onClear && /*#__PURE__*/createElement(Button, {
|
|
2332
2448
|
type: "secondary",
|
|
2333
|
-
onClick: onClear
|
|
2449
|
+
onClick: onClear,
|
|
2450
|
+
testId: testIds.clearButtonId
|
|
2334
2451
|
}, "Clear"), onApply && /*#__PURE__*/createElement(Button, {
|
|
2335
|
-
onClick: this.onApply
|
|
2452
|
+
onClick: this.onApply,
|
|
2453
|
+
testId: testIds.applyButtonId
|
|
2336
2454
|
}, "Apply")));
|
|
2337
2455
|
}
|
|
2338
2456
|
}
|
|
@@ -2431,8 +2549,11 @@ function Select(props) {
|
|
|
2431
2549
|
disabled,
|
|
2432
2550
|
isSelected,
|
|
2433
2551
|
placement,
|
|
2434
|
-
modifiers
|
|
2552
|
+
modifiers,
|
|
2553
|
+
testId
|
|
2435
2554
|
} = props;
|
|
2555
|
+
const singleSelectTestIds = getTestIds(testId, id => getSelectInputTestIds(id, false));
|
|
2556
|
+
const multiSelectTestIds = getTestIds(testId, id => getSelectInputTestIds(id, true));
|
|
2436
2557
|
return /*#__PURE__*/createElement("div", {
|
|
2437
2558
|
className: cx(selectWrapper, className, {
|
|
2438
2559
|
[relativePosition]: !!fullWidthDropdown
|
|
@@ -2454,7 +2575,8 @@ function Select(props) {
|
|
|
2454
2575
|
onClick: disabled ? undefined : () => {
|
|
2455
2576
|
toggleDropdown();
|
|
2456
2577
|
onDropdownToggle(isOpen);
|
|
2457
|
-
}
|
|
2578
|
+
},
|
|
2579
|
+
"data-testid": singleSelectTestIds.inputId
|
|
2458
2580
|
}, /*#__PURE__*/createElement(Input, Object.assign({
|
|
2459
2581
|
className: selectInputWrapper,
|
|
2460
2582
|
inputClassName: selectInput,
|
|
@@ -2503,7 +2625,9 @@ function Select(props) {
|
|
|
2503
2625
|
onDropdownToggle(isOpen);
|
|
2504
2626
|
toggle();
|
|
2505
2627
|
})
|
|
2506
|
-
}, commonProps
|
|
2628
|
+
}, commonProps, {
|
|
2629
|
+
testId: multiSelectTestIds.optionGroupId
|
|
2630
|
+
}), children);
|
|
2507
2631
|
} else {
|
|
2508
2632
|
return /*#__PURE__*/createElement(OptionGroupRadio, Object.assign({
|
|
2509
2633
|
selected: props.selected,
|
|
@@ -2512,7 +2636,9 @@ function Select(props) {
|
|
|
2512
2636
|
onDropdownToggle(isOpen);
|
|
2513
2637
|
toggle();
|
|
2514
2638
|
}
|
|
2515
|
-
}, commonProps
|
|
2639
|
+
}, commonProps, {
|
|
2640
|
+
testId: singleSelectTestIds.optionGroupId
|
|
2641
|
+
}), children);
|
|
2516
2642
|
}
|
|
2517
2643
|
}));
|
|
2518
2644
|
}
|
|
@@ -2558,8 +2684,10 @@ class PhoneNumberInput extends Component {
|
|
|
2558
2684
|
selectProps,
|
|
2559
2685
|
inputProps,
|
|
2560
2686
|
required,
|
|
2561
|
-
placeholder
|
|
2687
|
+
placeholder,
|
|
2688
|
+
testId
|
|
2562
2689
|
} = this.props;
|
|
2690
|
+
const testIds = getTestIds(testId, getPhoneNumberInputTestIds);
|
|
2563
2691
|
return /*#__PURE__*/createElement("div", {
|
|
2564
2692
|
className: cx(wrapper, className)
|
|
2565
2693
|
}, /*#__PURE__*/createElement("label", {
|
|
@@ -2574,12 +2702,15 @@ class PhoneNumberInput extends Component {
|
|
|
2574
2702
|
value: countryCode + "",
|
|
2575
2703
|
selected: countryCode
|
|
2576
2704
|
}, selectProps, {
|
|
2577
|
-
className: cx(selectStyle, selectProps && selectProps.className)
|
|
2705
|
+
className: cx(selectStyle, selectProps && selectProps.className),
|
|
2706
|
+
testId: testIds.countryId
|
|
2578
2707
|
}), this.props.children), /*#__PURE__*/createElement(Input, Object.assign({
|
|
2579
2708
|
onChange: this.onNumberChange,
|
|
2580
2709
|
placeholder: "",
|
|
2581
2710
|
value: phone
|
|
2582
|
-
}, inputProps
|
|
2711
|
+
}, inputProps, {
|
|
2712
|
+
testId: testIds.phoneId
|
|
2713
|
+
})));
|
|
2583
2714
|
}
|
|
2584
2715
|
}
|
|
2585
2716
|
|
|
@@ -2730,8 +2861,14 @@ const PopUp = props => {
|
|
|
2730
2861
|
rejectButtonText = "No",
|
|
2731
2862
|
children,
|
|
2732
2863
|
approveButtonProps,
|
|
2733
|
-
rejectButtonProps
|
|
2864
|
+
rejectButtonProps,
|
|
2865
|
+
testId
|
|
2734
2866
|
} = props;
|
|
2867
|
+
const {
|
|
2868
|
+
closeButtonId,
|
|
2869
|
+
approveButtonId,
|
|
2870
|
+
rejectButtonId
|
|
2871
|
+
} = getTestIds(testId, id => getPopUpTestIds(id));
|
|
2735
2872
|
return /*#__PURE__*/createElement(Modal, {
|
|
2736
2873
|
visible: visible,
|
|
2737
2874
|
modalClassName: flexCenter
|
|
@@ -2739,18 +2876,23 @@ const PopUp = props => {
|
|
|
2739
2876
|
className: modalContainer$1
|
|
2740
2877
|
}, onClose && /*#__PURE__*/createElement("i", {
|
|
2741
2878
|
className: cx("pi", "pi-close", iconCloseClassName),
|
|
2742
|
-
onClick: onClose
|
|
2879
|
+
onClick: onClose,
|
|
2880
|
+
"data-testid": closeButtonId
|
|
2743
2881
|
}), children, (onReject || onApprove) && /*#__PURE__*/createElement("div", {
|
|
2744
2882
|
className: buttonsContainer
|
|
2745
2883
|
}, onReject && /*#__PURE__*/createElement(Button, Object.assign({
|
|
2746
2884
|
size: "large",
|
|
2747
2885
|
type: "secondary",
|
|
2748
2886
|
onClick: onReject
|
|
2749
|
-
}, rejectButtonProps
|
|
2887
|
+
}, rejectButtonProps, {
|
|
2888
|
+
testId: rejectButtonId
|
|
2889
|
+
}), rejectButtonText), onApprove && /*#__PURE__*/createElement(Button, Object.assign({
|
|
2750
2890
|
size: "large",
|
|
2751
2891
|
type: "primary",
|
|
2752
2892
|
onClick: onApprove
|
|
2753
|
-
}, approveButtonProps
|
|
2893
|
+
}, approveButtonProps, {
|
|
2894
|
+
testId: approveButtonId
|
|
2895
|
+
}), approveButtonText))));
|
|
2754
2896
|
};
|
|
2755
2897
|
|
|
2756
2898
|
const selectedTabStyle = /*#__PURE__*/css({
|
|
@@ -2799,7 +2941,7 @@ class Tabs extends PureComponent {
|
|
|
2799
2941
|
const isSelected = this.state.selectedTab === tab;
|
|
2800
2942
|
return /*#__PURE__*/createElement("span", {
|
|
2801
2943
|
key: `${tab}-${i}`,
|
|
2802
|
-
"data-
|
|
2944
|
+
"data-testid": `${tab.replace(/\d/g, "").replace("(", "").replace(")", "").trim()}`,
|
|
2803
2945
|
className: cx(_className, isSelected && selectedTabStyle, isSelected && this.props.selectedTabClassName),
|
|
2804
2946
|
onClick: () => {
|
|
2805
2947
|
this.setState({
|
|
@@ -2965,14 +3107,17 @@ class RadioGroup extends PureComponent {
|
|
|
2965
3107
|
selected,
|
|
2966
3108
|
className,
|
|
2967
3109
|
name,
|
|
2968
|
-
disabled
|
|
3110
|
+
disabled,
|
|
3111
|
+
testId
|
|
2969
3112
|
} = this.props;
|
|
2970
|
-
const
|
|
3113
|
+
const testIds = getTestIds(testId, getRadioGroupTestIds);
|
|
3114
|
+
const _children = Children.map(children, (_radio, i) => {
|
|
2971
3115
|
const radio = _radio;
|
|
2972
3116
|
return cloneElement(radio, {
|
|
2973
3117
|
onChange: this.handleChange,
|
|
2974
3118
|
checked: selected === radio.props.value,
|
|
2975
|
-
disabled
|
|
3119
|
+
disabled,
|
|
3120
|
+
testId: testIds.optionId ? getOptionTestId(testIds.optionId, i) : undefined
|
|
2976
3121
|
});
|
|
2977
3122
|
});
|
|
2978
3123
|
return /*#__PURE__*/createElement("div", {
|
|
@@ -3173,7 +3318,8 @@ class SecondaryInput extends PureComponent {
|
|
|
3173
3318
|
message,
|
|
3174
3319
|
readOnly,
|
|
3175
3320
|
loading,
|
|
3176
|
-
className
|
|
3321
|
+
className,
|
|
3322
|
+
testId
|
|
3177
3323
|
} = this.props;
|
|
3178
3324
|
const {
|
|
3179
3325
|
isFocused
|
|
@@ -3203,7 +3349,9 @@ class SecondaryInput extends PureComponent {
|
|
|
3203
3349
|
},
|
|
3204
3350
|
onFocus: this.addFocus,
|
|
3205
3351
|
onBlur: this.removeFocus
|
|
3206
|
-
}, /*#__PURE__*/createElement("input", Object.assign({}, _inputProps, this.props.inputProps
|
|
3352
|
+
}, /*#__PURE__*/createElement("input", Object.assign({}, _inputProps, this.props.inputProps, {
|
|
3353
|
+
"data-testid": testId
|
|
3354
|
+
})), /*#__PURE__*/createElement("label", {
|
|
3207
3355
|
className: placeholderClassName
|
|
3208
3356
|
}, placeholder, required && /*#__PURE__*/createElement("span", {
|
|
3209
3357
|
style: {
|
|
@@ -3216,6 +3364,7 @@ class SecondaryInput extends PureComponent {
|
|
|
3216
3364
|
scale: 0.4
|
|
3217
3365
|
})), _message && /*#__PURE__*/createElement("div", {
|
|
3218
3366
|
className: messageStyle$1,
|
|
3367
|
+
"data-testid": testId ? getMessageTestId(testId) : undefined,
|
|
3219
3368
|
style: {
|
|
3220
3369
|
color: getColor$1(errorMessage, successMessage)
|
|
3221
3370
|
}
|
|
@@ -3828,13 +3977,15 @@ const Text = ({
|
|
|
3828
3977
|
typography,
|
|
3829
3978
|
color = colors.gray.darker,
|
|
3830
3979
|
children,
|
|
3831
|
-
className
|
|
3980
|
+
className,
|
|
3981
|
+
testId
|
|
3832
3982
|
}) => {
|
|
3833
3983
|
const _className = /*#__PURE__*/css({ ...typography,
|
|
3834
3984
|
color
|
|
3835
3985
|
}, "" );
|
|
3836
3986
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
3837
|
-
className: cx(_className, className)
|
|
3987
|
+
className: cx(_className, className),
|
|
3988
|
+
"data-testid": testId
|
|
3838
3989
|
}, children);
|
|
3839
3990
|
};
|
|
3840
3991
|
|
|
@@ -3921,7 +4072,7 @@ const TimePicker = props => {
|
|
|
3921
4072
|
toggleDropdown();
|
|
3922
4073
|
},
|
|
3923
4074
|
className: buttonStyle,
|
|
3924
|
-
"data-
|
|
4075
|
+
"data-testid": "hour-label"
|
|
3925
4076
|
}, /*#__PURE__*/createElement("span", {
|
|
3926
4077
|
className: /*#__PURE__*/css( {
|
|
3927
4078
|
name: "1czd1rs-TimePicker",
|
|
@@ -3964,7 +4115,7 @@ const TimePicker = props => {
|
|
|
3964
4115
|
toggleDropdown();
|
|
3965
4116
|
},
|
|
3966
4117
|
className: buttonStyle,
|
|
3967
|
-
"data-
|
|
4118
|
+
"data-testid": "minute-label"
|
|
3968
4119
|
}, /*#__PURE__*/createElement("span", {
|
|
3969
4120
|
className: /*#__PURE__*/css( {
|
|
3970
4121
|
name: "1czd1rs-TimePicker",
|
|
@@ -4089,7 +4240,8 @@ function defaultSearchBox({
|
|
|
4089
4240
|
errorMessage: props.errorMessage,
|
|
4090
4241
|
loading: props.loading,
|
|
4091
4242
|
required: props.required,
|
|
4092
|
-
disabled: props.disabled
|
|
4243
|
+
disabled: props.disabled,
|
|
4244
|
+
testId: props.testId
|
|
4093
4245
|
}));
|
|
4094
4246
|
}
|
|
4095
4247
|
class TypeAhead extends PureComponent {
|
|
@@ -4126,8 +4278,10 @@ class TypeAhead extends PureComponent {
|
|
|
4126
4278
|
className,
|
|
4127
4279
|
searchBox = defaultSearchBox,
|
|
4128
4280
|
dropdownClassName,
|
|
4129
|
-
children
|
|
4281
|
+
children,
|
|
4282
|
+
testId
|
|
4130
4283
|
} = this.props;
|
|
4284
|
+
const testIds = getTestIds(testId, getTypeaheadTestIds);
|
|
4131
4285
|
const {
|
|
4132
4286
|
showSuggestions,
|
|
4133
4287
|
value
|
|
@@ -4142,14 +4296,17 @@ class TypeAhead extends PureComponent {
|
|
|
4142
4296
|
registerChange: this.registerChange,
|
|
4143
4297
|
onFocus: this.onFocus,
|
|
4144
4298
|
value
|
|
4145
|
-
}, this.props
|
|
4299
|
+
}, { ...this.props,
|
|
4300
|
+
testId: testIds.searchBoxId
|
|
4301
|
+
}), /*#__PURE__*/createElement(MountTransition, {
|
|
4146
4302
|
visible: showSuggestions,
|
|
4147
4303
|
native: true
|
|
4148
4304
|
}, transitionStyles => /*#__PURE__*/createElement(animated.div, {
|
|
4149
4305
|
style: transitionStyles,
|
|
4150
4306
|
className: cx(optionsWrapper$1, dropdownClassName)
|
|
4151
4307
|
}, /*#__PURE__*/createElement(OptionGroupRadio, {
|
|
4152
|
-
onChange: this.onSelect
|
|
4308
|
+
onChange: this.onSelect,
|
|
4309
|
+
testId: testIds.optionGroupId
|
|
4153
4310
|
}, children))));
|
|
4154
4311
|
}
|
|
4155
4312
|
}
|
|
@@ -4210,8 +4367,20 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
4210
4367
|
capitalize: capitalize,
|
|
4211
4368
|
getShortenedNumber: getShortenedNumber,
|
|
4212
4369
|
initGoogleAnalytics: initGoogleAnalytics,
|
|
4213
|
-
isDesktop: isDesktop
|
|
4370
|
+
isDesktop: isDesktop,
|
|
4371
|
+
getTestIds: getTestIds,
|
|
4372
|
+
getOptionTestId: getOptionTestId,
|
|
4373
|
+
getRadioGroupTestIds: getRadioGroupTestIds,
|
|
4374
|
+
getOptionGroupTestIds: getOptionGroupTestIds,
|
|
4375
|
+
getOptionGroupRadioTestIds: getOptionGroupRadioTestIds,
|
|
4376
|
+
getOptionGroupCheckBoxTestIds: getOptionGroupCheckBoxTestIds,
|
|
4377
|
+
getPhoneNumberInputTestIds: getPhoneNumberInputTestIds,
|
|
4378
|
+
getMessageTestId: getMessageTestId,
|
|
4379
|
+
getSelectInputTestIds: getSelectInputTestIds,
|
|
4380
|
+
getTypeaheadTestIds: getTypeaheadTestIds,
|
|
4381
|
+
getCalendarTestIds: getCalendarTestIds,
|
|
4382
|
+
getPopUpTestIds: getPopUpTestIds
|
|
4214
4383
|
});
|
|
4215
4384
|
|
|
4216
|
-
export { BrowserBasedDateInput, Button, Calendar, Checkbox, CheckboxGroup, DateInput, DropDown, DropDownButton, Input, Loader, Logo, Message, Modal, NativeDateInput, Option, OptionGroup, OptionGroupCheckBox, OptionGroupRadio, OutsideClick, PhoneNumberInput, PopUp, PebblePopper as Popper, PresetCalendar, Radio, RadioGroup, Rating, Search, SecondaryInput, Select, SideBar, Slider, Stepper, Switch, TabSection, Tabs, Tag, Text, TimePicker, Toast, Tooltip, TypeAhead, UserAgentInfoContext, UserAgentInfoProvider, constants, mixins, styles, typography, index as utils };
|
|
4385
|
+
export { BrowserBasedDateInput, Button, Calendar, Checkbox, CheckboxGroup, DateInput, DropDown, DropDownButton, Input, Loader, Logo, Message, Modal, NativeDateInput, Option, OptionGroup, OptionGroupCheckBox, OptionGroupRadio, OutsideClick, PhoneNumberInput, PopUp, PebblePopper as Popper, PresetCalendar, Radio, RadioGroup, Rating, Search, SecondaryInput, Select, SideBar, Slider, Stepper, Switch, TabSection, Tabs, Tag, Text, TimePicker, Toast, Tooltip, TypeAhead, UserAgentInfoContext, UserAgentInfoProvider, constants, getCalendarTestIds, getMessageTestId, getOptionGroupCheckBoxTestIds, getOptionGroupRadioTestIds, getOptionGroupTestIds, getOptionTestId, getPhoneNumberInputTestIds, getPopUpTestIds, getRadioGroupTestIds, getSelectInputTestIds, getTestIds, getTypeaheadTestIds, mixins, styles, typography, index as utils };
|
|
4217
4386
|
//# sourceMappingURL=pebble-web.es.js.map
|