dinocollab-core 1.0.3 → 1.0.4
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/_virtual/_rollupPluginBabelHelpers.js +1 -487
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/api-context/alert-global.js +1 -165
- package/dist/api-context/alert-global.js.map +1 -1
- package/dist/api-context/drawer-global.js +1 -111
- package/dist/api-context/drawer-global.js.map +1 -1
- package/dist/api-context/global-modal.js +1 -94
- package/dist/api-context/global-modal.js.map +1 -1
- package/dist/api-context/popover-global.js +1 -109
- package/dist/api-context/popover-global.js.map +1 -1
- package/dist/api-context/popover.js +1 -93
- package/dist/api-context/popover.js.map +1 -1
- package/dist/api-context/ui.units.js +1 -22
- package/dist/api-context/ui.units.js.map +1 -1
- package/dist/components/breadcrumbs.js +1 -64
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/copy-to-clipboard.js +1 -111
- package/dist/components/copy-to-clipboard.js.map +1 -1
- package/dist/components/help-tooltip.js +1 -103
- package/dist/components/help-tooltip.js.map +1 -1
- package/dist/components/image-with-fallback.js +1 -50
- package/dist/components/image-with-fallback.js.map +1 -1
- package/dist/components/text-editor.js +1 -117
- package/dist/components/text-editor.js.map +1 -1
- package/dist/components/text-editor.preview.js +1 -26
- package/dist/components/text-editor.preview.js.map +1 -1
- package/dist/form/create.autocomplete.chips.js +1 -227
- package/dist/form/create.autocomplete.chips.js.map +1 -1
- package/dist/form/create.date-expired.js +1 -210
- package/dist/form/create.date-expired.js.map +1 -1
- package/dist/form/create.date-picker.js +1 -127
- package/dist/form/create.date-picker.js.map +1 -1
- package/dist/form/create.form-base.js +1 -140
- package/dist/form/create.form-base.js.map +1 -1
- package/dist/form/create.form-comfirm.js +1 -130
- package/dist/form/create.form-comfirm.js.map +1 -1
- package/dist/form/create.form-grid-layout.js +1 -187
- package/dist/form/create.form-grid-layout.js.map +1 -1
- package/dist/form/create.form-grid-layout.units.js +1 -41
- package/dist/form/create.form-grid-layout.units.js.map +1 -1
- package/dist/form/create.input.file.js +1 -78
- package/dist/form/create.input.file.js.map +1 -1
- package/dist/form/create.input.js +1 -275
- package/dist/form/create.input.js.map +1 -1
- package/dist/form/create.select-simple.js +1 -113
- package/dist/form/create.select-simple.js.map +1 -1
- package/dist/form/create.select-with-api.js +1 -276
- package/dist/form/create.select-with-api.js.map +1 -1
- package/dist/form/create.text-editor.js +1 -180
- package/dist/form/create.text-editor.js.map +1 -1
- package/dist/form/dino-form.js +1 -40
- package/dist/form/dino-form.js.map +1 -1
- package/dist/form/helper.js +1 -156
- package/dist/form/helper.js.map +1 -1
- package/dist/form/modal-wrapper.js +1 -81
- package/dist/form/modal-wrapper.js.map +1 -1
- package/dist/form/validator.js +1 -189
- package/dist/form/validator.js.map +1 -1
- package/dist/hooks/index.js +1 -47
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.js +1 -32
- package/dist/index.js.map +1 -1
- package/dist/redux/create.hoc-lazy.js +1 -70
- package/dist/redux/create.hoc-lazy.js.map +1 -1
- package/dist/redux/dino.js +1 -10
- package/dist/redux/dino.js.map +1 -1
- package/dist/redux/types.js +1 -8
- package/dist/redux/types.js.map +1 -1
- package/dist/redux/ui.error-page.js +1 -88
- package/dist/redux/ui.error-page.js.map +1 -1
- package/dist/redux/vector-404.webp.js +1 -3
- package/dist/redux/vector-404.webp.js.map +1 -1
- package/dist/table/context.js +1 -14
- package/dist/table/context.js.map +1 -1
- package/dist/table/create.action-row.js +1 -143
- package/dist/table/create.action-row.js.map +1 -1
- package/dist/table/create.table.js +1 -245
- package/dist/table/create.table.js.map +1 -1
- package/dist/table/custom.filter-operators.js +1 -88
- package/dist/table/custom.filter-operators.js.map +1 -1
- package/dist/table/dino.js +1 -135
- package/dist/table/dino.js.map +1 -1
- package/dist/table/helpers.js +1 -114
- package/dist/table/helpers.js.map +1 -1
- package/dist/table/model-filter.js +1 -22
- package/dist/table/model-filter.js.map +1 -1
- package/dist/table/toolbar-pannel.js +1 -142
- package/dist/table/toolbar-pannel.js.map +1 -1
- package/dist/table/ui.buttons.js +1 -66
- package/dist/table/ui.buttons.js.map +1 -1
- package/dist/table/ui.units.js +1 -247
- package/dist/table/ui.units.js.map +1 -1
- package/dist/utils/dayjs-config.js +1 -11
- package/dist/utils/dayjs-config.js.map +1 -1
- package/dist/utils/helpers.js +1 -198
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/json-object.js +1 -37
- package/dist/utils/json-object.js.map +1 -1
- package/dist/utils/query-param.js +1 -171
- package/dist/utils/query-param.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../src/api-context/popover.tsx"],"sourcesContent":["import React, { Component } from 'react'\r\nimport { Popover, PopoverProps, PopoverVirtualElement } from '@mui/material'\r\nimport { ContentDefault } from './ui.units'\r\n\r\nexport interface IPopoverOptions {\r\n anchorEl?: Element | (() => Element) | PopoverVirtualElement | (() => PopoverVirtualElement) | null\r\n popoverProps?: Omit<PopoverProps, 'open'>\r\n content: React.ReactNode\r\n}\r\n\r\nexport type TShowPopover = (option: IPopoverOptions) => void\r\n\r\nexport type TClosePopover = (reason?: 'backdropClick' | 'escapeKeyDown') => void\r\n\r\nexport interface IApiPopoverContext {\r\n showPopover: TShowPopover\r\n closePopover: TClosePopover\r\n}\r\n\r\nexport const ApiPopoverContext = React.createContext<IApiPopoverContext>({\r\n showPopover: () => {\r\n console.warn('ApiPopover provider not found!')\r\n },\r\n closePopover: () => {\r\n console.warn('ApiPopover provider not found!')\r\n }\r\n})\r\n\r\nexport const MapApiPopoverContext = (context: (state: IApiPopoverContext) => React.ReactNode) => (\r\n <ApiPopoverContext.Consumer>{context}</ApiPopoverContext.Consumer>\r\n)\r\n\r\ninterface IProps {}\r\ninterface IState extends IPopoverOptions {}\r\ntype TProps = React.PropsWithChildren<IProps>\r\nclass ApiPopover extends Component<TProps, IState> implements IApiPopoverContext {\r\n constructor(props: any) {\r\n super(props)\r\n this.state = { anchorEl: null, content: <ContentDefault /> }\r\n }\r\n render() {\r\n return (\r\n <ApiPopoverContext.Provider value={this}>\r\n {this.props.children}\r\n <Popover\r\n sx={{ '& .MuiPaper-root.MuiPaper-elevation': { overflow: 'hidden' } }}\r\n anchorEl={this.state.anchorEl}\r\n open={Boolean(this.state.anchorEl)}\r\n onClose={(_, reason) => this.closePopover(reason)}\r\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\r\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\r\n disableScrollLock\r\n {...this.state.popoverProps}\r\n >\r\n {this.state.content}\r\n </Popover>\r\n </ApiPopoverContext.Provider>\r\n )\r\n }\r\n showPopover = (option: IPopoverOptions) => {\r\n clearTimeout(this.timer)\r\n this.setState({ ...option })\r\n }\r\n timer: any\r\n closePopover: TClosePopover = () => {\r\n clearTimeout(this.timer)\r\n this.setState({ anchorEl: null }, () => {\r\n this.timer = setTimeout(() => {\r\n this.setState({ content: <ContentDefault /> })\r\n }, 500)\r\n })\r\n }\r\n}\r\nexport default ApiPopover\r\n\r\nexport interface IApiPopoverContextProps {\r\n contextPopover: IApiPopoverContext\r\n}\r\nexport const withApiPopoverContext = <P extends IApiPopoverContextProps>(Component: React.ComponentType<P>) => {\r\n return (props: Omit<P, keyof IApiPopoverContextProps>) => {\r\n return (\r\n <ApiPopover>\r\n {MapApiPopoverContext((context) => (\r\n <Component {...(props as P)} contextPopover={context} />\r\n ))}\r\n </ApiPopover>\r\n )\r\n }\r\n}\r\n"],"names":["ApiPopoverContext","React","createContext","showPopover","console","warn","closePopover","MapApiPopoverContext","context","_jsx","Consumer","ApiPopover","
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../src/api-context/popover.tsx"],"sourcesContent":["import React, { Component } from 'react'\r\nimport { Popover, PopoverProps, PopoverVirtualElement } from '@mui/material'\r\nimport { ContentDefault } from './ui.units'\r\n\r\nexport interface IPopoverOptions {\r\n anchorEl?: Element | (() => Element) | PopoverVirtualElement | (() => PopoverVirtualElement) | null\r\n popoverProps?: Omit<PopoverProps, 'open'>\r\n content: React.ReactNode\r\n}\r\n\r\nexport type TShowPopover = (option: IPopoverOptions) => void\r\n\r\nexport type TClosePopover = (reason?: 'backdropClick' | 'escapeKeyDown') => void\r\n\r\nexport interface IApiPopoverContext {\r\n showPopover: TShowPopover\r\n closePopover: TClosePopover\r\n}\r\n\r\nexport const ApiPopoverContext = React.createContext<IApiPopoverContext>({\r\n showPopover: () => {\r\n console.warn('ApiPopover provider not found!')\r\n },\r\n closePopover: () => {\r\n console.warn('ApiPopover provider not found!')\r\n }\r\n})\r\n\r\nexport const MapApiPopoverContext = (context: (state: IApiPopoverContext) => React.ReactNode) => (\r\n <ApiPopoverContext.Consumer>{context}</ApiPopoverContext.Consumer>\r\n)\r\n\r\ninterface IProps {}\r\ninterface IState extends IPopoverOptions {}\r\ntype TProps = React.PropsWithChildren<IProps>\r\nclass ApiPopover extends Component<TProps, IState> implements IApiPopoverContext {\r\n constructor(props: any) {\r\n super(props)\r\n this.state = { anchorEl: null, content: <ContentDefault /> }\r\n }\r\n render() {\r\n return (\r\n <ApiPopoverContext.Provider value={this}>\r\n {this.props.children}\r\n <Popover\r\n sx={{ '& .MuiPaper-root.MuiPaper-elevation': { overflow: 'hidden' } }}\r\n anchorEl={this.state.anchorEl}\r\n open={Boolean(this.state.anchorEl)}\r\n onClose={(_, reason) => this.closePopover(reason)}\r\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\r\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\r\n disableScrollLock\r\n {...this.state.popoverProps}\r\n >\r\n {this.state.content}\r\n </Popover>\r\n </ApiPopoverContext.Provider>\r\n )\r\n }\r\n showPopover = (option: IPopoverOptions) => {\r\n clearTimeout(this.timer)\r\n this.setState({ ...option })\r\n }\r\n timer: any\r\n closePopover: TClosePopover = () => {\r\n clearTimeout(this.timer)\r\n this.setState({ anchorEl: null }, () => {\r\n this.timer = setTimeout(() => {\r\n this.setState({ content: <ContentDefault /> })\r\n }, 500)\r\n })\r\n }\r\n}\r\nexport default ApiPopover\r\n\r\nexport interface IApiPopoverContextProps {\r\n contextPopover: IApiPopoverContext\r\n}\r\nexport const withApiPopoverContext = <P extends IApiPopoverContextProps>(Component: React.ComponentType<P>) => {\r\n return (props: Omit<P, keyof IApiPopoverContextProps>) => {\r\n return (\r\n <ApiPopover>\r\n {MapApiPopoverContext((context) => (\r\n <Component {...(props as P)} contextPopover={context} />\r\n ))}\r\n </ApiPopover>\r\n )\r\n }\r\n}\r\n"],"names":["ApiPopoverContext","React","createContext","showPopover","console","warn","closePopover","MapApiPopoverContext","context","_jsx","Consumer","ApiPopover","props","_this","_classCallCheck","_callSuper","_defineProperty","option","clearTimeout","timer","setState","_objectSpread","anchorEl","setTimeout","content","ContentDefault","state","_inherits","Component","_createClass","key","value","_this2","this","_jsxs","Provider","children","Popover","sx","overflow","open","Boolean","onClose","_","reason","anchorOrigin","vertical","horizontal","transformOrigin","disableScrollLock","popoverProps","withApiPopoverContext","contextPopover"],"mappings":"iVAmBaA,EAAoBC,EAAMC,cAAkC,CACvEC,YAAa,WACXC,QAAQC,KAAK,iCACd,EACDC,aAAc,WACZF,QAAQC,KAAK,iCACf,IAGWE,EAAuB,SAACC,GAAuD,OAC1FC,EAACT,EAAkBU,mBAAUF,GAAqC,EAM9DG,aACJ,SAAAA,EAAYC,GAAU,IAAAC,EAEwC,OAFxCC,OAAAH,GACpBE,EAAAE,EAAAJ,KAAAA,GAAMC,IAAMI,EAAAH,EAsBA,eAAA,SAACI,GACbC,aAAaL,EAAKM,OAClBN,EAAKO,SAAQC,EAAMJ,CAAAA,EAAAA,OACpBD,EAAAH,EAAA,gBAE6B,WAC5BK,aAAaL,EAAKM,OAClBN,EAAKO,SAAS,CAAEE,SAAU,OAAQ,WAChCT,EAAKM,MAAQI,YAAW,WACtBV,EAAKO,SAAS,CAAEI,QAASf,EAACgB,EAAc,CAAA,IACzC,GAAE,IACL,OAhCAZ,EAAKa,MAAQ,CAAEJ,SAAU,KAAME,QAASf,EAACgB,EAAc,CAAA,IAAKZ,CAC9D,CAAC,OAAAc,EAAAhB,EAJsBiB,GAItBC,EAAAlB,EAAA,CAAA,CAAAmB,IAAA,SAAAC,MACD,WAAM,IAAAC,EAAAC,KACJ,OACEC,EAAClC,EAAkBmC,SAAS,CAAAJ,MAAOE,KAChCG,SAAA,CAAAH,KAAKrB,MAAMwB,SACZ3B,EAAC4B,EAAOhB,EAAAA,EAAA,CACNiB,GAAI,CAAE,sCAAuC,CAAEC,SAAU,WACzDjB,SAAUW,KAAKP,MAAMJ,SACrBkB,KAAMC,QAAQR,KAAKP,MAAMJ,UACzBoB,QAAS,SAACC,EAAGC,GAAM,OAAKZ,EAAK1B,aAAasC,EAAO,EACjDC,aAAc,CAAEC,SAAU,SAAUC,WAAY,SAChDC,gBAAiB,CAAEF,SAAU,MAAOC,WAAY,SAChDE,mBAAiB,GACbhB,KAAKP,MAAMwB,cAAY,CAAA,EAAA,CAE1Bd,SAAAH,KAAKP,MAAMF,aAIpB,IAAC,IAoBU2B,EAAwB,SAAoCvB,GACvE,OAAO,SAAChB,GACN,OACEH,EAACE,EACE,CAAAyB,SAAA7B,GAAqB,SAACC,GAAO,OAC5BC,EAACmB,EAASP,EAAAA,KAAMT,GAAW,GAAA,CAAEwC,eAAgB5C,IAC9C,KAGN,CACH"}
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Box, Typography } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
var ContentDefault = function ContentDefault() {
|
|
5
|
-
return jsx(Box, {
|
|
6
|
-
sx: {
|
|
7
|
-
p: '9px 12px',
|
|
8
|
-
m: '12px',
|
|
9
|
-
backgroundColor: 'rgba(0,0,0,0.1)'
|
|
10
|
-
},
|
|
11
|
-
children: jsx(Typography, {
|
|
12
|
-
variant: 'caption',
|
|
13
|
-
sx: {
|
|
14
|
-
fontWeight: 600,
|
|
15
|
-
fontStyle: 'italic'
|
|
16
|
-
},
|
|
17
|
-
children: "Content"
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { ContentDefault };
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Box as t,Typography as i}from"@mui/material";var n=function(){return r(t,{sx:{p:"9px 12px",m:"12px",backgroundColor:"rgba(0,0,0,0.1)"},children:r(i,{variant:"caption",sx:{fontWeight:600,fontStyle:"italic"},children:"Content"})})};export{n as ContentDefault};
|
|
23
2
|
//# sourceMappingURL=ui.units.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.units.js","sources":["../../src/api-context/ui.units.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Box, Typography } from '@mui/material'\r\n\r\nexport const ContentDefault: FC = () => (\r\n <Box sx={{ p: '9px 12px', m: '12px', backgroundColor: 'rgba(0,0,0,0.1)' }}>\r\n <Typography variant='caption' sx={{ fontWeight: 600, fontStyle: 'italic' }}>\r\n Content\r\n </Typography>\r\n </Box>\r\n)\r\n"],"names":["ContentDefault","_jsx","Box","sx","p","m","backgroundColor","children","Typography","variant","fontWeight","fontStyle"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui.units.js","sources":["../../src/api-context/ui.units.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Box, Typography } from '@mui/material'\r\n\r\nexport const ContentDefault: FC = () => (\r\n <Box sx={{ p: '9px 12px', m: '12px', backgroundColor: 'rgba(0,0,0,0.1)' }}>\r\n <Typography variant='caption' sx={{ fontWeight: 600, fontStyle: 'italic' }}>\r\n Content\r\n </Typography>\r\n </Box>\r\n)\r\n"],"names":["ContentDefault","_jsx","Box","sx","p","m","backgroundColor","children","Typography","variant","fontWeight","fontStyle"],"mappings":"4FAGaA,IAAAA,EAAqB,WAAP,OACzBC,EAACC,EAAG,CAACC,GAAI,CAAEC,EAAG,WAAYC,EAAG,OAAQC,gBAAiB,mBAAmBC,SACvEN,EAACO,EAAU,CAACC,QAAQ,UAAUN,GAAI,CAAEO,WAAY,IAAKC,UAAW,UAAUJ,SAAA,aAGtE"}
|
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { styled, Box, Breadcrumbs as Breadcrumbs$1, Typography } from '@mui/material';
|
|
4
|
-
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
|
5
|
-
|
|
6
|
-
var Breadcrumbs = function Breadcrumbs(props) {
|
|
7
|
-
var _props$value;
|
|
8
|
-
var list = (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : [];
|
|
9
|
-
var handleClick = function handleClick(e, x) {
|
|
10
|
-
e.preventDefault();
|
|
11
|
-
e.stopPropagation();
|
|
12
|
-
x.onClick && x.onClick(e);
|
|
13
|
-
};
|
|
14
|
-
var getItemProps = function getItemProps(item) {
|
|
15
|
-
if (item.propsGetter) return item.propsGetter();
|
|
16
|
-
return item.url ? {
|
|
17
|
-
component: 'a',
|
|
18
|
-
href: item.url
|
|
19
|
-
} : {};
|
|
20
|
-
};
|
|
21
|
-
return jsx(Breadcrumbs$1, {
|
|
22
|
-
children: list.map(function (x, i) {
|
|
23
|
-
var isClick = !!x.onClick || !!x.url;
|
|
24
|
-
return jsxs(WrapTypography, _objectSpread2(_objectSpread2({}, getItemProps(x)), {}, {
|
|
25
|
-
onClick: x.onClick ? function (e) {
|
|
26
|
-
return handleClick(e, x);
|
|
27
|
-
} : undefined,
|
|
28
|
-
className: isClick ? 'clickable' : '',
|
|
29
|
-
children: [i < 1 && jsx(ArrowBackIosIcon, {
|
|
30
|
-
sx: {
|
|
31
|
-
fontSize: '16px',
|
|
32
|
-
mb: '3px',
|
|
33
|
-
color: '#000'
|
|
34
|
-
}
|
|
35
|
-
}), jsx(Typography, {
|
|
36
|
-
variant: 'subtitle1',
|
|
37
|
-
sx: {
|
|
38
|
-
fontWeight: 600
|
|
39
|
-
},
|
|
40
|
-
noWrap: true,
|
|
41
|
-
children: jsx("span", {
|
|
42
|
-
children: x.label
|
|
43
|
-
})
|
|
44
|
-
})]
|
|
45
|
-
}), 'key' + i);
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var WrapTypography = styled(Box)({
|
|
50
|
-
display: 'flex',
|
|
51
|
-
alignItems: 'center',
|
|
52
|
-
textDecoration: 'none',
|
|
53
|
-
'&.clickable': {
|
|
54
|
-
cursor: 'pointer'
|
|
55
|
-
},
|
|
56
|
-
'& .MuiTypography-root': {
|
|
57
|
-
color: 'var(--color-title)'
|
|
58
|
-
},
|
|
59
|
-
'&.clickable:hover .MuiTypography-root': {
|
|
60
|
-
textDecoration: 'underline'
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export { Breadcrumbs as default };
|
|
1
|
+
import{objectSpread2 as r}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as o,jsxs as e}from"react/jsx-runtime";import{styled as t,Box as i,Breadcrumbs as l,Typography as n}from"@mui/material";import a from"@mui/icons-material/ArrowBackIos";var c=function(t){var i,c=null!==(i=t.value)&&void 0!==i?i:[];return o(l,{children:c.map((function(t,i){var l,c=!!t.onClick||!!t.url;return e(p,r(r({},(l=t).propsGetter?l.propsGetter():l.url?{component:"a",href:l.url}:{}),{},{onClick:t.onClick?function(r){return function(r,o){r.preventDefault(),r.stopPropagation(),o.onClick&&o.onClick(r)}(r,t)}:void 0,className:c?"clickable":"",children:[i<1&&o(a,{sx:{fontSize:"16px",mb:"3px",color:"#000"}}),o(n,{variant:"subtitle1",sx:{fontWeight:600},noWrap:!0,children:o("span",{children:t.label})})]}),"key"+i)}))})},p=t(i)({display:"flex",alignItems:"center",textDecoration:"none","&.clickable":{cursor:"pointer"},"& .MuiTypography-root":{color:"var(--color-title)"},"&.clickable:hover .MuiTypography-root":{textDecoration:"underline"}});export{c as default};
|
|
65
2
|
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Box, Breadcrumbs as MUIBreadcrumbs, styled, Typography, TypographyProps } from '@mui/material'\r\nimport ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos'\r\n\r\nexport interface IBreadcrumbConfig {\r\n label: string\r\n url?: string\r\n propsGetter?: () => TypographyProps\r\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void\r\n}\r\n\r\nexport interface IBreadcrumbsProps {\r\n value?: IBreadcrumbConfig[]\r\n}\r\n\r\nconst Breadcrumbs: FC<IBreadcrumbsProps> = (props) => {\r\n const list = props.value ?? []\r\n\r\n const handleClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>, x: IBreadcrumbConfig) => {\r\n e.preventDefault()\r\n e.stopPropagation()\r\n x.onClick && x.onClick(e)\r\n }\r\n\r\n const getItemProps = (item: IBreadcrumbConfig): TypographyProps => {\r\n if (item.propsGetter) return item.propsGetter()\r\n return item.url ? ({ component: 'a', href: item.url } as TypographyProps) : {}\r\n }\r\n\r\n return (\r\n <MUIBreadcrumbs>\r\n {list.map((x, i) => {\r\n const isClick = !!x.onClick || !!x.url\r\n return (\r\n <WrapTypography\r\n key={'key' + i}\r\n {...getItemProps(x)}\r\n onClick={x.onClick ? (e: any) => handleClick(e, x) : undefined}\r\n className={isClick ? 'clickable' : ''}\r\n >\r\n {i < 1 && <ArrowBackIosIcon sx={{ fontSize: '16px', mb: '3px', color: '#000' }} />}\r\n <Typography variant='subtitle1' sx={{ fontWeight: 600 }} noWrap>\r\n <span>{x.label}</span>\r\n </Typography>\r\n </WrapTypography>\r\n )\r\n })}\r\n </MUIBreadcrumbs>\r\n )\r\n}\r\nexport default Breadcrumbs\r\n\r\nconst WrapTypography = styled(Box)({\r\n display: 'flex',\r\n alignItems: 'center',\r\n textDecoration: 'none',\r\n '&.clickable': {\r\n cursor: 'pointer'\r\n },\r\n '& .MuiTypography-root': {\r\n color: 'var(--color-title)'\r\n },\r\n '&.clickable:hover .MuiTypography-root': {\r\n textDecoration: 'underline'\r\n }\r\n})\r\n"],"names":["Breadcrumbs","props","_props$value","list","value","
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sources":["../../src/components/breadcrumbs.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Box, Breadcrumbs as MUIBreadcrumbs, styled, Typography, TypographyProps } from '@mui/material'\r\nimport ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos'\r\n\r\nexport interface IBreadcrumbConfig {\r\n label: string\r\n url?: string\r\n propsGetter?: () => TypographyProps\r\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void\r\n}\r\n\r\nexport interface IBreadcrumbsProps {\r\n value?: IBreadcrumbConfig[]\r\n}\r\n\r\nconst Breadcrumbs: FC<IBreadcrumbsProps> = (props) => {\r\n const list = props.value ?? []\r\n\r\n const handleClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>, x: IBreadcrumbConfig) => {\r\n e.preventDefault()\r\n e.stopPropagation()\r\n x.onClick && x.onClick(e)\r\n }\r\n\r\n const getItemProps = (item: IBreadcrumbConfig): TypographyProps => {\r\n if (item.propsGetter) return item.propsGetter()\r\n return item.url ? ({ component: 'a', href: item.url } as TypographyProps) : {}\r\n }\r\n\r\n return (\r\n <MUIBreadcrumbs>\r\n {list.map((x, i) => {\r\n const isClick = !!x.onClick || !!x.url\r\n return (\r\n <WrapTypography\r\n key={'key' + i}\r\n {...getItemProps(x)}\r\n onClick={x.onClick ? (e: any) => handleClick(e, x) : undefined}\r\n className={isClick ? 'clickable' : ''}\r\n >\r\n {i < 1 && <ArrowBackIosIcon sx={{ fontSize: '16px', mb: '3px', color: '#000' }} />}\r\n <Typography variant='subtitle1' sx={{ fontWeight: 600 }} noWrap>\r\n <span>{x.label}</span>\r\n </Typography>\r\n </WrapTypography>\r\n )\r\n })}\r\n </MUIBreadcrumbs>\r\n )\r\n}\r\nexport default Breadcrumbs\r\n\r\nconst WrapTypography = styled(Box)({\r\n display: 'flex',\r\n alignItems: 'center',\r\n textDecoration: 'none',\r\n '&.clickable': {\r\n cursor: 'pointer'\r\n },\r\n '& .MuiTypography-root': {\r\n color: 'var(--color-title)'\r\n },\r\n '&.clickable:hover .MuiTypography-root': {\r\n textDecoration: 'underline'\r\n }\r\n})\r\n"],"names":["Breadcrumbs","props","_props$value","list","value","_jsx","MUIBreadcrumbs","children","map","x","i","item","isClick","onClick","url","_jsxs","WrapTypography","_objectSpread","getItemProps","propsGetter","component","href","e","preventDefault","stopPropagation","handleClick","undefined","className","ArrowBackIosIcon","sx","fontSize","mb","color","Typography","variant","fontWeight","noWrap","label","styled","Box","display","alignItems","textDecoration","cursor"],"mappings":"4PAeA,IAAMA,EAAqC,SAACC,GAAS,IAAAC,EAC7CC,EAAkB,QAAdD,EAAGD,EAAMG,aAAK,IAAAF,EAAAA,EAAI,GAa5B,OACEG,EAACC,EAAc,CAAAC,SACZJ,EAAKK,KAAI,SAACC,EAAGC,GACZ,IARgBC,EAQVC,IAAYH,EAAEI,WAAaJ,EAAEK,IACnC,OACEC,EAACC,EAAcC,EAAAA,EAETC,CAAAA,GAZQP,EAYKF,GAXhBU,YAAoBR,EAAKQ,cAC3BR,EAAKG,IAAO,CAAEM,UAAW,IAAKC,KAAMV,EAAKG,KAA4B,CAAE,GAUnD,GAAA,CACnBD,QAASJ,EAAEI,QAAU,SAACS,GAAM,OAnBlB,SAACA,EAAiDb,GACpEa,EAAEC,iBACFD,EAAEE,kBACFf,EAAEI,SAAWJ,EAAEI,QAAQS,EACxB,CAe0CG,CAAYH,EAAGb,EAAE,OAAGiB,EACrDC,UAAWf,EAAU,YAAc,GAAEL,SAAA,CAEpCG,EAAI,GAAKL,EAACuB,EAAgB,CAACC,GAAI,CAAEC,SAAU,OAAQC,GAAI,MAAOC,MAAO,UACtE3B,EAAC4B,EAAU,CAACC,QAAQ,YAAYL,GAAI,CAAEM,WAAY,KAAOC,QACvD,EAAA7B,SAAAF,EAAA,OAAA,CAAAE,SAAOE,EAAE4B,aAPN,MAAQ3B,EAWlB,KAGP,EAGMM,EAAiBsB,EAAOC,EAAPD,CAAY,CACjCE,QAAS,OACTC,WAAY,SACZC,eAAgB,OAChB,cAAe,CACbC,OAAQ,WAEV,wBAAyB,CACvBX,MAAO,sBAET,wCAAyC,CACvCU,eAAgB"}
|
|
@@ -1,112 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { Component } from 'react';
|
|
4
|
-
import { Tooltip, Box, IconButton } from '@mui/material';
|
|
5
|
-
import copy from 'clipboard-copy';
|
|
6
|
-
import DoneIcon from '@mui/icons-material/Done';
|
|
7
|
-
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
|
8
|
-
|
|
9
|
-
var _excluded = ["title"];
|
|
10
|
-
var CopyToClipboard = /*#__PURE__*/function (_Component) {
|
|
11
|
-
function CopyToClipboard(props) {
|
|
12
|
-
var _this;
|
|
13
|
-
_classCallCheck(this, CopyToClipboard);
|
|
14
|
-
_this = _callSuper(this, CopyToClipboard, [props]);
|
|
15
|
-
_defineProperty(_this, "renderIcon", function () {
|
|
16
|
-
var _this$props$slots, _this$props$slots2;
|
|
17
|
-
if ((_this$props$slots = _this.props.slots) !== null && _this$props$slots !== void 0 && _this$props$slots.button) {
|
|
18
|
-
var ButtonComp = _this.props.slots.button;
|
|
19
|
-
return jsx(ButtonComp, {
|
|
20
|
-
onClick: _this.handleClickCopy,
|
|
21
|
-
copied: _this.state.copied
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
var Icon = _this.state.copied ? DoneIcon : ContentCopyIcon;
|
|
25
|
-
return jsx(IconButton, _objectSpread2(_objectSpread2({
|
|
26
|
-
onClick: _this.handleClickCopy
|
|
27
|
-
}, (_this$props$slots2 = _this.props.slots) === null || _this$props$slots2 === void 0 ? void 0 : _this$props$slots2.buttonProps), {}, {
|
|
28
|
-
children: jsx(Icon, {
|
|
29
|
-
fontSize: 'small',
|
|
30
|
-
sx: {
|
|
31
|
-
color: '#606060'
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}));
|
|
35
|
-
});
|
|
36
|
-
_defineProperty(_this, "handleClickCopy", function () {
|
|
37
|
-
_this.debounceTime.start();
|
|
38
|
-
_this.onCopy();
|
|
39
|
-
});
|
|
40
|
-
_defineProperty(_this, "debounceTime", {
|
|
41
|
-
cache: 0,
|
|
42
|
-
time: 1500,
|
|
43
|
-
start: function start() {
|
|
44
|
-
_this.debounceTime.clear();
|
|
45
|
-
_this.setState({
|
|
46
|
-
copied: true
|
|
47
|
-
}, function () {
|
|
48
|
-
_this.debounceTime.cache = setTimeout(function () {
|
|
49
|
-
_this.setState({
|
|
50
|
-
copied: false
|
|
51
|
-
});
|
|
52
|
-
}, _this.debounceTime.time);
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
clear: function clear() {
|
|
56
|
-
clearTimeout(_this.debounceTime.cache);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
_defineProperty(_this, "onCopy", function () {
|
|
60
|
-
copy(_this.props.value);
|
|
61
|
-
_this.setState({
|
|
62
|
-
showTooltip: true
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
_this.state = {
|
|
66
|
-
showTooltip: false,
|
|
67
|
-
copied: false
|
|
68
|
-
};
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
_inherits(CopyToClipboard, _Component);
|
|
72
|
-
return _createClass(CopyToClipboard, [{
|
|
73
|
-
key: "render",
|
|
74
|
-
value: function render() {
|
|
75
|
-
var _this$props$slots$too,
|
|
76
|
-
_this$props$slots3,
|
|
77
|
-
_this2 = this;
|
|
78
|
-
var leaveDelay = this.state.copied ? this.debounceTime.time - 200 : 0;
|
|
79
|
-
var _ref = (_this$props$slots$too = (_this$props$slots3 = this.props.slots) === null || _this$props$slots3 === void 0 ? void 0 : _this$props$slots3.tooltipProps) !== null && _this$props$slots$too !== void 0 ? _this$props$slots$too : {},
|
|
80
|
-
title = _ref.title,
|
|
81
|
-
tooltipProps = _objectWithoutProperties(_ref, _excluded);
|
|
82
|
-
var titleValue = this.state.copied ? 'Copied to clipboard!' : title !== null && title !== void 0 ? title : 'Copy to clipboard';
|
|
83
|
-
return jsx(Tooltip, _objectSpread2(_objectSpread2({
|
|
84
|
-
arrow: true,
|
|
85
|
-
title: titleValue,
|
|
86
|
-
leaveDelay: leaveDelay,
|
|
87
|
-
open: this.state.showTooltip,
|
|
88
|
-
onOpen: function onOpen() {
|
|
89
|
-
return _this2.setState({
|
|
90
|
-
showTooltip: true
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
onClose: function onClose() {
|
|
94
|
-
return _this2.setState({
|
|
95
|
-
showTooltip: false
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}, tooltipProps), {}, {
|
|
99
|
-
children: jsx(Box, {
|
|
100
|
-
sx: {
|
|
101
|
-
display: 'inline-block',
|
|
102
|
-
flex: '0 0 auto'
|
|
103
|
-
},
|
|
104
|
-
children: this.renderIcon()
|
|
105
|
-
})
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
}]);
|
|
109
|
-
}(Component);
|
|
110
|
-
|
|
111
|
-
export { CopyToClipboard as default };
|
|
1
|
+
import{inherits as o,createClass as e,objectWithoutProperties as t,objectSpread2 as i,classCallCheck as r,callSuper as n,defineProperty as l}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as s}from"react/jsx-runtime";import{Component as a}from"react";import{Tooltip as c,Box as p,IconButton as u}from"@mui/material";import d from"clipboard-copy";import m from"@mui/icons-material/Done";import h from"@mui/icons-material/ContentCopy";var f=["title"],C=function(){function C(o){var e;return r(this,C),e=n(this,C,[o]),l(e,"renderIcon",(function(){var o,t;if(null!==(o=e.props.slots)&&void 0!==o&&o.button){var r=e.props.slots.button;return s(r,{onClick:e.handleClickCopy,copied:e.state.copied})}var n=e.state.copied?m:h;return s(u,i(i({onClick:e.handleClickCopy},null===(t=e.props.slots)||void 0===t?void 0:t.buttonProps),{},{children:s(n,{fontSize:"small",sx:{color:"#606060"}})}))})),l(e,"handleClickCopy",(function(){e.debounceTime.start(),e.onCopy()})),l(e,"debounceTime",{cache:0,time:1500,start:function(){e.debounceTime.clear(),e.setState({copied:!0},(function(){e.debounceTime.cache=setTimeout((function(){e.setState({copied:!1})}),e.debounceTime.time)}))},clear:function(){clearTimeout(e.debounceTime.cache)}}),l(e,"onCopy",(function(){d(e.props.value),e.setState({showTooltip:!0})})),e.state={showTooltip:!1,copied:!1},e}return o(C,a),e(C,[{key:"render",value:function(){var o,e,r=this,n=this.state.copied?this.debounceTime.time-200:0,l=null!==(o=null===(e=this.props.slots)||void 0===e?void 0:e.tooltipProps)&&void 0!==o?o:{},a=l.title,u=t(l,f),d=this.state.copied?"Copied to clipboard!":null!=a?a:"Copy to clipboard";return s(c,i(i({arrow:!0,title:d,leaveDelay:n,open:this.state.showTooltip,onOpen:function(){return r.setState({showTooltip:!0})},onClose:function(){return r.setState({showTooltip:!1})}},u),{},{children:s(p,{sx:{display:"inline-block",flex:"0 0 auto"},children:this.renderIcon()})}))}}])}();export{C as default};
|
|
112
2
|
//# sourceMappingURL=copy-to-clipboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-to-clipboard.js","sources":["../../src/components/copy-to-clipboard.tsx"],"sourcesContent":["import React, { Component, ComponentType } from 'react'\r\nimport { Box, ButtonProps, IconButton, Tooltip, TooltipProps } from '@mui/material'\r\nimport copy from 'clipboard-copy'\r\nimport DoneIcon from '@mui/icons-material/Done'\r\nimport ContentCopyIcon from '@mui/icons-material/ContentCopy'\r\n\r\nexport interface ICopyToClipboardProps {\r\n value: string\r\n slots?: {\r\n tooltipProps?: Partial<TooltipProps>\r\n button?: ComponentType<{ onClick: () => void; copied?: boolean }>\r\n buttonProps?: ButtonProps\r\n }\r\n}\r\n\r\nexport interface ICopyToClipboardState {\r\n showTooltip: boolean\r\n copied: boolean\r\n}\r\n\r\nclass CopyToClipboard extends Component<ICopyToClipboardProps, ICopyToClipboardState> {\r\n constructor(props: ICopyToClipboardProps) {\r\n super(props)\r\n this.state = { showTooltip: false, copied: false }\r\n }\r\n\r\n render() {\r\n const leaveDelay = this.state.copied ? this.debounceTime.time - 200 : 0\r\n const { title, ...tooltipProps } = this.props.slots?.tooltipProps ?? {}\r\n const titleValue = this.state.copied ? 'Copied to clipboard!' : title ?? 'Copy to clipboard'\r\n return (\r\n <Tooltip\r\n arrow\r\n title={titleValue}\r\n leaveDelay={leaveDelay}\r\n open={this.state.showTooltip}\r\n onOpen={() => this.setState({ showTooltip: true })}\r\n onClose={() => this.setState({ showTooltip: false })}\r\n {...tooltipProps}\r\n >\r\n <Box sx={{ display: 'inline-block', flex: '0 0 auto' }}>{this.renderIcon()}</Box>\r\n </Tooltip>\r\n )\r\n }\r\n\r\n renderIcon = () => {\r\n if (this.props.slots?.button) {\r\n const ButtonComp = this.props.slots.button\r\n return <ButtonComp onClick={this.handleClickCopy} copied={this.state.copied} />\r\n }\r\n const Icon = this.state.copied ? DoneIcon : ContentCopyIcon\r\n return (\r\n <IconButton onClick={this.handleClickCopy} {...this.props.slots?.buttonProps}>\r\n <Icon fontSize='small' sx={{ color: '#606060' }} />\r\n </IconButton>\r\n )\r\n }\r\n\r\n handleClickCopy = () => {\r\n this.debounceTime.start()\r\n this.onCopy()\r\n }\r\n\r\n private debounceTime = {\r\n cache: 0 as any,\r\n time: 1500,\r\n start: () => {\r\n this.debounceTime.clear()\r\n this.setState({ copied: true }, () => {\r\n this.debounceTime.cache = setTimeout(() => {\r\n this.setState({ copied: false })\r\n }, this.debounceTime.time)\r\n })\r\n },\r\n clear: () => {\r\n clearTimeout(this.debounceTime.cache)\r\n }\r\n }\r\n\r\n private onCopy = () => {\r\n copy(this.props.value)\r\n this.setState({ showTooltip: true })\r\n }\r\n}\r\nexport default CopyToClipboard\r\n"],"names":["CopyToClipboard","
|
|
1
|
+
{"version":3,"file":"copy-to-clipboard.js","sources":["../../src/components/copy-to-clipboard.tsx"],"sourcesContent":["import React, { Component, ComponentType } from 'react'\r\nimport { Box, ButtonProps, IconButton, Tooltip, TooltipProps } from '@mui/material'\r\nimport copy from 'clipboard-copy'\r\nimport DoneIcon from '@mui/icons-material/Done'\r\nimport ContentCopyIcon from '@mui/icons-material/ContentCopy'\r\n\r\nexport interface ICopyToClipboardProps {\r\n value: string\r\n slots?: {\r\n tooltipProps?: Partial<TooltipProps>\r\n button?: ComponentType<{ onClick: () => void; copied?: boolean }>\r\n buttonProps?: ButtonProps\r\n }\r\n}\r\n\r\nexport interface ICopyToClipboardState {\r\n showTooltip: boolean\r\n copied: boolean\r\n}\r\n\r\nclass CopyToClipboard extends Component<ICopyToClipboardProps, ICopyToClipboardState> {\r\n constructor(props: ICopyToClipboardProps) {\r\n super(props)\r\n this.state = { showTooltip: false, copied: false }\r\n }\r\n\r\n render() {\r\n const leaveDelay = this.state.copied ? this.debounceTime.time - 200 : 0\r\n const { title, ...tooltipProps } = this.props.slots?.tooltipProps ?? {}\r\n const titleValue = this.state.copied ? 'Copied to clipboard!' : title ?? 'Copy to clipboard'\r\n return (\r\n <Tooltip\r\n arrow\r\n title={titleValue}\r\n leaveDelay={leaveDelay}\r\n open={this.state.showTooltip}\r\n onOpen={() => this.setState({ showTooltip: true })}\r\n onClose={() => this.setState({ showTooltip: false })}\r\n {...tooltipProps}\r\n >\r\n <Box sx={{ display: 'inline-block', flex: '0 0 auto' }}>{this.renderIcon()}</Box>\r\n </Tooltip>\r\n )\r\n }\r\n\r\n renderIcon = () => {\r\n if (this.props.slots?.button) {\r\n const ButtonComp = this.props.slots.button\r\n return <ButtonComp onClick={this.handleClickCopy} copied={this.state.copied} />\r\n }\r\n const Icon = this.state.copied ? DoneIcon : ContentCopyIcon\r\n return (\r\n <IconButton onClick={this.handleClickCopy} {...this.props.slots?.buttonProps}>\r\n <Icon fontSize='small' sx={{ color: '#606060' }} />\r\n </IconButton>\r\n )\r\n }\r\n\r\n handleClickCopy = () => {\r\n this.debounceTime.start()\r\n this.onCopy()\r\n }\r\n\r\n private debounceTime = {\r\n cache: 0 as any,\r\n time: 1500,\r\n start: () => {\r\n this.debounceTime.clear()\r\n this.setState({ copied: true }, () => {\r\n this.debounceTime.cache = setTimeout(() => {\r\n this.setState({ copied: false })\r\n }, this.debounceTime.time)\r\n })\r\n },\r\n clear: () => {\r\n clearTimeout(this.debounceTime.cache)\r\n }\r\n }\r\n\r\n private onCopy = () => {\r\n copy(this.props.value)\r\n this.setState({ showTooltip: true })\r\n }\r\n}\r\nexport default CopyToClipboard\r\n"],"names":["CopyToClipboard","props","_this","_classCallCheck","_callSuper","_defineProperty","_this$props$slots","_this$props$slots2","slots","button","ButtonComp","_jsx","onClick","handleClickCopy","copied","state","Icon","DoneIcon","ContentCopyIcon","IconButton","_objectSpread","buttonProps","children","fontSize","sx","color","debounceTime","start","onCopy","cache","time","clear","setState","setTimeout","clearTimeout","copy","value","showTooltip","_inherits","Component","_createClass","key","_this$props$slots$too","_this$props$slots3","_this2","this","leaveDelay","_ref","tooltipProps","title","_objectWithoutProperties","_excluded","titleValue","Tooltip","arrow","open","onOpen","onClose","Box","display","flex","renderIcon"],"mappings":"4cAoBMA,aACJ,SAAAA,EAAYC,GAA4B,IAAAC,EAEY,OAFZC,OAAAH,GACtCE,EAAAE,EAAAJ,KAAAA,GAAMC,IAAMI,EAAAH,EAAA,cAuBD,WAAK,IAAAI,EAAAC,EAChB,GAAoB,QAApBD,EAAIJ,EAAKD,MAAMO,aAAK,IAAAF,GAAhBA,EAAkBG,OAAQ,CAC5B,IAAMC,EAAaR,EAAKD,MAAMO,MAAMC,OACpC,OAAOE,EAACD,EAAU,CAACE,QAASV,EAAKW,gBAAiBC,OAAQZ,EAAKa,MAAMD,QACtE,CACD,IAAME,EAAOd,EAAKa,MAAMD,OAASG,EAAWC,EAC5C,OACEP,EAACQ,EAAUC,EAAAA,EAAA,CAACR,QAASV,EAAKW,iBAAqC,QAAtBN,EAAML,EAAKD,MAAMO,aAAK,IAAAD,OAAA,EAAhBA,EAAkBc,aAAW,CAAA,EAAA,CAC1EC,SAAAX,EAACK,EAAK,CAAAO,SAAS,QAAQC,GAAI,CAAEC,MAAO,mBAGzCpB,EAAAH,EAAA,mBAEiB,WAChBA,EAAKwB,aAAaC,QAClBzB,EAAK0B,YACNvB,EAAAH,EAEsB,eAAA,CACrB2B,MAAO,EACPC,KAAM,KACNH,MAAO,WACLzB,EAAKwB,aAAaK,QAClB7B,EAAK8B,SAAS,CAAElB,QAAQ,IAAQ,WAC9BZ,EAAKwB,aAAaG,MAAQI,YAAW,WACnC/B,EAAK8B,SAAS,CAAElB,QAAQ,GAC1B,GAAGZ,EAAKwB,aAAaI,KACvB,GACD,EACDC,MAAO,WACLG,aAAahC,EAAKwB,aAAaG,MACjC,IACDxB,EAAAH,EAAA,UAEgB,WACfiC,EAAKjC,EAAKD,MAAMmC,OAChBlC,EAAK8B,SAAS,CAAEK,aAAa,OA1D7BnC,EAAKa,MAAQ,CAAEsB,aAAa,EAAOvB,QAAQ,GAAOZ,CACpD,CAAC,OAAAoC,EAAAtC,EAJ2BuC,GAI3BC,EAAAxC,EAAA,CAAA,CAAAyC,IAAA,SAAAL,MAED,WAAM,IAAAM,EAAAC,EAAAC,EAAAC,KACEC,EAAaD,KAAK9B,MAAMD,OAAS+B,KAAKnB,aAAaI,KAAO,IAAM,EACtEiB,EAAiE,QAAjEL,UAAAC,EAAmCE,KAAK5C,MAAMO,aAAK,IAAAmC,OAAA,EAAhBA,EAAkBK,oBAAYN,IAAAA,EAAAA,EAAI,CAAE,EAA/DO,EAAKF,EAALE,MAAUD,EAAYE,EAAAH,EAAAI,GACxBC,EAAaP,KAAK9B,MAAMD,OAAS,uBAAyBmC,QAAAA,EAAS,oBACzE,OACEtC,EAAC0C,EAAOjC,EAAAA,EAAA,CACNkC,SACAL,MAAOG,EACPN,WAAYA,EACZS,KAAMV,KAAK9B,MAAMsB,YACjBmB,OAAQ,WAAF,OAAQZ,EAAKZ,SAAS,CAAEK,aAAa,GAAO,EAClDoB,QAAS,WAAF,OAAQb,EAAKZ,SAAS,CAAEK,aAAa,GAAQ,GAChDW,GAAY,GAAA,CAAA1B,SAEhBX,EAAC+C,EAAG,CAAClC,GAAI,CAAEmC,QAAS,eAAgBC,KAAM,YAAYtC,SAAGuB,KAAKgB,iBAGpE,IAAC"}
|
|
@@ -1,104 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { styled, Typography, Tooltip, tooltipClasses, Box, Stack, Divider, IconButton } from '@mui/material';
|
|
4
|
-
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
|
|
5
|
-
|
|
6
|
-
var _excluded = ["className"];
|
|
7
|
-
var HelpTooltip = function HelpTooltip(props) {
|
|
8
|
-
return jsx(HtmlTooltip, {
|
|
9
|
-
arrow: true,
|
|
10
|
-
placement: 'bottom',
|
|
11
|
-
title: jsxs(Stack, {
|
|
12
|
-
sx: {
|
|
13
|
-
gap: '6px',
|
|
14
|
-
py: '6px',
|
|
15
|
-
minWidth: '200px',
|
|
16
|
-
maxWidth: '400px '
|
|
17
|
-
},
|
|
18
|
-
children: [jsx(TooltipHeaderText, {
|
|
19
|
-
children: props.title
|
|
20
|
-
}), jsx(Divider, {}), jsx(Box, {
|
|
21
|
-
sx: {
|
|
22
|
-
p: '6px 12px'
|
|
23
|
-
},
|
|
24
|
-
children: props.children
|
|
25
|
-
})]
|
|
26
|
-
}),
|
|
27
|
-
children: jsx(Box, {
|
|
28
|
-
sx: _objectSpread2({
|
|
29
|
-
cursor: 'default'
|
|
30
|
-
}, props.sxIcon),
|
|
31
|
-
children: jsx(IconButton, {
|
|
32
|
-
size: 'small',
|
|
33
|
-
children: jsx(HelpOutlineIcon, {
|
|
34
|
-
fontSize: props.small ? 'small' : 'medium',
|
|
35
|
-
sx: {
|
|
36
|
-
color: 'rgb(25,103,210)'
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
var HelpTooltipWrap = function HelpTooltipWrap(props) {
|
|
44
|
-
return jsx(HtmlTooltip, {
|
|
45
|
-
arrow: true,
|
|
46
|
-
placement: 'bottom',
|
|
47
|
-
title: jsxs(Stack, {
|
|
48
|
-
sx: {
|
|
49
|
-
gap: '6px',
|
|
50
|
-
py: '6px',
|
|
51
|
-
minWidth: '200px',
|
|
52
|
-
maxWidth: '400px '
|
|
53
|
-
},
|
|
54
|
-
children: [jsx(TooltipHeaderText, {
|
|
55
|
-
children: props.title
|
|
56
|
-
}), jsx(Divider, {}), jsx(Box, {
|
|
57
|
-
sx: {
|
|
58
|
-
p: '6px 12px'
|
|
59
|
-
},
|
|
60
|
-
children: props.content
|
|
61
|
-
})]
|
|
62
|
-
}),
|
|
63
|
-
children: jsx(Box, {
|
|
64
|
-
sx: {
|
|
65
|
-
cursor: 'default'
|
|
66
|
-
},
|
|
67
|
-
children: props.children
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
var TooltipHeaderText = styled(function (props) {
|
|
72
|
-
return jsx(Typography, _objectSpread2({
|
|
73
|
-
variant: 'subtitle1'
|
|
74
|
-
}, props));
|
|
75
|
-
})({
|
|
76
|
-
color: '#0095ff',
|
|
77
|
-
fontWeight: 700,
|
|
78
|
-
padding: '0 10px'
|
|
79
|
-
});
|
|
80
|
-
var HtmlTooltip = styled(function (_ref) {
|
|
81
|
-
var className = _ref.className,
|
|
82
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
83
|
-
return jsx(Tooltip, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
84
|
-
classes: {
|
|
85
|
-
popper: className
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
})(function (_ref2) {
|
|
89
|
-
var theme = _ref2.theme;
|
|
90
|
-
return _defineProperty(_defineProperty({}, "& .".concat(tooltipClasses.tooltip), {
|
|
91
|
-
backgroundColor: '#fff',
|
|
92
|
-
color: '#3c3c3c',
|
|
93
|
-
maxWidth: 500,
|
|
94
|
-
minHeight: 120,
|
|
95
|
-
fontSize: theme.typography.pxToRem(12),
|
|
96
|
-
borderRadius: '8px',
|
|
97
|
-
boxShadow: 'rgba(0, 0, 0, 0.08) 0px 6px 30px'
|
|
98
|
-
}), "& .".concat(tooltipClasses.arrow), {
|
|
99
|
-
color: '#fff'
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
export { HelpTooltipWrap, HelpTooltip as default };
|
|
1
|
+
import{objectSpread2 as r,objectWithoutProperties as t,defineProperty as e}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i,jsxs as o}from"react/jsx-runtime";import{styled as n,Typography as l,Tooltip as a,tooltipClasses as p,Box as c,Stack as m,Divider as s,IconButton as x}from"@mui/material";import d from"@mui/icons-material/HelpOutline";var u=["className"],f=function(t){return i(g,{arrow:!0,placement:"bottom",title:o(m,{sx:{gap:"6px",py:"6px",minWidth:"200px",maxWidth:"400px "},children:[i(b,{children:t.title}),i(s,{}),i(c,{sx:{p:"6px 12px"},children:t.children})]}),children:i(c,{sx:r({cursor:"default"},t.sxIcon),children:i(x,{size:"small",children:i(d,{fontSize:t.small?"small":"medium",sx:{color:"rgb(25,103,210)"}})})})})},h=function(r){return i(g,{arrow:!0,placement:"bottom",title:o(m,{sx:{gap:"6px",py:"6px",minWidth:"200px",maxWidth:"400px "},children:[i(b,{children:r.title}),i(s,{}),i(c,{sx:{p:"6px 12px"},children:r.content})]}),children:i(c,{sx:{cursor:"default"},children:r.children})})},b=n((function(t){return i(l,r({variant:"subtitle1"},t))}))({color:"#0095ff",fontWeight:700,padding:"0 10px"}),g=n((function(e){var o=e.className,n=t(e,u);return i(a,r(r({},n),{},{classes:{popper:o}}))}))((function(r){var t=r.theme;return e(e({},"& .".concat(p.tooltip),{backgroundColor:"#fff",color:"#3c3c3c",maxWidth:500,minHeight:120,fontSize:t.typography.pxToRem(12),borderRadius:"8px",boxShadow:"rgba(0, 0, 0, 0.08) 0px 6px 30px"}),"& .".concat(p.arrow),{color:"#fff"})}));export{h as HelpTooltipWrap,f as default};
|
|
104
2
|
//# sourceMappingURL=help-tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-tooltip.js","sources":["../../src/components/help-tooltip.tsx"],"sourcesContent":["import React, { FC, PropsWithChildren, ReactNode } from 'react'\r\nimport { Box, Divider, IconButton, Stack, Tooltip, Typography } from '@mui/material'\r\nimport { SxProps, Theme, TooltipProps, TypographyProps, styled, tooltipClasses } from '@mui/material'\r\nimport HelpOutlineIcon from '@mui/icons-material/HelpOutline'\r\n\r\nexport interface IHelpTooltipProps {\r\n title: string\r\n small?: boolean\r\n sxIcon?: SxProps<Theme>\r\n}\r\n\r\nconst HelpTooltip: FC<PropsWithChildren<IHelpTooltipProps>> = (props) => (\r\n <HtmlTooltip\r\n arrow\r\n placement='bottom'\r\n title={\r\n <Stack sx={{ gap: '6px', py: '6px', minWidth: '200px', maxWidth: '400px ' }}>\r\n <TooltipHeaderText>{props.title}</TooltipHeaderText>\r\n <Divider />\r\n <Box sx={{ p: '6px 12px' }}>{props.children}</Box>\r\n </Stack>\r\n }\r\n >\r\n <Box sx={{ cursor: 'default', ...props.sxIcon }}>\r\n <IconButton size='small'>\r\n <HelpOutlineIcon fontSize={props.small ? 'small' : 'medium'} sx={{ color: 'rgb(25,103,210)' }} />\r\n </IconButton>\r\n </Box>\r\n </HtmlTooltip>\r\n)\r\n\r\nexport default HelpTooltip\r\n\r\nexport interface IHelpTooltipWrapProps {\r\n content: ReactNode\r\n title: string\r\n children: React.ReactNode\r\n}\r\n\r\nexport const HelpTooltipWrap: FC<IHelpTooltipWrapProps> = (props) => (\r\n <HtmlTooltip\r\n arrow\r\n placement='bottom'\r\n title={\r\n <Stack sx={{ gap: '6px', py: '6px', minWidth: '200px', maxWidth: '400px ' }}>\r\n <TooltipHeaderText>{props.title}</TooltipHeaderText>\r\n <Divider />\r\n <Box sx={{ p: '6px 12px' }}>{props.content}</Box>\r\n </Stack>\r\n }\r\n >\r\n <Box sx={{ cursor: 'default' }}>{props.children}</Box>\r\n </HtmlTooltip>\r\n)\r\n\r\nconst TooltipHeaderText = styled((props: TypographyProps) => <Typography variant='subtitle1' {...props} />)({\r\n color: '#0095ff',\r\n fontWeight: 700,\r\n padding: '0 10px'\r\n})\r\n\r\nconst HtmlTooltip = styled(({ className, ...props }: TooltipProps) => <Tooltip {...props} classes={{ popper: className }} />)(({ theme }) => ({\r\n [`& .${tooltipClasses.tooltip}`]: {\r\n backgroundColor: '#fff',\r\n color: '#3c3c3c',\r\n maxWidth: 500,\r\n minHeight: 120,\r\n fontSize: theme.typography.pxToRem(12),\r\n borderRadius: '8px',\r\n boxShadow: 'rgba(0, 0, 0, 0.08) 0px 6px 30px'\r\n },\r\n [`& .${tooltipClasses.arrow}`]: {\r\n color: '#fff'\r\n }\r\n}))\r\n"],"names":["HelpTooltip","props","_jsx","HtmlTooltip","arrow","placement","title","_jsxs","Stack","sx","gap","py","minWidth","maxWidth","children","TooltipHeaderText","Divider","Box","p","_objectSpread","cursor","sxIcon","IconButton","size","HelpOutlineIcon","fontSize","small","color","HelpTooltipWrap","content","styled","Typography","variant","fontWeight","padding","_ref","className","_objectWithoutProperties","_excluded","Tooltip","classes","popper","_ref2","theme","_defineProperty","concat","tooltipClasses","tooltip","backgroundColor","minHeight","typography","pxToRem","borderRadius","boxShadow"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-tooltip.js","sources":["../../src/components/help-tooltip.tsx"],"sourcesContent":["import React, { FC, PropsWithChildren, ReactNode } from 'react'\r\nimport { Box, Divider, IconButton, Stack, Tooltip, Typography } from '@mui/material'\r\nimport { SxProps, Theme, TooltipProps, TypographyProps, styled, tooltipClasses } from '@mui/material'\r\nimport HelpOutlineIcon from '@mui/icons-material/HelpOutline'\r\n\r\nexport interface IHelpTooltipProps {\r\n title: string\r\n small?: boolean\r\n sxIcon?: SxProps<Theme>\r\n}\r\n\r\nconst HelpTooltip: FC<PropsWithChildren<IHelpTooltipProps>> = (props) => (\r\n <HtmlTooltip\r\n arrow\r\n placement='bottom'\r\n title={\r\n <Stack sx={{ gap: '6px', py: '6px', minWidth: '200px', maxWidth: '400px ' }}>\r\n <TooltipHeaderText>{props.title}</TooltipHeaderText>\r\n <Divider />\r\n <Box sx={{ p: '6px 12px' }}>{props.children}</Box>\r\n </Stack>\r\n }\r\n >\r\n <Box sx={{ cursor: 'default', ...props.sxIcon }}>\r\n <IconButton size='small'>\r\n <HelpOutlineIcon fontSize={props.small ? 'small' : 'medium'} sx={{ color: 'rgb(25,103,210)' }} />\r\n </IconButton>\r\n </Box>\r\n </HtmlTooltip>\r\n)\r\n\r\nexport default HelpTooltip\r\n\r\nexport interface IHelpTooltipWrapProps {\r\n content: ReactNode\r\n title: string\r\n children: React.ReactNode\r\n}\r\n\r\nexport const HelpTooltipWrap: FC<IHelpTooltipWrapProps> = (props) => (\r\n <HtmlTooltip\r\n arrow\r\n placement='bottom'\r\n title={\r\n <Stack sx={{ gap: '6px', py: '6px', minWidth: '200px', maxWidth: '400px ' }}>\r\n <TooltipHeaderText>{props.title}</TooltipHeaderText>\r\n <Divider />\r\n <Box sx={{ p: '6px 12px' }}>{props.content}</Box>\r\n </Stack>\r\n }\r\n >\r\n <Box sx={{ cursor: 'default' }}>{props.children}</Box>\r\n </HtmlTooltip>\r\n)\r\n\r\nconst TooltipHeaderText = styled((props: TypographyProps) => <Typography variant='subtitle1' {...props} />)({\r\n color: '#0095ff',\r\n fontWeight: 700,\r\n padding: '0 10px'\r\n})\r\n\r\nconst HtmlTooltip = styled(({ className, ...props }: TooltipProps) => <Tooltip {...props} classes={{ popper: className }} />)(({ theme }) => ({\r\n [`& .${tooltipClasses.tooltip}`]: {\r\n backgroundColor: '#fff',\r\n color: '#3c3c3c',\r\n maxWidth: 500,\r\n minHeight: 120,\r\n fontSize: theme.typography.pxToRem(12),\r\n borderRadius: '8px',\r\n boxShadow: 'rgba(0, 0, 0, 0.08) 0px 6px 30px'\r\n },\r\n [`& .${tooltipClasses.arrow}`]: {\r\n color: '#fff'\r\n }\r\n}))\r\n"],"names":["HelpTooltip","props","_jsx","HtmlTooltip","arrow","placement","title","_jsxs","Stack","sx","gap","py","minWidth","maxWidth","children","TooltipHeaderText","Divider","Box","p","_objectSpread","cursor","sxIcon","IconButton","size","HelpOutlineIcon","fontSize","small","color","HelpTooltipWrap","content","styled","Typography","variant","fontWeight","padding","_ref","className","_objectWithoutProperties","_excluded","Tooltip","classes","popper","_ref2","theme","_defineProperty","concat","tooltipClasses","tooltip","backgroundColor","minHeight","typography","pxToRem","borderRadius","boxShadow"],"mappings":"wXAWMA,EAAwD,SAACC,GAAK,OAClEC,EAACC,EAAW,CACVC,OAAK,EACLC,UAAU,SACVC,MACEC,EAACC,EAAM,CAAAC,GAAI,CAAEC,IAAK,MAAOC,GAAI,MAAOC,SAAU,QAASC,SAAU,UAC/DC,SAAA,CAAAZ,EAACa,EAAiB,CAAAD,SAAEb,EAAMK,QAC1BJ,EAACc,EAAO,CAAA,GACRd,EAACe,EAAG,CAACR,GAAI,CAAES,EAAG,YAAYJ,SAAGb,EAAMa,cAC7BA,SAGVZ,EAACe,EAAI,CAAAR,GAAEU,EAAA,CAAIC,OAAQ,WAAcnB,EAAMoB,QAAQP,SAC7CZ,EAACoB,EAAW,CAAAC,KAAK,QACfT,SAAAZ,EAACsB,EAAe,CAACC,SAAUxB,EAAMyB,MAAQ,QAAU,SAAUjB,GAAI,CAAEkB,MAAO,0BAGlE,EAWHC,EAA6C,SAAC3B,GAAK,OAC9DC,EAACC,GACCC,OAAK,EACLC,UAAU,SACVC,MACEC,EAACC,EAAK,CAACC,GAAI,CAAEC,IAAK,MAAOC,GAAI,MAAOC,SAAU,QAASC,SAAU,UAC/DC,SAAA,CAAAZ,EAACa,EAAiB,CAAAD,SAAEb,EAAMK,QAC1BJ,EAACc,EAAU,CAAA,GACXd,EAACe,EAAG,CAACR,GAAI,CAAES,EAAG,YAAeJ,SAAAb,EAAM4B,aAIvCf,SAAAZ,EAACe,EAAI,CAAAR,GAAI,CAAEW,OAAQ,oBAAcnB,EAAMa,YAC3B,EAGVC,EAAoBe,GAAO,SAAC7B,GAAsB,OAAKC,EAAC6B,EAAUZ,EAAA,CAACa,QAAQ,aAAgB/B,GAAS,GAAhF6B,CAAkF,CAC1GH,MAAO,UACPM,WAAY,IACZC,QAAS,WAGL/B,EAAc2B,GAAO,SAAAK,GAAA,IAAGC,EAASD,EAATC,UAAcnC,EAAKoC,EAAAF,EAAAG,GAAA,OAAqBpC,EAACqC,EAAOpB,EAAAA,KAAKlB,GAAK,GAAA,CAAEuC,QAAS,CAAEC,OAAQL,KAAe,GAAxGN,EAA0G,SAAAY,GAAA,IAAGC,EAAKD,EAALC,MAAK,OAAAC,EAAAA,EAAA,CAAA,EAAA,MAAAC,OAC7HC,EAAeC,SAAY,CAChCC,gBAAiB,OACjBrB,MAAO,UACPd,SAAU,IACVoC,UAAW,IACXxB,SAAUkB,EAAMO,WAAWC,QAAQ,IACnCC,aAAc,MACdC,UAAW,2CACZR,OACMC,EAAe1C,OAAU,CAC9BuB,MAAO,QACR"}
|
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useEffect, Fragment as Fragment$1 } from 'react';
|
|
4
|
-
import { useDebounce } from '../hooks/index.js';
|
|
5
|
-
|
|
6
|
-
var _excluded = ["src", "fallbackSrc", "alt", "loading", "debounceDelay"];
|
|
7
|
-
var ImageWithFallback = function ImageWithFallback(_ref) {
|
|
8
|
-
var src = _ref.src,
|
|
9
|
-
fallbackSrc = _ref.fallbackSrc,
|
|
10
|
-
alt = _ref.alt,
|
|
11
|
-
loading = _ref.loading,
|
|
12
|
-
_ref$debounceDelay = _ref.debounceDelay,
|
|
13
|
-
debounceDelay = _ref$debounceDelay === void 0 ? 0 : _ref$debounceDelay,
|
|
14
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
var debouncedSrc = useDebounce(src, debounceDelay);
|
|
16
|
-
var debouncedFallbackSrc = useDebounce(fallbackSrc, debounceDelay);
|
|
17
|
-
var effectiveSrc = debounceDelay > 0 ? debouncedSrc : src;
|
|
18
|
-
var effectiveFallbackSrc = debounceDelay > 0 ? debouncedFallbackSrc : fallbackSrc;
|
|
19
|
-
var _useState = useState(true),
|
|
20
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
-
isLoading = _useState2[0],
|
|
22
|
-
setLoading = _useState2[1];
|
|
23
|
-
var _useState3 = useState(effectiveSrc !== null && effectiveSrc !== void 0 ? effectiveSrc : effectiveFallbackSrc),
|
|
24
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
-
imgSrc = _useState4[0],
|
|
26
|
-
setImgSrc = _useState4[1];
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
setImgSrc(effectiveSrc !== null && effectiveSrc !== void 0 ? effectiveSrc : effectiveFallbackSrc);
|
|
29
|
-
setLoading(true);
|
|
30
|
-
}, [effectiveSrc, effectiveFallbackSrc]);
|
|
31
|
-
var loadingElement = isLoading && loading ? loading : jsx(Fragment, {});
|
|
32
|
-
return jsxs(Fragment$1, {
|
|
33
|
-
children: [loadingElement, jsx("img", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
34
|
-
src: imgSrc,
|
|
35
|
-
alt: alt,
|
|
36
|
-
onLoadStart: function onLoadStart() {
|
|
37
|
-
return setLoading(true);
|
|
38
|
-
},
|
|
39
|
-
onLoad: function onLoad() {
|
|
40
|
-
return setLoading(false);
|
|
41
|
-
},
|
|
42
|
-
onError: function onError() {
|
|
43
|
-
setImgSrc(fallbackSrc);
|
|
44
|
-
setLoading(false);
|
|
45
|
-
}
|
|
46
|
-
}))]
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { ImageWithFallback as default };
|
|
1
|
+
import{objectWithoutProperties as r,slicedToArray as o,objectSpread2 as a}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as t,Fragment as n,jsxs as e}from"react/jsx-runtime";import{useState as l,useEffect as i,Fragment as c}from"react";import{useDebounce as u}from"../hooks/index.js";var s=["src","fallbackSrc","alt","loading","debounceDelay"],d=function(d){var f=d.src,m=d.fallbackSrc,p=d.alt,b=d.loading,g=d.debounceDelay,j=void 0===g?0:g,v=r(d,s),S=u(f,j),h=u(m,j),k=j>0?S:f,x=j>0?h:m,y=l(!0),D=o(y,2),L=D[0],P=D[1],_=l(null!=k?k:x),A=o(_,2),B=A[0],E=A[1];i((function(){E(null!=k?k:x),P(!0)}),[k,x]);var F=L&&b?b:t(n,{});return e(c,{children:[F,t("img",a(a({},v),{},{src:B,alt:p,onLoadStart:function(){return P(!0)},onLoad:function(){return P(!1)},onError:function(){E(m),P(!1)}}))]})};export{d as default};
|
|
51
2
|
//# sourceMappingURL=image-with-fallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-with-fallback.js","sources":["../../src/components/image-with-fallback.tsx"],"sourcesContent":["import React, { FC, Fragment, ReactNode, useEffect, useState } from 'react'\r\nimport { useDebounce } from '../hooks'\r\n\r\nexport interface IImageWithFallbackPropsOwner {\r\n src?: string\r\n alt?: string\r\n fallbackSrc: string\r\n loading?: ReactNode\r\n debounceDelay?: number\r\n}\r\n\r\nexport type IImageProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, keyof IImageWithFallbackPropsOwner>\r\n\r\nexport interface IImageWithFallbackProps extends IImageProps, IImageWithFallbackPropsOwner {}\r\n\r\nconst ImageWithFallback: FC<IImageWithFallbackProps> = ({ src, fallbackSrc, alt, loading, debounceDelay = 0, ...props }) => {\r\n const debouncedSrc = useDebounce(src, debounceDelay)\r\n const debouncedFallbackSrc = useDebounce(fallbackSrc, debounceDelay)\r\n\r\n const effectiveSrc = debounceDelay > 0 ? debouncedSrc : src\r\n const effectiveFallbackSrc = debounceDelay > 0 ? debouncedFallbackSrc : fallbackSrc\r\n\r\n const [isLoading, setLoading] = useState(true)\r\n const [imgSrc, setImgSrc] = useState(effectiveSrc ?? effectiveFallbackSrc)\r\n\r\n useEffect(() => {\r\n setImgSrc(effectiveSrc ?? effectiveFallbackSrc)\r\n setLoading(true)\r\n }, [effectiveSrc, effectiveFallbackSrc])\r\n\r\n const loadingElement = isLoading && loading ? loading : <></>\r\n\r\n return (\r\n <Fragment>\r\n {loadingElement}\r\n <img\r\n {...props}\r\n src={imgSrc}\r\n alt={alt}\r\n onLoadStart={() => setLoading(true)}\r\n onLoad={() => setLoading(false)}\r\n onError={() => {\r\n setImgSrc(fallbackSrc)\r\n setLoading(false)\r\n }}\r\n />\r\n </Fragment>\r\n )\r\n}\r\n\r\nexport default ImageWithFallback\r\n"],"names":["ImageWithFallback","_ref","src","fallbackSrc","alt","loading","_ref$debounceDelay","debounceDelay","props","_objectWithoutProperties","_excluded","debouncedSrc","useDebounce","debouncedFallbackSrc","effectiveSrc","effectiveFallbackSrc","_useState","useState","_useState2","_slicedToArray","isLoading","setLoading","_useState3","_useState4","imgSrc","setImgSrc","useEffect","loadingElement","_jsx","_jsxs","Fragment","onLoadStart","onLoad","onError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"image-with-fallback.js","sources":["../../src/components/image-with-fallback.tsx"],"sourcesContent":["import React, { FC, Fragment, ReactNode, useEffect, useState } from 'react'\r\nimport { useDebounce } from '../hooks'\r\n\r\nexport interface IImageWithFallbackPropsOwner {\r\n src?: string\r\n alt?: string\r\n fallbackSrc: string\r\n loading?: ReactNode\r\n debounceDelay?: number\r\n}\r\n\r\nexport type IImageProps = Omit<React.ImgHTMLAttributes<HTMLImageElement>, keyof IImageWithFallbackPropsOwner>\r\n\r\nexport interface IImageWithFallbackProps extends IImageProps, IImageWithFallbackPropsOwner {}\r\n\r\nconst ImageWithFallback: FC<IImageWithFallbackProps> = ({ src, fallbackSrc, alt, loading, debounceDelay = 0, ...props }) => {\r\n const debouncedSrc = useDebounce(src, debounceDelay)\r\n const debouncedFallbackSrc = useDebounce(fallbackSrc, debounceDelay)\r\n\r\n const effectiveSrc = debounceDelay > 0 ? debouncedSrc : src\r\n const effectiveFallbackSrc = debounceDelay > 0 ? debouncedFallbackSrc : fallbackSrc\r\n\r\n const [isLoading, setLoading] = useState(true)\r\n const [imgSrc, setImgSrc] = useState(effectiveSrc ?? effectiveFallbackSrc)\r\n\r\n useEffect(() => {\r\n setImgSrc(effectiveSrc ?? effectiveFallbackSrc)\r\n setLoading(true)\r\n }, [effectiveSrc, effectiveFallbackSrc])\r\n\r\n const loadingElement = isLoading && loading ? loading : <></>\r\n\r\n return (\r\n <Fragment>\r\n {loadingElement}\r\n <img\r\n {...props}\r\n src={imgSrc}\r\n alt={alt}\r\n onLoadStart={() => setLoading(true)}\r\n onLoad={() => setLoading(false)}\r\n onError={() => {\r\n setImgSrc(fallbackSrc)\r\n setLoading(false)\r\n }}\r\n />\r\n </Fragment>\r\n )\r\n}\r\n\r\nexport default ImageWithFallback\r\n"],"names":["ImageWithFallback","_ref","src","fallbackSrc","alt","loading","_ref$debounceDelay","debounceDelay","props","_objectWithoutProperties","_excluded","debouncedSrc","useDebounce","debouncedFallbackSrc","effectiveSrc","effectiveFallbackSrc","_useState","useState","_useState2","_slicedToArray","isLoading","setLoading","_useState3","_useState4","imgSrc","setImgSrc","useEffect","loadingElement","_jsx","_jsxs","Fragment","onLoadStart","onLoad","onError"],"mappings":"mWAeMA,EAAiD,SAAhCC,GAAoG,IAAjEC,EAAGD,EAAHC,IAAKC,EAAWF,EAAXE,YAAaC,EAAGH,EAAHG,IAAKC,EAAOJ,EAAPI,QAAOC,EAAAL,EAAEM,cAAAA,OAAgB,IAAHD,EAAG,EAACA,EAAKE,EAAKC,EAAAR,EAAAS,GAC7GC,EAAeC,EAAYV,EAAKK,GAChCM,EAAuBD,EAAYT,EAAaI,GAEhDO,EAAeP,EAAgB,EAAII,EAAeT,EAClDa,EAAuBR,EAAgB,EAAIM,EAAuBV,EAExEa,EAAgCC,GAAS,GAAKC,EAAAC,EAAAH,EAAA,GAAvCI,EAASF,EAAA,GAAEG,EAAUH,EAAA,GAC5BI,EAA4BL,EAASH,QAAAA,EAAgBC,GAAqBQ,EAAAJ,EAAAG,EAAA,GAAnEE,EAAMD,EAAA,GAAEE,EAASF,EAAA,GAExBG,GAAU,WACRD,EAAUX,QAAAA,EAAgBC,GAC1BM,GAAW,EACb,GAAG,CAACP,EAAcC,IAElB,IAAMY,EAAiBP,GAAaf,EAAUA,EAAUuB,QAExD,OACEC,EAACC,aACEH,EACDC,eACMpB,GAAK,GAAA,CACTN,IAAKsB,EACLpB,IAAKA,EACL2B,YAAa,WAAF,OAAQV,GAAW,EAAK,EACnCW,OAAQ,WAAF,OAAQX,GAAW,EAAM,EAC/BY,QAAS,WACPR,EAAUtB,GACVkB,GAAW,EACb,OAIR"}
|