@elliemae/ds-banner 2.3.1 → 3.0.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.
Files changed (65) hide show
  1. package/dist/cjs/DSBanner.js +155 -0
  2. package/dist/cjs/DSBanner.js.map +7 -0
  3. package/dist/cjs/defaultProps.js +45 -0
  4. package/dist/cjs/defaultProps.js.map +7 -0
  5. package/dist/cjs/index.d.js +27 -0
  6. package/dist/cjs/index.d.js.map +7 -0
  7. package/dist/cjs/index.js +37 -0
  8. package/dist/cjs/index.js.map +7 -0
  9. package/dist/cjs/propTypes.js +55 -0
  10. package/dist/cjs/propTypes.js.map +7 -0
  11. package/dist/cjs/styles.js +107 -0
  12. package/dist/cjs/styles.js.map +7 -0
  13. package/dist/cjs/utils/bannerTypes.js +40 -0
  14. package/dist/cjs/utils/bannerTypes.js.map +7 -0
  15. package/dist/cjs/utils/icons.js +58 -0
  16. package/dist/cjs/utils/icons.js.map +7 -0
  17. package/dist/cjs/utils/styleHelpers.js +99 -0
  18. package/dist/cjs/utils/styleHelpers.js.map +7 -0
  19. package/dist/esm/DSBanner.js +136 -0
  20. package/dist/esm/DSBanner.js.map +7 -0
  21. package/dist/esm/defaultProps.js +16 -0
  22. package/dist/esm/defaultProps.js.map +7 -0
  23. package/dist/esm/index.d.js +2 -0
  24. package/dist/esm/index.d.js.map +7 -0
  25. package/dist/esm/index.js +8 -0
  26. package/dist/esm/index.js.map +7 -0
  27. package/dist/esm/propTypes.js +26 -0
  28. package/dist/esm/propTypes.js.map +7 -0
  29. package/dist/esm/styles.js +78 -0
  30. package/dist/esm/styles.js.map +7 -0
  31. package/dist/esm/utils/bannerTypes.js +11 -0
  32. package/dist/esm/utils/bannerTypes.js.map +7 -0
  33. package/dist/esm/utils/icons.js +29 -0
  34. package/dist/esm/utils/icons.js.map +7 -0
  35. package/dist/esm/utils/styleHelpers.js +70 -0
  36. package/dist/esm/utils/styleHelpers.js.map +7 -0
  37. package/package.json +42 -33
  38. package/cjs/DSBanner.js +0 -132
  39. package/cjs/defaultProps.js +0 -22
  40. package/cjs/index.d.js +0 -2
  41. package/cjs/index.js +0 -12
  42. package/cjs/propTypes.js +0 -24
  43. package/cjs/styles.js +0 -146
  44. package/cjs/utils/bannerTypes.js +0 -12
  45. package/cjs/utils/icons.js +0 -36
  46. package/cjs/utils/styleHelpers.js +0 -53
  47. package/esm/DSBanner.js +0 -121
  48. package/esm/defaultProps.js +0 -18
  49. package/esm/index.d.js +0 -1
  50. package/esm/index.js +0 -2
  51. package/esm/propTypes.js +0 -20
  52. package/esm/styles.js +0 -131
  53. package/esm/utils/bannerTypes.js +0 -8
  54. package/esm/utils/icons.js +0 -28
  55. package/esm/utils/styleHelpers.js +0 -44
  56. package/types/DSBanner.d.ts +0 -59
  57. package/types/defaultProps.d.ts +0 -14
  58. package/types/index.d.ts +0 -3
  59. package/types/propTypes.d.ts +0 -33
  60. package/types/styles.d.ts +0 -7
  61. package/types/tests/DSBanner.events.test.d.ts +0 -1
  62. package/types/tests/DSBanner.test.d.ts +0 -1
  63. package/types/utils/bannerTypes.d.ts +0 -6
  64. package/types/utils/icons.d.ts +0 -7
  65. package/types/utils/styleHelpers.d.ts +0 -5
