pebble-web 2.25.2-alpha.1 → 2.25.2-alpha.3
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/Calendar.d.ts +1 -0
- package/dist/components/typings/CheckboxGroup.d.ts +1 -0
- package/dist/components/typings/PopUp.d.ts +1 -0
- package/dist/pebble-web.dev.js +157 -104
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +114 -66
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +113 -65
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +156 -103
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +155 -105
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +154 -104
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +157 -104
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +156 -103
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/testIds.d.ts +12 -0
- package/package.json +1 -1
- package/src/components/Calendar.tsx +28 -4
- package/src/components/CheckboxGroup.tsx +13 -3
- package/src/components/Input.tsx +2 -0
- package/src/components/PopUp.tsx +7 -1
- package/src/components/SecondaryInput.tsx +2 -0
- package/src/components/__tests__/__snapshots__/checkboxGroup.test.tsx.snap +88 -0
- package/src/components/__tests__/calendar.test.tsx +6 -24
- package/src/components/__tests__/checkboxGroup.test.tsx +39 -8
- package/src/components/typings/Calendar.ts +1 -0
- package/src/components/typings/CheckboxGroup.ts +1 -0
- package/src/components/typings/PopUp.ts +1 -0
- package/src/utils/testIds.ts +21 -0
package/dist/pebble-web.es.js
CHANGED
|
@@ -625,6 +625,76 @@ const buttonsWrapper = /*#__PURE__*/css({ ...flexSpaceBetween,
|
|
|
625
625
|
marginTop: 20
|
|
626
626
|
}, ";label:buttonsWrapper;" + ( "" ));
|
|
627
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
|
+
|
|
628
698
|
class Calendar extends PureComponent {
|
|
629
699
|
constructor() {
|
|
630
700
|
super(...arguments);
|
|
@@ -738,11 +808,18 @@ class Calendar extends PureComponent {
|
|
|
738
808
|
onClear,
|
|
739
809
|
maxDate,
|
|
740
810
|
minDate,
|
|
811
|
+
testId,
|
|
741
812
|
...rest
|
|
742
813
|
} = this.props;
|
|
743
814
|
const {
|
|
744
815
|
maxRangeDates
|
|
745
816
|
} = this.state;
|
|
817
|
+
const {
|
|
818
|
+
leftIconId,
|
|
819
|
+
rightIconId,
|
|
820
|
+
clearButtonId,
|
|
821
|
+
applyButtonId
|
|
822
|
+
} = getTestIds(testId, id => getCalendarTestIds(id));
|
|
746
823
|
return /*#__PURE__*/createElement("div", {
|
|
747
824
|
className: cx(wrapperStyle, {
|
|
748
825
|
[/*#__PURE__*/css( {
|
|
@@ -767,13 +844,15 @@ class Calendar extends PureComponent {
|
|
|
767
844
|
style: {
|
|
768
845
|
fontSize: 14
|
|
769
846
|
},
|
|
770
|
-
className: "pi pi-chevron-left"
|
|
847
|
+
className: "pi pi-chevron-left",
|
|
848
|
+
"data-testid": leftIconId
|
|
771
849
|
}),
|
|
772
850
|
nextLabel: /*#__PURE__*/createElement("i", {
|
|
773
851
|
style: {
|
|
774
852
|
fontSize: 14
|
|
775
853
|
},
|
|
776
|
-
className: "pi pi-arrow-right"
|
|
854
|
+
className: "pi pi-arrow-right",
|
|
855
|
+
"data-testid": rightIconId
|
|
777
856
|
}),
|
|
778
857
|
maxDate: maxDate || maxRangeDates && maxRangeDates.future,
|
|
779
858
|
minDate: minDate || maxRangeDates && maxRangeDates.past
|
|
@@ -781,9 +860,11 @@ class Calendar extends PureComponent {
|
|
|
781
860
|
className: buttonsWrapper
|
|
782
861
|
}, onClear && /*#__PURE__*/createElement(Button, {
|
|
783
862
|
onClick: this.onClear,
|
|
784
|
-
type: "secondary"
|
|
863
|
+
type: "secondary",
|
|
864
|
+
testId: clearButtonId
|
|
785
865
|
}, "Clear"), onApply && /*#__PURE__*/createElement(Button, {
|
|
786
|
-
onClick: this.onApply
|
|
866
|
+
onClick: this.onApply,
|
|
867
|
+
testId: applyButtonId
|
|
787
868
|
}, "Apply")));
|
|
788
869
|
}
|
|
789
870
|
}
|
|
@@ -912,14 +993,17 @@ class CheckboxGroup extends PureComponent {
|
|
|
912
993
|
selected,
|
|
913
994
|
className,
|
|
914
995
|
name,
|
|
915
|
-
disabled
|
|
996
|
+
disabled,
|
|
997
|
+
testId
|
|
916
998
|
} = this.props;
|
|
917
|
-
const _children = Children.map(children, _checkbox => {
|
|
999
|
+
const _children = Children.map(children, (_checkbox, i) => {
|
|
1000
|
+
const index = typeof i === "number" ? i : 0;
|
|
918
1001
|
const checkbox = _checkbox;
|
|
919
1002
|
return cloneElement(checkbox, {
|
|
920
1003
|
onChange: this.handleChange,
|
|
921
1004
|
checked: selected.indexOf(checkbox.props.value) >= 0,
|
|
922
|
-
disabled
|
|
1005
|
+
disabled,
|
|
1006
|
+
testId: testId ? getOptionTestId(testId, index) : undefined
|
|
923
1007
|
});
|
|
924
1008
|
});
|
|
925
1009
|
return /*#__PURE__*/createElement("div", {
|
|
@@ -1339,6 +1423,7 @@ class Input extends PureComponent {
|
|
|
1339
1423
|
}
|
|
1340
1424
|
}), _message && /*#__PURE__*/createElement("div", {
|
|
1341
1425
|
className: messageStyle,
|
|
1426
|
+
"data-testid": testId ? getMessageTestId(testId) : undefined,
|
|
1342
1427
|
style: {
|
|
1343
1428
|
color: getColor(errorMessage, successMessage)
|
|
1344
1429
|
}
|
|
@@ -2137,58 +2222,6 @@ const searchBoxScrolledStyle = /*#__PURE__*/css({
|
|
|
2137
2222
|
padding: onScrollPadding
|
|
2138
2223
|
}, ";label:searchBoxScrolledStyle;" + ( "" ));
|
|
2139
2224
|
|
|
2140
|
-
function getTestIds(id, builder) {
|
|
2141
|
-
return id ? builder(id) : {};
|
|
2142
|
-
}
|
|
2143
|
-
function getOptionTestId(id, index) {
|
|
2144
|
-
return `${id}-${index}`;
|
|
2145
|
-
}
|
|
2146
|
-
function getRadioGroupTestIds(id) {
|
|
2147
|
-
return {
|
|
2148
|
-
optionId: `${id}-option`
|
|
2149
|
-
};
|
|
2150
|
-
}
|
|
2151
|
-
function getOptionGroupTestIds(id) {
|
|
2152
|
-
return {
|
|
2153
|
-
searchBoxId: `${id}-search`,
|
|
2154
|
-
optionId: `${id}-option`,
|
|
2155
|
-
selectVisibleId: `${id}-select-visible`,
|
|
2156
|
-
clearVisibleId: `${id}-clear-visible`
|
|
2157
|
-
};
|
|
2158
|
-
}
|
|
2159
|
-
const getOptionGroupRadioTestIds = id => getOptionGroupTestIds(id);
|
|
2160
|
-
function getOptionGroupCheckBoxTestIds(id) {
|
|
2161
|
-
return {
|
|
2162
|
-
applyButtonId: `${id}-apply-btn`,
|
|
2163
|
-
clearButtonId: `${id}-clear-btn`,
|
|
2164
|
-
...getOptionGroupTestIds(id)
|
|
2165
|
-
};
|
|
2166
|
-
}
|
|
2167
|
-
function getPhoneNumberInputTestIds(id) {
|
|
2168
|
-
return {
|
|
2169
|
-
phoneId: `${id}-phone`,
|
|
2170
|
-
countryId: `${id}-country`,
|
|
2171
|
-
countryInputIds: getSelectInputTestIds(`${id}-country`)
|
|
2172
|
-
};
|
|
2173
|
-
}
|
|
2174
|
-
function getSelectInputTestIds(id, multiSelect = false) {
|
|
2175
|
-
const optionGroupId = `${id}-option-group`;
|
|
2176
|
-
const baseIds = {
|
|
2177
|
-
inputId: `${id}-input`,
|
|
2178
|
-
optionGroupId
|
|
2179
|
-
};
|
|
2180
|
-
return { ...(multiSelect ? getOptionGroupCheckBoxTestIds(optionGroupId) : getOptionGroupRadioTestIds(optionGroupId)),
|
|
2181
|
-
...baseIds
|
|
2182
|
-
};
|
|
2183
|
-
}
|
|
2184
|
-
function getTypeaheadTestIds(id) {
|
|
2185
|
-
const optionGroupId = `${id}-option-group`;
|
|
2186
|
-
return {
|
|
2187
|
-
optionGroupId,
|
|
2188
|
-
...getOptionGroupRadioTestIds(optionGroupId)
|
|
2189
|
-
};
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
2225
|
class OptionGroup extends PureComponent {
|
|
2193
2226
|
constructor() {
|
|
2194
2227
|
super(...arguments);
|
|
@@ -2828,8 +2861,14 @@ const PopUp = props => {
|
|
|
2828
2861
|
rejectButtonText = "No",
|
|
2829
2862
|
children,
|
|
2830
2863
|
approveButtonProps,
|
|
2831
|
-
rejectButtonProps
|
|
2864
|
+
rejectButtonProps,
|
|
2865
|
+
testId
|
|
2832
2866
|
} = props;
|
|
2867
|
+
const {
|
|
2868
|
+
closeButtonId,
|
|
2869
|
+
approveButtonId,
|
|
2870
|
+
rejectButtonId
|
|
2871
|
+
} = getTestIds(testId, id => getPopUpTestIds(id));
|
|
2833
2872
|
return /*#__PURE__*/createElement(Modal, {
|
|
2834
2873
|
visible: visible,
|
|
2835
2874
|
modalClassName: flexCenter
|
|
@@ -2837,18 +2876,23 @@ const PopUp = props => {
|
|
|
2837
2876
|
className: modalContainer$1
|
|
2838
2877
|
}, onClose && /*#__PURE__*/createElement("i", {
|
|
2839
2878
|
className: cx("pi", "pi-close", iconCloseClassName),
|
|
2840
|
-
onClick: onClose
|
|
2879
|
+
onClick: onClose,
|
|
2880
|
+
"data-testid": closeButtonId
|
|
2841
2881
|
}), children, (onReject || onApprove) && /*#__PURE__*/createElement("div", {
|
|
2842
2882
|
className: buttonsContainer
|
|
2843
2883
|
}, onReject && /*#__PURE__*/createElement(Button, Object.assign({
|
|
2844
2884
|
size: "large",
|
|
2845
2885
|
type: "secondary",
|
|
2846
2886
|
onClick: onReject
|
|
2847
|
-
}, rejectButtonProps
|
|
2887
|
+
}, rejectButtonProps, {
|
|
2888
|
+
testId: rejectButtonId
|
|
2889
|
+
}), rejectButtonText), onApprove && /*#__PURE__*/createElement(Button, Object.assign({
|
|
2848
2890
|
size: "large",
|
|
2849
2891
|
type: "primary",
|
|
2850
2892
|
onClick: onApprove
|
|
2851
|
-
}, approveButtonProps
|
|
2893
|
+
}, approveButtonProps, {
|
|
2894
|
+
testId: approveButtonId
|
|
2895
|
+
}), approveButtonText))));
|
|
2852
2896
|
};
|
|
2853
2897
|
|
|
2854
2898
|
const selectedTabStyle = /*#__PURE__*/css({
|
|
@@ -3320,6 +3364,7 @@ class SecondaryInput extends PureComponent {
|
|
|
3320
3364
|
scale: 0.4
|
|
3321
3365
|
})), _message && /*#__PURE__*/createElement("div", {
|
|
3322
3366
|
className: messageStyle$1,
|
|
3367
|
+
"data-testid": testId ? getMessageTestId(testId) : undefined,
|
|
3323
3368
|
style: {
|
|
3324
3369
|
color: getColor$1(errorMessage, successMessage)
|
|
3325
3370
|
}
|
|
@@ -4330,9 +4375,12 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
4330
4375
|
getOptionGroupRadioTestIds: getOptionGroupRadioTestIds,
|
|
4331
4376
|
getOptionGroupCheckBoxTestIds: getOptionGroupCheckBoxTestIds,
|
|
4332
4377
|
getPhoneNumberInputTestIds: getPhoneNumberInputTestIds,
|
|
4378
|
+
getMessageTestId: getMessageTestId,
|
|
4333
4379
|
getSelectInputTestIds: getSelectInputTestIds,
|
|
4334
|
-
getTypeaheadTestIds: getTypeaheadTestIds
|
|
4380
|
+
getTypeaheadTestIds: getTypeaheadTestIds,
|
|
4381
|
+
getCalendarTestIds: getCalendarTestIds,
|
|
4382
|
+
getPopUpTestIds: getPopUpTestIds
|
|
4335
4383
|
});
|
|
4336
4384
|
|
|
4337
|
-
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, getOptionGroupCheckBoxTestIds, getOptionGroupRadioTestIds, getOptionGroupTestIds, getOptionTestId, getPhoneNumberInputTestIds, getRadioGroupTestIds, getSelectInputTestIds, getTestIds, getTypeaheadTestIds, 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 };
|
|
4338
4386
|
//# sourceMappingURL=pebble-web.es.js.map
|