gov-ui-core 0.2.6-beta.9 → 0.2.6

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 (114) hide show
  1. package/.storybook/main.ts +36 -37
  2. package/.storybook/preview.tsx +27 -27
  3. package/@types/custom.d.ts +43 -43
  4. package/@types/styles.d.ts +3 -86
  5. package/README.md +46 -46
  6. package/build/App.d.ts +3 -3
  7. package/build/Main.d.ts +5 -5
  8. package/build/components/Button/DropdownButton.d.ts +15 -15
  9. package/build/components/Button/SwitchButton.d.ts +7 -7
  10. package/build/components/Button/index.d.ts +11 -11
  11. package/build/components/Button/styled.d.ts +10 -11
  12. package/build/components/Calendar/CalendarNavigation.d.ts +9 -9
  13. package/build/components/Calendar/constants.d.ts +2 -2
  14. package/build/components/Calendar/index.d.ts +11 -11
  15. package/build/components/Calendar/styled.d.ts +2 -2
  16. package/build/components/Carousel/ArrowButton.d.ts +7 -7
  17. package/build/components/Carousel/index.d.ts +14 -14
  18. package/build/components/Carousel/styled.d.ts +2 -2
  19. package/build/components/Directory/index.d.ts +32 -32
  20. package/build/components/Directory/styled.d.ts +6 -6
  21. package/build/components/EmptyBox/index.d.ts +8 -8
  22. package/build/components/EmptyBox/styled.d.ts +4 -4
  23. package/build/components/Form/Form.d.ts +21 -21
  24. package/build/components/Form/Group.d.ts +6 -6
  25. package/build/components/Form/Item.d.ts +22 -22
  26. package/build/components/Form/index.d.ts +14 -14
  27. package/build/components/Form/styled.d.ts +7 -7
  28. package/build/components/Header/ContentHeader.d.ts +15 -15
  29. package/build/components/Header/styled.d.ts +5 -5
  30. package/build/components/Icons/index.d.ts +14 -14
  31. package/build/components/Input/Checkbox.d.ts +19 -19
  32. package/build/components/Input/ErrorMessage.d.ts +8 -8
  33. package/build/components/Input/Input.d.ts +23 -23
  34. package/build/components/Input/InputNumber.d.ts +8 -8
  35. package/build/components/Input/Radio.d.ts +16 -16
  36. package/build/components/Input/Search.d.ts +13 -13
  37. package/build/components/Input/Select.d.ts +39 -40
  38. package/build/components/Input/TextArea.d.ts +15 -15
  39. package/build/components/Input/index.d.ts +19 -19
  40. package/build/components/Input/styled.d.ts +25 -25
  41. package/build/components/IntlText/index.d.ts +5 -5
  42. package/build/components/Loading/OverlayLoading.d.ts +10 -10
  43. package/build/components/Loading/Spinner.d.ts +9 -9
  44. package/build/components/Loading/styled.d.ts +10 -10
  45. package/build/components/Styled/mixins.d.ts +13 -13
  46. package/build/components/Styled/variable.d.ts +6 -6
  47. package/build/components/Table/AppendTable.d.ts +26 -26
  48. package/build/components/Table/AutoTooltip.d.ts +8 -8
  49. package/build/components/Table/TableBase.d.ts +16 -16
  50. package/build/components/Table/TableLoading.d.ts +9 -9
  51. package/build/components/Table/components/Pagination.d.ts +18 -18
  52. package/build/components/Table/components/PaginationItem.d.ts +9 -9
  53. package/build/components/Table/index.d.ts +27 -27
  54. package/build/components/Table/styled.d.ts +25 -25
  55. package/build/components/ThemeProvider.d.ts +16 -16
  56. package/build/globalStyle.d.ts +5 -5
  57. package/build/index.d.ts +1 -1
  58. package/build/index.js +1 -1
  59. package/build/modules.d.ts +23 -24
  60. package/build/pages/CreateTable.d.ts +20 -20
  61. package/build/pages/FormSample.d.ts +5 -5
  62. package/build/pages/Sample.d.ts +5 -5
  63. package/build/pages/Sample2.d.ts +5 -5
  64. package/build/pages/Sample3.d.ts +5 -5
  65. package/build/pages/Sample4.d.ts +5 -5
  66. package/build/pages/TableSample.d.ts +5 -5
  67. package/build/pages/sampleData.d.ts +59 -59
  68. package/build/reportWebVitals.d.ts +3 -3
  69. package/build/theme.d.ts +45 -3
  70. package/build/utils/customState.d.ts +28 -28
  71. package/build/utils/hookUtils.d.ts +16 -16
  72. package/build/utils/index.d.ts +35 -35
  73. package/config/env.js +104 -104
  74. package/config/getHttpsConfig.js +66 -66
  75. package/config/jest/babelTransform.js +29 -29
  76. package/config/jest/cssTransform.js +14 -14
  77. package/config/jest/fileTransform.js +40 -40
  78. package/config/modules.js +134 -134
  79. package/config/paths.js +77 -77
  80. package/config/webpack/persistentCache/createEnvironmentHash.js +9 -9
  81. package/config/webpack.config.js +756 -756
  82. package/config/webpack.prod.config.js +91 -91
  83. package/config/webpackDevServer.config.js +127 -127
  84. package/doctor-storybook.log +18 -0
  85. package/migration-storybook.log +98 -0
  86. package/package.json +215 -247
  87. package/public/index.html +43 -43
  88. package/public/manifest.json +25 -25
  89. package/public/robots.txt +3 -3
  90. package/scripts/build.js +217 -217
  91. package/scripts/start.js +154 -154
  92. package/scripts/test.js +52 -52
  93. package/tsconfig.json +34 -34
  94. package/.eslintrc.json +0 -54
  95. package/.husky/pre-commit +0 -4
  96. package/.prettierrc +0 -12
  97. package/.stylelintrc.json +0 -16
  98. package/build/20d0d451f31ed3b5c15f.woff +0 -1
  99. package/build/39285e8af490890e2df4.otf +0 -0
  100. package/build/3965b6176d1ce958b445.woff +0 -1
  101. package/build/508d69efb37042551458.woff +0 -1
  102. package/build/72ba455576ce8174ffa8.otf +0 -0
  103. package/build/a9ba4978d441af03cd27.woff +0 -1
  104. package/build/components/Button/constants.d.ts +0 -19
  105. package/build/components/Chip/constants.d.ts +0 -9
  106. package/build/components/Chip/index.d.ts +0 -12
  107. package/build/e65c7edcd47e3e9f5c99.otf +0 -0
  108. package/build/f7a8dce8dfc249d7e12b.otf +0 -0
  109. package/build/pages/ButtonSample.d.ts +0 -6
  110. package/build/pages/ChipSample.d.ts +0 -6
  111. package/build/pages/InputSample.d.ts +0 -6
  112. package/build/pages/TailwindSample.d.ts +0 -1
  113. package/postcss.config.js +0 -8
  114. package/tailwind.config.js +0 -185
