@zendeskgarden/react-colorpickers 9.0.0-next.18 → 9.0.0-next.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/elements/ColorPicker/ColorWell.js +1 -1
- package/dist/esm/elements/ColorPicker/index.js +11 -11
- package/dist/esm/elements/ColorPickerDialog/index.js +1 -2
- package/dist/esm/elements/ColorSwatch/index.js +1 -1
- package/dist/esm/elements/ColorSwatchDialog/index.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledAlphaRange.js +3 -3
- package/dist/esm/styled/ColorPicker/StyledColorPicker.js +2 -2
- package/dist/esm/styled/ColorPicker/StyledColorWell.js +2 -2
- package/dist/esm/styled/ColorPicker/StyledColorWellThumb.js +23 -12
- package/dist/esm/styled/ColorPicker/StyledHexField.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledHueRange.js +2 -2
- package/dist/esm/styled/ColorPicker/StyledInput.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledInputGroup.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledLabel.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledPreview.js +5 -5
- package/dist/esm/styled/ColorPicker/StyledRGBAField.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledSliderGroup.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledSliders.js +25 -3
- package/dist/esm/styled/ColorPickerDialog/StyledButton.js +1 -1
- package/dist/esm/styled/ColorPickerDialog/StyledButtonPreview.js +11 -10
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipBody.js +1 -1
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipModal.js +1 -1
- package/dist/esm/styled/ColorSwatch/StyledCell.js +1 -1
- package/dist/esm/styled/ColorSwatch/StyledColorSwatch.js +1 -1
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchInput.js +1 -1
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchLabel.js +19 -6
- package/dist/esm/styled/ColorSwatch/StyledIcon.js +1 -1
- package/dist/esm/styled/common/StyledRange.js +38 -29
- package/dist/index.cjs.js +157 -102
- package/dist/typings/styled/ColorPicker/StyledAlphaRange.d.ts +2 -2
- package/dist/typings/styled/ColorPicker/StyledColorPicker.d.ts +1 -1
- package/dist/typings/styled/ColorPicker/StyledColorWell.d.ts +1 -1
- package/dist/typings/styled/ColorPicker/StyledPreview.d.ts +3 -3
- package/dist/typings/styled/ColorPicker/StyledSliders.d.ts +3 -2
- package/dist/typings/styled/ColorPickerDialog/StyledButtonPreview.d.ts +1 -1
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchLabel.d.ts +1 -1
- package/dist/typings/styled/common/StyledRange.d.ts +2 -2
- package/dist/typings/styled/types.d.ts +12 -0
- package/package.json +7 -7
|
@@ -134,27 +134,27 @@ const ColorPicker = forwardRef((_ref, ref) => {
|
|
|
134
134
|
}, [computedColor]);
|
|
135
135
|
return React__default.createElement(StyledColorPicker, Object.assign({
|
|
136
136
|
ref: ref,
|
|
137
|
-
isOpaque: isOpaque
|
|
137
|
+
$isOpaque: isOpaque
|
|
138
138
|
}, props), React__default.createElement(ColorWell, {
|
|
139
139
|
hue: computedColor.hue,
|
|
140
140
|
saturation: computedColor.saturation,
|
|
141
141
|
lightness: computedColor.lightness,
|
|
142
142
|
onChange: handleColorWellChange
|
|
143
143
|
}), React__default.createElement(StyledSliderGroup, null, React__default.createElement(StyledPreview, {
|
|
144
|
-
red: computedColor.red,
|
|
145
|
-
green: computedColor.green,
|
|
146
|
-
blue: computedColor.blue,
|
|
147
|
-
alpha: computedColor.alpha,
|
|
148
|
-
isOpaque: isOpaque
|
|
144
|
+
$red: computedColor.red,
|
|
145
|
+
$green: computedColor.green,
|
|
146
|
+
$blue: computedColor.blue,
|
|
147
|
+
$alpha: computedColor.alpha,
|
|
148
|
+
$isOpaque: isOpaque
|
|
149
149
|
}), React__default.createElement(StyledSliders, {
|
|
150
|
-
isOpaque: isOpaque
|
|
150
|
+
$isOpaque: isOpaque
|
|
151
151
|
}, React__default.createElement(Field, null, React__default.createElement(Field.Label, {
|
|
152
152
|
hidden: true
|
|
153
153
|
}, labels.hueSlider || 'Hue slider'), React__default.createElement(StyledHueRange, {
|
|
154
154
|
step: 1,
|
|
155
155
|
max: 360,
|
|
156
156
|
value: computedColor.hue,
|
|
157
|
-
isOpaque: isOpaque,
|
|
157
|
+
$isOpaque: isOpaque,
|
|
158
158
|
onChange: handleHueChange
|
|
159
159
|
})), !isOpaque && React__default.createElement(Field, null, React__default.createElement(Field.Label, {
|
|
160
160
|
hidden: true
|
|
@@ -163,9 +163,9 @@ const ColorPicker = forwardRef((_ref, ref) => {
|
|
|
163
163
|
step: 0.01,
|
|
164
164
|
value: computedColor.alpha / 100,
|
|
165
165
|
onChange: handleAlphaSliderChange,
|
|
166
|
-
red: computedColor.red,
|
|
167
|
-
green: computedColor.green,
|
|
168
|
-
blue: computedColor.blue
|
|
166
|
+
$red: computedColor.red,
|
|
167
|
+
$green: computedColor.green,
|
|
168
|
+
$blue: computedColor.blue
|
|
169
169
|
})))), React__default.createElement(StyledInputGroup, null, React__default.createElement(StyledHexField, null, React__default.createElement(StyledLabel, {
|
|
170
170
|
isRegular: true
|
|
171
171
|
}, labels.hex || 'Hex'), React__default.createElement(StyledInput, {
|
|
@@ -102,7 +102,7 @@ const ColorPickerDialog = forwardRef((_ref, ref) => {
|
|
|
102
102
|
ref: buttonRef,
|
|
103
103
|
onClick: onClick
|
|
104
104
|
}, buttonProps), React__default.createElement(StyledButtonPreview, {
|
|
105
|
-
backgroundColor: isControlled ? color : uncontrolledColor
|
|
105
|
+
$backgroundColor: isControlled ? color : uncontrolledColor
|
|
106
106
|
}), React__default.createElement(Button.EndIcon, {
|
|
107
107
|
isRotated: referenceElement != null
|
|
108
108
|
}, React__default.createElement(SvgChevronDownStroke, null))), React__default.createElement(StyledTooltipModal, Object.assign({
|
|
@@ -110,7 +110,6 @@ const ColorPickerDialog = forwardRef((_ref, ref) => {
|
|
|
110
110
|
hasArrow: hasArrow,
|
|
111
111
|
zIndex: zIndex,
|
|
112
112
|
isAnimated: isAnimated,
|
|
113
|
-
isOpaque: isOpaque,
|
|
114
113
|
focusOnMount: false,
|
|
115
114
|
placement: placement,
|
|
116
115
|
referenceElement: referenceElement,
|
|
@@ -119,7 +119,7 @@ const ColorSwatch = forwardRef((_ref, ref) => {
|
|
|
119
119
|
key: value,
|
|
120
120
|
role: role
|
|
121
121
|
}, React__default.createElement(StyledColorSwatchLabel, {
|
|
122
|
-
backgroundColor: value
|
|
122
|
+
$backgroundColor: value
|
|
123
123
|
}, React__default.createElement(Tooltip, {
|
|
124
124
|
content: label
|
|
125
125
|
}, React__default.createElement(StyledColorSwatchInput, Object.assign({
|
|
@@ -131,7 +131,7 @@ const ColorSwatchDialog = forwardRef((_ref, ref) => {
|
|
|
131
131
|
ref: buttonRef,
|
|
132
132
|
onClick: onClick
|
|
133
133
|
}, buttonProps), React__default.createElement(StyledButtonPreview, {
|
|
134
|
-
backgroundColor: backgroundColor
|
|
134
|
+
$backgroundColor: backgroundColor
|
|
135
135
|
}), React__default.createElement(Button.EndIcon, {
|
|
136
136
|
isRotated: referenceElement !== null
|
|
137
137
|
}, React__default.createElement(SvgChevronDownStroke, null))), React__default.createElement(StyledTooltipModal, Object.assign({
|
|
@@ -11,8 +11,8 @@ import { StyledRange, getTrackMargin, getTrackHeight } from '../common/StyledRan
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_alpha';
|
|
12
12
|
const background = props => {
|
|
13
13
|
const direction = `to ${props.theme.rtl ? 'left' : 'right'}`;
|
|
14
|
-
const fromColor = `rgba(${props
|
|
15
|
-
const toColor = `rgb(${props
|
|
14
|
+
const fromColor = `rgba(${props.$red}, ${props.$green}, ${props.$blue}, 0)`;
|
|
15
|
+
const toColor = `rgb(${props.$red}, ${props.$green}, ${props.$blue})`;
|
|
16
16
|
const positionY = getTrackMargin(props);
|
|
17
17
|
const height = getTrackHeight(props);
|
|
18
18
|
const overlay = `linear-gradient(${direction}, ${fromColor}, ${toColor}) 0 ${positionY}px / 100% ${height}px no-repeat`;
|
|
@@ -30,7 +30,7 @@ const StyledAlphaRange = styled(StyledRange).attrs(props => ({
|
|
|
30
30
|
background: background(props)
|
|
31
31
|
},
|
|
32
32
|
'data-garden-id': COMPONENT_ID,
|
|
33
|
-
'data-garden-version': '9.0.0-next.
|
|
33
|
+
'data-garden-version': '9.0.0-next.19'
|
|
34
34
|
})).withConfig({
|
|
35
35
|
displayName: "StyledAlphaRange",
|
|
36
36
|
componentId: "sc-1f6hp2j-0"
|
|
@@ -9,11 +9,11 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'colorpickers.colorpicker';
|
|
11
11
|
const getColorPickerWidth = props => {
|
|
12
|
-
return props
|
|
12
|
+
return props.$isOpaque ? 268 : 312;
|
|
13
13
|
};
|
|
14
14
|
const StyledColorPicker = styled.div.attrs({
|
|
15
15
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0-next.
|
|
16
|
+
'data-garden-version': '9.0.0-next.19'
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "StyledColorPicker",
|
|
19
19
|
componentId: "sc-gspq4q-0"
|
|
@@ -14,13 +14,13 @@ const background = props => {
|
|
|
14
14
|
const black = `linear-gradient(0deg, ${props.theme.palette.black}, ${blackAlpha} 1%, transparent 99%)`;
|
|
15
15
|
const whiteAngle = `${props.theme.rtl ? -90 : 90}deg`;
|
|
16
16
|
const white = `linear-gradient(${whiteAngle}, ${props.theme.palette.white} 1%, transparent)`;
|
|
17
|
-
const colorValue = hsl(props
|
|
17
|
+
const colorValue = hsl(props.$hue, 1, 0.5);
|
|
18
18
|
const color = `linear-gradient(${colorValue}, ${colorValue})`;
|
|
19
19
|
return `${black}, ${white}, ${color}`;
|
|
20
20
|
};
|
|
21
21
|
const StyledColorWell = styled.div.attrs(props => ({
|
|
22
22
|
'data-garden-id': COMPONENT_ID,
|
|
23
|
-
'data-garden-version': '9.0.0-next.
|
|
23
|
+
'data-garden-version': '9.0.0-next.19',
|
|
24
24
|
'data-test-id': 'colorwell',
|
|
25
25
|
style: {
|
|
26
26
|
background: background(props)
|
|
@@ -4,26 +4,37 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import styled from 'styled-components';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
8
|
import { stripUnit } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_colorwell_thumb';
|
|
12
|
-
const
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme
|
|
15
|
+
} = _ref;
|
|
16
|
+
const borderColor = getColor({
|
|
17
|
+
theme,
|
|
18
|
+
hue: 'white'
|
|
19
|
+
});
|
|
20
|
+
const boxShadow = `${theme.shadows.xs(getColor({
|
|
21
|
+
theme,
|
|
22
|
+
hue: 'black'
|
|
23
|
+
}))}`;
|
|
24
|
+
return css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
|
|
25
|
+
};
|
|
26
|
+
const sizeStyles = _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
theme
|
|
29
|
+
} = _ref2;
|
|
13
30
|
const borderWidth = stripUnit(theme.borderWidths.sm) * 2;
|
|
14
31
|
const size = theme.space.base * 5;
|
|
15
32
|
const translateValue = size / -2;
|
|
16
|
-
return
|
|
17
|
-
transform: translate(${translateValue}px, ${translateValue}px);
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
border-width: ${borderWidth}px;
|
|
20
|
-
width: ${size}px;
|
|
21
|
-
height: ${size}px;
|
|
22
|
-
`;
|
|
33
|
+
return css(["transform:translate(", "px,", "px);box-sizing:border-box;border-width:", "px;width:", "px;height:", "px;"], translateValue, translateValue, borderWidth, size, size);
|
|
23
34
|
};
|
|
24
35
|
const StyledColorWellThumb = styled.div.attrs(props => ({
|
|
25
36
|
'data-garden-id': COMPONENT_ID,
|
|
26
|
-
'data-garden-version': '9.0.0-next.
|
|
37
|
+
'data-garden-version': '9.0.0-next.19',
|
|
27
38
|
'data-test-id': 'colorwell-thumb',
|
|
28
39
|
style: {
|
|
29
40
|
top: `${props.top}%`,
|
|
@@ -32,7 +43,7 @@ const StyledColorWellThumb = styled.div.attrs(props => ({
|
|
|
32
43
|
})).withConfig({
|
|
33
44
|
displayName: "StyledColorWellThumb",
|
|
34
45
|
componentId: "sc-1npyab0-0"
|
|
35
|
-
})(["position:absolute;border:
|
|
46
|
+
})(["position:absolute;border:", ";border-radius:50%;", " ", " ", ";"], props => props.theme.borders.sm, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
47
|
StyledColorWellThumb.defaultProps = {
|
|
37
48
|
theme: DEFAULT_THEME
|
|
38
49
|
};
|
|
@@ -11,7 +11,7 @@ import { Field } from '@zendeskgarden/react-forms';
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_hex_field';
|
|
12
12
|
const StyledHexField = styled(Field).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.19',
|
|
15
15
|
spellcheck: false
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledHexField",
|
|
@@ -11,11 +11,11 @@ import { StyledRange, getTrackMargin, getTrackHeight } from '../common/StyledRan
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_hue';
|
|
12
12
|
const StyledHueRange = styled(StyledRange).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.19'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledHueRange",
|
|
17
17
|
componentId: "sc-1gdhww1-0"
|
|
18
|
-
})(["background:linear-gradient( to ", ",#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100% ) no-repeat;background-position:", ";background-size:100% ", "px;"], props => props.theme.rtl ? 'left' : 'right', props => !props
|
|
18
|
+
})(["background:linear-gradient( to ", ",#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100% ) no-repeat;background-position:", ";background-size:100% ", "px;"], props => props.theme.rtl ? 'left' : 'right', props => !props.$isOpaque && `0 ${getTrackMargin(props)}px`, props => getTrackHeight(props));
|
|
19
19
|
StyledHueRange.defaultProps = {
|
|
20
20
|
theme: DEFAULT_THEME
|
|
21
21
|
};
|
|
@@ -11,7 +11,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_input';
|
|
12
12
|
const StyledInput = styled(Input).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.19',
|
|
15
15
|
focusInset: false
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledInput",
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'colorpickers.colorpicker_input_group';
|
|
11
11
|
const StyledInputGroup = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledInputGroup",
|
|
16
16
|
componentId: "sc-1m9g2wg-0"
|
|
@@ -11,7 +11,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_label';
|
|
12
12
|
const StyledLabel = styled(Label).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.19'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledLabel",
|
|
17
17
|
componentId: "sc-1vxt3m9-0"
|
|
@@ -10,9 +10,9 @@ import { retrieveComponentStyles, DEFAULT_THEME, getCheckeredBackground } from '
|
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_preview_box';
|
|
12
12
|
const background = props => {
|
|
13
|
-
const alpha = props
|
|
14
|
-
let retVal = `rgba(${props
|
|
15
|
-
if (!props
|
|
13
|
+
const alpha = props.$alpha ? props.$alpha / 100 : 0;
|
|
14
|
+
let retVal = `rgba(${props.$red}, ${props.$green}, ${props.$blue}, ${alpha})`;
|
|
15
|
+
if (!props.$isOpaque) {
|
|
16
16
|
retVal = getCheckeredBackground({
|
|
17
17
|
theme: props.theme,
|
|
18
18
|
size: 13,
|
|
@@ -26,12 +26,12 @@ const StyledPreview = styled.div.attrs(props => ({
|
|
|
26
26
|
background: background(props)
|
|
27
27
|
},
|
|
28
28
|
'data-garden-id': COMPONENT_ID,
|
|
29
|
-
'data-garden-version': '9.0.0-next.
|
|
29
|
+
'data-garden-version': '9.0.0-next.19',
|
|
30
30
|
'data-test-id': 'preview-box'
|
|
31
31
|
})).withConfig({
|
|
32
32
|
displayName: "StyledPreview",
|
|
33
33
|
componentId: "sc-1z5nh7-0"
|
|
34
|
-
})(["flex-shrink:0;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.borderRadii.md, props => props.theme.borderWidths.sm, props => rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * (props
|
|
34
|
+
})(["flex-shrink:0;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.borderRadii.md, props => props.theme.borderWidths.sm, props => rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * (props.$isOpaque ? 6 : 8), props => props.theme.space.base * (props.$isOpaque ? 6 : 8), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
35
35
|
StyledPreview.defaultProps = {
|
|
36
36
|
theme: DEFAULT_THEME
|
|
37
37
|
};
|
|
@@ -20,7 +20,7 @@ const sizeStyles = theme => {
|
|
|
20
20
|
};
|
|
21
21
|
const StyledRGBAField = styled(Field).attrs({
|
|
22
22
|
'data-garden-id': COMPONENT_ID,
|
|
23
|
-
'data-garden-version': '9.0.0-next.
|
|
23
|
+
'data-garden-version': '9.0.0-next.19'
|
|
24
24
|
}).withConfig({
|
|
25
25
|
displayName: "StyledRGBAField",
|
|
26
26
|
componentId: "sc-13266k8-0"
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'colorpickers.colorpicker_slider_group';
|
|
11
11
|
const StyledSliderGroup = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledSliderGroup",
|
|
16
16
|
componentId: "sc-tigkzg-0"
|
|
@@ -6,16 +6,38 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
-
import {
|
|
9
|
+
import { getTrackHeight, getTrackMargin } from '../common/StyledRange.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_sliders';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
if (props.$isOpaque) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const trackHeight = getTrackHeight(props);
|
|
17
|
+
const trackMargin = getTrackMargin(props);
|
|
18
|
+
return `
|
|
19
|
+
& > * {
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: ${trackMargin * 2 + trackHeight}px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
& > :first-child {
|
|
26
|
+
top: -${trackMargin}px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
& > :last-child {
|
|
30
|
+
bottom: -${trackMargin}px;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
};
|
|
12
34
|
const StyledSliders = styled.div.attrs({
|
|
13
35
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
36
|
+
'data-garden-version': '9.0.0-next.19'
|
|
15
37
|
}).withConfig({
|
|
16
38
|
displayName: "StyledSliders",
|
|
17
39
|
componentId: "sc-1lgr50m-0"
|
|
18
|
-
})(["position:relative;margin-", ":", "px;width:100
|
|
40
|
+
})(["position:relative;margin-", ":", "px;width:100%;", " ", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 2, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
41
|
StyledSliders.defaultProps = {
|
|
20
42
|
theme: DEFAULT_THEME
|
|
21
43
|
};
|
|
@@ -10,7 +10,7 @@ import { Button } from '@zendeskgarden/react-buttons';
|
|
|
10
10
|
|
|
11
11
|
const StyledButton = styled(Button).attrs({
|
|
12
12
|
isNeutral: true,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledButton",
|
|
16
16
|
componentId: "sc-1dlijfv-0"
|
|
@@ -9,22 +9,23 @@ import { rgba } from 'polished';
|
|
|
9
9
|
import { getCheckeredBackground, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colordialog_preview';
|
|
12
|
-
const background =
|
|
13
|
-
|
|
14
|
-
backgroundColor
|
|
15
|
-
|
|
12
|
+
const background = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
$backgroundColor,
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
16
17
|
let retVal;
|
|
17
|
-
if (typeof backgroundColor === 'string') {
|
|
18
|
-
retVal = backgroundColor;
|
|
19
|
-
} else if (backgroundColor === undefined) {
|
|
20
|
-
retVal =
|
|
18
|
+
if (typeof $backgroundColor === 'string') {
|
|
19
|
+
retVal = $backgroundColor;
|
|
20
|
+
} else if ($backgroundColor === undefined) {
|
|
21
|
+
retVal = theme.palette.white;
|
|
21
22
|
} else {
|
|
22
23
|
const {
|
|
23
24
|
red,
|
|
24
25
|
green,
|
|
25
26
|
blue,
|
|
26
27
|
alpha = 1
|
|
27
|
-
} = backgroundColor;
|
|
28
|
+
} = $backgroundColor;
|
|
28
29
|
retVal = `rgba(${red}, ${green}, ${blue}, ${alpha ? alpha / 100 : 0})`;
|
|
29
30
|
}
|
|
30
31
|
return retVal;
|
|
@@ -38,7 +39,7 @@ const StyledButtonPreview = styled.span.attrs(props => ({
|
|
|
38
39
|
})
|
|
39
40
|
},
|
|
40
41
|
'data-garden-id': COMPONENT_ID,
|
|
41
|
-
'data-garden-version': '9.0.0-next.
|
|
42
|
+
'data-garden-version': '9.0.0-next.19',
|
|
42
43
|
'data-test-id': 'dialog-preview'
|
|
43
44
|
})).withConfig({
|
|
44
45
|
displayName: "StyledButtonPreview",
|
|
@@ -11,7 +11,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colordialog_tooltipmodal_body';
|
|
12
12
|
const StyledTooltipBody = styled(TooltipModal.Body).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.19'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledTooltipBody",
|
|
17
17
|
componentId: "sc-1ueddpo-0"
|
|
@@ -11,7 +11,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colordialog_tooltipmodal';
|
|
12
12
|
const StyledTooltipModal = styled(TooltipModal).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.19'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledTooltipModal",
|
|
17
17
|
componentId: "sc-gykkrw-0"
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'colorpickers.swatch_cell';
|
|
11
11
|
const StyledCell = styled.td.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledCell",
|
|
16
16
|
componentId: "sc-qr3oit-0"
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'colorpickers.color_swatch';
|
|
11
11
|
const StyledColorSwatch = styled.table.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledColorSwatch",
|
|
16
16
|
componentId: "sc-ajx440-0"
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'colorpickers.color_swatch_input';
|
|
11
11
|
const StyledColorSwatchInput = styled.input.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.19'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledColorSwatchInput",
|
|
16
16
|
componentId: "sc-em45h0-0"
|
|
@@ -6,17 +6,30 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { parseToRgb, readableColor } from 'polished';
|
|
9
|
-
import { focusStyles, retrieveComponentStyles, DEFAULT_THEME,
|
|
9
|
+
import { focusStyles, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledButtonPreview } from '../ColorPickerDialog/StyledButtonPreview.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'colorpickers.color_swatch_label';
|
|
13
|
-
const colorStyles =
|
|
13
|
+
const colorStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
$backgroundColor,
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
14
18
|
const {
|
|
15
19
|
alpha
|
|
16
|
-
} = parseToRgb(
|
|
17
|
-
|
|
20
|
+
} = parseToRgb($backgroundColor);
|
|
21
|
+
const returnIfLightColor = getColor({
|
|
22
|
+
theme,
|
|
23
|
+
hue: 'neutralHue',
|
|
24
|
+
shade: 900
|
|
25
|
+
});
|
|
26
|
+
let foregroundColor = returnIfLightColor;
|
|
18
27
|
if (alpha === undefined || alpha >= 0.4) {
|
|
19
|
-
|
|
28
|
+
const returnIfDarkColor = getColor({
|
|
29
|
+
theme,
|
|
30
|
+
hue: 'white'
|
|
31
|
+
});
|
|
32
|
+
foregroundColor = readableColor($backgroundColor, returnIfLightColor, returnIfDarkColor, false );
|
|
20
33
|
}
|
|
21
34
|
return `
|
|
22
35
|
color: ${foregroundColor};
|
|
@@ -25,7 +38,7 @@ const colorStyles = props => {
|
|
|
25
38
|
const StyledColorSwatchLabel = styled(StyledButtonPreview).attrs({
|
|
26
39
|
as: 'label',
|
|
27
40
|
'data-garden-id': COMPONENT_ID,
|
|
28
|
-
'data-garden-version': '9.0.0-next.
|
|
41
|
+
'data-garden-version': '9.0.0-next.19'
|
|
29
42
|
}).withConfig({
|
|
30
43
|
displayName: "StyledColorSwatchLabel",
|
|
31
44
|
componentId: "sc-1aghocg-0"
|
|
@@ -12,7 +12,7 @@ import { StyledColorSwatchInput } from './StyledColorSwatchInput.js';
|
|
|
12
12
|
const COMPONENT_ID = 'colorpickers.colorswatch_check';
|
|
13
13
|
const StyledIcon = styled(SvgCheckSmFill).attrs({
|
|
14
14
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
15
|
+
'data-garden-version': '9.0.0-next.19'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledIcon",
|
|
18
18
|
componentId: "sc-8oigif-0"
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Range } from '@zendeskgarden/react-forms';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
import { stripUnit
|
|
10
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
9
|
+
import { stripUnit } from 'polished';
|
|
10
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'colorpickers.colorpicker_range';
|
|
13
13
|
const thumbStyles = function (styles) {
|
|
@@ -54,17 +54,36 @@ const trackLowerStyles = function (styles) {
|
|
|
54
54
|
}
|
|
55
55
|
`;
|
|
56
56
|
};
|
|
57
|
-
const colorStyles =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
const colorStyles = _ref => {
|
|
58
|
+
let {
|
|
59
|
+
theme
|
|
60
|
+
} = _ref;
|
|
61
|
+
const thumbBackgroundColor = getColor({
|
|
62
|
+
theme,
|
|
63
|
+
variable: 'background.default'
|
|
64
|
+
});
|
|
65
|
+
const thumbBorderColor = getColor({
|
|
66
|
+
theme,
|
|
67
|
+
variable: 'border.default',
|
|
68
|
+
dark: {
|
|
69
|
+
offset: -100
|
|
70
|
+
},
|
|
71
|
+
light: {
|
|
72
|
+
offset: 100
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const thumbActiveBackgroundColor = thumbBackgroundColor;
|
|
76
|
+
const thumbActiveBorderColor = getColor({
|
|
77
|
+
theme,
|
|
78
|
+
variable: 'border.primaryEmphasis'
|
|
79
|
+
});
|
|
80
|
+
const thumbFocusBorderColor = thumbActiveBorderColor;
|
|
81
|
+
const thumbHoverBackgroundColor = getColor({
|
|
82
|
+
theme,
|
|
83
|
+
variable: 'background.subtle'
|
|
84
|
+
});
|
|
85
|
+
const thumbHoverBorderColor = thumbActiveBorderColor;
|
|
65
86
|
return `
|
|
66
|
-
border-color: ${props.isOpaque && getColorV8('background', 600 , props.theme)};
|
|
67
|
-
|
|
68
87
|
${trackStyles(`
|
|
69
88
|
background-color: transparent;
|
|
70
89
|
`)}
|
|
@@ -94,32 +113,22 @@ const colorStyles = props => {
|
|
|
94
113
|
`, ':active')}
|
|
95
114
|
`;
|
|
96
115
|
};
|
|
97
|
-
const getThumbSize = props => props.theme.space.base * (props
|
|
98
|
-
const getTrackHeight = props => props.theme.space.base * (props
|
|
116
|
+
const getThumbSize = props => props.theme.space.base * (props.$isOpaque ? 6 : 4);
|
|
117
|
+
const getTrackHeight = props => props.theme.space.base * (props.$isOpaque ? 6 : 3);
|
|
99
118
|
const getTrackMargin = props => (getThumbSize(props) - getTrackHeight(props)) / 2 + stripUnit(props.theme.shadowWidths.md);
|
|
100
119
|
const sizeStyles = props => {
|
|
101
120
|
const thumbSize = getThumbSize(props);
|
|
102
121
|
const trackHeight = getTrackHeight(props);
|
|
103
122
|
const trackMargin = getTrackMargin(props);
|
|
104
123
|
const thumbMargin = (trackHeight - thumbSize) / 2;
|
|
105
|
-
const trackOffset = props.theme.space.base * (props
|
|
106
|
-
const height = props
|
|
107
|
-
let marginHorizontal;
|
|
108
|
-
let border;
|
|
109
|
-
let borderRadius;
|
|
110
|
-
if (props.isOpaque) {
|
|
111
|
-
marginHorizontal = `-${trackMargin}px`;
|
|
112
|
-
border = `${trackMargin}px ${props.theme.borderStyles.solid}`;
|
|
113
|
-
borderRadius = `${trackMargin + stripUnit(props.theme.shadowWidths.md)}px`;
|
|
114
|
-
}
|
|
124
|
+
const trackOffset = props.theme.space.base * (props.$isOpaque ? -2 : -1);
|
|
125
|
+
const height = props.$isOpaque ? trackHeight : trackMargin * 2 + trackHeight;
|
|
115
126
|
return `
|
|
116
127
|
/* stylelint-disable-next-line declaration-no-important */
|
|
117
128
|
margin-top: 0 !important;
|
|
118
|
-
margin-${props.theme.rtl ? 'right' : 'left'}: ${marginHorizontal};
|
|
119
129
|
height: ${height}px; /* [1] */
|
|
120
130
|
box-sizing: content-box; /* [2] */
|
|
121
|
-
border: ${
|
|
122
|
-
border-radius: ${borderRadius};
|
|
131
|
+
border-radius: ${props.$isOpaque && props.theme.borderRadii.md};
|
|
123
132
|
|
|
124
133
|
${trackStyles(`
|
|
125
134
|
margin: ${trackMargin}px ${trackOffset}px;
|
|
@@ -128,7 +137,7 @@ const sizeStyles = props => {
|
|
|
128
137
|
|
|
129
138
|
${thumbStyles(`
|
|
130
139
|
margin: ${thumbMargin}px 0;
|
|
131
|
-
border-width: ${
|
|
140
|
+
border-width: ${props.theme.borderWidths.sm};
|
|
132
141
|
height: ${thumbSize}px;
|
|
133
142
|
width: ${thumbSize}px;
|
|
134
143
|
`)};
|
|
@@ -136,7 +145,7 @@ const sizeStyles = props => {
|
|
|
136
145
|
};
|
|
137
146
|
const StyledRange = styled(Range).attrs({
|
|
138
147
|
'data-garden-id': COMPONENT_ID,
|
|
139
|
-
'data-garden-version': '9.0.0-next.
|
|
148
|
+
'data-garden-version': '9.0.0-next.19',
|
|
140
149
|
hasLowerTrack: false
|
|
141
150
|
}).withConfig({
|
|
142
151
|
displayName: "StyledRange",
|