@spaced-out/ui-design-system 0.0.34 → 0.0.36

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.
@@ -45,6 +45,7 @@
45
45
  }
46
46
 
47
47
  .sidebar-item {
48
+ cursor: pointer;
48
49
  color: #efebfa !important;
49
50
  }
50
51
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
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.36](https://github.com/spaced-out/ui-design-system/compare/v0.0.35...v0.0.36) (2023-03-03)
6
+
7
+
8
+ ### Features
9
+
10
+ * custom component in menu option ([31061ad](https://github.com/spaced-out/ui-design-system/commit/31061ad9cf685e2d73bb4cd9b733bfe3f9088e4a))
11
+
12
+ ### [0.0.35](https://github.com/spaced-out/ui-design-system/compare/v0.0.34...v0.0.35) (2023-03-02)
13
+
14
+
15
+ ### Features
16
+
17
+ * create component template script enhancements ([93b080c](https://github.com/spaced-out/ui-design-system/commit/93b080c8aa28cc0bd882be8f8572d13c60d7fcb4))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * card collapse ([#73](https://github.com/spaced-out/ui-design-system/issues/73)) ([9c03cd8](https://github.com/spaced-out/ui-design-system/commit/9c03cd88bd07b0cd0f5e13de11cd08ef8f8a3d84))
23
+ * handling for internal and external refs in tab anatomy ([#74](https://github.com/spaced-out/ui-design-system/issues/74)) ([bcdce79](https://github.com/spaced-out/ui-design-system/commit/bcdce791da04c0f0ec3e04524e97fc08116c1d41))
24
+
5
25
  ### [0.0.34](https://github.com/spaced-out/ui-design-system/compare/v0.0.33...v0.0.34) (2023-02-28)
6
26
 
7
27
 
@@ -51,6 +51,9 @@
51
51
  "42": {
52
52
  "value": "42px"
53
53
  },
54
+ "58": {
55
+ "value": "58px"
56
+ },
54
57
  "60": {
55
58
  "value": "60px"
56
59
  },
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CollapsibleCardContent = exports.CollapsibleCardAction = exports.CollapsibleCard = exports.COLLAPSIBLE_CARD_SEMANTIC = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
9
+ var _Button = require("../Button");
10
+ var _Icon = require("../Icon");
11
+ var _Truncate = require("../Truncate");
12
+ var _CollapsibleCardModule = _interopRequireDefault(require("./CollapsibleCard.module.css"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ 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); }
15
+ 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; }
16
+
17
+ const COLLAPSIBLE_CARD_SEMANTIC = Object.freeze({
18
+ neutral: 'neutral',
19
+ success: 'success',
20
+ information: 'information',
21
+ warning: 'warning',
22
+ danger: 'danger'
23
+ });
24
+ exports.COLLAPSIBLE_CARD_SEMANTIC = COLLAPSIBLE_CARD_SEMANTIC;
25
+ const CollapsibleCardAction = _ref => {
26
+ let {
27
+ children,
28
+ className
29
+ } = _ref;
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: (0, _classify.default)(_CollapsibleCardModule.default.actionContainer, className)
32
+ }, children);
33
+ };
34
+ exports.CollapsibleCardAction = CollapsibleCardAction;
35
+ const CollapsibleCardContent = _ref2 => {
36
+ let {
37
+ children,
38
+ className
39
+ } = _ref2;
40
+ return /*#__PURE__*/React.createElement("div", {
41
+ className: (0, _classify.default)(_CollapsibleCardModule.default.contentContainer, className)
42
+ }, children);
43
+ };
44
+ exports.CollapsibleCardContent = CollapsibleCardContent;
45
+ const CollapsibleCard = _ref3 => {
46
+ let {
47
+ id,
48
+ isOpen,
49
+ onChange,
50
+ classNames,
51
+ title,
52
+ children,
53
+ semantic = 'neutral',
54
+ headerIconName,
55
+ headerIconType = 'solid'
56
+ } = _ref3;
57
+ const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(Boolean(isOpen));
58
+ return /*#__PURE__*/React.createElement("div", {
59
+ "data-testid": "CollapsibleCard",
60
+ className: (0, _classify.default)(_CollapsibleCardModule.default.wrapper, classNames?.wrapper)
61
+ }, /*#__PURE__*/React.createElement(_Button.UnstyledButton, {
62
+ className: (0, _classify.default)(_CollapsibleCardModule.default.header, {
63
+ [_CollapsibleCardModule.default.isOpen]: collapsibleCardIsOpen
64
+ }, classNames?.title),
65
+ onClick: e => {
66
+ onChange?.(e, !collapsibleCardIsOpen, id);
67
+ setCollapsibleCardIsOpen(!collapsibleCardIsOpen);
68
+ }
69
+ }, /*#__PURE__*/React.createElement("div", {
70
+ className: _CollapsibleCardModule.default.headerContent
71
+ }, !!headerIconName && /*#__PURE__*/React.createElement("div", {
72
+ className: (0, _classify.default)(_CollapsibleCardModule.default.iconContainer, _CollapsibleCardModule.default[semantic])
73
+ }, /*#__PURE__*/React.createElement(_Icon.Icon, {
74
+ name: headerIconName,
75
+ type: headerIconType,
76
+ size: "small",
77
+ className: _CollapsibleCardModule.default[semantic]
78
+ })), /*#__PURE__*/React.createElement(_Truncate.Truncate, null, title)), collapsibleCardIsOpen ? /*#__PURE__*/React.createElement(_Icon.Icon, {
79
+ name: "chevron-up",
80
+ color: "secondary",
81
+ size: "small"
82
+ }) : /*#__PURE__*/React.createElement(_Icon.Icon, {
83
+ name: "chevron-down",
84
+ color: "secondary",
85
+ size: "small"
86
+ })), collapsibleCardIsOpen && /*#__PURE__*/React.createElement("div", {
87
+ className: (0, _classify.default)(_CollapsibleCardModule.default.content, classNames?.content)
88
+ }, children));
89
+ };
90
+ exports.CollapsibleCard = CollapsibleCard;
@@ -0,0 +1,133 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import classify from '../../utils/classify';
6
+ import {UnstyledButton} from '../Button';
7
+ import type {IconType} from '../Icon';
8
+ import {Icon} from '../Icon';
9
+ import {Truncate} from '../Truncate';
10
+
11
+ import css from './CollapsibleCard.module.css';
12
+
13
+
14
+ export const COLLAPSIBLE_CARD_SEMANTIC = Object.freeze({
15
+ neutral: 'neutral',
16
+ success: 'success',
17
+ information: 'information',
18
+ warning: 'warning',
19
+ danger: 'danger',
20
+ });
21
+
22
+ type ClassNames = $ReadOnly<{
23
+ wrapper?: string,
24
+ title?: string,
25
+ content?: string,
26
+ }>;
27
+
28
+ export type CollapsibleCardSemanticType = $Values<
29
+ typeof COLLAPSIBLE_CARD_SEMANTIC,
30
+ >;
31
+
32
+ export type CollapsibleCardProps = {
33
+ id?: string,
34
+ title: React.Node,
35
+ children: React.Node,
36
+ classNames?: ClassNames,
37
+ isOpen?: boolean,
38
+ headerIconName?: string,
39
+ headerIconType?: IconType,
40
+ semantic?: CollapsibleCardSemanticType,
41
+ onChange?: ?(
42
+ e: SyntheticEvent<HTMLElement>,
43
+ isOpen: boolean,
44
+ id?: string,
45
+ ) => mixed,
46
+ };
47
+
48
+ export type CollapsibleCardActionProps = {
49
+ children: React.Node,
50
+ className?: string,
51
+ };
52
+
53
+ export const CollapsibleCardAction = ({
54
+ children,
55
+ className,
56
+ }: CollapsibleCardActionProps): React.Node => (
57
+ <div className={classify(css.actionContainer, className)}>{children}</div>
58
+ );
59
+
60
+ export type CollapsibleCardContentProps = {
61
+ children: React.Node,
62
+ className?: string,
63
+ };
64
+
65
+ export const CollapsibleCardContent = ({
66
+ children,
67
+ className,
68
+ }: CollapsibleCardActionProps): React.Node => (
69
+ <div className={classify(css.contentContainer, className)}>{children}</div>
70
+ );
71
+
72
+ export const CollapsibleCard = ({
73
+ id,
74
+ isOpen,
75
+ onChange,
76
+ classNames,
77
+ title,
78
+ children,
79
+ semantic = 'neutral',
80
+ headerIconName,
81
+ headerIconType = 'solid',
82
+ }: CollapsibleCardProps): React.Node => {
83
+ const [collapsibleCardIsOpen, setCollapsibleCardIsOpen] = React.useState(
84
+ Boolean(isOpen),
85
+ );
86
+
87
+ return (
88
+ <div
89
+ data-testid="CollapsibleCard"
90
+ className={classify(css.wrapper, classNames?.wrapper)}
91
+ >
92
+ <UnstyledButton
93
+ className={classify(
94
+ css.header,
95
+ {
96
+ [css.isOpen]: collapsibleCardIsOpen,
97
+ },
98
+ classNames?.title,
99
+ )}
100
+ onClick={(e) => {
101
+ onChange?.(e, !collapsibleCardIsOpen, id);
102
+ setCollapsibleCardIsOpen(!collapsibleCardIsOpen);
103
+ }}
104
+ >
105
+ <div className={css.headerContent}>
106
+ {!!headerIconName && (
107
+ <div className={classify(css.iconContainer, css[semantic])}>
108
+ <Icon
109
+ name={headerIconName}
110
+ type={headerIconType}
111
+ size="small"
112
+ className={css[semantic]}
113
+ />
114
+ </div>
115
+ )}
116
+
117
+ <Truncate>{title}</Truncate>
118
+ </div>
119
+
120
+ {collapsibleCardIsOpen ? (
121
+ <Icon name="chevron-up" color="secondary" size="small" />
122
+ ) : (
123
+ <Icon name="chevron-down" color="secondary" size="small" />
124
+ )}
125
+ </UnstyledButton>
126
+ {collapsibleCardIsOpen && (
127
+ <div className={classify(css.content, classNames?.content)}>
128
+ {children}
129
+ </div>
130
+ )}
131
+ </div>
132
+ );
133
+ };
@@ -0,0 +1,139 @@
1
+ @value (colorBorderPrimary,
2
+ colorBackgroundPrimary,
3
+ colorBackgroundTertiary,
4
+ colorNeutralLightest,
5
+ colorNeutral,
6
+ colorInformationLightest,
7
+ colorInformation,
8
+ colorSuccessLightest,
9
+ colorSuccess,
10
+ colorDangerLightest,
11
+ colorDanger,
12
+ colorWarningLightest,
13
+ colorWarning,
14
+ colorFocusPrimary
15
+ ) from '../../styles/variables/_color.css';
16
+ @value (sizeFluid, size58, size34) from '../../styles/variables/_size.css';
17
+ @value (spaceSmall, spaceXSmall) from '../../styles/variables/_space.css';
18
+ @value (elevationCard) from '../../styles/variables/_elevation.css';
19
+ @value (borderWidthNone,
20
+ borderWidthPrimary,
21
+ borderRadiusSmall,
22
+ borderRadiusNone,
23
+ borderWidthTertiary
24
+ ) from '../../styles/variables/_border.css';
25
+
26
+ .wrapper {
27
+ display: flex;
28
+ flex-flow: column;
29
+ width: sizeFluid;
30
+ }
31
+
32
+ .header {
33
+ composes: subTitleSmall from '../../styles/typography.module.css';
34
+ composes: borderPrimary from '../../styles/border.module.css';
35
+ /* composes: motionEaseInEaseOut from '../../styles/animation.module.css'; */
36
+ min-height: size58;
37
+ border-radius: borderRadiusSmall;
38
+ display: flex;
39
+ cursor: pointer;
40
+ align-items: center;
41
+ width: sizeFluid;
42
+ justify-content: space-between;
43
+ gap: spaceSmall;
44
+ padding: spaceSmall;
45
+ background-color: colorBackgroundTertiary;
46
+ z-index: elevationCard;
47
+ }
48
+
49
+ .header:focus {
50
+ box-shadow: borderWidthNone borderWidthNone borderWidthNone
51
+ borderWidthTertiary colorFocusPrimary;
52
+ }
53
+
54
+ .header.isOpen {
55
+ border-radius: borderRadiusSmall borderRadiusSmall borderRadiusNone
56
+ borderRadiusNone;
57
+ }
58
+
59
+ .headerContent {
60
+ display: flex;
61
+ gap: spaceXSmall;
62
+ align-items: center;
63
+ text-align: left;
64
+ }
65
+
66
+ .iconContainer {
67
+ display: flex;
68
+ min-width: size34;
69
+ min-height: size34;
70
+ border-radius: borderRadiusSmall;
71
+ align-items: center;
72
+ justify-content: center;
73
+ }
74
+
75
+ .iconContainer.neutral {
76
+ background-color: colorNeutralLightest;
77
+ }
78
+
79
+ .iconContainer .neutral {
80
+ color: colorNeutral;
81
+ }
82
+
83
+ .iconContainer.success {
84
+ background-color: colorSuccessLightest;
85
+ }
86
+
87
+ .iconContainer .success {
88
+ color: colorSuccess;
89
+ }
90
+
91
+ .iconContainer.information {
92
+ background-color: colorInformationLightest;
93
+ }
94
+
95
+ .iconContainer .information {
96
+ color: colorInformation;
97
+ }
98
+
99
+ .iconContainer.warning {
100
+ background-color: colorWarningLightest;
101
+ }
102
+
103
+ .iconContainer .warning {
104
+ color: colorWarning;
105
+ }
106
+
107
+ .iconContainer.danger {
108
+ background-color: colorDangerLightest;
109
+ }
110
+
111
+ .iconContainer .danger {
112
+ color: colorDanger;
113
+ }
114
+
115
+ .content {
116
+ display: flex;
117
+ flex-flow: column;
118
+ background-color: colorBackgroundPrimary;
119
+ border-left: borderWidthPrimary solid colorBorderPrimary;
120
+ border-right: borderWidthPrimary solid colorBorderPrimary;
121
+ border-bottom: borderWidthPrimary solid colorBorderPrimary;
122
+ border-radius: borderRadiusNone borderRadiusNone borderRadiusSmall
123
+ borderRadiusSmall;
124
+ }
125
+
126
+ .contentContainer {
127
+ display: flex;
128
+ padding: spaceSmall;
129
+ }
130
+
131
+ .actionContainer {
132
+ display: flex;
133
+ border-top: borderWidthPrimary solid colorBorderPrimary;
134
+ border-radius: borderRadiusNone borderRadiusNone borderRadiusSmall
135
+ borderRadiusSmall;
136
+ background-color: colorBackgroundTertiary;
137
+ padding: spaceSmall;
138
+ gap: spaceXSmall;
139
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _CollapsibleCard = require("./CollapsibleCard");
7
+ Object.keys(_CollapsibleCard).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _CollapsibleCard[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _CollapsibleCard[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './CollapsibleCard';
@@ -36,32 +36,32 @@ const DialogIcon = _ref => {
36
36
  });
37
37
  case DIALOG_SEMANTIC.success:
38
38
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
39
- name: "circle-check",
39
+ name: iconName ? iconName : 'circle-check',
40
40
  color: _typography.TEXT_COLORS.success,
41
41
  type: "solid"
42
42
  });
43
43
  case DIALOG_SEMANTIC.information:
44
44
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
45
- name: "circle-info",
45
+ name: iconName ? iconName : 'circle-info',
46
46
  color: _typography.TEXT_COLORS.information,
47
47
  type: "solid"
48
48
  });
49
49
  case DIALOG_SEMANTIC.warning:
50
50
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
51
- name: "circle-exclamation",
51
+ name: iconName ? iconName : 'circle-exclamation',
52
52
  color: _typography.TEXT_COLORS.warning,
53
53
  type: "solid"
54
54
  });
