@elliemae/ds-banner 3.80.0-next.6 → 3.80.0-next.61

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 (60) hide show
  1. package/dist/cjs/DSBanner.js +31 -58
  2. package/dist/cjs/DSBanner.js.map +3 -3
  3. package/dist/cjs/DSBannerContent.js +24 -23
  4. package/dist/cjs/DSBannerContent.js.map +2 -2
  5. package/dist/cjs/LiveRegionCorrectlyImplemented.js +67 -0
  6. package/dist/cjs/LiveRegionCorrectlyImplemented.js.map +7 -0
  7. package/dist/cjs/{exported-related → constants}/index.js +8 -3
  8. package/dist/cjs/constants/index.js.map +7 -0
  9. package/dist/cjs/index.js +5 -5
  10. package/dist/cjs/index.js.map +2 -2
  11. package/dist/cjs/react-desc-prop-types.js +11 -6
  12. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  13. package/dist/cjs/styles.js +76 -46
  14. package/dist/cjs/styles.js.map +2 -2
  15. package/dist/cjs/typescript-testing/slot-props.js +52 -0
  16. package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
  17. package/dist/cjs/typescript-testing/typescript-banner-valid.js +2 -1
  18. package/dist/cjs/typescript-testing/typescript-banner-valid.js.map +2 -2
  19. package/dist/cjs/useBannerContainer.js +55 -0
  20. package/dist/cjs/useBannerContainer.js.map +7 -0
  21. package/dist/cjs/useBannerExitAnimation.js +66 -0
  22. package/dist/cjs/useBannerExitAnimation.js.map +7 -0
  23. package/dist/cjs/usePageNotice.js +53 -0
  24. package/dist/cjs/usePageNotice.js.map +7 -0
  25. package/dist/esm/DSBanner.js +26 -59
  26. package/dist/esm/DSBanner.js.map +2 -2
  27. package/dist/esm/DSBannerContent.js +24 -23
  28. package/dist/esm/DSBannerContent.js.map +2 -2
  29. package/dist/esm/LiveRegionCorrectlyImplemented.js +37 -0
  30. package/dist/esm/LiveRegionCorrectlyImplemented.js.map +7 -0
  31. package/dist/esm/{exported-related → constants}/index.js +5 -0
  32. package/dist/esm/constants/index.js.map +7 -0
  33. package/dist/esm/index.js +1 -1
  34. package/dist/esm/index.js.map +1 -1
  35. package/dist/esm/react-desc-prop-types.js +8 -3
  36. package/dist/esm/react-desc-prop-types.js.map +2 -2
  37. package/dist/esm/styles.js +56 -26
  38. package/dist/esm/styles.js.map +2 -2
  39. package/dist/esm/typescript-testing/slot-props.js +29 -0
  40. package/dist/esm/typescript-testing/slot-props.js.map +7 -0
  41. package/dist/esm/typescript-testing/typescript-banner-valid.js +2 -1
  42. package/dist/esm/typescript-testing/typescript-banner-valid.js.map +2 -2
  43. package/dist/esm/useBannerContainer.js +25 -0
  44. package/dist/esm/useBannerContainer.js.map +7 -0
  45. package/dist/esm/useBannerExitAnimation.js +36 -0
  46. package/dist/esm/useBannerExitAnimation.js.map +7 -0
  47. package/dist/esm/usePageNotice.js +23 -0
  48. package/dist/esm/usePageNotice.js.map +7 -0
  49. package/dist/types/DSBannerContent.d.ts +2 -0
  50. package/dist/types/LiveRegionCorrectlyImplemented.d.ts +11 -0
  51. package/dist/types/{exported-related → constants}/index.d.ts +9 -0
  52. package/dist/types/index.d.ts +1 -1
  53. package/dist/types/react-desc-prop-types.d.ts +15 -1
  54. package/dist/types/styles.d.ts +6 -4
  55. package/dist/types/useBannerContainer.d.ts +10 -0
  56. package/dist/types/useBannerExitAnimation.d.ts +15 -0
  57. package/dist/types/usePageNotice.d.ts +11 -0
  58. package/package.json +12 -10
  59. package/dist/cjs/exported-related/index.js.map +0 -7
  60. package/dist/esm/exported-related/index.js.map +0 -7
