@elliemae/ds-banner 2.3.1-rc.2 → 3.0.0-alpha.2
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/dist/cjs/DSBanner.js +155 -0
- package/dist/cjs/DSBanner.js.map +7 -0
- package/dist/cjs/defaultProps.js +45 -0
- package/dist/cjs/defaultProps.js.map +7 -0
- package/dist/cjs/index.d.js +27 -0
- package/dist/cjs/index.d.js.map +7 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +55 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/cjs/styles.js +107 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/cjs/utils/bannerTypes.js +40 -0
- package/dist/cjs/utils/bannerTypes.js.map +7 -0
- package/dist/cjs/utils/icons.js +58 -0
- package/dist/cjs/utils/icons.js.map +7 -0
- package/dist/cjs/utils/styleHelpers.js +99 -0
- package/dist/cjs/utils/styleHelpers.js.map +7 -0
- package/dist/esm/DSBanner.js +136 -0
- package/dist/esm/DSBanner.js.map +7 -0
- package/dist/esm/defaultProps.js +16 -0
- package/dist/esm/defaultProps.js.map +7 -0
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +26 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/dist/esm/styles.js +78 -0
- package/dist/esm/styles.js.map +7 -0
- package/dist/esm/utils/bannerTypes.js +11 -0
- package/dist/esm/utils/bannerTypes.js.map +7 -0
- package/dist/esm/utils/icons.js +29 -0
- package/dist/esm/utils/icons.js.map +7 -0
- package/dist/esm/utils/styleHelpers.js +70 -0
- package/dist/esm/utils/styleHelpers.js.map +7 -0
- package/package.json +42 -33
- package/cjs/DSBanner.js +0 -132
- package/cjs/defaultProps.js +0 -22
- package/cjs/index.d.js +0 -2
- package/cjs/index.js +0 -12
- package/cjs/propTypes.js +0 -24
- package/cjs/styles.js +0 -146
- package/cjs/utils/bannerTypes.js +0 -12
- package/cjs/utils/icons.js +0 -36
- package/cjs/utils/styleHelpers.js +0 -53
- package/esm/DSBanner.js +0 -121
- package/esm/defaultProps.js +0 -18
- package/esm/index.d.js +0 -1
- package/esm/index.js +0 -2
- package/esm/propTypes.js +0 -20
- package/esm/styles.js +0 -131
- package/esm/utils/bannerTypes.js +0 -8
- package/esm/utils/icons.js +0 -28
- package/esm/utils/styleHelpers.js +0 -44
- package/types/DSBanner.d.ts +0 -59
- package/types/defaultProps.d.ts +0 -14
- package/types/index.d.ts +0 -3
- package/types/propTypes.d.ts +0 -33
- package/types/styles.d.ts +0 -7
- package/types/tests/DSBanner.events.test.d.ts +0 -1
- package/types/tests/DSBanner.test.d.ts +0 -1
- package/types/utils/bannerTypes.d.ts +0 -6
- package/types/utils/icons.d.ts +0 -7
- package/types/utils/styleHelpers.d.ts +0 -5
package/esm/DSBanner.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
-
import React, { useRef, useState, useLayoutEffect, useCallback } from 'react';
|
|
10
|
-
import { CloseX } from '@elliemae/ds-icons';
|
|
11
|
-
import { describe } from 'react-desc';
|
|
12
|
-
import { icons } from './utils/icons.js';
|
|
13
|
-
import { propTypes } from './propTypes.js';
|
|
14
|
-
import { defaultProps } from './defaultProps.js';
|
|
15
|
-
import { StyledBannerContainer, StyledInnerContainer, StyledIconContainer, StyledTitle, StyledSubTitle, StyledActionLink, StyledCloseButton } from './styles.js';
|
|
16
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
|
-
|
|
18
|
-
var _CloseX, _span;
|
|
19
|
-
|
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
-
|
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
|
|
24
|
-
const DSBanner = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
type,
|
|
27
|
-
isOpen,
|
|
28
|
-
onClose,
|
|
29
|
-
label,
|
|
30
|
-
body,
|
|
31
|
-
actionLink,
|
|
32
|
-
showCloseButton,
|
|
33
|
-
containerProps,
|
|
34
|
-
actionRef
|
|
35
|
-
} = _ref;
|
|
36
|
-
const innerContainerRef = useRef(null);
|
|
37
|
-
const linkRef = useRef(null);
|
|
38
|
-
const [current, setCurrent] = useState(isOpen);
|
|
39
|
-
const [isAnimating, setIsAnimating] = useState(false);
|
|
40
|
-
const [alertTabIndex, setAlertTabIndex] = useState(undefined);
|
|
41
|
-
const ownerState = {
|
|
42
|
-
type
|
|
43
|
-
};
|
|
44
|
-
React.useEffect(() => {
|
|
45
|
-
if (actionRef && actionRef.current) {
|
|
46
|
-
actionRef.current.focusOnWrapper = () => {
|
|
47
|
-
if (innerContainerRef.current) {
|
|
48
|
-
setAlertTabIndex(0);
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
innerContainerRef.current.focus();
|
|
51
|
-
}, 100);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
actionRef.current.focusOnLink = () => {
|
|
56
|
-
if (linkRef.current) {
|
|
57
|
-
linkRef.current.focus();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}, [actionRef]);
|
|
62
|
-
useLayoutEffect(() => {
|
|
63
|
-
if (isOpen !== current || isOpen) setIsAnimating(true);else setIsAnimating(false);
|
|
64
|
-
}, [isOpen, current]);
|
|
65
|
-
const handleBlur = useCallback(() => {
|
|
66
|
-
setAlertTabIndex(undefined);
|
|
67
|
-
}, []);
|
|
68
|
-
const handleOnKeyDown = useCallback(e => {
|
|
69
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
70
|
-
e.preventDefault();
|
|
71
|
-
if (linkRef.current) linkRef.current.click();
|
|
72
|
-
}
|
|
73
|
-
}, []);
|
|
74
|
-
if (!isAnimating && !isOpen) return null;
|
|
75
|
-
return /*#__PURE__*/jsx(StyledBannerContainer, _objectSpread(_objectSpread({
|
|
76
|
-
type: type,
|
|
77
|
-
isOpen: isOpen,
|
|
78
|
-
isAnimating: isAnimating,
|
|
79
|
-
onAnimationEnd: () => setCurrent(isOpen),
|
|
80
|
-
"data-testid": "ds-banner-container"
|
|
81
|
-
}, containerProps), {}, {
|
|
82
|
-
ownerState: ownerState,
|
|
83
|
-
children: /*#__PURE__*/jsxs(StyledInnerContainer, {
|
|
84
|
-
type: type,
|
|
85
|
-
isOpen: isOpen,
|
|
86
|
-
ref: innerContainerRef,
|
|
87
|
-
isAnimating: isAnimating,
|
|
88
|
-
"data-testid": "ds-banner",
|
|
89
|
-
role: "alert",
|
|
90
|
-
tabIndex: alertTabIndex,
|
|
91
|
-
onBlur: handleBlur,
|
|
92
|
-
children: [/*#__PURE__*/_jsx(StyledIconContainer, {
|
|
93
|
-
"data-testid": "ds-banner-icon"
|
|
94
|
-
}, void 0, icons[type]), /*#__PURE__*/_jsx(StyledTitle, {}, void 0, label), /*#__PURE__*/_jsx(StyledSubTitle, {}, void 0, /*#__PURE__*/_jsx("span", {}, void 0, body), actionLink && /*#__PURE__*/jsx(StyledActionLink, {
|
|
95
|
-
"data-testid": "ds-banner-action-link",
|
|
96
|
-
onClick: actionLink.onClick,
|
|
97
|
-
href: actionLink.href,
|
|
98
|
-
ref: linkRef,
|
|
99
|
-
onKeyDown: handleOnKeyDown,
|
|
100
|
-
tabIndex: 0,
|
|
101
|
-
isBodyEmpty: body,
|
|
102
|
-
children: actionLink.label
|
|
103
|
-
})), showCloseButton ? /*#__PURE__*/_jsx(StyledCloseButton, {
|
|
104
|
-
"data-testid": "ds-banner-close-button",
|
|
105
|
-
buttonType: "secondary",
|
|
106
|
-
onClick: onClose,
|
|
107
|
-
"aria-label": "Close icon",
|
|
108
|
-
icon: _CloseX || (_CloseX = /*#__PURE__*/_jsx(CloseX, {
|
|
109
|
-
width: "12px",
|
|
110
|
-
height: "12px"
|
|
111
|
-
}))
|
|
112
|
-
}) : _span || (_span = /*#__PURE__*/_jsx("span", {}))]
|
|
113
|
-
})
|
|
114
|
-
}));
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
DSBanner.defaultProps = defaultProps;
|
|
118
|
-
const DSBannerWithSchema = describe(DSBanner);
|
|
119
|
-
DSBannerWithSchema.propTypes = propTypes;
|
|
120
|
-
|
|
121
|
-
export { DSBannerWithSchema, DSBanner as default };
|
package/esm/defaultProps.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BANNER_TYPES } from './utils/bannerTypes.js';
|
|
2
|
-
|
|
3
|
-
const defaultProps = {
|
|
4
|
-
containerProps: {},
|
|
5
|
-
label: '',
|
|
6
|
-
body: '',
|
|
7
|
-
type: BANNER_TYPES.INFO,
|
|
8
|
-
isOpen: true,
|
|
9
|
-
onClose: () => null,
|
|
10
|
-
showCloseButton: true,
|
|
11
|
-
actionLink: {
|
|
12
|
-
label: '',
|
|
13
|
-
onClick: () => null,
|
|
14
|
-
href: ''
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { defaultProps };
|
package/esm/index.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/esm/index.js
DELETED
package/esm/propTypes.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'react-desc';
|
|
2
|
-
import { BANNER_TYPES } from './utils/bannerTypes.js';
|
|
3
|
-
|
|
4
|
-
const propTypes = {
|
|
5
|
-
containerProps: PropTypes.object.description('Set of Properties attached to the main container').defaultValue({}),
|
|
6
|
-
label: PropTypes.string.description('banner s label').defaultValue(''),
|
|
7
|
-
body: PropTypes.string.description('banner s body content').defaultValue(''),
|
|
8
|
-
type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('banner s type').defaultValue(BANNER_TYPES.INFO),
|
|
9
|
-
onClose: PropTypes.func.description('function executed when the banner closes'),
|
|
10
|
-
isOpen: PropTypes.bool.description('whether the banner is open or closed').defaultValue(true),
|
|
11
|
-
showCloseButton: PropTypes.bool.description('whether to show close button or not').defaultValue(true),
|
|
12
|
-
actionLink: PropTypes.shape({
|
|
13
|
-
label: PropTypes.string,
|
|
14
|
-
onClick: PropTypes.func,
|
|
15
|
-
href: PropTypes.string
|
|
16
|
-
}).description('Properties of the ActionLink component').defaultValue({}),
|
|
17
|
-
actionRef: PropTypes.object.description("\n Reference to use actions:\n - focusOnLink: function to focus the banner\n - focusOnWrapper: function to focus the link\n ").defaultValue({})
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { propTypes };
|
package/esm/styles.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
-
import { styled } from '@elliemae/ds-system';
|
|
3
|
-
import DSButton from '@elliemae/ds-button';
|
|
4
|
-
import { handleAnimation, handleBorderColor } from './utils/styleHelpers.js';
|
|
5
|
-
|
|
6
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
7
|
-
const StyledBannerContainer = styled('div', {
|
|
8
|
-
name: 'DS-Banner',
|
|
9
|
-
slot: 'root'
|
|
10
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n height: ", ";\n ", ";\n"])), _ref => {
|
|
11
|
-
let {
|
|
12
|
-
isOpen
|
|
13
|
-
} = _ref;
|
|
14
|
-
return isOpen ? 'auto' : '0px';
|
|
15
|
-
}, _ref2 => {
|
|
16
|
-
let {
|
|
17
|
-
isAnimating,
|
|
18
|
-
isOpen,
|
|
19
|
-
height
|
|
20
|
-
} = _ref2;
|
|
21
|
-
return handleAnimation(isAnimating, isOpen, height);
|
|
22
|
-
});
|
|
23
|
-
const StyledInnerContainer = styled('div', {
|
|
24
|
-
name: 'DS-Banner',
|
|
25
|
-
slot: 'innerContainer'
|
|
26
|
-
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-right: 6px;\n display: grid;\n align-items: center;\n min-height: 41px;\n width: 100%;\n background-color: ", ";\n border-bottom: 5px solid ", ";\n ", ";\n &:focus {\n position: relative;\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n pointer-events: none;\n border-radius: 2px;\n width: calc(100%);\n border: 2px solid #1e79c2;\n height: calc(100% + 4px);\n }\n }\n grid-template-columns: auto minmax(auto, auto) minmax(auto, 1fr) auto;\n"])), _ref3 => {
|
|
27
|
-
let {
|
|
28
|
-
theme
|
|
29
|
-
} = _ref3;
|
|
30
|
-
return theme.colors.neutral['000'];
|
|
31
|
-
}, _ref4 => {
|
|
32
|
-
let {
|
|
33
|
-
type,
|
|
34
|
-
theme
|
|
35
|
-
} = _ref4;
|
|
36
|
-
return handleBorderColor(type, theme);
|
|
37
|
-
}, _ref5 => {
|
|
38
|
-
let {
|
|
39
|
-
isAnimating,
|
|
40
|
-
isOpen
|
|
41
|
-
} = _ref5;
|
|
42
|
-
return handleAnimation(isAnimating, isOpen);
|
|
43
|
-
});
|
|
44
|
-
const StyledIconContainer = styled('div', {
|
|
45
|
-
name: 'DS-Banner',
|
|
46
|
-
slot: 'iconContainer'
|
|
47
|
-
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-right: ", ";\n margin-left: ", ";\n"])), _ref6 => {
|
|
48
|
-
let {
|
|
49
|
-
theme
|
|
50
|
-
} = _ref6;
|
|
51
|
-
return theme.space.xxs;
|
|
52
|
-
}, _ref7 => {
|
|
53
|
-
let {
|
|
54
|
-
theme
|
|
55
|
-
} = _ref7;
|
|
56
|
-
return theme.space.xs;
|
|
57
|
-
});
|
|
58
|
-
const StyledTitle = styled('div', {
|
|
59
|
-
name: 'DS-Banner',
|
|
60
|
-
slot: 'title'
|
|
61
|
-
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), _ref8 => {
|
|
62
|
-
let {
|
|
63
|
-
theme
|
|
64
|
-
} = _ref8;
|
|
65
|
-
return theme.colors.neutral[700];
|
|
66
|
-
}, _ref9 => {
|
|
67
|
-
let {
|
|
68
|
-
theme
|
|
69
|
-
} = _ref9;
|
|
70
|
-
return theme.fontSizes.label[400];
|
|
71
|
-
}, _ref10 => {
|
|
72
|
-
let {
|
|
73
|
-
theme
|
|
74
|
-
} = _ref10;
|
|
75
|
-
return theme.fontWeights.semibold;
|
|
76
|
-
});
|
|
77
|
-
const StyledSubTitle = styled('div', {
|
|
78
|
-
name: 'DS-Banner',
|
|
79
|
-
slot: 'subtitle'
|
|
80
|
-
})(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n width: 100%;\n margin-left: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), _ref11 => {
|
|
81
|
-
let {
|
|
82
|
-
theme
|
|
83
|
-
} = _ref11;
|
|
84
|
-
return theme.space.xs;
|
|
85
|
-
}, _ref12 => {
|
|
86
|
-
let {
|
|
87
|
-
theme
|
|
88
|
-
} = _ref12;
|
|
89
|
-
return theme.fontSizes.subTitle[400];
|
|
90
|
-
}, _ref13 => {
|
|
91
|
-
let {
|
|
92
|
-
theme
|
|
93
|
-
} = _ref13;
|
|
94
|
-
return theme.fontWeights.regular;
|
|
95
|
-
});
|
|
96
|
-
const StyledActionLink = styled('a', {
|
|
97
|
-
name: 'DS-Banner',
|
|
98
|
-
slot: 'action'
|
|
99
|
-
})(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-left: ", ";\n white-space: nowrap;\n text-decoration: none;\n line-height: 1.1;\n font-size: ", ";\n font-weight: ", ";\n color: ", ";\n"])), _ref14 => {
|
|
100
|
-
let {
|
|
101
|
-
theme,
|
|
102
|
-
isBodyEmpty
|
|
103
|
-
} = _ref14;
|
|
104
|
-
return isBodyEmpty ? theme.space.xs : 0;
|
|
105
|
-
}, _ref15 => {
|
|
106
|
-
let {
|
|
107
|
-
theme
|
|
108
|
-
} = _ref15;
|
|
109
|
-
return theme.fontSizes.hyperlink[400];
|
|
110
|
-
}, _ref16 => {
|
|
111
|
-
let {
|
|
112
|
-
theme
|
|
113
|
-
} = _ref16;
|
|
114
|
-
return theme.fontWeights.regular;
|
|
115
|
-
}, _ref17 => {
|
|
116
|
-
let {
|
|
117
|
-
theme
|
|
118
|
-
} = _ref17;
|
|
119
|
-
return theme.colors.brand[600];
|
|
120
|
-
});
|
|
121
|
-
const StyledCloseButton = styled(DSButton, {
|
|
122
|
-
name: 'DS-Banner',
|
|
123
|
-
slot: 'closeButton'
|
|
124
|
-
})(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-left: ", ";\n &:not(focus) {\n border: transparent;\n }\n"])), _ref18 => {
|
|
125
|
-
let {
|
|
126
|
-
theme
|
|
127
|
-
} = _ref18;
|
|
128
|
-
return theme.space.xxs;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
export { StyledActionLink, StyledBannerContainer, StyledCloseButton, StyledIconContainer, StyledInnerContainer, StyledSubTitle, StyledTitle };
|
package/esm/utils/bannerTypes.js
DELETED
package/esm/utils/icons.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { SuccessFill, InfoFill, AlertsDetailFill, WarningSquare } from '@elliemae/ds-icons';
|
|
4
|
-
|
|
5
|
-
const icons = {
|
|
6
|
-
success: /*#__PURE__*/_jsx(SuccessFill, {
|
|
7
|
-
fill: "#207e56",
|
|
8
|
-
width: "20px",
|
|
9
|
-
height: "20px"
|
|
10
|
-
}),
|
|
11
|
-
info: /*#__PURE__*/_jsx(InfoFill, {
|
|
12
|
-
fill: "#1e79c2",
|
|
13
|
-
width: "20px",
|
|
14
|
-
height: "20px"
|
|
15
|
-
}),
|
|
16
|
-
danger: /*#__PURE__*/_jsx(AlertsDetailFill, {
|
|
17
|
-
fill: "#c64252",
|
|
18
|
-
width: "20px",
|
|
19
|
-
height: "20px"
|
|
20
|
-
}),
|
|
21
|
-
warning: /*#__PURE__*/_jsx(WarningSquare, {
|
|
22
|
-
fill: "#d17a00",
|
|
23
|
-
width: "20px",
|
|
24
|
-
height: "20px"
|
|
25
|
-
})
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { icons };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
-
import { kfrm, css } from '@elliemae/ds-system';
|
|
3
|
-
import { BANNER_TYPES } from './bannerTypes.js';
|
|
4
|
-
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
6
|
-
const slideIn = kfrm(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n transform: translate3d(0, -100%, 0);\n }\n 100% {\n transform: translate3d(0, 0, 0);\n }\n"])));
|
|
7
|
-
const slideOut = kfrm(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0% {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n }\n 60% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n transform: translate3d(0, -100%, 0);\n }\n"])));
|
|
8
|
-
|
|
9
|
-
const spanContainer = height => kfrm(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n 0% {\n height: 0px;\n }\n 100% {\n height: ", "px;\n }\n"])), height);
|
|
10
|
-
|
|
11
|
-
const shrinkContainer = height => kfrm(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n 0% {\n height: ", "px;\n }\n 100% {\n height: 0px;\n }\n"])), height);
|
|
12
|
-
|
|
13
|
-
const handleBorderColor = (type, _ref) => {
|
|
14
|
-
let {
|
|
15
|
-
colors
|
|
16
|
-
} = _ref;
|
|
17
|
-
|
|
18
|
-
switch (type) {
|
|
19
|
-
case BANNER_TYPES.SUCCESS:
|
|
20
|
-
return colors.success[900];
|
|
21
|
-
|
|
22
|
-
case BANNER_TYPES.INFO:
|
|
23
|
-
return colors.brand[600];
|
|
24
|
-
|
|
25
|
-
case BANNER_TYPES.WARNING:
|
|
26
|
-
return colors.warning[900];
|
|
27
|
-
|
|
28
|
-
case BANNER_TYPES.DANGER:
|
|
29
|
-
return colors.danger[900];
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const handleAnimation = function (isAnimating, isOpen) {
|
|
33
|
-
let height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
34
|
-
|
|
35
|
-
if (isAnimating) {
|
|
36
|
-
if (isOpen) {
|
|
37
|
-
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n animation: ", " 0.5s ease-in;\n "])), height ? spanContainer(height) : slideIn);
|
|
38
|
-
} else {
|
|
39
|
-
return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n animation: ", " 0.5s ease-in;\n "])), height ? shrinkContainer(height) : slideOut);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export { handleAnimation, handleBorderColor };
|
package/types/DSBanner.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
import type { BannerPropsT } from './index.d';
|
|
4
|
-
declare const DSBanner: {
|
|
5
|
-
({ type, isOpen, onClose, label, body, actionLink, showCloseButton, containerProps, actionRef, }: BannerPropsT): JSX.Element;
|
|
6
|
-
defaultProps: {
|
|
7
|
-
containerProps: {};
|
|
8
|
-
label: string;
|
|
9
|
-
body: string;
|
|
10
|
-
type: "info";
|
|
11
|
-
isOpen: boolean;
|
|
12
|
-
onClose: () => null;
|
|
13
|
-
showCloseButton: boolean;
|
|
14
|
-
actionLink: {
|
|
15
|
-
label: string;
|
|
16
|
-
onClick: () => null;
|
|
17
|
-
href: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
propTypes: {
|
|
21
|
-
containerProps: {
|
|
22
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
-
};
|
|
24
|
-
label: {
|
|
25
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
26
|
-
};
|
|
27
|
-
body: {
|
|
28
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
-
};
|
|
30
|
-
type: {
|
|
31
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
-
};
|
|
33
|
-
onClose: {
|
|
34
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
35
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
-
};
|
|
37
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
38
|
-
};
|
|
39
|
-
isOpen: {
|
|
40
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
41
|
-
};
|
|
42
|
-
showCloseButton: {
|
|
43
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
44
|
-
};
|
|
45
|
-
actionLink: {
|
|
46
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
-
};
|
|
48
|
-
actionRef: {
|
|
49
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
declare const DSBannerWithSchema: {
|
|
54
|
-
(props?: unknown): JSX.Element;
|
|
55
|
-
propTypes: unknown;
|
|
56
|
-
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
57
|
-
};
|
|
58
|
-
export default DSBanner;
|
|
59
|
-
export { DSBannerWithSchema };
|
package/types/defaultProps.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const defaultProps: {
|
|
2
|
-
containerProps: {};
|
|
3
|
-
label: string;
|
|
4
|
-
body: string;
|
|
5
|
-
type: "info";
|
|
6
|
-
isOpen: boolean;
|
|
7
|
-
onClose: () => null;
|
|
8
|
-
showCloseButton: boolean;
|
|
9
|
-
actionLink: {
|
|
10
|
-
label: string;
|
|
11
|
-
onClick: () => null;
|
|
12
|
-
href: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
package/types/index.d.ts
DELETED
package/types/propTypes.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
-
export declare const propTypes: {
|
|
3
|
-
containerProps: {
|
|
4
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
5
|
-
};
|
|
6
|
-
label: {
|
|
7
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
8
|
-
};
|
|
9
|
-
body: {
|
|
10
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
11
|
-
};
|
|
12
|
-
type: {
|
|
13
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
-
};
|
|
15
|
-
onClose: {
|
|
16
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
17
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
18
|
-
};
|
|
19
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
20
|
-
};
|
|
21
|
-
isOpen: {
|
|
22
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
-
};
|
|
24
|
-
showCloseButton: {
|
|
25
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
26
|
-
};
|
|
27
|
-
actionLink: {
|
|
28
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
-
};
|
|
30
|
-
actionRef: {
|
|
31
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
-
};
|
|
33
|
-
};
|
package/types/styles.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const StyledBannerContainer: any;
|
|
2
|
-
export declare const StyledInnerContainer: any;
|
|
3
|
-
export declare const StyledIconContainer: any;
|
|
4
|
-
export declare const StyledTitle: any;
|
|
5
|
-
export declare const StyledSubTitle: any;
|
|
6
|
-
export declare const StyledActionLink: any;
|
|
7
|
-
export declare const StyledCloseButton: any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/types/utils/icons.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
2
|
-
export declare const handleBorderColor: (type: any, { colors }: {
|
|
3
|
-
colors: any;
|
|
4
|
-
}) => string;
|
|
5
|
-
export declare const handleAnimation: (isAnimating: boolean, isOpen: boolean, height?: number | null) => FlattenSimpleInterpolation;
|