@tedi-design-system/react 19.0.0-rc.3 → 19.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedi-design-system/react",
3
- "version": "19.0.0-rc.3",
3
+ "version": "19.0.0-rc.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),o=require("react"),I=require("../../base/icon/icon.cjs.js"),M=require("../../buttons/button/button.cjs.js"),t=require("./breadcrumbs.module.scss.cjs.js"),P=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),S=require("../../../providers/label-provider/use-labels.cjs.js"),d=require("../../overlays/dropdown/dropdown.cjs.js"),N=n=>{const l=[];return o.Children.forEach(n,a=>{if(o.isValidElement(a)){if(a.type===o.Fragment){l.push(...N(a.props.children));return}l.push(a)}}),l},D=e.jsx(I.Icon,{name:"chevron_right",size:16,color:"brand"}),k=n=>{const{children:l,ariaLabel:a,showMoreLabel:w,separator:B=D,className:h}=n,{getCurrentBreakpointProps:C}=P.useBreakpointProps(n.defaultServerBreakpoint),{variant:q="long",maxItems:p,itemsBeforeCollapse:v=1,itemsAfterCollapse:y=1}=C(n),{getLabel:f}=S.useLabels(),x=a??f("breadcrumbs"),L=w??f("breadcrumbs.show-more"),s=N(l);if(s.length===0)return null;if(q==="short"){if(s.length<2)return null;const r=s[s.length-2],i=r.props,c=typeof r.type!="string"&&i.iconLeft===void 0?o.cloneElement(r,{iconLeft:"arrow_back"}):r;return e.jsx("nav",{"aria-label":x,className:b.default(t.default["tedi-breadcrumbs"],h),children:e.jsx("ol",{className:t.default["tedi-breadcrumbs__list"],children:e.jsx("li",{className:t.default["tedi-breadcrumbs__item"],children:c})})})}const u=Math.max(0,v),m=Math.max(1,y),g=p!==void 0&&s.length>p&&s.length>u+m?[...s.slice(0,u).map(r=>({kind:"item",element:r})),{kind:"ellipsis",hidden:s.slice(u,s.length-m)},...s.slice(s.length-m).map(r=>({kind:"item",element:r}))]:s.map(r=>({kind:"item",element:r})),j=g.length-1;return e.jsx("nav",{"aria-label":x,className:b.default(t.default["tedi-breadcrumbs"],h),children:e.jsx("ol",{className:t.default["tedi-breadcrumbs__list"],children:g.map((r,i)=>e.jsxs(o.Fragment,{children:[r.kind==="item"?e.jsx("li",{className:b.default(t.default["tedi-breadcrumbs__item"],{[t.default["tedi-breadcrumbs__current"]]:i===j}),children:r.element}):e.jsx("li",{className:t.default["tedi-breadcrumbs__item"],children:e.jsxs(d.Dropdown,{children:[e.jsx(d.Dropdown.Trigger,{children:e.jsxs(M.Button,{noStyle:!0,className:t.default["tedi-breadcrumbs__ellipsis"],children:[e.jsx("span",{"aria-hidden":"true",children:"…"}),e.jsx("span",{className:"sr-only",children:L})]})}),e.jsx(d.Dropdown.Content,{children:r.hidden.map((c,_)=>e.jsx(d.Dropdown.Item,{index:_,asChild:!0,children:c},c.key??_))})]})}),i<j&&e.jsx("li",{className:t.default["tedi-breadcrumbs__separator"],"aria-hidden":"true",children:B})]},i))})})};k.displayName="Breadcrumbs";exports.Breadcrumbs=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("../../../../../external/classnames/index.cjs.js"),l=require("react"),S=require("../../base/icon/icon.cjs.js"),M=require("../../buttons/button/button.cjs.js"),t=require("./breadcrumbs.module.scss.cjs.js"),P=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),D=require("../../../providers/label-provider/use-labels.cjs.js"),d=require("../../overlays/dropdown/dropdown.cjs.js"),y=i=>{const o=[];return l.Children.forEach(i,a=>{if(l.isValidElement(a)){if(a.type===l.Fragment){o.push(...y(a.props.children));return}o.push(a)}}),o},E=e.jsx(S.Icon,{name:"chevron_right",size:16,color:"brand"}),N=i=>{const{children:o,ariaLabel:a,showMoreLabel:k,separator:w=E,className:p}=i,{getCurrentBreakpointProps:B}=P.useBreakpointProps(i.defaultServerBreakpoint),{variant:q="long",maxItems:h,itemsBeforeCollapse:v=1,itemsAfterCollapse:C=1}=B(i),{getLabel:f}=D.useLabels(),x=a??f("breadcrumbs"),L=k??f("breadcrumbs.show-more"),s=y(o);if(s.length===0)return null;if(q==="short"){if(s.length<2)return null;const r=s[s.length-2],c=r.props,n=typeof r.type!="string"&&c.iconLeft===void 0?l.cloneElement(r,{iconLeft:"arrow_back"}):r;return e.jsx("nav",{"aria-label":x,className:b.default(t.default["tedi-breadcrumbs"],p),children:e.jsx("ol",{className:t.default["tedi-breadcrumbs__list"],children:e.jsx("li",{className:t.default["tedi-breadcrumbs__item"],children:n})})})}const u=Math.max(0,v),m=Math.max(1,C),g=h!==void 0&&s.length>h&&s.length>u+m?[...s.slice(0,u).map(r=>({kind:"item",element:r})),{kind:"ellipsis",hidden:s.slice(u,s.length-m)},...s.slice(s.length-m).map(r=>({kind:"item",element:r}))]:s.map(r=>({kind:"item",element:r})),j=g.length-1;return e.jsx("nav",{"aria-label":x,className:b.default(t.default["tedi-breadcrumbs"],p),children:e.jsx("ol",{className:t.default["tedi-breadcrumbs__list"],children:g.map((r,c)=>e.jsxs(l.Fragment,{children:[r.kind==="item"?e.jsx("li",{className:b.default(t.default["tedi-breadcrumbs__item"],{[t.default["tedi-breadcrumbs__current"]]:c===j}),children:r.element}):e.jsx("li",{className:t.default["tedi-breadcrumbs__item"],children:e.jsxs(d.Dropdown,{children:[e.jsx(d.Dropdown.Trigger,{children:e.jsxs(M.Button,{noStyle:!0,className:t.default["tedi-breadcrumbs__ellipsis"],children:[e.jsx("span",{"aria-hidden":"true",children:"…"}),e.jsx("span",{className:"sr-only",children:L})]})}),e.jsx(d.Dropdown.Content,{children:r.hidden.map((n,_)=>{const I=typeof n.type!="string"?l.cloneElement(n,{noStyle:!0}):n;return e.jsx(d.Dropdown.Item,{index:_,asChild:!0,children:I},n.key??_)})})]})}),c<j&&e.jsx("li",{className:t.default["tedi-breadcrumbs__separator"],"aria-hidden":"true",children:w})]},c))})})};N.displayName="Breadcrumbs";exports.Breadcrumbs=N;
@@ -1,37 +1,37 @@
1
1
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
- import h from "../../../../../external/classnames/index.es.js";
3
- import { cloneElement as E, Fragment as k, Children as P, isValidElement as S } from "react";
4
- import { Icon as j } from "../../base/icon/icon.es.js";
5
- import { Button as A } from "../../buttons/button/button.es.js";
2
+ import u from "../../../../../external/classnames/index.es.js";
3
+ import { cloneElement as k, Fragment as C, Children as P, isValidElement as j } from "react";
4
+ import { Icon as A } from "../../base/icon/icon.es.js";
5
+ import { Button as T } from "../../buttons/button/button.es.js";
6
6
  import s from "./breadcrumbs.module.scss.es.js";
