@foxford/ui 2.66.0 → 2.67.0-beta-c9e1f09-20250228
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/Amount/Amount.js +1 -1
- package/components/Amount/Amount.js.map +1 -1
- package/components/Amount/Amount.mjs +1 -1
- package/components/Amount/Amount.mjs.map +1 -1
- package/components/Anchor/Anchor.js +1 -1
- package/components/Anchor/Anchor.js.map +1 -1
- package/components/Anchor/Anchor.mjs +1 -1
- package/components/Anchor/Anchor.mjs.map +1 -1
- package/components/Button/Button.js +1 -1
- package/components/Button/Button.js.map +1 -1
- package/components/Button/Button.mjs +1 -1
- package/components/Button/Button.mjs.map +1 -1
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/Checkbox.mjs +1 -1
- package/components/Checkbox/Checkbox.mjs.map +1 -1
- package/components/Dialog/Dialog.js +1 -1
- package/components/Dialog/Dialog.js.map +1 -1
- package/components/Dialog/Dialog.mjs +1 -1
- package/components/Dialog/Dialog.mjs.map +1 -1
- package/components/DialogComponent/constants.js +1 -1
- package/components/DialogComponent/constants.js.map +1 -1
- package/components/DialogComponent/constants.mjs +1 -1
- package/components/DialogComponent/constants.mjs.map +1 -1
- package/components/Menu/Menu.js +1 -1
- package/components/Menu/Menu.js.map +1 -1
- package/components/Menu/Menu.mjs +1 -1
- package/components/Menu/Menu.mjs.map +1 -1
- package/components/Modal/adapter.js +1 -1
- package/components/Modal/adapter.js.map +1 -1
- package/components/Modal/adapter.mjs +1 -1
- package/components/Modal/adapter.mjs.map +1 -1
- package/components/Popover/Popover.js +1 -1
- package/components/Popover/Popover.js.map +1 -1
- package/components/Popover/Popover.mjs +1 -1
- package/components/Popover/Popover.mjs.map +1 -1
- package/components/Radio/Radio.js +1 -1
- package/components/Radio/Radio.js.map +1 -1
- package/components/Radio/Radio.mjs +1 -1
- package/components/Radio/Radio.mjs.map +1 -1
- 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/dts/index.d.ts +12 -13
- package/hooks/useClassname.js +1 -1
- package/hooks/useClassname.js.map +1 -1
- package/hooks/useClassname.mjs +1 -1
- package/hooks/useClassname.mjs.map +1 -1
- package/hooks/useMergedProps.js +1 -1
- package/hooks/useMergedProps.js.map +1 -1
- package/hooks/useMergedProps.mjs +1 -1
- package/hooks/useMergedProps.mjs.map +1 -1
- package/hooks/useMergedSizes.js +1 -1
- package/hooks/useMergedSizes.js.map +1 -1
- package/hooks/useMergedSizes.mjs +1 -1
- package/hooks/useMergedSizes.mjs.map +1 -1
- package/package.json +3 -4
- package/shared/utils/dom.js +1 -1
- package/shared/utils/dom.js.map +1 -1
- package/shared/utils/dom.mjs +1 -1
- package/shared/utils/dom.mjs.map +1 -1
- package/shared/utils/misc.js +1 -1
- package/shared/utils/misc.js.map +1 -1
- package/shared/utils/misc.mjs +1 -1
- package/shared/utils/misc.mjs.map +1 -1
- package/theme/theme-provider.js +1 -1
- package/theme/theme-provider.js.map +1 -1
- package/theme/theme-provider.mjs +1 -1
- package/theme/theme-provider.mjs.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef, useState, useLayoutEffect } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef, useState, useLayoutEffect } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport type { Props as FloaterProps, PopperInstance, Styles } from 'react-floater'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizeObserver } from 'hooks/useResizeObserver'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { deepmerge } from 'shared/utils/misc'\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 * Компонент поддерживает все атрибуты \\<div\\> элемента.\n *\n * Можно передать \"ref\", который будет ассоциирован с рутовым элементом.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Компонент основан на [\"react-floater\"](https://www.npmjs.com/package/react-floater).\n *\n * Получить доступ к компоненту, не подключенному к библиотеке, можно через `Tooltip.Component`.\n *\n * Полный интерфейс `Tooltip` можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts), интерфейс `Tooltip.Component` [тут](https://github.com/foxford/ui/blob/master/src/components/TooltipComponent/types.ts).\n *\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 styles = {},\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 portalElement,\n zIndex,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const [portal, setPortal] = useState<HTMLElement | null>(null)\n const [popper, setPopper] = useState<PopperInstance | null>(null)\n\n const floaterStyles: Partial<Styles> =\n typeof zIndex === 'number' ? deepmerge(styles, { options: { zIndex } }) : styles\n\n useLayoutEffect(() => {\n if (portalElement) {\n setPortal(null)\n } else if (document.body) {\n let popperPortal = document.querySelector<HTMLElement>('[data-popper-portal]')\n\n if (!popperPortal) {\n popperPortal = document.createElement('div')\n popperPortal.dataset.popperPortal = 'true'\n popperPortal.style.position = 'relative'\n\n document.body.appendChild(popperPortal)\n }\n\n setPortal(popperPortal)\n }\n }, [portalElement])\n\n useResizeObserver({\n target: document.body,\n onResize: () => {\n if (popper && popper.state.options.strategy === 'absolute') {\n popper.update()\n }\n },\n })\n\n if (!portalElement && !portal) {\n return null\n }\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n portalElement: portalElement ?? portal,\n styles: deepmerge(TOOLTIP_STYLES_DEFAULT, floaterStyles),\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 portalElement: portalElement ?? portal,\n getPopper: (popper, origin) => {\n setPopper(popper)\n if (restProps.getPopper) {\n restProps.getPopper(popper, origin)\n }\n },\n offset: restProps.offset ?? 8,\n styles: deepmerge(\n {\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 floaterStyles\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","styles","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","closeOnClickOutside","closeOnScroll","portalElement","zIndex","restProps","theme","useTheme","portal","setPortal","useState","popper","setPopper","floaterStyles","deepmerge","options","useLayoutEffect","document","body","popperPortal","querySelector","createElement","dataset","style","position","appendChild","useResizeObserver","target","onResize","state","strategy","update","tooltipProps","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","jsx","color","colors","backgroundColor","getPopper","origin","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"yqBA6BA,MAAMA,QAAkGC,OAAOC,OAC7GC,gBAAAA,gBACEC,MAAAA,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,OACVA,EAAS,CAAE,EAAAC,QACXA,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,EAAaC,cACbA,EAAaC,OACbA,KACGC,GACDvB,EAEJ,MAAMwB,EAAQC,OAAAA,WAEd,MAAOC,EAAQC,GAAaC,MAAQA,SAAqB,MACzD,MAAOC,EAAQC,GAAaF,MAAQA,SAAwB,MAE5D,MAAMG,SACGT,GAAW,SAAWU,KAAAA,UAAU5B,EAAQ,CAAE6B,QAAS,CAAEX,YAAclB,EA6B5E,GA3BA8B,MAAAA,iBAAgB,KACd,GAAIb,EACFM,EAAU,WACL,GAAIQ,SAASC,KAAM,CACxB,IAAIC,EAAeF,SAASG,cAA2B,wBAElDD,IACHA,EAAeF,SAASI,cAAc,OACtCF,EAAaG,QAAQH,aAAe,OACpCA,EAAaI,MAAMC,SAAW,WAE9BP,SAASC,KAAKO,YAAYN,IAG5BV,EAAUU,EACZ,IACC,CAAChB,IAEJuB,oCAAkB,CAChBC,OAAQV,SAASC,KACjBU,SAAUA,KACJjB,GAAUA,EAAOkB,MAAMd,QAAQe,WAAa,YAC9CnB,EAAOoB,QACT,KAIC5B,IAAkBK,EACrB,OAAO,KAGT,GAAIxB,IAAW,QAAS,CACtB,MAAMgD,EAAe,IAChB3B,EACHF,cAAeA,GAAiBK,EAChCtB,OAAQ4B,KAAAA,UAAUmB,iBAAsBA,uBAAEpB,IAG5C,OACEqB,WAAAA,IAACC,iBAAAA,QAAO,IAAKH,EAAYI,SACvBF,WAAAG,IAAA,OAAA,CAAAD,SAAOJ,EAAaI,YAG1B,CAEA,IAAIE,EAAQhC,EAAMiC,OAAO,qBAErB3C,IAAO0C,EAAQhC,EAAMiC,OAAO,sBAC5B1C,IAAUyC,EAAQhC,EAAMiC,OAAO,2BAC/B5C,GAAS6C,kBAAiBF,EAAQhC,EAAMiC,OAAO5C,EAAQ6C,kBAAoB7C,EAAQ6C,iBAEvF,MAAMR,EAAe,IAChB3B,EACHF,cAAeA,GAAiBK,EAChCiC,UAAWA,CAAC9B,EAAQ+B,KAClB9B,EAAUD,GACNN,EAAUoC,WACZpC,EAAUoC,UAAU9B,EAAQ+B,EAC9B,EAEFC,OAAQtC,EAAUsC,QAAU,EAC5BzD,OAAQ4B,KAAAA,UACN,CACE8B,MAAO,CACLN,QACAO,OAAQ,GACRC,OAAQ,GAEVC,QAAS,CACPC,OAAQ,0BAA0B1C,EAAMiC,OAAO,yBAGnD1B,GAEFoC,UACEf,WAAAG,IAACa,8BAAc,CACbnE,IAAKA,EACLE,KAAMA,EACNE,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,UAAWA,EACXC,MAAOA,EACPC,QAASA,EACTC,MAAOA,EACPC,SAAUA,EACVsD,MAAO9C,EAAU8C,MACjBrD,WAAYA,EACZsD,QAAS/C,EAAU+C,QACnBrD,aAAcA,EACdsD,OAAQhD,EAAUgD,OAClBC,gBAAiBjD,EAAUiD,gBAC3BtD,iBAAkBA,EAClBC,oBAAqBA,EACrBC,cAAeA,EACf+C,UAAW5C,EAAU4C,aAK3B,OACEf,WAAAA,IAACC,iBAAAA,QAAO,IACFH,EACJuB,UAAW,CACTC,KAAM,CACJC,SAAUzB,EAAa0B,eAG3B,IAGN,CACEC,YAxKiB,UAyKjBjE,MAAOkE,UAAAA,QAGX,CACEC,UAAWC,iBAAAA,0CA7KQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{forwardRef,useState,useLayoutEffect}from'react';import{useTheme}from'styled-components';import Floater from'react-floater';import{
|
|
1
|
+
import{forwardRef,useState,useLayoutEffect}from'react';import{useTheme}from'styled-components';import Floater from'react-floater';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{useResizeObserver}from'../../hooks/useResizeObserver.mjs';import{deepmerge}from'../../shared/utils/misc.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(((e,o)=>{const{preset:t,size:s="s",styles:r={},sizeXXS:n,sizeXS:i,sizeS:l,sizeM:p,sizeL:a,sizeXL:m,sizeUnits:c,sizes:d,palette:u,black:f,contrast:z,titleProps:T,contentProps:b,closeButtonProps:g,closeOnClickOutside:S,closeOnScroll:O,portalElement:h,zIndex:P,...y}=e;const C=useTheme();const[E,j]=useState(null);const[L,x]=useState(null);const w=typeof P=='number'?deepmerge(r,{options:{zIndex:P}}):r;if(useLayoutEffect((()=>{if(h)j(null);else if(document.body){let e=document.querySelector('[data-popper-portal]');e||(e=document.createElement('div'),e.dataset.popperPortal='true',e.style.position='relative',document.body.appendChild(e)),j(e)}}),[h]),useResizeObserver({target:document.body,onResize:()=>{L&&L.state.options.strategy==='absolute'&&L.update()}}),!h&&!E)return null;if(t!=='brand'){const e={...y,portalElement:h??E,styles:deepmerge(TOOLTIP_STYLES_DEFAULT,w)};return jsx(Floater,{...e,children:jsx("span",{children:e.children})})}let M=C.colors['bg-onmain-primary'];f&&(M=C.colors['bg-onmain-inverse']),z&&(M=C.colors['bg-brand-primary-basic']),u?.backgroundColor&&(M=C.colors[u.backgroundColor]??u.backgroundColor);const k={...y,portalElement:h??E,getPopper:(e,o)=>{x(e),y.getPopper&&y.getPopper(e,o)},offset:y.offset??8,styles:deepmerge({arrow:{color:M,spread:16,length:8},floater:{filter:`drop-shadow(0 6px 10px ${C.colors['bg-oncolor-hover']})`}},w),component:jsx(TooltipWrapper,{ref:o,size:s,sizeXXS:n,sizeXS:i,sizeS:l,sizeM:p,sizeL:a,sizeXL:m,sizeUnits:c,sizes:d,palette:u,black:f,contrast:z,title:y.title,titleProps:T,content:y.content,contentProps:b,footer:y.footer,showCloseButton:y.showCloseButton,closeButtonProps:g,closeOnClickOutside:S,closeOnScroll:O,component:y.component})};return jsx(Floater,{...k,modifiers:{flip:{enabled:!k.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, useState, useLayoutEffect } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport
|
|
1
|
+
{"version":3,"file":"Tooltip.mjs","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { forwardRef, useState, useLayoutEffect } from 'react'\nimport { useTheme } from 'styled-components'\nimport Floater from 'react-floater'\nimport type { Props as FloaterProps, PopperInstance, Styles } from 'react-floater'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { useResizeObserver } from 'hooks/useResizeObserver'\nimport { SIZES, TooltipComponent } from 'components/TooltipComponent'\nimport { deepmerge } from 'shared/utils/misc'\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 * Компонент поддерживает все атрибуты \\<div\\> элемента.\n *\n * Можно передать \"ref\", который будет ассоциирован с рутовым элементом.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Компонент основан на [\"react-floater\"](https://www.npmjs.com/package/react-floater).\n *\n * Получить доступ к компоненту, не подключенному к библиотеке, можно через `Tooltip.Component`.\n *\n * Полный интерфейс `Tooltip` можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Tooltip/types.ts), интерфейс `Tooltip.Component` [тут](https://github.com/foxford/ui/blob/master/src/components/TooltipComponent/types.ts).\n *\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 styles = {},\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 portalElement,\n zIndex,\n ...restProps\n } = props\n\n const theme = useTheme()\n\n const [portal, setPortal] = useState<HTMLElement | null>(null)\n const [popper, setPopper] = useState<PopperInstance | null>(null)\n\n const floaterStyles: Partial<Styles> =\n typeof zIndex === 'number' ? deepmerge(styles, { options: { zIndex } }) : styles\n\n useLayoutEffect(() => {\n if (portalElement) {\n setPortal(null)\n } else if (document.body) {\n let popperPortal = document.querySelector<HTMLElement>('[data-popper-portal]')\n\n if (!popperPortal) {\n popperPortal = document.createElement('div')\n popperPortal.dataset.popperPortal = 'true'\n popperPortal.style.position = 'relative'\n\n document.body.appendChild(popperPortal)\n }\n\n setPortal(popperPortal)\n }\n }, [portalElement])\n\n useResizeObserver({\n target: document.body,\n onResize: () => {\n if (popper && popper.state.options.strategy === 'absolute') {\n popper.update()\n }\n },\n })\n\n if (!portalElement && !portal) {\n return null\n }\n\n if (preset !== 'brand') {\n const tooltipProps = {\n ...restProps,\n portalElement: portalElement ?? portal,\n styles: deepmerge(TOOLTIP_STYLES_DEFAULT, floaterStyles),\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 portalElement: portalElement ?? portal,\n getPopper: (popper, origin) => {\n setPopper(popper)\n if (restProps.getPopper) {\n restProps.getPopper(popper, origin)\n }\n },\n offset: restProps.offset ?? 8,\n styles: deepmerge(\n {\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 floaterStyles\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","styles","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","palette","black","contrast","titleProps","contentProps","closeButtonProps","closeOnClickOutside","closeOnScroll","portalElement","zIndex","restProps","theme","useTheme","portal","setPortal","useState","popper","setPopper","floaterStyles","deepmerge","options","useLayoutEffect","document","body","popperPortal","querySelector","createElement","dataset","style","position","appendChild","useResizeObserver","target","onResize","state","strategy","update","tooltipProps","TOOLTIP_STYLES_DEFAULT","_jsx","Floater","children","color","colors","backgroundColor","getPopper","origin","offset","arrow","spread","length","floater","filter","component","TooltipWrapper","title","content","footer","showCloseButton","modifiers","flip","enabled","disableFlip","displayName","SIZES","Component","TooltipComponent"],"mappings":"8jBAYMA,MAAAA,eAAiB,UAiBvB,MAAMC,QAAkGC,OAAOC,OAC7GC,gBACEC,YAAW,CAACC,EAAOC,KACjB,MAAMC,OACJA,EAAMC,KACNA,EAAO,IAAGC,OACVA,EAAS,CAAE,EAAAC,QACXA,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,EAAaC,cACbA,EAAaC,OACbA,KACGC,GACDvB,EAEJ,MAAMwB,EAAQC,WAEd,MAAOC,EAAQC,GAAaC,SAA6B,MACzD,MAAOC,EAAQC,GAAaF,SAAgC,MAE5D,MAAMG,SACGT,GAAW,SAAWU,UAAU5B,EAAQ,CAAE6B,QAAS,CAAEX,YAAclB,EA6B5E,GA3BA8B,iBAAgB,KACd,GAAIb,EACFM,EAAU,WACL,GAAIQ,SAASC,KAAM,CACxB,IAAIC,EAAeF,SAASG,cAA2B,wBAElDD,IACHA,EAAeF,SAASI,cAAc,OACtCF,EAAaG,QAAQH,aAAe,OACpCA,EAAaI,MAAMC,SAAW,WAE9BP,SAASC,KAAKO,YAAYN,IAG5BV,EAAUU,EACZ,IACC,CAAChB,IAEJuB,kBAAkB,CAChBC,OAAQV,SAASC,KACjBU,SAAUA,KACJjB,GAAUA,EAAOkB,MAAMd,QAAQe,WAAa,YAC9CnB,EAAOoB,QACT,KAIC5B,IAAkBK,EACrB,OAAO,KAGT,GAAIxB,IAAW,QAAS,CACtB,MAAMgD,EAAe,IAChB3B,EACHF,cAAeA,GAAiBK,EAChCtB,OAAQ4B,UAAUmB,uBAAwBpB,IAG5C,OACEqB,IAACC,QAAO,IAAKH,EAAYI,SACvBF,IAAA,OAAA,CAAAE,SAAOJ,EAAaI,YAG1B,CAEA,IAAIC,EAAQ/B,EAAMgC,OAAO,qBAErB1C,IAAOyC,EAAQ/B,EAAMgC,OAAO,sBAC5BzC,IAAUwC,EAAQ/B,EAAMgC,OAAO,2BAC/B3C,GAAS4C,kBAAiBF,EAAQ/B,EAAMgC,OAAO3C,EAAQ4C,kBAAoB5C,EAAQ4C,iBAEvF,MAAMP,EAAe,IAChB3B,EACHF,cAAeA,GAAiBK,EAChCgC,UAAWA,CAAC7B,EAAQ8B,KAClB7B,EAAUD,GACNN,EAAUmC,WACZnC,EAAUmC,UAAU7B,EAAQ8B,EAC9B,EAEFC,OAAQrC,EAAUqC,QAAU,EAC5BxD,OAAQ4B,UACN,CACE6B,MAAO,CACLN,QACAO,OAAQ,GACRC,OAAQ,GAEVC,QAAS,CACPC,OAAQ,0BAA0BzC,EAAMgC,OAAO,yBAGnDzB,GAEFmC,UACEd,IAACe,eAAc,CACblE,IAAKA,EACLE,KAAMA,EACNE,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,UAAWA,EACXC,MAAOA,EACPC,QAASA,EACTC,MAAOA,EACPC,SAAUA,EACVqD,MAAO7C,EAAU6C,MACjBpD,WAAYA,EACZqD,QAAS9C,EAAU8C,QACnBpD,aAAcA,EACdqD,OAAQ/C,EAAU+C,OAClBC,gBAAiBhD,EAAUgD,gBAC3BrD,iBAAkBA,EAClBC,oBAAqBA,EACrBC,cAAeA,EACf8C,UAAW3C,EAAU2C,aAK3B,OACEd,IAACC,QAAO,IACFH,EACJsB,UAAW,CACTC,KAAM,CACJC,SAAUxB,EAAayB,eAG3B,IAGN,CACEC,YAxKiB,UAyKjBhE,MAAOiE,QAGX,CACEC,UAAWC"}
|
package/dts/index.d.ts
CHANGED
|
@@ -1301,17 +1301,16 @@ DisplayProperty {
|
|
|
1301
1301
|
iconProps?: IconProps;
|
|
1302
1302
|
/** Build rel attribute with relBuilder from context */
|
|
1303
1303
|
autoRel?: boolean;
|
|
1304
|
-
/** Link from
|
|
1305
|
-
* Look up [docs](https://v5.reactrouter.com/web/api/Link) */
|
|
1304
|
+
/** Link from `theme.link` will be used */
|
|
1306
1305
|
to?: string | Partial<Location$1> | ((location: Location$1) => string | Partial<Location$1>);
|
|
1307
|
-
/** Look up react-router-dom [docs](https://v5.reactrouter.com/web/api/Link) */
|
|
1308
|
-
replace?: boolean;
|
|
1309
1306
|
/** Anchor disabled */
|
|
1310
1307
|
disabled?: boolean;
|
|
1311
1308
|
/** Appearance variant */
|
|
1312
1309
|
onColored?: boolean;
|
|
1313
1310
|
/** Vertical alignment */
|
|
1314
1311
|
verticalAlign?: CSSVerticalAlign | boolean;
|
|
1312
|
+
/** @ignore @deprecated */
|
|
1313
|
+
replace?: boolean;
|
|
1315
1314
|
/** @ignore @deprecated Use anchor or Link interface */
|
|
1316
1315
|
as?: React.ElementType<any>;
|
|
1317
1316
|
/** @ignore @deprecated Use children */
|
|
@@ -1437,8 +1436,7 @@ ResponsiveNamedProperty<'height', 'l' | 'm' | 's' | 'xs' | number> {
|
|
|
1437
1436
|
* @default false */
|
|
1438
1437
|
outline?: boolean;
|
|
1439
1438
|
/**
|
|
1440
|
-
* Link from
|
|
1441
|
-
* Look up [docs](https://v5.reactrouter.com/web/api/Link)
|
|
1439
|
+
* Link from `theme.link` will be used
|
|
1442
1440
|
* @default undefined */
|
|
1443
1441
|
to?: string | Partial<Location$1> | ((location: Location$1) => string | Partial<Location$1>);
|
|
1444
1442
|
/**
|
|
@@ -3067,12 +3065,8 @@ interface MenuProps extends ResponsiveSizeProps<MenuComponentSize>, React.RefAtt
|
|
|
3067
3065
|
callback?: (action: 'open' | 'close', props: Props) => void;
|
|
3068
3066
|
/** Menu trigger and its target */
|
|
3069
3067
|
children?: React.ReactNode;
|
|
3070
|
-
/** Debugging logs in console */
|
|
3071
|
-
debug?: boolean;
|
|
3072
3068
|
/** Don't adjust menu on scroll / resize (default true) */
|
|
3073
3069
|
disableFlip?: boolean;
|
|
3074
|
-
/** Callback to get popper.js instance */
|
|
3075
|
-
getPopper?: (popper: PopperInstance, origin: 'floater' | 'wrapper') => void;
|
|
3076
3070
|
/** Distance in px between menu and its target (default 8px) */
|
|
3077
3071
|
offset?: number;
|
|
3078
3072
|
/** Switch between normal and controlled modes. It will disable built in menu behavior */
|
|
@@ -3081,8 +3075,6 @@ interface MenuProps extends ResponsiveSizeProps<MenuComponentSize>, React.RefAtt
|
|
|
3081
3075
|
placement?: Placement;
|
|
3082
3076
|
/** CSS selector or element to render menus */
|
|
3083
3077
|
portalElement?: Props['portalElement'];
|
|
3084
|
-
/** Custom styles */
|
|
3085
|
-
styles?: Partial<Styles>;
|
|
3086
3078
|
/** Render menu view (Menu.List, Menu.Container, or custom component) */
|
|
3087
3079
|
render: React.ReactElement | ((props: Pick<MenuProps, 'size' | 'sizeXXS' | 'sizeXS' | 'sizeS' | 'sizeM' | 'sizeL' | 'sizeXL' | 'showCloseButton' | 'closeButtonProps'> & {
|
|
3088
3080
|
closeFn: () => void;
|
|
@@ -3105,6 +3097,12 @@ interface MenuProps extends ResponsiveSizeProps<MenuComponentSize>, React.RefAtt
|
|
|
3105
3097
|
zIndex?: number;
|
|
3106
3098
|
/** Close menu on click outside (work in uncontrolled mode) */
|
|
3107
3099
|
closeOnClickOutside?: boolean;
|
|
3100
|
+
/** @ignore */
|
|
3101
|
+
debug?: boolean;
|
|
3102
|
+
/** @ignore */
|
|
3103
|
+
styles?: Partial<Styles>;
|
|
3104
|
+
/** @ignore */
|
|
3105
|
+
getPopper?: (popper: PopperInstance, origin: 'floater' | 'wrapper') => void;
|
|
3108
3106
|
}
|
|
3109
3107
|
|
|
3110
3108
|
/**
|
|
@@ -3463,7 +3461,7 @@ interface NotificationProps extends ResponsiveSizeProps<NotificationSize>, Respo
|
|
|
3463
3461
|
actionButtonProps?: ButtonProps;
|
|
3464
3462
|
/**
|
|
3465
3463
|
* Пропсы для компонента ссылки.
|
|
3466
|
-
* Для рендера нужно передать "to" (будет использован
|
|
3464
|
+
* Для рендера нужно передать "to" (будет использован `theme.link`)
|
|
3467
3465
|
* или "href" (будет использован нативный \<a\> элемент)
|
|
3468
3466
|
*/
|
|
3469
3467
|
anchorProps?: AnchorProps;
|
|
@@ -3640,6 +3638,7 @@ interface Theme {
|
|
|
3640
3638
|
mode: ThemeMode;
|
|
3641
3639
|
preset: ThemePreset;
|
|
3642
3640
|
name: ThemeName;
|
|
3641
|
+
link?: React.ElementType;
|
|
3643
3642
|
components?: {
|
|
3644
3643
|
Alert?: Partial<AlertProps>;
|
|
3645
3644
|
Anchor?: Partial<AnchorProps>;
|
package/hooks/useClassname.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var styled=require('styled-components');
|
|
1
|
+
'use strict';var styled=require('styled-components');var dom=require('../shared/utils/dom.js');exports.useClassname=(e,s)=>{const r=styled.useTheme();return dom.concatClassNames(`${r.classNamePrefix}-${e}`,s)};
|
|
2
2
|
//# sourceMappingURL=useClassname.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClassname.js","sources":["../../../src/hooks/useClassname.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport
|
|
1
|
+
{"version":3,"file":"useClassname.js","sources":["../../../src/hooks/useClassname.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { concatClassNames } from 'shared/utils/dom'\n\nexport function useClassname(componentName: string, originalClassName?: string) {\n const theme = useTheme()\n return concatClassNames(`${theme.classNamePrefix}-${componentName}`, originalClassName)\n}\n"],"names":["componentName","originalClassName","theme","useTheme","concatClassNames","classNamePrefix"],"mappings":"oHAGO,CAAsBA,EAAuBC,KAClD,MAAMC,EAAQC,OAAAA,WACd,OAAOC,IAAgBA,iBAAC,GAAGF,EAAMG,mBAAmBL,IAAiBC,EACvE"}
|
package/hooks/useClassname.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useTheme}from'styled-components';import
|
|
1
|
+
import{useTheme}from'styled-components';import{concatClassNames}from'../shared/utils/dom.mjs';function useClassname(s,e){const m=useTheme();return concatClassNames(`${m.classNamePrefix}-${s}`,e)}export{useClassname};
|
|
2
2
|
//# sourceMappingURL=useClassname.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClassname.mjs","sources":["../../../src/hooks/useClassname.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport
|
|
1
|
+
{"version":3,"file":"useClassname.mjs","sources":["../../../src/hooks/useClassname.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { concatClassNames } from 'shared/utils/dom'\n\nexport function useClassname(componentName: string, originalClassName?: string) {\n const theme = useTheme()\n return concatClassNames(`${theme.classNamePrefix}-${componentName}`, originalClassName)\n}\n"],"names":["useClassname","componentName","originalClassName","theme","useTheme","concatClassNames","classNamePrefix"],"mappings":"8FAGO,SAASA,aAAaC,EAAuBC,GAClD,MAAMC,EAAQC,WACd,OAAOC,iBAAiB,GAAGF,EAAMG,mBAAmBL,IAAiBC,EACvE"}
|
package/hooks/useMergedProps.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var styled=require('styled-components');var
|
|
1
|
+
'use strict';var styled=require('styled-components');var misc=require('../shared/utils/misc.js');exports.useMergedProps=(e,s)=>{const r=styled.useTheme();const t=misc.deepmerge((r.components??{})[s]??{},e);return{...t,preset:t.preset??r.preset}};
|
|
2
2
|
//# sourceMappingURL=useMergedProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedProps.js","sources":["../../../src/hooks/useMergedProps.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport {
|
|
1
|
+
{"version":3,"file":"useMergedProps.js","sources":["../../../src/hooks/useMergedProps.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { deepmerge } from 'shared/utils/misc'\nimport type { ThemePreset, WithThemePreset } from 'shared/types'\n\nexport function useMergedProps<\n T extends {\n preset?: ThemePreset\n }\n>(componentProps: T, componentName: string): WithThemePreset<T> {\n const theme = useTheme()\n\n const context = theme.components ?? {}\n const contextProps: T = context[componentName] ?? {}\n const mergedProps = deepmerge(contextProps, componentProps) as T\n\n return {\n ...mergedProps,\n preset: mergedProps.preset ?? theme.preset,\n }\n}\n"],"names":["componentProps","componentName","theme","useTheme","mergedProps","deepmerge","components","preset"],"mappings":"wHAIO,CAILA,EAAmBC,KACnB,MAAMC,EAAQC,OAAAA,WAId,MAAMC,EAAcC,KAAAA,WAFJH,EAAMI,YAAc,IACJL,IAAkB,CAAA,EACND,GAE5C,MAAO,IACFI,EACHG,OAAQH,EAAYG,QAAUL,EAAMK,OAExC"}
|
package/hooks/useMergedProps.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useTheme}from'styled-components';import{
|
|
1
|
+
import{useTheme}from'styled-components';import{deepmerge}from'../shared/utils/misc.mjs';function useMergedProps(e,s){const r=useTheme();const o=deepmerge((r.components??{})[s]??{},e);return{...o,preset:o.preset??r.preset}}export{useMergedProps};
|
|
2
2
|
//# sourceMappingURL=useMergedProps.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedProps.mjs","sources":["../../../src/hooks/useMergedProps.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport {
|
|
1
|
+
{"version":3,"file":"useMergedProps.mjs","sources":["../../../src/hooks/useMergedProps.ts"],"sourcesContent":["import { useTheme } from 'styled-components'\nimport { deepmerge } from 'shared/utils/misc'\nimport type { ThemePreset, WithThemePreset } from 'shared/types'\n\nexport function useMergedProps<\n T extends {\n preset?: ThemePreset\n }\n>(componentProps: T, componentName: string): WithThemePreset<T> {\n const theme = useTheme()\n\n const context = theme.components ?? {}\n const contextProps: T = context[componentName] ?? {}\n const mergedProps = deepmerge(contextProps, componentProps) as T\n\n return {\n ...mergedProps,\n preset: mergedProps.preset ?? theme.preset,\n }\n}\n"],"names":["useMergedProps","componentProps","componentName","theme","useTheme","mergedProps","deepmerge","components","preset"],"mappings":"wFAIO,SAASA,eAIdC,EAAmBC,GACnB,MAAMC,EAAQC,WAId,MAAMC,EAAcC,WAFJH,EAAMI,YAAc,IACJL,IAAkB,CAAA,EACND,GAE5C,MAAO,IACFI,EACHG,OAAQH,EAAYG,QAAUL,EAAMK,OAExC"}
|
package/hooks/useMergedSizes.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var misc=require('../shared/utils/misc.js');exports.useMergedSizes=(e,s)=>{const r=typeof s=='function'?s(e):s;return misc.deepmerge(r,e.sizes??{})};
|
|
2
2
|
//# sourceMappingURL=useMergedSizes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedSizes.js","sources":["../../../src/hooks/useMergedSizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"useMergedSizes.js","sources":["../../../src/hooks/useMergedSizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { deepmerge } from 'shared/utils/misc'\nimport type { KeysOfUnion, WithThemePreset, Size } from 'shared/types'\n\nexport function useMergedSizes<\n T extends WithThemePreset<{\n sizes?: Partial<Record<Size, CSSProperties>>\n }>\n>(\n componentProps: T,\n componentSizes:\n | Record<KeysOfUnion<T['sizes']>, CSSProperties>\n | ((props: T) => Record<KeysOfUnion<T['sizes']>, CSSProperties>)\n) {\n const sizesDefault = typeof componentSizes === 'function' ? componentSizes(componentProps) : componentSizes\n const sizesProp = componentProps.sizes ?? {}\n\n return deepmerge(sizesDefault, sizesProp) as Record<KeysOfUnion<T['sizes']>, CSSProperties>\n}\n"],"names":["componentProps","componentSizes","sizesDefault","deepmerge","sizes"],"mappings":"gFAIO,CAKLA,EACAC,KAIA,MAAMC,SAAsBD,GAAmB,WAAaA,EAAeD,GAAkBC,EAG7F,OAAOE,KAASA,UAACD,EAFCF,EAAeI,OAAS,GAG5C"}
|
package/hooks/useMergedSizes.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{deepmerge}from'../shared/utils/misc.mjs';function useMergedSizes(e,s){const r=typeof s=='function'?s(e):s;return deepmerge(r,e.sizes??{})}export{useMergedSizes};
|
|
2
2
|
//# sourceMappingURL=useMergedSizes.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMergedSizes.mjs","sources":["../../../src/hooks/useMergedSizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport {
|
|
1
|
+
{"version":3,"file":"useMergedSizes.mjs","sources":["../../../src/hooks/useMergedSizes.ts"],"sourcesContent":["import type { CSSProperties } from 'react'\nimport { deepmerge } from 'shared/utils/misc'\nimport type { KeysOfUnion, WithThemePreset, Size } from 'shared/types'\n\nexport function useMergedSizes<\n T extends WithThemePreset<{\n sizes?: Partial<Record<Size, CSSProperties>>\n }>\n>(\n componentProps: T,\n componentSizes:\n | Record<KeysOfUnion<T['sizes']>, CSSProperties>\n | ((props: T) => Record<KeysOfUnion<T['sizes']>, CSSProperties>)\n) {\n const sizesDefault = typeof componentSizes === 'function' ? componentSizes(componentProps) : componentSizes\n const sizesProp = componentProps.sizes ?? {}\n\n return deepmerge(sizesDefault, sizesProp) as Record<KeysOfUnion<T['sizes']>, CSSProperties>\n}\n"],"names":["useMergedSizes","componentProps","componentSizes","sizesDefault","deepmerge","sizes"],"mappings":"gDAIO,SAASA,eAKdC,EACAC,GAIA,MAAMC,SAAsBD,GAAmB,WAAaA,EAAeD,GAAkBC,EAG7F,OAAOE,UAAUD,EAFCF,EAAeI,OAAS,GAG5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.67.0-beta-c9e1f09-20250228",
|
|
4
4
|
"description": "UI components library",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/foxford/ui/issues"
|
|
@@ -22,11 +22,10 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@foxford/icon-pack": "0.12.0",
|
|
25
|
-
"
|
|
25
|
+
"deepmerge-ts": "7.1.5",
|
|
26
26
|
"dompurify": "3.1.6",
|
|
27
27
|
"fuse.js": "7.0.0",
|
|
28
28
|
"nanoid": "5.0.9",
|
|
29
|
-
"ramda": "0.28.0",
|
|
30
29
|
"rc-scrollbars": "1.1.5",
|
|
31
30
|
"react-floater": "0.9.4",
|
|
32
31
|
"react-input-mask": "2.0.4",
|
|
@@ -38,7 +37,6 @@
|
|
|
38
37
|
"peerDependencies": {
|
|
39
38
|
"react": ">=16 <=18",
|
|
40
39
|
"react-dom": ">=16 <=18",
|
|
41
|
-
"react-router-dom": ">=5.x.x",
|
|
42
40
|
"styled-components": "5.x"
|
|
43
41
|
},
|
|
44
42
|
"main": "./index.js",
|
|
@@ -71,3 +69,4 @@
|
|
|
71
69
|
"theme"
|
|
72
70
|
]
|
|
73
71
|
}
|
|
72
|
+
|
package/shared/utils/dom.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';const SELECTORS_FOCUSABLE='a[href]:not([tabindex^="-"]), button:not(:disabled, [tabindex^="-"]), input:not(:disabled, [type="hidden"], [tabindex^="-"]), select:not(:disabled, [tabindex^="-"]), textarea:not(:disabled, [tabindex^="-"]), area[href]:not([tabindex^="-"]), iframe:not([tabindex^="-"]), object:not([tabindex^="-"]), summary:not([tabindex^="-"]), [tabindex]:not([tabindex^="-"]), [contenteditable]:not([contenteditable="false"], [tabindex^="-"])';exports.concatClassNames=(...t)=>t.reduce(((t,e)=>(e&&(t=t?t+' '+e:e),t)),''),exports.focusFirstFocusable=(t,e)=>{if(t.matches(SELECTORS_FOCUSABLE)&&typeof t.focus=='function')return t.focus(e),!0;const n=t.querySelector(SELECTORS_FOCUSABLE);return n instanceof HTMLElement&&typeof n.focus=='function'&&(n.focus(e),!0)},exports.focusLastFocusable=(t,e)=>{const n=t.querySelectorAll(SELECTORS_FOCUSABLE);const o=n[n.length-1];return o instanceof HTMLElement&&typeof o.focus=='function'&&(o.focus(e),!0)};
|
|
1
|
+
'use strict';const SELECTORS_FOCUSABLE='a[href]:not([tabindex^="-"]), button:not(:disabled, [tabindex^="-"]), input:not(:disabled, [type="hidden"], [tabindex^="-"]), select:not(:disabled, [tabindex^="-"]), textarea:not(:disabled, [tabindex^="-"]), area[href]:not([tabindex^="-"]), iframe:not([tabindex^="-"]), object:not([tabindex^="-"]), summary:not([tabindex^="-"]), [tabindex]:not([tabindex^="-"]), [contenteditable]:not([contenteditable="false"], [tabindex^="-"])';exports.concatClassNames=(...t)=>t.reduce(((t,e)=>(typeof e=='string'&&(t=t?t+' '+e:e),t)),''),exports.focusFirstFocusable=(t,e)=>{if(t.matches(SELECTORS_FOCUSABLE)&&typeof t.focus=='function')return t.focus(e),!0;const n=t.querySelector(SELECTORS_FOCUSABLE);return n instanceof HTMLElement&&typeof n.focus=='function'&&(n.focus(e),!0)},exports.focusLastFocusable=(t,e)=>{const n=t.querySelectorAll(SELECTORS_FOCUSABLE);const o=n[n.length-1];return o instanceof HTMLElement&&typeof o.focus=='function'&&(o.focus(e),!0)};
|
|
2
2
|
//# sourceMappingURL=dom.js.map
|
package/shared/utils/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import type { Nullable } from 'shared/types'\n\nconst SELECTORS_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const focusFirstFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n if (element.matches(SELECTORS_FOCUSABLE) && typeof element.focus === 'function') {\n element.focus(options)\n\n return true\n }\n\n const descendent = element.querySelector(SELECTORS_FOCUSABLE)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n const descendants = element.querySelectorAll(SELECTORS_FOCUSABLE)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<
|
|
1
|
+
{"version":3,"file":"dom.js","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import type { Nullable } from 'shared/types'\n\nconst SELECTORS_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const focusFirstFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n if (element.matches(SELECTORS_FOCUSABLE) && typeof element.focus === 'function') {\n element.focus(options)\n\n return true\n }\n\n const descendent = element.querySelector(SELECTORS_FOCUSABLE)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n const descendants = element.querySelectorAll(SELECTORS_FOCUSABLE)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<unknown>[]): string =>\n classNames.reduce<string>((acc, className) => {\n if (typeof className === 'string') {\n acc = acc ? acc + ' ' + className : className\n }\n\n return acc\n }, '')\n"],"names":["SELECTORS_FOCUSABLE","concatClassNames","classNames","reduce","acc","className","focusFirstFocusable","element","options","matches","focus","descendent","querySelector","HTMLElement","focusLastFocusable","descendants","querySelectorAll","lastDescendant","length"],"mappings":"aAEA,MAAMA,oBACJ,ucA2C8BC,IAAIC,IAClCA,EAAWC,QAAe,CAACC,EAAKC,YACnBA,GAAc,WACvBD,EAAMA,EAAMA,EAAM,IAAMC,EAAYA,GAG/BD,IACN,gCAhD8BE,CACjCC,EACAC,KAIA,GAAID,EAAQE,QAAQT,6BAA+BO,EAAQG,OAAU,WAGnE,OAFAH,EAAQG,MAAMF,IAEP,EAGT,MAAMG,EAAaJ,EAAQK,cAAcZ,qBAEzC,OAAIW,aAAsBE,oBAAsBF,EAAWD,OAAU,aACnEC,EAAWD,MAAMF,IAEV,EAGG,6BAGoBM,CAChCP,EACAC,KAIA,MAAMO,EAAcR,EAAQS,iBAAiBhB,qBAC7C,MAAMiB,EAAiBF,EAAYA,EAAYG,OAAS,GAExD,OAAID,aAA0BJ,oBAAsBI,EAAeP,OAAU,aAC3EO,EAAeP,MAAMF,IAEd,EAGG"}
|
package/shared/utils/dom.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const SELECTORS_FOCUSABLE='a[href]:not([tabindex^="-"]), button:not(:disabled, [tabindex^="-"]), input:not(:disabled, [type="hidden"], [tabindex^="-"]), select:not(:disabled, [tabindex^="-"]), textarea:not(:disabled, [tabindex^="-"]), area[href]:not([tabindex^="-"]), iframe:not([tabindex^="-"]), object:not([tabindex^="-"]), summary:not([tabindex^="-"]), [tabindex]:not([tabindex^="-"]), [contenteditable]:not([contenteditable="false"], [tabindex^="-"])';const focusFirstFocusable=(t,e)=>{if(t.matches(SELECTORS_FOCUSABLE)&&typeof t.focus=='function')return t.focus(e),!0;const n=t.querySelector(SELECTORS_FOCUSABLE);return n instanceof HTMLElement&&typeof n.focus=='function'&&(n.focus(e),!0)};const focusLastFocusable=(t,e)=>{const n=t.querySelectorAll(SELECTORS_FOCUSABLE);const o=n[n.length-1];return o instanceof HTMLElement&&typeof o.focus=='function'&&(o.focus(e),!0)};const concatClassNames=(...t)=>t.reduce(((t,e)=>(e&&(t=t?t+' '+e:e),t)),'');export{concatClassNames,focusFirstFocusable,focusLastFocusable};
|
|
1
|
+
const SELECTORS_FOCUSABLE='a[href]:not([tabindex^="-"]), button:not(:disabled, [tabindex^="-"]), input:not(:disabled, [type="hidden"], [tabindex^="-"]), select:not(:disabled, [tabindex^="-"]), textarea:not(:disabled, [tabindex^="-"]), area[href]:not([tabindex^="-"]), iframe:not([tabindex^="-"]), object:not([tabindex^="-"]), summary:not([tabindex^="-"]), [tabindex]:not([tabindex^="-"]), [contenteditable]:not([contenteditable="false"], [tabindex^="-"])';const focusFirstFocusable=(t,e)=>{if(t.matches(SELECTORS_FOCUSABLE)&&typeof t.focus=='function')return t.focus(e),!0;const n=t.querySelector(SELECTORS_FOCUSABLE);return n instanceof HTMLElement&&typeof n.focus=='function'&&(n.focus(e),!0)};const focusLastFocusable=(t,e)=>{const n=t.querySelectorAll(SELECTORS_FOCUSABLE);const o=n[n.length-1];return o instanceof HTMLElement&&typeof o.focus=='function'&&(o.focus(e),!0)};const concatClassNames=(...t)=>t.reduce(((t,e)=>(typeof e=='string'&&(t=t?t+' '+e:e),t)),'');export{concatClassNames,focusFirstFocusable,focusLastFocusable};
|
|
2
2
|
//# sourceMappingURL=dom.mjs.map
|
package/shared/utils/dom.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.mjs","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import type { Nullable } from 'shared/types'\n\nconst SELECTORS_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const focusFirstFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n if (element.matches(SELECTORS_FOCUSABLE) && typeof element.focus === 'function') {\n element.focus(options)\n\n return true\n }\n\n const descendent = element.querySelector(SELECTORS_FOCUSABLE)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n const descendants = element.querySelectorAll(SELECTORS_FOCUSABLE)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<
|
|
1
|
+
{"version":3,"file":"dom.mjs","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import type { Nullable } from 'shared/types'\n\nconst SELECTORS_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"]), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const focusFirstFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n if (element.matches(SELECTORS_FOCUSABLE) && typeof element.focus === 'function') {\n element.focus(options)\n\n return true\n }\n\n const descendent = element.querySelector(SELECTORS_FOCUSABLE)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (\n element: HTMLElement,\n options?: {\n preventScroll?: boolean\n }\n): boolean => {\n const descendants = element.querySelectorAll(SELECTORS_FOCUSABLE)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus(options)\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<unknown>[]): string =>\n classNames.reduce<string>((acc, className) => {\n if (typeof className === 'string') {\n acc = acc ? acc + ' ' + className : className\n }\n\n return acc\n }, '')\n"],"names":["SELECTORS_FOCUSABLE","focusFirstFocusable","element","options","matches","focus","descendent","querySelector","HTMLElement","focusLastFocusable","descendants","querySelectorAll","lastDescendant","length","concatClassNames","classNames","reduce","acc","className"],"mappings":"AAEA,MAAMA,oBACJ,obAEWC,oBAAsBA,CACjCC,EACAC,KAIA,GAAID,EAAQE,QAAQJ,6BAA+BE,EAAQG,OAAU,WAGnE,OAFAH,EAAQG,MAAMF,IAEP,EAGT,MAAMG,EAAaJ,EAAQK,cAAcP,qBAEzC,OAAIM,aAAsBE,oBAAsBF,EAAWD,OAAU,aACnEC,EAAWD,MAAMF,IAEV,EAGG,QAGDM,mBAAqBA,CAChCP,EACAC,KAIA,MAAMO,EAAcR,EAAQS,iBAAiBX,qBAC7C,MAAMY,EAAiBF,EAAYA,EAAYG,OAAS,GAExD,OAAID,aAA0BJ,oBAAsBI,EAAeP,OAAU,aAC3EO,EAAeP,MAAMF,IAEd,EAGG,EAGDW,MAAAA,iBAAmBA,IAAIC,IAClCA,EAAWC,QAAe,CAACC,EAAKC,YACnBA,GAAc,WACvBD,EAAMA,EAAMA,EAAM,IAAMC,EAAYA,GAG/BD,IACN"}
|
package/shared/utils/misc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';exports.createThrottledCallback=(
|
|
1
|
+
'use strict';const deepmerge=require('deepmerge-ts').deepmergeCustom({mergeArrays:!1});exports.createThrottledCallback=(e,r=100)=>{let t=null;return s=>{t||(t=setTimeout((()=>{t=null}),r),e(s))}},exports.deepmerge=deepmerge,exports.getProgressPercent=(e,r)=>{if(e<0||r<=0)return 0;const t=e/r*100;return Number.isNaN(t)?0:Math.round(Math.min(t,100))};
|
|
2
2
|
//# sourceMappingURL=misc.js.map
|
package/shared/utils/misc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.js","sources":["../../../../src/shared/utils/misc.ts"],"sourcesContent":["import type { Nullable } from 'shared/types'\n\nexport const createThrottledCallback = <T>(cb: (params: T) => void, throttleMS = 100): typeof cb => {\n let timerId: Nullable<ReturnType<typeof setTimeout>> = null\n\n return (params: T) => {\n if (timerId) return\n\n timerId = setTimeout(() => {\n timerId = null\n }, throttleMS)\n\n cb(params)\n }\n}\n\nexport const getProgressPercent = (value: number, max: number): number => {\n if (value < 0 || max <= 0) return 0\n\n const percent = (value / max) * 100\n\n return Number.isNaN(percent) ? 0 : Math.round(Math.min(percent, 100))\n}\n"],"names":["createThrottledCallback","cb","throttleMS","timerId","params","setTimeout","getProgressPercent","value","max","percent","Number","isNaN","Math","round","min"],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc.js","sources":["../../../../src/shared/utils/misc.ts"],"sourcesContent":["import { deepmergeCustom } from 'deepmerge-ts'\nimport type { Nullable } from 'shared/types'\n\nexport const deepmerge = deepmergeCustom({\n mergeArrays: false,\n})\n\nexport const createThrottledCallback = <T>(cb: (params: T) => void, throttleMS = 100): typeof cb => {\n let timerId: Nullable<ReturnType<typeof setTimeout>> = null\n\n return (params: T) => {\n if (timerId) return\n\n timerId = setTimeout(() => {\n timerId = null\n }, throttleMS)\n\n cb(params)\n }\n}\n\nexport const getProgressPercent = (value: number, max: number): number => {\n if (value < 0 || max <= 0) return 0\n\n const percent = (value / max) * 100\n\n return Number.isNaN(percent) ? 0 : Math.round(Math.min(percent, 100))\n}\n"],"names":["deepmerge","deepmergeCustom","mergeArrays","createThrottledCallback","cb","throttleMS","timerId","params","setTimeout","getProgressPercent","value","max","percent","Number","isNaN","Math","round","min"],"mappings":"aAGaA,MAAAA,kCAAYC,gBAAgB,CACvCC,aAAa,oCAGwBC,CAAIC,EAAyBC,EAAa,OAC/E,IAAIC,EAAmD,KAEvD,OAAQC,IACFD,IAEJA,EAAUE,YAAW,KACnBF,EAAU,IAAI,GACbD,GAEHD,EAAGG,GAAO,CACX,yDAG+BE,CAACC,EAAeC,KAChD,GAAID,EAAQ,GAAKC,GAAO,EAAG,OAAO,EAElC,MAAMC,EAAWF,EAAQC,EAAO,IAEhC,OAAOE,OAAOC,MAAMF,GAAW,EAAIG,KAAKC,MAAMD,KAAKE,IAAIL,EAAS,KAAK"}
|
package/shared/utils/misc.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const createThrottledCallback=(e,
|
|
1
|
+
import{deepmergeCustom}from'deepmerge-ts';const deepmerge=deepmergeCustom({mergeArrays:!1});const createThrottledCallback=(e,r=100)=>{let t=null;return o=>{t||(t=setTimeout((()=>{t=null}),r),e(o))}};const getProgressPercent=(e,r)=>{if(e<0||r<=0)return 0;const t=e/r*100;return Number.isNaN(t)?0:Math.round(Math.min(t,100))};export{createThrottledCallback,deepmerge,getProgressPercent};
|
|
2
2
|
//# sourceMappingURL=misc.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.mjs","sources":["../../../../src/shared/utils/misc.ts"],"sourcesContent":["import type { Nullable } from 'shared/types'\n\nexport const createThrottledCallback = <T>(cb: (params: T) => void, throttleMS = 100): typeof cb => {\n let timerId: Nullable<ReturnType<typeof setTimeout>> = null\n\n return (params: T) => {\n if (timerId) return\n\n timerId = setTimeout(() => {\n timerId = null\n }, throttleMS)\n\n cb(params)\n }\n}\n\nexport const getProgressPercent = (value: number, max: number): number => {\n if (value < 0 || max <= 0) return 0\n\n const percent = (value / max) * 100\n\n return Number.isNaN(percent) ? 0 : Math.round(Math.min(percent, 100))\n}\n"],"names":["createThrottledCallback","cb","throttleMS","timerId","params","setTimeout","getProgressPercent","value","max","percent","Number","isNaN","Math","round","min"],"mappings":"
|
|
1
|
+
{"version":3,"file":"misc.mjs","sources":["../../../../src/shared/utils/misc.ts"],"sourcesContent":["import { deepmergeCustom } from 'deepmerge-ts'\nimport type { Nullable } from 'shared/types'\n\nexport const deepmerge = deepmergeCustom({\n mergeArrays: false,\n})\n\nexport const createThrottledCallback = <T>(cb: (params: T) => void, throttleMS = 100): typeof cb => {\n let timerId: Nullable<ReturnType<typeof setTimeout>> = null\n\n return (params: T) => {\n if (timerId) return\n\n timerId = setTimeout(() => {\n timerId = null\n }, throttleMS)\n\n cb(params)\n }\n}\n\nexport const getProgressPercent = (value: number, max: number): number => {\n if (value < 0 || max <= 0) return 0\n\n const percent = (value / max) * 100\n\n return Number.isNaN(percent) ? 0 : Math.round(Math.min(percent, 100))\n}\n"],"names":["deepmerge","deepmergeCustom","mergeArrays","createThrottledCallback","cb","throttleMS","timerId","params","setTimeout","getProgressPercent","value","max","percent","Number","isNaN","Math","round","min"],"mappings":"0CAGaA,MAAAA,UAAYC,gBAAgB,CACvCC,aAAa,IAGR,MAAMC,wBAA0BA,CAAIC,EAAyBC,EAAa,OAC/E,IAAIC,EAAmD,KAEvD,OAAQC,IACFD,IAEJA,EAAUE,YAAW,KACnBF,EAAU,IAAI,GACbD,GAEHD,EAAGG,GAAO,CACX,QAGUE,mBAAqBA,CAACC,EAAeC,KAChD,GAAID,EAAQ,GAAKC,GAAO,EAAG,OAAO,EAElC,MAAMC,EAAWF,EAAQC,EAAO,IAEhC,OAAOE,OAAOC,MAAMF,GAAW,EAAIG,KAAKC,MAAMD,KAAKE,IAAIL,EAAS,KAAK"}
|
package/theme/theme-provider.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var React=require('react');var styled=require('styled-components');var
|
|
1
|
+
'use strict';var React=require('react');var styled=require('styled-components');var misc=require('../shared/utils/misc.js');var globalStyled=require('./global-styled.js');var themes=require('./themes.js');var jsxRuntime=require('react/jsx-runtime');exports.ThemeProvider=e=>{const r=React.useCallback(((r=themes.defaultTheme)=>{const t=e.theme;return typeof t=='function'?t(r):typeof t!='object'||Array.isArray(t)||t===null?r:misc.deepmerge(r,t)}),[e.theme]);return jsxRuntime.jsxs(styled.ThemeProvider,{theme:r,children:[jsxRuntime.jsx(globalStyled.UiGlobalStyles,{}),e.children]})};
|
|
2
2
|
//# sourceMappingURL=theme-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.js","sources":["../../../src/theme/theme-provider.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport { useCallback } from 'react'\nimport { DefaultTheme, ThemeProvider as StyledThemeProvider } from 'styled-components'\nimport {
|
|
1
|
+
{"version":3,"file":"theme-provider.js","sources":["../../../src/theme/theme-provider.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport { useCallback } from 'react'\nimport { DefaultTheme, ThemeProvider as StyledThemeProvider } from 'styled-components'\nimport { deepmerge } from 'shared/utils/misc'\nimport { UiGlobalStyles } from './global-styled'\nimport { defaultTheme } from './themes'\n\ninterface ThemeProviderProps {\n theme: Partial<DefaultTheme> | ((topLevelTheme: DefaultTheme) => DefaultTheme)\n children: React.ReactNode\n}\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n const mergeTheme = useCallback(\n (topLevelTheme: DefaultTheme = defaultTheme): DefaultTheme => {\n const mergingTheme = props.theme\n\n if (typeof mergingTheme === 'function') {\n return mergingTheme(topLevelTheme)\n }\n\n if (typeof mergingTheme === 'object' && !Array.isArray(mergingTheme) && mergingTheme !== null) {\n return deepmerge(topLevelTheme, mergingTheme) as DefaultTheme\n }\n\n return topLevelTheme\n },\n [props.theme]\n )\n\n return (\n <StyledThemeProvider theme={mergeTheme}>\n <UiGlobalStyles />\n {props.children}\n </StyledThemeProvider>\n )\n}\n"],"names":["props","mergeTheme","useCallback","topLevelTheme","defaultTheme","mergingTheme","theme","Array","isArray","deepmerge","_jsxs","StyledThemeProvider","children","_jsx","UiGlobalStyles"],"mappings":"+QAY8BA,IAC5B,MAAMC,EAAaC,MAAAA,aACjB,CAACC,EAA8BC,OAAAA,gBAC7B,MAAMC,EAAeL,EAAMM,MAE3B,cAAWD,GAAiB,WACnBA,EAAaF,UAGXE,GAAiB,UAAaE,MAAMC,QAAQH,IAAiBA,IAAiB,KAIlFF,EAHEM,KAASA,UAACN,EAAeE,EAGd,GAEtB,CAACL,EAAMM,QAGT,OACEI,WAAAA,KAACC,OAAAA,cAAmB,CAACL,MAAOL,EAAWW,SAAA,CACrCC,WAAAA,IAACC,aAAAA,mBACAd,EAAMY,WAGb"}
|
package/theme/theme-provider.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback}from'react';import{ThemeProvider as ThemeProvider$1}from'styled-components';import{
|
|
1
|
+
import{useCallback}from'react';import{ThemeProvider as ThemeProvider$1}from'styled-components';import{deepmerge}from'../shared/utils/misc.mjs';import{UiGlobalStyles}from'./global-styled.mjs';import{defaultTheme}from'./themes.mjs';import{jsxs,jsx}from'react/jsx-runtime';function ThemeProvider(e){const r=useCallback(((r=defaultTheme)=>{const m=e.theme;return typeof m=='function'?m(r):typeof m!='object'||Array.isArray(m)||m===null?r:deepmerge(r,m)}),[e.theme]);return jsxs(ThemeProvider$1,{theme:r,children:[jsx(UiGlobalStyles,{}),e.children]})}export{ThemeProvider};
|
|
2
2
|
//# sourceMappingURL=theme-provider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.mjs","sources":["../../../src/theme/theme-provider.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport { useCallback } from 'react'\nimport { DefaultTheme, ThemeProvider as StyledThemeProvider } from 'styled-components'\nimport {
|
|
1
|
+
{"version":3,"file":"theme-provider.mjs","sources":["../../../src/theme/theme-provider.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport { useCallback } from 'react'\nimport { DefaultTheme, ThemeProvider as StyledThemeProvider } from 'styled-components'\nimport { deepmerge } from 'shared/utils/misc'\nimport { UiGlobalStyles } from './global-styled'\nimport { defaultTheme } from './themes'\n\ninterface ThemeProviderProps {\n theme: Partial<DefaultTheme> | ((topLevelTheme: DefaultTheme) => DefaultTheme)\n children: React.ReactNode\n}\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n const mergeTheme = useCallback(\n (topLevelTheme: DefaultTheme = defaultTheme): DefaultTheme => {\n const mergingTheme = props.theme\n\n if (typeof mergingTheme === 'function') {\n return mergingTheme(topLevelTheme)\n }\n\n if (typeof mergingTheme === 'object' && !Array.isArray(mergingTheme) && mergingTheme !== null) {\n return deepmerge(topLevelTheme, mergingTheme) as DefaultTheme\n }\n\n return topLevelTheme\n },\n [props.theme]\n )\n\n return (\n <StyledThemeProvider theme={mergeTheme}>\n <UiGlobalStyles />\n {props.children}\n </StyledThemeProvider>\n )\n}\n"],"names":["ThemeProvider","props","mergeTheme","useCallback","topLevelTheme","defaultTheme","mergingTheme","theme","Array","isArray","deepmerge","_jsxs","StyledThemeProvider","children","_jsx","UiGlobalStyles"],"mappings":"8QAYO,SAASA,cAAcC,GAC5B,MAAMC,EAAaC,aACjB,CAACC,EAA8BC,gBAC7B,MAAMC,EAAeL,EAAMM,MAE3B,cAAWD,GAAiB,WACnBA,EAAaF,UAGXE,GAAiB,UAAaE,MAAMC,QAAQH,IAAiBA,IAAiB,KAIlFF,EAHEM,UAAUN,EAAeE,EAGd,GAEtB,CAACL,EAAMM,QAGT,OACEI,KAACC,gBAAmB,CAACL,MAAOL,EAAWW,SAAA,CACrCC,IAACC,mBACAd,EAAMY,WAGb"}
|