@db-ux/react-core-components 4.9.1 → 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 (131) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +97 -35
  3. package/dist/components/accordion/accordion.js +102 -86
  4. package/dist/components/accordion/model.js +4 -2
  5. package/dist/components/accordion-item/accordion-item.d.ts +2 -1
  6. package/dist/components/accordion-item/accordion-item.js +89 -56
  7. package/dist/components/accordion-item/model.d.ts +4 -0
  8. package/dist/components/badge/badge.js +72 -32
  9. package/dist/components/badge/model.js +12 -1
  10. package/dist/components/brand/brand.js +60 -13
  11. package/dist/components/button/button.js +75 -21
  12. package/dist/components/button/model.js +13 -2
  13. package/dist/components/card/card.js +65 -15
  14. package/dist/components/card/model.js +8 -2
  15. package/dist/components/checkbox/checkbox.js +163 -157
  16. package/dist/components/custom-button/custom-button.js +65 -10
  17. package/dist/components/custom-select/custom-select.js +509 -727
  18. package/dist/components/custom-select/model.js +8 -1
  19. package/dist/components/custom-select-dropdown/custom-select-dropdown.js +62 -11
  20. package/dist/components/custom-select-dropdown/model.js +8 -1
  21. package/dist/components/custom-select-form-field/custom-select-form-field.js +57 -10
  22. package/dist/components/custom-select-list/custom-select-list.js +60 -11
  23. package/dist/components/custom-select-list-item/custom-select-list-item.js +89 -32
  24. package/dist/components/custom-select-list-item/model.js +4 -1
  25. package/dist/components/divider/divider.js +60 -10
  26. package/dist/components/divider/model.js +4 -2
  27. package/dist/components/drawer/drawer.js +118 -97
  28. package/dist/components/drawer/model.js +14 -4
  29. package/dist/components/header/header.js +143 -65
  30. package/dist/components/icon/icon.js +61 -12
  31. package/dist/components/icon/model.js +11 -1
  32. package/dist/components/infotext/infotext.js +62 -12
  33. package/dist/components/input/input.js +198 -167
  34. package/dist/components/input/model.js +21 -5
  35. package/dist/components/link/link.js +70 -12
  36. package/dist/components/link/model.js +8 -3
  37. package/dist/components/navigation/navigation.js +57 -11
  38. package/dist/components/navigation-item/model.d.ts +4 -0
  39. package/dist/components/navigation-item/navigation-item.js +117 -81
  40. package/dist/components/notification/model.js +12 -3
  41. package/dist/components/notification/notification.js +100 -32
  42. package/dist/components/page/model.js +4 -2
  43. package/dist/components/page/page.js +74 -46
  44. package/dist/components/popover/popover.js +126 -125
  45. package/dist/components/radio/radio.js +124 -85
  46. package/dist/components/section/section.js +59 -10
  47. package/dist/components/select/select.js +188 -191
  48. package/dist/components/stack/model.js +14 -4
  49. package/dist/components/stack/stack.js +63 -10
  50. package/dist/components/switch/switch.js +182 -150
  51. package/dist/components/tab-item/tab-item.js +105 -76
  52. package/dist/components/tab-list/tab-list.js +60 -11
  53. package/dist/components/tab-panel/tab-panel.js +59 -13
  54. package/dist/components/tabs/model.js +4 -2
  55. package/dist/components/tabs/tabs.js +191 -178
  56. package/dist/components/tag/model.js +4 -1
  57. package/dist/components/tag/tag.js +91 -32
  58. package/dist/components/textarea/model.js +13 -2
  59. package/dist/components/textarea/textarea.js +165 -150
  60. package/dist/components/tooltip/model.js +4 -1
  61. package/dist/components/tooltip/tooltip.js +119 -115
  62. package/dist/index.js +64 -81
  63. package/dist/shared/constants.js +32 -94
  64. package/dist/shared/figma.d.ts +12 -6
  65. package/dist/shared/model.js +73 -22
  66. package/dist/utils/document-click-listener.js +26 -29
  67. package/dist/utils/document-scroll-listener.js +30 -38
  68. package/dist/utils/floating-components.js +107 -358
  69. package/dist/utils/form-components.js +34 -60
  70. package/dist/utils/index.js +49 -167
  71. package/dist/utils/navigation.js +68 -135
  72. package/dist/utils/react.js +10 -15
  73. package/package.json +11 -8
  74. package/dist/components/accordion/index.js +0 -1
  75. package/dist/components/accordion-item/index.js +0 -1
  76. package/dist/components/accordion-item/model.js +0 -1
  77. package/dist/components/badge/index.js +0 -1
  78. package/dist/components/brand/index.js +0 -1
  79. package/dist/components/brand/model.js +0 -1
  80. package/dist/components/button/index.js +0 -1
  81. package/dist/components/card/index.js +0 -1
  82. package/dist/components/checkbox/index.js +0 -1
  83. package/dist/components/checkbox/model.js +0 -1
  84. package/dist/components/custom-button/index.js +0 -1
  85. package/dist/components/custom-button/model.js +0 -1
  86. package/dist/components/custom-select/index.js +0 -1
  87. package/dist/components/custom-select-dropdown/index.js +0 -1
  88. package/dist/components/custom-select-form-field/index.js +0 -1
  89. package/dist/components/custom-select-form-field/model.js +0 -1
  90. package/dist/components/custom-select-list/index.js +0 -1
  91. package/dist/components/custom-select-list/model.js +0 -1
  92. package/dist/components/custom-select-list-item/index.js +0 -1
  93. package/dist/components/divider/index.js +0 -1
  94. package/dist/components/drawer/index.js +0 -1
  95. package/dist/components/header/index.js +0 -1
  96. package/dist/components/header/model.js +0 -1
  97. package/dist/components/icon/index.js +0 -1
  98. package/dist/components/infotext/index.js +0 -1
  99. package/dist/components/infotext/model.js +0 -1
  100. package/dist/components/input/index.js +0 -1
  101. package/dist/components/link/index.js +0 -1
  102. package/dist/components/navigation/index.js +0 -1
  103. package/dist/components/navigation/model.js +0 -1
  104. package/dist/components/navigation-item/index.js +0 -1
  105. package/dist/components/navigation-item/model.js +0 -1
  106. package/dist/components/notification/index.js +0 -1
  107. package/dist/components/page/index.js +0 -1
  108. package/dist/components/popover/index.js +0 -1
  109. package/dist/components/popover/model.js +0 -1
  110. package/dist/components/radio/index.js +0 -1
  111. package/dist/components/radio/model.js +0 -1
  112. package/dist/components/section/index.js +0 -1
  113. package/dist/components/section/model.js +0 -1
  114. package/dist/components/select/index.js +0 -1
  115. package/dist/components/select/model.js +0 -1
  116. package/dist/components/stack/index.js +0 -1
  117. package/dist/components/switch/index.js +0 -1
  118. package/dist/components/switch/model.js +0 -1
  119. package/dist/components/tab-item/index.js +0 -1
  120. package/dist/components/tab-item/model.js +0 -1
  121. package/dist/components/tab-list/index.js +0 -1
  122. package/dist/components/tab-list/model.js +0 -1
  123. package/dist/components/tab-panel/index.js +0 -1
  124. package/dist/components/tab-panel/model.js +0 -1
  125. package/dist/components/tabs/index.js +0 -1
  126. package/dist/components/tag/index.js +0 -1
  127. package/dist/components/textarea/index.js +0 -1
  128. package/dist/components/tooltip/index.js +0 -1
  129. package/dist/shared/examples/index.js +0 -4
  130. package/dist/shared/figma.js +0 -1
  131. package/dist/shared/showcase/show-code-link.js +0 -51
