@gympass/yoga 7.104.1 → 7.106.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.
Files changed (43) hide show
  1. package/cjs/Checkbox/web/Checkbox.js +2 -2
  2. package/cjs/NavigationMenu/NavigationMenu.theme.js +124 -41
  3. package/cjs/NavigationMenu/web/BottomItems/BottomItem.js +7 -2
  4. package/cjs/NavigationMenu/web/BottomItems/BottomItems.js +5 -4
  5. package/cjs/NavigationMenu/web/Item/styles.js +6 -16
  6. package/cjs/NavigationMenu/web/Menu/Menu.js +91 -26
  7. package/cjs/NavigationMenu/web/NavigationMenu.js +7 -5
  8. package/cjs/NavigationMenu/web/Switcher/Actions.js +9 -5
  9. package/cjs/NavigationMenu/web/Switcher/Switcher.js +3 -3
  10. package/cjs/Text/Text.theme.js +74 -35
  11. package/cjs/Text/native/Text.test.js +88 -59
  12. package/cjs/Text/textStyle.android.js +12 -15
  13. package/cjs/Text/textStyle.ios.js +11 -11
  14. package/cjs/Text/textStyle.web.js +11 -10
  15. package/cjs/Text/web/Text.test.js +87 -57
  16. package/cjs/Theme/theme/v3theme.js +158 -1
  17. package/esm/Checkbox/web/Checkbox.js +2 -2
  18. package/esm/NavigationMenu/NavigationMenu.theme.js +124 -41
  19. package/esm/NavigationMenu/web/BottomItems/BottomItem.js +7 -2
  20. package/esm/NavigationMenu/web/BottomItems/BottomItems.js +5 -4
  21. package/esm/NavigationMenu/web/Item/styles.js +6 -16
  22. package/esm/NavigationMenu/web/Menu/Menu.js +92 -27
  23. package/esm/NavigationMenu/web/NavigationMenu.js +7 -5
  24. package/esm/NavigationMenu/web/Switcher/Actions.js +9 -5
  25. package/esm/NavigationMenu/web/Switcher/Switcher.js +3 -3
  26. package/esm/Text/Text.theme.js +74 -35
  27. package/esm/Text/native/Text.test.js +30 -1
  28. package/esm/Text/textStyle.android.js +12 -15
  29. package/esm/Text/textStyle.ios.js +11 -11
  30. package/esm/Text/textStyle.web.js +11 -10
  31. package/esm/Text/web/Text.test.js +31 -1
  32. package/esm/Theme/theme/v3theme.js +158 -1
  33. package/package.json +2 -2
  34. package/typings/{Actions-cd7fac99.d.ts → Actions-752d7514.d.ts} +2 -2
  35. package/typings/NavigationMenu/NavigationMenu.theme.d.ts +1 -71
  36. package/typings/NavigationMenu/index.d.ts +2 -2
  37. package/typings/NavigationMenu/web/BottomItems/index.d.ts +2 -1
  38. package/typings/NavigationMenu/web/Menu/index.d.ts +3 -1
  39. package/typings/NavigationMenu/web/Switcher/index.d.ts +1 -1
  40. package/typings/NavigationMenu/web/index.d.ts +2 -2
  41. package/typings/{NavigationMenu-57b14b2b.d.ts → NavigationMenu-8c022497.d.ts} +9 -11
  42. package/typings/Theme/theme/v3theme.d.ts +37 -37
  43. package/typings/index.d.ts +2 -2
@@ -35,13 +35,15 @@ import { media } from "@gympass/yoga-helpers";
35
35
  const StyledItemsContainer = styled.nav`
36
36
  position: relative;
37
37
  ${media.lg`display: none`}
38
+
39
+ z-index: ${({ $zIndex }) => $zIndex != null ? $zIndex : 2};
38
40
  `;
39
41
  const StyledItems = styled.ul`
40
42
  ${({
41
43
  theme: {
42
44
  yoga: {
43
45
  components: {
44
- navigationmenu: { backgroundColor, border, gap }
46
+ navigationmenu: { backgroundColor, border, gap, height }
45
47
  }
46
48
  }
47
49
  }
@@ -53,13 +55,12 @@ const StyledItems = styled.ul`
53
55
  grid-auto-flow: column;
