@instructure/ui-color-picker 8.25.1-snapshot-20
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 +17 -0
- package/README.md +46 -0
- package/es/ColorContrast/ColorContrastLocator.js +54 -0
- package/es/ColorContrast/index.js +174 -0
- package/es/ColorContrast/props.js +40 -0
- package/es/ColorContrast/styles.js +99 -0
- package/es/ColorContrast/theme.js +55 -0
- package/es/ColorIndicator/ColorIndicatorLocator.js +40 -0
- package/es/ColorIndicator/index.js +91 -0
- package/es/ColorIndicator/props.js +31 -0
- package/es/ColorIndicator/styles.js +70 -0
- package/es/ColorIndicator/theme.js +53 -0
- package/es/ColorMixer/ColorMixerLocator.js +27 -0
- package/es/ColorMixer/ColorPalette/index.js +258 -0
- package/es/ColorMixer/ColorPalette/props.js +37 -0
- package/es/ColorMixer/ColorPalette/styles.js +81 -0
- package/es/ColorMixer/ColorPalette/theme.js +48 -0
- package/es/ColorMixer/RGBAInput/index.js +148 -0
- package/es/ColorMixer/RGBAInput/props.js +39 -0
- package/es/ColorMixer/RGBAInput/styles.js +63 -0
- package/es/ColorMixer/RGBAInput/theme.js +43 -0
- package/es/ColorMixer/Slider/index.js +218 -0
- package/es/ColorMixer/Slider/props.js +38 -0
- package/es/ColorMixer/Slider/styles.js +95 -0
- package/es/ColorMixer/Slider/theme.js +53 -0
- package/es/ColorMixer/index.js +232 -0
- package/es/ColorMixer/props.js +40 -0
- package/es/ColorMixer/styles.js +49 -0
- package/es/ColorMixer/utils/shallowCompare.js +32 -0
- package/es/ColorPicker/ColorPickerLocator.js +137 -0
- package/es/ColorPicker/index.js +487 -0
- package/es/ColorPicker/props.js +47 -0
- package/es/ColorPicker/styles.js +119 -0
- package/es/ColorPicker/theme.js +76 -0
- package/es/ColorPreset/ColorPresetLocator.js +27 -0
- package/es/ColorPreset/index.js +268 -0
- package/es/ColorPreset/props.js +36 -0
- package/es/ColorPreset/styles.js +102 -0
- package/es/ColorPreset/theme.js +53 -0
- package/es/index.js +28 -0
- package/lib/ColorContrast/ColorContrastLocator.js +66 -0
- package/lib/ColorContrast/index.js +169 -0
- package/lib/ColorContrast/props.js +51 -0
- package/lib/ColorContrast/styles.js +107 -0
- package/lib/ColorContrast/theme.js +63 -0
- package/lib/ColorIndicator/ColorIndicatorLocator.js +51 -0
- package/lib/ColorIndicator/index.js +82 -0
- package/lib/ColorIndicator/props.js +42 -0
- package/lib/ColorIndicator/styles.js +78 -0
- package/lib/ColorIndicator/theme.js +63 -0
- package/lib/ColorMixer/ColorMixerLocator.js +37 -0
- package/lib/ColorMixer/ColorPalette/index.js +252 -0
- package/lib/ColorMixer/ColorPalette/props.js +48 -0
- package/lib/ColorMixer/ColorPalette/styles.js +90 -0
- package/lib/ColorMixer/ColorPalette/theme.js +57 -0
- package/lib/ColorMixer/RGBAInput/index.js +142 -0
- package/lib/ColorMixer/RGBAInput/props.js +50 -0
- package/lib/ColorMixer/RGBAInput/styles.js +71 -0
- package/lib/ColorMixer/RGBAInput/theme.js +51 -0
- package/lib/ColorMixer/Slider/index.js +211 -0
- package/lib/ColorMixer/Slider/props.js +49 -0
- package/lib/ColorMixer/Slider/styles.js +103 -0
- package/lib/ColorMixer/Slider/theme.js +62 -0
- package/lib/ColorMixer/index.js +226 -0
- package/lib/ColorMixer/props.js +51 -0
- package/lib/ColorMixer/styles.js +57 -0
- package/lib/ColorMixer/utils/shallowCompare.js +40 -0
- package/lib/ColorPicker/ColorPickerLocator.js +151 -0
- package/lib/ColorPicker/index.js +500 -0
- package/lib/ColorPicker/props.js +58 -0
- package/lib/ColorPicker/styles.js +127 -0
- package/lib/ColorPicker/theme.js +85 -0
- package/lib/ColorPreset/ColorPresetLocator.js +37 -0
- package/lib/ColorPreset/index.js +274 -0
- package/lib/ColorPreset/props.js +47 -0
- package/lib/ColorPreset/styles.js +110 -0
- package/lib/ColorPreset/theme.js +61 -0
- package/lib/index.js +45 -0
- package/lib/package.json +1 -0
- package/package.json +62 -0
- package/src/ColorContrast/ColorContrastLocator.ts +51 -0
- package/src/ColorContrast/README.md +111 -0
- package/src/ColorContrast/index.tsx +189 -0
- package/src/ColorContrast/props.ts +140 -0
- package/src/ColorContrast/styles.ts +102 -0
- package/src/ColorContrast/theme.ts +62 -0
- package/src/ColorIndicator/ColorIndicatorLocator.ts +41 -0
- package/src/ColorIndicator/README.md +76 -0
- package/src/ColorIndicator/index.tsx +89 -0
- package/src/ColorIndicator/props.ts +68 -0
- package/src/ColorIndicator/styles.ts +88 -0
- package/src/ColorIndicator/theme.ts +58 -0
- package/src/ColorMixer/ColorMixerLocator.ts +29 -0
- package/src/ColorMixer/ColorPalette/index.tsx +250 -0
- package/src/ColorMixer/ColorPalette/props.ts +87 -0
- package/src/ColorMixer/ColorPalette/styles.ts +94 -0
- package/src/ColorMixer/ColorPalette/theme.ts +52 -0
- package/src/ColorMixer/README.md +98 -0
- package/src/ColorMixer/RGBAInput/index.tsx +172 -0
- package/src/ColorMixer/RGBAInput/props.ts +93 -0
- package/src/ColorMixer/RGBAInput/styles.ts +69 -0
- package/src/ColorMixer/RGBAInput/theme.ts +48 -0
- package/src/ColorMixer/Slider/index.tsx +242 -0
- package/src/ColorMixer/Slider/props.ts +94 -0
- package/src/ColorMixer/Slider/styles.ts +114 -0
- package/src/ColorMixer/Slider/theme.ts +59 -0
- package/src/ColorMixer/index.tsx +221 -0
- package/src/ColorMixer/props.ts +169 -0
- package/src/ColorMixer/styles.ts +51 -0
- package/src/ColorMixer/utils/shallowCompare.ts +35 -0
- package/src/ColorPicker/ColorPickerLocator.ts +124 -0
- package/src/ColorPicker/README.md +420 -0
- package/src/ColorPicker/index.tsx +609 -0
- package/src/ColorPicker/props.ts +293 -0
- package/src/ColorPicker/styles.ts +131 -0
- package/src/ColorPicker/theme.ts +80 -0
- package/src/ColorPreset/ColorPresetLocator.ts +29 -0
- package/src/ColorPreset/README.md +121 -0
- package/src/ColorPreset/index.tsx +328 -0
- package/src/ColorPreset/props.ts +162 -0
- package/src/ColorPreset/styles.ts +107 -0
- package/src/ColorPreset/theme.ts +58 -0
- package/src/index.ts +34 -0
- package/tsconfig.build.json +36 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/ColorContrast/ColorContrastLocator.d.ts +592 -0
- package/types/ColorContrast/ColorContrastLocator.d.ts.map +1 -0
- package/types/ColorContrast/index.d.ts +61 -0
- package/types/ColorContrast/index.d.ts.map +1 -0
- package/types/ColorContrast/props.d.ts +62 -0
- package/types/ColorContrast/props.d.ts.map +1 -0
- package/types/ColorContrast/styles.d.ts +76 -0
- package/types/ColorContrast/styles.d.ts.map +1 -0
- package/types/ColorContrast/theme.d.ts +10 -0
- package/types/ColorContrast/theme.d.ts.map +1 -0
- package/types/ColorIndicator/ColorIndicatorLocator.d.ts +577 -0
- package/types/ColorIndicator/ColorIndicatorLocator.d.ts.map +1 -0
- package/types/ColorIndicator/index.d.ts +35 -0
- package/types/ColorIndicator/index.d.ts.map +1 -0
- package/types/ColorIndicator/props.d.ts +25 -0
- package/types/ColorIndicator/props.d.ts.map +1 -0
- package/types/ColorIndicator/styles.d.ts +15 -0
- package/types/ColorIndicator/styles.d.ts.map +1 -0
- package/types/ColorIndicator/theme.d.ts +11 -0
- package/types/ColorIndicator/theme.d.ts.map +1 -0
- package/types/ColorMixer/ColorMixerLocator.d.ts +566 -0
- package/types/ColorMixer/ColorMixerLocator.d.ts.map +1 -0
- package/types/ColorMixer/ColorPalette/index.d.ts +70 -0
- package/types/ColorMixer/ColorPalette/index.d.ts.map +1 -0
- package/types/ColorMixer/ColorPalette/props.d.ts +29 -0
- package/types/ColorMixer/ColorPalette/props.d.ts.map +1 -0
- package/types/ColorMixer/ColorPalette/styles.d.ts +15 -0
- package/types/ColorMixer/ColorPalette/styles.d.ts.map +1 -0
- package/types/ColorMixer/ColorPalette/theme.d.ts +10 -0
- package/types/ColorMixer/ColorPalette/theme.d.ts.map +1 -0
- package/types/ColorMixer/RGBAInput/index.d.ts +51 -0
- package/types/ColorMixer/RGBAInput/index.d.ts.map +1 -0
- package/types/ColorMixer/RGBAInput/props.d.ts +28 -0
- package/types/ColorMixer/RGBAInput/props.d.ts.map +1 -0
- package/types/ColorMixer/RGBAInput/styles.d.ts +15 -0
- package/types/ColorMixer/RGBAInput/styles.d.ts.map +1 -0
- package/types/ColorMixer/RGBAInput/theme.d.ts +10 -0
- package/types/ColorMixer/RGBAInput/theme.d.ts.map +1 -0
- package/types/ColorMixer/Slider/index.d.ts +64 -0
- package/types/ColorMixer/Slider/index.d.ts.map +1 -0
- package/types/ColorMixer/Slider/props.d.ts +26 -0
- package/types/ColorMixer/Slider/props.d.ts.map +1 -0
- package/types/ColorMixer/Slider/styles.d.ts +15 -0
- package/types/ColorMixer/Slider/styles.d.ts.map +1 -0
- package/types/ColorMixer/Slider/theme.d.ts +10 -0
- package/types/ColorMixer/Slider/theme.d.ts.map +1 -0
- package/types/ColorMixer/index.d.ts +59 -0
- package/types/ColorMixer/index.d.ts.map +1 -0
- package/types/ColorMixer/props.d.ts +91 -0
- package/types/ColorMixer/props.d.ts.map +1 -0
- package/types/ColorMixer/styles.d.ts +14 -0
- package/types/ColorMixer/styles.d.ts.map +1 -0
- package/types/ColorMixer/utils/shallowCompare.d.ts +3 -0
- package/types/ColorMixer/utils/shallowCompare.d.ts.map +1 -0
- package/types/ColorPicker/ColorPickerLocator.d.ts +4113 -0
- package/types/ColorPicker/ColorPickerLocator.d.ts.map +1 -0
- package/types/ColorPicker/index.d.ts +158 -0
- package/types/ColorPicker/index.d.ts.map +1 -0
- package/types/ColorPicker/props.d.ts +166 -0
- package/types/ColorPicker/props.d.ts.map +1 -0
- package/types/ColorPicker/styles.d.ts +17 -0
- package/types/ColorPicker/styles.d.ts.map +1 -0
- package/types/ColorPicker/theme.d.ts +10 -0
- package/types/ColorPicker/theme.d.ts.map +1 -0
- package/types/ColorPreset/ColorPresetLocator.d.ts +566 -0
- package/types/ColorPreset/ColorPresetLocator.d.ts.map +1 -0
- package/types/ColorPreset/index.d.ts +100 -0
- package/types/ColorPreset/index.d.ts.map +1 -0
- package/types/ColorPreset/props.d.ts +87 -0
- package/types/ColorPreset/props.d.ts.map +1 -0
- package/types/ColorPreset/styles.d.ts +77 -0
- package/types/ColorPreset/styles.d.ts.map +1 -0
- package/types/ColorPreset/theme.d.ts +10 -0
- package/types/ColorPreset/theme.d.ts.map +1 -0
- package/types/index.d.ts +11 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { colorToRGB, isValid } from '@instructure/ui-color-utils';
|
|
25
|
+
|
|
26
|
+
const calcBlendedColor = (c1, c2) => {
|
|
27
|
+
// 0.4 as decided by design
|
|
28
|
+
const c2Alpha = c2.a * 0.4;
|
|
29
|
+
const c1Alpha = 1 - c2Alpha;
|
|
30
|
+
const alpha = 1 - c1Alpha * (1 - c1Alpha);
|
|
31
|
+
return `rgba(
|
|
32
|
+
${c2.r * c2Alpha / alpha + c1.r * c1Alpha * (1 - c2Alpha) / alpha},
|
|
33
|
+
${c2.g * c2Alpha / alpha + c1.g * c1Alpha * (1 - c2Alpha) / alpha},
|
|
34
|
+
${c2.b * c2Alpha / alpha + c1.b * c1Alpha * (1 - c2Alpha) / alpha},
|
|
35
|
+
${c2.a < 0.6 ? 0.6 : c2.a})`;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* ---
|
|
39
|
+
* private: true
|
|
40
|
+
* ---
|
|
41
|
+
* Generates the style object from the theme and provided additional information
|
|
42
|
+
* @param {Object} componentTheme The theme variable object.
|
|
43
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
44
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
45
|
+
* @return {Object} The final style object, which will be used in the component
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const generateStyle = (componentTheme, props) => {
|
|
50
|
+
const color = props.color,
|
|
51
|
+
shape = props.shape;
|
|
52
|
+
return {
|
|
53
|
+
colorIndicator: {
|
|
54
|
+
label: 'colorIndicator',
|
|
55
|
+
width: shape === 'rectangle' ? componentTheme.rectangleIndicatorSize : componentTheme.circleIndicatorSize,
|
|
56
|
+
height: shape === 'rectangle' ? componentTheme.rectangleIndicatorSize : componentTheme.circleIndicatorSize,
|
|
57
|
+
borderRadius: shape === 'rectangle' ? componentTheme.rectangularIndicatorBorderRadius : componentTheme.circleIndicatorSize,
|
|
58
|
+
boxSizing: 'border-box',
|
|
59
|
+
borderWidth: componentTheme.borderWidth,
|
|
60
|
+
boxShadow: color ? `inset 0 0 0 1.5rem ${color}` : 'none',
|
|
61
|
+
borderStyle: 'solid',
|
|
62
|
+
backgroundImage: componentTheme.backgroundImage,
|
|
63
|
+
backgroundSize: componentTheme.backgroundSize,
|
|
64
|
+
backgroundPosition: componentTheme.backgroundPosition,
|
|
65
|
+
borderColor: calcBlendedColor(colorToRGB(componentTheme.colorIndicatorBorderColor), colorToRGB(isValid(color) ? color : '#fff'))
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default generateStyle;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export const colorIndicatorBorderColor = '#384A5899';
|
|
25
|
+
/**
|
|
26
|
+
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
+
* @param {Object} theme The actual theme object.
|
|
28
|
+
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const generateComponentTheme = theme => {
|
|
32
|
+
const colors = theme.colors,
|
|
33
|
+
borders = theme.borders,
|
|
34
|
+
spacing = theme.spacing;
|
|
35
|
+
const componentVariables = {
|
|
36
|
+
borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
37
|
+
backgroundImage: `linear-gradient(45deg, ${colors.tiara} 25%, transparent 25%),
|
|
38
|
+
linear-gradient(-45deg, ${colors.tiara} 25%, transparent 25%),
|
|
39
|
+
linear-gradient(45deg, transparent 75%, ${colors.tiara} 75%),
|
|
40
|
+
linear-gradient(-45deg, transparent 75%, ${colors.tiara} 75%)`,
|
|
41
|
+
backgroundSize: '.5rem .5rem',
|
|
42
|
+
backgroundPosition: '0 0, 0 .25rem, .25rem -0.25rem, -0.25rem 0px',
|
|
43
|
+
circleIndicatorSize: '1.5rem',
|
|
44
|
+
rectangleIndicatorSize: '2.375rem',
|
|
45
|
+
colorIndicatorBorderColor,
|
|
46
|
+
rectangularIndicatorBorderRadius: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
|
|
47
|
+
rectangularIndicatorBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall
|
|
48
|
+
};
|
|
49
|
+
return { ...componentVariables
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default generateComponentTheme;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
+
import { ColorMixer } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
26
|
+
|
|
27
|
+
export const ColorMixerLocator = locator(ColorMixer.selector);
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
var _dec, _class, _class2;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* The MIT License (MIT)
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyrigfht notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** @jsx jsx */
|
|
28
|
+
import React, { Component } from 'react';
|
|
29
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
30
|
+
import { addEventListener } from '@instructure/ui-dom-utils';
|
|
31
|
+
import shallowCompare from '../utils/shallowCompare';
|
|
32
|
+
import { View } from '@instructure/ui-view';
|
|
33
|
+
import { propTypes, allowedProps } from './props';
|
|
34
|
+
import generateStyle from './styles';
|
|
35
|
+
import generateComponentTheme from './theme';
|
|
36
|
+
/**
|
|
37
|
+
* ---
|
|
38
|
+
* private: true
|
|
39
|
+
* ---
|
|
40
|
+
* @tsProps
|
|
41
|
+
**/
|
|
42
|
+
|
|
43
|
+
let ColorPalette = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class ColorPalette extends Component {
|
|
44
|
+
constructor(props) {
|
|
45
|
+
super(props);
|
|
46
|
+
this.ref = null;
|
|
47
|
+
this._paletteRef = null;
|
|
48
|
+
this._mouseMoveListener = void 0;
|
|
49
|
+
this._mouseUpListener = void 0;
|
|
50
|
+
|
|
51
|
+
this.handleRef = el => {
|
|
52
|
+
const elementRef = this.props.elementRef;
|
|
53
|
+
this.ref = el;
|
|
54
|
+
|
|
55
|
+
if (typeof elementRef === 'function') {
|
|
56
|
+
elementRef(el);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
this.calcSaturation = position => Math.round(position / this.paletteWidth * 100) / 100;
|
|
61
|
+
|
|
62
|
+
this.calcLuminance = position => Math.round((this.paletteHeight - position) / this.paletteHeight * 100) / 100;
|
|
63
|
+
|
|
64
|
+
this.handleMouseUp = () => {
|
|
65
|
+
this.removeEventListeners();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
this.handleChange = e => {
|
|
69
|
+
if (this.props.disabled) return;
|
|
70
|
+
const clientX = e.clientX,
|
|
71
|
+
clientY = e.clientY;
|
|
72
|
+
|
|
73
|
+
const _this$calcColorPositi = this.calcColorPosition(clientX, clientY),
|
|
74
|
+
newXPosition = _this$calcColorPositi.newXPosition,
|
|
75
|
+
newYPosition = _this$calcColorPositi.newYPosition;
|
|
76
|
+
|
|
77
|
+
this.setState({
|
|
78
|
+
colorPosition: {
|
|
79
|
+
x: newXPosition,
|
|
80
|
+
y: newYPosition
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
this.props.onChange({
|
|
84
|
+
h: this.props.hue,
|
|
85
|
+
s: this.calcSaturation(newXPosition),
|
|
86
|
+
v: this.calcLuminance(newYPosition)
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
this.state = {
|
|
91
|
+
colorPosition: {
|
|
92
|
+
x: 0,
|
|
93
|
+
y: 0
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
componentDidMount() {
|
|
99
|
+
var _this$props$makeStyle, _this$props;
|
|
100
|
+
|
|
101
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.state);
|
|
102
|
+
this.setState({
|
|
103
|
+
colorPosition: this.calcPositionFromColor(this.props.color)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
componentDidUpdate(prevProps) {
|
|
108
|
+
var _this$props$makeStyle2, _this$props2;
|
|
109
|
+
|
|
110
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.state);
|
|
111
|
+
|
|
112
|
+
if (shallowCompare(prevProps.color, this.props.color)) {
|
|
113
|
+
this.setState({
|
|
114
|
+
colorPosition: this.calcPositionFromColor(this.props.color)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
componentWillUnmount() {
|
|
120
|
+
this.removeEventListeners();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get paletteWidth() {
|
|
124
|
+
return this._paletteRef.getBoundingClientRect().width;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get paletteHeight() {
|
|
128
|
+
return this._paletteRef.getBoundingClientRect().height;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
calcPositionFromColor(hsv) {
|
|
132
|
+
const s = hsv.s,
|
|
133
|
+
v = hsv.v;
|
|
134
|
+
return {
|
|
135
|
+
x: s * this.paletteWidth,
|
|
136
|
+
y: this.paletteHeight - v * this.paletteHeight
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
handlePaletteMouseDown(e) {
|
|
141
|
+
this.handleChange(e);
|
|
142
|
+
this._mouseMoveListener = addEventListener(window, 'mousemove', this.handleChange);
|
|
143
|
+
this._mouseUpListener = addEventListener(window, 'mouseup', this.handleMouseUp);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
removeEventListeners() {
|
|
147
|
+
var _this$_mouseMoveListe, _this$_mouseUpListene;
|
|
148
|
+
|
|
149
|
+
(_this$_mouseMoveListe = this._mouseMoveListener) === null || _this$_mouseMoveListe === void 0 ? void 0 : _this$_mouseMoveListe.remove();
|
|
150
|
+
(_this$_mouseUpListene = this._mouseUpListener) === null || _this$_mouseUpListene === void 0 ? void 0 : _this$_mouseUpListene.remove();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
calcColorPosition(clientX, clientY) {
|
|
154
|
+
const _getBoundingClientRec = this._paletteRef.getBoundingClientRect(),
|
|
155
|
+
x = _getBoundingClientRec.x,
|
|
156
|
+
y = _getBoundingClientRec.y;
|
|
157
|
+
|
|
158
|
+
return this.applyBoundaries(clientX - x, clientY - y);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
applyBoundaries(x, y) {
|
|
162
|
+
let newXPosition = x;
|
|
163
|
+
let newYPosition = y;
|
|
164
|
+
|
|
165
|
+
if (x > this.paletteWidth) {
|
|
166
|
+
newXPosition = this.paletteWidth;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (x < 0) {
|
|
170
|
+
newXPosition = 0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (y > this.paletteHeight) {
|
|
174
|
+
newYPosition = this.paletteHeight;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (y < 0) {
|
|
178
|
+
newYPosition = 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
newXPosition,
|
|
183
|
+
newYPosition
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
handleKeyDown(e) {
|
|
188
|
+
if (this.props.disabled) return;
|
|
189
|
+
const key = e.key;
|
|
190
|
+
if (key === 'Tab') return;
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
let deltaX = 0;
|
|
193
|
+
let deltaY = 0;
|
|
194
|
+
|
|
195
|
+
if (key === 'ArrowLeft' || key === 'a') {
|
|
196
|
+
deltaX = -2;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (key === 'ArrowRight' || key === 'd') {
|
|
200
|
+
deltaX = 2;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (key === 'ArrowUp' || key === 'w') {
|
|
204
|
+
deltaY = -2;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (key === 'ArrowDown' || key === 's') {
|
|
208
|
+
deltaY = 2;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const _this$applyBoundaries = this.applyBoundaries(this.state.colorPosition.x + deltaX, this.state.colorPosition.y + deltaY),
|
|
212
|
+
newXPosition = _this$applyBoundaries.newXPosition,
|
|
213
|
+
newYPosition = _this$applyBoundaries.newYPosition;
|
|
214
|
+
|
|
215
|
+
this.setState({
|
|
216
|
+
colorPosition: {
|
|
217
|
+
x: newXPosition,
|
|
218
|
+
y: newYPosition
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
this.props.onChange({
|
|
222
|
+
h: this.props.hue,
|
|
223
|
+
s: this.calcSaturation(newXPosition),
|
|
224
|
+
v: this.calcLuminance(newYPosition)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
render() {
|
|
229
|
+
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
230
|
+
|
|
231
|
+
return jsx(View, {
|
|
232
|
+
elementRef: this.handleRef,
|
|
233
|
+
disabled: this.props.disabled,
|
|
234
|
+
position: "relative",
|
|
235
|
+
background: "transparent",
|
|
236
|
+
display: "inline-block",
|
|
237
|
+
borderRadius: "medium",
|
|
238
|
+
borderWidth: "0",
|
|
239
|
+
padding: "0",
|
|
240
|
+
as: "div",
|
|
241
|
+
tabIndex: this.props.disabled ? void 0 : 0,
|
|
242
|
+
onKeyDown: e => this.handleKeyDown(e),
|
|
243
|
+
onMouseDown: e => this.handlePaletteMouseDown(e),
|
|
244
|
+
"aria-label": this.props.navigationExplanationScreenReaderLabel
|
|
245
|
+
}, jsx("div", {
|
|
246
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.indicator
|
|
247
|
+
}), this.props.disabled && jsx("div", {
|
|
248
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.disabledOverlay
|
|
249
|
+
}), jsx("div", {
|
|
250
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.palette,
|
|
251
|
+
ref: ref => {
|
|
252
|
+
this._paletteRef = ref;
|
|
253
|
+
}
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
}, _class2.displayName = "ColorPalette", _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.componentId = 'ColorMixer.Palette', _class2)) || _class);
|
|
258
|
+
export default ColorPalette;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
disabled: PropTypes.bool,
|
|
27
|
+
hue: PropTypes.number.isRequired,
|
|
28
|
+
color: PropTypes.object.isRequired,
|
|
29
|
+
width: PropTypes.number.isRequired,
|
|
30
|
+
height: PropTypes.number.isRequired,
|
|
31
|
+
indicatorRadius: PropTypes.number.isRequired,
|
|
32
|
+
onChange: PropTypes.func.isRequired,
|
|
33
|
+
elementRef: PropTypes.func,
|
|
34
|
+
navigationExplanationScreenReaderLabel: PropTypes.string.isRequired
|
|
35
|
+
};
|
|
36
|
+
const allowedProps = ['disabled', 'hue', 'color', 'width', 'height', 'indicatorRadius', 'onChange', 'elementRef', 'navigationExplanationScreenReaderLabel'];
|
|
37
|
+
export { propTypes, allowedProps };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { px } from '@instructure/ui-utils';
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
33
|
+
* @return {Object} The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const generateStyle = (componentTheme, props, state) => {
|
|
37
|
+
var _state$colorPosition, _state$colorPosition2;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
ColorPalette: {
|
|
41
|
+
label: 'ColorPalette'
|
|
42
|
+
},
|
|
43
|
+
indicator: {
|
|
44
|
+
label: 'ColorPalette__indicator',
|
|
45
|
+
width: `${props.indicatorRadius / 8}rem`,
|
|
46
|
+
height: `${props.indicatorRadius / 8}rem`,
|
|
47
|
+
borderRadius: `${props.indicatorRadius / 8}rem`,
|
|
48
|
+
background: componentTheme.whiteColor,
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
borderStyle: 'solid',
|
|
51
|
+
borderWidth: componentTheme.indicatorBorderWidth,
|
|
52
|
+
borderColor: componentTheme.indicatorBorderColor,
|
|
53
|
+
top: `${(state === null || state === void 0 ? void 0 : (_state$colorPosition = state.colorPosition) === null || _state$colorPosition === void 0 ? void 0 : _state$colorPosition.y) - px(`${props.indicatorRadius / 16}rem`)}px`,
|
|
54
|
+
left: `${(state === null || state === void 0 ? void 0 : (_state$colorPosition2 = state.colorPosition) === null || _state$colorPosition2 === void 0 ? void 0 : _state$colorPosition2.x) - px(`${props.indicatorRadius / 16}rem`)}px`
|
|
55
|
+
},
|
|
56
|
+
palette: {
|
|
57
|
+
label: 'ColorPalette__palette',
|
|
58
|
+
width: `${props.width / 16}rem`,
|
|
59
|
+
height: `${props.height / 16}rem`,
|
|
60
|
+
borderRadius: componentTheme.paletteBorderRadius,
|
|
61
|
+
borderStyle: 'solid',
|
|
62
|
+
borderWidth: componentTheme.paletteBorderWidth,
|
|
63
|
+
boxSizing: 'border-box',
|
|
64
|
+
borderColor: componentTheme.colorIndicatorBorderColor,
|
|
65
|
+
background: `linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1)),
|
|
66
|
+
linear-gradient(to right, white, hsl(${props.hue},100%,50%))`
|
|
67
|
+
},
|
|
68
|
+
disabledOverlay: {
|
|
69
|
+
label: 'ColorPalette__disabledOverlay',
|
|
70
|
+
background: 'rgba(255,255,255,.5)',
|
|
71
|
+
zIndex: componentTheme.disabledOverlayZIndex,
|
|
72
|
+
width: `${props.width / 16 + 1}rem`,
|
|
73
|
+
height: `${props.height / 16 + 1}rem`,
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
top: '-.5rem',
|
|
76
|
+
left: '-.5rem'
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default generateStyle;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { colorIndicatorBorderColor } from '../../ColorIndicator/theme';
|
|
25
|
+
/**
|
|
26
|
+
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
+
* @param {Object} theme The actual theme object.
|
|
28
|
+
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const generateComponentTheme = theme => {
|
|
32
|
+
const colors = theme.colors,
|
|
33
|
+
borders = theme.borders,
|
|
34
|
+
stacking = theme.stacking;
|
|
35
|
+
const componentVariables = {
|
|
36
|
+
indicatorBorderColor: colors.licorice,
|
|
37
|
+
whiteColor: colors.white,
|
|
38
|
+
colorIndicatorBorderColor,
|
|
39
|
+
indicatorBorderWidth: borders.widthSmall,
|
|
40
|
+
paletteBorderRadius: borders.radiusMedium,
|
|
41
|
+
paletteBorderWidth: borders.widthSmall,
|
|
42
|
+
disabledOverlayZIndex: stacking.topmost
|
|
43
|
+
};
|
|
44
|
+
return { ...componentVariables
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default generateComponentTheme;
|