dinocollab-shared 1.2.41 → 1.2.43
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/cart/styled.js +1 -1
- package/dist/cart/styled.js.map +1 -1
- package/dist/cart/widget.js +1 -1
- package/dist/cart/widget.js.map +1 -1
- package/dist/components/buttons.js +1 -1
- package/dist/components/buttons.js.map +1 -1
- package/dist/factory/cart-content/create.cart-content.js +2 -0
- package/dist/factory/cart-content/create.cart-content.js.map +1 -0
- package/dist/factory/cart-content/styled.js +2 -0
- package/dist/factory/cart-content/styled.js.map +1 -0
- package/dist/factory/cart-item/create.cart-item.js +2 -0
- package/dist/factory/cart-item/create.cart-item.js.map +1 -0
- package/dist/factory/cart-item/styled.js +2 -0
- package/dist/factory/cart-item/styled.js.map +1 -0
- package/dist/media-player/core/videoplayer.js.map +1 -1
- package/dist/media-right/media-widget/index.js +1 -1
- package/dist/media-right/media-widget/index.js.map +1 -1
- package/dist/media-right/media-widget/media-group-accordion.js +1 -1
- package/dist/media-right/media-widget/media-group-accordion.js.map +1 -1
- package/dist/media-right/media-widget/styled.js +1 -1
- package/dist/media-right/media-widget/styled.js.map +1 -1
- package/dist/notification/notify-list.js +1 -1
- package/dist/notification/notify-list.js.map +1 -1
- package/dist/notification/widget.js +1 -1
- package/dist/notification/widget.js.map +1 -1
- package/dist/types/cart/styled.d.ts +3 -15
- package/dist/types/cart/styled.d.ts.map +1 -1
- package/dist/types/cart/widget.d.ts +7 -7
- package/dist/types/cart/widget.d.ts.map +1 -1
- package/dist/types/components/buttons.d.ts +1 -0
- package/dist/types/components/buttons.d.ts.map +1 -1
- package/dist/types/factory/cart-content/create.cart-content.d.ts +5 -0
- package/dist/types/factory/cart-content/create.cart-content.d.ts.map +1 -0
- package/dist/types/factory/cart-content/index.d.ts +3 -0
- package/dist/types/factory/cart-content/index.d.ts.map +1 -0
- package/dist/types/factory/cart-content/styled.d.ts +10 -0
- package/dist/types/factory/cart-content/styled.d.ts.map +1 -0
- package/dist/types/factory/cart-content/types.d.ts +49 -0
- package/dist/types/factory/cart-content/types.d.ts.map +1 -0
- package/dist/types/factory/cart-item/create.cart-item.d.ts +5 -0
- package/dist/types/factory/cart-item/create.cart-item.d.ts.map +1 -0
- package/dist/types/factory/cart-item/index.d.ts +3 -0
- package/dist/types/factory/cart-item/index.d.ts.map +1 -0
- package/dist/types/factory/cart-item/styled.d.ts +8 -0
- package/dist/types/factory/cart-item/styled.d.ts.map +1 -0
- package/dist/types/factory/cart-item/types.d.ts +25 -0
- package/dist/types/factory/cart-item/types.d.ts.map +1 -0
- package/dist/types/factory/index.d.ts +3 -0
- package/dist/types/factory/index.d.ts.map +1 -0
- package/dist/types/media-player/core/videoplayer.d.ts +2 -2
- package/dist/types/media-player/core/videoplayer.d.ts.map +1 -1
- package/dist/types/media-right/index.d.ts +0 -1
- package/dist/types/media-right/index.d.ts.map +1 -1
- package/dist/types/media-right/media-widget/index.d.ts +10 -3
- package/dist/types/media-right/media-widget/index.d.ts.map +1 -1
- package/dist/types/media-right/media-widget/media-group-accordion.d.ts +9 -3
- package/dist/types/media-right/media-widget/media-group-accordion.d.ts.map +1 -1
- package/dist/types/media-right/media-widget/styled.d.ts +2 -13
- package/dist/types/media-right/media-widget/styled.d.ts.map +1 -1
- package/dist/types/notification/notify-list.d.ts +11 -2
- package/dist/types/notification/notify-list.d.ts.map +1 -1
- package/dist/types/notification/widget.d.ts +2 -0
- package/dist/types/notification/widget.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/media-right/media-widget/item-title-props-context.js +0 -2
- package/dist/media-right/media-widget/item-title-props-context.js.map +0 -1
- package/dist/media-right/media-widget/media-list.js +0 -2
- package/dist/media-right/media-widget/media-list.js.map +0 -1
- package/dist/media-right/media-widget/units.js +0 -2
- package/dist/media-right/media-widget/units.js.map +0 -1
- package/dist/types/media-right/media-widget/item-title-props-context.d.ts +0 -15
- package/dist/types/media-right/media-widget/item-title-props-context.d.ts.map +0 -1
- package/dist/types/media-right/media-widget/media-list.d.ts +0 -8
- package/dist/types/media-right/media-widget/media-list.d.ts.map +0 -1
- package/dist/types/media-right/media-widget/units.d.ts +0 -3
- package/dist/types/media-right/media-widget/units.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-group-accordion.js","sources":["../../../src/media-right/media-widget/media-group-accordion.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"media-group-accordion.js","sources":["../../../src/media-right/media-widget/media-group-accordion.tsx"],"sourcesContent":["// imports\r\nimport { useState } from 'react'\r\nimport { Accordion, AccordionSummary, AccordionDetails, Box, Typography, Chip, IconButton, styled, accordionSummaryClasses } from '@mui/material'\r\nimport EditIcon from '@mui/icons-material/Edit'\r\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore'\r\nimport FolderOutlinedIcon from '@mui/icons-material/FolderOutlined'\r\nimport { DeleteButton } from './button.delete'\r\nimport { InlineEditing } from './inline-editing'\r\nimport { mediaRightStoreOptions } from '../configs'\r\n// types\r\nimport type { ComponentType, FC, MouseEvent } from 'react'\r\nimport type { AccordionProps, AccordionDetailsProps, AccordionSummaryProps, BoxProps, TypographyProps } from '@mui/material'\r\nimport type { IMediaRightGroup, IMediaRightItem } from '../types'\r\n\r\nexport interface IMediaGroupAccordionProps {\r\n group: IMediaRightGroup\r\n accordionProps?: Partial<AccordionProps>\r\n accordionSummaryProps?: Partial<AccordionSummaryProps>\r\n accordionDetailsProps?: Partial<AccordionDetailsProps>\r\n renderItem?: (item: IMediaRightItem) => React.ReactNode\r\n onEditGroup: (group: IMediaRightGroup) => void\r\n onDeleteGroup: (groupId: string) => void\r\n onDeleteMedia: (groupId: string, mediaId: string) => void\r\n}\r\n\r\nexport const MediaGroupAccordion: FC<IMediaGroupAccordionProps> = (props) => {\r\n const [isEditing, setIsEditing] = useState(false)\r\n\r\n const handleSaveEdit = (value: string) => {\r\n props.onEditGroup({ ...props.group, name: value })\r\n setIsEditing(false)\r\n }\r\n\r\n const handleEditClick = (e: MouseEvent) => {\r\n e.stopPropagation()\r\n setIsEditing(true)\r\n }\r\n\r\n return (\r\n <PlaylistAccordion component='div' {...props.accordionProps} sx={{ my: '0 !important', ...props.accordionProps?.sx }}>\r\n <AccordionSummary component='div' expandIcon={<ExpandMoreIcon />} {...props.accordionSummaryProps}>\r\n <ItemBox>\r\n <FolderOutlinedIcon fontSize='small' />\r\n <InlineEditing\r\n key={props.group.id + props.group.name + isEditing}\r\n isEdit={isEditing}\r\n setShowEdit={setIsEditing}\r\n onSubmit={handleSaveEdit}\r\n defaultValue={props.group.name}\r\n textField={{\r\n inputProps: { maxLength: mediaRightStoreOptions.MAX_NAME_GROUP },\r\n sx: { flex: 1, minWidth: 0, '& .MuiOutlinedInput-root': { height: '32px' } }\r\n }}\r\n sxForm={{ flex: 1 }}\r\n >\r\n <ItemTitle variant='body2' noWrap title={props.group.name}>\r\n {props.group.name}\r\n </ItemTitle>\r\n <Chip sx={{ fontSize: '12px' }} label={`${props.group.items.length} items`} size='small' />\r\n <IconButton size='small' onClick={handleEditClick} color='success'>\r\n <EditIcon fontSize='small' />\r\n </IconButton>\r\n <DeleteButton onDelete={() => props.onDeleteGroup(props.group.id)} size='small' />\r\n </InlineEditing>\r\n </ItemBox>\r\n </AccordionSummary>\r\n <AccordionDetails {...props.accordionDetailsProps}>\r\n {props.group.items.map((item) => (props.renderItem ? props.renderItem(item) : null))}\r\n </AccordionDetails>\r\n </PlaylistAccordion>\r\n )\r\n}\r\n\r\nexport const PlaylistAccordion: ComponentType<AccordionProps> = styled(Accordion)({\r\n backgroundColor: 'transparent',\r\n boxShadow: 'none',\r\n backgroundImage: 'none',\r\n '&:before': { display: 'none' },\r\n '&.Mui-expanded': { margin: 0 },\r\n [`.${accordionSummaryClasses.root}`]: {\r\n position: 'sticky',\r\n top: 0,\r\n zIndex: 1,\r\n background: 'rgba(var(--color-bg-rba),0.7)',\r\n backdropFilter: 'blur(500px)',\r\n WebkitBackdropFilter: 'blur(500px)',\r\n borderRadius: '12px',\r\n minWidth: 0,\r\n [`& .${accordionSummaryClasses.content}`]: {\r\n minWidth: 0,\r\n margin: 0\r\n }\r\n }\r\n})\r\n\r\nexport const ItemBox: ComponentType<BoxProps> = styled(Box)(({ theme }) => ({\r\n display: 'flex',\r\n alignItems: 'center',\r\n flex: 1,\r\n gap: theme.spacing(1),\r\n minWidth: 0\r\n}))\r\n\r\nexport const ItemTitle: ComponentType<TypographyProps> = styled(Typography)(({ theme }) => ({\r\n fontWeight: 600,\r\n flex: 1,\r\n minWidth: 0,\r\n color: theme.palette.text.primary,\r\n marginLeft: theme.spacing(1)\r\n}))\r\n"],"names":["MediaGroupAccordion","props","_props$accordionProps","_useState","useState","_useState2","_slicedToArray","isEditing","setIsEditing","_jsxs","PlaylistAccordion","_objectSpread","component","accordionProps","sx","my","children","_jsx","AccordionSummary","expandIcon","ExpandMoreIcon","accordionSummaryProps","ItemBox","FolderOutlinedIcon","fontSize","InlineEditing","isEdit","setShowEdit","onSubmit","value","onEditGroup","group","name","defaultValue","textField","inputProps","maxLength","mediaRightStoreOptions","MAX_NAME_GROUP","flex","minWidth","height","sxForm","ItemTitle","variant","noWrap","title","Chip","label","concat","items","length","size","IconButton","onClick","e","stopPropagation","color","EditIcon","DeleteButton","onDelete","onDeleteGroup","id","AccordionDetails","accordionDetailsProps","map","item","renderItem","styled","Accordion","_defineProperty","backgroundColor","boxShadow","backgroundImage","display","margin","accordionSummaryClasses","root","position","top","zIndex","background","backdropFilter","WebkitBackdropFilter","borderRadius","content","Box","_ref","alignItems","gap","theme","spacing","Typography","_ref2","fontWeight","palette","text","primary","marginLeft"],"mappings":"iqBAyBaA,EAAqD,SAACC,GAAS,IAAAC,EAC1EC,EAAkCC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAA1CI,EAASF,EAAA,GAAEG,EAAYH,EAAA,GAY9B,OACEI,EAACC,EAAiBC,EAAAA,EAAA,CAACC,UAAU,OAAUX,EAAMY,gBAAc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+D,uBAAqB,GAAA,CAC9ChD,SAAAf,EAAM8B,MAAMmB,MAAMe,IAAI,SAACC,GAAI,OAAMjE,EAAMkE,WAAalE,EAAMkE,WAAWD,GAAQ,IAAK,SAI3F,EAEaxD,EAAmD0D,EAAOC,EAAPD,CAAiBE,EAAA,CAC/EC,gBAAiB,cACjBC,UAAW,OACXC,gBAAiB,OACjB,WAAY,CAAEC,QAAS,QACvB,iBAAkB,CAAEC,OAAQ,IAAG,IAAA1B,OAC1B2B,EAAwBC,MAAIP,EAAA,CAC/BQ,SAAU,SACVC,IAAK,EACLC,OAAQ,EACRC,WAAY,gCACZC,eAAgB,cAChBC,qBAAsB,cACtBC,aAAc,OACd5C,SAAU,GAAC,MAAAS,OACJ2B,EAAwBS,SAAY,CACzC7C,SAAU,EACVmC,OAAQ,MAKDrD,EAAmC8C,EAAOkB,EAAPlB,CAAY,SAAAmB,GAAQ,MAAQ,CAC1Eb,QAAS,OACTc,WAAY,SACZjD,KAAM,EACNkD,IAJkEF,EAALG,MAIlDC,QAAQ,GACnBnD,SAAU,EACX,GAEYG,EAA4CyB,EAAOwB,EAAPxB,CAAmB,SAAAyB,GAAA,IAAGH,EAAKG,EAALH,MAAK,MAAQ,CAC1FI,WAAY,IACZvD,KAAM,EACNC,SAAU,EACViB,MAAOiC,EAAMK,QAAQC,KAAKC,QAC1BC,WAAYR,EAAMC,QAAQ,GAC3B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{styled as r,Stack as o,Menu as t}from"@mui/material";var a=r(o)(function(r){var o=r.theme;return{"--color-bg":"dark"===o.palette.mode?"#121212":o.palette.background.paper,"--color-bg-rba":"dark"===o.palette.mode?"18, 18, 18":"255, 255, 255","--color-text":o.palette.text.primary,"--cart-color-bg":"var(--color-bg)",height:"100%"}}),e=r(t)(function(r){var o=r.theme;return{"--color-bg":"dark"===o.palette.mode?"#121212":o.palette.background.paper,"--color-text":o.palette.text.primary,"--cart-color-bg":"var(--color-bg)",marginTop:"45px","> .MuiPaper-root":{position:"relative",overflow:"visible",display:"flex",flexDirection:"column",backgroundColor:"var(--color-bg, #000000)",borderRadius:o.shape.borderRadius,minWidth:"280px",maxWidth:"550px",boxShadow:"0 1px 1px rgba(0, 0, 0, 0.05), 0 2px 2px rgba(0, 0, 0, 0.2), 0 4px 4px rgba(0, 0, 0, 0.15), 0 8px 8px rgba(0, 0, 0, 0.05)",animation:"fadeInDown 0.3s ease-out",marginTop:"8px",color:"var(--color-text, #000000)","@keyframes fadeInDown":{"0%":{opacity:0,transform:"translateY(-10px)"},"100%":{opacity:1,transform:"translateY(0)"}},"&::before":{content:'""',position:"absolute",backgroundColor:"var(--color-bg, #ffffff)",width:"10px",height:"10px",top:"-4px",right:o.spacing(1),transform:"translateX(-50%) rotate(45deg)",zIndex:0}},".MuiBackdrop-root":{backgroundColor:"transparent"},".MuiList-root":{padding:0,height:"100%",minHeight:0,maxHeight:"60vh"}}});export{e as MenuStyled,a as Root};
|
|
2
2
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sources":["../../../src/media-right/media-widget/styled.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"styled.js","sources":["../../../src/media-right/media-widget/styled.tsx"],"sourcesContent":["import { Menu, styled, Stack } from '@mui/material'\r\nimport type { ComponentType } from 'react'\r\nimport type { MenuProps, StackProps } from '@mui/material'\r\n\r\nexport const Root: ComponentType<StackProps> = styled(Stack)(({ theme }) => ({\r\n '--color-bg': theme.palette.mode === 'dark' ? '#121212' : theme.palette.background.paper,\r\n '--color-bg-rba': theme.palette.mode === 'dark' ? '18, 18, 18' : '255, 255, 255',\r\n '--color-text': theme.palette.text.primary,\r\n '--cart-color-bg': 'var(--color-bg)',\r\n height: '100%'\r\n}))\r\n\r\nexport const MenuStyled: ComponentType<MenuProps> = styled(Menu)(({ theme }) => ({\r\n '--color-bg': theme.palette.mode === 'dark' ? '#121212' : theme.palette.background.paper,\r\n '--color-text': theme.palette.text.primary,\r\n '--cart-color-bg': 'var(--color-bg)',\r\n marginTop: '45px',\r\n '> .MuiPaper-root': {\r\n position: 'relative',\r\n overflow: 'visible',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n backgroundColor: 'var(--color-bg, #000000)',\r\n borderRadius: theme.shape.borderRadius,\r\n minWidth: '280px',\r\n maxWidth: '550px',\r\n boxShadow: `0 1px 1px rgba(0, 0, 0, 0.05), 0 2px 2px rgba(0, 0, 0, 0.2), 0 4px 4px rgba(0, 0, 0, 0.15), 0 8px 8px rgba(0, 0, 0, 0.05)`,\r\n animation: 'fadeInDown 0.3s ease-out',\r\n marginTop: '8px',\r\n color: 'var(--color-text, #000000)',\r\n\r\n '@keyframes fadeInDown': {\r\n '0%': { opacity: 0, transform: 'translateY(-10px)' },\r\n '100%': { opacity: 1, transform: 'translateY(0)' }\r\n },\r\n\r\n '&::before': {\r\n content: '\"\"',\r\n position: 'absolute',\r\n backgroundColor: 'var(--color-bg, #ffffff)',\r\n width: '10px',\r\n height: '10px',\r\n top: '-4px',\r\n right: theme.spacing(1),\r\n transform: 'translateX(-50%) rotate(45deg)',\r\n zIndex: 0\r\n }\r\n },\r\n '.MuiBackdrop-root': { backgroundColor: 'transparent' },\r\n '.MuiList-root': { padding: 0, height: '100%', minHeight: 0, maxHeight: '60vh' }\r\n}))\r\n"],"names":["Root","styled","Stack","_ref","theme","palette","mode","background","paper","text","primary","height","MenuStyled","Menu","_ref2","marginTop","position","overflow","display","flexDirection","backgroundColor","borderRadius","shape","minWidth","maxWidth","boxShadow","animation","color","opacity","transform","content","width","top","right","spacing","zIndex","padding","minHeight","maxHeight"],"mappings":"4DAIO,IAAMA,EAAkCC,EAAOC,EAAPD,CAAc,SAAAE,GAAA,IAAGC,EAAKD,EAALC,MAAK,MAAQ,CAC3E,aAAqC,SAAvBA,EAAMC,QAAQC,KAAkB,UAAYF,EAAMC,QAAQE,WAAWC,MACnF,iBAAyC,SAAvBJ,EAAMC,QAAQC,KAAkB,aAAe,gBACjE,eAAgBF,EAAMC,QAAQI,KAAKC,QACnC,kBAAmB,kBACnBC,OAAQ,OACT,GAEYC,EAAuCX,EAAOY,EAAPZ,CAAa,SAAAa,GAAA,IAAGV,EAAKU,EAALV,MAAK,MAAQ,CAC/E,aAAqC,SAAvBA,EAAMC,QAAQC,KAAkB,UAAYF,EAAMC,QAAQE,WAAWC,MACnF,eAAgBJ,EAAMC,QAAQI,KAAKC,QACnC,kBAAmB,kBACnBK,UAAW,OACX,mBAAoB,CAClBC,SAAU,WACVC,SAAU,UACVC,QAAS,OACTC,cAAe,SACfC,gBAAiB,2BACjBC,aAAcjB,EAAMkB,MAAMD,aAC1BE,SAAU,QACVC,SAAU,QACVC,UAAsI,4HACtIC,UAAW,2BACXX,UAAW,MACXY,MAAO,6BAEP,wBAAyB,CACvB,KAAM,CAAEC,QAAS,EAAGC,UAAW,qBAC/B,OAAQ,CAAED,QAAS,EAAGC,UAAW,kBAGnC,YAAa,CACXC,QAAS,KACTd,SAAU,WACVI,gBAAiB,2BACjBW,MAAO,OACPpB,OAAQ,OACRqB,IAAK,OACLC,MAAO7B,EAAM8B,QAAQ,GACrBL,UAAW,iCACXM,OAAQ,IAGZ,oBAAqB,CAAEf,gBAAiB,eACxC,gBAAiB,CAAEgB,QAAS,EAAGzB,OAAQ,OAAQ0B,UAAW,EAAGC,UAAW,QACzE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{inherits as e,createClass as i,
|
|
1
|
+
import{inherits as e,createClass as i,objectSpread2 as t,classCallCheck as n,callSuper as r,defineProperty as o}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as l,jsx as a}from"react/jsx-runtime";import{Component as c}from"react";import{Box as s,Typography as d,alpha as m,colors as h,Stack as p,Divider as u,Button as f}from"@mui/material";import v from"@mui/icons-material/DraftsOutlined";import g from"@mui/icons-material/MarkEmailUnreadOutlined";import{formatTimeAgo as b}from"./helpers.js";import{NoDataPanel as x}from"../components/no-data-panel.js";import{NotifyListStyled as C,notifyListClasses as w}from"./styled.js";var N=function(){function N(){var e;n(this,N);for(var i=arguments.length,t=new Array(i),c=0;c<i;c++)t[c]=arguments[c];return e=r(this,N,[].concat(t)),o(e,"renderItem",function(i,t){return l(s,{className:w.item,onClick:function(){return e.onClickHandler(i)},children:[a(p,{px:1,children:i.IsRead?a(v,{color:"disabled"}):a(g,{color:"success"})}),l(s,{flex:1,children:[a(d,{variant:"subtitle1",component:"h6",className:w.itemTitle,children:i.Title}),a(d,{variant:"caption",className:w.itemSubTitle,children:i.SubTitle}),a(p,{direction:"row",spacing:1,justifyContent:"flex-end",children:a(d,{variant:"caption",color:m(h.common.white,.5),children:b(i.DateCreated)})})]})]},t.toString())}),o(e,"onClickHandler",function(i){e.props.onClick&&e.props.onClick(i)}),o(e,"getDescription",function(e){return 0===e?"No new notifications":1===e?"You have 1 unread notification":"You have ".concat(e," unread notifications")}),o(e,"getItems",function(i){return e.props.data.filter(function(e){return void 0===i||e.IsRead===i})}),e}return e(N,c),i(N,[{key:"render",value:function(){var e,i=this,n=this.getItems(!0),r=this.getItems(!1);return l(C,{className:"".concat(w.root).concat(this.props.isMobile?" mobile":""),children:[a("div",{className:w.header,children:l(s,{flex:1,children:[a(d,{variant:"h6",children:"Notifications"}),a(d,{variant:"body2",color:m(h.common.white,.6),children:this.getDescription(r.length)})]})}),l(p,{className:w.items,children:[r.length>0&&l("div",{children:[l("div",{className:w.groupTitle,children:[a(d,{variant:"caption",children:"Unseen"}),a(u,{sx:{borderColor:m(h.common.white,.1)}})]}),r.map(this.renderItem)]}),n.length>0&&l("div",{children:[l("div",{className:w.groupTitle,children:[a(d,{variant:"caption",children:"Seen"}),a(u,{sx:{borderColor:m(h.common.white,.1)}})]}),n.map(this.renderItem)]}),r.length+n.length===0&&a(x,{title:"No Notifications",subTitle:"You're all caught up!",sx:{minWidth:250,flex:1}})]}),!1!==this.props.enableViewAll&&a("div",{className:w.footer,children:a(f,t(t({variant:"text"},this.props.buttonViewAllProps),{},{onClick:function(e){var t,n,r,o;null===(t=i.props.buttonViewAllProps)||void 0===t||null===(n=t.onClick)||void 0===n||n.call(t,e),null===(r=(o=i.props).onViewAllClick)||void 0===r||r.call(o)},sx:t({flex:"0 0 auto",width:"auto"},null===(e=this.props.buttonViewAllProps)||void 0===e?void 0:e.sx),children:a(d,{variant:"caption",sx:{textTransform:"none",fontWeight:600},children:"View All"})}))})]})}}])}();export{N as default};
|
|
2
2
|
//# sourceMappingURL=notify-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify-list.js","sources":["../../src/notification/notify-list.tsx"],"sourcesContent":["import { Component } from 'react'\r\nimport { alpha, Box, Button, colors, Divider, Stack, Typography } from '@mui/material'\r\nimport DraftsOutlinedIcon from '@mui/icons-material/DraftsOutlined'\r\nimport MarkEmailUnreadOutlinedIcon from '@mui/icons-material/MarkEmailUnreadOutlined'\r\nimport { INotification } from './types'\r\nimport { formatTimeAgo } from './helpers'\r\nimport { NoDataPanel } from '../components/no-data-panel'\r\nimport { NotifyListStyled, notifyListClasses } from './styled'\r\n\r\ninterface INotifyListProps {\r\n data: INotification[]\r\n onClick?: (value: INotification) => void\r\n isMobile?: boolean\r\n}\r\n\r\nclass NotifyList extends Component<INotifyListProps> {\r\n render() {\r\n const listReaded = this.getItems(true)\r\n const listUnReaded = this.getItems(false)\r\n return (\r\n <NotifyListStyled className={`${notifyListClasses.root}${this.props.isMobile ? ' mobile' : ''}`}>\r\n {/* Render the menu header */}\r\n <div className={notifyListClasses.header}>\r\n <Box flex={1}>\r\n <Typography variant='h6'>Notifications</Typography>\r\n <Typography variant='body2' color={alpha(colors.common.white, 0.6)}>\r\n {this.getDescription(listUnReaded.length)}\r\n </Typography>\r\n </Box>\r\n </div>\r\n {/* <Divider variant='middle' sx={{ borderColor: alpha(colors.common.white, 0.1) }} /> */}\r\n {/* Render sub-menu items */}\r\n <Stack className={notifyListClasses.items}>\r\n {listUnReaded.length > 0 && (\r\n <div>\r\n <div className={notifyListClasses.groupTitle}>\r\n <Typography variant='caption'>Unseen</Typography>\r\n <Divider sx={{ borderColor: alpha(colors.common.white, 0.1) }} />\r\n </div>\r\n {listUnReaded.map(this.renderItem)}\r\n </div>\r\n )}\r\n {listReaded.length > 0 && (\r\n <div>\r\n <div className={notifyListClasses.groupTitle}>\r\n <Typography variant='caption'>Seen</Typography>\r\n <Divider sx={{ borderColor: alpha(colors.common.white, 0.1) }} />\r\n </div>\r\n {listReaded.map(this.renderItem)}\r\n </div>\r\n )}\r\n {listUnReaded.length + listReaded.length === 0 && (\r\n <NoDataPanel title='No Notifications' subTitle=\"You're all caught up!\" sx={{ minWidth: 250, flex: 1 }} />\r\n )}\r\n </Stack>\r\n <div className={notifyListClasses.footer}>\r\n
|
|
1
|
+
{"version":3,"file":"notify-list.js","sources":["../../src/notification/notify-list.tsx"],"sourcesContent":["import { Component, ComponentProps } from 'react'\r\nimport { alpha, Box, Button, colors, Divider, Stack, Typography } from '@mui/material'\r\nimport DraftsOutlinedIcon from '@mui/icons-material/DraftsOutlined'\r\nimport MarkEmailUnreadOutlinedIcon from '@mui/icons-material/MarkEmailUnreadOutlined'\r\nimport { INotification } from './types'\r\nimport { formatTimeAgo } from './helpers'\r\nimport { NoDataPanel } from '../components/no-data-panel'\r\nimport { NotifyListStyled, notifyListClasses } from './styled'\r\n\r\nexport interface INotifyListSlots {\r\n /** @default true */\r\n enableViewAll?: boolean\r\n buttonViewAllProps?: ComponentProps<typeof Button> & { [key: string]: any }\r\n onViewAllClick?: () => void\r\n}\r\n\r\ninterface INotifyListProps extends INotifyListSlots {\r\n data: INotification[]\r\n onClick?: (value: INotification) => void\r\n isMobile?: boolean\r\n}\r\n\r\nclass NotifyList extends Component<INotifyListProps> {\r\n render() {\r\n const listReaded = this.getItems(true)\r\n const listUnReaded = this.getItems(false)\r\n return (\r\n <NotifyListStyled className={`${notifyListClasses.root}${this.props.isMobile ? ' mobile' : ''}`}>\r\n {/* Render the menu header */}\r\n <div className={notifyListClasses.header}>\r\n <Box flex={1}>\r\n <Typography variant='h6'>Notifications</Typography>\r\n <Typography variant='body2' color={alpha(colors.common.white, 0.6)}>\r\n {this.getDescription(listUnReaded.length)}\r\n </Typography>\r\n </Box>\r\n </div>\r\n {/* <Divider variant='middle' sx={{ borderColor: alpha(colors.common.white, 0.1) }} /> */}\r\n {/* Render sub-menu items */}\r\n <Stack className={notifyListClasses.items}>\r\n {listUnReaded.length > 0 && (\r\n <div>\r\n <div className={notifyListClasses.groupTitle}>\r\n <Typography variant='caption'>Unseen</Typography>\r\n <Divider sx={{ borderColor: alpha(colors.common.white, 0.1) }} />\r\n </div>\r\n {listUnReaded.map(this.renderItem)}\r\n </div>\r\n )}\r\n {listReaded.length > 0 && (\r\n <div>\r\n <div className={notifyListClasses.groupTitle}>\r\n <Typography variant='caption'>Seen</Typography>\r\n <Divider sx={{ borderColor: alpha(colors.common.white, 0.1) }} />\r\n </div>\r\n {listReaded.map(this.renderItem)}\r\n </div>\r\n )}\r\n {listUnReaded.length + listReaded.length === 0 && (\r\n <NoDataPanel title='No Notifications' subTitle=\"You're all caught up!\" sx={{ minWidth: 250, flex: 1 }} />\r\n )}\r\n </Stack>\r\n {this.props.enableViewAll !== false && (\r\n <div className={notifyListClasses.footer}>\r\n <Button\r\n variant='text'\r\n {...this.props.buttonViewAllProps}\r\n onClick={(e) => {\r\n this.props.buttonViewAllProps?.onClick?.(e)\r\n this.props.onViewAllClick?.()\r\n }}\r\n sx={{ flex: '0 0 auto', width: 'auto', ...this.props.buttonViewAllProps?.sx }}\r\n >\r\n <Typography variant='caption' sx={{ textTransform: 'none', fontWeight: 600 }}>\r\n View All\r\n </Typography>\r\n </Button>\r\n </div>\r\n )}\r\n </NotifyListStyled>\r\n )\r\n }\r\n\r\n renderItem = (item: INotification, index: number) => {\r\n // Render each item in the menu\r\n return (\r\n <Box key={index.toString()} className={notifyListClasses.item} onClick={() => this.onClickHandler(item)}>\r\n <Stack px={1}>{item.IsRead ? <DraftsOutlinedIcon color='disabled' /> : <MarkEmailUnreadOutlinedIcon color='success' />}</Stack>\r\n <Box flex={1}>\r\n <Typography variant='subtitle1' component='h6' className={notifyListClasses.itemTitle}>\r\n {item.Title}\r\n </Typography>\r\n <Typography variant='caption' className={notifyListClasses.itemSubTitle}>\r\n {item.SubTitle}\r\n </Typography>\r\n <Stack direction='row' spacing={1} justifyContent='flex-end'>\r\n <Typography variant='caption' color={alpha(colors.common.white, 0.5)}>\r\n {formatTimeAgo(item.DateCreated)}\r\n </Typography>\r\n </Stack>\r\n </Box>\r\n </Box>\r\n )\r\n }\r\n\r\n onClickHandler = (notification: INotification) => {\r\n if (!this.props.onClick) return\r\n // Call the onClick handler if provided\r\n this.props.onClick(notification)\r\n }\r\n\r\n getDescription = (count: number) => {\r\n if (count === 0) return 'No new notifications'\r\n if (count === 1) return 'You have 1 unread notification'\r\n return `You have ${count} unread notifications`\r\n }\r\n\r\n getItems = (isReaded?: boolean) => {\r\n return this.props.data.filter((item) => (isReaded !== undefined ? item.IsRead === isReaded : true))\r\n }\r\n}\r\nexport default NotifyList\r\n"],"names":["NotifyList","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","this","concat","_defineProperty","item","index","_jsxs","Box","className","notifyListClasses","onClick","onClickHandler","children","_jsx","Stack","px","IsRead","DraftsOutlinedIcon","color","MarkEmailUnreadOutlinedIcon","flex","Typography","variant","component","itemTitle","Title","itemSubTitle","SubTitle","direction","spacing","justifyContent","alpha","colors","common","white","formatTimeAgo","DateCreated","toString","notification","props","count","isReaded","data","filter","undefined","_inherits","Component","_createClass","key","value","_this$props$buttonVie","_this2","listReaded","getItems","listUnReaded","NotifyListStyled","root","isMobile","header","getDescription","items","groupTitle","Divider","sx","borderColor","map","renderItem","NoDataPanel","title","subTitle","minWidth","enableViewAll","footer","Button","_objectSpread","buttonViewAllProps","e","_this2$props$buttonVi","_this2$props$buttonVi2","_this2$props$onViewAl","_this2$props","call","onVi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AKiE,eAGxBZ,EAAa1D,OAASwD,EAAWxD,SAAW,GAC3CiB,EAACsD,EAAW,CAACC,MAAM,mBAAmBC,SAAS,wBAAwBN,GAAI,CAAEO,SAAU,IAAKlD,KAAM,SAGxE,IAA7BnB,KAAKsC,MAAMgC,eACV1D,EAAK,MAAA,CAAAL,UAAWC,EAAkB+D,gBAChC3D,EAAC4D,EAAMC,EAAAA,EAAA,CACLpD,QAAQ,QACJrB,KAAKsC,MAAMoC,oBAAkB,CAAA,EAAA,CACjCjE,QAAS,SAACkE,GAAK,IAAAC,EAAAC,EAAAC,EAAAC,EACgB,QAA7BH,EAAA1B,EAAKZ,MAAMoC,0BAAkB,IAAAE,GAASC,QAATA,EAA7BD,EAA+BnE,eAA/BoE,IAAsCA,GAAtCA,EAAAG,KAAAJ,EAAyCD,GAChB,QAAzBG,GAAAC,EAAA7B,EAAKZ,OAAM2C,sBAAXH,IAAyBA,GAAzBA,EAAAE,KAAAD,EACD,EACDjB,GAAEW,EAAA,CAAItD,KAAM,WAAY+D,MAAO,QAAwC,QAAlCjC,EAAKjD,KAAKsC,MAAMoC,0BAAkB,IAAAzB,OAAA,EAA7BA,EAA+Ba,IAEzEnD,SAAAC,EAACQ,EAAW,CAAAC,QAAQ,UAAUyC,GAAI,CAAEqB,cAAe,OAAQC,WAAY,KAAKzE,SAAA,oBAQxF,IAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{slicedToArray as t,toConsumableArray as n,inherits as o,createClass as e,
|
|
1
|
+
import{slicedToArray as t,toConsumableArray as n,inherits as o,createClass as e,objectSpread2 as r,asyncToGenerator as a,classCallCheck as i,callSuper as l,defineProperty as s,regenerator as c}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as u,jsxs as d,Fragment as f}from"react/jsx-runtime";import{useTheme as p,useMediaQuery as h,Badge as m,Drawer as v}from"@mui/material";import{useState as C,useEffect as g,Component as y}from"react";import{GlobalModal as k,mapGlobalModalContext as w}from"dinocollab-core/api-context";import b from"@mui/icons-material/NotificationsNone";import{MenuStyled as D}from"./styled.js";import{IconButtonDark as S}from"../components/buttons.js";import{useFetchData as x}from"./hook.js";import R from"./notify-list.js";import{NotifyDetail as A}from"./notify-detail.js";var M=function(){function t(n){var o;return i(this,t),o=l(this,t,[n]),s(o,"onClickHandler",function(t){var n;o.onClose(),null===(n=o.globalModalContext)||void 0===n||n.show({backdropActivated:!0,renderContent:function(){var n;return u(A,{data:t,fetchDetail:o.props.fetchDetail,onRead:o.onReadHandler,onClose:null===(n=o.globalModalContext)||void 0===n?void 0:n.close})}})}),s(o,"onOpen",function(t){o.setState({anchorEl:t})}),s(o,"onClose",function(){o.setState({anchorEl:null})}),s(o,"onReadHandler",function(){var t=a(c().m(function t(n){var e,r,a;return c().w(function(t){for(;;)switch(t.n){case 0:null===(e=o.globalModalContext)||void 0===e||e.close();try{null===(r=(a=o.props).onRead)||void 0===r||r.call(a,n)}catch(t){console.error("Error updating read state:",t)}case 1:return t.a(2)}},t)}));return function(n){return t.apply(this,arguments)}}()),o.state={anchorEl:null,hydrated:!1},o}return o(t,y),e(t,[{key:"notifications",get:function(){var t;return null!==(t=this.props.data)&&void 0!==t?t:[]}},{key:"newFeatureCount",get:function(){return this.notifications.filter(function(t){return!t.IsRead}).length}},{key:"componentDidMount",value:function(){this.setState({hydrated:!0})}},{key:"componentDidUpdate",value:function(t){var n=this;if(t.data!==this.props.data&&this.props.data.length>0){var o=this.props.data.filter(function(t){return"Popup"===t.AreaType&&!t.IsRead});o.length>0&&setTimeout(function(){var t,e;null===(t=(e=n.props).onAutoShowPopup)||void 0===t||t.call(e,o[0])},1500)}}},{key:"render",value:function(){var t=this,n=Boolean(this.state.anchorEl);return d(f,{children:[u(S,{onClick:function(n){return t.onOpen(n.currentTarget)},children:u(m,{badgeContent:this.state.hydrated?this.newFeatureCount:0,color:"error",children:u(b,{fontSize:"small"})})}),this.props.isMobile?u(v,{anchor:"right",open:n,onClose:this.onClose,disableScrollLock:!0,PaperProps:{sx:{width:"calc(100% - 100px)",maxWidth:360}},children:w(function(n){return t.globalModalContext=n,u(R,r({data:t.props.data,onClick:t.onClickHandler,onViewAllClick:t.onClose},t.props.notifyListSlots))})}):u(D,{disableScrollLock:!0,anchorEl:this.state.anchorEl,open:n,onClose:this.onClose,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{component:"div"},children:w(function(n){return t.globalModalContext=n,u(R,r({data:t.props.data,onClick:t.onClickHandler,onViewAllClick:t.onClose},t.props.notifyListSlots))})})]})}}])}(),T=function(o){var e=x(o.featData),i=C([]),l=t(i,2),s=l[0],d=l[1],f=p(),m=h(f.breakpoints.down("sm"));g(function(){if(e.data){var t=n(e.data).sort(function(t,n){return new Date(n.DateCreated).getTime()-new Date(t.DateCreated).getTime()});d(t)}},[e.data]);var v=function(){var t=a(c().m(function t(n,e,a){var i;return c().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,null===(i=o.onRead)||void 0===i?void 0:i.call(o,n,e,a);case 1:d(function(t){return t.map(function(t){return t.Id===n?r(r({},t),{},{IsRead:!0}):t}).sort(function(t,n){return new Date(n.DateCreated).getTime()-new Date(t.DateCreated).getTime()})});case 2:return t.a(2)}},t)}));return function(n,o,e){return t.apply(this,arguments)}}();return u(k,{children:w(function(t){return u(M,{data:s,loading:e.loading,fetchDetail:o.fetchDetail,onRead:v,onAutoShowPopup:function(n){return function(t,n){n.show({backdropActivated:!0,renderContent:function(){return u(A,{data:t,fetchDetail:o.fetchDetail,onRead:(e=a(c().m(function t(o,e,r){return c().w(function(t){for(;;)switch(t.n){case 0:return n.close(),t.n=1,v(o,e,r);case 1:return t.a(2)}},t)})),function(t,n,o){return e.apply(this,arguments)}),onClose:n.close});var e}})}(n,t)},isMobile:m,notifyListSlots:o.notifyListSlots})})})},j=function(t){var n=function(n){return u(T,r(r({},t),n))};return n.displayName="NotificationWidget",n};export{T as NotificationWidget,j as createNotificationWidget,T as default};
|
|
2
2
|
//# sourceMappingURL=widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sources":["../../src/notification/widget.tsx"],"sourcesContent":["import { Badge, Drawer, useMediaQuery, useTheme } from '@mui/material'\r\nimport { Component, FC, useEffect, useState } from 'react'\r\nimport { GlobalModal, IGlobalModalContext, mapGlobalModalContext } from 'dinocollab-core/api-context'\r\nimport NotificationsNoneIcon from '@mui/icons-material/NotificationsNone'\r\nimport { MenuStyled } from './styled'\r\nimport { IconButtonDark } from '../components/buttons'\r\nimport { FetchDataFunction, useFetchData } from './hook'\r\nimport { INotification, ReadFunction, FetchDetailFunction, INotificationPropsDef } from './types'\r\nimport NotifyList from './notify-list'\r\nimport NotifyDetail from './notify-detail'\r\n\r\ninterface INotificationProps extends INotificationPropsDef {\r\n loading?: boolean\r\n data: INotification[]\r\n fetchDetail?: FetchDetailFunction\r\n onAutoShowPopup?: (notification: INotification) => void\r\n isMobile?: boolean\r\n}\r\n\r\ninterface INotificationState {\r\n anchorEl: HTMLElement | null\r\n hydrated: boolean\r\n}\r\nclass NotificationContent extends Component<INotificationProps, INotificationState> {\r\n globalModalContext?: IGlobalModalContext\r\n constructor(props: INotificationProps) {\r\n super(props)\r\n this.state = { anchorEl: null, hydrated: false }\r\n }\r\n\r\n get notifications() {\r\n return this.props.data ?? []\r\n }\r\n\r\n get newFeatureCount() {\r\n return this.notifications.filter((n) => !n.IsRead).length\r\n }\r\n\r\n componentDidMount() {\r\n // When mounted on the client, set hydrated = true\r\n this.setState({ hydrated: true })\r\n }\r\n\r\n componentDidUpdate(prevProps: INotificationProps) {\r\n // Auto show popup notifications\r\n if (prevProps.data !== this.props.data && this.props.data.length > 0) {\r\n const popupNotifications = this.props.data.filter((n) => n.AreaType === 'Popup' && !n.IsRead)\r\n if (popupNotifications.length > 0) {\r\n // Delay to improve UX\r\n setTimeout(() => {\r\n this.props.onAutoShowPopup?.(popupNotifications[0])\r\n }, 1500)\r\n }\r\n }\r\n }\r\n\r\n render() {\r\n const isOpen = Boolean(this.state.anchorEl)\r\n\r\n return (\r\n <>\r\n <IconButtonDark onClick={(e) => this.onOpen(e.currentTarget)}>\r\n <Badge badgeContent={this.state.hydrated ? this.newFeatureCount : 0} color='error'>\r\n <NotificationsNoneIcon fontSize='small' />\r\n </Badge>\r\n </IconButtonDark>\r\n\r\n {this.props.isMobile ? (\r\n <Drawer\r\n anchor='right'\r\n open={isOpen}\r\n onClose={this.onClose}\r\n disableScrollLock\r\n PaperProps={{ sx: { width: 'calc(100% - 100px)', maxWidth: 360 } }}\r\n >\r\n {mapGlobalModalContext((context: IGlobalModalContext) => {\r\n this.globalModalContext = context\r\n return <NotifyList data={this.props.data} onClick={this.onClickHandler} />\r\n })}\r\n </Drawer>\r\n ) : (\r\n <MenuStyled\r\n disableScrollLock\r\n anchorEl={this.state.anchorEl}\r\n open={isOpen}\r\n onClose={this.onClose}\r\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\r\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\r\n MenuListProps={{ component: 'div' }}\r\n >\r\n {mapGlobalModalContext((context: IGlobalModalContext) => {\r\n this.globalModalContext = context\r\n return <NotifyList data={this.props.data} onClick={this.onClickHandler} />\r\n })}\r\n </MenuStyled>\r\n )}\r\n </>\r\n )\r\n }\r\n\r\n onClickHandler = (value: INotification) => {\r\n this.onClose()\r\n this.globalModalContext?.show({\r\n backdropActivated: true,\r\n renderContent: () => (\r\n <NotifyDetail data={value} fetchDetail={this.props.fetchDetail} onRead={this.onReadHandler} onClose={this.globalModalContext?.close} />\r\n )\r\n })\r\n }\r\n\r\n onOpen = (target: HTMLElement) => {\r\n this.setState({ anchorEl: target })\r\n }\r\n\r\n onClose = () => {\r\n this.setState({ anchorEl: null })\r\n }\r\n\r\n onReadHandler: ReadFunction = async (id) => {\r\n this.globalModalContext?.close()\r\n // NotifyLocalStorage.setSingle(value.Id)\r\n try {\r\n // Call the callback to update the read state in the parent component\r\n this.props.onRead?.(id)\r\n } catch (error) {\r\n console.error('Error updating read state:', error)\r\n }\r\n }\r\n}\r\n\r\nexport interface INotificationWidgetProps {\r\n featData: FetchDataFunction<INotification[]>\r\n fetchDetail?: FetchDetailFunction\r\n onRead?: ReadFunction\r\n}\r\n\r\nexport const NotificationWidget: FC<INotificationWidgetProps> = (props) => {\r\n const intitialData = useFetchData<INotification[]>(props.featData)\r\n const [data, setData] = useState<INotification[]>([])\r\n const theme = useTheme()\r\n const isMobile = useMediaQuery(theme.breakpoints.down('sm'))\r\n\r\n // When initialData changes, update the local state\r\n useEffect(() => {\r\n if (intitialData.data) {\r\n const sortedData = [...intitialData.data].sort((a, b) => new Date(b.DateCreated).getTime() - new Date(a.DateCreated).getTime())\r\n setData(sortedData)\r\n }\r\n }, [intitialData.data])\r\n\r\n // Function to update read notifications\r\n const handleRead: ReadFunction = async (id: string, signal, options) => {\r\n await props.onRead?.(id, signal, options)\r\n setData((prev) => {\r\n const l = prev.map((n) => (n.Id === id ? { ...n, IsRead: true } : n))\r\n return l.sort((a, b) => new Date(b.DateCreated).getTime() - new Date(a.DateCreated).getTime())\r\n })\r\n }\r\n\r\n // Auto show popup notification\r\n const handleAutoShowPopup = (notification: INotification, context: IGlobalModalContext) => {\r\n context.show({\r\n backdropActivated: true,\r\n renderContent: () => (\r\n <NotifyDetail\r\n data={notification}\r\n fetchDetail={props.fetchDetail}\r\n onRead={async (id, s, o) => {\r\n context.close()\r\n await handleRead(id, s, o)\r\n }}\r\n onClose={context.close}\r\n />\r\n )\r\n })\r\n }\r\n\r\n return (\r\n <GlobalModal>\r\n {mapGlobalModalContext((context: IGlobalModalContext) => (\r\n <NotificationContent\r\n data={data}\r\n loading={intitialData.loading}\r\n fetchDetail={props.fetchDetail}\r\n onRead={handleRead}\r\n onAutoShowPopup={(x) => handleAutoShowPopup(x, context)}\r\n isMobile={isMobile}\r\n />\r\n ))}\r\n </GlobalModal>\r\n )\r\n}\r\nexport default NotificationWidget\r\n\r\nexport const createNotificationWidget = (params: INotificationWidgetProps) => {\r\n const _NotificationWidget: FC<Partial<INotificationWidgetProps>> = (props) => <NotificationWidget {...params} {...props} />\r\n _NotificationWidget.displayName = 'NotificationWidget'\r\n return _NotificationWidget\r\n}\r\n"],"names":["NotificationContent","props","_this","_classCallCheck","_callSuper","_defineProperty","value","_this$globalModalCont","onClose","globalModalContext","show","backdropActivated","renderContent","_this$globalModalCont2","_jsx","NotifyDetail","data","fetchDetail","onRead","onReadHandler","close","target","setState","anchorEl","_ref","_asyncToGenerator","_regenerator","m","_callee","id","_this$globalModalCont3","_this$props$onRead","_this$props","w","_context","n","call","error","console","a","_x","apply","this","arguments","state","hydrated","_inherits","Component","_createClass","key","get","_this$props$data","notifications","filter","IsRead","length","prevProps","_this2","popupNotifications","AreaType","setTimeout","_this2$props$onAutoSh","_this2$props","onAutoShowPopup","_this3","isOpen","Boolean","_jsxs","IconButtonDark","onClick","e","onOpen","currentTarget","children","Badge","badgeContent","newFeatureCount","color","NotificationsNoneIcon","fontSize","isMobile","Drawer","anchor","open","disableScrollLock","PaperProps","sx","width","maxWidth","mapGlobalModalContext","context","NotifyList","onClickHandler","MenuStyled","anchorOrigin","vertical","horizontal","transformOrigin","MenuListProps","component","NotificationWidget","intitialData","useFetchData","featData","_useState","useState","_useState2","_slicedToArray","setData","theme","useTheme","useMediaQuery","breakpoints","down","useEffect","sortedData","_toConsumableArray","sort","b","Date","DateCreated","getTime","handleRead","_ref2","_callee2","signal","options","_props$onRead","_context2","prev","map","Id","_objectSpread","_x2","_x3","_x4","GlobalModal","loading","x","notification","_onRead","_callee3","s","o","_context3","_x5","_x6","_x7","handleAutoShowPopup","createNotificationWidget","params","_NotificationWidget","displayName"],"mappings":"0yBAS0C,IAcpCA,aAEJ,SAAAA,EAAYC,GAAyB,IAAAC,EAEa,OAFbC,OAAAH,GACnCE,EAAAE,EAAAJ,KAAAA,GAAMC,IAAMI,EAAAH,EA0EG,iBAAA,SAACI,GAAwB,IAAAC,EACxCL,EAAKM,UACkBD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sJ,EAAoBC,YAAc,qBAC3BD,CACT"}
|
|
1
|
+
{"version":3,"file":"widget.js","sources":["../../src/notification/widget.tsx"],"sourcesContent":["import { Badge, Drawer, useMediaQuery, useTheme } from '@mui/material'\r\nimport { Component, FC, useEffect, useState } from 'react'\r\nimport { GlobalModal, IGlobalModalContext, mapGlobalModalContext } from 'dinocollab-core/api-context'\r\nimport NotificationsNoneIcon from '@mui/icons-material/NotificationsNone'\r\nimport { MenuStyled } from './styled'\r\nimport { IconButtonDark } from '../components/buttons'\r\nimport { FetchDataFunction, useFetchData } from './hook'\r\nimport { INotification, ReadFunction, FetchDetailFunction, INotificationPropsDef } from './types'\r\nimport NotifyList, { INotifyListSlots } from './notify-list'\r\nimport NotifyDetail from './notify-detail'\r\n\r\ninterface INotificationProps extends INotificationPropsDef {\r\n loading?: boolean\r\n data: INotification[]\r\n fetchDetail?: FetchDetailFunction\r\n onAutoShowPopup?: (notification: INotification) => void\r\n isMobile?: boolean\r\n notifyListSlots?: INotifyListSlots\r\n}\r\n\r\ninterface INotificationState {\r\n anchorEl: HTMLElement | null\r\n hydrated: boolean\r\n}\r\nclass NotificationContent extends Component<INotificationProps, INotificationState> {\r\n globalModalContext?: IGlobalModalContext\r\n constructor(props: INotificationProps) {\r\n super(props)\r\n this.state = { anchorEl: null, hydrated: false }\r\n }\r\n\r\n get notifications() {\r\n return this.props.data ?? []\r\n }\r\n\r\n get newFeatureCount() {\r\n return this.notifications.filter((n) => !n.IsRead).length\r\n }\r\n\r\n componentDidMount() {\r\n // When mounted on the client, set hydrated = true\r\n this.setState({ hydrated: true })\r\n }\r\n\r\n componentDidUpdate(prevProps: INotificationProps) {\r\n // Auto show popup notifications\r\n if (prevProps.data !== this.props.data && this.props.data.length > 0) {\r\n const popupNotifications = this.props.data.filter((n) => n.AreaType === 'Popup' && !n.IsRead)\r\n if (popupNotifications.length > 0) {\r\n // Delay to improve UX\r\n setTimeout(() => {\r\n this.props.onAutoShowPopup?.(popupNotifications[0])\r\n }, 1500)\r\n }\r\n }\r\n }\r\n\r\n render() {\r\n const isOpen = Boolean(this.state.anchorEl)\r\n\r\n return (\r\n <>\r\n <IconButtonDark onClick={(e) => this.onOpen(e.currentTarget)}>\r\n <Badge badgeContent={this.state.hydrated ? this.newFeatureCount : 0} color='error'>\r\n <NotificationsNoneIcon fontSize='small' />\r\n </Badge>\r\n </IconButtonDark>\r\n\r\n {this.props.isMobile ? (\r\n <Drawer\r\n anchor='right'\r\n open={isOpen}\r\n onClose={this.onClose}\r\n disableScrollLock\r\n PaperProps={{ sx: { width: 'calc(100% - 100px)', maxWidth: 360 } }}\r\n >\r\n {mapGlobalModalContext((context: IGlobalModalContext) => {\r\n this.globalModalContext = context\r\n return <NotifyList data={this.props.data} onClick={this.onClickHandler} onViewAllClick={this.onClose} {...this.props.notifyListSlots} />\r\n })}\r\n </Drawer>\r\n ) : (\r\n <MenuStyled\r\n disableScrollLock\r\n anchorEl={this.state.anchorEl}\r\n open={isOpen}\r\n onClose={this.onClose}\r\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\r\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\r\n MenuListProps={{ component: 'div' }}\r\n >\r\n {mapGlobalModalContext((context: IGlobalModalContext) => {\r\n this.globalModalContext = context\r\n return <NotifyList data={this.props.data} onClick={this.onClickHandler} onViewAllClick={this.onClose} {...this.props.notifyListSlots} />\r\n })}\r\n </MenuStyled>\r\n )}\r\n </>\r\n )\r\n }\r\n\r\n onClickHandler = (value: INotification) => {\r\n this.onClose()\r\n this.globalModalContext?.show({\r\n backdropActivated: true,\r\n renderContent: () => (\r\n <NotifyDetail data={value} fetchDetail={this.props.fetchDetail} onRead={this.onReadHandler} onClose={this.globalModalContext?.close} />\r\n )\r\n })\r\n }\r\n\r\n onOpen = (target: HTMLElement) => {\r\n this.setState({ anchorEl: target })\r\n }\r\n\r\n onClose = () => {\r\n this.setState({ anchorEl: null })\r\n }\r\n\r\n onReadHandler: ReadFunction = async (id) => {\r\n this.globalModalContext?.close()\r\n // NotifyLocalStorage.setSingle(value.Id)\r\n try {\r\n // Call the callback to update the read state in the parent component\r\n this.props.onRead?.(id)\r\n } catch (error) {\r\n console.error('Error updating read state:', error)\r\n }\r\n }\r\n}\r\n\r\nexport interface INotificationWidgetProps {\r\n featData: FetchDataFunction<INotification[]>\r\n fetchDetail?: FetchDetailFunction\r\n onRead?: ReadFunction\r\n notifyListSlots?: INotifyListSlots\r\n}\r\n\r\nexport const NotificationWidget: FC<INotificationWidgetProps> = (props) => {\r\n const intitialData = useFetchData<INotification[]>(props.featData)\r\n const [data, setData] = useState<INotification[]>([])\r\n const theme = useTheme()\r\n const isMobile = useMediaQuery(theme.breakpoints.down('sm'))\r\n\r\n // When initialData changes, update the local state\r\n useEffect(() => {\r\n if (intitialData.data) {\r\n const sortedData = [...intitialData.data].sort((a, b) => new Date(b.DateCreated).getTime() - new Date(a.DateCreated).getTime())\r\n setData(sortedData)\r\n }\r\n }, [intitialData.data])\r\n\r\n // Function to update read notifications\r\n const handleRead: ReadFunction = async (id: string, signal, options) => {\r\n await props.onRead?.(id, signal, options)\r\n setData((prev) => {\r\n const l = prev.map((n) => (n.Id === id ? { ...n, IsRead: true } : n))\r\n return l.sort((a, b) => new Date(b.DateCreated).getTime() - new Date(a.DateCreated).getTime())\r\n })\r\n }\r\n\r\n // Auto show popup notification\r\n const handleAutoShowPopup = (notification: INotification, context: IGlobalModalContext) => {\r\n context.show({\r\n backdropActivated: true,\r\n renderContent: () => (\r\n <NotifyDetail\r\n data={notification}\r\n fetchDetail={props.fetchDetail}\r\n onRead={async (id, s, o) => {\r\n context.close()\r\n await handleRead(id, s, o)\r\n }}\r\n onClose={context.close}\r\n />\r\n )\r\n })\r\n }\r\n\r\n return (\r\n <GlobalModal>\r\n {mapGlobalModalContext((context: IGlobalModalContext) => (\r\n <NotificationContent\r\n data={data}\r\n loading={intitialData.loading}\r\n fetchDetail={props.fetchDetail}\r\n onRead={handleRead}\r\n onAutoShowPopup={(x) => handleAutoShowPopup(x, context)}\r\n isMobile={isMobile}\r\n notifyListSlots={props.notifyListSlots}\r\n />\r\n ))}\r\n </GlobalModal>\r\n )\r\n}\r\nexport default NotificationWidget\r\n\r\nexport const createNotificationWidget = (params: INotificationWidgetProps) => {\r\n const _NotificationWidget: FC<Partial<INotificationWidgetProps>> = (props) => <NotificationWidget {...params} {...props} />\r\n _NotificationWidget.displayName = 'NotificationWidget'\r\n return _NotificationWidget\r\n}\r\n"],"names":["NotificationContent","props","_this","_classCallCheck","_callSuper","_defineProperty","value","_this$globalModalCont","onClose","globalModalContext","show","backdropActivated","renderContent","_this$globalModalCont2","_jsx","NotifyDetail","data","fetchDetail","onRead","onReadHandler","close","target","setState","anchorEl","_ref","_asyncToGenerator","_regenerator","m","_callee","id","_this$globalModalCont3","_this$props$onRead","_this$props","w","_context","n","call","error","console","a","_x","apply","this","arguments","state","hydrated","_inherits","Component","_createClass","key","get","_this$props$data","notifications","filter","IsRead","length","prevProps","_this2","popupNotifications","AreaType","setTimeout","_this2$props$onAutoSh","_this2$props","onAutoShowPopup","_this3","isOpen","Boolean","_jsxs","IconButtonDark","onClick","e","onOpen","currentTarget","children","Badge","badgeContent","newFeatureCount","color","NotificationsNoneIcon","fontSize","isMobile","Drawer","anchor","open","disableScrollLock","PaperProps","sx","width","maxWidth","mapGlobalModalContext","context","NotifyList","_objectSpread","onClickHandler","onViewAllClick","notifyListSlots","MenuStyled","anchorOrigin","vertical","horizontal","transformOrigin","MenuListProps","component","NotificationWidget","intitialData","useFetchData","featData","_useState","useState","_useState2","_slicedToArray","setData","theme","useTheme","useMediaQuery","breakpoints","down","useEffect","sortedData","_toConsumableArray","sort","b","Date","DateCreated","getTime","handleRead","_ref2","_callee2","signal","options","_props$onRead","_context2","prev","map","Id","_x2","_x3","_x4","GlobalModal","loading","x","notification","_onRead","_callee3","s","o","_context3","_x5","_x6","_x7","handleAutoShowPopup","createNotificationWidget","params","_NotificationWidget","displayName"],"mappings":"0yBAS0C,I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AAAP,EAAArG,MAAAC,KAAAC,UAAA,GAINnC,QAASkF,EAAQtE,QAJX,IAAA0H,CAKN,GAGP,CAU+BQ,CAAoBV,EAAGlD,EAAQ,EACvDV,SAAUA,EACVe,gBAAiB9F,EAAM8F,iBAE1B,IAGP,EAGawD,EAA2B,SAACC,GACvC,IAAMC,EAA6D,SAACxJ,GAAK,OAAKa,EAACyF,EAAkBX,EAAAA,EAAA,CAAA,EAAK4D,GAAYvJ,GAAS,EAE3H,OADAwJ,EAAoBC,YAAc,qBAC3BD,CACT"}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MenuProps, StackProps, TypographyProps } from '@mui/material';
|
|
3
|
+
export declare const Root: ComponentType<StackProps>;
|
|
3
4
|
export declare const MenuStyled: ComponentType<MenuProps>;
|
|
4
|
-
export declare const
|
|
5
|
-
root: string;
|
|
6
|
-
header: string;
|
|
7
|
-
footer: string;
|
|
8
|
-
content: string;
|
|
9
|
-
items: string;
|
|
10
|
-
item: string;
|
|
11
|
-
itemContent: string;
|
|
12
|
-
itemImg: string;
|
|
13
|
-
itemTitle: string;
|
|
14
|
-
itemPrice: string;
|
|
15
|
-
itemTag: string;
|
|
16
|
-
};
|
|
17
|
-
export declare const CartContentStyled: ComponentType<BoxProps>;
|
|
5
|
+
export declare const ItemTag: ComponentType<TypographyProps>;
|
|
18
6
|
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/cart/styled.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/cart/styled.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE3E,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,UAAU,CAMxC,CAAA;AAEH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,SAAS,CAsC7C,CAAA;AAEH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,eAAe,CAOhD,CAAA"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { ButtonProps } from '@mui/material';
|
|
3
|
-
import type { TypographyProps } from '@mui/material';
|
|
2
|
+
import { ButtonProps, TypographyProps } from '@mui/material';
|
|
4
3
|
import { ICartItem } from './types';
|
|
5
4
|
import { IAppSiteBaseUrl } from '../types';
|
|
6
|
-
type ITypographyProps = TypographyProps & {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
};
|
|
9
5
|
interface ICartWidgetProps {
|
|
10
6
|
baseUrl: IAppSiteBaseUrl;
|
|
11
7
|
carts?: ICartItem[];
|
|
@@ -16,8 +12,12 @@ interface ICartWidgetProps {
|
|
|
16
12
|
storageKey?: string;
|
|
17
13
|
onRemoveCart?: (item: ICartItem) => void;
|
|
18
14
|
onMoveToCartClick?: (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement, MouseEvent>) => void;
|
|
19
|
-
itemTitleProps?:
|
|
20
|
-
|
|
15
|
+
itemTitleProps?: TypographyProps & {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
itemTitlePropsGetter?: (item: ICartItem, close?: () => void) => TypographyProps & {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
21
|
}
|
|
22
22
|
export declare const CartWidget: FC<ICartWidgetProps>;
|
|
23
23
|
export declare const createCartWidget: (params: ICartWidgetProps) => FC<Partial<ICartWidgetProps>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../src/cart/widget.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../src/cart/widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,EAAE,EAAe,MAAM,OAAO,CAAA;AAC3D,OAAO,EAAS,WAAW,EAA6B,eAAe,EAA2B,MAAM,eAAe,CAAA;AAEvH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAO1C,UAAU,gBAAgB;IACxB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,qBAAqB,CAAC,EAAE,WAAW,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACxC,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAA;IACpG,cAAc,CAAC,EAAE,eAAe,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;IACzD,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,IAAI,KAAK,eAAe,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;CACzG;AA+BD,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,gBAAgB,CAgG3C,CAAA;AAED,eAAO,MAAM,gBAAgB,WAAY,gBAAgB,kCAIxD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../../../src/components/buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../../../src/components/buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAMjE,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,WAAW,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAgC3E,CAAA;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,eAAe,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAanF,CAAA;AAkBF,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,eAAe,CAYvD,CAAA;AAEH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,eAAe,CAAA;QAC7B,YAAY,CAAC,EAAE,eAAe,CAAA;QAC9B,WAAW,CAAC,EAAE,eAAe,CAAA;KAC9B,CAAA;CACF;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,uBAAuB,CAuCzD,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
import type { ICartContentProps, ICartContentOptions } from './types';
|
|
3
|
+
export declare const createCartContent: <T = {}>(defaultOptions?: ICartContentOptions) => React.ComponentType<ICartContentProps<T>>;
|
|
4
|
+
export default createCartContent;
|
|
5
|
+
//# sourceMappingURL=create.cart-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.cart-content.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-content/create.cart-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAK5C,OAAO,KAAK,EAAE,iBAAiB,EAA2B,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAE9F,eAAO,MAAM,iBAAiB,4BAA8B,mBAAmB,8CAqF9E,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-content/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BoxProps, StackProps } from '@mui/material';
|
|
2
|
+
import type { ComponentType } from 'react';
|
|
3
|
+
export declare const Root: ComponentType<BoxProps>;
|
|
4
|
+
export declare const Header: ComponentType<StackProps>;
|
|
5
|
+
export declare const HeaderLeft: ComponentType<StackProps>;
|
|
6
|
+
export declare const Body: ComponentType<BoxProps>;
|
|
7
|
+
export declare const Items: ComponentType<BoxProps>;
|
|
8
|
+
export declare const Footer: ComponentType<BoxProps>;
|
|
9
|
+
export default Root;
|
|
10
|
+
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-content/styled.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAS,UAAU,EAAU,MAAM,eAAe,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,QAAQ,CAgBtC,CAAA;AAEH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,UAAU,CAa1C,CAAA;AAEH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,UAAU,CAAqC,CAAA;AAEtF,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAqE,CAAA;AAE9G,eAAO,MAAM,KAAK,EAAE,aAAa,CAAC,QAAQ,CAKvC,CAAA;AAEH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,QAAQ,CAUxC,CAAA;AAEH,eAAe,IAAI,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ButtonProps, StackProps } from '@mui/material';
|
|
3
|
+
export interface ICartContentOptions {
|
|
4
|
+
labels?: {
|
|
5
|
+
title?: string;
|
|
6
|
+
buttonCheckout?: string;
|
|
7
|
+
itemsSuffixSingle?: string;
|
|
8
|
+
itemsSuffixMany?: string;
|
|
9
|
+
};
|
|
10
|
+
empty?: {
|
|
11
|
+
title?: string;
|
|
12
|
+
subTitle?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface ICartContentViewContext<T> extends ICartContentOptions {
|
|
16
|
+
carts: T[];
|
|
17
|
+
isMobile?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type CartContentSlot<T> = React.ReactNode | ((ctx: ICartContentViewContext<T>) => React.ReactNode);
|
|
20
|
+
export interface ICartContentSlots<T> {
|
|
21
|
+
header?: CartContentSlot<T>;
|
|
22
|
+
headerProps?: StackProps;
|
|
23
|
+
headerLeft?: CartContentSlot<T>;
|
|
24
|
+
headerLeftProps?: StackProps;
|
|
25
|
+
headerRight?: CartContentSlot<T>;
|
|
26
|
+
headerRightProps?: StackProps;
|
|
27
|
+
items?: CartContentSlot<T>;
|
|
28
|
+
beforeItems?: (ctx: ICartContentViewContext<T>) => React.ReactNode;
|
|
29
|
+
afterItems?: (ctx: ICartContentViewContext<T>) => React.ReactNode;
|
|
30
|
+
item?: (item: T, index: number, ctx: ICartContentViewContext<T>) => React.ReactNode;
|
|
31
|
+
footer?: CartContentSlot<T>;
|
|
32
|
+
empty?: CartContentSlot<T>;
|
|
33
|
+
}
|
|
34
|
+
export interface ICartContentProps<T> {
|
|
35
|
+
carts?: T[];
|
|
36
|
+
isMobile?: boolean;
|
|
37
|
+
onClose?: () => void;
|
|
38
|
+
onCheckout?: (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement, MouseEvent>) => void;
|
|
39
|
+
buttonMoveToCartProps?: ButtonProps & {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
42
|
+
buttonCheckoutProps?: ButtonProps & {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
slots?: ICartContentSlots<T>;
|
|
46
|
+
options?: ICartContentOptions;
|
|
47
|
+
}
|
|
48
|
+
export default ICartContentProps;
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-content/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE5D,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;KACzB,CAAA;IACD,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,CAAA;CACF;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,CAAE,SAAQ,m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B,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,EAAE,UAAU,CAAC,KAAK,IAAI,CAAA;IAC7F,qBAAqB,CAAC,EAAE,WAAW,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;IAC5D,mBAAmB,CAAC,EAAE,WAAW,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;IAC1D,KAAK,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAC9B;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import IFactoryCartProps, { ICartOptions } from './types';
|
|
3
|
+
export declare const createCartItem: <T = {}>(configs?: ICartOptions<T> | undefined) => ComponentType<IFactoryCartProps<T>>;
|
|
4
|
+
export default createCartItem;
|
|
5
|
+
//# sourceMappingURL=create.cart-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.cart-item.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-item/create.cart-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAW,MAAM,OAAO,CAAA;AAG9C,OAAO,iBAAiB,EAAE,EAAgB,YAAY,EAAE,MAAM,SAAS,CAAA;AAGvE,eAAO,MAAM,cAAc,wFA2D1B,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-item/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { BoxProps } from '@mui/material';
|
|
3
|
+
import type { IImageWithFallbackProps } from 'dinocollab-core/components';
|
|
4
|
+
export declare const ItemRoot: ComponentType<BoxProps>;
|
|
5
|
+
export declare const ItemImg: ComponentType<IImageWithFallbackProps>;
|
|
6
|
+
export declare const ItemContent: ComponentType<BoxProps>;
|
|
7
|
+
export declare const ItemTitle: ComponentType<BoxProps>;
|
|
8
|
+
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-item/styled.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAEzE,eAAO,MAAM,QAAQ,EAAE,aAAa,CAAC,QAAQ,CA0B1C,CAAA;AAEH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,uBAAuB,CAOxD,CAAA;AAEH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,QAAQ,CAQ9C,CAAA;AAEF,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,QAAQ,CAa3C,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TypographyProps } from '@mui/material';
|
|
3
|
+
export interface ICartOptions<T> {
|
|
4
|
+
slots?: ICartSlots<T>;
|
|
5
|
+
}
|
|
6
|
+
export interface ICartContext<T> {
|
|
7
|
+
item: T;
|
|
8
|
+
}
|
|
9
|
+
export type CartSlot<T> = React.ReactNode | ((ctx: ICartContext<T>) => React.ReactNode);
|
|
10
|
+
export interface ICartSlots<T> {
|
|
11
|
+
beforeTile?: CartSlot<T>;
|
|
12
|
+
afterTile?: CartSlot<T>;
|
|
13
|
+
}
|
|
14
|
+
export interface IFactoryCartProps<T = {}> {
|
|
15
|
+
item: T;
|
|
16
|
+
name?: string;
|
|
17
|
+
imageUrl?: string;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
onRemoveCart?: (item: T) => void;
|
|
20
|
+
itemTitleProps?: TypographyProps;
|
|
21
|
+
itemTitlePropsGetter?: (item: T, close?: () => void) => TypographyProps;
|
|
22
|
+
slots?: ICartSlots<T>;
|
|
23
|
+
}
|
|
24
|
+
export default IFactoryCartProps;
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/factory/cart-item/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CACtB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;AAEvF,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,EAAE;IACvC,IAAI,EAAE,CAAC,CAAA;IACP,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;IAChC,cAAc,CAAC,EAAE,eAAe,CAAA;IAChC,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,IAAI,KAAK,eAAe,CAAA;IACvE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CACtB;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factory/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { SxProps, Theme } from '@mui/material';
|
|
3
3
|
export interface IControlsConfig {
|
|
4
4
|
autoPlay?: boolean;
|
|
@@ -14,7 +14,7 @@ export interface MediaPlayerSlot {
|
|
|
14
14
|
anotherControls?: React.ReactNode;
|
|
15
15
|
mediaMetadata?: MediaMetadata;
|
|
16
16
|
}
|
|
17
|
-
interface IProps extends MediaPlayerSlot
|
|
17
|
+
interface IProps extends MediaPlayerSlot {
|
|
18
18
|
src?: string;
|
|
19
19
|
sx?: SxProps<Theme>;
|
|
20
20
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoplayer.d.ts","sourceRoot":"","sources":["../../../../src/media-player/core/videoplayer.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"videoplayer.d.ts","sourceRoot":"","sources":["../../../../src/media-player/core/videoplayer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAsB,OAAO,EAAE,KAAK,EAA2B,MAAM,eAAe,CAAA;AAsB3F,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;CACvC;AAGD,eAAO,MAAM,qBAAqB,EAAE,eAOnC,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACjC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AACD,UAAU,MAAO,SAAQ,eAAe;IACtC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,eAAe,qGAyFnB,CAAA;AAEF,eAAe,eAAe,CAAA"}
|
|
@@ -2,7 +2,6 @@ export * from './configs';
|
|
|
2
2
|
export * from './types';
|
|
3
3
|
export * from './guide-steps';
|
|
4
4
|
export * from './media-widget';
|
|
5
|
-
export type { ITypographyProps } from './media-widget/item-title-props-context';
|
|
6
5
|
export * from './group-selector';
|
|
7
6
|
export * from './hooks';
|
|
8
7
|
export * from './service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/media-right/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AAEzB,cAAc,SAAS,CAAA;AAEvB,cAAc,eAAe,CAAA;AAE7B,cAAc,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/media-right/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AAEzB,cAAc,SAAS,CAAA;AAEvB,cAAc,eAAe,CAAA;AAE7B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,SAAS,CAAA;AAEvB,cAAc,WAAW,CAAA;AAEzB,cAAc,WAAW,CAAA"}
|