@db-ux/react-core-components 4.9.0 → 4.10.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 (166) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +97 -35
  3. package/dist/components/accordion/accordion.js +102 -86
  4. package/dist/components/accordion/model.d.ts +2 -2
  5. package/dist/components/accordion/model.js +4 -2
  6. package/dist/components/accordion-item/accordion-item.d.ts +2 -1
  7. package/dist/components/accordion-item/accordion-item.js +89 -56
  8. package/dist/components/accordion-item/model.d.ts +5 -1
  9. package/dist/components/badge/badge.js +72 -32
  10. package/dist/components/badge/model.d.ts +1 -1
  11. package/dist/components/badge/model.js +12 -1
  12. package/dist/components/brand/brand.js +60 -13
  13. package/dist/components/brand/model.d.ts +1 -1
  14. package/dist/components/button/button.js +75 -21
  15. package/dist/components/button/model.d.ts +1 -1
  16. package/dist/components/button/model.js +13 -2
  17. package/dist/components/card/card.js +65 -15
  18. package/dist/components/card/model.d.ts +1 -1
  19. package/dist/components/card/model.js +8 -2
  20. package/dist/components/checkbox/checkbox.js +163 -157
  21. package/dist/components/checkbox/model.d.ts +1 -1
  22. package/dist/components/custom-button/custom-button.js +65 -10
  23. package/dist/components/custom-button/model.d.ts +2 -2
  24. package/dist/components/custom-select/custom-select.js +509 -727
  25. package/dist/components/custom-select/model.d.ts +4 -4
  26. package/dist/components/custom-select/model.js +8 -1
  27. package/dist/components/custom-select-dropdown/custom-select-dropdown.js +62 -11
  28. package/dist/components/custom-select-dropdown/model.d.ts +1 -1
  29. package/dist/components/custom-select-dropdown/model.js +8 -1
  30. package/dist/components/custom-select-form-field/custom-select-form-field.js +57 -10
  31. package/dist/components/custom-select-form-field/model.d.ts +1 -1
  32. package/dist/components/custom-select-list/custom-select-list.js +60 -11
  33. package/dist/components/custom-select-list/model.d.ts +1 -1
  34. package/dist/components/custom-select-list-item/custom-select-list-item.js +89 -32
  35. package/dist/components/custom-select-list-item/model.d.ts +1 -1
  36. package/dist/components/custom-select-list-item/model.js +4 -1
  37. package/dist/components/divider/divider.js +60 -10
  38. package/dist/components/divider/model.d.ts +1 -1
  39. package/dist/components/divider/model.js +4 -2
  40. package/dist/components/drawer/drawer.js +118 -97
  41. package/dist/components/drawer/model.d.ts +1 -1
  42. package/dist/components/drawer/model.js +14 -4
  43. package/dist/components/header/header.js +143 -65
  44. package/dist/components/header/model.d.ts +1 -1
  45. package/dist/components/icon/icon.js +61 -12
  46. package/dist/components/icon/model.d.ts +1 -1
  47. package/dist/components/icon/model.js +11 -1
  48. package/dist/components/infotext/infotext.js +62 -12
  49. package/dist/components/infotext/model.d.ts +1 -1
  50. package/dist/components/input/input.js +198 -167
  51. package/dist/components/input/model.d.ts +1 -1
  52. package/dist/components/input/model.js +21 -5
  53. package/dist/components/link/link.js +70 -12
  54. package/dist/components/link/model.d.ts +1 -1
  55. package/dist/components/link/model.js +8 -3
  56. package/dist/components/navigation/model.d.ts +1 -1
  57. package/dist/components/navigation/navigation.js +57 -11
  58. package/dist/components/navigation-item/model.d.ts +6 -2
  59. package/dist/components/navigation-item/navigation-item.js +117 -81
  60. package/dist/components/notification/model.d.ts +1 -1
  61. package/dist/components/notification/model.js +12 -3
  62. package/dist/components/notification/notification.js +100 -32
  63. package/dist/components/page/model.d.ts +1 -1
  64. package/dist/components/page/model.js +4 -2
  65. package/dist/components/page/page.js +74 -46
  66. package/dist/components/popover/model.d.ts +1 -1
  67. package/dist/components/popover/popover.js +126 -125
  68. package/dist/components/radio/model.d.ts +1 -1
  69. package/dist/components/radio/radio.js +124 -85
  70. package/dist/components/section/model.d.ts +1 -1
  71. package/dist/components/section/section.js +59 -10
  72. package/dist/components/select/model.d.ts +1 -1
  73. package/dist/components/select/select.js +188 -191
  74. package/dist/components/stack/model.d.ts +1 -1
  75. package/dist/components/stack/model.js +14 -4
  76. package/dist/components/stack/stack.js +63 -10
  77. package/dist/components/switch/model.d.ts +1 -1
  78. package/dist/components/switch/switch.js +182 -150
  79. package/dist/components/tab-item/model.d.ts +1 -1
  80. package/dist/components/tab-item/tab-item.js +105 -76
  81. package/dist/components/tab-list/model.d.ts +1 -1
  82. package/dist/components/tab-list/tab-list.js +60 -11
  83. package/dist/components/tab-panel/model.d.ts +1 -1
  84. package/dist/components/tab-panel/tab-panel.js +59 -13
  85. package/dist/components/tabs/model.d.ts +3 -3
  86. package/dist/components/tabs/model.js +4 -2
  87. package/dist/components/tabs/tabs.js +191 -178
  88. package/dist/components/tag/model.d.ts +1 -1
  89. package/dist/components/tag/model.js +4 -1
  90. package/dist/components/tag/tag.js +91 -32
  91. package/dist/components/textarea/model.d.ts +1 -1
  92. package/dist/components/textarea/model.js +13 -2
  93. package/dist/components/textarea/textarea.js +165 -150
  94. package/dist/components/tooltip/model.d.ts +1 -1
  95. package/dist/components/tooltip/model.js +4 -1
  96. package/dist/components/tooltip/tooltip.js +119 -115
  97. package/dist/index.js +64 -81
  98. package/dist/shared/constants.js +32 -94
  99. package/dist/shared/figma.d.ts +12 -6
  100. package/dist/shared/model.js +73 -22
  101. package/dist/utils/document-click-listener.js +26 -29
  102. package/dist/utils/document-scroll-listener.js +30 -38
  103. package/dist/utils/floating-components.js +107 -358
  104. package/dist/utils/form-components.js +34 -60
  105. package/dist/utils/index.js +49 -167
  106. package/dist/utils/navigation.js +68 -135
  107. package/dist/utils/react.js +10 -15
  108. package/package.json +11 -8
  109. package/dist/components/accordion/index.js +0 -1
  110. package/dist/components/accordion-item/index.js +0 -1
  111. package/dist/components/accordion-item/model.js +0 -1
  112. package/dist/components/badge/index.js +0 -1
  113. package/dist/components/brand/index.js +0 -1
  114. package/dist/components/brand/model.js +0 -1
  115. package/dist/components/button/index.js +0 -1
  116. package/dist/components/card/index.js +0 -1
  117. package/dist/components/checkbox/index.js +0 -1
  118. package/dist/components/checkbox/model.js +0 -1
  119. package/dist/components/custom-button/index.js +0 -1
  120. package/dist/components/custom-button/model.js +0 -1
  121. package/dist/components/custom-select/index.js +0 -1
  122. package/dist/components/custom-select-dropdown/index.js +0 -1
  123. package/dist/components/custom-select-form-field/index.js +0 -1
  124. package/dist/components/custom-select-form-field/model.js +0 -1
  125. package/dist/components/custom-select-list/index.js +0 -1
  126. package/dist/components/custom-select-list/model.js +0 -1
  127. package/dist/components/custom-select-list-item/index.js +0 -1
  128. package/dist/components/divider/index.js +0 -1
  129. package/dist/components/drawer/index.js +0 -1
  130. package/dist/components/header/index.js +0 -1
  131. package/dist/components/header/model.js +0 -1
  132. package/dist/components/icon/index.js +0 -1
  133. package/dist/components/infotext/index.js +0 -1
  134. package/dist/components/infotext/model.js +0 -1
  135. package/dist/components/input/index.js +0 -1
  136. package/dist/components/link/index.js +0 -1
  137. package/dist/components/navigation/index.js +0 -1
  138. package/dist/components/navigation/model.js +0 -1
  139. package/dist/components/navigation-item/index.js +0 -1
  140. package/dist/components/navigation-item/model.js +0 -1
  141. package/dist/components/notification/index.js +0 -1
  142. package/dist/components/page/index.js +0 -1
  143. package/dist/components/popover/index.js +0 -1
  144. package/dist/components/popover/model.js +0 -1
  145. package/dist/components/radio/index.js +0 -1
  146. package/dist/components/radio/model.js +0 -1
  147. package/dist/components/section/index.js +0 -1
  148. package/dist/components/section/model.js +0 -1
  149. package/dist/components/select/index.js +0 -1
  150. package/dist/components/select/model.js +0 -1
  151. package/dist/components/stack/index.js +0 -1
  152. package/dist/components/switch/index.js +0 -1
  153. package/dist/components/switch/model.js +0 -1
  154. package/dist/components/tab-item/index.js +0 -1
  155. package/dist/components/tab-item/model.js +0 -1
  156. package/dist/components/tab-list/index.js +0 -1
  157. package/dist/components/tab-list/model.js +0 -1
  158. package/dist/components/tab-panel/index.js +0 -1
  159. package/dist/components/tab-panel/model.js +0 -1
  160. package/dist/components/tabs/index.js +0 -1
  161. package/dist/components/tag/index.js +0 -1
  162. package/dist/components/textarea/index.js +0 -1
  163. package/dist/components/tooltip/index.js +0 -1
  164. package/dist/shared/examples/index.js +0 -4
  165. package/dist/shared/figma.js +0 -1
  166. package/dist/shared/showcase/show-code-link.js +0 -51
