@cypress-design/vue-icon 0.19.2 → 0.21.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 CHANGED
@@ -1 +1 @@
1
- TreeShakableIcons.ts
1
+ _TreeShakableIcons.ts
@@ -0,0 +1,15 @@
1
+ $ yarn build:codegen && yarn build:module && yarn build:types
2
+ $ node ./generate-icons.js
3
+ $ yarn vite build
4
+ $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
5
+ vite v4.2.2 building for production...
6
+ transforming...
7
+ ✓ 4 modules transformed.
8
+ rendering chunks...
9
+ computing gzip size...
10
+ dist/index.es.mjs 246.76 kB │ gzip: 48.31 kB │ map: 393.55 kB
11
+ Entry module "index.ts" is using named and default exports together. Consumers of your bundle will have to use `Icon.default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
12
+ dist/index.umd.js 230.09 kB │ gzip: 48.39 kB │ map: 385.74 kB
13
+ ✓ built in 8.87s
14
+ $ yarn tsc --project ./tsconfig.build.json
15
+ $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @cypress-design/vue-icon
2
2
 
3
+ ## 0.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#196](https://github.com/cypress-io/cypress-design/pull/196) [`fc6d9e4`](https://github.com/cypress-io/cypress-design/commit/fc6d9e4fedcc01fa8e01b868b0fa66d8895c37d0) Thanks [@elevatebart](https://github.com/elevatebart)! - refactor: avoid constants relative imports
8
+
9
+ ## 0.20.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#167](https://github.com/cypress-io/cypress-design/pull/167) [`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251) Thanks [@elevatebart](https://github.com/elevatebart)! - add icons shape pieces of heaven (sun & moon)
14
+
15
+ - [#178](https://github.com/cypress-io/cypress-design/pull/178) [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650) Thanks [@elevatebart](https://github.com/elevatebart)! - deliver new docs and improved components
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`18399c7`](https://github.com/cypress-io/cypress-design/commit/18399c72a52288c67af0935384430d4e4cd24251), [`d0de778`](https://github.com/cypress-io/cypress-design/commit/d0de77843adb87d8f4804219c6dca8f45b15c650)]:
20
+ - @cypress-design/icon-registry@0.21.0
21
+
3
22
  ## 0.19.2
4
23
 
5
24
  ### Patch Changes
package/ReadMe.md CHANGED
@@ -1,56 +1,76 @@
1
1
  # Icon
2
2
 
3
- ## Summary
3
+ ## Install
4
4
 
5
- Use the `<icon>` component to display an icon from the cypress figma library.
5
+ ```bash
6
+ npm install @cypress-design/vue-icon
7
+ ```
8
+
9
+ or with yarn
10
+
11
+ ```bash
12
+ yarn add @cypress-design/vue-icon
13
+ ```
6
14
 
7
15
  ## Usage
8
16
 
17
+ ### Import
18
+
9
19
  2 methods exist to load this component:
10
20
 
11
- The recommended:
21
+ Use named imports of each icon you plan on using.
22
+ I **recommend** this method because:
12
23
 
13
- - Tree shakable
14
- - Complete proper TS validation of all props inline
15
- - No auto-importation of the component in the template
24
+ - It's tree shakable: Only the icons you use will end up in your bundle
25
+ - You get TS validation of color props: if a color is not available, squigles will appear in your editor
16
26
 
17
- ```vue
27
+ ```vue live
18
28
  <script setup>
19
- import { IconBookCode } from @cypress-design/vue-icon
29
+ import { IconObjectBookCode } from '@cypress-design/vue-icon'
20
30
  </script>
31
+
21
32
  <template>
22
- <IconBookCode />
33
+ <IconObjectBookCode />
23
34
  </template>
24
35
  ```
25
36
 
26
- The simplest:
37
+ Import the default `Icon` component and pass the name of the icon. It can be useful but you should avoid it in production unless you know what you are doing.
38
+
39
+ It has advantages:
27
40
 
28
41
  - Allows for quick browsing of the available icons right in the template
29
42
  - Allows passing ids around and delegating color and size until the implementation.
43
+
44
+ But drawbacks too:
45
+
30
46
  - it prevents tree shaking.
31
- - It use TypeScript to validate sizes and colors but with a twist:
47
+ - It uses TypeScript to check sizes and colors but with a twist:
32
48
  - If the size of the icon is not available for the icon selected and is available for another, the error will appear on the icon component instead of on the size prop.
33
49
 
34
- ```vue
50
+ ```vue live
35
51
  <script setup>
36
- import Icon from @cypress-design/vue-icon
52
+ import Icon from '@cypress-design/vue-icon'
37
53
  </script>
54
+
38
55
  <template>
39
- <Icon name="book-code" />
56
+ <Icon name="object-book-code" />
40
57
  </template>
41
58
  ```
42
59
 
60
+ ### Colors
61
+
43
62
  Should you need to change the color of the icon on `hover` or `focus` prefix the props with these words.
44
63
 
45
64
  Here, the `strokeColor` will change on hover from indigo to jade
46
65
 
47
- ```vue
66
+ ```vue live
48
67
  <script setup>
49
- import { IconBook } from '@cypress-design/vue-icon'
68
+ import { IconObjectBook } from '@cypress-design/vue-icon'
50
69
  </script>
70
+
51
71
  <template>
52
- <button>
53
- <IconBook
72
+ <button class="flex items-center gap-[8px]">
73
+ <IconObjectBook
54
74
  size="16"
55
75
  strokeColor="blue-600"
56
76
  hoverStrokeColor="jade-600"
@@ -64,13 +84,14 @@ This prop will change all the pseudo prefixes to be group focused instead of tri
64
84
 
65
85
  To achieve the same goal, in WindiCSS, we would use `group-hover:` instead of `hover:`.
66
86
 
67
- ```vue
87
+ ```vue live
68
88
  <script setup>
69
- import { IconBook } from '@cypress-design/vue-icon'
89
+ import { IconObjectBook } from '@cypress-design/vue-icon'
70
90
  </script>
91
+
71
92
  <template>
72
- <button class="group hover:text-jade-800">
73
- <IconBook
93
+ <button class="group hover:text-jade-800 flex items-center gap-[8px]">
94
+ <IconObjectBook
74
95
  size="16"
75
96
  strokeColor="blue-600"
76
97
  hoverStrokeColor="jade-600"
@@ -80,14 +101,114 @@ import { IconBook } from '@cypress-design/vue-icon'
80
101
  </template>
81
102
  ```
82
103
 
83
- ## install
104
+ <!-- props are hardcoded here since volar (vue-component-meta) breaks before getting to generate a proper doc for it -->
84
105
 
85
- ```bash
86
- npm install @cypress-design/vue-icon
87
- ```
106
+ ## Props
88
107
 
89
- or with yarn
108
+ ### size
90
109
 
91
- ```bash
92
- yarn add @cypress-design/vue-icon
93
- ```
110
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">"4" | "8" | "12" | "16" | "20" | "24" | "48" | "64"</code></p>
111
+
112
+ Size of the icons canvas (in px)
113
+
114
+ ### interactiveColorsOnGroup
115
+
116
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">boolean</code> (optional)</p>
117
+
118
+ Should the interactive variants `hover` and `focus`<br/>be applied on the icon itself or on the parent<br/>group defined in windiCSS
119
+
120
+ ### strokeColor
121
+
122
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
123
+
124
+ Color of the stroke
125
+
126
+ ### hoverStrokeColor
127
+
128
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
129
+
130
+ Color of the stroke when hovered
131
+
132
+ ### focusStrokeColor
133
+
134
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
135
+
136
+ Color of the stroke when focused
137
+
138
+ ### hocusStrokeColor
139
+
140
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
141
+
142
+ Color of the stroke when both focused and hovered
143
+
144
+ ### fillColor
145
+
146
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
147
+
148
+ Color of the fill
149
+
150
+ ### hoverFillColor
151
+
152
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
153
+
154
+ Color of the fill when hovered
155
+
156
+ ### focusFillColor
157
+
158
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
159
+
160
+ Color of the fill when focused
161
+
162
+ ### hocusFillColor
163
+
164
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
165
+
166
+ Color of the fill when both focused and hovered
167
+
168
+ ### secondaryStrokeColor
169
+
170
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
171
+
172
+ Color of the secondary stroke
173
+
174
+ ### hoverSecondaryStrokeColor
175
+
176
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
177
+
178
+ Color of the secondary stroke when hovered
179
+
180
+ ### focusSecondaryStrokeColor
181
+
182
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
183
+
184
+ Color of the secondary stroke when focused
185
+
186
+ ### hocusSecondaryStrokeColor
187
+
188
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
189
+
190
+ Color of the secondary stroke when both focused and hovered
191
+
192
+ ### secondaryFillColor
193
+
194
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
195
+
196
+ Color of the secondary fill
197
+
198
+ ### hoverSecondaryFillColor
199
+
200
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
201
+
202
+ Color of the secondary fill when hovered
203
+
204
+ ### focusSecondaryFillColor
205
+
206
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
207
+
208
+ Color of the secondary fill when focused
209
+
210
+ ### hocusSecondaryFillColor
211
+
212
+ <p><b>type</b> <code class="bg-gray-50 dark:bg-gray-800 py-[2px] px-[4px]">WindiColor</code> (optional)</p>
213
+
214
+ Color of the secondary fill when both focused and hovered