@bikdotai/bik-component-library 0.0.772-beta.20 → 0.0.772-beta.22

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