@db-ux/react-core-components 4.12.1 → 4.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @db-ux/react-core-components
2
2
 
3
+ ## 4.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: enable Invoker Commands (`command`- and `commandfor`-HTML-attributes) for DBButton - [see commit 00f50c3](https://github.com/db-ux-design-system/core-web/commit/00f50c3fc4508e62f2e30589c00148c54e2fc852)
8
+
3
9
  ## 4.12.1
4
10
 
5
11
  ### Patch Changes
@@ -12,10 +12,13 @@ function DBButtonFn(props, component) {
12
12
  else if (props.onClick) {
13
13
  return "button";
14
14
  }
15
+ else if (props.commandfor) {
16
+ return "button";
17
+ }
15
18
  return "submit";
16
19
  }
17
20
  return (_jsxs("button", { ref: _ref, ...filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "data-density"]), id: props.id ?? props.propOverrides?.id, ...getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "data-density"]), className: cls("db-button", props.className), type: getButtonType(), disabled: getBoolean(props.disabled, "disabled"), "data-icon": props.iconLeading ?? props.icon, "data-show-icon": getBooleanAsString(props.showIconLeading, "showIconLeading") ||
18
- getBooleanAsString(props.showIcon, "showIcon"), "data-icon-trailing": props.iconTrailing, "data-show-icon-trailing": getBooleanAsString(props.showIconTrailing, "showIconTrailing"), "data-size": props.size, "data-width": props.width, "data-variant": props.variant, "data-wrap": getBooleanAsString(props.wrap, "wrap"), "data-no-text": getBooleanAsString(props.noText, "noText"), name: props.name, form: props.form, value: props.value, children: [props.text ? _jsx(_Fragment, { children: props.text }) : null, props.children] }));
21
+ getBooleanAsString(props.showIcon, "showIcon"), "data-icon-trailing": props.iconTrailing, "data-show-icon-trailing": getBooleanAsString(props.showIconTrailing, "showIconTrailing"), "data-size": props.size, "data-width": props.width, "data-variant": props.variant, "data-wrap": getBooleanAsString(props.wrap, "wrap"), "data-no-text": getBooleanAsString(props.noText, "noText"), name: props.name, form: props.form, value: props.value, command: props.command, commandfor: props.commandfor, children: [props.text ? _jsx(_Fragment, { children: props.text }) : null, props.children] }));
19
22
  }
20
23
  const DBButton = forwardRef(DBButtonFn);
21
24
  export default DBButton;
@@ -10,6 +10,14 @@ export type DBButtonSharedProps = {
10
10
  variant?: ButtonVariantType | string;
11
11
  };
12
12
  export type DBButtonDefaultProps = {
13
+ /**
14
+ * The [command](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#command) attribute specifies the action to perform on the element controlled by a `<button>` element.
15
+ */
16
+ command?: string;
17
+ /**
18
+ * The [commandfor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#commandfor) attribute turns a `<button>` into a command button that controls the given interactive element referenced by `id`.
19
+ */
20
+ commandfor?: string;
13
21
  /**
14
22
  * The disabled attribute can be set to [keep a user from clicking on the button](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled).
15
23
  */
package/dist/index.d.ts CHANGED
@@ -95,3 +95,19 @@ export * from './utils/document-scroll-listener.js';
95
95
  export * from './utils/floating-components.js';
96
96
  export * from './utils/index.js';
97
97
  export * from './utils/navigation.js';
98
+ /**
99
+ * Type augmentation for Invoker Commands API
100
+ * https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API
101
+ *
102
+ * Extends React's ButtonHTMLAttributes to include the `command` and `commandfor`
103
+ * HTML attributes for declarative dialog control via Invoker Commands.
104
+ *
105
+ * TODO: This augmentation can be removed once React's type definitions
106
+ * natively support these attributes.
107
+ */
108
+ declare module "react" {
109
+ interface ButtonHTMLAttributes<T> {
110
+ command?: string | undefined;
111
+ commandfor?: string | undefined;
112
+ }
113
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/react-core-components",
3
- "version": "4.12.1",
3
+ "version": "4.13.0",
4
4
  "type": "module",
5
5
  "description": "React components for @db-ux/core-components",
6
6
  "repository": {
@@ -17,8 +17,8 @@
17
17
  "dist/"
18
18
  ],
19
19
  "dependencies": {
20
- "@db-ux/core-components": "4.12.1",
21
- "@db-ux/core-foundations": "4.12.1"
20
+ "@db-ux/core-components": "4.13.0",
21
+ "@db-ux/core-foundations": "4.13.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@playwright/experimental-ct-react": "1.60.0",