@gympass/yoga 7.88.1 → 7.89.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/NavigationMenu/NavigationMenu.theme.js +80 -0
- package/cjs/NavigationMenu/index.js +35 -0
- package/cjs/NavigationMenu/web/BottomItems/BottomItem.js +165 -0
- package/cjs/NavigationMenu/web/BottomItems/BottomItems.js +66 -0
- package/cjs/NavigationMenu/web/BottomItems/index.js +41 -0
- package/cjs/NavigationMenu/web/Item/Item.js +55 -0
- package/cjs/NavigationMenu/web/Item/Subitem.js +39 -0
- package/cjs/NavigationMenu/web/Item/index.js +41 -0
- package/cjs/NavigationMenu/web/Item/styles.js +188 -0
- package/cjs/NavigationMenu/web/Menu/Menu.js +109 -0
- package/cjs/NavigationMenu/web/Menu/index.js +35 -0
- package/cjs/NavigationMenu/web/NavigationMenu.js +155 -0
- package/cjs/NavigationMenu/web/NavigationMenu.test.js +178 -0
- package/cjs/NavigationMenu/web/Switcher/Actions.js +72 -0
- package/cjs/NavigationMenu/web/Switcher/Switcher.js +105 -0
- package/cjs/NavigationMenu/web/Switcher/index.js +35 -0
- package/cjs/NavigationMenu/web/index.js +35 -0
- package/cjs/Theme/theme/componentThemes.js +114 -0
- package/cjs/Theme/theme/theme.js +3 -3
- package/cjs/index.js +3 -0
- package/cjs/yoga.d.js +1 -0
- package/esm/NavigationMenu/NavigationMenu.theme.js +60 -0
- package/esm/NavigationMenu/index.js +5 -0
- package/esm/NavigationMenu/web/BottomItems/BottomItem.js +135 -0
- package/esm/NavigationMenu/web/BottomItems/BottomItems.js +36 -0
- package/esm/NavigationMenu/web/BottomItems/index.js +6 -0
- package/esm/NavigationMenu/web/Item/Item.js +25 -0
- package/esm/NavigationMenu/web/Item/Subitem.js +9 -0
- package/esm/NavigationMenu/web/Item/index.js +6 -0
- package/esm/NavigationMenu/web/Item/styles.js +151 -0
- package/esm/NavigationMenu/web/Menu/Menu.js +79 -0
- package/esm/NavigationMenu/web/Menu/index.js +5 -0
- package/esm/NavigationMenu/web/NavigationMenu.js +125 -0
- package/esm/NavigationMenu/web/NavigationMenu.test.js +155 -0
- package/esm/NavigationMenu/web/Switcher/Actions.js +42 -0
- package/esm/NavigationMenu/web/Switcher/Switcher.js +75 -0
- package/esm/NavigationMenu/web/Switcher/index.js +5 -0
- package/esm/NavigationMenu/web/index.js +5 -0
- package/esm/Theme/theme/componentThemes.js +84 -0
- package/esm/Theme/theme/theme.js +2 -2
- package/esm/index.js +2 -0
- package/esm/yoga.d.js +0 -0
- package/package.json +2 -2
- package/typings/Icon-4557ae6b.d.ts +3 -0
- package/typings/NavigationMenu/NavigationMenu.theme.d.ts +73 -0
- package/typings/NavigationMenu/index.d.ts +7 -0
- package/typings/NavigationMenu/web/BottomItems/index.d.ts +16 -0
- package/typings/NavigationMenu/web/Item/index.d.ts +23 -0
- package/typings/NavigationMenu/web/Item/styles.d.ts +6 -0
- package/typings/NavigationMenu/web/Menu/index.d.ts +11 -0
- package/typings/NavigationMenu/web/Switcher/index.d.ts +6 -0
- package/typings/NavigationMenu/web/index.d.ts +7 -0
- package/typings/NavigationMenu-7f690c1e.d.ts +55 -0
- package/typings/Switcher-cab05b9f.d.ts +18 -0
- package/typings/index.d.ts +10 -9
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var styles_exports = {};
|
|
30
|
+
__export(styles_exports, {
|
|
31
|
+
StyledItem: () => StyledItem,
|
|
32
|
+
StyledTag: () => StyledTag,
|
|
33
|
+
StyledText: () => StyledText,
|
|
34
|
+
StyledTextContainer: () => StyledTextContainer
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(styles_exports);
|
|
37
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
38
|
+
var import_yoga_helpers = require("@gympass/yoga-helpers");
|
|
39
|
+
var import_Box = __toESM(require("../../../Box"));
|
|
40
|
+
var import_Tag = __toESM(require("../../../Tag"));
|
|
41
|
+
var import_Text = __toESM(require("../../../Text"));
|
|
42
|
+
const StyledTextContainer = (0, import_styled_components.default)(import_Box.default)`
|
|
43
|
+
${({
|
|
44
|
+
isSubItem,
|
|
45
|
+
theme: {
|
|
46
|
+
yoga: {
|
|
47
|
+
components: {
|
|
48
|
+
navigationmenu: { border, gap, padding }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}) => import_styled_components.css`
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
width: 100%;
|
|
57
|
+
gap: ${gap.xxsmall}px;
|
|
58
|
+
padding: 10px ${padding.xxsmall}px 10px ${isSubItem ? 44 : padding.small}px;
|
|
59
|
+
border-radius: ${border.radius.default}px;
|
|
60
|
+
`}
|
|
61
|
+
`;
|
|
62
|
+
const StyledTag = (0, import_styled_components.default)(import_Tag.default)`
|
|
63
|
+
${({
|
|
64
|
+
theme: {
|
|
65
|
+
yoga: {
|
|
66
|
+
components: {
|
|
67
|
+
navigationmenu: { backgroundColor, border, tag }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}) => import_styled_components.css`
|
|
72
|
+
text-transform: uppercase;
|
|
73
|
+
background-color: ${backgroundColor.stamina};
|
|
74
|
+
color: ${tag.color.default};
|
|
75
|
+
border-radius: ${border.radius.circle}px;
|
|
76
|
+
`}
|
|
77
|
+
`;
|
|
78
|
+
const StyledText = (0, import_styled_components.default)(import_Text.default)`
|
|
79
|
+
${({
|
|
80
|
+
theme: {
|
|
81
|
+
yoga: {
|
|
82
|
+
components: {
|
|
83
|
+
navigationmenu: { font }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}) => import_styled_components.css`
|
|
88
|
+
color: ${font.color.default};
|
|
89
|
+
flex: 1;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
`}
|
|
94
|
+
`;
|
|
95
|
+
const Active = import_styled_components.css`
|
|
96
|
+
${({
|
|
97
|
+
isResponsive,
|
|
98
|
+
theme: {
|
|
99
|
+
yoga: {
|
|
100
|
+
components: {
|
|
101
|
+
navigationmenu: { backgroundColor, icon, font }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}) => import_styled_components.css`
|
|
106
|
+
cursor: auto;
|
|
107
|
+
|
|
108
|
+
> ${StyledTextContainer} {
|
|
109
|
+
background-color: ${backgroundColor.default};
|
|
110
|
+
|
|
111
|
+
${isResponsive ? import_yoga_helpers.media.lg`background-color: ${backgroundColor.yoga}` : import_styled_components.css`
|
|
112
|
+
background-color: ${backgroundColor.yoga};
|
|
113
|
+
`}
|
|
114
|
+
|
|
115
|
+
${StyledText} {
|
|
116
|
+
color: ${font.color.active};
|
|
117
|
+
|
|
118
|
+
${isResponsive ? import_yoga_helpers.media.lg`font-weight: ${font.weight.medium}` : import_styled_components.css`
|
|
119
|
+
font-weight: ${font.weight.medium};
|
|
120
|
+
`}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
svg {
|
|
124
|
+
fill: ${icon.fill.active};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
> ${StyledTag} {
|
|
128
|
+
background-color: ${backgroundColor.stamina};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`}
|
|
132
|
+
`;
|
|
133
|
+
const StyledItem = import_styled_components.default.li`
|
|
134
|
+
${({
|
|
135
|
+
isActive,
|
|
136
|
+
theme: {
|
|
137
|
+
yoga: {
|
|
138
|
+
components: {
|
|
139
|
+
navigationmenu: { backgroundColor, border, icon, font }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}) => import_styled_components.css`
|
|
144
|
+
transition: background-color 300ms ease-in-out;
|
|
145
|
+
|
|
146
|
+
background-color: transparent;
|
|
147
|
+
border-radius: ${border.radius.default}px;
|
|
148
|
+
list-style-type: none;
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
|
|
151
|
+
svg {
|
|
152
|
+
height: ${icon.height}px;
|
|
153
|
+
width: ${icon.width}px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:hover,
|
|
157
|
+
&:focus {
|
|
158
|
+
${!isActive && import_styled_components.css`
|
|
159
|
+
background-color: ${backgroundColor.hover};
|
|
160
|
+
|
|
161
|
+
${StyledText} {
|
|
162
|
+
color: ${font.color.hover};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
svg {
|
|
166
|
+
fill: ${icon.fill.hover};
|
|
167
|
+
}
|
|
168
|
+
`};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
a {
|
|
172
|
+
text-decoration: none;
|
|
173
|
+
|
|
174
|
+
&.active {
|
|
175
|
+
${Active}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
${isActive && Active};
|
|
179
|
+
}
|
|
180
|
+
`}
|
|
181
|
+
`;
|
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
183
|
+
0 && (module.exports = {
|
|
184
|
+
StyledItem,
|
|
185
|
+
StyledTag,
|
|
186
|
+
StyledText,
|
|
187
|
+
StyledTextContainer
|
|
188
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Menu_exports = {};
|
|
30
|
+
__export(Menu_exports, {
|
|
31
|
+
default: () => Menu_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Menu_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
36
|
+
var import_yoga_icons = require("@gympass/yoga-icons");
|
|
37
|
+
var import_yoga = require("@gympass/yoga");
|
|
38
|
+
var import_Box = __toESM(require("../../../Box"));
|
|
39
|
+
var import_Icon = __toESM(require("../../../Icon"));
|
|
40
|
+
const StyledMenu = (0, import_styled_components.default)(import_Box.default)`
|
|
41
|
+
${({
|
|
42
|
+
hasAction,
|
|
43
|
+
theme: {
|
|
44
|
+
yoga: {
|
|
45
|
+
components: {
|
|
46
|
+
navigationmenu: { avatar, backgroundColor, border, gap, padding }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}) => import_styled_components.css`
|
|
51
|
+
transition: background-color 300ms ease-in-out;
|
|
52
|
+
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
width: 100%;
|
|
57
|
+
gap: ${gap.xxsmall}px;
|
|
58
|
+
padding: ${padding.xsmall}px;
|
|
59
|
+
background-color: ${backgroundColor.white};
|
|
60
|
+
border-radius: ${border.radius.circle}px;
|
|
61
|
+
border: 1px solid ${border.color.white};
|
|
62
|
+
|
|
63
|
+
> div:first-child {
|
|
64
|
+
height: ${avatar.height}px;
|
|
65
|
+
width: ${avatar.width}px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
${hasAction && import_styled_components.css`
|
|
69
|
+
:hover,
|
|
70
|
+
&:focus {
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
border: 1px solid ${border.color.default};
|
|
73
|
+
}
|
|
74
|
+
`}
|
|
75
|
+
`}
|
|
76
|
+
`;
|
|
77
|
+
const StyledTextContainer = (0, import_styled_components.default)(import_Box.default)`
|
|
78
|
+
flex: 1;
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
`;
|
|
81
|
+
const StyledText = (0, import_styled_components.default)(import_yoga.Text.Small)`
|
|
82
|
+
${({
|
|
83
|
+
theme: {
|
|
84
|
+
yoga: {
|
|
85
|
+
components: {
|
|
86
|
+
navigationmenu: { font }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}) => import_styled_components.css`
|
|
91
|
+
font-weight: ${font.weight.medium};
|
|
92
|
+
flex: 1;
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
text-overflow: ellipsis;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
`}
|
|
97
|
+
`;
|
|
98
|
+
const Menu = ({ avatar: Avatar, subtitle, title, onClick }) => {
|
|
99
|
+
const hasAction = Boolean(onClick);
|
|
100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledMenu, { hasAction, onClick, children: [
|
|
101
|
+
Avatar,
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledTextContainer, { children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledText, { children: title || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_yoga.Skeleton, { type: "text", variant: "body2", width: "100%" }) }),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_yoga.Text.Small, { color: "deep", children: subtitle })
|
|
105
|
+
] }),
|
|
106
|
+
hasAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.default, { as: import_yoga_icons.ArrowRight, size: "large", fill: "vibin" })
|
|
107
|
+
] });
|
|
108
|
+
};
|
|
109
|
+
var Menu_default = Menu;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Menu_exports = {};
|
|
30
|
+
__export(Menu_exports, {
|
|
31
|
+
default: () => Menu_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Menu_exports);
|
|
34
|
+
var import_Menu = __toESM(require("./Menu"));
|
|
35
|
+
var Menu_default = import_Menu.default;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var NavigationMenu_exports = {};
|
|
30
|
+
__export(NavigationMenu_exports, {
|
|
31
|
+
default: () => NavigationMenu_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(NavigationMenu_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
36
|
+
var import_yoga_helpers = require("@gympass/yoga-helpers");
|
|
37
|
+
var import_Menu = __toESM(require("./Menu"));
|
|
38
|
+
var import_Switcher = __toESM(require("./Switcher"));
|
|
39
|
+
var import_Item = require("./Item");
|
|
40
|
+
var import_BottomItems = require("./BottomItems");
|
|
41
|
+
var import_Box = __toESM(require("../../Box"));
|
|
42
|
+
const StyledNavigationMenu = (0, import_styled_components.default)(import_Box.default)`
|
|
43
|
+
${({
|
|
44
|
+
isOpenOnMobile,
|
|
45
|
+
isResponsive,
|
|
46
|
+
theme: {
|
|
47
|
+
yoga: {
|
|
48
|
+
components: {
|
|
49
|
+
navigationmenu: { backgroundColor, gap, padding }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}) => import_styled_components.css`
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: ${gap.medium}px;
|
|
57
|
+
padding: ${padding.small}px ${padding.xsmall}px;
|
|
58
|
+
background-color: ${backgroundColor.default};
|
|
59
|
+
|
|
60
|
+
width: 280px;
|
|
61
|
+
height: 100%;
|
|
62
|
+
right: 0;
|
|
63
|
+
|
|
64
|
+
transition: width 300ms ease-in-out;
|
|
65
|
+
|
|
66
|
+
${isResponsive && import_yoga_helpers.media.max("lg")`
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: calc(100% - 74px);
|
|
70
|
+
z-index: 10;
|
|
71
|
+
Top: 0;
|
|
72
|
+
right: ${isOpenOnMobile ? "0" : "-100%"};
|
|
73
|
+
|
|
74
|
+
transition: right 300ms ease-in-out;
|
|
75
|
+
`}
|
|
76
|
+
`}
|
|
77
|
+
`;
|
|
78
|
+
const StyledHeader = (0, import_styled_components.default)(import_Box.default)`
|
|
79
|
+
${({
|
|
80
|
+
theme: {
|
|
81
|
+
yoga: {
|
|
82
|
+
components: {
|
|
83
|
+
navigationmenu: { gap }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}) => import_styled_components.css`
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: ${gap.xxxsmall}px;
|
|
91
|
+
`}
|
|
92
|
+
`;
|
|
93
|
+
const StyledItems = import_styled_components.default.nav`
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
flex-grow: 1;
|
|
97
|
+
overflow-y: auto;
|
|
98
|
+
`;
|
|
99
|
+
const StyledItemsGroup = import_styled_components.default.ul`
|
|
100
|
+
${({
|
|
101
|
+
theme: {
|
|
102
|
+
yoga: {
|
|
103
|
+
components: {
|
|
104
|
+
navigationmenu: { gap, padding }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}) => import_styled_components.css`
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
margin: 0;
|
|
112
|
+
padding: 0 0 ${padding.small}px 0;
|
|
113
|
+
gap: ${gap.xxxsmall}px;
|
|
114
|
+
`}
|
|
115
|
+
`;
|
|
116
|
+
const StyledFooter = (0, import_styled_components.default)(import_Box.default)`
|
|
117
|
+
${({
|
|
118
|
+
theme: {
|
|
119
|
+
yoga: {
|
|
120
|
+
components: {
|
|
121
|
+
navigationmenu: { gap }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}) => import_styled_components.css`
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: ${gap.xxxsmall}px;
|
|
129
|
+
`}
|
|
130
|
+
`;
|
|
131
|
+
const NavigationMenu = ({
|
|
132
|
+
children,
|
|
133
|
+
openOnMobile = false,
|
|
134
|
+
responsive = true
|
|
135
|
+
}) => {
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
137
|
+
StyledNavigationMenu,
|
|
138
|
+
{
|
|
139
|
+
isOpenOnMobile: openOnMobile,
|
|
140
|
+
isResponsive: responsive,
|
|
141
|
+
children
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
NavigationMenu.Header = StyledHeader;
|
|
146
|
+
NavigationMenu.Menu = import_Menu.default;
|
|
147
|
+
NavigationMenu.Switcher = import_Switcher.default;
|
|
148
|
+
NavigationMenu.Items = StyledItems;
|
|
149
|
+
NavigationMenu.ItemsGroup = StyledItemsGroup;
|
|
150
|
+
NavigationMenu.Item = import_Item.Item;
|
|
151
|
+
NavigationMenu.Subitem = import_Item.Subitem;
|
|
152
|
+
NavigationMenu.BottomItems = import_BottomItems.BottomItems;
|
|
153
|
+
NavigationMenu.BottomItem = import_BottomItems.BottomItem;
|
|
154
|
+
NavigationMenu.Footer = StyledFooter;
|
|
155
|
+
var NavigationMenu_default = NavigationMenu;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_react2 = require("@testing-library/react");
|
|
26
|
+
var import_yoga_icons = require("@gympass/yoga-icons");
|
|
27
|
+
var import_Theme = __toESM(require("../../Theme"));
|
|
28
|
+
var import_AvatarCircle = __toESM(require("../../Avatar/web/AvatarCircle"));
|
|
29
|
+
var import_Icon = __toESM(require("../../Icon"));
|
|
30
|
+
var import_NavigationMenu = __toESM(require("./NavigationMenu"));
|
|
31
|
+
describe("<NavigationMenu />", () => {
|
|
32
|
+
describe("Snapshots", () => {
|
|
33
|
+
it("should match NavigationMenu", () => {
|
|
34
|
+
const renderWrapper = ({ children }) => {
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://www.gympass.com", children });
|
|
36
|
+
};
|
|
37
|
+
const IconComponent = ({ icon }) => {
|
|
38
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.default, { as: icon });
|
|
39
|
+
};
|
|
40
|
+
const itemMainGroup = [
|
|
41
|
+
{
|
|
42
|
+
expanded: true,
|
|
43
|
+
icon: import_yoga_icons.Doc,
|
|
44
|
+
label: "Subscription",
|
|
45
|
+
tag: "new",
|
|
46
|
+
subitems: [{ label: "Details" }]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
active: true,
|
|
50
|
+
icon: import_yoga_icons.Doc,
|
|
51
|
+
label: "Billing"
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
const itemGroups = [
|
|
55
|
+
[...itemMainGroup],
|
|
56
|
+
[
|
|
57
|
+
{
|
|
58
|
+
icon: import_yoga_icons.Help,
|
|
59
|
+
label: "Help"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
];
|
|
63
|
+
const bottomItems = [
|
|
64
|
+
...itemMainGroup.slice(0, 2).map(({ active, icon, label }) => ({
|
|
65
|
+
active,
|
|
66
|
+
icon,
|
|
67
|
+
label,
|
|
68
|
+
wrapper: renderWrapper
|
|
69
|
+
})),
|
|
70
|
+
{
|
|
71
|
+
active: false,
|
|
72
|
+
icon: import_yoga_icons.MenuMore,
|
|
73
|
+
label: "More",
|
|
74
|
+
wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children })
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
const { container } = (0, import_react2.render)(
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Theme.default, { children: [
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
80
|
+
import_NavigationMenu.default,
|
|
81
|
+
{
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
import_NavigationMenu.default.Menu,
|
|
85
|
+
{
|
|
86
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
|
|
87
|
+
title: "Company",
|
|
88
|
+
subtitle: "Reseller"
|
|
89
|
+
}
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Items, { children: itemGroups.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.ItemsGroup, { children: group.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
import_NavigationMenu.default.Item,
|
|
93
|
+
{
|
|
94
|
+
active: item.active,
|
|
95
|
+
expanded: item.expanded,
|
|
96
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconComponent, { icon: item.icon }),
|
|
97
|
+
label: item.label,
|
|
98
|
+
wrapper: renderWrapper,
|
|
99
|
+
tag: item.tag,
|
|
100
|
+
children: item.subitems && item.subitems.map(({ label }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
101
|
+
import_NavigationMenu.default.Subitem,
|
|
102
|
+
{
|
|
103
|
+
label,
|
|
104
|
+
wrapper: renderWrapper
|
|
105
|
+
},
|
|
106
|
+
label
|
|
107
|
+
))
|
|
108
|
+
},
|
|
109
|
+
item.label
|
|
110
|
+
)) }, index)) }),
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
import_NavigationMenu.default.Switcher,
|
|
113
|
+
{
|
|
114
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
|
|
115
|
+
title: "User",
|
|
116
|
+
subtitle: "Admin, Supervisor"
|
|
117
|
+
}
|
|
118
|
+
) })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.BottomItems, { children: bottomItems.map(({ active, icon, label, wrapper }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
|
+
import_NavigationMenu.default.BottomItem,
|
|
124
|
+
{
|
|
125
|
+
active,
|
|
126
|
+
icon,
|
|
127
|
+
label,
|
|
128
|
+
wrapper
|
|
129
|
+
},
|
|
130
|
+
label
|
|
131
|
+
)) })
|
|
132
|
+
] })
|
|
133
|
+
);
|
|
134
|
+
expect(container).toMatchSnapshot();
|
|
135
|
+
});
|
|
136
|
+
it("should match NavigationMenu.Menu with an action", () => {
|
|
137
|
+
const { container } = (0, import_react2.render)(
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default, { responsive: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
import_NavigationMenu.default.Menu,
|
|
140
|
+
{
|
|
141
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
|
|
142
|
+
title: "Company",
|
|
143
|
+
subtitle: "Reseller",
|
|
144
|
+
onClick: () => null
|
|
145
|
+
}
|
|
146
|
+
) }) }) })
|
|
147
|
+
);
|
|
148
|
+
expect(container).toMatchSnapshot();
|
|
149
|
+
});
|
|
150
|
+
it("should match NavigationMenu.Switcher with actions", () => {
|
|
151
|
+
const actions = [
|
|
152
|
+
{
|
|
153
|
+
id: "Action 1",
|
|
154
|
+
label: "Action 1",
|
|
155
|
+
onClick: () => null
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "Action 2",
|
|
159
|
+
label: "Action 2",
|
|
160
|
+
onClick: () => null
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
const { container } = (0, import_react2.render)(
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default, { responsive: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NavigationMenu.default.Footer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
|
+
import_NavigationMenu.default.Switcher,
|
|
166
|
+
{
|
|
167
|
+
actions,
|
|
168
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AvatarCircle.default, {}),
|
|
169
|
+
sideOffset: 36,
|
|
170
|
+
subtitle: "Admin, Supervisor",
|
|
171
|
+
title: "User"
|
|
172
|
+
}
|
|
173
|
+
) }) }) })
|
|
174
|
+
);
|
|
175
|
+
expect(container).toMatchSnapshot();
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
});
|