@bikdotai/bik-component-library 0.0.512-beta.2 → 0.0.512-beta.3

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("../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),o=require("react-popper"),t=require("../../dropShadow/DropShadow.js"),l=require("../Common.styled.js"),s=require("../OpenedDropdown/components/OpennedDropdown.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=i(n).default.forwardRef(((i,a)=>{var{children:d,onDropdownVisbilityChange:p,version:u="1.0"}=i,c=e.__rest(i,["children","onDropdownVisbilityChange","version"]);const v=a,[j,b]=n.useState(!1),[f,w]=n.useState(null),[D,O]=n.useState(null),{styles:y,attributes:g}=o.usePopper(f,D,{placement:c.placement,strategy:c.strategy});return n.useImperativeHandle(v,(()=>({openDropdown:j})),[]),n.useEffect((()=>{(null==v?void 0:v.current)&&(v.current.openDropdown=j)}),[j]),n.useEffect((()=>{null==p||p(j)}),[j]),r.jsxs(r.Fragment,{children:[r.jsxs("div",Object.assign({style:{position:"relative"},ref:w},{children:[r.jsx(l.OverLapAbs,{disabled:c.disabled,onClick:e=>{var r;null===(r=c.onDropdownOpen)||void 0===r||r.call(c),j?e.preventDefault():c.disabled||b(!0)}}),d]})),j&&r.jsx(l.OpenDropdownContainer,Object.assign({ref:O,style:Object.assign(Object.assign({},y.popper),{zIndex:3})},g.popper,{children:r.jsx(t.default,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:r.jsx(s.OpenedDropdown,Object.assign({},c,{onSelect:e=>{var r;"2.0"===u&&c.isMultiSelect||(null===(r=c.onSelect)||void 0===r||r.call(c,e),b(!1))},onClose:e=>{var r,n;"2.0"===u&&c.isMultiSelect&&e&&(null===(r=c.onSelect)||void 0===r||r.call(c,[...e])),b(!1),null===(n=null==c?void 0:c.onClose)||void 0===n||n.call(c)},version:u}))}))}))]})}));a.displayName="DropdownPopover",exports.DropdownPopover=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),o=require("react-popper"),t=require("../../dropShadow/DropShadow.js"),l=require("../Common.styled.js"),s=require("../OpenedDropdown/components/OpennedDropdown.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=i(n).default.forwardRef(((i,a)=>{var{children:d,onDropdownVisbilityChange:p,version:u="1.0"}=i,c=e.__rest(i,["children","onDropdownVisbilityChange","version"]);const v=a,[f,j]=n.useState(!1),[b,w]=n.useState(null),[D,O]=n.useState(null),y=n.useRef(null),{styles:g,attributes:h}=o.usePopper(b,D,{placement:c.placement,strategy:c.strategy});return n.useImperativeHandle(v,(()=>({openDropdown:f})),[]),n.useEffect((()=>{(null==v?void 0:v.current)&&(v.current.openDropdown=f)}),[f]),n.useEffect((()=>{null==p||p(f)}),[f]),r.jsxs(r.Fragment,{children:[r.jsxs("div",Object.assign({style:{position:"relative"},ref:w},{children:[r.jsx(l.OverLapAbs,{ref:y,disabled:c.disabled,onClick:e=>{var r;null===(r=c.onDropdownOpen)||void 0===r||r.call(c),f?(j(!1),e.preventDefault()):c.disabled||j(!0)}}),d]})),f&&r.jsx(l.OpenDropdownContainer,Object.assign({ref:O,style:Object.assign(Object.assign({},g.popper),{zIndex:3})},h.popper,{children:r.jsx(t.default,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:r.jsx(s.OpenedDropdown,Object.assign({},c,{onSelect:e=>{var r;"2.0"===u&&c.isMultiSelect||(null===(r=c.onSelect)||void 0===r||r.call(c,e),j(!1))},onClose:e=>{var r,n;"2.0"===u&&c.isMultiSelect&&e&&(null===(r=c.onSelect)||void 0===r||r.call(c,[...e])),j(!1),null===(n=null==c?void 0:c.onClose)||void 0===n||n.call(c)},version:u,headerRef:y}))}))}))]})}));a.displayName="DropdownPopover",exports.DropdownPopover=a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),n=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),p=require("./searchbox/SearchBox.js"),d=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=j=>{let{options:f,isSearchable:x,isMultiSelect:g,width:v,allowFreeForm:w,height:b,onClose:y,onSelect:m,onSearch:O,version:q,skipSorting:M}=j;const{dropdownOptions:C,search:D,searchedString:L,searchedOptions:F,onApplyHandler:A,selectAllHandler:k,onMultiSelectClear:B,onFreeFormSelect:H,onMultiSelectApply:Z,latestDropdownOptionsRef:P,getSelectedOptions:R}=n.useDropdown(q,f,m,M,g,O),[_,z]=t.useState(null!=v?v:S),[E,I]=t.useState(null),K=t.useRef(null);s.useOutside(K,(()=>{if(I(null),g&&"2.0"===q){const e=R(P.current);null==y||y(e)}else null==y||y(C)}));const N=null!=b?b:h,T="number"==typeof N?x&&g?N-96:x&&!g||!x&&g?N-48:N:N;t.useEffect((()=>{const e=null!=v?v:S;if(null===E)z(e);else if("number"==typeof e)z(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));z(t)}}),[E]);const W=[],G=(L&&O?F:C).map((e=>{var t,r;if(L&&!O){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(L.toLowerCase()))&&(W.push(!L||e.label===L),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(L.toLowerCase()))||(null===(r=e.searchKey)||void 0===r?void 0:r.toLowerCase().includes(L.toLowerCase()))?(W.push(!L||e.label===L),e):null}return e})).filter((e=>null!==e)),J=!!x&&L&&0===G.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:q,ref:K,style:{width:_}},{children:[e.jsxs("div",Object.assign({style:{width:E?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(p.SearchBox,{onSearch:D,version:q}),G.length||L?e.jsxs(a.MenuListContainer,Object.assign({minHeight:N,maxHeight:T},{children:[!!g&&!J&&e.jsx(u.SelectAllMenu,{version:q,options:L&&O?F:C,onSelect:k}),!w&&J&&e.jsx(d.SearchZeroState,{height:T,searchedString:L}),w&&(J||!!W.length&&W.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:q,isMultiSelect:g,onSelect:H,searchedString:L}),e.jsx(l.MenuList,{version:q,onSelect:A,showDescription:function(e,t){I(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:G})]})):e.jsx("div",Object.assign({style:{height:N,display:"flex"}},{children:e.jsx(r.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!g&&!(!G.length&&!L)&&"2.0"!==q&&e.jsx(c.default,{onClear:B,onApply:Z,list:L&&O?F:C})]})),!!E&&e.jsx(o.Description,{title:E.title,description:E.description,version:q})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),n=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=j=>{let{options:f,isSearchable:x,isMultiSelect:g,width:v,allowFreeForm:w,height:b,onClose:y,onSelect:m,onSearch:O,version:q,skipSorting:M,headerRef:C}=j;const{dropdownOptions:D,search:L,searchedString:F,searchedOptions:A,onApplyHandler:k,selectAllHandler:B,onMultiSelectClear:H,onFreeFormSelect:Z,onMultiSelectApply:R,latestDropdownOptionsRef:P,getSelectedOptions:_}=n.useDropdown(q,f,m,M,g,O),[z,E]=t.useState(null!=v?v:S),[I,K]=t.useState(null),N=t.useRef(null);s.useOutside(N,(()=>{if(K(null),g&&"2.0"===q){const e=_(P.current);null==y||y(e)}else null==y||y(D)}),[C]);const T=null!=b?b:h,W="number"==typeof T?x&&g?T-96:x&&!g||!x&&g?T-48:T:T;t.useEffect((()=>{const e=null!=v?v:S;if(null===I)E(e);else if("number"==typeof e)E(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));E(t)}}),[I]);const G=[],J=(F&&O?A:D).map((e=>{var t,r;if(F&&!O){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(F.toLowerCase()))&&(G.push(!F||e.label===F),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(F.toLowerCase()))||(null===(r=e.searchKey)||void 0===r?void 0:r.toLowerCase().includes(F.toLowerCase()))?(G.push(!F||e.label===F),e):null}return e})).filter((e=>null!==e)),Q=!!x&&F&&0===J.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:q,ref:N,style:{width:z}},{children:[e.jsxs("div",Object.assign({style:{width:I?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:L,version:q}),J.length||F?e.jsxs(a.MenuListContainer,Object.assign({minHeight:T,maxHeight:W},{children:[!!g&&!Q&&e.jsx(u.SelectAllMenu,{version:q,options:F&&O?A:D,onSelect:B}),!w&&Q&&e.jsx(p.SearchZeroState,{height:W,searchedString:F}),w&&(Q||!!G.length&&G.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:q,isMultiSelect:g,onSelect:Z,searchedString:F}),e.jsx(l.MenuList,{version:q,onSelect:k,showDescription:function(e,t){K(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:J})]})):e.jsx("div",Object.assign({style:{height:T,display:"flex"}},{children:e.jsx(r.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!g&&!(!J.length&&!F)&&"2.0"!==q&&e.jsx(c.default,{onClear:H,onApply:R,list:F&&O?A:D})]})),!!I&&e.jsx(o.Description,{title:I.title,description:I.description,version:q})]}))};
@@ -16,6 +16,7 @@ export interface OpenDropdownProps {
16
16
  onSearch?: (key: string) => Promise<DropdownOption[]>;
17
17
  version?: '1.0' | '2.0';
18
18
  skipSorting?: boolean;
19
+ headerRef?: any;
19
20
  }
20
21
  export type GroupedOption = {
21
22
  label?: string;
@@ -1 +1 @@
1
- export declare function useOutside(ref: any, cb: () => void): void;
1
+ export declare function useOutside(ref: any, cb: () => void, excludeRefs?: any[]): void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.useOutside=function(t,r){e.useEffect((()=>{function e(e){t.current&&!t.current.contains(e.target)&&r()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[t])};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.useOutside=function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];e.useEffect((()=>{function e(e){let u=!0;null==n||n.forEach((t=>{t.current&&t.current.contains(e.target)&&(u=!1)})),u&&t.current&&!t.current.contains(e.target)&&r()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[t])};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as o,Fragment as n,jsx as r}from"react/jsx-runtime";import l,{useState as i,useImperativeHandle as t,useEffect as s}from"react";import{usePopper as p}from"react-popper";import d from"../../dropShadow/DropShadow.js";import{OverLapAbs as a,OpenDropdownContainer as c}from"../Common.styled.js";import{OpenedDropdown as m}from"../OpenedDropdown/components/OpennedDropdown.js";const u=l.forwardRef(((l,u)=>{var{children:v,onDropdownVisbilityChange:b,version:f="1.0"}=l,w=e(l,["children","onDropdownVisbilityChange","version"]);const j=u,[g,h]=i(!1),[y,D]=i(null),[O,S]=i(null),{styles:C,attributes:x}=p(y,O,{placement:w.placement,strategy:w.strategy});return t(j,(()=>({openDropdown:g})),[]),s((()=>{(null==j?void 0:j.current)&&(j.current.openDropdown=g)}),[g]),s((()=>{null==b||b(g)}),[g]),o(n,{children:[o("div",Object.assign({style:{position:"relative"},ref:D},{children:[r(a,{disabled:w.disabled,onClick:e=>{var o;null===(o=w.onDropdownOpen)||void 0===o||o.call(w),g?e.preventDefault():w.disabled||h(!0)}}),v]})),g&&r(c,Object.assign({ref:S,style:Object.assign(Object.assign({},C.popper),{zIndex:3})},x.popper,{children:r(d,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:r(m,Object.assign({},w,{onSelect:e=>{var o;"2.0"===f&&w.isMultiSelect||(null===(o=w.onSelect)||void 0===o||o.call(w,e),h(!1))},onClose:e=>{var o,n;"2.0"===f&&w.isMultiSelect&&e&&(null===(o=w.onSelect)||void 0===o||o.call(w,[...e])),h(!1),null===(n=null==w?void 0:w.onClose)||void 0===n||n.call(w)},version:f}))}))}))]})}));u.displayName="DropdownPopover";export{u as DropdownPopover};
1
+ import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as o,Fragment as n,jsx as r}from"react/jsx-runtime";import l,{useState as i,useRef as t,useImperativeHandle as s,useEffect as d}from"react";import{usePopper as p}from"react-popper";import a from"../../dropShadow/DropShadow.js";import{OverLapAbs as c,OpenDropdownContainer as m}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const v=l.forwardRef(((l,v)=>{var{children:b,onDropdownVisbilityChange:f,version:w="1.0"}=l,h=e(l,["children","onDropdownVisbilityChange","version"]);const j=v,[g,y]=i(!1),[D,O]=i(null),[S,C]=i(null),x=t(null),{styles:R,attributes:z}=p(D,S,{placement:h.placement,strategy:h.strategy});return s(j,(()=>({openDropdown:g})),[]),d((()=>{(null==j?void 0:j.current)&&(j.current.openDropdown=g)}),[g]),d((()=>{null==f||f(g)}),[g]),o(n,{children:[o("div",Object.assign({style:{position:"relative"},ref:O},{children:[r(c,{ref:x,disabled:h.disabled,onClick:e=>{var o;null===(o=h.onDropdownOpen)||void 0===o||o.call(h),g?(y(!1),e.preventDefault()):h.disabled||y(!0)}}),b]})),g&&r(m,Object.assign({ref:C,style:Object.assign(Object.assign({},R.popper),{zIndex:3})},z.popper,{children:r(a,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:r(u,Object.assign({},h,{onSelect:e=>{var o;"2.0"===w&&h.isMultiSelect||(null===(o=h.onSelect)||void 0===o||o.call(h,e),y(!1))},onClose:e=>{var o,n;"2.0"===w&&h.isMultiSelect&&e&&(null===(o=h.onSelect)||void 0===o||o.call(h,[...e])),y(!1),null===(n=null==h?void 0:h.onClose)||void 0===n||n.call(h)},version:w,headerRef:x}))}))}))]})}));v.displayName="DropdownPopover";export{v as DropdownPopover};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as i}from"react";import{ZeroState as n}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,v=290,b=b=>{let{options:j,isSearchable:w,isMultiSelect:y,width:x,allowFreeForm:O,height:C,onClose:M,onSelect:D,onSearch:L,version:F,skipSorting:k}=b;const{dropdownOptions:A,search:H,searchedString:B,searchedOptions:Z,onApplyHandler:q,selectAllHandler:z,onMultiSelectClear:I,onFreeFormSelect:K,onMultiSelectApply:N,latestDropdownOptionsRef:P,getSelectedOptions:R}=s(F,j,D,k,y,L),[T,W]=o(null!=x?x:v),[E,G]=o(null),J=r(null);l(J,(()=>{if(G(null),y&&"2.0"===F){const e=R(P.current);null==M||M(e)}else null==M||M(A)}));const Q=null!=C?C:g,U="number"==typeof Q?w&&y?Q-96:w&&!y||!w&&y?Q-48:Q:Q;i((()=>{const e=null!=x?x:v;if(null===E)W(e);else if("number"==typeof e)W(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));W(t)}}),[E]);const V=[],X=(B&&L?Z:A).map((e=>{var t,o;if(B&&!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(B.toLowerCase()))&&(V.push(!B||e.label===B),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(B.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(B.toLowerCase()))?(V.push(!B||e.label===B),e):null}return e})).filter((e=>null!==e)),Y=!!w&&B&&0===X.length;return e(h,Object.assign({version:F,ref:J,style:{width:T}},{children:[e("div",Object.assign({style:{width:E?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(f,{onSearch:H,version:F}),X.length||B?e(m,Object.assign({minHeight:Q,maxHeight:U},{children:[!!y&&!Y&&t(u,{version:F,options:B&&L?Z:A,onSelect:z}),!O&&Y&&t(S,{height:U,searchedString:B}),O&&(Y||!!V.length&&V.every((e=>!1===e)))&&t(a,{version:F,isMultiSelect:y,onSelect:K,searchedString:B}),t(p,{version:F,onSelect:q,showDescription:function(e,t){G(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:X})]})):t("div",Object.assign({style:{height:Q,display:"flex"}},{children:t(n,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!X.length&&!B)&&"2.0"!==F&&t(d,{onClear:I,onApply:N,list:B&&L?Z:A})]})),!!E&&t(c,{title:E.title,description:E.description,version:F})]}))};export{b as OpenedDropdown};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as i}from"react";import{ZeroState as n}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,v=290,b=b=>{let{options:j,isSearchable:w,isMultiSelect:y,width:x,allowFreeForm:O,height:C,onClose:M,onSelect:D,onSearch:L,version:F,skipSorting:k,headerRef:A}=b;const{dropdownOptions:H,search:B,searchedString:R,searchedOptions:Z,onApplyHandler:q,selectAllHandler:z,onMultiSelectClear:I,onFreeFormSelect:K,onMultiSelectApply:N,latestDropdownOptionsRef:P,getSelectedOptions:T}=s(F,j,D,k,y,L),[W,E]=o(null!=x?x:v),[G,J]=o(null),Q=r(null);l(Q,(()=>{if(J(null),y&&"2.0"===F){const e=T(P.current);null==M||M(e)}else null==M||M(H)}),[A]);const U=null!=C?C:g,V="number"==typeof U?w&&y?U-96:w&&!y||!w&&y?U-48:U:U;i((()=>{const e=null!=x?x:v;if(null===G)E(e);else if("number"==typeof e)E(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));E(t)}}),[G]);const X=[],Y=(R&&L?Z:H).map((e=>{var t,o;if(R&&!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(R.toLowerCase()))&&(X.push(!R||e.label===R),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(R.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(R.toLowerCase()))?(X.push(!R||e.label===R),e):null}return e})).filter((e=>null!==e)),$=!!w&&R&&0===Y.length;return e(h,Object.assign({version:F,ref:Q,style:{width:W}},{children:[e("div",Object.assign({style:{width:G?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(f,{onSearch:B,version:F}),Y.length||R?e(m,Object.assign({minHeight:U,maxHeight:V},{children:[!!y&&!$&&t(u,{version:F,options:R&&L?Z:H,onSelect:z}),!O&&$&&t(S,{height:V,searchedString:R}),O&&($||!!X.length&&X.every((e=>!1===e)))&&t(a,{version:F,isMultiSelect:y,onSelect:K,searchedString:R}),t(p,{version:F,onSelect:q,showDescription:function(e,t){J(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:Y})]})):t("div",Object.assign({style:{height:U,display:"flex"}},{children:t(n,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!Y.length&&!R)&&"2.0"!==F&&t(d,{onClear:I,onApply:N,list:R&&L?Z:H})]})),!!G&&t(c,{title:G.title,description:G.description,version:F})]}))};export{b as OpenedDropdown};
@@ -16,6 +16,7 @@ export interface OpenDropdownProps {
16
16
  onSearch?: (key: string) => Promise<DropdownOption[]>;
17
17
  version?: '1.0' | '2.0';
18
18
  skipSorting?: boolean;
19
+ headerRef?: any;
19
20
  }
20
21
  export type GroupedOption = {
21
22
  label?: string;
@@ -1 +1 @@
1
- export declare function useOutside(ref: any, cb: () => void): void;
1
+ export declare function useOutside(ref: any, cb: () => void, excludeRefs?: any[]): void;
@@ -1 +1 @@
1
- import{useEffect as e}from"react";function n(n,t){e((()=>{function e(e){n.current&&!n.current.contains(e.target)&&t()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[n])}export{n as useOutside};
1
+ import{useEffect as t}from"react";function e(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];t((()=>{function t(t){let o=!0;null==r||r.forEach((e=>{e.current&&e.current.contains(t.target)&&(o=!1)})),o&&e.current&&!e.current.contains(t.target)&&n()}return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}}),[e])}export{e as useOutside};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.512-beta.2",
3
+ "version": "0.0.512-beta.3",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",