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

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"),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;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),o=require("react"),t=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 c(){}const u=u=>{var p,h,v,g,x,{placeHolder:j,size:f,onSelect:b,defaultOptions:w,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[L,W]=o.useState(!1),[_,z]=o.useState(!1),k=null!=f?f:"default",A=o.useRef(),[F,R]=o.useState(null!=w?w:[]);o.useEffect((()=>{var e;const n=[];null===(e=null==M?void 0:M.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&n.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&n.push(e)})),R([...n])}),[M.options]),o.useEffect((()=>{w&&R([...w])}),[w]);const N=d.getSelectedOptionsAsText(F),U=m?j:null!==(p=null!=N?N:j)&&void 0!==p?p:"Select an option",V=null!==(h=M.buttonWidth)&&void 0!==h?h:M.width,B=null!=V?V:"100%",G=null!==(v=M.dropdownWidth)&&void 0!==v?v:B;return n.jsx(n.Fragment,{children:n.jsx(i.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:S||("x-small"===k?24:"small"===k?32:48),width:B},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:n.jsx("div",Object.assign({onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1)},{children:n.jsxs(a.DropdownPopover,Object.assign({"data-test":M["data-test"],ref:A,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==b||b(e)},disabled:O,onDropdownVisbilityChange:e=>W(e)},M,{width:G},{children:["default"==E&&n.jsx(l.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 n.jsx(n.Fragment,{children:null===(e=F[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n.jsxs("div",Object.assign({style:{display:"flex"}},{children:[P&&(null===(e=F[0])||void 0===e?void 0:e.trailingIcon),n.jsx(r.default,{style:{transform:L?"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:t.COLORS.content.primary})]}))}},truncateText:null==C||C}),"chip"==E&&n.jsx(s.default,{placeholder:null!=j?j:"Select options",chips:F,onDeleteChip:e=>{null==H||H(e)},errorMessage:M.error,isDropdownOpened:L,sizeToUse:k,containerStyle:{width:null!==(x=M.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:T})]}))}))}))})};u.displayName="Dropdown",exports.Dropdown=u;
@@ -8,7 +8,7 @@ export interface OpenDropdownProps {
8
8
  error?: string;
9
9
  isMultiSelect?: boolean;
10
10
  maxSelections?: number;
11
- inputWidth?: string;
11
+ dropdownWidth?: string;
12
12
  width?: string;
13
13
  height?: number | string;
14
14
  allowFreeForm?: boolean;
@@ -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 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};
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:M,showLeadingIconInPlaceholder:W=!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=null!==(f=A.buttonWidth)&&void 0!==f?f:A.width,R=null!=Q?Q:"100%",X=null!==(b=A.dropdownWidth)&&void 0!==b?b:R;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:R},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)},{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:X},{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:W&&(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==M||M}),"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};
@@ -8,7 +8,7 @@ export interface OpenDropdownProps {
8
8
  error?: string;
9
9
  isMultiSelect?: boolean;
10
10
  maxSelections?: number;
11
- inputWidth?: string;
11
+ dropdownWidth?: string;
12
12
  width?: string;
13
13
  height?: number | string;
14
14
  allowFreeForm?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.770-beta.4",
3
+ "version": "0.0.770-beta.7",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",