@bikdotai/bik-component-library 0.0.763-beta.34 → 0.0.763-beta.37
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.
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,value:q}=c,M=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[W,L]=t.useState(!1),[_,z]=t.useState(!1),k=null!=j?j:"default",A=t.useRef(),[F,R]=t.useState(null!=m?m:[]),N=t.useRef(null),[U,V]=t.useState(null);t.useEffect((()=>{var e;const n=[];null===(e=null==M?void 0:M.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)})),R([...n])}),[M.options]),t.useEffect((()=>{m&&R([...m])}),[m]);const $=d.getSelectedOptionsAsText(F),B=y?f:null!==(p=null!=$?$:f)&&void 0!==p?p:"Select an option";t.useEffect((()=>{if(N.current){const e=N.current.scrollWidth;V(e+("x-small"===k?16:"small"===k?20:24)+2*("x-small"===k?16:12)+8+2)}}),[B,k]);const G=null!==(v=null!==(h=M.buttonWidth)&&void 0!==h?h:M.inputWidth)&&void 0!==v?v:"100%",J=U?`${U}px`:G;return n.jsxs(n.Fragment,{children:[n.jsx("span",Object.assign({ref:N,style:{position:"absolute",visibility:"hidden",whiteSpace:"nowrap",fontSize:"x-small"===k?"12px":"small"===k?"14px":"16px",fontFamily:"Inter"}},{children:B})),n.jsx(i.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:S||("x-small"===k?24:"small"===k?32:48),width:J,maxWidth:G,zIndex:1,cursor:"pointer",padding:"x-small"===k?"4px 8px":"6px 8px",backgroundColor:W||void 0!==q?"#C3E4C4":_?"#E0E0E0":"transparent",transition:"backgroundColor 0.3s ease"},I),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==q?"#00580E":"inherit"}}},{children:n.jsx("div",Object.assign({onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1)},{children:n.jsxs(a.DropdownPopover,Object.assign({"data-test":M["data-test"],ref:A,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==b||b(e)},disabled:w,onDropdownVisbilityChange:e=>L(e)},M,{children:["default"==E&&n.jsx(r.Input,{version:M.version,noErrorHint:O,state:w?"disabled":"none",value:void 0===q?B:q,errorMessage:M.error,variant:k,placeholder:null!=f?f:"Select an option",onChangeText:u,leftIcon:D&&(null===(x=F[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return n.jsx(n.Fragment,{children:null===(e=F[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=F[0])||void 0===e?void 0:e.trailingIcon),n.jsx(l.default,{style:{transform:W?"rotate(180deg)":"rotate(0deg)"},onClick:u,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"==E&&n.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:F,onDeleteChip:e=>{null==C||C(e)},errorMessage:M.error,isDropdownOpened:W,sizeToUse:k,containerStyle:{width:null!==(g=M.width)&&void 0!==g?g:"100%",cursor:"pointer"},showLabelsOnMoreHover:T})]}))}))}))]})};c.displayName="Dropdown",exports.Dropdown=c;
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
align-items: center;
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
flex: 1;
|
|
43
|
-
`,m=t=>{let{onDragStart:n,onDragEnd:r}=t;return e.jsxs(x,Object.assign({draggable:!0,onDragStart:n,onDragEnd:r},{children:[e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{})]}))},f=n.forwardRef(((r,o)=>{let{option:c,isMultiSelect:u,showDescription:x,onSelect:v,last:f,version:O,onDropdownItemClick:D,useDefaultCursor:y,isFocused:C=!1,dataIndex:I=-1,isDraggable:F=!1,onDragStart:T,onDragOver:S,onDrop:E,onDragEnd:k,isDraggedOver:w=!1}=r;var L;const[q,M]=n.useState(c.selected),$=(e,t)=>{if(!e.children){B(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==D||D(n)}},B=e=>{c.disabled||v(Object.assign(Object.assign({},c),{selected:e}))},R=y?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(s.Tooltip,Object.assign({body:"",tooltipContent:c.children?e.jsx("div",Object.assign({style:{backgroundColor:l.DEFAULT_THEME.colorsV2.surface.standard},ref:o,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1)},{children:e.jsx(p,Object.assign({version:null!=O?O:"2.0"},{children:c.children.map((t=>{var n;return e.jsx(g,{version:O,style:"1.0"!==O&&(null!==(n=null==c?void 0:c.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),$(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(g,{version:O,style:f?Object.assign(Object.assign({borderBottom:0},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),$(c)},onMouseOver:()=>{c.description?x(c.label,c.description):x()},listItem:{value:c.value,label:c.label},subText:c.subText,"data-option-index":I,role:"option",id:`dropdown-option-${I}`,"aria-selected":!!c.selected,onDragOver:F?S:void 0,onDrop:F?E:void 0,leadingIcon:u?e.jsxs(j,{children:[F
|
|
43
|
+
`,m=t=>{let{onDragStart:n,onDragEnd:r}=t;return e.jsxs(x,Object.assign({draggable:!0,onDragStart:n,onDragEnd:r},{children:[e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{}),e.jsx(v,{})]}))},f=n.forwardRef(((r,o)=>{let{option:c,isMultiSelect:u,showDescription:x,onSelect:v,last:f,version:O,onDropdownItemClick:D,useDefaultCursor:y,isFocused:C=!1,dataIndex:I=-1,isDraggable:F=!1,onDragStart:T,onDragOver:S,onDrop:E,onDragEnd:k,isDraggedOver:w=!1}=r;var L;const[q,M]=n.useState(c.selected),$=(e,t)=>{if(!e.children){B(!e.selected);const n=t?Object.assign(Object.assign({},e),{parent:t}):e;null==D||D(n)}},B=e=>{c.disabled||v(Object.assign(Object.assign({},c),{selected:e}))},R=y?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(s.Tooltip,Object.assign({body:"",tooltipContent:c.children?e.jsx("div",Object.assign({style:{backgroundColor:l.DEFAULT_THEME.colorsV2.surface.standard},ref:o,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1)},{children:e.jsx(p,Object.assign({version:null!=O?O:"2.0"},{children:c.children.map((t=>{var n;return e.jsx(g,{version:O,style:"1.0"!==O&&(null!==(n=null==c?void 0:c.children)&&void 0!==n?n:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),$(t,c)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:c.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(g,{version:O,style:f?Object.assign(Object.assign({borderBottom:0},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},R),w?{borderTop:`2px solid ${l.COLORS.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),$(c)},onMouseOver:()=>{c.description?x(c.label,c.description):x()},listItem:{value:c.value,label:c.label},subText:c.subText,"data-option-index":I,role:"option",id:`dropdown-option-${I}`,"aria-selected":!!c.selected,onDragOver:F?S:void 0,onDrop:F?E:void 0,leadingIcon:u?e.jsxs(j,{children:[F&&e.jsx(m,{onDragStart:T,onDragEnd:k}),e.jsx(i.CheckBox,{size:"2.0"===O?"SMALL":"DEFAULT",isDisabled:null!==(L=c.disabled)&&void 0!==L&&L,isChecked:!!c.selected,onValueChange:B}),e.jsx(h,{children:c.leadingIcon})]}):F?e.jsxs(b,{children:[e.jsx(m,{onDragStart:T,onDragEnd:k}),c.leadingIcon&&e.jsx("div",{children:c.leadingIcon})]}):c.leadingIcon?e.jsx(e.Fragment,{children:c.leadingIcon}):void 0,customComponent:c.customComponent,trailingIcon:c.isFreeForm?e.jsx(d.FreeFormContainer,{children:e.jsx(a.BodyCaption,Object.assign({style:{color:l.COLORS.content.secondary}},{children:"Freeform"}))}):c.children?e.jsx(t.default,{width:12,height:12}):c.trailingIcon?e.jsx(e.Fragment,{children:c.trailingIcon}):void 0,variant:c.disabled?"inactive":C||c.selected||!u&&q?"selected":"default"})}))})}));exports.MenuItem=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsxs as o,Fragment as n,jsx as
|
|
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 l,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,value:k}=v,A=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[_,F]=l(!1),[N,U]=l(!1),V=null!=y?y:"default",$=i(),[q,B]=l(null!=O?O:[]),G=i(null),[J,K]=l(null);r((()=>{var e;const o=[];null===(e=null==A?void 0:A.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)})),B([...o])}),[A.options]),r((()=>{O&&B([...O])}),[O]);const Q=h(q),R=E?j:null!==(g=null!=Q?Q:j)&&void 0!==g?g:"Select an option";r((()=>{if(G.current){const e=G.current.scrollWidth;K(e+("x-small"===V?16:"small"===V?20:24)+2*("x-small"===V?16:12)+8+2)}}),[R,V]);const X=null!==(x=null!==(f=A.buttonWidth)&&void 0!==f?f:A.inputWidth)&&void 0!==x?x:"100%",Y=J?`${J}px`:X;return o(n,{children:[t("span",Object.assign({ref:G,style:{position:"absolute",visibility:"hidden",whiteSpace:"nowrap",fontSize:"x-small"===V?"12px":"small"===V?"14px":"16px",fontFamily:"Inter"}},{children:R})),t(c.Provider,Object.assign({value:{InputWrapper:Object.assign({height:C||("x-small"===V?24:"small"===V?32:48),width:Y,maxWidth:X,zIndex:1,cursor:"pointer",padding:"x-small"===V?"4px 8px":"6px 8px",backgroundColor:_||void 0!==k?"#C3E4C4":N?"#E0E0E0":"transparent",transition:"backgroundColor 0.3s ease"},T),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==k?"#00580E":"inherit"}}},{children:t("div",Object.assign({onMouseEnter:()=>U(!0),onMouseLeave:()=>U(!1)},{children:o(u,Object.assign({"data-test":A["data-test"],ref:$,onSelect:function(e){Array.isArray(e)?B([...e]):B([e]),null==I||I(e)},disabled:S,onDropdownVisbilityChange:e=>F(e)},A,{children:["default"==D&&t(d,{version:A.version,noErrorHint:H,state:S?"disabled":"none",value:void 0===k?R:k,errorMessage:A.error,variant:V,placeholder:null!=j?j:"Select an option",onChangeText:m,leftIcon:M&&(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:[L&&(null===(e=q[0])||void 0===e?void 0:e.trailingIcon),t(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===V?16:"small"===V?20:24,height:"x-small"===V?16:"small"===V?20:24,color:s.content.primary})]}))}},truncateText:null==W||W}),"chip"==D&&t(p,{placeholder:null!=j?j:"Select options",chips:q,onDeleteChip:e=>{null==P||P(e)},errorMessage:A.error,isDropdownOpened:_,sizeToUse:V,containerStyle:{width:null!==(w=A.width)&&void 0!==w?w:"100%",cursor:"pointer"},showLabelsOnMoreHover:z})]}))}))}))]})};v.displayName="Dropdown";export{v as Dropdown};
|
|
@@ -22,13 +22,13 @@ import{jsx as e,Fragment as n,jsxs as o}from"react/jsx-runtime";import t from"..
|
|
|
22
22
|
align-self: center;
|
|
23
23
|
height: fit-content;
|
|
24
24
|
min-height: 18px;
|
|
25
|
-
`,
|
|
25
|
+
`,x=l.div`
|
|
26
26
|
width: 2.86px;
|
|
27
27
|
height: 2.86px;
|
|
28
28
|
border-radius: 50%;
|
|
29
29
|
background-color: ${g.content.inactive};
|
|
30
30
|
flex-shrink: 0;
|
|
31
|
-
`,
|
|
31
|
+
`,b=l.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
align-content: center;
|
|
34
34
|
justify-content: center;
|
|
@@ -40,4 +40,4 @@ import{jsx as e,Fragment as n,jsxs as o}from"react/jsx-runtime";import t from"..
|
|
|
40
40
|
align-items: center;
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
flex: 1;
|
|
43
|
-
`,j=n=>{let{onDragStart:t,onDragEnd:r}=n;return o(h,Object.assign({draggable:!0,onDragStart:t,onDragEnd:r},{children:[e(
|
|
43
|
+
`,j=n=>{let{onDragStart:t,onDragEnd:r}=n;return o(h,Object.assign({draggable:!0,onDragStart:t,onDragEnd:r},{children:[e(x,{}),e(x,{}),e(x,{}),e(x,{}),e(x,{}),e(x,{})]}))},y=r(((r,l)=>{let{option:s,isMultiSelect:h,showDescription:x,onSelect:y,last:I,version:O,onDropdownItemClick:C,useDefaultCursor:k,isFocused:w=!1,dataIndex:T=-1,isDraggable:$=!1,onDragStart:S,onDragOver:E,onDrop:F,onDragEnd:M,isDraggedOver:L=!1}=r;var B;const[A,V]=i(s.selected),z=(e,n)=>{if(!e.children){R(!e.selected);const o=n?Object.assign(Object.assign({},e),{parent:n}):e;null==C||C(o)}},R=e=>{s.disabled||y(Object.assign(Object.assign({},s),{selected:e}))},U=k?{cursor:"default"}:{};return e(n,{children:e(d,Object.assign({body:"",tooltipContent:s.children?e("div",Object.assign({style:{backgroundColor:p.colorsV2.surface.standard},ref:l,onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1)},{children:e(v,Object.assign({version:null!=O?O:"2.0"},{children:s.children.map((n=>{var o;return e(u,{version:O,style:"1.0"!==O&&(null!==(o=null==s?void 0:s.children)&&void 0!==o?o:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),z(n,s)},listItem:{value:n.value,label:n.label},subText:n.subText,leadingIcon:n.leadingIcon||void 0,customComponent:n.customComponent,trailingIcon:n.trailingIcon||void 0,variant:s.disabled?"inactive":n.selected?"selected":"default"},n.value)}))}))})):e(n,{}),placement:"right-start",hideArrow:!0},{children:e(u,{version:O,style:I?Object.assign(Object.assign({borderBottom:0},U),L?{borderTop:`2px solid ${g.content.brand}`,opacity:.5}:{}):Object.assign(Object.assign({},U),L?{borderTop:`2px solid ${g.content.brand}`,opacity:.5}:{}),onClick:e=>{e.preventDefault(),z(s)},onMouseOver:()=>{s.description?x(s.label,s.description):x()},listItem:{value:s.value,label:s.label},subText:s.subText,"data-option-index":T,role:"option",id:`dropdown-option-${T}`,"aria-selected":!!s.selected,onDragOver:$?E:void 0,onDrop:$?F:void 0,leadingIcon:h?o(b,{children:[$&&e(j,{onDragStart:S,onDragEnd:M}),e(a,{size:"2.0"===O?"SMALL":"DEFAULT",isDisabled:null!==(B=s.disabled)&&void 0!==B&&B,isChecked:!!s.selected,onValueChange:R}),e(f,{children:s.leadingIcon})]}):$?o(D,{children:[e(j,{onDragStart:S,onDragEnd:M}),s.leadingIcon&&e("div",{children:s.leadingIcon})]}):s.leadingIcon?e(n,{children:s.leadingIcon}):void 0,customComponent:s.customComponent,trailingIcon:s.isFreeForm?e(m,{children:e(c,Object.assign({style:{color:g.content.secondary}},{children:"Freeform"}))}):s.children?e(t,{width:12,height:12}):s.trailingIcon?e(n,{children:s.trailingIcon}):void 0,variant:s.disabled?"inactive":w||s.selected||!h&&A?"selected":"default"})}))})}));export{y as MenuItem};
|