@spothero/ui 16.2.0-beta.0 → 17.0.0-beta.2
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.
- package/dist/components/Accordion/Accordion.js +13 -0
- package/dist/components/Accordion/Accordion.stories.js +86 -0
- package/dist/components/Accordion/index.js +41 -0
- package/dist/components/Accordion/styles/button.js +23 -0
- package/dist/components/Accordion/styles/container.js +15 -0
- package/dist/components/Accordion/styles/index.js +32 -0
- package/dist/components/Accordion/styles/panel.js +13 -0
- package/dist/components/Alert/Alert.js +119 -0
- package/dist/components/Alert/Alert.stories.js +80 -0
- package/dist/components/Alert/index.js +15 -0
- package/dist/components/Alert/styles/index.js +192 -0
- package/dist/components/AutoSuggestSelect/AutoSuggestSelect.js +189 -0
- package/dist/components/AutoSuggestSelect/index.js +15 -0
- package/dist/components/Badge/Badge.js +13 -0
- package/dist/components/Badge/Badge.stories.js +38 -0
- package/dist/components/Badge/styles/index.js +40 -0
- package/dist/components/Button/Button.js +73 -0
- package/dist/components/Button/Button.spec.js +31 -0
- package/dist/components/Button/Button.styles.js +173 -0
- package/dist/components/Button/button-props.js +90 -0
- package/dist/components/Button/index.js +23 -0
- package/dist/components/Button/stories/button.js +59 -0
- package/dist/components/Button/stories/index.stories.js +124 -0
- package/dist/components/Button/stories/overview.js +96 -0
- package/dist/components/Card/Card.js +38 -0
- package/dist/components/Card/Card.stories.js +41 -0
- package/dist/components/Checkbox/Checkbox.js +13 -0
- package/dist/components/Checkbox/Checkbox.stories.js +44 -0
- package/dist/components/Checkbox/index.js +15 -0
- package/dist/components/Checkbox/styles/index.js +64 -0
- package/dist/components/Container/Container.js +34 -0
- package/dist/components/Container/Container.stories.js +74 -0
- package/dist/components/Container/Container.styles.js +17 -0
- package/dist/components/Divider/Divider.js +47 -0
- package/dist/components/Divider/Divider.stories.js +49 -0
- package/dist/components/Divider/Divider.styles.js +28 -0
- package/dist/components/FormControl/FormControl.js +79 -0
- package/dist/components/Grid/Grid.js +49 -0
- package/dist/components/Grid/Grid.stories.js +141 -0
- package/dist/components/Grid/Grid.styles.js +19 -0
- package/dist/components/Grid/GridItem.js +34 -0
- package/dist/components/Grid/GridItem.styles.js +13 -0
- package/dist/components/Grid/index.js +23 -0
- package/dist/components/Heading/Heading.js +49 -0
- package/dist/components/Heading/Heading.stories.js +54 -0
- package/dist/components/Heading/Heading.styles.js +79 -0
- package/dist/components/Icon/Icon.js +13 -0
- package/dist/components/Icon/Icon.stories.js +47 -0
- package/dist/components/Image/Image.js +106 -0
- package/dist/components/Image/Image.spec.js +83 -0
- package/dist/components/Image/Image.stories.js +92 -0
- package/dist/components/Input/Input.js +61 -0
- package/dist/components/Input/Input.stories.js +71 -0
- package/dist/components/Input/index.js +15 -0
- package/dist/components/Input/styles/index.js +71 -0
- package/dist/components/Link/Link.js +13 -0
- package/dist/components/Link/Link.stories.js +61 -0
- package/dist/components/Link/Link.styles.js +42 -0
- package/dist/components/List/List.js +88 -0
- package/dist/components/List/List.stories.js +124 -0
- package/dist/components/List/index.js +23 -0
- package/dist/components/List/styles/index.js +24 -0
- package/dist/components/List/styles/item.styles.js +11 -0
- package/dist/components/Loader/Loader.js +62 -0
- package/dist/components/Loader/Loader.stories.js +140 -0
- package/dist/components/Modal/Modal.js +52 -0
- package/dist/components/Modal/Modal.stories.js +236 -0
- package/dist/components/Modal/index.js +15 -0
- package/dist/components/Modal/styles/body.js +48 -0
- package/dist/components/Modal/styles/closeButton.js +27 -0
- package/dist/components/Modal/styles/dialog.js +25 -0
- package/dist/components/Modal/styles/dialogContainer.js +26 -0
- package/dist/components/Modal/styles/footer.js +12 -0
- package/dist/components/Modal/styles/header.js +20 -0
- package/dist/components/Modal/styles/index.js +70 -0
- package/dist/components/Modal/styles/overlay.js +12 -0
- package/dist/components/Popover/Popover.js +48 -0
- package/dist/components/Popover/Popover.stories.js +101 -0
- package/dist/components/Popover/PopoverArrow.js +34 -0
- package/dist/components/Popover/PopoverCloseButton.js +34 -0
- package/dist/components/Popover/PopoverContent.js +53 -0
- package/dist/components/Popover/index.js +37 -0
- package/dist/components/Popover/styles/index.js +38 -0
- package/dist/components/Popover/styles/popover-arrow.js +16 -0
- package/dist/components/Popover/styles/popover-body.js +15 -0
- package/dist/components/Popover/styles/popover-close-button.js +30 -0
- package/dist/components/Popover/styles/popover-content.js +29 -0
- package/dist/components/Popover/styles/popover-header.js +12 -0
- package/dist/components/Popover/styles/popper.js +11 -0
- package/dist/components/Radio/Radio.js +52 -0
- package/dist/components/Radio/Radio.stories.js +142 -0
- package/dist/components/Radio/RadioGroup.js +65 -0
- package/dist/components/Radio/index.js +23 -0
- package/dist/components/Radio/styles/index.js +65 -0
- package/dist/components/Select/Select.js +71 -0
- package/dist/components/Select/Select.stories.js +74 -0
- package/dist/components/Select/index.js +15 -0
- package/dist/components/Select/styles/index.js +57 -0
- package/dist/components/Skeleton/Skeleton.stories.js +41 -0
- package/dist/components/Skeleton/Skeleton.styles.js +13 -0
- package/dist/components/Skeleton/index.js +25 -0
- package/dist/components/Spinner/Spinner.js +47 -0
- package/dist/components/Spinner/Spinner.stories.js +134 -0
- package/dist/components/Spinner/Spinner.styles.js +76 -0
- package/dist/components/Switch/Switch.js +59 -0
- package/dist/components/Switch/Switch.stories.js +86 -0
- package/dist/components/Switch/index.js +15 -0
- package/dist/components/Switch/styles/index.js +46 -0
- package/dist/components/Table/Table.js +13 -0
- package/dist/components/Table/Table.stories.js +92 -0
- package/dist/components/Table/Table.styles.js +87 -0
- package/dist/components/Table/index.js +59 -0
- package/dist/components/Tabs/Tabs.js +48 -0
- package/dist/components/Tabs/Tabs.stories.js +51 -0
- package/dist/components/Tabs/combineSizeWithVariant.js +44 -0
- package/dist/components/Tabs/index.js +41 -0
- package/dist/components/Tabs/styles/index.js +52 -0
- package/dist/components/Text/Text.js +44 -0
- package/dist/components/Text/Text.stories.js +56 -0
- package/dist/components/Text/Text.styles.js +67 -0
- package/dist/components/Text/combineAsWithVariant.js +123 -0
- package/dist/components/Text/options.js +9 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +66 -0
- package/dist/components/ThemeProvider/ThemeProvider.stories.js +63 -0
- package/dist/components/index.js +577 -0
- package/dist/components/styles.js +175 -0
- package/dist/theme/base/breakpoints.js +27 -0
- package/dist/theme/base/colors.js +148 -0
- package/dist/theme/base/index.js +59 -0
- package/dist/theme/base/sizes.js +88 -0
- package/dist/theme/base/typography.js +41 -0
- package/dist/theme/base/zindices.js +35 -0
- package/dist/theme/global.js +52 -0
- package/dist/theme/index.js +63 -0
- package/dist/utils/Spaces.js +27 -0
- package/package.json +4 -4
- package/.eslintignore +0 -7
- package/CHANGELOG.md +0 -1767
- package/__tests__/threshold-ratchet.js +0 -167
- package/babel.config.js +0 -1
- package/dex.config.js +0 -45
- package/jest.config.json +0 -64
- package/v2/assets-manifest.json +0 -5
- package/v2/index.html +0 -1
- package/v2/index.js +0 -3
- package/v2/index.js.LICENSE.txt +0 -14
- package/v2/index.js.map +0 -1
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const {merge} = require('lodash');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* OPTIONS:
|
|
8
|
-
* - tolerance: keeps the threshold below the measured coverage, allowing wiggle room. default: 0 tolerance
|
|
9
|
-
* - roundDown: round down to the nearest integer. default: false
|
|
10
|
-
* - configLocation: the location of the jest config, default: <rootDir>/jest.config.json
|
|
11
|
-
*/
|
|
12
|
-
class ThresholdRatchet {
|
|
13
|
-
#globalConfig;
|
|
14
|
-
#options;
|
|
15
|
-
|
|
16
|
-
constructor(globalConfig, options) {
|
|
17
|
-
this.#globalConfig = globalConfig;
|
|
18
|
-
this.#options = options;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
#log = (message, type = 'info') => {
|
|
22
|
-
let transformedMessage = message;
|
|
23
|
-
const messageLength =
|
|
24
|
-
transformedMessage % 2 === 0
|
|
25
|
-
? transformedMessage.length
|
|
26
|
-
: transformedMessage.length + 1;
|
|
27
|
-
|
|
28
|
-
let header = ' ThresholdRatchet ';
|
|
29
|
-
const minStringLength = 80;
|
|
30
|
-
|
|
31
|
-
if (messageLength < minStringLength) {
|
|
32
|
-
transformedMessage = transformedMessage
|
|
33
|
-
.padStart(minStringLength / 2 + message.length / 2, ' ')
|
|
34
|
-
.padEnd(minStringLength, ' ');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
header = header
|
|
38
|
-
.padStart(transformedMessage.length / 2 + header.length / 2, '=')
|
|
39
|
-
.padEnd(transformedMessage.length, '=');
|
|
40
|
-
|
|
41
|
-
const footer = ''.padStart(transformedMessage.length, '=');
|
|
42
|
-
const colorText = type === 'info' ? chalk.green : chalk.red;
|
|
43
|
-
const colorBackground =
|
|
44
|
-
type === 'info' ? chalk.bgGreen.black : chalk.bgRed.black;
|
|
45
|
-
|
|
46
|
-
console.log(`\n${colorBackground(header)}`);
|
|
47
|
-
console.log(`\n${colorText(transformedMessage)}\n`);
|
|
48
|
-
console.log(`${colorBackground(footer)}\n`);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
#getCoverageSummary = () => {
|
|
52
|
-
const coverageDirectory = this.#globalConfig.coverageDirectory;
|
|
53
|
-
const coverageSummary = JSON.parse(
|
|
54
|
-
fs.readFileSync(
|
|
55
|
-
`${coverageDirectory}/coverage-summary.json`,
|
|
56
|
-
'utf-8'
|
|
57
|
-
)
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return coverageSummary;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
#generateNewThreshold = coverageSummary => {
|
|
64
|
-
return Object.entries(coverageSummary.total).reduce(
|
|
65
|
-
(acc, [type, {pct}]) => {
|
|
66
|
-
const newThreshold = pct - (this.#options.tolerance || 5);
|
|
67
|
-
|
|
68
|
-
const percent = this.#options.roundDown
|
|
69
|
-
? Math.floor(newThreshold)
|
|
70
|
-
: newThreshold;
|
|
71
|
-
|
|
72
|
-
acc[type] = percent;
|
|
73
|
-
|
|
74
|
-
return acc;
|
|
75
|
-
},
|
|
76
|
-
{}
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
#updateThreshold = newThreshold => {
|
|
81
|
-
let configLocation =
|
|
82
|
-
this.#options.configLocation || '<rootDir>/jest.config.json';
|
|
83
|
-
|
|
84
|
-
configLocation = configLocation.replace(
|
|
85
|
-
'<rootDir>',
|
|
86
|
-
this.#globalConfig.rootDir
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const configFile = JSON.parse(fs.readFileSync(configLocation, 'utf-8'));
|
|
90
|
-
|
|
91
|
-
const newConfig = merge(configFile, {
|
|
92
|
-
coverageThreshold: {
|
|
93
|
-
global: newThreshold,
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
fs.writeFileSync(
|
|
98
|
-
configLocation,
|
|
99
|
-
JSON.stringify(newConfig, null, 4),
|
|
100
|
-
'utf-8'
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
this.#log('Updated global threshold');
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
#hasDecreasedCoverage = newThreshold => {
|
|
107
|
-
const current = this.#globalConfig.coverageThreshold;
|
|
108
|
-
|
|
109
|
-
return Object.keys((current && current.global) || {}).some(
|
|
110
|
-
key => current.global[key] > newThreshold[key]
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
#hasIncreasedCoverage = newThreshold => {
|
|
115
|
-
const current = this.#globalConfig.coverageThreshold;
|
|
116
|
-
|
|
117
|
-
return current && current.global
|
|
118
|
-
? Object.keys(current.global).some(
|
|
119
|
-
key => current.global[key] < newThreshold[key]
|
|
120
|
-
)
|
|
121
|
-
: true;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
onRunComplete(context, {numFailedTests}) {
|
|
125
|
-
if (this.#globalConfig.watch) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (!this.#globalConfig.coverageReporters.includes('json-summary')) {
|
|
130
|
-
this.#log(
|
|
131
|
-
'ThresholdRatchet needs "json-summary" within "coverageReporters"',
|
|
132
|
-
'error'
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (numFailedTests) {
|
|
139
|
-
this.#log(
|
|
140
|
-
'ThresholdRatchet only runs when all tests have passed',
|
|
141
|
-
'error'
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const coverageSummary = this.#getCoverageSummary();
|
|
148
|
-
const newThreshold = this.#generateNewThreshold(coverageSummary);
|
|
149
|
-
|
|
150
|
-
if (this.#hasDecreasedCoverage(newThreshold)) {
|
|
151
|
-
this.#log(
|
|
152
|
-
'Coverage has decreased! Please resolve before running tests again.',
|
|
153
|
-
'error'
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (this.#hasIncreasedCoverage(newThreshold)) {
|
|
160
|
-
this.#updateThreshold(newThreshold);
|
|
161
|
-
} else {
|
|
162
|
-
this.#log('Coverage has not changed');
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
module.exports = ThresholdRatchet;
|
package/babel.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = {presets: ['@babel/preset-env']};
|
package/dex.config.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const targetEntry = process.env.TARGET_ENTRY;
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
client: {
|
|
7
|
-
plugins: [],
|
|
8
|
-
},
|
|
9
|
-
production: {
|
|
10
|
-
client: {
|
|
11
|
-
entry: [`./src/components/index.js`],
|
|
12
|
-
output: {
|
|
13
|
-
filename: 'index.js',
|
|
14
|
-
path: path.resolve(__dirname, targetEntry),
|
|
15
|
-
library: {
|
|
16
|
-
name: '@spothero/ui',
|
|
17
|
-
type: 'umd',
|
|
18
|
-
},
|
|
19
|
-
globalObject: 'this',
|
|
20
|
-
},
|
|
21
|
-
externals: {
|
|
22
|
-
react: {
|
|
23
|
-
root: 'React',
|
|
24
|
-
commonjs2: 'react',
|
|
25
|
-
commonjs: 'react',
|
|
26
|
-
amd: 'react',
|
|
27
|
-
},
|
|
28
|
-
'react-dom': {
|
|
29
|
-
root: 'ReactDOM',
|
|
30
|
-
commonjs2: 'react-dom',
|
|
31
|
-
commonjs: 'react-dom',
|
|
32
|
-
amd: 'react-dom',
|
|
33
|
-
},
|
|
34
|
-
lodash: {
|
|
35
|
-
commonjs2: 'lodash',
|
|
36
|
-
commonjs: 'lodash',
|
|
37
|
-
amd: 'lodash',
|
|
38
|
-
root: '_',
|
|
39
|
-
},
|
|
40
|
-
'prop-types': 'prop-types',
|
|
41
|
-
'@chakra-ui/react': '@chakra-ui/react',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
package/jest.config.json
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"rootDir": "./",
|
|
3
|
-
"clearMocks": true,
|
|
4
|
-
"resetMocks": true,
|
|
5
|
-
"moduleDirectories": [
|
|
6
|
-
"node_modules",
|
|
7
|
-
"<rootDir>/src",
|
|
8
|
-
"<rootDir>/__tests__",
|
|
9
|
-
"<rootDir>"
|
|
10
|
-
],
|
|
11
|
-
"moduleFileExtensions": [
|
|
12
|
-
"js",
|
|
13
|
-
"jsx",
|
|
14
|
-
"json"
|
|
15
|
-
],
|
|
16
|
-
"setupFiles": [
|
|
17
|
-
"jest-date-mock"
|
|
18
|
-
],
|
|
19
|
-
"setupFilesAfterEnv": [
|
|
20
|
-
"jest-extended",
|
|
21
|
-
"jest-chain",
|
|
22
|
-
"@testing-library/jest-dom/extend-expect"
|
|
23
|
-
],
|
|
24
|
-
"transform": {
|
|
25
|
-
"^.+\\.(js|jsx)$": "babel-jest"
|
|
26
|
-
},
|
|
27
|
-
"testMatch": [
|
|
28
|
-
"**/?(*)+(spec|test).js?(x)"
|
|
29
|
-
],
|
|
30
|
-
"watchPlugins": [
|
|
31
|
-
"jest-watch-typeahead/filename",
|
|
32
|
-
"jest-watch-typeahead/testname"
|
|
33
|
-
],
|
|
34
|
-
"coverageDirectory": "coverage",
|
|
35
|
-
"collectCoverageFrom": [
|
|
36
|
-
"<rootDir>/src/js/**/*.{js,jsx}"
|
|
37
|
-
],
|
|
38
|
-
"coverageReporters": [
|
|
39
|
-
"json",
|
|
40
|
-
"lcov",
|
|
41
|
-
"text-summary",
|
|
42
|
-
"json-summary"
|
|
43
|
-
],
|
|
44
|
-
"reporters": [
|
|
45
|
-
"default",
|
|
46
|
-
[
|
|
47
|
-
"<rootDir>/__tests__/threshold-ratchet.js",
|
|
48
|
-
{
|
|
49
|
-
"tolerance": 5,
|
|
50
|
-
"roundDown": true,
|
|
51
|
-
"configLocation": "<rootDir>/jest.config.json"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
],
|
|
55
|
-
"coverageThreshold": {
|
|
56
|
-
"global": {
|
|
57
|
-
"lines": null,
|
|
58
|
-
"statements": null,
|
|
59
|
-
"functions": null,
|
|
60
|
-
"branches": null,
|
|
61
|
-
"branchesTrue": null
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
package/v2/assets-manifest.json
DELETED
package/v2/index.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><script defer="defer" src="/index.js"></script></head><body><div id="root"></div></body></html>
|