@lowdefy/blocks-basic 4.0.0-alpha.29 → 4.0.0-alpha.31

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.
@@ -0,0 +1,65 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ /*
16
+ Copyright 2020-2022 Lowdefy, Inc
17
+
18
+ Licensed under the Apache License, Version 2.0 (the "License");
19
+ you may not use this file except in compliance with the License.
20
+ You may obtain a copy of the License at
21
+
22
+ http://www.apache.org/licenses/LICENSE-2.0
23
+
24
+ Unless required by applicable law or agreed to in writing, software
25
+ distributed under the License is distributed on an "AS IS" BASIS,
26
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
+ See the License for the specific language governing permissions and
28
+ limitations under the License.
29
+ */ import React from 'react';
30
+ import { get } from '@lowdefy/helpers';
31
+ import { blockDefaultProps } from '@lowdefy/block-utils';
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({
36
+ id: blockId,
37
+ className: methods.makeCssClass([
38
+ properties.style,
39
+ disabled && {
40
+ color: '#BEBEBE',
41
+ cursor: 'not-allowed'
42
+ },
43
+ ]),
44
+ disabled: disabled,
45
+ onClick: ()=>methods.triggerEvent({
46
+ name: 'onClick'
47
+ })
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
+ };
57
+ AnchorBlock.defaultProps = blockDefaultProps;
58
+ AnchorBlock.meta = {
59
+ category: 'display',
60
+ icons: [
61
+ 'AiOutlineLoading3Quarters'
62
+ ],
63
+ styles: []
64
+ };
65
+ export default AnchorBlock;
@@ -0,0 +1,96 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
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
+ },
33
+ "disabled": {
34
+ "type": "boolean",
35
+ "default": false,
36
+ "description": "Disable the anchor if true."
37
+ },
38
+ "icon": {
39
+ "type": ["string", "object"],
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.",
41
+ "docs": {
42
+ "displayType": "icon"
43
+ }
44
+ },
45
+ "pageId": {
46
+ "type": "string",
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."
52
+ },
53
+ "rel": {
54
+ "type": "string",
55
+ "default": "noopener noreferrer",
56
+ "description": "The relationship of the linked URL as space-separated link types."
57
+ },
58
+ "newTab": {
59
+ "type": "boolean",
60
+ "default": false,
61
+ "description": "Open link in a new tab when the anchor link is clicked."
62
+ },
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": {
69
+ "type": "boolean",
70
+ "default": false,
71
+ "description": "Disable scrolling to the top of the page after page transition. Can only be used with pageId link and newTab false."
72
+ },
73
+ "style": {
74
+ "type": "object",
75
+ "description": "Css style object to applied to anchor.",
76
+ "docs": {
77
+ "displayType": "yaml"
78
+ }
79
+ },
80
+ "title": {
81
+ "type": "string",
82
+ "description": "Text to display in the anchor."
83
+ }
84
+ }
85
+ },
86
+ "events": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "properties": {
90
+ "onClick": {
91
+ "type": "array",
92
+ "description": "Called when Anchor is clicked."
93
+ }
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import React from 'react';
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ const Box = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ React.createElement("div", {
18
+ id: blockId,
19
+ "data-testid": blockId,
20
+ onClick: ()=>methods.triggerEvent({
21
+ name: 'onClick'
22
+ }),
23
+ className: methods.makeCssClass([
24
+ {
25
+ outline: 'none',
26
+ cursor: events.onClick && 'pointer'
27
+ },
28
+ properties.style,
29
+ ])
30
+ }, properties.content || content.content && content.content());
31
+ Box.defaultProps = blockDefaultProps;
32
+ Box.meta = {
33
+ category: 'container',
34
+ icons: [],
35
+ styles: []
36
+ };
37
+ export default Box;
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "content": {
8
+ "type": "string",
9
+ "description": "Box content string. Overrides the \"content\" content area."
10
+ },
11
+ "style": {
12
+ "type": "object",
13
+ "description": "Css style object to apply to Box div.",
14
+ "docs": {
15
+ "displayType": "yaml"
16
+ }
17
+ }
18
+ }
19
+ },
20
+ "events": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "onClick": {
25
+ "type": "array",
26
+ "description": "Trigger actions when the Box is clicked."
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import React from 'react';
16
+ import DOMPurify from 'dompurify';
17
+ import { blockDefaultProps } from '@lowdefy/block-utils';
18
+ import { type } from '@lowdefy/helpers';
19
+ let DangerousHtml = class DangerousHtml extends React.Component {
20
+ componentDidMount() {
21
+ const htmlString = type.isNone(this.props.properties.html) ? '' : this.props.properties.html.toString();
22
+ this.div.innerHTML = DOMPurify.sanitize(htmlString, this.DOMPurifyOptions);
23
+ }
24
+ componentDidUpdate() {
25
+ const htmlString = type.isNone(this.props.properties.html) ? '' : this.props.properties.html.toString();
26
+ this.div.innerHTML = DOMPurify.sanitize(htmlString, this.DOMPurifyOptions);
27
+ }
28
+ render() {
29
+ const { blockId , properties , methods } = this.props;
30
+ return /*#__PURE__*/ React.createElement("div", {
31
+ id: blockId,
32
+ "data-testid": blockId,
33
+ ref: (el)=>{
34
+ if (el) {
35
+ this.div = el;
36
+ }
37
+ },
38
+ className: methods.makeCssClass(properties.style)
39
+ });
40
+ }
41
+ constructor(props){
42
+ super(props);
43
+ this.div = {
44
+ innerHTML: ''
45
+ };
46
+ // we do not revaluate DOMPurifyOptions improve options safety by not making options dynamic.
47
+ this.DOMPurifyOptions = props.properties.DOMPurifyOptions;
48
+ }
49
+ };
50
+ DangerousHtml.defaultProps = blockDefaultProps;
51
+ DangerousHtml.meta = {
52
+ category: 'display',
53
+ icons: [],
54
+ styles: []
55
+ };
56
+ export default DangerousHtml;
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "html": {
8
+ "type": "string",
9
+ "description": "Content to be rendered as Html.",
10
+ "docs": {
11
+ "displayType": "text-area"
12
+ }
13
+ },
14
+ "DOMPurifyOptions": {
15
+ "type": "object",
16
+ "description": "Customize DOMPurify options. Options are only applied when the block is mounted, thus any parsed settings is only applied at first render.",
17
+ "docs": {
18
+ "displayType": "yaml"
19
+ }
20
+ },
21
+ "style": {
22
+ "type": "object",
23
+ "description": "Css style object to apply to Html div.",
24
+ "docs": {
25
+ "displayType": "yaml"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import React from 'react';
16
+ import { blockDefaultProps, HtmlComponent } from '@lowdefy/block-utils';
17
+ const HtmlBlock = ({ blockId , properties , methods })=>/*#__PURE__*/ React.createElement(HtmlComponent, {
18
+ div: true,
19
+ html: properties.html,
20
+ id: blockId,
21
+ methods: methods,
22
+ style: properties.style
23
+ });
24
+ HtmlBlock.defaultProps = blockDefaultProps;
25
+ HtmlBlock.meta = {
26
+ category: 'display',
27
+ icons: [],
28
+ styles: []
29
+ };
30
+ export default HtmlBlock;
@@ -0,0 +1,23 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "html": {
8
+ "type": "string",
9
+ "description": "Content to be rendered as Html.",
10
+ "docs": {
11
+ "displayType": "text-area"
12
+ }
13
+ },
14
+ "style": {
15
+ "type": "object",
16
+ "description": "Css style object to apply to Html div.",
17
+ "docs": {
18
+ "displayType": "yaml"
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,38 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ /*
16
+ Copyright 2020-2022 Lowdefy, Inc
17
+
18
+ Licensed under the Apache License, Version 2.0 (the "License");
19
+ you may not use this file except in compliance with the License.
20
+ You may obtain a copy of the License at
21
+
22
+ http://www.apache.org/licenses/LICENSE-2.0
23
+
24
+ Unless required by applicable law or agreed to in writing, software
25
+ distributed under the License is distributed on an "AS IS" BASIS,
26
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
+ See the License for the specific language governing permissions and
28
+ limitations under the License.
29
+ */ import React from 'react';
30
+ import { blockDefaultProps } from '@lowdefy/block-utils';
31
+ const IconBlock = ({ components: { Icon } , ...props })=>/*#__PURE__*/ React.createElement(Icon, _extends({}, props));
32
+ IconBlock.defaultProps = blockDefaultProps;
33
+ IconBlock.meta = {
34
+ category: 'display',
35
+ icons: [],
36
+ styles: []
37
+ };
38
+ export default IconBlock;
@@ -0,0 +1,63 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "color": {
8
+ "type": "string",
9
+ "description": "Primary icon color.",
10
+ "docs": {
11
+ "displayType": "color"
12
+ }
13
+ },
14
+ "name": {
15
+ "type": "string",
16
+ "default": "AiOutlineCloseCircle",
17
+ "description": "Name of icon to be displayed."
18
+ },
19
+ "rotate": {
20
+ "type": "number",
21
+ "description": "Number of degrees to rotate the icon."
22
+ },
23
+ "size": {
24
+ "type": ["string", "number"],
25
+ "description": "Size of the icon.",
26
+ "docs": {
27
+ "displayType": "number"
28
+ }
29
+ },
30
+ "spin": {
31
+ "type": "boolean",
32
+ "default": false,
33
+ "description": "Continuously spin icon with animation."
34
+ },
35
+ "title": {
36
+ "type": "string",
37
+ "description": "Icon description for accessibility."
38
+ },
39
+ "style": {
40
+ "type": "object",
41
+ "description": "CSS style object.",
42
+ "docs": {
43
+ "displayType": "yaml"
44
+ }
45
+ },
46
+ "disableLoadingIcon": {
47
+ "type": "boolean",
48
+ "default": false,
49
+ "description": "While loading after the icon has been clicked, don't render the loading icon."
50
+ }
51
+ }
52
+ },
53
+ "events": {
54
+ "type": "object",
55
+ "additionalProperties": false,
56
+ "properties": {
57
+ "onClick": {
58
+ "type": "array",
59
+ "description": "Trigger actions when icon is clicked."
60
+ }
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,54 @@
1
+ function _extends() {
2
+ _extends = Object.assign || function(target) {
3
+ for(var i = 1; i < arguments.length; i++){
4
+ var source = arguments[i];
5
+ for(var key in source){
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ /*
16
+ Copyright 2020-2022 Lowdefy, Inc
17
+
18
+ Licensed under the Apache License, Version 2.0 (the "License");
19
+ you may not use this file except in compliance with the License.
20
+ You may obtain a copy of the License at
21
+
22
+ http://www.apache.org/licenses/LICENSE-2.0
23
+
24
+ Unless required by applicable law or agreed to in writing, software
25
+ distributed under the License is distributed on an "AS IS" BASIS,
26
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
+ See the License for the specific language governing permissions and
28
+ limitations under the License.
29
+ */ import React from 'react';
30
+ import { blockDefaultProps } from '@lowdefy/block-utils';
31
+ const ImgBlock = ({ blockId , events , properties , methods })=>{
32
+ const { style , ...allProps } = properties;
33
+ return /*#__PURE__*/ React.createElement("img", _extends({}, allProps, {
34
+ id: blockId,
35
+ "data-testid": blockId,
36
+ onClick: ()=>methods.triggerEvent({
37
+ name: 'onClick'
38
+ }),
39
+ className: methods.makeCssClass([
40
+ {
41
+ outline: 'none',
42
+ cursor: events.onClick && 'pointer'
43
+ },
44
+ style,
45
+ ])
46
+ }));
47
+ };
48
+ ImgBlock.defaultProps = blockDefaultProps;
49
+ ImgBlock.meta = {
50
+ category: 'display',
51
+ icons: [],
52
+ styles: []
53
+ };
54
+ export default ImgBlock;
@@ -0,0 +1,59 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["src"],
7
+ "properties": {
8
+ "src": {
9
+ "type": "string",
10
+ "description": "The image URL."
11
+ },
12
+ "alt": {
13
+ "type": "string",
14
+ "description": "Alternative text description of the image."
15
+ },
16
+ "crossOrigin": {
17
+ "type": "string",
18
+ "enum": ["anonymous", "use-credentials"],
19
+ "description": "Indicates if the fetching of the image must be done using a CORS request."
20
+ },
21
+ "decoding": {
22
+ "type": "string",
23
+ "enum": ["sync", "async", "auto"],
24
+ "description": "An image decoding hint to the browser. Sync for atomic presentation with other content, async, to reduce delay in presenting other content and auto leave to browser to decide."
25
+ },
26
+ "height": {
27
+ "type": "number",
28
+ "description": "Height of the image."
29
+ },
30
+ "loading": {
31
+ "type": "string",
32
+ "enum": ["eager", "lazy"],
33
+ "description": "How the browser should load the image. Eager loads the image immediately, lazy, defers loading until the image it reaches a calculated distance from the viewport, as defined by the browser."
34
+ },
35
+ "sizes": {
36
+ "type": "string",
37
+ "description": "Indicating a set of source sizes of strings separated by commas."
38
+ },
39
+ "srcSet": {
40
+ "type": "string",
41
+ "description": "Possible image sources for the user agent to use, strings separated by commas.",
42
+ "docs": {
43
+ "displayType": "text-area"
44
+ }
45
+ },
46
+ "style": {
47
+ "type": "object",
48
+ "description": "Css style object to applied to the image.",
49
+ "docs": {
50
+ "displayType": "yaml"
51
+ }
52
+ },
53
+ "width": {
54
+ "type": "number",
55
+ "description": "Width of the image."
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,53 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import React, { useEffect } from 'react';
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ import Box from '../Box/Box.js';
18
+ const List = ({ blockId , events , list , methods , properties })=>{
19
+ useEffect(()=>{
20
+ methods.registerMethod('pushItem', methods.pushItem);
21
+ methods.registerMethod('unshiftItem', methods.unshiftItem);
22
+ methods.registerMethod('removeItem', methods.removeItem);
23
+ methods.registerMethod('moveItemDown', methods.moveItemDown);
24
+ methods.registerMethod('moveItemUp', methods.moveItemUp);
25
+ }, []);
26
+ return /*#__PURE__*/ React.createElement(Box, {
27
+ blockId: blockId,
28
+ events: events,
29
+ properties: {
30
+ style: {
31
+ ...properties.direction ? {
32
+ display: 'flex',
33
+ flexDirection: properties.direction,
34
+ flexWrap: properties.wrap ? properties.wrap : 'wrap',
35
+ overflow: properties.scroll ? 'auto' : 'visible'
36
+ } : {},
37
+ ...properties.style
38
+ }
39
+ },
40
+ methods: methods,
41
+ content: {
42
+ content: ()=>list.map((item)=>item.content())
43
+ }
44
+ });
45
+ };
46
+ List.defaultProps = blockDefaultProps;
47
+ List.meta = {
48
+ category: 'list',
49
+ valueType: 'array',
50
+ icons: [],
51
+ styles: []
52
+ };
53
+ export default List;
@@ -0,0 +1,40 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "direction": {
8
+ "type": "string",
9
+ "enum": ["row", "column", "row-reverse", "column-reverse"],
10
+ "description": "List content along a 'row' or down a 'column'. Applies the 'flex-direction' css property to the List block."
11
+ },
12
+ "wrap": {
13
+ "type": "string",
14
+ "enum": ["wrap", "nowrap", "wrap-reverse"],
15
+ "description": "Specifies wrapping style to be applied to List block as 'wrap', 'nowrap' or 'wrap-reverse'. Applies the 'flex-wrap' css property to the List block - defaults to 'wrap', requires List direction to be set."
16
+ },
17
+ "scroll": {
18
+ "type": "boolean",
19
+ "description": "Specifies whether scrolling should be applied to the List, can be true or false. Applies the 'overflow' css property to the List block - defaults to 'visible', requires List direction to be set."
20
+ },
21
+ "style": {
22
+ "type": "object",
23
+ "description": "Css style object to apply to List block.",
24
+ "docs": {
25
+ "displayType": "yaml"
26
+ }
27
+ }
28
+ }
29
+ },
30
+ "events": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "onClick": {
35
+ "type": "array",
36
+ "description": "Trigger actions when the List is clicked."
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import React from 'react';
16
+ import { blockDefaultProps } from '@lowdefy/block-utils';
17
+ const Span = ({ blockId , content , events , methods , properties })=>/*#__PURE__*/ React.createElement("span", {
18
+ id: blockId,
19
+ "data-testid": blockId,
20
+ onClick: ()=>methods.triggerEvent({
21
+ name: 'onClick'
22
+ }),
23
+ className: methods.makeCssClass([
24
+ {
25
+ outline: 'none',
26
+ cursor: events.onClick && 'pointer'
27
+ },
28
+ properties.style,
29
+ ])
30
+ }, properties.content || content.content && content.content());
31
+ Span.defaultProps = blockDefaultProps;
32
+ Span.meta = {
33
+ category: 'container',
34
+ icons: [],
35
+ styles: []
36
+ };
37
+ export default Span;
@@ -0,0 +1,30 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "content": {
8
+ "type": "string",
9
+ "description": "Span content string. Overrides the \"content\" content area."
10
+ },
11
+ "style": {
12
+ "type": "object",
13
+ "description": "Css style object to apply to Span div.",
14
+ "docs": {
15
+ "displayType": "yaml"
16
+ }
17
+ }
18
+ }
19
+ },
20
+ "events": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "onClick": {
25
+ "type": "array",
26
+ "description": "Trigger actions when the Span is clicked."
27
+ }
28
+ }
29
+ }
30
+ }
package/dist/blocks.js ADDED
@@ -0,0 +1,22 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export { default as Anchor } from './blocks/Anchor/Anchor.js';
16
+ export { default as Box } from './blocks/Box/Box.js';
17
+ export { default as DangerousHtml } from './blocks/DangerousHtml/DangerousHtml.js';
18
+ export { default as Html } from './blocks/Html/Html.js';
19
+ export { default as Icon } from './blocks/Icon/Icon.js';
20
+ export { default as Img } from './blocks/Img/Img.js';
21
+ export { default as List } from './blocks/List/List.js';
22
+ export { default as Span } from './blocks/Span/Span.js';
package/dist/types.js ADDED
@@ -0,0 +1,32 @@
1
+ /* eslint-disable import/namespace */ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-basic",
3
- "version": "4.0.0-alpha.29",
3
+ "version": "4.0.0-alpha.31",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Basic html Lowdefy blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -48,16 +48,16 @@
48
48
  "test": "jest --coverage"
49
49
  },
50
50
  "dependencies": {
51
- "@lowdefy/block-utils": "4.0.0-alpha.29",
52
- "@lowdefy/helpers": "4.0.0-alpha.29",
51
+ "@lowdefy/block-utils": "4.0.0-alpha.31",
52
+ "@lowdefy/helpers": "4.0.0-alpha.31",
53
53
  "dompurify": "2.3.8",
54
- "react": "18.1.0",
55
- "react-dom": "18.1.0"
54
+ "react": "18.2.0",
55
+ "react-dom": "18.2.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@emotion/jest": "11.9.1",
59
- "@lowdefy/block-dev": "4.0.0-alpha.29",
60
- "@lowdefy/jest-yaml-transform": "4.0.0-alpha.29",
59
+ "@lowdefy/block-dev": "4.0.0-alpha.31",
60
+ "@lowdefy/jest-yaml-transform": "4.0.0-alpha.31",
61
61
  "@swc/cli": "0.1.57",
62
62
  "@swc/core": "1.2.194",
63
63
  "@swc/jest": "0.2.21",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "621a191ebc0a1569ee6669dc74c12f8be5a8c7f3"
75
+ "gitHead": "96ef86d4ce4849f8f11110662efbbaede1bcd5a5"
76
76
  }