@cypress-design/vue-icon 0.19.2 → 0.20.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 +15 -0
- package/CHANGELOG.md +13 -0
- package/ReadMe.md +28 -28
- package/_TreeShakableIcons.ts +3936 -0
- package/dist/{TreeShakableIcons.d.ts → _TreeShakableIcons.d.ts} +7 -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 +445 -415
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/generate-icons.js +1 -1
- package/index.ts +1 -1
- package/package.json +30 -29
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +3 -0
- package/Icon.stories.mdx +0 -132
- package/TreeShakableIcons.ts +0 -3900
- 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 { compileVueIconProperties } from './compileProperties'
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './_TreeShakableIcons'
|
|
6
6
|
|
|
7
7
|
export type IconId = keyof typeof iconsMetadata
|
package/package.json
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
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
|
-
|
|
2
|
+
"name": "@cypress-design/vue-icon",
|
|
3
|
+
"version": "0.20.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"*"
|
|
6
|
+
],
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"main": "./dist/index.umd.js",
|
|
9
|
+
"module": "./dist/index.es.mjs",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.es.mjs",
|
|
13
|
+
"require": "./dist/index.umd.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "yarn build:codegen && yarn build:module && yarn build:types",
|
|
18
|
+
"build:codegen": "node ./generate-icons.js",
|
|
19
|
+
"build:module": "yarn vite build",
|
|
20
|
+
"build:types": "yarn tsc --project ./tsconfig.build.json"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@cypress-design/icon-registry": "^0.21.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@cypress-design/css": "*",
|
|
27
|
+
"@types/lodash": "^4.14.192",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
29
|
+
"dedent": "^0.7.0"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT"
|
|
31
32
|
}
|
package/tsconfig.build.json
CHANGED
package/tsconfig.json
CHANGED
package/Icon.stories.mdx
DELETED
|
@@ -1,132 +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?raw";
|
|
5
|
-
const colors = ['jade', 'teal', 'red', 'indigo', 'blue', 'purple', 'gray'];
|
|
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
|
-
options: Object.keys(iconsMetadata),
|
|
16
|
-
control: { type: 'select' },
|
|
17
|
-
},
|
|
18
|
-
size: {
|
|
19
|
-
options: ['8', '16', '32', '48', '120'],
|
|
20
|
-
control: { type: 'select' },
|
|
21
|
-
},
|
|
22
|
-
strokeColor: {
|
|
23
|
-
options: colors.map(color => `${color}-500`),
|
|
24
|
-
control: { type: 'select' },
|
|
25
|
-
},
|
|
26
|
-
fillColor: {
|
|
27
|
-
options: colors.map(color => `${color}-100`),
|
|
28
|
-
control: { type: 'select' },
|
|
29
|
-
},
|
|
30
|
-
secondaryStrokeColor: {
|
|
31
|
-
options: colors.map(color => `${color}-500`),
|
|
32
|
-
control: { type: 'select' },
|
|
33
|
-
},
|
|
34
|
-
secondaryFillColor: {
|
|
35
|
-
options: colors.map(color => `${color}-100`),
|
|
36
|
-
control: { type: 'select' },
|
|
37
|
-
}
|
|
38
|
-
}}
|
|
39
|
-
parameters={{
|
|
40
|
-
design: {
|
|
41
|
-
type: "figma",
|
|
42
|
-
url: 'https://www.figma.com/file/1WJ3GVQyMV5e7xVxPg3yID/Design-System?node-id=864%3A11',
|
|
43
|
-
}
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
|
|
47
|
-
<Canvas withSource="none">
|
|
48
|
-
<Story name="Icon">
|
|
49
|
-
{(args) => (
|
|
50
|
-
{
|
|
51
|
-
components: { Icon },
|
|
52
|
-
data() {
|
|
53
|
-
args.name = args.name ?? 'general-placeholder'
|
|
54
|
-
return { args }
|
|
55
|
-
},
|
|
56
|
-
computed: {
|
|
57
|
-
unavailableSize() {
|
|
58
|
-
const { size, name } = this.args
|
|
59
|
-
return size && iconsMetadata[name] && !iconsMetadata[name]?.availableSizes.includes(size)
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
template: `<div>
|
|
63
|
-
<p v-if="this.unavailableSize" class="text-red-500 bg-red-50">Not available at this size</p>
|
|
64
|
-
<Icon v-else v-bind="this.args" />
|
|
65
|
-
</div>`,
|
|
66
|
-
}
|
|
67
|
-
)}
|
|
68
|
-
</Story>
|
|
69
|
-
</Canvas>
|
|
70
|
-
|
|
71
|
-
## Usage
|
|
72
|
-
|
|
73
|
-
The simple way using the Icon component
|
|
74
|
-
|
|
75
|
-
```vue
|
|
76
|
-
<script setup>
|
|
77
|
-
import Icon from '@cypress-design/vue-icon'
|
|
78
|
-
</script>
|
|
79
|
-
<template>
|
|
80
|
-
<button>
|
|
81
|
-
<Icon name="book" size="16" strokeColor="blue-600" fillColor="red-200" class="bg-red-100" />Read
|
|
82
|
-
</button>
|
|
83
|
-
</template>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
The tree-shakable way (more optimized)
|
|
87
|
-
|
|
88
|
-
```vue
|
|
89
|
-
<script setup>
|
|
90
|
-
import { IconBook } from '@cypress-design/vue-icon'
|
|
91
|
-
</script>
|
|
92
|
-
<template>
|
|
93
|
-
<button>
|
|
94
|
-
<IconBook size="16" strokeColor="blue-600" fillColor="red-200" class="bg-red-100" />Read
|
|
95
|
-
</button>
|
|
96
|
-
</template>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
Should you need to change the color of the icon on `hover` or `focus` prefix the props with these words.
|
|
100
|
-
|
|
101
|
-
Here, the `strokeColor` will change on hover from indigo to jade
|
|
102
|
-
|
|
103
|
-
```vue
|
|
104
|
-
<script setup>
|
|
105
|
-
import { IconBook } from '@cypress-design/vue-icon'
|
|
106
|
-
</script>
|
|
107
|
-
<template>
|
|
108
|
-
<button>
|
|
109
|
-
<IconBook size="16" strokeColor="blue-600" hoverStrokeColor="jade-600" />Read
|
|
110
|
-
</button>
|
|
111
|
-
</template>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
If you need the `hover` or `focus` effect to be triggered on the parent group, use `interactiveColorsOnGroup`.
|
|
115
|
-
This prop will change all the pseudo prefixes to be group focused instead of triggered by the icon itself.
|
|
116
|
-
|
|
117
|
-
To achieve the same goal, in WindiCSS, we would use `group-hover:` instead of `hover:`.
|
|
118
|
-
|
|
119
|
-
```vue
|
|
120
|
-
<script setup>
|
|
121
|
-
import { IconBook } from '@cypress-design/vue-icon'
|
|
122
|
-
</script>
|
|
123
|
-
<template>
|
|
124
|
-
<button class="group hover:text-jade-800">
|
|
125
|
-
<IconBook size="16" strokeColor="blue-600" hoverStrokeColor="jade-600" interactiveColorsOnGroup />Read
|
|
126
|
-
</button>
|
|
127
|
-
</template>
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
<Description>
|
|
131
|
-
{changelog.replace(/^# .+/, '## Changelog')}
|
|
132
|
-
</Description>
|