@tedi-design-system/react 19.1.0-rc.2 → 19.1.0-rc.3

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.
@@ -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
  };