@db-ux/react-core-components 4.9.0-1-c55de66 → 4.9.0-stencil-bundle-ad37ca4

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
@@ -189,7 +189,7 @@ _version bump_
189
189
 
190
190
  - fix: set DBTabItem internal state `_selected` correctly - [see commit f7625cb](https://github.com/db-ux-design-system/core-web/commit/f7625cbd9d64513527e826c9d2c1ef42b2734a4b):
191
191
 
192
- - Now also sets aria-selected=true|false correctly which improves screen reader behaviour
192
+ - Now also sets aria-selected=true|false correctly which improves screen reader behaviour
193
193
 
194
194
  ## 4.2.1
195
195
 
@@ -31,7 +31,7 @@ function DBAccordionFn(props, component) {
31
31
  useEffect(() => {
32
32
  // If we have a single behavior we first check for
33
33
  // props.name otherwise for state_id
34
- if (initialized) {
34
+ if (initialized && _ref.current) {
35
35
  if (props.behavior === "single") {
36
36
  if (props.name) {
37
37
  if (_name !== props.name) {
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
- declare const DBAccordionItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../shared/model").GlobalProps | "name" | "text" | "defaultOpen" | "disabled" | "headline" | "headlinePlain" | keyof import("../../shared/model").ToggleEventProps> & {
2
+ declare const DBAccordionItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../shared/model").GlobalProps | "name" | "text" | "defaultOpen" | "open" | "disabled" | "headline" | "headlinePlain" | keyof import("../../shared/model").ToggleEventProps> & {
3
3
  defaultOpen?: boolean;
4
+ open?: boolean;
4
5
  disabled?: boolean | string;
5
6
  headline?: any;
6
7
  headlinePlain?: string;
@@ -27,7 +27,9 @@ function DBAccordionItemFn(props, component) {
27
27
  if (props.onToggle) {
28
28
  props.onToggle(newStateOpen);
29
29
  }
30
- set_open(newStateOpen);
30
+ if (props.open === undefined) {
31
+ set_open(newStateOpen);
32
+ }
31
33
  }
32
34
  useEffect(() => {
33
35
  if (props.defaultOpen) {
@@ -45,6 +47,11 @@ function DBAccordionItemFn(props, component) {
45
47
  set_name(props.name);
46
48
  }
47
49
  }, [props.name]);
50
+ useEffect(() => {
51
+ if (props.open !== undefined) {
52
+ set_open(props.open);
53
+ }
54
+ }, [props.open]);
48
55
  return (React.createElement("li", Object.assign({ id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.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-accordion-item", props.className) }),
49
56
  React.createElement("details", Object.assign({ "aria-disabled": getBooleanAsString(props.disabled), 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", "onToggle"]), { name: _name, open: _open }),
50
57
  React.createElement("summary", { onClick: (event) => handleToggle(event) },
@@ -4,6 +4,10 @@ export type DBAccordionItemDefaultProps = {
4
4
  * Initial state for the accordion item
5
5
  */
6
6
  defaultOpen?: boolean;
7
+ /**
8
+ * State for the accordion item
9
+ */
10
+ open?: boolean;
7
11
  /**
8
12
  * The disabled attribute can be set to keep a user from clicking on the element.
9
13
  */
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import { filterPassingProps, getRootProps } from "../../utils/react";
4
4
  import { useState, useRef, useEffect, forwardRef } from "react";
5
5
  import { DEFAULT_CLOSE_BUTTON } from "../../shared/constants";
6
- import { cls, delay, getBooleanAsString, isKeyboardEvent } from "../../utils";
6
+ import { cls, delay, getBoolean, getBooleanAsString, isKeyboardEvent, } from "../../utils";
7
7
  import DBButton from "../button/button";
8
8
  function DBDrawerFn(props, component) {
9
9
  var _a, _b, _c;
@@ -40,8 +40,8 @@ function DBDrawerFn(props, component) {
40
40
  }
41
41
  function handleDialogOpen() {
42
42
  if (_ref.current) {
43
- const open = Boolean(props.open);
44
- if (open && !_ref.current.open) {
43
+ const dialogOpen = getBoolean(props.open);
44
+ if (dialogOpen && !_ref.current.open) {
45
45
  if (dialogContainerRef.current) {
46
46
  dialogContainerRef.current.removeAttribute("data-transition");
47
47
  }
@@ -59,7 +59,7 @@ function DBDrawerFn(props, component) {
59
59
  }
60
60
  }, 1);
61
61
  }
62
- if (!open && _ref.current.open) {
62
+ if (!dialogOpen && _ref.current.open) {
63
63
  if (dialogContainerRef.current) {
64
64
  dialogContainerRef.current.dataset["transition"] =
65
65
  "close";
@@ -41,13 +41,6 @@ function DBHeaderFn(props, component) {
41
41
  }
42
42
  }, [initialized, _ref.current]);
43
43
  return (React.createElement("header", Object.assign({ 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", "onToggle"]), 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-header", props.className), id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-width": props.width, "data-on-forcing-mobile": props.forceMobile && !forcedToMobile }),
44
- React.createElement(DBDrawer, { className: "db-header-drawer", spacing: "small", rounded: true, closeButtonId: props.closeButtonId, closeButtonText: props.closeButtonText, open: getBoolean(props.drawerOpen), onClose: (event) => handleToggle() },
45
- React.createElement("div", { className: "db-header-drawer-navigation" },
46
- React.createElement("div", { className: "db-header-navigation", onClick: (event) => handleNavigationItemClick(event) }, props.children),
47
- React.createElement("div", { className: "db-header-meta-navigation" },
48
- React.createElement(React.Fragment, null, props.metaNavigation))),
49
- React.createElement("div", { className: "db-header-secondary-action" },
50
- React.createElement(React.Fragment, null, props.secondaryAction))),
51
44
  React.createElement("div", { className: "db-header-meta-navigation" },
52
45
  React.createElement(React.Fragment, null, props.metaNavigation)),
53
46
  React.createElement("div", { className: "db-header-navigation-bar" },
@@ -61,7 +54,14 @@ function DBHeaderFn(props, component) {
61
54
  React.createElement("div", { className: "db-header-burger-menu-container" },
62
55
  React.createElement(DBButton, { icon: "menu", variant: "ghost", noText: true, onClick: (event) => handleToggle() }, (_c = props.burgerMenuLabel) !== null && _c !== void 0 ? _c : DEFAULT_BURGER_MENU)),
63
56
  React.createElement("div", { className: "db-header-secondary-action" },
64
- React.createElement(React.Fragment, null, props.secondaryAction))))));
57
+ React.createElement(React.Fragment, null, props.secondaryAction)))),
58
+ React.createElement(DBDrawer, { className: "db-header-drawer", spacing: "small", rounded: true, closeButtonId: props.closeButtonId, closeButtonText: props.closeButtonText, open: getBoolean(props.drawerOpen), onClose: (event) => handleToggle() },
59
+ React.createElement("div", { className: "db-header-drawer-navigation" },
60
+ React.createElement("div", { className: "db-header-navigation", onClick: (event) => handleNavigationItemClick(event) }, props.children),
61
+ React.createElement("div", { className: "db-header-meta-navigation" },
62
+ React.createElement(React.Fragment, null, props.metaNavigation))),
63
+ React.createElement("div", { className: "db-header-secondary-action" },
64
+ React.createElement(React.Fragment, null, props.secondaryAction)))));
65
65
  }
66
66
  const DBHeader = forwardRef(DBHeaderFn);
67
67
  export default DBHeader;
@@ -17,6 +17,10 @@ export type DBNavigationItemDefaultProps = {
17
17
  * This is for mobile navigation only, if it is set the sub-navigation is a static overlay
18
18
  */
19
19
  subNavigationExpanded?: boolean | string;
20
+ /**
21
+ * Force hide sub-navigation - for web component output
22
+ */
23
+ hideSubNavigation?: boolean;
20
24
  };
21
25
  export type DBNavigationItemProps = DBNavigationItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & WrapProps & NavigationBackButtonProps & ShowIconProps & TextProps;
22
26
  export type DBNavigationItemDefaultState = {
@@ -70,14 +70,13 @@ function DBNavigationItemFn(props, component) {
70
70
  }
71
71
  }
72
72
  }, [initialized, _ref.current]);
73
- return (React.createElement("li", Object.assign({ 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: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id, onMouseOver: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.enableFollow(), onMouseLeave: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.disableFollow(), onMouseMove: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.followByMouseEvent(event) }, 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-navigation-item", props.className), "data-width": props.width, "data-icon": props.icon, "data-show-icon": getBooleanAsString(props.showIcon), "data-active": props.active, "data-wrap": getBooleanAsString(props.wrap), "aria-disabled": getBooleanAsString(props.disabled) }),
74
- !hasSubNavigation ? (React.createElement(React.Fragment, null, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children))) : null,
73
+ return (React.createElement("li", Object.assign({ 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: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id, onMouseOver: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.enableFollow(), onMouseLeave: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.disableFollow(), onMouseMove: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.followByMouseEvent(event) }, 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-navigation-item", props.className), "data-width": props.width, "data-icon": props.icon, "data-show-icon": getBooleanAsString(props.showIcon), "data-active": props.active, "data-wrap": getBooleanAsString(props.wrap), "aria-disabled": getBooleanAsString(props.disabled) }), !getBoolean(props.hideSubNavigation, "hideSubNavigation") &&
75
74
  hasSubNavigation ? (React.createElement(React.Fragment, null,
76
- React.createElement("button", { className: "db-navigation-item-expand-button", id: subNavigationToggleId, "aria-haspopup": hasAreaPopup ? "true" : undefined, "aria-expanded": isSubNavigationExpanded, "aria-controls": subNavigationId, disabled: getBoolean(props.disabled, "disabled"), onClick: (event) => handleClick(event) }, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)),
77
- React.createElement("menu", { className: "db-sub-navigation", id: subNavigationId, "aria-labelledby": subNavigationToggleId, "data-force-close": autoClose, onClick: (event) => handleNavigationItemClick(event) },
78
- hasAreaPopup ? (React.createElement("div", { className: "db-mobile-navigation-back" },
79
- React.createElement(DBButton, { icon: "arrow_left", variant: "ghost", id: props.backButtonId, onClick: (event) => handleBackClick(event) }, (_c = props.backButtonText) !== null && _c !== void 0 ? _c : DEFAULT_BACK))) : null,
80
- React.createElement(React.Fragment, null, props.subNavigation)))) : null));
75
+ React.createElement("button", { className: "db-navigation-item-expand-button", id: subNavigationToggleId, "aria-haspopup": hasAreaPopup ? "true" : undefined, "aria-expanded": isSubNavigationExpanded, "aria-controls": subNavigationId, disabled: getBoolean(props.disabled, "disabled"), onClick: (event) => handleClick(event) }, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)),
76
+ React.createElement("menu", { className: "db-sub-navigation", id: subNavigationId, "aria-labelledby": subNavigationToggleId, "data-force-close": autoClose, onClick: (event) => handleNavigationItemClick(event) },
77
+ hasAreaPopup ? (React.createElement("div", { className: "db-mobile-navigation-back" },
78
+ React.createElement(DBButton, { icon: "arrow_left", variant: "ghost", id: props.backButtonId, onClick: (event) => handleBackClick(event) }, (_c = props.backButtonText) !== null && _c !== void 0 ? _c : DEFAULT_BACK))) : null,
79
+ React.createElement(React.Fragment, null, props.subNavigation)))) : props.text ? (React.createElement(React.Fragment, null, props.text)) : (React.createElement(React.Fragment, null, props.children))));
81
80
  }
82
81
  const DBNavigationItem = forwardRef(DBNavigationItemFn);
83
82
  export default DBNavigationItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/react-core-components",
3
- "version": "4.9.0-1-c55de66",
3
+ "version": "4.9.0-stencil-bundle-ad37ca4",
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.9.0-1-c55de66",
21
- "@db-ux/core-foundations": "4.9.0-1-c55de66"
20
+ "@db-ux/core-components": "4.9.0-stencil-bundle-ad37ca4",
21
+ "@db-ux/core-foundations": "4.9.0-stencil-bundle-ad37ca4"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@playwright/experimental-ct-react": "1.60.0",