@lowdefy/blocks-antd 5.3.0 → 5.4.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.
Files changed (97) hide show
  1. package/dist/blocks/AutoComplete/AutoComplete.js +1 -0
  2. package/dist/blocks/AutoComplete/meta.js +2 -1
  3. package/dist/blocks/ButtonSelector/ButtonSelector.js +74 -27
  4. package/dist/blocks/ButtonSelector/meta.js +18 -4
  5. package/dist/blocks/Carousel/meta.js +16 -0
  6. package/dist/blocks/CheckboxSelector/CheckboxSelector.js +46 -14
  7. package/dist/blocks/CheckboxSelector/meta.js +7 -1
  8. package/dist/blocks/CheckboxSwitch/CheckboxSwitch.js +1 -0
  9. package/dist/blocks/CheckboxSwitch/meta.js +4 -1
  10. package/dist/blocks/ColorSelector/ColorSelector.js +1 -0
  11. package/dist/blocks/ColorSelector/meta.js +2 -1
  12. package/dist/blocks/ConfigProvider/ConfigProvider.js +1 -0
  13. package/dist/blocks/ConfigProvider/meta.js +7 -0
  14. package/dist/blocks/ConfirmModal/ConfirmModal.js +2 -2
  15. package/dist/blocks/ConfirmModal/meta.js +2 -4
  16. package/dist/blocks/DateRangeSelector/DateRangeSelector.js +4 -9
  17. package/dist/blocks/DateRangeSelector/meta.js +4 -8
  18. package/dist/blocks/DateSelector/DateSelector.js +4 -3
  19. package/dist/blocks/DateSelector/meta.js +4 -5
  20. package/dist/blocks/DateTimeSelector/DateTimeSelector.js +4 -3
  21. package/dist/blocks/DateTimeSelector/meta.js +4 -5
  22. package/dist/blocks/DropdownMenu/meta.js +46 -6
  23. package/dist/blocks/Label/Label.js +30 -5
  24. package/dist/blocks/Label/meta.js +8 -2
  25. package/dist/blocks/ListSelector/ListSelector.js +384 -0
  26. package/dist/blocks/ListSelector/e2e.js +40 -0
  27. package/dist/blocks/ListSelector/meta.js +215 -0
  28. package/dist/blocks/Menu/Menu.js +26 -80
  29. package/dist/blocks/Menu/meta.js +160 -64
  30. package/dist/blocks/MobileMenu/meta.js +50 -50
  31. package/dist/blocks/Modal/Modal.js +2 -2
  32. package/dist/blocks/Modal/meta.js +2 -4
  33. package/dist/blocks/MonthSelector/MonthSelector.js +4 -3
  34. package/dist/blocks/MonthSelector/meta.js +4 -5
  35. package/dist/blocks/MultipleSelector/MultipleSelector.js +41 -9
  36. package/dist/blocks/MultipleSelector/meta.js +24 -5
  37. package/dist/blocks/NumberInput/NumberInput.js +3 -1
  38. package/dist/blocks/NumberInput/meta.js +3 -3
  39. package/dist/blocks/PageHeaderMenu/PageHeaderMenu.js +10 -2
  40. package/dist/blocks/PageHeaderMenu/meta.js +8 -1
  41. package/dist/blocks/PageSidebarLayout/PageSidebarLayout.js +2 -1
  42. package/dist/blocks/PageSidebarLayout/meta.js +8 -1
  43. package/dist/blocks/PageSiderMenu/PageSiderMenu.js +2 -1
  44. package/dist/blocks/PageSiderMenu/meta.js +8 -1
  45. package/dist/blocks/PasswordInput/PasswordInput.js +1 -0
  46. package/dist/blocks/PasswordInput/meta.js +2 -1
  47. package/dist/blocks/PhoneNumberInput/PhoneNumberInput.js +1 -0
  48. package/dist/blocks/PhoneNumberInput/meta.js +2 -1
  49. package/dist/blocks/RadioSelector/RadioSelector.js +44 -14
  50. package/dist/blocks/RadioSelector/meta.js +7 -1
  51. package/dist/blocks/RatingSlider/meta.js +2 -1
  52. package/dist/blocks/SegmentedSelector/SegmentedSelector.js +10 -4
  53. package/dist/blocks/SegmentedSelector/meta.js +7 -4
  54. package/dist/blocks/Selector/Selector.js +55 -9
  55. package/dist/blocks/Selector/meta.js +24 -5
  56. package/dist/blocks/Slider/Slider.js +1 -0
  57. package/dist/blocks/Slider/meta.js +2 -1
  58. package/dist/blocks/Switch/Switch.js +1 -0
  59. package/dist/blocks/Switch/meta.js +2 -1
  60. package/dist/blocks/Tabs/Tabs.js +30 -43
  61. package/dist/blocks/Tabs/meta.js +8 -10
  62. package/dist/blocks/TextArea/TextArea.js +1 -0
  63. package/dist/blocks/TextArea/meta.js +2 -1
  64. package/dist/blocks/TextInput/TextInput.js +1 -0
  65. package/dist/blocks/TextInput/meta.js +2 -1
  66. package/dist/blocks/TreeInput/TreeInput.js +91 -0
  67. package/dist/blocks/TreeInput/e2e.js +33 -0
  68. package/dist/blocks/TreeInput/meta.js +68 -0
  69. package/dist/blocks/TreeMultipleSelector/TreeMultipleSelector.js +161 -0
  70. package/dist/blocks/TreeMultipleSelector/e2e.js +46 -0
  71. package/dist/blocks/TreeMultipleSelector/meta.js +128 -0
  72. package/dist/blocks/TreeSelector/TreeSelector.js +127 -88
  73. package/dist/blocks/TreeSelector/e2e.js +20 -9
  74. package/dist/blocks/TreeSelector/meta.js +70 -254
  75. package/dist/blocks/WeekSelector/WeekSelector.js +2 -1
  76. package/dist/blocks/WeekSelector/meta.js +3 -3
  77. package/dist/blocks/buildMenuItems.js +89 -26
  78. package/dist/blocks/headerActions.js +87 -3
  79. package/dist/blocks/normalizeItemClassAndStyle.js +77 -0
  80. package/dist/blocks.js +3 -0
  81. package/dist/e2e.js +3 -0
  82. package/dist/getContrastTextColor.js +45 -0
  83. package/dist/getOptionColorStyle.js +36 -0
  84. package/dist/getSelectedIndex.js +42 -0
  85. package/dist/getSelectorOptions.js +67 -0
  86. package/dist/getTreeData.js +94 -0
  87. package/dist/metas.js +3 -0
  88. package/dist/schemas/dataOptions.js +36 -0
  89. package/dist/schemas/index.js +1 -0
  90. package/dist/schemas/label.js +3 -1
  91. package/dist/schemas/labelTooltip.js +44 -0
  92. package/dist/schemas/options.js +7 -3
  93. package/dist/schemas/treeSelectTheme.js +125 -0
  94. package/dist/serializeSelectorValue.js +38 -0
  95. package/dist/useSelectorOptions.js +38 -0
  96. package/dist/useSetData.js +27 -0
  97. package/package.json +9 -7
