@elliemae/ds-banner 2.2.1 → 2.3.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/DSBanner.js CHANGED
@@ -1,57 +1,62 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- var _jsx = require('@babel/runtime/helpers/jsx');
7
- require('core-js/modules/web.dom-collections.iterator.js');
8
- require('core-js/modules/esnext.async-iterator.filter.js');
9
- require('core-js/modules/esnext.iterator.constructor.js');
10
- require('core-js/modules/esnext.iterator.filter.js');
11
- require('core-js/modules/esnext.async-iterator.for-each.js');
12
- require('core-js/modules/esnext.iterator.for-each.js');
13
- var React = require('react');
14
- var dsIcons = require('@elliemae/ds-icons');
15
- var reactDesc = require('react-desc');
16
- var icons = require('./utils/icons.js');
17
- var propTypes = require('./propTypes.js');
18
- var defaultProps = require('./defaultProps.js');
19
- var styles = require('./styles.js');
20
- var jsxRuntime = require('react/jsx-runtime');
21
-
22
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
23
-
24
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
25
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
26
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
27
-
28
- var _CloseX, _span;
29
-
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
-
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
-
34
- const DSBanner = _ref => {
35
- let {
36
- type,
37
- isOpen,
38
- onClose,
39
- label,
40
- body,
41
- actionLink,
42
- showCloseButton,
43
- containerProps,
44
- actionRef
45
- } = _ref;
46
- const innerContainerRef = React.useRef(null);
47
- const linkRef = React.useRef(null);
48
- const [current, setCurrent] = React.useState(isOpen);
49
- const [isAnimating, setIsAnimating] = React.useState(false);
50
- const [alertTabIndex, setAlertTabIndex] = React.useState(undefined);
51
- const ownerState = {
52
- type
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
53
26
  };
54
- React__default["default"].useEffect(() => {
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var DSBanner_exports = {};
29
+ __export(DSBanner_exports, {
30
+ DSBanner: () => DSBanner,
31
+ DSBannerWithSchema: () => DSBannerWithSchema,
32
+ default: () => DSBanner_default
33
+ });
34
+ var React = __toESM(require("react"));
35
+ var import_react = __toESM(require("react"));
36
+ var import_ds_icons = require("@elliemae/ds-icons");
37
+ var import_react_desc = require("react-desc");
38
+ var import_icons = require("./utils/icons");
39
+ var import_propTypes = require("./propTypes");
40
+ var import_defaultProps = require("./defaultProps");
41
+ var import_styles = require("./styles");
42
+ const DSBanner = ({
43
+ type,
44
+ isOpen,
45
+ onClose,
46
+ label,
47
+ body,
48
+ actionLink,
49
+ showCloseButton,
50
+ containerProps,
51
+ actionRef
52
+ }) => {
53
+ const innerContainerRef = (0, import_react.useRef)(null);
54
+ const linkRef = (0, import_react.useRef)(null);
55
+ const [current, setCurrent] = (0, import_react.useState)(isOpen);
56
+ const [isAnimating, setIsAnimating] = (0, import_react.useState)(false);
57
+ const [alertTabIndex, setAlertTabIndex] = (0, import_react.useState)(void 0);
58
+ const ownerState = { type };
59
+ import_react.default.useEffect(() => {
55
60
  if (actionRef && actionRef.current) {
56
61
  actionRef.current.focusOnWrapper = () => {
57
62
  if (innerContainerRef.current) {
@@ -61,7 +66,6 @@ const DSBanner = _ref => {
61
66
  }, 100);
62
67
  }
63
68
  };
64
-
65
69
  actionRef.current.focusOnLink = () => {
66
70
  if (linkRef.current) {
67
71
  linkRef.current.focus();
@@ -69,64 +73,66 @@ const DSBanner = _ref => {
69
73
  };
70
74
  }
71
75
  }, [actionRef]);
72
- React.useLayoutEffect(() => {
73
- if (isOpen !== current || isOpen) setIsAnimating(true);else setIsAnimating(false);
76
+ (0, import_react.useLayoutEffect)(() => {
77
+ if (isOpen !== current || isOpen)
78
+ setIsAnimating(true);
79
+ else
80
+ setIsAnimating(false);
74
81
  }, [isOpen, current]);
75
- const handleBlur = React.useCallback(() => {
76
- setAlertTabIndex(undefined);
82
+ const handleBlur = (0, import_react.useCallback)(() => {
83
+ setAlertTabIndex(void 0);
77
84
  }, []);
78
- const handleOnKeyDown = React.useCallback(e => {
79
- if (e.key === 'Enter' || e.key === ' ') {
85
+ const handleOnKeyDown = (0, import_react.useCallback)((e) => {
86
+ if (e.key === "Enter" || e.key === " ") {
80
87
  e.preventDefault();
81
- if (linkRef.current) linkRef.current.click();
88
+ if (linkRef.current)
89
+ linkRef.current.click();
82
90
  }
83
91
  }, []);
84
- if (!isAnimating && !isOpen) return null;
85
- return /*#__PURE__*/jsxRuntime.jsx(styles.StyledBannerContainer, _objectSpread(_objectSpread({
86
- type: type,
87
- isOpen: isOpen,
88
- isAnimating: isAnimating,
92
+ if (!isAnimating && !isOpen)
93
+ return null;
94
+ return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledBannerContainer, {
95
+ type,
96
+ isOpen,
97
+ isAnimating,
89
98
  onAnimationEnd: () => setCurrent(isOpen),
90
- "data-testid": "ds-banner-container"
91
- }, containerProps), {}, {
92
- ownerState: ownerState,
93
- children: /*#__PURE__*/jsxRuntime.jsxs(styles.StyledInnerContainer, {
94
- type: type,
95
- isOpen: isOpen,
96
- ref: innerContainerRef,
97
- isAnimating: isAnimating,
98
- "data-testid": "ds-banner",
99
- role: "alert",
100
- tabIndex: alertTabIndex,
101
- onBlur: handleBlur,
102
- children: [/*#__PURE__*/_jsx__default["default"](styles.StyledIconContainer, {
103
- "data-testid": "ds-banner-icon"
104
- }, void 0, icons.icons[type]), /*#__PURE__*/_jsx__default["default"](styles.StyledTitle, {}, void 0, label), /*#__PURE__*/_jsx__default["default"](styles.StyledSubTitle, {}, void 0, /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, body), actionLink && /*#__PURE__*/jsxRuntime.jsx(styles.StyledActionLink, {
105
- "data-testid": "ds-banner-action-link",
106
- onClick: actionLink.onClick,
107
- href: actionLink.href,
108
- ref: linkRef,
109
- onKeyDown: handleOnKeyDown,
110
- tabIndex: 0,
111
- isBodyEmpty: body,
112
- children: actionLink.label
113
- })), showCloseButton ? /*#__PURE__*/_jsx__default["default"](styles.StyledCloseButton, {
114
- "data-testid": "ds-banner-close-button",
115
- buttonType: "secondary",
116
- onClick: onClose,
117
- "aria-label": "Close icon",
118
- icon: _CloseX || (_CloseX = /*#__PURE__*/_jsx__default["default"](dsIcons.CloseX, {
119
- width: "12px",
120
- height: "12px"
121
- }))
122
- }) : _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}))]
99
+ "data-testid": "ds-banner-container",
100
+ ...containerProps,
101
+ ownerState
102
+ }, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledInnerContainer, {
103
+ type,
104
+ isOpen,
105
+ ref: innerContainerRef,
106
+ isAnimating,
107
+ "data-testid": "ds-banner",
108
+ role: "alert",
109
+ tabIndex: alertTabIndex,
110
+ onBlur: handleBlur
111
+ }, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledIconContainer, {
112
+ "data-testid": "ds-banner-icon"
113
+ }, import_icons.icons[type]), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledTitle, null, label), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledSubTitle, null, /* @__PURE__ */ import_react.default.createElement("span", null, body), actionLink && /* @__PURE__ */ import_react.default.createElement(import_styles.StyledActionLink, {
114
+ "data-testid": "ds-banner-action-link",
115
+ onClick: actionLink.onClick,
116
+ href: actionLink.href,
117
+ ref: linkRef,
118
+ onKeyDown: handleOnKeyDown,
119
+ tabIndex: 0,
120
+ isBodyEmpty: body
121
+ }, actionLink.label)), showCloseButton ? /* @__PURE__ */ import_react.default.createElement(import_styles.StyledCloseButton, {
122
+ "data-testid": "ds-banner-close-button",
123
+ buttonType: "secondary",
124
+ onClick: onClose,
125
+ "aria-label": "Close icon",
126
+ icon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.CloseX, {
127
+ width: "12px",
128
+ height: "12px"
123
129
  })
124
- }));
130
+ }) : /* @__PURE__ */ import_react.default.createElement("span", null)));
125
131
  };
126
-
127
- DSBanner.defaultProps = defaultProps.defaultProps;
128
- const DSBannerWithSchema = reactDesc.describe(DSBanner);
129
- DSBannerWithSchema.propTypes = propTypes.propTypes;
130
-
131
- exports.DSBannerWithSchema = DSBannerWithSchema;
132
- exports["default"] = DSBanner;
132
+ DSBanner.defaultProps = import_defaultProps.defaultProps;
133
+ DSBanner.propTypes = import_propTypes.propTypes;
134
+ const DSBannerWithSchema = (0, import_react_desc.describe)(DSBanner);
135
+ DSBannerWithSchema.propTypes = import_propTypes.propTypes;
136
+ var DSBanner_default = DSBanner;
137
+ module.exports = __toCommonJS(DSBanner_exports);
138
+ //# sourceMappingURL=DSBanner.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSBanner.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useLayoutEffect, useRef, useCallback, useState } from 'react';\nimport { CloseX } from '@elliemae/ds-icons';\nimport { describe } from 'react-desc';\nimport type { BannerPropsT } from './index.d';\nimport { icons } from './utils/icons';\nimport { propTypes } from './propTypes';\nimport { defaultProps } from './defaultProps';\nimport {\n StyledActionLink,\n StyledCloseButton,\n StyledInnerContainer,\n StyledBannerContainer,\n StyledIconContainer,\n StyledSubTitle,\n StyledTitle,\n} from './styles';\n\nconst DSBanner = ({\n type,\n isOpen,\n onClose,\n label,\n body,\n actionLink,\n showCloseButton,\n containerProps,\n actionRef,\n}: BannerPropsT): JSX.Element => {\n const innerContainerRef = useRef<HTMLDivElement | null>(null);\n const linkRef = useRef<HTMLAnchorElement | null>(null);\n const [current, setCurrent] = useState<boolean>(isOpen);\n const [isAnimating, setIsAnimating] = useState<boolean>(false);\n const [alertTabIndex, setAlertTabIndex] = useState<number | undefined>(undefined);\n\n const ownerState = { type };\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusOnWrapper = () => {\n if (innerContainerRef.current) {\n setAlertTabIndex(0);\n setTimeout(() => {\n innerContainerRef.current.focus();\n }, 100);\n }\n };\n actionRef.current.focusOnLink = () => {\n if (linkRef.current) {\n linkRef.current.focus();\n }\n };\n }\n }, [actionRef]);\n\n useLayoutEffect(() => {\n if (isOpen !== current || isOpen) setIsAnimating(true);\n else setIsAnimating(false);\n }, [isOpen, current]);\n\n const handleBlur = useCallback(() => {\n setAlertTabIndex(undefined);\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 if (!isAnimating && !isOpen) return null;\n\n return (\n <StyledBannerContainer\n type={type}\n isOpen={isOpen}\n isAnimating={isAnimating}\n onAnimationEnd={() => setCurrent(isOpen)}\n data-testid=\"ds-banner-container\"\n {...containerProps}\n ownerState={ownerState}\n >\n <StyledInnerContainer\n type={type}\n isOpen={isOpen}\n ref={innerContainerRef}\n isAnimating={isAnimating}\n data-testid=\"ds-banner\"\n role=\"alert\"\n tabIndex={alertTabIndex}\n onBlur={handleBlur}\n >\n <StyledIconContainer data-testid=\"ds-banner-icon\">{icons[type]}</StyledIconContainer>\n <StyledTitle>{label}</StyledTitle>\n <StyledSubTitle>\n <span>{body}</span>\n {actionLink && (\n <StyledActionLink\n data-testid=\"ds-banner-action-link\"\n onClick={actionLink.onClick}\n href={actionLink.href}\n ref={linkRef}\n onKeyDown={handleOnKeyDown}\n tabIndex={0}\n isBodyEmpty={body}\n >\n {actionLink.label}\n </StyledActionLink>\n )}\n </StyledSubTitle>\n\n {showCloseButton ? (\n <StyledCloseButton\n data-testid=\"ds-banner-close-button\"\n buttonType=\"secondary\"\n onClick={onClose}\n aria-label=\"Close icon\"\n icon={<CloseX width=\"12px\" height=\"12px\" />}\n />\n ) : (\n <span />\n )}\n </StyledInnerContainer>\n </StyledBannerContainer>\n );\n};\n\nDSBanner.defaultProps = defaultProps;\nDSBanner.propTypes = propTypes;\nconst DSBannerWithSchema = describe(DSBanner);\nDSBannerWithSchema.propTypes = propTypes;\n\nexport default DSBanner;\nexport { DSBanner, DSBannerWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAsE;AACtE,sBAAuB;AACvB,wBAAyB;AAEzB,mBAAsB;AACtB,uBAA0B;AAC1B,0BAA6B;AAC7B,oBAQO;AAEP,MAAM,WAAW,CAAC;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MAC+B;AAC/B,QAAM,oBAAoB,yBAA8B;AACxD,QAAM,UAAU,yBAAiC;AACjD,QAAM,CAAC,SAAS,cAAc,2BAAkB;AAChD,QAAM,CAAC,aAAa,kBAAkB,2BAAkB;AACxD,QAAM,CAAC,eAAe,oBAAoB,2BAA6B;AAEvE,QAAM,aAAa,EAAE;AAErB,uBAAM,UAAU,MAAM;AACpB,QAAI,aAAa,UAAU,SAAS;AAClC,gBAAU,QAAQ,iBAAiB,MAAM;AACvC,YAAI,kBAAkB,SAAS;AAC7B,2BAAiB;AACjB,qBAAW,MAAM;AACf,8BAAkB,QAAQ;AAAA,aACzB;AAAA;AAAA;AAGP,gBAAU,QAAQ,cAAc,MAAM;AACpC,YAAI,QAAQ,SAAS;AACnB,kBAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,KAIrB,CAAC;AAEJ,oCAAgB,MAAM;AACpB,QAAI,WAAW,WAAW;AAAQ,qBAAe;AAAA;AAC5C,qBAAe;AAAA,KACnB,CAAC,QAAQ;AAEZ,QAAM,aAAa,8BAAY,MAAM;AACnC,qBAAiB;AAAA,KAChB;AACH,QAAM,kBAAkB,8BAAY,CAAC,MAA2B;AAC9D,QAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,QAAE;AACF,UAAI,QAAQ;AAAS,gBAAQ,QAAQ;AAAA;AAAA,KAEtC;AAEH,MAAI,CAAC,eAAe,CAAC;AAAQ,WAAO;AAEpC,SACE,mDAAC,qCAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,MAAM,WAAW;AAAA,IACjC,eAAY;AAAA,OACR;AAAA,IACJ;AAAA,KAEA,mDAAC,oCAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA,eAAY;AAAA,IACZ,MAAK;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,KAER,mDAAC,mCAAD;AAAA,IAAqB,eAAY;AAAA,KAAkB,mBAAM,QACzD,mDAAC,2BAAD,MAAc,QACd,mDAAC,8BAAD,MACE,mDAAC,QAAD,MAAO,OACN,cACC,mDAAC,gCAAD;AAAA,IACE,eAAY;AAAA,IACZ,SAAS,WAAW;AAAA,IACpB,MAAM,WAAW;AAAA,IACjB,KAAK;AAAA,IACL,WAAW;AAAA,IACX,UAAU;AAAA,IACV,aAAa;AAAA,KAEZ,WAAW,SAKjB,kBACC,mDAAC,iCAAD;AAAA,IACE,eAAY;AAAA,IACZ,YAAW;AAAA,IACX,SAAS;AAAA,IACT,cAAW;AAAA,IACX,MAAM,mDAAC,wBAAD;AAAA,MAAQ,OAAM;AAAA,MAAO,QAAO;AAAA;AAAA,OAGpC,mDAAC,QAAD;AAAA;AAOV,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,MAAM,qBAAqB,gCAAS;AACpC,mBAAmB,YAAY;AAE/B,IAAO,mBAAQ;",
6
+ "names": []
7
+ }
@@ -1,22 +1,45 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var bannerTypes = require('./utils/bannerTypes.js');
6
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var defaultProps_exports = {};
29
+ __export(defaultProps_exports, {
30
+ defaultProps: () => defaultProps
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_bannerTypes = require("./utils/bannerTypes");
7
34
  const defaultProps = {
8
35
  containerProps: {},
9
- label: '',
10
- body: '',
11
- type: bannerTypes.BANNER_TYPES.INFO,
36
+ label: "",
37
+ body: "",
38
+ type: import_bannerTypes.BANNER_TYPES.INFO,
12
39
  isOpen: true,
13
40
  onClose: () => null,
14
41
  showCloseButton: true,
15
- actionLink: {
16
- label: '',
17
- onClick: () => null,
18
- href: ''
19
- }
42
+ actionLink: { label: "", onClick: () => null, href: "" }
20
43
  };
21
-
22
- exports.defaultProps = defaultProps;
44
+ module.exports = __toCommonJS(defaultProps_exports);
45
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/defaultProps.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { BANNER_TYPES } from './utils/bannerTypes';\n\nexport const defaultProps = {\n containerProps: {},\n label: '',\n body: '',\n type: BANNER_TYPES.INFO,\n isOpen: true,\n onClose: () => null,\n showCloseButton: true,\n actionLink: { label: '', onClick: () => null, href: '' },\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,yBAA6B;AAEtB,MAAM,eAAe;AAAA,EAC1B,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM,gCAAa;AAAA,EACnB,QAAQ;AAAA,EACR,SAAS,MAAM;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY,EAAE,OAAO,IAAI,SAAS,MAAM,MAAM,MAAM;AAAA;",
6
+ "names": []
7
+ }
package/cjs/index.d.js CHANGED
@@ -1,2 +1,27 @@
1
- 'use strict';
2
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __reExport = (target, module2, copyDefault, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
+ }
14
+ return target;
15
+ };
16
+ var __toESM = (module2, isNodeMode) => {
17
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ };
19
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
+ return (module2, temp) => {
21
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
+ };
23
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
+ var index_d_exports = {};
25
+ var React = __toESM(require("react"));
26
+ module.exports = __toCommonJS(index_d_exports);
27
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.d.ts", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport { BANNER_TYPES } from './utils/bannerTypes';\n\ntype BannerTypesT = typeof BANNER_TYPES[keyof typeof BANNER_TYPES];\n\ninterface ActionLinkT {\n label: string;\n onClick: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void | null;\n href: string;\n}\n\nexport interface BannerPropsT {\n type: BannerTypesT;\n isOpen: boolean;\n onClose: () => void | null;\n actionLink: ActionLinkT;\n label: string;\n body: string;\n showCloseButton?: boolean;\n containerProps: Record<string, unknown>;\n actionRef?: any;\n}\n\nexport interface StyledBannerContainerT {\n type: BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n height: number;\n}\n\nexport interface StyledInnerContainerT {\n type: BannerTypesT;\n isOpen: boolean;\n isAnimating: boolean;\n ref: React.MutableRefObject<HTMLDivElement>;\n}\n\nexport interface StyledActionLinkT {\n isBodyEmpty: string;\n ref: React.MutableRefObject<HTMLAnchorElement>;\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
6
+ "names": []
7
+ }
package/cjs/index.js CHANGED
@@ -1,12 +1,37 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSBanner = require('./DSBanner.js');
6
- var bannerTypes = require('./utils/bannerTypes.js');
7
-
8
-
9
-
10
- exports.DSBannerWithSchema = DSBanner.DSBannerWithSchema;
11
- exports["default"] = DSBanner["default"];
12
- exports.BANNER_TYPES = bannerTypes.BANNER_TYPES;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ default: () => import_DSBanner.default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_DSBanner = __toESM(require("./DSBanner"));
34
+ __reExport(src_exports, require("./DSBanner"));
35
+ __reExport(src_exports, require("./utils/bannerTypes"));
36
+ module.exports = __toCommonJS(src_exports);
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export { default } from './DSBanner';\nexport * from './DSBanner';\nexport * from './utils/bannerTypes';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAAwB;AACxB,wBAAc;AACd,wBAAc;",
6
+ "names": []
7
+ }
package/cjs/propTypes.js CHANGED
@@ -1,24 +1,55 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var reactDesc = require('react-desc');
6
- var bannerTypes = require('./utils/bannerTypes.js');
7
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var propTypes_exports = {};
29
+ __export(propTypes_exports, {
30
+ propTypes: () => propTypes
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react_desc = require("react-desc");
34
+ var import_bannerTypes = require("./utils/bannerTypes");
8
35
  const propTypes = {
9
- containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container').defaultValue({}),
10
- label: reactDesc.PropTypes.string.description('banner s label').defaultValue(''),
11
- body: reactDesc.PropTypes.string.description('banner s body content').defaultValue(''),
12
- type: reactDesc.PropTypes.oneOf(Object.values(bannerTypes.BANNER_TYPES)).description('banner s type').defaultValue(bannerTypes.BANNER_TYPES.INFO),
13
- onClose: reactDesc.PropTypes.func.description('function executed when the banner closes'),
14
- isOpen: reactDesc.PropTypes.bool.description('whether the banner is open or closed').defaultValue(true),
15
- showCloseButton: reactDesc.PropTypes.bool.description('whether to show close button or not').defaultValue(true),
16
- actionLink: reactDesc.PropTypes.shape({
17
- label: reactDesc.PropTypes.string,
18
- onClick: reactDesc.PropTypes.func,
19
- href: reactDesc.PropTypes.string
20
- }).description('Properties of the ActionLink component').defaultValue({}),
21
- actionRef: reactDesc.PropTypes.object.description("\n Reference to use actions:\n - focusOnLink: function to focus the banner\n - focusOnWrapper: function to focus the link\n ").defaultValue({})
36
+ containerProps: import_react_desc.PropTypes.object.description("Set of Properties attached to the main container").defaultValue({}),
37
+ label: import_react_desc.PropTypes.string.description("banner s label").defaultValue(""),
38
+ body: import_react_desc.PropTypes.string.description("banner s body content").defaultValue(""),
39
+ type: import_react_desc.PropTypes.oneOf(Object.values(import_bannerTypes.BANNER_TYPES)).description("banner s type").defaultValue(import_bannerTypes.BANNER_TYPES.INFO),
40
+ onClose: import_react_desc.PropTypes.func.description("function executed when the banner closes"),
41
+ isOpen: import_react_desc.PropTypes.bool.description("whether the banner is open or closed").defaultValue(true),
42
+ showCloseButton: import_react_desc.PropTypes.bool.description("whether to show close button or not").defaultValue(true),
43
+ actionLink: import_react_desc.PropTypes.shape({
44
+ label: import_react_desc.PropTypes.string,
45
+ onClick: import_react_desc.PropTypes.func,
46
+ href: import_react_desc.PropTypes.string
47
+ }).description("Properties of the ActionLink component").defaultValue({}),
48
+ actionRef: import_react_desc.PropTypes.object.description(`
49
+ Reference to use actions:
50
+ - focusOnLink: function to focus the banner
51
+ - focusOnWrapper: function to focus the link
52
+ `).defaultValue({})
22
53
  };
23
-
24
- exports.propTypes = propTypes;
54
+ module.exports = __toCommonJS(propTypes_exports);
55
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { PropTypes } from 'react-desc';\nimport { BANNER_TYPES } from './utils/bannerTypes';\n\nexport const propTypes = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container').defaultValue({}),\n label: PropTypes.string.description('banner s label').defaultValue(''),\n body: PropTypes.string.description('banner s body content').defaultValue(''),\n type: PropTypes.oneOf(Object.values(BANNER_TYPES)).description('banner s type').defaultValue(BANNER_TYPES.INFO),\n onClose: PropTypes.func.description('function executed when the banner closes'),\n isOpen: PropTypes.bool.description('whether the banner is open or closed').defaultValue(true),\n showCloseButton: PropTypes.bool.description('whether to show close button or not').defaultValue(true),\n actionLink: PropTypes.shape({\n label: PropTypes.string,\n onClick: PropTypes.func,\n href: PropTypes.string,\n })\n .description('Properties of the ActionLink component')\n .defaultValue({}),\n actionRef: PropTypes.object\n .description(\n `\n Reference to use actions:\n - focusOnLink: function to focus the banner\n - focusOnWrapper: function to focus the link\n `,\n )\n .defaultValue({}),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAC1B,yBAA6B;AAEtB,MAAM,YAAY;AAAA,EACvB,gBAAgB,4BAAU,OAAO,YAAY,oDAAoD,aAAa;AAAA,EAC9G,OAAO,4BAAU,OAAO,YAAY,kBAAkB,aAAa;AAAA,EACnE,MAAM,4BAAU,OAAO,YAAY,yBAAyB,aAAa;AAAA,EACzE,MAAM,4BAAU,MAAM,OAAO,OAAO,kCAAe,YAAY,iBAAiB,aAAa,gCAAa;AAAA,EAC1G,SAAS,4BAAU,KAAK,YAAY;AAAA,EACpC,QAAQ,4BAAU,KAAK,YAAY,wCAAwC,aAAa;AAAA,EACxF,iBAAiB,4BAAU,KAAK,YAAY,uCAAuC,aAAa;AAAA,EAChG,YAAY,4BAAU,MAAM;AAAA,IAC1B,OAAO,4BAAU;AAAA,IACjB,SAAS,4BAAU;AAAA,IACnB,MAAM,4BAAU;AAAA,KAEf,YAAY,0CACZ,aAAa;AAAA,EAChB,WAAW,4BAAU,OAClB,YACC;AAAA;AAAA;AAAA;AAAA,OAMD,aAAa;AAAA;",
6
+ "names": []
7
+ }