@radix-ui/react-accessible-icon 0.0.0-20250116175529

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 ADDED
@@ -0,0 +1,13 @@
1
+ # `react-accessible-icon`
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ $ yarn add @radix-ui/react-accessible-icon
7
+ # or
8
+ $ npm install @radix-ui/react-accessible-icon
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ View docs [here](https://radix-ui.com/primitives/docs/utilities/accessible-icon).
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ interface AccessibleIconProps {
4
+ children?: React.ReactNode;
5
+ /**
6
+ * The accessible label for the icon. This label will be visually hidden but announced to screen
7
+ * reader users, similar to `alt` text for `img` tags.
8
+ */
9
+ label: string;
10
+ }
11
+ declare const AccessibleIcon: React.FC<AccessibleIconProps>;
12
+ declare const Root: React.FC<AccessibleIconProps>;
13
+
14
+ export { AccessibleIcon, type AccessibleIconProps, Root };
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+
3
+ interface AccessibleIconProps {
4
+ children?: React.ReactNode;
5
+ /**
6
+ * The accessible label for the icon. This label will be visually hidden but announced to screen
7
+ * reader users, similar to `alt` text for `img` tags.
8
+ */
9
+ label: string;
10
+ }
11
+ declare const AccessibleIcon: React.FC<AccessibleIconProps>;
12
+ declare const Root: React.FC<AccessibleIconProps>;
13
+
14
+ export { AccessibleIcon, type AccessibleIconProps, Root };
package/dist/index.js ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/react/accessible-icon/src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ AccessibleIcon: () => AccessibleIcon,
34
+ Root: () => Root2
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+
38
+ // packages/react/accessible-icon/src/AccessibleIcon.tsx
39
+ var React = __toESM(require("react"));
40
+ var VisuallyHiddenPrimitive = __toESM(require("@radix-ui/react-visually-hidden"));
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var NAME = "AccessibleIcon";
43
+ var AccessibleIcon = ({ children, label }) => {
44
+ const child = React.Children.only(children);
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
46
+ React.cloneElement(child, {
47
+ // accessibility
48
+ "aria-hidden": "true",
49
+ focusable: "false"
50
+ // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable
51
+ }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHiddenPrimitive.Root, { children: label })
53
+ ] });
54
+ };
55
+ AccessibleIcon.displayName = NAME;
56
+ var Root2 = AccessibleIcon;
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/AccessibleIcon.tsx"],
4
+ "sourcesContent": ["export {\n AccessibleIcon,\n //\n Root,\n} from './AccessibleIcon';\nexport type { AccessibleIconProps } from './AccessibleIcon';\n", "import * as React from 'react';\nimport * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';\n\nconst NAME = 'AccessibleIcon';\n\ninterface AccessibleIconProps {\n children?: React.ReactNode;\n /**\n * The accessible label for the icon. This label will be visually hidden but announced to screen\n * reader users, similar to `alt` text for `img` tags.\n */\n label: string;\n}\n\nconst AccessibleIcon: React.FC<AccessibleIconProps> = ({ children, label }) => {\n const child = React.Children.only(children);\n return (\n <>\n {React.cloneElement(child as React.ReactElement<React.SVGAttributes<SVGElement>>, {\n // accessibility\n 'aria-hidden': 'true',\n focusable: 'false', // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable\n })}\n <VisuallyHiddenPrimitive.Root>{label}</VisuallyHiddenPrimitive.Root>\n </>\n );\n};\n\nAccessibleIcon.displayName = NAME;\n\nconst Root = AccessibleIcon;\n\nexport {\n AccessibleIcon,\n //\n Root,\n};\nexport type { AccessibleIconProps };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,cAAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,8BAAyC;AAgBrC;AAdJ,IAAM,OAAO;AAWb,IAAM,iBAAgD,CAAC,EAAE,UAAU,MAAM,MAAM;AAC7E,QAAM,QAAc,eAAS,KAAK,QAAQ;AAC1C,SACE,4EACG;AAAA,IAAM,mBAAa,OAA8D;AAAA;AAAA,MAEhF,eAAe;AAAA,MACf,WAAW;AAAA;AAAA,IACb,CAAC;AAAA,IACD,4CAAyB,8BAAxB,EAA8B,iBAAM;AAAA,KACvC;AAEJ;AAEA,eAAe,cAAc;AAE7B,IAAMC,QAAO;",
6
+ "names": ["Root", "Root"]
7
+ }
package/dist/index.mjs ADDED
@@ -0,0 +1,24 @@
1
+ // packages/react/accessible-icon/src/AccessibleIcon.tsx
2
+ import * as React from "react";
3
+ import * as VisuallyHiddenPrimitive from "@radix-ui/react-visually-hidden";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ var NAME = "AccessibleIcon";
6
+ var AccessibleIcon = ({ children, label }) => {
7
+ const child = React.Children.only(children);
8
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
9
+ React.cloneElement(child, {
10
+ // accessibility
11
+ "aria-hidden": "true",
12
+ focusable: "false"
13
+ // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable
14
+ }),
15
+ /* @__PURE__ */ jsx(VisuallyHiddenPrimitive.Root, { children: label })
16
+ ] });
17
+ };
18
+ AccessibleIcon.displayName = NAME;
19
+ var Root2 = AccessibleIcon;
20
+ export {
21
+ AccessibleIcon,
22
+ Root2 as Root
23
+ };
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/AccessibleIcon.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';\n\nconst NAME = 'AccessibleIcon';\n\ninterface AccessibleIconProps {\n children?: React.ReactNode;\n /**\n * The accessible label for the icon. This label will be visually hidden but announced to screen\n * reader users, similar to `alt` text for `img` tags.\n */\n label: string;\n}\n\nconst AccessibleIcon: React.FC<AccessibleIconProps> = ({ children, label }) => {\n const child = React.Children.only(children);\n return (\n <>\n {React.cloneElement(child as React.ReactElement<React.SVGAttributes<SVGElement>>, {\n // accessibility\n 'aria-hidden': 'true',\n focusable: 'false', // See: https://allyjs.io/tutorials/focusing-in-svg.html#making-svg-elements-focusable\n })}\n <VisuallyHiddenPrimitive.Root>{label}</VisuallyHiddenPrimitive.Root>\n </>\n );\n};\n\nAccessibleIcon.displayName = NAME;\n\nconst Root = AccessibleIcon;\n\nexport {\n AccessibleIcon,\n //\n Root,\n};\nexport type { AccessibleIconProps };\n"],
5
+ "mappings": ";AAAA,YAAY,WAAW;AACvB,YAAY,6BAA6B;AAgBrC,mBAME,KANF;AAdJ,IAAM,OAAO;AAWb,IAAM,iBAAgD,CAAC,EAAE,UAAU,MAAM,MAAM;AAC7E,QAAM,QAAc,eAAS,KAAK,QAAQ;AAC1C,SACE,iCACG;AAAA,IAAM,mBAAa,OAA8D;AAAA;AAAA,MAEhF,eAAe;AAAA,MACf,WAAW;AAAA;AAAA,IACb,CAAC;AAAA,IACD,oBAAyB,8BAAxB,EAA8B,iBAAM;AAAA,KACvC;AAEJ;AAEA,eAAe,cAAc;AAE7B,IAAMA,QAAO;",
6
+ "names": ["Root"]
7
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@radix-ui/react-accessible-icon",
3
+ "version": "0.0.0-20250116175529",
4
+ "license": "MIT",
5
+ "exports": {
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "default": "./dist/index.mjs"
10
+ },
11
+ "require": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ }
16
+ },
17
+ "source": "./src/index.ts",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.mjs",
20
+ "types": "./dist/index.d.ts",
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "sideEffects": false,
26
+ "scripts": {
27
+ "clean": "rm -rf dist"
28
+ },
29
+ "dependencies": {
30
+ "@radix-ui/react-visually-hidden": "workspace:*"
31
+ },
32
+ "peerDependencies": {
33
+ "@types/react": "*",
34
+ "@types/react-dom": "*",
35
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
36
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@types/react": {
40
+ "optional": true
41
+ },
42
+ "@types/react-dom": {
43
+ "optional": true
44
+ }
45
+ },
46
+ "homepage": "https://radix-ui.com/primitives",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/radix-ui/primitives.git"
50
+ },
51
+ "bugs": {
52
+ "url": "https://github.com/radix-ui/primitives/issues"
53
+ }
54
+ }