@bikdotai/bik-component-library 0.0.575 → 0.0.576-mldd-beta.0
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/dropdown/MultilevelDropdownPopover/index.d.ts +15 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +4 -0
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +4 -0
- package/dist/cjs/components/dropdown/type.d.ts +2 -0
- 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/dropdown/MultilevelDropdownPopover/index.d.ts +15 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +4 -0
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +4 -0
- package/dist/esm/components/dropdown/type.d.ts +2 -0
- 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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Placement } from "../../tooltips";
|
|
3
|
+
import { OpenDropdownProps } from '../type';
|
|
4
|
+
export declare const MultilevelDropdownPopover: React.ForwardRefExoticComponent<OpenDropdownProps & {
|
|
5
|
+
isLoading?: boolean | undefined;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
onDropdownOpen?: (() => void) | undefined;
|
|
9
|
+
onDropdownVisbilityChange?: ((isOpen: boolean) => void) | undefined;
|
|
10
|
+
tooltipContent?: string | undefined;
|
|
11
|
+
tooltipDirection?: Placement | undefined;
|
|
12
|
+
showTooltipArrow?: boolean | undefined;
|
|
13
|
+
} & React.RefAttributes<{
|
|
14
|
+
openDropdown: boolean;
|
|
15
|
+
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),o=require("../../../../hooks/useOutside.js"),r=require("../../hooks/useDropdown.js"),i=require("./description/Description.js"),s=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=j=>{let{options:f,isSearchable:x,isMultiSelect:g,width:w,allowFreeForm:b,height:v,onClose:m,onSelect:y,onSearch:O,version:M,skipSorting:q,headerRef:C,hideSelectAll:D,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:I}=j;const{dropdownOptions:H,search:Z,searchedString:R,searchedOptions:T,onApplyHandler:P,selectAllHandler:_,onMultiSelectClear:z,onFreeFormSelect:E,onMultiSelectApply:K,latestDropdownOptionsRef:N,getSelectedOptions:W}=r.useDropdown(M,f,y,q,g,O),[G,J]=t.useState(null!=w?w:S),[Q,U]=t.useState(null),V=t.useRef(null);o.useOutside(V,(()=>{}),[C]);const X=null!=v?v:h,Y="number"==typeof X?x&&g?X-96:x&&!g||!x&&g?X-48:X:X;t.useEffect((()=>{const e=null!=w?w:S;if(null===Q)J(e);else if("number"==typeof e)J(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));J(t)}}),[Q]);const $=[],ee=(R&&O?T:H).map((e=>{var t,n;if(R&&!O){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(R.toLowerCase()))&&($.push(!R||e.label===R),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(R.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(R.toLowerCase()))?($.push(!R||e.label===R),e):null}return e})).filter((e=>null!==e)),te=!!x&&R&&0===ee.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:M,ref:V,style:{width:G}},{children:[e.jsxs("div",Object.assign({style:{width:Q?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:Z,version:M}),ee.length||R?e.jsxs(a.MenuListContainer,Object.assign({minHeight:X,maxHeight:Y},{children:[!!g&&!te&&!D&&e.jsx(u.SelectAllMenu,{version:M,options:R&&O?T:H,onSelect:_}),!b&&te&&e.jsx(p.SearchZeroState,{isLoading:I,height:Y,searchedString:R}),b&&(te||!!$.length&&$.every((e=>!1===e)))&&e.jsx(s.FreeFormMenu,{version:M,isMultiSelect:g,onSelect:E,searchedString:R}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:M,onSelect:P,showDescription:function(e,t){U(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:ee})]})):e.jsx("div",Object.assign({style:{height:X,display:"flex"}},{children:e.jsx(n.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!g&&!(!ee.length&&!R)&&"2.0"!==M&&e.jsx(c.default,{onClear:()=>{z(),null==k||k()},onApply:K,list:R&&O?T:H,buttonText:L,buttonOptions:B})]})),!!Q&&e.jsx(i.Description,{title:Q.title,description:Q.description,version:M})]}))};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../../assets/icons/chevronRight.svg.js"),n=require("styled-components"),i=require("../../../../checkBox/CheckBox.js"),s=require("../../../../list-item/ListItem.js"),r=require("../../../../tooltips/Tooltip.js"),o=require("../../../../TypographyStyle.js"),l=require("../../../../../constants/Theme.js"),a=require("./FreeFormMenu.styled.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=c(n).default(s.ListItem)`
|
|
2
2
|
padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
margin-top: ${e=>"2.0"===e.version?"2px":"0"};
|
|
5
|
-
`;exports.MenuItem=
|
|
5
|
+
`;exports.MenuItem=n=>{let{option:s,isMultiSelect:c,showDescription:u,onSelect:p,last:g,version:m,onDropdownItemClick:j}=n;var x;const h=(e,t)=>{if(!e.children)if(v(!e.selected),t){const n=Object.assign(Object.assign({},e),{parent:t});null==j||j(n)}else null==j||j(e)};function v(e){s.disabled||p(Object.assign(Object.assign({},s),{selected:e}))}return e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,Object.assign({body:"",tooltipContent:s.children?e.jsx("div",Object.assign({style:{minWidth:"148px",padding:"1.0"===m?0:"4px",border:`1px solid ${"1.0"===m?l.DEFAULT_THEME.colorsV2.stroke.primary:"none"}`}},{children:s.children.map(((t,n)=>{var i,r;return e.jsx(e.Fragment,{children:e.jsx(d,{version:m,style:n===(null!==(r=null===(i=s.children)||void 0===i?void 0:i.length)&&void 0!==r?r:0)-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),h(t,s)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:s.disabled?"inactive":t.selected?"selected":"default"})})}))})):e.jsx(e.Fragment,{}),placement:"right",hideArrow:!0,variant:"light"},{children:e.jsx(d,{version:m,style:g?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),h(s)},onMouseOver:function(){s.description?u(s.label,s.description):u()},listItem:{value:s.value,label:s.label},subText:s.subText,leadingIcon:c?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(i.CheckBox,{size:"2.0"===m?"SMALL":"DEFAULT",isDisabled:null!==(x=s.disabled)&&void 0!==x&&x,isChecked:!!s.selected,onValueChange:v}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:s.leadingIcon}))]})):s.leadingIcon?e.jsx(e.Fragment,{children:s.leadingIcon}):e.jsx(e.Fragment,{}),customComponent:s.customComponent,trailingIcon:s.isFreeForm?e.jsx(a.FreeFormContainer,{children:e.jsx(o.BodyCaption,Object.assign({style:{color:l.COLORS.content.secondary}},{children:"Freeform"}))}):s.children?e.jsx(t.default,{width:12,height:12}):s.trailingIcon?e.jsx(e.Fragment,{children:s.trailingIcon}):e.jsx(e.Fragment,{}),variant:s.disabled?"inactive":s.selected?"selected":"default"})}))})};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownOption, SingleOption } from '../../type';
|
|
3
3
|
export declare function iterateOnOptions(options: DropdownOption[], newVal: Partial<SingleOption>, checkCB?: (optionForValidation: SingleOption) => boolean): ({
|
|
4
|
+
children?: SingleOption[] | undefined;
|
|
4
5
|
label: string;
|
|
5
6
|
value: string;
|
|
6
7
|
description?: string | null | undefined;
|
|
@@ -13,7 +14,9 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
13
14
|
customComponent?: JSX.Element | undefined;
|
|
14
15
|
searchKey?: string | undefined;
|
|
15
16
|
selectedLabel?: string | undefined;
|
|
17
|
+
parent?: SingleOption | undefined;
|
|
16
18
|
} | {
|
|
19
|
+
children?: SingleOption[] | undefined;
|
|
17
20
|
label?: string | undefined;
|
|
18
21
|
value?: string | undefined;
|
|
19
22
|
description?: string | null | undefined;
|
|
@@ -26,6 +29,7 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
26
29
|
customComponent?: JSX.Element | undefined;
|
|
27
30
|
searchKey?: string | undefined;
|
|
28
31
|
selectedLabel?: string | undefined;
|
|
32
|
+
parent?: SingleOption | undefined;
|
|
29
33
|
options: SingleOption[];
|
|
30
34
|
})[];
|
|
31
35
|
export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
|
|
@@ -8,6 +8,7 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
8
8
|
searchedString: string;
|
|
9
9
|
searchedOptions: DropdownOption[];
|
|
10
10
|
onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
|
|
11
|
+
children?: SingleOption[] | undefined;
|
|
11
12
|
label: string;
|
|
12
13
|
value: string;
|
|
13
14
|
description?: string | null | undefined;
|
|
@@ -20,7 +21,9 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
20
21
|
customComponent?: JSX.Element | undefined;
|
|
21
22
|
searchKey?: string | undefined;
|
|
22
23
|
selectedLabel?: string | undefined;
|
|
24
|
+
parent?: SingleOption | undefined;
|
|
23
25
|
} | {
|
|
26
|
+
children?: SingleOption[] | undefined;
|
|
24
27
|
label?: string | undefined;
|
|
25
28
|
value?: string | undefined;
|
|
26
29
|
description?: string | null | undefined;
|
|
@@ -33,6 +36,7 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
33
36
|
customComponent?: JSX.Element | undefined;
|
|
34
37
|
searchKey?: string | undefined;
|
|
35
38
|
selectedLabel?: string | undefined;
|
|
39
|
+
parent?: SingleOption | undefined;
|
|
36
40
|
options: SingleOption[];
|
|
37
41
|
})[] | undefined;
|
|
38
42
|
selectAllHandler: (newState: SelectAllCheckboxState) => void;
|
|
@@ -32,6 +32,7 @@ export type GroupedOption = {
|
|
|
32
32
|
options: (SingleOption | MultiSelectOption)[];
|
|
33
33
|
};
|
|
34
34
|
export type SingleOption = {
|
|
35
|
+
children?: SingleOption[];
|
|
35
36
|
label: string;
|
|
36
37
|
value: string;
|
|
37
38
|
description?: string | null;
|
|
@@ -44,6 +45,7 @@ export type SingleOption = {
|
|
|
44
45
|
customComponent?: JSX.Element;
|
|
45
46
|
searchKey?: string;
|
|
46
47
|
selectedLabel?: string;
|
|
48
|
+
parent?: SingleOption;
|
|
47
49
|
};
|
|
48
50
|
export type MultiSelectOption = SingleOption;
|
|
49
51
|
export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
|
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Placement } from "../../tooltips";
|
|
3
|
+
import { OpenDropdownProps } from '../type';
|
|
4
|
+
export declare const MultilevelDropdownPopover: React.ForwardRefExoticComponent<OpenDropdownProps & {
|
|
5
|
+
isLoading?: boolean | undefined;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
onDropdownOpen?: (() => void) | undefined;
|
|
9
|
+
onDropdownVisbilityChange?: ((isOpen: boolean) => void) | undefined;
|
|
10
|
+
tooltipContent?: string | undefined;
|
|
11
|
+
tooltipDirection?: Placement | undefined;
|
|
12
|
+
showTooltipArrow?: boolean | undefined;
|
|
13
|
+
} & React.RefAttributes<{
|
|
14
|
+
openDropdown: boolean;
|
|
15
|
+
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as r}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,b=290,w=w=>{let{options:v,isSearchable:j,isMultiSelect:y,width:x,allowFreeForm:O,height:C,onClose:M,onSelect:D,onSearch:L,version:k,skipSorting:A,headerRef:F,hideSelectAll:I,primaryButtonText:B,onInfiniteScroll:H,onMultiSelectClear:T,onDropdownItemClick:R,buttonOptions:Z,isSearchLoading:q}=w;const{dropdownOptions:z,search:K,searchedString:N,searchedOptions:P,onApplyHandler:W,selectAllHandler:E,onMultiSelectClear:G,onFreeFormSelect:J,onMultiSelectApply:Q,latestDropdownOptionsRef:U,getSelectedOptions:V}=s(k,v,D,A,y,L),[X,Y]=o(null!=x?x:b),[$,_]=o(null),ee=n(null);l(ee,(()=>{
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as r}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,b=290,w=w=>{let{options:v,isSearchable:j,isMultiSelect:y,width:x,allowFreeForm:O,height:C,onClose:M,onSelect:D,onSearch:L,version:k,skipSorting:A,headerRef:F,hideSelectAll:I,primaryButtonText:B,onInfiniteScroll:H,onMultiSelectClear:T,onDropdownItemClick:R,buttonOptions:Z,isSearchLoading:q}=w;const{dropdownOptions:z,search:K,searchedString:N,searchedOptions:P,onApplyHandler:W,selectAllHandler:E,onMultiSelectClear:G,onFreeFormSelect:J,onMultiSelectApply:Q,latestDropdownOptionsRef:U,getSelectedOptions:V}=s(k,v,D,A,y,L),[X,Y]=o(null!=x?x:b),[$,_]=o(null),ee=n(null);l(ee,(()=>{}),[F]);const te=null!=C?C:g,oe="number"==typeof te?j&&y?te-96:j&&!y||!j&&y?te-48:te:te;i((()=>{const e=null!=x?x:b;if(null===$)Y(e);else if("number"==typeof e)Y(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));Y(t)}}),[$]);const ne=[],ie=(N&&L?P:z).map((e=>{var t,o;if(N&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(N.toLowerCase()))&&(ne.push(!N||e.label===N),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(N.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(N.toLowerCase()))?(ne.push(!N||e.label===N),e):null}return e})).filter((e=>null!==e)),re=!!j&&N&&0===ie.length;return e(h,Object.assign({version:k,ref:ee,style:{width:X}},{children:[e("div",Object.assign({style:{width:$?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!j&&t(f,{onSearch:K,version:k}),ie.length||N?e(m,Object.assign({minHeight:te,maxHeight:oe},{children:[!!y&&!re&&!I&&t(u,{version:k,options:N&&L?P:z,onSelect:E}),!O&&re&&t(S,{isLoading:q,height:oe,searchedString:N}),O&&(re||!!ne.length&&ne.every((e=>!1===e)))&&t(a,{version:k,isMultiSelect:y,onSelect:J,searchedString:N}),t(p,{onInfiniteScroll:H,onDropdownItemClick:R,version:k,onSelect:W,showDescription:function(e,t){_(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:ie})]})):t("div",Object.assign({style:{height:te,display:"flex"}},{children:t(r,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!ie.length&&!N)&&"2.0"!==k&&t(d,{onClear:()=>{G(),null==T||T()},onApply:Q,list:N&&L?P:z,buttonText:B,buttonOptions:Z})]})),!!$&&t(c,{title:$.title,description:$.description,version:k})]}))};export{w as OpenedDropdown};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{jsx as e,
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import n from"../../../../../assets/icons/chevronRight.svg.js";import o from"styled-components";import{CheckBox as l}from"../../../../checkBox/CheckBox.js";import{ListItem as r}from"../../../../list-item/ListItem.js";import{Tooltip as s}from"../../../../tooltips/Tooltip.js";import{BodyCaption as c}from"../../../../TypographyStyle.js";import{DEFAULT_THEME as a,COLORS as d}from"../../../../../constants/Theme.js";import{FreeFormContainer as p}from"./FreeFormMenu.styled.js";const m=o(r)`
|
|
2
2
|
padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
margin-top: ${e=>"2.0"===e.version?"2px":"0"};
|
|
5
|
-
`,
|
|
5
|
+
`,g=o=>{let{option:r,isMultiSelect:g,showDescription:h,onSelect:u,last:v,version:b,onDropdownItemClick:f}=o;var j;const x=(e,t)=>{if(!e.children)if(y(!e.selected),t){const i=Object.assign(Object.assign({},e),{parent:t});null==f||f(i)}else null==f||f(e)};function y(e){r.disabled||u(Object.assign(Object.assign({},r),{selected:e}))}return e(t,{children:e(s,Object.assign({body:"",tooltipContent:r.children?e("div",Object.assign({style:{minWidth:"148px",padding:"1.0"===b?0:"4px",border:`1px solid ${"1.0"===b?a.colorsV2.stroke.primary:"none"}`}},{children:r.children.map(((i,n)=>{var o,l;return e(t,{children:e(m,{version:b,style:n===(null!==(l=null===(o=r.children)||void 0===o?void 0:o.length)&&void 0!==l?l:0)-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(i,r)},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:i.leadingIcon||void 0,customComponent:i.customComponent,trailingIcon:i.trailingIcon||void 0,variant:r.disabled?"inactive":i.selected?"selected":"default"})})}))})):e(t,{}),placement:"right",hideArrow:!0,variant:"light"},{children:e(m,{version:b,style:v?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(r)},onMouseOver:function(){r.description?h(r.label,r.description):h()},listItem:{value:r.value,label:r.label},subText:r.subText,leadingIcon:g?i("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e(l,{size:"2.0"===b?"SMALL":"DEFAULT",isDisabled:null!==(j=r.disabled)&&void 0!==j&&j,isChecked:!!r.selected,onValueChange:y}),e("div",Object.assign({style:{marginRight:"-4px"}},{children:r.leadingIcon}))]})):r.leadingIcon?e(t,{children:r.leadingIcon}):e(t,{}),customComponent:r.customComponent,trailingIcon:r.isFreeForm?e(p,{children:e(c,Object.assign({style:{color:d.content.secondary}},{children:"Freeform"}))}):r.children?e(n,{width:12,height:12}):r.trailingIcon?e(t,{children:r.trailingIcon}):e(t,{}),variant:r.disabled?"inactive":r.selected?"selected":"default"})}))})};export{g as MenuItem};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DropdownOption, SingleOption } from '../../type';
|
|
3
3
|
export declare function iterateOnOptions(options: DropdownOption[], newVal: Partial<SingleOption>, checkCB?: (optionForValidation: SingleOption) => boolean): ({
|
|
4
|
+
children?: SingleOption[] | undefined;
|
|
4
5
|
label: string;
|
|
5
6
|
value: string;
|
|
6
7
|
description?: string | null | undefined;
|
|
@@ -13,7 +14,9 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
13
14
|
customComponent?: JSX.Element | undefined;
|
|
14
15
|
searchKey?: string | undefined;
|
|
15
16
|
selectedLabel?: string | undefined;
|
|
17
|
+
parent?: SingleOption | undefined;
|
|
16
18
|
} | {
|
|
19
|
+
children?: SingleOption[] | undefined;
|
|
17
20
|
label?: string | undefined;
|
|
18
21
|
value?: string | undefined;
|
|
19
22
|
description?: string | null | undefined;
|
|
@@ -26,6 +29,7 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
26
29
|
customComponent?: JSX.Element | undefined;
|
|
27
30
|
searchKey?: string | undefined;
|
|
28
31
|
selectedLabel?: string | undefined;
|
|
32
|
+
parent?: SingleOption | undefined;
|
|
29
33
|
options: SingleOption[];
|
|
30
34
|
})[];
|
|
31
35
|
export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
|
|
@@ -8,6 +8,7 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
8
8
|
searchedString: string;
|
|
9
9
|
searchedOptions: DropdownOption[];
|
|
10
10
|
onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
|
|
11
|
+
children?: SingleOption[] | undefined;
|
|
11
12
|
label: string;
|
|
12
13
|
value: string;
|
|
13
14
|
description?: string | null | undefined;
|
|
@@ -20,7 +21,9 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
20
21
|
customComponent?: JSX.Element | undefined;
|
|
21
22
|
searchKey?: string | undefined;
|
|
22
23
|
selectedLabel?: string | undefined;
|
|
24
|
+
parent?: SingleOption | undefined;
|
|
23
25
|
} | {
|
|
26
|
+
children?: SingleOption[] | undefined;
|
|
24
27
|
label?: string | undefined;
|
|
25
28
|
value?: string | undefined;
|
|
26
29
|
description?: string | null | undefined;
|
|
@@ -33,6 +36,7 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
33
36
|
customComponent?: JSX.Element | undefined;
|
|
34
37
|
searchKey?: string | undefined;
|
|
35
38
|
selectedLabel?: string | undefined;
|
|
39
|
+
parent?: SingleOption | undefined;
|
|
36
40
|
options: SingleOption[];
|
|
37
41
|
})[] | undefined;
|
|
38
42
|
selectAllHandler: (newState: SelectAllCheckboxState) => void;
|
|
@@ -32,6 +32,7 @@ export type GroupedOption = {
|
|
|
32
32
|
options: (SingleOption | MultiSelectOption)[];
|
|
33
33
|
};
|
|
34
34
|
export type SingleOption = {
|
|
35
|
+
children?: SingleOption[];
|
|
35
36
|
label: string;
|
|
36
37
|
value: string;
|
|
37
38
|
description?: string | null;
|
|
@@ -44,6 +45,7 @@ export type SingleOption = {
|
|
|
44
45
|
customComponent?: JSX.Element;
|
|
45
46
|
searchKey?: string;
|
|
46
47
|
selectedLabel?: string;
|
|
48
|
+
parent?: SingleOption;
|
|
47
49
|
};
|
|
48
50
|
export type MultiSelectOption = SingleOption;
|
|
49
51
|
export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
|