ferns-ui 1.16.1 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion.js +2 -7
- package/dist/Accordion.js.map +1 -1
- package/dist/ActionSheet.js +11 -14
- package/dist/ActionSheet.js.map +1 -1
- package/dist/AddressField.js +1 -1
- package/dist/AddressField.js.map +1 -1
- package/dist/Badge.js +1 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Banner.js +1 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.js +3 -3
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +1 -0
- package/dist/Button.js.map +1 -1
- package/dist/CheckBox.js.map +1 -1
- package/dist/Common.d.ts +9 -13
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.js +2 -1
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js +22 -22
- package/dist/DateTimeField.js.map +1 -1
- package/dist/EmailField.js +37 -17
- package/dist/EmailField.js.map +1 -1
- package/dist/ErrorBoundary.d.ts +1 -1
- package/dist/FernsProvider.js +1 -1
- package/dist/FernsProvider.js.map +1 -1
- package/dist/Heading.js +1 -3
- package/dist/Heading.js.map +1 -1
- package/dist/Hyperlink.js +1 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/IconButton.js.map +1 -1
- package/dist/Image.js.map +1 -1
- package/dist/MobileAddressAutoComplete.js +1 -1
- package/dist/MobileAddressAutoComplete.js.map +1 -1
- package/dist/Modal.d.ts +1 -1
- package/dist/Modal.js +15 -35
- package/dist/Modal.js.map +1 -1
- package/dist/ModalSheet.d.ts +1 -1
- package/dist/ModalSheet.js +1 -1
- package/dist/ModalSheet.js.map +1 -1
- package/dist/NumberField.js +4 -10
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberPickerActionSheet.d.ts +3 -1
- package/dist/NumberPickerActionSheet.js +3 -0
- package/dist/NumberPickerActionSheet.js.map +1 -1
- package/dist/Page.js +1 -1
- package/dist/Page.js.map +1 -1
- package/dist/Pagination.js +2 -2
- package/dist/Pagination.js.map +1 -1
- package/dist/Permissions.d.ts +1 -1
- package/dist/Permissions.js +2 -2
- package/dist/Permissions.js.map +1 -1
- package/dist/PickerSelect.js +1 -1
- package/dist/PickerSelect.js.map +1 -1
- package/dist/SectionDivider.js +1 -1
- package/dist/SectionDivider.js.map +1 -1
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/Signature.native.js +2 -2
- package/dist/Signature.native.js.map +1 -1
- package/dist/SignatureField.js +2 -2
- package/dist/SignatureField.js.map +1 -1
- package/dist/Slider.js +3 -3
- package/dist/Slider.js.map +1 -1
- package/dist/SplitPage.js +7 -7
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +6 -4
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TapToEdit.js +3 -3
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Text.js +1 -1
- package/dist/Text.js.map +1 -1
- package/dist/TextFieldNumberActionSheet.d.ts +4 -2
- package/dist/TextFieldNumberActionSheet.js +4 -1
- package/dist/TextFieldNumberActionSheet.js.map +1 -1
- package/dist/Tooltip.js +21 -39
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +1 -0
- package/dist/Unifier.js.map +1 -1
- package/dist/Utilities.d.ts +1 -1
- package/dist/Utilities.js +3 -2
- package/dist/Utilities.js.map +1 -1
- package/dist/WebAddressAutocomplete.js +1 -2
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/jestSetup.d.ts +0 -0
- package/dist/jestSetup.js +21 -0
- package/dist/jestSetup.js.map +1 -0
- package/dist/setupTests.js +22 -0
- package/dist/setupTests.js.map +1 -1
- package/dist/table/Table.js +15 -14
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableHeaderCell.js +2 -2
- package/dist/table/TableHeaderCell.js.map +1 -1
- package/dist/test-utils.d.ts +4 -1
- package/dist/useStoredState.js +2 -4
- package/dist/useStoredState.js.map +1 -1
- package/package.json +106 -43
- package/src/Accordion.tsx +1 -7
- package/src/ActionSheet.tsx +22 -26
- package/src/AddressField.tsx +1 -1
- package/src/Avatar.test.tsx +0 -2
- package/src/Badge.tsx +1 -1
- package/src/Banner.tsx +1 -1
- package/src/Box.test.tsx +70 -71
- package/src/Box.tsx +9 -21
- package/src/Button.tsx +1 -0
- package/src/CheckBox.tsx +1 -7
- package/src/Common.ts +21 -14
- package/src/DataTable.tsx +4 -3
- package/src/DateTimeField.tsx +22 -22
- package/src/EmailField.tsx +42 -22
- package/src/FernsProvider.tsx +4 -1
- package/src/Heading.tsx +1 -3
- package/src/Hyperlink.tsx +2 -2
- package/src/IconButton.tsx +2 -2
- package/src/Image.tsx +0 -1
- package/src/MobileAddressAutoComplete.tsx +1 -1
- package/src/Modal.tsx +21 -58
- package/src/ModalSheet.tsx +1 -1
- package/src/NumberField.tsx +4 -10
- package/src/NumberPickerActionSheet.tsx +5 -1
- package/src/Page.tsx +1 -1
- package/src/Pagination.tsx +11 -2
- package/src/Permissions.ts +2 -2
- package/src/PickerSelect.tsx +1 -1
- package/src/SectionDivider.tsx +1 -1
- package/src/SegmentedControl.tsx +1 -3
- package/src/Signature.native.tsx +2 -2
- package/src/SignatureField.tsx +2 -2
- package/src/Slider.tsx +17 -10
- package/src/SplitPage.native.tsx +4 -2
- package/src/SplitPage.tsx +4 -4
- package/src/TapToEdit.tsx +7 -3
- package/src/Text.tsx +1 -1
- package/src/TextArea.test.tsx +43 -27
- package/src/TextField.test.tsx +4 -3
- package/src/TextFieldNumberActionSheet.tsx +7 -3
- package/src/Tooltip.tsx +29 -45
- package/src/Unifier.ts +3 -1
- package/src/Utilities.tsx +4 -3
- package/src/WebAddressAutocomplete.tsx +1 -1
- package/src/index.tsx +10 -11
- package/src/jestSetup.ts +16 -0
- package/src/setupTests.ts +24 -0
- package/src/table/Table.tsx +38 -36
- package/src/table/TableHeaderCell.tsx +2 -2
- package/src/useStoredState.ts +11 -13
- package/dist/Accordion.test.d.ts +0 -1
- package/dist/Accordion.test.js +0 -71
- package/dist/Accordion.test.js.map +0 -1
- package/dist/AddressField.test.d.ts +0 -1
- package/dist/AddressField.test.js +0 -65
- package/dist/AddressField.test.js.map +0 -1
- package/dist/Avatar.test.d.ts +0 -1
- package/dist/Avatar.test.js +0 -131
- package/dist/Avatar.test.js.map +0 -1
- package/dist/Badge.test.d.ts +0 -1
- package/dist/Badge.test.js +0 -76
- package/dist/Badge.test.js.map +0 -1
- package/dist/Box.test.d.ts +0 -1
- package/dist/Box.test.js +0 -528
- package/dist/Box.test.js.map +0 -1
- package/dist/DateTimeField.test.d.ts +0 -1
- package/dist/DateTimeField.test.js +0 -258
- package/dist/DateTimeField.test.js.map +0 -1
- package/dist/DateUtilities.test.d.ts +0 -1
- package/dist/DateUtilities.test.js +0 -279
- package/dist/DateUtilities.test.js.map +0 -1
- package/dist/MarkdownView.d.ts +0 -5
- package/dist/MarkdownView.js +0 -44
- package/dist/MarkdownView.js.map +0 -1
- package/dist/TextArea.test.d.ts +0 -1
- package/dist/TextArea.test.js +0 -146
- package/dist/TextArea.test.js.map +0 -1
- package/dist/TextField.test.d.ts +0 -1
- package/dist/TextField.test.js +0 -251
- package/dist/TextField.test.js.map +0 -1
- package/dist/useStoredState.test.d.ts +0 -1
- package/dist/useStoredState.test.js +0 -93
- package/dist/useStoredState.test.js.map +0 -1
- package/src/MarkdownView.tsx +0 -67
package/src/Badge.tsx
CHANGED
|
@@ -77,7 +77,7 @@ export const Badge = ({
|
|
|
77
77
|
let badgeValue = value;
|
|
78
78
|
|
|
79
79
|
if (variant === "numberOnly") {
|
|
80
|
-
if (!
|
|
80
|
+
if (!isNaN(Number(value)) && maxValue) {
|
|
81
81
|
const numberValue = Number(value);
|
|
82
82
|
if (numberValue > maxValue) {
|
|
83
83
|
badgeValue = `${maxValue}+`;
|
package/src/Banner.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import debounce from "lodash/debounce";
|
|
2
2
|
import React, {useEffect, useState} from "react";
|
|
3
|
-
import {ActivityIndicator, Text as NativeText,
|
|
3
|
+
import {ActivityIndicator, Pressable, Text as NativeText, View} from "react-native";
|
|
4
4
|
|
|
5
5
|
import {Box} from "./Box";
|
|
6
6
|
import {BannerProps, IconName, SurfaceTheme} from "./Common";
|
package/src/Box.test.tsx
CHANGED
|
@@ -38,7 +38,7 @@ describe("Box", () => {
|
|
|
38
38
|
const view = root.findByType("View");
|
|
39
39
|
expect(view.props.style).toMatchObject({
|
|
40
40
|
flexDirection: "column",
|
|
41
|
-
display: "flex"
|
|
41
|
+
display: "flex"
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
|
|
@@ -53,7 +53,7 @@ describe("Box", () => {
|
|
|
53
53
|
expect(view.props.style).toMatchObject({
|
|
54
54
|
flexGrow: 1,
|
|
55
55
|
flexShrink: 1,
|
|
56
|
-
display: "flex"
|
|
56
|
+
display: "flex"
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -62,7 +62,7 @@ describe("Box", () => {
|
|
|
62
62
|
const view = root.findByType("View");
|
|
63
63
|
expect(view.props.style).toMatchObject({
|
|
64
64
|
flexShrink: 1,
|
|
65
|
-
display: "flex"
|
|
65
|
+
display: "flex"
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -71,7 +71,7 @@ describe("Box", () => {
|
|
|
71
71
|
const view = root.findByType("View");
|
|
72
72
|
expect(view.props.style).toMatchObject({
|
|
73
73
|
flex: 0,
|
|
74
|
-
display: "flex"
|
|
74
|
+
display: "flex"
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
|
|
@@ -79,7 +79,7 @@ describe("Box", () => {
|
|
|
79
79
|
const {root} = renderWithTheme(<Box justifyContent="center" />);
|
|
80
80
|
const view = root.findByType("View");
|
|
81
81
|
expect(view.props.style).toMatchObject({
|
|
82
|
-
justifyContent: "center"
|
|
82
|
+
justifyContent: "center"
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -87,7 +87,7 @@ describe("Box", () => {
|
|
|
87
87
|
const {root} = renderWithTheme(<Box alignItems="center" />);
|
|
88
88
|
const view = root.findByType("View");
|
|
89
89
|
expect(view.props.style).toMatchObject({
|
|
90
|
-
alignItems: "center"
|
|
90
|
+
alignItems: "center"
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
|
|
@@ -95,7 +95,7 @@ describe("Box", () => {
|
|
|
95
95
|
const {root} = renderWithTheme(<Box alignContent="center" />);
|
|
96
96
|
const view = root.findByType("View");
|
|
97
97
|
expect(view.props.style).toMatchObject({
|
|
98
|
-
alignContent: "center"
|
|
98
|
+
alignContent: "center"
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
|
|
@@ -103,7 +103,7 @@ describe("Box", () => {
|
|
|
103
103
|
const {root} = renderWithTheme(<Box alignSelf="center" />);
|
|
104
104
|
const view = root.findByType("View");
|
|
105
105
|
expect(view.props.style).toMatchObject({
|
|
106
|
-
alignSelf: "center"
|
|
106
|
+
alignSelf: "center"
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -112,7 +112,7 @@ describe("Box", () => {
|
|
|
112
112
|
const view = root.findByType("View");
|
|
113
113
|
expect(view.props.style).toMatchObject({
|
|
114
114
|
flexWrap: "wrap",
|
|
115
|
-
alignItems: "flex-start"
|
|
115
|
+
alignItems: "flex-start"
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
118
|
|
|
@@ -120,7 +120,7 @@ describe("Box", () => {
|
|
|
120
120
|
const {root} = renderWithTheme(<Box gap={4} />);
|
|
121
121
|
const view = root.findByType("View");
|
|
122
122
|
expect(view.props.style).toMatchObject({
|
|
123
|
-
gap: 16
|
|
123
|
+
gap: 16
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
});
|
|
@@ -130,7 +130,7 @@ describe("Box", () => {
|
|
|
130
130
|
const {root} = renderWithTheme(<Box padding={4} />);
|
|
131
131
|
const view = root.findByType("View");
|
|
132
132
|
expect(view.props.style).toMatchObject({
|
|
133
|
-
padding: 16
|
|
133
|
+
padding: 16
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
136
|
|
|
@@ -139,7 +139,7 @@ describe("Box", () => {
|
|
|
139
139
|
const view = root.findByType("View");
|
|
140
140
|
expect(view.props.style).toMatchObject({
|
|
141
141
|
paddingLeft: 8,
|
|
142
|
-
paddingRight: 8
|
|
142
|
+
paddingRight: 8
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
|
|
@@ -148,7 +148,7 @@ describe("Box", () => {
|
|
|
148
148
|
const view = root.findByType("View");
|
|
149
149
|
expect(view.props.style).toMatchObject({
|
|
150
150
|
paddingTop: 12,
|
|
151
|
-
paddingBottom: 12
|
|
151
|
+
paddingBottom: 12
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
154
|
|
|
@@ -156,7 +156,7 @@ describe("Box", () => {
|
|
|
156
156
|
const {root} = renderWithTheme(<Box margin={4} />);
|
|
157
157
|
const view = root.findByType("View");
|
|
158
158
|
expect(view.props.style).toMatchObject({
|
|
159
|
-
margin: 16
|
|
159
|
+
margin: 16
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
162
|
|
|
@@ -164,7 +164,7 @@ describe("Box", () => {
|
|
|
164
164
|
const {root} = renderWithTheme(<Box marginTop={2} />);
|
|
165
165
|
const view = root.findByType("View");
|
|
166
166
|
expect(view.props.style).toMatchObject({
|
|
167
|
-
marginTop: 8
|
|
167
|
+
marginTop: 8
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
170
|
|
|
@@ -172,7 +172,7 @@ describe("Box", () => {
|
|
|
172
172
|
const {root} = renderWithTheme(<Box marginBottom={2} />);
|
|
173
173
|
const view = root.findByType("View");
|
|
174
174
|
expect(view.props.style).toMatchObject({
|
|
175
|
-
marginBottom: 8
|
|
175
|
+
marginBottom: 8
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
178
|
|
|
@@ -180,7 +180,7 @@ describe("Box", () => {
|
|
|
180
180
|
const {root} = renderWithTheme(<Box marginLeft={2} />);
|
|
181
181
|
const view = root.findByType("View");
|
|
182
182
|
expect(view.props.style).toMatchObject({
|
|
183
|
-
marginLeft: 8
|
|
183
|
+
marginLeft: 8
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
186
|
|
|
@@ -188,7 +188,7 @@ describe("Box", () => {
|
|
|
188
188
|
const {root} = renderWithTheme(<Box marginRight={2} />);
|
|
189
189
|
const view = root.findByType("View");
|
|
190
190
|
expect(view.props.style).toMatchObject({
|
|
191
|
-
marginRight: 8
|
|
191
|
+
marginRight: 8
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
});
|
|
@@ -198,7 +198,7 @@ describe("Box", () => {
|
|
|
198
198
|
const {root} = renderWithTheme(<Box width={100} />);
|
|
199
199
|
const view = root.findByType("View");
|
|
200
200
|
expect(view.props.style).toMatchObject({
|
|
201
|
-
width: 100
|
|
201
|
+
width: 100
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
|
|
@@ -206,7 +206,7 @@ describe("Box", () => {
|
|
|
206
206
|
const {root} = renderWithTheme(<Box height={100} />);
|
|
207
207
|
const view = root.findByType("View");
|
|
208
208
|
expect(view.props.style).toMatchObject({
|
|
209
|
-
height: 100
|
|
209
|
+
height: 100
|
|
210
210
|
});
|
|
211
211
|
});
|
|
212
212
|
|
|
@@ -214,7 +214,7 @@ describe("Box", () => {
|
|
|
214
214
|
const {root} = renderWithTheme(<Box width="50%" />);
|
|
215
215
|
const view = root.findByType("View");
|
|
216
216
|
expect(view.props.style).toMatchObject({
|
|
217
|
-
width: "50%"
|
|
217
|
+
width: "50%"
|
|
218
218
|
});
|
|
219
219
|
});
|
|
220
220
|
|
|
@@ -222,7 +222,7 @@ describe("Box", () => {
|
|
|
222
222
|
const {root} = renderWithTheme(<Box height="50%" />);
|
|
223
223
|
const view = root.findByType("View");
|
|
224
224
|
expect(view.props.style).toMatchObject({
|
|
225
|
-
height: "50%"
|
|
225
|
+
height: "50%"
|
|
226
226
|
});
|
|
227
227
|
});
|
|
228
228
|
});
|
|
@@ -232,7 +232,7 @@ describe("Box", () => {
|
|
|
232
232
|
const {root} = renderWithTheme(<Box position="absolute" />);
|
|
233
233
|
const view = root.findByType("View");
|
|
234
234
|
expect(view.props.style).toMatchObject({
|
|
235
|
-
position: "absolute"
|
|
235
|
+
position: "absolute"
|
|
236
236
|
});
|
|
237
237
|
});
|
|
238
238
|
|
|
@@ -240,7 +240,7 @@ describe("Box", () => {
|
|
|
240
240
|
const {root} = renderWithTheme(<Box top />);
|
|
241
241
|
const view = root.findByType("View");
|
|
242
242
|
expect(view.props.style).toMatchObject({
|
|
243
|
-
top: 0
|
|
243
|
+
top: 0
|
|
244
244
|
});
|
|
245
245
|
});
|
|
246
246
|
|
|
@@ -248,7 +248,7 @@ describe("Box", () => {
|
|
|
248
248
|
const {root} = renderWithTheme(<Box bottom />);
|
|
249
249
|
const view = root.findByType("View");
|
|
250
250
|
expect(view.props.style).toMatchObject({
|
|
251
|
-
bottom: 0
|
|
251
|
+
bottom: 0
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
|
|
@@ -256,7 +256,7 @@ describe("Box", () => {
|
|
|
256
256
|
const {root} = renderWithTheme(<Box left />);
|
|
257
257
|
const view = root.findByType("View");
|
|
258
258
|
expect(view.props.style).toMatchObject({
|
|
259
|
-
left: 0
|
|
259
|
+
left: 0
|
|
260
260
|
});
|
|
261
261
|
});
|
|
262
262
|
|
|
@@ -264,7 +264,7 @@ describe("Box", () => {
|
|
|
264
264
|
const {root} = renderWithTheme(<Box right />);
|
|
265
265
|
const view = root.findByType("View");
|
|
266
266
|
expect(view.props.style).toMatchObject({
|
|
267
|
-
right: 0
|
|
267
|
+
right: 0
|
|
268
268
|
});
|
|
269
269
|
});
|
|
270
270
|
|
|
@@ -272,7 +272,7 @@ describe("Box", () => {
|
|
|
272
272
|
const {root} = renderWithTheme(<Box zIndex={10} />);
|
|
273
273
|
const view = root.findByType("View");
|
|
274
274
|
expect(view.props.style).toMatchObject({
|
|
275
|
-
zIndex: 10
|
|
275
|
+
zIndex: 10
|
|
276
276
|
});
|
|
277
277
|
});
|
|
278
278
|
});
|
|
@@ -356,9 +356,7 @@ describe("Box", () => {
|
|
|
356
356
|
it("should warn when using circle without dimensions", () => {
|
|
357
357
|
const consoleSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
358
358
|
renderWithTheme(<Box rounding="circle" />);
|
|
359
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
360
|
-
"Cannot use Box rounding='circle' without height or width."
|
|
361
|
-
);
|
|
359
|
+
expect(consoleSpy).toHaveBeenCalledWith("Cannot use Box rounding='circle' without height or width.");
|
|
362
360
|
consoleSpy.mockRestore();
|
|
363
361
|
});
|
|
364
362
|
});
|
|
@@ -368,7 +366,7 @@ describe("Box", () => {
|
|
|
368
366
|
const {root} = renderWithTheme(<Box display="none" />);
|
|
369
367
|
const view = root.findByType("View");
|
|
370
368
|
expect(view.props.style).toMatchObject({
|
|
371
|
-
display: "none"
|
|
369
|
+
display: "none"
|
|
372
370
|
});
|
|
373
371
|
});
|
|
374
372
|
|
|
@@ -376,7 +374,7 @@ describe("Box", () => {
|
|
|
376
374
|
const {root} = renderWithTheme(<Box display="flex" />);
|
|
377
375
|
const view = root.findByType("View");
|
|
378
376
|
expect(view.props.style).toMatchObject({
|
|
379
|
-
flex: undefined
|
|
377
|
+
flex: undefined
|
|
380
378
|
});
|
|
381
379
|
});
|
|
382
380
|
|
|
@@ -385,7 +383,7 @@ describe("Box", () => {
|
|
|
385
383
|
const view = root.findByType("View");
|
|
386
384
|
expect(view.props.style).toMatchObject({
|
|
387
385
|
flex: 0,
|
|
388
|
-
flexDirection: "row"
|
|
386
|
+
flexDirection: "row"
|
|
389
387
|
});
|
|
390
388
|
});
|
|
391
389
|
});
|
|
@@ -395,7 +393,7 @@ describe("Box", () => {
|
|
|
395
393
|
const {root} = renderWithTheme(<Box overflow="scroll" />);
|
|
396
394
|
const view = root.findByType("View");
|
|
397
395
|
expect(view.props.style).toMatchObject({
|
|
398
|
-
overflow: "scroll"
|
|
396
|
+
overflow: "scroll"
|
|
399
397
|
});
|
|
400
398
|
});
|
|
401
399
|
|
|
@@ -403,7 +401,7 @@ describe("Box", () => {
|
|
|
403
401
|
const {root} = renderWithTheme(<Box overflow="scrollY" />);
|
|
404
402
|
const view = root.findByType("View");
|
|
405
403
|
expect(view.props.style).toMatchObject({
|
|
406
|
-
overflow: "scroll"
|
|
404
|
+
overflow: "scroll"
|
|
407
405
|
});
|
|
408
406
|
});
|
|
409
407
|
|
|
@@ -411,7 +409,7 @@ describe("Box", () => {
|
|
|
411
409
|
const {root} = renderWithTheme(<Box overflow="hidden" />);
|
|
412
410
|
const view = root.findByType("View");
|
|
413
411
|
expect(view.props.style).toMatchObject({
|
|
414
|
-
overflow: "hidden"
|
|
412
|
+
overflow: "hidden"
|
|
415
413
|
});
|
|
416
414
|
});
|
|
417
415
|
});
|
|
@@ -428,15 +426,11 @@ describe("Box", () => {
|
|
|
428
426
|
it("should render as Pressable when onClick is provided", () => {
|
|
429
427
|
const mockOnClick = jest.fn();
|
|
430
428
|
const {root} = renderWithTheme(
|
|
431
|
-
<Box
|
|
432
|
-
onClick={mockOnClick}
|
|
433
|
-
accessibilityLabel="Click me"
|
|
434
|
-
accessibilityHint="Tap to trigger action"
|
|
435
|
-
>
|
|
429
|
+
<Box onClick={mockOnClick} accessibilityLabel="Click me" accessibilityHint="Tap to trigger action">
|
|
436
430
|
<Text>Clickable content</Text>
|
|
437
431
|
</Box>
|
|
438
432
|
);
|
|
439
|
-
|
|
433
|
+
|
|
440
434
|
expect(root).toBeTruthy();
|
|
441
435
|
// Just verify the component renders without error when onClick is provided
|
|
442
436
|
});
|
|
@@ -444,33 +438,33 @@ describe("Box", () => {
|
|
|
444
438
|
it("should call onClick when pressed", async () => {
|
|
445
439
|
const mockOnClick = jest.fn();
|
|
446
440
|
const {getByTestId} = renderWithTheme(
|
|
447
|
-
<Box
|
|
448
|
-
onClick={mockOnClick}
|
|
441
|
+
<Box
|
|
442
|
+
onClick={mockOnClick}
|
|
449
443
|
testID="clickable-box"
|
|
450
|
-
accessibilityLabel="Click me"
|
|
444
|
+
accessibilityLabel="Click me"
|
|
451
445
|
accessibilityHint="Tap to trigger action"
|
|
452
446
|
/>
|
|
453
447
|
);
|
|
454
|
-
|
|
448
|
+
|
|
455
449
|
const pressable = getByTestId("clickable-box-clickable");
|
|
456
450
|
await act(async () => {
|
|
457
451
|
fireEvent.press(pressable);
|
|
458
452
|
});
|
|
459
|
-
|
|
453
|
+
|
|
460
454
|
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
461
455
|
});
|
|
462
456
|
|
|
463
457
|
it("should apply accessibility props to Pressable", () => {
|
|
464
458
|
const mockOnClick = jest.fn();
|
|
465
459
|
const {getByTestId} = renderWithTheme(
|
|
466
|
-
<Box
|
|
460
|
+
<Box
|
|
467
461
|
onClick={mockOnClick}
|
|
468
462
|
testID="accessible-box"
|
|
469
463
|
accessibilityLabel="Click me"
|
|
470
464
|
accessibilityHint="Tap to trigger action"
|
|
471
465
|
/>
|
|
472
466
|
);
|
|
473
|
-
|
|
467
|
+
|
|
474
468
|
const pressable = getByTestId("accessible-box-clickable");
|
|
475
469
|
expect(pressable).toBeTruthy();
|
|
476
470
|
// Basic check that accessibility props are being applied
|
|
@@ -519,24 +513,26 @@ describe("Box", () => {
|
|
|
519
513
|
const {getByTestId} = renderWithTheme(
|
|
520
514
|
<Box onHoverStart={mockOnHoverStart} testID="hover-box" />
|
|
521
515
|
);
|
|
522
|
-
|
|
516
|
+
|
|
523
517
|
const view = getByTestId("hover-box");
|
|
524
518
|
await act(async () => {
|
|
525
519
|
fireEvent(view, "pointerEnter");
|
|
526
520
|
});
|
|
527
|
-
|
|
521
|
+
|
|
528
522
|
expect(mockOnHoverStart).toHaveBeenCalledTimes(1);
|
|
529
523
|
});
|
|
530
524
|
|
|
531
525
|
it("should call onHoverEnd", async () => {
|
|
532
526
|
const mockOnHoverEnd = jest.fn();
|
|
533
|
-
const {getByTestId} = renderWithTheme(
|
|
534
|
-
|
|
527
|
+
const {getByTestId} = renderWithTheme(
|
|
528
|
+
<Box onHoverEnd={mockOnHoverEnd} testID="hover-box" />
|
|
529
|
+
);
|
|
530
|
+
|
|
535
531
|
const view = getByTestId("hover-box");
|
|
536
532
|
await act(async () => {
|
|
537
533
|
fireEvent(view, "pointerLeave");
|
|
538
534
|
});
|
|
539
|
-
|
|
535
|
+
|
|
540
536
|
expect(mockOnHoverEnd).toHaveBeenCalledTimes(1);
|
|
541
537
|
});
|
|
542
538
|
});
|
|
@@ -545,7 +541,7 @@ describe("Box", () => {
|
|
|
545
541
|
it("should expose scrollToEnd method", () => {
|
|
546
542
|
const ref = React.createRef<any>();
|
|
547
543
|
renderWithTheme(<Box ref={ref} scroll />);
|
|
548
|
-
|
|
544
|
+
|
|
549
545
|
expect(ref.current).toBeTruthy();
|
|
550
546
|
expect(typeof ref.current.scrollToEnd).toBe("function");
|
|
551
547
|
});
|
|
@@ -553,7 +549,7 @@ describe("Box", () => {
|
|
|
553
549
|
it("should expose scrollTo method", () => {
|
|
554
550
|
const ref = React.createRef<any>();
|
|
555
551
|
renderWithTheme(<Box ref={ref} scroll />);
|
|
556
|
-
|
|
552
|
+
|
|
557
553
|
expect(ref.current).toBeTruthy();
|
|
558
554
|
expect(typeof ref.current.scrollTo).toBe("function");
|
|
559
555
|
});
|
|
@@ -562,11 +558,11 @@ describe("Box", () => {
|
|
|
562
558
|
describe("dangerous inline styles", () => {
|
|
563
559
|
it("should apply dangerouslySetInlineStyle", () => {
|
|
564
560
|
const {root} = renderWithTheme(
|
|
565
|
-
<Box dangerouslySetInlineStyle={{__style: {backgroundColor: "red"}}} />
|
|
561
|
+
<Box dangerouslySetInlineStyle={{ __style: { backgroundColor: "red" } }} />
|
|
566
562
|
);
|
|
567
563
|
const view = root.findByType("View");
|
|
568
564
|
expect(view.props.style).toMatchObject({
|
|
569
|
-
backgroundColor: "red"
|
|
565
|
+
backgroundColor: "red"
|
|
570
566
|
});
|
|
571
567
|
});
|
|
572
568
|
});
|
|
@@ -575,9 +571,7 @@ describe("Box", () => {
|
|
|
575
571
|
it("should warn when using wrap and alignItems together", () => {
|
|
576
572
|
const consoleSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
577
573
|
renderWithTheme(<Box wrap alignItems="center" />);
|
|
578
|
-
expect(consoleSpy).toHaveBeenCalledWith(
|
|
579
|
-
"React Native doesn't support wrap and alignItems together."
|
|
580
|
-
);
|
|
574
|
+
expect(consoleSpy).toHaveBeenCalledWith("React Native doesn't support wrap and alignItems together.");
|
|
581
575
|
consoleSpy.mockRestore();
|
|
582
576
|
});
|
|
583
577
|
});
|
|
@@ -610,7 +604,7 @@ describe("Box", () => {
|
|
|
610
604
|
expect(view.props.style).toMatchObject({
|
|
611
605
|
padding: 0,
|
|
612
606
|
margin: 0,
|
|
613
|
-
gap: 0
|
|
607
|
+
gap: 0
|
|
614
608
|
});
|
|
615
609
|
});
|
|
616
610
|
});
|
|
@@ -623,11 +617,11 @@ describe("Box", () => {
|
|
|
623
617
|
|
|
624
618
|
it("should match snapshot with layout props", () => {
|
|
625
619
|
const component = renderWithTheme(
|
|
626
|
-
<Box
|
|
627
|
-
direction="column"
|
|
628
|
-
flex="grow"
|
|
629
|
-
justifyContent="center"
|
|
630
|
-
alignItems="center"
|
|
620
|
+
<Box
|
|
621
|
+
direction="column"
|
|
622
|
+
flex="grow"
|
|
623
|
+
justifyContent="center"
|
|
624
|
+
alignItems="center"
|
|
631
625
|
padding={4}
|
|
632
626
|
margin={2}
|
|
633
627
|
/>
|
|
@@ -637,7 +631,7 @@ describe("Box", () => {
|
|
|
637
631
|
|
|
638
632
|
it("should match snapshot with clickable props", () => {
|
|
639
633
|
const component = renderWithTheme(
|
|
640
|
-
<Box
|
|
634
|
+
<Box
|
|
641
635
|
onClick={jest.fn()}
|
|
642
636
|
accessibilityLabel="Click me"
|
|
643
637
|
accessibilityHint="Tap to trigger action"
|
|
@@ -658,9 +652,14 @@ describe("Box", () => {
|
|
|
658
652
|
|
|
659
653
|
it("should match snapshot with border and rounding", () => {
|
|
660
654
|
const component = renderWithTheme(
|
|
661
|
-
<Box
|
|
655
|
+
<Box
|
|
656
|
+
border="default"
|
|
657
|
+
rounding="md"
|
|
658
|
+
color="primary"
|
|
659
|
+
shadow
|
|
660
|
+
/>
|
|
662
661
|
);
|
|
663
662
|
expect(component.toJSON()).toMatchSnapshot();
|
|
664
663
|
});
|
|
665
664
|
});
|
|
666
|
-
});
|
|
665
|
+
});
|
package/src/Box.tsx
CHANGED
|
@@ -58,7 +58,7 @@ const isValidPercentage = (value: string): boolean => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
const isValidWidthHeight = (value: number | string): boolean => {
|
|
61
|
-
return typeof value ===
|
|
61
|
+
return typeof value === 'number' || !isNaN(Number(value)) || isValidPercentage(value);
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
// eslint-disable-next-line react/display-name
|
|
@@ -153,12 +153,10 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
153
153
|
gap: (value) => ({gap: getSpacing(value)}),
|
|
154
154
|
height: (value) => {
|
|
155
155
|
if (!isValidWidthHeight(value)) {
|
|
156
|
-
console.warn(
|
|
157
|
-
`Box: height prop must be a number or percentage string (e.g., "50%"), received: ${value}`
|
|
158
|
-
);
|
|
156
|
+
console.warn(`Box: height prop must be a number or percentage string (e.g., "50%"), received: ${value}`);
|
|
159
157
|
return {};
|
|
160
158
|
}
|
|
161
|
-
if (props.border && !
|
|
159
|
+
if (props.border && !isNaN(Number(value))) {
|
|
162
160
|
return {height: Number(value) + 2 * 2};
|
|
163
161
|
} else {
|
|
164
162
|
return {height: value};
|
|
@@ -212,12 +210,10 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
212
210
|
top: (top) => ({top: top ? 0 : undefined}),
|
|
213
211
|
width: (value) => {
|
|
214
212
|
if (!isValidWidthHeight(value)) {
|
|
215
|
-
console.warn(
|
|
216
|
-
`Box: width prop must be a number or percentage string (e.g., "50%"), received: ${value}`
|
|
217
|
-
);
|
|
213
|
+
console.warn(`Box: width prop must be a number or percentage string (e.g., "50%"), received: ${value}`);
|
|
218
214
|
return {};
|
|
219
215
|
}
|
|
220
|
-
if (props.border && !
|
|
216
|
+
if (props.border && !isNaN(Number(value))) {
|
|
221
217
|
return {width: Number(value) + 2 * 2};
|
|
222
218
|
} else {
|
|
223
219
|
return {width: value};
|
|
@@ -225,36 +221,28 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
225
221
|
},
|
|
226
222
|
maxHeight: (value) => {
|
|
227
223
|
if (!isValidWidthHeight(value)) {
|
|
228
|
-
console.warn(
|
|
229
|
-
`Box: maxHeight prop must be a number or percentage string (e.g., "50%"), received: ${value}`
|
|
230
|
-
);
|
|
224
|
+
console.warn(`Box: maxHeight prop must be a number or percentage string (e.g., "50%"), received: ${value}`);
|
|
231
225
|
return {};
|
|
232
226
|
}
|
|
233
227
|
return {maxHeight: value};
|
|
234
228
|
},
|
|
235
229
|
maxWidth: (value) => {
|
|
236
230
|
if (!isValidWidthHeight(value)) {
|
|
237
|
-
console.warn(
|
|
238
|
-
`Box: maxWidth prop must be a number or percentage string (e.g., "50%"), received: ${value}`
|
|
239
|
-
);
|
|
231
|
+
console.warn(`Box: maxWidth prop must be a number or percentage string (e.g., "50%"), received: ${value}`);
|
|
240
232
|
return {};
|
|
241
233
|
}
|
|
242
234
|
return {maxWidth: value};
|
|
243
235
|
},
|
|
244
236
|
minHeight: (value) => {
|
|
245
237
|
if (!isValidWidthHeight(value)) {
|
|
246
|
-
console.warn(
|
|
247
|
-
`Box: minHeight prop must be a number or percentage string (e.g., "50%"), received: ${value}`
|
|
248
|
-
);
|
|
238
|
+
console.warn(`Box: minHeight prop must be a number or percentage string (e.g., "50%"), received: ${value}`);
|
|
249
239
|
return {};
|
|
250
240
|
}
|
|
251
241
|
return {minHeight: value};
|
|
252
242
|
},
|
|
253
243
|
minWidth: (value) => {
|
|
254
244
|
if (!isValidWidthHeight(value)) {
|
|
255
|
-
console.warn(
|
|
256
|
-
`Box: minWidth prop must be a number or percentage string (e.g., "50%"), received: ${value}`
|
|
257
|
-
);
|
|
245
|
+
console.warn(`Box: minWidth prop must be a number or percentage string (e.g., "50%"), received: ${value}`);
|
|
258
246
|
return {};
|
|
259
247
|
}
|
|
260
248
|
return {minWidth: value};
|
package/src/Button.tsx
CHANGED
package/src/CheckBox.tsx
CHANGED
|
@@ -32,13 +32,7 @@ export const CheckBox: FC<CheckBoxProps> = ({selected, size = "md", bgColor = "d
|
|
|
32
32
|
}}
|
|
33
33
|
>
|
|
34
34
|
{selected ? (
|
|
35
|
-
<FontAwesome6
|
|
36
|
-
color={theme.surface.base}
|
|
37
|
-
name="check"
|
|
38
|
-
size={px[size].icon}
|
|
39
|
-
solid
|
|
40
|
-
selectable={undefined}
|
|
41
|
-
/>
|
|
35
|
+
<FontAwesome6 color={theme.surface.base} name="check" size={px[size].icon} solid selectable={undefined}/>
|
|
42
36
|
) : null}
|
|
43
37
|
</View>
|
|
44
38
|
);
|
package/src/Common.ts
CHANGED
|
@@ -64,11 +64,6 @@ export interface AccordionProps extends InfoModalIconProps {
|
|
|
64
64
|
* The title of the accordion.
|
|
65
65
|
*/
|
|
66
66
|
title: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* * Callback fired when the accordion is toggled.
|
|
70
|
-
* */
|
|
71
|
-
onToggle?: (isCollapse: boolean) => void;
|
|
72
67
|
}
|
|
73
68
|
|
|
74
69
|
export interface BaseProfile {
|
|
@@ -308,6 +303,18 @@ export type TextColor = keyof TextTheme;
|
|
|
308
303
|
export type SurfaceColor = keyof SurfaceTheme;
|
|
309
304
|
export type BorderColor = keyof BorderTheme;
|
|
310
305
|
export type StatusColor = keyof StatusTheme;
|
|
306
|
+
// TODO: Remove ButtonColor. Buttons no longer have colors, only types (called style in Figma)
|
|
307
|
+
export type ButtonColor =
|
|
308
|
+
| "blue"
|
|
309
|
+
| "gray"
|
|
310
|
+
| "red"
|
|
311
|
+
// | "transparent"
|
|
312
|
+
| "white"
|
|
313
|
+
| "primary"
|
|
314
|
+
| "secondary"
|
|
315
|
+
| "accent"
|
|
316
|
+
| "tertiary"
|
|
317
|
+
| string;
|
|
311
318
|
|
|
312
319
|
// TODO: we may want/need to expand icon color options from just text colors.
|
|
313
320
|
export type IconColor = TextColor;
|
|
@@ -425,11 +432,11 @@ export const iconSizeToNumber = (size?: IconSize) => {
|
|
|
425
432
|
|
|
426
433
|
export type TextSize = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
427
434
|
|
|
428
|
-
export
|
|
435
|
+
export type ValueMappingItem = {
|
|
429
436
|
value: number;
|
|
430
437
|
label: string;
|
|
431
438
|
size?: IconSize;
|
|
432
|
-
}
|
|
439
|
+
};
|
|
433
440
|
|
|
434
441
|
export type IconPrefix = "far" | "fas";
|
|
435
442
|
|
|
@@ -731,7 +738,7 @@ export interface HeadingProps {
|
|
|
731
738
|
children?: React.ReactNode;
|
|
732
739
|
color?: TextColor;
|
|
733
740
|
overflow?: "normal" | "breakWord"; // default "breakWord"
|
|
734
|
-
size?: "sm" | "md" | "lg" | "xl"
|
|
741
|
+
size?: "sm" | "md" | "lg" | "xl"; // default "sm"
|
|
735
742
|
truncate?: boolean; // default false
|
|
736
743
|
testID?: string;
|
|
737
744
|
}
|
|
@@ -763,6 +770,11 @@ export interface ImageProps {
|
|
|
763
770
|
style?: any;
|
|
764
771
|
}
|
|
765
772
|
|
|
773
|
+
export interface SearchButtonProps {
|
|
774
|
+
color: ButtonColor;
|
|
775
|
+
onClick: () => void;
|
|
776
|
+
}
|
|
777
|
+
|
|
766
778
|
export interface BackButtonInterface {
|
|
767
779
|
onBack: () => void;
|
|
768
780
|
}
|
|
@@ -1774,11 +1786,6 @@ export interface ModalProps {
|
|
|
1774
1786
|
* The content of the modal.
|
|
1775
1787
|
*/
|
|
1776
1788
|
children?: React.ReactElement;
|
|
1777
|
-
/**
|
|
1778
|
-
* If true, the modal will be closed when the background is clicked.
|
|
1779
|
-
* @default false
|
|
1780
|
-
*/
|
|
1781
|
-
persistOnBackgroundClick?: boolean;
|
|
1782
1789
|
/**
|
|
1783
1790
|
* If true, the primary button will be disabled.
|
|
1784
1791
|
* @default false
|
|
@@ -2132,7 +2139,7 @@ export interface TableContextType {
|
|
|
2132
2139
|
}
|
|
2133
2140
|
|
|
2134
2141
|
export interface TableContextProviderProps extends TableContextType {
|
|
2135
|
-
children: React.
|
|
2142
|
+
children: React.ReactElement;
|
|
2136
2143
|
}
|
|
2137
2144
|
|
|
2138
2145
|
export interface TextProps {
|