@spaced-out/ui-design-system 0.1.122 → 0.1.123

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.1.123](https://github.com/spaced-out/ui-design-system/compare/v0.1.122...v0.1.123) (2024-08-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * [GDS-429] side menu link accordion and href inclusion ([#251](https://github.com/spaced-out/ui-design-system/issues/251)) ([e54f712](https://github.com/spaced-out/ui-design-system/commit/e54f712b6e450c80ca70aad3565fe1be8820bbb9))
11
+
5
12
  ### [0.1.122](https://github.com/spaced-out/ui-design-system/compare/v0.1.121...v0.1.122) (2024-08-22)
6
13
 
7
14
 
@@ -218,7 +218,9 @@ const PageTitle = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
218
218
  }, /*#__PURE__*/React.createElement("div", {
219
219
  className: _PageTitleModule.default.headerWithBackBtn
220
220
  }, showBackButton && /*#__PURE__*/React.createElement(_Tooltip.Tooltip, {
221
- title: "Navigate Back"
221
+ title: "Navigate Back",
222
+ delayMotionDuration: "slow",
223
+ placement: "top-start"
222
224
  }, /*#__PURE__*/React.createElement(_Button.Button, {
223
225
  onClick: handleBack,
224
226
  type: "tertiary",
@@ -239,7 +239,11 @@ export const PageTitle: React$AbstractComponent<
239
239
  <div className={classify(css.leftSlot, classNames?.leftSlot)}>
240
240
  <div className={css.headerWithBackBtn}>
241
241
  {showBackButton && (
242
- <Tooltip title="Navigate Back">
242
+ <Tooltip
243
+ title="Navigate Back"
244
+ delayMotionDuration="slow"
245
+ placement="top-start"
246
+ >
243
247
  <Button
244
248
  onClick={handleBack}
245
249
  type="tertiary"
@@ -9,6 +9,7 @@ var _classify = _interopRequireDefault(require("../../utils/classify"));
9
9
  var _Button = require("../Button");
10
10
  var _ConditionalWrapper = require("../ConditionalWrapper");
11
11
  var _Icon = require("../Icon");
12
+ var _Link = require("../Link");
12
13
  var _Text = require("../Text");
13
14
  var _Tooltip = require("../Tooltip");
14
15
  var _SideMenuLinkModule = _interopRequireDefault(require("./SideMenuLink.module.css"));
@@ -189,6 +190,10 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
189
190
  onChange,
190
191
  tabIndex = 0,
191
192
  tooltip,
193
+ isGroupMenuLink = false,
194
+ linkComponent: LinkComponent,
195
+ rightSlot,
196
+ to,
192
197
  ...restButtonProps
193
198
  } = _ref;
194
199
  const selected = selectedValue === pageNameKey;
@@ -197,6 +202,15 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
197
202
  onChange && onChange(e, pageNameKey);
198
203
  };
199
204
  return /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
205
+ condition: to !== undefined,
206
+ wrapper: children => /*#__PURE__*/React.createElement(_Link.Link, {
207
+ to: to,
208
+ tabIndex: -1,
209
+ linkComponent: LinkComponent,
210
+ onClick: e => e.preventDefault(),
211
+ className: _SideMenuLinkModule.default.linkComponent
212
+ }, children)
213
+ }, /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
200
214
  condition: Boolean(!opened && !inActive),
201
215
  wrapper: children => /*#__PURE__*/React.createElement(_Tooltip.Tooltip, _extends({
202
216
  body: MENU_NAME_LIST[pageNameKey].title
@@ -219,10 +233,13 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
219
233
  size: "medium",
220
234
  color: _Text.TEXT_COLORS.inverseSecondary,
221
235
  className: _SideMenuLinkModule.default.menuIcon
222
- }) : null, pageNameKey && MENU_NAME_LIST[pageNameKey] && opened ? /*#__PURE__*/React.createElement(_Text.SubTitleSmall, {
223
- color: _Text.TEXT_COLORS.inverseSecondary,
224
- className: _SideMenuLinkModule.default.menuText
225
- }, MENU_NAME_LIST[pageNameKey].title) : null));
236
+ }) : null, opened ? /*#__PURE__*/React.createElement("div", {
237
+ className: _SideMenuLinkModule.default.menuLabelContainer
238
+ }, pageNameKey && MENU_NAME_LIST[pageNameKey] ? isGroupMenuLink ? /*#__PURE__*/React.createElement(_Text.SubTitleSmall, {
239
+ className: _SideMenuLinkModule.default.groupMenuLinkText
240
+ }, MENU_NAME_LIST[pageNameKey].title) : /*#__PURE__*/React.createElement(_Text.BodyMedium, {
241
+ className: _SideMenuLinkModule.default.menuLinkText
242
+ }, MENU_NAME_LIST[pageNameKey].title) : null, rightSlot ? rightSlot : null) : null)));
226
243
  });