@@ -1,13 +1,59 @@
1
1
  "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useRef, forwardRef } from "react";
5
- import { cls } from "../../utils";
6
- function DBNavigationFn(props, component) {
7
- var _a, _b;
8
- const _ref = component || useRef(component);
9
- return (React.createElement("nav", 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 }, 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", props.className) }),
10
- React.createElement("menu", null, props.children)));
2
+ import { filterPassingProps as e, getRootProps as t } from "../../utils/react.js";
3
+ import { cls as n } from "../../utils/index.js";
4
+ import { forwardRef as r, useRef as i } from "react";
5
+ import { jsx as a } from "react/jsx-runtime";
6
+ //#region src/components/navigation/navigation.tsx
7
+ function o(r, o) {
8
+ return /* @__PURE__ */ a("nav", {
9
+ ref: o || i(o),
10
+ ...e(r, [
11
+ "data-icon-variant",
12
+ "data-icon-variant-before",
13
+ "data-icon-variant-after",
14
+ "data-icon-weight",
15
+ "data-icon-weight-before",
16
+ "data-icon-weight-after",
17
+ "data-interactive",
18
+ "data-force-mobile",
19
+ "data-color",
20
+ "data-container-color",
21
+ "data-bg-color",
22
+ "data-on-bg-color",
23
+ "data-color-scheme",
24
+ "data-font-size",
25
+ "data-headline-size",
26
+ "data-divider",
27
+ "data-focus",
28
+ "data-font",
29
+ "data-density"
30
+ ]),
31
+ id: r.id ?? r.propOverrides?.id,
32
+ ...t(r, [
33
+ "data-icon-variant",
34
+ "data-icon-variant-before",
35
+ "data-icon-variant-after",
36
+ "data-icon-weight",
37
+ "data-icon-weight-before",
38
+ "data-icon-weight-after",
39
+ "data-interactive",
40
+ "data-force-mobile",
41
+ "data-color",
42
+ "data-container-color",
43
+ "data-bg-color",
44
+ "data-on-bg-color",
45
+ "data-color-scheme",
46
+ "data-font-size",
47
+ "data-headline-size",
48
+ "data-divider",
49
+ "data-focus",
50
+ "data-font",
51
+ "data-density"
52
+ ]),
53
+ className: n("db-navigation", r.className),
54
+ children: /* @__PURE__ */ a("menu", { children: r.children })
55
+ });
11
56
  }
