@elliemae/ds-banner 3.53.0-alpha.1 → 3.53.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cjs/DSBanner.js +121 -108
  2. package/dist/cjs/DSBanner.js.map +3 -3
  3. package/dist/cjs/DSBannerContent.js +101 -0
  4. package/dist/cjs/DSBannerContent.js.map +7 -0
  5. package/dist/cjs/exported-related/index.js +5 -1
  6. package/dist/cjs/exported-related/index.js.map +2 -2
  7. package/dist/cjs/react-desc-prop-types.js +7 -2
  8. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  9. package/dist/cjs/styles.js +70 -27
  10. package/dist/cjs/styles.js.map +2 -2
  11. package/dist/cjs/typescript-testing/typescript-banner-valid.js +12 -4
  12. package/dist/cjs/typescript-testing/typescript-banner-valid.js.map +2 -2
  13. package/dist/esm/DSBanner.js +126 -115
  14. package/dist/esm/DSBanner.js.map +2 -2
  15. package/dist/esm/DSBannerContent.js +71 -0
  16. package/dist/esm/DSBannerContent.js.map +7 -0
  17. package/dist/esm/exported-related/index.js +5 -1
  18. package/dist/esm/exported-related/index.js.map +2 -2
  19. package/dist/esm/react-desc-prop-types.js +14 -4
  20. package/dist/esm/react-desc-prop-types.js.map +2 -2
  21. package/dist/esm/styles.js +70 -27
  22. package/dist/esm/styles.js.map +2 -2
  23. package/dist/esm/typescript-testing/typescript-banner-valid.js +12 -4
  24. package/dist/esm/typescript-testing/typescript-banner-valid.js.map +2 -2
  25. package/dist/types/DSBannerContent.d.ts +8 -0
  26. package/dist/types/exported-related/index.d.ts +5 -0
  27. package/dist/types/react-desc-prop-types.d.ts +5 -3
  28. package/dist/types/styles.d.ts +9 -11
  29. package/package.json +10 -9
  30. package/dist/cjs/utils/icons.js +0 -43
  31. package/dist/cjs/utils/icons.js.map +0 -7
  32. package/dist/cjs/utils/styleHelpers.js +0 -102
  33. package/dist/cjs/utils/styleHelpers.js.map +0 -7
  34. package/dist/esm/utils/icons.js +0 -13
  35. package/dist/esm/utils/icons.js.map +0 -7
  36. package/dist/esm/utils/styleHelpers.js +0 -72
  37. package/dist/esm/utils/styleHelpers.js.map +0 -7
  38. package/dist/types/utils/icons.d.ts +0 -2
  39. package/dist/types/utils/styleHelpers.d.ts +0 -6
@@ -38,10 +38,42 @@ var import_jsx_runtime = require("react/jsx-runtime");
38
38
  var import_ds_icons = require("@elliemae/ds-icons");
39
39
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
40
40
  var import_react = __toESM(require("react"));
41
+ var import_react_dom = __toESM(require("react-dom"));
42
+ var import_uid = require("uid");
43
+ var import_ds_system = require("@elliemae/ds-system");
44
+ var import_DSBannerContent = require("./DSBannerContent.js");
41
45
  var import_exported_related = require("./exported-related/index.js");
42
46
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
43
47
  var import_styles = require("./styles.js");
