@redsift/design-system-legacy 8.0.1 → 8.0.3
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/package.json +3 -2
- package/dist/package.json +0 -65
- package/rollup.config.js +0 -70
- package/src/components/Alert/Alert.jsx +0 -94
- package/src/components/Alert/index.ts +0 -1
- package/src/components/Alert/readme.md +0 -114
- package/src/components/Button/Button.jsx +0 -161
- package/src/components/Button/index.ts +0 -1
- package/src/components/Button/readme.md +0 -173
- package/src/components/Card/Card.jsx +0 -34
- package/src/components/Card/index.ts +0 -1
- package/src/components/Card/readme.md +0 -54
- package/src/components/CardHeader/CardHeader.jsx +0 -40
- package/src/components/CardHeader/index.ts +0 -1
- package/src/components/Checkbox/Checkbox.jsx +0 -123
- package/src/components/Checkbox/index.ts +0 -1
- package/src/components/Checkbox/readme.md +0 -54
- package/src/components/CheckboxTree/CheckboxTree.jsx +0 -167
- package/src/components/CheckboxTree/CheckboxTree.styles.ts +0 -49
- package/src/components/CheckboxTree/index.ts +0 -1
- package/src/components/CheckboxTree/readme.md +0 -60
- package/src/components/IconContainer/IconContainer.jsx +0 -51
- package/src/components/IconContainer/index.ts +0 -1
- package/src/components/Input/Input.jsx +0 -27
- package/src/components/Input/OutlineInput/OutlineInput.jsx +0 -188
- package/src/components/Input/RegularInput/RegularInput.jsx +0 -55
- package/src/components/Input/RegularInput/RegularInput.styles.ts +0 -98
- package/src/components/Input/index.ts +0 -1
- package/src/components/Input/readme.md +0 -82
- package/src/components/Pagination/Pagination.jsx +0 -111
- package/src/components/Pagination/index.ts +0 -1
- package/src/components/Pagination/readme.md +0 -34
- package/src/components/Radio/Radio.jsx +0 -121
- package/src/components/Radio/index.ts +0 -1
- package/src/components/Radio/readme.md +0 -90
- package/src/components/Select/Select.jsx +0 -360
- package/src/components/Select/SelectComponents.jsx +0 -342
- package/src/components/Select/index.ts +0 -1
- package/src/components/Select/readme.md +0 -2507
- package/src/components/Switch/Switch.jsx +0 -130
- package/src/components/Switch/index.ts +0 -1
- package/src/components/Switch/readme.md +0 -55
- package/src/components/Table/ExportCSVButton.jsx +0 -34
- package/src/components/Table/Table.jsx +0 -872
- package/src/components/Table/TableComponents.jsx +0 -239
- package/src/components/Table/TableFilters.jsx +0 -23
- package/src/components/Table/TableStyles.jsx +0 -514
- package/src/components/Table/index.ts +0 -1
- package/src/components/Table/readme.md +0 -2190
- package/src/components/Tabs/Tabs.jsx +0 -116
- package/src/components/Tabs/TabsComponents.jsx +0 -124
- package/src/components/Tabs/index.ts +0 -1
- package/src/components/Tabs/readme.md +0 -171
- package/src/components/Typography/Typography.jsx +0 -77
- package/src/components/Typography/index.ts +0 -1
- package/src/components/Typography/readme.md +0 -88
- package/src/components/icons/ActionsIcon.jsx +0 -24
- package/src/components/icons/AddIcon.jsx +0 -8
- package/src/components/icons/Arrow.jsx +0 -39
- package/src/components/icons/ArrowDown.jsx +0 -8
- package/src/components/icons/ArrowIcon.jsx +0 -25
- package/src/components/icons/ArrowUp.jsx +0 -8
- package/src/components/icons/BarchartHorizontal.jsx +0 -18
- package/src/components/icons/BellIcon.jsx +0 -19
- package/src/components/icons/BimiSetupIcon.jsx +0 -25
- package/src/components/icons/Chevron.jsx +0 -42
- package/src/components/icons/ChevronLeft.jsx +0 -8
- package/src/components/icons/ChevronRight.jsx +0 -8
- package/src/components/icons/ClearIcon.jsx +0 -8
- package/src/components/icons/Cloud.jsx +0 -34
- package/src/components/icons/Cross.jsx +0 -25
- package/src/components/icons/DeleteIcon.jsx +0 -19
- package/src/components/icons/DynamicDmarcIcon.jsx +0 -43
- package/src/components/icons/EditOutline.jsx +0 -8
- package/src/components/icons/Email.jsx +0 -68
- package/src/components/icons/EmailSourcesIcon.jsx +0 -36
- package/src/components/icons/ExpandLayoutIcon.jsx +0 -38
- package/src/components/icons/ExportIcon.jsx +0 -7
- package/src/components/icons/Eye.jsx +0 -28
- package/src/components/icons/Facebook.jsx +0 -31
- package/src/components/icons/FilterList.jsx +0 -8
- package/src/components/icons/FindOutHowIcon.jsx +0 -49
- package/src/components/icons/FlatArrow.jsx +0 -33
- package/src/components/icons/ForwardArrowIcon.jsx +0 -54
- package/src/components/icons/Github.jsx +0 -41
- package/src/components/icons/Globe.jsx +0 -29
- package/src/components/icons/Hand.jsx +0 -21
- package/src/components/icons/InfinityLoop.jsx +0 -22
- package/src/components/icons/InfinityLoopBreak.jsx +0 -35
- package/src/components/icons/IngrainIcon.jsx +0 -33
- package/src/components/icons/LanguageIcon.jsx +0 -44
- package/src/components/icons/Linkedin.jsx +0 -37
- package/src/components/icons/LocationPin.jsx +0 -34
- package/src/components/icons/MicrosoftShield.jsx +0 -44
- package/src/components/icons/News.jsx +0 -65
- package/src/components/icons/Nodes.jsx +0 -17
- package/src/components/icons/OnDmarcIcon.jsx +0 -29
- package/src/components/icons/OnDmarcLogo.jsx +0 -74
- package/src/components/icons/OnDomainIcon.jsx +0 -27
- package/src/components/icons/OnInboxIcon.jsx +0 -42
- package/src/components/icons/OnInboxLogo.jsx +0 -97
- package/src/components/icons/OnInboxManagerIcon.jsx +0 -46
- package/src/components/icons/OpenInNewTabIcon.jsx +0 -28
- package/src/components/icons/Padlock.jsx +0 -37
- package/src/components/icons/PlusIcon.jsx +0 -16
- package/src/components/icons/Question.jsx +0 -19
- package/src/components/icons/Recruiting.jsx +0 -34
- package/src/components/icons/ReportsIcon.jsx +0 -25
- package/src/components/icons/SearchIcon.jsx +0 -7
- package/src/components/icons/Shield.jsx +0 -17
- package/src/components/icons/ShieldPassIcon.jsx +0 -23
- package/src/components/icons/ShieldSolid.jsx +0 -33
- package/src/components/icons/ShieldWarningIcon.jsx +0 -40
- package/src/components/icons/ShieldWarningInvertedIcon.jsx +0 -36
- package/src/components/icons/Spinner.jsx +0 -100
- package/src/components/icons/Team.jsx +0 -164
- package/src/components/icons/ThreeDotsIcon.jsx +0 -18
- package/src/components/icons/Thumb.jsx +0 -17
- package/src/components/icons/Traffic.jsx +0 -22
- package/src/components/icons/Twitter.jsx +0 -47
- package/src/components/icons/Upload.jsx +0 -12
- package/src/components/icons/VerticalDots.jsx +0 -28
- package/src/components/icons/Warning.jsx +0 -36
- package/src/components/icons/WarningTriangle.jsx +0 -44
- package/src/components/icons/Youtube.jsx +0 -28
- package/src/components/icons/index.ts +0 -69
- package/src/hooks/useDebouncedValue.jsx +0 -19
- package/src/hooks/useFetch.jsx +0 -26
- package/src/hooks/useIsMobile.jsx +0 -25
- package/src/hooks/useOnClickOutside.jsx +0 -14
- package/src/hooks/useToggle.jsx +0 -8
- package/src/index.ts +0 -23
- package/tsconfig.json +0 -3
- /package/{dist/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/index.js.map → index.js.map} +0 -0
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prepare": "install-peers || exit 0",
|
|
12
12
|
"prepublishOnly": "yarn build"
|
|
13
13
|
},
|
|
14
|
-
"version": "8.0.
|
|
14
|
+
"version": "8.0.3",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"classnames": "^2.3.1",
|
|
17
17
|
"match-sorter": "^6.3.1",
|
|
@@ -61,5 +61,6 @@
|
|
|
61
61
|
"react": "17 || 18",
|
|
62
62
|
"react-dom": "17 || 18",
|
|
63
63
|
"styled-components": "^5.3.5"
|
|
64
|
-
}
|
|
64
|
+
},
|
|
65
|
+
"gitHead": "26fbb2d534df48d7618fe6bf8f60eb4b0bf736b1"
|
|
65
66
|
}
|
package/dist/package.json
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@redsift/design-system-legacy",
|
|
3
|
-
"publishConfig": {
|
|
4
|
-
"directory": "dist"
|
|
5
|
-
},
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"module": "index.js",
|
|
8
|
-
"sideEffects": false,
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "rollup -c",
|
|
11
|
-
"prepare": "install-peers || exit 0",
|
|
12
|
-
"prepublishOnly": "yarn build"
|
|
13
|
-
},
|
|
14
|
-
"version": "8.0.1",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"classnames": "^2.3.1",
|
|
17
|
-
"match-sorter": "^6.3.1",
|
|
18
|
-
"prop-types": "^15.8.1",
|
|
19
|
-
"react-csv": "^2.2.2",
|
|
20
|
-
"react-table": "^7.7.0",
|
|
21
|
-
"react-window": "^1.8.6",
|
|
22
|
-
"simplebar": "^5.3.4",
|
|
23
|
-
"simplebar-react": "^2.3.6"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@babel/core": "^7.8.3",
|
|
27
|
-
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
28
|
-
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
29
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
|
|
30
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
|
|
31
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
32
|
-
"@babel/plugin-proposal-private-methods": "^7.16.11",
|
|
33
|
-
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
|
|
34
|
-
"@babel/preset-env": "^7.17.10",
|
|
35
|
-
"@babel/preset-react": "^7.17.12",
|
|
36
|
-
"@babel/preset-typescript": "^7.16.7",
|
|
37
|
-
"@rollup/plugin-babel": "^6.0.2",
|
|
38
|
-
"@rollup/plugin-commonjs": "^24.0.0",
|
|
39
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
40
|
-
"@svgr/rollup": "^6.2.1",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
42
|
-
"@typescript-eslint/parser": "^5.26.0",
|
|
43
|
-
"autoprefixer": "^9.7.4",
|
|
44
|
-
"babel-plugin-require-context-hook": "^1.0.0",
|
|
45
|
-
"dts-bundle-generator": "^7.1.0",
|
|
46
|
-
"identity-obj-proxy": "^3.0.0",
|
|
47
|
-
"install-peers-cli": "^2.2.0",
|
|
48
|
-
"postcss-flexbox-unboxer": "^1.0.0",
|
|
49
|
-
"postcss-hover-media-feature": "^1.0.2",
|
|
50
|
-
"react": "18.2.0",
|
|
51
|
-
"react-dom": "18.2.0",
|
|
52
|
-
"rollup": "^2.72.1",
|
|
53
|
-
"rollup-plugin-analyzer": "^4.0.0",
|
|
54
|
-
"rollup-plugin-auto-external": "^2.0.0",
|
|
55
|
-
"rollup-plugin-cleaner": "^1.0.0",
|
|
56
|
-
"rollup-plugin-copy": "^3.4.0",
|
|
57
|
-
"rollup-plugin-ts-paths-resolve": "^1.7.1",
|
|
58
|
-
"rollup-plugin-typescript-paths": "^1.3.1"
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"react": "17 || 18",
|
|
62
|
-
"react-dom": "17 || 18",
|
|
63
|
-
"styled-components": "^5.3.5"
|
|
64
|
-
}
|
|
65
|
-
}
|
package/rollup.config.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { babel } from '@rollup/plugin-babel';
|
|
2
|
-
import analyze from 'rollup-plugin-analyzer';
|
|
3
|
-
import autoExternal from 'rollup-plugin-auto-external';
|
|
4
|
-
import cleaner from 'rollup-plugin-cleaner';
|
|
5
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
-
import copy from 'rollup-plugin-copy';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
9
|
-
import svgr from '@svgr/rollup';
|
|
10
|
-
import tsPathsResolve from 'rollup-plugin-ts-paths-resolve';
|
|
11
|
-
|
|
12
|
-
import pkg from './package.json';
|
|
13
|
-
const BABEL_CONFIG = require('../../babel.config');
|
|
14
|
-
|
|
15
|
-
const ROOT_PATH = path.resolve(__dirname, '..', '..');
|
|
16
|
-
const DIST_PATH = path.resolve(__dirname, pkg.publishConfig.directory);
|
|
17
|
-
export const extensions = ['.js', '.jsx', '.ts', '.tsx'];
|
|
18
|
-
|
|
19
|
-
const input = Object.fromEntries([
|
|
20
|
-
['index', 'src/index.ts'],
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
input,
|
|
25
|
-
output: {
|
|
26
|
-
format: 'esm',
|
|
27
|
-
sourcemap: true,
|
|
28
|
-
hoistTransitiveImports: false,
|
|
29
|
-
dir: DIST_PATH,
|
|
30
|
-
// Unnamed chunk moved to `_internal` folder
|
|
31
|
-
chunkFileNames: '_internal/[name].js',
|
|
32
|
-
},
|
|
33
|
-
plugins: [
|
|
34
|
-
/** Clean dist dir */
|
|
35
|
-
cleaner({ targets: [DIST_PATH] }),
|
|
36
|
-
/** Externalize dependencies */
|
|
37
|
-
autoExternal(),
|
|
38
|
-
/** Analyze created bundle */
|
|
39
|
-
analyze(),
|
|
40
|
-
/** Resolve tsconfig paths. */
|
|
41
|
-
tsPathsResolve(),
|
|
42
|
-
/** Resolve source files */
|
|
43
|
-
resolve({ browser: true, extensions }),
|
|
44
|
-
/** Resolve commonjs dependencies */
|
|
45
|
-
commonjs({ include: /node_modules/ }),
|
|
46
|
-
/** Handle SVG */
|
|
47
|
-
svgr(),
|
|
48
|
-
/** Transpile JS/TS */
|
|
49
|
-
babel({
|
|
50
|
-
babelHelpers: 'bundled',
|
|
51
|
-
extensions,
|
|
52
|
-
exclude: /node_modules/,
|
|
53
|
-
plugins: BABEL_CONFIG.plugins,
|
|
54
|
-
presets: [
|
|
55
|
-
['@babel/preset-env', { targets: 'defaults' }],
|
|
56
|
-
'@babel/preset-react',
|
|
57
|
-
'@babel/preset-typescript'
|
|
58
|
-
],
|
|
59
|
-
}),
|
|
60
|
-
/** Copy additional files to dist */
|
|
61
|
-
copy({
|
|
62
|
-
targets: [
|
|
63
|
-
{ src: path.join(ROOT_PATH, 'CONTRIBUTING.md'), dest: DIST_PATH },
|
|
64
|
-
{ src: path.join(ROOT_PATH, 'LICENSE.md'), dest: DIST_PATH },
|
|
65
|
-
{ src: path.join(__dirname, 'README.md'), dest: DIST_PATH },
|
|
66
|
-
{ src: path.join(__dirname, 'package.json'), dest: DIST_PATH },
|
|
67
|
-
],
|
|
68
|
-
}),
|
|
69
|
-
],
|
|
70
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
|
|
5
|
-
import { Button } from '../Button';
|
|
6
|
-
import { Typography } from '../Typography';
|
|
7
|
-
import { WarningTriangle, Cross } from '../icons';
|
|
8
|
-
|
|
9
|
-
const kindToColor = {
|
|
10
|
-
success: "#e0ffe2",
|
|
11
|
-
info: "#dbf1ff",
|
|
12
|
-
warning: "#fff6dd",
|
|
13
|
-
danger: "#ffe3e0",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const kindToCornerColor = {
|
|
17
|
-
warning: "#FCBB54",
|
|
18
|
-
danger: "#E06354",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const AlertContainer = styled.div`
|
|
22
|
-
position: relative;
|
|
23
|
-
padding: 1.5em 3em;
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: row;
|
|
26
|
-
background-color: ${(props) => kindToColor[props.type]};
|
|
27
|
-
justify-content: space-between;
|
|
28
|
-
${(props) => (props.fluid ? "width: 100%;" : "")}
|
|
29
|
-
align-items: ${(props) => (props.simple ? "center" : "flex-start")};
|
|
30
|
-
> button {
|
|
31
|
-
align-self: ${(props) => (props.simple ? "center" : "flex-start")};
|
|
32
|
-
}
|
|
33
|
-
line-height: 1.3em;
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
const Title = styled(Typography)`
|
|
37
|
-
font-family: Raleway;
|
|
38
|
-
margin-bottom: 0.5em;
|
|
39
|
-
font-weight: 600;
|
|
40
|
-
font-size: 1.12em;
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
const Content = styled(Typography)`
|
|
44
|
-
color: #333;
|
|
45
|
-
font-weight: medium;
|
|
46
|
-
> p {
|
|
47
|
-
margin-bottom: 0;
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
const CloseButton = styled(Button)`
|
|
52
|
-
${(props) =>
|
|
53
|
-
props.simple
|
|
54
|
-
? "margin: 0 -2em 0 2em;"
|
|
55
|
-
: `
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: .75em;
|
|
58
|
-
right: .5em;
|
|
59
|
-
`}
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
const WarningContainer = styled.div`
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: 0;
|
|
65
|
-
left: 0;
|
|
66
|
-
padding: 0.5em 0.75em 0.75em 0.5em;
|
|
67
|
-
border-radius: 0 0 3.5em 0;
|
|
68
|
-
background-color: ${(props) => props.color};
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
export const Alert = ({ children, type = "info", fluid, title, onClose, ...rest }) => (
|
|
72
|
-
<AlertContainer
|
|
73
|
-
type={type}
|
|
74
|
-
simple={!title}
|
|
75
|
-
fluid={fluid}
|
|
76
|
-
role="alert"
|
|
77
|
-
{...rest}
|
|
78
|
-
>
|
|
79
|
-
<div>
|
|
80
|
-
{kindToCornerColor[type] && (
|
|
81
|
-
<WarningContainer color={kindToCornerColor[type]}>
|
|
82
|
-
<WarningTriangle fill="#FFF" fillBar width={20} />
|
|
83
|
-
</WarningContainer>
|
|
84
|
-
)}
|
|
85
|
-
{title && <Title>{title}</Title>}
|
|
86
|
-
<Content>{children}</Content>
|
|
87
|
-
</div>
|
|
88
|
-
{onClose && (
|
|
89
|
-
<CloseButton flatIcon simple={!title} onClick={onClose}>
|
|
90
|
-
<Cross title="dismiss" width={title ? 10 : 12} />
|
|
91
|
-
</CloseButton>
|
|
92
|
-
)}
|
|
93
|
-
</AlertContainer>
|
|
94
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Alert';
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
### Accessibility
|
|
2
|
-
|
|
3
|
-
- Ensure both the label and id props are completed
|
|
4
|
-
|
|
5
|
-
### Props
|
|
6
|
-
|
|
7
|
-
| Prop | Default | Options |
|
|
8
|
-
| :---------: | :-----: | -----------------------------------------------: |
|
|
9
|
-
| children | | string or text react component **Required** |
|
|
10
|
-
| title | | string |
|
|
11
|
-
| type | "info" | "success" | "info" | "warning" | "danger" |
|
|
12
|
-
| fluid | | boolean |
|
|
13
|
-
| onClose | | () => void |
|
|
14
|
-
| ...rest | | |
|
|
15
|
-
|
|
16
|
-
### Examples
|
|
17
|
-
|
|
18
|
-
Simple alerts
|
|
19
|
-
```jsx
|
|
20
|
-
<div
|
|
21
|
-
style={{
|
|
22
|
-
display: "flex",
|
|
23
|
-
flexWrap: "wrap",
|
|
24
|
-
flexDirection: "row",
|
|
25
|
-
alignItems: "center",
|
|
26
|
-
justifyContent: "space-evenly"
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
<Alert>
|
|
30
|
-
Simple alert (only children)!
|
|
31
|
-
</Alert>
|
|
32
|
-
<Alert onClose={() => alert('onClose triggered')}>
|
|
33
|
-
Simple alert (only children) that can be closed
|
|
34
|
-
</Alert>
|
|
35
|
-
</div>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
With title and description
|
|
39
|
-
```jsx
|
|
40
|
-
<div
|
|
41
|
-
style={{
|
|
42
|
-
display: "flex",
|
|
43
|
-
flexWrap: "wrap",
|
|
44
|
-
flexDirection: "row",
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
justifyContent: "space-evenly"
|
|
47
|
-
}}
|
|
48
|
-
>
|
|
49
|
-
<Alert title="Not so simple">
|
|
50
|
-
Simple alert (only children)!
|
|
51
|
-
</Alert>
|
|
52
|
-
<Alert
|
|
53
|
-
title="Still not so simple"
|
|
54
|
-
onClose={() => alert('onClose triggered')}
|
|
55
|
-
>
|
|
56
|
-
Simple alert (only children) that can be closed
|
|
57
|
-
</Alert>
|
|
58
|
-
</div>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Fluid
|
|
62
|
-
```jsx
|
|
63
|
-
<div
|
|
64
|
-
style={{
|
|
65
|
-
display: "flex",
|
|
66
|
-
flexWrap: "wrap",
|
|
67
|
-
flexDirection: "row",
|
|
68
|
-
alignItems: "center",
|
|
69
|
-
justifyContent: "space-evenly"
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<Alert title="Not so simple" fluid>
|
|
73
|
-
Lorem ipsum dolor sit amet
|
|
74
|
-
</Alert>
|
|
75
|
-
<br/>
|
|
76
|
-
<Alert
|
|
77
|
-
title="Still not so simple"
|
|
78
|
-
onClose={() => alert('onClose triggered')}
|
|
79
|
-
fluid
|
|
80
|
-
>
|
|
81
|
-
Lorem ispum dolor sit amet
|
|
82
|
-
</Alert>
|
|
83
|
-
</div>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Variants
|
|
87
|
-
```jsx
|
|
88
|
-
<div
|
|
89
|
-
style={{
|
|
90
|
-
display: "flex",
|
|
91
|
-
flexWrap: "wrap",
|
|
92
|
-
flexDirection: "column",
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
<Alert type="success" title="Success [type='success', title=...]">
|
|
96
|
-
type="success"
|
|
97
|
-
</Alert>
|
|
98
|
-
<br/>
|
|
99
|
-
<Alert type="info" title="[type='info', title=..., onClose={...}]" onClose={() => {}}>
|
|
100
|
-
type="info"
|
|
101
|
-
</Alert>
|
|
102
|
-
<br/>
|
|
103
|
-
<Alert type="warning" title="Caution! [type='warning', title=...., onClose={...}]" onClose={() => {}}>
|
|
104
|
-
Damn gerbils have stopped running again! Someone has been dispatched to poke them with a sharp stick.
|
|
105
|
-
</Alert>
|
|
106
|
-
<br/>
|
|
107
|
-
<Alert type="danger" title="Whoops! something went wrong [type='danger', title=...]">
|
|
108
|
-
The application has encountered an unknown error.
|
|
109
|
-
It doesn't appear to have affected your data, but our technical staff have been automatically notified and will be
|
|
110
|
-
looking into this with the utmost urgency.
|
|
111
|
-
</Alert>
|
|
112
|
-
</div>
|
|
113
|
-
```
|
|
114
|
-
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
2
|
-
import styled, { keyframes } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
const spin = keyframes`
|
|
5
|
-
to {
|
|
6
|
-
transform: rotate(360deg);
|
|
7
|
-
}
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
const Loader = styled.div`
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: calc(50% - 10px);
|
|
13
|
-
left: calc(50% - 10px);
|
|
14
|
-
border: 3px solid rgba(255, 255, 255, 0.1);
|
|
15
|
-
border-top-color: ${(props) => props.color || "#fff"};
|
|
16
|
-
border-radius: 50%;
|
|
17
|
-
width: 1.1em;
|
|
18
|
-
height: 1.1em;
|
|
19
|
-
animation: ${spin} 1s linear infinite;
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
const BaseButton = styled.button`
|
|
23
|
-
position: relative;
|
|
24
|
-
font-size: 0.875rem;
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
font-family: Raleway, sans-serif;
|
|
27
|
-
user-select: none;
|
|
28
|
-
border-radius: 4px;
|
|
29
|
-
padding: 0px 16px;
|
|
30
|
-
height: 40px;
|
|
31
|
-
vertical-align: middle;
|
|
32
|
-
font-weight: 500;
|
|
33
|
-
transition: background-color 0.2s ease;
|
|
34
|
-
text-decoration: none;
|
|
35
|
-
text-align: center;
|
|
36
|
-
outline: 0;
|
|
37
|
-
border-width: 0;
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
&:disabled {
|
|
40
|
-
color: rgba(0, 0, 0, 0.26);
|
|
41
|
-
cursor: default;
|
|
42
|
-
}
|
|
43
|
-
&:disabled:hover {
|
|
44
|
-
background-color: transparent;
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
const FlatButton = styled(BaseButton)`
|
|
49
|
-
color: ${(props) => props.color || ""};
|
|
50
|
-
&:hover {
|
|
51
|
-
background-color: ${(props) => props.hoverColor || ""};
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
const IconButton = styled(BaseButton)`
|
|
56
|
-
align-self: center;
|
|
57
|
-
padding: 0px;
|
|
58
|
-
margin: 0px 5px;
|
|
59
|
-
height: unset;
|
|
60
|
-
`;
|
|
61
|
-
|
|
62
|
-
const OutlinedButton = styled(BaseButton)`
|
|
63
|
-
border-style: solid;
|
|
64
|
-
border-width: 1px;
|
|
65
|
-
border-color: ${(props) => props.color || ""};
|
|
66
|
-
color: ${(props) => props.color || ""};
|
|
67
|
-
&:hover {
|
|
68
|
-
background-color: ${(props) => props.hoverColor || ""};
|
|
69
|
-
}
|
|
70
|
-
&:disabled {
|
|
71
|
-
border-color: rgba(0, 0, 0, 0.12);
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
const DefaultButton = styled(BaseButton)`
|
|
76
|
-
color: #fff;
|
|
77
|
-
background-color: ${(props) => props.color || ""};
|
|
78
|
-
&:hover {
|
|
79
|
-
background-color: ${(props) => props.hoverColor || props.color || ""};
|
|
80
|
-
}
|
|
81
|
-
&:disabled {
|
|
82
|
-
background-color: rgba(0, 0, 0, 0.12);
|
|
83
|
-
}
|
|
84
|
-
&:disabled:hover {
|
|
85
|
-
background-color: rgba(0, 0, 0, 0.12);
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
const RaisedButton = styled(DefaultButton)`
|
|
90
|
-
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2),
|
|
91
|
-
0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12);
|
|
92
|
-
&:disabled {
|
|
93
|
-
box-shadow: none;
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
|
|
97
|
-
export const Button = (props) => {
|
|
98
|
-
const {
|
|
99
|
-
isLoading,
|
|
100
|
-
children,
|
|
101
|
-
color,
|
|
102
|
-
hoverColor,
|
|
103
|
-
flat,
|
|
104
|
-
flatIcon,
|
|
105
|
-
raised,
|
|
106
|
-
outlined,
|
|
107
|
-
loaderStyles,
|
|
108
|
-
danger,
|
|
109
|
-
white,
|
|
110
|
-
onClick,
|
|
111
|
-
type = "button",
|
|
112
|
-
...rest
|
|
113
|
-
} = props;
|
|
114
|
-
|
|
115
|
-
const Component = flat
|
|
116
|
-
? FlatButton
|
|
117
|
-
: outlined
|
|
118
|
-
? OutlinedButton
|
|
119
|
-
: flatIcon
|
|
120
|
-
? IconButton
|
|
121
|
-
: raised
|
|
122
|
-
? RaisedButton
|
|
123
|
-
: DefaultButton;
|
|
124
|
-
|
|
125
|
-
const buttonColor =
|
|
126
|
-
"color" in props ? color : danger ? "#e06354" : white ? "#fff" : "";
|
|
127
|
-
|
|
128
|
-
const buttonHoverColor =
|
|
129
|
-
"hoverColor" in props
|
|
130
|
-
? hoverColor
|
|
131
|
-
: danger
|
|
132
|
-
? !flat && !outlined
|
|
133
|
-
? "#c23324"
|
|
134
|
-
: "rgba(224, 99, 84, 0.1)"
|
|
135
|
-
: white
|
|
136
|
-
? !flat && !outlined
|
|
137
|
-
? "#f2f2f2"
|
|
138
|
-
: "rgba(255, 255, 255, 0.2)"
|
|
139
|
-
: "";
|
|
140
|
-
|
|
141
|
-
const loaderColor = !flat && !outlined ? "#fff" : buttonColor;
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<Component
|
|
145
|
-
color={buttonColor}
|
|
146
|
-
hoverColor={buttonHoverColor}
|
|
147
|
-
onClick={!isLoading ? onClick : null}
|
|
148
|
-
type={type}
|
|
149
|
-
{...rest}
|
|
150
|
-
>
|
|
151
|
-
{isLoading ? (
|
|
152
|
-
<Fragment>
|
|
153
|
-
<Loader color={loaderColor} style={{ loaderStyles }} />
|
|
154
|
-
<div style={{ visibility: "hidden" }}>{children}</div>
|
|
155
|
-
</Fragment>
|
|
156
|
-
) : (
|
|
157
|
-
children
|
|
158
|
-
)}
|
|
159
|
-
</Component>
|
|
160
|
-
);
|
|
161
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Button';
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
### Accessibility
|
|
2
|
-
|
|
3
|
-
- Anything clickable must be wrapped in a `<Button>`, `<a>` or `<input>` tag. `<div>`'s should not have onClicks
|
|
4
|
-
- Icon Buttons (buttons that do not have any text) must have an `aria-label`
|
|
5
|
-
|
|
6
|
-
### Props
|
|
7
|
-
|
|
8
|
-
| Prop | Default | Options |
|
|
9
|
-
| :----------: | :-----: | ---------------------------------------------------------------------------------------------------------------------------------: |
|
|
10
|
-
| isLoading | false | If true, shows loader spinner and disables the onClick event |
|
|
11
|
-
| color | | Colors |
|
|
12
|
-
| hoverColor | | Colors |
|
|
13
|
-
| loaderStyles | | inline Styles |
|
|
14
|
-
| disabled | false | Boolean |
|
|
15
|
-
| flat | false | Boolean |
|
|
16
|
-
| flatIcon | false | If true, changes styles to a button style suitable for icons (no text content). Ensure `aria-label` and `title` props are provided |
|
|
17
|
-
| outlined | false | Boolean |
|
|
18
|
-
| raised | false | Boolean |
|
|
19
|
-
| danger | false | Boolean |
|
|
20
|
-
| white | false | Boolean |
|
|
21
|
-
| onClick | | Function |
|
|
22
|
-
| children | | |
|
|
23
|
-
| ...rest | | |
|
|
24
|
-
|
|
25
|
-
### Examples
|
|
26
|
-
|
|
27
|
-
App Examples
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
<div>
|
|
31
|
-
<div
|
|
32
|
-
style={{
|
|
33
|
-
display: 'flex',
|
|
34
|
-
flexWrap: 'wrap',
|
|
35
|
-
flexDirection: 'row',
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
justifyContent: 'space-evenly',
|
|
38
|
-
marginBottom: '10px',
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
<Button color="#02ac61" hoverColor="#029756">
|
|
42
|
-
Default
|
|
43
|
-
</Button>
|
|
44
|
-
<Button raised color="#02ac61" hoverColor="#029756">
|
|
45
|
-
Raised
|
|
46
|
-
</Button>
|
|
47
|
-
<Button outlined color="#02ac61" hoverColor="rgba(2, 172, 97, 0.1)">
|
|
48
|
-
Outlined
|
|
49
|
-
</Button>
|
|
50
|
-
<Button flat color="#02ac61" hoverColor="rgba(2, 172, 97, 0.1)">
|
|
51
|
-
Flat
|
|
52
|
-
</Button>
|
|
53
|
-
</div>
|
|
54
|
-
<div
|
|
55
|
-
style={{
|
|
56
|
-
display: 'flex',
|
|
57
|
-
flexWrap: 'wrap',
|
|
58
|
-
flexDirection: 'row',
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
justifyContent: 'space-evenly',
|
|
61
|
-
marginBottom: '10px',
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
<Button color="#33b222" hoverColor="#2b961d">
|
|
65
|
-
Default
|
|
66
|
-
</Button>
|
|
67
|
-
<Button raised color="#33b222" hoverColor="#2b961d">
|
|
68
|
-
Raised
|
|
69
|
-
</Button>
|
|
70
|
-
<Button outlined color="#33b222" hoverColor="rgba(51, 187, 34, 0.1)">
|
|
71
|
-
Outlined
|
|
72
|
-
</Button>
|
|
73
|
-
<Button flat color="#33b222" hoverColor="rgba(51, 187, 34, 0.1)">
|
|
74
|
-
Flat
|
|
75
|
-
</Button>
|
|
76
|
-
</div>
|
|
77
|
-
<div
|
|
78
|
-
style={{
|
|
79
|
-
display: 'flex',
|
|
80
|
-
flexWrap: 'wrap',
|
|
81
|
-
flexDirection: 'row',
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
justifyContent: 'space-evenly',
|
|
84
|
-
marginBottom: '10px',
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
<Button color="#53C3EB" hoverColor="#1bafe4">
|
|
88
|
-
Default
|
|
89
|
-
</Button>
|
|
90
|
-
<Button raised color="#53C3EB" hoverColor="#1bafe4">
|
|
91
|
-
Raised
|
|
92
|
-
</Button>
|
|
93
|
-
<Button outlined color="#53C3EB" hoverColor="rgba(83, 195, 235, 0.1)">
|
|
94
|
-
Outlined
|
|
95
|
-
</Button>
|
|
96
|
-
<Button flat color="#53C3EB" hoverColor="rgba(83, 195, 235, 0.1)">
|
|
97
|
-
Flat
|
|
98
|
-
</Button>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
More Examples
|
|
104
|
-
|
|
105
|
-
```js
|
|
106
|
-
<div
|
|
107
|
-
style={{
|
|
108
|
-
display: "flex",
|
|
109
|
-
flexWrap: "wrap",
|
|
110
|
-
flexDirection: "row",
|
|
111
|
-
alignItems: "center",
|
|
112
|
-
justifyContent: "space-evenly"
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
<Button disabled color="green" hoverColor="#CCC">
|
|
116
|
-
Disabled
|
|
117
|
-
</Button>
|
|
118
|
-
<Button disabled outlined color="green" hoverColor="#CCC">
|
|
119
|
-
Disabled
|
|
120
|
-
</Button>
|
|
121
|
-
<Button flat disabled color="green" hoverColor="#CCC">
|
|
122
|
-
Disabled
|
|
123
|
-
</Button>
|
|
124
|
-
<Button danger>
|
|
125
|
-
Danger
|
|
126
|
-
</Button>
|
|
127
|
-
<Button outlined danger>
|
|
128
|
-
Danger
|
|
129
|
-
</Button>
|
|
130
|
-
<Button flat danger>
|
|
131
|
-
Danger
|
|
132
|
-
</Button>
|
|
133
|
-
<Button isLoading color="#33b222" hoverColor="#2b961d">
|
|
134
|
-
Button
|
|
135
|
-
</Button>
|
|
136
|
-
<Button isLoading outlined color="#33b222" hoverColor="rgba(51, 187, 34, 0.1)">
|
|
137
|
-
Button
|
|
138
|
-
</Button>
|
|
139
|
-
<Button isLoading flat color="#33b222" hoverColor="rgba(51, 187, 34, 0.1)">
|
|
140
|
-
Button
|
|
141
|
-
</Button>
|
|
142
|
-
</div>
|
|
143
|
-
<div
|
|
144
|
-
style={{
|
|
145
|
-
display: "flex",
|
|
146
|
-
flexWrap: "wrap",
|
|
147
|
-
flexDirection: "row",
|
|
148
|
-
alignItems: "center",
|
|
149
|
-
justifyContent: "space-evenly"
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
<div style={{ backgroundColor: "#33b222", padding: "3px" }}>
|
|
153
|
-
<Button outlined white>
|
|
154
|
-
White
|
|
155
|
-
</Button>
|
|
156
|
-
<Button flat white>
|
|
157
|
-
White
|
|
158
|
-
</Button>
|
|
159
|
-
</div>
|
|
160
|
-
<Button isLoading color="green" hoverColor="#CCC">
|
|
161
|
-
Custom
|
|
162
|
-
</Button>
|
|
163
|
-
<Button color="green" hoverColor="#CCC" style={{ color: "orange" }}>
|
|
164
|
-
Custom
|
|
165
|
-
</Button>
|
|
166
|
-
<Button color="green" hoverColor="#CCC" style={{ color: "orange", width: '150px' }}>
|
|
167
|
-
Custom
|
|
168
|
-
</Button>
|
|
169
|
-
<Button outlined color="green" hoverColor="#CCC" style={{width: '150px'}}>
|
|
170
|
-
Custom
|
|
171
|
-
</Button>
|
|
172
|
-
</div>
|
|
173
|
-
```
|