@strapi/plugin-color-picker 0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71 → 0.0.0-next.f5b09a8e61e059f02784478e27c310c6290be088
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/LICENSE +12 -19
- package/dist/_chunks/ColorPickerInput-0d985ad5.mjs +277 -0
- package/dist/_chunks/ColorPickerInput-0d985ad5.mjs.map +1 -0
- package/dist/_chunks/ColorPickerInput-8875b370.js +298 -0
- package/dist/_chunks/ColorPickerInput-8875b370.js.map +1 -0
- package/{admin/src/translations/cs.json → dist/_chunks/cs-32e5b75a.mjs} +6 -2
- package/dist/_chunks/cs-32e5b75a.mjs.map +1 -0
- package/dist/_chunks/cs-c22467c6.js +16 -0
- package/dist/_chunks/cs-c22467c6.js.map +1 -0
- package/{admin/src/translations/en.json → dist/_chunks/en-2230584b.mjs} +6 -2
- package/dist/_chunks/en-2230584b.mjs.map +1 -0
- package/dist/_chunks/en-eb6717ab.js +19 -0
- package/dist/_chunks/en-eb6717ab.js.map +1 -0
- package/dist/_chunks/index-214132a2.mjs +124 -0
- package/dist/_chunks/index-214132a2.mjs.map +1 -0
- package/dist/_chunks/index-9695efa4.js +125 -0
- package/dist/_chunks/index-9695efa4.js.map +1 -0
- package/{admin/src/translations/ru.json → dist/_chunks/ru-0bf57448.mjs} +6 -2
- package/dist/_chunks/ru-0bf57448.mjs.map +1 -0
- package/dist/_chunks/ru-1d1cf8a8.js +19 -0
- package/dist/_chunks/ru-1d1cf8a8.js.map +1 -0
- package/dist/_chunks/sv-6e7fa200.js +16 -0
- package/dist/_chunks/sv-6e7fa200.js.map +1 -0
- package/{admin/src/translations/sv.json → dist/_chunks/sv-de6a785a.mjs} +6 -2
- package/dist/_chunks/sv-de6a785a.mjs.map +1 -0
- package/{admin/src/translations/tr.json → dist/_chunks/tr-4d632eac.mjs} +6 -2
- package/dist/_chunks/tr-4d632eac.mjs.map +1 -0
- package/dist/_chunks/tr-67b6e192.js +16 -0
- package/dist/_chunks/tr-67b6e192.js.map +1 -0
- package/{admin/src/translations/zh.json → dist/_chunks/zh-5ba3e025.mjs} +6 -2
- package/dist/_chunks/zh-5ba3e025.mjs.map +1 -0
- package/dist/_chunks/zh-e5010f8b.js +16 -0
- package/dist/_chunks/zh-e5010f8b.js.map +1 -0
- package/dist/admin/components/ColorPickerIcon.d.ts +1 -0
- package/dist/admin/components/ColorPickerInput.d.ts +32 -0
- package/dist/admin/hooks/useComposeRefs.d.ts +29 -0
- package/dist/admin/index.d.ts +18 -0
- package/dist/admin/index.js +9 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +10 -0
- package/dist/admin/index.mjs.map +1 -0
- package/dist/admin/pluginId.d.ts +1 -0
- package/dist/admin/utils/getTrad.d.ts +1 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +13 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +14 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/register.d.ts +2 -0
- package/dist/server/register.d.ts.map +1 -0
- package/package.json +68 -38
- package/strapi-server.js +1 -1
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -14
- package/admin/src/components/ColorPicker/ColorPickerIcon/index.js +0 -25
- package/admin/src/components/ColorPicker/ColorPickerInput/index.js +0 -205
- package/admin/src/components/tests/__snapshots__/color-picker-input.test.js.snap +0 -238
- package/admin/src/components/tests/color-picker-input.test.js +0 -63
- package/admin/src/index.js +0 -87
- package/admin/src/pluginId.js +0 -5
- package/admin/src/utils/getTrad.js +0 -5
- package/color-picker.png +0 -0
- package/jest.config.front.js +0 -5
- package/server/index.js +0 -7
- package/server/register.js +0 -9
- package/strapi-admin.js +0 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
/**
|
|
3
|
+
* TODO: we need to have the type for StrapiApp done from `@strapi/admin` package.
|
|
4
|
+
*/
|
|
5
|
+
register(app: any): void;
|
|
6
|
+
registerTrads({ locales }: {
|
|
7
|
+
locales: string[];
|
|
8
|
+
}): Promise<({
|
|
9
|
+
data: {
|
|
10
|
+
[x: string]: string;
|
|
11
|
+
};
|
|
12
|
+
locale: string;
|
|
13
|
+
} | {
|
|
14
|
+
data: {};
|
|
15
|
+
locale: string;
|
|
16
|
+
})[]>;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const index = require("../_chunks/index-9695efa4.js");
|
|
3
|
+
require("@strapi/helper-plugin");
|
|
4
|
+
require("react/jsx-dev-runtime");
|
|
5
|
+
require("@strapi/design-system");
|
|
6
|
+
require("@strapi/icons");
|
|
7
|
+
require("styled-components");
|
|
8
|
+
module.exports = index.index;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { i } from "../_chunks/index-214132a2.mjs";
|
|
2
|
+
import "@strapi/helper-plugin";
|
|
3
|
+
import "react/jsx-dev-runtime";
|
|
4
|
+
import "@strapi/design-system";
|
|
5
|
+
import "@strapi/icons";
|
|
6
|
+
import "styled-components";
|
|
7
|
+
export {
|
|
8
|
+
i as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pluginId = "color-picker";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getTrad: (id: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../server/src/index.ts"],"names":[],"mappings":";;;AAEA,wBAEE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../server/src/register.ts","../../server/src/index.ts"],"sourcesContent":["export const register = ({ strapi }: any) => {\n strapi.customFields.register({\n name: 'color',\n plugin: 'color-picker',\n type: 'string',\n });\n};\n","import { register } from './register';\n\nexport default {\n register,\n};\n"],"names":[],"mappings":";AAAO,MAAM,WAAW,CAAC,EAAE,aAAkB;AAC3C,SAAO,aAAa,SAAS;AAAA,IAC3B,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,EAAA,CACP;AACH;ACJA,MAAe,QAAA;AAAA,EACb;AACF;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../server/src/register.ts","../../server/src/index.ts"],"sourcesContent":["export const register = ({ strapi }: any) => {\n strapi.customFields.register({\n name: 'color',\n plugin: 'color-picker',\n type: 'string',\n });\n};\n","import { register } from './register';\n\nexport default {\n register,\n};\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,CAAC,EAAE,aAAkB;AAC3C,SAAO,aAAa,SAAS;AAAA,IAC3B,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,EAAA,CACP;AACH;ACJA,MAAe,QAAA;AAAA,EACb;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../server/src/register.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAgB,GAAG,SAMvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-color-picker",
|
|
3
|
-
"version": "0.0.0-next.
|
|
3
|
+
"version": "0.0.0-next.f5b09a8e61e059f02784478e27c310c6290be088",
|
|
4
4
|
"description": "Strapi maintained Custom Fields",
|
|
5
|
-
"strapi": {
|
|
6
|
-
"name": "color-picker",
|
|
7
|
-
"description": "Color picker custom field",
|
|
8
|
-
"kind": "plugin",
|
|
9
|
-
"displayName": "Color Picker"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@strapi/design-system": "1.6.6",
|
|
13
|
-
"@strapi/helper-plugin": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
|
|
14
|
-
"@strapi/icons": "1.6.6",
|
|
15
|
-
"prop-types": "^15.7.2",
|
|
16
|
-
"react-colorful": "5.6.1",
|
|
17
|
-
"react-intl": "6.3.2"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@testing-library/react": "12.1.4",
|
|
21
|
-
"react": "^17.0.2",
|
|
22
|
-
"react-dom": "^17.0.2",
|
|
23
|
-
"react-router-dom": "5.3.4",
|
|
24
|
-
"styled-components": "5.3.3"
|
|
25
|
-
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"@strapi/strapi": "^4.4.0",
|
|
28
|
-
"react": "^17.0.2",
|
|
29
|
-
"react-dom": "^17.0.2",
|
|
30
|
-
"react-router-dom": "^5.3.4",
|
|
31
|
-
"styled-components": "^5.3.3"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
35
|
-
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
36
|
-
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
|
|
37
|
-
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
|
38
|
-
"lint": "run -T eslint ."
|
|
39
|
-
},
|
|
40
5
|
"repository": {
|
|
41
6
|
"type": "git",
|
|
42
7
|
"url": "https://github.com/strapi/strapi.git",
|
|
@@ -55,9 +20,74 @@
|
|
|
55
20
|
"url": "https://strapi.io"
|
|
56
21
|
}
|
|
57
22
|
],
|
|
23
|
+
"exports": {
|
|
24
|
+
"./strapi-admin": {
|
|
25
|
+
"types": "./dist/admin/index.d.ts",
|
|
26
|
+
"source": "./admin/src/index.ts",
|
|
27
|
+
"import": "./dist/admin/index.mjs",
|
|
28
|
+
"require": "./dist/admin/index.js",
|
|
29
|
+
"default": "./dist/admin/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./strapi-server": {
|
|
32
|
+
"types": "./dist/server/index.d.ts",
|
|
33
|
+
"source": "./server/src/index.ts",
|
|
34
|
+
"import": "./dist/server/index.mjs",
|
|
35
|
+
"require": "./dist/server/index.js",
|
|
36
|
+
"default": "./dist/server/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"./dist",
|
|
42
|
+
"strapi-server.js"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "strapi plugin:build --force",
|
|
46
|
+
"clean": "run -T rimraf ./dist",
|
|
47
|
+
"lint": "run -T eslint .",
|
|
48
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
49
|
+
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
50
|
+
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
|
|
51
|
+
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
52
|
+
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
|
53
|
+
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
|
|
54
|
+
"watch": "strapi plugin:watch"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@strapi/design-system": "1.13.0",
|
|
58
|
+
"@strapi/helper-plugin": "0.0.0-next.f5b09a8e61e059f02784478e27c310c6290be088",
|
|
59
|
+
"@strapi/icons": "1.13.0",
|
|
60
|
+
"prop-types": "^15.8.1",
|
|
61
|
+
"react-colorful": "5.6.1",
|
|
62
|
+
"react-intl": "6.4.1"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@strapi/strapi": "0.0.0-next.f5b09a8e61e059f02784478e27c310c6290be088",
|
|
66
|
+
"@testing-library/react": "14.0.0",
|
|
67
|
+
"@testing-library/user-event": "14.4.3",
|
|
68
|
+
"@types/styled-components": "5.1.26",
|
|
69
|
+
"react": "^18.2.0",
|
|
70
|
+
"react-dom": "^18.2.0",
|
|
71
|
+
"react-router-dom": "5.3.4",
|
|
72
|
+
"styled-components": "5.3.3",
|
|
73
|
+
"typescript": "5.2.2"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@strapi/strapi": "^4.4.0",
|
|
77
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
78
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
79
|
+
"react-router-dom": "5.3.4",
|
|
80
|
+
"styled-components": "5.3.3"
|
|
81
|
+
},
|
|
58
82
|
"engines": {
|
|
59
|
-
"node": ">=
|
|
83
|
+
"node": ">=18.0.0 <=20.x.x",
|
|
60
84
|
"npm": ">=6.0.0"
|
|
61
85
|
},
|
|
62
|
-
"
|
|
86
|
+
"strapi": {
|
|
87
|
+
"name": "color-picker",
|
|
88
|
+
"description": "Color picker custom field",
|
|
89
|
+
"kind": "plugin",
|
|
90
|
+
"displayName": "Color Picker"
|
|
91
|
+
},
|
|
92
|
+
"gitHead": "f5b09a8e61e059f02784478e27c310c6290be088"
|
|
63
93
|
}
|
package/strapi-server.js
CHANGED
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { Icon, Flex } from '@strapi/design-system';
|
|
4
|
-
import { Paint } from '@strapi/icons';
|
|
5
|
-
|
|
6
|
-
const IconBox = styled(Flex)`
|
|
7
|
-
/* Hard code color values */
|
|
8
|
-
/* to stay consistent between themes */
|
|
9
|
-
background-color: #f0f0ff; /* primary100 */
|
|
10
|
-
border: 1px solid #d9d8ff; /* primary200 */
|
|
11
|
-
|
|
12
|
-
svg > path {
|
|
13
|
-
fill: #4945ff; /* primary600 */
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
const ColorPickerIcon = () => {
|
|
18
|
-
return (
|
|
19
|
-
<IconBox justifyContent="center" alignItems="center" width={7} height={6} hasRadius aria-hidden>
|
|
20
|
-
<Icon as={Paint} />
|
|
21
|
-
</IconBox>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default ColorPickerIcon;
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import {
|
|
5
|
-
Typography,
|
|
6
|
-
Flex,
|
|
7
|
-
Box,
|
|
8
|
-
BaseButton,
|
|
9
|
-
FocusTrap,
|
|
10
|
-
Field,
|
|
11
|
-
FieldHint,
|
|
12
|
-
FieldError,
|
|
13
|
-
FieldLabel,
|
|
14
|
-
FieldInput,
|
|
15
|
-
Popover,
|
|
16
|
-
} from '@strapi/design-system';
|
|
17
|
-
import { CarretDown } from '@strapi/icons';
|
|
18
|
-
import { useIntl } from 'react-intl';
|
|
19
|
-
import { HexColorPicker } from 'react-colorful';
|
|
20
|
-
|
|
21
|
-
import getTrad from '../../../utils/getTrad';
|
|
22
|
-
|
|
23
|
-
const ColorPreview = styled.div`
|
|
24
|
-
border-radius: 50%;
|
|
25
|
-
width: 20px;
|
|
26
|
-
height: 20px;
|
|
27
|
-
margin-right: 10px;
|
|
28
|
-
background-color: ${(props) => props.color};
|
|
29
|
-
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const ColorPicker = styled(HexColorPicker)`
|
|
33
|
-
&& {
|
|
34
|
-
width: 100%;
|
|
35
|
-
aspect-ratio: 1.5;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.react-colorful__pointer {
|
|
39
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
40
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.react-colorful__saturation {
|
|
44
|
-
border-radius: ${({ theme }) => theme.spaces[1]};
|
|
45
|
-
border-bottom: none;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.react-colorful__hue {
|
|
49
|
-
border-radius: 10px;
|
|
50
|
-
height: ${({ theme }) => theme.spaces[3]};
|
|
51
|
-
margin-top: ${({ theme }) => theme.spaces[2]};
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
const ColorPickerToggle = styled(BaseButton)`
|
|
56
|
-
display: flex;
|
|
57
|
-
justify-content: space-between;
|
|
58
|
-
align-items: center;
|
|
59
|
-
|
|
60
|
-
svg {
|
|
61
|
-
width: ${({ theme }) => theme.spaces[2]};
|
|
62
|
-
height: ${({ theme }) => theme.spaces[2]};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
svg > path {
|
|
66
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
|
67
|
-
justify-self: flex-end;
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
const ColorPickerPopover = styled(Popover)`
|
|
72
|
-
padding: ${({ theme }) => theme.spaces[2]};
|
|
73
|
-
min-height: 270px;
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
const ColorPickerInput = ({
|
|
77
|
-
attribute,
|
|
78
|
-
description,
|
|
79
|
-
disabled,
|
|
80
|
-
error,
|
|
81
|
-
intlLabel,
|
|
82
|
-
labelAction,
|
|
83
|
-
name,
|
|
84
|
-
onChange,
|
|
85
|
-
required,
|
|
86
|
-
value,
|
|
87
|
-
}) => {
|
|
88
|
-
const [showColorPicker, setShowColorPicker] = useState(false);
|
|
89
|
-
const colorPickerButtonRef = useRef();
|
|
90
|
-
const { formatMessage } = useIntl();
|
|
91
|
-
const color = value || '#000000';
|
|
92
|
-
const styleUppercase = { textTransform: 'uppercase' };
|
|
93
|
-
|
|
94
|
-
const handleBlur = (e) => {
|
|
95
|
-
e.preventDefault();
|
|
96
|
-
|
|
97
|
-
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
98
|
-
setShowColorPicker(false);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<Field
|
|
104
|
-
name={name}
|
|
105
|
-
id={name}
|
|
106
|
-
// GenericInput calls formatMessage and returns a string for the error
|
|
107
|
-
error={error}
|
|
108
|
-
hint={description && formatMessage(description)}
|
|
109
|
-
required={required}
|
|
110
|
-
>
|
|
111
|
-
<Flex direction="column" alignItems="stretch" gap={1}>
|
|
112
|
-
<FieldLabel action={labelAction}>{formatMessage(intlLabel)}</FieldLabel>
|
|
113
|
-
<ColorPickerToggle
|
|
114
|
-
ref={colorPickerButtonRef}
|
|
115
|
-
aria-label={formatMessage({
|
|
116
|
-
id: getTrad('color-picker.toggle.aria-label'),
|
|
117
|
-
defaultMessage: 'Color picker toggle',
|
|
118
|
-
})}
|
|
119
|
-
aria-controls="color-picker-value"
|
|
120
|
-
aria-haspopup="dialog"
|
|
121
|
-
aria-expanded={showColorPicker}
|
|
122
|
-
aria-disabled={disabled}
|
|
123
|
-
disabled={disabled}
|
|
124
|
-
onClick={() => setShowColorPicker(!showColorPicker)}
|
|
125
|
-
>
|
|
126
|
-
<Flex>
|
|
127
|
-
<ColorPreview color={color} />
|
|
128
|
-
<Typography
|
|
129
|
-
style={styleUppercase}
|
|
130
|
-
textColor={value ? null : 'neutral600'}
|
|
131
|
-
variant="omega"
|
|
132
|
-
>
|
|
133
|
-
{color}
|
|
134
|
-
</Typography>
|
|
135
|
-
</Flex>
|
|
136
|
-
<CarretDown aria-hidden />
|
|
137
|
-
</ColorPickerToggle>
|
|
138
|
-
{showColorPicker && (
|
|
139
|
-
<ColorPickerPopover
|
|
140
|
-
onBlur={handleBlur}
|
|
141
|
-
role="dialog"
|
|
142
|
-
source={colorPickerButtonRef}
|
|
143
|
-
spacing={4}
|
|
144
|
-
>
|
|
145
|
-
<FocusTrap onEscape={() => setShowColorPicker(false)}>
|
|
146
|
-
<ColorPicker
|
|
147
|
-
color={color}
|
|
148
|
-
onChange={(hexValue) =>
|
|
149
|
-
onChange({ target: { name, value: hexValue, type: attribute.type } })
|
|
150
|
-
}
|
|
151
|
-
/>
|
|
152
|
-
<Flex paddingTop={3} paddingLeft={4} justifyContent="flex-end">
|
|
153
|
-
<Box paddingRight={2}>
|
|
154
|
-
<Typography variant="omega" as="label" textColor="neutral600">
|
|
155
|
-
{formatMessage({
|
|
156
|
-
id: getTrad('color-picker.input.format'),
|
|
157
|
-
defaultMessage: 'HEX',
|
|
158
|
-
})}
|
|
159
|
-
</Typography>
|
|
160
|
-
</Box>
|
|
161
|
-
<FieldInput
|
|
162
|
-
id="color-picker-value"
|
|
163
|
-
aria-label={formatMessage({
|
|
164
|
-
id: getTrad('color-picker.input.aria-label'),
|
|
165
|
-
defaultMessage: 'Color picker input',
|
|
166
|
-
})}
|
|
167
|
-
style={styleUppercase}
|
|
168
|
-
value={value}
|
|
169
|
-
placeholder="#000000"
|
|
170
|
-
onChange={onChange}
|
|
171
|
-
/>
|
|
172
|
-
</Flex>
|
|
173
|
-
</FocusTrap>
|
|
174
|
-
</ColorPickerPopover>
|
|
175
|
-
)}
|
|
176
|
-
<FieldHint />
|
|
177
|
-
<FieldError />
|
|
178
|
-
</Flex>
|
|
179
|
-
</Field>
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
ColorPickerInput.defaultProps = {
|
|
184
|
-
description: null,
|
|
185
|
-
disabled: false,
|
|
186
|
-
error: null,
|
|
187
|
-
labelAction: null,
|
|
188
|
-
required: false,
|
|
189
|
-
value: '',
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
ColorPickerInput.propTypes = {
|
|
193
|
-
intlLabel: PropTypes.object.isRequired,
|
|
194
|
-
onChange: PropTypes.func.isRequired,
|
|
195
|
-
attribute: PropTypes.object.isRequired,
|
|
196
|
-
name: PropTypes.string.isRequired,
|
|
197
|
-
description: PropTypes.object,
|
|
198
|
-
disabled: PropTypes.bool,
|
|
199
|
-
error: PropTypes.string,
|
|
200
|
-
labelAction: PropTypes.object,
|
|
201
|
-
required: PropTypes.bool,
|
|
202
|
-
value: PropTypes.string,
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export default ColorPickerInput;
|