44
- var import_icons = require("./utils/icons.js");
48
+ const outOfTheBoxCols = ["auto", "fit-content(50%)", "1fr"];
49
+ const outOfTheBoxColsSmallLayout = ["auto", "1fr"];
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";
58
+ const LiveRegionCorrectlyImplemented = ({
59
+ id,
60
+ innerRef,
61
+ announcementType,
62
+ ownerPropsConfig
63
+ }) => import_react_dom.default.createPortal(
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ import_styles.StyledLiveRegionPortal,
66
+ {
67
+ id,
68
+ innerRef,
69
+ "aria-atomic": "true",
70
+ "aria-live": typeMap[announcementType],
71
+ "data-testid": import_exported_related.DSBannerDatatestid.LIVE_REGION_PORTAL,
72
+ ...ownerPropsConfig
73
+ }
74
+ ),
75
+ document.body
76
+ );
45
77
  const DSBanner = (props) => {
46
78
  const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
47
79
  const {
@@ -56,48 +88,34 @@ const DSBanner = (props) => {
56
88
  showCloseButton,
57
89
  containerProps,
58
90
  actionRef,
91
+ withLiveRegionAnnouncement,
92
+ isPageNotice,
59
93
  ...rest
60
94
  } = propsWithDefaults;
61
95
  const { height: globalHeight, ...globalAttrs } = (0, import_ds_props_helpers.useGetGlobalAttributes)(rest);
62
96
  const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefaults, { ...props });
63
97
  const xstyledAttrs = (0, import_ds_props_helpers.useGetXstyledProps)(rest);
64
- const innerContainerRef = (0, import_react.useRef)(null);
65
- const linkRef = (0, import_react.useRef)(null);
66
- let { current } = (0, import_react.useRef)(false);
67
- const [isAnimating, setIsAnimating] = (0, import_react.useState)(false);
68
- const [height, setHeight] = (0, import_react.useState)(0);
69
- const [alertTabIndex, setAlertTabIndex] = (0, import_react.useState)(void 0);
70
- (0, import_react.useEffect)(() => {
71
- if (innerContainerRef.current) {
72
- setHeight(innerContainerRef.current.offsetHeight);
73
- }
74
- }, [isAnimating, isOpen]);
75
- (0, import_react.useEffect)(() => {
76
- if (actionRef && actionRef.current) {
77
- actionRef.current.focusOnWrapper = () => {
78
- if (innerContainerRef.current) {
79
- setAlertTabIndex(0);
80
- setTimeout(() => {
81
- innerContainerRef.current?.focus();
82
- }, 300);
83
- }
84
- };
85
- actionRef.current.focusOnLink = () => {
86
- if (linkRef.current) {
87
- linkRef.current.focus();
88
- }
89
- };
90
- }
91
- }, [actionRef]);
92
- const handleBlur = (0, import_react.useCallback)(() => {
93
- setAlertTabIndex(void 0);
94
- }, []);
95
- const handleOnKeyDown = (0, import_react.useCallback)((e) => {
96
- if (e.key === "Enter" || e.key === " ") {
97
- e.preventDefault();
98
- if (linkRef.current) linkRef.current.click();
99
- }
100
- }, []);
98
+ const layoutMode = (0, import_ds_system.useGetLayoutMode)();
99
+ const isSmall = layoutMode === "s" || layoutMode === "xs";
100
+ const innerContainerCols = (0, import_react.useMemo)(() => {
101
+ if (CustomBody) return colsWithCustomBody;
102
+ return isSmall ? outOfTheBoxColsSmallLayout : outOfTheBoxCols;
103
+ }, [CustomBody, isSmall]);
104
+ const handleActionRefForContainer = (0, import_react.useCallback)(
105
+ (containerNode) => {
106
+ if (containerNode && actionRef && actionRef.current) {
107
+ actionRef.current.focusOnWrapper = () => {
108
+ if (containerNode) {
109
+ setTimeout(() => {
110
+ containerNode?.focus();
111
+ }, 300);
112
+ }
113
+ };
114
+ }
115
+ },
116
+ [actionRef]
117
+ );
118
+ const generatedContainerId = (0, import_react.useMemo)(() => `ds-banner-${(0, import_uid.uid)(5)}`, []);
101
119
  const handleOnKeyDownToClose = (0, import_react.useCallback)(
102
120
  (e) => {
103
121
  if (e.key === "Escape") {
@@ -107,85 +125,80 @@ const DSBanner = (props) => {
107
125
  },
108
126
  [onClose]
109
127
  );
110
- (0, import_react.useLayoutEffect)(() => {
111
- if (isOpen !== current || isOpen) setIsAnimating(true);
112
- else setIsAnimating(false);
113
- }, [isOpen, current]);
114
- const innerCols = import_react.default.useMemo(() => {
115
- if (!CustomBody) {
116
- const finalCols = ["auto", "fit-content(50%)", "1fr"];
117
- if (showCloseButton) finalCols.push("auto");
118
- return finalCols;
128
+ const liveRegionRef = import_react.default.useRef(null);
129
+ const isOpenRef = import_react.default.useRef(isOpen);
130
+ isOpenRef.current = isOpen;
131
+ const textToAnnounceRef = import_react.default.useRef(`${label} ${body}`);
132
+ textToAnnounceRef.current = `${label} ${body}`;
133
+ const read = import_react.default.useCallback(() => {
134
+ if (liveRegionRef.current) {
135
+ if (isOpenRef.current) liveRegionRef.current.textContent = textToAnnounceRef.current;
136
+ else liveRegionRef.current.textContent = "";
119
137
  }
120
- return ["1fr", "auto"];
121
- }, [CustomBody, showCloseButton]);
122
- if (!isAnimating && !isOpen) return null;
123
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ }, []);
139
+ (0, import_react.useEffect)(() => {
140
+ if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();
141
+ }, [isOpen, withLiveRegionAnnouncement, read]);
142
+ if (!isOpen)
143
+ return getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
+ LiveRegionCorrectlyImplemented,
145
+ {
146
+ id: `${generatedContainerId}-live-region`,
147
+ innerRef: liveRegionRef,
148
+ announcementType: withLiveRegionAnnouncement,
149
+ ownerPropsConfig
150
+ }
151
+ ) : null;
152
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
124
153
  import_styles.StyledBannerContainer,
125
154
  {
126
- isOpen,
127
- height,
128
155
  onKeyDown: handleOnKeyDownToClose,
129
- isAnimating,
130
- onAnimationEnd: () => {
131
- current = isOpen;
132
- setIsAnimating(false);
133
- },
134
156
  "data-testid": import_exported_related.DSBannerDatatestid.CONTAINER,
157
+ innerRef: handleActionRefForContainer,
158
+ tabIndex: -1,
159
+ role: isPageNotice ? "region" : void 0,
135
160
  ...containerProps,
136
161
  ...globalAttrs,
137
162
  ...xstyledAttrs,
138
163
  ...ownerPropsConfig,
139
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
140
- import_styles.StyledInnerContainer,
141
- {
142
- cols: innerCols,
143
- $type: type,
144
- "data-type": type,
145
- isOpen,
146
- innerRef: innerContainerRef,
147
- isAnimating,
148
- "data-testid": import_exported_related.DSBannerDatatestid.INNER_CONTAINER,
149
- role: "alert",
150
- tabIndex: alertTabIndex,
151
- onBlur: handleBlur,
152
- ...ownerPropsConfig,
153
- children: !CustomBody ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
154
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIconContainer, { "data-testid": import_exported_related.DSBannerDatatestid.ICON_CONTAINER, ...ownerPropsConfig, children: import_icons.icons[type] }),
155
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { ...ownerPropsConfig, children: label }),
156
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledSubTitle, { ...ownerPropsConfig, children: [
157
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: body }),
158
- actionLink && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
159
- import_styles.StyledActionLink,
160
- {
161
- "data-testid": import_exported_related.DSBannerDatatestid.ACTION_LINK,
162
- onClick: actionLink.onClick,
163
- href: actionLink.href,
164
- innerRef: linkRef,
165
- onKeyDown: handleOnKeyDown,
166
- tabIndex: 0,
167
- isBodyEmpty: !body,
168
- title: actionLink.label,
169
- ...ownerPropsConfig,
170
- children: actionLink.label
171
- }
172
- )
173
- ] }),
174
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
175
- import_styles.StyledCloseButton,
176
- {
177
- "data-testid": import_exported_related.DSBannerDatatestid.CLOSE_BUTTON,
178
- buttonType: "icon",
179
- innerRef: closeBtnRef,
180
- onClick: onClose,
181
- "aria-label": "Close icon",
182
- ...ownerPropsConfig,
183
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.CloseX, { width: 12, height: 12 })
184
- }
185
- ) : null
186
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomBody, {})
187
- }
188
- )
164
+ children: [
165
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledBannerLayout, { ...ownerPropsConfig, $type: type, children: [
166
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
167
+ import_styles.StyledInnerContainer,
168
+ {
169
+ cols: innerContainerCols,
170
+ "data-type": type,
171
+ "data-testid": import_exported_related.DSBannerDatatestid.INNER_CONTAINER,
172
+ role: withLiveRegionAnnouncement === "alert" ? "alert" : void 0,
173
+ id: generatedContainerId,
174
+ ...ownerPropsConfig,
175
+ children: !CustomBody ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSBannerContent.DSBannerContent, { propsWithDefaults }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomBody, {})
176
+ }
177
+ ),
178
+ !CustomBody && showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
179
+ import_styles.StyledCloseButton,
180
+ {
181
+ "data-testid": import_exported_related.DSBannerDatatestid.CLOSE_BUTTON,
182
+ buttonType: "icon",
183
+ innerRef: closeBtnRef,
184
+ onClick: onClose,
185
+ "aria-label": "Visually dismiss the banner",
186
+ "aria-describedby": generatedContainerId,
187
+ ...ownerPropsConfig,
188
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.CloseX, { width: 12, height: 12 })
189
+ }
190
+ ) : null
191
+ ] }),
192
+ getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ LiveRegionCorrectlyImplemented,
194
+ {
195
+ id: `${generatedContainerId}-live-region`,
196
+ innerRef: liveRegionRef,
197
+ announcementType: withLiveRegionAnnouncement,
198
+ ownerPropsConfig
199
+ }
200
+ ) : null
201
+ ]
189
202
  }
