pebble-web 2.25.2-alpha.3 → 2.26.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 +0 -1
- package/dist/components/typings/Calendar.d.ts +0 -1
- package/dist/components/typings/CheckboxGroup.d.ts +0 -1
- package/dist/components/typings/Control.d.ts +0 -1
- package/dist/components/typings/DateInput.d.ts +0 -1
- package/dist/components/typings/Dropdown.d.ts +0 -1
- package/dist/components/typings/Input.d.ts +0 -1
- package/dist/components/typings/Loader.d.ts +0 -1
- package/dist/components/typings/Message.d.ts +0 -1
- package/dist/components/typings/OptionGroup.d.ts +0 -1
- package/dist/components/typings/OptionGroupCheckBox.d.ts +0 -1
- package/dist/components/typings/OptionGroupRadio.d.ts +0 -1
- package/dist/components/typings/PhoneNumberInput.d.ts +0 -1
- package/dist/components/typings/PopUp.d.ts +0 -1
- package/dist/components/typings/RadioGroup.d.ts +0 -1
- package/dist/components/typings/Search.d.ts +0 -1
- package/dist/components/typings/SecondaryInput.d.ts +0 -1
- package/dist/components/typings/Select.d.ts +0 -1
- package/dist/components/typings/Text.d.ts +0 -1
- package/dist/components/typings/Typeahead.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/pebble-web.dev.js +164 -358
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +70 -239
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +64 -233
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +158 -352
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +165 -347
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +159 -341
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +166 -360
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +160 -354
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/useragent/index.d.ts +1 -2
- package/package.json +3 -3
- package/src/components/Button.tsx +1 -3
- package/src/components/Calendar.tsx +4 -28
- package/src/components/CheckboxGroup.tsx +3 -13
- package/src/components/DateInput.tsx +1 -3
- package/src/components/DropDown.tsx +1 -3
- package/src/components/Input.tsx +3 -15
- package/src/components/Loader.tsx +1 -3
- package/src/components/Message.tsx +1 -3
- package/src/components/NativeDateInput.tsx +1 -2
- package/src/components/OptionGroupCheckBox.tsx +2 -14
- package/src/components/PhoneNumberInput.tsx +1 -7
- package/src/components/PopUp.tsx +1 -7
- package/src/components/RadioGroup.tsx +3 -20
- package/src/components/Search.tsx +1 -3
- package/src/components/SecondaryInput.tsx +2 -9
- package/src/components/Select.tsx +1 -13
- package/src/components/Tabs.tsx +1 -1
- package/src/components/Text.tsx +2 -7
- package/src/components/TimePicker.tsx +2 -2
- package/src/components/Toast.tsx +2 -2
- package/src/components/TypeAhead.tsx +3 -14
- package/src/components/__tests__/__snapshots__/optionGroup.test.tsx.snap +3 -0
- package/src/components/__tests__/__snapshots__/select.test.tsx.snap +0 -3
- package/src/components/__tests__/__snapshots__/timepicker.test.tsx.snap +18 -18
- package/src/components/__tests__/calendar.test.tsx +24 -6
- package/src/components/__tests__/checkboxGroup.test.tsx +8 -39
- package/src/components/__tests__/select.test.tsx +30 -19
- package/src/components/__tests__/timepicker.test.tsx +14 -4
- package/src/components/shared/Control.tsx +1 -3
- package/src/components/shared/OptionGroup.tsx +5 -23
- package/src/components/typings/Button.ts +0 -1
- package/src/components/typings/Calendar.ts +0 -1
- package/src/components/typings/CheckboxGroup.ts +0 -1
- package/src/components/typings/Control.ts +0 -1
- package/src/components/typings/DateInput.ts +0 -1
- package/src/components/typings/Dropdown.ts +0 -1
- package/src/components/typings/Input.ts +0 -1
- package/src/components/typings/Loader.ts +0 -1
- package/src/components/typings/Message.ts +0 -1
- package/src/components/typings/OptionGroup.ts +0 -1
- package/src/components/typings/OptionGroupCheckBox.ts +0 -1
- package/src/components/typings/OptionGroupRadio.ts +0 -1
- package/src/components/typings/PhoneNumberInput.ts +0 -1
- package/src/components/typings/PopUp.ts +0 -1
- package/src/components/typings/RadioGroup.ts +0 -1
- package/src/components/typings/Search.ts +0 -1
- package/src/components/typings/SecondaryInput.ts +0 -1
- package/src/components/typings/Select.ts +0 -1
- package/src/components/typings/Text.ts +0 -1
- package/src/components/typings/Typeahead.ts +0 -1
- package/src/index.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/useragent/index.tsx +1 -1
- package/dist/utils/testIds.d.ts +0 -65
- package/src/components/__tests__/__snapshots__/checkboxGroup.test.tsx.snap +0 -88
- package/src/utils/testIds.ts +0 -119
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
interface UserAgentInfoProviderProps {
|
|
2
|
+
export interface UserAgentInfoProviderProps {
|
|
3
3
|
userAgent: string;
|
|
4
4
|
}
|
|
5
5
|
export interface UserAgentInfo {
|
|
@@ -10,4 +10,3 @@ export declare class UserAgentInfoProvider extends React.PureComponent<UserAgent
|
|
|
10
10
|
constructor(props: UserAgentInfoProviderProps);
|
|
11
11
|
render(): JSX.Element;
|
|
12
12
|
}
|
|
13
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pebble-web",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"author": "ritz078 <rkritesh078@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/pebble-web.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"build:watch": "chokidar 'src/**/*.ts' 'src/**/*.tsx' -c 'yarn build'",
|
|
20
20
|
"pretest": "tslint ./src/**/*.{ts,tsx} ./stories/**/*.{ts,tsx} ./{tests,typings}/**/*.{ts,tsx}",
|
|
21
21
|
"test": "jest --coverage",
|
|
22
|
-
"
|
|
22
|
+
"_prepublishOnly": "yarn build && yarn test",
|
|
23
23
|
"test:watch": "yarn jest --watchAll"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"utility-types": "^3.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"pebble-shared": "^2.
|
|
47
|
+
"pebble-shared": "^2.26.0"
|
|
48
48
|
},
|
|
49
49
|
"greenkeeper": {
|
|
50
50
|
"ignore": [
|
|
@@ -23,8 +23,7 @@ const Button: React.FunctionComponent<ButtonProps> = ({
|
|
|
23
23
|
loading,
|
|
24
24
|
outline,
|
|
25
25
|
size = "small",
|
|
26
|
-
buttonProps
|
|
27
|
-
testId
|
|
26
|
+
buttonProps
|
|
28
27
|
}: ButtonProps) => {
|
|
29
28
|
const disableAction = disabled || loading;
|
|
30
29
|
|
|
@@ -41,7 +40,6 @@ const Button: React.FunctionComponent<ButtonProps> = ({
|
|
|
41
40
|
onClick={!disableAction ? onClick : undefined}
|
|
42
41
|
style={{ width }}
|
|
43
42
|
disabled={disabled}
|
|
44
|
-
data-testid={testId}
|
|
45
43
|
{...buttonProps}
|
|
46
44
|
>
|
|
47
45
|
{loading ? <Loader color={colors.white.base} scale={0.4} /> : children}
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
} from "./styles/Calendar.styles";
|
|
14
14
|
import Button from "./Button";
|
|
15
15
|
import { isSameDay, endOfDay, startOfDay, addDays, subDays } from "date-fns";
|
|
16
|
-
import { getCalendarTestIds, getTestIds } from "../utils/testIds";
|
|
17
16
|
|
|
18
17
|
class Calendar extends React.PureComponent<CalendarProps, CalendarState> {
|
|
19
18
|
static defaultProps: Partial<CalendarProps> = {
|
|
@@ -137,16 +136,9 @@ class Calendar extends React.PureComponent<CalendarProps, CalendarState> {
|
|
|
137
136
|
onClear,
|
|
138
137
|
maxDate,
|
|
139
138
|
minDate,
|
|
140
|
-
testId,
|
|
141
139
|
...rest
|
|
142
140
|
} = this.props;
|
|
143
141
|
const { maxRangeDates } = this.state;
|
|
144
|
-
const {
|
|
145
|
-
leftIconId,
|
|
146
|
-
rightIconId,
|
|
147
|
-
clearButtonId,
|
|
148
|
-
applyButtonId
|
|
149
|
-
} = getTestIds(testId, id => getCalendarTestIds(id));
|
|
150
142
|
|
|
151
143
|
return (
|
|
152
144
|
<div
|
|
@@ -173,18 +165,10 @@ class Calendar extends React.PureComponent<CalendarProps, CalendarState> {
|
|
|
173
165
|
tileDisabled={this.getDisabledDays}
|
|
174
166
|
onClickDay={this.onDayClick}
|
|
175
167
|
prevLabel={
|
|
176
|
-
<i
|
|
177
|
-
style={{ fontSize: 14 }}
|
|
178
|
-
className="pi pi-chevron-left"
|
|
179
|
-
data-testid={leftIconId}
|
|
180
|
-
/>
|
|
168
|
+
<i style={{ fontSize: 14 }} className="pi pi-chevron-left" />
|
|
181
169
|
}
|
|
182
170
|
nextLabel={
|
|
183
|
-
<i
|
|
184
|
-
style={{ fontSize: 14 }}
|
|
185
|
-
className="pi pi-arrow-right"
|
|
186
|
-
data-testid={rightIconId}
|
|
187
|
-
/>
|
|
171
|
+
<i style={{ fontSize: 14 }} className="pi pi-arrow-right" />
|
|
188
172
|
}
|
|
189
173
|
maxDate={maxDate || (maxRangeDates && maxRangeDates.future)}
|
|
190
174
|
minDate={minDate || (maxRangeDates && maxRangeDates.past)}
|
|
@@ -193,19 +177,11 @@ class Calendar extends React.PureComponent<CalendarProps, CalendarState> {
|
|
|
193
177
|
{(onClear || onApply) && (
|
|
194
178
|
<div className={buttonsWrapper}>
|
|
195
179
|
{onClear && (
|
|
196
|
-
<Button
|
|
197
|
-
onClick={this.onClear}
|
|
198
|
-
type="secondary"
|
|
199
|
-
testId={clearButtonId}
|
|
200
|
-
>
|
|
180
|
+
<Button onClick={this.onClear} type="secondary">
|
|
201
181
|
Clear
|
|
202
182
|
</Button>
|
|
203
183
|
)}
|
|
204
|
-
{onApply &&
|
|
205
|
-
<Button onClick={this.onApply} testId={applyButtonId}>
|
|
206
|
-
Apply
|
|
207
|
-
</Button>
|
|
208
|
-
)}
|
|
184
|
+
{onApply && <Button onClick={this.onApply}>Apply</Button>}
|
|
209
185
|
</div>
|
|
210
186
|
)}
|
|
211
187
|
</div>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CheckboxGroupProps } from "./typings/CheckboxGroup";
|
|
3
3
|
import { CheckboxProps } from "./typings/Checkbox";
|
|
4
|
-
import { getOptionTestId } from "../utils/testIds";
|
|
5
4
|
import { getSelectedCheckboxes } from "./utils/getSelectedCheckboxes";
|
|
6
5
|
|
|
7
6
|
export default class CheckboxGroup<OptionType> extends React.PureComponent<
|
|
@@ -16,17 +15,9 @@ export default class CheckboxGroup<OptionType> extends React.PureComponent<
|
|
|
16
15
|
};
|
|
17
16
|
|
|
18
17
|
render() {
|
|
19
|
-
const {
|
|
20
|
-
children,
|
|
21
|
-
selected,
|
|
22
|
-
className,
|
|
23
|
-
name,
|
|
24
|
-
disabled,
|
|
25
|
-
testId
|
|
26
|
-
} = this.props;
|
|
18
|
+
const { children, selected, className, name, disabled } = this.props;
|
|
27
19
|
|
|
28
|
-
const _children = React.Children.map(children,
|
|
29
|
-
const index = typeof i === "number" ? i : 0;
|
|
20
|
+
const _children = React.Children.map(children, _checkbox => {
|
|
30
21
|
// `_checkbox as React.ReactElement<CheckboxProps>` is a hack
|
|
31
22
|
// Because React does not allow us to specify what sort of elements
|
|
32
23
|
// you can allow as children and leaves it on you to figure out
|
|
@@ -37,8 +28,7 @@ export default class CheckboxGroup<OptionType> extends React.PureComponent<
|
|
|
37
28
|
return React.cloneElement(checkbox, {
|
|
38
29
|
onChange: this.handleChange,
|
|
39
30
|
checked: selected.indexOf(checkbox.props.value) >= 0,
|
|
40
|
-
disabled
|
|
41
|
-
testId: testId ? getOptionTestId(testId, index) : undefined
|
|
31
|
+
disabled
|
|
42
32
|
});
|
|
43
33
|
});
|
|
44
34
|
|
|
@@ -94,8 +94,7 @@ export default class DateInput extends React.PureComponent<
|
|
|
94
94
|
initiallyOpen,
|
|
95
95
|
onOutsideClick,
|
|
96
96
|
controlled,
|
|
97
|
-
isOpen
|
|
98
|
-
testId
|
|
97
|
+
isOpen
|
|
99
98
|
} = this.props;
|
|
100
99
|
|
|
101
100
|
const _wrapperClassName = cx(wrapperStyle, wrapperClassName);
|
|
@@ -132,7 +131,6 @@ export default class DateInput extends React.PureComponent<
|
|
|
132
131
|
}}
|
|
133
132
|
className={cx(inputStyle, inputProps && inputProps.className)}
|
|
134
133
|
disabled={disabled}
|
|
135
|
-
testId={testId}
|
|
136
134
|
/>
|
|
137
135
|
)}
|
|
138
136
|
</Rifm>
|
|
@@ -48,8 +48,7 @@ class DropDown extends React.PureComponent<DropdownProps, DropdownState> {
|
|
|
48
48
|
disabled,
|
|
49
49
|
labelClassName,
|
|
50
50
|
controlled,
|
|
51
|
-
onOutsideClick
|
|
52
|
-
testId
|
|
51
|
+
onOutsideClick
|
|
53
52
|
} = this.props;
|
|
54
53
|
|
|
55
54
|
const _isDropDownOpen = controlled
|
|
@@ -83,7 +82,6 @@ class DropDown extends React.PureComponent<DropdownProps, DropdownState> {
|
|
|
83
82
|
onClick={this.toggleDropdown}
|
|
84
83
|
disabled={disabled}
|
|
85
84
|
className={labelClassName}
|
|
86
|
-
testId={testId}
|
|
87
85
|
>
|
|
88
86
|
{buttonLabel}
|
|
89
87
|
</DropDownButton>
|
package/src/components/Input.tsx
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from "./styles/Input.styles";
|
|
16
16
|
import { colors } from "pebble-shared";
|
|
17
17
|
import Loader from "./Loader";
|
|
18
|
-
import { getMessageTestId } from "../utils/testIds";
|
|
19
18
|
|
|
20
19
|
function getColor(
|
|
21
20
|
error: string | undefined,
|
|
@@ -85,8 +84,7 @@ class Input extends React.PureComponent<InputProps, InputState> {
|
|
|
85
84
|
onClick,
|
|
86
85
|
loading,
|
|
87
86
|
leftElement,
|
|
88
|
-
rightElement
|
|
89
|
-
testId
|
|
87
|
+
rightElement
|
|
90
88
|
} = this.props;
|
|
91
89
|
const { isFocused } = this.state;
|
|
92
90
|
|
|
@@ -154,18 +152,9 @@ class Input extends React.PureComponent<InputProps, InputState> {
|
|
|
154
152
|
{leftElement?.()}
|
|
155
153
|
|
|
156
154
|
{this.props.textArea ? (
|
|
157
|
-
<textarea
|
|
158
|
-
{..._inputProps}
|
|
159
|
-
{...this.props.inputProps}
|
|
160
|
-
data-testid={testId}
|
|
161
|
-
/>
|
|
155
|
+
<textarea {..._inputProps} {...this.props.inputProps} />
|
|
162
156
|
) : (
|
|
163
|
-
<input
|
|
164
|
-
type={type}
|
|
165
|
-
{..._inputProps}
|
|
166
|
-
{...this.props.inputProps}
|
|
167
|
-
data-testid={testId}
|
|
168
|
-
/>
|
|
157
|
+
<input type={type} {..._inputProps} {...this.props.inputProps} />
|
|
169
158
|
)}
|
|
170
159
|
|
|
171
160
|
{loading && (
|
|
@@ -198,7 +187,6 @@ class Input extends React.PureComponent<InputProps, InputState> {
|
|
|
198
187
|
{_message && (
|
|
199
188
|
<div
|
|
200
189
|
className={messageStyle}
|
|
201
|
-
data-testid={testId ? getMessageTestId(testId) : undefined}
|
|
202
190
|
style={{ color: getColor(errorMessage, successMessage) }}
|
|
203
191
|
>
|
|
204
192
|
{_message}
|
|
@@ -7,8 +7,7 @@ import { cx } from "emotion";
|
|
|
7
7
|
const Loader: React.FunctionComponent<LoaderProps> = ({
|
|
8
8
|
color = colors.gray.darker,
|
|
9
9
|
scale = 1,
|
|
10
|
-
className
|
|
11
|
-
testId
|
|
10
|
+
className
|
|
12
11
|
}) => {
|
|
13
12
|
const style = {
|
|
14
13
|
backgroundColor: color
|
|
@@ -17,7 +16,6 @@ const Loader: React.FunctionComponent<LoaderProps> = ({
|
|
|
17
16
|
<div
|
|
18
17
|
className={cx(spinnerStyle, className)}
|
|
19
18
|
style={{ transform: `scale(${scale})` }}
|
|
20
|
-
data-testid={testId}
|
|
21
19
|
>
|
|
22
20
|
<div style={style} />
|
|
23
21
|
<div style={style} />
|
|
@@ -7,8 +7,7 @@ import { AlertProps } from "./typings/Message";
|
|
|
7
7
|
const Message: React.FunctionComponent<AlertProps> = ({
|
|
8
8
|
intent,
|
|
9
9
|
className,
|
|
10
|
-
text
|
|
11
|
-
testId
|
|
10
|
+
text
|
|
12
11
|
}) => {
|
|
13
12
|
const bColor = _colors[intent];
|
|
14
13
|
|
|
@@ -23,7 +22,6 @@ const Message: React.FunctionComponent<AlertProps> = ({
|
|
|
23
22
|
style={{
|
|
24
23
|
backgroundColor: bColor
|
|
25
24
|
}}
|
|
26
|
-
data-testid={testId}
|
|
27
25
|
>
|
|
28
26
|
<i className={iconClass} />
|
|
29
27
|
{text}
|
|
@@ -12,7 +12,7 @@ export default class NativeDateInput extends React.PureComponent<
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
render() {
|
|
15
|
-
const { inputProps, placeholder, value, disabled
|
|
15
|
+
const { inputProps, placeholder, value, disabled } = this.props;
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<Input
|
|
@@ -26,7 +26,6 @@ export default class NativeDateInput extends React.PureComponent<
|
|
|
26
26
|
fixLabelAtTop
|
|
27
27
|
{...inputProps}
|
|
28
28
|
disabled={disabled}
|
|
29
|
-
testId={testId}
|
|
30
29
|
/>
|
|
31
30
|
);
|
|
32
31
|
}
|
|
@@ -6,7 +6,6 @@ import OptionGroup from "./shared/OptionGroup";
|
|
|
6
6
|
import { OptionGroupCheckBoxProps } from "./typings/OptionGroupCheckBox";
|
|
7
7
|
import * as styles from "../components/styles/OptionGroupCheckBox.styles";
|
|
8
8
|
import { OptionProps } from "./typings/Option";
|
|
9
|
-
import { getOptionGroupCheckBoxTestIds, getTestIds } from "../utils/testIds";
|
|
10
9
|
|
|
11
10
|
export default class OptionGroupCheckBox<
|
|
12
11
|
OptionType
|
|
@@ -53,7 +52,6 @@ export default class OptionGroupCheckBox<
|
|
|
53
52
|
onClear,
|
|
54
53
|
isSelected,
|
|
55
54
|
onChange,
|
|
56
|
-
testId,
|
|
57
55
|
...rest
|
|
58
56
|
} = this.props;
|
|
59
57
|
const advancedOptionsProps = {
|
|
@@ -61,7 +59,6 @@ export default class OptionGroupCheckBox<
|
|
|
61
59
|
clearVisible: this.clearVisible,
|
|
62
60
|
...this.props.advancedOptionsProps
|
|
63
61
|
};
|
|
64
|
-
const testIds = getTestIds(testId, getOptionGroupCheckBoxTestIds);
|
|
65
62
|
return (
|
|
66
63
|
<div className={cx(styles.optionGroupCheckBoxWrap, wrapClassName)}>
|
|
67
64
|
<OptionGroup<OptionType>
|
|
@@ -70,25 +67,16 @@ export default class OptionGroupCheckBox<
|
|
|
70
67
|
isSelected={isSelected || this.isSelected}
|
|
71
68
|
handleChange={this.handleChange}
|
|
72
69
|
multiSelect
|
|
73
|
-
testId={testId}
|
|
74
70
|
/>
|
|
75
71
|
|
|
76
72
|
{(onApply || onClear) && (
|
|
77
73
|
<div className={styles.optionGroupCheckBoxButtonWrap}>
|
|
78
74
|
{onClear && (
|
|
79
|
-
<Button
|
|
80
|
-
type="secondary"
|
|
81
|
-
onClick={onClear}
|
|
82
|
-
testId={testIds.clearButtonId}
|
|
83
|
-
>
|
|
75
|
+
<Button type="secondary" onClick={onClear}>
|
|
84
76
|
Clear
|
|
85
77
|
</Button>
|
|
86
78
|
)}
|
|
87
|
-
{onApply &&
|
|
88
|
-
<Button onClick={this.onApply} testId={testIds.applyButtonId}>
|
|
89
|
-
Apply
|
|
90
|
-
</Button>
|
|
91
|
-
)}
|
|
79
|
+
{onApply && <Button onClick={this.onApply}>Apply</Button>}
|
|
92
80
|
</div>
|
|
93
81
|
)}
|
|
94
82
|
</div>
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
} from "./styles/PhoneNumberInput.styles";
|
|
11
11
|
import { labelStyle } from "./styles/Input.styles";
|
|
12
12
|
import { colors } from "pebble-shared";
|
|
13
|
-
import { getPhoneNumberInputTestIds, getTestIds } from "../utils/testIds";
|
|
14
13
|
|
|
15
14
|
export default class PhoneNumberInput<
|
|
16
15
|
OptionType = string
|
|
@@ -41,11 +40,8 @@ export default class PhoneNumberInput<
|
|
|
41
40
|
selectProps,
|
|
42
41
|
inputProps,
|
|
43
42
|
required,
|
|
44
|
-
placeholder
|
|
45
|
-
testId
|
|
43
|
+
placeholder
|
|
46
44
|
} = this.props;
|
|
47
|
-
|
|
48
|
-
const testIds = getTestIds(testId, getPhoneNumberInputTestIds);
|
|
49
45
|
return (
|
|
50
46
|
<div className={cx(wrapper, className)}>
|
|
51
47
|
<label
|
|
@@ -65,7 +61,6 @@ export default class PhoneNumberInput<
|
|
|
65
61
|
selected={countryCode}
|
|
66
62
|
{...selectProps}
|
|
67
63
|
className={cx(selectStyle, selectProps && selectProps.className)}
|
|
68
|
-
testId={testIds.countryId}
|
|
69
64
|
>
|
|
70
65
|
{this.props.children}
|
|
71
66
|
</Select>
|
|
@@ -74,7 +69,6 @@ export default class PhoneNumberInput<
|
|
|
74
69
|
placeholder=""
|
|
75
70
|
value={phone}
|
|
76
71
|
{...inputProps}
|
|
77
|
-
testId={testIds.phoneId}
|
|
78
72
|
/>
|
|
79
73
|
</div>
|
|
80
74
|
);
|
package/src/components/PopUp.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
flexCenter
|
|
10
10
|
} from "./styles/PopUp.styles";
|
|
11
11
|
import { PopUpProps } from "./typings/PopUp";
|
|
12
|
-
import { getPopUpTestIds, getTestIds } from "../utils/testIds";
|
|
13
12
|
|
|
14
13
|
const PopUp: React.FunctionComponent<PopUpProps> = props => {
|
|
15
14
|
const {
|
|
@@ -21,10 +20,8 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
|
|
|
21
20
|
rejectButtonText = "No",
|
|
22
21
|
children,
|
|
23
22
|
approveButtonProps,
|
|
24
|
-
rejectButtonProps
|
|
25
|
-
testId
|
|
23
|
+
rejectButtonProps
|
|
26
24
|
} = props;
|
|
27
|
-
const {closeButtonId, approveButtonId, rejectButtonId} = getTestIds(testId, id => getPopUpTestIds(id));
|
|
28
25
|
return (
|
|
29
26
|
<Modal visible={visible} modalClassName={flexCenter}>
|
|
30
27
|
<div className={modalContainer}>
|
|
@@ -32,7 +29,6 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
|
|
|
32
29
|
<i
|
|
33
30
|
className={cx("pi", "pi-close", iconCloseClassName)}
|
|
34
31
|
onClick={onClose}
|
|
35
|
-
data-testid={closeButtonId}
|
|
36
32
|
/>
|
|
37
33
|
)}
|
|
38
34
|
{children}
|
|
@@ -44,7 +40,6 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
|
|
|
44
40
|
type="secondary"
|
|
45
41
|
onClick={onReject}
|
|
46
42
|
{...rejectButtonProps}
|
|
47
|
-
testId={rejectButtonId}
|
|
48
43
|
>
|
|
49
44
|
{rejectButtonText}
|
|
50
45
|
</Button>
|
|
@@ -55,7 +50,6 @@ const PopUp: React.FunctionComponent<PopUpProps> = props => {
|
|
|
55
50
|
type="primary"
|
|
56
51
|
onClick={onApprove}
|
|
57
52
|
{...approveButtonProps}
|
|
58
|
-
testId={approveButtonId}
|
|
59
53
|
>
|
|
60
54
|
{approveButtonText}
|
|
61
55
|
</Button>
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { RadioProps } from "./typings/Radio";
|
|
3
3
|
import { RadioGroupProps } from "./typings/RadioGroup";
|
|
4
|
-
import {
|
|
5
|
-
getOptionTestId,
|
|
6
|
-
getRadioGroupTestIds,
|
|
7
|
-
getTestIds
|
|
8
|
-
} from "../utils/testIds";
|
|
9
4
|
|
|
10
5
|
export default class RadioGroup<OptionType> extends React.PureComponent<
|
|
11
6
|
RadioGroupProps<OptionType>
|
|
@@ -20,18 +15,9 @@ export default class RadioGroup<OptionType> extends React.PureComponent<
|
|
|
20
15
|
};
|
|
21
16
|
|
|
22
17
|
render() {
|
|
23
|
-
const {
|
|
24
|
-
children,
|
|
25
|
-
selected,
|
|
26
|
-
className,
|
|
27
|
-
name,
|
|
28
|
-
disabled,
|
|
29
|
-
testId
|
|
30
|
-
} = this.props;
|
|
18
|
+
const { children, selected, className, name, disabled } = this.props;
|
|
31
19
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const _children = React.Children.map(children, (_radio, i) => {
|
|
20
|
+
const _children = React.Children.map(children, _radio => {
|
|
35
21
|
// `_radio as React.ReactElement<RadioProps>` is a hack
|
|
36
22
|
// Because React does not allow us to specify what sort of elements
|
|
37
23
|
// you can allow as children and leaves it on you to figure out
|
|
@@ -40,10 +26,7 @@ export default class RadioGroup<OptionType> extends React.PureComponent<
|
|
|
40
26
|
return React.cloneElement(radio, {
|
|
41
27
|
onChange: this.handleChange,
|
|
42
28
|
checked: selected === radio.props.value,
|
|
43
|
-
disabled
|
|
44
|
-
testId: testIds.optionId
|
|
45
|
-
? getOptionTestId(testIds.optionId, i)
|
|
46
|
-
: undefined
|
|
29
|
+
disabled
|
|
47
30
|
});
|
|
48
31
|
});
|
|
49
32
|
|
|
@@ -27,8 +27,7 @@ class Search extends React.PureComponent<SearchProps> {
|
|
|
27
27
|
className,
|
|
28
28
|
clearable,
|
|
29
29
|
value,
|
|
30
|
-
loading
|
|
31
|
-
testId
|
|
30
|
+
loading
|
|
32
31
|
} = this.props;
|
|
33
32
|
|
|
34
33
|
const wrapperClassName = cx(searchWrapperStyle, {
|
|
@@ -51,7 +50,6 @@ class Search extends React.PureComponent<SearchProps> {
|
|
|
51
50
|
ref={this.searchInputRef}
|
|
52
51
|
value={value}
|
|
53
52
|
{...inputProps}
|
|
54
|
-
data-testid={testId}
|
|
55
53
|
/>
|
|
56
54
|
{loading && <Loader scale={0.4} color={colors.violet.base} />}
|
|
57
55
|
{clearable && (
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
messageStyle,
|
|
13
13
|
placeholderStyle
|
|
14
14
|
} from "./styles/SecondaryInput.styles";
|
|
15
|
-
import { getMessageTestId } from "../utils/testIds";
|
|
16
15
|
import {
|
|
17
16
|
SecondaryInputProps,
|
|
18
17
|
SecondaryInputState
|
|
@@ -77,8 +76,7 @@ export default class SecondaryInput extends React.PureComponent<
|
|
|
77
76
|
message,
|
|
78
77
|
readOnly,
|
|
79
78
|
loading,
|
|
80
|
-
className
|
|
81
|
-
testId
|
|
79
|
+
className
|
|
82
80
|
} = this.props;
|
|
83
81
|
const { isFocused } = this.state;
|
|
84
82
|
|
|
@@ -121,11 +119,7 @@ export default class SecondaryInput extends React.PureComponent<
|
|
|
121
119
|
onFocus={this.addFocus}
|
|
122
120
|
onBlur={this.removeFocus}
|
|
123
121
|
>
|
|
124
|
-
<input
|
|
125
|
-
{..._inputProps}
|
|
126
|
-
{...this.props.inputProps}
|
|
127
|
-
data-testid={testId}
|
|
128
|
-
/>
|
|
122
|
+
<input {..._inputProps} {...this.props.inputProps} />
|
|
129
123
|
<label className={placeholderClassName}>
|
|
130
124
|
{placeholder}
|
|
131
125
|
{required && (
|
|
@@ -140,7 +134,6 @@ export default class SecondaryInput extends React.PureComponent<
|
|
|
140
134
|
{_message && (
|
|
141
135
|
<div
|
|
142
136
|
className={messageStyle}
|
|
143
|
-
data-testid={testId ? getMessageTestId(testId) : undefined}
|
|
144
137
|
style={{ color: getColor(errorMessage, successMessage) }}
|
|
145
138
|
>
|
|
146
139
|
{_message}
|
|
@@ -16,7 +16,6 @@ import DropDown from "./DropDown";
|
|
|
16
16
|
import Input from "./Input";
|
|
17
17
|
import OptionGroupCheckBox from "./OptionGroupCheckBox";
|
|
18
18
|
import OptionGroupRadio from "./OptionGroupRadio";
|
|
19
|
-
import { getSelectInputTestIds, getTestIds } from "../utils/testIds";
|
|
20
19
|
|
|
21
20
|
function noop() {}
|
|
22
21
|
|
|
@@ -35,17 +34,9 @@ function Select<OptionType>(props: SelectProps<OptionType>) {
|
|
|
35
34
|
disabled,
|
|
36
35
|
isSelected,
|
|
37
36
|
placement,
|
|
38
|
-
modifiers
|
|
39
|
-
testId
|
|
37
|
+
modifiers
|
|
40
38
|
} = props;
|
|
41
39
|
|
|
42
|
-
const singleSelectTestIds = getTestIds(testId, id =>
|
|
43
|
-
getSelectInputTestIds(id, false)
|
|
44
|
-
);
|
|
45
|
-
const multiSelectTestIds = getTestIds(testId, id =>
|
|
46
|
-
getSelectInputTestIds(id, true)
|
|
47
|
-
);
|
|
48
|
-
|
|
49
40
|
return (
|
|
50
41
|
<div
|
|
51
42
|
className={cx(selectWrapper, className, {
|
|
@@ -77,7 +68,6 @@ function Select<OptionType>(props: SelectProps<OptionType>) {
|
|
|
77
68
|
onDropdownToggle(isOpen);
|
|
78
69
|
}
|
|
79
70
|
}
|
|
80
|
-
data-testid={singleSelectTestIds.inputId}
|
|
81
71
|
>
|
|
82
72
|
<Input
|
|
83
73
|
className={selectInputWrapper}
|
|
@@ -163,7 +153,6 @@ function Select<OptionType>(props: SelectProps<OptionType>) {
|
|
|
163
153
|
})
|
|
164
154
|
}
|
|
165
155
|
{...commonProps}
|
|
166
|
-
testId={multiSelectTestIds.optionGroupId}
|
|
167
156
|
>
|
|
168
157
|
{children}
|
|
169
158
|
</OptionGroupCheckBox>
|
|
@@ -178,7 +167,6 @@ function Select<OptionType>(props: SelectProps<OptionType>) {
|
|
|
178
167
|
toggle();
|
|
179
168
|
}}
|
|
180
169
|
{...commonProps}
|
|
181
|
-
testId={singleSelectTestIds.optionGroupId}
|
|
182
170
|
>
|
|
183
171
|
{children}
|
|
184
172
|
</OptionGroupRadio>
|
package/src/components/Tabs.tsx
CHANGED
package/src/components/Text.tsx
CHANGED
|
@@ -7,19 +7,14 @@ const Text: React.FunctionComponent<TextProps> = ({
|
|
|
7
7
|
typography,
|
|
8
8
|
color = colors.gray.darker,
|
|
9
9
|
children,
|
|
10
|
-
className
|
|
11
|
-
testId
|
|
10
|
+
className
|
|
12
11
|
}) => {
|
|
13
12
|
const _className = css({
|
|
14
13
|
...typography,
|
|
15
14
|
color
|
|
16
15
|
});
|
|
17
16
|
|
|
18
|
-
return (
|
|
19
|
-
<span className={cx(_className, className)} data-testid={testId}>
|
|
20
|
-
{children}
|
|
21
|
-
</span>
|
|
22
|
-
);
|
|
17
|
+
return <span className={cx(_className, className)}>{children}</span>;
|
|
23
18
|
};
|
|
24
19
|
|
|
25
20
|
export default Text;
|
|
@@ -78,7 +78,7 @@ const TimePicker: React.FunctionComponent<TimePickerProps> = props => {
|
|
|
78
78
|
toggleDropdown();
|
|
79
79
|
}}
|
|
80
80
|
className={buttonStyle}
|
|
81
|
-
data-
|
|
81
|
+
data-test-id="hour-label"
|
|
82
82
|
>
|
|
83
83
|
<span className={css({ marginRight: "15px" })}>
|
|
84
84
|
{selectedHour !== undefined
|
|
@@ -128,7 +128,7 @@ const TimePicker: React.FunctionComponent<TimePickerProps> = props => {
|
|
|
128
128
|
toggleDropdown();
|
|
129
129
|
}}
|
|
130
130
|
className={buttonStyle}
|
|
131
|
-
data-
|
|
131
|
+
data-test-id="minute-label"
|
|
132
132
|
>
|
|
133
133
|
<span className={css({ marginRight: "15px" })}>
|
|
134
134
|
{selectedMinute !== undefined
|
package/src/components/Toast.tsx
CHANGED
|
@@ -124,12 +124,12 @@ class Toast extends React.PureComponent<ToastProps, ToastState> {
|
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
componentDidMount() {
|
|
127
|
-
emitter.on<EventType>("showToast",
|
|
127
|
+
emitter.on<EventType>("showToast", this.show);
|
|
128
128
|
emitter.on<EventType>("hideToast", this.hide);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
componentWillUnmount() {
|
|
132
|
-
emitter.off<EventType>("showToast",
|
|
132
|
+
emitter.off<EventType>("showToast", this.show);
|
|
133
133
|
emitter.off("hideToast", this.hide);
|
|
134
134
|
}
|
|
135
135
|
|