12
- const DBNavigation = forwardRef(DBNavigationFn);
13
- export default DBNavigation;
57
+ var s = r(o);
58
+ //#endregion
59
+ export { s as default };
@@ -1,5 +1,5 @@
1
- import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, NavigationBehaviorState, ShowIconProps, TextProps, WidthProps, WrapProps } from '../../shared/model';
2
- import { NavigationItemSafeTriangle } from '../../utils/navigation';
1
+ import type { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, NavigationBehaviorState, ShowIconProps, TextProps, WidthProps, WrapProps } from '../../shared/model';
2
+ import type { NavigationItemSafeTriangle } from '../../utils/navigation';
3
3
  export type DBNavigationItemDefaultProps = {
4
4
  /**
5
5
  * Alternative indicator for active navigation item (bold font). In contrast to the use of aria-current="page" on the contained anchor, this does not guarantee correct a11y.
@@ -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 | string;
20
24
  };
21
25
  export type DBNavigationItemProps = DBNavigationItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & WrapProps & NavigationBackButtonProps & ShowIconProps & TextProps;
22
26
  export type DBNavigationItemDefaultState = {
@@ -1,83 +1,119 @@
1
1
  "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useState, useRef, useEffect, forwardRef } from "react";
5
- import { DEFAULT_BACK } from "../../shared/constants";
6
- import { cls, delay, getBoolean, getBooleanAsString } from "../../utils";
7
- import { NavigationItemSafeTriangle } from "../../utils/navigation";
8
- import DBButton from "../button/button";
9
- import { useId } from "react";
10
- function DBNavigationItemFn(props, component) {
11
- var _a, _b, _c;
12
- const uuid = useId();
13
- const _ref = component || useRef(component);
14
- const [initialized, setInitialized] = useState(() => false);
15
- const [hasAreaPopup, setHasAreaPopup] = useState(() => false);
16
- const [hasSubNavigation, setHasSubNavigation] = useState(() => true);
17
- const [isSubNavigationExpanded, setIsSubNavigationExpanded] = useState(() => false);
18
- const [autoClose, setAutoClose] = useState(() => false);
19
- const [navigationItemSafeTriangle, setNavigationItemSafeTriangle] = useState(() => undefined);
20
- const [subNavigationId, setSubNavigationId] = useState(() => undefined);
21
- const [subNavigationToggleId, setSubNavigationToggleId] = useState(() => undefined);
22
- function handleNavigationItemClick(event) {
23
- var _a;
24
- if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.nodeName) === "A") {
25
- setAutoClose(true);
26
- void delay(() => {
27
- setAutoClose(false);
28
- }, 1000);
29
- }
30
- }
31
- function handleClick(event) {
32
- if (props.onClick) {
33
- event.stopPropagation();
34
- props.onClick(event);
35
- }
36
- if (hasAreaPopup) {
37
- setIsSubNavigationExpanded(true);
38
- }
39
- }
40
- function handleBackClick(event) {
41
- event.stopPropagation();
42
- setIsSubNavigationExpanded(false);
43
- }
44
- useEffect(() => {
45
- var _a;
46
- setInitialized(true);
47
- const subNavId = `sub-nav-${(_a = props.id) !== null && _a !== void 0 ? _a : uuid}`;
48
- setSubNavigationId(subNavId);
49
- setSubNavigationToggleId(`${subNavId}-toggle`);
50
- }, []);
51
- useEffect(() => {
52
- if (props.subNavigationExpanded !== undefined) {
53
- setIsSubNavigationExpanded(!!getBoolean(props.subNavigationExpanded, "subNavigationExpanded"));
54
- }
55
- }, [props.subNavigationExpanded]);
56
- useEffect(() => {
57
- var _a;
58
- if (initialized && _ref.current) {
59
- const subNavigationSlot = _ref.current.querySelector("menu");
60
- if (subNavigationSlot) {
61
- if (((_a = subNavigationSlot.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
62
- setHasAreaPopup(true);
63
- if (!navigationItemSafeTriangle) {
64
- setNavigationItemSafeTriangle(new NavigationItemSafeTriangle(_ref.current, subNavigationSlot));
65
- }
66
- }
67
- else {
68
- setHasSubNavigation(false);
69
- }
70
- }
71
- }
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,
75
- 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));
2
+ import { filterPassingProps as e, getRootProps as t } from "../../utils/react.js";
3
+ import { cls as n, delay as r, getBoolean as i, getBooleanAsString as a } from "../../utils/index.js";
4
+ import "../../shared/constants.js";
5
+ import o from "../button/button.js";
6
+ import { NavigationItemSafeTriangle as s } from "../../utils/navigation.js";
7
+ import { forwardRef as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
8
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ //#region src/components/navigation-item/navigation-item.tsx
10
+ function g(c, g) {
11
+ let _ = u(), v = g || d(g), [y, b] = f(() => !1), [x, S] = f(() => !1), [C, w] = f(() => !0), [T, E] = f(() => !1), [D, O] = f(() => !1), [k, A] = f(() => void 0), [j, M] = f(() => void 0), [N, P] = f(() => void 0);
12
+ function F(e) {
13
+ e?.target?.nodeName === "A" && (O(!0), r(() => {
14
+ O(!1);
15
+ }, 1e3));
16
+ }
17
+ function I(e) {
18
+ c.onClick && (e.stopPropagation(), c.onClick(e)), x && E(!0);
19
+ }
20
+ function L(e) {
21
+ e.stopPropagation(), E(!1);
22
+ }
23
+ return l(() => {
24
+ b(!0);
25
+ let e = `sub-nav-${c.id ?? _}`;
26
+ M(e), P(`${e}-toggle`);
27
+ }, []), l(() => {
28
+ c.subNavigationExpanded !== void 0 && E(!!i(c.subNavigationExpanded, "subNavigationExpanded"));
29
+ }, [c.subNavigationExpanded]), l(() => {
30
+ if (y && v.current) {
31
+ let e = v.current.querySelector("menu");
32
+ e && (e.children?.length > 0 ? (S(!0), k || A(new s(v.current, e))) : w(!1));
33
+ }
34
+ }, [y, v.current]), /* @__PURE__ */ m("li", {
35
+ ref: v,
36
+ ...e(c, [
37
+ "data-icon-variant",
38
+ "data-icon-variant-before",
39
+ "data-icon-variant-after",
40
+ "data-icon-weight",
41
+ "data-icon-weight-before",
42
+ "data-icon-weight-after",
43
+ "data-interactive",
44
+ "data-force-mobile",
45
+ "data-color",
46
+ "data-container-color",
47
+ "data-bg-color",
48
+ "data-on-bg-color",
49
+ "data-color-scheme",
50
+ "data-font-size",
51
+ "data-headline-size",
52
+ "data-divider",
53
+ "data-focus",
54
+ "data-font",
55
+ "data-density"
56
+ ]),
57
+ id: c.id ?? c.propOverrides?.id,
58
+ onMouseOver: (e) => k?.enableFollow(),
59
+ onMouseLeave: (e) => k?.disableFollow(),
60
+ onMouseMove: (e) => k?.followByMouseEvent(e),
61
+ ...t(c, [
62
+ "data-icon-variant",
63
+ "data-icon-variant-before",
64
+ "data-icon-variant-after",
65
+ "data-icon-weight",
66
+ "data-icon-weight-before",
67
+ "data-icon-weight-after",
68
+ "data-interactive",
69
+ "data-force-mobile",
70
+ "data-color",
71
+ "data-container-color",
72
+ "data-bg-color",
73
+ "data-on-bg-color",
74
+ "data-color-scheme",
75
+ "data-font-size",
76
+ "data-headline-size",
77
+ "data-divider",
78
+ "data-focus",
79
+ "data-font",
80
+ "data-density"
81
+ ]),
82
+ className: n("db-navigation-item", c.className),
83
+ "data-width": c.width,
84
+ "data-icon": c.icon,
85
+ "data-show-icon": a(c.showIcon),
86
+ "data-active": c.active,
87
+ "data-wrap": a(c.wrap),
88
+ "aria-disabled": a(c.disabled),
89
+ children: !i(c.hideSubNavigation, "hideSubNavigation") && C ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("button", {
90
+ className: "db-navigation-item-expand-button",
91
+ id: N,
92
+ "aria-haspopup": x ? "true" : void 0,
93
+ "aria-expanded": T,
94
+ "aria-controls": j,
95
+ disabled: i(c.disabled, "disabled"),
96
+ onClick: (e) => I(e),
97
+ children: c.text ? /* @__PURE__ */ m(p, { children: c.text }) : /* @__PURE__ */ m(p, { children: c.children })
98
+ }), /* @__PURE__ */ h("menu", {
99
+ className: "db-sub-navigation",
100
+ id: j,
101
+ "aria-labelledby": N,
102
+ "data-force-close": D,
103
+ onClick: (e) => F(e),
104
+ children: [x ? /* @__PURE__ */ m("div", {
105
+ className: "db-mobile-navigation-back",
106
+ children: /* @__PURE__ */ m(o, {
107
+ icon: "arrow_left",
108
+ variant: "ghost",
109
+ id: c.backButtonId,
110
+ onClick: (e) => L(e),
111
+ children: c.backButtonText ?? "Back"
112
+ })
113
+ }) : null, /* @__PURE__ */ m(p, { children: c.subNavigation })]
114
+ })] }) : c.text ? /* @__PURE__ */ m(p, { children: c.text }) : /* @__PURE__ */ m(p, { children: c.children })
115
+ });
81
116
  }
