@tedi-design-system/react 18.1.0-rc.25 → 18.1.0-rc.27
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/bundle-stats.html +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/community/components/tooltip/tooltip-trigger.cjs.js +1 -1
- package/src/community/components/tooltip/tooltip-trigger.es.js +15 -14
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +15 -0
- package/src/tedi/components/form/date-field/date-field.es.js +304 -269
- package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +8 -0
- package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +147 -66
- package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.es.js +3 -0
- package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.es.js +8 -7
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.es.js +10 -9
- package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +20 -19
- package/src/tedi/helpers/get-element-ref.cjs.js +1 -0
- package/src/tedi/helpers/get-element-ref.d.ts +11 -0
- package/src/tedi/helpers/get-element-ref.es.js +8 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +21 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),v=require("../../../../../external/classnames/index.cjs.js"),i=require("react"),T=require("../../base/icon/icon.cjs.js"),Z=require("../../buttons/closing-button/closing-button.cjs.js"),ee=require("../../misc/separator/separator.cjs.js"),z=require("../../tags/tag/tag.cjs.js"),te=require("../form-label/form-label.cjs.js"),r=require("./multi-value-field.module.scss.cjs.js"),le=require("../../../providers/label-provider/use-labels.cjs.js"),j=4,ie=44,N=i.forwardRef((F,O)=>{const{id:A,label:w,name:q,values:C,onChange:_,tagColor:y="primary",tagsDirection:P="stack",className:$,icon:o,onIconClick:V,iconButtonProps:m,isClearable:G=!0,required:S,disabled:b}=F,{getLabel:M}=le.useLabels(),[X,B]=i.useState(C??[]),E=i.useRef(null),W=i.useRef(null);i.useImperativeHandle(O,()=>({input:W.current,wrapper:E.current}),[]);const a=C??X,n=P==="row",[f,D]=i.useState(null),H=i.useCallback(e=>D(e),[]),p=i.useRef(0),[d,g]=i.useState(null);i.useEffect(()=>{n&&g(null)},[a.length,n]),i.useEffect(()=>{if(!n||!f||typeof ResizeObserver>"u")return;const e=new ResizeObserver(t=>{var c;const s=((c=t[0])==null?void 0:c.contentRect.width)??0;s>0&&s!==p.current&&g(null)});return e.observe(f),()=>e.disconnect()},[n,f]),i.useLayoutEffect(()=>{if(!n||d!==null)return;const e=f;if(!e)return;const t=e.clientWidth;if(t===0)return;const s=e.querySelectorAll("[data-tedi-tag-index]");if(s.length===0)return;let c=0;for(let u=0;u<s.length;u++)c+=s[u].offsetWidth+(u>0?j:0);if(c<=t){p.current=t,g(s.length);return}let k=0,h=0;for(let u=0;u<s.length;u++){const Q=s[u].offsetWidth,Y=u<s.length-1?ie+j:0,L=k+Q+(h>0?j:0);if(L+Y<=t)k=L,h++;else break}h===0&&(h=1),p.current=t,g(h)},[n,d,a,f]);const I=e=>{B(e),_==null||_(e)},J=e=>{const t=a.filter((s,c)=>c!==e);I(t)},x=!b&&G&&a.length>0,U=()=>{I([])},R=n&&d!==null?Math.max(0,a.length-d):0,K=()=>{if(!o)return null;const e=typeof o=="string"?{name:o}:o;return V?l.jsx("button",{...m,className:v.default(r.default["tedi-multi-value-field__icon-wrapper"],m==null?void 0:m.className),onClick:V,type:"button",children:l.jsx(T.Icon,{...e,size:18})}):l.jsx("div",{className:r.default["tedi-multi-value-field__icon-wrapper"],children:l.jsx(T.Icon,{...e,size:18})})};return l.jsxs("div",{className:v.default(r.default["tedi-multi-value-field"],$),children:[w&&l.jsx(te.FormLabel,{id:A,label:w,required:S}),l.jsxs("div",{ref:E,className:v.default(r.default["tedi-multi-value-field__inner"],{[r.default["tedi-multi-value-field__inner--row"]]:n}),children:[a.length>0&&l.jsxs("div",{ref:H,className:v.default(r.default["tedi-multi-value-field__tags"],{[r.default["tedi-multi-value-field__tags--row"]]:n}),children:[a.map((e,t)=>n&&d!==null&&t>=d?null:l.jsx(z.Tag,{color:y,"data-tedi-tag-index":t,onClose:b?void 0:()=>J(t),children:e},`${e}-${t}`)),R>0&&l.jsxs(z.Tag,{color:y,className:r.default["tedi-multi-value-field__overflow-tag"],"aria-label":M("multi-value-field.hidden-count",R),children:["+",R]})]}),(x||o)&&l.jsxs("div",{className:r.default["tedi-multi-value-field__right-area"],children:[x&&l.jsx(Z.ClosingButton,{onClick:U,title:M("clear"),className:r.default["tedi-multi-value-field__clear-button"],iconSize:18}),x&&o&&l.jsx(ee.Separator,{color:"primary",axis:"vertical",height:1.5,spacing:.25}),o&&K()]})]}),q&&l.jsx("input",{ref:W,type:"hidden",name:q,value:a.length?JSON.stringify(a):"",required:S,disabled:b})]})});N.displayName="MultiValueField";exports.MultiValueField=N;exports.default=N;
|
|
@@ -29,6 +29,14 @@ export interface MultiValueFieldProps {
|
|
|
29
29
|
* @default 'primary'
|
|
30
30
|
*/
|
|
31
31
|
tagColor?: 'primary' | 'secondary' | 'danger';
|
|
32
|
+
/**
|
|
33
|
+
* Layout for the value tags.
|
|
34
|
+
* - `'stack'` (default) — tags wrap onto multiple rows; the field grows in height.
|
|
35
|
+
* - `'row'` — tags stay on a single row; any that don't fit collapse into a
|
|
36
|
+
* `+N` counter (the count is measured from the available width).
|
|
37
|
+
* @default stack
|
|
38
|
+
*/
|
|
39
|
+
tagsDirection?: 'stack' | 'row';
|
|
32
40
|
/**
|
|
33
41
|
* Additional CSS class names applied to the root element.
|
|
34
42
|
*/
|
|
@@ -1,81 +1,162 @@
|
|
|
1
|
-
import { jsxs as m, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { ClosingButton as
|
|
6
|
-
import { Separator as
|
|
7
|
-
import { Tag as
|
|
8
|
-
import { FormLabel as
|
|
9
|
-
import
|
|
10
|
-
import { useLabels as
|
|
11
|
-
const
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import v from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import { forwardRef as te, useState as R, useRef as C, useImperativeHandle as le, useCallback as ie, useEffect as T, useLayoutEffect as re } from "react";
|
|
4
|
+
import { Icon as F } from "../../base/icon/icon.es.js";
|
|
5
|
+
import { ClosingButton as ne } from "../../buttons/closing-button/closing-button.es.js";
|
|
6
|
+
import { Separator as se } from "../../misc/separator/separator.es.js";
|
|
7
|
+
import { Tag as P } from "../../tags/tag/tag.es.js";
|
|
8
|
+
import { FormLabel as ae } from "../form-label/form-label.es.js";
|
|
9
|
+
import r from "./multi-value-field.module.scss.es.js";
|
|
10
|
+
import { useLabels as oe } from "../../../providers/label-provider/use-labels.es.js";
|
|
11
|
+
const y = 4, ue = 44, ce = te((j, q) => {
|
|
12
12
|
const {
|
|
13
|
-
id:
|
|
14
|
-
label:
|
|
15
|
-
name:
|
|
16
|
-
values:
|
|
17
|
-
onChange:
|
|
18
|
-
tagColor:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
13
|
+
id: G,
|
|
14
|
+
label: V,
|
|
15
|
+
name: W,
|
|
16
|
+
values: E,
|
|
17
|
+
onChange: g,
|
|
18
|
+
tagColor: k = "primary",
|
|
19
|
+
tagsDirection: X = "stack",
|
|
20
|
+
className: $,
|
|
21
|
+
icon: o,
|
|
22
|
+
onIconClick: I,
|
|
23
|
+
iconButtonProps: h,
|
|
24
|
+
isClearable: D = !0,
|
|
25
|
+
required: M,
|
|
26
|
+
disabled: _
|
|
27
|
+
} = j, { getLabel: S } = oe(), [H, J] = R(E ?? []), x = C(null), z = C(null);
|
|
28
|
+
le(q, () => ({ input: z.current, wrapper: x.current }), []);
|
|
29
|
+
const n = E ?? H, i = X === "row", [d, U] = R(null), B = ie((e) => U(e), []), b = C(0), [c, p] = R(null);
|
|
30
|
+
T(() => {
|
|
31
|
+
i && p(null);
|
|
32
|
+
}, [n.length, i]), T(() => {
|
|
33
|
+
if (!i || !d || typeof ResizeObserver > "u") return;
|
|
34
|
+
const e = new ResizeObserver((t) => {
|
|
35
|
+
var u;
|
|
36
|
+
const l = ((u = t[0]) == null ? void 0 : u.contentRect.width) ?? 0;
|
|
37
|
+
l > 0 && l !== b.current && p(null);
|
|
38
|
+
});
|
|
39
|
+
return e.observe(d), () => e.disconnect();
|
|
40
|
+
}, [i, d]), re(() => {
|
|
41
|
+
if (!i || c !== null) return;
|
|
42
|
+
const e = d;
|
|
43
|
+
if (!e) return;
|
|
44
|
+
const t = e.clientWidth;
|
|
45
|
+
if (t === 0) return;
|
|
46
|
+
const l = e.querySelectorAll("[data-tedi-tag-index]");
|
|
47
|
+
if (l.length === 0) return;
|
|
48
|
+
let u = 0;
|
|
49
|
+
for (let s = 0; s < l.length; s++)
|
|
50
|
+
u += l[s].offsetWidth + (s > 0 ? y : 0);
|
|
51
|
+
if (u <= t) {
|
|
52
|
+
b.current = t, p(l.length);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
let L = 0, f = 0;
|
|
56
|
+
for (let s = 0; s < l.length; s++) {
|
|
57
|
+
const Z = l[s].offsetWidth, ee = s < l.length - 1 ? ue + y : 0, O = L + Z + (f > 0 ? y : 0);
|
|
58
|
+
if (O + ee <= t)
|
|
59
|
+
L = O, f++;
|
|
60
|
+
else
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
f === 0 && (f = 1), b.current = t, p(f);
|
|
64
|
+
}, [i, c, n, d]);
|
|
65
|
+
const A = (e) => {
|
|
66
|
+
J(e), g == null || g(e);
|
|
67
|
+
}, K = (e) => {
|
|
68
|
+
const t = n.filter((l, u) => u !== e);
|
|
69
|
+
A(t);
|
|
70
|
+
}, N = !_ && D && n.length > 0, Q = () => {
|
|
71
|
+
A([]);
|
|
72
|
+
}, w = i && c !== null ? Math.max(0, n.length - c) : 0, Y = () => {
|
|
73
|
+
if (!o) return null;
|
|
74
|
+
const e = typeof o == "string" ? { name: o } : o;
|
|
75
|
+
return I ? /* @__PURE__ */ a(
|
|
37
76
|
"button",
|
|
38
77
|
{
|
|
39
|
-
...
|
|
40
|
-
className:
|
|
41
|
-
onClick:
|
|
78
|
+
...h,
|
|
79
|
+
className: v(r["tedi-multi-value-field__icon-wrapper"], h == null ? void 0 : h.className),
|
|
80
|
+
onClick: I,
|
|
42
81
|
type: "button",
|
|
43
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ a(F, { ...e, size: 18 })
|
|
44
83
|
}
|
|
45
|
-
) : /* @__PURE__ */
|
|
84
|
+
) : /* @__PURE__ */ a("div", { className: r["tedi-multi-value-field__icon-wrapper"], children: /* @__PURE__ */ a(F, { ...e, size: 18 }) });
|
|
46
85
|
};
|
|
47
|
-
return /* @__PURE__ */ m("div", { className:
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */ m(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
return /* @__PURE__ */ m("div", { className: v(r["tedi-multi-value-field"], $), children: [
|
|
87
|
+
V && /* @__PURE__ */ a(ae, { id: G, label: V, required: M }),
|
|
88
|
+
/* @__PURE__ */ m(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
ref: x,
|
|
92
|
+
className: v(r["tedi-multi-value-field__inner"], {
|
|
93
|
+
[r["tedi-multi-value-field__inner--row"]]: i
|
|
94
|
+
}),
|
|
95
|
+
children: [
|
|
96
|
+
n.length > 0 && /* @__PURE__ */ m(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
ref: B,
|
|
100
|
+
className: v(r["tedi-multi-value-field__tags"], {
|
|
101
|
+
[r["tedi-multi-value-field__tags--row"]]: i
|
|
102
|
+
}),
|
|
103
|
+
children: [
|
|
104
|
+
n.map((e, t) => i && c !== null && t >= c ? null : /* @__PURE__ */ a(
|
|
105
|
+
P,
|
|
106
|
+
{
|
|
107
|
+
color: k,
|
|
108
|
+
"data-tedi-tag-index": t,
|
|
109
|
+
onClose: _ ? void 0 : () => K(t),
|
|
110
|
+
children: e
|
|
111
|
+
},
|
|
112
|
+
`${e}-${t}`
|
|
113
|
+
)),
|
|
114
|
+
w > 0 && /* @__PURE__ */ m(
|
|
115
|
+
P,
|
|
116
|
+
{
|
|
117
|
+
color: k,
|
|
118
|
+
className: r["tedi-multi-value-field__overflow-tag"],
|
|
119
|
+
"aria-label": S("multi-value-field.hidden-count", w),
|
|
120
|
+
children: [
|
|
121
|
+
"+",
|
|
122
|
+
w
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
(N || o) && /* @__PURE__ */ m("div", { className: r["tedi-multi-value-field__right-area"], children: [
|
|
130
|
+
N && /* @__PURE__ */ a(
|
|
131
|
+
ne,
|
|
132
|
+
{
|
|
133
|
+
onClick: Q,
|
|
134
|
+
title: S("clear"),
|
|
135
|
+
className: r["tedi-multi-value-field__clear-button"],
|
|
136
|
+
iconSize: 18
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
N && o && /* @__PURE__ */ a(se, { color: "primary", axis: "vertical", height: 1.5, spacing: 0.25 }),
|
|
140
|
+
o && Y()
|
|
141
|
+
] })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
W && /* @__PURE__ */ a(
|
|
66
146
|
"input",
|
|
67
147
|
{
|
|
148
|
+
ref: z,
|
|
68
149
|
type: "hidden",
|
|
69
|
-
name:
|
|
70
|
-
value:
|
|
71
|
-
required:
|
|
72
|
-
disabled:
|
|
150
|
+
name: W,
|
|
151
|
+
value: n.length ? JSON.stringify(n) : "",
|
|
152
|
+
required: M,
|
|
153
|
+
disabled: _
|
|
73
154
|
}
|
|
74
155
|
)
|
|
75
156
|
] });
|
|
76
157
|
});
|
|
77
|
-
|
|
158
|
+
ce.displayName = "MultiValueField";
|
|
78
159
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
160
|
+
ce as MultiValueField,
|
|
161
|
+
ce as default
|
|
81
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-multi-value-field__inner":"tedi-multi-value-field__inner-d00be7fe","tedi-multi-value-field__tags":"tedi-multi-value-field__tags-4f52450e","tedi-multi-value-field__right-area":"tedi-multi-value-field__right-area-2d533551","tedi-multi-value-field__icon-wrapper":"tedi-multi-value-field__icon-wrapper-d73d0e44"};exports.default=e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-multi-value-field__inner":"tedi-multi-value-field__inner-d00be7fe","tedi-multi-value-field__inner--row":"tedi-multi-value-field__inner--row-50af96e5","tedi-multi-value-field__tags":"tedi-multi-value-field__tags-4f52450e","tedi-multi-value-field__tags--row":"tedi-multi-value-field__tags--row-fa16b6db","tedi-multi-value-field__overflow-tag":"tedi-multi-value-field__overflow-tag-e6aa972a","tedi-multi-value-field__right-area":"tedi-multi-value-field__right-area-2d533551","tedi-multi-value-field__icon-wrapper":"tedi-multi-value-field__icon-wrapper-d73d0e44"};exports.default=e;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const e = {
|
|
2
2
|
"tedi-multi-value-field__inner": "tedi-multi-value-field__inner-d00be7fe",
|
|
3
|
+
"tedi-multi-value-field__inner--row": "tedi-multi-value-field__inner--row-50af96e5",
|
|
3
4
|
"tedi-multi-value-field__tags": "tedi-multi-value-field__tags-4f52450e",
|
|
5
|
+
"tedi-multi-value-field__tags--row": "tedi-multi-value-field__tags--row-fa16b6db",
|
|
6
|
+
"tedi-multi-value-field__overflow-tag": "tedi-multi-value-field__overflow-tag-e6aa972a",
|
|
4
7
|
"tedi-multi-value-field__right-area": "tedi-multi-value-field__right-area-2d533551",
|
|
5
8
|
"tedi-multi-value-field__icon-wrapper": "tedi-multi-value-field__icon-wrapper-d73d0e44"
|
|
6
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),c=require("react"),f=require("../dropdown-context.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),c=require("react"),g=require("../../../../helpers/get-element-ref.cjs.js"),f=require("../dropdown-context.cjs.js"),i=({children:e})=>{const{refs:r,getReferenceProps:t}=f.useDropdownContext(),o=g.getElementRef(e),n=s.useMergeRefs([r.setReference,o]);return c.cloneElement(e,t({...e.props,ref:n}))};exports.DropdownTrigger=i;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { useMergeRefs as
|
|
2
|
-
import { cloneElement as
|
|
1
|
+
import { useMergeRefs as m } from "../../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
2
|
+
import { cloneElement as n } from "react";
|
|
3
|
+
import { getElementRef as s } from "../../../../helpers/get-element-ref.es.js";
|
|
3
4
|
import { useDropdownContext as p } from "../dropdown-context.es.js";
|
|
4
|
-
const
|
|
5
|
-
const { refs:
|
|
6
|
-
return
|
|
5
|
+
const u = ({ children: e }) => {
|
|
6
|
+
const { refs: o, getReferenceProps: r } = p(), t = s(e), f = m([o.setReference, t]);
|
|
7
|
+
return n(
|
|
7
8
|
e,
|
|
8
|
-
|
|
9
|
+
r({
|
|
9
10
|
...e.props,
|
|
10
11
|
ref: f
|
|
11
12
|
})
|
|
12
13
|
);
|
|
13
14
|
};
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
u as DropdownTrigger
|
|
16
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),f=require("../../../../helpers/get-element-ref.cjs.js"),g=require("../modal-context.cjs.js"),i=(...t)=>r=>{for(const e of t)e&&(typeof e=="function"?e(r):e.current=r)},o=({children:t})=>{const{getReferenceProps:r,reference:e}=g.useModalContext(),n=f.getElementRef(t),s=i(e,n);return c.cloneElement(t,r({...t.props,ref:s}))};o.displayName="Modal.Trigger";exports.ModalTrigger=o;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { cloneElement as n } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { getElementRef as s } from "../../../../helpers/get-element-ref.es.js";
|
|
3
|
+
import { useModalContext as m } from "../modal-context.es.js";
|
|
4
|
+
const c = (...o) => (r) => {
|
|
5
|
+
for (const e of o)
|
|
6
|
+
e && (typeof e == "function" ? e(r) : e.current = r);
|
|
7
|
+
}, i = ({ children: o }) => {
|
|
8
|
+
const { getReferenceProps: r, reference: e } = m(), t = s(o), f = c(e, t);
|
|
9
|
+
return n(o, r({ ...o.props, ref: f }));
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
i.displayName = "Modal.Trigger";
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
i as ModalTrigger
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),m=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),p=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),q=require("../../../helpers/get-element-ref.cjs.js"),x=require("../../base/icon/icon.cjs.js"),_=require("./overlay.cjs.js"),r=require("./overlay.module.scss.cjs.js"),R=require("../../../providers/label-provider/use-labels.cjs.js"),E=l=>{const{children:e,className:s}=l,{getLabel:c}=R.useLabels(),{getReferenceProps:i,reference:a,openWith:d,open:u,role:g,ariaHidden:f,contentId:v}=t.useContext(_.OverlayContext),y=t.isValidElement(e)?q.getElementRef(e):void 0,o=m.useMergeRefs([a,y]),n=g==="tooltip"&&!f?{"aria-describedby":u?v:void 0}:{};return t.isValidElement(e)?t.cloneElement(e,i({tabIndex:0,...n,label:e.type===x.Icon?c("tooltip.icon-trigger"):void 0,...e.props,ref:o})):b.jsx("div",{...i({ref:o,tabIndex:0,className:p.default(r.default["tedi-overlay__trigger"],r.default["tedi-overlay__trigger--text"],{[r.default["tedi-overlay__trigger--click"]]:d==="click"},s),...n}),children:e})};exports.OverlayTrigger=E;
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMergeRefs as
|
|
3
|
-
import
|
|
4
|
-
import { useContext as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useMergeRefs as y } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import b from "../../../../../external/classnames/index.es.js";
|
|
4
|
+
import { useContext as _, isValidElement as s, cloneElement as u } from "react";
|
|
5
|
+
import { getElementRef as I } from "../../../helpers/get-element-ref.es.js";
|
|
6
|
+
import { Icon as R } from "../../base/icon/icon.es.js";
|
|
7
|
+
import { OverlayContext as h } from "./overlay.es.js";
|
|
7
8
|
import r from "./overlay.module.scss.es.js";
|
|
8
|
-
import { useLabels as
|
|
9
|
-
const
|
|
10
|
-
const { children: e, className:
|
|
11
|
-
"aria-describedby":
|
|
9
|
+
import { useLabels as E } from "../../../providers/label-provider/use-labels.es.js";
|
|
10
|
+
const T = (n) => {
|
|
11
|
+
const { children: e, className: l } = n, { getLabel: m } = E(), { getReferenceProps: t, reference: c, openWith: a, open: p, role: f, ariaHidden: d, contentId: g } = _(h), v = s(e) ? I(e) : void 0, o = y([c, v]), i = f === "tooltip" && !d ? {
|
|
12
|
+
"aria-describedby": p ? g : void 0
|
|
12
13
|
} : {};
|
|
13
|
-
return
|
|
14
|
+
return s(e) ? u(
|
|
14
15
|
e,
|
|
15
16
|
t({
|
|
16
|
-
ref: o,
|
|
17
17
|
tabIndex: 0,
|
|
18
18
|
...i,
|
|
19
|
-
label: e.type ===
|
|
20
|
-
...e.props
|
|
19
|
+
label: e.type === R ? m("tooltip.icon-trigger") : void 0,
|
|
20
|
+
...e.props,
|
|
21
|
+
ref: o
|
|
21
22
|
})
|
|
22
|
-
) : /* @__PURE__ */
|
|
23
|
+
) : /* @__PURE__ */ x(
|
|
23
24
|
"div",
|
|
24
25
|
{
|
|
25
26
|
...t({
|
|
26
27
|
ref: o,
|
|
27
28
|
tabIndex: 0,
|
|
28
|
-
className:
|
|
29
|
+
className: b(
|
|
29
30
|
r["tedi-overlay__trigger"],
|
|
30
31
|
r["tedi-overlay__trigger--text"],
|
|
31
32
|
{
|
|
32
|
-
[r["tedi-overlay__trigger--click"]]:
|
|
33
|
+
[r["tedi-overlay__trigger--click"]]: a === "click"
|
|
33
34
|
},
|
|
34
|
-
|
|
35
|
+
l
|
|
35
36
|
),
|
|
36
37
|
...i
|
|
37
38
|
}),
|
|
@@ -40,5 +41,5 @@ const j = (s) => {
|
|
|
40
41
|
);
|
|
41
42
|
};
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
T as OverlayTrigger
|
|
44
45
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),n=t=>{const e=t;return Number.parseInt(r.version,10)>=19?e.props.ref:e.ref};exports.getElementRef=n;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement, Ref } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Reads a React element's ref in a version-safe way.
|
|
4
|
+
*
|
|
5
|
+
* React 19 moved `ref` onto `props` (an enumerable prop) and warns whenever the
|
|
6
|
+
* legacy `element.ref` getter is accessed. React 18 keeps the ref on the element
|
|
7
|
+
* itself. So read from `props.ref` on React 19+ and only fall back to
|
|
8
|
+
* `element.ref` on React 18 — avoiding both the deprecation warning and the
|
|
9
|
+
* lost ref.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getElementRef: <T = unknown>(element: ReactElement) => Ref<T> | undefined;
|