@cypress-design/react-icon 0.18.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 CHANGED
@@ -1 +1 @@
1
- TreeShakableIcons.ts
1
+ _TreeShakableIcons.ts
@@ -0,0 +1,13 @@
1
+ $ yarn build:codegen && yarn build:module && yarn build:types
2
+ $ node ./generate-icons.js
3
+ $ rollup -c ./rollup.config.mjs
4
+ 
5
+ ./index.ts → ./dist/index.umd.js, ./dist/index.es.mjs...
6
+ (!) Mixing named and default exports
7
+ https://rollupjs.org/configuration-options/#output-exports
8
+ The following entry modules are using named and default exports together:
9
+ index.ts
10
+
11
+ Consumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
12
+ created ./dist/index.umd.js, ./dist/index.es.mjs in 13.9s
13
+ $ tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @cypress-design/react-icon
2
2
 
3
+ ## 0.20.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.19.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.18.2
4
23
 
5
24
  ### Patch Changes
package/IconReact.cy.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react'
2
2
  import Icon, { IconObjectBookCode } from './index'
3
- import { mount } from 'cypress/react'
3
+ import { mount } from 'cypress/react18'
4
4
 
5
5
  describe('Icon', () => {
6
6
  it('renders correctly', () => {
package/ReadMe.md CHANGED
@@ -1,17 +1,29 @@
1
1
  # Icon
2
2
 
3
+ ## Install
4
+
5
+ ```bash
6
+ npm install @cypress-design/react-icon
7
+ ```
8
+
9
+ or with yarn
10
+
11
+ ```bash
12
+ yarn add @cypress-design/react-icon
13
+ ```
14
+
3
15
  ## Usage
4
16
 
5
17
  The simple way using the Icon component
6
18
 
7
- ```tsx
8
- import { Icon } from '@cypress-design/react-icon'
19
+ ```tsx live
20
+ import Icon from '@cypress-design/react-icon'
9
21
 
10
22
  export const MyButtonWithIcon = () => {
11
23
  return (
12
- <button>
24
+ <button className="flex items-center gap-[8px] p-[8px] border-1 border-red-500">
13
25
  <Icon
14
- name="book"
26
+ name="object-book"
15
27
  size="16"
16
28
  strokeColor="blue-600"
17
29
  fillColor="red-200"
@@ -23,16 +35,16 @@ export const MyButtonWithIcon = () => {
23
35
  }
24
36
  ```
25
37
 
26
- The tree-shakable way (more optimized)
38
+ We can also import each icon components separately. When we use named imports, the results becomes tree-shakable (more optimized).
39
+ This means that the final bundle will not contain any of the unused icons code.
40
+ Only imported icons will end up in your app or website js.
27
41
 
28
- ```tsx
29
- import { IconBook } from '@cypress-design/react-icon'
42
+ ```tsx live
43
+ import { IconObjectBook } from '@cypress-design/react-icon'
30
44
 
31
45
  export const MyButtonWithIcon = () => {
32
46
  return (
33
- <button>
34
- <IconBook size="16" strokeColor="indigo-600" fillColor="red-200" />
35
- </button>
47
+ <IconObjectBook size="16" strokeColor="indigo-600" fillColor="red-200" />
36
48
  )
37
49
  }
38
50
  ```
@@ -41,13 +53,13 @@ Should you need to change the color of the icon on `hover` or `focus` prefix the
41
53
 
42
54
  Here, the `strokeColor` will change on hover from indigo to jade
43
55
 
44
- ```tsx
45
- import { IconBook } from '@cypress-design/react-icon'
56
+ ```tsx live
57
+ import { IconObjectBook } from '@cypress-design/react-icon'
46
58
 
47
59
  export const MyButtonWithIcon = () => {
48
60
  return (
49
61
  <button>
50
- <IconBook
62
+ <IconObjectBook
51
63
  size="16"
52
64
  strokeColor="indigo-600"
53
65
  hoverStrokeColor="jade-600"
@@ -62,14 +74,14 @@ This prop will change all the pseudo prefixes to be group focused instead of tri
62
74
 
63
75
  To achieve the same goal, in WindiCSS, we would use `group-hover:` instead of `hover:`.
64
76
 
65
- ```tsx
66
- import { IconBook } from '@cypress-design/react-icon'
77
+ ```tsx live
78
+ import { IconObjectBook } from '@cypress-design/react-icon'
67
79
 
68
80
  export const MyButtonWithIcon = () => {
69
81
  return (
70
- <button className="group hover:text-jade-800">
71
- <IconBook
72
- size="16"
82
+ <button className="flex items-center gap-[8px] group hover:text-jade-800">
83
+ <IconObjectBook
84
+ size="48"
73
85
  strokeColor="indigo-600"
74
86
  hoverStrokeColor="jade-600"
75
87
  interactiveColorsOnGroup
@@ -79,15 +91,3 @@ export const MyButtonWithIcon = () => {
79
91
  )
80
92
  }
81
93
  ```
82
-
83
- ## install
84
-
85
- ```bash
86
- npm install @cypress-design/react-icon
87
- ```
88
-
89
- or with yarn
90
-
91
- ```bash
92
- yarn add @cypress-design/react-icon
93
- ```