pebble-web 3.0.0-alpha.0 → 3.0.0-alpha.1

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.
Files changed (102) hide show
  1. package/dist/components/typings/Button.d.ts +1 -0
  2. package/dist/components/typings/Calendar.d.ts +1 -0
  3. package/dist/components/typings/CheckboxGroup.d.ts +1 -0
  4. package/dist/components/typings/Control.d.ts +1 -0
  5. package/dist/components/typings/DateInput.d.ts +1 -0
  6. package/dist/components/typings/Dropdown.d.ts +1 -0
  7. package/dist/components/typings/Input.d.ts +1 -0
  8. package/dist/components/typings/Loader.d.ts +1 -0
  9. package/dist/components/typings/Message.d.ts +1 -0
  10. package/dist/components/typings/OptionGroup.d.ts +1 -0
  11. package/dist/components/typings/OptionGroupCheckBox.d.ts +1 -0
  12. package/dist/components/typings/OptionGroupRadio.d.ts +1 -0
  13. package/dist/components/typings/PhoneNumberInput.d.ts +1 -0
  14. package/dist/components/typings/PopUp.d.ts +1 -0
  15. package/dist/components/typings/RadioGroup.d.ts +1 -0
  16. package/dist/components/typings/Search.d.ts +1 -0
  17. package/dist/components/typings/SecondaryInput.d.ts +1 -0
  18. package/dist/components/typings/Select.d.ts +1 -0
  19. package/dist/components/typings/Text.d.ts +1 -0
  20. package/dist/components/typings/Typeahead.d.ts +1 -0
  21. package/dist/index.d.ts +1 -0
  22. package/dist/pebble-web.dev.js +401 -179
  23. package/dist/pebble-web.dev.js.map +1 -1
  24. package/dist/pebble-web.es.dev.js +283 -85
  25. package/dist/pebble-web.es.dev.js.map +1 -1
  26. package/dist/pebble-web.es.js +277 -79
  27. package/dist/pebble-web.es.js.map +1 -1
  28. package/dist/pebble-web.js +395 -173
  29. package/dist/pebble-web.js.map +1 -1
  30. package/dist/pebble-web.module.dev.js +390 -180
  31. package/dist/pebble-web.module.dev.js.map +1 -1
  32. package/dist/pebble-web.module.js +384 -174
  33. package/dist/pebble-web.module.js.map +1 -1
  34. package/dist/pebble-web.umd.dev.js +409 -181
  35. package/dist/pebble-web.umd.dev.js.map +1 -1
  36. package/dist/pebble-web.umd.js +403 -175
  37. package/dist/pebble-web.umd.js.map +1 -1
  38. package/dist/utils/animation.d.ts +2 -19
  39. package/dist/utils/index.d.ts +1 -0
  40. package/dist/utils/testIds.d.ts +65 -0
  41. package/dist/utils/useragent/index.d.ts +1 -2
  42. package/package.json +3 -4
  43. package/src/components/Button.tsx +3 -1
  44. package/src/components/Calendar.tsx +28 -4
  45. package/src/components/CheckboxGroup.tsx +13 -3
  46. package/src/components/DateInput.tsx +3 -1
  47. package/src/components/DropDown.tsx +3 -1
  48. package/src/components/Input.tsx +15 -3
  49. package/src/components/Loader.tsx +3 -1
  50. package/src/components/Logo.tsx +22 -15
  51. package/src/components/Message.tsx +3 -1
  52. package/src/components/NativeDateInput.tsx +2 -1
  53. package/src/components/OptionGroupCheckBox.tsx +14 -2
  54. package/src/components/PhoneNumberInput.tsx +7 -1
  55. package/src/components/PopUp.tsx +7 -1
  56. package/src/components/RadioGroup.tsx +24 -4
  57. package/src/components/Search.tsx +3 -1
  58. package/src/components/SecondaryInput.tsx +9 -2
  59. package/src/components/Select.tsx +13 -1
  60. package/src/components/Tabs.tsx +1 -1
  61. package/src/components/Text.tsx +7 -2
  62. package/src/components/TimePicker.tsx +2 -2
  63. package/src/components/Toast.tsx +2 -2
  64. package/src/components/TypeAhead.tsx +14 -3
  65. package/src/components/__tests__/__snapshots__/checkboxGroup.test.tsx.snap +88 -0
  66. package/src/components/__tests__/__snapshots__/logo.test.tsx.snap +55 -12
  67. package/src/components/__tests__/__snapshots__/optionGroup.test.tsx.snap +0 -3
  68. package/src/components/__tests__/__snapshots__/select.test.tsx.snap +3 -0
  69. package/src/components/__tests__/__snapshots__/timepicker.test.tsx.snap +18 -18
  70. package/src/components/__tests__/calendar.test.tsx +6 -24
  71. package/src/components/__tests__/checkboxGroup.test.tsx +39 -8
  72. package/src/components/__tests__/select.test.tsx +19 -30
  73. package/src/components/__tests__/timepicker.test.tsx +4 -14
  74. package/src/components/shared/Control.tsx +3 -1
  75. package/src/components/shared/MountTransition.tsx +7 -3
  76. package/src/components/shared/OptionGroup.tsx +23 -5
  77. package/src/components/typings/Button.ts +1 -0
  78. package/src/components/typings/Calendar.ts +1 -0
  79. package/src/components/typings/CheckboxGroup.ts +1 -0
  80. package/src/components/typings/Control.ts +1 -0
  81. package/src/components/typings/DateInput.ts +1 -0
  82. package/src/components/typings/Dropdown.ts +1 -0
  83. package/src/components/typings/Input.ts +1 -0
  84. package/src/components/typings/Loader.ts +1 -0
  85. package/src/components/typings/Message.ts +1 -0
  86. package/src/components/typings/OptionGroup.ts +1 -0
  87. package/src/components/typings/OptionGroupCheckBox.ts +1 -0
  88. package/src/components/typings/OptionGroupRadio.ts +1 -0
  89. package/src/components/typings/PhoneNumberInput.ts +1 -0
  90. package/src/components/typings/PopUp.ts +1 -0
  91. package/src/components/typings/RadioGroup.ts +1 -0
  92. package/src/components/typings/Search.ts +1 -0
  93. package/src/components/typings/SecondaryInput.ts +1 -0
  94. package/src/components/typings/Select.ts +1 -0
  95. package/src/components/typings/Text.ts +1 -0
  96. package/src/components/typings/Typeahead.ts +1 -0
  97. package/src/index.ts +1 -0
  98. package/src/utils/animation.ts +3 -3
  99. package/src/utils/index.ts +1 -0
  100. package/src/utils/testIds.ts +119 -0
  101. package/src/utils/useragent/index.tsx +1 -1
  102. package/src/.DS_Store +0 -0
