@bikdotai/bik-component-library 0.0.162 → 0.0.163

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("react/jsx-runtime"),t=require("react"),s=require("../../../zeroState/ZeroState.js"),n=require("../../../../hooks/useOutside.js"),l=require("../utils/iterationOnOptions.js"),i=require("./description/Description.js"),o=require("./menu/FreeFormMenu.js"),r=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 f=304,h=290;exports.OpenedDropdown=j=>{let{options:b,isSearchable:S,isMultiSelect:O,width:x,allowFreeForm:g,height:v,onClose:m,onSelect:w}=j;const[y,q]=t.useState(null!=b?b:[]);t.useEffect((()=>{b&&q(b.sort((e=>e.selected?-1:1)))}),[b]);const[C,M]=t.useState(null!=x?x:h),[L,F]=t.useState(""),[D,A]=t.useState(null),B=t.useRef(null);n.useOutside(B,(()=>{A(null),null==m||m()}));const Z=null!=v?v:f,E="number"==typeof Z?S&&O?Z-96:S&&!O||!S&&O?Z-48:Z:Z;function k(e){if(O){const t=l.iterateOnOptions(y,{selected:e.selected},(t=>t.value===e.value));q([...t])}else null==w||w(e)}t.useEffect((()=>{const e=null!=x?x:h;if(null===D)M(e);else if("number"==typeof e)M(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));M(t)}}),[D]);const H=[],P=y.map((e=>{var t,s;if(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(L.toLowerCase()))&&(H.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===(s=e.searchKey)||void 0===s?void 0:s.toLowerCase().includes(L.toLowerCase()))?(H.push(!L||e.label===L),e):null}return e})).filter((e=>null!==e)),_=!!S&&L&&0===P.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({ref:B,style:{width:C}},{children:[e.jsxs("div",Object.assign({style:{width:D?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!S&&e.jsx(d.SearchBox,{onSearch:function(e){F(e)}}),P.length||L?e.jsxs(a.MenuListContainer,Object.assign({minHeight:Z,maxHeight:E},{children:[!!O&&!_&&e.jsx(u.SelectAllMenu,{options:y,onSelect:function(e){if("selectAll"===e){const e=l.iterateOnOptions(y,{selected:!0},(e=>{var t;return L?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(L.toLowerCase()))&&!e.disabled:!e.disabled}));q([...e])}else if("notSelected"===e){const e=l.iterateOnOptions(y,{selected:!1},(e=>!e.disabled));q([...e])}}}),!g&&_&&e.jsx(p.SearchZeroState,{searchedString:L}),g&&(_||!!H.length&&H.every((e=>!1===e)))&&e.jsx(o.FreeFormMenu,{isMultiSelect:O,onSelect:function(e){if(!O)return void k({label:L,value:L,isFreeForm:!0,selected:!0});const t=y.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===L&&t.value===L?e:t.selected})));e&&(t.some((e=>e.label===L&&e.value===L))||t.unshift({label:L,value:L,isFreeForm:!0,selected:!0})),q([...t])},searchedString:L}),e.jsx(r.MenuList,{onSelect:k,showDescription:function(e,t){A(e&&t?{title:e,description:t}:null)},isMultiSelect:O,options:P})]})):e.jsx("div",Object.assign({style:{height:Z,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!O&&!(!P.length&&!L)&&e.jsx(c.default,{onClear:function(){const e=l.iterateOnOptions(y,{selected:!1});q([...e])},onApply:function(){const e=[];y.forEach((t=>{if(t.options){const s=t.options.filter((e=>!0===e.selected));e.push(Object.assign(Object.assign({},t),{options:[...s]}))}else t.selected&&e.push(Object.assign({},t))})),null==w||w([...e])},list:y})]})),!!D&&e.jsx(i.Description,{title:D.title,description:D.description})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../zeroState/ZeroState.js"),n=require("../../../../hooks/useOutside.js"),l=require("../utils/iterationOnOptions.js"),i=require("./description/Description.js"),o=require("./menu/FreeFormMenu.js"),r=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 f=304,h=290;exports.OpenedDropdown=j=>{let{options:b,isSearchable:S,isMultiSelect:O,width:x,allowFreeForm:g,height:v,onClose:m,onSelect:w}=j;const[y,q]=t.useState(null!=b?b:[]);t.useEffect((()=>{b&&q([...b.sort((e=>e.selected?-1:1))])}),[b]);const[C,M]=t.useState(null!=x?x:h),[L,F]=t.useState(""),[D,A]=t.useState(null),B=t.useRef(null);n.useOutside(B,(()=>{A(null),null==m||m()}));const Z=null!=v?v:f,E="number"==typeof Z?S&&O?Z-96:S&&!O||!S&&O?Z-48:Z:Z;function k(e){if(O){const t=l.iterateOnOptions(y,{selected:e.selected},(t=>t.value===e.value));q([...t])}else null==w||w(e)}t.useEffect((()=>{const e=null!=x?x:h;if(null===D)M(e);else if("number"==typeof e)M(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));M(t)}}),[D]);const H=[],P=y.map((e=>{var t,s;if(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(L.toLowerCase()))&&(H.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===(s=e.searchKey)||void 0===s?void 0:s.toLowerCase().includes(L.toLowerCase()))?(H.push(!L||e.label===L),e):null}return e})).filter((e=>null!==e)),_=!!S&&L&&0===P.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({ref:B,style:{width:C}},{children:[e.jsxs("div",Object.assign({style:{width:D?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!S&&e.jsx(d.SearchBox,{onSearch:function(e){F(e)}}),P.length||L?e.jsxs(a.MenuListContainer,Object.assign({minHeight:Z,maxHeight:E},{children:[!!O&&!_&&e.jsx(u.SelectAllMenu,{options:y,onSelect:function(e){if("selectAll"===e){const e=l.iterateOnOptions(y,{selected:!0},(e=>{var t;return L?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(L.toLowerCase()))&&!e.disabled:!e.disabled}));q([...e])}else if("notSelected"===e){const e=l.iterateOnOptions(y,{selected:!1},(e=>!e.disabled));q([...e])}}}),!g&&_&&e.jsx(p.SearchZeroState,{searchedString:L}),g&&(_||!!H.length&&H.every((e=>!1===e)))&&e.jsx(o.FreeFormMenu,{isMultiSelect:O,onSelect:function(e){if(!O)return void k({label:L,value:L,isFreeForm:!0,selected:!0});const t=y.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===L&&t.value===L?e:t.selected})));e&&(t.some((e=>e.label===L&&e.value===L))||t.unshift({label:L,value:L,isFreeForm:!0,selected:!0})),q([...t])},searchedString:L}),e.jsx(r.MenuList,{onSelect:k,showDescription:function(e,t){A(e&&t?{title:e,description:t}:null)},isMultiSelect:O,options:P})]})):e.jsx("div",Object.assign({style:{height:Z,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!O&&!(!P.length&&!L)&&e.jsx(c.default,{onClear:function(){const e=l.iterateOnOptions(y,{selected:!1});q([...e])},onApply:function(){const e=[];y.forEach((t=>{if(t.options){const s=t.options.filter((e=>!0===e.selected));e.push(Object.assign(Object.assign({},t),{options:[...s]}))}else t.selected&&e.push(Object.assign({},t))})),null==w||w([...e])},list:y})]})),!!D&&e.jsx(i.Description,{title:D.title,description:D.description})]}))};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as l,useRef as s}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as n}from"../../../../hooks/useOutside.js";import{iterateOnOptions as r}from"../utils/iterationOnOptions.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 f,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as h}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const g=304,j=290,v=v=>{let{options:S,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:L,onSelect:F}=v;const[M,D]=o(null!=S?S:[]);l((()=>{S&&D(S.sort((e=>e.selected?-1:1)))}),[S]);const[A,B]=o(null!=O?O:j),[k,H]=o(""),[Z,q]=o(null),z=s(null);n(z,(()=>{q(null),null==L||L()}));const E=null!=C?C:g,I="number"==typeof E?w&&y?E-96:w&&!y||!w&&y?E-48:E:E;function K(e){if(y){const t=r(M,{selected:e.selected},(t=>t.value===e.value));D([...t])}else null==F||F(e)}l((()=>{const e=null!=O?O:j;if(null===Z)B(e);else if("number"==typeof e)B(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));B(t)}}),[Z]);const N=[],P=M.map((e=>{var t,o;if(k){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(k.toLowerCase()))&&(N.push(!k||e.label===k),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(k.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(k.toLowerCase()))?(N.push(!k||e.label===k),e):null}return e})).filter((e=>null!==e)),T=!!w&&k&&0===P.length;return e(f,Object.assign({ref:z,style:{width:A}},{children:[e("div",Object.assign({style:{width:Z?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!w&&t(h,{onSearch:function(e){H(e)}}),P.length||k?e(m,Object.assign({minHeight:E,maxHeight:I},{children:[!!y&&!T&&t(d,{options:M,onSelect:function(e){if("selectAll"===e){const e=r(M,{selected:!0},(e=>{var t;return k?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(k.toLowerCase()))&&!e.disabled:!e.disabled}));D([...e])}else if("notSelected"===e){const e=r(M,{selected:!1},(e=>!e.disabled));D([...e])}}}),!x&&T&&t(b,{searchedString:k}),x&&(T||!!N.length&&N.every((e=>!1===e)))&&t(a,{isMultiSelect:y,onSelect:function(e){if(!y)return void K({label:k,value:k,isFreeForm:!0,selected:!0});const t=M.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===k&&t.value===k?e:t.selected})));e&&(t.some((e=>e.label===k&&e.value===k))||t.unshift({label:k,value:k,isFreeForm:!0,selected:!0})),D([...t])},searchedString:k}),t(u,{onSelect:K,showDescription:function(e,t){q(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:P})]})):t("div",Object.assign({style:{height:E,display:"flex"}},{children:t(i,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!P.length&&!k)&&t(p,{onClear:function(){const e=r(M,{selected:!1});D([...e])},onApply:function(){const e=[];M.forEach((t=>{if(t.options){const o=t.options.filter((e=>!0===e.selected));e.push(Object.assign(Object.assign({},t),{options:[...o]}))}else t.selected&&e.push(Object.assign({},t))})),null==F||F([...e])},list:M})]})),!!Z&&t(c,{title:Z.title,description:Z.description})]}))};export{v as OpenedDropdown};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as l,useRef as s}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as n}from"../../../../hooks/useOutside.js";import{iterateOnOptions as r}from"../utils/iterationOnOptions.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 f,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as h}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const g=304,j=290,v=v=>{let{options:S,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:L,onSelect:F}=v;const[M,D]=o(null!=S?S:[]);l((()=>{S&&D([...S.sort((e=>e.selected?-1:1))])}),[S]);const[A,B]=o(null!=O?O:j),[k,H]=o(""),[Z,q]=o(null),z=s(null);n(z,(()=>{q(null),null==L||L()}));const E=null!=C?C:g,I="number"==typeof E?w&&y?E-96:w&&!y||!w&&y?E-48:E:E;function K(e){if(y){const t=r(M,{selected:e.selected},(t=>t.value===e.value));D([...t])}else null==F||F(e)}l((()=>{const e=null!=O?O:j;if(null===Z)B(e);else if("number"==typeof e)B(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));B(t)}}),[Z]);const N=[],P=M.map((e=>{var t,o;if(k){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(k.toLowerCase()))&&(N.push(!k||e.label===k),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(k.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(k.toLowerCase()))?(N.push(!k||e.label===k),e):null}return e})).filter((e=>null!==e)),T=!!w&&k&&0===P.length;return e(f,Object.assign({ref:z,style:{width:A}},{children:[e("div",Object.assign({style:{width:Z?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!w&&t(h,{onSearch:function(e){H(e)}}),P.length||k?e(m,Object.assign({minHeight:E,maxHeight:I},{children:[!!y&&!T&&t(d,{options:M,onSelect:function(e){if("selectAll"===e){const e=r(M,{selected:!0},(e=>{var t;return k?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(k.toLowerCase()))&&!e.disabled:!e.disabled}));D([...e])}else if("notSelected"===e){const e=r(M,{selected:!1},(e=>!e.disabled));D([...e])}}}),!x&&T&&t(b,{searchedString:k}),x&&(T||!!N.length&&N.every((e=>!1===e)))&&t(a,{isMultiSelect:y,onSelect:function(e){if(!y)return void K({label:k,value:k,isFreeForm:!0,selected:!0});const t=M.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===k&&t.value===k?e:t.selected})));e&&(t.some((e=>e.label===k&&e.value===k))||t.unshift({label:k,value:k,isFreeForm:!0,selected:!0})),D([...t])},searchedString:k}),t(u,{onSelect:K,showDescription:function(e,t){q(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:P})]})):t("div",Object.assign({style:{height:E,display:"flex"}},{children:t(i,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!P.length&&!k)&&t(p,{onClear:function(){const e=r(M,{selected:!1});D([...e])},onApply:function(){const e=[];M.forEach((t=>{if(t.options){const o=t.options.filter((e=>!0===e.selected));e.push(Object.assign(Object.assign({},t),{options:[...o]}))}else t.selected&&e.push(Object.assign({},t))})),null==F||F([...e])},list:M})]})),!!Z&&t(c,{title:Z.title,description:Z.description})]}))};export{v as OpenedDropdown};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.162",
3
+ "version": "0.0.163",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",