@elliemae/ds-banner 3.17.0-next.2 → 3.17.0-next.20
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 +46 -9
- package/dist/cjs/DSBanner.js.map +3 -3
- package/dist/cjs/exported-related/DSBannerDatatestid.js +1 -0
- package/dist/cjs/exported-related/DSBannerDatatestid.js.map +2 -2
- package/dist/cjs/exported-related/theming.js +1 -0
- package/dist/cjs/exported-related/theming.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +2 -0
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styles.js +25 -23
- package/dist/cjs/styles.js.map +2 -2
- package/dist/esm/DSBanner.js +47 -10
- package/dist/esm/DSBanner.js.map +3 -3
- package/dist/esm/exported-related/DSBannerDatatestid.js +1 -0
- package/dist/esm/exported-related/DSBannerDatatestid.js.map +2 -2
- package/dist/esm/exported-related/theming.js +1 -0
- package/dist/esm/exported-related/theming.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +2 -0
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styles.js +25 -23
- package/dist/esm/styles.js.map +2 -2
- package/dist/types/exported-related/DSBannerDatatestid.d.ts +1 -0
- package/dist/types/exported-related/theming.d.ts +1 -0
- package/dist/types/react-desc-prop-types.d.ts +2 -0
- package/dist/types/styles.d.ts +17 -5
- package/dist/types/tests/DSBanner.axe.test.d.ts +1 -0
- package/dist/types/utils/icons.d.ts +1 -0
- package/package.json +9 -6
package/dist/cjs/DSBanner.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(DSBanner_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(DSBanner_exports);
|
|
36
36
|
var React = __toESM(require("react"));
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var import_react = require("react");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
40
40
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
41
41
|
var import_icons = require("./utils/icons.js");
|
|
@@ -44,7 +44,20 @@ var import_exported_related = require("./exported-related/index.js");
|
|
|
44
44
|
var import_styles = require("./styles.js");
|
|
45
45
|
const DSBanner = (props) => {
|
|
46
46
|
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
47
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
type,
|
|
49
|
+
isOpen,
|
|
50
|
+
onClose,
|
|
51
|
+
label,
|
|
52
|
+
body,
|
|
53
|
+
closeBtnRef,
|
|
54
|
+
CustomBody,
|
|
55
|
+
actionLink,
|
|
56
|
+
showCloseButton,
|
|
57
|
+
containerProps,
|
|
58
|
+
actionRef,
|
|
59
|
+
...rest
|
|
60
|
+
} = propsWithDefaults;
|
|
48
61
|
const { height: globalHeight, ...globalAttrs } = (0, import_ds_props_helpers.useGetGlobalAttributes)(rest);
|
|
49
62
|
const xstyledAttrs = (0, import_ds_props_helpers.useGetXstyledProps)(rest);
|
|
50
63
|
const innerContainerRef = (0, import_react.useRef)(null);
|
|
@@ -85,12 +98,30 @@ const DSBanner = (props) => {
|
|
|
85
98
|
linkRef.current.click();
|
|
86
99
|
}
|
|
87
100
|
}, []);
|
|
101
|
+
const handleOnKeyDownToClose = (0, import_react.useCallback)(
|
|
102
|
+
(e) => {
|
|
103
|
+
if (e.key === "Escape") {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
onClose();
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
[onClose]
|
|
109
|
+
);
|
|
88
110
|
(0, import_react.useLayoutEffect)(() => {
|
|
89
111
|
if (isOpen !== current || isOpen)
|
|
90
112
|
setIsAnimating(true);
|
|
91
113
|
else
|
|
92
114
|
setIsAnimating(false);
|
|
93
115
|
}, [isOpen, current]);
|
|
116
|
+
const innerCols = import_react.default.useMemo(() => {
|
|
117
|
+
if (!CustomBody) {
|
|
118
|
+
const finalCols = ["auto", "fit-content(50%)", "1fr"];
|
|
119
|
+
if (showCloseButton)
|
|
120
|
+
finalCols.push("auto");
|
|
121
|
+
return finalCols;
|
|
122
|
+
}
|
|
123
|
+
return ["1fr", "auto"];
|
|
124
|
+
}, [CustomBody, showCloseButton]);
|
|
94
125
|
if (!isAnimating && !isOpen)
|
|
95
126
|
return null;
|
|
96
127
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -98,15 +129,19 @@ const DSBanner = (props) => {
|
|
|
98
129
|
{
|
|
99
130
|
isOpen,
|
|
100
131
|
height,
|
|
132
|
+
onKeyDown: handleOnKeyDownToClose,
|
|
101
133
|
isAnimating,
|
|
102
134
|
onAnimationEnd: () => setCurrent(isOpen),
|
|
103
135
|
"data-testid": import_exported_related.DSBannerDatatestid.CONTAINER,
|
|
104
136
|
...containerProps,
|
|
105
137
|
...globalAttrs,
|
|
106
138
|
...xstyledAttrs,
|
|
107
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
140
|
import_styles.StyledInnerContainer,
|
|
109
141
|
{
|
|
142
|
+
cols: innerCols,
|
|
143
|
+
justifyItems: CustomBody ? "center" : "",
|
|
144
|
+
alignItems: height === 41 ? "center" : "flex-start",
|
|
110
145
|
type,
|
|
111
146
|
isOpen,
|
|
112
147
|
ref: innerContainerRef,
|
|
@@ -115,10 +150,10 @@ const DSBanner = (props) => {
|
|
|
115
150
|
role: "alert",
|
|
116
151
|
tabIndex: alertTabIndex,
|
|
117
152
|
onBlur: handleBlur,
|
|
118
|
-
children: [
|
|
119
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIconContainer, { "data-testid": import_exported_related.DSBannerDatatestid.ICON_CONTAINER, children: import_icons.icons[type] }),
|
|
120
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { children: label }),
|
|
121
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledSubTitle, { children: [
|
|
153
|
+
children: !CustomBody ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIconContainer, { height, "data-testid": import_exported_related.DSBannerDatatestid.ICON_CONTAINER, children: import_icons.icons[type] }),
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { height, children: label }),
|
|
156
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledSubTitle, { height, children: [
|
|
122
157
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: body }),
|
|
123
158
|
actionLink && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
159
|
import_styles.StyledActionLink,
|
|
@@ -139,12 +174,14 @@ const DSBanner = (props) => {
|
|
|
139
174
|
{
|
|
140
175
|
"data-testid": import_exported_related.DSBannerDatatestid.CLOSE_BUTTON,
|
|
141
176
|
buttonType: "icon",
|
|
177
|
+
height,
|
|
178
|
+
innerRef: closeBtnRef,
|
|
142
179
|
onClick: onClose,
|
|
143
180
|
"aria-label": "Close icon",
|
|
144
181
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.CloseX, { width: 12, height: 12 })
|
|
145
182
|
}
|
|
146
|
-
) :
|
|
147
|
-
]
|
|
183
|
+
) : null
|
|
184
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomBody, {})
|
|
148
185
|
}
|
|
149
186
|
)
|
|
150
187
|
}
|
package/dist/cjs/DSBanner.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSBanner.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
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-props-helpers';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { icons } from './utils/icons.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n\n const {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": []
|
|
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-props-helpers';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { icons } from './utils/icons.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n\n const {\n type,\n isOpen,\n onClose,\n label,\n body,\n closeBtnRef,\n CustomBody,\n actionLink,\n showCloseButton,\n containerProps,\n actionRef,\n ...rest\n } = propsWithDefaults;\n // eslint-disable-next-line no-unused-vars\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 const handleOnKeyDownToClose = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClose();\n }\n },\n [onClose],\n );\n\n useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n const innerCols = React.useMemo(() => {\n if (!CustomBody) {\n const finalCols = ['auto', 'fit-content(50%)', '1fr'];\n if (showCloseButton) finalCols.push('auto');\n return finalCols;\n }\n return ['1fr', 'auto'];\n }, [CustomBody, showCloseButton]);\n\n if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n isOpen={isOpen}\n height={height}\n onKeyDown={handleOnKeyDownToClose}\n isAnimating={isAnimating}\n onAnimationEnd={() => setCurrent(isOpen)}\n data-testid={DSBannerDatatestid.CONTAINER}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n <StyledInnerContainer\n cols={innerCols}\n justifyItems={CustomBody ? 'center' : ''}\n alignItems={height === 41 ? 'center' : 'flex-start'}\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 {!CustomBody ? (\n <>\n <StyledIconContainer height={height} data-testid={DSBannerDatatestid.ICON_CONTAINER}>\n {icons[type]}\n </StyledIconContainer>\n <StyledTitle height={height}>{label}</StyledTitle>\n <StyledSubTitle height={height}>\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 height={height}\n innerRef={closeBtnRef}\n onClick={onClose}\n aria-label=\"Close icon\"\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </>\n ) : (\n <CustomBody />\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;AA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A,UACA;AAAA,UACA,KAAK;AAAA,UACL;AAAA,UACA,eAAa,2CAAmB;AAAA,UAChC,MAAK;AAAA,UACL,UAAU;AAAA,UACV,QAAQ;AAAA,UAEP,WAAC,aACA,4EACE;AAAA,wDAAC,qCAAoB,QAAgB,eAAa,2CAAmB,gBAClE,6BAAM,IAAI,GACb;AAAA,YACA,4CAAC,6BAAY,QAAiB,iBAAM;AAAA,YACpC,6CAAC,gCAAe,QACd;AAAA,0DAAC,UAAM,gBAAK;AAAA,cACX,cACC;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAa,2CAAmB;AAAA,kBAChC,SAAS,WAAW;AAAA,kBACpB,MAAM,WAAW;AAAA,kBACjB,KAAK;AAAA,kBACL,WAAW;AAAA,kBACX,UAAU;AAAA,kBACV,aAAa;AAAA,kBAEZ,qBAAW;AAAA;AAAA,cACd;AAAA,eAEJ;AAAA,YACC,kBACC;AAAA,cAAC;AAAA;AAAA,gBACC,eAAa,2CAAmB;AAAA,gBAChC,YAAW;AAAA,gBACX;AAAA,gBACA,UAAU;AAAA,gBACV,SAAS;AAAA,gBACT,cAAW;AAAA,gBAEX,sDAAC,0BAAO,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,YACjC,IACE;AAAA,aACN,IAEA,4CAAC,cAAW;AAAA;AAAA,MAEhB;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,yBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(DSBannerDatatestid_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
const DSBannerDatatestid = {
|
|
36
36
|
CONTAINER: "ds-banner-container",
|
|
37
|
+
CUSTOM_CONTAINER: "ds-banner-custom-container",
|
|
37
38
|
INNER_CONTAINER: "ds-banner",
|
|
38
39
|
ICON_CONTAINER: "ds-banner-icon",
|
|
39
40
|
ACTION_LINK: "ds-banner-action-link",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/exported-related/DSBannerDatatestid.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const DSBannerDatatestid = {\n CONTAINER: 'ds-banner-container',\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n ACTION_LINK: 'ds-banner-action-link',\n CLOSE_BUTTON: 'ds-banner-close-button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
4
|
+
"sourcesContent": ["export const DSBannerDatatestid = {\n CONTAINER: 'ds-banner-container',\n CUSTOM_CONTAINER: 'ds-banner-custom-container',\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n ACTION_LINK: 'ds-banner-action-link',\n CLOSE_BUTTON: 'ds-banner-close-button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/exported-related/theming.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const DSBannerName = 'DSBanner';\n\nexport const DSBannerSlots = {\n CONTAINER: 'root',\n INNER_CONTAINER: 'inner-container',\n TITLE: 'title',\n SUBTITLE: 'subtitle',\n ICON_CONTAINER: 'icon-container',\n ACTION_LINK: 'action-link',\n CLOSE_BUTTON: 'close-button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe;AAErB,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
4
|
+
"sourcesContent": ["export const DSBannerName = 'DSBanner';\n\nexport const DSBannerSlots = {\n CONTAINER: 'root',\n INNER_CONTAINER: 'inner-container',\n CUSTOM_CONTAINER: 'custom-container',\n TITLE: 'title',\n SUBTITLE: 'subtitle',\n ICON_CONTAINER: 'icon-container',\n ACTION_LINK: 'action-link',\n CLOSE_BUTTON: 'close-button',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe;AAErB,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -50,10 +50,12 @@ const propTypes = {
|
|
|
50
50
|
containerProps: import_ds_props_helpers.PropTypes.object.description("Set of Properties attached to the main container.").defaultValue({}),
|
|
51
51
|
label: import_ds_props_helpers.PropTypes.string.description("Banner label.").defaultValue(""),
|
|
52
52
|
body: import_ds_props_helpers.PropTypes.string.description("Banner body content").defaultValue(""),
|
|
53
|
+
CustomBody: import_ds_props_helpers.PropTypes.func.description("Banner custom content").defaultValue(""),
|
|
53
54
|
type: import_ds_props_helpers.PropTypes.oneOf(Object.values(import_exported_related.BANNER_TYPES)).description("Banner type.").defaultValue(import_exported_related.BANNER_TYPES.INFO),
|
|
54
55
|
onClose: import_ds_props_helpers.PropTypes.func.description("Callback when the Banner closes."),
|
|
55
56
|
isOpen: import_ds_props_helpers.PropTypes.bool.description("Whether the Banner is open or closed.").defaultValue(true),
|
|
56
57
|
showCloseButton: import_ds_props_helpers.PropTypes.bool.description("Whether to show close button or not.").defaultValue(true),
|
|
58
|
+
closeBtnRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.object, import_ds_props_helpers.PropTypes.func]).description("Inner ref to button component."),
|
|
57
59
|
actionLink: import_ds_props_helpers.PropTypes.shape({
|
|
58
60
|
label: import_ds_props_helpers.PropTypes.string,
|
|
59
61
|
onClick: import_ds_props_helpers.PropTypes.func,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { BANNER_TYPES } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\n\nexport declare namespace DSBannerT {\n export interface Props {\n type?: DSBannerInternalsT.BannerTypesT;\n isOpen?: boolean;\n onClose?: () => void | null;\n actionLink?: DSBannerInternalsT.ActionLinkT;\n label?: string;\n body?: string;\n showCloseButton?: boolean;\n containerProps?: Record<string, unknown>;\n actionRef?: {\n current: {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n };\n };\n }\n}\n\nexport const defaultProps: DSBannerT.Props = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.').defaultValue({}),\n label: PropTypes.string.description('Banner label.').defaultValue(''),\n body: PropTypes.string.description('Banner body content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('Banner type.').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('Callback 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 for the Action Link.')\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} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAAuE;AACvE,8BAA6B;
|
|
4
|
+
"sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { BANNER_TYPES } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\n\nexport declare namespace DSBannerT {\n export interface Props {\n type?: DSBannerInternalsT.BannerTypesT;\n isOpen?: boolean;\n onClose?: () => void | null;\n actionLink?: DSBannerInternalsT.ActionLinkT;\n label?: string;\n body?: string;\n CustomBody?: React.ComponentType<Record<string, unknown>>;\n closeBtnRef?: React.MutableRefObject<HTMLButtonElement | null> | ((ref: HTMLButtonElement | null) => void);\n showCloseButton?: boolean;\n containerProps?: Record<string, unknown>;\n actionRef?: {\n current: {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n };\n };\n }\n}\n\nexport const defaultProps: DSBannerT.Props = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.').defaultValue({}),\n label: PropTypes.string.description('Banner label.').defaultValue(''),\n body: PropTypes.string.description('Banner body content').defaultValue(''),\n CustomBody: PropTypes.func.description('Banner custom content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('Banner type.').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('Callback 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 closeBtnRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n actionLink: PropTypes.shape({\n label: PropTypes.string,\n onClick: PropTypes.func,\n href: PropTypes.string,\n })\n .description('Properties for the Action Link.')\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} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAAuE;AACvE,8BAA6B;AAwBtB,MAAM,eAAgC;AAAA,EAC3C,gBAA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require("@elliemae/ds-button");
|
|
43
43
|
var import_styleHelpers = require("./utils/styleHelpers.js");
|
|
44
44
|
var import_exported_related = require("./exported-related/index.js");
|
|
45
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
|
45
46
|
const StyledBannerContainer = (0, import_ds_system.styled)("div", {
|
|
46
47
|
name: import_exported_related.DSBannerName,
|
|
47
48
|
slot: import_exported_related.DSBannerSlots.CONTAINER
|
|
@@ -51,50 +52,46 @@ const StyledBannerContainer = (0, import_ds_system.styled)("div", {
|
|
|
51
52
|
${({ isAnimating, isOpen, height }) => (0, import_styleHelpers.handleAnimation)(isAnimating, isOpen, height)};
|
|
52
53
|
${import_ds_system.xStyledCommonProps}
|
|
53
54
|
`;
|
|
54
|
-
const StyledInnerContainer = (0, import_ds_system.styled)(
|
|
55
|
+
const StyledInnerContainer = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
55
56
|
name: import_exported_related.DSBannerName,
|
|
56
57
|
slot: import_exported_related.DSBannerSlots.INNER_CONTAINER
|
|
57
58
|
})`
|
|
58
|
-
padding-right:
|
|
59
|
-
display: grid;
|
|
60
|
-
align-items: center;
|
|
59
|
+
padding-right: 4px;
|
|
61
60
|
min-height: 41px;
|
|
62
61
|
width: 100%;
|
|
63
62
|
background-color: ${({ theme }) => theme.colors.neutral["000"]};
|
|
64
63
|
border-bottom: 5px solid ${({ type, theme }) => (0, import_styleHelpers.handleBorderColor)(type, theme)};
|
|
65
64
|
transform: translateY(${({ isOpen }) => isOpen ? "0" : "-100%"});
|
|
66
65
|
${({ isAnimating, isOpen }) => (0, import_styleHelpers.handleAnimation)(isAnimating, isOpen)};
|
|
67
|
-
&:focus {
|
|
68
|
-
position: relative;
|
|
69
|
-
&:after {
|
|
70
|
-
content: '';
|
|
71
|
-
display: block;
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: 0;
|
|
74
|
-
left: 0;
|
|
75
|
-
pointer-events: none;
|
|
76
|
-
border-radius: 2px;
|
|
77
|
-
width: calc(100%);
|
|
78
|
-
border: 2px solid #1e79c2;
|
|
79
|
-
height: calc(100% + 4px);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
grid-template-columns: auto minmax(auto, auto) minmax(auto, 1fr) auto;
|
|
83
66
|
`;
|
|
84
|
-
const StyledIconContainer = (0, import_ds_system.styled)("div", {
|
|
67
|
+
const StyledIconContainer = (0, import_ds_system.styled)("div", {
|
|
68
|
+
name: import_exported_related.DSBannerName,
|
|
69
|
+
slot: import_exported_related.DSBannerSlots.ICON_CONTAINER
|
|
70
|
+
})`
|
|
71
|
+
margin-top: ${({ height }) => height > 41 ? "6px" : "2px"};
|
|
85
72
|
margin-right: ${({ theme }) => theme.space.xxs};
|
|
86
73
|
margin-left: ${({ theme }) => theme.space.xs};
|
|
74
|
+
min-width: 0px;
|
|
87
75
|
`;
|
|
88
76
|
const StyledTitle = (0, import_ds_system.styled)("div", { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.TITLE })`
|
|
89
77
|
color: ${({ theme }) => theme.colors.neutral[700]};
|
|
90
78
|
font-size: ${({ theme }) => theme.fontSizes.label[400]};
|
|
91
79
|
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
80
|
+
margin-top: ${({ height }) => height > 41 ? "8px" : "1px"};
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
overflow-wrap: break-word;
|
|
83
|
+
white-space: pre-wrap;
|
|
84
|
+
min-width: 0px;
|
|
92
85
|
`;
|
|
93
86
|
const StyledSubTitle = (0, import_ds_system.styled)("div", { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.SUBTITLE })`
|
|
94
|
-
width: 100%;
|
|
95
87
|
margin-left: ${({ theme }) => theme.space.xs};
|
|
96
88
|
font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};
|
|
97
89
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
90
|
+
margin-top: ${({ height }) => height > 41 ? "8px" : "1px"};
|
|
91
|
+
font-size: 14px;
|
|
92
|
+
overflow-wrap: break-word;
|
|
93
|
+
white-space: pre-wrap;
|
|
94
|
+
min-width: 0px;
|
|
98
95
|
`;
|
|
99
96
|
const StyledActionLink = (0, import_ds_system.styled)("a", { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.ACTION_LINK })`
|
|
100
97
|
margin-left: ${({ theme, isBodyEmpty }) => isBodyEmpty ? theme.space.xs : 0};
|
|
@@ -107,12 +104,17 @@ const StyledActionLink = (0, import_ds_system.styled)("a", { name: import_export
|
|
|
107
104
|
border: 2px solid transparent;
|
|
108
105
|
border-radius: 2px;
|
|
109
106
|
padding: 2px 4px;
|
|
107
|
+
min-width: 0px;
|
|
110
108
|
&:focus {
|
|
111
109
|
outline: none;
|
|
112
110
|
border: 2px solid ${({ theme }) => theme.colors.brand[700]};
|
|
113
111
|
}
|
|
114
112
|
`;
|
|
115
|
-
const StyledCloseButton = (0, import_ds_system.styled)(import_ds_button.DSButtonV2, {
|
|
113
|
+
const StyledCloseButton = (0, import_ds_system.styled)(import_ds_button.DSButtonV2, {
|
|
114
|
+
name: import_exported_related.DSBannerName,
|
|
115
|
+
slot: import_exported_related.DSBannerSlots.CLOSE_BUTTON
|
|
116
|
+
})`
|
|
116
117
|
margin-left: ${({ theme }) => theme.space.xxs};
|
|
118
|
+
margin-top: ${({ height }) => height > 41 ? "5px" : "2px"};
|
|
117
119
|
`;
|
|
118
120
|
//# sourceMappingURL=styles.js.map
|
package/dist/cjs/styles.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styles.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { SizingProps, LayoutProps, SpaceProps, ColorProps } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { handleAnimation, handleBorderColor } from './utils/styleHelpers.js';\nimport { DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\nimport type {} from '@xstyled/util';\nimport type {} from '@xstyled/system';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {\n isOpen: boolean;\n isAnimating: boolean;\n height: number;\n}\n\ninterface StyledInnerContainerT {\n type: DSBannerInternalsT.BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n}\n\ninterface StyledActionLinkT {\n isBodyEmpty: string;\n}\n\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n overflow: hidden;\n height: ${({ isOpen }) => (isOpen ? 'auto' : '0px')};\n ${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};\n ${xStyledCommonProps}\n`;\n\nexport const StyledInnerContainer = styled(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAE3C,uBAA2B;AAC3B,0BAAmD;AACnD,8BAA4C;
|
|
4
|
+
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { SizingProps, LayoutProps, SpaceProps, ColorProps } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { handleAnimation, handleBorderColor } from './utils/styleHelpers.js';\nimport { DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\nimport { Grid } from '@elliemae/ds-grid';\nimport type {} from '@xstyled/util';\nimport type {} from '@xstyled/system';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {\n isOpen: boolean;\n isAnimating: boolean;\n height: number;\n}\n\ninterface StyledInnerContainerT {\n type: DSBannerInternalsT.BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n}\n\ninterface StyledIconContainerT {\n height: number;\n}\n\ninterface StyledTitleT {\n height: number;\n}\n\ninterface StyledSubTitleT {\n height: number;\n}\n\ninterface StyledActionLinkT {\n isBodyEmpty: string;\n}\n\ninterface StyledCloseButtonT {\n height: number;\n}\n\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n overflow: hidden;\n height: ${({ isOpen }) => (isOpen ? 'auto' : '0px')};\n ${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};\n ${xStyledCommonProps}\n`;\n\nexport const StyledInnerContainer = styled(Grid, {\n name: DSBannerName,\n slot: DSBannerSlots.INNER_CONTAINER,\n})<StyledInnerContainerT>`\n padding-right: 4px;\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 transform: translateY(${({ isOpen }) => (isOpen ? '0' : '-100%')});\n ${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};\n`;\n\nexport const StyledIconContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.ICON_CONTAINER,\n})<StyledIconContainerT>`\n margin-top: ${({ height }) => (height > 41 ? '6px' : '2px')};\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n min-width: 0px;\n`;\n\nexport const StyledTitle = styled('div', { name: DSBannerName, slot: DSBannerSlots.TITLE })<StyledTitleT>`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.label[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n margin-top: ${({ height }) => (height > 41 ? '8px' : '1px')};\n font-size: 14px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledSubTitle = styled('div', { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })<StyledSubTitleT>`\n margin-left: ${({ theme }) => theme.space.xs};\n font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n margin-top: ${({ height }) => (height > 41 ? '8px' : '1px')};\n font-size: 14px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledActionLink = styled('a', { name: DSBannerName, slot: DSBannerSlots.ACTION_LINK })<StyledActionLinkT>`\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 border: 2px solid transparent;\n border-radius: 2px;\n padding: 2px 4px;\n min-width: 0px;\n &:focus {\n outline: none;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n`;\nexport const StyledCloseButton = styled(DSButtonV2, {\n name: DSBannerName,\n slot: DSBannerSlots.CLOSE_BUTTON,\n})<StyledCloseButtonT>`\n margin-left: ${({ theme }) => theme.space.xxs};\n margin-top: ${({ height }) => (height > 41 ? '5px' : '2px')};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAE3C,uBAA2B;AAC3B,0BAAmD;AACnD,8BAA4C;AAE5C,qBAAqB;AAoCd,MAAM,4BAAwB,yBAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,OAAO,MAAO,SAAS,SAAS;AAAA,IAC3C,CAAC,EAAE,aAAa,QAAQ,OAAO,UAAM,qCAAgB,aAAa,QAAQ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,EAAE,OAAO,MAAO,SAAS,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOhD,MAAM,uBAAmB,yBAAO,KAAK,EAAE,MAAM,sCAAc,MAAM,sCAAc,YAAY,CAAC;AAAA,iBAClF,CAAC,EAAE,OAAO,YAAY,MAAO,cAAc,MAAM,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA,eAI9D,CAAC,EAAE,MAAM,MAAM,MAAM,UAAU,UAAU,GAAG;AAAA,iBAC1C,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY;AAAA,WACvC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAOxB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAGtD,MAAM,wBAAoB,yBAAO,6BAAY;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA,iBACgB,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM;AAAA,gBAC5B,CAAC,EAAE,OAAO,MAAO,SAAS,KAAK,QAAQ;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSBanner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useLayoutEffect, useRef, useCallback, useState, useEffect } from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React2, { useLayoutEffect, useRef, useCallback, useState, useEffect } from "react";
|
|
4
4
|
import {
|
|
5
5
|
describe,
|
|
6
6
|
useMemoMergePropsWithDefault,
|
|
@@ -22,7 +22,20 @@ import {
|
|
|
22
22
|
} from "./styles.js";
|
|
23
23
|
const DSBanner = (props) => {
|
|
24
24
|
const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);
|
|
25
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
type,
|
|
27
|
+
isOpen,
|
|
28
|
+
onClose,
|
|
29
|
+
label,
|
|
30
|
+
body,
|
|
31
|
+
closeBtnRef,
|
|
32
|
+
CustomBody,
|
|
33
|
+
actionLink,
|
|
34
|
+
showCloseButton,
|
|
35
|
+
containerProps,
|
|
36
|
+
actionRef,
|
|
37
|
+
...rest
|
|
38
|
+
} = propsWithDefaults;
|
|
26
39
|
const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);
|
|
27
40
|
const xstyledAttrs = useGetXstyledProps(rest);
|
|
28
41
|
const innerContainerRef = useRef(null);
|
|
@@ -63,12 +76,30 @@ const DSBanner = (props) => {
|
|
|
63
76
|
linkRef.current.click();
|
|
64
77
|
}
|
|
65
78
|
}, []);
|
|
79
|
+
const handleOnKeyDownToClose = useCallback(
|
|
80
|
+
(e) => {
|
|
81
|
+
if (e.key === "Escape") {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
onClose();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
[onClose]
|
|
87
|
+
);
|
|
66
88
|
useLayoutEffect(() => {
|
|
67
89
|
if (isOpen !== current || isOpen)
|
|
68
90
|
setIsAnimating(true);
|
|
69
91
|
else
|
|
70
92
|
setIsAnimating(false);
|
|
71
93
|
}, [isOpen, current]);
|
|
94
|
+
const innerCols = React2.useMemo(() => {
|
|
95
|
+
if (!CustomBody) {
|
|
96
|
+
const finalCols = ["auto", "fit-content(50%)", "1fr"];
|
|
97
|
+
if (showCloseButton)
|
|
98
|
+
finalCols.push("auto");
|
|
99
|
+
return finalCols;
|
|
100
|
+
}
|
|
101
|
+
return ["1fr", "auto"];
|
|
102
|
+
}, [CustomBody, showCloseButton]);
|
|
72
103
|
if (!isAnimating && !isOpen)
|
|
73
104
|
return null;
|
|
74
105
|
return /* @__PURE__ */ jsx(
|
|
@@ -76,15 +107,19 @@ const DSBanner = (props) => {
|
|
|
76
107
|
{
|
|
77
108
|
isOpen,
|
|
78
109
|
height,
|
|
110
|
+
onKeyDown: handleOnKeyDownToClose,
|
|
79
111
|
isAnimating,
|
|
80
112
|
onAnimationEnd: () => setCurrent(isOpen),
|
|
81
113
|
"data-testid": DSBannerDatatestid.CONTAINER,
|
|
82
114
|
...containerProps,
|
|
83
115
|
...globalAttrs,
|
|
84
116
|
...xstyledAttrs,
|
|
85
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ jsx(
|
|
86
118
|
StyledInnerContainer,
|
|
87
119
|
{
|
|
120
|
+
cols: innerCols,
|
|
121
|
+
justifyItems: CustomBody ? "center" : "",
|
|
122
|
+
alignItems: height === 41 ? "center" : "flex-start",
|
|
88
123
|
type,
|
|
89
124
|
isOpen,
|
|
90
125
|
ref: innerContainerRef,
|
|
@@ -93,10 +128,10 @@ const DSBanner = (props) => {
|
|
|
93
128
|
role: "alert",
|
|
94
129
|
tabIndex: alertTabIndex,
|
|
95
130
|
onBlur: handleBlur,
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ jsx(StyledIconContainer, { "data-testid": DSBannerDatatestid.ICON_CONTAINER, children: icons[type] }),
|
|
98
|
-
/* @__PURE__ */ jsx(StyledTitle, { children: label }),
|
|
99
|
-
/* @__PURE__ */ jsxs(StyledSubTitle, { children: [
|
|
131
|
+
children: !CustomBody ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(StyledIconContainer, { height, "data-testid": DSBannerDatatestid.ICON_CONTAINER, children: icons[type] }),
|
|
133
|
+
/* @__PURE__ */ jsx(StyledTitle, { height, children: label }),
|
|
134
|
+
/* @__PURE__ */ jsxs(StyledSubTitle, { height, children: [
|
|
100
135
|
/* @__PURE__ */ jsx("span", { children: body }),
|
|
101
136
|
actionLink && /* @__PURE__ */ jsx(
|
|
102
137
|
StyledActionLink,
|
|
@@ -117,12 +152,14 @@ const DSBanner = (props) => {
|
|
|
117
152
|
{
|
|
118
153
|
"data-testid": DSBannerDatatestid.CLOSE_BUTTON,
|
|
119
154
|
buttonType: "icon",
|
|
155
|
+
height,
|
|
156
|
+
innerRef: closeBtnRef,
|
|
120
157
|
onClick: onClose,
|
|
121
158
|
"aria-label": "Close icon",
|
|
122
159
|
children: /* @__PURE__ */ jsx(CloseX, { width: 12, height: 12 })
|
|
123
160
|
}
|
|
124
|
-
) :
|
|
125
|
-
]
|
|
161
|
+
) : null
|
|
162
|
+
] }) : /* @__PURE__ */ jsx(CustomBody, {})
|
|
126
163
|
}
|
|
127
164
|
)
|
|
128
165
|
}
|
package/dist/esm/DSBanner.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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, useEffect } from 'react';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { icons } from './utils/icons.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n\n const {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": []
|
|
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-props-helpers';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { icons } from './utils/icons.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);\n\n const {\n type,\n isOpen,\n onClose,\n label,\n body,\n closeBtnRef,\n CustomBody,\n actionLink,\n showCloseButton,\n containerProps,\n actionRef,\n ...rest\n } = propsWithDefaults;\n // eslint-disable-next-line no-unused-vars\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 const handleOnKeyDownToClose = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClose();\n }\n },\n [onClose],\n );\n\n useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n const innerCols = React.useMemo(() => {\n if (!CustomBody) {\n const finalCols = ['auto', 'fit-content(50%)', '1fr'];\n if (showCloseButton) finalCols.push('auto');\n return finalCols;\n }\n return ['1fr', 'auto'];\n }, [CustomBody, showCloseButton]);\n\n if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n isOpen={isOpen}\n height={height}\n onKeyDown={handleOnKeyDownToClose}\n isAnimating={isAnimating}\n onAnimationEnd={() => setCurrent(isOpen)}\n data-testid={DSBannerDatatestid.CONTAINER}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n <StyledInnerContainer\n cols={innerCols}\n justifyItems={CustomBody ? 'center' : ''}\n alignItems={height === 41 ? 'center' : 'flex-start'}\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 {!CustomBody ? (\n <>\n <StyledIconContainer height={height} data-testid={DSBannerDatatestid.ICON_CONTAINER}>\n {icons[type]}\n </StyledIconContainer>\n <StyledTitle height={height}>{label}</StyledTitle>\n <StyledSubTitle height={height}>\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 height={height}\n innerRef={closeBtnRef}\n onClick={onClose}\n aria-label=\"Close icon\"\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </>\n ) : (\n <CustomBody />\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;AC2Ib,mBACE,KAIA,YALF;AA1IV,OAAOA,UAAS,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;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,QAAQ,cAAc,GAAG,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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;AAAA,gBACA,UAAU;AAAA,gBACV,SAAS;AAAA,gBACT,cAAW;AAAA,gBAEX,8BAAC,UAAO,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,YACjC,IACE;AAAA,aACN,IAEA,oBAAC,cAAW;AAAA;AAAA,MAEhB;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/DSBannerDatatestid.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSBannerDatatestid = {\n CONTAINER: 'ds-banner-container',\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n ACTION_LINK: 'ds-banner-action-link',\n CLOSE_BUTTON: 'ds-banner-close-button',\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSBannerDatatestid = {\n CONTAINER: 'ds-banner-container',\n CUSTOM_CONTAINER: 'ds-banner-custom-container',\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n ACTION_LINK: 'ds-banner-action-link',\n CLOSE_BUTTON: 'ds-banner-close-button',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;AAAA,EAChC,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/theming.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSBannerName = 'DSBanner';\n\nexport const DSBannerSlots = {\n CONTAINER: 'root',\n INNER_CONTAINER: 'inner-container',\n TITLE: 'title',\n SUBTITLE: 'subtitle',\n ICON_CONTAINER: 'icon-container',\n ACTION_LINK: 'action-link',\n CLOSE_BUTTON: 'close-button',\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,eAAe;AAErB,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSBannerName = 'DSBanner';\n\nexport const DSBannerSlots = {\n CONTAINER: 'root',\n INNER_CONTAINER: 'inner-container',\n CUSTOM_CONTAINER: 'custom-container',\n TITLE: 'title',\n SUBTITLE: 'subtitle',\n ICON_CONTAINER: 'icon-container',\n ACTION_LINK: 'action-link',\n CLOSE_BUTTON: 'close-button',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,eAAe;AAErB,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,10 +16,12 @@ const propTypes = {
|
|
|
16
16
|
containerProps: PropTypes.object.description("Set of Properties attached to the main container.").defaultValue({}),
|
|
17
17
|
label: PropTypes.string.description("Banner label.").defaultValue(""),
|
|
18
18
|
body: PropTypes.string.description("Banner body content").defaultValue(""),
|
|
19
|
+
CustomBody: PropTypes.func.description("Banner custom content").defaultValue(""),
|
|
19
20
|
type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description("Banner type.").defaultValue(BANNER_TYPES.INFO),
|
|
20
21
|
onClose: PropTypes.func.description("Callback when the Banner closes."),
|
|
21
22
|
isOpen: PropTypes.bool.description("Whether the Banner is open or closed.").defaultValue(true),
|
|
22
23
|
showCloseButton: PropTypes.bool.description("Whether to show close button or not.").defaultValue(true),
|
|
24
|
+
closeBtnRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description("Inner ref to button component."),
|
|
23
25
|
actionLink: PropTypes.shape({
|
|
24
26
|
label: PropTypes.string,
|
|
25
27
|
onClick: PropTypes.func,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { BANNER_TYPES } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\n\nexport declare namespace DSBannerT {\n export interface Props {\n type?: DSBannerInternalsT.BannerTypesT;\n isOpen?: boolean;\n onClose?: () => void | null;\n actionLink?: DSBannerInternalsT.ActionLinkT;\n label?: string;\n body?: string;\n showCloseButton?: boolean;\n containerProps?: Record<string, unknown>;\n actionRef?: {\n current: {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n };\n };\n }\n}\n\nexport const defaultProps: DSBannerT.Props = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.').defaultValue({}),\n label: PropTypes.string.description('Banner label.').defaultValue(''),\n body: PropTypes.string.description('Banner body content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('Banner type.').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('Callback 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 for the Action Link.')\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} as WeakValidationMap<unknown>;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { BANNER_TYPES } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\n\nexport declare namespace DSBannerT {\n export interface Props {\n type?: DSBannerInternalsT.BannerTypesT;\n isOpen?: boolean;\n onClose?: () => void | null;\n actionLink?: DSBannerInternalsT.ActionLinkT;\n label?: string;\n body?: string;\n CustomBody?: React.ComponentType<Record<string, unknown>>;\n closeBtnRef?: React.MutableRefObject<HTMLButtonElement | null> | ((ref: HTMLButtonElement | null) => void);\n showCloseButton?: boolean;\n containerProps?: Record<string, unknown>;\n actionRef?: {\n current: {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n };\n };\n }\n}\n\nexport const defaultProps: DSBannerT.Props = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.').defaultValue({}),\n label: PropTypes.string.description('Banner label.').defaultValue(''),\n body: PropTypes.string.description('Banner body content').defaultValue(''),\n CustomBody: PropTypes.func.description('Banner custom content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('Banner type.').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('Callback 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 closeBtnRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n actionLink: PropTypes.shape({\n label: PropTypes.string,\n onClick: PropTypes.func,\n href: PropTypes.string,\n })\n .description('Properties for the Action Link.')\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} as WeakValidationMap<unknown>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE,SAAS,oBAAoB;AAwBtB,MAAM,eAAgC;AAAA,EAC3C,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM,aAAa;AAAA,EACnB,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AACnB;AAEO,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,gBAAgB,UAAU,OAAO,YAAY,mDAAmD,EAAE,aAAa,CAAC,CAAC;AAAA,EACjH,OAAO,UAAU,OAAO,YAAY,eAAe,EAAE,aAAa,EAAE;AAAA,EACpE,MAAM,UAAU,OAAO,YAAY,qBAAqB,EAAE,aAAa,EAAE;AAAA,EACzE,YAAY,UAAU,KAAK,YAAY,uBAAuB,EAAE,aAAa,EAAE;AAAA,EAC/E,MAAM,UAAU,MAAM,OAAO,OAAO,YAAY,CAAC,EAAE,YAAY,cAAc,EAAE,aAAa,aAAa,IAAI;AAAA,EAC7G,SAAS,UAAU,KAAK,YAAY,kCAAkC;AAAA,EACtE,QAAQ,UAAU,KAAK,YAAY,uCAAuC,EAAE,aAAa,IAAI;AAAA,EAC7F,iBAAiB,UAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,IAAI;AAAA,EACrG,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAAA,EACjH,YAAY,UAAU,MAAM;AAAA,IAC1B,OAAO,UAAU;AAAA,IACjB,SAAS,UAAU;AAAA,IACnB,MAAM,UAAU;AAAA,EAClB,CAAC,EACE,YAAY,iCAAiC,EAC7C,aAAa,CAAC,CAAC;AAAA,EAClB,WAAW,UAAU,OAClB;AAAA,IACC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,aAAa,CAAC,CAAC;AACpB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -3,6 +3,7 @@ import { styled, xStyledCommonProps } from "@elliemae/ds-system";
|
|
|
3
3
|
import { DSButtonV2 } from "@elliemae/ds-button";
|
|
4
4
|
import { handleAnimation, handleBorderColor } from "./utils/styleHelpers.js";
|
|
5
5
|
import { DSBannerName, DSBannerSlots } from "./exported-related/index.js";
|
|
6
|
+
import { Grid } from "@elliemae/ds-grid";
|
|
6
7
|
const StyledBannerContainer = styled("div", {
|
|
7
8
|
name: DSBannerName,
|
|
8
9
|
slot: DSBannerSlots.CONTAINER
|
|
@@ -12,50 +13,46 @@ const StyledBannerContainer = styled("div", {
|
|
|
12
13
|
${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};
|
|
13
14
|
${xStyledCommonProps}
|
|
14
15
|
`;
|
|
15
|
-
const StyledInnerContainer = styled(
|
|
16
|
+
const StyledInnerContainer = styled(Grid, {
|
|
16
17
|
name: DSBannerName,
|
|
17
18
|
slot: DSBannerSlots.INNER_CONTAINER
|
|
18
19
|
})`
|
|
19
|
-
padding-right:
|
|
20
|
-
display: grid;
|
|
21
|
-
align-items: center;
|
|
20
|
+
padding-right: 4px;
|
|
22
21
|
min-height: 41px;
|
|
23
22
|
width: 100%;
|
|
24
23
|
background-color: ${({ theme }) => theme.colors.neutral["000"]};
|
|
25
24
|
border-bottom: 5px solid ${({ type, theme }) => handleBorderColor(type, theme)};
|
|
26
25
|
transform: translateY(${({ isOpen }) => isOpen ? "0" : "-100%"});
|
|
27
26
|
${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};
|
|
28
|
-
&:focus {
|
|
29
|
-
position: relative;
|
|
30
|
-
&:after {
|
|
31
|
-
content: '';
|
|
32
|
-
display: block;
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: 0;
|
|
35
|
-
left: 0;
|
|
36
|
-
pointer-events: none;
|
|
37
|
-
border-radius: 2px;
|
|
38
|
-
width: calc(100%);
|
|
39
|
-
border: 2px solid #1e79c2;
|
|
40
|
-
height: calc(100% + 4px);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
grid-template-columns: auto minmax(auto, auto) minmax(auto, 1fr) auto;
|
|
44
27
|
`;
|
|
45
|
-
const StyledIconContainer = styled("div", {
|
|
28
|
+
const StyledIconContainer = styled("div", {
|
|
29
|
+
name: DSBannerName,
|
|
30
|
+
slot: DSBannerSlots.ICON_CONTAINER
|
|
31
|
+
})`
|
|
32
|
+
margin-top: ${({ height }) => height > 41 ? "6px" : "2px"};
|
|
46
33
|
margin-right: ${({ theme }) => theme.space.xxs};
|
|
47
34
|
margin-left: ${({ theme }) => theme.space.xs};
|
|
35
|
+
min-width: 0px;
|
|
48
36
|
`;
|
|
49
37
|
const StyledTitle = styled("div", { name: DSBannerName, slot: DSBannerSlots.TITLE })`
|
|
50
38
|
color: ${({ theme }) => theme.colors.neutral[700]};
|
|
51
39
|
font-size: ${({ theme }) => theme.fontSizes.label[400]};
|
|
52
40
|
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
41
|
+
margin-top: ${({ height }) => height > 41 ? "8px" : "1px"};
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
overflow-wrap: break-word;
|
|
44
|
+
white-space: pre-wrap;
|
|
45
|
+
min-width: 0px;
|
|
53
46
|
`;
|
|
54
47
|
const StyledSubTitle = styled("div", { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })`
|
|
55
|
-
width: 100%;
|
|
56
48
|
margin-left: ${({ theme }) => theme.space.xs};
|
|
57
49
|
font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};
|
|
58
50
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
51
|
+
margin-top: ${({ height }) => height > 41 ? "8px" : "1px"};
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
overflow-wrap: break-word;
|
|
54
|
+
white-space: pre-wrap;
|
|
55
|
+
min-width: 0px;
|
|
59
56
|
`;
|
|
60
57
|
const StyledActionLink = styled("a", { name: DSBannerName, slot: DSBannerSlots.ACTION_LINK })`
|
|
61
58
|
margin-left: ${({ theme, isBodyEmpty }) => isBodyEmpty ? theme.space.xs : 0};
|
|
@@ -68,13 +65,18 @@ const StyledActionLink = styled("a", { name: DSBannerName, slot: DSBannerSlots.A
|
|
|
68
65
|
border: 2px solid transparent;
|
|
69
66
|
border-radius: 2px;
|
|
70
67
|
padding: 2px 4px;
|
|
68
|
+
min-width: 0px;
|
|
71
69
|
&:focus {
|
|
72
70
|
outline: none;
|
|
73
71
|
border: 2px solid ${({ theme }) => theme.colors.brand[700]};
|
|
74
72
|
}
|
|
75
73
|
`;
|
|
76
|
-
const StyledCloseButton = styled(DSButtonV2, {
|
|
74
|
+
const StyledCloseButton = styled(DSButtonV2, {
|
|
75
|
+
name: DSBannerName,
|
|
76
|
+
slot: DSBannerSlots.CLOSE_BUTTON
|
|
77
|
+
})`
|
|
77
78
|
margin-left: ${({ theme }) => theme.space.xxs};
|
|
79
|
+
margin-top: ${({ height }) => height > 41 ? "5px" : "2px"};
|
|
78
80
|
`;
|
|
79
81
|
export {
|
|
80
82
|
StyledActionLink,
|
package/dist/esm/styles.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { SizingProps, LayoutProps, SpaceProps, ColorProps } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { handleAnimation, handleBorderColor } from './utils/styleHelpers.js';\nimport { DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\nimport type {} from '@xstyled/util';\nimport type {} from '@xstyled/system';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {\n isOpen: boolean;\n isAnimating: boolean;\n height: number;\n}\n\ninterface StyledInnerContainerT {\n type: DSBannerInternalsT.BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n}\n\ninterface StyledActionLinkT {\n isBodyEmpty: string;\n}\n\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n overflow: hidden;\n height: ${({ isOpen }) => (isOpen ? 'auto' : '0px')};\n ${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};\n ${xStyledCommonProps}\n`;\n\nexport const StyledInnerContainer = styled(
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,0BAA0B;AAE3C,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,cAAc,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type { SizingProps, LayoutProps, SpaceProps, ColorProps } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { handleAnimation, handleBorderColor } from './utils/styleHelpers.js';\nimport { DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerInternalsT } from './sharedTypes.js';\nimport { Grid } from '@elliemae/ds-grid';\nimport type {} from '@xstyled/util';\nimport type {} from '@xstyled/system';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {\n isOpen: boolean;\n isAnimating: boolean;\n height: number;\n}\n\ninterface StyledInnerContainerT {\n type: DSBannerInternalsT.BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n}\n\ninterface StyledIconContainerT {\n height: number;\n}\n\ninterface StyledTitleT {\n height: number;\n}\n\ninterface StyledSubTitleT {\n height: number;\n}\n\ninterface StyledActionLinkT {\n isBodyEmpty: string;\n}\n\ninterface StyledCloseButtonT {\n height: number;\n}\n\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n overflow: hidden;\n height: ${({ isOpen }) => (isOpen ? 'auto' : '0px')};\n ${({ isAnimating, isOpen, height }) => handleAnimation(isAnimating, isOpen, height)};\n ${xStyledCommonProps}\n`;\n\nexport const StyledInnerContainer = styled(Grid, {\n name: DSBannerName,\n slot: DSBannerSlots.INNER_CONTAINER,\n})<StyledInnerContainerT>`\n padding-right: 4px;\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 transform: translateY(${({ isOpen }) => (isOpen ? '0' : '-100%')});\n ${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};\n`;\n\nexport const StyledIconContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.ICON_CONTAINER,\n})<StyledIconContainerT>`\n margin-top: ${({ height }) => (height > 41 ? '6px' : '2px')};\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n min-width: 0px;\n`;\n\nexport const StyledTitle = styled('div', { name: DSBannerName, slot: DSBannerSlots.TITLE })<StyledTitleT>`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.label[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n margin-top: ${({ height }) => (height > 41 ? '8px' : '1px')};\n font-size: 14px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledSubTitle = styled('div', { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })<StyledSubTitleT>`\n margin-left: ${({ theme }) => theme.space.xs};\n font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n margin-top: ${({ height }) => (height > 41 ? '8px' : '1px')};\n font-size: 14px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledActionLink = styled('a', { name: DSBannerName, slot: DSBannerSlots.ACTION_LINK })<StyledActionLinkT>`\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 border: 2px solid transparent;\n border-radius: 2px;\n padding: 2px 4px;\n min-width: 0px;\n &:focus {\n outline: none;\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n }\n`;\nexport const StyledCloseButton = styled(DSButtonV2, {\n name: DSBannerName,\n slot: DSBannerSlots.CLOSE_BUTTON,\n})<StyledCloseButtonT>`\n margin-left: ${({ theme }) => theme.space.xxs};\n margin-top: ${({ height }) => (height > 41 ? '5px' : '2px')};\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,0BAA0B;AAE3C,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,cAAc,qBAAqB;AAE5C,SAAS,YAAY;AAoCd,MAAM,wBAAwB,OAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA,YAEW,CAAC,EAAE,OAAO,MAAO,SAAS,SAAS;AAAA,IAC3C,CAAC,EAAE,aAAa,QAAQ,OAAO,MAAM,gBAAgB,aAAa,QAAQ,MAAM;AAAA,IAChF;AAAA;AAGG,MAAM,uBAAuB,OAAO,MAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA,sBAIqB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK;AAAA,6BAClC,CAAC,EAAE,MAAM,MAAM,MAAM,kBAAkB,MAAM,KAAK;AAAA,0BACrD,CAAC,EAAE,OAAO,MAAO,SAAS,MAAM;AAAA,IACtD,CAAC,EAAE,aAAa,OAAO,MAAM,gBAAgB,aAAa,MAAM;AAAA;AAG7D,MAAM,sBAAsB,OAAO,OAAO;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA,gBACe,CAAC,EAAE,OAAO,MAAO,SAAS,KAAK,QAAQ;AAAA,kBACrC,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM;AAAA,iBAC5B,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM;AAAA;AAAA;AAIrC,MAAM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AC5B,CAAC,EAAE,OAAO,MAAO,SAAS,KAAK,QAAQ;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,6 +8,8 @@ export declare namespace DSBannerT {
|
|
|
8
8
|
actionLink?: DSBannerInternalsT.ActionLinkT;
|
|
9
9
|
label?: string;
|
|
10
10
|
body?: string;
|
|
11
|
+
CustomBody?: React.ComponentType<Record<string, unknown>>;
|
|
12
|
+
closeBtnRef?: React.MutableRefObject<HTMLButtonElement | null> | ((ref: HTMLButtonElement | null) => void);
|
|
11
13
|
showCloseButton?: boolean;
|
|
12
14
|
containerProps?: Record<string, unknown>;
|
|
13
15
|
actionRef?: {
|
package/dist/types/styles.d.ts
CHANGED
|
@@ -11,14 +11,26 @@ interface StyledInnerContainerT {
|
|
|
11
11
|
isOpen: boolean;
|
|
12
12
|
isAnimating: boolean;
|
|
13
13
|
}
|
|
14
|
+
interface StyledIconContainerT {
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
interface StyledTitleT {
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
interface StyledSubTitleT {
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
14
23
|
interface StyledActionLinkT {
|
|
15
24
|
isBodyEmpty: string;
|
|
16
25
|
}
|
|
26
|
+
interface StyledCloseButtonT {
|
|
27
|
+
height: number;
|
|
28
|
+
}
|
|
17
29
|
export declare const StyledBannerContainer: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledBannerContainerT, never>;
|
|
18
|
-
export declare const StyledInnerContainer: import("styled-components").StyledComponent<"
|
|
19
|
-
export declare const StyledIconContainer: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme,
|
|
20
|
-
export declare const StyledTitle: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme,
|
|
21
|
-
export declare const StyledSubTitle: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme,
|
|
30
|
+
export declare const StyledInnerContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/dist/types/react-desc-prop-types.js").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, StyledInnerContainerT, never>;
|
|
31
|
+
export declare const StyledIconContainer: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledIconContainerT, never>;
|
|
32
|
+
export declare const StyledTitle: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledTitleT, never>;
|
|
33
|
+
export declare const StyledSubTitle: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, StyledSubTitleT, never>;
|
|
22
34
|
export declare const StyledActionLink: import("styled-components").StyledComponent<"a", import("@elliemae/ds-system").Theme, StyledActionLinkT, never>;
|
|
23
|
-
export declare const StyledCloseButton: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-button").DSButtonT.Props>, import("@elliemae/ds-system").Theme,
|
|
35
|
+
export declare const StyledCloseButton: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-button").DSButtonT.Props>, import("@elliemae/ds-system").Theme, StyledCloseButtonT, never>;
|
|
24
36
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-banner",
|
|
3
|
-
"version": "3.17.0-next.
|
|
3
|
+
"version": "3.17.0-next.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Banner",
|
|
6
6
|
"files": [
|
|
@@ -63,16 +63,19 @@
|
|
|
63
63
|
"indent": 4
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@elliemae/ds-
|
|
69
|
-
"@elliemae/ds-
|
|
70
|
-
"@elliemae/ds-
|
|
66
|
+
"@xstyled/system": "~3.7.3",
|
|
67
|
+
"@xstyled/util": "3.7.0",
|
|
68
|
+
"@elliemae/ds-button": "3.17.0-next.20",
|
|
69
|
+
"@elliemae/ds-props-helpers": "3.17.0-next.20",
|
|
70
|
+
"@elliemae/ds-grid": "3.17.0-next.20",
|
|
71
|
+
"@elliemae/ds-system": "3.17.0-next.20",
|
|
72
|
+
"@elliemae/ds-icons": "3.17.0-next.20"
|
|
71
73
|
},
|
|
72
74
|
"devDependencies": {
|
|
73
75
|
"@testing-library/jest-dom": "~5.16.5",
|
|
74
76
|
"@testing-library/react": "~12.1.3",
|
|
75
77
|
"@testing-library/user-event": "~13.5.0",
|
|
78
|
+
"jest-axe": "^7.0.1",
|
|
76
79
|
"styled-components": "~5.3.9"
|
|
77
80
|
},
|
|
78
81
|
"peerDependencies": {
|