@gympass/yoga 7.96.1 → 7.96.2

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.
@@ -65,11 +65,17 @@ var import_react = __toESM(require("react"));
65
65
  var import_prop_types = require("prop-types");
66
66
  var import_styled_components = __toESM(require("styled-components"));
67
67
  var import_react_native = require("react-native");
68
+ var import_yoga_common = require("@gympass/yoga-common");
68
69
  var import_Counter = __toESM(require("./Counter"));
69
70
  var import_Theme = require("../../Theme");
70
71
  var import_Text = __toESM(require("../../Text"));
71
72
  var import_Icon = __toESM(require("../../Icon"));
72
- const Wrapper = import_styled_components.default.View`
73
+ const BORDER_OPACITY = 0.4;
74
+ const Wrapper = import_styled_components.default.View.attrs(({ theme: { yoga } }) => {
75
+ return {
76
+ borderColor: (0, import_yoga_common.hexToRgb)(yoga.colors.secondary, BORDER_OPACITY)
77
+ };
78
+ })`
73
79
  height: 32px;
74
80
  max-width: 216px;
75
81
 
@@ -78,10 +84,9 @@ const Wrapper = import_styled_components.default.View`
78
84
  justify-content: flex-start;
79
85
 
80
86
  margin-right: ${import_Theme.theme.spacing.xxsmall}px;
81
- padding: ${import_Theme.theme.spacing.xxsmall}px;
87
+ padding: ${import_Theme.theme.spacing.xxxsmall}px ${import_Theme.theme.spacing.xsmall}px;
82
88
 
83
89
  border-style: solid;
84
- border-color: ${import_Theme.theme.colors.elements.lineAndBorders};
85
90
  border-radius: ${import_Theme.theme.radii.circle}px;
86
91
  border-width: ${import_Theme.theme.borders.small}px;
87
92
 
@@ -91,22 +96,27 @@ const Wrapper = import_styled_components.default.View`
91
96
 
92
97
  ${({ disabled }) => disabled ? import_styled_components.css`
93
98
  background-color: ${import_Theme.theme.colors.elements.backgroundAndDisabled};
94
- color: ${import_Theme.theme.colors.elements.selectionAndIcons};
95
-
96
- border-color: ${import_Theme.theme.colors.elements.lineAndBorders};
99
+ border-color: ${import_Theme.theme.colors.elements.backgroundAndDisabled};
97
100
  ` : ""}
98
101
 
99
102
  ${({ selected }) => selected ? import_styled_components.css`
100
103
  background-color: ${import_Theme.theme.colors.secondary};
101
- border-color: transparent;
104
+ ` : ""}
105
+
106
+ ${({ justAnIcon }) => justAnIcon ? import_styled_components.css`
107
+ padding: ${import_Theme.theme.spacing.xxsmall}px;
102
108
  ` : ""}
103
109
  `;
104
110
  const StyledChips = (0, import_styled_components.default)(import_Text.default)`
105
111
  font-size: ${import_Theme.theme.fontSizes.xsmall}px;
106
- line-height: ${import_Theme.theme.lineHeights.xxsmall}px;
112
+ line-height: ${import_Theme.theme.lineHeights.xsmall}px;
107
113
 
108
114
  flex-shrink: 1;
109
115
 
116
+ ${({ disabled }) => disabled ? import_styled_components.css`
117
+ color: ${import_Theme.theme.colors.text.disabled};
118
+ ` : ""}
119
+
110
120
  ${({ selected }) => selected ? import_styled_components.css`
111
121
  color: ${import_Theme.theme.colors.white};
112
122
  ` : ""}
