design-system-silkhaus 3.2.0-beta.dropdown.4 → 3.2.0-beta.dropdown.6

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.
@@ -99,7 +99,7 @@ export declare interface DropdownProps {
99
99
  /**
100
100
  * Callback when dropdown value is changed
101
101
  */
102
- onChange?: (selectedOption: DropdownOption) => void;
102
+ onChange?: (selectedOption: DropdownOption | DropdownOption[]) => void;
103
103
  /**
104
104
  * Pass this callback function if you want to override the default selected value display text.
105
105
  * By default the dropdown will display the label from the selected option
package/dist/app/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Y=Object.defineProperty,Z=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var P=(e,t,d)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[t]=d,w=(e,t)=>{for(var d in t||(t={}))W.call(t,d)&&P(e,d,t[d]);if(z)for(var d of z(t))T.call(t,d)&&P(e,d,t[d]);return e},F=(e,t)=>Z(e,O(t));var A=(e,t)=>{var d={};for(var r in e)W.call(e,r)&&t.indexOf(r)<0&&(d[r]=e[r]);if(e!=null&&z)for(var r of z(e))t.indexOf(r)<0&&T.call(e,r)&&(d[r]=e[r]);return d};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Checkbox-D0PLHW4-.cjs"),f=require("react"),U=({children:e,size:t="small"})=>s.jsxRuntimeExports.jsx("div",{className:`ds-flex ds-items-center ds-justify-center ${t==="small"?"ds-h-5 ds-w-5":"ds-h-6 ds-w-6"}`,children:e}),ss={primary:"ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-rounded-sm hover:ds-text-Text-textPrimaryDark hover:ds-bg-Background-accentEggplant-highlight hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-Background-accentEggplant-darkened focus:ds-bg-Background-accentEggplant-100 focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:focus:ds-shadow-none disabled:ds-bg-Background-accentEggplant-20 ds-text-mediumFootnoteEmphasized",secondary:"ds-text-black ds-rounded-sm ds-border ds-border-Fills-terciary hover:ds-bg-[#F6F8FC] hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-[#F6F8FC] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] focus:ds-bg-[#F6F8FC] focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:ds-border disabled:ds-border-Fills-terciary disabled:ds-text-Text-tertiary disabled:ds-bg-transparent ds-text-mediumFootnoteEmphasized"},es={primary:"ds-rounded-sm ds-border ds-text-black ds-border-Fills-terciary ds-bg-[#F6F8FC] ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized",secondary:"ds-rounded-sm ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized"},D=f.forwardRef((E,R)=>{var l=E,{color:e="primary",disabled:t=!1,className:d,children:r,startIcon:n,selected:c,endIcon:i,trackingId:x,helperText:j,helpterTextClassName:y,buttonClassName:h}=l,u=A(l,["color","disabled","className","children","startIcon","selected","endIcon","trackingId","helperText","helpterTextClassName","buttonClassName"]);return s.jsxRuntimeExports.jsxs("div",{className:s.cn("ds-flex ds-flex-col ds-gap-1",d),children:[s.jsxRuntimeExports.jsxs("button",F(w({"data-tracking-id":x,ref:R,disabled:t,className:s.twMerge(s.clsx({[es[e]]:c,[ss[e]]:!c},"ds-px-2 ds-py-1","ds-flex ds-w-full ds-flex-1 ds-items-center ds-justify-center",h))},u),{children:[n&&s.jsxRuntimeExports.jsx(U,{children:n}),r&&s.jsxRuntimeExports.jsx("div",{className:`${n?"ds-ml-1":""} ${i?"ds-mr-1":""}`,children:r}),i&&s.jsxRuntimeExports.jsx(U,{children:i})]})),j&&s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-w-full ds-text-right ds-text-mediumFootnoteRegular",y),children:j})]})});D.displayName="Button";const $=f.forwardRef((e,t)=>{const C=e,{value:d,options:r,onSelectionChange:n=()=>{},isMultiSelect:c,noDataError:i,buttonMinWidth:x,buttonWidth:j,minSelectionError:y,buttonsContainerClassName:h,buttonClassName:u}=C,R=A(C,["value","options","onSelectionChange","isMultiSelect","noDataError","buttonMinWidth","buttonWidth","minSelectionError","buttonsContainerClassName","buttonClassName"]),[E,l]=f.useState([]),[b,m]=f.useState("");f.useEffect(()=>{d&&d.length?l(d):l([])},[d]);const g=(a,o)=>{o.currentTarget.blur();const p=[...E],B=p.findIndex(I=>I.value===a.value);B!==-1?p.length>1?(p.splice(B,1),m("")):m(y):(p.push(a),m("")),l(p),n(p)},N=(a,o)=>{o.currentTarget.blur();const p=[a];l(p),n(p)};return s.jsxRuntimeExports.jsxs("div",F(w({ref:t},R),{children:[s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-flex ds-flex-wrap ds-gap-2",h),children:r.length>0?r.map(a=>s.jsxRuntimeExports.jsx(f.Fragment,{children:c?s.jsxRuntimeExports.jsx(D,{selected:E.some(o=>o.value===a.value),onClick:o=>g(a,o),color:"secondary",style:{minWidth:x,width:j},className:u,startIcon:a.startIcon,endIcon:a.endIcon,children:a.label}):s.jsxRuntimeExports.jsx(D,{selected:E.some(o=>o.value===a.value),onClick:o=>N(a,o),color:"secondary",style:{minWidth:x,width:j},className:u,startIcon:a.startIcon,endIcon:a.endIcon,children:a.label})},a.value)):s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:i})}),b&&s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:b})]}))});$.displayName="ButtonsGroupSelector";const G=e=>window.innerWidth<s.tabletMinWidth?s.jsxRuntimeExports.jsx(V,w({},e)):s.jsxRuntimeExports.jsx(M,w({},e));G.displayName="Dropdown";const M=({placement:e="bottom-start",trigger:t,triggerContainerClassName:d,disabled:r,onOpenChange:n,adjustHeight:c=!0,adjustWidth:i=!0,options:x,getSelectedValueDisplayText:j=K,placeholder:y,value:h,isMultiSelect:u})=>{const[R,E]=f.useState(),l=typeof h=="undefined"?R:h,b=typeof h=="undefined"?E:()=>{},[m,g]=f.useState(!1),{refs:N,floatingStyles:C,context:a}=s.useFloating({open:m,onOpenChange:v=>{g(v),n&&n(v)},middleware:[s.offset(8),s.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"end"}),s.shift({padding:4}),s.size({apply({availableWidth:v,availableHeight:k,elements:_}){c&&(_.floating.style.maxHeight=`${k-4}px`),i&&(_.floating.style.maxWidth=`${v-4}px`)}})],whileElementsMounted:s.autoUpdate,placement:e}),o=s.useClick(a),p=s.useFocus(a),B=s.useDismiss(a),I=s.useRole(a),{getReferenceProps:L,getFloatingProps:Q}=s.useInteractions([o,p,B,I]);return t||(t=s.jsxRuntimeExports.jsx(H,{selectedOption:S(l,x),getSelectedValueDisplayText:j,placeholder:y})),r?s.jsxRuntimeExports.jsx("div",{className:d,children:t}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",F(w({className:s.cn("ds-cursor-pointer",d),ref:N.setReference},L()),{children:t})),m&&s.jsxRuntimeExports.jsx(s.FloatingPortal,{children:s.jsxRuntimeExports.jsx("div",F(w({ref:N.setFloating,style:C},Q()),{className:s.cn("ds-z-[29999] ds-flex ds-min-w-[200px] ds-flex-col ds-gap-1 ds-rounded ds-bg-white ds-p-2 ds-shadow-md",c&&"ds-overflow-y-auto",i&&"ds-overflow-x-auto"),children:s.jsxRuntimeExports.jsx(J,{isMultiSelect:u,options:x,onOptionClick:v=>{let k;if(u){const _=l||[];_.includes(v.value)?k=_.filter(X=>X!==v.value):k=[..._,v.value]}else k=v.value,g(!1);b(k)},selectedOption:S(l,x)})}))})]})};M.displayName="DesktopDropdown";const V=({trigger:e,triggerContainerClassName:t,disabled:d,onOpenChange:r,getSelectedValueDisplayText:n=K,placeholder:c,value:i,options:x,isMultiSelect:j})=>{const[y,h]=f.useState(),u=typeof i=="undefined"?y:i,R=typeof i=="undefined"?h:()=>{},[E,l]=f.useState(!1);return e||(e=s.jsxRuntimeExports.jsx(H,{selectedOption:S(u,x),getSelectedValueDisplayText:n,placeholder:c})),d?s.jsxRuntimeExports.jsx("div",{className:t,children:e}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:t,onClick:()=>{l(!0),r&&r(!0)},children:e}),s.jsxRuntimeExports.jsx(s.AnimatedModal,{animation:"slideUp",show:E,handleClose:()=>{l(!1),r&&r(!1)},contentClassName:s.cn("ds-absolute ds-mb-0 ds-w-full"),className:"ds-z-[29999]",children:s.jsxRuntimeExports.jsx(q,{onClose:()=>{l(!1),r&&r(!1)},children:s.jsxRuntimeExports.jsx(J,{isMultiSelect:j,options:x,onOptionClick:b=>{let m;if(j){const g=u||[];g.includes(b.value)?m=g.filter(N=>N!==b.value):m=[...g,b.value]}else m=b.value,l(!1);R(m)},selectedOption:S(u,x)})})})]})};V.displayName="MobileDropdown";const q=({onClose:e,children:t})=>s.jsxRuntimeExports.jsxs("div",{className:"ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white",children:[s.jsxRuntimeExports.jsxs("div",{className:"ds-flex ds-shrink-0 ds-items-center ds-justify-between ds-px-8 ds-py-4",children:[s.jsxRuntimeExports.jsx("div",{onClick:e,className:"ds-flex ds-size-5 ds-cursor-pointer ds-items-center ds-justify-center",children:s.jsxRuntimeExports.jsx(s.CloseIcon,{className:"ds-size-4"})}),s.jsxRuntimeExports.jsx("div",{className:"ds-size-5"})]}),s.jsxRuntimeExports.jsx("div",{className:"ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular",children:t}),s.jsxRuntimeExports.jsx("div",{className:"ds-px-8 ds-py-4",children:s.jsxRuntimeExports.jsx(s.Button,{buttonClassName:"ds-py-3",onClick:e,children:"Close"})})]});q.displayName="MobilePopoverContentWrapper";const H=({selectedOption:e,getSelectedValueDisplayText:t,placeholder:d})=>{const r=!e||Array.isArray(e)&&e.length===0?d||"":t(e);return s.jsxRuntimeExports.jsx(D,{color:"secondary",endIcon:s.jsxRuntimeExports.jsx(s.ChevronDownRegularIcon,{className:"ds-size-4"}),buttonClassName:"ds-justify-between",children:r})},J=({options:e,onOptionClick:t,isMultiSelect:d,selectedOption:r})=>e&&e.map(n=>s.jsxRuntimeExports.jsx(ts,{onClick:()=>t(n),option:n,isSelected:Array.isArray(r)?r.some(c=>c.value===n.value):(r==null?void 0:r.value)===n.value,showCheckbox:d},n.value)),ts=({onClick:e,option:t,isSelected:d,showCheckbox:r})=>s.jsxRuntimeExports.jsxs("div",{onClick:t.disabled?void 0:e,className:s.cn("ds-flex ds-min-h-[72px] ds-transform ds-cursor-pointer ds-items-center ds-gap-4 ds-rounded ds-px-4 ds-py-2 ds-text-smallFootnoteEmphasized hover:ds-bg-[#F6F8FC] ds-tablet:ds-min-h-[auto] ds-tablet:ds-gap-2 ds-tablet:ds-px-2 ds-desktop:ds-text-mediumFootnoteEmphasized",!r&&"ds-transform ds-transition-all ds-duration-300 hover:ds-px-4"),children:[t.thumbnailUrl&&s.jsxRuntimeExports.jsx("img",{src:t.thumbnailUrl,className:"ds-h-14 ds-w-14 ds-shrink-0 ds-rounded ds-object-cover ds-tablet:ds-h-6 ds-tablet:ds-w-9 ds-tablet:ds-rounded-sm"}),t.icon,s.jsxRuntimeExports.jsx("div",{className:"ds-flex-grow",children:t.label}),d&&!r&&s.jsxRuntimeExports.jsx(s.CheckmarkIcon,{className:"ds-size-4 ds-shrink-0"}),r&&s.jsxRuntimeExports.jsx(s.Checkbox,{isChecked:d,disabled:t.disabled})]}),S=(e,t)=>Array.isArray(e)?t.filter(d=>e.includes(d.value)):t.find(d=>d.value===e),K=e=>Array.isArray(e)?e.map(t=>t.label).join(", "):e.label;exports.Button=D;exports.ButtonsGroupSelector=$;exports.DesktopDropdown=M;exports.Dropdown=G;exports.MobileDropdown=V;exports.findOptionByValue=S;
1
+ "use strict";var X=Object.defineProperty,Y=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var P=(e,t,d)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:d}):e[t]=d,y=(e,t)=>{for(var d in t||(t={}))V.call(t,d)&&P(e,d,t[d]);if(S)for(var d of S(t))W.call(t,d)&&P(e,d,t[d]);return e},w=(e,t)=>Y(e,Z(t));var z=(e,t)=>{var d={};for(var r in e)V.call(e,r)&&t.indexOf(r)<0&&(d[r]=e[r]);if(e!=null&&S)for(var r of S(e))t.indexOf(r)<0&&W.call(e,r)&&(d[r]=e[r]);return d};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../Checkbox-D0PLHW4-.cjs"),j=require("react"),T=({children:e,size:t="small"})=>s.jsxRuntimeExports.jsx("div",{className:`ds-flex ds-items-center ds-justify-center ${t==="small"?"ds-h-5 ds-w-5":"ds-h-6 ds-w-6"}`,children:e}),ss={primary:"ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-rounded-sm hover:ds-text-Text-textPrimaryDark hover:ds-bg-Background-accentEggplant-highlight hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-Background-accentEggplant-darkened focus:ds-bg-Background-accentEggplant-100 focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:focus:ds-shadow-none disabled:ds-bg-Background-accentEggplant-20 ds-text-mediumFootnoteEmphasized",secondary:"ds-text-black ds-rounded-sm ds-border ds-border-Fills-terciary hover:ds-bg-[#F6F8FC] hover:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] active:ds-bg-[#F6F8FC] active:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] focus:ds-bg-[#F6F8FC] focus:ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] disabled:ds-border disabled:ds-border-Fills-terciary disabled:ds-text-Text-tertiary disabled:ds-bg-transparent ds-text-mediumFootnoteEmphasized"},es={primary:"ds-rounded-sm ds-border ds-text-black ds-border-Fills-terciary ds-bg-[#F6F8FC] ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized",secondary:"ds-rounded-sm ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized"},N=j.forwardRef((g,E)=>{var u=g,{color:e="primary",disabled:t=!1,className:d,children:r,startIcon:i,selected:c,endIcon:a,trackingId:n,helperText:x,helpterTextClassName:f,buttonClassName:h}=u,b=z(u,["color","disabled","className","children","startIcon","selected","endIcon","trackingId","helperText","helpterTextClassName","buttonClassName"]);return s.jsxRuntimeExports.jsxs("div",{className:s.cn("ds-flex ds-flex-col ds-gap-1",d),children:[s.jsxRuntimeExports.jsxs("button",w(y({"data-tracking-id":n,ref:E,disabled:t,className:s.twMerge(s.clsx({[es[e]]:c,[ss[e]]:!c},"ds-px-2 ds-py-1","ds-flex ds-w-full ds-flex-1 ds-items-center ds-justify-center",h))},b),{children:[i&&s.jsxRuntimeExports.jsx(T,{children:i}),r&&s.jsxRuntimeExports.jsx("div",{className:`${i?"ds-ml-1":""} ${a?"ds-mr-1":""}`,children:r}),a&&s.jsxRuntimeExports.jsx(T,{children:a})]})),x&&s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-w-full ds-text-right ds-text-mediumFootnoteRegular",f),children:x})]})});N.displayName="Button";const U=j.forwardRef((e,t)=>{const v=e,{value:d,options:r,onSelectionChange:i=()=>{},isMultiSelect:c,noDataError:a,buttonMinWidth:n,buttonWidth:x,minSelectionError:f,buttonsContainerClassName:h,buttonClassName:b}=v,E=z(v,["value","options","onSelectionChange","isMultiSelect","noDataError","buttonMinWidth","buttonWidth","minSelectionError","buttonsContainerClassName","buttonClassName"]),[g,u]=j.useState([]),[p,R]=j.useState("");j.useEffect(()=>{d&&d.length?u(d):u([])},[d]);const k=(l,o)=>{o.currentTarget.blur();const m=[...g],F=m.findIndex(B=>B.value===l.value);F!==-1?m.length>1?(m.splice(F,1),R("")):R(f):(m.push(l),R("")),u(m),i(m)},_=(l,o)=>{o.currentTarget.blur();const m=[l];u(m),i(m)};return s.jsxRuntimeExports.jsxs("div",w(y({ref:t},E),{children:[s.jsxRuntimeExports.jsx("div",{className:s.cn("ds-flex ds-flex-wrap ds-gap-2",h),children:r.length>0?r.map(l=>s.jsxRuntimeExports.jsx(j.Fragment,{children:c?s.jsxRuntimeExports.jsx(N,{selected:g.some(o=>o.value===l.value),onClick:o=>k(l,o),color:"secondary",style:{minWidth:n,width:x},className:b,startIcon:l.startIcon,endIcon:l.endIcon,children:l.label}):s.jsxRuntimeExports.jsx(N,{selected:g.some(o=>o.value===l.value),onClick:o=>_(l,o),color:"secondary",style:{minWidth:n,width:x},className:b,startIcon:l.startIcon,endIcon:l.endIcon,children:l.label})},l.value)):s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:a})}),p&&s.jsxRuntimeExports.jsx("div",{className:"ds_xSmallSubheadRegular ds-p-2 ds-text-System-red",children:p})]}))});U.displayName="ButtonsGroupSelector";const $=e=>window.innerWidth<s.tabletMinWidth?s.jsxRuntimeExports.jsx(M,y({},e)):s.jsxRuntimeExports.jsx(I,y({},e));$.displayName="Dropdown";const I=({placement:e="bottom-start",trigger:t,triggerContainerClassName:d,disabled:r,onOpenChange:i,adjustHeight:c=!0,adjustWidth:a=!0,options:n,getSelectedValueDisplayText:x=J,placeholder:f,value:h,isMultiSelect:b,onChange:E})=>{const[g,u]=j.useState(),p=typeof h=="undefined"?g:h,R=typeof h=="undefined"?u:()=>{},[k,_]=j.useState(!1),{refs:v,floatingStyles:l,context:o}=s.useFloating({open:k,onOpenChange:D=>{_(D),i&&i(D)},middleware:[s.offset(8),s.flip({crossAxis:e.includes("-"),fallbackAxisSideDirection:"end"}),s.shift({padding:4}),s.size({apply({availableWidth:D,availableHeight:Q,elements:A}){c&&(A.floating.style.maxHeight=`${Q-4}px`),a&&(A.floating.style.maxWidth=`${D-4}px`)}})],whileElementsMounted:s.autoUpdate,placement:e}),m=s.useClick(o),F=s.useFocus(o),B=s.useDismiss(o),K=s.useRole(o),{getReferenceProps:L,getFloatingProps:O}=s.useInteractions([m,F,B,K]);return t||(t=s.jsxRuntimeExports.jsx(q,{selectedOption:C(p,n),getSelectedValueDisplayText:x,placeholder:f})),r?s.jsxRuntimeExports.jsx("div",{className:d,children:t}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",w(y({className:s.cn("ds-cursor-pointer",d),ref:v.setReference},L()),{children:t})),k&&s.jsxRuntimeExports.jsx(s.FloatingPortal,{children:s.jsxRuntimeExports.jsx("div",w(y({ref:v.setFloating,style:l},O()),{className:s.cn("ds-z-[29999] ds-flex ds-min-w-[200px] ds-flex-col ds-gap-1 ds-rounded ds-bg-white ds-p-2 ds-shadow-md",c&&"ds-overflow-y-auto",a&&"ds-overflow-x-auto"),children:s.jsxRuntimeExports.jsx(H,{isMultiSelect:b,options:n,value:p,setValue:R,setIsOpen:_,onChange:E})}))})]})};I.displayName="DesktopDropdown";const M=({trigger:e,triggerContainerClassName:t,disabled:d,onOpenChange:r,getSelectedValueDisplayText:i=J,placeholder:c,value:a,options:n,isMultiSelect:x,onChange:f})=>{const[h,b]=j.useState(),E=typeof a=="undefined"?h:a,g=typeof a=="undefined"?b:()=>{},[u,p]=j.useState(!1);return e||(e=s.jsxRuntimeExports.jsx(q,{selectedOption:C(E,n),getSelectedValueDisplayText:i,placeholder:c})),d?s.jsxRuntimeExports.jsx("div",{className:t,children:e}):s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:t,onClick:()=>{p(!0),r&&r(!0)},children:e}),s.jsxRuntimeExports.jsx(s.AnimatedModal,{animation:"slideUp",show:u,handleClose:()=>{p(!1),r&&r(!1)},contentClassName:s.cn("ds-absolute ds-mb-0 ds-w-full"),className:"ds-z-[29999]",children:s.jsxRuntimeExports.jsx(G,{onClose:()=>{p(!1),r&&r(!1)},children:s.jsxRuntimeExports.jsx(H,{isMultiSelect:x,options:n,value:E,setValue:g,setIsOpen:p,onChange:f})})})]})};M.displayName="MobileDropdown";const G=({onClose:e,children:t})=>s.jsxRuntimeExports.jsxs("div",{className:"ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white",children:[s.jsxRuntimeExports.jsxs("div",{className:"ds-flex ds-shrink-0 ds-items-center ds-justify-between ds-px-8 ds-py-4",children:[s.jsxRuntimeExports.jsx("div",{onClick:e,className:"ds-flex ds-size-5 ds-cursor-pointer ds-items-center ds-justify-center",children:s.jsxRuntimeExports.jsx(s.CloseIcon,{className:"ds-size-4"})}),s.jsxRuntimeExports.jsx("div",{className:"ds-size-5"})]}),s.jsxRuntimeExports.jsx("div",{className:"ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular",children:t}),s.jsxRuntimeExports.jsx("div",{className:"ds-px-8 ds-py-4",children:s.jsxRuntimeExports.jsx(s.Button,{buttonClassName:"ds-py-3",onClick:e,children:"Close"})})]});G.displayName="MobilePopoverContentWrapper";const q=({selectedOption:e,getSelectedValueDisplayText:t,placeholder:d})=>{const r=!e||Array.isArray(e)&&e.length===0?d||"":t(e);return s.jsxRuntimeExports.jsx(N,{color:"secondary",endIcon:s.jsxRuntimeExports.jsx(s.ChevronDownRegularIcon,{className:"ds-size-4"}),buttonClassName:"ds-justify-between",children:r})},H=({options:e,isMultiSelect:t,value:d,setValue:r,setIsOpen:i,onChange:c})=>e&&e.map(a=>s.jsxRuntimeExports.jsx(ts,{onClick:()=>{let n;if(t){const x=d||[];x.includes(a.value)?n=x.filter(f=>f!==a.value):n=[...x,a.value]}else n=a.value,i(!1);r(n),c&&c(C(n,e))},option:a,isSelected:Array.isArray(d)?d.some(n=>n===a.value):d===a.value,showCheckbox:t},a.value)),ts=({onClick:e,option:t,isSelected:d,showCheckbox:r})=>s.jsxRuntimeExports.jsxs("div",{onClick:t.disabled?void 0:e,className:s.cn("ds-flex ds-min-h-[72px] ds-transform ds-cursor-pointer ds-items-center ds-gap-4 ds-rounded ds-px-4 ds-py-2 ds-text-smallFootnoteEmphasized hover:ds-bg-[#F6F8FC] ds-tablet:ds-min-h-[auto] ds-tablet:ds-gap-2 ds-tablet:ds-px-2 ds-desktop:ds-text-mediumFootnoteEmphasized",!r&&"ds-transform ds-transition-all ds-duration-300 hover:ds-px-4"),children:[t.thumbnailUrl&&s.jsxRuntimeExports.jsx("img",{src:t.thumbnailUrl,className:"ds-h-14 ds-w-14 ds-shrink-0 ds-rounded ds-object-cover ds-tablet:ds-h-6 ds-tablet:ds-w-9 ds-tablet:ds-rounded-sm"}),t.icon,s.jsxRuntimeExports.jsx("div",{className:"ds-flex-grow",children:t.label}),d&&!r&&s.jsxRuntimeExports.jsx(s.CheckmarkIcon,{className:"ds-size-4 ds-shrink-0"}),r&&s.jsxRuntimeExports.jsx(s.Checkbox,{isChecked:d,disabled:t.disabled})]}),C=(e,t)=>Array.isArray(e)?t.filter(d=>e.includes(d.value)):t.find(d=>d.value===e),J=e=>Array.isArray(e)?e.map(t=>t.label).join(", "):e.label;exports.Button=N;exports.ButtonsGroupSelector=U;exports.DesktopDropdown=I;exports.Dropdown=$;exports.MobileDropdown=M;exports.findOptionByValue=C;
package/dist/index.d.ts CHANGED
@@ -2,9 +2,11 @@ import { CalendarDayShape } from 'react-dates';
2
2
  import { ClassProp } from 'class-variance-authority/types';
3
3
  import { ClassValue } from 'clsx';
4
4
  import { default as default_2 } from 'react';
5
+ import { ElementType } from 'react';
5
6
  import { FC } from 'react';
6
7
  import { ForwardRefExoticComponent } from 'react';
7
8
  import { HTMLAttributes } from 'react';
9
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
8
10
  import { LazyLoadTypes } from 'react-slick';
9
11
  import { ModifiersShape } from 'react-dates';
10
12
  import { Moment } from 'moment';
@@ -321,6 +323,20 @@ export declare const CloseIcon: FC<{
321
323
 
322
324
  export declare function cn(...inputs: ClassValue[]): string;
323
325
 
326
+ /**
327
+ * A wrapper component that follows design system's margins on pages for different screen sizes
328
+ */
329
+ export declare const Container: <T extends ElementType = "div">({ as, children, className, dataTestId, ...rest }: ContainerProps<T>) => JSX_2.Element;
330
+
331
+ export declare type ContainerProps<T extends ElementType = 'div'> = React.PropsWithChildren<{
332
+ /**
333
+ * Element type to render as
334
+ * @default 'div'
335
+ */
336
+ as?: T;
337
+ dataTestId?: string;
338
+ }> & React.ComponentPropsWithoutRef<T>;
339
+
324
340
  export declare const ContractIcon: FC<{
325
341
  className?: string;
326
342
  }>;