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

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,159 +1,165 @@
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_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
6
- import { cls, delay, getBoolean, getHideProp, hasVoiceOver, stringPropVisible, } from "../../utils";
7
- import { addCheckedResetEventListener, } from "../../utils/form-components";
8
- import DBInfotext from "../infotext/infotext";
9
- import { useId } from "react";
10
- function DBCheckboxFn(props, component) {
11
- var _a, _b;
12
- const uuid = useId();
13
- const _ref = component || useRef(component);
14
- const [initialized, setInitialized] = useState(() => false);
15
- const [_id, set_id] = useState(() => undefined);
16
- const [_messageId, set_messageId] = useState(() => undefined);
17
- const [_validMessageId, set_validMessageId] = useState(() => undefined);
18
- const [_invalidMessageId, set_invalidMessageId] = useState(() => undefined);
19
- const [_invalidMessage, set_invalidMessage] = useState(() => undefined);
20
- const [_descByIds, set_descByIds] = useState(() => undefined);
21
- const [_voiceOverFallback, set_voiceOverFallback] = useState(() => "");
22
- const [abortController, setAbortController] = useState(() => undefined);
23
- function hasValidState() {
24
- var _a;
25
- return !!((_a = props.validMessage) !== null && _a !== void 0 ? _a : props.validation === "valid");
26
- }
27
- function handleValidation() {
28
- var _a, _b, _c, _d;
29
- /* For a11y reasons we need to map the correct message with the checkbox */
30
- if (!((_a = _ref.current) === null || _a === void 0 ? void 0 : _a.validity.valid) || props.validation === "invalid") {
31
- set_descByIds(_invalidMessageId);
32
- set_invalidMessage(props.invalidMessage ||
33
- ((_b = _ref.current) === null || _b === void 0 ? void 0 : _b.validationMessage) ||
34
- DEFAULT_INVALID_MESSAGE);
35
- if (hasVoiceOver()) {
36
- set_voiceOverFallback(_invalidMessage);
37
- delay(() => set_voiceOverFallback(""), 1000);
38
- }
39
- }
40
- else if (hasValidState() &&
41
- ((_c = _ref.current) === null || _c === void 0 ? void 0 : _c.validity.valid) &&
42
- props.required) {
43
- set_descByIds(_validMessageId);
44
- if (hasVoiceOver()) {
45
- set_voiceOverFallback((_d = props.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE);
46
- delay(() => set_voiceOverFallback(""), 1000);
47
- }
48
- }
49
- else if (stringPropVisible(props.message, props.showMessage)) {
50
- set_descByIds(_messageId);
51
- }
52
- else {
53
- set_descByIds(undefined);
54
- }
55
- }
56
- function handleChange(event, reset) {
57
- if (props.onChange) {
58
- props.onChange(event);
59
- }
60
- handleValidation();
61
- }
62
- function handleBlur(event) {
63
- if (props.onBlur) {
64
- props.onBlur(event);
65
- }
66
- }
67
- function handleFocus(event) {
68
- if (props.onFocus) {
69
- props.onFocus(event);
70
- }
71
- }
72
- function resetIds() {
73
- var _a, _b, _c;
74
- const mId = (_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 : `checkbox-${uuid}`;
75
- set_id(mId);
76
- set_messageId(mId + DEFAULT_MESSAGE_ID_SUFFIX);
77
- set_validMessageId(mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX);
78
- set_invalidMessageId(mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX);
79
- }
80
- useEffect(() => {
81
- setInitialized(true);
82
- resetIds();
83
- set_invalidMessage(props.invalidMessage || DEFAULT_INVALID_MESSAGE);
84
- }, []);
85
- useEffect(() => {
86
- var _a, _b;
87
- if ((_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) {
88
- resetIds();
89
- }
90
- }, [props.id, (_a = props.propOverrides) === null || _a === void 0 ? void 0 : _a.id]);
91
- useEffect(() => {
92
- var _a;
93
- set_invalidMessage(props.invalidMessage ||
94
- ((_a = _ref.current) === null || _a === void 0 ? void 0 : _a.validationMessage) ||
95
- DEFAULT_INVALID_MESSAGE);
96
- }, [_ref.current, props.invalidMessage]);
97
- useEffect(() => {
98
- if (_id) {
99
- const messageId = _id + DEFAULT_MESSAGE_ID_SUFFIX;
100
- set_messageId(messageId);
101
- set_validMessageId(_id + DEFAULT_VALID_MESSAGE_ID_SUFFIX);
102
- set_invalidMessageId(_id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX);
103
- if (stringPropVisible(props.message, props.showMessage)) {
104
- set_descByIds(messageId);
105
- }
106
- handleValidation();
107
- }
108
- }, [_id]);
109
- useEffect(() => {
110
- if (_ref.current) {
111
- if (props.indeterminate !== undefined) {
112
- // When indeterminate is set, the value of the checked prop only impacts the form submitted values.
113
- // It has no accessibility or UX implications. (https://mui.com/material-ui/react-checkbox/)
114
- _ref.current.indeterminate = !!getBoolean(props.indeterminate);
115
- }
116
- }
117
- }, [initialized, _ref.current, props.indeterminate]);
118
- useEffect(() => {
119
- if (initialized && _ref.current) {
120
- // in angular this must be set via native element
121
- if (props.checked != undefined) {
122
- _ref.current.checked = !!getBoolean(props.checked);
123
- }
124
- setInitialized(false);
125
- }
126
- }, [initialized, _ref.current, props.checked]);
127
- useEffect(() => {
128
- if (_ref.current) {
129
- const defaultChecked = props.defaultChecked;
130
- let controller = abortController;
131
- if (!controller) {
132
- controller = new AbortController();
133
- setAbortController(controller);
134
- }
135
- addCheckedResetEventListener(_ref.current, {
136
- checked: props.checked,
137
- defaultChecked,
138
- }, (event) => {
139
- handleChange(event, true);
140
- }, controller.signal);
141
- }
142
- }, [_ref.current]);
143
- useEffect(() => {
144
- return () => {
145
- abortController === null || abortController === void 0 ? void 0 : abortController.abort();
146
- };
147
- }, []);
148
- return (React.createElement("div", Object.assign({}, 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-checkbox", props.className), "data-size": props.size, "data-hide-asterisk": getHideProp(props.showRequiredAsterisk), "data-hide-label": getHideProp(props.showLabel) }),
149
- React.createElement("label", { htmlFor: _id },
150
- React.createElement("input", Object.assign({ type: "checkbox", "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"), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), "aria-describedby": (_b = props.ariaDescribedBy) !== null && _b !== void 0 ? _b : _descByIds })),
151
- props.label ? React.createElement(React.Fragment, null, props.label) : null,
152
- props.children),
153
- stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
154
- hasValidState() ? (React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, props.validMessage || DEFAULT_VALID_MESSAGE)) : null,
155
- React.createElement(DBInfotext, { size: "small", semantic: "critical", id: _invalidMessageId }, _invalidMessage),
156
- React.createElement("span", { "data-visually-hidden": "true", role: "status" }, _voiceOverFallback)));
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, hasVoiceOver as o, stringPropVisible as s } from "../../utils/index.js";
4
+ import { DEFAULT_INVALID_MESSAGE_ID_SUFFIX as c, DEFAULT_MESSAGE_ID_SUFFIX as l, DEFAULT_VALID_MESSAGE_ID_SUFFIX as u } from "../../shared/constants.js";
5
+ import { addCheckedResetEventListener as d } from "../../utils/form-components.js";
6
+ import f from "../infotext/infotext.js";
7
+ import { forwardRef as p, useEffect as m, useId as h, useRef as g, useState as _ } from "react";
8
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
9
+ //#region src/components/checkbox/checkbox.tsx
10
+ function x(p, x) {
11
+ let S = h(), C = x || g(x), [w, T] = _(() => !1), [E, D] = _(() => void 0), [O, k] = _(() => void 0), [A, j] = _(() => void 0), [M, N] = _(() => void 0), [P, F] = _(() => void 0), [I, L] = _(() => void 0), [R, z] = _(() => ""), [B, V] = _(() => void 0);
12
+ function H() {
13
+ return !!(p.validMessage ?? p.validation === "valid");
14
+ }
15
+ function U() {
16
+ !C.current?.validity.valid || p.validation === "invalid" ? (L(M), F(p.invalidMessage || C.current?.validationMessage || "TODO: Add an invalidMessage"), o() && (z(P), r(() => z(""), 1e3))) : H() && C.current?.validity.valid && p.required ? (L(A), o() && (z(p.validMessage ?? "TODO: Add a validMessage"), r(() => z(""), 1e3))) : s(p.message, p.showMessage) ? L(O) : L(void 0);
17
+ }
18
+ function W(e, t) {
19
+ p.onChange && p.onChange(e), U();
20
+ }
21
+ function G(e) {
22
+ p.onBlur && p.onBlur(e);
23
+ }
24
+ function K(e) {
25
+ p.onFocus && p.onFocus(e);
26
+ }
27
+ function q() {
28
+ let e = p.id ?? p.propOverrides?.id ?? `checkbox-${S}`;
29
+ D(e), k(e + l), j(e + u), N(e + c);
30
+ }
31
+ return m(() => {
32
+ T(!0), q(), F(p.invalidMessage || "TODO: Add an invalidMessage");
33
+ }, []), m(() => {
34
+ (p.id ?? p.propOverrides?.id) && q();
35
+ }, [p.id, p.propOverrides?.id]), m(() => {
36
+ F(p.invalidMessage || C.current?.validationMessage || "TODO: Add an invalidMessage");
37
+ }, [C.current, p.invalidMessage]), m(() => {
38
+ if (E) {
39
+ let e = E + l;
40
+ k(e), j(E + u), N(E + c), s(p.message, p.showMessage) && L(e), U();
41
+ }
42
+ }, [E]), m(() => {
43
+ C.current && p.indeterminate !== void 0 && (C.current.indeterminate = !!i(p.indeterminate));
44
+ }, [
45
+ w,
46
+ C.current,
47
+ p.indeterminate
48
+ ]), m(() => {
49
+ w && C.current && (p.checked != null && (C.current.checked = !!i(p.checked)), T(!1));
50
+ }, [
51
+ w,
52
+ C.current,
53
+ p.checked
54
+ ]), m(() => {
55
+ if (C.current) {
56
+ let e = p.defaultChecked, t = B;
57
+ t || (t = new AbortController(), V(t)), d(C.current, {
58
+ checked: p.checked,
59
+ defaultChecked: e
60
+ }, (e) => {
61
+ W(e, !0);
62
+ }, t.signal);
63
+ }
64
+ }, [C.current]), m(() => () => {
65
+ B?.abort();
66
+ }, []), /* @__PURE__ */ b("div", {
67
+ ...t(p, [
68
+ "data-icon-variant",
69
+ "data-icon-variant-before",
70
+ "data-icon-variant-after",
71
+ "data-icon-weight",
72
+ "data-icon-weight-before",
73
+ "data-icon-weight-after",
74
+ "data-interactive",
75
+ "data-force-mobile",
76
+ "data-color",
77
+ "data-container-color",
78
+ "data-bg-color",
79
+ "data-on-bg-color",
80
+ "data-color-scheme",
81
+ "data-font-size",
82
+ "data-headline-size",
83
+ "data-divider",
84
+ "data-focus",
85
+ "data-font",
86
+ "data-density"
87
+ ]),
88
+ className: n("db-checkbox", p.className),
89
+ "data-size": p.size,
90
+ "data-hide-asterisk": a(p.showRequiredAsterisk),
91
+ "data-hide-label": a(p.showLabel),
92
+ children: [
93
+ /* @__PURE__ */ b("label", {
94
+ htmlFor: E,
95
+ children: [
96
+ /* @__PURE__ */ y("input", {
97
+ type: "checkbox",
98
+ "aria-invalid": p.validation === "invalid",
99
+ "data-custom-validity": p.validation,
100
+ ref: C,
101
+ ...e(p, [
102
+ "data-icon-variant",
103
+ "data-icon-variant-before",
104
+ "data-icon-variant-after",
105
+ "data-icon-weight",
106
+ "data-icon-weight-before",
107
+ "data-icon-weight-after",
108
+ "data-interactive",
109
+ "data-force-mobile",
110
+ "data-color",
111
+ "data-container-color",
112
+ "data-bg-color",
113
+ "data-on-bg-color",
114
+ "data-color-scheme",
115
+ "data-font-size",
116
+ "data-headline-size",
117
+ "data-divider",
118
+ "data-focus",
119
+ "data-font",
120
+ "data-density"
121
+ ]),
122
+ id: E,
123
+ name: p.name,
124
+ checked: i(p.checked, "checked"),
125
+ disabled: i(p.disabled, "disabled"),
126
+ value: p.value,
127
+ required: i(p.required, "required"),
128
+ onChange: (e) => W(e),
129
+ onBlur: (e) => G(e),
130
+ onFocus: (e) => K(e),
131
+ "aria-describedby": p.ariaDescribedBy ?? I
132
+ }),
133
+ p.label ? /* @__PURE__ */ y(v, { children: p.label }) : null,
134
+ p.children
135
+ ]
136
+ }),
137
+ s(p.message, p.showMessage) ? /* @__PURE__ */ y(f, {
138
+ size: "small",
139
+ icon: p.messageIcon,
140
+ id: O,
141
+ children: p.message
142
+ }) : null,
143
+ H() ? /* @__PURE__ */ y(f, {
144
+ size: "small",
145
+ semantic: "successful",
146
+ id: A,
147
+ children: p.validMessage || "TODO: Add a validMessage"
148
+ }) : null,
149
+ /* @__PURE__ */ y(f, {
150
+ size: "small",
151
+ semantic: "critical",
152
+ id: M,
153
+ children: P
154
+ }),
155
+ /* @__PURE__ */ y("span", {
156
+ "data-visually-hidden": "true",
157
+ role: "status",
158
+ children: R
159
+ })
160
+ ]
161
+ });
157
162
  }
158
- const DBCheckbox = forwardRef(DBCheckboxFn);
159
- export default DBCheckbox;
163
+ var S = p(x);
164
+ //#endregion
165
+ export { S as default };
@@ -1,12 +1,67 @@
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, getBooleanAsString } from "../../utils";
6
- function DBCustomButtonFn(props, component) {
7
- var _a, _b, _c, _d;
8
- const _ref = component || useRef(component);
9
- 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-custom-button", props.className), "data-icon": (_c = props.iconLeading) !== null && _c !== void 0 ? _c : props.icon, "data-show-icon": getBooleanAsString((_d = props.showIconLeading) !== null && _d !== void 0 ? _d : props.showIcon), "data-icon-trailing": props.iconTrailing, "data-show-icon-trailing": getBooleanAsString(props.showIconTrailing), "data-size": props.size, "data-width": props.width, "data-variant": props.variant, "data-no-text": getBooleanAsString(props.noText) }), props.children));
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, useRef as a } from "react";
5
+ import { jsx as o } from "react/jsx-runtime";
6
+ //#region src/components/custom-button/custom-button.tsx
7
+ function s(i, s) {
8
+ return /* @__PURE__ */ o("div", {
9
+ ref: s || a(s),
10
+ ...e(i, [
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: i.id ?? i.propOverrides?.id,
32
+ ...t(i, [
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-custom-button", i.className),
54
+ "data-icon": i.iconLeading ?? i.icon,
55
+ "data-show-icon": r(i.showIconLeading ?? i.showIcon),
56
+ "data-icon-trailing": i.iconTrailing,
57
+ "data-show-icon-trailing": r(i.showIconTrailing),
58
+ "data-size": i.size,
59
+ "data-width": i.width,
60
+ "data-variant": i.variant,
61
+ "data-no-text": r(i.noText),
62
+ children: i.children
63
+ });
10
64
  }
11
- const DBCustomButton = forwardRef(DBCustomButtonFn);
12
- export default DBCustomButton;
65
+ var c = i(s);
66
+ //#endregion
67
+ export { c as default };