@tedi-design-system/react 19.1.2-rc.3 → 19.2.0-rc.1

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 (33) hide show
  1. package/bundle-stats.html +1 -1
  2. package/index.css +1 -1
  3. package/package.json +1 -1
  4. package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
  5. package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +6 -0
  6. package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +126 -117
  7. package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.cjs.js +1 -1
  8. package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.es.js +2 -0
  9. package/src/tedi/components/form/select/components/select-clear-indicator.cjs.js +1 -1
  10. package/src/tedi/components/form/select/components/select-clear-indicator.es.js +21 -10
  11. package/src/tedi/components/form/select/select.cjs.js +1 -1
  12. package/src/tedi/components/form/select/select.d.ts +6 -0
  13. package/src/tedi/components/form/select/select.es.js +173 -171
  14. package/src/tedi/components/form/select/select.module.scss.cjs.js +1 -1
  15. package/src/tedi/components/form/select/select.module.scss.es.js +2 -1
  16. package/src/tedi/components/form/textarea/textarea.d.ts +1 -1
  17. package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
  18. package/src/tedi/components/form/textfield/textfield.d.ts +6 -0
  19. package/src/tedi/components/form/textfield/textfield.es.js +86 -84
  20. package/src/tedi/components/form/textfield/textfield.module.scss.cjs.js +1 -1
  21. package/src/tedi/components/form/textfield/textfield.module.scss.es.js +2 -0
  22. package/src/tedi/components/navigation/breadcrumbs/breadcrumbs.cjs.js +1 -1
  23. package/src/tedi/components/navigation/breadcrumbs/breadcrumbs.es.js +19 -10
  24. package/src/tedi/components/navigation/breadcrumbs/breadcrumbs.module.scss.cjs.js +1 -1
  25. package/src/tedi/components/navigation/breadcrumbs/breadcrumbs.module.scss.es.js +2 -1
  26. package/src/tedi/components/overlays/dropdown/dropdown-context.d.ts +8 -0
  27. package/src/tedi/components/overlays/dropdown/dropdown-item/dropdown-item.cjs.js +1 -1
  28. package/src/tedi/components/overlays/dropdown/dropdown-item/dropdown-item.es.js +46 -46
  29. package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.cjs.js +1 -1
  30. package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.es.js +7 -6
  31. package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
  32. package/src/tedi/components/overlays/dropdown/dropdown.d.ts +8 -0
  33. package/src/tedi/components/overlays/dropdown/dropdown.es.js +95 -87
@@ -78,6 +78,14 @@ export interface DropdownProps extends BreakpointSupport<DropdownBreakpointProps
78
78
  * the user has to press an arrow key to start navigating.
79
79
  */
80
80
  defaultActiveIndex?: number;
81
+ /**
82
+ * Navigation mode — use when the dropdown lists **links** (e.g. collapsed breadcrumbs) rather than
83
+ * menu commands. Drops the `menu` / `menuitem` roles, `aria-haspopup="menu"` and roving tabindex, so
84
+ * screen readers announce the items as links and each is a normal Tab stop. Keep it `false` (default)
85
+ * for action menus.
86
+ * @default false
87
+ */
88
+ navigation?: boolean;
81
89
  className?: string;
82
90
  }
