pebble-web 2.25.1 → 2.25.2-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/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/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/pebble-web.dev.js +244 -112
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +178 -57
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +173 -52
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +239 -107
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +244 -112
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +239 -107
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +244 -112
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +239 -107
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/testIds.d.ts +53 -0
- package/package.json +1 -1
- package/src/components/Button.tsx +3 -1
- package/src/components/DateInput.tsx +3 -1
- package/src/components/DropDown.tsx +3 -1
- package/src/components/Input.tsx +13 -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/RadioGroup.tsx +20 -3
- package/src/components/Search.tsx +3 -1
- package/src/components/SecondaryInput.tsx +7 -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__/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__/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/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/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/utils/index.ts +1 -0
- package/src/utils/testIds.ts +98 -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
|
|
@@ -817,7 +821,8 @@ function Control(props) {
|
|
|
817
821
|
children = ControlView,
|
|
818
822
|
type,
|
|
819
823
|
className,
|
|
820
|
-
indeterminate
|
|
824
|
+
indeterminate,
|
|
825
|
+
testId
|
|
821
826
|
} = props;
|
|
822
827
|
return /*#__PURE__*/createElement("div", {
|
|
823
828
|
className: cx(controlStyle, className),
|
|
@@ -830,7 +835,8 @@ function Control(props) {
|
|
|
830
835
|
onClick: !disabled ? e => onChange && onChange({
|
|
831
836
|
value,
|
|
832
837
|
checked: !checked
|
|
833
|
-
}, e) : undefined
|
|
838
|
+
}, e) : undefined,
|
|
839
|
+
"data-testid": testId
|
|
834
840
|
}, children(props));
|
|
835
841
|
}
|
|
836
842
|
const ControlView = ({
|
|
@@ -1031,7 +1037,8 @@ class DropDown extends PureComponent {
|
|
|
1031
1037
|
disabled,
|
|
1032
1038
|
labelClassName,
|
|
1033
1039
|
controlled,
|
|
1034
|
-
onOutsideClick
|
|
1040
|
+
onOutsideClick,
|
|
1041
|
+
testId
|
|
1035
1042
|
} = this.props;
|
|
1036
1043
|
const _isDropDownOpen = controlled ? !!this.props.isOpen : this.state.isOpen;
|
|
1037
1044
|
return /*#__PURE__*/createElement(OutsideClick, {
|
|
@@ -1059,7 +1066,8 @@ class DropDown extends PureComponent {
|
|
|
1059
1066
|
isOpen: _isDropDownOpen,
|
|
1060
1067
|
onClick: this.toggleDropdown,
|
|
1061
1068
|
disabled: disabled,
|
|
1062
|
-
className: labelClassName
|
|
1069
|
+
className: labelClassName,
|
|
1070
|
+
testId: testId
|
|
1063
1071
|
}, buttonLabel))), /*#__PURE__*/createElement(MountTransition, {
|
|
1064
1072
|
visible: _isDropDownOpen
|
|
1065
1073
|
}, transitionStyles => /*#__PURE__*/createElement(animated.div, {
|
|
@@ -1267,7 +1275,8 @@ class Input extends PureComponent {
|
|
|
1267
1275
|
onClick,
|
|
1268
1276
|
loading,
|
|
1269
1277
|
leftElement,
|
|
1270
|
-
rightElement
|
|
1278
|
+
rightElement,
|
|
1279
|
+
testId
|
|
1271
1280
|
} = this.props;
|
|
1272
1281
|
const {
|
|
1273
1282
|
isFocused
|
|
@@ -1307,9 +1316,13 @@ class Input extends PureComponent {
|
|
|
1307
1316
|
onClick: onClick
|
|
1308
1317
|
}, /*#__PURE__*/createElement("div", {
|
|
1309
1318
|
className: _inputWrapperClassName
|
|
1310
|
-
}, leftElement === null || leftElement === void 0 ? void 0 : leftElement(), this.props.textArea ? /*#__PURE__*/createElement("textarea", Object.assign({}, _inputProps, this.props.inputProps
|
|
1319
|
+
}, leftElement === null || leftElement === void 0 ? void 0 : leftElement(), this.props.textArea ? /*#__PURE__*/createElement("textarea", Object.assign({}, _inputProps, this.props.inputProps, {
|
|
1320
|
+
"data-testid": testId
|
|
1321
|
+
})) : /*#__PURE__*/createElement("input", Object.assign({
|
|
1311
1322
|
type: type
|
|
1312
|
-
}, _inputProps, this.props.inputProps
|
|
1323
|
+
}, _inputProps, this.props.inputProps, {
|
|
1324
|
+
"data-testid": testId
|
|
1325
|
+
})), loading && /*#__PURE__*/createElement(Loader, {
|
|
1313
1326
|
color: colors.violet.base,
|
|
1314
1327
|
scale: 0.6,
|
|
1315
1328
|
className: _loadingStyle
|
|
@@ -1350,7 +1363,8 @@ class NativeDateInput extends PureComponent {
|
|
|
1350
1363
|
inputProps,
|
|
1351
1364
|
placeholder,
|
|
1352
1365
|
value,
|
|
1353
|
-
disabled
|
|
1366
|
+
disabled,
|
|
1367
|
+
testId
|
|
1354
1368
|
} = this.props;
|
|
1355
1369
|
return /*#__PURE__*/createElement(Input, Object.assign({
|
|
1356
1370
|
onChange: this.onDateInputChange,
|
|
@@ -1360,7 +1374,8 @@ class NativeDateInput extends PureComponent {
|
|
|
1360
1374
|
placeholder: placeholder,
|
|
1361
1375
|
fixLabelAtTop: true
|
|
1362
1376
|
}, inputProps, {
|
|
1363
|
-
disabled: disabled
|
|
1377
|
+
disabled: disabled,
|
|
1378
|
+
testId: testId
|
|
1364
1379
|
}));
|
|
1365
1380
|
}
|
|
1366
1381
|
}
|
|
@@ -1449,7 +1464,8 @@ class DateInput extends PureComponent {
|
|
|
1449
1464
|
initiallyOpen,
|
|
1450
1465
|
onOutsideClick,
|
|
1451
1466
|
controlled,
|
|
1452
|
-
isOpen
|
|
1467
|
+
isOpen,
|
|
1468
|
+
testId
|
|
1453
1469
|
} = this.props;
|
|
1454
1470
|
const _wrapperClassName = cx(wrapperStyle$3, wrapperClassName);
|
|
1455
1471
|
const _dropDownClassName = cx(dropDownClassName, this.props.dropDownClassName);
|
|
@@ -1481,7 +1497,8 @@ class DateInput extends PureComponent {
|
|
|
1481
1497
|
onChange
|
|
1482
1498
|
},
|
|
1483
1499
|
className: cx(inputStyle$1, inputProps && inputProps.className),
|
|
1484
|
-
disabled: disabled
|
|
1500
|
+
disabled: disabled,
|
|
1501
|
+
testId: testId
|
|
1485
1502
|
}))),
|
|
1486
1503
|
className: _wrapperClassName,
|
|
1487
1504
|
placement: placement,
|
|
@@ -1748,11 +1765,11 @@ class Toast extends PureComponent {
|
|
|
1748
1765
|
emitter.emit("hideToast");
|
|
1749
1766
|
}
|
|
1750
1767
|
componentDidMount() {
|
|
1751
|
-
emitter.on("showToast", this.show);
|
|
1768
|
+
emitter.on("showToast", e => e && this.show(e));
|
|
1752
1769
|
emitter.on("hideToast", this.hide);
|
|
1753
1770
|
}
|
|
1754
1771
|
componentWillUnmount() {
|
|
1755
|
-
emitter.off("showToast", this.show);
|
|
1772
|
+
emitter.off("showToast", e => e && this.show(e));
|
|
1756
1773
|
emitter.off("hideToast", this.hide);
|
|
1757
1774
|
}
|
|
1758
1775
|
render() {
|
|
@@ -1809,7 +1826,8 @@ const messageWrapper = /*#__PURE__*/css({
|
|
|
1809
1826
|
const Message = ({
|
|
1810
1827
|
intent,
|
|
1811
1828
|
className,
|
|
1812
|
-
text
|
|
1829
|
+
text,
|
|
1830
|
+
testId
|
|
1813
1831
|
}) => {
|
|
1814
1832
|
const bColor = _colors[intent];
|
|
1815
1833
|
const iconClass = cx("pi", {
|
|
@@ -1820,7 +1838,8 @@ const Message = ({
|
|
|
1820
1838
|
className: cx(messageWrapper, className),
|
|
1821
1839
|
style: {
|
|
1822
1840
|
backgroundColor: bColor
|
|
1823
|
-
}
|
|
1841
|
+
},
|
|
1842
|
+
"data-testid": testId
|
|
1824
1843
|
}, /*#__PURE__*/createElement("i", {
|
|
1825
1844
|
className: iconClass
|
|
1826
1845
|
}), text);
|
|
@@ -2035,7 +2054,8 @@ class Search extends PureComponent {
|
|
|
2035
2054
|
className,
|
|
2036
2055
|
clearable,
|
|
2037
2056
|
value,
|
|
2038
|
-
loading
|
|
2057
|
+
loading,
|
|
2058
|
+
testId
|
|
2039
2059
|
} = this.props;
|
|
2040
2060
|
const wrapperClassName = cx(searchWrapperStyle, {
|
|
2041
2061
|
__pebble__search__small: type === "small",
|
|
@@ -2056,7 +2076,9 @@ class Search extends PureComponent {
|
|
|
2056
2076
|
},
|
|
2057
2077
|
ref: this.searchInputRef,
|
|
2058
2078
|
value: value
|
|
2059
|
-
}, inputProps
|
|
2079
|
+
}, inputProps, {
|
|
2080
|
+
"data-testid": testId
|
|
2081
|
+
})), loading && /*#__PURE__*/createElement(Loader, {
|
|
2060
2082
|
scale: 0.4,
|
|
2061
2083
|
color: colors.violet.base
|
|
2062
2084
|
}), clearable && /*#__PURE__*/createElement("div", {
|
|
@@ -2115,6 +2137,58 @@ const searchBoxScrolledStyle = /*#__PURE__*/css({
|
|
|
2115
2137
|
padding: onScrollPadding
|
|
2116
2138
|
}, ";label:searchBoxScrolledStyle;" + ( "" ));
|
|
2117
2139
|
|
|
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
|
+
|
|
2118
2192
|
class OptionGroup extends PureComponent {
|
|
2119
2193
|
constructor() {
|
|
2120
2194
|
super(...arguments);
|
|
@@ -2199,12 +2273,14 @@ class OptionGroup extends PureComponent {
|
|
|
2199
2273
|
className,
|
|
2200
2274
|
isSelected,
|
|
2201
2275
|
handleChange,
|
|
2202
|
-
searchBoxProps
|
|
2276
|
+
searchBoxProps,
|
|
2277
|
+
testId
|
|
2203
2278
|
} = this.props;
|
|
2204
2279
|
const {
|
|
2205
2280
|
isScrolled,
|
|
2206
2281
|
highlighted
|
|
2207
2282
|
} = this.state;
|
|
2283
|
+
const testIds = getTestIds(testId, getOptionGroupTestIds);
|
|
2208
2284
|
const _children = Children.map(children, (_option, i) => {
|
|
2209
2285
|
const option = _option;
|
|
2210
2286
|
let ref = this.optionsRefsSet.get(i);
|
|
@@ -2217,7 +2293,8 @@ class OptionGroup extends PureComponent {
|
|
|
2217
2293
|
isActive: highlighted === i,
|
|
2218
2294
|
isSelected: isSelected(option.props.value),
|
|
2219
2295
|
multiSelect,
|
|
2220
|
-
ref
|
|
2296
|
+
ref,
|
|
2297
|
+
testId: testIds.optionId ? getOptionTestId(testIds.optionId, i) : undefined
|
|
2221
2298
|
});
|
|
2222
2299
|
});
|
|
2223
2300
|
const searchBoxClassName = cx(searchBoxWrapper, {
|
|
@@ -2232,7 +2309,8 @@ class OptionGroup extends PureComponent {
|
|
|
2232
2309
|
inputProps: { ...(searchBoxProps && searchBoxProps.inputProps),
|
|
2233
2310
|
onKeyDown: this.handleKeyPress,
|
|
2234
2311
|
autoFocus: true
|
|
2235
|
-
}
|
|
2312
|
+
},
|
|
2313
|
+
testId: testIds.searchBoxId
|
|
2236
2314
|
}))), !!Children.count(children) && /*#__PURE__*/createElement("div", {
|
|
2237
2315
|
ref: this.optionRef,
|
|
2238
2316
|
style: {
|
|
@@ -2240,14 +2318,16 @@ class OptionGroup extends PureComponent {
|
|
|
2240
2318
|
},
|
|
2241
2319
|
className: cx(optionsWrapper, className),
|
|
2242
2320
|
role: multiSelect ? "group" : "radiogroup",
|
|
2243
|
-
"data-
|
|
2321
|
+
"data-testid": testId,
|
|
2244
2322
|
"aria-label": searchBoxProps && searchBoxProps.placeholder
|
|
2245
2323
|
}, advancedOptions && advancedOptionsProps && /*#__PURE__*/createElement("div", {
|
|
2246
2324
|
className: _class
|
|
2247
2325
|
}, /*#__PURE__*/createElement("div", {
|
|
2248
|
-
onClick: advancedOptionsProps.selectVisible
|
|
2326
|
+
onClick: advancedOptionsProps.selectVisible,
|
|
2327
|
+
"data-testid": testIds.selectVisibleId
|
|
2249
2328
|
}, "Select Visible"), /*#__PURE__*/createElement("div", {
|
|
2250
|
-
onClick: advancedOptionsProps.clearVisible
|
|
2329
|
+
onClick: advancedOptionsProps.clearVisible,
|
|
2330
|
+
"data-testid": testIds.clearVisibleId
|
|
2251
2331
|
}, "Clear Visible")), _children));
|
|
2252
2332
|
}
|
|
2253
2333
|
}
|
|
@@ -2312,6 +2392,7 @@ class OptionGroupCheckBox extends PureComponent {
|
|
|
2312
2392
|
onClear,
|
|
2313
2393
|
isSelected,
|
|
2314
2394
|
onChange,
|
|
2395
|
+
testId,
|
|
2315
2396
|
...rest
|
|
2316
2397
|
} = this.props;
|
|
2317
2398
|
const advancedOptionsProps = {
|
|
@@ -2319,20 +2400,24 @@ class OptionGroupCheckBox extends PureComponent {
|
|
|
2319
2400
|
clearVisible: this.clearVisible,
|
|
2320
2401
|
...this.props.advancedOptionsProps
|
|
2321
2402
|
};
|
|
2403
|
+
const testIds = getTestIds(testId, getOptionGroupCheckBoxTestIds);
|
|
2322
2404
|
return /*#__PURE__*/createElement("div", {
|
|
2323
2405
|
className: cx(optionGroupCheckBoxWrap, wrapClassName)
|
|
2324
2406
|
}, /*#__PURE__*/createElement(OptionGroup, Object.assign({}, rest, {
|
|
2325
2407
|
advancedOptionsProps: advancedOptionsProps,
|
|
2326
2408
|
isSelected: isSelected || this.isSelected,
|
|
2327
2409
|
handleChange: this.handleChange,
|
|
2328
|
-
multiSelect: true
|
|
2410
|
+
multiSelect: true,
|
|
2411
|
+
testId: testId
|
|
2329
2412
|
})), (onApply || onClear) && /*#__PURE__*/createElement("div", {
|
|
2330
2413
|
className: optionGroupCheckBoxButtonWrap
|
|
2331
2414
|
}, onClear && /*#__PURE__*/createElement(Button, {
|
|
2332
2415
|
type: "secondary",
|
|
2333
|
-
onClick: onClear
|
|
2416
|
+
onClick: onClear,
|
|
2417
|
+
testId: testIds.clearButtonId
|
|
2334
2418
|
}, "Clear"), onApply && /*#__PURE__*/createElement(Button, {
|
|
2335
|
-
onClick: this.onApply
|
|
2419
|
+
onClick: this.onApply,
|
|
2420
|
+
testId: testIds.applyButtonId
|
|
2336
2421
|
}, "Apply")));
|
|
2337
2422
|
}
|
|
2338
2423
|
}
|
|
@@ -2431,8 +2516,11 @@ function Select(props) {
|
|
|
2431
2516
|
disabled,
|
|
2432
2517
|
isSelected,
|
|
2433
2518
|
placement,
|
|
2434
|
-
modifiers
|
|
2519
|
+
modifiers,
|
|
2520
|
+
testId
|
|
2435
2521
|
} = props;
|
|
2522
|
+
const singleSelectTestIds = getTestIds(testId, id => getSelectInputTestIds(id, false));
|
|
2523
|
+
const multiSelectTestIds = getTestIds(testId, id => getSelectInputTestIds(id, true));
|
|
2436
2524
|
return /*#__PURE__*/createElement("div", {
|
|
2437
2525
|
className: cx(selectWrapper, className, {
|
|
2438
2526
|
[relativePosition]: !!fullWidthDropdown
|
|
@@ -2454,7 +2542,8 @@ function Select(props) {
|
|
|
2454
2542
|
onClick: disabled ? undefined : () => {
|
|
2455
2543
|
toggleDropdown();
|
|
2456
2544
|
onDropdownToggle(isOpen);
|
|
2457
|
-
}
|
|
2545
|
+
},
|
|
2546
|
+
"data-testid": singleSelectTestIds.inputId
|
|
2458
2547
|
}, /*#__PURE__*/createElement(Input, Object.assign({
|
|
2459
2548
|
className: selectInputWrapper,
|
|
2460
2549
|
inputClassName: selectInput,
|
|
@@ -2503,7 +2592,9 @@ function Select(props) {
|
|
|
2503
2592
|
onDropdownToggle(isOpen);
|
|
2504
2593
|
toggle();
|
|
2505
2594
|
})
|
|
2506
|
-
}, commonProps
|
|
2595
|
+
}, commonProps, {
|
|
2596
|
+
testId: multiSelectTestIds.optionGroupId
|
|
2597
|
+
}), children);
|
|
2507
2598
|
} else {
|
|
2508
2599
|
return /*#__PURE__*/createElement(OptionGroupRadio, Object.assign({
|
|
2509
2600
|
selected: props.selected,
|
|
@@ -2512,7 +2603,9 @@ function Select(props) {
|
|
|
2512
2603
|
onDropdownToggle(isOpen);
|
|
2513
2604
|
toggle();
|
|
2514
2605
|
}
|
|
2515
|
-
}, commonProps
|
|
2606
|
+
}, commonProps, {
|
|
2607
|
+
testId: singleSelectTestIds.optionGroupId
|
|
2608
|
+
}), children);
|
|
2516
2609
|
}
|
|
2517
2610
|
}));
|
|
2518
2611
|
}
|
|
@@ -2558,8 +2651,10 @@ class PhoneNumberInput extends Component {
|
|
|
2558
2651
|
selectProps,
|
|
2559
2652
|
inputProps,
|
|
2560
2653
|
required,
|
|
2561
|
-
placeholder
|
|
2654
|
+
placeholder,
|
|
2655
|
+
testId
|
|
2562
2656
|
} = this.props;
|
|
2657
|
+
const testIds = getTestIds(testId, getPhoneNumberInputTestIds);
|
|
2563
2658
|
return /*#__PURE__*/createElement("div", {
|
|
2564
2659
|
className: cx(wrapper, className)
|
|
2565
2660
|
}, /*#__PURE__*/createElement("label", {
|
|
@@ -2574,12 +2669,15 @@ class PhoneNumberInput extends Component {
|
|
|
2574
2669
|
value: countryCode + "",
|
|
2575
2670
|
selected: countryCode
|
|
2576
2671
|
}, selectProps, {
|
|
2577
|
-
className: cx(selectStyle, selectProps && selectProps.className)
|
|
2672
|
+
className: cx(selectStyle, selectProps && selectProps.className),
|
|
2673
|
+
testId: testIds.countryId
|
|
2578
2674
|
}), this.props.children), /*#__PURE__*/createElement(Input, Object.assign({
|
|
2579
2675
|
onChange: this.onNumberChange,
|
|
2580
2676
|
placeholder: "",
|
|
2581
2677
|
value: phone
|
|
2582
|
-
}, inputProps
|
|
2678
|
+
}, inputProps, {
|
|
2679
|
+
testId: testIds.phoneId
|
|
2680
|
+
})));
|
|
2583
2681
|
}
|
|
2584
2682
|
}
|
|
2585
2683
|
|
|
@@ -2799,7 +2897,7 @@ class Tabs extends PureComponent {
|
|
|
2799
2897
|
const isSelected = this.state.selectedTab === tab;
|
|
2800
2898
|
return /*#__PURE__*/createElement("span", {
|
|
2801
2899
|
key: `${tab}-${i}`,
|
|
2802
|
-
"data-
|
|
2900
|
+
"data-testid": `${tab.replace(/\d/g, "").replace("(", "").replace(")", "").trim()}`,
|
|
2803
2901
|
className: cx(_className, isSelected && selectedTabStyle, isSelected && this.props.selectedTabClassName),
|
|
2804
2902
|
onClick: () => {
|
|
2805
2903
|
this.setState({
|
|
@@ -2965,14 +3063,17 @@ class RadioGroup extends PureComponent {
|
|
|
2965
3063
|
selected,
|
|
2966
3064
|
className,
|
|
2967
3065
|
name,
|
|
2968
|
-
disabled
|
|
3066
|
+
disabled,
|
|
3067
|
+
testId
|
|
2969
3068
|
} = this.props;
|
|
2970
|
-
const
|
|
3069
|
+
const testIds = getTestIds(testId, getRadioGroupTestIds);
|
|
3070
|
+
const _children = Children.map(children, (_radio, i) => {
|
|
2971
3071
|
const radio = _radio;
|
|
2972
3072
|
return cloneElement(radio, {
|
|
2973
3073
|
onChange: this.handleChange,
|
|
2974
3074
|
checked: selected === radio.props.value,
|
|
2975
|
-
disabled
|
|
3075
|
+
disabled,
|
|
3076
|
+
testId: testIds.optionId ? getOptionTestId(testIds.optionId, i) : undefined
|
|
2976
3077
|
});
|
|
2977
3078
|
});
|
|
2978
3079
|
return /*#__PURE__*/createElement("div", {
|
|
@@ -3173,7 +3274,8 @@ class SecondaryInput extends PureComponent {
|
|
|
3173
3274
|
message,
|
|
3174
3275
|
readOnly,
|
|
3175
3276
|
loading,
|
|
3176
|
-
className
|
|
3277
|
+
className,
|
|
3278
|
+
testId
|
|
3177
3279
|
} = this.props;
|
|
3178
3280
|
const {
|
|
3179
3281
|
isFocused
|
|
@@ -3203,7 +3305,9 @@ class SecondaryInput extends PureComponent {
|
|
|
3203
3305
|
},
|
|
3204
3306
|
onFocus: this.addFocus,
|
|
3205
3307
|
onBlur: this.removeFocus
|
|
3206
|
-
}, /*#__PURE__*/createElement("input", Object.assign({}, _inputProps, this.props.inputProps
|
|
3308
|
+
}, /*#__PURE__*/createElement("input", Object.assign({}, _inputProps, this.props.inputProps, {
|
|
3309
|
+
"data-testid": testId
|
|
3310
|
+
})), /*#__PURE__*/createElement("label", {
|
|
3207
3311
|
className: placeholderClassName
|
|
3208
3312
|
}, placeholder, required && /*#__PURE__*/createElement("span", {
|
|
3209
3313
|
style: {
|
|
@@ -3828,13 +3932,15 @@ const Text = ({
|
|
|
3828
3932
|
typography,
|
|
3829
3933
|
color = colors.gray.darker,
|
|
3830
3934
|
children,
|
|
3831
|
-
className
|
|
3935
|
+
className,
|
|
3936
|
+
testId
|
|
3832
3937
|
}) => {
|
|
3833
3938
|
const _className = /*#__PURE__*/css({ ...typography,
|
|
3834
3939
|
color
|
|
3835
3940
|
}, "" );
|
|
3836
3941
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
3837
|
-
className: cx(_className, className)
|
|
3942
|
+
className: cx(_className, className),
|
|
3943
|
+
"data-testid": testId
|
|
3838
3944
|
}, children);
|
|
3839
3945
|
};
|
|
3840
3946
|
|
|
@@ -3921,7 +4027,7 @@ const TimePicker = props => {
|
|
|
3921
4027
|
toggleDropdown();
|
|
3922
4028
|
},
|
|
3923
4029
|
className: buttonStyle,
|
|
3924
|
-
"data-
|
|
4030
|
+
"data-testid": "hour-label"
|
|
3925
4031
|
}, /*#__PURE__*/createElement("span", {
|
|
3926
4032
|
className: /*#__PURE__*/css( {
|
|
3927
4033
|
name: "1czd1rs-TimePicker",
|
|
@@ -3964,7 +4070,7 @@ const TimePicker = props => {
|
|
|
3964
4070
|
toggleDropdown();
|
|
3965
4071
|
},
|
|
3966
4072
|
className: buttonStyle,
|
|
3967
|
-
"data-
|
|
4073
|
+
"data-testid": "minute-label"
|
|
3968
4074
|
}, /*#__PURE__*/createElement("span", {
|
|
3969
4075
|
className: /*#__PURE__*/css( {
|
|
3970
4076
|
name: "1czd1rs-TimePicker",
|
|
@@ -4089,7 +4195,8 @@ function defaultSearchBox({
|
|
|
4089
4195
|
errorMessage: props.errorMessage,
|
|
4090
4196
|
loading: props.loading,
|
|
4091
4197
|
required: props.required,
|
|
4092
|
-
disabled: props.disabled
|
|
4198
|
+
disabled: props.disabled,
|
|
4199
|
+
testId: props.testId
|
|
4093
4200
|
}));
|
|
4094
4201
|
}
|
|
4095
4202
|
class TypeAhead extends PureComponent {
|
|
@@ -4126,8 +4233,10 @@ class TypeAhead extends PureComponent {
|
|
|
4126
4233
|
className,
|
|
4127
4234
|
searchBox = defaultSearchBox,
|
|
4128
4235
|
dropdownClassName,
|
|
4129
|
-
children
|
|
4236
|
+
children,
|
|
4237
|
+
testId
|
|
4130
4238
|
} = this.props;
|
|
4239
|
+
const testIds = getTestIds(testId, getTypeaheadTestIds);
|
|
4131
4240
|
const {
|
|
4132
4241
|
showSuggestions,
|
|
4133
4242
|
value
|
|
@@ -4142,14 +4251,17 @@ class TypeAhead extends PureComponent {
|
|
|
4142
4251
|
registerChange: this.registerChange,
|
|
4143
4252
|
onFocus: this.onFocus,
|
|
4144
4253
|
value
|
|
4145
|
-
}, this.props
|
|
4254
|
+
}, { ...this.props,
|
|
4255
|
+
testId: testIds.searchBoxId
|
|
4256
|
+
}), /*#__PURE__*/createElement(MountTransition, {
|
|
4146
4257
|
visible: showSuggestions,
|
|
4147
4258
|
native: true
|
|
4148
4259
|
}, transitionStyles => /*#__PURE__*/createElement(animated.div, {
|
|
4149
4260
|
style: transitionStyles,
|
|
4150
4261
|
className: cx(optionsWrapper$1, dropdownClassName)
|
|
4151
4262
|
}, /*#__PURE__*/createElement(OptionGroupRadio, {
|
|
4152
|
-
onChange: this.onSelect
|
|
4263
|
+
onChange: this.onSelect,
|
|
4264
|
+
testId: testIds.optionGroupId
|
|
4153
4265
|
}, children))));
|
|
4154
4266
|
}
|
|
4155
4267
|
}
|
|
@@ -4210,7 +4322,16 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
4210
4322
|
capitalize: capitalize,
|
|
4211
4323
|
getShortenedNumber: getShortenedNumber,
|
|
4212
4324
|
initGoogleAnalytics: initGoogleAnalytics,
|
|
4213
|
-
isDesktop: isDesktop
|
|
4325
|
+
isDesktop: isDesktop,
|
|
4326
|
+
getTestIds: getTestIds,
|
|
4327
|
+
getOptionTestId: getOptionTestId,
|
|
4328
|
+
getRadioGroupTestIds: getRadioGroupTestIds,
|
|
4329
|
+
getOptionGroupTestIds: getOptionGroupTestIds,
|
|
4330
|
+
getOptionGroupRadioTestIds: getOptionGroupRadioTestIds,
|
|
4331
|
+
getOptionGroupCheckBoxTestIds: getOptionGroupCheckBoxTestIds,
|
|
4332
|
+
getPhoneNumberInputTestIds: getPhoneNumberInputTestIds,
|
|
4333
|
+
getSelectInputTestIds: getSelectInputTestIds,
|
|
4334
|
+
getTypeaheadTestIds: getTypeaheadTestIds
|
|
4214
4335
|
});
|
|
4215
4336
|
|
|
4216
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 };
|