@bikdotai/bik-component-library 0.0.534-beta.1 → 0.0.534-beta.2
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.
|
@@ -7,5 +7,7 @@ export type DropdownProps = OpenDropdownProps & {
|
|
|
7
7
|
noErrorHint?: boolean;
|
|
8
8
|
buttonWidth?: string;
|
|
9
9
|
placeHolderHeight?: string;
|
|
10
|
+
showPlaceholderWhenSelected?: boolean;
|
|
11
|
+
inputStyle?: React.CSSProperties;
|
|
10
12
|
};
|
|
11
13
|
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./DropdownPopover/index.js");function a(){}const d=d=>{var u,c,p,{placeHolder:h,size:v,onSelect:g,defaultOptions:j,disabled:b,noErrorHint:f,placeHolderHeight:x,showPlaceholderWhenSelected:w=!1,inputStyle:S={}}=d,y=e.__rest(d,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle"]);const[m,H]=n.useState(!1),O=null!=v?v:"default",q=n.useRef(),[E,I]=n.useState(null!=j?j:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==y?void 0:y.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)})),I([...t])}),[y.options]),n.useEffect((()=>{j&&I([...j])}),[j]);const P=E.length?E.map((e=>e.label)).join(", "):void 0;return t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:x||("small"===O?32:48),width:null!==(c=null!==(u=y.buttonWidth)&&void 0!==u?u:y.width)&&void 0!==c?c:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},S),input:{minHeight:"100%"}}},{children:t.jsx(s.DropdownPopover,Object.assign({ref:q,onSelect:function(e){Array.isArray(e)?I([...e]):I([e]),null==g||g(e)},disabled:b,onDropdownVisbilityChange:e=>H(e)},y,{children:t.jsx(i.Input,{version:y.version,noErrorHint:f,state:b?"disabled":"none",value:w?h:null!=P?P:"",errorMessage:y.error,variant:O,placeholder:null!=h?h:"Select an option",width:null!==(p=y.width)&&void 0!==p?p:"100%",onChangeText:a,rightIcon:{icon:()=>t.jsx(o.default,{style:{transform:m?"rotate(180deg)":"rotate(0deg)"},onClick:a,width:"small"===O?20:24,height:"small"===O?20:24,color:r.COLORS.content.primary})},truncateText:!0})}))}))};d.displayName="Dropdown",exports.Dropdown=d;
|
|
@@ -7,5 +7,7 @@ export type DropdownProps = OpenDropdownProps & {
|
|
|
7
7
|
noErrorHint?: boolean;
|
|
8
8
|
buttonWidth?: string;
|
|
9
9
|
placeHolderHeight?: string;
|
|
10
|
+
showPlaceholderWhenSelected?: boolean;
|
|
11
|
+
inputStyle?: React.CSSProperties;
|
|
10
12
|
};
|
|
11
13
|
export declare const Dropdown: React.FC<DropdownProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as r}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";function p(){}const c=c=>{var u,h,m,{placeHolder:g,size:v,onSelect:f,defaultOptions:b,disabled:j,noErrorHint:w,placeHolderHeight:H,showPlaceholderWhenSelected:x=!1,inputStyle:y={}}=c,S=e(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle"]);const[O,E]=t(!1),I=null!=v?v:"default",P=n(),[D,W]=t(null!=b?b:[]);r((()=>{var e;const o=[];null===(e=null==S?void 0:S.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)})),W([...o])}),[S.options]),r((()=>{b&&W([...b])}),[b]);const z=D.length?D.map((e=>e.label)).join(", "):void 0;return o(a.Provider,Object.assign({value:{InputWrapper:Object.assign({height:H||("small"===I?32:48),width:null!==(h=null!==(u=S.buttonWidth)&&void 0!==u?u:S.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},y),input:{minHeight:"100%"}}},{children:o(d,Object.assign({ref:P,onSelect:function(e){Array.isArray(e)?W([...e]):W([e]),null==f||f(e)},disabled:j,onDropdownVisbilityChange:e=>E(e)},S,{children:o(s,{version:S.version,noErrorHint:w,state:j?"disabled":"none",value:x?g:null!=z?z:"",errorMessage:S.error,variant:I,placeholder:null!=g?g:"Select an option",width:null!==(m=S.width)&&void 0!==m?m:"100%",onChangeText:p,rightIcon:{icon:()=>o(l,{style:{transform:O?"rotate(180deg)":"rotate(0deg)"},onClick:p,width:"small"===I?20:24,height:"small"===I?20:24,color:i.content.primary})},truncateText:!0})}))}))};c.displayName="Dropdown";export{c as Dropdown};
|