@lowdefy/blocks-basic 4.0.0-alpha.1 → 4.0.0-alpha.7
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.
- package/dist/blocks/Anchor/Anchor.js +20 -44
- package/dist/blocks/Anchor/schema.json +39 -4
- package/dist/blocks/Box/Box.js +3 -2
- package/dist/blocks/DangerousHtml/DangerousHtml.js +3 -2
- package/dist/blocks/Html/Html.js +3 -2
- package/dist/blocks/Icon/Icon.js +3 -2
- package/dist/blocks/Img/Img.js +3 -2
- package/dist/blocks/List/List.js +4 -4
- package/dist/blocks/Span/Span.js +3 -2
- package/dist/types.js +19 -16
- package/package.json +22 -17
|
@@ -14,34 +14,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
See the License for the specific language governing permissions and
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/ import React from 'react';
|
|
17
|
-
import { get
|
|
17
|
+
import { get } from '@lowdefy/helpers';
|
|
18
18
|
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, {
|
|
30
|
-
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
19
|
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
20
|
const showLoading = get(events, 'onClick.loading') || loading;
|
|
42
21
|
const disabled = properties.disabled || showLoading;
|
|
43
|
-
return(/*#__PURE__*/ _jsx(
|
|
44
|
-
|
|
22
|
+
return(/*#__PURE__*/ _jsx(Link, {
|
|
23
|
+
id: blockId,
|
|
45
24
|
className: methods.makeCssClass([
|
|
46
25
|
properties.style,
|
|
47
26
|
disabled && {
|
|
@@ -50,28 +29,24 @@ const AnchorBlock = ({ blockId , events , components: { Icon , Link } , loading
|
|
|
50
29
|
},
|
|
51
30
|
]),
|
|
52
31
|
disabled: disabled,
|
|
53
|
-
href: properties.href,
|
|
54
|
-
Link: Link,
|
|
55
|
-
rel: properties.rel,
|
|
56
|
-
newTab: properties.newTab,
|
|
57
32
|
onClick: ()=>methods.triggerEvent({
|
|
58
33
|
name: 'onClick'
|
|
59
34
|
})
|
|
60
35
|
,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
36
|
+
...properties,
|
|
37
|
+
children: (defaultTitle)=>/*#__PURE__*/ _jsxs(_Fragment, {
|
|
38
|
+
children: [
|
|
39
|
+
properties.icon && /*#__PURE__*/ _jsx(Icon, {
|
|
40
|
+
blockId: `${blockId}_icon`,
|
|
41
|
+
events: events,
|
|
42
|
+
properties: showLoading ? {
|
|
43
|
+
name: 'LoadingOutlined',
|
|
44
|
+
spin: true
|
|
45
|
+
} : properties.icon
|
|
46
|
+
}) + ` `,
|
|
47
|
+
properties.title || defaultTitle
|
|
48
|
+
]
|
|
49
|
+
})
|
|
75
50
|
}));
|
|
76
51
|
};
|
|
77
52
|
AnchorBlock.defaultProps = blockDefaultProps;
|
|
@@ -82,7 +57,8 @@ AnchorBlock.meta = {
|
|
|
82
57
|
properties: {
|
|
83
58
|
lines: 1
|
|
84
59
|
}
|
|
85
|
-
}
|
|
60
|
+
},
|
|
61
|
+
icons: [],
|
|
62
|
+
styles: []
|
|
86
63
|
};
|
|
87
|
-
AnchorBlock.styles = [];
|
|
88
64
|
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,
|
|
@@ -16,9 +42,13 @@
|
|
|
16
42
|
"displayType": "icon"
|
|
17
43
|
}
|
|
18
44
|
},
|
|
19
|
-
"
|
|
45
|
+
"pageId": {
|
|
20
46
|
"type": "string",
|
|
21
|
-
"description": "
|
|
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
|
-
"
|
|
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": "
|
|
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",
|
package/dist/blocks/Box/Box.js
CHANGED
|
@@ -35,7 +35,8 @@ const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE_
|
|
|
35
35
|
Box.defaultProps = blockDefaultProps;
|
|
36
36
|
Box.meta = {
|
|
37
37
|
category: 'container',
|
|
38
|
-
loading: false
|
|
38
|
+
loading: false,
|
|
39
|
+
icons: [],
|
|
40
|
+
styles: []
|
|
39
41
|
};
|
|
40
|
-
Box.styles = [];
|
|
41
42
|
export default Box;
|
|
@@ -51,7 +51,8 @@ let DangerousHtml = class DangerousHtml extends React.Component {
|
|
|
51
51
|
DangerousHtml.defaultProps = blockDefaultProps;
|
|
52
52
|
DangerousHtml.meta = {
|
|
53
53
|
category: 'display',
|
|
54
|
-
loading: false
|
|
54
|
+
loading: false,
|
|
55
|
+
icons: [],
|
|
56
|
+
styles: []
|
|
55
57
|
};
|
|
56
|
-
DangerousHtml.styles = [];
|
|
57
58
|
export default DangerousHtml;
|
package/dist/blocks/Html/Html.js
CHANGED
|
@@ -26,7 +26,8 @@ const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx(Html
|
|
|
26
26
|
HtmlBlock.defaultProps = blockDefaultProps;
|
|
27
27
|
HtmlBlock.meta = {
|
|
28
28
|
category: 'display',
|
|
29
|
-
loading: false
|
|
29
|
+
loading: false,
|
|
30
|
+
icons: [],
|
|
31
|
+
styles: []
|
|
30
32
|
};
|
|
31
|
-
HtmlBlock.styles = [];
|
|
32
33
|
export default HtmlBlock;
|
package/dist/blocks/Icon/Icon.js
CHANGED
|
@@ -22,7 +22,8 @@ const IconBlock = ({ components: { Icon } , ...props })=>/*#__PURE__*/ _jsx(Ico
|
|
|
22
22
|
IconBlock.defaultProps = blockDefaultProps;
|
|
23
23
|
IconBlock.meta = {
|
|
24
24
|
category: 'display',
|
|
25
|
-
loading: false
|
|
25
|
+
loading: false,
|
|
26
|
+
icons: [],
|
|
27
|
+
styles: []
|
|
26
28
|
};
|
|
27
|
-
IconBlock.styles = [];
|
|
28
29
|
export default IconBlock;
|
package/dist/blocks/Img/Img.js
CHANGED
|
@@ -37,7 +37,8 @@ const ImgBlock = ({ blockId , events , properties , methods })=>{
|
|
|
37
37
|
ImgBlock.defaultProps = blockDefaultProps;
|
|
38
38
|
ImgBlock.meta = {
|
|
39
39
|
category: 'display',
|
|
40
|
-
loading: false
|
|
40
|
+
loading: false,
|
|
41
|
+
icons: [],
|
|
42
|
+
styles: []
|
|
41
43
|
};
|
|
42
|
-
ImgBlock.styles = [];
|
|
43
44
|
export default ImgBlock;
|
package/dist/blocks/List/List.js
CHANGED
|
@@ -34,8 +34,7 @@ const List = ({ blockId , events , list , methods , properties })=>{
|
|
|
34
34
|
flexDirection: properties.direction,
|
|
35
35
|
flexWrap: properties.wrap ? properties.wrap : 'wrap',
|
|
36
36
|
overflow: properties.scroll ? 'auto' : 'visible'
|
|
37
|
-
} : {
|
|
38
|
-
},
|
|
37
|
+
} : {},
|
|
39
38
|
...properties.style
|
|
40
39
|
}
|
|
41
40
|
},
|
|
@@ -50,7 +49,8 @@ List.defaultProps = blockDefaultProps;
|
|
|
50
49
|
List.meta = {
|
|
51
50
|
category: 'list',
|
|
52
51
|
valueType: 'array',
|
|
53
|
-
loading: false
|
|
52
|
+
loading: false,
|
|
53
|
+
icons: [],
|
|
54
|
+
styles: []
|
|
54
55
|
};
|
|
55
|
-
List.styles = [];
|
|
56
56
|
export default List;
|
package/dist/blocks/Span/Span.js
CHANGED
|
@@ -35,7 +35,8 @@ const Span = ({ blockId , content , events , methods , properties })=>/*#__PURE
|
|
|
35
35
|
Span.defaultProps = blockDefaultProps;
|
|
36
36
|
Span.meta = {
|
|
37
37
|
category: 'container',
|
|
38
|
-
loading: false
|
|
38
|
+
loading: false,
|
|
39
|
+
icons: [],
|
|
40
|
+
styles: []
|
|
39
41
|
};
|
|
40
|
-
Span.styles = [];
|
|
41
42
|
export default Span;
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* eslint-disable import/namespace */ /*
|
|
2
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (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
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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.
|
|
3
|
+
"version": "4.0.0-alpha.7",
|
|
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.
|
|
47
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
48
|
-
"dompurify": "2.3.
|
|
49
|
-
"react": "18.0.0-
|
|
50
|
-
"react-dom": "18.0.0-
|
|
52
|
+
"@lowdefy/block-utils": "4.0.0-alpha.7",
|
|
53
|
+
"@lowdefy/helpers": "4.0.0-alpha.7",
|
|
54
|
+
"dompurify": "2.3.5",
|
|
55
|
+
"react": "18.0.0-rc.0",
|
|
56
|
+
"react-dom": "18.0.0-rc.0"
|
|
51
57
|
},
|
|
52
58
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@swc/
|
|
57
|
-
"@swc/
|
|
58
|
-
"@
|
|
59
|
-
"@testing-library/dom": "8.10.1",
|
|
59
|
+
"@emotion/jest": "11.7.1",
|
|
60
|
+
"@lowdefy/block-dev": "4.0.0-alpha.7",
|
|
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.
|
|
68
|
+
"jest": "27.5.1",
|
|
64
69
|
"jest-serializer-html": "7.1.0",
|
|
65
|
-
"jest-transform-yaml": "0.
|
|
70
|
+
"jest-transform-yaml": "1.0.0"
|
|
66
71
|
},
|
|
67
72
|
"publishConfig": {
|
|
68
73
|
"access": "public"
|
|
69
74
|
},
|
|
70
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "52ec14639d00de910cf9b8ab25bf933ca891cff5"
|
|
71
76
|
}
|