@lowdefy/blocks-color-selectors 4.0.0-alpha.9 → 4.0.0-rc.1

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -17,16 +17,15 @@ import { HexColorPicker, HexColorInput } from 'react-colorful';
17
17
  import classNames from 'classnames';
18
18
  import useClickOutside from './useClickOutside.js';
19
19
  const DEFAULT_COLOR = '#000000';
20
- export const ColorPicker = ({ className , disabled , hideInput , onChange , size , undefinedColor , value , })=>{
20
+ export const ColorPicker = ({ className , disabled , hideInput , onChange , size , value =DEFAULT_COLOR })=>{
21
21
  const popover = useRef();
22
22
  const [isOpen, toggle] = useState(false);
23
- const [color, setColor] = useState(value || undefinedColor || DEFAULT_COLOR);
24
23
  const close = useCallback((newColor)=>{
25
24
  toggle(false);
26
25
  onChange(newColor);
27
26
  }, []);
28
- useClickOutside(popover, close, color);
29
- return(/*#__PURE__*/ React.createElement("div", {
27
+ useClickOutside(popover, close, value);
28
+ return /*#__PURE__*/ React.createElement("div", {
30
29
  className: classNames({
31
30
  'color-picker': true,
32
31
  [className]: true
@@ -39,7 +38,7 @@ export const ColorPicker = ({ className , disabled , hideInput , onChange , size
39
38
  'color-picker-swatch-disabled': disabled
40
39
  }),
41
40
  style: {
42
- backgroundColor: color
41
+ backgroundColor: value
43
42
  },
44
43
  onClick: ()=>!disabled && toggle(true)
45
44
  }), !hideInput && /*#__PURE__*/ React.createElement(HexColorInput, {
@@ -51,9 +50,8 @@ export const ColorPicker = ({ className , disabled , hideInput , onChange , size
51
50
  'ant-input-sm': size === 'small',
52
51
  'ant-input-lg': size === 'large'
53
52
  }),
54
- color: color,
53
+ color: value || '',
55
54
  onChange: (newColor)=>{
56
- setColor(newColor);
57
55
  onChange(newColor);
58
56
  },
59
57
  prefixed: true,
@@ -62,8 +60,8 @@ export const ColorPicker = ({ className , disabled , hideInput , onChange , size
62
60
  className: "color-picker-popover",
63
61
  ref: popover
64
62
  }, /*#__PURE__*/ React.createElement(HexColorPicker, {
65
- color: color,
66
- onChange: setColor
67
- }))));
63
+ color: value || DEFAULT_COLOR,
64
+ onChange: onChange
65
+ })));
68
66
  };
69
67
  export default ColorPicker;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
16
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  import Label from '@lowdefy/blocks-antd/blocks/Label/Label.js';
18
18
  import ColorPicker from './ColorPicker.js';
19
- const ColorSelector = ({ blockId , components , events , loading , methods , properties , required , validation , value , })=>{
20
- return(/*#__PURE__*/ React.createElement(Label, {
19
+ const ColorSelector = ({ blockId , components , events , loading , methods , properties , required , validation , value })=>{
20
+ return /*#__PURE__*/ React.createElement(Label, {
21
21
  blockId: blockId,
22
22
  components: components,
23
23
  events: events,
@@ -36,7 +36,7 @@ const ColorSelector = ({ blockId , components , events , loading , methods , pro
36
36
  {
37
37
  marginBottom: '0px !important'
38
38
  },
39
- properties.inputStyle,
39
+ properties.inputStyle
40
40
  ]),
41
41
  onChange: (newColor)=>{
42
42
  methods.setValue(newColor);
@@ -45,14 +45,13 @@ const ColorSelector = ({ blockId , components , events , loading , methods , pro
45
45
  });
46
46
  },
47
47
  size: properties.size,
48
- undefinedColor: properties.undefinedColor,
49
48
  value: value,
50
49
  hideInput: properties.hideInput,
51
50
  disabled: properties.disabled || loading,
52
51
  methods: methods
53
52
  })
54
53
  }
55
- }));
54
+ });
56
55
  };
