@tedi-design-system/react 19.1.0-rc.1 → 19.1.0-rc.10

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 (90) hide show
  1. package/DESIGN.md +308 -0
  2. package/README.md +28 -0
  3. package/bundle-stats.html +1 -1
  4. package/component.manifest.json +1191 -0
  5. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  6. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  7. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  8. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  9. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  10. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  11. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  12. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  13. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  14. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  15. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  16. package/external/prop-types/external/react-is/index.es.js +1 -1
  17. package/index.css +1 -1
  18. package/package.json +2 -2
  19. package/src/community/components/layout/sidenav/sidenav.cjs.js +1 -1
  20. package/src/community/components/layout/sidenav/sidenav.es.js +38 -40
  21. package/src/community/components/map-components/base-map-selection/base-map-option.cjs.js +1 -1
  22. package/src/community/components/map-components/base-map-selection/base-map-option.d.ts +8 -5
  23. package/src/community/components/map-components/base-map-selection/base-map-option.es.js +63 -65
  24. package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
  25. package/src/community/components/map-components/base-map-selection/base-map-selection.d.ts +1 -4
  26. package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +55 -55
  27. package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
  28. package/src/community/components/map-components/map-button/map-button.d.ts +2 -3
  29. package/src/community/components/map-components/map-button/map-button.es.js +37 -36
  30. package/src/community/components/map-components/map-dropdown/map-dropdown.cjs.js +1 -1
  31. package/src/community/components/map-components/map-dropdown/map-dropdown.es.js +51 -49
  32. package/src/tedi/components/content/card/card.module.scss.cjs.js +1 -1
  33. package/src/tedi/components/content/card/card.module.scss.es.js +3 -2
  34. package/src/tedi/components/content/collapse/collapse.cjs.js +1 -1
  35. package/src/tedi/components/content/collapse/collapse.d.ts +9 -0
  36. package/src/tedi/components/content/collapse/collapse.es.js +44 -35
  37. package/src/tedi/components/filter/filter/filter.cjs.js +1 -1
  38. package/src/tedi/components/filter/filter/filter.d.ts +5 -0
  39. package/src/tedi/components/filter/filter/filter.es.js +154 -144
  40. package/src/tedi/components/filter/filter/filter.module.scss.cjs.js +1 -1
  41. package/src/tedi/components/filter/filter/filter.module.scss.es.js +2 -1
  42. package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -1
  43. package/src/tedi/components/form/date-field/date-field-helpers.d.ts +12 -19
  44. package/src/tedi/components/form/date-field/date-field-helpers.es.js +27 -21
  45. package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
  46. package/src/tedi/components/form/date-field/date-field.d.ts +1 -1
  47. package/src/tedi/components/form/date-field/date-field.es.js +169 -164
  48. package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
  49. package/src/tedi/components/form/textfield/textfield.es.js +21 -21
  50. package/src/tedi/components/form/time-field/time-field.cjs.js +1 -1
  51. package/src/tedi/components/form/time-field/time-field.es.js +126 -124
  52. package/src/tedi/components/layout/sidenav/components/sidenav-item/sidenav-item.cjs.js +1 -1
  53. package/src/tedi/components/layout/sidenav/components/sidenav-item/sidenav-item.es.js +82 -85
  54. package/src/tedi/components/layout/sidenav/sidenav.cjs.js +1 -1
  55. package/src/tedi/components/layout/sidenav/sidenav.es.js +16 -16
  56. package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.cjs.js +1 -1
  57. package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.es.js +6 -7
  58. package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.cjs.js +1 -1
  59. package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.es.js +2 -2
  60. package/src/tedi/components/layout/top-nav/top-nav.cjs.js +1 -1
  61. package/src/tedi/components/layout/top-nav/top-nav.es.js +9 -8
  62. package/src/tedi/components/misc/affix/affix.cjs.js +1 -1
  63. package/src/tedi/components/misc/affix/affix.es.js +20 -8
  64. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.cjs.js +1 -1
  65. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.d.ts +9 -1
  66. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-collapsible/table-of-contents-collapsible.es.js +78 -39
  67. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-item/table-of-contents-item.d.ts +6 -0
  68. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.cjs.js +1 -1
  69. package/src/tedi/components/navigation/table-of-contents/components/table-of-contents-row/table-of-contents-row.es.js +23 -28
  70. package/src/tedi/components/navigation/table-of-contents/table-of-contents.cjs.js +1 -1
  71. package/src/tedi/components/navigation/table-of-contents/table-of-contents.d.ts +32 -21
  72. package/src/tedi/components/navigation/table-of-contents/table-of-contents.es.js +58 -55
  73. package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.cjs.js +1 -1
  74. package/src/tedi/components/navigation/table-of-contents/table-of-contents.module.scss.es.js +4 -1
  75. package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
  76. package/src/tedi/components/overlays/dropdown/dropdown.d.ts +8 -0
  77. package/src/tedi/components/overlays/dropdown/dropdown.es.js +82 -74
  78. package/src/tedi/components/overlays/dropdown/dropdown.module.scss.cjs.js +1 -1
  79. package/src/tedi/components/overlays/dropdown/dropdown.module.scss.es.js +1 -0
  80. package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
  81. package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +22 -21
  82. package/src/tedi/helpers/hooks/use-safe-id.cjs.js +1 -0
  83. package/src/tedi/helpers/hooks/use-safe-id.d.ts +16 -0
  84. package/src/tedi/helpers/hooks/use-safe-id.es.js +5 -0
  85. package/src/tedi/helpers/index.d.ts +1 -0
  86. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  87. package/src/tedi/providers/label-provider/labels-map.d.ts +14 -0
  88. package/src/tedi/providers/label-provider/labels-map.es.js +14 -0
  89. package/tedi.cjs.js +1 -1
  90. package/tedi.es.js +10 -8
