@elliemae/ds-banner 2.2.0 → 2.3.0-alpha.3

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/esm/DSBanner.js CHANGED
@@ -1,47 +1,37 @@
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;
1
+ import * as React from "react";
2
+ import React2, { useLayoutEffect, useRef, useCallback, useState } from "react";
3
+ import { CloseX } from "@elliemae/ds-icons";
4
+ import { describe } from "react-desc";
5
+ import { icons } from "./utils/icons";
6
+ import { propTypes } from "./propTypes";
7
+ import { defaultProps } from "./defaultProps";
8
+ import {
9
+ StyledActionLink,
10
+ StyledCloseButton,
11
+ StyledInnerContainer,
12
+ StyledBannerContainer,
13
+ StyledIconContainer,
14
+ StyledSubTitle,
15
+ StyledTitle
16
+ } from "./styles";
17
+ const DSBanner = ({
18
+ type,
19
+ isOpen,
20
+ onClose,
21
+ label,
22
+ body,
23
+ actionLink,
24
+ showCloseButton,
25
+ containerProps,
26
+ actionRef
27
+ }) => {
36
28
  const innerContainerRef = useRef(null);
37
29
  const linkRef = useRef(null);
38
30
  const [current, setCurrent] = useState(isOpen);
39
31
  const [isAnimating, setIsAnimating] = useState(false);
40
- const [alertTabIndex, setAlertTabIndex] = useState(undefined);
41
- const ownerState = {
42
- type
43
- };
44
- React.useEffect(() => {
32
+ const [alertTabIndex, setAlertTabIndex] = useState(void 0);
33
+ const ownerState = { type };
34
+ React2.useEffect(() => {
45
35
  if (actionRef && actionRef.current) {
46
36
  actionRef.current.focusOnWrapper = () => {
47
37
  if (innerContainerRef.current) {
@@ -51,7 +41,6 @@ const DSBanner = _ref => {
51
41
  }, 100);
52
42
  }
53
43
  };
54
-
55
44
  actionRef.current.focusOnLink = () => {
56
45
  if (linkRef.current) {
57
46
  linkRef.current.focus();
@@ -60,62 +49,69 @@ const DSBanner = _ref => {
60
49
  }
61
50
  }, [actionRef]);
62
51
  useLayoutEffect(() => {
63
- if (isOpen !== current || isOpen) setIsAnimating(true);else setIsAnimating(false);
52
+ if (isOpen !== current || isOpen)
53
+ setIsAnimating(true);
54
+ else
55
+ setIsAnimating(false);
64
56
  }, [isOpen, current]);
65
57
  const handleBlur = useCallback(() => {
66
- setAlertTabIndex(undefined);
58
+ setAlertTabIndex(void 0);
67
59
  }, []);
68
- const handleOnKeyDown = useCallback(e => {
69
- if (e.key === 'Enter' || e.key === ' ') {
60
+ const handleOnKeyDown = useCallback((e) => {
61
+ if (e.key === "Enter" || e.key === " ") {
70
62
  e.preventDefault();
71
- if (linkRef.current) linkRef.current.click();
63
+ if (linkRef.current)
64
+ linkRef.current.click();
72
65
  }
73
66
  }, []);
74
- if (!isAnimating && !isOpen) return null;
75
- return /*#__PURE__*/jsx(StyledBannerContainer, _objectSpread(_objectSpread({
76
- type: type,
77
- isOpen: isOpen,
78
- isAnimating: isAnimating,
67
+ if (!isAnimating && !isOpen)
68
+ return null;
69
+ return /* @__PURE__ */ React2.createElement(StyledBannerContainer, {
70
+ type,
71
+ isOpen,
72
+ isAnimating,
79
73
  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", {}))]
74
+ "data-testid": "ds-banner-container",
75
+ ...containerProps,
76
+ ownerState
77
+ }, /* @__PURE__ */ React2.createElement(StyledInnerContainer, {
78
+ type,
79
+ isOpen,
80
+ ref: innerContainerRef,
81
+ isAnimating,
82
+ "data-testid": "ds-banner",
83
+ role: "alert",
84
+ tabIndex: alertTabIndex,
85
+ onBlur: handleBlur
86
+ }, /* @__PURE__ */ React2.createElement(StyledIconContainer, {
87
+ "data-testid": "ds-banner-icon"
88
+ }, icons[type]), /* @__PURE__ */ React2.createElement(StyledTitle, null, label), /* @__PURE__ */ React2.createElement(StyledSubTitle, null, /* @__PURE__ */ React2.createElement("span", null, body), actionLink && /* @__PURE__ */ React2.createElement(StyledActionLink, {
89
+ "data-testid": "ds-banner-action-link",
90
+ onClick: actionLink.onClick,
91
+ href: actionLink.href,
92
+ ref: linkRef,
93
+ onKeyDown: handleOnKeyDown,
94
+ tabIndex: 0,
95
+ isBodyEmpty: body
96
+ }, actionLink.label)), showCloseButton ? /* @__PURE__ */ React2.createElement(StyledCloseButton, {
97
+ "data-testid": "ds-banner-close-button",
98
+ buttonType: "secondary",
99
+ onClick: onClose,
100
+ "aria-label": "Close icon",
101
+ icon: /* @__PURE__ */ React2.createElement(CloseX, {
102
+ width: "12px",
103
+ height: "12px"
113
104
  })
114
- }));
105
+ }) : /* @__PURE__ */ React2.createElement("span", null)));
115
106
  };
116
-
117
107
  DSBanner.defaultProps = defaultProps;
108
+ DSBanner.propTypes = propTypes;
118
109
  const DSBannerWithSchema = describe(DSBanner);
119
110
  DSBannerWithSchema.propTypes = propTypes;
120
-
121
- export { DSBannerWithSchema, DSBanner as default };
111
+ var DSBanner_default = DSBanner;
112
+ export {
113
+ DSBanner,
114
+ DSBannerWithSchema,
115
+ DSBanner_default as default
116
+ };
117
+ //# sourceMappingURL=DSBanner.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSBanner.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useLayoutEffect, useRef, useCallback, useState } from 'react';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { describe } from 'react-desc';\nimport type { BannerPropsT } from './index.d';\nimport { icons } from './utils/icons';\nimport { propTypes } from './propTypes';\nimport { defaultProps } from './defaultProps';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles';\n\nconst DSBanner = ({\n type,\n isOpen,\n onClose,\n label,\n body,\n actionLink,\n showCloseButton,\n containerProps,\n actionRef,\n}: BannerPropsT): JSX.Element => {\n const innerContainerRef = useRef<HTMLDivElement | null>(null);\n const linkRef = useRef<HTMLAnchorElement | null>(null);\n const [current, setCurrent] = useState<boolean>(isOpen);\n const [isAnimating, setIsAnimating] = useState<boolean>(false);\n const [alertTabIndex, setAlertTabIndex] = useState<number | undefined>(undefined);\n\n const ownerState = { type };\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (innerContainerRef.current) {\n setAlertTabIndex(0);\n setTimeout(() => {\n innerContainerRef.current.focus();\n }, 100);\n }\n };\n actionRef.current.focusOnLink = () => {\n if (linkRef.current) {\n linkRef.current.focus();\n }\n };\n }\n }, [actionRef]);\n\n useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n const handleBlur = useCallback(() => {\n setAlertTabIndex(undefined);\n }, []);\n const handleOnKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (linkRef.current) linkRef.current.click();\n }\n }, []);\n\n if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n type={type}\n isOpen={isOpen}\n isAnimating={isAnimating}\n onAnimationEnd={() => setCurrent(isOpen)}\n data-testid=\"ds-banner-container\"\n {...containerProps}\n ownerState={ownerState}\n >\n <StyledInnerContainer\n type={type}\n isOpen={isOpen}\n ref={innerContainerRef}\n isAnimating={isAnimating}\n data-testid=\"ds-banner\"\n role=\"alert\"\n tabIndex={alertTabIndex}\n onBlur={handleBlur}\n >\n <StyledIconContainer data-testid=\"ds-banner-icon\">{icons[type]}</StyledIconContainer>\n <StyledTitle>{label}</StyledTitle>\n <StyledSubTitle>\n <span>{body}</span>\n {actionLink && (\n <StyledActionLink\n data-testid=\"ds-banner-action-link\"\n onClick={actionLink.onClick}\n href={actionLink.href}\n ref={linkRef}\n onKeyDown={handleOnKeyDown}\n tabIndex={0}\n isBodyEmpty={body}\n >\n {actionLink.label}\n </StyledActionLink>\n )}\n </StyledSubTitle>\n\n {showCloseButton ? (\n <StyledCloseButton\n data-testid=\"ds-banner-close-button\"\n buttonType=\"secondary\"\n onClick={onClose}\n aria-label=\"Close icon\"\n icon={<CloseX width=\"12px\" height=\"12px\" />}\n />\n ) : (\n <span />\n )}\n </StyledInnerContainer>\n </StyledBannerContainer>\n );\n};\n\nDSBanner.defaultProps = defaultProps;\nDSBanner.propTypes = propTypes;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = propTypes;\n\nexport default DSBanner;\nexport { DSBanner, DSBannerWithSchema };\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,MAAM,WAAW,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MAC+B;AAC/B,QAAM,oBAAoB,OAA8B;AACxD,QAAM,UAAU,OAAiC;AACjD,QAAM,CAAC,SAAS,cAAc,SAAkB;AAChD,QAAM,CAAC,aAAa,kBAAkB,SAAkB;AACxD,QAAM,CAAC,eAAe,oBAAoB,SAA6B;AAEvE,QAAM,aAAa,EAAE;AAErB,SAAM,UAAU,MAAM;AACpB,QAAI,aAAa,UAAU,SAAS;AAClC,gBAAU,QAAQ,iBAAiB,MAAM;AACvC,YAAI,kBAAkB,SAAS;AAC7B,2BAAiB;AACjB,qBAAW,MAAM;AACf,8BAAkB,QAAQ;AAAA,aACzB;AAAA;AAAA;AAGP,gBAAU,QAAQ,cAAc,MAAM;AACpC,YAAI,QAAQ,SAAS;AACnB,kBAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,KAIrB,CAAC;AAEJ,kBAAgB,MAAM;AACpB,QAAI,WAAW,WAAW;AAAQ,qBAAe;AAAA;AAC5C,qBAAe;AAAA,KACnB,CAAC,QAAQ;AAEZ,QAAM,aAAa,YAAY,MAAM;AACnC,qBAAiB;AAAA,KAChB;AACH,QAAM,kBAAkB,YAAY,CAAC,MAA2B;AAC9D,QAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,QAAE;AACF,UAAI,QAAQ;AAAS,gBAAQ,QAAQ;AAAA;AAAA,KAEtC;AAEH,MAAI,CAAC,eAAe,CAAC;AAAQ,WAAO;AAEpC,SACE,qCAAC,uBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,MAAM,WAAW;AAAA,IACjC,eAAY;AAAA,OACR;AAAA,IACJ;AAAA,KAEA,qCAAC,sBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA,eAAY;AAAA,IACZ,MAAK;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,KAER,qCAAC,qBAAD;AAAA,IAAqB,eAAY;AAAA,KAAkB,MAAM,QACzD,qCAAC,aAAD,MAAc,QACd,qCAAC,gBAAD,MACE,qCAAC,QAAD,MAAO,OACN,cACC,qCAAC,kBAAD;AAAA,IACE,eAAY;AAAA,IACZ,SAAS,WAAW;AAAA,IACpB,MAAM,WAAW;AAAA,IACjB,KAAK;AAAA,IACL,WAAW;AAAA,IACX,UAAU;AAAA,IACV,aAAa;AAAA,KAEZ,WAAW,SAKjB,kBACC,qCAAC,mBAAD;AAAA,IACE,eAAY;AAAA,IACZ,YAAW;AAAA,IACX,SAAS;AAAA,IACT,cAAW;AAAA,IACX,MAAM,qCAAC,QAAD;AAAA,MAAQ,OAAM;AAAA,MAAO,QAAO;AAAA;AAAA,OAGpC,qCAAC,QAAD;AAAA;AAOV,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,MAAM,qBAAqB,SAAS;AACpC,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
6
+ "names": []
7
+ }
@@ -1,18 +1,16 @@
1
- import { BANNER_TYPES } from './utils/bannerTypes.js';
2
-
1
+ import * as React from "react";
2
+ import { BANNER_TYPES } from "./utils/bannerTypes";
3
3
  const defaultProps = {
4
4
  containerProps: {},
5
- label: '',
6
- body: '',
5
+ label: "",
6
+ body: "",
7
7
  type: BANNER_TYPES.INFO,
8
8
  isOpen: true,
9
9
  onClose: () => null,
10
10
  showCloseButton: true,
11
- actionLink: {
12
- label: '',
13
- onClick: () => null,
14
- href: ''
15
- }
11
+ actionLink: { label: "", onClick: () => null, href: "" }
16
12
  };
17
-
18
- export { defaultProps };
13
+ export {
14
+ defaultProps
15
+ };
16
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { BANNER_TYPES } from './utils/bannerTypes';\n\nexport const defaultProps = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n actionLink: { label: '', onClick: () => null, href: '' },\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEO,MAAM,eAAe;AAAA,EAC1B,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM,aAAa;AAAA,EACnB,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY,EAAE,OAAO,IAAI,SAAS,MAAM,MAAM,MAAM;AAAA;",
6
+ "names": []
7
+ }
package/esm/index.d.js CHANGED
@@ -1 +1,2 @@
1
-
1
+ import * as React from "react";
2
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
package/esm/index.js CHANGED
@@ -1,2 +1,8 @@
1
- export { DSBannerWithSchema, default } from './DSBanner.js';
2
- export { BANNER_TYPES } from './utils/bannerTypes.js';
1
+ import * as React from "react";
2
+ import { default as default2 } from "./DSBanner";
3
+ export * from "./DSBanner";
4
+ export * from "./utils/bannerTypes";
5
+ export {
6
+ default2 as default
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default } from './DSBanner';\nexport * from './DSBanner';\nexport * from './utils/bannerTypes';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;",
6
+ "names": []
7
+ }
package/esm/propTypes.js CHANGED
@@ -1,20 +1,26 @@
1
- import { PropTypes } from 'react-desc';
2
- import { BANNER_TYPES } from './utils/bannerTypes.js';
3
-
1
+ import * as React from "react";
2
+ import { PropTypes } from "react-desc";
3
+ import { BANNER_TYPES } from "./utils/bannerTypes";
4
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),
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
12
  actionLink: PropTypes.shape({
13
13
  label: PropTypes.string,
14
14
  onClick: PropTypes.func,
15
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({})
16
+ }).description("Properties of the ActionLink component").defaultValue({}),
17
+ actionRef: PropTypes.object.description(`
18
+ Reference to use actions:
19
+ - focusOnLink: function to focus the banner
20
+ - focusOnWrapper: function to focus the link
21
+ `).defaultValue({})
18
22
  };
19
-
20
- export { propTypes };
23
+ export {
24
+ propTypes
25
+ };
26
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { BANNER_TYPES } from './utils/bannerTypes';\n\nexport const propTypes = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container').defaultValue({}),\n label: PropTypes.string.description('banner s label').defaultValue(''),\n body: PropTypes.string.description('banner s body content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('banner s type').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('function executed when the banner closes'),\n isOpen: PropTypes.bool.description('whether the banner is open or closed').defaultValue(true),\n showCloseButton: PropTypes.bool.description('whether to show close button or not').defaultValue(true),\n actionLink: PropTypes.shape({\n label: PropTypes.string,\n onClick: PropTypes.func,\n href: PropTypes.string,\n })\n .description('Properties of the ActionLink component')\n .defaultValue({}),\n actionRef: PropTypes.object\n .description(\n `\n Reference to use actions:\n - focusOnLink: function to focus the banner\n - focusOnWrapper: function to focus the link\n `,\n )\n .defaultValue({}),\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEO,MAAM,YAAY;AAAA,EACvB,gBAAgB,UAAU,OAAO,YAAY,oDAAoD,aAAa;AAAA,EAC9G,OAAO,UAAU,OAAO,YAAY,kBAAkB,aAAa;AAAA,EACnE,MAAM,UAAU,OAAO,YAAY,yBAAyB,aAAa;AAAA,EACzE,MAAM,UAAU,MAAM,OAAO,OAAO,eAAe,YAAY,iBAAiB,aAAa,aAAa;AAAA,EAC1G,SAAS,UAAU,KAAK,YAAY;AAAA,EACpC,QAAQ,UAAU,KAAK,YAAY,wCAAwC,aAAa;AAAA,EACxF,iBAAiB,UAAU,KAAK,YAAY,uCAAuC,aAAa;AAAA,EAChG,YAAY,UAAU,MAAM;AAAA,IAC1B,OAAO,UAAU;AAAA,IACjB,SAAS,UAAU;AAAA,IACnB,MAAM,UAAU;AAAA,KAEf,YAAY,0CACZ,aAAa;AAAA,EAChB,WAAW,UAAU,OAClB,YACC;AAAA;AAAA;AAAA;AAAA,OAMD,aAAa;AAAA;",
6
+ "names": []
7
+ }
package/esm/styles.js CHANGED
@@ -1,131 +1,78 @@
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 };
1
+ import * as React from "react";
2
+ import { styled } from "@elliemae/ds-system";
3
+ import DSButton from "@elliemae/ds-button";
4
+ import { handleAnimation, handleBorderColor } from "./utils/styleHelpers";
5
+ const StyledBannerContainer = styled("div", { name: "DS-Banner", slot: "root" })`
6
+ overflow: hidden;
7
+ height: ${({ isOpen }) => isOpen ? "auto" : "0px"};
8
+ ${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};
9
+ `;
10
+ const StyledInnerContainer = styled("div", {
11
+ name: "DS-Banner",
12
+ slot: "innerContainer"
13
+ })`
14
+ padding-right: 6px;
15
+ display: grid;
16
+ align-items: center;
17
+ min-height: 41px;
18
+ width: 100%;
19
+ background-color: ${({ theme }) => theme.colors.neutral["000"]};
20
+ border-bottom: 5px solid ${({ type, theme }) => handleBorderColor(type, theme)};
21
+ ${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};
22
+ &:focus {
23
+ position: relative;
24
+ &:after {
25
+ content: '';
26
+ display: block;
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ pointer-events: none;
31
+ border-radius: 2px;
32
+ width: calc(100%);
33
+ border: 2px solid #1e79c2;
34
+ height: calc(100% + 4px);
35
+ }
36
+ }
37
+ grid-template-columns: auto minmax(auto, auto) minmax(auto, 1fr) auto;
38
+ `;
39
+ const StyledIconContainer = styled("div", { name: "DS-Banner", slot: "iconContainer" })`
40
+ margin-right: ${({ theme }) => theme.space.xxs};
41
+ margin-left: ${({ theme }) => theme.space.xs};
42
+ `;
43
+ const StyledTitle = styled("div", { name: "DS-Banner", slot: "title" })`
44
+ color: ${({ theme }) => theme.colors.neutral[700]};
45
+ font-size: ${({ theme }) => theme.fontSizes.label[400]};
46
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
47
+ `;
48
+ const StyledSubTitle = styled("div", { name: "DS-Banner", slot: "subtitle" })`
49
+ width: 100%;
50
+ margin-left: ${({ theme }) => theme.space.xs};
51
+ font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};
52
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
53
+ `;
54
+ const StyledActionLink = styled("a", { name: "DS-Banner", slot: "action" })`
55
+ margin-left: ${({ theme, isBodyEmpty }) => isBodyEmpty ? theme.space.xs : 0};
56
+ white-space: nowrap;
57
+ text-decoration: none;
58
+ line-height: 1.1;
59
+ font-size: ${({ theme }) => theme.fontSizes.hyperlink[400]};
60
+ font-weight: ${({ theme }) => theme.fontWeights.regular};
61
+ color: ${({ theme }) => theme.colors.brand[600]};
62
+ `;
63
+ const StyledCloseButton = styled(DSButton, { name: "DS-Banner", slot: "closeButton" })`
64
+ margin-left: ${({ theme }) => theme.space.xxs};
65
+ &:not(focus) {
66
+ border: transparent;
67
+ }
68
+ `;
69
+ export {
70
+ StyledActionLink,
71
+ StyledBannerContainer,
72
+ StyledCloseButton,
73
+ StyledIconContainer,
74
+ StyledInnerContainer,
75
+ StyledSubTitle,
76
+ StyledTitle
77
+ };
78
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport DSButton from '@elliemae/ds-button';\nimport type { StyledActionLinkT, StyledBannerContainerT, StyledInnerContainerT } from './index.d';\nimport { handleAnimation, handleBorderColor } from './utils/styleHelpers';\n\nexport const StyledBannerContainer = styled<StyledBannerContainerT>('div', { name: 'DS-Banner', slot: 'root' })`\n overflow: hidden;\n height: ${({ isOpen }) => (isOpen ? 'auto' : '0px')};\n ${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};\n`;\n\nexport const StyledInnerContainer = styled<StyledInnerContainerT>('div', {\n name: 'DS-Banner',\n slot: 'innerContainer',\n})`\n padding-right: 6px;\n display: grid;\n align-items: center;\n min-height: 41px;\n width: 100%;\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n border-bottom: 5px solid ${({ type, theme }) => handleBorderColor(type, theme)};\n ${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};\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`;\n\nexport const StyledIconContainer = styled('div', { name: 'DS-Banner', slot: 'iconContainer' })`\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n`;\n\nexport const StyledTitle = styled('div', { name: 'DS-Banner', slot: 'title' })`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.label[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n`;\n\nexport const StyledSubTitle = styled('div', { name: 'DS-Banner', slot: 'subtitle' })`\n width: 100%;\n margin-left: ${({ theme }) => theme.space.xs};\n font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n`;\n\nexport const StyledActionLink = styled<StyledActionLinkT>('a', { name: 'DS-Banner', slot: 'action' })`\n margin-left: ${({ theme, isBodyEmpty }) => (isBodyEmpty ? theme.space.xs : 0)};\n white-space: nowrap;\n text-decoration: none;\n line-height: 1.1;\n font-size: ${({ theme }) => theme.fontSizes.hyperlink[400]};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n color: ${({ theme }) => theme.colors.brand[600]};\n`;\n\nexport const StyledCloseButton = styled(DSButton, { name: 'DS-Banner', slot: 'closeButton' })`\n margin-left: ${({ theme }) => theme.space.xxs};\n &:not(focus) {\n border: transparent;\n }\n`;\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEA;AAEO,MAAM,wBAAwB,OAA+B,OAAO,EAAE,MAAM,aAAa,MAAM;AAAA;AAAA,YAE1F,CAAC,EAAE,aAAc,SAAS,SAAS;AAAA,IAC3C,CAAC,EAAE,aAAa,QAAQ,aAAa,gBAAgB,aAAa,QAAQ;AAAA;AAGvE,MAAM,uBAAuB,OAA8B,OAAO;AAAA,EACvE,MAAM;AAAA,EACN,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAOc,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA,6BAC7B,CAAC,EAAE,MAAM,YAAY,kBAAkB,MAAM;AAAA,IACtE,CAAC,EAAE,aAAa,aAAa,gBAAgB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBvD,MAAM,sBAAsB,OAAO,OAAO,EAAE,MAAM,aAAa,MAAM;AAAA,kBAC1D,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,iBAC5B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAGrC,MAAM,cAAc,OAAO,OAAO,EAAE,MAAM,aAAa,MAAM;AAAA,WACzD,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA,eAChC,CAAC,EAAE,YAAY,MAAM,UAAU,MAAM;AAAA,iBACnC,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAG3C,MAAM,iBAAiB,OAAO,OAAO,EAAE,MAAM,aAAa,MAAM;AAAA;AAAA,iBAEtD,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,eAC7B,CAAC,EAAE,YAAY,MAAM,UAAU,SAAS;AAAA,iBACtC,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAG3C,MAAM,mBAAmB,OAA0B,KAAK,EAAE,MAAM,aAAa,MAAM;AAAA,iBACzE,CAAC,EAAE,OAAO,kBAAmB,cAAc,MAAM,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA,eAI9D,CAAC,EAAE,YAAY,MAAM,UAAU,UAAU;AAAA,iBACvC,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA,WACvC,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAGtC,MAAM,oBAAoB,OAAO,UAAU,EAAE,MAAM,aAAa,MAAM;AAAA,iBAC5D,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,8 +1,11 @@
1
+ import * as React from "react";
1
2
  const BANNER_TYPES = {
2
- INFO: 'info',
3
- SUCCESS: 'success',
4
- WARNING: 'warning',
5
- DANGER: 'danger'
3
+ INFO: "info",
4
+ SUCCESS: "success",
5
+ WARNING: "warning",
6
+ DANGER: "danger"
6
7
  };
7
-
8
- export { BANNER_TYPES };
8
+ export {
9
+ BANNER_TYPES
10
+ };
11
+ //# sourceMappingURL=bannerTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/bannerTypes.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const BANNER_TYPES = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DANGER: 'danger',\n} as const;\n"],
5
+ "mappings": "AAAA;ACAO,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA;",
6
+ "names": []
7
+ }