glints-aries 4.0.249 → 4.0.250
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/es/@next/Banner/Banner.d.ts +4 -2
- package/es/@next/Banner/Banner.js +32 -3
- package/es/@next/Banner/Banner.stories.d.ts +3 -0
- package/es/@next/Banner/FixedBannerStyle.d.ts +5 -0
- package/es/@next/Banner/FixedBannerStyle.js +23 -0
- package/lib/@next/Banner/Banner.d.ts +4 -2
- package/lib/@next/Banner/Banner.js +32 -3
- package/lib/@next/Banner/Banner.stories.d.ts +3 -0
- package/lib/@next/Banner/FixedBannerStyle.d.ts +5 -0
- package/lib/@next/Banner/FixedBannerStyle.js +35 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconNames } from '../Icon/icons/icons';
|
|
3
|
-
export
|
|
3
|
+
export interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
title?: string;
|
|
5
5
|
/** If set will take precedent of status */
|
|
6
6
|
iconName?: IconNames;
|
|
@@ -10,5 +10,7 @@ export declare type BannerProps = {
|
|
|
10
10
|
secondaryAction?: React.ReactNode;
|
|
11
11
|
dismissable?: boolean;
|
|
12
12
|
onDismiss?: () => void;
|
|
13
|
-
|
|
13
|
+
type?: 'static' | 'fixed';
|
|
14
|
+
showIcon?: boolean;
|
|
15
|
+
}
|
|
14
16
|
export declare const Banner: React.ForwardRefExoticComponent<BannerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["title", "status", "iconName", "children", "action", "secondaryAction", "dismissable", "onDismiss"];
|
|
3
|
+
var _excluded = ["title", "status", "iconName", "children", "action", "secondaryAction", "dismissable", "onDismiss", "type", "showIcon"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { ButtonGroup } from '../ButtonGroup';
|
|
6
6
|
import { Icon } from '../Icon';
|
|
7
7
|
import { Typography } from '../Typography';
|
|
8
8
|
import { StyledBanner, StyledBannerContentContainer, StyledBannerTitle, StyledBannerTitleContainer, StyledCloseIconWrapper } from './BannerStyle';
|
|
9
|
+
import { StyledFixedBanner, StyledFixedIconWrapper, StyledFixedBannerContentContainer, StyledFixedBannerButtonContainer, StyledFixedCloseIconWrapper } from './FixedBannerStyle';
|
|
9
10
|
var iconNameStatusMap = {
|
|
10
11
|
success: 'ri-checkbox-circle-fill',
|
|
11
12
|
info: 'ri-information-fill',
|
|
@@ -22,13 +23,18 @@ export var Banner = /*#__PURE__*/React.forwardRef(function Banner(_ref, ref) {
|
|
|
22
23
|
_ref$dismissable = _ref.dismissable,
|
|
23
24
|
dismissable = _ref$dismissable === void 0 ? true : _ref$dismissable,
|
|
24
25
|
onDismiss = _ref.onDismiss,
|
|
26
|
+
_ref$type = _ref.type,
|
|
27
|
+
type = _ref$type === void 0 ? 'static' : _ref$type,
|
|
28
|
+
_ref$showIcon = _ref.showIcon,
|
|
29
|
+
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
25
30
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
26
31
|
var iconByStatus = iconNameStatusMap[status];
|
|
27
32
|
if (!iconByStatus) {
|
|
28
33
|
console.warn("Status " + status + " is not valid, default style will be used");
|
|
29
34
|
}
|
|
30
35
|
var iconNameValue = iconName ? iconName : iconByStatus || iconNameStatusMap['info'];
|
|
31
|
-
|
|
36
|
+
var actionComponent = /*#__PURE__*/React.createElement(React.Fragment, null, (action || secondaryAction) && /*#__PURE__*/React.createElement(ButtonGroup, null, action, secondaryAction));
|
|
37
|
+
if (type === 'static') return /*#__PURE__*/React.createElement(StyledBanner, _extends({
|
|
32
38
|
ref: ref,
|
|
33
39
|
"data-titled": !!title,
|
|
34
40
|
"data-status": status
|
|
@@ -47,5 +53,28 @@ export var Banner = /*#__PURE__*/React.forwardRef(function Banner(_ref, ref) {
|
|
|
47
53
|
}))), /*#__PURE__*/React.createElement(StyledBannerContentContainer, null, /*#__PURE__*/React.createElement(Typography, {
|
|
48
54
|
as: "div",
|
|
49
55
|
variant: "body1"
|
|
50
|
-
}, children)), /*#__PURE__*/React.createElement(StyledBannerContentContainer, null,
|
|
56
|
+
}, children)), /*#__PURE__*/React.createElement(StyledBannerContentContainer, null, actionComponent));
|
|
57
|
+
return /*#__PURE__*/React.createElement(StyledFixedBanner, _extends({
|
|
58
|
+
ref: ref,
|
|
59
|
+
"data-status": status,
|
|
60
|
+
"data-nobutton": action ? '' : 'true'
|
|
61
|
+
}, props), showIcon && /*#__PURE__*/React.createElement(StyledFixedIconWrapper, {
|
|
62
|
+
"data-status": status
|
|
63
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
64
|
+
name: iconNameValue
|
|
65
|
+
})), /*#__PURE__*/React.createElement(StyledFixedBannerContentContainer, {
|
|
66
|
+
"data-noicon": showIcon ? '' : 'true'
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
68
|
+
as: "div",
|
|
69
|
+
variant: "body1"
|
|
70
|
+
}, children)), /*#__PURE__*/React.createElement(StyledFixedBannerButtonContainer, {
|
|
71
|
+
"data-noicon": showIcon ? '' : 'true'
|
|
72
|
+
}, actionComponent), dismissable && /*#__PURE__*/React.createElement(StyledFixedCloseIconWrapper, {
|
|
73
|
+
role: "button",
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
return onDismiss == null ? void 0 : onDismiss();
|
|
76
|
+
}
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
78
|
+
name: "ri-close"
|
|
79
|
+
})));
|
|
51
80
|
});
|
|
@@ -3,3 +3,6 @@ declare const _default: Meta<import("@storybook/react").Args>;
|
|
|
3
3
|
export default _default;
|
|
4
4
|
export declare const Interactive: any;
|
|
5
5
|
export declare const WithButtons: any;
|
|
6
|
+
export declare const WithTwoButtons: any;
|
|
7
|
+
export declare const FixedBanner: any;
|
|
8
|
+
export declare const FixedBannerWithButtons: any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledFixedBanner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const StyledFixedIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const StyledFixedBannerContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const StyledFixedBannerButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const StyledFixedCloseIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import * as Breakpoints from '../utilities/breakpoints';
|
|
3
|
+
import { Blue, Green, Neutral, Orange, Red } from '../utilities/colors';
|
|
4
|
+
export var StyledFixedBanner = styled.div.withConfig({
|
|
5
|
+
displayName: "FixedBannerStyle__StyledFixedBanner",
|
|
6
|
+
componentId: "sc-1clh4a2-0"
|
|
7
|
+
})(["position:fixed;left:0;right:0;height:56px;display:flex;justify-content:center;align-items:center;padding-inline:48px;background:", ";color:", ";svg{position:static;fill:", ";height:20px;width:20px;margin-top:4px;}&[data-status='success']{background:", ";}&[data-status='info']{background:", ";}&[data-status='warning']{background:", ";}&[data-status='critical']{background:", ";}@media (max-width:", "){padding:16px;height:100px;svg{margin-top:0px;}&[data-nobutton='true']{height:52px;}}"], Neutral.B99, Neutral.B18, Neutral.B40, Green.B89, Blue.S08, Orange.S21, Red.B100, Breakpoints.large);
|
|
8
|
+
export var StyledFixedIconWrapper = styled.div.withConfig({
|
|
9
|
+
displayName: "FixedBannerStyle__StyledFixedIconWrapper",
|
|
10
|
+
componentId: "sc-1clh4a2-1"
|
|
11
|
+
})(["padding-right:12px;&[data-status='success'] svg{fill:", ";}&[data-status='info'] svg{fill:", ";}&[data-status='warning'] svg{fill:", ";}&[data-status='critical'] svg{fill:", ";}@media (max-width:", "){position:absolute;left:16px;top:16px;}"], Green.B61, Blue.S99, Orange.S87, Red.B93, Breakpoints.large);
|
|
12
|
+
export var StyledFixedBannerContentContainer = styled.div.withConfig({
|
|
13
|
+
displayName: "FixedBannerStyle__StyledFixedBannerContentContainer",
|
|
14
|
+
componentId: "sc-1clh4a2-2"
|
|
15
|
+
})(["padding-right:16px;@media (max-width:", "){position:absolute;top:16px;left:52px;&[data-noicon='true']{left:16px;}}"], Breakpoints.large);
|
|
16
|
+
export var StyledFixedBannerButtonContainer = styled.div.withConfig({
|
|
17
|
+
displayName: "FixedBannerStyle__StyledFixedBannerButtonContainer",
|
|
18
|
+
componentId: "sc-1clh4a2-3"
|
|
19
|
+
})(["@media (max-width:", "){position:absolute;top:48px;left:52px;&[data-noicon='true']{left:16px;}}"], Breakpoints.large);
|
|
20
|
+
export var StyledFixedCloseIconWrapper = styled.div.withConfig({
|
|
21
|
+
displayName: "FixedBannerStyle__StyledFixedCloseIconWrapper",
|
|
22
|
+
componentId: "sc-1clh4a2-4"
|
|
23
|
+
})(["cursor:pointer;position:absolute;color:", ";right:48px;padding-left:16px;svg{fill:", ";}@media (max-width:", "){top:16px;right:16px;}"], Neutral.B40, Neutral.B40, Breakpoints.large);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconNames } from '../Icon/icons/icons';
|
|
3
|
-
export
|
|
3
|
+
export interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
title?: string;
|
|
5
5
|
/** If set will take precedent of status */
|
|
6
6
|
iconName?: IconNames;
|
|
@@ -10,5 +10,7 @@ export declare type BannerProps = {
|
|
|
10
10
|
secondaryAction?: React.ReactNode;
|
|
11
11
|
dismissable?: boolean;
|
|
12
12
|
onDismiss?: () => void;
|
|
13
|
-
|
|
13
|
+
type?: 'static' | 'fixed';
|
|
14
|
+
showIcon?: boolean;
|
|
15
|
+
}
|
|
14
16
|
export declare const Banner: React.ForwardRefExoticComponent<BannerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -10,7 +10,8 @@ var _ButtonGroup = require("../ButtonGroup");
|
|
|
10
10
|
var _Icon = require("../Icon");
|
|
11
11
|
var _Typography = require("../Typography");
|
|
12
12
|
var _BannerStyle = require("./BannerStyle");
|
|
13
|
-
var
|
|
13
|
+
var _FixedBannerStyle = require("./FixedBannerStyle");
|
|
14
|
+
var _excluded = ["title", "status", "iconName", "children", "action", "secondaryAction", "dismissable", "onDismiss", "type", "showIcon"];
|
|
14
15
|
var iconNameStatusMap = {
|
|
15
16
|
success: 'ri-checkbox-circle-fill',
|
|
16
17
|
info: 'ri-information-fill',
|
|
@@ -27,13 +28,18 @@ var Banner = /*#__PURE__*/_react["default"].forwardRef(function Banner(_ref, ref
|
|
|
27
28
|
_ref$dismissable = _ref.dismissable,
|
|
28
29
|
dismissable = _ref$dismissable === void 0 ? true : _ref$dismissable,
|
|
29
30
|
onDismiss = _ref.onDismiss,
|
|
31
|
+
_ref$type = _ref.type,
|
|
32
|
+
type = _ref$type === void 0 ? 'static' : _ref$type,
|
|
33
|
+
_ref$showIcon = _ref.showIcon,
|
|
34
|
+
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
30
35
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
31
36
|
var iconByStatus = iconNameStatusMap[status];
|
|
32
37
|
if (!iconByStatus) {
|
|
33
38
|
console.warn("Status " + status + " is not valid, default style will be used");
|
|
34
39
|
}
|
|
35
40
|
var iconNameValue = iconName ? iconName : iconByStatus || iconNameStatusMap['info'];
|
|
36
|
-
|
|
41
|
+
var actionComponent = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (action || secondaryAction) && /*#__PURE__*/_react["default"].createElement(_ButtonGroup.ButtonGroup, null, action, secondaryAction));
|
|
42
|
+
if (type === 'static') return /*#__PURE__*/_react["default"].createElement(_BannerStyle.StyledBanner, (0, _extends2["default"])({
|
|
37
43
|
ref: ref,
|
|
38
44
|
"data-titled": !!title,
|
|
39
45
|
"data-status": status
|
|
@@ -52,6 +58,29 @@ var Banner = /*#__PURE__*/_react["default"].forwardRef(function Banner(_ref, ref
|
|
|
52
58
|
}))), /*#__PURE__*/_react["default"].createElement(_BannerStyle.StyledBannerContentContainer, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
53
59
|
as: "div",
|
|
54
60
|
variant: "body1"
|
|
55
|
-
}, children)), /*#__PURE__*/_react["default"].createElement(_BannerStyle.StyledBannerContentContainer, null,
|
|
61
|
+
}, children)), /*#__PURE__*/_react["default"].createElement(_BannerStyle.StyledBannerContentContainer, null, actionComponent));
|
|
62
|
+
return /*#__PURE__*/_react["default"].createElement(_FixedBannerStyle.StyledFixedBanner, (0, _extends2["default"])({
|
|
63
|
+
ref: ref,
|
|
64
|
+
"data-status": status,
|
|
65
|
+
"data-nobutton": action ? '' : 'true'
|
|
66
|
+
}, props), showIcon && /*#__PURE__*/_react["default"].createElement(_FixedBannerStyle.StyledFixedIconWrapper, {
|
|
67
|
+
"data-status": status
|
|
68
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
|
|
69
|
+
name: iconNameValue
|
|
70
|
+
})), /*#__PURE__*/_react["default"].createElement(_FixedBannerStyle.StyledFixedBannerContentContainer, {
|
|
71
|
+
"data-noicon": showIcon ? '' : 'true'
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
73
|
+
as: "div",
|
|
74
|
+
variant: "body1"
|
|
75
|
+
}, children)), /*#__PURE__*/_react["default"].createElement(_FixedBannerStyle.StyledFixedBannerButtonContainer, {
|
|
76
|
+
"data-noicon": showIcon ? '' : 'true'
|
|
77
|
+
}, actionComponent), dismissable && /*#__PURE__*/_react["default"].createElement(_FixedBannerStyle.StyledFixedCloseIconWrapper, {
|
|
78
|
+
role: "button",
|
|
79
|
+
onClick: function onClick() {
|
|
80
|
+
return onDismiss == null ? void 0 : onDismiss();
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
|
|
83
|
+
name: "ri-close"
|
|
84
|
+
})));
|
|
56
85
|
});
|
|
57
86
|
exports.Banner = Banner;
|
|
@@ -3,3 +3,6 @@ declare const _default: Meta<import("@storybook/react").Args>;
|
|
|
3
3
|
export default _default;
|
|
4
4
|
export declare const Interactive: any;
|
|
5
5
|
export declare const WithButtons: any;
|
|
6
|
+
export declare const WithTwoButtons: any;
|
|
7
|
+
export declare const FixedBanner: any;
|
|
8
|
+
export declare const FixedBannerWithButtons: any;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledFixedBanner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const StyledFixedIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const StyledFixedBannerContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const StyledFixedBannerButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const StyledFixedCloseIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.StyledFixedIconWrapper = exports.StyledFixedCloseIconWrapper = exports.StyledFixedBannerContentContainer = exports.StyledFixedBannerButtonContainer = exports.StyledFixedBanner = void 0;
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var Breakpoints = _interopRequireWildcard(require("../utilities/breakpoints"));
|
|
8
|
+
var _colors = require("../utilities/colors");
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
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; }
|
|
11
|
+
var StyledFixedBanner = _styledComponents["default"].div.withConfig({
|
|
12
|
+
displayName: "FixedBannerStyle__StyledFixedBanner",
|
|
13
|
+
componentId: "sc-1clh4a2-0"
|
|
14
|
+
})(["position:fixed;left:0;right:0;height:56px;display:flex;justify-content:center;align-items:center;padding-inline:48px;background:", ";color:", ";svg{position:static;fill:", ";height:20px;width:20px;margin-top:4px;}&[data-status='success']{background:", ";}&[data-status='info']{background:", ";}&[data-status='warning']{background:", ";}&[data-status='critical']{background:", ";}@media (max-width:", "){padding:16px;height:100px;svg{margin-top:0px;}&[data-nobutton='true']{height:52px;}}"], _colors.Neutral.B99, _colors.Neutral.B18, _colors.Neutral.B40, _colors.Green.B89, _colors.Blue.S08, _colors.Orange.S21, _colors.Red.B100, Breakpoints.large);
|
|
15
|
+
exports.StyledFixedBanner = StyledFixedBanner;
|
|
16
|
+
var StyledFixedIconWrapper = _styledComponents["default"].div.withConfig({
|
|
17
|
+
displayName: "FixedBannerStyle__StyledFixedIconWrapper",
|
|
18
|
+
componentId: "sc-1clh4a2-1"
|
|
19
|
+
})(["padding-right:12px;&[data-status='success'] svg{fill:", ";}&[data-status='info'] svg{fill:", ";}&[data-status='warning'] svg{fill:", ";}&[data-status='critical'] svg{fill:", ";}@media (max-width:", "){position:absolute;left:16px;top:16px;}"], _colors.Green.B61, _colors.Blue.S99, _colors.Orange.S87, _colors.Red.B93, Breakpoints.large);
|
|
20
|
+
exports.StyledFixedIconWrapper = StyledFixedIconWrapper;
|
|
21
|
+
var StyledFixedBannerContentContainer = _styledComponents["default"].div.withConfig({
|
|
22
|
+
displayName: "FixedBannerStyle__StyledFixedBannerContentContainer",
|
|
23
|
+
componentId: "sc-1clh4a2-2"
|
|
24
|
+
})(["padding-right:16px;@media (max-width:", "){position:absolute;top:16px;left:52px;&[data-noicon='true']{left:16px;}}"], Breakpoints.large);
|
|
25
|
+
exports.StyledFixedBannerContentContainer = StyledFixedBannerContentContainer;
|
|
26
|
+
var StyledFixedBannerButtonContainer = _styledComponents["default"].div.withConfig({
|
|
27
|
+
displayName: "FixedBannerStyle__StyledFixedBannerButtonContainer",
|
|
28
|
+
componentId: "sc-1clh4a2-3"
|
|
29
|
+
})(["@media (max-width:", "){position:absolute;top:48px;left:52px;&[data-noicon='true']{left:16px;}}"], Breakpoints.large);
|
|
30
|
+
exports.StyledFixedBannerButtonContainer = StyledFixedBannerButtonContainer;
|
|
31
|
+
var StyledFixedCloseIconWrapper = _styledComponents["default"].div.withConfig({
|
|
32
|
+
displayName: "FixedBannerStyle__StyledFixedCloseIconWrapper",
|
|
33
|
+
componentId: "sc-1clh4a2-4"
|
|
34
|
+
})(["cursor:pointer;position:absolute;color:", ";right:48px;padding-left:16px;svg{fill:", ";}@media (max-width:", "){top:16px;right:16px;}"], _colors.Neutral.B40, _colors.Neutral.B40, Breakpoints.large);
|
|
35
|
+
exports.StyledFixedCloseIconWrapper = StyledFixedCloseIconWrapper;
|