@papernote/ui 1.9.2 → 1.9.3
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/components/NotificationBell.d.ts +7 -1
- package/dist/components/NotificationBell.d.ts.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.esm.js +42 -48
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +42 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/NotificationBell.stories.tsx +71 -0
- package/src/components/NotificationBell.tsx +12 -4
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import NotificationBell, { NotificationItem } from './NotificationBell';
|
|
|
4
4
|
import Stack from './Stack';
|
|
5
5
|
import Text from './Text';
|
|
6
6
|
import Box from './Box';
|
|
7
|
+
import { MessageCircle, Inbox, BellRing, Mail } from 'lucide-react';
|
|
7
8
|
|
|
8
9
|
const meta = {
|
|
9
10
|
title: 'Components/NotificationBell',
|
|
@@ -757,3 +758,73 @@ export const OutlinedInHeader: Story = {
|
|
|
757
758
|
);
|
|
758
759
|
},
|
|
759
760
|
};
|
|
761
|
+
|
|
762
|
+
export const CustomIcon: Story = {
|
|
763
|
+
render: () => (
|
|
764
|
+
<Stack direction="horizontal" spacing="xl" align="center">
|
|
765
|
+
<Stack align="center" spacing="sm">
|
|
766
|
+
<NotificationBell
|
|
767
|
+
notifications={sampleNotifications}
|
|
768
|
+
unreadCount={3}
|
|
769
|
+
icon={<MessageCircle className="h-5 w-5 text-ink-600" />}
|
|
770
|
+
onViewAll={() => {}}
|
|
771
|
+
/>
|
|
772
|
+
<Text size="xs" color="muted">Message icon</Text>
|
|
773
|
+
</Stack>
|
|
774
|
+
<Stack align="center" spacing="sm">
|
|
775
|
+
<NotificationBell
|
|
776
|
+
notifications={sampleNotifications}
|
|
777
|
+
unreadCount={5}
|
|
778
|
+
icon={<Inbox className="h-5 w-5 text-ink-600" />}
|
|
779
|
+
onViewAll={() => {}}
|
|
780
|
+
/>
|
|
781
|
+
<Text size="xs" color="muted">Inbox icon</Text>
|
|
782
|
+
</Stack>
|
|
783
|
+
<Stack align="center" spacing="sm">
|
|
784
|
+
<NotificationBell
|
|
785
|
+
notifications={sampleNotifications}
|
|
786
|
+
unreadCount={2}
|
|
787
|
+
icon={<BellRing className="h-5 w-5 text-ink-600" />}
|
|
788
|
+
onViewAll={() => {}}
|
|
789
|
+
/>
|
|
790
|
+
<Text size="xs" color="muted">Bell ring icon</Text>
|
|
791
|
+
</Stack>
|
|
792
|
+
<Stack align="center" spacing="sm">
|
|
793
|
+
<NotificationBell
|
|
794
|
+
notifications={sampleNotifications}
|
|
795
|
+
unreadCount={8}
|
|
796
|
+
icon={<Mail className="h-5 w-5 text-ink-600" />}
|
|
797
|
+
onViewAll={() => {}}
|
|
798
|
+
/>
|
|
799
|
+
<Text size="xs" color="muted">Mail icon</Text>
|
|
800
|
+
</Stack>
|
|
801
|
+
</Stack>
|
|
802
|
+
),
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
export const CustomIconOutlined: Story = {
|
|
806
|
+
render: () => (
|
|
807
|
+
<Stack direction="horizontal" spacing="xl" align="center">
|
|
808
|
+
<Stack align="center" spacing="sm">
|
|
809
|
+
<NotificationBell
|
|
810
|
+
notifications={sampleNotifications}
|
|
811
|
+
unreadCount={3}
|
|
812
|
+
bellStyle="outlined"
|
|
813
|
+
icon={<MessageCircle className="h-5 w-5 text-ink-600" />}
|
|
814
|
+
onViewAll={() => {}}
|
|
815
|
+
/>
|
|
816
|
+
<Text size="xs" color="muted">Outlined message</Text>
|
|
817
|
+
</Stack>
|
|
818
|
+
<Stack align="center" spacing="sm">
|
|
819
|
+
<NotificationBell
|
|
820
|
+
notifications={sampleNotifications}
|
|
821
|
+
unreadCount={5}
|
|
822
|
+
bellStyle="outlined"
|
|
823
|
+
icon={<Mail className="h-5 w-5 text-ink-600" />}
|
|
824
|
+
onViewAll={() => {}}
|
|
825
|
+
/>
|
|
826
|
+
<Text size="xs" color="muted">Outlined mail</Text>
|
|
827
|
+
</Stack>
|
|
828
|
+
</Stack>
|
|
829
|
+
),
|
|
830
|
+
};
|
|
@@ -89,6 +89,11 @@ export interface NotificationBellProps {
|
|
|
89
89
|
* - 'outlined': Visible border/container with subtle background
|
|
90
90
|
*/
|
|
91
91
|
bellStyle?: NotificationBellStyle;
|
|
92
|
+
/**
|
|
93
|
+
* Custom icon to use instead of the default bell
|
|
94
|
+
* Use this to provide your own notification icon
|
|
95
|
+
*/
|
|
96
|
+
icon?: React.ReactNode;
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
/**
|
|
@@ -206,6 +211,7 @@ export default function NotificationBell({
|
|
|
206
211
|
variant = 'compact',
|
|
207
212
|
showUnreadInHeader = false,
|
|
208
213
|
bellStyle = 'ghost',
|
|
214
|
+
icon: customIcon,
|
|
209
215
|
}: NotificationBellProps) {
|
|
210
216
|
const [isOpen, setIsOpen] = useState(false);
|
|
211
217
|
|
|
@@ -266,6 +272,9 @@ export default function NotificationBell({
|
|
|
266
272
|
lg: 'p-4',
|
|
267
273
|
};
|
|
268
274
|
|
|
275
|
+
// Default bell icon or custom icon
|
|
276
|
+
const bellIcon = customIcon || <Bell className={`${iconSizes[size]} text-ink-600`} />;
|
|
277
|
+
|
|
269
278
|
// Trigger button
|
|
270
279
|
const triggerButton = bellStyle === 'outlined' ? (
|
|
271
280
|
<div className="relative inline-block">
|
|
@@ -286,7 +295,7 @@ export default function NotificationBell({
|
|
|
286
295
|
: 'Notifications'
|
|
287
296
|
}
|
|
288
297
|
>
|
|
289
|
-
|
|
298
|
+
{bellIcon}
|
|
290
299
|
</button>
|
|
291
300
|
{unreadCount > 0 && (
|
|
292
301
|
<span
|
|
@@ -310,6 +319,7 @@ export default function NotificationBell({
|
|
|
310
319
|
iconOnly
|
|
311
320
|
size={size}
|
|
312
321
|
disabled={disabled}
|
|
322
|
+
icon={bellIcon}
|
|
313
323
|
badge={unreadCount > 0 ? unreadCount : undefined}
|
|
314
324
|
badgeVariant="error"
|
|
315
325
|
aria-label={
|
|
@@ -318,9 +328,7 @@ export default function NotificationBell({
|
|
|
318
328
|
: 'Notifications'
|
|
319
329
|
}
|
|
320
330
|
className={className}
|
|
321
|
-
|
|
322
|
-
<Bell className={iconSizes[size]} />
|
|
323
|
-
</Button>
|
|
331
|
+
/>
|
|
324
332
|
);
|
|
325
333
|
|
|
326
334
|
// Header title with optional unread count
|