@jobber/components-native 0.82.1-JOB-131123-c660de8.42 → 0.83.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/package.json +2 -2
- package/dist/src/InputSearch/InputSearch.js +4 -5
- package/dist/src/Text/Text.js +2 -2
- package/dist/src/Typography/Typography.js +2 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/Text/Text.d.ts +2 -6
- package/dist/types/src/Typography/Typography.d.ts +1 -3
- package/dist/types/src/Typography/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/Heading/__snapshots__/Heading.test.tsx.snap +0 -8
- package/src/InputSearch/InputSearch.tsx +4 -6
- package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +0 -7
- package/src/Text/Text.test.tsx +6 -34
- package/src/Text/Text.tsx +0 -8
- package/src/Text/__snapshots__/Text.test.tsx.snap +1 -21
- package/src/TextList/__snapshots__/TextList.test.tsx.snap +0 -4
- package/src/Typography/Typography.test.tsx +1 -32
- package/src/Typography/Typography.tsx +0 -7
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +0 -31
- package/src/Typography/index.ts +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextAlign, TextVariation, TruncateLength, TypographyProps } from "../Typography";
|
|
2
2
|
import { TypographyUnsafeStyle } from "../Typography/Typography";
|
|
3
3
|
export interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSize" | "selectable"> {
|
|
4
4
|
/**
|
|
@@ -66,11 +66,7 @@ export interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSi
|
|
|
66
66
|
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
67
67
|
*/
|
|
68
68
|
readonly UNSAFE_style?: TypographyUnsafeStyle;
|
|
69
|
-
/**
|
|
70
|
-
* Callback that is called when the text is laid out.
|
|
71
|
-
*/
|
|
72
|
-
readonly onTextLayout?: OnTextLayoutEvent;
|
|
73
69
|
}
|
|
74
70
|
export type TextLevel = "text" | "textSupporting";
|
|
75
71
|
export declare const TEXT_MAX_SCALED_FONT_SIZES: Record<TextLevel, number>;
|
|
76
|
-
export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, italic, hideFromScreenReader, maxFontScaleSize, UNSAFE_style, underline, selectable,
|
|
72
|
+
export declare function Text({ level, variation, emphasis, allowFontScaling, adjustsFontSizeToFit, maxLines, align, children, reverseTheme, strikeThrough, italic, hideFromScreenReader, maxFontScaleSize, UNSAFE_style, underline, selectable, }: TextProps): JSX.Element;
|
|
@@ -86,13 +86,12 @@ export interface TypographyProps<T extends FontFamily> extends Pick<TextProps, "
|
|
|
86
86
|
*/
|
|
87
87
|
readonly strikeThrough?: boolean;
|
|
88
88
|
readonly UNSAFE_style?: TypographyUnsafeStyle;
|
|
89
|
-
readonly onTextLayout?: OnTextLayoutEvent;
|
|
90
89
|
}
|
|
91
90
|
export interface TypographyUnsafeStyle {
|
|
92
91
|
textStyle?: StyleProp<TextStyle>;
|
|
93
92
|
}
|
|
94
93
|
export declare const Typography: React.MemoExoticComponent<typeof InternalTypography>;
|
|
95
|
-
declare function InternalTypography<T extends FontFamily = "base">({ fontFamily, fontStyle, fontWeight, transform, color, align, size, children, maxLines, allowFontScaling, maxFontScaleSize, adjustsFontSizeToFit, lineHeight, letterSpacing, reverseTheme, hideFromScreenReader, accessibilityRole, strikeThrough, underline, UNSAFE_style, selectable,
|
|
94
|
+
declare function InternalTypography<T extends FontFamily = "base">({ fontFamily, fontStyle, fontWeight, transform, color, align, size, children, maxLines, allowFontScaling, maxFontScaleSize, adjustsFontSizeToFit, lineHeight, letterSpacing, reverseTheme, hideFromScreenReader, accessibilityRole, strikeThrough, underline, UNSAFE_style, selectable, }: TypographyProps<T>): JSX.Element;
|
|
96
95
|
export type FontFamily = "base" | "display";
|
|
97
96
|
export type FontStyle = "regular" | "italic";
|
|
98
97
|
export type FontWeight = "regular" | "medium" | "bold" | "semiBold" | "extraBold" | "black";
|
|
@@ -109,5 +108,4 @@ export type LineHeight = "extravagant" | "jumbo" | "largest" | "larger" | "large
|
|
|
109
108
|
export type LetterSpacing = "base" | "loose";
|
|
110
109
|
export type TextAccessibilityRole = "text" | "header";
|
|
111
110
|
export type TruncateLength = "single" | "small" | "base" | "large" | "extraLarge" | "unlimited";
|
|
112
|
-
export type OnTextLayoutEvent = Exclude<TextProps["onTextLayout"], undefined>;
|
|
113
111
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Typography } from "./Typography";
|
|
2
|
-
export type { FontFamily, FontStyle, FontWeight, BaseWeight, DisplayWeight, BaseStyle, DisplayStyle, TextColor, TextTransform, TextSize, TextAlign, LineHeight, LetterSpacing, TextAccessibilityRole, TextVariation, TypographyProps, TruncateLength,
|
|
2
|
+
export type { FontFamily, FontStyle, FontWeight, BaseWeight, DisplayWeight, BaseStyle, DisplayStyle, TextColor, TextTransform, TextSize, TextAlign, LineHeight, LetterSpacing, TextAccessibilityRole, TextVariation, TypographyProps, TruncateLength, } from "./Typography";
|
|
3
3
|
export { getTypographyStyles, useTypographyStyles } from "./Typography.style";
|
|
4
4
|
export { typographyStyles } from "./Typography.style";
|
|
5
5
|
export { TypographyGestureDetector } from "./TypographyGestureDetector";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"react-native-safe-area-context": "^5.4.0",
|
|
80
80
|
"react-native-svg": ">=12.0.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "5b2a570f0d657e82d04a8d60964242f67da3fab0"
|
|
83
83
|
}
|
|
@@ -6,7 +6,6 @@ exports[`when Heading called with Subtitle variation should match snapshot 1`] =
|
|
|
6
6
|
adjustsFontSizeToFit={false}
|
|
7
7
|
allowFontScaling={true}
|
|
8
8
|
collapsable={false}
|
|
9
|
-
ellipsizeMode="middle"
|
|
10
9
|
maxFontSizeMultiplier={1}
|
|
11
10
|
selectable={true}
|
|
12
11
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -41,7 +40,6 @@ exports[`when Heading called with an alignment should match snapshot 1`] = `
|
|
|
41
40
|
adjustsFontSizeToFit={false}
|
|
42
41
|
allowFontScaling={true}
|
|
43
42
|
collapsable={false}
|
|
44
|
-
ellipsizeMode="middle"
|
|
45
43
|
selectable={true}
|
|
46
44
|
selectionColor="hsl(86, 100%, 46%)"
|
|
47
45
|
style={
|
|
@@ -75,7 +73,6 @@ exports[`when Heading called with maxLines should match snapshot 1`] = `
|
|
|
75
73
|
adjustsFontSizeToFit={false}
|
|
76
74
|
allowFontScaling={true}
|
|
77
75
|
collapsable={false}
|
|
78
|
-
ellipsizeMode="middle"
|
|
79
76
|
numberOfLines={1}
|
|
80
77
|
selectable={true}
|
|
81
78
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -110,7 +107,6 @@ exports[`when Heading called with reverseTheme should match snapshot 1`] = `
|
|
|
110
107
|
adjustsFontSizeToFit={false}
|
|
111
108
|
allowFontScaling={true}
|
|
112
109
|
collapsable={false}
|
|
113
|
-
ellipsizeMode="middle"
|
|
114
110
|
selectable={true}
|
|
115
111
|
selectionColor="hsl(86, 100%, 46%)"
|
|
116
112
|
style={
|
|
@@ -144,7 +140,6 @@ exports[`when Heading called with sub-heading variation and text-color should ma
|
|
|
144
140
|
adjustsFontSizeToFit={false}
|
|
145
141
|
allowFontScaling={true}
|
|
146
142
|
collapsable={false}
|
|
147
|
-
ellipsizeMode="middle"
|
|
148
143
|
maxFontSizeMultiplier={1.375}
|
|
149
144
|
selectable={true}
|
|
150
145
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -179,7 +174,6 @@ exports[`when Heading called with sub-heading variation should match snapshot 1`
|
|
|
179
174
|
adjustsFontSizeToFit={false}
|
|
180
175
|
allowFontScaling={true}
|
|
181
176
|
collapsable={false}
|
|
182
|
-
ellipsizeMode="middle"
|
|
183
177
|
maxFontSizeMultiplier={1.375}
|
|
184
178
|
selectable={true}
|
|
185
179
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -214,7 +208,6 @@ exports[`when Heading called with text as the only prop should match snapshot 1`
|
|
|
214
208
|
adjustsFontSizeToFit={false}
|
|
215
209
|
allowFontScaling={true}
|
|
216
210
|
collapsable={false}
|
|
217
|
-
ellipsizeMode="middle"
|
|
218
211
|
selectable={true}
|
|
219
212
|
selectionColor="hsl(86, 100%, 46%)"
|
|
220
213
|
style={
|
|
@@ -248,7 +241,6 @@ exports[`when Heading called with title variation should match snapshot 1`] = `
|
|
|
248
241
|
adjustsFontSizeToFit={false}
|
|
249
242
|
allowFontScaling={true}
|
|
250
243
|
collapsable={false}
|
|
251
|
-
ellipsizeMode="middle"
|
|
252
244
|
maxFontSizeMultiplier={1.0625}
|
|
253
245
|
selectable={true}
|
|
254
246
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Ref, forwardRef, useEffect } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import
|
|
3
|
+
import { useDebounce } from "@jobber/hooks/useDebounce";
|
|
4
4
|
import { styles } from "./InputSearch.style";
|
|
5
5
|
import { InputText, InputTextProps, InputTextRef } from "../InputText";
|
|
6
6
|
|
|
@@ -49,14 +49,12 @@ function SearchInputInternal(
|
|
|
49
49
|
}: InputSearchProps,
|
|
50
50
|
ref: Ref<InputTextRef>,
|
|
51
51
|
) {
|
|
52
|
-
const
|
|
52
|
+
const debouncedSearch = useDebounce(onDebouncedChange, wait);
|
|
53
53
|
const handleChange = (newValue = "") => onChange(newValue);
|
|
54
54
|
|
|
55
55
|
useEffect(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return delayedSearch.cancel;
|
|
59
|
-
}, [value, delayedSearch]);
|
|
56
|
+
debouncedSearch(value);
|
|
57
|
+
}, [value, debouncedSearch]);
|
|
60
58
|
|
|
61
59
|
return (
|
|
62
60
|
<View style={styles.container}>
|
|
@@ -25,7 +25,6 @@ exports[`StatusLabel alignment when alignment prop set to "end" should match sna
|
|
|
25
25
|
adjustsFontSizeToFit={false}
|
|
26
26
|
allowFontScaling={true}
|
|
27
27
|
collapsable={false}
|
|
28
|
-
ellipsizeMode="middle"
|
|
29
28
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
30
29
|
selectable={true}
|
|
31
30
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -105,7 +104,6 @@ exports[`StatusLabel alignment when alignment prop set to default ("start") shou
|
|
|
105
104
|
adjustsFontSizeToFit={false}
|
|
106
105
|
allowFontScaling={true}
|
|
107
106
|
collapsable={false}
|
|
108
|
-
ellipsizeMode="middle"
|
|
109
107
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
110
108
|
selectable={true}
|
|
111
109
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -185,7 +183,6 @@ exports[`StatusLabel status when status prop set to "critical" should match snap
|
|
|
185
183
|
adjustsFontSizeToFit={false}
|
|
186
184
|
allowFontScaling={true}
|
|
187
185
|
collapsable={false}
|
|
188
|
-
ellipsizeMode="middle"
|
|
189
186
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
190
187
|
selectable={true}
|
|
191
188
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -265,7 +262,6 @@ exports[`StatusLabel status when status prop set to "inactive" should match snap
|
|
|
265
262
|
adjustsFontSizeToFit={false}
|
|
266
263
|
allowFontScaling={true}
|
|
267
264
|
collapsable={false}
|
|
268
|
-
ellipsizeMode="middle"
|
|
269
265
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
270
266
|
selectable={true}
|
|
271
267
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -345,7 +341,6 @@ exports[`StatusLabel status when status prop set to "informative" should match s
|
|
|
345
341
|
adjustsFontSizeToFit={false}
|
|
346
342
|
allowFontScaling={true}
|
|
347
343
|
collapsable={false}
|
|
348
|
-
ellipsizeMode="middle"
|
|
349
344
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
350
345
|
selectable={true}
|
|
351
346
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -425,7 +420,6 @@ exports[`StatusLabel status when status prop set to "warning" should match snaps
|
|
|
425
420
|
adjustsFontSizeToFit={false}
|
|
426
421
|
allowFontScaling={true}
|
|
427
422
|
collapsable={false}
|
|
428
|
-
ellipsizeMode="middle"
|
|
429
423
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
430
424
|
selectable={true}
|
|
431
425
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -505,7 +499,6 @@ exports[`StatusLabel status when status prop set to default ("success") should m
|
|
|
505
499
|
adjustsFontSizeToFit={false}
|
|
506
500
|
allowFontScaling={true}
|
|
507
501
|
collapsable={false}
|
|
508
|
-
ellipsizeMode="middle"
|
|
509
502
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
510
503
|
selectable={true}
|
|
511
504
|
selectionColor="hsl(86, 100%, 46%)"
|
package/src/Text/Text.test.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
3
|
import { Text } from ".";
|
|
4
4
|
import { tokens } from "../utils/design";
|
|
5
5
|
|
|
@@ -135,7 +135,6 @@ it("renders with italic styling", () => {
|
|
|
135
135
|
|
|
136
136
|
it("renders text that is inaccessible", () => {
|
|
137
137
|
const text = render(<Text hideFromScreenReader={true}>Test Text</Text>);
|
|
138
|
-
|
|
139
138
|
expect(text.root.props).toEqual(
|
|
140
139
|
expect.objectContaining({
|
|
141
140
|
accessibilityRole: "none",
|
|
@@ -146,7 +145,7 @@ it("renders text that is inaccessible", () => {
|
|
|
146
145
|
});
|
|
147
146
|
|
|
148
147
|
it("renders text with underline styling", () => {
|
|
149
|
-
const text = render(<Text underline="
|
|
148
|
+
const text = render(<Text underline="dashed">Test Text</Text>);
|
|
150
149
|
|
|
151
150
|
expect(text.toJSON()).toMatchSnapshot();
|
|
152
151
|
});
|
|
@@ -160,39 +159,12 @@ describe("UNSAFE_style", () => {
|
|
|
160
159
|
},
|
|
161
160
|
};
|
|
162
161
|
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
const { getByRole } = render(
|
|
163
|
+
<Text UNSAFE_style={customStyle}>Test Text</Text>,
|
|
164
|
+
);
|
|
165
|
+
const textElement = getByRole("text");
|
|
165
166
|
expect(textElement.props.style).toContainEqual(
|
|
166
167
|
expect.objectContaining(customStyle.textStyle),
|
|
167
168
|
);
|
|
168
169
|
});
|
|
169
170
|
});
|
|
170
|
-
|
|
171
|
-
describe("onTextLayout", () => {
|
|
172
|
-
it("calls onTextLayout callback when text layout event occurs", () => {
|
|
173
|
-
const onTextLayoutMock = jest.fn();
|
|
174
|
-
render(<Text onTextLayout={onTextLayoutMock}>Test Text</Text>);
|
|
175
|
-
|
|
176
|
-
const textElement = screen.getByRole("text");
|
|
177
|
-
const mockEvent = {
|
|
178
|
-
nativeEvent: {
|
|
179
|
-
lines: [
|
|
180
|
-
{
|
|
181
|
-
text: "Test Text",
|
|
182
|
-
x: 0,
|
|
183
|
-
y: 0,
|
|
184
|
-
width: 100,
|
|
185
|
-
height: 20,
|
|
186
|
-
ascender: 15,
|
|
187
|
-
descender: -5,
|
|
188
|
-
capHeight: 14,
|
|
189
|
-
xHeight: 10,
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
fireEvent(textElement, "onTextLayout", mockEvent);
|
|
195
|
-
expect(onTextLayoutMock).toHaveBeenCalledTimes(1);
|
|
196
|
-
expect(onTextLayoutMock).toHaveBeenCalledWith(mockEvent);
|
|
197
|
-
});
|
|
198
|
-
});
|
package/src/Text/Text.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
BaseWeight,
|
|
4
4
|
LineHeight,
|
|
5
|
-
OnTextLayoutEvent,
|
|
6
5
|
TextAccessibilityRole,
|
|
7
6
|
TextAlign,
|
|
8
7
|
TextSize,
|
|
@@ -94,11 +93,6 @@ export interface TextProps
|
|
|
94
93
|
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
95
94
|
*/
|
|
96
95
|
readonly UNSAFE_style?: TypographyUnsafeStyle;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Callback that is called when the text is laid out.
|
|
100
|
-
*/
|
|
101
|
-
readonly onTextLayout?: OnTextLayoutEvent;
|
|
102
96
|
}
|
|
103
97
|
|
|
104
98
|
export type TextLevel = "text" | "textSupporting";
|
|
@@ -142,7 +136,6 @@ export function Text({
|
|
|
142
136
|
UNSAFE_style,
|
|
143
137
|
underline,
|
|
144
138
|
selectable,
|
|
145
|
-
onTextLayout,
|
|
146
139
|
}: TextProps): JSX.Element {
|
|
147
140
|
const accessibilityRole: TextAccessibilityRole = "text";
|
|
148
141
|
|
|
@@ -156,7 +149,6 @@ export function Text({
|
|
|
156
149
|
maxFontScaleSize={maxFontScaleSize || TEXT_MAX_SCALED_FONT_SIZES[level]}
|
|
157
150
|
selectable={selectable}
|
|
158
151
|
underline={underline}
|
|
159
|
-
onTextLayout={onTextLayout}
|
|
160
152
|
{...{
|
|
161
153
|
...levelStyles[level],
|
|
162
154
|
allowFontScaling,
|
|
@@ -6,7 +6,6 @@ exports[`renders text supporting with no additional props 1`] = `
|
|
|
6
6
|
adjustsFontSizeToFit={false}
|
|
7
7
|
allowFontScaling={true}
|
|
8
8
|
collapsable={false}
|
|
9
|
-
ellipsizeMode="middle"
|
|
10
9
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
11
10
|
selectable={true}
|
|
12
11
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -41,7 +40,6 @@ exports[`renders text supporting with variation success 1`] = `
|
|
|
41
40
|
adjustsFontSizeToFit={false}
|
|
42
41
|
allowFontScaling={true}
|
|
43
42
|
collapsable={false}
|
|
44
|
-
ellipsizeMode="middle"
|
|
45
43
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
46
44
|
selectable={true}
|
|
47
45
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -76,7 +74,6 @@ exports[`renders text supporting with variation success reverseTheme true 1`] =
|
|
|
76
74
|
adjustsFontSizeToFit={false}
|
|
77
75
|
allowFontScaling={true}
|
|
78
76
|
collapsable={false}
|
|
79
|
-
ellipsizeMode="middle"
|
|
80
77
|
maxFontSizeMultiplier={1.1428571428571428}
|
|
81
78
|
selectable={true}
|
|
82
79
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -111,7 +108,6 @@ exports[`renders text that is not scaled down with adjustsFontSize false 1`] = `
|
|
|
111
108
|
adjustsFontSizeToFit={false}
|
|
112
109
|
allowFontScaling={true}
|
|
113
110
|
collapsable={false}
|
|
114
|
-
ellipsizeMode="middle"
|
|
115
111
|
maxFontSizeMultiplier={3.125}
|
|
116
112
|
numberOfLines={4}
|
|
117
113
|
selectable={true}
|
|
@@ -147,7 +143,6 @@ exports[`renders text that is scaled down with adjustsFontSize true 1`] = `
|
|
|
147
143
|
adjustsFontSizeToFit={true}
|
|
148
144
|
allowFontScaling={true}
|
|
149
145
|
collapsable={false}
|
|
150
|
-
ellipsizeMode="middle"
|
|
151
146
|
maxFontSizeMultiplier={3.125}
|
|
152
147
|
numberOfLines={4}
|
|
153
148
|
selectable={true}
|
|
@@ -183,7 +178,6 @@ exports[`renders text with base variation 1`] = `
|
|
|
183
178
|
adjustsFontSizeToFit={false}
|
|
184
179
|
allowFontScaling={true}
|
|
185
180
|
collapsable={false}
|
|
186
|
-
ellipsizeMode="middle"
|
|
187
181
|
maxFontSizeMultiplier={3.125}
|
|
188
182
|
selectable={true}
|
|
189
183
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -218,7 +212,6 @@ exports[`renders text with center alignment 1`] = `
|
|
|
218
212
|
adjustsFontSizeToFit={false}
|
|
219
213
|
allowFontScaling={true}
|
|
220
214
|
collapsable={false}
|
|
221
|
-
ellipsizeMode="middle"
|
|
222
215
|
maxFontSizeMultiplier={3.125}
|
|
223
216
|
selectable={true}
|
|
224
217
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -253,7 +246,6 @@ exports[`renders text with error variation 1`] = `
|
|
|
253
246
|
adjustsFontSizeToFit={false}
|
|
254
247
|
allowFontScaling={true}
|
|
255
248
|
collapsable={false}
|
|
256
|
-
ellipsizeMode="middle"
|
|
257
249
|
maxFontSizeMultiplier={3.125}
|
|
258
250
|
selectable={true}
|
|
259
251
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -288,7 +280,6 @@ exports[`renders text with error variation reverseTheme true 1`] = `
|
|
|
288
280
|
adjustsFontSizeToFit={false}
|
|
289
281
|
allowFontScaling={true}
|
|
290
282
|
collapsable={false}
|
|
291
|
-
ellipsizeMode="middle"
|
|
292
283
|
maxFontSizeMultiplier={3.125}
|
|
293
284
|
selectable={true}
|
|
294
285
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -323,7 +314,6 @@ exports[`renders text with info variation 1`] = `
|
|
|
323
314
|
adjustsFontSizeToFit={false}
|
|
324
315
|
allowFontScaling={true}
|
|
325
316
|
collapsable={false}
|
|
326
|
-
ellipsizeMode="middle"
|
|
327
317
|
maxFontSizeMultiplier={3.125}
|
|
328
318
|
selectable={true}
|
|
329
319
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -358,7 +348,6 @@ exports[`renders text with left alignment 1`] = `
|
|
|
358
348
|
adjustsFontSizeToFit={false}
|
|
359
349
|
allowFontScaling={true}
|
|
360
350
|
collapsable={false}
|
|
361
|
-
ellipsizeMode="middle"
|
|
362
351
|
maxFontSizeMultiplier={3.125}
|
|
363
352
|
selectable={true}
|
|
364
353
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -393,7 +382,6 @@ exports[`renders text with no additional props 1`] = `
|
|
|
393
382
|
adjustsFontSizeToFit={false}
|
|
394
383
|
allowFontScaling={true}
|
|
395
384
|
collapsable={false}
|
|
396
|
-
ellipsizeMode="middle"
|
|
397
385
|
maxFontSizeMultiplier={3.125}
|
|
398
386
|
selectable={true}
|
|
399
387
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -428,7 +416,6 @@ exports[`renders text with right alignment 1`] = `
|
|
|
428
416
|
adjustsFontSizeToFit={false}
|
|
429
417
|
allowFontScaling={true}
|
|
430
418
|
collapsable={false}
|
|
431
|
-
ellipsizeMode="middle"
|
|
432
419
|
maxFontSizeMultiplier={3.125}
|
|
433
420
|
selectable={true}
|
|
434
421
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -463,7 +450,6 @@ exports[`renders text with subdued variation 1`] = `
|
|
|
463
450
|
adjustsFontSizeToFit={false}
|
|
464
451
|
allowFontScaling={true}
|
|
465
452
|
collapsable={false}
|
|
466
|
-
ellipsizeMode="middle"
|
|
467
453
|
maxFontSizeMultiplier={3.125}
|
|
468
454
|
selectable={true}
|
|
469
455
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -498,7 +484,6 @@ exports[`renders text with success variation 1`] = `
|
|
|
498
484
|
adjustsFontSizeToFit={false}
|
|
499
485
|
allowFontScaling={true}
|
|
500
486
|
collapsable={false}
|
|
501
|
-
ellipsizeMode="middle"
|
|
502
487
|
maxFontSizeMultiplier={3.125}
|
|
503
488
|
selectable={true}
|
|
504
489
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -533,7 +518,6 @@ exports[`renders text with success variation reverseTheme true 1`] = `
|
|
|
533
518
|
adjustsFontSizeToFit={false}
|
|
534
519
|
allowFontScaling={true}
|
|
535
520
|
collapsable={false}
|
|
536
|
-
ellipsizeMode="middle"
|
|
537
521
|
maxFontSizeMultiplier={3.125}
|
|
538
522
|
selectable={true}
|
|
539
523
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -568,7 +552,6 @@ exports[`renders text with underline styling 1`] = `
|
|
|
568
552
|
adjustsFontSizeToFit={false}
|
|
569
553
|
allowFontScaling={true}
|
|
570
554
|
collapsable={false}
|
|
571
|
-
ellipsizeMode="middle"
|
|
572
555
|
maxFontSizeMultiplier={3.125}
|
|
573
556
|
selectable={true}
|
|
574
557
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -591,7 +574,7 @@ exports[`renders text with underline styling 1`] = `
|
|
|
591
574
|
"letterSpacing": 0,
|
|
592
575
|
},
|
|
593
576
|
{
|
|
594
|
-
"textDecorationStyle": "
|
|
577
|
+
"textDecorationStyle": "dashed",
|
|
595
578
|
},
|
|
596
579
|
{
|
|
597
580
|
"textDecorationColor": "hsl(197, 15%, 43%)",
|
|
@@ -610,7 +593,6 @@ exports[`renders text with warn variation 1`] = `
|
|
|
610
593
|
adjustsFontSizeToFit={false}
|
|
611
594
|
allowFontScaling={true}
|
|
612
595
|
collapsable={false}
|
|
613
|
-
ellipsizeMode="middle"
|
|
614
596
|
maxFontSizeMultiplier={3.125}
|
|
615
597
|
selectable={true}
|
|
616
598
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -645,7 +627,6 @@ exports[`renders with italic styling 1`] = `
|
|
|
645
627
|
adjustsFontSizeToFit={false}
|
|
646
628
|
allowFontScaling={true}
|
|
647
629
|
collapsable={false}
|
|
648
|
-
ellipsizeMode="middle"
|
|
649
630
|
maxFontSizeMultiplier={3.125}
|
|
650
631
|
selectable={true}
|
|
651
632
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -683,7 +664,6 @@ exports[`renders with strikethrough styling 1`] = `
|
|
|
683
664
|
adjustsFontSizeToFit={false}
|
|
684
665
|
allowFontScaling={true}
|
|
685
666
|
collapsable={false}
|
|
686
|
-
ellipsizeMode="middle"
|
|
687
667
|
maxFontSizeMultiplier={3.125}
|
|
688
668
|
selectable={true}
|
|
689
669
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -41,7 +41,6 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
41
41
|
adjustsFontSizeToFit={false}
|
|
42
42
|
allowFontScaling={true}
|
|
43
43
|
collapsable={false}
|
|
44
|
-
ellipsizeMode="middle"
|
|
45
44
|
maxFontSizeMultiplier={3.125}
|
|
46
45
|
selectable={true}
|
|
47
46
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -81,7 +80,6 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
81
80
|
adjustsFontSizeToFit={false}
|
|
82
81
|
allowFontScaling={true}
|
|
83
82
|
collapsable={false}
|
|
84
|
-
ellipsizeMode="middle"
|
|
85
83
|
maxFontSizeMultiplier={3.125}
|
|
86
84
|
selectable={true}
|
|
87
85
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -135,7 +133,6 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
135
133
|
adjustsFontSizeToFit={false}
|
|
136
134
|
allowFontScaling={true}
|
|
137
135
|
collapsable={false}
|
|
138
|
-
ellipsizeMode="middle"
|
|
139
136
|
maxFontSizeMultiplier={3.125}
|
|
140
137
|
selectable={true}
|
|
141
138
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -175,7 +172,6 @@ exports[`TextList when the bulletItems is provided displays the text list 1`] =
|
|
|
175
172
|
adjustsFontSizeToFit={false}
|
|
176
173
|
allowFontScaling={true}
|
|
177
174
|
collapsable={false}
|
|
178
|
-
ellipsizeMode="middle"
|
|
179
175
|
maxFontSizeMultiplier={3.125}
|
|
180
176
|
selectable={true}
|
|
181
177
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
3
|
import { I18nManager } from "react-native";
|
|
4
4
|
import { Typography } from "./Typography";
|
|
5
5
|
|
|
@@ -251,34 +251,3 @@ describe("underline", () => {
|
|
|
251
251
|
},
|
|
252
252
|
);
|
|
253
253
|
});
|
|
254
|
-
|
|
255
|
-
describe("onTextLayout", () => {
|
|
256
|
-
it("calls onTextLayout callback when text layout event occurs", () => {
|
|
257
|
-
const onTextLayoutMock = jest.fn();
|
|
258
|
-
const { getByRole } = render(
|
|
259
|
-
<Typography onTextLayout={onTextLayoutMock}>Test Text</Typography>,
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
const textElement = getByRole("text");
|
|
263
|
-
const mockEvent = {
|
|
264
|
-
nativeEvent: {
|
|
265
|
-
lines: [
|
|
266
|
-
{
|
|
267
|
-
text: "Test Text",
|
|
268
|
-
x: 0,
|
|
269
|
-
y: 0,
|
|
270
|
-
width: 100,
|
|
271
|
-
height: 20,
|
|
272
|
-
ascender: 15,
|
|
273
|
-
descender: -5,
|
|
274
|
-
capHeight: 14,
|
|
275
|
-
xHeight: 10,
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
},
|
|
279
|
-
};
|
|
280
|
-
fireEvent(textElement, "onTextLayout", mockEvent);
|
|
281
|
-
expect(onTextLayoutMock).toHaveBeenCalledTimes(1);
|
|
282
|
-
expect(onTextLayoutMock).toHaveBeenCalledWith(mockEvent);
|
|
283
|
-
});
|
|
284
|
-
});
|
|
@@ -120,8 +120,6 @@ export interface TypographyProps<T extends FontFamily>
|
|
|
120
120
|
readonly strikeThrough?: boolean;
|
|
121
121
|
|
|
122
122
|
readonly UNSAFE_style?: TypographyUnsafeStyle;
|
|
123
|
-
|
|
124
|
-
readonly onTextLayout?: OnTextLayoutEvent;
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
const maxNumberOfLines = {
|
|
@@ -162,7 +160,6 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
162
160
|
underline,
|
|
163
161
|
UNSAFE_style,
|
|
164
162
|
selectable = true,
|
|
165
|
-
onTextLayout,
|
|
166
163
|
}: TypographyProps<T>): JSX.Element {
|
|
167
164
|
const styles = useTypographyStyles();
|
|
168
165
|
const sizeAndHeight = getSizeAndHeightStyle(size, styles, lineHeight);
|
|
@@ -212,7 +209,6 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
212
209
|
adjustsFontSizeToFit,
|
|
213
210
|
style,
|
|
214
211
|
numberOfLines: numberOfLinesForNativeText,
|
|
215
|
-
ellipsizeMode: "middle",
|
|
216
212
|
}}
|
|
217
213
|
{...accessibilityProps}
|
|
218
214
|
maxFontSizeMultiplier={getScaleMultiplier(
|
|
@@ -221,7 +217,6 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
221
217
|
)}
|
|
222
218
|
selectable={selectable}
|
|
223
219
|
selectionColor={tokens["color-brand--highlight"]}
|
|
224
|
-
onTextLayout={onTextLayout}
|
|
225
220
|
>
|
|
226
221
|
{text}
|
|
227
222
|
</Text>
|
|
@@ -482,5 +477,3 @@ export type TruncateLength =
|
|
|
482
477
|
| "large"
|
|
483
478
|
| "extraLarge"
|
|
484
479
|
| "unlimited";
|
|
485
|
-
|
|
486
|
-
export type OnTextLayoutEvent = Exclude<TextProps["onTextLayout"], undefined>;
|