@spaced-out/ui-design-system 0.0.20 → 0.0.22
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 +15 -0
- package/lib/components/Button/Button.js +10 -6
- package/lib/components/Button/Button.js.flow +12 -4
- package/lib/components/Button/Button.module.css +1 -1
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js +48 -0
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.js.flow +67 -0
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.module.css +75 -0
- package/lib/components/ButtonTabs/ButtonTab/index.js +16 -0
- package/lib/components/ButtonTabs/ButtonTab/index.js.flow +3 -0
- package/lib/components/ButtonTabs/ButtonTabs.js +47 -0
- package/lib/components/ButtonTabs/ButtonTabs.js.flow +62 -0
- package/lib/components/ButtonTabs/ButtonTabs.module.css +27 -0
- package/lib/components/ButtonTabs/index.js +27 -0
- package/lib/components/ButtonTabs/index.js.flow +4 -0
- package/lib/components/InContextAlert/InContextAlert.js +7 -2
- package/lib/components/InContextAlert/InContextAlert.js.flow +20 -10
- package/lib/components/InContextAlert/InContextAlert.module.css +6 -1
- package/lib/components/OptionButton/OptionButton.js +4 -2
- package/lib/components/OptionButton/OptionButton.js.flow +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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.22](https://github.com/spaced-out/ui-design-system/compare/v0.0.21...v0.0.22) (2023-02-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* button tabs component and button text fixes ([#62](https://github.com/spaced-out/ui-design-system/issues/62)) ([bd44a54](https://github.com/spaced-out/ui-design-system/commit/bd44a547e7ba0bcb9cf59be212191dd6353f79e0))
|
|
11
|
+
|
|
12
|
+
### [0.0.21](https://github.com/spaced-out/ui-design-system/compare/v0.0.20...v0.0.21) (2023-02-08)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* actiontype default value should be button ([#59](https://github.com/spaced-out/ui-design-system/issues/59)) ([f0c1c38](https://github.com/spaced-out/ui-design-system/commit/f0c1c382a2c6501a57b7ffd2e50c4b585f3079af))
|
|
18
|
+
* incontext alert design fixes ([#60](https://github.com/spaced-out/ui-design-system/issues/60)) ([60e8aa0](https://github.com/spaced-out/ui-design-system/commit/60e8aa052d56f2624a6a83aa77fdeb0f24d7327c))
|
|
19
|
+
|
|
5
20
|
### [0.0.20](https://github.com/spaced-out/ui-design-system/compare/v0.0.19...v0.0.20) (2023-02-08)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -7,6 +7,7 @@ exports.UnstyledButton = exports.Button = exports.BUTTON_TYPES = exports.BUTTON_
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classify = require("../../utils/classify");
|
|
9
9
|
var _Icon = require("../Icon");
|
|
10
|
+
var _Truncate = require("../Truncate");
|
|
10
11
|
var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
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); }
|
|
@@ -71,7 +72,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
71
72
|
type = 'primary',
|
|
72
73
|
isFluid = false,
|
|
73
74
|
disabled = false,
|
|
74
|
-
actionType = '
|
|
75
|
+
actionType = 'button',
|
|
75
76
|
size = 'medium',
|
|
76
77
|
...props
|
|
77
78
|
} = _ref2;
|
|
@@ -97,27 +98,30 @@ const Button = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
97
98
|
className: _ButtonModule.default.buttonRow
|
|
98
99
|
}, !(iconLeftName || iconRightName) ? /*#__PURE__*/React.createElement("div", {
|
|
99
100
|
className: _ButtonModule.default.textContainerCenter
|
|
100
|
-
}, children) :
|
|
101
|
+
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children)) :
|
|
101
102
|
// has icon, but no child
|
|
102
103
|
children == null ? /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
103
104
|
name: iconLeftName || iconRightName,
|
|
104
105
|
color: disabled ? 'disabled' : ButtonTypeToIconColorMap[type],
|
|
105
106
|
size: size === 'medium' ? 'medium' : 'small',
|
|
106
|
-
type: iconLeftType || iconRightType
|
|
107
|
+
type: iconLeftType || iconRightType,
|
|
108
|
+
className: classNames?.icon
|
|
107
109
|
}) :
|
|
108
110
|
// has icon _and_ child
|
|
109
111
|
(iconLeftName || iconRightName) && /*#__PURE__*/React.createElement(React.Fragment, null, iconLeftName && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
110
112
|
name: iconLeftName,
|
|
111
113
|
color: disabled ? 'disabled' : ButtonTypeToIconColorMap[type],
|
|
112
114
|
size: size === 'medium' ? 'medium' : 'small',
|
|
113
|
-
type: iconLeftType
|
|
115
|
+
type: iconLeftType,
|
|
116
|
+
className: classNames?.icon
|
|
114
117
|
}), /*#__PURE__*/React.createElement("div", {
|
|
115
118
|
className: _ButtonModule.default.textContainerLeft
|
|
116
|
-
}, children), iconRightName && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
119
|
+
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children)), iconRightName && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
117
120
|
name: iconRightName,
|
|
118
121
|
color: disabled ? 'disabled' : ButtonTypeToIconColorMap[type],
|
|
119
122
|
size: size === 'medium' ? 'medium' : 'small',
|
|
120
|
-
type: iconRightType
|
|
123
|
+
type: iconRightType,
|
|
124
|
+
className: classNames?.icon
|
|
121
125
|
}))));
|
|
122
126
|
});
|
|
123
127
|
exports.Button = Button;
|
|
@@ -5,11 +5,12 @@ import * as React from 'react';
|
|
|
5
5
|
import {classify} from '../../utils/classify';
|
|
6
6
|
import type {IconType} from '../Icon';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
+
import {Truncate} from '../Truncate';
|
|
8
9
|
|
|
9
10
|
import css from './Button.module.css';
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
13
|
+
type ClassNames = $ReadOnly<{wrapper?: string, icon?: string}>;
|
|
13
14
|
|
|
14
15
|
export const BUTTON_TYPES = Object.freeze({
|
|
15
16
|
primary: 'primary',
|
|
@@ -110,7 +111,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
110
111
|
type = 'primary',
|
|
111
112
|
isFluid = false,
|
|
112
113
|
disabled = false,
|
|
113
|
-
actionType = '
|
|
114
|
+
actionType = 'button',
|
|
114
115
|
size = 'medium',
|
|
115
116
|
...props
|
|
116
117
|
}: ButtonProps,
|
|
@@ -143,7 +144,9 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
143
144
|
<div className={css.buttonRow}>
|
|
144
145
|
{/* Has no icon, only child */}
|
|
145
146
|
{!(iconLeftName || iconRightName) ? (
|
|
146
|
-
<div className={css.textContainerCenter}>
|
|
147
|
+
<div className={css.textContainerCenter}>
|
|
148
|
+
<Truncate>{children}</Truncate>
|
|
149
|
+
</div>
|
|
147
150
|
) : // has icon, but no child
|
|
148
151
|
children == null ? (
|
|
149
152
|
<Icon
|
|
@@ -151,6 +154,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
151
154
|
color={disabled ? 'disabled' : ButtonTypeToIconColorMap[type]}
|
|
152
155
|
size={size === 'medium' ? 'medium' : 'small'}
|
|
153
156
|
type={iconLeftType || iconRightType}
|
|
157
|
+
className={classNames?.icon}
|
|
154
158
|
/>
|
|
155
159
|
) : (
|
|
156
160
|
// has icon _and_ child
|
|
@@ -164,9 +168,12 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
164
168
|
}
|
|
165
169
|
size={size === 'medium' ? 'medium' : 'small'}
|
|
166
170
|
type={iconLeftType}
|
|
171
|
+
className={classNames?.icon}
|
|
167
172
|
/>
|
|
168
173
|
)}
|
|
169
|
-
<div className={css.textContainerLeft}>
|
|
174
|
+
<div className={css.textContainerLeft}>
|
|
175
|
+
<Truncate>{children}</Truncate>
|
|
176
|
+
</div>
|
|
170
177
|
{iconRightName && (
|
|
171
178
|
<Icon
|
|
172
179
|
name={iconRightName}
|
|
@@ -175,6 +182,7 @@ export const Button: React$AbstractComponent<ButtonProps, HTMLButtonElement> =
|
|
|
175
182
|
}
|
|
176
183
|
size={size === 'medium' ? 'medium' : 'small'}
|
|
177
184
|
type={iconRightType}
|
|
185
|
+
className={classNames?.icon}
|
|
178
186
|
/>
|
|
179
187
|
)}
|
|
180
188
|
</>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ButtonTab = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../../utils/classify"));
|
|
9
|
+
var _Button = require("../../Button");
|
|
10
|
+
var _ButtonTabModule = _interopRequireDefault(require("./ButtonTab.module.css"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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); }
|
|
15
|
+
const ButtonTab = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
classNames,
|
|
18
|
+
children,
|
|
19
|
+
iconName,
|
|
20
|
+
iconType = 'regular',
|
|
21
|
+
size,
|
|
22
|
+
onButtonTabSelect,
|
|
23
|
+
id,
|
|
24
|
+
selectedButtonTabId,
|
|
25
|
+
disabled,
|
|
26
|
+
...props
|
|
27
|
+
} = _ref;
|
|
28
|
+
return /*#__PURE__*/React.createElement(_Button.Button, _extends({}, props, {
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
size: size,
|
|
31
|
+
type: id === selectedButtonTabId ? 'tertiary' : 'ghost',
|
|
32
|
+
classNames: {
|
|
33
|
+
wrapper: (0, _classify.default)(_ButtonTabModule.default.buttonTabWrapper, {
|
|
34
|
+
[_ButtonTabModule.default.mediumButtonTab]: size === 'medium',
|
|
35
|
+
[_ButtonTabModule.default.smallButtonTab]: size === 'small',
|
|
36
|
+
[_ButtonTabModule.default.onlyIcon]: iconName && !children,
|
|
37
|
+
[_ButtonTabModule.default.isSelected]: id === selectedButtonTabId,
|
|
38
|
+
[_ButtonTabModule.default.isUnSelected]: id !== selectedButtonTabId,
|
|
39
|
+
[_ButtonTabModule.default.disabled]: disabled
|
|
40
|
+
}, classNames?.wrapper),
|
|
41
|
+
icon: _ButtonTabModule.default.icon
|
|
42
|
+
},
|
|
43
|
+
iconLeftName: iconName,
|
|
44
|
+
iconLeftType: iconType,
|
|
45
|
+
onClick: e => onButtonTabSelect && onButtonTabSelect(id, e)
|
|
46
|
+
}), children);
|
|
47
|
+
};
|
|
48
|
+
exports.ButtonTab = ButtonTab;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import classify from '../../../utils/classify';
|
|
6
|
+
import {Button} from '../../Button';
|
|
7
|
+
import type {IconType} from '../../Icon';
|
|
8
|
+
|
|
9
|
+
import css from './ButtonTab.module.css';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
13
|
+
|
|
14
|
+
export type ButtonTabProps = {
|
|
15
|
+
classNames?: ClassNames,
|
|
16
|
+
children?: React.Node,
|
|
17
|
+
disabled?: boolean,
|
|
18
|
+
onButtonTabSelect?: ?(id: string, e?: SyntheticEvent<HTMLElement>) => mixed,
|
|
19
|
+
iconName?: string,
|
|
20
|
+
iconType?: IconType,
|
|
21
|
+
size?: 'medium' | 'small',
|
|
22
|
+
isFluid?: boolean,
|
|
23
|
+
ariaLabel?: string,
|
|
24
|
+
id: string,
|
|
25
|
+
selectedButtonTabId?: string,
|
|
26
|
+
...
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const ButtonTab = ({
|
|
30
|
+
classNames,
|
|
31
|
+
children,
|
|
32
|
+
iconName,
|
|
33
|
+
iconType = 'regular',
|
|
34
|
+
size,
|
|
35
|
+
onButtonTabSelect,
|
|
36
|
+
id,
|
|
37
|
+
selectedButtonTabId,
|
|
38
|
+
disabled,
|
|
39
|
+
...props
|
|
40
|
+
}: ButtonTabProps): React.Node => (
|
|
41
|
+
<Button
|
|
42
|
+
{...props}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
size={size}
|
|
45
|
+
type={id === selectedButtonTabId ? 'tertiary' : 'ghost'}
|
|
46
|
+
classNames={{
|
|
47
|
+
wrapper: classify(
|
|
48
|
+
css.buttonTabWrapper,
|
|
49
|
+
{
|
|
50
|
+
[css.mediumButtonTab]: size === 'medium',
|
|
51
|
+
[css.smallButtonTab]: size === 'small',
|
|
52
|
+
[css.onlyIcon]: iconName && !children,
|
|
53
|
+
[css.isSelected]: id === selectedButtonTabId,
|
|
54
|
+
[css.isUnSelected]: id !== selectedButtonTabId,
|
|
55
|
+
[css.disabled]: disabled,
|
|
56
|
+
},
|
|
57
|
+
classNames?.wrapper,
|
|
58
|
+
),
|
|
59
|
+
icon: css.icon,
|
|
60
|
+
}}
|
|
61
|
+
iconLeftName={iconName}
|
|
62
|
+
iconLeftType={iconType}
|
|
63
|
+
onClick={(e) => onButtonTabSelect && onButtonTabSelect(id, e)}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@value (colorTextDisabled, colorTextPrimary, colorTextSecondary, colorBackgroundTertiary, colorButtonFillTertiaryEnabled) from '../../../styles/variables/_color.css';
|
|
2
|
+
@value (size38, size30) from '../../../styles/variables/_size.css';
|
|
3
|
+
@value (spaceSmall) from '../../../styles/variables/_space.css';
|
|
4
|
+
@value (borderWidthPrimary) from '../../../styles/variables/_border.css';
|
|
5
|
+
|
|
6
|
+
button.buttonTabWrapper {
|
|
7
|
+
padding-left: spaceSmall;
|
|
8
|
+
padding-right: spaceSmall;
|
|
9
|
+
height: size38;
|
|
10
|
+
color: colorTextSecondary;
|
|
11
|
+
min-width: initial;
|
|
12
|
+
text-align: left;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.buttonTabWrapper .icon {
|
|
16
|
+
color: colorTextSecondary;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
button.buttonTabWrapper:hover {
|
|
20
|
+
color: colorTextPrimary;
|
|
21
|
+
background-color: initial;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button.buttonTabWrapper:hover .icon {
|
|
25
|
+
color: colorTextPrimary;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.buttonTabWrapper.mediumButtonTab {
|
|
29
|
+
height: size38;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.buttonTabWrapper.smallButtonTab {
|
|
33
|
+
height: size30;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.onlyIcon {
|
|
37
|
+
color: colorTextSecondary;
|
|
38
|
+
padding-left: initial;
|
|
39
|
+
padding-right: initial;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.mediumButtonTab.onlyIcon {
|
|
43
|
+
max-width: size38;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.smallButtonTab.onlyIcon {
|
|
47
|
+
max-width: size30;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.buttonTabWrapper.isSelected {
|
|
51
|
+
background-color: colorBackgroundTertiary;
|
|
52
|
+
color: colorTextPrimary;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.buttonTabWrapper.isSelected:hover {
|
|
56
|
+
background-color: colorBackgroundTertiary;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.buttonTabWrapper.isSelected .icon {
|
|
60
|
+
color: colorTextPrimary;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.buttonTabWrapper.disabled {
|
|
64
|
+
color: colorTextDisabled;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.buttonTabWrapper.disabled .icon {
|
|
68
|
+
color: colorTextDisabled;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.buttonTabWrapper.isUnSelected {
|
|
72
|
+
padding-left: spaceSmall;
|
|
73
|
+
padding-right: spaceSmall;
|
|
74
|
+
border: borderWidthPrimary solid colorButtonFillTertiaryEnabled;
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ButtonTab = require("./ButtonTab");
|
|
7
|
+
Object.keys(_ButtonTab).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ButtonTab[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ButtonTab[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ButtonTabs = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _ButtonTabsModule = _interopRequireDefault(require("./ButtonTabs.module.css"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
const ButtonTabs = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
classNames,
|
|
17
|
+
children,
|
|
18
|
+
isFluid,
|
|
19
|
+
size = 'medium',
|
|
20
|
+
disabled,
|
|
21
|
+
selectedButtonTabId,
|
|
22
|
+
onButtonTabSelect
|
|
23
|
+
} = _ref;
|
|
24
|
+
const childrenWithProps = React.Children.map(children, child => {
|
|
25
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
26
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
27
|
+
...child.props,
|
|
28
|
+
isFluid,
|
|
29
|
+
size,
|
|
30
|
+
disabled,
|
|
31
|
+
selectedButtonTabId,
|
|
32
|
+
onButtonTabSelect
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return child;
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
"data-testid": "ButtonTabs",
|
|
39
|
+
className: (0, _classify.default)(_ButtonTabsModule.default.buttonTabsWrapper, {
|
|
40
|
+
[_ButtonTabsModule.default.medium]: size === 'medium',
|
|
41
|
+
[_ButtonTabsModule.default.small]: size === 'small',
|
|
42
|
+
[_ButtonTabsModule.default.isFluid]: isFluid,
|
|
43
|
+
[_ButtonTabsModule.default.disabled]: disabled
|
|
44
|
+
}, classNames?.wrapper)
|
|
45
|
+
}, childrenWithProps);
|
|
46
|
+
};
|
|
47
|
+
exports.ButtonTabs = ButtonTabs;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import classify from '../../utils/classify';
|
|
6
|
+
|
|
7
|
+
import css from './ButtonTabs.module.css';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
11
|
+
|
|
12
|
+
export type ButtonTabsProps = {
|
|
13
|
+
classNames?: ClassNames,
|
|
14
|
+
children: React.Node,
|
|
15
|
+
isFluid?: boolean,
|
|
16
|
+
size?: 'medium' | 'small',
|
|
17
|
+
disabled?: boolean,
|
|
18
|
+
selectedButtonTabId?: string,
|
|
19
|
+
onButtonTabSelect?: ?(id: string, e?: SyntheticEvent<HTMLElement>) => mixed,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ButtonTabs = ({
|
|
23
|
+
classNames,
|
|
24
|
+
children,
|
|
25
|
+
isFluid,
|
|
26
|
+
size = 'medium',
|
|
27
|
+
disabled,
|
|
28
|
+
selectedButtonTabId,
|
|
29
|
+
onButtonTabSelect,
|
|
30
|
+
}: ButtonTabsProps): React.Node => {
|
|
31
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
|
32
|
+
if (React.isValidElement(child)) {
|
|
33
|
+
return React.cloneElement(child, {
|
|
34
|
+
...child.props,
|
|
35
|
+
isFluid,
|
|
36
|
+
size,
|
|
37
|
+
disabled,
|
|
38
|
+
selectedButtonTabId,
|
|
39
|
+
onButtonTabSelect,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return child;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
data-testid="ButtonTabs"
|
|
48
|
+
className={classify(
|
|
49
|
+
css.buttonTabsWrapper,
|
|
50
|
+
{
|
|
51
|
+
[css.medium]: size === 'medium',
|
|
52
|
+
[css.small]: size === 'small',
|
|
53
|
+
[css.isFluid]: isFluid,
|
|
54
|
+
[css.disabled]: disabled,
|
|
55
|
+
},
|
|
56
|
+
classNames?.wrapper,
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
{childrenWithProps}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@value (colorBackgroundSecondary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (size42, size34, sizeFluid) from '../../styles/variables/_size.css';
|
|
3
|
+
@value (spaceXXSmall) from '../../styles/variables/_space.css';
|
|
4
|
+
@value (borderRadiusMedium) from '../../styles/variables/_border.css';
|
|
5
|
+
|
|
6
|
+
.buttonTabsWrapper {
|
|
7
|
+
display: flex;
|
|
8
|
+
gap: spaceXXSmall;
|
|
9
|
+
background-color: colorBackgroundSecondary;
|
|
10
|
+
align-items: center;
|
|
11
|
+
padding-left: calc(spaceXXSmall / 2);
|
|
12
|
+
padding-right: calc(spaceXXSmall / 2);
|
|
13
|
+
width: fit-content;
|
|
14
|
+
border-radius: borderRadiusMedium;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.buttonTabsWrapper.medium {
|
|
18
|
+
height: size42;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.buttonTabsWrapper.small {
|
|
22
|
+
height: size34;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.buttonTabsWrapper.isFluid {
|
|
26
|
+
width: sizeFluid;
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ButtonTab = require("./ButtonTab");
|
|
7
|
+
Object.keys(_ButtonTab).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ButtonTab[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ButtonTab[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _ButtonTabs = require("./ButtonTabs");
|
|
18
|
+
Object.keys(_ButtonTabs).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _ButtonTabs[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _ButtonTabs[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -81,7 +81,9 @@ const InContextAlert = props => {
|
|
|
81
81
|
children,
|
|
82
82
|
selfDismiss = false,
|
|
83
83
|
leftIconName = '',
|
|
84
|
-
onCloseClick
|
|
84
|
+
onCloseClick,
|
|
85
|
+
actionText = '',
|
|
86
|
+
onAction
|
|
85
87
|
} = props;
|
|
86
88
|
const [dismissed, setDismissed] = React.useState(false);
|
|
87
89
|
const closeClickHandler = e => {
|
|
@@ -103,7 +105,10 @@ const InContextAlert = props => {
|
|
|
103
105
|
className: (0, _classify.classify)(classNames?.alertText)
|
|
104
106
|
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
105
107
|
line: 2
|
|
106
|
-
}, children)),
|
|
108
|
+
}, children)), actionText ? /*#__PURE__*/React.createElement(_Text.ButtonTextExtraSmall, {
|
|
109
|
+
className: _InContextAlertModule.default.actionText,
|
|
110
|
+
onClick: onAction
|
|
111
|
+
}, actionText) : dismissable && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
107
112
|
color: _typography.TEXT_COLORS.primary,
|
|
108
113
|
name: "close",
|
|
109
114
|
size: "small",
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import {TEXT_COLORS} from '../../types/typography';
|
|
6
6
|
import {classify} from '../../utils/classify';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
-
import {SubTitleExtraSmall} from '../Text';
|
|
8
|
+
import {ButtonTextExtraSmall, SubTitleExtraSmall} from '../Text';
|
|
9
9
|
import {Truncate} from '../Truncate';
|
|
10
10
|
|
|
11
11
|
import css from './InContextAlert.module.css';
|
|
@@ -32,6 +32,8 @@ type InContextAlertBaseProps = {
|
|
|
32
32
|
}
|
|
33
33
|
| {dismissable?: false},
|
|
34
34
|
children?: string,
|
|
35
|
+
actionText?: string,
|
|
36
|
+
onAction?: ?(SyntheticEvent<HTMLElement>) => mixed,
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
type InContextAlertPropsFixedIcon = {
|
|
@@ -127,6 +129,8 @@ export const InContextAlert = (props: InContextAlertProps): React.Node => {
|
|
|
127
129
|
selfDismiss = false,
|
|
128
130
|
leftIconName = '',
|
|
129
131
|
onCloseClick,
|
|
132
|
+
actionText = '',
|
|
133
|
+
onAction,
|
|
130
134
|
} = props;
|
|
131
135
|
const [dismissed, setDismissed] = React.useState(false);
|
|
132
136
|
const closeClickHandler = (e) => {
|
|
@@ -156,15 +160,21 @@ export const InContextAlert = (props: InContextAlertProps): React.Node => {
|
|
|
156
160
|
<Truncate line={2}>{children}</Truncate>
|
|
157
161
|
</SubTitleExtraSmall>
|
|
158
162
|
)}
|
|
159
|
-
{
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
{actionText ? (
|
|
164
|
+
<ButtonTextExtraSmall className={css.actionText} onClick={onAction}>
|
|
165
|
+
{actionText}
|
|
166
|
+
</ButtonTextExtraSmall>
|
|
167
|
+
) : (
|
|
168
|
+
dismissable && (
|
|
169
|
+
<Icon
|
|
170
|
+
color={TEXT_COLORS.primary}
|
|
171
|
+
name="close"
|
|
172
|
+
size="small"
|
|
173
|
+
type="regular"
|
|
174
|
+
onClick={closeClickHandler}
|
|
175
|
+
className={css.closeIcon}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
168
178
|
)}
|
|
169
179
|
</div>
|
|
170
180
|
)}
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
border-radius: borderRadiusXSmall;
|
|
35
35
|
width: sizeFluid;
|
|
36
36
|
word-break: normal;
|
|
37
|
-
overflow-wrap: anywhere;
|
|
38
37
|
border-width: borderWidthPrimary;
|
|
39
38
|
border-style: solid;
|
|
40
39
|
}
|
|
@@ -68,3 +67,9 @@
|
|
|
68
67
|
cursor: pointer;
|
|
69
68
|
margin-left: auto;
|
|
70
69
|
}
|
|
70
|
+
|
|
71
|
+
.actionText {
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
margin-left: auto;
|
|
74
|
+
text-decoration: underline;
|
|
75
|
+
}
|
|
@@ -27,7 +27,8 @@ const OptionButton = _ref => {
|
|
|
27
27
|
onButtonClick,
|
|
28
28
|
onMenuOpen,
|
|
29
29
|
onMenuClose,
|
|
30
|
-
ariaLabel
|
|
30
|
+
ariaLabel,
|
|
31
|
+
actionType
|
|
31
32
|
} = _ref;
|
|
32
33
|
const [iconName, setIconName] = React.useState('chevron-down');
|
|
33
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -43,7 +44,8 @@ const OptionButton = _ref => {
|
|
|
43
44
|
},
|
|
44
45
|
disabled: disabled,
|
|
45
46
|
isFluid: isFluid,
|
|
46
|
-
ariaLabel: ariaLabel
|
|
47
|
+
ariaLabel: ariaLabel,
|
|
48
|
+
actionType: actionType
|
|
47
49
|
}, children), /*#__PURE__*/React.createElement(_ButtonDropdown.ButtonDropdown, {
|
|
48
50
|
anchorPosition: anchorPosition,
|
|
49
51
|
ariaLabel: ariaLabel,
|
|
@@ -37,6 +37,7 @@ export const OptionButton = ({
|
|
|
37
37
|
onMenuOpen,
|
|
38
38
|
onMenuClose,
|
|
39
39
|
ariaLabel,
|
|
40
|
+
actionType,
|
|
40
41
|
}: OptionButtonProps): React.Node => {
|
|
41
42
|
const [iconName, setIconName] = React.useState('chevron-down');
|
|
42
43
|
|
|
@@ -52,6 +53,7 @@ export const OptionButton = ({
|
|
|
52
53
|
disabled={disabled}
|
|
53
54
|
isFluid={isFluid}
|
|
54
55
|
ariaLabel={ariaLabel}
|
|
56
|
+
actionType={actionType}
|
|
55
57
|
>
|
|
56
58
|
{children}
|
|
57
59
|
</Button>
|