@bikdotai/bik-component-library 0.0.774-beta.10 → 0.0.774-beta.11
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"),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,f,
|
|
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,f,{placeHolder:g,size:j,onSelect:w,defaultOptions:b,disabled:O,noErrorHint:m,placeHolderHeight:S,showPlaceholderWhenSelected:y=!1,inputStyle:I={},inputType:E="default",onDeleteChip:H,truncatedText:C,showLeadingIconInPlaceholder:D=!1,showTrailingIconPlaceholder:P=!1,showLabelsOnMoreHover:T=!1,value:q,resizeable:L=!1}=u,M=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[W,z]=n.useState(!1),[_,k]=n.useState(!1),A=null!=j?j:"default",R=n.useRef(null),[F,N]=n.useState(0),U=n.useRef(),[V,$]=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)})),$([...t])}),[M.options]),n.useEffect((()=>{b&&$([...b])}),[b]);const B=d.getSelectedOptionsAsText(V),G=y?g:null!==(p=null!=B?B:g)&&void 0!==p?p:"Select an option";n.useLayoutEffect((()=>{L&&R.current&&N(R.current.offsetWidth)}),[L,G,A]);const J=M.buttonWidth,K=L?F+("x-small"===A?16:"small"===A?20:24)+("default"===A?8:0)+16+8+4:void 0,Q=void 0!==K?`${K}px`:null!==(h=null!=J?J:M.width)&&void 0!==h?h:"100%",X=null!==(v=M.dropdownWidth)&&void 0!==v?v:Q;return t.jsxs(t.Fragment,{children:[t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:S||("x-small"===A?24:"small"===A?32:48),width:Q},J?{maxWidth:J}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===A?"4px 8px":"6px 8px",backgroundColor:void 0!==q?"#C3E4C4":_?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),I),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==q?"#00580E":"inherit"}}},{children:t.jsx("div",Object.assign({onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),style:M.width?{width:M.width}:void 0},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":M["data-test"],ref:U,onSelect:function(e){Array.isArray(e)?$([...e]):$([e]),null==w||w(e)},disabled:O,onDropdownVisbilityChange:e=>z(e)},M,{width:X},{children:["default"==E&&t.jsx(l.Input,{version:M.version,noErrorHint:m,state:O?"disabled":"none",value:void 0===q?G:q,errorMessage:M.error,variant:A,placeholder:null!=g?g:"Select an option",onChangeText:c,leftIcon:D&&(null===(x=V[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=V[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=V[0])||void 0===e?void 0:e.trailingIcon),t.jsx(i.default,{style:{transform:W?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"x-small"===A?16:"small"===A?20:24,height:"x-small"===A?16:"small"===A?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==C||C}),"chip"==E&&t.jsx(s.default,{placeholder:null!=g?g:"Select options",chips:V,onDeleteChip:e=>{null==H||H(e)},errorMessage:M.error,isDropdownOpened:W,sizeToUse:A,containerStyle:{width:null!==(f=M.width)&&void 0!==f?f:"100%",cursor:"pointer"},showLabelsOnMoreHover:T})]}))}))})),L&&t.jsx("span",Object.assign({ref:R,"aria-hidden":!0,style:{position:"fixed",top:"-9999px",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===A?"12px":"small"===A?"14px":"16px"}},{children:G}))]})};u.displayName="Dropdown",exports.Dropdown=u;
|
|
@@ -1 +1 @@
|
|
|
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,j,
|
|
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,j,{placeHolder:O,size:y,onSelect:I,defaultOptions:S,disabled:H,noErrorHint:E,placeHolderHeight:C,showPlaceholderWhenSelected:T=!1,inputStyle:D={},inputType:P="default",onDeleteChip:W,truncatedText:z,showLeadingIconInPlaceholder:M=!1,showTrailingIconPlaceholder:L=!1,showLabelsOnMoreHover:k=!1,value:A,resizeable:_=!1}=f,N=e(f,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[U,V]=i(!1),[$,q]=i(!1),B=null!=y?y:"default",F=l(null),[G,J]=i(0),K=l(),[Q,R]=i(null!=S?S:[]);r((()=>{var e;const o=[];null===(e=null==N?void 0:N.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])}),[N.options]),r((()=>{S&&R([...S])}),[S]);const X=v(Q),Y=T?O:null!==(g=null!=X?X:O)&&void 0!==g?g:"Select an option";s((()=>{_&&F.current&&J(F.current.offsetWidth)}),[_,Y,B]);const Z=N.buttonWidth,ee=_?G+("x-small"===B?16:"small"===B?20:24)+("default"===B?8:0)+16+8+4:void 0,oe=void 0!==ee?`${ee}px`:null!==(x=null!=Z?Z:N.width)&&void 0!==x?x:"100%",ne=null!==(b=N.dropdownWidth)&&void 0!==b?b:oe;return o(n,{children:[t(p.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:C||("x-small"===B?24:"small"===B?32:48),width:oe},Z?{maxWidth:Z}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===B?"4px 8px":"6px 8px",backgroundColor:void 0!==A?"#C3E4C4":$?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),D),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==A?"#00580E":"inherit"}}},{children:t("div",Object.assign({onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),style:N.width?{width:N.width}:void 0},{children:o(u,Object.assign({"data-test":N["data-test"],ref:K,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==I||I(e)},disabled:H,onDropdownVisbilityChange:e=>V(e)},N,{width:ne},{children:["default"==P&&t(c,{version:N.version,noErrorHint:E,state:H?"disabled":"none",value:void 0===A?Y:A,errorMessage:N.error,variant:B,placeholder:null!=O?O:"Select an option",onChangeText:m,leftIcon:M&&(null===(w=Q[0])||void 0===w?void 0:w.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:[L&&(null===(e=Q[0])||void 0===e?void 0:e.trailingIcon),t(d,{style:{transform:U?"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==z||z}),"chip"==P&&t(h,{placeholder:null!=O?O:"Select options",chips:Q,onDeleteChip:e=>{null==W||W(e)},errorMessage:N.error,isDropdownOpened:U,sizeToUse:B,containerStyle:{width:null!==(j=N.width)&&void 0!==j?j:"100%",cursor:"pointer"},showLabelsOnMoreHover:k})]}))}))})),_&&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};
|