sbwb-ds 3.1.13 → 3.1.14
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/sbwb-ds.js
CHANGED
|
@@ -86763,23 +86763,23 @@ const oWe = ({
|
|
|
86763
86763
|
hasMore: p,
|
|
86764
86764
|
isLoading: v,
|
|
86765
86765
|
onLoadMore: g
|
|
86766
|
-
}) => {
|
|
86767
|
-
const [
|
|
86768
|
-
|
|
86769
|
-
}, [i]),
|
|
86770
|
-
if (!
|
|
86766
|
+
}, C) => {
|
|
86767
|
+
const [w, b] = lt(n), x = tt(null), S = fr(() => {
|
|
86768
|
+
b((V) => !V), i == null || i();
|
|
86769
|
+
}, [i]), M = fr(() => {
|
|
86770
|
+
if (!x.current || v || !p)
|
|
86771
86771
|
return;
|
|
86772
|
-
const { scrollTop:
|
|
86773
|
-
|
|
86772
|
+
const { scrollTop: V, scrollHeight: D, clientHeight: T } = x.current;
|
|
86773
|
+
D - V <= T + 5 && (g == null || g());
|
|
86774
86774
|
}, [v, p, g]);
|
|
86775
86775
|
if (!f)
|
|
86776
86776
|
return null;
|
|
86777
|
-
const
|
|
86777
|
+
const L = /* @__PURE__ */ Ve(
|
|
86778
86778
|
Jze,
|
|
86779
86779
|
{
|
|
86780
|
-
ref:
|
|
86780
|
+
ref: C,
|
|
86781
86781
|
style: { ...s, width: c, height: u },
|
|
86782
|
-
isPinned:
|
|
86782
|
+
isPinned: w,
|
|
86783
86783
|
floating: l,
|
|
86784
86784
|
zIndex: h,
|
|
86785
86785
|
children: [
|
|
@@ -86789,11 +86789,11 @@ const oWe = ({
|
|
|
86789
86789
|
i && /* @__PURE__ */ R(
|
|
86790
86790
|
Sr,
|
|
86791
86791
|
{
|
|
86792
|
-
iconName:
|
|
86792
|
+
iconName: w ? "PinFillMd" : "PinMd",
|
|
86793
86793
|
color: y.colors.neutralColors.colorNeutralCloudy,
|
|
86794
86794
|
hoverColor: y.colors.neutralColors.colorNeutralDarkest,
|
|
86795
|
-
title:
|
|
86796
|
-
onClick:
|
|
86795
|
+
title: w ? "Desfixar da tela" : "Fixar na tela",
|
|
86796
|
+
onClick: S
|
|
86797
86797
|
}
|
|
86798
86798
|
),
|
|
86799
86799
|
a && /* @__PURE__ */ R(
|
|
@@ -86814,14 +86814,14 @@ const oWe = ({
|
|
|
86814
86814
|
o === "default" ? lWe(
|
|
86815
86815
|
e,
|
|
86816
86816
|
t,
|
|
86817
|
-
|
|
86818
|
-
|
|
86817
|
+
x,
|
|
86818
|
+
M,
|
|
86819
86819
|
v
|
|
86820
|
-
) : /* @__PURE__ */ R(fW, { ref:
|
|
86820
|
+
) : /* @__PURE__ */ R(fW, { ref: x, onScroll: M, children: d })
|
|
86821
86821
|
]
|
|
86822
86822
|
}
|
|
86823
86823
|
);
|
|
86824
|
-
return l ? Qf.createPortal(
|
|
86824
|
+
return l ? Qf.createPortal(L, document.body) : L;
|
|
86825
86825
|
}
|
|
86826
86826
|
);
|
|
86827
86827
|
export {
|
package/dist/sbwb-ds.umd.cjs
CHANGED
|
@@ -7456,4 +7456,4 @@ echarts.use([`+F+"]);":"Unknown series "+$))}return}if(d==="tooltip"){if(S){proc
|
|
|
7456
7456
|
font-weight: ${e?y.fonts.fontWeight.fontWeightBold:y.fonts.fontWeight.fontWeightRegular};
|
|
7457
7457
|
}
|
|
7458
7458
|
`}
|
|
7459
|
-
`;const hW=({id:e,message:t,date:r,isNew:n,onClick:a})=>R(YEe,{isNew:n,onClick:()=>e!==void 0&&(a==null?void 0:a(e)),children:ke("div",{children:[ke("p",{children:[t,n&&R(mr,{iconName:"FiberManualRecordFill1Sm",color:"rgba(33, 150, 243, 1)",customStyles:{marginLeft:"2.5px",marginTop:"2px",marginRight:"3.1px"}})]}),R("span",{children:r})]})}),KEe=(e,t,r,n,a)=>e.length===0?R(qEe,{children:"Você ainda não tem notificações."}):ke(fW,{ref:r,onScroll:n,children:[e.map(i=>R(hW,{...i,onClick:t},i.id)),a&&R(XEe,{children:"Carregando mais notificações..."})]}),QEe=ee.forwardRef(({notifications:e=[],onNotificationClick:t,title:r,pinned:n=!1,onClose:a,onPin:i,mode:o="default",floating:l=!1,position:s={top:"10px",right:"10px"},width:c="309px",height:u="400px",children:d,isOpen:f,zIndex:h="9999999",hasMore:p,isLoading:g,onLoadMore:m})=>{const[
|
|
7459
|
+
`;const hW=({id:e,message:t,date:r,isNew:n,onClick:a})=>R(YEe,{isNew:n,onClick:()=>e!==void 0&&(a==null?void 0:a(e)),children:ke("div",{children:[ke("p",{children:[t,n&&R(mr,{iconName:"FiberManualRecordFill1Sm",color:"rgba(33, 150, 243, 1)",customStyles:{marginLeft:"2.5px",marginTop:"2px",marginRight:"3.1px"}})]}),R("span",{children:r})]})}),KEe=(e,t,r,n,a)=>e.length===0?R(qEe,{children:"Você ainda não tem notificações."}):ke(fW,{ref:r,onScroll:n,children:[e.map(i=>R(hW,{...i,onClick:t},i.id)),a&&R(XEe,{children:"Carregando mais notificações..."})]}),QEe=ee.forwardRef(({notifications:e=[],onNotificationClick:t,title:r,pinned:n=!1,onClose:a,onPin:i,mode:o="default",floating:l=!1,position:s={top:"10px",right:"10px"},width:c="309px",height:u="400px",children:d,isOpen:f,zIndex:h="9999999",hasMore:p,isLoading:g,onLoadMore:m},C)=>{const[w,S]=ee.useState(n),b=ee.useRef(null),x=ee.useCallback(()=>{S(V=>!V),i==null||i()},[i]),_=ee.useCallback(()=>{if(!b.current||g||!p)return;const{scrollTop:V,scrollHeight:H,clientHeight:T}=b.current;H-V<=T+5&&(m==null||m())},[g,p,m]);if(!f)return null;const L=ke(WEe,{ref:C,style:{...s,width:c,height:u},isPinned:w,floating:l,zIndex:h,children:[ke(GEe,{children:[R(UEe,{children:r}),ke(jEe,{children:[i&&R(mr,{iconName:w?"PinFillMd":"PinMd",color:y.colors.neutralColors.colorNeutralCloudy,hoverColor:y.colors.neutralColors.colorNeutralDarkest,title:w?"Desfixar da tela":"Fixar na tela",onClick:x}),a&&R(mr,{iconName:"CloseMd",color:y.colors.neutralColors.colorNeutralCloudy,hoverColor:y.colors.neutralColors.colorNeutralDarkest,title:"Fechar",onClick:a,customStyles:{cursor:"pointer"}})]})]}),o==="default"?KEe(e,t,b,_,g):R(fW,{ref:b,onScroll:_,children:d})]});return l?U6.default.createPortal(L,document.body):L});ht.Accordion=LG,ht.ActionButton=Fn,ht.ActionButtonCell=n3e,ht.Actions=OG,ht.Alert=yj,ht.Autocomplete=oL,ht.Avatar=RM,ht.BackgroundSection=Tee,ht.Breadcrumb=BM,ht.Button=x1,ht.ChartBar=N_e,ht.ChartPie=E_e,ht.ChartRadar=u_e,ht.Checkbox=p0,ht.Column=aU,ht.Container=oU,ht.DataTable=J2e,ht.DatePicker=MV,ht.Divider=Jc,ht.EmptyBox=iX,ht.Footer=zEe,ht.HeaderTitle=V2e,ht.Icon=mr,ht.Input=Zc,ht.ItemList=SU,ht.Linear=S_e,ht.Loading=Fj,ht.LocalStorageAdapter=Jh,ht.MenuMultiSelect=Hv,ht.MenuSelect=D2,ht.Modal=ote,ht.MultiSelect=PV,ht.Notification=QEe,ht.NotificationText=hW,ht.Pagination=EU,ht.ProgressBar=jj,ht.ProgressCircle=tX,ht.Radio=GM,ht.ReviewStatus=U_e,ht.Row=TU,ht.Select=bp,ht.Sheet=TEe,ht.SheetHistory=wEe,ht.Sidebar=t2e,ht.SkeletonLoading=GU,ht.Status=YU,ht.Stepper=tY,ht.Switch=lY,ht.TabBar=d2e,ht.Table=_2e,ht.TableCell=j9,ht.TableHeaderCell=P4,ht.TableProvider=C2e,ht.TableRow=Tg,ht.Tag=xp,ht.Textarea=Mp,ht.TokenArea=oj,ht.Toolbar=t3e,ht.Tooltip=Qr,ht.Tree=dW,ht.sg=y,ht.useTableContext=VV,Object.defineProperty(ht,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef, forwardRef, useCallback } from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import * as C from './styles';
|
|
4
|
-
import { sg } from '../../../styles/styleGuide'
|
|
4
|
+
import { sg } from '../../../styles/styleGuide';
|
|
5
5
|
import Icon from '../../atoms/Icon';
|
|
6
6
|
|
|
7
7
|
export interface NotificationItemProps {
|
|
@@ -68,10 +68,12 @@ const renderNotificationContent = (
|
|
|
68
68
|
onNotificationClick?: (id: number) => void,
|
|
69
69
|
listRef?: React.RefObject<HTMLDivElement>,
|
|
70
70
|
handleScroll?: () => void,
|
|
71
|
-
isLoading?: boolean
|
|
71
|
+
isLoading?: boolean
|
|
72
72
|
) => {
|
|
73
73
|
if (notifications.length === 0) {
|
|
74
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
<C.EmptyStateText>Você ainda não tem notificações.</C.EmptyStateText>
|
|
76
|
+
);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
return (
|
|
@@ -87,105 +89,110 @@ const renderNotificationContent = (
|
|
|
87
89
|
<C.LoadingWrapper>Carregando mais notificações...</C.LoadingWrapper>
|
|
88
90
|
)}
|
|
89
91
|
</C.NotificationList>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const NotificationComponent = forwardRef<HTMLDivElement, NotificationProps>(
|
|
96
|
+
(
|
|
97
|
+
{
|
|
98
|
+
notifications = [],
|
|
99
|
+
onNotificationClick,
|
|
100
|
+
title,
|
|
101
|
+
pinned = false,
|
|
102
|
+
onClose,
|
|
103
|
+
onPin,
|
|
104
|
+
mode = 'default',
|
|
105
|
+
floating = false,
|
|
106
|
+
position = { top: '10px', right: '10px' },
|
|
107
|
+
width = '309px',
|
|
108
|
+
height = '400px',
|
|
109
|
+
children,
|
|
110
|
+
isOpen,
|
|
111
|
+
zIndex = '9999999',
|
|
112
|
+
hasMore,
|
|
113
|
+
isLoading,
|
|
114
|
+
onLoadMore,
|
|
115
|
+
},
|
|
116
|
+
ref
|
|
117
|
+
) => {
|
|
118
|
+
const [isPinned, setIsPinned] = useState(pinned);
|
|
119
|
+
const notificationListRef = useRef<HTMLDivElement>(null);
|
|
92
120
|
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
pinned = false,
|
|
98
|
-
onClose,
|
|
99
|
-
onPin,
|
|
100
|
-
mode = 'default',
|
|
101
|
-
floating = false,
|
|
102
|
-
position = { top: '10px', right: '10px' },
|
|
103
|
-
width = '309px',
|
|
104
|
-
height = '400px',
|
|
105
|
-
children,
|
|
106
|
-
isOpen,
|
|
107
|
-
zIndex = '9999999',
|
|
108
|
-
hasMore,
|
|
109
|
-
isLoading,
|
|
110
|
-
onLoadMore,
|
|
111
|
-
}) => {
|
|
112
|
-
const [isPinned, setIsPinned] = useState(pinned);
|
|
113
|
-
const notificationRef = useRef<HTMLDivElement>(null);
|
|
121
|
+
const handlePin = useCallback(() => {
|
|
122
|
+
setIsPinned((prev) => !prev);
|
|
123
|
+
onPin?.();
|
|
124
|
+
}, [onPin]);
|
|
114
125
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
126
|
+
const handleScroll = useCallback(() => {
|
|
127
|
+
if (!notificationListRef.current || isLoading || !hasMore) return;
|
|
128
|
+
const { scrollTop, scrollHeight, clientHeight } =
|
|
129
|
+
notificationListRef.current;
|
|
130
|
+
if (scrollHeight - scrollTop <= clientHeight + 5) {
|
|
131
|
+
onLoadMore?.();
|
|
132
|
+
}
|
|
133
|
+
}, [isLoading, hasMore, onLoadMore]);
|
|
119
134
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const { scrollTop, scrollHeight, clientHeight } = notificationRef.current
|
|
123
|
-
if (scrollHeight - scrollTop <= clientHeight + 5) {
|
|
124
|
-
onLoadMore?.()
|
|
135
|
+
if (!isOpen) {
|
|
136
|
+
return null;
|
|
125
137
|
}
|
|
126
|
-
}, [isLoading, hasMore, onLoadMore])
|
|
127
138
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
const notificationContent = (
|
|
140
|
+
<C.Container
|
|
141
|
+
ref={ref}
|
|
142
|
+
style={{ ...position, width, height }}
|
|
143
|
+
isPinned={isPinned}
|
|
144
|
+
floating={floating}
|
|
145
|
+
zIndex={zIndex}
|
|
146
|
+
>
|
|
147
|
+
<C.Header>
|
|
148
|
+
<C.Title>{title}</C.Title>
|
|
149
|
+
<C.Icons>
|
|
150
|
+
{onPin && (
|
|
151
|
+
<Icon
|
|
152
|
+
iconName={isPinned ? 'PinFillMd' : 'PinMd'}
|
|
153
|
+
color={sg.colors.neutralColors.colorNeutralCloudy}
|
|
154
|
+
hoverColor={sg.colors.neutralColors.colorNeutralDarkest}
|
|
155
|
+
title={isPinned ? 'Desfixar da tela' : 'Fixar na tela'}
|
|
156
|
+
onClick={handlePin}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
{onClose && (
|
|
160
|
+
<Icon
|
|
161
|
+
iconName="CloseMd"
|
|
162
|
+
color={sg.colors.neutralColors.colorNeutralCloudy}
|
|
163
|
+
hoverColor={sg.colors.neutralColors.colorNeutralDarkest}
|
|
164
|
+
title="Fechar"
|
|
165
|
+
onClick={onClose}
|
|
166
|
+
customStyles={{
|
|
167
|
+
cursor: 'pointer',
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
</C.Icons>
|
|
172
|
+
</C.Header>
|
|
131
173
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
hoverColor={sg.colors.neutralColors.colorNeutralDarkest}
|
|
148
|
-
title={isPinned ? "Desfixar da tela" : "Fixar na tela"}
|
|
149
|
-
onClick={handlePin}
|
|
150
|
-
/>
|
|
151
|
-
)}
|
|
152
|
-
{onClose && (
|
|
153
|
-
<Icon
|
|
154
|
-
iconName="CloseMd"
|
|
155
|
-
color={sg.colors.neutralColors.colorNeutralCloudy}
|
|
156
|
-
hoverColor={sg.colors.neutralColors.colorNeutralDarkest}
|
|
157
|
-
title="Fechar"
|
|
158
|
-
onClick={onClose}
|
|
159
|
-
customStyles={{
|
|
160
|
-
cursor: "pointer",
|
|
161
|
-
}}
|
|
162
|
-
/>
|
|
163
|
-
)}
|
|
164
|
-
</C.Icons>
|
|
165
|
-
</C.Header>
|
|
174
|
+
{mode === 'default' ? (
|
|
175
|
+
renderNotificationContent(
|
|
176
|
+
notifications,
|
|
177
|
+
onNotificationClick,
|
|
178
|
+
notificationListRef,
|
|
179
|
+
handleScroll,
|
|
180
|
+
isLoading
|
|
181
|
+
)
|
|
182
|
+
) : (
|
|
183
|
+
<C.NotificationList ref={notificationListRef} onScroll={handleScroll}>
|
|
184
|
+
{children}
|
|
185
|
+
</C.NotificationList>
|
|
186
|
+
)}
|
|
187
|
+
</C.Container>
|
|
188
|
+
);
|
|
166
189
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onNotificationClick,
|
|
171
|
-
notificationRef,
|
|
172
|
-
handleScroll,
|
|
173
|
-
isLoading,
|
|
174
|
-
)
|
|
175
|
-
) : (
|
|
176
|
-
<C.NotificationList ref={notificationRef} onScroll={handleScroll}>
|
|
177
|
-
{children}
|
|
178
|
-
</C.NotificationList>
|
|
179
|
-
)}
|
|
180
|
-
</C.Container>
|
|
181
|
-
);
|
|
190
|
+
if (floating) {
|
|
191
|
+
return ReactDOM.createPortal(notificationContent, document.body);
|
|
192
|
+
}
|
|
182
193
|
|
|
183
|
-
|
|
184
|
-
return ReactDOM.createPortal(notificationContent, document.body);
|
|
194
|
+
return notificationContent;
|
|
185
195
|
}
|
|
186
|
-
|
|
187
|
-
return notificationContent;
|
|
188
|
-
}
|
|
189
196
|
);
|
|
190
197
|
|
|
191
198
|
export default NotificationComponent;
|