@bikdotai/bik-component-library 0.0.770-beta.3 → 0.0.770-beta.4

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.
@@ -18,7 +18,5 @@ export type DropdownProps = OpenDropdownProps & {
18
18
  showLabelsOnMoreHover?: boolean;
19
19
  backgroundColor?: string;
20
20
  value?: string;
21
- /** When true, resizes the input box to fit the selected text. Defaults to false for backward compatibility. */
22
- autoResize?: boolean;
23
21
  };
24
22
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -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 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
+ "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"),r=require("../../assets/icons/chevronDown.svg.js"),l=require("../input/Input.js"),i=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,g,{placeHolder:f,size:x,onSelect:j,defaultOptions:b,disabled:w,noErrorHint:O,placeHolderHeight:S,showPlaceholderWhenSelected:I=!1,inputStyle:m={},inputType:y="default",onDeleteChip:E,truncatedText:H,showLeadingIconInPlaceholder:C=!1,showTrailingIconPlaceholder:D=!1,showLabelsOnMoreHover:P=!1,value:T}=c,q=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[M,L]=n.useState(!1),[W,_]=n.useState(!1),z=null!=x?x:"default",k=n.useRef(),[A,R]=n.useState(null!=b?b:[]),F=n.useRef(null),[N,U]=n.useState(void 0);n.useEffect((()=>{var e;const t=[];null===(e=null==q?void 0:q.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)})),R([...t])}),[q.options]),n.useEffect((()=>{b&&R([...b])}),[b]);const V=d.getSelectedOptionsAsText(A),$=I?f:null!==(p=null!=V?V:f)&&void 0!==p?p:"Select an option",B=null!==(h=q.buttonWidth)&&void 0!==h?h:q.width;n.useEffect((()=>{B||F.current&&U(`${F.current.offsetWidth}px`)}),[B]);const G=null!=B?B:"100%",J=null!=B?B:N;return t.jsx(t.Fragment,{children:t.jsx(i.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:S||("x-small"===z?24:"small"===z?32:48),width:G},B?{maxWidth:B}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===z?"4px 8px":"6px 8px",backgroundColor:void 0!==T?"#C3E4C4":W?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),m),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==T?"#00580E":"inherit"}}},{children:t.jsx("div",Object.assign({ref:F,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":q["data-test"],ref:k,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==j||j(e)},disabled:w,onDropdownVisbilityChange:e=>L(e)},q,{width:J},{children:["default"==y&&t.jsx(l.Input,{version:q.version,noErrorHint:O,state:w?"disabled":"none",value:void 0===T?$:T,errorMessage:q.error,variant:z,placeholder:null!=f?f:"Select an option",onChangeText:u,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(r.default,{style:{transform:M?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"x-small"===z?16:"small"===z?20:24,height:"x-small"===z?16:"small"===z?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==H||H}),"chip"==y&&t.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:A,onDeleteChip:e=>{null==E||E(e)},errorMessage:q.error,isDropdownOpened:M,sizeToUse:z,containerStyle:{width:null!==(g=q.width)&&void 0!==g?g:"100%",cursor:"pointer"},showLabelsOnMoreHover:P})]}))}))}))})};c.displayName="Dropdown",exports.Dropdown=c;
@@ -18,7 +18,5 @@ export type DropdownProps = OpenDropdownProps & {
18
18
  showLabelsOnMoreHover?: boolean;
19
19
  backgroundColor?: string;
20
20
  value?: string;
21
- /** When true, resizes the input box to fit the selected text. Defaults to false for backward compatibility. */
22
- autoResize?: boolean;
23
21
  };
24
22
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -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,{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};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,Fragment as n,jsxs as t}from"react/jsx-runtime";import{useState as l,useRef as r,useEffect as i}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 v(){}const m=m=>{var f,g,b,w,{placeHolder:x,size:j,onSelect:O,defaultOptions:I,disabled:y,noErrorHint:H,placeHolderHeight:S,showPlaceholderWhenSelected:E=!1,inputStyle:C={},inputType:T="default",onDeleteChip:D,truncatedText:P,showLeadingIconInPlaceholder:M=!1,showTrailingIconPlaceholder:W=!1,showLabelsOnMoreHover:L=!1,value:z}=m,k=e(m,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[A,_]=l(!1),[N,U]=l(!1),V=null!=j?j:"default",$=r(),[q,B]=l(null!=I?I:[]),F=r(null),[G,J]=l(void 0);i((()=>{var e;const o=[];null===(e=null==k?void 0:k.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])}),[k.options]),i((()=>{I&&B([...I])}),[I]);const K=h(q),Q=E?x:null!==(f=null!=K?K:x)&&void 0!==f?f:"Select an option",R=null!==(g=k.buttonWidth)&&void 0!==g?g:k.width;i((()=>{R||F.current&&J(`${F.current.offsetWidth}px`)}),[R]);const X=null!=R?R:"100%",Y=null!=R?R:G;return o(n,{children:o(c.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:S||("x-small"===V?24:"small"===V?32:48),width:X},R?{maxWidth:R}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===V?"4px 8px":"6px 8px",backgroundColor:void 0!==z?"#C3E4C4":N?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),C),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==z?"#00580E":"inherit"}}},{children:o("div",Object.assign({ref:F,onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1)},{children:t(u,Object.assign({"data-test":k["data-test"],ref:$,onSelect:function(e){Array.isArray(e)?B([...e]):B([e]),null==O||O(e)},disabled:y,onDropdownVisbilityChange:e=>_(e)},k,{width:Y},{children:["default"==T&&o(d,{version:k.version,noErrorHint:H,state:y?"disabled":"none",value:void 0===z?Q:z,errorMessage:k.error,variant:V,placeholder:null!=x?x:"Select an option",onChangeText:v,leftIcon:M&&(null===(b=q[0])||void 0===b?void 0:b.leadingIcon)?{icon:()=>{var e;return o(n,{children:null===(e=q[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t("div",Object.assign({style:{display:"flex"}},{children:[W&&(null===(e=q[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:A?"rotate(180deg)":"rotate(0deg)"},onClick:v,width:"x-small"===V?16:"small"===V?20:24,height:"x-small"===V?16:"small"===V?20:24,color:s.content.primary})]}))}},truncateText:null==P||P}),"chip"==T&&o(p,{placeholder:null!=x?x:"Select options",chips:q,onDeleteChip:e=>{null==D||D(e)},errorMessage:k.error,isDropdownOpened:A,sizeToUse:V,containerStyle:{width:null!==(w=k.width)&&void 0!==w?w:"100%",cursor:"pointer"},showLabelsOnMoreHover:L})]}))}))}))})};m.displayName="Dropdown";export{m 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.3",
3
+ "version": "0.0.770-beta.4",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",