@zendeskgarden/react-colorpickers 9.0.0-next.2 → 9.0.0-next.21
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/README.md +72 -2
- package/dist/esm/elements/ColorPicker/ColorWell.js +110 -0
- package/dist/esm/elements/ColorPicker/index.js +237 -0
- package/dist/esm/elements/ColorPicker/reducer.js +275 -0
- package/dist/esm/elements/ColorPickerDialog/index.js +153 -0
- package/dist/esm/elements/ColorSwatch/index.js +149 -0
- package/dist/esm/elements/ColorSwatchDialog/index.js +179 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +29 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
- package/dist/esm/styled/ColorPicker/StyledAlphaRange.js +42 -0
- package/dist/esm/styled/ColorPicker/StyledColorPicker.js +25 -0
- package/dist/esm/styled/ColorPicker/StyledColorWell.js +36 -0
- package/dist/esm/styled/ColorPicker/StyledColorWellThumb.js +51 -0
- package/dist/esm/styled/ColorPicker/StyledHexField.js +24 -0
- package/dist/esm/styled/ColorPicker/StyledHueRange.js +23 -0
- package/dist/esm/styled/ColorPicker/StyledInput.js +24 -0
- package/dist/esm/styled/ColorPicker/StyledInputGroup.js +22 -0
- package/dist/esm/styled/ColorPicker/StyledLabel.js +23 -0
- package/dist/esm/styled/ColorPicker/StyledPreview.js +39 -0
- package/dist/esm/styled/ColorPicker/StyledRGBAField.js +32 -0
- package/dist/esm/styled/ColorPicker/StyledSliderGroup.js +22 -0
- package/dist/esm/styled/ColorPicker/StyledSliders.js +45 -0
- package/dist/esm/styled/ColorPickerDialog/StyledButton.js +22 -0
- package/dist/esm/styled/ColorPickerDialog/StyledButtonPreview.js +52 -0
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipBody.js +23 -0
- package/dist/esm/styled/ColorPickerDialog/StyledTooltipModal.js +23 -0
- package/dist/esm/styled/ColorSwatch/StyledCell.js +22 -0
- package/dist/esm/styled/ColorSwatch/StyledColorSwatch.js +22 -0
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchInput.js +22 -0
- package/dist/esm/styled/ColorSwatch/StyledColorSwatchLabel.js +53 -0
- package/dist/esm/styled/ColorSwatch/StyledIcon.js +24 -0
- package/dist/esm/styled/common/StyledRange.js +160 -0
- package/dist/esm/utils/conversion.js +34 -0
- package/dist/esm/utils/saturation.js +64 -0
- package/dist/esm/utils/validation.js +12 -0
- package/dist/index.cjs.js +267 -243
- package/dist/typings/elements/{Colorpicker → ColorPicker}/index.d.ts +2 -2
- package/dist/typings/elements/{ColorpickerDialog → ColorPickerDialog}/index.d.ts +2 -2
- package/dist/typings/index.d.ts +3 -3
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledAlphaRange.d.ts +2 -2
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorPicker.d.ts +1 -1
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorWell.d.ts +1 -1
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledPreview.d.ts +3 -3
- package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledSliders.d.ts +3 -2
- package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledButton.d.ts +0 -1
- package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledButtonPreview.d.ts +2 -2
- package/dist/typings/styled/ColorSwatch/StyledColorSwatchLabel.d.ts +3 -3
- package/dist/typings/styled/common/StyledRange.d.ts +2 -2
- package/dist/typings/styled/index.d.ts +17 -17
- package/dist/typings/styled/types.d.ts +12 -0
- package/dist/typings/types/index.d.ts +2 -2
- package/package.json +12 -12
- package/dist/index.esm.js +0 -1612
- package/dist/typings/styled/common/checkeredBackground.d.ts +0 -8
- /package/dist/typings/elements/{Colorpicker → ColorPicker}/ColorWell.d.ts +0 -0
- /package/dist/typings/elements/{Colorpicker → ColorPicker}/reducer.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledColorWellThumb.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledHexField.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledHueRange.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledInput.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledInputGroup.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledLabel.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledRGBAField.d.ts +0 -0
- /package/dist/typings/styled/{Colorpicker → ColorPicker}/StyledSliderGroup.d.ts +0 -0
- /package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledTooltipBody.d.ts +0 -0
- /package/dist/typings/styled/{ColorpickerDialog → ColorPickerDialog}/StyledTooltipModal.d.ts +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
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, { css } from 'styled-components';
|
|
8
|
+
import { stripUnit } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_colorwell_thumb';
|
|
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;
|
|
30
|
+
const borderWidth = stripUnit(theme.borderWidths.sm) * 2;
|
|
31
|
+
const size = theme.space.base * 5;
|
|
32
|
+
const translateValue = size / -2;
|
|
33
|
+
return css(["transform:translate(", "px,", "px);box-sizing:border-box;border-width:", "px;width:", "px;height:", "px;"], translateValue, translateValue, borderWidth, size, size);
|
|
34
|
+
};
|
|
35
|
+
const StyledColorWellThumb = styled.div.attrs(props => ({
|
|
36
|
+
'data-garden-id': COMPONENT_ID,
|
|
37
|
+
'data-garden-version': '9.0.0-next.21',
|
|
38
|
+
'data-test-id': 'colorwell-thumb',
|
|
39
|
+
style: {
|
|
40
|
+
top: `${props.top}%`,
|
|
41
|
+
left: `${props.left}%`
|
|
42
|
+
}
|
|
43
|
+
})).withConfig({
|
|
44
|
+
displayName: "StyledColorWellThumb",
|
|
45
|
+
componentId: "sc-1npyab0-0"
|
|
46
|
+
})(["position:absolute;border:", ";border-radius:50%;", " ", " ", ";"], props => props.theme.borders.sm, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
47
|
+
StyledColorWellThumb.defaultProps = {
|
|
48
|
+
theme: DEFAULT_THEME
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { StyledColorWellThumb };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { Field } from '@zendeskgarden/react-forms';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_hex_field';
|
|
12
|
+
const StyledHexField = styled(Field).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21',
|
|
15
|
+
spellcheck: false
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledHexField",
|
|
18
|
+
componentId: "sc-ijq1c-0"
|
|
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
|
+
|
|
24
|
+
export { StyledHexField };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledRange, getTrackMargin, getTrackHeight } from '../common/StyledRange.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_hue';
|
|
12
|
+
const StyledHueRange = styled(StyledRange).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledHueRange",
|
|
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.$isOpaque && `0 ${getTrackMargin(props)}px`, props => getTrackHeight(props));
|
|
19
|
+
StyledHueRange.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledHueRange };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { Input } from '@zendeskgarden/react-forms';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_input';
|
|
12
|
+
const StyledInput = styled(Input).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21',
|
|
15
|
+
focusInset: false
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledInput",
|
|
18
|
+
componentId: "sc-1uzlutt-0"
|
|
19
|
+
})(["text-align:center;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledInput.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledInput };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_input_group';
|
|
11
|
+
const StyledInputGroup = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledInputGroup",
|
|
16
|
+
componentId: "sc-1m9g2wg-0"
|
|
17
|
+
})(["display:flex;justify-content:space-between;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledInputGroup.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledInputGroup };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { Label } from '@zendeskgarden/react-forms';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_label';
|
|
12
|
+
const StyledLabel = styled(Label).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledLabel",
|
|
17
|
+
componentId: "sc-1vxt3m9-0"
|
|
18
|
+
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledLabel.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledLabel };
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { rgba } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getCheckeredBackground } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_preview_box';
|
|
12
|
+
const background = 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
|
+
retVal = getCheckeredBackground({
|
|
17
|
+
theme: props.theme,
|
|
18
|
+
size: 13,
|
|
19
|
+
overlay: retVal
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return retVal;
|
|
23
|
+
};
|
|
24
|
+
const StyledPreview = styled.div.attrs(props => ({
|
|
25
|
+
style: {
|
|
26
|
+
background: background(props)
|
|
27
|
+
},
|
|
28
|
+
'data-garden-id': COMPONENT_ID,
|
|
29
|
+
'data-garden-version': '9.0.0-next.21',
|
|
30
|
+
'data-test-id': 'preview-box'
|
|
31
|
+
})).withConfig({
|
|
32
|
+
displayName: "StyledPreview",
|
|
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.$isOpaque ? 6 : 8), props => props.theme.space.base * (props.$isOpaque ? 6 : 8), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
35
|
+
StyledPreview.defaultProps = {
|
|
36
|
+
theme: DEFAULT_THEME
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { StyledPreview };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Field } from '@zendeskgarden/react-forms';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_rgb_field';
|
|
12
|
+
const sizeStyles = theme => {
|
|
13
|
+
const margin = `${theme.space.base * 1.5}px`;
|
|
14
|
+
const width = `${theme.space.base * 12.75}px`;
|
|
15
|
+
return `
|
|
16
|
+
margin-${theme.rtl ? 'right' : 'left'}: ${margin};
|
|
17
|
+
width: ${width};
|
|
18
|
+
min-width: ${width};
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
const StyledRGBAField = styled(Field).attrs({
|
|
22
|
+
'data-garden-id': COMPONENT_ID,
|
|
23
|
+
'data-garden-version': '9.0.0-next.21'
|
|
24
|
+
}).withConfig({
|
|
25
|
+
displayName: "StyledRGBAField",
|
|
26
|
+
componentId: "sc-13266k8-0"
|
|
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
|
+
|
|
32
|
+
export { StyledRGBAField };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'colorpickers.colorpicker_slider_group';
|
|
11
|
+
const StyledSliderGroup = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledSliderGroup",
|
|
16
|
+
componentId: "sc-tigkzg-0"
|
|
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
|
+
|
|
22
|
+
export { StyledSliderGroup };
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { getTrackHeight, getTrackMargin } from '../common/StyledRange.js';
|
|
10
|
+
|
|
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
|
+
};
|
|
34
|
+
const StyledSliders = styled.div.attrs({
|
|
35
|
+
'data-garden-id': COMPONENT_ID,
|
|
36
|
+
'data-garden-version': '9.0.0-next.21'
|
|
37
|
+
}).withConfig({
|
|
38
|
+
displayName: "StyledSliders",
|
|
39
|
+
componentId: "sc-1lgr50m-0"
|
|
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));
|
|
41
|
+
StyledSliders.defaultProps = {
|
|
42
|
+
theme: DEFAULT_THEME
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { StyledSliders };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { Button } from '@zendeskgarden/react-buttons';
|
|
10
|
+
|
|
11
|
+
const StyledButton = styled(Button).attrs({
|
|
12
|
+
isNeutral: true,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledButton",
|
|
16
|
+
componentId: "sc-1dlijfv-0"
|
|
17
|
+
})(["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);
|
|
18
|
+
StyledButton.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledButton };
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { rgba } from 'polished';
|
|
9
|
+
import { getCheckeredBackground, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colordialog_preview';
|
|
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
|
+
} else {
|
|
23
|
+
const {
|
|
24
|
+
red,
|
|
25
|
+
green,
|
|
26
|
+
blue,
|
|
27
|
+
alpha = 1
|
|
28
|
+
} = $backgroundColor;
|
|
29
|
+
retVal = `rgba(${red}, ${green}, ${blue}, ${alpha ? alpha / 100 : 0})`;
|
|
30
|
+
}
|
|
31
|
+
return retVal;
|
|
32
|
+
};
|
|
33
|
+
const StyledButtonPreview = styled.span.attrs(props => ({
|
|
34
|
+
style: {
|
|
35
|
+
background: getCheckeredBackground({
|
|
36
|
+
theme: props.theme,
|
|
37
|
+
size: 8,
|
|
38
|
+
overlay: background(props)
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
'data-garden-id': COMPONENT_ID,
|
|
42
|
+
'data-garden-version': '9.0.0-next.21',
|
|
43
|
+
'data-test-id': 'dialog-preview'
|
|
44
|
+
})).withConfig({
|
|
45
|
+
displayName: "StyledButtonPreview",
|
|
46
|
+
componentId: "sc-yxis8h-0"
|
|
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));
|
|
48
|
+
StyledButtonPreview.defaultProps = {
|
|
49
|
+
theme: DEFAULT_THEME
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { StyledButtonPreview };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { TooltipModal } from '@zendeskgarden/react-modals';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colordialog_tooltipmodal_body';
|
|
12
|
+
const StyledTooltipBody = styled(TooltipModal.Body).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledTooltipBody",
|
|
17
|
+
componentId: "sc-1ueddpo-0"
|
|
18
|
+
})(["padding:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledTooltipBody.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledTooltipBody };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { TooltipModal } from '@zendeskgarden/react-modals';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'colorpickers.colordialog_tooltipmodal';
|
|
12
|
+
const StyledTooltipModal = styled(TooltipModal).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.21'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledTooltipModal",
|
|
17
|
+
componentId: "sc-gykkrw-0"
|
|
18
|
+
})(["width:auto !important;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledTooltipModal.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledTooltipModal };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'colorpickers.swatch_cell';
|
|
11
|
+
const StyledCell = styled.td.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledCell",
|
|
16
|
+
componentId: "sc-qr3oit-0"
|
|
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
|
+
|
|
22
|
+
export { StyledCell };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'colorpickers.color_swatch';
|
|
11
|
+
const StyledColorSwatch = styled.table.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledColorSwatch",
|
|
16
|
+
componentId: "sc-ajx440-0"
|
|
17
|
+
})(["border-collapse:collapse;line-height:normal;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledColorSwatch.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledColorSwatch };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'colorpickers.color_swatch_input';
|
|
11
|
+
const StyledColorSwatchInput = styled.input.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.21'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledColorSwatchInput",
|
|
16
|
+
componentId: "sc-em45h0-0"
|
|
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
|
+
|
|
22
|
+
export { StyledColorSwatchInput };
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { parseToRgb, readableColor } from 'polished';
|
|
9
|
+
import { focusStyles, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledButtonPreview } from '../ColorPickerDialog/StyledButtonPreview.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'colorpickers.color_swatch_label';
|
|
13
|
+
const colorStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
$backgroundColor,
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
alpha
|
|
20
|
+
} = parseToRgb($backgroundColor);
|
|
21
|
+
const returnIfLightColor = getColor({
|
|
22
|
+
theme,
|
|
23
|
+
hue: 'neutralHue',
|
|
24
|
+
shade: 900
|
|
25
|
+
});
|
|
26
|
+
let foregroundColor = returnIfLightColor;
|
|
27
|
+
if (alpha === undefined || alpha >= 0.4) {
|
|
28
|
+
const returnIfDarkColor = getColor({
|
|
29
|
+
theme,
|
|
30
|
+
hue: 'white'
|
|
31
|
+
});
|
|
32
|
+
foregroundColor = readableColor($backgroundColor, returnIfLightColor, returnIfDarkColor, false );
|
|
33
|
+
}
|
|
34
|
+
return `
|
|
35
|
+
color: ${foregroundColor};
|
|
36
|
+
`;
|
|
37
|
+
};
|
|
38
|
+
const StyledColorSwatchLabel = styled(StyledButtonPreview).attrs({
|
|
39
|
+
as: 'label',
|
|
40
|
+
'data-garden-id': COMPONENT_ID,
|
|
41
|
+
'data-garden-version': '9.0.0-next.21'
|
|
42
|
+
}).withConfig({
|
|
43
|
+
displayName: "StyledColorSwatchLabel",
|
|
44
|
+
componentId: "sc-1aghocg-0"
|
|
45
|
+
})(["position:relative;top:0;border-radius:", ";", ";", " ", ";"], props => props.theme.borderRadii.md, colorStyles, props => focusStyles({
|
|
46
|
+
theme: props.theme,
|
|
47
|
+
selector: '&:has(:focus-visible)'
|
|
48
|
+
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
49
|
+
StyledColorSwatchLabel.defaultProps = {
|
|
50
|
+
theme: DEFAULT_THEME
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { StyledColorSwatchLabel };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 SvgCheckSmFill from '../../node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledColorSwatchInput } from './StyledColorSwatchInput.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'colorpickers.colorswatch_check';
|
|
13
|
+
const StyledIcon = styled(SvgCheckSmFill).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '9.0.0-next.21'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledIcon",
|
|
18
|
+
componentId: "sc-8oigif-0"
|
|
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
|
+
|
|
24
|
+
export { StyledIcon };
|