@instructure/ui-color-picker 8.33.1 → 8.33.2-snapshot-5
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 +8 -0
- package/es/ColorContrast/ColorContrastLocator.js +3 -3
- package/es/ColorContrast/index.js +15 -34
- package/es/ColorContrast/props.js +1 -0
- package/es/ColorContrast/styles.js +0 -2
- package/es/ColorContrast/theme.js +5 -5
- package/es/ColorIndicator/ColorIndicatorLocator.js +3 -4
- package/es/ColorIndicator/index.js +1 -10
- package/es/ColorIndicator/props.js +1 -0
- package/es/ColorIndicator/styles.js +2 -5
- package/es/ColorIndicator/theme.js +6 -5
- package/es/ColorMixer/ColorMixerLocator.js +2 -7
- package/es/ColorMixer/ColorPalette/index.js +9 -50
- package/es/ColorMixer/ColorPalette/props.js +1 -0
- package/es/ColorMixer/ColorPalette/styles.js +2 -3
- package/es/ColorMixer/ColorPalette/theme.js +6 -5
- package/es/ColorMixer/RGBAInput/index.js +7 -19
- package/es/ColorMixer/RGBAInput/props.js +1 -0
- package/es/ColorMixer/RGBAInput/styles.js +0 -1
- package/es/ColorMixer/RGBAInput/theme.js +3 -3
- package/es/ColorMixer/Slider/index.js +7 -37
- package/es/ColorMixer/Slider/props.js +1 -0
- package/es/ColorMixer/Slider/styles.js +0 -2
- package/es/ColorMixer/Slider/theme.js +6 -5
- package/es/ColorMixer/index.js +25 -34
- package/es/ColorMixer/props.js +1 -0
- package/es/ColorMixer/styles.js +0 -1
- package/es/ColorMixer/utils/shallowCompare.js +1 -2
- package/es/ColorPicker/ColorPickerLocator.js +10 -23
- package/es/ColorPicker/index.js +24 -77
- package/es/ColorPicker/props.js +1 -0
- package/es/ColorPicker/styles.js +4 -5
- package/es/ColorPicker/theme.js +7 -6
- package/es/ColorPreset/ColorPresetLocator.js +7 -10
- package/es/ColorPreset/index.js +4 -28
- package/es/ColorPreset/props.js +1 -0
- package/es/ColorPreset/styles.js +0 -1
- package/es/ColorPreset/theme.js +4 -4
- package/lib/ColorContrast/ColorContrastLocator.js +1 -6
- package/lib/ColorContrast/index.js +14 -47
- package/lib/ColorContrast/props.js +1 -3
- package/lib/ColorContrast/styles.js +0 -3
- package/lib/ColorContrast/theme.js +5 -6
- package/lib/ColorIndicator/ColorIndicatorLocator.js +2 -7
- package/lib/ColorIndicator/index.js +0 -18
- package/lib/ColorIndicator/props.js +1 -3
- package/lib/ColorIndicator/styles.js +2 -6
- package/lib/ColorIndicator/theme.js +6 -7
- package/lib/ColorMixer/ColorMixerLocator.js +3 -11
- package/lib/ColorMixer/ColorPalette/index.js +8 -61
- package/lib/ColorMixer/ColorPalette/props.js +1 -3
- package/lib/ColorMixer/ColorPalette/styles.js +0 -4
- package/lib/ColorMixer/ColorPalette/theme.js +4 -6
- package/lib/ColorMixer/RGBAInput/index.js +6 -29
- package/lib/ColorMixer/RGBAInput/props.js +1 -3
- package/lib/ColorMixer/RGBAInput/styles.js +0 -2
- package/lib/ColorMixer/RGBAInput/theme.js +3 -4
- package/lib/ColorMixer/Slider/index.js +6 -46
- package/lib/ColorMixer/Slider/props.js +1 -3
- package/lib/ColorMixer/Slider/styles.js +0 -3
- package/lib/ColorMixer/Slider/theme.js +4 -6
- package/lib/ColorMixer/index.js +24 -46
- package/lib/ColorMixer/props.js +1 -3
- package/lib/ColorMixer/styles.js +0 -2
- package/lib/ColorMixer/utils/shallowCompare.js +1 -3
- package/lib/ColorPicker/ColorPickerLocator.js +10 -29
- package/lib/ColorPicker/index.js +24 -102
- package/lib/ColorPicker/props.js +1 -3
- package/lib/ColorPicker/styles.js +4 -6
- package/lib/ColorPicker/theme.js +5 -7
- package/lib/ColorPreset/ColorPresetLocator.js +3 -12
- package/lib/ColorPreset/index.js +3 -49
- package/lib/ColorPreset/props.js +1 -3
- package/lib/ColorPreset/styles.js +0 -2
- package/lib/ColorPreset/theme.js +4 -5
- package/lib/index.js +0 -5
- package/package.json +25 -25
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,40 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.ColorContrast = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
|
-
|
|
16
11
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
17
|
-
|
|
18
12
|
var _console = require("@instructure/console");
|
|
19
|
-
|
|
20
13
|
var _contrast = require("@instructure/ui-color-utils/lib/contrast.js");
|
|
21
|
-
|
|
22
14
|
var _emotion = require("@instructure/emotion");
|
|
23
|
-
|
|
24
15
|
var _Text = require("@instructure/ui-text/lib/Text");
|
|
25
|
-
|
|
26
16
|
var _Pill = require("@instructure/ui-pill/lib/Pill");
|
|
27
|
-
|
|
28
17
|
var _ColorIndicator = _interopRequireDefault(require("../ColorIndicator"));
|
|
29
|
-
|
|
30
18
|
var _props = require("./props");
|
|
31
|
-
|
|
32
19
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
33
|
-
|
|
34
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
35
|
-
|
|
36
21
|
var _dec, _dec2, _class, _class2;
|
|
37
|
-
|
|
38
22
|
/**
|
|
39
23
|
---
|
|
40
24
|
category: components
|
|
@@ -45,21 +29,18 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
45
29
|
constructor(props) {
|
|
46
30
|
super(props);
|
|
47
31
|
this.ref = null;
|
|
48
|
-
|
|
49
32
|
this.handleRef = el => {
|
|
50
33
|
const elementRef = this.props.elementRef;
|
|
51
34
|
this.ref = el;
|
|
52
|
-
|
|
53
35
|
if (typeof elementRef === 'function') {
|
|
54
36
|
elementRef(el);
|
|
55
37
|
}
|
|
56
38
|
};
|
|
57
|
-
|
|
58
39
|
this.renderStatus = (pass, description) => {
|
|
59
40
|
const _this$props = this.props,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
successLabel = _this$props.successLabel,
|
|
42
|
+
failureLabel = _this$props.failureLabel,
|
|
43
|
+
styles = _this$props.styles;
|
|
63
44
|
return (0, _emotion.jsx)("div", {
|
|
64
45
|
css: styles === null || styles === void 0 ? void 0 : styles.statusWrapper
|
|
65
46
|
}, (0, _emotion.jsx)("div", {
|
|
@@ -70,10 +51,8 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
70
51
|
color: pass ? 'success' : 'danger'
|
|
71
52
|
}, pass ? successLabel : failureLabel)));
|
|
72
53
|
};
|
|
73
|
-
|
|
74
54
|
this.renderColorIndicator = (color, label) => {
|
|
75
55
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
76
|
-
|
|
77
56
|
return (0, _emotion.jsx)(_react.default.Fragment, null, (0, _emotion.jsx)("div", null, (0, _emotion.jsx)("div", {
|
|
78
57
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.colorIndicator
|
|
79
58
|
}, (0, _emotion.jsx)(_ColorIndicator.default, {
|
|
@@ -84,7 +63,6 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
84
63
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.pickedColorHex
|
|
85
64
|
}, color)));
|
|
86
65
|
};
|
|
87
|
-
|
|
88
66
|
this.calcBlendedColor = (c1, c2) => {
|
|
89
67
|
const alpha = 1 - (1 - c1.a) * (1 - c2.a);
|
|
90
68
|
return {
|
|
@@ -95,36 +73,28 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
95
73
|
};
|
|
96
74
|
};
|
|
97
75
|
}
|
|
98
|
-
|
|
99
76
|
componentDidMount() {
|
|
100
77
|
var _this$props$makeStyle, _this$props2;
|
|
101
|
-
|
|
102
78
|
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
103
79
|
}
|
|
104
|
-
|
|
105
80
|
componentDidUpdate() {
|
|
106
81
|
var _this$props$makeStyle2, _this$props3;
|
|
107
|
-
|
|
108
82
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
109
83
|
}
|
|
110
|
-
|
|
111
84
|
renderPreview() {
|
|
112
85
|
const _this$props4 = this.props,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
86
|
+
styles = _this$props4.styles,
|
|
87
|
+
withoutColorPreview = _this$props4.withoutColorPreview,
|
|
88
|
+
firstColor = _this$props4.firstColor,
|
|
89
|
+
secondColor = _this$props4.secondColor,
|
|
90
|
+
firstColorLabel = _this$props4.firstColorLabel,
|
|
91
|
+
secondColorLabel = _this$props4.secondColorLabel;
|
|
120
92
|
if (withoutColorPreview) {
|
|
121
93
|
return null;
|
|
122
94
|
}
|
|
123
|
-
|
|
124
95
|
if (!firstColorLabel || !secondColorLabel) {
|
|
125
96
|
(0, _console.error)(false, 'When `withoutColorPreview` is not set to true, the properties `firstColorLabel` and `secondColorLabel` are required!');
|
|
126
97
|
}
|
|
127
|
-
|
|
128
98
|
return !withoutColorPreview && (0, _emotion.jsx)("div", {
|
|
129
99
|
css: styles === null || styles === void 0 ? void 0 : styles.colorPreview
|
|
130
100
|
}, (0, _emotion.jsx)("div", {
|
|
@@ -133,7 +103,6 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
133
103
|
css: styles === null || styles === void 0 ? void 0 : styles.secondColorPreview
|
|
134
104
|
}, this.renderColorIndicator(secondColor, secondColorLabel || '')));
|
|
135
105
|
}
|
|
136
|
-
|
|
137
106
|
//We project the firstColor onto an opaque white background, then we project the secondColor onto
|
|
138
107
|
//the projected first color. We calculate the contrast of these two, projected colors.
|
|
139
108
|
get calcContrast() {
|
|
@@ -148,14 +117,13 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
148
117
|
const c2OnC1OnWhite = this.calcBlendedColor(c1OnWhite, c2RGBA);
|
|
149
118
|
return (0, _contrast.contrast)(colorToHex8(c1OnWhite), colorToHex8(c2OnC1OnWhite), 2);
|
|
150
119
|
}
|
|
151
|
-
|
|
152
120
|
render() {
|
|
153
121
|
const _this$props5 = this.props,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
122
|
+
styles = _this$props5.styles,
|
|
123
|
+
label = _this$props5.label,
|
|
124
|
+
normalTextLabel = _this$props5.normalTextLabel,
|
|
125
|
+
largeTextLabel = _this$props5.largeTextLabel,
|
|
126
|
+
graphicsTextLabel = _this$props5.graphicsTextLabel;
|
|
159
127
|
const contrast = this.calcContrast;
|
|
160
128
|
return (0, _emotion.jsx)("div", Object.assign({}, (0, _omitProps.omitProps)(this.props, ColorContrast.allowedProps), {
|
|
161
129
|
ref: this.handleRef,
|
|
@@ -169,7 +137,6 @@ let ColorContrast = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
169
137
|
size: "x-large"
|
|
170
138
|
}, contrast, ":1"), this.renderPreview(), this.renderStatus(contrast >= 4.5, normalTextLabel), this.renderStatus(contrast >= 3, largeTextLabel), this.renderStatus(contrast >= 3, graphicsTextLabel));
|
|
171
139
|
}
|
|
172
|
-
|
|
173
140
|
}, _class2.displayName = "ColorContrast", _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.componentId = 'ColorContrast', _class2.defaultProps = {
|
|
174
141
|
withoutColorPreview: false
|
|
175
142
|
}, _class2)) || _class) || _class);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
elementRef: _propTypes.default.func,
|
|
37
35
|
failureLabel: _propTypes.default.string.isRequired,
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -45,7 +44,6 @@ const generateStyle = componentTheme => {
|
|
|
45
44
|
flex: 1,
|
|
46
45
|
color: pass ? componentTheme.successColor : componentTheme.failureColor
|
|
47
46
|
});
|
|
48
|
-
|
|
49
47
|
return {
|
|
50
48
|
colorContrast: {
|
|
51
49
|
label: 'colorContrast',
|
|
@@ -102,6 +100,5 @@ const generateStyle = componentTheme => {
|
|
|
102
100
|
}
|
|
103
101
|
};
|
|
104
102
|
};
|
|
105
|
-
|
|
106
103
|
var _default = generateStyle;
|
|
107
104
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,9 +35,9 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
typography = theme.typography,
|
|
39
|
+
spacing = theme.spacing,
|
|
40
|
+
borders = theme.borders;
|
|
42
41
|
const componentVariables = {
|
|
43
42
|
width: '17rem',
|
|
44
43
|
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
@@ -55,9 +54,9 @@ const generateComponentTheme = theme => {
|
|
|
55
54
|
failureColor: colors.crimson,
|
|
56
55
|
pickedHexColor: colors.ash
|
|
57
56
|
};
|
|
58
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
...componentVariables
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
|
|
62
61
|
var _default = generateComponentTheme;
|
|
63
62
|
exports.default = _default;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ColorIndicatorLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,16 +30,15 @@ var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
35
|
const ColorIndicatorLocator = (0, _locator.locator)(_index.ColorIndicator.selector, {
|
|
39
36
|
getColorRGBA: element => {
|
|
40
37
|
const _getComputedStyle = getComputedStyle(element),
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
boxShadow = _getComputedStyle.boxShadow;
|
|
43
39
|
if (boxShadow === 'none') {
|
|
44
40
|
return boxShadow;
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
const shadowColor = /rgba?\(\d+,\s\d+,\s\d+(,\s.+)?\)/.exec(boxShadow)[0];
|
|
48
43
|
return (0, _uiColorUtils.colorToRGB)(shadowColor);
|
|
49
44
|
}
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.ColorIndicator = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
13
|
-
|
|
14
10
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
|
-
|
|
16
11
|
var _emotion = require("@instructure/emotion");
|
|
17
|
-
|
|
18
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
19
|
-
|
|
20
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
|
-
|
|
22
14
|
var _props = require("./props");
|
|
23
|
-
|
|
24
15
|
var _dec, _dec2, _class, _class2;
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
---
|
|
28
18
|
category: components
|
|
@@ -33,29 +23,22 @@ let ColorIndicator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
33
23
|
constructor() {
|
|
34
24
|
super(...arguments);
|
|
35
25
|
this.ref = null;
|
|
36
|
-
|
|
37
26
|
this.handleRef = el => {
|
|
38
27
|
const elementRef = this.props.elementRef;
|
|
39
28
|
this.ref = el;
|
|
40
|
-
|
|
41
29
|
if (typeof elementRef === 'function') {
|
|
42
30
|
elementRef(el);
|
|
43
31
|
}
|
|
44
32
|
};
|
|
45
33
|
}
|
|
46
|
-
|
|
47
34
|
componentDidMount() {
|
|
48
35
|
var _this$props$makeStyle, _this$props;
|
|
49
|
-
|
|
50
36
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
51
37
|
}
|
|
52
|
-
|
|
53
38
|
componentDidUpdate() {
|
|
54
39
|
var _this$props$makeStyle2, _this$props2;
|
|
55
|
-
|
|
56
40
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
57
41
|
}
|
|
58
|
-
|
|
59
42
|
render() {
|
|
60
43
|
const styles = this.props.styles;
|
|
61
44
|
return (0, _emotion.jsx)("div", Object.assign({}, (0, _omitProps.omitProps)(this.props, ColorIndicator.allowedProps), {
|
|
@@ -63,7 +46,6 @@ let ColorIndicator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
63
46
|
css: styles === null || styles === void 0 ? void 0 : styles.colorIndicator
|
|
64
47
|
}));
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
}, _class2.displayName = "ColorIndicator", _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.componentId = 'ColorIndicator', _class2.defaultProps = {
|
|
68
50
|
shape: 'circle'
|
|
69
51
|
}, _class2)) || _class) || _class);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
color: _propTypes.default.string,
|
|
37
35
|
elementRef: _propTypes.default.func,
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
|
|
9
|
-
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -30,6 +28,7 @@ var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
|
|
|
30
28
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
29
|
* SOFTWARE.
|
|
32
30
|
*/
|
|
31
|
+
|
|
33
32
|
const calcBlendedColor = (c1, c2) => {
|
|
34
33
|
// 0.4 as decided by design
|
|
35
34
|
const c2Alpha = c2.a * 0.4;
|
|
@@ -51,11 +50,9 @@ const calcBlendedColor = (c1, c2) => {
|
|
|
51
50
|
* @param {Object} state the state of the component, the style is applied to
|
|
52
51
|
* @return {Object} The final style object, which will be used in the component
|
|
53
52
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
53
|
const generateStyle = (componentTheme, props) => {
|
|
57
54
|
const color = props.color,
|
|
58
|
-
|
|
55
|
+
shape = props.shape;
|
|
59
56
|
return {
|
|
60
57
|
colorIndicator: {
|
|
61
58
|
label: 'colorIndicator',
|
|
@@ -73,6 +70,5 @@ const generateStyle = (componentTheme, props) => {
|
|
|
73
70
|
}
|
|
74
71
|
};
|
|
75
72
|
};
|
|
76
|
-
|
|
77
73
|
var _default = generateStyle;
|
|
78
74
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.colorIndicatorBorderColor = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -28,19 +27,19 @@ exports.default = exports.colorIndicatorBorderColor = void 0;
|
|
|
28
27
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
28
|
* SOFTWARE.
|
|
30
29
|
*/
|
|
30
|
+
|
|
31
31
|
const colorIndicatorBorderColor = '#384A5899';
|
|
32
|
+
|
|
32
33
|
/**
|
|
33
34
|
* Generates the theme object for the component from the theme and provided additional information
|
|
34
35
|
* @param {Object} theme The actual theme object.
|
|
35
36
|
* @return {Object} The final theme object with the overrides and component variables
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
38
|
exports.colorIndicatorBorderColor = colorIndicatorBorderColor;
|
|
39
|
-
|
|
40
39
|
const generateComponentTheme = theme => {
|
|
41
40
|
const colors = theme.colors,
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
borders = theme.borders,
|
|
42
|
+
spacing = theme.spacing;
|
|
44
43
|
const componentVariables = {
|
|
45
44
|
borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
46
45
|
backgroundImage: `linear-gradient(45deg, ${colors.tiara} 25%, transparent 25%),
|
|
@@ -55,9 +54,9 @@ const generateComponentTheme = theme => {
|
|
|
55
54
|
rectangularIndicatorBorderRadius: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
56
55
|
rectangularIndicatorBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall
|
|
57
56
|
};
|
|
58
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
...componentVariables
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
|
|
62
61
|
var _default = generateComponentTheme;
|
|
63
62
|
exports.default = _default;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ColorMixerLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _uiTestUtils = require("@instructure/ui-test-utils");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,43 +30,39 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
const customMethos = {
|
|
38
35
|
findTextInput: function () {
|
|
39
36
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
37
|
args[_key] = arguments[_key];
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
return (0, _uiTestUtils.find)('[id^=TextInput_]', ...args);
|
|
44
40
|
},
|
|
45
41
|
findColorPalette: function () {
|
|
46
42
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
47
43
|
args[_key2] = arguments[_key2];
|
|
48
44
|
}
|
|
49
|
-
|
|
50
45
|
return (0, _uiTestUtils.find)('[aria-label*="color palette"]', ...args);
|
|
51
46
|
},
|
|
52
47
|
findColorSlider: function () {
|
|
53
48
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
54
49
|
args[_key3] = arguments[_key3];
|
|
55
50
|
}
|
|
56
|
-
|
|
57
51
|
return (0, _uiTestUtils.find)('[aria-label*="color slider"]', ...args);
|
|
58
52
|
},
|
|
59
53
|
findAlphaSlider: function () {
|
|
60
54
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
61
55
|
args[_key4] = arguments[_key4];
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
return (0, _uiTestUtils.find)('[aria-label*="alpha slider"]', ...args);
|
|
65
58
|
},
|
|
66
59
|
findIndicator: function () {
|
|
67
60
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
68
61
|
args[_key5] = arguments[_key5];
|
|
69
62
|
}
|
|
70
|
-
|
|
71
63
|
return (0, _uiTestUtils.find)('[clas*=__indicator]', ...args);
|
|
72
64
|
}
|
|
73
|
-
};
|
|
74
|
-
|
|
65
|
+
};
|
|
66
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
75
67
|
const ColorMixerLocator = (0, _locator.locator)(_index.ColorMixer.selector, customMethos);
|
|
76
68
|
exports.ColorMixerLocator = ColorMixerLocator;
|