@cypress-design/vue-icon 0.24.0 → 0.24.1

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.
@@ -2,14 +2,14 @@ $ yarn build:codegen && yarn build:module && yarn build:types
2
2
  $ node ./generate-icons.js
3
3
  $ yarn vite build
4
4
  $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/vite build
5
- vite v4.4.4 building for production...
5
+ vite v4.4.6 building for production...
6
6
  transforming...
7
7
  ✓ 4 modules transformed.
8
8
  rendering chunks...
9
9
  computing gzip size...
10
- dist/index.es.mjs 263.56 kB │ gzip: 51.64 kB │ map: 444.62 kB
10
+ dist/index.es.mjs 263.56 kB │ gzip: 51.64 kB │ map: 444.18 kB
11
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 228.88 kB │ gzip: 51.08 kB │ map: 432.39 kB
13
- ✓ built in 6.64s
12
+ dist/index.umd.js 228.88 kB │ gzip: 51.08 kB │ map: 431.95 kB
13
+ ✓ built in 9.56s
14
14
  $ yarn tsc --project ./tsconfig.build.json
15
15
  $ /home/runner/work/cypress-design/cypress-design/node_modules/.bin/tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @cypress-design/vue-icon
2
2
 
3
+ ## 0.24.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#290](https://github.com/cypress-io/cypress-design/pull/290) [`b3b4fbc`](https://github.com/cypress-io/cypress-design/commit/b3b4fbc189457a311abaf93959ec211067957a5c) Thanks [@elevatebart](https://github.com/elevatebart)! - fix: types of class attribute in icon
8
+
3
9
  ## 0.24.0
4
10
 
5
11
  ### Minor Changes
package/Icon.ts CHANGED
@@ -14,8 +14,12 @@ export default defineComponent(
14
14
  (
15
15
  // the OpenIconProps helps volar extract the documentation from the props
16
16
  // since the IconProps are more restrictive, it will not change the use behavior
17
- props: OpenIconProps & Pick<IconProps, 'name'> & { class?: string },
18
- { attrs }: { attrs: Omit<SVGAttributes, 'name' | 'class'> }
17
+ props: OpenIconProps &
18
+ Pick<IconProps, 'name'> & {
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ class?: any
21
+ },
22
+ { attrs }: { attrs: Omit<SVGAttributes, 'name' | 'class'> },
19
23
  ) => {
20
24
  const ret = computed(() => {
21
25
  const { class: className, ...otherProps } = props
@@ -24,7 +28,7 @@ export default defineComponent(
24
28
  })
25
29
 
26
30
  const { componentProps, defs } = compileVueIconProperties(
27
- computed(() => ret.value.iconProps)
31
+ computed(() => ret.value.iconProps),
28
32
  )
29
33
 
30
34
  const { shouldRenderDefs } = useShouldRenderDefs(props.name, defs)
@@ -65,5 +69,5 @@ export default defineComponent(
65
69
  'name',
66
70
  'class',
67
71
  ],
68
- }
72
+ },
69
73
  )
package/IconVue.cy.tsx CHANGED
@@ -26,7 +26,27 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
26
26
  mount(() => <IconDocumentBlank {...props} />)
27
27
  })
28
28
 
29
- it('renders multiple times an icon with defs with the Icon comp', () => {
29
+ it('renders correctly with array classes', () => {
30
+ mount(() => (
31
+ <IconObjectBookCode
32
+ class={[
33
+ 'text-red-100',
34
+ 'text-red-500',
35
+ { 'text-indigo-100': true, 'text-indigo-600': true },
36
+ ]}
37
+ fillColor="red-100"
38
+ strokeColor="red-500"
39
+ secondaryFillColor="indigo-100"
40
+ secondaryStrokeColor="indigo-600"
41
+ />
42
+ ))
43
+
44
+ cy.get('svg')
45
+ .should('have.class', 'text-red-100')
46
+ .and('have.class', 'text-red-500')
47
+ })
48
+
49
+ it('renders multiple times an icon with defs with the generic Icon component', () => {
30
50
  mount(() => (
31
51
  <div class="p-2">
32
52
  <Icon name="browser-webkit" class="w-16 h-16 hidden" />
@@ -80,9 +100,9 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
80
100
  cy.get('button').click()
81
101
  })
82
102
 
83
- it('renders multiple times an icon with defs with the Icon comp', () => {
103
+ it('renders multiple times an icon with defs with the Icon component and toggle it', () => {
84
104
  cy.viewport(200, 200)
85
- const iconName = ref<'browser-webkit' | 'browser-safari'>('browser-safari')
105
+ const iconName = ref<'browser-edge' | 'browser-safari'>('browser-safari')
86
106
  mount(() => (
87
107
  <div class="p-2 flex flex-col h-screen items-center justify-center">
88
108
  <Icon name={iconName.value} class="w-16 h-16 hidden" />
@@ -90,9 +110,9 @@ describe('Icon', { viewportWidth: 80, viewportHeight: 80 }, () => {
90
110
  <button
91
111
  onClick={() =>
92
112
  (iconName.value =
93
- iconName.value === 'browser-webkit'
113
+ iconName.value === 'browser-edge'
94
114
  ? 'browser-safari'
95
- : 'browser-webkit')
115
+ : 'browser-edge')
96
116
  }
97
117
  >
98
118
  toggle