@ebay/ui-core-react 1.4.2 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/ebay-icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,GAAG,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAIrE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAM9B,oBAAY,WAAW,GAAG,OAAO,CAAC;AAElC,oBAAY,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAE,eAAe,GAAG,MAAM,CAAA;IACvC,IAAI,EAAE,IAAI,CAAC;IACX,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CACrC,CAAC;;AAqEF,wBAAuC"}
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/ebay-icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,GAAG,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAIrE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAQ9B,oBAAY,WAAW,GAAG,OAAO,CAAC;AAElC,oBAAY,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAE,eAAe,GAAG,MAAM,CAAA;IACvC,IAAI,EAAE,IAAI,CAAC;IACX,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CACrC,CAAC;;AAoEF,wBAAuC"}
package/ebay-icon/icon.js CHANGED
@@ -48,8 +48,10 @@ var react_1 = __importStar(require("react"));
48
48
  var classnames_1 = __importDefault(require("classnames"));
49
49
  var component_utils_1 = require("../common/component-utils");
50
50
  var random_id_1 = require("../common/random-id");
51
- var SMALL_ICON_SIZE = 16;
52
- var LARGE_ICON_SIZE = 64;
51
+ var iconPixelSizes = {
52
+ small: 16,
53
+ large: 64
54
+ };
53
55
  var DEFAULT_ICON_SIZE = 24;
54
56
  var EbayIcon = function (_a) {
55
57
  var _b;
@@ -58,29 +60,26 @@ var EbayIcon = function (_a) {
58
60
  react_1.useEffect(function () {
59
61
  setRandomId(random_id_1.randomId());
60
62
  }, []);
61
- var noTitle = a11yVariant === 'label';
63
+ var withAriaLabel = a11yVariant === 'label';
62
64
  var a11yTextId = a11yText && "icon-title-" + rId;
63
65
  var a11yProps = a11yText ? {
64
- 'aria-labelledby': noTitle ? undefined : a11yTextId,
65
- 'aria-label': noTitle ? a11yText : undefined,
66
+ 'aria-labelledby': withAriaLabel ? undefined : a11yTextId,
67
+ 'aria-label': withAriaLabel ? a11yText : undefined,
66
68
  role: 'img'
67
69
  } : {
68
70
  'aria-hidden': true
69
71
  };
70
- var iconSize = getIconSize(name) + "px";
71
72
  var prefixSvg = type === 'icon' ? 'icon-' : '';
72
73
  var kebabName = kebabCased(name);
74
+ var iconSize = getIconPixelSize(kebabName) + "px";
73
75
  var className = classnames_1.default(extraClass, (_b = {}, _b[getIconClass(type, kebabName)] = !noSkinClasses, _b));
74
76
  return (react_1.default.createElement("svg", __assign({ height: iconSize, width: iconSize }, rest, { className: className, xmlns: "http://www.w3.org/2000/svg", focusable: false, ref: forwardedRef }, a11yProps),
75
- a11yText && !noTitle && react_1.default.createElement("title", { id: a11yTextId }, a11yText),
77
+ a11yText && !withAriaLabel && react_1.default.createElement("title", { id: a11yTextId }, a11yText),
76
78
  react_1.default.createElement("use", { xlinkHref: "#" + prefixSvg + kebabName })));
77
79
  };
78
- function getIconSize(iconName) {
80
+ function getIconPixelSize(iconName) {
79
81
  var sizeCandidate = iconName.split('-').slice(-1)[0];
80
- return {
81
- small: SMALL_ICON_SIZE,
82
- large: LARGE_ICON_SIZE
83
- }[sizeCandidate] || DEFAULT_ICON_SIZE;
82
+ return iconPixelSizes[sizeCandidate] || DEFAULT_ICON_SIZE;
84
83
  }
85
84
  function kebabCased(str) {
86
85
  return str.replace(/([A-Z])/g, function (s, c) { return "-" + c.toLowerCase(); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebay/ui-core-react",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Skin components build off React",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",