82
- const DBNavigationItem = forwardRef(DBNavigationItemFn);
83
- export default DBNavigationItem;
117
+ var _ = c(g);
118
+ //#endregion
119
+ export { _ as default };
@@ -1,4 +1,4 @@
1
- import { ClickEvent, CloseEventProps, CloseEventState, GlobalProps, GlobalState, IconProps, InnerCloseButtonProps, RoleProps, SemanticProps, ShowIconProps, TextProps } from '../../shared/model';
1
+ import type { ClickEvent, CloseEventProps, CloseEventState, GlobalProps, GlobalState, IconProps, InnerCloseButtonProps, RoleProps, SemanticProps, ShowIconProps, TextProps } from '../../shared/model';
2
2
  export declare const NotificationVariantList: readonly ["docked", "standalone", "overlay"];
3
3
  export type NotificationVariantType = (typeof NotificationVariantList)[number];
4
4
  export declare const NotificationLinkVariantList: readonly ["block", "inline"];
@@ -1,3 +1,12 @@
1
- export const NotificationVariantList = ['docked', 'standalone', 'overlay'];
2
- export const NotificationLinkVariantList = ['block', 'inline'];
3
- export const NotificationAriaLiveList = ['assertive', 'polite', 'off'];
1
+ //#region src/components/notification/model.ts
2
+ var e = [
3
+ "docked",
4
+ "standalone",
5
+ "overlay"
6
+ ], t = ["block", "inline"], n = [
7
+ "assertive",
8
+ "polite",
9
+ "off"
10
+ ];
11
+ //#endregion
12
+ export { n as NotificationAriaLiveList, t as NotificationLinkVariantList, e as NotificationVariantList };
@@ -1,34 +1,102 @@
1
1
  "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useRef, forwardRef } from "react";
