@factorialco/f0-react 8.25.0 → 8.27.0

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.
@@ -5472,6 +5472,9 @@ declare const defaultTranslations: {
5472
5472
  readonly language: "Language";
5473
5473
  readonly audio: "Audio";
5474
5474
  };
5475
+ readonly swipeDeck: {
5476
+ readonly label: "Swipe deck";
5477
+ };
5475
5478
  readonly meetingCard: {
5476
5479
  readonly today: "Today";
5477
5480
  readonly yesterday: "Yesterday";
@@ -6195,6 +6198,7 @@ declare const defaultTranslations: {
6195
6198
  readonly description: "Try a different date or fewer filters";
6196
6199
  };
6197
6200
  readonly windowedCategories: "Showing {{count}} of {{total}} categories";
6201
+ readonly noData: "No data";
6198
6202
  readonly tooltip: {
6199
6203
  readonly ofTotal: "of total";
6200
6204
  readonly total: "total";
@@ -12450,6 +12454,22 @@ export declare type F0SelectTagProp = string | {
12450
12454
 
12451
12455
  export declare type F0SelectVariant = (typeof selectVariants)[number];
12452
12456
 
12457
+ /**
12458
+ * @experimental This is an experimental component, use it at your own risk.
12459
+ */
12460
+ export declare const F0SwipeDeck: <T>({ deck, renderCard, label, empty, dataTestId, offsetThreshold, velocityThreshold, }: F0SwipeDeckProps<T>) => JSX_2.Element;
12461
+
12462
+ export declare type F0SwipeDeckProps<T> = WithDataTestIdProps & {
12463
+ deck: UseSwipeDeckResult<T>;
12464
+ renderCard: (item: T) => ReactNode;
12465
+ label?: string;
12466
+ empty?: ReactNode;
12467
+ /** Drag distance in pixels that commits a decision. */
12468
+ offsetThreshold?: number;
12469
+ /** Drag speed in pixels per second that commits a decision regardless of distance. */
12470
+ velocityThreshold?: number;
12471
+ };
12472
+
12453
12473
  /**
12454
12474
  * @experimental This is an experimental component use it at your own risk
12455
12475
  */
@@ -18792,6 +18812,24 @@ export declare type SummaryKey<Definition extends SummariesDefinition> = Definit
18792
18812
 
18793
18813
  export declare type SummaryType = "sum";
18794
18814
 
18815
+ export declare type SwipeDecision<T> = {
18816
+ item: T;
18817
+ direction: SwipeDirection;
18818
+ };
18819
+
18820
+ export declare type SwipeDeckAction = {
18821
+ type: "decide";
18822
+ direction: SwipeDirection;
18823
+ } | {
18824
+ type: "undo";
18825
+ } | {
18826
+ type: "rollback";
18827
+ };
18828
+
18829
+ export declare type SwipeDirection = (typeof swipeDirections)[number];
18830
+
18831
+ export declare const swipeDirections: readonly ["left", "right"];
18832
+
18795
18833
  /**
18796
18834
  * @experimental This is an experimental component use it at your own risk
18797
18835
  */
@@ -20058,6 +20096,43 @@ export declare const useSidebarChats: () => SidebarChatStore;
20058
20096
  */
20059
20097
  export declare function useSidePanel(): SidePanelContextValue;
20060
20098
 
20099
+ export declare const useSwipeDeck: <T>({ items, getItemId, onDecide, onUndo, onNeedMore, undoDepth, needMoreThreshold, }: UseSwipeDeckOptions<T>) => UseSwipeDeckResult<T>;
20100
+
20101
+ export declare type UseSwipeDeckOptions<T> = {
20102
+ /**
20103
+ * Append-only: the deck reads it by position, so a page of new items must be
20104
+ * added to the end. Replacing the array with a differently ordered or
20105
+ * filtered one makes the deck skip items.
20106
+ */
20107
+ items: T[];
20108
+ getItemId: (item: T) => string;
20109
+ /**
20110
+ * `rollback` returns the item to the deck, for a consumer whose mutation
20111
+ * failed: as the current card when it was the most recent decision, after
20112
+ * the items loaded so far otherwise.
20113
+ */
20114
+ onDecide?: (decision: SwipeDecision<T>, rollback: () => void) => void;
20115
+ onUndo?: (item: T) => void;
20116
+ /** Fires once each time the remaining items drop to `needMoreThreshold`. */
20117
+ onNeedMore?: () => void;
20118
+ undoDepth?: number;
20119
+ needMoreThreshold?: number;
20120
+ };
20121
+
20122
+ export declare type UseSwipeDeckResult<T> = {
20123
+ current: T | undefined;
20124
+ currentId: string | undefined;
20125
+ index: number;
20126
+ total: number;
20127
+ remaining: number;
20128
+ canUndo: boolean;
20129
+ lastAction: SwipeDeckAction | undefined;
20130
+ decide: (direction: SwipeDirection) => void;
20131
+ swipeLeft: () => void;
20132
+ swipeRight: () => void;
20133
+ undo: () => void;
20134
+ };
20135
+
20061
20136
  /**
20062
20137
  * Attaches a track to a media element F0 owns.
20063
20138
  *