@bikdotai/bik-component-library 0.0.731-beta.3 → 0.0.731-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),r=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,x=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:S,isMultiSelect:b,maxSelections:g,width:m,allowFreeForm:v,height:w,onClose:O,onSelect:y,onSearch:E,version:D,skipSorting:C,headerRef:R,hideSelectAll:q,primaryButtonText:M,onInfiniteScroll:k,onMultiSelectClear:L,onDropdownItemClick:A,buttonOptions:I,isSearchLoading:F,disableSearchOptions:T,disableSearchedOptionExcept:B,useDefaultCursor:P,containerStyle:H={},zeroState:Z}=f;const{dropdownOptions:_,search:z,searchedString:V,searchedOptions:W,onApplyHandler:$,selectAllHandler:K,onMultiSelectClear:N,onFreeFormSelect:U,onMultiSelectApply:G,latestDropdownOptionsRef:J,getSelectedOptions:Q,getCurrentSelectionCount:X}=o.useDropdown(D,j,y,C,b,E,T,B,g),[Y,ee]=t.useState(null!=m?m:x),[te,ne]=t.useState(null),[se,oe]=t.useState(-1),re=t.useRef(null),ie=t.useRef([]),le=t.useRef(null);s.useOutside(re,(()=>{if(ne(null),b&&"2.0"===D){const e=Q(J.current);null==O||O(e)}else null==O||O(_)}),[R,ie]);t.useEffect((()=>{const e=e=>{var t;const n=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const n=e;n.disabled||t.push(n)}})),t})(V&&E?W:_);if(0===n.length)return;if(null===(t=re.current)||void 0===t?void 0:t.contains(e.target))if("ArrowDown"===e.key)e.preventDefault(),e.stopPropagation(),oe((e=>{const t=e<n.length-1?e+1:0;return setTimeout((()=>{var e;const n=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);n&&n.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("ArrowUp"===e.key)e.preventDefault(),e.stopPropagation(),oe((e=>{const t=e>0?e-1:n.length-1;return setTimeout((()=>{var e;const n=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);n&&n.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("Enter"===e.key&&se>=0){e.preventDefault(),e.stopPropagation();const t=n[se];t&&$(Object.assign(Object.assign({},t),{selected:!t.selected}))}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[se,V,W,_,E,$]);const ue=null!=w?w:h,ae="number"==typeof ue?S&&b?ue-96:S&&!b||!S&&b?ue-48:ue:ue;t.useEffect((()=>{const e=null!=m?m:x;if(null===te)ee(e);else if("number"==typeof e)ee(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ee(t)}}),[te]);const ce=[],de=(e=>{if(!b||!g&&0!==g)return e;const t=X(e)>=g;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((V&&E?W:_).map((e=>{var t,n;if(V&&!E){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))&&(ce.push(!V||e.label===V),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(V.toLowerCase()))?(ce.push(!V||e.label===V),e):null}return e})).filter((e=>null!==e))),pe=!!S&&V&&0===de.length;return t.useEffect((()=>{re.current&&re.current.focus()}),[]),e.jsxRuntimeExports.jsxs(c.OpennedDropdownContainer,Object.assign({version:D,ref:re,tabIndex:-1,style:Object.assign({width:Y,outline:"none"},H)},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{width:te?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!S&&e.jsxRuntimeExports.jsx(d.SearchBox,{onSearch:z,version:D}),de.length||V?e.jsxRuntimeExports.jsxs(c.MenuListContainer,Object.assign({minHeight:ue,maxHeight:ae,ref:le},{children:[!!b&&!pe&&!q&&e.jsxRuntimeExports.jsx(u.SelectAllMenu,{version:D,options:V&&E?W:_,onSelect:K}),!v&&pe&&e.jsxRuntimeExports.jsx(p.SearchZeroState,{isLoading:F,height:ae,searchedString:V,containerWidth:m}),v&&(pe||!!ce.length&&ce.every((e=>!1===e)))&&e.jsxRuntimeExports.jsx(i.FreeFormMenu,{version:D,isMultiSelect:b,onSelect:U,searchedString:V}),e.jsxRuntimeExports.jsx(l.MenuList,{onInfiniteScroll:k,onDropdownItemClick:A,version:D,onSelect:$,showDescription:function(e,t){ne(e&&t?{title:e,description:t}:null)},isMultiSelect:b,options:de,useDefaultCursor:P,ref:ie,focusedIndex:se})]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:ue,display:"flex"}},{children:e.jsxRuntimeExports.jsx(n.ZeroState,Object.assign({},Z,{title:(null==Z?void 0:Z.title)||"No results found",subTitle:(null==Z?void 0:Z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!b&&!(!de.length&&!V)&&"2.0"!==D&&e.jsxRuntimeExports.jsx(a.default,{onClear:()=>{N(),null==L||L()},onApply:G,list:V&&E?W:_,buttonText:M,buttonOptions:I})]})),!!te&&e.jsxRuntimeExports.jsx(r.Description,{title:te.title,description:te.description,version:D})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),r=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,x=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:S,isMultiSelect:b,maxSelections:g,width:m,allowFreeForm:v,height:w,onClose:O,onSelect:y,onSearch:E,version:C,skipSorting:D,headerRef:R,hideSelectAll:q,primaryButtonText:k,onInfiniteScroll:M,onMultiSelectClear:L,onDropdownItemClick:A,buttonOptions:I,isSearchLoading:F,disableSearchOptions:T,disableSearchedOptionExcept:B,useDefaultCursor:P,containerStyle:H={},zeroState:Z}=f;const{dropdownOptions:_,search:z,searchedString:V,searchedOptions:W,onApplyHandler:$,selectAllHandler:K,onMultiSelectClear:N,onFreeFormSelect:U,onMultiSelectApply:G,latestDropdownOptionsRef:J,getSelectedOptions:Q,getCurrentSelectionCount:X}=o.useDropdown(C,j,y,D,b,E,T,B,g),[Y,ee]=t.useState(null!=m?m:x),[te,ne]=t.useState(null),[se,oe]=t.useState(-1),re=t.useRef(null),ie=t.useRef([]),le=t.useRef(null);s.useOutside(re,(()=>{if(ne(null),b&&"2.0"===C){const e=Q(J.current);null==O||O(e)}else null==O||O(_)}),[R,ie]);const ue=t.useCallback((e=>{const t=[];return e.forEach((e=>{if(e.options){e.options.forEach((e=>{e.disabled||t.push(e)}))}else{const n=e;n.disabled||t.push(n)}})),t}),[]);t.useEffect((()=>{const e=e=>{var t;const n=ue(V&&E?W:_);if(0===n.length)return;if(null===(t=re.current)||void 0===t?void 0:t.contains(e.target))if("ArrowDown"===e.key)e.preventDefault(),e.stopPropagation(),oe((e=>{const t=e<n.length-1?e+1:0;return setTimeout((()=>{var e;const n=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);n&&n.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("ArrowUp"===e.key)e.preventDefault(),e.stopPropagation(),oe((e=>{const t=e>0?e-1:n.length-1;return setTimeout((()=>{var e;const n=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);n&&n.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("Enter"===e.key&&se>=0){e.preventDefault(),e.stopPropagation();const t=n[se];t&&$(Object.assign(Object.assign({},t),{selected:!t.selected}))}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[se,V,E,ue]);const ae=null!=w?w:h,ce="number"==typeof ae?S&&b?ae-96:S&&!b||!S&&b?ae-48:ae:ae;t.useEffect((()=>{const e=null!=m?m:x;if(null===te)ee(e);else if("number"==typeof e)ee(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ee(t)}}),[te]);const de=[],pe=(e=>{if(!b||!g&&0!==g)return e;const t=X(e)>=g;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((V&&E?W:_).map((e=>{var t,n;if(V&&!E){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))&&(de.push(!V||e.label===V),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(V.toLowerCase()))?(de.push(!V||e.label===V),e):null}return e})).filter((e=>null!==e))),he=!!S&&V&&0===pe.length;return t.useEffect((()=>{re.current&&re.current.focus()}),[]),e.jsxRuntimeExports.jsxs(c.OpennedDropdownContainer,Object.assign({version:C,ref:re,tabIndex:-1,style:Object.assign({width:Y,outline:"none"},H)},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{width:te?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!S&&e.jsxRuntimeExports.jsx(d.SearchBox,{onSearch:z,version:C}),pe.length||V?e.jsxRuntimeExports.jsxs(c.MenuListContainer,Object.assign({minHeight:ae,maxHeight:ce,ref:le},{children:[!!b&&!he&&!q&&e.jsxRuntimeExports.jsx(u.SelectAllMenu,{version:C,options:V&&E?W:_,onSelect:K}),!v&&he&&e.jsxRuntimeExports.jsx(p.SearchZeroState,{isLoading:F,height:ce,searchedString:V,containerWidth:m}),v&&(he||!!de.length&&de.every((e=>!1===e)))&&e.jsxRuntimeExports.jsx(i.FreeFormMenu,{version:C,isMultiSelect:b,onSelect:U,searchedString:V}),e.jsxRuntimeExports.jsx(l.MenuList,{onInfiniteScroll:M,onDropdownItemClick:A,version:C,onSelect:$,showDescription:function(e,t){ne(e&&t?{title:e,description:t}:null)},isMultiSelect:b,options:pe,useDefaultCursor:P,ref:ie,focusedIndex:se})]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:ae,display:"flex"}},{children:e.jsxRuntimeExports.jsx(n.ZeroState,Object.assign({},Z,{title:(null==Z?void 0:Z.title)||"No results found",subTitle:(null==Z?void 0:Z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!b&&!(!pe.length&&!V)&&"2.0"!==C&&e.jsxRuntimeExports.jsx(a.default,{onClear:()=>{N(),null==L||L()},onApply:G,list:V&&E?W:_,buttonText:k,buttonOptions:I})]})),!!te&&e.jsxRuntimeExports.jsx(r.Description,{title:te.title,description:te.description,version:C})]}))};
@@ -1 +1 @@
1
- import{j as e}from"../../../../node_modules/react/jsx-runtime.js";import{useState as t,useRef as o,useEffect as n}from"react";import{ZeroState as s}from"../../../zeroState/ZeroState.js";import{useOutside as r}from"../../../../hooks/useOutside.js";import{useDropdown as i}from"../../hooks/useDropdown.js";import{Description as l}from"./description/Description.js";import{FreeFormMenu as c}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as p,MenuListContainer as h}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as m}from"./searchbox/SearchZeroState.js";const b=304,g=290,j=j=>{let{options:S,isSearchable:v,isMultiSelect:x,maxSelections:w,width:y,allowFreeForm:O,height:C,onClose:D,onSelect:k,onSearch:L,version:M,skipSorting:I,headerRef:A,hideSelectAll:E,primaryButtonText:F,onInfiniteScroll:T,onMultiSelectClear:B,onDropdownItemClick:H,buttonOptions:P,isSearchLoading:q,disableSearchOptions:z,disableSearchedOptionExcept:R,useDefaultCursor:V,containerStyle:W={},zeroState:Z}=j;const{dropdownOptions:$,search:K,searchedString:N,searchedOptions:U,onApplyHandler:_,selectAllHandler:G,onMultiSelectClear:J,onFreeFormSelect:Q,onMultiSelectApply:X,latestDropdownOptionsRef:Y,getSelectedOptions:ee,getCurrentSelectionCount:te}=i(M,S,k,I,x,L,z,R,w),[oe,ne]=t(null!=y?y:g),[se,re]=t(null),[ie,le]=t(-1),ce=o(null),ae=o([]),ue=o(null);r(ce,(()=>{if(re(null),x&&"2.0"===M){const e=ee(Y.current);null==D||D(e)}else null==D||D($)}),[A,ae]);n((()=>{const e=e=>{var t;const o=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const o=e;o.disabled||t.push(o)}})),t})(N&&L?U:$);if(0===o.length)return;if(null===(t=ce.current)||void 0===t?void 0:t.contains(e.target))if("ArrowDown"===e.key)e.preventDefault(),e.stopPropagation(),le((e=>{const t=e<o.length-1?e+1:0;return setTimeout((()=>{var e;const o=null===(e=ue.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);o&&o.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("ArrowUp"===e.key)e.preventDefault(),e.stopPropagation(),le((e=>{const t=e>0?e-1:o.length-1;return setTimeout((()=>{var e;const o=null===(e=ue.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);o&&o.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("Enter"===e.key&&ie>=0){e.preventDefault(),e.stopPropagation();const t=o[ie];t&&_(Object.assign(Object.assign({},t),{selected:!t.selected}))}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[ie,N,U,$,L,_]);const de=null!=C?C:b,pe="number"==typeof de?v&&x?de-96:v&&!x||!v&&x?de-48:de:de;n((()=>{const e=null!=y?y:g;if(null===se)ne(e);else if("number"==typeof e)ne(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ne(t)}}),[se]);const he=[],fe=(e=>{if(!x||!w&&0!==w)return e;const t=te(e)>=w;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((N&&L?U:$).map((e=>{var t,o;if(N&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(N.toLowerCase()))&&(he.push(!N||e.label===N),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(N.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(N.toLowerCase()))?(he.push(!N||e.label===N),e):null}return e})).filter((e=>null!==e))),me=!!v&&N&&0===fe.length;return n((()=>{ce.current&&ce.current.focus()}),[]),e.jsxs(p,Object.assign({version:M,ref:ce,tabIndex:-1,style:Object.assign({width:oe,outline:"none"},W)},{children:[e.jsxs("div",Object.assign({style:{width:se?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!v&&e.jsx(f,{onSearch:K,version:M}),fe.length||N?e.jsxs(h,Object.assign({minHeight:de,maxHeight:pe,ref:ue},{children:[!!x&&!me&&!E&&e.jsx(u,{version:M,options:N&&L?U:$,onSelect:G}),!O&&me&&e.jsx(m,{isLoading:q,height:pe,searchedString:N,containerWidth:y}),O&&(me||!!he.length&&he.every((e=>!1===e)))&&e.jsx(c,{version:M,isMultiSelect:x,onSelect:Q,searchedString:N}),e.jsx(a,{onInfiniteScroll:T,onDropdownItemClick:H,version:M,onSelect:_,showDescription:function(e,t){re(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:fe,useDefaultCursor:V,ref:ae,focusedIndex:ie})]})):e.jsx("div",Object.assign({style:{height:de,display:"flex"}},{children:e.jsx(s,Object.assign({},Z,{title:(null==Z?void 0:Z.title)||"No results found",subTitle:(null==Z?void 0:Z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!x&&!(!fe.length&&!N)&&"2.0"!==M&&e.jsx(d,{onClear:()=>{J(),null==B||B()},onApply:X,list:N&&L?U:$,buttonText:F,buttonOptions:P})]})),!!se&&e.jsx(l,{title:se.title,description:se.description,version:M})]}))};export{j as OpenedDropdown};
1
+ import{j as e}from"../../../../node_modules/react/jsx-runtime.js";import{useState as t,useRef as o,useCallback as n,useEffect as s}from"react";import{ZeroState as r}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{useDropdown as l}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as u}from"./menu/MenuList.js";import{SelectAllMenu as d}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as f}from"./OpennedDropdown.styled.js";import{SearchBox as m}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const g=304,j=290,S=S=>{let{options:v,isSearchable:x,isMultiSelect:w,maxSelections:y,width:O,allowFreeForm:C,height:D,onClose:k,onSelect:L,onSearch:M,version:I,skipSorting:A,headerRef:E,hideSelectAll:F,primaryButtonText:T,onInfiniteScroll:B,onMultiSelectClear:H,onDropdownItemClick:P,buttonOptions:q,isSearchLoading:z,disableSearchOptions:R,disableSearchedOptionExcept:V,useDefaultCursor:W,containerStyle:Z={},zeroState:$}=S;const{dropdownOptions:K,search:N,searchedString:U,searchedOptions:_,onApplyHandler:G,selectAllHandler:J,onMultiSelectClear:Q,onFreeFormSelect:X,onMultiSelectApply:Y,latestDropdownOptionsRef:ee,getSelectedOptions:te,getCurrentSelectionCount:oe}=l(I,v,L,A,w,M,R,V,y),[ne,se]=t(null!=O?O:j),[re,ie]=t(null),[le,ce]=t(-1),ae=o(null),ue=o([]),de=o(null);i(ae,(()=>{if(ie(null),w&&"2.0"===I){const e=te(ee.current);null==k||k(e)}else null==k||k(K)}),[E,ue]);const pe=n((e=>{const t=[];return e.forEach((e=>{if(e.options){e.options.forEach((e=>{e.disabled||t.push(e)}))}else{const o=e;o.disabled||t.push(o)}})),t}),[]);s((()=>{const e=e=>{var t;const o=pe(U&&M?_:K);if(0===o.length)return;if(null===(t=ae.current)||void 0===t?void 0:t.contains(e.target))if("ArrowDown"===e.key)e.preventDefault(),e.stopPropagation(),ce((e=>{const t=e<o.length-1?e+1:0;return setTimeout((()=>{var e;const o=null===(e=de.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);o&&o.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("ArrowUp"===e.key)e.preventDefault(),e.stopPropagation(),ce((e=>{const t=e>0?e-1:o.length-1;return setTimeout((()=>{var e;const o=null===(e=de.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${t}"]`);o&&o.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),t}));else if("Enter"===e.key&&le>=0){e.preventDefault(),e.stopPropagation();const t=o[le];t&&G(Object.assign(Object.assign({},t),{selected:!t.selected}))}};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[le,U,M,pe]);const he=null!=D?D:g,fe="number"==typeof he?x&&w?he-96:x&&!w||!x&&w?he-48:he:he;s((()=>{const e=null!=O?O:j;if(null===re)se(e);else if("number"==typeof e)se(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));se(t)}}),[re]);const me=[],be=(e=>{if(!w||!y&&0!==y)return e;const t=oe(e)>=y;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((U&&M?_:K).map((e=>{var t,o;if(U&&!M){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(U.toLowerCase()))&&(me.push(!U||e.label===U),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(U.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(U.toLowerCase()))?(me.push(!U||e.label===U),e):null}return e})).filter((e=>null!==e))),ge=!!x&&U&&0===be.length;return s((()=>{ae.current&&ae.current.focus()}),[]),e.jsxs(h,Object.assign({version:I,ref:ae,tabIndex:-1,style:Object.assign({width:ne,outline:"none"},Z)},{children:[e.jsxs("div",Object.assign({style:{width:re?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(m,{onSearch:N,version:I}),be.length||U?e.jsxs(f,Object.assign({minHeight:he,maxHeight:fe,ref:de},{children:[!!w&&!ge&&!F&&e.jsx(d,{version:I,options:U&&M?_:K,onSelect:J}),!C&&ge&&e.jsx(b,{isLoading:z,height:fe,searchedString:U,containerWidth:O}),C&&(ge||!!me.length&&me.every((e=>!1===e)))&&e.jsx(a,{version:I,isMultiSelect:w,onSelect:X,searchedString:U}),e.jsx(u,{onInfiniteScroll:B,onDropdownItemClick:P,version:I,onSelect:G,showDescription:function(e,t){ie(e&&t?{title:e,description:t}:null)},isMultiSelect:w,options:be,useDefaultCursor:W,ref:ue,focusedIndex:le})]})):e.jsx("div",Object.assign({style:{height:he,display:"flex"}},{children:e.jsx(r,Object.assign({},$,{title:(null==$?void 0:$.title)||"No results found",subTitle:(null==$?void 0:$.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!w&&!(!be.length&&!U)&&"2.0"!==I&&e.jsx(p,{onClear:()=>{Q(),null==H||H()},onApply:Y,list:U&&M?_:K,buttonText:T,buttonOptions:q})]})),!!re&&e.jsx(c,{title:re.title,description:re.description,version:I})]}))};export{S as OpenedDropdown};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.731-beta.3",
3
+ "version": "0.0.731-beta.4",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",