@cypress-design/vue-icon 0.2.0 → 0.3.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/CHANGELOG.md +11 -0
- package/Icon.stories.mdx +1 -3
- package/Icon.ts +15 -17
- package/IconVue.cy.tsx +15 -0
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.d.ts.map +1 -1
- package/dist/TreeShakableIcons.d.ts +154 -120
- package/dist/TreeShakableIcons.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +234 -66
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/generate-icons.js +18 -18
- package/index.ts +5 -5
- package/package.json +3 -3
- package/tsconfig.build.json +1 -1
- package/vite.config.ts +3 -3
- package/Icon.cy.tsx +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @cypress-design/vue-icon
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#33](https://github.com/cypress-io/cypress-design/pull/33) [`5f9cf10`](https://github.com/cypress-io/cypress-design/commit/5f9cf10ff4709fcd7d322c2dc5dbc676473b433e) Thanks [@elevatebart](https://github.com/elevatebart)! - Allow vue icon to have a class
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`5f9cf10`](https://github.com/cypress-io/cypress-design/commit/5f9cf10ff4709fcd7d322c2dc5dbc676473b433e), [`69b3327`](https://github.com/cypress-io/cypress-design/commit/69b332757ba3b73d0ae881c5959daa7a2e644fe0)]:
|
|
12
|
+
- @cypress-design/icon-registry@0.3.0
|
|
13
|
+
|
|
3
14
|
## 0.2.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/Icon.stories.mdx
CHANGED
|
@@ -44,7 +44,7 @@ import Icon from './Icon'
|
|
|
44
44
|
}}
|
|
45
45
|
/>
|
|
46
46
|
|
|
47
|
-
<Canvas>
|
|
47
|
+
<Canvas withSource="none">
|
|
48
48
|
<Story name="Icon">
|
|
49
49
|
{(args) => (
|
|
50
50
|
{
|
|
@@ -68,8 +68,6 @@ import Icon from './Icon'
|
|
|
68
68
|
</Story>
|
|
69
69
|
</Canvas>
|
|
70
70
|
|
|
71
|
-
<ArgsTable/>
|
|
72
|
-
|
|
73
71
|
## Usage
|
|
74
72
|
|
|
75
73
|
The simple way using the Icon component
|
package/Icon.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type IconProps, compileIcon } from '@cypress-design/icon-registry'
|
|
2
|
-
import { h, type SVGAttributes } from 'vue'
|
|
1
|
+
import { type IconProps, compileIcon } from '@cypress-design/icon-registry'
|
|
2
|
+
import { h, type SVGAttributes } from 'vue'
|
|
3
3
|
|
|
4
4
|
export default (props: IconProps & Omit<SVGAttributes, 'name'>) => {
|
|
5
|
-
return h('svg', compileVueIconProperties(compileIcon(props)))
|
|
6
|
-
}
|
|
5
|
+
return h('svg', compileVueIconProperties(compileIcon(props)))
|
|
6
|
+
}
|
|
7
7
|
|
|
8
8
|
export const compileVueIconProperties = ({
|
|
9
9
|
body,
|
|
@@ -13,15 +13,16 @@ export const compileVueIconProperties = ({
|
|
|
13
13
|
fillColor,
|
|
14
14
|
secondaryStrokeColor,
|
|
15
15
|
secondaryFillColor,
|
|
16
|
+
class: className,
|
|
16
17
|
...attributes
|
|
17
18
|
}: SVGAttributes & {
|
|
18
|
-
body: string
|
|
19
|
-
compiledClasses: string[]
|
|
20
|
-
size: string
|
|
21
|
-
strokeColor?: string
|
|
22
|
-
fillColor?: string
|
|
23
|
-
secondaryStrokeColor?: string
|
|
24
|
-
secondaryFillColor?: string
|
|
19
|
+
body: string
|
|
20
|
+
compiledClasses: string[]
|
|
21
|
+
size: string
|
|
22
|
+
strokeColor?: string
|
|
23
|
+
fillColor?: string
|
|
24
|
+
secondaryStrokeColor?: string
|
|
25
|
+
secondaryFillColor?: string
|
|
25
26
|
}) => {
|
|
26
27
|
const componentProps: any = {
|
|
27
28
|
width: size,
|
|
@@ -29,12 +30,9 @@ export const compileVueIconProperties = ({
|
|
|
29
30
|
fill: 'none',
|
|
30
31
|
innerHTML: body,
|
|
31
32
|
...attributes, // add all standard attributes back to the svg tag
|
|
32
|
-
};
|
|
33
|
-
if (attributes.class) {
|
|
34
|
-
compiledClasses.push(attributes.class);
|
|
35
33
|
}
|
|
36
34
|
if (compiledClasses.length) {
|
|
37
|
-
componentProps.class = compiledClasses.join(' ')
|
|
35
|
+
componentProps.class = compiledClasses.join(' ')
|
|
38
36
|
}
|
|
39
|
-
return componentProps
|
|
40
|
-
}
|
|
37
|
+
return componentProps
|
|
38
|
+
}
|
package/IconVue.cy.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconObjectBookCode } from './index'
|
|
2
|
+
import { mount } from 'cypress/vue'
|
|
3
|
+
|
|
4
|
+
describe('Icon', () => {
|
|
5
|
+
it('renders correctly', () => {
|
|
6
|
+
mount(() => (
|
|
7
|
+
<IconObjectBookCode
|
|
8
|
+
fillColor="red-100"
|
|
9
|
+
strokeColor="red-500"
|
|
10
|
+
secondaryFillColor="indigo-100"
|
|
11
|
+
secondaryStrokeColor="indigo-600"
|
|
12
|
+
/>
|
|
13
|
+
))
|
|
14
|
+
})
|
|
15
|
+
})
|
package/dist/Icon.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const _default: (props: IconProps & Omit<SVGAttributes, 'name'>) => impo
|
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}>;
|
|
6
6
|
export default _default;
|
|
7
|
-
export declare const compileVueIconProperties: ({ body, compiledClasses, size, strokeColor, fillColor, secondaryStrokeColor, secondaryFillColor, ...attributes }: SVGAttributes & {
|
|
7
|
+
export declare const compileVueIconProperties: ({ body, compiledClasses, size, strokeColor, fillColor, secondaryStrokeColor, secondaryFillColor, class: className, ...attributes }: SVGAttributes & {
|
|
8
8
|
body: string;
|
|
9
9
|
compiledClasses: string[];
|
|
10
10
|
size: string;
|
package/dist/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../Icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../Icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAK,KAAK,aAAa,EAAE,MAAM,KAAK,CAAA;gCAEpB,SAAS,GAAG,KAAK,aAAa,EAAE,MAAM,CAAC;;;AAA9D,wBAEC;AAED,eAAO,MAAM,wBAAwB;UAW7B,MAAM;qBACK,MAAM,EAAE;UACnB,MAAM;;;;;SAiBb,CAAA"}
|