@gympass/yoga 7.113.1 → 7.114.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.
- package/cjs/Button/Button.theme.js +7 -1
- package/cjs/Button/index.native.js +2 -0
- package/cjs/Button/native/Button.test.js +38 -0
- package/cjs/Button/native/Outline.js +222 -0
- package/cjs/Card/native/EventCard/EventCard.js +9 -10
- package/esm/Button/Button.theme.js +7 -1
- package/esm/Button/index.native.js +2 -0
- package/esm/Button/native/Button.test.js +38 -0
- package/esm/Button/native/Outline.js +194 -0
- package/esm/Card/native/EventCard/EventCard.js +9 -10
- package/package.json +2 -2
|
@@ -104,7 +104,10 @@ const Button = ({
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
border: {
|
|
107
|
-
width: borders.small
|
|
107
|
+
width: borders.small,
|
|
108
|
+
color: {
|
|
109
|
+
disabled: colors.elements.backgroundAndDisabled
|
|
110
|
+
}
|
|
108
111
|
},
|
|
109
112
|
font: {
|
|
110
113
|
default: {
|
|
@@ -118,6 +121,9 @@ const Button = ({
|
|
|
118
121
|
disabled: {
|
|
119
122
|
color: colors.text.disabled
|
|
120
123
|
},
|
|
124
|
+
inverted: {
|
|
125
|
+
color: colors.text.primary
|
|
126
|
+
},
|
|
121
127
|
hover: {
|
|
122
128
|
color: colors.white
|
|
123
129
|
},
|
|
@@ -35,7 +35,9 @@ var import_Button = __toESM(require("./native/Button"));
|
|
|
35
35
|
var import_Text = __toESM(require("./native/Text"));
|
|
36
36
|
var import_Link = __toESM(require("./native/Link"));
|
|
37
37
|
var import_Icon = __toESM(require("./native/Icon"));
|
|
38
|
+
var import_Outline = __toESM(require("./native/Outline"));
|
|
38
39
|
import_Button.default.Text = import_Text.default;
|
|
39
40
|
import_Button.default.Link = import_Link.default;
|
|
40
41
|
import_Button.default.Icon = import_Icon.default;
|
|
42
|
+
import_Button.default.Outline = import_Outline.default;
|
|
41
43
|
var index_native_default = import_Button.default;
|
|
@@ -183,6 +183,12 @@ describe("<Button />", () => {
|
|
|
183
183
|
);
|
|
184
184
|
expect(toJSON()).toMatchSnapshot();
|
|
185
185
|
});
|
|
186
|
+
it("should match snapshot with outline Button", () => {
|
|
187
|
+
const { toJSON } = (0, import_react_native.render)(
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Outline, { secondary: true }) })
|
|
189
|
+
);
|
|
190
|
+
expect(toJSON()).toMatchSnapshot();
|
|
191
|
+
});
|
|
186
192
|
it("should match snapshot with default Button with Icon", () => {
|
|
187
193
|
const { toJSON } = (0, import_react_native.render)(
|
|
188
194
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { icon: import_yoga_icons.Booking, secondary: true }) })
|
|
@@ -215,6 +221,12 @@ describe("<Button />", () => {
|
|
|
215
221
|
);
|
|
216
222
|
expect(toJSON()).toMatchSnapshot();
|
|
217
223
|
});
|
|
224
|
+
it("should match snapshot with outline Button", () => {
|
|
225
|
+
const { toJSON } = (0, import_react_native.render)(
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Outline, { inverted: true, secondary: true }) })
|
|
227
|
+
);
|
|
228
|
+
expect(toJSON()).toMatchSnapshot();
|
|
229
|
+
});
|
|
218
230
|
it("should match snapshot with default Button with Icon", () => {
|
|
219
231
|
const { toJSON } = (0, import_react_native.render)(
|
|
220
232
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { inverted: true, icon: import_yoga_icons.Booking, secondary: true }) })
|
|
@@ -247,6 +259,12 @@ describe("<Button />", () => {
|
|
|
247
259
|
);
|
|
248
260
|
expect(toJSON()).toMatchSnapshot();
|
|
249
261
|
});
|
|
262
|
+
it("should match snapshot with outline Button", () => {
|
|
263
|
+
const { toJSON } = (0, import_react_native.render)(
|
|
264
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Outline, { small: true, secondary: true }) })
|
|
265
|
+
);
|
|
266
|
+
expect(toJSON()).toMatchSnapshot();
|
|
267
|
+
});
|
|
250
268
|
it("should match snapshot with default Button with Icon", () => {
|
|
251
269
|
const { toJSON } = (0, import_react_native.render)(
|
|
252
270
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { small: true, icon: import_yoga_icons.Booking, secondary: true }) })
|
|
@@ -273,6 +291,12 @@ describe("<Button />", () => {
|
|
|
273
291
|
);
|
|
274
292
|
expect(toJSON()).toMatchSnapshot();
|
|
275
293
|
});
|
|
294
|
+
it("should match snapshot with outline Button", () => {
|
|
295
|
+
const { toJSON } = (0, import_react_native.render)(
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Outline, { full: true, secondary: true }) })
|
|
297
|
+
);
|
|
298
|
+
expect(toJSON()).toMatchSnapshot();
|
|
299
|
+
});
|
|
276
300
|
it("should match snapshot with default Button with Icon", () => {
|
|
277
301
|
const { toJSON } = (0, import_react_native.render)(
|
|
278
302
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { full: true, icon: import_yoga_icons.Booking, secondary: true }) })
|
|
@@ -315,6 +339,12 @@ describe("<Button />", () => {
|
|
|
315
339
|
);
|
|
316
340
|
expect(toJSON()).toMatchSnapshot();
|
|
317
341
|
});
|
|
342
|
+
it("should match snapshot with outline Button", () => {
|
|
343
|
+
const { toJSON } = (0, import_react_native.render)(
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Outline, { disabled: true }) })
|
|
345
|
+
);
|
|
346
|
+
expect(toJSON()).toMatchSnapshot();
|
|
347
|
+
});
|
|
318
348
|
it("should match snapshot with default Button with Icon", () => {
|
|
319
349
|
const { toJSON } = (0, import_react_native.render)(
|
|
320
350
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { disabled: true, icon: import_yoga_icons.Booking }) })
|
|
@@ -361,6 +391,14 @@ describe("<Button />", () => {
|
|
|
361
391
|
import_react_native.fireEvent.press(getByRole("button"));
|
|
362
392
|
expect(onPressMock).toHaveBeenCalled();
|
|
363
393
|
});
|
|
394
|
+
it("should call onPress function when press on Button.Outline", () => {
|
|
395
|
+
const onPressMock = jest.fn();
|
|
396
|
+
const { getByRole } = (0, import_react_native.render)(
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default.Outline, { onPress: onPressMock }) })
|
|
398
|
+
);
|
|
399
|
+
import_react_native.fireEvent.press(getByRole("button"));
|
|
400
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
401
|
+
});
|
|
364
402
|
it("should not call onPress function when press on Button disabled", () => {
|
|
365
403
|
const onPressMock = jest.fn();
|
|
366
404
|
const { getByText } = (0, import_react_native.render)(
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
var Outline_exports = {};
|
|
59
|
+
__export(Outline_exports, {
|
|
60
|
+
default: () => Outline_default
|
|
61
|
+
});
|
|
62
|
+
module.exports = __toCommonJS(Outline_exports);
|
|
63
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
64
|
+
var import_react = __toESM(require("react"));
|
|
65
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
66
|
+
var import_prop_types = require("prop-types");
|
|
67
|
+
var import_yoga_common = require("@gympass/yoga-common");
|
|
68
|
+
var import_withTouchable = __toESM(require("./withTouchable"));
|
|
69
|
+
var import_Button = require("./Button");
|
|
70
|
+
const getInvertedStyles = ({ outline, pressed, white, disabled }) => {
|
|
71
|
+
const newStyles = {};
|
|
72
|
+
if (disabled) {
|
|
73
|
+
newStyles.backgroundColor = white;
|
|
74
|
+
newStyles.borderColor = outline.border.color.disabled;
|
|
75
|
+
}
|
|
76
|
+
if (!disabled && pressed) {
|
|
77
|
+
newStyles.backgroundColor = (0, import_yoga_common.hexToRgb)(white, 0.75);
|
|
78
|
+
newStyles.borderColor = "transparent";
|
|
79
|
+
}
|
|
80
|
+
return __spreadValues({
|
|
81
|
+
backgroundColor: outline.backgroundColor.default,
|
|
82
|
+
borderColor: white,
|
|
83
|
+
borderWidth: outline.border.width
|
|
84
|
+
}, newStyles);
|
|
85
|
+
};
|
|
86
|
+
const getDisabledStyles = ({ outline }) => {
|
|
87
|
+
return {
|
|
88
|
+
backgroundColor: outline.backgroundColor.default,
|
|
89
|
+
borderColor: outline.border.color.disabled,
|
|
90
|
+
borderWidth: outline.border.width
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const getStyles = ({ outline, pressed, secondary }) => {
|
|
94
|
+
const state = secondary ? "secondary" : "primary";
|
|
95
|
+
const newStyles = {};
|
|
96
|
+
if (pressed) {
|
|
97
|
+
newStyles.backgroundColor = outline.font.pressed[state].color;
|
|
98
|
+
newStyles.borderColor = "transparent";
|
|
99
|
+
}
|
|
100
|
+
return __spreadValues({
|
|
101
|
+
backgroundColor: outline.backgroundColor.default,
|
|
102
|
+
borderColor: outline.font.default[state].color,
|
|
103
|
+
borderWidth: outline.border.width
|
|
104
|
+
}, newStyles);
|
|
105
|
+
};
|
|
106
|
+
const LabelText = (0, import_styled_components.default)(import_Button.Label)`
|
|
107
|
+
${({ color }) => `
|
|
108
|
+
color: ${color};
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
`},
|
|
111
|
+
`;
|
|
112
|
+
const ButtonContainerOutline = (0, import_styled_components.default)(import_Button.ButtonContainer)`
|
|
113
|
+
${({
|
|
114
|
+
secondary,
|
|
115
|
+
inverted,
|
|
116
|
+
disabled,
|
|
117
|
+
pressed,
|
|
118
|
+
theme: {
|
|
119
|
+
yoga: {
|
|
120
|
+
colors: { white },
|
|
121
|
+
components: {
|
|
122
|
+
button: {
|
|
123
|
+
types: { outline }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}) => {
|
|
129
|
+
if (inverted) {
|
|
130
|
+
return getInvertedStyles({ outline, pressed, white, disabled });
|
|
131
|
+
}
|
|
132
|
+
if (disabled) {
|
|
133
|
+
return getDisabledStyles({ outline });
|
|
134
|
+
}
|
|
135
|
+
return getStyles({ outline, pressed, secondary });
|
|
136
|
+
}}}
|
|
137
|
+
`;
|
|
138
|
+
const ButtonOutline = (0, import_react.forwardRef)(
|
|
139
|
+
(_a, ref) => {
|
|
140
|
+
var _b = _a, {
|
|
141
|
+
children,
|
|
142
|
+
disabled,
|
|
143
|
+
pressed,
|
|
144
|
+
small,
|
|
145
|
+
secondary,
|
|
146
|
+
inverted,
|
|
147
|
+
theme: {
|
|
148
|
+
yoga: {
|
|
149
|
+
colors,
|
|
150
|
+
components: {
|
|
151
|
+
button: {
|
|
152
|
+
types: { outline }
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} = _b, rest = __objRest(_b, [
|
|
158
|
+
"children",
|
|
159
|
+
"disabled",
|
|
160
|
+
"pressed",
|
|
161
|
+
"small",
|
|
162
|
+
"secondary",
|
|
163
|
+
"inverted",
|
|
164
|
+
"theme"
|
|
165
|
+
]);
|
|
166
|
+
const state = secondary ? "secondary" : "primary";
|
|
167
|
+
let textColor = colors[state];
|
|
168
|
+
if (disabled) {
|
|
169
|
+
textColor = outline.font.disabled.color;
|
|
170
|
+
} else if (inverted) {
|
|
171
|
+
textColor = colors.white;
|
|
172
|
+
if (pressed) {
|
|
173
|
+
textColor = outline.font.inverted.color;
|
|
174
|
+
}
|
|
175
|
+
} else if (pressed) {
|
|
176
|
+
textColor = colors.white;
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
179
|
+
ButtonContainerOutline,
|
|
180
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
181
|
+
disabled,
|
|
182
|
+
pressed,
|
|
183
|
+
small,
|
|
184
|
+
secondary,
|
|
185
|
+
inverted,
|
|
186
|
+
accessible: true,
|
|
187
|
+
accessibilityRole: "button",
|
|
188
|
+
ref,
|
|
189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
190
|
+
LabelText,
|
|
191
|
+
{
|
|
192
|
+
disabled,
|
|
193
|
+
pressed,
|
|
194
|
+
small,
|
|
195
|
+
secondary,
|
|
196
|
+
color: textColor,
|
|
197
|
+
children
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
})
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
ButtonOutline.propTypes = {
|
|
205
|
+
children: import_prop_types.node,
|
|
206
|
+
full: import_prop_types.bool,
|
|
207
|
+
disabled: import_prop_types.bool,
|
|
208
|
+
small: import_prop_types.bool,
|
|
209
|
+
pressed: import_prop_types.bool,
|
|
210
|
+
inverted: import_prop_types.bool,
|
|
211
|
+
secondary: import_prop_types.bool
|
|
212
|
+
};
|
|
213
|
+
ButtonOutline.defaultProps = {
|
|
214
|
+
children: "Button",
|
|
215
|
+
full: false,
|
|
216
|
+
disabled: false,
|
|
217
|
+
small: false,
|
|
218
|
+
pressed: false,
|
|
219
|
+
inverted: false,
|
|
220
|
+
secondary: false
|
|
221
|
+
};
|
|
222
|
+
var Outline_default = (0, import_withTouchable.default)((0, import_styled_components.withTheme)(ButtonOutline));
|
|
@@ -71,7 +71,7 @@ var import_Card = __toESM(require("../Card"));
|
|
|
71
71
|
var import_Text = __toESM(require("../../../Text"));
|
|
72
72
|
var import_Box = __toESM(require("../../../Box"));
|
|
73
73
|
var import_Button = __toESM(require("../../../Button"));
|
|
74
|
-
const { spacing, radii,
|
|
74
|
+
const { spacing, radii, colors, borders } = import_themeReader.default;
|
|
75
75
|
const Event = (0, import_styled_components.default)(import_Card.default).attrs({ hasShadow: false })`
|
|
76
76
|
flex-direction: row;
|
|
77
77
|
height: 104px;
|
|
@@ -110,15 +110,14 @@ const Top = (0, import_styled_components.default)(import_Box.default)`
|
|
|
110
110
|
align-items: center;
|
|
111
111
|
height: ${spacing.small}px;
|
|
112
112
|
`;
|
|
113
|
-
const Name = (0, import_styled_components.default)(import_Text.default.
|
|
113
|
+
const Name = (0, import_styled_components.default)(import_Text.default.Body2)`
|
|
114
114
|
margin-bottom: ${spacing.xxxsmall}px;
|
|
115
|
-
line-height: ${lineHeights.small}px;
|
|
116
115
|
`;
|
|
117
|
-
const Place = (0, import_styled_components.default)(import_Text.default.
|
|
116
|
+
const Place = (0, import_styled_components.default)(import_Text.default.Caption)`
|
|
118
117
|
width: 180px;
|
|
119
118
|
margin-bottom: ${spacing.xsmall}px;
|
|
120
119
|
`;
|
|
121
|
-
const Day = (0, import_styled_components.default)(import_Text.default.H5)`
|
|
120
|
+
const Day = (0, import_styled_components.default)(import_Text.default.H5).attrs({ bold: true })`
|
|
122
121
|
margin-top: ${spacing.xxxsmall}px;
|
|
123
122
|
margin-bottom: ${spacing.xxxsmall}px;
|
|
124
123
|
`;
|
|
@@ -155,9 +154,9 @@ const SmallCard = ({
|
|
|
155
154
|
borderRadius: "small",
|
|
156
155
|
bgColor: getIndicatorColor(active, Boolean(event))
|
|
157
156
|
}
|
|
158
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.
|
|
157
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.Caption, { variant: active ? "white" : "deep", children: month }) }),
|
|
159
158
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Day, { variant: active ? "white" : "secondary", children: day }),
|
|
160
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.Caption, { variant: active ? "white" : "deep", children: String(dayOfWeek).toUpperCase() })
|
|
161
160
|
] });
|
|
162
161
|
const FullCard = (0, import_styled_components.withTheme)(
|
|
163
162
|
({
|
|
@@ -176,9 +175,9 @@ const FullCard = (0, import_styled_components.withTheme)(
|
|
|
176
175
|
}
|
|
177
176
|
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
178
177
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DateInfo, { bg: "primary", children: [
|
|
179
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Top, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Top, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.Caption, { inverted: true, children: month }) }),
|
|
180
179
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Day, { inverted: true, children: day }),
|
|
181
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.Caption, { inverted: true, children: String(dayOfWeek).toUpperCase() })
|
|
182
181
|
] }),
|
|
183
182
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EventInfo, { p: "small", pl: "xsmall", children: [
|
|
184
183
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Name, { numberOfLines: 1, size: "small", children: event.name }),
|
|
@@ -186,7 +185,7 @@ const FullCard = (0, import_styled_components.withTheme)(
|
|
|
186
185
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Row, { children: [
|
|
187
186
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EventTime, { children: [
|
|
188
187
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_yoga_icons.Time, { fill: icon.fill, style: { marginRight: 5 } }),
|
|
189
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Text.default.Caption, { children: event.time })
|
|
190
189
|
] }),
|
|
191
190
|
!!link && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonLink, { onPress: onLinkPress, small: true, secondary: true, children: link })
|
|
192
191
|
] })
|
|
@@ -81,7 +81,10 @@ const Button = ({
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
border: {
|
|
84
|
-
width: borders.small
|
|
84
|
+
width: borders.small,
|
|
85
|
+
color: {
|
|
86
|
+
disabled: colors.elements.backgroundAndDisabled
|
|
87
|
+
}
|
|
85
88
|
},
|
|
86
89
|
font: {
|
|
87
90
|
default: {
|
|
@@ -95,6 +98,9 @@ const Button = ({
|
|
|
95
98
|
disabled: {
|
|
96
99
|
color: colors.text.disabled
|
|
97
100
|
},
|
|
101
|
+
inverted: {
|
|
102
|
+
color: colors.text.primary
|
|
103
|
+
},
|
|
98
104
|
hover: {
|
|
99
105
|
color: colors.white
|
|
100
106
|
},
|
|
@@ -2,9 +2,11 @@ import Button from "./native/Button";
|
|
|
2
2
|
import ButtonText from "./native/Text";
|
|
3
3
|
import ButtonLink from "./native/Link";
|
|
4
4
|
import ButtonIcon from "./native/Icon";
|
|
5
|
+
import ButtonOutline from "./native/Outline";
|
|
5
6
|
Button.Text = ButtonText;
|
|
6
7
|
Button.Link = ButtonLink;
|
|
7
8
|
Button.Icon = ButtonIcon;
|
|
9
|
+
Button.Outline = ButtonOutline;
|
|
8
10
|
var index_native_default = Button;
|
|
9
11
|
export {
|
|
10
12
|
index_native_default as default
|
|
@@ -160,6 +160,12 @@ describe("<Button />", () => {
|
|
|
160
160
|
);
|
|
161
161
|
expect(toJSON()).toMatchSnapshot();
|
|
162
162
|
});
|
|
163
|
+
it("should match snapshot with outline Button", () => {
|
|
164
|
+
const { toJSON } = render(
|
|
165
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Outline, { secondary: true }) })
|
|
166
|
+
);
|
|
167
|
+
expect(toJSON()).toMatchSnapshot();
|
|
168
|
+
});
|
|
163
169
|
it("should match snapshot with default Button with Icon", () => {
|
|
164
170
|
const { toJSON } = render(
|
|
165
171
|
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { icon: Booking, secondary: true }) })
|
|
@@ -192,6 +198,12 @@ describe("<Button />", () => {
|
|
|
192
198
|
);
|
|
193
199
|
expect(toJSON()).toMatchSnapshot();
|
|
194
200
|
});
|
|
201
|
+
it("should match snapshot with outline Button", () => {
|
|
202
|
+
const { toJSON } = render(
|
|
203
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Outline, { inverted: true, secondary: true }) })
|
|
204
|
+
);
|
|
205
|
+
expect(toJSON()).toMatchSnapshot();
|
|
206
|
+
});
|
|
195
207
|
it("should match snapshot with default Button with Icon", () => {
|
|
196
208
|
const { toJSON } = render(
|
|
197
209
|
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { inverted: true, icon: Booking, secondary: true }) })
|
|
@@ -224,6 +236,12 @@ describe("<Button />", () => {
|
|
|
224
236
|
);
|
|
225
237
|
expect(toJSON()).toMatchSnapshot();
|
|
226
238
|
});
|
|
239
|
+
it("should match snapshot with outline Button", () => {
|
|
240
|
+
const { toJSON } = render(
|
|
241
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Outline, { small: true, secondary: true }) })
|
|
242
|
+
);
|
|
243
|
+
expect(toJSON()).toMatchSnapshot();
|
|
244
|
+
});
|
|
227
245
|
it("should match snapshot with default Button with Icon", () => {
|
|
228
246
|
const { toJSON } = render(
|
|
229
247
|
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { small: true, icon: Booking, secondary: true }) })
|
|
@@ -250,6 +268,12 @@ describe("<Button />", () => {
|
|
|
250
268
|
);
|
|
251
269
|
expect(toJSON()).toMatchSnapshot();
|
|
252
270
|
});
|
|
271
|
+
it("should match snapshot with outline Button", () => {
|
|
272
|
+
const { toJSON } = render(
|
|
273
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Outline, { full: true, secondary: true }) })
|
|
274
|
+
);
|
|
275
|
+
expect(toJSON()).toMatchSnapshot();
|
|
276
|
+
});
|
|
253
277
|
it("should match snapshot with default Button with Icon", () => {
|
|
254
278
|
const { toJSON } = render(
|
|
255
279
|
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { full: true, icon: Booking, secondary: true }) })
|
|
@@ -292,6 +316,12 @@ describe("<Button />", () => {
|
|
|
292
316
|
);
|
|
293
317
|
expect(toJSON()).toMatchSnapshot();
|
|
294
318
|
});
|
|
319
|
+
it("should match snapshot with outline Button", () => {
|
|
320
|
+
const { toJSON } = render(
|
|
321
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Outline, { disabled: true }) })
|
|
322
|
+
);
|
|
323
|
+
expect(toJSON()).toMatchSnapshot();
|
|
324
|
+
});
|
|
295
325
|
it("should match snapshot with default Button with Icon", () => {
|
|
296
326
|
const { toJSON } = render(
|
|
297
327
|
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button, { disabled: true, icon: Booking }) })
|
|
@@ -338,6 +368,14 @@ describe("<Button />", () => {
|
|
|
338
368
|
fireEvent.press(getByRole("button"));
|
|
339
369
|
expect(onPressMock).toHaveBeenCalled();
|
|
340
370
|
});
|
|
371
|
+
it("should call onPress function when press on Button.Outline", () => {
|
|
372
|
+
const onPressMock = jest.fn();
|
|
373
|
+
const { getByRole } = render(
|
|
374
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Button.Outline, { onPress: onPressMock }) })
|
|
375
|
+
);
|
|
376
|
+
fireEvent.press(getByRole("button"));
|
|
377
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
378
|
+
});
|
|
341
379
|
it("should not call onPress function when press on Button disabled", () => {
|
|
342
380
|
const onPressMock = jest.fn();
|
|
343
381
|
const { getByText } = render(
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx } from "react/jsx-runtime";
|
|
33
|
+
import React, { forwardRef } from "react";
|
|
34
|
+
import styled, { withTheme } from "styled-components";
|
|
35
|
+
import { bool, node } from "prop-types";
|
|
36
|
+
import { hexToRgb } from "@gympass/yoga-common";
|
|
37
|
+
import withTouchable from "./withTouchable";
|
|
38
|
+
import { Label, ButtonContainer } from "./Button";
|
|
39
|
+
const getInvertedStyles = ({ outline, pressed, white, disabled }) => {
|
|
40
|
+
const newStyles = {};
|
|
41
|
+
if (disabled) {
|
|
42
|
+
newStyles.backgroundColor = white;
|
|
43
|
+
newStyles.borderColor = outline.border.color.disabled;
|
|
44
|
+
}
|
|
45
|
+
if (!disabled && pressed) {
|
|
46
|
+
newStyles.backgroundColor = hexToRgb(white, 0.75);
|
|
47
|
+
newStyles.borderColor = "transparent";
|
|
48
|
+
}
|
|
49
|
+
return __spreadValues({
|
|
50
|
+
backgroundColor: outline.backgroundColor.default,
|
|
51
|
+
borderColor: white,
|
|
52
|
+
borderWidth: outline.border.width
|
|
53
|
+
}, newStyles);
|
|
54
|
+
};
|
|
55
|
+
const getDisabledStyles = ({ outline }) => {
|
|
56
|
+
return {
|
|
57
|
+
backgroundColor: outline.backgroundColor.default,
|
|
58
|
+
borderColor: outline.border.color.disabled,
|
|
59
|
+
borderWidth: outline.border.width
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const getStyles = ({ outline, pressed, secondary }) => {
|
|
63
|
+
const state = secondary ? "secondary" : "primary";
|
|
64
|
+
const newStyles = {};
|
|
65
|
+
if (pressed) {
|
|
66
|
+
newStyles.backgroundColor = outline.font.pressed[state].color;
|
|
67
|
+
newStyles.borderColor = "transparent";
|
|
68
|
+
}
|
|
69
|
+
return __spreadValues({
|
|
70
|
+
backgroundColor: outline.backgroundColor.default,
|
|
71
|
+
borderColor: outline.font.default[state].color,
|
|
72
|
+
borderWidth: outline.border.width
|
|
73
|
+
}, newStyles);
|
|
74
|
+
};
|
|
75
|
+
const LabelText = styled(Label)`
|
|
76
|
+
${({ color }) => `
|
|
77
|
+
color: ${color};
|
|
78
|
+
text-decoration: none;
|
|
79
|
+
`},
|
|
80
|
+
`;
|
|
81
|
+
const ButtonContainerOutline = styled(ButtonContainer)`
|
|
82
|
+
${({
|
|
83
|
+
secondary,
|
|
84
|
+
inverted,
|
|
85
|
+
disabled,
|
|
86
|
+
pressed,
|
|
87
|
+
theme: {
|
|
88
|
+
yoga: {
|
|
89
|
+
colors: { white },
|
|
90
|
+
components: {
|
|
91
|
+
button: {
|
|
92
|
+
types: { outline }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}) => {
|
|
98
|
+
if (inverted) {
|
|
99
|
+
return getInvertedStyles({ outline, pressed, white, disabled });
|
|
100
|
+
}
|
|
101
|
+
if (disabled) {
|
|
102
|
+
return getDisabledStyles({ outline });
|
|
103
|
+
}
|
|
104
|
+
return getStyles({ outline, pressed, secondary });
|
|
105
|
+
}}}
|
|
106
|
+
`;
|
|
107
|
+
const ButtonOutline = forwardRef(
|
|
108
|
+
(_a, ref) => {
|
|
109
|
+
var _b = _a, {
|
|
110
|
+
children,
|
|
111
|
+
disabled,
|
|
112
|
+
pressed,
|
|
113
|
+
small,
|
|
114
|
+
secondary,
|
|
115
|
+
inverted,
|
|
116
|
+
theme: {
|
|
117
|
+
yoga: {
|
|
118
|
+
colors,
|
|
119
|
+
components: {
|
|
120
|
+
button: {
|
|
121
|
+
types: { outline }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} = _b, rest = __objRest(_b, [
|
|
127
|
+
"children",
|
|
128
|
+
"disabled",
|
|
129
|
+
"pressed",
|
|
130
|
+
"small",
|
|
131
|
+
"secondary",
|
|
132
|
+
"inverted",
|
|
133
|
+
"theme"
|
|
134
|
+
]);
|
|
135
|
+
const state = secondary ? "secondary" : "primary";
|
|
136
|
+
let textColor = colors[state];
|
|
137
|
+
if (disabled) {
|
|
138
|
+
textColor = outline.font.disabled.color;
|
|
139
|
+
} else if (inverted) {
|
|
140
|
+
textColor = colors.white;
|
|
141
|
+
if (pressed) {
|
|
142
|
+
textColor = outline.font.inverted.color;
|
|
143
|
+
}
|
|
144
|
+
} else if (pressed) {
|
|
145
|
+
textColor = colors.white;
|
|
146
|
+
}
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
ButtonContainerOutline,
|
|
149
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
150
|
+
disabled,
|
|
151
|
+
pressed,
|
|
152
|
+
small,
|
|
153
|
+
secondary,
|
|
154
|
+
inverted,
|
|
155
|
+
accessible: true,
|
|
156
|
+
accessibilityRole: "button",
|
|
157
|
+
ref,
|
|
158
|
+
children: /* @__PURE__ */ jsx(
|
|
159
|
+
LabelText,
|
|
160
|
+
{
|
|
161
|
+
disabled,
|
|
162
|
+
pressed,
|
|
163
|
+
small,
|
|
164
|
+
secondary,
|
|
165
|
+
color: textColor,
|
|
166
|
+
children
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
ButtonOutline.propTypes = {
|
|
174
|
+
children: node,
|
|
175
|
+
full: bool,
|
|
176
|
+
disabled: bool,
|
|
177
|
+
small: bool,
|
|
178
|
+
pressed: bool,
|
|
179
|
+
inverted: bool,
|
|
180
|
+
secondary: bool
|
|
181
|
+
};
|
|
182
|
+
ButtonOutline.defaultProps = {
|
|
183
|
+
children: "Button",
|
|
184
|
+
full: false,
|
|
185
|
+
disabled: false,
|
|
186
|
+
small: false,
|
|
187
|
+
pressed: false,
|
|
188
|
+
inverted: false,
|
|
189
|
+
secondary: false
|
|
190
|
+
};
|
|
191
|
+
var Outline_default = withTouchable(withTheme(ButtonOutline));
|
|
192
|
+
export {
|
|
193
|
+
Outline_default as default
|
|
194
|
+
};
|
|
@@ -40,7 +40,7 @@ import Card from "../Card";
|
|
|
40
40
|
import Text from "../../../Text";
|
|
41
41
|
import Box from "../../../Box";
|
|
42
42
|
import Button from "../../../Button";
|
|
43
|
-
const { spacing, radii,
|
|
43
|
+
const { spacing, radii, colors, borders } = theme;
|
|
44
44
|
const Event = styled(Card).attrs({ hasShadow: false })`
|
|
45
45
|
flex-direction: row;
|
|
46
46
|
height: 104px;
|
|
@@ -79,15 +79,14 @@ const Top = styled(Box)`
|
|
|
79
79
|
align-items: center;
|
|
80
80
|
height: ${spacing.small}px;
|
|
81
81
|
`;
|
|
82
|
-
const Name = styled(Text.
|
|
82
|
+
const Name = styled(Text.Body2)`
|
|
83
83
|
margin-bottom: ${spacing.xxxsmall}px;
|
|
84
|
-
line-height: ${lineHeights.small}px;
|
|
85
84
|
`;
|
|
86
|
-
const Place = styled(Text.
|
|
85
|
+
const Place = styled(Text.Caption)`
|
|
87
86
|
width: 180px;
|
|
88
87
|
margin-bottom: ${spacing.xsmall}px;
|
|
89
88
|
`;
|
|
90
|
-
const Day = styled(Text.H5)`
|
|
89
|
+
const Day = styled(Text.H5).attrs({ bold: true })`
|
|
91
90
|
margin-top: ${spacing.xxxsmall}px;
|
|
92
91
|
margin-bottom: ${spacing.xxxsmall}px;
|
|
93
92
|
`;
|
|
@@ -124,9 +123,9 @@ const SmallCard = ({
|
|
|
124
123
|
borderRadius: "small",
|
|
125
124
|
bgColor: getIndicatorColor(active, Boolean(event))
|
|
126
125
|
}
|
|
127
|
-
) : /* @__PURE__ */ jsx(Text.
|
|
126
|
+
) : /* @__PURE__ */ jsx(Text.Caption, { variant: active ? "white" : "deep", children: month }) }),
|
|
128
127
|
/* @__PURE__ */ jsx(Day, { variant: active ? "white" : "secondary", children: day }),
|
|
129
|
-
/* @__PURE__ */ jsx(Text.
|
|
128
|
+
/* @__PURE__ */ jsx(Text.Caption, { variant: active ? "white" : "deep", children: String(dayOfWeek).toUpperCase() })
|
|
130
129
|
] });
|
|
131
130
|
const FullCard = withTheme(
|
|
132
131
|
({
|
|
@@ -145,9 +144,9 @@ const FullCard = withTheme(
|
|
|
145
144
|
}
|
|
146
145
|
}) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
147
146
|
/* @__PURE__ */ jsxs(DateInfo, { bg: "primary", children: [
|
|
148
|
-
/* @__PURE__ */ jsx(Top, { children: /* @__PURE__ */ jsx(Text.
|
|
147
|
+
/* @__PURE__ */ jsx(Top, { children: /* @__PURE__ */ jsx(Text.Caption, { inverted: true, children: month }) }),
|
|
149
148
|
/* @__PURE__ */ jsx(Day, { inverted: true, children: day }),
|
|
150
|
-
/* @__PURE__ */ jsx(Text.
|
|
149
|
+
/* @__PURE__ */ jsx(Text.Caption, { inverted: true, children: String(dayOfWeek).toUpperCase() })
|
|
151
150
|
] }),
|
|
152
151
|
/* @__PURE__ */ jsxs(EventInfo, { p: "small", pl: "xsmall", children: [
|
|
153
152
|
/* @__PURE__ */ jsx(Name, { numberOfLines: 1, size: "small", children: event.name }),
|
|
@@ -155,7 +154,7 @@ const FullCard = withTheme(
|
|
|
155
154
|
/* @__PURE__ */ jsxs(Row, { children: [
|
|
156
155
|
/* @__PURE__ */ jsxs(EventTime, { children: [
|
|
157
156
|
/* @__PURE__ */ jsx(Time, { fill: icon.fill, style: { marginRight: 5 } }),
|
|
158
|
-
/* @__PURE__ */ jsx(Text.
|
|
157
|
+
/* @__PURE__ */ jsx(Text.Caption, { children: event.time })
|
|
159
158
|
] }),
|
|
160
159
|
!!link && /* @__PURE__ */ jsx(ButtonLink, { onPress: onLinkPress, small: true, secondary: true, children: link })
|
|
161
160
|
] })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.114.0",
|
|
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": "
|
|
60
|
+
"gitHead": "0016f4757bed1bb22ce1856b61a7c519457ea8eb",
|
|
61
61
|
"module": "./esm",
|
|
62
62
|
"private": false,
|
|
63
63
|
"react-native": "./cjs/index.native.js"
|