5
- import { DEFAULT_CLOSE_BUTTON } from "../../shared/constants";
6
- import { cls, getBoolean, getBooleanAsString, getNotificationRole, stringPropVisible, } from "../../utils";
7
- import DBButton from "../button/button";
8
- function DBNotificationFn(props, component) {
9
- var _a, _b, _c;
10
- const _ref = component || useRef(component);
11
- function handleClose(event) {
12
- if (!event)
13
- return;
14
- event.stopPropagation();
15
- if (props.onClose) {
16
- props.onClose(event);
17
- }
18
- }
19
- return (React.createElement("div", 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", "onClose"]), { 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-notification", props.className), role: getNotificationRole({
20
- semantic: props.semantic,
21
- role: props.role,
22
- ariaLive: props.ariaLive,
23
- }), "aria-live": props.ariaLive, "data-semantic": props.semantic, "data-variant": props.variant, "data-icon": getBoolean(props.showIcon) !== false ? props.icon : undefined, "data-show-icon": getBooleanAsString(props.showIcon), "data-link-variant": props.linkVariant }),
24
- React.createElement(React.Fragment, null, props.image),
25
- stringPropVisible(props.headline, props.showHeadline) ? (React.createElement("header", { "data-area": "head" }, props.headline)) : null,
26
- React.createElement("div", { "data-area": "content" },
27
- props.text ? React.createElement(React.Fragment, null, props.text) : null,
28
- props.children),
29
- stringPropVisible(props.timestamp, props.showTimestamp) ? (React.createElement("time", { "data-area": "timestamp", dateTime: props.timestampDatetime }, props.timestamp)) : null,
30
- React.createElement(React.Fragment, null, props.link),
31
- getBoolean(props.closeable, "closeable") ? (React.createElement(DBButton, { icon: "cross", variant: "ghost", size: "small", id: props.closeButtonId, noText: true, onClick: (event) => handleClose(event) }, (_c = props.closeButtonText) !== null && _c !== void 0 ? _c : DEFAULT_CLOSE_BUTTON)) : null));
2
+ import { filterPassingProps as e, getRootProps as t } from "../../utils/react.js";
3
+ import { cls as n, getBoolean as r, getBooleanAsString as i, getNotificationRole as a, stringPropVisible as o } from "../../utils/index.js";
4
+ import "../../shared/constants.js";
5
+ import s from "../button/button.js";
6
+ import { forwardRef as c, useRef as l } from "react";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ //#region src/components/notification/notification.tsx
9
+ function p(c, p) {
10
+ let m = p || l(p);
11
+ function h(e) {
12
+ e && (e.stopPropagation(), c.onClose && c.onClose(e));
13
+ }
14
+ return /* @__PURE__ */ f("div", {
15
+ ref: m,
16
+ ...e(c, [
17
+ "data-icon-variant",
18
+ "data-icon-variant-before",
19
+ "data-icon-variant-after",
20
+ "data-icon-weight",
21
+ "data-icon-weight-before",
22
+ "data-icon-weight-after",
23
+ "data-interactive",
24
+ "data-force-mobile",
25
+ "data-color",
26
+ "data-container-color",
27
+ "data-bg-color",
28
+ "data-on-bg-color",
29
+ "data-color-scheme",
30
+ "data-font-size",
31
+ "data-headline-size",
32
+ "data-divider",
33
+ "data-focus",
34
+ "data-font",
35
+ "data-density",
36
+ "onClose"
37
+ ]),
38
+ id: c.id ?? c.propOverrides?.id,
39
+ ...t(c, [
40
+ "data-icon-variant",
41
+ "data-icon-variant-before",
42
+ "data-icon-variant-after",
43
+ "data-icon-weight",
44
+ "data-icon-weight-before",
45
+ "data-icon-weight-after",
46
+ "data-interactive",
47
+ "data-force-mobile",
48
+ "data-color",
49
+ "data-container-color",
50
+ "data-bg-color",
51
+ "data-on-bg-color",
52
+ "data-color-scheme",
53
+ "data-font-size",
54
+ "data-headline-size",
55
+ "data-divider",
56
+ "data-focus",
57
+ "data-font",
58
+ "data-density"
59
+ ]),
60
+ className: n("db-notification", c.className),
61
+ role: a({
62
+ semantic: c.semantic,
63
+ role: c.role,
64
+ ariaLive: c.ariaLive
65
+ }),
66
+ "aria-live": c.ariaLive,
67
+ "data-semantic": c.semantic,
68
+ "data-variant": c.variant,
69
+ "data-icon": r(c.showIcon) === !1 ? void 0 : c.icon,
70
+ "data-show-icon": i(c.showIcon),
71
+ "data-link-variant": c.linkVariant,
72
+ children: [
73
+ /* @__PURE__ */ d(u, { children: c.image }),
74
+ o(c.headline, c.showHeadline) ? /* @__PURE__ */ d("header", {
75
+ "data-area": "head",
76
+ children: c.headline
77
+ }) : null,
78
+ /* @__PURE__ */ f("div", {
79
+ "data-area": "content",
80
+ children: [c.text ? /* @__PURE__ */ d(u, { children: c.text }) : null, c.children]
81
+ }),
82
+ o(c.timestamp, c.showTimestamp) ? /* @__PURE__ */ d("time", {
83
+ "data-area": "timestamp",
84
+ dateTime: c.timestampDatetime,
85
+ children: c.timestamp
86
+ }) : null,
87
+ /* @__PURE__ */ d(u, { children: c.link }),
88
+ r(c.closeable, "closeable") ? /* @__PURE__ */ d(s, {
89
+ icon: "cross",
90
+ variant: "ghost",
91
+ size: "small",
92
+ id: c.closeButtonId,
93
+ noText: !0,
94
+ onClick: (e) => h(e),
95
+ children: c.closeButtonText ?? "Close"
96
+ }) : null
97
+ ]
98
+ });
32
99
  }
