ferns-ui 0.37.3 → 0.37.4
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/Link.d.ts +4 -6
- package/dist/Link.js +3 -8
- package/dist/Link.js.map +1 -1
- package/dist/Text.d.ts +2 -1
- package/dist/Text.js +2 -2
- package/dist/Text.js.map +1 -1
- package/package.json +2 -2
- package/src/Link.tsx +11 -12
- package/src/Text.tsx +3 -1
package/dist/Link.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
export declare class Link extends React.Component<LinkProps, LinkState> {
|
|
6
|
-
constructor(props: LinkProps);
|
|
7
|
-
render(): React.JSX.Element;
|
|
2
|
+
import { TextProps } from "./Text";
|
|
3
|
+
interface LinkProps extends TextProps {
|
|
4
|
+
href: string;
|
|
8
5
|
}
|
|
6
|
+
export declare function Link(props: LinkProps): React.ReactElement;
|
|
9
7
|
export {};
|
package/dist/Link.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Linking } from "react-native";
|
|
2
3
|
import { Text } from "./Text";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
super(props);
|
|
6
|
-
this.state = {};
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return React.createElement(Text, null, this.props.children);
|
|
10
|
-
}
|
|
4
|
+
export function Link(props) {
|
|
5
|
+
return (React.createElement(Text, Object.assign({}, props, { color: props.color || "blue", onPress: () => Linking.openURL(props.href) }), props.children));
|
|
11
6
|
}
|
|
12
7
|
//# sourceMappingURL=Link.js.map
|
package/dist/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../src/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../src/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,OAAO,EAAC,IAAI,EAAY,MAAM,QAAQ,CAAC;AAMvC,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,OAAO,CACL,oBAAC,IAAI,oBAAK,KAAK,IAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KACtF,KAAK,CAAC,QAAQ,CACV,CACR,CAAC;AACJ,CAAC"}
|
package/dist/Text.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface TextProps {
|
|
|
6
6
|
color?: AllColors;
|
|
7
7
|
inline?: boolean;
|
|
8
8
|
italic?: boolean;
|
|
9
|
+
onPress?: () => void;
|
|
9
10
|
overflow?: "normal" | "breakWord";
|
|
10
11
|
size?: TextSize;
|
|
11
12
|
truncate?: boolean;
|
|
@@ -16,4 +17,4 @@ export interface TextProps {
|
|
|
16
17
|
weight?: "bold" | "normal";
|
|
17
18
|
testID?: string;
|
|
18
19
|
}
|
|
19
|
-
export declare function Text({ align, children, color, inline, italic, overflow, size, truncate, font, underline, numberOfLines, skipLinking, testID, weight, }: TextProps): React.ReactElement;
|
|
20
|
+
export declare function Text({ align, children, color, inline, italic, overflow, size, truncate, font, onPress, underline, numberOfLines, skipLinking, testID, weight, }: TextProps): React.ReactElement;
|
package/dist/Text.js
CHANGED
|
@@ -7,7 +7,7 @@ const fontSizes = {
|
|
|
7
7
|
md: 14,
|
|
8
8
|
lg: 16,
|
|
9
9
|
};
|
|
10
|
-
export function Text({ align = "left", children, color, inline = false, italic = false, overflow, size = "md", truncate = false, font, underline, numberOfLines, skipLinking, testID, weight = "normal", }) {
|
|
10
|
+
export function Text({ align = "left", children, color, inline = false, italic = false, overflow, size = "md", truncate = false, font, onPress, underline, numberOfLines, skipLinking, testID, weight = "normal", }) {
|
|
11
11
|
const { theme } = useContext(ThemeContext);
|
|
12
12
|
function propsToStyle() {
|
|
13
13
|
const style = {};
|
|
@@ -81,7 +81,7 @@ export function Text({ align = "left", children, color, inline = false, italic =
|
|
|
81
81
|
else if (inline || truncate) {
|
|
82
82
|
lines = 1;
|
|
83
83
|
}
|
|
84
|
-
const inner = (React.createElement(NativeText, { numberOfLines: lines, style: propsToStyle(), testID: testID }, children));
|
|
84
|
+
const inner = (React.createElement(NativeText, { numberOfLines: lines, style: propsToStyle(), testID: testID, onPress: onPress }, children));
|
|
85
85
|
if (skipLinking) {
|
|
86
86
|
return inner;
|
|
87
87
|
}
|
package/dist/Text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,IAAI,IAAI,UAAU,EAAY,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,IAAI,IAAI,UAAU,EAAY,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAoBrC,MAAM,SAAS,GAAG;IAChB,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,UAAU,IAAI,CAA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,CAAC;KACH;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferns-ui",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"scripts": {
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"@typescript-eslint/parser": "^6.9.0",
|
|
132
132
|
"dayjs": "^1.11.10",
|
|
133
133
|
"eslint": "^8.52.0",
|
|
134
|
-
"eslint-config-ferns": "^0.4.
|
|
134
|
+
"eslint-config-ferns": "^0.4.5",
|
|
135
135
|
"eslint-config-prettier": "^9.0.0",
|
|
136
136
|
"eslint-plugin-import": "^2.29.0",
|
|
137
137
|
"eslint-plugin-lodash": "^7.1.0",
|
package/src/Link.tsx
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import {Linking} from "react-native";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import {Text} from "./Text";
|
|
4
|
+
import {Text, TextProps} from "./Text";
|
|
5
5
|
|
|
6
|
-
interface
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
constructor(props: LinkProps) {
|
|
10
|
-
super(props);
|
|
11
|
-
this.state = {};
|
|
12
|
-
}
|
|
6
|
+
interface LinkProps extends TextProps {
|
|
7
|
+
href: string;
|
|
8
|
+
}
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export function Link(props: LinkProps): React.ReactElement {
|
|
11
|
+
return (
|
|
12
|
+
<Text {...props} color={props.color || "blue"} onPress={() => Linking.openURL(props.href)}>
|
|
13
|
+
{props.children}
|
|
14
|
+
</Text>
|
|
15
|
+
);
|
|
17
16
|
}
|
package/src/Text.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export interface TextProps {
|
|
|
11
11
|
color?: AllColors;
|
|
12
12
|
inline?: boolean; // default false
|
|
13
13
|
italic?: boolean; // default false
|
|
14
|
+
onPress?: () => void;
|
|
14
15
|
overflow?: "normal" | "breakWord"; // deprecated
|
|
15
16
|
size?: TextSize; // default "md"
|
|
16
17
|
truncate?: boolean; // default false
|
|
@@ -38,6 +39,7 @@ export function Text({
|
|
|
38
39
|
size = "md",
|
|
39
40
|
truncate = false,
|
|
40
41
|
font,
|
|
42
|
+
onPress,
|
|
41
43
|
underline,
|
|
42
44
|
numberOfLines,
|
|
43
45
|
skipLinking,
|
|
@@ -117,7 +119,7 @@ export function Text({
|
|
|
117
119
|
lines = 1;
|
|
118
120
|
}
|
|
119
121
|
const inner = (
|
|
120
|
-
<NativeText numberOfLines={lines} style={propsToStyle()} testID={testID}>
|
|
122
|
+
<NativeText numberOfLines={lines} style={propsToStyle()} testID={testID} onPress={onPress}>
|
|
121
123
|
{children}
|
|
122
124
|
</NativeText>
|
|
123
125
|
);
|