@zendeskgarden/react-colorpickers 9.0.0-next.8 → 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 +12 -10
- 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 +11 -12
- 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 +20 -19
- 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 +298 -315
- 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
- package/dist/esm/styled/common/checkeredBackground.js +0 -28
- package/dist/typings/styled/common/checkeredBackground.d.ts +0 -8
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { rgba } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles,
|
|
10
|
-
import { checkeredBackground } from '../common/checkeredBackground.js';
|
|
9
|
+
import { retrieveComponentStyles, getCheckeredBackground } from '@zendeskgarden/react-theming';
|
|
11
10
|
|
|
12
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_preview_box';
|
|
13
12
|
const background = props => {
|
|
14
|
-
const alpha = props
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
retVal = getCheckeredBackground({
|
|
17
|
+
theme: props.theme,
|
|
18
|
+
size: 13,
|
|
19
|
+
overlay: retVal
|
|
20
|
+
});
|
|
19
21
|
}
|
|
20
22
|
return retVal;
|
|
21
23
|
};
|
|
@@ -24,14 +26,11 @@ const StyledPreview = styled.div.attrs(props => ({
|
|
|
24
26
|
background: background(props)
|
|
25
27
|
},
|
|
26
28
|
'data-garden-id': COMPONENT_ID,
|
|
27
|
-
'data-garden-version': '9.0.0
|
|
29
|
+
'data-garden-version': '9.0.0',
|
|
28
30
|
'data-test-id': 'preview-box'
|
|
29
31
|
})).withConfig({
|
|
30
32
|
displayName: "StyledPreview",
|
|
31
33
|
componentId: "sc-1z5nh7-0"
|
|
32
|
-
})(["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
|
|
33
|
-
StyledPreview.defaultProps = {
|
|
34
|
-
theme: DEFAULT_THEME
|
|
35
|
-
};
|
|
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));
|
|
36
35
|
|
|
37
36
|
export { StyledPreview };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Field } from '@zendeskgarden/react-forms';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'colorpickers.colorpicker_rgb_field';
|
|
12
12
|
const sizeStyles = theme => {
|
|
@@ -20,13 +20,10 @@ 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
|
|
23
|
+
'data-garden-version': '9.0.0'
|
|
24
24
|
}).withConfig({
|
|
25
25
|
displayName: "StyledRGBAField",
|
|
26
26
|
componentId: "sc-13266k8-0"
|
|
27
27
|
})(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles(props.theme), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
28
|
-
StyledRGBAField.defaultProps = {
|
|
29
|
-
theme: DEFAULT_THEME
|
|
30
|
-
};
|
|
31
28
|
|
|
32
29
|
export { StyledRGBAField };
|
|
@@ -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_slider_group';
|
|
11
11
|
const StyledSliderGroup = 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: "StyledSliderGroup",
|
|
16
16
|
componentId: "sc-tigkzg-0"
|
|
17
17
|
})(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledSliderGroup.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledSliderGroup };
|
|
@@ -5,19 +5,38 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
9
|
-
import {
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
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
|
|
36
|
+
'data-garden-version': '9.0.0'
|
|
15
37
|
}).withConfig({
|
|
16
38
|
displayName: "StyledSliders",
|
|
17
39
|
componentId: "sc-1lgr50m-0"
|
|
18
|
-
})(["position:relative;margin-", ":", "px;width:100
|
|
19
|
-
StyledSliders.defaultProps = {
|
|
20
|
-
theme: DEFAULT_THEME
|
|
21
|
-
};
|
|
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));
|
|
22
41
|
|
|
23
42
|
export { StyledSliders };
|
|
@@ -5,20 +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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
8
|
import { Button } from '@zendeskgarden/react-buttons';
|
|
10
9
|
|
|
11
|
-
const COMPONENT_ID = 'colorpickers.colordialog_button';
|
|
12
10
|
const StyledButton = styled(Button).attrs({
|
|
13
11
|
isNeutral: true,
|
|
14
|
-
'data-garden-
|
|
15
|
-
'data-garden-version': '9.0.0-next.8'
|
|
12
|
+
'data-garden-version': '9.0.0'
|
|
16
13
|
}).withConfig({
|
|
17
14
|
displayName: "StyledButton",
|
|
18
15
|
componentId: "sc-1dlijfv-0"
|
|
19
|
-
})(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}"
|
|
20
|
-
StyledButton.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
16
|
+
})(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}"], props => props.theme.space.base * 17, props => props.theme.space.base * 17, props => props.theme.rtl ? 'left' : 'right', props => props.theme.borderRadii.md, props => props.theme.rtl ? 'left' : 'right', props => props.theme.borderRadii.md);
|
|
23
17
|
|
|
24
18
|
export { StyledButton };
|
|
@@ -6,43 +6,44 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { rgba } from 'polished';
|
|
9
|
-
import {
|
|
10
|
-
import { checkeredBackground } from '../common/checkeredBackground.js';
|
|
9
|
+
import { getCheckeredBackground, retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
11
10
|
|
|
12
11
|
const COMPONENT_ID = 'colorpickers.colordialog_preview';
|
|
13
|
-
const background =
|
|
14
|
-
|
|
15
|
-
backgroundColor
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const background = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
$backgroundColor,
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
let retVal;
|
|
18
|
+
if (typeof $backgroundColor === 'string') {
|
|
19
|
+
retVal = $backgroundColor;
|
|
20
|
+
} else if ($backgroundColor === undefined) {
|
|
21
|
+
retVal = theme.palette.white;
|
|
22
22
|
} else {
|
|
23
23
|
const {
|
|
24
24
|
red,
|
|
25
25
|
green,
|
|
26
26
|
blue,
|
|
27
27
|
alpha = 1
|
|
28
|
-
} = backgroundColor;
|
|
29
|
-
|
|
28
|
+
} = $backgroundColor;
|
|
29
|
+
retVal = `rgba(${red}, ${green}, ${blue}, ${alpha ? alpha / 100 : 0})`;
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return retVal;
|
|
32
32
|
};
|
|
33
33
|
const StyledButtonPreview = styled.span.attrs(props => ({
|
|
34
34
|
style: {
|
|
35
|
-
background:
|
|
35
|
+
background: getCheckeredBackground({
|
|
36
|
+
theme: props.theme,
|
|
37
|
+
size: 8,
|
|
38
|
+
overlay: background(props)
|
|
39
|
+
})
|
|
36
40
|
},
|
|
37
41
|
'data-garden-id': COMPONENT_ID,
|
|
38
|
-
'data-garden-version': '9.0.0
|
|
42
|
+
'data-garden-version': '9.0.0',
|
|
39
43
|
'data-test-id': 'dialog-preview'
|
|
40
44
|
})).withConfig({
|
|
41
45
|
displayName: "StyledButtonPreview",
|
|
42
46
|
componentId: "sc-yxis8h-0"
|
|
43
47
|
})(["display:inline-block;bottom:", "px;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.space.base, props => props.theme.borderRadii.sm, props => props.theme.borderWidths.sm, props => rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * 5, props => props.theme.space.base * 5, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
44
|
-
StyledButtonPreview.defaultProps = {
|
|
45
|
-
theme: DEFAULT_THEME
|
|
46
|
-
};
|
|
47
48
|
|
|
48
49
|
export { StyledButtonPreview };
|
|
@@ -5,19 +5,16 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
9
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { TooltipDialog } from '@zendeskgarden/react-modals';
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
|
-
const COMPONENT_ID = 'colorpickers.
|
|
12
|
-
const StyledTooltipBody = styled(
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colordialog_tooltipdialog_body';
|
|
12
|
+
const StyledTooltipBody = styled(TooltipDialog.Body).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: "StyledTooltipBody",
|
|
17
17
|
componentId: "sc-1ueddpo-0"
|
|
18
18
|
})(["padding:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
-
StyledTooltipBody.defaultProps = {
|
|
20
|
-
theme: DEFAULT_THEME
|
|
21
|
-
};
|
|
22
19
|
|
|
23
20
|
export { StyledTooltipBody };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { TooltipDialog } from '@zendeskgarden/react-modals';
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colordialog_tooltipdialog';
|
|
12
|
+
const StyledTooltipDialog = styled(TooltipDialog).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledTooltipDialog",
|
|
17
|
+
componentId: "sc-1vbkccl-0"
|
|
18
|
+
})(["width:auto !important;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
|
|
20
|
+
export { StyledTooltipDialog };
|
|
@@ -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.swatch_cell';
|
|
11
11
|
const StyledCell = styled.td.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: "StyledCell",
|
|
16
16
|
componentId: "sc-qr3oit-0"
|
|
17
17
|
})(["padding:", "px;font-size:0;", ";"], props => props.theme.space.base, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledCell.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledCell };
|
|
@@ -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.color_swatch';
|
|
11
11
|
const StyledColorSwatch = styled.table.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: "StyledColorSwatch",
|
|
16
16
|
componentId: "sc-ajx440-0"
|
|
17
17
|
})(["border-collapse:collapse;line-height:normal;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledColorSwatch.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledColorSwatch };
|
|
@@ -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.color_swatch_input';
|
|
11
11
|
const StyledColorSwatchInput = styled.input.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: "StyledColorSwatchInput",
|
|
16
16
|
componentId: "sc-em45h0-0"
|
|
17
17
|
})(["position:absolute;opacity:0;z-index:1;margin:0;cursor:pointer;width:100%;height:100%;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledColorSwatchInput.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledColorSwatchInput };
|
|
@@ -6,17 +6,30 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { parseToRgb, readableColor } from 'polished';
|
|
9
|
-
import { focusStyles, retrieveComponentStyles,
|
|
9
|
+
import { focusStyles, retrieveComponentStyles, 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
|
|
41
|
+
'data-garden-version': '9.0.0'
|
|
29
42
|
}).withConfig({
|
|
30
43
|
displayName: "StyledColorSwatchLabel",
|
|
31
44
|
componentId: "sc-1aghocg-0"
|
|
@@ -33,8 +46,5 @@ const StyledColorSwatchLabel = styled(StyledButtonPreview).attrs({
|
|
|
33
46
|
theme: props.theme,
|
|
34
47
|
selector: '&:has(:focus-visible)'
|
|
35
48
|
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
|
-
StyledColorSwatchLabel.defaultProps = {
|
|
37
|
-
theme: DEFAULT_THEME
|
|
38
|
-
};
|
|
39
49
|
|
|
40
50
|
export { StyledColorSwatchLabel };
|
|
@@ -6,19 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import SvgCheckSmFill from '../../node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledColorSwatchInput } from './StyledColorSwatchInput.js';
|
|
11
11
|
|
|
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
|
|
15
|
+
'data-garden-version': '9.0.0'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledIcon",
|
|
18
18
|
componentId: "sc-8oigif-0"
|
|
19
19
|
})(["position:absolute;top:0;left:0;transition:opacity 0.2s ease-in-out;opacity:0;width:100%;height:100%;", ":checked ~ &{opacity:1;}", ";"], StyledColorSwatchInput, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledIcon.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledIcon };
|
|
@@ -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,
|
|
9
|
+
import { stripUnit } from 'polished';
|
|
10
|
+
import { retrieveComponentStyles, 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
|
|
148
|
+
'data-garden-version': '9.0.0',
|
|
140
149
|
hasLowerTrack: false
|
|
141
150
|
}).withConfig({
|
|
142
151
|
displayName: "StyledRange",
|
|
@@ -144,8 +153,5 @@ const StyledRange = styled(Range).attrs({
|
|
|
144
153
|
})(["", ";", " ", ";", ";"], sizeStyles, trackStyles(`
|
|
145
154
|
border-radius: 0;
|
|
146
155
|
`), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
147
|
-
StyledRange.defaultProps = {
|
|
148
|
-
theme: DEFAULT_THEME
|
|
149
|
-
};
|
|
150
156
|
|
|
151
157
|
export { StyledRange, getTrackHeight, getTrackMargin, trackStyles };
|