@bikdotai/bik-component-library 0.0.726-beta.11 → 0.0.726-beta.3
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/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.d.ts +0 -1
- package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +0 -1
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +0 -3
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/StaticCoupon/StaticCoupon.d.ts +1 -51
- package/dist/cjs/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +2 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.d.ts +0 -1
- package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +0 -1
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +0 -3
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/discount-modal/StaticCoupon/StaticCoupon.d.ts +1 -51
- package/dist/esm/components/discount-modal/StaticCoupon/StaticCoupon.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +4 -4
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../../../node_modules/react/jsx-runtime.js";import{useState as t,useRef as o,useEffect as n}from"react";import{ZeroState as s}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{useDropdown as r}from"../../hooks/useDropdown.js";import{Description as l}from"./description/Description.js";import{FreeFormMenu as c}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as d,MenuListContainer as
|
|
1
|
+
import{j as e}from"../../../../node_modules/react/jsx-runtime.js";import{useState as t,useRef as o,useEffect as n}from"react";import{ZeroState as s}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{useDropdown as r}from"../../hooks/useDropdown.js";import{Description as l}from"./description/Description.js";import{FreeFormMenu as c}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as d,MenuListContainer as f}from"./OpennedDropdown.styled.js";import{SearchBox as h}from"./searchbox/SearchBox.js";import{SearchZeroState as m}from"./searchbox/SearchZeroState.js";const b=304,j=290,g=g=>{let{options:S,isSearchable:x,isMultiSelect:v,maxSelections:O,width:w,allowFreeForm:y,height:D,onClose:C,onSelect:k,onSearch:M,version:L,skipSorting:A,headerRef:I,hideSelectAll:F,primaryButtonText:E,onInfiniteScroll:B,onMultiSelectClear:H,onDropdownItemClick:T,buttonOptions:q,isSearchLoading:z,disableSearchOptions:K,disableSearchedOptionExcept:R,useDefaultCursor:W,containerStyle:Z={},zeroState:N}=g;const{dropdownOptions:P,search:U,searchedString:V,searchedOptions:$,onApplyHandler:_,selectAllHandler:G,onMultiSelectClear:J,onFreeFormSelect:Q,onMultiSelectApply:X,latestDropdownOptionsRef:Y,getSelectedOptions:ee,getCurrentSelectionCount:te}=r(L,S,k,A,v,M,K,R,O),[oe,ne]=t(null!=w?w:j),[se,ie]=t(null),[re,le]=t(-1),ce=o(null),ae=o([]),ue=o(null);i(ce,(()=>{if(ie(null),v&&"2.0"===L){const e=ee(Y.current);null==C||C(e)}else null==C||C(P)}),[I,ae]),n((()=>{var e;if(null==re)return;const t=null===(e=ue.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${re}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),[re]);n((()=>{le(-1)}),[V,$,P]);n((()=>{ue.current&&ue.current.focus()}),[]);const pe=null!=D?D:b,de="number"==typeof pe?x&&v?pe-96:x&&!v||!x&&v?pe-48:pe:pe;n((()=>{const e=null!=w?w:j;if(null===se)ne(e);else if("number"==typeof e)ne(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ne(t)}}),[se]);const fe=[],he=(e=>{if(!v||!O&&0!==O)return e;const t=te(e)>=O;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((V&&M?$:P).map((e=>{var t,o;if(V&&!M){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(V.toLowerCase()))&&(fe.push(!V||e.label===V),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(V.toLowerCase()))?(fe.push(!V||e.label===V),e):null}return e})).filter((e=>null!==e))),me=!!x&&V&&0===he.length;return e.jsxs(d,Object.assign({version:L,ref:ce,style:Object.assign({width:oe},Z)},{children:[e.jsxs("div",Object.assign({style:{width:se?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(h,{onSearch:U,version:L}),he.length||V?e.jsxs(f,Object.assign({minHeight:pe,maxHeight:de,ref:ue,tabIndex:0,onKeyDown:e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const o=e;o.disabled||t.push(o)}})),t})(V&&M?$:P);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),le((e=>e<t.length-1?e+1:0));else if("ArrowUp"===e.key)e.preventDefault(),le((e=>e>0?e-1:t.length-1));else if("Enter"===e.key&&re>=0){e.preventDefault();const o=t[re];o&&_(Object.assign(Object.assign({},o),{selected:!o.selected}))}else"Escape"===e.key&&(e.preventDefault(),null==C||C())}},{children:[!!v&&!me&&!F&&e.jsx(u,{version:L,options:V&&M?$:P,onSelect:G}),!y&&me&&e.jsx(m,{isLoading:z,height:de,searchedString:V,containerWidth:w}),y&&(me||!!fe.length&&fe.every((e=>!1===e)))&&e.jsx(c,{version:L,isMultiSelect:v,onSelect:Q,searchedString:V}),e.jsx(a,{onInfiniteScroll:B,onDropdownItemClick:T,version:L,onSelect:_,showDescription:function(e,t){ie(e&&t?{title:e,description:t}:null)},isMultiSelect:v,options:he,useDefaultCursor:W,ref:ae,focusedIndex:re})]})):e.jsx("div",Object.assign({style:{height:pe,display:"flex"}},{children:e.jsx(s,Object.assign({},N,{title:(null==N?void 0:N.title)||"No results found",subTitle:(null==N?void 0:N.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!v&&!(!he.length&&!V)&&"2.0"!==L&&e.jsx(p,{onClear:()=>{J(),null==H||H()},onApply:X,list:V&&M?$:P,buttonText:E,buttonOptions:q})]})),!!se&&e.jsx(l,{title:se.title,description:se.description,version:L})]}))};export{g as OpenedDropdown};
|
|
@@ -9,6 +9,8 @@ interface MenuItemProps {
|
|
|
9
9
|
last?: boolean;
|
|
10
10
|
version?: '1.0' | '2.0';
|
|
11
11
|
useDefaultCursor?: boolean;
|
|
12
|
+
isFocused?: boolean;
|
|
13
|
+
dataIndex?: number;
|
|
12
14
|
}
|
|
13
15
|
export declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
16
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{j as e}from"../../../../../node_modules/react/jsx-runtime.js";import t from"../../../../../assets/icons/chevronRight.svg.js";import{forwardRef as
|
|
1
|
+
import{j as e}from"../../../../../node_modules/react/jsx-runtime.js";import t from"../../../../../assets/icons/chevronRight.svg.js";import{forwardRef as o,useState as n}from"react";import i from"styled-components";import{CheckBox as s}from"../../../../checkBox/CheckBox.js";import{ListItem as r}from"../../../../list-item/ListItem.js";import{Tooltip as l}from"../../../../tooltips/Tooltip.js";import{BodyCaption as a}from"../../../../TypographyStyle.js";import{DEFAULT_THEME as d,COLORS as c}from"../../../../../constants/Theme.js";import{FreeFormContainer as p}from"./FreeFormMenu.styled.js";const m=i(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
|
-
`,u=
|
|
5
|
+
`,u=i.div`
|
|
6
6
|
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12);
|
|
7
7
|
border-radius: ${e=>{let{version:t}=e;return"1.0"===t?"0":"8px"}};
|
|
8
8
|
padding: ${e=>{let{version:t}=e;return"1.0"===t?"0":"4px"}};
|
|
9
9
|
min-width: 148px;
|
|
10
|
-
border: ${e=>{let{version:t}=e;return"1.0"===t?`1px solid ${
|
|
10
|
+
border: ${e=>{let{version:t}=e;return"1.0"===t?`1px solid ${d.colorsV2.stroke.primary}`:"none"}};
|
|
11
11
|
max-height: 248px;
|
|
12
12
|
overflow-y: auto;
|
|
13
|
-
`,g=
|
|
13
|
+
`,g=o(((o,i)=>{let{option:r,isMultiSelect:g,showDescription:x,onSelect:j,last:v,version:h,onDropdownItemClick:b,useDefaultCursor:f,isFocused:y=!1,dataIndex:I=-1}=o;var C;const[O,F]=n(r.selected),k=(e,t)=>{if(!e.children){w(!e.selected);const o=t?Object.assign(Object.assign({},e),{parent:t}):e;null==b||b(o)}},w=e=>{r.disabled||j(Object.assign(Object.assign({},r),{selected:e}))},T=f?{cursor:"default"}:{};return e.jsx(e.Fragment,{children:e.jsx(l,Object.assign({body:"",tooltipContent:r.children?e.jsx("div",Object.assign({style:{backgroundColor:d.colorsV2.surface.standard},ref:i,onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1)},{children:e.jsx(u,Object.assign({version:null!=h?h:"2.0"},{children:r.children.map((t=>{var o;return e.jsx(m,{version:h,style:"1.0"!==h&&(null!==(o=null==r?void 0:r.children)&&void 0!==o?o:[]).length-1?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),k(t,r)},listItem:{value:t.value,label:t.label},subText:t.subText,leadingIcon:t.leadingIcon||void 0,customComponent:t.customComponent,trailingIcon:t.trailingIcon||void 0,variant:r.disabled?"inactive":t.selected?"selected":"default"},t.value)}))}))})):e.jsx(e.Fragment,{}),placement:"right-start",hideArrow:!0},{children:e.jsx(m,{version:h,style:v?Object.assign({borderBottom:0},T):Object.assign({},T),onClick:e=>{e.preventDefault(),k(r)},onMouseOver:()=>{r.description?x(r.label,r.description):x()},listItem:{value:r.value,label:r.label},subText:r.subText,"data-option-index":I,role:"option",id:`dropdown-option-${I}`,"aria-selected":!!r.selected,leadingIcon:g?e.jsxs("div",Object.assign({style:{display:"flex",alignContent:"center",justifyContent:"center",gap:8}},{children:[e.jsx(s,{size:"2.0"===h?"SMALL":"DEFAULT",isDisabled:null!==(C=r.disabled)&&void 0!==C&&C,isChecked:!!r.selected,onValueChange:w}),e.jsx("div",Object.assign({style:{marginRight:"-4px"}},{children:r.leadingIcon}))]})):r.leadingIcon?e.jsx(e.Fragment,{children:r.leadingIcon}):void 0,customComponent:r.customComponent,trailingIcon:r.isFreeForm?e.jsx(p,{children:e.jsx(a,Object.assign({style:{color:c.content.secondary}},{children:"Freeform"}))}):r.children?e.jsx(t,{width:12,height:12}):r.trailingIcon?e.jsx(e.Fragment,{children:r.trailingIcon}):void 0,variant:r.disabled?"inactive":y||r.selected||!g&&O?"selected":"default"})}))})}));export{g as MenuItem};
|
|
@@ -9,6 +9,7 @@ interface MenuListProps {
|
|
|
9
9
|
onInfiniteScroll?: () => void;
|
|
10
10
|
onDropdownItemClick?: (option: DropdownOption) => void;
|
|
11
11
|
useDefaultCursor?: boolean;
|
|
12
|
+
focusedIndex?: number;
|
|
12
13
|
}
|
|
13
14
|
export declare const MenuList: import("react").ForwardRefExoticComponent<MenuListProps & import("react").RefAttributes<HTMLDivElement[]>>;
|
|
14
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../../../../node_modules/react/jsx-runtime.js";import{forwardRef as n,useRef as t,useCallback as
|
|
1
|
+
import{j as e}from"../../../../../node_modules/react/jsx-runtime.js";import{forwardRef as n,useRef as t,useCallback as s,useEffect as r}from"react";import{MenuItem as o}from"./MenuItem.js";import{StyledGroupedLabel as i}from"./MenuList.styled.js";const c=n(((n,c)=>{let{options:l,isMultiSelect:u,showDescription:a,onSelect:d,version:p,onInfiniteScroll:f,onDropdownItemClick:j,useDefaultCursor:m,focusedIndex:g=-1}=n;const x=t(null),h=t(null),b=s((()=>{x.current&&x.current.disconnect(),x.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==f||f())})),h.current&&x.current.observe(h.current)}),[f]);r((()=>(b(),()=>{x.current&&x.current.disconnect()})),[b,l]);const I=new Map;let D=-1;return l.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(D++,I.set(e,D))}));else{const n=e;n.disabled||(D++,I.set(n,D))}})),e.jsx(e.Fragment,{children:l.map(((n,t)=>{const s=t===l.length-1;if(n.options){const r=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===p?2:0}},{children:[e.jsxs(i,Object.assign({version:p},{children:[r.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:r.leadingIcon})):null,r.label]})),r.options.map(((n,s)=>{const i=I.get(n),l=i===g&&!n.disabled;return e.jsx(o,{version:p,last:s===r.options.length-1,onSelect:d,showDescription:a,onDropdownItemClick:j,isMultiSelect:u,option:n,useDefaultCursor:m,isFocused:l,dataIndex:i,ref:e=>{c&&"object"==typeof c&&c.current&&e&&e&&e&&e&&(c.current[t]=e)}},`${t}-${s}`)})),s?e.jsx("span",{ref:h}):null]}),t)}const r=n,f=I.get(r),x=f===g&&!r.disabled;return e.jsxs("div",{children:[e.jsx(o,{version:p,last:s,onSelect:d,showDescription:a,onDropdownItemClick:j,isMultiSelect:u,option:r,useDefaultCursor:m,isFocused:x,dataIndex:f,ref:e=>{c&&"object"==typeof c&&c.current&&e&&(c.current[t]=e)}},t),s?e.jsx("span",{ref:h}):null]},t)}))})}));export{c as MenuList};
|