@artsy/palette-mobile 10.0.2 → 10.0.3

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,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  /// <reference types="react" />
2
3
  import { EventEmitter } from "events";
3
4
  import { TextInput, TextInputProps, TextStyle } from "react-native";
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare const LinkText: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("./Text").TextProps & import("react").RefAttributes<import("react-native").Text>>, any, {}, never>;
2
+ import { TextProps } from "./Text";
3
+ export declare const LinkText: ({ style, ...props }: TextProps) => JSX.Element;
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.LinkText = void 0;
7
- const native_1 = __importDefault(require("styled-components/native"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
5
  const Text_1 = require("./Text");
9
- exports.LinkText = (0, native_1.default)(Text_1.Text) `
10
- text-decoration-line: underline;
11
- `;
6
+ const LinkText = ({ style, ...props }) => ((0, jsx_runtime_1.jsx)(Text_1.Text, { ...props, style: [style, { textDecorationLine: "underline" }] }));
7
+ exports.LinkText = LinkText;
@@ -10,6 +10,7 @@ export interface TextProps extends RNTextProps, InnerStyledTextProps {
10
10
  weight?: "regular" | "medium";
11
11
  maxChars?: number;
12
12
  underline?: boolean;
13
+ maxWidth?: boolean;
13
14
  }
14
15
  export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<RNText>>;
15
16
  type InnerStyledTextProps = ColorProps & SpaceProps & TypographyProps & FontSizeProps;
@@ -11,7 +11,7 @@ const native_1 = __importDefault(require("styled-components/native"));
11
11
  const styled_system_1 = require("styled-system");
12
12
  const __1 = require("../..");
13
13
  const helpers_1 = require("./helpers");
14
- exports.Text = (0, react_1.forwardRef)(({ variant = "sm", italic = false, color = "onBackgroundHigh", caps, weight = "regular", underline = false, style, children, ...restProps }, ref) => {
14
+ exports.Text = (0, react_1.forwardRef)(({ variant = "sm", italic = false, color = "onBackgroundHigh", caps, weight = "regular", underline = false, maxWidth, style, children, ...restProps }, ref) => {
15
15
  const { theme } = (0, __1.useTheme)();
16
16
  const fontFamily = (0, helpers_1.useFontFamilyFor)({ italic, weight });
17
17
  const nativeTextStyle = [caps ? { textTransform: "uppercase" } : {}];
@@ -19,6 +19,7 @@ exports.Text = (0, react_1.forwardRef)(({ variant = "sm", italic = false, color
19
19
  ...nativeTextStyle,
20
20
  { textAlignVertical: "center" },
21
21
  { textDecorationLine: !!underline ? "underline" : "none" },
22
+ !!maxWidth ? { width: "100%", maxWidth: 600, alignSelf: "center" } : {},
22
23
  style, // keep last so we can override
23
24
  ], fontFamily: fontFamily, ...fixTextTreatmentForStyledComponent(theme.textTreatments[variant]), children: children, color: color, ...restProps }));
24
25
  });
@@ -0,0 +1,11 @@
1
+ import { ComponentMeta, ComponentStory } from "@storybook/react-native";
2
+ import { Text } from ".";
3
+ declare const TextMeta: ComponentMeta<typeof Text>;
4
+ export default TextMeta;
5
+ type TextStory = ComponentStory<typeof Text>;
6
+ export declare const Variants: TextStory;
7
+ export declare const VariantsInBoxes: TextStory;
8
+ export declare const BasicProps: TextStory;
9
+ export declare const Misc: TextStory;
10
+ export declare const FontCenteringRaw: TextStory;
11
+ export declare const FontCenteringPalette: TextStory;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FontCenteringPalette = exports.FontCenteringRaw = exports.Misc = exports.BasicProps = exports.VariantsInBoxes = exports.Variants = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_1 = require("react-native");
6
+ const _1 = require(".");
7
+ const helpers_1 = require("../../storybook/helpers");
8
+ const Box_1 = require("../Box");
9
+ const Flex_1 = require("../Flex");
10
+ const TextMeta = {
11
+ title: "Theme/Text",
12
+ component: _1.Text,
13
+ };
14
+ exports.default = TextMeta;
15
+ const variants = ["xs", "sm", "md", "lg", "xl", "xxl"];
16
+ const Variants = () => ((0, jsx_runtime_1.jsx)(helpers_1.DataList, { data: variants, renderItem: ({ item: variant }) => (0, jsx_runtime_1.jsxs)(_1.Text, { variant: variant, children: [variant, " ~~ This is a text."] }) }));
17
+ exports.Variants = Variants;
18
+ const VariantsInBoxes = () => ((0, jsx_runtime_1.jsx)(helpers_1.DataList, { data: variants, renderItem: ({ item: variant }) => ((0, jsx_runtime_1.jsx)(Box_1.Box, { borderWidth: 1, borderColor: "black", width: 100, children: (0, jsx_runtime_1.jsxs)(_1.Text, { variant: variant, children: [variant, " ~~ This is a text."] }) })) }));
19
+ exports.VariantsInBoxes = VariantsInBoxes;
20
+ const BasicProps = () => ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(_1.Text, { children: "regular ~~ This is a text." }), (0, jsx_runtime_1.jsx)(_1.LinkText, { children: "LinkText." }), (0, jsx_runtime_1.jsx)(_1.Text, { caps: true, children: "caps ~~ This is a text." }), (0, jsx_runtime_1.jsx)(_1.Text, { italic: true, children: "italics ~~ This is a text." }), (0, jsx_runtime_1.jsx)(_1.Text, { caps: true, italic: true, children: "caps italics ~~ This is a text." }), (0, jsx_runtime_1.jsx)(_1.Text, { weight: "medium", children: "weight: medium ~~ This is a text." }), (0, jsx_runtime_1.jsx)(_1.Text, { maxWidth: true, children: "maxwidth ~~ This is a text." })] }));
21
+ exports.BasicProps = BasicProps;
22
+ const Misc = () => ((0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: { borderWidth: 1, borderColor: "black" }, children: (0, jsx_runtime_1.jsx)(_1.Text, { pl: 2, mb: 4, mr: 80, color: "red", backgroundColor: "orange", children: "Testing the other props" }) }), (0, jsx_runtime_1.jsx)(react_native_1.View, {})] }));
23
+ exports.Misc = Misc;
24
+ // this is useful for making sure our custom fonts are rendering at the same height for ios and android
25
+ const FontCenteringRaw = () => {
26
+ const style = { borderWidth: 1, borderColor: "black", fontSize: 16, lineHeight: 16 };
27
+ const systemFontStyle = react_native_1.Platform.OS === "android" ? { textAlignVertical: "bottom" } : {}; // this we add in our Text in palette-eigen
28
+ const unicaFontStyle = react_native_1.Platform.OS === "android" ? { textAlignVertical: "center" } : {}; // this we add in our Text in palette-eigen
29
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flexDirection: "row", flex: 1, children: [(0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { children: "System font" }), (0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, systemFontStyle], children: "regular TEXT." }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, systemFontStyle], children: "ALL CAPS text." })] })] }), (0, jsx_runtime_1.jsx)(Flex_1.Flex, { width: "1px", height: "100%", borderWidth: 1, borderColor: "black" }), (0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { children: "Unica custom font" }), (0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, { fontFamily: "Unica77LL-Regular" }, unicaFontStyle], children: "regular TEXT." }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [style, { fontFamily: "Unica77LL-Regular" }, unicaFontStyle], children: "ALL CAPS text." })] })] })] }));
30
+ };
31
+ exports.FontCenteringRaw = FontCenteringRaw;
32
+ // this is useful for making sure our custom fonts are rendering at the same height for ios and android
33
+ const FontCenteringPalette = () => {
34
+ const style = { borderWidth: 1, borderColor: "black", fontSize: 16, lineHeight: 16 };
35
+ return ((0, jsx_runtime_1.jsxs)(Flex_1.Flex, { flex: 1, children: [(0, jsx_runtime_1.jsx)(_1.Text, { children: "System font" }), (0, jsx_runtime_1.jsxs)(helpers_1.List, { children: [(0, jsx_runtime_1.jsx)(_1.Text, { style: style, children: "regular TEXT." }), (0, jsx_runtime_1.jsx)(_1.Text, { style: style, children: "ALL CAPS text." })] })] }));
36
+ };
37
+ exports.FontCenteringPalette = FontCenteringPalette;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const text_1 = require("../../utils/text");
4
+ describe("Text", () => {
5
+ it("uses endash in ranges", () => {
6
+ const usingHelper = (0, text_1.range)("10", "20");
7
+ const usingEndash = `10 ${text_1.endash} 20`;
8
+ expect(usingHelper).toEqual(usingEndash);
9
+ expect(usingHelper).toEqual("10 – 20"); // endash
10
+ expect(usingHelper).not.toEqual("10 - 20"); // minus
11
+ });
12
+ });
package/dist/svgs/Icon.js CHANGED
@@ -7,7 +7,7 @@ exports.RadialGradient = exports.Stop = exports.LinearGradient = exports.Defs =
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_native_1 = require("react-native");
9
9
  const react_native_svg_1 = __importDefault(require("react-native-svg"));
