mirror of
https://github.com/ionic-team/ionicons.git
synced 2026-12-04 17:24:01 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fcee649df | ||
|
|
e4bf096aaf | ||
|
|
cdb0d80cde | ||
|
|
e358a4f418 | ||
|
|
0f6c84f976 | ||
|
|
63788874db | ||
|
|
ac450cbd28 | ||
|
|
2ffcb6a012 | ||
|
|
998b9207f3 | ||
|
|
c290bea476 | ||
|
|
f2ed84a256 | ||
|
|
7f3f55c94e | ||
|
|
ffcf9f9034 | ||
|
|
6116bc2627 | ||
|
|
b7c9bb024a | ||
|
|
8c412f6748 | ||
|
|
53ce49e929 | ||
|
|
b27268f7db | ||
|
|
2c1b968bff | ||
|
|
98975ec0f5 |
@@ -43,7 +43,7 @@ Please see our [Contributor Code of Conduct](./CODE_OF_CONDUCT.md) for informati
|
||||
#### Modifying Components
|
||||
|
||||
1. Navigate to the `src/components/` directory and open the `icon` component to modify.
|
||||
2. Make any changes to the icon component and then [preview-changes](#preview-component-changes).
|
||||
2. Make any changes to the icon component and then [preview the changes](#preview-component-changes).
|
||||
|
||||
|
||||
#### Preview Component Changes
|
||||
@@ -64,6 +64,10 @@ TODO -->
|
||||
3. Please fill out the Pull Request template to the best of your ability and include any issues that are related.
|
||||
|
||||
|
||||
## Updating Documentation
|
||||
|
||||
The documentation site for Ionicons is located in the [ionicons-site](https://github.com/ionic-team/ionicons-site) repository.
|
||||
|
||||
## License
|
||||
|
||||
By contributing your code to the ionic-team/ionicons GitHub Repository, you agree to license your contribution under the MIT license.
|
||||
|
||||
+35
-3
@@ -3,13 +3,45 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.1.2](https://github.com/ionic-team/ionicons/compare/v6.1.1...v6.1.2) (2023-02-08)
|
||||
# [7.1.0](https://github.com/ionic-team/ionicons/compare/v7.0.0...v7.1.0) (2023-03-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* chevron-expand and chevron-collapse icons ([#1198](https://github.com/ionic-team/ionicons/issues/1198)) ([cdb0d80](https://github.com/ionic-team/ionicons/commit/cdb0d80cde1dc5dd90fb2a1c3b4fa31d68294821))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [7.1.0](https://github.com/ionic-team/ionicons/compare/v7.0.0...v7.1.0) (2023-03-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* chevron-expand and chevron-collapse icons ([#1198](https://github.com/ionic-team/ionicons/issues/1198)) ([cdb0d80](https://github.com/ionic-team/ionicons/commit/cdb0d80cde1dc5dd90fb2a1c3b4fa31d68294821))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [7.0.0](https://github.com/ionic-team/ionicons/compare/v6.1.3...v7.0.0) (2023-03-07)
|
||||
|
||||
**Migration Note:** Developers should ensure that their `<ion-icon>` usages have either `aria-label` or `aria-hidden` to avoid accessibility issues. See https://ionic.io/ionicons/usage for more information.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **icon:** remove auto-generated aria-label ([#1170](https://github.com/ionic-team/ionicons/issues/1170)) ([98975ec](https://github.com/ionic-team/ionicons/commit/98975ec0f54b825c33f528683834a5e38298d598))
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.1.3](https://github.com/ionic-team/ionicons/compare/v6.1.2...v6.1.3) (2023-02-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **icon:** load base64 data urls ([#1172](https://github.com/ionic-team/ionicons/issues/1172)) ([72f0936](https://github.com/ionic-team/ionicons/commit/72f09369de76b00697437f54d919782307843a87))
|
||||
* **icon:** md and ios properties are reactive ([#1174](https://github.com/ionic-team/ionicons/issues/1174)) ([65bcbb4](https://github.com/ionic-team/ionicons/commit/65bcbb477734e33901a6f0c650d3f1f2c3084fca)), closes [#802](https://github.com/ionic-team/ionicons/issues/802)
|
||||
* DomParser usage in SSR ([#1180](https://github.com/ionic-team/ionicons/issues/1180)) ([8c412f6](https://github.com/ionic-team/ionicons/commit/8c412f67486d6cc9725de63f0c15b6c6cd8d47ce)), closes [#1179](https://github.com/ionic-team/ionicons/issues/1179)
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
"packages": [
|
||||
"./"
|
||||
],
|
||||
"version": "6.1.2"
|
||||
"version": "7.1.0"
|
||||
}
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ionicons",
|
||||
"version": "6.1.2",
|
||||
"version": "7.1.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ionicons",
|
||||
"version": "6.1.2",
|
||||
"version": "7.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stencil/core": "^2.18.0"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionicons",
|
||||
"version": "6.1.2",
|
||||
"version": "7.1.0",
|
||||
"description": "Premium icons for Ionic.",
|
||||
"files": [
|
||||
"components/",
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ async function optimizeSvgs(srcSvgData: SvgData[]) {
|
||||
if (item.isElem()) {
|
||||
item.eachAttr((attr) => {
|
||||
if (attr.name === 'stroke' || attr.name === 'fill') {
|
||||
if (attr.value === '#000') {
|
||||
if (attr.value === '#000' || attr.value === 'currentColor') {
|
||||
item.addAttr({
|
||||
name: attr.name,
|
||||
value: 'currentColor',
|
||||
|
||||
@@ -17,7 +17,6 @@ export class Icon {
|
||||
|
||||
@State() private svgContent?: string;
|
||||
@State() private isVisible = false;
|
||||
@State() private ariaLabel?: string;
|
||||
|
||||
/**
|
||||
* The mode determines which platform styles to use.
|
||||
@@ -123,12 +122,6 @@ export class Icon {
|
||||
}
|
||||
}
|
||||
|
||||
private hasAriaHidden = () => {
|
||||
const { el } = this;
|
||||
|
||||
return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';
|
||||
};
|
||||
|
||||
@Watch('name')
|
||||
@Watch('src')
|
||||
@Watch('icon')
|
||||
@@ -149,34 +142,18 @@ export class Icon {
|
||||
}
|
||||
}
|
||||
|
||||
const label = (this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md));
|
||||
|
||||
/**
|
||||
* Come up with a default label
|
||||
* in case user does not provide their own.
|
||||
*/
|
||||
if (label) {
|
||||
this.ariaLabel = label.replace(/\-/g, ' ');
|
||||
}
|
||||
this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { iconName, ariaLabel, el, inheritedAttributes } = this;
|
||||
const { iconName, el, inheritedAttributes } = this;
|
||||
const mode = this.mode || 'md';
|
||||
const flipRtl =
|
||||
this.flipRtl ||
|
||||
(iconName && (iconName.indexOf('arrow') > -1 || iconName.indexOf('chevron') > -1) && this.flipRtl !== false);
|
||||
|
||||
/**
|
||||
* Only set the aria-label if a) we have generated
|
||||
* one for the icon and if aria-hidden is not set to "true".
|
||||
* If developer wants to set their own aria-label, then
|
||||
* inheritedAttributes down below will override whatever
|
||||
* default label we have set.
|
||||
*/
|
||||
return (
|
||||
<Host
|
||||
aria-label={ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null}
|
||||
role="img"
|
||||
class={{
|
||||
[mode]: true,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { isEncodedDataUrl, isSvgDataUrl, validateContent } from './validate';
|
||||
export const ioniconContent = new Map<string, string>();
|
||||
const requests = new Map<string, Promise<any>>();
|
||||
|
||||
let parser = new DOMParser();
|
||||
let parser: DOMParser;
|
||||
|
||||
export const getSvgContent = (url: string, sanitize: boolean) => {
|
||||
// see if we already have a request for this url
|
||||
|
||||
@@ -16,20 +16,6 @@ describe('icon', () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it('renders aria-hidden and no aria-label', async () => {
|
||||
const { root } = await newSpecPage({
|
||||
components: [Icon],
|
||||
html: `<ion-icon aria-hidden="true"></ion-icon>`,
|
||||
});
|
||||
expect(root).toEqualHtml(`
|
||||
<ion-icon class="md" role="img" aria-hidden="true">
|
||||
<mock:shadow-root>
|
||||
<div class="icon-inner"></div>
|
||||
</mock:shadow-root>
|
||||
</ion-icon>
|
||||
`);
|
||||
});
|
||||
|
||||
it('renders rtl with aria-hidden', async () => {
|
||||
const { root } = await newSpecPage({
|
||||
components: [Icon],
|
||||
@@ -46,21 +32,6 @@ describe('icon', () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it('renders default aria-label', async () => {
|
||||
const { root } = await newSpecPage({
|
||||
components: [Icon],
|
||||
html: `<ion-icon name="chevron-forward"></ion-icon>`,
|
||||
});
|
||||
|
||||
expect(root).toEqualHtml(`
|
||||
<ion-icon class="md" name="chevron-forward" role="img" aria-label="chevron forward">
|
||||
<mock:shadow-root>
|
||||
<div class="icon-inner"></div>
|
||||
</mock:shadow-root>
|
||||
</ion-icon>
|
||||
`);
|
||||
});
|
||||
|
||||
it('renders custom aria-label', async () => {
|
||||
const { root } = await newSpecPage({
|
||||
components: [Icon],
|
||||
@@ -105,34 +76,4 @@ describe('icon', () => {
|
||||
</ion-icon>
|
||||
`);
|
||||
});
|
||||
|
||||
it('renders default label after changing source', async () => {
|
||||
const page = await newSpecPage({
|
||||
components: [Icon],
|
||||
html: `<ion-icon name="chevron-forward"></ion-icon>`,
|
||||
});
|
||||
|
||||
const icon = page.root;
|
||||
|
||||
expect(icon).toEqualHtml(`
|
||||
<ion-icon class="md" name="chevron-forward" role="img" aria-label="chevron forward">
|
||||
<mock:shadow-root>
|
||||
<div class="icon-inner"></div>
|
||||
</mock:shadow-root>
|
||||
</ion-icon>
|
||||
`);
|
||||
|
||||
if (icon) {
|
||||
icon.name = 'trash';
|
||||
}
|
||||
await page.waitForChanges();
|
||||
|
||||
expect(icon).toEqualHtml(`
|
||||
<ion-icon class="md" name="trash" role="img" aria-label="trash">
|
||||
<mock:shadow-root>
|
||||
<div class="icon-inner"></div>
|
||||
</mock:shadow-root>
|
||||
</ion-icon>
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2545,6 +2545,29 @@
|
||||
"sharp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-collapse",
|
||||
"tags": [
|
||||
"chevron",
|
||||
"collapse"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-collapse-outline",
|
||||
"tags": [
|
||||
"chevron",
|
||||
"collapse",
|
||||
"outline"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-collapse-sharp",
|
||||
"tags": [
|
||||
"chevron",
|
||||
"collapse",
|
||||
"sharp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-down",
|
||||
"tags": [
|
||||
@@ -2600,6 +2623,29 @@
|
||||
"sharp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-expand",
|
||||
"tags": [
|
||||
"chevron",
|
||||
"expand"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-expand-outline",
|
||||
"tags": [
|
||||
"chevron",
|
||||
"expand",
|
||||
"outline"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-expand-sharp",
|
||||
"tags": [
|
||||
"chevron",
|
||||
"expand",
|
||||
"sharp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chevron-forward",
|
||||
"tags": [
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M136 104L256 208L376 104" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/><path d="M136 408L256 304L376 408" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"/></svg>
|
||||
|
After Width: | Height: | Size: 338 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M102.145 108.514L256 241.855l153.855-133.341-31.437-36.273L256 178.337 133.582 72.241l-31.437 36.273zm0 294.972L256 270.145l153.855 133.341-31.437 36.273L256 333.663 133.582 439.759l-31.437-36.273z"/></svg>
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M117.863 88.282c-8.681 10.017-7.598 25.174 2.419 33.855l120 104c9.02 7.818 22.416 7.818 31.436 0l120-104c10.017-8.681 11.1-23.838 2.419-33.855s-23.839-11.099-33.855-2.418L256 176.241 151.718 85.864c-10.016-8.681-25.174-7.598-33.855 2.418zm0 335.436c-8.681-10.017-7.598-25.174 2.419-33.855l120-104c9.02-7.818 22.416-7.818 31.436 0l120 104c10.017 8.681 11.1 23.838 2.419 33.855s-23.839 11.099-33.855 2.418L256 335.759l-104.282 90.377c-10.016 8.681-25.174 7.598-33.855-2.418z"/></svg>
|
||||
|
After Width: | Height: | Size: 552 B |
@@ -0,0 +1 @@
|
||||
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M136 208L256 104L376 208" stroke="currentColor" fill="none" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/><path d="M136 304L256 408L376 304" stroke="currentColor" fill="none" stroke-width="32" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||
|
After Width: | Height: | Size: 339 B |
@@ -0,0 +1 @@
|
||||
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M136 208L256 104L376 208" fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="square"/><path d="M136 304L256 408L376 304" fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="square"/></svg>
|
||||
|
After Width: | Height: | Size: 293 B |
@@ -0,0 +1 @@
|
||||
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M136 208L256 104L376 208" fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/><path d="M136 304L256 408L376 304" fill="none" stroke="currentColor" stroke-width="48" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||
|
After Width: | Height: | Size: 339 B |
Reference in New Issue
Block a user