@hero-design/rn 7.23.0 → 7.24.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.
Files changed (73) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/assets/fonts/hero-icons.ttf +0 -0
  3. package/es/index.js +857 -8825
  4. package/lib/assets/fonts/hero-icons.ttf +0 -0
  5. package/lib/index.js +858 -8824
  6. package/package.json +6 -4
  7. package/rollup.config.js +1 -0
  8. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +1 -0
  9. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -0
  10. package/src/components/Empty/index.tsx +1 -2
  11. package/src/components/Icon/HeroIcon/fonts/hero-icons.ttf +0 -0
  12. package/src/components/Icon/HeroIcon/glyphMap.json +1 -0
  13. package/src/components/Icon/HeroIcon/index.tsx +3 -7
  14. package/src/components/Icon/IconList.ts +8 -5
  15. package/src/components/Icon/index.tsx +1 -0
  16. package/src/components/RichTextEditor/RichTextEditor.tsx +1 -4
  17. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -0
  18. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +8 -4
  19. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
  20. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +8 -4
  21. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
  22. package/src/components/Spinner/AnimatedSpinner.tsx +22 -7
  23. package/src/components/Spinner/StyledSpinner.tsx +16 -11
  24. package/src/components/Spinner/__tests__/AnimatedSpinner.spec.tsx +3 -1
  25. package/src/components/Spinner/__tests__/StyledSpinner.spec.tsx +42 -31
  26. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +8 -4
  27. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +532 -72
  28. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +8 -4
  29. package/src/components/Spinner/index.tsx +6 -1
  30. package/src/components/Swipeable/StyledSwipeable.tsx +11 -0
  31. package/src/components/Swipeable/SwipeableAction.tsx +45 -0
  32. package/src/components/Swipeable/__tests__/SwipeableAction.spec.tsx +37 -0
  33. package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +130 -0
  34. package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +33 -0
  35. package/src/components/Swipeable/__tests__/index.spec.tsx +34 -0
  36. package/src/components/Swipeable/index.tsx +148 -0
  37. package/src/components/TextInput/StyledTextInput.tsx +6 -12
  38. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +12 -6
  39. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +22 -138
  40. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +13 -0
  41. package/src/components/TextInput/__tests__/index.spec.tsx +114 -124
  42. package/src/components/TextInput/index.tsx +7 -6
  43. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +1 -0
  44. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -0
  45. package/src/index.ts +4 -0
  46. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +11 -6
  47. package/src/theme/components/spinner.ts +4 -1
  48. package/src/theme/components/swipeable.ts +13 -0
  49. package/src/theme/components/textInput.ts +0 -5
  50. package/src/theme/getTheme.ts +3 -0
  51. package/src/theme/global/colors/jobs.ts +0 -1
  52. package/src/theme/global/colors/work.ts +0 -2
  53. package/src/types.ts +2 -0
  54. package/testUtils/setup.tsx +13 -0
  55. package/types/components/Empty/index.d.ts +1 -2
  56. package/types/components/Icon/IconList.d.ts +1 -1
  57. package/types/components/Icon/index.d.ts +4 -1
  58. package/types/components/Icon/utils.d.ts +1 -1
  59. package/types/components/Spinner/AnimatedSpinner.d.ts +2 -1
  60. package/types/components/Spinner/StyledSpinner.d.ts +1 -0
  61. package/types/components/Spinner/index.d.ts +5 -1
  62. package/types/components/Swipeable/StyledSwipeable.d.ts +10 -0
  63. package/types/components/Swipeable/SwipeableAction.d.ts +27 -0
  64. package/types/components/Swipeable/index.d.ts +41 -0
  65. package/types/components/TextInput/StyledTextInput.d.ts +2 -1
  66. package/types/components/TextInput/index.d.ts +1 -1
  67. package/types/index.d.ts +3 -2
  68. package/types/theme/components/spinner.d.ts +4 -1
  69. package/types/theme/components/swipeable.d.ts +9 -0
  70. package/types/theme/components/textInput.d.ts +0 -5
  71. package/types/theme/getTheme.d.ts +2 -0
  72. package/types/types.d.ts +2 -1
  73. package/src/components/Icon/HeroIcon/selection.json +0 -7029