@@ -22,6 +22,7 @@ const Option = AutoComplete.Option;
22
22
  const AutoCompleteInput = ({ blockId, classNames = {}, components, events, loading, methods, properties, required, styles = {}, validation, value })=>{
23
23
  return /*#__PURE__*/ React.createElement(Label, {
24
24
  blockId: blockId,
25
+ methods: methods,
25
26
  classNames: classNames,
26
27
  components: components,
27
28
  events: events,
@@ -44,7 +44,8 @@ export default {
44
44
  event: {
45
45
  value: 'The search input value.'
46
46
  }
47
- }
47
+ },
48
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
48
49
  },
49
50
  properties: {
50
51
  type: 'object',
@@ -17,17 +17,41 @@ import { ConfigProvider, Radio } from 'antd';
17
17
  import { renderHtml, withBlockDefaults } from '@lowdefy/block-utils';
18
18
  import { type } from '@lowdefy/helpers';
19
19
  import Label from '../Label/Label.js';
20
- import getValueIndex from '../../getValueIndex.js';
21
- import getUniqueValues from '../../getUniqueValues.js';
20
+ import getSelectedIndex from '../../getSelectedIndex.js';
21
+ import useSelectorOptions from '../../useSelectorOptions.js';
22
+ import getContrastTextColor from '../../getContrastTextColor.js';
22
23
  import withTheme from '../withTheme.js';
23
24
  const ButtonSelector = ({ blockId, classNames = {}, components, events, loading, properties, required, styles = {}, validation, value, methods })=>{
24
- const uniqueValueOptions = getUniqueValues(properties.options || []);
25
+ const uniqueValueOptions = useSelectorOptions({
26
+ properties,
27
+ methods
28
+ });
29
+ // `variant` (solid | outlined) matches the Button block. `buttonStyle` is a
30
+ // deprecated alias kept for backward compatibility.
31
+ const variant = properties.variant ?? (properties.buttonStyle === 'outline' ? 'outlined' : 'solid');
32
+ const isOutline = variant === 'outlined';
33
+ const selectedIndex = type.isNone(value) ? undefined : getSelectedIndex(value, uniqueValueOptions, {
34
+ properties
35
+ });
36
+ const contrastColor = getContrastTextColor(properties.color);
37
+ const themeConfig = {
38
+ token: {
39
+ colorPrimary: properties.color
40
+ }
41
+ };
42
+ if (contrastColor) {
43
+ themeConfig.components = {
44
+ Radio: {
45
+ buttonSolidCheckedColor: contrastColor
46
+ }
47
+ };
48
+ }
25
49
  const radioGroup = /*#__PURE__*/ React.createElement(Radio.Group, {
26
50
  id: `${blockId}_input`,
27
51
  className: classNames.element,
28
52
  disabled: properties.disabled || loading,
29
53
  size: properties.size,
30
- buttonStyle: properties.buttonStyle ? properties.buttonStyle : 'solid',
54
+ buttonStyle: isOutline ? 'outline' : 'solid',
31
55
  style: styles.element,
32
56
  onChange: (event)=>{
33
57
  const value = type.isPrimitive(uniqueValueOptions[event.target.value]) ? uniqueValueOptions[event.target.value] : uniqueValueOptions[event.target.value].value;
@@ -39,30 +63,59 @@ const ButtonSelector = ({ blockId, classNames = {}, components, events, loading,
39
63
  }
40
64
  });
41
65
  },
42
- value: type.isNone(value) ? undefined : getValueIndex(value, properties.options || [])
43
- }, uniqueValueOptions.map((opt, i)=>type.isPrimitive(opt) ? /*#__PURE__*/ React.createElement(Radio.Button, {
66
+ value: type.isNone(value) ? undefined : getSelectedIndex(value, uniqueValueOptions, {
67
+ properties
68
+ })
69
+ }, uniqueValueOptions.map((opt, i)=>{
70
+ const isPrimitive = type.isPrimitive(opt);
71
+ const optColor = isPrimitive ? undefined : opt.color;
72
+ const isSelected = `${i}` === selectedIndex;
73
+ // The outline tint follows currentColor (the active colorPrimary), which is
74
+ // the option's own color when set, else the block-level color.
75
+ const selectedStyle = isSelected && isOutline ? {
76
+ backgroundColor: 'color-mix(in srgb, currentColor 12%, transparent)'
77
+ } : undefined;
78
+ let html;
79
+ if (isPrimitive) {
80
+ html = `${opt}`;
81
+ } else {
82
+ html = type.isNone(opt.label) ? `${opt.value}` : opt.label;
83
+ }
84
+ const button = /*#__PURE__*/ React.createElement(Radio.Button, {
44
85
  id: `${blockId}_${i}`,
45
86
  key: i,
46
87
  value: `${i}`,
47
- disabled: properties.disabled || loading
88
+ disabled: (isPrimitive ? undefined : opt.disabled) || properties.disabled || loading,
89
+ style: {
90
+ ...isPrimitive ? {} : opt.style,
91
+ ...selectedStyle
92
+ }
48
93
  }, renderHtml({
49
- html: `${opt}`,
94
+ html,
50
95
  methods
51
- })) : /*#__PURE__*/ React.createElement(Radio.Button, {
52
- id: `${blockId}_${i}`,
96
+ }));
97
+ if (type.isNone(optColor)) return button;
98
+ // Per-option color drives both the hover state and the checked fill/outline,
99
+ // independent of the selected value or block-level color.
100
+ const optContrast = getContrastTextColor(optColor);
101
+ const optTheme = {
102
+ token: {
103
+ colorPrimary: optColor
104
+ }
105
+ };
106
+ if (optContrast) optTheme.components = {
107
+ Radio: {
108
+ buttonSolidCheckedColor: optContrast
109
+ }
110
+ };
111
+ return /*#__PURE__*/ React.createElement(ConfigProvider, {
53
112
  key: i,
54
- value: `${i}`,
55
- disabled: opt.disabled || properties.disabled || loading,
56
- style: opt.style
57
- }, type.isNone(opt.label) ? renderHtml({
58
- html: `${opt.value}`,
59
- methods
60
- }) : renderHtml({
61
- html: opt.label,
62
- methods
63
- }))));
113
+ theme: optTheme
114
+ }, button);
115
+ }));
64
116
  return /*#__PURE__*/ React.createElement(Label, {
65
117
  blockId: blockId,
118
+ methods: methods,
66
119
  classNames: classNames,
67
120
  components: components,
68
121
  events: events,
@@ -76,13 +129,7 @@ const ButtonSelector = ({ blockId, classNames = {}, components, events, loading,
76
129
  styles: styles,
77
130
  content: {
78
131
  content: ()=>properties.color ? /*#__PURE__*/ React.createElement(ConfigProvider, {
79
- theme: {
80
- components: {
81
- Radio: {
82
- colorPrimary: properties.color
83
- }
84
- }
85
- }
132
+ theme: themeConfig
86
133
  }, radioGroup) : radioGroup
87
134
  }
88
135
  });
@@ -15,6 +15,7 @@
15
15
  */ import LabelMeta from '../Label/meta.js';
16
16
  import label from '../../schemas/label.js';
17
17
  import options from '../../schemas/options.js';
18
+ import { data, html, valueKey, primaryKey } from '../../schemas/dataOptions.js';
18
19
  import { disabled, inputTitle, sizeSmallDefaultLarge } from '../../schemas/inputProperties.js';
19
20
  export default {
20
21
  category: 'input',
@@ -34,30 +35,43 @@ export default {
34
35
  event: {
35
36
  value: 'The selected value.'
36
37
  }
37
- }
38
+ },
39
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
38
40
  },
39
41
  properties: {
40
42
  type: 'object',
41
43
  additionalProperties: false,
42
44
  properties: {
45
+ variant: {
46
+ type: 'string',
47
+ enum: [
48
+ 'solid',
49
+ 'outlined'
50
+ ],
51
+ default: 'solid',
52
+ description: 'Visual variant of the selected option button, matching the Button block.'
53
+ },
43
54
  buttonStyle: {
44
55
  type: 'string',
45
56
  enum: [
46
57
  'solid',
47
58
  'outline'
48
59
  ],
49
- default: 'solid',
50
- description: 'Style of the selected option button.'
60
+ description: 'Deprecated — use `variant` (solid | outlined) instead.'
51
61
  },
52
62
  color: {
53
63
  type: 'string',
54
- description: 'Selected button color.',
64
+ description: 'Color applied to the selected button. Fills the background in solid mode (with auto-contrasting text) and the border/text in outline mode.',
55
65
  docs: {
56
66
  displayType: 'color'
57
67
  }
58
68
  },
59
69
  disabled,
60
70
  options,
71
+ data,
72
+ html,
73
+ valueKey,
74
+ primaryKey,
61
75
  size: sizeSmallDefaultLarge,
62
76
  label,
63
77
  title: inputTitle,
@@ -152,6 +152,22 @@
152
152
  default: false,
153
153
  description: 'Reverses the slide order.'
154
154
  },
155
+ slides: {
156
+ type: 'array',
157
+ description: 'Optional list of slides for explicit ordering and metadata. Each entry must have a `key` matching a slot name. When omitted, every defined slot becomes a slide, ordered alphabetically by key. Each entry is passed to `afterChange` and `beforeChange` events as `event.current` and `event.next` — any extra fields on the entry (e.g. a title or analytics id) are available there.',
158
+ items: {
159
+ type: 'object',
160
+ required: [
161
+ 'key'
162
+ ],
163
+ properties: {
164
+ key: {
165
+ type: 'string',
166
+ description: 'Slot key for this slide.'
167
+ }
168
+ }
169
+ }
170
+ },
155
171
  slidesPerRow: {
156
172
  type: 'integer',
157
173
  default: 1,
@@ -17,11 +17,18 @@ import { Checkbox, ConfigProvider, Space } from 'antd';
17
17
  import { type } from '@lowdefy/helpers';
18
18
  import { renderHtml, withBlockDefaults } from '@lowdefy/block-utils';
19
19
  import Label from '../Label/Label.js';
20
- import getValueIndex from '../../getValueIndex.js';
21
- import getUniqueValues from '../../getUniqueValues.js';
20
+ import getSelectedIndex from '../../getSelectedIndex.js';
21
+ import useSelectorOptions from '../../useSelectorOptions.js';
22
22
  import withTheme from '../withTheme.js';
23
23
  const CheckboxSelector = ({ blockId, classNames = {}, components, events, loading, properties, required, styles = {}, validation, value, methods })=>{
24
- const uniqueValueOptions = getUniqueValues(properties.options || []);
24
+ const uniqueValueOptions = useSelectorOptions({
25
+ properties,
26
+ methods
27
+ });
28
+ const selectedIndexes = new Set(type.isNone(value) ? [] : getSelectedIndex(value, uniqueValueOptions, {
29
+ properties,
30
+ multiple: true
31
+ }));
25
32
  const checkboxGroup = /*#__PURE__*/ React.createElement(Checkbox.Group, {
26
33
  id: `${blockId}_input`,
27
34
  className: classNames.element,
@@ -40,33 +47,58 @@ const CheckboxSelector = ({ blockId, classNames = {}, components, events, loadin
40
47
  }
41
48
  });
42
49
  },
43
- value: getValueIndex(value, uniqueValueOptions, true)
50
+ value: getSelectedIndex(value, uniqueValueOptions, {
51
+ properties,
52
+ multiple: true
53
+ })
44
54
  }, /*#__PURE__*/ React.createElement(Space, {
45
55
  direction: properties.direction,
46
56
  wrap: type.isNone(properties.wrap) ? true : properties.wrap,
47
57
  align: type.isNone(properties.align) ? 'start' : properties.align
48
- }, uniqueValueOptions.map((opt, i)=>type.isPrimitive(opt) ? /*#__PURE__*/ React.createElement(Checkbox, {
49
- id: `${blockId}_${i}`,
50
- key: i,
51
- value: `${i}`
52
- }, renderHtml({
53
- html: `${opt}`,
54
- methods
55
- })) : /*#__PURE__*/ React.createElement(Checkbox, {
58
+ }, uniqueValueOptions.map((opt, i)=>{
59
+ if (type.isPrimitive(opt)) {
60
+ return /*#__PURE__*/ React.createElement(Checkbox, {
61
+ id: `${blockId}_${i}`,
62
+ key: i,
63
+ value: `${i}`
64
+ }, renderHtml({
65
+ html: `${opt}`,
66
+ methods
67
+ }));
68
+ }
69
+ const isSelected = selectedIndexes.has(`${i}`);
70
+ const checkbox = /*#__PURE__*/ React.createElement(Checkbox, {
56
71
  id: `${blockId}_${i}`,
57
72
  key: i,
58
73
  value: `${i}`,
59
74
  disabled: opt.disabled,
60
- style: opt.style
75
+ style: {
76
+ ...opt.style,
77
+ ...isSelected && opt.color ? {
78
+ color: opt.color
79
+ } : {}
80
+ }
61
81
  }, type.isNone(opt.label) ? renderHtml({
62
82
  html: `${opt.value}`,
63
83
  methods
64
84
  }) : renderHtml({
65
85
  html: opt.label,
66
86
  methods
67
- })))));
87
+ }));
88
+ if (type.isNone(opt.color)) return checkbox;
89
+ // Per-option color: token override colors this checkbox's checked tick.
90
+ return /*#__PURE__*/ React.createElement(ConfigProvider, {
91
+ key: i,
92
+ theme: {
93
+ token: {
94
+ colorPrimary: opt.color
95
+ }
96
+ }
97
+ }, checkbox);
98
+ })));
68
99
  return /*#__PURE__*/ React.createElement(Label, {
69
100
  blockId: blockId,
101
+ methods: methods,
70
102
  classNames: classNames,
71
103
  components: components,
72
104
  events: events,
@@ -15,6 +15,7 @@
15
15
  */ import LabelMeta from '../Label/meta.js';
16
16
  import label from '../../schemas/label.js';
17
17
  import options from '../../schemas/options.js';
18
+ import { data, html, valueKey, primaryKey } from '../../schemas/dataOptions.js';
18
19
  import { disabled, inputTitle } from '../../schemas/inputProperties.js';
19
20
  export default {
20
21
  category: 'input',
@@ -34,7 +35,8 @@ export default {
34
35
  event: {
35
36
  value: 'The selected value.'
36
37
  }
37
- }
38
+ },
39
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
38
40
  },
39
41
  properties: {
40
42
  type: 'object',
@@ -74,6 +76,10 @@ export default {
74
76
  description: "Specifies wrapping of options. Applies when 'direction' is 'horizontal'."
75
77
  },
76
78
  options,
79
+ data,
80
+ html,
81
+ valueKey,
82
+ primaryKey,
77
83
  label,
78
84
  title: inputTitle,
79
85
  theme: {
@@ -44,6 +44,7 @@ const CheckboxSwitch = ({ blockId, classNames = {}, components, events, loading,
44
44
  })));
45
45
  return /*#__PURE__*/ React.createElement(Label, {
46
46
  blockId: blockId,
47
+ methods: methods,
47
48
  classNames: classNames,
48
49
  components: components,
49
50
  events: events,
@@ -13,6 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import LabelMeta from '../Label/meta.js';
16
+ import tooltip from '../../schemas/labelTooltip.js';
16
17
  export default {
17
18
  category: 'input',
18
19
  icons: [
@@ -31,7 +32,8 @@ export default {
31
32
  event: {
32
33
  value: 'The checkbox value.'
33
34
  }
34
- }
35
+ },
36
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
35
37
  },
36
38
  properties: {
37
39
  type: 'object',
@@ -80,6 +82,7 @@ export default {
80
82
  type: 'string',
81
83
  description: 'Label title - supports html.'
82
84
  },
85
+ tooltip,
83
86
  span: {
84
87
  type: 'number',
85
88
  description: 'Label inline span.'
@@ -21,6 +21,7 @@ import withTheme from '../withTheme.js';
21
21
  const ColorSelectorInput = ({ blockId, classNames = {}, components, events, loading, methods, properties, required, styles = {}, validation, value })=>{
22
22
  return /*#__PURE__*/ React.createElement(Label, {
23
23
  blockId: blockId,
24
+ methods: methods,
24
25
  classNames: classNames,
25
26
  components: components,
26
27
  events: events,
@@ -51,7 +51,8 @@ export default {
51
51
  event: {
52
52
  open: 'Whether the popup is open.'
53
53
  }
54
- }
54
+ },
55
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
55
56
  },
56
57
  properties: {
57
58
  type: 'object',
@@ -42,6 +42,7 @@ const ConfigProviderBlock = ({ blockId, content, properties })=>{
42
42
  componentDisabled: properties.componentDisabled,
43
43
  componentSize: properties.componentSize,
44
44
  direction: properties.direction,
45
+ locale: properties.locale,
45
46
  variant: properties.variant,
46
47
  theme: Object.keys(themeConfig).length > 0 ? themeConfig : undefined
47
48
  }, /*#__PURE__*/ React.createElement("div", {
@@ -63,6 +63,13 @@
63
63
  default: 'ltr',
64
64
  description: 'Direction of layout.'
65
65
  },
66
+ locale: {
67
+ type: 'object',
68
+ description: 'Antd locale object to localize built-in component strings (date pickers, pagination, modal, form validation). Pair with the _locale operator and config.i18n to keep the whole subtree in one language.',
69
+ docs: {
70
+ displayType: 'yaml'
71
+ }
72
+ },
66
73
  token: {
67
74
  type: 'object',
68
75
  description: 'Theme token configuration. Customize design tokens like colorPrimary, fontSize, etc.',
@@ -54,7 +54,7 @@ const ConfirmModal = ({ blockId, classNames = {}, events, content, components: {
54
54
  body: styles.body
55
55
  },
56
56
  closable: properties.closable,
57
- okText: properties.okText ?? 'Ok',
57
+ okText: properties.okText,
58
58
  okButtonProps: properties.okButton?.icon ? {
59
59
  ...properties.okButton,
60
60
  icon: properties.okButton.icon && /*#__PURE__*/ React.createElement(ErrorBoundary, {
@@ -87,7 +87,7 @@ const ConfirmModal = ({ blockId, classNames = {}, events, content, components: {
87
87
  }
88
88
  }))
89
89
  } : properties.cancelButton,
90
- cancelText: properties.cancelText ?? 'Cancel',
90
+ cancelText: properties.cancelText,
91
91
  centered: properties.centered ?? false,
92
92
  mask: properties.mask !== undefined ? properties.mask : true,
93
93
  maskClosable: properties.maskClosable ?? false,
@@ -76,13 +76,11 @@
76
76
  },
77
77
  okText: {
78
78
  type: 'string',
79
- default: 'Ok',
80
- description: 'Text of the Ok button.'
79
+ description: 'Text of the Ok button. When unset, antd uses the localized default from ConfigProvider locale.'
81
80
  },
82
81
  cancelText: {
83
82
  type: 'string',
84
- default: 'Cancel',
85
- description: 'Text of the Cancel button.'
83
+ description: 'Text of the Cancel button. When unset, antd uses the localized default from ConfigProvider locale.'
86
84
  },
87
85
  okButton: {
88
86
  type: 'object',
@@ -16,7 +16,7 @@
16
16
  import { DatePicker } from 'antd';
17
17
  import dayjs from 'dayjs';
18
18
  import utc from 'dayjs/plugin/utc.js';
19
- import { type } from '@lowdefy/helpers';
19
+ import { getLocaleDateFormat, type } from '@lowdefy/helpers';
20
20
  import { withBlockDefaults } from '@lowdefy/block-utils';
21
21
  import Label from '../Label/Label.js';
22
22
  import withTheme from '../withTheme.js';
@@ -32,6 +32,7 @@ const DateRangeSelector = ({ blockId, classNames = {}, components: { Icon }, eve
32
32
  const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
33
33
  return /*#__PURE__*/ React.createElement(Label, {
34
34
  blockId: blockId,
35
+ methods: methods,
35
36
  classNames: classNames,
36
37
  components: {
37
38
  Icon
@@ -64,18 +65,12 @@ const DateRangeSelector = ({ blockId, classNames = {}, components: { Icon }, eve
64
65
  },
65
66
  disabled: properties.disabled || loading,
66
67
  disabledDate: disabledDate(properties.disabledDates),
67
- format: properties.format ?? 'YYYY-MM-DD',
68
+ format: properties.format ?? getLocaleDateFormat(methods.getLocale?.()) ?? 'YYYY-MM-DD',
68
69
  getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
69
70
  separator: properties.separator ?? '~',
70
71
  size: properties.size,
71
72
  status: validation.status,
72
- placeholder: (type.isArray(properties.placeholder) && [
73
- properties.placeholder[0] ?? 'Start Date',
74
- properties.placeholder[1] ?? 'End Date'
75
- ]) ?? [
76
- 'Start Date',
77
- 'End Date'
78
- ],
73
+ placeholder: type.isArray(properties.placeholder) ? properties.placeholder : undefined,
79
74
  suffixIcon: /*#__PURE__*/ React.createElement(Icon, {
80
75
  blockId: `${blockId}_suffixIcon`,
81
76
  classNames: {
@@ -38,7 +38,8 @@ export default {
38
38
  event: {
39
39
  value: 'The selected date range value.'
40
40
  }
41
- }
41
+ },
42
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
42
43
  },
43
44
  properties: {
44
45
  type: 'object',
@@ -68,17 +69,12 @@ export default {
68
69
  disabledDates,
69
70
  format: {
70
71
  type: 'string',
71
- default: 'YYYY-MM-DD',
72
- description: 'Format in which to parse the date value, eg. "DD MMMM YYYY" will parse a date value of 1999-12-31 as "31 December 1999". The format has to conform to dayjs formats.'
72
+ description: 'Format in which to parse the date value, eg. "DD MMMM YYYY" will parse a date value of 1999-12-31 as "31 December 1999". The format has to conform to dayjs formats. Defaults to the active locale\'s date format, or "YYYY-MM-DD" when no locale is configured.'
73
73
  },
74
74
  label,
75
75
  placeholder: {
76
76
  type: 'array',
77
- default: [
78
- 'Start Date',
79
- 'End Date'
80
- ],
81
- description: 'Placeholder text inside the block before user types input.',
77
+ description: 'Placeholder text inside the block before user types input. When unset, antd uses the localized default from ConfigProvider locale.',
82
78
  docs: {
83
79
  displayType: 'manual',
84
80
  block: {
@@ -15,7 +15,7 @@
15
15
  */ import React, { useState } from 'react';
16
16
  import dayjs from 'dayjs';
17
17
  import utc from 'dayjs/plugin/utc.js';
18
- import { type } from '@lowdefy/helpers';
18
+ import { getLocaleDateFormat, type } from '@lowdefy/helpers';
19
19
  import { DatePicker } from 'antd';
20
20
  import { withBlockDefaults } from '@lowdefy/block-utils';
21
21
  import Label from '../Label/Label.js';
@@ -26,6 +26,7 @@ const DateSelector = ({ blockId, classNames = {}, components: { Icon }, events,
26
26
  const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
27
27
  return /*#__PURE__*/ React.createElement(Label, {
28
28
  blockId: blockId,
29
+ methods: methods,
29
30
  classNames: classNames,
30
31
  components: {
31
32
  Icon
@@ -57,9 +58,9 @@ const DateSelector = ({ blockId, classNames = {}, components: { Icon }, events,
57
58
  ...styles.element
58
59
  },
59
60
  disabled: properties.disabled || loading,
60
- format: properties.format ?? 'YYYY-MM-DD',
61
+ format: properties.format ?? getLocaleDateFormat(methods.getLocale?.()) ?? 'YYYY-MM-DD',
61
62
  getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
62
- placeholder: properties.placeholder ?? 'Select Date',
63
+ placeholder: properties.placeholder,
63
64
  showToday: properties.showToday,
64
65
  size: properties.size,
65
66
  status: validation.status,
@@ -38,7 +38,8 @@ export default {
38
38
  event: {
39
39
  value: 'The selected date value.'
40
40
  }
41
- }
41
+ },
42
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
42
43
  },
43
44
  properties: {
44
45
  type: 'object',
@@ -69,12 +70,10 @@ export default {
69
70
  label,
70
71
  format: {
71
72
  type: 'string',
72
- default: 'YYYY-MM-DD',
73
- description: 'Format in which to parse the date value, eg. "DD MMMM YYYY" will parse a date value of 1999-12-31 as "31 December 1999". The format has to conform to dayjs formats.'
73
+ description: 'Format in which to parse the date value, eg. "DD MMMM YYYY" will parse a date value of 1999-12-31 as "31 December 1999". The format has to conform to dayjs formats. Defaults to the active locale\'s date format, or "YYYY-MM-DD" when no locale is configured.'
74
74
  },
75
75
  placeholder: {
76
- ...placeholder,
77
- default: 'Select Date'
76
+ ...placeholder
78
77
  },
79
78
  showToday: {
80
79
  type: 'boolean',
@@ -16,7 +16,7 @@
16
16
  import { DatePicker } from 'antd';
17
17
  import dayjs from 'dayjs';
18
18
  import utc from 'dayjs/plugin/utc.js';
19
- import { type } from '@lowdefy/helpers';
19
+ import { getLocaleDateFormat, type } from '@lowdefy/helpers';
20
20
  import { withBlockDefaults } from '@lowdefy/block-utils';
21
21
  import Label from '../Label/Label.js';
22
22
  import withTheme from '../withTheme.js';
@@ -39,6 +39,7 @@ const DateTimeSelector = ({ blockId, classNames = {}, components: { Icon }, even
39
39
  };
40
40
  return /*#__PURE__*/ React.createElement(Label, {
41
41
  blockId: blockId,
42
+ methods: methods,
42
43
  classNames: classNames,
43
44
  components: {
44
45
  Icon
@@ -71,9 +72,9 @@ const DateTimeSelector = ({ blockId, classNames = {}, components: { Icon }, even
71
72
  },
72
73
  disabled: properties.disabled || loading,
73
74
  disabledDate: disabledDate(properties.disabledDates),
74
- format: properties.format ?? 'YYYY-MM-DD HH:mm',
75
+ format: properties.format ?? getLocaleDateFormat(methods.getLocale?.(), 'datetime') ?? 'YYYY-MM-DD HH:mm',
75
76
  getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
76
- placeholder: properties.placeholder ?? 'Select Date & Time',
77
+ placeholder: properties.placeholder,
77
78
  showNow: properties.showNow,
78
79
  showToday: properties.showToday,
79
80
  size: properties.size,
@@ -38,7 +38,8 @@ export default {
38
38
  event: {
39
39
  value: 'The selected date-time value.'
40
40
  }
41
- }
41
+ },
42
+ onTooltipClick: 'Trigger actions when the tooltip icon is clicked.'
42
43
  },
43
44
  properties: {
44
45
  type: 'object',
@@ -68,8 +69,7 @@ export default {
68
69
  disabledDates,
69
70
  format: {
70
71
  type: 'string',
71
- default: 'YYYY-MM-DD HH:mm',
72
- description: 'Format in which to parse the date value, eg. "DD MMMM YYYY" will parse a date value of 1999-12-31 as "31 December 1999". The format has to conform to dayjs formats.'
72
+ description: 'Format in which to parse the date value, eg. "DD MMMM YYYY HH:mm" will parse a date value of 1999-12-31T15:30 as "31 December 1999 15:30". The format has to conform to dayjs formats. Defaults to the active locale\'s date-time format, or "YYYY-MM-DD HH:mm" when no locale is configured.'
73
73
  },
74
74
  hourStep: {
75
75
  type: 'integer',
@@ -85,8 +85,7 @@ export default {
85
85
  description: 'Minute intervals to show in the time selector.'
86
86
  },
87
87
  placeholder: {
88
- ...placeholder,
89
- default: 'Select Date & Time'
88
+ ...placeholder
90
89
  },
91
90
  secondStep: {
92
91
  type: 'integer',