@wise/art 2.5.0-beta.8 → 2.6.0-beta.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.
Files changed (196) hide show
  1. package/README.md +0 -1
  2. package/dist/CheckMark-1d199954.js +39 -0
  3. package/dist/CheckMark-1d199954.js.map +1 -0
  4. package/dist/CheckMark-dfa7e17d.js +37 -0
  5. package/dist/CheckMark-dfa7e17d.js.map +1 -0
  6. package/dist/Confetti-3f6f42f8.js +36 -0
  7. package/dist/Confetti-3f6f42f8.js.map +1 -0
  8. package/dist/Confetti-a1500ca5.js +34 -0
  9. package/dist/Confetti-a1500ca5.js.map +1 -0
  10. package/dist/Flower-01a6ad2e.js +27 -0
  11. package/dist/Flower-01a6ad2e.js.map +1 -0
  12. package/dist/Flower-194046f6.js +29 -0
  13. package/dist/Flower-194046f6.js.map +1 -0
  14. package/dist/Globe-e0b92541.js +43 -0
  15. package/dist/Globe-e0b92541.js.map +1 -0
  16. package/dist/Globe-f9a29570.js +45 -0
  17. package/dist/Globe-f9a29570.js.map +1 -0
  18. package/dist/Graph-a5cabcf9.js +33 -0
  19. package/dist/Graph-a5cabcf9.js.map +1 -0
  20. package/dist/Graph-d719e9bc.js +31 -0
  21. package/dist/Graph-d719e9bc.js.map +1 -0
  22. package/dist/Jars-786486f1.js +50 -0
  23. package/dist/Jars-786486f1.js.map +1 -0
  24. package/dist/Jars-ce225524.js +52 -0
  25. package/dist/Jars-ce225524.js.map +1 -0
  26. package/dist/Lock-32a1942d.js +41 -0
  27. package/dist/Lock-32a1942d.js.map +1 -0
  28. package/dist/Lock-a8143e20.js +43 -0
  29. package/dist/Lock-a8143e20.js.map +1 -0
  30. package/dist/MagnifyingGlass-8d2fb672.js +32 -0
  31. package/dist/MagnifyingGlass-8d2fb672.js.map +1 -0
  32. package/dist/MagnifyingGlass-d6a087d9.js +30 -0
  33. package/dist/MagnifyingGlass-d6a087d9.js.map +1 -0
  34. package/dist/Marble-4abb104b.js +42 -0
  35. package/dist/Marble-4abb104b.js.map +1 -0
  36. package/dist/Marble-ce46aa0f.js +44 -0
  37. package/dist/Marble-ce46aa0f.js.map +1 -0
  38. package/dist/MarbleCard-56c75d72.js +47 -0
  39. package/dist/MarbleCard-56c75d72.js.map +1 -0
  40. package/dist/MarbleCard-877fd12e.js +45 -0
  41. package/dist/MarbleCard-877fd12e.js.map +1 -0
  42. package/dist/MultiCurrency-0e4db1a6.js +61 -0
  43. package/dist/MultiCurrency-0e4db1a6.js.map +1 -0
  44. package/dist/MultiCurrency-700fce5f.js +63 -0
  45. package/dist/MultiCurrency-700fce5f.js.map +1 -0
  46. package/dist/Plane-88c1d61e.js +37 -0
  47. package/dist/Plane-88c1d61e.js.map +1 -0
  48. package/dist/Plane-8eb0f41c.js +39 -0
  49. package/dist/Plane-8eb0f41c.js.map +1 -0
  50. package/dist/Scene-597f1100.js +50 -0
  51. package/dist/Scene-597f1100.js.map +1 -0
  52. package/dist/Scene-e2e3b7aa.js +48 -0
  53. package/dist/Scene-e2e3b7aa.js.map +1 -0
  54. package/dist/common.d.ts +15 -14
  55. package/dist/common.d.ts.map +1 -0
  56. package/dist/flags/Flag.d.ts +13 -12
  57. package/dist/flags/Flag.d.ts.map +1 -0
  58. package/dist/flags/index.d.ts +3 -2
  59. package/dist/flags/index.d.ts.map +1 -0
  60. package/dist/illustrations/Illustration.d.ts +21 -20
  61. package/dist/illustrations/Illustration.d.ts.map +1 -0
  62. package/dist/illustrations/index.d.ts +5 -4
  63. package/dist/illustrations/index.d.ts.map +1 -0
  64. package/dist/illustrations/metadata.d.ts +69 -68
  65. package/dist/illustrations/metadata.d.ts.map +1 -0
  66. package/dist/illustrations3d/Illustration3d.d.ts +11 -10
  67. package/dist/illustrations3d/Illustration3d.d.ts.map +1 -0
  68. package/dist/illustrations3d/Scene.d.ts +9 -8
  69. package/dist/illustrations3d/Scene.d.ts.map +1 -0
  70. package/dist/illustrations3d/index.d.ts +5 -4
  71. package/dist/illustrations3d/index.d.ts.map +1 -0
  72. package/dist/illustrations3d/models/CheckMark.d.ts +4 -3
  73. package/dist/illustrations3d/models/CheckMark.d.ts.map +1 -0
  74. package/dist/illustrations3d/models/Confetti.d.ts +4 -3
  75. package/dist/illustrations3d/models/Confetti.d.ts.map +1 -0
  76. package/dist/illustrations3d/models/Flower.d.ts +4 -3
  77. package/dist/illustrations3d/models/Flower.d.ts.map +1 -0
  78. package/dist/illustrations3d/models/Globe.d.ts +4 -3
  79. package/dist/illustrations3d/models/Globe.d.ts.map +1 -0
  80. package/dist/illustrations3d/models/Graph.d.ts +4 -3
  81. package/dist/illustrations3d/models/Graph.d.ts.map +1 -0
  82. package/dist/illustrations3d/models/Jars.d.ts +4 -3
  83. package/dist/illustrations3d/models/Jars.d.ts.map +1 -0
  84. package/dist/illustrations3d/models/Lock.d.ts +4 -3
  85. package/dist/illustrations3d/models/Lock.d.ts.map +1 -0
  86. package/dist/illustrations3d/models/MagnifyingGlass.d.ts +4 -3
  87. package/dist/illustrations3d/models/MagnifyingGlass.d.ts.map +1 -0
  88. package/dist/illustrations3d/models/Marble.d.ts +4 -3
  89. package/dist/illustrations3d/models/Marble.d.ts.map +1 -0
  90. package/dist/illustrations3d/models/MarbleCard.d.ts +4 -3
  91. package/dist/illustrations3d/models/MarbleCard.d.ts.map +1 -0
  92. package/dist/illustrations3d/models/MultiCurrency.d.ts +4 -3
  93. package/dist/illustrations3d/models/MultiCurrency.d.ts.map +1 -0
  94. package/dist/illustrations3d/models/Plane.d.ts +4 -3
  95. package/dist/illustrations3d/models/Plane.d.ts.map +1 -0
  96. package/dist/illustrations3d/utils.d.ts +9 -8
  97. package/dist/illustrations3d/utils.d.ts.map +1 -0
  98. package/dist/index-322e874c.js +332 -0
  99. package/dist/index-322e874c.js.map +1 -0
  100. package/dist/index-3bf9c1e9.js +325 -0
  101. package/dist/index-3bf9c1e9.js.map +1 -0
  102. package/dist/index.d.ts +10 -9
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +21 -1
  105. package/dist/index.js.map +1 -1
  106. package/dist/index.mjs +5 -0
  107. package/dist/index.mjs.map +1 -0
  108. package/package.json +40 -29
  109. package/src/common.ts +17 -0
  110. package/src/flags/Flag.stories.tsx +19 -0
  111. package/src/flags/Flag.tsx +40 -0
  112. package/src/flags/index.ts +2 -0
  113. package/src/illustrations/Illustration.css +27 -0
  114. package/src/illustrations/Illustration.stories.tsx +33 -0
  115. package/src/illustrations/Illustration.tsx +95 -0
  116. package/src/illustrations/index.ts +5 -0
  117. package/src/illustrations/metadata.ts +141 -0
  118. package/src/illustrations3d/Illustration3d.stories.tsx +89 -0
  119. package/src/illustrations3d/Illustration3d.tsx +133 -0
  120. package/src/illustrations3d/Scene.tsx +54 -0
  121. package/src/illustrations3d/index.ts +6 -0
  122. package/src/illustrations3d/models/CheckMark.tsx +30 -0
  123. package/src/illustrations3d/models/Confetti.tsx +29 -0
  124. package/src/illustrations3d/models/Flower.tsx +25 -0
  125. package/src/illustrations3d/models/Globe.tsx +42 -0
  126. package/src/illustrations3d/models/Graph.tsx +27 -0
  127. package/src/illustrations3d/models/Jars.tsx +47 -0
  128. package/src/illustrations3d/models/Lock.tsx +38 -0
  129. package/src/illustrations3d/models/MagnifyingGlass.tsx +31 -0
  130. package/src/illustrations3d/models/Marble.tsx +57 -0
  131. package/src/illustrations3d/models/MarbleCard.tsx +62 -0
  132. package/src/illustrations3d/models/MultiCurrency.tsx +58 -0
  133. package/src/illustrations3d/models/Plane.tsx +33 -0
  134. package/src/illustrations3d/utils.ts +68 -0
  135. package/src/index.ts +12 -0
  136. package/dist/CheckMark-a7c4192e.js +0 -2
  137. package/dist/CheckMark-a7c4192e.js.map +0 -1
  138. package/dist/CheckMark-c09041e4.js +0 -2
  139. package/dist/CheckMark-c09041e4.js.map +0 -1
  140. package/dist/Confetti-535240b0.js +0 -2
  141. package/dist/Confetti-535240b0.js.map +0 -1
  142. package/dist/Confetti-a3ce33fb.js +0 -2
  143. package/dist/Confetti-a3ce33fb.js.map +0 -1
  144. package/dist/Flower-de7f810e.js +0 -2
  145. package/dist/Flower-de7f810e.js.map +0 -1
  146. package/dist/Flower-f066e1ae.js +0 -2
  147. package/dist/Flower-f066e1ae.js.map +0 -1
  148. package/dist/Globe-5c7583f2.js +0 -2
  149. package/dist/Globe-5c7583f2.js.map +0 -1
  150. package/dist/Globe-d727ac2f.js +0 -2
  151. package/dist/Globe-d727ac2f.js.map +0 -1
  152. package/dist/Graph-0e6b9c58.js +0 -2
  153. package/dist/Graph-0e6b9c58.js.map +0 -1
  154. package/dist/Graph-3280d218.js +0 -2
  155. package/dist/Graph-3280d218.js.map +0 -1
  156. package/dist/Jars-32112246.js +0 -2
  157. package/dist/Jars-32112246.js.map +0 -1
  158. package/dist/Jars-fd0866ef.js +0 -2
  159. package/dist/Jars-fd0866ef.js.map +0 -1
  160. package/dist/Lock-21c35a1e.js +0 -2
  161. package/dist/Lock-21c35a1e.js.map +0 -1
  162. package/dist/Lock-d249e9ee.js +0 -2
  163. package/dist/Lock-d249e9ee.js.map +0 -1
  164. package/dist/MagnifyingGlass-d0d5d3f6.js +0 -2
  165. package/dist/MagnifyingGlass-d0d5d3f6.js.map +0 -1
  166. package/dist/MagnifyingGlass-dd6ac241.js +0 -2
  167. package/dist/MagnifyingGlass-dd6ac241.js.map +0 -1
  168. package/dist/Marble-1a42836c.js +0 -2
  169. package/dist/Marble-1a42836c.js.map +0 -1
  170. package/dist/Marble-d00298d5.js +0 -2
  171. package/dist/Marble-d00298d5.js.map +0 -1
  172. package/dist/MarbleCard-af7cf06b.js +0 -2
  173. package/dist/MarbleCard-af7cf06b.js.map +0 -1
  174. package/dist/MarbleCard-edfe8044.js +0 -2
  175. package/dist/MarbleCard-edfe8044.js.map +0 -1
  176. package/dist/MultiCurrency-76c41e39.js +0 -2
  177. package/dist/MultiCurrency-76c41e39.js.map +0 -1
  178. package/dist/MultiCurrency-f13609fe.js +0 -2
  179. package/dist/MultiCurrency-f13609fe.js.map +0 -1
  180. package/dist/Plane-3e2e27a1.js +0 -2
  181. package/dist/Plane-3e2e27a1.js.map +0 -1
  182. package/dist/Plane-436856f6.js +0 -2
  183. package/dist/Plane-436856f6.js.map +0 -1
  184. package/dist/Scene-ddc93fb1.js +0 -2
  185. package/dist/Scene-ddc93fb1.js.map +0 -1
  186. package/dist/Scene-f6751467.js +0 -2
  187. package/dist/Scene-f6751467.js.map +0 -1
  188. package/dist/flags/Flag.stories.d.ts +0 -6
  189. package/dist/illustrations/Illustration.stories.d.ts +0 -19
  190. package/dist/illustrations3d/Illustration3d.stories.d.ts +0 -18
  191. package/dist/index-b62ef291.js +0 -2
  192. package/dist/index-b62ef291.js.map +0 -1
  193. package/dist/index-e4ef8220.js +0 -2
  194. package/dist/index-e4ef8220.js.map +0 -1
  195. package/dist/index.module.js +0 -2
  196. package/dist/index.module.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- export { Flag } from './flags';
