pebble-web 2.25.2-alpha.0 → 2.25.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/typings/Calendar.d.ts +1 -0
- package/dist/components/typings/CheckboxGroup.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/pebble-web.dev.js +141 -100
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +91 -62
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +90 -61
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +140 -99
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +131 -101
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +130 -100
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +141 -100
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +140 -99
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/testIds.d.ts +7 -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/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/index.ts +1 -0
- package/src/utils/testIds.ts +13 -0
package/dist/pebble-web.es.js
CHANGED
|
@@ -625,6 +625,69 @@ 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
|
+
|
|
628
691
|
class Calendar extends PureComponent {
|
|
629
692
|
constructor() {
|
|
630
693
|
super(...arguments);
|
|
@@ -738,11 +801,18 @@ class Calendar extends PureComponent {
|
|
|
738
801
|
onClear,
|
|
739
802
|
maxDate,
|
|
740
803
|
minDate,
|
|
804
|
+
testId,
|
|
741
805
|
...rest
|
|
742
806
|
} = this.props;
|
|
743
807
|
const {
|
|
744
808
|
maxRangeDates
|
|
745
809
|
} = this.state;
|
|
810
|
+
const {
|
|
811
|
+
leftIconId,
|
|
812
|
+
rightIconId,
|
|
813
|
+
clearButtonId,
|
|
814
|
+
applyButtonId
|
|
815
|
+
} = getTestIds(testId, id => getCalendarTestIds(id));
|
|
746
816
|
return /*#__PURE__*/createElement("div", {
|
|
747
817
|
className: cx(wrapperStyle, {
|
|
748
818
|
[/*#__PURE__*/css( {
|
|
@@ -767,13 +837,15 @@ class Calendar extends PureComponent {
|
|
|
767
837
|
style: {
|
|
768
838
|
fontSize: 14
|
|
769
839
|
},
|
|
770
|
-
className: "pi pi-chevron-left"
|
|
840
|
+
className: "pi pi-chevron-left",
|
|
841
|
+
"data-testid": leftIconId
|
|
771
842
|
}),
|
|
772
843
|
nextLabel: /*#__PURE__*/createElement("i", {
|
|
773
844
|
style: {
|
|
774
845
|
fontSize: 14
|
|
775
846
|
},
|
|
776
|
-
className: "pi pi-arrow-right"
|
|
847
|
+
className: "pi pi-arrow-right",
|
|
848
|
+
"data-testid": rightIconId
|
|
777
849
|
}),
|
|
778
850
|
maxDate: maxDate || maxRangeDates && maxRangeDates.future,
|
|
779
851
|
minDate: minDate || maxRangeDates && maxRangeDates.past
|
|
@@ -781,9 +853,11 @@ class Calendar extends PureComponent {
|
|
|
781
853
|
className: buttonsWrapper
|
|
782
854
|
}, onClear && /*#__PURE__*/createElement(Button, {
|
|
783
855
|
onClick: this.onClear,
|
|
784
|
-
type: "secondary"
|
|
856
|
+
type: "secondary",
|
|
857
|
+
testId: clearButtonId
|
|
785
858
|
}, "Clear"), onApply && /*#__PURE__*/createElement(Button, {
|
|
786
|
-
onClick: this.onApply
|
|
859
|
+
onClick: this.onApply,
|
|
860
|
+
testId: applyButtonId
|
|
787
861
|
}, "Apply")));
|
|
788
862
|
}
|
|
789
863
|
}
|
|
@@ -912,14 +986,17 @@ class CheckboxGroup extends PureComponent {
|
|
|
912
986
|
selected,
|
|
913
987
|
className,
|
|
914
988
|
name,
|
|
915
|
-
disabled
|
|
989
|
+
disabled,
|
|
990
|
+
testId
|
|
916
991
|
} = this.props;
|
|
917
|
-
const _children = Children.map(children, _checkbox => {
|
|
992
|
+
const _children = Children.map(children, (_checkbox, i) => {
|
|
993
|
+
const index = typeof i === "number" ? i : 0;
|
|
918
994
|
const checkbox = _checkbox;
|
|
919
995
|
return cloneElement(checkbox, {
|
|
920
996
|
onChange: this.handleChange,
|
|
921
997
|
checked: selected.indexOf(checkbox.props.value) >= 0,
|
|
922
|
-
disabled
|
|
998
|
+
disabled,
|
|
999
|
+
testId: testId ? getOptionTestId(testId, index) : undefined
|
|
923
1000
|
});
|
|
924
1001
|
});
|
|
925
1002
|
return /*#__PURE__*/createElement("div", {
|
|
@@ -1339,6 +1416,7 @@ class Input extends PureComponent {
|
|
|
1339
1416
|
}
|
|
1340
1417
|
}), _message && /*#__PURE__*/createElement("div", {
|
|
1341
1418
|
className: messageStyle,
|
|
1419
|
+
"data-testid": testId ? getMessageTestId(testId) : undefined,
|
|
1342
1420
|
style: {
|
|
1343
1421
|
color: getColor(errorMessage, successMessage)
|
|
1344
1422
|
}
|
|
@@ -2137,58 +2215,6 @@ const searchBoxScrolledStyle = /*#__PURE__*/css({
|
|
|
2137
2215
|
padding: onScrollPadding
|
|
2138
2216
|
}, ";label:searchBoxScrolledStyle;" + ( "" ));
|
|
2139
2217
|
|
|
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
2218
|
class OptionGroup extends PureComponent {
|
|
2193
2219
|
constructor() {
|
|
2194
2220
|
super(...arguments);
|
|
@@ -3320,6 +3346,7 @@ class SecondaryInput extends PureComponent {
|
|
|
3320
3346
|
scale: 0.4
|
|
3321
3347
|
})), _message && /*#__PURE__*/createElement("div", {
|
|
3322
3348
|
className: messageStyle$1,
|
|
3349
|
+
"data-testid": testId ? getMessageTestId(testId) : undefined,
|
|
3323
3350
|
style: {
|
|
3324
3351
|
color: getColor$1(errorMessage, successMessage)
|
|
3325
3352
|
}
|
|
@@ -4330,9 +4357,11 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
4330
4357
|
getOptionGroupRadioTestIds: getOptionGroupRadioTestIds,
|
|
4331
4358
|
getOptionGroupCheckBoxTestIds: getOptionGroupCheckBoxTestIds,
|
|
4332
4359
|
getPhoneNumberInputTestIds: getPhoneNumberInputTestIds,
|
|
4360
|
+
getMessageTestId: getMessageTestId,
|
|
4333
4361
|
getSelectInputTestIds: getSelectInputTestIds,
|
|
4334
|
-
getTypeaheadTestIds: getTypeaheadTestIds
|
|
4362
|
+
getTypeaheadTestIds: getTypeaheadTestIds,
|
|
4363
|
+
getCalendarTestIds: getCalendarTestIds
|
|
4335
4364
|
});
|
|
4336
4365
|
|
|
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, mixins, styles, typography, index as utils };
|
|
4366
|
+
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, getRadioGroupTestIds, getSelectInputTestIds, getTestIds, getTypeaheadTestIds, mixins, styles, typography, index as utils };
|
|
4338
4367
|
//# sourceMappingURL=pebble-web.es.js.map
|