@spaced-out/ui-design-system 0.0.46 → 0.0.48
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 +14 -0
- package/lib/components/Banner/Banner.js +41 -0
- package/lib/components/Banner/Banner.js.flow +51 -0
- package/lib/components/Banner/Banner.module.css +56 -0
- package/lib/components/Banner/index.js +16 -0
- package/lib/components/Banner/index.js.flow +3 -0
- package/lib/components/Dialog/Dialog.js +9 -6
- package/lib/components/Dialog/Dialog.js.flow +18 -6
- package/lib/components/InContextAlert/InContextAlert.js +17 -12
- package/lib/components/InContextAlert/InContextAlert.js.flow +47 -23
- package/lib/components/InContextAlert/InContextAlert.module.css +9 -2
- package/lib/components/InContextAlert/index.js +11 -13
- package/lib/components/InContextAlert/index.js.flow +1 -1
- package/lib/components/Modal/Modal.js +9 -6
- package/lib/components/Modal/Modal.js.flow +15 -5
- package/lib/components/Panel/Panel.js +9 -6
- package/lib/components/Panel/Panel.js.flow +15 -5
- package/package.json +1 -1
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.48](https://github.com/spaced-out/ui-design-system/compare/v0.0.47...v0.0.48) (2023-03-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* exposed classnames for dialog modal and panel semantic components ([551c7c1](https://github.com/spaced-out/ui-design-system/commit/551c7c1451d70073de5ca8f6a5935e68cd3fefe6))
|
|
11
|
+
|
|
12
|
+
### [0.0.47](https://github.com/spaced-out/ui-design-system/compare/v0.0.46...v0.0.47) (2023-03-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* banner component ([bbf4420](https://github.com/spaced-out/ui-design-system/commit/bbf4420b9ed333c902a56442d9a64b8558c820a1))
|
|
18
|
+
|
|
5
19
|
### [0.0.46](https://github.com/spaced-out/ui-design-system/compare/v0.0.45...v0.0.46) (2023-03-10)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Banner = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _InContextAlert = require("../InContextAlert");
|
|
10
|
+
var _BannerModule = _interopRequireDefault(require("./Banner.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 Banner = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
classNames,
|
|
18
|
+
semantic,
|
|
19
|
+
leftIconType = 'solid',
|
|
20
|
+
alignment = 'top',
|
|
21
|
+
...props
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_InContextAlert.InContextAlert, _extends({}, props, {
|
|
24
|
+
leftIconType: leftIconType,
|
|
25
|
+
semantic: semantic,
|
|
26
|
+
classNames: {
|
|
27
|
+
wrapper: (0, _classify.default)(_BannerModule.default.bannerContainer, {
|
|
28
|
+
[_BannerModule.default.neutral]: semantic === _InContextAlert.ALERT_SEMANTIC.neutral,
|
|
29
|
+
[_BannerModule.default.success]: semantic === _InContextAlert.ALERT_SEMANTIC.success,
|
|
30
|
+
[_BannerModule.default.information]: semantic === _InContextAlert.ALERT_SEMANTIC.information,
|
|
31
|
+
[_BannerModule.default.warning]: semantic === _InContextAlert.ALERT_SEMANTIC.warning,
|
|
32
|
+
[_BannerModule.default.danger]: semantic === _InContextAlert.ALERT_SEMANTIC.danger,
|
|
33
|
+
[_BannerModule.default.topAligned]: alignment === 'top',
|
|
34
|
+
[_BannerModule.default.bottomAligned]: alignment === 'bottom'
|
|
35
|
+
}, classNames?.wrapper),
|
|
36
|
+
alertText: (0, _classify.default)(classNames?.alertText),
|
|
37
|
+
actionContainer: (0, _classify.default)(_BannerModule.default.alertContainer, classNames?.actionContainer)
|
|
38
|
+
}
|
|
39
|
+
})));
|
|
40
|
+
};
|
|
41
|
+
exports.Banner = Banner;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import classify from '../../utils/classify';
|
|
6
|
+
import type {InContextAlertProps} from '../InContextAlert';
|
|
7
|
+
import {ALERT_SEMANTIC, InContextAlert} from '../InContextAlert';
|
|
8
|
+
|
|
9
|
+
import css from './Banner.module.css';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export type BannerProps = {
|
|
13
|
+
...InContextAlertProps,
|
|
14
|
+
alignment?: 'top' | 'bottom',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Banner = ({
|
|
18
|
+
classNames,
|
|
19
|
+
semantic,
|
|
20
|
+
leftIconType = 'solid',
|
|
21
|
+
alignment = 'top',
|
|
22
|
+
...props
|
|
23
|
+
}: BannerProps): React.Node => (
|
|
24
|
+
<>
|
|
25
|
+
<InContextAlert
|
|
26
|
+
{...props}
|
|
27
|
+
leftIconType={leftIconType}
|
|
28
|
+
semantic={semantic}
|
|
29
|
+
classNames={{
|
|
30
|
+
wrapper: classify(
|
|
31
|
+
css.bannerContainer,
|
|
32
|
+
{
|
|
33
|
+
[css.neutral]: semantic === ALERT_SEMANTIC.neutral,
|
|
34
|
+
[css.success]: semantic === ALERT_SEMANTIC.success,
|
|
35
|
+
[css.information]: semantic === ALERT_SEMANTIC.information,
|
|
36
|
+
[css.warning]: semantic === ALERT_SEMANTIC.warning,
|
|
37
|
+
[css.danger]: semantic === ALERT_SEMANTIC.danger,
|
|
38
|
+
[css.topAligned]: alignment === 'top',
|
|
39
|
+
[css.bottomAligned]: alignment === 'bottom',
|
|
40
|
+
},
|
|
41
|
+
classNames?.wrapper,
|
|
42
|
+
),
|
|
43
|
+
alertText: classify(classNames?.alertText),
|
|
44
|
+
actionContainer: classify(
|
|
45
|
+
css.alertContainer,
|
|
46
|
+
classNames?.actionContainer,
|
|
47
|
+
),
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
colorNeutralLight,
|
|
3
|
+
colorSuccessLight,
|
|
4
|
+
colorInformationLight,
|
|
5
|
+
colorWarningLight,
|
|
6
|
+
colorDangerLight
|
|
7
|
+
) from '../../styles/variables/_color.css';
|
|
8
|
+
|
|
9
|
+
@value (
|
|
10
|
+
spaceMedium,
|
|
11
|
+
spaceSmall
|
|
12
|
+
) from '../../styles/variables/_space.css';
|
|
13
|
+
|
|
14
|
+
@value (
|
|
15
|
+
borderWidthPrimary
|
|
16
|
+
) from '../../styles/variables/_border.css';
|
|
17
|
+
|
|
18
|
+
.bannerContainer {
|
|
19
|
+
border: none;
|
|
20
|
+
border-radius: initial;
|
|
21
|
+
padding: spaceSmall spaceMedium;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.neutral {
|
|
25
|
+
border-color: colorNeutralLight;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.success {
|
|
29
|
+
border-color: colorSuccessLight;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.information {
|
|
33
|
+
border-color: colorInformationLight;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.warning {
|
|
37
|
+
border-color: colorWarningLight;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.danger {
|
|
41
|
+
border-color: colorDangerLight;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.topAligned {
|
|
45
|
+
border-bottom-width: borderWidthPrimary;
|
|
46
|
+
border-bottom-style: solid;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.bottomAligned {
|
|
50
|
+
border-top-width: borderWidthPrimary;
|
|
51
|
+
border-top-style: solid;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.alertContainer {
|
|
55
|
+
padding-left: calc(spaceSmall * 2);
|
|
56
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Banner = require("./Banner");
|
|
7
|
+
Object.keys(_Banner).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Banner[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Banner[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -68,10 +68,11 @@ const DialogIcon = _ref => {
|
|
|
68
68
|
};
|
|
69
69
|
const DialogHeader = _ref2 => {
|
|
70
70
|
let {
|
|
71
|
-
children
|
|
71
|
+
children,
|
|
72
|
+
className
|
|
72
73
|
} = _ref2;
|
|
73
74
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
className: _DialogModule.default.dialogHeader
|
|
75
|
+
className: (0, _classify.default)(_DialogModule.default.dialogHeader, className)
|
|
75
76
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
77
|
className: _DialogModule.default.headerContent
|
|
77
78
|
}, children)));
|
|
@@ -79,19 +80,21 @@ const DialogHeader = _ref2 => {
|
|
|
79
80
|
exports.DialogHeader = DialogHeader;
|
|
80
81
|
const DialogBody = _ref3 => {
|
|
81
82
|
let {
|
|
82
|
-
children
|
|
83
|
+
children,
|
|
84
|
+
className
|
|
83
85
|
} = _ref3;
|
|
84
86
|
return /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className: _DialogModule.default.dialogBody
|
|
87
|
+
className: (0, _classify.default)(_DialogModule.default.dialogBody, className)
|
|
86
88
|
}, children);
|
|
87
89
|
};
|
|
88
90
|
exports.DialogBody = DialogBody;
|
|
89
91
|
const DialogFooter = _ref4 => {
|
|
90
92
|
let {
|
|
91
|
-
children
|
|
93
|
+
children,
|
|
94
|
+
className
|
|
92
95
|
} = _ref4;
|
|
93
96
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
94
|
-
className: _DialogModule.default.dialogFooter
|
|
97
|
+
className: (0, _classify.default)(_DialogModule.default.dialogFooter, className)
|
|
95
98
|
}, /*#__PURE__*/React.createElement("div", {
|
|
96
99
|
className: _DialogModule.default.dialogFooterActions
|
|
97
100
|
}, children)));
|
|
@@ -23,14 +23,17 @@ export type DialogSemanticType = $Values<typeof DIALOG_SEMANTIC>;
|
|
|
23
23
|
|
|
24
24
|
export type DialogHeaderProps = {
|
|
25
25
|
children?: React.Node,
|
|
26
|
+
className?: string,
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export type DialogFooterProps = {
|
|
29
30
|
children?: React.Node,
|
|
31
|
+
className?: string,
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
export type DialogBodyProps = {
|
|
33
35
|
children?: React.Node,
|
|
36
|
+
className?: string,
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
export type DialogPropsBase = {
|
|
@@ -106,24 +109,33 @@ const DialogIcon = ({
|
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
111
|
|
|
109
|
-
export const DialogHeader = ({
|
|
112
|
+
export const DialogHeader = ({
|
|
113
|
+
children,
|
|
114
|
+
className,
|
|
115
|
+
}: DialogHeaderProps): React.Node => (
|
|
110
116
|
<>
|
|
111
117
|
{React.Children.count(children) > 0 && (
|
|
112
|
-
<div className={css.dialogHeader}>
|
|
118
|
+
<div className={classify(css.dialogHeader, className)}>
|
|
113
119
|
<div className={css.headerContent}>{children}</div>
|
|
114
120
|
</div>
|
|
115
121
|
)}
|
|
116
122
|
</>
|
|
117
123
|
);
|
|
118
124
|
|
|
119
|
-
export const DialogBody = ({
|
|
120
|
-
|
|
125
|
+
export const DialogBody = ({
|
|
126
|
+
children,
|
|
127
|
+
className,
|
|
128
|
+
}: DialogBodyProps): React.Node => (
|
|
129
|
+
<div className={classify(css.dialogBody, className)}>{children}</div>
|
|
121
130
|
);
|
|
122
131
|
|
|
123
|
-
export const DialogFooter = ({
|
|
132
|
+
export const DialogFooter = ({
|
|
133
|
+
children,
|
|
134
|
+
className,
|
|
135
|
+
}: DialogFooterProps): React.Node => (
|
|
124
136
|
<>
|
|
125
137
|
{React.Children.count(children) > 0 && (
|
|
126
|
-
<div className={css.dialogFooter}>
|
|
138
|
+
<div className={classify(css.dialogFooter, className)}>
|
|
127
139
|
<div className={css.dialogFooterActions}>{children}</div>
|
|
128
140
|
</div>
|
|
129
141
|
)}
|
|
@@ -26,7 +26,8 @@ exports.ALERT_SEMANTIC = ALERT_SEMANTIC;
|
|
|
26
26
|
const AlertIcon = _ref => {
|
|
27
27
|
let {
|
|
28
28
|
semantic,
|
|
29
|
-
leftIconName
|
|
29
|
+
leftIconName,
|
|
30
|
+
leftIconType
|
|
30
31
|
} = _ref;
|
|
31
32
|
switch (semantic) {
|
|
32
33
|
case ALERT_SEMANTIC.neutral:
|
|
@@ -34,42 +35,42 @@ const AlertIcon = _ref => {
|
|
|
34
35
|
color: _typography.TEXT_COLORS.neutral,
|
|
35
36
|
name: leftIconName ? leftIconName : 'face-smile',
|
|
36
37
|
size: "small",
|
|
37
|
-
type:
|
|
38
|
+
type: leftIconType
|
|
38
39
|
});
|
|
39
40
|
case ALERT_SEMANTIC.success:
|
|
40
41
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
41
42
|
name: leftIconName ? leftIconName : 'circle-check',
|
|
42
43
|
size: "small",
|
|
43
44
|
color: _typography.TEXT_COLORS.success,
|
|
44
|
-
type:
|
|
45
|
+
type: leftIconType
|
|
45
46
|
});
|
|
46
47
|
case ALERT_SEMANTIC.information:
|
|
47
48
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
48
49
|
name: leftIconName ? leftIconName : 'circle-info',
|
|
49
50
|
size: "small",
|
|
50
51
|
color: _typography.TEXT_COLORS.information,
|
|
51
|
-
type:
|
|
52
|
+
type: leftIconType
|
|
52
53
|
});
|
|
53
54
|
case ALERT_SEMANTIC.warning:
|
|
54
55
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
55
56
|
name: leftIconName ? leftIconName : 'circle-exclamation',
|
|
56
57
|
size: "small",
|
|
57
58
|
color: _typography.TEXT_COLORS.warning,
|
|
58
|
-
type:
|
|
59
|
+
type: leftIconType
|
|
59
60
|
});
|
|
60
61
|
case ALERT_SEMANTIC.danger:
|
|
61
62
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
62
63
|
name: leftIconName ? leftIconName : 'shield-exclamation',
|
|
63
64
|
size: "small",
|
|
64
65
|
color: _typography.TEXT_COLORS.danger,
|
|
65
|
-
type:
|
|
66
|
+
type: leftIconType
|
|
66
67
|
});
|
|
67
68
|
default:
|
|
68
69
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
69
70
|
color: _typography.TEXT_COLORS.neutral,
|
|
70
71
|
name: leftIconName ? leftIconName : 'face-smile',
|
|
71
72
|
size: "small",
|
|
72
|
-
type:
|
|
73
|
+
type: leftIconType
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
};
|
|
@@ -83,7 +84,8 @@ const InContextAlert = props => {
|
|
|
83
84
|
leftIconName = '',
|
|
84
85
|
onCloseClick,
|
|
85
86
|
actionText = '',
|
|
86
|
-
onAction
|
|
87
|
+
onAction,
|
|
88
|
+
leftIconType
|
|
87
89
|
} = props;
|
|
88
90
|
const [dismissed, setDismissed] = React.useState(false);
|
|
89
91
|
const closeClickHandler = e => {
|
|
@@ -100,21 +102,24 @@ const InContextAlert = props => {
|
|
|
100
102
|
}, classNames?.wrapper)
|
|
101
103
|
}, /*#__PURE__*/React.createElement(AlertIcon, {
|
|
102
104
|
semantic: semantic,
|
|
103
|
-
leftIconName: leftIconName
|
|
105
|
+
leftIconName: leftIconName,
|
|
106
|
+
leftIconType: leftIconType
|
|
104
107
|
}), React.Children.count(children) > 0 && /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
|
|
105
108
|
className: (0, _classify.classify)(classNames?.alertText)
|
|
106
109
|
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
107
110
|
line: 2
|
|
108
|
-
}, children)), actionText
|
|
111
|
+
}, children)), !!(actionText || dismissable) && /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: (0, _classify.classify)(_InContextAlertModule.default.actionContainer, classNames?.actionContainer)
|
|
113
|
+
}, !!actionText && /*#__PURE__*/React.createElement(_Text.ButtonTextExtraSmall, {
|
|
109
114
|
className: _InContextAlertModule.default.actionText,
|
|
110
115
|
onClick: onAction
|
|
111
|
-
}, actionText)
|
|
116
|
+
}, actionText), !!dismissable && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
112
117
|
color: _typography.TEXT_COLORS.primary,
|
|
113
118
|
name: "close",
|
|
114
119
|
size: "small",
|
|
115
120
|
type: "regular",
|
|
116
121
|
onClick: closeClickHandler,
|
|
117
122
|
className: _InContextAlertModule.default.closeIcon
|
|
118
|
-
})));
|
|
123
|
+
}))));
|
|
119
124
|
};
|
|
120
125
|
exports.InContextAlert = InContextAlert;
|
|
@@ -4,6 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
|
|
5
5
|
import {TEXT_COLORS} from '../../types/typography';
|
|
6
6
|
import {classify} from '../../utils/classify';
|
|
7
|
+
import type {IconType} from '../Icon';
|
|
7
8
|
import {Icon} from '../Icon';
|
|
8
9
|
import {ButtonTextExtraSmall, SubTitleExtraSmall} from '../Text';
|
|
9
10
|
import {Truncate} from '../Truncate';
|
|
@@ -19,7 +20,11 @@ export const ALERT_SEMANTIC = Object.freeze({
|
|
|
19
20
|
danger: 'danger',
|
|
20
21
|
});
|
|
21
22
|
|
|
22
|
-
type ClassNames = $ReadOnly<{
|
|
23
|
+
type ClassNames = $ReadOnly<{
|
|
24
|
+
wrapper?: string,
|
|
25
|
+
alertText?: string,
|
|
26
|
+
actionContainer?: string,
|
|
27
|
+
}>;
|
|
23
28
|
export type AlertSemanticType = $Values<typeof ALERT_SEMANTIC>;
|
|
24
29
|
|
|
25
30
|
type InContextAlertBaseProps = {
|
|
@@ -40,14 +45,17 @@ export type InContextAlertProps = {
|
|
|
40
45
|
...InContextAlertBaseProps,
|
|
41
46
|
semantic: AlertSemanticType,
|
|
42
47
|
leftIconName?: string,
|
|
48
|
+
leftIconType?: IconType,
|
|
43
49
|
};
|
|
44
50
|
|
|
45
51
|
const AlertIcon = ({
|
|
46
52
|
semantic,
|
|
47
53
|
leftIconName,
|
|
54
|
+
leftIconType,
|
|
48
55
|
}: {
|
|
49
56
|
semantic: AlertSemanticType,
|
|
50
57
|
leftIconName: string,
|
|
58
|
+
leftIconType?: IconType,
|
|
51
59
|
}) => {
|
|
52
60
|
switch (semantic) {
|
|
53
61
|
case ALERT_SEMANTIC.neutral:
|
|
@@ -56,7 +64,7 @@ const AlertIcon = ({
|
|
|
56
64
|
color={TEXT_COLORS.neutral}
|
|
57
65
|
name={leftIconName ? leftIconName : 'face-smile'}
|
|
58
66
|
size="small"
|
|
59
|
-
type=
|
|
67
|
+
type={leftIconType}
|
|
60
68
|
/>
|
|
61
69
|
);
|
|
62
70
|
case ALERT_SEMANTIC.success:
|
|
@@ -65,7 +73,7 @@ const AlertIcon = ({
|
|
|
65
73
|
name={leftIconName ? leftIconName : 'circle-check'}
|
|
66
74
|
size="small"
|
|
67
75
|
color={TEXT_COLORS.success}
|
|
68
|
-
type=
|
|
76
|
+
type={leftIconType}
|
|
69
77
|
/>
|
|
70
78
|
);
|
|
71
79
|
|
|
@@ -75,7 +83,7 @@ const AlertIcon = ({
|
|
|
75
83
|
name={leftIconName ? leftIconName : 'circle-info'}
|
|
76
84
|
size="small"
|
|
77
85
|
color={TEXT_COLORS.information}
|
|
78
|
-
type=
|
|
86
|
+
type={leftIconType}
|
|
79
87
|
/>
|
|
80
88
|
);
|
|
81
89
|
|
|
@@ -85,7 +93,7 @@ const AlertIcon = ({
|
|
|
85
93
|
name={leftIconName ? leftIconName : 'circle-exclamation'}
|
|
86
94
|
size="small"
|
|
87
95
|
color={TEXT_COLORS.warning}
|
|
88
|
-
type=
|
|
96
|
+
type={leftIconType}
|
|
89
97
|
/>
|
|
90
98
|
);
|
|
91
99
|
|
|
@@ -95,7 +103,7 @@ const AlertIcon = ({
|
|
|
95
103
|
name={leftIconName ? leftIconName : 'shield-exclamation'}
|
|
96
104
|
size="small"
|
|
97
105
|
color={TEXT_COLORS.danger}
|
|
98
|
-
type=
|
|
106
|
+
type={leftIconType}
|
|
99
107
|
/>
|
|
100
108
|
);
|
|
101
109
|
|
|
@@ -105,7 +113,7 @@ const AlertIcon = ({
|
|
|
105
113
|
color={TEXT_COLORS.neutral}
|
|
106
114
|
name={leftIconName ? leftIconName : 'face-smile'}
|
|
107
115
|
size="small"
|
|
108
|
-
type=
|
|
116
|
+
type={leftIconType}
|
|
109
117
|
/>
|
|
110
118
|
);
|
|
111
119
|
}
|
|
@@ -122,6 +130,7 @@ export const InContextAlert = (props: InContextAlertProps): React.Node => {
|
|
|
122
130
|
onCloseClick,
|
|
123
131
|
actionText = '',
|
|
124
132
|
onAction,
|
|
133
|
+
leftIconType,
|
|
125
134
|
} = props;
|
|
126
135
|
const [dismissed, setDismissed] = React.useState(false);
|
|
127
136
|
const closeClickHandler = (e) => {
|
|
@@ -145,27 +154,42 @@ export const InContextAlert = (props: InContextAlertProps): React.Node => {
|
|
|
145
154
|
classNames?.wrapper,
|
|
146
155
|
)}
|
|
147
156
|
>
|
|
148
|
-
<AlertIcon
|
|
157
|
+
<AlertIcon
|
|
158
|
+
semantic={semantic}
|
|
159
|
+
leftIconName={leftIconName}
|
|
160
|
+
leftIconType={leftIconType}
|
|
161
|
+
/>
|
|
149
162
|
{React.Children.count(children) > 0 && (
|
|
150
163
|
<SubTitleExtraSmall className={classify(classNames?.alertText)}>
|
|
151
164
|
<Truncate line={2}>{children}</Truncate>
|
|
152
165
|
</SubTitleExtraSmall>
|
|
153
166
|
)}
|
|
154
|
-
{actionText
|
|
155
|
-
<
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
{!!(actionText || dismissable) && (
|
|
168
|
+
<div
|
|
169
|
+
className={classify(
|
|
170
|
+
css.actionContainer,
|
|
171
|
+
classNames?.actionContainer,
|
|
172
|
+
)}
|
|
173
|
+
>
|
|
174
|
+
{!!actionText && (
|
|
175
|
+
<ButtonTextExtraSmall
|
|
176
|
+
className={css.actionText}
|
|
177
|
+
onClick={onAction}
|
|
178
|
+
>
|
|
179
|
+
{actionText}
|
|
180
|
+
</ButtonTextExtraSmall>
|
|
181
|
+
)}
|
|
182
|
+
{!!dismissable && (
|
|
183
|
+
<Icon
|
|
184
|
+
color={TEXT_COLORS.primary}
|
|
185
|
+
name="close"
|
|
186
|
+
size="small"
|
|
187
|
+
type="regular"
|
|
188
|
+
onClick={closeClickHandler}
|
|
189
|
+
className={css.closeIcon}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
169
193
|
)}
|
|
170
194
|
</div>
|
|
171
195
|
)}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
) from '../../styles/variables/_color.css';
|
|
15
15
|
|
|
16
16
|
@value (
|
|
17
|
-
spaceXSmall
|
|
17
|
+
spaceXSmall,
|
|
18
|
+
spaceSmall
|
|
18
19
|
) from '../../styles/variables/_space.css';
|
|
19
20
|
|
|
20
21
|
@value (
|
|
@@ -68,8 +69,14 @@
|
|
|
68
69
|
margin-left: auto;
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
.actionContainer {
|
|
73
|
+
display: flex;
|
|
74
|
+
margin-left: auto;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: spaceSmall;
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
.actionText {
|
|
72
80
|
cursor: pointer;
|
|
73
|
-
margin-left: auto;
|
|
74
81
|
text-decoration: underline;
|
|
75
82
|
}
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
var _InContextAlert = require("./InContextAlert");
|
|
6
|
+
var _InContextAlert = require("./InContextAlert");
|
|
7
|
+
Object.keys(_InContextAlert).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _InContextAlert[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _InContextAlert[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -23,10 +23,11 @@ const ModalHeader = _ref => {
|
|
|
23
23
|
let {
|
|
24
24
|
children,
|
|
25
25
|
hideCloseBtn,
|
|
26
|
-
onCloseButtonClick
|
|
26
|
+
onCloseButtonClick,
|
|
27
|
+
className
|
|
27
28
|
} = _ref;
|
|
28
29
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: _ModalModule.default.modalHeader
|
|
30
|
+
className: (0, _classify.default)(_ModalModule.default.modalHeader, className)
|
|
30
31
|
}, /*#__PURE__*/React.createElement("div", {
|
|
31
32
|
className: _ModalModule.default.headerContent
|
|
32
33
|
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children)), !hideCloseBtn && /*#__PURE__*/React.createElement(_Button.Button, {
|
|
@@ -39,19 +40,21 @@ const ModalHeader = _ref => {
|
|
|
39
40
|
exports.ModalHeader = ModalHeader;
|
|
40
41
|
const ModalBody = _ref2 => {
|
|
41
42
|
let {
|
|
42
|
-
children
|
|
43
|
+
children,
|
|
44
|
+
className
|
|
43
45
|
} = _ref2;
|
|
44
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: _ModalModule.default.modalBody
|
|
47
|
+
className: (0, _classify.default)(_ModalModule.default.modalBody, className)
|
|
46
48
|
}, children);
|
|
47
49
|
};
|
|
48
50
|
exports.ModalBody = ModalBody;
|
|
49
51
|
const ModalFooter = _ref3 => {
|
|
50
52
|
let {
|
|
51
|
-
children
|
|
53
|
+
children,
|
|
54
|
+
className
|
|
52
55
|
} = _ref3;
|
|
53
56
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: _ModalModule.default.modalFooter
|
|
57
|
+
className: (0, _classify.default)(_ModalModule.default.modalFooter, className)
|
|
55
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
56
59
|
className: _ModalModule.default.modalFooterActions
|
|
57
60
|
}, children)));
|
|
@@ -40,24 +40,28 @@ export type ModalHeaderProps = {
|
|
|
40
40
|
children?: React.Node,
|
|
41
41
|
hideCloseBtn?: boolean,
|
|
42
42
|
onCloseButtonClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
|
|
43
|
+
className?: string,
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
export type ModalFooterProps = {
|
|
46
47
|
children?: React.Node,
|
|
48
|
+
className?: string,
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
export type ModalBodyProps = {
|
|
50
52
|
children?: React.Node,
|
|
53
|
+
className?: string,
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
export const ModalHeader = ({
|
|
54
57
|
children,
|
|
55
58
|
hideCloseBtn,
|
|
56
59
|
onCloseButtonClick,
|
|
60
|
+
className,
|
|
57
61
|
}: ModalHeaderProps): React.Node => (
|
|
58
62
|
<>
|
|
59
63
|
{React.Children.count(children) > 0 && (
|
|
60
|
-
<div className={css.modalHeader}>
|
|
64
|
+
<div className={classify(css.modalHeader, className)}>
|
|
61
65
|
<div className={css.headerContent}>
|
|
62
66
|
<Truncate>{children}</Truncate>
|
|
63
67
|
</div>
|
|
@@ -74,14 +78,20 @@ export const ModalHeader = ({
|
|
|
74
78
|
</>
|
|
75
79
|
);
|
|
76
80
|
|
|
77
|
-
export const ModalBody = ({
|
|
78
|
-
|
|
81
|
+
export const ModalBody = ({
|
|
82
|
+
children,
|
|
83
|
+
className,
|
|
84
|
+
}: ModalBodyProps): React.Node => (
|
|
85
|
+
<div className={classify(css.modalBody, className)}>{children}</div>
|
|
79
86
|
);
|
|
80
87
|
|
|
81
|
-
export const ModalFooter = ({
|
|
88
|
+
export const ModalFooter = ({
|
|
89
|
+
children,
|
|
90
|
+
className,
|
|
91
|
+
}: ModalFooterProps): React.Node => (
|
|
82
92
|
<>
|
|
83
93
|
{React.Children.count(children) > 0 && (
|
|
84
|
-
<div className={css.modalFooter}>
|
|
94
|
+
<div className={classify(css.modalFooter, className)}>
|
|
85
95
|
<div className={css.modalFooterActions}>{children}</div>
|
|
86
96
|
</div>
|
|
87
97
|
)}
|
|
@@ -20,10 +20,11 @@ const PanelHeader = _ref => {
|
|
|
20
20
|
let {
|
|
21
21
|
children,
|
|
22
22
|
hideCloseBtn,
|
|
23
|
-
onCloseButtonClick
|
|
23
|
+
onCloseButtonClick,
|
|
24
|
+
className
|
|
24
25
|
} = _ref;
|
|
25
26
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: _PanelModule.default.panelHeader
|
|
27
|
+
className: (0, _classify.default)(_PanelModule.default.panelHeader, className)
|
|
27
28
|
}, /*#__PURE__*/React.createElement("div", {
|
|
28
29
|
className: _PanelModule.default.headerContent
|
|
29
30
|
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children)), !hideCloseBtn && /*#__PURE__*/React.createElement(_Button.Button, {
|
|
@@ -36,19 +37,21 @@ const PanelHeader = _ref => {
|
|
|
36
37
|
exports.PanelHeader = PanelHeader;
|
|
37
38
|
const PanelBody = _ref2 => {
|
|
38
39
|
let {
|
|
39
|
-
children
|
|
40
|
+
children,
|
|
41
|
+
className
|
|
40
42
|
} = _ref2;
|
|
41
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className: _PanelModule.default.panelBody
|
|
44
|
+
className: (0, _classify.default)(_PanelModule.default.panelBody, className)
|
|
43
45
|
}, children);
|
|
44
46
|
};
|
|
45
47
|
exports.PanelBody = PanelBody;
|
|
46
48
|
const PanelFooter = _ref3 => {
|
|
47
49
|
let {
|
|
48
|
-
children
|
|
50
|
+
children,
|
|
51
|
+
className
|
|
49
52
|
} = _ref3;
|
|
50
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.count(children) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: _PanelModule.default.panelFooter
|
|
54
|
+
className: (0, _classify.default)(_PanelModule.default.panelFooter, className)
|
|
52
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
53
56
|
className: _PanelModule.default.panelFooterActions
|
|
54
57
|
}, children)));
|
|
@@ -20,14 +20,17 @@ export type PanelHeaderProps = {
|
|
|
20
20
|
children?: React.Node,
|
|
21
21
|
hideCloseBtn?: boolean,
|
|
22
22
|
onCloseButtonClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
|
|
23
|
+
className?: string,
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
export type PanelFooterProps = {
|
|
26
27
|
children?: React.Node,
|
|
28
|
+
className?: string,
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export type PanelBodyProps = {
|
|
30
32
|
children?: React.Node,
|
|
33
|
+
className?: string,
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
export type PanelProps = {
|
|
@@ -40,10 +43,11 @@ export const PanelHeader = ({
|
|
|
40
43
|
children,
|
|
41
44
|
hideCloseBtn,
|
|
42
45
|
onCloseButtonClick,
|
|
46
|
+
className,
|
|
43
47
|
}: PanelHeaderProps): React.Node => (
|
|
44
48
|
<>
|
|
45
49
|
{React.Children.count(children) > 0 && (
|
|
46
|
-
<div className={css.panelHeader}>
|
|
50
|
+
<div className={classify(css.panelHeader, className)}>
|
|
47
51
|
<div className={css.headerContent}>
|
|
48
52
|
<Truncate>{children}</Truncate>
|
|
49
53
|
</div>
|
|
@@ -60,14 +64,20 @@ export const PanelHeader = ({
|
|
|
60
64
|
</>
|
|
61
65
|
);
|
|
62
66
|
|
|
63
|
-
export const PanelBody = ({
|
|
64
|
-
|
|
67
|
+
export const PanelBody = ({
|
|
68
|
+
children,
|
|
69
|
+
className,
|
|
70
|
+
}: PanelBodyProps): React.Node => (
|
|
71
|
+
<div className={classify(css.panelBody, className)}>{children}</div>
|
|
65
72
|
);
|
|
66
73
|
|
|
67
|
-
export const PanelFooter = ({
|
|
74
|
+
export const PanelFooter = ({
|
|
75
|
+
children,
|
|
76
|
+
className,
|
|
77
|
+
}: PanelFooterProps): React.Node => (
|
|
68
78
|
<>
|
|
69
79
|
{React.Children.count(children) > 0 && (
|
|
70
|
-
<div className={css.panelFooter}>
|
|
80
|
+
<div className={classify(css.panelFooter, className)}>
|
|
71
81
|
<div className={css.panelFooterActions}>{children}</div>
|
|
72
82
|
</div>
|
|
73
83
|
)}
|