@bikdotai/bik-component-library 0.0.774-beta.12 → 0.0.774-beta.6

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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/chevronDown.svg.js"),l=require("../input/Input.js"),r=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function c(){}const u=u=>{var p,h,v,x,f,{placeHolder:g,size:j,onSelect:w,defaultOptions:b,disabled:O,noErrorHint:m,placeHolderHeight:S,showPlaceholderWhenSelected:y=!1,inputStyle:I={},inputType:E="default",onDeleteChip:H,truncatedText:C,showLeadingIconInPlaceholder:D=!1,showTrailingIconPlaceholder:P=!1,showLabelsOnMoreHover:T=!1,value:q,resizeable:L=!1}=u,M=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[W,z]=n.useState(!1),[_,k]=n.useState(!1),A=null!=j?j:"default",R=n.useRef(null),[F,N]=n.useState(0),U=n.useRef(),[V,$]=n.useState(null!=b?b:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==M?void 0:M.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),$([...t])}),[M.options]),n.useEffect((()=>{b&&$([...b])}),[b]);const B=d.getSelectedOptionsAsText(V),G=y?g:null!==(p=null!=B?B:g)&&void 0!==p?p:"Select an option";n.useLayoutEffect((()=>{L&&R.current&&N(R.current.offsetWidth)}),[L,G,A]);const J=M.buttonWidth,K=L?F+("x-small"===A?16:"small"===A?20:24)+("default"===A?8:0)+16+8+4:void 0,Q=void 0!==K?`${K}px`:null!==(h=null!=J?J:M.width)&&void 0!==h?h:"100%",X=null!==(v=M.dropdownWidth)&&void 0!==v?v:Q;return t.jsxs(t.Fragment,{children:[t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:S||("x-small"===A?24:"small"===A?32:48),width:Q},J?{maxWidth:J}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===A?"4px 8px":"6px 8px",backgroundColor:void 0!==q?"#C3E4C4":_?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),I),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==q?"#00580E":"inherit"}}},{children:t.jsx("div",Object.assign({onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),style:M.width?{width:M.width}:void 0},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":M["data-test"],ref:U,onSelect:function(e){Array.isArray(e)?$([...e]):$([e]),null==w||w(e)},disabled:O,onDropdownVisbilityChange:e=>z(e)},M,{width:X},{children:["default"==E&&t.jsx(l.Input,{version:M.version,noErrorHint:m,state:O?"disabled":"none",value:void 0===q?G:q,errorMessage:M.error,variant:A,placeholder:null!=g?g:"Select an option",onChangeText:c,leftIcon:D&&(null===(x=V[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=V[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[P&&(null===(e=V[0])||void 0===e?void 0:e.trailingIcon),t.jsx(i.default,{style:{transform:W?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"x-small"===A?16:"small"===A?20:24,height:"x-small"===A?16:"small"===A?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==C||C}),"chip"==E&&t.jsx(s.default,{placeholder:null!=g?g:"Select options",chips:V,onDeleteChip:e=>{null==H||H(e)},errorMessage:M.error,isDropdownOpened:W,sizeToUse:A,containerStyle:{width:null!==(f=M.width)&&void 0!==f?f:"100%",cursor:"pointer"},showLabelsOnMoreHover:T})]}))}))})),L&&t.jsx("span",Object.assign({ref:R,"aria-hidden":!0,style:{position:"fixed",top:"-9999px",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===A?"12px":"small"===A?"14px":"16px"}},{children:G}))]})};u.displayName="Dropdown",exports.Dropdown=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/chevronDown.svg.js"),l=require("../input/Input.js"),r=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function c(){}const u=u=>{var p,h,v,x,g,f,{placeHolder:j,size:w,onSelect:b,defaultOptions:O,disabled:m,noErrorHint:S,placeHolderHeight:y,showPlaceholderWhenSelected:I=!1,inputStyle:E={},inputType:H="default",onDeleteChip:C,truncatedText:D,showLeadingIconInPlaceholder:P=!1,showTrailingIconPlaceholder:T=!1,showLabelsOnMoreHover:q=!1,value:L,resizeable:M=!1}=u,W=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[z,_]=n.useState(!1),[k,A]=n.useState(!1),R=null!=w?w:"default",F=n.useRef(null),[N,U]=n.useState(0),V=n.useRef(),[$,B]=n.useState(null!=O?O:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==W?void 0:W.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),B([...t])}),[W.options]),n.useEffect((()=>{O&&B([...O])}),[O]);const G=d.getSelectedOptionsAsText($),J=I?j:null!==(p=null!=G?G:j)&&void 0!==p?p:"Select an option";n.useLayoutEffect((()=>{M&&F.current&&U(F.current.offsetWidth)}),[M,J,R]);const K=W.buttonWidth,Q=M?N+("x-small"===R?16:"small"===R?20:24)+("default"===R?8:0)+16+8+4:void 0,X=void 0!==Q?`${Q}px`:null!==(v=null!==(h=W.width)&&void 0!==h?h:K)&&void 0!==v?v:"100%",Y=null!==(x=W.dropdownWidth)&&void 0!==x?x:X;return t.jsxs(t.Fragment,{children:[t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:y||("x-small"===R?24:"small"===R?32:48),width:X},K?{maxWidth:K}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===R?"4px 8px":"6px 8px",backgroundColor:void 0!==L?"#C3E4C4":k?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),E),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==L?"#00580E":"inherit"}}},{children:t.jsx("div",Object.assign({onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),style:W.width?{width:W.width}:void 0},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":W["data-test"],ref:V,onSelect:function(e){Array.isArray(e)?B([...e]):B([e]),null==b||b(e)},disabled:m,onDropdownVisbilityChange:e=>_(e)},W,{width:Y},{children:["default"==H&&t.jsx(l.Input,{version:W.version,noErrorHint:S,state:m?"disabled":"none",value:void 0===L?J:L,errorMessage:W.error,variant:R,placeholder:null!=j?j:"Select an option",onChangeText:c,leftIcon:P&&(null===(g=$[0])||void 0===g?void 0:g.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=$[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[T&&(null===(e=$[0])||void 0===e?void 0:e.trailingIcon),t.jsx(i.default,{style:{transform:z?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"x-small"===R?16:"small"===R?20:24,height:"x-small"===R?16:"small"===R?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==D||D}),"chip"==H&&t.jsx(s.default,{placeholder:null!=j?j:"Select options",chips:$,onDeleteChip:e=>{null==C||C(e)},errorMessage:W.error,isDropdownOpened:z,sizeToUse:R,containerStyle:{width:null!==(f=W.width)&&void 0!==f?f:"100%",cursor:"pointer"},showLabelsOnMoreHover:q})]}))}))})),M&&t.jsx("span",Object.assign({ref:F,"aria-hidden":!0,style:{visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===R?"12px":"small"===R?"14px":"16px"}},{children:J}))]})};u.displayName="Dropdown",exports.Dropdown=u;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- import{__rest as e}from"../../_virtual/_tslib.js";import{jsxs as o,Fragment as n,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r,useLayoutEffect as s}from"react";import{COLORS as a}from"../../constants/Theme.js";import d from"../../assets/icons/chevronDown.svg.js";import{Input as c}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import h from"./ChipInput.js";import{DropdownPopover as u}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as v}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const f=f=>{var g,x,b,w,j,{placeHolder:O,size:y,onSelect:I,defaultOptions:S,disabled:H,noErrorHint:E,placeHolderHeight:C,showPlaceholderWhenSelected:T=!1,inputStyle:D={},inputType:P="default",onDeleteChip:W,truncatedText:z,showLeadingIconInPlaceholder:M=!1,showTrailingIconPlaceholder:L=!1,showLabelsOnMoreHover:k=!1,value:A,resizeable:_=!1}=f,N=e(f,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[U,V]=i(!1),[$,q]=i(!1),B=null!=y?y:"default",F=l(null),[G,J]=i(0),K=l(),[Q,R]=i(null!=S?S:[]);r((()=>{var e;const o=[];null===(e=null==N?void 0:N.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),R([...o])}),[N.options]),r((()=>{S&&R([...S])}),[S]);const X=v(Q),Y=T?O:null!==(g=null!=X?X:O)&&void 0!==g?g:"Select an option";s((()=>{_&&F.current&&J(F.current.offsetWidth)}),[_,Y,B]);const Z=N.buttonWidth,ee=_?G+("x-small"===B?16:"small"===B?20:24)+("default"===B?8:0)+16+8+4:void 0,oe=void 0!==ee?`${ee}px`:null!==(x=null!=Z?Z:N.width)&&void 0!==x?x:"100%",ne=null!==(b=N.dropdownWidth)&&void 0!==b?b:oe;return o(n,{children:[t(p.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:C||("x-small"===B?24:"small"===B?32:48),width:oe},Z?{maxWidth:Z}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===B?"4px 8px":"6px 8px",backgroundColor:void 0!==A?"#C3E4C4":$?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),D),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==A?"#00580E":"inherit"}}},{children:t("div",Object.assign({onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),style:N.width?{width:N.width}:void 0},{children:o(u,Object.assign({"data-test":N["data-test"],ref:K,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==I||I(e)},disabled:H,onDropdownVisbilityChange:e=>V(e)},N,{width:ne},{children:["default"==P&&t(c,{version:N.version,noErrorHint:E,state:H?"disabled":"none",value:void 0===A?Y:A,errorMessage:N.error,variant:B,placeholder:null!=O?O:"Select an option",onChangeText:m,leftIcon:M&&(null===(w=Q[0])||void 0===w?void 0:w.leadingIcon)?{icon:()=>{var e;return t(n,{children:null===(e=Q[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return o("div",Object.assign({style:{display:"flex"}},{children:[L&&(null===(e=Q[0])||void 0===e?void 0:e.trailingIcon),t(d,{style:{transform:U?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===B?16:"small"===B?20:24,height:"x-small"===B?16:"small"===B?20:24,color:a.content.primary})]}))}},truncateText:null==z||z}),"chip"==P&&t(h,{placeholder:null!=O?O:"Select options",chips:Q,onDeleteChip:e=>{null==W||W(e)},errorMessage:N.error,isDropdownOpened:U,sizeToUse:B,containerStyle:{width:null!==(j=N.width)&&void 0!==j?j:"100%",cursor:"pointer"},showLabelsOnMoreHover:k})]}))}))})),_&&t("span",Object.assign({ref:F,"aria-hidden":!0,style:{position:"fixed",top:"-9999px",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===B?"12px":"small"===B?"14px":"16px"}},{children:Y}))]})};f.displayName="Dropdown";export{f as Dropdown};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsxs as o,Fragment as n,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r,useLayoutEffect as s}from"react";import{COLORS as a}from"../../constants/Theme.js";import d from"../../assets/icons/chevronDown.svg.js";import{Input as c}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import h from"./ChipInput.js";import{DropdownPopover as u}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as v}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const f=f=>{var g,b,w,x,j,O,{placeHolder:y,size:I,onSelect:S,defaultOptions:H,disabled:E,noErrorHint:C,placeHolderHeight:T,showPlaceholderWhenSelected:D=!1,inputStyle:P={},inputType:W="default",onDeleteChip:z,truncatedText:M,showLeadingIconInPlaceholder:L=!1,showTrailingIconPlaceholder:k=!1,showLabelsOnMoreHover:A=!1,value:_,resizeable:N=!1}=f,U=e(f,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[V,$]=i(!1),[q,B]=i(!1),F=null!=I?I:"default",G=l(null),[J,K]=i(0),Q=l(),[R,X]=i(null!=H?H:[]);r((()=>{var e;const o=[];null===(e=null==U?void 0:U.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),X([...o])}),[U.options]),r((()=>{H&&X([...H])}),[H]);const Y=v(R),Z=D?y:null!==(g=null!=Y?Y:y)&&void 0!==g?g:"Select an option";s((()=>{N&&G.current&&K(G.current.offsetWidth)}),[N,Z,F]);const ee=U.buttonWidth,oe=N?J+("x-small"===F?16:"small"===F?20:24)+("default"===F?8:0)+16+8+4:void 0,ne=void 0!==oe?`${oe}px`:null!==(w=null!==(b=U.width)&&void 0!==b?b:ee)&&void 0!==w?w:"100%",te=null!==(x=U.dropdownWidth)&&void 0!==x?x:ne;return o(n,{children:[t(p.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:T||("x-small"===F?24:"small"===F?32:48),width:ne},ee?{maxWidth:ee}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===F?"4px 8px":"6px 8px",backgroundColor:void 0!==_?"#C3E4C4":q?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),P),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==_?"#00580E":"inherit"}}},{children:t("div",Object.assign({onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),style:U.width?{width:U.width}:void 0},{children:o(u,Object.assign({"data-test":U["data-test"],ref:Q,onSelect:function(e){Array.isArray(e)?X([...e]):X([e]),null==S||S(e)},disabled:E,onDropdownVisbilityChange:e=>$(e)},U,{width:te},{children:["default"==W&&t(c,{version:U.version,noErrorHint:C,state:E?"disabled":"none",value:void 0===_?Z:_,errorMessage:U.error,variant:F,placeholder:null!=y?y:"Select an option",onChangeText:m,leftIcon:L&&(null===(j=R[0])||void 0===j?void 0:j.leadingIcon)?{icon:()=>{var e;return t(n,{children:null===(e=R[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return o("div",Object.assign({style:{display:"flex"}},{children:[k&&(null===(e=R[0])||void 0===e?void 0:e.trailingIcon),t(d,{style:{transform:V?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===F?16:"small"===F?20:24,height:"x-small"===F?16:"small"===F?20:24,color:a.content.primary})]}))}},truncateText:null==M||M}),"chip"==W&&t(h,{placeholder:null!=y?y:"Select options",chips:R,onDeleteChip:e=>{null==z||z(e)},errorMessage:U.error,isDropdownOpened:V,sizeToUse:F,containerStyle:{width:null!==(O=U.width)&&void 0!==O?O:"100%",cursor:"pointer"},showLabelsOnMoreHover:A})]}))}))})),N&&t("span",Object.assign({ref:G,"aria-hidden":!0,style:{visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===F?"12px":"small"===F?"14px":"16px"}},{children:Z}))]})};f.displayName="Dropdown";export{f as Dropdown};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.774-beta.12",
3
+ "version": "0.0.774-beta.6",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",