@@ -22,19 +22,13 @@ describe("Calendar", () => {
22
22
  selected={date}
23
23
  />
24
24
  );
25
- calendar
26
- .find(".react-calendar__tile")
27
- .at(0)
28
- .simulate("click");
25
+ calendar.find(".react-calendar__tile").at(0).simulate("click");
29
26
 
30
27
  // in case of range selector onChange should only be called once
31
28
  // both values of range have been selected.
32
29
  expect(changeSpy.calledOnce).toBeFalsy();
33
30
 
34
- calendar
35
- .find(".react-calendar__tile")
36
- .at(10)
37
- .simulate("click");
31
+ calendar.find(".react-calendar__tile").at(10).simulate("click");
38
32
 
39
33
  calendar
40
34
  .find(".calendar-test > div")
@@ -74,10 +68,7 @@ describe("Calendar", () => {
74
68
  />
75
69
  );
76
70
 
77
- calendar
78
- .find(".react-calendar__tile")
79
- .at(0)
80
- .simulate("click");
71
+ calendar.find(".react-calendar__tile").at(0).simulate("click");
81
72
 
82
73
  calendar
83
74
  .find(".calendar-test > div")
@@ -107,10 +98,7 @@ describe("Calendar", () => {
107
98
  selected={date[0]}
108
99
  />
109
100
  );
110
- calendar
111
- .find(".react-calendar__tile")
112
- .at(0)
113
- .simulate("click");
101
+ calendar.find(".react-calendar__tile").at(0).simulate("click");
114
102
 
115
103
  expect(changeSpy.calledOnce).toBeTruthy();
116
104
 
@@ -149,15 +137,9 @@ describe("Calendar", () => {
149
137
  />
150
138
  );
151
139
 
152
- calendar
153
- .find(".react-calendar__tile")
154
- .at(0)
155
- .simulate("click");
140
+ calendar.find(".react-calendar__tile").at(0).simulate("click");
156
141
 
157
- calendar
158
- .find(".react-calendar__tile")
159
- .at(10)
160
- .simulate("click");
142
+ calendar.find(".react-calendar__tile").at(10).simulate("click");
161
143
 
162
144
  calendar
163
145
  .find(".calendar-test > div")
@@ -1,9 +1,27 @@
1
1
  import * as React from "react";
2
2
  import { Checkbox, CheckboxGroup } from "../";
3
3
  import { mount } from "enzyme";
4
+ import renderer from "react-test-renderer";
4
5
  import sinon from "sinon";
5
6
 
6
7
  describe("CheckboxGroup", () => {
8
+ test("snapshot", () => {
9
+ const spy = sinon.spy();
10
+ const component = renderer.create(
11
+ <CheckboxGroup
12
+ selected={["checkbox-1"]}
13
+ onChange={spy}
14
+ name="test"
15
+ testId="checkbox-group"
16
+ >
17
+ <Checkbox value="checkbox-0" label="I am a checkbox" />
18
+ <Checkbox value="checkbox-1" label="I am a checkbox" />
19
+ </CheckboxGroup>
20
+ );
21
+ const tree = component.toJSON();
22
+ expect(tree).toMatchSnapshot();
23
+ });
24
+
7
25
  test("should call onChange on click with correct arguments", () => {
8
26
  const spy = sinon.spy();
9
27
 
@@ -14,10 +32,7 @@ describe("CheckboxGroup", () => {
14
32
  </CheckboxGroup>
15
33
  );
16
34
 
17
- checkbox
18
- .find(Checkbox)
19
- .at(1)
20
- .simulate("click");
35
+ checkbox.find(Checkbox).at(1).simulate("click");
21
36
 
22
37
  expect(spy.calledWith([])).toBeTruthy();
23
38
 
@@ -25,11 +40,27 @@ describe("CheckboxGroup", () => {
25
40
  selected: []
26
41
  });
27
42
 
28
- checkbox
29
- .find(Checkbox)
30
- .at(0)
31
- .simulate("click");
43
+ checkbox.find(Checkbox).at(0).simulate("click");
32
44
 
33
45
  expect(spy.calledWith(["checkbox-0"])).toBeTruthy();
34
46
  });
47
+
48
+ test("should append checkbox test ids for children", () => {
49
+ const spy = sinon.spy();
50
+
51
+ const checkbox = mount(
52
+ <CheckboxGroup
53
+ selected={[]}
54
+ onChange={spy}
55
+ name="test"
56
+ testId="checkbox-group"
57
+ >
58
+ <Checkbox value="checkbox-0" label="I am a checkbox" />
59
+ <Checkbox value="checkbox-1" label="I am a checkbox" />
60
+ </CheckboxGroup>
61
+ );
62
+
63
+ expect(checkbox.find("[data-testid='checkbox-group-0']").length).toBe(1);
64
+ expect(checkbox.find("[data-testid='checkbox-group-1']").length).toBe(1);
65
+ });
35
66
  });
@@ -9,6 +9,7 @@ import Button from "../Button";
9
9
  import Input from "../Input";
10
10
  import Search from "../Search";
11
11
  import "../../../tests/__setup__/matchers";
12
+ import { getSelectInputTestIds } from "../../utils/testIds";
12
13
 
13
14
  const options = new Array(5)
14
15
  .fill(1)
@@ -18,6 +19,9 @@ const options = new Array(5)
18
19
 
19
20
  const noop = () => {};
20
21
 
22
+ const SINGLE_SELECT_TEST_ID = "test-single-select";
23
+ const MULTI_SELECT_TEST_ID = "test-multi-select";
24
+
21
25
  function getComponent(
22
26
  spy = noop,
23
27
  props: Partial<SingleSelectProps<string>> = {}
@@ -28,6 +32,7 @@ function getComponent(
28
32
  placeholder="Choose Option"
29
33
  selected={"option-2"}
30
34
  {...props}
35
+ testId={SINGLE_SELECT_TEST_ID}
31
36
  >
32
37
  {options}
33
38
  </Select>
@@ -44,6 +49,7 @@ function getMultiSelectComponent<T>(
44
49
  placeholder="Choose Option"
45
50
  multiSelect
46
51
  {...props}
52
+ testId={MULTI_SELECT_TEST_ID}
47
53
  >
48
54
  {options}
49
55
  </Select>
@@ -96,18 +102,17 @@ describe("Component: Select", () => {
96
102
  const spy = sinon.spy();
97
103
  const select = mount(getComponent(spy));
98
104
  select.find(Input).simulate("click");
99
- select
100
- .find(Option)
101
- .at(2)
102
- .simulate("click");
105
+ select.find(Option).at(2).simulate("click");
103
106
 
104
107
  expect(spy.calledWith("option-3")).toBeTruthy();
105
108
 
106
109
  // wait for the dropdown animation to get over.
107
110
  clock.tick(1000);
108
111
 
112
+ const { optionGroupId } = getSelectInputTestIds(SINGLE_SELECT_TEST_ID);
113
+
109
114
  // This means that Option is no more rendered in DOM.
110
- expect(select).toNotBeInDOM("[data-test-id='optiongroup']");
115
+ expect(select).toNotBeInDOM(`[data-testid='${optionGroupId}']`);
111
116
  });
112
117
 
113
118
  test("multi select: should trigger onChange with correct onChange", () => {
@@ -124,10 +129,7 @@ describe("Component: Select", () => {
124
129
  })
125
130
  );
126
131
  select.find(Input).simulate("click");
127
- select
128
- .find(Option)
129
- .at(2)
130
- .simulate("click");
132
+ select.find(Option).at(2).simulate("click");
131
133
 
132
134
  expect(spy.calledWith(["option-3"])).toBeTruthy();
133
135
 
@@ -135,10 +137,7 @@ describe("Component: Select", () => {
135
137
  selected: ["option-3"]
136
138
  });
137
139
 
138
- select
139
- .find(Option)
140
- .at(3)
141
- .simulate("click");
140
+ select.find(Option).at(3).simulate("click");
142
141
 
143
142
  expect(spy.calledWith(["option-3", "option-4"])).toBeTruthy();
144
143
 
@@ -146,20 +145,14 @@ describe("Component: Select", () => {
146
145
  selected: ["option-3", "option-4"]
147
146
  });
148
147
 
149
- select
150
- .find(Option)
151
- .at(2)
152
- .simulate("click");
148
+ select.find(Option).at(2).simulate("click");
153
149
 
154
150
  expect(spy.calledWith(["option-4"])).toBeTruthy();
155
151
 
156
152
  expect(select.find(Button)).toHaveLength(2);
157
153
 
158
154
  // test onClear
159
- select
160
- .find(Button)
161
- .at(0)
162
- .simulate("click");
155
+ select.find(Button).at(0).simulate("click");
163
156
  expect(clearSpy.calledOnce).toBeTruthy();
164
157
 
165
158
  // Reopen dropdown and test onApply
@@ -168,16 +161,15 @@ describe("Component: Select", () => {
168
161
  selected: ["option-3"]
169
162
  });
170
163
 
171
- select
172
- .find(Button)
173
- .at(1)
174
- .simulate("click");
164
+ select.find(Button).at(1).simulate("click");
175
165
  expect(applySpy.calledWith(["option-3"])).toBeTruthy();
176
166
 
177
167
  clock.tick(1000);
178
168
 
169
+ const { optionGroupId } = getSelectInputTestIds(MULTI_SELECT_TEST_ID, true);
170
+
179
171
  // ensure the dropdown is closed
180
- expect(select).toNotBeInDOM("[data-test-id='optiongroup']");
172
+ expect(select).toNotBeInDOM(`[data-testid='${optionGroupId}']`);
181
173
  });
182
174
 
183
175
  test("single select: query change triggers onChange", () => {
@@ -222,10 +214,7 @@ describe("Component: Select", () => {
222
214
  );
223
215
  select.find(Input).simulate("click");
224
216
 
225
- select
226
- .find(Search)
227
- .find(".pi-close")
228
- .simulate("click");
217
+ select.find(Search).find(".pi-close").simulate("click");
229
218
  expect(clearQuerySpy.calledWith("")).toBeTruthy();
230
219
  });
231
220
 
@@ -36,30 +36,20 @@ describe("TimePicker: functionality test", () => {
36
36
  const timePicker = mount(
37
37
  <TimePicker onHourChange={spyHour} onMinuteChange={spyMinute} />
38
38
  );
39
- timePicker.find("[data-test-id='hour-label']").simulate("click");
39
+ timePicker.find("[data-testid='hour-label']").simulate("click");
40
40
 
41
41
  clock.tick(10000);
42
42
 
43
- timePicker
44
- .find(DropDown)
45
- .at(0)
46
- .find(Option)
47
- .at(0)
48
- .simulate("click");
43
+ timePicker.find(DropDown).at(0).find(Option).at(0).simulate("click");
49
44
 
50
45
  expect(spyHour.calledOnce).toBeTruthy();
51
46
  expect(spyHour.calledWith(1)).toBeTruthy();
52
47
 
53
- timePicker.find("[data-test-id='minute-label']").simulate("click");
48
+ timePicker.find("[data-testid='minute-label']").simulate("click");
54
49
 
55
50
  clock.tick(10000);
56
51
 
57
- timePicker
58
- .find(DropDown)
59
- .at(1)
60
- .find(Option)
61
- .at(0)
62
- .simulate("click");
52
+ timePicker.find(DropDown).at(1).find(Option).at(0).simulate("click");
63
53
 
64
54
  expect(spyMinute.calledOnce).toBeTruthy();
65
55
  expect(spyMinute.calledWith(0)).toBeTruthy();
@@ -13,7 +13,8 @@ function Control<OptionType>(props: ControlProps<OptionType>) {
13
13
  children = ControlView,
14
14
  type,
15
15
  className,
16
- indeterminate
16
+ indeterminate,
17
+ testId
17
18
  } = props;
18
19
  return (
19
20
  <div
@@ -30,6 +31,7 @@ function Control<OptionType>(props: ControlProps<OptionType>) {
30
31
  onChange && onChange({ value, checked: !checked }, e)
31
32
  : undefined
32
33
  }
34
+ data-testid={testId}
33
35
  >
34
36
  {children(props)}
35
37
  </div>
@@ -1,5 +1,10 @@
1
1
  import * as React from "react";
2
- import { Transition, UseTransitionProps, SpringValues } from "react-spring";
2
+ import {
3
+ Transition,
4
+ UseTransitionProps,
5
+ SpringValues,
6
+ TransitionComponentProps
7
+ } from "react-spring";
3
8
  import {
4
9
  animationConfig,
5
10
  TransitionPhase,
@@ -17,8 +22,7 @@ interface MountTransitionProps extends UseTransitionProps<boolean> {
17
22
 
18
23
  const MountTransition: React.FunctionComponent<MountTransitionProps> = props => {
19
24
  return (
20
- <Transition
21
- // @ts-expect-error
25
+ <Transition<boolean, TransitionComponentProps<boolean>>
22
26
  items={props.visible}
23
27
  {...animationConfig}
24
28
  {...props}
@@ -12,6 +12,11 @@ import {
12
12
  searchBoxHeight
13
13
  } from "../styles/OptionGroup.styles";
14
14
  import { rowWrapper, advancedActionsWrapper } from "../styles/Options.styles";
15
+ import {
16
+ getOptionGroupTestIds,
17
+ getOptionTestId,
18
+ getTestIds
19
+ } from "../../utils/testIds";
15
20
 
16
21
  class OptionGroup<OptionType> extends React.PureComponent<
17
22
  OptionGroupProps<OptionType>,
@@ -121,10 +126,13 @@ class OptionGroup<OptionType> extends React.PureComponent<
121
126
  className,
122
127
  isSelected,
123
128
  handleChange,
124
- searchBoxProps
129
+ searchBoxProps,
130
+ testId
125
131
  } = this.props;
126
132
  const { isScrolled, highlighted } = this.state;
127
133
 
134
+ const testIds = getTestIds(testId, getOptionGroupTestIds);
135
+
128
136
  const _children = React.Children.map(children, (_option, i) => {
129
137
  // `_option as React.ReactElement<OptionProps>` is a hack
130
138
  // Because React does not allow us to specify what sort of elements
@@ -142,7 +150,10 @@ class OptionGroup<OptionType> extends React.PureComponent<
142
150
  isSelected: isSelected(option.props.value),
143
151
  multiSelect,
144
152
  // @ts-ignore
145
- ref
153
+ ref,
154
+ testId: testIds.optionId
155
+ ? getOptionTestId(testIds.optionId, i)
156
+ : undefined
146
157
  });
147
158
  });
148
159
 
@@ -168,6 +179,7 @@ class OptionGroup<OptionType> extends React.PureComponent<
168
179
  onKeyDown: this.handleKeyPress,
169
180
  autoFocus: true
170
181
  }}
182
+ testId={testIds.searchBoxId}
171
183
  />
172
184
  </div>
173
185
  )}
@@ -179,15 +191,21 @@ class OptionGroup<OptionType> extends React.PureComponent<
179
191
  }}
180
192
  className={cx(optionsWrapper, className)}
181
193
  role={multiSelect ? "group" : "radiogroup"}
182
- data-test-id="optiongroup"
194
+ data-testid={testId}
183
195
  aria-label={searchBoxProps && searchBoxProps.placeholder}
184
196
  >
185
197
  {advancedOptions && advancedOptionsProps && (
186
198
  <div className={_class}>
187
- <div onClick={advancedOptionsProps.selectVisible}>
199
+ <div
200
+ onClick={advancedOptionsProps.selectVisible}
201
+ data-testid={testIds.selectVisibleId}
202
+ >
188
203
  Select Visible
189
204
  </div>
190
- <div onClick={advancedOptionsProps.clearVisible}>
205
+ <div
206
+ onClick={advancedOptionsProps.clearVisible}
207
+ data-testid={testIds.clearVisibleId}
208
+ >
191
209
  Clear Visible
192
210
  </div>
193
211
  </div>
@@ -16,6 +16,7 @@ export interface ButtonProps {
16
16
  loading?: boolean;
17
17
  outline?: boolean;
18
18
  buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
19
+ testId?: string;
19
20
  }
20
21
 
21
22
  export interface DropDownButtonProps extends ButtonProps {
@@ -12,6 +12,7 @@ interface CommonCalendarProps extends Omit<CP, "onChange"> {
12
12
  onClear?: () => void;
13
13
  tileDots: TileDot[];
14
14
  disabledDays?: Array<number | Date>;
15
+ testId?: string;
15
16
  }
16
17
 
17
18
  export interface DateSingle extends CommonCalendarProps {
@@ -6,4 +6,5 @@ export interface CheckboxGroupProps<OptionType> {
6
6
  className?: string;
7
7
  name: string;
8
8
  disabled?: boolean;
9
+ testId?: string;
9
10
  }
@@ -14,4 +14,5 @@ export interface ControlProps<OptionType> {
14
14
  className?: string;
15
15
  iconClassName?: string;
16
16
  indeterminate?: boolean;
17
+ testId?: string;
17
18
  }
@@ -18,6 +18,7 @@ export interface DateInputProps {
18
18
  onOutsideClick?: (isOpen: boolean) => void;
19
19
  controlled?: boolean;
20
20
  isOpen?: boolean;
21
+ testId?: string;
21
22
  }
22
23
 
23
24
  export interface DateInputState {
@@ -25,6 +25,7 @@ export interface DropdownProps {
25
25
  modifiers?: Modifiers;
26
26
  controlled?: boolean;
27
27
  isOpen?: boolean;
28
+ testId?: string;
28
29
  }
29
30
 
30
31
  export interface DropdownState {
@@ -20,6 +20,7 @@ export interface CommonInputProps {
20
20
  successMessage?: string;
21
21
  leftElement?: () => React.ReactNode;
22
22
  rightElement?: () => React.ReactNode;
23
+ testId?: string;
23
24
  }
24
25
 
25
26
  export type InputType =
@@ -2,4 +2,5 @@ export interface LoaderProps {
2
2
  color?: string;
3
3
  className?: string;
4
4
  scale?: number;
5
+ testId?: string;
5
6
  }
@@ -4,4 +4,5 @@ export interface AlertProps {
4
4
  intent: "error" | "success";
5
5
  className?: string;
6
6
  text: React.ReactChild;
7
+ testId?: string;
7
8
  }
@@ -13,6 +13,7 @@ export interface CommonProps {
13
13
  selectVisible?: () => void;
14
14
  clearVisible?: () => void;
15
15
  };
16
+ testId?: string;
16
17
  }
17
18
 
18
19
  export interface OptionGroupProps<OptionType> extends CommonProps {
@@ -13,4 +13,5 @@ export interface OptionGroupCheckBoxProps<OptionType> extends CommonProps {
13
13
  props: OptionGroupCheckBoxProps<OptionType>
14
14
  ) => void;
15
15
  onClear?: () => void;
16
+ testId?: string;
16
17
  }
@@ -7,4 +7,5 @@ export interface OptionGroupRadio<OptionType> extends CommonProps {
7
7
  */
8
8
  selected?: OptionType;
9
9
  isSelected?: (value: OptionType) => boolean;
10
+ testId?: string;
10
11
  }
@@ -19,4 +19,5 @@ export interface PhoneNumberInputProps<OptionType = string> {
19
19
  inputProps?: Omit<SimpleInputProps, "value" | "onChange" | "placeholder">;
20
20
  placeholder?: string;
21
21
  required?: boolean;
22
+ testId?: string;
22
23
  }
@@ -9,4 +9,5 @@ export interface PopUpProps {
9
9
  rejectButtonText?: string | Element;
10
10
  approveButtonProps?: Omit<ButtonProps, "children" | "onClick">;
11
11
  rejectButtonProps?: Omit<ButtonProps, "children" | "onClick">;
12
+ testId?: string;
12
13
  }
@@ -7,4 +7,5 @@ export interface RadioGroupProps<OptionType> {
7
7
  className?: string;
8
8
  name: string;
9
9
  disabled?: boolean;
10
+ testId?: string;
10
11
  }
@@ -10,4 +10,5 @@ export interface SearchProps {
10
10
  clearable?: boolean;
11
11
  inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
12
12
  loading?: boolean;
13
+ testId?: string;
13
14
  }
@@ -14,6 +14,7 @@ export interface SecondaryInputProps {
14
14
  message?: string;
15
15
  inputProps?: React.InputHTMLAttributes<HTMLInputElement> &
16
16
  React.RefAttributes<HTMLInputElement>;
17
+ testId?: string;
17
18
  }
18
19
 
19
20
  export interface SecondaryInputState {
@@ -23,6 +23,7 @@ export interface CommonSelectProps<OptionType> {
23
23
  isSelected?: (value: OptionType) => boolean;
24
24
  placement?: Placement;
25
25
  modifiers?: Modifiers;
26
+ testId?: string;
26
27
  }
27
28
 
28
29
  export interface SingleSelectProps<OptionType>
@@ -4,4 +4,5 @@ export interface TextProps {
4
4
  color?: string;
5
5
  className?: string;
6
6
  typography?: TypographyStyle;
7
+ testId?: string;
7
8
  }
@@ -34,6 +34,7 @@ export interface TypeaheadProps<OptionType> {
34
34
  valueExtractor: (value: OptionType) => string;
35
35
  onClear?: () => void;
36
36
  inputProps?: Omit<SimpleInputProps, "onChange" | "value" | "placeholder">;
37
+ testId?: string;
37
38
  }
38
39
 
39
40
  export interface TypeaheadState {
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./theme";
2
2
  export * from "./components";
3
3
  export * from "./utils/useragent";
4
+ export * from "./utils/testIds";
4
5
 
5
6
  import * as utils from "./utils";
6
7
  import { colors } from "pebble-shared";
@@ -1,14 +1,14 @@
1
- import { TransitionState } from "react-spring";
1
+ import { TransitionState, UseTransitionProps } from "react-spring";
2
2
 
3
3
  // TransitionPhase enum is not exported by react-spring package
4
4
  // so we alias it as a type here
5
5
  export type TransitionPhase = TransitionState["phase"];
6
6
 
7
- export const animationConfig = {
7
+ export const animationConfig: UseTransitionProps<boolean> = {
8
8
  from: { opacity: 0, transform: "scale(0.95)" },
9
9
  enter: { opacity: 1, transform: "scale(1)" },
10
10
  leave: { opacity: 0, transform: "scale(0.95)", pointerEvents: "none" },
11
- config: (_show: boolean, _index: number, state: TransitionPhase) =>
11
+ config: (_show, _index, state) =>
12
12
  state === "leave" ? { duration: 80 } : { duration: 200 }
13
13
  };
14
14
 
@@ -2,3 +2,4 @@ export * from "./strings/capitalize";
2
2
  export * from "./numbers/format";
3
3
  export * from "./analytics/ga";
4
4
  export * from "./dimensions";
5
+ export * from "./testIds";