@ledgerhq/native-ui 0.8.3-next.0 → 0.8.4-nightly.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TextVariants } from "../../styles/theme";
|
|
2
2
|
import { BaseTextProps } from "./index";
|
|
3
3
|
export declare type FontWeightTypes = "medium" | "semiBold" | "bold";
|
|
4
|
+
export declare const fontWeightTypes: FontWeightTypes[];
|
|
4
5
|
export declare function getBracketSize({ variant }: {
|
|
5
6
|
variant?: TextVariants;
|
|
6
7
|
}): number;
|
|
@@ -11,6 +12,7 @@ export declare function getTextTypeStyle({ bracket }: {
|
|
|
11
12
|
lineHeight?: string;
|
|
12
13
|
paddingTop?: number;
|
|
13
14
|
textTransform?: string;
|
|
15
|
+
letterSpacing?: number;
|
|
14
16
|
}>;
|
|
15
17
|
export declare function getTextStyle({ variant, bracket, fontWeight, }: Partial<BaseTextProps>): {
|
|
16
18
|
fontFamily: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export const fontWeightTypes = ["medium", "semiBold", "bold"];
|
|
1
2
|
const bracketSizes = {
|
|
2
3
|
h1: 32,
|
|
4
|
+
h1Inter: 32,
|
|
3
5
|
h2: 28,
|
|
4
6
|
h3: 20,
|
|
5
7
|
h4: 18,
|
|
@@ -24,6 +26,11 @@ export function getTextTypeStyle({ bracket }) {
|
|
|
24
26
|
paddingTop: bracket ? 5 : 0,
|
|
25
27
|
textTransform: "uppercase",
|
|
26
28
|
},
|
|
29
|
+
h1Inter: {
|
|
30
|
+
fontFamily: "Inter",
|
|
31
|
+
lineHeight: "42px",
|
|
32
|
+
letterSpacing: -1,
|
|
33
|
+
},
|
|
27
34
|
h2: {
|
|
28
35
|
fontFamily: "Alpha",
|
|
29
36
|
lineHeight: "28px",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="styled-components-react-native" />
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { TouchableOpacity, TouchableOpacityProps } from "react-native";
|
|
4
4
|
import { BaseStyledProps } from "../../styled";
|
|
5
|
-
export declare type ButtonProps =
|
|
5
|
+
export declare type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
|
|
6
6
|
Icon?: React.ComponentType<{
|
|
7
7
|
size: number;
|
|
8
8
|
color: string;
|
|
@@ -18,7 +18,7 @@ export declare type ButtonProps = TouchableHighlightProps & BaseStyledProps & {
|
|
|
18
18
|
pending?: boolean;
|
|
19
19
|
displayContentWhenPending?: boolean;
|
|
20
20
|
};
|
|
21
|
-
export declare const Base: import("styled-components").StyledComponent<typeof
|
|
21
|
+
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {
|
|
22
22
|
iconButton?: boolean | undefined;
|
|
23
23
|
sizeVariant?: ButtonProps["size"];
|
|
24
24
|
} & Omit<ButtonProps, "size">, never>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import React, { useCallback, useState, useMemo } from "react";
|
|
11
11
|
import styled, { useTheme } from "styled-components/native";
|
|
12
|
-
import { ActivityIndicator,
|
|
12
|
+
import { ActivityIndicator, TouchableOpacity, View } from "react-native";
|
|
13
13
|
import { buttonSizeStyle, getButtonColorStyle } from "../../cta/Button/getButtonStyle";
|
|
14
14
|
import { ctaIconSize, ctaTextType } from "../../cta/getCtaStyle";
|
|
15
15
|
import Text from "../../Text";
|
|
@@ -18,7 +18,7 @@ import baseStyled from "../../styled";
|
|
|
18
18
|
const IconContainer = styled.View `
|
|
19
19
|
${(p) => p.iconButton ? "" : p.iconPosition === "left" ? `margin-right: 10px;` : `margin-left: 10px;`}
|
|
20
20
|
`;
|
|
21
|
-
export const Base = baseStyled(
|
|
21
|
+
export const Base = baseStyled(TouchableOpacity).attrs((p) => (Object.assign(Object.assign({}, getButtonColorStyle(p.theme.colors, p).button), {
|
|
22
22
|
// Avoid conflict with styled-system's size property by nulling size and renaming it
|
|
23
23
|
size: undefined, sizeVariant: p.size }))) `
|
|
24
24
|
|
package/lib/styles/theme.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ColorPalette } from "@ledgerhq/ui-shared";
|
|
2
2
|
export declare const space: number[];
|
|
3
|
-
export declare
|
|
3
|
+
export declare const textVariants: readonly ["h1", "h1Inter", "h2", "h3", "h4", "h5", "large", "body", "bodyLineHeight", "paragraph", "paragraphLineHeight", "small", "subtitle", "tiny"];
|
|
4
|
+
export declare type TextVariants = typeof textVariants[number];
|
|
4
5
|
export declare type ThemeScale<Type, Aliases extends string> = Array<Type> & Record<Aliases, Type>;
|
|
5
|
-
export declare const fontSizes: ThemeScale<number,
|
|
6
|
+
export declare const fontSizes: ThemeScale<number, "h1" | "h1Inter" | "h2" | "h3" | "h4" | "h5" | "large" | "body" | "bodyLineHeight" | "paragraph" | "paragraphLineHeight" | "small" | "subtitle" | "tiny">;
|
|
6
7
|
export declare const radii: number[];
|
|
7
8
|
export declare const zIndexes: number[];
|
|
8
9
|
export declare type Theme = {
|
package/lib/styles/theme.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { palettes } from "@ledgerhq/ui-shared";
|
|
2
2
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
|
3
3
|
export const space = [0, 2, 4, 8, 12, 14, 16, 24, 32, 40, 48, 64, 80, 96, 120];
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export const textVariants = [
|
|
5
|
+
"h1",
|
|
6
|
+
"h1Inter",
|
|
7
|
+
"h2",
|
|
8
|
+
"h3",
|
|
9
|
+
"h4",
|
|
10
|
+
"h5",
|
|
11
|
+
"large",
|
|
12
|
+
"body",
|
|
13
|
+
"bodyLineHeight",
|
|
14
|
+
"paragraph",
|
|
15
|
+
"paragraphLineHeight",
|
|
16
|
+
"small",
|
|
17
|
+
"subtitle",
|
|
18
|
+
"tiny",
|
|
19
|
+
];
|
|
20
|
+
// 0 1 2 3 4 5 6 7 8 9
|
|
21
|
+
export const fontSizes = [10, 11, 12, 13, 14, 16, 18, 24, 28, 32];
|
|
6
22
|
[
|
|
7
23
|
fontSizes.tiny,
|
|
8
24
|
fontSizes.subtitle,
|
|
@@ -13,6 +29,7 @@ export const fontSizes = [10, 11, 12, 13, 14, 16, 18, 24, 28];
|
|
|
13
29
|
fontSizes.h3,
|
|
14
30
|
fontSizes.h2,
|
|
15
31
|
fontSizes.h1,
|
|
32
|
+
fontSizes.h1Inter,
|
|
16
33
|
] = fontSizes;
|
|
17
34
|
fontSizes.bodyLineHeight = fontSizes.body;
|
|
18
35
|
fontSizes.paragraphLineHeight = fontSizes.paragraph;
|