ferns-ui 0.2.3 → 0.4.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,25 @@
1
+ import React from "react";
2
+ interface AvatarProps {
3
+ /**
4
+ * The name of the user. This is used for the placeholder treatment if an image is not available.
5
+ */
6
+ name: string;
7
+ /**
8
+ * Override the generated initials from `name`.
9
+ */
10
+ initials?: string;
11
+ /**
12
+ * Adds a white border around Avatar so it's visible when displayed on other images.
13
+ */
14
+ outline?: boolean;
15
+ /**
16
+ * xs: 24px, sm: 32px, md: 48px, lg: 64px, xl: 120px.
17
+ */
18
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
19
+ /**
20
+ * The URL of the user's image.
21
+ */
22
+ src?: string;
23
+ }
24
+ export declare const Avatar: (props: AvatarProps) => React.ReactElement;
25
+ export {};
package/dist/Avatar.js ADDED
@@ -0,0 +1,48 @@
1
+ import React, { useState } from "react";
2
+ import { Image, Text, View } from "react-native";
3
+ import { Box } from "./Box";
4
+ import { Unifier } from "./Unifier";
5
+ const sizes = {
6
+ xs: 24,
7
+ sm: 32,
8
+ md: 48,
9
+ lg: 64,
10
+ xl: 120,
11
+ };
12
+ export const Avatar = (props) => {
13
+ const [isImageLoaded, setIsImageLoaded] = useState(true);
14
+ const { name, initials, outline, size = "md", src } = props;
15
+ const width = sizes[size];
16
+ const height = sizes[size];
17
+ const radius = sizes[size] / 2;
18
+ const fontSize = sizes[size] / 2;
19
+ const computedInitials = initials !== null && initials !== void 0 ? initials : name.match(/(^\S\S?|\s\S)?/g)
20
+ .map((v) => v.trim())
21
+ .join("")
22
+ .match(/(^\S|\S$)?/g)
23
+ .join("")
24
+ .toLocaleUpperCase();
25
+ const handleImageError = () => setIsImageLoaded(false);
26
+ return (React.createElement(Box, { border: outline ? "white" : undefined, height: height, overflow: "hidden", position: "relative", rounding: "circle", width: width }, src && isImageLoaded ? (
27
+ // TODO: Make our Image component rounding work so that we can use it for Avatar. Currently it creates an
28
+ // unrounded box around the Image.
29
+ React.createElement(Image, { resizeMode: "contain", source: { uri: src, cache: "force-cache" }, style: {
30
+ borderRadius: radius,
31
+ height,
32
+ width,
33
+ display: "flex",
34
+ alignItems: "center",
35
+ justifyContent: "center",
36
+ overflow: "hidden",
37
+ }, onError: handleImageError })) : (React.createElement(View, { style: {
38
+ height,
39
+ width,
40
+ borderRadius: radius,
41
+ display: "flex",
42
+ alignItems: "center",
43
+ justifyContent: "center",
44
+ backgroundColor: Unifier.theme.gray,
45
+ } },
46
+ React.createElement(Text, { style: { fontSize, color: Unifier.theme.darkGray } }, computedInitials)))));
47
+ };
48
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../src/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,KAAK,GAAG;IACZ,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,GAAG;CACR,CAAC;AAyBF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAsB,EAAE;IAC/D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAC,GAAG,KAAK,CAAC;IAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,MAAM,G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KAAK;YACL,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;SACpC;QAED,oBAAC,IAAI,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAC,IAAG,gBAAgB,CAAQ,CAC5E,CACR,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
package/dist/Common.d.ts CHANGED
@@ -437,7 +437,7 @@ export interface SpinnerProps {
437
437
  color?: Color;
438
438
  }
