@papernote/ui 1.10.6 → 1.10.7

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,15 +1,19 @@
1
1
  import React from 'react';
2
2
  import type { LucideIcon } from 'lucide-react';
3
3
  /**
4
- * Action configuration for swipe gestures
4
+ * Single action configuration for swipe gestures
5
5
  */
6
6
  export interface SwipeListAction {
7
+ /** Unique identifier for the action */
8
+ id: string;
7
9
  /** Background color variant or custom Tailwind class */
8
- color: 'destructive' | 'warning' | 'success' | 'primary' | string;
10
+ color: 'destructive' | 'warning' | 'success' | 'primary' | 'neutral' | string;
9
11
  /** Lucide icon to display */
10
12
  icon: LucideIcon;
11
- /** Label for accessibility */
13
+ /** Label shown below icon */
12
14
  label: string;
15
+ /** Click handler (can be async) */
16
+ onClick: () => void | Promise<void>;
13
17
  }
14
18
  /**
15
19
  * SwipeableListItem component props
@@ -17,50 +21,65 @@ export interface SwipeListAction {
17
21
  export interface SwipeableListItemProps {
18
22
  /** List item content */
19
23
  children: React.ReactNode;
20
- /** Handler called when swiped right past threshold (can be async) */
21
- onSwipeRight?: () => void | Promise<void>;
22
- /** Handler called when swiped left past threshold (can be async) */
23
- onSwipeLeft?: () => void | Promise<void>;
24
- /** Right swipe action configuration (revealed when swiping right) */
25
- rightAction?: SwipeListAction;
26
- /** Left swipe action configuration (revealed when swiping left) */
27
- leftAction?: SwipeListAction;
28
- /** Pixels of swipe before action triggers (default: 100) */
29
- swipeThreshold?: number;
24
+ /** Actions shown when swiping left (appear on right side) */
25
+ leftActions?: SwipeListAction[];
26
+ /** Actions shown when swiping right (appear on left side) */
27
+ rightActions?: SwipeListAction[];
28
+ /** Width per action button in pixels (default: 72) */
29
+ actionWidth?: number;
30
+ /** Enable full swipe to trigger first action (default: false) */
31
+ fullSwipe?: boolean;
32
+ /** Full swipe threshold as percentage of container width (default: 0.5) */
33
+ fullSwipeThreshold?: number;
30
34
  /** Disable swipe interactions */
31
35
  disabled?: boolean;
32
36
  /** Additional class name */
33
37
  className?: string;
38
+ /** Callback when swipe state changes */
39
+ onSwipeChange?: (direction: 'left' | 'right' | null) => void;
34
40
  }
35
41
  /**
36
- * SwipeableListItem - List item with swipe-to-action functionality
42
+ * SwipeableListItem - List item with swipe-to-reveal action buttons
37
43
  *
38
- * Designed for mobile workflows with keyboard accessibility:
39
- * - Swipe right to approve/confirm
40
- * - Swipe left to dismiss/delete
41
- * - Arrow keys for keyboard navigation
44
+ * Features:
45
+ * - Multiple actions per side (like email apps)
46
+ * - Full swipe to trigger primary action
47
+ * - Keyboard accessibility (Arrow keys + Tab + Enter)
42
48
  * - Async callback support with loading state
49
+ * - Haptic feedback on mobile
50
+ * - Smooth animations and visual polish
43
51
  *
44
- * @example
52
+ * @example Single action per side
45
53
  * ```tsx
46
54
  * <SwipeableListItem
47
- * onSwipeRight={() => handleApprove()}
48
- * onSwipeLeft={() => handleDismiss()}
49
- * rightAction={{
50
- * icon: Check,
51
- * color: 'success',
52
- * label: 'Approve'
53
- * }}
54
- * leftAction={{
55
- * icon: X,
56
- * color: 'destructive',
57
- * label: 'Dismiss'
58
- * }}
55
+ * rightActions={[
56
+ * { id: 'approve', icon: Check, color: 'success', label: 'Approve', onClick: handleApprove }
57
+ * ]}
58
+ * leftActions={[
59
+ * { id: 'delete', icon: Trash, color: 'destructive', label: 'Delete', onClick: handleDelete }
60
+ * ]}
59
61
  * >
60
62
  * <div className="p-4">List item content</div>
61
63
  * </SwipeableListItem>
62
64
  * ```
65
+ *
66
+ * @example Multiple actions (email-style)
67
+ * ```tsx
68
+ * <SwipeableListItem
69
+ * leftActions={[
70
+ * { id: 'delete', icon: Trash, color: 'destructive', label: 'Delete', onClick: handleDelete },
71
+ * { id: 'archive', icon: Archive, color: 'warning', label: 'Archive', onClick: handleArchive },
72
+ * ]}
73
+ * rightActions={[
74
+ * { id: 'read', icon: Mail, color: 'primary', label: 'Read', onClick: handleRead },
75
+ * { id: 'star', icon: Star, color: 'warning', label: 'Star', onClick: handleStar },
76
+ * ]}
77
+ * fullSwipe
78
+ * >
79
+ * <EmailListItem />
80
+ * </SwipeableListItem>
81
+ * ```
63
82
  */