2
- export { default as Illustration } from './illustrations';
3
- export { default as Illustration3d } from './illustrations3d';
4
- export { Assets } from './illustrations';
5
- export { Sizes } from './common';
6
- export type { FlagProps } from './flags';
7
- export type { IllustrationNames, IllustrationProps } from './illustrations';
8
- export type { Illustration3dNames, Illustration3dProps } from './illustrations3d';
9
- export { is3dIllustrationSupported } from './illustrations3d';
1
+ export { Flag } from './flags';
2
+ export { default as Illustration } from './illustrations';
3
+ export { default as Illustration3d } from './illustrations3d';
4
+ export { Assets } from './illustrations';
5
+ export { Sizes } from './common';
6
+ export type { FlagProps } from './flags';
7
+ export type { IllustrationNames, IllustrationProps } from './illustrations';
8
+ export type { Illustration3dNames, Illustration3dProps } from './illustrations3d';
9
+ export { is3dIllustrationSupported } from './illustrations3d';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,22 @@
1
- var e=require("./index-b62ef291.js");require("react"),require("classnames"),Object.defineProperty(exports,"Assets",{enumerable:!0,get:function(){return e.Assets}}),exports.Flag=e.Flag,exports.Illustration=e.Illustration,exports.Illustration3d=e.Illustration3d,Object.defineProperty(exports,"Sizes",{enumerable:!0,get:function(){return e.Sizes}}),exports.is3dIllustrationSupported=e.is3dIllustrationSupported;
1
+ 'use strict';
2
+
3
+ var index = require('./index-322e874c.js');
4
+ require('react');
5
+ require('react/jsx-runtime');
6
+ require('clsx');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, 'Assets', {
11
+ enumerable: true,
12
+ get: function () { return index.Assets; }
13
+ });
14
+ exports.Flag = index.Flag;
15
+ exports.Illustration = index.Illustration;
16
+ exports.Illustration3d = index.Illustration3d;
17
+ Object.defineProperty(exports, 'Sizes', {
18
+ enumerable: true,
19
+ get: function () { return index.Sizes; }
20
+ });
21
+ exports.is3dIllustrationSupported = index.is3dIllustrationSupported;
2
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ export { A as Assets, F as Flag, a as Illustration, b as Illustration3d, S as Sizes, i as is3dIllustrationSupported } from './index-3bf9c1e9.js';
2
+ import 'react';
3
+ import 'react/jsx-runtime';
4
+ import 'clsx';
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/art",
3
- "version": "2.5.0-beta.8",
3
+ "version": "2.6.0-beta.1",
4
4
  "license": "MIT",