@@ -1,37 +1,27 @@
1
- import { fireEvent, within } from "@testing-library/react-native";
2
- import React from "react";
3
- import { theme } from "../../..";
4
- import renderWithTheme from "../../../testHelpers/renderWithTheme";
5
- import Icon from "../../Icon";
6
- import TextInput, { getVariant } from "../index";
7
-
8
- describe("getVariant", () => {
1
+ import { fireEvent, within } from '@testing-library/react-native';
2
+ import React from 'react';
3
+ import { theme } from '../../..';
4
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
5
+ import Icon from '../../Icon';
6
+ import TextInput, { getVariant } from '../index';
7
+
8
+ describe('getVariant', () => {
9
9
  it.each`
10
- disabled | error | editable | loading | isFocused | isEmptyValue | expected
11
- ${false} | ${undefined} | ${true} | ${false} | ${false} | ${true} | ${"default"}
12
- ${false} | ${undefined} | ${true} | ${false} | ${false} | ${false} | ${"filled"}
13
- ${false} | ${undefined} | ${true} | ${false} | ${true} | ${true} | ${"focused"}
14
- ${false} | ${undefined} | ${false} | ${true} | ${true} | ${true} | ${"readonly"}
15
- ${false} | ${"This field is required"} | ${false} | ${false} | ${true} | ${true} | ${"error"}
16
- ${true} | ${"This field is required"} | ${false} | ${false} | ${true} | ${true} | ${"disabled"}
10
+ disabled | error | editable | loading | isEmptyValue | expected
11
+ ${false} | ${undefined} | ${true} | ${false} | ${true} | ${'default'}
12
+ ${false} | ${undefined} | ${true} | ${false} | ${false} | ${'filled'}
13
+ ${false} | ${undefined} | ${false} | ${true} | ${true} | ${'readonly'}
14
+ ${false} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'error'}
15
+ ${true} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'disabled'}
17
16
  `(
18
- "should return the correct variant when disabled $disabled, errorMessage $errorMessage, editable $false, isFocused $isFocused, isEmptyValue $isEmptyValue",
19
- ({
20
- disabled,
21
- error,
22
- editable,
23
- loading,
24
- isFocused,
25
- isEmptyValue,
26
- expected,
27
- }) => {
17
+ 'should return the correct variant when disabled $disabled, errorMessage $errorMessage, editable $false, isEmptyValue $isEmptyValue',
18
+ ({ disabled, error, editable, loading, isEmptyValue, expected }) => {
28
19
  expect(
29
20
  getVariant({
30
21
  disabled,
31
22
  error,
32
23
  editable,
33
24
  loading,
34
- isFocused,
35
25
  isEmptyValue,
36
26
  })
37
27
  ).toBe(expected);
@@ -39,9 +29,9 @@ describe("getVariant", () => {
39
29
  );
40
30
  });
41
31
 
42
- describe("TextInput", () => {
43
- describe("idle", () => {
44
- it("renders correctly", () => {
32
+ describe('TextInput', () => {
33
+ describe('idle', () => {
34
+ it('renders correctly', () => {
45
35
  const { getByTestId, toJSON } = renderWithTheme(
46
36
  <TextInput
47
37
  label="Amount (AUD)"
@@ -53,25 +43,25 @@ describe("TextInput", () => {
53
43
  );
54
44
 
55
45
  expect(toJSON()).toMatchSnapshot();
56
- expect(getByTestId("idle-text-input")).toBeTruthy();
46
+ expect(getByTestId('idle-text-input')).toBeTruthy();
57
47
  expect(
58
- within(getByTestId("idle-text-input")).queryAllByTestId("text-input")
48
+ within(getByTestId('idle-text-input')).queryAllByTestId('text-input')
59
49
  ).toHaveLength(1);
60
50
  expect(
61
- within(getByTestId("idle-text-input")).queryAllByText("Amount (AUD)")
51
+ within(getByTestId('idle-text-input')).queryAllByText('Amount (AUD)')
62
52
  ).toHaveLength(1);
63
53
  expect(
64
- within(getByTestId("idle-text-input")).queryAllByTestId("input-label")
54
+ within(getByTestId('idle-text-input')).queryAllByTestId('input-label')
65
55
  ).toHaveLength(1);
66
56
  expect(
67
- within(getByTestId("idle-text-input")).queryAllByTestId("input-prefix")
57
+ within(getByTestId('idle-text-input')).queryAllByTestId('input-prefix')
68
58
  ).toHaveLength(1);
69
59
  expect(
70
- within(getByTestId("idle-text-input")).queryAllByTestId("input-suffix")
60
+ within(getByTestId('idle-text-input')).queryAllByTestId('input-suffix')
71
61
  ).toHaveLength(1);
72
62
  });
73
63
 
74
- it("should not render input-label if label is empty", () => {
64
+ it('should not render input-label if label is empty', () => {
75
65
  const { getByTestId } = renderWithTheme(
76
66
  <TextInput
77
67
  prefix="dollar-sign"
@@ -80,13 +70,13 @@ describe("TextInput", () => {
80
70
  />
81
71
  );
82
72
 
83
- expect(getByTestId("idle-text-input")).toBeTruthy();
73
+ expect(getByTestId('idle-text-input')).toBeTruthy();
84
74
  expect(
85
- within(getByTestId("idle-text-input")).queryAllByTestId("input-label")
75
+ within(getByTestId('idle-text-input')).queryAllByTestId('input-label')
86
76
  ).toHaveLength(0);
87
77
  });
88
78
 
89
- it("onChangeText, onBlur, onFocus", () => {
79
+ it('onChangeText, onBlur, onFocus', () => {
90
80
  const onChangeText = jest.fn();
91
81
  const onBlur = jest.fn();
92
82
  const onFocus = jest.fn();
@@ -102,23 +92,23 @@ describe("TextInput", () => {
102
92
  />
103
93
  );
104
94
 
105
- const testInput = within(getByTestId("idle-text-input")).getByTestId(
106
- "text-input"
95
+ const testInput = within(getByTestId('idle-text-input')).getByTestId(
96
+ 'text-input'
107
97
  );
108
98
 
109
- fireEvent.changeText(testInput, "Thong Quach");
110
- expect(onChangeText).toHaveBeenCalledWith("Thong Quach");
99
+ fireEvent.changeText(testInput, 'Thong Quach');
100
+ expect(onChangeText).toHaveBeenCalledWith('Thong Quach');
111
101
 
112
- fireEvent(testInput, "blur");
102
+ fireEvent(testInput, 'blur');
113
103
  expect(onBlur).toHaveBeenCalledTimes(1);
114
104
 
115
- fireEvent(testInput, "focus");
105
+ fireEvent(testInput, 'focus');
116
106
  expect(onFocus).toHaveBeenCalledTimes(1);
117
107
  });
118
108
  });
119
109
 
120
- describe("idle with suffix and prefix are React Element", () => {
121
- it("renders correctly", () => {
110
+ describe('idle with suffix and prefix are React Element', () => {
111
+ it('renders correctly', () => {
122
112
  const { toJSON, queryAllByTestId, queryAllByText } = renderWithTheme(
123
113
  <TextInput
124
114
  label="Amount (AUD)"
@@ -129,16 +119,16 @@ describe("TextInput", () => {
129
119
  );
130
120
 
131
121
  expect(toJSON()).toMatchSnapshot();
132
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
133
- expect(queryAllByText("*")).toHaveLength(1);
134
- expect(queryAllByTestId("input-label")).toHaveLength(1);
135
- expect(queryAllByTestId("prefix-element")).toHaveLength(1);
136
- expect(queryAllByTestId("suffix-element")).toHaveLength(1);
137
- expect(queryAllByTestId("text-input")).toHaveLength(1);
122
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
123
+ expect(queryAllByText('*')).toHaveLength(1);
124
+ expect(queryAllByTestId('input-label')).toHaveLength(1);
125
+ expect(queryAllByTestId('prefix-element')).toHaveLength(1);
126
+ expect(queryAllByTestId('suffix-element')).toHaveLength(1);
127
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
138
128
  });
139
129
  });
140
- describe("required", () => {
141
- it("renders correctly", () => {
130
+ describe('required', () => {
131
+ it('renders correctly', () => {
142
132
  const { toJSON, queryAllByTestId, queryAllByText } = renderWithTheme(
143
133
  <TextInput
144
134
  label="Amount (AUD)"
@@ -149,17 +139,17 @@ describe("TextInput", () => {
149
139
  );
150
140
 
151
141
  expect(toJSON()).toMatchSnapshot();
152
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
153
- expect(queryAllByText("*")).toHaveLength(1);
154
- expect(queryAllByTestId("input-label")).toHaveLength(1);
155
- expect(queryAllByTestId("input-prefix")).toHaveLength(1);
156
- expect(queryAllByTestId("input-suffix")).toHaveLength(1);
157
- expect(queryAllByTestId("text-input")).toHaveLength(1);
142
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
143
+ expect(queryAllByText('*')).toHaveLength(1);
144
+ expect(queryAllByTestId('input-label')).toHaveLength(1);
145
+ expect(queryAllByTestId('input-prefix')).toHaveLength(1);
146
+ expect(queryAllByTestId('input-suffix')).toHaveLength(1);
147
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
158
148
  });
159
149
  });
160
150
 
161
- describe("filled", () => {
162
- it("renders correctly", () => {
151
+ describe('filled', () => {
152
+ it('renders correctly', () => {
163
153
  const {
164
154
  toJSON,
165
155
  queryAllByTestId,
@@ -175,17 +165,17 @@ describe("TextInput", () => {
175
165
  );
176
166
 
177
167
  expect(toJSON()).toMatchSnapshot();
178
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
179
- expect(queryAllByDisplayValue("100")).toHaveLength(1);
180
- expect(queryAllByTestId("input-label")).toHaveLength(1);
181
- expect(queryAllByTestId("input-prefix")).toHaveLength(1);
182
- expect(queryAllByTestId("input-suffix")).toHaveLength(1);
183
- expect(queryAllByTestId("text-input")).toHaveLength(1);
168
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
169
+ expect(queryAllByDisplayValue('100')).toHaveLength(1);
170
+ expect(queryAllByTestId('input-label')).toHaveLength(1);
171
+ expect(queryAllByTestId('input-prefix')).toHaveLength(1);
172
+ expect(queryAllByTestId('input-suffix')).toHaveLength(1);
173
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
184
174
  });
185
175
  });
186
176
 
187
- describe("readonly", () => {
188
- it("renders correctly", () => {
177
+ describe('readonly', () => {
178
+ it('renders correctly', () => {
189
179
  const onChangeText = jest.fn();
190
180
  const {
191
181
  toJSON,
@@ -206,31 +196,31 @@ describe("TextInput", () => {
206
196
  );
207
197
 
208
198
  expect(toJSON()).toMatchSnapshot();
209
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
210
- expect(queryAllByDisplayValue("100")).toHaveLength(1);
211
- expect(queryAllByTestId("input-label")).toHaveLength(1);
212
- expect(queryAllByTestId("input-prefix")).toHaveLength(1);
213
- expect(queryAllByTestId("input-suffix")).toHaveLength(1);
214
- expect(queryAllByTestId("text-input")).toHaveLength(1);
215
-
216
- expect(getByTestId("text-input")).not.toHaveProp("editable", "false");
199
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
200
+ expect(queryAllByDisplayValue('100')).toHaveLength(1);
201
+ expect(queryAllByTestId('input-label')).toHaveLength(1);
202
+ expect(queryAllByTestId('input-prefix')).toHaveLength(1);
203
+ expect(queryAllByTestId('input-suffix')).toHaveLength(1);
204
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
205
+
206
+ expect(getByTestId('text-input')).not.toHaveProp('editable', 'false');
217
207
  });
218
208
  });
219
209
 
220
- describe("loading", () => {
221
- it("renders correctly", () => {
210
+ describe('loading', () => {
211
+ it('renders correctly', () => {
222
212
  const { toJSON, queryAllByTestId, getByTestId } = renderWithTheme(
223
213
  <TextInput suffix="arrow-down" loading />
224
214
  );
225
215
 
226
216
  expect(toJSON()).toMatchSnapshot();
227
- expect(queryAllByTestId("text-input")).toHaveLength(1);
228
- expect(getByTestId("input-suffix")).toHaveProp("name", "loading");
217
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
218
+ expect(getByTestId('input-suffix')).toHaveProp('name', 'loading');
229
219
  });
230
220
  });
231
221
 
232
- describe("max length", () => {
233
- it("renders correctly", () => {
222
+ describe('max length', () => {
223
+ it('renders correctly', () => {
234
224
  const {
235
225
  toJSON,
236
226
  queryAllByTestId,
@@ -249,18 +239,18 @@ describe("TextInput", () => {
249
239
  );
250
240
 
251
241
  expect(toJSON()).toMatchSnapshot();
252
- expect(queryAllByText("Shout out")).toHaveLength(1);
253
- expect(queryAllByDisplayValue("shout out Tung Van")).toHaveLength(1);
254
- expect(queryAllByText("18/255")).toHaveLength(1);
255
- expect(queryAllByTestId("input-label")).toHaveLength(1);
256
- expect(queryAllByTestId("text-input")).toHaveLength(1);
242
+ expect(queryAllByText('Shout out')).toHaveLength(1);
243
+ expect(queryAllByDisplayValue('shout out Tung Van')).toHaveLength(1);
244
+ expect(queryAllByText('18/255')).toHaveLength(1);
245
+ expect(queryAllByTestId('input-label')).toHaveLength(1);
246
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
257
247
 
258
- expect(getByTestId("text-input")).not.toHaveProp("multiline", "true");
248
+ expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
259
249
  });
260
250
  });
261
251
 
262
- describe("disabled", () => {
263
- it("renders correctly", () => {
252
+ describe('disabled', () => {
253
+ it('renders correctly', () => {
264
254
  const { toJSON, queryAllByTestId, queryAllByText, getByTestId } =
265
255
  renderWithTheme(
266
256
  <TextInput
@@ -273,17 +263,17 @@ describe("TextInput", () => {
273
263
  );
274
264
 
275
265
  expect(toJSON()).toMatchSnapshot();
276
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
277
- expect(queryAllByTestId("input-label")).toHaveLength(1);
278
- expect(queryAllByTestId("text-input")).toHaveLength(1);
279
- expect(getByTestId("disabled-text-input")).toBeDisabled();
266
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
267
+ expect(queryAllByTestId('input-label')).toHaveLength(1);
268
+ expect(queryAllByTestId('text-input')).toHaveLength(1);
269
+ expect(getByTestId('disabled-text-input')).toBeDisabled();
280
270
 
281
- expect(getByTestId("text-input")).not.toHaveProp("multiline", "true");
271
+ expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
282
272
  });
283
273
  });
284
274
 
285
- describe("error", () => {
286
- it("renders correctly", () => {
275
+ describe('error', () => {
276
+ it('renders correctly', () => {
287
277
  const { toJSON, queryAllByText } = renderWithTheme(
288
278
  <TextInput
289
279
  label="Amount (AUD)"
@@ -294,12 +284,12 @@ describe("TextInput", () => {
294
284
  );
295
285
 
296
286
  expect(toJSON()).toMatchSnapshot();
297
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
298
- expect(queryAllByText("This field is required")).toHaveLength(1);
287
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
288
+ expect(queryAllByText('This field is required')).toHaveLength(1);
299
289
  });
300
290
  });
301
- describe("helper text", () => {
302
- it("renders correctly", () => {
291
+ describe('helper text', () => {
292
+ it('renders correctly', () => {
303
293
  const { toJSON, queryAllByText } = renderWithTheme(
304
294
  <TextInput
305
295
  label="Amount (AUD)"
@@ -310,14 +300,14 @@ describe("TextInput", () => {
310
300
  );
311
301
 
312
302
  expect(toJSON()).toMatchSnapshot();
313
- expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
314
- expect(queryAllByText("This is helper text")).toHaveLength(1);
303
+ expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
304
+ expect(queryAllByText('This is helper text')).toHaveLength(1);
315
305
  });
316
306
  });
317
307
 
318
- describe("placeholder", () => {
319
- describe("TextInput is idle", () => {
320
- it("renders correctly", () => {
308
+ describe('placeholder', () => {
309
+ describe('TextInput is idle', () => {
310
+ it('renders correctly', () => {
321
311
  const wrapper = renderWithTheme(
322
312
  <TextInput
323
313
  label="Amount (AUD)"
@@ -329,20 +319,20 @@ describe("TextInput", () => {
329
319
  );
330
320
 
331
321
  expect(wrapper.toJSON()).toMatchSnapshot();
332
- expect(wrapper.queryByPlaceholderText("Enter Amount")).toBeFalsy();
322
+ expect(wrapper.queryByPlaceholderText('Enter Amount')).toBeFalsy();
333
323
 
334
- fireEvent(wrapper.getByTestId("text-input"), "focus");
335
- expect(wrapper.queryByPlaceholderText("Enter Amount")).toBeTruthy();
324
+ fireEvent(wrapper.getByTestId('text-input'), 'focus');
325
+ expect(wrapper.queryByPlaceholderText('Enter Amount')).toBeTruthy();
336
326
 
337
- fireEvent(wrapper.getByTestId("text-input"), "blur");
338
- expect(wrapper.queryByPlaceholderText("Enter Amount")).toBeFalsy();
327
+ fireEvent(wrapper.getByTestId('text-input'), 'blur');
328
+ expect(wrapper.queryByPlaceholderText('Enter Amount')).toBeFalsy();
339
329
  });
340
330
  });
341
331
  });
342
332
 
343
- describe("defaultValue", () => {
344
- describe("TextInput is idle", () => {
345
- it("renders correctly", () => {
333
+ describe('defaultValue', () => {
334
+ describe('TextInput is idle', () => {
335
+ it('renders correctly', () => {
346
336
  const wrapper = renderWithTheme(
347
337
  <TextInput
348
338
  label="Amount (AUD)"
@@ -356,13 +346,13 @@ describe("TextInput", () => {
356
346
  );
357
347
 
358
348
  expect(wrapper.toJSON()).toMatchSnapshot();
359
- expect(wrapper.queryByDisplayValue("1000")).toBeTruthy();
360
- expect(wrapper.queryByText("4/255")).toBeTruthy();
349
+ expect(wrapper.queryByDisplayValue('1000')).toBeTruthy();
350
+ expect(wrapper.queryByText('4/255')).toBeTruthy();
361
351
  });
362
352
  });
363
353
 
364
- describe("default Value and Value", () => {
365
- it("renders correctly with 2000", () => {
354
+ describe('default Value and Value', () => {
355
+ it('renders correctly with 2000', () => {
366
356
  const wrapper = renderWithTheme(
367
357
  <TextInput
368
358
  label="Amount (AUD)"
@@ -377,9 +367,9 @@ describe("TextInput", () => {
377
367
  );
378
368
 
379
369
  expect(wrapper.toJSON()).toMatchSnapshot();
380
- expect(wrapper.queryByDisplayValue("2000")).toBeTruthy();
381
- expect(wrapper.queryByDisplayValue("1000")).toBeFalsy();
382
- expect(wrapper.queryByText("4/255")).toBeTruthy();
370
+ expect(wrapper.queryByDisplayValue('2000')).toBeTruthy();
371
+ expect(wrapper.queryByDisplayValue('1000')).toBeFalsy();
372
+ expect(wrapper.queryByText('4/255')).toBeTruthy();
383
373
  });
384
374
  });
385
375
  });
@@ -104,7 +104,6 @@ export const getVariant = ({
104
104
  error,
105
105
  editable,
106
106
  loading,
107
- isFocused,
108
107
  isEmptyValue,
109
108
  }: {
110
109
  disabled?: boolean;
@@ -123,9 +122,6 @@ export const getVariant = ({
123
122
  if (!editable || loading) {
124
123
  return 'readonly';
125
124
  }
126
- if (isFocused) {
127
- return 'focused';
128
- }
129
125
  if (!isEmptyValue) {
130
126
  return 'filled';
131
127
  }
@@ -213,7 +209,8 @@ const TextInput = ({
213
209
  nativeProps.onChangeText?.(text);
214
210
  },
215
211
  defaultValue,
216
- placeholder: variant === 'focused' ? nativeProps.placeholder : undefined,
212
+ placeholder:
213
+ isFocused || label === undefined ? nativeProps.placeholder : undefined,
217
214
  };
218
215
 
219
216
  return (
@@ -225,7 +222,11 @@ const TextInput = ({
225
222
  testID={testID}
226
223
  >
227
224
  <StyledTextInputContainer>
228
- <StyledBorderBackDrop themeVariant={variant} style={borderStyle} />
225
+ <StyledBorderBackDrop
226
+ themeFocused={isFocused}
227
+ themeVariant={variant}
228
+ style={borderStyle}
229
+ />
229
230
  {(isFocused || (label && !isEmptyValue)) && (
230
231
  <StyledLabelContainer pointerEvents="none">
231
232
  {required && (
@@ -61,6 +61,7 @@ exports[`TimePickerAndroid renders correctly 1`] = `
61
61
  undefined,
62
62
  ]
63
63
  }
64
+ themeFocused={false}
64
65
  themeVariant="filled"
65
66
  />
66
67
  <View
@@ -61,6 +61,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
61
61
  undefined,
62
62
  ]
63
63
  }
64
+ themeFocused={false}
64
65
  themeVariant="filled"
65
66
  />
66
67
  <View
package/src/index.ts CHANGED
@@ -5,6 +5,7 @@ import theme, {
5
5
  swagSystemPalette,
6
6
  workSystemPalette,
7
7
  jobsSystemPalette,
8
+ ThemeSwitcher,
8
9
  } from './theme';
9
10
  import { scale } from './utils/scale';
10
11
 
@@ -33,6 +34,7 @@ import PinInput from './components/PinInput';
33
34
  import Progress from './components/Progress';
34
35
  import Slider from './components/Slider';
35
36
  import Spinner from './components/Spinner';
37
+ import Swipeable from './components/Swipeable';
36
38
  import Radio from './components/Radio';
37
39
  import SectionHeading from './components/SectionHeading';
38
40
  import Select from './components/Select';
@@ -53,6 +55,7 @@ export {
53
55
  useTheme,
54
56
  scale,
55
57
  ThemeProvider,
58
+ ThemeSwitcher,
56
59
  swagSystemPalette,
57
60
  workSystemPalette,
58
61
  jobsSystemPalette,
@@ -81,6 +84,7 @@ export {
81
84
  Progress,
82
85
  Slider,
83
86
  Spinner,
87
+ Swipeable,
84
88
  Radio,
85
89
  SectionHeading,
86
90
  Select,
@@ -597,7 +597,10 @@ Object {
597
597
  },
598
598
  "spinner": Object {
599
599
  "colors": Object {
600
- "dot": "#001f23",
600
+ "dot": Object {
601
+ "inverted": "#ffffff",
602
+ "primary": "#001f23",
603
+ },
601
604
  },
602
605
  "radii": Object {
603
606
  "default": 999,
@@ -617,6 +620,13 @@ Object {
617
620
  },
618
621
  },
619
622
  },
623
+ "swipeable": Object {
624
+ "colors": Object {
625
+ "danger": "#f46363",
626
+ "primary": "#001f23",
627
+ "success": "#5ace7d",
628
+ },
629
+ },
620
630
  "switch": Object {
621
631
  "colors": Object {
622
632
  "backgroundColors": Object {
@@ -736,7 +746,6 @@ Object {
736
746
  "disabled": "#bfc1c5",
737
747
  "error": "#f46363",
738
748
  "filled": "#f46363",
739
- "focused": "#f46363",
740
749
  "readonly": "#808f91",
741
750
  },
742
751
  "borders": Object {
@@ -744,7 +753,6 @@ Object {
744
753
  "disabled": "#bfc1c5",
745
754
  "error": "#f46363",
746
755
  "filled": "#001f23",
747
- "focused": "#001f23",
748
756
  "readonly": "#808f91",
749
757
  },
750
758
  "disabledLabel": "#bfc1c5",
@@ -756,7 +764,6 @@ Object {
756
764
  "disabled": "#bfc1c5",
757
765
  "error": "#001f23",
758
766
  "filled": "#001f23",
759
- "focused": "#001f23",
760
767
  "readonly": "#bfc1c5",
761
768
  },
762
769
  "labelsInsideTextInput": Object {
@@ -764,7 +771,6 @@ Object {
764
771
  "disabled": "#bfc1c5",
765
772
  "error": "#001f23",
766
773
  "filled": "#001f23",
767
- "focused": "#001f23",
768
774
  "readonly": "#bfc1c5",
769
775
  },
770
776
  "maxLengthLabels": Object {
@@ -772,7 +778,6 @@ Object {
772
778
  "disabled": "#bfc1c5",
773
779
  "error": "#f46363",
774
780
  "filled": "#001f23",
775
- "focused": "#001f23",
776
781
  "readonly": "#bfc1c5",
777
782
  },
778
783
  "placeholderIfFocued": "#808f91",
@@ -2,7 +2,10 @@ import type { GlobalTheme } from '../global';
2
2
 
3
3
  const getSpinnerTheme = (theme: GlobalTheme) => {
4
4
  const colors = {
5
- dot: theme.colors.primary,
5
+ dot: {
6
+ primary: theme.colors.primary,
7
+ inverted: theme.colors.onPrimary,
8
+ },
6
9
  };
7
10
 
8
11
  const space = {
@@ -0,0 +1,13 @@
1
+ import type { GlobalTheme } from '../global';
2
+
3
+ const getSwipeableTheme = (theme: GlobalTheme) => {
4
+ const colors = {
5
+ success: theme.colors.success,
6
+ danger: theme.colors.error,
7
+ primary: theme.colors.primary,
8
+ };
9
+
10
+ return { colors };
11
+ };
12
+
13
+ export default getSwipeableTheme;
@@ -9,7 +9,6 @@ const getTextInputTheme = (theme: GlobalTheme) => {
9
9
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
10
10
  readonly: theme.colors.mutedSecondary,
11
11
  filled: theme.colors.error,
12
- focused: theme.colors.error,
13
12
  },
14
13
  error: theme.colors.error,
15
14
  placeholderIfNotFocused: theme.colors.globalPrimary,
@@ -24,7 +23,6 @@ const getTextInputTheme = (theme: GlobalTheme) => {
24
23
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
25
24
  readonly: theme.colors.mutedSecondary,
26
25
  filled: theme.colors.globalPrimary,
27
- focused: theme.colors.globalPrimary,
28
26
  },
29
27
  labels: {
30
28
  default: theme.colors.globalPrimary,
@@ -32,7 +30,6 @@ const getTextInputTheme = (theme: GlobalTheme) => {
32
30
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
33
31
  readonly: theme.colors.disabledOnDefaultGlobalSurface,
34
32
  filled: theme.colors.globalPrimary,
35
- focused: theme.colors.globalPrimary,
36
33
  },
37
34
  labelsInsideTextInput: {
38
35
  default: theme.colors.globalPrimary,
@@ -40,7 +37,6 @@ const getTextInputTheme = (theme: GlobalTheme) => {
40
37
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
41
38
  readonly: theme.colors.disabledOnDefaultGlobalSurface,
42
39
  filled: theme.colors.globalPrimary,
43
- focused: theme.colors.globalPrimary,
44
40
  },
45
41
  maxLengthLabels: {
46
42
  default: theme.colors.globalPrimary,
@@ -48,7 +44,6 @@ const getTextInputTheme = (theme: GlobalTheme) => {
48
44
  disabled: theme.colors.disabledOnDefaultGlobalSurface,
49
45
  readonly: theme.colors.disabledOnDefaultGlobalSurface,
50
46
  filled: theme.colors.globalPrimary,
51
- focused: theme.colors.globalPrimary,
52
47
  },
53
48
  };
54
49