64
- export declare function SwipeableListItem({ children, onSwipeRight, onSwipeLeft, rightAction, leftAction, swipeThreshold, disabled, className, }: SwipeableListItemProps): import("react/jsx-runtime").JSX.Element;
83
+ export declare function SwipeableListItem({ children, leftActions, rightActions, actionWidth, fullSwipe, fullSwipeThreshold, disabled, className, onSwipeChange, }: SwipeableListItemProps): import("react/jsx-runtime").JSX.Element;
65
84
  export default SwipeableListItem;
66
85
  //# sourceMappingURL=SwipeableListItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeableListItem.d.ts","sourceRoot":"","sources":["../../src/components/SwipeableListItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IAClE,6BAA6B;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,qEAAqE;IACrE,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,mEAAmE;IACnE,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAoB,EACpB,QAAgB,EAChB,SAAc,GACf,EAAE,sBAAsB,2CA4UxB;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"SwipeableListItem.d.ts","sourceRoot":"","sources":["../../src/components/SwipeableListItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;IAC9E,6BAA6B;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,6DAA6D;IAC7D,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,6DAA6D;IAC7D,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9D;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,WAAgB,EAChB,YAAiB,EACjB,WAAgB,EAChB,SAAiB,EACjB,kBAAwB,EACxB,QAAgB,EAChB,SAAc,EACd,aAAa,GACd,EAAE,sBAAsB,2CAsZxB;AAED,eAAe,iBAAiB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3006,15 +3006,19 @@ interface SwipeableCardProps {
3006
3006
  declare function SwipeableCard({ children, onSwipeRight, onSwipeLeft, rightAction, leftAction, swipeThreshold, hapticFeedback, disabled, onSwipeStart, onSwipeEnd, className, }: SwipeableCardProps): react_jsx_runtime.JSX.Element;
3007
3007
 
3008
3008
  /**
3009
- * Action configuration for swipe gestures
3009
+ * Single action configuration for swipe gestures
3010
3010
  */
3011
3011
  interface SwipeListAction {
3012
+ /** Unique identifier for the action */
3013
+ id: string;
3012
3014
  /** Background color variant or custom Tailwind class */
3013
- color: 'destructive' | 'warning' | 'success' | 'primary' | string;
3015
+ color: 'destructive' | 'warning' | 'success' | 'primary' | 'neutral' | string;
3014
3016
  /** Lucide icon to display */
3015
3017
  icon: LucideIcon;
3016
- /** Label for accessibility */
3018
+ /** Label shown below icon */
3017
3019
  label: string;
3020
+ /** Click handler (can be async) */
3021
+ onClick: () => void | Promise<void>;
3018
3022
  }
3019
3023
  /**
3020
3024
  * SwipeableListItem component props
@@ -3022,51 +3026,66 @@ interface SwipeListAction {
3022
3026
  interface SwipeableListItemProps {
3023
3027
  /** List item content */
3024
3028
  children: React__default.ReactNode;
