@bikdotai/bik-component-library 0.0.30-beta.1 → 0.0.30-beta.2

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"),l=require("react"),a=require("../../DropdownWrapper.js");const n=n=>{let{onChange:r,extra:i,val:o,isLoading:t,errors:s,disabled:d}=n;const[u,c]=l.useState([]),p=o;return l.useEffect((()=>{const e=[...(null==i?void 0:i.options)&&Array.isArray(i.options)?i.options.filter((e=>!!Object.keys(e).length)).map((e=>({selected:!!(null==p?void 0:p.find((l=>l.name===e.name||l.id===e.id))),label:e.name,value:e.id}))):[]].concat((null!=p?p:[]).map((e=>({value:e.id,label:e.name}))));null==p||p.forEach((l=>{let{name:a,id:n}=l;const r=e.findIndex((e=>e.value===n&&e.label===a));-1!==r&&(e[r].selected=!0)})),c([...e])}),[i,p]),e.jsx("div",{children:e.jsx(a.default,{disabled:d,allowFreeForm:!0,isSearchable:!0,isLoading:t,error:null==s?void 0:s.val,isMultiSelect:!0,options:u,onSelect:function(e){if(Array.isArray(e)){const l=[];e.forEach((e=>{var a,n;e.options?null===(a=e.options)||void 0===a||a.forEach((e=>{l.push({name:e.label,id:e.value})})):l.push({name:null!==(n=e.label)&&void 0!==n?n:"",id:e.value})})),null==r||r(l)}}})})};exports.default=l=>e.jsx(n,Object.assign({},l));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),a=require("../../DropdownWrapper.js");const i=i=>{let{onChange:n,extra:r,val:o,isLoading:t,errors:s,disabled:d}=i;const[u,c]=l.useState([]),v=o;return l.useEffect((()=>{var e;const l=(null==r?void 0:r.options)&&Array.isArray(r.options)?r.options.filter((e=>!!Object.keys(e).length)).map((e=>({selected:!!(null==v?void 0:v.find((l=>l.name===e.name||l.id===e.id))),label:e.name,value:e.id}))):[],a=null!==(e=null==v?void 0:v.map((e=>e.id)))&&void 0!==e?e:[],i=[...l.filter((e=>!a.includes(e.value)))].concat((null!=v?v:[]).map((e=>({value:e.id,label:e.name}))));null==v||v.forEach((e=>{let{name:l,id:a}=e;const n=i.findIndex((e=>e.value===a&&e.label===l));-1!==n&&(i[n].selected=!0)})),c([...i])}),[r,v]),e.jsx("div",{children:e.jsx(a.default,{disabled:d,allowFreeForm:!0,isSearchable:!0,isLoading:t,error:null==s?void 0:s.val,isMultiSelect:!0,options:u,onSelect:function(e){if(Array.isArray(e)){const l=[];e.forEach((e=>{var a,i;e.options?null===(a=e.options)||void 0===a||a.forEach((e=>{l.push({name:e.label,id:e.value})})):l.push({name:null!==(i=e.label)&&void 0!==i?i:"",id:e.value})})),null==n||n(l)}}})})};exports.default=l=>e.jsx(i,Object.assign({},l));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../dropdown/Dropdown.js"),i=require("./InputLoader.js");exports.default=t=>{let{options:l,onSelect:o,defaultOption:d,isSearchable:s,isLoading:a,error:n,nativeID:u,dropdownLabel:p,isMultiSelect:c,allowFreeForm:h,width:w,disabled:j}=t;return a?e.jsx(i.default,{}):e.jsx("div",Object.assign({style:{maxWidth:200,width:200},id:u},{children:e.jsx(r.Dropdown,{height:208,disabled:j,allowFreeForm:null!=h&&h,isMultiSelect:c,width:w,size:"small",placeHolder:p,error:n,isSearchable:null!=s&&s,defaultOptions:d?Array.isArray(d)?d:[d]:void 0,options:l,onSelect:o})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../dropdown/Dropdown.js"),i=require("./InputLoader.js");exports.default=l=>{let{options:t,onSelect:o,defaultOption:d,isSearchable:s,isLoading:a,error:n,nativeID:u,dropdownLabel:p,isMultiSelect:c,allowFreeForm:h,width:w,disabled:j}=l;return a?e.jsx(i.default,{}):e.jsx("div",Object.assign({style:{maxWidth:200,width:200},id:u},{children:e.jsx(r.Dropdown,{height:(null==t?void 0:t.length)?void 0:208,disabled:j,allowFreeForm:null!=h&&h,isMultiSelect:c,width:w,size:"small",placeHolder:p,error:n,isSearchable:null!=s&&s,defaultOptions:d?Array.isArray(d)?d:[d]:void 0,options:t,onSelect:o})}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("react"),n=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),s=require("../input/context/InputStyleProvider.js"),l=require("./DropdownPopover/index.js");function a(){}const u=u=>{var d,c,{placeHolder:p,size:v,onSelect:h,defaultOptions:j,disabled:f,noErrorHint:g}=u,x=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint"]);const b=null!=v?v:"default",w=t.useRef(),[m,O]=t.useState(null!=j?j:[]);t.useEffect((()=>{var e;const r=[];null===(e=null==x?void 0:x.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&r.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&r.push(e)})),O([...r])}),[x.options]),t.useEffect((()=>{j&&O([...j])}),[j]);const q=m.length?m.map((e=>e.label)).join(", "):void 0;return r.jsx(s.InputStyleContext.Provider,Object.assign({value:{InputWrapper:{height:"small"===b?32:48,width:null!==(d=x.width)&&void 0!==d?d:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},input:{minHeight:"100%"}}},{children:r.jsx(l.DropdownPopover,Object.assign({ref:w,onSelect:function(e){Array.isArray(e)?O([...e]):O([e]),null==h||h(e)},disabled:f},x,{children:r.jsx(i.Input,{noErrorHint:g,state:f?"disabled":"none",value:q,errorMessage:x.error,variant:b,placeholder:null!=p?p:"Select an option",width:null!==(c=x.width)&&void 0!==c?c:"100%",onChangeText:a,rightIcon:{icon:()=>{var e;return r.jsx(o.default,{style:{transform:(null===(e=null==w?void 0:w.current)||void 0===e?void 0:e.openDropdown)?"rotate(180deg)":"rotate(0deg)"},onClick:a,width:"small"===b?20:24,height:"small"===b?20:24,color:n.COLORS.content.primary})}}})}))}))};u.displayName="Dropdown",exports.Dropdown=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("react"),n=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./DropdownPopover/index.js");function a(){}const u=u=>{var d,c,{placeHolder:p,size:v,onSelect:h,defaultOptions:j,disabled:f,noErrorHint:g}=u,x=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint"]);const b=null!=v?v:"default",w=t.useRef(),[m,O]=t.useState(null!=j?j:[]);t.useEffect((()=>{var e;const r=[];null===(e=null==x?void 0:x.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&r.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&r.push(e)})),O([...r])}),[x.options]),t.useEffect((()=>{j&&O([...j])}),[j]);const q=m.length?m.map((e=>e.label)).join(", "):void 0;return r.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:{height:"small"===b?32:48,width:null!==(d=x.width)&&void 0!==d?d:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},input:{minHeight:"100%"}}},{children:r.jsx(s.DropdownPopover,Object.assign({ref:w,onSelect:function(e){Array.isArray(e)?O([...e]):O([e]),null==h||h(e)},disabled:f},x,{children:r.jsx(i.Input,{noErrorHint:g,state:f?"disabled":"none",value:null!=q?q:"",errorMessage:x.error,variant:b,placeholder:null!=p?p:"Select an option",width:null!==(c=x.width)&&void 0!==c?c:"100%",onChangeText:a,rightIcon:{icon:()=>{var e;return r.jsx(o.default,{style:{transform:(null===(e=null==w?void 0:w.current)||void 0===e?void 0:e.openDropdown)?"rotate(180deg)":"rotate(0deg)"},onClick:a,width:"small"===b?20:24,height:"small"===b?20:24,color:n.COLORS.content.primary})}}})}))}))};u.displayName="Dropdown",exports.Dropdown=u;
@@ -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:x,isMultiSelect:O,width:b,allowFreeForm:g,height:m,onClose:v,onSelect:q}=j;const[y,M]=t.useState(null!=S?S:[]),[w,F]=t.useState(null!=b?b:h),[D,A]=t.useState(""),[B,C]=t.useState(null),Z=t.useRef(null);n.useOutside(Z,(()=>{C(null),null==v||v()}));const L=null!=m?m:f,E="number"==typeof L?x&&O?L-96:x&&!O||!x&&O?L-48:L:L;function H(e){if(O){const t=i.iterateOnOptions(y,{selected:e.selected},(t=>t.value===e.value));M([...t])}else null==q||q(e)}t.useEffect((()=>{const e=null!=b?b:h;if(null===B)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)}}),[B]);const W=y.map((e=>{var t;if(D){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.includes(D))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.includes(D))?e:null}return e})).filter((e=>null!==e)),_=!!x&&D&&0===W.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({ref:Z,style:{maxWidth:B?800:400,width:w}},{children:[e.jsxs("div",Object.assign({style:{width:B?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:function(e){A(e)}}),W.length||D?e.jsxs(a.MenuListContainer,Object.assign({minHeight:L,maxHeight:E},{children:[!!O&&!_&&e.jsx(u.SelectAllMenu,{options:y,onSelect:function(e){if("selectAll"===e){const e=i.iterateOnOptions(y,{selected:!0},(e=>!e.disabled));M([...e])}else if("notSelected"===e){const e=i.iterateOnOptions(y,{selected:!1},(e=>!e.disabled));M([...e])}}}),!g&&_&&e.jsx(p.SearchZeroState,{searchedString:D}),g&&_&&e.jsx(o.FreeFormMenu,{isMultiSelect:O,onSelect:function(e){if(!O)return void H({label:D,value:D,isFreeForm:!0,selected:!0});const t=y.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===D&&t.value===D?e:t.selected})));e&&(t.some((e=>e.label===D&&e.value===D))||t.unshift({label:D,value:D,isFreeForm:!0,selected:!0})),M([...t])},searchedString:D}),e.jsx(r.MenuList,{onSelect:H,showDescription:function(e,t){C(e&&t?{title:e,description:t}:null)},isMultiSelect:O,options:W})]})):e.jsx("div",Object.assign({style:{height:L,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!O&&e.jsx(c.default,{onClear:function(){const e=i.iterateOnOptions(y,{selected:!1});M([...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==q||q([...e])},list:y})]})),!!B&&e.jsx(l.Description,{title:B.title,description:B.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 h=304,f=290;exports.OpenedDropdown=j=>{let{options:S,isSearchable:x,isMultiSelect:O,width:b,allowFreeForm:g,height:m,onClose:v,onSelect:q}=j;const[y,M]=t.useState(null!=S?S:[]),[w,F]=t.useState(null!=b?b:f),[D,A]=t.useState(""),[B,C]=t.useState(null),Z=t.useRef(null);n.useOutside(Z,(()=>{C(null),null==v||v()}));const L=null!=m?m:h,E="number"==typeof L?x&&O?L-96:x&&!O||!x&&O?L-48:L:L;function H(e){if(O){const t=i.iterateOnOptions(y,{selected:e.selected},(t=>t.value===e.value));M([...t])}else null==q||q(e)}t.useEffect((()=>{const e=null!=b?b:f;if(null===B)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)}}),[B]);const W=y.map((e=>{var t;if(D){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.includes(D))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.includes(D))?e:null}return e})).filter((e=>null!==e)),_=!!x&&D&&0===W.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({ref:Z,style:{maxWidth:B?800:400,width:w}},{children:[e.jsxs("div",Object.assign({style:{width:B?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:function(e){A(e)}}),W.length||D?e.jsxs(a.MenuListContainer,Object.assign({minHeight:L,maxHeight:E},{children:[!!O&&!_&&e.jsx(u.SelectAllMenu,{options:y,onSelect:function(e){if("selectAll"===e){const e=i.iterateOnOptions(y,{selected:!0},(e=>!e.disabled));M([...e])}else if("notSelected"===e){const e=i.iterateOnOptions(y,{selected:!1},(e=>!e.disabled));M([...e])}}}),!g&&_&&e.jsx(p.SearchZeroState,{searchedString:D}),g&&_&&e.jsx(o.FreeFormMenu,{isMultiSelect:O,onSelect:function(e){if(!O)return void H({label:D,value:D,isFreeForm:!0,selected:!0});const t=y.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===D&&t.value===D?e:t.selected})));e&&(t.some((e=>e.label===D&&e.value===D))||t.unshift({label:D,value:D,isFreeForm:!0,selected:!0})),M([...t])},searchedString:D}),e.jsx(r.MenuList,{onSelect:H,showDescription:function(e,t){C(e&&t?{title:e,description:t}:null)},isMultiSelect:O,options:W})]})):e.jsx("div",Object.assign({style:{height:L,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!O&&!(!W.length&&!D)&&e.jsx(c.default,{onClear:function(){const e=i.iterateOnOptions(y,{selected:!1});M([...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==q||q([...e])},list:y})]})),!!B&&e.jsx(l.Description,{title:B.title,description:B.description})]}))};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const WorkingStepper: () => JSX.Element;
2
3
  export declare enum STEPENUM {
3
4
  STEP1 = "STEP1",
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import o from"../../DropdownWrapper.js";const n=n=>{let{onChange:i,extra:r,val:t,isLoading:s,errors:d,disabled:c}=n;const[u,m]=l([]),p=t;return a((()=>{const e=[...(null==r?void 0:r.options)&&Array.isArray(r.options)?r.options.filter((e=>!!Object.keys(e).length)).map((e=>({selected:!!(null==p?void 0:p.find((l=>l.name===e.name||l.id===e.id))),label:e.name,value:e.id}))):[]].concat((null!=p?p:[]).map((e=>({value:e.id,label:e.name}))));null==p||p.forEach((l=>{let{name:a,id:o}=l;const n=e.findIndex((e=>e.value===o&&e.label===a));-1!==n&&(e[n].selected=!0)})),m([...e])}),[r,p]),e("div",{children:e(o,{disabled:c,allowFreeForm:!0,isSearchable:!0,isLoading:s,error:null==d?void 0:d.val,isMultiSelect:!0,options:u,onSelect:function(e){if(Array.isArray(e)){const l=[];e.forEach((e=>{var a,o;e.options?null===(a=e.options)||void 0===a||a.forEach((e=>{l.push({name:e.label,id:e.value})})):l.push({name:null!==(o=e.label)&&void 0!==o?o:"",id:e.value})})),null==i||i(l)}}})})};var i=l=>e(n,Object.assign({},l));export{i as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import i from"../../DropdownWrapper.js";const n=n=>{let{onChange:o,extra:r,val:t,isLoading:d,errors:s,disabled:u}=n;const[c,v]=l([]),m=t;return a((()=>{var e;const l=(null==r?void 0:r.options)&&Array.isArray(r.options)?r.options.filter((e=>!!Object.keys(e).length)).map((e=>({selected:!!(null==m?void 0:m.find((l=>l.name===e.name||l.id===e.id))),label:e.name,value:e.id}))):[],a=null!==(e=null==m?void 0:m.map((e=>e.id)))&&void 0!==e?e:[],i=[...l.filter((e=>!a.includes(e.value)))].concat((null!=m?m:[]).map((e=>({value:e.id,label:e.name}))));null==m||m.forEach((e=>{let{name:l,id:a}=e;const n=i.findIndex((e=>e.value===a&&e.label===l));-1!==n&&(i[n].selected=!0)})),v([...i])}),[r,m]),e("div",{children:e(i,{disabled:u,allowFreeForm:!0,isSearchable:!0,isLoading:d,error:null==s?void 0:s.val,isMultiSelect:!0,options:c,onSelect:function(e){if(Array.isArray(e)){const l=[];e.forEach((e=>{var a,i;e.options?null===(a=e.options)||void 0===a||a.forEach((e=>{l.push({name:e.label,id:e.value})})):l.push({name:null!==(i=e.label)&&void 0!==i?i:"",id:e.value})})),null==o||o(l)}}})})};var o=l=>e(n,Object.assign({},l));export{o as default};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{Dropdown as r}from"../../dropdown/Dropdown.js";import o from"./InputLoader.js";const i=i=>{let{options:t,onSelect:l,defaultOption:a,isSearchable:d,isLoading:s,error:n,nativeID:p,dropdownLabel:c,isMultiSelect:m,allowFreeForm:u,width:h,disabled:w}=i;return s?e(o,{}):e("div",Object.assign({style:{maxWidth:200,width:200},id:p},{children:e(r,{height:208,disabled:w,allowFreeForm:null!=u&&u,isMultiSelect:m,width:h,size:"small",placeHolder:c,error:n,isSearchable:null!=d&&d,defaultOptions:a?Array.isArray(a)?a:[a]:void 0,options:t,onSelect:l})}))};export{i as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{Dropdown as o}from"../../dropdown/Dropdown.js";import i from"./InputLoader.js";const r=r=>{let{options:l,onSelect:t,defaultOption:d,isSearchable:a,isLoading:n,error:s,nativeID:p,dropdownLabel:c,isMultiSelect:m,allowFreeForm:u,width:h,disabled:w}=r;return n?e(i,{}):e("div",Object.assign({style:{maxWidth:200,width:200},id:p},{children:e(o,{height:(null==l?void 0:l.length)?void 0:208,disabled:w,allowFreeForm:null!=u&&u,isMultiSelect:m,width:h,size:"small",placeHolder:c,error:s,isSearchable:null!=a&&a,defaultOptions:d?Array.isArray(d)?d:[d]:void 0,options:l,onSelect:t})}))};export{r as default};
@@ -1 +1 @@
1
- import{__rest as o}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{useRef as t,useState as r,useEffect as n}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";function p(){}const c=c=>{var u,m,{placeHolder:h,size:v,onSelect:f,defaultOptions:g,disabled:b,noErrorHint:j}=c,w=o(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint"]);const x=null!=v?v:"default",y=t(),[H,O]=r(null!=g?g:[]);n((()=>{var o;const e=[];null===(o=null==w?void 0:w.options)||void 0===o||o.forEach((o=>{o.options?o.options.forEach((o=>{o.selected&&e.push(Object.assign(Object.assign({},o),{label:o.label}))})):o.selected&&e.push(o)})),O([...e])}),[w.options]),n((()=>{g&&O([...g])}),[g]);const E=H.length?H.map((o=>o.label)).join(", "):void 0;return e(a.Provider,Object.assign({value:{InputWrapper:{height:"small"===x?32:48,width:null!==(u=w.width)&&void 0!==u?u:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},input:{minHeight:"100%"}}},{children:e(d,Object.assign({ref:y,onSelect:function(o){Array.isArray(o)?O([...o]):O([o]),null==f||f(o)},disabled:b},w,{children:e(s,{noErrorHint:j,state:b?"disabled":"none",value:E,errorMessage:w.error,variant:x,placeholder:null!=h?h:"Select an option",width:null!==(m=w.width)&&void 0!==m?m:"100%",onChangeText:p,rightIcon:{icon:()=>{var o;return e(l,{style:{transform:(null===(o=null==y?void 0:y.current)||void 0===o?void 0:o.openDropdown)?"rotate(180deg)":"rotate(0deg)"},onClick:p,width:"small"===x?20:24,height:"small"===x?20:24,color:i.content.primary})}}})}))}))};c.displayName="Dropdown";export{c as Dropdown};
1
+ import{__rest as o}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{useRef as t,useState as n,useEffect as r}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";function p(){}const c=c=>{var u,m,{placeHolder:h,size:v,onSelect:f,defaultOptions:g,disabled:b,noErrorHint:j}=c,w=o(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint"]);const x=null!=v?v:"default",y=t(),[H,O]=n(null!=g?g:[]);r((()=>{var o;const e=[];null===(o=null==w?void 0:w.options)||void 0===o||o.forEach((o=>{o.options?o.options.forEach((o=>{o.selected&&e.push(Object.assign(Object.assign({},o),{label:o.label}))})):o.selected&&e.push(o)})),O([...e])}),[w.options]),r((()=>{g&&O([...g])}),[g]);const E=H.length?H.map((o=>o.label)).join(", "):void 0;return e(a.Provider,Object.assign({value:{InputWrapper:{height:"small"===x?32:48,width:null!==(u=w.width)&&void 0!==u?u:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},input:{minHeight:"100%"}}},{children:e(d,Object.assign({ref:y,onSelect:function(o){Array.isArray(o)?O([...o]):O([o]),null==f||f(o)},disabled:b},w,{children:e(s,{noErrorHint:j,state:b?"disabled":"none",value:null!=E?E:"",errorMessage:w.error,variant:x,placeholder:null!=h?h:"Select an option",width:null!==(m=w.width)&&void 0!==m?m:"100%",onChangeText:p,rightIcon:{icon:()=>{var o;return e(l,{style:{transform:(null===(o=null==y?void 0:y.current)||void 0===o?void 0:o.openDropdown)?"rotate(180deg)":"rotate(0deg)"},onClick:p,width:"small"===x?20:24,height:"small"===x?20:24,color:i.content.primary})}}})}))}))};c.displayName="Dropdown";export{c as Dropdown};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as l,useEffect as i}from"react";import{ZeroState as n}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 j=304,S=290,g=g=>{let{options:v,isSearchable:O,isMultiSelect:x,width:y,allowFreeForm:w,height:F,onClose:M,onSelect:D}=g;const[A,B]=o(null!=v?v:[]),[C,H]=o(null!=y?y:S),[W,Z]=o(""),[k,z]=o(null),E=l(null);s(E,(()=>{z(null),null==M||M()}));const I=null!=F?F:j,L="number"==typeof I?O&&x?I-96:O&&!x||!O&&x?I-48:I:I;function N(e){if(x){const t=r(A,{selected:e.selected},(t=>t.value===e.value));B([...t])}else null==D||D(e)}i((()=>{const e=null!=y?y:S;if(null===k)H(e);else if("number"==typeof e)H(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));H(t)}}),[k]);const T=A.map((e=>{var t;if(W){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.includes(W))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.includes(W))?e:null}return e})).filter((e=>null!==e)),q=!!O&&W&&0===T.length;return e(m,Object.assign({ref:E,style:{maxWidth:k?800:400,width:C}},{children:[e("div",Object.assign({style:{width:k?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!O&&t(h,{onSearch:function(e){Z(e)}}),T.length||W?e(f,Object.assign({minHeight:I,maxHeight:L},{children:[!!x&&!q&&t(p,{options:A,onSelect:function(e){if("selectAll"===e){const e=r(A,{selected:!0},(e=>!e.disabled));B([...e])}else if("notSelected"===e){const e=r(A,{selected:!1},(e=>!e.disabled));B([...e])}}}),!w&&q&&t(b,{searchedString:W}),w&&q&&t(u,{isMultiSelect:x,onSelect:function(e){if(!x)return void N({label:W,value:W,isFreeForm:!0,selected:!0});const t=A.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===W&&t.value===W?e:t.selected})));e&&(t.some((e=>e.label===W&&e.value===W))||t.unshift({label:W,value:W,isFreeForm:!0,selected:!0})),B([...t])},searchedString:W}),t(a,{onSelect:N,showDescription:function(e,t){z(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:T})]})):t("div",Object.assign({style:{height:I,display:"flex"}},{children:t(n,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!x&&t(d,{onClear:function(){const e=r(A,{selected:!1});B([...e])},onApply:function(){const e=[];A.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==D||D([...e])},list:A})]})),!!k&&t(c,{title:k.title,description:k.description})]}))};export{g as OpenedDropdown};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useRef as o,useEffect 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 j=304,g=290,S=S=>{let{options:v,isSearchable:O,isMultiSelect:x,width:y,allowFreeForm:w,height:F,onClose:M,onSelect:D}=S;const[A,B]=l(null!=v?v:[]),[C,H]=l(null!=y?y:g),[W,Z]=l(""),[k,z]=l(null),E=o(null);s(E,(()=>{z(null),null==M||M()}));const I=null!=F?F:j,L="number"==typeof I?O&&x?I-96:O&&!x||!O&&x?I-48:I:I;function N(e){if(x){const t=r(A,{selected:e.selected},(t=>t.value===e.value));B([...t])}else null==D||D(e)}n((()=>{const e=null!=y?y:g;if(null===k)H(e);else if("number"==typeof e)H(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));H(t)}}),[k]);const T=A.map((e=>{var t;if(W){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.includes(W))})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.includes(W))?e:null}return e})).filter((e=>null!==e)),q=!!O&&W&&0===T.length;return e(m,Object.assign({ref:E,style:{maxWidth:k?800:400,width:C}},{children:[e("div",Object.assign({style:{width:k?"50%":"100%",display:"flex",flexDirection:"column"}},{children:[!!O&&t(h,{onSearch:function(e){Z(e)}}),T.length||W?e(f,Object.assign({minHeight:I,maxHeight:L},{children:[!!x&&!q&&t(p,{options:A,onSelect:function(e){if("selectAll"===e){const e=r(A,{selected:!0},(e=>!e.disabled));B([...e])}else if("notSelected"===e){const e=r(A,{selected:!1},(e=>!e.disabled));B([...e])}}}),!w&&q&&t(b,{searchedString:W}),w&&q&&t(u,{isMultiSelect:x,onSelect:function(e){if(!x)return void N({label:W,value:W,isFreeForm:!0,selected:!0});const t=A.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===W&&t.value===W?e:t.selected})));e&&(t.some((e=>e.label===W&&e.value===W))||t.unshift({label:W,value:W,isFreeForm:!0,selected:!0})),B([...t])},searchedString:W}),t(a,{onSelect:N,showDescription:function(e,t){z(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:T})]})):t("div",Object.assign({style:{height:I,display:"flex"}},{children:t(i,{title:"No options passed",subTitle:"Sorry we could not find any options to show"})})),!!x&&!(!T.length&&!W)&&t(d,{onClear:function(){const e=r(A,{selected:!1});B([...e])},onApply:function(){const e=[];A.forEach((t=>{if(t.options){const l=t.options.filter((e=>!0===e.selected));e.push(Object.assign(Object.assign({},t),{options:[...l]}))}else t.selected&&e.push(Object.assign({},t))})),null==D||D([...e])},list:A})]})),!!k&&t(c,{title:k.title,description:k.description})]}))};export{S as OpenedDropdown};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const WorkingStepper: () => JSX.Element;
2
3
  export declare enum STEPENUM {
3
4
  STEP1 = "STEP1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.30-beta.1",
3
+ "version": "0.0.30-beta.2",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",