@bikdotai/bik-component-library 0.0.673-beta.0 → 0.0.673-beta.1

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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -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"),r=require("../../constants/Theme.js"),l=require("../../assets/icons/chevronDown.svg.js"),n=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/errorInfo.svg.js"),a=require("../input/Input.styled.js"),o=require("../tag/Tag.js"),c=require("../tooltips/Tooltip.js"),d=require("../TypographyStyle.js"),h=require("./Common.styled.js");exports.default=g=>{let{chips:j,onDeleteChip:u,containerStyle:p={},sizeToUse:x="default",isDropdownOpened:b,placeholder:m="Select..",errorMessage:O="",showLabelsOnMoreHover:y=!1}=g;const[v,f]=t.useState(),[q,S]=t.useState(0),[T,C]=t.useState([]);return t.useEffect((()=>{if(!j)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(j);let s=j.filter((s=>(e+=s.label.length,e<=t)));0===s.length&&j.length>0&&(s=[j[0]]),f(s);const r=j.filter((e=>!s.includes(e))).map((e=>e.label));C(r),S(j.length-s.length)}),[j]),e.jsxs(e.Fragment,{children:[e.jsxs(h.ChipInputWrapper,Object.assign({style:Object.assign({},p),error:!!O},{children:[e.jsxs("div",Object.assign({className:"chips-container"},{children:[null==v?void 0:v.map(((t,r)=>e.jsx("div",Object.assign({style:{zIndex:2}},{children:e.jsx(o.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:()=>{u(t)}})},{children:t.selectedLabel||t.label}))}),r))),!!q&&e.jsx(c.Tooltip,Object.assign({body:"",placement:"bottom",tooltipContent:y&&T.length>0?e.jsx("div",Object.assign({style:{padding:"4px"}},{children:T.map(((t,s)=>e.jsx("div",{children:t},s)))})):e.jsx(e.Fragment,{})},{children:e.jsx(d.BodyCaption,Object.assign({color:r.COLORS.content.placeholder},{children:`+${q} more`}))})),0===j.length&&e.jsx("div",Object.assign({style:{color:r.COLORS.content.placeholder}},{children:m}))]})),e.jsx("div",{children:e.jsx(l.default,{style:{transform:b?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===x?16:"small"===x?20:24,height:"x-small"===x?16:"small"===x?20:24,color:r.COLORS.content.primary})})]})),!!O&&e.jsxs(a.InputFooter,Object.assign({invalid:!0},{children:[!!O&&e.jsx(i.default,{width:16,height:16}),O]}))]})};
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"),i=require("../../assets/icons/cross.svg.js"),n=require("../../assets/icons/errorInfo.svg.js"),o=require("../input/Input.styled.js"),a=require("../tag/Tag.js"),c=require("../tooltips/Tooltip.js"),d=require("../TypographyStyle.js"),h=require("./Common.styled.js");exports.default=j=>{let{chips:g,onDeleteChip:u,containerStyle:p={},sizeToUse:x="default",isDropdownOpened:O,placeholder:b="Select..",errorMessage:y="",showLabelsOnMoreHover:m=!1}=j;const[v,f]=t.useState(),[q,C]=t.useState(0),[S,T]=t.useState([]);return t.useEffect((()=>{if(!g)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(g);let s=g.filter((s=>(e+=s.label.length,e<=t)));0===s.length&&g.length>0&&(s=[g[0]]),f(s);const l=g.filter((e=>!s.includes(e))).map((e=>e.label));T(l),C(g.length-s.length)}),[g]),e.jsxs(e.Fragment,{children:[e.jsxs(h.ChipInputWrapper,Object.assign({style:Object.assign({},p),error:!!y},{children:[e.jsxs("div",Object.assign({className:"chips-container"},{children:[null==v?void 0:v.map(((t,l)=>e.jsx("div",Object.assign({style:{zIndex:2}},{children:e.jsx(a.Tag,Object.assign({tagText:s.default.truncateText(t.selectedLabel||t.label,40),TrailingIcon:()=>e.jsx(i.default,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{u(t)}})},{children:t.selectedLabel||t.label}))}),l))),!!q&&e.jsx("div",Object.assign({style:{position:"relative",zIndex:10,pointerEvents:"auto"}},{children:e.jsx(c.Tooltip,Object.assign({body:"",placement:"bottom",tooltipContent:m&&S.length>0?e.jsx("div",Object.assign({style:{padding:"4px"}},{children:S.map(((t,s)=>e.jsx(d.BodyCaption,Object.assign({style:{color:l.COLORS.text.white}},{children:t}),s)))})):void 0},{children:e.jsx(d.BodyCaption,Object.assign({color:l.COLORS.content.placeholder},{children:`+${q} more`}))}))})),0===g.length&&e.jsx("div",Object.assign({style:{color:l.COLORS.content.placeholder}},{children:b}))]})),e.jsx("div",{children:e.jsx(r.default,{style:{transform:O?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===x?16:"small"===x?20:24,height:"x-small"===x?16:"small"===x?20:24,color:l.COLORS.content.primary})})]})),!!y&&e.jsxs(o.InputFooter,Object.assign({invalid:!0},{children:[!!y&&e.jsx(n.default,{width:16,height:16}),y]}))]})};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- import{jsxs as e,Fragment as t,jsx as s}from"react/jsx-runtime";import{useState as l,useEffect as o}from"react";import r from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import i from"../../assets/icons/chevronDown.svg.js";import c from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/errorInfo.svg.js";import{InputFooter as d}from"../input/Input.styled.js";import{Tag as m}from"../tag/Tag.js";import{Tooltip as h}from"../tooltips/Tooltip.js";import{BodyCaption as p}from"../TypographyStyle.js";import{ChipInputWrapper as g}from"./Common.styled.js";const j=j=>{let{chips:b,onDeleteChip:f,containerStyle:y={},sizeToUse:v="default",isDropdownOpened:u,placeholder:O="Select..",errorMessage:x="",showLabelsOnMoreHover:T=!1}=j;const[w,C]=l(),[I,S]=l(0),[D,L]=l([]);return o((()=>{if(!b)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(b);let s=b.filter((s=>(e+=s.label.length,e<=t)));0===s.length&&b.length>0&&(s=[b[0]]),C(s);const l=b.filter((e=>!s.includes(e))).map((e=>e.label));L(l),S(b.length-s.length)}),[b]),e(t,{children:[e(g,Object.assign({style:Object.assign({},y),error:!!x},{children:[e("div",Object.assign({className:"chips-container"},{children:[null==w?void 0:w.map(((e,t)=>s("div",Object.assign({style:{zIndex:2}},{children:s(m,Object.assign({tagText:r.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>s(c,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{f(e)}})},{children:e.selectedLabel||e.label}))}),t))),!!I&&s(h,Object.assign({body:"",placement:"bottom",tooltipContent:T&&D.length>0?s("div",Object.assign({style:{padding:"4px"}},{children:D.map(((e,t)=>s("div",{children:e},t)))})):s(t,{})},{children:s(p,Object.assign({color:n.content.placeholder},{children:`+${I} more`}))})),0===b.length&&s("div",Object.assign({style:{color:n.content.placeholder}},{children:O}))]})),s("div",{children:s(i,{style:{transform:u?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===v?16:"small"===v?20:24,height:"x-small"===v?16:"small"===v?20:24,color:n.content.primary})})]})),!!x&&e(d,Object.assign({invalid:!0},{children:[!!x&&s(a,{width:16,height:16}),x]}))]})};export{j as default};
1
+ import{jsxs as e,Fragment as t,jsx as s}from"react/jsx-runtime";import{useState as o,useEffect as l}from"react";import i from"../../utils/StringUtils.js";import{COLORS as r}from"../../constants/Theme.js";import n from"../../assets/icons/chevronDown.svg.js";import c from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/errorInfo.svg.js";import{InputFooter as d}from"../input/Input.styled.js";import{Tag as h}from"../tag/Tag.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodyCaption as p}from"../TypographyStyle.js";import{ChipInputWrapper as g}from"./Common.styled.js";const j=j=>{let{chips:b,onDeleteChip:f,containerStyle:v={},sizeToUse:y="default",isDropdownOpened:O,placeholder:u="Select..",errorMessage:x="",showLabelsOnMoreHover:T=!1}=j;const[w,I]=o(),[C,S]=o(0),[z,D]=o([]);return l((()=>{if(!b)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(b);let s=b.filter((s=>(e+=s.label.length,e<=t)));0===s.length&&b.length>0&&(s=[b[0]]),I(s);const o=b.filter((e=>!s.includes(e))).map((e=>e.label));D(o),S(b.length-s.length)}),[b]),e(t,{children:[e(g,Object.assign({style:Object.assign({},v),error:!!x},{children:[e("div",Object.assign({className:"chips-container"},{children:[null==w?void 0:w.map(((e,t)=>s("div",Object.assign({style:{zIndex:2}},{children:s(h,Object.assign({tagText:i.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>s(c,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{f(e)}})},{children:e.selectedLabel||e.label}))}),t))),!!C&&s("div",Object.assign({style:{position:"relative",zIndex:10,pointerEvents:"auto"}},{children:s(m,Object.assign({body:"",placement:"bottom",tooltipContent:T&&z.length>0?s("div",Object.assign({style:{padding:"4px"}},{children:z.map(((e,t)=>s(p,Object.assign({style:{color:r.text.white}},{children:e}),t)))})):void 0},{children:s(p,Object.assign({color:r.content.placeholder},{children:`+${C} more`}))}))})),0===b.length&&s("div",Object.assign({style:{color:r.content.placeholder}},{children:u}))]})),s("div",{children:s(n,{style:{transform:O?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===y?16:"small"===y?20:24,height:"x-small"===y?16:"small"===y?20:24,color:r.content.primary})})]})),!!x&&e(d,Object.assign({invalid:!0},{children:[!!x&&s(a,{width:16,height:16}),x]}))]})};export{j as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.673-beta.0",
3
+ "version": "0.0.673-beta.1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",