@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
@@ -30,9 +30,11 @@ var styles_exports = {};
30
30
  __export(styles_exports, {
31
31
  StyledActionLink: () => StyledActionLink,
32
32
  StyledBannerContainer: () => StyledBannerContainer,
33
+ StyledBannerLayout: () => StyledBannerLayout,
33
34
  StyledCloseButton: () => StyledCloseButton,
34
35
  StyledIconContainer: () => StyledIconContainer,
35
36
  StyledInnerContainer: () => StyledInnerContainer,
37
+ StyledLiveRegionPortal: () => StyledLiveRegionPortal,
36
38
  StyledSubTitle: () => StyledSubTitle,
37
39
  StyledTitle: () => StyledTitle
38
40
  });
@@ -41,15 +43,18 @@ var React = __toESM(require("react"));
41
43
  var import_ds_button_v2 = require("@elliemae/ds-button-v2");
42
44
  var import_ds_grid = require("@elliemae/ds-grid");
43
45
  var import_ds_system = require("@elliemae/ds-system");
46
+ var import_ds_typography = require("@elliemae/ds-typography");
44
47
  var import_exported_related = require("./exported-related/index.js");
45
- var import_styleHelpers = require("./utils/styleHelpers.js");
46
48
  const StyledBannerContainer = (0, import_ds_system.styled)("div", {
47
49
  name: import_exported_related.DSBannerName,
48
50
  slot: import_exported_related.DSBannerSlots.CONTAINER
49
51
  })`
50
- overflow: ${({ isAnimating }) => !isAnimating ? "visible" : "hidden"};
51
- height: ${({ isAnimating, height }) => !isAnimating ? "auto" : `${height}px`};
52
- ${({ isAnimating, isOpen }) => (0, import_styleHelpers.handleAnimation)(isAnimating, isOpen)};
52
+ min-height: 41px;
53
+ overflow: hidden;
54
+ transition: all 0.5s ease-in;
55
+ @starting-style {
56
+ max-height: 0px;
57
+ }
53
58
  ${import_ds_system.xStyledCommonProps}
54
59
  `;