5
5
  "description": "React library for art elements in UI",
6
6
  "homepage": "https://github.com/transferwise/web-art#readme",
@@ -13,7 +13,9 @@
13
13
  "module": "./dist/index.module.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "files": [
16
- "dist"
16
+ "dist/",
17
+ "src/",
18
+ "!**/*.tsbuildinfo"
17
19
  ],
18
20
  "scripts": {
19
21
  "setup": "yarn && yarn build",
@@ -26,66 +28,75 @@
26
28
  "convert-flags-svg-to-png": "node ./scripts/convert-flags-svg-to-png.mjs",
27
29
  "convert-i10s-png-to-webp": "rm -rf s3-bucket/illustrations/ && copyfiles --f node_modules/wise-atoms/illustrations/**/*.png s3-bucket/illustrations && node ./scripts/convert-png-to-webp.mjs",
28
30
  "generate-i10s-metadata": "node ./scripts/generate-i10s-metadata.mjs && eslint 'src/illustrations/metadata.ts' --fix",
29
- "bundle": "rm -rf dist && microbundle --jsxFragment React.Fragment --jsx React.createElement --format es,cjs && cpx src/illustrations/Illustration.css dist/",
31
+ "bundle": "rm -rf dist && rollup --config --sourcemap && cpx src/illustrations/Illustration.css dist/",
30
32
  "cleanup": "rm -rf temp",
31
33
  "build": "yarn load-i10s && yarn load-3d-i10s && yarn convert-i10s-png-to-webp && yarn generate-i10s-metadata && yarn load-flags && yarn bundle && yarn cleanup",
32
- "start": "start-storybook -p 3001",
34
+ "start": "storybook dev -p 3001",
33
35
  "dev": "yarn start",
34
36
  "test": "echo 'release-to-github-with-changelog-pre-release-checks'",
35
37
  "lint-fix": "eslint 'src/**/*.{js,ts,tsx}' 'scripts/*.{mjs,js,ts,tsx}' --fix",
36
- "build-docs": "build-storybook -o docs",
37
- "deploy-docs": "deploy-to-github-pages -d docs -m main"
38
+ "build-docs": "storybook build -o docs && touch ./docs/.nojekyll"
38
39
  },
