@jobber/components-native 0.76.1-JOB-116234-d279b0f.20 → 0.76.1-JOB-116234-63c4467.27

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.
Files changed (41) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/AtlantisThemeContext/AtlantisThemeContext.js +10 -21
  3. package/dist/src/Flex/Flex.js +2 -3
  4. package/dist/src/Flex/Flex.styles.js +9 -0
  5. package/dist/src/InputFieldWrapper/CommonInputStyles.style.js +6 -2
  6. package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +2 -1
  7. package/dist/src/InputPressable/InputPressable.style.js +6 -5
  8. package/dist/src/InputText/InputText.style.js +6 -6
  9. package/dist/src/Typography/Typography.js +12 -11
  10. package/dist/src/Typography/Typography.style.js +1 -8
  11. package/dist/src/utils/design/index.js +5 -2
  12. package/dist/src/utils/meta/meta.json +1 -0
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/types/src/AtlantisThemeContext/types.d.ts +6 -3
  15. package/dist/types/src/Button/Button.d.ts +1 -1
  16. package/dist/types/src/Flex/Flex.styles.d.ts +1 -0
  17. package/dist/types/src/Text/Text.d.ts +1 -1
  18. package/dist/types/src/Typography/Typography.style.d.ts +1 -8
  19. package/dist/types/src/utils/design/index.d.ts +5 -0
  20. package/package.json +2 -2
  21. package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +106 -0
  22. package/src/AtlantisThemeContext/AtlantisThemeContext.tsx +12 -54
  23. package/src/AtlantisThemeContext/buildThemedStyles.test.tsx +83 -0
  24. package/src/AtlantisThemeContext/types.ts +7 -3
  25. package/src/Button/Button.tsx +1 -1
  26. package/src/Flex/Flex.styles.tsx +13 -1
  27. package/src/Flex/Flex.tsx +2 -3
  28. package/src/InputFieldWrapper/CommonInputStyles.style.ts +2 -0
  29. package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +1 -6
  30. package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +9 -2
  31. package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +2 -1
  32. package/src/InputPressable/InputPressable.style.ts +7 -5
  33. package/src/InputText/InputText.style.ts +7 -6
  34. package/src/Text/Text.tsx +1 -1
  35. package/src/Typography/Typography.style.ts +1 -8
  36. package/src/Typography/Typography.tsx +19 -8
  37. package/src/utils/design/index.ts +5 -2
  38. package/src/utils/meta/meta.json +1 -0
  39. package/dist/src/Flex/Flex.gap.styles.js +0 -9
  40. package/dist/types/src/Flex/Flex.gap.styles.d.ts +0 -2
  41. package/src/Flex/Flex.gap.styles.tsx +0 -14
@@ -1,16 +1,19 @@
1
1
  import { iosTokens } from "@jobber/design";
2
- import { PropsWithChildren } from "react";
3
2
  export interface AtlantisThemeContextValue {
4
3
  /**
5
- * The theme of the application.
4
+ * The active theme.
6
5
  */
7
6
  readonly theme: Theme;
8
7
  /**
9
8
  * The design tokens for the current theme.
10
9
  */
11
10
  readonly tokens: typeof iosTokens;
11
+ /**
12
+ * Change the current theme globally.
13
+ */
14
+ readonly setTheme: (theme: Theme) => void;
12
15
  }
