@ebay/ui-core-react 1.7.3 → 1.8.0
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/common/notice-utils/notice-cta.d.ts +8 -0
- package/common/notice-utils/notice-cta.d.ts.map +1 -0
- package/common/notice-utils/notice-cta.js +34 -0
- package/ebay-page-notice/README.md +4 -1
- package/ebay-page-notice/index.d.ts +1 -0
- package/ebay-page-notice/index.d.ts.map +1 -1
- package/ebay-page-notice/index.js +2 -0
- package/ebay-page-notice/page-notice-cta.d.ts +8 -0
- package/ebay-page-notice/page-notice-cta.d.ts.map +1 -0
- package/ebay-page-notice/page-notice-cta.js +12 -0
- package/ebay-page-notice/page-notice.d.ts +3 -1
- package/ebay-page-notice/page-notice.d.ts.map +1 -1
- package/ebay-page-notice/page-notice.js +33 -4
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
declare type Props = React.HTMLProps<HTMLDivElement> & {
|
|
3
|
+
type: 'window' | 'section' | 'page';
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const NoticeCTA: FC<Props>;
|
|
7
|
+
export default NoticeCTA;
|
|
8
|
+
//# sourceMappingURL=notice-cta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notice-cta.d.ts","sourceRoot":"","sources":["../../../src/common/notice-utils/notice-cta.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAGjC,aAAK,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG;IAC3C,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAA;AAED,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,KAAK,CAIxB,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
var react_1 = __importDefault(require("react"));
|
|
29
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
30
|
+
var NoticeCTA = function (_a) {
|
|
31
|
+
var className = _a.className, type = _a.type, children = _a.children, rest = __rest(_a, ["className", "type", "children"]);
|
|
32
|
+
return (react_1.default.createElement("p", __assign({ className: classnames_1.default(className, type + "-notice__cta") }, rest), children));
|
|
33
|
+
};
|
|
34
|
+
exports.default = NoticeCTA;
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
EbayNoticeContent,
|
|
13
13
|
EbayPageNoticeTitle,
|
|
14
14
|
EbayPageNoticeFooter,
|
|
15
|
+
EbayPageNoticeCTA
|
|
15
16
|
} from '@ebay/ui-core-react/ebay-page-notice'
|
|
16
17
|
```
|
|
17
18
|
|
|
@@ -43,6 +44,8 @@ import "@ebay/skin/page-notice";
|
|
|
43
44
|
|
|
44
45
|
| Name | Type | Stateful | Description | Default |
|
|
45
46
|
| ------------ | ----------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
46
|
-
| `status` | String ( `"general"`,`"attention"`, `"confirmation"`, or `"information"`) | No | Determines the style and type of notice to be displayed
|
|
47
|
+
| `status` | String ( `"general"`,`"attention"`, `"confirmation"`, or `"information"`) | No | Determines the style and type of notice to be displayed | `"general"` |
|
|
47
48
|
| `aria-label` | String | No | The description of the notice itself for screen readers. Check out [this issue](https://github.com/eBay/skin/issues/1001) for more context. | - |
|
|
48
49
|
| `children` | React Node | No | The content to be displayed within the notice | - |
|
|
50
|
+
| `a11yDismissText` | String | No | Determines if the notice will have a dismiss button. Acts as the aria-label for the dismiss button. Should not be used with a footer. | - |
|
|
51
|
+
| `onDismissed` | Dispatch<boolean> | No | Handler for any extra functionality for after a notice is dismissed. | - |
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as EbayPageNotice } from './page-notice';
|
|
2
2
|
export { default as EbayPageNoticeTitle } from './page-notice-title';
|
|
3
3
|
export { default as EbayPageNoticeFooter } from './page-notice-footer';
|
|
4
|
+
export { default as EbayPageNoticeCTA } from './page-notice-cta';
|
|
4
5
|
export { EbayNoticeContent } from '../ebay-notice-base/components/ebay-notice-content';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-page-notice/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ebay-page-notice/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA"}
|
|
@@ -6,5 +6,7 @@ var page_notice_title_1 = require("./page-notice-title");
|
|
|
6
6
|
Object.defineProperty(exports, "EbayPageNoticeTitle", { enumerable: true, get: function () { return page_notice_title_1.default; } });
|
|
7
7
|
var page_notice_footer_1 = require("./page-notice-footer");
|
|
8
8
|
Object.defineProperty(exports, "EbayPageNoticeFooter", { enumerable: true, get: function () { return page_notice_footer_1.default; } });
|
|
9
|
+
var page_notice_cta_1 = require("./page-notice-cta");
|
|
10
|
+
Object.defineProperty(exports, "EbayPageNoticeCTA", { enumerable: true, get: function () { return page_notice_cta_1.default; } });
|
|
9
11
|
var ebay_notice_content_1 = require("../ebay-notice-base/components/ebay-notice-content");
|
|
10
12
|
Object.defineProperty(exports, "EbayNoticeContent", { enumerable: true, get: function () { return ebay_notice_content_1.EbayNoticeContent; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-notice-cta.d.ts","sourceRoot":"","sources":["../../src/ebay-page-notice/page-notice-cta.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAG5C,aAAK,KAAK,GAAG;IACT,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB,CAAA;AAED,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAIhC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var notice_cta_1 = __importDefault(require("../common/notice-utils/notice-cta"));
|
|
8
|
+
var EbayPageNoticeCTA = function (_a) {
|
|
9
|
+
var className = _a.className, children = _a.children;
|
|
10
|
+
return (react_1.default.createElement(notice_cta_1.default, { className: className, type: "page" }, children));
|
|
11
|
+
};
|
|
12
|
+
exports.default = EbayPageNoticeCTA;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { Dispatch, FC, MouseEvent } from 'react';
|
|
2
2
|
declare type Props = React.HTMLProps<HTMLElement> & {
|
|
3
3
|
status?: 'general' | 'attention' | 'confirmation' | 'information';
|
|
4
4
|
'aria-label'?: string;
|
|
5
|
+
a11yDismissText: string;
|
|
6
|
+
onDismiss?: Dispatch<MouseEvent>;
|
|
5
7
|
};
|
|
6
8
|
declare const EbayPageNotice: FC<Props>;
|
|
7
9
|
export default EbayPageNotice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-page-notice/page-notice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"page-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-page-notice/page-notice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAA0B,MAAM,OAAO,CAAA;AAK/E,aAAK,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG;IACxC,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAC;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAA;CACnC,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,KAAK,CAoD7B,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -10,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
13
32
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
33
|
var t = {};
|
|
15
34
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,21 +44,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
45
|
};
|
|
27
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
var react_1 =
|
|
47
|
+
var react_1 = __importStar(require("react"));
|
|
29
48
|
var notice_content_1 = __importDefault(require("../common/notice-utils/notice-content"));
|
|
30
49
|
var ebay_notice_content_1 = require("../ebay-notice-base/components/ebay-notice-content");
|
|
31
50
|
var ebay_icon_1 = require("../ebay-icon");
|
|
32
51
|
var EbayPageNotice = function (_a) {
|
|
33
|
-
var _b = _a.status, status = _b === void 0 ? 'general' : _b, children = _a.children, ariaLabel = _a["aria-label"], rest = __rest(_a, ["status", "children", 'aria-label']);
|
|
52
|
+
var _b = _a.status, status = _b === void 0 ? 'general' : _b, children = _a.children, onDismiss = _a.onDismiss, a11yDismissText = _a.a11yDismissText, ariaLabel = _a["aria-label"], rest = __rest(_a, ["status", "children", "onDismiss", "a11yDismissText", 'aria-label']);
|
|
53
|
+
var _c = react_1.useState(false), dismissed = _c[0], setDismissed = _c[1];
|
|
34
54
|
var childrenArray = react_1.default.Children.toArray(children);
|
|
35
55
|
var content = childrenArray.find(function (child) { return child.type === ebay_notice_content_1.EbayNoticeContent; });
|
|
36
56
|
if (!content) {
|
|
37
57
|
throw new Error("EbayPageNotice: Please use a EbayNoticeContent that defines the content of the notice");
|
|
38
58
|
}
|
|
39
|
-
|
|
59
|
+
var handleDismissedClicked = function (event) {
|
|
60
|
+
setDismissed(true);
|
|
61
|
+
if (onDismiss) {
|
|
62
|
+
onDismiss(event);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return dismissed ? null : (react_1.default.createElement("section", __assign({}, rest, { "aria-labelledby": status + "-status", className: "page-notice " + (status !== "general" ? "page-notice--" + status : ""), role: "region" }),
|
|
40
66
|
status !== "general" ? (react_1.default.createElement("div", { className: "page-notice__header", id: status + "-status" },
|
|
41
67
|
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: status + "FilledSmall", a11yText: ariaLabel, a11yVariant: "label" }))) : null,
|
|
42
68
|
react_1.default.createElement(notice_content_1.default, __assign({}, content.props, { type: "page" })),
|
|
43
|
-
children
|
|
69
|
+
children,
|
|
70
|
+
a11yDismissText && (react_1.default.createElement("div", { className: "page-notice__footer" },
|
|
71
|
+
react_1.default.createElement("button", { "aria-label": a11yDismissText, className: "fake-link page-notice__dismiss", onClick: handleDismissedClicked },
|
|
72
|
+
react_1.default.createElement(ebay_icon_1.EbayIcon, { name: 'close-small' }))))));
|
|
44
73
|
};
|
|
45
74
|
exports.default = EbayPageNotice;
|