227
244
  exports.SideMenuLink = SideMenuLink;
228
245
  SideMenuLink.displayName = 'SideMenuLink';
@@ -6,7 +6,9 @@ import classify from '../../utils/classify';
6
6
  import {UnstyledButton} from '../Button';
7
7
  import {ConditionalWrapper} from '../ConditionalWrapper';
8
8
  import {Icon} from '../Icon';
9
- import {SubTitleSmall, TEXT_COLORS} from '../Text';
9
+ import type {BaseLinkProps} from '../Link';
10
+ import {Link} from '../Link';
11
+ import {BodyMedium, SubTitleSmall, TEXT_COLORS} from '../Text';
10
12
  import type {BaseTooltipProps} from '../Tooltip';
11
13
  import {Tooltip} from '../Tooltip';
12
14
 
@@ -189,6 +191,10 @@ export type SideMenuLinkProps = {
189
191
  onChange?: (e: SyntheticEvent<HTMLElement>, newValue: string) => mixed,
190
192
  tabIndex?: number,
191
193
  tooltip?: BaseTooltipProps,
194
+ isGroupMenuLink?: boolean,
195
+ to?: string,
196
+ rightSlot?: React.Node,
197
+ linkComponent?: React.AbstractComponent<BaseLinkProps, ?HTMLAnchorElement>,
192
198
  ...
193
199
  };
194
200
 
@@ -206,6 +212,10 @@ export const SideMenuLink: React$AbstractComponent<
206
212
  onChange,
207
213
  tabIndex = 0,
208
214
  tooltip,
215
+ isGroupMenuLink = false,
216
+ linkComponent: LinkComponent,
217
+ rightSlot,
218
+ to,
209
219
  ...restButtonProps
210
220
  }: SideMenuLinkProps,
211
221
  ref,
@@ -218,49 +228,73 @@ export const SideMenuLink: React$AbstractComponent<
218
228
 
