profinansy-ui-lib 3.8.24 → 3.8.25

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,10 +1,11 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { Placement } from '@floating-ui/react';
3
3
  import { ITooltipProps } from './Tooltip.typed';
4
- export declare function useTooltip({ placement, isHover, showArrow }: {
4
+ export declare function useTooltip({ placement, isHover, showArrow, onOpenTooltip }: {
5
5
  placement?: Placement;
6
6
  isHover?: boolean;
7
7
  showArrow?: boolean;
8
+ onOpenTooltip?: ITooltipProps['onOpenTooltip'];
8
9
  }): {
9
10
  placement: Placement;
10
11
  strategy: import("@floating-ui/utils").Strategy;
@@ -362,7 +362,7 @@ Check the top-level render call using <`+q+">.")}return G}}function U2(M,G){{if(
362
362
  white-space: break-spaces;
363
363
  position: relative;
364
364
  ${Et}
365
- `;function Tp({placement:e="bottom",isHover:t=!1,showArrow:n=!0}){const[r,o]=m.useState(!1),i=m.useRef(null),a=z1({placement:e,open:r,onOpenChange:o,whileElementsMounted:pr,middleware:[hi({element:i}),Ur(n?10:4),Jr({crossAxis:e.includes("-"),fallbackAxisSideDirection:"end",padding:5}),Z1({padding:{top:70,bottom:10,left:10,right:10}})]});m.useEffect(()=>{if(a.middlewareData.arrow&&a.middlewareData.shift&&i.current&&n){const{x:g,y:v}=a.middlewareData.arrow,b=l?.placement.split("-")[0],x={};(b==="top"||b==="bottom")&&(x.left=`${g-a.middlewareData.shift.x}px`,b==="top"?x.bottom="0px":x.top="-13px"),(b==="left"||b==="right")&&(x.top=`${v-a.middlewareData.shift.y}px`,b==="left"?x.right="0px":x.left="-13px"),Object.assign(i.current.style,x)}},[a,n]);const l=a.context,c=Fs(l,{enabled:t,handleClose:Mp(),move:!1,delay:{open:300,close:0}}),u=G1(l,{enabled:!t}),f=Y1(l),p=U1(l),C=X1([f,p,u,c]);return m.useMemo(()=>({arrowRef:i,open:r,setOpen:o,...C,...a}),[r,o,C,a,i])}const Os=m.createContext(null),K1=({children:e,width:t,height:n,zIndex:r,padding:o,borderRadius:i,styleContainer:a,...l})=>{const c=Tp({...l});return s.jsx(Os.Provider,{value:c,children:s.jsxs("div",{style:a,onClick:u=>l.isHover?null:u.stopPropagation(),children:[s.jsx(Rp,{targetElement:l.targetElement}),s.jsx(Pp,{width:t,height:n,zIndex:r,padding:o,borderRadius:i,showArrow:l.showArrow,children:e})]})})},Rp=({targetElement:e})=>{const t=m.useContext(Os),n=dn([t.refs.setReference]);return e&&m.isValidElement(e)?m.cloneElement(e,t.getReferenceProps({ref:n,...e.props,"data-state":t.open?"open":"closed"})):null},Pp=({children:e,width:t,height:n,zIndex:r,padding:o,borderRadius:i,showArrow:a=!0})=>{const{context:l,...c}=m.useContext(Os),u=dn([c.refs.setFloating]),{mode:f}=ne(),{styles:p}=J1(l,{duration:{open:100,close:100},initial:{opacity:0,transform:"scale(0.8)"}});return l.open?s.jsx(W1,{children:s.jsx(Dp,{ref:u,style:{zIndex:r||_t.zIndex5,...c.floatingStyles},...c.getFloatingProps(),children:s.jsx(h.ThemeProvider,{theme:J[f],children:s.jsx("div",{style:p,children:s.jsxs(_p,{$width:t,$height:n,$borderRadius:i,$mode:f,children:[a&&s.jsx(js,{ref:c.arrowRef,context:l,tipRadius:2,stroke:f==="light"?"#f0f0f0":J[f].stroke.contrast,strokeWidth:1,fill:J[f].background.field}),s.jsx(Ap,{$height:n,$padding:o,children:e})]})})})})}):null},Ns=({$isCloseMode:e})=>s.jsx(K1,{isHover:!0,targetElement:s.jsx("div",{style:{display:"flex",alignItems:"center"},children:s.jsx(N8,{$isCloseMode:e})}),children:s.jsxs(Z8,{children:["Доступно по подписке ",s.jsx("span",{children:"Premium"})]})}),Vl=e=>{switch(e){case"header1-Bold":return[48,56,700];case"header2-ExtraBold":return[32,44,800];case"header2-Bold":return[32,44,700];case"header3-Bold":return[24,32,700];case"header3-SemiBold":return[24,32,600];case"header4-Bold":return[20,24,700];case"header4-SemiBold":return[20,24,600];case"header5-Bold":return[18,22,700];case"header5-SemiBold":return[18,22,600];case"header6-Bold":return[16,20,700];case"header6-SemiBold":return[16,20,600];case"paragraph-Regular":return[17,22,400];case"paragraph-Medium":return[17,22,500];case"text-Regular":return[15,20,400];case"text-Medium":return[15,20,500];case"text-Bold":return[15,20,700];case"description-Regular":return[14,18,400];case"description-Medium":return[14,18,500];case"description-SemiBold":return[14,18,600];case"description-Bold":return[14,18,700];case"caption-Medium":return[13,16,500];case"caption-SemiBold":return[13,16,600];case"caption-Bold":return[13,16,700];case"caption2-Medium":return[12,16,500];case"caption2-SemiBold":return[12,16,600];case"caption2-Bold":return[12,16,700];case"tag-Medium11":return[11,14,500];case"tag-Medium10":return[10,14,500];case"tag-Medium9":return[9,14,500];case"controls-Regular":return[16,20,400];case"controls-Medium":return[16,20,500];case"controls-SemiBold":return[16,20,600];default:return[15,20,400]}},Hp=e=>{if(Array.isArray(e)){let t="";return e.forEach(({variant:n,resolution:r})=>{const o=Vl(n);r?t+=`@media (max-width: ${r}px) {
365
+ `;function Tp({placement:e="bottom",isHover:t=!1,showArrow:n=!0,onOpenTooltip:r}){const[o,i]=m.useState(!1),a=m.useRef(null);m.useEffect(()=>{r&&r(o)},[o]);const l=z1({placement:e,open:o,onOpenChange:i,whileElementsMounted:pr,middleware:[hi({element:a}),Ur(n?10:4),Jr({crossAxis:e.includes("-"),fallbackAxisSideDirection:"end",padding:5}),Z1({padding:{top:70,bottom:10,left:10,right:10}})]});m.useEffect(()=>{if(l.middlewareData.arrow&&l.middlewareData.shift&&a.current&&n){const{x:v,y:b}=l.middlewareData.arrow,x=c?.placement.split("-")[0],y={};(x==="top"||x==="bottom")&&(y.left=`${v-l.middlewareData.shift.x}px`,x==="top"?y.bottom="0px":y.top="-13px"),(x==="left"||x==="right")&&(y.top=`${b-l.middlewareData.shift.y}px`,x==="left"?y.right="0px":y.left="-13px"),Object.assign(a.current.style,y)}},[l,n]);const c=l.context,u=Fs(c,{enabled:t,handleClose:Mp(),move:!1,delay:{open:300,close:0}}),f=G1(c,{enabled:!t}),p=Y1(c),C=U1(c),g=X1([p,C,f,u]);return m.useMemo(()=>({arrowRef:a,open:o,setOpen:i,...g,...l}),[o,i,g,l,a])}const Os=m.createContext(null),K1=({children:e,width:t,height:n,zIndex:r,padding:o,borderRadius:i,styleContainer:a,...l})=>{const c=Tp({...l});return s.jsx(Os.Provider,{value:c,children:s.jsxs("div",{style:a,onClick:u=>l.isHover?null:u.stopPropagation(),children:[s.jsx(Rp,{targetElement:l.targetElement}),s.jsx(Pp,{width:t,height:n,zIndex:r,padding:o,borderRadius:i,showArrow:l.showArrow,children:e})]})})},Rp=({targetElement:e})=>{const t=m.useContext(Os),n=dn([t.refs.setReference]);return e&&m.isValidElement(e)?m.cloneElement(e,t.getReferenceProps({ref:n,...e.props,"data-state":t.open?"open":"closed"})):null},Pp=({children:e,width:t,height:n,zIndex:r,padding:o,borderRadius:i,showArrow:a=!0})=>{const{context:l,...c}=m.useContext(Os),u=dn([c.refs.setFloating]),{mode:f}=ne(),{styles:p}=J1(l,{duration:{open:100,close:100},initial:{opacity:0,transform:"scale(0.8)"}});return l.open?s.jsx(W1,{children:s.jsx(Dp,{ref:u,style:{zIndex:r||_t.zIndex5,...c.floatingStyles},...c.getFloatingProps(),children:s.jsx(h.ThemeProvider,{theme:J[f],children:s.jsx("div",{style:p,children:s.jsxs(_p,{$width:t,$height:n,$borderRadius:i,$mode:f,children:[a&&s.jsx(js,{ref:c.arrowRef,context:l,tipRadius:2,stroke:f==="light"?"#f0f0f0":J[f].stroke.contrast,strokeWidth:1,fill:J[f].background.field}),s.jsx(Ap,{$height:n,$padding:o,children:e})]})})})})}):null},Ns=({$isCloseMode:e})=>s.jsx(K1,{isHover:!0,targetElement:s.jsx("div",{style:{display:"flex",alignItems:"center"},children:s.jsx(N8,{$isCloseMode:e})}),children:s.jsxs(Z8,{children:["Доступно по подписке ",s.jsx("span",{children:"Premium"})]})}),Vl=e=>{switch(e){case"header1-Bold":return[48,56,700];case"header2-ExtraBold":return[32,44,800];case"header2-Bold":return[32,44,700];case"header3-Bold":return[24,32,700];case"header3-SemiBold":return[24,32,600];case"header4-Bold":return[20,24,700];case"header4-SemiBold":return[20,24,600];case"header5-Bold":return[18,22,700];case"header5-SemiBold":return[18,22,600];case"header6-Bold":return[16,20,700];case"header6-SemiBold":return[16,20,600];case"paragraph-Regular":return[17,22,400];case"paragraph-Medium":return[17,22,500];case"text-Regular":return[15,20,400];case"text-Medium":return[15,20,500];case"text-Bold":return[15,20,700];case"description-Regular":return[14,18,400];case"description-Medium":return[14,18,500];case"description-SemiBold":return[14,18,600];case"description-Bold":return[14,18,700];case"caption-Medium":return[13,16,500];case"caption-SemiBold":return[13,16,600];case"caption-Bold":return[13,16,700];case"caption2-Medium":return[12,16,500];case"caption2-SemiBold":return[12,16,600];case"caption2-Bold":return[12,16,700];case"tag-Medium11":return[11,14,500];case"tag-Medium10":return[10,14,500];case"tag-Medium9":return[9,14,500];case"controls-Regular":return[16,20,400];case"controls-Medium":return[16,20,500];case"controls-SemiBold":return[16,20,600];default:return[15,20,400]}},Hp=e=>{if(Array.isArray(e)){let t="";return e.forEach(({variant:n,resolution:r})=>{const o=Vl(n);r?t+=`@media (max-width: ${r}px) {
366
366
  font-size: ${o[0]}px;
367
367
  line-height: ${o[1]}px;
368
368
  font-weight: ${o[2]};`:t+=`