@@ -38,42 +38,18 @@ 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
41
  var import_ds_system = require("@elliemae/ds-system");
44
42
  var import_DSBannerContent = require("./DSBannerContent.js");
45
- var import_exported_related = require("./exported-related/index.js");
43
+ var import_LiveRegionCorrectlyImplemented = require("./LiveRegionCorrectlyImplemented.js");
44
+ var import_constants = require("./constants/index.js");
45
+ var import_useBannerContainer = require("./useBannerContainer.js");
46
+ var import_usePageNotice = require("./usePageNotice.js");
46
47
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
47
48
  var import_styles = require("./styles.js");
48
- const outOfTheBoxCols = ["auto", "fit-content(50%)", "1fr"];
49
+ const outOfTheBoxCols = ["auto", "1fr"];
49
50
  const outOfTheBoxColsSmallLayout = ["auto", "1fr"];
50
51
  const colsWithCustomBody = ["1fr", "auto"];
51
- const typeMap = {
52
- alert: void 0,
53
- polite: "polite",
54
- assertive: "assertive",
55
- none: "off"
56
- };
57
52
  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
- );
77
53
  const DSBanner = (props) => {
78
54
  const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
79
55
  const {
@@ -90,6 +66,7 @@ const DSBanner = (props) => {
90
66
  actionRef,
91
67
  withLiveRegionAnnouncement,
92
68
  isPageNotice,
69
+ bannerId,
93
70
  ...rest
94
71
  } = propsWithDefaults;
95
72
  const { height: globalHeight, ...globalAttrs } = (0, import_ds_props_helpers.useGetGlobalAttributes)(rest);
@@ -101,21 +78,11 @@ const DSBanner = (props) => {
101
78
  if (CustomBody) return colsWithCustomBody;
102
79
  return isSmall ? outOfTheBoxColsSmallLayout : outOfTheBoxCols;
103
80
  }, [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]
81
+ const { handleActionRefForContainer, isContainerRendered, containerExitProps, liveRegionKey } = (0, import_useBannerContainer.useBannerContainer)(
82
+ isOpen,
83
+ actionRef
117
84
  );
118
- const generatedContainerId = (0, import_react.useMemo)(() => `ds-banner-${(0, import_uid.uid)(5)}`, []);
85
+ const { baseId, contentIds, pageNoticeNameProps } = (0, import_usePageNotice.usePageNotice)(propsWithDefaults, props, globalAttrs);
119
86
  const handleOnKeyDownToClose = (0, import_react.useCallback)(
120
87
  (e) => {
121
88
  if (e.key === "Escape") {
@@ -139,27 +106,31 @@ const DSBanner = (props) => {
139
106
  (0, import_react.useEffect)(() => {
140
107
  if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();
141
108
  }, [isOpen, withLiveRegionAnnouncement, read]);
142
- if (!isOpen)
109
+ if (!isContainerRendered)
143
110
  return getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
- LiveRegionCorrectlyImplemented,
111
+ import_LiveRegionCorrectlyImplemented.LiveRegionCorrectlyImplemented,
145
112
  {
146
- id: `${generatedContainerId}-live-region`,
113
+ id: `${baseId}-live-region`,
147
114
  innerRef: liveRegionRef,
148
115
  announcementType: withLiveRegionAnnouncement,
149
- ownerPropsConfig
116
+ ownerPropsConfig,
117
+ globalAttrs
150
118
  }
151
119
  ) : null;
152
120
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
153
121
  import_styles.StyledBannerContainer,
154
122
  {
155
123
  onKeyDown: handleOnKeyDownToClose,
156
- "data-testid": import_exported_related.DSBannerDatatestid.CONTAINER,
124
+ "data-testid": import_constants.DSBannerDatatestid.CONTAINER,
157
125
  innerRef: handleActionRefForContainer,
158
126
  tabIndex: -1,
159
127
  role: isPageNotice ? "region" : void 0,
128
+ $isExpanded: isOpen,
129
+ ...pageNoticeNameProps,
160
130
  ...containerProps,
161
131
  ...globalAttrs,
162
132
  ...xstyledAttrs,
133
+ ...containerExitProps,
163
134
  ...ownerPropsConfig,
164
135
  children: [
165
136
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledBannerLayout, { ...ownerPropsConfig, $type: type, children: [
@@ -168,41 +139,43 @@ const DSBanner = (props) => {
168
139
  {
169
140
  cols: innerContainerCols,
170
141
  "data-type": type,
171
- "data-testid": import_exported_related.DSBannerDatatestid.INNER_CONTAINER,
142
+ "data-testid": import_constants.DSBannerDatatestid.INNER_CONTAINER,
172
143
  role: withLiveRegionAnnouncement === "alert" ? "alert" : void 0,
173
- id: generatedContainerId,
144
+ id: baseId,
174
145
  ...ownerPropsConfig,
175
- children: !CustomBody ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSBannerContent.DSBannerContent, { propsWithDefaults }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomBody, {})
146
+ children: !CustomBody ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSBannerContent.DSBannerContent, { propsWithDefaults, ...contentIds }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomBody, {})
176
147
  }
177
148
  ),
178
149
  !CustomBody && showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
179
150
  import_styles.StyledCloseButton,
180
151
  {
181
- "data-testid": import_exported_related.DSBannerDatatestid.CLOSE_BUTTON,
152
+ "data-testid": import_constants.DSBannerDatatestid.CLOSE_BUTTON,
182
153
  buttonType: "icon",
183
154
  innerRef: closeBtnRef,
184
155
  onClick: onClose,
185
156
  "aria-label": "Visually dismiss the banner",
186
- "aria-describedby": generatedContainerId,
157
+ "aria-describedby": baseId,
187
158
  ...ownerPropsConfig,
188
159
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.CloseX, { width: 12, height: 12 })
189
160
  }
190
161
  ) : null
191
162
  ] }),
192
163
  getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
- LiveRegionCorrectlyImplemented,
164
+ import_LiveRegionCorrectlyImplemented.LiveRegionCorrectlyImplemented,
194
165
  {
195
- id: `${generatedContainerId}-live-region`,
166
+ id: `${baseId}-live-region`,
196
167
  innerRef: liveRegionRef,
197
168
  announcementType: withLiveRegionAnnouncement,
198
- ownerPropsConfig
199
- }
169
+ ownerPropsConfig,
170
+ globalAttrs
171
+ },
172
+ liveRegionKey
200
173
  ) : null
