@cloudflare/component-button 2.9.55 → 2.9.59
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/CHANGELOG.md +28 -1
- package/es/Button.js +22 -40
- package/lib/Button.js +23 -40
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [2.9.
|
|
6
|
+
## [2.9.59](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-button@2.9.58...@cloudflare/component-button@2.9.59) (2021-09-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @cloudflare/component-button
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [2.9.58](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-button@2.9.57...@cloudflare/component-button@2.9.58) (2021-09-20)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @cloudflare/component-button
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [2.9.57](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-button@2.9.56...@cloudflare/component-button@2.9.57) (2021-09-17)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **component-button:** UI-4634 Add missing style-const package ([414af06](http://stash.cfops.it:7999/fe/stratus/commits/414af06))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [2.9.56](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/component-button@2.9.54...@cloudflare/component-button@2.9.56) (2021-09-15)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @cloudflare/component-button
|
|
9
36
|
|
package/es/Button.js
CHANGED
|
@@ -6,9 +6,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import { isDarkMode } from '@cloudflare/style-const';
|
|
9
10
|
import { createStyledComponent } from '@cloudflare/style-container';
|
|
10
11
|
import { Icon } from '@cloudflare/component-icon';
|
|
11
12
|
|
|
13
|
+
const standardColors = theme => {
|
|
14
|
+
// The button color is white in both dark and light modes.
|
|
15
|
+
const color = isDarkMode() ? theme.colors.black : theme.colors.white;
|
|
16
|
+
return {
|
|
17
|
+
default: theme.colors.gray[1],
|
|
18
|
+
primary: color,
|
|
19
|
+
success: color,
|
|
20
|
+
warning: color,
|
|
21
|
+
danger: color,
|
|
22
|
+
inverted: {
|
|
23
|
+
danger: theme.colors.red[3],
|
|
24
|
+
primary: theme.colors.blue[4]
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
12
29
|
const buttonColors = theme => ({
|
|
13
30
|
// Normal default state colors
|
|
14
31
|
normal: {
|
|
@@ -23,17 +40,7 @@ const buttonColors = theme => ({
|
|
|
23
40
|
primary: 'transparent'
|
|
24
41
|
}
|
|
25
42
|
},
|
|
26
|
-
color:
|
|
27
|
-
default: theme.colors.gray[1],
|
|
28
|
-
primary: theme.colors.white,
|
|
29
|
-
success: theme.colors.white,
|
|
30
|
-
warning: theme.colors.white,
|
|
31
|
-
danger: theme.colors.white,
|
|
32
|
-
inverted: {
|
|
33
|
-
danger: theme.colors.red[3],
|
|
34
|
-
primary: theme.colors.blue[4]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
43
|
+
color: standardColors(theme)
|
|
37
44
|
},
|
|
38
45
|
// Hover
|
|
39
46
|
hover: {
|
|
@@ -48,17 +55,12 @@ const buttonColors = theme => ({
|
|
|
48
55
|
primary: theme.colors.blue[4]
|
|
49
56
|
}
|
|
50
57
|
},
|
|
51
|
-
color: {
|
|
52
|
-
default: theme.colors.gray[1],
|
|
53
|
-
primary: theme.colors.white,
|
|
54
|
-
success: theme.colors.white,
|
|
55
|
-
warning: theme.colors.white,
|
|
56
|
-
danger: theme.colors.white,
|
|
58
|
+
color: _objectSpread({}, standardColors(theme), {
|
|
57
59
|
inverted: {
|
|
58
60
|
danger: theme.colors.white,
|
|
59
61
|
primary: theme.colors.white
|
|
60
62
|
}
|
|
61
|
-
}
|
|
63
|
+
})
|
|
62
64
|
},
|
|
63
65
|
// Active
|
|
64
66
|
active: {
|
|
@@ -73,17 +75,7 @@ const buttonColors = theme => ({
|
|
|
73
75
|
primary: 'transparent'
|
|
74
76
|
}
|
|
75
77
|
},
|
|
76
|
-
color:
|
|
77
|
-
default: theme.colors.gray[1],
|
|
78
|
-
primary: theme.colors.white,
|
|
79
|
-
success: theme.colors.white,
|
|
80
|
-
warning: theme.colors.white,
|
|
81
|
-
danger: theme.colors.white,
|
|
82
|
-
inverted: {
|
|
83
|
-
danger: theme.colors.red[3],
|
|
84
|
-
primary: theme.colors.blue[4]
|
|
85
|
-
}
|
|
86
|
-
}
|
|
78
|
+
color: standardColors(theme)
|
|
87
79
|
},
|
|
88
80
|
// Focus
|
|
89
81
|
focus: {
|
|
@@ -98,17 +90,7 @@ const buttonColors = theme => ({
|
|
|
98
90
|
primary: 'transparent'
|
|
99
91
|
}
|
|
100
92
|
},
|
|
101
|
-
color:
|
|
102
|
-
default: theme.colors.gray[1],
|
|
103
|
-
primary: theme.colors.white,
|
|
104
|
-
success: theme.colors.white,
|
|
105
|
-
warning: theme.colors.white,
|
|
106
|
-
danger: theme.colors.white,
|
|
107
|
-
inverted: {
|
|
108
|
-
danger: theme.colors.red[3],
|
|
109
|
-
primary: theme.colors.blue[4]
|
|
110
|
-
}
|
|
111
|
-
}
|
|
93
|
+
color: standardColors(theme)
|
|
112
94
|
}
|
|
113
95
|
});
|
|
114
96
|
|
package/lib/Button.js
CHANGED
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
+
var _styleConst = require("@cloudflare/style-const");
|
|
13
|
+
|
|
12
14
|
var _styleContainer = require("@cloudflare/style-container");
|
|
13
15
|
|
|
14
16
|
var _componentIcon = require("@cloudflare/component-icon");
|
|
@@ -21,6 +23,22 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
21
23
|
|
|
22
24
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
25
|
|
|
26
|
+
var standardColors = function standardColors(theme) {
|
|
27
|
+
// The button color is white in both dark and light modes.
|
|
28
|
+
var color = (0, _styleConst.isDarkMode)() ? theme.colors.black : theme.colors.white;
|
|
29
|
+
return {
|
|
30
|
+
default: theme.colors.gray[1],
|
|
31
|
+
primary: color,
|
|
32
|
+
success: color,
|
|
33
|
+
warning: color,
|
|
34
|
+
danger: color,
|
|
35
|
+
inverted: {
|
|
36
|
+
danger: theme.colors.red[3],
|
|
37
|
+
primary: theme.colors.blue[4]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
24
42
|
var buttonColors = function buttonColors(theme) {
|
|
25
43
|
return {
|
|
26
44
|
// Normal default state colors
|
|
@@ -36,17 +54,7 @@ var buttonColors = function buttonColors(theme) {
|
|
|
36
54
|
primary: 'transparent'
|
|
37
55
|
}
|
|
38
56
|
},
|
|
39
|
-
color:
|
|
40
|
-
default: theme.colors.gray[1],
|
|
41
|
-
primary: theme.colors.white,
|
|
42
|
-
success: theme.colors.white,
|
|
43
|
-
warning: theme.colors.white,
|
|
44
|
-
danger: theme.colors.white,
|
|
45
|
-
inverted: {
|
|
46
|
-
danger: theme.colors.red[3],
|
|
47
|
-
primary: theme.colors.blue[4]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
57
|
+
color: standardColors(theme)
|
|
50
58
|
},
|
|
51
59
|
// Hover
|
|
52
60
|
hover: {
|
|
@@ -61,17 +69,12 @@ var buttonColors = function buttonColors(theme) {
|
|
|
61
69
|
primary: theme.colors.blue[4]
|
|
62
70
|
}
|
|
63
71
|
},
|
|
64
|
-
color: {
|
|
65
|
-
default: theme.colors.gray[1],
|
|
66
|
-
primary: theme.colors.white,
|
|
67
|
-
success: theme.colors.white,
|
|
68
|
-
warning: theme.colors.white,
|
|
69
|
-
danger: theme.colors.white,
|
|
72
|
+
color: _objectSpread({}, standardColors(theme), {
|
|
70
73
|
inverted: {
|
|
71
74
|
danger: theme.colors.white,
|
|
72
75
|
primary: theme.colors.white
|
|
73
76
|
}
|
|
74
|
-
}
|
|
77
|
+
})
|
|
75
78
|
},
|
|
76
79
|
// Active
|
|
77
80
|
active: {
|
|
@@ -86,17 +89,7 @@ var buttonColors = function buttonColors(theme) {
|
|
|
86
89
|
primary: 'transparent'
|
|
87
90
|
}
|
|
88
91
|
},
|
|
89
|
-
color:
|
|
90
|
-
default: theme.colors.gray[1],
|
|
91
|
-
primary: theme.colors.white,
|
|
92
|
-
success: theme.colors.white,
|
|
93
|
-
warning: theme.colors.white,
|
|
94
|
-
danger: theme.colors.white,
|
|
95
|
-
inverted: {
|
|
96
|
-
danger: theme.colors.red[3],
|
|
97
|
-
primary: theme.colors.blue[4]
|
|
98
|
-
}
|
|
99
|
-
}
|
|
92
|
+
color: standardColors(theme)
|
|
100
93
|
},
|
|
101
94
|
// Focus
|
|
102
95
|
focus: {
|
|
@@ -111,17 +104,7 @@ var buttonColors = function buttonColors(theme) {
|
|
|
111
104
|
primary: 'transparent'
|
|
112
105
|
}
|
|
113
106
|
},
|
|
114
|
-
color:
|
|
115
|
-
default: theme.colors.gray[1],
|
|
116
|
-
primary: theme.colors.white,
|
|
117
|
-
success: theme.colors.white,
|
|
118
|
-
warning: theme.colors.white,
|
|
119
|
-
danger: theme.colors.white,
|
|
120
|
-
inverted: {
|
|
121
|
-
danger: theme.colors.red[3],
|
|
122
|
-
primary: theme.colors.blue[4]
|
|
123
|
-
}
|
|
124
|
-
}
|
|
107
|
+
color: standardColors(theme)
|
|
125
108
|
}
|
|
126
109
|
};
|
|
127
110
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/component-button",
|
|
3
3
|
"description": "Cloudflare Button Component",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.59",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"author": "James Kyle <jkyle@cloudflare.com>",
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@cloudflare/component-icon": "^6.
|
|
16
|
-
"@cloudflare/style-
|
|
15
|
+
"@cloudflare/component-icon": "^6.4.1",
|
|
16
|
+
"@cloudflare/style-const": "^3.0.3",
|
|
17
|
+
"@cloudflare/style-container": "^7.4.1",
|
|
17
18
|
"polished": "^1.9.3",
|
|
18
19
|
"prop-types": "^15.6.0"
|
|
19
20
|
},
|
|
@@ -31,5 +32,5 @@
|
|
|
31
32
|
"test-coverage": "stratus test --coverage",
|
|
32
33
|
"test-watch": "stratus test --watch"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f1bb40a37c71b4a89a644c19d4e581271615871c"
|
|
35
36
|
}
|