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