@bikdotai/bik-component-library 0.0.643-zero.1 → 0.0.643-zero.2
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/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/dropdown/DropdownPopover/index.d.ts +6 -0
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +6 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/dropdown/DropdownPopover/index.d.ts +6 -0
- package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ButtonProps } from "../../button/model";
|
|
2
3
|
import { Placement } from "../../tooltips";
|
|
3
4
|
import { OpenDropdownProps } from '../type';
|
|
4
5
|
export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdownProps & {
|
|
@@ -12,6 +13,11 @@ export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdo
|
|
|
12
13
|
showTooltipArrow?: boolean | undefined;
|
|
13
14
|
allowEvents?: boolean | undefined;
|
|
14
15
|
'data-test'?: string | undefined;
|
|
16
|
+
zeroState?: {
|
|
17
|
+
actionButton?: ButtonProps | undefined;
|
|
18
|
+
title: string;
|
|
19
|
+
subTitle?: string | undefined;
|
|
20
|
+
} | undefined;
|
|
15
21
|
} & React.RefAttributes<{
|
|
16
22
|
openDropdown: boolean;
|
|
17
23
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),n=require("react-popper"),r=require("../../dropShadow/DropShadow.js"),l=require("../../tooltips/Tooltip.js"),s=require("../Common.styled.js"),i=require("../OpenedDropdown/components/OpennedDropdown.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(o).default.forwardRef(((a,d)=>{var{children:p,onDropdownVisbilityChange:c,version:u="1.0",tooltipContent:v,tooltipDirection:j,showTooltipArrow:w}=a,b=e.__rest(a,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const h=d,[f,D]=o.useState(!1),[O,g]=o.useState(null),[x,y]=o.useState(null),S=o.useRef(null),{styles:m,attributes:C}=n.usePopper(O,x,{placement:b.placement,strategy:b.strategy}),q=e=>{var t,o;"2.0"===u&&b.isMultiSelect&&e&&(null===(t=b.onSelect)||void 0===t||t.call(b,[...e])),D(!1),null===(o=null==b?void 0:b.onClose)||void 0===o||o.call(b)};o.useImperativeHandle(h,(()=>({openDropdown:f})),[]),o.useEffect((()=>{(null==h?void 0:h.current)&&(h.current.openDropdown=f)}),[f]),o.useEffect((()=>{null==c||c(f)}),[f]);const E=()=>t.jsxs(t.Fragment,{children:[t.jsxs("div",Object.assign({style:{position:"relative"},ref:g},{children:[t.jsx(s.OverLapAbs,Object.assign({ref:S,allowEvents:b.allowEvents,disabled:b.disabled,onClick:e=>{var t;null===(t=b.onDropdownOpen)||void 0===t||t.call(b),f?(D(!1),e.preventDefault()):b.disabled||D(!0)}},{children:b.allowEvents?p:null})),b.allowEvents?null:p]})),f&&t.jsx(s.OpenDropdownContainer,Object.assign({ref:y,style:Object.assign(Object.assign({},m.popper),{zIndex:3})},C.popper,{"data-test":b["data-test"]},{children:t.jsx(r.DropShadow,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:t.jsx(i.OpenedDropdown,Object.assign({},b,{onSelect:e=>{var t;"2.0"===u&&b.isMultiSelect||(null===(t=b.onSelect)||void 0===t||t.call(b,e),D(!1))},onClose:q,version:u,headerRef:S,zeroState:null==b?void 0:b.zeroState}))}))}))]});return t.jsx(t.Fragment,{children:f||void 0===v?E():t.jsx(l.Tooltip,Object.assign({body:v,placement:j,hideArrow:!w},{children:t.jsx("div",Object.assign({"data-test":b["data-test"]},{children:E()}))}))})}));d.displayName="DropdownPopover",exports.DropdownPopover=d;
|
|
@@ -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"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:x,isMultiSelect:g,width:b,allowFreeForm:v,height:w,onClose:O,onSelect:m,onSearch:y,version:C,skipSorting:D,headerRef:M,hideSelectAll:q,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:I,disableSearchOptions:H,disableSearchedOptionExcept:R,useDefaultCursor:T,containerStyle:Z={},zeroState:z}=f;const{dropdownOptions:E,search:P,searchedString:_,searchedOptions:K,onApplyHandler:N,selectAllHandler:W,onMultiSelectClear:G,onFreeFormSelect:J,onMultiSelectApply:Q,latestDropdownOptionsRef:U,getSelectedOptions:V}=r.useDropdown(C,j,m,D,g,y,H,R),[X,Y]=t.useState(null!=b?b:S),[$,ee]=t.useState(null),te=t.useRef(null),ne=t.useRef([]);o.useOutside(te,(()=>{if(ee(null),g&&"2.0"===C){const e=V(U.current);null==O||O(e)}else null==O||O(E)}),[M,ne]);const oe=null!=w?w:h,re="number"==typeof oe?x&&g?oe-96:x&&!g||!x&&g?oe-48:oe:oe;t.useEffect((()=>{const e=null!=b?b:S;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 ie=[],se=(_&&y?K:E).map((e=>{var t,n;if(_&&!y){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(_.toLowerCase()))&&(ie.push(!_||e.label===_),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(_.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(_.toLowerCase()))?(ie.push(!_||e.label===_),e):null}return e})).filter((e=>null!==e)),le=!!x&&_&&0===se.length;return e.jsxs(c.OpennedDropdownContainer,Object.assign({version:C,ref:te,style:Object.assign({width:X},Z)},{children:[e.jsxs("div",Object.assign({style:{width:$?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:P,version:C}),se.length||_?e.jsxs(c.MenuListContainer,Object.assign({minHeight:oe,maxHeight:re},{children:[!!g&&!le&&!q&&e.jsx(u.SelectAllMenu,{version:C,options:_&&y?K:E,onSelect:W}),!v&&le&&e.jsx(p.SearchZeroState,{isLoading:I,height:re,searchedString:_}),v&&(le||!!ie.length&&ie.every((e=>!1===e)))&&e.jsx(s.FreeFormMenu,{version:C,isMultiSelect:g,onSelect:J,searchedString:_}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:C,onSelect:N,showDescription:function(e,t){ee(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:se,useDefaultCursor:T,ref:ne})]})):e.jsx("div",Object.assign({style:{height:oe,display:"flex"}},{children:e.jsx(n.ZeroState,{title:(null==z?void 0:z.title)||"No results found",subTitle:(null==z?void 0:z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",actionButton:null==z?void 0:z.actionButton})})),!!g&&!(!se.length&&!_)&&"2.0"!==C&&e.jsx(a.default,{onClear:()=>{G(),null==k||k()},onApply:Q,list:_&&y?K:E,buttonText:L,buttonOptions:B})]})),!!$&&e.jsx(i.Description,{title:$.title,description:$.description,version:C})]}))};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Placement, PositioningStrategy } from '@popperjs/core';
|
|
3
|
-
import { Type } from '../button/model';
|
|
3
|
+
import { ButtonProps, Type } from '../button/model';
|
|
4
4
|
export interface OpenDropdownProps {
|
|
5
5
|
defaultOptions?: DropdownOption[];
|
|
6
6
|
options: DropdownOption[];
|
|
@@ -30,6 +30,11 @@ export interface OpenDropdownProps {
|
|
|
30
30
|
useDefaultCursor?: boolean;
|
|
31
31
|
'data-test'?: string;
|
|
32
32
|
containerStyle?: React.CSSProperties;
|
|
33
|
+
zeroState?: {
|
|
34
|
+
actionButton?: ButtonProps;
|
|
35
|
+
title: string;
|
|
36
|
+
subTitle?: string;
|
|
37
|
+
};
|
|
33
38
|
}
|
|
34
39
|
export type GroupedOption = {
|
|
35
40
|
label?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ButtonProps } from "../../button/model";
|
|
2
3
|
import { Placement } from "../../tooltips";
|
|
3
4
|
import { OpenDropdownProps } from '../type';
|
|
4
5
|
export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdownProps & {
|
|
@@ -12,6 +13,11 @@ export declare const DropdownPopover: React.ForwardRefExoticComponent<OpenDropdo
|
|
|
12
13
|
showTooltipArrow?: boolean | undefined;
|
|
13
14
|
allowEvents?: boolean | undefined;
|
|
14
15
|
'data-test'?: string | undefined;
|
|
16
|
+
zeroState?: {
|
|
17
|
+
actionButton?: ButtonProps | undefined;
|
|
18
|
+
title: string;
|
|
19
|
+
subTitle?: string | undefined;
|
|
20
|
+
} | undefined;
|
|
15
21
|
} & React.RefAttributes<{
|
|
16
22
|
openDropdown: boolean;
|
|
17
23
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t,jsxs as l}from"react/jsx-runtime";import n,{useState as r,useRef as i,useImperativeHandle as s,useEffect as a}from"react";import{usePopper as d}from"react-popper";import{DropShadow as p}from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as v,OpenDropdownContainer as m}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const w=n.forwardRef(((n,w)=>{var{children:b,onDropdownVisbilityChange:h,version:f="1.0",tooltipContent:j,tooltipDirection:g,showTooltipArrow:D}=n,O=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const y=w,[C
|
|
1
|
+
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e,Fragment as t,jsxs as l}from"react/jsx-runtime";import n,{useState as r,useRef as i,useImperativeHandle as s,useEffect as a}from"react";import{usePopper as d}from"react-popper";import{DropShadow as p}from"../../dropShadow/DropShadow.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{OverLapAbs as v,OpenDropdownContainer as m}from"../Common.styled.js";import{OpenedDropdown as u}from"../OpenedDropdown/components/OpennedDropdown.js";const w=n.forwardRef(((n,w)=>{var{children:b,onDropdownVisbilityChange:h,version:f="1.0",tooltipContent:j,tooltipDirection:g,showTooltipArrow:D}=n,O=o(n,["children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow"]);const y=w,[S,C]=r(!1),[z,E]=r(null),[x,A]=r(null),R=i(null),{styles:T,attributes:M}=d(z,x,{placement:O.placement,strategy:O.strategy}),V=o=>{var e,t;"2.0"===f&&O.isMultiSelect&&o&&(null===(e=O.onSelect)||void 0===e||e.call(O,[...o])),C(!1),null===(t=null==O?void 0:O.onClose)||void 0===t||t.call(O)};s(y,(()=>({openDropdown:S})),[]),a((()=>{(null==y?void 0:y.current)&&(y.current.openDropdown=S)}),[S]),a((()=>{null==h||h(S)}),[S]);const _=()=>l(t,{children:[l("div",Object.assign({style:{position:"relative"},ref:E},{children:[e(v,Object.assign({ref:R,allowEvents:O.allowEvents,disabled:O.disabled,onClick:o=>{var e;null===(e=O.onDropdownOpen)||void 0===e||e.call(O),S?(C(!1),o.preventDefault()):O.disabled||C(!0)}},{children:O.allowEvents?b:null})),O.allowEvents?null:b]})),S&&e(m,Object.assign({ref:A,style:Object.assign(Object.assign({},T.popper),{zIndex:3})},M.popper,{"data-test":O["data-test"]},{children:e(p,Object.assign({level:"z2",position:"down",style:{borderRadius:8}},{children:e(u,Object.assign({},O,{onSelect:o=>{var e;"2.0"===f&&O.isMultiSelect||(null===(e=O.onSelect)||void 0===e||e.call(O,o),C(!1))},onClose:V,version:f,headerRef:R,zeroState:null==O?void 0:O.zeroState}))}))}))]});return e(t,{children:S||void 0===j?_():e(c,Object.assign({body:j,placement:g,hideArrow:!D},{children:e("div",Object.assign({"data-test":O["data-test"]},{children:_()}))}))})}));w.displayName="DropdownPopover";export{w as DropdownPopover};
|
|
@@ -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
|
|
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 l}from"../../../zeroState/ZeroState.js";import{useOutside as r}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 u}from"./menu/MenuList.js";import{SelectAllMenu as p}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,v=v=>{let{options:w,isSearchable:j,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:D,onSelect:M,onSearch:L,version:k,skipSorting:A,headerRef:B,hideSelectAll:F,primaryButtonText:I,onInfiniteScroll:H,onMultiSelectClear:T,onDropdownItemClick:z,buttonOptions:R,isSearchLoading:Z,disableSearchOptions:q,disableSearchedOptionExcept:E,useDefaultCursor:K,containerStyle:N={},zeroState:P}=v;const{dropdownOptions:W,search:G,searchedString:J,searchedOptions:Q,onApplyHandler:U,selectAllHandler:V,onMultiSelectClear:X,onFreeFormSelect:Y,onMultiSelectApply:$,latestDropdownOptionsRef:_,getSelectedOptions:ee}=s(k,w,M,A,y,L,q,E),[te,oe]=o(null!=O?O:b),[ne,ie]=o(null),le=n(null),re=n([]);r(le,(()=>{if(ie(null),y&&"2.0"===k){const e=ee(_.current);null==D||D(e)}else null==D||D(W)}),[B,re]);const se=null!=C?C:g,ce="number"==typeof se?j&&y?se-96:j&&!y||!j&&y?se-48:se:se;i((()=>{const e=null!=O?O:b;if(null===ne)oe(e);else if("number"==typeof e)oe(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));oe(t)}}),[ne]);const ae=[],ue=(J&&L?Q:W).map((e=>{var t,o;if(J&&!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(J.toLowerCase()))&&(ae.push(!J||e.label===J),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(J.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(J.toLowerCase()))?(ae.push(!J||e.label===J),e):null}return e})).filter((e=>null!==e)),pe=!!j&&J&&0===ue.length;return e(h,Object.assign({version:k,ref:le,style:Object.assign({width:te},N)},{children:[e("div",Object.assign({style:{width:ne?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!j&&t(f,{onSearch:G,version:k}),ue.length||J?e(m,Object.assign({minHeight:se,maxHeight:ce},{children:[!!y&&!pe&&!F&&t(p,{version:k,options:J&&L?Q:W,onSelect:V}),!x&&pe&&t(S,{isLoading:Z,height:ce,searchedString:J}),x&&(pe||!!ae.length&&ae.every((e=>!1===e)))&&t(a,{version:k,isMultiSelect:y,onSelect:Y,searchedString:J}),t(u,{onInfiniteScroll:H,onDropdownItemClick:z,version:k,onSelect:U,showDescription:function(e,t){ie(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:ue,useDefaultCursor:K,ref:re})]})):t("div",Object.assign({style:{height:se,display:"flex"}},{children:t(l,{title:(null==P?void 0:P.title)||"No results found",subTitle:(null==P?void 0:P.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance.",actionButton:null==P?void 0:P.actionButton})})),!!y&&!(!ue.length&&!J)&&"2.0"!==k&&t(d,{onClear:()=>{X(),null==T||T()},onApply:$,list:J&&L?Q:W,buttonText:I,buttonOptions:R})]})),!!ne&&t(c,{title:ne.title,description:ne.description,version:k})]}))};export{v as OpenedDropdown};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Placement, PositioningStrategy } from '@popperjs/core';
|
|
3
|
-
import { Type } from '../button/model';
|
|
3
|
+
import { ButtonProps, Type } from '../button/model';
|
|
4
4
|
export interface OpenDropdownProps {
|
|
5
5
|
defaultOptions?: DropdownOption[];
|
|
6
6
|
options: DropdownOption[];
|
|
@@ -30,6 +30,11 @@ export interface OpenDropdownProps {
|
|
|
30
30
|
useDefaultCursor?: boolean;
|
|
31
31
|
'data-test'?: string;
|
|
32
32
|
containerStyle?: React.CSSProperties;
|
|
33
|
+
zeroState?: {
|
|
34
|
+
actionButton?: ButtonProps;
|
|
35
|
+
title: string;
|
|
36
|
+
subTitle?: string;
|
|
37
|
+
};
|
|
33
38
|
}
|
|
34
39
|
export type GroupedOption = {
|
|
35
40
|
label?: string;
|