@bikdotai/bik-component-library 0.0.772-beta.20 → 0.0.772-beta.22
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"),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,{placeHolder:f,size:g,onSelect:j,defaultOptions:b,disabled:w,noErrorHint:O,placeHolderHeight:m,showPlaceholderWhenSelected:S=!1,inputStyle:y={},inputType:I="default",onDeleteChip:E,truncatedText:H,showLeadingIconInPlaceholder:C=!1,showTrailingIconPlaceholder:D=!1,showLabelsOnMoreHover:P=!1,value:T,resizeable:q=!1}=u,L=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[M,W]=n.useState(!1),[z,_]=n.useState(!1),k=null!=g?g:"default",A=n.useRef(null),[R,F]=n.useState(0),N=n.useRef(),[U,V]=n.useState(null!=b?b:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==L?void 0:L.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)})),V([...t])}),[L.options]),n.useEffect((()=>{b&&V([...b])}),[b]);const B=d.getSelectedOptionsAsText(U),G=S?f:null!==(p=null!=B?B:f)&&void 0!==p?p:"Select an option";n.useLayoutEffect((()=>{q&&A.current&&F(A.current.offsetWidth)}),[q,G]);const J=L.buttonWidth,K=q?R+("x-small"===k?16:"small"===k?20:24)+("default"===k?8:0)+16+8+4:void 0,Q=null!==(h=L.dropdownWidth)&&void 0!==h?h:"212px";return t.jsxs(t.Fragment,{children:[t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:m||("x-small"===k?24:"small"===k?32:48),width:void 0!==K?K:null!=J?J:"100%"},J?{maxWidth:J}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===k?"4px 8px":"6px 8px",backgroundColor:void 0!==T?"#C3E4C4":z?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),y),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==T?"#00580E":"inherit"}}},{children:t.jsx("div",Object.assign({onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),style:L.width?{width:L.width}:void 0},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":L["data-test"],ref:N,onSelect:function(e){Array.isArray(e)?V([...e]):V([e]),null==j||j(e)},disabled:w,onDropdownVisbilityChange:e=>W(e)},L,{width:Q},{children:["default"==I&&t.jsx(l.Input,{version:L.version,noErrorHint:O,state:w?"disabled":"none",value:void 0===T?G:T,errorMessage:L.error,variant:k,placeholder:null!=f?f:"Select an option",onChangeText:c,leftIcon:C&&(null===(v=U[0])||void 0===v?void 0:v.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=U[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=U[0])||void 0===e?void 0:e.trailingIcon),t.jsx(i.default,{style:{transform:M?"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:o.COLORS.content.primary})]}))}},truncateText:null==H||H}),"chip"==I&&t.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:U,onDeleteChip:e=>{null==E||E(e)},errorMessage:L.error,isDropdownOpened:M,sizeToUse:k,containerStyle:{width:null!==(x=L.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:P})]}))}))})),q&&t.jsx("span",Object.assign({ref:A,"aria-hidden":!0,style:{position:"fixed",top:"-9999px",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===k?"12px":"small"===k?"14px":"16px"}},{children:G}))]})};u.displayName="Dropdown",exports.Dropdown=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{
|
|
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,{placeHolder:j,size:O,onSelect:y,defaultOptions:I,disabled:S,noErrorHint:H,placeHolderHeight:E,showPlaceholderWhenSelected:C=!1,inputStyle:T={},inputType:D="default",onDeleteChip:P,truncatedText:W,showLeadingIconInPlaceholder:z=!1,showTrailingIconPlaceholder:M=!1,showLabelsOnMoreHover:L=!1,value:k,resizeable:A=!1}=f,_=e(f,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[N,U]=i(!1),[V,q]=i(!1),B=null!=O?O:"default",F=l(null),[G,J]=i(0),K=l(),[Q,R]=i(null!=I?I:[]);r((()=>{var e;const o=[];null===(e=null==_?void 0:_.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])}),[_.options]),r((()=>{I&&R([...I])}),[I]);const X=v(Q),Y=C?j:null!==(g=null!=X?X:j)&&void 0!==g?g:"Select an option";s((()=>{A&&F.current&&J(F.current.offsetWidth)}),[A,Y]);const Z=_.buttonWidth,$=A?G+("x-small"===B?16:"small"===B?20:24)+("default"===B?8:0)+16+8+4:void 0,ee=null!==(x=_.dropdownWidth)&&void 0!==x?x:"212px";return o(n,{children:[t(p.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:E||("x-small"===B?24:"small"===B?32:48),width:void 0!==$?$:null!=Z?Z:"100%"},Z?{maxWidth:Z}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===B?"4px 8px":"6px 8px",backgroundColor:void 0!==k?"#C3E4C4":V?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),T),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==k?"#00580E":"inherit"}}},{children:t("div",Object.assign({onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),style:_.width?{width:_.width}:void 0},{children:o(u,Object.assign({"data-test":_["data-test"],ref:K,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==y||y(e)},disabled:S,onDropdownVisbilityChange:e=>U(e)},_,{width:ee},{children:["default"==D&&t(c,{version:_.version,noErrorHint:H,state:S?"disabled":"none",value:void 0===k?Y:k,errorMessage:_.error,variant:B,placeholder:null!=j?j:"Select an option",onChangeText:m,leftIcon:z&&(null===(b=Q[0])||void 0===b?void 0:b.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:[M&&(null===(e=Q[0])||void 0===e?void 0:e.trailingIcon),t(d,{style:{transform:N?"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==W||W}),"chip"==D&&t(h,{placeholder:null!=j?j:"Select options",chips:Q,onDeleteChip:e=>{null==P||P(e)},errorMessage:_.error,isDropdownOpened:N,sizeToUse:B,containerStyle:{width:null!==(w=_.width)&&void 0!==w?w:"100%",cursor:"pointer"},showLabelsOnMoreHover:L})]}))}))})),A&&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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bikdotai/bik-component-library",
|
|
3
|
-
"version": "0.0.772-beta.
|
|
3
|
+
"version": "0.0.772-beta.22",
|
|
4
4
|
"description": "Bik Component Library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@amplitude/analytics-browser": "^2.9.3",
|
|
50
50
|
"@babel/runtime": "^7.20.7",
|
|
51
|
-
"@bikdotai/bik-component-library": "^0.0.772-beta.
|
|
51
|
+
"@bikdotai/bik-component-library": "^0.0.772-beta.21",
|
|
52
52
|
"@bikdotai/bik-models": "^2.12.0",
|
|
53
53
|
"@popperjs/core": "^2.11.7",
|
|
54
54
|
"@tippyjs/react": "^4.2.6",
|