@bikdotai/bik-component-library 0.0.552-beta.2 → 0.0.552-beta.4

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,11 +1,12 @@
1
1
  import React from 'react';
2
+ import { SingleOption } from './type';
2
3
  interface ChipInputProps {
3
- chips: string[];
4
- onDeleteChip: (chip: string, index: number) => void;
4
+ placeholder?: string;
5
+ chips: SingleOption[];
6
+ onDeleteChip: (chip: SingleOption) => void;
5
7
  containerStyle?: React.CSSProperties;
6
8
  isDropdownOpened?: boolean;
7
9
  sizeToUse?: 'default' | 'small';
8
- setDropdownVisibility?: React.Dispatch<React.SetStateAction<boolean>>;
9
10
  }
10
11
  declare const ChipInput: React.FC<ChipInputProps>;
11
12
  export default ChipInput;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../constants/Theme.js"),t=require("../../assets/icons/chevronDown.svg.js"),r=require("../../assets/icons/cross.svg.js"),n=require("../tag/Tag.js"),i=require("../TypographyStyle.js"),o=require("./Common.styled.js");exports.default=a=>{let{chips:l,onDeleteChip:c,containerStyle:d={},sizeToUse:h="default",isDropdownOpened:j}=a;return e.jsxs(o.ChipInputWrapper,Object.assign({style:Object.assign({},d)},{children:[e.jsxs("div",Object.assign({className:"chips-container"},{children:[l.slice(0,2).map(((s,t)=>e.jsx("div",Object.assign({style:{zIndex:10}},{children:e.jsx(n.Tag,Object.assign({tagText:s,TrailingIcon:()=>e.jsx(r.default,{width:12,height:12,style:{cursor:"pointer"},onClick:e=>{e.preventDefault(),e.stopPropagation(),c(s,t)}})},{children:s}))}),t))),l.length>2&&e.jsx(i.BodyCaption,Object.assign({color:s.COLORS.content.placeholder},{children:`+${l.length-2} more`})),0===l.length&&e.jsx(i.BodyCaption,Object.assign({color:s.COLORS.content.placeholder},{children:"Select.."}))]})),e.jsx("div",{children:e.jsx(t.default,{style:{transform:j?"rotate(180deg)":"rotate(0deg)"},width:"small"===h?20:24,height:"small"===h?20:24,color:s.COLORS.content.primary})})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../constants/Theme.js"),t=require("../../assets/icons/chevronDown.svg.js"),r=require("../../assets/icons/cross.svg.js"),l=require("../tag/Tag.js"),i=require("../TypographyStyle.js"),n=require("./Common.styled.js");exports.default=a=>{let{chips:c,onDeleteChip:o,containerStyle:d={},sizeToUse:h="default",isDropdownOpened:j,placeholder:g="Select.."}=a;return e.jsxs(n.ChipInputWrapper,Object.assign({style:Object.assign({},d)},{children:[e.jsxs("div",Object.assign({className:"chips-container"},{children:[c.slice(0,2).map(((s,t)=>e.jsx("div",Object.assign({style:{zIndex:10}},{children:e.jsx(l.Tag,Object.assign({tagText:s.selectedLabel||s.label,TrailingIcon:()=>e.jsx(r.default,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{o(s)}})},{children:s.selectedLabel||s.label}))}),t))),c.length>2&&e.jsx(i.BodyCaption,Object.assign({color:s.COLORS.content.placeholder},{children:`+${c.length-2} more`})),0===c.length&&e.jsx("div",Object.assign({style:{color:s.COLORS.content.placeholder}},{children:g}))]})),e.jsx("div",{children:e.jsx(t.default,{style:{transform:j?"rotate(180deg)":"rotate(0deg)"},width:"small"===h?20:24,height:"small"===h?20:24,color:s.COLORS.content.primary})})]}))};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { OpenDropdownProps } from './type';
