@elliemae/ds-banner 3.5.0-rc.9 → 3.6.0-next.0
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 +51 -31
- package/dist/cjs/DSBanner.js.map +2 -2
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/cjs/utils/icons.js +5 -5
- package/dist/cjs/utils/icons.js.map +2 -2
- package/dist/esm/DSBanner.js +51 -31
- package/dist/esm/DSBanner.js.map +2 -2
- package/dist/esm/utils/icons.js +5 -5
- package/dist/esm/utils/icons.js.map +2 -2
- package/package.json +5 -5
package/dist/cjs/DSBanner.js
CHANGED
|
@@ -30,7 +30,8 @@ __export(DSBanner_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(DSBanner_exports);
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
|
-
var
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_react = require("react");
|
|
34
35
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
36
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
36
37
|
var import_icons = require("./utils/icons");
|
|
@@ -88,7 +89,7 @@ const DSBanner = (props) => {
|
|
|
88
89
|
}, [isOpen, current]);
|
|
89
90
|
if (!isAnimating && !isOpen)
|
|
90
91
|
return null;
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledBannerContainer, {
|
|
92
93
|
isOpen,
|
|
93
94
|
height,
|
|
94
95
|
isAnimating,
|
|
@@ -96,35 +97,54 @@ const DSBanner = (props) => {
|
|
|
96
97
|
"data-testid": import_exported_related.DSBannerDatatestid.CONTAINER,
|
|
97
98
|
...containerProps,
|
|
98
99
|
...globalAttrs,
|
|
99
|
-
...xstyledAttrs
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
100
|
+
...xstyledAttrs,
|
|
101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledInnerContainer, {
|
|
102
|
+
type,
|
|
103
|
+
isOpen,
|
|
104
|
+
ref: innerContainerRef,
|
|
105
|
+
isAnimating,
|
|
106
|
+
"data-testid": import_exported_related.DSBannerDatatestid.INNER_CONTAINER,
|
|
107
|
+
role: "alert",
|
|
108
|
+
tabIndex: alertTabIndex,
|
|
109
|
+
onBlur: handleBlur,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIconContainer, {
|
|
112
|
+
"data-testid": import_exported_related.DSBannerDatatestid.ICON_CONTAINER,
|
|
113
|
+
children: import_icons.icons[type]
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, {
|
|
116
|
+
children: label
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledSubTitle, {
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
121
|
+
children: body
|
|
122
|
+
}),
|
|
123
|
+
actionLink && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledActionLink, {
|
|
124
|
+
"data-testid": import_exported_related.DSBannerDatatestid.ACTION_LINK,
|
|
125
|
+
onClick: actionLink.onClick,
|
|
126
|
+
href: actionLink.href,
|
|
127
|
+
ref: linkRef,
|
|
128
|
+
onKeyDown: handleOnKeyDown,
|
|
129
|
+
tabIndex: 0,
|
|
130
|
+
isBodyEmpty: body,
|
|
131
|
+
children: actionLink.label
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCloseButton, {
|
|
136
|
+
"data-testid": import_exported_related.DSBannerDatatestid.CLOSE_BUTTON,
|
|
137
|
+
buttonType: "icon",
|
|
138
|
+
onClick: onClose,
|
|
139
|
+
"aria-label": "Close icon",
|
|
140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.CloseX, {
|
|
141
|
+
width: 12,
|
|
142
|
+
height: 12
|
|
143
|
+
})
|
|
144
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
});
|
|
128
148
|
};
|
|
129
149
|
DSBanner.displayName = import_exported_related.DSBannerName;
|
|
130
150
|
const DSBannerWithSchema = (0, import_ds_utilities.describe)(DSBanner);
|
package/dist/cjs/DSBanner.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSBanner.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useLayoutEffect, useRef, useCallback, useState, useEffect } from 'react';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { icons } from './utils/icons';\nimport { propTypes, defaultProps } from './react-desc-prop-types';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles';\nimport type { DSBannerT } from './react-desc-prop-types';\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n\n const { type, isOpen, onClose, label, body, actionLink, showCloseButton, containerProps, actionRef, ...rest } =\n propsWithDefaults;\n\n const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);\n\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const innerContainerRef = useRef<HTMLDivElement>(null);\n const linkRef = useRef<HTMLAnchorElement>(null);\n const [current, setCurrent] = useState<boolean>(isOpen);\n const [isAnimating, setIsAnimating] = useState<boolean>(false);\n const [height, setHeight] = useState(0);\n const [alertTabIndex, setAlertTabIndex] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n if (innerContainerRef.current) {\n setHeight(innerContainerRef.current.offsetHeight);\n }\n }, [isAnimating, isOpen]);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (innerContainerRef.current) {\n setAlertTabIndex(0);\n setTimeout(() => {\n innerContainerRef.current?.focus();\n }, 300);\n }\n };\n actionRef.current.focusOnLink = () => {\n if (linkRef.current) {\n linkRef.current.focus();\n }\n };\n }\n }, [actionRef]);\n\n const handleBlur = useCallback(() => {\n setAlertTabIndex(undefined);\n }, []);\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 useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n isOpen={isOpen}\n height={height}\n isAnimating={isAnimating}\n onAnimationEnd={() => setCurrent(isOpen)}\n data-testid={DSBannerDatatestid.CONTAINER}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n <StyledInnerContainer\n type={type}\n isOpen={isOpen}\n ref={innerContainerRef}\n isAnimating={isAnimating}\n data-testid={DSBannerDatatestid.INNER_CONTAINER}\n role=\"alert\"\n tabIndex={alertTabIndex}\n onBlur={handleBlur}\n >\n <StyledIconContainer data-testid={DSBannerDatatestid.ICON_CONTAINER}>{icons[type]}</StyledIconContainer>\n <StyledTitle>{label}</StyledTitle>\n <StyledSubTitle>\n <span>{body}</span>\n {actionLink && (\n <StyledActionLink\n data-testid={DSBannerDatatestid.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 {showCloseButton ? (\n <StyledCloseButton\n data-testid={DSBannerDatatestid.CLOSE_BUTTON}\n buttonType=\"icon\"\n onClick={onClose}\n aria-label=\"Close icon\"\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : (\n <span />\n )}\n </StyledInnerContainer>\n </StyledBannerContainer>\n );\n};\n\nDSBanner.displayName = DSBannerName;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = propTypes;\n\nexport default DSBanner;\nexport { DSBanner, DSBannerWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,mBAAiF;AACjF,0BAKO;AACP,sBAAuB;AACvB,mBAAsB;AACtB,mCAAwC;AACxC,8BAAiD;AACjD,oBAQO;AAGP,MAAM,WAAiD,CAAC,UAAU;AAChE,QAAM,wBAAoB,kDAA6B,OAAO,yCAAY;AAE1E,QAAM,EAAE,MAAM,QAA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;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sharedTypes.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { BANNER_TYPES } from './exported-related';\n\nexport declare namespace DSBannerInternalsT {\n export type BannerTypesT = typeof BANNER_TYPES[keyof typeof BANNER_TYPES];\n\n export interface ActionLinkT {\n label: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href
|
|
4
|
+
"sourcesContent": ["import { BANNER_TYPES } from './exported-related';\n\nexport declare namespace DSBannerInternalsT {\n export type BannerTypesT = typeof BANNER_TYPES[keyof typeof BANNER_TYPES];\n\n export interface ActionLinkT {\n label: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href?: string;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/utils/icons.js
CHANGED
|
@@ -28,25 +28,25 @@ __export(icons_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(icons_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
32
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
33
33
|
const icons = {
|
|
34
|
-
success: /* @__PURE__ */
|
|
34
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.SuccessFill, {
|
|
35
35
|
color: ["success", "900"],
|
|
36
36
|
width: "20px",
|
|
37
37
|
height: "20px"
|
|
38
38
|
}),
|
|
39
|
-
info: /* @__PURE__ */
|
|
39
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.InfoFill, {
|
|
40
40
|
color: ["brand-primary", "600"],
|
|
41
41
|
width: "20px",
|
|
42
42
|
height: "20px"
|
|
43
43
|
}),
|
|
44
|
-
danger: /* @__PURE__ */
|
|
44
|
+
danger: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.AlertsDetailFill, {
|
|
45
45
|
color: ["danger", "900"],
|
|
46
46
|
width: "20px",
|
|
47
47
|
height: "20px"
|
|
48
48
|
}),
|
|
49
|
-
warning: /* @__PURE__ */
|
|
49
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.WarningSquare, {
|
|
50
50
|
color: ["warning", "900"],
|
|
51
51
|
width: "20px",
|
|
52
52
|
height: "20px"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/icons.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React from 'react';\nimport { AlertsDetailFill, InfoFill, SuccessFill, WarningSquare } from '@elliemae/ds-icons';\n\nexport const icons: Record<string, JSX.Element> = {\n success: <SuccessFill color={['success', '900']} width=\"20px\" height=\"20px\" />,\n info: <InfoFill color={['brand-primary', '600']} width=\"20px\" height=\"20px\" />,\n danger: <AlertsDetailFill color={['danger', '900']} width=\"20px\" height=\"20px\" />,\n warning: <WarningSquare color={['warning', '900']} width=\"20px\" height=\"20px\" />,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,sBAAuE;AAEhE,MAAM,QAAqC;AAAA,EAChD,SAAS,4CAAC;AAAA,IAAY,OAAO,CAAC,WAAW,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAAA,EAC5E,MAAM,4CAAC;AAAA,IAAS,OAAO,CAAC,iBAAiB,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAAA,EAC5E,QAAQ,4CAAC;AAAA,IAAiB,OAAO,CAAC,UAAU,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAAA,EAC/E,SAAS,4CAAC;AAAA,IAAc,OAAO,CAAC,WAAW,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAChF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSBanner.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLayoutEffect, useRef, useCallback, useState, useEffect } from "react";
|
|
3
4
|
import {
|
|
4
5
|
describe,
|
|
5
6
|
useMemoMergePropsWithDefault,
|
|
@@ -70,7 +71,7 @@ const DSBanner = (props) => {
|
|
|
70
71
|
}, [isOpen, current]);
|
|
71
72
|
if (!isAnimating && !isOpen)
|
|
72
73
|
return null;
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ jsx(StyledBannerContainer, {
|
|
74
75
|
isOpen,
|
|
75
76
|
height,
|
|
76
77
|
isAnimating,
|
|
@@ -78,35 +79,54 @@ const DSBanner = (props) => {
|
|
|
78
79
|
"data-testid": DSBannerDatatestid.CONTAINER,
|
|
79
80
|
...containerProps,
|
|
80
81
|
...globalAttrs,
|
|
81
|
-
...xstyledAttrs
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
82
|
+
...xstyledAttrs,
|
|
83
|
+
children: /* @__PURE__ */ jsxs(StyledInnerContainer, {
|
|
84
|
+
type,
|
|
85
|
+
isOpen,
|
|
86
|
+
ref: innerContainerRef,
|
|
87
|
+
isAnimating,
|
|
88
|
+
"data-testid": DSBannerDatatestid.INNER_CONTAINER,
|
|
89
|
+
role: "alert",
|
|
90
|
+
tabIndex: alertTabIndex,
|
|
91
|
+
onBlur: handleBlur,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx(StyledIconContainer, {
|
|
94
|
+
"data-testid": DSBannerDatatestid.ICON_CONTAINER,
|
|
95
|
+
children: icons[type]
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx(StyledTitle, {
|
|
98
|
+
children: label
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsxs(StyledSubTitle, {
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsx("span", {
|
|
103
|
+
children: body
|
|
104
|
+
}),
|
|
105
|
+
actionLink && /* @__PURE__ */ jsx(StyledActionLink, {
|
|
106
|
+
"data-testid": DSBannerDatatestid.ACTION_LINK,
|
|
107
|
+
onClick: actionLink.onClick,
|
|
108
|
+
href: actionLink.href,
|
|
109
|
+
ref: linkRef,
|
|
110
|
+
onKeyDown: handleOnKeyDown,
|
|
111
|
+
tabIndex: 0,
|
|
112
|
+
isBodyEmpty: body,
|
|
113
|
+
children: actionLink.label
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
}),
|
|
117
|
+
showCloseButton ? /* @__PURE__ */ jsx(StyledCloseButton, {
|
|
118
|
+
"data-testid": DSBannerDatatestid.CLOSE_BUTTON,
|
|
119
|
+
buttonType: "icon",
|
|
120
|
+
onClick: onClose,
|
|
121
|
+
"aria-label": "Close icon",
|
|
122
|
+
children: /* @__PURE__ */ jsx(CloseX, {
|
|
123
|
+
width: 12,
|
|
124
|
+
height: 12
|
|
125
|
+
})
|
|
126
|
+
}) : /* @__PURE__ */ jsx("span", {})
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
});
|
|
110
130
|
};
|
|
111
131
|
DSBanner.displayName = DSBannerName;
|
|
112
132
|
const DSBannerWithSchema = describe(DSBanner);
|
package/dist/esm/DSBanner.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSBanner.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useLayoutEffect, useRef, useCallback, useState, useEffect } from 'react';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { icons } from './utils/icons';\nimport { propTypes, defaultProps } from './react-desc-prop-types';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles';\nimport type { DSBannerT } from './react-desc-prop-types';\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n\n const { type, isOpen, onClose, label, body, actionLink, showCloseButton, containerProps, actionRef, ...rest } =\n propsWithDefaults;\n\n const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);\n\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const innerContainerRef = useRef<HTMLDivElement>(null);\n const linkRef = useRef<HTMLAnchorElement>(null);\n const [current, setCurrent] = useState<boolean>(isOpen);\n const [isAnimating, setIsAnimating] = useState<boolean>(false);\n const [height, setHeight] = useState(0);\n const [alertTabIndex, setAlertTabIndex] = useState<number | undefined>(undefined);\n\n useEffect(() => {\n if (innerContainerRef.current) {\n setHeight(innerContainerRef.current.offsetHeight);\n }\n }, [isAnimating, isOpen]);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (innerContainerRef.current) {\n setAlertTabIndex(0);\n setTimeout(() => {\n innerContainerRef.current?.focus();\n }, 300);\n }\n };\n actionRef.current.focusOnLink = () => {\n if (linkRef.current) {\n linkRef.current.focus();\n }\n };\n }\n }, [actionRef]);\n\n const handleBlur = useCallback(() => {\n setAlertTabIndex(undefined);\n }, []);\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 useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n isOpen={isOpen}\n height={height}\n isAnimating={isAnimating}\n onAnimationEnd={() => setCurrent(isOpen)}\n data-testid={DSBannerDatatestid.CONTAINER}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n <StyledInnerContainer\n type={type}\n isOpen={isOpen}\n ref={innerContainerRef}\n isAnimating={isAnimating}\n data-testid={DSBannerDatatestid.INNER_CONTAINER}\n role=\"alert\"\n tabIndex={alertTabIndex}\n onBlur={handleBlur}\n >\n <StyledIconContainer data-testid={DSBannerDatatestid.ICON_CONTAINER}>{icons[type]}</StyledIconContainer>\n <StyledTitle>{label}</StyledTitle>\n <StyledSubTitle>\n <span>{body}</span>\n {actionLink && (\n <StyledActionLink\n data-testid={DSBannerDatatestid.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 {showCloseButton ? (\n <StyledCloseButton\n data-testid={DSBannerDatatestid.CLOSE_BUTTON}\n buttonType=\"icon\"\n onClick={onClose}\n aria-label=\"Close icon\"\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : (\n <span />\n )}\n </StyledInnerContainer>\n </StyledBannerContainer>\n );\n};\n\nDSBanner.displayName = DSBannerName;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = propTypes;\n\nexport default DSBanner;\nexport { DSBanner, DSBannerWithSchema };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,iBAAiB,QAAQ,aAAa,UAAU,iBAAiB;AACjF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,WAAW,oBAAoB;AACxC,SAAS,oBAAoB,oBAAoB;AACjD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,MAAM,WAAiD,CAAC,UAAU;AAChE,QAAM,oBAAoB,6BAA6B,OAAO,YAAY;AAE1E,QAAM,EAAE,MAAM,QAAQ,SAAS,OAAO,MAAM,YAAY,iBAAiB,gBAAgB,cAAc,KAAK,IAC1G;AAEF,QAAM,EAAE,QAAQ,iBAAiB,YAAY,IAAI,uBAAuB,IAAI;AAE5E,QAAM,eAAe,mBAAmB,IAAI;AAE5C,QAAM,oBAAoB,OAAuB,IAAI;AACrD,QAAM,UAAU,OAA0B,IAAI;AAC9C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,MAAM;AACtD,QAAM,CAAC,aAAa,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A,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IAEJ,+BAAC;AAAA,MACC;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL;AAAA,MACA,eAAa,mBAAmB;AAAA,MAChC,MAAK;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,MAER;AAAA,4BAAC;AAAA,UAAoB,eAAa,mBAAmB;AAAA,UAAiB,gBAAM;AAAA,SAAM;AAAA,QAClF,oBAAC;AAAA,UAAa;AAAA,SAAM;AAAA,QACpB,qBAAC;AAAA,UACC;AAAA,gCAAC;AAAA,cAAM;AAAA,aAAK;AAAA,YACX,cACC,oBAAC;AAAA,cACC,eAAa,mBAAmB;AAAA,cAChC,SAAS,WAAW;AAAA,cACpB,MAAM,WAAW;AAAA,cACjB,KAAK;AAAA,cACL,WAAW;AAAA,cACX,UAAU;AAAA,cACV,aAAa;AAAA,cAEZ,qBAAW;AAAA,aACd;AAAA;AAAA,SAEJ;AAAA,QACC,kBACC,oBAAC;AAAA,UACC,eAAa,mBAAmB;AAAA,UAChC,YAAW;AAAA,UACX,SAAS;AAAA,UACT,cAAW;AAAA,UAEX,8BAAC;AAAA,YAAO,OAAO;AAAA,YAAI,QAAQ;AAAA,WAAI;AAAA,SACjC,IAEA,oBAAC,UAAK;AAAA;AAAA,KAEV;AAAA,GACF;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/esm/utils/icons.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { AlertsDetailFill, InfoFill, SuccessFill, WarningSquare } from "@elliemae/ds-icons";
|
|
4
4
|
const icons = {
|
|
5
|
-
success: /* @__PURE__ */
|
|
5
|
+
success: /* @__PURE__ */ jsx(SuccessFill, {
|
|
6
6
|
color: ["success", "900"],
|
|
7
7
|
width: "20px",
|
|
8
8
|
height: "20px"
|
|
9
9
|
}),
|
|
10
|
-
info: /* @__PURE__ */
|
|
10
|
+
info: /* @__PURE__ */ jsx(InfoFill, {
|
|
11
11
|
color: ["brand-primary", "600"],
|
|
12
12
|
width: "20px",
|
|
13
13
|
height: "20px"
|
|
14
14
|
}),
|
|
15
|
-
danger: /* @__PURE__ */
|
|
15
|
+
danger: /* @__PURE__ */ jsx(AlertsDetailFill, {
|
|
16
16
|
color: ["danger", "900"],
|
|
17
17
|
width: "20px",
|
|
18
18
|
height: "20px"
|
|
19
19
|
}),
|
|
20
|
-
warning: /* @__PURE__ */
|
|
20
|
+
warning: /* @__PURE__ */ jsx(WarningSquare, {
|
|
21
21
|
color: ["warning", "900"],
|
|
22
22
|
width: "20px",
|
|
23
23
|
height: "20px"
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/icons.tsx"],
|
|
4
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: Record<string, JSX.Element> = {\n success: <SuccessFill color={['success', '900']} width=\"20px\" height=\"20px\" />,\n info: <InfoFill color={['brand-primary', '600']} width=\"20px\" height=\"20px\" />,\n danger: <AlertsDetailFill color={['danger', '900']} width=\"20px\" height=\"20px\" />,\n warning: <WarningSquare color={['warning', '900']} width=\"20px\" height=\"20px\" />,\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,kBAAkB,UAAU,aAAa,qBAAqB;AAEhE,MAAM,QAAqC;AAAA,EAChD,SAAS,oBAAC;AAAA,IAAY,OAAO,CAAC,WAAW,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAAA,EAC5E,MAAM,oBAAC;AAAA,IAAS,OAAO,CAAC,iBAAiB,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAAA,EAC5E,QAAQ,oBAAC;AAAA,IAAiB,OAAO,CAAC,UAAU,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAAA,EAC/E,SAAS,oBAAC;AAAA,IAAc,OAAO,CAAC,WAAW,KAAK;AAAA,IAAG,OAAM;AAAA,IAAO,QAAO;AAAA,GAAO;AAChF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-banner",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Banner",
|
|
6
6
|
"files": [
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"indent": 4
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@elliemae/ds-button": "3.
|
|
67
|
-
"@elliemae/ds-icons": "3.
|
|
68
|
-
"@elliemae/ds-system": "3.
|
|
69
|
-
"@elliemae/ds-utilities": "3.
|
|
66
|
+
"@elliemae/ds-button": "3.6.0-next.0",
|
|
67
|
+
"@elliemae/ds-icons": "3.6.0-next.0",
|
|
68
|
+
"@elliemae/ds-system": "3.6.0-next.0",
|
|
69
|
+
"@elliemae/ds-utilities": "3.6.0-next.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@testing-library/jest-dom": "~5.16.4",
|