57
56
  ColorSelector.defaultProps = blockDefaultProps;
58
57
  ColorSelector.meta = {
@@ -7,14 +7,6 @@
7
7
  "type": "string",
8
8
  "description": "Title to describe the input component, if no title is specified the block id is displayed."
9
9
  },
10
- "undefinedColor": {
11
- "type": "string",
12
- "default": "#000000",
13
- "description": "Default color to display if input value is null.",
14
- "docs": {
15
- "displayType": "color"
16
- }
17
- },
18
10
  "inputStyle": {
19
11
  "type": "object",
20
12
  "description": "Css style to applied to input.",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/blocks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable import/namespace */ /*
2
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-color-selectors",
3
- "version": "4.0.0-alpha.9",
3
+ "version": "4.0.0-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "A Lowdefy color selector blocks based on react-color.",
6
6
  "homepage": "https://lowdefy.com",
@@ -42,39 +42,38 @@
42
42
  "dist/*"
43
43
  ],
44
44
  "scripts": {
45
- "build": "yarn swc",
45
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
46
46
  "clean": "rm -rf dist",
47
47
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
48
- "prepare": "yarn build",
49
- "swc": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && yarn copyfiles",
50
- "test:watch": "jest --coverage --watch",
51
- "test": "jest --coverage"
48
+ "prepublishOnly": "pnpm build",
49
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
52
50
  },
53
51
  "dependencies": {
54
- "@lowdefy/block-utils": "4.0.0-alpha.9",
55
- "@lowdefy/blocks-antd": "4.0.0-alpha.9",
56
- "classnames": "2.3.1",
57
- "react": "17.0.2",
58
- "react-colorful": "5.5.1",
59
- "react-dom": "17.0.2"
52
+ "@lowdefy/block-utils": "4.0.0-rc.1",
53
+ "@lowdefy/blocks-antd": "4.0.0-rc.1",
54
+ "classnames": "2.3.2",
55
+ "react": "18.2.0",
56
+ "react-colorful": "5.6.1",
57
+ "react-dom": "18.2.0"
60
58
  },
61
59
  "devDependencies": {
62
- "@emotion/jest": "11.7.1",
63
- "@lowdefy/block-dev": "4.0.0-alpha.9",
64
- "@swc/cli": "0.1.55",
65
- "@swc/core": "1.2.135",
66
- "@swc/jest": "0.2.17",
67
- "@testing-library/dom": "8.11.3",
68
- "@testing-library/react": "13.0.0-alpha.4",
69
- "@testing-library/user-event": "14.0.0-alpha.14",
60
+ "@emotion/jest": "11.10.5",
61
+ "@lowdefy/block-dev": "4.0.0-rc.1",
62
+ "@lowdefy/jest-yaml-transform": "4.0.0-rc.1",
63
+ "@swc/cli": "0.1.59",
64
+ "@swc/core": "1.3.24",
65
+ "@swc/jest": "0.2.24",
66
+ "@testing-library/dom": "8.19.1",
67
+ "@testing-library/react": "13.4.0",
68
+ "@testing-library/user-event": "14.4.3",
70
69
  "copyfiles": "2.4.1",
71
- "jest": "27.5.1",
72
- "jest-canvas-mock": "2.3.1",
73
- "jest-serializer-html": "7.1.0",
74
- "jest-transform-yaml": "1.0.0"
70
+ "jest": "28.1.0",
71
+ "jest-canvas-mock": "2.4.0",
72
+ "jest-environment-jsdom": "28.1.0",
73
+ "jest-serializer-html": "7.1.0"
75
74
  },
76
75
  "publishConfig": {
77
76
  "access": "public"
78
77
  },
79
- "gitHead": "98b544eca231bdcfca6c3a8601a891835d5ce571"
78
+ "gitHead": "ecc4f16c19eede929eda177db524cf13a8053379"
80
79
  }