83
91
  export declare const Dropdown: {
@@ -1,131 +1,139 @@
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";
1
+ import { jsxs as q, jsx as c } from "react/jsx-runtime";
2
+ import { useFloatingNodeId as z, useFloating as G, useInteractions as J, useClick as K, useRole as Q, useDismiss as V, useListNavigation as X, FloatingPortal as Y, FloatingFocusManager as Z } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import ee from "../../../../../external/classnames/index.es.js";
4
4
  import e from "react";
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
- divided: R = !1,
22
- width: y = "auto",
23
- variant: m = "default",
5
+ import h from "./dropdown.module.scss.es.js";
6
+ import { DropdownContent as te } from "./dropdown-content/dropdown-content.es.js";
7
+ import { DropdownContext as oe } from "./dropdown-context.es.js";
8
+ import { resolveDropdownWidth as ne } from "./dropdown-helpers.es.js";
9
+ import { DropdownItem as re } from "./dropdown-item/dropdown-item.es.js";
10
+ import { DropdownSeparator as ie } from "./dropdown-separator/dropdown-separator.es.js";
11
+ import { DropdownTrigger as se } from "./dropdown-trigger/dropdown-trigger.es.js";
12
+ import { useBreakpointProps as ae } from "../../../helpers/hooks/use-breakpoint-props.es.js";
13
+ import { useLabels as le } from "../../../providers/label-provider/use-labels.es.js";
14
+ import { autoUpdate as de } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
15
+ import { offset as ce, flip as me, shift as ue } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
16
+ const pe = 4, m = (w) => {
17
+ var F;
18
+ const { getCurrentBreakpointProps: N } = ae(w.defaultServerBreakpoint), {
19
+ children: R,
20
+ modal: I = !1,
21
+ divided: y = !1,
22
+ width: P = "auto",
23
+ variant: u = "default",
24
24
  open: p,
25
- defaultOpen: P = !1,
25
+ defaultOpen: S = !1,
26
26
  onOpenChange: s,
27
27
  defaultActiveIndex: o,
28
- placement: u = "bottom-start",
28
+ placement: f = "bottom-start",
29
29
  maxHeight: a,
30
- className: S
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 ?? _;
30
+ navigation: l = !1,
31
+ className: k
32
+ } = N(w), { getLabel: B } = le(), _ = z(), x = e.useId(), D = e.useRef([]), [d, g] = e.useState(o ?? null), [v, W] = e.useState(null), [E, H] = e.useState(S), t = p ?? E;
32
33
  e.useEffect(() => {
33
- t || f(o ?? null);
34
+ t || g(o ?? null);
34
35
  }, [t, o]);
35
- const I = e.useCallback(
36
+ const O = e.useCallback(
36
37
  (i) => {
37
- p === void 0 && W(i), s == null || s(i);
38
+ p === void 0 && H(i), s == null || s(i);
38
39
  },
39
40
  [p, s]
40
- ), E = q({
41
- nodeId: k,
41
+ ), L = G({
42
+ nodeId: _,
42
43
  open: t,
43
- placement: u,
44
- onOpenChange: I,
45
- middleware: [le(me), de(), ce()],
46
- whileElementsMounted: ae
47
- }), { context: n, refs: r, x: H, y: L, strategy: M } = E, D = z([
48
- G(n),
49
- J(n, { role: "menu" }),
44
+ placement: f,
45
+ onOpenChange: O,
46
+ middleware: [ce(pe), me(), ue()],
47
+ whileElementsMounted: de
48
+ }), { context: n, refs: r, x: M, y: T, strategy: $ } = L, C = J([
50
49
  K(n),
51
- Q(n, {
52
- listRef: x,
53
- activeIndex: l,
54
- onNavigate: f,
50
+ // In navigation mode the popup is a list of links, not a menu — disable the menu role and the
51
+ // roving-tabindex list navigation so items stay plain, tabbable links.
52
+ Q(n, { role: "menu", enabled: !l }),
53
+ V(n),
54
+ X(n, {
55
+ listRef: D,
56
+ activeIndex: d,
57
+ onNavigate: g,
55
58
  loop: !0,
56
59
  selectedIndex: o ?? null,
57
- focusItemOnOpen: o !== null ? !0 : "auto"
60
+ focusItemOnOpen: o !== null ? !0 : "auto",
61
+ enabled: !l
58
62
  })
59
- ]), T = {
63
+ ]), j = {
60
64
  open: t,
61
- setOpen: I,
65
+ setOpen: O,
62
66
  refs: r,
63
- listItemsRef: x,
64
- activeIndex: l,
65
- setActiveIndex: f,
66
- placement: u,
67
- content: g,
68
- setContent: B,
69
- divided: R,
70
- variant: m,
71
- ...D
72
- }, $ = (O = r.reference.current) == null ? void 0 : O.getBoundingClientRect().width, j = e.useMemo(() => {
67
+ listItemsRef: D,
68
+ activeIndex: d,
69
+ setActiveIndex: g,
70
+ placement: f,
71
+ content: v,
72
+ setContent: W,
73
+ divided: y,
74
+ variant: u,
75
+ navigation: l,
76
+ contentId: x,
77
+ ...C
78
+ }, A = (F = r.reference.current) == null ? void 0 : F.getBoundingClientRect().width, U = e.useMemo(() => {
73
79
  const i = r.reference.current;
74
80
  if (!i) return;
75
- const C = i.offsetParent;
76
- if (C)
77
- return C.getBoundingClientRect().width;
81
+ const b = i.offsetParent;
82
+ if (b)
83
+ return b.getBoundingClientRect().width;
78
84
  }, [r.reference.current]);
79
- return /* @__PURE__ */ A(ee.Provider, { value: T, children: [
80
- N,
81
- /* @__PURE__ */ d(V, { children: t && /* @__PURE__ */ d(
82
- X,
85
+ return /* @__PURE__ */ q(oe.Provider, { value: j, children: [
86
+ R,
87
+ /* @__PURE__ */ c(Y, { children: t && /* @__PURE__ */ c(
88
+ Z,
83
89
  {
84
90
  context: n,
85
- modal: w,
86
- visuallyHiddenDismiss: w ? b("close") : !1,
87
- children: /* @__PURE__ */ d(
91
+ modal: I,
92
+ visuallyHiddenDismiss: I ? B("close") : !1,
93
+ children: /* @__PURE__ */ c(
88
94
  "div",
89
95
  {
90
- ...D.getFloatingProps({
96
+ ...C.getFloatingProps({
91
97
  ref: r.setFloating,
92
- className: Y(
93
- v["tedi-dropdown"],
94
- { [v[`tedi-dropdown--${m}`]]: m === "tree" },
95
- S
98
+ className: ee(
99
+ h["tedi-dropdown"],
100
+ { [h[`tedi-dropdown--${u}`]]: u === "tree" },
101
+ k
96
102
  ),
97
103
  style: {
98
- position: M,
99
- left: H ?? 0,
100
- top: L ?? 0,
101
- width: te(y, $, j)
104
+ position: $,
105
+ left: M ?? 0,
106
+ top: T ?? 0,
107
+ width: ne(P, A, U)
102
108
  },
103
- role: "menu",
104
- "aria-orientation": "vertical",
105
- "aria-activedescendant": l !== null ? `dropdown-item-${l}` : void 0
109
+ ...l ? { id: x } : {
110
+ role: "menu",
111
+ "aria-orientation": "vertical",
112
+ "aria-activedescendant": d !== null ? `dropdown-item-${d}` : void 0
113
+ }
106
114
  }),
107
- "data-placement": u,
115
+ "data-placement": f,
108
116
  "data-state": t ? "open" : "closed",
109
- children: a !== void 0 ? /* @__PURE__ */ d(
117
+ children: a !== void 0 ? /* @__PURE__ */ c(
110
118
  "div",
111
119
  {
112
- className: v["tedi-dropdown__scroll"],
120
+ className: h["tedi-dropdown__scroll"],
113
121
  role: "group",
114
122
  tabIndex: 0,
115
123
  style: { maxHeight: typeof a == "number" ? `${a}px` : a },
116
- children: g
124
+ children: v
117
125
  }
118
- ) : g
126
+ ) : v
119
127
  }
120
128
  )
121
129
  }
122
130
  ) })
123
131
  ] });
124
132
  };
125
- c.Trigger = re;
126
- c.Content = Z;
127
- c.Item = oe;
128
- c.Separator = ne;
133
+ m.Trigger = se;
134
+ m.Content = te;
135
+ m.Item = re;
136
+ m.Separator = ie;
129
137
  export {
130
- c as Dropdown
138
+ m as Dropdown
131
139
  };