219
229
  return (
220
230
  <ConditionalWrapper
221
- condition={Boolean(!opened && !inActive)}
231
+ condition={to !== undefined}
222
232
  wrapper={(children) => (
223
- <Tooltip body={MENU_NAME_LIST[pageNameKey].title} {...tooltip}>
233
+ <Link
234
+ to={to}
235
+ tabIndex={-1}
236
+ linkComponent={LinkComponent}
237
+ onClick={(e) => e.preventDefault()}
238
+ className={css.linkComponent}
239
+ >
224
240
  {children}
225
- </Tooltip>
241
+ </Link>
226
242
  )}
227
243
  >
228
- <UnstyledButton
229
- {...restButtonProps}
230
- className={classify(
231
- css.linkWrapper,
232
- {
233
- [css.selected]: selected,
234
- [css.disabled]: disabled,
235
- [css.inActive]: inActive,
236
- [css.closed]: !opened,
237
- },
238
- classNames?.wrapper,
244
+ <ConditionalWrapper
245
+ condition={Boolean(!opened && !inActive)}
246
+ wrapper={(children) => (
247
+ <Tooltip body={MENU_NAME_LIST[pageNameKey].title} {...tooltip}>
248
+ {children}
249
+ </Tooltip>
239
250
  )}
240
- onClick={onChangeHandler}
241
- ref={ref}
242
- tabIndex={disabled ? -1 : tabIndex}
243
- disabled={disabled}
244
- key={pageNameKey}
245
251
  >
246
- {pageNameKey && MENU_NAME_LIST[pageNameKey] ? (
247
- <Icon
248
- type={MENU_NAME_LIST[pageNameKey].iconType}
249
- name={MENU_NAME_LIST[pageNameKey].iconName}
250
- size="medium"
251
- color={TEXT_COLORS.inverseSecondary}
252
- className={css.menuIcon}
253
- />
254
- ) : null}
255
- {pageNameKey && MENU_NAME_LIST[pageNameKey] && opened ? (
256
- <SubTitleSmall
257
- color={TEXT_COLORS.inverseSecondary}
258
- className={css.menuText}
259
- >
260
- {MENU_NAME_LIST[pageNameKey].title}
261
- </SubTitleSmall>
262
- ) : null}
263
- </UnstyledButton>
252
+ <UnstyledButton
253
+ {...restButtonProps}
254
+ className={classify(
255
+ css.linkWrapper,
256
+ {
257
+ [css.selected]: selected,
258
+ [css.disabled]: disabled,
259
+ [css.inActive]: inActive,
260
+ [css.closed]: !opened,
261
+ },
262
+ classNames?.wrapper,
263
+ )}
264
+ onClick={onChangeHandler}
265
+ ref={ref}
266
+ tabIndex={disabled ? -1 : tabIndex}
267
+ disabled={disabled}
268
+ key={pageNameKey}
269
+ >
270
+ {pageNameKey && MENU_NAME_LIST[pageNameKey] ? (
271
+ <Icon
272
+ type={MENU_NAME_LIST[pageNameKey].iconType}
273
+ name={MENU_NAME_LIST[pageNameKey].iconName}
274
+ size="medium"
275
+ color={TEXT_COLORS.inverseSecondary}
276
+ className={css.menuIcon}
277
+ />
278
+ ) : null}
279
+ {opened ? (
280
+ <div className={css.menuLabelContainer}>
281
+ {pageNameKey && MENU_NAME_LIST[pageNameKey] ? (
282
+ isGroupMenuLink ? (
283
+ <SubTitleSmall className={css.groupMenuLinkText}>
284
+ {MENU_NAME_LIST[pageNameKey].title}
285
+ </SubTitleSmall>
286
+ ) : (
287
+ <BodyMedium className={css.menuLinkText}>
288
+ {MENU_NAME_LIST[pageNameKey].title}
289
+ </BodyMedium>
290
+ )
291
+ ) : null}
292
+
293
+ {rightSlot ? rightSlot : null}
294
+ </div>
295
+ ) : null}
296
+ </UnstyledButton>
297
+ </ConditionalWrapper>
264
298
  </ConditionalWrapper>
265
299
  );
266
300
  },
@@ -8,6 +8,7 @@
8
8
  colorSideMenuBackgroundDefault,
9
9
  colorSideMenuBackgroundHovered,
10
10
  colorSideMenuBackgroundSelected,
11
+ colorGroupMenuTextDefault,
11
12
  colorFocusPrimary
12
13
  ) from '../../styles/variables/_color.css';
13
14
  @value ( spaceNone, spaceXXSmall, spaceXSmall, spaceSmall ) from '../../styles/variables/_space.css';
@@ -62,22 +63,47 @@
62
63
  color: colorSideMenuIconDefault;
63
64
  }
64
65
 
66
+ .linkComponent {
67
+ width: sizeFluid;
68
+ text-decoration: none;
69
+ }
70
+
65
71
  .linkWrapper.selected {
66
72
  background: colorSideMenuBackgroundSelected;
67
73
  color: colorTextInversePrimary;
68
74
  }
69
75
 
70
- .linkWrapper.selected .menuIcon {
76
+ .linkWrapper.selected .menuIcon,
77
+ .linkWrapper.selected .menuLinkText {
71
78
  color: colorSideMenuIconActive;
72
79
  }
73
80
 
74
- .linkWrapper:not(.inActive):hover .menuIcon {
81
+ .linkWrapper:hover .menuIcon {
75
82
  color: colorSideMenuIconActive;
76
83
  }
77
84
 
78
- .menuText {
85
+ .groupMenuLinkText {
79
86
  color: inherit;
80
87
  margin-right: spaceSmall;
81
88
  white-space: nowrap;
82
89
  padding-right: spaceXXSmall;
83
90
  }
91
+
92
+ .menuLinkText {
93
+ color: colorGroupMenuTextDefault;
94
+ margin-right: spaceSmall;
95
+ white-space: nowrap;
96
+ padding-right: spaceXXSmall;
97
+ }
98
+
99
+ .linkWrapper:hover .menuLinkText {
100
+ color: colorSideMenuIconActive;
101
+ }
102
+
103
+ .menuLabelContainer {
104
+ color: inherit;
105
+ display: flex;
106
+ flex: 1;
107
+ justify-content: space-between;
108
+ padding-right: spaceXSmall;
109
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.122",
3
+ "version": "0.1.123",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {