@bikdotai/bik-component-library 0.0.68 → 0.0.69

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"),i=require("../utils/iterationOnOptions.js"),l=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:S,isSearchable:O,isMultiSelect:x,width:b,allowFreeForm:g,height:m,onClose:v,onSelect:w}=j;const[y,q]=t.useState(null!=S?S:[]);t.useEffect((()=>{q(S)}),[JSON.stringify(S)]);const[M,F]=t.useState(null!=b?b:h),[C,D]=t.useState(""),[L,A]=t.useState(null),B=t.useRef(null);n.useOutside(B,(()=>{A(null),null==v||v()}));const Z=null!=m?m:f,E="number"==typeof Z?O&&x?Z-96:O&&!x||!O&&x?Z-48:Z:Z;function H(e){if(x){const t=i.iterateOnOptions(y,{selected:e.selected},(t=>t.value===e.value));q([...t])}else null==w||w(e)}t.useEffect((()=>{const e=null!=b?b:h;if(null===L)F(e);else if("number"==typeof e)F(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));F(t)}}),[L]);const N=y.map((e=>{var t;if(C){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(C.toLowerCase()))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(C.toLowerCase()))?e:null}return e})).filter((e=>null!==e)),W=!!O&&C&&0===N.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({ref:B,style:{maxWidth:L?800:400,width:M}},{children:[e.jsxs("div",Object.assign({style:{width:L?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!O&&e.jsx(d.SearchBox,{onSearch:function(e){D(e)}}),N.length||C?e.jsxs(a.MenuListContainer,Object.assign({minHeight:Z,maxHeight:E},{children:[!!x&&!W&&e.jsx(u.SelectAllMenu,{options:y,onSelect:function(e){if("selectAll"===e){const e=i.iterateOnOptions(y,{selected:!0},(e=>!e.disabled));q([...e])}else if("notSelected"===e){const e=i.iterateOnOptions(y,{selected:!1},(e=>!e.disabled));q([...e])}}}),!g&&W&&e.jsx(p.SearchZeroState,{searchedString:C}),g&&W&&e.jsx(o.FreeFormMenu,{isMultiSelect:x,onSelect:function(e){if(!x)return void H({label:C,value:C,isFreeForm:!0,selected:!0});const t=y.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===C&&t.value===C?e:t.selected})));e&&(t.some((e=>e.label===C&&e.value===C))||t.unshift({label:C,value:C,isFreeForm:!0,selected:!0})),q([...t])},searchedString:C}),e.jsx(r.MenuList,{onSelect:H,showDescription:function(e,t){A(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:N})]})):e.jsx("div",Object.assign({style:{height:Z,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!x&&!(!N.length&&!C)&&e.jsx(c.default,{onClear:function(){const e=i.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})]})),!!L&&e.jsx(l.Description,{title:L.title,description:L.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"),i=require("../utils/iterationOnOptions.js"),l=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:S,isSearchable:x,isMultiSelect:O,width:b,allowFreeForm:g,height:m,onClose:v,onSelect:w}=j;const[q,y]=t.useState(null!=S?S:[]);t.useEffect((()=>{y(S)}),[S]);const[M,F]=t.useState(null!=b?b:h),[C,D]=t.useState(""),[L,A]=t.useState(null),B=t.useRef(null);n.useOutside(B,(()=>{A(null),null==v||v()}));const Z=null!=m?m:f,E="number"==typeof Z?x&&O?Z-96:x&&!O||!x&&O?Z-48:Z:Z;function H(e){if(O){const t=i.iterateOnOptions(q,{selected:e.selected},(t=>t.value===e.value));y([...t])}else null==w||w(e)}t.useEffect((()=>{const e=null!=b?b:h;if(null===L)F(e);else if("number"==typeof e)F(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));F(t)}}),[L]);const W=q.map((e=>{var t;if(C){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(C.toLowerCase()))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(C.toLowerCase()))?e:null}return e})).filter((e=>null!==e)),_=!!x&&C&&0===W.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({ref:B,style:{maxWidth:L?800:400,width:M}},{children:[e.jsxs("div",Object.assign({style:{width:L?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:function(e){D(e)}}),W.length||C?e.jsxs(a.MenuListContainer,Object.assign({minHeight:Z,maxHeight:E},{children:[!!O&&!_&&e.jsx(u.SelectAllMenu,{options:q,onSelect:function(e){if("selectAll"===e){const e=i.iterateOnOptions(q,{selected:!0},(e=>!e.disabled));y([...e])}else if("notSelected"===e){const e=i.iterateOnOptions(q,{selected:!1},(e=>!e.disabled));y([...e])}}}),!g&&_&&e.jsx(p.SearchZeroState,{searchedString:C}),g&&_&&e.jsx(o.FreeFormMenu,{isMultiSelect:O,onSelect:function(e){if(!O)return void H({label:C,value:C,isFreeForm:!0,selected:!0});const t=q.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===C&&t.value===C?e:t.selected})));e&&(t.some((e=>e.label===C&&e.value===C))||t.unshift({label:C,value:C,isFreeForm:!0,selected:!0})),y([...t])},searchedString:C}),e.jsx(r.MenuList,{onSelect:H,showDescription:function(e,t){A(e&&t?{title:e,description:t}:null)},isMultiSelect:O,options:W})]})):e.jsx("div",Object.assign({style:{height:Z,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!O&&!(!W.length&&!C)&&e.jsx(c.default,{onClear:function(){const e=i.iterateOnOptions(q,{selected:!1});y([...e])},onApply:function(){const e=[];q.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:q})]})),!!L&&e.jsx(l.Description,{title:L.title,description:L.description})]}))};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as l,useRef as n}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as s}from"../../../../hooks/useOutside.js";import{iterateOnOptions as r}from"../utils/iterationOnOptions.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as u}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as p}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as m,MenuListContainer as f}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,S=S=>{let{options:v,isSearchable:O,isMultiSelect:w,width:y,allowFreeForm:x,height:F,onClose:M,onSelect:C}=S;const[D,L]=o(null!=v?v:[]);l((()=>{L(v)}),[JSON.stringify(v)]);const[A,B]=o(null!=y?y:j),[H,N]=o(""),[W,Z]=o(null),k=n(null);s(k,(()=>{Z(null),null==M||M()}));const z=null!=F?F:g,E="number"==typeof z?O&&w?z-96:O&&!w||!O&&w?z-48:z:z;function I(e){if(w){const t=r(D,{selected:e.selected},(t=>t.value===e.value));L([...t])}else null==C||C(e)}l((()=>{const e=null!=y?y:j;if(null===W)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)}}),[W]);const J=D.map((e=>{var t;if(H){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(H.toLowerCase()))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(H.toLowerCase()))?e:null}return e})).filter((e=>null!==e)),T=!!O&&H&&0===J.length;return e(m,Object.assign({ref:k,style:{maxWidth:W?800:400,width:A}},{children:[e("div",Object.assign({style:{width:W?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!O&&t(h,{onSearch:function(e){N(e)}}),J.length||H?e(f,Object.assign({minHeight:z,maxHeight:E},{children:[!!w&&!T&&t(p,{options:D,onSelect:function(e){if("selectAll"===e){const e=r(D,{selected:!0},(e=>!e.disabled));L([...e])}else if("notSelected"===e){const e=r(D,{selected:!1},(e=>!e.disabled));L([...e])}}}),!x&&T&&t(b,{searchedString:H}),x&&T&&t(u,{isMultiSelect:w,onSelect:function(e){if(!w)return void I({label:H,value:H,isFreeForm:!0,selected:!0});const t=D.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===H&&t.value===H?e:t.selected})));e&&(t.some((e=>e.label===H&&e.value===H))||t.unshift({label:H,value:H,isFreeForm:!0,selected:!0})),L([...t])},searchedString:H}),t(a,{onSelect:I,showDescription:function(e,t){Z(e&&t?{title:e,description:t}:null)},isMultiSelect:w,options:J})]})):t("div",Object.assign({style:{height:z,display:"flex"}},{children:t(i,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!w&&!(!J.length&&!H)&&t(d,{onClear:function(){const e=r(D,{selected:!1});L([...e])},onApply:function(){const e=[];D.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==C||C([...e])},list:D})]})),!!W&&t(c,{title:W.title,description:W.description})]}))};export{S as OpenedDropdown};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as l,useRef as n}from"react";import{ZeroState as s}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{iterateOnOptions as r}from"../utils/iterationOnOptions.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as u}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as p}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as m,MenuListContainer as f}from"./OpennedDropdown.styled.js";import{SearchBox as h}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const j=304,g=290,S=S=>{let{options:v,isSearchable:O,isMultiSelect:w,width:x,allowFreeForm:y,height:F,onClose:M,onSelect:C}=S;const[D,L]=o(null!=v?v:[]);l((()=>{L(v)}),[v]);const[A,B]=o(null!=x?x:g),[H,W]=o(""),[Z,k]=o(null),z=n(null);i(z,(()=>{k(null),null==M||M()}));const E=null!=F?F:j,I="number"==typeof E?O&&w?E-96:O&&!w||!O&&w?E-48:E:E;function N(e){if(w){const t=r(D,{selected:e.selected},(t=>t.value===e.value));L([...t])}else null==C||C(e)}l((()=>{const e=null!=x?x:g;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 T=D.map((e=>{var t;if(H){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(H.toLowerCase()))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(H.toLowerCase()))?e:null}return e})).filter((e=>null!==e)),q=!!O&&H&&0===T.length;return e(m,Object.assign({ref:z,style:{maxWidth:Z?800:400,width:A}},{children:[e("div",Object.assign({style:{width:Z?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!O&&t(h,{onSearch:function(e){W(e)}}),T.length||H?e(f,Object.assign({minHeight:E,maxHeight:I},{children:[!!w&&!q&&t(p,{options:D,onSelect:function(e){if("selectAll"===e){const e=r(D,{selected:!0},(e=>!e.disabled));L([...e])}else if("notSelected"===e){const e=r(D,{selected:!1},(e=>!e.disabled));L([...e])}}}),!y&&q&&t(b,{searchedString:H}),y&&q&&t(u,{isMultiSelect:w,onSelect:function(e){if(!w)return void N({label:H,value:H,isFreeForm:!0,selected:!0});const t=D.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===H&&t.value===H?e:t.selected})));e&&(t.some((e=>e.label===H&&e.value===H))||t.unshift({label:H,value:H,isFreeForm:!0,selected:!0})),L([...t])},searchedString:H}),t(a,{onSelect:N,showDescription:function(e,t){k(e&&t?{title:e,description:t}:null)},isMultiSelect:w,options:T})]})):t("div",Object.assign({style:{height:E,display:"flex"}},{children:t(s,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!w&&!(!T.length&&!H)&&t(d,{onClear:function(){const e=r(D,{selected:!1});L([...e])},onApply:function(){const e=[];D.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==C||C([...e])},list:D})]})),!!Z&&t(c,{title:Z.title,description:Z.description})]}))};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.68",
3
+ "version": "0.0.69",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",