@wise/art 2.10.0-beta.3 → 2.10.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.
Files changed (107) hide show
  1. package/README.md +9 -39
  2. package/dist/{CheckMark-6a3a1306.esm.js → CheckMark-75975410.esm.js} +2 -3
  3. package/dist/CheckMark-75975410.esm.js.map +1 -0
  4. package/dist/{CheckMark-275a5118.js → CheckMark-91b74943.js} +2 -3
  5. package/dist/CheckMark-91b74943.js.map +1 -0
  6. package/dist/{Confetti-a33c5884.js → Confetti-4e9cc611.js} +2 -3
  7. package/dist/Confetti-4e9cc611.js.map +1 -0
  8. package/dist/{Confetti-345455b0.esm.js → Confetti-eb9add24.esm.js} +2 -3
  9. package/dist/Confetti-eb9add24.esm.js.map +1 -0
  10. package/dist/{Flower-861861e4.esm.js → Flower-66206fda.esm.js} +2 -3
  11. package/dist/Flower-66206fda.esm.js.map +1 -0
  12. package/dist/{Flower-aa1da081.js → Flower-c9d23967.js} +2 -3
  13. package/dist/Flower-c9d23967.js.map +1 -0
  14. package/dist/{Globe-71aaced4.js → Globe-8e3a5a93.js} +2 -3
  15. package/dist/Globe-8e3a5a93.js.map +1 -0
  16. package/dist/{Globe-c5fb26d3.esm.js → Globe-a27525fe.esm.js} +2 -3
  17. package/dist/Globe-a27525fe.esm.js.map +1 -0
  18. package/dist/{Graph-4bcdb92e.esm.js → Graph-72ebad19.esm.js} +2 -3
  19. package/dist/Graph-72ebad19.esm.js.map +1 -0
  20. package/dist/{Graph-f0f91ba3.js → Graph-9a766bb4.js} +2 -3
  21. package/dist/Graph-9a766bb4.js.map +1 -0
  22. package/dist/Illustration.css +1 -1
  23. package/dist/{Jars-35b153d0.esm.js → Jars-315f0e1e.esm.js} +2 -3
  24. package/dist/Jars-315f0e1e.esm.js.map +1 -0
  25. package/dist/{Jars-4cf264dc.js → Jars-bfd6186b.js} +2 -3
  26. package/dist/Jars-bfd6186b.js.map +1 -0
  27. package/dist/{Lock-a508a7d9.esm.js → Lock-64866d42.esm.js} +2 -3
  28. package/dist/Lock-64866d42.esm.js.map +1 -0
  29. package/dist/{Lock-070af72c.js → Lock-9f35874f.js} +2 -3
  30. package/dist/Lock-9f35874f.js.map +1 -0
  31. package/dist/{MagnifyingGlass-44a60017.esm.js → MagnifyingGlass-7bcc177b.esm.js} +2 -3
  32. package/dist/MagnifyingGlass-7bcc177b.esm.js.map +1 -0
  33. package/dist/{MagnifyingGlass-6d6a5c78.js → MagnifyingGlass-850402f3.js} +2 -3
  34. package/dist/MagnifyingGlass-850402f3.js.map +1 -0
  35. package/dist/{Marble-d84b0fb4.esm.js → Marble-8e71ce64.esm.js} +2 -3
  36. package/dist/Marble-8e71ce64.esm.js.map +1 -0
  37. package/dist/{Marble-28f06aa6.js → Marble-d1c83ca5.js} +2 -3
  38. package/dist/Marble-d1c83ca5.js.map +1 -0
  39. package/dist/{MarbleCard-cc6cb580.esm.js → MarbleCard-a3bee913.esm.js} +2 -3
  40. package/dist/MarbleCard-a3bee913.esm.js.map +1 -0
  41. package/dist/{MarbleCard-c2ce30a3.js → MarbleCard-c7445571.js} +2 -3
  42. package/dist/MarbleCard-c7445571.js.map +1 -0
  43. package/dist/{MultiCurrency-526a1740.js → MultiCurrency-32138601.js} +2 -3
  44. package/dist/MultiCurrency-32138601.js.map +1 -0
  45. package/dist/{MultiCurrency-bbb1399d.esm.js → MultiCurrency-93fd79bd.esm.js} +2 -3
  46. package/dist/MultiCurrency-93fd79bd.esm.js.map +1 -0
  47. package/dist/{Plane-52bdbc05.esm.js → Plane-300c9b8d.esm.js} +2 -3
  48. package/dist/Plane-300c9b8d.esm.js.map +1 -0
  49. package/dist/{Plane-e7955448.js → Plane-531209fc.js} +2 -3
  50. package/dist/Plane-531209fc.js.map +1 -0
  51. package/dist/{Scene-057939b3.esm.js → Scene-74f99a47.esm.js} +2 -3
  52. package/dist/Scene-74f99a47.esm.js.map +1 -0
  53. package/dist/{Scene-3826fea0.js → Scene-fab9127c.js} +2 -3
  54. package/dist/Scene-fab9127c.js.map +1 -0
  55. package/dist/{index-b33abf80.js → index-a4dd3e1a.js} +14 -86
  56. package/dist/index-a4dd3e1a.js.map +1 -0
  57. package/dist/{index-1e4862aa.esm.js → index-d9418379.esm.js} +16 -83
  58. package/dist/index-d9418379.esm.js.map +1 -0
  59. package/dist/index.d.ts +0 -2
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.esm.js +1 -2
  62. package/dist/index.esm.js.map +1 -1
  63. package/dist/index.js +1 -3
  64. package/dist/index.js.map +1 -1
  65. package/package.json +16 -18
  66. package/src/index.css +0 -1
  67. package/src/index.ts +0 -2
  68. package/dist/CheckMark-275a5118.js.map +0 -1
  69. package/dist/CheckMark-6a3a1306.esm.js.map +0 -1
  70. package/dist/Confetti-345455b0.esm.js.map +0 -1
  71. package/dist/Confetti-a33c5884.js.map +0 -1
  72. package/dist/Flower-861861e4.esm.js.map +0 -1
  73. package/dist/Flower-aa1da081.js.map +0 -1
  74. package/dist/Globe-71aaced4.js.map +0 -1
  75. package/dist/Globe-c5fb26d3.esm.js.map +0 -1
  76. package/dist/Graph-4bcdb92e.esm.js.map +0 -1
  77. package/dist/Graph-f0f91ba3.js.map +0 -1
  78. package/dist/Jars-35b153d0.esm.js.map +0 -1
  79. package/dist/Jars-4cf264dc.js.map +0 -1
  80. package/dist/Lock-070af72c.js.map +0 -1
  81. package/dist/Lock-a508a7d9.esm.js.map +0 -1
  82. package/dist/MagnifyingGlass-44a60017.esm.js.map +0 -1
  83. package/dist/MagnifyingGlass-6d6a5c78.js.map +0 -1
  84. package/dist/Marble-28f06aa6.js.map +0 -1
  85. package/dist/Marble-d84b0fb4.esm.js.map +0 -1
  86. package/dist/MarbleCard-c2ce30a3.js.map +0 -1
  87. package/dist/MarbleCard-cc6cb580.esm.js.map +0 -1
  88. package/dist/MultiCurrency-526a1740.js.map +0 -1
  89. package/dist/MultiCurrency-bbb1399d.esm.js.map +0 -1
  90. package/dist/Plane-52bdbc05.esm.js.map +0 -1
  91. package/dist/Plane-e7955448.js.map +0 -1
  92. package/dist/Scene-057939b3.esm.js.map +0 -1
  93. package/dist/Scene-3826fea0.js.map +0 -1
  94. package/dist/icons/Icon.d.ts +0 -12
  95. package/dist/icons/Icon.d.ts.map +0 -1
  96. package/dist/icons/Icon.spec.d.ts +0 -2
  97. package/dist/icons/Icon.spec.d.ts.map +0 -1
  98. package/dist/icons/index.d.ts +0 -3
  99. package/dist/icons/index.d.ts.map +0 -1
  100. package/dist/index-1e4862aa.esm.js.map +0 -1
  101. package/dist/index-b33abf80.js.map +0 -1
  102. package/src/bankTransfer.svg +0 -3
  103. package/src/icons/Icon.css +0 -10
  104. package/src/icons/Icon.spec.tsx +0 -21
  105. package/src/icons/Icon.stories.tsx +0 -30
  106. package/src/icons/Icon.tsx +0 -98
  107. package/src/icons/index.ts +0 -2