190
203
  );
191
204
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSBanner.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-lines */\nimport { CloseX } from '@elliemae/ds-icons';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\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 StyledActionLink,\n StyledBannerContainer,\n StyledCloseButton,\n StyledIconContainer,\n StyledInnerContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles.js';\nimport { icons } from './utils/icons.js';\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 ...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\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const innerContainerRef = useRef<HTMLDivElement>(null);\n const linkRef = useRef<HTMLAnchorElement>(null);\n let { current } = useRef<boolean>(false);\n const [isAnimating, setIsAnimating] = useState<boolean>(false);\n const [height, setHeight] = useState<number>(0);\n const [alertTabIndex, setAlertTabIndex] = useState<TypescriptHelpersT.WCAGTabIndex | undefined>(undefined);\n\n useEffect(() => {\n if (innerContainerRef.current) {\n setHeight(innerContainerRef.current.offsetHeight);\n }\n }, [isAnimating, isOpen]);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (innerContainerRef.current) {\n setAlertTabIndex(0);\n setTimeout(() => {\n innerContainerRef.current?.focus();\n }, 300);\n }\n };\n actionRef.current.focusOnLink = () => {\n if (linkRef.current) {\n linkRef.current.focus();\n }\n };\n }\n }, [actionRef]);\n\n const handleBlur = useCallback(() => {\n setAlertTabIndex(undefined);\n }, []);\n\n const handleOnKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (linkRef.current) linkRef.current.click();\n }\n }, []);\n\n const handleOnKeyDownToClose = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClose();\n }\n },\n [onClose],\n );\n\n useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n const innerCols = React.useMemo(() => {\n if (!CustomBody) {\n const finalCols = ['auto', 'fit-content(50%)', '1fr'];\n if (showCloseButton) finalCols.push('auto');\n return finalCols;\n }\n return ['1fr', 'auto'];\n }, [CustomBody, showCloseButton]);\n\n if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n isOpen={isOpen}\n height={height}\n onKeyDown={handleOnKeyDownToClose}\n isAnimating={isAnimating}\n onAnimationEnd={() => {\n current = isOpen;\n setIsAnimating(false);\n }}\n data-testid={DSBannerDatatestid.CONTAINER}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n {...ownerPropsConfig}\n >\n <StyledInnerContainer\n cols={innerCols}\n $type={type}\n data-type={type}\n isOpen={isOpen}\n innerRef={innerContainerRef}\n isAnimating={isAnimating}\n data-testid={DSBannerDatatestid.INNER_CONTAINER}\n role=\"alert\"\n tabIndex={alertTabIndex}\n onBlur={handleBlur}\n {...ownerPropsConfig}\n >\n {!CustomBody ? (\n <>\n <StyledIconContainer data-testid={DSBannerDatatestid.ICON_CONTAINER} {...ownerPropsConfig}>\n {icons[type]}\n </StyledIconContainer>\n <StyledTitle {...ownerPropsConfig}>{label}</StyledTitle>\n <StyledSubTitle {...ownerPropsConfig}>\n <span>{body}</span>\n {actionLink && (\n <StyledActionLink\n data-testid={DSBannerDatatestid.ACTION_LINK}\n onClick={actionLink.onClick}\n href={actionLink.href}\n innerRef={linkRef}\n onKeyDown={handleOnKeyDown}\n tabIndex={0}\n isBodyEmpty={!body}\n title={actionLink.label}\n {...ownerPropsConfig}\n >\n {actionLink.label}\n </StyledActionLink>\n )}\n </StyledSubTitle>\n {showCloseButton ? (\n <StyledCloseButton\n data-testid={DSBannerDatatestid.CLOSE_BUTTON}\n buttonType=\"icon\"\n innerRef={closeBtnRef}\n onClick={onClose}\n aria-label=\"Close icon\"\n {...ownerPropsConfig}\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </>\n ) : (\n <CustomBody />\n )}\n </StyledInnerContainer>\n </StyledBannerContainer>\n );\n};\n\nDSBanner.displayName = DSBannerName;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = 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;ADkJb;AAjJV,sBAAuB;AACvB,8BAMO;AAEP,mBAAiF;AACjF,8BAAiD;AAEjD,mCAAsD;AACtD,oBAQO;AACP,mBAAsB;AAEtB,MAAM,WAAiD,CAAC,UAAU;AAChE,QAAM,wBAAoB,sDAAsD,OAAO,yCAAY;AAEnG,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,QAAQ,cAAc,GAAG,YAAY,QAAI,gDAAuB,IAAI;AAC5E,QAAM,uBAAmB,uCAAc,mBAAmB,EAAE,GAAG,MAAM,CAAC;AAEtE,QAAM,mBAAe,4CAAmB,IAAI;AAE5C,QAAM,wBAAoB,qBAAuB,IAAI;AACrD,QAAM,cAAU,qBAA0B,IAAI;AAC9C,MAAI,EAAE,QAAQ,QAAI,qBAAgB,KAAK;AACvC,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAkB,KAAK;AAC7D,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAiB,CAAC;AAC9C,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAsD,MAAS;AAEzG,8BAAU,MAAM;AACd,QAAI,kBAAkB,SAAS;AAC7B,gBAAU,kBAAkB,Q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AO,IAAI,QAAQ,IAAI;AAAA;AAAA,YACjC,IACE;AAAA,aACN,IAEA,4CAAC,cAAW;AAAA;AAAA,MAEhB;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,yBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
6
- "names": ["React"]
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,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;AACR;AAEA,MAAM,kBAAkB,CAAC,SAAiB,SAAS,YAAY,SAAS;AAExE,MAAM,iCAAiC,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAME,iBAAAA,QAAS;AAAA,EACP;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,eAAY;AAAA,MAGZ,aAAW,QAAQ,gBAAgB;AAAA,MACnC,eAAa,2CAAmB;AAAA,MAC/B,GAAG;AAAA;AAAA,EACN;AAAA,EACA,SAAS;AACX;AAEF,MAAM,WAAiD,CAAC,UAAU;AAChE,QAAM,wBAAoB,sDAAsD,OAAO,yCAAY;AAEnG,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AA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I;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
+ "names": ["ReactDOM", "React"]
7
7
  }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var DSBannerContent_exports = {};
