@bikdotai/bik-component-library 0.0.673-beta.1 → 0.0.673
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/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/checkBox/CheckBox.d.ts +0 -1
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.d.ts +0 -2
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/Common.styled.d.ts +1 -3
- package/dist/cjs/components/dropdown/Common.styled.js +4 -4
- package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/checkBox/CheckBox.d.ts +0 -1
- package/dist/esm/components/checkBox/CheckBox.js +1 -1
- package/dist/esm/components/dropdown/ChipInput.d.ts +0 -2
- package/dist/esm/components/dropdown/ChipInput.js +1 -1
- package/dist/esm/components/dropdown/Common.styled.d.ts +1 -3
- package/dist/esm/components/dropdown/Common.styled.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=s=>{const l=i.useMemo((()=>s.activeColor||t.COLORS.background.positive.vibrant),[s.activeColor]);return e.jsxs("svg",Object.assign({width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",viewBox:s.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",rx:"4",fill:s.isDisabled?t.COLORS.content.inactive:l}),!s.isPartial&&e.jsx("svg",Object.assign({width:s.isSmall?"8":"10",height:s.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e.jsx("rect",{x:"5",y:s.isSmall?"7":"8",width:s.isSmall?"6":"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}))};exports.CheckBox=r=>{var o;const[c,d]=i.useState(r.isChecked||!1),[n,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./CheckBox.styled.js"),l=require("../TypographyStyle.js"),t=require("../../constants/Theme.js");const a=s=>{const l=i.useMemo((()=>s.activeColor||t.COLORS.background.positive.vibrant),[s.activeColor]);return e.jsxs("svg",Object.assign({width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",viewBox:s.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("rect",{x:"0",y:"0",width:s.isSmall?"16":"18",height:s.isSmall?"16":"18",rx:"4",fill:s.isDisabled?t.COLORS.content.inactive:l}),!s.isPartial&&e.jsx("svg",Object.assign({width:s.isSmall?"8":"10",height:s.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),s.isPartial&&e.jsx("rect",{x:"5",y:s.isSmall?"7":"8",width:s.isSmall?"6":"8",height:"2",rx:"1",fill:t.COLORS.surface.standard})]}))};exports.CheckBox=r=>{var o;const[c,d]=i.useState(r.isChecked||!1),[n,h]=i.useState(r.isPartiallyChecked||!1),[b,x]=i.useState(r.isDisabled||!1),[C,S]=i.useState(!1),[u,O]=i.useState(!1);i.useEffect((()=>{d(r.isChecked)}),[r.isChecked]),i.useEffect((()=>{x(r.isDisabled||!1)}),[r.isDisabled]),i.useEffect((()=>{h(r.isPartiallyChecked||!1)}),[r.isPartiallyChecked]);return e.jsxs(s.CheckboxContainer,Object.assign({onClick:e=>{var i;if(!r.isDisabled){const s=!c;n?h(!n):d(s),null===(i=r.onValueChange)||void 0===i||i.call(r,s,r.value,e)}},onMouseEnter:()=>S(!r.skipHoverState),onMouseLeave:()=>S(!1),onMouseDown:()=>O(!r.skipHoverState),onMouseUp:()=>O(!1),isDisabled:b,enableHover:r.enableHover,style:null!==(o=r.style)&&void 0!==o?o:{}},{children:[e.jsx(s.CheckboxIcon,Object.assign({checked:c,hovered:C,clicked:u,isDisabled:b,size:r.size,borderColor:r.checkboxBorderColor},{children:c&&e.jsx(a,{isPartial:n||!1,isDisabled:b,isSmall:"SMALL"===r.size,activeColor:null==r?void 0:r.activeColor})})),r.label?r.boldOnChecked&&c?"DEFAULT"===r.labelSize?e.jsx(l.TitleRegular,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(l.TitleSmall,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):"SMALL"===r.size||"SMALL"===r.labelSize?e.jsx(l.BodySecondary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(l.BodyPrimary,Object.assign({color:r.isDisabled?t.COLORS.text.disabled:t.COLORS.text.primary},{children:r.label})):e.jsx(e.Fragment,{}),r.rightComponent]}))};
|
|
@@ -7,8 +7,6 @@ interface ChipInputProps {
|
|
|
7
7
|
containerStyle?: React.CSSProperties;
|
|
8
8
|
isDropdownOpened?: boolean;
|
|
9
9
|
sizeToUse?: 'default' | 'small' | 'x-small';
|
|
10
|
-
errorMessage?: string;
|
|
11
|
-
showLabelsOnMoreHover?: boolean;
|
|
12
10
|
}
|
|
13
11
|
declare const ChipInput: React.FC<ChipInputProps>;
|
|
14
12
|
export default ChipInput;
|
|
@@ -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"),
|
|
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"),a=require("../TypographyStyle.js"),c=require("./Common.styled.js");exports.default=o=>{let{chips:d,onDeleteChip:h,containerStyle:g={},sizeToUse:u="default",isDropdownOpened:j,placeholder:p="Select.."}=o;const[x,O]=t.useState(),[b,m]=t.useState(0);return t.useEffect((()=>{if(!d)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)));0===s.length&&d.length>0&&(s=[d[0]]),O(s),m(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(a.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:"x-small"===u?16:"small"===u?20:24,height:"x-small"===u?16:"small"===u?20:24,color:l.COLORS.content.primary})})]}))};
|
|
@@ -4,6 +4,4 @@ export declare const OverLapAbs: import("styled-components").StyledComponent<"di
|
|
|
4
4
|
}, never>;
|
|
5
5
|
export declare const OpenDropdownContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const LoadingContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export declare const ChipInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
-
error?: boolean | undefined;
|
|
9
|
-
}, never>;
|
|
7
|
+
export declare const ChipInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
height: 100%;
|
|
9
9
|
z-index: 2;
|
|
10
10
|
cursor: ${e=>(null==e?void 0:e.disabled)?"not-allowed":"pointer"};
|
|
11
|
-
`,
|
|
11
|
+
`,p=r.default.div`
|
|
12
12
|
margin-top: 8px;
|
|
13
13
|
margin-bottom: 8px;
|
|
14
14
|
`;r.default.div`
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
background: ${t.COLORS.surface.hovered};
|
|
20
20
|
border: 1px solid ${t.COLORS.stroke.primary};
|
|
21
21
|
border-radius: 4px;
|
|
22
|
-
`;const
|
|
22
|
+
`;const n=r.default.div`
|
|
23
23
|
width: 360px;
|
|
24
24
|
height: 100%;
|
|
25
25
|
padding: 8px;
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
justify-content: space-between;
|
|
28
28
|
align-items: center;
|
|
29
29
|
border-radius: 4px;
|
|
30
|
-
border:
|
|
30
|
+
border: 1px solid ${t.COLORS.stroke.primary};
|
|
31
31
|
.chips-container {
|
|
32
32
|
display: flex;
|
|
33
33
|
gap: 8px;
|
|
34
34
|
flex-wrap: wrap;
|
|
35
35
|
align-items: center;
|
|
36
36
|
}
|
|
37
|
-
`;exports.ChipInputWrapper=
|
|
37
|
+
`;exports.ChipInputWrapper=n,exports.OpenDropdownContainer=p,exports.OverLapAbs=o;
|
|
@@ -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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),l=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=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 u(){}const c=c=>{var p,h,v,g,x,{placeHolder:j,size:f,onSelect:w,defaultOptions:I,disabled:b,noErrorHint:y,placeHolderHeight:O,showPlaceholderWhenSelected:S=!1,inputStyle:m={},inputType:D="default",onDeleteChip:P,truncatedText:T,showLeadingIconInPlaceholder:q=!1,showTrailingIconPlaceholder:H=!1}=c,C=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder"]);const[E,_]=n.useState(!1),z=null!=f?f:"default",W=n.useRef(),[A,L]=n.useState(null!=I?I:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==C?void 0:C.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)})),L([...t])}),[C.options]),n.useEffect((()=>{I&&L([...I])}),[I]);const M=d.getSelectedOptionsAsText(A);return t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("x-small"===z?24:"small"===z?32:48),width:null!==(h=null!==(p=C.buttonWidth)&&void 0!==p?p:C.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===z?"4px 8px":"6px 8px"},m),input:{minHeight:"100%"}}},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":C["data-test"],ref:W,onSelect:function(e){Array.isArray(e)?L([...e]):L([e]),null==w||w(e)},disabled:b,onDropdownVisbilityChange:e=>_(e)},C,{children:["default"==D&&t.jsx(i.Input,{version:C.version,noErrorHint:y,state:b?"disabled":"none",value:S?j:null!=M?M:"",errorMessage:C.error,variant:z,placeholder:null!=j?j:"Select an option",width:null!==(v=C.width)&&void 0!==v?v:"100%",onChangeText:u,leftIcon:q&&(null===(g=A[0])||void 0===g?void 0:g.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=A[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[H&&(null===(e=A[0])||void 0===e?void 0:e.trailingIcon),t.jsx(o.default,{style:{transform:E?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"x-small"===z?16:"small"===z?20:24,height:"x-small"===z?16:"small"===z?20:24,color:l.COLORS.content.primary})]}))}},truncateText:null==T||T}),"chip"==D&&t.jsx(s.default,{placeholder:null!=j?j:"Select options",chips:A,onDeleteChip:e=>{null==P||P(e)},isDropdownOpened:E,sizeToUse:z,containerStyle:{width:null!==(x=C.width)&&void 0!==x?x:"100%",cursor:"pointer"}})]}))}))};c.displayName="Dropdown",exports.Dropdown=c;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as s,useEffect as t,useMemo as a}from"react";import{CheckboxContainer as o,CheckboxIcon as r}from"./CheckBox.styled.js";import{TitleRegular as d,TitleSmall as n,BodySecondary as c,BodyPrimary as
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as s,useEffect as t,useMemo as a}from"react";import{CheckboxContainer as o,CheckboxIcon as r}from"./CheckBox.styled.js";import{TitleRegular as d,TitleSmall as n,BodySecondary as c,BodyPrimary as h}from"../TypographyStyle.js";import{COLORS as b}from"../../constants/Theme.js";const m=l=>{const s=a((()=>l.activeColor||b.background.positive.vibrant),[l.activeColor]);return e("svg",Object.assign({width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",viewBox:l.isSmall?"0 0 16 16":"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[i("rect",{x:"0",y:"0",width:l.isSmall?"16":"18",height:l.isSmall?"16":"18",rx:"4",fill:l.isDisabled?b.content.inactive:s}),!l.isPartial&&i("svg",Object.assign({width:l.isSmall?"8":"10",height:l.isSmall?"7":"9",x:"4",y:"4",viewBox:"0 0 10 9",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z",fill:"white"})})),l.isPartial&&i("rect",{x:"5",y:l.isSmall?"7":"8",width:l.isSmall?"6":"8",height:"2",rx:"1",fill:b.surface.standard})]}))},v=a=>{var v;const[g,C]=s(a.isChecked||!1),[p,x]=s(a.isPartiallyChecked||!1),[S,u]=s(a.isDisabled||!1),[w,y]=s(!1),[k,D]=s(!1);t((()=>{C(a.isChecked)}),[a.isChecked]),t((()=>{u(a.isDisabled||!1)}),[a.isDisabled]),t((()=>{x(a.isPartiallyChecked||!1)}),[a.isPartiallyChecked]);return e(o,Object.assign({onClick:e=>{var i;if(!a.isDisabled){const l=!g;p?x(!p):C(l),null===(i=a.onValueChange)||void 0===i||i.call(a,l,a.value,e)}},onMouseEnter:()=>y(!a.skipHoverState),onMouseLeave:()=>y(!1),onMouseDown:()=>D(!a.skipHoverState),onMouseUp:()=>D(!1),isDisabled:S,enableHover:a.enableHover,style:null!==(v=a.style)&&void 0!==v?v:{}},{children:[i(r,Object.assign({checked:g,hovered:w,clicked:k,isDisabled:S,size:a.size,borderColor:a.checkboxBorderColor},{children:g&&i(m,{isPartial:p||!1,isDisabled:S,isSmall:"SMALL"===a.size,activeColor:null==a?void 0:a.activeColor})})),a.label?a.boldOnChecked&&g?"DEFAULT"===a.labelSize?i(d,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(n,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):"SMALL"===a.size||"SMALL"===a.labelSize?i(c,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(h,Object.assign({color:a.isDisabled?b.text.disabled:b.text.primary},{children:a.label})):i(l,{}),a.rightComponent]}))};export{v as CheckBox};
|
|
@@ -7,8 +7,6 @@ interface ChipInputProps {
|
|
|
7
7
|
containerStyle?: React.CSSProperties;
|
|
8
8
|
isDropdownOpened?: boolean;
|
|
9
9
|
sizeToUse?: 'default' | 'small' | 'x-small';
|
|
10
|
-
errorMessage?: string;
|
|
11
|
-
showLabelsOnMoreHover?: boolean;
|
|
12
10
|
}
|
|
13
11
|
declare const ChipInput: React.FC<ChipInputProps>;
|
|
14
12
|
export default ChipInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useEffect as s}from"react";import r from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import n 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 m}from"./Common.styled.js";const h=h=>{let{chips:d,onDeleteChip:g,containerStyle:p={},sizeToUse:j="default",isDropdownOpened:f,placeholder:b="Select.."}=h;const[y,u]=l(),[v,O]=l(0);return s((()=>{if(!d)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(d);let l=d.filter((l=>(e+=l.label.length,e<=t)));0===l.length&&d.length>0&&(l=[d[0]]),u(l),O(d.length-l.length)}),[d]),e(m,Object.assign({style:Object.assign({},p)},{children:[e("div",Object.assign({className:"chips-container"},{children:[null==y?void 0:y.map(((e,l)=>t("div",Object.assign({style:{zIndex:2}},{children:t(c,Object.assign({tagText:r.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>t(i,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{g(e)}})},{children:e.selectedLabel||e.label}))}),l))),!!v&&t(a,Object.assign({color:o.content.placeholder},{children:`+${v} more`})),0===d.length&&t("div",Object.assign({style:{color:o.content.placeholder}},{children:b}))]})),t("div",{children:t(n,{style:{transform:f?"rotate(180deg)":"rotate(0deg)"},width:"x-small"===j?16:"small"===j?20:24,height:"x-small"===j?16:"small"===j?20:24,color:o.content.primary})})]}))};export{h as default};
|
|
@@ -4,6 +4,4 @@ export declare const OverLapAbs: import("styled-components").StyledComponent<"di
|
|
|
4
4
|
}, never>;
|
|
5
5
|
export declare const OpenDropdownContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const LoadingContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export declare const ChipInputWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
-
error?: boolean | undefined;
|
|
9
|
-
}, never>;
|
|
7
|
+
export declare const ChipInputWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -27,7 +27,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
27
27
|
justify-content: space-between;
|
|
28
28
|
align-items: center;
|
|
29
29
|
border-radius: 4px;
|
|
30
|
-
border:
|
|
30
|
+
border: 1px solid ${i.stroke.primary};
|
|
31
31
|
.chips-container {
|
|
32
32
|
display: flex;
|
|
33
33
|
gap: 8px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as n,Fragment 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,w,x,I,{placeHolder:b,size:j,onSelect:y,defaultOptions:O,disabled:S,noErrorHint:H,placeHolderHeight:T,showPlaceholderWhenSelected:D=!1,inputStyle:P={},inputType:C="default",onDeleteChip:E,truncatedText:z,showLeadingIconInPlaceholder:W=!1,showTrailingIconPlaceholder:A=!1}=v,L=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder"]);const[_,k]=l(!1),M=null!=j?j:"default",N=i(),[U,V]=l(null!=O?O:[]);r((()=>{var e;const o=[];null===(e=null==L?void 0:L.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)})),V([...o])}),[L.options]),r((()=>{O&&V([...O])}),[O]);const q=h(U);return o(c.Provider,Object.assign({value:{InputWrapper:Object.assign({height:T||("x-small"===M?24:"small"===M?32:48),width:null!==(f=null!==(g=L.buttonWidth)&&void 0!==g?g:L.width)&&void 0!==f?f:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===M?"4px 8px":"6px 8px"},P),input:{minHeight:"100%"}}},{children:n(u,Object.assign({"data-test":L["data-test"],ref:N,onSelect:function(e){Array.isArray(e)?V([...e]):V([e]),null==y||y(e)},disabled:S,onDropdownVisbilityChange:e=>k(e)},L,{children:["default"==C&&o(d,{version:L.version,noErrorHint:H,state:S?"disabled":"none",value:D?b:null!=q?q:"",errorMessage:L.error,variant:M,placeholder:null!=b?b:"Select an option",width:null!==(w=L.width)&&void 0!==w?w:"100%",onChangeText:m,leftIcon:W&&(null===(x=U[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return o(t,{children:null===(e=U[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n("div",Object.assign({style:{display:"flex"}},{children:[A&&(null===(e=U[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===M?16:"small"===M?20:24,height:"x-small"===M?16:"small"===M?20:24,color:s.content.primary})]}))}},truncateText:null==z||z}),"chip"==C&&o(p,{placeholder:null!=b?b:"Select options",chips:U,onDeleteChip:e=>{null==E||E(e)},isDropdownOpened:_,sizeToUse:M,containerStyle:{width:null!==(I=L.width)&&void 0!==I?I:"100%",cursor:"pointer"}})]}))}))};v.displayName="Dropdown";export{v as Dropdown};
|