13
- export interface AtlantisThemeContextProviderProps extends PropsWithChildren {
16
+ export interface AtlantisThemeContextProviderProps {
14
17
  /**
15
18
  * The children to render.
16
19
  */
@@ -62,7 +62,7 @@ interface CommonButtonProps {
62
62
  /**
63
63
  * **Use at your own risk:** Custom style for specific elements. This should only be used as a
64
64
  * **last resort**. Using this may result in unexpected side effects.
65
- * More information [here](https://atlantis.getjobber.com/storybook/?path=/docs/guides-customizing-components--docs#unsafe_-props).
65
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
66
66
  */
67
67
  readonly UNSAFE_style?: ButtonUnsafeStyle;
68
68
  }
@@ -6,3 +6,4 @@ export declare const styles: {
6
6
  };
7
7
  };
8
8
  export declare const columnStyles: Record<ColumnKeys, ViewStyle>;
9
+ export declare const gapStyles: Record<"small" | "base" | "none" | "smallest" | "smaller" | "large", ViewStyle>;
@@ -63,7 +63,7 @@ export interface TextProps extends Pick<TypographyProps<"base">, "maxFontScaleSi
63
63
  /**
64
64
  * **Use at your own risk:** Custom style for specific elements. This should only be used as a
65
65
  * **last resort**. Using this may result in unexpected side effects.
66
- * More information [here](https://atlantis.getjobber.com/storybook/?path=/docs/guides-customizing-components--docs#unsafe_-props).
66
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
67
67
  */
68
68
  readonly UNSAFE_style?: TypographyUnsafeStyle;
69
69
  }
@@ -8,14 +8,7 @@ export declare const createTypographyTokens: (tokens: AtlantisThemeContextValue[
8
8
  [index: string]: TextStyle;
9
9
  };
10
10
  /**
11
- * `StyleSheet` for Typography.tsx.
12
- *
13
- * If you find yourself needing to use what's inside this object on files other
14
- * than `<Typography />`, please import from `@jobber/components-native` instead.
15
- *
16
- * ```
17
- * import { typographyStyles } from "@jobber/components-native"
18
- * ```
11
+ * @deprecated Use useTypographyStyles instead
19
12
  */
20
13
  export declare const typographyStyles: Record<string, TextStyle>;
21
14
  export declare const useTypographyStyles: () => {
@@ -1,2 +1,7 @@
1
1
  import { iosTokens } from "@jobber/design";
2
+ /**
3
+ * These design tokens don't react to theme changes. Only use these if you need to access
4
+ * tokens that are not affected by the current theme, otherwise you should be using our
5
+ * useAtlantisTheme() hook to access the current theme's tokens.
6
+ */
2
7
  export declare const tokens: typeof iosTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.76.1-JOB-116234-d279b0f.20+d279b0fd",
3
+ "version": "0.76.1-JOB-116234-63c4467.27+63c44675",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -80,5 +80,5 @@
80
80
  "react-native-safe-area-context": "^4.5.2",
81
81
  "react-native-svg": ">=12.0.0"
82
82
  },
83
- "gitHead": "d279b0fddc435572c48dff35f02db80ee4ca3ee7"
83
+ "gitHead": "63c446753585b99a48ea4782613671ca6ff3c8b1"
84
84
  }
