@wise/art 0.0.0-experimental-1d6d788

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.
Files changed (174) hide show
  1. package/README.md +155 -0
  2. package/dist/CheckMark-C7SPkQjr.esm.js +38 -0
  3. package/dist/CheckMark-C7SPkQjr.esm.js.map +1 -0
  4. package/dist/CheckMark-DbWrBNtH.js +40 -0
  5. package/dist/CheckMark-DbWrBNtH.js.map +1 -0
  6. package/dist/Confetti-BbPKLCpN.js +37 -0
  7. package/dist/Confetti-BbPKLCpN.js.map +1 -0
  8. package/dist/Confetti-DPMBG56o.esm.js +35 -0
  9. package/dist/Confetti-DPMBG56o.esm.js.map +1 -0
  10. package/dist/Flower-Dhjb1Y6Z.esm.js +28 -0
  11. package/dist/Flower-Dhjb1Y6Z.esm.js.map +1 -0
  12. package/dist/Flower-I053ey4H.js +30 -0
  13. package/dist/Flower-I053ey4H.js.map +1 -0
  14. package/dist/Globe-CJDK9wR6.esm.js +44 -0
  15. package/dist/Globe-CJDK9wR6.esm.js.map +1 -0
  16. package/dist/Globe-DD_Ybugr.js +46 -0
  17. package/dist/Globe-DD_Ybugr.js.map +1 -0
  18. package/dist/Graph-D1M4JGez.esm.js +32 -0
  19. package/dist/Graph-D1M4JGez.esm.js.map +1 -0
  20. package/dist/Graph-DrtwCTeB.js +34 -0
  21. package/dist/Graph-DrtwCTeB.js.map +1 -0
  22. package/dist/Illustration.css +1 -0
  23. package/dist/Interest-5AzhwfRZ.js +53 -0
  24. package/dist/Interest-5AzhwfRZ.js.map +1 -0
  25. package/dist/Interest-d9YRzYsQ.esm.js +51 -0
  26. package/dist/Interest-d9YRzYsQ.esm.js.map +1 -0
  27. package/dist/Jars-Bj5zryIy.esm.js +51 -0
  28. package/dist/Jars-Bj5zryIy.esm.js.map +1 -0
  29. package/dist/Jars-DTpuM002.js +53 -0
  30. package/dist/Jars-DTpuM002.js.map +1 -0
  31. package/dist/Lock-Ca-LEge7.js +44 -0
  32. package/dist/Lock-Ca-LEge7.js.map +1 -0
  33. package/dist/Lock-xy_KoW2g.esm.js +42 -0
  34. package/dist/Lock-xy_KoW2g.esm.js.map +1 -0
  35. package/dist/MagnifyingGlass-CR0nvKTo.esm.js +31 -0
  36. package/dist/MagnifyingGlass-CR0nvKTo.esm.js.map +1 -0
  37. package/dist/MagnifyingGlass-DFASWsdn.js +33 -0
  38. package/dist/MagnifyingGlass-DFASWsdn.js.map +1 -0
  39. package/dist/Marble-BZIHD9uw.js +45 -0
  40. package/dist/Marble-BZIHD9uw.js.map +1 -0
  41. package/dist/Marble-Dn1NhVNa.esm.js +43 -0
  42. package/dist/Marble-Dn1NhVNa.esm.js.map +1 -0
  43. package/dist/MarbleCard-CLq_nDBM.esm.js +46 -0
  44. package/dist/MarbleCard-CLq_nDBM.esm.js.map +1 -0
  45. package/dist/MarbleCard-CtjGjEPp.js +48 -0
  46. package/dist/MarbleCard-CtjGjEPp.js.map +1 -0
  47. package/dist/MultiCurrency-B5HtZfTG.esm.js +62 -0
  48. package/dist/MultiCurrency-B5HtZfTG.esm.js.map +1 -0
  49. package/dist/MultiCurrency-Bh-7t3nH.js +64 -0
  50. package/dist/MultiCurrency-Bh-7t3nH.js.map +1 -0
  51. package/dist/Plane-D-NW6i-O.js +40 -0
  52. package/dist/Plane-D-NW6i-O.js.map +1 -0
  53. package/dist/Plane-aYcLKAhf.esm.js +38 -0
  54. package/dist/Plane-aYcLKAhf.esm.js.map +1 -0
  55. package/dist/Scene-ClmxQ_BP.esm.js +54 -0
  56. package/dist/Scene-ClmxQ_BP.esm.js.map +1 -0
  57. package/dist/Scene-DNB5gL2m.js +56 -0
  58. package/dist/Scene-DNB5gL2m.js.map +1 -0
  59. package/dist/common-DBpCdW70.esm.js +14 -0
  60. package/dist/common-DBpCdW70.esm.js.map +1 -0
  61. package/dist/common-H4L6Hbbh.js +16 -0
  62. package/dist/common-H4L6Hbbh.js.map +1 -0
  63. package/dist/common.d.ts +15 -0
  64. package/dist/common.d.ts.map +1 -0
  65. package/dist/flags/Flag.d.ts +14 -0
  66. package/dist/flags/Flag.d.ts.map +1 -0
  67. package/dist/flags/Flag.spec.d.ts +2 -0
  68. package/dist/flags/Flag.spec.d.ts.map +1 -0
  69. package/dist/flags/index.d.ts +3 -0
  70. package/dist/flags/index.d.ts.map +1 -0
  71. package/dist/flags/metadata.d.ts +2 -0
  72. package/dist/flags/metadata.d.ts.map +1 -0
  73. package/dist/illustrations/Illustration.d.ts +20 -0
  74. package/dist/illustrations/Illustration.d.ts.map +1 -0
  75. package/dist/illustrations/Illustration.spec.d.ts +2 -0
  76. package/dist/illustrations/Illustration.spec.d.ts.map +1 -0
  77. package/dist/illustrations/index.d.ts +5 -0
  78. package/dist/illustrations/index.d.ts.map +1 -0
  79. package/dist/illustrations/metadata.d.ts +113 -0
  80. package/dist/illustrations/metadata.d.ts.map +1 -0
  81. package/dist/illustrations3d/Illustration3D.d.ts +10 -0
  82. package/dist/illustrations3d/Illustration3D.d.ts.map +1 -0
  83. package/dist/illustrations3d/Scene.d.ts +10 -0
  84. package/dist/illustrations3d/Scene.d.ts.map +1 -0
  85. package/dist/illustrations3d/index.d.ts +5 -0
  86. package/dist/illustrations3d/index.d.ts.map +1 -0
  87. package/dist/illustrations3d/models/CheckMark.d.ts +3 -0
  88. package/dist/illustrations3d/models/CheckMark.d.ts.map +1 -0
  89. package/dist/illustrations3d/models/Confetti.d.ts +3 -0
  90. package/dist/illustrations3d/models/Confetti.d.ts.map +1 -0
  91. package/dist/illustrations3d/models/Flower.d.ts +3 -0
  92. package/dist/illustrations3d/models/Flower.d.ts.map +1 -0
  93. package/dist/illustrations3d/models/Globe.d.ts +3 -0
  94. package/dist/illustrations3d/models/Globe.d.ts.map +1 -0
  95. package/dist/illustrations3d/models/Graph.d.ts +3 -0
  96. package/dist/illustrations3d/models/Graph.d.ts.map +1 -0
  97. package/dist/illustrations3d/models/Interest.d.ts +3 -0
  98. package/dist/illustrations3d/models/Interest.d.ts.map +1 -0
  99. package/dist/illustrations3d/models/Jars.d.ts +3 -0
  100. package/dist/illustrations3d/models/Jars.d.ts.map +1 -0
  101. package/dist/illustrations3d/models/Lock.d.ts +3 -0
  102. package/dist/illustrations3d/models/Lock.d.ts.map +1 -0
  103. package/dist/illustrations3d/models/MagnifyingGlass.d.ts +3 -0
  104. package/dist/illustrations3d/models/MagnifyingGlass.d.ts.map +1 -0
  105. package/dist/illustrations3d/models/Marble.d.ts +3 -0
  106. package/dist/illustrations3d/models/Marble.d.ts.map +1 -0
  107. package/dist/illustrations3d/models/MarbleCard.d.ts +3 -0
  108. package/dist/illustrations3d/models/MarbleCard.d.ts.map +1 -0
  109. package/dist/illustrations3d/models/MultiCurrency.d.ts +3 -0
  110. package/dist/illustrations3d/models/MultiCurrency.d.ts.map +1 -0
  111. package/dist/illustrations3d/models/Plane.d.ts +3 -0
  112. package/dist/illustrations3d/models/Plane.d.ts.map +1 -0
  113. package/dist/illustrations3d/utils.d.ts +9 -0
  114. package/dist/illustrations3d/utils.d.ts.map +1 -0
  115. package/dist/illustrations3d/utils.spec.d.ts +2 -0
  116. package/dist/illustrations3d/utils.spec.d.ts.map +1 -0
  117. package/dist/index-ApMK-TMV.esm.js +377 -0
  118. package/dist/index-ApMK-TMV.esm.js.map +1 -0
  119. package/dist/index-CeTVmx_6.js +383 -0
  120. package/dist/index-CeTVmx_6.js.map +1 -0
  121. package/dist/index.d.ts +10 -0
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.esm.js +6 -0
  124. package/dist/index.esm.js.map +1 -0
  125. package/dist/index.js +23 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/rive/RiveIllustration.d.ts +13 -0
  128. package/dist/rive/RiveIllustration.d.ts.map +1 -0
  129. package/dist/rive/index.d.ts +3 -0
  130. package/dist/rive/index.d.ts.map +1 -0
  131. package/dist/rive/index.esm.js +47 -0
  132. package/dist/rive/index.esm.js.map +1 -0
  133. package/dist/rive/index.js +53 -0
  134. package/dist/rive/index.js.map +1 -0
  135. package/package.json +125 -0
  136. package/src/common.ts +17 -0
  137. package/src/flags/AllFlagsAndSizes.stories.tsx +131 -0
  138. package/src/flags/Flag.css +4 -0
  139. package/src/flags/Flag.spec.tsx +31 -0
  140. package/src/flags/Flag.stories.tsx +20 -0
  141. package/src/flags/Flag.tsx +65 -0
  142. package/src/flags/index.ts +2 -0
  143. package/src/flags/metadata.ts +9 -0
  144. package/src/illustrations/Illustration.css +27 -0
  145. package/src/illustrations/Illustration.spec.tsx +20 -0
  146. package/src/illustrations/Illustration.stories.tsx +58 -0
  147. package/src/illustrations/Illustration.tsx +95 -0
  148. package/src/illustrations/index.ts +5 -0
  149. package/src/illustrations/metadata.ts +13 -0
  150. package/src/illustrations3d/Illustration3D.stories.tsx +101 -0
  151. package/src/illustrations3d/Illustration3D.tsx +139 -0
  152. package/src/illustrations3d/Scene.tsx +62 -0
  153. package/src/illustrations3d/index.ts +6 -0
  154. package/src/illustrations3d/models/CheckMark.tsx +30 -0
  155. package/src/illustrations3d/models/Confetti.tsx +29 -0
  156. package/src/illustrations3d/models/Flower.tsx +24 -0
  157. package/src/illustrations3d/models/Globe.tsx +41 -0
  158. package/src/illustrations3d/models/Graph.tsx +26 -0
  159. package/src/illustrations3d/models/Interest.tsx +42 -0
  160. package/src/illustrations3d/models/Jars.tsx +47 -0
  161. package/src/illustrations3d/models/Lock.tsx +38 -0
  162. package/src/illustrations3d/models/MagnifyingGlass.tsx +30 -0
  163. package/src/illustrations3d/models/Marble.tsx +47 -0
  164. package/src/illustrations3d/models/MarbleCard.tsx +50 -0
  165. package/src/illustrations3d/models/MultiCurrency.tsx +58 -0
  166. package/src/illustrations3d/models/Plane.tsx +33 -0
  167. package/src/illustrations3d/utils.spec.tsx +36 -0
  168. package/src/illustrations3d/utils.ts +73 -0
  169. package/src/index.css +3 -0
  170. package/src/index.ts +12 -0
  171. package/src/rive/RiveIllustration.css +18 -0
  172. package/src/rive/RiveIllustration.stories.tsx +20 -0
  173. package/src/rive/RiveIllustration.tsx +54 -0
  174. package/src/rive/index.ts +2 -0