54
56
  align-items: center;
55
57
  width: 100%;
56
- height: 56px;
57
- background-color: ${backgroundColor.white};
58
+ height: ${height.bottomMenu}px;
59
+ background-color: ${backgroundColor.bottomMenu};
58
60
  margin: 0;
59
61
  padding: 0;
60
62
  border: 1px solid ${border.color.default};
61
63
  gap: ${gap.xxxsmall}px;
62
- z-index: ${({ $zIndex }) => $zIndex != null ? $zIndex : 2};
63
64
  `}
64
65
  `;
65
66
  const BottomItems = (_a) => {
@@ -1,9 +1,7 @@
1
1
  import styled, { css } from "styled-components";
2
- import { media } from "@gympass/yoga-helpers";
3
- import Box from "../../../Box";
4
2
  import Tag from "../../../Tag";
5
3
  import Text from "../../../Text";
6
- const StyledTextContainer = styled(Box)`
4
+ const StyledTextContainer = styled.div`
7
5
  ${({
8
6
  isSubItem,
9
7
  theme: {
@@ -34,9 +32,9 @@ const StyledTag = styled(Tag)`
34
32
  }
35
33
  }) => css`
36
34
  text-transform: uppercase;
37
- background-color: ${backgroundColor.stamina};
35
+ background-color: ${backgroundColor.tag};
38
36
  color: ${tag.color.default};
39
- border-radius: ${border.radius.circle}px;
37
+ border-radius: ${border.radius.tag}px;
40
38
  `}
41
39
  `;
42
40
  const StyledText = styled(Text)`
@@ -58,7 +56,6 @@ const StyledText = styled(Text)`
58
56
  `;
59
57
  const Active = css`
60
58
  ${({
61
- isResponsive,
62
59
  theme: {
63
60
  yoga: {
64
61
  components: {
@@ -70,18 +67,11 @@ const Active = css`
70
67
  cursor: auto;
71
68
 
72
69
  > ${StyledTextContainer} {
73
- background-color: ${backgroundColor.default};
74
-
75
- ${isResponsive ? media.lg`background-color: ${backgroundColor.yoga}` : css`
76
- background-color: ${backgroundColor.yoga};
77
- `}
70
+ background-color: ${backgroundColor.active};
78
71
 
79
72
  ${StyledText} {
80
73
  color: ${font.color.active};
81
-
82
- ${isResponsive ? media.lg`font-weight: ${font.weight.medium}` : css`
83
- font-weight: ${font.weight.medium};
84
- `}
74
+ font-weight: ${font.weight.bold};
85
75
  }
86
76
 
87
77
  svg {
@@ -89,7 +79,7 @@ const Active = css`
89
79
  }
90
80
 
91
81
  > ${StyledTag} {
92
- background-color: ${backgroundColor.stamina};
82
+ background-color: ${backgroundColor.tag};
93
83
  }
94
84
  }
95
85
  `}
@@ -1,51 +1,64 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import styled, { css } from "styled-components";
3
- import { ArrowRight } from "@gympass/yoga-icons";
3
+ import { ChevronDown } from "@gympass/yoga-icons";
4
4
  import { Text } from "@gympass/yoga";
5
- import Box from "../../../Box";
6
5
  import Icon from "../../../Icon";
7
- const StyledMenu = styled(Box)`
6
+ const StyledMenu = styled.div`
8
7
  ${({
9
8
  hasAction,
10
9
  theme: {
11
10
  yoga: {
12
11
  components: {
13
- navigationmenu: { avatar, backgroundColor, border, gap, padding }
12
+ navigationmenu: {
13
+ backgroundColor,
14
+ border,
15
+ gap,
16
+ padding,
17
+ height,
18
+ hover
19
+ }
14
20
  }
15
21
  }
16
22
  }
17
23
  }) => css`
18
24
  transition: background-color 300ms ease-in-out;
19
25
 
20
- display: flex;
26
+ display: grid;
21
27
  align-items: center;
22
- justify-content: space-between;
23
28
  width: 100%;
29
+ grid-template-columns: max-content 1fr max-content;
24
30
  gap: ${gap.xxsmall}px;
25
31
  padding: ${padding.xsmall}px;
26
- background-color: ${backgroundColor.white};
27
- border-radius: ${border.radius.circle}px;
28
- border: 1px solid ${border.color.white};
29
-
30
- > div:first-child {
31
- height: ${avatar.height}px;
32
- width: ${avatar.width}px;
33
- }
32
+ background-color: ${backgroundColor.contextMenu};
33
+ border-radius: ${border.radius.contextMenu}px;
34
+ min-height: ${height.contextMenu}px;
34
35
 
35
36
  ${hasAction && css`
36
- :hover,
37
+ cursor: pointer;
38
+ &:hover,
37
39
  &:focus {
38
- cursor: pointer;
39
- border: 1px solid ${border.color.default};
40
+ ${hover.contextMenu}
40
41
  }
41
42
  `}
42
43
  `}
43
44
  `;
44
- const StyledTextContainer = styled(Box)`
45
- flex: 1;
46
- overflow: hidden;
45
+ const StyledTextContainer = styled.div`
46
+ ${({
47
+ theme: {
48
+ yoga: {
49
+ components: {
50
+ navigationmenu: { gap }
51
+ }
52
+ }
53
+ }
54
+ }) => css`
55
+ display: flex;
56
+ flex-direction: column;
57
+ gap: ${gap.xxxsmall}px;
58
+ overflow: hidden;
59
+ `}
47
60
  `;
48
- const StyledText = styled(Text.Small)`
61
+ const StyledTitle = styled(Text.H4)`
49
62
  ${({
50
63
  theme: {
51
64
  yoga: {
@@ -55,22 +68,74 @@ const StyledText = styled(Text.Small)`
55
68
  }
56
69
  }
57
70
  }) => css`
58
- font-weight: ${font.weight.medium};
71
+ font-size: ${font.size.contextMenu.title}px;
72
+ line-height: ${font.size.contextMenu.title}px;
73
+ font-weight: ${font.weight.bold};
59
74
  flex: 1;
60
75
  white-space: nowrap;
61
76
  text-overflow: ellipsis;
62
77
  overflow: hidden;
63
78
  `}
64
79
  `;
65
- const Menu = ({ avatar: Avatar, subtitle, title, onClick }) => {
80
+ const StyledSubtitle = styled(Text.Small)`
81
+ ${({
82
+ theme: {
83
+ yoga: {
84
+ components: {
85
+ navigationmenu: { font }
86
+ }
87
+ }
88
+ }
89
+ }) => css`
90
+ color: ${font.color.default};
91
+ `}
92
+ `;
93
+ const StyledActionIconContainer = styled.div`
94
+ ${({
95
+ theme: {
96
+ yoga: {
97
+ components: {
98
+ navigationmenu: { icon }
99
+ }
100
+ }
101
+ }
102
+ }) => css`
103
+ svg {
104
+ fill: ${icon.fill.actions};
105
+ }
106
+ `}
107
+ `;
108
+ const StyledAvatarContainer = styled.div`
109
+ ${({
110
+ theme: {
111
+ yoga: {
112
+ components: {
113
+ navigationmenu: { avatar }
114
+ }
115
+ }
116
+ }
117
+ }) => css`
118
+ > div:first-child {
119
+ height: ${avatar.height}px;
120
+ width: ${avatar.width}px;
121
+ }
122
+ `}
123
+ `;
124
+ const Menu = ({
125
+ avatar: Avatar,
126
+ icon,
127
+ subtitle,
128
+ title,
129
+ onClick
130
+ }) => {
66
131
  const hasAction = Boolean(onClick);
67
132
  return /* @__PURE__ */ jsxs(StyledMenu, { hasAction, onClick, children: [
68
- Avatar,
133
+ !!Avatar && /* @__PURE__ */ jsx(StyledAvatarContainer, { children: Avatar }),
69
134
  /* @__PURE__ */ jsxs(StyledTextContainer, { children: [
70
- title && /* @__PURE__ */ jsx(StyledText, { children: title }),
71
- subtitle && /* @__PURE__ */ jsx(Text.Small, { color: "deep", children: subtitle })
135
+ title && /* @__PURE__ */ jsx(StyledTitle, { children: title }),
136
+ subtitle && /* @__PURE__ */ jsx(StyledSubtitle, { children: subtitle })
72
137
  ] }),
73
- hasAction && /* @__PURE__ */ jsx(Icon, { as: ArrowRight, size: "large", fill: "vibin" })
138
+ hasAction && /* @__PURE__ */ jsx(StyledActionIconContainer, { children: /* @__PURE__ */ jsx(Icon, { as: icon != null ? icon : ChevronDown, size: "large" }) })
74
139
  ] });
75
140
  };
76
141
  var Menu_default = Menu;
@@ -36,7 +36,6 @@ import Menu from "./Menu";
36
36
  import Switcher from "./Switcher";
37
37
  import { Item, Subitem } from "./Item";
38
38
  import { BottomItems, BottomItem } from "./BottomItems";
39
- import Box from "../../Box";
40
39
  const DeskTopContainer = css`
41
40
  ${({
42
41
  theme: {
@@ -80,7 +79,7 @@ const StyledNavigationMenu = styled.div`
80
79
  `}
81
80
  `}
82
81
  `;
83
- const StyledHeader = styled(Box)`
82
+ const StyledHeader = styled.header`
84
83
  ${({
85
84
  theme: {
86
85
  yoga: {
@@ -118,7 +117,7 @@ const StyledItemsGroup = styled.ul`
118
117
  gap: ${gap.xxxsmall}px;
119
118
  `}
120
119
  `;
121
- const StyledFooter = styled(Box)`
120
+ const StyledFooter = styled.footer`
122
121
  ${({
123
122
  theme: {
124
123
  yoga: {
@@ -137,17 +136,20 @@ const NavigationMenu = (_a) => {
137
136
  var _b = _a, {
138
137
  children,
139
138
  openOnMobile = false,
140
- responsive = true
139
+ responsive = true,
140
+ zIndex
141
141
  } = _b, htmlAttributes = __objRest(_b, [
142
142
  "children",
143
143
  "openOnMobile",
144
- "responsive"
144
+ "responsive",
145
+ "zIndex"
145
146
  ]);
146
147
  return /* @__PURE__ */ jsx(
147
148
  StyledNavigationMenu,
148
149
  __spreadProps(__spreadValues({}, htmlAttributes), {
149
150
  isOpenOnMobile: openOnMobile,
150
151
  isResponsive: responsive,
152
+ $zIndex: zIndex,
151
153
  children
152
154
  })
153
155
  );
@@ -8,7 +8,7 @@ const StyledAction = styled.div`
8
8
  theme: {
9
9
  yoga: {
10
10
  components: {
11
- navigationmenu: { backgroundColor, border, height, width }
11
+ navigationmenu: { backgroundColor, border, height, width, icon }
12
12
  }
13
13
  }
14
14
  }
@@ -20,7 +20,11 @@ const StyledAction = styled.div`
20
20
  justify-content: center;
21
21
  width: ${width.xxlarge}px;
22
22
  height: ${height.xxlarge}px;
23
- border-radius: ${border.radius.circle}px;
23
+ border-radius: ${border.radius.action}px;
24
+
25
+ svg {
26
+ fill: ${icon.fill.actions};
27
+ }
24
28
 
25
29
  :hover,
26
30
  &:focus {
@@ -29,18 +33,18 @@ const StyledAction = styled.div`
29
33
  }
30
34
  `}
31
35
  `;
32
- function Actions({ actions, sideOffset, $zIndex }) {
36
+ function Actions({ actions, sideOffset, zIndex }) {
33
37
  if (!(actions == null ? void 0 : actions.length)) {
34
38
  return null;
35
39
  }
36
40
  return /* @__PURE__ */ jsxs(YogaMenu, { onMouseHover: false, children: [
37
- /* @__PURE__ */ jsx(YogaMenu.Action, { children: /* @__PURE__ */ jsx(StyledAction, { children: /* @__PURE__ */ jsx(Icon, { as: MenuMore, size: "medium", fill: "vibin" }) }) }),
41
+ /* @__PURE__ */ jsx(YogaMenu.Action, { children: /* @__PURE__ */ jsx(StyledAction, { children: /* @__PURE__ */ jsx(Icon, { as: MenuMore, size: "medium" }) }) }),
38
42
  /* @__PURE__ */ jsx(
39
43
  YogaMenu.List,
40
44
  {
41
45
  side: "right",
42
46
  sideOffset,
43
- zIndex: `${$zIndex != null ? $zIndex : 2}`,
47
+ zIndex: `${zIndex != null ? zIndex : 2}`,
44
48
  children: actions.map(({ id, label, onClick }) => /* @__PURE__ */ jsx(YogaMenu.Item, { onClick, children: label }, id))
45
49
  }
46
50
  )
@@ -58,7 +58,7 @@ const StyledSwitcher = styled(Box)`
58
58
  }
59
59
  `}
60
60
  `;
61
- const StyledTextContainer = styled(Box)`
61
+ const StyledTextContainer = styled.div`
62
62
  flex: 1;
63
63
  overflow: hidden;
64
64
  `;
@@ -72,7 +72,7 @@ const StyledTitle = styled(Text.Small)`
72
72
  }
73
73
  }
74
74
  }) => css`
75
- font-weight: ${font.weight.medium};
75
+ font-weight: ${font.weight.bold};
76
76
  flex: 1;
77
77
  white-space: nowrap;
78
78
  text-overflow: ellipsis;
@@ -95,7 +95,7 @@ const Switcher = (_a) => {
95
95
  "subtitle",
96
96
  "title"
97
97
  ]);
98
- const hasActions = actions == null ? void 0 : actions.length;
98
+ const hasActions = !!(actions == null ? void 0 : actions.length);
99
99
  return /* @__PURE__ */ jsxs(StyledSwitcher, { fill, children: [
100
100
  Avatar,
101
101
  /* @__PURE__ */ jsx(StyledTextContainer, { children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -2,105 +2,144 @@ const Text = ({ fontSizes, lineHeights, fontWeights }) => ({
2
2
  display1: {
3
3
  fontFamily: "NaN Holo Condensed",
4
4
  fontsize: fontSizes.xhuge,
5
- lineHeight: lineHeights.xhuge,
6
- fontWeight: fontWeights.bold
5
+ fontWeight: fontWeights.bold,
6
+ lineHeight: lineHeights.xhuge
7
7
  },
8
8
  display2: {
9
9
  fontFamily: "NaN Holo Condensed",
10
10
  fontsize: fontSizes.xxxlarge,
11
- lineHeight: lineHeights.xxlarge,
12
- fontWeight: fontWeights.bold
11
+ fontWeight: fontWeights.bold,
12
+ lineHeight: lineHeights.xxlarge
13
13
  },
14
14
  display3: {
15
15
  fontFamily: "NaN Holo Condensed",
16
16
  fontsize: fontSizes.xxlarge,
17
- lineHeight: lineHeights.xlarge,
18
- fontWeight: fontWeights.bold
17
+ fontWeight: fontWeights.bold,
18
+ lineHeight: lineHeights.xlarge
19
19
  },
20
20
  display4: {
21
21
  fontFamily: "NaN Holo Condensed",
22
22
  fontsize: fontSizes.xlarge,
23
- lineHeight: lineHeights.medium,
24
- fontWeight: fontWeights.bold
23
+ fontWeight: fontWeights.bold,
24
+ lineHeight: lineHeights.medium
25
25
  },
26
26
  displayNumber: {
27
27
  fontFamily: "NaN Holo Condensed",
28
28
  fontsize: fontSizes.xxxlarge,
29
- lineHeight: lineHeights.xxlarge,
30
- fontWeight: fontWeights.bold
29
+ fontWeight: fontWeights.bold,
30
+ lineHeight: lineHeights.xxlarge
31
31
  },
32
32
  h1: {
33
33
  fontsize: fontSizes.huge,
34
- lineHeight: lineHeights.huge,
35
- fontWeight: fontWeights.medium
34
+ fontWeight: fontWeights.medium,
35
+ lineHeight: lineHeights.huge
36
+ },
37
+ "h1-light": {
38
+ fontWeight: fontWeights.light
36
39
  },
37
40
  h2: {
38
41
  fontsize: fontSizes.xxxlarge,
39
- lineHeight: lineHeights.xxxlarge,
40
- fontWeight: fontWeights.medium
42
+ fontWeight: fontWeights.medium,
43
+ lineHeight: lineHeights.xxxlarge
44
+ },
45
+ "h2-light": {
46
+ fontWeight: fontWeights.light
41
47
  },
42
48
  h3: {
43
49
  fontsize: fontSizes.xxlarge,
44
- lineHeight: lineHeights.xxlarge,
45
- fontWeight: fontWeights.medium
50
+ fontWeight: fontWeights.medium,
51
+ lineHeight: lineHeights.xxlarge
52
+ },
53
+ "h3-light": {
54
+ fontWeight: fontWeights.light
46
55
  },
47
56
  h4: {
48
57
  fontsize: fontSizes.xlarge,
49
- lineHeight: lineHeights.xlarge,
50
- fontWeight: fontWeights.medium
58
+ fontWeight: fontWeights.medium,
59
+ lineHeight: lineHeights.xlarge
60
+ },
61
+ "h4-light": {
62
+ fontWeight: fontWeights.light
51
63
  },
52
64
  h5: {
53
65
  fontsize: fontSizes.large,
54
- lineHeight: lineHeights.large,
55
- fontWeight: fontWeights.medium
66
+ fontWeight: fontWeights.medium,
67
+ lineHeight: lineHeights.large
68
+ },
69
+ "h5-light": {
70
+ fontWeight: fontWeights.light
56
71
  },
57
72
  body1: {
58
73
  fontsize: fontSizes.medium,
59
- lineHeight: lineHeights.medium,
74
+ fontWeight: fontWeights.regular,
75
+ lineHeight: lineHeights.medium
76
+ },
77
+ "body1-bold": {
60
78
  fontWeight: fontWeights.medium
61
79
  },
62
80
  body2: {
63
81
  fontsize: fontSizes.small,
64
- lineHeight: lineHeights.small,
82
+ fontWeight: fontWeights.regular,
83
+ lineHeight: lineHeights.small
84
+ },
85
+ "body2-bold": {
65
86
  fontWeight: fontWeights.medium
66
87
  },
67
88
  caption: {
68
89
  fontsize: fontSizes.xsmall,
69
- lineHeight: lineHeights.xsmall,
70
- fontWeight: fontWeights.regular
90
+ fontWeight: fontWeights.regular,
91
+ lineHeight: lineHeights.xsmall
71
92
  },
72
93
  overline: {
73
94
  fontsize: fontSizes.xsmall,
74
- lineHeight: lineHeights.xsmall,
75
- fontWeight: fontWeights.bold
95
+ fontWeight: fontWeights.medium,
96
+ lineHeight: lineHeights.xsmall
76
97
  },
77
98
  sectionTitle: {
78
99
  fontsize: fontSizes.xsmall,
79
- lineHeight: lineHeights.xsmall,
80
100
  fontWeight: fontWeights.medium,
101
+ lineHeight: lineHeights.xsmall,
81
102
  letterSpacing: 1,
82
103
  textTransform: "uppercase"
83
104
  },
84
105
  smallestException: {
85
106
  fontsize: fontSizes.xxsmall,
86
- lineHeight: lineHeights.xxsmall,
87
- fontWeight: fontWeights.regular
107
+ fontWeight: fontWeights.regular,
108
+ lineHeight: lineHeights.xxsmall
88
109
  },
89
110
  // deprecated, please don't use
90
111
  p: {
91
112
  fontsize: fontSizes.medium,
92
- lineHeight: lineHeights.medium,
93
- fontWeight: fontWeights.regular
113
+ fontWeight: fontWeights.regular,
114
+ lineHeight: lineHeights.medium
115
+ },
116
+ "p-light": {
117
+ fontWeight: fontWeights.light
118
+ },
119
+ "p-bold": {
120
+ fontWeight: fontWeights.medium
94
121
  },
95
122
  small: {
96
123
  fontsize: fontSizes.small,
97
- lineHeight: lineHeights.small,
98
- fontWeight: fontWeights.regular
124
+ fontWeight: fontWeights.regular,
125
+ lineHeight: lineHeights.small
126
+ },
127
+ "small-light": {
128
+ fontWeight: fontWeights.light
129
+ },
130
+ "small-bold": {
131
+ fontWeight: fontWeights.medium
99
132
  },
100
133
  tiny: {
101
134
  fontsize: fontSizes.xsmall,
102
- lineHeight: lineHeights.xsmall,
103
- fontWeight: fontWeights.regular
135
+ fontWeight: fontWeights.regular,
136
+ lineHeight: lineHeights.xsmall
137
+ },
138
+ "tiny-light": {
139
+ fontWeight: fontWeights.light
140
+ },
141
+ "tiny-bold": {
142
+ fontWeight: fontWeights.medium
104
143
  },
105
144
  light: {
106
145
  fontWeight: fontWeights.light
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { render } from "@testing-library/react-native";
4
- import { ThemeProvider } from "../..";
5
4
  import { Text } from ".";
5
+ import { ThemeProvider } from "../..";
6
6
  describe("<Text />", () => {
7
7
  describe("Snapshots", () => {
8
8
  it("should match snapshot with Text", () => {
@@ -34,6 +34,35 @@ describe("<Text />", () => {
34
34
  );
35
35
  expect(toJSON()).toMatchSnapshot();
36
36
  });
37
+ it("should match snapshot with Text when v3Theme is settled", () => {
38
+ const { toJSON } = render(
39
+ /* @__PURE__ */ jsxs(ThemeProvider, { children: [
40
+ /* @__PURE__ */ jsx(Text.Display1, { children: "Text Display1" }),
41
+ /* @__PURE__ */ jsx(Text.Display2, { children: "Text Display2" }),
42
+ /* @__PURE__ */ jsx(Text.Display3, { children: "Text Display3" }),
43
+ /* @__PURE__ */ jsx(Text.Display4, { children: "Text Display4" }),
44
+ /* @__PURE__ */ jsx(Text.DisplayNumber, { children: "Text DisplayNumber" }),
45
+ /* @__PURE__ */ jsx(Text.H1, { children: "Text H1" }),
46
+ /* @__PURE__ */ jsx(Text.H2, { children: "Text H2" }),
47
+ /* @__PURE__ */ jsx(Text.H3, { children: "Text H3" }),
48
+ /* @__PURE__ */ jsx(Text.H4, { children: "Text H4" }),
49
+ /* @__PURE__ */ jsx(Text.Body1, { children: "Text Body1" }),
50
+ /* @__PURE__ */ jsx(Text.Body2, { children: "Text Body2" }),
51
+ /* @__PURE__ */ jsx(Text.Caption, { children: "Text Caption" }),
52
+ /* @__PURE__ */ jsx(Text.Overline, { children: "Text Overline" }),
53
+ /* @__PURE__ */ jsx(Text.SectionTitle, { children: "Text SectionTitle" }),
54
+ /* @__PURE__ */ jsx(Text.SmallestException, { children: "Text SmallestException" }),
55
+ /* @__PURE__ */ jsx(Text, { children: "Text" }),
56
+ /* @__PURE__ */ jsx(Text.Small, { children: "Text Small" }),
57
+ /* @__PURE__ */ jsx(Text.Tiny, { children: "Text Tiny" }),
58
+ /* @__PURE__ */ jsx(Text.Regular, { children: "Text Regular" }),
59
+ /* @__PURE__ */ jsx(Text.Medium, { children: "Text Medium" }),
60
+ /* @__PURE__ */ jsx(Text.Bold, { children: "Text Bold" }),
61
+ /* @__PURE__ */ jsx(Text.Black, { children: "Text Black" })
62
+ ] })
63
+ );
64
+ expect(toJSON()).toMatchSnapshot();
65
+ });
37
66
  it("should match snapshot with Text variant", () => {
38
67
  const { toJSON } = render(
39
68
  /* @__PURE__ */ jsxs(ThemeProvider, { children: [
@@ -1,5 +1,8 @@
1
1
  import { css } from "styled-components";
2
2
  import defaultStyle from "./sharedTextStyle";
3
+ const formatFontFamily = (fontFamily, fontWeight) => {
4
+ return fontWeight === 400 ? fontFamily : `${fontFamily}-${fontWeight}`;
5
+ };
3
6
  const textStyle = (type) => () => css`
4
7
  ${defaultStyle(type)};
5
8
  ${({
@@ -8,26 +11,20 @@ const textStyle = (type) => () => css`
8
11
  theme: {
9
12
  yoga: {
10
13
  baseFont,
11
- fontWeights,
12
- components: {
13
- text: {
14
- [type]: { fontFamily, fontWeight }
15
- }
16
- }
14
+ components: { text }
17
15
  }
18
16
  }
19
17
  }) => {
20
- let finalFontFamily;
21
- if (fontFamily) {
22
- finalFontFamily = `${fontFamily}-${fontWeight}`;
23
- } else {
24
- finalFontFamily = fontWeight === 400 ? baseFont.family : `${baseFont.family}-${fontWeight}`;
18
+ const fontFamily = text[type].fontFamily || baseFont.family;
19
+ let finalFontWeight = text[type].fontWeight;
20
+ if (light && text[`${type}-light`]) {
21
+ finalFontWeight = text[`${type}-light`].fontWeight;
22
+ }
23
+ if (bold && text[`${type}-bold`]) {
24
+ finalFontWeight = text[`${type}-bold`].fontWeight;
25
25
  }
26
26
  return css`
27
- font-family: '${finalFontFamily}';
28
-
29
- ${light ? `font-family: ${baseFont.family}-${fontWeights.light};` : ""}
30
- ${bold ? `font-family: ${baseFont.family}-${fontWeights.bold};` : ""}
27
+ font-family: '${formatFontFamily(fontFamily, finalFontWeight)}';
31
28
  `;
32
29
  }}
33
30
  `;
@@ -8,21 +8,21 @@ const textStyle = (type) => () => css`
8
8
  theme: {
9
9
  yoga: {
10
10
  baseFont,
11
- fontWeights,
12
- components: {
13
- text: {
14
- [type]: { fontFamily, fontWeight }
15
- }
16
- }
11
+ components: { text }
17
12
  }
18
13
  }
19
14
  }) => {
20
- const finalFontFamily = fontFamily || baseFont.family;
15
+ const fontFamily = text[type].fontFamily || baseFont.family;
16
+ let finalFontWeight = text[type].fontWeight;
17
+ if (light && text[`${type}-light`]) {
18
+ finalFontWeight = text[`${type}-light`].fontWeight;
19
+ }
20
+ if (bold && text[`${type}-bold`]) {
21
+ finalFontWeight = text[`${type}-bold`].fontWeight;
22
+ }
21
23
  return css`
22
- font-family: ${finalFontFamily};
23
- ${fontWeight ? `font-weight: ${fontWeight};` : ""}
24
- ${light ? `font-weight: ${fontWeights.light};` : ""}
25
- ${bold ? `font-weight: ${fontWeights.bold};` : ""}
24
+ font-family: ${fontFamily};
25
+ ${finalFontWeight ? `font-weight: ${finalFontWeight};` : ""}
26
26
  `;
27
27
  }}
28
28
  `;