@payfit/unity-illustrations 0.0.0-alpha.12 → 0.0.0-alpha.15
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-illustrations",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.15",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.cts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"src"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@payfit/unity-themes": "0.0.0-alpha.
|
|
41
|
+
"@payfit/unity-themes": "0.0.0-alpha.15",
|
|
42
42
|
"@storybook/addon-a11y": "9.0.11",
|
|
43
43
|
"@storybook/addon-docs": "9.0.11",
|
|
44
44
|
"@storybook/addon-links": "9.0.11",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tailwind-variants": "0.2.1"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@payfit/unity-themes": "0.0.0-alpha.
|
|
64
|
+
"@payfit/unity-themes": "0.0.0-alpha.15",
|
|
65
65
|
"react": "^18",
|
|
66
66
|
"react-dom": "^18",
|
|
67
67
|
"svgo": "3.3.2"
|
|
@@ -46,24 +46,6 @@ function MyComponent() {
|
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
### Bulk imports
|
|
50
|
-
|
|
51
|
-
You can also import illustrations in bulk from the package's main export. This is less efficient than individual imports, but it's useful if you want to import many illustrations at once.
|
|
52
|
-
|
|
53
|
-
```tsx
|
|
54
|
-
import { Illustration, Dashboard, FAQ, Library } from '@payfit/unity-illustrations'
|
|
55
|
-
|
|
56
|
-
function MyComponent() {
|
|
57
|
-
return (
|
|
58
|
-
<>
|
|
59
|
-
<Illustration src={Dashboard} alt="Dashboard illustration" variant="picture" className="uy-size-600" />
|
|
60
|
-
<Illustration src={FAQ} alt="FAQ illustration" variant="picture" className="uy-size-600" />
|
|
61
|
-
<Illustration src={Library} alt="Library illustration" variant="picture" className="uy-size-600" />
|
|
62
|
-
</>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
49
|
### Dynamic imports
|
|
68
50
|
|
|
69
51
|
You can also use dynamic imports to import illustrations on demand. This is useful if you want to import illustrations only when they are needed or under certain dynamic conditions. For this case, make sure to use the individual import syntax.
|
|
@@ -76,8 +58,7 @@ function MyComponent() {
|
|
|
76
58
|
}
|
|
77
59
|
```
|
|
78
60
|
|
|
79
|
-
> **Note:**
|
|
80
|
-
> **Note:** Similarly, avoid using variables in dynamic imports, like `const Dashboard = await import('@payfit/unity-illustrations/${illustrationName}')`, as it will not be able to be tree-shaken.
|
|
61
|
+
> **Note:** Avoid using variables in dynamic imports, like `const Dashboard = await import('@payfit/unity-illustrations/${illustrationName}')`, as it will not be able to be tree-shaken.
|
|
81
62
|
|
|
82
63
|
## TypeScript Support
|
|
83
64
|
|
|
@@ -66,7 +66,7 @@ const IllustrationLibrary = ({ filter }: { filter?: 'filled' | 'outlined' }) =>
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
const copyToClipboard = useCallback((illustrationName: string) => {
|
|
69
|
-
const importStatement = `import ${illustrationName} from '@payfit/unity-illustrations/${illustrationName}'`
|
|
69
|
+
const importStatement = `import ${illustrationName} from '@payfit/unity-illustrations/assets/${illustrationName}'`
|
|
70
70
|
|
|
71
71
|
navigator.clipboard.writeText(importStatement).then(() => {
|
|
72
72
|
setCopiedIllustration(illustrationName)
|