@bikdotai/bik-component-library 0.0.745 → 0.0.746
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),s=require("./MenuList.styled.js");const r=n.forwardRef(((r,o)=>{let{options:i,isMultiSelect:c,showDescription:l,onSelect:u,version:a,onInfiniteScroll:d,onDropdownItemClick:p,useDefaultCursor:f,focusedIndex:j=-1}=r;const b=n.useRef(null),x=n.useRef(null),g=n.useCallback((()=>{b.current&&b.current.disconnect(),b.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==d||d())})),x.current&&b.current.observe(x.current)}),[d]);n.useEffect((()=>(g(),()=>{b.current&&b.current.disconnect()})),[g,i]);const I=new Map;let h=-1;return i.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(h++,I.set(e,h))}));else{const n=e;n.disabled||(h++,I.set(n,h))}})),e.jsx(e.Fragment,{children:i.map(((n,r)=>{const d=r===i.length-1;if(n.options){const i=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[e.jsxs(s.StyledGroupedLabel,Object.assign({version:a},{children:[i.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:i.leadingIcon})):null,i.label]})),i.options.map(((n,s)=>{const d=I.get(n),b=d===j&&!n.disabled;return e.jsx(t.MenuItem,{version:a,last:s===i.options.length-1,onSelect:u,showDescription:l,onDropdownItemClick:p,isMultiSelect:c,option:n,useDefaultCursor:f,isFocused:b,dataIndex:d,ref:e=>{o&&"object"==typeof o&&o.current&&e&&e&&e&&e&&(o.current[r]=e)}},`${r}-${s}`)})),d?e.jsx("span",{ref:x}):null]}),r)}const b=n,g=I.get(b),h=g===j&&!b.disabled;return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:a,last:d,onSelect:u,showDescription:l,onDropdownItemClick:p,isMultiSelect:c,option:b,useDefaultCursor:f,isFocused:h,dataIndex:g,ref:e=>{o&&"object"==typeof o&&o.current&&e&&(o.current[r]=e)}},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("./MenuItem.js"),s=require("./MenuList.styled.js");const r=n.forwardRef(((r,o)=>{let{options:i,isMultiSelect:c,showDescription:l,onSelect:u,version:a,onInfiniteScroll:d,onDropdownItemClick:p,useDefaultCursor:f,focusedIndex:j=-1}=r;const b=n.useRef(null),x=n.useRef(null),g=n.useCallback((()=>{b.current&&b.current.disconnect(),b.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==d||d())})),x.current&&b.current.observe(x.current)}),[d]);n.useEffect((()=>(g(),()=>{b.current&&b.current.disconnect()})),[g,i]);const I=new Map;let h=-1;return i.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(h++,I.set(e,h))}));else{const n=e;n.disabled||(h++,I.set(n,h))}})),e.jsx(e.Fragment,{children:i.map(((n,r)=>{const d=r===i.length-1;if(n.options){const i=n;return e.jsxs("div",Object.assign({style:{marginTop:"2.0"===a?2:0}},{children:[e.jsxs(s.StyledGroupedLabel,Object.assign({version:a},{children:[i.leadingIcon?e.jsx("span",Object.assign({style:{marginRight:8}},{children:i.leadingIcon})):null,i.label]})),i.options.map(((n,s)=>{const d=I.get(n),b=d===j&&!n.disabled;return e.jsx(t.MenuItem,{version:a,last:s===i.options.length-1,onSelect:u,showDescription:l,onDropdownItemClick:p,isMultiSelect:c,option:n,useDefaultCursor:f,isFocused:b,dataIndex:d,ref:e=>{o&&"object"==typeof o&&o.current&&e&&e&&e&&e&&(o.current[r]=e)}},`${r}-${s}`)})),d?e.jsx("span",{ref:x}):null]}),r)}const b=n,g=I.get(b),h=g===j&&!b.disabled;return e.jsxs("div",{children:[e.jsx(t.MenuItem,{version:a,last:d,onSelect:u,showDescription:l,onDropdownItemClick:p,isMultiSelect:c,option:b,useDefaultCursor:f,isFocused:h,dataIndex:g,ref:e=>{o&&"object"==typeof o&&o.current&&e&&(o.current[r]=e)}},b.value),d?e.jsx("span",{ref:x}):null]},r)}))})}));exports.MenuList=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useCallback as s,useEffect as i}from"react";import{MenuItem as c}from"./MenuItem.js";import{StyledGroupedLabel as l}from"./MenuList.styled.js";const u=r(((r,u)=>{let{options:a,isMultiSelect:d,showDescription:p,onSelect:f,version:m,onInfiniteScroll:g,onDropdownItemClick:h,useDefaultCursor:b,focusedIndex:I=-1}=r;const
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import{forwardRef as r,useRef as o,useCallback as s,useEffect as i}from"react";import{MenuItem as c}from"./MenuItem.js";import{StyledGroupedLabel as l}from"./MenuList.styled.js";const u=r(((r,u)=>{let{options:a,isMultiSelect:d,showDescription:p,onSelect:f,version:m,onInfiniteScroll:g,onDropdownItemClick:h,useDefaultCursor:b,focusedIndex:I=-1}=r;const v=o(null),D=o(null),j=s((()=>{v.current&&v.current.disconnect(),v.current=new IntersectionObserver((e=>{e[0].isIntersecting&&(null==g||g())})),D.current&&v.current.observe(D.current)}),[g]);i((()=>(j(),()=>{v.current&&v.current.disconnect()})),[j,a]);const w=new Map;let S=-1;return a.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||(S++,w.set(e,S))}));else{const n=e;n.disabled||(S++,w.set(n,S))}})),e(n,{children:a.map(((n,r)=>{const o=r===a.length-1;if(n.options){const s=n;return t("div",Object.assign({style:{marginTop:"2.0"===m?2:0}},{children:[t(l,Object.assign({version:m},{children:[s.leadingIcon?e("span",Object.assign({style:{marginRight:8}},{children:s.leadingIcon})):null,s.label]})),s.options.map(((n,t)=>{const o=w.get(n),i=o===I&&!n.disabled;return e(c,{version:m,last:t===s.options.length-1,onSelect:f,showDescription:p,onDropdownItemClick:h,isMultiSelect:d,option:n,useDefaultCursor:b,isFocused:i,dataIndex:o,ref:e=>{u&&"object"==typeof u&&u.current&&e&&e&&e&&e&&(u.current[r]=e)}},`${r}-${t}`)})),o?e("span",{ref:D}):null]}),r)}const s=n,i=w.get(s),g=i===I&&!s.disabled;return t("div",{children:[e(c,{version:m,last:o,onSelect:f,showDescription:p,onDropdownItemClick:h,isMultiSelect:d,option:s,useDefaultCursor:b,isFocused:g,dataIndex:i,ref:e=>{u&&"object"==typeof u&&u.current&&e&&(u.current[r]=e)}},s.value),o?e("span",{ref:D}):null]},r)}))})}));export{u as MenuList};
|