@spaced-out/ui-design-system 0.0.62 → 0.0.64

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 CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.64](https://github.com/spaced-out/ui-design-system/compare/v0.0.63...v0.0.64) (2023-03-29)
6
+
7
+
8
+ ### Features
9
+
10
+ * submenu spacing correction ([#87](https://github.com/spaced-out/ui-design-system/issues/87)) ([6cc9011](https://github.com/spaced-out/ui-design-system/commit/6cc901182bb2426ba02769f605b52126ff7a0267))
11
+
12
+ ### [0.0.63](https://github.com/spaced-out/ui-design-system/compare/v0.0.62...v0.0.63) (2023-03-28)
13
+
14
+
15
+ ### Features
16
+
17
+ * optional close button for submenu header ([#85](https://github.com/spaced-out/ui-design-system/issues/85)) ([24cfbdb](https://github.com/spaced-out/ui-design-system/commit/24cfbdb0f8c985fee3ecf8de6771f07eacae26ff))
18
+
5
19
  ### [0.0.62](https://github.com/spaced-out/ui-design-system/compare/v0.0.61...v0.0.62) (2023-03-28)
6
20
 
7
21
 
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.SubMenuItemText = exports.SubMenuItemIcon = exports.SubMenuItemAction = exports.SubMenuItem = exports.SubMenuGroup = exports.SubMenu = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _classify = _interopRequireDefault(require("../../utils/classify"));
9
+ var _Button = require("../Button");
9
10
  var _Icon = require("../Icon");
10
11
  var _Text = require("../Text");
11
12
  var _SubMenuModule = _interopRequireDefault(require("./SubMenu.module.css"));
@@ -145,7 +146,7 @@ const SubMenuGroup = _ref5 => {
145
146
  className: (0, _classify.default)(_SubMenuModule.default.subMenuGroupHeader, classNames?.groupHeader),
146
147
  onClick: collapseHandler,
147
148
  onKeyDown: onKeyDownHandlerHeader,
148
- tabindex: "0"
149
+ tabIndex: "0"
149
150
  }, /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
150
151
  color: _Text.TEXT_COLORS.inverseSecondary,
151
152
  className: _SubMenuModule.default.groupTitle
@@ -164,7 +165,9 @@ const SubMenu = _ref6 => {
164
165
  let {
165
166
  classNames,
166
167
  children,
167
- title
168
+ title,
169
+ onClose,
170
+ showClose = false
168
171
  } = _ref6;
169
172
  const childrenWithProps = React.Children.map(children, child => {
170
173
  if ( /*#__PURE__*/React.isValidElement(child)) {
@@ -175,10 +178,23 @@ const SubMenu = _ref6 => {
175
178
  });
176
179
  return /*#__PURE__*/React.createElement("div", {
177
180
  className: (0, _classify.default)(_SubMenuModule.default.subMenuWrapper, classNames?.wrapper)
181
+ }, /*#__PURE__*/React.createElement("div", {
182
+ className: _SubMenuModule.default.subMenuTitleAndButton
178
183
  }, /*#__PURE__*/React.createElement(_Text.SubTitleMedium, {
179
184
  className: _SubMenuModule.default.subMenuHeader,
180
185
  color: _Text.TEXT_COLORS.inversePrimary
181
- }, title), childrenWithProps);
186
+ }, title), showClose && /*#__PURE__*/React.createElement(_Button.Button, {
187
+ ariaLabel: "Icon Button",
188
+ iconRightName: "close",
189
+ onClick: onClose,
190
+ size: "small",
191
+ type: "ghost",
192
+ actionType: "button",
193
+ classNames: {
194
+ wrapper: _SubMenuModule.default.subMenuCloseButton,
195
+ icon: _SubMenuModule.default.subMenuCloseIcon
196
+ }
197
+ })), childrenWithProps);
182
198
  };
183
199
  exports.SubMenu = SubMenu;
184
200
  SubMenu.displayName = 'SubMenu';
@@ -4,6 +4,7 @@ import * as React from 'react';
4
4
 
5
5
  import type {ColorTypes} from '../../types/typography';
6
6
  import classify from '../../utils/classify';
7
+ import {Button} from '../Button';
7
8
  import type {IconProps} from '../Icon';
8
9
  import {Icon} from '../Icon';
9
10
  import type {TextProps} from '../Text';
@@ -206,7 +207,7 @@ export const SubMenuGroup = ({
206
207
  className={classify(css.subMenuGroupHeader, classNames?.groupHeader)}
207
208
  onClick={collapseHandler}
208
209
  onKeyDown={onKeyDownHandlerHeader}
209
- tabindex="0"
210
+ tabIndex="0"
210
211
  >
211
212
  <SubTitleExtraSmall
212
213
  color={TEXT_COLORS.inverseSecondary}
@@ -241,12 +242,16 @@ export type SubMenuProps = {
241
242
  classNames?: ClassNames,
242
243
  title: string,
243
244
  children?: React.Node,
245
+ onClose?: () => mixed,
246
+ showClose?: boolean,
244
247
  };
245
248
 
246
249
  export const SubMenu = ({
247
250
  classNames,
248
251
  children,
249
252
  title,
253
+ onClose,
254
+ showClose = false,
250
255
  }: SubMenuProps): React.Node => {
251
256
  const childrenWithProps = React.Children.map(children, (child) => {
252
257
  if (React.isValidElement(child)) {
@@ -256,12 +261,28 @@ export const SubMenu = ({
256
261
 
257
262
  return (
258
263
  <div className={classify(css.subMenuWrapper, classNames?.wrapper)}>
259
- <SubTitleMedium
260
- className={css.subMenuHeader}
261
- color={TEXT_COLORS.inversePrimary}
262
- >
263
- {title}
264
- </SubTitleMedium>
264
+ <div className={css.subMenuTitleAndButton}>
265
+ <SubTitleMedium
266
+ className={css.subMenuHeader}
267
+ color={TEXT_COLORS.inversePrimary}
268
+ >
269
+ {title}
270
+ </SubTitleMedium>
271
+ {showClose && (
272
+ <Button
273
+ ariaLabel="Icon Button"
274
+ iconRightName="close"
275
+ onClick={onClose}
276
+ size="small"
277
+ type="ghost"
278
+ actionType="button"
279
+ classNames={{
280
+ wrapper: css.subMenuCloseButton,
281
+ icon: css.subMenuCloseIcon,
282
+ }}
283
+ />
284
+ )}
285
+ </div>
265
286
  {childrenWithProps}
266
287
  </div>
267
288
  );
@@ -8,10 +8,11 @@
8
8
  colorTextInverseSecondary,
9
9
  colorTextInversePrimary,
10
10
  colorSubMenuBackgroundDefault,
11
+ colorSideMenuIconActive,
11
12
  colorSuccess,
12
13
  colorFocusDanger
13
14
  ) from '../../styles/variables/_color.css';
14
- @value ( spaceNone, spaceXSmall, spaceSmall, spaceMedium ) from '../../styles/variables/_space.css';
15
+ @value ( spaceNone, spaceXXSmall, spaceXSmall, spaceSmall, spaceMedium ) from '../../styles/variables/_space.css';
15
16
 
16
17
  @value ( borderWidthTertiary, borderRadiusSmall, borderWidthPrimary, borderRadiusMedium, borderWidthNone) from '../../styles/variables/_border.css';
17
18
 
@@ -25,13 +26,31 @@
25
26
  user-select: none;
26
27
  }
27
28
 
29
+ .subMenuTitleAndButton {
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: space-between;
33
+ border-bottom: borderWidthPrimary solid colorNeutralDarkest;
34
+ }
35
+
36
+ .subMenuCloseButton {
37
+ margin: spaceSmall;
38
+ }
39
+
40
+ .subMenuCloseButton:hover {
41
+ background-color: colorNeutralDarkest;
42
+ }
43
+
44
+ .subMenuCloseIcon {
45
+ color: colorSideMenuIconActive;
46
+ }
47
+
28
48
  .subMenuHeader {
29
49
  height: size60;
30
50
  display: flex;
31
51
  flex-direction: row;
32
52
  align-items: center;
33
53
  padding: spaceMedium;
34
- border-bottom: borderWidthPrimary solid colorNeutralDarkest;
35
54
  }
36
55
 
37
56
  .menuChildWrap {
@@ -57,11 +76,6 @@
57
76
  cursor: pointer;
58
77
  padding: spaceXSmall;
59
78
  border-radius: borderRadiusSmall;
60
- border: borderWidthTertiary solid colorFillNone;
61
- }
62
-
63
- .subMenuGroupHeader:focus-within {
64
- border: borderWidthTertiary solid colorFocusPrimary;
65
79
  }
66
80
 
67
81
  .subMenuGroupHeader:focus-visible {
@@ -69,7 +83,8 @@
69
83
  }
70
84
 
71
85
  .subMenuGroupHeader:focus {
72
- border: borderWidthTertiary solid colorFocusPrimary;
86
+ box-shadow: borderWidthNone borderWidthNone borderWidthNone
87
+ borderWidthTertiary colorFocusPrimary;
73
88
  }
74
89
 
75
90
  .groupTitle {
@@ -79,8 +94,8 @@
79
94
  .subMenuGroup {
80
95
  display: flex;
81
96
  flex-direction: column;
82
- margin-top: spaceMedium;
83
- gap: spaceMedium;
97
+ margin-top: spaceXSmall;
98
+ gap: spaceXXSmall;
84
99
  }
85
100
 
86
101
  .subMenuGroup.collapsed {
@@ -104,7 +119,6 @@
104
119
  cursor: pointer;
105
120
  padding: spaceXSmall;
106
121
  box-sizing: border-box;
107
- border: borderWidthTertiary solid colorFillNone;
108
122
  }
109
123
 
110
124
  .menuItem:not(.selected):hover {
@@ -117,7 +131,8 @@
117
131
 
118
132
  .menuItem:focus {
119
133
  background: colorNeutralDarkest;
120
- border: borderWidthTertiary solid colorFocusPrimary;
134
+ box-shadow: borderWidthNone borderWidthNone borderWidthNone
135
+ borderWidthTertiary colorFocusPrimary;
121
136
  }
122
137
 
123
138
  .menuIcon {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.62",
3
+ "version": "0.0.64",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {