@tedi-design-system/react 19.1.0-rc.8 → 19.1.0

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 (145) hide show
  1. package/bundle-stats.html +1 -1
  2. package/community.cjs.js +1 -1
  3. package/community.es.js +215 -223
  4. package/component.manifest.json +63 -20
  5. package/external/@floating-ui/core/dist/floating-ui.core.es.js +1 -1
  6. package/external/@floating-ui/dom/dist/floating-ui.dom.es.js +2 -2
  7. package/external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js +5 -5
  8. package/external/@mui/x-date-pickers/DatePicker/shared.es.js +1 -1
  9. package/external/@mui/x-date-pickers/DateTimePicker/shared.es.js +1 -1
  10. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  11. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  12. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  13. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  14. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  15. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  16. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  17. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  18. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  19. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  20. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  21. package/external/prop-types/external/react-is/index.es.js +1 -1
  22. package/index.css +1 -1
  23. package/package.json +2 -2
  24. package/src/community/components/accordion/accordion.cjs.js +1 -1
  25. package/src/community/components/accordion/accordion.es.js +14 -9
  26. package/src/community/components/card/card-notification/card-notification.cjs.js +1 -1
  27. package/src/community/components/card/card-notification/card-notification.es.js +10 -8
  28. package/src/community/components/dock-panel/dock-panel.cjs.js +2 -0
  29. package/src/community/components/dock-panel/dock-panel.d.ts +110 -0
  30. package/src/community/components/dock-panel/dock-panel.es.js +138 -0
  31. package/src/community/components/dock-panel/dock-panel.module.scss.cjs.js +1 -0
  32. package/src/community/components/dock-panel/dock-panel.module.scss.es.js +18 -0
  33. package/src/community/components/dropdown/dropdown.cjs.js +1 -1
  34. package/src/community/components/dropdown/dropdown.es.js +34 -32
  35. package/src/community/components/form/category-search/category-search.cjs.js +1 -0
  36. package/src/community/components/form/category-search/category-search.d.ts +9 -0
  37. package/src/community/components/form/category-search/category-search.es.js +297 -0
  38. package/src/community/components/form/category-search/category-search.module.scss.cjs.js +1 -0
  39. package/src/community/components/form/category-search/category-search.module.scss.es.js +21 -0
  40. package/src/community/components/form/category-search/category-search.types.d.ts +162 -0
  41. package/src/community/components/form/category-search/define-category-search-category.cjs.js +1 -0
  42. package/src/community/components/form/category-search/define-category-search-category.d.ts +7 -0
  43. package/src/community/components/form/category-search/define-category-search-category.es.js +25 -0
  44. package/src/community/components/form/category-search/index.d.ts +3 -0
  45. package/src/community/components/form/category-search/use-category-search.cjs.js +1 -0
  46. package/src/community/components/form/category-search/use-category-search.d.ts +17 -0
  47. package/src/community/components/form/category-search/use-category-search.es.js +64 -0
  48. package/src/community/components/form/file-upload/file-upload.cjs.js +1 -1
  49. package/src/community/components/form/file-upload/file-upload.es.js +43 -41
  50. package/src/community/components/form/pickers/calendar/calendar.cjs.js +1 -1
  51. package/src/community/components/form/pickers/calendar/calendar.es.js +41 -39
  52. package/src/community/components/form/pickers/timepicker/timepicker.cjs.js +1 -1
  53. package/src/community/components/form/pickers/timepicker/timepicker.es.js +33 -31
  54. package/src/community/components/form/toggle/toggle.cjs.js +1 -1
  55. package/src/community/components/form/toggle/toggle.es.js +30 -28
  56. package/src/community/components/map-components/base-map-selection/base-map-selection.cjs.js +1 -1
  57. package/src/community/components/map-components/base-map-selection/base-map-selection.es.js +19 -19
  58. package/src/community/components/map-components/carousel/carousel.cjs.js +1 -1
  59. package/src/community/components/map-components/carousel/carousel.es.js +19 -17
  60. package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
  61. package/src/community/components/map-components/map-button/map-button.d.ts +10 -1
  62. package/src/community/components/map-components/map-button/map-button.es.js +31 -29
  63. package/src/community/components/map-components/map-dropdown/map-dropdown.cjs.js +1 -1
  64. package/src/community/components/map-components/map-dropdown/map-dropdown.es.js +51 -49
  65. package/src/community/components/status/status.cjs.js +1 -1
  66. package/src/community/components/status/status.es.js +14 -12
  67. package/src/community/components/stepper/stepper.cjs.js +1 -1
  68. package/src/community/components/stepper/stepper.es.js +33 -31
  69. package/src/community/components/table/table.cjs.js +1 -1
  70. package/src/community/components/table/table.es.js +9 -9
  71. package/src/community/components/table-of-contents/table-of-contents.cjs.js +1 -1
  72. package/src/community/components/table-of-contents/table-of-contents.es.js +21 -19
  73. package/src/community/components/tabs/tabs/tabs.cjs.js +1 -1
  74. package/src/community/components/tabs/tabs/tabs.es.js +29 -27
  75. package/src/community/components/vertical-stepper/vertical-stepper.cjs.js +1 -1
  76. package/src/community/components/vertical-stepper/vertical-stepper.es.js +8 -6
  77. package/src/community/deprecated-exports.cjs.js +1 -0
  78. package/src/community/deprecated-exports.d.ts +19 -0
  79. package/src/community/deprecated-exports.es.js +112 -0
  80. package/src/community/index.d.ts +3 -0
  81. package/src/tedi/components/content/card/card.d.ts +4 -0
  82. package/src/tedi/components/content/carousel/carousel.cjs.js +1 -1
  83. package/src/tedi/components/content/carousel/carousel.d.ts +5 -0
  84. package/src/tedi/components/content/carousel/carousel.es.js +20 -20
  85. package/src/tedi/components/content/carousel/use-carousel.cjs.js +1 -1
  86. package/src/tedi/components/content/carousel/use-carousel.d.ts +1 -1
  87. package/src/tedi/components/content/carousel/use-carousel.es.js +127 -127
  88. package/src/tedi/components/content/table-card/index.d.ts +1 -0
  89. package/src/tedi/components/content/table-card/table-card.cjs.js +1 -0
  90. package/src/tedi/components/content/table-card/table-card.d.ts +131 -0
  91. package/src/tedi/components/content/table-card/table-card.es.js +206 -0
  92. package/src/tedi/components/content/table-card/table-card.module.scss.cjs.js +1 -0
  93. package/src/tedi/components/content/table-card/table-card.module.scss.es.js +18 -0
  94. package/src/tedi/components/content/text-group/text-group-list/text-group-list.cjs.js +1 -1
  95. package/src/tedi/components/content/text-group/text-group-list/text-group-list.d.ts +42 -0
  96. package/src/tedi/components/content/text-group/text-group-list/text-group-list.es.js +41 -23
  97. package/src/tedi/components/content/text-group/text-group.cjs.js +1 -1
  98. package/src/tedi/components/content/text-group/text-group.d.ts +10 -0
  99. package/src/tedi/components/content/text-group/text-group.es.js +14 -13
  100. package/src/tedi/components/content/text-group/text-group.module.scss.cjs.js +1 -1
  101. package/src/tedi/components/content/text-group/text-group.module.scss.es.js +5 -1
  102. package/src/tedi/components/form/date-field/date-field-helpers.cjs.js +1 -1
  103. package/src/tedi/components/form/date-field/date-field-helpers.d.ts +12 -19
  104. package/src/tedi/components/form/date-field/date-field-helpers.es.js +27 -21
  105. package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
  106. package/src/tedi/components/form/date-field/date-field.d.ts +1 -1
  107. package/src/tedi/components/form/date-field/date-field.es.js +169 -164
  108. package/src/tedi/components/form/date-time-field/date-time-field.cjs.js +1 -1
  109. package/src/tedi/components/form/date-time-field/date-time-field.es.js +181 -176
  110. package/src/tedi/components/form/search/index.d.ts +1 -0
  111. package/src/tedi/components/form/search/search.cjs.js +1 -1
  112. package/src/tedi/components/form/search/search.d.ts +92 -1
  113. package/src/tedi/components/form/search/search.es.js +265 -69
  114. package/src/tedi/components/form/search/search.module.scss.cjs.js +1 -1
  115. package/src/tedi/components/form/search/search.module.scss.es.js +9 -1
  116. package/src/tedi/components/form/slider/slider.cjs.js +1 -1
  117. package/src/tedi/components/form/slider/slider.es.js +38 -38
  118. package/src/tedi/components/form/slider/slider.module.scss.cjs.js +1 -1
  119. package/src/tedi/components/form/slider/slider.module.scss.es.js +0 -1
  120. package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
  121. package/src/tedi/components/form/textfield/textfield.es.js +21 -21
  122. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.cjs.js +1 -1
  123. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.d.ts +1 -1
  124. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.es.js +28 -27
  125. package/src/tedi/components/layout/mobile-nav/mobile-nav.cjs.js +1 -1
  126. package/src/tedi/components/layout/mobile-nav/mobile-nav.d.ts +1 -1
  127. package/src/tedi/components/layout/mobile-nav/mobile-nav.es.js +124 -92
  128. package/src/tedi/components/layout/sidenav/sidenav.module.scss.cjs.js +1 -1
  129. package/src/tedi/components/layout/sidenav/sidenav.module.scss.es.js +1 -0
  130. package/src/tedi/components/navigation/tabs/tabs-helpers.cjs.js +1 -1
  131. package/src/tedi/components/navigation/tabs/tabs-helpers.d.ts +5 -0
  132. package/src/tedi/components/navigation/tabs/tabs-helpers.es.js +7 -4
  133. package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.cjs.js +1 -1
  134. package/src/tedi/components/navigation/tabs/tabs-trigger/tabs-trigger.es.js +17 -17
  135. package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
  136. package/src/tedi/components/overlays/dropdown/dropdown.es.js +8 -6
  137. package/src/tedi/helpers/warn-deprecated/warn-deprecated.cjs.js +1 -0
  138. package/src/tedi/helpers/warn-deprecated/warn-deprecated.d.ts +12 -0
  139. package/src/tedi/helpers/warn-deprecated/warn-deprecated.es.js +11 -0
  140. package/src/tedi/index.d.ts +2 -1
  141. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  142. package/src/tedi/providers/label-provider/labels-map.d.ts +30 -2
  143. package/src/tedi/providers/label-provider/labels-map.es.js +29 -1
  144. package/tedi.cjs.js +1 -1
  145. package/tedi.es.js +326 -324
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),t=require("../../../../../external/classnames/index.cjs.js"),v=require("react"),w=require("../../buttons/button/button.cjs.js"),j=require("../textfield/textfield.cjs.js"),a=require("./search.module.scss.cjs.js"),L=require("../../../providers/label-provider/use-labels.cjs.js"),n=v.forwardRef(({placeholder:u,isClearable:o=!0,searchIcon:r="search",onSearch:s,onChange:f,button:e,ariaLabel:h,className:_,input:p,...l},m)=>{const{getLabel:i}=L.useLabels(),b=g=>{g.key==="Enter"&&(s==null||s(l.value))},x=()=>{s==null||s(l.value)},d=typeof r=="string"?{name:r}:r,y={color:"secondary",...d,className:t.default(d.className,l.disabled&&a.default["tedi-search__icon--disabled"])},q={...l,ref:m,inputClassName:t.default(a.default["tedi-search__input"],e&&a.default["tedi-search__input--has-button"],_),placeholder:u,isClearable:o,onKeyDown:b,onChange:f,input:{...p,role:"searchbox"},...e?{}:{icon:y}},N=h||i("search");return c.jsxs("div",{className:t.default(a.default["tedi-search__wrapper"],l.size==="small"&&a.default["tedi-search__wrapper--small"],l.size==="large"&&a.default["tedi-search__wrapper--large"]),role:"search","aria-label":N,children:[c.jsx(j.TextField,{...q}),e&&c.jsx(w.Button,{...e,onClick:x,className:t.default(a.default["tedi-search__button"],!e.children&&a.default["tedi-search__button--icon-only"],e.className),"aria-label":e.children?void 0:i("search"),children:e.children??i("search")})]})});n.displayName="Search";exports.Search=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),C=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),N=require("../../../../../external/classnames/index.cjs.js"),o=require("react"),Q=require("../../base/typography/text/text.cjs.js"),Je=require("../../buttons/button/button.cjs.js"),We=require("../../loaders/spinner/spinner.cjs.js"),H=require("../../misc/option-content/option-content.cjs.js"),Xe=require("../textfield/textfield.cjs.js"),s=require("./search.module.scss.cjs.js"),Ye=require("../../../providers/label-provider/use-labels.cjs.js"),Ze=require("../../../../../external/@floating-ui/dom/dist/floating-ui.dom.cjs.js"),D=require("../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs.js"),$e=4,G=8,fe=["a[href]","area[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","iframe",'[tabindex]:not([tabindex="-1"])'].join(","),et=(l,m)=>m?m(l):typeof l.label=="string"?l.label:String(l.value),tt=(l,m)=>{const x=m.trim();if(!x)return l;const h=l.toLowerCase().indexOf(x.toLowerCase());return h===-1?l:r.jsxs(r.Fragment,{children:[l.slice(0,h),r.jsx(Q.Text,{element:"span",modifiers:"bold",children:l.slice(h,h+x.length)}),l.slice(h+x.length)]})},he=o.forwardRef((l,m)=>{var ue;const{id:x,placeholder:h,isClearable:pe=!0,searchIcon:L="search",onSearch:u,onChange:q,onClear:be,onFocus:F,button:a,ariaLabel:me,className:xe,input:R,value:J,defaultValue:ye,suggestions:S,onSuggestionSelect:P,loading:v=!1,minQueryLength:W=0,hideOnScroll:_e=!1,renderSuggestionContent:E,getSuggestionText:ve,noResultsText:ge,loadingText:je,resultsCountText:Ce,footer:O,...I}=l,{getLabel:y}=Ye.useLabels(),Ne=o.useId(),k=x??Ne,d=S!==void 0,i=o.useMemo(()=>Array.isArray(S)?S:[],[S]),X=J!==void 0,[Re,Y]=o.useState(ye??""),f=J??Re,[K,g]=o.useState(!1),[c,B]=o.useState(null),Z=o.useRef([]),M=o.useRef(null),j=o.useRef(null),T=o.useRef(!1);o.useImperativeHandle(m,()=>j.current,[]);const $=f.trim().length>=W,z=!v&&i.length>0,Se=o.useMemo(()=>i.reduce((e,t,n)=>t.disabled?[...e,n]:e,[]),[i]),{refs:_,floatingStyles:Ie,context:ee}=C.useFloating({open:d&&K,onOpenChange:g,placement:"bottom-start",whileElementsMounted:Ze.autoUpdate,middleware:[D.offset($e),D.flip({padding:G}),D.shift({padding:G}),D.size({padding:G,apply({rects:e,elements:t,availableHeight:n}){t.floating.style.width=`${e.reference.width}px`,t.floating.style.setProperty("--tedi-search-panel-available-height",`${n}px`)}})]}),Te=C.useDismiss(ee,{ancestorScroll:_e}),we=C.useListNavigation(ee,{listRef:Z,activeIndex:c,onNavigate:B,virtual:!0,loop:!0,disabledIndices:Se}),{getReferenceProps:Ae,getFloatingProps:De,getItemProps:Le}=C.useInteractions([Te,we]);o.useEffect(()=>{var e;_.setPositionReference(((e=j.current)==null?void 0:e.inner)??null)},[_,d]);const te=`${k}-listbox`,ne=e=>`${k}-option-${e}`,p=d&&K&&$&&(v||z||f.trim().length>0),re=()=>M.current?Array.from(M.current.querySelectorAll(fe)):[],se=(e=!0)=>{var t,n;T.current=e,(n=(t=j.current)==null?void 0:t.input)==null||n.focus()},w=()=>{g(!1),B(null)},ae=e=>{e.disabled||(X||Y(et(e,ve)),P==null||P(e),w())},qe=e=>{X||Y(e),q==null||q(e),d&&(T.current=!1,B(null),g(e.trim().length>=W))},Fe=e=>{if(F==null||F(e),!!d){if(T.current){T.current=!1;return}$&&g(!0)}},Pe=e=>{e.key==="Enter"&&(u==null||u(f))},Ee=!v&&c!==null&&!((ue=i[c])!=null&&ue.disabled)?i[c]:void 0,Oe=()=>{var b,A;const e=(b=j.current)==null?void 0:b.input;if(!e)return;const t=_.floating.current,n=Array.from(document.body.querySelectorAll(fe)).filter(U=>!(t!=null&&t.contains(U)));(A=n[n.indexOf(e)+1])==null||A.focus()},ke=e=>{if(e.key==="Enter"){if(p&&c!==null&&i[c]&&!i[c].disabled){e.preventDefault(),ae(i[c]);return}u==null||u(f),g(!1);return}if(e.key==="Tab"&&!e.shiftKey&&p&&O){const t=re();t.length&&(e.preventDefault(),t[0].focus())}},Ke=e=>{if(!d||!K)return;const t=e.relatedTarget,n=_.floating.current;t&&(e.currentTarget.contains(t)||n!=null&&n.contains(t))||w()},Be=e=>{if(e.key==="Escape"){e.preventDefault(),w(),se();return}if(e.key!=="Tab")return;const t=re(),n=t.indexOf(e.target);e.shiftKey&&n===0?(e.preventDefault(),se()):!e.shiftKey&&n===t.length-1&&(e.preventDefault(),w(),Oe())},le=typeof L=="string"?{name:L}:L,Me={color:"secondary",...le,className:N.default(le.className,I.disabled&&s.default["tedi-search__icon--disabled"])},oe=d?Ae({role:"combobox","aria-autocomplete":"list","aria-expanded":p,"aria-controls":p&&z?te:void 0,"aria-activedescendant":p&&Ee&&c!==null?ne(c):void 0,onKeyDown:ke}):{role:"searchbox"},ie={...R,...oe};if(d){const e=R==null?void 0:R.onKeyDown,t=oe.onKeyDown;ie.onKeyDown=n=>{e==null||e(n),t==null||t(n)}}const ze={...I,ref:j,id:k,value:f,onChange:qe,onClear:be,onFocus:Fe,inputClassName:N.default(s.default["tedi-search__input"],a&&s.default["tedi-search__input--has-button"],xe),placeholder:h,isClearable:pe,input:ie,...a?{}:{icon:Me},...d?{}:{onKeyDown:Pe}},Ue=e=>{var t;(t=a==null?void 0:a.onClick)==null||t.call(a,e),u==null||u(f)},Ve=me||y("search"),ce=je??y("search.loading"),de=ge??y("search.no-results"),He=Ce??(e=>y("search.results-count",e)),Ge=p?v?ce:i.length>0?He(i.length):de:"",Qe=()=>v?r.jsxs("div",{className:s.default["tedi-search__panel-status"],children:[r.jsx(We.Spinner,{size:16}),r.jsx(Q.Text,{color:"tertiary",children:ce})]}):z?r.jsx("ul",{id:te,role:"listbox",className:s.default["tedi-search__panel-list"],children:i.map((e,t)=>{const n=c===t&&!e.disabled,b=typeof(e.label??e.value)=="string"?String(e.label??e.value):void 0,A=typeof e.description=="string"?e.description:void 0,U=!E&&b?[b,A].filter(Boolean).join(", "):void 0;return r.jsx("li",{id:ne(t),role:"option","aria-selected":n,"aria-disabled":e.disabled||void 0,"aria-label":U,ref:V=>{Z.current[t]=V},className:N.default(s.default["tedi-search__option"],{[s.default["tedi-search__option--active"]]:n,[s.default["tedi-search__option--disabled"]]:e.disabled}),...Le({onClick:()=>ae(e),onMouseDown:V=>V.preventDefault()}),children:E?E(e,{active:n,query:f}):r.jsxs(H.OptionContent,{disabled:e.disabled,layout:e.description!==void 0?"vertical":"horizontal",children:[r.jsx(H.OptionContent.Label,{children:b?tt(b,f):e.label??e.value}),e.description!==void 0&&r.jsx(H.OptionContent.Meta,{children:e.description})]})},e.value)})}):r.jsx("div",{className:s.default["tedi-search__panel-status"],children:r.jsx(Q.Text,{color:"tertiary",children:de})});return r.jsxs("div",{ref:_.setReference,className:N.default(s.default["tedi-search__wrapper"],I.size==="small"&&s.default["tedi-search__wrapper--small"],I.size==="large"&&s.default["tedi-search__wrapper--large"]),role:"search","aria-label":Ve,onBlur:Ke,children:[r.jsx(Xe.TextField,{...ze}),a&&r.jsx(Je.Button,{...a,onClick:Ue,className:N.default(s.default["tedi-search__button"],!a.children&&s.default["tedi-search__button--icon-only"],a.className),"aria-label":a["aria-label"]??(a.children?void 0:y("search")),children:a.children??y("search")}),d&&r.jsx("span",{"aria-live":"polite",role:"status",className:s.default["tedi-search__announcement"],children:Ge}),p&&r.jsx(C.FloatingPortal,{children:r.jsxs("div",{ref:_.setFloating,style:Ie,className:s.default["tedi-search__panel"],...De(),children:[Qe(),O&&r.jsx("div",{ref:M,className:s.default["tedi-search__footer"],onKeyDown:Be,children:O})]})})]})});he.displayName="Search";const nt=he;exports.Search=nt;
@@ -2,9 +2,32 @@ import { default as React } from 'react';
2
2
  import { IconWithoutBackgroundProps } from '../../base/icon/icon';
3
3
  import { ButtonProps } from '../../buttons/button/button';
4
4
  import { TextFieldForwardRef, TextFieldProps } from '../textfield/textfield';
5
- export interface SearchProps extends Omit<TextFieldProps, 'isTextArea' | 'icon' | 'onKeyPress'> {
5
+ export interface SearchSuggestion {
6
+ /**
7
+ * Stable value returned to `onSuggestionSelect` and used as the React key. For
8
+ * richer payloads keep a lookup keyed by this value on the consumer side.
9
+ */
10
+ value: string;
11
+ /**
12
+ * Visible label. Falls back to `value` when omitted.
13
+ */
14
+ label?: React.ReactNode;
15
+ /**
16
+ * Optional secondary line shown beneath the label (e.g. a code, category, or
17
+ * hint). Rendered as `OptionContent.Meta` in the default row layout; ignored
18
+ * when a custom `renderSuggestionContent` is supplied.
19
+ */
20
+ description?: React.ReactNode;
21
+ /**
22
+ * Renders the suggestion greyed out and skips it during keyboard navigation.
23
+ * @default false
24
+ */
25
+ disabled?: boolean;
26
+ }
27
+ export interface SearchProps extends Omit<TextFieldProps, 'isTextArea' | 'icon' | 'onIconClick' | 'iconButtonProps' | 'isArrowsHidden' | 'onKeyPress' | 'startSlot' | 'endSlot' | 'inputClassName'> {
6
28
  /**
7
29
  * Callback triggered when the search is executed (Enter key pressed or button clicked).
30
+ * In autocomplete mode it fires on Enter only when no suggestion is active — a free-text submit.
8
31
  */
9
32
  onSearch?: (value: string) => void;
10
33
  /**
@@ -20,5 +43,73 @@ export interface SearchProps extends Omit<TextFieldProps, 'isTextArea' | 'icon'
20
43
  * E.g., "Search products" or "Search site".
21
44
  */
22
45
  ariaLabel?: string;
46
+ /**
47
+ * Suggestions rendered in the popup. Providing this array (even empty) turns the
48
+ * field into an accessible combobox; leave it `undefined` for a plain search
49
+ * field. Filter / fetch these yourself in response to `onChange`; the component
50
+ * renders exactly what it is given.
51
+ */
52
+ suggestions?: SearchSuggestion[];
53
+ /**
54
+ * Fired when a suggestion is chosen (Enter on the active suggestion, or click). In
55
+ * controlled mode update `value` from here to reflect the picked label.
56
+ */
57
+ onSuggestionSelect?: (suggestion: SearchSuggestion) => void;
58
+ /**
59
+ * Shows a loading row in the popup instead of suggestions — use while an async
60
+ * request is in flight.
61
+ * @default false
62
+ */
63
+ loading?: boolean;
64
+ /**
65
+ * Minimum query length (after trimming) before the popup opens.
66
+ * @default 0
67
+ */
68
+ minQueryLength?: number;
69
+ /**
70
+ * Closes the suggestion popup when the page (or a scrollable ancestor) scrolls.
71
+ * Scrolling the suggestion list itself keeps the popup open.
72
+ * @default false
73
+ */
74
+ hideOnScroll?: boolean;
75
+ /**
76
+ * Custom suggestion renderer. Receives the suggestion plus its active state and
77
+ * the current query (handy for match highlighting).
78
+ */
79
+ renderSuggestionContent?: (suggestion: SearchSuggestion, state: {
80
+ active: boolean;
81
+ query: string;
82
+ }) => React.ReactNode;
83
+ /**
84
+ * Derives the input text to show after a suggestion is picked (uncontrolled mode).
85
+ * Defaults to the suggestion's string label, falling back to its `value`.
86
+ */
87
+ getSuggestionText?: (suggestion: SearchSuggestion) => string;
88
+ /**
89
+ * Text shown when there are no suggestions and it is not loading. Defaults to the
90
+ * localized `search.no-results` label.
91
+ */
92
+ noResultsText?: React.ReactNode;
93
+ /**
94
+ * Text shown in the loading row. Defaults to the localized `search.loading` label.
95
+ */
96
+ loadingText?: React.ReactNode;
97
+ /**
98
+ * Builds the politely announced live-region message stating how many suggestions
99
+ * are available. Defaults to the localized `search.results-count` label.
100
+ */
101
+ resultsCountText?: (count: number) => string;
102
+ /**
103
+ * Extra content pinned below the suggestions — fallback actions or a hint, for
104
+ * example. It shows whenever the popup is open, including the no-results state.
105
+ * `Tab` from the field moves focus into the footer's controls.
106
+ */
107
+ footer?: React.ReactNode;
108
+ /**
109
+ * Additional native attributes for the input element (e.g. `autoComplete`, `maxLength`).
110
+ * Narrowed to input attributes — a search field is always a single-line `<input>`.
111
+ */
112
+ input?: React.InputHTMLAttributes<HTMLInputElement>;
23
113
  }
24
114
  export declare const Search: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<TextFieldForwardRef>>;
115
+ export default Search;
@@ -1,74 +1,270 @@
1
- import { jsxs as b, jsx as t } from "react/jsx-runtime";
2
- import i from "../../../../../external/classnames/index.es.js";
3
- import { forwardRef as g } from "react";
4
- import { Button as k } from "../../buttons/button/button.es.js";
5
- import { TextField as B } from "../textfield/textfield.es.js";
6
- import a from "./search.module.scss.es.js";
7
- import { useLabels as C } from "../../../providers/label-provider/use-labels.es.js";
8
- const L = g(
9
- ({
10
- placeholder: d,
11
- isClearable: m = !0,
12
- searchIcon: l = "search",
13
- onSearch: s,
14
- onChange: n,
15
- button: e,
16
- ariaLabel: p,
17
- className: _,
18
- input: h,
19
- ...r
20
- }, f) => {
21
- const { getLabel: c } = C(), y = (v) => {
22
- v.key === "Enter" && (s == null || s(r.value));
23
- }, N = () => {
24
- s == null || s(r.value);
25
- }, o = typeof l == "string" ? { name: l } : l, u = {
26
- color: "secondary",
27
- ...o,
28
- className: i(o.className, r.disabled && a["tedi-search__icon--disabled"])
29
- }, w = {
30
- ...r,
31
- ref: f,
32
- inputClassName: i(a["tedi-search__input"], e && a["tedi-search__input--has-button"], _),
33
- placeholder: d,
34
- isClearable: m,
35
- onKeyDown: y,
36
- onChange: n,
37
- input: { ...h, role: "searchbox" },
38
- ...e ? {} : { icon: u }
39
- }, x = p || c("search");
40
- return /* @__PURE__ */ b(
41
- "div",
42
- {
43
- className: i(
44
- a["tedi-search__wrapper"],
45
- r.size === "small" && a["tedi-search__wrapper--small"],
46
- r.size === "large" && a["tedi-search__wrapper--large"]
47
- ),
48
- role: "search",
49
- "aria-label": x,
50
- children: [
51
- /* @__PURE__ */ t(B, { ...w }),
52
- e && /* @__PURE__ */ t(
53
- k,
54
- {
55
- ...e,
56
- onClick: N,
57
- className: i(
58
- a["tedi-search__button"],
59
- !e.children && a["tedi-search__button--icon-only"],
60
- e.className
61
- ),
62
- "aria-label": e.children ? void 0 : c("search"),
63
- children: e.children ?? c("search")
64
- }
65
- )
66
- ]
1
+ import { jsxs as C, jsx as s, Fragment as We } from "react/jsx-runtime";
2
+ import { useFloating as Xe, useDismiss as Ye, useListNavigation as Ze, useInteractions as et, FloatingPortal as tt } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import g from "../../../../../external/classnames/index.es.js";
4
+ import q, { forwardRef as rt, useMemo as pe, useState as H, useRef as T } from "react";
5
+ import { Text as Q } from "../../base/typography/text/text.es.js";
6
+ import { Button as nt } from "../../buttons/button/button.es.js";
7
+ import { Spinner as ot } from "../../loaders/spinner/spinner.es.js";
8
+ import { OptionContent as U } from "../../misc/option-content/option-content.es.js";
9
+ import { TextField as st } from "../textfield/textfield.es.js";
10
+ import n from "./search.module.scss.es.js";
11
+ import { useLabels as at } from "../../../providers/label-provider/use-labels.es.js";
12
+ import { autoUpdate as it } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
13
+ import { offset as lt, flip as ct, shift as dt, size as ut } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
14
+ const ft = 4, G = 8, he = [
15
+ "a[href]",
16
+ "area[href]",
17
+ "button:not([disabled])",
18
+ "input:not([disabled])",
19
+ "select:not([disabled])",
20
+ "textarea:not([disabled])",
21
+ "iframe",
22
+ '[tabindex]:not([tabindex="-1"])'
23
+ ].join(","), pt = (a, m) => m ? m(a) : typeof a.label == "string" ? a.label : String(a.value), ht = (a, m) => {
24
+ const b = m.trim();
25
+ if (!b) return a;
26
+ const f = a.toLowerCase().indexOf(b.toLowerCase());
27
+ return f === -1 ? a : /* @__PURE__ */ C(We, { children: [
28
+ a.slice(0, f),
29
+ /* @__PURE__ */ s(Q, { element: "span", modifiers: "bold", children: a.slice(f, f + b.length) }),
30
+ a.slice(f + b.length)
31
+ ] });
32
+ }, me = rt((a, m) => {
33
+ var fe;
34
+ const {
35
+ id: b,
36
+ placeholder: f,
37
+ isClearable: be = !0,
38
+ searchIcon: F = "search",
39
+ onSearch: d,
40
+ onChange: S,
41
+ onClear: ye,
42
+ onFocus: E,
43
+ button: o,
44
+ ariaLabel: _e,
45
+ className: ve,
46
+ input: I,
47
+ value: J,
48
+ defaultValue: xe,
49
+ suggestions: w,
50
+ onSuggestionSelect: P,
51
+ loading: v = !1,
52
+ minQueryLength: W = 0,
53
+ hideOnScroll: Ne = !1,
54
+ renderSuggestionContent: k,
55
+ getSuggestionText: ge,
56
+ noResultsText: Ce,
57
+ loadingText: Ie,
58
+ resultsCountText: we,
59
+ footer: K,
60
+ ...A
61
+ } = a, { getLabel: y } = at(), Ae = q.useId(), B = b ?? Ae, c = w !== void 0, i = pe(() => Array.isArray(w) ? w : [], [w]), X = J !== void 0, [De, Y] = H(xe ?? ""), u = J ?? De, [O, x] = H(!1), [l, M] = H(null), Z = T([]), z = T(null), N = T(null), D = T(!1);
62
+ q.useImperativeHandle(m, () => N.current, []);
63
+ const ee = u.trim().length >= W, V = !v && i.length > 0, Re = pe(
64
+ () => i.reduce((e, t, r) => t.disabled ? [...e, r] : e, []),
65
+ [i]
66
+ ), { refs: _, floatingStyles: Le, context: te } = Xe({
67
+ open: c && O,
68
+ onOpenChange: x,
69
+ placement: "bottom-start",
70
+ whileElementsMounted: it,
71
+ middleware: [
72
+ lt(ft),
73
+ ct({ padding: G }),
74
+ dt({ padding: G }),
75
+ ut({
76
+ padding: G,
77
+ apply({ rects: e, elements: t, availableHeight: r }) {
78
+ t.floating.style.width = `${e.reference.width}px`, t.floating.style.setProperty("--tedi-search-panel-available-height", `${r}px`);
79
+ }
80
+ })
81
+ ]
82
+ }), Te = Ye(te, { ancestorScroll: Ne }), Fe = Ze(te, {
83
+ listRef: Z,
84
+ activeIndex: l,
85
+ onNavigate: M,
86
+ virtual: !0,
87
+ loop: !0,
88
+ disabledIndices: Re
89
+ }), { getReferenceProps: Se, getFloatingProps: Ee, getItemProps: Pe } = et([Te, Fe]);
90
+ q.useEffect(() => {
91
+ var e;
92
+ _.setPositionReference(((e = N.current) == null ? void 0 : e.inner) ?? null);
93
+ }, [_, c]);
94
+ const re = `${B}-listbox`, ne = (e) => `${B}-option-${e}`, p = c && O && ee && (v || V || u.trim().length > 0), oe = () => z.current ? Array.from(z.current.querySelectorAll(he)) : [], se = (e = !0) => {
95
+ var t, r;
96
+ D.current = e, (r = (t = N.current) == null ? void 0 : t.input) == null || r.focus();
97
+ }, R = () => {
98
+ x(!1), M(null);
99
+ }, ae = (e) => {
100
+ e.disabled || (X || Y(pt(e, ge)), P == null || P(e), R());
101
+ }, ke = (e) => {
102
+ X || Y(e), S == null || S(e), c && (D.current = !1, M(null), x(e.trim().length >= W));
103
+ }, Ke = (e) => {
104
+ if (E == null || E(e), !!c) {
105
+ if (D.current) {
106
+ D.current = !1;
107
+ return;
67
108
  }
109
+ ee && x(!0);
110
+ }
111
+ }, Be = (e) => {
112
+ e.key === "Enter" && (d == null || d(u));
113
+ }, Oe = !v && l !== null && !((fe = i[l]) != null && fe.disabled) ? i[l] : void 0, Me = () => {
114
+ var h, L;
115
+ const e = (h = N.current) == null ? void 0 : h.input;
116
+ if (!e) return;
117
+ const t = _.floating.current, r = Array.from(document.body.querySelectorAll(he)).filter(
118
+ ($) => !(t != null && t.contains($))
68
119
  );
120
+ (L = r[r.indexOf(e) + 1]) == null || L.focus();
121
+ }, ze = (e) => {
122
+ if (e.key === "Enter") {
123
+ if (p && l !== null && i[l] && !i[l].disabled) {
124
+ e.preventDefault(), ae(i[l]);
125
+ return;
126
+ }
127
+ d == null || d(u), x(!1);
128
+ return;
129
+ }
130
+ if (e.key === "Tab" && !e.shiftKey && p && K) {
131
+ const t = oe();
132
+ t.length && (e.preventDefault(), t[0].focus());
133
+ }
134
+ }, Ve = (e) => {
135
+ if (!c || !O) return;
136
+ const t = e.relatedTarget, r = _.floating.current;
137
+ t && (e.currentTarget.contains(t) || r != null && r.contains(t)) || R();
138
+ }, $e = (e) => {
139
+ if (e.key === "Escape") {
140
+ e.preventDefault(), R(), se();
141
+ return;
142
+ }
143
+ if (e.key !== "Tab") return;
144
+ const t = oe(), r = t.indexOf(e.target);
145
+ e.shiftKey && r === 0 ? (e.preventDefault(), se()) : !e.shiftKey && r === t.length - 1 && (e.preventDefault(), R(), Me());
146
+ }, ie = typeof F == "string" ? { name: F } : F, je = {
147
+ color: "secondary",
148
+ ...ie,
149
+ className: g(ie.className, A.disabled && n["tedi-search__icon--disabled"])
150
+ }, le = c ? Se({
151
+ role: "combobox",
152
+ "aria-autocomplete": "list",
153
+ "aria-expanded": p,
154
+ "aria-controls": p && V ? re : void 0,
155
+ "aria-activedescendant": p && Oe && l !== null ? ne(l) : void 0,
156
+ onKeyDown: ze
157
+ }) : { role: "searchbox" }, ce = { ...I, ...le };
158
+ if (c) {
159
+ const e = I == null ? void 0 : I.onKeyDown, t = le.onKeyDown;
160
+ ce.onKeyDown = (r) => {
161
+ e == null || e(r), t == null || t(r);
162
+ };
69
163
  }
70
- );
71
- L.displayName = "Search";
164
+ const qe = {
165
+ ...A,
166
+ ref: N,
167
+ id: B,
168
+ value: u,
169
+ onChange: ke,
170
+ onClear: ye,
171
+ onFocus: Ke,
172
+ inputClassName: g(n["tedi-search__input"], o && n["tedi-search__input--has-button"], ve),
173
+ placeholder: f,
174
+ isClearable: be,
175
+ input: ce,
176
+ ...o ? {} : { icon: je },
177
+ ...c ? {} : { onKeyDown: Be }
178
+ }, He = (e) => {
179
+ var t;
180
+ (t = o == null ? void 0 : o.onClick) == null || t.call(o, e), d == null || d(u);
181
+ }, Ue = _e || y("search"), de = Ie ?? y("search.loading"), ue = Ce ?? y("search.no-results"), Ge = we ?? ((e) => y("search.results-count", e)), Qe = p ? v ? de : i.length > 0 ? Ge(i.length) : ue : "", Je = () => v ? /* @__PURE__ */ C("div", { className: n["tedi-search__panel-status"], children: [
182
+ /* @__PURE__ */ s(ot, { size: 16 }),
183
+ /* @__PURE__ */ s(Q, { color: "tertiary", children: de })
184
+ ] }) : V ? /* @__PURE__ */ s("ul", { id: re, role: "listbox", className: n["tedi-search__panel-list"], children: i.map((e, t) => {
185
+ const r = l === t && !e.disabled, h = typeof (e.label ?? e.value) == "string" ? String(e.label ?? e.value) : void 0, L = typeof e.description == "string" ? e.description : void 0, $ = !k && h ? [h, L].filter(Boolean).join(", ") : void 0;
186
+ return /* @__PURE__ */ s(
187
+ "li",
188
+ {
189
+ id: ne(t),
190
+ role: "option",
191
+ "aria-selected": r,
192
+ "aria-disabled": e.disabled || void 0,
193
+ "aria-label": $,
194
+ ref: (j) => {
195
+ Z.current[t] = j;
196
+ },
197
+ className: g(n["tedi-search__option"], {
198
+ [n["tedi-search__option--active"]]: r,
199
+ [n["tedi-search__option--disabled"]]: e.disabled
200
+ }),
201
+ ...Pe({
202
+ onClick: () => ae(e),
203
+ onMouseDown: (j) => j.preventDefault()
204
+ }),
205
+ children: k ? k(e, { active: r, query: u }) : /* @__PURE__ */ C(
206
+ U,
207
+ {
208
+ disabled: e.disabled,
209
+ layout: e.description !== void 0 ? "vertical" : "horizontal",
210
+ children: [
211
+ /* @__PURE__ */ s(U.Label, { children: h ? ht(h, u) : e.label ?? e.value }),
212
+ e.description !== void 0 && /* @__PURE__ */ s(U.Meta, { children: e.description })
213
+ ]
214
+ }
215
+ )
216
+ },
217
+ e.value
218
+ );
219
+ }) }) : /* @__PURE__ */ s("div", { className: n["tedi-search__panel-status"], children: /* @__PURE__ */ s(Q, { color: "tertiary", children: ue }) });
220
+ return /* @__PURE__ */ C(
221
+ "div",
222
+ {
223
+ ref: _.setReference,
224
+ className: g(
225
+ n["tedi-search__wrapper"],
226
+ A.size === "small" && n["tedi-search__wrapper--small"],
227
+ A.size === "large" && n["tedi-search__wrapper--large"]
228
+ ),
229
+ role: "search",
230
+ "aria-label": Ue,
231
+ onBlur: Ve,
232
+ children: [
233
+ /* @__PURE__ */ s(st, { ...qe }),
234
+ o && /* @__PURE__ */ s(
235
+ nt,
236
+ {
237
+ ...o,
238
+ onClick: He,
239
+ className: g(
240
+ n["tedi-search__button"],
241
+ !o.children && n["tedi-search__button--icon-only"],
242
+ o.className
243
+ ),
244
+ "aria-label": o["aria-label"] ?? (o.children ? void 0 : y("search")),
245
+ children: o.children ?? y("search")
246
+ }
247
+ ),
248
+ c && /* @__PURE__ */ s("span", { "aria-live": "polite", role: "status", className: n["tedi-search__announcement"], children: Qe }),
249
+ p && /* @__PURE__ */ s(tt, { children: /* @__PURE__ */ C(
250
+ "div",
251
+ {
252
+ ref: _.setFloating,
253
+ style: Le,
254
+ className: n["tedi-search__panel"],
255
+ ...Ee(),
256
+ children: [
257
+ Je(),
258
+ K && /* @__PURE__ */ s("div", { ref: z, className: n["tedi-search__footer"], onKeyDown: $e, children: K })
259
+ ]
260
+ }
261
+ ) })
262
+ ]
263
+ }
264
+ );
265
+ });
266
+ me.displayName = "Search";
267
+ const Rt = me;
72
268
  export {
73
- L as Search
269
+ Rt as Search
74
270
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-search__wrapper":"tedi-search__wrapper-92d6f11f","tedi-search__input":"tedi-search__input-94d53b76","tedi-search__input--has-button":"tedi-search__input--has-button-d8e073e7","tedi-search__icon--disabled":"tedi-search__icon--disabled-2b492592","tedi-search__button":"tedi-search__button-cbb4df17","tedi-search__wrapper--small":"tedi-search__wrapper--small-7c104c6a","tedi-search__wrapper--large":"tedi-search__wrapper--large-b59e60d7","tedi-search__button--icon-only":"tedi-search__button--icon-only-cf897af5"};exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-search__wrapper":"tedi-search__wrapper-92d6f11f","tedi-search__input":"tedi-search__input-94d53b76","tedi-search__input--has-button":"tedi-search__input--has-button-d8e073e7","tedi-search__icon--disabled":"tedi-search__icon--disabled-2b492592","tedi-search__button":"tedi-search__button-cbb4df17","tedi-search__wrapper--small":"tedi-search__wrapper--small-7c104c6a","tedi-search__wrapper--large":"tedi-search__wrapper--large-b59e60d7","tedi-search__button--icon-only":"tedi-search__button--icon-only-cf897af5","tedi-search__panel":"tedi-search__panel-7a3fa5f0","tedi-search__panel-list":"tedi-search__panel-list-78174923","tedi-search__option":"tedi-search__option-a57e9a32","tedi-search__option--active":"tedi-search__option--active-4831d2e9","tedi-search__option--disabled":"tedi-search__option--disabled-c0308fc9","tedi-search__panel-status":"tedi-search__panel-status-1f8248ab","tedi-search__footer":"tedi-search__footer-d45973c7","tedi-search__announcement":"tedi-search__announcement-fbcbe856"};exports.default=e;
@@ -6,7 +6,15 @@ const e = {
6
6
  "tedi-search__button": "tedi-search__button-cbb4df17",
7
7
  "tedi-search__wrapper--small": "tedi-search__wrapper--small-7c104c6a",
8
8
  "tedi-search__wrapper--large": "tedi-search__wrapper--large-b59e60d7",
9
- "tedi-search__button--icon-only": "tedi-search__button--icon-only-cf897af5"
9
+ "tedi-search__button--icon-only": "tedi-search__button--icon-only-cf897af5",
10
+ "tedi-search__panel": "tedi-search__panel-7a3fa5f0",
11
+ "tedi-search__panel-list": "tedi-search__panel-list-78174923",
12
+ "tedi-search__option": "tedi-search__option-a57e9a32",
13
+ "tedi-search__option--active": "tedi-search__option--active-4831d2e9",
14
+ "tedi-search__option--disabled": "tedi-search__option--disabled-c0308fc9",
15
+ "tedi-search__panel-status": "tedi-search__panel-status-1f8248ab",
16
+ "tedi-search__footer": "tedi-search__footer-d45973c7",
17
+ "tedi-search__announcement": "tedi-search__announcement-fbcbe856"
10
18
  };
11
19
  export {
12
20
  e as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),ne=require("../../overlays/tooltip/tooltip.cjs.js"),de=require("../../overlays/tooltip/tooltip-content.cjs.js"),oe=require("../../overlays/tooltip/tooltip-trigger.cjs.js"),ue=require("../feedback-text/feedback-text.cjs.js"),ce=require("../form-label/form-label.cjs.js"),t=require("./slider.module.scss.cjs.js"),fe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=e.forwardRef((h,M)=>{const{getCurrentBreakpointProps:V}=fe.useBreakpointProps(h.defaultServerBreakpoint),{id:E,name:P,label:x,hideLabel:R,required:_,min:l=0,max:d=100,step:D=1,value:c,defaultValue:$,onChange:o,disabled:s=!1,invalid:H=!1,minLabel:f,maxLabel:O,showCurrentValue:p=!1,valueFormatter:k,tooltip:U=!0,addonRight:j,helper:r,className:z,"aria-label":A,"aria-labelledby":G,"aria-valuetext":J}=V(h),K=e.useId(),b=E??`tedi-slider-${K}`,w=r?r.id??`${b}-helper`:void 0,[Q,W]=e.useState($??l),u=Math.min(d,Math.max(l,c??Q)),[X,L]=e.useState(!1),[Y,N]=e.useState(!1),[i,C]=e.useState(!1),S=!!U&&!s,Z=S&&(X||Y||i),ee=e.useCallback(()=>L(!0),[]),ae=e.useCallback(()=>L(!1),[]),te=e.useCallback(()=>N(!0),[]),re=e.useCallback(()=>N(!1),[]),T=e.useRef(null),n=e.useCallback(()=>{T.current=null,C(!1)},[]);e.useEffect(()=>{if(i)return window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[i,n]);const le=e.useCallback(g=>{s||(T.current=g.pointerId,C(!0))},[s]),se=e.useCallback(g=>{const B=Number(g.target.value);c===void 0&&W(B),o==null||o(B)},[o,c]),q=H||(r==null?void 0:r.type)==="error",I=d===l?0:(u-l)/(d-l)*100,y=k?k(u):u,v=p?y:O,ie=m.default(t.default["tedi-slider"],{[t.default["tedi-slider--disabled"]]:s,[t.default["tedi-slider--invalid"]]:q,[t.default["tedi-slider--dragging"]]:i&&!s},z);return a.jsxs("div",{"data-name":"slider",className:ie,children:[x&&a.jsx(ce.FormLabel,{id:b,label:x,required:_,hideLabel:R}),a.jsxs("div",{className:t.default["tedi-slider__container"],children:[a.jsxs("div",{className:t.default["tedi-slider__track-row"],children:[f!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":"true",children:f}),a.jsxs("div",{className:t.default["tedi-slider__track"],style:{"--tedi-slider-progress":`${I}%`,"--tedi-slider-progress-ratio":`${I/100}`},children:[a.jsx("input",{ref:M,id:b,name:P,type:"range",min:l,max:d,step:D,value:u,disabled:s,required:_,"aria-invalid":q?"true":void 0,"aria-describedby":w,"aria-label":A,"aria-labelledby":G,"aria-valuetext":J,onChange:se,onMouseEnter:ee,onMouseLeave:ae,onPointerDown:le,onFocus:te,onBlur:re,className:m.default(t.default["tedi-slider__input"],{[t.default["tedi-slider__input--dragging"]]:i})}),S&&a.jsxs(ne.Tooltip,{open:Z,onToggle:()=>{},focusManager:{returnFocus:!1,initialFocus:-1},placement:"top",trackReferencePosition:!0,children:[a.jsx(oe.TooltipTrigger,{children:a.jsx("span",{className:t.default["tedi-slider__thumb-anchor"],"aria-hidden":"true",tabIndex:-1})}),a.jsx(de.TooltipContent,{children:y})]})]}),v!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":p?void 0:"true","aria-live":p?"polite":void 0,children:v})]}),j&&a.jsx("div",{className:t.default["tedi-slider__addon"],children:j})]}),r&&a.jsx(ue.FeedbackText,{...r,id:w,className:m.default(t.default["tedi-slider__feedback"],r.className)})]})});F.displayName="Slider";exports.Slider=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),B=require("../../../../../external/classnames/index.cjs.js"),e=require("react"),ne=require("../../overlays/tooltip/tooltip.cjs.js"),de=require("../../overlays/tooltip/tooltip-content.cjs.js"),oe=require("../../overlays/tooltip/tooltip-trigger.cjs.js"),ue=require("../feedback-text/feedback-text.cjs.js"),ce=require("../form-label/form-label.cjs.js"),t=require("./slider.module.scss.cjs.js"),pe=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),F=e.forwardRef((m,M)=>{const{getCurrentBreakpointProps:V}=pe.useBreakpointProps(m.defaultServerBreakpoint),{id:E,name:P,label:h,hideLabel:R,required:x,min:l=0,max:d=100,step:D=1,value:c,defaultValue:$,onChange:o,disabled:i=!1,invalid:H=!1,minLabel:p,maxLabel:O,showCurrentValue:f=!1,valueFormatter:_,tooltip:U=!0,addonRight:j,helper:r,className:z,"aria-label":A,"aria-labelledby":G,"aria-valuetext":J}=V(m),K=e.useId(),v=E??`tedi-slider-${K}`,k=r?r.id??`${v}-helper`:void 0,[Q,W]=e.useState($??l),u=Math.min(d,Math.max(l,c??Q)),[X,w]=e.useState(!1),[Y,L]=e.useState(!1),[s,C]=e.useState(!1),N=!!U&&!i,Z=N&&(X||Y||s),ee=e.useCallback(()=>w(!0),[]),ae=e.useCallback(()=>w(!1),[]),te=e.useCallback(()=>L(!0),[]),re=e.useCallback(()=>L(!1),[]),S=e.useRef(null),n=e.useCallback(()=>{S.current=null,C(!1)},[]);e.useEffect(()=>{if(s)return window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[s,n]);const le=e.useCallback(g=>{i||(S.current=g.pointerId,C(!0))},[i]),ie=e.useCallback(g=>{const y=Number(g.target.value);c===void 0&&W(y),o==null||o(y)},[o,c]),T=H||(r==null?void 0:r.type)==="error",q=d===l?0:(u-l)/(d-l)*100,I=_?_(u):u,b=f?I:O,se=B.default(t.default["tedi-slider"],{[t.default["tedi-slider--disabled"]]:i,[t.default["tedi-slider--invalid"]]:T,[t.default["tedi-slider--dragging"]]:s&&!i},z);return a.jsxs("div",{"data-name":"slider",className:se,children:[h&&a.jsx(ce.FormLabel,{id:v,label:h,required:x,hideLabel:R}),a.jsxs("div",{className:t.default["tedi-slider__container"],children:[a.jsxs("div",{className:t.default["tedi-slider__track-row"],children:[p!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":"true",children:p}),a.jsxs("div",{className:t.default["tedi-slider__track"],style:{"--tedi-slider-progress":`${q}%`,"--tedi-slider-progress-ratio":`${q/100}`},children:[a.jsx("input",{ref:M,id:v,name:P,type:"range",min:l,max:d,step:D,value:u,disabled:i,required:x,"aria-invalid":T?"true":void 0,"aria-describedby":k,"aria-label":A,"aria-labelledby":G,"aria-valuetext":J,onChange:ie,onMouseEnter:ee,onMouseLeave:ae,onPointerDown:le,onFocus:te,onBlur:re,className:B.default(t.default["tedi-slider__input"],{[t.default["tedi-slider__input--dragging"]]:s})}),N&&a.jsxs(ne.Tooltip,{open:Z,onToggle:()=>{},focusManager:{returnFocus:!1,initialFocus:-1},placement:"top",trackReferencePosition:!0,children:[a.jsx(oe.TooltipTrigger,{children:a.jsx("span",{className:t.default["tedi-slider__thumb-anchor"],"aria-hidden":"true",tabIndex:-1})}),a.jsx(de.TooltipContent,{children:I})]})]}),b!=null&&a.jsx("span",{className:t.default["tedi-slider__range-label"],"aria-hidden":f?void 0:"true","aria-live":f?"polite":void 0,children:b})]}),j&&a.jsx("div",{className:t.default["tedi-slider__addon"],children:j})]}),r&&a.jsx(ue.FeedbackText,{...r,id:k})]})});F.displayName="Slider";exports.Slider=F;