@strapi/plugin-color-picker 0.0.0-next.f5107c72369ee86a8ec1b6782f2e890925033ca3 → 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/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 +1 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +11 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +14 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/register.d.ts +1 -0
- package/dist/server/register.d.ts.map +1 -0
- package/package.json +67 -48
- package/admin/src/components/ColorPicker/ColorPickerIcon/index.js +0 -26
- package/admin/src/components/ColorPicker/ColorPickerInput/index.js +0 -206
- 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 -65
- package/admin/src/index.js +0 -88
- package/admin/src/pluginId.js +0 -5
- package/admin/src/utils/getTrad.js +0 -5
- package/dist/server/register.js +0 -12
- package/dist/server/register.js.map +0 -1
- package/strapi-admin.js +0 -3
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { lightTheme, ThemeProvider } from '@strapi/design-system';
|
|
4
|
-
import { fireEvent, render, screen } from '@testing-library/react';
|
|
5
|
-
import { IntlProvider } from 'react-intl';
|
|
6
|
-
|
|
7
|
-
import ColorPickerInput from '../ColorPicker/ColorPickerInput';
|
|
8
|
-
|
|
9
|
-
const mockAttribute = {
|
|
10
|
-
customField: 'plugin::color-picker.color',
|
|
11
|
-
pluginOptions: { i18n: { localized: true } },
|
|
12
|
-
type: 'string',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const App = (
|
|
16
|
-
<IntlProvider locale="en" messages={{}} textComponent="span">
|
|
17
|
-
<ThemeProvider theme={lightTheme}>
|
|
18
|
-
<ColorPickerInput
|
|
19
|
-
name="color"
|
|
20
|
-
value=""
|
|
21
|
-
onChange={jest.fn()}
|
|
22
|
-
attribute={mockAttribute}
|
|
23
|
-
intlLabel={{ id: 'color-picker', defaultMessage: 'color-picker' }}
|
|
24
|
-
/>
|
|
25
|
-
</ThemeProvider>
|
|
26
|
-
</IntlProvider>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
describe('<ColorPickerInput />', () => {
|
|
30
|
-
/**
|
|
31
|
-
* We do this because –
|
|
32
|
-
* https://github.com/facebook/jest/issues/12670
|
|
33
|
-
*/
|
|
34
|
-
beforeAll(() => {
|
|
35
|
-
jest.setTimeout(30000);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Reset timeout to what is expected
|
|
40
|
-
*/
|
|
41
|
-
afterAll(() => {
|
|
42
|
-
jest.setTimeout(5000);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('renders and matches the snapshot', () => {
|
|
46
|
-
const { container } = render(App);
|
|
47
|
-
|
|
48
|
-
expect(container).toMatchSnapshot();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('toggles the popover', () => {
|
|
52
|
-
render(App);
|
|
53
|
-
const colorPickerToggle = screen.getByRole('button', { name: 'Color picker toggle' });
|
|
54
|
-
fireEvent.click(colorPickerToggle);
|
|
55
|
-
|
|
56
|
-
const popover = screen.getByRole('dialog');
|
|
57
|
-
const saturation = screen.getByRole('slider', { name: 'Color' });
|
|
58
|
-
const hue = screen.getByRole('slider', { name: 'Hue' });
|
|
59
|
-
const input = screen.getByRole('textbox', { name: 'Color picker input' });
|
|
60
|
-
expect(popover).toBeVisible();
|
|
61
|
-
expect(saturation).toBeVisible();
|
|
62
|
-
expect(hue).toBeVisible();
|
|
63
|
-
expect(input).toBeVisible();
|
|
64
|
-
});
|
|
65
|
-
});
|
package/admin/src/index.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
2
|
-
|
|
3
|
-
import ColorPickerIcon from './components/ColorPicker/ColorPickerIcon';
|
|
4
|
-
import pluginId from './pluginId';
|
|
5
|
-
import getTrad from './utils/getTrad';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
register(app) {
|
|
9
|
-
app.customFields.register({
|
|
10
|
-
name: 'color',
|
|
11
|
-
pluginId: 'color-picker',
|
|
12
|
-
type: 'string',
|
|
13
|
-
icon: ColorPickerIcon,
|
|
14
|
-
intlLabel: {
|
|
15
|
-
id: getTrad('color-picker.label'),
|
|
16
|
-
defaultMessage: 'Color',
|
|
17
|
-
},
|
|
18
|
-
intlDescription: {
|
|
19
|
-
id: getTrad('color-picker.description'),
|
|
20
|
-
defaultMessage: 'Select any color',
|
|
21
|
-
},
|
|
22
|
-
components: {
|
|
23
|
-
Input: async () =>
|
|
24
|
-
import(
|
|
25
|
-
/* webpackChunkName: "color-picker-input-component" */ './components/ColorPicker/ColorPickerInput'
|
|
26
|
-
),
|
|
27
|
-
},
|
|
28
|
-
options: {
|
|
29
|
-
advanced: [
|
|
30
|
-
{
|
|
31
|
-
intlLabel: {
|
|
32
|
-
id: getTrad('color-picker.options.advanced.regex'),
|
|
33
|
-
defaultMessage: 'RegExp pattern',
|
|
34
|
-
},
|
|
35
|
-
name: 'regex',
|
|
36
|
-
type: 'text',
|
|
37
|
-
defaultValue: '^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$',
|
|
38
|
-
description: {
|
|
39
|
-
id: getTrad('color-picker.options.advanced.regex.description'),
|
|
40
|
-
defaultMessage: 'The text of the regular expression',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
sectionTitle: {
|
|
45
|
-
id: 'global.settings',
|
|
46
|
-
defaultMessage: 'Settings',
|
|
47
|
-
},
|
|
48
|
-
items: [
|
|
49
|
-
{
|
|
50
|
-
name: 'required',
|
|
51
|
-
type: 'checkbox',
|
|
52
|
-
intlLabel: {
|
|
53
|
-
id: getTrad('color-picker.options.advanced.requiredField'),
|
|
54
|
-
defaultMessage: 'Required field',
|
|
55
|
-
},
|
|
56
|
-
description: {
|
|
57
|
-
id: getTrad('color-picker.options.advanced.requiredField.description'),
|
|
58
|
-
defaultMessage: "You won't be able to create an entry if this field is empty",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
async registerTrads({ locales }) {
|
|
68
|
-
const importedTrads = await Promise.all(
|
|
69
|
-
locales.map((locale) => {
|
|
70
|
-
return import(`./translations/${locale}.json`)
|
|
71
|
-
.then(({ default: data }) => {
|
|
72
|
-
return {
|
|
73
|
-
data: prefixPluginTranslations(data, pluginId),
|
|
74
|
-
locale,
|
|
75
|
-
};
|
|
76
|
-
})
|
|
77
|
-
.catch(() => {
|
|
78
|
-
return {
|
|
79
|
-
data: {},
|
|
80
|
-
locale,
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
})
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
return Promise.resolve(importedTrads);
|
|
87
|
-
},
|
|
88
|
-
};
|
package/admin/src/pluginId.js
DELETED
package/dist/server/register.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.register = void 0;
|
|
4
|
-
const register = ({ strapi }) => {
|
|
5
|
-
strapi.customFields.register({
|
|
6
|
-
name: 'color',
|
|
7
|
-
plugin: 'color-picker',
|
|
8
|
-
type: 'string',
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
exports.register = register;
|
|
12
|
-
//# sourceMappingURL=register.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../server/src/register.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,CAAC,EAAE,MAAM,EAAO,EAAE,EAAE;IAC1C,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC;QAC3B,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,cAAc;QACtB,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;AACL,CAAC,CAAC;AANW,QAAA,QAAQ,YAMnB"}
|
package/strapi-admin.js
DELETED