30
+ __export(DSBannerContent_exports, {
31
+ DSBannerContent: () => DSBannerContent,
32
+ icons: () => icons
33
+ });
34
+ module.exports = __toCommonJS(DSBannerContent_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_ds_icons = require("@elliemae/ds-icons");
38
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
39
+ var import_ds_typography = require("@elliemae/ds-typography");
40
+ var import_react = __toESM(require("react"));
41
+ var import_exported_related = require("./exported-related/index.js");
42
+ var import_styles = require("./styles.js");
43
+ const icons = {
44
+ success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.SuccessFill, { color: ["success", "900"], width: "20px", height: "20px" }),
45
+ info: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.InfoFill, { color: ["brand-primary", "600"], width: "20px", height: "20px" }),
46
+ danger: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.AlertsDetailFill, { color: ["danger", "900"], width: "20px", height: "20px" }),
47
+ warning: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.WarningSquare, { color: ["warning", "900"], width: "20px", height: "20px" })
48
+ };
49
+ const DSBannerContent = (props) => {
50
+ const {
51
+ propsWithDefaults,
52
+ propsWithDefaults: { type, label, body, actionLink, actionRef }
53
+ } = props;
54
+ const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefaults, { ...props });
55
+ const linkRef = import_react.default.useRef(null);
56
+ const handleActionRefForLink = (0, import_react.useCallback)(
57
+ (linkNode) => {
58
+ if (linkNode) {
59
+ linkRef.current = linkNode;
60
+ if (actionRef && actionRef.current) {
61
+ actionRef.current.focusOnLink = () => {
62
+ linkNode?.focus?.();
63
+ };
64
+ }
65
+ }
66
+ },
67
+ [actionRef]
68
+ );
69
+ const handleOnKeyDown = (0, import_react.useCallback)((e) => {
70
+ if (e.key === "Enter" || e.key === " ") {
71
+ e.preventDefault();
72
+ if (linkRef.current) linkRef.current.click();
73
+ }
74
+ }, []);
75
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIconContainer, { "data-testid": import_exported_related.DSBannerDatatestid.ICON_CONTAINER, ...ownerPropsConfig, children: icons[type] }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { variant: import_ds_typography.TYPOGRAPHY_VARIANTS.B1, ...ownerPropsConfig, children: label }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledSubTitle, { id: import_exported_related.BANNER_BODY_ID, variant: import_ds_typography.TYPOGRAPHY_VARIANTS.B1, ...ownerPropsConfig, children: [
79
+ body,
80
+ actionLink && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
81
+ " ",
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ import_styles.StyledActionLink,
84
+ {
85
+ "data-testid": import_exported_related.DSBannerDatatestid.ACTION_LINK,
86
+ onClick: actionLink.onClick,
87
+ href: actionLink.href,
88
+ innerRef: handleActionRefForLink,
89
+ onKeyDown: handleOnKeyDown,
90
+ tabIndex: 0,
91
+ isBodyEmpty: !body,
92
+ title: actionLink.label,
93
+ ...ownerPropsConfig,
94
+ children: actionLink.label
95
+ }
96
+ )
97
+ ] })
98
+ ] })
99
+ ] });
100
+ };
101
+ //# sourceMappingURL=DSBannerContent.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSBannerContent.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport { AlertsDetailFill, InfoFill, SuccessFill, WarningSquare } from '@elliemae/ds-icons';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { TYPOGRAPHY_VARIANTS } from '@elliemae/ds-typography';\nimport React, { useCallback } from 'react';\nimport { BANNER_BODY_ID, DSBannerDatatestid } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { StyledActionLink, StyledIconContainer, StyledSubTitle, StyledTitle } from './styles.js';\n\nexport const icons: Record<string, JSX.Element> = {\n success: <SuccessFill color={['success', '900']} width=\"20px\" height=\"20px\" />,\n info: <InfoFill color={['brand-primary', '600']} width=\"20px\" height=\"20px\" />,\n danger: <AlertsDetailFill color={['danger', '900']} width=\"20px\" height=\"20px\" />,\n warning: <WarningSquare color={['warning', '900']} width=\"20px\" height=\"20px\" />,\n};\n\ninterface DSBannerContentProps {\n propsWithDefaults: DSBannerT.InternalProps;\n}\n\nexport const DSBannerContent: React.ComponentType<DSBannerContentProps> = (props) => {\n const {\n propsWithDefaults,\n propsWithDefaults: { type, label, body, actionLink, actionRef },\n } = props;\n const ownerPropsConfig = useOwnerProps(propsWithDefaults, { ...props });\n\n const linkRef = React.useRef<HTMLAnchorElement>(null) as React.MutableRefObject<HTMLAnchorElement>;\n\n const handleActionRefForLink = useCallback<React.RefCallback<HTMLAnchorElement>>(\n (linkNode) => {\n if (linkNode) {\n linkRef.current = linkNode;\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnLink = () => {\n linkNode?.focus?.();\n };\n }\n }\n },\n [actionRef],\n );\n\n const handleOnKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n if (linkRef.current) linkRef.current.click();\n }\n }, []);\n\n return (\n <>\n <StyledIconContainer data-testid={DSBannerDatatestid.ICON_CONTAINER} {...ownerPropsConfig}>\n {icons[type]}\n </StyledIconContainer>\n <StyledTitle variant={TYPOGRAPHY_VARIANTS.B1} {...ownerPropsConfig}>\n {label}\n </StyledTitle>\n <StyledSubTitle id={BANNER_BODY_ID} variant={TYPOGRAPHY_VARIANTS.B1} {...ownerPropsConfig}>\n {body}\n {actionLink && (\n <>\n {/* This way of handling the space is making use of the browser default\n white-space clamping, avoiding lots of JS code. */}\n {' '}\n <StyledActionLink\n data-testid={DSBannerDatatestid.ACTION_LINK}\n onClick={actionLink.onClick}\n href={actionLink.href}\n innerRef={handleActionRefForLink}\n onKeyDown={handleOnKeyDown}\n tabIndex={0}\n isBodyEmpty={!body}\n title={actionLink.label}\n {...ownerPropsConfig}\n >\n {actionLink.label}\n </StyledActionLink>\n </>\n )}\n </StyledSubTitle>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADUZ;AATX,sBAAuE;AACvE,8BAA8B;AAC9B,2BAAoC;AACpC,mBAAmC;AACnC,8BAAmD;AAEnD,oBAAmF;AAE5E,MAAM,QAAqC;AAAA,EAChD,SAAS,4CAAC,+BAAY,OAAO,CAAC,WAAW,KAAK,GAAG,OAAM,QAAO,QAAO,QAAO;AAAA,EAC5E,MAAM,4CAAC,4BAAS,OAAO,CAAC,iBAAiB,KAAK,GAAG,OAAM,QAAO,QAAO,QAAO;AAAA,EAC5E,QAAQ,4CAAC,oCAAiB,OAAO,CAAC,UAAU,KAAK,GAAG,OAAM,QAAO,QAAO,QAAO;AAAA,EAC/E,SAAS,4CAAC,iCAAc,OAAO,CAAC,WAAW,KAAK,GAAG,OAAM,QAAO,QAAO,QAAO;AAChF;AAMO,MAAM,kBAA6D,CAAC,UAAU;AACnF,QAAM;AAAA,IACJ;AAAA,IACA,mBAAmB,EAAE,MAAM,OAAO,MAAM,YAAY,UAAU;AAAA,EAChE,IAAI;AACJ,QAAM,uBAAmB,uCAAc,mBAAmB,EAAE,GAAG,MAAM,CAAC;AAEtE,QAAM,UAAU,aAAAA,QAAM,OAA0B,IAAI;AAEpD,QAAM,6BAAyB;AAAA,IAC7B,CAAC,aAAa;AACZ,UAAI,UAAU;AACZ,gBAAQ,UAAU;AAClB,YAAI,aAAa,UAAU,SAAS;AAClC,oBAAU,QAAQ,cAAc,MAAM;AACpC,sBAAU,QAAQ;AAAA,UACpB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AAEA,QAAM,sBAAkB,0BAAY,CAAC,MAA2B;AAC9D,QAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,QAAE,eAAe;AACjB,UAAI,QAAQ,QAAS,SAAQ,QAAQ,MAAM;AAAA,IAC7C;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SACE,4EACE;AAAA,gDAAC,qCAAoB,eAAa,2CAAmB,gBAAiB,GAAG,kBACtE,gBAAM,IAAI,GACb;AAAA,IACA,4CAAC,6BAAY,SAAS,yCAAoB,IAAK,GAAG,kBAC/C,iBACH;AAAA,IACA,6CAAC,gCAAe,IAAI,wCAAgB,SAAS,yCAAoB,IAAK,GAAG,kBACtE;AAAA;AAAA,MACA,cACC,4EAGG;AAAA;AAAA,QACD;AAAA,UAAC;AAAA;AAAA,YACC,eAAa,2CAAmB;AAAA,YAChC,SAAS,WAAW;AAAA,YACpB,MAAM,WAAW;AAAA,YACjB,UAAU;AAAA,YACV,WAAW;AAAA,YACX,UAAU;AAAA,YACV,aAAa,CAAC;AAAA,YACd,OAAO,WAAW;AAAA,YACjB,GAAG;AAAA,YAEH,qBAAW;AAAA;AAAA,QACd;AAAA,SACF;AAAA,OAEJ;AAAA,KACF;AAEJ;",
6
+ "names": ["React"]
7
+ }
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var exported_related_exports = {};
30
30
  __export(exported_related_exports, {
31
+ BANNER_BODY_ID: () => BANNER_BODY_ID,
31
32
  BANNER_TYPES: () => BANNER_TYPES,
32
33
  DSBannerDatatestid: () => DSBannerDatatestid,
33
34
  DSBannerName: () => DSBannerName,
@@ -43,6 +44,7 @@ const BANNER_TYPES = {
43
44
  WARNING: "warning",
44
45
  DANGER: "danger"
45
46
  };
47
+ const BANNER_BODY_ID = "ds-banner-body";
46
48
  const DSBannerSlots = {
47
49
  CONTAINER: "container",
48
50
  INNER_CONTAINER: "inner-container",
@@ -51,7 +53,9 @@ const DSBannerSlots = {
51
53
  SUBTITLE: "subtitle",
52
54
  ICON_CONTAINER: "icon-container",
53
55
  ACTION_LINK: "action-link",
54
- CLOSE_BUTTON: "close-button"
56
+ CLOSE_BUTTON: "close-button",
57
+ LAYOUT: "layout",
58
+ LIVE_REGION_PORTAL: "live-region-portal"
55
59
  };
56
60
  const DSBannerDatatestid = {
57
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\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} 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;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,eAAe;AACrB,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAoBO,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,cAAc;AAChB;AAGO,MAAM,qBAAqB;AAAA,EAChC,OAAI,0CAAwB,cAAc,aAAa;AAAA;AAAA,EAEvD,iBAAiB;AAAA,EACjB,gBAAgB;AAClB;",
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
  }
@@ -43,11 +43,14 @@ const defaultProps = {
43
43
  type: import_exported_related.BANNER_TYPES.INFO,
44
44
  isOpen: true,
45
45
  onClose: () => null,
46
- showCloseButton: true
46
+ showCloseButton: true,
47
+ withLiveRegionAnnouncement: "alert",
48
+ isPageNotice: false
47
49
  };
48
50
  const DSBannerPropTypes = {
49
51
  ...import_ds_props_helpers.globalAttributesPropTypes,
50
52
  ...import_ds_props_helpers.xstyledPropTypes,
53
+ ...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_exported_related.DSBannerName, import_exported_related.DSBannerSlots),
51
54
  containerProps: import_ds_props_helpers.PropTypes.object.description("Set of Properties attached to the main container.").defaultValue({}),
52
55
  label: import_ds_props_helpers.PropTypes.string.description("Banner label.").defaultValue(""),
53
56
  body: import_ds_props_helpers.PropTypes.string.description("Banner body content").defaultValue(""),
@@ -68,7 +71,9 @@ const DSBannerPropTypes = {
68
71
  - focusOnLink: function to focus the banner
69
72
  - focusOnWrapper: function to focus the link
70
73
  `
71
- ).defaultValue({})
74
+ ).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)
72
77
  };
73
78
  const DSBannerPropTypesSchema = DSBannerPropTypes;
74
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 { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport { BANNER_TYPES } 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 }\n\n export interface OptionalProps {\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};\n\nexport const DSBannerPropTypes: DSPropTypesSchema<DSBannerT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n containerProps: PropTypes.object.description('Set of Properties attached to the main container.').defaultValue({}),\n label: PropTypes.string.description('Banner label.').defaultValue(''),\n body: PropTypes.string.description('Banner body content').defaultValue(''),\n CustomBody: PropTypes.func.description('Banner custom content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('Banner type.').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('Callback when the Banner closes.'),\n isOpen: PropTypes.bool.description('Whether the Banner is open or closed.').defaultValue(true),\n showCloseButton: PropTypes.bool.description('Whether to show close button or not.').defaultValue(true),\n closeBtnRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n actionLink: PropTypes.shape({\n label: PropTypes.string,\n onClick: PropTypes.func,\n href: PropTypes.string,\n })\n .description('Properties for the Action Link.')\n .defaultValue({}),\n actionRef: PropTypes.object\n .description(\n `\n Reference to use actions:\n - focusOnLink: function to focus the banner\n - focusOnWrapper: function to focus the link\n `,\n )\n .defaultValue({}),\n};\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,8BAAuE;AACvE,8BAA6B;AAuCtB,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;AACnB;AAEO,MAAM,oBAAwD;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,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;AACpB;AAEO,MAAM,0BAA0B;",
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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