@bikdotai/bik-component-library 0.0.757-beta.13 → 0.0.757-beta.14
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"),
|
|
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,x,{placeHolder:g,size:j,onSelect:f,defaultOptions:w,disabled:b,noErrorHint:O,placeHolderHeight:I,showPlaceholderWhenSelected:m=!1,inputStyle:y={},inputType:S="default",onDeleteChip:H,truncatedText:D,showLeadingIconInPlaceholder:P=!1,showTrailingIconPlaceholder:T=!1,showLabelsOnMoreHover:q=!1}=c,C=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover"]);const[E,W]=n.useState(!1),L=null!=j?j:"default",M=n.useRef(),[_,z]=n.useState(null!=w?w:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==C?void 0:C.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)})),z([...t])}),[C.options]),n.useEffect((()=>{w&&z([...w])}),[w]);const A=d.getSelectedOptionsAsText(_);return t.jsx(i.InputStyleContext.Provider,Object.assign({value:{RootContainer:{maxWidth:null!==(h=null!==(p=C.buttonWidth)&&void 0!==p?p:C.inputWidth)&&void 0!==h?h:"100%"},InputWrapper:Object.assign({height:I||("x-small"===L?24:"small"===L?32:48),zIndex:1,cursor:"pointer",padding:"x-small"===L?"4px 8px":"6px 8px"},y),input:{minHeight:"100%",maxWidth:"100%"}}},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":C["data-test"],ref:M,onSelect:function(e){Array.isArray(e)?z([...e]):z([e]),null==f||f(e)},disabled:b,onDropdownVisbilityChange:e=>W(e)},C,{children:["default"==S&&t.jsx(l.Input,{version:C.version,noErrorHint:O,state:b?"disabled":"none",value:m?g:null!=A?A:"",errorMessage:C.error,variant:L,placeholder:null!=g?g:"Select an option",onChangeText:u,leftIcon:P&&(null===(v=_[0])||void 0===v?void 0:v.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=_[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[T&&(null===(e=_[0])||void 0===e?void 0:e.trailingIcon),t.jsx(r.default,{style:{transform:E?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"x-small"===L?16:"small"===L?20:24,height:"x-small"===L?16:"small"===L?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==D||D}),"chip"==S&&t.jsx(s.default,{placeholder:null!=g?g:"Select options",chips:_,onDeleteChip:e=>{null==H||H(e)},errorMessage:C.error,isDropdownOpened:E,sizeToUse:L,containerStyle:{width:null!==(x=C.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:q})]}))}))};c.displayName="Dropdown",exports.Dropdown=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment 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 p}from"../input/context/InputStyleProvider.js";import c from"./ChipInput.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var g,f,x,b,{placeHolder:w,size:I,onSelect:j,defaultOptions:O,disabled:y,noErrorHint:H,placeHolderHeight:S,showPlaceholderWhenSelected:T=!1,inputStyle:D={},inputType:P="default",onDeleteChip:C,truncatedText:W,showLeadingIconInPlaceholder:E=!1,showTrailingIconPlaceholder:L=!1,showLabelsOnMoreHover:M=!1}=v,z=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover"]);const[A,_]=l(!1),k=null!=I?I:"default",N=r(),[R,U]=l(null!=O?O:[]);i((()=>{var e;const o=[];null===(e=null==z?void 0:z.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)})),U([...o])}),[z.options]),i((()=>{O&&U([...O])}),[O]);const V=u(R);return o(p.Provider,Object.assign({value:{RootContainer:{maxWidth:null!==(f=null!==(g=z.buttonWidth)&&void 0!==g?g:z.inputWidth)&&void 0!==f?f:"100%"},InputWrapper:Object.assign({height:S||("x-small"===k?24:"small"===k?32:48),zIndex:1,cursor:"pointer",padding:"x-small"===k?"4px 8px":"6px 8px"},D),input:{minHeight:"100%",maxWidth:"100%"}}},{children:n(h,Object.assign({"data-test":z["data-test"],ref:N,onSelect:function(e){Array.isArray(e)?U([...e]):U([e]),null==j||j(e)},disabled:y,onDropdownVisbilityChange:e=>_(e)},z,{children:["default"==P&&o(d,{version:z.version,noErrorHint:H,state:y?"disabled":"none",value:T?w:null!=V?V:"",errorMessage:z.error,variant:k,placeholder:null!=w?w:"Select an option",onChangeText:m,leftIcon:E&&(null===(x=R[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return o(t,{children:null===(e=R[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n("div",Object.assign({style:{display:"flex"}},{children:[L&&(null===(e=R[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:A?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===k?16:"small"===k?20:24,height:"x-small"===k?16:"small"===k?20:24,color:s.content.primary})]}))}},truncateText:null==W||W}),"chip"==P&&o(c,{placeholder:null!=w?w:"Select options",chips:R,onDeleteChip:e=>{null==C||C(e)},errorMessage:z.error,isDropdownOpened:A,sizeToUse:k,containerStyle:{width:null!==(b=z.width)&&void 0!==b?b:"100%",cursor:"pointer"},showLabelsOnMoreHover:M})]}))}))};v.displayName="Dropdown";export{v as Dropdown};
|