@transferwise/components 45.4.0 → 45.5.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 (94) hide show
  1. package/build/es/no-polyfill/actionButton/ActionButton.js +1 -1
  2. package/build/es/no-polyfill/actionButton/ActionButton.spec.js +1 -1
  3. package/build/es/no-polyfill/actionButton/ActionButton.story.js +1 -1
  4. package/build/es/no-polyfill/circularButton/CircularButton.js +1 -1
  5. package/build/es/no-polyfill/common/DOMOperations/DOMOperations.js +6 -6
  6. package/build/es/no-polyfill/common/DOMOperations/index.js +1 -1
  7. package/build/es/no-polyfill/common/flowHeader/FlowHeader.js +1 -1
  8. package/build/es/no-polyfill/common/hooks/index.js +1 -1
  9. package/build/es/no-polyfill/common/hooks/useClientWidth/useClientWidth.js +1 -1
  10. package/build/es/no-polyfill/common/hooks/useLayout/useLayout.js +1 -1
  11. package/build/es/no-polyfill/common/index.js +1 -1
  12. package/build/es/no-polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
  13. package/build/es/no-polyfill/decision/Decision.js +2 -2
  14. package/build/es/no-polyfill/definitionList/DefinitionList.js +1 -1
  15. package/build/es/no-polyfill/dimmer/Dimmer.js +2 -2
  16. package/build/es/no-polyfill/flowNavigation/FlowNavigation.js +2 -2
  17. package/build/es/no-polyfill/flowNavigation/backButton/BackButton.js +1 -1
  18. package/build/es/no-polyfill/index.js +1 -1
  19. package/build/es/no-polyfill/overlayHeader/OverlayHeader.js +1 -1
  20. package/build/es/no-polyfill/phoneNumberInput/data/countries.js +1 -1
  21. package/build/es/no-polyfill/snackbar/Snackbar.js +1 -1
  22. package/build/es/no-polyfill/stepper/Stepper.js +1 -1
  23. package/build/es/no-polyfill/tile/Tile.js +1 -1
  24. package/build/es/polyfill/actionButton/ActionButton.js +1 -1
  25. package/build/es/polyfill/actionButton/ActionButton.spec.js +1 -1
  26. package/build/es/polyfill/actionButton/ActionButton.story.js +1 -1
  27. package/build/es/polyfill/circularButton/CircularButton.js +1 -1
  28. package/build/es/polyfill/common/DOMOperations/DOMOperations.js +6 -6
  29. package/build/es/polyfill/common/DOMOperations/index.js +1 -1
  30. package/build/es/polyfill/common/flowHeader/FlowHeader.js +1 -1
  31. package/build/es/polyfill/common/hooks/index.js +1 -1
  32. package/build/es/polyfill/common/hooks/useClientWidth/useClientWidth.js +1 -1
  33. package/build/es/polyfill/common/hooks/useLayout/useLayout.js +1 -1
  34. package/build/es/polyfill/common/index.js +1 -1
  35. package/build/es/polyfill/dateLookup/dateTrigger/DateTrigger.js +1 -1
  36. package/build/es/polyfill/decision/Decision.js +2 -2
  37. package/build/es/polyfill/definitionList/DefinitionList.js +1 -1
  38. package/build/es/polyfill/dimmer/Dimmer.js +2 -2
  39. package/build/es/polyfill/flowNavigation/FlowNavigation.js +2 -2
  40. package/build/es/polyfill/flowNavigation/backButton/BackButton.js +1 -1
  41. package/build/es/polyfill/index.js +1 -1
  42. package/build/es/polyfill/overlayHeader/OverlayHeader.js +1 -1
  43. package/build/es/polyfill/phoneNumberInput/data/countries.js +1 -1
  44. package/build/es/polyfill/snackbar/Snackbar.js +1 -1
  45. package/build/es/polyfill/stepper/Stepper.js +1 -1
  46. package/build/es/polyfill/tile/Tile.js +1 -1
  47. package/build/main.css +1 -1
  48. package/build/styles/actionButton/ActionButton.css +1 -1
  49. package/build/styles/main.css +1 -1
  50. package/build/styles/popover/Popover.css +1 -1
  51. package/build/styles/select/Select.css +1 -1
  52. package/build/styles/snackbar/Snackbar.css +1 -1
  53. package/build/styles/stepper/Stepper.css +1 -1
  54. package/build/types/actionButton/ActionButton.d.ts +3 -0
  55. package/build/types/actionButton/ActionButton.story.d.ts +1 -1
  56. package/build/types/button/Button.story.d.ts +105 -72
  57. package/build/types/circularButton/CircularButton.d.ts +1 -1
  58. package/build/types/common/DOMOperations/DOMOperations.d.ts +2 -2
  59. package/build/types/common/DOMOperations/index.d.ts +3 -3
  60. package/build/types/common/Option/Option.d.ts +1 -1
  61. package/build/types/common/flowHeader/FlowHeader.d.ts +10 -1
  62. package/build/types/common/hooks/index.d.ts +1 -1
  63. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +9 -8
  64. package/build/types/common/index.d.ts +1 -1
  65. package/build/types/decision/Decision.d.ts +1 -1
  66. package/build/types/definitionList/DefinitionList.d.ts +1 -1
  67. package/build/types/flowNavigation/FlowNavigation.d.ts +16 -34
  68. package/build/types/index.d.ts +2 -2
  69. package/build/types/inputs/Input.d.ts +1 -1
  70. package/build/types/inputs/TextArea.d.ts +1 -1
  71. package/build/types/listItem/ListItem.d.ts +1 -1
  72. package/build/types/listItem/ListItem.story.d.ts +1 -1
  73. package/build/types/snackbar/Snackbar.d.ts +1 -1
  74. package/build/types/stepper/Stepper.d.ts +13 -18
  75. package/build/umd/no-polyfill/main.js +1 -1
  76. package/build/umd/polyfill/main.js +1 -1
  77. package/package.json +7 -12
  78. package/scripts/generate-type-declarations.js +0 -2
  79. package/build/es/no-polyfill/common/flowHeader/index.js +0 -1
  80. package/build/es/no-polyfill/common/hooks/useClientWidth/index.js +0 -1
  81. package/build/es/no-polyfill/flowNavigation/index.js +0 -1
  82. package/build/es/no-polyfill/stepper/index.js +0 -1
  83. package/build/es/polyfill/common/flowHeader/index.js +0 -1
  84. package/build/es/polyfill/common/hooks/useClientWidth/index.js +0 -1
  85. package/build/es/polyfill/flowNavigation/index.js +0 -1
  86. package/build/es/polyfill/stepper/index.js +0 -1
  87. package/build/types/common/flowHeader/index.d.ts +0 -1
  88. package/build/types/common/hooks/useClientWidth/index.d.ts +0 -1
  89. package/build/types/flowNavigation/index.d.ts +0 -1
  90. package/build/types/stepper/index.d.ts +0 -2
  91. package/scripts/neptune-upgrader.js +0 -114
  92. package/upgrades/2021-02-v34-35.js +0 -193
  93. package/upgrades/2021-04-v35-36-typescript-support.js +0 -290
  94. package/upgrades/utils/index.js +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "45.4.0",
