@cdx-ui/icons 0.0.1-beta.172 → 0.0.1-beta.174

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.
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
+ var _reactNative = require("react-native");
8
9
  var NativeSvg = _interopRequireWildcard(require("react-native-svg"));
9
10
  var _defaultAttributes = _interopRequireWildcard(require("./defaultAttributes"));
10
11
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -24,16 +25,24 @@ const createForgeIcon = (iconName, iconData) => {
24
25
  fill: color,
25
26
  ...rest
26
27
  };
28
+ const accessibilityProps = _reactNative.Platform.OS === 'web' ? isInformative ? {
29
+ role: 'img',
30
+ 'aria-label': accessibilityLabel
31
+ } : {
32
+ 'aria-hidden': true
33
+ } : {
34
+ accessible: isInformative,
35
+ ...(isInformative && {
36
+ accessibilityRole: 'image',
37
+ accessibilityLabel
38
+ })
39
+ };
27
40
  return /*#__PURE__*/(0, _react.createElement)(NativeSvg.Svg, {
28
41
  ref,
29
42
  ..._defaultAttributes.default,
30
43
  width: size,
31
44
  height: size,
32
- accessible: isInformative,
33
- ...(isInformative && {
34
- accessibilityRole: 'image',
35
- accessibilityLabel
36
- }),
45
+ ...accessibilityProps,
37
46
  'data-testid': dataTestId,
38
47
  ...customAttrs
39
48
  }, iconNode.map(([tag, attrs], index) => {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { forwardRef, createElement } from 'react';
4
+ import { Platform } from 'react-native';
4
5
  import * as NativeSvg from 'react-native-svg';
5
6
  import defaultAttributes, { childDefaultAttributes } from './defaultAttributes';
6
7
  const createForgeIcon = (iconName, iconData) => {
@@ -19,16 +20,24 @@ const createForgeIcon = (iconName, iconData) => {
19
20
  fill: color,
20
21
  ...rest
21
22
  };
23
+ const accessibilityProps = Platform.OS === 'web' ? isInformative ? {
24
+ role: 'img',
25
+ 'aria-label': accessibilityLabel
26
+ } : {
27
+ 'aria-hidden': true
28
+ } : {
29
+ accessible: isInformative,
30
+ ...(isInformative && {
31
+ accessibilityRole: 'image',
32
+ accessibilityLabel
33
+ })
34
+ };
22
35
  return /*#__PURE__*/createElement(NativeSvg.Svg, {
23
36
  ref,
24
37
  ...defaultAttributes,
25
38
  width: size,
26
39
  height: size,
27
- accessible: isInformative,
28
- ...(isInformative && {
29
- accessibilityRole: 'image',
30
- accessibilityLabel
31
- }),
40
+ ...accessibilityProps,
32
41
  'data-testid': dataTestId,
33
42
  ...customAttrs
34
43
  }, iconNode.map(([tag, attrs], index) => {
@@ -12,8 +12,7 @@ export interface ForgeIconProps extends SvgProps {
12
12
  size?: string | number;
13
13
  /**
14
14
  * When provided, the icon becomes an accessible element announced by screen readers
15
- * with `accessibilityRole="image"`. When omitted, the icon is decorative and
16
- * hidden from assistive technology (`accessible={false}`).
15
+ * as an image. When omitted, the icon is decorative and hidden from assistive technology.
17
16
  */
18
17
  accessibilityLabel?: string;
19
18
  'data-testid'?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdx-ui/icons",
3
- "version": "0.0.1-beta.172",
3
+ "version": "0.0.1-beta.174",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dfh-candescent-ui/ui-component-framework",