@@ -122,7 +132,7 @@ const Chips = import_react.default.forwardRef(
122
132
  onToggle,
123
133
  onPress = onToggle,
124
134
  theme: {
125
- yoga: { spacing }
135
+ yoga: { spacing, colors }
126
136
  }
127
137
  } = _b, props = __objRest(_b, [
128
138
  "children",
@@ -135,6 +145,9 @@ const Chips = import_react.default.forwardRef(
135
145
  "theme"
136
146
  ]);
137
147
  const [FirstIcon, SecondIcon] = icons;
148
+ const justAnIcon = (icons[0] || icons[1]) && !children;
149
+ const fillSelected = selected ? "white" : "secondary";
150
+ const fillIcon = disabled ? colors.text.disabled : fillSelected;
138
151
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
139
152
  import_react_native.TouchableWithoutFeedback,
140
153
  __spreadProps(__spreadValues({
@@ -142,42 +155,51 @@ const Chips = import_react.default.forwardRef(
142
155
  ref,
143
156
  accessibilityRole: "button"
144
157
  }, props), {
145
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, { disabled, selected, children: [
146
- SecondIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
147
- import_Icon.default,
148
- {
149
- as: SecondIcon,
150
- fill: selected ? "white" : "secondary",
151
- width: "small",
152
- height: "small",
153
- style: {
154
- marginRight: children ? spacing.xxxsmall : void 0
155
- }
156
- }
157
- ),
158
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
159
- StyledChips,
160
- {
161
- as: selected ? import_Text.default.Medium : import_Text.default,
162
- selected,
163
- numberOfLines: 1,
164
- children
165
- }
166
- ),
167
- selected && counter && !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Counter.default, { value: counter }),
168
- FirstIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
169
- import_Icon.default,
170
- {
171
- as: FirstIcon,
172
- fill: selected ? "white" : "secondary",
173
- width: "small",
174
- height: "small",
175
- style: {
176
- marginLeft: children ? spacing.xxxsmall : void 0
177
- }
178
- }
179
- )
180
- ] })
158
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
159
+ Wrapper,
160
+ {
161
+ disabled,
162
+ selected,
163
+ justAnIcon,
164
+ children: [
165
+ SecondIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
166
+ import_Icon.default,
167
+ {
168
+ as: SecondIcon,
169
+ fill: fillIcon,
170
+ width: "small",
171
+ height: "small",
172
+ style: {
173
+ marginRight: children ? spacing.xxxsmall : void 0
174
+ }
175
+ }
176
+ ),
177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
178
+ StyledChips,
179
+ {
180
+ disabled,
181
+ as: selected ? import_Text.default.Bold : import_Text.default,
182
+ selected,
183
+ numberOfLines: 1,
184
+ children
185
+ }
186
+ ),
187
+ selected && counter && !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Counter.default, { value: counter }),
188
+ FirstIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
189
+ import_Icon.default,
190
+ {
191
+ as: FirstIcon,
192
+ fill: fillIcon,
193
+ width: "small",
194
+ height: "small",
195
+ style: {
196
+ marginLeft: children ? spacing.xxxsmall : void 0
197
+ }
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ )
181
203
  })
182
204
  );
183
205
  }
@@ -68,6 +68,8 @@ var import_yoga_common = require("@gympass/yoga-common");
68
68
  var import_Theme = require("../../Theme");
69
69
  var import_Icon = __toESM(require("../../Icon"));
70
70
  var import_Counter = __toESM(require("./Counter"));
71
+ const BORDER_OPACITY = 0.4;
72
+ const BORDER_PRESSED_OPACITY = 0.6;
71
73
  const Text = import_styled_components.default.span`
72
74
  display: inline-block;
73
75
  box-sizing: border-box;
@@ -89,7 +91,7 @@ const Wrapper = import_styled_components.default.button`
89
91
  cursor: pointer;
90
92
 
91
93
  ${(_a) => {
92
- var _b = _a, { selected } = _b, props = __objRest(_b, ["selected"]);
94
+ var _b = _a, { selected, justAnIcon } = _b, props = __objRest(_b, ["selected", "justAnIcon"]);
93
95
  const {
94
96
  spacing,
95
97
  borders,
@@ -102,7 +104,7 @@ const Wrapper = import_styled_components.default.button`
102
104
  } = (0, import_Theme.theme)(props);
103
105
  const commonStyles = `
104
106
 
105
- padding: ${spacing.xxsmall}px;
107
+ padding: ${justAnIcon ? `${spacing.xxsmall}px` : `${spacing.xxsmall}px ${spacing.xsmall}px`};
106
108
 
107
109
  border-radius: ${radii.circle}px;
108
110
  border-width: ${borders.small}px;
@@ -117,11 +119,15 @@ const Wrapper = import_styled_components.default.button`
117
119
 
118
120
  &[disabled] {
119
121
  background-color: ${colors.elements.backgroundAndDisabled};
120
- color: ${colors.elements.selectionAndIcons};
122
+ color: ${colors.text.disabled};
121
123
 
122
- border-color: ${colors.elements.lineAndBorders};
124
+ border-color: ${colors.elements.backgroundAndDisabled};
123
125
 
124
126
  cursor: not-allowed;
127
+
128
+ svg {
129
+ fill: ${colors.text.disabled};
130
+ }
125
131
  }
126
132
 
127
133
  svg {
@@ -137,17 +143,25 @@ const Wrapper = import_styled_components.default.button`
137
143
 
138
144
  border-color: transparent;
139
145
 
140
- font-weight: ${fontWeights.medium};
146
+ font-weight: ${fontWeights.bold};
141
147
 
142
148
  &:hover:enabled {
143
149
  border-color: ${colors.secondary};
144
150
  }
151
+
152
+ &:active:enabled {
153
+ background-color: ${(0, import_yoga_common.hexToRgb)(
154
+ colors.secondary,
155
+ BORDER_PRESSED_OPACITY
156
+ )};
157
+ border-color: transparent;
158
+ }
145
159
  `;
146
160
  }
147
161
  return `
148
162
  ${commonStyles}
149
163
 
150
- border-color: ${colors.elements.lineAndBorders};
164
+ border-color: ${(0, import_yoga_common.hexToRgb)(colors.secondary, BORDER_OPACITY)};
151
165
 
152
166
  background-color: ${colors.white};
153
167
  color: ${colors.secondary};
@@ -158,9 +172,13 @@ const Wrapper = import_styled_components.default.button`
158
172
  border-color: ${colors.secondary};
159
173
  }
160
174
 
161
- &:focus:enabled,
162
175
  &:active:enabled {
163
- border-color: ${(0, import_yoga_common.hexToRgb)(colors.elements.lineAndBorders, 0.75)};
176
+ border-color: ${(0, import_yoga_common.hexToRgb)(colors.secondary, BORDER_PRESSED_OPACITY)};
177
+ color: ${(0, import_yoga_common.hexToRgb)(colors.secondary, BORDER_PRESSED_OPACITY)};
178
+
179
+ svg {
180
+ fill: ${(0, import_yoga_common.hexToRgb)(colors.secondary, BORDER_PRESSED_OPACITY)};
181
+ }
164
182
  }
165
183
  `;
166
184
  }}
@@ -189,6 +207,7 @@ const Chips = import_react.default.forwardRef(
189
207
  "theme"
190
208
  ]);