39
40
  "dependencies": {
41
+ "@babel/runtime": "^7.22.15",
42
+ "clsx": "^2.0.0",
40
43
  "three": "^0.154.0",
41
44
  "@react-three/fiber": "^8.13.5",
42
45
  "@react-three/drei": "^9.78.2"
43
46
  },
44
47
  "devDependencies": {
45
- "@babel/preset-env": "^7.18.9",
46
- "@babel/preset-react": "^7.18.6",
47
- "@babel/preset-typescript": "^7.18.6",
48
- "@storybook/addon-essentials": "^6.5.13",
49
- "@storybook/react": "^6.5.13",
48
+ "@babel/core": "^7.22.15",
49
+ "@babel/plugin-transform-runtime": "^7.22.15",
50
+ "@babel/preset-env": "^7.22.15",
51
+ "@babel/preset-react": "^7.22.15",
52
+ "@babel/preset-typescript": "^7.22.15",
53
+ "@rollup/plugin-babel": "^6.0.3",
54
+ "@rollup/plugin-typescript": "^11.1.3",
55
+ "@storybook/addon-essentials": "^7.4.0",
56
+ "@storybook/react": "^7.4.0",
57
+ "@storybook/react-vite": "^7.4.0",
50
58
  "@transferwise/eslint-config": "^8.0.0",
51
- "@tsconfig/node16": "^1.0.3",
52
- "@types/glob": "^8.0.0",
53
- "@types/imagemin": "^8.0.0",
59
+ "@tsconfig/recommended": "^1.0.2",
60
+ "@types/babel__core": "^7.20.1",
61
+ "@types/glob": "^8.1.0",
62
+ "@types/imagemin": "^8.0.1",
54
63
  "@types/imagemin-webp": "^7.0.0",
55
- "@types/jest": "^28.1.6",
56
- "@types/jsdom": "^21.1.0",
57
- "@types/react": "^18.0.15",
58
- "@types/react-dom": "^18.0.6",
64
+ "@types/jest": "^28.1.8",
65
+ "@types/jsdom": "^21.1.2",
66
+ "@types/react": "^18.2.21",
67
+ "@types/react-dom": "^18.2.7",
59
68
  "@types/three": "^0.154.0",
60
- "classnames": "^2.3.1",
69
+ "babel-plugin-optimize-clsx": "^2.6.2",
61
70
  "copyfiles": "^2.4.1",
62
71
  "cpx": "^1.5.0",
63
- "deploy-to-github-pages": "^1.0.1",
64
- "eslint": "^8.21.0",
65
- "glob": "^8.0.3",
72
+ "eslint": "^8.48.0",
73
+ "glob": "^8.1.0",
66
74
  "imagemin": "^8.0.1",
67
75
  "imagemin-webp": "^7.0.0",
68
76
  "gltf-pipeline": "^4.1.0",
69
77
  "jest": "^28.1.3",
70
78
  "jest-environment-jsdom": "^28.1.3",
71
- "jsdom": "~21.1.1",
72
- "microbundle": "^0.15.1",
73
- "prettier": "^2.7.1",
79
+ "jsdom": "~21.1.2",
80
+ "prettier": "^2.8.8",
74
81
  "react": "^18.2.0",
75
82
  "react-dom": "^18.2.0",
76
83
  "release-to-github-with-changelog": "^1.2.4",
77
- "sharp": "^0.32.1",
84
+ "sharp": "^0.32.5",
85
+ "storybook": "^7.4.0",
78
86
  "ts-node": "10.9.1",
79
- "typescript": "^4.7.4",
87
+ "typescript": "^4.9.5",
88
+ "vite": "^4.4.9",
80
89
  "wise-atoms": "git+ssh://git@github.com:transferwise/wise-atoms.git#c2683d557cf6f7b4f6226ea8f0e67bc797e7fb2e"
81
90
  },