201
174
  ]
202
175
  }
203
176
  );
204
177
  };
205
- DSBanner.displayName = import_exported_related.DSBannerName;
178
+ DSBanner.displayName = import_constants.DSBannerName;
206
179
  const DSBannerWithSchema = (0, import_ds_props_helpers.describe)(DSBanner);
207
180
  DSBannerWithSchema.propTypes = import_react_desc_prop_types.DSBannerPropTypesSchema;
208
181
  var DSBanner_default = DSBanner;
@@ -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 {\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,qBA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AG;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
- "names": ["ReactDOM", "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 { useGetLayoutMode } from '@elliemae/ds-system';\nimport { DSBannerContent } from './DSBannerContent.js';\nimport { LiveRegionCorrectlyImplemented } from './LiveRegionCorrectlyImplemented.js';\nimport { DSBannerDatatestid, DSBannerName } from './constants/index.js';\nimport { useBannerContainer } from './useBannerContainer.js';\nimport { usePageNotice } from './usePageNotice.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBannerPropTypesSchema } from './react-desc-prop-types.js';\nimport { StyledBannerContainer, StyledBannerLayout, StyledCloseButton, StyledInnerContainer } from './styles.js';\n\nconst outOfTheBoxCols = ['auto', '1fr'];\nconst outOfTheBoxColsSmallLayout = ['auto', '1fr'];\nconst colsWithCustomBody = ['1fr', 'auto'];\n\nconst getIsLiveRegion = (type: string) => type === 'polite' || type === 'assertive';\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 bannerId,\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, isContainerRendered, containerExitProps, liveRegionKey } = useBannerContainer(\n isOpen,\n actionRef,\n );\n\n const { baseId, contentIds, pageNoticeNameProps } = usePageNotice(propsWithDefaults, props, globalAttrs);\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 // the container stays mounted while it slides up after closing (see useBannerExitAnimation)\n if (!isContainerRendered)\n return getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${baseId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n globalAttrs={globalAttrs}\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 $isExpanded={isOpen}\n {...pageNoticeNameProps}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n {...containerExitProps}\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={baseId}\n {...ownerPropsConfig}\n >\n {!CustomBody ? <DSBannerContent propsWithDefaults={propsWithDefaults} {...contentIds} /> : <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={baseId}\n {...ownerPropsConfig}\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </StyledBannerLayout>\n {getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n key={liveRegionKey}\n id={`${baseId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n globalAttrs={globalAttrs}\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;AD6FjB;AA7FN,sBAAuB;AACvB,8BAMO;AACP,mBAAuD;AACvD,uBAAiC;AACjC,6BAAgC;AAChC,4CAA+C;AAC/C,uBAAiD;AACjD,gCAAmC;AACnC,2BAA8B;AAE9B,mCAAsD;AACtD,oBAAmG;AAEnG,MAAM,kBAAkB,CAAC,QAAQ,KAAK;AACtC,MAAM,6BAA6B,CAAC,QAAQ,KAAK;AACjD,MAAM,qBAAqB,CAAC,OAAO,MAAM;AAEzC,MAAM,kBAAkB,CAAC,SAAiB,SAAS,YAAY,SAAS;AAExE,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;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,QAAM,EAAE,QAAQ,cAAc,GAAG,YAAY,QAAI,gDAAuB,IAAI;AAC5E,QAAM,uBAAmB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React"]
7
7
  }
