@strapi/plugin-color-picker 0.0.0-next.c593a2735b35c69d2c421003b6f80adf72fcf16e → 0.0.0-next.c7c44a121f7abc0c52826a7d310fe4534b8727f0

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.
Files changed (66) hide show
  1. package/dist/_chunks/ColorPickerInput-8c35610d.js +298 -0
  2. package/dist/_chunks/ColorPickerInput-8c35610d.js.map +1 -0
  3. package/dist/_chunks/ColorPickerInput-b9dc2ba1.mjs +277 -0
  4. package/dist/_chunks/ColorPickerInput-b9dc2ba1.mjs.map +1 -0
  5. package/{admin/src/translations/cs.json → dist/_chunks/cs-32e5b75a.mjs} +6 -2
  6. package/dist/_chunks/cs-32e5b75a.mjs.map +1 -0
  7. package/dist/_chunks/cs-c22467c6.js +16 -0
  8. package/dist/_chunks/cs-c22467c6.js.map +1 -0
  9. package/{admin/src/translations/en.json → dist/_chunks/en-2230584b.mjs} +6 -2
  10. package/dist/_chunks/en-2230584b.mjs.map +1 -0
  11. package/dist/_chunks/en-eb6717ab.js +19 -0
  12. package/dist/_chunks/en-eb6717ab.js.map +1 -0
  13. package/dist/_chunks/index-83ab6784.js +126 -0
  14. package/dist/_chunks/index-83ab6784.js.map +1 -0
  15. package/dist/_chunks/index-b4858a3b.mjs +125 -0
  16. package/dist/_chunks/index-b4858a3b.mjs.map +1 -0
  17. package/{admin/src/translations/ru.json → dist/_chunks/ru-0bf57448.mjs} +6 -2
  18. package/dist/_chunks/ru-0bf57448.mjs.map +1 -0
  19. package/dist/_chunks/ru-1d1cf8a8.js +19 -0
  20. package/dist/_chunks/ru-1d1cf8a8.js.map +1 -0
  21. package/dist/_chunks/sv-6e7fa200.js +16 -0
  22. package/dist/_chunks/sv-6e7fa200.js.map +1 -0
  23. package/{admin/src/translations/sv.json → dist/_chunks/sv-de6a785a.mjs} +6 -2
  24. package/dist/_chunks/sv-de6a785a.mjs.map +1 -0
  25. package/{admin/src/translations/tr.json → dist/_chunks/tr-4d632eac.mjs} +6 -2
  26. package/dist/_chunks/tr-4d632eac.mjs.map +1 -0
  27. package/dist/_chunks/tr-67b6e192.js +16 -0
  28. package/dist/_chunks/tr-67b6e192.js.map +1 -0
  29. package/{admin/src/translations/zh.json → dist/_chunks/zh-5ba3e025.mjs} +6 -2
  30. package/dist/_chunks/zh-5ba3e025.mjs.map +1 -0
  31. package/dist/_chunks/zh-e5010f8b.js +16 -0
  32. package/dist/_chunks/zh-e5010f8b.js.map +1 -0
  33. package/dist/admin/components/ColorPickerIcon.d.ts +1 -0
  34. package/dist/admin/components/ColorPickerInput.d.ts +32 -0
  35. package/dist/admin/hooks/useComposeRefs.d.ts +29 -0
  36. package/dist/admin/index.d.ts +18 -0
  37. package/dist/admin/index.js +9 -0
  38. package/dist/admin/index.js.map +1 -0
  39. package/dist/admin/index.mjs +10 -0
  40. package/dist/admin/index.mjs.map +1 -0
  41. package/dist/admin/pluginId.d.ts +1 -0
  42. package/dist/admin/utils/getTrad.d.ts +1 -0
  43. package/dist/server/index.d.ts +5 -0
  44. package/dist/server/index.d.ts.map +1 -0
  45. package/dist/server/index.js +13 -0
  46. package/dist/server/index.js.map +1 -0
  47. package/dist/server/index.mjs +14 -0
  48. package/dist/server/index.mjs.map +1 -0
  49. package/dist/server/register.d.ts +2 -0
  50. package/dist/server/register.d.ts.map +1 -0
  51. package/package.json +70 -37
  52. package/strapi-server.js +1 -1
  53. package/.eslintignore +0 -2
  54. package/.eslintrc.js +0 -14
  55. package/admin/src/components/ColorPicker/ColorPickerIcon/index.js +0 -26
  56. package/admin/src/components/ColorPicker/ColorPickerInput/index.js +0 -206
  57. package/admin/src/components/tests/__snapshots__/color-picker-input.test.js.snap +0 -238
  58. package/admin/src/components/tests/color-picker-input.test.js +0 -65
  59. package/admin/src/index.js +0 -88
  60. package/admin/src/pluginId.js +0 -5
  61. package/admin/src/utils/getTrad.js +0 -5
  62. package/color-picker.png +0 -0
  63. package/jest.config.front.js +0 -6
  64. package/server/index.js +0 -7
  65. package/server/register.js +0 -9
  66. 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
- });
@@ -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
- };
@@ -1,5 +0,0 @@
1
- const pluginPkg = require('../../package.json');
2
-
3
- const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
4
-
5
- module.exports = pluginId;
@@ -1,5 +0,0 @@
1
- import pluginId from '../pluginId';
2
-
3
- const getTrad = (id) => `${pluginId}.${id}`;
4
-
5
- export default getTrad;
package/color-picker.png DELETED
Binary file
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- preset: '../../../jest-preset.front.js',
5
- displayName: 'Color picker plugin',
6
- };
package/server/index.js DELETED
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- const register = require('./register');
4
-
5
- module.exports = {
6
- register,
7
- };
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = ({ strapi }) => {
4
- strapi.customFields.register({
5
- name: 'color',
6
- plugin: 'color-picker',
7
- type: 'string',
8
- });
9
- };
package/strapi-admin.js DELETED
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('./admin/src').default;