ivt 0.0.3 → 0.0.5
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/accordion/index.mjs +1 -1
- package/dist/badge/index.mjs +1 -1
- package/dist/base/index.mjs +1 -1
- package/dist/base/index.mjs.map +1 -1
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/calendar/index.d.ts +11 -0
- package/dist/calendar/index.mjs +2 -0
- package/dist/calendar/index.mjs.map +1 -0
- package/dist/card/index.d.ts +12 -0
- package/dist/card/index.mjs +2 -0
- package/dist/card/index.mjs.map +1 -0
- package/dist/checkbox/index.mjs +1 -1
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chunks/{TextWrap-B2WOcyfj.mjs → TextWrap-apUajb0q.mjs} +2 -2
- package/dist/chunks/{TextWrap-B2WOcyfj.mjs.map → TextWrap-apUajb0q.mjs.map} +1 -1
- package/dist/chunks/accordion-CQGSj-IW.mjs +2 -0
- package/dist/chunks/{accordion-CEMX6Rna.mjs.map → accordion-CQGSj-IW.mjs.map} +1 -1
- package/dist/chunks/{bundle-mjs-HknDzN6Z.mjs → bundle-mjs-CtG6Smj_.mjs} +1 -1
- package/dist/chunks/{bundle-mjs-HknDzN6Z.mjs.map → bundle-mjs-CtG6Smj_.mjs.map} +1 -1
- package/dist/chunks/{button-DR1cWE8S.mjs → button-D_c_ntEX.mjs} +2 -2
- package/dist/chunks/{button-DR1cWE8S.mjs.map → button-D_c_ntEX.mjs.map} +1 -1
- package/dist/chunks/check-DjRtCxG6.mjs +2 -0
- package/dist/chunks/{check-wZkDbgjO.mjs.map → check-DjRtCxG6.mjs.map} +1 -1
- package/dist/chunks/chevron-down-BCzo9yB2.mjs +2 -0
- package/dist/chunks/{chevron-down-BbjHXP7j.mjs.map → chevron-down-BCzo9yB2.mjs.map} +1 -1
- package/dist/chunks/chevron-left-DUJqO1vN.mjs +2 -0
- package/dist/chunks/chevron-left-DUJqO1vN.mjs.map +1 -0
- package/dist/chunks/chevron-right-CoNJE7ZW.mjs +2 -0
- package/dist/chunks/{chevron-right-NuCkf5RR.mjs.map → chevron-right-CoNJE7ZW.mjs.map} +1 -1
- package/dist/chunks/command-eoEJKrZQ.mjs +2 -0
- package/dist/chunks/command-eoEJKrZQ.mjs.map +1 -0
- package/dist/chunks/{createLucideIcon-DHet3kMe.mjs → createLucideIcon-CIn9dHnW.mjs} +1 -1
- package/dist/chunks/{createLucideIcon-DHet3kMe.mjs.map → createLucideIcon-CIn9dHnW.mjs.map} +1 -1
- package/dist/chunks/dialog-TKsk0Iu2.mjs +2 -0
- package/dist/chunks/{dialog-B7nAaDwF.mjs.map → dialog-TKsk0Iu2.mjs.map} +1 -1
- package/dist/chunks/index-B98y16WE.mjs +2 -0
- package/dist/chunks/index-B98y16WE.mjs.map +1 -0
- package/dist/chunks/{index-B25rp7IZ.mjs → index-BpJwNLRW.mjs} +1 -1
- package/dist/chunks/{index-B25rp7IZ.mjs.map → index-BpJwNLRW.mjs.map} +1 -1
- package/dist/chunks/index-C598HM8V.mjs +2 -0
- package/dist/chunks/index-C598HM8V.mjs.map +1 -0
- package/dist/chunks/index-CCYyT_rk.mjs +2 -0
- package/dist/chunks/index-CCYyT_rk.mjs.map +1 -0
- package/dist/chunks/index-CX5r7IKM.mjs +2 -0
- package/dist/chunks/index-CX5r7IKM.mjs.map +1 -0
- package/dist/chunks/{index-D6Orj-nf.mjs → index-CXrD_SvM.mjs} +2 -2
- package/dist/chunks/{index-D6Orj-nf.mjs.map → index-CXrD_SvM.mjs.map} +1 -1
- package/dist/chunks/index-ChLuxn93.mjs +2 -0
- package/dist/chunks/index-ChLuxn93.mjs.map +1 -0
- package/dist/chunks/index-CluuXDB_.mjs +2 -0
- package/dist/chunks/index-CluuXDB_.mjs.map +1 -0
- package/dist/chunks/{index-CJMeIDw8.mjs → index-D-s-TbR3.mjs} +2 -2
- package/dist/chunks/{index-CJMeIDw8.mjs.map → index-D-s-TbR3.mjs.map} +1 -1
- package/dist/chunks/index-DOx7g1Qo.mjs +2 -0
- package/dist/chunks/{index-EftYm3Nj.mjs.map → index-DOx7g1Qo.mjs.map} +1 -1
- package/dist/chunks/{index-BsTRBWyW.mjs → index-Db2NO0t8.mjs} +2 -2
- package/dist/chunks/{index-BsTRBWyW.mjs.map → index-Db2NO0t8.mjs.map} +1 -1
- package/dist/chunks/{index-Cv2row07.mjs → index-DxtdpBCb.mjs} +1 -1
- package/dist/chunks/{index-Cv2row07.mjs.map → index-DxtdpBCb.mjs.map} +1 -1
- package/dist/chunks/{index-CjcSvOxo.mjs → index-DzMQps4Q.mjs} +2 -2
- package/dist/chunks/{index-CjcSvOxo.mjs.map → index-DzMQps4Q.mjs.map} +1 -1
- package/dist/chunks/{input-B2w6lnoj.mjs → input-BxTp3Q5l.mjs} +2 -2
- package/dist/chunks/{input-B2w6lnoj.mjs.map → input-BxTp3Q5l.mjs.map} +1 -1
- package/dist/chunks/{label-DXr1d22R.mjs → label-BhQUf4a7.mjs} +2 -2
- package/dist/chunks/{label-DXr1d22R.mjs.map → label-BhQUf4a7.mjs.map} +1 -1
- package/dist/chunks/pagination-qTGmkoRO.mjs +2 -0
- package/dist/chunks/pagination-qTGmkoRO.mjs.map +1 -0
- package/dist/chunks/popover-DDPhp0Sa.mjs +2 -0
- package/dist/chunks/{popover-BDcGFNWg.mjs.map → popover-DDPhp0Sa.mjs.map} +1 -1
- package/dist/chunks/progress-C_yWLgAi.mjs +2 -0
- package/dist/chunks/progress-C_yWLgAi.mjs.map +1 -0
- package/dist/chunks/scroll-area-CuX49k8h.mjs +2 -0
- package/dist/chunks/{scroll-area-BEfzUuiC.mjs.map → scroll-area-CuX49k8h.mjs.map} +1 -1
- package/dist/chunks/{select-ByQjLEt1.mjs → select-BydKi4E_.mjs} +2 -2
- package/dist/chunks/{select-ByQjLEt1.mjs.map → select-BydKi4E_.mjs.map} +1 -1
- package/dist/chunks/{skeleton-BiE2soDg.mjs → skeleton-BFnps3wE.mjs} +2 -2
- package/dist/chunks/{skeleton-BiE2soDg.mjs.map → skeleton-BFnps3wE.mjs.map} +1 -1
- package/dist/chunks/sortable-7DK1K35h.mjs +2 -0
- package/dist/chunks/sortable-7DK1K35h.mjs.map +1 -0
- package/dist/chunks/{table-yo_IkKny.mjs → table-DRvqJktC.mjs} +2 -2
- package/dist/chunks/{table-yo_IkKny.mjs.map → table-DRvqJktC.mjs.map} +1 -1
- package/dist/chunks/tslib.es6-Cx3xzITX.mjs +2 -0
- package/dist/chunks/tslib.es6-Cx3xzITX.mjs.map +1 -0
- package/dist/chunks/utils-jIFl11as.mjs +2 -0
- package/dist/chunks/utils-jIFl11as.mjs.map +1 -0
- package/dist/chunks/x-xnz0lTd-.mjs +2 -0
- package/dist/chunks/x-xnz0lTd-.mjs.map +1 -0
- package/dist/command/index.mjs +1 -1
- package/dist/data-table/index.d.ts +21 -5
- package/dist/data-table/index.mjs +1 -1
- package/dist/data-table/index.mjs.map +1 -1
- package/dist/dialog/index.mjs +1 -1
- package/dist/dropdown-menu/index.mjs +1 -1
- package/dist/dropdown-menu/index.mjs.map +1 -1
- package/dist/dropzone/index.d.ts +84 -0
- package/dist/dropzone/index.mjs +7 -0
- package/dist/dropzone/index.mjs.map +1 -0
- package/dist/form/index.mjs +1 -1
- package/dist/icon/index.mjs +1 -1
- package/dist/index.css +2 -2
- package/dist/input/index.mjs +1 -1
- package/dist/label/index.mjs +1 -1
- package/dist/pagination/index.mjs +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/progress/index.d.ts +7 -0
- package/dist/progress/index.mjs +2 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/scroll-area/index.mjs +1 -1
- package/dist/select/index.mjs +1 -1
- package/dist/separator/index.mjs +1 -1
- package/dist/sheet/index.mjs +1 -1
- package/dist/sheet/index.mjs.map +1 -1
- package/dist/skeleton/index.mjs +1 -1
- package/dist/sortable/index.d.ts +109 -0
- package/dist/sortable/index.mjs +2 -0
- package/dist/sortable/index.mjs.map +1 -0
- package/dist/table/index.mjs +1 -1
- package/dist/tabs/index.d.ts +10 -0
- package/dist/tabs/index.mjs +2 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/toast/index.d.ts +20 -0
- package/dist/toast/index.mjs +2 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/tooltip/index.mjs +1 -1
- package/dist/tooltip/index.mjs.map +1 -1
- package/package.json +47 -2
- package/dist/chunks/accordion-CEMX6Rna.mjs +0 -2
- package/dist/chunks/check-wZkDbgjO.mjs +0 -2
- package/dist/chunks/chevron-down-BbjHXP7j.mjs +0 -2
- package/dist/chunks/chevron-right-NuCkf5RR.mjs +0 -2
- package/dist/chunks/command-BvsI_sq9.mjs +0 -2
- package/dist/chunks/command-BvsI_sq9.mjs.map +0 -1
- package/dist/chunks/dialog-B7nAaDwF.mjs +0 -2
- package/dist/chunks/index-BESNMrh8.mjs +0 -2
- package/dist/chunks/index-BESNMrh8.mjs.map +0 -1
- package/dist/chunks/index-D5hJSEl1.mjs +0 -2
- package/dist/chunks/index-D5hJSEl1.mjs.map +0 -1
- package/dist/chunks/index-EftYm3Nj.mjs +0 -2
- package/dist/chunks/index-ew5utTUc.mjs +0 -2
- package/dist/chunks/index-ew5utTUc.mjs.map +0 -1
- package/dist/chunks/pagination-Cgu8tTUI.mjs +0 -2
- package/dist/chunks/pagination-Cgu8tTUI.mjs.map +0 -1
- package/dist/chunks/popover-BDcGFNWg.mjs +0 -2
- package/dist/chunks/scroll-area-BEfzUuiC.mjs +0 -2
- package/dist/chunks/utils-BpbSpG2q.mjs +0 -2
- package/dist/chunks/utils-BpbSpG2q.mjs.map +0 -1
@@ -0,0 +1,109 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import { UniqueIdentifier, DndContextProps, DragOverlay } from '@dnd-kit/core';
|
3
|
+
import { SortableContextProps } from '@dnd-kit/sortable';
|
4
|
+
import { SlotProps } from '@radix-ui/react-slot';
|
5
|
+
import * as React from 'react';
|
6
|
+
import { ButtonProps } from '../button/index.js';
|
7
|
+
import 'class-variance-authority/types';
|
8
|
+
import 'class-variance-authority';
|
9
|
+
|
10
|
+
interface SortableProps<TData extends {
|
11
|
+
id: UniqueIdentifier;
|
12
|
+
}> extends DndContextProps {
|
13
|
+
/**
|
14
|
+
* An array of data items that the sortable component will render.
|
15
|
+
* @example
|
16
|
+
* value={[
|
17
|
+
* { id: 1, name: 'Item 1' },
|
18
|
+
* { id: 2, name: 'Item 2' },
|
19
|
+
* ]}
|
20
|
+
*/
|
21
|
+
value: TData[];
|
22
|
+
/**
|
23
|
+
* An optional callback function that is called when the order of the data items changes.
|
24
|
+
* It receives the new array of items as its argument.
|
25
|
+
* @example
|
26
|
+
* onValueChange={(items) => console.log(items)}
|
27
|
+
*/
|
28
|
+
onValueChange?: (items: TData[]) => void;
|
29
|
+
/**
|
30
|
+
* An optional callback function that is called when an item is moved.
|
31
|
+
* It receives an event object with `activeIndex` and `overIndex` properties, representing the original and new positions of the moved item.
|
32
|
+
* This will override the default behavior of updating the order of the data items.
|
33
|
+
* @type (event: { activeIndex: number; overIndex: number }) => void
|
34
|
+
* @example
|
35
|
+
* onMove={(event) => console.log(`Item moved from index ${event.activeIndex} to index ${event.overIndex}`)}
|
36
|
+
*/
|
37
|
+
onMove?: (event: {
|
38
|
+
activeIndex: number;
|
39
|
+
overIndex: number;
|
40
|
+
}) => void;
|
41
|
+
/**
|
42
|
+
* A collision detection strategy that will be used to determine the closest sortable item.
|
43
|
+
* @default closestCenter
|
44
|
+
* @type DndContextProps["collisionDetection"]
|
45
|
+
*/
|
46
|
+
collisionDetection?: DndContextProps["collisionDetection"];
|
47
|
+
/**
|
48
|
+
* An array of modifiers that will be used to modify the behavior of the sortable component.
|
49
|
+
* @default
|
50
|
+
* [restrictToVerticalAxis, restrictToParentElement]
|
51
|
+
* @type Modifier[]
|
52
|
+
*/
|
53
|
+
modifiers?: DndContextProps["modifiers"];
|
54
|
+
/**
|
55
|
+
* A sorting strategy that will be used to determine the new order of the data items.
|
56
|
+
* @default verticalListSortingStrategy
|
57
|
+
* @type SortableContextProps["strategy"]
|
58
|
+
*/
|
59
|
+
strategy?: SortableContextProps["strategy"];
|
60
|
+
/**
|
61
|
+
* Specifies the axis for the drag-and-drop operation. It can be "vertical", "horizontal", or "both".
|
62
|
+
* @default "vertical"
|
63
|
+
* @type "vertical" | "horizontal" | "mixed"
|
64
|
+
*/
|
65
|
+
orientation?: "vertical" | "horizontal" | "mixed";
|
66
|
+
/**
|
67
|
+
* An optional React node that is rendered on top of the sortable component.
|
68
|
+
* It can be used to display additional information or controls.
|
69
|
+
* @default null
|
70
|
+
* @type React.ReactNode | null
|
71
|
+
* @example
|
72
|
+
* overlay={<Skeleton className="w-full h-8" />}
|
73
|
+
*/
|
74
|
+
overlay?: React.ReactNode | null;
|
75
|
+
}
|
76
|
+
declare function Sortable<TData extends {
|
77
|
+
id: UniqueIdentifier;
|
78
|
+
}>({ value, onValueChange, collisionDetection, modifiers, strategy, onMove, orientation, overlay, children, ...props }: SortableProps<TData>): react_jsx_runtime.JSX.Element;
|
79
|
+
interface SortableOverlayProps extends React.ComponentPropsWithRef<typeof DragOverlay> {
|
80
|
+
activeId?: UniqueIdentifier | null;
|
81
|
+
}
|
82
|
+
declare const SortableOverlay: React.ForwardRefExoticComponent<SortableOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
83
|
+
interface SortableItemProps extends SlotProps {
|
84
|
+
/**
|
85
|
+
* The unique identifier of the item.
|
86
|
+
* @example "item-1"
|
87
|
+
* @type UniqueIdentifier
|
88
|
+
*/
|
89
|
+
value: UniqueIdentifier;
|
90
|
+
/**
|
91
|
+
* Specifies whether the item should act as a trigger for the drag-and-drop action.
|
92
|
+
* @default false
|
93
|
+
* @type boolean | undefined
|
94
|
+
*/
|
95
|
+
asTrigger?: boolean;
|
96
|
+
/**
|
97
|
+
* Merges the item's props into its immediate child.
|
98
|
+
* @default false
|
99
|
+
* @type boolean | undefined
|
100
|
+
*/
|
101
|
+
asChild?: boolean;
|
102
|
+
}
|
103
|
+
declare const SortableItem: React.ForwardRefExoticComponent<SortableItemProps & React.RefAttributes<HTMLDivElement>>;
|
104
|
+
interface SortableDragHandleProps extends ButtonProps {
|
105
|
+
withHandle?: boolean;
|
106
|
+
}
|
107
|
+
declare const SortableDragHandle: React.ForwardRefExoticComponent<SortableDragHandleProps & React.RefAttributes<HTMLButtonElement>>;
|
108
|
+
|
109
|
+
export { Sortable, SortableDragHandle, SortableItem, SortableOverlay };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
export{S as Sortable,a as SortableDragHandle,b as SortableItem,c as SortableOverlay}from"../chunks/sortable-7DK1K35h.mjs";import"react";import"react-dom";import"@radix-ui/react-slot";import"../chunks/utils-jIFl11as.mjs";import"../chunks/bundle-mjs-CtG6Smj_.mjs";import"../chunks/button-D_c_ntEX.mjs";import"class-variance-authority";
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/table/index.mjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export{T as Table,b as TableBody,g as TableCaption,f as TableCell,c as TableFooter,d as TableHead,a as TableHeader,e as TableRow}from"../chunks/table-
|
1
|
+
export{T as Table,b as TableBody,g as TableCaption,f as TableCell,c as TableFooter,d as TableHead,a as TableHeader,e as TableRow}from"../chunks/table-DRvqJktC.mjs";import"react";import"../chunks/utils-jIFl11as.mjs";import"../chunks/bundle-mjs-CtG6Smj_.mjs";
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import * as React from 'react';
|
3
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
4
|
+
|
5
|
+
declare function Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
6
|
+
declare function TabsList({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.List>): react_jsx_runtime.JSX.Element;
|
7
|
+
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
8
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
9
|
+
|
10
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import*as e from"react";import{c as t,P as a}from"../chunks/index-CX5r7IKM.mjs";import{c as n}from"../chunks/index-CCYyT_rk.mjs";import{c as o,R as r,I as i}from"../chunks/index-C598HM8V.mjs";import{P as s}from"../chunks/index-DxtdpBCb.mjs";import{u as c}from"../chunks/index-BpJwNLRW.mjs";import{u as d}from"../chunks/index-D-s-TbR3.mjs";import{u as l}from"../chunks/index-Db2NO0t8.mjs";import{jsx as u}from"react/jsx-runtime";import{c as m}from"../chunks/utils-jIFl11as.mjs";import"@radix-ui/react-collection";import"react-dom";import"@radix-ui/react-slot";import"../chunks/bundle-mjs-CtG6Smj_.mjs";var f="Tabs",[p,b]=n(f,[o]),v=o(),[h,g]=p(f),x=e.forwardRef(((e,t)=>{const{__scopeTabs:a,value:n,onValueChange:o,defaultValue:r,orientation:i="horizontal",dir:m,activationMode:f="automatic",...p}=e,b=c(m),[v,g]=d({prop:n,onChange:o,defaultProp:r});return u(h,{scope:a,baseId:l(),value:v,onValueChange:g,orientation:i,dir:b,activationMode:f,children:u(s.div,{dir:b,"data-orientation":i,...p,ref:t})})}));x.displayName=f;var y="TabsList",k=e.forwardRef(((e,t)=>{const{__scopeTabs:a,loop:n=!0,...o}=e,i=g(y,a),c=v(a);return u(r,{asChild:!0,...c,orientation:i.orientation,dir:i.dir,loop:n,children:u(s.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})}));k.displayName=y;var j="TabsTrigger",w=e.forwardRef(((e,a)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...c}=e,d=g(j,n),l=v(n),m=C(d.baseId,o),f=T(d.baseId,o),p=o===d.value;return u(i,{asChild:!0,...l,focusable:!r,active:p,children:u(s.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:m,...c,ref:a,onMouseDown:t(e.onMouseDown,(e=>{r||0!==e.button||!1!==e.ctrlKey?e.preventDefault():d.onValueChange(o)})),onKeyDown:t(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&d.onValueChange(o)})),onFocus:t(e.onFocus,(()=>{const e="manual"!==d.activationMode;p||r||!e||d.onValueChange(o)}))})})}));w.displayName=j;var N="TabsContent",_=e.forwardRef(((t,n)=>{const{__scopeTabs:o,value:r,forceMount:i,children:c,...d}=t,l=g(N,o),m=C(l.baseId,r),f=T(l.baseId,r),p=r===l.value,b=e.useRef(p);return e.useEffect((()=>{const e=requestAnimationFrame((()=>b.current=!1));return()=>cancelAnimationFrame(e)}),[]),u(a,{present:i||p,children:({present:e})=>u(s.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":m,hidden:!e,id:f,tabIndex:0,...d,ref:n,style:{...t.style,animationDuration:b.current?"0s":void 0},children:e&&c})})}));function C(e,t){return`${e}-trigger-${t}`}function T(e,t){return`${e}-content-${t}`}_.displayName=N;var I=x,D=k,E=w,M=_;function R({className:t,...a}){return e.createElement(I,{"data-slot":"tabs",className:m("flex flex-col gap-2",t),...a})}function V({className:t,...a}){return e.createElement(D,{"data-slot":"tabs-list",className:m("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",t),...a})}function F({className:t,...a}){return e.createElement(E,{"data-slot":"tabs-trigger",className:m("data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/50 inline-flex h-[calc(100%-1px)] flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...a})}function $({className:t,...a}){return e.createElement(M,{"data-slot":"tabs-content",className:m("flex-1 outline-none",t),...a})}export{R as Tabs,$ as TabsContent,V as TabsList,F as TabsTrigger};
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../node_modules/@radix-ui/react-tabs/dist/index.mjs","../../src/components/ui/tabs/tabs.tsx"],"sourcesContent":["\"use client\";\n\n// packages/react/tabs/src/tabs.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { createRovingFocusGroupScope } from \"@radix-ui/react-roving-focus\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport * as RovingFocusGroup from \"@radix-ui/react-roving-focus\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { jsx } from \"react/jsx-runtime\";\nvar TABS_NAME = \"Tabs\";\nvar [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [\n createRovingFocusGroupScope\n]);\nvar useRovingFocusGroupScope = createRovingFocusGroupScope();\nvar [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);\nvar Tabs = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeTabs,\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation = \"horizontal\",\n dir,\n activationMode = \"automatic\",\n ...tabsProps\n } = props;\n const direction = useDirection(dir);\n const [value, setValue] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n defaultProp: defaultValue\n });\n return /* @__PURE__ */ jsx(\n TabsProvider,\n {\n scope: __scopeTabs,\n baseId: useId(),\n value,\n onValueChange: setValue,\n orientation,\n dir: direction,\n activationMode,\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n dir: direction,\n \"data-orientation\": orientation,\n ...tabsProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nTabs.displayName = TABS_NAME;\nvar TAB_LIST_NAME = \"TabsList\";\nvar TabsList = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, loop = true, ...listProps } = props;\n const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n return /* @__PURE__ */ jsx(\n RovingFocusGroup.Root,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n orientation: context.orientation,\n dir: context.dir,\n loop,\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n role: \"tablist\",\n \"aria-orientation\": context.orientation,\n ...listProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nTabsList.displayName = TAB_LIST_NAME;\nvar TRIGGER_NAME = \"TabsTrigger\";\nvar TabsTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, value, disabled = false, ...triggerProps } = props;\n const context = useTabsContext(TRIGGER_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n return /* @__PURE__ */ jsx(\n RovingFocusGroup.Item,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n focusable: !disabled,\n active: isSelected,\n children: /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n role: \"tab\",\n \"aria-selected\": isSelected,\n \"aria-controls\": contentId,\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n id: triggerId,\n ...triggerProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onValueChange(value);\n } else {\n event.preventDefault();\n }\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if ([\" \", \"Enter\"].includes(event.key)) context.onValueChange(value);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => {\n const isAutomaticActivation = context.activationMode !== \"manual\";\n if (!isSelected && !disabled && isAutomaticActivation) {\n context.onValueChange(value);\n }\n })\n }\n )\n }\n );\n }\n);\nTabsTrigger.displayName = TRIGGER_NAME;\nvar CONTENT_NAME = \"TabsContent\";\nvar TabsContent = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, value, forceMount, children, ...contentProps } = props;\n const context = useTabsContext(CONTENT_NAME, __scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n const isMountAnimationPreventedRef = React.useRef(isSelected);\n React.useEffect(() => {\n const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);\n return () => cancelAnimationFrame(rAF);\n }, []);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-orientation\": context.orientation,\n role: \"tabpanel\",\n \"aria-labelledby\": triggerId,\n hidden: !present,\n id: contentId,\n tabIndex: 0,\n ...contentProps,\n ref: forwardedRef,\n style: {\n ...props.style,\n animationDuration: isMountAnimationPreventedRef.current ? \"0s\" : void 0\n },\n children: present && children\n }\n ) });\n }\n);\nTabsContent.displayName = CONTENT_NAME;\nfunction makeTriggerId(baseId, value) {\n return `${baseId}-trigger-${value}`;\n}\nfunction makeContentId(baseId, value) {\n return `${baseId}-content-${value}`;\n}\nvar Root2 = Tabs;\nvar List = TabsList;\nvar Trigger = TabsTrigger;\nvar Content = TabsContent;\nexport {\n Content,\n List,\n Root2 as Root,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n Trigger,\n createTabsScope\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\n\nimport { cn } from \"@/lib/utils\";\n\nfunction Tabs({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Root>) {\n return (\n <TabsPrimitive.Root\n data-slot=\"tabs\"\n className={cn(\"flex flex-col gap-2\", className)}\n {...props}\n />\n );\n}\n\nfunction TabsList({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.List>) {\n return (\n <TabsPrimitive.List\n data-slot=\"tabs-list\"\n className={cn(\n \"bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TabsTrigger({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {\n return (\n <TabsPrimitive.Trigger\n data-slot=\"tabs-trigger\"\n className={cn(\n \"data-[state=active]:bg-background data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/50 inline-flex h-[calc(100%-1px)] flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TabsContent({\n className,\n ...props\n}: React.ComponentProps<typeof TabsPrimitive.Content>) {\n return (\n <TabsPrimitive.Content\n data-slot=\"tabs-content\"\n className={cn(\"flex-1 outline-none\", className)}\n {...props}\n />\n );\n}\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent };\n"],"names":["TABS_NAME","createTabsContext","createTabsScope","createContextScope","createRovingFocusGroupScope","useRovingFocusGroupScope","TabsProvider","useTabsContext","Tabs","React","forwardRef","props","forwardedRef","__scopeTabs","value","valueProp","onValueChange","defaultValue","orientation","dir","activationMode","tabsProps","direction","useDirection","setValue","useControllableState","prop","onChange","defaultProp","jsx","scope","baseId","useId","children","Primitive","div","ref","displayName","TAB_LIST_NAME","TabsList","loop","listProps","context","rovingFocusGroupScope","RovingFocusGroup.Root","asChild","role","TRIGGER_NAME","TabsTrigger","disabled","triggerProps","triggerId","makeTriggerId","contentId","makeContentId","isSelected","RovingFocusGroup.Item","focusable","active","button","type","id","onMouseDown","composeEventHandlers","event","ctrlKey","preventDefault","onKeyDown","includes","key","onFocus","isAutomaticActivation","CONTENT_NAME","TabsContent","forceMount","contentProps","isMountAnimationPreventedRef","useRef","useEffect","rAF","requestAnimationFrame","current","cancelAnimationFrame","Presence","present","hidden","tabIndex","style","animationDuration","Root","List","Trigger","Content","className","createElement","TabsPrimitive","data-slot","cn"],"mappings":"ylBAiBA,IAAMA,EAAY,QAGXC,EAAmBC,GAAmBC,EAAmBH,EAAW,CACzEI,IAEIC,EAA2BD,KAW1BE,EAAcC,GAAkBN,EAAoCD,GA6BrEQ,EAAaC,EAAAC,YACjB,CAACC,EAA+BC,KAC9B,MAAMC,YACJA,EACAC,MAAOC,EAAAC,cACPA,EAAAC,aACAA,EAAAC,YACAA,EAAc,aAAAC,IACdA,EAAAC,eACAA,EAAiB,eACdC,GACDV,EACEW,EAAYC,EAAaJ,IACxBL,EAAOU,GAAYC,EAAqB,CAC7CC,KAAMX,EACNY,SAAUX,EACVY,YAAaX,IAGf,OACEY,EAACvB,EAAA,CACCwB,MAAOjB,EACPkB,OAAQC,IACRlB,QACAE,cAAeQ,EACfN,cACAC,IAAKG,EACLF,iBAEAa,SAAAJ,EAACK,EAAUC,IAAV,CACChB,IAAKG,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,EACV4C,EAAUnB,ECpRhB,SAASjE,GAAKqF,UACZA,KACGlF,IAEH,OACEF,EAAAqF,cAACC,EAAkB,CACjBC,YAAU,OACVH,UAAWI,EAAG,sBAAuBJ,MACjClF,GAGV,CAEA,SAAS4B,GAASsD,UAChBA,KACGlF,IAEH,OACEF,EAAAqF,cAACC,EAAkB,CACjBC,YAAU,YACVH,UAAWI,EACT,sGACAJ,MAEElF,GAGV,CAEA,SAASqC,GAAY6C,UACnBA,KACGlF,IAEH,OACEF,EAAAqF,cAACC,EAAqB,CACpBC,YAAU,eACVH,UAAWI,EACT,ioBACAJ,MAEElF,GAGV,CAEA,SAAS8D,GAAYoB,UACnBA,KACGlF,IAEH,OACEF,EAAAqF,cAACC,EAAqB,CACpBC,YAAU,eACVH,UAAWI,EAAG,sBAAuBJ,MACjClF,GAGV","x_google_ignoreList":[0]}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
3
|
+
import * as ToastPrimitives from '@radix-ui/react-toast';
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
5
|
+
import * as React from 'react';
|
6
|
+
|
7
|
+
declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
|
8
|
+
declare const ToastViewport: ({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Viewport>) => react_jsx_runtime.JSX.Element;
|
9
|
+
declare const toastVariants: (props?: ({
|
10
|
+
variant?: "default" | "destructive" | null | undefined;
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
12
|
+
declare const Toast: ({ className, variant, ...props }: React.ComponentProps<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>) => react_jsx_runtime.JSX.Element;
|
13
|
+
declare const ToastAction: ({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Action>) => react_jsx_runtime.JSX.Element;
|
14
|
+
declare const ToastClose: ({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Close>) => react_jsx_runtime.JSX.Element;
|
15
|
+
declare const ToastTitle: ({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Title>) => react_jsx_runtime.JSX.Element;
|
16
|
+
declare const ToastDescription: ({ className, ...props }: React.ComponentProps<typeof ToastPrimitives.Description>) => react_jsx_runtime.JSX.Element;
|
17
|
+
type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
|
18
|
+
type ToastActionElement = React.ReactElement<typeof ToastAction>;
|
19
|
+
|
20
|
+
export { Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import*as e from"react";import*as t from"react-dom";import{u as r,P as o,c as n,a as s,b as a}from"../chunks/index-CX5r7IKM.mjs";import{createCollection as i}from"@radix-ui/react-collection";import{c}from"../chunks/index-CCYyT_rk.mjs";import{B as d,R as u,P as l}from"../chunks/index-CXrD_SvM.mjs";import{P as p,d as f}from"../chunks/index-DxtdpBCb.mjs";import{u as m}from"../chunks/index-D-s-TbR3.mjs";import{V as v}from"../chunks/index-B98y16WE.mjs";import{jsx as w,jsxs as h,Fragment as x}from"react/jsx-runtime";import{cva as y}from"class-variance-authority";import{c as g}from"../chunks/utils-jIFl11as.mjs";import{X as E}from"../chunks/x-xnz0lTd-.mjs";import"@radix-ui/react-slot";import"../chunks/bundle-mjs-CtG6Smj_.mjs";import"../chunks/createLucideIcon-CIn9dHnW.mjs";var T="ToastProvider",[b,R,C]=i("Toast"),[P,N]=c("Toast",[C]),[k,D]=P(T),L=t=>{const{__scopeToast:r,label:o="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:a=50,children:i}=t,[c,d]=e.useState(null),[u,l]=e.useState(0),p=e.useRef(!1),f=e.useRef(!1);return o.trim()||console.error(`Invalid prop \`label\` supplied to \`${T}\`. Expected non-empty \`string\`.`),w(b.Provider,{scope:r,children:w(k,{scope:r,label:o,duration:n,swipeDirection:s,swipeThreshold:a,toastCount:u,viewport:c,onViewportChange:d,onToastAdd:e.useCallback((()=>l((e=>e+1))),[]),onToastRemove:e.useCallback((()=>l((e=>e-1))),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:f,children:i})})};L.displayName=T;var S="ToastViewport",_=["F8"],F="toast.viewportPause",I="toast.viewportResume",A=e.forwardRef(((t,o)=>{const{__scopeToast:n,hotkey:s=_,label:a="Notifications ({hotkey})",...i}=t,c=D(S,n),u=R(n),l=e.useRef(null),f=e.useRef(null),m=e.useRef(null),v=e.useRef(null),x=r(o,v,c.onViewportChange),y=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=c.toastCount>0;e.useEffect((()=>{const e=e=>{0!==s.length&&s.every((t=>e[t]||e.code===t))&&v.current?.focus()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[s]),e.useEffect((()=>{const e=l.current,t=v.current;if(g&&e&&t){const r=()=>{if(!c.isClosePausedRef.current){const e=new CustomEvent(F);t.dispatchEvent(e),c.isClosePausedRef.current=!0}},o=()=>{if(c.isClosePausedRef.current){const e=new CustomEvent(I);t.dispatchEvent(e),c.isClosePausedRef.current=!1}},n=t=>{!e.contains(t.relatedTarget)&&o()},s=()=>{e.contains(document.activeElement)||o()};return e.addEventListener("focusin",r),e.addEventListener("focusout",n),e.addEventListener("pointermove",r),e.addEventListener("pointerleave",s),window.addEventListener("blur",r),window.addEventListener("focus",o),()=>{e.removeEventListener("focusin",r),e.removeEventListener("focusout",n),e.removeEventListener("pointermove",r),e.removeEventListener("pointerleave",s),window.removeEventListener("blur",r),window.removeEventListener("focus",o)}}}),[g,c.isClosePausedRef]);const E=e.useCallback((({tabbingDirection:e})=>{const t=u().map((t=>{const r=t.ref.current,o=[r,...ee(r)];return"forwards"===e?o:o.reverse()}));return("forwards"===e?t.reverse():t).flat()}),[u]);return e.useEffect((()=>{const e=v.current;if(e){const t=t=>{const r=t.altKey||t.ctrlKey||t.metaKey;if("Tab"===t.key&&!r){const r=document.activeElement,o=t.shiftKey;if(t.target===e&&o)return void f.current?.focus();const n=E({tabbingDirection:o?"backwards":"forwards"}),s=n.findIndex((e=>e===r));te(n.slice(s+1))?t.preventDefault():o?f.current?.focus():m.current?.focus()}};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}}),[u,E]),h(d,{ref:l,role:"region","aria-label":a.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&w(M,{ref:f,onFocusFromOutsideViewport:()=>{te(E({tabbingDirection:"forwards"}))}}),w(b.Slot,{scope:n,children:w(p.ol,{tabIndex:-1,...i,ref:x})}),g&&w(M,{ref:m,onFocusFromOutsideViewport:()=>{te(E({tabbingDirection:"backwards"}))}})]})}));A.displayName=S;var j="ToastFocusProxy",M=e.forwardRef(((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:o,...n}=e,s=D(j,r);return w(v,{"aria-hidden":!0,tabIndex:0,...n,ref:t,style:{position:"fixed"},onFocus:e=>{const t=e.relatedTarget;!s.viewport?.contains(t)&&o()}})}));M.displayName=j;var K="Toast",O=e.forwardRef(((e,t)=>{const{forceMount:r,open:a,defaultOpen:i,onOpenChange:c,...d}=e,[u=!0,l]=m({prop:a,defaultProp:i,onChange:c});return w(o,{present:r||u,children:w(B,{open:u,...d,ref:t,onClose:()=>l(!1),onPause:s(e.onPause),onResume:s(e.onResume),onSwipeStart:n(e.onSwipeStart,(e=>{e.currentTarget.setAttribute("data-swipe","start")})),onSwipeMove:n(e.onSwipeMove,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${r}px`)})),onSwipeCancel:n(e.onSwipeCancel,(e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")})),onSwipeEnd:n(e.onSwipeEnd,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${r}px`),l(!1)}))})})}));O.displayName=K;var[V,$]=P(K,{onClose(){}}),B=e.forwardRef(((o,a)=>{const{__scopeToast:i,type:c="foreground",duration:d,open:l,onClose:f,onEscapeKeyDown:m,onPause:v,onResume:y,onSwipeStart:g,onSwipeMove:E,onSwipeCancel:T,onSwipeEnd:R,...C}=o,P=D(K,i),[N,k]=e.useState(null),L=r(a,(e=>k(e))),S=e.useRef(null),_=e.useRef(null),A=d||P.duration,j=e.useRef(0),M=e.useRef(A),O=e.useRef(0),{onToastAdd:$,onToastRemove:B}=P,X=s((()=>{const e=N?.contains(document.activeElement);e&&P.viewport?.focus(),f()})),q=e.useCallback((e=>{e&&e!==1/0&&(window.clearTimeout(O.current),j.current=(new Date).getTime(),O.current=window.setTimeout(X,e))}),[X]);e.useEffect((()=>{const e=P.viewport;if(e){const t=()=>{q(M.current),y?.()},r=()=>{const e=(new Date).getTime()-j.current;M.current=M.current-e,window.clearTimeout(O.current),v?.()};return e.addEventListener(F,r),e.addEventListener(I,t),()=>{e.removeEventListener(F,r),e.removeEventListener(I,t)}}}),[P.viewport,A,v,y,q]),e.useEffect((()=>{l&&!P.isClosePausedRef.current&&q(A)}),[l,A,P.isClosePausedRef,q]),e.useEffect((()=>($(),()=>B())),[$,B]);const H=e.useMemo((()=>N?J(N):null),[N]);return P.viewport?h(x,{children:[H&&w(U,{__scopeToast:i,role:"status","aria-live":"foreground"===c?"assertive":"polite","aria-atomic":!0,children:H}),w(V,{scope:i,onClose:X,children:t.createPortal(w(b.ItemSlot,{scope:i,children:w(u,{asChild:!0,onEscapeKeyDown:n(m,(()=>{P.isFocusedToastEscapeKeyDownRef.current||X(),P.isFocusedToastEscapeKeyDownRef.current=!1})),children:w(p.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":l?"open":"closed","data-swipe-direction":P.swipeDirection,...C,ref:L,style:{userSelect:"none",touchAction:"none",...o.style},onKeyDown:n(o.onKeyDown,(e=>{"Escape"===e.key&&(m?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(P.isFocusedToastEscapeKeyDownRef.current=!0,X()))})),onPointerDown:n(o.onPointerDown,(e=>{0===e.button&&(S.current={x:e.clientX,y:e.clientY})})),onPointerMove:n(o.onPointerMove,(e=>{if(!S.current)return;const t=e.clientX-S.current.x,r=e.clientY-S.current.y,o=Boolean(_.current),n=["left","right"].includes(P.swipeDirection),s=["left","up"].includes(P.swipeDirection)?Math.min:Math.max,a=n?s(0,t):0,i=n?0:s(0,r),c="touch"===e.pointerType?10:2,d={x:a,y:i},u={originalEvent:e,delta:d};o?(_.current=d,Q("toast.swipeMove",E,u,{discrete:!1})):Z(d,P.swipeDirection,c)?(_.current=d,Q("toast.swipeStart",g,u,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(r)>c)&&(S.current=null)})),onPointerUp:n(o.onPointerUp,(e=>{const t=_.current,r=e.target;if(r.hasPointerCapture(e.pointerId)&&r.releasePointerCapture(e.pointerId),_.current=null,S.current=null,t){const r=e.currentTarget,o={originalEvent:e,delta:t};Z(t,P.swipeDirection,P.swipeThreshold)?Q("toast.swipeEnd",R,o,{discrete:!0}):Q("toast.swipeCancel",T,o,{discrete:!0}),r.addEventListener("click",(e=>e.preventDefault()),{once:!0})}}))})})}),P.viewport)})]}):null})),U=t=>{const{__scopeToast:r,children:o,...n}=t,i=D(K,r),[c,d]=e.useState(!1),[u,p]=e.useState(!1);return function(e=()=>{}){const t=s(e);a((()=>{let e=0,r=0;return e=window.requestAnimationFrame((()=>r=window.requestAnimationFrame(t))),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(r)}}),[t])}((()=>d(!0))),e.useEffect((()=>{const e=window.setTimeout((()=>p(!0)),1e3);return()=>window.clearTimeout(e)}),[]),u?null:w(l,{asChild:!0,children:w(v,{...n,children:c&&h(x,{children:[i.label," ",o]})})})},X=e.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;return w(p.div,{...o,ref:t})}));X.displayName="ToastTitle";var q=e.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;return w(p.div,{...o,ref:t})}));q.displayName="ToastDescription";var H="ToastAction",W=e.forwardRef(((e,t)=>{const{altText:r,...o}=e;return r.trim()?w(G,{altText:r,asChild:!0,children:w(z,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${H}\`. Expected non-empty \`string\`.`),null)}));W.displayName=H;var Y="ToastClose",z=e.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e,s=$(Y,r);return w(G,{asChild:!0,children:w(p.button,{type:"button",...o,ref:t,onClick:n(e.onClick,s.onClose)})})}));z.displayName=Y;var G=e.forwardRef(((e,t)=>{const{__scopeToast:r,altText:o,...n}=e;return w(p.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...n,ref:t})}));function J(e){const t=[];return Array.from(e.childNodes).forEach((e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),function(e){return e.nodeType===e.ELEMENT_NODE}(e)){const r=e.ariaHidden||e.hidden||"none"===e.style.display,o=""===e.dataset.radixToastAnnounceExclude;if(!r)if(o){const r=e.dataset.radixToastAnnounceAlt;r&&t.push(r)}else t.push(...J(e))}})),t}function Q(e,t,r,{discrete:o}){const n=r.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),o?f(n,s):n.dispatchEvent(s)}var Z=(e,t,r=0)=>{const o=Math.abs(e.x),n=Math.abs(e.y),s=o>n;return"left"===t||"right"===t?s&&o>r:!s&&n>r};function ee(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function te(e){const t=document.activeElement;return e.some((e=>e===t||(e.focus(),document.activeElement!==t)))}var re=A,oe=O,ne=X,se=q,ae=W,ie=z;const ce=L,de=({className:e,...t})=>React.createElement(re,{"data-slot":"toast-viewport",className:g("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:top-auto sm:right-0 sm:bottom-0 sm:flex-col md:max-w-[420px]",e),...t}),ue=y("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive-foreground bg-destructive-foreground text-destructive"}},defaultVariants:{variant:"default"}}),le=({className:e,variant:t,...r})=>React.createElement(oe,{"data-slot":"toast-root",className:g(ue({variant:t}),e),...r}),pe=({className:e,...t})=>React.createElement(ae,{"data-slot":"toast-action",className:g("ring-offset-background hover:bg-secondary focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none disabled:opacity-50",e),...t}),fe=({className:e,...t})=>React.createElement(ie,{"data-slot":"toast-close",className:g("text-foreground/50 hover:text-foreground absolute top-2 right-2 rounded-md p-1 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:ring-2 focus:outline-none group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t},React.createElement(E,{className:"h-4 w-4"})),me=({className:e,...t})=>React.createElement(ne,{"data-slot":"toast-title",className:g("text-sm font-semibold",e),...t}),ve=({className:e,...t})=>React.createElement(se,{"data-slot":"toast-description",className:g("text-sm opacity-90",e),...t});export{le as Toast,pe as ToastAction,fe as ToastClose,ve as ToastDescription,ce as ToastProvider,me as ToastTitle,de as ToastViewport};
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../node_modules/@radix-ui/react-toast/dist/index.mjs","../../src/components/ui/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\n// packages/react/toast/src/toast.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport * as DismissableLayer from \"@radix-ui/react-dismissable-layer\";\nimport { Portal } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar PROVIDER_NAME = \"ToastProvider\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(\"Toast\");\nvar [createToastContext, createToastScope] = createContextScope(\"Toast\", [createCollectionScope]);\nvar [ToastProviderProvider, useToastProviderContext] = createToastContext(PROVIDER_NAME);\nvar ToastProvider = (props) => {\n const {\n __scopeToast,\n label = \"Notification\",\n duration = 5e3,\n swipeDirection = \"right\",\n swipeThreshold = 50,\n children\n } = props;\n const [viewport, setViewport] = React.useState(null);\n const [toastCount, setToastCount] = React.useState(0);\n const isFocusedToastEscapeKeyDownRef = React.useRef(false);\n const isClosePausedRef = React.useRef(false);\n if (!label.trim()) {\n console.error(\n `Invalid prop \\`label\\` supplied to \\`${PROVIDER_NAME}\\`. Expected non-empty \\`string\\`.`\n );\n }\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: __scopeToast, children: /* @__PURE__ */ jsx(\n ToastProviderProvider,\n {\n scope: __scopeToast,\n label,\n duration,\n swipeDirection,\n swipeThreshold,\n toastCount,\n viewport,\n onViewportChange: setViewport,\n onToastAdd: React.useCallback(() => setToastCount((prevCount) => prevCount + 1), []),\n onToastRemove: React.useCallback(() => setToastCount((prevCount) => prevCount - 1), []),\n isFocusedToastEscapeKeyDownRef,\n isClosePausedRef,\n children\n }\n ) });\n};\nToastProvider.displayName = PROVIDER_NAME;\nvar VIEWPORT_NAME = \"ToastViewport\";\nvar VIEWPORT_DEFAULT_HOTKEY = [\"F8\"];\nvar VIEWPORT_PAUSE = \"toast.viewportPause\";\nvar VIEWPORT_RESUME = \"toast.viewportResume\";\nvar ToastViewport = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeToast,\n hotkey = VIEWPORT_DEFAULT_HOTKEY,\n label = \"Notifications ({hotkey})\",\n ...viewportProps\n } = props;\n const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);\n const getItems = useCollection(__scopeToast);\n const wrapperRef = React.useRef(null);\n const headFocusProxyRef = React.useRef(null);\n const tailFocusProxyRef = React.useRef(null);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n const hotkeyLabel = hotkey.join(\"+\").replace(/Key/g, \"\").replace(/Digit/g, \"\");\n const hasToasts = context.toastCount > 0;\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n const isHotkeyPressed = hotkey.length !== 0 && hotkey.every((key) => event[key] || event.code === key);\n if (isHotkeyPressed) ref.current?.focus();\n };\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [hotkey]);\n React.useEffect(() => {\n const wrapper = wrapperRef.current;\n const viewport = ref.current;\n if (hasToasts && wrapper && viewport) {\n const handlePause = () => {\n if (!context.isClosePausedRef.current) {\n const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);\n viewport.dispatchEvent(pauseEvent);\n context.isClosePausedRef.current = true;\n }\n };\n const handleResume = () => {\n if (context.isClosePausedRef.current) {\n const resumeEvent = new CustomEvent(VIEWPORT_RESUME);\n viewport.dispatchEvent(resumeEvent);\n context.isClosePausedRef.current = false;\n }\n };\n const handleFocusOutResume = (event) => {\n const isFocusMovingOutside = !wrapper.contains(event.relatedTarget);\n if (isFocusMovingOutside) handleResume();\n };\n const handlePointerLeaveResume = () => {\n const isFocusInside = wrapper.contains(document.activeElement);\n if (!isFocusInside) handleResume();\n };\n wrapper.addEventListener(\"focusin\", handlePause);\n wrapper.addEventListener(\"focusout\", handleFocusOutResume);\n wrapper.addEventListener(\"pointermove\", handlePause);\n wrapper.addEventListener(\"pointerleave\", handlePointerLeaveResume);\n window.addEventListener(\"blur\", handlePause);\n window.addEventListener(\"focus\", handleResume);\n return () => {\n wrapper.removeEventListener(\"focusin\", handlePause);\n wrapper.removeEventListener(\"focusout\", handleFocusOutResume);\n wrapper.removeEventListener(\"pointermove\", handlePause);\n wrapper.removeEventListener(\"pointerleave\", handlePointerLeaveResume);\n window.removeEventListener(\"blur\", handlePause);\n window.removeEventListener(\"focus\", handleResume);\n };\n }\n }, [hasToasts, context.isClosePausedRef]);\n const getSortedTabbableCandidates = React.useCallback(\n ({ tabbingDirection }) => {\n const toastItems = getItems();\n const tabbableCandidates = toastItems.map((toastItem) => {\n const toastNode = toastItem.ref.current;\n const toastTabbableCandidates = [toastNode, ...getTabbableCandidates(toastNode)];\n return tabbingDirection === \"forwards\" ? toastTabbableCandidates : toastTabbableCandidates.reverse();\n });\n return (tabbingDirection === \"forwards\" ? tabbableCandidates.reverse() : tabbableCandidates).flat();\n },\n [getItems]\n );\n React.useEffect(() => {\n const viewport = ref.current;\n if (viewport) {\n const handleKeyDown = (event) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === \"Tab\" && !isMetaKey;\n if (isTabKey) {\n const focusedElement = document.activeElement;\n const isTabbingBackwards = event.shiftKey;\n const targetIsViewport = event.target === viewport;\n if (targetIsViewport && isTabbingBackwards) {\n headFocusProxyRef.current?.focus();\n return;\n }\n const tabbingDirection = isTabbingBackwards ? \"backwards\" : \"forwards\";\n const sortedCandidates = getSortedTabbableCandidates({ tabbingDirection });\n const index = sortedCandidates.findIndex((candidate) => candidate === focusedElement);\n if (focusFirst(sortedCandidates.slice(index + 1))) {\n event.preventDefault();\n } else {\n isTabbingBackwards ? headFocusProxyRef.current?.focus() : tailFocusProxyRef.current?.focus();\n }\n }\n };\n viewport.addEventListener(\"keydown\", handleKeyDown);\n return () => viewport.removeEventListener(\"keydown\", handleKeyDown);\n }\n }, [getItems, getSortedTabbableCandidates]);\n return /* @__PURE__ */ jsxs(\n DismissableLayer.Branch,\n {\n ref: wrapperRef,\n role: \"region\",\n \"aria-label\": label.replace(\"{hotkey}\", hotkeyLabel),\n tabIndex: -1,\n style: { pointerEvents: hasToasts ? void 0 : \"none\" },\n children: [\n hasToasts && /* @__PURE__ */ jsx(\n FocusProxy,\n {\n ref: headFocusProxyRef,\n onFocusFromOutsideViewport: () => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: \"forwards\"\n });\n focusFirst(tabbableCandidates);\n }\n }\n ),\n /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeToast, children: /* @__PURE__ */ jsx(Primitive.ol, { tabIndex: -1, ...viewportProps, ref: composedRefs }) }),\n hasToasts && /* @__PURE__ */ jsx(\n FocusProxy,\n {\n ref: tailFocusProxyRef,\n onFocusFromOutsideViewport: () => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: \"backwards\"\n });\n focusFirst(tabbableCandidates);\n }\n }\n )\n ]\n }\n );\n }\n);\nToastViewport.displayName = VIEWPORT_NAME;\nvar FOCUS_PROXY_NAME = \"ToastFocusProxy\";\nvar FocusProxy = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;\n const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);\n return /* @__PURE__ */ jsx(\n VisuallyHidden,\n {\n \"aria-hidden\": true,\n tabIndex: 0,\n ...proxyProps,\n ref: forwardedRef,\n style: { position: \"fixed\" },\n onFocus: (event) => {\n const prevFocusedElement = event.relatedTarget;\n const isFocusFromOutsideViewport = !context.viewport?.contains(prevFocusedElement);\n if (isFocusFromOutsideViewport) onFocusFromOutsideViewport();\n }\n }\n );\n }\n);\nFocusProxy.displayName = FOCUS_PROXY_NAME;\nvar TOAST_NAME = \"Toast\";\nvar TOAST_SWIPE_START = \"toast.swipeStart\";\nvar TOAST_SWIPE_MOVE = \"toast.swipeMove\";\nvar TOAST_SWIPE_CANCEL = \"toast.swipeCancel\";\nvar TOAST_SWIPE_END = \"toast.swipeEnd\";\nvar Toast = React.forwardRef(\n (props, forwardedRef) => {\n const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;\n const [open = true, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange\n });\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || open, children: /* @__PURE__ */ jsx(\n ToastImpl,\n {\n open,\n ...toastProps,\n ref: forwardedRef,\n onClose: () => setOpen(false),\n onPause: useCallbackRef(props.onPause),\n onResume: useCallbackRef(props.onResume),\n onSwipeStart: composeEventHandlers(props.onSwipeStart, (event) => {\n event.currentTarget.setAttribute(\"data-swipe\", \"start\");\n }),\n onSwipeMove: composeEventHandlers(props.onSwipeMove, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute(\"data-swipe\", \"move\");\n event.currentTarget.style.setProperty(\"--radix-toast-swipe-move-x\", `${x}px`);\n event.currentTarget.style.setProperty(\"--radix-toast-swipe-move-y\", `${y}px`);\n }),\n onSwipeCancel: composeEventHandlers(props.onSwipeCancel, (event) => {\n event.currentTarget.setAttribute(\"data-swipe\", \"cancel\");\n event.currentTarget.style.removeProperty(\"--radix-toast-swipe-move-x\");\n event.currentTarget.style.removeProperty(\"--radix-toast-swipe-move-y\");\n event.currentTarget.style.removeProperty(\"--radix-toast-swipe-end-x\");\n event.currentTarget.style.removeProperty(\"--radix-toast-swipe-end-y\");\n }),\n onSwipeEnd: composeEventHandlers(props.onSwipeEnd, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute(\"data-swipe\", \"end\");\n event.currentTarget.style.removeProperty(\"--radix-toast-swipe-move-x\");\n event.currentTarget.style.removeProperty(\"--radix-toast-swipe-move-y\");\n event.currentTarget.style.setProperty(\"--radix-toast-swipe-end-x\", `${x}px`);\n event.currentTarget.style.setProperty(\"--radix-toast-swipe-end-y\", `${y}px`);\n setOpen(false);\n })\n }\n ) });\n }\n);\nToast.displayName = TOAST_NAME;\nvar [ToastInteractiveProvider, useToastInteractiveContext] = createToastContext(TOAST_NAME, {\n onClose() {\n }\n});\nvar ToastImpl = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeToast,\n type = \"foreground\",\n duration: durationProp,\n open,\n onClose,\n onEscapeKeyDown,\n onPause,\n onResume,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n ...toastProps\n } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const [node, setNode] = React.useState(null);\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const pointerStartRef = React.useRef(null);\n const swipeDeltaRef = React.useRef(null);\n const duration = durationProp || context.duration;\n const closeTimerStartTimeRef = React.useRef(0);\n const closeTimerRemainingTimeRef = React.useRef(duration);\n const closeTimerRef = React.useRef(0);\n const { onToastAdd, onToastRemove } = context;\n const handleClose = useCallbackRef(() => {\n const isFocusInToast = node?.contains(document.activeElement);\n if (isFocusInToast) context.viewport?.focus();\n onClose();\n });\n const startTimer = React.useCallback(\n (duration2) => {\n if (!duration2 || duration2 === Infinity) return;\n window.clearTimeout(closeTimerRef.current);\n closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();\n closeTimerRef.current = window.setTimeout(handleClose, duration2);\n },\n [handleClose]\n );\n React.useEffect(() => {\n const viewport = context.viewport;\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.current);\n onResume?.();\n };\n const handlePause = () => {\n const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;\n closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;\n window.clearTimeout(closeTimerRef.current);\n onPause?.();\n };\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.addEventListener(VIEWPORT_RESUME, handleResume);\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume);\n };\n }\n }, [context.viewport, duration, onPause, onResume, startTimer]);\n React.useEffect(() => {\n if (open && !context.isClosePausedRef.current) startTimer(duration);\n }, [open, duration, context.isClosePausedRef, startTimer]);\n React.useEffect(() => {\n onToastAdd();\n return () => onToastRemove();\n }, [onToastAdd, onToastRemove]);\n const announceTextContent = React.useMemo(() => {\n return node ? getAnnounceTextContent(node) : null;\n }, [node]);\n if (!context.viewport) return null;\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n announceTextContent && /* @__PURE__ */ jsx(\n ToastAnnounce,\n {\n __scopeToast,\n role: \"status\",\n \"aria-live\": type === \"foreground\" ? \"assertive\" : \"polite\",\n \"aria-atomic\": true,\n children: announceTextContent\n }\n ),\n /* @__PURE__ */ jsx(ToastInteractiveProvider, { scope: __scopeToast, onClose: handleClose, children: ReactDOM.createPortal(\n /* @__PURE__ */ jsx(Collection.ItemSlot, { scope: __scopeToast, children: /* @__PURE__ */ jsx(\n DismissableLayer.Root,\n {\n asChild: true,\n onEscapeKeyDown: composeEventHandlers(onEscapeKeyDown, () => {\n if (!context.isFocusedToastEscapeKeyDownRef.current) handleClose();\n context.isFocusedToastEscapeKeyDownRef.current = false;\n }),\n children: /* @__PURE__ */ jsx(\n Primitive.li,\n {\n role: \"status\",\n \"aria-live\": \"off\",\n \"aria-atomic\": true,\n tabIndex: 0,\n \"data-state\": open ? \"open\" : \"closed\",\n \"data-swipe-direction\": context.swipeDirection,\n ...toastProps,\n ref: composedRefs,\n style: { userSelect: \"none\", touchAction: \"none\", ...props.style },\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key !== \"Escape\") return;\n onEscapeKeyDown?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) {\n context.isFocusedToastEscapeKeyDownRef.current = true;\n handleClose();\n }\n }),\n onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {\n if (event.button !== 0) return;\n pointerStartRef.current = { x: event.clientX, y: event.clientY };\n }),\n onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {\n if (!pointerStartRef.current) return;\n const x = event.clientX - pointerStartRef.current.x;\n const y = event.clientY - pointerStartRef.current.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef.current);\n const isHorizontalSwipe = [\"left\", \"right\"].includes(context.swipeDirection);\n const clamp = [\"left\", \"up\"].includes(context.swipeDirection) ? Math.min : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === \"touch\" ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, onSwipeMove, eventDetail, {\n discrete: false\n });\n } else if (isDeltaInDirection(delta, context.swipeDirection, moveStartBuffer)) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, onSwipeStart, eventDetail, {\n discrete: false\n });\n event.target.setPointerCapture(event.pointerId);\n } else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n pointerStartRef.current = null;\n }\n }),\n onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {\n const delta = swipeDeltaRef.current;\n const target = event.target;\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n swipeDeltaRef.current = null;\n pointerStartRef.current = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true\n });\n } else {\n handleAndDispatchCustomEvent(\n TOAST_SWIPE_CANCEL,\n onSwipeCancel,\n eventDetail,\n {\n discrete: true\n }\n );\n }\n toast.addEventListener(\"click\", (event2) => event2.preventDefault(), {\n once: true\n });\n }\n })\n }\n )\n }\n ) }),\n context.viewport\n ) })\n ] });\n }\n);\nvar ToastAnnounce = (props) => {\n const { __scopeToast, children, ...announceProps } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const [renderAnnounceText, setRenderAnnounceText] = React.useState(false);\n const [isAnnounced, setIsAnnounced] = React.useState(false);\n useNextFrame(() => setRenderAnnounceText(true));\n React.useEffect(() => {\n const timer = window.setTimeout(() => setIsAnnounced(true), 1e3);\n return () => window.clearTimeout(timer);\n }, []);\n return isAnnounced ? null : /* @__PURE__ */ jsx(Portal, { asChild: true, children: /* @__PURE__ */ jsx(VisuallyHidden, { ...announceProps, children: renderAnnounceText && /* @__PURE__ */ jsxs(Fragment, { children: [\n context.label,\n \" \",\n children\n ] }) }) });\n};\nvar TITLE_NAME = \"ToastTitle\";\nvar ToastTitle = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeToast, ...titleProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { ...titleProps, ref: forwardedRef });\n }\n);\nToastTitle.displayName = TITLE_NAME;\nvar DESCRIPTION_NAME = \"ToastDescription\";\nvar ToastDescription = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeToast, ...descriptionProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { ...descriptionProps, ref: forwardedRef });\n }\n);\nToastDescription.displayName = DESCRIPTION_NAME;\nvar ACTION_NAME = \"ToastAction\";\nvar ToastAction = React.forwardRef(\n (props, forwardedRef) => {\n const { altText, ...actionProps } = props;\n if (!altText.trim()) {\n console.error(\n `Invalid prop \\`altText\\` supplied to \\`${ACTION_NAME}\\`. Expected non-empty \\`string\\`.`\n );\n return null;\n }\n return /* @__PURE__ */ jsx(ToastAnnounceExclude, { altText, asChild: true, children: /* @__PURE__ */ jsx(ToastClose, { ...actionProps, ref: forwardedRef }) });\n }\n);\nToastAction.displayName = ACTION_NAME;\nvar CLOSE_NAME = \"ToastClose\";\nvar ToastClose = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeToast, ...closeProps } = props;\n const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);\n return /* @__PURE__ */ jsx(ToastAnnounceExclude, { asChild: true, children: /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n ...closeProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, interactiveContext.onClose)\n }\n ) });\n }\n);\nToastClose.displayName = CLOSE_NAME;\nvar ToastAnnounceExclude = React.forwardRef((props, forwardedRef) => {\n const { __scopeToast, altText, ...announceExcludeProps } = props;\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-radix-toast-announce-exclude\": \"\",\n \"data-radix-toast-announce-alt\": altText || void 0,\n ...announceExcludeProps,\n ref: forwardedRef\n }\n );\n});\nfunction getAnnounceTextContent(container) {\n const textContent = [];\n const childNodes = Array.from(container.childNodes);\n childNodes.forEach((node) => {\n if (node.nodeType === node.TEXT_NODE && node.textContent) textContent.push(node.textContent);\n if (isHTMLElement(node)) {\n const isHidden = node.ariaHidden || node.hidden || node.style.display === \"none\";\n const isExcluded = node.dataset.radixToastAnnounceExclude === \"\";\n if (!isHidden) {\n if (isExcluded) {\n const altText = node.dataset.radixToastAnnounceAlt;\n if (altText) textContent.push(altText);\n } else {\n textContent.push(...getAnnounceTextContent(node));\n }\n }\n }\n });\n return textContent;\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const currentTarget = detail.originalEvent.currentTarget;\n const event = new CustomEvent(name, { bubbles: true, cancelable: true, detail });\n if (handler) currentTarget.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(currentTarget, event);\n } else {\n currentTarget.dispatchEvent(event);\n }\n}\nvar isDeltaInDirection = (delta, direction, threshold = 0) => {\n const deltaX = Math.abs(delta.x);\n const deltaY = Math.abs(delta.y);\n const isDeltaX = deltaX > deltaY;\n if (direction === \"left\" || direction === \"right\") {\n return isDeltaX && deltaX > threshold;\n } else {\n return !isDeltaX && deltaY > threshold;\n }\n};\nfunction useNextFrame(callback = () => {\n}) {\n const fn = useCallbackRef(callback);\n useLayoutEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n raf1 = window.requestAnimationFrame(() => raf2 = window.requestAnimationFrame(fn));\n return () => {\n window.cancelAnimationFrame(raf1);\n window.cancelAnimationFrame(raf2);\n };\n }, [fn]);\n}\nfunction isHTMLElement(node) {\n return node.nodeType === node.ELEMENT_NODE;\n}\nfunction getTabbableCandidates(container) {\n const nodes = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node) => {\n const isHiddenInput = node.tagName === \"INPUT\" && node.type === \"hidden\";\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while (walker.nextNode()) nodes.push(walker.currentNode);\n return nodes;\n}\nfunction focusFirst(candidates) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\n}\nvar Provider = ToastProvider;\nvar Viewport = ToastViewport;\nvar Root2 = Toast;\nvar Title = ToastTitle;\nvar Description = ToastDescription;\nvar Action = ToastAction;\nvar Close = ToastClose;\nexport {\n Action,\n Close,\n Description,\n Provider,\n Root2 as Root,\n Title,\n Toast,\n ToastAction,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n Viewport,\n createToastScope\n};\n//# sourceMappingURL=index.mjs.map\n","import * as ToastPrimitives from \"@radix-ui/react-toast\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst ToastProvider = ToastPrimitives.Provider;\n\nconst ToastViewport = ({\n className,\n ...props\n}: React.ComponentProps<typeof ToastPrimitives.Viewport>) => (\n <ToastPrimitives.Viewport\n data-slot=\"toast-viewport\"\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:top-auto sm:right-0 sm:bottom-0 sm:flex-col md:max-w-[420px]\",\n className,\n )}\n {...props}\n />\n);\n\nconst toastVariants = cva(\n \"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full\",\n {\n variants: {\n variant: {\n default: \"border bg-background text-foreground\",\n destructive:\n \"destructive group border-destructive-foreground bg-destructive-foreground text-destructive\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nconst Toast = ({\n className,\n variant,\n ...props\n}: React.ComponentProps<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>) => {\n return (\n <ToastPrimitives.Root\n data-slot=\"toast-root\"\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n );\n};\n\nconst ToastAction = ({\n className,\n ...props\n}: React.ComponentProps<typeof ToastPrimitives.Action>) => (\n <ToastPrimitives.Action\n data-slot=\"toast-action\"\n className={cn(\n \"ring-offset-background hover:bg-secondary focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n);\n\nconst ToastClose = ({\n className,\n ...props\n}: React.ComponentProps<typeof ToastPrimitives.Close>) => (\n <ToastPrimitives.Close\n data-slot=\"toast-close\"\n className={cn(\n \"text-foreground/50 hover:text-foreground absolute top-2 right-2 rounded-md p-1 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:ring-2 focus:outline-none group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600\",\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n);\n\nconst ToastTitle = ({\n className,\n ...props\n}: React.ComponentProps<typeof ToastPrimitives.Title>) => (\n <ToastPrimitives.Title\n data-slot=\"toast-title\"\n className={cn(\"text-sm font-semibold\", className)}\n {...props}\n />\n);\n\nconst ToastDescription = ({\n className,\n ...props\n}: React.ComponentProps<typeof ToastPrimitives.Description>) => (\n <ToastPrimitives.Description\n data-slot=\"toast-description\"\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n);\n\ntype ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\n\ntype ToastActionElement = React.ReactElement<typeof ToastAction>;\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n"],"names":["PROVIDER_NAME","Collection","useCollection","createCollectionScope","createCollection","createToastContext","createToastScope","createContextScope","ToastProviderProvider","useToastProviderContext","ToastProvider","props","__scopeToast","label","duration","swipeDirection","swipeThreshold","children","viewport","setViewport","React","useState","toastCount","setToastCount","isFocusedToastEscapeKeyDownRef","useRef","isClosePausedRef","trim","console","error","jsx","Provider","scope","onViewportChange","onToastAdd","useCallback","prevCount","onToastRemove","displayName","VIEWPORT_NAME","VIEWPORT_DEFAULT_HOTKEY","VIEWPORT_PAUSE","VIEWPORT_RESUME","ToastViewport","forwardRef","forwardedRef","hotkey","viewportProps","context","getItems","wrapperRef","headFocusProxyRef","tailFocusProxyRef","ref","composedRefs","useComposedRefs","hotkeyLabel","join","replace","hasToasts","useEffect","handleKeyDown","event","length","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","handleFocusOutResume","contains","relatedTarget","handlePointerLeaveResume","activeElement","window","getSortedTabbableCandidates","tabbingDirection","tabbableCandidates","map","toastItem","toastNode","toastTabbableCandidates","getTabbableCandidates","reverse","flat","isMetaKey","altKey","ctrlKey","metaKey","focusedElement","isTabbingBackwards","shiftKey","target","sortedCandidates","index","findIndex","candidate","focusFirst","slice","preventDefault","jsxs","DismissableLayer.Branch","role","tabIndex","style","pointerEvents","FocusProxy","onFocusFromOutsideViewport","Slot","Primitive","ol","FOCUS_PROXY_NAME","proxyProps","VisuallyHidden","position","onFocus","prevFocusedElement","TOAST_NAME","Toast","forceMount","open","openProp","defaultOpen","onOpenChange","toastProps","setOpen","useControllableState","prop","defaultProp","onChange","Presence","present","ToastImpl","onClose","onPause","useCallbackRef","onResume","onSwipeStart","composeEventHandlers","currentTarget","setAttribute","onSwipeMove","x","y","detail","delta","setProperty","onSwipeCancel","removeProperty","onSwipeEnd","ToastInteractiveProvider","useToastInteractiveContext","type","durationProp","onEscapeKeyDown","node","setNode","pointerStartRef","swipeDeltaRef","closeTimerStartTimeRef","closeTimerRemainingTimeRef","closeTimerRef","handleClose","isFocusInToast","startTimer","Infinity","clearTimeout","Date","getTime","setTimeout","elapsedTime","announceTextContent","useMemo","getAnnounceTextContent","Fragment","ToastAnnounce","ReactDOM","createPortal","ItemSlot","DismissableLayer.Root","asChild","li","userSelect","touchAction","onKeyDown","nativeEvent","defaultPrevented","onPointerDown","button","clientX","clientY","onPointerMove","hasSwipeMoveStarted","Boolean","isHorizontalSwipe","includes","clamp","Math","min","max","clampedX","clampedY","moveStartBuffer","pointerType","eventDetail","originalEvent","handleAndDispatchCustomEvent","discrete","isDeltaInDirection","setPointerCapture","pointerId","abs","onPointerUp","hasPointerCapture","releasePointerCapture","toast","once","announceProps","renderAnnounceText","setRenderAnnounceText","isAnnounced","setIsAnnounced","callback","fn","useLayoutEffect","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","useNextFrame","timer","Portal","ToastTitle","titleProps","div","ToastDescription","descriptionProps","ACTION_NAME","ToastAction","altText","actionProps","ToastAnnounceExclude","ToastClose","CLOSE_NAME","closeProps","interactiveContext","onClick","announceExcludeProps","container","textContent","Array","from","childNodes","forEach","nodeType","TEXT_NODE","push","ELEMENT_NODE","isHTMLElement","isHidden","ariaHidden","hidden","display","isExcluded","dataset","radixToastAnnounceExclude","radixToastAnnounceAlt","name","handler","bubbles","cancelable","dispatchDiscreteCustomEvent","direction","threshold","deltaX","deltaY","isDeltaX","nodes","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","isHiddenInput","tagName","disabled","FILTER_SKIP","FILTER_ACCEPT","nextNode","currentNode","candidates","previouslyFocusedElement","some","Viewport","Root","Title","Description","Action","Close","className","ToastPrimitives","data-slot","cn","toastVariants","cva","variants","variant","default","destructive","defaultVariants","createElement","toast-close","X"],"mappings":"wwBAqBA,IAAMA,EAAgB,iBAEfC,EAAYC,EAAeC,GAAyBC,EAA+B,UAkBnFC,EAAoBC,GAAoBC,EAAmB,QAAS,CAACJ,KACrEK,EAAuBC,GAC5BJ,EAA8CL,GA2B1CU,EAA+CC,IACnD,MAAMC,aACJA,EAAAC,MACAA,EAAQ,eAAAC,SACRA,EAAW,IAAAC,eACXA,EAAiB,QAAAC,eACjBA,EAAiB,GAAAC,SACjBA,GACEN,GACGO,EAAUC,GAAqBC,EAAAC,SAAsC,OACrEC,EAAYC,GAAuBH,EAAAC,SAAS,GAC7CG,EAAuCJ,EAAAK,QAAO,GAC9CC,EAAyBN,EAAAK,QAAO,GAQtC,OANKZ,EAAMc,QACTC,QAAQC,MACN,wCAAwC7B,uCAK1C8B,EAAC7B,EAAW8B,SAAX,CAAoBC,MAAOpB,EAC1BK,SAAAa,EAACtB,EAAA,CACCwB,MAAOpB,EACPC,QACAC,WACAC,iBACAC,iBACAM,aACAJ,WACAe,iBAAkBd,EAClBe,WAAkBd,EAAAe,aAAY,IAAMZ,GAAea,GAAcA,EAAY,KAAI,IAC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HS,MAACkS,cAAAA,GAAsB,CACrBC,YAAU,eACVF,UAAWG,EACT,qgBACAH,MAEE1S,IAIFiP,GAAa,EACjByD,eACG1S,KAEHS,MAACkS,cAAAA,GAAqB,CACpBC,YAAU,cACVF,UAAWG,EACT,wVACAH,GAEFY,cAAY,MACRtT,GAEJS,MAAC8S,cAAAA,EAAAA,CAAEb,UAAU,aAIXnE,GAAa,EACjBmE,eACG1S,KAEHS,MAACkS,cAAAA,GAAqB,CACpBC,YAAU,cACVF,UAAWG,EAAG,wBAAyBH,MACnC1S,IAIF0O,GAAmB,EACvBgE,eACG1S,KAEHS,MAACkS,cAAAA,GAA2B,CAC1BC,YAAU,oBACVF,UAAWG,EAAG,qBAAsBH,MAChC1S","x_google_ignoreList":[0]}
|
package/dist/tooltip/index.mjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import*as e from"react";import{
|
1
|
+
import*as e from"react";import{u as t,c as n,P as o}from"../chunks/index-CX5r7IKM.mjs";import{c as r}from"../chunks/index-CCYyT_rk.mjs";import{P as i,D as a}from"../chunks/index-CXrD_SvM.mjs";import{u as s}from"../chunks/index-Db2NO0t8.mjs";import{c,R as l,A as u,C as d,a as p}from"../chunks/index-DOx7g1Qo.mjs";import{P as f}from"../chunks/index-DxtdpBCb.mjs";import{Slottable as m}from"@radix-ui/react-slot";import{u as h}from"../chunks/index-D-s-TbR3.mjs";import{R as g}from"../chunks/index-B98y16WE.mjs";import{jsx as x,jsxs as y}from"react/jsx-runtime";import{c as v}from"../chunks/utils-jIFl11as.mjs";import"react-dom";import"../chunks/index-DzMQps4Q.mjs";import"../chunks/bundle-mjs-CtG6Smj_.mjs";var[b,w]=r("Tooltip",[c]),T=c(),C="TooltipProvider",E=700,k="tooltip.open",[_,D]=b(C),P=t=>{const{__scopeTooltip:n,delayDuration:o=E,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=t,[s,c]=e.useState(!0),l=e.useRef(!1),u=e.useRef(0);return e.useEffect((()=>{const e=u.current;return()=>window.clearTimeout(e)}),[]),x(_,{scope:n,isOpenDelayed:s,delayDuration:o,onOpen:e.useCallback((()=>{window.clearTimeout(u.current),c(!1)}),[]),onClose:e.useCallback((()=>{window.clearTimeout(u.current),u.current=window.setTimeout((()=>c(!0)),r)}),[r]),isPointerInTransitRef:l,onPointerInTransitChange:e.useCallback((e=>{l.current=e}),[]),disableHoverableContent:i,children:a})};P.displayName=C;var R="Tooltip",[L,O]=b(R),j=t=>{const{__scopeTooltip:n,children:o,open:r,defaultOpen:i=!1,onOpenChange:a,disableHoverableContent:c,delayDuration:u}=t,d=D(R,t.__scopeTooltip),p=T(n),[f,m]=e.useState(null),g=s(),y=e.useRef(0),v=c??d.disableHoverableContent,b=u??d.delayDuration,w=e.useRef(!1),[C=!1,E]=h({prop:r,defaultProp:i,onChange:e=>{e?(d.onOpen(),document.dispatchEvent(new CustomEvent(k))):d.onClose(),a?.(e)}}),_=e.useMemo((()=>C?w.current?"delayed-open":"instant-open":"closed"),[C]),P=e.useCallback((()=>{window.clearTimeout(y.current),y.current=0,w.current=!1,E(!0)}),[E]),O=e.useCallback((()=>{window.clearTimeout(y.current),y.current=0,E(!1)}),[E]),j=e.useCallback((()=>{window.clearTimeout(y.current),y.current=window.setTimeout((()=>{w.current=!0,E(!0),y.current=0}),b)}),[b,E]);return e.useEffect((()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)}),[]),x(l,{...p,children:x(L,{scope:n,contentId:g,open:C,stateAttribute:_,trigger:f,onTriggerChange:m,onTriggerEnter:e.useCallback((()=>{d.isOpenDelayed?j():P()}),[d.isOpenDelayed,j,P]),onTriggerLeave:e.useCallback((()=>{v?O():(window.clearTimeout(y.current),y.current=0)}),[O,v]),onOpen:P,onClose:O,disableHoverableContent:v,children:o})})};j.displayName=R;var M="TooltipTrigger",I=e.forwardRef(((o,r)=>{const{__scopeTooltip:i,...a}=o,s=O(M,i),c=D(M,i),l=T(i),d=e.useRef(null),p=t(r,d,s.onTriggerChange),m=e.useRef(!1),h=e.useRef(!1),g=e.useCallback((()=>m.current=!1),[]);return e.useEffect((()=>()=>document.removeEventListener("pointerup",g)),[g]),x(u,{asChild:!0,...l,children:x(f.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...a,ref:p,onPointerMove:n(o.onPointerMove,(e=>{"touch"!==e.pointerType&&(h.current||c.isPointerInTransitRef.current||(s.onTriggerEnter(),h.current=!0))})),onPointerLeave:n(o.onPointerLeave,(()=>{s.onTriggerLeave(),h.current=!1})),onPointerDown:n(o.onPointerDown,(()=>{m.current=!0,document.addEventListener("pointerup",g,{once:!0})})),onFocus:n(o.onFocus,(()=>{m.current||s.onOpen()})),onBlur:n(o.onBlur,s.onClose),onClick:n(o.onClick,s.onClose)})})}));I.displayName=M;var N="TooltipPortal",[H,A]=b(N,{forceMount:void 0}),B=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,s=O(N,t);return x(H,{scope:t,forceMount:n,children:x(o,{present:n||s.open,children:x(i,{asChild:!0,container:a,children:r})})})};B.displayName=N;var z="TooltipContent",F=e.forwardRef(((e,t)=>{const n=A(z,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...a}=e,s=O(z,e.__scopeTooltip);return x(o,{present:r||s.open,children:s.disableHoverableContent?x(Y,{side:i,...a,ref:t}):x(S,{side:i,...a,ref:t})})})),S=e.forwardRef(((n,o)=>{const r=O(z,n.__scopeTooltip),i=D(z,n.__scopeTooltip),a=e.useRef(null),s=t(o,a),[c,l]=e.useState(null),{trigger:u,onClose:d}=r,p=a.current,{onPointerInTransitChange:f}=i,m=e.useCallback((()=>{l(null),f(!1)}),[f]),h=e.useCallback(((e,t)=>{const n=e.currentTarget,o={x:e.clientX,y:e.clientY},r=function(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return o}(o,function(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,o,r,i)){case i:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}(o,n.getBoundingClientRect())),i=function(e){const t=e.slice();return t.sort(((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0)),function(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const o=e[n];for(;t.length>=2;){const e=t[t.length-1],n=t[t.length-2];if(!((e.x-n.x)*(o.y-n.y)>=(e.y-n.y)*(o.x-n.x)))break;t.pop()}t.push(o)}t.pop();const n=[];for(let t=e.length-1;t>=0;t--){const o=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(o.y-t.y)>=(e.y-t.y)*(o.x-t.x)))break;n.pop()}n.push(o)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...r,...function(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}(t.getBoundingClientRect())]);l(i),f(!0)}),[f]);return e.useEffect((()=>()=>m()),[m]),e.useEffect((()=>{if(u&&p){const e=e=>h(e,p),t=e=>h(e,u);return u.addEventListener("pointerleave",e),p.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),p.removeEventListener("pointerleave",t)}}}),[u,p,h,m]),e.useEffect((()=>{if(c){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},o=u?.contains(t)||p?.contains(t),r=!function(e,t){const{x:n,y:o}=e;let r=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){const a=t[e].x,s=t[e].y,c=t[i].x,l=t[i].y;s>o!=l>o&&n<(c-a)*(o-s)/(l-s)+a&&(r=!r)}return r}(n,c);o?m():r&&(m(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[u,p,c,d,m]),x(Y,{...n,ref:s})})),[K,X]=b(R,{isInside:!1}),Y=e.forwardRef(((t,n)=>{const{__scopeTooltip:o,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:c,...l}=t,u=O(z,o),p=T(o),{onClose:f}=u;return e.useEffect((()=>(document.addEventListener(k,f),()=>document.removeEventListener(k,f))),[f]),e.useEffect((()=>{if(u.trigger){const e=e=>{const t=e.target;t?.contains(u.trigger)&&f()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[u.trigger,f]),x(a,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:y(d,{"data-state":u.stateAttribute,...p,...l,ref:n,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[x(m,{children:r}),x(K,{scope:o,isInside:!0,children:x(g,{id:u.contentId,role:"tooltip",children:i||r})})]})})}));F.displayName=z;var q="TooltipArrow";e.forwardRef(((e,t)=>{const{__scopeTooltip:n,...o}=e,r=T(n);return X(q,n).isInside?null:x(p,{...r,...o,ref:t})})).displayName=q;var G=P,J=j,Q=I,U=B,V=F;function W({delayDuration:t=0,...n}){return e.createElement(G,{"data-slot":"tooltip-provider",delayDuration:t,...n})}function Z({...t}){return e.createElement(W,null,e.createElement(J,{"data-slot":"tooltip",...t}))}function $({...t}){return e.createElement(Q,{"data-slot":"tooltip-trigger",...t})}function ee({className:t,sideOffset:n=0,children:o,...r}){return e.createElement(U,null,e.createElement(V,{"data-slot":"tooltip-content",sideOffset:n,className:v("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md px-3 py-1.5 text-sm shadow-md drop-shadow",t),...r},o))}export{Z as Tooltip,ee as TooltipContent,W as TooltipProvider,$ as TooltipTrigger};
|
2
2
|
//# sourceMappingURL=index.mjs.map
|