ingred-ui 37.2.0 → 37.2.1

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/index.es.js CHANGED
@@ -5549,7 +5549,7 @@ object-assign
5549
5549
  background-color: ${({$variant:e,theme:t,$disabled:n})=>{if(n)return t.palette.text.disabled;return jH(t)[e].indicatorBackground}};
5550
5550
  box-shadow: ${({$variant:e,theme:t,$disabled:n})=>{if(n)return"none";return jH(t)[e].indicatorShadow}};
5551
5551
  border-radius: ${({$size:e,theme:t})=>t.radii[PH[e].itemRadius]}px;
5552
- `,JH="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function UH(e){const n=t.useRef(e);return JH(()=>{n.current=e}),t.useCallback((...e)=>n.current(...e),[])}const QH=e.forwardRef(function({cases:t,value:n,onChange:r,size:i="medium",variant:a="light",disabled:o=!1,fullWidth:l=!1,width:s,showTooltip:c=!1,tooltipPosition:d=["top-start","bottom-start","auto"]},u){const p=oe(),m=t,h=new Map,g=e.useRef(null),f=e.useRef(null),[b,v]=e.useState({}),x=(e,t)=>()=>{!r||o||t||r(e)},y=e.useMemo(()=>"small"===i||"medium"===i?"sm-md":"md",[i]),w=e.useCallback((e,t)=>t?jH(p)[a].iconColorActive:e?p.palette.text.disabled:jH(p)[a].iconColor,[p,a]),C=e.useCallback((e,t)=>{const n=jH(p)[a];return t?n.textColorActive:e?n.textColorDisabled:n.textColor},[p,a]),E=e.useMemo(()=>"small"===i?"xs":"sm",[i]),I=UH(()=>{const{tabsMeta:e,tabMeta:t}=(()=>{const e=g.current;let t,r;if(e){const n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}if(e&&null!=n&&f.current){const e=f.current.children;if(e.length>0){const t=e[h.get(n)];r=(null==t?void 0:t.getBoundingClientRect())||null}}return{tabsMeta:t,tabMeta:r}})();let r=0;if(t&&e){const n=e.scrollLeft;r=t.left-e.left+n}const i={left:r,width:t?t.width:0};if(void 0===b.left||void 0===b.width)v(i);else{const e=Math.abs(b.left-i.left),t=Math.abs((null==b?void 0:b.width)-i.width);(e>=1||t>=1)&&v(i)}});e.useEffect(()=>{I()},[n,m.length,i,a,I]),e.useEffect(()=>{const e=()=>{I()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[I]);const $=o||m.some((e,t)=>(void 0===e.value?t:e.value)===n&&!!e.disabled);return e.createElement(_H,{ref:u,$size:i,$variant:a,$disabled:o,$fullWidth:l,$width:s,role:"tablist","aria-label":"Switch options"},e.createElement(FH,{ref:g},e.createElement(XH,{$size:i,$variant:a,$disabled:$,style:Object.assign({},b)}),e.createElement(GH,{ref:f,$size:i,$fullWidth:l},m.map((t,r)=>{const l=void 0===t.value?r:t.value;h.set(l,r);const s=l===n,u=t.disabled||o,p=null!=t.icon?e.createElement(YH,{$size:i,$variant:a,$active:s,$disabled:u,"data-disabled":u,role:"tab","aria-selected":s,tabIndex:u?-1:0,onClick:x(l,u)},e.createElement(ue,{name:t.icon,size:y,color:w(u,s)})):e.createElement(WH,{key:t.name,$size:i,$variant:a,$active:s,$disabled:u,"data-disabled":u,role:"tab","aria-selected":s,tabIndex:u?-1:0,onClick:x(l,u)},e.createElement(Le,{trimVertical:!0,component:"span",size:E,weight:"normal",color:C(u,s)},t.name));return c?e.createElement(Fc,{key:t.name,content:t.name,positionPriority:d,offset:[0,15]},p):e.createElement(e.Fragment,{key:t.name},p)}))))}),KH=e.forwardRef(function(t,n){var{children:r}=t,i=R(t,["children"]);return e.createElement("tbody",Object.assign({ref:n},i),r)}),qH=v.td`
5552
+ `,JH="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function UH(e){const n=t.useRef(e);return JH(()=>{n.current=e}),t.useCallback((...e)=>n.current(...e),[])}const QH=e.forwardRef(function({cases:t,value:n,onChange:r,size:i="medium",variant:a="light",disabled:o=!1,fullWidth:l=!1,width:s,showTooltip:c=!1,tooltipPosition:d=["top-start","bottom-start","auto"]},u){const p=oe(),m=t,h=new Map,g=e.useRef(null),f=e.useRef(null),[b,v]=e.useState({}),x=(e,t)=>()=>{!r||o||t||r(e)},y=e.useMemo(()=>"small"===i||"medium"===i?"sm-md":"md",[i]),w=e.useCallback((e,t)=>t?jH(p)[a].iconColorActive:e?p.palette.text.disabled:jH(p)[a].iconColor,[p,a]),C=e.useCallback((e,t)=>{const n=jH(p)[a];return t?n.textColorActive:e?n.textColorDisabled:n.textColor},[p,a]),E=e.useMemo(()=>"small"===i?"xs":"sm",[i]),I=UH(()=>{const{tabsMeta:e,tabMeta:t}=(()=>{const e=g.current;let t,r;if(e){const n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}if(e&&null!=n&&f.current){const e=f.current.children;if(e.length>0){const t=e[h.get(n)];r=(null==t?void 0:t.getBoundingClientRect())||null}}return{tabsMeta:t,tabMeta:r}})();let r=0;if(t&&e){const n=e.scrollLeft;r=t.left-e.left+n}const i={left:r,width:t?t.width:0};if(void 0===b.left||void 0===b.width)v(i);else{const e=Math.abs(b.left-i.left),t=Math.abs((null==b?void 0:b.width)-i.width);(e>=1||t>=1)&&v(i)}});e.useEffect(()=>{I()},[n,m.length,i,a,I]),e.useEffect(()=>{const e=()=>{I()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[I]);const $=o||m.some((e,t)=>(void 0===e.value?t:e.value)===n&&!!e.disabled);return e.createElement(_H,{ref:u,$size:i,$variant:a,$disabled:o,$fullWidth:l,$width:s,role:"tablist","aria-label":"Switch options"},e.createElement(FH,{ref:g},e.createElement(XH,{$size:i,$variant:a,$disabled:$,style:Object.assign({},b)}),e.createElement(GH,{ref:f,$size:i,$fullWidth:l},m.map((t,r)=>{const l=void 0===t.value?r:t.value;h.set(l,r);const s=l===n,u=t.disabled||o,p=null!=t.icon?e.createElement(YH,{$size:i,$variant:a,$active:s,$disabled:u,"data-disabled":u,role:"tab","aria-label":t.name,"aria-selected":s,tabIndex:u?-1:0,onClick:x(l,u)},e.createElement(ue,{name:t.icon,size:y,color:w(u,s)})):e.createElement(WH,{key:t.name,$size:i,$variant:a,$active:s,$disabled:u,"data-disabled":u,role:"tab","aria-selected":s,tabIndex:u?-1:0,onClick:x(l,u)},e.createElement(Le,{trimVertical:!0,component:"span",size:E,weight:"normal",color:C(u,s)},t.name));return c?e.createElement(Fc,{key:t.name,content:t.name,positionPriority:d,offset:[0,15]},p):e.createElement(e.Fragment,{key:t.name},p)}))))}),KH=e.forwardRef(function(t,n){var{children:r}=t,i=R(t,["children"]);return e.createElement("tbody",Object.assign({ref:n},i),r)}),qH=v.td`
5553
5553
  width: ${({width:e})=>e};
5554
5554
  padding: ${({theme:e})=>2*e.spacing}px;
5555
5555
  `,eS=e.forwardRef(function(t,n){var{width:r="auto",children:i}=t,a=R(t,["width","children"]);return e.createElement(qH,Object.assign({ref:n,width:r},a),e.createElement(Le,{component:"div"},i))}),tS=e.forwardRef(function({children:t},n){return e.createElement("thead",{ref:n},t)}),nS={small:"8px",medium:"12px",large:"16px"},rS=e=>nS[e],iS=v.tr`