@db-ux/react-core-components 4.9.1 → 4.10.0-esm-f121fc3

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 (241) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/README.md +97 -35
  3. package/dist/components/accordion/accordion.d.ts +1 -1
  4. package/dist/components/accordion/accordion.js +102 -86
  5. package/dist/components/accordion/index.d.ts +1 -1
  6. package/dist/components/accordion/model.d.ts +1 -1
  7. package/dist/components/accordion/model.js +4 -2
  8. package/dist/components/accordion-item/accordion-item.d.ts +3 -2
  9. package/dist/components/accordion-item/accordion-item.js +89 -56
  10. package/dist/components/accordion-item/index.d.ts +1 -1
  11. package/dist/components/accordion-item/model.d.ts +5 -1
  12. package/dist/components/badge/badge.d.ts +1 -1
  13. package/dist/components/badge/badge.js +72 -32
  14. package/dist/components/badge/index.d.ts +1 -1
  15. package/dist/components/badge/model.d.ts +1 -1
  16. package/dist/components/badge/model.js +12 -1
  17. package/dist/components/brand/brand.d.ts +1 -1
  18. package/dist/components/brand/brand.js +60 -13
  19. package/dist/components/brand/index.d.ts +1 -1
  20. package/dist/components/brand/model.d.ts +1 -1
  21. package/dist/components/button/button.d.ts +1 -1
  22. package/dist/components/button/button.js +75 -21
  23. package/dist/components/button/index.d.ts +1 -1
  24. package/dist/components/button/model.d.ts +1 -1
  25. package/dist/components/button/model.js +13 -2
  26. package/dist/components/card/card.d.ts +1 -1
  27. package/dist/components/card/card.js +65 -15
  28. package/dist/components/card/index.d.ts +1 -1
  29. package/dist/components/card/model.d.ts +1 -1
  30. package/dist/components/card/model.js +8 -2
  31. package/dist/components/checkbox/checkbox.d.ts +1 -1
  32. package/dist/components/checkbox/checkbox.js +163 -157
  33. package/dist/components/checkbox/index.d.ts +1 -1
  34. package/dist/components/checkbox/model.d.ts +1 -1
  35. package/dist/components/custom-button/custom-button.d.ts +1 -1
  36. package/dist/components/custom-button/custom-button.js +65 -10
  37. package/dist/components/custom-button/index.d.ts +1 -1
  38. package/dist/components/custom-button/model.d.ts +2 -2
  39. package/dist/components/custom-select/custom-select.d.ts +1 -1
  40. package/dist/components/custom-select/custom-select.js +509 -727
  41. package/dist/components/custom-select/index.d.ts +1 -1
  42. package/dist/components/custom-select/model.d.ts +3 -3
  43. package/dist/components/custom-select/model.js +8 -1
  44. package/dist/components/custom-select-dropdown/custom-select-dropdown.d.ts +1 -1
  45. package/dist/components/custom-select-dropdown/custom-select-dropdown.js +62 -11
  46. package/dist/components/custom-select-dropdown/index.d.ts +1 -1
  47. package/dist/components/custom-select-dropdown/model.d.ts +1 -1
  48. package/dist/components/custom-select-dropdown/model.js +8 -1
  49. package/dist/components/custom-select-form-field/custom-select-form-field.d.ts +1 -1
  50. package/dist/components/custom-select-form-field/custom-select-form-field.js +57 -10
  51. package/dist/components/custom-select-form-field/index.d.ts +1 -1
  52. package/dist/components/custom-select-form-field/model.d.ts +1 -1
  53. package/dist/components/custom-select-list/custom-select-list.d.ts +1 -1
  54. package/dist/components/custom-select-list/custom-select-list.js +60 -11
  55. package/dist/components/custom-select-list/index.d.ts +1 -1
  56. package/dist/components/custom-select-list/model.d.ts +1 -1
  57. package/dist/components/custom-select-list-item/custom-select-list-item.d.ts +2 -2
  58. package/dist/components/custom-select-list-item/custom-select-list-item.js +89 -32
  59. package/dist/components/custom-select-list-item/index.d.ts +1 -1
  60. package/dist/components/custom-select-list-item/model.d.ts +1 -1
  61. package/dist/components/custom-select-list-item/model.js +4 -1
  62. package/dist/components/divider/divider.d.ts +1 -1
  63. package/dist/components/divider/divider.js +60 -10
  64. package/dist/components/divider/index.d.ts +1 -1
  65. package/dist/components/divider/model.d.ts +1 -1
  66. package/dist/components/divider/model.js +4 -2
  67. package/dist/components/drawer/drawer.d.ts +2 -2
  68. package/dist/components/drawer/drawer.js +118 -97
  69. package/dist/components/drawer/index.d.ts +1 -1
  70. package/dist/components/drawer/model.d.ts +1 -1
  71. package/dist/components/drawer/model.js +14 -4
  72. package/dist/components/header/header.d.ts +1 -1
  73. package/dist/components/header/header.js +143 -65
  74. package/dist/components/header/index.d.ts +1 -1
  75. package/dist/components/header/model.d.ts +1 -1
  76. package/dist/components/icon/icon.d.ts +1 -1
  77. package/dist/components/icon/icon.js +61 -12
  78. package/dist/components/icon/index.d.ts +1 -1
  79. package/dist/components/icon/model.d.ts +1 -1
  80. package/dist/components/icon/model.js +11 -1
  81. package/dist/components/infotext/index.d.ts +1 -1
  82. package/dist/components/infotext/infotext.d.ts +1 -1
  83. package/dist/components/infotext/infotext.js +62 -12
  84. package/dist/components/infotext/model.d.ts +1 -1
  85. package/dist/components/input/index.d.ts +1 -1
  86. package/dist/components/input/input.d.ts +1 -1
  87. package/dist/components/input/input.js +198 -167
  88. package/dist/components/input/model.d.ts +1 -1
  89. package/dist/components/input/model.js +21 -5
  90. package/dist/components/link/index.d.ts +1 -1
  91. package/dist/components/link/link.d.ts +1 -1
  92. package/dist/components/link/link.js +70 -12
  93. package/dist/components/link/model.d.ts +1 -1
  94. package/dist/components/link/model.js +8 -3
  95. package/dist/components/navigation/index.d.ts +1 -1
  96. package/dist/components/navigation/model.d.ts +1 -1
  97. package/dist/components/navigation/navigation.d.ts +1 -1
  98. package/dist/components/navigation/navigation.js +57 -11
  99. package/dist/components/navigation-item/index.d.ts +1 -1
  100. package/dist/components/navigation-item/model.d.ts +6 -2
  101. package/dist/components/navigation-item/navigation-item.d.ts +1 -1
  102. package/dist/components/navigation-item/navigation-item.js +117 -81
  103. package/dist/components/notification/index.d.ts +1 -1
  104. package/dist/components/notification/model.d.ts +1 -1
  105. package/dist/components/notification/model.js +12 -3
  106. package/dist/components/notification/notification.d.ts +2 -2
  107. package/dist/components/notification/notification.js +100 -32
  108. package/dist/components/page/index.d.ts +1 -1
  109. package/dist/components/page/model.d.ts +1 -1
  110. package/dist/components/page/model.js +4 -2
  111. package/dist/components/page/page.d.ts +1 -1
  112. package/dist/components/page/page.js +74 -46
  113. package/dist/components/popover/index.d.ts +1 -1
  114. package/dist/components/popover/model.d.ts +1 -1
  115. package/dist/components/popover/popover.d.ts +1 -1
  116. package/dist/components/popover/popover.js +126 -125
  117. package/dist/components/radio/index.d.ts +1 -1
  118. package/dist/components/radio/model.d.ts +1 -1
  119. package/dist/components/radio/radio.d.ts +1 -1
  120. package/dist/components/radio/radio.js +124 -85
  121. package/dist/components/section/index.d.ts +1 -1
  122. package/dist/components/section/model.d.ts +1 -1
  123. package/dist/components/section/section.d.ts +1 -1
  124. package/dist/components/section/section.js +59 -10
  125. package/dist/components/select/index.d.ts +1 -1
  126. package/dist/components/select/model.d.ts +1 -1
  127. package/dist/components/select/select.d.ts +1 -1
  128. package/dist/components/select/select.js +188 -191
  129. package/dist/components/stack/index.d.ts +1 -1
  130. package/dist/components/stack/model.d.ts +1 -1
  131. package/dist/components/stack/model.js +14 -4
  132. package/dist/components/stack/stack.d.ts +1 -1
  133. package/dist/components/stack/stack.js +63 -10
  134. package/dist/components/switch/index.d.ts +1 -1
  135. package/dist/components/switch/model.d.ts +1 -1
  136. package/dist/components/switch/switch.d.ts +1 -1
  137. package/dist/components/switch/switch.js +182 -150
  138. package/dist/components/tab-item/index.d.ts +1 -1
  139. package/dist/components/tab-item/model.d.ts +1 -1
  140. package/dist/components/tab-item/tab-item.d.ts +1 -1
  141. package/dist/components/tab-item/tab-item.js +105 -76
  142. package/dist/components/tab-list/index.d.ts +1 -1
  143. package/dist/components/tab-list/model.d.ts +1 -1
  144. package/dist/components/tab-list/tab-list.d.ts +1 -1
  145. package/dist/components/tab-list/tab-list.js +60 -11
  146. package/dist/components/tab-panel/index.d.ts +1 -1
  147. package/dist/components/tab-panel/model.d.ts +1 -1
  148. package/dist/components/tab-panel/tab-panel.d.ts +1 -1
  149. package/dist/components/tab-panel/tab-panel.js +59 -13
  150. package/dist/components/tabs/index.d.ts +1 -1
  151. package/dist/components/tabs/model.d.ts +1 -1
  152. package/dist/components/tabs/model.js +4 -2
  153. package/dist/components/tabs/tabs.d.ts +1 -1
  154. package/dist/components/tabs/tabs.js +191 -178
  155. package/dist/components/tag/index.d.ts +1 -1
  156. package/dist/components/tag/model.d.ts +1 -1
  157. package/dist/components/tag/model.js +4 -1
  158. package/dist/components/tag/tag.d.ts +1 -1
  159. package/dist/components/tag/tag.js +91 -32
  160. package/dist/components/textarea/index.d.ts +1 -1
  161. package/dist/components/textarea/model.d.ts +1 -1
  162. package/dist/components/textarea/model.js +13 -2
  163. package/dist/components/textarea/textarea.d.ts +1 -1
  164. package/dist/components/textarea/textarea.js +165 -150
  165. package/dist/components/tooltip/index.d.ts +1 -1
  166. package/dist/components/tooltip/model.d.ts +1 -1
  167. package/dist/components/tooltip/model.js +4 -1
  168. package/dist/components/tooltip/tooltip.d.ts +1 -1
  169. package/dist/components/tooltip/tooltip.js +119 -115
  170. package/dist/index.d.ts +26 -26
  171. package/dist/index.js +64 -81
  172. package/dist/shared/constants.js +32 -94
  173. package/dist/shared/figma.d.ts +12 -6
  174. package/dist/shared/model.js +73 -22
  175. package/dist/utils/document-click-listener.js +26 -29
  176. package/dist/utils/document-scroll-listener.js +30 -38
  177. package/dist/utils/floating-components.js +107 -358
  178. package/dist/utils/form-components.js +34 -60
  179. package/dist/utils/index.d.ts +1 -1
  180. package/dist/utils/index.js +49 -167
  181. package/dist/utils/navigation.js +68 -135
  182. package/dist/utils/react.js +10 -15
  183. package/package.json +13 -8
  184. package/dist/components/accordion/index.js +0 -1
  185. package/dist/components/accordion-item/index.js +0 -1
  186. package/dist/components/accordion-item/model.js +0 -1
  187. package/dist/components/badge/index.js +0 -1
  188. package/dist/components/brand/index.js +0 -1
  189. package/dist/components/brand/model.js +0 -1
  190. package/dist/components/button/index.js +0 -1
  191. package/dist/components/card/index.js +0 -1
  192. package/dist/components/checkbox/index.js +0 -1
  193. package/dist/components/checkbox/model.js +0 -1
  194. package/dist/components/custom-button/index.js +0 -1
  195. package/dist/components/custom-button/model.js +0 -1
  196. package/dist/components/custom-select/index.js +0 -1
  197. package/dist/components/custom-select-dropdown/index.js +0 -1
  198. package/dist/components/custom-select-form-field/index.js +0 -1
  199. package/dist/components/custom-select-form-field/model.js +0 -1
  200. package/dist/components/custom-select-list/index.js +0 -1
  201. package/dist/components/custom-select-list/model.js +0 -1
  202. package/dist/components/custom-select-list-item/index.js +0 -1
  203. package/dist/components/divider/index.js +0 -1
  204. package/dist/components/drawer/index.js +0 -1
  205. package/dist/components/header/index.js +0 -1
  206. package/dist/components/header/model.js +0 -1
  207. package/dist/components/icon/index.js +0 -1
  208. package/dist/components/infotext/index.js +0 -1
  209. package/dist/components/infotext/model.js +0 -1
  210. package/dist/components/input/index.js +0 -1
  211. package/dist/components/link/index.js +0 -1
  212. package/dist/components/navigation/index.js +0 -1
  213. package/dist/components/navigation/model.js +0 -1
  214. package/dist/components/navigation-item/index.js +0 -1
  215. package/dist/components/navigation-item/model.js +0 -1
  216. package/dist/components/notification/index.js +0 -1
  217. package/dist/components/page/index.js +0 -1
  218. package/dist/components/popover/index.js +0 -1
  219. package/dist/components/popover/model.js +0 -1
  220. package/dist/components/radio/index.js +0 -1
  221. package/dist/components/radio/model.js +0 -1
  222. package/dist/components/section/index.js +0 -1
  223. package/dist/components/section/model.js +0 -1
  224. package/dist/components/select/index.js +0 -1
  225. package/dist/components/select/model.js +0 -1
  226. package/dist/components/stack/index.js +0 -1
  227. package/dist/components/switch/index.js +0 -1
  228. package/dist/components/switch/model.js +0 -1
  229. package/dist/components/tab-item/index.js +0 -1
  230. package/dist/components/tab-item/model.js +0 -1
  231. package/dist/components/tab-list/index.js +0 -1
  232. package/dist/components/tab-list/model.js +0 -1
  233. package/dist/components/tab-panel/index.js +0 -1
  234. package/dist/components/tab-panel/model.js +0 -1
  235. package/dist/components/tabs/index.js +0 -1
  236. package/dist/components/tag/index.js +0 -1
  237. package/dist/components/textarea/index.js +0 -1
  238. package/dist/components/tooltip/index.js +0 -1
  239. package/dist/shared/examples/index.js +0 -4
  240. package/dist/shared/figma.js +0 -1
  241. package/dist/shared/showcase/show-code-link.js +0 -51