@@ -0,0 +1,106 @@
1
+ import React from "react";
2
+ import { act, renderHook } from "@testing-library/react-native";
3
+ import { darkTokens, iosTokens } from "@jobber/design";
4
+ import merge from "lodash/merge";
5
+ import {
6
+ AtlantisThemeContextProvider,
7
+ useAtlantisTheme,
8
+ } from "./AtlantisThemeContext";
9
+ import { AtlantisThemeContextProviderProps, Theme } from "./types";
10
+
11
+ const expectedDarkTokens = merge({}, iosTokens, darkTokens);
12
+ const expectedLightTokens = iosTokens;
13
+
14
+ function Wrapper({
15
+ children,
16
+ dangerouslyOverrideTheme,
17
+ }: AtlantisThemeContextProviderProps) {
18
+ return (
19
+ <AtlantisThemeContextProvider
20
+ dangerouslyOverrideTheme={dangerouslyOverrideTheme}
21
+ >
22
+ {children}
23
+ </AtlantisThemeContextProvider>
24
+ );
25
+ }
26
+
27
+ function WrapperWithOverride({
28
+ children,
29
+ dangerouslyOverrideTheme,
30
+ }: AtlantisThemeContextProviderProps) {
31
+ return (
32
+ <Wrapper>
33
+ <AtlantisThemeContextProvider
34
+ dangerouslyOverrideTheme={dangerouslyOverrideTheme}
35
+ >
36
+ {children}
37
+ </AtlantisThemeContextProvider>
38
+ </Wrapper>
39
+ );
40
+ }
41
+
42
+ describe("ThemeContext", () => {
43
+ it("defaults to the light theme", () => {
44
+ const { result } = renderHook(useAtlantisTheme, {
45
+ wrapper: (props: AtlantisThemeContextProviderProps) => (
46
+ <Wrapper {...props} />
47
+ ),
48
+ });
49
+
50
+ expect(result.current.theme).toBe("light");
51
+ expect(result.current.tokens).toEqual(expectedLightTokens);
52
+ });
53
+
54
+ it("updates the theme and tokens", () => {
55
+ const { result } = renderHook(useAtlantisTheme, {
56
+ wrapper: (props: AtlantisThemeContextProviderProps) => (
57
+ <Wrapper {...props} />
58
+ ),
59
+ });
60
+
61
+ act(() => result.current.setTheme("dark"));
62
+ expect(result.current.theme).toBe("dark");
63
+ expect(result.current.tokens).toEqual(expectedDarkTokens);
64
+
65
+ act(() => result.current.setTheme("light"));
66
+ expect(result.current.theme).toBe("light");
67
+ expect(result.current.tokens).toEqual(expectedLightTokens);
68
+ });
69
+
70
+ describe("when theme is forced for provider", () => {
71
+ it("ignores updates to the global theme", () => {
72
+ const { result } = renderHook(useAtlantisTheme, {
73
+ wrapper: (props: AtlantisThemeContextProviderProps) => (
74
+ <WrapperWithOverride {...props} dangerouslyOverrideTheme="light" />
75
+ ),
76
+ });
77
+
78
+ // Update the global theme
79
+ act(() => result.current.setTheme("dark"));
80
+
81
+ // This hook shouldn't be affected by it because it's set to the light theme
82
+ expect(result.current.theme).toBe("light");
83
+ expect(result.current.tokens).toEqual(expectedLightTokens);
84
+ });
85
+
86
+ it.each([
87
+ { defaultTheme: "light", expectedTokens: expectedLightTokens },
88
+ { defaultTheme: "dark", expectedTokens: expectedDarkTokens },
89
+ ] as { defaultTheme: Theme; expectedTokens: typeof iosTokens }[])(
90
+ "provides the dangerouslyOverrideTheme $defaultTheme tokens",
91
+ ({ defaultTheme, expectedTokens }) => {
92
+ const { result } = renderHook(useAtlantisTheme, {
93
+ wrapper: (props: AtlantisThemeContextProviderProps) => (
94
+ <WrapperWithOverride
95
+ {...props}
96
+ dangerouslyOverrideTheme={defaultTheme}
97
+ />
98
+ ),
99
+ });
100
+
101
+ expect(result.current.theme).toBe(defaultTheme);
102
+ expect(result.current.tokens).toEqual(expectedTokens);
103
+ },
104
+ );
105
+ });
106
+ });
@@ -1,10 +1,5 @@
1
1
  import { androidTokens, darkTokens, iosTokens } from "@jobber/design";
2
- import React, {
3
- PropsWithChildren,
4
- createContext,
5
- useContext,
6
- useState,
7
- } from "react";
2
+ import React, { createContext, useContext, useState } from "react";
8
3
  import merge from "lodash/merge";
9
4
  import { Platform } from "react-native";