2
+ import { OpenDropdownProps, SingleOption } from './type';
3
3
  export type DropdownProps = OpenDropdownProps & {
4
4
  placeHolder?: string;
5
5
  size?: 'default' | 'small';
@@ -10,6 +10,6 @@ export type DropdownProps = OpenDropdownProps & {
10
10
  showPlaceholderWhenSelected?: boolean;
11
11
  inputStyle?: React.CSSProperties;
12
12
  inputType?: 'chip' | 'default';
13
- onDeleteChip?: (chip: string, index: number) => void;
13
+ onDeleteChip?: (chip: SingleOption) => void;
14
14
  };
15
15
  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"),n=require("react"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/chevronDown.svg.js"),r=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),d=require("./DropdownPopover/index.js"),u=require("./OpenedDropdown/utils/iterationOnOptions.js");function a(){}const p=p=>{var c,h,v,g,j,{placeHolder:f,size:w,onSelect:b,defaultOptions:x,disabled:y,noErrorHint:O,placeHolderHeight:S,showPlaceholderWhenSelected:D=!1,inputStyle:q={},inputType:C="default",onDeleteChip:H}=p,m=e.__rest(p,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip"]);const[I,E]=n.useState(!1),P=null!=w?w:"default",T=n.useRef(),[_,A]=n.useState(null!=x?x:[]);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)})),A([...t])}),[m.options]),n.useEffect((()=>{x&&A([...x])}),[x]);const z=u.getSelectedOptionsAsText(_),W=u.getSelectedOptionsAsArray(_);return t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:S||("small"===P?32:48),width:null!==(h=null!==(c=m.buttonWidth)&&void 0!==c?c:m.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},q),input:{minHeight:"100%"}}},{children:t.jsxs(d.DropdownPopover,Object.assign({ref:T,onSelect:function(e){Array.isArray(e)?A([...e]):A([e]),null==b||b(e)},disabled:y,onDropdownVisbilityChange:e=>E(e)},m,{children:["default"==C&&t.jsx(r.Input,{version:m.version,noErrorHint:O,state:y?"disabled":"none",value:D?f:null!=z?z:"",errorMessage:m.error,variant:P,placeholder:null!=f?f:"Select an option",width:null!==(v=m.width)&&void 0!==v?v:"100%",onChangeText:a,rightIcon:{icon:()=>t.jsx(i.default,{style:{transform:I?"rotate(180deg)":"rotate(0deg)"},onClick:a,width:"small"===P?20:24,height:"small"===P?20:24,color:o.COLORS.content.primary})},truncateText:!0}),"chip"==C&&t.jsx(s.default,{chips:W,onDeleteChip:(e,t)=>{null==H||H(e,t),console.log("onDeleteChip",e,t)},isDropdownOpened:I,sizeToUse:P,containerStyle:{width:null!==(g=m.width)&&void 0!==g?g:"100%",cursor:"pointer"},setDropdownVisibility:null===(j=null==T?void 0:T.current)||void 0===j?void 0:j.setDropdownVisibility})]}))}))};p.displayName="Dropdown",exports.Dropdown=p;
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"),i=require("../input/Input.js"),l=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),u=require("./DropdownPopover/index.js"),a=require("./OpenedDropdown/utils/iterationOnOptions.js");function d(){}const p=p=>{var c,h,v,j,{placeHolder:f,size:g,onSelect:w,defaultOptions:x,disabled:S,noErrorHint:b,placeHolderHeight:O,showPlaceholderWhenSelected:y=!1,inputStyle:D={},inputType:q="default",onDeleteChip:H}=p,m=e.__rest(p,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip"]);const[C,I]=n.useState(!1),E=null!=g?g:"default",P=n.useRef(),[T,_]=n.useState(null!=x?x:[]);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((()=>{x&&_([...x])}),[x]);const z=a.getSelectedOptionsAsText(T);return t.jsx(l.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("small"===E?32:48),width:null!==(h=null!==(c=m.buttonWidth)&&void 0!==c?c:m.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},D),input:{minHeight:"100%"}}},{children:t.jsxs(u.DropdownPopover,Object.assign({ref:P,onSelect:function(e){Array.isArray(e)?_([...e]):_([e]),null==w||w(e)},disabled:S,onDropdownVisbilityChange:e=>I(e)},m,{children:["default"==q&&t.jsx(i.Input,{version:m.version,noErrorHint:b,state:S?"disabled":"none",value:y?f:null!=z?z:"",errorMessage:m.error,variant:E,placeholder:null!=f?f:"Select an option",width:null!==(v=m.width)&&void 0!==v?v:"100%",onChangeText:d,rightIcon:{icon:()=>t.jsx(r.default,{style:{transform:C?"rotate(180deg)":"rotate(0deg)"},onClick:d,width:"small"===E?20:24,height:"small"===E?20:24,color:o.COLORS.content.primary})},truncateText:!0}),"chip"==q&&t.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:T,onDeleteChip:e=>{null==H||H(e)},isDropdownOpened:C,sizeToUse:E,containerStyle:{width:null!==(j=m.width)&&void 0!==j?j:"100%",cursor:"pointer"}})]}))}))};p.displayName="Dropdown",exports.Dropdown=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),r=require("react"),t=require("react-popper"),n=require("../../dropShadow/DropShadow.js"),i=require("../../tooltips/Tooltip.js"),l=require("../Common.styled.js"),s=require("../OpenedDropdown/components/OpennedDropdown.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=p(r).default.forwardRef(((p,d)=>{var{children:a,onDropdownVisbilityChange:c,version:u="1.0",tooltipContent:v,tooltipDirection:j,showTooltipArrow:w}=p,b=e.__rest(p,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const f=d,[D,h]=r.useState(!1),[g,y]=r.useState(null),[O,x]=r.useState(null),m=r.useRef(null),{styles:S,attributes:C}=t.usePopper(g,O,{placement:b.placement,strategy:b.strategy}),q=e=>{var o,r;"2.0"===u&&b.isMultiSelect&&e&&(null===(o=b.onSelect)||void 0===o||o.call(b,[...e])),h(!1),null===(r=null==b?void 0:b.onClose)||void 0===r||r.call(b)};r.useImperativeHandle(f,(()=>({openDropdown:D,closeDropdown:()=>h(!1),openDropdownFn:()=>h(!0),setDropdownVisibility:h})),[]),r.useEffect((()=>{(null==f?void 0:f.current)&&(f.current.openDropdown=D)}),[D]),r.useEffect((()=>{null==c||c(D)}),[D]);const _=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",Object.assign({style:{position:"relative"},ref:y},{children:[o.jsx(l.OverLapAbs,{ref:m,disabled:b.disabled,onClick:e=>{var o;e.stopPropagation(),null===(o=b.onDropdownOpen)||void 0===o||o.call(b),D?(h(!1),e.preventDefault()):b.disabled||h(!0)}}),a]})),D&&o.jsx(l.OpenDropdownContainer,Object.assign({ref:x,style:Object.assign(Object.assign({},S.popper),{zIndex:3})},C.popper,{children:o.jsx(n.default,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:o.jsx(s.OpenedDropdown,Object.assign({},b,{onSelect:e=>{var o;"2.0"===u&&b.isMultiSelect||(null===(o=b.onSelect)||void 0===o||o.call(b,e),h(!1))},onClose:q,version:u,headerRef:m}))}))}))]});return o.jsx(o.Fragment,{children:D||void 0===v?_():o.jsx(i.Tooltip,Object.assign({body:v,placement:j,hideArrow:!w},{children:o.jsx("div",{children:_()})}))})}));d.displayName="DropdownPopover",exports.DropdownPopover=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),r=require("react"),t=require("react-popper"),n=require("../../dropShadow/DropShadow.js"),l=require("../../tooltips/Tooltip.js"),i=require("../Common.styled.js"),s=require("../OpenedDropdown/components/OpennedDropdown.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const p=d(r).default.forwardRef(((d,p)=>{var{children:a,onDropdownVisbilityChange:c,version:u="1.0",tooltipContent:v,tooltipDirection:j,showTooltipArrow:w}=d,b=e.__rest(d,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const f=p,[h,D]=r.useState(!1),[g,O]=r.useState(null),[x,y]=r.useState(null),m=r.useRef(null),{styles:S,attributes:C}=t.usePopper(g,x,{placement:b.placement,strategy:b.strategy}),q=e=>{var o,r;"2.0"===u&&b.isMultiSelect&&e&&(null===(o=b.onSelect)||void 0===o||o.call(b,[...e])),D(!1),null===(r=null==b?void 0:b.onClose)||void 0===r||r.call(b)};r.useImperativeHandle(f,(()=>({openDropdown:h})),[]),r.useEffect((()=>{(null==f?void 0:f.current)&&(f.current.openDropdown=h)}),[h]),r.useEffect((()=>{null==c||c(h)}),[h]);const _=()=>o.jsxs(o.Fragment,{children:[o.jsxs("div",Object.assign({style:{position:"relative"},ref:O},{children:[o.jsx(i.OverLapAbs,{ref:m,disabled:b.disabled,onClick:e=>{var o;e.stopPropagation(),null===(o=b.onDropdownOpen)||void 0===o||o.call(b),h?(D(!1),e.preventDefault()):b.disabled||D(!0)}}),a]})),h&&o.jsx(i.OpenDropdownContainer,Object.assign({ref:y,style:Object.assign(Object.assign({},S.popper),{zIndex:3})},C.popper,{children:o.jsx(n.default,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:o.jsx(s.OpenedDropdown,Object.assign({},b,{onSelect:e=>{var o;"2.0"===u&&b.isMultiSelect||(null===(o=b.onSelect)||void 0===o||o.call(b,e),D(!1))},onClose:q,version:u,headerRef:m}))}))}))]});return o.jsx(o.Fragment,{children:h||void 0===v?_():o.jsx(l.Tooltip,Object.assign({body:v,placement:j,hideArrow:!w},{children:o.jsx("div",{children:_()})}))})}));p.displayName="DropdownPopover",exports.DropdownPopover=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSelectedOptionsAsArray=function(e){return e&&e.length?e.map((e=>{var t;const n=e;return null!==(t=n.selectedLabel)&&void 0!==t?t:n.label})):[]},exports.getSelectedOptionsAsText=function(e){if(e&&e.length)return e.map((e=>{var t;const n=e;return null!==(t=n.selectedLabel)&&void 0!==t?t:n.label})).join(", ")},exports.iterateOnOptions=function(e,t,n){return e.map((e=>{if(e.options){const s=e.options.map((e=>!n||n(e)?Object.assign(Object.assign({},e),t):Object.assign({},e)));return Object.assign(Object.assign({},e),{options:[...s]})}return!n||n(e)?Object.assign(Object.assign({},e),t):Object.assign({},e)}))},exports.iterateOnOptionsRaw=function(e,t){e.forEach((e=>{e.options?e.options.forEach(t):t(e)}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSelectedOptionsAsText=function(t){if(t&&t.length)return t.map((t=>{var e;const n=t;return null!==(e=n.selectedLabel)&&void 0!==e?e:n.label})).join(", ")},exports.iterateOnOptions=function(t,e,n){return t.map((t=>{if(t.options){const s=t.options.map((t=>!n||n(t)?Object.assign(Object.assign({},t),e):Object.assign({},t)));return Object.assign(Object.assign({},t),{options:[...s]})}return!n||n(t)?Object.assign(Object.assign({},t),e):Object.assign({},t)}))},exports.iterateOnOptionsRaw=function(t,e){t.forEach((t=>{t.options?t.options.forEach(e):e(t)}))};
@@ -31,6 +31,7 @@
31
31
  svg:hover {
32
32
  cursor: pointer;
33
33
  background: ${t.COLORS.background.base};
34
+ border-radius: 4px;
34
35
  }
35
36
  ${t=>{let{headerStyle:o}=t;return e.css`
36
37
  ${Object.keys(o).map((e=>`${e}: ${o[e]};`)).join("\n")}
@@ -42,7 +43,7 @@
42
43
  ${t=>{let{bodyStyle:o}=t;return e.css`
43
44
  ${Object.keys(o).map((e=>`${e}: ${o[e]};`)).join("\n")}
44
45
  `}}
45
- `,l=r.default.div`
46
+ `,p=r.default.div`
46
47
  height: 60px;
47
48
  width: 100%;
48
49
  position: sticky;
@@ -57,8 +58,8 @@
57
58
  ${t=>{let{footerStyle:o}=t;return e.css`
58
59
  ${Object.keys(o).map((e=>`${e}: ${o[e]};`)).join("\n")}
59
60
  `}}
60
- `,p=r.default.div`
61
+ `,l=r.default.div`
61
62
  display: flex;
62
63
  flex-direction: ${e=>e.footerDirection||"row"};
63
64
  gap: 8px;
64
- `;exports.FooterButtonWrapper=p,exports.SideModalBody=s,exports.SideModalContainer=n,exports.SideModalFooter=l,exports.SideModalHeader=a,exports.SideModalStyle=d;
65
+ `;exports.FooterButtonWrapper=l,exports.SideModalBody=s,exports.SideModalContainer=n,exports.SideModalFooter=p,exports.SideModalHeader=a,exports.SideModalStyle=d;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
+ import { SingleOption } from './type';
2
3
  interface ChipInputProps {
3
- chips: string[];
4
- onDeleteChip: (chip: string, index: number) => void;
4
+ placeholder?: string;
5
+ chips: SingleOption[];
6
+ onDeleteChip: (chip: SingleOption) => void;
5
7
  containerStyle?: React.CSSProperties;
6
8
  isDropdownOpened?: boolean;
7
9
  sizeToUse?: 'default' | 'small';
8
- setDropdownVisibility?: React.Dispatch<React.SetStateAction<boolean>>;
9
10
  }
10
11
  declare const ChipInput: React.FC<ChipInputProps>;
11
12
  export default ChipInput;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{COLORS as s}from"../../constants/Theme.js";import o from"../../assets/icons/chevronDown.svg.js";import r from"../../assets/icons/cross.svg.js";import{Tag as n}from"../tag/Tag.js";import{BodyCaption as i}from"../TypographyStyle.js";import{ChipInputWrapper as c}from"./Common.styled.js";const l=l=>{let{chips:a,onDeleteChip:m,containerStyle:h={},sizeToUse:p="default",isDropdownOpened:d}=l;return e(c,Object.assign({style:Object.assign({},h)},{children:[e("div",Object.assign({className:"chips-container"},{children:[a.slice(0,2).map(((e,s)=>t("div",Object.assign({style:{zIndex:10}},{children:t(n,Object.assign({tagText:e,TrailingIcon:()=>t(r,{width:12,height:12,style:{cursor:"pointer"},onClick:t=>{t.preventDefault(),t.stopPropagation(),m(e,s)}})},{children:e}))}),s))),a.length>2&&t(i,Object.assign({color:s.content.placeholder},{children:`+${a.length-2} more`})),0===a.length&&t(i,Object.assign({color:s.content.placeholder},{children:"Select.."}))]})),t("div",{children:t(o,{style:{transform:d?"rotate(180deg)":"rotate(0deg)"},width:"small"===p?20:24,height:"small"===p?20:24,color:s.content.primary})})]}))};export{l as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{COLORS as s}from"../../constants/Theme.js";import o from"../../assets/icons/chevronDown.svg.js";import r from"../../assets/icons/cross.svg.js";import{Tag as l}from"../tag/Tag.js";import{BodyCaption as n}from"../TypographyStyle.js";import{ChipInputWrapper as i}from"./Common.styled.js";const c=c=>{let{chips:a,onDeleteChip:d,containerStyle:h={},sizeToUse:m="default",isDropdownOpened:g,placeholder:p="Select.."}=c;return e(i,Object.assign({style:Object.assign({},h)},{children:[e("div",Object.assign({className:"chips-container"},{children:[a.slice(0,2).map(((e,s)=>t("div",Object.assign({style:{zIndex:10}},{children:t(l,Object.assign({tagText:e.selectedLabel||e.label,TrailingIcon:()=>t(r,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{d(e)}})},{children:e.selectedLabel||e.label}))}),s))),a.length>2&&t(n,Object.assign({color:s.content.placeholder},{children:`+${a.length-2} more`})),0===a.length&&t("div",Object.assign({style:{color:s.content.placeholder}},{children:p}))]})),t("div",{children:t(o,{style:{transform:g?"rotate(180deg)":"rotate(0deg)"},width:"small"===m?20:24,height:"small"===m?20:24,color:s.content.primary})})]}))};export{c as default};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { OpenDropdownProps } from './type';
2
+ import { OpenDropdownProps, SingleOption } from './type';
3
3
  export type DropdownProps = OpenDropdownProps & {
4
4
  placeHolder?: string;
5
5
  size?: 'default' | 'small';
@@ -10,6 +10,6 @@ export type DropdownProps = OpenDropdownProps & {
10
10
  showPlaceholderWhenSelected?: boolean;
11
11
  inputStyle?: React.CSSProperties;
12
12
  inputType?: 'chip' | 'default';
13
- onDeleteChip?: (chip: string, index: number) => void;
13
+ onDeleteChip?: (chip: SingleOption) => void;
14
14
  };
15
15
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -1 +1 @@
1
- import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useState as n,useRef as i,useEffect as r}from"react";import{COLORS as l}from"../../constants/Theme.js";import s from"../../assets/icons/chevronDown.svg.js";import{Input as p}from"../input/Input.js";import{InputStyleContext as d}from"../input/context/InputStyleProvider.js";import a from"./ChipInput.js";import{DropdownPopover as c}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u,getSelectedOptionsAsArray as h}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var f,g,w,b,j,{placeHolder:y,size:D,onSelect:O,defaultOptions:H,disabled:S,noErrorHint:x,placeHolderHeight:C,showPlaceholderWhenSelected:I=!1,inputStyle:T={},inputType:E="default",onDeleteChip:P}=v,z=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip"]);const[W,V]=n(!1),A=null!=D?D:"default",_=i(),[k,M]=n(null!=H?H:[]);r((()=>{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)})),M([...o])}),[z.options]),r((()=>{H&&M([...H])}),[H]);const N=u(k),U=h(k);return o(d.Provider,Object.assign({value:{InputWrapper:Object.assign({height:C||("small"===A?32:48),width:null!==(g=null!==(f=z.buttonWidth)&&void 0!==f?f:z.width)&&void 0!==g?g:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},T),input:{minHeight:"100%"}}},{children:t(c,Object.assign({ref:_,onSelect:function(e){Array.isArray(e)?M([...e]):M([e]),null==O||O(e)},disabled:S,onDropdownVisbilityChange:e=>V(e)},z,{children:["default"==E&&o(p,{version:z.version,noErrorHint:x,state:S?"disabled":"none",value:I?y:null!=N?N:"",errorMessage:z.error,variant:A,placeholder:null!=y?y:"Select an option",width:null!==(w=z.width)&&void 0!==w?w:"100%",onChangeText:m,rightIcon:{icon:()=>o(s,{style:{transform:W?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"small"===A?20:24,height:"small"===A?20:24,color:l.content.primary})},truncateText:!0}),"chip"==E&&o(a,{chips:U,onDeleteChip:(e,o)=>{null==P||P(e,o),console.log("onDeleteChip",e,o)},isDropdownOpened:W,sizeToUse:A,containerStyle:{width:null!==(b=z.width)&&void 0!==b?b:"100%",cursor:"pointer"},setDropdownVisibility:null===(j=null==_?void 0:_.current)||void 0===j?void 0:j.setDropdownVisibility})]}))}))};v.displayName="Dropdown";export{v as Dropdown};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useState as n,useRef as i,useEffect as r}from"react";import{COLORS as l}from"../../constants/Theme.js";import s from"../../assets/icons/chevronDown.svg.js";import{Input as p}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import d from"./ChipInput.js";import{DropdownPopover as c}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function h(){}const m=m=>{var f,v,g,w,{placeHolder:b,size:j,onSelect:y,defaultOptions:O,disabled:S,noErrorHint:H,placeHolderHeight:x,showPlaceholderWhenSelected:D=!1,inputStyle:C={},inputType:I="default",onDeleteChip:T}=m,E=e(m,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip"]);const[P,z]=n(!1),W=null!=j?j:"default",A=i(),[_,k]=n(null!=O?O:[]);r((()=>{var e;const o=[];null===(e=null==E?void 0:E.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)})),k([...o])}),[E.options]),r((()=>{O&&k([...O])}),[O]);const M=u(_);return o(a.Provider,Object.assign({value:{InputWrapper:Object.assign({height:x||("small"===W?32:48),width:null!==(v=null!==(f=E.buttonWidth)&&void 0!==f?f:E.width)&&void 0!==v?v:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},C),input:{minHeight:"100%"}}},{children:t(c,Object.assign({ref:A,onSelect:function(e){Array.isArray(e)?k([...e]):k([e]),null==y||y(e)},disabled:S,onDropdownVisbilityChange:e=>z(e)},E,{children:["default"==I&&o(p,{version:E.version,noErrorHint:H,state:S?"disabled":"none",value:D?b:null!=M?M:"",errorMessage:E.error,variant:W,placeholder:null!=b?b:"Select an option",width:null!==(g=E.width)&&void 0!==g?g:"100%",onChangeText:h,rightIcon:{icon:()=>o(s,{style:{transform:P?"rotate(180deg)":"rotate(0deg)"},onClick:h,width:"small"===W?20:24,height:"small"===W?20:24,color:l.content.primary})},truncateText:!0}),"chip"==I&&o(d,{placeholder:null!=b?b:"Select options",chips:_,onDeleteChip:e=>{null==T||T(e)},isDropdownOpened:P,sizeToUse:W,containerStyle:{width:null!==(w=E.width)&&void 0!==w?w:"100%",cursor:"pointer"}})]}))}))};m.displayName="Dropdown";export{m as Dropdown};
@@ -1 +1 @@
1
- import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import t,{useState as i,useRef as l,useImperativeHandle as s,useEffect as p}from"react";import{usePopper as d}from"react-popper";import a from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as m,OpenDropdownContainer as v}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const w=t.forwardRef(((t,w)=>{var{children:b,onDropdownVisbilityChange:h,version:f="1.0",tooltipContent:D,tooltipDirection:j,showTooltipArrow:g}=t,y=o(t,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const O=w,[C,S]=i(!1),[x,A]=i(null),[R,T]=i(null),V=l(null),{styles:z,attributes:M}=d(x,R,{placement:y.placement,strategy:y.strategy}),P=o=>{var e,n;"2.0"===f&&y.isMultiSelect&&o&&(null===(e=y.onSelect)||void 0===e||e.call(y,[...o])),S(!1),null===(n=null==y?void 0:y.onClose)||void 0===n||n.call(y)};s(O,(()=>({openDropdown:C,closeDropdown:()=>S(!1),openDropdownFn:()=>S(!0),setDropdownVisibility:S})),[]),p((()=>{(null==O?void 0:O.current)&&(O.current.openDropdown=C)}),[C]),p((()=>{null==h||h(C)}),[C]);const _=()=>r(n,{children:[r("div",Object.assign({style:{position:"relative"},ref:A},{children:[e(m,{ref:V,disabled:y.disabled,onClick:o=>{var e;o.stopPropagation(),null===(e=y.onDropdownOpen)||void 0===e||e.call(y),C?(S(!1),o.preventDefault()):y.disabled||S(!0)}}),b]})),C&&e(v,Object.assign({ref:T,style:Object.assign(Object.assign({},z.popper),{zIndex:3})},M.popper,{children:e(a,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:e(u,Object.assign({},y,{onSelect:o=>{var e;"2.0"===f&&y.isMultiSelect||(null===(e=y.onSelect)||void 0===e||e.call(y,o),S(!1))},onClose:P,version:f,headerRef:V}))}))}))]});return e(n,{children:C||void 0===D?_():e(c,Object.assign({body:D,placement:j,hideArrow:!g},{children:e("div",{children:_()})}))})}));w.displayName="DropdownPopover";export{w as DropdownPopover};
1
+ import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import t,{useState as i,useRef as l,useImperativeHandle as s,useEffect as p}from"react";import{usePopper as d}from"react-popper";import a from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as m,OpenDropdownContainer as v}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const h=t.forwardRef(((t,h)=>{var{children:w,onDropdownVisbilityChange:b,version:f="1.0",tooltipContent:j,tooltipDirection:g,showTooltipArrow:D}=t,y=o(t,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const O=h,[C,S]=i(!1),[x,A]=i(null),[R,T]=i(null),z=l(null),{styles:M,attributes:P}=d(x,R,{placement:y.placement,strategy:y.strategy}),V=o=>{var e,r;"2.0"===f&&y.isMultiSelect&&o&&(null===(e=y.onSelect)||void 0===e||e.call(y,[...o])),S(!1),null===(r=null==y?void 0:y.onClose)||void 0===r||r.call(y)};s(O,(()=>({openDropdown:C})),[]),p((()=>{(null==O?void 0:O.current)&&(O.current.openDropdown=C)}),[C]),p((()=>{null==b||b(C)}),[C]);const _=()=>n(r,{children:[n("div",Object.assign({style:{position:"relative"},ref:A},{children:[e(m,{ref:z,disabled:y.disabled,onClick:o=>{var e;o.stopPropagation(),null===(e=y.onDropdownOpen)||void 0===e||e.call(y),C?(S(!1),o.preventDefault()):y.disabled||S(!0)}}),w]})),C&&e(v,Object.assign({ref:T,style:Object.assign(Object.assign({},M.popper),{zIndex:3})},P.popper,{children:e(a,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:e(u,Object.assign({},y,{onSelect:o=>{var e;"2.0"===f&&y.isMultiSelect||(null===(e=y.onSelect)||void 0===e||e.call(y,o),S(!1))},onClose:V,version:f,headerRef:z}))}))}))]});return e(r,{children:C||void 0===j?_():e(c,Object.assign({body:j,placement:g,hideArrow:!D},{children:e("div",{children:_()})}))})}));h.displayName="DropdownPopover";export{h as DropdownPopover};
@@ -1 +1 @@
1
- function n(n,t,e){return n.map((n=>{if(n.options){const s=n.options.map((n=>!e||e(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)));return Object.assign(Object.assign({},n),{options:[...s]})}return!e||e(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)}))}function t(n,t){n.forEach((n=>{n.options?n.options.forEach(t):t(n)}))}function e(n){if(n&&n.length)return n.map((n=>{var t;const e=n;return null!==(t=e.selectedLabel)&&void 0!==t?t:e.label})).join(", ")}function s(n){return n&&n.length?n.map((n=>{var t;const e=n;return null!==(t=e.selectedLabel)&&void 0!==t?t:e.label})):[]}export{s as getSelectedOptionsAsArray,e as getSelectedOptionsAsText,n as iterateOnOptions,t as iterateOnOptionsRaw};
1
+ function n(n,t,s){return n.map((n=>{if(n.options){const e=n.options.map((n=>!s||s(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)));return Object.assign(Object.assign({},n),{options:[...e]})}return!s||s(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)}))}function t(n,t){n.forEach((n=>{n.options?n.options.forEach(t):t(n)}))}function s(n){if(n&&n.length)return n.map((n=>{var t;const s=n;return null!==(t=s.selectedLabel)&&void 0!==t?t:s.label})).join(", ")}export{s as getSelectedOptionsAsText,n as iterateOnOptions,t as iterateOnOptionsRaw};
@@ -31,6 +31,7 @@ import e,{css as t}from"styled-components";import{COLORS as o}from"../../constan
31
31
  svg:hover {
32
32
  cursor: pointer;
33
33
  background: ${o.background.base};
34
+ border-radius: 4px;
34
35
  }
35
36
  ${e=>{let{headerStyle:o}=e;return t`
36
37
  ${Object.keys(o).map((e=>`${e}: ${o[e]};`)).join("\n")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.552-beta.2",
3
+ "version": "0.0.552-beta.4",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",