3
+ "version": "45.5.1",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/umd/polyfill/main.js",
@@ -12,17 +12,13 @@
12
12
  ],
13
13
  "files": [
14
14
  "build",
15
- "scripts",
16
- "upgrades"
15
+ "scripts"
17
16
  ],
18
17
  "repository": {
19
18
  "type": "git",
20
19
  "fullname": "transferwise/neptune",
21
20
  "url": "git+https://github.com/transferwise/neptune-web.git"
22
21
  },
23
- "bin": {
24
- "neptune-upgrade-util": "scripts/neptune-upgrader.js"
25
- },
26
22
  "devDependencies": {
27
23
  "@formatjs/cli": "^4.8.3",
28
24
  "@rollup/plugin-babel": "^5.2.2",
@@ -53,8 +49,9 @@
53
49
  "@transferwise/icons": "^3.2.3",
54
50
  "@transferwise/neptune-tokens": "^8.5.0",
55
51
  "@types/jest": "^26.0.20",
56
- "@types/jscodeshift": "^0.11.0",
57
52
  "@types/node": "^14.14.31",
53
+ "@types/react": "^17.0.59",
54
+ "@types/react-dom": "^17.0.20",
58
55
  "@types/react-transition-group": "4.4.5",
59
56
  "@types/testing-library__jest-dom": "^5.14.5",
60
57
  "@wise/art": "^2.0.1",
@@ -72,12 +69,12 @@
72
69
  "rollup-plugin-uglify": "^6.0.4",
73
70
  "storybook": "^7.0.6",
74
71
  "@transferwise/less-config": "3.0.6",
75
- "@transferwise/neptune-css": "14.3.49",
72
+ "@transferwise/neptune-css": "14.3.50",
76
73
  "@wise/components-theming": "0.7.5"
77
74
  },