82
91
  "peerDependencies": {
83
- "classnames": "^2.3",
84
92
  "react": ">=17",
85
93
  "react-dom": ">=17"
86
94
  },
87
95
  "prettier": "@transferwise/eslint-config/.prettierrc.js",
88
96
  "publishConfig": {
89
97
  "access": "public"
98
+ },
99
+ "resolutions": {
100
+ "jackspeak": "2.1.1"
90
101
  }
91
- }
102
+ }
package/src/common.ts ADDED
@@ -0,0 +1,17 @@
1
+ export enum Sizes {
2
+ SMALL = 'small',
3
+ MEDIUM = 'medium',
4
+ LARGE = 'large',
5
+ }
6
+
7
+ export const ImageSizes = {
8
+ [Sizes.SMALL]: 200,
9
+ [Sizes.MEDIUM]: 300,
10
+ [Sizes.LARGE]: 500,
11
+ };
12
+
13
+ export type LargeSize = 'large';
14
+ export type MediumSize = 'medium';
15
+ export type SmallSize = 'small';
16
+
17
+ export type Descriptors = '1x' | '1.5x' | '2x' | '3x' | '4x';
@@ -0,0 +1,19 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Flag } from './Flag';
4
+
5
+ const meta: Meta<typeof Flag> = {
6
+ component: Flag,
7
+ title: 'Flag',
8
+ };
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof Flag>;
12
+
13
+ export const Basic: Story = {
14
+ render: (args) => <Flag {...args} />,
15
+ args: {
16
+ code: 'GBP',
17
+ intrinsicSize: 64,
18
+ },
19
+ };
@@ -0,0 +1,40 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export interface FlagProps {
4
+ /**
5
+ * Two-letter country code (ISO 3166-1 alpha-2) or three-letter currency code (ISO 4217).
6
+ */
7
+ code: string;
8
+
9
+ /**
10
+ * Width and height to reserve for the underlying image, in pixels. A detailed variant is shown from 150px and above.
11
+ */
12
+ intrinsicSize?: number;
13
+ }
14
+
15
+ const unknownFlagName = 'wise';
16
+
17
+ export const Flag = ({ code, intrinsicSize = 64 }: FlagProps) => {
18
+ const [fallback, setFallback] = useState<'simple' | 'unknown' | null>(null);
19
+ useEffect(() => {
20
+ setFallback(null);
21
+ }, [code]);
22
+
23
+ const detailed = intrinsicSize >= 150;
24
+ const name =
25
+ fallback !== 'unknown'
26
+ ? `${code.toLowerCase()}${fallback == null && detailed ? '-detailed' : ''}`
27
+ : unknownFlagName;
28
+
29
+ return (
30
+ <img
31
+ src={`https://wise.com/web-art/assets/flags/${name}.svg`}
32
+ alt=""
33
+ width={intrinsicSize}
34
+ height={intrinsicSize}
35
+ onError={() => {
36
+ setFallback((prev) => (prev == null && detailed ? 'simple' : 'unknown'));
37
+ }}
38
+ />
39
+ );
40
+ };
@@ -0,0 +1,2 @@
1
+ export { Flag } from './Flag';
2
+ export type { FlagProps } from './Flag';
@@ -0,0 +1,27 @@
1
+ /* Prevent image overflow viewport or container element */
2
+ img.wds-illustration {
3
+ max-width: 100%;
4
+ }
5
+
6
+ .wds-illustration-padding {
7
+ padding: 24px;
8
+ }
9
+
10
+ .wds-illustration-3d {
11
+ display: inline-flex;
12
+ }
13
+
14
+ .wds-illustration-3d-small {
15
+ width: 200px;
16
+ height: 200px;
17
+ }
18
+
19
+ .wds-illustration-3d-medium {
20
+ width: 300px;
21
+ height: 300px;
22
+ }
23
+
24
+ .wds-illustration-3d-large {
25
+ width: 500px;
26
+ height: 500px;
27
+ }
@@ -0,0 +1,33 @@
1
+ /* eslint-disable react/forbid-dom-props */
2
+ import React from 'react';
3
+
4
+ import Illustration, { Props as IllustrationProps } from './Illustration';
5
+ import { Assets, IllustrationNames } from './metadata';
6
+
7
+ export default {
8
+ component: Illustration,
9
+ title: 'Illustration',
10
+ };
11
+
12
+ export const All = () => {
13
+ const assetNames = Object.values(Assets);
14
+ return (
15
+ <>
16
+ <div>Total number of illustrations: {assetNames.length}</div>
17
+ {Object.values(Assets).map((assetName) => (
18
+ <p key={assetName}>
19
+ Asset: <code>{assetName}</code>
20
+ <Illustration alt={assetName} key={assetName} name={assetName as IllustrationNames} />
21
+ </p>
22
+ ))}
23
+ </>
24
+ );
25
+ };
26
+
27
+ export const Individual = ({ name = Assets.CHECK_MARK, ...props }: IllustrationProps) => {
28
+ return (
29
+ <>
30
+ <Illustration name={name} {...props} />
31
+ </>
32
+ );
33
+ };
@@ -0,0 +1,95 @@
1
+ import { clsx } from 'clsx';
2
+ import { forwardRef } from 'react';
3
+
4
+ import {
5
+ type LargeSize,
6
+ type MediumSize,
7
+ type SmallSize,
8
+ type Descriptors,
9
+ Sizes,
10
+ } from './../common';
11
+ import type { IllustrationNames } from './metadata';
12
+
13
+ // Picking only a few props from Image element to avoid breaking change
14
+ // as in future underlying element might change
15
+ type ImgProps = Pick<React.ImgHTMLAttributes<HTMLImageElement>, 'id' | 'className'>;
16
+
17
+ export type IllustrationSizes = LargeSize | MediumSize | SmallSize;
18
+
19
+ export type Props = {
20
+ name: IllustrationNames;
21
+ alt: string;
22
+ size?: IllustrationSizes;
23
+ loading?: 'eager' | 'lazy';
24
+ disablePadding?: boolean;
25
+ } & ImgProps;
26
+
27
+ const imageSizes = {
28
+ [Sizes.SMALL]: 200,
29
+ [Sizes.MEDIUM]: 300,
30
+ [Sizes.LARGE]: 500,
31
+ };
32
+
33
+ const Illustration = forwardRef<HTMLImageElement, Props>(
34
+ (
35
+ {
36
+ id,
37
+ name,
38
+ alt,
39
+ loading = 'eager',
40
+ className,
41
+ size = Sizes.MEDIUM,
42
+ disablePadding = false,
43
+ }: Props,
44
+ ref,
45
+ ) => {
46
+ const { SMALL, MEDIUM } = Sizes;
47
+
48
+ return name ? (
49
+ <picture>
50
+ {size === Sizes.LARGE || size === Sizes.MEDIUM ? (
51
+ <>
52
+ <source
53
+ width={imageSizes[SMALL]}
54
+ height={imageSizes[SMALL]}
55
+ media="(max-width: 575px)"
56
+ srcSet={`${defineSrc(name, SMALL, '1x')}, ${defineSrc(name, SMALL, '2x')} 2x`}
57
+ />
58
+ {size !== Sizes.MEDIUM ? (
59
+ <source
60
+ width={imageSizes[MEDIUM]}
61
+ height={imageSizes[MEDIUM]}
62
+ media="(max-width: 992px)"
63
+ srcSet={`${defineSrc(name, MEDIUM, '1x')}, ${defineSrc(name, MEDIUM, '2x')} 2x`}
64
+ />
65
+ ) : null}
66
+ </>
67
+ ) : null}
68
+
69
+ <img
70
+ id={id}
71
+ ref={ref}
72
+ alt={alt ?? name.replace('-', ' ')}
73
+ data-testid={`wds-${name}-illustration`}
74
+ className={clsx(
75
+ 'wds-illustration',
76
+ `wds-illustration-${name}`,
77
+ { 'wds-illustration-padding': !disablePadding },
78
+ className,
79
+ )}
80
+ loading={loading}
81
+ src={defineSrc(name, size, '1x')}
82
+ srcSet={`${defineSrc(name, size, '2x')} 2x`}
83
+ width={imageSizes[size]}
84
+ height={imageSizes[size]}
85
+ />
86
+ </picture>
87
+ ) : null;
88
+ },
89
+ );
90
+
91
+ function defineSrc(illustration: string, size: IllustrationSizes, descriptor: Descriptors) {
92
+ return `https://wise.com/web-art/assets/illustrations/${illustration}-${size}@${descriptor}.webp`;
93
+ }
94
+
95
+ export default Illustration;
@@ -0,0 +1,5 @@
1
+ export { default } from './Illustration';
2
+ export type { Props as IllustrationProps } from './Illustration';
3
+
4
+ export { Assets } from './metadata';
5
+ export type { IllustrationNames } from './metadata';
@@ -0,0 +1,141 @@
1
+ /*
2
+ *
3
+ * DON'T MODIFY THIS FILE IT'S AUTO GENERATED
4
+ * See: `scripts/generate-i10s-metadata.mjs`
5
+ *
6
+ */
7
+
8
+ export enum Assets {
9
+ BELL = 'bell',
10
+ BRIEFCASE = 'briefcase',
11
+ BUSINESS_CARD = 'business-card',
12
+ CALENDAR = 'calendar',
13
+ CHECK_MARK = 'check-mark',
14
+ CLOSED_WINDOW = 'closed-window',
15
+ COIN_PILE_DOWN = 'coin-pile-down',
16
+ COIN_PILE_UP = 'coin-pile-up',
17
+ CONFETTI = 'confetti',
18
+ CONSTRUCTION_FENCE = 'construction-fence',
19
+ CONVERT = 'convert',
20
+ COOKIE = 'cookie',
21
+ DIGITAL_CARD_2 = 'digital-card-2',
22
+ DIGITAL_CARD = 'digital-card',
23
+ DOCUMENTS = 'documents',
24
+ DOOR = 'door',
25
+ ECO_CARD = 'eco-card',
26
+ ELECTRIC_PLUG = 'electric-plug',
27
+ EMAIL_SUCCESS = 'email-success',
28
+ EMAIL = 'email',
29
+ EXCLAMATION_MARK = 'exclamation-mark',
30
+ FLAG = 'flag',
31
+ FLOWER = 'flower',
32
+ GEAR = 'gear',
33
+ GLOBE = 'globe',
34
+ GRAPH = 'graph',
35
+ HEART_2 = 'heart-2',
36
+ HEART_3 = 'heart-3',
37
+ HEART_4 = 'heart-4',
38
+ HEART_5 = 'heart-5',
39
+ HEART = 'heart',
40
+ HOUSE = 'house',
41
+ ID_CARD = 'id-card',
42
+ INFINITE = 'infinite',
43
+ INVITE_LETTER = 'invite-letter',
44
+ JARS = 'jars',
45
+ KEY = 'key',
46
+ LIGHT_BULB = 'light-bulb',
47
+ LOCK = 'lock',
48
+ MAGNIFYING_GLASS = 'magnifying-glass',
49
+ MAP = 'map',
50
+ MARBLE_CARD_BUSINESS = 'marble-card-business',
51
+ MARBLE_CARD = 'marble-card',
52
+ MARBLE = 'marble',
53
+ MEGAPHONE = 'megaphone',
54
+ MULTI_CURRENCY = 'multi-currency',
55
+ ONE_INVITE_LETTER_OPENED = 'one-invite-letter-opened',
56
+ PALM_TREE = 'palm-tree',
57
+ PERCENTAGE = 'percentage',
58
+ PERSONAL_CARD = 'personal-card',
59
+ PHONES = 'phones',
60
+ PIE_CHART = 'pie-chart',
61
+ PLANE_2 = 'plane-2',
62
+ PLANE = 'plane',
63
+ PUZZLE_PIECES = 'puzzle-pieces',
64
+ QUESTION_MARK = 'question-mark',
65
+ RECEIVE = 'receive',
66
+ REMINDER_LETTER = 'reminder-letter',
67
+ SAND_TIMER = 'sand-timer',
68
+ SHOPPING_BAG = 'shopping-bag',
69
+ SKIP_AUTHENTICATION = 'skip-authentication',
70
+ SPEECH_BUBBLE = 'speech-bubble',
71
+ TOOL = 'tool',
72
+ TWO_INVITE_LETTERS_OPENED = 'two-invite-letters-opened',
73
+ WALLET = 'wallet',
74
+ }
75
+
76
+ export type IllustrationNames =
77
+ | 'bell'
78
+ | 'briefcase'
79
+ | 'business-card'
80
+ | 'calendar'
81
+ | 'check-mark'
82
+ | 'closed-window'
83
+ | 'coin-pile-down'
84
+ | 'coin-pile-up'
85
+ | 'confetti'
86
+ | 'construction-fence'
87
+ | 'convert'
88
+ | 'cookie'
89
+ | 'digital-card-2'
90
+ | 'digital-card'
91
+ | 'documents'
92
+ | 'door'
93
+ | 'eco-card'
94
+ | 'electric-plug'
95
+ | 'email-success'
96
+ | 'email'
97
+ | 'exclamation-mark'
98
+ | 'flag'
99
+ | 'flower'
100
+ | 'gear'
101
+ | 'globe'
102
+ | 'graph'
103
+ | 'heart-2'
104
+ | 'heart-3'
105
+ | 'heart-4'
106
+ | 'heart-5'
107
+ | 'heart'
108
+ | 'house'
109
+ | 'id-card'
110
+ | 'infinite'
111
+ | 'invite-letter'
112
+ | 'jars'
113
+ | 'key'
114
+ | 'light-bulb'
115
+ | 'lock'
116
+ | 'magnifying-glass'
117
+ | 'map'
118
+ | 'marble-card-business'
119
+ | 'marble-card'
120
+ | 'marble'
121
+ | 'megaphone'
122
+ | 'multi-currency'
123
+ | 'one-invite-letter-opened'
124
+ | 'palm-tree'
125
+ | 'percentage'
126
+ | 'personal-card'
127
+ | 'phones'
128
+ | 'pie-chart'
129
+ | 'plane-2'
130
+ | 'plane'
131
+ | 'puzzle-pieces'
132
+ | 'question-mark'
133
+ | 'receive'
134
+ | 'reminder-letter'
135
+ | 'sand-timer'
136
+ | 'shopping-bag'
137
+ | 'skip-authentication'
138
+ | 'speech-bubble'
139
+ | 'tool'
140
+ | 'two-invite-letters-opened'
141
+ | 'wallet';
@@ -0,0 +1,89 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
2
+ import React, { useEffect } from 'react';
3
+
4
+ import { Sizes } from '../common';
5
+ import { Assets } from '../illustrations/metadata';
6
+
7
+ import Illustration3d from './Illustration3d';
8
+
9
+ export default {
10
+ title: '3D Illustrations',
11
+ };
12
+
13
+ export const Confetti = () => {
14
+ return (
15
+ <>
16
+ <Illustration3d name={Assets.CONFETTI} size={Sizes.LARGE} />
17
+ </>
18
+ );
19
+ };
20
+
21
+ export const Globe = () => {
22
+ return (
23
+ <>
24
+ <Illustration3d name={Assets.GLOBE} size={Sizes.LARGE} />
25
+ </>
26
+ );
27
+ };
28
+
29
+ export const Lock = () => {
30
+ return <Illustration3d name={Assets.LOCK} size={Sizes.LARGE} />;
31
+ };
32
+
33
+ export const CheckMark = () => {
34
+ return <Illustration3d name={Assets.CHECK_MARK} size={Sizes.LARGE} />;
35
+ };
36
+
37
+ export const Flower = () => {
38
+ return <Illustration3d name={Assets.FLOWER} size={Sizes.LARGE} />;
39
+ };
40
+
41
+ export const Plane = () => {
42
+ return <Illustration3d name={Assets.PLANE} size={Sizes.LARGE} />;
43
+ };
44
+
45
+ export const Graph = () => {
46
+ return <Illustration3d name={Assets.GRAPH} size={Sizes.LARGE} />;
47
+ };
48
+
49
+ export const Marble = () => {
50
+ return <Illustration3d name={Assets.MARBLE} size={Sizes.LARGE} />;
51
+ };
52
+
53
+ export const MarbleCard = () => {
54
+ return <Illustration3d name={Assets.MARBLE_CARD} size={Sizes.LARGE} />;
55
+ };
56
+
57
+ export const MagnifyingGlass = () => {
58
+ return <Illustration3d name={Assets.MAGNIFYING_GLASS} size={Sizes.LARGE} />;
59
+ };
60
+
61
+ export const Jars = () => {
62
+ return <Illustration3d name={Assets.JARS} size={Sizes.LARGE} />;
63
+ };
64
+
65
+ export const MultiCurrency = () => {
66
+ return <Illustration3d name={Assets.MULTI_CURRENCY} size={Sizes.LARGE} />;
67
+ };
68
+
69
+ export const Fallback = () => {
70
+ // @ts-expect-error navigator has connection property
71
+ const originalNavigator = window.navigator.connection;
72
+ // mock slow internet connection
73
+ // @ts-expect-error navigator has connection property
74
+ window.navigator.connection = { effectiveType: 'slow-2g' };
75
+
76
+ useEffect(() => {
77
+ // cleanup mock on unmount
78
+ // @ts-expect-error navigator has connection property
79
+ return () => (window.navigator.connection = originalNavigator);
80
+ }, [originalNavigator]);
81
+
82
+ return (
83
+ <>
84
+ <Illustration3d name={Assets.LOCK} />
85
+ <br />
86
+ Mock slow internet connection so it fallback to static illustration
87
+ </>
88
+ );
89
+ };