10
- const styled_components_1 = __importDefault(require("styled-components"));
10
+ const native_1 = __importDefault(require("styled-components/native"));
11
11
  const styled_system_1 = require("styled-system");
12
12
  const DEFAULT_SIZE = 18;
13
13
  /**
@@ -22,7 +22,7 @@ const ScaledSvg = ({ width = DEFAULT_SIZE, height = DEFAULT_SIZE, ...restProps }
22
22
  return (0, jsx_runtime_1.jsx)(react_native_svg_1.default, { width: scaledWidth, height: scaledHeight, ...restProps });
23
23
  };
24
24
  /** Wrapper for icons to include space */
25
- exports.Icon = (0, styled_components_1.default)(ScaledSvg) `
25
+ exports.Icon = (0, native_1.default)(ScaledSvg) `
26
26
  position: relative;
27
27
 
28
28
  ${styled_system_1.space};
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useTheme = void 0;
4
4
  const react_1 = require("react");
5
- const styled_components_1 = require("styled-components");
5
+ const native_1 = require("styled-components/native");
6
6
  const tokens_1 = require("../../tokens");
7
7
  const useTheme = () => {
8
- const maybeTheme = (0, react_1.useContext)(styled_components_1.ThemeContext);
8
+ const maybeTheme = (0, react_1.useContext)(native_1.ThemeContext);
9
9
  // if we are not wrapped in `<Theme>`, if we dev, throw error.
10
10
  // if we are in prod, we will default to v2 to avoid a crash.
11
11
  // if we are wrapped, then all good.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "10.0.2",
3
+ "version": "10.0.3",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",