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

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,13 @@
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.63](https://github.com/spaced-out/ui-design-system/compare/v0.0.62...v0.0.63) (2023-03-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * 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))
11
+
5
12
  ### [0.0.62](https://github.com/spaced-out/ui-design-system/compare/v0.0.61...v0.0.62) (2023-03-28)
6
13
 
7
14
 
@@ -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"));
@@ -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';
@@ -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,6 +8,7 @@
8
8
  colorTextInverseSecondary,
9
9
  colorTextInversePrimary,
10
10
  colorSubMenuBackgroundDefault,
11
+ colorSideMenuIconActive,
11
12
  colorSuccess,
12
13
  colorFocusDanger
13
14
  ) from '../../styles/variables/_color.css';
@@ -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 {
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.63",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {