@zendeskgarden/react-colorpickers 9.0.0-next.9 → 9.0.0
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 +10 -12
- package/dist/esm/elements/ColorPicker/index.js +12 -12
- package/dist/esm/elements/ColorPickerDialog/index.js +7 -5
- package/dist/esm/elements/ColorSwatch/index.js +64 -61
- package/dist/esm/elements/ColorSwatchDialog/index.js +7 -4
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +1 -1
- package/dist/esm/styled/ColorPicker/StyledAlphaRange.js +4 -7
- package/dist/esm/styled/ColorPicker/StyledColorPicker.js +3 -6
- package/dist/esm/styled/ColorPicker/StyledColorWell.js +3 -6
- package/dist/esm/styled/ColorPicker/StyledColorWellThumb.js +23 -15
- package/dist/esm/styled/ColorPicker/StyledHexField.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledHueRange.js +2 -6
- package/dist/esm/styled/ColorPicker/StyledInput.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledInputGroup.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledLabel.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledPreview.js +6 -9
- package/dist/esm/styled/ColorPicker/StyledRGBAField.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledSliderGroup.js +2 -5
- package/dist/esm/styled/ColorPicker/StyledSliders.js +26 -7
- package/dist/esm/styled/ColorPickerDialog/StyledButton.js +2 -8
- package/dist/esm/styled/ColorPickerDialog/StyledButtonPreview.js +12 -14
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipBody.js +5 -8
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipDialog.js +20 -0
- package/dist/esm/styled/ColorSwatch/StyledCell.js +2 -5
- package/dist/esm/styled/ColorSwatch/StyledColorSwatch.js +2 -5
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchInput.js +2 -5
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchLabel.js +19 -9
- package/dist/esm/styled/ColorSwatch/StyledIcon.js +2 -5
- package/dist/esm/styled/common/StyledRange.js +38 -32
- package/dist/index.cjs.js +277 -288
- 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/StyledButton.d.ts +0 -1
- package/dist/typings/styled/ColorPickerDialog/StyledButtonPreview.d.ts +1 -1
- package/dist/typings/styled/ColorPickerDialog/{StyledTooltipModal.d.ts → StyledTooltipDialog.d.ts} +2 -2
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchLabel.d.ts +1 -1
- package/dist/typings/styled/common/StyledRange.d.ts +2 -2
- package/dist/typings/styled/index.d.ts +1 -1
- package/dist/typings/styled/types.d.ts +12 -0
- package/dist/typings/types/index.d.ts +9 -9
- package/package.json +11 -12
- package/LICENSE.md +0 -176
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipModal.js +0 -23
|
@@ -24,7 +24,7 @@ import '../../styled/ColorPicker/StyledRGBAField.js';
|
|
|
24
24
|
import '../../styled/ColorPicker/StyledSliders.js';
|
|
25
25
|
import '../../styled/ColorPickerDialog/StyledButton.js';
|
|
26
26
|
import '../../styled/ColorPickerDialog/StyledButtonPreview.js';
|
|
27
|
-
import '../../styled/ColorPickerDialog/
|
|
27
|
+
import '../../styled/ColorPickerDialog/StyledTooltipDialog.js';
|
|
28
28
|
import '../../styled/ColorPickerDialog/StyledTooltipBody.js';
|
|
29
29
|
import '../../styled/ColorSwatch/StyledColorSwatch.js';
|
|
30
30
|
import '../../styled/ColorSwatch/StyledColorSwatchInput.js';
|
|
@@ -93,17 +93,15 @@ const ColorWell = React__default.memo(_ref => {
|
|
|
93
93
|
throttledChange.cancel();
|
|
94
94
|
};
|
|
95
95
|
}, [throttledChange]);
|
|
96
|
-
return (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}))
|
|
106
|
-
);
|
|
96
|
+
return React__default.createElement(StyledColorWell, {
|
|
97
|
+
$hue: hue,
|
|
98
|
+
ref: containerRef,
|
|
99
|
+
role: "presentation",
|
|
100
|
+
onMouseDown: handleMouseDown
|
|
101
|
+
}, React__default.createElement(StyledColorWellThumb, {
|
|
102
|
+
top: mouseActiveRef.current ? topFromMouse : topPosition,
|
|
103
|
+
left: mouseActiveRef.current ? leftFromMouse : leftPosition
|
|
104
|
+
}));
|
|
107
105
|
});
|
|
108
106
|
ColorWell.displayName = 'ColorWell';
|
|
109
107
|
|
|
@@ -23,7 +23,7 @@ import { StyledRGBAField } from '../../styled/ColorPicker/StyledRGBAField.js';
|
|
|
23
23
|
import { StyledSliders } from '../../styled/ColorPicker/StyledSliders.js';
|
|
24
24
|
import '../../styled/ColorPickerDialog/StyledButton.js';
|
|
25
25
|
import '../../styled/ColorPickerDialog/StyledButtonPreview.js';
|
|
26
|
-
import '../../styled/ColorPickerDialog/
|
|
26
|
+
import '../../styled/ColorPickerDialog/StyledTooltipDialog.js';
|
|
27
27
|
import '../../styled/ColorPickerDialog/StyledTooltipBody.js';
|
|
28
28
|
import '../../styled/ColorSwatch/StyledColorSwatch.js';
|
|
29
29
|
import '../../styled/ColorSwatch/StyledColorSwatchInput.js';
|
|
@@ -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, {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React__default, { forwardRef, useRef, useState, useEffect, cloneElement, Children } from 'react';
|
|
8
|
+
import { useTheme } from 'styled-components';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import { Button } from '@zendeskgarden/react-buttons';
|
|
10
11
|
import { PLACEMENT } from '@zendeskgarden/react-modals';
|
|
@@ -26,14 +27,14 @@ import '../../styled/ColorPicker/StyledRGBAField.js';
|
|
|
26
27
|
import '../../styled/ColorPicker/StyledSliders.js';
|
|
27
28
|
import { StyledButton } from '../../styled/ColorPickerDialog/StyledButton.js';
|
|
28
29
|
import { StyledButtonPreview } from '../../styled/ColorPickerDialog/StyledButtonPreview.js';
|
|
29
|
-
import {
|
|
30
|
+
import { StyledTooltipDialog } from '../../styled/ColorPickerDialog/StyledTooltipDialog.js';
|
|
30
31
|
import { StyledTooltipBody } from '../../styled/ColorPickerDialog/StyledTooltipBody.js';
|
|
31
32
|
import '../../styled/ColorSwatch/StyledColorSwatch.js';
|
|
32
33
|
import '../../styled/ColorSwatch/StyledColorSwatchInput.js';
|
|
33
34
|
import '../../styled/ColorSwatch/StyledColorSwatchLabel.js';
|
|
34
35
|
import '../../styled/ColorSwatch/StyledIcon.js';
|
|
35
36
|
import '../../styled/ColorSwatch/StyledCell.js';
|
|
36
|
-
import { useText } from '@zendeskgarden/react-theming';
|
|
37
|
+
import { useText, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
37
38
|
|
|
38
39
|
const ColorPickerDialog = forwardRef((_ref, ref) => {
|
|
39
40
|
let {
|
|
@@ -65,6 +66,7 @@ const ColorPickerDialog = forwardRef((_ref, ref) => {
|
|
|
65
66
|
const ariaLabelText = useText(ColorPickerDialog, {
|
|
66
67
|
'aria-label': ariaLabel
|
|
67
68
|
}, 'aria-label', 'Color picker');
|
|
69
|
+
const theme = useTheme() || DEFAULT_THEME;
|
|
68
70
|
const openDialog = () => {
|
|
69
71
|
setReferenceElement(buttonRef.current);
|
|
70
72
|
onDialogChange && onDialogChange({
|
|
@@ -102,17 +104,17 @@ const ColorPickerDialog = forwardRef((_ref, ref) => {
|
|
|
102
104
|
ref: buttonRef,
|
|
103
105
|
onClick: onClick
|
|
104
106
|
}, buttonProps), React__default.createElement(StyledButtonPreview, {
|
|
105
|
-
backgroundColor: isControlled ? color : uncontrolledColor
|
|
107
|
+
$backgroundColor: isControlled ? color : uncontrolledColor
|
|
106
108
|
}), React__default.createElement(Button.EndIcon, {
|
|
107
109
|
isRotated: referenceElement != null
|
|
108
|
-
}, React__default.createElement(SvgChevronDownStroke, null))), React__default.createElement(
|
|
110
|
+
}, React__default.createElement(SvgChevronDownStroke, null))), React__default.createElement(StyledTooltipDialog, Object.assign({
|
|
109
111
|
ref: ref,
|
|
110
112
|
hasArrow: hasArrow,
|
|
111
113
|
zIndex: zIndex,
|
|
112
114
|
isAnimated: isAnimated,
|
|
113
|
-
isOpaque: isOpaque,
|
|
114
115
|
focusOnMount: false,
|
|
115
116
|
placement: placement,
|
|
117
|
+
offset: theme.space.base,
|
|
116
118
|
referenceElement: referenceElement,
|
|
117
119
|
onClose: () => {
|
|
118
120
|
closeDialog();
|
|
@@ -27,7 +27,7 @@ import '../../styled/ColorPicker/StyledRGBAField.js';
|
|
|
27
27
|
import '../../styled/ColorPicker/StyledSliders.js';
|
|
28
28
|
import '../../styled/ColorPickerDialog/StyledButton.js';
|
|
29
29
|
import '../../styled/ColorPickerDialog/StyledButtonPreview.js';
|
|
30
|
-
import '../../styled/ColorPickerDialog/
|
|
30
|
+
import '../../styled/ColorPickerDialog/StyledTooltipDialog.js';
|
|
31
31
|
import '../../styled/ColorPickerDialog/StyledTooltipBody.js';
|
|
32
32
|
import { StyledColorSwatch } from '../../styled/ColorSwatch/StyledColorSwatch.js';
|
|
33
33
|
import { StyledColorSwatchInput } from '../../styled/ColorSwatch/StyledColorSwatchInput.js';
|
|
@@ -70,69 +70,72 @@ const ColorSwatch = forwardRef((_ref, ref) => {
|
|
|
70
70
|
setColIndex(col);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
if (isCheckboxGroup && event.target.checked) {
|
|
101
|
-
const inputs = gridRef.current?.querySelectorAll('input');
|
|
102
|
-
inputs?.forEach(input => {
|
|
103
|
-
if (input !== event.target) {
|
|
104
|
-
input.checked = false;
|
|
73
|
+
return (
|
|
74
|
+
React__default.createElement(StyledColorSwatch, Object.assign({
|
|
75
|
+
role: "grid",
|
|
76
|
+
ref: mergeRefs([gridRef, ref])
|
|
77
|
+
}, props), React__default.createElement("tbody", null, colors.map((row, _rowIndex) => React__default.createElement("tr", {
|
|
78
|
+
key: row[0].value
|
|
79
|
+
}, row.map((color, _colIndex) => {
|
|
80
|
+
const {
|
|
81
|
+
label,
|
|
82
|
+
value
|
|
83
|
+
} = color;
|
|
84
|
+
const {
|
|
85
|
+
role,
|
|
86
|
+
...gridCellProps
|
|
87
|
+
} = getGridCellProps({
|
|
88
|
+
colIndex: _colIndex,
|
|
89
|
+
rowIndex: _rowIndex
|
|
90
|
+
});
|
|
91
|
+
const checked = isControlled ? selectedRowIndex === _rowIndex && selectedColIndex === _colIndex : undefined;
|
|
92
|
+
const defaultChecked = isControlled ? undefined : defaultSelectedRowIndex === _rowIndex && defaultSelectedColIndex === _colIndex;
|
|
93
|
+
const handleChange = event => {
|
|
94
|
+
if (onSelect) {
|
|
95
|
+
if (event.target.checked) {
|
|
96
|
+
onSelect(_rowIndex, _colIndex);
|
|
97
|
+
} else {
|
|
98
|
+
onSelect(null, null);
|
|
105
99
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
const handleBlur = event => {
|
|
110
|
-
if (!(isCheckboxGroup || gridRef.current?.contains(event.relatedTarget))) {
|
|
111
|
-
const selectedInput = gridRef.current?.querySelector(`input[name='${event.target.name}']:checked`);
|
|
112
|
-
if (selectedInput !== null) {
|
|
100
|
+
}
|
|
101
|
+
if (isCheckboxGroup && event.target.checked) {
|
|
113
102
|
const inputs = gridRef.current?.querySelectorAll('input');
|
|
114
|
-
inputs?.forEach(input =>
|
|
103
|
+
inputs?.forEach(input => {
|
|
104
|
+
if (input !== event.target) {
|
|
105
|
+
input.checked = false;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const handleBlur = event => {
|
|
111
|
+
if (!(isCheckboxGroup || gridRef.current?.contains(event.relatedTarget))) {
|
|
112
|
+
const selectedInput = gridRef.current?.querySelector(`input[name='${event.target.name}']:checked`);
|
|
113
|
+
if (selectedInput !== null) {
|
|
114
|
+
const inputs = gridRef.current?.querySelectorAll('input');
|
|
115
|
+
inputs?.forEach(input => input.setAttribute('tabIndex', input.checked ? '0' : '-1'));
|
|
116
|
+
}
|
|
115
117
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
118
|
+
};
|
|
119
|
+
return React__default.createElement(StyledCell, {
|
|
120
|
+
key: value,
|
|
121
|
+
role: role
|
|
122
|
+
}, React__default.createElement(StyledColorSwatchLabel, {
|
|
123
|
+
$backgroundColor: value
|
|
124
|
+
}, React__default.createElement(Tooltip, {
|
|
125
|
+
content: label,
|
|
126
|
+
zIndex: 1
|
|
127
|
+
}, React__default.createElement(StyledColorSwatchInput, Object.assign({
|
|
128
|
+
"aria-label": label,
|
|
129
|
+
name: name,
|
|
130
|
+
type: isCheckboxGroup ? 'checkbox' : 'radio',
|
|
131
|
+
value: value,
|
|
132
|
+
defaultChecked: defaultChecked,
|
|
133
|
+
checked: checked,
|
|
134
|
+
onBlur: handleBlur,
|
|
135
|
+
onChange: handleChange
|
|
136
|
+
}, gridCellProps))), React__default.createElement(StyledIcon, null)));
|
|
137
|
+
})))))
|
|
138
|
+
);
|
|
136
139
|
});
|
|
137
140
|
ColorSwatch.displayName = 'ColorSwatch';
|
|
138
141
|
ColorSwatch.propTypes = {
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import React__default, { forwardRef, useRef, useState, useEffect, cloneElement, Children } from 'react';
|
|
8
|
+
import { useTheme } from 'styled-components';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import { Button } from '@zendeskgarden/react-buttons';
|
|
10
11
|
import { PLACEMENT } from '@zendeskgarden/react-modals';
|
|
11
|
-
import { useText } from '@zendeskgarden/react-theming';
|
|
12
|
+
import { DEFAULT_THEME, useText } from '@zendeskgarden/react-theming';
|
|
12
13
|
import { composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
13
14
|
import SvgChevronDownStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js';
|
|
14
15
|
import { ColorSwatch } from '../ColorSwatch/index.js';
|
|
@@ -27,7 +28,7 @@ import '../../styled/ColorPicker/StyledRGBAField.js';
|
|
|
27
28
|
import '../../styled/ColorPicker/StyledSliders.js';
|
|
28
29
|
import { StyledButton } from '../../styled/ColorPickerDialog/StyledButton.js';
|
|
29
30
|
import { StyledButtonPreview } from '../../styled/ColorPickerDialog/StyledButtonPreview.js';
|
|
30
|
-
import {
|
|
31
|
+
import { StyledTooltipDialog } from '../../styled/ColorPickerDialog/StyledTooltipDialog.js';
|
|
31
32
|
import { StyledTooltipBody } from '../../styled/ColorPickerDialog/StyledTooltipBody.js';
|
|
32
33
|
import '../../styled/ColorSwatch/StyledColorSwatch.js';
|
|
33
34
|
import '../../styled/ColorSwatch/StyledColorSwatchInput.js';
|
|
@@ -65,6 +66,7 @@ const ColorSwatchDialog = forwardRef((_ref, ref) => {
|
|
|
65
66
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
66
67
|
const [rowIndex, setRowIndex] = useState(defaultSelectedRowIndex);
|
|
67
68
|
const [colIndex, setColIndex] = useState(defaultSelectedColIndex);
|
|
69
|
+
const theme = useTheme() || DEFAULT_THEME;
|
|
68
70
|
let backgroundColor;
|
|
69
71
|
if (isControlled) {
|
|
70
72
|
if (selectedRowIndex !== null && selectedColIndex !== null) {
|
|
@@ -131,15 +133,16 @@ const ColorSwatchDialog = forwardRef((_ref, ref) => {
|
|
|
131
133
|
ref: buttonRef,
|
|
132
134
|
onClick: onClick
|
|
133
135
|
}, buttonProps), React__default.createElement(StyledButtonPreview, {
|
|
134
|
-
backgroundColor: backgroundColor
|
|
136
|
+
$backgroundColor: backgroundColor
|
|
135
137
|
}), React__default.createElement(Button.EndIcon, {
|
|
136
138
|
isRotated: referenceElement !== null
|
|
137
|
-
}, React__default.createElement(SvgChevronDownStroke, null))), React__default.createElement(
|
|
139
|
+
}, React__default.createElement(SvgChevronDownStroke, null))), React__default.createElement(StyledTooltipDialog, Object.assign({
|
|
138
140
|
ref: ref,
|
|
139
141
|
zIndex: zIndex,
|
|
140
142
|
hasArrow: hasArrow,
|
|
141
143
|
focusOnMount: false,
|
|
142
144
|
placement: placement,
|
|
145
|
+
offset: theme.space.base,
|
|
143
146
|
isAnimated: isAnimated,
|
|
144
147
|
referenceElement: referenceElement,
|
|
145
148
|
onClose: closeDialog,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
11
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { getCheckeredBackground } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledRange, getTrackMargin, getTrackHeight } from '../common/StyledRange.js';
|
|
10
10
|
|
|
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,13 +30,10 @@ 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
|
|
33
|
+
'data-garden-version': '9.0.0'
|
|
34
34
|
})).withConfig({
|
|
35
35
|
displayName: "StyledAlphaRange",
|
|
36
36
|
componentId: "sc-1f6hp2j-0"
|
|
37
37
|
})([""]);
|
|
38
|
-
StyledAlphaRange.defaultProps = {
|
|
39
|
-
theme: DEFAULT_THEME
|
|
40
|
-
};
|
|
41
38
|
|
|
42
39
|
export { StyledAlphaRange };
|
|
@@ -5,21 +5,18 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
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
|
|
16
|
+
'data-garden-version': '9.0.0'
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "StyledColorPicker",
|
|
19
19
|
componentId: "sc-gspq4q-0"
|
|
20
20
|
})(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
|
-
StyledColorPicker.defaultProps = {
|
|
22
|
-
theme: DEFAULT_THEME
|
|
23
|
-
};
|
|
24
21
|
|
|
25
22
|
export { StyledColorPicker, getColorPickerWidth };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { rgba, hsl } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_colorwell';
|
|
12
12
|
const background = props => {
|
|
@@ -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
|
|
23
|
+
'data-garden-version': '9.0.0',
|
|
24
24
|
'data-test-id': 'colorwell',
|
|
25
25
|
style: {
|
|
26
26
|
background: background(props)
|
|
@@ -29,8 +29,5 @@ const StyledColorWell = styled.div.attrs(props => ({
|
|
|
29
29
|
displayName: "StyledColorWell",
|
|
30
30
|
componentId: "sc-1gg9z8m-0"
|
|
31
31
|
})(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
32
|
-
StyledColorWell.defaultProps = {
|
|
33
|
-
theme: DEFAULT_THEME
|
|
34
|
-
};
|
|
35
32
|
|
|
36
33
|
export { StyledColorWell };
|
|
@@ -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, 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
|
|
37
|
+
'data-garden-version': '9.0.0',
|
|
27
38
|
'data-test-id': 'colorwell-thumb',
|
|
28
39
|
style: {
|
|
29
40
|
top: `${props.top}%`,
|
|
@@ -32,9 +43,6 @@ const StyledColorWellThumb = styled.div.attrs(props => ({
|
|
|
32
43
|
})).withConfig({
|
|
33
44
|
displayName: "StyledColorWellThumb",
|
|
34
45
|
componentId: "sc-1npyab0-0"
|
|
35
|
-
})(["position:absolute;border:
|
|
36
|
-
StyledColorWellThumb.defaultProps = {
|
|
37
|
-
theme: DEFAULT_THEME
|
|
38
|
-
};
|
|
46
|
+
})(["position:absolute;border:", ";border-radius:50%;", " ", " ", ";"], props => props.theme.borders.sm, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
39
47
|
|
|
40
48
|
export { StyledColorWellThumb };
|
|
@@ -5,20 +5,17 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { Field } from '@zendeskgarden/react-forms';
|
|
10
10
|
|
|
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
|
|
14
|
+
'data-garden-version': '9.0.0',
|
|
15
15
|
spellcheck: false
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledHexField",
|
|
18
18
|
componentId: "sc-ijq1c-0"
|
|
19
19
|
})(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledHexField.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledHexField };
|
|
@@ -5,19 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
8
|
import { StyledRange, getTrackMargin, getTrackHeight } from '../common/StyledRange.js';
|
|
10
9
|
|
|
11
10
|
const COMPONENT_ID = 'colorpickers.colorpicker_hue';
|
|
12
11
|
const StyledHueRange = styled(StyledRange).attrs({
|
|
13
12
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0
|
|
13
|
+
'data-garden-version': '9.0.0'
|
|
15
14
|
}).withConfig({
|
|
16
15
|
displayName: "StyledHueRange",
|
|
17
16
|
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
|
|
19
|
-
StyledHueRange.defaultProps = {
|
|
20
|
-
theme: DEFAULT_THEME
|
|
21
|
-
};
|
|
17
|
+
})(["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));
|
|
22
18
|
|
|
23
19
|
export { StyledHueRange };
|
|
@@ -6,19 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { Input } from '@zendeskgarden/react-forms';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
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
|
|
14
|
+
'data-garden-version': '9.0.0',
|
|
15
15
|
focusInset: false
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledInput",
|
|
18
18
|
componentId: "sc-1uzlutt-0"
|
|
19
19
|
})(["text-align:center;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledInput.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledInput };
|
|
@@ -5,18 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
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
|
|
13
|
+
'data-garden-version': '9.0.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledInputGroup",
|
|
16
16
|
componentId: "sc-1m9g2wg-0"
|
|
17
17
|
})(["display:flex;justify-content:space-between;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledInputGroup.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledInputGroup };
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { Label } from '@zendeskgarden/react-forms';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
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
|
|
14
|
+
'data-garden-version': '9.0.0'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledLabel",
|
|
17
17
|
componentId: "sc-1vxt3m9-0"
|
|
18
18
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
-
StyledLabel.defaultProps = {
|
|
20
|
-
theme: DEFAULT_THEME
|
|
21
|
-
};
|
|
22
19
|
|
|
23
20
|
export { StyledLabel };
|