@cypress-design/react-icon 0.18.1 → 0.19.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/.gitignore +1 -1
- package/.turbo/turbo-build.log +13 -0
- package/CHANGELOG.md +22 -0
- package/IconReact.cy.tsx +1 -1
- package/ReadMe.md +27 -29
- package/_TreeShakableIcons.ts +4363 -0
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/{TreeShakableIcons.d.ts → _TreeShakableIcons.d.ts} +3 -1
- package/dist/_TreeShakableIcons.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.mjs +518 -496
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +524 -501
- package/dist/index.umd.js.map +1 -1
- package/generate-icons.js +1 -1
- package/index.ts +1 -1
- package/package.json +4 -3
- package/tsconfig.json +3 -0
- package/Icon.stories.mdx +0 -113
- package/TreeShakableIcons.ts +0 -4323
- package/dist/TreeShakableIcons.d.ts.map +0 -1
package/generate-icons.js
CHANGED
package/index.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { iconsMetadata } from '@cypress-design/icon-registry'
|
|
|
2
2
|
export type { WindiColor } from '@cypress-design/icon-registry'
|
|
3
3
|
export { default } from './Icon'
|
|
4
4
|
export { compileReactIconProperties } from './compileProperties'
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './_TreeShakableIcons'
|
|
6
6
|
|
|
7
7
|
export type IconId = keyof typeof iconsMetadata
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress-design/react-icon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"*"
|
|
6
6
|
],
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
"build:types": "tsc --project ./tsconfig.build.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@cypress-design/icon-registry": "^0.
|
|
23
|
+
"@cypress-design/icon-registry": "^0.21.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@
|
|
26
|
+
"@cypress-design/css": "*",
|
|
27
|
+
"@types/lodash": "^4.14.192",
|
|
27
28
|
"lodash": "^4.17.21",
|
|
28
29
|
"dedent": "^0.7.0"
|
|
29
30
|
},
|
package/tsconfig.json
CHANGED
package/Icon.stories.mdx
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { ArgsTable, Canvas, Meta, Story, Description } from '@storybook/addon-docs'
|
|
2
|
-
import { iconsMetadata } from '@cypress-design/icon-registry';
|
|
3
|
-
import { version } from "./package.json";
|
|
4
|
-
import changelog from "./CHANGELOG.md";
|
|
5
|
-
|
|
6
|
-
import { Icon } from './Icon'
|
|
7
|
-
|
|
8
|
-
<h1>Icon<span className="text-lg font-normal"> - v{version}</span></h1>
|
|
9
|
-
|
|
10
|
-
<Meta
|
|
11
|
-
title="Icon"
|
|
12
|
-
component={Icon}
|
|
13
|
-
argTypes={{
|
|
14
|
-
name: {
|
|
15
|
-
control: { type: 'select' },
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
control: { type: 'select' },
|
|
19
|
-
},
|
|
20
|
-
strokeColor: {
|
|
21
|
-
control: { type: 'select' },
|
|
22
|
-
},
|
|
23
|
-
fillColor: {
|
|
24
|
-
control: { type: 'select' },
|
|
25
|
-
},
|
|
26
|
-
secondaryStrokeColor: {
|
|
27
|
-
control: { type: 'select' },
|
|
28
|
-
},
|
|
29
|
-
secondaryFillColor: {
|
|
30
|
-
control: { type: 'select' },
|
|
31
|
-
},
|
|
32
|
-
}}
|
|
33
|
-
parameters={{
|
|
34
|
-
design: {
|
|
35
|
-
type: "figma",
|
|
36
|
-
url: 'https://www.figma.com/file/1WJ3GVQyMV5e7xVxPg3yID/Design-System?node-id=864%3A11',
|
|
37
|
-
}
|
|
38
|
-
}}
|
|
39
|
-
/>
|
|
40
|
-
|
|
41
|
-
<Canvas>
|
|
42
|
-
<Story name="Icon">
|
|
43
|
-
{(args) => {
|
|
44
|
-
const name = args.name ?? 'general-placeholder'
|
|
45
|
-
if(args.size && !iconsMetadata[name]?.availableSizes.includes(args.size)) {
|
|
46
|
-
return <p className="text-red-500 bg-red-50">Not available at this size</p>
|
|
47
|
-
}
|
|
48
|
-
return <Icon {...{...args, name }} className="m-2"/>
|
|
49
|
-
}}
|
|
50
|
-
</Story>
|
|
51
|
-
</Canvas>
|
|
52
|
-
|
|
53
|
-
<ArgsTable exclude={/^(hover|focus|hocus)/g} />
|
|
54
|
-
|
|
55
|
-
## Usage
|
|
56
|
-
|
|
57
|
-
The simple way using the Icon component
|
|
58
|
-
|
|
59
|
-
```tsx
|
|
60
|
-
import { Icon } from '@cypress-design/react-icon'
|
|
61
|
-
|
|
62
|
-
export const MyButtonWithIcon = () => {
|
|
63
|
-
return (<button>
|
|
64
|
-
<Icon name="book" size="16" strokeColor="blue-600" fillColor="red-200" className="bg-red-100" />Read
|
|
65
|
-
</button>)
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The tree-shakable way (more optimized)
|
|
70
|
-
|
|
71
|
-
```tsx
|
|
72
|
-
import { IconBook } from '@cypress-design/react-icon'
|
|
73
|
-
|
|
74
|
-
export const MyButtonWithIcon = () => {
|
|
75
|
-
return (<button>
|
|
76
|
-
<IconBook size="16" strokeColor="indigo-600" fillColor="red-200" />
|
|
77
|
-
</button>)
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Should you need to change the color of the icon on `hover` or `focus` prefix the props with these words.
|
|
82
|
-
|
|
83
|
-
Here, the `strokeColor` will change on hover from indigo to jade
|
|
84
|
-
|
|
85
|
-
```tsx
|
|
86
|
-
import { IconBook } from '@cypress-design/react-icon'
|
|
87
|
-
|
|
88
|
-
export const MyButtonWithIcon = () => {
|
|
89
|
-
return (<button>
|
|
90
|
-
<IconBook size="16" strokeColor="indigo-600" hoverStrokeColor="jade-600" />
|
|
91
|
-
</button>)
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
If you need the `hover` or `focus` effect to be triggered on the parent group, use `interactiveColorsOnGroup`.
|
|
96
|
-
This prop will change all the pseudo prefixes to be group focused instead of triggered by the icon itself.
|
|
97
|
-
|
|
98
|
-
To achieve the same goal, in WindiCSS, we would use `group-hover:` instead of `hover:`.
|
|
99
|
-
|
|
100
|
-
```tsx
|
|
101
|
-
import { IconBook } from '@cypress-design/react-icon'
|
|
102
|
-
|
|
103
|
-
export const MyButtonWithIcon = () => {
|
|
104
|
-
return (<button className="group hover:text-jade-800">
|
|
105
|
-
<IconBook size="16" strokeColor="indigo-600" hoverStrokeColor="jade-600" interactiveColorsOnGroup />
|
|
106
|
-
Book
|
|
107
|
-
</button>)
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
<Description>
|
|
112
|
-
{changelog.replace(/^# .+/, '## Changelog')}
|
|
113
|
-
</Description>
|