@lowdefy/blocks-antd 6.0.0 → 6.1.0

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.
@@ -13,7 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
- import { Button, ConfigProvider } from 'antd';
16
+ import { Button, ConfigProvider, Tooltip } from 'antd';
17
17
  import { get, type } from '@lowdefy/helpers';
18
18
  import { renderHtml, withBlockDefaults } from '@lowdefy/block-utils';
19
19
  import withTheme from '../withTheme.js';
@@ -60,7 +60,12 @@ const ButtonBlock = ({ blockId, classNames = {}, components: { Icon, ShortcutBad
60
60
  const { color: buttonColor, variant, type: buttonType } = getButtonProps(properties);
61
61
  const isPresetColor = ANTD_COLOR_PRESETS.has(properties.color);
62
62
  const resolvedColor = isPresetColor ? buttonColor : properties.color ? 'primary' : buttonColor;
63
- const button = /*#__PURE__*/ React.createElement(Button, {
63
+ // An icon-only button still has to say what it does: with hideTitle the
64
+ // title becomes the hover text unless `tooltip` names its own. A button that
65
+ // shows its title gets a tooltip only when asked.
66
+ const titleHidden = properties.hideTitle || properties.shape === 'circle' && type.isNone(properties.title);
67
+ const tooltip = type.isString(properties.tooltip) ? properties.tooltip : titleHidden && !type.isNone(properties.title) ? properties.title : null;
68
+ const rawButton = /*#__PURE__*/ React.createElement(Button, {
64
69
  block: properties.block,
65
70
  className: classNames.element,
66
71
  style: styles.element,
@@ -101,6 +106,10 @@ const ButtonBlock = ({ blockId, classNames = {}, components: { Icon, ShortcutBad
101
106
  }), /*#__PURE__*/ React.createElement(ShortcutBadge, {
102
107
  shortcut: events[onClickActionName]?.shortcut
103
108
  })));
109
+ const button = tooltip ? /*#__PURE__*/ React.createElement(Tooltip, {
110
+ title: tooltip,
111
+ mouseEnterDelay: 0.3
112
+ }, rawButton) : rawButton;
104
113
  if (properties.color && !isPresetColor) {
105
114
  return /*#__PURE__*/ React.createElement(ConfigProvider, {
106
115
  theme: {
@@ -59,6 +59,10 @@
59
59
  description: "Hide the button's title.",
60
60
  default: false
61
61
  },
62
+ tooltip: {
63
+ type: 'string',
64
+ description: 'Hover text for the button. An icon-only button (`hideTitle: true`) shows its `title` as the tooltip when this is not set.'
65
+ },
62
66
  href: {
63
67
  type: 'string',
64
68
  description: 'The URL to redirect to when the button is clicked. Useful when used with a type link button.'
@@ -89,6 +89,11 @@
89
89
  properties:
90
90
  hideTitle: true
91
91
  icon: AiOutlineDelete
92
+ - id: 'properties.tooltip: Save'
93
+ type: Button
94
+ properties:
95
+ title: Save
96
+ tooltip: Save the form
92
97
  - id: 'properties.href: www.lowdefy.com'
93
98
  type: Button
94
99
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-antd",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Ant Design Blocks",
6
6
  "homepage": "https://lowdefy.com",
@@ -45,9 +45,9 @@
45
45
  ],
46
46
  "dependencies": {
47
47
  "@ant-design/icons": "6.1.0",
48
- "@lowdefy/block-utils": "6.0.0",
49
- "@lowdefy/helpers": "6.0.0",
50
- "@lowdefy/nunjucks": "6.0.0",
48
+ "@lowdefy/block-utils": "6.1.0",
49
+ "@lowdefy/helpers": "6.1.0",
50
+ "@lowdefy/nunjucks": "6.1.0",
51
51
  "@rc-component/motion": "1.3.1",
52
52
  "classnames": "2.5.1",
53
53
  "dayjs": "1.11.20",
@@ -60,9 +60,9 @@
60
60
  "react-dom": ">=18"
61
61
  },
62
62
  "devDependencies": {
63
- "@lowdefy/block-dev-e2e": "6.0.0",
64
- "@lowdefy/e2e-utils": "6.0.0",
65
- "@lowdefy/node-utils": "6.0.0",
63
+ "@lowdefy/block-dev-e2e": "6.1.0",
64
+ "@lowdefy/e2e-utils": "6.1.0",
65
+ "@lowdefy/node-utils": "6.1.0",
66
66
  "@playwright/test": "1.59.1",
67
67
  "@swc/cli": "0.8.1",
68
68
  "@swc/core": "1.15.32",