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