@papernote/ui 1.9.1 → 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.
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  /**
2
3
  * Represents a single notification item
3
4
  */
@@ -71,6 +72,11 @@ export interface NotificationBellProps {
71
72
  * - 'outlined': Visible border/container with subtle background
72
73
  */
73
74
  bellStyle?: NotificationBellStyle;
75
+ /**
76
+ * Custom icon to use instead of the default bell
77
+ * Use this to provide your own notification icon
78
+ */
79
+ icon?: React.ReactNode;
74
80
  }
75
81
  /**
76
82
  * NotificationBell - A bell icon with badge and dropdown for displaying notifications
@@ -100,5 +106,5 @@ export interface NotificationBellProps {
100
106
  * />
101
107
  * ```
102
108
  */
103
- export default function NotificationBell({ notifications, unreadCount: providedUnreadCount, onMarkAsRead, onMarkAllRead, onNotificationClick, onViewAll, loading, dropdownPosition, maxHeight, size, emptyMessage, viewAllText, disabled, className, variant, showUnreadInHeader, bellStyle, }: NotificationBellProps): import("react/jsx-runtime").JSX.Element;
109
+ export default function NotificationBell({ notifications, unreadCount: providedUnreadCount, onMarkAsRead, onMarkAllRead, onNotificationClick, onViewAll, loading, dropdownPosition, maxHeight, size, emptyMessage, viewAllText, disabled, className, variant, showUnreadInHeader, bellStyle, icon: customIcon, }: NotificationBellProps): import("react/jsx-runtime").JSX.Element;
104
110
  //# sourceMappingURL=NotificationBell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationBell.d.ts","sourceRoot":"","sources":["../../src/components/NotificationBell.tsx"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAA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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACnC;AAmED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,aAAa,EACb,WAAW,EAAE,mBAAmB,EAChC,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,OAAe,EACf,gBAAiC,EACjC,SAAmB,EACnB,IAAW,EACX,YAAiC,EACjC,WAAsC,EACtC,QAAgB,EAChB,SAAc,EACd,OAAmB,EACnB,kBAA0B,EAC1B,SAAmB,GACpB,EAAE,qBAAqB,2CA+VvB"}