3025
- /** Handler called when swiped right past threshold (can be async) */
3026
- onSwipeRight?: () => void | Promise<void>;
3027
- /** Handler called when swiped left past threshold (can be async) */
3028
- onSwipeLeft?: () => void | Promise<void>;
3029
- /** Right swipe action configuration (revealed when swiping right) */
3030
- rightAction?: SwipeListAction;
3031
- /** Left swipe action configuration (revealed when swiping left) */
3032
- leftAction?: SwipeListAction;
3033
- /** Pixels of swipe before action triggers (default: 100) */
3034
- swipeThreshold?: number;
3029
+ /** Actions shown when swiping left (appear on right side) */
3030
+ leftActions?: SwipeListAction[];
3031
+ /** Actions shown when swiping right (appear on left side) */
3032
+ rightActions?: SwipeListAction[];
3033
+ /** Width per action button in pixels (default: 72) */
3034
+ actionWidth?: number;
3035
+ /** Enable full swipe to trigger first action (default: false) */
3036
+ fullSwipe?: boolean;
3037
+ /** Full swipe threshold as percentage of container width (default: 0.5) */
3038
+ fullSwipeThreshold?: number;
3035
3039
  /** Disable swipe interactions */
3036
3040
  disabled?: boolean;
3037
3041
  /** Additional class name */
3038
3042
  className?: string;
3043
+ /** Callback when swipe state changes */
3044
+ onSwipeChange?: (direction: 'left' | 'right' | null) => void;
3039
3045
  }
3040
3046
  /**
3041
- * SwipeableListItem - List item with swipe-to-action functionality
3047
+ * SwipeableListItem - List item with swipe-to-reveal action buttons
3042
3048
  *
3043
- * Designed for mobile workflows with keyboard accessibility:
3044
- * - Swipe right to approve/confirm
3045
- * - Swipe left to dismiss/delete
3046
- * - Arrow keys for keyboard navigation
3049
+ * Features:
3050
+ * - Multiple actions per side (like email apps)
3051
+ * - Full swipe to trigger primary action
3052
+ * - Keyboard accessibility (Arrow keys + Tab + Enter)
3047
3053
  * - Async callback support with loading state
3054
+ * - Haptic feedback on mobile
3055
+ * - Smooth animations and visual polish
3048
3056
  *
3049
- * @example
3057
+ * @example Single action per side
3050
3058
  * ```tsx
3051
3059
  * <SwipeableListItem
3052
- * onSwipeRight={() => handleApprove()}
3053
- * onSwipeLeft={() => handleDismiss()}
3054
- * rightAction={{
3055
- * icon: Check,
3056
- * color: 'success',
3057
- * label: 'Approve'
3058
- * }}
3059
- * leftAction={{
3060
- * icon: X,
3061
- * color: 'destructive',
3062
- * label: 'Dismiss'
3063
- * }}
3060
+ * rightActions={[
3061
+ * { id: 'approve', icon: Check, color: 'success', label: 'Approve', onClick: handleApprove }
3062
+ * ]}
3063
+ * leftActions={[
3064
+ * { id: 'delete', icon: Trash, color: 'destructive', label: 'Delete', onClick: handleDelete }
3065
+ * ]}
3064
3066
  * >
3065
3067
  * <div className="p-4">List item content</div>
3066
3068
  * </SwipeableListItem>
3067
3069
  * ```
3070
+ *
3071
+ * @example Multiple actions (email-style)
3072
+ * ```tsx
3073
+ * <SwipeableListItem
3074
+ * leftActions={[
3075
+ * { id: 'delete', icon: Trash, color: 'destructive', label: 'Delete', onClick: handleDelete },
3076
+ * { id: 'archive', icon: Archive, color: 'warning', label: 'Archive', onClick: handleArchive },
3077
+ * ]}
3078
+ * rightActions={[
3079
+ * { id: 'read', icon: Mail, color: 'primary', label: 'Read', onClick: handleRead },
3080
+ * { id: 'star', icon: Star, color: 'warning', label: 'Star', onClick: handleStar },
3081
+ * ]}
3082
+ * fullSwipe
3083
+ * >
3084
+ * <EmailListItem />
3085
+ * </SwipeableListItem>
3086
+ * ```
3068
3087
  */
3069
- declare function SwipeableListItem({ children, onSwipeRight, onSwipeLeft, rightAction, leftAction, swipeThreshold, disabled, className, }: SwipeableListItemProps): react_jsx_runtime.JSX.Element;
3088
+ declare function SwipeableListItem({ children, leftActions, rightActions, actionWidth, fullSwipe, fullSwipeThreshold, disabled, className, onSwipeChange, }: SwipeableListItemProps): react_jsx_runtime.JSX.Element;
3070
3089
 
3071
3090
  interface NotificationBannerAction {
3072
3091
  /** Button label */