@lowdefy/blocks-color-selectors 4.0.0-alpha.8 → 4.0.0-rc.0

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-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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
27
  useClickOutside(popover, close, value);
29
- return(/*#__PURE__*/ React.createElement("div", {
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,16 +50,18 @@ 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,
55
- onChange: setColor,
53
+ color: value || '',
54
+ onChange: (newColor)=>{
55
+ onChange(newColor);
56
+ },
56
57
  prefixed: true,
57
58
  disabled: disabled
58
59
  }), isOpen && /*#__PURE__*/ React.createElement("div", {
59
60
  className: "color-picker-popover",
60
61
  ref: popover
61
62
  }, /*#__PURE__*/ React.createElement(HexColorPicker, {
62
- color: color,
63
- onChange: setColor
64
- }))));
63
+ color: value || DEFAULT_COLOR,
64
+ onChange: onChange
65
+ })));
65
66
  };
66
67
  export default ColorPicker;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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,11 +17,10 @@ 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
19
  const ColorSelector = ({ blockId , components , events , loading , methods , properties , required , validation , value , })=>{
20
- return(/*#__PURE__*/ React.createElement(Label, {
20
+ return /*#__PURE__*/ React.createElement(Label, {
21
21
  blockId: blockId,
22
22
  components: components,
23
23
  events: events,
24
- loading: loading,
25
24
  methods: methods,
26
25
  properties: {
27
26
  title: properties.title,
@@ -46,25 +45,18 @@ const ColorSelector = ({ blockId , components , events , loading , methods , pro
46
45
  });
47
46
  },
48
47
  size: properties.size,
49
- undefinedColor: properties.undefinedColor,
50
48
  value: value,
51
49
  hideInput: properties.hideInput,
52
- disabled: properties.disabled,
50
+ disabled: properties.disabled || loading,
53
51
  methods: methods
54
52
  })
55
53
  }
56
- }));
54
+ });
57
55
  };
58
56
  ColorSelector.defaultProps = blockDefaultProps;
59
57
  ColorSelector.meta = {
60
58
  valueType: 'string',
61
59
  category: 'input',
62
- loading: {
63
- type: 'Skeleton',
64
- properties: {
65
- height: 216
66
- }
67
- },
68
60
  icons: [
69
61
  ...Label.meta.icons
70
62
  ],
@@ -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-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 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.8",
3
+ "version": "4.0.0-rc.0",
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,39 @@
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",
48
+ "prepublishOnly": "pnpm build",
50
49
  "test:watch": "jest --coverage --watch",
51
50
  "test": "jest --coverage"
52
51
  },
53
52
  "dependencies": {
54
- "@lowdefy/block-utils": "4.0.0-alpha.8",
55
- "@lowdefy/blocks-antd": "4.0.0-alpha.8",
53
+ "@lowdefy/block-utils": "4.0.0-rc.0",
54
+ "@lowdefy/blocks-antd": "4.0.0-rc.0",
56
55
  "classnames": "2.3.1",
57
- "react": "17.0.2",
56
+ "react": "18.2.0",
58
57
  "react-colorful": "5.5.1",
59
- "react-dom": "17.0.2"
58
+ "react-dom": "18.2.0"
60
59
  },
61
60
  "devDependencies": {
62
- "@emotion/jest": "11.7.1",
63
- "@lowdefy/block-dev": "4.0.0-alpha.8",
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",
61
+ "@emotion/jest": "11.9.1",
62
+ "@lowdefy/block-dev": "4.0.0-rc.0",
63
+ "@lowdefy/jest-yaml-transform": "4.0.0-rc.0",
64
+ "@swc/cli": "0.1.57",
65
+ "@swc/core": "1.2.194",
66
+ "@swc/jest": "0.2.21",
67
+ "@testing-library/dom": "8.13.0",
68
+ "@testing-library/react": "13.3.0",
69
+ "@testing-library/user-event": "14.2.0",
70
70
  "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"
71
+ "jest": "28.1.0",
72
+ "jest-canvas-mock": "2.4.0",
73
+ "jest-environment-jsdom": "28.1.0",
74
+ "jest-serializer-html": "7.1.0"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
- "gitHead": "9d56b83cf45e868afe3a1eeba750fe826eb74c8c"
79
+ "gitHead": "f6872d7ff6da421710096536fce7b2016ef8f35c"
80
80
  }