@bikdotai/bik-component-library 0.0.552-beta.8 → 0.0.552-beta.9
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("react/jsx-runtime"),t=require("react"),s=require("../../utils/StringUtils.js"),l=require("../../constants/Theme.js"),r=require("../../assets/icons/chevronDown.svg.js"),n=require("../../assets/icons/cross.svg.js"),i=require("../tag/Tag.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../utils/StringUtils.js"),l=require("../../constants/Theme.js"),r=require("../../assets/icons/chevronDown.svg.js"),n=require("../../assets/icons/cross.svg.js"),i=require("../tag/Tag.js"),o=require("../TypographyStyle.js"),c=require("./Common.styled.js");exports.default=a=>{let{chips:d,onDeleteChip:h,containerStyle:g={},sizeToUse:u="default",isDropdownOpened:j,placeholder:p="Select.."}=a;const[x,O]=t.useState(),[b,y]=t.useState(0);return t.useEffect((()=>{if(!d||!(null==d?void 0:d.length))return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(d);let s=d.filter((s=>(e+=s.label.length,e<=t)));console.log("options",s),console.log("chips",d),O(s),y(d.length-s.length)}),[d]),e.jsxs(c.ChipInputWrapper,Object.assign({style:Object.assign({},g)},{children:[e.jsxs("div",Object.assign({className:"chips-container"},{children:[null==x?void 0:x.map(((t,l)=>e.jsx("div",Object.assign({style:{zIndex:2}},{children:e.jsx(i.Tag,Object.assign({tagText:s.default.truncateText(t.selectedLabel||t.label,40),TrailingIcon:()=>e.jsx(n.default,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{h(t)}})},{children:t.selectedLabel||t.label}))}),l))),!!b&&e.jsx(o.BodyCaption,Object.assign({color:l.COLORS.content.placeholder},{children:`+${b} more`})),0===d.length&&e.jsx("div",Object.assign({style:{color:l.COLORS.content.placeholder}},{children:p}))]})),e.jsx("div",{children:e.jsx(r.default,{style:{transform:j?"rotate(180deg)":"rotate(0deg)"},width:"small"===u?20:24,height:"small"===u?20:24,color:l.COLORS.content.primary})})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as l}from"react";import s from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import r from"../../assets/icons/chevronDown.svg.js";import i from"../../assets/icons/cross.svg.js";import{Tag as c}from"../tag/Tag.js";import{BodyCaption as a}from"../TypographyStyle.js";import{ChipInputWrapper as h}from"./Common.styled.js";const m=m=>{let{chips:d,onDeleteChip:g,containerStyle:p={},sizeToUse:j="default",isDropdownOpened:f,placeholder:b="Select.."}=m;const[y,u]=o(),[v,O]=o(0);return l((()=>{if(!d||!(null==d?void 0:d.length))return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(d);let o=d.filter((o=>(e+=o.label.length,e<=t)));console.log("options",o),console.log("chips",d),u(o),O(d.length-o.length)}),[d]),e(h,Object.assign({style:Object.assign({},p)},{children:[e("div",Object.assign({className:"chips-container"},{children:[null==y?void 0:y.map(((e,o)=>t("div",Object.assign({style:{zIndex:2}},{children:t(c,Object.assign({tagText:s.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>t(i,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{g(e)}})},{children:e.selectedLabel||e.label}))}),o))),!!v&&t(a,Object.assign({color:n.content.placeholder},{children:`+${v} more`})),0===d.length&&t("div",Object.assign({style:{color:n.content.placeholder}},{children:b}))]})),t("div",{children:t(r,{style:{transform:f?"rotate(180deg)":"rotate(0deg)"},width:"small"===j?20:24,height:"small"===j?20:24,color:n.content.primary})})]}))};export{m as default};
|