@@ -1,127 +1,128 @@
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, delay as utilsDelay } from "../../utils";
6
- import { DocumentScrollListener } from "../../utils/document-scroll-listener";
7
- import { handleFixedPopover } from "../../utils/floating-components";
8
- function DBPopoverFn(props, component) {
9
- var _a, _b, _c;
10
- const _ref = component || useRef(component);
11
- const [initialized, setInitialized] = useState(() => false);
12
- const [isExpanded, setIsExpanded] = useState(() => false);
13
- const [_documentScrollListenerCallbackId, set_documentScrollListenerCallbackId,] = useState(() => undefined);
14
- const [_observer, set_observer] = useState(() => undefined);
15
- function handleEscape(event) {
16
- if (!event || event.key === "Escape") {
17
- // TODO: Recursive for any child
18
- for (const child of Array.from(_ref.current.children)) {
19
- child.blur();
20
- }
21
- }
22
- }
23
- function handleAutoPlacement() {
24
- if (!_ref.current)
25
- return;
26
- const article = _ref.current.querySelector("article");
27
- if (article) {
28
- // This is a workaround for angular
29
- void utilsDelay(() => {
30
- var _a;
31
- handleFixedPopover(article, _ref.current, (_a = props.placement) !== null && _a !== void 0 ? _a : "bottom");
32
- }, 1);
33
- }
34
- }
35
- function handleDocumentScroll(event) {
36
- var _a, _b;
37
- if (((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.contains) && ((_b = event === null || event === void 0 ? void 0 : event.target) === null || _b === void 0 ? void 0 : _b.contains(_ref.current))) {
38
- handleAutoPlacement();
39
- }
40
- }
41
- function handleEnter() {
42
- setIsExpanded(true);
43
- set_documentScrollListenerCallbackId(new DocumentScrollListener().addCallback((event) => handleDocumentScroll(event)));
44
- handleAutoPlacement();
45
- const child = getTrigger();
46
- if (child) {
47
- _observer === null || _observer === void 0 ? void 0 : _observer.observe(child);
48
- }
49
- }
50
- function handleLeave(event) {
51
- const element = event === null || event === void 0 ? void 0 : event.target;
52
- const parent = element === null || element === void 0 ? void 0 : element.parentNode;
53
- if (!parent ||
54
- (element.parentNode.querySelector(":focus") !== element &&
55
- element.parentNode.querySelector(":focus-within") !== element &&
56
- element.parentNode.querySelector(":hover") !== element)) {
57
- setIsExpanded(false);
58
- if (_documentScrollListenerCallbackId) {
59
- new DocumentScrollListener().removeCallback(_documentScrollListenerCallbackId);
60
- }
61
- const child = getTrigger();
62
- if (child) {
63
- _observer === null || _observer === void 0 ? void 0 : _observer.unobserve(child);
64
- }
65
- }
66
- }
67
- function getTrigger() {
68
- var _a;
69
- if (_ref.current) {
70
- const children = Array.from(_ref.current.children);
71
- if (children.length >= 2) {
72
- const firstChild = children[0];
73
- if (firstChild.tagName.includes("-")) {
74
- // this is a workaround for custom angular components
75
- return ((_a = firstChild.children) === null || _a === void 0 ? void 0 : _a.length) > 0
76
- ? firstChild.children[0]
77
- : null;
78
- }
79
- else {
80
- return firstChild;
81
- }
82
- }
83
- }
84
- return null;
85
- }
86
- useEffect(() => {
87
- setInitialized(true);
88
- }, []);
89
- useEffect(() => {
90
- if (_ref.current && initialized) {
91
- setInitialized(false);
92
- const child = getTrigger();
93
- if (child) {
94
- child.ariaHasPopup = "true";
95
- }
96
- handleAutoPlacement();
97
- _ref.current.addEventListener("keydown", (event) => handleEscape(event));
98
- ["mouseenter", "focusin"].forEach((event) => {
99
- _ref.current.addEventListener(event, () => handleEnter());
100
- });
101
- ["mouseleave", "focusout"].forEach((event) => {
102
- _ref.current.addEventListener(event, () => handleLeave());
103
- });
104
- if (typeof window !== "undefined" && "IntersectionObserver" in window) {
105
- set_observer(new IntersectionObserver((payload) => {
106
- const entry = payload.find(({ target }) => target === getTrigger());
107
- if (entry && !entry.isIntersecting) {
108
- handleEscape(false);
109
- }
110
- }));
111
- }
112
- }
113
- }, [_ref.current, initialized]);
114
- useEffect(() => {
115
- if (_ref.current) {
116
- const child = getTrigger();
117
- if (child) {
118
- child.ariaExpanded = Boolean(isExpanded).toString();
119
- }
120
- }
121
- }, [_ref.current, isExpanded]);
122
- 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-popover", props.className) }),
123
- React.createElement(React.Fragment, null, props.trigger),
124
- React.createElement("article", { className: "db-popover-content", "data-spacing": props.spacing, "data-gap": getBooleanAsString(props.gap), "data-animation": getBooleanAsString((_c = props.animation) !== null && _c !== void 0 ? _c : true), "data-open": getBooleanAsString(props.open), "data-delay": props.delay, "data-width": props.width, "data-placement": props.placement }, props.children)));
2
+ import { filterPassingProps as e, getRootProps as t } from "../../utils/react.js";
3
+ import { cls as n, delay as r, getBooleanAsString as i } from "../../utils/index.js";
4
+ import { DocumentScrollListener as a } from "../../utils/document-scroll-listener.js";
5
+ import { handleFixedPopover as o } from "../../utils/floating-components.js";
6
+ import { forwardRef as s, useEffect as c, useRef as l, useState as u } from "react";
7
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
+ //#region src/components/popover/popover.tsx
9
+ function m(s, m) {
10
+ let h = m || l(m), [g, _] = u(() => !1), [v, y] = u(() => !1), [b, x] = u(() => void 0), [S, C] = u(() => void 0);
11
+ function w(e) {
12
+ if (!e || e.key === "Escape") for (let e of Array.from(h.current.children)) e.blur();
13
+ }
14
+ function T() {
15
+ if (!h.current) return;
16
+ let e = h.current.querySelector("article");
17
+ e && r(() => {
18
+ o(e, h.current, s.placement ?? "bottom");
19
+ }, 1);
20
+ }
21
+ function E(e) {
22
+ e?.target?.contains && e?.target?.contains(h.current) && T();
23
+ }
24
+ function D() {
25
+ y(!0), x(new a().addCallback((e) => E(e))), T();
26
+ let e = k();
27
+ e && S?.observe(e);
28
+ }
29
+ function O(e) {
30
+ let t = e?.target;
31
+ if (!t?.parentNode || t.parentNode.querySelector(":focus") !== t && t.parentNode.querySelector(":focus-within") !== t && t.parentNode.querySelector(":hover") !== t) {
32
+ y(!1), b && new a().removeCallback(b);
33
+ let e = k();
34
+ e && S?.unobserve(e);
35
+ }
36
+ }
37
+ function k() {
38
+ if (h.current) {
39
+ let e = Array.from(h.current.children);
40
+ if (e.length >= 2) {
41
+ let t = e[0];
42
+ return t.tagName.includes("-") ? t.children?.length > 0 ? t.children[0] : null : t;
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+ return c(() => {
48
+ _(!0);
49
+ }, []), c(() => {
50
+ if (h.current && g) {
51
+ _(!1);
52
+ let e = k();
53
+ e && (e.ariaHasPopup = "true"), T(), h.current.addEventListener("keydown", (e) => w(e)), ["mouseenter", "focusin"].forEach((e) => {
54
+ h.current.addEventListener(e, () => D());
55
+ }), ["mouseleave", "focusout"].forEach((e) => {
56
+ h.current.addEventListener(e, () => O());
57
+ }), typeof window < "u" && "IntersectionObserver" in window && C(new IntersectionObserver((e) => {
58
+ let t = e.find(({ target: e }) => e === k());
59
+ t && !t.isIntersecting && w(!1);
60
+ }));
61
+ }
62
+ }, [h.current, g]), c(() => {
63
+ if (h.current) {
64
+ let e = k();
65
+ e && (e.ariaExpanded = (!!v).toString());
66
+ }
67
+ }, [h.current, v]), /* @__PURE__ */ p("div", {
68
+ ref: h,
69
+ ...e(s, [
70
+ "data-icon-variant",
71
+ "data-icon-variant-before",
72
+ "data-icon-variant-after",
73
+ "data-icon-weight",
74
+ "data-icon-weight-before",
75
+ "data-icon-weight-after",
76
+ "data-interactive",
77
+ "data-force-mobile",
78
+ "data-color",
79
+ "data-container-color",
80
+ "data-bg-color",
81
+ "data-on-bg-color",
82
+ "data-color-scheme",
83
+ "data-font-size",
84
+ "data-headline-size",
85
+ "data-divider",
86
+ "data-focus",
87
+ "data-font",
88
+ "data-density"
89
+ ]),
90
+ id: s.id ?? s.propOverrides?.id,
91
+ ...t(s, [
92
+ "data-icon-variant",
93
+ "data-icon-variant-before",
94
+ "data-icon-variant-after",
95
+ "data-icon-weight",
96
+ "data-icon-weight-before",
97
+ "data-icon-weight-after",
98
+ "data-interactive",
99
+ "data-force-mobile",
100
+ "data-color",
101
+ "data-container-color",
102
+ "data-bg-color",
103
+ "data-on-bg-color",
104
+ "data-color-scheme",
105
+ "data-font-size",
106
+ "data-headline-size",
107
+ "data-divider",
108
+ "data-focus",
109
+ "data-font",
110
+ "data-density"
111
+ ]),
112
+ className: n("db-popover", s.className),
113
+ children: [/* @__PURE__ */ f(d, { children: s.trigger }), /* @__PURE__ */ f("article", {
114
+ className: "db-popover-content",
115
+ "data-spacing": s.spacing,
116
+ "data-gap": i(s.gap),
117
+ "data-animation": i(s.animation ?? !0),
118
+ "data-open": i(s.open),
119
+ "data-delay": s.delay,
120
+ "data-width": s.width,
121
+ "data-placement": s.placement,
122
+ children: s.children
123
+ })]
124
+ });
125
125
  }
126
- const DBPopover = forwardRef(DBPopoverFn);
127
- export default DBPopover;
126
+ var h = s(m);
127
+ //#endregion
128
+ export { h as default };
@@ -1,87 +1,126 @@
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, delay, getBoolean, getHideProp } from "../../utils";
6
- import { addResetEventListener, } from "../../utils/form-components";
7
- import { useId } from "react";
8
- function DBRadioFn(props, component) {
9
- var _a;
10
- const uuid = useId();
11
- const _ref = component || useRef(component);
12
- const [initialized, setInitialized] = useState(() => false);
13
- const [_id, set_id] = useState(() => undefined);
14
- const [abortController, setAbortController] = useState(() => undefined);
15
- function handleInput(event, reset) {
16
- if (props.onInput) {
17
- props.onInput(event);
18
- }
19
- }
20
- function handleChange(event, reset) {
21
- if (props.onChange) {
22
- props.onChange(event);
23
- }
24
- }
25
- function handleBlur(event) {
26
- if (props.onBlur) {
27
- props.onBlur(event);
28
- }
29
- }
30
- function handleFocus(event) {
31
- if (props.onFocus) {
32
- props.onFocus(event);
33
- }
34
- }
35
- function resetIds() {
36
- var _a, _b, _c;
37
- set_id((_c = (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : `radio-${uuid}`);
38
- }
39
- useEffect(() => {
40
- setInitialized(true);
41
- resetIds();
42
- }, []);
43
- useEffect(() => {
44
- var _a, _b;
45
- if ((_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) {
46
- resetIds();
47
- }
48
- }, [props.id, (_a = props.propOverrides) === null || _a === void 0 ? void 0 : _a.id]);
49
- useEffect(() => {
50
- if (props.checked && initialized && _ref.current) {
51
- _ref.current.checked = true;
52
- }
53
- }, [initialized, _ref.current, props.checked]);
54
- useEffect(() => {
55
- if (_ref.current) {
56
- const defaultChecked = props.defaultChecked;
57
- let controller = abortController;
58
- if (!controller) {
59
- controller = new AbortController();
60
- setAbortController(controller);
61
- }
62
- addResetEventListener(_ref.current, (event) => {
63
- void delay(() => {
64
- const resetChecked = props.checked
65
- ? props.checked
66
- : defaultChecked
67
- ? defaultChecked
68
- : _ref.current.checked;
69
- const valueEvent = Object.assign(Object.assign({}, event), { target: Object.assign(Object.assign({}, event.target), { value: "", checked: resetChecked }) });
70
- handleChange(valueEvent, true);
71
- handleInput(valueEvent, true);
72
- }, 1);
73
- }, controller.signal);
74
- }
75
- }, [_ref.current]);
76
- useEffect(() => {
77
- return () => {
78
- abortController === null || abortController === void 0 ? void 0 : abortController.abort();
79
- };
80
- }, []);
81
- return (React.createElement("label", Object.assign({ "data-size": props.size, "data-hide-label": getHideProp(props.showLabel), "data-hide-asterisk": getHideProp(props.showRequiredAsterisk) }, 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-radio", props.className), htmlFor: _id }),
82
- React.createElement("input", Object.assign({ type: "radio", "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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: _id, name: props.name, checked: getBoolean(props.checked, "checked"), disabled: getBoolean(props.disabled, "disabled"), value: props.value, required: getBoolean(props.required, "required"), onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event) })),
83
- props.label ? React.createElement(React.Fragment, null, props.label) : null,
84
- 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, getHideProp as a } from "../../utils/index.js";
4
+ import { addResetEventListener as o } from "../../utils/form-components.js";
5
+ import { forwardRef as s, useEffect as c, useId as l, useRef as u, useState as d } from "react";
6
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ //#region src/components/radio/radio.tsx
8
+ function h(s, h) {
9
+ let g = l(), _ = h || u(h), [v, y] = d(() => !1), [b, x] = d(() => void 0), [S, C] = d(() => void 0);
10
+ function w(e, t) {
11
+ s.onInput && s.onInput(e);
12
+ }
13
+ function T(e, t) {
14
+ s.onChange && s.onChange(e);
15
+ }
16
+ function E(e) {
17
+ s.onBlur && s.onBlur(e);
18
+ }
19
+ function D(e) {
20
+ s.onFocus && s.onFocus(e);
21
+ }
22
+ function O() {
23
+ x(s.id ?? s.propOverrides?.id ?? `radio-${g}`);
24
+ }
25
+ return c(() => {
26
+ y(!0), O();
27
+ }, []), c(() => {
28
+ (s.id ?? s.propOverrides?.id) && O();
29
+ }, [s.id, s.propOverrides?.id]), c(() => {
30
+ s.checked && v && _.current && (_.current.checked = !0);
31
+ }, [
32
+ v,
33
+ _.current,
34
+ s.checked
35
+ ]), c(() => {
36
+ if (_.current) {
37
+ let e = s.defaultChecked, t = S;
38
+ t || (t = new AbortController(), C(t)), o(_.current, (t) => {
39
+ r(() => {
40
+ let n = s.checked ? s.checked : e || _.current.checked, r = {
41
+ ...t,
42
+ target: {
43
+ ...t.target,
44
+ value: "",
45
+ checked: n
46
+ }
47
+ };
48
+ T(r, !0), w(r, !0);
49
+ }, 1);
50
+ }, t.signal);
51
+ }
52
+ }, [_.current]), c(() => () => {
53
+ S?.abort();
54
+ }, []), /* @__PURE__ */ m("label", {
55
+ "data-size": s.size,
56
+ "data-hide-label": a(s.showLabel),
57
+ "data-hide-asterisk": a(s.showRequiredAsterisk),
58
+ ...t(s, [
59
+ "data-icon-variant",
60
+ "data-icon-variant-before",
61
+ "data-icon-variant-after",
62
+ "data-icon-weight",
63
+ "data-icon-weight-before",
64
+ "data-icon-weight-after",
65
+ "data-interactive",
66
+ "data-force-mobile",
67
+ "data-color",
68
+ "data-container-color",
69
+ "data-bg-color",
70
+ "data-on-bg-color",
71
+ "data-color-scheme",
72
+ "data-font-size",
73
+ "data-headline-size",
74
+ "data-divider",
75
+ "data-focus",
76
+ "data-font",
77
+ "data-density"
78
+ ]),
79
+ className: n("db-radio", s.className),
80
+ htmlFor: b,
81
+ children: [
82
+ /* @__PURE__ */ p("input", {
83
+ type: "radio",
84
+ "aria-invalid": s.validation === "invalid",
85
+ "data-custom-validity": s.validation,
86
+ ref: _,
87
+ ...e(s, [
88
+ "data-icon-variant",
89
+ "data-icon-variant-before",
90
+ "data-icon-variant-after",
91
+ "data-icon-weight",
92
+ "data-icon-weight-before",
93
+ "data-icon-weight-after",
94
+ "data-interactive",
95
+ "data-force-mobile",
96
+ "data-color",
97
+ "data-container-color",
98
+ "data-bg-color",
99
+ "data-on-bg-color",
100
+ "data-color-scheme",
101
+ "data-font-size",
102
+ "data-headline-size",
103
+ "data-divider",
104
+ "data-focus",
105
+ "data-font",
106
+ "data-density"
107
+ ]),
108
+ id: b,
109
+ name: s.name,
110
+ checked: i(s.checked, "checked"),
111
+ disabled: i(s.disabled, "disabled"),
112
+ value: s.value,
113
+ required: i(s.required, "required"),
114
+ onInput: (e) => w(e),
115
+ onChange: (e) => T(e),
116
+ onBlur: (e) => E(e),
117
+ onFocus: (e) => D(e)
118
+ }),
119
+ s.label ? /* @__PURE__ */ p(f, { children: s.label }) : null,
120
+ s.children
121
+ ]
122
+ });
85
123
  }
86
- const DBRadio = forwardRef(DBRadioFn);
87
- export default DBRadio;
124
+ var g = s(h);
125
+ //#endregion
126
+ export { g as default };
@@ -1,12 +1,61 @@
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 DBSectionFn(props, component) {
7
- var _a, _b;
8
- const _ref = component || useRef(component);
9
- return (React.createElement("section", 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-section", props.className), "data-spacing": props.spacing || "medium", "data-width": props.width }), 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/section/section.tsx
7
+ function o(r, o) {
8
+ return /* @__PURE__ */ a("section", {
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-section", r.className),
54
+ "data-spacing": r.spacing || "medium",
55
+ "data-width": r.width,
56
+ children: r.children
57
+ });
10
58
  }
11
- const DBSection = forwardRef(DBSectionFn);
12
- export default DBSection;
59
+ var s = r(o);
60
+ //#endregion
61
+ export { s as default };