@@ -0,0 +1,99 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var styleHelpers_exports = {};
29
+ __export(styleHelpers_exports, {
30
+ handleAnimation: () => handleAnimation,
31
+ handleBorderColor: () => handleBorderColor
32
+ });
33
+ var React = __toESM(require("react"));
34
+ var import_ds_system = require("@elliemae/ds-system");
35
+ var import_bannerTypes = require("./bannerTypes");
36
+ const slideIn = import_ds_system.kfrm`
37
+ 0% {
38
+ transform: translate3d(0, -100%, 0);
39
+ }
40
+ 100% {
41
+ transform: translate3d(0, 0, 0);
42
+ }
43
+ `;
44
+ const slideOut = import_ds_system.kfrm`
45
+ 0% {
46
+ transform: translate3d(0, 0, 0);
47
+ opacity: 1;
48
+ }
49
+ 60% {
50
+ opacity: 0;
51
+ }
52
+ 100% {
53
+ opacity: 0;
54
+ transform: translate3d(0, -100%, 0);
55
+ }
56
+ `;
57
+ const spanContainer = (height) => import_ds_system.kfrm`
58
+ 0% {
59
+ height: 0px;
60
+ }
61
+ 100% {
62
+ height: ${height}px;
63
+ }
64
+ `;
65
+ const shrinkContainer = (height) => import_ds_system.kfrm`
66
+ 0% {
67
+ height: ${height}px;
68
+ }
69
+ 100% {
70
+ height: 0px;
71
+ }
72
+ `;
73
+ const handleBorderColor = (type, { colors }) => {
74
+ switch (type) {
75
+ case import_bannerTypes.BANNER_TYPES.SUCCESS:
76
+ return colors.success[900];
77
+ case import_bannerTypes.BANNER_TYPES.INFO:
78
+ return colors.brand[600];
79
+ case import_bannerTypes.BANNER_TYPES.WARNING:
80
+ return colors.warning[900];
81
+ case import_bannerTypes.BANNER_TYPES.DANGER:
82
+ return colors.danger[900];
83
+ }
84
+ };
85
+ const handleAnimation = (isAnimating, isOpen, height = null) => {
86
+ if (isAnimating) {
87
+ if (isOpen) {
88
+ return import_ds_system.css`
89
+ animation: ${height ? spanContainer(height) : slideIn} 0.5s ease-in;
90
+ `;
91
+ } else {
92
+ return import_ds_system.css`
93
+ animation: ${height ? shrinkContainer(height) : slideOut} 0.5s ease-in;
94
+ `;
95
+ }
96
+ }
97
+ };
98
+ module.exports = __toCommonJS(styleHelpers_exports);
99
+ //# sourceMappingURL=styleHelpers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utils/styleHelpers.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { kfrm, css } from '@elliemae/ds-system';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport { BANNER_TYPES } from './bannerTypes';\n\nconst slideIn = kfrm`\n 0% {\n transform: translate3d(0, -100%, 0);\n }\n 100% {\n transform: translate3d(0, 0, 0);\n }\n`;\n\nconst slideOut = kfrm`\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`;\n\nconst spanContainer = (height: number) => kfrm`\n 0% {\n height: 0px;\n }\n 100% {\n height: ${height}px;\n }\n`;\n\nconst shrinkContainer = (height: number) => kfrm`\n 0% {\n height: ${height}px;\n }\n 100% {\n height: 0px;\n }\n`;\n\nexport const handleBorderColor = (type, { colors }): string => {\n switch (type) {\n case BANNER_TYPES.SUCCESS:\n return colors.success[900];\n case BANNER_TYPES.INFO:\n return colors.brand[600];\n case BANNER_TYPES.WARNING:\n return colors.warning[900];\n case BANNER_TYPES.DANGER:\n return colors.danger[900];\n }\n};\n\nexport const handleAnimation = (\n isAnimating: boolean,\n isOpen: boolean,\n height: number | null = null,\n): FlattenSimpleInterpolation => {\n if (isAnimating) {\n if (isOpen) {\n return css`\n animation: ${height ? spanContainer(height) : slideIn} 0.5s ease-in;\n `;\n } else {\n return css`\n animation: ${height ? shrinkContainer(height) : slideOut} 0.5s ease-in;\n `;\n }\n }\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA0B;AAE1B,yBAA6B;AAE7B,MAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcjB,MAAM,gBAAgB,CAAC,WAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,cAK5B;AAAA;AAAA;AAId,MAAM,kBAAkB,CAAC,WAAmB;AAAA;AAAA,cAE9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAOP,MAAM,oBAAoB,CAAC,MAAM,EAAE,aAAqB;AAC7D,UAAQ;AAAA,SACD,gCAAa;AAChB,aAAO,OAAO,QAAQ;AAAA,SACnB,gCAAa;AAChB,aAAO,OAAO,MAAM;AAAA,SACjB,gCAAa;AAChB,aAAO,OAAO,QAAQ;AAAA,SACnB,gCAAa;AAChB,aAAO,OAAO,OAAO;AAAA;AAAA;AAIpB,MAAM,kBAAkB,CAC7B,aACA,QACA,SAAwB,SACO;AAC/B,MAAI,aAAa;AACf,QAAI,QAAQ;AACV,aAAO;AAAA,qBACQ,SAAS,cAAc,UAAU;AAAA;AAAA,WAE3C;AACL,aAAO;AAAA,qBACQ,SAAS,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,136 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import React2, { useLayoutEffect, useRef, useCallback, useState } from "react";
22
+ import { CloseX } from "@elliemae/ds-icons";
23
+ import { describe } from "react-desc";
24
+ import { icons } from "./utils/icons";
25
+ import { propTypes } from "./propTypes";
26
+ import { defaultProps } from "./defaultProps";
27
+ import {
28
+ StyledActionLink,
29
+ StyledCloseButton,
30
+ StyledInnerContainer,
31
+ StyledBannerContainer,
32
+ StyledIconContainer,
33
+ StyledSubTitle,
34
+ StyledTitle
35
+ } from "./styles";
36
+ const DSBanner = ({
37
+ type,
38
+ isOpen,
39
+ onClose,
40
+ label,
41
+ body,
42
+ actionLink,
43
+ showCloseButton,
44
+ containerProps,
45
+ actionRef
46
+ }) => {
47
+ const innerContainerRef = useRef(null);
48
+ const linkRef = useRef(null);
49
+ const [current, setCurrent] = useState(isOpen);
50
+ const [isAnimating, setIsAnimating] = useState(false);
51
+ const [alertTabIndex, setAlertTabIndex] = useState(void 0);
52
+ const ownerState = { type };
53
+ React2.useEffect(() => {
54
+ if (actionRef && actionRef.current) {
55
+ actionRef.current.focusOnWrapper = () => {
56
+ if (innerContainerRef.current) {
57
+ setAlertTabIndex(0);
58
+ setTimeout(() => {
59
+ innerContainerRef.current.focus();
60
+ }, 100);
61
+ }
62
+ };
63
+ actionRef.current.focusOnLink = () => {
64
+ if (linkRef.current) {
65
+ linkRef.current.focus();
66
+ }
67
+ };
68
+ }
69
+ }, [actionRef]);
70
+ useLayoutEffect(() => {
71
+ if (isOpen !== current || isOpen)
72
+ setIsAnimating(true);
73
+ else
74
+ setIsAnimating(false);
75
+ }, [isOpen, current]);
76
+ const handleBlur = useCallback(() => {
77
+ setAlertTabIndex(void 0);
78
+ }, []);
79
+ const handleOnKeyDown = useCallback((e) => {
80
+ if (e.key === "Enter" || e.key === " ") {
81
+ e.preventDefault();
82
+ if (linkRef.current)
83
+ linkRef.current.click();
84
+ }
85
+ }, []);
86
+ if (!isAnimating && !isOpen)
87
+ return null;
88
+ return /* @__PURE__ */ React2.createElement(StyledBannerContainer, __spreadProps(__spreadValues({
89
+ type,
90
+ isOpen,
91
+ isAnimating,
92
+ onAnimationEnd: () => setCurrent(isOpen),
93
+ "data-testid": "ds-banner-container"
94
+ }, containerProps), {
95
+ ownerState
96
+ }), /* @__PURE__ */ React2.createElement(StyledInnerContainer, {
97
+ type,
98
+ isOpen,
99
+ ref: innerContainerRef,
100
+ isAnimating,
101
+ "data-testid": "ds-banner",
102
+ role: "alert",
103
+ tabIndex: alertTabIndex,
104
+ onBlur: handleBlur
105
+ }, /* @__PURE__ */ React2.createElement(StyledIconContainer, {
106
+ "data-testid": "ds-banner-icon"
107
+ }, icons[type]), /* @__PURE__ */ React2.createElement(StyledTitle, null, label), /* @__PURE__ */ React2.createElement(StyledSubTitle, null, /* @__PURE__ */ React2.createElement("span", null, body), actionLink && /* @__PURE__ */ React2.createElement(StyledActionLink, {
108
+ "data-testid": "ds-banner-action-link",
109
+ onClick: actionLink.onClick,
110
+ href: actionLink.href,
111
+ ref: linkRef,
112
+ onKeyDown: handleOnKeyDown,
113
+ tabIndex: 0,
114
+ isBodyEmpty: body
115
+ }, actionLink.label)), showCloseButton ? /* @__PURE__ */ React2.createElement(StyledCloseButton, {
116
+ "data-testid": "ds-banner-close-button",
117
+ buttonType: "secondary",
118
+ onClick: onClose,
119
+ "aria-label": "Close icon",
120
+ icon: /* @__PURE__ */ React2.createElement(CloseX, {
121
+ width: "12px",
122
+ height: "12px"
123
+ })
124
+ }) : /* @__PURE__ */ React2.createElement("span", null)));
125
+ };
126
+ DSBanner.defaultProps = defaultProps;
127
+ DSBanner.propTypes = propTypes;
128
+ const DSBannerWithSchema = describe(DSBanner);
129
+ DSBannerWithSchema.propTypes = propTypes;
130
+ var DSBanner_default = DSBanner;
131
+ export {
132
+ DSBanner,
133
+ DSBannerWithSchema,
134
+ DSBanner_default as default
135
+ };
136
+ //# 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,KACR,iBANN;AAAA,IAOE;AAAA,MAEA,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
+ }
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { BANNER_TYPES } from "./utils/bannerTypes";
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: { label: "", onClick: () => null, href: "" }
12
+ };
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
+ }
@@ -0,0 +1,2 @@
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
+ }
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import { PropTypes } from "react-desc";
3
+ import { BANNER_TYPES } from "./utils/bannerTypes";
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(`
18
+ Reference to use actions:
19
+ - focusOnLink: function to focus the banner
20
+ - focusOnWrapper: function to focus the link
21
+ `).defaultValue({})
22
+ };
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
+ }
@@ -0,0 +1,78 @@
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
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ const BANNER_TYPES = {
3
+ INFO: "info",
4
+ SUCCESS: "success",
5
+ WARNING: "warning",
6
+ DANGER: "danger"
7
+ };
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
+ }
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { AlertsDetailFill, InfoFill, SuccessFill, WarningSquare } from "@elliemae/ds-icons";
4
+ const icons = {
5
+ success: /* @__PURE__ */ React2.createElement(SuccessFill, {
6
+ fill: "#207e56",
7
+ width: "20px",
8
+ height: "20px"
9
+ }),
10
+ info: /* @__PURE__ */ React2.createElement(InfoFill, {
11
+ fill: "#1e79c2",
12
+ width: "20px",
13
+ height: "20px"
14
+ }),
15
+ danger: /* @__PURE__ */ React2.createElement(AlertsDetailFill, {
16
+ fill: "#c64252",
17
+ width: "20px",
18
+ height: "20px"
19
+ }),
20
+ warning: /* @__PURE__ */ React2.createElement(WarningSquare, {
21
+ fill: "#d17a00",
22
+ width: "20px",
23
+ height: "20px"
24
+ })
25
+ };
26
+ export {
27
+ icons
28
+ };
29
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/icons.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { AlertsDetailFill, InfoFill, SuccessFill, WarningSquare } from '@elliemae/ds-icons';\n\nexport const icons = {\n success: <SuccessFill fill=\"#207e56\" width=\"20px\" height=\"20px\" />,\n info: <InfoFill fill=\"#1e79c2\" width=\"20px\" height=\"20px\" />,\n danger: <AlertsDetailFill fill=\"#c64252\" width=\"20px\" height=\"20px\" />,\n warning: <WarningSquare fill=\"#d17a00\" width=\"20px\" height=\"20px\" />,\n};\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AAEO,MAAM,QAAQ;AAAA,EACnB,SAAS,qCAAC,aAAD;AAAA,IAAa,MAAK;AAAA,IAAU,OAAM;AAAA,IAAO,QAAO;AAAA;AAAA,EACzD,MAAM,qCAAC,UAAD;AAAA,IAAU,MAAK;AAAA,IAAU,OAAM;AAAA,IAAO,QAAO;AAAA;AAAA,EACnD,QAAQ,qCAAC,kBAAD;AAAA,IAAkB,MAAK;AAAA,IAAU,OAAM;AAAA,IAAO,QAAO;AAAA;AAAA,EAC7D,SAAS,qCAAC,eAAD;AAAA,IAAe,MAAK;AAAA,IAAU,OAAM;AAAA,IAAO,QAAO;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,70 @@
1
+ import * as React from "react";
2
+ import { kfrm, css } from "@elliemae/ds-system";
3
+ import { BANNER_TYPES } from "./bannerTypes";
4
+ const slideIn = kfrm`
5
+ 0% {
6
+ transform: translate3d(0, -100%, 0);
7
+ }
8
+ 100% {
9
+ transform: translate3d(0, 0, 0);
10
+ }
11
+ `;
12
+ const slideOut = kfrm`
13
+ 0% {
14
+ transform: translate3d(0, 0, 0);
15
+ opacity: 1;
16
+ }
17
+ 60% {
18
+ opacity: 0;
19
+ }
20
+ 100% {
21
+ opacity: 0;
22
+ transform: translate3d(0, -100%, 0);
23
+ }
24
+ `;
25
+ const spanContainer = (height) => kfrm`
26
+ 0% {
27
+ height: 0px;
28
+ }
29
+ 100% {
30
+ height: ${height}px;
31
+ }
32
+ `;
33
+ const shrinkContainer = (height) => kfrm`
34
+ 0% {
35
+ height: ${height}px;
36
+ }
37
+ 100% {
38
+ height: 0px;
39
+ }
40
+ `;
41
+ const handleBorderColor = (type, { colors }) => {
42
+ switch (type) {
43
+ case BANNER_TYPES.SUCCESS:
44
+ return colors.success[900];
45
+ case BANNER_TYPES.INFO:
46
+ return colors.brand[600];
47
+ case BANNER_TYPES.WARNING:
48
+ return colors.warning[900];
49
+ case BANNER_TYPES.DANGER:
50
+ return colors.danger[900];
51
+ }
52
+ };
53
+ const handleAnimation = (isAnimating, isOpen, height = null) => {
54
+ if (isAnimating) {
55
+ if (isOpen) {
56
+ return css`
57
+ animation: ${height ? spanContainer(height) : slideIn} 0.5s ease-in;
58
+ `;
59
+ } else {
60
+ return css`
61
+ animation: ${height ? shrinkContainer(height) : slideOut} 0.5s ease-in;
62
+ `;
63
+ }
64
+ }
65
+ };
66
+ export {
67
+ handleAnimation,
68
+ handleBorderColor
69
+ };
70
+ //# sourceMappingURL=styleHelpers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/styleHelpers.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { kfrm, css } from '@elliemae/ds-system';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport { BANNER_TYPES } from './bannerTypes';\n\nconst slideIn = kfrm`\n 0% {\n transform: translate3d(0, -100%, 0);\n }\n 100% {\n transform: translate3d(0, 0, 0);\n }\n`;\n\nconst slideOut = kfrm`\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`;\n\nconst spanContainer = (height: number) => kfrm`\n 0% {\n height: 0px;\n }\n 100% {\n height: ${height}px;\n }\n`;\n\nconst shrinkContainer = (height: number) => kfrm`\n 0% {\n height: ${height}px;\n }\n 100% {\n height: 0px;\n }\n`;\n\nexport const handleBorderColor = (type, { colors }): string => {\n switch (type) {\n case BANNER_TYPES.SUCCESS:\n return colors.success[900];\n case BANNER_TYPES.INFO:\n return colors.brand[600];\n case BANNER_TYPES.WARNING:\n return colors.warning[900];\n case BANNER_TYPES.DANGER:\n return colors.danger[900];\n }\n};\n\nexport const handleAnimation = (\n isAnimating: boolean,\n isOpen: boolean,\n height: number | null = null,\n): FlattenSimpleInterpolation => {\n if (isAnimating) {\n if (isOpen) {\n return css`\n animation: ${height ? spanContainer(height) : slideIn} 0.5s ease-in;\n `;\n } else {\n return css`\n animation: ${height ? shrinkContainer(height) : slideOut} 0.5s ease-in;\n `;\n }\n }\n};\n"],
5
+ "mappings": "AAAA;ACAA;AAEA;AAEA,MAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcjB,MAAM,gBAAgB,CAAC,WAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,cAK5B;AAAA;AAAA;AAId,MAAM,kBAAkB,CAAC,WAAmB;AAAA;AAAA,cAE9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAOP,MAAM,oBAAoB,CAAC,MAAM,EAAE,aAAqB;AAC7D,UAAQ;AAAA,SACD,aAAa;AAChB,aAAO,OAAO,QAAQ;AAAA,SACnB,aAAa;AAChB,aAAO,OAAO,MAAM;AAAA,SACjB,aAAa;AAChB,aAAO,OAAO,QAAQ;AAAA,SACnB,aAAa;AAChB,aAAO,OAAO,OAAO;AAAA;AAAA;AAIpB,MAAM,kBAAkB,CAC7B,aACA,QACA,SAAwB,SACO;AAC/B,MAAI,aAAa;AACf,QAAI,QAAQ;AACV,aAAO;AAAA,qBACQ,SAAS,cAAc,UAAU;AAAA;AAAA,WAE3C;AACL,aAAO;AAAA,qBACQ,SAAS,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }