@elliemae/ds-banner 3.53.0-alpha.2 → 3.53.0-alpha.4
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 +24 -11
- package/dist/cjs/DSBanner.js.map +2 -2
- package/dist/cjs/exported-related/index.js +2 -1
- package/dist/cjs/exported-related/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +4 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styles.js +13 -13
- package/dist/cjs/styles.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-banner-valid.js +8 -4
- package/dist/cjs/typescript-testing/typescript-banner-valid.js.map +2 -2
- package/dist/esm/DSBanner.js +31 -12
- package/dist/esm/DSBanner.js.map +2 -2
- package/dist/esm/exported-related/index.js +2 -1
- package/dist/esm/exported-related/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +4 -2
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styles.js +13 -13
- package/dist/esm/styles.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-banner-valid.js +8 -4
- package/dist/esm/typescript-testing/typescript-banner-valid.js.map +2 -2
- package/dist/types/exported-related/index.d.ts +2 -0
- package/dist/types/react-desc-prop-types.d.ts +2 -1
- package/dist/types/styles.d.ts +1 -0
- package/package.json +9 -9
package/dist/cjs/DSBanner.js
CHANGED
|
@@ -48,19 +48,28 @@ var import_styles = require("./styles.js");
|
|
|
48
48
|
const outOfTheBoxCols = ["auto", "fit-content(50%)", "1fr"];
|
|
49
49
|
const outOfTheBoxColsSmallLayout = ["auto", "1fr"];
|
|
50
50
|
const colsWithCustomBody = ["1fr", "auto"];
|
|
51
|
+
const typeMap = {
|
|
52
|
+
alert: void 0,
|
|
53
|
+
polite: "polite",
|
|
54
|
+
assertive: "assertive",
|
|
55
|
+
none: "off"
|
|
56
|
+
};
|
|
57
|
+
const getIsLiveRegion = (type) => type === "polite" || type === "assertive";
|
|
51
58
|
const LiveRegionCorrectlyImplemented = ({
|
|
52
59
|
id,
|
|
53
60
|
innerRef,
|
|
54
|
-
announcementType
|
|
61
|
+
announcementType,
|
|
62
|
+
ownerPropsConfig
|
|
55
63
|
}) => import_react_dom.default.createPortal(
|
|
56
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
-
|
|
65
|
+
import_styles.StyledLiveRegionPortal,
|
|
58
66
|
{
|
|
59
67
|
id,
|
|
60
|
-
|
|
68
|
+
innerRef,
|
|
61
69
|
"aria-atomic": "true",
|
|
62
|
-
"aria-live": announcementType,
|
|
63
|
-
|
|
70
|
+
"aria-live": typeMap[announcementType],
|
|
71
|
+
"data-testid": import_exported_related.DSBannerDatatestid.LIVE_REGION_PORTAL,
|
|
72
|
+
...ownerPropsConfig
|
|
64
73
|
}
|
|
65
74
|
),
|
|
66
75
|
document.body
|
|
@@ -80,6 +89,7 @@ const DSBanner = (props) => {
|
|
|
80
89
|
containerProps,
|
|
81
90
|
actionRef,
|
|
82
91
|
withLiveRegionAnnouncement,
|
|
92
|
+
isPageNotice,
|
|
83
93
|
...rest
|
|
84
94
|
} = propsWithDefaults;
|
|
85
95
|
const { height: globalHeight, ...globalAttrs } = (0, import_ds_props_helpers.useGetGlobalAttributes)(rest);
|
|
@@ -127,15 +137,16 @@ const DSBanner = (props) => {
|
|
|
127
137
|
}
|
|
128
138
|
}, []);
|
|
129
139
|
(0, import_react.useEffect)(() => {
|
|
130
|
-
if (isOpen && withLiveRegionAnnouncement) read();
|
|
140
|
+
if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();
|
|
131
141
|
}, [isOpen, withLiveRegionAnnouncement, read]);
|
|
132
142
|
if (!isOpen)
|
|
133
|
-
return withLiveRegionAnnouncement ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
|
+
return getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
144
|
LiveRegionCorrectlyImplemented,
|
|
135
145
|
{
|
|
136
146
|
id: `${generatedContainerId}-live-region`,
|
|
137
147
|
innerRef: liveRegionRef,
|
|
138
|
-
announcementType: withLiveRegionAnnouncement
|
|
148
|
+
announcementType: withLiveRegionAnnouncement,
|
|
149
|
+
ownerPropsConfig
|
|
139
150
|
}
|
|
140
151
|
) : null;
|
|
141
152
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -145,6 +156,7 @@ const DSBanner = (props) => {
|
|
|
145
156
|
"data-testid": import_exported_related.DSBannerDatatestid.CONTAINER,
|
|
146
157
|
innerRef: handleActionRefForContainer,
|
|
147
158
|
tabIndex: -1,
|
|
159
|
+
role: isPageNotice ? "region" : void 0,
|
|
148
160
|
...containerProps,
|
|
149
161
|
...globalAttrs,
|
|
150
162
|
...xstyledAttrs,
|
|
@@ -157,7 +169,7 @@ const DSBanner = (props) => {
|
|
|
157
169
|
cols: innerContainerCols,
|
|
158
170
|
"data-type": type,
|
|
159
171
|
"data-testid": import_exported_related.DSBannerDatatestid.INNER_CONTAINER,
|
|
160
|
-
role:
|
|
172
|
+
role: withLiveRegionAnnouncement === "alert" ? "alert" : void 0,
|
|
161
173
|
id: generatedContainerId,
|
|
162
174
|
...ownerPropsConfig,
|
|
163
175
|
children: !CustomBody ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSBannerContent.DSBannerContent, { propsWithDefaults }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomBody, {})
|
|
@@ -177,12 +189,13 @@ const DSBanner = (props) => {
|
|
|
177
189
|
}
|
|
178
190
|
) : null
|
|
179
191
|
] }),
|
|
180
|
-
withLiveRegionAnnouncement ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
192
|
+
getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
193
|
LiveRegionCorrectlyImplemented,
|
|
182
194
|
{
|
|
183
195
|
id: `${generatedContainerId}-live-region`,
|
|
184
196
|
innerRef: liveRegionRef,
|
|
185
|
-
announcementType: withLiveRegionAnnouncement
|
|
197
|
+
announcementType: withLiveRegionAnnouncement,
|
|
198
|
+
ownerPropsConfig
|
|
186
199
|
}
|
|
187
200
|
) : null
|
|
188
201
|
]
|
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": ["import { CloseX } from '@elliemae/ds-icons';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { uid } from 'uid';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport { DSBannerContent } from './DSBannerContent.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBannerPropTypesSchema } from './react-desc-prop-types.js';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { CloseX } from '@elliemae/ds-icons';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { uid } from 'uid';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport { DSBannerContent } from './DSBannerContent.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBannerPropTypesSchema } from './react-desc-prop-types.js';\nimport {\n StyledLiveRegionPortal,\n StyledBannerContainer,\n StyledBannerLayout,\n StyledCloseButton,\n StyledInnerContainer,\n} from './styles.js';\n\nconst outOfTheBoxCols = ['auto', 'fit-content(50%)', '1fr'];\nconst outOfTheBoxColsSmallLayout = ['auto', '1fr'];\nconst colsWithCustomBody = ['1fr', 'auto'];\nconst typeMap = {\n alert: undefined,\n polite: 'polite',\n assertive: 'assertive',\n none: 'off',\n} as const;\n\nconst getIsLiveRegion = (type: string) => type === 'polite' || type === 'assertive';\n\nconst LiveRegionCorrectlyImplemented = ({\n id,\n innerRef,\n announcementType,\n ownerPropsConfig,\n}: {\n id: string;\n innerRef: React.Ref<HTMLDivElement>;\n announcementType: 'alert' | 'polite' | 'assertive' | 'none';\n ownerPropsConfig: Record<string, unknown>;\n}) =>\n ReactDOM.createPortal(\n <StyledLiveRegionPortal\n id={id}\n innerRef={innerRef}\n aria-atomic=\"true\"\n // off is never going to be printed because this portal is not printed when announcement is none\n // the off is just a quick hack to circumvent typescript typechecks in the static building\n aria-live={typeMap[announcementType]}\n data-testid={DSBannerDatatestid.LIVE_REGION_PORTAL}\n {...ownerPropsConfig}\n />,\n document.body,\n );\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSBannerT.InternalProps>(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 withLiveRegionAnnouncement,\n isPageNotice,\n ...rest\n } = propsWithDefaults;\n // eslint-disable-next-line no-unused-vars\n const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);\n const ownerPropsConfig = useOwnerProps(propsWithDefaults, { ...props });\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const layoutMode = useGetLayoutMode();\n const isSmall = layoutMode === 's' || layoutMode === 'xs';\n const innerContainerCols = useMemo(() => {\n if (CustomBody) return colsWithCustomBody;\n return isSmall ? outOfTheBoxColsSmallLayout : outOfTheBoxCols;\n }, [CustomBody, isSmall]);\n\n const handleActionRefForContainer = useCallback<React.RefCallback<HTMLDivElement>>(\n (containerNode) => {\n if (containerNode && actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (containerNode) {\n setTimeout(() => {\n containerNode?.focus();\n }, 300);\n }\n };\n }\n },\n [actionRef],\n );\n\n const generatedContainerId = useMemo(() => `ds-banner-${uid(5)}`, []);\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 const liveRegionRef = React.useRef<HTMLDivElement>(null);\n const isOpenRef = React.useRef(isOpen);\n isOpenRef.current = isOpen;\n const textToAnnounceRef = React.useRef(`${label} ${body}`);\n textToAnnounceRef.current = `${label} ${body}`;\n const read = React.useCallback(() => {\n if (liveRegionRef.current) {\n if (isOpenRef.current) liveRegionRef.current.textContent = textToAnnounceRef.current;\n else liveRegionRef.current.textContent = '';\n }\n }, []);\n\n useEffect(() => {\n if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();\n }, [isOpen, withLiveRegionAnnouncement, read]);\n\n // this used to \"try\" to animate the banner closing\n // in reality the closing animation has never actually worked (the banner just disappears, due to using \"&&\" instead of \"||\" in the logic)\n // given that it has never worked, and the complexity it adds to the code, we are officially removing the closing animation for now\n // if there is a future need for it, we can re-visit adding it back in.\n if (!isOpen)\n return getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${generatedContainerId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n />\n ) : null;\n\n return (\n <StyledBannerContainer\n onKeyDown={handleOnKeyDownToClose}\n data-testid={DSBannerDatatestid.CONTAINER}\n innerRef={handleActionRefForContainer}\n tabIndex={-1}\n role={isPageNotice ? 'region' : undefined}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n {...ownerPropsConfig}\n >\n <StyledBannerLayout {...ownerPropsConfig} $type={type}>\n <StyledInnerContainer\n cols={innerContainerCols}\n data-type={type}\n data-testid={DSBannerDatatestid.INNER_CONTAINER}\n role={withLiveRegionAnnouncement === 'alert' ? 'alert' : undefined}\n id={generatedContainerId}\n {...ownerPropsConfig}\n >\n {!CustomBody ? <DSBannerContent propsWithDefaults={propsWithDefaults} /> : <CustomBody />}\n </StyledInnerContainer>\n {!CustomBody && showCloseButton ? (\n <StyledCloseButton\n data-testid={DSBannerDatatestid.CLOSE_BUTTON}\n buttonType=\"icon\"\n innerRef={closeBtnRef}\n onClick={onClose}\n aria-label=\"Visually dismiss the banner\"\n aria-describedby={generatedContainerId}\n {...ownerPropsConfig}\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </StyledBannerLayout>\n {getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${generatedContainerId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n />\n ) : null}\n </StyledBannerContainer>\n );\n};\n\nDSBanner.displayName = DSBannerName;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = DSBannerPropTypesSchema;\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;ADgDnB;AAhDJ,sBAAuB;AACvB,8BAMO;AACP,mBAAuD;AACvD,uBAAqB;AACrB,iBAAoB;AACpB,uBAAiC;AACjC,6BAAgC;AAChC,8BAAiD;AAEjD,mCAAsD;AACtD,oBAMO;AAEP,MAAM,kBA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AChC,UAAU;AAAA,MACV,UAAU;AAAA,MACV,MAAM,eAAe,WAAW;AAAA,MAC/B,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,qDAAC,oCAAoB,GAAG,kBAAkB,OAAO,MAC/C;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,aAAW;AAAA,cACX,eAAa,2CAAmB;AAAA,cAChC,MAAM,+BAA+B,UAAU,UAAU;AAAA,cACzD,IAAI;AAAA,cACH,GAAG;AAAA,cAEH,WAAC,aAAa,4CAAC,0CAAgB,mBAAsC,IAAK,4CAAC,cAAW;AAAA;AAAA,UACzF;AAAA,UACC,CAAC,cAAc,kBACd;AAAA,YAAC;AAAA;AAAA,cACC,eAAa,2CAAmB;AAAA,cAChC,YAAW;AAAA,cACX,UAAU;AAAA,cACV,SAAS;AAAA,cACT,cAAW;AAAA,cACX,oBAAkB;AAAA,cACjB,GAAG;AAAA,cAEJ,sDAAC,0BAAO,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,UACjC,IACE;AAAA,WACN;AAAA,QACC,gBAAgB,0BAA0B,IACzC;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,GAAG,oBAAoB;AAAA,YAC3B,UAAU;AAAA,YACV,kBAAkB;AAAA,YAClB;AAAA;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,yBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
6
|
"names": ["ReactDOM", "React"]
|
|
7
7
|
}
|
|
@@ -54,7 +54,8 @@ const DSBannerSlots = {
|
|
|
54
54
|
ICON_CONTAINER: "icon-container",
|
|
55
55
|
ACTION_LINK: "action-link",
|
|
56
56
|
CLOSE_BUTTON: "close-button",
|
|
57
|
-
LAYOUT: "layout"
|
|
57
|
+
LAYOUT: "layout",
|
|
58
|
+
LIVE_REGION_PORTAL: "live-region-portal"
|
|
58
59
|
};
|
|
59
60
|
const DSBannerDatatestid = {
|
|
60
61
|
...(0, import_ds_system.slotObjectToDataTestIds)(DSBannerName, DSBannerSlots),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/exported-related/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSBannerName = 'DSBanner';\nexport const BANNER_TYPES = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DANGER: 'danger',\n} as const;\n\nexport const BANNER_BODY_ID = 'ds-banner-body';\n\n// previously this was the exported data-testid object\n// the one marked as // ok are the one that works with the slots convention and works with the slotObjectToDataTestIds function\n// the rest are not compatible and needs manual handling\n// export const DSBannerDatatestid = {\n// CONTAINER: 'ds-banner-container', // ok\n// CUSTOM_CONTAINER: 'ds-banner-custom-container', // ok\n// ACTION_LINK: 'ds-banner-action-link', // ok\n// CLOSE_BUTTON: 'ds-banner-close-button', // ok\n// // From here down are not compatible with the slotObjectToDataTestIds function.\n// INNER_CONTAINER: 'ds-banner',\n// ICON_CONTAINER: 'ds-banner-icon',\n// // from here they were not present but they had an asigned Slot.\n// // TITLE\n// // SUBTITLE\n// };\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\n\nexport const DSBannerSlots = {\n CONTAINER: 'container',\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 LAYOUT: 'layout',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const DSBannerDatatestid = {\n ...(slotObjectToDataTestIds(DSBannerName, DSBannerSlots) as Record<keyof typeof DSBannerSlots, string>),\n // handling the rest of the data-testids that are not compatible with the slotObjectToDataTestIds function manually to avoid breaking changes\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,eAAe;AACrB,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,MAAM,iBAAiB;AAoBvB,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;AAAA,EACd,QAAQ;
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSBannerName = 'DSBanner';\nexport const BANNER_TYPES = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DANGER: 'danger',\n} as const;\n\nexport const BANNER_BODY_ID = 'ds-banner-body';\n\n// previously this was the exported data-testid object\n// the one marked as // ok are the one that works with the slots convention and works with the slotObjectToDataTestIds function\n// the rest are not compatible and needs manual handling\n// export const DSBannerDatatestid = {\n// CONTAINER: 'ds-banner-container', // ok\n// CUSTOM_CONTAINER: 'ds-banner-custom-container', // ok\n// ACTION_LINK: 'ds-banner-action-link', // ok\n// CLOSE_BUTTON: 'ds-banner-close-button', // ok\n// // From here down are not compatible with the slotObjectToDataTestIds function.\n// INNER_CONTAINER: 'ds-banner',\n// ICON_CONTAINER: 'ds-banner-icon',\n// // from here they were not present but they had an asigned Slot.\n// // TITLE\n// // SUBTITLE\n// };\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\n\nexport const DSBannerSlots = {\n CONTAINER: 'container',\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 LAYOUT: 'layout',\n LIVE_REGION_PORTAL: 'live-region-portal',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const DSBannerDatatestid = {\n ...(slotObjectToDataTestIds(DSBannerName, DSBannerSlots) as Record<keyof typeof DSBannerSlots, string>),\n // handling the rest of the data-testids that are not compatible with the slotObjectToDataTestIds function manually to avoid breaking changes\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,eAAe;AACrB,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,MAAM,iBAAiB;AAoBvB,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;AAAA,EACd,QAAQ;AAAA,EACR,oBAAoB;AACtB;AAGO,MAAM,qBAAqB;AAAA,EAChC,OAAI,0CAAwB,cAAc,aAAa;AAAA;AAAA,EAEvD,iBAAiB;AAAA,EACjB,gBAAgB;AAClB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,7 +44,8 @@ const defaultProps = {
|
|
|
44
44
|
isOpen: true,
|
|
45
45
|
onClose: () => null,
|
|
46
46
|
showCloseButton: true,
|
|
47
|
-
withLiveRegionAnnouncement:
|
|
47
|
+
withLiveRegionAnnouncement: "alert",
|
|
48
|
+
isPageNotice: false
|
|
48
49
|
};
|
|
49
50
|
const DSBannerPropTypes = {
|
|
50
51
|
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
@@ -71,7 +72,8 @@ const DSBannerPropTypes = {
|
|
|
71
72
|
- focusOnWrapper: function to focus the link
|
|
72
73
|
`
|
|
73
74
|
).defaultValue({}),
|
|
74
|
-
withLiveRegionAnnouncement: import_ds_props_helpers.PropTypes.oneOf(["assertive", "polite"]).description("Whether to announce the banner content in a live region when it opens.").defaultValue(
|
|
75
|
+
withLiveRegionAnnouncement: import_ds_props_helpers.PropTypes.oneOf(["alert", "assertive", "polite"]).description("Whether to announce the banner content in a live region when it opens.").defaultValue("alert"),
|
|
76
|
+
isPageNotice: import_ds_props_helpers.PropTypes.bool.description("Whether to add role region to the banner.").defaultValue(false)
|
|
75
77
|
};
|
|
76
78
|
const DSBannerPropTypesSchema = DSBannerPropTypes;
|
|
77
79
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -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 { MutableRefObject, RefCallback } from 'react';\nimport type { XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\n\nexport declare namespace DSBannerT {\n export interface ActionRef {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n }\n\n export interface ActionLinkT {\n label: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href?: string;\n }\n\n export type BannerTypesT = (typeof BANNER_TYPES)[keyof typeof BANNER_TYPES];\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n label: string;\n body: string;\n type: BannerTypesT;\n isOpen: boolean;\n onClose: () => void | null;\n showCloseButton: boolean;\n withLiveRegionAnnouncement: 'assertive' | 'polite' |
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAKO;AAEP,8BAA0D;
|
|
4
|
+
"sourcesContent": ["import type { MutableRefObject, RefCallback } from 'react';\nimport type { XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\n\nexport declare namespace DSBannerT {\n export interface ActionRef {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n }\n\n export interface ActionLinkT {\n label: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href?: string;\n }\n\n export type BannerTypesT = (typeof BANNER_TYPES)[keyof typeof BANNER_TYPES];\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n label: string;\n body: string;\n type: BannerTypesT;\n isOpen: boolean;\n onClose: () => void | null;\n showCloseButton: boolean;\n withLiveRegionAnnouncement: 'alert' | 'assertive' | 'polite' | 'none';\n isPageNotice: boolean;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSBannerName, typeof DSBannerSlots> {\n actionLink?: ActionLinkT;\n CustomBody?: React.ComponentType<Record<string, unknown>>;\n closeBtnRef?: React.MutableRefObject<HTMLButtonElement | null> | RefCallback<HTMLButtonElement>;\n actionRef?: MutableRefObject<ActionRef>;\n }\n export interface Props extends Partial<DefaultProps>, OptionalProps, XstyledProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, XstyledProps, RequiredProps {}\n}\n\nexport const defaultProps: DSBannerT.DefaultProps = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\n\nexport const DSBannerPropTypes: DSPropTypesSchema<DSBannerT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n ...getPropsPerSlotPropTypes(DSBannerName, DSBannerSlots),\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 withLiveRegionAnnouncement: PropTypes.oneOf(['alert', 'assertive', 'polite'])\n .description('Whether to announce the banner content in a live region when it opens.')\n .defaultValue('alert'),\n isPageNotice: PropTypes.bool.description('Whether to add role region to the banner.').defaultValue(false),\n};\n\nexport const DSBannerPropTypesSchema = DSBannerPropTypes as unknown as ValidationMap<DSBannerT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAKO;AAEP,8BAA0D;AA0CnD,MAAM,eAAuC;AAAA,EAClD,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM,qCAAa;AAAA,EACnB,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AAAA,EACjB,4BAA4B;AAAA,EAC5B,cAAc;AAChB;AAEO,MAAM,oBAAwD;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAG,kDAAyB,sCAAc,qCAAa;AAAA,EACvD,gBAAgB,kCAAU,OAAO,YAAY,mDAAmD,EAAE,aAAa,CAAC,CAAC;AAAA,EACjH,OAAO,kCAAU,OAAO,YAAY,eAAe,EAAE,aAAa,EAAE;AAAA,EACpE,MAAM,kCAAU,OAAO,YAAY,qBAAqB,EAAE,aAAa,EAAE;AAAA,EACzE,YAAY,kCAAU,KAAK,YAAY,uBAAuB,EAAE,aAAa,EAAE;AAAA,EAC/E,MAAM,kCAAU,MAAM,OAAO,OAAO,oCAAY,CAAC,EAAE,YAAY,cAAc,EAAE,aAAa,qCAAa,IAAI;AAAA,EAC7G,SAAS,kCAAU,KAAK,YAAY,kCAAkC;AAAA,EACtE,QAAQ,kCAAU,KAAK,YAAY,uCAAuC,EAAE,aAAa,IAAI;AAAA,EAC7F,iBAAiB,kCAAU,KAAK,YAAY,sCAAsC,EAAE,aAAa,IAAI;AAAA,EACrG,aAAa,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAAA,EACjH,YAAY,kCAAU,MAAM;AAAA,IAC1B,OAAO,kCAAU;AAAA,IACjB,SAAS,kCAAU;AAAA,IACnB,MAAM,kCAAU;AAAA,EAClB,CAAC,EACE,YAAY,iCAAiC,EAC7C,aAAa,CAAC,CAAC;AAAA,EAClB,WAAW,kCAAU,OAClB;AAAA,IACC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKF,EACC,aAAa,CAAC,CAAC;AAAA,EAClB,4BAA4B,kCAAU,MAAM,CAAC,SAAS,aAAa,QAAQ,CAAC,EACzE,YAAY,wEAAwE,EACpF,aAAa,OAAO;AAAA,EACvB,cAAc,kCAAU,KAAK,YAAY,2CAA2C,EAAE,aAAa,KAAK;AAC1G;AAEO,MAAM,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styles.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(styles_exports, {
|
|
|
34
34
|
StyledCloseButton: () => StyledCloseButton,
|
|
35
35
|
StyledIconContainer: () => StyledIconContainer,
|
|
36
36
|
StyledInnerContainer: () => StyledInnerContainer,
|
|
37
|
+
StyledLiveRegionPortal: () => StyledLiveRegionPortal,
|
|
37
38
|
StyledSubTitle: () => StyledSubTitle,
|
|
38
39
|
StyledTitle: () => StyledTitle
|
|
39
40
|
});
|
|
@@ -48,15 +49,12 @@ const StyledBannerContainer = (0, import_ds_system.styled)("div", {
|
|
|
48
49
|
name: import_exported_related.DSBannerName,
|
|
49
50
|
slot: import_exported_related.DSBannerSlots.CONTAINER
|
|
50
51
|
})`
|
|
51
|
-
|
|
52
|
+
min-height: 41px;
|
|
52
53
|
overflow: hidden;
|
|
53
|
-
|
|
54
54
|
transition: all 0.5s ease-in;
|
|
55
|
-
|
|
56
55
|
@starting-style {
|
|
57
56
|
max-height: 0px;
|
|
58
57
|
}
|
|
59
|
-
|
|
60
58
|
${import_ds_system.xStyledCommonProps}
|
|
61
59
|
`;
|
|
62
60
|
const StyledInnerContainer = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
@@ -64,9 +62,9 @@ const StyledInnerContainer = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
|
64
62
|
slot: import_exported_related.DSBannerSlots.INNER_CONTAINER
|
|
65
63
|
})`
|
|
66
64
|
padding-right: 4px;
|
|
65
|
+
padding-bottom: 6px;
|
|
67
66
|
width: 100%;
|
|
68
67
|
min-width: 0;
|
|
69
|
-
min-height: 41px;
|
|
70
68
|
`;
|
|
71
69
|
const handleBorderColor = (type, { colors }) => {
|
|
72
70
|
switch (type) {
|
|
@@ -96,9 +94,6 @@ const StyledBannerLayout = (0, import_ds_system.styled)("div", {
|
|
|
96
94
|
flex: 1;
|
|
97
95
|
min-width: 0;
|
|
98
96
|
}
|
|
99
|
-
& > :last-child {
|
|
100
|
-
flex-shrink: 0;
|
|
101
|
-
}
|
|
102
97
|
`;
|
|
103
98
|
const StyledIconContainer = (0, import_ds_system.styled)("div", {
|
|
104
99
|
name: import_exported_related.DSBannerName,
|
|
@@ -113,7 +108,6 @@ const StyledTitle = (0, import_ds_system.styled)(import_ds_typography.DSTypograp
|
|
|
113
108
|
color: neutral-700;
|
|
114
109
|
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
115
110
|
padding-top: 9px;
|
|
116
|
-
padding-bottom: 9px;
|
|
117
111
|
overflow-wrap: break-word;
|
|
118
112
|
white-space: pre-wrap;
|
|
119
113
|
min-width: 0px;
|
|
@@ -122,7 +116,6 @@ const StyledSubTitle = (0, import_ds_system.styled)(import_ds_typography.DSTypog
|
|
|
122
116
|
margin-left: ${({ theme }) => theme.space.xs};
|
|
123
117
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
124
118
|
padding-top: 9px;
|
|
125
|
-
padding-bottom: 6px;
|
|
126
119
|
overflow-wrap: break-word;
|
|
127
120
|
white-space: pre-wrap;
|
|
128
121
|
min-width: 0px;
|
|
@@ -141,7 +134,8 @@ const StyledActionLink = (0, import_ds_system.styled)("a", {
|
|
|
141
134
|
})`
|
|
142
135
|
display: inline-block;
|
|
143
136
|
text-decoration: none;
|
|
144
|
-
line-height:
|
|
137
|
+
line-height: inherit;
|
|
138
|
+
+ font-size: inherit;
|
|
145
139
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
146
140
|
color: brand-600;
|
|
147
141
|
min-width: 0px;
|
|
@@ -166,7 +160,13 @@ const StyledCloseButton = (0, import_ds_system.styled)(import_ds_button_v2.DSBut
|
|
|
166
160
|
name: import_exported_related.DSBannerName,
|
|
167
161
|
slot: import_exported_related.DSBannerSlots.CLOSE_BUTTON
|
|
168
162
|
})`
|
|
169
|
-
margin
|
|
170
|
-
|
|
163
|
+
margin: 5px;
|
|
164
|
+
`;
|
|
165
|
+
const StyledLiveRegionPortal = (0, import_ds_system.styled)("div", {
|
|
166
|
+
name: import_exported_related.DSBannerName,
|
|
167
|
+
slot: import_exported_related.DSBannerSlots.LIVE_REGION_PORTAL
|
|
168
|
+
})`
|
|
169
|
+
clip: rect(0 0 0 0);
|
|
170
|
+
position: absolute;
|
|
171
171
|
`;
|
|
172
172
|
//# 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 { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { ColorProps, LayoutProps, SizingProps, SpaceProps } from '@elliemae/ds-system';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {}\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA2B;AAC3B,qBAAqB;AAErB,uBAA2C;AAC3C,2BAA6B;AAG7B,8BAA0D;AAInD,MAAM,4BAAwB,yBAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { ColorProps, LayoutProps, SizingProps, SpaceProps } from '@elliemae/ds-system';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {}\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n min-height: 41px;\n overflow: hidden;\n transition: all 0.5s ease-in;\n @starting-style {\n max-height: 0px;\n }\n ${xStyledCommonProps}\n`;\n\ninterface StyledInnerContainerT {}\nexport const StyledInnerContainer = styled(Grid, {\n name: DSBannerName,\n slot: DSBannerSlots.INNER_CONTAINER,\n})<StyledInnerContainerT>`\n padding-right: 4px;\n padding-bottom: 6px;\n width: 100%;\n min-width: 0;\n`;\n\nconst handleBorderColor = (\n type: DSBannerT.BannerTypesT,\n { colors }: { colors: Record<string, Record<string, string>> },\n): string => {\n switch (type) {\n case BANNER_TYPES.SUCCESS:\n return colors.success[900];\n case BANNER_TYPES.INFO:\n return colors.brand[600];\n case BANNER_TYPES.WARNING:\n return colors.warning[900];\n case BANNER_TYPES.DANGER:\n return colors.danger[900];\n default:\n return 'should_not_happen';\n }\n};\ninterface StyledBannerLayoutT {\n $type: DSBannerT.BannerTypesT;\n}\nexport const StyledBannerLayout = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.LAYOUT,\n})<StyledBannerLayoutT>`\n display: flex;\n width: 100%;\n align-items: flex-start;\n justify-content: space-between;\n background-color: neutral-000;\n border-bottom: 5px solid ${({ $type, theme }) => handleBorderColor($type, theme)};\n & > :first-child {\n flex: 1;\n min-width: 0;\n }\n`;\n\nexport const StyledIconContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.ICON_CONTAINER,\n})`\n padding-top: 8px;\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n min-width: 0px;\n`;\n\nexport const StyledTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlots.TITLE })`\n color: neutral-700;\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n padding-top: 9px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledSubTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })`\n margin-left: ${({ theme }) => theme.space.xs};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n padding-top: 9px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n ${({ theme }) => {\n if (['s', 'xs'].includes(theme.layoutMode!)) {\n return `\n grid-column: 1 / -1;\n `;\n }\n return '';\n }}\n`;\n\ninterface StyledActionLinkT {\n isBodyEmpty: boolean;\n}\nexport const StyledActionLink = styled('a', {\n name: DSBannerName,\n slot: DSBannerSlots.ACTION_LINK,\n})<StyledActionLinkT>`\n display: inline-block;\n text-decoration: none;\n line-height: inherit;\n+ font-size: inherit;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n color: brand-600;\n min-width: 0px;\n position: relative;\n &:focus {\n outline: none;\n &:after {\n position: absolute;\n content: '';\n top: -2px;\n left: -2px;\n right: -2px;\n bottom: -2px;\n border-radius: 2px;\n border: 2px solid brand-700;\n box-shadow: 0 0 0 1px brand-700;\n pointer-events: none;\n }\n }\n`;\nexport const StyledCloseButton = styled(DSButtonV2, {\n name: DSBannerName,\n slot: DSBannerSlots.CLOSE_BUTTON,\n})`\n margin: 5px;\n`;\n\nexport const StyledLiveRegionPortal = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.LIVE_REGION_PORTAL,\n})`\n clip: rect(0 0 0 0);\n position: absolute;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA2B;AAC3B,qBAAqB;AAErB,uBAA2C;AAC3C,2BAA6B;AAG7B,8BAA0D;AAInD,MAAM,4BAAwB,yBAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOG,mCAAkB;AAAA;AAIf,MAAM,2BAAuB,yBAAO,qBAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOD,MAAM,oBAAoB,CACxB,MACA,EAAE,OAAO,MACE;AACX,UAAQ,MAAM;AAAA,IACZ,KAAK,qCAAa;AAChB,aAAO,OAAO,QAAQ,GAAG;AAAA,IAC3B,KAAK,qCAAa;AAChB,aAAO,OAAO,MAAM,GAAG;AAAA,IACzB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AA;AAAA;AAAA;AAAA,iBAKgB,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBlD,MAAM,wBAAoB,yBAAO,gCAAY;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAIM,MAAM,6BAAyB,yBAAO,OAAO;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -57,7 +57,8 @@ const testCompleteDefaults = {
|
|
|
57
57
|
isOpen: true,
|
|
58
58
|
onClose: () => null,
|
|
59
59
|
showCloseButton: true,
|
|
60
|
-
withLiveRegionAnnouncement:
|
|
60
|
+
withLiveRegionAnnouncement: "alert",
|
|
61
|
+
isPageNotice: false
|
|
61
62
|
};
|
|
62
63
|
const testInternalProps = {
|
|
63
64
|
...testRequiredProps,
|
|
@@ -74,21 +75,24 @@ const testExplicitDefinition = {
|
|
|
74
75
|
body: "",
|
|
75
76
|
type: "info",
|
|
76
77
|
isOpen: true,
|
|
77
|
-
withLiveRegionAnnouncement:
|
|
78
|
+
withLiveRegionAnnouncement: "alert",
|
|
79
|
+
isPageNotice: false
|
|
78
80
|
};
|
|
79
81
|
const testInferedTypeCompatibility = {
|
|
80
82
|
label: "",
|
|
81
83
|
body: "",
|
|
82
84
|
type: "info",
|
|
83
85
|
isOpen: true,
|
|
84
|
-
withLiveRegionAnnouncement:
|
|
86
|
+
withLiveRegionAnnouncement: "alert",
|
|
87
|
+
isPageNotice: false
|
|
85
88
|
};
|
|
86
89
|
const testDefinitionAsConst = {
|
|
87
90
|
label: "",
|
|
88
91
|
body: "",
|
|
89
92
|
type: "info",
|
|
90
93
|
isOpen: true,
|
|
91
|
-
withLiveRegionAnnouncement:
|
|
94
|
+
withLiveRegionAnnouncement: "alert",
|
|
95
|
+
isPageNotice: false
|
|
92
96
|
};
|
|
93
97
|
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
94
98
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSBanner, { ...testExplicitDefinition }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-banner-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBanner } from '../index.js';\nimport type { DSBannerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBannerT.Props;\ntype ComponentPropsInternals = DSBannerT.InternalProps;\ntype ComponentPropsDefaultProps = DSBannerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSBannerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSBannerT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionLink: {\n label: 'test',\n onClick: () => {},\n href: 'test',\n },\n CustomBody: () => <div>test</div>,\n closeBtnRef: () => null,\n actionRef: { current: {} },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n label: 'hello',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: {},\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACkBH;AAjBpB,eAAyB;AAUzB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,YAAY;AAAA,IACV,OAAO;AAAA,IACP,SAAS,MAAM;AAAA,IAAC;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,YAAY,MAAM,4CAAC,SAAI,kBAAI;AAAA,EAC3B,aAAa,MAAM;AAAA,EACnB,WAAW,EAAE,SAAS,CAAC,EAAE;AAC3B;AAIA,MAAM,sBAA2D;AAAA,EAC/D,OAAO;AACT;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AAAA,EACjB,4BAA4B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBanner } from '../index.js';\nimport type { DSBannerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBannerT.Props;\ntype ComponentPropsInternals = DSBannerT.InternalProps;\ntype ComponentPropsDefaultProps = DSBannerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSBannerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSBannerT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionLink: {\n label: 'test',\n onClick: () => {},\n href: 'test',\n },\n CustomBody: () => <div>test</div>,\n closeBtnRef: () => null,\n actionRef: { current: {} },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n label: 'hello',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: {},\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSBanner {...testExplicitDefinition} />\n <DSBanner {...testInferedTypeCompatibility} />\n <DSBanner {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSBanner label=\"hello\" body=\"body\" type=\"danger\" isOpen />\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACkBH;AAjBpB,eAAyB;AAUzB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,YAAY;AAAA,IACV,OAAO;AAAA,IACP,SAAS,MAAM;AAAA,IAAC;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,YAAY,MAAM,4CAAC,SAAI,kBAAI;AAAA,EAC3B,aAAa,MAAM;AAAA,EACnB,WAAW,EAAE,SAAS,CAAC,EAAE;AAC3B;AAIA,MAAM,sBAA2D;AAAA,EAC/D,OAAO;AACT;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AAAA,EACjB,4BAA4B;AAAA,EAC5B,cAAc;AAChB;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,4BAA4B;AAAA,EAC5B,cAAc;AAChB;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,4BAA4B;AAAA,EAC5B,cAAc;AAChB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,4BAA4B;AAAA,EAC5B,cAAc;AAChB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,qBAAU,GAAG,wBAAwB;AAAA,EACtC,4CAAC,qBAAU,GAAG,8BAA8B;AAAA,EAC5C,4CAAC,qBAAU,GAAG,uBAAuB;AAAA,EAErC,4CAAC,qBAAS,OAAM,SAAQ,MAAK,QAAO,MAAK,UAAS,QAAM,MAAC;AAAA,GAC3D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSBanner.js
CHANGED
|
@@ -15,23 +15,38 @@ import { useGetLayoutMode } from "@elliemae/ds-system";
|
|
|
15
15
|
import { DSBannerContent } from "./DSBannerContent.js";
|
|
16
16
|
import { DSBannerDatatestid, DSBannerName } from "./exported-related/index.js";
|
|
17
17
|
import { defaultProps, DSBannerPropTypesSchema } from "./react-desc-prop-types.js";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
StyledLiveRegionPortal,
|
|
20
|
+
StyledBannerContainer,
|
|
21
|
+
StyledBannerLayout,
|
|
22
|
+
StyledCloseButton,
|
|
23
|
+
StyledInnerContainer
|
|
24
|
+
} from "./styles.js";
|
|
19
25
|
const outOfTheBoxCols = ["auto", "fit-content(50%)", "1fr"];
|
|
20
26
|
const outOfTheBoxColsSmallLayout = ["auto", "1fr"];
|
|
21
27
|
const colsWithCustomBody = ["1fr", "auto"];
|
|
28
|
+
const typeMap = {
|
|
29
|
+
alert: void 0,
|
|
30
|
+
polite: "polite",
|
|
31
|
+
assertive: "assertive",
|
|
32
|
+
none: "off"
|
|
33
|
+
};
|
|
34
|
+
const getIsLiveRegion = (type) => type === "polite" || type === "assertive";
|
|
22
35
|
const LiveRegionCorrectlyImplemented = ({
|
|
23
36
|
id,
|
|
24
37
|
innerRef,
|
|
25
|
-
announcementType
|
|
38
|
+
announcementType,
|
|
39
|
+
ownerPropsConfig
|
|
26
40
|
}) => ReactDOM.createPortal(
|
|
27
41
|
/* @__PURE__ */ jsx(
|
|
28
|
-
|
|
42
|
+
StyledLiveRegionPortal,
|
|
29
43
|
{
|
|
30
44
|
id,
|
|
31
|
-
|
|
45
|
+
innerRef,
|
|
32
46
|
"aria-atomic": "true",
|
|
33
|
-
"aria-live": announcementType,
|
|
34
|
-
|
|
47
|
+
"aria-live": typeMap[announcementType],
|
|
48
|
+
"data-testid": DSBannerDatatestid.LIVE_REGION_PORTAL,
|
|
49
|
+
...ownerPropsConfig
|
|
35
50
|
}
|
|
36
51
|
),
|
|
37
52
|
document.body
|
|
@@ -51,6 +66,7 @@ const DSBanner = (props) => {
|
|
|
51
66
|
containerProps,
|
|
52
67
|
actionRef,
|
|
53
68
|
withLiveRegionAnnouncement,
|
|
69
|
+
isPageNotice,
|
|
54
70
|
...rest
|
|
55
71
|
} = propsWithDefaults;
|
|
56
72
|
const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);
|
|
@@ -98,15 +114,16 @@ const DSBanner = (props) => {
|
|
|
98
114
|
}
|
|
99
115
|
}, []);
|
|
100
116
|
useEffect(() => {
|
|
101
|
-
if (isOpen && withLiveRegionAnnouncement) read();
|
|
117
|
+
if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();
|
|
102
118
|
}, [isOpen, withLiveRegionAnnouncement, read]);
|
|
103
119
|
if (!isOpen)
|
|
104
|
-
return withLiveRegionAnnouncement ? /* @__PURE__ */ jsx(
|
|
120
|
+
return getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ jsx(
|
|
105
121
|
LiveRegionCorrectlyImplemented,
|
|
106
122
|
{
|
|
107
123
|
id: `${generatedContainerId}-live-region`,
|
|
108
124
|
innerRef: liveRegionRef,
|
|
109
|
-
announcementType: withLiveRegionAnnouncement
|
|
125
|
+
announcementType: withLiveRegionAnnouncement,
|
|
126
|
+
ownerPropsConfig
|
|
110
127
|
}
|
|
111
128
|
) : null;
|
|
112
129
|
return /* @__PURE__ */ jsxs(
|
|
@@ -116,6 +133,7 @@ const DSBanner = (props) => {
|
|
|
116
133
|
"data-testid": DSBannerDatatestid.CONTAINER,
|
|
117
134
|
innerRef: handleActionRefForContainer,
|
|
118
135
|
tabIndex: -1,
|
|
136
|
+
role: isPageNotice ? "region" : void 0,
|
|
119
137
|
...containerProps,
|
|
120
138
|
...globalAttrs,
|
|
121
139
|
...xstyledAttrs,
|
|
@@ -128,7 +146,7 @@ const DSBanner = (props) => {
|
|
|
128
146
|
cols: innerContainerCols,
|
|
129
147
|
"data-type": type,
|
|
130
148
|
"data-testid": DSBannerDatatestid.INNER_CONTAINER,
|
|
131
|
-
role:
|
|
149
|
+
role: withLiveRegionAnnouncement === "alert" ? "alert" : void 0,
|
|
132
150
|
id: generatedContainerId,
|
|
133
151
|
...ownerPropsConfig,
|
|
134
152
|
children: !CustomBody ? /* @__PURE__ */ jsx(DSBannerContent, { propsWithDefaults }) : /* @__PURE__ */ jsx(CustomBody, {})
|
|
@@ -148,12 +166,13 @@ const DSBanner = (props) => {
|
|
|
148
166
|
}
|
|
149
167
|
) : null
|
|
150
168
|
] }),
|
|
151
|
-
withLiveRegionAnnouncement ? /* @__PURE__ */ jsx(
|
|
169
|
+
getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ jsx(
|
|
152
170
|
LiveRegionCorrectlyImplemented,
|
|
153
171
|
{
|
|
154
172
|
id: `${generatedContainerId}-live-region`,
|
|
155
173
|
innerRef: liveRegionRef,
|
|
156
|
-
announcementType: withLiveRegionAnnouncement
|
|
174
|
+
announcementType: withLiveRegionAnnouncement,
|
|
175
|
+
ownerPropsConfig
|
|
157
176
|
}
|
|
158
177
|
) : null
|
|
159
178
|
]
|
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", "import { CloseX } from '@elliemae/ds-icons';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { uid } from 'uid';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport { DSBannerContent } from './DSBannerContent.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBannerPropTypesSchema } from './react-desc-prop-types.js';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { CloseX } from '@elliemae/ds-icons';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { uid } from 'uid';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport { DSBannerContent } from './DSBannerContent.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBannerPropTypesSchema } from './react-desc-prop-types.js';\nimport {\n StyledLiveRegionPortal,\n StyledBannerContainer,\n StyledBannerLayout,\n StyledCloseButton,\n StyledInnerContainer,\n} from './styles.js';\n\nconst outOfTheBoxCols = ['auto', 'fit-content(50%)', '1fr'];\nconst outOfTheBoxColsSmallLayout = ['auto', '1fr'];\nconst colsWithCustomBody = ['1fr', 'auto'];\nconst typeMap = {\n alert: undefined,\n polite: 'polite',\n assertive: 'assertive',\n none: 'off',\n} as const;\n\nconst getIsLiveRegion = (type: string) => type === 'polite' || type === 'assertive';\n\nconst LiveRegionCorrectlyImplemented = ({\n id,\n innerRef,\n announcementType,\n ownerPropsConfig,\n}: {\n id: string;\n innerRef: React.Ref<HTMLDivElement>;\n announcementType: 'alert' | 'polite' | 'assertive' | 'none';\n ownerPropsConfig: Record<string, unknown>;\n}) =>\n ReactDOM.createPortal(\n <StyledLiveRegionPortal\n id={id}\n innerRef={innerRef}\n aria-atomic=\"true\"\n // off is never going to be printed because this portal is not printed when announcement is none\n // the off is just a quick hack to circumvent typescript typechecks in the static building\n aria-live={typeMap[announcementType]}\n data-testid={DSBannerDatatestid.LIVE_REGION_PORTAL}\n {...ownerPropsConfig}\n />,\n document.body,\n );\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSBannerT.InternalProps>(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 withLiveRegionAnnouncement,\n isPageNotice,\n ...rest\n } = propsWithDefaults;\n // eslint-disable-next-line no-unused-vars\n const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);\n const ownerPropsConfig = useOwnerProps(propsWithDefaults, { ...props });\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const layoutMode = useGetLayoutMode();\n const isSmall = layoutMode === 's' || layoutMode === 'xs';\n const innerContainerCols = useMemo(() => {\n if (CustomBody) return colsWithCustomBody;\n return isSmall ? outOfTheBoxColsSmallLayout : outOfTheBoxCols;\n }, [CustomBody, isSmall]);\n\n const handleActionRefForContainer = useCallback<React.RefCallback<HTMLDivElement>>(\n (containerNode) => {\n if (containerNode && actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (containerNode) {\n setTimeout(() => {\n containerNode?.focus();\n }, 300);\n }\n };\n }\n },\n [actionRef],\n );\n\n const generatedContainerId = useMemo(() => `ds-banner-${uid(5)}`, []);\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 const liveRegionRef = React.useRef<HTMLDivElement>(null);\n const isOpenRef = React.useRef(isOpen);\n isOpenRef.current = isOpen;\n const textToAnnounceRef = React.useRef(`${label} ${body}`);\n textToAnnounceRef.current = `${label} ${body}`;\n const read = React.useCallback(() => {\n if (liveRegionRef.current) {\n if (isOpenRef.current) liveRegionRef.current.textContent = textToAnnounceRef.current;\n else liveRegionRef.current.textContent = '';\n }\n }, []);\n\n useEffect(() => {\n if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();\n }, [isOpen, withLiveRegionAnnouncement, read]);\n\n // this used to \"try\" to animate the banner closing\n // in reality the closing animation has never actually worked (the banner just disappears, due to using \"&&\" instead of \"||\" in the logic)\n // given that it has never worked, and the complexity it adds to the code, we are officially removing the closing animation for now\n // if there is a future need for it, we can re-visit adding it back in.\n if (!isOpen)\n return getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${generatedContainerId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n />\n ) : null;\n\n return (\n <StyledBannerContainer\n onKeyDown={handleOnKeyDownToClose}\n data-testid={DSBannerDatatestid.CONTAINER}\n innerRef={handleActionRefForContainer}\n tabIndex={-1}\n role={isPageNotice ? 'region' : undefined}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n {...ownerPropsConfig}\n >\n <StyledBannerLayout {...ownerPropsConfig} $type={type}>\n <StyledInnerContainer\n cols={innerContainerCols}\n data-type={type}\n data-testid={DSBannerDatatestid.INNER_CONTAINER}\n role={withLiveRegionAnnouncement === 'alert' ? 'alert' : undefined}\n id={generatedContainerId}\n {...ownerPropsConfig}\n >\n {!CustomBody ? <DSBannerContent propsWithDefaults={propsWithDefaults} /> : <CustomBody />}\n </StyledInnerContainer>\n {!CustomBody && showCloseButton ? (\n <StyledCloseButton\n data-testid={DSBannerDatatestid.CLOSE_BUTTON}\n buttonType=\"icon\"\n innerRef={closeBtnRef}\n onClick={onClose}\n aria-label=\"Visually dismiss the banner\"\n aria-describedby={generatedContainerId}\n {...ownerPropsConfig}\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </StyledBannerLayout>\n {getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${generatedContainerId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n />\n ) : null}\n </StyledBannerContainer>\n );\n};\n\nDSBanner.displayName = DSBannerName;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = DSBannerPropTypesSchema;\n\nexport default DSBanner;\nexport { DSBanner, DSBannerWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgDnB,cAiHE,YAjHF;AAhDJ,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAOA,UAAS,aAAa,WAAW,eAAe;AACvD,OAAO,cAAc;AACrB,SAAS,WAAW;AACpB,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB,oBAAoB;AAEjD,SAAS,cAAc,+BAA+B;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kBAAkB,CAAC,QAAQ,oBAAoB,KAAK;AAC1D,MAAM,6BAA6B,CAAC,QAAQ,KAAK;AACjD,MAAM,qBAAqB,CAAC,OAAO,MAAM;AACzC,MAAM,UAAU;AAAA,EACd,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,MAAM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aAAW;AAAA,cACX,eAAa,mBAAmB;AAAA,cAChC,MAAM,+BAA+B,UAAU,UAAU;AAAA,cACzD,IAAI;AAAA,cACH,GAAG;AAAA,cAEH,WAAC,aAAa,oBAAC,mBAAgB,mBAAsC,IAAK,oBAAC,cAAW;AAAA;AAAA,UACzF;AAAA,UACC,CAAC,cAAc,kBACd;AAAA,YAAC;AAAA;AAAA,cACC,eAAa,mBAAmB;AAAA,cAChC,YAAW;AAAA,cACX,UAAU;AAAA,cACV,SAAS;AAAA,cACT,cAAW;AAAA,cACX,oBAAkB;AAAA,cACjB,GAAG;AAAA,cAEJ,8BAAC,UAAO,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,UACjC,IACE;AAAA,WACN;AAAA,QACC,gBAAgB,0BAA0B,IACzC;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,GAAG,oBAAoB;AAAA,YAC3B,UAAU;AAAA,YACV,kBAAkB;AAAA,YAClB;AAAA;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -17,7 +17,8 @@ const DSBannerSlots = {
|
|
|
17
17
|
ICON_CONTAINER: "icon-container",
|
|
18
18
|
ACTION_LINK: "action-link",
|
|
19
19
|
CLOSE_BUTTON: "close-button",
|
|
20
|
-
LAYOUT: "layout"
|
|
20
|
+
LAYOUT: "layout",
|
|
21
|
+
LIVE_REGION_PORTAL: "live-region-portal"
|
|
21
22
|
};
|
|
22
23
|
const DSBannerDatatestid = {
|
|
23
24
|
...slotObjectToDataTestIds(DSBannerName, DSBannerSlots),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSBannerName = 'DSBanner';\nexport const BANNER_TYPES = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DANGER: 'danger',\n} as const;\n\nexport const BANNER_BODY_ID = 'ds-banner-body';\n\n// previously this was the exported data-testid object\n// the one marked as // ok are the one that works with the slots convention and works with the slotObjectToDataTestIds function\n// the rest are not compatible and needs manual handling\n// export const DSBannerDatatestid = {\n// CONTAINER: 'ds-banner-container', // ok\n// CUSTOM_CONTAINER: 'ds-banner-custom-container', // ok\n// ACTION_LINK: 'ds-banner-action-link', // ok\n// CLOSE_BUTTON: 'ds-banner-close-button', // ok\n// // From here down are not compatible with the slotObjectToDataTestIds function.\n// INNER_CONTAINER: 'ds-banner',\n// ICON_CONTAINER: 'ds-banner-icon',\n// // from here they were not present but they had an asigned Slot.\n// // TITLE\n// // SUBTITLE\n// };\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\n\nexport const DSBannerSlots = {\n CONTAINER: 'container',\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 LAYOUT: 'layout',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const DSBannerDatatestid = {\n ...(slotObjectToDataTestIds(DSBannerName, DSBannerSlots) as Record<keyof typeof DSBannerSlots, string>),\n // handling the rest of the data-testids that are not compatible with the slotObjectToDataTestIds function manually to avoid breaking changes\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,eAAe;AACrB,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,MAAM,iBAAiB;AAoBvB,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;AAAA,EACd,QAAQ;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSBannerName = 'DSBanner';\nexport const BANNER_TYPES = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n DANGER: 'danger',\n} as const;\n\nexport const BANNER_BODY_ID = 'ds-banner-body';\n\n// previously this was the exported data-testid object\n// the one marked as // ok are the one that works with the slots convention and works with the slotObjectToDataTestIds function\n// the rest are not compatible and needs manual handling\n// export const DSBannerDatatestid = {\n// CONTAINER: 'ds-banner-container', // ok\n// CUSTOM_CONTAINER: 'ds-banner-custom-container', // ok\n// ACTION_LINK: 'ds-banner-action-link', // ok\n// CLOSE_BUTTON: 'ds-banner-close-button', // ok\n// // From here down are not compatible with the slotObjectToDataTestIds function.\n// INNER_CONTAINER: 'ds-banner',\n// ICON_CONTAINER: 'ds-banner-icon',\n// // from here they were not present but they had an asigned Slot.\n// // TITLE\n// // SUBTITLE\n// };\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\n\nexport const DSBannerSlots = {\n CONTAINER: 'container',\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 LAYOUT: 'layout',\n LIVE_REGION_PORTAL: 'live-region-portal',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const DSBannerDatatestid = {\n ...(slotObjectToDataTestIds(DSBannerName, DSBannerSlots) as Record<keyof typeof DSBannerSlots, string>),\n // handling the rest of the data-testids that are not compatible with the slotObjectToDataTestIds function manually to avoid breaking changes\n INNER_CONTAINER: 'ds-banner',\n ICON_CONTAINER: 'ds-banner-icon',\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,eAAe;AACrB,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,MAAM,iBAAiB;AAoBvB,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;AAAA,EACd,QAAQ;AAAA,EACR,oBAAoB;AACtB;AAGO,MAAM,qBAAqB;AAAA,EAChC,GAAI,wBAAwB,cAAc,aAAa;AAAA;AAAA,EAEvD,iBAAiB;AAAA,EACjB,gBAAgB;AAClB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,7 +14,8 @@ const defaultProps = {
|
|
|
14
14
|
isOpen: true,
|
|
15
15
|
onClose: () => null,
|
|
16
16
|
showCloseButton: true,
|
|
17
|
-
withLiveRegionAnnouncement:
|
|
17
|
+
withLiveRegionAnnouncement: "alert",
|
|
18
|
+
isPageNotice: false
|
|
18
19
|
};
|
|
19
20
|
const DSBannerPropTypes = {
|
|
20
21
|
...globalAttributesPropTypes,
|
|
@@ -41,7 +42,8 @@ const DSBannerPropTypes = {
|
|
|
41
42
|
- focusOnWrapper: function to focus the link
|
|
42
43
|
`
|
|
43
44
|
).defaultValue({}),
|
|
44
|
-
withLiveRegionAnnouncement: PropTypes.oneOf(["assertive", "polite"]).description("Whether to announce the banner content in a live region when it opens.").defaultValue(
|
|
45
|
+
withLiveRegionAnnouncement: PropTypes.oneOf(["alert", "assertive", "polite"]).description("Whether to announce the banner content in a live region when it opens.").defaultValue("alert"),
|
|
46
|
+
isPageNotice: PropTypes.bool.description("Whether to add role region to the banner.").defaultValue(false)
|
|
45
47
|
};
|
|
46
48
|
const DSBannerPropTypesSchema = DSBannerPropTypes;
|
|
47
49
|
export {
|
|
@@ -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 { MutableRefObject, RefCallback } from 'react';\nimport type { XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\n\nexport declare namespace DSBannerT {\n export interface ActionRef {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n }\n\n export interface ActionLinkT {\n label: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href?: string;\n }\n\n export type BannerTypesT = (typeof BANNER_TYPES)[keyof typeof BANNER_TYPES];\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n label: string;\n body: string;\n type: BannerTypesT;\n isOpen: boolean;\n onClose: () => void | null;\n showCloseButton: boolean;\n withLiveRegionAnnouncement: 'assertive' | 'polite' |
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc,cAAc,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { MutableRefObject, RefCallback } from 'react';\nimport type { XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\n\nexport declare namespace DSBannerT {\n export interface ActionRef {\n focusOnWrapper?: () => void;\n focusOnLink?: () => void;\n }\n\n export interface ActionLinkT {\n label: string;\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href?: string;\n }\n\n export type BannerTypesT = (typeof BANNER_TYPES)[keyof typeof BANNER_TYPES];\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n label: string;\n body: string;\n type: BannerTypesT;\n isOpen: boolean;\n onClose: () => void | null;\n showCloseButton: boolean;\n withLiveRegionAnnouncement: 'alert' | 'assertive' | 'polite' | 'none';\n isPageNotice: boolean;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSBannerName, typeof DSBannerSlots> {\n actionLink?: ActionLinkT;\n CustomBody?: React.ComponentType<Record<string, unknown>>;\n closeBtnRef?: React.MutableRefObject<HTMLButtonElement | null> | RefCallback<HTMLButtonElement>;\n actionRef?: MutableRefObject<ActionRef>;\n }\n export interface Props extends Partial<DefaultProps>, OptionalProps, XstyledProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, XstyledProps, RequiredProps {}\n}\n\nexport const defaultProps: DSBannerT.DefaultProps = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\n\nexport const DSBannerPropTypes: DSPropTypesSchema<DSBannerT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n ...getPropsPerSlotPropTypes(DSBannerName, DSBannerSlots),\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 withLiveRegionAnnouncement: PropTypes.oneOf(['alert', 'assertive', 'polite'])\n .description('Whether to announce the banner content in a live region when it opens.')\n .defaultValue('alert'),\n isPageNotice: PropTypes.bool.description('Whether to add role region to the banner.').defaultValue(false),\n};\n\nexport const DSBannerPropTypesSchema = DSBannerPropTypes as unknown as ValidationMap<DSBannerT.Props>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,cAAc,cAAc,qBAAqB;AA0CnD,MAAM,eAAuC;AAAA,EAClD,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM,aAAa;AAAA,EACnB,QAAQ;AAAA,EACR,S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AM,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -8,15 +8,12 @@ const StyledBannerContainer = styled("div", {
|
|
|
8
8
|
name: DSBannerName,
|
|
9
9
|
slot: DSBannerSlots.CONTAINER
|
|
10
10
|
})`
|
|
11
|
-
|
|
11
|
+
min-height: 41px;
|
|
12
12
|
overflow: hidden;
|
|
13
|
-
|
|
14
13
|
transition: all 0.5s ease-in;
|
|
15
|
-
|
|
16
14
|
@starting-style {
|
|
17
15
|
max-height: 0px;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
${xStyledCommonProps}
|
|
21
18
|
`;
|
|
22
19
|
const StyledInnerContainer = styled(Grid, {
|
|
@@ -24,9 +21,9 @@ const StyledInnerContainer = styled(Grid, {
|
|
|
24
21
|
slot: DSBannerSlots.INNER_CONTAINER
|
|
25
22
|
})`
|
|
26
23
|
padding-right: 4px;
|
|
24
|
+
padding-bottom: 6px;
|
|
27
25
|
width: 100%;
|
|
28
26
|
min-width: 0;
|
|
29
|
-
min-height: 41px;
|
|
30
27
|
`;
|
|
31
28
|
const handleBorderColor = (type, { colors }) => {
|
|
32
29
|
switch (type) {
|
|
@@ -56,9 +53,6 @@ const StyledBannerLayout = styled("div", {
|
|
|
56
53
|
flex: 1;
|
|
57
54
|
min-width: 0;
|
|
58
55
|
}
|
|
59
|
-
& > :last-child {
|
|
60
|
-
flex-shrink: 0;
|
|
61
|
-
}
|
|
62
56
|
`;
|
|
63
57
|
const StyledIconContainer = styled("div", {
|
|
64
58
|
name: DSBannerName,
|
|
@@ -73,7 +67,6 @@ const StyledTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlo
|
|
|
73
67
|
color: neutral-700;
|
|
74
68
|
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
75
69
|
padding-top: 9px;
|
|
76
|
-
padding-bottom: 9px;
|
|
77
70
|
overflow-wrap: break-word;
|
|
78
71
|
white-space: pre-wrap;
|
|
79
72
|
min-width: 0px;
|
|
@@ -82,7 +75,6 @@ const StyledSubTitle = styled(DSTypography, { name: DSBannerName, slot: DSBanner
|
|
|
82
75
|
margin-left: ${({ theme }) => theme.space.xs};
|
|
83
76
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
84
77
|
padding-top: 9px;
|
|
85
|
-
padding-bottom: 6px;
|
|
86
78
|
overflow-wrap: break-word;
|
|
87
79
|
white-space: pre-wrap;
|
|
88
80
|
min-width: 0px;
|
|
@@ -101,7 +93,8 @@ const StyledActionLink = styled("a", {
|
|
|
101
93
|
})`
|
|
102
94
|
display: inline-block;
|
|
103
95
|
text-decoration: none;
|
|
104
|
-
line-height:
|
|
96
|
+
line-height: inherit;
|
|
97
|
+
+ font-size: inherit;
|
|
105
98
|
font-weight: ${({ theme }) => theme.fontWeights.regular};
|
|
106
99
|
color: brand-600;
|
|
107
100
|
min-width: 0px;
|
|
@@ -126,8 +119,14 @@ const StyledCloseButton = styled(DSButtonV2, {
|
|
|
126
119
|
name: DSBannerName,
|
|
127
120
|
slot: DSBannerSlots.CLOSE_BUTTON
|
|
128
121
|
})`
|
|
129
|
-
margin
|
|
130
|
-
|
|
122
|
+
margin: 5px;
|
|
123
|
+
`;
|
|
124
|
+
const StyledLiveRegionPortal = styled("div", {
|
|
125
|
+
name: DSBannerName,
|
|
126
|
+
slot: DSBannerSlots.LIVE_REGION_PORTAL
|
|
127
|
+
})`
|
|
128
|
+
clip: rect(0 0 0 0);
|
|
129
|
+
position: absolute;
|
|
131
130
|
`;
|
|
132
131
|
export {
|
|
133
132
|
StyledActionLink,
|
|
@@ -136,6 +135,7 @@ export {
|
|
|
136
135
|
StyledCloseButton,
|
|
137
136
|
StyledIconContainer,
|
|
138
137
|
StyledInnerContainer,
|
|
138
|
+
StyledLiveRegionPortal,
|
|
139
139
|
StyledSubTitle,
|
|
140
140
|
StyledTitle
|
|
141
141
|
};
|
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 { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { ColorProps, LayoutProps, SizingProps, SpaceProps } from '@elliemae/ds-system';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {}\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAErB,SAAS,QAAQ,0BAA0B;AAC3C,SAAS,oBAAoB;AAG7B,SAAS,cAAc,cAAc,qBAAqB;AAInD,MAAM,wBAAwB,OAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { ColorProps, LayoutProps, SizingProps, SpaceProps } from '@elliemae/ds-system';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {}\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n min-height: 41px;\n overflow: hidden;\n transition: all 0.5s ease-in;\n @starting-style {\n max-height: 0px;\n }\n ${xStyledCommonProps}\n`;\n\ninterface StyledInnerContainerT {}\nexport const StyledInnerContainer = styled(Grid, {\n name: DSBannerName,\n slot: DSBannerSlots.INNER_CONTAINER,\n})<StyledInnerContainerT>`\n padding-right: 4px;\n padding-bottom: 6px;\n width: 100%;\n min-width: 0;\n`;\n\nconst handleBorderColor = (\n type: DSBannerT.BannerTypesT,\n { colors }: { colors: Record<string, Record<string, string>> },\n): string => {\n switch (type) {\n case BANNER_TYPES.SUCCESS:\n return colors.success[900];\n case BANNER_TYPES.INFO:\n return colors.brand[600];\n case BANNER_TYPES.WARNING:\n return colors.warning[900];\n case BANNER_TYPES.DANGER:\n return colors.danger[900];\n default:\n return 'should_not_happen';\n }\n};\ninterface StyledBannerLayoutT {\n $type: DSBannerT.BannerTypesT;\n}\nexport const StyledBannerLayout = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.LAYOUT,\n})<StyledBannerLayoutT>`\n display: flex;\n width: 100%;\n align-items: flex-start;\n justify-content: space-between;\n background-color: neutral-000;\n border-bottom: 5px solid ${({ $type, theme }) => handleBorderColor($type, theme)};\n & > :first-child {\n flex: 1;\n min-width: 0;\n }\n`;\n\nexport const StyledIconContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.ICON_CONTAINER,\n})`\n padding-top: 8px;\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n min-width: 0px;\n`;\n\nexport const StyledTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlots.TITLE })`\n color: neutral-700;\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n padding-top: 9px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledSubTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })`\n margin-left: ${({ theme }) => theme.space.xs};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n padding-top: 9px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n ${({ theme }) => {\n if (['s', 'xs'].includes(theme.layoutMode!)) {\n return `\n grid-column: 1 / -1;\n `;\n }\n return '';\n }}\n`;\n\ninterface StyledActionLinkT {\n isBodyEmpty: boolean;\n}\nexport const StyledActionLink = styled('a', {\n name: DSBannerName,\n slot: DSBannerSlots.ACTION_LINK,\n})<StyledActionLinkT>`\n display: inline-block;\n text-decoration: none;\n line-height: inherit;\n+ font-size: inherit;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n color: brand-600;\n min-width: 0px;\n position: relative;\n &:focus {\n outline: none;\n &:after {\n position: absolute;\n content: '';\n top: -2px;\n left: -2px;\n right: -2px;\n bottom: -2px;\n border-radius: 2px;\n border: 2px solid brand-700;\n box-shadow: 0 0 0 1px brand-700;\n pointer-events: none;\n }\n }\n`;\nexport const StyledCloseButton = styled(DSButtonV2, {\n name: DSBannerName,\n slot: DSBannerSlots.CLOSE_BUTTON,\n})`\n margin: 5px;\n`;\n\nexport const StyledLiveRegionPortal = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.LIVE_REGION_PORTAL,\n})`\n clip: rect(0 0 0 0);\n position: absolute;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAErB,SAAS,QAAQ,0BAA0B;AAC3C,SAAS,oBAAoB;AAG7B,SAAS,cAAc,cAAc,qBAAqB;AAInD,MAAM,wBAAwB,OAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO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M,MAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKrD,CAAC,EAAE,MAAM,MAAM;AACf,MAAI,CAAC,KAAK,IAAI,EAAE,SAAS,MAAM,UAAW,GAAG;AAC3C,WAAO;AAAA;AAAA;AAAA,EAGT;AACA,SAAO;AACT,CAAC;AAAA;AAMI,MAAM,mBAAmB,OAAO,KAAK;AAAA,EAC1C,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKgB,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBlD,MAAM,oBAAoB,OAAO,YAAY;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAIM,MAAM,yBAAyB,OAAO,OAAO;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,8 @@ const testCompleteDefaults = {
|
|
|
34
34
|
isOpen: true,
|
|
35
35
|
onClose: () => null,
|
|
36
36
|
showCloseButton: true,
|
|
37
|
-
withLiveRegionAnnouncement:
|
|
37
|
+
withLiveRegionAnnouncement: "alert",
|
|
38
|
+
isPageNotice: false
|
|
38
39
|
};
|
|
39
40
|
const testInternalProps = {
|
|
40
41
|
...testRequiredProps,
|
|
@@ -51,21 +52,24 @@ const testExplicitDefinition = {
|
|
|
51
52
|
body: "",
|
|
52
53
|
type: "info",
|
|
53
54
|
isOpen: true,
|
|
54
|
-
withLiveRegionAnnouncement:
|
|
55
|
+
withLiveRegionAnnouncement: "alert",
|
|
56
|
+
isPageNotice: false
|
|
55
57
|
};
|
|
56
58
|
const testInferedTypeCompatibility = {
|
|
57
59
|
label: "",
|
|
58
60
|
body: "",
|
|
59
61
|
type: "info",
|
|
60
62
|
isOpen: true,
|
|
61
|
-
withLiveRegionAnnouncement:
|
|
63
|
+
withLiveRegionAnnouncement: "alert",
|
|
64
|
+
isPageNotice: false
|
|
62
65
|
};
|
|
63
66
|
const testDefinitionAsConst = {
|
|
64
67
|
label: "",
|
|
65
68
|
body: "",
|
|
66
69
|
type: "info",
|
|
67
70
|
isOpen: true,
|
|
68
|
-
withLiveRegionAnnouncement:
|
|
71
|
+
withLiveRegionAnnouncement: "alert",
|
|
72
|
+
isPageNotice: false
|
|
69
73
|
};
|
|
70
74
|
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
75
|
/* @__PURE__ */ jsx(DSBanner, { ...testExplicitDefinition }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-banner-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBanner } from '../index.js';\nimport type { DSBannerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBannerT.Props;\ntype ComponentPropsInternals = DSBannerT.InternalProps;\ntype ComponentPropsDefaultProps = DSBannerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSBannerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSBannerT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionLink: {\n label: 'test',\n onClick: () => {},\n href: 'test',\n },\n CustomBody: () => <div>test</div>,\n closeBtnRef: () => null,\n actionRef: { current: {} },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n label: 'hello',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: {},\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement:
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACkBH,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBanner } from '../index.js';\nimport type { DSBannerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBannerT.Props;\ntype ComponentPropsInternals = DSBannerT.InternalProps;\ntype ComponentPropsDefaultProps = DSBannerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSBannerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSBannerT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionLink: {\n label: 'test',\n onClick: () => {},\n href: 'test',\n },\n CustomBody: () => <div>test</div>,\n closeBtnRef: () => null,\n actionRef: { current: {} },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n label: 'hello',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: {},\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSBanner {...testExplicitDefinition} />\n <DSBanner {...testInferedTypeCompatibility} />\n <DSBanner {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSBanner label=\"hello\" body=\"body\" type=\"danger\" isOpen />\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACkBH,SAyElB,UAzEkB,KAyElB,YAzEkB;AAjBpB,SAAS,gBAAgB;AAUzB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,YAAY;AAAA,IACV,OAAO;AAAA,IACP,SAAS,MAAM;AAAA,IAAC;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,YAAY,MAAM,oBAAC,SAAI,kBAAI;AAAA,EAC3B,aAAa,MAAM;AAAA,EACnB,WAAW,EAAE,SA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names": []
|
|
7
7
|
}
|
|
@@ -16,6 +16,7 @@ export declare const DSBannerSlots: {
|
|
|
16
16
|
readonly ACTION_LINK: "action-link";
|
|
17
17
|
readonly CLOSE_BUTTON: "close-button";
|
|
18
18
|
readonly LAYOUT: "layout";
|
|
19
|
+
readonly LIVE_REGION_PORTAL: "live-region-portal";
|
|
19
20
|
};
|
|
20
21
|
export declare const DSBannerDatatestid: {
|
|
21
22
|
INNER_CONTAINER: string;
|
|
@@ -27,4 +28,5 @@ export declare const DSBannerDatatestid: {
|
|
|
27
28
|
ACTION_LINK: string;
|
|
28
29
|
CLOSE_BUTTON: string;
|
|
29
30
|
LAYOUT: string;
|
|
31
|
+
LIVE_REGION_PORTAL: string;
|
|
30
32
|
};
|
|
@@ -23,7 +23,8 @@ export declare namespace DSBannerT {
|
|
|
23
23
|
isOpen: boolean;
|
|
24
24
|
onClose: () => void | null;
|
|
25
25
|
showCloseButton: boolean;
|
|
26
|
-
withLiveRegionAnnouncement: 'assertive' | 'polite' |
|
|
26
|
+
withLiveRegionAnnouncement: 'alert' | 'assertive' | 'polite' | 'none';
|
|
27
|
+
isPageNotice: boolean;
|
|
27
28
|
}
|
|
28
29
|
interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSBannerName, typeof DSBannerSlots> {
|
|
29
30
|
actionLink?: ActionLinkT;
|
package/dist/types/styles.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ interface StyledActionLinkT {
|
|
|
18
18
|
}
|
|
19
19
|
export declare const StyledActionLink: import("styled-components").StyledComponent<"a", import("@elliemae/ds-system").Theme, StyledActionLinkT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"a">, never>;
|
|
20
20
|
export declare const StyledCloseButton: import("styled-components").StyledComponent<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV2T.Props>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ComponentType<import("@elliemae/ds-button-v2").DSButtonV2T.Props>>, never>;
|
|
21
|
+
export declare const StyledLiveRegionPortal: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
21
22
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-banner",
|
|
3
|
-
"version": "3.53.0-alpha.
|
|
3
|
+
"version": "3.53.0-alpha.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Banner",
|
|
6
6
|
"files": [
|
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@xstyled/system": "~3.7.3",
|
|
40
40
|
"@xstyled/util": "~3.7.0",
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-system": "3.53.0-alpha.
|
|
46
|
-
"@elliemae/ds-typescript-helpers": "3.53.0-alpha.
|
|
41
|
+
"@elliemae/ds-button-v2": "3.53.0-alpha.4",
|
|
42
|
+
"@elliemae/ds-grid": "3.53.0-alpha.4",
|
|
43
|
+
"@elliemae/ds-props-helpers": "3.53.0-alpha.4",
|
|
44
|
+
"@elliemae/ds-icons": "3.53.0-alpha.4",
|
|
45
|
+
"@elliemae/ds-system": "3.53.0-alpha.4",
|
|
46
|
+
"@elliemae/ds-typescript-helpers": "3.53.0-alpha.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
50
50
|
"jest": "~29.7.0",
|
|
51
51
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-
|
|
53
|
-
"@elliemae/ds-
|
|
52
|
+
"@elliemae/ds-test-utils": "3.53.0-alpha.4",
|
|
53
|
+
"@elliemae/ds-monorepo-devops": "3.53.0-alpha.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"lodash-es": "^4.17.21",
|