10
5
  import {
@@ -24,68 +19,31 @@ const completeDarkTokens = merge({}, lightTokens, darkTokens);
24
19
  const AtlantisThemeContext = createContext<AtlantisThemeContextValue>({
25
20
  theme: "light",
26
21
  tokens: lightTokens,
22
+ setTheme: () => {
23
+ console.error(
24
+ "useAtlantisTheme accessed outside of AtlantisThemeContextProvider",
25
+ );
26
+ },
27
27
  });
28
28
 
29
29
  export function AtlantisThemeContextProvider({
30
30
  children,
31
31
  dangerouslyOverrideTheme,
32
32
  }: AtlantisThemeContextProviderProps) {
33
- if (dangerouslyOverrideTheme) {
34
- return (
35
- <InternalStaticThemeProvider
36
- dangerouslyOverrideTheme={dangerouslyOverrideTheme}
37
- >
38
- {children}
39
- </InternalStaticThemeProvider>
40
- );
41
- }
42
-
43
- return (
44
- <InternalDynamicThemeProvider>{children}</InternalDynamicThemeProvider>
45
- );
46
- }
47
-
48
- function InternalDynamicThemeProvider({ children }: PropsWithChildren) {
49
- // TODO: check initial theme from local/device storage?
50
- // const initialTheme: Theme = (globalThis.document.documentElement.dataset.theme as Theme) ?? "light";
33
+ // TODO: check last saved theme from local/device storage
51
34
  const initialTheme: Theme = "light";
35
+ const [globalTheme, setGlobalTheme] = useState<Theme>(initialTheme);
52
36
 
53
- const [internalTheme] = useState<Theme>(initialTheme);
54
- const currentTokens =
55
- internalTheme === "dark" ? completeDarkTokens : lightTokens;
56
-
57
- // TODO: listen for global theme update -> setInternalTheme
58
- // See web's AtlantisThemeContext for an example of how it does this.
59
-
60
- return (
61
- <AtlantisThemeContext.Provider
62
- value={{
63
- theme: internalTheme,
64
- tokens: currentTokens,
65
- }}
66
- >
67
- {children}
68
- </AtlantisThemeContext.Provider>
69
- );
70
- }
71
-
72
- function InternalStaticThemeProvider({
73
- dangerouslyOverrideTheme,
74
- children,
75
- }: Required<
76
- Pick<
77
- AtlantisThemeContextProviderProps,
78
- "dangerouslyOverrideTheme" | "children"
79
- >
80
- >) {
37
+ const currentTheme = dangerouslyOverrideTheme ?? globalTheme;
81
38
  const currentTokens =
82
- dangerouslyOverrideTheme === "dark" ? completeDarkTokens : lightTokens;
39
+ currentTheme === "dark" ? completeDarkTokens : lightTokens;
83
40
 
84
41
  return (
85
42
  <AtlantisThemeContext.Provider
86
43
  value={{
87
- theme: dangerouslyOverrideTheme,
44
+ theme: currentTheme,
88
45
  tokens: currentTokens,
46
+ setTheme: setGlobalTheme,
89
47
  }}
90
48
  >
91
49
  {children}
@@ -0,0 +1,83 @@
1
+ import React from "react";
2
+ import { renderHook } from "@testing-library/react-native";
3
+ import { buildThemedStyles } from "./buildThemedStyles";
4
+ import { AtlantisThemeContextProvider } from "./AtlantisThemeContext";
5
+
6
+ describe("buildThemedStyles", () => {
7
+ const wrapper = ({ children }: { children: React.ReactNode }) => (
8
+ <AtlantisThemeContextProvider>{children}</AtlantisThemeContextProvider>
9
+ );
10
+
11
+ it("creates styles using theme tokens", () => {
12
+ const useTestStyles = buildThemedStyles(tokens => ({
13
+ container: {
14
+ backgroundColor: tokens["color-surface"],
15
+ padding: tokens["space-base"],
16
+ },
17
+ }));
18
+
19
+ const { result } = renderHook(() => useTestStyles(), { wrapper });
20
+
21
+ expect(result.current).toEqual({
22
+ container: {
23
+ backgroundColor: expect.any(String),
24
+ padding: expect.any(Number),
25
+ },
26
+ });
27
+ });
28
+
29
+ it("memoizes styles and only updates when tokens change", () => {
30
+ const styleFactory = jest.fn(tokens => ({
31
+ container: {
32
+ backgroundColor: tokens["color-surface"],
33
+ },
34
+ }));
35
+
36
+ const useTestStyles = buildThemedStyles(styleFactory);
37
+
38
+ const { result, rerender } = renderHook(() => useTestStyles(), { wrapper });
39
+
40
+ // Initial render should call styleFactory
41
+ expect(styleFactory).toHaveBeenCalledTimes(1);
42
+ const initialResult = result.current;
43
+
44
+ // Rerender without token changes should not call styleFactory again
45
+ rerender({ wrapper });
46
+ expect(styleFactory).toHaveBeenCalledTimes(1);
47
+ expect(result.current).toBe(initialResult);
48
+ });
49
+
50
+ it("creates styles with dependent hooks", () => {
51
+ const useDependentStyles = () => ({
52
+ text: { color: "red" },
53
+ });
54
+
55
+ const useTestStyles = () => {
56
+ const dependentStyles = useDependentStyles();
57
+
58
+ return buildThemedStyles(tokens => ({
59
+ container: {
60
+ ...dependentStyles.text,
61
+ padding: tokens["space-base"],
62
+ },
63
+ }))();
64
+ };
65
+
66
+ const { result } = renderHook(() => useTestStyles(), { wrapper });
67
+
68
+ expect(result.current).toEqual({
69
+ container: {
70
+ color: "red",
71
+ padding: expect.any(Number),
72
+ },
73
+ });
74
+ });
75
+
76
+ it("handles empty style objects", () => {
77
+ const useTestStyles = buildThemedStyles(() => ({}));
78
+
79
+ const { result } = renderHook(() => useTestStyles(), { wrapper });
80
+
81
+ expect(result.current).toEqual({});
82
+ });
83
+ });
@@ -1,9 +1,8 @@
1
1
  import { iosTokens } from "@jobber/design";
2
- import { PropsWithChildren } from "react";
3
2
 
4
3
  export interface AtlantisThemeContextValue {
5
4
  /**
6
- * The theme of the application.
5
+ * The active theme.
7
6
  */
8
7
  readonly theme: Theme;
9
8
 
@@ -11,9 +10,14 @@ export interface AtlantisThemeContextValue {
11
10
  * The design tokens for the current theme.
12
11
  */
13
12
  readonly tokens: typeof iosTokens;
13
+
14
+ /**
15
+ * Change the current theme globally.
16
+ */
17
+ readonly setTheme: (theme: Theme) => void;
14
18
  }
15
19
 
16
- export interface AtlantisThemeContextProviderProps extends PropsWithChildren {
20
+ export interface AtlantisThemeContextProviderProps {
17
21
  /**
18
22
  * The children to render.
19
23
  */
@@ -81,7 +81,7 @@ interface CommonButtonProps {
81
81
  /**
82
82
  * **Use at your own risk:** Custom style for specific elements. This should only be used as a
83
83
  * **last resort**. Using this may result in unexpected side effects.
84
- * More information [here](https://atlantis.getjobber.com/storybook/?path=/docs/guides-customizing-components--docs#unsafe_-props).
84
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
85
85
  */
86
86
  readonly UNSAFE_style?: ButtonUnsafeStyle;
87
87
  }
@@ -1,5 +1,6 @@
1
1
  import { StyleSheet, ViewStyle } from "react-native";
2
- import { ColumnKeys } from "./types";
2
+ import { ColumnKeys, Spacing, spacing } from "./types";
3
+ import { tokens as staticTokens } from "../utils/design";
3
4
 
4
5
  export const styles = StyleSheet.create({
5
6
  row: { flexDirection: "row" },
@@ -16,3 +17,14 @@ export const columnStyles: Record<ColumnKeys, ViewStyle> = StyleSheet.create({
16
17
  flexBasis: 0,
17
18
  },
18
19
  });
20
+
21
+ export const gapStyles = StyleSheet.create(
22
+ spacing.reduce((gapObj, space) => {
23
+ let paddingLeft = 0;
24
+ if (space !== "none") paddingLeft = staticTokens[`space-${space}`];
25
+
26
+ gapObj[space] = { paddingLeft };
27
+
28
+ return gapObj;
29
+ }, {} as Record<Spacing, ViewStyle>),
30
+ );
package/src/Flex/Flex.tsx CHANGED
@@ -1,8 +1,7 @@
1
1
  import React, { Children, PropsWithChildren } from "react";
2
2
  import { View } from "react-native";
3
3
  import chunk from "lodash/chunk";
4
- import { columnStyles, styles } from "./Flex.styles";
5
- import { useGapStyles } from "./Flex.gap.styles";
4
+ import { columnStyles, gapStyles, styles } from "./Flex.styles";
6
5
  import { FlexProps } from "./types";
7
6
  import { Content } from "../Content";
8
7
 
@@ -61,7 +60,7 @@ function Row({
61
60
  <View
62
61
  style={[
63
62
  columnStyles[template[index]] || columnStyles.grow,
64
- index > 0 && gap && useGapStyles()[gap],
63
+ index > 0 && gap && gapStyles[gap],
65
64
  ]}
66
65
  >
67
66
  {child}
@@ -4,6 +4,7 @@ import {
4
4
  buildThemedStyles,
5
5
  } from "../AtlantisThemeContext";
6
6
  import {
7
+ // eslint-disable-next-line import/no-deprecated
7
8
  typographyStyles as staticTypographyStyles,
8
9
  useTypographyStyles,
9
10
  } from "../Typography";
@@ -52,6 +53,7 @@ export const createCommonInputTokens = (
52
53
  * @deprecated Use useCommonInputStyles instead
53
54
  */
54
55
  export const commonInputStyles = StyleSheet.create(
56
+ // eslint-disable-next-line import/no-deprecated
55
57
  createCommonInputTokens(staticTokens, staticTypographyStyles),
56
58
  );
57
59
 
@@ -10,10 +10,7 @@ import {
10
10
  prefixIconTestId,
11
11
  prefixLabelTestId,
12
12
  } from "./Prefix";
13
- import {
14
- typographyStyles as staticStyles,
15
- useTypographyStyles,
16
- } from "../../../Typography";
13
+ import { useTypographyStyles } from "../../../Typography";
17
14
  import { useStyles } from "../../InputFieldWrapper.style";
18
15
  import { tokens } from "../../../utils/design";
19
16
  import * as IconComponent from "../../../Icon/Icon";
@@ -31,8 +28,6 @@ beforeAll(() => {
31
28
 
32
29
  styles = stylesHook.result.current;
33
30
  typographyStyles = typographyStylesHook.result.current;
34
- console.log(typographyStyles.defaultSize);
35
- console.log(staticStyles.defaultSize);
36
31
  });
37
32
 
38
33
  function setupLabel({
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { render } from "@testing-library/react-native";
2
+ import { render, renderHook } from "@testing-library/react-native";
3
3
  import { TextStyle } from "react-native";
4
4
  import {
5
5
  SuffixIcon,
@@ -7,7 +7,7 @@ import {
7
7
  SuffixLabel,
8
8
  SuffixLabelProps,
9
9
  } from "./Suffix";
10
- import { typographyStyles } from "../../../Typography";
10
+ import { useTypographyStyles } from "../../../Typography";
11
11
 
12
12
  const mockLabel = "$";
13
13
 
@@ -49,6 +49,13 @@ function setupIcon({
49
49
  );
50
50
  }
51
51
 
52
+ let typographyStyles: ReturnType<typeof useTypographyStyles>;
53
+
54
+ beforeAll(() => {
55
+ const typographyStylesHook = renderHook(() => useTypographyStyles());
56
+ typographyStyles = typographyStylesHook.result.current;
57
+ });
58
+
52
59
  describe("Suffix", () => {
53
60
  it("renders a suffix label when specified", () => {
54
61
  const { getByText } = setupLabel({});
@@ -9,7 +9,7 @@ import {
9
9
  import { IconNames } from "@jobber/design";
10
10
  import { Icon } from "../../../Icon";
11
11
  import { Text } from "../../../Text";
12
- import { typographyStyles } from "../../../Typography";
12
+ import { useTypographyStyles } from "../../../Typography";
13
13
  import { useAtlantisTheme } from "../../../AtlantisThemeContext";
14
14
  import { useStyles } from "../../InputFieldWrapper.style";
15
15
 
@@ -36,6 +36,7 @@ export function SuffixLabel({
36
36
  styleOverride,
37
37
  }: SuffixLabelProps): JSX.Element {
38
38
  const styles = useStyles();
39
+ const typographyStyles = useTypographyStyles();
39
40
 
40
41
  return (
41
42
  <View
@@ -1,8 +1,10 @@
1
1
  import { buildThemedStyles } from "../AtlantisThemeContext";
2
- import { typographyStyles } from "../Typography/Typography.style";
2
+ import { useTypographyStyles } from "../Typography";
3
3
 
4
- export const useStyles = buildThemedStyles(tokens => {
5
- return {
4
+ export const useStyles = () => {
5
+ const typographyStyles = useTypographyStyles();
6
+
7
+ return buildThemedStyles(tokens => ({
6
8
  pressable: {
7
9
  flex: 1,
8
10
  },
@@ -26,5 +28,5 @@ export const useStyles = buildThemedStyles(tokens => {
26
28
  inputInvalid: {
27
29
  borderColor: tokens["color-critical"],
28
30
  },
29
- };
30
- });
31
+ }))();
32
+ };
@@ -1,8 +1,10 @@
1
1
  import { buildThemedStyles } from "../AtlantisThemeContext";
2
- import { typographyStyles } from "../Typography";
2
+ import { useTypographyStyles } from "../Typography";
3
3
 
4
- export const useStyles = buildThemedStyles(tokens => {
5
- return {
4
+ export const useStyles = () => {
5
+ const typographyStyles = useTypographyStyles();
6
+
7
+ return buildThemedStyles(tokens => ({
6
8
  inputPaddingTop: {
7
9
  paddingTop:
8
10
  (typographyStyles.smallSize.fontSize || 0) +
@@ -22,9 +24,8 @@ export const useStyles = buildThemedStyles(tokens => {
22
24
  },
23
25
 
24
26
  multilineInputiOS: {
25
- // for placeholder
26
27
  paddingTop:
27
28
  (typographyStyles.defaultSize.fontSize || 0) + tokens["space-smallest"],
28
29
  },
29
- };
30
- });
30
+ }))();
31
+ };
package/src/Text/Text.tsx CHANGED
@@ -90,7 +90,7 @@ export interface TextProps
90
90
  /**
91
91
  * **Use at your own risk:** Custom style for specific elements. This should only be used as a
92
92
  * **last resort**. Using this may result in unexpected side effects.
93
- * More information [here](https://atlantis.getjobber.com/storybook/?path=/docs/guides-customizing-components--docs#unsafe_-props).
93
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
94
94
  */
95
95
  readonly UNSAFE_style?: TypographyUnsafeStyle;
96
96
  }
@@ -620,14 +620,7 @@ export const createTypographyTokens = (
620
620
  });
621
621
 
622
622
  /**
623
- * `StyleSheet` for Typography.tsx.
624
- *
625
- * If you find yourself needing to use what's inside this object on files other
626
- * than `<Typography />`, please import from `@jobber/components-native` instead.
627
- *
628
- * ```
629
- * import { typographyStyles } from "@jobber/components-native"
630
- * ```
623
+ * @deprecated Use useTypographyStyles instead
631
624
  */
632
625
  export const typographyStyles: Record<string, TextStyle> = StyleSheet.create(
633
626
  createTypographyTokens(staticTokens),