@foxford/ui 2.50.1 → 2.51.0-beta-e0179b8-20241107
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/components/Badge/style.js +1 -1
- package/components/Badge/style.js.map +1 -1
- package/components/Badge/style.mjs +1 -1
- package/components/Badge/style.mjs.map +1 -1
- package/components/FormLabel/FormLabel.js +1 -1
- package/components/FormLabel/FormLabel.js.map +1 -1
- package/components/FormLabel/FormLabel.mjs +1 -1
- package/components/FormLabel/FormLabel.mjs.map +1 -1
- package/components/FormLabel/style.js +1 -1
- package/components/FormLabel/style.js.map +1 -1
- package/components/FormLabel/style.mjs +1 -1
- package/components/FormLabel/style.mjs.map +1 -1
- package/components/InputCheckbox/InputCheckbox.js +1 -1
- package/components/InputCheckbox/InputCheckbox.js.map +1 -1
- package/components/InputCheckbox/InputCheckbox.mjs +1 -1
- package/components/InputCheckbox/InputCheckbox.mjs.map +1 -1
- package/components/InputRadio/InputRadio.js +1 -1
- package/components/InputRadio/InputRadio.js.map +1 -1
- package/components/InputRadio/InputRadio.mjs +1 -1
- package/components/InputRadio/InputRadio.mjs.map +1 -1
- package/components/MenuComponent/MenuComponent.js +1 -1
- package/components/MenuComponent/MenuComponent.js.map +1 -1
- package/components/MenuComponent/MenuComponent.mjs +1 -1
- package/components/MenuComponent/MenuComponent.mjs.map +1 -1
- package/components/Switch/Knob.js +2 -0
- package/components/Switch/Knob.js.map +1 -0
- package/components/Switch/Knob.mjs +2 -0
- package/components/Switch/Knob.mjs.map +1 -0
- package/components/Switch/Switch.js +2 -0
- package/components/Switch/Switch.js.map +1 -0
- package/components/Switch/Switch.mjs +2 -0
- package/components/Switch/Switch.mjs.map +1 -0
- package/components/Switch/constants.js +2 -0
- package/components/Switch/constants.js.map +1 -0
- package/components/Switch/constants.mjs +2 -0
- package/components/Switch/constants.mjs.map +1 -0
- package/components/Switch/style.js +2 -0
- package/components/Switch/style.js.map +1 -0
- package/components/Switch/style.mjs +2 -0
- package/components/Switch/style.mjs.map +1 -0
- package/components/Tooltip/Tooltip.js +1 -1
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.mjs +1 -1
- package/components/Tooltip/Tooltip.mjs.map +1 -1
- package/components/Tooltip/TooltipWrapper.js +1 -1
- package/components/Tooltip/TooltipWrapper.js.map +1 -1
- package/components/Tooltip/TooltipWrapper.mjs +1 -1
- package/components/Tooltip/TooltipWrapper.mjs.map +1 -1
- package/dts/index.d.ts +83 -5
- package/hooks/useClickOutside.js +2 -0
- package/hooks/useClickOutside.js.map +1 -0
- package/hooks/useClickOutside.mjs +2 -0
- package/hooks/useClickOutside.mjs.map +1 -0
- package/hooks/useScrollMonitor.js +2 -0
- package/hooks/useScrollMonitor.js.map +1 -0
- package/hooks/useScrollMonitor.mjs +2 -0
- package/hooks/useScrollMonitor.mjs.map +1 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuComponent.js","sources":["../../../../src/components/MenuComponent/MenuComponent.tsx"],"sourcesContent":["import { forwardRef, useRef, useImperativeHandle, useEffect, isValidElement, cloneElement } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { focusFirstFocusable } from 'shared/utils/dom'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { MenuComponentProps } from './types'\n\nconst COMPONENT_NAME = 'MenuComponent'\n\nconst noop = () => undefined\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [MenuComponentProps](https://github.com/foxford/ui/blob/master/src/components/MenuComponent/types.ts)\n */\nconst MenuComponent: React.ForwardRefExoticComponent<MenuComponentProps> = withMergedProps<\n MenuComponentProps,\n HTMLDivElement\n>(\n forwardRef((props, forwardedRef) => {\n const {\n size = 'm',\n closeFn = noop,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n children,\n autoFocus,\n disableAutoFocus,\n showCloseButton,\n closeButtonProps,\n onUnmount,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n useEffect(() => {\n return () => {\n if (onUnmount) onUnmount()\n }\n }, [])\n\n useEffect(() => {\n const timerId = setTimeout(() => {\n if (!disableAutoFocus && ref.current) focusFirstFocusable(ref.current)\n }, 0)\n\n return () => {\n clearTimeout(timerId)\n }\n }, [autoFocus, disableAutoFocus])\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const forwardProps = {\n showCloseButton,\n closeButtonProps,\n closeFn,\n }\n\n const elementProps =\n isValidElement(children) && typeof children.props === 'object' && children.props !== null ? children.props : {}\n\n return (\n <Styled.Root {...restProps} {...sizeProps} ref={ref}>\n {isValidElement(children)\n ? cloneElement(children, { ...sizeProps, ...forwardProps, ...elementProps })\n : typeof children === 'function'\n ? children({ ...sizeProps, ...forwardProps })\n : undefined}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { MenuComponent }\n\nexport { SIZES }\n"],"names":["noop","MenuComponent","withMergedProps","forwardRef","props","forwardedRef","size","closeFn","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","children","autoFocus","disableAutoFocus","showCloseButton","closeButtonProps","onUnmount","restProps","ref","useRef","useImperativeHandle","current","useEffect","timerId","setTimeout","focusFirstFocusable","clearTimeout","sizeProps","forwardProps","elementProps","isValidElement","_jsx","Styled","cloneElement","undefined","displayName","sizes","SIZES"],"mappings":"sQASA,MAAMA,KAAOA,KAAe,EAYtBC,MAAAA,cAAqEC,gBAAAA,gBAIzEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,IAAGC,QACVA,EAAUP,KAAIQ,QACdA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,SACNA,EAAQC,UACRA,EAASC,iBACTA,EAAgBC,gBAChBA,EAAeC,iBACfA,EAAgBC,UAChBA,KACGC,GACDhB,EAEJ,MAAMiB,EAAMC,aAAuB,MAEnCC,MAAAA,oBAAkElB,GAAc,IAAMgB,EAAIG,
|
|
1
|
+
{"version":3,"file":"MenuComponent.js","sources":["../../../../src/components/MenuComponent/MenuComponent.tsx"],"sourcesContent":["import { forwardRef, useRef, useImperativeHandle, useEffect, isValidElement, cloneElement } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { focusFirstFocusable } from 'shared/utils/dom'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { MenuComponentProps } from './types'\n\nconst COMPONENT_NAME = 'MenuComponent'\n\nconst noop = () => undefined\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [MenuComponentProps](https://github.com/foxford/ui/blob/master/src/components/MenuComponent/types.ts)\n */\nconst MenuComponent: React.ForwardRefExoticComponent<MenuComponentProps> = withMergedProps<\n MenuComponentProps,\n HTMLDivElement\n>(\n forwardRef((props, forwardedRef) => {\n const {\n size = 'm',\n closeFn = noop,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n children,\n autoFocus,\n disableAutoFocus,\n showCloseButton,\n closeButtonProps,\n onUnmount,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current, [])\n\n useEffect(() => {\n return () => {\n if (onUnmount) onUnmount()\n }\n }, [])\n\n useEffect(() => {\n const timerId = setTimeout(() => {\n if (!disableAutoFocus && ref.current) focusFirstFocusable(ref.current)\n }, 0)\n\n return () => {\n clearTimeout(timerId)\n }\n }, [autoFocus, disableAutoFocus])\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const forwardProps = {\n showCloseButton,\n closeButtonProps,\n closeFn,\n }\n\n const elementProps =\n isValidElement(children) && typeof children.props === 'object' && children.props !== null ? children.props : {}\n\n return (\n <Styled.Root {...restProps} {...sizeProps} ref={ref}>\n {isValidElement(children)\n ? cloneElement(children, { ...sizeProps, ...forwardProps, ...elementProps })\n : typeof children === 'function'\n ? children({ ...sizeProps, ...forwardProps })\n : undefined}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { MenuComponent }\n\nexport { SIZES }\n"],"names":["noop","MenuComponent","withMergedProps","forwardRef","props","forwardedRef","size","closeFn","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","children","autoFocus","disableAutoFocus","showCloseButton","closeButtonProps","onUnmount","restProps","ref","useRef","useImperativeHandle","current","useEffect","timerId","setTimeout","focusFirstFocusable","clearTimeout","sizeProps","forwardProps","elementProps","isValidElement","_jsx","Styled","cloneElement","undefined","displayName","sizes","SIZES"],"mappings":"sQASA,MAAMA,KAAOA,KAAe,EAYtBC,MAAAA,cAAqEC,gBAAAA,gBAIzEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,IAAGC,QACVA,EAAUP,KAAIQ,QACdA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,SACNA,EAAQC,UACRA,EAASC,iBACTA,EAAgBC,gBAChBA,EAAeC,iBACfA,EAAgBC,UAChBA,KACGC,GACDhB,EAEJ,MAAMiB,EAAMC,aAAuB,MAEnCC,MAAAA,oBAAkElB,GAAc,IAAMgB,EAAIG,SAAS,IAEnGC,MAAAA,WAAU,IACD,KACDN,GAAWA,GAAW,GAE3B,IAEHM,MAAAA,WAAU,KACR,MAAMC,EAAUC,YAAW,MACpBX,GAAoBK,EAAIG,SAASI,IAAAA,oBAAoBP,EAAIG,QAAQ,GACrE,GAEH,MAAO,KACLK,aAAaH,EAAQ,CACtB,GACA,CAACX,EAAWC,IAEf,MAAMc,EAAY,CAChBxB,OACAE,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMkB,EAAe,CACnBd,kBACAC,mBACAX,WAGF,MAAMyB,EACJC,MAAcA,eAACnB,WAAoBA,EAASV,OAAU,UAAYU,EAASV,QAAU,KAAOU,EAASV,MAAQ,CAAA,EAE/G,OACE8B,WAAAA,IAACC,MAAAA,KAAW,IAAKf,KAAeU,EAAWT,IAAKA,EAAIP,SACjDmB,MAAAA,eAAenB,GACZsB,MAAAA,aAAatB,EAAU,IAAKgB,KAAcC,KAAiBC,WACpDlB,GAAa,WACpBA,EAAS,IAAKgB,KAAcC,SAC5BM,GACQ,IAGlB,CACEC,YAvFmB,gBAwFnBC,MAAOC,UAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{forwardRef,useRef,useImperativeHandle,useEffect,isValidElement,cloneElement}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{focusFirstFocusable}from'../../shared/utils/dom.mjs';import{SIZES}from'./constants.mjs';import{Root}from'./style.mjs';import{jsx}from'react/jsx-runtime';const noop=()=>{};const MenuComponent=withMergedProps(forwardRef(((e,o)=>{const{size:s="m",closeFn:t=noop,sizeXXS:n,sizeXS:r,sizeS:i,sizeM:c,sizeL:u,sizeXL:m,children:l,autoFocus:p,disableAutoFocus:f,showCloseButton:a,closeButtonProps:d,onUnmount:z,...S}=e;const E=useRef(null);useImperativeHandle(o,(()=>E.current)),useEffect((()=>()=>{z&&z()}),[]),useEffect((()=>{const e=setTimeout((()=>{!f&&E.current&&focusFirstFocusable(E.current)}),0);return()=>{clearTimeout(e)}}),[p,f]);const h={size:s,sizeXXS:n,sizeXS:r,sizeS:i,sizeM:c,sizeL:u,sizeXL:m};const j={showCloseButton:a,closeButtonProps:d,closeFn:t};const F=isValidElement(l)&&typeof l.props=='object'&&l.props!==null?l.props:{};return jsx(Root,{...S,...h,ref:E,children:isValidElement(l)?cloneElement(l,{...h,...j,...F}):typeof l=='function'?l({...h,...j}):void 0})})),{displayName:'MenuComponent',sizes:SIZES});export{MenuComponent,SIZES};
|
|
1
|
+
import{forwardRef,useRef,useImperativeHandle,useEffect,isValidElement,cloneElement}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{focusFirstFocusable}from'../../shared/utils/dom.mjs';import{SIZES}from'./constants.mjs';import{Root}from'./style.mjs';import{jsx}from'react/jsx-runtime';const noop=()=>{};const MenuComponent=withMergedProps(forwardRef(((e,o)=>{const{size:s="m",closeFn:t=noop,sizeXXS:n,sizeXS:r,sizeS:i,sizeM:c,sizeL:u,sizeXL:m,children:l,autoFocus:p,disableAutoFocus:f,showCloseButton:a,closeButtonProps:d,onUnmount:z,...S}=e;const E=useRef(null);useImperativeHandle(o,(()=>E.current),[]),useEffect((()=>()=>{z&&z()}),[]),useEffect((()=>{const e=setTimeout((()=>{!f&&E.current&&focusFirstFocusable(E.current)}),0);return()=>{clearTimeout(e)}}),[p,f]);const h={size:s,sizeXXS:n,sizeXS:r,sizeS:i,sizeM:c,sizeL:u,sizeXL:m};const j={showCloseButton:a,closeButtonProps:d,closeFn:t};const F=isValidElement(l)&&typeof l.props=='object'&&l.props!==null?l.props:{};return jsx(Root,{...S,...h,ref:E,children:isValidElement(l)?cloneElement(l,{...h,...j,...F}):typeof l=='function'?l({...h,...j}):void 0})})),{displayName:'MenuComponent',sizes:SIZES});export{MenuComponent,SIZES};
|
|
2
2
|
//# sourceMappingURL=MenuComponent.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuComponent.mjs","sources":["../../../../src/components/MenuComponent/MenuComponent.tsx"],"sourcesContent":["import { forwardRef, useRef, useImperativeHandle, useEffect, isValidElement, cloneElement } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { focusFirstFocusable } from 'shared/utils/dom'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { MenuComponentProps } from './types'\n\nconst COMPONENT_NAME = 'MenuComponent'\n\nconst noop = () => undefined\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [MenuComponentProps](https://github.com/foxford/ui/blob/master/src/components/MenuComponent/types.ts)\n */\nconst MenuComponent: React.ForwardRefExoticComponent<MenuComponentProps> = withMergedProps<\n MenuComponentProps,\n HTMLDivElement\n>(\n forwardRef((props, forwardedRef) => {\n const {\n size = 'm',\n closeFn = noop,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n children,\n autoFocus,\n disableAutoFocus,\n showCloseButton,\n closeButtonProps,\n onUnmount,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n useEffect(() => {\n return () => {\n if (onUnmount) onUnmount()\n }\n }, [])\n\n useEffect(() => {\n const timerId = setTimeout(() => {\n if (!disableAutoFocus && ref.current) focusFirstFocusable(ref.current)\n }, 0)\n\n return () => {\n clearTimeout(timerId)\n }\n }, [autoFocus, disableAutoFocus])\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const forwardProps = {\n showCloseButton,\n closeButtonProps,\n closeFn,\n }\n\n const elementProps =\n isValidElement(children) && typeof children.props === 'object' && children.props !== null ? children.props : {}\n\n return (\n <Styled.Root {...restProps} {...sizeProps} ref={ref}>\n {isValidElement(children)\n ? cloneElement(children, { ...sizeProps, ...forwardProps, ...elementProps })\n : typeof children === 'function'\n ? children({ ...sizeProps, ...forwardProps })\n : undefined}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { MenuComponent }\n\nexport { SIZES }\n"],"names":["noop","MenuComponent","withMergedProps","forwardRef","props","forwardedRef","size","closeFn","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","children","autoFocus","disableAutoFocus","showCloseButton","closeButtonProps","onUnmount","restProps","ref","useRef","useImperativeHandle","current","useEffect","timerId","setTimeout","focusFirstFocusable","clearTimeout","sizeProps","forwardProps","elementProps","isValidElement","_jsx","Styled","cloneElement","undefined","displayName","sizes","SIZES"],"mappings":"2TASA,MAAMA,KAAOA,KAAe,EAYtBC,MAAAA,cAAqEC,gBAIzEC,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,IAAGC,QACVA,EAAUP,KAAIQ,QACdA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,SACNA,EAAQC,UACRA,EAASC,iBACTA,EAAgBC,gBAChBA,EAAeC,iBACfA,EAAgBC,UAChBA,KACGC,GACDhB,EAEJ,MAAMiB,EAAMC,OAAuB,MAEnCC,oBAAkElB,GAAc,IAAMgB,EAAIG,
|
|
1
|
+
{"version":3,"file":"MenuComponent.mjs","sources":["../../../../src/components/MenuComponent/MenuComponent.tsx"],"sourcesContent":["import { forwardRef, useRef, useImperativeHandle, useEffect, isValidElement, cloneElement } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { focusFirstFocusable } from 'shared/utils/dom'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { MenuComponentProps } from './types'\n\nconst COMPONENT_NAME = 'MenuComponent'\n\nconst noop = () => undefined\n\n/**\n *\n * Component accepts all \\<div\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [MenuComponentProps](https://github.com/foxford/ui/blob/master/src/components/MenuComponent/types.ts)\n */\nconst MenuComponent: React.ForwardRefExoticComponent<MenuComponentProps> = withMergedProps<\n MenuComponentProps,\n HTMLDivElement\n>(\n forwardRef((props, forwardedRef) => {\n const {\n size = 'm',\n closeFn = noop,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n children,\n autoFocus,\n disableAutoFocus,\n showCloseButton,\n closeButtonProps,\n onUnmount,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current, [])\n\n useEffect(() => {\n return () => {\n if (onUnmount) onUnmount()\n }\n }, [])\n\n useEffect(() => {\n const timerId = setTimeout(() => {\n if (!disableAutoFocus && ref.current) focusFirstFocusable(ref.current)\n }, 0)\n\n return () => {\n clearTimeout(timerId)\n }\n }, [autoFocus, disableAutoFocus])\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const forwardProps = {\n showCloseButton,\n closeButtonProps,\n closeFn,\n }\n\n const elementProps =\n isValidElement(children) && typeof children.props === 'object' && children.props !== null ? children.props : {}\n\n return (\n <Styled.Root {...restProps} {...sizeProps} ref={ref}>\n {isValidElement(children)\n ? cloneElement(children, { ...sizeProps, ...forwardProps, ...elementProps })\n : typeof children === 'function'\n ? children({ ...sizeProps, ...forwardProps })\n : undefined}\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { MenuComponent }\n\nexport { SIZES }\n"],"names":["noop","MenuComponent","withMergedProps","forwardRef","props","forwardedRef","size","closeFn","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","children","autoFocus","disableAutoFocus","showCloseButton","closeButtonProps","onUnmount","restProps","ref","useRef","useImperativeHandle","current","useEffect","timerId","setTimeout","focusFirstFocusable","clearTimeout","sizeProps","forwardProps","elementProps","isValidElement","_jsx","Styled","cloneElement","undefined","displayName","sizes","SIZES"],"mappings":"2TASA,MAAMA,KAAOA,KAAe,EAYtBC,MAAAA,cAAqEC,gBAIzEC,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,IAAGC,QACVA,EAAUP,KAAIQ,QACdA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,SACNA,EAAQC,UACRA,EAASC,iBACTA,EAAgBC,gBAChBA,EAAeC,iBACfA,EAAgBC,UAChBA,KACGC,GACDhB,EAEJ,MAAMiB,EAAMC,OAAuB,MAEnCC,oBAAkElB,GAAc,IAAMgB,EAAIG,SAAS,IAEnGC,WAAU,IACD,KACDN,GAAWA,GAAW,GAE3B,IAEHM,WAAU,KACR,MAAMC,EAAUC,YAAW,MACpBX,GAAoBK,EAAIG,SAASI,oBAAoBP,EAAIG,QAAQ,GACrE,GAEH,MAAO,KACLK,aAAaH,EAAQ,CACtB,GACA,CAACX,EAAWC,IAEf,MAAMc,EAAY,CAChBxB,OACAE,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,MAAMkB,EAAe,CACnBd,kBACAC,mBACAX,WAGF,MAAMyB,EACJC,eAAenB,WAAoBA,EAASV,OAAU,UAAYU,EAASV,QAAU,KAAOU,EAASV,MAAQ,CAAA,EAE/G,OACE8B,IAACC,KAAW,IAAKf,KAAeU,EAAWT,IAAKA,EAAIP,SACjDmB,eAAenB,GACZsB,aAAatB,EAAU,IAAKgB,KAAcC,KAAiBC,WACpDlB,GAAa,WACpBA,EAAS,IAAKgB,KAAcC,SAC5BM,GACQ,IAGlB,CACEC,YAvFmB,gBAwFnBC,MAAOC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var withMergedProps=require('../../hocs/withMergedProps.js');var constants=require('./constants.js');var style=require('./style.js');var require$$0=require('react/jsx-runtime');const Knob=withMergedProps.withMergedProps((({size:e="m",...r})=>require$$0.jsx(style.Knob,{...r,size:e})),{displayName:'Knob',sizes:constants.SIZES_KNOB});exports.Knob=Knob;
|
|
2
|
+
//# sourceMappingURL=Knob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Knob.js","sources":["../../../../src/components/Switch/Knob.tsx"],"sourcesContent":["import { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES_KNOB } from './constants'\nimport * as Styled from './style'\nimport type { KnobProps } from './types'\n\nconst COMPONENT_NAME = 'Knob'\n\nconst Knob: React.ForwardRefExoticComponent<KnobProps> = withMergedProps<KnobProps, HTMLSpanElement>(\n ({ size = 'm', ...props }) => {\n return <Styled.Knob {...props} size={size} />\n },\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES_KNOB,\n }\n)\n\nexport { Knob }\n"],"names":["Knob","withMergedProps","size","props","_jsx","Styled","displayName","sizes","SIZES_KNOB"],"mappings":"8LAOA,MAAMA,KAAmDC,gBAAeA,iBACtE,EAAGC,OAAO,OAAQC,KACTC,WAAAA,IAACC,MAAAA,KAAW,IAAKF,EAAOD,KAAMA,KAEvC,CACEI,YAPmB,OAQnBC,MAAOC,UAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{SIZES_KNOB}from'./constants.mjs';import{Knob as Knob$1}from'./style.mjs';import{jsx}from'react/jsx-runtime';const Knob=withMergedProps((({size:o="m",...s})=>jsx(Knob$1,{...s,size:o})),{displayName:'Knob',sizes:SIZES_KNOB});export{Knob};
|
|
2
|
+
//# sourceMappingURL=Knob.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Knob.mjs","sources":["../../../../src/components/Switch/Knob.tsx"],"sourcesContent":["import { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES_KNOB } from './constants'\nimport * as Styled from './style'\nimport type { KnobProps } from './types'\n\nconst COMPONENT_NAME = 'Knob'\n\nconst Knob: React.ForwardRefExoticComponent<KnobProps> = withMergedProps<KnobProps, HTMLSpanElement>(\n ({ size = 'm', ...props }) => {\n return <Styled.Knob {...props} size={size} />\n },\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES_KNOB,\n }\n)\n\nexport { Knob }\n"],"names":["Knob","withMergedProps","size","props","_jsx","Styled","displayName","sizes","SIZES_KNOB"],"mappings":"+KAOA,MAAMA,KAAmDC,iBACvD,EAAGC,OAAO,OAAQC,KACTC,IAACC,OAAW,IAAKF,EAAOD,KAAMA,KAEvC,CACEI,YAPmB,OAQnBC,MAAOC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var Knob=require('./Knob.js');var constants=require('./constants.js');var style=require('./style.js');var require$$0=require('react/jsx-runtime');const Switch=withMergedProps.withMergedProps(React.forwardRef(((e,s)=>{const{size:i="m",knobProps:r={},sizeXXS:t,sizeXS:a,sizeS:n,sizeM:c,sizeL:o,sizeXL:l,sizes:z,sizeUnits:u,preset:d,inline:p,palette:h,style:S,className:q,disabled:w,...$}=e;const b={size:i,sizeXXS:t,sizeXS:a,sizeS:n,sizeM:c,sizeL:o,sizeXL:l};return require$$0.jsxs(style.Root,{...b,sizes:z,sizeUnits:u,preset:d,inline:p,palette:h,style:S,className:q,disabled:w,children:[require$$0.jsx(style.Input,{...$,disabled:w,type:"checkbox",ref:s}),require$$0.jsx(style.Track,{children:require$$0.jsx(Knob.Knob,{...b,...r})})]})})),{displayName:"Switch",sizes:constants.SIZES});exports.COMPONENT_NAME="Switch",exports.Switch=Switch;
|
|
2
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Knob } from './Knob'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { SwitchProps } from './types'\n\nconst COMPONENT_NAME = 'Switch'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Switch/types.ts).\n */\nconst Switch: React.ForwardRefExoticComponent<SwitchProps> = withMergedProps<SwitchProps, HTMLInputElement>(\n forwardRef((props, ref) => {\n const {\n size = 'm',\n knobProps = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n palette,\n style,\n className,\n disabled,\n ...inputProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n return (\n <Styled.Root\n {...sizeProps}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n palette={palette}\n style={style}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='checkbox' ref={ref} />\n <Styled.Track>\n <Knob {...sizeProps} {...knobProps} />\n </Styled.Track>\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Switch, COMPONENT_NAME }\n"],"names":["Switch","withMergedProps","forwardRef","props","ref","size","knobProps","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","palette","style","className","disabled","inputProps","sizeProps","_jsxs","Styled","children","_jsx","jsx","type","Knob","displayName","SIZES"],"mappings":"uPAmBMA,MAAAA,OAAuDC,gBAAAA,gBAC3DC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,IAAGC,UACVA,EAAY,CAAE,EAAAC,QACdA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,UACLA,EAASC,OACTA,EAAMC,OACNA,EAAMC,QACNA,QACAC,EAAKC,UACLA,EAASC,SACTA,KACGC,GACDlB,EAEJ,MAAMmB,EAAY,CAChBjB,OACAE,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,OACEW,WAAAA,KAACC,MAAAA,KAAW,IACNF,EACJT,MAAOA,EACPC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,QAASA,EACTC,MAAOA,EACPC,UAAWA,EACXC,SAAUA,EAASK,SAEnBC,CAAAA,WAAAC,IAACH,YAAY,IAAKH,EAAYD,SAAUA,EAAUQ,KAAK,WAAWxB,IAAKA,IACvEsB,WAAAC,IAACH,YAAY,CAAAC,SACXC,WAAAC,IAACE,UAAI,IAAKP,KAAehB,QAEf,IAGlB,CACEwB,YAhEmB,SAiEnBjB,MAAOkB,UAAAA,+BAjEY"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{forwardRef}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{Knob}from'./Knob.mjs';import{SIZES}from'./constants.mjs';import{Root,Input,Track}from'./style.mjs';import{jsxs,jsx}from'react/jsx-runtime';const COMPONENT_NAME='Switch';const Switch=withMergedProps(forwardRef(((s,e)=>{const{size:i="m",knobProps:t={},sizeXXS:r,sizeXS:o,sizeS:n,sizeM:m,sizeL:c,sizeXL:p,sizes:z,sizeUnits:a,preset:l,inline:d,palette:S,style:f,className:h,disabled:j,...w}=s;const x={size:i,sizeXXS:r,sizeXS:o,sizeS:n,sizeM:m,sizeL:c,sizeXL:p};return jsxs(Root,{...x,sizes:z,sizeUnits:a,preset:l,inline:d,palette:S,style:f,className:h,disabled:j,children:[jsx(Input,{...w,disabled:j,type:"checkbox",ref:e}),jsx(Track,{children:jsx(Knob,{...x,...t})})]})})),{displayName:"Switch",sizes:SIZES});export{COMPONENT_NAME,Switch};
|
|
2
|
+
//# sourceMappingURL=Switch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.mjs","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Knob } from './Knob'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { SwitchProps } from './types'\n\nconst COMPONENT_NAME = 'Switch'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Switch/types.ts).\n */\nconst Switch: React.ForwardRefExoticComponent<SwitchProps> = withMergedProps<SwitchProps, HTMLInputElement>(\n forwardRef((props, ref) => {\n const {\n size = 'm',\n knobProps = {},\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n palette,\n style,\n className,\n disabled,\n ...inputProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n return (\n <Styled.Root\n {...sizeProps}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n palette={palette}\n style={style}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='checkbox' ref={ref} />\n <Styled.Track>\n <Knob {...sizeProps} {...knobProps} />\n </Styled.Track>\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { Switch, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Switch","withMergedProps","forwardRef","props","ref","size","knobProps","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","palette","style","className","disabled","inputProps","sizeProps","_jsxs","Styled","children","_jsx","type","Knob","displayName","SIZES"],"mappings":"4OAOMA,MAAAA,eAAiB,SAYjBC,MAAAA,OAAuDC,gBAC3DC,YAAW,CAACC,EAAOC,KACjB,MAAMC,KACJA,EAAO,IAAGC,UACVA,EAAY,CAAE,EAAAC,QACdA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,UACLA,EAASC,OACTA,EAAMC,OACNA,EAAMC,QACNA,EAAOC,MACPA,EAAKC,UACLA,EAASC,SACTA,KACGC,GACDlB,EAEJ,MAAMmB,EAAY,CAChBjB,OACAE,UACAC,SACAC,QACAC,QACAC,QACAC,UAGF,OACEW,KAACC,KAAW,IACNF,EACJT,MAAOA,EACPC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,QAASA,EACTC,MAAOA,EACPC,UAAWA,EACXC,SAAUA,EAASK,SAEnBC,CAAAA,IAACF,MAAY,IAAKH,EAAYD,SAAUA,EAAUO,KAAK,WAAWvB,IAAKA,IACvEsB,IAACF,MAAY,CAAAC,SACXC,IAACE,KAAI,IAAKN,KAAehB,QAEf,IAGlB,CACEuB,YAhEmB,SAiEnBhB,MAAOiB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';const SIZE_SWITCH={width:44,height:24,borderRadius:48};const SIZE_KNOB={width:16,height:16,borderRadius:'50%'};const SIZES_KNOB={xl:SIZE_KNOB,l:SIZE_KNOB,m:SIZE_KNOB,s:SIZE_KNOB,xs:SIZE_KNOB};exports.SIZES={xl:SIZE_SWITCH,l:SIZE_SWITCH,m:SIZE_SWITCH,s:SIZE_SWITCH,xs:SIZE_SWITCH},exports.SIZES_KNOB=SIZES_KNOB;
|
|
2
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/components/Switch/constants.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport type { SwitchSize } from './types'\n\nconst SIZE_SWITCH: CSSProperties = {\n width: 44,\n height: 24,\n borderRadius: 48,\n}\n\nconst SIZE_KNOB: CSSProperties = {\n width: 16,\n height: 16,\n borderRadius: '50%',\n}\n\nexport const SIZES: Record<SwitchSize, CSSProperties> = {\n xl: SIZE_SWITCH,\n l: SIZE_SWITCH,\n m: SIZE_SWITCH,\n s: SIZE_SWITCH,\n xs: SIZE_SWITCH,\n}\n\nexport const SIZES_KNOB: Record<SwitchSize, CSSProperties> = {\n xl: SIZE_KNOB,\n l: SIZE_KNOB,\n m: SIZE_KNOB,\n s: SIZE_KNOB,\n xs: SIZE_KNOB,\n}\n"],"names":["SIZE_SWITCH","width","height","borderRadius","SIZE_KNOB","SIZES_KNOB","xl","l","m","s","xs"],"mappings":"aAGA,MAAMA,YAA6B,CACjCC,MAAO,GACPC,OAAQ,GACRC,aAAc,IAGhB,MAAMC,UAA2B,CAC/BH,MAAO,GACPC,OAAQ,GACRC,aAAc,OAWT,MAAME,WAAgD,CAC3DC,GAAIF,UACJG,EAAGH,UACHI,EAAGJ,UACHK,EAAGL,UACHM,GAAIN,yBAbkD,CACtDE,GAAIN,YACJO,EAAGP,YACHQ,EAAGR,YACHS,EAAGT,YACHU,GAAIV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const SIZE_SWITCH={width:44,height:24,borderRadius:48};const SIZE_KNOB={width:16,height:16,borderRadius:'50%'};const SIZES={xl:SIZE_SWITCH,l:SIZE_SWITCH,m:SIZE_SWITCH,s:SIZE_SWITCH,xs:SIZE_SWITCH};const SIZES_KNOB={xl:SIZE_KNOB,l:SIZE_KNOB,m:SIZE_KNOB,s:SIZE_KNOB,xs:SIZE_KNOB};export{SIZES,SIZES_KNOB};
|
|
2
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../../../../src/components/Switch/constants.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport type { SwitchSize } from './types'\n\nconst SIZE_SWITCH: CSSProperties = {\n width: 44,\n height: 24,\n borderRadius: 48,\n}\n\nconst SIZE_KNOB: CSSProperties = {\n width: 16,\n height: 16,\n borderRadius: '50%',\n}\n\nexport const SIZES: Record<SwitchSize, CSSProperties> = {\n xl: SIZE_SWITCH,\n l: SIZE_SWITCH,\n m: SIZE_SWITCH,\n s: SIZE_SWITCH,\n xs: SIZE_SWITCH,\n}\n\nexport const SIZES_KNOB: Record<SwitchSize, CSSProperties> = {\n xl: SIZE_KNOB,\n l: SIZE_KNOB,\n m: SIZE_KNOB,\n s: SIZE_KNOB,\n xs: SIZE_KNOB,\n}\n"],"names":["SIZE_SWITCH","width","height","borderRadius","SIZE_KNOB","SIZES","xl","l","m","s","xs","SIZES_KNOB"],"mappings":"AAGA,MAAMA,YAA6B,CACjCC,MAAO,GACPC,OAAQ,GACRC,aAAc,IAGhB,MAAMC,UAA2B,CAC/BH,MAAO,GACPC,OAAQ,GACRC,aAAc,OAGT,MAAME,MAA2C,CACtDC,GAAIN,YACJO,EAAGP,YACHQ,EAAGR,YACHS,EAAGT,YACHU,GAAIV,aAGC,MAAMW,WAAgD,CAC3DL,GAAIF,UACJG,EAAGH,UACHI,EAAGJ,UACHK,EAAGL,UACHM,GAAIN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var styled=require('styled-components');var tinycolor=require('../../external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.js');var style=require('../../shared/utils/style.js');var responsiveSize=require('../../mixins/responsive-size.js');function _interopDefault(o){return o&&o.__esModule?o:{default:o}}var styled__default=_interopDefault(styled);const shouldForwardSwitchProp=style.createShouldForwardProp((o=>!['inline','disabled'].includes(o)));const shouldForwardKnobProp=style.createShouldForwardProp();const Input=styled__default.default.input.withConfig({shouldForwardProp:o=>!['error','success','onColored'].includes(o)}).withConfig({displayName:"Switch__Input",componentId:"ui__sc-9l6yad-0"})(["box-sizing:border-box;position:absolute;top:0;left:0;margin:0;border:none;opacity:0;width:100%;height:100%;z-index:1;cursor:inherit;&:focus{outline:none;}"]);const Track=styled__default.default.span.withConfig({displayName:"Switch__Track",componentId:"ui__sc-9l6yad-1"})(["box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:100%;padding:0 1px;border-radius:inherit;transition:background-color 250ms linear;"]);const Knob=styled__default.default.span.withConfig({shouldForwardProp:shouldForwardKnobProp}).withConfig({displayName:"Switch__Knob",componentId:"ui__sc-9l6yad-2"})(["box-sizing:border-box;display:flex;justify-content:center;align-items:center;width:50%;height:100%;transition:transform 250ms cubic-bezier(0.45,0,0.2,1);&::after{content:'';flex-shrink:0;","}"],responsiveSize.responsiveSize);const Root=styled__default.default.span.withConfig({shouldForwardProp:shouldForwardSwitchProp}).withConfig({displayName:"Switch__Root",componentId:"ui__sc-9l6yad-3"})([""," "," ",""],(o=>`\n box-sizing: border-box;\n isolation: isolate;\n position: relative;\n flex-shrink: 0;\n display: ${o.inline?'inline-flex':'flex'};\n cursor: ${o.disabled?'not-allowed':'pointer'};\n\n & > ${Input}:checked + ${Track} > ${Knob} {\n transform: translateX(100%);\n }\n\n & > ${Input}:focus-visible + ${Track} {\n box-shadow: 0 0 0 2px ${o.theme.colors.white}, 0 0 0 4px ${o.theme.colors['border-focus']};\n outline: 2px solid transparent;\n outline-offset: 2px;\n }\n `),(o=>{return e={knobColor:o.theme.colors['bg-oncolor-primary'],knobShadowColor:o.theme.colors['bg-oncolor-hover'],trackColor:o.theme.colors['bg-onmain-tertiary'],trackColorHover:tinycolor.default(o.theme.colors['bg-onmain-tertiary']).darken(6).toString(),trackColorChecked:o.theme.colors['bg-brand-primary-basic'],trackColorCheckedHover:tinycolor.default(o.theme.colors['bg-brand-primary-basic']).lighten(4).toString(),trackColorDisabled:o.theme.colors['bg-disabled-small'],trackColorDisabledChecked:o.theme.colors['bg-disabled-active'],...o.palette},`\n & > ${Track} > ${Knob}::after {\n background-color: ${e.knobColor};\n box-shadow: 0px 2px 4px ${e.knobShadowColor};\n }\n & > ${Track} {\n background-color: ${e.trackColor};\n }\n & > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${e.trackColorChecked};\n }\n & > ${Input}:disabled + ${Track} {\n background-color: ${e.trackColorDisabled};\n }\n & > ${Input}:disabled:checked + ${Track} {\n background-color: ${e.trackColorDisabledChecked};\n }\n &:hover > ${Input}:not(:disabled) + ${Track} {\n background-color: ${e.trackColorHover};\n }\n &:hover > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${e.trackColorCheckedHover};\n }\n`;var e}),responsiveSize.responsiveSize);exports.Input=Input,exports.Knob=Knob,exports.Root=Root,exports.Track=Track;
|
|
2
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sources":["../../../../src/components/Switch/style.ts"],"sourcesContent":["import styled from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport type { CSSColor } from 'shared/types'\nimport type { StyledSwitchProps, StyledKnobProps, SwitchPalette } from './types'\n\nconst shouldForwardSwitchProp = createShouldForwardProp((propKey) => !['inline', 'disabled'].includes(propKey))\n\nconst shouldForwardKnobProp = createShouldForwardProp()\n\nexport const Input = styled.input.withConfig({\n shouldForwardProp: (propKey) => !['error', 'success', 'onColored'].includes(propKey),\n})`\n box-sizing: border-box;\n position: absolute;\n top: 0;\n left: 0;\n margin: 0;\n border: none;\n opacity: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n cursor: inherit;\n &:focus {\n outline: none;\n }\n`\n\nexport const Track = styled.span`\n box-sizing: border-box;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0 1px;\n border-radius: inherit;\n transition: background-color 250ms linear;\n`\n\nexport const Knob = styled.span.withConfig<StyledKnobProps>({\n shouldForwardProp: shouldForwardKnobProp,\n})`\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 50%;\n height: 100%;\n transition: transform 250ms cubic-bezier(0.45, 0, 0.2, 1);\n &::after {\n content: '';\n flex-shrink: 0;\n ${responsiveSize}\n }\n`\n\nconst template = (palette: SwitchPalette) => `\n & > ${Track} > ${Knob}::after {\n background-color: ${palette.knobColor};\n box-shadow: 0px 2px 4px ${palette.knobShadowColor};\n }\n & > ${Track} {\n background-color: ${palette.trackColor};\n }\n & > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${palette.trackColorChecked};\n }\n & > ${Input}:disabled + ${Track} {\n background-color: ${palette.trackColorDisabled};\n }\n & > ${Input}:disabled:checked + ${Track} {\n background-color: ${palette.trackColorDisabledChecked};\n }\n &:hover > ${Input}:not(:disabled) + ${Track} {\n background-color: ${palette.trackColorHover};\n }\n &:hover > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${palette.trackColorCheckedHover};\n }\n`\n\nexport const Root = styled.span.withConfig<StyledSwitchProps>({\n shouldForwardProp: shouldForwardSwitchProp,\n})`\n ${(props) => `\n box-sizing: border-box;\n isolation: isolate;\n position: relative;\n flex-shrink: 0;\n display: ${props.inline ? 'inline-flex' : 'flex'};\n cursor: ${props.disabled ? 'not-allowed' : 'pointer'};\n\n & > ${Input}:checked + ${Track} > ${Knob} {\n transform: translateX(100%);\n }\n\n & > ${Input}:focus-visible + ${Track} {\n box-shadow: 0 0 0 2px ${props.theme.colors.white}, 0 0 0 4px ${props.theme.colors['border-focus']};\n outline: 2px solid transparent;\n outline-offset: 2px;\n }\n `}\n\n ${(props) =>\n template({\n knobColor: props.theme.colors['bg-oncolor-primary'],\n knobShadowColor: props.theme.colors['bg-oncolor-hover'],\n trackColor: props.theme.colors['bg-onmain-tertiary'],\n trackColorHover: tinycolor(props.theme.colors['bg-onmain-tertiary']).darken(6).toString() as CSSColor,\n trackColorChecked: props.theme.colors['bg-brand-primary-basic'],\n trackColorCheckedHover: tinycolor(props.theme.colors['bg-brand-primary-basic']).lighten(4).toString() as CSSColor,\n trackColorDisabled: props.theme.colors['bg-disabled-small'],\n trackColorDisabledChecked: props.theme.colors['bg-disabled-active'],\n ...props.palette,\n })}\n\n ${responsiveSize}\n`\n"],"names":["shouldForwardSwitchProp","createShouldForwardProp","propKey","includes","shouldForwardKnobProp","Input","styled","input","withConfig","shouldForwardProp","displayName","componentId","Track","span","Knob","responsiveSize","Root","props","inline","disabled","theme","colors","white","template","palette","knobColor","knobShadowColor","trackColor","trackColorHover","tinycolor","default","darken","toString","trackColorChecked","trackColorCheckedHover","lighten","trackColorDisabled","trackColorDisabledChecked"],"mappings":"qXAOA,MAAMA,wBAA0BC,MAAAA,yBAAyBC,IAAa,CAAC,SAAU,YAAYC,SAASD,KAEtG,MAAME,sBAAwBH,MAAuBA,0BAE9C,MAAMI,MAAQC,gBAAAA,QAAOC,MAAMC,WAAW,CAC3CC,kBAAoBP,IAAa,CAAC,QAAS,UAAW,aAAaC,SAASD,KAC5EM,WAAA,CAAAE,YAAA,gBAAAC,YAAA,mBAFmBL,CAiBpB,CAAA,qKAEYM,MAAQN,gBAAAA,QAAOO,KAAIL,WAAA,CAAAE,YAAA,gBAAAC,YAAA,mBAAXL,CAUpB,CAAA,8JAEM,MAAMQ,KAAOR,gBAAAA,QAAOO,KAAKL,WAA4B,CAC1DC,kBAAmBL,wBACnBI,WAAA,CAAAE,YAAA,eAAAC,YAAA,mBAFkBL,CAElB,CAAA,8LAAA,KAWIS,eAAAA,gBA6BC,MAAMC,KAAOV,gBAAAA,QAAOO,KAAKL,WAA8B,CAC5DC,kBAAmBT,0BACnBQ,WAAA,CAAAE,YAAA,eAAAC,YAAA,mBAFkBL,CAElB,CAAA,GAAA,IAAA,IAAA,KACGW,GAAU,gIAKEA,EAAMC,OAAS,cAAgB,0BAChCD,EAAME,SAAW,cAAgB,2BAErCd,mBAAmBO,WAAWE,sEAI9BT,yBAAyBO,0CACLK,EAAMG,MAAMC,OAAOC,oBAAoBL,EAAMG,MAAMC,OAAO,yGAMrFJ,IACDM,OAhDcC,EAgDL,CACPC,UAAWR,EAAMG,MAAMC,OAAO,sBAC9BK,gBAAiBT,EAAMG,MAAMC,OAAO,oBACpCM,WAAYV,EAAMG,MAAMC,OAAO,sBAC/BO,gBAAiBC,UAASC,QAACb,EAAMG,MAAMC,OAAO,uBAAuBU,OAAO,GAAGC,WAC/EC,kBAAmBhB,EAAMG,MAAMC,OAAO,0BACtCa,uBAAwBL,UAASC,QAACb,EAAMG,MAAMC,OAAO,2BAA2Bc,QAAQ,GAAGH,WAC3FI,mBAAoBnB,EAAMG,MAAMC,OAAO,qBACvCgB,0BAA2BpB,EAAMG,MAAMC,OAAO,yBAC3CJ,EAAMO,SAzD8B,WACrCZ,WAAWE,wCACKU,EAAQC,2CACFD,EAAQE,gCAE9Bd,kCACgBY,EAAQG,2BAExBtB,kCAAkCO,kCAClBY,EAAQS,kCAExB5B,oBAAoBO,kCACJY,EAAQY,mCAExB/B,4BAA4BO,kCACZY,EAAQa,gDAElBhC,0BAA0BO,kCAChBY,EAAQI,sCAElBvB,kCAAkCO,kCACxBY,EAAQU,iCArBdV,KA0DZ,GAEFT,eAAcA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import styled from'styled-components';import tinycolor from'../../external/.pnpm/tinycolor2@1.4.2/node_modules/tinycolor2/tinycolor.mjs';import{createShouldForwardProp}from'../../shared/utils/style.mjs';import{responsiveSize}from'../../mixins/responsive-size.mjs';const shouldForwardSwitchProp=createShouldForwardProp((o=>!['inline','disabled'].includes(o)));const shouldForwardKnobProp=createShouldForwardProp();const Input=styled.input.withConfig({shouldForwardProp:o=>!['error','success','onColored'].includes(o)}).withConfig({displayName:"Switch__Input",componentId:"ui__sc-9l6yad-0"})(["box-sizing:border-box;position:absolute;top:0;left:0;margin:0;border:none;opacity:0;width:100%;height:100%;z-index:1;cursor:inherit;&:focus{outline:none;}"]);const Track=styled.span.withConfig({displayName:"Switch__Track",componentId:"ui__sc-9l6yad-1"})(["box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:100%;padding:0 1px;border-radius:inherit;transition:background-color 250ms linear;"]);const Knob=styled.span.withConfig({shouldForwardProp:shouldForwardKnobProp}).withConfig({displayName:"Switch__Knob",componentId:"ui__sc-9l6yad-2"})(["box-sizing:border-box;display:flex;justify-content:center;align-items:center;width:50%;height:100%;transition:transform 250ms cubic-bezier(0.45,0,0.2,1);&::after{content:'';flex-shrink:0;","}"],responsiveSize);const Root=styled.span.withConfig({shouldForwardProp:shouldForwardSwitchProp}).withConfig({displayName:"Switch__Root",componentId:"ui__sc-9l6yad-3"})([""," "," ",""],(o=>`\n box-sizing: border-box;\n isolation: isolate;\n position: relative;\n flex-shrink: 0;\n display: ${o.inline?'inline-flex':'flex'};\n cursor: ${o.disabled?'not-allowed':'pointer'};\n\n & > ${Input}:checked + ${Track} > ${Knob} {\n transform: translateX(100%);\n }\n\n & > ${Input}:focus-visible + ${Track} {\n box-shadow: 0 0 0 2px ${o.theme.colors.white}, 0 0 0 4px ${o.theme.colors['border-focus']};\n outline: 2px solid transparent;\n outline-offset: 2px;\n }\n `),(o=>{return r={knobColor:o.theme.colors['bg-oncolor-primary'],knobShadowColor:o.theme.colors['bg-oncolor-hover'],trackColor:o.theme.colors['bg-onmain-tertiary'],trackColorHover:tinycolor(o.theme.colors['bg-onmain-tertiary']).darken(6).toString(),trackColorChecked:o.theme.colors['bg-brand-primary-basic'],trackColorCheckedHover:tinycolor(o.theme.colors['bg-brand-primary-basic']).lighten(4).toString(),trackColorDisabled:o.theme.colors['bg-disabled-small'],trackColorDisabledChecked:o.theme.colors['bg-disabled-active'],...o.palette},`\n & > ${Track} > ${Knob}::after {\n background-color: ${r.knobColor};\n box-shadow: 0px 2px 4px ${r.knobShadowColor};\n }\n & > ${Track} {\n background-color: ${r.trackColor};\n }\n & > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${r.trackColorChecked};\n }\n & > ${Input}:disabled + ${Track} {\n background-color: ${r.trackColorDisabled};\n }\n & > ${Input}:disabled:checked + ${Track} {\n background-color: ${r.trackColorDisabledChecked};\n }\n &:hover > ${Input}:not(:disabled) + ${Track} {\n background-color: ${r.trackColorHover};\n }\n &:hover > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${r.trackColorCheckedHover};\n }\n`;var r}),responsiveSize);export{Input,Knob,Root,Track};
|
|
2
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","sources":["../../../../src/components/Switch/style.ts"],"sourcesContent":["import styled from 'styled-components'\nimport tinycolor from 'tinycolor2'\nimport { createShouldForwardProp } from 'shared/utils/style'\nimport { responsiveSize } from 'mixins/responsive-size'\nimport type { CSSColor } from 'shared/types'\nimport type { StyledSwitchProps, StyledKnobProps, SwitchPalette } from './types'\n\nconst shouldForwardSwitchProp = createShouldForwardProp((propKey) => !['inline', 'disabled'].includes(propKey))\n\nconst shouldForwardKnobProp = createShouldForwardProp()\n\nexport const Input = styled.input.withConfig({\n shouldForwardProp: (propKey) => !['error', 'success', 'onColored'].includes(propKey),\n})`\n box-sizing: border-box;\n position: absolute;\n top: 0;\n left: 0;\n margin: 0;\n border: none;\n opacity: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n cursor: inherit;\n &:focus {\n outline: none;\n }\n`\n\nexport const Track = styled.span`\n box-sizing: border-box;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0 1px;\n border-radius: inherit;\n transition: background-color 250ms linear;\n`\n\nexport const Knob = styled.span.withConfig<StyledKnobProps>({\n shouldForwardProp: shouldForwardKnobProp,\n})`\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n width: 50%;\n height: 100%;\n transition: transform 250ms cubic-bezier(0.45, 0, 0.2, 1);\n &::after {\n content: '';\n flex-shrink: 0;\n ${responsiveSize}\n }\n`\n\nconst template = (palette: SwitchPalette) => `\n & > ${Track} > ${Knob}::after {\n background-color: ${palette.knobColor};\n box-shadow: 0px 2px 4px ${palette.knobShadowColor};\n }\n & > ${Track} {\n background-color: ${palette.trackColor};\n }\n & > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${palette.trackColorChecked};\n }\n & > ${Input}:disabled + ${Track} {\n background-color: ${palette.trackColorDisabled};\n }\n & > ${Input}:disabled:checked + ${Track} {\n background-color: ${palette.trackColorDisabledChecked};\n }\n &:hover > ${Input}:not(:disabled) + ${Track} {\n background-color: ${palette.trackColorHover};\n }\n &:hover > ${Input}:not(:disabled):checked + ${Track} {\n background-color: ${palette.trackColorCheckedHover};\n }\n`\n\nexport const Root = styled.span.withConfig<StyledSwitchProps>({\n shouldForwardProp: shouldForwardSwitchProp,\n})`\n ${(props) => `\n box-sizing: border-box;\n isolation: isolate;\n position: relative;\n flex-shrink: 0;\n display: ${props.inline ? 'inline-flex' : 'flex'};\n cursor: ${props.disabled ? 'not-allowed' : 'pointer'};\n\n & > ${Input}:checked + ${Track} > ${Knob} {\n transform: translateX(100%);\n }\n\n & > ${Input}:focus-visible + ${Track} {\n box-shadow: 0 0 0 2px ${props.theme.colors.white}, 0 0 0 4px ${props.theme.colors['border-focus']};\n outline: 2px solid transparent;\n outline-offset: 2px;\n }\n `}\n\n ${(props) =>\n template({\n knobColor: props.theme.colors['bg-oncolor-primary'],\n knobShadowColor: props.theme.colors['bg-oncolor-hover'],\n trackColor: props.theme.colors['bg-onmain-tertiary'],\n trackColorHover: tinycolor(props.theme.colors['bg-onmain-tertiary']).darken(6).toString() as CSSColor,\n trackColorChecked: props.theme.colors['bg-brand-primary-basic'],\n trackColorCheckedHover: tinycolor(props.theme.colors['bg-brand-primary-basic']).lighten(4).toString() as CSSColor,\n trackColorDisabled: props.theme.colors['bg-disabled-small'],\n trackColorDisabledChecked: props.theme.colors['bg-disabled-active'],\n ...props.palette,\n })}\n\n ${responsiveSize}\n`\n"],"names":["shouldForwardSwitchProp","createShouldForwardProp","propKey","includes","shouldForwardKnobProp","Input","styled","input","withConfig","shouldForwardProp","displayName","componentId","Track","span","Knob","responsiveSize","Root","props","inline","disabled","theme","colors","white","template","palette","knobColor","knobShadowColor","trackColor","trackColorHover","tinycolor","darken","toString","trackColorChecked","trackColorCheckedHover","lighten","trackColorDisabled","trackColorDisabledChecked"],"mappings":"wQAOA,MAAMA,wBAA0BC,yBAAyBC,IAAa,CAAC,SAAU,YAAYC,SAASD,KAEtG,MAAME,sBAAwBH,0BAEvB,MAAMI,MAAQC,OAAOC,MAAMC,WAAW,CAC3CC,kBAAoBP,IAAa,CAAC,QAAS,UAAW,aAAaC,SAASD,KAC5EM,WAAA,CAAAE,YAAA,gBAAAC,YAAA,mBAFmBL,CAiBpB,CAAA,qKAEYM,MAAQN,OAAOO,KAAIL,WAAA,CAAAE,YAAA,gBAAAC,YAAA,mBAAXL,CAUpB,CAAA,8JAEM,MAAMQ,KAAOR,OAAOO,KAAKL,WAA4B,CAC1DC,kBAAmBL,wBACnBI,WAAA,CAAAE,YAAA,eAAAC,YAAA,mBAFkBL,CAElB,CAAA,8LAAA,KAWIS,gBA6BC,MAAMC,KAAOV,OAAOO,KAAKL,WAA8B,CAC5DC,kBAAmBT,0BACnBQ,WAAA,CAAAE,YAAA,eAAAC,YAAA,mBAFkBL,CAElB,CAAA,GAAA,IAAA,IAAA,KACGW,GAAU,gIAKEA,EAAMC,OAAS,cAAgB,0BAChCD,EAAME,SAAW,cAAgB,2BAErCd,mBAAmBO,WAAWE,sEAI9BT,yBAAyBO,0CACLK,EAAMG,MAAMC,OAAOC,oBAAoBL,EAAMG,MAAMC,OAAO,yGAMrFJ,IACDM,OAhDcC,EAgDL,CACPC,UAAWR,EAAMG,MAAMC,OAAO,sBAC9BK,gBAAiBT,EAAMG,MAAMC,OAAO,oBACpCM,WAAYV,EAAMG,MAAMC,OAAO,sBAC/BO,gBAAiBC,UAAUZ,EAAMG,MAAMC,OAAO,uBAAuBS,OAAO,GAAGC,WAC/EC,kBAAmBf,EAAMG,MAAMC,OAAO,0BACtCY,uBAAwBJ,UAAUZ,EAAMG,MAAMC,OAAO,2BAA2Ba,QAAQ,GAAGH,WAC3FI,mBAAoBlB,EAAMG,MAAMC,OAAO,qBACvCe,0BAA2BnB,EAAMG,MAAMC,OAAO,yBAC3CJ,EAAMO,SAzD8B,WACrCZ,WAAWE,wCACKU,EAAQC,2CACFD,EAAQE,gCAE9Bd,kCACgBY,EAAQG,2BAExBtB,kCAAkCO,kCAClBY,EAAQQ,kCAExB3B,oBAAoBO,kCACJY,EAAQW,mCAExB9B,4BAA4BO,kCACZY,EAAQY,gDAElB/B,0BAA0BO,kCAChBY,EAAQI,sCAElBvB,kCAAkCO,kCACxBY,EAAQS,iCArBdT,KA0DZ,GAEFT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var React=require('react');var styled=require('styled-components');var Floater=require('react-floater');var ramda=require('ramda');var withMergedProps=require('../../hocs/withMergedProps.js');var TooltipWrapper=require('./TooltipWrapper.js');var defaultConstants=require('./default-constants.js');var require$$0=require('react/jsx-runtime');var TooltipComponent=require('../TooltipComponent/TooltipComponent.js');var constants=require('../TooltipComponent/constants.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Floater__default=_interopDefault(Floater);const Tooltip=Object.assign(withMergedProps.withMergedProps(React.forwardRef(((e,o)=>{const{preset:t,size:r="s",sizeXXS:s,sizeXS:i,sizeS:n,sizeM:
|
|
1
|
+
'use strict';var React=require('react');var styled=require('styled-components');var Floater=require('react-floater');var ramda=require('ramda');var withMergedProps=require('../../hocs/withMergedProps.js');var TooltipWrapper=require('./TooltipWrapper.js');var defaultConstants=require('./default-constants.js');var require$$0=require('react/jsx-runtime');var TooltipComponent=require('../TooltipComponent/TooltipComponent.js');var constants=require('../TooltipComponent/constants.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Floater__default=_interopDefault(Floater);const Tooltip=Object.assign(withMergedProps.withMergedProps(React.forwardRef(((e,o)=>{const{preset:t,size:r="s",sizeXXS:s,sizeXS:i,sizeS:n,sizeM:l,sizeL:a,sizeXL:p,sizeUnits:c,sizes:u,palette:d,black:f,contrast:m,titleProps:T,contentProps:z,closeButtonProps:C,closeOnClickOutside:b,closeOnScroll:g,...q}=e;const h=styled.useTheme();if(t!=='brand'){const e={...q,styles:ramda.mergeDeepLeft(q.styles??{},defaultConstants.TOOLTIP_STYLES_DEFAULT)};return require$$0.jsx(Floater__default.default,{...e,children:require$$0.jsx("span",{children:e.children})})}let v=h.colors['bg-onmain-primary'];f&&(v=h.colors['bg-onmain-inverse']),m&&(v=h.colors['bg-brand-primary-basic']),d?.backgroundColor&&(v=h.colors[d.backgroundColor]??d.backgroundColor);const _={...q,offset:q.offset??8,styles:ramda.mergeDeepLeft(q.styles??{},{arrow:{color:v,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${h.colors['bg-oncolor-hover']})`}}),component:require$$0.jsx(TooltipWrapper.TooltipWrapper,{ref:o,size:r,sizeXXS:s,sizeXS:i,sizeS:n,sizeM:l,sizeL:a,sizeXL:p,sizeUnits:c,sizes:u,palette:d,black:f,contrast:m,title:q.title,titleProps:T,content:q.content,contentProps:z,footer:q.footer,showCloseButton:q.showCloseButton,closeButtonProps:C,closeOnClickOutside:b,closeOnScroll:g,component:q.component})};return require$$0.jsx(Floater__default.default,{..._,modifiers:{flip:{enabled:!_.disableFlip}}})})),{displayName:"Tooltip",sizes:constants.SIZES}),{Component:TooltipComponent.TooltipComponent});exports.COMPONENT_NAME="Tooltip",exports.Tooltip=Tooltip;
|
|
2
2
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport { mergeDeepLeft } from 'ramda'\nimport type { Props as FloaterProps } from 'react-floater/lib/types'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { TooltipWrapper } from './TooltipWrapper'\nimport { TOOLTIP_STYLES_DEFAULT } from './default-constants'\nimport type { TooltipProps } from './types'\n\nconst COMPONENT_NAME = 'Tooltip'\n\n/**\n *\n * Component accepts [\"react-floater\"](https://www.npmjs.com/package/react-floater/v/0.8.2) v0.8.2 props.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to tooltip component root.\n *\n * See full [TooltipProps](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts)\n */\nconst Tooltip: React.ForwardRefExoticComponent<TooltipProps> & { Component: typeof TooltipComponent } = Object.assign(\n withMergedProps<TooltipProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const {\n preset,\n size = 's',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n palette,\n black,\n contrast,\n titleProps,\n contentProps,\n closeButtonProps,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n styles: mergeDeepLeft(restProps.styles ?? {}, TOOLTIP_STYLES_DEFAULT),\n } as FloaterProps\n\n return (\n <Floater {...tooltipProps}>\n <span>{tooltipProps.children}</span>\n </Floater>\n )\n }\n\n let color = theme.colors['bg-onmain-primary']\n\n if (black) color = theme.colors['bg-onmain-inverse']\n if (contrast) color = theme.colors['bg-brand-primary-basic']\n if (palette?.backgroundColor) color = theme.colors[palette.backgroundColor] ?? palette.backgroundColor\n\n const tooltipProps = {\n ...restProps,\n offset: restProps.offset ?? 8,\n styles: mergeDeepLeft(restProps.styles ?? {}, {\n arrow: {\n color,\n spread: 16,\n length: 8,\n },\n floater: {\n filter: `drop-shadow(0 6px 10px ${theme.colors['bg-oncolor-hover']})`,\n },\n }),\n component: (\n <TooltipWrapper\n ref={ref}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizeUnits={sizeUnits}\n sizes={sizes}\n palette={palette}\n black={black}\n contrast={contrast}\n title={restProps.title}\n titleProps={titleProps}\n content={restProps.content}\n contentProps={contentProps}\n footer={restProps.footer}\n showCloseButton={restProps.showCloseButton}\n closeButtonProps={closeButtonProps}\n component={restProps.component}\n />\n ),\n } as FloaterProps\n\n return (\n <Floater\n {...tooltipProps}\n modifiers={{\n flip: {\n enabled: !tooltipProps.disableFlip,\n },\n }}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n ),\n {\n Component: TooltipComponent,\n }\n)\n\nexport { Tooltip }\n\nexport { COMPONENT_NAME }\n"],"names":["Tooltip","Object","assign","withMergedProps","forwardRef","props","ref","preset","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","restProps","theme","useTheme","tooltipProps","styles","mergeDeepLeft","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","jsx","color","colors","backgroundColor","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"mlBAuBA,MAAMA,QAAkGC,OAAOC,OAC7GC,gBAAAA,gBACEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,QACVA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,iBACZA,KACGC,
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport { mergeDeepLeft } from 'ramda'\nimport type { Props as FloaterProps } from 'react-floater/lib/types'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { TooltipWrapper } from './TooltipWrapper'\nimport { TOOLTIP_STYLES_DEFAULT } from './default-constants'\nimport type { TooltipProps } from './types'\n\nconst COMPONENT_NAME = 'Tooltip'\n\n/**\n *\n * Component accepts [\"react-floater\"](https://www.npmjs.com/package/react-floater/v/0.8.2) v0.8.2 props.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to tooltip component root.\n *\n * See full [TooltipProps](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts)\n */\nconst Tooltip: React.ForwardRefExoticComponent<TooltipProps> & { Component: typeof TooltipComponent } = Object.assign(\n withMergedProps<TooltipProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const {\n preset,\n size = 's',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n palette,\n black,\n contrast,\n titleProps,\n contentProps,\n closeButtonProps,\n closeOnClickOutside,\n closeOnScroll,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n styles: mergeDeepLeft(restProps.styles ?? {}, TOOLTIP_STYLES_DEFAULT),\n } as FloaterProps\n\n return (\n <Floater {...tooltipProps}>\n <span>{tooltipProps.children}</span>\n </Floater>\n )\n }\n\n let color = theme.colors['bg-onmain-primary']\n\n if (black) color = theme.colors['bg-onmain-inverse']\n if (contrast) color = theme.colors['bg-brand-primary-basic']\n if (palette?.backgroundColor) color = theme.colors[palette.backgroundColor] ?? palette.backgroundColor\n\n const tooltipProps = {\n ...restProps,\n offset: restProps.offset ?? 8,\n styles: mergeDeepLeft(restProps.styles ?? {}, {\n arrow: {\n color,\n spread: 16,\n length: 8,\n },\n floater: {\n filter: `drop-shadow(0 6px 10px ${theme.colors['bg-oncolor-hover']})`,\n },\n }),\n component: (\n <TooltipWrapper\n ref={ref}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizeUnits={sizeUnits}\n sizes={sizes}\n palette={palette}\n black={black}\n contrast={contrast}\n title={restProps.title}\n titleProps={titleProps}\n content={restProps.content}\n contentProps={contentProps}\n footer={restProps.footer}\n showCloseButton={restProps.showCloseButton}\n closeButtonProps={closeButtonProps}\n closeOnClickOutside={closeOnClickOutside}\n closeOnScroll={closeOnScroll}\n component={restProps.component}\n />\n ),\n } as FloaterProps\n\n return (\n <Floater\n {...tooltipProps}\n modifiers={{\n flip: {\n enabled: !tooltipProps.disableFlip,\n },\n }}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n ),\n {\n Component: TooltipComponent,\n }\n)\n\nexport { Tooltip }\n\nexport { COMPONENT_NAME }\n"],"names":["Tooltip","Object","assign","withMergedProps","forwardRef","props","ref","preset","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","closeOnClickOutside","closeOnScroll","restProps","theme","useTheme","tooltipProps","styles","mergeDeepLeft","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","jsx","color","colors","backgroundColor","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"mlBAuBA,MAAMA,QAAkGC,OAAOC,OAC7GC,gBAAAA,gBACEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,QACVA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,iBACZA,EAAgBC,oBAChBA,EAAmBC,cACnBA,KACGC,GACDpB,EAEJ,MAAMqB,EAAQC,OAAAA,WAEd,GAAIpB,IAAW,QAAS,CACtB,MAAMqB,EAAe,IAChBH,EACHI,OAAQC,MAAAA,cAAcL,EAAUI,QAAU,CAAA,EAAIE,iBAAAA,yBAGhD,OACEC,WAAAA,IAACC,iBAAAA,QAAO,IAAKL,EAAYM,SACvBF,WAAAG,IAAA,OAAA,CAAAD,SAAON,EAAaM,YAG1B,CAEA,IAAIE,EAAQV,EAAMW,OAAO,qBAErBnB,IAAOkB,EAAQV,EAAMW,OAAO,sBAC5BlB,IAAUiB,EAAQV,EAAMW,OAAO,2BAC/BpB,GAASqB,kBAAiBF,EAAQV,EAAMW,OAAOpB,EAAQqB,kBAAoBrB,EAAQqB,iBAEvF,MAAMV,EAAe,IAChBH,EACHc,OAAQd,EAAUc,QAAU,EAC5BV,OAAQC,MAAaA,cAACL,EAAUI,QAAU,CAAA,EAAI,CAC5CW,MAAO,CACLJ,QACAK,OAAQ,GACRC,OAAQ,GAEVC,QAAS,CACPC,OAAQ,0BAA0BlB,EAAMW,OAAO,0BAGnDQ,UACEb,WAAAG,IAACW,8BAAc,CACbxC,IAAKA,EACLE,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,UAAWA,EACXC,MAAOA,EACPC,QAASA,EACTC,MAAOA,EACPC,SAAUA,EACV4B,MAAOtB,EAAUsB,MACjB3B,WAAYA,EACZ4B,QAASvB,EAAUuB,QACnB3B,aAAcA,EACd4B,OAAQxB,EAAUwB,OAClBC,gBAAiBzB,EAAUyB,gBAC3B5B,iBAAkBA,EAClBC,oBAAqBA,EACrBC,cAAeA,EACfqB,UAAWpB,EAAUoB,aAK3B,OACEb,WAAAA,IAACC,iBAAAA,QAAO,IACFL,EACJuB,UAAW,CACTC,KAAM,CACJC,SAAUzB,EAAa0B,eAG3B,IAGN,CACEC,YAhHiB,UAiHjBvC,MAAOwC,UAAAA,QAGX,CACEC,UAAWC,iBAAAA,0CArHQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{forwardRef}from'react';import{useTheme}from'styled-components';import Floater from'react-floater';import{mergeDeepLeft}from'ramda';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{TooltipWrapper}from'./TooltipWrapper.mjs';import{TOOLTIP_STYLES_DEFAULT}from'./default-constants.mjs';import{jsx}from'react/jsx-runtime';import{TooltipComponent}from'../TooltipComponent/TooltipComponent.mjs';import{SIZES}from'../TooltipComponent/constants.mjs';const COMPONENT_NAME='Tooltip';const Tooltip=Object.assign(withMergedProps(forwardRef(((o,e)=>{const{preset:t,size:
|
|
1
|
+
import{forwardRef}from'react';import{useTheme}from'styled-components';import Floater from'react-floater';import{mergeDeepLeft}from'ramda';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{TooltipWrapper}from'./TooltipWrapper.mjs';import{TOOLTIP_STYLES_DEFAULT}from'./default-constants.mjs';import{jsx}from'react/jsx-runtime';import{TooltipComponent}from'../TooltipComponent/TooltipComponent.mjs';import{SIZES}from'../TooltipComponent/constants.mjs';const COMPONENT_NAME='Tooltip';const Tooltip=Object.assign(withMergedProps(forwardRef(((o,e)=>{const{preset:t,size:s="s",sizeXXS:r,sizeXS:i,sizeS:n,sizeM:l,sizeL:p,sizeXL:c,sizeUnits:m,sizes:a,palette:f,black:d,contrast:T,titleProps:z,contentProps:S,closeButtonProps:b,closeOnClickOutside:g,closeOnScroll:u,...C}=o;const O=useTheme();if(t!=='brand'){const o={...C,styles:mergeDeepLeft(C.styles??{},TOOLTIP_STYLES_DEFAULT)};return jsx(Floater,{...o,children:jsx("span",{children:o.children})})}let h=O.colors['bg-onmain-primary'];d&&(h=O.colors['bg-onmain-inverse']),T&&(h=O.colors['bg-brand-primary-basic']),f?.backgroundColor&&(h=O.colors[f.backgroundColor]??f.backgroundColor);const L={...C,offset:C.offset??8,styles:mergeDeepLeft(C.styles??{},{arrow:{color:h,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${O.colors['bg-oncolor-hover']})`}}),component:jsx(TooltipWrapper,{ref:e,size:s,sizeXXS:r,sizeXS:i,sizeS:n,sizeM:l,sizeL:p,sizeXL:c,sizeUnits:m,sizes:a,palette:f,black:d,contrast:T,title:C.title,titleProps:z,content:C.content,contentProps:S,footer:C.footer,showCloseButton:C.showCloseButton,closeButtonProps:b,closeOnClickOutside:g,closeOnScroll:u,component:C.component})};return jsx(Floater,{...L,modifiers:{flip:{enabled:!L.disableFlip}}})})),{displayName:"Tooltip",sizes:SIZES}),{Component:TooltipComponent});export{COMPONENT_NAME,Tooltip};
|
|
2
2
|
//# sourceMappingURL=Tooltip.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.mjs","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport { mergeDeepLeft } from 'ramda'\nimport type { Props as FloaterProps } from 'react-floater/lib/types'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { TooltipWrapper } from './TooltipWrapper'\nimport { TOOLTIP_STYLES_DEFAULT } from './default-constants'\nimport type { TooltipProps } from './types'\n\nconst COMPONENT_NAME = 'Tooltip'\n\n/**\n *\n * Component accepts [\"react-floater\"](https://www.npmjs.com/package/react-floater/v/0.8.2) v0.8.2 props.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to tooltip component root.\n *\n * See full [TooltipProps](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts)\n */\nconst Tooltip: React.ForwardRefExoticComponent<TooltipProps> & { Component: typeof TooltipComponent } = Object.assign(\n withMergedProps<TooltipProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const {\n preset,\n size = 's',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n palette,\n black,\n contrast,\n titleProps,\n contentProps,\n closeButtonProps,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n styles: mergeDeepLeft(restProps.styles ?? {}, TOOLTIP_STYLES_DEFAULT),\n } as FloaterProps\n\n return (\n <Floater {...tooltipProps}>\n <span>{tooltipProps.children}</span>\n </Floater>\n )\n }\n\n let color = theme.colors['bg-onmain-primary']\n\n if (black) color = theme.colors['bg-onmain-inverse']\n if (contrast) color = theme.colors['bg-brand-primary-basic']\n if (palette?.backgroundColor) color = theme.colors[palette.backgroundColor] ?? palette.backgroundColor\n\n const tooltipProps = {\n ...restProps,\n offset: restProps.offset ?? 8,\n styles: mergeDeepLeft(restProps.styles ?? {}, {\n arrow: {\n color,\n spread: 16,\n length: 8,\n },\n floater: {\n filter: `drop-shadow(0 6px 10px ${theme.colors['bg-oncolor-hover']})`,\n },\n }),\n component: (\n <TooltipWrapper\n ref={ref}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizeUnits={sizeUnits}\n sizes={sizes}\n palette={palette}\n black={black}\n contrast={contrast}\n title={restProps.title}\n titleProps={titleProps}\n content={restProps.content}\n contentProps={contentProps}\n footer={restProps.footer}\n showCloseButton={restProps.showCloseButton}\n closeButtonProps={closeButtonProps}\n component={restProps.component}\n />\n ),\n } as FloaterProps\n\n return (\n <Floater\n {...tooltipProps}\n modifiers={{\n flip: {\n enabled: !tooltipProps.disableFlip,\n },\n }}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n ),\n {\n Component: TooltipComponent,\n }\n)\n\nexport { Tooltip }\n\nexport { COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Tooltip","Object","assign","withMergedProps","forwardRef","props","ref","preset","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","restProps","theme","useTheme","tooltipProps","styles","mergeDeepLeft","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","color","colors","backgroundColor","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"kdAWMA,MAAAA,eAAiB,UAYvB,MAAMC,QAAkGC,OAAOC,OAC7GC,gBACEC,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,QACVA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,iBACZA,KACGC,
|
|
1
|
+
{"version":3,"file":"Tooltip.mjs","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport { mergeDeepLeft } from 'ramda'\nimport type { Props as FloaterProps } from 'react-floater/lib/types'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { TooltipWrapper } from './TooltipWrapper'\nimport { TOOLTIP_STYLES_DEFAULT } from './default-constants'\nimport type { TooltipProps } from './types'\n\nconst COMPONENT_NAME = 'Tooltip'\n\n/**\n *\n * Component accepts [\"react-floater\"](https://www.npmjs.com/package/react-floater/v/0.8.2) v0.8.2 props.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to tooltip component root.\n *\n * See full [TooltipProps](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts)\n */\nconst Tooltip: React.ForwardRefExoticComponent<TooltipProps> & { Component: typeof TooltipComponent } = Object.assign(\n withMergedProps<TooltipProps, HTMLDivElement>(\n forwardRef((props, ref) => {\n const {\n preset,\n size = 's',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n palette,\n black,\n contrast,\n titleProps,\n contentProps,\n closeButtonProps,\n closeOnClickOutside,\n closeOnScroll,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n styles: mergeDeepLeft(restProps.styles ?? {}, TOOLTIP_STYLES_DEFAULT),\n } as FloaterProps\n\n return (\n <Floater {...tooltipProps}>\n <span>{tooltipProps.children}</span>\n </Floater>\n )\n }\n\n let color = theme.colors['bg-onmain-primary']\n\n if (black) color = theme.colors['bg-onmain-inverse']\n if (contrast) color = theme.colors['bg-brand-primary-basic']\n if (palette?.backgroundColor) color = theme.colors[palette.backgroundColor] ?? palette.backgroundColor\n\n const tooltipProps = {\n ...restProps,\n offset: restProps.offset ?? 8,\n styles: mergeDeepLeft(restProps.styles ?? {}, {\n arrow: {\n color,\n spread: 16,\n length: 8,\n },\n floater: {\n filter: `drop-shadow(0 6px 10px ${theme.colors['bg-oncolor-hover']})`,\n },\n }),\n component: (\n <TooltipWrapper\n ref={ref}\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizeUnits={sizeUnits}\n sizes={sizes}\n palette={palette}\n black={black}\n contrast={contrast}\n title={restProps.title}\n titleProps={titleProps}\n content={restProps.content}\n contentProps={contentProps}\n footer={restProps.footer}\n showCloseButton={restProps.showCloseButton}\n closeButtonProps={closeButtonProps}\n closeOnClickOutside={closeOnClickOutside}\n closeOnScroll={closeOnScroll}\n component={restProps.component}\n />\n ),\n } as FloaterProps\n\n return (\n <Floater\n {...tooltipProps}\n modifiers={{\n flip: {\n enabled: !tooltipProps.disableFlip,\n },\n }}\n />\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n ),\n {\n Component: TooltipComponent,\n }\n)\n\nexport { Tooltip }\n\nexport { COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Tooltip","Object","assign","withMergedProps","forwardRef","props","ref","preset","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","closeOnClickOutside","closeOnScroll","restProps","theme","useTheme","tooltipProps","styles","mergeDeepLeft","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","color","colors","backgroundColor","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"kdAWMA,MAAAA,eAAiB,UAYvB,MAAMC,QAAkGC,OAAOC,OAC7GC,gBACEC,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,QACVA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,MACPA,EAAKC,SACLA,EAAQC,WACRA,EAAUC,aACVA,EAAYC,iBACZA,EAAgBC,oBAChBA,EAAmBC,cACnBA,KACGC,GACDpB,EAEJ,MAAMqB,EAAQC,WAEd,GAAIpB,IAAW,QAAS,CACtB,MAAMqB,EAAe,IAChBH,EACHI,OAAQC,cAAcL,EAAUI,QAAU,CAAA,EAAIE,yBAGhD,OACEC,IAACC,QAAO,IAAKL,EAAYM,SACvBF,IAAA,OAAA,CAAAE,SAAON,EAAaM,YAG1B,CAEA,IAAIC,EAAQT,EAAMU,OAAO,qBAErBlB,IAAOiB,EAAQT,EAAMU,OAAO,sBAC5BjB,IAAUgB,EAAQT,EAAMU,OAAO,2BAC/BnB,GAASoB,kBAAiBF,EAAQT,EAAMU,OAAOnB,EAAQoB,kBAAoBpB,EAAQoB,iBAEvF,MAAMT,EAAe,IAChBH,EACHa,OAAQb,EAAUa,QAAU,EAC5BT,OAAQC,cAAcL,EAAUI,QAAU,CAAA,EAAI,CAC5CU,MAAO,CACLJ,QACAK,OAAQ,GACRC,OAAQ,GAEVC,QAAS,CACPC,OAAQ,0BAA0BjB,EAAMU,OAAO,0BAGnDQ,UACEZ,IAACa,eAAc,CACbvC,IAAKA,EACLE,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,UAAWA,EACXC,MAAOA,EACPC,QAASA,EACTC,MAAOA,EACPC,SAAUA,EACV2B,MAAOrB,EAAUqB,MACjB1B,WAAYA,EACZ2B,QAAStB,EAAUsB,QACnB1B,aAAcA,EACd2B,OAAQvB,EAAUuB,OAClBC,gBAAiBxB,EAAUwB,gBAC3B3B,iBAAkBA,EAClBC,oBAAqBA,EACrBC,cAAeA,EACfoB,UAAWnB,EAAUmB,aAK3B,OACEZ,IAACC,QAAO,IACFL,EACJsB,UAAW,CACTC,KAAM,CACJC,SAAUxB,EAAayB,eAG3B,IAGN,CACEC,YAhHiB,UAiHjBtC,MAAOuC,QAGX,CACEC,UAAWC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var React=require('react');var useKeyboardListener=require('../../hooks/useKeyboardListener.js');var constants=require('../../shared/constants.js');var require$$0=require('react/jsx-runtime');var TooltipComponent=require('../TooltipComponent/TooltipComponent.js');const closeFnNoop=()=>{};exports.TooltipWrapper=React.forwardRef(((e,o)=>{const{size:
|
|
1
|
+
'use strict';var React=require('react');var useKeyboardListener=require('../../hooks/useKeyboardListener.js');var useClickOutside=require('../../hooks/useClickOutside.js');var useScrollMonitor=require('../../hooks/useScrollMonitor.js');var constants=require('../../shared/constants.js');var require$$0=require('react/jsx-runtime');var TooltipComponent=require('../TooltipComponent/TooltipComponent.js');const closeFnNoop=()=>{};exports.TooltipWrapper=React.forwardRef(((e,o)=>{const{size:t,sizeXXS:r,sizeXS:s,sizeS:n,sizeM:c,sizeL:i,sizeXL:u,black:l,contrast:a,showCloseButton:p,closeButtonProps:d,closeOnClickOutside:f,closeOnScroll:z,id:S,role:k,closeFn:m=closeFnNoop,component:R,...C}=e;const y=React.useRef(null);const q=React.useRef(null);const b=React.useRef(null);React.useImperativeHandle(o,(()=>y.current),[]),React.useEffect((()=>{if(f&&y.current){const e=y.current.getAttribute('id');e&&(q.current=document.querySelector(`[data-id="${e}"]`))}}),[f]),useKeyboardListener.useKeyboardListener('keyup',constants.keyboardKeys.Esc.key,m),useClickOutside.useClickOutside(y,(e=>{!f||q.current&&q.current.contains(e.target)||(b.current&&clearTimeout(b.current),b.current=setTimeout((()=>{m(),b.current=null}),0))})),useScrollMonitor.useScrollMonitor({onScrollStart:()=>{z&&m()}});const j={size:t,sizeXXS:r,sizeXS:s,sizeS:n,sizeM:c,sizeL:i,sizeXL:u,black:l,contrast:a,showCloseButton:p,closeButtonProps:d,id:S,role:k,closeFn:m};if(React.isValidElement(R)){const e=typeof R.props=='object'&&R.props!==null?R.props:{};return React.cloneElement(R,{ref:y,...j,...e})}return typeof R=='function'?R(j):require$$0.jsx(TooltipComponent.TooltipComponent,{ref:y,...j,...C})}));
|
|
2
2
|
//# sourceMappingURL=TooltipWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipWrapper.js","sources":["../../../../src/components/Tooltip/TooltipWrapper.tsx"],"sourcesContent":["import { forwardRef, isValidElement, cloneElement } from 'react'\nimport { useKeyboardListener } from 'hooks/useKeyboardListener'\nimport { keyboardKeys } from 'shared/constants'\nimport { TooltipComponent } from 'components/TooltipComponent'\nimport type { TooltipWrapperProps } from './types'\n\nconst closeFnNoop = () => undefined\n\nconst TooltipWrapper = forwardRef<HTMLDivElement, TooltipWrapperProps>((props,
|
|
1
|
+
{"version":3,"file":"TooltipWrapper.js","sources":["../../../../src/components/Tooltip/TooltipWrapper.tsx"],"sourcesContent":["import { forwardRef, isValidElement, cloneElement, useRef, useImperativeHandle, useEffect } from 'react'\nimport { useKeyboardListener } from 'hooks/useKeyboardListener'\nimport { useClickOutside } from 'hooks/useClickOutside'\nimport { useScrollMonitor } from 'hooks/useScrollMonitor'\nimport { keyboardKeys } from 'shared/constants'\nimport { TooltipComponent } from 'components/TooltipComponent'\nimport type { TooltipWrapperProps } from './types'\n\nconst closeFnNoop = () => undefined\n\nconst TooltipWrapper = forwardRef<HTMLDivElement, TooltipWrapperProps>((props, forwardedRef) => {\n const {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n black,\n contrast,\n showCloseButton,\n closeButtonProps,\n closeOnClickOutside,\n closeOnScroll,\n id,\n role,\n closeFn = closeFnNoop,\n component,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n const tooltipChildRef = useRef<Element | null>(null)\n\n const closeFnTimerId = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useImperativeHandle(forwardedRef, () => ref.current as HTMLDivElement, [])\n\n useEffect(() => {\n if (closeOnClickOutside && ref.current) {\n const componentId = ref.current.getAttribute('id')\n\n if (componentId) {\n tooltipChildRef.current = document.querySelector(`[data-id=\"${componentId}\"]`)\n }\n }\n }, [closeOnClickOutside])\n\n useKeyboardListener('keyup', keyboardKeys.Esc.key, closeFn)\n\n useClickOutside(ref, (evt) => {\n if (closeOnClickOutside && (!tooltipChildRef.current || !tooltipChildRef.current.contains(evt.target as Node))) {\n if (closeFnTimerId.current) {\n clearTimeout(closeFnTimerId.current)\n }\n\n closeFnTimerId.current = setTimeout(() => {\n closeFn()\n closeFnTimerId.current = null\n }, 0)\n }\n })\n\n useScrollMonitor({\n onScrollStart: () => {\n if (closeOnScroll) closeFn()\n },\n })\n\n const injectionProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n black,\n contrast,\n showCloseButton,\n closeButtonProps,\n id,\n role,\n closeFn,\n }\n\n if (isValidElement(component)) {\n const elementProps = typeof component.props === 'object' && component.props !== null ? component.props : {}\n\n return cloneElement(component, { ref, ...injectionProps, ...elementProps })\n }\n\n if (typeof component === 'function') {\n return component(injectionProps)\n }\n\n return <TooltipComponent ref={ref} {...injectionProps} {...restProps} />\n})\n\nexport { TooltipWrapper }\n"],"names":["closeFnNoop","forwardRef","props","forwardedRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","black","contrast","showCloseButton","closeButtonProps","closeOnClickOutside","closeOnScroll","id","role","closeFn","component","restProps","ref","useRef","tooltipChildRef","closeFnTimerId","useImperativeHandle","current","useEffect","componentId","getAttribute","document","querySelector","useKeyboardListener","keyboardKeys","Esc","key","useClickOutside","evt","contains","target","clearTimeout","setTimeout","useScrollMonitor","onScrollStart","injectionProps","isValidElement","elementProps","cloneElement","_jsx","TooltipComponent"],"mappings":"mZAQA,MAAMA,YAAcA,KAAe,yBAEZC,MAAUA,YAAsC,CAACC,EAAOC,KAC7E,MAAMC,KACJA,EAAIC,QACJA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,SACLA,EAAQC,gBACRA,EAAeC,iBACfA,EAAgBC,oBAChBA,EAAmBC,cACnBA,EAAaC,GACbA,EAAEC,KACFA,EAAIC,QACJA,EAAUnB,YAAWoB,UACrBA,KACGC,GACDnB,EAEJ,MAAMoB,EAAMC,aAAuB,MACnC,MAAMC,EAAkBD,aAAuB,MAE/C,MAAME,EAAiBF,aAA6C,MAEpEG,MAAAA,oBAAoBvB,GAAc,IAAMmB,EAAIK,SAA2B,IAEvEC,MAAAA,WAAU,KACR,GAAIb,GAAuBO,EAAIK,QAAS,CACtC,MAAME,EAAcP,EAAIK,QAAQG,aAAa,MAEzCD,IACFL,EAAgBG,QAAUI,SAASC,cAAc,aAAaH,OAElE,IACC,CAACd,IAEJkB,oBAAmBA,oBAAC,QAASC,UAAYA,aAACC,IAAIC,IAAKjB,GAEnDkB,gBAAeA,gBAACf,GAAMgB,KAChBvB,GAAyBS,EAAgBG,SAAYH,EAAgBG,QAAQY,SAASD,EAAIE,UACxFf,EAAeE,SACjBc,aAAahB,EAAeE,SAG9BF,EAAeE,QAAUe,YAAW,KAClCvB,IACAM,EAAeE,QAAU,IAAI,GAC5B,GACL,IAGFgB,kCAAiB,CACfC,cAAeA,KACT5B,GAAeG,GAAS,IAIhC,MAAM0B,EAAiB,CACrBzC,OACAC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,QACAC,WACAC,kBACAC,mBACAG,KACAC,OACAC,WAGF,GAAI2B,MAAAA,eAAe1B,GAAY,CAC7B,MAAM2B,SAAsB3B,EAAUlB,OAAU,UAAYkB,EAAUlB,QAAU,KAAOkB,EAAUlB,MAAQ,CAAA,EAEzG,OAAO8C,MAAAA,aAAa5B,EAAW,CAAEE,SAAQuB,KAAmBE,GAC9D,CAEA,cAAW3B,GAAc,WAChBA,EAAUyB,GAGZI,WAAAA,IAACC,iBAAAA,iBAAgB,CAAC5B,IAAKA,KAASuB,KAAoBxB,GAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{forwardRef,isValidElement,cloneElement}from'react';import{useKeyboardListener}from'../../hooks/useKeyboardListener.mjs';import{keyboardKeys}from'../../shared/constants.mjs';import{jsx}from'react/jsx-runtime';import{TooltipComponent}from'../TooltipComponent/TooltipComponent.mjs';const closeFnNoop=()=>{};const TooltipWrapper=forwardRef(((o
|
|
1
|
+
import{forwardRef,useRef,useImperativeHandle,useEffect,isValidElement,cloneElement}from'react';import{useKeyboardListener}from'../../hooks/useKeyboardListener.mjs';import{useClickOutside}from'../../hooks/useClickOutside.mjs';import{useScrollMonitor}from'../../hooks/useScrollMonitor.mjs';import{keyboardKeys}from'../../shared/constants.mjs';import{jsx}from'react/jsx-runtime';import{TooltipComponent}from'../TooltipComponent/TooltipComponent.mjs';const closeFnNoop=()=>{};const TooltipWrapper=forwardRef(((e,o)=>{const{size:t,sizeXXS:s,sizeXS:r,sizeS:n,sizeM:i,sizeL:l,sizeXL:c,black:u,contrast:p,showCloseButton:m,closeButtonProps:a,closeOnClickOutside:f,closeOnScroll:d,id:z,role:k,closeFn:S=closeFnNoop,component:y,...C}=e;const b=useRef(null);const j=useRef(null);const T=useRef(null);useImperativeHandle(o,(()=>b.current),[]),useEffect((()=>{if(f&&b.current){const e=b.current.getAttribute('id');e&&(j.current=document.querySelector(`[data-id="${e}"]`))}}),[f]),useKeyboardListener('keyup',keyboardKeys.Esc.key,S),useClickOutside(b,(e=>{!f||j.current&&j.current.contains(e.target)||(T.current&&clearTimeout(T.current),T.current=setTimeout((()=>{S(),T.current=null}),0))})),useScrollMonitor({onScrollStart:()=>{d&&S()}});const X={size:t,sizeXXS:s,sizeXS:r,sizeS:n,sizeM:i,sizeL:l,sizeXL:c,black:u,contrast:p,showCloseButton:m,closeButtonProps:a,id:z,role:k,closeFn:S};if(isValidElement(y)){const e=typeof y.props=='object'&&y.props!==null?y.props:{};return cloneElement(y,{ref:b,...X,...e})}return typeof y=='function'?y(X):jsx(TooltipComponent,{ref:b,...X,...C})}));export{TooltipWrapper};
|
|
2
2
|
//# sourceMappingURL=TooltipWrapper.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipWrapper.mjs","sources":["../../../../src/components/Tooltip/TooltipWrapper.tsx"],"sourcesContent":["import { forwardRef, isValidElement, cloneElement } from 'react'\nimport { useKeyboardListener } from 'hooks/useKeyboardListener'\nimport { keyboardKeys } from 'shared/constants'\nimport { TooltipComponent } from 'components/TooltipComponent'\nimport type { TooltipWrapperProps } from './types'\n\nconst closeFnNoop = () => undefined\n\nconst TooltipWrapper = forwardRef<HTMLDivElement, TooltipWrapperProps>((props,
|
|
1
|
+
{"version":3,"file":"TooltipWrapper.mjs","sources":["../../../../src/components/Tooltip/TooltipWrapper.tsx"],"sourcesContent":["import { forwardRef, isValidElement, cloneElement, useRef, useImperativeHandle, useEffect } from 'react'\nimport { useKeyboardListener } from 'hooks/useKeyboardListener'\nimport { useClickOutside } from 'hooks/useClickOutside'\nimport { useScrollMonitor } from 'hooks/useScrollMonitor'\nimport { keyboardKeys } from 'shared/constants'\nimport { TooltipComponent } from 'components/TooltipComponent'\nimport type { TooltipWrapperProps } from './types'\n\nconst closeFnNoop = () => undefined\n\nconst TooltipWrapper = forwardRef<HTMLDivElement, TooltipWrapperProps>((props, forwardedRef) => {\n const {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n black,\n contrast,\n showCloseButton,\n closeButtonProps,\n closeOnClickOutside,\n closeOnScroll,\n id,\n role,\n closeFn = closeFnNoop,\n component,\n ...restProps\n } = props\n\n const ref = useRef<HTMLDivElement>(null)\n const tooltipChildRef = useRef<Element | null>(null)\n\n const closeFnTimerId = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useImperativeHandle(forwardedRef, () => ref.current as HTMLDivElement, [])\n\n useEffect(() => {\n if (closeOnClickOutside && ref.current) {\n const componentId = ref.current.getAttribute('id')\n\n if (componentId) {\n tooltipChildRef.current = document.querySelector(`[data-id=\"${componentId}\"]`)\n }\n }\n }, [closeOnClickOutside])\n\n useKeyboardListener('keyup', keyboardKeys.Esc.key, closeFn)\n\n useClickOutside(ref, (evt) => {\n if (closeOnClickOutside && (!tooltipChildRef.current || !tooltipChildRef.current.contains(evt.target as Node))) {\n if (closeFnTimerId.current) {\n clearTimeout(closeFnTimerId.current)\n }\n\n closeFnTimerId.current = setTimeout(() => {\n closeFn()\n closeFnTimerId.current = null\n }, 0)\n }\n })\n\n useScrollMonitor({\n onScrollStart: () => {\n if (closeOnScroll) closeFn()\n },\n })\n\n const injectionProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n black,\n contrast,\n showCloseButton,\n closeButtonProps,\n id,\n role,\n closeFn,\n }\n\n if (isValidElement(component)) {\n const elementProps = typeof component.props === 'object' && component.props !== null ? component.props : {}\n\n return cloneElement(component, { ref, ...injectionProps, ...elementProps })\n }\n\n if (typeof component === 'function') {\n return component(injectionProps)\n }\n\n return <TooltipComponent ref={ref} {...injectionProps} {...restProps} />\n})\n\nexport { TooltipWrapper }\n"],"names":["closeFnNoop","TooltipWrapper","forwardRef","props","forwardedRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","black","contrast","showCloseButton","closeButtonProps","closeOnClickOutside","closeOnScroll","id","role","closeFn","component","restProps","ref","useRef","tooltipChildRef","closeFnTimerId","useImperativeHandle","current","useEffect","componentId","getAttribute","document","querySelector","useKeyboardListener","keyboardKeys","Esc","key","useClickOutside","evt","contains","target","clearTimeout","setTimeout","useScrollMonitor","onScrollStart","injectionProps","isValidElement","elementProps","cloneElement","_jsx","TooltipComponent"],"mappings":"+bAQA,MAAMA,YAAcA,KAAe,EAE7BC,MAAAA,eAAiBC,YAAgD,CAACC,EAAOC,KAC7E,MAAMC,KACJA,EAAIC,QACJA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,MACNA,EAAKC,SACLA,EAAQC,gBACRA,EAAeC,iBACfA,EAAgBC,oBAChBA,EAAmBC,cACnBA,EAAaC,GACbA,EAAEC,KACFA,EAAIC,QACJA,EAAUpB,YAAWqB,UACrBA,KACGC,GACDnB,EAEJ,MAAMoB,EAAMC,OAAuB,MACnC,MAAMC,EAAkBD,OAAuB,MAE/C,MAAME,EAAiBF,OAA6C,MAEpEG,oBAAoBvB,GAAc,IAAMmB,EAAIK,SAA2B,IAEvEC,WAAU,KACR,GAAIb,GAAuBO,EAAIK,QAAS,CACtC,MAAME,EAAcP,EAAIK,QAAQG,aAAa,MAEzCD,IACFL,EAAgBG,QAAUI,SAASC,cAAc,aAAaH,OAElE,IACC,CAACd,IAEJkB,oBAAoB,QAASC,aAAaC,IAAIC,IAAKjB,GAEnDkB,gBAAgBf,GAAMgB,KAChBvB,GAAyBS,EAAgBG,SAAYH,EAAgBG,QAAQY,SAASD,EAAIE,UACxFf,EAAeE,SACjBc,aAAahB,EAAeE,SAG9BF,EAAeE,QAAUe,YAAW,KAClCvB,IACAM,EAAeE,QAAU,IAAI,GAC5B,GACL,IAGFgB,iBAAiB,CACfC,cAAeA,KACT5B,GAAeG,GAAS,IAIhC,MAAM0B,EAAiB,CACrBzC,OACAC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,QACAC,WACAC,kBACAC,mBACAG,KACAC,OACAC,WAGF,GAAI2B,eAAe1B,GAAY,CAC7B,MAAM2B,SAAsB3B,EAAUlB,OAAU,UAAYkB,EAAUlB,QAAU,KAAOkB,EAAUlB,MAAQ,CAAA,EAEzG,OAAO8C,aAAa5B,EAAW,CAAEE,SAAQuB,KAAmBE,GAC9D,CAEA,cAAW3B,GAAc,WAChBA,EAAUyB,GAGZI,IAACC,iBAAgB,CAAC5B,IAAKA,KAASuB,KAAoBxB,GAAa"}
|
package/dts/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { CSSProperties, Component, SVGAttributes, FunctionComponent, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, PureComponent } from 'react';
|
|
3
|
+
import { CSSProperties, Component, SVGAttributes, FunctionComponent, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, RefObject, PureComponent } from 'react';
|
|
4
4
|
import * as styled_components from 'styled-components';
|
|
5
5
|
import { CSSObject, DefaultTheme, FlattenSimpleInterpolation, ThemeProps, Interpolation, SimpleInterpolation, css, StyledProps } from 'styled-components';
|
|
6
6
|
import { Props, PopperInstance, PlacementOptions, Styles } from 'react-floater/lib/types';
|
|
@@ -5037,6 +5037,12 @@ declare type InputCheckboxPalette = {
|
|
|
5037
5037
|
borderColorDisabledChecked: CSSColor;
|
|
5038
5038
|
};
|
|
5039
5039
|
interface InputCheckboxProps extends ResponsiveSizeProps<CheckboxSize$1>, Omit<React.ComponentPropsWithRef<'input'>, 'size' | 'children'> {
|
|
5040
|
+
/** Текущее состояние контрола (использование включает контролируемый режим) */
|
|
5041
|
+
checked?: boolean;
|
|
5042
|
+
/** Начальное состояние контрола */
|
|
5043
|
+
defaultChecked?: boolean;
|
|
5044
|
+
/** Колбек, который будет вызван при изменении состояния контрола */
|
|
5045
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
5040
5046
|
/** Кастомные цвета */
|
|
5041
5047
|
palette?: Partial<Record<keyof InputCheckboxPalette, Color>>;
|
|
5042
5048
|
/** Рендер рутового элемента инлайн */
|
|
@@ -5292,6 +5298,8 @@ DisplayProperty, Omit<React.ComponentPropsWithRef<'div'>, 'color' | 'children'>
|
|
|
5292
5298
|
iconProps?: IconProps;
|
|
5293
5299
|
/** Don't use margin-right: 8px; */
|
|
5294
5300
|
resetDefaultMargin?: boolean;
|
|
5301
|
+
/** @ignore Internal */
|
|
5302
|
+
cursor?: string;
|
|
5295
5303
|
/** @ignore @deprecated Use children */
|
|
5296
5304
|
content?: string | React.ReactNode;
|
|
5297
5305
|
}
|
|
@@ -5417,6 +5425,10 @@ interface TooltipProps extends ResponsiveSizeProps<Size, SizeValue>, React.RefAt
|
|
|
5417
5425
|
callback?: (action: 'open' | 'close', props: Props) => void;
|
|
5418
5426
|
/** Default tooltip target */
|
|
5419
5427
|
children?: React.ReactNode;
|
|
5428
|
+
/** Close tooltip on click outside of its component (work in uncontrolled mode only) */
|
|
5429
|
+
closeOnClickOutside?: boolean;
|
|
5430
|
+
/** Close tooltip on document scroll (work in uncontrolled mode only) */
|
|
5431
|
+
closeOnScroll?: boolean;
|
|
5420
5432
|
/** Custom UI for tooltip */
|
|
5421
5433
|
component?: React.ReactElement | ((props: Pick<TooltipProps, 'size' | 'sizeXXS' | 'sizeXS' | 'sizeS' | 'sizeM' | 'sizeL' | 'sizeXL' | 'black' | 'contrast' | 'showCloseButton' | 'closeButtonProps'> & {
|
|
5422
5434
|
id?: string;
|
|
@@ -5575,6 +5587,10 @@ interface PopoverProps extends ResponsiveSizeProps<Size, SizeValue>, React.RefAt
|
|
|
5575
5587
|
autoOpen?: boolean;
|
|
5576
5588
|
/** It will be called on state change */
|
|
5577
5589
|
callback?: (action: 'open' | 'close', props: Props) => void;
|
|
5590
|
+
/** Close tooltip on click outside of its component (work in uncontrolled mode only) */
|
|
5591
|
+
closeOnClickOutside?: boolean;
|
|
5592
|
+
/** Close tooltip on document scroll (work in uncontrolled mode only) */
|
|
5593
|
+
closeOnScroll?: boolean;
|
|
5578
5594
|
/** Default tooltip target */
|
|
5579
5595
|
children?: React.ReactNode;
|
|
5580
5596
|
/** Debugging logs in console */
|
|
@@ -6422,6 +6438,46 @@ interface AccordionProps extends ResponsiveSizeProps<AccordionSize>, ResponsiveM
|
|
|
6422
6438
|
*/
|
|
6423
6439
|
declare const Accordion: React.ForwardRefExoticComponent<AccordionProps>;
|
|
6424
6440
|
|
|
6441
|
+
declare type SwitchSize = 'xl' | 'l' | 'm' | 's' | 'xs';
|
|
6442
|
+
declare type SwitchPalette = {
|
|
6443
|
+
knobColor: CSSColor;
|
|
6444
|
+
knobShadowColor: CSSColor;
|
|
6445
|
+
trackColor: CSSColor;
|
|
6446
|
+
trackColorHover: CSSColor;
|
|
6447
|
+
trackColorChecked: CSSColor;
|
|
6448
|
+
trackColorCheckedHover: CSSColor;
|
|
6449
|
+
trackColorDisabled: CSSColor;
|
|
6450
|
+
trackColorDisabledChecked: CSSColor;
|
|
6451
|
+
};
|
|
6452
|
+
interface KnobProps extends ResponsiveSizeProps<SwitchSize>, React.ComponentPropsWithoutRef<'span'> {
|
|
6453
|
+
}
|
|
6454
|
+
interface SwitchProps extends ResponsiveSizeProps<SwitchSize>, Omit<React.ComponentPropsWithRef<'input'>, 'size' | 'children'> {
|
|
6455
|
+
/** Текущее состояние контрола (использование включает контролируемый режим) */
|
|
6456
|
+
checked?: boolean;
|
|
6457
|
+
/** Начальное состояние контрола */
|
|
6458
|
+
defaultChecked?: boolean;
|
|
6459
|
+
/** Колбек, который будет вызван при изменении состояния контрола */
|
|
6460
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
6461
|
+
/** Кастомные цвета */
|
|
6462
|
+
palette?: Partial<Record<keyof SwitchPalette, Color>>;
|
|
6463
|
+
/** Пропсы для ручки переключателя */
|
|
6464
|
+
knobProps?: KnobProps;
|
|
6465
|
+
/** Рендер рутового элемента инлайн */
|
|
6466
|
+
inline?: boolean;
|
|
6467
|
+
}
|
|
6468
|
+
|
|
6469
|
+
/**
|
|
6470
|
+
*
|
|
6471
|
+
* Компонент поддерживает все атрибуты \<input\> элемента.
|
|
6472
|
+
*
|
|
6473
|
+
* Переданный "ref" будет ассоциирован с \<input\>.
|
|
6474
|
+
*
|
|
6475
|
+
* Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.
|
|
6476
|
+
*
|
|
6477
|
+
* Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Switch/types.ts).
|
|
6478
|
+
*/
|
|
6479
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps>;
|
|
6480
|
+
|
|
6425
6481
|
interface Theme {
|
|
6426
6482
|
breakpoints: Readonly<Record<Lowercase<Breakpoint>, number>>;
|
|
6427
6483
|
assetHost?: string;
|
|
@@ -6474,6 +6530,7 @@ interface Theme {
|
|
|
6474
6530
|
DialogComponent?: Partial<DialogComponentProps>;
|
|
6475
6531
|
Notification?: Partial<NotificationProps>;
|
|
6476
6532
|
Accordion?: Partial<AccordionProps>;
|
|
6533
|
+
Switch?: Partial<SwitchProps>;
|
|
6477
6534
|
};
|
|
6478
6535
|
}
|
|
6479
6536
|
|
|
@@ -6550,6 +6607,18 @@ declare const screenMinXl: (params?: MediaQueryParams) => <T extends object>(arg
|
|
|
6550
6607
|
*/
|
|
6551
6608
|
declare const screenRetina: (args_0: CSSObject | TemplateStringsArray, args_1: SimpleInterpolation) => styled_components.FlattenSimpleInterpolation;
|
|
6552
6609
|
|
|
6610
|
+
declare const useClickOutside: (ref: RefObject<HTMLElement>, handleClickOutside: (evt: MouseEvent) => void, listenerOptions?: AddEventListenerOptions | boolean) => void;
|
|
6611
|
+
|
|
6612
|
+
declare const useScrollMonitor: ({ target, scrollThrottleMS, scrollEndDebounceMS, onScroll, onScrollStart, onScrollEnd, listenerOptions, }: {
|
|
6613
|
+
target?: string | HTMLElement | RefObject<HTMLElement> | null | undefined;
|
|
6614
|
+
scrollThrottleMS?: number | undefined;
|
|
6615
|
+
scrollEndDebounceMS?: number | undefined;
|
|
6616
|
+
onScroll?: ((evt: Event) => void) | undefined;
|
|
6617
|
+
onScrollStart?: ((evt: Event) => void) | undefined;
|
|
6618
|
+
onScrollEnd?: ((evt: Event) => void) | undefined;
|
|
6619
|
+
listenerOptions?: boolean | AddEventListenerOptions | undefined;
|
|
6620
|
+
}) => void;
|
|
6621
|
+
|
|
6553
6622
|
declare const vAlign: (vAlign: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline') => styled_components.FlattenSimpleInterpolation;
|
|
6554
6623
|
|
|
6555
6624
|
declare function buildMediaQuery(value: number | Size | 'auto' | 'initial' | 'inherit' | boolean, property: string | ((_size: number | 'auto' | 'initial' | 'inherit' | boolean, _sizing?: null | string) => FlattenSimpleInterpolation | null), screenQueryFunction: typeof screenXs, sizing: null | string, sizes?: Record<Size, number>): ReturnType<typeof css>;
|
|
@@ -7247,6 +7316,9 @@ declare const withThemeScrollable: react.ForwardRefExoticComponent<{
|
|
|
7247
7316
|
disabled?: boolean | undefined;
|
|
7248
7317
|
isolate?: boolean | undefined;
|
|
7249
7318
|
shadowColor?: string | undefined;
|
|
7319
|
+
onScrollStart?: (() => void) | undefined;
|
|
7320
|
+
tagName?: string | undefined;
|
|
7321
|
+
trackColor?: string | undefined;
|
|
7250
7322
|
autoHeight?: boolean | undefined;
|
|
7251
7323
|
autoHeightMax?: number | undefined;
|
|
7252
7324
|
autoHeightMin?: number | undefined;
|
|
@@ -7257,7 +7329,6 @@ declare const withThemeScrollable: react.ForwardRefExoticComponent<{
|
|
|
7257
7329
|
disableDefaultStyles?: boolean | undefined;
|
|
7258
7330
|
hideTracksWhenNotNeeded?: boolean | undefined;
|
|
7259
7331
|
onScrollFrame?: (() => void) | undefined;
|
|
7260
|
-
onScrollStart?: (() => void) | undefined;
|
|
7261
7332
|
onScrollStop?: (() => void) | undefined;
|
|
7262
7333
|
onUpdate?: ((values: rc_scrollbars.ScrollValues) => void) | undefined;
|
|
7263
7334
|
renderThumbHorizontal?: rc_scrollbars_lib_Scrollbars_types.CustomRenderer | undefined;
|
|
@@ -7265,7 +7336,6 @@ declare const withThemeScrollable: react.ForwardRefExoticComponent<{
|
|
|
7265
7336
|
renderTrackHorizontal?: rc_scrollbars_lib_Scrollbars_types.CustomRenderer | undefined;
|
|
7266
7337
|
renderTrackVertical?: rc_scrollbars_lib_Scrollbars_types.CustomRenderer | undefined;
|
|
7267
7338
|
renderView?: rc_scrollbars_lib_Scrollbars_types.CustomRenderer | undefined;
|
|
7268
|
-
tagName?: string | undefined;
|
|
7269
7339
|
thumbMinSize?: number | undefined;
|
|
7270
7340
|
thumbSize?: number | undefined;
|
|
7271
7341
|
universal?: boolean | undefined;
|
|
@@ -7276,7 +7346,6 @@ declare const withThemeScrollable: react.ForwardRefExoticComponent<{
|
|
|
7276
7346
|
thumbOpacity?: number | undefined;
|
|
7277
7347
|
thumbBorderRadius?: number | undefined;
|
|
7278
7348
|
thumbWidth?: number | undefined;
|
|
7279
|
-
trackColor?: string | undefined;
|
|
7280
7349
|
trackOpacity?: number | undefined;
|
|
7281
7350
|
trackBorderRadius?: number | undefined;
|
|
7282
7351
|
trackWidth?: number | undefined;
|
|
@@ -7887,6 +7956,12 @@ declare type InputRadioPalette = {
|
|
|
7887
7956
|
borderColorDisabledChecked: CSSColor;
|
|
7888
7957
|
};
|
|
7889
7958
|
interface InputRadioProps extends ResponsiveSizeProps<RadioSize>, Omit<React.ComponentPropsWithRef<'input'>, 'size' | 'children'> {
|
|
7959
|
+
/** Текущее состояние контрола (использование включает контролируемый режим) */
|
|
7960
|
+
checked?: boolean;
|
|
7961
|
+
/** Начальное состояние контрола */
|
|
7962
|
+
defaultChecked?: boolean;
|
|
7963
|
+
/** Колбек, который будет вызван при изменении состояния контрола */
|
|
7964
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
7890
7965
|
/** Кастомные цвета */
|
|
7891
7966
|
palette?: Partial<Record<keyof InputRadioPalette, Color>>;
|
|
7892
7967
|
/** Рендер рутового элемента инлайн */
|
|
@@ -8018,6 +8093,8 @@ declare type FormLabelPalette = {
|
|
|
8018
8093
|
borderColorHover: CSSColor;
|
|
8019
8094
|
};
|
|
8020
8095
|
interface FormLabelProps extends ResponsiveSizeProps<FormLabelSize>, ResponsiveMarginProps, React.ComponentPropsWithRef<'label'> {
|
|
8096
|
+
/** Пропсы бейджа с правого края (для рендера нужно передать `badgeProps.children`) */
|
|
8097
|
+
badgeProps?: BadgeProps;
|
|
8021
8098
|
/** Кастомные цвета */
|
|
8022
8099
|
palette?: Partial<Record<keyof FormLabelPalette, Color>>;
|
|
8023
8100
|
/** Рендер контрола: `Radio.Input`, `Checkbox.Input` или кастомного.
|
|
@@ -8047,6 +8124,7 @@ interface FormLabelProps extends ResponsiveSizeProps<FormLabelSize>, ResponsiveM
|
|
|
8047
8124
|
text?: React.ReactNode;
|
|
8048
8125
|
textProps?: TextProps;
|
|
8049
8126
|
buttonProps?: IconButtonProps;
|
|
8127
|
+
tooltipProps?: TooltipProps;
|
|
8050
8128
|
};
|
|
8051
8129
|
/** @ignore @deprecated */
|
|
8052
8130
|
onColored?: boolean;
|
|
@@ -8198,4 +8276,4 @@ interface DropdownProps extends ResponsiveSizeProps<DropdownSize>, ResponsiveMar
|
|
|
8198
8276
|
*/
|
|
8199
8277
|
declare const Dropdown: React.ForwardRefExoticComponent<DropdownProps>;
|
|
8200
8278
|
|
|
8201
|
-
export { Accordion, ActionBtn, Alert, Amount, Anchor, Arrow, ArrowBadge, Avatar, Badge, type BaseProps, type Breakpoint, Button, COUNTRY_DATA, type CSSBorderStyle, type CSSColor, type CSSFontWeight, type CSSGlobalValue, type CSSUnit, type CSSVerticalAlign, CURRENCY_MAP, Checkbox, Chip, type Color, ColorNames, type ColorPaletteKey, Container, ContextMenu, CurrencyCodes, DEFAULT_MASK, Dialog, Dropdown, FormLabel, type HEX, INITIAL_MASK, Icon, IconButton, Indicator, Input, type KeysOfUnion, ListItem, Menu, Modal, Notification, type Nullable, Paper, Popover, Progress, type RGB, type RGBA, Radio, type ResponsivePositionProps, type ResponsivePropKey, type ResponsiveProps, type ResponsiveSizeInterpolationProps, type ResponsiveSizeProps, withThemeScrollable as Scrollable, Section, Select, Separator, type Size, type SizeValue, Skeleton, Spacer, Spinner, Switcher, Tab, Tabs, Tag, Text$1 as Text, Textarea, type Theme, type ThemeMode, type ThemeName, type ThemePreset, ThemeProvider, Tooltip, type WithThemePreset, adultDarkTheme, adultLightTheme, babyDarkTheme, babyLightTheme, baseInputStyle, buildMediaQuery, color, desktopFirst, hexToRgbA, isHex, mobileFirst, motherDarkTheme, motherLightTheme, property, responsiveNamedProperty, responsiveProperty, screenL, screenM, screenMaxL, screenMaxM, screenMaxS, screenMaxXl, screenMaxXs, screenMaxXxs, screenMinL, screenMinM, screenMinS, screenMinXl, screenMinXs, screenRetina, screenS, screenXl, screenXs, teenDarkTheme, teenLightTheme, defaultTheme as theme, vAlign };
|
|
8279
|
+
export { Accordion, ActionBtn, Alert, Amount, Anchor, Arrow, ArrowBadge, Avatar, Badge, type BaseProps, type Breakpoint, Button, COUNTRY_DATA, type CSSBorderStyle, type CSSColor, type CSSFontWeight, type CSSGlobalValue, type CSSUnit, type CSSVerticalAlign, CURRENCY_MAP, Checkbox, Chip, type Color, ColorNames, type ColorPaletteKey, Container, ContextMenu, CurrencyCodes, DEFAULT_MASK, Dialog, Dropdown, FormLabel, type HEX, INITIAL_MASK, Icon, IconButton, Indicator, Input, type KeysOfUnion, ListItem, Menu, Modal, Notification, type Nullable, Paper, Popover, Progress, type RGB, type RGBA, Radio, type ResponsivePositionProps, type ResponsivePropKey, type ResponsiveProps, type ResponsiveSizeInterpolationProps, type ResponsiveSizeProps, withThemeScrollable as Scrollable, Section, Select, Separator, type Size, type SizeValue, Skeleton, Spacer, Spinner, Switch, Switcher, Tab, Tabs, Tag, Text$1 as Text, Textarea, type Theme, type ThemeMode, type ThemeName, type ThemePreset, ThemeProvider, Tooltip, type WithThemePreset, adultDarkTheme, adultLightTheme, babyDarkTheme, babyLightTheme, baseInputStyle, buildMediaQuery, color, desktopFirst, hexToRgbA, isHex, mobileFirst, motherDarkTheme, motherLightTheme, property, responsiveNamedProperty, responsiveProperty, screenL, screenM, screenMaxL, screenMaxM, screenMaxS, screenMaxXl, screenMaxXs, screenMaxXxs, screenMinL, screenMinM, screenMinS, screenMinXl, screenMinXs, screenRetina, screenS, screenXl, screenXs, teenDarkTheme, teenLightTheme, defaultTheme as theme, useClickOutside, useScrollMonitor, vAlign };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var React=require('react');exports.useClickOutside=(e,t,c)=>{React.useEffect((()=>{const listener=c=>{e.current&&!e.current.contains(c.target)&&t(c)};return document.addEventListener('click',listener,c),()=>{document.removeEventListener('click',listener,c)}}),[t,c])};
|
|
2
|
+
//# sourceMappingURL=useClickOutside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClickOutside.js","sources":["../../../src/hooks/useClickOutside.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport type { RefObject } from 'react'\n\nexport const useClickOutside = (\n ref: RefObject<HTMLElement>,\n handleClickOutside: (evt: MouseEvent) => void,\n // eslint-disable-next-line jsx-control-statements/jsx-jcs-no-undef\n listenerOptions?: AddEventListenerOptions | boolean\n) => {\n useEffect(() => {\n const listener = (evt: MouseEvent) => {\n if (ref.current && !ref.current.contains(evt.target as Node)) {\n handleClickOutside(evt)\n }\n }\n\n document.addEventListener('click', listener, listenerOptions)\n\n return () => {\n document.removeEventListener('click', listener, listenerOptions)\n }\n }, [handleClickOutside, listenerOptions])\n}\n"],"names":["useClickOutside","ref","handleClickOutside","listenerOptions","useEffect","listener","evt","current","contains","target","document","addEventListener","removeEventListener"],"mappings":"gEAG+BA,CAC7BC,EACAC,EAEAC,KAEAC,MAAAA,WAAU,KACR,MAAMC,SAAYC,IACZL,EAAIM,UAAYN,EAAIM,QAAQC,SAASF,EAAIG,SAC3CP,EAAmBI,EACrB,EAKF,OAFAI,SAASC,iBAAiB,QAASN,SAAUF,GAEtC,KACLO,SAASE,oBAAoB,QAASP,SAAUF,EAAgB,CACjE,GACA,CAACD,EAAoBC,GAAiB"}
|