package/scripts/build.js CHANGED
@@ -1,217 +1,217 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'production';
5
- process.env.NODE_ENV = 'production';
6
-
7
- // Makes the script crash on unhandled rejections instead of silently
8
- // ignoring them. In the future, promise rejections that are not handled will
9
- // terminate the Node.js process with a non-zero exit code.
10
- process.on('unhandledRejection', err => {
11
- throw err;
12
- });
13
-
14
- // Ensure environment variables are read.
15
- require('../config/env');
16
-
17
- const path = require('path');
18
- const chalk = require('react-dev-utils/chalk');
19
- const fs = require('fs-extra');
20
- const bfj = require('bfj');
21
- const webpack = require('webpack');
22
- const configFactory = require('../config/webpack.prod.config');
23
- const paths = require('../config/paths');
24
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
25
- const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
26
- const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
27
- const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
28
- const printBuildError = require('react-dev-utils/printBuildError');
29
-
30
- const measureFileSizesBeforeBuild =
31
- FileSizeReporter.measureFileSizesBeforeBuild;
32
- const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
33
- const useYarn = fs.existsSync(paths.yarnLockFile);
34
-
35
- // These sizes are pretty large. We'll warn for bundles exceeding them.
36
- const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
37
- const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
38
-
39
- const isInteractive = process.stdout.isTTY;
40
-
41
- // Warn and crash if required files are missing
42
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
43
- process.exit(1);
44
- }
45
-
46
- const argv = process.argv.slice(2);
47
- const writeStatsJson = argv.indexOf('--stats') !== -1;
48
-
49
- // Generate configuration
50
- const config = configFactory('production');
51
-
52
- // We require that you explicitly set browsers and do not fall back to
53
- // browserslist defaults.
54
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
55
- checkBrowsers(paths.appPath, isInteractive)
56
- .then(() => {
57
- // First, read the current file sizes in build directory.
58
- // This lets us display how much they changed later.
59
- return measureFileSizesBeforeBuild(paths.appBuild);
60
- })
61
- .then(previousFileSizes => {
62
- // Remove all content but keep the directory so that
63
- // if you're in it, you don't end up in Trash
64
- fs.emptyDirSync(paths.appBuild);
65
- // Merge with the public folder
66
- copyPublicFolder();
67
- // Start the webpack build
68
- return build(previousFileSizes);
69
- })
70
- .then(
71
- ({ stats, previousFileSizes, warnings }) => {
72
- if (warnings.length) {
73
- console.log(chalk.yellow('Compiled with warnings.\n'));
74
- console.log(warnings.join('\n\n'));
75
- console.log(
76
- '\nSearch for the ' +
77
- chalk.underline(chalk.yellow('keywords')) +
78
- ' to learn more about each warning.'
79
- );
80
- console.log(
81
- 'To ignore, add ' +
82
- chalk.cyan('// eslint-disable-next-line') +
83
- ' to the line before.\n'
84
- );
85
- } else {
86
- console.log(chalk.green('Compiled successfully.\n'));
87
- }
88
-
89
- console.log('File sizes after gzip:\n');
90
- printFileSizesAfterBuild(
91
- stats,
92
- previousFileSizes,
93
- paths.appBuild,
94
- WARN_AFTER_BUNDLE_GZIP_SIZE,
95
- WARN_AFTER_CHUNK_GZIP_SIZE
96
- );
97
- console.log();
98
-
99
- const appPackage = require(paths.appPackageJson);
100
- const publicUrl = paths.publicUrlOrPath;
101
- const publicPath = config.output.publicPath;
102
- const buildFolder = path.relative(process.cwd(), paths.appBuild);
103
- printHostingInstructions(
104
- appPackage,
105
- publicUrl,
106
- publicPath,
107
- buildFolder,
108
- useYarn
109
- );
110
- },
111
- err => {
112
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
113
- if (tscCompileOnError) {
114
- console.log(
115
- chalk.yellow(
116
- 'Compiled with the following type errors (you may want to check these before deploying your app):\n'
117
- )
118
- );
119
- printBuildError(err);
120
- } else {
121
- console.log(chalk.red('Failed to compile.\n'));
122
- printBuildError(err);
123
- process.exit(1);
124
- }
125
- }
126
- )
127
- .catch(err => {
128
- if (err && err.message) {
129
- console.log(err.message);
130
- }
131
- process.exit(1);
132
- });
133
-
134
- // Create the production build and print the deployment instructions.
135
- function build(previousFileSizes) {
136
- console.log('Creating an optimized production build...');
137
-
138
- const compiler = webpack(config);
139
- return new Promise((resolve, reject) => {
140
- compiler.run((err, stats) => {
141
- let messages;
142
- if (err) {
143
- if (!err.message) {
144
- return reject(err);
145
- }
146
-
147
- let errMessage = err.message;
148
-
149
- // Add additional information for postcss errors
150
- if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
151
- errMessage +=
152
- '\nCompileError: Begins at CSS selector ' +
153
- err['postcssNode'].selector;
154
- }
155
-
156
- messages = formatWebpackMessages({
157
- errors: [errMessage],
158
- warnings: [],
159
- });
160
- } else {
161
- messages = formatWebpackMessages(
162
- stats.toJson({ all: false, warnings: true, errors: true })
163
- );
164
- }
165
- if (messages.errors.length) {
166
- // Only keep the first error. Others are often indicative
167
- // of the same problem, but confuse the reader with noise.
168
- if (messages.errors.length > 1) {
169
- messages.errors.length = 1;
170
- }
171
- return reject(new Error(messages.errors.join('\n\n')));
172
- }
173
- if (
174
- process.env.CI &&
175
- (typeof process.env.CI !== 'string' ||
176
- process.env.CI.toLowerCase() !== 'false') &&
177
- messages.warnings.length
178
- ) {
179
- // Ignore sourcemap warnings in CI builds. See #8227 for more info.
180
- const filteredWarnings = messages.warnings.filter(
181
- w => !/Failed to parse source map/.test(w)
182
- );
183
- if (filteredWarnings.length) {
184
- console.log(
185
- chalk.yellow(
186
- '\nTreating warnings as errors because process.env.CI = true.\n' +
187
- 'Most CI servers set it automatically.\n'
188
- )
189
- );
190
- return reject(new Error(filteredWarnings.join('\n\n')));
191
- }
192
- }
193
-
194
- const resolveArgs = {
195
- stats,
196
- previousFileSizes,
197
- warnings: messages.warnings,
198
- };
199
-
200
- if (writeStatsJson) {
201
- return bfj
202
- .write(paths.appBuild + '/bundle-stats.json', stats.toJson())
203
- .then(() => resolve(resolveArgs))
204
- .catch(error => reject(new Error(error)));
205
- }
206
-
207
- return resolve(resolveArgs);
208
- });
209
- });
210
- }
211
-
212
- function copyPublicFolder() {
213
- fs.copySync(paths.appPublic, paths.appBuild, {
214
- dereference: true,
215
- filter: file => file !== paths.appHtml,
216
- });
217
- }
1
+ 'use strict';
2
+
3
+ // Do this as the first thing so that any code reading it knows the right env.
4
+ process.env.BABEL_ENV = 'production';
5
+ process.env.NODE_ENV = 'production';
6
+
7
+ // Makes the script crash on unhandled rejections instead of silently
8
+ // ignoring them. In the future, promise rejections that are not handled will
9
+ // terminate the Node.js process with a non-zero exit code.
10
+ process.on('unhandledRejection', err => {
11
+ throw err;
12
+ });
13
+
14
+ // Ensure environment variables are read.
15
+ require('../config/env');
16
+
17
+ const path = require('path');
18
+ const chalk = require('react-dev-utils/chalk');
19
+ const fs = require('fs-extra');
20
+ const bfj = require('bfj');
21
+ const webpack = require('webpack');
22
+ const configFactory = require('../config/webpack.prod.config');
23
+ const paths = require('../config/paths');
24
+ const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
25
+ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
26
+ const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
27
+ const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
28
+ const printBuildError = require('react-dev-utils/printBuildError');
29
+
30
+ const measureFileSizesBeforeBuild =
31
+ FileSizeReporter.measureFileSizesBeforeBuild;
32
+ const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
33
+ const useYarn = fs.existsSync(paths.yarnLockFile);
34
+
35
+ // These sizes are pretty large. We'll warn for bundles exceeding them.
36
+ const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
37
+ const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
38
+
39
+ const isInteractive = process.stdout.isTTY;
40
+
41
+ // Warn and crash if required files are missing
42
+ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
43
+ process.exit(1);
44
+ }
45
+
46
+ const argv = process.argv.slice(2);
47
+ const writeStatsJson = argv.indexOf('--stats') !== -1;
48
+
49
+ // Generate configuration
50
+ const config = configFactory('production');
51
+
52
+ // We require that you explicitly set browsers and do not fall back to
53
+ // browserslist defaults.
54
+ const { checkBrowsers } = require('react-dev-utils/browsersHelper');
55
+ checkBrowsers(paths.appPath, isInteractive)
56
+ .then(() => {
57
+ // First, read the current file sizes in build directory.
58
+ // This lets us display how much they changed later.
59
+ return measureFileSizesBeforeBuild(paths.appBuild);
60
+ })
61
+ .then(previousFileSizes => {
62
+ // Remove all content but keep the directory so that
63
+ // if you're in it, you don't end up in Trash
64
+ fs.emptyDirSync(paths.appBuild);
65
+ // Merge with the public folder
66
+ copyPublicFolder();
67
+ // Start the webpack build
68
+ return build(previousFileSizes);
69
+ })
70
+ .then(
71
+ ({ stats, previousFileSizes, warnings }) => {
72
+ if (warnings.length) {
73
+ console.log(chalk.yellow('Compiled with warnings.\n'));
74
+ console.log(warnings.join('\n\n'));
75
+ console.log(
76
+ '\nSearch for the ' +
77
+ chalk.underline(chalk.yellow('keywords')) +
78
+ ' to learn more about each warning.'
79
+ );
80
+ console.log(
81
+ 'To ignore, add ' +
82
+ chalk.cyan('// eslint-disable-next-line') +
83
+ ' to the line before.\n'
84
+ );
85
+ } else {
86
+ console.log(chalk.green('Compiled successfully.\n'));
87
+ }
88
+
89
+ console.log('File sizes after gzip:\n');
90
+ printFileSizesAfterBuild(
91
+ stats,
92
+ previousFileSizes,
93
+ paths.appBuild,
94
+ WARN_AFTER_BUNDLE_GZIP_SIZE,
95
+ WARN_AFTER_CHUNK_GZIP_SIZE
96
+ );
97
+ console.log();
98
+
99
+ const appPackage = require(paths.appPackageJson);
100
+ const publicUrl = paths.publicUrlOrPath;
101
+ const publicPath = config.output.publicPath;
102
+ const buildFolder = path.relative(process.cwd(), paths.appBuild);
103
+ printHostingInstructions(
104
+ appPackage,
105
+ publicUrl,
106
+ publicPath,
107
+ buildFolder,
108
+ useYarn
109
+ );
110
+ },
111
+ err => {
112
+ const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
113
+ if (tscCompileOnError) {
114
+ console.log(
115
+ chalk.yellow(
116
+ 'Compiled with the following type errors (you may want to check these before deploying your app):\n'
117
+ )
118
+ );
119
+ printBuildError(err);
120
+ } else {
121
+ console.log(chalk.red('Failed to compile.\n'));
122
+ printBuildError(err);
123
+ process.exit(1);
124
+ }
125
+ }
126
+ )
127
+ .catch(err => {
128
+ if (err && err.message) {
129
+ console.log(err.message);
130
+ }
131
+ process.exit(1);
132
+ });
133
+
134
+ // Create the production build and print the deployment instructions.
135
+ function build(previousFileSizes) {
136
+ console.log('Creating an optimized production build...');
137
+
138
+ const compiler = webpack(config);
139
+ return new Promise((resolve, reject) => {
140
+ compiler.run((err, stats) => {
141
+ let messages;
142
+ if (err) {
143
+ if (!err.message) {
144
+ return reject(err);
145
+ }
146
+
147
+ let errMessage = err.message;
148
+
149
+ // Add additional information for postcss errors
150
+ if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
151
+ errMessage +=
152
+ '\nCompileError: Begins at CSS selector ' +
153
+ err['postcssNode'].selector;
154
+ }
155
+
156
+ messages = formatWebpackMessages({
157
+ errors: [errMessage],
158
+ warnings: [],
159
+ });
160
+ } else {
161
+ messages = formatWebpackMessages(
162
+ stats.toJson({ all: false, warnings: true, errors: true })
163
+ );
164
+ }
165
+ if (messages.errors.length) {
166
+ // Only keep the first error. Others are often indicative
167
+ // of the same problem, but confuse the reader with noise.
168
+ if (messages.errors.length > 1) {
169
+ messages.errors.length = 1;
170
+ }
171
+ return reject(new Error(messages.errors.join('\n\n')));
172
+ }
173
+ if (
174
+ process.env.CI &&
175
+ (typeof process.env.CI !== 'string' ||
176
+ process.env.CI.toLowerCase() !== 'false') &&
177
+ messages.warnings.length
178
+ ) {
179
+ // Ignore sourcemap warnings in CI builds. See #8227 for more info.
180
+ const filteredWarnings = messages.warnings.filter(
181
+ w => !/Failed to parse source map/.test(w)
182
+ );
183
+ if (filteredWarnings.length) {
184
+ console.log(
185
+ chalk.yellow(
186
+ '\nTreating warnings as errors because process.env.CI = true.\n' +
187
+ 'Most CI servers set it automatically.\n'
188
+ )
189
+ );
190
+ return reject(new Error(filteredWarnings.join('\n\n')));
191
+ }
192
+ }
193
+
194
+ const resolveArgs = {
195
+ stats,
196
+ previousFileSizes,
197
+ warnings: messages.warnings,
198
+ };
199
+
200
+ if (writeStatsJson) {
201
+ return bfj
202
+ .write(paths.appBuild + '/bundle-stats.json', stats.toJson())
203
+ .then(() => resolve(resolveArgs))
204
+ .catch(error => reject(new Error(error)));
205
+ }
206
+
207
+ return resolve(resolveArgs);
208
+ });
209
+ });
210
+ }
211
+
212
+ function copyPublicFolder() {
213
+ fs.copySync(paths.appPublic, paths.appBuild, {
214
+ dereference: true,
215
+ filter: file => file !== paths.appHtml,
216
+ });
217
+ }