55
60
  const StyledInnerContainer = (0, import_ds_system.styled)(import_ds_grid.Grid, {
@@ -57,13 +62,38 @@ const StyledInnerContainer = (0, import_ds_system.styled)(import_ds_grid.Grid, {
57
62
  slot: import_exported_related.DSBannerSlots.INNER_CONTAINER
58
63
  })`
59
64
  padding-right: 4px;
60
- min-height: 41px;
65
+ padding-bottom: 6px;
66
+ width: 100%;
67
+ min-width: 0;
68
+ `;
69
+ const handleBorderColor = (type, { colors }) => {
70
+ switch (type) {
71
+ case import_exported_related.BANNER_TYPES.SUCCESS:
72
+ return colors.success[900];
73
+ case import_exported_related.BANNER_TYPES.INFO:
74
+ return colors.brand[600];
75
+ case import_exported_related.BANNER_TYPES.WARNING:
76
+ return colors.warning[900];
77
+ case import_exported_related.BANNER_TYPES.DANGER:
78
+ return colors.danger[900];
79
+ default:
80
+ return "should_not_happen";
81
+ }
82
+ };
83
+ const StyledBannerLayout = (0, import_ds_system.styled)("div", {
84
+ name: import_exported_related.DSBannerName,
85
+ slot: import_exported_related.DSBannerSlots.LAYOUT
86
+ })`
87
+ display: flex;
61
88
  width: 100%;
89
+ align-items: flex-start;
90
+ justify-content: space-between;
62
91
  background-color: neutral-000;
63
- border-bottom: 5px solid ${({ $type, theme }) => (0, import_styleHelpers.handleBorderColor)($type, theme)};
64
- transform: translateY(${({ isOpen }) => isOpen ? "0" : "-100%"});
65
- transition: transform 0.5s ease-in-out;
66
- ${({ isAnimating, isOpen }) => (0, import_styleHelpers.handleAnimation)(isAnimating, isOpen)};
92
+ border-bottom: 5px solid ${({ $type, theme }) => handleBorderColor($type, theme)};
93
+ & > :first-child {
94
+ flex: 1;
95
+ min-width: 0;
96
+ }
67
97
  `;
68
98
  const StyledIconContainer = (0, import_ds_system.styled)("div", {
69
99
  name: import_exported_related.DSBannerName,
@@ -74,47 +104,54 @@ const StyledIconContainer = (0, import_ds_system.styled)("div", {
74
104
  margin-left: ${({ theme }) => theme.space.xs};
75
105
  min-width: 0px;
76
106
  `;
77
- const StyledTitle = (0, import_ds_system.styled)("div", { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.TITLE })`
107
+ const StyledTitle = (0, import_ds_system.styled)(import_ds_typography.DSTypography, { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.TITLE })`
78
108
  color: neutral-700;
79
- font-size: ${({ theme }) => theme.fontSizes.label[400]};
80
109
  font-weight: ${({ theme }) => theme.fontWeights.semibold};
81
110
  padding-top: 9px;
82
- padding-bottom: 9px;
83
- font-size: 14px;
84
111
  overflow-wrap: break-word;
85
112
  white-space: pre-wrap;
86
113
  min-width: 0px;
87
114
  `;
88
- const StyledSubTitle = (0, import_ds_system.styled)("div", { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.SUBTITLE })`
115
+ const StyledSubTitle = (0, import_ds_system.styled)(import_ds_typography.DSTypography, { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.SUBTITLE })`
89
116
  margin-left: ${({ theme }) => theme.space.xs};
90
- font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};
91
117
  font-weight: ${({ theme }) => theme.fontWeights.regular};
92
118
  padding-top: 9px;
93
- padding-bottom: 6px;
94
- font-size: 14px;
95
119
  overflow-wrap: break-word;
96
120
  white-space: pre-wrap;
97
121
  min-width: 0px;
122
+ ${({ theme }) => {
123
+ if (["s", "xs"].includes(theme.layoutMode)) {
124
+ return `
125
+ grid-column: 1 / -1;
126
+ `;
127
+ }
128
+ return "";
129
+ }}
98
130
  `;
99
- const StyledActionLink = (0, import_ds_system.styled)("a", { name: import_exported_related.DSBannerName, slot: import_exported_related.DSBannerSlots.ACTION_LINK })`
100
- margin-left: ${({ theme, isBodyEmpty }) => !isBodyEmpty ? theme.space.xs : 0};
131
+ const StyledActionLink = (0, import_ds_system.styled)("a", {
132
+ name: import_exported_related.DSBannerName,
133
+ slot: import_exported_related.DSBannerSlots.ACTION_LINK
134
+ })`
135
+ display: inline-block;
101
136
  text-decoration: none;
102
- font-size: 14px;
103
- line-height: 14px;
137
+ line-height: inherit;
138
+ + font-size: inherit;
104
139
  font-weight: ${({ theme }) => theme.fontWeights.regular};
105
140
  color: brand-600;
106
141
  min-width: 0px;
107
142
  position: relative;
108
143
  &:focus {
144
+ outline: none;
109
145
  &:after {
110
146
  position: absolute;
111
147
  content: '';
112
- left: 0;
113
- top: 0;
114
- width: 100%;
115
- height: 100%;
148
+ top: -2px;
149
+ left: -2px;
150
+ right: -2px;
151
+ bottom: -2px;
116
152
  border-radius: 2px;
117
153
  border: 2px solid brand-700;
154
+ box-shadow: 0 0 0 1px brand-700;
118
155
  pointer-events: none;
119
156
  }
120
157
  }
@@ -123,7 +160,13 @@ const StyledCloseButton = (0, import_ds_system.styled)(import_ds_button_v2.DSBut
123
160
  name: import_exported_related.DSBannerName,
124
161
  slot: import_exported_related.DSBannerSlots.CLOSE_BUTTON
125
162
  })`
126
- margin-left: ${({ theme }) => theme.space.xxs};
127
- margin-top: 4px;
163
+ margin: 5px;
164
+ `;
165
+ const StyledLiveRegionPortal = (0, import_ds_system.styled)("div", {
166
+ name: import_exported_related.DSBannerName,
167
+ slot: import_exported_related.DSBannerSlots.LIVE_REGION_PORTAL
168
+ })`
169
+ clip: rect(0 0 0 0);
170
+ position: absolute;
128
171
  `;
129
172
  //# sourceMappingURL=styles.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/styles.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { ColorProps, LayoutProps, SizingProps, SpaceProps } from '@elliemae/ds-system';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\nimport { DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { handleAnimation, handleBorderColor } from './utils/styleHelpers.js';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {\n isOpen: boolean;\n isAnimating: boolean;\n height: number;\n}\n\ninterface StyledInnerContainerT {\n $type: DSBannerT.BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n}\n\ninterface StyledActionLinkT {\n isBodyEmpty: boolean;\n}\n\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n overflow: ${({ isAnimating }) => (!isAnimating ? 'visible' : 'hidden')};\n height: ${({ isAnimating, height }) => (!isAnimating ? 'auto' : `${height}px`)};\n ${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};\n ${xStyledCommonProps}\n`;\n\nexport const StyledInnerContainer = styled(Grid, {\n name: DSBannerName,\n slot: DSBannerSlots.INNER_CONTAINER,\n})<StyledInnerContainerT>`\n padding-right: 4px;\n min-height: 41px;\n width: 100%;\n background-color: neutral-000;\n border-bottom: 5px solid ${({ $type, theme }) => handleBorderColor($type, theme)};\n transform: translateY(${({ isOpen }) => (isOpen ? '0' : '-100%')});\n transition: transform 0.5s ease-in-out;\n ${({ isAnimating, isOpen }) => handleAnimation(isAnimating, isOpen)};\n`;\n\nexport const StyledIconContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.ICON_CONTAINER,\n})`\n padding-top: 8px;\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n min-width: 0px;\n`;\n\nexport const StyledTitle = styled('div', { name: DSBannerName, slot: DSBannerSlots.TITLE })`\n color: neutral-700;\n font-size: ${({ theme }) => theme.fontSizes.label[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n padding-top: 9px;\n padding-bottom: 9px;\n font-size: 14px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledSubTitle = styled('div', { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })`\n margin-left: ${({ theme }) => theme.space.xs};\n font-size: ${({ theme }) => theme.fontSizes.subTitle[400]};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n padding-top: 9px;\n padding-bottom: 6px;\n font-size: 14px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledActionLink = styled('a', { name: DSBannerName, slot: DSBannerSlots.ACTION_LINK })<StyledActionLinkT>`\n margin-left: ${({ theme, isBodyEmpty }) => (!isBodyEmpty ? theme.space.xs : 0)};\n text-decoration: none;\n font-size: 14px;\n line-height: 14px;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n color: brand-600;\n min-width: 0px;\n position: relative;\n &:focus {\n &:after {\n position: absolute;\n content: '';\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n border: 2px solid brand-700;\n pointer-events: none;\n }\n }\n`;\nexport const StyledCloseButton = styled(DSButtonV2, {\n name: DSBannerName,\n slot: DSBannerSlots.CLOSE_BUTTON,\n})`\n margin-left: ${({ theme }) => theme.space.xxs};\n margin-top: 4px;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA2B;AAC3B,qBAAqB;AAErB,uBAA2C;AAG3C,8BAA4C;AAE5C,0BAAmD;AAkB5C,MAAM,4BAAwB,yBAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA,cACa,CAAC,EAAE,YAAY,MAAO,CAAC,cAAc,YAAY,QAAS;AAAA,YAC5D,CAAC,EAAE,aAAa,OAAO,MAAO,CAAC,cAAc,SAAS,GAAG,MAAM,IAAK;AAAA,IAC5E,CAAC,EAAE,aAAa,OAAO,UAAM,qCAAgB,aAAa,MAAM,CAAC;AAAA,IACjE,mCAAkB;AAAA;AAGf,MAAM,2BAAuB,yBAAO,qBAAM;AAAA,EAC/C,M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I/D,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBlD,MAAM,wBAAoB,yBAAO,gCAAY;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA,iBACgB,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,GAAG;AAAA;AAAA;",
4
+ "sourcesContent": ["import { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport type { ColorProps, LayoutProps, SizingProps, SpaceProps } from '@elliemae/ds-system';\nimport { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\nimport { BANNER_TYPES, DSBannerName, DSBannerSlots } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\n\ninterface StyledBannerContainerT extends SizingProps, LayoutProps, SpaceProps, ColorProps {}\nexport const StyledBannerContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.CONTAINER,\n})<StyledBannerContainerT>`\n min-height: 41px;\n overflow: hidden;\n transition: all 0.5s ease-in;\n @starting-style {\n max-height: 0px;\n }\n ${xStyledCommonProps}\n`;\n\ninterface StyledInnerContainerT {}\nexport const StyledInnerContainer = styled(Grid, {\n name: DSBannerName,\n slot: DSBannerSlots.INNER_CONTAINER,\n})<StyledInnerContainerT>`\n padding-right: 4px;\n padding-bottom: 6px;\n width: 100%;\n min-width: 0;\n`;\n\nconst handleBorderColor = (\n type: DSBannerT.BannerTypesT,\n { colors }: { colors: Record<string, Record<string, string>> },\n): string => {\n switch (type) {\n case BANNER_TYPES.SUCCESS:\n return colors.success[900];\n case BANNER_TYPES.INFO:\n return colors.brand[600];\n case BANNER_TYPES.WARNING:\n return colors.warning[900];\n case BANNER_TYPES.DANGER:\n return colors.danger[900];\n default:\n return 'should_not_happen';\n }\n};\ninterface StyledBannerLayoutT {\n $type: DSBannerT.BannerTypesT;\n}\nexport const StyledBannerLayout = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.LAYOUT,\n})<StyledBannerLayoutT>`\n display: flex;\n width: 100%;\n align-items: flex-start;\n justify-content: space-between;\n background-color: neutral-000;\n border-bottom: 5px solid ${({ $type, theme }) => handleBorderColor($type, theme)};\n & > :first-child {\n flex: 1;\n min-width: 0;\n }\n`;\n\nexport const StyledIconContainer = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.ICON_CONTAINER,\n})`\n padding-top: 8px;\n margin-right: ${({ theme }) => theme.space.xxs};\n margin-left: ${({ theme }) => theme.space.xs};\n min-width: 0px;\n`;\n\nexport const StyledTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlots.TITLE })`\n color: neutral-700;\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n padding-top: 9px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n`;\n\nexport const StyledSubTitle = styled(DSTypography, { name: DSBannerName, slot: DSBannerSlots.SUBTITLE })`\n margin-left: ${({ theme }) => theme.space.xs};\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n padding-top: 9px;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n min-width: 0px;\n ${({ theme }) => {\n if (['s', 'xs'].includes(theme.layoutMode!)) {\n return `\n grid-column: 1 / -1;\n `;\n }\n return '';\n }}\n`;\n\ninterface StyledActionLinkT {\n isBodyEmpty: boolean;\n}\nexport const StyledActionLink = styled('a', {\n name: DSBannerName,\n slot: DSBannerSlots.ACTION_LINK,\n})<StyledActionLinkT>`\n display: inline-block;\n text-decoration: none;\n line-height: inherit;\n+ font-size: inherit;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n color: brand-600;\n min-width: 0px;\n position: relative;\n &:focus {\n outline: none;\n &:after {\n position: absolute;\n content: '';\n top: -2px;\n left: -2px;\n right: -2px;\n bottom: -2px;\n border-radius: 2px;\n border: 2px solid brand-700;\n box-shadow: 0 0 0 1px brand-700;\n pointer-events: none;\n }\n }\n`;\nexport const StyledCloseButton = styled(DSButtonV2, {\n name: DSBannerName,\n slot: DSBannerSlots.CLOSE_BUTTON,\n})`\n margin: 5px;\n`;\n\nexport const StyledLiveRegionPortal = styled('div', {\n name: DSBannerName,\n slot: DSBannerSlots.LIVE_REGION_PORTAL,\n})`\n clip: rect(0 0 0 0);\n position: absolute;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA2B;AAC3B,qBAAqB;AAErB,uBAA2C;AAC3C,2BAA6B;AAG7B,8BAA0D;AAInD,MAAM,4BAAwB,yBAAO,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOG,mCAAkB;AAAA;AAIf,MAAM,2BAAuB,yBAAO,qBAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOD,MAAM,oBAAoB,CACxB,MACA,EAAE,OAAO,MACE;AACX,UAAQ,MAAM;AAAA,IACZ,KAAK,qCAAa;AAChB,aAAO,OAAO,QAAQ,GAAG;AAAA,IAC3B,KAAK,qCAAa;AAChB,aAAO,OAAO,MAAM,GAAG;AAAA,IACzB,KAAK,qCAAa;AAChB,aAAO,OAAO,QAAQ,GAAG;AAAA,IAC3B,KAAK,qCAAa;AAChB,aAAO,OAAO,OAAO,GAAG;AAAA,IAC1B;AACE,aAAO;AAAA,EACX;AACF;AAIO,MAAM,yBAAqB,yBAAO,OAAO;AAAA,EAC9C,MAAM;AAAA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,wBAAoB,yBAAO,gCAAY;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAIM,MAAM,6BAAyB,yBAAO,OAAO;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,sCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -56,7 +56,9 @@ const testCompleteDefaults = {
56
56
  type: "info",
57
57
  isOpen: true,
58
58
  onClose: () => null,
59
- showCloseButton: true
59
+ showCloseButton: true,
60
+ withLiveRegionAnnouncement: "alert",
61
+ isPageNotice: false
60
62
  };
61
63
  const testInternalProps = {
62
64
  ...testRequiredProps,
@@ -72,19 +74,25 @@ const testExplicitDefinition = {
72
74
  label: "",
73
75
  body: "",
74
76
  type: "info",
75
- isOpen: true
77
+ isOpen: true,
78
+ withLiveRegionAnnouncement: "alert",
79
+ isPageNotice: false
76
80
  };
77
81
  const testInferedTypeCompatibility = {
78
82
  label: "",
79
83
  body: "",
80
84
  type: "info",
81
- isOpen: true
85
+ isOpen: true,
86
+ withLiveRegionAnnouncement: "alert",
87
+ isPageNotice: false
82
88
  };
83
89
  const testDefinitionAsConst = {
84
90
  label: "",
85
91
  body: "",
86
92
  type: "info",
87
- isOpen: true
93
+ isOpen: true,
94
+ withLiveRegionAnnouncement: "alert",
95
+ isPageNotice: false
88
96
  };
89
97
  const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
90
98
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSBanner, { ...testExplicitDefinition }),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-banner-valid.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBanner } from '../index.js';\nimport type { DSBannerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBannerT.Props;\ntype ComponentPropsInternals = DSBannerT.InternalProps;\ntype ComponentPropsDefaultProps = DSBannerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSBannerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSBannerT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionLink: {\n label: 'test',\n onClick: () => {},\n href: 'test',\n },\n CustomBody: () => <div>test</div>,\n closeBtnRef: () => null,\n actionRef: { current: {} },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n label: 'hello',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: {},\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSBanner {...testExplicitDefinition} />\n <DSBanner {...testInferedTypeCompatibility} />\n <DSBanner {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSBanner label=\"hello\" body=\"body\" type=\"danger\" isOpen />\n </>\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACkBH;AAjBpB,eAAyB;AAUzB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,YAAY;AAAA,IACV,OAAO;AAAA,IACP,SAAS,MAAM;AAAA,IAAC;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,YAAY,MAAM,4CAAC,SAAI,kBAAI;AAAA,EAC3B,aAAa,MAAM;AAAA,EACnB,WAAW,EAAE,SAAS,CAAC,EAAE;AAC3B;AAIA,MAAM,sBAA2D;AAAA,EAC/D,OAAO;AACT;AACA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AACnB;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AACV;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,qBAAU,GAAG,wBAAwB;AAAA,EACtC,4CAAC,qBAAU,GAAG,8BAA8B;AAAA,EAC5C,4CAAC,qBAAU,GAAG,uBAAuB;AAAA,EAErC,4CAAC,qBAAS,OAAM,SAAQ,MAAK,QAAO,MAAK,UAAS,QAAM,MAAC;AAAA,GAC3D;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSBanner } from '../index.js';\nimport type { DSBannerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSBannerT.Props;\ntype ComponentPropsInternals = DSBannerT.InternalProps;\ntype ComponentPropsDefaultProps = DSBannerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSBannerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSBannerT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n actionLink: {\n label: 'test',\n onClick: () => {},\n href: 'test',\n },\n CustomBody: () => <div>test</div>,\n closeBtnRef: () => null,\n actionRef: { current: {} },\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n label: 'hello',\n};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: {},\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: '',\n body: '',\n type: 'info',\n isOpen: true,\n withLiveRegionAnnouncement: 'alert',\n isPageNotice: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSBanner {...testExplicitDefinition} />\n <DSBanner {...testInferedTypeCompatibility} />\n <DSBanner {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSBanner label=\"hello\" body=\"body\" type=\"danger\" isOpen />\n </>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACkBH;AAjBpB,eAAyB;AAUzB,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD;AAAA,EACrD,YAAY;AAAA,IACV,OAAO;AAAA,IACP,SAAS,MAAM;AAAA,IAAC;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,YAAY,MAAM,4CAAC,SAAI,kBAAI;AAAA,EAC3B,aAAa,MAAM;AAAA,EACnB,WAAW,EAAE,SAAS,CAAC,EAAE;AAC3B;A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,5 @@
1
1
  import * as React from "react";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CloseX } from "@elliemae/ds-icons";
4
4
  import {
5
5
  describe,
@@ -8,19 +8,49 @@ import {
8
8
  useMemoMergePropsWithDefault,
9
9
  useOwnerProps
10
10
  } from "@elliemae/ds-props-helpers";
11
- import React2, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
11
+ import React2, { useCallback, useEffect, useMemo } from "react";
12
+ import ReactDOM from "react-dom";
13
+ import { uid } from "uid";
14
+ import { useGetLayoutMode } from "@elliemae/ds-system";
15
+ import { DSBannerContent } from "./DSBannerContent.js";
12
16
  import { DSBannerDatatestid, DSBannerName } from "./exported-related/index.js";
13
17
  import { defaultProps, DSBannerPropTypesSchema } from "./react-desc-prop-types.js";
14
18
  import {
15
- StyledActionLink,
19
+ StyledLiveRegionPortal,
16
20
  StyledBannerContainer,
21
+ StyledBannerLayout,
17
22
  StyledCloseButton,
18
- StyledIconContainer,
19
- StyledInnerContainer,
20
- StyledSubTitle,
21
- StyledTitle
23
+ StyledInnerContainer
22
24
  } from "./styles.js";
23
- import { icons } from "./utils/icons.js";
25
+ const outOfTheBoxCols = ["auto", "fit-content(50%)", "1fr"];
26
+ const outOfTheBoxColsSmallLayout = ["auto", "1fr"];
27
+ const colsWithCustomBody = ["1fr", "auto"];
28
+ const typeMap = {
29
+ alert: void 0,
30
+ polite: "polite",
31
+ assertive: "assertive",
32
+ none: "off"
33
+ };
34
+ const getIsLiveRegion = (type) => type === "polite" || type === "assertive";
35
+ const LiveRegionCorrectlyImplemented = ({
36
+ id,
37
+ innerRef,
38
+ announcementType,
39
+ ownerPropsConfig
40
+ }) => ReactDOM.createPortal(
41
+ /* @__PURE__ */ jsx(
42
+ StyledLiveRegionPortal,
43
+ {
44
+ id,
45
+ innerRef,
46
+ "aria-atomic": "true",
47
+ "aria-live": typeMap[announcementType],
48
+ "data-testid": DSBannerDatatestid.LIVE_REGION_PORTAL,
49
+ ...ownerPropsConfig
50
+ }
51
+ ),
52
+ document.body
53
+ );
24
54
  const DSBanner = (props) => {
25
55
  const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps);
26
56
  const {
@@ -35,48 +65,34 @@ const DSBanner = (props) => {
35
65
  showCloseButton,
36
66
  containerProps,
37
67
  actionRef,
68
+ withLiveRegionAnnouncement,
69
+ isPageNotice,
38
70
  ...rest
39
71
  } = propsWithDefaults;
40
72
  const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);
41
73
  const ownerPropsConfig = useOwnerProps(propsWithDefaults, { ...props });
42
74
  const xstyledAttrs = useGetXstyledProps(rest);
43
- const innerContainerRef = useRef(null);
44
- const linkRef = useRef(null);
45
- let { current } = useRef(false);
46
- const [isAnimating, setIsAnimating] = useState(false);
47
- const [height, setHeight] = useState(0);
48
- const [alertTabIndex, setAlertTabIndex] = useState(void 0);
49
- useEffect(() => {
50
- if (innerContainerRef.current) {
51
- setHeight(innerContainerRef.current.offsetHeight);
52
- }
53
- }, [isAnimating, isOpen]);
54
- useEffect(() => {
55
- if (actionRef && actionRef.current) {
56
- actionRef.current.focusOnWrapper = () => {
57
- if (innerContainerRef.current) {
58
- setAlertTabIndex(0);
59
- setTimeout(() => {
60
- innerContainerRef.current?.focus();
61
- }, 300);
62
- }
63
- };
64
- actionRef.current.focusOnLink = () => {
65
- if (linkRef.current) {
66
- linkRef.current.focus();
67
- }
68
- };
69
- }
70
- }, [actionRef]);
71
- const handleBlur = useCallback(() => {
72
- setAlertTabIndex(void 0);
73
- }, []);
74
- const handleOnKeyDown = useCallback((e) => {
75
- if (e.key === "Enter" || e.key === " ") {
76
- e.preventDefault();
77
- if (linkRef.current) linkRef.current.click();
78
- }
79
- }, []);
75
+ const layoutMode = useGetLayoutMode();
76
+ const isSmall = layoutMode === "s" || layoutMode === "xs";
77
+ const innerContainerCols = useMemo(() => {
78
+ if (CustomBody) return colsWithCustomBody;
79
+ return isSmall ? outOfTheBoxColsSmallLayout : outOfTheBoxCols;
80
+ }, [CustomBody, isSmall]);
81
+ const handleActionRefForContainer = useCallback(
82
+ (containerNode) => {
83
+ if (containerNode && actionRef && actionRef.current) {
84
+ actionRef.current.focusOnWrapper = () => {
85
+ if (containerNode) {
86
+ setTimeout(() => {
87
+ containerNode?.focus();
88
+ }, 300);
89
+ }
90
+ };
91
+ }
92
+ },
93
+ [actionRef]
94
+ );
95
+ const generatedContainerId = useMemo(() => `ds-banner-${uid(5)}`, []);
80
96
  const handleOnKeyDownToClose = useCallback(
81
97
  (e) => {
82
98
  if (e.key === "Escape") {
@@ -86,85 +102,80 @@ const DSBanner = (props) => {
86
102
  },
87
103
  [onClose]
88
104
  );
89
- useLayoutEffect(() => {
90
- if (isOpen !== current || isOpen) setIsAnimating(true);
91
- else setIsAnimating(false);
92
- }, [isOpen, current]);
93
- const innerCols = React2.useMemo(() => {
94
- if (!CustomBody) {
95
- const finalCols = ["auto", "fit-content(50%)", "1fr"];
96
- if (showCloseButton) finalCols.push("auto");
97
- return finalCols;
105
+ const liveRegionRef = React2.useRef(null);
106
+ const isOpenRef = React2.useRef(isOpen);
107
+ isOpenRef.current = isOpen;
108
+ const textToAnnounceRef = React2.useRef(`${label} ${body}`);
109
+ textToAnnounceRef.current = `${label} ${body}`;
110
+ const read = React2.useCallback(() => {
111
+ if (liveRegionRef.current) {
112
+ if (isOpenRef.current) liveRegionRef.current.textContent = textToAnnounceRef.current;
113
+ else liveRegionRef.current.textContent = "";
98
114
  }
99
- return ["1fr", "auto"];
100
- }, [CustomBody, showCloseButton]);
101
- if (!isAnimating && !isOpen) return null;
102
- return /* @__PURE__ */ jsx(
115
+ }, []);
116
+ useEffect(() => {
117
+ if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();
118
+ }, [isOpen, withLiveRegionAnnouncement, read]);
119
+ if (!isOpen)
120
+ return getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ jsx(
121
+ LiveRegionCorrectlyImplemented,
122
+ {
123
+ id: `${generatedContainerId}-live-region`,
124
+ innerRef: liveRegionRef,
125
+ announcementType: withLiveRegionAnnouncement,
126
+ ownerPropsConfig
127
+ }
128
+ ) : null;
129
+ return /* @__PURE__ */ jsxs(
103
130
  StyledBannerContainer,
104
131
  {
105
- isOpen,
106
- height,
107
132
  onKeyDown: handleOnKeyDownToClose,
108
- isAnimating,
109
- onAnimationEnd: () => {
110
- current = isOpen;
111
- setIsAnimating(false);
112
- },
113
133
  "data-testid": DSBannerDatatestid.CONTAINER,
134
+ innerRef: handleActionRefForContainer,
135
+ tabIndex: -1,
136
+ role: isPageNotice ? "region" : void 0,
114
137
  ...containerProps,
115
138
  ...globalAttrs,
116
139
  ...xstyledAttrs,
117
140
  ...ownerPropsConfig,
118
- children: /* @__PURE__ */ jsx(
119
- StyledInnerContainer,
120
- {
121
- cols: innerCols,
122
- $type: type,
123
- "data-type": type,
124
- isOpen,
125
- innerRef: innerContainerRef,
126
- isAnimating,
127
- "data-testid": DSBannerDatatestid.INNER_CONTAINER,
128
- role: "alert",
129
- tabIndex: alertTabIndex,
130
- onBlur: handleBlur,
131
- ...ownerPropsConfig,
132
- children: !CustomBody ? /* @__PURE__ */ jsxs(Fragment, { children: [
133
- /* @__PURE__ */ jsx(StyledIconContainer, { "data-testid": DSBannerDatatestid.ICON_CONTAINER, ...ownerPropsConfig, children: icons[type] }),
134
- /* @__PURE__ */ jsx(StyledTitle, { ...ownerPropsConfig, children: label }),
135
- /* @__PURE__ */ jsxs(StyledSubTitle, { ...ownerPropsConfig, children: [
136
- /* @__PURE__ */ jsx("span", { children: body }),
137
- actionLink && /* @__PURE__ */ jsx(
138
- StyledActionLink,
139
- {
140
- "data-testid": DSBannerDatatestid.ACTION_LINK,
141
- onClick: actionLink.onClick,
142
- href: actionLink.href,
143
- innerRef: linkRef,
144
- onKeyDown: handleOnKeyDown,
145
- tabIndex: 0,
146
- isBodyEmpty: !body,
147
- title: actionLink.label,
148
- ...ownerPropsConfig,
149
- children: actionLink.label
150
- }
151
- )
152
- ] }),
153
- showCloseButton ? /* @__PURE__ */ jsx(
154
- StyledCloseButton,
155
- {
156
- "data-testid": DSBannerDatatestid.CLOSE_BUTTON,
157
- buttonType: "icon",
158
- innerRef: closeBtnRef,
159
- onClick: onClose,
160
- "aria-label": "Close icon",
161
- ...ownerPropsConfig,
162
- children: /* @__PURE__ */ jsx(CloseX, { width: 12, height: 12 })
163
- }
164
- ) : null
165
- ] }) : /* @__PURE__ */ jsx(CustomBody, {})
166
- }
167
- )
141
+ children: [
142
+ /* @__PURE__ */ jsxs(StyledBannerLayout, { ...ownerPropsConfig, $type: type, children: [
143
+ /* @__PURE__ */ jsx(
144
+ StyledInnerContainer,
145
+ {
146
+ cols: innerContainerCols,
147
+ "data-type": type,
148
+ "data-testid": DSBannerDatatestid.INNER_CONTAINER,
149
+ role: withLiveRegionAnnouncement === "alert" ? "alert" : void 0,
150
+ id: generatedContainerId,
151
+ ...ownerPropsConfig,
152
+ children: !CustomBody ? /* @__PURE__ */ jsx(DSBannerContent, { propsWithDefaults }) : /* @__PURE__ */ jsx(CustomBody, {})
153
+ }
154
+ ),
155
+ !CustomBody && showCloseButton ? /* @__PURE__ */ jsx(
156
+ StyledCloseButton,
157
+ {
158
+ "data-testid": DSBannerDatatestid.CLOSE_BUTTON,
159
+ buttonType: "icon",
160
+ innerRef: closeBtnRef,
161
+ onClick: onClose,
162
+ "aria-label": "Visually dismiss the banner",
163
+ "aria-describedby": generatedContainerId,
164
+ ...ownerPropsConfig,
165
+ children: /* @__PURE__ */ jsx(CloseX, { width: 12, height: 12 })
166
+ }
167
+ ) : null
168
+ ] }),
169
+ getIsLiveRegion(withLiveRegionAnnouncement) ? /* @__PURE__ */ jsx(
170
+ LiveRegionCorrectlyImplemented,
171
+ {
172
+ id: `${generatedContainerId}-live-region`,
173
+ innerRef: liveRegionRef,
174
+ announcementType: withLiveRegionAnnouncement,
175
+ ownerPropsConfig
176
+ }
177
+ ) : null
178
+ ]
168
179
  }
169
180
  );
170
181
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSBanner.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { 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"],
5
- "mappings": "AAAA,YAAY,WAAW;ACkJb,mBACE,KAIA,YALF;AAjJV,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,OAAOA,UAAS,aAAa,WAAW,iBAAiB,QAAQ,gBAAgB;AACjF,SAAS,oBAAoB,oBAAoB;AAEjD,SAAS,cAAc,+BAA+B;AACtD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AAEtB,MAAM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AQ;AAAA,UACP,GAAG;AAAA,UAEH,WAAC,aACA,iCACE;AAAA,gCAAC,uBAAoB,eAAa,mBAAmB,gBAAiB,GAAG,kBACtE,gBAAM,IAAI,GACb;AAAA,YACA,oBAAC,eAAa,GAAG,kBAAmB,iBAAM;AAAA,YAC1C,qBAAC,kBAAgB,GAAG,kBAClB;AAAA,kCAAC,UAAM,gBAAK;AAAA,cACX,cACC;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAa,mBAAmB;AAAA,kBAChC,SAAS,WAAW;AAAA,kBACpB,MAAM,WAAW;AAAA,kBACjB,UAAU;AAAA,kBACV,WAAW;AAAA,kBACX,UAAU;AAAA,kBACV,aAAa,CAAC;AAAA,kBACd,OAAO,WAAW;AAAA,kBACjB,GAAG;AAAA,kBAEH,qBAAW;AAAA;AAAA,cACd;AAAA,eAEJ;AAAA,YACC,kBACC;AAAA,cAAC;AAAA;AAAA,gBACC,eAAa,mBAAmB;AAAA,gBAChC,YAAW;AAAA,gBACX,UAAU;AAAA,gBACV,SAAS;AAAA,gBACT,cAAW;AAAA,gBACV,GAAG;AAAA,gBAEJ,8BAAC,UAAO,OAAO,IAAI,QAAQ,IAAI;AAAA;AAAA,YACjC,IACE;AAAA,aACN,IAEA,oBAAC,cAAW;AAAA;AAAA,MAEhB;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { CloseX } from '@elliemae/ds-icons';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { uid } from 'uid';\nimport { useGetLayoutMode } from '@elliemae/ds-system';\nimport { DSBannerContent } from './DSBannerContent.js';\nimport { DSBannerDatatestid, DSBannerName } from './exported-related/index.js';\nimport type { DSBannerT } from './react-desc-prop-types.js';\nimport { defaultProps, DSBannerPropTypesSchema } from './react-desc-prop-types.js';\nimport {\n StyledLiveRegionPortal,\n StyledBannerContainer,\n StyledBannerLayout,\n StyledCloseButton,\n StyledInnerContainer,\n} from './styles.js';\n\nconst outOfTheBoxCols = ['auto', 'fit-content(50%)', '1fr'];\nconst outOfTheBoxColsSmallLayout = ['auto', '1fr'];\nconst colsWithCustomBody = ['1fr', 'auto'];\nconst typeMap = {\n alert: undefined,\n polite: 'polite',\n assertive: 'assertive',\n none: 'off',\n} as const;\n\nconst getIsLiveRegion = (type: string) => type === 'polite' || type === 'assertive';\n\nconst LiveRegionCorrectlyImplemented = ({\n id,\n innerRef,\n announcementType,\n ownerPropsConfig,\n}: {\n id: string;\n innerRef: React.Ref<HTMLDivElement>;\n announcementType: 'alert' | 'polite' | 'assertive' | 'none';\n ownerPropsConfig: Record<string, unknown>;\n}) =>\n ReactDOM.createPortal(\n <StyledLiveRegionPortal\n id={id}\n innerRef={innerRef}\n aria-atomic=\"true\"\n // off is never going to be printed because this portal is not printed when announcement is none\n // the off is just a quick hack to circumvent typescript typechecks in the static building\n aria-live={typeMap[announcementType]}\n data-testid={DSBannerDatatestid.LIVE_REGION_PORTAL}\n {...ownerPropsConfig}\n />,\n document.body,\n );\n\nconst DSBanner: React.ComponentType<DSBannerT.Props> = (props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSBannerT.InternalProps>(props, defaultProps);\n\n const {\n type,\n isOpen,\n onClose,\n label,\n body,\n closeBtnRef,\n CustomBody,\n actionLink,\n showCloseButton,\n containerProps,\n actionRef,\n withLiveRegionAnnouncement,\n isPageNotice,\n ...rest\n } = propsWithDefaults;\n // eslint-disable-next-line no-unused-vars\n const { height: globalHeight, ...globalAttrs } = useGetGlobalAttributes(rest);\n const ownerPropsConfig = useOwnerProps(propsWithDefaults, { ...props });\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const layoutMode = useGetLayoutMode();\n const isSmall = layoutMode === 's' || layoutMode === 'xs';\n const innerContainerCols = useMemo(() => {\n if (CustomBody) return colsWithCustomBody;\n return isSmall ? outOfTheBoxColsSmallLayout : outOfTheBoxCols;\n }, [CustomBody, isSmall]);\n\n const handleActionRefForContainer = useCallback<React.RefCallback<HTMLDivElement>>(\n (containerNode) => {\n if (containerNode && actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (containerNode) {\n setTimeout(() => {\n containerNode?.focus();\n }, 300);\n }\n };\n }\n },\n [actionRef],\n );\n\n const generatedContainerId = useMemo(() => `ds-banner-${uid(5)}`, []);\n\n const handleOnKeyDownToClose = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClose();\n }\n },\n [onClose],\n );\n\n const liveRegionRef = React.useRef<HTMLDivElement>(null);\n const isOpenRef = React.useRef(isOpen);\n isOpenRef.current = isOpen;\n const textToAnnounceRef = React.useRef(`${label} ${body}`);\n textToAnnounceRef.current = `${label} ${body}`;\n const read = React.useCallback(() => {\n if (liveRegionRef.current) {\n if (isOpenRef.current) liveRegionRef.current.textContent = textToAnnounceRef.current;\n else liveRegionRef.current.textContent = '';\n }\n }, []);\n\n useEffect(() => {\n if (isOpen && getIsLiveRegion(withLiveRegionAnnouncement)) read();\n }, [isOpen, withLiveRegionAnnouncement, read]);\n\n // this used to \"try\" to animate the banner closing\n // in reality the closing animation has never actually worked (the banner just disappears, due to using \"&&\" instead of \"||\" in the logic)\n // given that it has never worked, and the complexity it adds to the code, we are officially removing the closing animation for now\n // if there is a future need for it, we can re-visit adding it back in.\n if (!isOpen)\n return getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${generatedContainerId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n />\n ) : null;\n\n return (\n <StyledBannerContainer\n onKeyDown={handleOnKeyDownToClose}\n data-testid={DSBannerDatatestid.CONTAINER}\n innerRef={handleActionRefForContainer}\n tabIndex={-1}\n role={isPageNotice ? 'region' : undefined}\n {...containerProps}\n {...globalAttrs}\n {...xstyledAttrs}\n {...ownerPropsConfig}\n >\n <StyledBannerLayout {...ownerPropsConfig} $type={type}>\n <StyledInnerContainer\n cols={innerContainerCols}\n data-type={type}\n data-testid={DSBannerDatatestid.INNER_CONTAINER}\n role={withLiveRegionAnnouncement === 'alert' ? 'alert' : undefined}\n id={generatedContainerId}\n {...ownerPropsConfig}\n >\n {!CustomBody ? <DSBannerContent propsWithDefaults={propsWithDefaults} /> : <CustomBody />}\n </StyledInnerContainer>\n {!CustomBody && showCloseButton ? (\n <StyledCloseButton\n data-testid={DSBannerDatatestid.CLOSE_BUTTON}\n buttonType=\"icon\"\n innerRef={closeBtnRef}\n onClick={onClose}\n aria-label=\"Visually dismiss the banner\"\n aria-describedby={generatedContainerId}\n {...ownerPropsConfig}\n >\n <CloseX width={12} height={12} />\n </StyledCloseButton>\n ) : null}\n </StyledBannerLayout>\n {getIsLiveRegion(withLiveRegionAnnouncement) ? (\n <LiveRegionCorrectlyImplemented\n id={`${generatedContainerId}-live-region`}\n innerRef={liveRegionRef}\n announcementType={withLiveRegionAnnouncement}\n ownerPropsConfig={ownerPropsConfig}\n />\n ) : null}\n </StyledBannerContainer>\n );\n};\n\nDSBanner.displayName = DSBannerName;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = DSBannerPropTypesSchema;\n\nexport default DSBanner;\nexport { DSBanner, DSBannerWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACgDnB,cAiHE,YAjHF;AAhDJ,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAOA,UAAS,aAAa,WAAW,eAAe;AACvD,OAAO,cAAc;AACrB,SAAS,WAAW;AACpB,SAAS,wBAAwB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