55
55
  case DIALOG_SEMANTIC.danger:
56
56
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
57
- name: "shield-exclamation",
57
+ name: iconName ? iconName : 'shield-exclamation',
58
58
  color: _typography.TEXT_COLORS.danger,
59
59
  type: "solid"
60
60
  });
61
61
  default:
62
62
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
63
63
  color: _typography.TEXT_COLORS.neutral,
64
- name: "face-smile",
64
+ name: iconName ? iconName : 'face-smile',
65
65
  type: "solid"
66
66
  });
67
67
  }
@@ -37,21 +37,12 @@ export type DialogPropsBase = {
37
37
  ...ModalProps,
38
38
  };
39
39
 
40
- export type DialogPropsWithFixedIcon = {
40
+ export type DialogProps = {
41
41
  ...DialogPropsBase,
42
42
  semantic?: DialogSemanticType,
43
- };
44
-
45
- export type DialogPropsWithVariableIcon = {
46
- ...DialogPropsBase,
47
- semantic?: 'neutral',
48
43
  iconName?: string,
49
44
  };
50
45
 
51
- export type DialogProps =
52
- | DialogPropsWithFixedIcon
53
- | DialogPropsWithVariableIcon;
54
-
55
46
  const DialogIcon = ({
56
47
  semantic,
57
48
  iconName,
@@ -70,18 +61,26 @@ const DialogIcon = ({
70
61
  );
71
62
  case DIALOG_SEMANTIC.success:
72
63
  return (
73
- <Icon name="circle-check" color={TEXT_COLORS.success} type="solid" />
64
+ <Icon
65
+ name={iconName ? iconName : 'circle-check'}
66
+ color={TEXT_COLORS.success}
67
+ type="solid"
68
+ />
74
69
  );
75
70
 
76
71
  case DIALOG_SEMANTIC.information:
77
72
  return (
78
- <Icon name="circle-info" color={TEXT_COLORS.information} type="solid" />
73
+ <Icon
74
+ name={iconName ? iconName : 'circle-info'}
75
+ color={TEXT_COLORS.information}
76
+ type="solid"
77
+ />
79
78
  );
80
79
 
81
80
  case DIALOG_SEMANTIC.warning:
82
81
  return (
83
82
  <Icon
84
- name="circle-exclamation"
83
+ name={iconName ? iconName : 'circle-exclamation'}
85
84
  color={TEXT_COLORS.warning}
86
85
  type="solid"
87
86
  />
@@ -90,7 +89,7 @@ const DialogIcon = ({
90
89
  case DIALOG_SEMANTIC.danger:
91
90
  return (
92
91
  <Icon
93
- name="shield-exclamation"
92
+ name={iconName ? iconName : 'shield-exclamation'}
94
93
  color={TEXT_COLORS.danger}
95
94
  type="solid"
96
95
  />
@@ -98,7 +97,11 @@ const DialogIcon = ({
98
97
 
99
98
  default:
100
99
  return (
101
- <Icon color={TEXT_COLORS.neutral} name="face-smile" type="solid" />
100
+ <Icon
101
+ color={TEXT_COLORS.neutral}
102
+ name={iconName ? iconName : 'face-smile'}
103
+ type="solid"
104
+ />
102
105
  );
103
106
  }
104
107
  };
@@ -38,28 +38,28 @@ const AlertIcon = _ref => {
38
38
  });
39
39
  case ALERT_SEMANTIC.success:
40
40
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
41
- name: "circle-check",
41
+ name: leftIconName ? leftIconName : 'circle-check',
42
42
  size: "small",
43
43
  color: _typography.TEXT_COLORS.success,
44
44
  type: "regular"
45
45
  });
46
46
  case ALERT_SEMANTIC.information:
47
47
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
48
- name: "circle-info",
48
+ name: leftIconName ? leftIconName : 'circle-info',
49
49
  size: "small",
50
50
  color: _typography.TEXT_COLORS.information,
51
51
  type: "regular"
52
52
  });
53
53
  case ALERT_SEMANTIC.warning:
54
54
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
55
- name: "circle-exclamation",
55
+ name: leftIconName ? leftIconName : 'circle-exclamation',
56
56
  size: "small",
57
57
  color: _typography.TEXT_COLORS.warning,
58
58
  type: "regular"
59
59
  });
60
60
  case ALERT_SEMANTIC.danger:
61
61
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
62
- name: "shield-exclamation",
62
+ name: leftIconName ? leftIconName : 'shield-exclamation',
63
63
  size: "small",
64
64
  color: _typography.TEXT_COLORS.danger,
65
65
  type: "regular"
@@ -67,7 +67,7 @@ const AlertIcon = _ref => {
67
67
  default:
68
68
  return /*#__PURE__*/React.createElement(_Icon.Icon, {
69
69
  color: _typography.TEXT_COLORS.neutral,
70
- name: "face-smile",
70
+ name: leftIconName ? leftIconName : 'face-smile',
71
71
  size: "small",
72
72
  type: "regular"
73
73
  });
@@ -36,21 +36,12 @@ type InContextAlertBaseProps = {
36
36
  onAction?: ?(SyntheticEvent<HTMLElement>) => mixed,
37
37
  };
38
38
 
39
- type InContextAlertPropsFixedIcon = {
39
+ export type InContextAlertProps = {
40
40
  ...InContextAlertBaseProps,
41
41
  semantic: AlertSemanticType,
42
- };
43
-
44
- type InContextAlertPropsNeutral = {
45
- ...InContextAlertBaseProps,
46
- semantic?: 'neutral',
47
42
  leftIconName?: string,
48
43
  };
49
44
 
50
- export type InContextAlertProps =
51
- | InContextAlertPropsFixedIcon
52
- | InContextAlertPropsNeutral;
53
-
54
45
  const AlertIcon = ({
55
46
  semantic,
56
47
  leftIconName,
@@ -71,7 +62,7 @@ const AlertIcon = ({
71
62
  case ALERT_SEMANTIC.success:
72
63
  return (
73
64
  <Icon
74
- name="circle-check"
65
+ name={leftIconName ? leftIconName : 'circle-check'}
75
66
  size="small"
76
67
  color={TEXT_COLORS.success}
77
68
  type="regular"
@@ -81,7 +72,7 @@ const AlertIcon = ({
81
72
  case ALERT_SEMANTIC.information:
82
73
  return (
83
74
  <Icon
84
- name="circle-info"
75
+ name={leftIconName ? leftIconName : 'circle-info'}
85
76
  size="small"
86
77
  color={TEXT_COLORS.information}
87
78
  type="regular"
@@ -91,7 +82,7 @@ const AlertIcon = ({
91
82
  case ALERT_SEMANTIC.warning:
92
83
  return (
93
84
  <Icon
94
- name="circle-exclamation"
85
+ name={leftIconName ? leftIconName : 'circle-exclamation'}
95
86
  size="small"
96
87
  color={TEXT_COLORS.warning}
97
88
  type="regular"
@@ -101,7 +92,7 @@ const AlertIcon = ({
101
92
  case ALERT_SEMANTIC.danger:
102
93
  return (
103
94
  <Icon
104
- name="shield-exclamation"
95
+ name={leftIconName ? leftIconName : 'shield-exclamation'}
105
96
  size="small"
106
97
  color={TEXT_COLORS.danger}
107
98
  type="regular"
@@ -112,7 +103,7 @@ const AlertIcon = ({
112
103
  return (
113
104
  <Icon
114
105
  color={TEXT_COLORS.neutral}
115
- name="face-smile"
106
+ name={leftIconName ? leftIconName : 'face-smile'}
116
107
  size="small"
117
108
  type="regular"
118
109
  />
@@ -13,8 +13,9 @@ type ClassNames = $ReadOnly<{wrapper?: string}>;
13
13
 
14
14
  export type MenuOption = {
15
15
  key?: string,
16
- label: string,
16
+ label?: string,
17
17
  secondaryLabel?: string,
18
+ customComponent?: React.Node,
18
19
  iconLeft?: string,
19
20
  iconLeftType?: IconType,
20
21
  iconRight?: string,
@@ -26,6 +26,7 @@ const MenuOptionButton = props => {
26
26
  key,
27
27
  label,
28
28
  secondaryLabel,
29
+ customComponent,
29
30
  iconLeft,
30
31
  iconLeftType,
31
32
  iconRight,
@@ -58,7 +59,7 @@ const MenuOptionButton = props => {
58
59
  className: _MenuModule.default.optionTextContainer
59
60
  }, /*#__PURE__*/React.createElement("div", {
60
61
  className: _MenuModule.default.optionTextLabel
61
- }, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, label)), !!secondaryLabel && /*#__PURE__*/React.createElement("div", {
62
+ }, /*#__PURE__*/React.isValidElement(customComponent) ? customComponent : /*#__PURE__*/React.createElement(_Truncate.Truncate, null, label)), !!secondaryLabel && /*#__PURE__*/React.createElement("div", {
62
63
  className: _MenuModule.default.optionTextSecondaryLabel
63
64
  }, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, secondaryLabel))), !!iconRight && /*#__PURE__*/React.createElement(_Icon.Icon, {
64
65
  name: iconRight,
@@ -30,6 +30,7 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
30
30
  key,
31
31
  label,
32
32
  secondaryLabel,
33
+ customComponent,
33
34
  iconLeft,
34
35
  iconLeftType,
35
36
  iconRight,
@@ -67,7 +68,11 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
67
68
  )}
68
69
  <div className={css.optionTextContainer}>
69
70
  <div className={css.optionTextLabel}>
70
- <Truncate>{label}</Truncate>
71
+ {React.isValidElement(customComponent) ? (
72
+ customComponent
73
+ ) : (
74
+ <Truncate>{label}</Truncate>
75
+ )}
71
76
  </div>
72
77
 
73
78
  {!!secondaryLabel && (
@@ -22,7 +22,7 @@ const TAB_SIZE = Object.freeze({
22
22
  exports.TAB_SIZE = TAB_SIZE;
23
23
  const tabSizeOptions = [...Object.keys(TAB_SIZE)];
24
24
  exports.tabSizeOptions = tabSizeOptions;
25
- const Tab = _ref => {
25
+ const Tab = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
26
26
  let {
27
27
  classNames,
28
28
  onSelect,
@@ -37,7 +37,8 @@ const Tab = _ref => {
37
37
  width,
38
38
  ...props
39
39
  } = _ref;
40
- const ref = React.useRef(null);
40
+ const tabRef = React.useRef(null);
41
+ React.useImperativeHandle(forwardRef, () => tabRef.current);
41
42
  const selected = tabId && tabId === selectedTab?.tabId;
42
43
  const onClickHandler = e => {
43
44
  if (!disabled) {
@@ -47,7 +48,7 @@ const Tab = _ref => {
47
48
  label
48
49
  });
49
50
  onClick && onClick(e);
50
- ref.current?.blur();
51
+ tabRef.current?.blur();
51
52
  }
52
53
  };
53
54
  return /*#__PURE__*/React.createElement(_Button.UnstyledButton, _extends({}, props, {
@@ -63,7 +64,7 @@ const Tab = _ref => {
63
64
  width
64
65
  },
65
66
  tabIndex: disabled ? '-1' : 0,
66
- ref: ref
67
+ ref: tabRef
67
68
  }), /*#__PURE__*/React.createElement("span", {
68
69
  className: (0, _classify.classify)(_TabModule.default.iconTextWrap, {
69
70
  [_TabModule.default.selected]: selected === true,
@@ -88,6 +89,6 @@ const Tab = _ref => {
88
89
  [_TabModule.default.disabled]: disabled === true
89
90
  })
90
91
  }, label))));
91
- };
92
+ });
92
93
  exports.Tab = Tab;
93
94
  Tab.displayName = 'Tab';
@@ -37,97 +37,104 @@ export type TabProps = {
37
37
  onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
38
38
  };
39
39
 
40
- export const Tab = ({
41
- classNames,
42
- onSelect,
43
- size = 'medium',
44
- selectedTab,
45
- disabled = false,
46
- tabId,
47
- label,
48
- iconName,
49
- iconType,
50
- onClick,
51
- width,
52
- ...props
53
- }: TabProps): React.Node => {
54
- const ref = React.useRef(null);
55
- const selected = tabId && tabId === selectedTab?.tabId;
56
- const onClickHandler = (e) => {
57
- if (!disabled) {
58
- e.preventDefault();
59
- onSelect && onSelect({tabId, label});
60
- onClick && onClick(e);
61
- ref.current?.blur();
62
- }
63
- };
64
- return (
65
- <UnstyledButton
66
- {...props}
67
- disabled={disabled}
68
- className={classify(
69
- css.button,
70
- {
71
- [css.selected]: selected === true,
72
- [css.disabled]: disabled === true,
73
- [css.mediumSize]: size === 'medium',
74
- [css.smallSize]: size === 'small',
75
- },
76
- classNames?.wrapper,
77
- )}
78
- onClick={onClickHandler}
79
- style={{width}}
80
- tabIndex={disabled ? '-1' : 0}
81
- ref={ref}
82
- >
83
- <span
84
- className={classify(
85
- css.iconTextWrap,
86
- {
87
- [css.selected]: selected === true,
88
- [css.disabled]: disabled === true,
89
- },
90
- classNames?.iconTextWrap,
91
- )}
92
- >
93
- {iconName ? (
94
- <Icon
95
- name={iconName}
96
- type={iconType}
97
- size={size}
98
- className={classify(css.icon, {
40
+ export const Tab: React$AbstractComponent<TabProps, HTMLButtonElement> =
41
+ React.forwardRef<TabProps, HTMLButtonElement>(
42
+ (
43
+ {
44
+ classNames,
45
+ onSelect,
46
+ size = 'medium',
47
+ selectedTab,
48
+ disabled = false,
49
+ tabId,
50
+ label,
51
+ iconName,
52
+ iconType,
53
+ onClick,
54
+ width,
55
+ ...props
56
+ }: TabProps,
57
+ forwardRef,
58
+ ) => {
59
+ const tabRef = React.useRef(null);
60
+ React.useImperativeHandle(forwardRef, () => tabRef.current);
61
+ const selected = tabId && tabId === selectedTab?.tabId;
62
+ const onClickHandler = (e) => {
63
+ if (!disabled) {
64
+ e.preventDefault();
65
+ onSelect && onSelect({tabId, label});
66
+ onClick && onClick(e);
67
+ tabRef.current?.blur();
68
+ }
69
+ };
70
+ return (
71
+ <UnstyledButton
72
+ {...props}
73
+ disabled={disabled}
74
+ className={classify(
75
+ css.button,
76
+ {
77
+ [css.selected]: selected === true,
99
78
  [css.disabled]: disabled === true,
100
- })}
101
- />
102
- ) : null}
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,
79
+ [css.mediumSize]: size === 'medium',
80
+ [css.smallSize]: size === 'small',
81
+ },
82
+ classNames?.wrapper,
83
+ )}
84
+ onClick={onClickHandler}
85
+ style={{width}}
86
+ tabIndex={disabled ? '-1' : 0}
87
+ ref={tabRef}
88
+ >
89
+ <span
90
+ className={classify(
91
+ css.iconTextWrap,
92
+ {
93
+ [css.selected]: selected === true,
94
+ [css.disabled]: disabled === true,
95
+ },
96
+ classNames?.iconTextWrap,
97
+ )}
98
+ >
99
+ {iconName ? (
100
+ <Icon
101
+ name={iconName}
102
+ type={iconType}
103
+ size={size}
104
+ className={classify(css.icon, {
120
105
  [css.disabled]: disabled === true,
121
106
  })}
122
- >
123
- {label}
124
- </ButtonTextSmall>
107
+ />
108
+ ) : null}
109
+
110
+ {label && (
111
+ <>
112
+ {size === TAB_SIZE.medium ? (
113
+ <ButtonTextMedium
114
+ color={TEXT_COLORS.secondary}
115
+ className={classify(css.tabContainer, {
116
+ [css.disabled]: disabled === true,
117
+ })}
118
+ >
119
+ {label}
120
+ </ButtonTextMedium>
121
+ ) : (
122
+ <ButtonTextSmall
123
+ color={TEXT_COLORS.secondary}
124
+ className={classify(css.tabContainer, {
125
+ [css.selected]: selected === true,
126
+ [css.disabled]: disabled === true,
127
+ })}
128
+ >
129
+ {label}
130
+ </ButtonTextSmall>
131
+ )}
132
+ </>
125
133
  )}
126
- </>
127
- )}
128
- </span>
129
- </UnstyledButton>
134
+ </span>
135
+ </UnstyledButton>
136
+ );
137
+ },
130
138
  );
131
- };
132
139
 
133
140
  Tab.displayName = 'Tab';
@@ -32,6 +32,8 @@
32
32
 
33
33
  @value size42: 42px;
34
34
 
35
+ @value size58: 58px;
36
+
35
37
  @value size60: 60px;
36
38
 
37
39
  @value size100: 100px;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.sizeFullViewportHeight = exports.sizeFluid = exports.size960 = exports.size8 = exports.size720 = exports.size60 = exports.size580 = exports.size500 = exports.size5 = exports.size480 = exports.size42 = exports.size400 = exports.size40 = exports.size4 = exports.size380 = exports.size38 = exports.size36 = exports.size34 = exports.size300 = exports.size30 = exports.size276 = exports.size260 = exports.size26 = exports.size240 = exports.size24 = exports.size228 = exports.size22 = exports.size20 = exports.size2 = exports.size18 = exports.size160 = exports.size140 = exports.size12 = exports.size110 = exports.size100 = exports.size10 = void 0;
6
+ exports.sizeFullViewportHeight = exports.sizeFluid = exports.size960 = exports.size8 = exports.size720 = exports.size60 = exports.size580 = exports.size58 = exports.size500 = exports.size5 = exports.size480 = exports.size42 = exports.size400 = exports.size40 = exports.size4 = exports.size380 = exports.size38 = exports.size36 = exports.size34 = exports.size300 = exports.size30 = exports.size276 = exports.size260 = exports.size26 = exports.size240 = exports.size24 = exports.size228 = exports.size22 = exports.size20 = exports.size2 = exports.size18 = exports.size160 = exports.size140 = exports.size12 = exports.size110 = exports.size100 = exports.size10 = void 0;
7
7
 
8
8
  const size2 = '2px';
9
9
  exports.size2 = size2;
@@ -39,6 +39,8 @@ const size40 = '40px';
39
39
  exports.size40 = size40;
40
40
  const size42 = '42px';
41
41
  exports.size42 = size42;
42
+ const size58 = '58px';
43
+ exports.size58 = size58;
42
44
  const size60 = '60px';
43
45
  exports.size60 = size60;
44
46
  const size100 = '100px';
@@ -34,6 +34,8 @@ export const size40 = '40px';
34
34
 
35
35
  export const size42 = '42px';
36
36
 
37
+ export const size58 = '58px';
38
+
37
39
  export const size60 = '60px';
38
40
 
39
41
  export const size100 = '100px';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {