@ebay/ui-core-react 5.5.0 → 5.6.1

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/README.md CHANGED
@@ -184,6 +184,7 @@ One way to comply those guidelines is to implement your new component as similia
184
184
  ## Changelog
185
185
 
186
186
  `@ebay/ui-core-react`
187
+ ### version 5.x (Skin 16, breaking changes in event callbacks)
187
188
  ### version 4.x (Skin 16, breaking changes in icon names)
188
189
  ### version 3.x (Skin 15, some breaking changes in dialog components)
189
190
  ### version 2.x (Skin 15)
@@ -39,12 +39,15 @@ import "@ebay/skin/section-notice";
39
39
 
40
40
  ## Attributes
41
41
 
42
- | Name | Type | Stateful | Description | Default |
43
- | ---------------------- | -------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
44
- | `status` | String (`"general", "attention"`, `"confirmation"`, or `"information"`) | No | Determines the style and type of notice to be displayed | `"general"` |
45
- | `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. | - |
46
- | `aria-roledescription` | String | No | Adds role description attribute to the section notice | `"Notice"` |
47
- | `children` | React Node | No | The content to be displayed within the notice. **Must have the EbayNoticeContent within the children!** | - |
42
+ | Name | Type | Stateful | Description | Default |
43
+ | ---------------------- | ---------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
44
+ | `status` | String (`"general", "attention"`, `"confirmation"`, `"information"`, `"education"`) | No | Determines the style and type of notice to be displayed | `"general"` |
45
+ | `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. | - |
46
+ | `aria-roledescription` | String | No | Adds role description attribute to the section notice | `"Notice"` |
47
+ | `children` | React Node | No | The content to be displayed within the notice. **Must have the EbayNoticeContent within the children!** | - |
48
+ | `educationIcon` | Icon | No | Icon of the educational banner | `"lightbulb24"`|
49
+ | `iconClass` | String | No | Class that will be added to the icon svg | - |
50
+ | `prominent` | Boolean | No | Sets the educational banner with a more prominent background | `false` |
48
51
 
49
52
  ## Callbacks
50
53
  | Name | Required | Description | Arguments |
@@ -1,5 +1,6 @@
1
1
  import { ComponentProps, FC, KeyboardEventHandler, MouseEventHandler } from 'react';
2
- export declare type SectionNoticeStatus = 'general' | 'none' | 'attention' | 'confirmation' | 'information';
2
+ import { Icon } from '../ebay-icon';
3
+ export declare type SectionNoticeStatus = 'general' | 'none' | 'attention' | 'confirmation' | 'information' | 'education';
3
4
  export declare type Props = ComponentProps<'section'> & {
4
5
  status?: SectionNoticeStatus;
5
6
  'aria-label'?: string;
@@ -7,6 +8,9 @@ export declare type Props = ComponentProps<'section'> & {
7
8
  className?: string;
8
9
  a11yDismissText?: string;
9
10
  onDismiss?: MouseEventHandler & KeyboardEventHandler;
11
+ educationIcon?: Icon;
12
+ iconClass?: string;
13
+ prominent?: boolean;
10
14
  };
11
15
  declare const EbaySectionNotice: FC<Props>;
12
16
  export default EbaySectionNotice;
@@ -1 +1 @@
1
- {"version":3,"file":"section-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-section-notice/section-notice.tsx"],"names":[],"mappings":"AAAA,OAAc,EACV,cAAc,EACd,EAAE,EAEF,oBAAoB,EAEpB,iBAAiB,EAEpB,MAAM,OAAO,CAAA;AAOd,oBAAY,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAA;AACnG,oBAAY,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG;IAC5C,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;CACxD,CAAA;AAED,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAmDhC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
1
+ {"version":3,"file":"section-notice.d.ts","sourceRoot":"","sources":["../../src/ebay-section-notice/section-notice.tsx"],"names":[],"mappings":"AAAA,OAAc,EACV,cAAc,EACd,EAAE,EAEF,oBAAoB,EAEpB,iBAAiB,EAEpB,MAAM,OAAO,CAAA;AAId,OAAO,EAAY,IAAI,EAAE,MAAM,cAAc,CAAA;AAG7C,oBAAY,mBAAmB,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,CAAA;AACjH,oBAAY,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG;IAC5C,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;IACrD,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAA;AAED,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,KAAK,CAoEhC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -51,14 +51,25 @@ var notice_content_1 = __importDefault(require("../common/notice-utils/notice-co
51
51
  var ebay_icon_1 = require("../ebay-icon");
52
52
  var index_1 = require("./index");
53
53
  var EbaySectionNotice = function (_a) {
54
- var _b = _a.status, status = _b === void 0 ? 'general' : _b, children = _a.children, className = _a.className, ariaLabel = _a["aria-label"], _c = _a["aria-roledescription"], ariaRoleDescription = _c === void 0 ? 'Notice' : _c, a11yDismissText = _a.a11yDismissText, _d = _a.onDismiss, onDismiss = _d === void 0 ? function () { } : _d, rest = __rest(_a, ["status", "children", "className", 'aria-label', 'aria-roledescription', "a11yDismissText", "onDismiss"]);
55
- var _e = react_1.useState(false), dismissed = _e[0], setDismissed = _e[1];
54
+ var _b;
55
+ var _c = _a.status, status = _c === void 0 ? 'general' : _c, children = _a.children, className = _a.className, ariaLabel = _a["aria-label"], _d = _a["aria-roledescription"], ariaRoleDescription = _d === void 0 ? 'Notice' : _d, a11yDismissText = _a.a11yDismissText, educationIcon = _a.educationIcon, iconClass = _a.iconClass, prominent = _a.prominent, _e = _a.onDismiss, onDismiss = _e === void 0 ? function () { } : _e, rest = __rest(_a, ["status", "children", "className", 'aria-label', 'aria-roledescription', "a11yDismissText", "educationIcon", "iconClass", "prominent", "onDismiss"]);
56
+ var _f = react_1.useState(false), dismissed = _f[0], setDismissed = _f[1];
56
57
  var childrenArray = react_1.default.Children.toArray(children);
57
58
  var content = childrenArray.find(function (_a) {
58
59
  var type = _a.type;
59
60
  return type === ebay_notice_content_1.EbayNoticeContent;
60
61
  });
61
62
  var hasStatus = status !== 'general' && status !== 'none';
63
+ var isEducational = status === 'education';
64
+ var iconName = null;
65
+ if (hasStatus) {
66
+ if (isEducational) {
67
+ iconName = educationIcon || 'lightbulb24';
68
+ }
69
+ else {
70
+ iconName = status + "Filled16";
71
+ }
72
+ }
62
73
  if (!content) {
63
74
  throw new Error("EbaySectionNotice: Please use a EbayNoticeContent that defines the content of the notice");
64
75
  }
@@ -66,9 +77,13 @@ var EbaySectionNotice = function (_a) {
66
77
  setDismissed(true);
67
78
  onDismiss(event);
68
79
  };
69
- return dismissed ? null : (react_1.default.createElement("section", __assign({}, rest, { className: classnames_1.default(className, "section-notice", hasStatus && "section-notice--" + status), role: "region", "aria-label": !hasStatus ? ariaLabel : null, "aria-labelledby": hasStatus ? "section-notice-" + status : null, "aria-roledescription": ariaRoleDescription }),
70
- hasStatus && (react_1.default.createElement("div", { className: "section-notice__header", id: "section-notice-" + status },
71
- react_1.default.createElement(ebay_icon_1.EbayIcon, { name: status + "Filled16", a11yText: ariaLabel, a11yVariant: "label" }))),
80
+ return dismissed ? null : (react_1.default.createElement("section", __assign({}, rest, { className: classnames_1.default(className, "section-notice", (_b = {},
81
+ _b["section-notice--" + status] = hasStatus,
82
+ _b['section-notice--education'] = isEducational && prominent,
83
+ _b['section-notice--large-icon'] = isEducational,
84
+ _b)), role: "region", "aria-label": !hasStatus ? ariaLabel : null, "aria-labelledby": hasStatus ? "section-notice-" + status : null, "aria-roledescription": ariaRoleDescription }),
85
+ iconName && (react_1.default.createElement("div", { className: "section-notice__header", id: "section-notice-" + status },
86
+ react_1.default.createElement(ebay_icon_1.EbayIcon, { className: iconClass, name: iconName, a11yText: ariaLabel, a11yVariant: "label" }))),
72
87
  react_1.default.createElement(notice_content_1.default, __assign({}, content.props, { type: "section" })),
73
88
  children,
74
89
  a11yDismissText && (react_1.default.createElement(index_1.EbaySectionNoticeFooter, null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebay/ui-core-react",
3
- "version": "5.5.0",
3
+ "version": "5.6.1",
4
4
  "description": "Skin components build off React",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -13,7 +13,8 @@
13
13
  "eslint-local": "eslint . --ext ts,tsx",
14
14
  "eslint": "eslint . --ext .ts,.tsx -f checkstyle -o ./lint/checkstyle-result.xml",
15
15
  "format": "eslint . --fix 'src/**/*.{ts,tsx}'",
16
- "storybook": "start-storybook -p 9001 -c .storybook",
16
+ "storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 9001 -c .storybook",
17
+ "storybook-node16": "start-storybook -p 9001 -c .storybook",
17
18
  "test": "yarn jest",
18
19
  "build": "yarn tsc",
19
20
  "update-icons": "node ./scripts/update-icons",