@@ -15,7 +15,7 @@ const Se = {
15
15
  large: 24,
16
16
  default: 18
17
17
  }, Be = _e((I, J) => {
18
- var O;
18
+ var M;
19
19
  const { getCurrentBreakpointProps: Q } = ke(I.defaultServerBreakpoint), {
20
20
  id: we,
21
21
  label: g,
@@ -43,15 +43,15 @@ const Se = {
43
43
  value: N,
44
44
  onFocus: A,
45
45
  onBlur: k,
46
- onClick: ie,
46
+ onClick: ae,
47
47
  helper: e,
48
48
  input: a,
49
- name: ae,
49
+ name: ie,
50
50
  isTextArea: le,
51
51
  startSlot: ne,
52
52
  endSlot: se,
53
53
  ...oe
54
- } = Q(I) || {}, { getLabel: L } = Ce(), T = y.useRef(null), E = y.useRef(null), [de, P] = y.useState(N ?? $ ?? ""), V = N ?? de, f = !!(R && V && !F), m = (O = Ae) == null ? void 0 : O(), ce = y.useId(), fe = m == null ? void 0 : m.hasExternalLabel, u = I.id ?? (m == null ? void 0 : m.inputId) ?? ce;
54
+ } = Q(I) || {}, { getLabel: L } = Ce(), T = y.useRef(null), E = y.useRef(null), [de, O] = y.useState(N ?? $ ?? ""), P = N ?? de, f = !!(R && P && !F), m = (M = Ae) == null ? void 0 : M(), ce = y.useId(), fe = m == null ? void 0 : m.hasExternalLabel, u = I.id ?? (m == null ? void 0 : m.inputId) ?? ce;
55
55
  y.useImperativeHandle(J, () => ({
56
56
  get input() {
57
57
  return E.current;
@@ -60,14 +60,14 @@ const Se = {
60
60
  return T.current;
61
61
  }
62
62
  }));
63
- const j = b(() => Array.isArray(e) ? c || e.some((r) => r.type === "error") : c || (e == null ? void 0 : e.type) === "error", [c, e]), me = b(() => !e || Array.isArray(e) && e.length === 0 ? !1 : Array.isArray(e) ? !c && e.every((r) => r.type === "valid") : !c && e.type === "valid", [c, e]), ue = s === "large" ? "default" : s, h = N !== void 0, pe = B(
63
+ const V = b(() => Array.isArray(e) ? c || e.some((r) => r.type === "error") : c || (e == null ? void 0 : e.type) === "error", [c, e]), me = b(() => !e || Array.isArray(e) && e.length === 0 ? !1 : Array.isArray(e) ? !c && e.every((r) => r.type === "valid") : !c && e.type === "valid", [c, e]), ue = s === "large" ? "default" : s, h = N !== void 0, pe = B(
64
64
  (r) => {
65
- h || P(r), o == null || o(r);
65
+ h || O(r), o == null || o(r);
66
66
  },
67
67
  [h, o]
68
- ), H = B(() => {
69
- h || P(""), o == null || o(""), x == null || x();
70
- }, [h, o, x]), K = B(() => {
68
+ ), j = B(() => {
69
+ h || O(""), o == null || o(""), x == null || x();
70
+ }, [h, o, x]), H = B(() => {
71
71
  if (!i) return null;
72
72
  const C = {
73
73
  size: s === "large" ? 24 : s === "small" ? !!v ? 18 : 16 : 18,
@@ -84,33 +84,33 @@ const Se = {
84
84
  children: /* @__PURE__ */ n(D, { ...q })
85
85
  }
86
86
  ) : /* @__PURE__ */ n("div", { className: t["tedi-textfield__icon-wrapper"], "aria-hidden": "true", children: /* @__PURE__ */ n(D, { ...q }) });
87
- }, [i, s, v, p, d]), M = b(() => f ? /* @__PURE__ */ n(
87
+ }, [i, s, v, p, d]), K = b(() => f ? /* @__PURE__ */ n(
88
88
  be,
89
89
  {
90
90
  iconSize: Se[s === "large" ? "large" : "default"],
91
- onClick: d ? void 0 : H,
91
+ onClick: d ? void 0 : j,
92
92
  disabled: d,
93
93
  title: L("clear"),
94
94
  className: t["tedi-textfield__clear-button"]
95
95
  }
96
- ) : null, [f, s, d, H, L]), ye = b(() => !f && !i ? null : /* @__PURE__ */ S("div", { className: t["tedi-textfield__right-area"], children: [
97
- M,
96
+ ) : null, [f, s, d, j, L]), ye = b(() => !f && !i ? null : /* @__PURE__ */ S("div", { className: t["tedi-textfield__right-area"], children: [
97
+ K,
98
98
  f && i && /* @__PURE__ */ n(Ie, { color: "primary", axis: "vertical", className: t["tedi-textfield__separator"] }),
99
- i && K()
100
- ] }), [f, i, M, K]), ve = /* @__PURE__ */ n(
99
+ i && H()
100
+ ] }), [f, i, K, H]), ve = /* @__PURE__ */ n(
101
101
  ge,
102
102
  {
103
103
  ...a,
104
104
  id: u,
105
- name: ae,
106
- value: V,
105
+ name: ie,
106
+ value: P,
107
107
  defaultValue: $,
108
108
  onChange: pe,
109
109
  onChangeEvent: G,
110
110
  disabled: d,
111
- readOnly: F,
111
+ readOnly: F || (a == null ? void 0 : a.readOnly),
112
112
  required: w,
113
- invalid: j,
113
+ invalid: V,
114
114
  placeholder: Y,
115
115
  className: _(t["tedi-textfield__input"], X, {
116
116
  [t["tedi-textfield__input--hidden-arrows"]]: Z
@@ -132,7 +132,7 @@ const Se = {
132
132
  t["tedi-textfield"],
133
133
  { [t[`tedi-textfield--${s}`]]: s },
134
134
  { [t["tedi-textfield--with-icon"]]: i },
135
- { [t["tedi-textfield--invalid"]]: j },
135
+ { [t["tedi-textfield--invalid"]]: V },
136
136
  { [t["tedi-textfield--valid"]]: me },
137
137
  { [t["tedi-textfield--clearable"]]: f },
138
138
  W
@@ -146,7 +146,7 @@ const Se = {
146
146
  onKeyDown: re,
147
147
  onKeyUp: ee,
148
148
  onKeyPress: te,
149
- onClick: ie,
149
+ onClick: ae,
150
150
  ref: T,
151
151
  children: [
152
152
  ne,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),y=require("../../../../../external/classnames/index.cjs.js"),f=require("react"),A=require("../textfield/textfield.cjs.js"),ge=require("../time-picker/time-picker.cjs.js"),d=require("./time-field.module.scss.cjs.js"),H=require("./time-field-helpers.cjs.js"),ke=require("./time-picker-modal/time-picker-modal.cjs.js"),xe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),K=require("../../../helpers/hooks/use-breakpoint.cjs.js"),F=require("../../overlays/dropdown/dropdown.cjs.js"),he=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),B=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),G=_=>{const{getCurrentBreakpointProps:J}=xe.useBreakpointProps(_.defaultServerBreakpoint),{id:L,label:Q,value:u,defaultValue:W,onChange:C,readOnly:h=!1,disabled:l=!1,required:X,placeholder:Y,inputProps:t,stepMinutes:M=1,className:O,availableTimes:a,modal:P=!1,modalProps:Z}=_,{useNativePicker:$=!1,timePickerTrigger:N="button",showPicker:n=!0,availableTimesVariant:w="grid-buttons",clearable:ee=!0}=J(_),D=u!==void 0,[te,R]=f.useState(u??W??""),m=D?u:te,[T,j]=f.useState(!1),[ie,U]=f.useState(!1),p=N==="input",s=$,ne=K.default(),g=!s&&n&&!h&&!l&&(P===!0||typeof P=="string"&&K.isBreakpointBelow(ne,P)),oe=c.useFloating({open:T,onOpenChange:j,placement:p?"bottom-start":"bottom-end",middleware:[B.offset(H.TIMEPICKER_OFFSET),B.flip(),B.shift()],whileElementsMounted:he.autoUpdate}),{refs:q,context:b,x:re,y:se,strategy:le}=oe,ae=c.useClick(b),de=c.useDismiss(b),ce=c.useRole(b,{role:"listbox"}),S=n&&p&&!h&&!l&&!s&&!g,V=c.useInteractions([...S?[ae]:[],de,ce]),k=e=>{const o=e.trim();D||R(o),C==null||C(o)},ue=e=>{var v;const o=e.target.value??"";(v=t==null?void 0:t.onBlur)==null||v.call(t,e);const r=H.normalizeTime(o);r!==null&&r!==o&&k(r)};f.useEffect(()=>{u!==void 0&&R(u)},[u]);const x=f.useRef(null);f.useEffect(()=>{var e;(e=x.current)!=null&&e.inner&&q.setReference(x.current.inner)},[q]);const fe=()=>{var o;const e=(o=x.current)==null?void 0:o.input;if(e){if(typeof e.showPicker=="function"){e.showPicker();return}e.focus()}},me=()=>j(e=>!e),E=()=>U(!0),pe=()=>{!n||l||(s?fe():g?E():N==="button"&&me())},z=g&&p&&!h?()=>{E()}:void 0,I={...t,id:L,label:Q,value:m,placeholder:Y,readOnly:h||!s&&p,disabled:l||(t==null?void 0:t.disabled),icon:n?"schedule":{name:"schedule",color:"inherit"},isClearable:ee,required:X,onIconClick:n?pe:void 0,onChange:k,onBlur:ue,className:y.default(d.default["tedi-time-field__textfield"],{[d.default["tedi-time-field__icon--disabled"]]:!n||l},{[d.default["tedi-time-field__textfield--disabled"]]:l||(t==null?void 0:t.disabled)},{[d.default["tedi-time-field--native"]]:s}),input:{...t==null?void 0:t.input,...s&&{type:"time"},...z&&{onClick:z}}};if(!s&&n&&!l&&w==="dropdown"&&!!(a!=null&&a.length)){const e=a.indexOf(m),o=e>=0?e:0;return i.jsxs(F.Dropdown,{width:"trigger",defaultActiveIndex:o,children:[i.jsx(F.Dropdown.Trigger,{children:i.jsx("div",{className:y.default(d.default["tedi-time-field__container"],O,{[d.default["tedi-time-field__container--native"]]:s}),children:i.jsx(A.TextField,{ref:x,...I,input:{...I.input,...!p&&{onClick:r=>r.stopPropagation()}}})})}),i.jsx(F.Dropdown.Content,{children:a.map((r,v)=>i.jsx(F.Dropdown.Item,{index:v,active:r===m,onClick:()=>k(r),children:r},r))})]})}return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:y.default(d.default["tedi-time-field__container"],O),...S?V.getReferenceProps():{},"aria-haspopup":n?"listbox":void 0,tabIndex:-1,children:i.jsx(A.TextField,{ref:x,"aria-expanded":n?T:void 0,...I})}),g&&i.jsx(ke.TimePickerModal,{open:ie,onOpenChange:U,value:m,onConfirm:k,stepMinutes:M,availableTimes:a,gridVariant:w==="grid-radio"?"radio":"button",modalProps:Z}),!s&&n&&!l&&!g&&i.jsx(c.FloatingPortal,{children:T&&i.jsx(c.FloatingFocusManager,{context:b,modal:!1,initialFocus:-1,children:i.jsx("div",{ref:q.setFloating,...V.getFloatingProps({style:{position:le,top:se??0,left:re??0}}),children:i.jsx(ge.TimePicker,{value:m,stepMinutes:M,availableTimes:a,onChange:e=>{k(e),a&&j(!1)},gridVariant:w==="grid-radio"?"radio":"button",className:d.default["tedi-time-field__picker-wrapper"]})})})})]})};G.displayName="TimeField";exports.TimeField=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),M=require("../../../../../external/classnames/index.cjs.js"),m=require("react"),J=require("../textfield/textfield.cjs.js"),Pe=require("../time-picker/time-picker.cjs.js"),c=require("./time-field.module.scss.cjs.js"),Q=require("./time-field-helpers.cjs.js"),Ce=require("./time-picker-modal/time-picker-modal.cjs.js"),_e=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),Te=require("../../../providers/label-provider/use-labels.cjs.js"),W=require("../../../helpers/hooks/use-breakpoint.cjs.js"),P=require("../../overlays/dropdown/dropdown.cjs.js"),je=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),N=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),X=C=>{const{getCurrentBreakpointProps:Y}=_e.useBreakpointProps(C.defaultServerBreakpoint),{getLabel:Z}=Te.useLabels(),{id:$,label:ee,value:f,defaultValue:te,onChange:_,readOnly:h=!1,disabled:a=!1,required:ie,placeholder:ne,inputProps:t,stepMinutes:R=1,className:D,availableTimes:l,modal:T=!1,modalProps:oe}=C,{useNativePicker:re=!1,timePickerTrigger:j="button",showPicker:o=!0,availableTimesVariant:q="grid-buttons",clearable:se=!0}=Y(C),E=f!==void 0,[ae,S]=m.useState(f??te??""),g=E?f:ae,[w,I]=m.useState(!1),[U,V]=m.useState(!1),p=j==="input",n=re,le=W.default(),d=!n&&o&&!h&&!a&&(T===!0||typeof T=="string"&&W.isBreakpointBelow(le,T)),de=u.useFloating({open:w,onOpenChange:I,placement:p?"bottom-start":"bottom-end",middleware:[N.offset(Q.TIMEPICKER_OFFSET),N.flip(),N.shift()],whileElementsMounted:je.autoUpdate}),{refs:B,context:v,x:ce,y:ue,strategy:fe}=de,pe=u.useClick(v),me=u.useDismiss(v),ge=u.useRole(v,{role:"listbox"}),L=o&&p&&!h&&!a&&!n&&!d,z=u.useInteractions([...L?[pe]:[],me,ge]),x=e=>{const r=e.trim();E||S(r),_==null||_(r)},xe=e=>{var F;const r=e.target.value??"";(F=t==null?void 0:t.onBlur)==null||F.call(t,e);const s=Q.normalizeTime(r);s!==null&&s!==r&&x(s)};m.useEffect(()=>{f!==void 0&&S(f)},[f]);const k=m.useRef(null);m.useEffect(()=>{var e;(e=k.current)!=null&&e.inner&&B.setReference(k.current.inner)},[B]);const ke=()=>{var r;const e=(r=k.current)==null?void 0:r.input;if(e){if(typeof e.showPicker=="function"){e.showPicker();return}e.focus()}},be=()=>I(e=>!e),A=()=>V(!0),he=()=>{!o||a||(n?ke():d?A():j==="button"&&be())},H=d&&p&&!h?()=>{A()}:void 0,y=!n&&o&&!a&&q==="dropdown"&&!!(l!=null&&l.length),K=d?"dialog":"listbox",G=d?U:w,ve=o&&!n&&!y&&(j==="button"||d),Fe=o&&p&&!n&&!y,O={...t,id:$,label:ee,value:g,placeholder:ne,readOnly:h||!n&&p,disabled:a||(t==null?void 0:t.disabled),icon:o?"schedule":{name:"schedule",color:"inherit"},isClearable:se,required:ie,onIconClick:o?he:void 0,iconButtonProps:{"aria-label":Z("time-field.open-picker"),...ve&&{"aria-haspopup":K,"aria-expanded":G},...t==null?void 0:t.iconButtonProps},onChange:x,onBlur:xe,className:M.default(c.default["tedi-time-field__textfield"],{[c.default["tedi-time-field__icon--disabled"]]:!o||a},{[c.default["tedi-time-field__textfield--disabled"]]:a||(t==null?void 0:t.disabled)},{[c.default["tedi-time-field--native"]]:n}),input:{...t==null?void 0:t.input,...n&&{type:"time"},...H&&{onClick:H},...Fe&&{role:"combobox","aria-haspopup":K,"aria-expanded":G}}};if(y){const e=l.indexOf(g),r=e>=0?e:0;return i.jsxs(P.Dropdown,{width:"trigger",defaultActiveIndex:r,children:[i.jsx(P.Dropdown.Trigger,{children:i.jsx("div",{role:"combobox",className:M.default(c.default["tedi-time-field__container"],D,{[c.default["tedi-time-field__container--native"]]:n}),children:i.jsx(J.TextField,{ref:k,...O,input:{...O.input,...!p&&{onClick:s=>s.stopPropagation()}}})})}),i.jsx(P.Dropdown.Content,{children:l.map((s,F)=>i.jsx(P.Dropdown.Item,{index:F,active:s===g,onClick:()=>x(s),children:s},s))})]})}const b={...L?z.getReferenceProps():{}};return delete b.role,delete b["aria-haspopup"],delete b["aria-expanded"],delete b["aria-controls"],i.jsxs(i.Fragment,{children:[i.jsx("div",{className:M.default(c.default["tedi-time-field__container"],D),...b,tabIndex:-1,children:i.jsx(J.TextField,{ref:k,...O})}),d&&i.jsx(Ce.TimePickerModal,{open:U,onOpenChange:V,value:g,onConfirm:x,stepMinutes:R,availableTimes:l,gridVariant:q==="grid-radio"?"radio":"button",modalProps:oe}),!n&&o&&!a&&!d&&i.jsx(u.FloatingPortal,{children:w&&i.jsx(u.FloatingFocusManager,{context:v,modal:!1,initialFocus:-1,children:i.jsx("div",{ref:B.setFloating,...z.getFloatingProps({style:{position:fe,top:ue??0,left:ce??0}}),children:i.jsx(Pe.TimePicker,{value:g,stepMinutes:R,availableTimes:l,onChange:e=>{x(e),l&&I(!1)},gridVariant:q==="grid-radio"?"radio":"button",className:c.default["tedi-time-field__picker-wrapper"]})})})})]})};X.displayName="TimeField";exports.TimeField=X;
