@db-ux/react-core-components 4.9.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/README.md +97 -35
- package/dist/components/accordion/accordion.js +102 -86
- package/dist/components/accordion/model.d.ts +2 -2
- package/dist/components/accordion/model.js +4 -2
- package/dist/components/accordion-item/accordion-item.d.ts +2 -1
- package/dist/components/accordion-item/accordion-item.js +89 -56
- package/dist/components/accordion-item/model.d.ts +5 -1
- package/dist/components/badge/badge.js +72 -32
- package/dist/components/badge/model.d.ts +1 -1
- package/dist/components/badge/model.js +12 -1
- package/dist/components/brand/brand.js +60 -13
- package/dist/components/brand/model.d.ts +1 -1
- package/dist/components/button/button.js +75 -21
- package/dist/components/button/model.d.ts +1 -1
- package/dist/components/button/model.js +13 -2
- package/dist/components/card/card.js +65 -15
- package/dist/components/card/model.d.ts +1 -1
- package/dist/components/card/model.js +8 -2
- package/dist/components/checkbox/checkbox.js +163 -157
- package/dist/components/checkbox/model.d.ts +1 -1
- package/dist/components/custom-button/custom-button.js +65 -10
- package/dist/components/custom-button/model.d.ts +2 -2
- package/dist/components/custom-select/custom-select.js +509 -727
- package/dist/components/custom-select/model.d.ts +4 -4
- package/dist/components/custom-select/model.js +8 -1
- package/dist/components/custom-select-dropdown/custom-select-dropdown.js +62 -11
- package/dist/components/custom-select-dropdown/model.d.ts +1 -1
- package/dist/components/custom-select-dropdown/model.js +8 -1
- package/dist/components/custom-select-form-field/custom-select-form-field.js +57 -10
- package/dist/components/custom-select-form-field/model.d.ts +1 -1
- package/dist/components/custom-select-list/custom-select-list.js +60 -11
- package/dist/components/custom-select-list/model.d.ts +1 -1
- package/dist/components/custom-select-list-item/custom-select-list-item.js +89 -32
- package/dist/components/custom-select-list-item/model.d.ts +1 -1
- package/dist/components/custom-select-list-item/model.js +4 -1
- package/dist/components/divider/divider.js +60 -10
- package/dist/components/divider/model.d.ts +1 -1
- package/dist/components/divider/model.js +4 -2
- package/dist/components/drawer/drawer.js +118 -97
- package/dist/components/drawer/model.d.ts +1 -1
- package/dist/components/drawer/model.js +14 -4
- package/dist/components/header/header.js +143 -65
- package/dist/components/header/model.d.ts +1 -1
- package/dist/components/icon/icon.js +61 -12
- package/dist/components/icon/model.d.ts +1 -1
- package/dist/components/icon/model.js +11 -1
- package/dist/components/infotext/infotext.js +62 -12
- package/dist/components/infotext/model.d.ts +1 -1
- package/dist/components/input/input.js +198 -167
- package/dist/components/input/model.d.ts +1 -1
- package/dist/components/input/model.js +21 -5
- package/dist/components/link/link.js +70 -12
- package/dist/components/link/model.d.ts +1 -1
- package/dist/components/link/model.js +8 -3
- package/dist/components/navigation/model.d.ts +1 -1
- package/dist/components/navigation/navigation.js +57 -11
- package/dist/components/navigation-item/model.d.ts +6 -2
- package/dist/components/navigation-item/navigation-item.js +117 -81
- package/dist/components/notification/model.d.ts +1 -1
- package/dist/components/notification/model.js +12 -3
- package/dist/components/notification/notification.js +100 -32
- package/dist/components/page/model.d.ts +1 -1
- package/dist/components/page/model.js +4 -2
- package/dist/components/page/page.js +74 -46
- package/dist/components/popover/model.d.ts +1 -1
- package/dist/components/popover/popover.js +126 -125
- package/dist/components/radio/model.d.ts +1 -1
- package/dist/components/radio/radio.js +124 -85
- package/dist/components/section/model.d.ts +1 -1
- package/dist/components/section/section.js +59 -10
- package/dist/components/select/model.d.ts +1 -1
- package/dist/components/select/select.js +188 -191
- package/dist/components/stack/model.d.ts +1 -1
- package/dist/components/stack/model.js +14 -4
- package/dist/components/stack/stack.js +63 -10
- package/dist/components/switch/model.d.ts +1 -1
- package/dist/components/switch/switch.js +182 -150
- package/dist/components/tab-item/model.d.ts +1 -1
- package/dist/components/tab-item/tab-item.js +105 -76
- package/dist/components/tab-list/model.d.ts +1 -1
- package/dist/components/tab-list/tab-list.js +60 -11
- package/dist/components/tab-panel/model.d.ts +1 -1
- package/dist/components/tab-panel/tab-panel.js +59 -13
- package/dist/components/tabs/model.d.ts +3 -3
- package/dist/components/tabs/model.js +4 -2
- package/dist/components/tabs/tabs.js +191 -178
- package/dist/components/tag/model.d.ts +1 -1
- package/dist/components/tag/model.js +4 -1
- package/dist/components/tag/tag.js +91 -32
- package/dist/components/textarea/model.d.ts +1 -1
- package/dist/components/textarea/model.js +13 -2
- package/dist/components/textarea/textarea.js +165 -150
- package/dist/components/tooltip/model.d.ts +1 -1
- package/dist/components/tooltip/model.js +4 -1
- package/dist/components/tooltip/tooltip.js +119 -115
- package/dist/index.js +64 -81
- package/dist/shared/constants.js +32 -94
- package/dist/shared/figma.d.ts +12 -6
- package/dist/shared/model.js +73 -22
- package/dist/utils/document-click-listener.js +26 -29
- package/dist/utils/document-scroll-listener.js +30 -38
- package/dist/utils/floating-components.js +107 -358
- package/dist/utils/form-components.js +34 -60
- package/dist/utils/index.js +49 -167
- package/dist/utils/navigation.js +68 -135
- package/dist/utils/react.js +10 -15
- package/package.json +11 -8
- package/dist/components/accordion/index.js +0 -1
- package/dist/components/accordion-item/index.js +0 -1
- package/dist/components/accordion-item/model.js +0 -1
- package/dist/components/badge/index.js +0 -1
- package/dist/components/brand/index.js +0 -1
- package/dist/components/brand/model.js +0 -1
- package/dist/components/button/index.js +0 -1
- package/dist/components/card/index.js +0 -1
- package/dist/components/checkbox/index.js +0 -1
- package/dist/components/checkbox/model.js +0 -1
- package/dist/components/custom-button/index.js +0 -1
- package/dist/components/custom-button/model.js +0 -1
- package/dist/components/custom-select/index.js +0 -1
- package/dist/components/custom-select-dropdown/index.js +0 -1
- package/dist/components/custom-select-form-field/index.js +0 -1
- package/dist/components/custom-select-form-field/model.js +0 -1
- package/dist/components/custom-select-list/index.js +0 -1
- package/dist/components/custom-select-list/model.js +0 -1
- package/dist/components/custom-select-list-item/index.js +0 -1
- package/dist/components/divider/index.js +0 -1
- package/dist/components/drawer/index.js +0 -1
- package/dist/components/header/index.js +0 -1
- package/dist/components/header/model.js +0 -1
- package/dist/components/icon/index.js +0 -1
- package/dist/components/infotext/index.js +0 -1
- package/dist/components/infotext/model.js +0 -1
- package/dist/components/input/index.js +0 -1
- package/dist/components/link/index.js +0 -1
- package/dist/components/navigation/index.js +0 -1
- package/dist/components/navigation/model.js +0 -1
- package/dist/components/navigation-item/index.js +0 -1
- package/dist/components/navigation-item/model.js +0 -1
- package/dist/components/notification/index.js +0 -1
- package/dist/components/page/index.js +0 -1
- package/dist/components/popover/index.js +0 -1
- package/dist/components/popover/model.js +0 -1
- package/dist/components/radio/index.js +0 -1
- package/dist/components/radio/model.js +0 -1
- package/dist/components/section/index.js +0 -1
- package/dist/components/section/model.js +0 -1
- package/dist/components/select/index.js +0 -1
- package/dist/components/select/model.js +0 -1
- package/dist/components/stack/index.js +0 -1
- package/dist/components/switch/index.js +0 -1
- package/dist/components/switch/model.js +0 -1
- package/dist/components/tab-item/index.js +0 -1
- package/dist/components/tab-item/model.js +0 -1
- package/dist/components/tab-list/index.js +0 -1
- package/dist/components/tab-list/model.js +0 -1
- package/dist/components/tab-panel/index.js +0 -1
- package/dist/components/tab-panel/model.js +0 -1
- package/dist/components/tabs/index.js +0 -1
- package/dist/components/tag/index.js +0 -1
- package/dist/components/textarea/index.js +0 -1
- package/dist/components/tooltip/index.js +0 -1
- package/dist/shared/examples/index.js +0 -4
- package/dist/shared/figma.js +0 -1
- package/dist/shared/showcase/show-code-link.js +0 -51
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/components/textarea/model.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"none",
|
|
4
|
+
"both",
|
|
5
|
+
"horizontal",
|
|
6
|
+
"vertical"
|
|
7
|
+
], t = [
|
|
8
|
+
"hard",
|
|
9
|
+
"soft",
|
|
10
|
+
"off"
|
|
11
|
+
];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as TextareaResizeList, t as TextareaWrapList };
|
|
@@ -1,152 +1,167 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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, getNumber as o, hasVoiceOver as s, stringPropVisible as c } from "../../utils/index.js";
|
|
4
|
+
import { DEFAULT_INVALID_MESSAGE_ID_SUFFIX as l, DEFAULT_MESSAGE_ID_SUFFIX as u, DEFAULT_VALID_MESSAGE_ID_SUFFIX as d } from "../../shared/constants.js";
|
|
5
|
+
import { addValueResetEventListener as f } from "../../utils/form-components.js";
|
|
6
|
+
import p from "../infotext/infotext.js";
|
|
7
|
+
import { forwardRef as m, useEffect as h, useId as g, useRef as _, useState as v } from "react";
|
|
8
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/textarea/textarea.tsx
|
|
10
|
+
function x(m, x) {
|
|
11
|
+
let S = g(), C = x || _(x), [w, T] = v(() => void 0), [E, D] = v(() => void 0), [O, k] = v(() => void 0), [A, j] = v(() => void 0), [M, N] = v(() => void 0), [P, F] = v(() => void 0), [I, L] = v(() => ""), [R, z] = v(() => ""), [B, V] = v(() => void 0);
|
|
12
|
+
function H() {
|
|
13
|
+
return !!(m.validMessage ?? m.validation === "valid");
|
|
14
|
+
}
|
|
15
|
+
function U() {
|
|
16
|
+
!C.current?.validity.valid || m.validation === "invalid" ? (F(A), N(m.invalidMessage || C.current?.validationMessage || "TODO: Add an invalidMessage"), s() && (z(M), r(() => z(""), 1e3))) : H() && C.current?.validity.valid && (m.required || m.minLength || m.maxLength) ? (F(O), s() && (z(m.validMessage ?? "TODO: Add a validMessage"), r(() => z(""), 1e3))) : c(m.message, m.showMessage) ? F(E) : F(void 0);
|
|
17
|
+
}
|
|
18
|
+
function W(e, t) {
|
|
19
|
+
m.onInput && m.onInput(e), U();
|
|
20
|
+
}
|
|
21
|
+
function G(e, t) {
|
|
22
|
+
m.onChange && m.onChange(e), U();
|
|
23
|
+
}
|
|
24
|
+
function K(e) {
|
|
25
|
+
m.onBlur && m.onBlur(e);
|
|
26
|
+
}
|
|
27
|
+
function q(e) {
|
|
28
|
+
m.onFocus && m.onFocus(e);
|
|
29
|
+
}
|
|
30
|
+
function J() {
|
|
31
|
+
let e = m.id ?? m.propOverrides?.id ?? `textarea-${S}`;
|
|
32
|
+
T(e), D(e + u), k(e + d), j(e + l);
|
|
33
|
+
}
|
|
34
|
+
return h(() => {
|
|
35
|
+
J(), N(m.invalidMessage || "TODO: Add an invalidMessage");
|
|
36
|
+
}, []), h(() => {
|
|
37
|
+
(m.id ?? m.propOverrides?.id) && J();
|
|
38
|
+
}, [m.id, m.propOverrides?.id]), h(() => {
|
|
39
|
+
N(m.invalidMessage || C.current?.validationMessage || "TODO: Add an invalidMessage");
|
|
40
|
+
}, [C.current, m.invalidMessage]), h(() => {
|
|
41
|
+
if (w) {
|
|
42
|
+
let e = w + u;
|
|
43
|
+
D(e), k(w + d), j(w + l), c(m.message, m.showMessage) && F(e), U();
|
|
44
|
+
}
|
|
45
|
+
}, [w]), h(() => {
|
|
46
|
+
L(m.value);
|
|
47
|
+
}, [m.value]), h(() => {
|
|
48
|
+
if (C.current) {
|
|
49
|
+
let e = m.defaultValue, t = B;
|
|
50
|
+
t || (t = new AbortController(), V(t)), f(C.current, {
|
|
51
|
+
value: m.value,
|
|
52
|
+
defaultValue: e
|
|
53
|
+
}, (e) => {
|
|
54
|
+
G(e, !0), W(e, !0);
|
|
55
|
+
}, t.signal);
|
|
56
|
+
}
|
|
57
|
+
}, [C.current]), h(() => () => {
|
|
58
|
+
B?.abort();
|
|
59
|
+
}, []), /* @__PURE__ */ b("div", {
|
|
60
|
+
...t(m, [
|
|
61
|
+
"data-icon-variant",
|
|
62
|
+
"data-icon-variant-before",
|
|
63
|
+
"data-icon-variant-after",
|
|
64
|
+
"data-icon-weight",
|
|
65
|
+
"data-icon-weight-before",
|
|
66
|
+
"data-icon-weight-after",
|
|
67
|
+
"data-interactive",
|
|
68
|
+
"data-force-mobile",
|
|
69
|
+
"data-color",
|
|
70
|
+
"data-container-color",
|
|
71
|
+
"data-bg-color",
|
|
72
|
+
"data-on-bg-color",
|
|
73
|
+
"data-color-scheme",
|
|
74
|
+
"data-font-size",
|
|
75
|
+
"data-headline-size",
|
|
76
|
+
"data-divider",
|
|
77
|
+
"data-focus",
|
|
78
|
+
"data-font",
|
|
79
|
+
"data-density"
|
|
80
|
+
]),
|
|
81
|
+
className: n("db-textarea", m.className),
|
|
82
|
+
"data-variant": m.variant,
|
|
83
|
+
"data-hide-asterisk": a(m.showRequiredAsterisk),
|
|
84
|
+
"data-hide-label": a(m.showLabel),
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ y("label", {
|
|
87
|
+
htmlFor: w,
|
|
88
|
+
children: m.label ?? "LABEL SHOULD BE SET"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ y("textarea", {
|
|
91
|
+
"aria-invalid": m.validation === "invalid",
|
|
92
|
+
"data-custom-validity": m.validation,
|
|
93
|
+
"data-field-sizing": m.fieldSizing,
|
|
94
|
+
ref: C,
|
|
95
|
+
...e(m, [
|
|
96
|
+
"data-icon-variant",
|
|
97
|
+
"data-icon-variant-before",
|
|
98
|
+
"data-icon-variant-after",
|
|
99
|
+
"data-icon-weight",
|
|
100
|
+
"data-icon-weight-before",
|
|
101
|
+
"data-icon-weight-after",
|
|
102
|
+
"data-interactive",
|
|
103
|
+
"data-force-mobile",
|
|
104
|
+
"data-color",
|
|
105
|
+
"data-container-color",
|
|
106
|
+
"data-bg-color",
|
|
107
|
+
"data-on-bg-color",
|
|
108
|
+
"data-color-scheme",
|
|
109
|
+
"data-font-size",
|
|
110
|
+
"data-headline-size",
|
|
111
|
+
"data-divider",
|
|
112
|
+
"data-focus",
|
|
113
|
+
"data-font",
|
|
114
|
+
"data-density"
|
|
115
|
+
]),
|
|
116
|
+
id: w,
|
|
117
|
+
"data-resize": m.resize,
|
|
118
|
+
"data-hide-resizer": a(m.showResizer ?? !0),
|
|
119
|
+
disabled: i(m.disabled, "disabled"),
|
|
120
|
+
required: i(m.required, "required"),
|
|
121
|
+
readOnly: i(m.readOnly, "readOnly") || i(m.readonly, "readonly"),
|
|
122
|
+
form: m.form,
|
|
123
|
+
maxLength: o(m.maxLength, m.maxlength),
|
|
124
|
+
minLength: o(m.minLength, m.minlength),
|
|
125
|
+
name: m.name,
|
|
126
|
+
wrap: m.wrap,
|
|
127
|
+
spellCheck: m.spellCheck,
|
|
128
|
+
autoComplete: m.autocomplete,
|
|
129
|
+
onInput: (e) => W(e),
|
|
130
|
+
onChange: (e) => G(e),
|
|
131
|
+
onBlur: (e) => K(e),
|
|
132
|
+
onFocus: (e) => q(e),
|
|
133
|
+
value: m.value,
|
|
134
|
+
"aria-describedby": m.ariaDescribedBy ?? P,
|
|
135
|
+
placeholder: m.placeholder ?? " ",
|
|
136
|
+
rows: o(m.rows, 4),
|
|
137
|
+
cols: o(m.cols)
|
|
138
|
+
}),
|
|
139
|
+
c(m.message, m.showMessage) ? /* @__PURE__ */ y(p, {
|
|
140
|
+
size: "small",
|
|
141
|
+
icon: m.messageIcon,
|
|
142
|
+
id: E,
|
|
143
|
+
children: m.message
|
|
144
|
+
}) : null,
|
|
145
|
+
H() ? /* @__PURE__ */ y(p, {
|
|
146
|
+
size: "small",
|
|
147
|
+
semantic: "successful",
|
|
148
|
+
id: O,
|
|
149
|
+
children: m.validMessage || "TODO: Add a validMessage"
|
|
150
|
+
}) : null,
|
|
151
|
+
/* @__PURE__ */ y(p, {
|
|
152
|
+
size: "small",
|
|
153
|
+
semantic: "critical",
|
|
154
|
+
id: A,
|
|
155
|
+
children: M
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ y("span", {
|
|
158
|
+
"data-visually-hidden": "true",
|
|
159
|
+
role: "status",
|
|
160
|
+
children: R
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
150
164
|
}
|
|
151
|
-
|
|
152
|
-
|
|
165
|
+
var S = m(x);
|
|
166
|
+
//#endregion
|
|
167
|
+
export { S as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEventState, DocumentScrollState, EmphasisProps, GlobalProps, GlobalState, InitializedState, PlacementProps, PopoverProps, PopoverState, ResetIdState, TextProps, WrapProps } from '../../shared/model';
|
|
1
|
+
import type { ClickEventState, DocumentScrollState, EmphasisProps, GlobalProps, GlobalState, InitializedState, PlacementProps, PopoverProps, PopoverState, ResetIdState, TextProps, WrapProps } from '../../shared/model';
|
|
2
2
|
export declare const TooltipVariantList: readonly ["description", "label"];
|
|
3
3
|
export type TooltipVariantType = (typeof TooltipVariantList)[number];
|
|
4
4
|
export type DBTooltipDefaultProps = {
|
|
@@ -1,117 +1,121 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 { DEFAULT_ID as a } from "../../shared/constants.js";
|
|
5
|
+
import { DocumentScrollListener as o } from "../../utils/document-scroll-listener.js";
|
|
6
|
+
import { handleFixedPopover as s } from "../../utils/floating-components.js";
|
|
7
|
+
import { forwardRef as c, useEffect as l, useId as u, useRef as d, useState as f } from "react";
|
|
8
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/tooltip/tooltip.tsx
|
|
10
|
+
function g(c, g) {
|
|
11
|
+
let _ = u(), v = g || d(g), [y, b] = f(() => a), [x, S] = f(() => !1), [C, w] = f(() => void 0), [T, E] = f(() => void 0);
|
|
12
|
+
function D(e) {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
}
|
|
15
|
+
function O(e) {
|
|
16
|
+
(!e || e.key === "Escape") && v.current && getComputedStyle(v.current).visibility === "visible" && k().blur();
|
|
17
|
+
}
|
|
18
|
+
function k() {
|
|
19
|
+
let e = v.current.parentElement;
|
|
20
|
+
return e && e.localName.includes("tooltip") && (e = e.parentElement), e;
|
|
21
|
+
}
|
|
22
|
+
function A(e) {
|
|
23
|
+
e && v.current && r(() => {
|
|
24
|
+
v.current && s(v.current, e, c.placement ?? "bottom");
|
|
25
|
+
}, 1);
|
|
26
|
+
}
|
|
27
|
+
function j(e, t) {
|
|
28
|
+
e?.target?.contains && e?.target?.contains(v.current) && A(t);
|
|
29
|
+
}
|
|
30
|
+
function M() {
|
|
31
|
+
C && new o().removeCallback(C), T?.unobserve(k());
|
|
32
|
+
}
|
|
33
|
+
function N(e) {
|
|
34
|
+
w(new o().addCallback((t) => j(t, e))), A(e), T?.observe(k());
|
|
35
|
+
}
|
|
36
|
+
function P() {
|
|
37
|
+
b(c.id ?? c.propOverrides?.id ?? "tooltip-" + _);
|
|
38
|
+
}
|
|
39
|
+
return l(() => {
|
|
40
|
+
P(), S(!0);
|
|
41
|
+
}, []), l(() => {
|
|
42
|
+
(c.id ?? c.propOverrides?.id) && P();
|
|
43
|
+
}, [c.id, c.propOverrides?.id]), l(() => {
|
|
44
|
+
if (v.current && x && y) {
|
|
45
|
+
let e = k();
|
|
46
|
+
e && (A(e), ["mouseenter", "focusin"].forEach((t) => {
|
|
47
|
+
e.addEventListener(t, () => N(e));
|
|
48
|
+
}), e.addEventListener("keydown", (e) => O(e)), ["mouseleave", "focusout"].forEach((t) => {
|
|
49
|
+
e.addEventListener(t, () => M());
|
|
50
|
+
}), e.dataset.hasTooltip = "true", c.variant === "label" ? e.setAttribute("aria-labelledby", y) : e.setAttribute("aria-describedby", y)), typeof window < "u" && "IntersectionObserver" in window && E(new IntersectionObserver((e) => {
|
|
51
|
+
let t = e.find(({ target: e }) => e === k());
|
|
52
|
+
t && !t.isIntersecting && O(!1);
|
|
53
|
+
})), S(!1);
|
|
54
|
+
}
|
|
55
|
+
}, [
|
|
56
|
+
v.current,
|
|
57
|
+
x,
|
|
58
|
+
y
|
|
59
|
+
]), /* @__PURE__ */ h("i", {
|
|
60
|
+
role: "tooltip",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
"data-gap": "true",
|
|
63
|
+
ref: v,
|
|
64
|
+
...e(c, [
|
|
65
|
+
"data-icon-variant",
|
|
66
|
+
"data-icon-variant-before",
|
|
67
|
+
"data-icon-variant-after",
|
|
68
|
+
"data-icon-weight",
|
|
69
|
+
"data-icon-weight-before",
|
|
70
|
+
"data-icon-weight-after",
|
|
71
|
+
"data-interactive",
|
|
72
|
+
"data-force-mobile",
|
|
73
|
+
"data-color",
|
|
74
|
+
"data-container-color",
|
|
75
|
+
"data-bg-color",
|
|
76
|
+
"data-on-bg-color",
|
|
77
|
+
"data-color-scheme",
|
|
78
|
+
"data-font-size",
|
|
79
|
+
"data-headline-size",
|
|
80
|
+
"data-divider",
|
|
81
|
+
"data-focus",
|
|
82
|
+
"data-font",
|
|
83
|
+
"data-density"
|
|
84
|
+
]),
|
|
85
|
+
...t(c, [
|
|
86
|
+
"data-icon-variant",
|
|
87
|
+
"data-icon-variant-before",
|
|
88
|
+
"data-icon-variant-after",
|
|
89
|
+
"data-icon-weight",
|
|
90
|
+
"data-icon-weight-before",
|
|
91
|
+
"data-icon-weight-after",
|
|
92
|
+
"data-interactive",
|
|
93
|
+
"data-force-mobile",
|
|
94
|
+
"data-color",
|
|
95
|
+
"data-container-color",
|
|
96
|
+
"data-bg-color",
|
|
97
|
+
"data-on-bg-color",
|
|
98
|
+
"data-color-scheme",
|
|
99
|
+
"data-font-size",
|
|
100
|
+
"data-headline-size",
|
|
101
|
+
"data-divider",
|
|
102
|
+
"data-focus",
|
|
103
|
+
"data-font",
|
|
104
|
+
"data-density"
|
|
105
|
+
]),
|
|
106
|
+
className: n("db-tooltip", c.className),
|
|
107
|
+
id: y,
|
|
108
|
+
"data-emphasis": c.emphasis,
|
|
109
|
+
"data-wrap": i(c.wrap),
|
|
110
|
+
"data-animation": i(c.animation ?? !0),
|
|
111
|
+
"data-delay": c.delay,
|
|
112
|
+
"data-width": c.width,
|
|
113
|
+
"data-show-arrow": i(c.showArrow ?? !0),
|
|
114
|
+
"data-placement": c.placement,
|
|
115
|
+
onClick: (e) => D(e),
|
|
116
|
+
children: [c.text ? /* @__PURE__ */ m(p, { children: c.text }) : null, c.children]
|
|
117
|
+
});
|
|
115
118
|
}
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
var _ = c(g);
|
|
120
|
+
//#endregion
|
|
121
|
+
export { _ as default };
|