@e1011/es-kit 1.1.85 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/esm/index.css +333 -333
- package/dist/hooks/esm/src/core/hooks/index.js +1 -1
- package/dist/hooks/esm/src/core/hooks/useThemePreference.js +1 -1
- package/dist/hooks/esm/src/core/hooks/useThemePreference.js.map +1 -1
- package/dist/hooks/esm/src/core/utils/helpers/ui.js +1 -1
- package/dist/hooks/esm/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/hooks/index.css +333 -333
- package/dist/hooks/src/core/hooks/index.js +1 -1
- package/dist/hooks/src/core/hooks/useThemePreference.js +1 -1
- package/dist/hooks/src/core/hooks/useThemePreference.js.map +1 -1
- package/dist/hooks/src/core/utils/helpers/ui.js +1 -1
- package/dist/hooks/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/lib/cjs/src/core/hooks/useThemePreference.js +1 -1
- package/dist/lib/cjs/src/core/hooks/useThemePreference.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/atoms/icons.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/atoms/icons.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/atoms/text/Text.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/atoms/text/Text.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
- package/dist/lib/cjs/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/ui.js +1 -1
- package/dist/lib/cjs/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/lib/cjs/src/index.js +1 -1
- package/dist/lib/esm/src/core/hooks/useThemePreference.js +1 -1
- package/dist/lib/esm/src/core/hooks/useThemePreference.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/atoms/icons.js +1 -1
- package/dist/lib/esm/src/core/ui/components/atoms/icons.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/atoms/text/Text.js +1 -1
- package/dist/lib/esm/src/core/ui/components/atoms/text/Text.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
- package/dist/lib/esm/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
- package/dist/lib/esm/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
- package/dist/lib/esm/src/core/utils/helpers/ui.js +1 -1
- package/dist/lib/esm/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/lib/esm/src/index.js +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/hooks/useThemePreference.d.ts +0 -41
- package/dist/types/src/core/hooks/useThemePreference.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/icons.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/atoms/text/Text.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/error/ErrorBoundary.d.ts +2 -2
- package/dist/types/src/core/ui/components/error/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/molecules/popover/PopoverLite.d.ts.map +1 -1
- package/dist/types/src/core/utils/helpers/ui.d.ts +40 -0
- package/dist/types/src/core/utils/helpers/ui.d.ts.map +1 -1
- package/dist/ui/esm/src/core/ui/components/atoms/icons.js +1 -1
- package/dist/ui/esm/src/core/ui/components/atoms/icons.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/atoms/text/Text.js +1 -1
- package/dist/ui/esm/src/core/ui/components/atoms/text/Text.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
- package/dist/ui/esm/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
- package/dist/ui/esm/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
- package/dist/ui/esm/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/ui/src/core/ui/components/atoms/icons.js +1 -1
- package/dist/ui/src/core/ui/components/atoms/icons.js.map +1 -1
- package/dist/ui/src/core/ui/components/atoms/text/Text.js +1 -1
- package/dist/ui/src/core/ui/components/atoms/text/Text.js.map +1 -1
- package/dist/ui/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
- package/dist/ui/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
- package/dist/ui/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
- package/dist/ui/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/utils/esm/index.css +333 -333
- package/dist/utils/esm/src/core/utils/helpers/ui.js +1 -1
- package/dist/utils/esm/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/utils/esm/src/core/utils/index.js +1 -1
- package/dist/utils/index.css +333 -333
- package/dist/utils/src/core/utils/helpers/ui.js +1 -1
- package/dist/utils/src/core/utils/helpers/ui.js.map +1 -1
- package/dist/utils/src/core/utils/index.js +1 -1
- package/package.json +4 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},React.createElement("path",{d:"M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z"})),c=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},React.createElement("path",{d:"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z"}));export{e as closeIconJSX,c as infoIconJSX};
|
|
2
2
|
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sources":["../../../../../../../../src/core/ui/components/atoms/icons.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"icons.js","sources":["../../../../../../../../src/core/ui/components/atoms/icons.tsx"],"sourcesContent":["\nexport const closeIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z' /></svg>\n)\nexport const infoIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z' /></svg>\n\n)\n\n\nexport const appStoreIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M255.9 120.9l9.1-15.7c5.6-9.8 18.1-13.1 27.9-7.5 9.8 5.6 13.1 18.1 7.5 27.9l-87.5 151.5h63.3c20.5 0 32 24.1 23.1 40.8H113.8c-11.3 0-20.4-9.1-20.4-20.4 0-11.3 9.1-20.4 20.4-20.4h52l66.6-115.4-20.8-36.1c-5.6-9.8-2.3-22.2 7.5-27.9 9.8-5.6 22.2-2.3 27.9 7.5l8.9 15.7zm-78.7 218l-19.6 34c-5.6 9.8-18.1 13.1-27.9 7.5-9.8-5.6-13.1-18.1-7.5-27.9l14.6-25.2c16.4-5.1 29.8-1.2 40.4 11.6zm168.9-61.7h53.1c11.3 0 20.4 9.1 20.4 20.4 0 11.3-9.1 20.4-20.4 20.4h-29.5l19.9 34.5c5.6 9.8 2.3 22.2-7.5 27.9-9.8 5.6-22.2 2.3-27.9-7.5-33.5-58.1-58.7-101.6-75.4-130.6-17.1-29.5-4.9-59.1 7.2-69.1 13.4 23 33.4 57.7 60.1 104zM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z' /></svg>\n)\n\n\nexport const batteryEmptyIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'><path d='M544 192V160c0-35.35-28.65-64-64-64H64C28.65 96 0 124.7 0 160v192c0 35.35 28.65 64 64 64h416c35.35 0 64-28.65 64-64v-32c17.67 0 32-14.33 32-32V224C576 206.3 561.7 192 544 192zM480 352H64V160h416V352z' /></svg>\n)\n\n\nexport const elementorIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M425.6 32H22.4C10 32 0 42 0 54.4v403.2C0 470 10 480 22.4 480h403.2c12.4 0 22.4-10 22.4-22.4V54.4C448 42 438 32 425.6 32M164.3 355.5h-39.8v-199h39.8v199zm159.3 0H204.1v-39.8h119.5v39.8zm0-79.6H204.1v-39.8h119.5v39.8zm0-79.7H204.1v-39.8h119.5v39.8z' /></svg>\n)\n\nexport const squareCheckIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M384 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h320c35.35 0 64-28.65 64-64V96C448 60.65 419.3 32 384 32zM400 416c0 8.836-7.164 16-16 16H64c-8.836 0-16-7.164-16-16V96c0-8.838 7.164-16 16-16h320c8.836 0 16 7.162 16 16V416zM303 175L192 286.1L144.1 239c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l64 64C179.7 341.7 185.8 344 192 344s12.28-2.344 16.97-7.031l128-128c9.375-9.375 9.375-24.56 0-33.94S312.4 165.7 303 175z' /></svg>\n)\n\nexport const pencilIcon = (\n <svg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path d='M8.91878 3.38356L6.59333 1.08219L7.35936 0.315069C7.56911 0.105023 7.82682 0 8.13251 0C8.43782 0 8.69536 0.105023 8.9051 0.315069L9.67113 1.08219C9.88088 1.29224 9.99031 1.54575 9.99943 1.84274C10.0086 2.13936 9.90824 2.39269 9.69849 2.60274L8.91878 3.38356ZM8.12539 4.19178L2.32545 10H0V7.67123L5.79994 1.86301L8.12539 4.19178Z' fill='#E2E369' />\n </svg>\n\n)\n"],"names":["closeIconJSX","React","createElement","xmlns","viewBox","d","infoIconJSX"],"mappings":"AACaA,MAAAA,EACXC,MAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,MAAAC,cAAA,OAAA,CAAMG,EAAE,ygBAE3DC,EACXL,MAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,MAAAC,cAAA,OAAA,CAAMG,EAAE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{objectWithoutProperties as t,objectSpread2 as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import r,
|
|
1
|
+
import{objectWithoutProperties as t,objectSpread2 as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import{memo as r,useMemo as o,createElement as a}from"react";import{useParseProps as s}from"../../../../hooks/useParseProps.js";import{composeId as l}from"../../../../utils/helpers/text.js";const i=["element","children","href","target","className","id","onClick","text"],n=r((r=>{let{element:n="span",children:c,href:d,target:p,className:m="",id:u,onClick:h,text:f}=r,x=t(r,i);const{dataProps:P,restProps:b}=s(x),g=f||(null==c?void 0:c.toString()),j=o((()=>h?{onClick:h,onKeyDown:h,role:"button",tabIndex:-1}:{}),[h]);return a(n,e(e(e({id:"".concat(u||g&&l(g)),href:d,text:f,target:p,className:m},j),{},{style:b},P),{},{"data-testid":"".concat(P.dataTestId||P["data-testid"]||u||g&&l(g))}),c)}));n.displayName="Text";export{n as Text};
|
|
2
2
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Text.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Text.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Text.tsx"],"sourcesContent":["import { createElement, memo, FC, useMemo } from 'react'\n\nimport { composeId } from '../../../../utils'\nimport { useParseProps } from '../../../../hooks'\n\nimport { ITextProps, TextProps } from './text.types'\n\n\nexport const Text: FC<TextProps> = memo<ITextProps>((\n { element = 'span', children, href, target, className = '', id, onClick, text, ...rest }: ITextProps,\n) => {\n const { dataProps, restProps } = useParseProps(rest)\n const textFromChildren: string | undefined = text || children?.toString()\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return createElement<TextProps>(\n element,\n {\n id: `${id || (textFromChildren && composeId(textFromChildren))}`,\n href,\n text,\n target,\n className,\n ...onClickProps,\n style: restProps,\n ...dataProps,\n 'data-testid':\n `${dataProps.dataTestId || dataProps['data-testid'] || id || (textFromChildren && composeId(textFromChildren))}`,\n },\n children,\n )\n})\n\nText.displayName = 'Text'\n"],"names":["Text","memo","_ref","element","children","href","target","className","id","onClick","text","rest","_objectWithoutProperties","_excluded","dataProps","restProps","useParseProps","textFromChildren","toString","onClickProps","useMemo","onKeyDown","role","tabIndex","createElement","_objectSpread","concat","composeId","style","dataTestId","displayName"],"mappings":"oYAQaA,EAAsBC,GAAiBC,IAE/C,IADHC,QAAEA,EAAU,OAAMC,SAAEA,EAAQC,KAAEA,EAAIC,OAAEA,EAAMC,UAAEA,EAAY,GAAEC,GAAEA,EAAEC,QAAEA,EAAOC,KAAEA,GAA2BR,EAAlBS,EAAIC,EAAAV,EAAAW,GAEtF,MAAMC,UAAEA,EAASC,UAAEA,GAAcC,EAAcL,GACzCM,EAAuCP,IAAQN,aAAQ,EAARA,EAAUc,YAEzDC,EAAeC,GAAQ,IAAOX,EAAW,CAC7CA,UACAY,UAAWZ,EACXa,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACd,IAEX,OAAOe,EACLrB,EAAOsB,EAAAA,EAAAA,EAAA,CAELjB,GAAE,GAAAkB,OAAKlB,GAAOS,GAAoBU,EAAUV,IAC5CZ,OACAK,OACAJ,SACAC,aACGY,GAAY,GAAA,CACfS,MAAOb,GACJD,GAAS,GAAA,CACZ,iBAAaY,OACVZ,EAAUe,YAAcf,EAAU,gBAAkBN,GAAOS,GAAoBU,EAAUV,MAE9Fb,EACD,IAGHJ,EAAK8B,YAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sources":["../../../../../../../../src/core/ui/components/error/ErrorBoundary.tsx"],"sourcesContent":["import { FC, memo, PureComponent, ReactNode } from 'react'\n\nimport { IconBase } from '../icon'\nimport { LayoutBox } from '../container/layoutBox/LayoutBox'\n\nimport classes from './errorBoundary.module.scss'\nimport { DefaultErrorComponentProps, ErrorBoundaryProps } from './errorBoundary.types'\n\n\ninterface State {\n error?: Error\n errorInfo?: unknown\n hasError: boolean\n}\n\n\nexport const DefaultErrorComponent: FC<DefaultErrorComponentProps>\n= memo(({ title, text }: DefaultErrorComponentProps) => (\n <LayoutBox className={classes.errorBoundary} direction='column' flexWrap='wrap' gap='2rem' padding='1rem'>\n {title && <h1>{title}</h1>}\n <LayoutBox align='center' justify='space-between' gap='1rem'>\n <IconBase\n className={classes.StyledIcon}\n color='#FF0000'\n width='3rem'\n height='3rem'\n >\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>\n <path d='M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z' />\n </svg>\n </IconBase>\n {text && (\n <LayoutBox flexShrink='0' width='90%'>\n {text}\n </LayoutBox>\n )}\n </LayoutBox>\n </LayoutBox>\n))\nDefaultErrorComponent.displayName = 'DefaultErrorComponent'\n\nexport class ErrorBoundary extends PureComponent<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props)\n this.state = { hasError: false }\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error }\n }\n\n componentDidCatch(error: Error, errorInfo:
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sources":["../../../../../../../../src/core/ui/components/error/ErrorBoundary.tsx"],"sourcesContent":["import { ErrorInfo, FC, memo, PureComponent, ReactNode } from 'react'\n\nimport { IconBase } from '../icon'\nimport { LayoutBox } from '../container/layoutBox/LayoutBox'\n\nimport classes from './errorBoundary.module.scss'\nimport { DefaultErrorComponentProps, ErrorBoundaryProps } from './errorBoundary.types'\n\n\ninterface State {\n error?: Error\n errorInfo?: unknown\n hasError: boolean\n}\n\n\nexport const DefaultErrorComponent: FC<DefaultErrorComponentProps>\n= memo(({ title, text }: DefaultErrorComponentProps) => (\n <LayoutBox className={classes.errorBoundary} direction='column' flexWrap='wrap' gap='2rem' padding='1rem'>\n {title && <h1>{title}</h1>}\n <LayoutBox align='center' justify='space-between' gap='1rem'>\n <IconBase\n className={classes.StyledIcon}\n color='#FF0000'\n width='3rem'\n height='3rem'\n >\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>\n <path d='M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z' />\n </svg>\n </IconBase>\n {text && (\n <LayoutBox flexShrink='0' width='90%'>\n {text}\n </LayoutBox>\n )}\n </LayoutBox>\n </LayoutBox>\n))\nDefaultErrorComponent.displayName = 'DefaultErrorComponent'\n\nexport class ErrorBoundary extends PureComponent<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props)\n this.state = { hasError: false }\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error }\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n // eslint-disable-next-line no-console\n !this.props.muted && error && console.error(error)\n // eslint-disable-next-line no-console\n !this.props.muted && errorInfo && console.error(errorInfo)\n\n this.props?.onError?.({ error, errorInfo })\n\n !this.props.muted && this.setState({ hasError: true, error, errorInfo })\n }\n\n render(): ReactNode {\n const { ErrorComponent = DefaultErrorComponent, title, text, muted } = this.props\n const { hasError, error, errorInfo } = this.state\n\n if (hasError && !muted) {\n return (\n <ErrorComponent\n title={title || error?.toString() || 'Error'}\n text={text || `${JSON.stringify(errorInfo, null, 2)}`}\n />\n )\n }\n\n if (hasError && muted) {\n return null\n }\n\n return this.props.children\n }\n}\n"],"names":["DefaultErrorComponent","memo","_ref","title","text","React","createElement","LayoutBox","className","classes","errorBoundary","direction","flexWrap","gap","padding","align","justify","IconBase","StyledIcon","color","width","height","xmlns","viewBox","d","flexShrink","displayName","ErrorBoundary","PureComponent","constructor","props","super","this","state","hasError","getDerivedStateFromError","error","componentDidCatch","errorInfo","_this$props","_this$props$onError","muted","onError","call","setState","render","ErrorComponent","toString","concat","JSON","stringify","children"],"mappings":"6MAgBaA,MAAAA,EACXC,GAAKC,IAAA,IAACC,MAAEA,EAAKC,KAAEA,GAAkCF,EAAA,OACjDG,MAAAC,cAACC,EAAS,CAACC,UAAWC,EAAQC,cAAeC,UAAU,SAASC,SAAS,OAAOC,IAAI,OAAOC,QAAQ,QAChGX,GAASE,MAAAC,cAAA,KAAA,KAAKH,GACfE,MAAAC,cAACC,EAAS,CAACQ,MAAM,SAASC,QAAQ,gBAAgBH,IAAI,QACpDR,MAAAC,cAACW,EAAQ,CACPT,UAAWC,EAAQS,WACnBC,MAAM,UACNC,MAAM,OACNC,OAAO,QAEPhB,MAAAC,cAAA,MAAA,CAAKgB,MAAM,6BAA6BC,QAAQ,eAC9ClB,MAAAC,cAAA,OAAA,CAAMkB,EAAE,6WAGXpB,GACCC,MAAAC,cAACC,EAAS,CAACkB,WAAW,IAAIL,MAAM,OAC7BhB,IAIG,IAEdJ,EAAsB0B,YAAc,wBAE7B,MAAMC,UAAsBC,EACjCC,WAAAA,CAAYC,GACVC,MAAMD,GACNE,KAAKC,MAAQ,CAAEC,UAAU,EAC3B,CAEA,+BAAOC,CAAyBC,GAC9B,MAAO,CAAEF,UAAU,EAAME,QAC3B,CAEAC,iBAAAA,CAAkBD,EAAcE,GAA4B,IAAAC,EAAAC,EAEzDR,KAAKF,MAAMW,MAEXT,KAAKF,MAAMW,cAEZF,OAAKT,aAAK,IAAAS,GAAS,QAATC,EAAVD,EAAYG,eAAZF,IAAmBA,GAAnBA,EAAAG,KAAAJ,EAAsB,CAAEH,QAAOE,eAE9BN,KAAKF,MAAMW,OAAST,KAAKY,SAAS,CAAEV,UAAU,EAAME,QAAOE,aAC9D,CAEAO,MAAAA,GACE,MAAMC,eAAEA,EAAiB9C,EAAqBG,MAAEA,EAAKC,KAAEA,EAAIqC,MAAEA,GAAUT,KAAKF,OACtEI,SAAEA,EAAQE,MAAEA,EAAKE,UAAEA,GAAcN,KAAKC,MAE5C,OAAIC,IAAaO,EAEbpC,MAAAC,cAACwC,EAAc,CACb3C,MAAOA,IAASiC,aAAAA,EAAAA,EAAOW,aAAc,QACrC3C,KAAMA,GAAI4C,GAAAA,OAAOC,KAAKC,UAAUZ,EAAW,KAAM,MAKnDJ,GAAYO,EACP,KAGFT,KAAKF,MAAMqB,QACpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{objectWithoutProperties as e,objectSpread2 as
|
|
1
|
+
import{objectWithoutProperties as e,objectSpread2 as t,extends as n}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import"../../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{memo as l,useState as o,useEffect as r,useRef as i,useMemo as a,useCallback as s,cloneElement as u}from"react";import{createPopper as d}from"../../../../../../node_modules/@popperjs/core/lib/popper.js";import{cancelableSetTimeout as c}from"../../../../utils/helpers/cancelableDelayedFunction.js";import{outsideClickHandler as p}from"../../../../hooks/useOutsideClick.js";import{KeyCode as m,EventName as v}from"../../../../constants/ui.constants.js";const f=["children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape"],h=["ContentComponent"],y={modal:{zIndex:1,position:"fixed",width:"100%",height:"100%",top:"0",left:"0",background:"rgba(0 0 0 / 70%)",pointerEvents:"all",userSelect:"none",visibility:"hidden"}},b=l((l=>{var b,w;let{children:C,components:E,placement:g="bottom",modifiers:O,data:k,hoverable:R,clickable:j,onOpen:L,onHide:M,isOpen:x,hideOnContentClick:H=!1,hideOnClickOutside:P=!0,hideTimeout:T=150,isPopup:A=!1,isModal:N=!1,modalOverlayClassName:W,modalContainer:_,targetRef:D,hideOnEscape:z}=l,B=e(l,f);const[F,I]=o(null),[K,S]=o(null!==(b=null==D?void 0:D.current)&&void 0!==b?b:null);r((()=>{null!=D&&D.current&&S(null==D?void 0:D.current)}),[D]);const q=E||{},{ContentComponent:G}=q,J=e(q,h),Q=i(null),U=a((()=>{const e=O?{modifiers:O,placement:g}:{placement:g};return e.modifiers=e.modifiers||[],A&&(e.modifiers=[...e.modifiers,{name:"centering",phase:"beforeWrite",enabled:!0,fn:e=>{let{state:n}=e;const l=null==_?void 0:_.getBoundingClientRect(),{width:o,height:r,left:i,top:a}=l||{width:window.innerWidth,height:window.innerHeight,left:0,top:0},s=i+(o-n.elements.popper.clientWidth)/2,u=a+(r-n.elements.popper.clientHeight)/2;return t(t({},n),{},{styles:t(t({},n.styles),{},{popper:t(t({},n.styles.popper),{},{left:"".concat(s,"px"),top:"".concat(u,"px"),transform:"none"})})})}}]),e}),[O,g,A,_]),V=i();r((()=>{var e;let n;return null==Q||null===(e=Q.current)||void 0===e||e.destroy(),K&&F&&(n=d(K,F,t({},U)),Q.current=n),()=>{var e;null===(e=n)||void 0===e||e.destroy(),Q.current=null}}),[F,K,U]);const X=i(),Y=i(-1),Z=s((()=>{var e,t;F&&delete F.dataset.show,N&&null!=se&&se.current&&(se.current.style.visibility="hidden",delete se.current.dataset.show),null==Q||null===(e=Q.current)||void 0===e||e.update(),null==M||M(),null==X||null===(t=X.current)||void 0===t||t.call(X),clearTimeout(Y.current)}),[F,N,M]),$=s((()=>{V.current&&V.current(),V.current=c(Z,T)}),[Z,T]),ee=s((()=>{V.current&&V.current()}),[]),te=s((e=>{var t;("true"===(null==F||null===(t=F.dataset)||void 0===t?void 0:t.show)&&P&&(null==F||!F.contains(e))||null!=F&&F.contains(e)&&H)&&Z()}),[Z,F,H,P]),ne=s((()=>{var e,t;F&&(F.dataset.show="true"),null==Q||null===(e=Q.current)||void 0===e||e.update(),N&&null!=se&&se.current&&(se.current.style.visibility="visible",se.current.dataset.show="true"),null==L||L(),null==X||null===(t=X.current)||void 0===t||t.call(X),clearTimeout(Y.current),Y.current=setTimeout((()=>{X.current=p(K,te)}),250)}),[F,te,N,L,K]),le=s((()=>{var e;"true"===(null==F||null===(e=F.dataset)||void 0===e?void 0:e.show)?Z():ne()}),[F,Z,ne]),oe=s((e=>{z&&e.keyCode===m.Escape&&Z()}),[z,Z]);r((()=>{var e,t;const n=null==K||null===(e=K.addEventListener)||void 0===e?void 0:e.bind(K),l=null==F||null===(t=F.addEventListener)||void 0===t?void 0:t.bind(F);return l&&n&&(R&&(n(v.MouseEnter,ne),l(v.MouseEnter,ee),n(v.MouseLeave,$),l(v.MouseLeave,Z)),j&&n(v.Click,le)),z&&document.addEventListener(v.KeyDown,oe),()=>{var e,t;const n=null==K||null===(e=K.removeEventListener)||void 0===e?void 0:e.bind(K),l=null==F||null===(t=F.removeEventListener)||void 0===t?void 0:t.bind(F);document.removeEventListener(v.KeyDown,oe),V.current&&V.current(),n&&(n(v.Click,le),n(v.MouseEnter,ne),n(v.MouseLeave,$)),l&&(l(v.MouseLeave,Z),l(v.MouseEnter,ee))}}),[K,F,j,R,ne,Z,le,$,ee,z,oe]),r((()=>(!0===x&&ne(),!1===x&&Z(),null==X?void 0:X.current)),[Z,x,ne]);const re="function"==typeof C,ie="function"!=typeof C&&!Array.isArray(C),ae="function"!=typeof C&&Array.isArray(C)&&2===C.filter((e=>!!e)).length,se=i(null);return r((()=>{N&&F&&(F.style.zIndex="2")}),[F,N]),React.createElement(React.Fragment,null,N&&React.createElement("span",{ref:se,style:y.modal,className:W}),!D&&re&&(null==C?void 0:C({forwardedRef:S,data:k})),!D&&ie&&React.createElement("span",{ref:S},C),!ae&&G&&React.createElement(G,n({placement:g,forwardedRef:I,ref:"function"!=typeof G?I:null,data:k,hide:Z,components:J},B)),!D&&ae&&React.createElement("span",{ref:S},C[0]),ae&&(null==C?void 0:C[1])&&"object"==typeof(null==C?void 0:C[1])&&u(C[1],t(t({},null==C||null===(w=C[1])||void 0===w?void 0:w.props),{},{placement:g,forwardedRef:I,ref:I,data:k,hide:Z,components:J},B)))}));b.displayName="Popover";export{b as Popover};
|
|
2
2
|
//# sourceMappingURL=PopoverLite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverLite.js","sources":["../../../../../../../../../src/core/ui/components/molecules/popover/PopoverLite.tsx"],"sourcesContent":["\nimport React, { FC, memo, useRef, useEffect, useState, useCallback, useMemo,\n CSSProperties, ReactNode, ReactElement } from 'react'\nimport { createPopper, Instance, ModifierArguments } from '@popperjs/core'\n\nimport { EventName, KeyCode } from '../../../../constants'\nimport { cancelableSetTimeout } from '../../../../utils'\nimport { outsideClickHandler } from '../../../../hooks'\n\nimport { PopoverProps } from './popover.types'\n\n\nconst styles: Record<string, Partial<CSSProperties>> = {\n modal: {\n zIndex: 1,\n position: 'fixed',\n width: '100%',\n height: '100%',\n top: '0',\n left: '0',\n background: 'rgba(0 0 0 / 70%)',\n pointerEvents: 'all',\n userSelect: 'none',\n visibility: 'hidden',\n },\n}\n\nexport const Popover: FC<PopoverProps> = memo<PopoverProps>(\n ({\n children,\n components,\n placement = 'bottom',\n modifiers,\n data,\n hoverable,\n clickable,\n onOpen,\n onHide,\n isOpen,\n hideOnContentClick = false,\n hideOnClickOutside = true,\n hideTimeout = 150,\n isPopup = false,\n isModal = false,\n modalOverlayClassName,\n modalContainer,\n targetRef,\n hideOnEscape,\n ...props\n }: PopoverProps) => {\n const [content, setContent] = useState<HTMLElement | null>(null)\n const [target, setTarget] = useState<HTMLElement | null>(targetRef?.current ?? null)\n\n useEffect(() => {\n if (targetRef?.current) {\n setTarget(targetRef?.current)\n }\n }, [targetRef])\n\n const { ContentComponent, ...contentComponents } = components || {}\n\n const popperInstanceRef = useRef<Instance | null>(null)\n\n const options = useMemo(() => {\n const options = (modifiers ? { modifiers, placement } : { placement })\n\n options.modifiers = options.modifiers || []\n\n if (isPopup) {\n options.modifiers = [\n ...options.modifiers,\n {\n name: 'centering',\n phase: 'beforeWrite',\n enabled: true,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n fn: ({ state }): Partial<ModifierArguments> => {\n const mcBoundRect = modalContainer?.getBoundingClientRect()\n\n const { width, height, left, top } = mcBoundRect || {\n width: window.innerWidth,\n height: window.innerHeight,\n left: 0,\n top: 0,\n }\n\n const xpos = left + (width - state.elements.popper.clientWidth) / 2\n const ypos = top + (height - state.elements.popper.clientHeight) / 2\n\n return {\n ...state,\n styles: {\n ...state.styles,\n popper: {\n ...state.styles.popper,\n left: `${xpos}px`,\n top: `${ypos}px`,\n transform: 'none',\n },\n },\n }\n },\n },\n ] as PopoverProps['modifiers']\n }\n\n return options\n }, [modifiers, placement, isPopup, modalContainer])\n\n // to save cancelable setTimout\n const pendingHideRef = useRef<(() => void)>()\n\n useEffect(() => {\n popperInstanceRef?.current?.destroy()\n let popperInstance: ReturnType<typeof createPopper>\n\n if (target && content) {\n popperInstance = createPopper(target, content, { ...options })\n\n popperInstanceRef.current = popperInstance\n }\n\n return (): void => {\n popperInstance?.destroy()\n popperInstanceRef.current = null\n }\n }, [content, target, options])\n\n\n const outsideClickUnsubscriber = useRef<() => void | null>()\n const outsideClickUnsubscriberTimeout = useRef<any>(-1)\n\n const hide = useCallback(() => {\n if (content) {\n delete content.dataset.show\n }\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'hidden'\n delete modalRef.current.dataset.show\n }\n\n popperInstanceRef?.current?.update()\n onHide?.()\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n }, [content, isModal, onHide])\n\n\n const delayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n pendingHideRef.current = cancelableSetTimeout(hide, hideTimeout)\n }, [hide, hideTimeout])\n\n const cancelDelayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n }, [])\n\n const handleOutsideClick = useCallback((eventTarget: HTMLElement | null) => {\n if ((content?.dataset?.show === 'true' && hideOnClickOutside && !content?.contains(eventTarget))\n || (content?.contains(eventTarget) && hideOnContentClick)) {\n hide()\n }\n }, [hide, content, hideOnContentClick, hideOnClickOutside])\n\n const open = useCallback(() => {\n if (content) {\n content.dataset.show = 'true'\n }\n\n popperInstanceRef?.current?.update()\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'visible'\n modalRef.current.dataset.show = 'true'\n }\n\n onOpen?.()\n\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n outsideClickUnsubscriberTimeout.current = setTimeout(() => {\n outsideClickUnsubscriber.current = outsideClickHandler(target, handleOutsideClick)\n }, 250)\n }, [content, handleOutsideClick, isModal, onOpen, target])\n\n const toggleOpen = useCallback(() => {\n content?.dataset?.show === 'true' ? hide() : open()\n }, [content, hide, open])\n\n const keydownHandler = useCallback((event: Event) => {\n if (hideOnEscape && (event as unknown as KeyboardEvent).keyCode === KeyCode.Escape) {\n hide()\n }\n }, [hideOnEscape, hide])\n\n useEffect(() => {\n if (!hoverable && !clickable) {\n console.error('Popover component should have at least one of props [\"hoverable\", \"clickable\"]')\n }\n\n const targetAddListener = target?.addEventListener?.bind(target)\n const contentAddListener = content?.addEventListener?.bind(content)\n\n if (contentAddListener && targetAddListener) {\n if (hoverable) {\n targetAddListener(EventName.MouseEnter, open)\n contentAddListener(EventName.MouseEnter, cancelDelayedHide)\n targetAddListener(EventName.MouseLeave, delayedHide)\n contentAddListener(EventName.MouseLeave, hide)\n }\n\n if (clickable) {\n targetAddListener(EventName.Click, toggleOpen)\n }\n }\n\n if (hideOnEscape) {\n document.addEventListener(EventName.KeyDown, keydownHandler)\n }\n\n return (): void => {\n const targetRemoveListener = target?.removeEventListener?.bind(target)\n const contentRemoveListener = content?.removeEventListener?.bind(content)\n\n document.removeEventListener(EventName.KeyDown, keydownHandler)\n\n pendingHideRef.current && pendingHideRef.current()\n\n if (targetRemoveListener) {\n targetRemoveListener(EventName.Click, toggleOpen)\n targetRemoveListener(EventName.MouseEnter, open)\n targetRemoveListener(EventName.MouseLeave, delayedHide)\n }\n if (contentRemoveListener) {\n contentRemoveListener(EventName.MouseLeave, hide)\n contentRemoveListener(EventName.MouseEnter, cancelDelayedHide)\n }\n }\n }, [target, content, clickable, hoverable,\n open, hide, toggleOpen, delayedHide, cancelDelayedHide, hideOnEscape, keydownHandler])\n\n // open, hide based on external isOpen\n useEffect(() => {\n if (isOpen === true) {\n open()\n }\n if (isOpen === false) {\n hide()\n }\n return outsideClickUnsubscriber?.current as () => void\n }, [hide, isOpen, open])\n\n const childrenIsFunction = typeof children === 'function'\n const childrenIsElement = typeof children !== 'function' && !Array.isArray(children)\n const childrenAreElements = typeof children !== 'function' && Array.isArray(children)\n && children.filter((child: ReactNode) => !!child).length === 2\n\n // modal\n const modalRef = useRef<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (isModal && content) {\n content.style.zIndex = '2'\n }\n }, [content, isModal])\n\n return (\n <>\n {isModal && <span ref={modalRef} style={styles.modal} className={modalOverlayClassName} />}\n {(!targetRef && childrenIsFunction) && children?.({ forwardedRef: setTarget, data })}\n {(!targetRef && childrenIsElement) && <span ref={setTarget}>{children}</span>}\n {!childrenAreElements && ContentComponent && (\n <ContentComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n placement={placement}\n forwardedRef={setContent}\n ref={typeof ContentComponent !== 'function' ? setContent : null}\n data={data}\n hide={hide}\n components={contentComponents as { [key: string]: FC | React.Component<any> }}\n {...props}\n />\n )}\n {(!targetRef && childrenAreElements) && <span ref={setTarget}>{children[0]}</span>}\n {(childrenAreElements && children?.[1] && typeof children?.[1] === 'object')\n && React.cloneElement(children[1] as ReactElement, {\n ...((children?.[1] as ReactElement)?.props),\n placement,\n forwardedRef: setContent,\n // ...(typeof children[1] !== 'function' ? { ref: setContent } : {}),\n ref: setContent,\n data,\n hide,\n components: contentComponents as { [key: string]: FC | React.Component<any> },\n ...props,\n })}\n </>\n )\n },\n)\n\nPopover.displayName = 'Popover'\n"],"names":["styles","modal","zIndex","position","width","height","top","left","background","pointerEvents","userSelect","visibility","Popover","memo","_ref","_targetRef$current","_children$","children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape","props","_objectWithoutProperties","_excluded","content","setContent","useState","target","setTarget","current","useEffect","_ref2","ContentComponent","contentComponents","_excluded2","popperInstanceRef","useRef","options","useMemo","name","phase","enabled","fn","_ref3","state","mcBoundRect","getBoundingClientRect","window","innerWidth","innerHeight","xpos","elements","popper","clientWidth","ypos","clientHeight","_objectSpread","concat","transform","pendingHideRef","_popperInstanceRef$cu","popperInstance","destroy","createPopper","_popperInstance","outsideClickUnsubscriber","outsideClickUnsubscriberTimeout","hide","useCallback","_popperInstanceRef$cu2","_outsideClickUnsubscr","dataset","show","modalRef","style","update","call","clearTimeout","delayedHide","cancelableSetTimeout","cancelDelayedHide","handleOutsideClick","eventTarget","_content$dataset","contains","open","_popperInstanceRef$cu3","_outsideClickUnsubscr2","setTimeout","outsideClickHandler","toggleOpen","_content$dataset2","keydownHandler","event","keyCode","KeyCode","Escape","_target$addEventListe","_content$addEventList","targetAddListener","addEventListener","bind","contentAddListener","EventName","MouseEnter","MouseLeave","Click","document","KeyDown","_target$removeEventLi","_content$removeEventL","targetRemoveListener","removeEventListener","contentRemoveListener","childrenIsFunction","childrenIsElement","Array","isArray","childrenAreElements","filter","child","length","React","createElement","Fragment","ref","className","forwardedRef","_extends","cloneElement","displayName"],"mappings":"86BAYMA,EAAiD,CACrDC,MAAO,CACLC,OAAQ,EACRC,SAAU,QACVC,MAAO,OACPC,OAAQ,OACRC,IAAK,IACLC,KAAM,IACNC,WAAY,oBACZC,cAAe,MACfC,WAAY,OACZC,WAAY,WAIHC,EAA4BC,GACvCC,IAqBoB,IAAAC,EAAAC,EAAA,IArBnBC,SACCA,EAAQC,WACRA,EAAUC,UACVA,EAAY,SAAQC,UACpBA,EAASC,KACTA,EAAIC,UACJA,EAASC,UACTA,EAASC,OACTA,EAAMC,OACNA,EAAMC,OACNA,EAAMC,mBACNA,GAAqB,EAAKC,mBAC1BA,GAAqB,EAAIC,YACzBA,EAAc,IAAGC,QACjBA,GAAU,EAAKC,QACfA,GAAU,EAAKC,sBACfA,EAAqBC,eACrBA,EAAcC,UACdA,EAASC,aACTA,GAEarB,EADVsB,EAAKC,EAAAvB,EAAAwB,GAER,MAAOC,EAASC,GAAcC,EAA6B,OACpDC,EAAQC,GAAaF,EAA+C,QAAvC1B,EAAqBmB,aAAS,EAATA,EAAWU,eAAO7B,IAAAA,EAAAA,EAAI,MAE/E8B,GAAU,KACJX,SAAAA,EAAWU,SACbD,EAAUT,eAAAA,EAAWU,QACvB,GACC,CAACV,IAEJ,MAAAY,EAAmD5B,GAAc,CAAE,GAA7D6B,iBAAEA,GAAwCD,EAAnBE,EAAiBX,EAAAS,EAAAG,GAExCC,EAAoBC,EAAwB,MAE5CC,EAAUC,GAAQ,KACtB,MAAMD,EAAWhC,EAAY,CAAEA,YAAWD,aAAc,CAAEA,aA2C1D,OAzCAiC,EAAQhC,UAAYgC,EAAQhC,WAAa,GAErCU,IACFsB,EAAQhC,UAAY,IACfgC,EAAQhC,UACX,CACEkC,KAAM,YACNC,MAAO,cACPC,SAAS,EAGTC,GAAIC,IAA2C,IAA1CC,MAAEA,GAAOD,EACZ,MAAME,EAAc3B,eA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KpG,EACLnB,OACA6D,OACAhE,WAAY8B,GACTZ,IAEJ,IAKTxB,EAAQqI,YAAc"}
|
|
1
|
+
{"version":3,"file":"PopoverLite.js","sources":["../../../../../../../../../src/core/ui/components/molecules/popover/PopoverLite.tsx"],"sourcesContent":["\nimport { FC, memo, useRef, useEffect, useState, useCallback, useMemo, cloneElement,\n CSSProperties, ReactNode, ReactElement, Component } from 'react'\nimport { createPopper, Instance, ModifierArguments } from '@popperjs/core'\n\nimport { EventName, KeyCode } from '../../../../constants'\nimport { cancelableSetTimeout } from '../../../../utils'\nimport { outsideClickHandler } from '../../../../hooks'\n\nimport { PopoverProps } from './popover.types'\n\n\nconst styles: Record<string, Partial<CSSProperties>> = {\n modal: {\n zIndex: 1,\n position: 'fixed',\n width: '100%',\n height: '100%',\n top: '0',\n left: '0',\n background: 'rgba(0 0 0 / 70%)',\n pointerEvents: 'all',\n userSelect: 'none',\n visibility: 'hidden',\n },\n}\n\nexport const Popover: FC<PopoverProps> = memo<PopoverProps>(\n ({\n children,\n components,\n placement = 'bottom',\n modifiers,\n data,\n hoverable,\n clickable,\n onOpen,\n onHide,\n isOpen,\n hideOnContentClick = false,\n hideOnClickOutside = true,\n hideTimeout = 150,\n isPopup = false,\n isModal = false,\n modalOverlayClassName,\n modalContainer,\n targetRef,\n hideOnEscape,\n ...props\n }: PopoverProps) => {\n const [content, setContent] = useState<HTMLElement | null>(null)\n const [target, setTarget] = useState<HTMLElement | null>(targetRef?.current ?? null)\n\n useEffect(() => {\n if (targetRef?.current) {\n setTarget(targetRef?.current)\n }\n }, [targetRef])\n\n const { ContentComponent, ...contentComponents } = components || {}\n\n const popperInstanceRef = useRef<Instance | null>(null)\n\n const options = useMemo(() => {\n const options = (modifiers ? { modifiers, placement } : { placement })\n\n options.modifiers = options.modifiers || []\n\n if (isPopup) {\n options.modifiers = [\n ...options.modifiers,\n {\n name: 'centering',\n phase: 'beforeWrite',\n enabled: true,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n fn: ({ state }): Partial<ModifierArguments> => {\n const mcBoundRect = modalContainer?.getBoundingClientRect()\n\n const { width, height, left, top } = mcBoundRect || {\n width: window.innerWidth,\n height: window.innerHeight,\n left: 0,\n top: 0,\n }\n\n const xpos = left + (width - state.elements.popper.clientWidth) / 2\n const ypos = top + (height - state.elements.popper.clientHeight) / 2\n\n return {\n ...state,\n styles: {\n ...state.styles,\n popper: {\n ...state.styles.popper,\n left: `${xpos}px`,\n top: `${ypos}px`,\n transform: 'none',\n },\n },\n }\n },\n },\n ] as PopoverProps['modifiers']\n }\n\n return options\n }, [modifiers, placement, isPopup, modalContainer])\n\n // to save cancelable setTimout\n const pendingHideRef = useRef<(() => void)>()\n\n useEffect(() => {\n popperInstanceRef?.current?.destroy()\n let popperInstance: ReturnType<typeof createPopper>\n\n if (target && content) {\n popperInstance = createPopper(target, content, { ...options })\n\n popperInstanceRef.current = popperInstance\n }\n\n return (): void => {\n popperInstance?.destroy()\n popperInstanceRef.current = null\n }\n }, [content, target, options])\n\n\n const outsideClickUnsubscriber = useRef<() => void | null>()\n const outsideClickUnsubscriberTimeout = useRef<any>(-1)\n\n const hide = useCallback(() => {\n if (content) {\n delete content.dataset.show\n }\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'hidden'\n delete modalRef.current.dataset.show\n }\n\n popperInstanceRef?.current?.update()\n onHide?.()\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n }, [content, isModal, onHide])\n\n\n const delayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n pendingHideRef.current = cancelableSetTimeout(hide, hideTimeout)\n }, [hide, hideTimeout])\n\n const cancelDelayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n }, [])\n\n const handleOutsideClick = useCallback((eventTarget: HTMLElement | null) => {\n if ((content?.dataset?.show === 'true' && hideOnClickOutside && !content?.contains(eventTarget))\n || (content?.contains(eventTarget) && hideOnContentClick)) {\n hide()\n }\n }, [hide, content, hideOnContentClick, hideOnClickOutside])\n\n const open = useCallback(() => {\n if (content) {\n content.dataset.show = 'true'\n }\n\n popperInstanceRef?.current?.update()\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'visible'\n modalRef.current.dataset.show = 'true'\n }\n\n onOpen?.()\n\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n outsideClickUnsubscriberTimeout.current = setTimeout(() => {\n outsideClickUnsubscriber.current = outsideClickHandler(target, handleOutsideClick)\n }, 250)\n }, [content, handleOutsideClick, isModal, onOpen, target])\n\n const toggleOpen = useCallback(() => {\n content?.dataset?.show === 'true' ? hide() : open()\n }, [content, hide, open])\n\n const keydownHandler = useCallback((event: Event) => {\n if (hideOnEscape && (event as unknown as KeyboardEvent).keyCode === KeyCode.Escape) {\n hide()\n }\n }, [hideOnEscape, hide])\n\n useEffect(() => {\n if (!hoverable && !clickable) {\n console.error('Popover component should have at least one of props [\"hoverable\", \"clickable\"]')\n }\n\n const targetAddListener = target?.addEventListener?.bind(target)\n const contentAddListener = content?.addEventListener?.bind(content)\n\n if (contentAddListener && targetAddListener) {\n if (hoverable) {\n targetAddListener(EventName.MouseEnter, open)\n contentAddListener(EventName.MouseEnter, cancelDelayedHide)\n targetAddListener(EventName.MouseLeave, delayedHide)\n contentAddListener(EventName.MouseLeave, hide)\n }\n\n if (clickable) {\n targetAddListener(EventName.Click, toggleOpen)\n }\n }\n\n if (hideOnEscape) {\n document.addEventListener(EventName.KeyDown, keydownHandler)\n }\n\n return (): void => {\n const targetRemoveListener = target?.removeEventListener?.bind(target)\n const contentRemoveListener = content?.removeEventListener?.bind(content)\n\n document.removeEventListener(EventName.KeyDown, keydownHandler)\n\n pendingHideRef.current && pendingHideRef.current()\n\n if (targetRemoveListener) {\n targetRemoveListener(EventName.Click, toggleOpen)\n targetRemoveListener(EventName.MouseEnter, open)\n targetRemoveListener(EventName.MouseLeave, delayedHide)\n }\n if (contentRemoveListener) {\n contentRemoveListener(EventName.MouseLeave, hide)\n contentRemoveListener(EventName.MouseEnter, cancelDelayedHide)\n }\n }\n }, [target, content, clickable, hoverable,\n open, hide, toggleOpen, delayedHide, cancelDelayedHide, hideOnEscape, keydownHandler])\n\n // open, hide based on external isOpen\n useEffect(() => {\n if (isOpen === true) {\n open()\n }\n if (isOpen === false) {\n hide()\n }\n return outsideClickUnsubscriber?.current as () => void\n }, [hide, isOpen, open])\n\n const childrenIsFunction = typeof children === 'function'\n const childrenIsElement = typeof children !== 'function' && !Array.isArray(children)\n const childrenAreElements = typeof children !== 'function' && Array.isArray(children)\n && children.filter((child: ReactNode) => !!child).length === 2\n\n // modal\n const modalRef = useRef<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (isModal && content) {\n content.style.zIndex = '2'\n }\n }, [content, isModal])\n\n return (\n <>\n {isModal && <span ref={modalRef} style={styles.modal} className={modalOverlayClassName} />}\n {(!targetRef && childrenIsFunction) && children?.({ forwardedRef: setTarget, data })}\n {(!targetRef && childrenIsElement) && <span ref={setTarget}>{children}</span>}\n {!childrenAreElements && ContentComponent && (\n <ContentComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n placement={placement}\n forwardedRef={setContent}\n ref={typeof ContentComponent !== 'function' ? setContent : null}\n data={data}\n hide={hide}\n components={contentComponents as { [key: string]: FC | Component<any> }}\n {...props}\n />\n )}\n {(!targetRef && childrenAreElements) && <span ref={setTarget}>{children[0]}</span>}\n {(childrenAreElements && children?.[1] && typeof children?.[1] === 'object')\n && cloneElement(children[1] as ReactElement, {\n ...((children?.[1] as ReactElement)?.props),\n placement,\n forwardedRef: setContent,\n // ...(typeof children[1] !== 'function' ? { ref: setContent } : {}),\n ref: setContent,\n data,\n hide,\n components: contentComponents as { [key: string]: FC | Component<any> },\n ...props,\n })}\n </>\n )\n },\n)\n\nPopover.displayName = 'Popover'\n"],"names":["styles","modal","zIndex","position","width","height","top","left","background","pointerEvents","userSelect","visibility","Popover","memo","_ref","_targetRef$current","_children$","children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape","props","_objectWithoutProperties","_excluded","content","setContent","useState","target","setTarget","current","useEffect","_ref2","ContentComponent","contentComponents","_excluded2","popperInstanceRef","useRef","options","useMemo","name","phase","enabled","fn","_ref3","state","mcBoundRect","getBoundingClientRect","window","innerWidth","innerHeight","xpos","elements","popper","clientWidth","ypos","clientHeight","_objectSpread","concat","transform","pendingHideRef","_popperInstanceRef$cu","popperInstance","destroy","createPopper","_popperInstance","outsideClickUnsubscriber","outsideClickUnsubscriberTimeout","hide","useCallback","_popperInstanceRef$cu2","_outsideClickUnsubscr","dataset","show","modalRef","style","update","call","clearTimeout","delayedHide","cancelableSetTimeout","cancelDelayedHide","handleOutsideClick","eventTarget","_content$dataset","contains","open","_popperInstanceRef$cu3","_outsideClickUnsubscr2","setTimeout","outsideClickHandler","toggleOpen","_content$dataset2","keydownHandler","event","keyCode","KeyCode","Escape","_target$addEventListe","_content$addEventList","targetAddListener","addEventListener","bind","contentAddListener","EventName","MouseEnter","MouseLeave","Click","document","KeyDown","_target$removeEventLi","_content$removeEventL","targetRemoveListener","removeEventListener","contentRemoveListener","childrenIsFunction","childrenIsElement","Array","isArray","childrenAreElements","filter","child","length","React","createElement","Fragment","ref","className","forwardedRef","_extends","cloneElement","displayName"],"mappings":"67BAYMA,EAAiD,CACrDC,MAAO,CACLC,OAAQ,EACRC,SAAU,QACVC,MAAO,OACPC,OAAQ,OACRC,IAAK,IACLC,KAAM,IACNC,WAAY,oBACZC,cAAe,MACfC,WAAY,OACZC,WAAY,WAIHC,EAA4BC,GACvCC,IAqBoB,IAAAC,EAAAC,EAAA,IArBnBC,SACCA,EAAQC,WACRA,EAAUC,UACVA,EAAY,SAAQC,UACpBA,EAASC,KACTA,EAAIC,UACJA,EAASC,UACTA,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N,GAAU,KACJd,GAAWQ,IACbA,EAAQkD,MAAMvF,OAAS,IACzB,GACC,CAACqC,EAASR,IAGX0G,MAAAC,cAAAD,MAAAE,SAAA,KACG5G,GAAW0G,MAAAC,cAAA,OAAA,CAAME,IAAKpD,GAAUC,MAAOzF,EAAOC,MAAO4I,UAAW7G,KAC9DE,GAAa+F,KAAuBhH,aAAAA,EAAAA,EAAW,CAAE6H,aAAcnG,EAAWtB,WAC1Ea,GAAagG,IAAsBO,MAAAC,cAAA,OAAA,CAAME,IAAKjG,GAAY1B,IAC3DoH,IAAuBtF,GACzB0F,MAAAC,cAAC3F,EAECgG,EAAA,CACA5H,UAAWA,EACX2H,aAActG,EACdoG,IAAiC,mBAArB7F,EAAkCP,EAAa,KAC3DnB,KAAMA,EACN6D,KAAMA,EACNhE,WAAY8B,GACRZ,KAGHF,GAAamG,IAAwBI,MAAAC,cAAA,OAAA,CAAME,IAAKjG,GAAY1B,EAAS,IACtEoH,KAAuBpH,aAAQ,EAARA,EAAW,KAA+B,iBAAlBA,aAAAA,EAAAA,EAAW,KACzD+H,EAAa/H,EAAS,GAAEsD,EAAAA,EAAA,GACpBtD,SAAa,QAALD,EAARC,EAAW,UAAE,IAAAD,OAAA,EAAdA,EAAiCoB,OAAK,CAAA,EAAA,CAC1CjB,YACA2H,aAActG,EAEdoG,IAAKpG,EACLnB,OACA6D,OACAhE,WAAY8B,GACTZ,IAEJ,IAKTxB,EAAQqI,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const
|
|
1
|
+
import"../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const e=(e,t)=>t instanceof Map?{dataType:"Map",value:Array.from(t.entries())}:t,t=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return t.filter((e=>"string"==typeof e&&null!=e)).filter(Boolean).join(" ")},o=e=>{const t={},o={};return Object.entries(e).forEach((e=>{let[n,l]=e;"data-"===n.substr(0,5)||"data"===n.substr(0,4)?t[n]=l:o[n]=l})),{dataProps:t,restProps:o}},n=function(e){var t;let o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;var a;if(n.tokens=n.tokens||{},null!=l)return n.tokens[e]=l,"".concat(e).concat(null==n||null===(a=n.tokens)||void 0===a?void 0:a[e]);const c=void 0===(null==n?void 0:n.tokens[e])||null===(null==n?void 0:n.tokens[e]);return n.tokens[e]=n.tokens[e]||0,c?"".concat(e,0):o?(n.tokens[e]+=1,"".concat(e).concat(null==n||null===(r=n.tokens)||void 0===r?void 0:r[e])):"".concat(e).concat(null==n||null===(t=n.tokens)||void 0===t?void 0:t[e]);var r},l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_top",o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l.aElement=l.aElement||document.createElement("a");const{aElement:n}=l;return n.setAttribute("href",e),n.setAttribute("target",t),n.dataset.date="".concat(Date.now()),n.click(),o&&(n.remove(),l.aElement=null),n},a=e=>{var t,o,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(o=e.stopPropagation)||void 0===o||o.call(e),null==e||null===(n=e.stopImmediatePropagation)||void 0===n||n.call(e)};let c={dark:"theme-dark",light:"theme-light"};const r=()=>c,s=e=>{c=e},d=function(e,t){let o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=e?c.light:c.dark,l=e?c.dark:c.light;t&&(t.classList.remove(n),t.classList.remove(l),t.classList.add(l)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(n)).forEach((e=>{e.classList.add(".".concat(l)),e.classList.remove(".".concat(n))})),o&&(document.querySelectorAll(".shadow-div").forEach((e=>{var t,o;null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(n)))||void 0===t||t.classList.add(l),null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(n)))||void 0===o||o.classList.remove(n)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var t,o,a;null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(n)))||void 0===t||t.classList.add(l),null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(n)))||void 0===o||o.classList.remove(n);const c=null===(a=e.shadowRoot)||void 0===a?void 0:a.childNodes[0];c&&(c.classList.add(l),c.classList.remove(n))}))))},i=(e,t)=>{let o=e||!1;"undefined"!=typeof document&&void 0===e&&(o=document.body.classList.contains(c.dark)),d(o,t||document.body)},u="change",v=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const o=o=>{const n=e();null==d||d(o,n),null==t||t(o)},n=e=>{o(e.matches)},l=e=>{o(!e.matches)},a=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(u,n),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(u,l)}catch(e){}return o(null==a?void 0:a.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(u,n),window.matchMedia("(prefers-color-scheme: light)").addEventListener(u,l),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(u,n),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(u,l)}};export{l as anchorClick,t as classNames,n as generateId,r as getBaseThemes,e as mapSerReplacer,a as noop,v as observeThemePreference,o as parseProps,s as setThemeClassNames,d as switchColorTheme,i as updateColorTheme};
|
|
2
2
|
//# sourceMappingURL=ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sources":["../../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n"],"names":["mapSerReplacer","key","value","Map","dataType","Array","from","entries","classNames","_len","arguments","length","classes","_key","filter","className","Boolean","join","parseProps","props","dataProps","restProps","Object","forEach","_ref","substr","generateId","token","_generateId$tokens3","increment","undefined","forcedValue","_generateId$tokens","tokens","concat","noValue","_generateId$tokens2","anchorClick","href","target","remove","aElement","document","createElement","setAttribute","dataset","date","Date","now","click","noop","event","_event$preventDefault","_event$stopPropagatio","_event$stopImmediateP","preventDefault","call","stopPropagation","stopImmediatePropagation"],"mappings":"uFAAaA,EACXA,CAACC,EAAaC,IACVA,aAAiBC,IACZ,CACLC,SAAU,MACVF,MAAOG,MAAMC,KAAKJ,EAAMK,YAGrBL,EAIIM,EAAa,WAAA,IAAA,IAAAC,EAAAC,UAAAC,OAAIC,EAAOP,IAAAA,MAAAI,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAPD,EAAOC,GAAAH,UAAAG,GAAA,OAA2BD,EAC7DE,QAAQC,GAAgD,iBAAdA,GAAP,MAAiCA,IACpED,OAAOE,SAASC,KAAK,IAAI,EAQfC,EAAcC,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOf,QAAQY,GAAOI,SAAQC,IAAkB,IAAhBvB,EAAKC,GAAMsB,EAChB,UAArBvB,EAAIwB,OAAO,EAAG,IAAuC,SAArBxB,EAAIwB,OAAO,EAAG,GAChDL,EAAUnB,GAAOC,EAEjBmB,EAAUpB,GAAOC,CACnB,IAEK,CAAEkB,YAAWC,YAAW,EAQpBK,EAAyB,SACpCC,GAGG,IAAAC,EAAA,IAFHC,IAASnB,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,KAAA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AhBA,EAALD,EAAOI,0BAAcH,GAArBA,EAAAI,KAAAL,GACAA,SAAsBE,QAAjBA,EAALF,EAAOM,2BAAeJ,GAAtBA,EAAAG,KAAAL,GACAA,SAA+BG,QAA1BA,EAALH,EAAOO,oCAAwBJ,GAA/BA,EAAAE,KAAAL,EAAmC"}
|
|
1
|
+
{"version":3,"file":"ui.js","sources":["../../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\nexport type ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n"],"names":["mapSerReplacer","key","value","Map","dataType","Array","from","entries","classNames","_len","arguments","length","classes","_key","filter","className","Boolean","join","parseProps","props","dataProps","restProps","Object","forEach","_ref","substr","generateId","token","_generateId$tokens3","increment","undefined","forcedValue","_generateId$tokens","tokens","concat","noValue","_generateId$tokens2","anchorClick","href","target","remove","aElement","document","createElement","setAttribute","dataset","date","Date","now","click","noop","event","_event$preventDefault","_event$stopPropagatio","_event$stopImmediateP","preventDefault","call","stopPropagation","stopImmediatePropagation","baseThemes","dark","light","getBaseThemes","setThemeClassNames","themes","switchColorTheme","isDark","htmlElement","findShadows","oldClass","newClass","classList","add","querySelectorAll","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","updateColorTheme","resolvedIsDark","body","contains","windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","switchCallback","switchColorThemeHandler","changeDarkColorThemeHandler","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener"],"mappings":"uFAAaA,EACXA,CAACC,EAAaC,IACVA,aAAiBC,IACZ,CACLC,SAAU,MACVF,MAAOG,MAAMC,KAAKJ,EAAMK,YAGrBL,EAIIM,EAAa,WAAA,IAAA,IAAAC,EAAAC,UAAAC,OAAIC,EAAOP,IAAAA,MAAAI,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAPD,EAAOC,GAAAH,UAAAG,GAAA,OAA2BD,EAC7DE,QAAQC,GAAgD,iBAAdA,GAAP,MAAiCA,IACpED,OAAOE,SAASC,KAAK,IAAI,EAQfC,EAAcC,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOf,QAAQY,GAAOI,SAAQC,IAAkB,IAAhBvB,EAAKC,GAAMsB,EAChB,UAArBvB,EAAIwB,OAAO,EAAG,IAAuC,SAArBxB,EAAIwB,OAAO,EAAG,GAChDL,EAAUnB,GAAOC,EAEjBmB,EAAUpB,GAAOC,CACnB,IAEK,CAAEkB,YAAWC,YAAW,EAQpBK,EAAyB,SACpCC,GAGG,IAAAC,EAAA,IAFHC,IAASnB,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,KAAAA,UAAA,GACTqB,EAA+BrB,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,GAAAA,UAAA,QAAGoB,EAIqB,IAAAE,EAAvD,GAFAN,EAAWO,OAASP,EAAWO,QAAU,CAAE,EAEvCF,QAEF,OADAL,EAAWO,OAAON,GAASI,EAC3BG,GAAAA,OAAUP,GAAKO,OAAGR,SAAk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CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{useApi}from"./core/hooks/useApi.js";export{useToggle}from"./core/hooks/useToggle.js";export{useToggle2}from"./core/hooks/useToggle2.js";export{outsideClickHandler,useOutsideClick}from"./core/hooks/useOutsideClick.js";export{useResize}from"./core/hooks/useResize.js";export{useClassNames}from"./core/hooks/useClassNames.js";export{useParseProps}from"./core/hooks/useParseProps.js";export{
|
|
1
|
+
export{useApi}from"./core/hooks/useApi.js";export{useToggle}from"./core/hooks/useToggle.js";export{useToggle2}from"./core/hooks/useToggle2.js";export{outsideClickHandler,useOutsideClick}from"./core/hooks/useOutsideClick.js";export{useResize}from"./core/hooks/useResize.js";export{useClassNames}from"./core/hooks/useClassNames.js";export{useParseProps}from"./core/hooks/useParseProps.js";export{useThemePreference}from"./core/hooks/useThemePreference.js";export{useAnimation}from"./core/hooks/useAnimation.js";export{useIntersectionObserver}from"./core/hooks/useIntersectionObserver.js";export{useTimeoutFn}from"./core/hooks/useSetTimeout.js";export{isBirthNumberValid}from"./core/utils/helpers/birthnumber.validator.js";export{getMatch,isValidFormat,isValidModulo11,parse,regex}from"./core/utils/helpers/birthnumberCZSKvalidator.js";export{parseCSVdata,validateCSVFile,validateCSVlines,validateJSONFile,validateLineCellTrimmed,validateLineNumColumns,validateSDFFile}from"./core/utils/helpers/fileValidator.js";export{DATE_FORMAT,DATE_TIME_FORMAT,formatDate,formatDateTime,formatDateToTimestamp,getDate}from"./core/utils/helpers/date.js";export{getDeviceId}from"./core/utils/helpers/deviceInfo.js";export{emailMatch,emailMatcher,regexBuilder}from"./core/utils/helpers/emailMatcher.js";export{cleanCsvLines,formatFilePath}from"./core/utils/helpers/file.js";export{arrayToObjectTree,chunkArray,duplicatesInArray,formatJsonString,formatObj,formatObj2}from"./core/utils/helpers/objectOperations.js";export{AsyncFunctionTemplate,debounce,delay,isFunctionAsync,memoize,memoizeComplex,memoizer,nestedTernary}from"./core/utils/helpers/other.js";export{escapeRegExp,fileNameExt,findStringInText,normalizeString,removeWhitespaces,sanitizeId,sanitizePathId,toLowerCase,toUpperCase,truncateText}from"./core/utils/helpers/textValueOperations.js";export{Operation,decrementValue,incerementValue,numberDefined,numberOperation,restrictNumberInLimits,setValue}from"./core/utils/helpers/valueOperations.js";export{cancelableSetInterval,cancelableSetTimeout}from"./core/utils/helpers/cancelableDelayedFunction.js";export{anchorClick,classNames,generateId,getBaseThemes,mapSerReplacer,noop,observeThemePreference,parseProps,setThemeClassNames,switchColorTheme,updateColorTheme}from"./core/utils/helpers/ui.js";export{composeId,defaultSanitizeConfig,sanitizeHtml}from"./core/utils/helpers/text.js";export{keyExtractor,keyExtractorFunction}from"./core/utils/keyExtractor.js";export{dateRangeFormat,getDateTime,getTimeFromNow,getTimeFromNowOriginal,getTimeTo}from"./core/utils/date.js";export{ced,createResolveAttribute,customElementDefine,resolveAttributes}from"./core/utils/webComponents/webComponent.utils.js";export{canSetStateMerge,createStore,getSetStateMerge}from"./core/utils/appState/store/store.vanillajs.js";export{createDataStore}from"./core/utils/appState/store/store.vanillajs.templates.js";export{useStore,useStoreApi}from"./core/utils/appState/store/useStore.react.js";export{PeregrineMQ,PeregrineMQClearError}from"./core/utils/appState/peregrineMQ/peregrineMQ.js";export{NON_EXISTENT_CHANNEL}from"./core/utils/appState/peregrineMQ/peregrineMQ.types.js";export{usePeregrineMQ}from"./core/utils/appState/peregrineMQ/usePeregrineMQ.react.js";export{peregrineMQInstance}from"./core/utils/appState/peregrineMQ/index.js";export{TinyStateMachine,TinyStateMachineEvent,TinyStateMachineEventType,TinyStateMachineState,createStates,stateIterator}from"./core/utils/appState/stateMachine/tiny-state-machine.base.js";export{ArrayFirst,ArrayLast}from"./core/utils/array.js";export{Alerts,EventName,KeyCode}from"./core/constants/ui.constants.js";export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./core/ui/utils/style.js";export{BoxLayout,LayoutBox}from"./core/ui/components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./core/ui/components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./core/ui/components/container/lazyComponent/LazyComponent.js";export{CollapsibleContainer}from"./core/ui/components/container/CollapsibleContainer.js";export{ResizableContainer}from"./core/ui/components/container/ResizableContainer.js";export{DefaultErrorComponent,ErrorBoundary}from"./core/ui/components/error/ErrorBoundary.js";export{Field,Select,setIconColor,setIconComponent}from"./core/ui/components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./core/ui/components/dividers/DividerLine.js";export{IconBase}from"./core/ui/components/icon/IconBase.js";export{Icon}from"./core/ui/components/icon/Icon.js";export{ESIcon,ESIconBase}from"./core/ui/components/icon/IconWC.js";export{Button,IconButton,keys}from"./core/ui/components/atoms/button/Button.js";export{Text}from"./core/ui/components/atoms/text/Text.js";export{Headline,HeadlineSecondary,HeadlineTertiary}from"./core/ui/components/atoms/text/Headline.js";export{Paragraph,ParagraphBold,ParagraphBoldSmall,ParagraphSmall}from"./core/ui/components/atoms/text/Paragraph.js";export{Link}from"./core/ui/components/atoms/text/Link.js";export{AnchorLink}from"./core/ui/components/atoms/text/anchor-link/AnchorLink.js";export{TextAndContent,TextAndIcons}from"./core/ui/components/atoms/textAndContent/TextAndContent.js";export{Tag}from"./core/ui/components/atoms/tag/Tag.js";export{TagVariant}from"./core/ui/components/atoms/tag/tag.types.js";export{Toggle}from"./core/ui/components/atoms/toggle/Toggle.js";export{FlowLayout}from"./core/ui/components/molecules/layouts/FlowLayout.js";export{Popover}from"./core/ui/components/molecules/popover/PopoverLite.js";export{Tooltip}from"./core/ui/components/molecules/popover/Tooltip.js";export{PopoverPlacement}from"./core/ui/components/molecules/popover/popover.types.js";export{Popup}from"./core/ui/components/molecules/popup/Popup.js";export{PopupAnimateVariant}from"./core/ui/components/molecules/popup/popup.types.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|