@@ -38,7 +38,7 @@ var import_ds_icons = require("@elliemae/ds-icons");
38
38
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
39
39
  var import_ds_typography = require("@elliemae/ds-typography");
40
40
  var import_react = __toESM(require("react"));
41
- var import_exported_related = require("./exported-related/index.js");
41
+ var import_constants = require("./constants/index.js");
42
42
  var import_styles = require("./styles.js");
43
43
  const icons = {
44
44
  success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.SuccessFill, { color: ["success", "900"], width: "20px", height: "20px" }),
@@ -49,6 +49,8 @@ const icons = {
49
49
  const DSBannerContent = (props) => {
50
50
  const {
51
51
  propsWithDefaults,
52
+ titleId,
53
+ bodyId,
52
54
  propsWithDefaults: { type, label, body, actionLink, actionRef }
53
55
  } = props;
54
56
  const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefaults, { ...props });
@@ -73,28 +75,27 @@ const DSBannerContent = (props) => {
73
75
  }
74
76
  }, []);
75
77
  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
- !body ? "" : " ",
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
- ] })
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledIconContainer, { "data-testid": import_constants.DSBannerDatatestid.ICON_CONTAINER, ...ownerPropsConfig, children: icons[type] }),
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledBody, { $isBodyEmpty: !body, ...ownerPropsConfig, children: [
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { id: titleId, variant: import_ds_typography.TYPOGRAPHY_VARIANTS.H5_STRONG, component: "span", ...ownerPropsConfig, children: label }),
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSubTitle, { id: bodyId, variant: import_ds_typography.TYPOGRAPHY_VARIANTS.B1, ...ownerPropsConfig, children: body }),
82
+ actionLink && // its own element (a sibling of the description, not inline in it): the spacing is CSS, not literal spaces.
83
+ // the DSTypography link variant gives the size + DSTypography-root class, the underline/weight pending UX are in styles.tsx
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
+ import_styles.StyledActionLink,
86
+ {
87
+ variant: import_ds_typography.TYPOGRAPHY_VARIANTS.LINK_SML_TITLE,
88
+ "data-testid": import_constants.DSBannerDatatestid.ACTION_LINK,
89
+ onClick: actionLink.onClick,
90
+ href: actionLink.href,
91
+ innerRef: handleActionRefForLink,
92
+ onKeyDown: handleOnKeyDown,
93
+ tabIndex: 0,
94
+ title: actionLink.label,
95
+ ...ownerPropsConfig,
96
+ children: actionLink.label
97
+ }
98
+ )
98
99
  ] })