@@ -1,99 +1,120 @@
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_CLOSE_BUTTON } from "../../shared/constants";
6
- import { cls, delay, getBooleanAsString, isKeyboardEvent } from "../../utils";
7
- import DBButton from "../button/button";
8
- function DBDrawerFn(props, component) {
9
- var _a, _b, _c;
10
- const _ref = component || useRef(component);
11
- const dialogContainerRef = useRef(null);
12
- const [initialized, setInitialized] = useState(() => false);
13
- function handleClose(event, forceClose) {
14
- var _a;
15
- if (!event)
16
- return;
17
- if (isKeyboardEvent(event)) {
18
- if (event.key === "Escape") {
19
- event.preventDefault();
20
- if (props.onClose) {
21
- props.onClose(event);
22
- }
23
- }
24
- }
25
- else {
26
- if (forceClose) {
27
- event.stopPropagation();
28
- if (props.onClose) {
29
- props.onClose(event);
30
- }
31
- }
32
- if (((_a = event.target) === null || _a === void 0 ? void 0 : _a.nodeName) === "DIALOG" &&
33
- event.type === "click" &&
34
- props.backdrop !== "none") {
35
- if (props.onClose) {
36
- props.onClose(event);
37
- }
38
- }
39
- }
40
- }
41
- function handleDialogOpen() {
42
- if (_ref.current) {
43
- const open = Boolean(props.open);
44
- if (open && !_ref.current.open) {
45
- if (dialogContainerRef.current) {
46
- dialogContainerRef.current.removeAttribute("data-transition");
47
- }
48
- if (props.position === "absolute" ||
49
- props.backdrop === "none" ||
50
- props.variant === "inside") {
51
- _ref.current.show();
52
- }
53
- else {
54
- _ref.current.showModal();
55
- }
56
- void delay(() => {
57
- if (dialogContainerRef.current) {
58
- dialogContainerRef.current.dataset["transition"] = "open";
59
- }
60
- }, 1);
61
- }
62
- if (!open && _ref.current.open) {
63
- if (dialogContainerRef.current) {
64
- dialogContainerRef.current.dataset["transition"] =
65
- "close";
66
- }
67
- void delay(() => {
68
- var _a;
69
- (_a = _ref.current) === null || _a === void 0 ? void 0 : _a.close();
70
- }, 401);
71
- }
72
- }
73
- }
74
- useEffect(() => {
75
- handleDialogOpen();
76
- setInitialized(true);
77
- }, []);
78
- useEffect(() => {
79
- handleDialogOpen();
80
- }, [props.open]);
81
- useEffect(() => {
82
- if (_ref.current && initialized && props.position === "absolute") {
83
- const refElement = _ref.current;
84
- const parent = refElement.parentElement;
85
- if (parent) {
86
- parent.style.position = "relative";
87
- }
88
- }
89
- }, [_ref.current, initialized, props.position]);
90
- return (React.createElement("dialog", Object.assign({ className: "db-drawer", id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id, 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"]), { onClick: (event) => handleClose(event), onKeyDown: (event) => handleClose(event), "data-position": props.position, "data-backdrop": props.backdrop, "data-direction": props.direction, "data-variant": props.variant }),
91
- React.createElement("article", Object.assign({ ref: dialogContainerRef }, 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-drawer-container", props.className), "data-spacing": props.spacing, "data-width": props.width, "data-direction": props.direction, "data-rounded": getBooleanAsString(props.rounded) }),
92
- React.createElement("header", { className: "db-drawer-header" },
93
- React.createElement("div", { className: "db-drawer-header-text" },
94
- React.createElement(React.Fragment, null, props.drawerHeader)),
95
- React.createElement(DBButton, { className: "button-close-drawer", icon: "cross", variant: "ghost", id: props.closeButtonId, noText: true, onClick: (event) => handleClose(event, true) }, (_c = props.closeButtonText) !== null && _c !== void 0 ? _c : DEFAULT_CLOSE_BUTTON)),
96
- React.createElement("div", { className: "db-drawer-content" }, props.children))));
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, isKeyboardEvent as o } from "../../utils/index.js";
4
+ import "../../shared/constants.js";
5
+ import s from "../button/button.js";
6
+ import { forwardRef as c, useEffect as l, useRef as u, useState as d } from "react";
7
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
8
+ //#region src/components/drawer/drawer.tsx
9
+ function h(c, h) {
10
+ let g = h || u(h), _ = u(null), [v, y] = d(() => !1);
11
+ function b(e, t) {
12
+ e && (o(e) ? e.key === "Escape" && (e.preventDefault(), c.onClose && c.onClose(e)) : (t && (e.stopPropagation(), c.onClose && c.onClose(e)), e.target?.nodeName === "DIALOG" && e.type === "click" && c.backdrop !== "none" && c.onClose && c.onClose(e)));
13
+ }
14
+ function x() {
15
+ if (g.current) {
16
+ let e = i(c.open, "open");
17
+ e && !g.current.open && (_.current && _.current.removeAttribute("data-transition"), c.position === "absolute" || c.backdrop === "none" || c.variant === "inside" ? g.current.show() : g.current.showModal(), r(() => {
18
+ _.current && (_.current.dataset.transition = "open");
19
+ }, 1)), !e && g.current.open && (_.current && (_.current.dataset.transition = "close"), r(() => {
20
+ g.current?.close();
21
+ }, 401));
22
+ }
23
+ }
24
+ return l(() => {
25
+ x(), y(!0);
26
+ }, []), l(() => {
27
+ x();
28
+ }, [c.open]), l(() => {
29
+ if (g.current && v && c.position === "absolute") {
30
+ let e = g.current.parentElement;
31
+ e && (e.style.position = "relative");
32
+ }
33
+ }, [
34
+ g.current,
35
+ v,
36
+ c.position
37
+ ]), /* @__PURE__ */ p("dialog", {
38
+ className: "db-drawer",
39
+ id: c.id ?? c.propOverrides?.id,
40
+ ref: g,
41
+ ...e(c, [
42
+ "data-icon-variant",
43
+ "data-icon-variant-before",
44
+ "data-icon-variant-after",
45
+ "data-icon-weight",
46
+ "data-icon-weight-before",
47
+ "data-icon-weight-after",
48
+ "data-interactive",
49
+ "data-force-mobile",
50
+ "data-color",
51
+ "data-container-color",
52
+ "data-bg-color",
53
+ "data-on-bg-color",
54
+ "data-color-scheme",
55
+ "data-font-size",
56
+ "data-headline-size",
57
+ "data-divider",
58
+ "data-focus",
59
+ "data-font",
60
+ "data-density",
61
+ "onClose"
62
+ ]),
63
+ onClick: (e) => b(e),
64
+ onKeyDown: (e) => b(e),
65
+ "data-position": c.position,
66
+ "data-backdrop": c.backdrop,
67
+ "data-direction": c.direction,
68
+ "data-variant": c.variant,
69
+ children: /* @__PURE__ */ m("article", {
70
+ ref: _,
71
+ ...t(c, [
72
+ "data-icon-variant",
73
+ "data-icon-variant-before",
74
+ "data-icon-variant-after",
75
+ "data-icon-weight",
76
+ "data-icon-weight-before",
77
+ "data-icon-weight-after",
78
+ "data-interactive",
79
+ "data-force-mobile",
80
+ "data-color",
81
+ "data-container-color",
82
+ "data-bg-color",
83
+ "data-on-bg-color",
84
+ "data-color-scheme",
85
+ "data-font-size",
86
+ "data-headline-size",
87
+ "data-divider",
88
+ "data-focus",
89
+ "data-font",
90
+ "data-density"
91
+ ]),
92
+ className: n("db-drawer-container", c.className),
93
+ "data-spacing": c.spacing,
94
+ "data-width": c.width,
95
+ "data-direction": c.direction,
96
+ "data-rounded": a(c.rounded),
97
+ children: [/* @__PURE__ */ m("header", {
98
+ className: "db-drawer-header",
99
+ children: [/* @__PURE__ */ p("div", {
100
+ className: "db-drawer-header-text",
101
+ children: /* @__PURE__ */ p(f, { children: c.drawerHeader })
102
+ }), /* @__PURE__ */ p(s, {
103
+ className: "button-close-drawer",
104
+ icon: "cross",
105
+ variant: "ghost",
106
+ id: c.closeButtonId,
107
+ noText: !0,
108
+ onClick: (e) => b(e, !0),
109
+ children: c.closeButtonText ?? "Close"
110
+ })]
111
+ }), /* @__PURE__ */ p("div", {
112
+ className: "db-drawer-content",
113
+ children: c.children
114
+ })]
115
+ })
116
+ });
97
117
  }
98
- const DBDrawer = forwardRef(DBDrawerFn);
99
- export default DBDrawer;
118
+ var g = c(h);
119
+ //#endregion
120
+ export { g as default };
@@ -1 +1 @@
1
- export { default as DBDrawer } from './drawer';
1
+ export { default as DBDrawer } from './drawer.js';
@@ -1,4 +1,4 @@
1
- import type { ClickEvent, CloseEventProps, CloseEventState, GeneralKeyboardEvent, GlobalProps, GlobalState, InitializedState, InnerCloseButtonProps, SpacingProps, WidthProps } from '../../shared/model';
1
+ import type { ClickEvent, CloseEventProps, CloseEventState, GeneralKeyboardEvent, GlobalProps, GlobalState, InitializedState, InnerCloseButtonProps, SpacingProps, WidthProps } from '../../shared/model.js';
2
2
  export declare const DrawerBackdropList: readonly ["none", "strong", "weak", "invisible"];
3
3
  export type DrawerBackdropType = (typeof DrawerBackdropList)[number];
4
4
  export declare const DrawerDirectionList: readonly ["left", "right", "up", "down"];
@@ -1,4 +1,14 @@
1
- export const DrawerBackdropList = ['none', 'strong', 'weak', 'invisible'];
2
- export const DrawerDirectionList = ['left', 'right', 'up', 'down'];
3
- export const DrawerVariantList = ['modal', 'inside'];
4
- export const DrawerPositionList = ['fixed', 'absolute'];
1
+ //#region src/components/drawer/model.ts
2
+ var e = [
3
+ "none",
4
+ "strong",
5
+ "weak",
6
+ "invisible"
7
+ ], t = [
8
+ "left",
9
+ "right",
10
+ "up",
11
+ "down"
12
+ ], n = ["modal", "inside"], r = ["fixed", "absolute"];
13
+ //#endregion
14
+ export { e as DrawerBackdropList, t as DrawerDirectionList, r as DrawerPositionList, n as DrawerVariantList };
@@ -1,3 +1,3 @@
1
1
  import * as React from "react";
2
- declare const DBHeader: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | keyof import("../..").ToggleEventProps | "width" | keyof import("../..").InnerCloseButtonProps | keyof import("./model").DBHeaderDefaultProps> & import("./model").DBHeaderDefaultProps & import("../..").InnerCloseButtonProps & import("../..").GlobalProps & import("../..").ToggleEventProps & import("../..").ContainerWidthProps & React.RefAttributes<any>>;
2
+ declare const DBHeader: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../index.js").GlobalProps | keyof import("../../index.js").ToggleEventProps | "width" | keyof import("../../index.js").InnerCloseButtonProps | keyof import("./model").DBHeaderDefaultProps> & import("./model").DBHeaderDefaultProps & import("../../index.js").InnerCloseButtonProps & import("../../index.js").GlobalProps & import("../../index.js").ToggleEventProps & import("../../index.js").ContainerWidthProps & React.RefAttributes<any>>;
3
3
  export default DBHeader;
@@ -1,67 +1,145 @@
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_BURGER_MENU } from "../../shared/constants";
6
- import { addAttributeToChildren, cls, getBoolean } from "../../utils";
7
- import { isEventTargetNavigationItem } from "../../utils/navigation";
8
- import DBButton from "../button/button";
9
- import DBDrawer from "../drawer/drawer";
10
- function DBHeaderFn(props, component) {
11
- var _a, _b, _c;
12
- const _ref = component || useRef(component);
13
- const [initialized, setInitialized] = useState(() => false);
14
- const [forcedToMobile, setForcedToMobile] = useState(() => false);
15
- function handleToggle(event) {
16
- if (event && event.stopPropagation) {
17
- event.stopPropagation();
18
- }
19
- const open = !getBoolean(props.drawerOpen, "drawerOpen");
20
- if (props.onToggle) {
21
- props.onToggle(open);
22
- }
23
- }
24
- function handleNavigationItemClick(event) {
25
- if (isEventTargetNavigationItem(event)) {
26
- handleToggle();
27
- }
28
- }
29
- useEffect(() => {
30
- setInitialized(true);
31
- }, []);
32
- useEffect(() => {
33
- if (initialized && _ref.current && props.forceMobile) {
34
- // Adds this attribute to the header to enable all styling which would have
35
- // @media screen and (min-width: $db-screens-m) to show mobile navigation on a desktop device
36
- addAttributeToChildren(_ref.current, {
37
- key: "data-force-mobile",
38
- value: "true",
39
- });
40
- setForcedToMobile(true);
41
- }
42
- }, [initialized, _ref.current]);
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
- React.createElement("div", { className: "db-header-meta-navigation" },
52
- React.createElement(React.Fragment, null, props.metaNavigation)),
53
- React.createElement("div", { className: "db-header-navigation-bar" },
54
- React.createElement("div", { className: "db-header-brand-container" },
55
- React.createElement(React.Fragment, null, props.brand)),
56
- React.createElement("div", { className: "db-header-navigation-container" },
57
- React.createElement("div", { className: "db-header-navigation" }, props.children),
58
- React.createElement("div", { className: "db-header-primary-action" },
59
- React.createElement(React.Fragment, null, props.primaryAction))),
60
- React.createElement("div", { className: "db-header-action-container" },
61
- React.createElement("div", { className: "db-header-burger-menu-container" },
62
- React.createElement(DBButton, { icon: "menu", variant: "ghost", noText: true, onClick: (event) => handleToggle() }, (_c = props.burgerMenuLabel) !== null && _c !== void 0 ? _c : DEFAULT_BURGER_MENU)),
63
- React.createElement("div", { className: "db-header-secondary-action" },
64
- React.createElement(React.Fragment, null, props.secondaryAction))))));
2
+ import { filterPassingProps as e, getRootProps as t } from "../../utils/react.js";
3
+ import { addAttributeToChildren as n, cls as r, getBoolean as i } from "../../utils/index.js";
4
+ import "../../shared/constants.js";
5
+ import a from "../button/button.js";
6
+ import o from "../drawer/drawer.js";
7
+ import { isEventTargetNavigationItem as s } from "../../utils/navigation.js";
8
+ import { forwardRef as c, useEffect as l, useRef as u, useState as d } from "react";
9
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
+ //#region src/components/header/header.tsx
11
+ function h(c, h) {
12
+ let g = h || u(h), [_, v] = d(() => !1), [y, b] = d(() => !1);
13
+ function x(e) {
14
+ e && e.stopPropagation && e.stopPropagation();
15
+ let t = !i(c.drawerOpen, "drawerOpen");
16
+ c.onToggle && c.onToggle(t);
17
+ }
18
+ function S(e) {
19
+ s(e) && x();
20
+ }
21
+ return l(() => {
22
+ v(!0);
23
+ }, []), l(() => {
24
+ _ && g.current && c.forceMobile && (n(g.current, {
25
+ key: "data-force-mobile",
26
+ value: "true"
27
+ }), b(!0));
28
+ }, [_, g.current]), /* @__PURE__ */ m("header", {
29
+ ref: g,
30
+ ...e(c, [
31
+ "data-icon-variant",
32
+ "data-icon-variant-before",
33
+ "data-icon-variant-after",
34
+ "data-icon-weight",
35
+ "data-icon-weight-before",
36
+ "data-icon-weight-after",
37
+ "data-interactive",
38
+ "data-force-mobile",
39
+ "data-color",
40
+ "data-container-color",
41
+ "data-bg-color",
42
+ "data-on-bg-color",
43
+ "data-color-scheme",
44
+ "data-font-size",
45
+ "data-headline-size",
46
+ "data-divider",
47
+ "data-focus",
48
+ "data-font",
49
+ "data-density",
50
+ "onToggle"
51
+ ]),
52
+ ...t(c, [
53
+ "data-icon-variant",
54
+ "data-icon-variant-before",
55
+ "data-icon-variant-after",
56
+ "data-icon-weight",
57
+ "data-icon-weight-before",
58
+ "data-icon-weight-after",
59
+ "data-interactive",
60
+ "data-force-mobile",
61
+ "data-color",
62
+ "data-container-color",
63
+ "data-bg-color",
64
+ "data-on-bg-color",
65
+ "data-color-scheme",
66
+ "data-font-size",
67
+ "data-headline-size",
68
+ "data-divider",
69
+ "data-focus",
70
+ "data-font",
71
+ "data-density"
72
+ ]),
73
+ className: r("db-header", c.className),
74
+ id: c.id ?? c.propOverrides?.id,
75
+ "data-width": c.width,
76
+ "data-on-forcing-mobile": c.forceMobile && !y,
77
+ children: [
78
+ /* @__PURE__ */ p("div", {
79
+ className: "db-header-meta-navigation",
80
+ children: /* @__PURE__ */ p(f, { children: c.metaNavigation })
81
+ }),
82
+ /* @__PURE__ */ m("div", {
83
+ className: "db-header-navigation-bar",
84
+ children: [
85
+ /* @__PURE__ */ p("div", {
86
+ className: "db-header-brand-container",
87
+ children: /* @__PURE__ */ p(f, { children: c.brand })
88
+ }),
89
+ /* @__PURE__ */ m("div", {
90
+ className: "db-header-navigation-container",
91
+ children: [/* @__PURE__ */ p("div", {
92
+ className: "db-header-navigation",
93
+ children: c.children
94
+ }), /* @__PURE__ */ p("div", {
95
+ className: "db-header-primary-action",
96
+ children: /* @__PURE__ */ p(f, { children: c.primaryAction })
97
+ })]
98
+ }),
99
+ /* @__PURE__ */ m("div", {
100
+ className: "db-header-action-container",
101
+ children: [/* @__PURE__ */ p("div", {
102
+ className: "db-header-burger-menu-container",
103
+ children: /* @__PURE__ */ p(a, {
104
+ icon: "menu",
105
+ variant: "ghost",
106
+ noText: !0,
107
+ onClick: (e) => x(),
108
+ children: c.burgerMenuLabel ?? "BurgerMenu"
109
+ })
110
+ }), /* @__PURE__ */ p("div", {
111
+ className: "db-header-secondary-action",
112
+ children: /* @__PURE__ */ p(f, { children: c.secondaryAction })
113
+ })]
114
+ })
115
+ ]
116
+ }),
117
+ /* @__PURE__ */ m(o, {
118
+ className: "db-header-drawer",
119
+ spacing: "small",
120
+ rounded: !0,
121
+ closeButtonId: c.closeButtonId,
122
+ closeButtonText: c.closeButtonText,
123
+ open: i(c.drawerOpen),
124
+ onClose: (e) => x(),
125
+ children: [/* @__PURE__ */ m("div", {
126
+ className: "db-header-drawer-navigation",
127
+ children: [/* @__PURE__ */ p("div", {
128
+ className: "db-header-navigation",
129
+ onClick: (e) => S(e),
130
+ children: c.children
131
+ }), /* @__PURE__ */ p("div", {
132
+ className: "db-header-meta-navigation",
133
+ children: /* @__PURE__ */ p(f, { children: c.metaNavigation })
134
+ })]
135
+ }), /* @__PURE__ */ p("div", {
136
+ className: "db-header-secondary-action",
137
+ children: /* @__PURE__ */ p(f, { children: c.secondaryAction })
138
+ })]
139
+ })
140
+ ]
141
+ });
65
142
  }
66
- const DBHeader = forwardRef(DBHeaderFn);
67
- export default DBHeader;
143
+ var g = c(h);
144
+ //#endregion
145
+ export { g as default };
@@ -1 +1 @@
1
- export { default as DBHeader } from './header';
1
+ export { default as DBHeader } from './header.js';
@@ -1,4 +1,4 @@
1
- import type { ContainerWidthProps, GlobalProps, GlobalState, InitializedState, InnerCloseButtonProps, NavigationBehaviorState, ToggleEventProps, ToggleEventState } from '../../shared/model';
1
+ import type { ContainerWidthProps, GlobalProps, GlobalState, InitializedState, InnerCloseButtonProps, NavigationBehaviorState, ToggleEventProps, ToggleEventState } from '../../shared/model.js';
2
2
  export type DBHeaderDefaultProps = {
3
3
  /**
4
4
  * Slot to pass in the DBBrand component
@@ -1,3 +1,3 @@
1
1
  import * as React from "react";
2
- declare const DBIcon: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | "text" | "icon" | keyof import("./model").DBIconDefaultProps> & import("./model").DBIconDefaultProps & import("../..").GlobalProps & import("../..").IconProps & import("../..").TextProps & React.RefAttributes<any>>;
2
+ declare const DBIcon: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../index.js").GlobalProps | "text" | "icon" | keyof import("./model.js").DBIconDefaultProps> & import("./model.js").DBIconDefaultProps & import("../../index.js").GlobalProps & import("../../index.js").IconProps & import("../../index.js").TextProps & React.RefAttributes<any>>;
3
3
  export default DBIcon;
@@ -1,14 +1,63 @@
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 DBIconFn(props, component) {
7
- var _a, _b;
8
- const _ref = component || useRef(component);
9
- return (React.createElement("span", Object.assign({ "aria-hidden": "true", 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-icon", props.className), "data-icon": props.icon, "data-icon-weight": props.weight, "data-icon-variant": props.variant }),
10
- props.text ? React.createElement(React.Fragment, null, props.text) : null,
11
- 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 { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ //#region src/components/icon/icon.tsx
7
+ function c(r, c) {
8
+ return /* @__PURE__ */ s("span", {
9
+ "aria-hidden": "true",
10
+ ref: c || i(c),
11
+ ...e(r, [
12
+ "data-icon-variant",
13
+ "data-icon-variant-before",
14
+ "data-icon-variant-after",
15
+ "data-icon-weight",
16
+ "data-icon-weight-before",
17
+ "data-icon-weight-after",
18
+ "data-interactive",
19
+ "data-force-mobile",
20
+ "data-color",
21
+ "data-container-color",
22
+ "data-bg-color",
23
+ "data-on-bg-color",
24
+ "data-color-scheme",
25
+ "data-font-size",
26
+ "data-headline-size",
27
+ "data-divider",
28
+ "data-focus",
29
+ "data-font",
30
+ "data-density"
31
+ ]),
32
+ id: r.id ?? r.propOverrides?.id,
33
+ ...t(r, [
34
+ "data-icon-variant",
35
+ "data-icon-variant-before",
36
+ "data-icon-variant-after",
37
+ "data-icon-weight",
38
+ "data-icon-weight-before",
39
+ "data-icon-weight-after",
40
+ "data-interactive",
41
+ "data-force-mobile",
42
+ "data-color",
43
+ "data-container-color",
44
+ "data-bg-color",
45
+ "data-on-bg-color",
46
+ "data-color-scheme",
47
+ "data-font-size",
48
+ "data-headline-size",
49
+ "data-divider",
50
+ "data-focus",
51
+ "data-font",
52
+ "data-density"
53
+ ]),
54
+ className: n("db-icon", r.className),
55
+ "data-icon": r.icon,
56
+ "data-icon-weight": r.weight,
57
+ "data-icon-variant": r.variant,
58
+ children: [r.text ? /* @__PURE__ */ o(a, { children: r.text }) : null, r.children]
59
+ });
12
60
  }
13
- const DBIcon = forwardRef(DBIconFn);
14
- export default DBIcon;
61
+ var l = r(c);
62
+ //#endregion
63
+ export { l as default };
@@ -1 +1 @@
1
- export { default as DBIcon } from './icon';
1
+ export { default as DBIcon } from './icon.js';
@@ -1,4 +1,4 @@
1
- import type { GlobalProps, GlobalState, IconProps, TextProps } from '../../shared/model';
1
+ import type { GlobalProps, GlobalState, IconProps, TextProps } from '../../shared/model.js';
2
2
  export declare const IconWeightList: readonly ["16", "20", "24", "32", "48", "64"];
3
3
  export type IconWeightType = (typeof IconWeightList)[number];
4
4
  export type DBIconDefaultProps = {
@@ -1 +1,11 @@
1
- export const IconWeightList = ['16', '20', '24', '32', '48', '64'];
1
+ //#region src/components/icon/model.ts
2
+ var e = [
3
+ "16",
4
+ "20",
5
+ "24",
6
+ "32",
7
+ "48",
8
+ "64"
9
+ ];
10
+ //#endregion
11
+ export { e as IconWeightList };
@@ -1 +1 @@
1
- export { default as DBInfotext } from './infotext';
1
+ export { default as DBInfotext } from './infotext.js';
@@ -1,3 +1,3 @@
1
1
  import * as React from "react";
2
- declare const DBInfotext: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | "semantic" | "text" | "size" | "wrap" | "icon" | "showIcon"> & import("../..").GlobalProps & import("../..").SemanticProps & import("../..").IconProps & import("../..").SizeProps & import("../..").ShowIconProps & import("../..").TextProps & import("../..").WrapProps & React.RefAttributes<any>>;
2
+ declare const DBInfotext: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../index.js").GlobalProps | "semantic" | "text" | "size" | "wrap" | "icon" | "showIcon"> & import("../../index.js").GlobalProps & import("../../index.js").SemanticProps & import("../../index.js").IconProps & import("../../index.js").SizeProps & import("../../index.js").ShowIconProps & import("../../index.js").TextProps & import("../../index.js").WrapProps & React.RefAttributes<any>>;
3
3
  export default DBInfotext;