@spaced-out/ui-design-system 0.0.22 → 0.0.23
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/CHANGELOG.md +22 -0
- package/design-tokens/color/app-color.json +7 -0
- package/design-tokens/size/base-size.json +6 -0
- package/lib/components/Avatar/Avatar.js +15 -5
- package/lib/components/Avatar/Avatar.js.flow +14 -0
- package/lib/components/Avatar/Avatar.module.css +21 -1
- package/lib/components/Chip/Chip.js +11 -3
- package/lib/components/Chip/Chip.js.flow +12 -2
- package/lib/components/Chip/Chip.module.css +31 -0
- package/lib/components/Icon/Icon.js.flow +1 -1
- package/lib/components/SideMenuLink/SideMenuLink.module.css +1 -0
- package/lib/components/StatusIndicator/StatusIndicator.js +36 -0
- package/lib/components/StatusIndicator/StatusIndicator.js.flow +47 -0
- package/lib/components/StatusIndicator/StatusIndicator.module.css +37 -0
- package/lib/components/StatusIndicator/index.js +16 -0
- package/lib/components/StatusIndicator/index.js.flow +3 -0
- package/lib/components/SubMenu/SubMenu.js +168 -0
- package/lib/components/SubMenu/SubMenu.js.flow +243 -0
- package/lib/components/SubMenu/SubMenu.module.css +119 -0
- package/lib/components/SubMenu/index.js +42 -0
- package/lib/components/SubMenu/index.js.flow +11 -0
- package/lib/components/Tabs/Tab/Tab.js +2 -2
- package/lib/components/Tabs/Tab/Tab.js.flow +24 -19
- package/lib/components/Tabs/Tab/Tab.module.css +5 -1
- package/lib/styles/variables/_color.css +2 -0
- package/lib/styles/variables/_color.js +3 -1
- package/lib/styles/variables/_color.js.flow +2 -0
- package/lib/styles/variables/_size.css +4 -0
- package/lib/styles/variables/_size.js +6 -2
- package/lib/styles/variables/_size.js.flow +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SubMenuItemText = exports.SubMenuItemIcon = exports.SubMenuItemAction = exports.SubMenuItem = exports.SubMenuGroup = exports.SubMenu = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _Icon = require("../Icon");
|
|
10
|
+
var _Text = require("../Text");
|
|
11
|
+
var _SubMenuModule = _interopRequireDefault(require("./SubMenu.module.css"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
const SubMenuItemIcon = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/React.createElement(_Icon.Icon, _extends({}, props, {
|
|
22
|
+
size: "small",
|
|
23
|
+
color: _Text.TEXT_COLORS.inverseSecondary,
|
|
24
|
+
className: (0, _classify.default)(_SubMenuModule.default.menuIcon, className)
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
exports.SubMenuItemIcon = SubMenuItemIcon;
|
|
28
|
+
SubMenuItemIcon.displayName = 'SubMenuItemIcon';
|
|
29
|
+
const SubMenuItemText = _ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
} = _ref2;
|
|
35
|
+
return /*#__PURE__*/React.createElement(_Text.ButtonTextSmall, _extends({}, props, {
|
|
36
|
+
className: (0, _classify.default)(_SubMenuModule.default.subMenuItemText, className),
|
|
37
|
+
color: _Text.TEXT_COLORS.inversePrimary
|
|
38
|
+
}), children);
|
|
39
|
+
};
|
|
40
|
+
exports.SubMenuItemText = SubMenuItemText;
|
|
41
|
+
SubMenuItemText.displayName = 'SubMenuItemText';
|
|
42
|
+
const SubMenuItemAction = _ref3 => {
|
|
43
|
+
let {
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
} = _ref3;
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
49
|
+
className: (0, _classify.default)(_SubMenuModule.default.subMenuItemAction, className)
|
|
50
|
+
}), children);
|
|
51
|
+
};
|
|
52
|
+
exports.SubMenuItemAction = SubMenuItemAction;
|
|
53
|
+
SubMenuItemAction.displayName = 'SubMenuItemAction';
|
|
54
|
+
const SubMenuItem = _ref4 => {
|
|
55
|
+
let {
|
|
56
|
+
children,
|
|
57
|
+
selectedMenuKey,
|
|
58
|
+
disabled,
|
|
59
|
+
classNames,
|
|
60
|
+
onChange,
|
|
61
|
+
menuKey
|
|
62
|
+
} = _ref4;
|
|
63
|
+
const onChangeHandler = () => {
|
|
64
|
+
if (!disabled) {
|
|
65
|
+
onChange && onChange(menuKey);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const selected = selectedMenuKey === menuKey;
|
|
69
|
+
const getNamedComp = comp => {
|
|
70
|
+
const childrenArray = React.Children.toArray(children);
|
|
71
|
+
if (childrenArray.length) {
|
|
72
|
+
const nodes = [];
|
|
73
|
+
for (const child of childrenArray) {
|
|
74
|
+
if (child?.type?.displayName === comp) {
|
|
75
|
+
nodes.push( /*#__PURE__*/React.cloneElement(child, {
|
|
76
|
+
selected,
|
|
77
|
+
disabled
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return nodes.length > 1 ? nodes : nodes[0];
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: (0, _classify.default)(_SubMenuModule.default.menuItem, {
|
|
87
|
+
[_SubMenuModule.default.selected]: selected,
|
|
88
|
+
[_SubMenuModule.default.disabled]: disabled
|
|
89
|
+
}, classNames?.wrapper),
|
|
90
|
+
onClick: onChangeHandler
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: _SubMenuModule.default.menuIconName
|
|
93
|
+
}, getNamedComp('SubMenuItemIcon'), getNamedComp('SubMenuItemText')), getNamedComp('SubMenuItemAction'));
|
|
94
|
+
};
|
|
95
|
+
exports.SubMenuItem = SubMenuItem;
|
|
96
|
+
const SubMenuGroup = _ref5 => {
|
|
97
|
+
let {
|
|
98
|
+
children,
|
|
99
|
+
groupTitle,
|
|
100
|
+
collapsible = false,
|
|
101
|
+
disabled = false,
|
|
102
|
+
onChange,
|
|
103
|
+
selectedMenuKey,
|
|
104
|
+
classNames
|
|
105
|
+
} = _ref5;
|
|
106
|
+
const [collapsed, setCollapsed] = React.useState(false);
|
|
107
|
+
const collapseHandler = () => {
|
|
108
|
+
collapsible && setCollapsed(!collapsed);
|
|
109
|
+
};
|
|
110
|
+
const onChangeHandler = value => {
|
|
111
|
+
if (onChange) {
|
|
112
|
+
onChange(value);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const childrenWithProps = React.Children.map(children, child => {
|
|
116
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
117
|
+
const {
|
|
118
|
+
disabled: disabledChild
|
|
119
|
+
} = child.props;
|
|
120
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
121
|
+
selectedMenuKey,
|
|
122
|
+
onChange: onChangeHandler,
|
|
123
|
+
disabled: disabledChild || disabled
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return child;
|
|
127
|
+
});
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: (0, _classify.default)(_SubMenuModule.default.subMenuGroupWrapper, classNames?.wrapper)
|
|
130
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: (0, _classify.default)(_SubMenuModule.default.subMenuGroupHeader, classNames?.groupHeader),
|
|
132
|
+
onClick: collapseHandler
|
|
133
|
+
}, /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
|
|
134
|
+
color: _Text.TEXT_COLORS.inverseSecondary,
|
|
135
|
+
className: _SubMenuModule.default.groupTitle
|
|
136
|
+
}, groupTitle), collapsible && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
137
|
+
color: _Text.TEXT_COLORS.inverseSecondary,
|
|
138
|
+
name: collapsed ? 'chevron-down' : 'chevron-up',
|
|
139
|
+
size: "small"
|
|
140
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
className: (0, _classify.default)(_SubMenuModule.default.subMenuGroup, {
|
|
142
|
+
[_SubMenuModule.default.collapsed]: collapsible && collapsed
|
|
143
|
+
}, classNames?.menuGroup)
|
|
144
|
+
}, childrenWithProps));
|
|
145
|
+
};
|
|
146
|
+
exports.SubMenuGroup = SubMenuGroup;
|
|
147
|
+
const SubMenu = _ref6 => {
|
|
148
|
+
let {
|
|
149
|
+
classNames,
|
|
150
|
+
children,
|
|
151
|
+
title
|
|
152
|
+
} = _ref6;
|
|
153
|
+
const childrenWithProps = React.Children.map(children, child => {
|
|
154
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
155
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: _SubMenuModule.default.menuChildWrap
|
|
157
|
+
}, child);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: (0, _classify.default)(_SubMenuModule.default.subMenuWrapper, classNames?.wrapper)
|
|
162
|
+
}, /*#__PURE__*/React.createElement(_Text.SubTitleMedium, {
|
|
163
|
+
className: _SubMenuModule.default.subMenuHeader,
|
|
164
|
+
color: _Text.TEXT_COLORS.inversePrimary
|
|
165
|
+
}, title), childrenWithProps);
|
|
166
|
+
};
|
|
167
|
+
exports.SubMenu = SubMenu;
|
|
168
|
+
SubMenu.displayName = 'SubMenu';
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type {ColorTypes} from '../../types/typography';
|
|
6
|
+
import classify from '../../utils/classify';
|
|
7
|
+
import type {IconProps} from '../Icon';
|
|
8
|
+
import {Icon} from '../Icon';
|
|
9
|
+
import type {TextProps} from '../Text';
|
|
10
|
+
import {
|
|
11
|
+
ButtonTextSmall,
|
|
12
|
+
SubTitleExtraSmall,
|
|
13
|
+
SubTitleMedium,
|
|
14
|
+
TEXT_COLORS,
|
|
15
|
+
} from '../Text';
|
|
16
|
+
|
|
17
|
+
import css from './SubMenu.module.css';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
21
|
+
|
|
22
|
+
export const SubMenuItemIcon = ({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: IconProps): React.Node => (
|
|
26
|
+
<Icon
|
|
27
|
+
{...props}
|
|
28
|
+
size="small"
|
|
29
|
+
color={TEXT_COLORS.inverseSecondary}
|
|
30
|
+
className={classify(css.menuIcon, className)}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
SubMenuItemIcon.displayName = 'SubMenuItemIcon';
|
|
35
|
+
|
|
36
|
+
export const SubMenuItemText = ({
|
|
37
|
+
children,
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: TextProps): React.Node => (
|
|
41
|
+
<ButtonTextSmall
|
|
42
|
+
{...props}
|
|
43
|
+
className={classify(css.subMenuItemText, className)}
|
|
44
|
+
color={TEXT_COLORS.inversePrimary}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</ButtonTextSmall>
|
|
48
|
+
);
|
|
49
|
+
SubMenuItemText.displayName = 'SubMenuItemText';
|
|
50
|
+
|
|
51
|
+
export type SubMenuItemActionProps = {
|
|
52
|
+
children?: React.Node,
|
|
53
|
+
color?: ColorTypes,
|
|
54
|
+
className?: string,
|
|
55
|
+
...
|
|
56
|
+
};
|
|
57
|
+
export const SubMenuItemAction = ({
|
|
58
|
+
children,
|
|
59
|
+
className,
|
|
60
|
+
...props
|
|
61
|
+
}: SubMenuItemActionProps): React.Node => (
|
|
62
|
+
<div {...props} className={classify(css.subMenuItemAction, className)}>
|
|
63
|
+
{children}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
SubMenuItemAction.displayName = 'SubMenuItemAction';
|
|
67
|
+
|
|
68
|
+
export type SubMenuItemProps = {
|
|
69
|
+
classNames?: ClassNames,
|
|
70
|
+
children?: React.Node,
|
|
71
|
+
selectedMenuKey?: string,
|
|
72
|
+
disabled?: boolean,
|
|
73
|
+
onChange?: (selectedMenuKey: string) => mixed,
|
|
74
|
+
menuKey: string,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const SubMenuItem = ({
|
|
78
|
+
children,
|
|
79
|
+
selectedMenuKey,
|
|
80
|
+
disabled,
|
|
81
|
+
classNames,
|
|
82
|
+
onChange,
|
|
83
|
+
menuKey,
|
|
84
|
+
}: SubMenuItemProps): React.Node => {
|
|
85
|
+
const onChangeHandler = () => {
|
|
86
|
+
if (!disabled) {
|
|
87
|
+
onChange && onChange(menuKey);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const selected = selectedMenuKey === menuKey;
|
|
92
|
+
|
|
93
|
+
const getNamedComp = (comp: string) => {
|
|
94
|
+
const childrenArray = React.Children.toArray(children);
|
|
95
|
+
if (childrenArray.length) {
|
|
96
|
+
const nodes: React.Node[] = [];
|
|
97
|
+
for (const child of childrenArray) {
|
|
98
|
+
if (child?.type?.displayName === comp) {
|
|
99
|
+
nodes.push(
|
|
100
|
+
React.cloneElement(child, {
|
|
101
|
+
selected,
|
|
102
|
+
disabled,
|
|
103
|
+
}),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return nodes.length > 1 ? nodes : nodes[0];
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div
|
|
114
|
+
className={classify(
|
|
115
|
+
css.menuItem,
|
|
116
|
+
{
|
|
117
|
+
[css.selected]: selected,
|
|
118
|
+
[css.disabled]: disabled,
|
|
119
|
+
},
|
|
120
|
+
classNames?.wrapper,
|
|
121
|
+
)}
|
|
122
|
+
onClick={onChangeHandler}
|
|
123
|
+
>
|
|
124
|
+
<div className={css.menuIconName}>
|
|
125
|
+
{getNamedComp('SubMenuItemIcon')}
|
|
126
|
+
{getNamedComp('SubMenuItemText')}
|
|
127
|
+
</div>
|
|
128
|
+
{getNamedComp('SubMenuItemAction')}
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
type SubMenuGroupClassNames = $ReadOnly<{
|
|
134
|
+
wrapper?: string,
|
|
135
|
+
groupHeader?: string,
|
|
136
|
+
menuGroup?: string,
|
|
137
|
+
}>;
|
|
138
|
+
|
|
139
|
+
export type SubMenuGroupProps = {
|
|
140
|
+
children?: React.Node,
|
|
141
|
+
groupTitle?: string,
|
|
142
|
+
collapsible?: boolean,
|
|
143
|
+
disabled?: boolean,
|
|
144
|
+
onChange?: (value: string) => mixed,
|
|
145
|
+
selectedMenuKey?: string,
|
|
146
|
+
classNames?: SubMenuGroupClassNames,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const SubMenuGroup = ({
|
|
150
|
+
children,
|
|
151
|
+
groupTitle,
|
|
152
|
+
collapsible = false,
|
|
153
|
+
disabled = false,
|
|
154
|
+
onChange,
|
|
155
|
+
selectedMenuKey,
|
|
156
|
+
classNames,
|
|
157
|
+
}: SubMenuGroupProps): React.Node => {
|
|
158
|
+
const [collapsed, setCollapsed] = React.useState(false);
|
|
159
|
+
const collapseHandler = () => {
|
|
160
|
+
collapsible && setCollapsed(!collapsed);
|
|
161
|
+
};
|
|
162
|
+
const onChangeHandler = (value) => {
|
|
163
|
+
if (onChange) {
|
|
164
|
+
onChange(value);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
|
168
|
+
if (React.isValidElement(child)) {
|
|
169
|
+
const {disabled: disabledChild} = child.props;
|
|
170
|
+
return React.cloneElement(child, {
|
|
171
|
+
selectedMenuKey,
|
|
172
|
+
onChange: onChangeHandler,
|
|
173
|
+
disabled: disabledChild || disabled,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return child;
|
|
177
|
+
});
|
|
178
|
+
return (
|
|
179
|
+
<div className={classify(css.subMenuGroupWrapper, classNames?.wrapper)}>
|
|
180
|
+
<div
|
|
181
|
+
className={classify(css.subMenuGroupHeader, classNames?.groupHeader)}
|
|
182
|
+
onClick={collapseHandler}
|
|
183
|
+
>
|
|
184
|
+
<SubTitleExtraSmall
|
|
185
|
+
color={TEXT_COLORS.inverseSecondary}
|
|
186
|
+
className={css.groupTitle}
|
|
187
|
+
>
|
|
188
|
+
{groupTitle}
|
|
189
|
+
</SubTitleExtraSmall>
|
|
190
|
+
{collapsible && (
|
|
191
|
+
<Icon
|
|
192
|
+
color={TEXT_COLORS.inverseSecondary}
|
|
193
|
+
name={collapsed ? 'chevron-down' : 'chevron-up'}
|
|
194
|
+
size="small"
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
<div
|
|
199
|
+
className={classify(
|
|
200
|
+
css.subMenuGroup,
|
|
201
|
+
{
|
|
202
|
+
[css.collapsed]: collapsible && collapsed,
|
|
203
|
+
},
|
|
204
|
+
classNames?.menuGroup,
|
|
205
|
+
)}
|
|
206
|
+
>
|
|
207
|
+
{childrenWithProps}
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export type SubMenuProps = {
|
|
214
|
+
classNames?: ClassNames,
|
|
215
|
+
title: string,
|
|
216
|
+
children?: React.Node,
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export const SubMenu = ({
|
|
220
|
+
classNames,
|
|
221
|
+
children,
|
|
222
|
+
title,
|
|
223
|
+
}: SubMenuProps): React.Node => {
|
|
224
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
|
225
|
+
if (React.isValidElement(child)) {
|
|
226
|
+
return <div className={css.menuChildWrap}>{child}</div>;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<div className={classify(css.subMenuWrapper, classNames?.wrapper)}>
|
|
232
|
+
<SubTitleMedium
|
|
233
|
+
className={css.subMenuHeader}
|
|
234
|
+
color={TEXT_COLORS.inversePrimary}
|
|
235
|
+
>
|
|
236
|
+
{title}
|
|
237
|
+
</SubTitleMedium>
|
|
238
|
+
{childrenWithProps}
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
SubMenu.displayName = 'SubMenu';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@value ( size34, size60, sizeFluid, sizeFullViewportHeight) from '../../styles/variables/_size.css';
|
|
2
|
+
|
|
3
|
+
@value (
|
|
4
|
+
colorNeutralDarkest,
|
|
5
|
+
colorTextInverseSecondary,
|
|
6
|
+
colorTextInversePrimary,
|
|
7
|
+
colorSubMenuBackgroundDefault
|
|
8
|
+
) from '../../styles/variables/_color.css';
|
|
9
|
+
@value ( spaceNone, spaceXSmall, spaceSmall, spaceMedium ) from '../../styles/variables/_space.css';
|
|
10
|
+
|
|
11
|
+
@value ( borderRadiusSmall, borderWidthPrimary) from '../../styles/variables/_border.css';
|
|
12
|
+
|
|
13
|
+
.subMenuWrapper {
|
|
14
|
+
background: colorSubMenuBackgroundDefault;
|
|
15
|
+
width: sizeFluid;
|
|
16
|
+
min-height: sizeFullViewportHeight;
|
|
17
|
+
cursor: default;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
user-select: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.subMenuHeader {
|
|
24
|
+
height: size60;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
align-items: center;
|
|
28
|
+
padding: spaceMedium;
|
|
29
|
+
border-bottom: borderWidthPrimary solid colorNeutralDarkest;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.menuChildWrap {
|
|
33
|
+
margin: spaceNone spaceSmall;
|
|
34
|
+
border-bottom: borderWidthPrimary solid colorNeutralDarkest;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.menuChildWrap:last-child {
|
|
38
|
+
border-bottom: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.subMenuGroupWrapper {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
padding: spaceMedium spaceNone;
|
|
45
|
+
flex: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.subMenuGroupHeader {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
padding: spaceNone spaceXSmall spaceNone spaceXSmall;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.groupTitle {
|
|
57
|
+
text-transform: uppercase;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.subMenuGroup {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
margin-top: spaceXSmall;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.subMenuGroup.collapsed {
|
|
67
|
+
display: none !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.menuItem {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
background: colorSubMenuBackgroundDefault;
|
|
74
|
+
color: colorTextInverseSecondary;
|
|
75
|
+
flex-direction: row;
|
|
76
|
+
gap: spaceXSmall;
|
|
77
|
+
justify-content: space-between;
|
|
78
|
+
align-items: center;
|
|
79
|
+
flex: auto;
|
|
80
|
+
height: size34;
|
|
81
|
+
min-height: size34;
|
|
82
|
+
border-radius: borderRadiusSmall;
|
|
83
|
+
width: sizeFluid;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
padding: spaceXSmall;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.menuItem:not(.selected):hover {
|
|
89
|
+
color: colorTextInversePrimary;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.menuIcon {
|
|
93
|
+
color: inherit;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.menuItem.selected {
|
|
97
|
+
background: colorNeutralDarkest;
|
|
98
|
+
color: colorTextInversePrimary;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.menuItem.disabled {
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.menuIconName {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: row;
|
|
108
|
+
gap: spaceSmall;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.subMenuItemText {
|
|
112
|
+
color: inherit;
|
|
113
|
+
margin-right: spaceSmall;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.subMenuItemAction {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: row;
|
|
119
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SubMenu", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _SubMenu.SubMenu;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "SubMenuGroup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _SubMenu.SubMenuGroup;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SubMenuItem", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _SubMenu.SubMenuItem;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "SubMenuItemAction", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _SubMenu.SubMenuItemAction;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SubMenuItemIcon", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _SubMenu.SubMenuItemIcon;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "SubMenuItemText", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _SubMenu.SubMenuItemText;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _SubMenu = require("./SubMenu");
|
|
@@ -76,7 +76,7 @@ const Tab = _ref => {
|
|
|
76
76
|
className: (0, _classify.classify)(_TabModule.default.icon, {
|
|
77
77
|
[_TabModule.default.disabled]: disabled === true
|
|
78
78
|
})
|
|
79
|
-
}) : null, size === TAB_SIZE.medium ? /*#__PURE__*/React.createElement(_Text.ButtonTextMedium, {
|
|
79
|
+
}) : null, label && /*#__PURE__*/React.createElement(React.Fragment, null, size === TAB_SIZE.medium ? /*#__PURE__*/React.createElement(_Text.ButtonTextMedium, {
|
|
80
80
|
color: _typography.TEXT_COLORS.secondary,
|
|
81
81
|
className: (0, _classify.classify)(_TabModule.default.tabContainer, {
|
|
82
82
|
[_TabModule.default.disabled]: disabled === true
|
|
@@ -87,7 +87,7 @@ const Tab = _ref => {
|
|
|
87
87
|
[_TabModule.default.selected]: selected === true,
|
|
88
88
|
[_TabModule.default.disabled]: disabled === true
|
|
89
89
|
})
|
|
90
|
-
}, label)));
|
|
90
|
+
}, label))));
|
|
91
91
|
};
|
|
92
92
|
exports.Tab = Tab;
|
|
93
93
|
Tab.displayName = 'Tab';
|
|
@@ -100,25 +100,30 @@ export const Tab = ({
|
|
|
100
100
|
})}
|
|
101
101
|
/>
|
|
102
102
|
) : null}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
103
|
+
|
|
104
|
+
{label && (
|
|
105
|
+
<>
|
|
106
|
+
{size === TAB_SIZE.medium ? (
|
|
107
|
+
<ButtonTextMedium
|
|
108
|
+
color={TEXT_COLORS.secondary}
|
|
109
|
+
className={classify(css.tabContainer, {
|
|
110
|
+
[css.disabled]: disabled === true,
|
|
111
|
+
})}
|
|
112
|
+
>
|
|
113
|
+
{label}
|
|
114
|
+
</ButtonTextMedium>
|
|
115
|
+
) : (
|
|
116
|
+
<ButtonTextSmall
|
|
117
|
+
color={TEXT_COLORS.secondary}
|
|
118
|
+
className={classify(css.tabContainer, {
|
|
119
|
+
[css.selected]: selected === true,
|
|
120
|
+
[css.disabled]: disabled === true,
|
|
121
|
+
})}
|
|
122
|
+
>
|
|
123
|
+
{label}
|
|
124
|
+
</ButtonTextSmall>
|
|
125
|
+
)}
|
|
126
|
+
</>
|
|
122
127
|
)}
|
|
123
128
|
</span>
|
|
124
129
|
</UnstyledButton>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
border: borderWidthTertiary solid colorFocusPrimary;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.button:focus .
|
|
28
|
+
.button:focus .iconTextWrap {
|
|
29
29
|
color: colorTextPrimary;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
border-bottom: borderWidthTertiary solid colorFillNone;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
.iconTextWrap:hover {
|
|
59
|
+
color: colorTextPrimary;
|
|
60
|
+
}
|
|
61
|
+
|
|
58
62
|
.icon {
|
|
59
63
|
color: inherit;
|
|
60
64
|
}
|