@bikdotai/bik-component-library 0.0.772-beta.21 → 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,{placeHolder:x,size:j,onSelect:f,defaultOptions:w,disabled:b,noErrorHint:O,placeHolderHeight:I,showPlaceholderWhenSelected:S=!1,inputStyle:m={},inputType:y="default",onDeleteChip:E,truncatedText:H,showLeadingIconInPlaceholder:C=!1,showTrailingIconPlaceholder:D=!1,showLabelsOnMoreHover:P=!1,value:T}=u,q=e.__rest(u,["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!=j?j:"default",k=n.useRef(),[A,F]=n.useState(null!=w?w:[]);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)})),F([...t])}),[q.options]),n.useEffect((()=>{w&&F([...w])}),[w]);const R=d.getSelectedOptionsAsText(A),N=S?x:null!==(p=null!=R?R:x)&&void 0!==p?p:"Select an option",U=q.buttonWidth,V=null!==(h=q.dropdownWidth)&&void 0!==h?h:"212px";return t.jsx(t.Fragment,{children:t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:I||("x-small"===z?24:"small"===z?32:48),width:null!=U?U:"100%"},U?{maxWidth:U}:{}),{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({onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),style:q.width?{width:q.width}:void 0},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":q["data-test"],ref:k,onSelect:function(e){Array.isArray(e)?F([...e]):F([e]),null==f||f(e)},disabled:b,onDropdownVisbilityChange:e=>L(e)},q,{width:V},{children:["default"==y&&t.jsx(i.Input,{version:q.version,noErrorHint:O,state:b?"disabled":"none",value:void 0===T?N:T,errorMessage:q.error,variant:z,placeholder:null!=x?x:"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(r.default,{style:{transform:M?"rotate(180deg)":"rotate(0deg)"},onClick:c,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!=x?x:"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})]}))}))}))})};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,w,b,{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,_]=i(!1),[N,U]=i(!1),V=null!=j?j:"default",q=l(),[B,F]=i(null!=I?I:[]);r((()=>{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)})),F([...o])}),[k.options]),r((()=>{I&&F([...I])}),[I]);const G=u(B),J=E?x:null!==(g=null!=G?G:x)&&void 0!==g?g:"Select an option",K=k.buttonWidth,Q=null!==(f=k.dropdownWidth)&&void 0!==f?f:"212px";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:null!=K?K:"100%"},K?{maxWidth:K}:{}),{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({onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1),style:k.width?{width:k.width}:void 0},{children:t(h,Object.assign({"data-test":k["data-test"],ref:q,onSelect:function(e){Array.isArray(e)?F([...e]):F([e]),null==O||O(e)},disabled:y,onDropdownVisbilityChange:e=>_(e)},k,{width:Q},{children:["default"==T&&o(d,{version:k.version,noErrorHint:H,state:y?"disabled":"none",value:void 0===z?J:z,errorMessage:k.error,variant:V,placeholder:null!=x?x:"Select an option",onChangeText:v,leftIcon:M&&(null===(w=B[0])||void 0===w?void 0:w.leadingIcon)?{icon:()=>{var e;return o(n,{children:null===(e=B[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=B[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:B,onDeleteChip:e=>{null==D||D(e)},errorMessage:k.error,isDropdownOpened:A,sizeToUse:V,containerStyle:{width:null!==(b=k.width)&&void 0!==b?b:"100%",cursor:"pointer"},showLabelsOnMoreHover:L})]}))}))}))})};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.21",
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",