@scarlab-icons/js 3.0.0 → 3.2.0
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 +22 -2
- package/dist/index.cjs +106 -58462
- package/dist/index.d.ts +19 -3
- package/dist/index.js +104 -58463
- package/package.json +17 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p align="center"><a href="https://scarlab-icons.la-moore.ru" target="_blank" rel="noopener noreferrer"><img width="100" src="
|
|
1
|
+
<p align="center"><a href="https://scarlab-icons.la-moore.ru" target="_blank" rel="noopener noreferrer"><img width="100" src="https://raw.githubusercontent.com/la-moore/scarlab-icons/master/.github/logo.svg" alt="Scarlab logo"></a></p>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<a href="https://www.npmjs.com/package/@scarlab-icons/js"><img src="https://img.shields.io/npm/v/@scarlab-icons/js?color=%23cb0000" alt="npm version"></a>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
# [Scarlab Icons](http://scarlab-icons.la-moore.ru/)
|
|
9
|
-
Scarlab Icons is a collection of more than
|
|
9
|
+
Scarlab Icons is a collection of more than 1400 simple, beautiful and open source icons. Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.
|
|
10
10
|
|
|
11
11
|
[scarlab-icons](http://scarlab-icons.la-moore.ru/)
|
|
12
12
|
|
|
@@ -36,6 +36,8 @@ replace({
|
|
|
36
36
|
})
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
> `replace()` includes every icon (~2.5 MB). Add [`@scarlab-icons/unplugin`](https://github.com/la-moore/scarlab-icons/tree/master/packages/unplugin) to your Vite or Rollup config and only the icons you use end up in the bundle, with no code changes.
|
|
40
|
+
|
|
39
41
|
### Data Attributes
|
|
40
42
|
|
|
41
43
|
- `data-scarlab` - Icon name (required)
|
|
@@ -56,6 +58,24 @@ Any other HTML attributes will be passed through to the generated SVG element:
|
|
|
56
58
|
</div>
|
|
57
59
|
```
|
|
58
60
|
|
|
61
|
+
### Accessibility
|
|
62
|
+
Icons are decorative by default and rendered with `aria-hidden="true"`. Add `aria-label` (or `aria-labelledby`) to give an icon an accessible name — `aria-hidden` is then omitted:
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<div data-scarlab="heart" aria-label="Like"></div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### API
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import { getIcon, toSvg } from '@scarlab-icons/js'
|
|
72
|
+
|
|
73
|
+
const icon = getIcon('heart', 'outline') // IconNode | undefined, style defaults to 'base'
|
|
74
|
+
const svg = toSvg(icon, { width: 32, strokeWidth: 3, class: 'my-icon' })
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`toSvg` converts camelCase names to kebab-case (`strokeWidth` → `stroke-width`), escapes values and skips `null`, `undefined` and `false`.
|
|
78
|
+
|
|
59
79
|
## Figma
|
|
60
80
|
Scarlab Icons is available as a [Figma component library](https://www.figma.com/community/file/1051907827478622063/Scarab-Icons). To use the components, log in to your Figma account and duplicate the file to your drafts.
|
|
61
81
|
|