1
+ {"version":3,"file":"NotificationBell.d.ts","sourceRoot":"","sources":["../../src/components/NotificationBell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAS9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC/C,wCAAwC;IACxC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC/C,wCAAwC;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6CAA6C;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,+CAA+C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kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAuED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,aAAa,EACb,WAAW,EAAE,mBAAmB,EAChC,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,OAAe,EACf,gBAAiC,EACjC,SAAmB,EACnB,IAAW,EACX,YAAiC,EACjC,WAAsC,EACtC,QAAgB,EAChB,SAAc,EACd,OAAmB,EACnB,kBAA0B,EAC1B,SAAmB,EACnB,IAAI,EAAE,UAAU,GACjB,EAAE,qBAAqB,2CAiWvB"}
package/dist/index.d.ts CHANGED
@@ -4191,6 +4191,11 @@ interface NotificationBellProps {
4191
4191
  * - 'outlined': Visible border/container with subtle background
4192
4192
  */
4193
4193
  bellStyle?: NotificationBellStyle;
4194
+ /**
4195
+ * Custom icon to use instead of the default bell
4196
+ * Use this to provide your own notification icon
4197
+ */
4198
+ icon?: React__default.ReactNode;
4194
4199
  }
4195
4200
  /**
4196
4201
  * NotificationBell - A bell icon with badge and dropdown for displaying notifications
@@ -4220,7 +4225,7 @@ interface NotificationBellProps {
4220
4225
  * />
4221
4226
  * ```
4222
4227
  */
4223
- declare function NotificationBell({ notifications, unreadCount: providedUnreadCount, onMarkAsRead, onMarkAllRead, onNotificationClick, onViewAll, loading, dropdownPosition, maxHeight, size, emptyMessage, viewAllText, disabled, className, variant, showUnreadInHeader, bellStyle, }: NotificationBellProps): react_jsx_runtime.JSX.Element;
4228
+ declare function NotificationBell({ notifications, unreadCount: providedUnreadCount, onMarkAsRead, onMarkAllRead, onNotificationClick, onViewAll, loading, dropdownPosition, maxHeight, size, emptyMessage, viewAllText, disabled, className, variant, showUnreadInHeader, bellStyle, icon: customIcon, }: NotificationBellProps): react_jsx_runtime.JSX.Element;
4224
4229
 
4225
4230
  /**
4226
4231
  * Configuration for how data should display in card view
package/dist/index.esm.js CHANGED
@@ -10103,19 +10103,23 @@ const defaultTypeLabels = {
10103
10103
  };
10104
10104
  /**
10105
10105
  * Map dropdown position to Popover placement
10106
+ * - bottom-right: Below bell, dropdown's right edge aligns with bell
10107
+ * - bottom-left: Below bell, dropdown's left edge aligns with bell
10108
+ * - top-right: Above bell, dropdown's right edge aligns with bell
10109
+ * - top-left: Above bell, dropdown's left edge aligns with bell
10106
10110
  */
10107
10111
  function getPopoverPlacement(position) {
10108
10112
  switch (position) {
10109
10113
  case 'bottom-right':
10110
10114
  case 'right':
10111
- return 'bottom-start';
10115
+ return 'bottom-start'; // Below, extends to the right
10112
10116
  case 'bottom-left':
10113
10117
  case 'left':
10114
- return 'bottom-end';
10118
+ return 'bottom-end'; // Below, extends to the left
10115
10119
  case 'top-right':
10116
- return 'top-start';
10120
+ return 'top-start'; // Above, extends to the right
10117
10121
  case 'top-left':
10118
- return 'top-end';
10122
+ return 'top-end'; // Above, extends to the left
10119
10123
  default:
10120
10124
  return 'bottom-start';
10121
10125
  }
@@ -10148,7 +10152,7 @@ function getPopoverPlacement(position) {
10148
10152
  * />
10149
10153
  * ```
10150
10154
  */
10151
- function NotificationBell({ notifications, unreadCount: providedUnreadCount, onMarkAsRead, onMarkAllRead, onNotificationClick, onViewAll, loading = false, dropdownPosition = 'bottom-right', maxHeight = '400px', size = 'md', emptyMessage = 'No notifications', viewAllText = 'View all notifications', disabled = false, className = '', variant = 'compact', showUnreadInHeader = false, bellStyle = 'ghost', }) {
10155
+ function NotificationBell({ notifications, unreadCount: providedUnreadCount, onMarkAsRead, onMarkAllRead, onNotificationClick, onViewAll, loading = false, dropdownPosition = 'bottom-right', maxHeight = '400px', size = 'md', emptyMessage = 'No notifications', viewAllText = 'View all notifications', disabled = false, className = '', variant = 'compact', showUnreadInHeader = false, bellStyle = 'ghost', icon: customIcon, }) {
10152
10156
  const [isOpen, setIsOpen] = useState(false);
10153
10157
  // Calculate unread count if not provided
10154
10158
  const unreadCount = useMemo(() => {
@@ -10193,6 +10197,8 @@ function NotificationBell({ notifications, unreadCount: providedUnreadCount, onM
10193
10197
  md: 'p-3',
10194
10198
  lg: 'p-4',
10195
10199
  };
10200
+ // Default bell icon or custom icon
10201
+ const bellIcon = customIcon || jsx(Bell, { className: `${iconSizes[size]} text-ink-600` });
10196
10202
  // Trigger button
10197
10203
  const triggerButton = bellStyle === 'outlined' ? (jsxs("div", { className: "relative inline-block", children: [jsx("button", { className: `
10198
10204
  ${outlinedSizeClasses[size]}
@@ -10204,16 +10210,16 @@ function NotificationBell({ notifications, unreadCount: providedUnreadCount, onM
10204
10210
  ${className}
10205
10211
  `, disabled: disabled, "aria-label": unreadCount > 0
10206
10212
  ? `Notifications - ${unreadCount} unread`
10207
- : 'Notifications', children: jsx(Bell, { className: `${iconSizes[size]} text-ink-600` }) }), unreadCount > 0 && (jsx("span", { className: `
10213
+ : 'Notifications', children: bellIcon }), unreadCount > 0 && (jsx("span", { className: `
10208
10214
  absolute -top-1 -right-1
10209
10215
  flex items-center justify-center
10210
10216
  min-w-[18px] h-[18px] px-1.5
10211
10217
  rounded-full text-white font-semibold text-[11px]
10212
10218
  bg-error-500 shadow-sm
10213
10219
  pointer-events-none
10214
- `, "aria-label": `${unreadCount > 99 ? '99+' : unreadCount} notifications`, children: unreadCount > 99 ? '99+' : unreadCount }))] })) : (jsx(Button, { variant: "ghost", iconOnly: true, size: size, disabled: disabled, badge: unreadCount > 0 ? unreadCount : undefined, badgeVariant: "error", "aria-label": unreadCount > 0
10220
+ `, "aria-label": `${unreadCount > 99 ? '99+' : unreadCount} notifications`, children: unreadCount > 99 ? '99+' : unreadCount }))] })) : (jsx(Button, { variant: "ghost", iconOnly: true, size: size, disabled: disabled, icon: bellIcon, badge: unreadCount > 0 ? unreadCount : undefined, badgeVariant: "error", "aria-label": unreadCount > 0
10215
10221
  ? `Notifications - ${unreadCount} unread`
10216
- : 'Notifications', className: className, children: jsx(Bell, { className: iconSizes[size] }) }));
10222
+ : 'Notifications', className: className }));
10217
10223
  // Header title with optional unread count
10218
10224
  const headerTitle = showUnreadInHeader && unreadCount > 0
10219
10225
  ? `Notifications (${unreadCount} unread)`