33
- const DBNotification = forwardRef(DBNotificationFn);
34
- export default DBNotification;
100
+ var m = c(p);
101
+ //#endregion
102
+ export { m as default };
@@ -1,4 +1,4 @@
1
- import { GlobalProps, GlobalState } from '../../shared/model';
1
+ import type { GlobalProps, GlobalState } from '../../shared/model';
2
2
  export declare const PageVariantList: readonly ["auto", "fixed"];
3
3
  export type PageVariantType = (typeof PageVariantList)[number];
4
4
  export declare const PageDocumentOverflowList: readonly ["hidden", "auto"];
@@ -1,2 +1,4 @@
1
- export const PageVariantList = ['auto', 'fixed'];
2
- export const PageDocumentOverflowList = ['hidden', 'auto'];
1
+ //#region src/components/page/model.ts
2
+ var e = ["auto", "fixed"], t = ["hidden", "auto"];
3
+ //#endregion
4
+ export { t as PageDocumentOverflowList, e as PageVariantList };
@@ -1,48 +1,76 @@
1
1
  "use client";
2
- import * as React from "react";
3
- import { filterPassingProps, getRootProps } from "../../utils/react";
4
- import { useState, useRef, useEffect, forwardRef } from "react";
5
- import { cls, getBooleanAsString } from "../../utils";
6
- function DBPageFn(props, component) {
7
- var _a, _b;
8
- const _ref = component || useRef(component);
9
- const [fontsLoaded, setFontsLoaded] = useState(() => false);
10
- const hasInitialized = useRef(false);
11
- if (!hasInitialized.current) {
12
- if (typeof window !== "undefined" &&
13
- document &&
14
- (props.documentOverflow === "hidden" ||
15
- (props.variant === "fixed" && props.documentOverflow !== "auto"))) {
16
- // We need to set this to `html` element that the flex-box solution works
17
- // See https://stackoverflow.com/a/43710216 - Approach 1 - flexbox
18
- document.documentElement.classList.add("db-page-document");
19
- }
20
- hasInitialized.current = true;
21
- }
22
- useEffect(() => {
23
- setFontsLoaded(!props.fadeIn);
24
- if (document && props.fadeIn) {
25
- document.fonts.ready.then(() => {
26
- setFontsLoaded(true);
27
- });
28
- }
29
- else {
30
- setFontsLoaded(true);
31
- }
32
- }, []);
33
- useEffect(() => {
34
- return () => {
35
- if (typeof window !== "undefined" &&
36
- document.documentElement.classList.contains("db-page-document")) {
37
- // remove document styles set by this
38
- document.documentElement.classList.remove("db-page-document");
39
- }
40
- };
41
- }, []);
42
- return (React.createElement("div", 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 }, 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-page", props.className), "data-variant": props.variant, "data-fade-in": getBooleanAsString(props.fadeIn), "data-fonts-loaded": getBooleanAsString(fontsLoaded) }),
43
- React.createElement(React.Fragment, null, props.header),
44
- React.createElement("main", { className: cls("db-main", props.mainClass) }, props.children),
45
- React.createElement(React.Fragment, null, props.footer)));
2
+ import { filterPassingProps as e, getRootProps as t } from "../../utils/react.js";
3
+ import { cls as n, getBooleanAsString as r } from "../../utils/index.js";
4
+ import { forwardRef as i, useEffect as a, useRef as o, useState as s } from "react";
5
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ //#region src/components/page/page.tsx
7
+ function d(i, d) {
8
+ let f = d || o(d), [p, m] = s(() => !1), h = o(!1);
9
+ return h.current ||= (typeof window < "u" && document && (i.documentOverflow === "hidden" || i.variant === "fixed" && i.documentOverflow !== "auto") && document.documentElement.classList.add("db-page-document"), !0), a(() => {
10
+ m(!i.fadeIn), document && i.fadeIn ? document.fonts.ready.then(() => {
11
+ m(!0);
12
+ }) : m(!0);
13
+ }, []), a(() => () => {
14
+ typeof window < "u" && document.documentElement.classList.contains("db-page-document") && document.documentElement.classList.remove("db-page-document");
15
+ }, []), /* @__PURE__ */ u("div", {
16
+ ref: f,
17
+ ...e(i, [
18
+ "data-icon-variant",
19
+ "data-icon-variant-before",
20
+ "data-icon-variant-after",
21
+ "data-icon-weight",
22
+ "data-icon-weight-before",
23
+ "data-icon-weight-after",
24
+ "data-interactive",
25
+ "data-force-mobile",
26
+ "data-color",
27
+ "data-container-color",
28
+ "data-bg-color",
29
+ "data-on-bg-color",
30
+ "data-color-scheme",
31
+ "data-font-size",
32
+ "data-headline-size",
33
+ "data-divider",
34
+ "data-focus",
35
+ "data-font",
36
+ "data-density"
37
+ ]),
38
+ id: i.id ?? i.propOverrides?.id,
39
+ ...t(i, [
40
+ "data-icon-variant",
41
+ "data-icon-variant-before",
42
+ "data-icon-variant-after",
43
+ "data-icon-weight",
44
+ "data-icon-weight-before",
45
+ "data-icon-weight-after",
46
+ "data-interactive",
47
+ "data-force-mobile",
48
+ "data-color",
49
+ "data-container-color",
50
+ "data-bg-color",
51
+ "data-on-bg-color",
52
+ "data-color-scheme",
53
+ "data-font-size",
54
+ "data-headline-size",
55
+ "data-divider",
56
+ "data-focus",
57
+ "data-font",
58
+ "data-density"
59
+ ]),
60
+ className: n("db-page", i.className),
61
+ "data-variant": i.variant,
62
+ "data-fade-in": r(i.fadeIn),
63
+ "data-fonts-loaded": r(p),
64
+ children: [
65
+ /* @__PURE__ */ l(c, { children: i.header }),
66
+ /* @__PURE__ */ l("main", {
67
+ className: n("db-main", i.mainClass),
68
+ children: i.children
69
+ }),
70
+ /* @__PURE__ */ l(c, { children: i.footer })
71
+ ]
72
+ });
46
73
  }
47
- const DBPage = forwardRef(DBPageFn);
48
- export default DBPage;
74
+ var f = i(d);
75
+ //#endregion
76
+ export { f as default };
@@ -1,4 +1,4 @@
1
- import { GapProps, GlobalProps, GlobalState, InitializedState, PlacementProps, PopoverProps, PopoverState, SpacingProps } from '../../shared/model';
1
+ import type { GapProps, GlobalProps, GlobalState, InitializedState, PlacementProps, PopoverProps, PopoverState, SpacingProps } from '../../shared/model';
2
2
  export type DBPopoverDefaultProps = {
3
3
  /**
4
4
  * Use open to disable the default hover/focus behavior to use it on click or other trigger.