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