@@ -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 e=require("react/jsx-runtime"),f=require("react"),n=require("../../../../../../../external/classnames/index.cjs.js"),P=require("../../../../base/icon/icon.cjs.js"),y=require("../../../../content/collapse/collapse.cjs.js"),k=require("../../../../navigation/link/link.cjs.js"),s=require("../../sidenav.module.scss.cjs.js"),J=require("../sidenav-dropdown/sidenav-dropdown.cjs.js"),K=require("../../../../../providers/label-provider/use-labels.cjs.js"),h=require("../../../../overlays/tooltip/tooltip.cjs.js"),D=M=>{const{icon:t,children:i,isActive:g,onClick:x,subItems:C,subItemGroups:O,as:j,onItemClick:v,className:E,level:d=1,isCollapsed:c=!1,isDefaultOpen:R=!1,sideNavItemSize:B="default",...u}=M,{getLabel:T}=K.useLabels(),[o,$]=f.useState(R??!1),[S,z]=f.useState(!1),N=f.useId(),m=O??(C?[{subItems:C}]:null),l=!!m,F=d>1&&l,H=n.default(s.default["tedi-sidenav__item"],s.default[`tedi-sidenav__item--${B}`],{[s.default[`tedi-sidenav__item--level-${d}`]]:d>1,[s.default["tedi-sidenav__item--current"]]:g,[s.default["tedi-sidenav__item--has-children"]]:l,[s.default["tedi-sidenav__item--with-tree"]]:F},E),_=a=>{const r={color:"white",className:n.default(s.default["tedi-sidenav__icon"])},p=typeof a=="string"?{...r,name:a}:{...r,...a,className:n.default(r.className,a==null?void 0:a.className)};return e.jsx(P.Icon,{...p})},A=a=>{x==null||x(a),l||v==null||v()},w=a=>{$(a)},G=l&&(u.href||u.to),b={...u,as:j,onClick:A,className:n.default(s.default["tedi-sidenav__link"],G&&s.default["tedi-sidenav__link--has-children-link"]),noStyle:!0,role:"menuitem","aria-current":g?"page":void 0,"aria-label":c&&typeof i=="string"?i:void 0,...l?{"aria-haspopup":"true","aria-expanded":o,"aria-controls":N}:{}},I=()=>!c&&(m==null?void 0:m.map((a,L)=>{var r;return e.jsxs("div",{children:[(a==null?void 0:a.subHeading)&&e.jsx("div",{className:s.default["tedi-sidenav__subheading"],children:a.subHeading}),e.jsx("ul",{className:s.default["tedi-sidenav__list"],role:"menu",children:(r=a.subItems)==null?void 0:r.map((p,W)=>f.createElement(D,{as:j,...p,key:W,level:d+1,onItemClick:v,isCollapsed:c,className:n.default(s.default["tedi-sidenav__sub-item"],p.className)}))})]},L)})),q=e.jsx("li",{"data-name":"sidenav-item",className:H,children:l&&c?e.jsx(J.SideNavDropdown,{trigger:e.jsx(h.Tooltip.Trigger,{children:e.jsxs("span",{className:n.default(s.default["tedi-sidenav__link"],S&&s.default["tedi-sidenav__link--active"]),children:[t&&_(t),e.jsx(P.Icon,{name:S?"chevron_right":"expand_more",color:"white",className:s.default["tedi-sidenav__toggle-icon"],size:18}),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]})}),as:j,groups:m,onOpenChange:z}):l&&d===1?u.href||u.to?e.jsxs(e.Fragment,{children:[e.jsxs(k.Link,{...b,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]}),e.jsx("div",{className:s.default["tedi-sidenav__link-collapse-wrapper"],children:e.jsx(y.Collapse,{id:N,hideCollapseText:!0,inverted:!0,open:o,onToggle:w,toggleLabel:T("sidenav.toggleSubmenuChildren",{isCollapsedInternal:o,children:i}),className:s.default["tedi-sidenav__collapse"],titleRowProps:{element:"span"},children:I()})})]}):e.jsx(y.Collapse,{id:N,hideCollapseText:!0,inverted:!0,fullRowToggle:!0,open:o,onToggle:w,className:s.default["tedi-sidenav__collapse"],titleRowProps:{element:"span"},toggleLabel:T("sidenav.toggleSubmenuChildren",{isCollapsedInternal:o,children:i}),title:e.jsxs("span",{className:n.default(s.default["tedi-sidenav__link"],o&&s.default["tedi-sidenav__link--active"]),"aria-current":g?"page":void 0,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]}),children:I()}):l?e.jsxs(e.Fragment,{children:[e.jsxs(k.Link,{...b,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i}),e.jsx("i",{className:s.default["tedi-sidenav__bullet"]})]}),I()]}):e.jsx(h.Tooltip.Trigger,{children:e.jsxs(k.Link,{...b,children:[t&&_(t),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]})})});return d===1&&c?e.jsxs(h.Tooltip,{placement:"right",focusManager:void 0,children:[e.jsx(h.Tooltip.Content,{maxWidth:"medium",children:i}),q]}):q};exports.SideNavItem=D;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),n=require("../../../../../../../external/classnames/index.cjs.js"),P=require("../../../../base/icon/icon.cjs.js"),R=require("../../../../content/collapse/collapse.cjs.js"),I=require("../../../../navigation/link/link.cjs.js"),s=require("../../sidenav.module.scss.cjs.js"),J=require("../sidenav-dropdown/sidenav-dropdown.cjs.js"),K=require("../../../../../providers/label-provider/use-labels.cjs.js"),Q=require("../../../../../helpers/hooks/use-safe-id.cjs.js"),p=require("../../../../overlays/tooltip/tooltip.cjs.js"),y=D=>{const{icon:a,children:i,isActive:h,onClick:g,subItems:k,subItemGroups:M,as:x,onItemClick:v,className:O,level:d=1,isCollapsed:r=!1,isDefaultOpen:E=!1,sideNavItemSize:A="default",...c}=D,{getLabel:C}=K.useLabels(),[u,B]=b.useState(E??!1),[S,$]=b.useState(!1),T=Q.useSafeId("sidenav-collapse"),m=M??(k?[{subItems:k}]:null),l=!!m,z=d>1&&l,F=n.default(s.default["tedi-sidenav__item"],s.default[`tedi-sidenav__item--${A}`],{[s.default[`tedi-sidenav__item--level-${d}`]]:d>1,[s.default["tedi-sidenav__item--current"]]:h,[s.default["tedi-sidenav__item--has-children"]]:l,[s.default["tedi-sidenav__item--with-tree"]]:z},O),_=t=>{const o={color:"white",className:n.default(s.default["tedi-sidenav__icon"])},f=typeof t=="string"?{...o,name:t}:{...o,...t,className:n.default(o.className,t==null?void 0:t.className)};return e.jsx(P.Icon,{...f})},H=t=>{g==null||g(t),l||v==null||v()},q=t=>{B(t)},G=l&&(c.href||c.to),j={...c,as:x,onClick:H,className:n.default(s.default["tedi-sidenav__link"],G&&s.default["tedi-sidenav__link--has-children-link"]),noStyle:!0,"aria-current":h?"page":void 0,"aria-label":r&&typeof i=="string"?i:void 0},N=()=>!r&&(m==null?void 0:m.map((t,L)=>{var o;return e.jsxs("div",{children:[(t==null?void 0:t.subHeading)&&e.jsx("div",{className:s.default["tedi-sidenav__subheading"],children:t.subHeading}),e.jsx("ul",{className:s.default["tedi-sidenav__list"],children:(o=t.subItems)==null?void 0:o.map((f,W)=>b.createElement(y,{as:x,...f,key:W,level:d+1,onItemClick:v,isCollapsed:r,className:n.default(s.default["tedi-sidenav__sub-item"],f.className)}))})]},L)})),w=e.jsx("li",{"data-name":"sidenav-item",className:F,children:l&&r?e.jsx(J.SideNavDropdown,{trigger:e.jsx(p.Tooltip.Trigger,{children:e.jsxs("span",{className:n.default(s.default["tedi-sidenav__link"],S&&s.default["tedi-sidenav__link--active"]),children:[a&&_(a),e.jsx(P.Icon,{name:S?"chevron_right":"expand_more",color:"white",className:s.default["tedi-sidenav__toggle-icon"],size:18}),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]})}),as:x,groups:m,onOpenChange:$}):l&&d===1?c.href||c.to?e.jsxs(e.Fragment,{children:[e.jsxs(I.Link,{...j,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]}),e.jsx("div",{className:s.default["tedi-sidenav__link-collapse-wrapper"],children:e.jsx(R.Collapse,{id:T,hideCollapseText:!0,inverted:!0,contentAsRegion:!1,open:u,onToggle:q,toggleLabel:C("sidenav.toggleSubmenuChildren",{isCollapsedInternal:u,children:i}),className:s.default["tedi-sidenav__collapse"],titleRowProps:{element:"span"},children:N()})})]}):e.jsx(R.Collapse,{id:T,hideCollapseText:!0,inverted:!0,fullRowToggle:!0,contentAsRegion:!1,open:u,onToggle:q,className:s.default["tedi-sidenav__collapse"],titleRowProps:{element:"span"},toggleLabel:C("sidenav.toggleSubmenuChildren",{isCollapsedInternal:u,children:i}),title:e.jsxs("span",{className:n.default(s.default["tedi-sidenav__link"],u&&s.default["tedi-sidenav__link--active"]),"aria-current":h?"page":void 0,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]}),children:N()}):l?e.jsxs(e.Fragment,{children:[e.jsxs(I.Link,{...j,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i}),e.jsx("i",{className:s.default["tedi-sidenav__bullet"]})]}),N()]}):e.jsx(p.Tooltip.Trigger,{children:e.jsxs(I.Link,{...j,children:[a&&_(a),e.jsx("span",{className:s.default["tedi-sidenav__title"],children:i})]})})});return d===1&&r?e.jsxs(p.Tooltip,{placement:"right",focusManager:void 0,children:[e.jsx(p.Tooltip.Content,{maxWidth:"medium",children:i}),w]}):w};exports.SideNavItem=y;