@gympass/yoga 7.88.2 → 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 +3 -1
- 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 +3 -1
- 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,151 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { media } from "@gympass/yoga-helpers";
|
|
3
|
+
import Box from "../../../Box";
|
|
4
|
+
import Tag from "../../../Tag";
|
|
5
|
+
import Text from "../../../Text";
|
|
6
|
+
const StyledTextContainer = styled(Box)`
|
|
7
|
+
${({
|
|
8
|
+
isSubItem,
|
|
9
|
+
theme: {
|
|
10
|
+
yoga: {
|
|
11
|
+
components: {
|
|
12
|
+
navigationmenu: { border, gap, padding }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}) => css`
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
width: 100%;
|
|
21
|
+
gap: ${gap.xxsmall}px;
|
|
22
|
+
padding: 10px ${padding.xxsmall}px 10px ${isSubItem ? 44 : padding.small}px;
|
|
23
|
+
border-radius: ${border.radius.default}px;
|
|
24
|
+
`}
|
|
25
|
+
`;
|
|
26
|
+
const StyledTag = styled(Tag)`
|
|
27
|
+
${({
|
|
28
|
+
theme: {
|
|
29
|
+
yoga: {
|
|
30
|
+
components: {
|
|
31
|
+
navigationmenu: { backgroundColor, border, tag }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}) => css`
|
|
36
|
+
text-transform: uppercase;
|
|
37
|
+
background-color: ${backgroundColor.stamina};
|
|
38
|
+
color: ${tag.color.default};
|
|
39
|
+
border-radius: ${border.radius.circle}px;
|
|
40
|
+
`}
|
|
41
|
+
`;
|
|
42
|
+
const StyledText = styled(Text)`
|
|
43
|
+
${({
|
|
44
|
+
theme: {
|
|
45
|
+
yoga: {
|
|
46
|
+
components: {
|
|
47
|
+
navigationmenu: { font }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}) => css`
|
|
52
|
+
color: ${font.color.default};
|
|
53
|
+
flex: 1;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
text-overflow: ellipsis;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
`}
|
|
58
|
+
`;
|
|
59
|
+
const Active = css`
|
|
60
|
+
${({
|
|
61
|
+
isResponsive,
|
|
62
|
+
theme: {
|
|
63
|
+
yoga: {
|
|
64
|
+
components: {
|
|
65
|
+
navigationmenu: { backgroundColor, icon, font }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}) => css`
|
|
70
|
+
cursor: auto;
|
|
71
|
+
|
|
72
|
+
> ${StyledTextContainer} {
|
|
73
|
+
background-color: ${backgroundColor.default};
|
|
74
|
+
|
|
75
|
+
${isResponsive ? media.lg`background-color: ${backgroundColor.yoga}` : css`
|
|
76
|
+
background-color: ${backgroundColor.yoga};
|
|
77
|
+
`}
|
|
78
|
+
|
|
79
|
+
${StyledText} {
|
|
80
|
+
color: ${font.color.active};
|
|
81
|
+
|
|
82
|
+
${isResponsive ? media.lg`font-weight: ${font.weight.medium}` : css`
|
|
83
|
+
font-weight: ${font.weight.medium};
|
|
84
|
+
`}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
svg {
|
|
88
|
+
fill: ${icon.fill.active};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
> ${StyledTag} {
|
|
92
|
+
background-color: ${backgroundColor.stamina};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`}
|
|
96
|
+
`;
|
|
97
|
+
const StyledItem = styled.li`
|
|
98
|
+
${({
|
|
99
|
+
isActive,
|
|
100
|
+
theme: {
|
|
101
|
+
yoga: {
|
|
102
|
+
components: {
|
|
103
|
+
navigationmenu: { backgroundColor, border, icon, font }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}) => css`
|
|
108
|
+
transition: background-color 300ms ease-in-out;
|
|
109
|
+
|
|
110
|
+
background-color: transparent;
|
|
111
|
+
border-radius: ${border.radius.default}px;
|
|
112
|
+
list-style-type: none;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
|
|
115
|
+
svg {
|
|
116
|
+
height: ${icon.height}px;
|
|
117
|
+
width: ${icon.width}px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:hover,
|
|
121
|
+
&:focus {
|
|
122
|
+
${!isActive && css`
|
|
123
|
+
background-color: ${backgroundColor.hover};
|
|
124
|
+
|
|
125
|
+
${StyledText} {
|
|
126
|
+
color: ${font.color.hover};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
svg {
|
|
130
|
+
fill: ${icon.fill.hover};
|
|
131
|
+
}
|
|
132
|
+
`};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
a {
|
|
136
|
+
text-decoration: none;
|
|
137
|
+
|
|
138
|
+
&.active {
|
|
139
|
+
${Active}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
${isActive && Active};
|
|
143
|
+
}
|
|
144
|
+
`}
|
|
145
|
+
`;
|
|
146
|
+
export {
|
|
147
|
+
StyledItem,
|
|
148
|
+
StyledTag,
|
|
149
|
+
StyledText,
|
|
150
|
+
StyledTextContainer
|
|
151
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { ArrowRight } from "@gympass/yoga-icons";
|
|
4
|
+
import { Text, Skeleton } from "@gympass/yoga";
|
|
5
|
+
import Box from "../../../Box";
|
|
6
|
+
import Icon from "../../../Icon";
|
|
7
|
+
const StyledMenu = styled(Box)`
|
|
8
|
+
${({
|
|
9
|
+
hasAction,
|
|
10
|
+
theme: {
|
|
11
|
+
yoga: {
|
|
12
|
+
components: {
|
|
13
|
+
navigationmenu: { avatar, backgroundColor, border, gap, padding }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}) => css`
|
|
18
|
+
transition: background-color 300ms ease-in-out;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
width: 100%;
|
|
24
|
+
gap: ${gap.xxsmall}px;
|
|
25
|
+
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
|
+
}
|
|
34
|
+
|
|
35
|
+
${hasAction && css`
|
|
36
|
+
:hover,
|
|
37
|
+
&:focus {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
border: 1px solid ${border.color.default};
|
|
40
|
+
}
|
|
41
|
+
`}
|
|
42
|
+
`}
|
|
43
|
+
`;
|
|
44
|
+
const StyledTextContainer = styled(Box)`
|
|
45
|
+
flex: 1;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
`;
|
|
48
|
+
const StyledText = styled(Text.Small)`
|
|
49
|
+
${({
|
|
50
|
+
theme: {
|
|
51
|
+
yoga: {
|
|
52
|
+
components: {
|
|
53
|
+
navigationmenu: { font }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}) => css`
|
|
58
|
+
font-weight: ${font.weight.medium};
|
|
59
|
+
flex: 1;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
`}
|
|
64
|
+
`;
|
|
65
|
+
const Menu = ({ avatar: Avatar, subtitle, title, onClick }) => {
|
|
66
|
+
const hasAction = Boolean(onClick);
|
|
67
|
+
return /* @__PURE__ */ jsxs(StyledMenu, { hasAction, onClick, children: [
|
|
68
|
+
Avatar,
|
|
69
|
+
/* @__PURE__ */ jsxs(StyledTextContainer, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(StyledText, { children: title || /* @__PURE__ */ jsx(Skeleton, { type: "text", variant: "body2", width: "100%" }) }),
|
|
71
|
+
/* @__PURE__ */ jsx(Text.Small, { color: "deep", children: subtitle })
|
|
72
|
+
] }),
|
|
73
|
+
hasAction && /* @__PURE__ */ jsx(Icon, { as: ArrowRight, size: "large", fill: "vibin" })
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
var Menu_default = Menu;
|
|
77
|
+
export {
|
|
78
|
+
Menu_default as default
|
|
79
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { media } from "@gympass/yoga-helpers";
|
|
4
|
+
import Menu from "./Menu";
|
|
5
|
+
import Switcher from "./Switcher";
|
|
6
|
+
import { Item, Subitem } from "./Item";
|
|
7
|
+
import { BottomItems, BottomItem } from "./BottomItems";
|
|
8
|
+
import Box from "../../Box";
|
|
9
|
+
const StyledNavigationMenu = styled(Box)`
|
|
10
|
+
${({
|
|
11
|
+
isOpenOnMobile,
|
|
12
|
+
isResponsive,
|
|
13
|
+
theme: {
|
|
14
|
+
yoga: {
|
|
15
|
+
components: {
|
|
16
|
+
navigationmenu: { backgroundColor, gap, padding }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}) => css`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: ${gap.medium}px;
|
|
24
|
+
padding: ${padding.small}px ${padding.xsmall}px;
|
|
25
|
+
background-color: ${backgroundColor.default};
|
|
26
|
+
|
|
27
|
+
width: 280px;
|
|
28
|
+
height: 100%;
|
|
29
|
+
right: 0;
|
|
30
|
+
|
|
31
|
+
transition: width 300ms ease-in-out;
|
|
32
|
+
|
|
33
|
+
${isResponsive && media.max("lg")`
|
|
34
|
+
position: absolute;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: calc(100% - 74px);
|
|
37
|
+
z-index: 10;
|
|
38
|
+
Top: 0;
|
|
39
|
+
right: ${isOpenOnMobile ? "0" : "-100%"};
|
|
40
|
+
|
|
41
|
+
transition: right 300ms ease-in-out;
|
|
42
|
+
`}
|
|
43
|
+
`}
|
|
44
|
+
`;
|
|
45
|
+
const StyledHeader = styled(Box)`
|
|
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
|
+
`}
|
|
59
|
+
`;
|
|
60
|
+
const StyledItems = styled.nav`
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
flex-grow: 1;
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
`;
|
|
66
|
+
const StyledItemsGroup = styled.ul`
|
|
67
|
+
${({
|
|
68
|
+
theme: {
|
|
69
|
+
yoga: {
|
|
70
|
+
components: {
|
|
71
|
+
navigationmenu: { gap, padding }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}) => css`
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0 0 ${padding.small}px 0;
|
|
80
|
+
gap: ${gap.xxxsmall}px;
|
|
81
|
+
`}
|
|
82
|
+
`;
|
|
83
|
+
const StyledFooter = styled(Box)`
|
|
84
|
+
${({
|
|
85
|
+
theme: {
|
|
86
|
+
yoga: {
|
|
87
|
+
components: {
|
|
88
|
+
navigationmenu: { gap }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}) => css`
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: ${gap.xxxsmall}px;
|
|
96
|
+
`}
|
|
97
|
+
`;
|
|
98
|
+
const NavigationMenu = ({
|
|
99
|
+
children,
|
|
100
|
+
openOnMobile = false,
|
|
101
|
+
responsive = true
|
|
102
|
+
}) => {
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
StyledNavigationMenu,
|
|
105
|
+
{
|
|
106
|
+
isOpenOnMobile: openOnMobile,
|
|
107
|
+
isResponsive: responsive,
|
|
108
|
+
children
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
NavigationMenu.Header = StyledHeader;
|
|
113
|
+
NavigationMenu.Menu = Menu;
|
|
114
|
+
NavigationMenu.Switcher = Switcher;
|
|
115
|
+
NavigationMenu.Items = StyledItems;
|
|
116
|
+
NavigationMenu.ItemsGroup = StyledItemsGroup;
|
|
117
|
+
NavigationMenu.Item = Item;
|
|
118
|
+
NavigationMenu.Subitem = Subitem;
|
|
119
|
+
NavigationMenu.BottomItems = BottomItems;
|
|
120
|
+
NavigationMenu.BottomItem = BottomItem;
|
|
121
|
+
NavigationMenu.Footer = StyledFooter;
|
|
122
|
+
var NavigationMenu_default = NavigationMenu;
|
|
123
|
+
export {
|
|
124
|
+
NavigationMenu_default as default
|
|
125
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import { Help, Doc, MenuMore } from "@gympass/yoga-icons";
|
|
4
|
+
import ThemeProvider from "../../Theme";
|
|
5
|
+
import AvatarCircle from "../../Avatar/web/AvatarCircle";
|
|
6
|
+
import Icon from "../../Icon";
|
|
7
|
+
import NavigationMenu from "./NavigationMenu";
|
|
8
|
+
describe("<NavigationMenu />", () => {
|
|
9
|
+
describe("Snapshots", () => {
|
|
10
|
+
it("should match NavigationMenu", () => {
|
|
11
|
+
const renderWrapper = ({ children }) => {
|
|
12
|
+
return /* @__PURE__ */ jsx("a", { href: "https://www.gympass.com", children });
|
|
13
|
+
};
|
|
14
|
+
const IconComponent = ({ icon }) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(Icon, { as: icon });
|
|
16
|
+
};
|
|
17
|
+
const itemMainGroup = [
|
|
18
|
+
{
|
|
19
|
+
expanded: true,
|
|
20
|
+
icon: Doc,
|
|
21
|
+
label: "Subscription",
|
|
22
|
+
tag: "new",
|
|
23
|
+
subitems: [{ label: "Details" }]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
active: true,
|
|
27
|
+
icon: Doc,
|
|
28
|
+
label: "Billing"
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
const itemGroups = [
|
|
32
|
+
[...itemMainGroup],
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
icon: Help,
|
|
36
|
+
label: "Help"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
];
|
|
40
|
+
const bottomItems = [
|
|
41
|
+
...itemMainGroup.slice(0, 2).map(({ active, icon, label }) => ({
|
|
42
|
+
active,
|
|
43
|
+
icon,
|
|
44
|
+
label,
|
|
45
|
+
wrapper: renderWrapper
|
|
46
|
+
})),
|
|
47
|
+
{
|
|
48
|
+
active: false,
|
|
49
|
+
icon: MenuMore,
|
|
50
|
+
label: "More",
|
|
51
|
+
wrapper: ({ children }) => /* @__PURE__ */ jsx("div", { children })
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
const { container } = render(
|
|
55
|
+
/* @__PURE__ */ jsxs(ThemeProvider, { children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(
|
|
57
|
+
NavigationMenu,
|
|
58
|
+
{
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(NavigationMenu.Header, { children: /* @__PURE__ */ jsx(
|
|
61
|
+
NavigationMenu.Menu,
|
|
62
|
+
{
|
|
63
|
+
avatar: /* @__PURE__ */ jsx(AvatarCircle, {}),
|
|
64
|
+
title: "Company",
|
|
65
|
+
subtitle: "Reseller"
|
|
66
|
+
}
|
|
67
|
+
) }),
|
|
68
|
+
/* @__PURE__ */ jsx(NavigationMenu.Items, { children: itemGroups.map((group, index) => /* @__PURE__ */ jsx(NavigationMenu.ItemsGroup, { children: group.map((item) => /* @__PURE__ */ jsx(
|
|
69
|
+
NavigationMenu.Item,
|
|
70
|
+
{
|
|
71
|
+
active: item.active,
|
|
72
|
+
expanded: item.expanded,
|
|
73
|
+
icon: /* @__PURE__ */ jsx(IconComponent, { icon: item.icon }),
|
|
74
|
+
label: item.label,
|
|
75
|
+
wrapper: renderWrapper,
|
|
76
|
+
tag: item.tag,
|
|
77
|
+
children: item.subitems && item.subitems.map(({ label }) => /* @__PURE__ */ jsx(
|
|
78
|
+
NavigationMenu.Subitem,
|
|
79
|
+
{
|
|
80
|
+
label,
|
|
81
|
+
wrapper: renderWrapper
|
|
82
|
+
},
|
|
83
|
+
label
|
|
84
|
+
))
|
|
85
|
+
},
|
|
86
|
+
item.label
|
|
87
|
+
)) }, index)) }),
|
|
88
|
+
/* @__PURE__ */ jsx(NavigationMenu.Footer, { children: /* @__PURE__ */ jsx(
|
|
89
|
+
NavigationMenu.Switcher,
|
|
90
|
+
{
|
|
91
|
+
avatar: /* @__PURE__ */ jsx(AvatarCircle, {}),
|
|
92
|
+
title: "User",
|
|
93
|
+
subtitle: "Admin, Supervisor"
|
|
94
|
+
}
|
|
95
|
+
) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(NavigationMenu.BottomItems, { children: bottomItems.map(({ active, icon, label, wrapper }) => /* @__PURE__ */ jsx(
|
|
100
|
+
NavigationMenu.BottomItem,
|
|
101
|
+
{
|
|
102
|
+
active,
|
|
103
|
+
icon,
|
|
104
|
+
label,
|
|
105
|
+
wrapper
|
|
106
|
+
},
|
|
107
|
+
label
|
|
108
|
+
)) })
|
|
109
|
+
] })
|
|
110
|
+
);
|
|
111
|
+
expect(container).toMatchSnapshot();
|
|
112
|
+
});
|
|
113
|
+
it("should match NavigationMenu.Menu with an action", () => {
|
|
114
|
+
const { container } = render(
|
|
115
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(NavigationMenu, { responsive: false, children: /* @__PURE__ */ jsx(NavigationMenu.Header, { children: /* @__PURE__ */ jsx(
|
|
116
|
+
NavigationMenu.Menu,
|
|
117
|
+
{
|
|
118
|
+
avatar: /* @__PURE__ */ jsx(AvatarCircle, {}),
|
|
119
|
+
title: "Company",
|
|
120
|
+
subtitle: "Reseller",
|
|
121
|
+
onClick: () => null
|
|
122
|
+
}
|
|
123
|
+
) }) }) })
|
|
124
|
+
);
|
|
125
|
+
expect(container).toMatchSnapshot();
|
|
126
|
+
});
|
|
127
|
+
it("should match NavigationMenu.Switcher with actions", () => {
|
|
128
|
+
const actions = [
|
|
129
|
+
{
|
|
130
|
+
id: "Action 1",
|
|
131
|
+
label: "Action 1",
|
|
132
|
+
onClick: () => null
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "Action 2",
|
|
136
|
+
label: "Action 2",
|
|
137
|
+
onClick: () => null
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
const { container } = render(
|
|
141
|
+
/* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(NavigationMenu, { responsive: false, children: /* @__PURE__ */ jsx(NavigationMenu.Footer, { children: /* @__PURE__ */ jsx(
|
|
142
|
+
NavigationMenu.Switcher,
|
|
143
|
+
{
|
|
144
|
+
actions,
|
|
145
|
+
avatar: /* @__PURE__ */ jsx(AvatarCircle, {}),
|
|
146
|
+
sideOffset: 36,
|
|
147
|
+
subtitle: "Admin, Supervisor",
|
|
148
|
+
title: "User"
|
|
149
|
+
}
|
|
150
|
+
) }) }) })
|
|
151
|
+
);
|
|
152
|
+
expect(container).toMatchSnapshot();
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { MenuMore } from "@gympass/yoga-icons";
|
|
4
|
+
import { Menu as YogaMenu } from "@gympass/yoga";
|
|
5
|
+
import Icon from "../../../Icon";
|
|
6
|
+
import Box from "../../../Box";
|
|
7
|
+
const StyledAction = styled(Box)`
|
|
8
|
+
${({
|
|
9
|
+
theme: {
|
|
10
|
+
yoga: {
|
|
11
|
+
components: {
|
|
12
|
+
navigationmenu: { backgroundColor, border, height, width }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}) => css`
|
|
17
|
+
transition: background-color 300ms ease-in-out;
|
|
18
|
+
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
width: ${width.xxlarge}px;
|
|
23
|
+
height: ${height.xxlarge}px;
|
|
24
|
+
border-radius: ${border.radius.circle}px;
|
|
25
|
+
|
|
26
|
+
:hover,
|
|
27
|
+
&:focus {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
background-color: ${backgroundColor.hover};
|
|
30
|
+
}
|
|
31
|
+
`}
|
|
32
|
+
`;
|
|
33
|
+
const Actions = ({ actions, sideOffset }) => {
|
|
34
|
+
return /* @__PURE__ */ jsxs(YogaMenu, { onMouseHover: false, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(YogaMenu.Action, { children: /* @__PURE__ */ jsx(StyledAction, { children: /* @__PURE__ */ jsx(Icon, { as: MenuMore, size: "medium", fill: "vibin" }) }) }),
|
|
36
|
+
/* @__PURE__ */ jsx(YogaMenu.List, { side: "right", sideOffset, zIndex: "10", children: actions.map(({ id, label, onClick }) => /* @__PURE__ */ jsx(YogaMenu.Item, { onClick, children: label }, id)) })
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
var Actions_default = Actions;
|
|
40
|
+
export {
|
|
41
|
+
Actions_default as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import { Text, Skeleton } from "@gympass/yoga";
|
|
4
|
+
import Actions from "./Actions";
|
|
5
|
+
import Box from "../../../Box";
|
|
6
|
+
const StyledSwitcher = styled(Box)`
|
|
7
|
+
${({
|
|
8
|
+
fill,
|
|
9
|
+
theme: {
|
|
10
|
+
yoga: {
|
|
11
|
+
colors,
|
|
12
|
+
components: {
|
|
13
|
+
navigationmenu: { border, gap, height, padding, width }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}) => css`
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
width: 100%;
|
|
22
|
+
gap: ${gap.xxsmall}px;
|
|
23
|
+
padding: ${padding.xsmall}px;
|
|
24
|
+
background-color: ${colors[fill]};
|
|
25
|
+
border-radius: ${border.radius.default}px;
|
|
26
|
+
|
|
27
|
+
> div:first-child {
|
|
28
|
+
height: ${height.xlarge}px;
|
|
29
|
+
width: ${width.xlarge}px;
|
|
30
|
+
}
|
|
31
|
+
`}
|
|
32
|
+
`;
|
|
33
|
+
const StyledTextContainer = styled(Box)`
|
|
34
|
+
flex: 1;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
`;
|
|
37
|
+
const StyledTitle = styled(Text.Small)`
|
|
38
|
+
${({
|
|
39
|
+
theme: {
|
|
40
|
+
yoga: {
|
|
41
|
+
components: {
|
|
42
|
+
navigationmenu: { font }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}) => css`
|
|
47
|
+
font-weight: ${font.weight.medium};
|
|
48
|
+
flex: 1;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
`}
|
|
53
|
+
`;
|
|
54
|
+
const Switcher = ({
|
|
55
|
+
actions,
|
|
56
|
+
avatar: Avatar,
|
|
57
|
+
fill = "transparent",
|
|
58
|
+
sideOffset = 36,
|
|
59
|
+
subtitle,
|
|
60
|
+
title
|
|
61
|
+
}) => {
|
|
62
|
+
const hasActions = actions == null ? void 0 : actions.length;
|
|
63
|
+
return /* @__PURE__ */ jsxs(StyledSwitcher, { fill, children: [
|
|
64
|
+
Avatar,
|
|
65
|
+
/* @__PURE__ */ jsxs(StyledTextContainer, { children: [
|
|
66
|
+
/* @__PURE__ */ jsx(StyledTitle, { children: title || /* @__PURE__ */ jsx(Skeleton, { type: "text", variant: "body2", width: "100%" }) }),
|
|
67
|
+
/* @__PURE__ */ jsx(Text.Tiny, { color: "deep", children: subtitle })
|
|
68
|
+
] }),
|
|
69
|
+
hasActions && /* @__PURE__ */ jsx(Actions, { actions, sideOffset })
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
var Switcher_default = Switcher;
|
|
73
|
+
export {
|
|
74
|
+
Switcher_default as default
|
|
75
|
+
};
|
|
@@ -36,6 +36,7 @@ import Stepper from "../../Stepper/Stepper.theme.js";
|
|
|
36
36
|
import Tag from "../../Tag/Tag.theme.js";
|
|
37
37
|
import Text from "../../Text/Text.theme.js";
|
|
38
38
|
import TextArea from "../../TextArea/TextArea.theme.js";
|
|
39
|
+
import NavigationMenu from "../../NavigationMenu/NavigationMenu.theme";
|
|
39
40
|
const componentThemes = {
|
|
40
41
|
Accordion,
|
|
41
42
|
ActionRequirement,
|
|
@@ -74,7 +75,8 @@ const componentThemes = {
|
|
|
74
75
|
Stepper,
|
|
75
76
|
Tag,
|
|
76
77
|
Text,
|
|
77
|
-
TextArea
|
|
78
|
+
TextArea,
|
|
79
|
+
NavigationMenu
|
|
78
80
|
};
|
|
79
81
|
var componentThemes_default = componentThemes;
|
|
80
82
|
export {
|
package/esm/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import Skeleton from "./Skeleton";
|
|
|
40
40
|
import ActionRequirement from "./ActionRequirement";
|
|
41
41
|
import Popover from "./Popover";
|
|
42
42
|
import Spinner from "./Spinner";
|
|
43
|
+
import NavigationMenu from "./NavigationMenu";
|
|
43
44
|
export {
|
|
44
45
|
Accordion,
|
|
45
46
|
ActionRequirement,
|
|
@@ -69,6 +70,7 @@ export {
|
|
|
69
70
|
Input,
|
|
70
71
|
List,
|
|
71
72
|
Menu,
|
|
73
|
+
NavigationMenu,
|
|
72
74
|
PlanCard,
|
|
73
75
|
Popover,
|
|
74
76
|
Progress,
|
package/esm/yoga.d.js
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.89.0",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"types": "./typings/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"react-native": "0.72.3",
|
|
57
57
|
"styled-components": "^4.4.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "0f1e1dc67d7dbe17045b0fb018460cf623735b6e",
|
|
60
60
|
"module": "./esm",
|
|
61
61
|
"private": false,
|
|
62
62
|
"react-native": "./cjs/index.native.js"
|