99
100
  ] });
100
101
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 {!body ? '' : ' '}\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;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elliemae/ds-icons';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { TYPOGRAPHY_VARIANTS } from '@elliemae/ds-typography';\nimport React, { useCallback } from 'react';\nimport { DSBannerDatatestid } from './constants/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { StyledActionLink, StyledIconContainer, StyledSubTitle, StyledTitle, StyledBody } 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 titleId?: string;\n bodyId?: string;\n}\n\nexport const DSBannerContent: React.ComponentType<DSBannerContentProps> = (props) => {\n const {\n propsWithDefaults,\n titleId,\n bodyId,\n propsWithDefaults: { type, label, body, actionLink, actionRef },\n } = props;\n const ownerPropsConfig = useOwnerProps(propsWithDefaults, { ...props });\n\n const linkRef = React.useRef<HTMLElement>(null) as React.MutableRefObject<HTMLElement>;\n\n const handleActionRefForLink = useCallback<React.RefCallback<HTMLElement>>(\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 <StyledBody $isBodyEmpty={!body} {...ownerPropsConfig}>\n {/* h5-strong look, but a span: the title must not inject a heading into the host page outline.\n `component` (not `as`): on a styled(DSTypography) wrapper `as` would replace DSTypography itself. */}\n <StyledTitle id={titleId} variant={TYPOGRAPHY_VARIANTS.H5_STRONG} component=\"span\" {...ownerPropsConfig}>\n {label}\n </StyledTitle>\n <StyledSubTitle id={bodyId} variant={TYPOGRAPHY_VARIANTS.B1} {...ownerPropsConfig}>\n {body}\n </StyledSubTitle>\n {actionLink && (\n // its own element (a sibling of the description, not inline in it): the spacing is CSS, not literal spaces.\n // the DSTypography link variant gives the size + DSTypography-root class, the underline/weight pending UX are in styles.tsx\n <StyledActionLink\n variant={TYPOGRAPHY_VARIANTS.LINK_SML_TITLE}\n data-testid={DSBannerDatatestid.ACTION_LINK}\n onClick={actionLink.onClick}\n href={actionLink.href}\n innerRef={handleActionRefForLink}\n onKeyDown={handleOnKeyDown}\n tabIndex={0}\n title={actionLink.label}\n {...ownerPropsConfig}\n >\n {actionLink.label}\n </StyledActionLink>\n )}\n </StyledBody>\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,uBAAmC;AAEnC,oBAA+F;AAExF,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;AAQO,MAAM,kBAA6D,CAAC,UAAU;AACn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EH,qBAAW;AAAA;AAAA,MACd;AAAA,OAEJ;AAAA,KACF;AAEJ;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,67 @@
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 LiveRegionCorrectlyImplemented_exports = {};
30
+ __export(LiveRegionCorrectlyImplemented_exports, {
31
+ LiveRegionCorrectlyImplemented: () => LiveRegionCorrectlyImplemented
32
+ });
33
+ module.exports = __toCommonJS(LiveRegionCorrectlyImplemented_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react_dom = __toESM(require("react-dom"));
37
+ var import_constants = require("./constants/index.js");
38
+ var import_styles = require("./styles.js");
39
+ const typeMap = {
40
+ alert: void 0,
41
+ polite: "polite",
42
+ assertive: "assertive",
43
+ none: "off"
44
+ };
45
+ const LiveRegionCorrectlyImplemented = ({
46
+ id,
47
+ innerRef,
48
+ announcementType,
49
+ ownerPropsConfig,
50
+ globalAttrs: { lang, dir }
51
+ }) => import_react_dom.default.createPortal(
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
+ import_styles.StyledLiveRegionPortal,
54
+ {
55
+ lang,
56
+ dir,
57
+ id,
58
+ innerRef,
59
+ "aria-atomic": "true",
60
+ "aria-live": typeMap[announcementType],
61
+ "data-testid": import_constants.DSBannerDatatestid.LIVE_REGION_PORTAL,
62
+ ...ownerPropsConfig
63
+ }
64
+ ),
65
+ document.body
66
+ );
67
+ //# sourceMappingURL=LiveRegionCorrectlyImplemented.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/LiveRegionCorrectlyImplemented.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { DSBannerDatatestid } from './constants/index.js';\nimport { StyledLiveRegionPortal } from './styles.js';\n\nconst typeMap = {\n alert: undefined,\n polite: 'polite',\n assertive: 'assertive',\n none: 'off',\n} as const;\n\nexport const LiveRegionCorrectlyImplemented = ({\n id,\n innerRef,\n announcementType,\n ownerPropsConfig,\n globalAttrs: { lang, dir },\n}: {\n id: string;\n innerRef: React.Ref<HTMLDivElement>;\n announcementType: 'alert' | 'polite' | 'assertive' | 'none';\n ownerPropsConfig: Record<string, unknown>;\n globalAttrs: { lang?: string; dir?: string };\n}) =>\n ReactDOM.createPortal(\n <StyledLiveRegionPortal\n // the portal lives in document.body (outside the banner subtree) so it does not inherit lang/dir from the banner\n // only these two are forwarded, the rest of the global attributes belong to the banner container\n lang={lang}\n dir={dir}\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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0BnB;AAzBJ,uBAAqB;AACrB,uBAAmC;AACnC,oBAAuC;AAEvC,MAAM,UAAU;AAAA,EACd,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,MAAM;AACR;AAEO,MAAM,iCAAiC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa,EAAE,MAAM,IAAI;AAC3B,MAOE,iBAAAA,QAAS;AAAA,EACP;AAAA,IAAC;AAAA;AAAA,MAGC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAY;AAAA,MAGZ,aAAW,QAAQ,gBAAgB;AAAA,MACnC,eAAa,oCAAmB;AAAA,MAC/B,GAAG;AAAA;AAAA,EACN;AAAA,EACA,SAAS;AACX;",
6
+ "names": ["ReactDOM"]
7
+ }
@@ -26,15 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var exported_related_exports = {};
30
- __export(exported_related_exports, {
29
+ var constants_exports = {};
30
+ __export(constants_exports, {
31
31
  BANNER_BODY_ID: () => BANNER_BODY_ID,
32
+ BANNER_SLIDE_DURATION_MS: () => BANNER_SLIDE_DURATION_MS,
32
33
  BANNER_TYPES: () => BANNER_TYPES,
33
34
  DSBannerDatatestid: () => DSBannerDatatestid,
34
35
  DSBannerName: () => DSBannerName,
35
36
  DSBannerSlots: () => DSBannerSlots
36
37
  });
37
- module.exports = __toCommonJS(exported_related_exports);
38
+ module.exports = __toCommonJS(constants_exports);
38
39
  var React = __toESM(require("react"));
39
40
  var import_ds_system = require("@elliemae/ds-system");
40
41
  const DSBannerName = "DSBanner";
@@ -44,11 +45,15 @@ const BANNER_TYPES = {
44
45
  WARNING: "warning",
45
46
  DANGER: "danger"
46
47
  };
48
+ const BANNER_SLIDE_DURATION_MS = 500;
47
49
  const BANNER_BODY_ID = "ds-banner-body";
48
50
  const DSBannerSlots = {
49
51
  CONTAINER: "container",
50
52
  INNER_CONTAINER: "inner-container",
53
+ // reserved slot: declared but never rendered. It is part of the public surface (DSBannerDatatestid, dsBannerCustomContainer slot prop)
54
+ // and pinned by DSBanner.data-testid.test.js, so removing it is a breaking change. See KNOWN_INTENTIONAL_DEVIATIONS.md
51
55
  CUSTOM_CONTAINER: "custom-container",
56
+ BODY: "body",
52
57
  TITLE: "title",
53
58
  SUBTITLE: "subtitle",
54
59
  ICON_CONTAINER: "icon-container",
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/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// duration of the slide down (open) and slide up (close) of the banner, defined by the Banner spec v2 \"Motion and Animation\"\nexport const BANNER_SLIDE_DURATION_MS = 500;\n\n/**\n * @deprecated legacy export, no longer rendered or used by the component (PUI-19089).\n * The body used to render with this fixed id, which duplicated across banners. The body id is now\n * `<bannerId>-body`, where `bannerId` is generated per instance or provided through the `bannerId` prop.\n * Kept only so imports of the old constant keep resolving.\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 // reserved slot: declared but never rendered. It is part of the public surface (DSBannerDatatestid, dsBannerCustomContainer slot prop)\n // and pinned by DSBanner.data-testid.test.js, so removing it is a breaking change. See KNOWN_INTENTIONAL_DEVIATIONS.md\n CUSTOM_CONTAINER: 'custom-container',\n BODY: 'body',\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;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,eAAe;AACrB,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAGO,MAAM,2BAA2B;AAQjC,MAAM,iBAAiB;AAoBvB,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,iBAAiB;AAAA;AAAA;AAAA,EAGjB,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,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
+ "names": []
7
+ }
package/dist/cjs/index.js CHANGED
@@ -28,15 +28,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var index_exports = {};
30
30
  __export(index_exports, {
31
- BANNER_TYPES: () => import_exported_related.BANNER_TYPES,
31
+ BANNER_TYPES: () => import_constants.BANNER_TYPES,
32
32
  DSBanner: () => import_DSBanner.DSBanner,
33
- DSBannerDatatestid: () => import_exported_related.DSBannerDatatestid,
34
- DSBannerName: () => import_exported_related.DSBannerName,
35
- DSBannerSlots: () => import_exported_related.DSBannerSlots,
33
+ DSBannerDatatestid: () => import_constants.DSBannerDatatestid,
34
+ DSBannerName: () => import_constants.DSBannerName,
35
+ DSBannerSlots: () => import_constants.DSBannerSlots,
36
36
  DSBannerWithSchema: () => import_DSBanner.DSBannerWithSchema
37
37
  });
38
38
  module.exports = __toCommonJS(index_exports);
39
39
  var React = __toESM(require("react"));
40
40
  var import_DSBanner = require("./DSBanner.js");
41
- var import_exported_related = require("./exported-related/index.js");
41
+ var import_constants = require("./constants/index.js");
42
42
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["// eslint-disable-next-line no-restricted-exports\nexport { DSBanner, DSBannerWithSchema } from './DSBanner.js';\nexport { DSBannerName, BANNER_TYPES, DSBannerSlots, DSBannerDatatestid } from './exported-related/index.js';\nexport type { DSBannerT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,sBAA6C;AAC7C,8BAA8E;",
4
+ "sourcesContent": ["// eslint-disable-next-line no-restricted-exports\nexport { DSBanner, DSBannerWithSchema } from './DSBanner.js';\nexport { DSBannerName, BANNER_TYPES, DSBannerSlots, DSBannerDatatestid } from './constants/index.js';\nexport type { DSBannerT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,sBAA6C;AAC7C,uBAA8E;",
6
6
  "names": []
7
7
  }
@@ -35,12 +35,12 @@ __export(react_desc_prop_types_exports, {
35
35
  module.exports = __toCommonJS(react_desc_prop_types_exports);
36
36
  var React = __toESM(require("react"));
37
37
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
38
- var import_exported_related = require("./exported-related/index.js");
38
+ var import_constants = require("./constants/index.js");
39
39
  const defaultProps = {
40
40
  containerProps: {},
41
41
  label: "",
42
42
  body: "",
43
- type: import_exported_related.BANNER_TYPES.INFO,
43
+ type: import_constants.BANNER_TYPES.INFO,
44
44
  isOpen: true,
45
45
  onClose: () => null,
46
46
  showCloseButton: true,
@@ -50,12 +50,12 @@ const defaultProps = {
50
50
  const DSBannerPropTypes = {
51
51
  ...import_ds_props_helpers.globalAttributesPropTypes,
52
52
  ...import_ds_props_helpers.xstyledPropTypes,
53
- ...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_exported_related.DSBannerName, import_exported_related.DSBannerSlots),
53
+ ...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSBannerName, import_constants.DSBannerSlots),
54
54
  containerProps: import_ds_props_helpers.PropTypes.object.description("Set of Properties attached to the main container.").defaultValue({}),
55
55
  label: import_ds_props_helpers.PropTypes.string.description("Banner label.").defaultValue(""),
56
56
  body: import_ds_props_helpers.PropTypes.string.description("Banner body content").defaultValue(""),
57
57
  CustomBody: import_ds_props_helpers.PropTypes.func.description("Banner custom content").defaultValue(""),
58
- type: import_ds_props_helpers.PropTypes.oneOf(Object.values(import_exported_related.BANNER_TYPES)).description("Banner type.").defaultValue(import_exported_related.BANNER_TYPES.INFO),
58
+ type: import_ds_props_helpers.PropTypes.oneOf(Object.values(import_constants.BANNER_TYPES)).description("Banner type.").defaultValue(import_constants.BANNER_TYPES.INFO),
59
59
  onClose: import_ds_props_helpers.PropTypes.func.description("Callback when the Banner closes."),
60
60
  isOpen: import_ds_props_helpers.PropTypes.bool.description("Whether the Banner is open or closed.").defaultValue(true),
61
61
  showCloseButton: import_ds_props_helpers.PropTypes.bool.description("Whether to show close button or not.").defaultValue(true),
@@ -72,8 +72,13 @@ const DSBannerPropTypes = {
72
72
  - focusOnWrapper: function to focus the link
73
73
  `
74
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)
75
+ withLiveRegionAnnouncement: import_ds_props_helpers.PropTypes.oneOf(["alert", "assertive", "polite", "none"]).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(
77
+ "Whether to add role region to the banner. The region is named by default from the label prop; a name passed via aria-label/aria-labelledby (containerProps or dsBannerContainer) takes precedence."
78
+ ).defaultValue(false),
79
+ bannerId: import_ds_props_helpers.PropTypes.string.description(
80
+ `Base id of the banner. Every id the banner renders derives from it: the inner container uses it as is, the title uses "<bannerId>-title", the body uses "<bannerId>-body" and the live region uses "<bannerId>-live-region". When omitted, a unique base is generated per instance ("ds-banner-<random>"). Must start with a letter. Pass your own to reference the banner parts from aria-describedby / aria-labelledby.`
81
+ )
77
82
  };
78
83
  const DSBannerPropTypesSchema = DSBannerPropTypes;
79
84
  //# 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: '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;",
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 './constants/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 extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSBannerName,\n typeof DSBannerSlots\n > {\n actionLink?: ActionLinkT;\n CustomBody?: React.ComponentType<Record<string, unknown>>;\n closeBtnRef?: React.MutableRefObject<HTMLButtonElement | null> | RefCallback<HTMLButtonElement>;\n actionRef?: MutableRefObject<ActionRef>;\n bannerId?: string;\n }\n export type SlotFunctionArguments = {\n dsBannerContainer: () => object;\n dsBannerInnerContainer: () => object;\n dsBannerCustomContainer: () => object;\n dsBannerBody: () => object;\n dsBannerTitle: () => object;\n dsBannerSubtitle: () => object;\n dsBannerIconContainer: () => object;\n dsBannerActionLink: () => object;\n dsBannerCloseButton: () => object;\n dsBannerLayout: () => object;\n dsBannerLiveRegionPortal: () => object;\n };\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', 'none'])\n .description('Whether to announce the banner content in a live region when it opens.')\n .defaultValue('alert'),\n isPageNotice: PropTypes.bool\n .description(\n 'Whether to add role region to the banner. The region is named by default from the label prop; a name passed via aria-label/aria-labelledby (containerProps or dsBannerContainer) takes precedence.',\n )\n .defaultValue(false),\n bannerId: PropTypes.string.description(\n `Base id of the banner. Every id the banner renders derives from it: the inner container uses it as is, the title uses \"<bannerId>-title\", the body uses \"<bannerId>-body\" and the live region uses \"<bannerId>-live-region\". When omitted, a unique base is generated per instance (\"ds-banner-<random>\"). Must start with a letter. Pass your own to reference the banner parts from aria-describedby / aria-labelledby.`,\n ),\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,uBAA0D;AA2DnD,MAAM,eAAuC;AAAA,EAClD,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM,8BAAa;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,+BAAc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