@jobber/components-native 0.2.1 → 0.3.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.
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { Typography, } from "../Typography";
3
+ import { tokens } from "../utils/design";
4
+ const levelStyles = {
5
+ text: {
6
+ size: "default",
7
+ lineHeight: "base",
8
+ },
9
+ textSupporting: {
10
+ size: "small",
11
+ lineHeight: "tight",
12
+ },
13
+ };
14
+ const MAX_TEXT_FONT_SIZE_SCALE = 50;
15
+ const maxScaledFontSize = {
16
+ text: MAX_TEXT_FONT_SIZE_SCALE,
17
+ textSupporting: tokens["typography--fontSize-base"],
18
+ };
19
+ export function Text({ level = "text", variation = "base", emphasis, allowFontScaling = true, adjustsFontSizeToFit = false, maxLines = "unlimited", align, children, reverseTheme = false, strikeThrough = false, hideFromScreenReader = false, maxFontScaleSize, selectable, }) {
20
+ const accessibilityRole = "text";
21
+ return (React.createElement(Typography, Object.assign({ color: variation, fontFamily: "base", fontStyle: "regular", fontWeight: getFontWeight({ level, emphasis }), maxFontScaleSize: maxFontScaleSize || maxScaledFontSize[level], selectable: selectable }, Object.assign(Object.assign({}, levelStyles[level]), { allowFontScaling,
22
+ align,
23
+ adjustsFontSizeToFit,
24
+ accessibilityRole,
25
+ reverseTheme,
26
+ maxLines,
27
+ strikeThrough,
28
+ hideFromScreenReader })), children));
29
+ }
30
+ function getFontWeight({ level, emphasis, }) {
31
+ if (emphasis === "strong")
32
+ return "semiBold";
33
+ if (level === "textSupporting")
34
+ return "medium";
35
+ return "regular";
36
+ }
@@ -0,0 +1 @@
1
+ export { Text } from "./Text";
package/dist/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./Icon";
2
2
  export * from "./Divider";
3
3
  export * from "./Typography";
4
+ export * from "./Text";