Skip to content

Commit 6efbe30

Browse files
committed
Merge branch 'main' of https://github.com/coreui/coreui-icons-react into HEAD
2 parents 928865b + 8a61778 commit 6efbe30

File tree

3 files changed

+50
-30
lines changed

3 files changed

+50
-30
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coreui/icons-react",
3-
"version": "2.1.0",
3+
"version": "2.2.1",
44
"description": "Official React component for CoreUI Icons",
55
"keywords": [
66
"coreui",
@@ -13,13 +13,13 @@
1313
"component",
1414
"react"
1515
],
16-
"homepage": "https://icons.coreui.io",
16+
"homepage": "https://coreui.io/react/docs/components/icon/",
1717
"bugs": {
18-
"url": "https://github.com/coreui/coreui-icons/issues"
18+
"url": "https://github.com/coreui/coreui-icons-react/issues"
1919
},
2020
"repository": {
2121
"type": "git",
22-
"url": "https://github.com/coreui/coreui-icons.git"
22+
"url": "https://github.com/coreui/coreui-icons-react.git"
2323
},
2424
"license": "MIT",
2525
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",

src/CIcon.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,17 @@
7575
width: 0.875rem;
7676
height: 0.875rem;
7777
font-size: 0.875rem;
78+
}
79+
80+
.visually-hidden,
81+
.visually-hidden-focusable:not(:focus):not(:focus-within) {
82+
position: absolute!important;
83+
width: 1px!important;
84+
height: 1px!important;
85+
padding: 0!important;
86+
margin: -1px!important;
87+
overflow: hidden!important;
88+
clip: rect(0,0,0,0)!important;
89+
white-space: nowrap!important;
90+
border: 0!important;
7891
}

src/CIcon.tsx

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { HTMLAttributes, forwardRef, useState, useMemo } from 'react'
33
import classNames from 'classnames'
44
import './CIcon.css'
55

6-
export interface CIconProps extends HTMLAttributes<SVGSVGElement> {
6+
export interface CIconProps extends Omit<HTMLAttributes<SVGSVGElement>, 'content'> {
77
/**
88
* A string of all className you want applied to the component.
99
*/
@@ -17,7 +17,7 @@ export interface CIconProps extends HTMLAttributes<SVGSVGElement> {
1717
/**
1818
* Use for replacing default CIcon component classes. Prop is overriding the 'size' prop.
1919
*/
20-
customClassName?: string | string[] // eslint-disable-line @typescript-eslint/ban-types
20+
customClassName?: string | string[]
2121
/**
2222
* Name of the icon placed in React object or SVG content.
2323
*/
@@ -136,30 +136,37 @@ export const CIcon = forwardRef<SVGSVGElement, CIconProps>(
136136
className,
137137
)
138138

139-
return use ? (
140-
<svg
141-
xmlns="http://www.w3.org/2000/svg"
142-
className={_className}
143-
{...(height && { height: height })}
144-
{...(width && { width: width })}
145-
role="img"
146-
{...rest}
147-
ref={ref}
148-
>
149-
<use href={use}></use>
150-
</svg>
151-
) : (
152-
<svg
153-
xmlns="http://www.w3.org/2000/svg"
154-
viewBox={viewBox}
155-
className={_className}
156-
{...(height && { height: height })}
157-
{...(width && { width: width })}
158-
role="img"
159-
dangerouslySetInnerHTML={{ __html: titleCode + iconCode }}
160-
{...rest}
161-
ref={ref}
162-
/>
139+
return (
140+
<>
141+
{use ? (
142+
<svg
143+
xmlns="http://www.w3.org/2000/svg"
144+
className={_className}
145+
{...(height && { height: height })}
146+
{...(width && { width: width })}
147+
role="img"
148+
aria-hidden="true"
149+
{...rest}
150+
ref={ref}
151+
>
152+
<use href={use}></use>
153+
</svg>
154+
) : (
155+
<svg
156+
xmlns="http://www.w3.org/2000/svg"
157+
viewBox={viewBox}
158+
className={_className}
159+
{...(height && { height: height })}
160+
{...(width && { width: width })}
161+
role="img"
162+
aria-hidden="true"
163+
dangerouslySetInnerHTML={{ __html: titleCode + iconCode }}
164+
{...rest}
165+
ref={ref}
166+
/>
167+
)}
168+
{title && <span className="visually-hidden">{title}</span>}
169+
</>
163170
)
164171
},
165172
)

0 commit comments

Comments
 (0)