78
75
  "peerDependencies": {
79
76
  "@transferwise/icons": "^3.2.3",
80
- "@transferwise/neptune-css": "^14.3.49",
77
+ "@transferwise/neptune-css": "^14.3.50",
81
78
  "@wise/art": "^2",
82
79
  "@wise/components-theming": "0.5 - 0.7",
83
80
  "currency-flags": "^4.0.2",
@@ -101,12 +98,10 @@
101
98
  "@react-spring/web": "~9.6.1",
102
99
  "@transferwise/formatting": "^2.1.0",
103
100
  "@transferwise/neptune-validation": "^3.0.12",
101
+ "@types/lodash.throttle": "^4.1.7",
104
102
  "classnames": "^2.2.6",
105
103
  "commonmark": "0.29.1",
106
104
  "core-js": "^3.8.0",
107
- "inquirer": "^8.1.1",
108
- "inquirer-file-tree-selection-prompt": "^1.0.7",
109
- "jscodeshift": "^0.11.0",
110
105
  "lodash.clamp": "^4.0.3",
111
106
  "lodash.debounce": "^4.0.8",
112
107
  "lodash.difference": "^4.5.0",
@@ -18,8 +18,6 @@ const jsFiles = [
18
18
  { filename: 'Radio', folder: 'radio' },
19
19
  { filename: 'Select', folder: 'select' },
20
20
  { filename: 'MoneyInput', folder: 'moneyInput' },
21
- { filename: 'Stepper', folder: 'stepper' },
22
- { filename: 'FlowNavigation', folder: 'flowNavigation' },
23
21
  { filename: 'Popover', folder: 'popover' },
24
22
  { filename: 'Money', folder: 'money' },
25
23
  { filename: 'RadioOption', folder: 'radioOption' },
@@ -1 +0,0 @@
1
- export{default}from"./FlowHeader";
@@ -1 +0,0 @@
1
- export{useClientWidth as default}from"./useClientWidth";
@@ -1 +0,0 @@
1
- export{default}from"./FlowNavigation";
@@ -1 +0,0 @@
1
- import Stepper from"./Stepper";export default Stepper;
@@ -1 +0,0 @@
1
- export{default}from"./FlowHeader";
@@ -1 +0,0 @@
1
- export{useClientWidth as default}from"./useClientWidth";
@@ -1 +0,0 @@
1
- export{default}from"./FlowNavigation";
@@ -1 +0,0 @@
1
- import Stepper from"./Stepper";export default Stepper;
@@ -1 +0,0 @@
1
- export { default } from "./FlowHeader";
@@ -1 +0,0 @@
1
- export { useClientWidth as default } from "./useClientWidth";
@@ -1 +0,0 @@
1
- export { default } from "./FlowNavigation";
@@ -1,2 +0,0 @@
1
- export default Stepper;
2
- import Stepper from "./Stepper";
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
-
4
- const { exec } = require('child_process');
5
- const path = require('path');
6
-
7
- const inquirer = require('inquirer');
8
- const inquirerFileTreeSelection = require('inquirer-file-tree-selection-prompt');
9
-
10
- inquirer.registerPrompt('file-tree-selection', inquirerFileTreeSelection);
11
-
12
- const IGNORE_PATTERN = '**/node_modules/*';
13
- const EXTENSIONS = {
14
- JS: 'js & jsx',
15
- TSX: 'tsx',
16
- BOTH: 'js,jsx & tsx',
17
- };
18
-
19
- const fetchSettings = () => {
20
- const questions = [
21
- {
22
- name: 'transform',
23
- type: 'file-tree-selection',
24
- root: path.join(__dirname, '../upgrades'),
25
- message: '✨ Which upgrade would you like to run?',
26
- },
27
- {
28
- type: 'list',
29
- name: 'extension',
30
- message: '✨ What file extensions should I look at?',
31
- choices: Object.values(EXTENSIONS),
32
- },
33
- {
34
- name: 'files',
35
- type: 'file-tree-selection',
36
- onlyShowDir: true,
37
- root: process.cwd(),
38
- message: '✨ And what directory would you like to transform?',
39
- },
40
- ];
41
- return inquirer.prompt(questions);
42
- };
43
-
44
- const fetchOptions = () => {
45
- const questions = [
46
- {
47
- name: 'dry',
48
- type: 'confirm',
49
- message: '✨ Dry run? (no changes are made to files)',
50
- },
51
- {
52
- name: 'verbose',
53
- type: 'confirm',
54
- message: '✨ Extra logging?',
55
- default: false,
56
- },
57
- ];
58
- return inquirer.prompt(questions);
59
- };
60
-
61
- const okToProceed = () => {
62
- const questions = [
63
- {
64
- name: 'confirm',
65
- type: 'confirm',
66
- message: 'Does everything look ok?',
67
- },
68
- ];
69
- return inquirer.prompt(questions);
70
- };
71
-
72
- const run = async () => {
73
- const { transform, extension, files } = await fetchSettings();
74
- const { dry, verbose } = await fetchOptions();
75
-
76
- console.log(`✨ Please review the following:`);
77
- console.log(`✨ Upgrade script: ${transform}`);
78
- console.log(`✨ File extension(s): ${extension}`);
79
- console.log(`✨ Directory: ${files}`);
80
- console.log(`✨ Dry run: ${dry}`);
81
-
82
- const { confirm } = await okToProceed();
83
-
84
- const options = `${dry ? '-d' : ''} ${verbose ? '-v=2' : ''}`;
85
-
86
- const handleOutput = (error, stdout, stderr) => {
87
- if (error) {
88
- console.log(stderr);
89
- return;
90
- }
91
- console.log(stdout);
92
- };
93
-
94
- const codeshiftPath = path.join(__dirname, '../node_modules/.bin/jscodeshift');
95
-
96
- const coreCommand = `${codeshiftPath} ${files} -t=${transform} ${options}`;
97
-
98
- if (confirm) {
99
- console.log('🚀 Running codemod, please wait a few seconds...');
100
- if (extension === EXTENSIONS.BOTH || extension === EXTENSIONS.JS) {
101
- exec(`${coreCommand} --extensions=js,jsx --ignore-pattern='${IGNORE_PATTERN}'`, handleOutput);
102
- }
103
- if (extension === EXTENSIONS.BOTH || extension === EXTENSIONS.TSX) {
104
- exec(
105
- `${coreCommand} --parser=tsx --extensions=tsx --ignore-pattern='${IGNORE_PATTERN}'`,
106
- handleOutput,
107
- );
108
- }
109
- } else {
110
- console.log('👋 Exiting');
111
- }
112
- };
113
-
114
- run();
@@ -1,193 +0,0 @@
1
- import { log } from './utils';
2
-
3
- const TYPE_REPLACEMENTS = {
4
- primary: 'Button.Type.ACCENT',
5
- secondary: 'Button.Type.ACCENT',
6
- link: 'Button.Type.ACCENT',
7
- danger: 'Button.Type.NEGATIVE',
8
- pay: 'Button.Type.POSITIVE',
9
- };
10
-
11
- const PRIORITY_ADDITIONS = {
12
- secondary: 'Button.Priority.SECONDARY',
13
- link: 'Button.Priority.TERTIARY',
14
- danger: 'Button.Priority.SECONDARY',
15
- };
16
-
17
- const transform = (file, api, options) => {
18
- const printOptions = options.printOptions || {
19
- quote: 'single',
20
- trailingComma: true,
21
- };
22
-
23
- const j = api.jscodeshift;
24
- const root = j(file.source);
25
-
26
- log('All aboard the transformation train 🚂', 2);
27
- log(
28
- 'Upgrading instances of Button from @transferwise/components. Please refer to components/upgrades/2021-02-v34-35.js for details.',
29
- 1,
30
- );
31
- log(`Using the ${options.parser} parser.`, 2);
32
-
33
- const literalType = options.parser === 'tsx' ? 'StringLiteral' : 'Literal';
34
-
35
- // First, ensure they are importing Button from our package
36
- const buttonImports = root
37
- .find(j.ImportDeclaration, {
38
- source: {
39
- type: literalType,
40
- value: '@transferwise/components',
41
- },
42
- })
43
- .find(j.Identifier, {
44
- name: 'Button',
45
- });
46
-
47
- if (buttonImports.size() === 0) {
48
- return null;
49
- }
50
-
51
- log('Found import of Button from @transferwise/components, continuing 🛤', 1);
52
-
53
- const buttons = root.findJSXElements('Button');
54
-
55
- log('Adding priorities for literal types', 2);
56
-
57
- // Add in priorities for literal types such as <Button type="secondary"/> => <Button type="secondary" priority={Button.Priority.SECONDARY} />
58
- buttons
59
- .find(j.JSXAttribute, {
60
- name: {
61
- type: 'JSXIdentifier',
62
- name: 'type',
63
- },
64
- value: {
65
- type: 'Literal',
66
- },
67
- })
68
- .replaceWith((nodePath) => {
69
- const priority = PRIORITY_ADDITIONS[nodePath.value.value.value]; // 😅
70
-
71
- if (!priority) {
72
- return nodePath.value;
73
- }
74
-
75
- return [
76
- nodePath.value,
77
- j.jsxAttribute(
78
- j.jsxIdentifier('priority'),
79
- j.jsxExpressionContainer(j.identifier(priority)),
80
- ),
81
- ];
82
- });
83
-
84
- log('Adding priorities for expressive types', 2);
85
-
86
- // Add in priorities for expressive types such as <Button type={Button.Type.SECONDARY}/> => <Button type={Button.Type.SECONDARY} priority={Button.Priority.SECONDARY} />
87
- buttons
88
- .find(j.JSXAttribute, {
89
- name: {
90
- type: 'JSXIdentifier',
91
- name: 'type',
92
- },
93
- value: {
94
- type: 'JSXExpressionContainer',
95
- expression: {
96
- type: 'MemberExpression',
97
- object: {
98
- type: 'MemberExpression',
99
- object: {
100
- name: 'Button',
101
- type: 'Identifier',
102
- },
103
- property: {
104
- name: 'Type',
105
- type: 'Identifier',
106
- },
107
- },
108
- },
109
- },
110
- })
111
- .replaceWith((nodePath) => {
112
- const type = nodePath.value.value.expression.property.name;
113
-
114
- const priority = PRIORITY_ADDITIONS[type.toLowerCase()];
115
-
116
- if (!priority) {
117
- return nodePath.value;
118
- }
119
-
120
- return [
121
- nodePath.value,
122
- j.jsxAttribute(
123
- j.jsxIdentifier('priority'),
124
- j.jsxExpressionContainer(j.identifier(priority)),
125
- ),
126
- ];
127
- });
128
-
129
- log('Replacing deprecated literal types', 2);
130
-
131
- // Replace literal types such as <Button type="primary"/> => <Button type={Button.Type.ACCENT} />
132
- buttons
133
- .find(j.JSXAttribute, {
134
- name: {
135
- type: 'JSXIdentifier',
136
- name: 'type',
137
- },
138
- value: {
139
- type: 'Literal',
140
- },
141
- })
142
- .find(j.Literal)
143
- .replaceWith((nodePath) => {
144
- const type = TYPE_REPLACEMENTS[nodePath.value.value];
145
-
146
- if (!type) {
147
- return nodePath.value;
148
- }
149
-
150
- return j.jsxExpressionContainer(j.identifier(type));
151
- });
152
-
153
- log('Replacing deprecated expressive types', 2);
154
-
155
- // Replace expressive types such as <Button type={Button.Type.PRIMARY}/> => <Button type={Button.Type.ACCENT} />
156
- buttons
157
- .find(j.JSXAttribute, {
158
- name: {
159
- type: 'JSXIdentifier',
160
- name: 'type',
161
- },
162
- value: {
163
- type: 'JSXExpressionContainer',
164
- },
165
- })
166
- .find(j.MemberExpression, {
167
- object: {
168
- type: 'MemberExpression',
169
- object: {
170
- name: 'Button',
171
- type: 'Identifier',
172
- },
173
- property: {
174
- name: 'Type',
175
- type: 'Identifier',
176
- },
177
- },
178
- })
179
- .replaceWith((node) => {
180
- const type = node.value.property.name.toLowerCase();
181
-
182
- if (!TYPE_REPLACEMENTS[type]) {
183
- return node.value;
184
- }
185
- return j.jsxIdentifier(TYPE_REPLACEMENTS[type]);
186
- });
187
-
188
- log('Transformation complete, printing to source.', 1);
189
-
190
- return root.toSource(printOptions);
191
- };
192
-
193
- export default transform;