@@ -1,21 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import '@testing-library/jest-dom';
3
-
4
- import { Icon } from './Icon';
5
-
6
- describe('Icon', () => {
7
- it.skip('should default (wise flag) icon incase unknown icon name provided', () => {
8
- render(<Icon name="foo" />);
9
-
10
- screen.debug();
11
-
12
- // expect(screen.getByRole('img')).toHaveAttribute('alt', '');
13
- });
14
-
15
- it.skip('should create alt with custom text', () => {
16
- const customAltText = 'Image of slick check mark';
17
- render(<Illustration alt={customAltText} name={Assets.CHECK_MARK} />);
18
-
19
- expect(screen.getByRole('img')).toHaveAttribute('alt', customAltText);
20
- });
21
- });
@@ -1,30 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import { AlertCircle } from '@transferwise/icons';
3
-
4
- import { Icon } from './Icon';
5
-
6
- export default {
7
- component: Icon,
8
- title: 'Icon (Beta)',
9
- };
10
-
11
- type Story = StoryObj<typeof Icon>;
12
-
13
- export const Basic: Story = {
14
- render: (args) => {
15
- return (
16
- // eslint-disable-next-line react/forbid-dom-props
17
- <div style={{ color: 'green' }}>
18
- <p>
19
- New icon: <Icon {...args} />
20
- <br />
21
- Old icon: <AlertCircle className={args.className} size={args.size} filled={args.filled} />
22
- </p>
23
- </div>
24
- );
25
- },
26
- args: {
27
- name: 'alert-circle',
28
- className: 'd-inline-block',
29
- },
30
- };
@@ -1,98 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { useEffect, useRef, AriaRole } from 'react';
3
- import sanitize from 'sanitize-html';
4
-
5
- export type Props = {
6
- name: string;
7
- size?: 16 | 24 | '16' | '24';
8
- className?: string;
9
- 'data-testid'?: string;
10
- title?: string;
11
- role?: AriaRole;
12
- filled?: boolean;
13
- };
14
-
15
- export const Icon = ({
16
- name,
17
- size = 16,
18
- className = undefined,
19
- filled = false,
20
- 'data-testid': testId,
21
- title = undefined,
22
- role = undefined,
23
- }: Props) => {
24
- const assetName: string = filled ? `${name}-fill` : name;
25
- const iconRef = useRef<HTMLSpanElement>(null);
26
-
27
- useEffect(() => {
28
- const loadIconAsset = async () => {
29
- if (iconRef.current) {
30
- try {
31
- iconRef.current.innerHTML = await downloadSanitizeIcon(name);
32
- } catch (error) {
33
- // eslint-disable-next-line no-console
34
- console.warn(error, 'use fallback (Fast Flag) icon');
35
- iconRef.current.innerHTML = await downloadSanitizeIcon('fast-flag');
36
- }
37
- }
38
- };
39
- void loadIconAsset();
40
- }, [name]);
41
-
42
- return (
43
- <span
44
- ref={iconRef}
45
- className={clsx('wds-icon', `wds-icon-${assetName}`, `wds-icon-size-${size}`, className)}
46
- aria-hidden={title ? undefined : true}
47
- role={role ?? (title ? undefined : 'none')}
48
- data-testid={testId}
49
- >
50
- {title && <span className="sr-only">{title}</span>}
51
- </span>
52
- );
53
- };
54
-
55
- const svgAttributes = [
56
- 'xmlns',
57
- 'width',
58
- 'height',
59
- 'fill',
60
- 'viewBox',
61
- 'd',
62
- 'fill-rule',
63
- 'cx',
64
- 'cy',
65
- 'r',
66
- 'x',
67
- 'y',
68
- ];
69
-
70
- const allowedTagsAttrs = {
71
- svg: svgAttributes,
72
- path: svgAttributes,
73
- circle: svgAttributes,
74
- rect: svgAttributes,
75
- };
76
-
77
- async function downloadSanitizeIcon(name: string): Promise<string> {
78
- const response = await fetch(srcUrl(name));
79
- if (!response.ok) {
80
- throw new Error(`Failed to download icon '${name}'`);
81
- }
82
- const iconHtml = await response.text();
83
- return sanitize(iconHtml, {
84
- // allow only SVG elements (https://developer.mozilla.org/en-US/docs/Web/SVG/Element)
85
- // and only SVG attributes (https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute)
86
- allowedTags: Object.keys(allowedTagsAttrs),
87
- allowedAttributes: allowedTagsAttrs,
88
- parser: {
89
- lowerCaseAttributeNames: false,
90
- },
91
- });
92
- }
93
-
94
- function srcUrl(assetName: string) {
95
- // return `/${assetName}.svg`;
96
- // return `http://localhost:3001/${assetName}.svg`;
97
- return `https://wise.com/web-art/assets/beta-icons/${assetName}.svg`;
98
- }
@@ -1,2 +0,0 @@
1
- export { Icon } from './Icon';
2
- export type { Props as IconProps } from './Icon';