7
- import { useBreakpointProps as T } from "../../../helpers/hooks/use-breakpoint-props.es.js";
8
- import { useLabels as z } from "../../../providers/label-provider/use-labels.es.js";
7
+ import { useBreakpointProps as z } from "../../../helpers/hooks/use-breakpoint-props.es.js";
8
+ import { useLabels as D } from "../../../providers/label-provider/use-labels.es.js";
9
9
  import { Dropdown as c } from "../../overlays/dropdown/dropdown.es.js";
10
10
  const v = (l) => {
11
- const n = [];
11
+ const i = [];
12
12
  return P.forEach(l, (a) => {
13
- if (S(a)) {
14
- if (a.type === k) {
15
- n.push(...v(a.props.children));
13
+ if (j(a)) {
14
+ if (a.type === C) {
15
+ i.push(...v(a.props.children));
16
16
  return;
17
17
  }
18
- n.push(a);
18
+ i.push(a);
19
19
  }
20
- }), n;
21
- }, D = /* @__PURE__ */ r(j, { name: "chevron_right", size: 16, color: "brand" }), F = (l) => {
22
- const { children: n, ariaLabel: a, showMoreLabel: y, separator: B = D, className: u } = l, { getCurrentBreakpointProps: L } = T(l.defaultServerBreakpoint), {
23
- variant: w = "long",
20
+ }), i;
21
+ }, F = /* @__PURE__ */ r(A, { name: "chevron_right", size: 16, color: "brand" }), V = (l) => {
22
+ const { children: i, ariaLabel: a, showMoreLabel: B, separator: L = F, className: h } = l, { getCurrentBreakpointProps: w } = z(l.defaultServerBreakpoint), {
23
+ variant: x = "long",
24
24
  maxItems: b,
25
- itemsBeforeCollapse: x = 1,
26
- itemsAfterCollapse: I = 1
27
- } = L(l), { getLabel: f } = z(), _ = a ?? f("breadcrumbs"), M = y ?? f("breadcrumbs.show-more"), t = v(n);
25
+ itemsBeforeCollapse: I = 1,
26
+ itemsAfterCollapse: M = 1
27
+ } = w(l), { getLabel: f } = D(), _ = a ?? f("breadcrumbs"), S = B ?? f("breadcrumbs.show-more"), t = v(i);
28
28
  if (t.length === 0) return null;
29
- if (w === "short") {
29
+ if (x === "short") {
30
30
  if (t.length < 2) return null;
31
- const e = t[t.length - 2], i = e.props, o = typeof e.type != "string" && i.iconLeft === void 0 ? E(e, { iconLeft: "arrow_back" }) : e;
32
- return /* @__PURE__ */ r("nav", { "aria-label": _, className: h(s["tedi-breadcrumbs"], u), children: /* @__PURE__ */ r("ol", { className: s["tedi-breadcrumbs__list"], children: /* @__PURE__ */ r("li", { className: s["tedi-breadcrumbs__item"], children: o }) }) });
31
+ const e = t[t.length - 2], o = e.props, n = typeof e.type != "string" && o.iconLeft === void 0 ? k(e, { iconLeft: "arrow_back" }) : e;
32
+ return /* @__PURE__ */ r("nav", { "aria-label": _, className: u(s["tedi-breadcrumbs"], h), children: /* @__PURE__ */ r("ol", { className: s["tedi-breadcrumbs__list"], children: /* @__PURE__ */ r("li", { className: s["tedi-breadcrumbs__item"], children: n }) }) });
33
33
  }
34
- const m = Math.max(0, x), d = Math.max(1, I), g = b !== void 0 && t.length > b && t.length > m + d ? [
34
+ const m = Math.max(0, I), d = Math.max(1, M), g = b !== void 0 && t.length > b && t.length > m + d ? [
35
35
  ...t.slice(0, m).map((e) => ({ kind: "item", element: e })),
36
36
  {
37
37
  kind: "ellipsis",
@@ -39,26 +39,29 @@ const v = (l) => {
39
39
  },
40
40
  ...t.slice(t.length - d).map((e) => ({ kind: "item", element: e }))
41
41
  ] : t.map((e) => ({ kind: "item", element: e })), N = g.length - 1;
42
- return /* @__PURE__ */ r("nav", { "aria-label": _, className: h(s["tedi-breadcrumbs"], u), children: /* @__PURE__ */ r("ol", { className: s["tedi-breadcrumbs__list"], children: g.map((e, i) => /* @__PURE__ */ p(k, { children: [
42
+ return /* @__PURE__ */ r("nav", { "aria-label": _, className: u(s["tedi-breadcrumbs"], h), children: /* @__PURE__ */ r("ol", { className: s["tedi-breadcrumbs__list"], children: g.map((e, o) => /* @__PURE__ */ p(C, { children: [
43
43
  e.kind === "item" ? /* @__PURE__ */ r(
44
44
  "li",
45
45
  {
46
- className: h(s["tedi-breadcrumbs__item"], {
47
- [s["tedi-breadcrumbs__current"]]: i === N
46
+ className: u(s["tedi-breadcrumbs__item"], {
47
+ [s["tedi-breadcrumbs__current"]]: o === N
48
48
  }),
49
49
  children: e.element
50
50
  }
51
51
  ) : /* @__PURE__ */ r("li", { className: s["tedi-breadcrumbs__item"], children: /* @__PURE__ */ p(c, { children: [
52
- /* @__PURE__ */ r(c.Trigger, { children: /* @__PURE__ */ p(A, { noStyle: !0, className: s["tedi-breadcrumbs__ellipsis"], children: [
52
+ /* @__PURE__ */ r(c.Trigger, { children: /* @__PURE__ */ p(T, { noStyle: !0, className: s["tedi-breadcrumbs__ellipsis"], children: [
53
53
  /* @__PURE__ */ r("span", { "aria-hidden": "true", children: "…" }),
54
- /* @__PURE__ */ r("span", { className: "sr-only", children: M })
54
+ /* @__PURE__ */ r("span", { className: "sr-only", children: S })
55
55
  ] }) }),
56
- /* @__PURE__ */ r(c.Content, { children: e.hidden.map((o, C) => /* @__PURE__ */ r(c.Item, { index: C, asChild: !0, children: o }, o.key ?? C)) })
56
+ /* @__PURE__ */ r(c.Content, { children: e.hidden.map((n, y) => {
57
+ const E = typeof n.type != "string" ? k(n, { noStyle: !0 }) : n;
58
+ return /* @__PURE__ */ r(c.Item, { index: y, asChild: !0, children: E }, n.key ?? y);
59
+ }) })
57
60
  ] }) }),
58
- i < N && /* @__PURE__ */ r("li", { className: s["tedi-breadcrumbs__separator"], "aria-hidden": "true", children: B })
59
- ] }, i)) }) });
61
+ o < N && /* @__PURE__ */ r("li", { className: s["tedi-breadcrumbs__separator"], "aria-hidden": "true", children: L })
62
+ ] }, o)) }) });
60
63
  };
61
- F.displayName = "Breadcrumbs";
64
+ V.displayName = "Breadcrumbs";
62
65
  export {
63
- F as Breadcrumbs
66
+ V as Breadcrumbs
64
67
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),K=require("../../../../../../external/classnames/index.cjs.js"),R=require("../dropdown-context.cjs.js"),r=require("./dropdown-item.module.scss.cjs.js"),S=({children:c,onClick:t,disabled:n,active:w,index:u,indent:i,asChild:o=!1,closeOnSelect:p=!0,isParent:y=!1,className:_,role:s,...l})=>{const{getItemProps:v,listItemsRef:b,setOpen:f,activeIndex:x,divided:I,variant:a}=R.useDropdownContext(),g=o?"div":"button",q=e=>typeof e!="number"||e<=0?{}:{"--dropdown-indent-level":e,"--dropdown-indent":`${e}rem`},D=e=>{if(n)return;const d=e.currentTarget.querySelector('input[type="checkbox"], input[type="radio"]');if(d){d.click();return}o?t==null||t(e):(t==null||t(e),p&&f(!1))},P=e=>{if(!n&&(e.key==="Enter"||e.key===" ")){e.preventDefault();const d=e.currentTarget.querySelector('input[type="checkbox"], input[type="radio"]');d?d.click():t==null||t(e),!o&&p&&f(!1)}},m={ref(e){typeof u=="number"&&(b.current[u]=e)},tabIndex:x===u?0:-1,className:K.default(r.default["tedi-dropdown__item"],{[r.default["tedi-dropdown__item--active"]]:w,[r.default["tedi-dropdown__item--disabled"]]:n,[r.default["tedi-dropdown__item--divided"]]:I,[r.default["tedi-dropdown__item--indent"]]:i,[r.default["tedi-dropdown__item--tree-item"]]:a==="tree"&&i,[r.default["tedi-dropdown__item--tree-parent"]]:a==="tree"&&y},_),style:q(i),onClick:D,onKeyDown:P,...l},j=o&&p===!1?{...m,role:s}:v({role:s??"menuitem",disabled:o?void 0:n,...m});return T.jsx(g,{...j,children:c})};exports.DropdownItem=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),U=require("../../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),D=require("../../../../../../external/classnames/index.cjs.js"),m=require("react"),z=require("../dropdown-context.cjs.js"),u=require("./dropdown-item.module.scss.cjs.js"),g=(n,t)=>r=>{n==null||n(r),r.defaultPrevented||t==null||t(r)},A=({children:n,onClick:t,disabled:r,active:x,index:d,indent:p,asChild:s=!1,closeOnSelect:f=!0,isParent:I=!1,className:b,role:y,...q})=>{const{getItemProps:R,listItemsRef:P,setOpen:a,activeIndex:k,divided:E,variant:l}=z.useDropdownContext(),K=s?"div":"button",c=s&&f!==!1&&m.isValidElement(n),w=e=>{typeof d=="number"&&(P.current[d]=e)},N=m.isValidElement(n)?n.ref:void 0,T=U.useMergeRefs([w,N]),j=e=>typeof e!="number"||e<=0?{}:{"--dropdown-indent-level":e,"--dropdown-indent":`${e}rem`},V=e=>{if(r){e.preventDefault();return}const o=e.currentTarget.querySelector('input[type="checkbox"], input[type="radio"]');if(o){o.click();return}t==null||t(e),(!s||c)&&f&&a(!1)},M=e=>{if(r){(e.key==="Enter"||e.key===" ")&&e.preventDefault();return}if(e.key==="Enter"||e.key===" "){const o=e.currentTarget.querySelector('input[type="checkbox"], input[type="radio"]');if(o){e.preventDefault(),o.click(),!s&&f&&a(!1);return}if(c){e.preventDefault(),e.currentTarget.click();return}e.preventDefault(),t==null||t(e),!s&&f&&a(!1)}},_={ref:w,tabIndex:k===d?0:-1,className:D.default(u.default["tedi-dropdown__item"],{[u.default["tedi-dropdown__item--active"]]:x,[u.default["tedi-dropdown__item--disabled"]]:r,[u.default["tedi-dropdown__item--divided"]]:E,[u.default["tedi-dropdown__item--indent"]]:p,[u.default["tedi-dropdown__item--tree-item"]]:l==="tree"&&p,[u.default["tedi-dropdown__item--tree-parent"]]:l==="tree"&&I},b),style:j(p),onClick:V,onKeyDown:M,...q},v=s&&f===!1?{..._,role:y}:R({role:y??"menuitem",disabled:s?void 0:r,..._});if(c){const e=n,o=e.props,i=v;return m.cloneElement(e,{...i,ref:T,className:D.default(i.className,o.className),style:{...i.style,...o.style},"aria-disabled":r||void 0,tabIndex:r?-1:i.tabIndex,onClick:g(i.onClick,o.onClick),onKeyDown:g(i.onKeyDown,o.onKeyDown)})}return S.jsx(K,{...v,children:n})};exports.DropdownItem=A;
@@ -34,10 +34,14 @@ export type DropdownItemProps = {
34
34
  */
35
35
  indent?: number;
36
36
  /**
37
- * When `true`, renders a plain `<div>` instead of a `<button>`.
38
- * Useful when wrapping form controls like `<Checkbox>` or `<Radio>` that already handle their own events.
39
- * **Warning:** When `asChild={true}`, the item is no longer focusable via keyboard navigation
40
- * unless the child element itself is focusable.
37
+ * Render the item as its child element instead of a `<button>`.
38
+ *
39
+ * - **Navigable child (default `closeOnSelect`)** — e.g. a `Link`: the item props (`role`,
40
+ * roving `tabindex`, handlers, styles) are merged directly onto the child so it becomes the
41
+ * single focusable `menuitem`. This avoids a focusable wrapper *and* a focusable child (a
42
+ * double Tab stop) and keeps the role and accessible name on one element.
43
+ * - **Form control (`closeOnSelect={false}`)** — e.g. a `Checkbox` / `Radio`: the child is
44
+ * wrapped in a plain `<div>` menuitem that forwards activation to the inner control.
41
45
  *
42
46
  * @default false
43
47
  */
@@ -1,70 +1,101 @@
1
- import { jsx as T } from "react/jsx-runtime";
2
- import j from "../../../../../../external/classnames/index.es.js";
3
- import { useDropdownContext as E } from "../dropdown-context.es.js";
4
- import r from "./dropdown-item.module.scss.es.js";
5
- const l = ({
6
- children: y,
7
- onClick: t,
8
- disabled: n,
9
- active: _,
10
- index: d,
11
- indent: i,
12
- asChild: o = !1,
13
- closeOnSelect: s = !0,
14
- isParent: w = !1,
15
- className: c,
16
- role: m,
17
- ...v
1
+ import { jsx as $ } from "react/jsx-runtime";
2
+ import { useMergeRefs as z } from "../../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import D from "../../../../../../external/classnames/index.es.js";
4
+ import { isValidElement as I, cloneElement as A } from "react";
5
+ import { useDropdownContext as B } from "../dropdown-context.es.js";
6
+ import p from "./dropdown-item.module.scss.es.js";
7
+ const b = (n, e) => (o) => {
8
+ n == null || n(o), o.defaultPrevented || e == null || e(o);
9
+ }, W = ({
10
+ children: n,
11
+ onClick: e,
12
+ disabled: o,
13
+ active: g,
14
+ index: m,
15
+ indent: u,
16
+ asChild: s = !1,
17
+ closeOnSelect: i = !0,
18
+ isParent: l = !1,
19
+ className: x,
20
+ role: d,
21
+ ...k
18
22
  }) => {
19
- const { getItemProps: b, listItemsRef: x, setOpen: f, activeIndex: D, divided: I, variant: u } = E(), g = o ? "div" : "button", P = (e) => typeof e != "number" || e <= 0 ? {} : {
20
- "--dropdown-indent-level": e,
21
- "--dropdown-indent": `${e}rem`
22
- }, q = (e) => {
23
- if (n) return;
24
- const p = e.currentTarget.querySelector(
23
+ const { getItemProps: K, listItemsRef: N, setOpen: a, activeIndex: P, divided: R, variant: y } = B(), E = s ? "div" : "button", c = s && i !== !1 && I(n), w = (t) => {
24
+ typeof m == "number" && (N.current[m] = t);
25
+ }, T = I(n) ? n.ref : void 0, q = z([w, T]), V = (t) => typeof t != "number" || t <= 0 ? {} : {
26
+ "--dropdown-indent-level": t,
27
+ "--dropdown-indent": `${t}rem`
28
+ }, j = (t) => {
29
+ if (o) {
30
+ t.preventDefault();
31
+ return;
32
+ }
33
+ const r = t.currentTarget.querySelector(
25
34
  'input[type="checkbox"], input[type="radio"]'
26
35
  );
27
- if (p) {
28
- p.click();
36
+ if (r) {
37
+ r.click();
38
+ return;
39
+ }
40
+ e == null || e(t), (!s || c) && i && a(!1);
41
+ }, M = (t) => {
42
+ if (o) {
43
+ (t.key === "Enter" || t.key === " ") && t.preventDefault();
29
44
  return;
30
45
  }
31
- o ? t == null || t(e) : (t == null || t(e), s && f(!1));
32
- }, K = (e) => {
33
- if (!n && (e.key === "Enter" || e.key === " ")) {
34
- e.preventDefault();
35
- const p = e.currentTarget.querySelector(
46
+ if (t.key === "Enter" || t.key === " ") {
47
+ const r = t.currentTarget.querySelector(
36
48
  'input[type="checkbox"], input[type="radio"]'
37
49
  );
38
- p ? p.click() : t == null || t(e), !o && s && f(!1);
50
+ if (r) {
51
+ t.preventDefault(), r.click(), !s && i && a(!1);
52
+ return;
53
+ }
54
+ if (c) {
55
+ t.preventDefault(), t.currentTarget.click();
56
+ return;
57
+ }
58
+ t.preventDefault(), e == null || e(t), !s && i && a(!1);
39
59
  }
40
- }, a = {
41
- ref(e) {
42
- typeof d == "number" && (x.current[d] = e);
43
- },
44
- tabIndex: D === d ? 0 : -1,
45
- className: j(
46
- r["tedi-dropdown__item"],
60
+ }, v = {
61
+ ref: w,
62
+ tabIndex: P === m ? 0 : -1,
63
+ className: D(
64
+ p["tedi-dropdown__item"],
47
65
  {
48
- [r["tedi-dropdown__item--active"]]: _,
49
- [r["tedi-dropdown__item--disabled"]]: n,
50
- [r["tedi-dropdown__item--divided"]]: I,
51
- [r["tedi-dropdown__item--indent"]]: i,
52
- [r["tedi-dropdown__item--tree-item"]]: u === "tree" && i,
53
- [r["tedi-dropdown__item--tree-parent"]]: u === "tree" && w
66
+ [p["tedi-dropdown__item--active"]]: g,
67
+ [p["tedi-dropdown__item--disabled"]]: o,
68
+ [p["tedi-dropdown__item--divided"]]: R,
69
+ [p["tedi-dropdown__item--indent"]]: u,
70
+ [p["tedi-dropdown__item--tree-item"]]: y === "tree" && u,
71
+ [p["tedi-dropdown__item--tree-parent"]]: y === "tree" && l
54
72
  },
55
- c
73
+ x
56
74
  ),
57
- style: P(i),
58
- onClick: q,
59
- onKeyDown: K,
75
+ style: V(u),
76
+ onClick: j,
77
+ onKeyDown: M,
78
+ ...k
79
+ }, _ = s && i === !1 ? { ...v, role: d } : K({
80
+ role: d ?? "menuitem",
81
+ disabled: s ? void 0 : o,
60
82
  ...v
61
- }, N = o && s === !1 ? { ...a, role: m } : b({
62
- role: m ?? "menuitem",
63
- disabled: o ? void 0 : n,
64
- ...a
65
83
  });
66
- return /* @__PURE__ */ T(g, { ...N, children: y });
84
+ if (c) {
85
+ const t = n, r = t.props, f = _;
86
+ return A(t, {
87
+ ...f,
88
+ ref: q,
89
+ className: D(f.className, r.className),
90
+ style: { ...f.style, ...r.style },
91
+ "aria-disabled": o || void 0,
92
+ tabIndex: o ? -1 : f.tabIndex,
93
+ onClick: b(f.onClick, r.onClick),
94
+ onKeyDown: b(f.onKeyDown, r.onKeyDown)
95
+ });
96
+ }
97
+ return /* @__PURE__ */ $(E, { ..._, children: n });
67
98
  };
68
99
  export {
69
- l as DropdownItem
100
+ W as DropdownItem
70
101
  };