@tedi-design-system/react 19.1.0-rc.2 → 19.1.0-rc.4
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/DESIGN.md +308 -0
- package/README.md +28 -0
- package/_virtual/index.es13.js +2 -2
- package/_virtual/index.es14.js +2 -2
- package/bundle-stats.html +1 -1
- package/component.manifest.json +1191 -0
- 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/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/filter/filter/filter.cjs.js +1 -1
- package/src/tedi/components/filter/filter/filter.d.ts +5 -0
- package/src/tedi/components/filter/filter/filter.es.js +154 -144
- package/src/tedi/components/filter/filter/filter.module.scss.cjs.js +1 -1
- package/src/tedi/components/filter/filter/filter.module.scss.es.js +2 -1
- package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
- package/src/tedi/components/form/time-field/time-field.es.js +126 -124
- package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.d.ts +8 -0
- package/src/tedi/components/overlays/dropdown/dropdown.es.js +82 -74
- package/src/tedi/components/overlays/dropdown/dropdown.module.scss.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown.module.scss.es.js +1 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +7 -0
- package/src/tedi/providers/label-provider/labels-map.es.js +7 -0
|
@@ -1,67 +1,68 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { TextField as
|
|
6
|
-
import { TimePicker as
|
|
1
|
+
import { jsxs as G, jsx as i, Fragment as xe } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as ve, useClick as Ce, useDismiss as _e, useRole as Fe, useInteractions as Pe, FloatingPortal as Ie, FloatingFocusManager as Te } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import O from "../../../../../external/classnames/index.es.js";
|
|
4
|
+
import we, { useState as M, useEffect as H } from "react";
|
|
5
|
+
import { TextField as J } from "../textfield/textfield.es.js";
|
|
6
|
+
import { TimePicker as Be } from "../time-picker/time-picker.es.js";
|
|
7
7
|
import d from "./time-field.module.scss.es.js";
|
|
8
|
-
import { normalizeTime as
|
|
9
|
-
import { TimePickerModal as
|
|
10
|
-
import { useBreakpointProps as
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
import { normalizeTime as ye, TIMEPICKER_OFFSET as Ne } from "./time-field-helpers.es.js";
|
|
9
|
+
import { TimePickerModal as Oe } from "./time-picker-modal/time-picker-modal.es.js";
|
|
10
|
+
import { useBreakpointProps as Me } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
11
|
+
import { useLabels as Re } from "../../../providers/label-provider/use-labels.es.js";
|
|
12
|
+
import Ve, { isBreakpointBelow as Ee } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
13
|
+
import { Dropdown as v } from "../../overlays/dropdown/dropdown.es.js";
|
|
14
|
+
import { autoUpdate as Ue } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
15
|
+
import { offset as De, flip as Se, shift as je } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
16
|
+
const Le = (C) => {
|
|
17
|
+
const { getCurrentBreakpointProps: Q } = Me(C.defaultServerBreakpoint), { getLabel: W } = Re(), {
|
|
18
|
+
id: X,
|
|
19
|
+
label: Y,
|
|
20
|
+
value: m,
|
|
21
|
+
defaultValue: Z,
|
|
22
|
+
onChange: _,
|
|
23
|
+
readOnly: k = !1,
|
|
24
|
+
disabled: l = !1,
|
|
25
|
+
required: $,
|
|
26
|
+
placeholder: ee,
|
|
26
27
|
inputProps: t,
|
|
27
|
-
stepMinutes:
|
|
28
|
-
className:
|
|
29
|
-
availableTimes:
|
|
30
|
-
modal:
|
|
31
|
-
modalProps:
|
|
28
|
+
stepMinutes: R = 1,
|
|
29
|
+
className: V,
|
|
30
|
+
availableTimes: s,
|
|
31
|
+
modal: F = !1,
|
|
32
|
+
modalProps: te
|
|
32
33
|
} = C, {
|
|
33
|
-
useNativePicker:
|
|
34
|
-
timePickerTrigger:
|
|
35
|
-
showPicker:
|
|
36
|
-
availableTimesVariant:
|
|
37
|
-
clearable:
|
|
38
|
-
} =
|
|
39
|
-
open:
|
|
40
|
-
onOpenChange:
|
|
41
|
-
placement:
|
|
42
|
-
middleware: [Ne
|
|
43
|
-
whileElementsMounted:
|
|
44
|
-
}), { refs:
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
(
|
|
51
|
-
const
|
|
52
|
-
|
|
34
|
+
useNativePicker: ie = !1,
|
|
35
|
+
timePickerTrigger: P = "button",
|
|
36
|
+
showPicker: n = !0,
|
|
37
|
+
availableTimesVariant: I = "grid-buttons",
|
|
38
|
+
clearable: oe = !0
|
|
39
|
+
} = Q(C), E = m !== void 0, [ne, U] = M(m ?? Z ?? ""), f = E ? m : ne, [T, w] = M(!1), [D, S] = M(!1), u = P === "input", o = ie, re = Ve(), c = !o && n && !k && !l && (F === !0 || typeof F == "string" && Ee(re, F)), ae = ve({
|
|
40
|
+
open: T,
|
|
41
|
+
onOpenChange: w,
|
|
42
|
+
placement: u ? "bottom-start" : "bottom-end",
|
|
43
|
+
middleware: [De(Ne), Se(), je()],
|
|
44
|
+
whileElementsMounted: Ue
|
|
45
|
+
}), { refs: B, context: b, x: le, y: se, strategy: ce } = ae, de = Ce(b), me = _e(b), ue = Fe(b, { role: "listbox" }), j = n && u && !k && !l && !o && !c, L = Pe([...j ? [de] : [], me, ue]), p = (e) => {
|
|
46
|
+
const r = e.trim();
|
|
47
|
+
E || U(r), _ == null || _(r);
|
|
48
|
+
}, fe = (e) => {
|
|
49
|
+
var x;
|
|
50
|
+
const r = e.target.value ?? "";
|
|
51
|
+
(x = t == null ? void 0 : t.onBlur) == null || x.call(t, e);
|
|
52
|
+
const a = ye(r);
|
|
53
|
+
a !== null && a !== r && p(a);
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, [
|
|
57
|
-
const g =
|
|
58
|
-
|
|
55
|
+
H(() => {
|
|
56
|
+
m !== void 0 && U(m);
|
|
57
|
+
}, [m]);
|
|
58
|
+
const g = we.useRef(null);
|
|
59
|
+
H(() => {
|
|
59
60
|
var e;
|
|
60
|
-
(e = g.current) != null && e.inner &&
|
|
61
|
-
}, [
|
|
62
|
-
const
|
|
63
|
-
var
|
|
64
|
-
const e = (
|
|
61
|
+
(e = g.current) != null && e.inner && B.setReference(g.current.inner);
|
|
62
|
+
}, [B]);
|
|
63
|
+
const pe = () => {
|
|
64
|
+
var r;
|
|
65
|
+
const e = (r = g.current) == null ? void 0 : r.input;
|
|
65
66
|
if (e) {
|
|
66
67
|
if (typeof e.showPicker == "function") {
|
|
67
68
|
e.showPicker();
|
|
@@ -69,108 +70,109 @@ const Me = (C) => {
|
|
|
69
70
|
}
|
|
70
71
|
e.focus();
|
|
71
72
|
}
|
|
72
|
-
},
|
|
73
|
-
!
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
} : void 0, I = {
|
|
73
|
+
}, ge = () => w((e) => !e), q = () => S(!0), he = () => {
|
|
74
|
+
!n || l || (o ? pe() : c ? q() : P === "button" && ge());
|
|
75
|
+
}, z = c && u && !k ? () => {
|
|
76
|
+
q();
|
|
77
|
+
} : void 0, y = !o && n && !l && I === "dropdown" && !!(s != null && s.length), A = c ? "dialog" : "listbox", K = c ? D : T, ke = n && !o && !y && (P === "button" || c), be = n && u && !o && !y, N = {
|
|
77
78
|
...t,
|
|
78
|
-
id:
|
|
79
|
-
label:
|
|
79
|
+
id: X,
|
|
80
|
+
label: Y,
|
|
80
81
|
value: f,
|
|
81
|
-
placeholder:
|
|
82
|
-
readOnly:
|
|
83
|
-
disabled:
|
|
84
|
-
icon:
|
|
85
|
-
isClearable:
|
|
86
|
-
required:
|
|
87
|
-
onIconClick:
|
|
82
|
+
placeholder: ee,
|
|
83
|
+
readOnly: k || !o && u,
|
|
84
|
+
disabled: l || (t == null ? void 0 : t.disabled),
|
|
85
|
+
icon: n ? "schedule" : { name: "schedule", color: "inherit" },
|
|
86
|
+
isClearable: oe,
|
|
87
|
+
required: $,
|
|
88
|
+
onIconClick: n ? he : void 0,
|
|
89
|
+
iconButtonProps: {
|
|
90
|
+
"aria-label": W("time-field.open-picker"),
|
|
91
|
+
...ke && { "aria-haspopup": A, "aria-expanded": K },
|
|
92
|
+
...t == null ? void 0 : t.iconButtonProps
|
|
93
|
+
},
|
|
88
94
|
onChange: p,
|
|
89
|
-
onBlur:
|
|
90
|
-
className:
|
|
95
|
+
onBlur: fe,
|
|
96
|
+
className: O(
|
|
91
97
|
d["tedi-time-field__textfield"],
|
|
92
|
-
{ [d["tedi-time-field__icon--disabled"]]: !
|
|
93
|
-
{ [d["tedi-time-field__textfield--disabled"]]:
|
|
94
|
-
{ [d["tedi-time-field--native"]]:
|
|
98
|
+
{ [d["tedi-time-field__icon--disabled"]]: !n || l },
|
|
99
|
+
{ [d["tedi-time-field__textfield--disabled"]]: l || (t == null ? void 0 : t.disabled) },
|
|
100
|
+
{ [d["tedi-time-field--native"]]: o }
|
|
95
101
|
),
|
|
96
102
|
input: {
|
|
97
103
|
...t == null ? void 0 : t.input,
|
|
98
|
-
...
|
|
99
|
-
...
|
|
104
|
+
...o && { type: "time" },
|
|
105
|
+
...z && { onClick: z },
|
|
106
|
+
...be && { role: "combobox", "aria-haspopup": A, "aria-expanded": K }
|
|
100
107
|
}
|
|
101
108
|
};
|
|
102
|
-
if (
|
|
103
|
-
const e =
|
|
104
|
-
return /* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */ i(
|
|
109
|
+
if (y) {
|
|
110
|
+
const e = s.indexOf(f), r = e >= 0 ? e : 0;
|
|
111
|
+
return /* @__PURE__ */ G(v, { width: "trigger", defaultActiveIndex: r, children: [
|
|
112
|
+
/* @__PURE__ */ i(v.Trigger, { children: /* @__PURE__ */ i(
|
|
106
113
|
"div",
|
|
107
114
|
{
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
role: "combobox",
|
|
116
|
+
className: O(d["tedi-time-field__container"], V, {
|
|
117
|
+
[d["tedi-time-field__container--native"]]: o
|
|
110
118
|
}),
|
|
111
119
|
children: /* @__PURE__ */ i(
|
|
112
|
-
|
|
120
|
+
J,
|
|
113
121
|
{
|
|
114
122
|
ref: g,
|
|
115
|
-
...
|
|
123
|
+
...N,
|
|
116
124
|
input: {
|
|
117
|
-
...
|
|
118
|
-
...!
|
|
119
|
-
onClick: (
|
|
125
|
+
...N.input,
|
|
126
|
+
...!u && {
|
|
127
|
+
onClick: (a) => a.stopPropagation()
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
130
|
}
|
|
123
131
|
)
|
|
124
132
|
}
|
|
125
133
|
) }),
|
|
126
|
-
/* @__PURE__ */ i(
|
|
134
|
+
/* @__PURE__ */ i(v.Content, { children: s.map((a, x) => /* @__PURE__ */ i(v.Item, { index: x, active: a === f, onClick: () => p(a), children: a }, a)) })
|
|
127
135
|
] });
|
|
128
136
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
tabIndex: -1,
|
|
137
|
-
children: /* @__PURE__ */ i(A, { ref: g, "aria-expanded": o ? P : void 0, ...I })
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
u && /* @__PURE__ */ i(
|
|
141
|
-
Pe,
|
|
137
|
+
const h = {
|
|
138
|
+
...j ? L.getReferenceProps() : {}
|
|
139
|
+
};
|
|
140
|
+
return delete h.role, delete h["aria-haspopup"], delete h["aria-expanded"], delete h["aria-controls"], /* @__PURE__ */ G(xe, { children: [
|
|
141
|
+
/* @__PURE__ */ i("div", { className: O(d["tedi-time-field__container"], V), ...h, tabIndex: -1, children: /* @__PURE__ */ i(J, { ref: g, ...N }) }),
|
|
142
|
+
c && /* @__PURE__ */ i(
|
|
143
|
+
Oe,
|
|
142
144
|
{
|
|
143
|
-
open:
|
|
144
|
-
onOpenChange:
|
|
145
|
+
open: D,
|
|
146
|
+
onOpenChange: S,
|
|
145
147
|
value: f,
|
|
146
148
|
onConfirm: p,
|
|
147
|
-
stepMinutes:
|
|
148
|
-
availableTimes:
|
|
149
|
-
gridVariant:
|
|
150
|
-
modalProps:
|
|
149
|
+
stepMinutes: R,
|
|
150
|
+
availableTimes: s,
|
|
151
|
+
gridVariant: I === "grid-radio" ? "radio" : "button",
|
|
152
|
+
modalProps: te
|
|
151
153
|
}
|
|
152
154
|
),
|
|
153
|
-
!
|
|
155
|
+
!o && n && !l && !c && /* @__PURE__ */ i(Ie, { children: T && /* @__PURE__ */ i(Te, { context: b, modal: !1, initialFocus: -1, children: /* @__PURE__ */ i(
|
|
154
156
|
"div",
|
|
155
157
|
{
|
|
156
|
-
ref:
|
|
157
|
-
...
|
|
158
|
+
ref: B.setFloating,
|
|
159
|
+
...L.getFloatingProps({
|
|
158
160
|
style: {
|
|
159
|
-
position:
|
|
160
|
-
top:
|
|
161
|
-
left:
|
|
161
|
+
position: ce,
|
|
162
|
+
top: se ?? 0,
|
|
163
|
+
left: le ?? 0
|
|
162
164
|
}
|
|
163
165
|
}),
|
|
164
166
|
children: /* @__PURE__ */ i(
|
|
165
|
-
|
|
167
|
+
Be,
|
|
166
168
|
{
|
|
167
169
|
value: f,
|
|
168
|
-
stepMinutes:
|
|
169
|
-
availableTimes:
|
|
170
|
+
stepMinutes: R,
|
|
171
|
+
availableTimes: s,
|
|
170
172
|
onChange: (e) => {
|
|
171
|
-
p(e),
|
|
173
|
+
p(e), s && w(!1);
|
|
172
174
|
},
|
|
173
|
-
gridVariant:
|
|
175
|
+
gridVariant: I === "grid-radio" ? "radio" : "button",
|
|
174
176
|
className: d["tedi-time-field__picker-wrapper"]
|
|
175
177
|
}
|
|
176
178
|
)
|
|
@@ -178,7 +180,7 @@ const Me = (C) => {
|
|
|
178
180
|
) }) })
|
|
179
181
|
] });
|
|
180
182
|
};
|
|
181
|
-
|
|
183
|
+
Le.displayName = "TimeField";
|
|
182
184
|
export {
|
|
183
|
-
|
|
185
|
+
Le as TimeField
|
|
184
186
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),e=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),A=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),v=require("./dropdown.module.scss.cjs.js"),z=require("./dropdown-content/dropdown-content.cjs.js"),G=require("./dropdown-context.cjs.js"),J=require("./dropdown-helpers.cjs.js"),K=require("./dropdown-item/dropdown-item.cjs.js"),Q=require("./dropdown-separator/dropdown-separator.cjs.js"),V=require("./dropdown-trigger/dropdown-trigger.cjs.js"),X=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Y=require("../../../providers/label-provider/use-labels.cjs.js"),Z=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),h=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),ee=4,a=x=>{var O;const{getCurrentBreakpointProps:F}=X.useBreakpointProps(x.defaultServerBreakpoint),{children:P,modal:q=!1,divided:R=!1,width:b="auto",variant:p="default",open:f,defaultOpen:y=!1,onOpenChange:l,defaultActiveIndex:n,placement:g="bottom-start",maxHeight:c,className:j}=F(x),{getLabel:N}=Y.useLabels(),_=e.useFloatingNodeId(),D=t.useRef([]),[u,m]=t.useState(n??null),[w,k]=t.useState(null),[B,T]=t.useState(y),o=f??B;t.useEffect(()=>{o||m(n??null)},[o,n]);const I=t.useCallback(i=>{f===void 0&&T(i),l==null||l(i)},[f,l]),U=e.useFloating({nodeId:_,open:o,placement:g,onOpenChange:I,middleware:[h.offset(ee),h.flip(),h.shift()],whileElementsMounted:Z.autoUpdate}),{context:r,refs:s,x:H,y:L,strategy:M}=U,C=e.useInteractions([e.useClick(r),e.useRole(r,{role:"menu"}),e.useDismiss(r),e.useListNavigation(r,{listRef:D,activeIndex:u,onNavigate:m,loop:!0,selectedIndex:n??null,focusItemOnOpen:n!==null?!0:"auto"})]),W={open:o,setOpen:I,refs:s,listItemsRef:D,activeIndex:u,setActiveIndex:m,placement:g,content:w,setContent:k,divided:R,variant:p,...C},E=(O=s.reference.current)==null?void 0:O.getBoundingClientRect().width,$=t.useMemo(()=>{const i=s.reference.current;if(!i)return;const S=i.offsetParent;if(S)return S.getBoundingClientRect().width},[s.reference.current]);return d.jsxs(G.DropdownContext.Provider,{value:W,children:[P,d.jsx(e.FloatingPortal,{children:o&&d.jsx(e.FloatingFocusManager,{context:r,modal:q,visuallyHiddenDismiss:q?N("close"):!1,children:d.jsx("div",{...C.getFloatingProps({ref:s.setFloating,className:A.default(v.default["tedi-dropdown"],{[v.default[`tedi-dropdown--${p}`]]:p==="tree"},j),style:{position:M,left:H??0,top:L??0,width:J.resolveDropdownWidth(b,E,$)},role:"menu","aria-orientation":"vertical","aria-activedescendant":u!==null?`dropdown-item-${u}`:void 0}),"data-placement":g,"data-state":o?"open":"closed",children:c!==void 0?d.jsx("div",{className:v.default["tedi-dropdown__scroll"],style:{maxHeight:typeof c=="number"?`${c}px`:c},children:w}):w})})})]})};a.Trigger=V.DropdownTrigger;a.Content=z.DropdownContent;a.Item=K.DropdownItem;a.Separator=Q.DropdownSeparator;exports.Dropdown=a;
|
|
@@ -34,6 +34,14 @@ type DropdownBreakpointProps = {
|
|
|
34
34
|
* @default 'default'
|
|
35
35
|
*/
|
|
36
36
|
variant?: 'default' | 'tree';
|
|
37
|
+
/**
|
|
38
|
+
* Restricts the height of the dropdown's scrollable body. When the content is taller,
|
|
39
|
+
* the body scrolls vertically while any sticky regions (e.g. a Filter search / clear) stay pinned.
|
|
40
|
+
* - `number` – fixed max height in pixels
|
|
41
|
+
* - `string` – any valid CSS length (e.g. `'20rem'`, `'50vh'`)
|
|
42
|
+
* @default undefined (no restriction)
|
|
43
|
+
*/
|
|
44
|
+
maxHeight?: number | string;
|
|
37
45
|
};
|
|
38
46
|
export interface DropdownProps extends BreakpointSupport<DropdownBreakpointProps> {
|
|
39
47
|
/**
|
|
@@ -1,121 +1,129 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useFloatingNodeId as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as A, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useFloatingNodeId as U, useFloating as q, useInteractions as z, useClick as G, useRole as J, useDismiss as K, useListNavigation as Q, FloatingPortal as V, FloatingFocusManager as X } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import Y from "../../../../../external/classnames/index.es.js";
|
|
4
4
|
import e from "react";
|
|
5
|
-
import
|
|
6
|
-
import { DropdownContent as
|
|
7
|
-
import { DropdownContext as
|
|
8
|
-
import { resolveDropdownWidth as
|
|
9
|
-
import { DropdownItem as
|
|
10
|
-
import { DropdownSeparator as
|
|
11
|
-
import { DropdownTrigger as
|
|
12
|
-
import { useBreakpointProps as
|
|
13
|
-
import { useLabels as
|
|
14
|
-
import { autoUpdate as
|
|
15
|
-
import { offset as
|
|
16
|
-
const
|
|
17
|
-
var
|
|
18
|
-
const { getCurrentBreakpointProps:
|
|
19
|
-
children:
|
|
20
|
-
modal:
|
|
5
|
+
import v from "./dropdown.module.scss.es.js";
|
|
6
|
+
import { DropdownContent as Z } from "./dropdown-content/dropdown-content.es.js";
|
|
7
|
+
import { DropdownContext as ee } from "./dropdown-context.es.js";
|
|
8
|
+
import { resolveDropdownWidth as te } from "./dropdown-helpers.es.js";
|
|
9
|
+
import { DropdownItem as oe } from "./dropdown-item/dropdown-item.es.js";
|
|
10
|
+
import { DropdownSeparator as ne } from "./dropdown-separator/dropdown-separator.es.js";
|
|
11
|
+
import { DropdownTrigger as re } from "./dropdown-trigger/dropdown-trigger.es.js";
|
|
12
|
+
import { useBreakpointProps as ie } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
13
|
+
import { useLabels as se } from "../../../providers/label-provider/use-labels.es.js";
|
|
14
|
+
import { autoUpdate as ae } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
15
|
+
import { offset as le, flip as de, shift as ce } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
16
|
+
const me = 4, c = (h) => {
|
|
17
|
+
var O;
|
|
18
|
+
const { getCurrentBreakpointProps: F } = ie(h.defaultServerBreakpoint), {
|
|
19
|
+
children: N,
|
|
20
|
+
modal: w = !1,
|
|
21
21
|
divided: R = !1,
|
|
22
|
-
width:
|
|
23
|
-
variant:
|
|
24
|
-
open:
|
|
22
|
+
width: y = "auto",
|
|
23
|
+
variant: m = "default",
|
|
24
|
+
open: p,
|
|
25
25
|
defaultOpen: P = !1,
|
|
26
26
|
onOpenChange: s,
|
|
27
27
|
defaultActiveIndex: o,
|
|
28
28
|
placement: u = "bottom-start",
|
|
29
|
+
maxHeight: a,
|
|
29
30
|
className: S
|
|
30
|
-
} =
|
|
31
|
+
} = F(h), { getLabel: b } = se(), k = U(), x = e.useRef([]), [l, f] = e.useState(o ?? null), [g, B] = e.useState(null), [_, W] = e.useState(P), t = p ?? _;
|
|
31
32
|
e.useEffect(() => {
|
|
32
|
-
t ||
|
|
33
|
+
t || f(o ?? null);
|
|
33
34
|
}, [t, o]);
|
|
34
|
-
const
|
|
35
|
+
const D = e.useCallback(
|
|
35
36
|
(i) => {
|
|
36
|
-
|
|
37
|
+
p === void 0 && W(i), s == null || s(i);
|
|
37
38
|
},
|
|
38
|
-
[
|
|
39
|
-
), E =
|
|
40
|
-
nodeId:
|
|
39
|
+
[p, s]
|
|
40
|
+
), E = q({
|
|
41
|
+
nodeId: k,
|
|
41
42
|
open: t,
|
|
42
43
|
placement: u,
|
|
43
|
-
onOpenChange:
|
|
44
|
-
middleware: [
|
|
45
|
-
whileElementsMounted:
|
|
46
|
-
}), { context: n, refs: r, x:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
listRef:
|
|
52
|
-
activeIndex:
|
|
53
|
-
onNavigate:
|
|
44
|
+
onOpenChange: D,
|
|
45
|
+
middleware: [le(me), de(), ce()],
|
|
46
|
+
whileElementsMounted: ae
|
|
47
|
+
}), { context: n, refs: r, x: H, y: L, strategy: M } = E, I = z([
|
|
48
|
+
G(n),
|
|
49
|
+
J(n, { role: "menu" }),
|
|
50
|
+
K(n),
|
|
51
|
+
Q(n, {
|
|
52
|
+
listRef: x,
|
|
53
|
+
activeIndex: l,
|
|
54
|
+
onNavigate: f,
|
|
54
55
|
loop: !0,
|
|
55
56
|
selectedIndex: o ?? null,
|
|
56
57
|
focusItemOnOpen: o !== null ? !0 : "auto"
|
|
57
58
|
})
|
|
58
|
-
]),
|
|
59
|
+
]), T = {
|
|
59
60
|
open: t,
|
|
60
|
-
setOpen:
|
|
61
|
+
setOpen: D,
|
|
61
62
|
refs: r,
|
|
62
|
-
listItemsRef:
|
|
63
|
-
activeIndex:
|
|
64
|
-
setActiveIndex:
|
|
63
|
+
listItemsRef: x,
|
|
64
|
+
activeIndex: l,
|
|
65
|
+
setActiveIndex: f,
|
|
65
66
|
placement: u,
|
|
66
|
-
content:
|
|
67
|
+
content: g,
|
|
67
68
|
setContent: B,
|
|
68
69
|
divided: R,
|
|
69
|
-
variant:
|
|
70
|
-
...
|
|
71
|
-
},
|
|
70
|
+
variant: m,
|
|
71
|
+
...I
|
|
72
|
+
}, $ = (O = r.reference.current) == null ? void 0 : O.getBoundingClientRect().width, j = e.useMemo(() => {
|
|
72
73
|
const i = r.reference.current;
|
|
73
74
|
if (!i) return;
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
return
|
|
75
|
+
const C = i.offsetParent;
|
|
76
|
+
if (C)
|
|
77
|
+
return C.getBoundingClientRect().width;
|
|
77
78
|
}, [r.reference.current]);
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
79
|
+
return /* @__PURE__ */ A(ee.Provider, { value: T, children: [
|
|
80
|
+
N,
|
|
81
|
+
/* @__PURE__ */ d(V, { children: t && /* @__PURE__ */ d(
|
|
82
|
+
X,
|
|
82
83
|
{
|
|
83
84
|
context: n,
|
|
84
|
-
modal:
|
|
85
|
-
visuallyHiddenDismiss:
|
|
86
|
-
children: /* @__PURE__ */
|
|
85
|
+
modal: w,
|
|
86
|
+
visuallyHiddenDismiss: w ? b("close") : !1,
|
|
87
|
+
children: /* @__PURE__ */ d(
|
|
87
88
|
"div",
|
|
88
89
|
{
|
|
89
|
-
...
|
|
90
|
+
...I.getFloatingProps({
|
|
90
91
|
ref: r.setFloating,
|
|
91
|
-
className:
|
|
92
|
-
|
|
93
|
-
{ [
|
|
92
|
+
className: Y(
|
|
93
|
+
v["tedi-dropdown"],
|
|
94
|
+
{ [v[`tedi-dropdown--${m}`]]: m === "tree" },
|
|
94
95
|
S
|
|
95
96
|
),
|
|
96
97
|
style: {
|
|
97
|
-
position:
|
|
98
|
-
left:
|
|
99
|
-
top:
|
|
100
|
-
width:
|
|
98
|
+
position: M,
|
|
99
|
+
left: H ?? 0,
|
|
100
|
+
top: L ?? 0,
|
|
101
|
+
width: te(y, $, j)
|
|
101
102
|
},
|
|
102
103
|
role: "menu",
|
|
103
104
|
"aria-orientation": "vertical",
|
|
104
|
-
"aria-activedescendant":
|
|
105
|
+
"aria-activedescendant": l !== null ? `dropdown-item-${l}` : void 0
|
|
105
106
|
}),
|
|
106
107
|
"data-placement": u,
|
|
107
108
|
"data-state": t ? "open" : "closed",
|
|
108
|
-
children:
|
|
109
|
+
children: a !== void 0 ? /* @__PURE__ */ d(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: v["tedi-dropdown__scroll"],
|
|
113
|
+
style: { maxHeight: typeof a == "number" ? `${a}px` : a },
|
|
114
|
+
children: g
|
|
115
|
+
}
|
|
116
|
+
) : g
|
|
109
117
|
}
|
|
110
118
|
)
|
|
111
119
|
}
|
|
112
120
|
) })
|
|
113
121
|
] });
|
|
114
122
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
c.Trigger = re;
|
|
124
|
+
c.Content = Z;
|
|
125
|
+
c.Item = oe;
|
|
126
|
+
c.Separator = ne;
|
|
119
127
|
export {
|
|
120
|
-
|
|
128
|
+
c as Dropdown
|
|
121
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-dropdown":"tedi-dropdown-0246d37c","tedi-dropdown--tree":"tedi-dropdown--tree-c13f70ee","tedi-dropdown__item":"tedi-dropdown__item-fa7ee478"};exports.default=e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-dropdown":"tedi-dropdown-0246d37c","tedi-dropdown__scroll":"tedi-dropdown__scroll-c7d1c849","tedi-dropdown--tree":"tedi-dropdown--tree-c13f70ee","tedi-dropdown__item":"tedi-dropdown__item-fa7ee478"};exports.default=e;
|