-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIcon.mjs
More file actions
48 lines (41 loc) · 1.25 KB
/
Icon.mjs
File metadata and controls
48 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// @ts-check
import classNameProp from "class-name-prop";
import React from "react";
/** CSS dependency URLs for the React component {@linkcode Icon}. */
export const css = new Set([new URL("./Icon.css", import.meta.url).href]);
/** React component for an inline SVG icon. */
const Icon = React.forwardRef(
(
/**
* @type {IconProps
* & React.ComponentPropsWithoutRef<"svg">
* & { [dataAttribute: `data-${string}`]: unknown }}
*/
{ size = "1em", title, className, children, ...props },
/** @type {React.ForwardedRef<SVGElement>} */
ref
) =>
React.createElement(
"svg",
{
className: classNameProp("daui-Icon", className),
...props,
width: size,
height: size,
viewBox: "0 0 32 32",
ref,
},
React.createElement("title", null, `${title} icon`),
children
)
);
Icon.displayName = "Icon";
export default Icon;
/**
* Props for the {@linkcode Icon} React component, excluding additional props
* for the {@linkcode SVGElement} container.
* @typedef {object} IconProps
* @prop {string} [size] {@link SVGElement SVG} width and height. Some browser
* versions don’t support `rem` units. Defaults to `"1em"`.
* @prop {string} title Icon title.
*/