@@ -0,0 +1,47 @@
1
+ import { useGLTF } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const Marble = () => {
8
+ const model = useGLTF(defineSrc('marble.glb'));
9
+
10
+ const lights = useLoader(ObjectLoader, defineSrc('marble-light.json'));
11
+
12
+ const sphere = model.scene.getObjectByName('Sphere1');
13
+ sphere.material.depthTest = true;
14
+
15
+ const stripeBottom = model.scene.getObjectByName('Strip_Center_Big_(4th_-_Bottom_Layer)');
16
+ stripeBottom.material.depthTest = false;
17
+ stripeBottom.renderOrder = 1;
18
+
19
+ const stripeLeft = model.scene.getObjectByName('Strip_Left_(3rd)');
20
+ stripeLeft.material.depthTest = false;
21
+ stripeLeft.renderOrder = 2;
22
+
23
+ const stripeRight = model.scene.getObjectByName('Strip_Left_(3rd)');
24
+ stripeRight.material.depthTest = false;
25
+ stripeRight.renderOrder = 3;
26
+
27
+ const stripeTop = model.scene.getObjectByName('Strip_Center_(1st_-_Top_Layer)');
28
+ stripeTop.material.depthTest = false;
29
+ stripeTop.renderOrder = 4;
30
+
31
+ const animatedMaps = [sphere, stripeTop, stripeBottom, stripeLeft, stripeRight].map(
32
+ (object) => object.material.map,
33
+ );
34
+
35
+ useFrame(() => {
36
+ animatedMaps.forEach((map) => (map.offset.y += -0.0015));
37
+ });
38
+
39
+ return (
40
+ <>
41
+ <primitive scale={1.4} position={[0, -11, 0]} object={model.scene} />
42
+ <primitive object={lights} />
43
+ </>
44
+ );
45
+ };
46
+
47
+ export default Marble;
@@ -0,0 +1,50 @@
1
+ import { useGLTF } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const MarbleCard = () => {
8
+ const model = useGLTF(defineSrc('marble-card.glb'));
9
+
10
+ const lights = useLoader(ObjectLoader, defineSrc('marble-card-light.json'));
11
+ const sphere = model.scene.getObjectByName('Sphere1');
12
+ sphere.material.depthTest = true;
13
+
14
+ const stripeBottom = model.scene.getObjectByName('Strip_Center_Big_(4th_-_Bottom_Layer)');
15
+ stripeBottom.material.depthTest = false;
16
+ stripeBottom.renderOrder = 1;
17
+
18
+ const stripeLeft = model.scene.getObjectByName('Strip_Left_(3rd)');
19
+ stripeLeft.material.depthTest = false;
20
+ stripeLeft.renderOrder = 2;
21
+
22
+ const stripeRight = model.scene.getObjectByName('Strip_Right_(2nd)');
23
+ stripeRight.material.depthTest = false;
24
+ stripeRight.renderOrder = 3;
25
+
26
+ const stripeTop = model.scene.getObjectByName('Strip_Center_(1st_-_Top_Layer)');
27
+ stripeTop.material.depthTest = false;
28
+ stripeTop.renderOrder = 4;
29
+
30
+ const card = model.scene.getObjectByName('Plane');
31
+ card.material.depthTest = false;
32
+ card.material.metalness = 0;
33
+
34
+ const animatedMaps = [sphere, stripeTop, stripeBottom, stripeLeft, stripeRight].map(
35
+ (object) => object.material.map,
36
+ );
37
+
38
+ useFrame(() => {
39
+ animatedMaps.forEach((map) => (map.offset.y += -0.0015));
40
+ });
41
+
42
+ return (
43
+ <>
44
+ <primitive scale={1.4} position={[0, -10, 0]} object={model.scene} />
45
+ <primitive object={lights} />
46
+ </>
47
+ );
48
+ };
49
+
50
+ export default MarbleCard;
@@ -0,0 +1,58 @@
1
+ import { useGLTF, useAnimations } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { useRef } from 'react';
4
+ import { ObjectLoader, TextureLoader, Color } from 'three';
5
+
6
+ import { defineSrc } from '../utils';
7
+
8
+ const MultiCurrency = () => {
9
+ const ref = useRef();
10
+ const model = useGLTF(defineSrc('multi-currency.glb'));
11
+
12
+ const lights = useLoader(ObjectLoader, defineSrc('multi-currency-light.json'));
13
+ const wiseLogo = useLoader(TextureLoader, defineSrc('wise-flag-map-bump.jpg'));
14
+
15
+ const animatedMaps = [];
16
+
17
+ model.scene.traverse((child) => {
18
+ if (child.name.includes('Note')) {
19
+ child.castShadow = true;
20
+ child.receiveShadow = true;
21
+ }
22
+
23
+ if (child.name.startsWith('Coin_') && child.isMesh) {
24
+ const { material } = child;
25
+ material.bumpMap = wiseLogo;
26
+ material.bumpMap.flipY = false;
27
+ material.bumpScale = 1;
28
+ material.color = new Color(0.49, 0.49, 0.49);
29
+ child.castShadow = false;
30
+ child.receiveShadow = false;
31
+ }
32
+
33
+ if (child.name.startsWith('NoteBase_') && child.isMesh) {
34
+ animatedMaps.push(child.material.map);
35
+ }
36
+
37
+ if (child.name.includes('Wise') && child.isMesh) {
38
+ animatedMaps.push(child.material.map);
39
+ }
40
+ });
41
+
42
+ const { mixer, clips } = useAnimations(model.animations, ref);
43
+ useFrame(() => {
44
+ animatedMaps.forEach((animatedMap) => {
45
+ animatedMap.offset.x += 0.001;
46
+ });
47
+ mixer.clipAction(clips[0]).play();
48
+ });
49
+
50
+ return (
51
+ <>
52
+ <primitive ref={ref} position={[-0.5, -10, 0]} scale={1.3} object={model.scene} />
53
+ <primitive object={lights} />
54
+ </>
55
+ );
56
+ };
57
+
58
+ export default MultiCurrency;
@@ -0,0 +1,33 @@
1
+ import { useGLTF, useAnimations } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { useRef } from 'react';
4
+ import { ObjectLoader } from 'three';
5
+
6
+ import { defineSrc } from '../utils';
7
+
8
+ const Plane = () => {
9
+ const ref = useRef();
10
+ const model = useGLTF(defineSrc('plane.glb'));
11
+
12
+ const lights = useLoader(ObjectLoader, defineSrc('plane-light.json'));
13
+ const plane = model.scene.getObjectByName('Plane_6_update');
14
+
15
+ const { mixer, clips } = useAnimations(model.animations, ref);
16
+ useFrame(() => {
17
+ model.materials['Tapestry WebGL'].map.offset.y += 0.018;
18
+
19
+ plane.position.x = 0.45;
20
+
21
+ plane.position.y = 7.5;
22
+ mixer.clipAction(clips[0]).play();
23
+ });
24
+
25
+ return (
26
+ <>
27
+ <primitive ref={ref} scale={1.3} position={[0, -7, 0]} object={model.scene} />
28
+ <primitive object={lights} />
29
+ </>
30
+ );
31
+ };
32
+
33
+ export default Plane;
@@ -0,0 +1,36 @@
1
+ /* eslint-disable testing-library/await-async-utils */
2
+ import '@testing-library/jest-dom';
3
+ import { waitFor, renderHook } from '@testing-library/react';
4
+
5
+ import { useBattery } from './utils';
6
+
7
+ describe('utils for 3D', () => {
8
+ describe('useBattery hook', () => {
9
+ it('returns default value when navigator#getBattery not implemented', () => {
10
+ const { result } = renderHook(() => useBattery());
11
+
12
+ expect(result.current).not.toBeNull();
13
+ });
14
+
15
+ it('returns device battery data when navigator#getBattery is implemented (mocked)', () => {
16
+ const testBatteryData = { level: 0.792 };
17
+ // eslint-disable-next-line jest/prefer-spy-on
18
+ navigator.getBattery = jest.fn().mockReturnValue(testBatteryData);
19
+ const { result } = renderHook(() => useBattery());
20
+
21
+ void waitFor(() => {
22
+ expect(result.current).toBe(testBatteryData);
23
+ });
24
+ });
25
+
26
+ it('returns default value when navigator#getBattery is implemented but not function', () => {
27
+ // eslint-disable-next-line jest/prefer-spy-on
28
+ navigator.getBattery = { level: 0.792 };
29
+ const { result } = renderHook(() => useBattery());
30
+
31
+ void waitFor(() => {
32
+ expect(result.current).toBe({ level: 1 });
33
+ });
34
+ });
35
+ });
36
+ });
@@ -0,0 +1,73 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ import type { IllustrationNames } from '../illustrations/metadata';
4
+
5
+ export function useBattery() {
6
+ const [batteryData, setBatteryData] = useState<{ level: number }>({ level: 1.0 });
7
+
8
+ useEffect(() => {
9
+ const getBatteryData = async () => {
10
+ // @ts-expect-error .getBattery exists in Navigator interface
11
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
12
+ const battery = await navigator.getBattery();
13
+
14
+ setBatteryData({
15
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
16
+ level: battery?.level,
17
+ });
18
+ };
19
+ // Check if the browser supports the Battery API
20
+ if (
21
+ 'getBattery' in navigator &&
22
+ navigator.getBattery !== undefined &&
23
+ typeof navigator.getBattery === 'function'
24
+ ) {
25
+ void getBatteryData();
26
+ }
27
+ }, []);
28
+
29
+ return batteryData;
30
+ }
31
+
32
+ export function isBatteryLow(batteryLevel: number): boolean {
33
+ return batteryLevel < 0.2;
34
+ }
35
+
36
+ export function isConnectionSlow(): boolean {
37
+ // @ts-expect-error .connection prop exists in Navigator interface
38
+ const { connection } = window.navigator;
39
+ if (connection === undefined) {
40
+ return false;
41
+ }
42
+ return (
43
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
44
+ ['slow-2g', '2g'].includes(connection?.effectiveType as string) ||
45
+ // @ts-expect-error Property 'connection' does exist on type 'Navigator'
46
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
47
+ navigator?.connection?.saveData === true
48
+ );
49
+ }
50
+
51
+ export function defineSrc(asset: string): string {
52
+ return `https://wise.com/web-art/assets/illustrations3d/${asset}`;
53
+ }
54
+
55
+ const illustration3DNames = [
56
+ 'lock',
57
+ 'globe',
58
+ 'confetti',
59
+ 'check-mark',
60
+ 'flower',
61
+ 'graph',
62
+ 'jars',
63
+ 'magnifying-glass',
64
+ 'marble',
65
+ 'marble-card',
66
+ 'multi-currency',
67
+ 'plane',
68
+ 'interest',
69
+ ];
70
+
71
+ export function isIllustrationSupport3D(asset: IllustrationNames): boolean {
72
+ return illustration3DNames.includes(asset);
73
+ }
package/src/index.css ADDED
@@ -0,0 +1,3 @@
1
+ @import './illustrations/Illustration.css';
2
+ @import './flags/Flag.css';
3
+ @import './rive/RiveIllustration.css';
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ export { Flag } from './flags';
2
+ export { default as Illustration } from './illustrations';
3
+ export { default as Illustration3D } from './illustrations3d';
4
+
5
+ export { Assets } from './illustrations';
6
+ export { Sizes } from './common';
7
+
8
+ export type { FlagProps } from './flags';
9
+ export type { IllustrationNames, IllustrationProps } from './illustrations';
10
+ export type { Illustration3DNames, Illustration3DProps } from './illustrations3d';
11
+
12
+ export { isIllustrationSupport3D } from './illustrations3d';
@@ -0,0 +1,18 @@
1
+ .wds-illustration-rive {
2
+ display: inline-flex;
3
+ }
4
+
5
+ .wds-illustration-rive-small {
6
+ width: 200px;
7
+ height: 200px;
8
+ }
9
+
10
+ .wds-illustration-rive-medium {
11
+ width: 300px;
12
+ height: 300px;
13
+ }
14
+
15
+ .wds-illustration-rive-large {
16
+ width: 500px;
17
+ height: 500px;
18
+ }
@@ -0,0 +1,20 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+
3
+ import RiveIllustrationExperimental from './RiveIllustration';
4
+
5
+ export default {
6
+ component: RiveIllustrationExperimental,
7
+ title: 'Rive Illustrations (Experimental)',
8
+ };
9
+
10
+ type Story = StoryObj<typeof RiveIllustrationExperimental>;
11
+
12
+ export const DocumentScan: Story = {
13
+ tags: ['autodocs'],
14
+ render: () => (
15
+ <>
16
+ <RiveIllustrationExperimental name="document-scan" />
17
+ <p>Note: This API is experimental and may be subject to changes or removal.</p>
18
+ </>
19
+ ),
20
+ };
@@ -0,0 +1,54 @@
1
+ import { useRive } from "@rive-app/react-webgl2";
2
+ import clsx from "clsx";
3
+ import { useEffect, useState } from "react";
4
+
5
+ import { Sizes } from "../common";
6
+ import type { Illustration3DProps } from "../illustrations3d";
7
+
8
+ export interface RiveProps {
9
+ src: string;
10
+ animationNames?: string | string[];
11
+ }
12
+
13
+ const Rive = ({ src, animationNames }: RiveProps) => {
14
+ const { RiveComponent } = useRive({
15
+ src,
16
+ animations: animationNames,
17
+ autoplay: true,
18
+ });
19
+
20
+ return (<RiveComponent />);
21
+ };
22
+
23
+ export type Props = {
24
+ name: 'document-scan';
25
+ size?: Illustration3DProps["size"];
26
+ className?: Illustration3DProps["className"];
27
+ };
28
+
29
+ const RiveIllustrationExperimental = ({ name, size: sizeProp = Sizes.MEDIUM, className }: Props) => {
30
+ const [size, setSize] = useState<Props['size']>(sizeProp);
31
+ useEffect(() => {
32
+ const isMobile: boolean =
33
+ (typeof window !== "undefined" && window?.matchMedia('(max-width: 575px)')?.matches) ?? false;
34
+ if (isMobile) {
35
+ setSize(Sizes.SMALL);
36
+ }
37
+ }, []);
38
+ return (
39
+ <div className={clsx('wds-illustration-rive', `wds-illustration-rive-${name}`, `wds-illustration-rive-${size}`, className)}>
40
+ {(() => {
41
+ if (name === 'document-scan') {
42
+ return (
43
+ <Rive
44
+ src="https://wise.com/web-art/assets/illustrations3d/rive/doc-scan.riv"
45
+ animationNames={["Scan Line Appearing", "Scan Line Moving"]}
46
+ />);
47
+ }
48
+ return null;
49
+ })()}
50
+ </div>
51
+ );
52
+ };
53
+
54
+ export default RiveIllustrationExperimental;
@@ -0,0 +1,2 @@
1
+ export type { Props as RiveIllustrationExperimentalProps } from './RiveIllustration';
2
+ export { default as RiveIllustrationExperimental } from './RiveIllustration';