@lowdefy/blocks-basic 4.0.0-alpha.1 → 4.0.0-alpha.12

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,39 +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
- }
61
+ icons: [
62
+ 'AiOutlineLoading3Quarters'
63
+ ],
64
+ styles: []
86
65
  };
87
- AnchorBlock.styles = [];
88
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,13 @@ 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
36
+ icons: [],
37
+ styles: []
39
38
  };
40
- Box.styles = [];
41
39
  export default Box;
@@ -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,7 @@ let DangerousHtml = class DangerousHtml extends React.Component {
51
50
  DangerousHtml.defaultProps = blockDefaultProps;
52
51
  DangerousHtml.meta = {
53
52
  category: 'display',
54
- loading: false
53
+ icons: [],
54
+ styles: []
55
55
  };
56
- DangerousHtml.styles = [];
57
56
  export default DangerousHtml;
@@ -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,7 @@ const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx(Html
26
25
  HtmlBlock.defaultProps = blockDefaultProps;
27
26
  HtmlBlock.meta = {
28
27
  category: 'display',
29
- loading: false
28
+ icons: [],
29
+ styles: []
30
30
  };
31
- HtmlBlock.styles = [];
32
31
  export default HtmlBlock;
@@ -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,26 @@ 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
36
+ icons: [],
37
+ styles: []
26
38
  };
27
- IconBlock.styles = [];
28
39
  export default IconBlock;
@@ -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,12 @@ 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
52
+ icons: [],
53
+ styles: []
41
54
  };
42
- ImgBlock.styles = [];
43
55
  export default ImgBlock;
@@ -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: {
@@ -34,8 +33,7 @@ const List = ({ blockId , events , list , methods , properties })=>{
34
33
  flexDirection: properties.direction,
35
34
  flexWrap: properties.wrap ? properties.wrap : 'wrap',
36
35
  overflow: properties.scroll ? 'auto' : 'visible'
37
- } : {
38
- },
36
+ } : {},
39
37
  ...properties.style
40
38
  }
41
39
  },
@@ -50,7 +48,7 @@ List.defaultProps = blockDefaultProps;
50
48
  List.meta = {
51
49
  category: 'list',
52
50
  valueType: 'array',
53
- loading: false
51
+ icons: [],
52
+ styles: []
54
53
  };
55
- List.styles = [];
56
54
  export default List;
@@ -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,13 @@ 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
36
+ icons: [],
37
+ styles: []
39
38
  };
40
- Span.styles = [];
41
39
  export default Span;
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
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
1
+ /* eslint-disable import/namespace */ /*
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.
@@ -12,18 +12,21 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ export default {
16
- blocks: [
17
- 'Anchor',
18
- 'Box',
19
- 'DangerousHtml',
20
- 'Html',
21
- 'Icon',
22
- 'Img',
23
- 'List',
24
- 'Span'
25
- ],
26
- styles: [
27
- 'style.less'
28
- ]
29
- };
15
+ */ import * as blocks from './blocks.js';
16
+ const icons = {};
17
+ const styles = {};
18
+ Object.keys(blocks).forEach((block)=>{
19
+ icons[block] = blocks[block].meta.icons || [];
20
+ styles[block] = blocks[block].meta.styles || [];
21
+ });
22
+ export default {
23
+ blocks: Object.keys(blocks),
24
+ icons,
25
+ styles: {
26
+ default: [],
27
+ ...styles
28
+ }
29
+ }; // export default {
30
+ // blocks: ['Anchor', 'Box', 'DangerousHtml', 'Html', 'Icon', 'Img', 'List', 'Span'],
31
+ // styles: { default: ['style.less'], Anchor: ['blocks/Anchor/style.less'] },
32
+ // };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-basic",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.12",
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"
@@ -19,6 +20,10 @@
19
20
  {
20
21
  "name": "Gerrie van Wyk",
21
22
  "url": "https://github.com/Gervwyk"
23
+ },
24
+ {
25
+ "name": "Sandile Memela",
26
+ "url": "https://github.com/sah-memela"
22
27
  }
23
28
  ],
24
29
  "repository": {
@@ -27,6 +32,7 @@
27
32
  },
28
33
  "type": "module",
29
34
  "exports": {
35
+ "./*": "./dist/*",
30
36
  "./blocks": "./dist/blocks.js",
31
37
  "./types": "./dist/types.js"
32
38
  },
@@ -43,29 +49,28 @@
43
49
  "test": "jest --coverage"
44
50
  },
45
51
  "dependencies": {
46
- "@lowdefy/block-utils": "4.0.0-alpha.1",
47
- "@lowdefy/helpers": "4.0.0-alpha.1",
48
- "dompurify": "2.3.3",
49
- "react": "18.0.0-alpha-327d5c484-20211106",
50
- "react-dom": "18.0.0-alpha-327d5c484-20211106"
52
+ "@lowdefy/block-utils": "4.0.0-alpha.12",
53
+ "@lowdefy/helpers": "4.0.0-alpha.12",
54
+ "dompurify": "2.3.5",
55
+ "react": "17.0.2",
56
+ "react-dom": "17.0.2"
51
57
  },
52
58
  "devDependencies": {
53
- "@babel/preset-react": "7.16.0",
54
- "@emotion/jest": "11.5.0",
55
- "@lowdefy/block-dev": "4.0.0-alpha.1",
56
- "@swc/cli": "0.1.52",
57
- "@swc/core": "1.2.112",
58
- "@swc/jest": "0.2.9",
59
- "@testing-library/dom": "8.10.1",
59
+ "@emotion/jest": "11.7.1",
60
+ "@lowdefy/block-dev": "4.0.0-alpha.12",
61
+ "@swc/cli": "0.1.55",
62
+ "@swc/core": "1.2.135",
63
+ "@swc/jest": "0.2.17",
64
+ "@testing-library/dom": "8.11.3",
60
65
  "@testing-library/react": "13.0.0-alpha.4",
61
66
  "@testing-library/user-event": "14.0.0-alpha.14",
62
67
  "copyfiles": "2.4.1",
63
- "jest": "27.3.1",
68
+ "jest": "27.5.1",
64
69
  "jest-serializer-html": "7.1.0",
65
- "jest-transform-yaml": "0.1.2"
70
+ "jest-transform-yaml": "1.0.0"
66
71
  },
67
72
  "publishConfig": {
68
73
  "access": "public"
69
74
  },
70
- "gitHead": "c97a8fa6b5a641e7d50df09f5601a9c586eeb65a"
75
+ "gitHead": "41b6138a81bee7da362dad06345bc9f87b2c2133"
71
76
  }