@synerise/ds-color-picker 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/ColorPicker.d.ts +1 -1
- package/dist/ColorPicker.js +106 -28
- package/dist/ColorPicker.styles.d.ts +92 -2
- package/dist/ColorPicker.styles.js +89 -8
- package/dist/ColorPicker.types.d.ts +12 -2
- package/dist/ColorPicker.types.js +7 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-color-picker@0.1.3...@synerise/ds-color-picker@0.1.4) (2023-01-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **color-picker:** change import src to packges's root ([0cac9f4](https://github.com/Synerise/synerise-design/commit/0cac9f4a6fdc99d5dd1c744ece924f5ac3e02bb9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.1.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-color-picker@0.1.2...@synerise/ds-color-picker@0.1.3) (2023-01-02)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **color-picker:** fix adding dot to tags and typing,copy text ([b33b588](https://github.com/Synerise/synerise-design/commit/b33b5882d5d357b745d2b9421c4d30d09c651871))
|
|
23
|
+
* **color-picker:** fix height of dropdown ([0f1d964](https://github.com/Synerise/synerise-design/commit/0f1d9647cfd29936c98218f4fd7de9a175dcb3e2))
|
|
24
|
+
* **color-picker:** remove select and add input to pick color ([dd9cd1a](https://github.com/Synerise/synerise-design/commit/dd9cd1aba392af05637ee89b51f09ffc59e9c5b7))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [0.1.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-color-picker@0.1.1...@synerise/ds-color-picker@0.1.2) (2022-12-08)
|
|
7
31
|
|
|
8
32
|
|
package/dist/ColorPicker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColorPickerProps } from './ColorPicker.types';
|
|
3
|
-
export declare function ColorPicker({ value, onChange, colors, onSaveColors, infix, placeholder,
|
|
3
|
+
export declare function ColorPicker({ value, onChange, colors, onSaveColors, infix, placeholder, inputProps, maxSavedColors, tooltipText, isShownSavedColors, size, errorText, description, }: ColorPickerProps): JSX.Element;
|
|
4
4
|
export default ColorPicker;
|
package/dist/ColorPicker.js
CHANGED
|
@@ -2,12 +2,13 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { HexColorPicker as ReactColorful } from 'react-colorful';
|
|
5
|
-
import Select from '@synerise/ds-select';
|
|
6
|
-
import Button from '@synerise/ds-button';
|
|
7
5
|
import Divider from '@synerise/ds-divider';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
6
|
+
import Tags, { TagShape, Tag } from '@synerise/ds-tags';
|
|
7
|
+
import Icon, { FormulaPlusM, CopyClipboardM } from '@synerise/ds-icon';
|
|
8
|
+
import * as copy from 'copy-to-clipboard';
|
|
9
|
+
import Tooltip from '@synerise/ds-tooltip';
|
|
10
|
+
import Dropdown from '@synerise/ds-dropdown';
|
|
11
|
+
import { useOnClickOutside } from '@synerise/ds-utils';
|
|
11
12
|
import ColorPickerStyles from './ColorPicker.styles';
|
|
12
13
|
export function ColorPicker(_ref) {
|
|
13
14
|
var _ref$value = _ref.value,
|
|
@@ -21,22 +22,55 @@ export function ColorPicker(_ref) {
|
|
|
21
22
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
22
23
|
} : _ref$infix,
|
|
23
24
|
placeholder = _ref.placeholder,
|
|
24
|
-
|
|
25
|
+
inputProps = _ref.inputProps,
|
|
25
26
|
_ref$maxSavedColors = _ref.maxSavedColors,
|
|
26
|
-
maxSavedColors = _ref$maxSavedColors === void 0 ?
|
|
27
|
+
maxSavedColors = _ref$maxSavedColors === void 0 ? 9 : _ref$maxSavedColors,
|
|
28
|
+
tooltipText = _ref.tooltipText,
|
|
29
|
+
isShownSavedColors = _ref.isShownSavedColors,
|
|
30
|
+
_ref$size = _ref.size,
|
|
31
|
+
size = _ref$size === void 0 ? 'M' : _ref$size,
|
|
32
|
+
errorText = _ref.errorText,
|
|
33
|
+
description = _ref.description;
|
|
27
34
|
|
|
28
35
|
var _React$useState = React.useState(value),
|
|
29
36
|
color = _React$useState[0],
|
|
30
37
|
setColor = _React$useState[1];
|
|
31
38
|
|
|
39
|
+
var _React$useState2 = React.useState(-1),
|
|
40
|
+
pressed = _React$useState2[0],
|
|
41
|
+
setPressed = _React$useState2[1];
|
|
42
|
+
|
|
32
43
|
var onChangeColor = function onChangeColor(colorValue) {
|
|
33
44
|
setColor(colorValue);
|
|
34
45
|
onChange && onChange(colorValue);
|
|
35
46
|
};
|
|
36
47
|
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
var heightOfDropdown = React.useCallback(function () {
|
|
49
|
+
if (errorText || description) {
|
|
50
|
+
if (errorText && description) {
|
|
51
|
+
return -40;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return -20;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return 4;
|
|
58
|
+
}, [errorText, description]);
|
|
59
|
+
|
|
60
|
+
var _React$useState3 = React.useState(false),
|
|
61
|
+
dropdownVisible = _React$useState3[0],
|
|
62
|
+
setDropdownVisible = _React$useState3[1];
|
|
63
|
+
|
|
64
|
+
var ref = React.useRef(null);
|
|
65
|
+
useOnClickOutside(ref, function () {
|
|
66
|
+
setDropdownVisible(false);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
var _React$useState4 = React.useState(colors),
|
|
70
|
+
savedColors = _React$useState4[0],
|
|
71
|
+
setSavedColors = _React$useState4[1];
|
|
72
|
+
|
|
73
|
+
var hash = '#';
|
|
40
74
|
|
|
41
75
|
var saveColor = function saveColor() {
|
|
42
76
|
setSavedColors(function (ar) {
|
|
@@ -46,48 +80,92 @@ export function ColorPicker(_ref) {
|
|
|
46
80
|
});
|
|
47
81
|
};
|
|
48
82
|
|
|
49
|
-
var swatchSection = /*#__PURE__*/React.createElement(
|
|
83
|
+
var swatchSection = /*#__PURE__*/React.createElement(ColorPickerStyles.SwatchSectionWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
84
|
+
title: "Save color swatch"
|
|
85
|
+
}, /*#__PURE__*/React.createElement(ColorPickerStyles.AddColorButton, {
|
|
50
86
|
mode: "single-icon",
|
|
87
|
+
type: "ghost",
|
|
51
88
|
onClick: saveColor
|
|
52
89
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
90
|
+
size: 16,
|
|
53
91
|
component: /*#__PURE__*/React.createElement(FormulaPlusM, null)
|
|
54
|
-
})), infix({
|
|
92
|
+
}))), infix({
|
|
55
93
|
color: color,
|
|
56
94
|
setColor: onChangeColor
|
|
57
95
|
}), savedColors.length > 0 && /*#__PURE__*/React.createElement(Tags, {
|
|
58
|
-
tagShape: TagShape.SINGLE_CHARACTER_SQUARE
|
|
96
|
+
tagShape: TagShape.SINGLE_CHARACTER_SQUARE // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
,
|
|
59
99
|
selected: savedColors.map(function (colorEntry, i) {
|
|
60
100
|
return {
|
|
61
101
|
id: i,
|
|
62
102
|
key: "color-" + i,
|
|
63
|
-
name:
|
|
103
|
+
name: /*#__PURE__*/React.createElement(Tooltip, {
|
|
104
|
+
title: colorEntry
|
|
105
|
+
}, /*#__PURE__*/React.createElement(ColorPickerStyles.TagDot, {
|
|
106
|
+
pressed: i === pressed
|
|
107
|
+
})),
|
|
64
108
|
color: colorEntry,
|
|
65
109
|
onClick: function onClick() {
|
|
66
110
|
onChangeColor(colorEntry);
|
|
111
|
+
setPressed(i);
|
|
67
112
|
}
|
|
68
113
|
};
|
|
69
114
|
}),
|
|
70
115
|
disabled: false
|
|
71
116
|
}));
|
|
72
|
-
var dropdown = /*#__PURE__*/React.createElement(ColorPickerStyles.Container,
|
|
117
|
+
var dropdown = /*#__PURE__*/React.createElement(ColorPickerStyles.Container, {
|
|
118
|
+
ref: ref,
|
|
119
|
+
size: size
|
|
120
|
+
}, /*#__PURE__*/React.createElement(ReactColorful, {
|
|
73
121
|
color: color,
|
|
74
122
|
onChange: onChangeColor
|
|
75
|
-
}), /*#__PURE__*/React.createElement(ColorPickerStyles.
|
|
76
|
-
|
|
123
|
+
}), /*#__PURE__*/React.createElement(ColorPickerStyles.PrefixTag, {
|
|
124
|
+
height: isShownSavedColors
|
|
125
|
+
}, /*#__PURE__*/React.createElement(Tag, {
|
|
126
|
+
shape: TagShape.SINGLE_CHARACTER_SQUARE,
|
|
127
|
+
color: color,
|
|
128
|
+
disabled: false
|
|
129
|
+
})), /*#__PURE__*/React.createElement(ColorPickerStyles.SubContainer, {
|
|
130
|
+
savedColors: isShownSavedColors
|
|
131
|
+
}, /*#__PURE__*/React.createElement(ColorPickerStyles.ColorPickerInput, {
|
|
132
|
+
value: color.substr(1),
|
|
133
|
+
prefixel: /*#__PURE__*/React.createElement(ColorPickerStyles.PreffixWrapper, null, "#"),
|
|
134
|
+
onChange: function onChange(ev) {
|
|
135
|
+
return setColor(hash + ev.target.value);
|
|
136
|
+
},
|
|
137
|
+
placeholder: placeholder,
|
|
138
|
+
icon1: /*#__PURE__*/React.createElement(ColorPickerStyles.CopyIcon, {
|
|
139
|
+
onClick: function onClick() {
|
|
140
|
+
copy(color);
|
|
141
|
+
},
|
|
142
|
+
component: /*#__PURE__*/React.createElement(CopyClipboardM, null)
|
|
143
|
+
}),
|
|
144
|
+
icon1Tooltip: /*#__PURE__*/React.createElement("span", null, tooltipText)
|
|
145
|
+
}), isShownSavedColors && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Divider, null), swatchSection)));
|
|
146
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
147
|
+
align: {
|
|
148
|
+
offset: [0, heightOfDropdown()]
|
|
149
|
+
},
|
|
150
|
+
visible: dropdownVisible,
|
|
151
|
+
overlay: dropdown,
|
|
152
|
+
placement: "bottomLeft"
|
|
153
|
+
}, /*#__PURE__*/React.createElement(ColorPickerStyles.ColorPickerSelect, _extends({
|
|
154
|
+
prefix: /*#__PURE__*/React.createElement(ColorPickerStyles.ColorTag, {
|
|
155
|
+
shape: TagShape.SINGLE_CHARACTER_ROUND,
|
|
156
|
+
color: color,
|
|
157
|
+
disabled: false
|
|
158
|
+
}),
|
|
77
159
|
onChange: function onChange(ev) {
|
|
78
160
|
return setColor(ev.target.value);
|
|
79
161
|
},
|
|
80
|
-
placeholder: placeholder
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
showArrow: false,
|
|
162
|
+
placeholder: placeholder,
|
|
163
|
+
onClick: function onClick() {
|
|
164
|
+
return setDropdownVisible(!dropdownVisible);
|
|
165
|
+
},
|
|
85
166
|
value: color,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return dropdown;
|
|
90
|
-
}
|
|
91
|
-
}, selectProps)));
|
|
167
|
+
description: description,
|
|
168
|
+
errorText: errorText
|
|
169
|
+
}, inputProps))));
|
|
92
170
|
}
|
|
93
171
|
export default ColorPicker;
|
|
@@ -1,5 +1,95 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Button from '@synerise/ds-button';
|
|
3
|
+
export declare const TagDot: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
pressed?: boolean | undefined;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const ColorTag: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-tags/dist/Tag/Tag.types").Props>, any, {}, never>;
|
|
7
|
+
export declare const AddColorButton: import("styled-components").StyledComponent<typeof Button, any, {}, never>;
|
|
8
|
+
export declare const CopyIcon: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-icon").IconProps>, any, {}, never>;
|
|
9
|
+
export declare const ColorPickerInput: import("styled-components").StyledComponent<(import("react").ComponentClass<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
10
|
+
mask: string;
|
|
11
|
+
formatCharacters?: object | undefined;
|
|
12
|
+
placeholderChar?: string | undefined;
|
|
13
|
+
value?: string | undefined;
|
|
14
|
+
}) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps), any> & {
|
|
15
|
+
displayName: string;
|
|
16
|
+
}) | (import("react").FunctionComponent<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
17
|
+
mask: string;
|
|
18
|
+
formatCharacters?: object | undefined;
|
|
19
|
+
placeholderChar?: string | undefined;
|
|
20
|
+
value?: string | undefined;
|
|
21
|
+
})> & {
|
|
22
|
+
displayName: string;
|
|
23
|
+
}), any, {}, never>;
|
|
24
|
+
export declare const ColorPickerSelect: import("styled-components").StyledComponent<(import("react").ComponentClass<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
25
|
+
mask: string;
|
|
26
|
+
formatCharacters?: object | undefined;
|
|
27
|
+
placeholderChar?: string | undefined;
|
|
28
|
+
value?: string | undefined;
|
|
29
|
+
}) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps), any> & {
|
|
30
|
+
displayName: string;
|
|
31
|
+
}) | (import("react").FunctionComponent<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
32
|
+
mask: string;
|
|
33
|
+
formatCharacters?: object | undefined;
|
|
34
|
+
placeholderChar?: string | undefined;
|
|
35
|
+
value?: string | undefined;
|
|
36
|
+
})> & {
|
|
37
|
+
displayName: string;
|
|
38
|
+
}), any, {}, never>;
|
|
39
|
+
export declare const PrefixTag: import("styled-components").StyledComponent<"div", any, {
|
|
40
|
+
height?: boolean | undefined;
|
|
41
|
+
}, never>;
|
|
42
|
+
export declare const SwatchSectionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
43
|
+
export declare const PreffixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
44
|
+
export declare const ValueWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
1
45
|
declare const _default: {
|
|
2
|
-
Container: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
-
|
|
46
|
+
Container: import("styled-components").StyledComponent<"div", any, {
|
|
47
|
+
size?: "S" | "M" | "L" | undefined;
|
|
48
|
+
}, never>;
|
|
49
|
+
SubContainer: import("styled-components").StyledComponent<"div", any, {
|
|
50
|
+
savedColors?: boolean | undefined;
|
|
51
|
+
}, never>;
|
|
52
|
+
ColorTag: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-tags/dist/Tag/Tag.types").Props>, any, {}, never>;
|
|
53
|
+
PrefixTag: import("styled-components").StyledComponent<"div", any, {
|
|
54
|
+
height?: boolean | undefined;
|
|
55
|
+
}, never>;
|
|
56
|
+
AddColorButton: import("styled-components").StyledComponent<typeof Button, any, {}, never>;
|
|
57
|
+
SwatchSectionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
58
|
+
PreffixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
59
|
+
ValueWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
60
|
+
CopyIcon: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-icon").IconProps>, any, {}, never>;
|
|
61
|
+
ColorPickerInput: import("styled-components").StyledComponent<(import("react").ComponentClass<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
62
|
+
mask: string;
|
|
63
|
+
formatCharacters?: object | undefined;
|
|
64
|
+
placeholderChar?: string | undefined;
|
|
65
|
+
value?: string | undefined;
|
|
66
|
+
}) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps), any> & {
|
|
67
|
+
displayName: string;
|
|
68
|
+
}) | (import("react").FunctionComponent<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
69
|
+
mask: string;
|
|
70
|
+
formatCharacters?: object | undefined;
|
|
71
|
+
placeholderChar?: string | undefined;
|
|
72
|
+
value?: string | undefined;
|
|
73
|
+
})> & {
|
|
74
|
+
displayName: string;
|
|
75
|
+
}), any, {}, never>;
|
|
76
|
+
TagDot: import("styled-components").StyledComponent<"div", any, {
|
|
77
|
+
pressed?: boolean | undefined;
|
|
78
|
+
}, never>;
|
|
79
|
+
ColorPickerSelect: import("styled-components").StyledComponent<(import("react").ComponentClass<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
80
|
+
mask: string;
|
|
81
|
+
formatCharacters?: object | undefined;
|
|
82
|
+
placeholderChar?: string | undefined;
|
|
83
|
+
value?: string | undefined;
|
|
84
|
+
}) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps), any> & {
|
|
85
|
+
displayName: string;
|
|
86
|
+
}) | (import("react").FunctionComponent<(object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").TextAreaProps) | (object & import("@synerise/ds-input").InputProps & import("antd/lib/input").InputProps & {
|
|
87
|
+
mask: string;
|
|
88
|
+
formatCharacters?: object | undefined;
|
|
89
|
+
placeholderChar?: string | undefined;
|
|
90
|
+
value?: string | undefined;
|
|
91
|
+
})> & {
|
|
92
|
+
displayName: string;
|
|
93
|
+
}), any, {}, never>;
|
|
4
94
|
};
|
|
5
95
|
export default _default;
|
|
@@ -1,14 +1,95 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
1
|
+
import styled from 'styled-components'; // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
|
|
4
|
+
import { TagsStyles, Tag } from '@synerise/ds-tags';
|
|
5
|
+
import Button from '@synerise/ds-button';
|
|
6
|
+
import Icon from '@synerise/ds-icon';
|
|
7
|
+
import { Input } from '@synerise/ds-input';
|
|
8
|
+
import { ColorPickerSize } from './ColorPicker.types';
|
|
9
|
+
export var TagDot = styled.div.withConfig({
|
|
10
|
+
displayName: "ColorPickerstyles__TagDot",
|
|
11
|
+
componentId: "sc-1iu8b6j-0"
|
|
12
|
+
})(["display:", ";width:4px;height:4px;background-color:", ";border-radius:50%;"], function (props) {
|
|
13
|
+
return props.pressed ? 'flex' : 'none';
|
|
14
|
+
}, function (props) {
|
|
15
|
+
return props.theme.palette.white;
|
|
16
|
+
});
|
|
17
|
+
var SIZE_DEFAULT = 167;
|
|
3
18
|
var Container = styled.div.withConfig({
|
|
4
19
|
displayName: "ColorPickerstyles__Container",
|
|
5
|
-
componentId: "sc-1iu8b6j-0"
|
|
6
|
-
})(["@media (min-width:200px){min-width:200px;}.react-colorful__last-control{margin:16px 46px 8px 16px;border-radius:4px;height:8px;}.ant-divider-horizontal{margin:16px 0px;}", "{margin-bottom:-8px;}"], TagsStyles.Container);
|
|
7
|
-
var Subcontainer = styled.div.withConfig({
|
|
8
|
-
displayName: "ColorPickerstyles__Subcontainer",
|
|
9
20
|
componentId: "sc-1iu8b6j-1"
|
|
10
|
-
})(["
|
|
21
|
+
})(["@media (min-width:200px){min-width:200px;margin:-8px;background-color:", ";}.react-colorful__last-control{margin:24px 56px 8px 17px;border-radius:4px;height:8px;}.react-colorful__saturation{border-bottom:0px;border-radius:4px 4px 0 0;height:96px;.react-colorful__interactive{height:96px;}}&&& .ds-tag{width:16px;height:16px;margin:0px 4px 8px;border:1px solid ", ";&:hover{", "{display:flex;}}}.react-colorful__pointer{width:16px;height:16px;}.react-colorful{width:268px;max-width:268px;height:", "px;}.react-colorful__hue-pointer{border:1px solid ", ";box-shadow:none !important;.react-colorful__pointer-fill{background-color:", " !important;}}.ant-divider-horizontal{margin:16px 0px;}", "{margin-bottom:-8px;}"], function (props) {
|
|
22
|
+
return props.theme.palette.white;
|
|
23
|
+
}, function (props) {
|
|
24
|
+
return props.theme.palette['grey-300'];
|
|
25
|
+
}, TagDot, function (props) {
|
|
26
|
+
return ColorPickerSize[props.size] || SIZE_DEFAULT;
|
|
27
|
+
}, function (props) {
|
|
28
|
+
return props.theme.palette['grey-300'];
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.theme.palette.white;
|
|
31
|
+
}, TagsStyles.Container);
|
|
32
|
+
var SubContainer = styled.div.withConfig({
|
|
33
|
+
displayName: "ColorPickerstyles__SubContainer",
|
|
34
|
+
componentId: "sc-1iu8b6j-2"
|
|
35
|
+
})(["padding:", ";"], function (props) {
|
|
36
|
+
return props.savedColors ? '8px 16px 16px' : '8px 16px 0;';
|
|
37
|
+
});
|
|
38
|
+
export var ColorTag = styled(Tag).withConfig({
|
|
39
|
+
displayName: "ColorPickerstyles__ColorTag",
|
|
40
|
+
componentId: "sc-1iu8b6j-3"
|
|
41
|
+
})(["width:16px;height:16px;border:1px solid ", ";"], function (props) {
|
|
42
|
+
return props.theme.palette['grey-300'];
|
|
43
|
+
});
|
|
44
|
+
export var AddColorButton = styled(Button).withConfig({
|
|
45
|
+
displayName: "ColorPickerstyles__AddColorButton",
|
|
46
|
+
componentId: "sc-1iu8b6j-4"
|
|
47
|
+
})(["&&&.ant-btn{width:16px;height:16px;margin-right:2px;}"]);
|
|
48
|
+
export var CopyIcon = styled(Icon).withConfig({
|
|
49
|
+
displayName: "ColorPickerstyles__CopyIcon",
|
|
50
|
+
componentId: "sc-1iu8b6j-5"
|
|
51
|
+
})(["display:none;"]);
|
|
52
|
+
export var ColorPickerInput = styled(Input).withConfig({
|
|
53
|
+
displayName: "ColorPickerstyles__ColorPickerInput",
|
|
54
|
+
componentId: "sc-1iu8b6j-6"
|
|
55
|
+
})(["&:hover{", "{display:flex;}}"], CopyIcon);
|
|
56
|
+
export var ColorPickerSelect = styled(Input).withConfig({
|
|
57
|
+
displayName: "ColorPickerstyles__ColorPickerSelect",
|
|
58
|
+
componentId: "sc-1iu8b6j-7"
|
|
59
|
+
})([".ant-input-affix-wrapper{padding:4px 4px;}.ant-input-prefix{margin-right:8px;}&&& .ant-input{padding-right:4px;box-shadow:none;}width:100px;max-width:100px;"]);
|
|
60
|
+
export var PrefixTag = styled.div.withConfig({
|
|
61
|
+
displayName: "ColorPickerstyles__PrefixTag",
|
|
62
|
+
componentId: "sc-1iu8b6j-8"
|
|
63
|
+
})(["&&& .ds-tag{width:24px;height:24px;border:1px solid ", ";cursor:auto;&:hover:before{cursor:auto;filter:brightness(100%);}}position:absolute;right:", ";bottom:", ";z-index:2;cursor:auto;"], function (props) {
|
|
64
|
+
return props.theme.palette['grey-300'];
|
|
65
|
+
}, function (props) {
|
|
66
|
+
return props.height ? '12px' : '12px';
|
|
67
|
+
}, function (props) {
|
|
68
|
+
return props.height ? '97px' : '48px';
|
|
69
|
+
});
|
|
70
|
+
export var SwatchSectionWrapper = styled.div.withConfig({
|
|
71
|
+
displayName: "ColorPickerstyles__SwatchSectionWrapper",
|
|
72
|
+
componentId: "sc-1iu8b6j-9"
|
|
73
|
+
})(["display:flex;alignitems:center;"]);
|
|
74
|
+
export var PreffixWrapper = styled.div.withConfig({
|
|
75
|
+
displayName: "ColorPickerstyles__PreffixWrapper",
|
|
76
|
+
componentId: "sc-1iu8b6j-10"
|
|
77
|
+
})(["padding:6px 12px;"]);
|
|
78
|
+
export var ValueWrapper = styled.div.withConfig({
|
|
79
|
+
displayName: "ColorPickerstyles__ValueWrapper",
|
|
80
|
+
componentId: "sc-1iu8b6j-11"
|
|
81
|
+
})(["display:flex;font-size:12px;"]);
|
|
11
82
|
export default {
|
|
12
83
|
Container: Container,
|
|
13
|
-
|
|
84
|
+
SubContainer: SubContainer,
|
|
85
|
+
ColorTag: ColorTag,
|
|
86
|
+
PrefixTag: PrefixTag,
|
|
87
|
+
AddColorButton: AddColorButton,
|
|
88
|
+
SwatchSectionWrapper: SwatchSectionWrapper,
|
|
89
|
+
PreffixWrapper: PreffixWrapper,
|
|
90
|
+
ValueWrapper: ValueWrapper,
|
|
91
|
+
CopyIcon: CopyIcon,
|
|
92
|
+
ColorPickerInput: ColorPickerInput,
|
|
93
|
+
TagDot: TagDot,
|
|
94
|
+
ColorPickerSelect: ColorPickerSelect
|
|
14
95
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { InputProps } from '@synerise/ds-input';
|
|
3
3
|
export declare type ColorHookType = {
|
|
4
4
|
color: string;
|
|
5
5
|
setColor: (color: string) => void;
|
|
6
6
|
};
|
|
7
|
+
export declare enum ColorPickerSize {
|
|
8
|
+
'S' = 135,
|
|
9
|
+
'M' = 167,
|
|
10
|
+
'L' = 199
|
|
11
|
+
}
|
|
7
12
|
export interface ColorPickerProps extends Partial<Pick<HTMLInputElement, 'placeholder'>> {
|
|
8
13
|
value?: string;
|
|
9
14
|
onChange?: (color: string) => void;
|
|
@@ -15,5 +20,10 @@ export interface ColorPickerProps extends Partial<Pick<HTMLInputElement, 'placeh
|
|
|
15
20
|
*/
|
|
16
21
|
infix?: (colorHooks?: Partial<ColorHookType>) => JSX.Element;
|
|
17
22
|
maxSavedColors?: number;
|
|
18
|
-
|
|
23
|
+
inputProps?: Omit<InputProps, 'value' | 'onChange' | 'defaultValue'>;
|
|
24
|
+
tooltipText?: string;
|
|
25
|
+
isShownSavedColors?: boolean;
|
|
26
|
+
size?: 'S' | 'M' | 'L';
|
|
27
|
+
errorText?: string;
|
|
28
|
+
description?: string;
|
|
19
29
|
}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var ColorPickerSize;
|
|
2
|
+
|
|
3
|
+
(function (ColorPickerSize) {
|
|
4
|
+
ColorPickerSize[ColorPickerSize["S"] = 135] = "S";
|
|
5
|
+
ColorPickerSize[ColorPickerSize["M"] = 167] = "M";
|
|
6
|
+
ColorPickerSize[ColorPickerSize["L"] = 199] = "L";
|
|
7
|
+
})(ColorPickerSize || (ColorPickerSize = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-color-picker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Color-Picker Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"@synerise/ds-button": "^0.17.10",
|
|
36
36
|
"@synerise/ds-divider": "^0.5.26",
|
|
37
37
|
"@synerise/ds-icon": "^0.52.0",
|
|
38
|
-
"@synerise/ds-input": "^0.18.
|
|
39
|
-
"@synerise/ds-select": "^0.14.
|
|
40
|
-
"@synerise/ds-tags": "^0.7.
|
|
38
|
+
"@synerise/ds-input": "^0.18.28",
|
|
39
|
+
"@synerise/ds-select": "^0.14.30",
|
|
40
|
+
"@synerise/ds-tags": "^0.7.2",
|
|
41
41
|
"rc-select": "~11.4.0",
|
|
42
42
|
"react-colorful": "^5.2.0"
|
|
43
43
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"@synerise/ds-core": "*",
|
|
46
46
|
"react": ">=16.9.0 < 17.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "6e6447c72a216903dc397b8462bcf41f91c1326b"
|
|
49
49
|
}
|