@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/generate-icons.js CHANGED
@@ -55,7 +55,7 @@ ${iconsComponents.join('\n\n\n')}
55
55
 
56
56
  async function writeFile(fileContents) {
57
57
  await fs.writeFile(
58
- path.resolve(__dirname, './TreeShakableIcons.ts'),
58
+ path.resolve(__dirname, './_TreeShakableIcons.ts'),
59
59
  fileContents,
60
60
  'utf-8'
61
61
  )
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 './TreeShakableIcons'
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
- "name": "@cypress-design/vue-icon",
3
- "version": "0.19.2",
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.20.4"
24
- },
25
- "devDependencies": {
26
- "@types/lodash": "^4.14.182",
27
- "lodash": "^4.17.21",
28
- "dedent": "^0.7.0"
29
- },
30
- "license": "MIT"
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
  }
@@ -2,6 +2,7 @@
2
2
  "extends": "../../../tsconfig.vue.json",
3
3
  "include": ["./*.vue", "./index.ts"],
4
4
  "compilerOptions": {
5
- "outDir": "dist"
5
+ "outDir": "dist",
6
+ "composite": false
6
7
  }
7
8
  }
package/tsconfig.json CHANGED
@@ -1,4 +1,7 @@
1
1
  {
2
2
  "extends": "../../../tsconfig.vue.json",
3
+ "compilerOptions": {
4
+ "rootDir": "../"
5
+ },
3
6
  "include": ["*.vue", "*.ts", "*.tsx"]
4
7
  }
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>