@lowdefy/blocks-basic 4.0.0-alpha.6 → 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.
@@ -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, type } from '@lowdefy/helpers';
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(Tag, {
44
- blockId: blockId,
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
- 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
- })
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;
@@ -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
- "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",
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.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"
@@ -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.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"
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.7",
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": "52ec14639d00de910cf9b8ab25bf933ca891cff5"
76
76
  }