439
439
  export interface MaskProps {
440
- children?: React.ReactNode;
440
+ children?: React.ReactElement;
441
441
  shape?: "circle" | "rounded" | "square";
442
442
  height?: number | string;
443
443
  width?: number | string;
package/dist/Form.d.ts CHANGED
@@ -4,7 +4,7 @@ interface FormLineProps {
4
4
  value: any;
5
5
  onSave: (value: any) => void;
6
6
  kind: "boolean" | "string" | "textarea" | "select" | "multiboolean";
7
- options?: (string | undefined)[];
7
+ options?: string[];
8
8
  }
9
9
  interface FormLineState {
10
10
  editing: boolean;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @providesModule Hyperlink
3
+ *
4
+ * Forked from https://github.com/obipawan/react-native-hyperlink
5
+ *
6
+ *
7
+ * MIT License
8
+ *
9
+ * Copyright (c) 2019 Pawan
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ * */
29
+ import React from "react";
30
+ import { StyleProp } from "react-native";
31
+ interface Props {
32
+ linkDefault?: boolean;
33
+ linkify?: any;
34
+ linkStyle?: StyleProp<any>;
35
+ linkText?: string | ((url: string) => string);
36
+ onPress?: (url: string) => void;
37
+ onLongPress?: (url: string, text: string) => void;
38
+ injectViewProps?: (url: string) => any;
39
+ children?: React.ReactNode;
40
+ style?: StyleProp<any>;
41
+ }
42
+ export declare function Hyperlink(props: Props): JSX.Element;
43
+ export {};
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @providesModule Hyperlink
3
+ *
4
+ * Forked from https://github.com/obipawan/react-native-hyperlink
5
+ *
6
+ *
7
+ * MIT License
8
+ *
9
+ * Copyright (c) 2019 Pawan
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ * */
29
+ var __rest = (this && this.__rest) || function (s, e) {
30
+ var t = {};
31
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
32
+ t[p] = s[p];
33
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
34
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
35
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
36
+ t[p[i]] = s[p[i]];
37
+ }
38
+ return t;
39
+ };
40
+ import mdurl from "mdurl";
41
+ import React from "react";
42
+ import { Linking, Platform, Text, View } from "react-native";
43
+ const linkifyLib = require("linkify-it")();
44
+ const { OS } = Platform;
45
+ // Leaving this as a class component because it was easier to handle the `pasrse(this)` in `render()`
46
+ class HyperlinkComponent extends React.Component {
47
+ constructor() {
48
+ super(...arguments);
49
+ this.isTextNested = (component) => {
50
+ if (!React.isValidElement(component))
51
+ throw new Error("Invalid component");
52
+ const { type: { displayName } = {} } = component;
53
+ if (displayName !== "Text")
54
+ throw new Error("Not a Text component");
55
+ return typeof component.props.children !== "string";
56
+ };
57
+ this.linkify = (component) => {
58
+ const linkifyIt = this.props.linkify || linkifyLib;
59
+ if (!linkifyIt.pretest(component.props.children) || !linkifyIt.test(component.props.children))
60
+ return component;
61
+ const elements = [];
62
+ let _lastIndex = 0;
63
+ const componentProps = Object.assign(Object.assign({}, component.props), { ref: undefined, key: undefined });
64
+ try {
65
+ linkifyIt.match(component.props.children).forEach(({ index, lastIndex, text, url }) => {
66
+ const nonLinkedText = component.props.children.substring(_lastIndex, index);
67
+ nonLinkedText && elements.push(nonLinkedText);
68
+ _lastIndex = lastIndex;
69
+ if (this.props.linkText)
70
+ text =
71
+ typeof this.props.linkText === "function"
72
+ ? this.props.linkText(url)
73
+ : this.props.linkText;
74
+ const clickHandlerProps = {};
75
+ if (OS !== "web") {
76
+ if (this.props.onLongPress) {
77
+ clickHandlerProps.onLongPress = () => this.props.onLongPress(url, text);
78
+ }
79
+ }
80
+ if (this.props.onPress) {
81
+ clickHandlerProps.onPress = () => this.props.onPress(url, text);
82
+ }
83
+ let injected = {};
84
+ if (this.props.injectViewProps) {
85
+ injected = this.props.injectViewProps(url);
86
+ }
87
+ elements.push(React.createElement(Text, Object.assign({}, componentProps, clickHandlerProps, { key: url + index, style: [component.props.style, this.props.linkStyle] }, injected), text));
88
+ });
89
+ elements.push(component.props.children.substring(_lastIndex, component.props.children.length));
90
+ return React.cloneElement(component, componentProps, elements);
91
+ }
92
+ catch (err) {
93
+ return component;
94
+ }
95
+ };
96
+ this.parse = (component) => {
97
+ const { props: { children } = {} } = component || {};
98
+ if (!children)
99
+ return component;
100
+ const componentProps = Object.assign(Object.assign({}, component.props), { ref: undefined, key: undefined });
101
+ const linkifyIt = this.props.linkify || linkifyLib;
102
+ return React.cloneElement(component, componentProps, React.Children.map(children, (child) => {
103
+ const { type: { displayName } = {} } = child || {};
104
+ if (typeof child === "string" && linkifyIt.pretest(child))
105
+ return this.linkify(React.createElement(Text, Object.assign({}, componentProps, { style: component.props.style }), child));
106
+ if (displayName === "Text" && !this.isTextNested(child))
107
+ return this.linkify(child);
108
+ return this.parse(child);
109
+ }));
110
+ };
111
+ }
112
+ render() {
113
+ const viewProps = __rest(this.props, []);
114
+ delete viewProps.onPress;
115
+ delete viewProps.linkDefault;
116
+ delete viewProps.onLongPress;
117
+ delete viewProps.linkStyle;
118
+ return (React.createElement(View, Object.assign({}, viewProps, { style: this.props.style }), !this.props.onPress && !this.props.onLongPress && !this.props.linkStyle
119
+ ? this.props.children
120
+ : this.parse(this).props.children));
121
+ }
122
+ }
123
+ export function Hyperlink(props) {
124
+ const handleLink = (url) => {
125
+ const urlObject = mdurl.parse(url);
126
+ urlObject.protocol = urlObject.protocol.toLowerCase();
127
+ const normalizedURL = mdurl.format(urlObject);
128
+ Linking.canOpenURL(normalizedURL).then((supported) => supported && Linking.openURL(normalizedURL));
129
+ };
130
+ const onPress = handleLink || props.onPress;
131
+ if (props.linkDefault)
132
+ return React.createElement(HyperlinkComponent, Object.assign({}, props, { onPress: onPress }));
133
+ return React.createElement(HyperlinkComponent, Object.assign({}, props));
134
+ }
135
+ //# sourceMappingURL=Hyperlink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hyperlink.js","sourceRoot":"","sources":["../src/Hyperlink.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BK;;;;;;;;;;;;AAEL,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAa,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAEtE,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;AAE3C,MAAM,EAAC,EAAE,EAAC,GAAG,QAAQ,CAAC;AActB,qGAAqG;AACrG,MAAM,kBAAmB,SAAQ,KAAK,CAAC,SAAgB;IAAvD;;QACE,iBAAY,GAAG,CAAC,SAAc,EAAE,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAC3E,MAAM,EAAC,IAAI,EAAE,EAAC,WAAW,EAAC,GAAG,EAAS,EAAC,GAAG,SAAS,CAAC;YACpD,IAAI,WAAW,KAAK,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YACpE,OAAO,OAAQ,SAAS,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AAC,KAAK,CAAC,KAAK,KACzC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS;YACtE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;YACrB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAC9B,CACR,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,SAAS,CAAC,KAAY;IACpC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;QACjC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACtD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,IAAI,CACpC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAC3D,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC;IAC5C,IAAI,KAAK,CAAC,WAAW;QAAE,OAAO,oBAAC,kBAAkB,oBAAK,KAAK,IAAE,OAAO,EAAE,OAAO,IAAI,CAAC;IAClF,OAAO,oBAAC,kBAAkB,oBAAK,KAAK,EAAI,CAAC;AAC3C,CAAC"}
package/dist/Mask.d.ts CHANGED
@@ -1,5 +1,3 @@
1
1
  import React from "react";
2
2
  import { MaskProps } from "./Common";
3
- export declare class Mask extends React.Component<MaskProps, {}> {
4
- render(): React.ReactNode;
5
- }
3
+ export declare function Mask(props: MaskProps): React.ReactElement | null;
package/dist/Mask.js CHANGED
@@ -1,22 +1,19 @@
1
1
  import React from "react";
2
- export class Mask extends React.Component {
3
- render() {
4
- // if (this.props.shape === "rounded") {
5
- // return <Box style={{overflow: "hidden", borderRadius: 12}}>{this.props.children}</Box>;
6
- // } else if (this.props.shape === "circle") {
7
- // return <Box style={{overflow: "hidden", borderRadius: 1000}}>{this.props.children}</Box>;
8
- // }
9
- // if (this.props.rounding) {
10
- // let rounding = this.props.rounding === "circle" ? 100 : this.props.rounding;
11
- // // Subtract 1 from rounding because of some very odd rendering.
12
- // return (
13
- // // <View style={{borderRadius: (rounding - 1) * 4, overflow: "visible"}}>
14
- // <View>{this.props.children}</View>
15
- // // </View>
16
- // );
17
- // } else {
18
- return this.props.children;
19
- // }
2
+ import { View } from "react-native";
3
+ export function Mask(props) {
4
+ if (props.shape === "rounded") {
5
+ return React.createElement(View, { style: { overflow: "hidden", borderRadius: 12 } }, props.children);
6
+ }
7
+ else if (props.shape === "circle") {
8
+ return React.createElement(View, { style: { overflow: "hidden", borderRadius: 1000 } }, props.children);
9
+ }
10
+ if (props.rounding) {
11
+ const rounding = props.rounding === "circle" ? 100 : props.rounding;
12
+ // Subtract 1 from rounding because of some very odd rendering.
13
+ return (React.createElement(View, { style: { borderRadius: (rounding - 1) * 4, overflow: "visible" } }, props.children));
14
+ }
15
+ else {
16
+ return props.children || null;
20
17
  }
21
18
  }
22
19
  //# sourceMappingURL=Mask.js.map
package/dist/Mask.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Mask.js","sourceRoot":"","sources":["../src/Mask.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,OAAO,IAAK,SAAQ,KAAK,CAAC,SAAwB;IACtD,MAAM;QACJ,wCAAwC;QACxC,4FAA4F;QAC5F,8CAA8C;QAC9C,8FAA8F;QAC9F,IAAI;QACJ,6BAA6B;QAC7B,iFAAiF;QACjF,oEAAoE;QACpE,aAAa;QACb,gFAAgF;QAChF,2CAA2C;QAC3C,iBAAiB;QACjB,OAAO;QACP,WAAW;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC3B,IAAI;IACN,CAAC;CACF"}
1
+ {"version":3,"file":"Mask.js","sourceRoot":"","sources":["../src/Mask.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAIlC,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE;QAC7B,OAAO,oBAAC,IAAI,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAC,IAAG,KAAK,CAAC,QAAQ,CAAQ,CAAC;KACrF;SAAM,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE;QACnC,OAAO,oBAAC,IAAI,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAC,IAAG,KAAK,CAAC,QAAQ,CAAQ,CAAC;KACvF;IACD,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;QACpE,+DAA+D;QAC/D,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,EAAC,YAAY,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAC,IAAG,KAAK,CAAC,QAAQ,CAAQ,CAC9F,CAAC;KACH;SAAM;QACL,OAAO,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;KAC/B;AACH,CAAC"}
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { FieldWithLabelsProps } from "./Common";
3
3
  export declare type SelectListOptions = {
4
4
  label: string;
5
- value: string | undefined;
5
+ value: string | number;
6
6
  }[];
7
7
  export interface SelectListProps extends FieldWithLabelsProps {
8
8
  id?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectList.js","sourceRoot":"","sources":["../src/SelectList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,cAAc,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAclC,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAA8B;IAApE;;QACE,UAAK,GAAG,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC;IA4B3B,CAAC;IA1BC,MAAM;QACJ,OAAO,CACL,oBAAC,cAAc,IACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EACzB,WAAW,EAAE,EAAE,EACf,KAAK,EAAE;gBACL,aAAa,EAAE;oBACb,aAAa,EAAE,KAAK;oBACpB,cAAc,EAAE,QAAQ;oBACxB,UAAU,EAAE,QAAQ;oBACpB,SAAS,EAAE,EAAE;oBACb,KAAK,EAAE,MAAM;oBACb,oDAAoD;oBACpD,iBAAiB,EAAE,CAAC;oBACpB,eAAe,EAAE,CAAC;oBAClB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;oBAC/B,WAAW,EAAE,CAAC;oBACd,YAAY,EAAE,CAAC;oBACf,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;iBACrC;aACF,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAClC,CACH,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"SelectList.js","sourceRoot":"","sources":["../src/SelectList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,cAAc,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAelC,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAA8B;IAApE;;QACE,UAAK,GAAG,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC;IA4B3B,CAAC;IA1BC,MAAM;QACJ,OAAO,CACL,oBAAC,cAAc,IACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EACzB,WAAW,EAAE,EAAE,EACf,KAAK,EAAE;gBACL,aAAa,EAAE;oBACb,aAAa,EAAE,KAAK;oBACpB,cAAc,EAAE,QAAQ;oBACxB,UAAU,EAAE,QAAQ;oBACpB,SAAS,EAAE,EAAE;oBACb,KAAK,EAAE,MAAM;oBACb,oDAAoD;oBACpD,iBAAiB,EAAE,CAAC;oBACpB,eAAe,EAAE,CAAC;oBAClB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;oBAC/B,WAAW,EAAE,CAAC;oBACd,YAAY,EAAE,CAAC;oBACf,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;iBACrC;aACF,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAClC,CACH,CAAC;IACJ,CAAC;CACF"}
package/dist/Text.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { Text as NativeText } from "react-native";
3
- import Hyperlink from "react-native-hyperlink";
3
+ import { Hyperlink } from "./Hyperlink";
4
4
  import { Unifier } from "./Unifier";
5
5
  export class Text extends React.Component {
6
6
  constructor() {
@@ -74,11 +74,7 @@ export class Text extends React.Component {
74
74
  return inner;
75
75
  }
76
76
  else {
77
- return (
78
- // <Hyperlink linkDefault={true} linkStyle={{textDecorationLine: "underline"}}>
79
- // {inner}
80
- // </Hyperlink>
81
- React.createElement(Hyperlink, { linkDefault: true }, inner));
77
+ return (React.createElement(Hyperlink, { linkDefault: true, linkStyle: { textDecorationLine: "underline" } }, inner));
82
78
  }
83
79
  }
84
80
  }
package/dist/Text.js.map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QAAQ,CACT,CACd,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAC1B,OAAO,KAAK,CAAC;SACd;aAAM;YACL,OAAO,CACL,oBAAC,SAAS,IAAC,WAAW,QAAC,SAAS,EAAE,EAAC,kBAAkB,EAAE,WAAW,EAAC,IAChE,KAAK,CACI,CACb,CAAC;SACH;IACH,CAAC;CACF"}
package/dist/Unifier.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  /* eslint-disable @typescript-eslint/no-empty-function */
3
3
  import AsyncStorage from "@react-native-async-storage/async-storage";
4
- import { Clipboard, Dimensions, Keyboard, Linking, Vibration } from "react-native";
4
+ import { Clipboard, Dimensions, Keyboard, Linking, Platform, Vibration } from "react-native";
5
5
  import ReactNativeHapticFeedback from "react-native-haptic-feedback";
6
6
  import { requestPermissions } from "./Permissions";
7
7
  const DEFAULT_FONT = "Cochin";
@@ -121,7 +121,9 @@ class UnifierClass {
121
121
  enableVibrateFallback: true,
122
122
  ignoreAndroidSystemSettings: false,
123
123
  };
124
- ReactNativeHapticFeedback.trigger("impactLight", options);
124
+ if (Platform.OS !== "web") {
125
+ ReactNativeHapticFeedback.trigger("impactLight", options);
126
+ }
125
127
  },
126
128
  openUrl: async (url) => {
127
129
  return Linking.openURL(url);
@@ -1 +1 @@
1
- {"version":3,"file":"Unifier.js","sourceRoot":"","sources":["../src/Unifier.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yDAAyD;AAEzD,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACjF,OAAO,yBAAyB,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,iBAAi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AI,YAAY,CAAC,UAAU,EAC1F,cAAc,EACZ,QAAA,IAAI,CAAC,MAAM,4CAAE,cAAc,aAAI,IAAI,CAAC,MAAM,4CAAE,WAAW,CAAA,IAAI,YAAY,CAAC,cAAc,EACxF,SAAS,EAAE,QAAA,IAAI,CAAC,MAAM,4CAAE,SAAS,aAAI,IAAI,CAAC,MAAM,4CAAE,WAAW,CAAA,IAAI,YAAY,CAAC,SAAS,IACvF;IACJ,CAAC;CA0GF;AAED,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAEzD,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./Common";
2
+ export * from "./Avatar";
2
3
  export * from "./Banner";
3
4
  export * from "./BlurBox";
4
5
  export * from "./Body";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./Common";
2
+ export * from "./Avatar";
2
3
  export * from "./Banner";
3
4
  export * from "./BlurBox";
4
5
  export * from "./Body";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,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C;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,4BAA4B;AAC5B,4BAA4B;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,2BAA2B;AAE3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,2BAA2B;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ferns-ui",
3
- "version": "0.2.3",
3
+ "version": "0.4.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
@@ -122,22 +122,24 @@
122
122
  "@expo/vector-icons": "^13.0.0",
123
123
  "@react-native-async-storage/async-storage": "^1.17.4",
124
124
  "@react-native-community/blur": "^3.6.0",
125
- "@react-native-community/datetimepicker": "^6.1.3",
125
+ "@react-native-community/datetimepicker": "^5.1.0",
126
126
  "@react-native-picker/picker": "^2.2.1",
127
127
  "@sentry/browser": "^6.19.7",
128
128
  "@sentry/react": "^6.19.7",
129
129
  "@sentry/react-native": "^3.4.2",
130
130
  "@types/lodash": "^4.14.182",
131
+ "@types/mdurl": "^1.0.2",
131
132
  "@types/react-native": "^0.67.7",
132
133
  "@typescript-eslint/eslint-plugin": "^5.23.0",
133
134
  "@typescript-eslint/parser": "^5.23.0",
134
135
  "eslint": "^8.15.0",
135
- "eslint-config-ferns": "^0.3.1",
136
+ "eslint-config-ferns": "^0.3.2",
136
137
  "eslint-config-prettier": "^8.5.0",
137
138
  "eslint-plugin-import": "^2.26.0",
138
139
  "eslint-plugin-lodash": "^7.1.0",
139
140
  "eslint-plugin-prettier": "^4.0.0",
140
141
  "eslint-plugin-react": "^7.29.4",
142
+ "eslint-plugin-react-hooks": "^4.5.0",
141
143
  "eslint-plugin-react-native": "^4.0.0",
142
144
  "eslint-plugin-simple-import-sort": "^7.0.0",
143
145
  "expo-font": "^10.1.0",
@@ -153,7 +155,6 @@
153
155
  "react-native": "^0.64.3",
154
156
  "react-native-gesture-handler": "^1.6.1",
155
157
  "react-native-haptic-feedback": "^1.10.0",
156
- "react-native-hyperlink": "^0.0.19",
157
158
  "react-native-modalize": "^2.0.12",
158
159
  "react-native-navigation": "^6.12.0",
159
160
  "react-native-permissions": "^3.1.0",
@@ -185,7 +186,6 @@
185
186
  "react-native": "^0.64.3",
186
187
  "react-native-gesture-handler": "^1.6.1",
187
188
  "react-native-haptic-feedback": "^1.10.0",
188
- "react-native-hyperlink": "^0.0.19",
189
189
  "react-native-modalize": "^2.0.12",
190
190
  "react-native-navigation": "^6.12.0",
191
191
  "react-native-permissions": "^3.1.0",
package/src/Avatar.tsx ADDED
@@ -0,0 +1,98 @@
1
+ import React, {useState} from "react";
2
+ import {Image, Text, View} from "react-native";
3
+
4
+ import {Box} from "./Box";
5
+ import {Unifier} from "./Unifier";
6
+
7
+ const sizes = {
8
+ xs: 24,
9
+ sm: 32,
10
+ md: 48,
11
+ lg: 64,
12
+ xl: 120,
13
+ };
14
+
15
+ interface AvatarProps {
16
+ /**
17
+ * The name of the user. This is used for the placeholder treatment if an image is not available.
18
+ */
19
+ name: string;
20
+ /**
21
+ * Override the generated initials from `name`.
22
+ */
23
+ initials?: string;
24
+ /**
25
+ * Adds a white border around Avatar so it's visible when displayed on other images.
26
+ */
27
+ outline?: boolean;
28
+ /**
29
+ * xs: 24px, sm: 32px, md: 48px, lg: 64px, xl: 120px.
30
+ */
31
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
32
+ /**
33
+ * The URL of the user's image.
34
+ */
35
+ src?: string;
36
+ }
37
+
38
+ export const Avatar = (props: AvatarProps): React.ReactElement => {
39
+ const [isImageLoaded, setIsImageLoaded] = useState(true);
40
+ const {name, initials, outline, size = "md", src} = props;
41
+ const width = sizes[size];
42
+ const height = sizes[size];
43
+ const radius = sizes[size] / 2;
44
+ const fontSize = sizes[size] / 2;
45
+ const computedInitials =
46
+ initials ??
47
+ (name.match(/(^\S\S?|\s\S)?/g) as any)
48
+ .map((v: string) => v.trim())
49
+ .join("")
50
+ .match(/(^\S|\S$)?/g)
51
+ .join("")
52
+ .toLocaleUpperCase();
53
+
54
+ const handleImageError = () => setIsImageLoaded(false);
55
+ return (
56
+ <Box
57
+ border={outline ? "white" : undefined}
58
+ height={height}
59
+ overflow="hidden"
60
+ position="relative"
61
+ rounding="circle"
62
+ width={width}
63
+ >
64
+ {src && isImageLoaded ? (
65
+ // TODO: Make our Image component rounding work so that we can use it for Avatar. Currently it creates an
66
+ // unrounded box around the Image.
67
+ <Image
68
+ resizeMode="contain"
69
+ source={{uri: src, cache: "force-cache"}}
70
+ style={{
71
+ borderRadius: radius,
72
+ height,
73
+ width,
74
+ display: "flex",
75
+ alignItems: "center",
76
+ justifyContent: "center",
77
+ overflow: "hidden",
78
+ }}
79
+ onError={handleImageError}
80
+ />
81
+ ) : (
82
+ <View
83
+ style={{
84
+ height,
85
+ width,
86
+ borderRadius: radius,
87
+ display: "flex",
88
+ alignItems: "center",
89
+ justifyContent: "center",
90
+ backgroundColor: Unifier.theme.gray,
91
+ }}
92
+ >
93
+ <Text style={{fontSize, color: Unifier.theme.darkGray}}>{computedInitials}</Text>
94
+ </View>
95
+ )}
96
+ </Box>
97
+ );
98
+ };
package/src/Common.ts CHANGED
@@ -776,7 +776,7 @@ export interface SpinnerProps {
776
776
  }
777
777
 
778
778
  export interface MaskProps {
779
- children?: React.ReactNode;
779
+ children?: React.ReactElement;
780
780
  shape?: "circle" | "rounded" | "square";
781
781
  height?: number | string;
782
782
  width?: number | string;
package/src/Form.tsx CHANGED
@@ -21,7 +21,7 @@ interface FormLineProps {
21
21
  value: any;
22
22
  onSave: (value: any) => void;
23
23
  kind: "boolean" | "string" | "textarea" | "select" | "multiboolean";
24
- options?: (string | undefined)[];
24
+ options?: string[];
25
25
  }
26
26
 
27
27
  interface FormLineState {
@@ -0,0 +1,181 @@
1
+ /**
2
+ * @providesModule Hyperlink
3
+ *
4
+ * Forked from https://github.com/obipawan/react-native-hyperlink
5
+ *
6
+ *
7
+ * MIT License
8
+ *
9
+ * Copyright (c) 2019 Pawan
10
+ *
11
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ * of this software and associated documentation files (the "Software"), to deal
13
+ * in the Software without restriction, including without limitation the rights
14
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ * copies of the Software, and to permit persons to whom the Software is
16
+ * furnished to do so, subject to the following conditions:
17
+ *
18
+ * The above copyright notice and this permission notice shall be included in all
19
+ * copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ * */
29
+
30
+ import mdurl from "mdurl";
31
+ import React from "react";
32
+ import {Linking, Platform, StyleProp, Text, View} from "react-native";
33
+
34
+ const linkifyLib = require("linkify-it")();
35
+
36
+ const {OS} = Platform;
37
+
38
+ interface Props {
39
+ linkDefault?: boolean;
40
+ linkify?: any;
41
+ linkStyle?: StyleProp<any>;
42
+ linkText?: string | ((url: string) => string);
43
+ onPress?: (url: string) => void;
44
+ onLongPress?: (url: string, text: string) => void;
45
+ injectViewProps?: (url: string) => any;
46
+ children?: React.ReactNode;
47
+ style?: StyleProp<any>;
48
+ }
49
+
50
+ // Leaving this as a class component because it was easier to handle the `pasrse(this)` in `render()`
51
+ class HyperlinkComponent extends React.Component<Props> {
52
+ isTextNested = (component: any) => {
53
+ if (!React.isValidElement(component)) throw new Error("Invalid component");
54
+ const {type: {displayName} = {} as any} = component;
55
+ if (displayName !== "Text") throw new Error("Not a Text component");
56
+ return typeof (component.props as any).children !== "string";
57
+ };
58
+
59
+ linkify = (component: any) => {
60
+ const linkifyIt = this.props.linkify || linkifyLib;
61
+
62
+ if (!linkifyIt.pretest(component.props.children) || !linkifyIt.test(component.props.children))
63
+ return component;
64
+
65
+ const elements = [];
66
+ let _lastIndex = 0;
67
+
68
+ const componentProps = {
69
+ ...component.props,
70
+ ref: undefined,
71
+ key: undefined,
72
+ };
73
+
74
+ try {
75
+ linkifyIt.match(component.props.children).forEach(({index, lastIndex, text, url}: any) => {
76
+ const nonLinkedText = component.props.children.substring(_lastIndex, index);
77
+ nonLinkedText && elements.push(nonLinkedText);
78
+ _lastIndex = lastIndex;
79
+ if (this.props.linkText)
80
+ text =
81
+ typeof this.props.linkText === "function"
82
+ ? this.props.linkText(url)
83
+ : this.props.linkText;
84
+
85
+ const clickHandlerProps: any = {};
86
+ if (OS !== "web") {
87
+ if (this.props.onLongPress) {
88
+ clickHandlerProps.onLongPress = () => (this.props as any).onLongPress(url, text);
89
+ }
90
+ }
91
+ if (this.props.onPress) {
92
+ clickHandlerProps.onPress = () => (this.props as any).onPress(url, text);
93
+ }
94
+
95
+ let injected: any = {};
96
+ if (this.props.injectViewProps) {
97
+ injected = this.props.injectViewProps(url);
98
+ }
99
+
100
+ elements.push(
101
+ <Text
102
+ {...componentProps}
103
+ {...clickHandlerProps}
104
+ key={url + index}
105
+ style={[component.props.style, this.props.linkStyle]}
106
+ {...injected}
107
+ >
108
+ {text}
109
+ </Text>
110
+ );
111
+ });
112
+ elements.push(
113
+ component.props.children.substring(_lastIndex, component.props.children.length)
114
+ );
115
+ return React.cloneElement(component, componentProps, elements);
116
+ } catch (err) {
117
+ return component;
118
+ }
119
+ };
120
+
121
+ parse = (component: any): React.ReactElement => {
122
+ const {props: {children} = {} as any} = component || {};
123
+ if (!children) return component;
124
+
125
+ const componentProps = {
126
+ ...component.props,
127
+ ref: undefined,
128
+ key: undefined,
129
+ };
130
+
131
+ const linkifyIt = this.props.linkify || linkifyLib;
132
+
133
+ return React.cloneElement(
134
+ component,
135
+ componentProps,
136
+ React.Children.map(children, (child) => {
137
+ const {type: {displayName} = {} as any} = child || {};
138
+ if (typeof child === "string" && linkifyIt.pretest(child))
139
+ return this.linkify(
140
+ <Text {...componentProps} style={component.props.style}>
141
+ {child}
142
+ </Text>
143
+ );
144
+ if (displayName === "Text" && !this.isTextNested(child)) return this.linkify(child);
145
+ return this.parse(child);
146
+ })
147
+ );
148
+ };
149
+
150
+ render() {
151
+ const {...viewProps} = this.props;
152
+ delete viewProps.onPress;
153
+ delete viewProps.linkDefault;
154
+ delete viewProps.onLongPress;
155
+ delete viewProps.linkStyle;
156
+
157
+ return (
158
+ <View {...viewProps} style={this.props.style}>
159
+ {!this.props.onPress && !this.props.onLongPress && !this.props.linkStyle
160
+ ? this.props.children
161
+ : this.parse(this).props.children}
162
+ </View>
163
+ );
164
+ }
165
+ }
166
+
167
+ export function Hyperlink(props: Props) {
168
+ const handleLink = (url: string) => {
169
+ const urlObject = mdurl.parse(url);
170
+ urlObject.protocol = urlObject.protocol.toLowerCase();
171
+ const normalizedURL = mdurl.format(urlObject);
172
+
173
+ Linking.canOpenURL(normalizedURL).then(
174
+ (supported) => supported && Linking.openURL(normalizedURL)
175
+ );
176
+ };
177
+
178
+ const onPress = handleLink || props.onPress;
179
+ if (props.linkDefault) return <HyperlinkComponent {...props} onPress={onPress} />;
180
+ return <HyperlinkComponent {...props} />;
181
+ }
package/src/Mask.tsx CHANGED
@@ -1,24 +1,21 @@
1
1
  import React from "react";
2
+ import {View} from "react-native";
2
3
 
3
4
  import {MaskProps} from "./Common";
4
5
 
5
- export class Mask extends React.Component<MaskProps, {}> {
6
- render() {
7
- // if (this.props.shape === "rounded") {
8
- // return <Box style={{overflow: "hidden", borderRadius: 12}}>{this.props.children}</Box>;
9
- // } else if (this.props.shape === "circle") {
10
- // return <Box style={{overflow: "hidden", borderRadius: 1000}}>{this.props.children}</Box>;
11
- // }
12
- // if (this.props.rounding) {
13
- // let rounding = this.props.rounding === "circle" ? 100 : this.props.rounding;
14
- // // Subtract 1 from rounding because of some very odd rendering.
15
- // return (
16
- // // <View style={{borderRadius: (rounding - 1) * 4, overflow: "visible"}}>
17
- // <View>{this.props.children}</View>
18
- // // </View>
19
- // );
20
- // } else {
21
- return this.props.children;
22
- // }
6
+ export function Mask(props: MaskProps): React.ReactElement | null {
7
+ if (props.shape === "rounded") {
8
+ return <View style={{overflow: "hidden", borderRadius: 12}}>{props.children}</View>;
9
+ } else if (props.shape === "circle") {
10
+ return <View style={{overflow: "hidden", borderRadius: 1000}}>{props.children}</View>;
11
+ }
12
+ if (props.rounding) {
13
+ const rounding = props.rounding === "circle" ? 100 : props.rounding;
14
+ // Subtract 1 from rounding because of some very odd rendering.
15
+ return (
16
+ <View style={{borderRadius: (rounding - 1) * 4, overflow: "visible"}}>{props.children}</View>
17
+ );
18
+ } else {
19
+ return props.children || null;
23
20
  }
24
21
  }
@@ -4,7 +4,8 @@ import {FieldWithLabelsProps} from "./Common";
4
4
  import RNPickerSelect from "./PickerSelect";
5
5
  import {Unifier} from "./Unifier";
6
6
 
7
- export type SelectListOptions = {label: string; value: string | undefined}[];
7
+ // Use "" if you want to have an "unset" value.
8
+ export type SelectListOptions = {label: string; value: string | number}[];
8
9
  export interface SelectListProps extends FieldWithLabelsProps {
9
10
  id?: string;
10
11
  name?: string;
package/src/Text.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import {Text as NativeText} from "react-native";
3
- import Hyperlink from "react-native-hyperlink";
4
3
 
5
4
  import {TextProps} from "./Common";
5
+ import {Hyperlink} from "./Hyperlink";
6
6
  import {Unifier} from "./Unifier";
7
7
 
8
8
  export class Text extends React.Component<TextProps, {}> {
@@ -82,10 +82,9 @@ export class Text extends React.Component<TextProps, {}> {
82
82
  return inner;
83
83
  } else {
84
84
  return (
85
- // <Hyperlink linkDefault={true} linkStyle={{textDecorationLine: "underline"}}>
86
- // {inner}
87
- // </Hyperlink>
88
- <Hyperlink linkDefault>{inner}</Hyperlink>
85
+ <Hyperlink linkDefault linkStyle={{textDecorationLine: "underline"}}>
86
+ {inner}
87
+ </Hyperlink>
89
88
  );
90
89
  }
91
90
  }
package/src/Unifier.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable @typescript-eslint/no-empty-function */
3
3
 
4
4
  import AsyncStorage from "@react-native-async-storage/async-storage";
5
- import {Clipboard, Dimensions, Keyboard, Linking, Vibration} from "react-native";
5
+ import {Clipboard, Dimensions, Keyboard, Linking, Platform, Vibration} from "react-native";
6
6
  import ReactNativeHapticFeedback from "react-native-haptic-feedback";
7
7
 
8
8
  import {PermissionKind, UnifiedTheme} from "./Common";
@@ -206,7 +206,9 @@ class UnifierClass {
206
206
  enableVibrateFallback: true,
207
207
  ignoreAndroidSystemSettings: false,
208
208
  };
209
- ReactNativeHapticFeedback.trigger("impactLight", options);
209
+ if (Platform.OS !== "web") {
210
+ ReactNativeHapticFeedback.trigger("impactLight", options);
211
+ }
210
212
  },
211
213
  openUrl: async (url: string) => {
212
214
  return Linking.openURL(url);
package/src/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./Common";
2
+ export * from "./Avatar";
2
3
  export * from "./Banner";
3
4
  export * from "./BlurBox";
4
5
  export * from "./Body";