@lowdefy/blocks-basic 4.0.0-alpha.6 → 4.0.0-alpha.9

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,6 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -14,34 +13,27 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
14
13
  See the License for the specific language governing permissions and
15
14
  limitations under the License.
16
15
  */ import React from 'react';
17
- import { get, type } from '@lowdefy/helpers';
16
+ import { get } from '@lowdefy/helpers';
18
17
  import { blockDefaultProps } from '@lowdefy/block-utils';
19
- const Strong = ({ children , strong })=>strong ? /*#__PURE__*/ _jsx("b", {
20
- children: children
21
- }) : /*#__PURE__*/ _jsx(_Fragment, {
22
- children: children
23
- })
24
- ;
25
- const Tag = ({ blockId , children , className , disabled , href , Link , newTab , onClick , rel })=>disabled ? /*#__PURE__*/ _jsx("span", {
26
- id: blockId,
27
- className: className,
28
- children: children
29
- }) : /*#__PURE__*/ _jsx(Link, {
18
+ function _extends() {
19
+ _extends = Object.assign || function(target) {
20
+ for(var i = 1; i < arguments.length; i++){
21
+ var source = arguments[i];
22
+ for(var key in source){
23
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
24
+ target[key] = source[key];
25
+ }
26
+ }
27
+ }
28
+ return target;
29
+ };
30
+ return _extends.apply(this, arguments);
31
+ }
32
+ const AnchorBlock = ({ blockId , events , components: { Icon , Link } , methods , properties })=>{
33
+ const disabled = properties.disabled || get(events, 'onClick.loading');
34
+ const { icon , title , ...linkProperties } = properties;
35
+ return(/*#__PURE__*/ React.createElement(Link, _extends({
30
36
  id: blockId,
31
- className: className,
32
- href: href,
33
- onClick: onClick,
34
- rel: rel || 'noopener noreferrer',
35
- target: newTab ? '_blank' : '_self',
36
- children: children
37
- })
38
- ;
39
- const AnchorBlock = ({ blockId , events , components: { Icon , Link } , loading , methods , properties , })=>{
40
- const title = type.isNone(properties.title) ? type.isNone(properties.href) ? properties.href : blockId : properties.title;
41
- const showLoading = get(events, 'onClick.loading') || loading;
42
- const disabled = properties.disabled || showLoading;
43
- return(/*#__PURE__*/ _jsx(Tag, {
44
- blockId: blockId,
45
37
  className: methods.makeCssClass([
46
38
  properties.style,
47
39
  disabled && {
@@ -50,40 +42,25 @@ const AnchorBlock = ({ blockId , events , components: { Icon , Link } , loading
50
42
  },
51
43
  ]),
52
44
  disabled: disabled,
53
- href: properties.href,
54
- Link: Link,
55
- rel: properties.rel,
56
- newTab: properties.newTab,
57
45
  onClick: ()=>methods.triggerEvent({
58
46
  name: 'onClick'
59
47
  })
60
- ,
61
- children: /*#__PURE__*/ _jsxs(Strong, {
62
- strong: properties.strong,
63
- children: [
64
- properties.icon && /*#__PURE__*/ _jsx(Icon, {
65
- blockId: `${blockId}_icon`,
66
- events: events,
67
- properties: showLoading ? {
68
- name: 'LoadingOutlined',
69
- spin: true
70
- } : properties.icon
71
- }),
72
- ` ${title}`
73
- ]
74
- })
75
- }));
48
+ }, linkProperties), (defaultTitle)=>/*#__PURE__*/ React.createElement(React.Fragment, null, icon && /*#__PURE__*/ React.createElement(Icon, {
49
+ blockId: `${blockId}_icon`,
50
+ events: events,
51
+ properties: get(events, 'onClick.loading') ? {
52
+ name: 'AiOutlineLoading3Quarters',
53
+ spin: true
54
+ } : icon
55
+ }), title || defaultTitle)
56
+ ));
76
57
  };
77
58
  AnchorBlock.defaultProps = blockDefaultProps;
78
59
  AnchorBlock.meta = {
79
60
  category: 'display',
80
- loading: {
81
- type: 'SkeletonParagraph',
82
- properties: {
83
- lines: 1
84
- }
85
- },
86
- icons: [],
61
+ icons: [
62
+ 'AiOutlineLoading3Quarters'
63
+ ],
87
64
  styles: []
88
65
  };
89
66
  export default AnchorBlock;
@@ -4,6 +4,32 @@
4
4
  "type": "object",
5
5
  "additionalProperties": false,
6
6
  "properties": {
7
+ "ariaLabel": {
8
+ "type": "string",
9
+ "description": "Arial-label to apply to link tag."
10
+ },
11
+ "back": {
12
+ "type": "boolean",
13
+ "description": "When the link is clicked, trigger the browser back."
14
+ },
15
+ "home": {
16
+ "type": "boolean",
17
+ "description": "When the link is clicked, route to the home page."
18
+ },
19
+ "input": {
20
+ "type": "object",
21
+ "description": "When the link is clicked, pass data as the input object to the next Lowdefy page. Can only be used with pageId link and newTab false.",
22
+ "docs": {
23
+ "displayType": "yaml"
24
+ }
25
+ },
26
+ "urlQuery": {
27
+ "type": "object",
28
+ "description": "When the link is clicked, pass data as a url query to the next page.",
29
+ "docs": {
30
+ "displayType": "yaml"
31
+ }
32
+ },
7
33
  "disabled": {
8
34
  "type": "boolean",
9
35
  "default": false,
@@ -11,14 +37,18 @@
11
37
  },
12
38
  "icon": {
13
39
  "type": ["string", "object"],
14
- "description": "Name of an Ant Design Icon or properties of an Icon block for anchor icon.",
40
+ "description": "Name of an React-Icon (See <a href='https://react-icons.github.io/react-icons/'>all icons</a>) or properties of an Icon block for anchor icon.",
15
41
  "docs": {
16
42
  "displayType": "icon"
17
43
  }
18
44
  },
19
- "href": {
45
+ "pageId": {
20
46
  "type": "string",
21
- "description": "Anchor element href property."
47
+ "description": "When the link is clicked, route to the provided Lowdefy page."
48
+ },
49
+ "url": {
50
+ "type": "string",
51
+ "description": "External url to link to when the anchor link is clicked."
22
52
  },
23
53
  "rel": {
24
54
  "type": "string",
@@ -30,10 +60,15 @@
30
60
  "default": false,
31
61
  "description": "Open link in a new tab when the anchor link is clicked."
32
62
  },
33
- "strong": {
63
+ "replace": {
64
+ "type": "boolean",
65
+ "default": false,
66
+ "description": "Prevent adding a new entry into browser history by replacing the url instead of pushing into history. Can only be used with pageId link and newTab false."
67
+ },
68
+ "scroll": {
34
69
  "type": "boolean",
35
70
  "default": false,
36
- "description": "Makes the text bold when true."
71
+ "description": "Disable scrolling to the top of the page after page transition. Can only be used with pageId link and newTab false."
37
72
  },
38
73
  "style": {
39
74
  "type": "object",
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -15,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
14
  limitations under the License.
16
15
  */ import React from 'react';
17
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
18
- const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ _jsx("div", {
17
+ const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ React.createElement("div", {
19
18
  id: blockId,
20
19
  "data-testid": blockId,
21
20
  onClick: ()=>methods.triggerEvent({
@@ -28,14 +27,12 @@ const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE_
28
27
  cursor: events.onClick && 'pointer'
29
28
  },
30
29
  properties.style,
31
- ]),
32
- children: properties.content || content.content && content.content()
33
- })
30
+ ])
31
+ }, properties.content || content.content && content.content())
34
32
  ;
35
33
  Box.defaultProps = blockDefaultProps;
36
34
  Box.meta = {
37
35
  category: 'container',
38
- loading: false,
39
36
  icons: [],
40
37
  styles: []
41
38
  };
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -28,7 +27,7 @@ let DangerousHtml = class DangerousHtml extends React.Component {
28
27
  }
29
28
  render() {
30
29
  const { blockId , properties , methods } = this.props;
31
- return(/*#__PURE__*/ _jsx("div", {
30
+ return(/*#__PURE__*/ React.createElement("div", {
32
31
  id: blockId,
33
32
  "data-testid": blockId,
34
33
  ref: (el)=>{
@@ -51,7 +50,6 @@ let DangerousHtml = class DangerousHtml extends React.Component {
51
50
  DangerousHtml.defaultProps = blockDefaultProps;
52
51
  DangerousHtml.meta = {
53
52
  category: 'display',
54
- loading: false,
55
53
  icons: [],
56
54
  styles: []
57
55
  };
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -15,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
14
  limitations under the License.
16
15
  */ import React from 'react';
17
16
  import { blockDefaultProps, HtmlComponent } from '@lowdefy/block-utils';
18
- const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx(HtmlComponent, {
17
+ const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ React.createElement(HtmlComponent, {
19
18
  div: true,
20
19
  html: properties.html,
21
20
  id: blockId,
@@ -26,7 +25,6 @@ const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx(Html
26
25
  HtmlBlock.defaultProps = blockDefaultProps;
27
26
  HtmlBlock.meta = {
28
27
  category: 'display',
29
- loading: false,
30
28
  icons: [],
31
29
  styles: []
32
30
  };
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -15,14 +14,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
14
  limitations under the License.
16
15
  */ import React from 'react';
17
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
18
- const IconBlock = ({ components: { Icon } , ...props })=>/*#__PURE__*/ _jsx(Icon, {
19
- ...props
20
- })
17
+ function _extends() {
18
+ _extends = Object.assign || function(target) {
19
+ for(var i = 1; i < arguments.length; i++){
20
+ var source = arguments[i];
21
+ for(var key in source){
22
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
23
+ target[key] = source[key];
24
+ }
25
+ }
26
+ }
27
+ return target;
28
+ };
29
+ return _extends.apply(this, arguments);
30
+ }
31
+ const IconBlock = ({ components: { Icon } , ...props })=>/*#__PURE__*/ React.createElement(Icon, _extends({}, props))
21
32
  ;
22
33
  IconBlock.defaultProps = blockDefaultProps;
23
34
  IconBlock.meta = {
24
35
  category: 'display',
25
- loading: false,
26
36
  icons: [],
27
37
  styles: []
28
38
  };
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "name": {
15
15
  "type": "string",
16
- "default": "AiCloseCircleOutlined",
16
+ "default": "AiOutlineCloseCircle",
17
17
  "description": "Name of icon to be displayed."
18
18
  },
19
19
  "rotate": {
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -15,10 +14,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
14
  limitations under the License.
16
15
  */ import React from 'react';
17
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ function _extends() {
18
+ _extends = Object.assign || function(target) {
19
+ for(var i = 1; i < arguments.length; i++){
20
+ var source = arguments[i];
21
+ for(var key in source){
22
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
23
+ target[key] = source[key];
24
+ }
25
+ }
26
+ }
27
+ return target;
28
+ };
29
+ return _extends.apply(this, arguments);
30
+ }
18
31
  const ImgBlock = ({ blockId , events , properties , methods })=>{
19
32
  const { style , ...allProps } = properties;
20
- return(/*#__PURE__*/ _jsx("img", {
21
- ...allProps,
33
+ return(/*#__PURE__*/ React.createElement("img", _extends({}, allProps, {
22
34
  id: blockId,
23
35
  "data-testid": blockId,
24
36
  onClick: ()=>methods.triggerEvent({
@@ -32,12 +44,11 @@ const ImgBlock = ({ blockId , events , properties , methods })=>{
32
44
  },
33
45
  style,
34
46
  ])
35
- }));
47
+ })));
36
48
  };
37
49
  ImgBlock.defaultProps = blockDefaultProps;
38
50
  ImgBlock.meta = {
39
51
  category: 'display',
40
- loading: false,
41
52
  icons: [],
42
53
  styles: []
43
54
  };
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -24,7 +23,7 @@ const List = ({ blockId , events , list , methods , properties })=>{
24
23
  methods.registerMethod('moveItemDown', methods.moveItemDown);
25
24
  methods.registerMethod('moveItemUp', methods.moveItemUp);
26
25
  }, []);
27
- return(/*#__PURE__*/ _jsx(Box, {
26
+ return(/*#__PURE__*/ React.createElement(Box, {
28
27
  blockId: blockId,
29
28
  events: events,
30
29
  properties: {
@@ -49,7 +48,6 @@ List.defaultProps = blockDefaultProps;
49
48
  List.meta = {
50
49
  category: 'list',
51
50
  valueType: 'array',
52
- loading: false,
53
51
  icons: [],
54
52
  styles: []
55
53
  };
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -15,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
14
  limitations under the License.
16
15
  */ import React from 'react';
17
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
18
- const Span = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ _jsx("span", {
17
+ const Span = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ React.createElement("span", {
19
18
  id: blockId,
20
19
  "data-testid": blockId,
21
20
  onClick: ()=>methods.triggerEvent({
@@ -28,14 +27,12 @@ const Span = ({ blockId , content , events , methods , properties })=>/*#__PURE
28
27
  cursor: events.onClick && 'pointer'
29
28
  },
30
29
  properties.style,
31
- ]),
32
- children: properties.content || content.content && content.content()
33
- })
30
+ ])
31
+ }, properties.content || content.content && content.content())
34
32
  ;
35
33
  Span.defaultProps = blockDefaultProps;
36
34
  Span.meta = {
37
35
  category: 'container',
38
- loading: false,
39
36
  icons: [],
40
37
  styles: []
41
38
  };
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,12 +1,13 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-basic",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.9",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Basic html Lowdefy blocks.",
6
6
  "homepage": "https://lowdefy.com",
7
7
  "keywords": [
8
8
  "lowdefy",
9
- "lowdefy blocks"
9
+ "lowdefy blocks",
10
+ "lowdefy plugin"
10
11
  ],
11
12
  "bugs": {
12
13
  "url": "https://github.com/lowdefy/lowdefy/issues"
@@ -48,29 +49,28 @@
48
49
  "test": "jest --coverage"
49
50
  },
50
51
  "dependencies": {
51
- "@lowdefy/block-utils": "4.0.0-alpha.6",
52
- "@lowdefy/helpers": "4.0.0-alpha.6",
53
- "dompurify": "2.3.3",
54
- "react": "18.0.0-alpha-327d5c484-20211106",
55
- "react-dom": "18.0.0-alpha-327d5c484-20211106"
52
+ "@lowdefy/block-utils": "4.0.0-alpha.9",
53
+ "@lowdefy/helpers": "4.0.0-alpha.9",
54
+ "dompurify": "2.3.5",
55
+ "react": "17.0.2",
56
+ "react-dom": "17.0.2"
56
57
  },
57
58
  "devDependencies": {
58
- "@babel/preset-react": "7.16.0",
59
- "@emotion/jest": "11.5.0",
60
- "@lowdefy/block-dev": "4.0.0-alpha.6",
59
+ "@emotion/jest": "11.7.1",
60
+ "@lowdefy/block-dev": "4.0.0-alpha.9",
61
61
  "@swc/cli": "0.1.55",
62
- "@swc/core": "1.2.130",
62
+ "@swc/core": "1.2.135",
63
63
  "@swc/jest": "0.2.17",
64
- "@testing-library/dom": "8.10.1",
64
+ "@testing-library/dom": "8.11.3",
65
65
  "@testing-library/react": "13.0.0-alpha.4",
66
66
  "@testing-library/user-event": "14.0.0-alpha.14",
67
67
  "copyfiles": "2.4.1",
68
- "jest": "27.3.1",
68
+ "jest": "27.5.1",
69
69
  "jest-serializer-html": "7.1.0",
70
- "jest-transform-yaml": "0.1.2"
70
+ "jest-transform-yaml": "1.0.0"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "2530e31af795b6a3c75ac8f72c8dbe0ab5d1251b"
75
+ "gitHead": "98b544eca231bdcfca6c3a8601a891835d5ce571"
76
76
  }