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