191
209
  const [FirstIcon, SecondIcon] = icons;
210
+ const justAnIcon = (icons[0] || icons[1]) && !children;
192
211
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
193
212
  Wrapper,
194
213
  __spreadProps(__spreadValues({
@@ -196,6 +215,7 @@ const Chips = import_react.default.forwardRef(
196
215
  disabled,
197
216
  onClick,
198
217
  ref,
218
+ justAnIcon,
199
219
  type: "button"
200
220
  }, props), {
201
221
  children: [
@@ -34,11 +34,17 @@ import React from "react";
34
34
  import { number, arrayOf, bool, func, node } from "prop-types";
35
35
  import styled, { css, withTheme } from "styled-components";
36
36
  import { TouchableWithoutFeedback } from "react-native";
37
+ import { hexToRgb } from "@gympass/yoga-common";
37
38
  import Counter from "./Counter";
38
39
  import { theme } from "../../Theme";
39
40
  import Text from "../../Text";
40
41
  import Icon from "../../Icon";
41
- const Wrapper = styled.View`
42
+ const BORDER_OPACITY = 0.4;
43
+ const Wrapper = styled.View.attrs(({ theme: { yoga } }) => {
44
+ return {
45
+ borderColor: hexToRgb(yoga.colors.secondary, BORDER_OPACITY)
46
+ };
47
+ })`
42
48
  height: 32px;
43
49
  max-width: 216px;
44
50
 
@@ -47,10 +53,9 @@ const Wrapper = styled.View`
47
53
  justify-content: flex-start;
48
54
 
49
55
  margin-right: ${theme.spacing.xxsmall}px;
50
- padding: ${theme.spacing.xxsmall}px;
56
+ padding: ${theme.spacing.xxxsmall}px ${theme.spacing.xsmall}px;
51
57
 
52
58
  border-style: solid;
53
- border-color: ${theme.colors.elements.lineAndBorders};
54
59
  border-radius: ${theme.radii.circle}px;
55
60
  border-width: ${theme.borders.small}px;
56
61
 
@@ -60,22 +65,27 @@ const Wrapper = styled.View`
60
65
 
61
66
  ${({ disabled }) => disabled ? css`
62
67
  background-color: ${theme.colors.elements.backgroundAndDisabled};
63
- color: ${theme.colors.elements.selectionAndIcons};
64
-
65
- border-color: ${theme.colors.elements.lineAndBorders};
68
+ border-color: ${theme.colors.elements.backgroundAndDisabled};
66
69
  ` : ""}
67
70
 
68
71
  ${({ selected }) => selected ? css`
69
72
  background-color: ${theme.colors.secondary};
70
- border-color: transparent;
73
+ ` : ""}
74
+
75
+ ${({ justAnIcon }) => justAnIcon ? css`
76
+ padding: ${theme.spacing.xxsmall}px;
71
77
  ` : ""}
72
78
  `;
73
79
  const StyledChips = styled(Text)`
74
80
  font-size: ${theme.fontSizes.xsmall}px;
75
- line-height: ${theme.lineHeights.xxsmall}px;
81
+ line-height: ${theme.lineHeights.xsmall}px;
76
82
 
77
83
  flex-shrink: 1;
78
84
 
85
+ ${({ disabled }) => disabled ? css`
86
+ color: ${theme.colors.text.disabled};
87
+ ` : ""}
88
+
79
89
  ${({ selected }) => selected ? css`
80
90
  color: ${theme.colors.white};
81
91
  ` : ""}
@@ -91,7 +101,7 @@ const Chips = React.forwardRef(
91
101
  onToggle,
92
102
  onPress = onToggle,
93
103
  theme: {
94
- yoga: { spacing }
104
+ yoga: { spacing, colors }
95
105
  }
96
106
  } = _b, props = __objRest(_b, [
97
107
  "children",
@@ -104,6 +114,9 @@ const Chips = React.forwardRef(
104
114
  "theme"
105
115
  ]);
106
116
  const [FirstIcon, SecondIcon] = icons;
117
+ const justAnIcon = (icons[0] || icons[1]) && !children;
118
+ const fillSelected = selected ? "white" : "secondary";
119
+ const fillIcon = disabled ? colors.text.disabled : fillSelected;
107
120
  return /* @__PURE__ */ jsx(
108
121
  TouchableWithoutFeedback,
109
122
  __spreadProps(__spreadValues({
@@ -111,42 +124,51 @@ const Chips = React.forwardRef(
111
124
  ref,
112
125
  accessibilityRole: "button"
113
126
  }, props), {
114
- children: /* @__PURE__ */ jsxs(Wrapper, { disabled, selected, children: [
115
- SecondIcon && /* @__PURE__ */ jsx(
116
- Icon,
117
- {
118
- as: SecondIcon,
119
- fill: selected ? "white" : "secondary",
120
- width: "small",
121
- height: "small",
122
- style: {
123
- marginRight: children ? spacing.xxxsmall : void 0
124
- }
125
- }
126
- ),
127
- /* @__PURE__ */ jsx(
128
- StyledChips,
129
- {
130
- as: selected ? Text.Medium : Text,
131
- selected,
132
- numberOfLines: 1,
133
- children
134
- }
135
- ),
136
- selected && counter && !disabled && /* @__PURE__ */ jsx(Counter, { value: counter }),
137
- FirstIcon && /* @__PURE__ */ jsx(
138
- Icon,
139
- {
140
- as: FirstIcon,
141
- fill: selected ? "white" : "secondary",
142
- width: "small",
143
- height: "small",
144
- style: {
145
- marginLeft: children ? spacing.xxxsmall : void 0
146
- }
147
- }
148
- )
149
- ] })
127
+ children: /* @__PURE__ */ jsxs(
128
+ Wrapper,
129
+ {
130
+ disabled,
131
+ selected,
132
+ justAnIcon,
133
+ children: [
134
+ SecondIcon && /* @__PURE__ */ jsx(
135
+ Icon,
136
+ {
137
+ as: SecondIcon,
138
+ fill: fillIcon,
139
+ width: "small",
140
+ height: "small",
141
+ style: {
142
+ marginRight: children ? spacing.xxxsmall : void 0
143
+ }
144
+ }
145
+ ),
146
+ /* @__PURE__ */ jsx(
147
+ StyledChips,
148
+ {
149
+ disabled,
150
+ as: selected ? Text.Bold : Text,
151
+ selected,
152
+ numberOfLines: 1,
153
+ children
154
+ }
155
+ ),
156
+ selected && counter && !disabled && /* @__PURE__ */ jsx(Counter, { value: counter }),
157
+ FirstIcon && /* @__PURE__ */ jsx(
158
+ Icon,
159
+ {
160
+ as: FirstIcon,
161
+ fill: fillIcon,
162
+ width: "small",
163
+ height: "small",
164
+ style: {
165
+ marginLeft: children ? spacing.xxxsmall : void 0
166
+ }
167
+ }
168
+ )
169
+ ]
170
+ }
171
+ )
150
172
  })
151
173
  );
152
174
  }
@@ -37,6 +37,8 @@ import { hexToRgb } from "@gympass/yoga-common";
37
37
  import { theme } from "../../Theme";
38
38
  import Icon from "../../Icon";
39
39
  import Counter from "./Counter";
40
+ const BORDER_OPACITY = 0.4;
41
+ const BORDER_PRESSED_OPACITY = 0.6;
40
42
  const Text = styled.span`
41
43
  display: inline-block;
42
44
  box-sizing: border-box;
@@ -58,7 +60,7 @@ const Wrapper = styled.button`
58
60
  cursor: pointer;
59
61
 
60
62
  ${(_a) => {
61
- var _b = _a, { selected } = _b, props = __objRest(_b, ["selected"]);
63
+ var _b = _a, { selected, justAnIcon } = _b, props = __objRest(_b, ["selected", "justAnIcon"]);
62
64
  const {
63
65
  spacing,
64
66
  borders,
@@ -71,7 +73,7 @@ const Wrapper = styled.button`
71
73
  } = theme(props);
72
74
  const commonStyles = `
73
75
 
74
- padding: ${spacing.xxsmall}px;
76
+ padding: ${justAnIcon ? `${spacing.xxsmall}px` : `${spacing.xxsmall}px ${spacing.xsmall}px`};
75
77
 
76
78
  border-radius: ${radii.circle}px;
77
79
  border-width: ${borders.small}px;
@@ -86,11 +88,15 @@ const Wrapper = styled.button`
86
88
 
87
89
  &[disabled] {
88
90
  background-color: ${colors.elements.backgroundAndDisabled};
89
- color: ${colors.elements.selectionAndIcons};
91
+ color: ${colors.text.disabled};
90
92
 
91
- border-color: ${colors.elements.lineAndBorders};
93
+ border-color: ${colors.elements.backgroundAndDisabled};
92
94
 
93
95
  cursor: not-allowed;
96
+
97
+ svg {
98
+ fill: ${colors.text.disabled};
99
+ }
94
100
  }
95
101
 
96
102
  svg {
@@ -106,17 +112,25 @@ const Wrapper = styled.button`
106
112
 
107
113
  border-color: transparent;
108
114
 
109
- font-weight: ${fontWeights.medium};
115
+ font-weight: ${fontWeights.bold};
110
116
 
111
117
  &:hover:enabled {
112
118
  border-color: ${colors.secondary};
113
119
  }
120
+
121
+ &:active:enabled {
122
+ background-color: ${hexToRgb(
123
+ colors.secondary,
124
+ BORDER_PRESSED_OPACITY
125
+ )};
126
+ border-color: transparent;
127
+ }
114
128
  `;
115
129
  }
116
130
  return `
117
131
  ${commonStyles}
118
132
 
119
- border-color: ${colors.elements.lineAndBorders};
133
+ border-color: ${hexToRgb(colors.secondary, BORDER_OPACITY)};
120
134
 
121
135
  background-color: ${colors.white};
122
136
  color: ${colors.secondary};
@@ -127,9 +141,13 @@ const Wrapper = styled.button`
127
141
  border-color: ${colors.secondary};
128
142
  }
129
143
 
130
- &:focus:enabled,
131
144
  &:active:enabled {
132
- border-color: ${hexToRgb(colors.elements.lineAndBorders, 0.75)};
145
+ border-color: ${hexToRgb(colors.secondary, BORDER_PRESSED_OPACITY)};
146
+ color: ${hexToRgb(colors.secondary, BORDER_PRESSED_OPACITY)};
147
+
148
+ svg {
149
+ fill: ${hexToRgb(colors.secondary, BORDER_PRESSED_OPACITY)};
150
+ }
133
151
  }
134
152
  `;
135
153
  }}
@@ -158,6 +176,7 @@ const Chips = React.forwardRef(
158
176
  "theme"
159
177
  ]);
160
178
  const [FirstIcon, SecondIcon] = icons;
179
+ const justAnIcon = (icons[0] || icons[1]) && !children;
161
180
  return /* @__PURE__ */ jsxs(
162
181
  Wrapper,
163
182
  __spreadProps(__spreadValues({
@@ -165,6 +184,7 @@ const Chips = React.forwardRef(
165
184
  disabled,
166
185
  onClick,
167
186
  ref,
187
+ justAnIcon,
168
188
  type: "button"
169
189
  }, props), {
170
190
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gympass/yoga",
3
- "version": "7.96.1",
3
+ "version": "7.96.2",
4
4
  "description": "Gympass component library",
5
5
  "main": "./cjs",
6
6
  "types": "./typings/index.d.ts",
@@ -57,7 +57,7 @@
57
57
  "react-native": "0.72.3",
58
58
  "styled-components": "^4.4.0"
59
59
  },
60
- "gitHead": "a16ac9a9aec864b53a8f40a720d72e7366c2a1d9",
60
+ "gitHead": "3c29667a48ee7711af163e79795737495861eda3",
61
61
  "module": "./esm",
62
62
  "private": false,
63
63
  "react-native": "./cjs/index.native.js"