@radui/ui 0.3.0 → 0.5.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.
- package/README.md +31 -0
- package/dist/components/Accordion.js +1 -1
- package/dist/components/AlertDialog.d.ts +5 -3
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AspectRatio.js +1 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/AvatarGroup.js +1 -1
- package/dist/components/{AvatarPrimitiveFallback-KiY3slgV.js → AvatarPrimitiveFallback-BOYawMc9.js} +1 -1
- package/dist/components/Badge.js +1 -1
- package/dist/components/BlockQuote.js +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.js +1 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/CheckboxCards.js +1 -1
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/{CheckboxGroupPrimitive-DgfnzMT9.js → CheckboxGroupPrimitive-Cd8ra39e.js} +1 -1
- package/dist/components/Code.js +1 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Combobox.d.ts +3 -1
- package/dist/components/Combobox.js +1 -1
- package/dist/components/ComboboxPrimitive-BhHSrtiY.js +1 -0
- package/dist/components/Command.d.ts +112 -0
- package/dist/components/Command.js +1 -0
- package/dist/components/ContextMenu.d.ts +16 -0
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/DataList.d.ts +7 -2
- package/dist/components/DataList.js +1 -1
- package/dist/components/Dialog.d.ts +5 -3
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Disclosure.js +1 -1
- package/dist/components/Drawer.d.ts +153 -0
- package/dist/components/Drawer.js +1 -0
- package/dist/components/DropdownMenu.d.ts +4 -0
- package/dist/components/DropdownMenu.js +1 -1
- package/dist/components/Em.js +1 -1
- package/dist/components/Heading.js +1 -1
- package/dist/components/HoverCard.d.ts +10 -2
- package/dist/components/HoverCard.js +1 -1
- package/dist/components/Kbd.js +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/MenuPrimitive-wJbEC-gM.js +1 -0
- package/dist/components/Menubar.d.ts +4 -0
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Minimap.js +1 -1
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.d.ts +2 -0
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Progress.js +1 -1
- package/dist/components/Quote.d.ts +2 -0
- package/dist/components/Quote.js +1 -1
- package/dist/components/Radio.js +1 -1
- package/dist/components/RadioCards.js +1 -1
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/{RadioGroupPrimitive-tlWBfWJ8.js → RadioGroupPrimitive-CcvI-_wm.js} +1 -1
- package/dist/components/ScrollArea.js +1 -1
- package/dist/components/Select.d.ts +3 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Separator.js +1 -1
- package/dist/components/Skeleton.js +1 -1
- package/dist/components/Slider.d.ts +4 -1
- package/dist/components/Slider.js +1 -1
- package/dist/components/Spinner.js +1 -1
- package/dist/components/Splitter.js +1 -1
- package/dist/components/Steps.js +1 -1
- package/dist/components/Strong.js +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/TabNav.js +1 -1
- package/dist/components/Table.js +1 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/Text.js +1 -1
- package/dist/components/TextArea.js +1 -1
- package/dist/components/TextField.d.ts +41 -0
- package/dist/components/TextField.js +1 -0
- package/dist/components/Theme.d.ts +2 -0
- package/dist/components/Theme.js +1 -1
- package/dist/components/Toggle.js +1 -1
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tree.js +1 -1
- package/dist/components/VisuallyHidden.js +1 -1
- package/dist/components/floating-ui.react-Byzse64h.js +5 -0
- package/dist/components/index-BbEsAodL.js +1 -0
- package/dist/components/{index-TYaYKM2M.js → index-DOVR6Rd5.js} +1 -1
- package/dist/components/{index-BZVbVgqN.js → index-DU_6Msfu.js} +1 -1
- package/dist/components/index-Db-tduwt.js +1 -0
- package/dist/components/index-Ir5FYyWW.js +1 -0
- package/dist/components/index-eAZUMNef.js +1 -0
- package/dist/components/{index-BOy86lYu.js → index-gM8bbyw1.js} +1 -1
- package/dist/components/index-m6qHOeQ9.js +1 -0
- package/dist/components/mergeProps-B9ocQsG4.js +1 -0
- package/dist/components/useComponentClass-QwNivz0h.js +1 -0
- package/dist/themes/tailwind-presets/default.js +1 -1
- package/package.json +160 -13
- package/dist/components/ComboboxPrimitive-Ddp_PqU6.js +0 -1
- package/dist/components/MenuPrimitive-BnQil448.js +0 -1
- package/dist/components/floating-ui.react-DMgxgTKq.js +0 -5
- package/dist/components/index-3dZuI04X.js +0 -1
- package/dist/components/index-6If6D2Zi.js +0 -1
- package/dist/components/index-98jQ1vTr.js +0 -1
- package/dist/components/index-B77TeBat.js +0 -1
- package/dist/components/index-DTYJVF-V.js +0 -1
- package/dist/components/index-W6-aam_B.js +0 -1
- package/dist/themes/default.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{forwardRef as t}from"react";import{jsx as n}from"react/jsx-runtime";import{M as o}from"./MenuPrimitive-
|
|
1
|
+
'use client';import e,{forwardRef as t}from"react";import{jsx as n}from"react/jsx-runtime";import{M as o,a as s}from"./MenuPrimitive-wJbEC-gM.js";import{u as r}from"./useComponentClass-QwNivz0h.js";import{c as a}from"./clsx-BaVHROc5.js";import{u}from"./index-wRElCyvx.js";import{u as i}from"./floating-ui.react-Byzse64h.js";import{c as l}from"./index-eAZUMNef.js";import c from"./Separator.js";import"./index-Db-tduwt.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";import"./ThemeContext-Sm-iNANd.js";import"react-dom";const m=e.createContext(null),C="ContextMenu",d=t((({children:e,customRootClass:t,className:s,open:i,defaultOpen:l=!1,onOpenChange:c,variant:d,size:p,...x},h)=>{const[f,g]=u(i,l,c),M=r(t,C);return n(m.Provider,{value:{rootClass:M,setIsOpen:g,variant:d,size:p},children:n(o.Root,{ref:h,className:a(M&&`${M}-root`,s),open:f,onOpenChange:g,...x,children:e})})}));d.displayName=C;const p=t((({children:t,className:r,...u},l)=>{const c=e.useContext(m),C=e.useContext(s),d=e.useRef(null),p=i([d,l]);if(!c)return console.warn("ContextMenuTrigger should be used in the ContextMenuRoot"),null;const{rootClass:x,setIsOpen:h}=c,f=(e,t)=>{C?.refs.setPositionReference({getBoundingClientRect:()=>({width:0,height:0,x:e,y:t,top:t,left:e,right:e,bottom:t,toJSON(){return this}})}),h(!0)};return n(o.Trigger,{className:a(x&&`${x}-trigger`,r),asChild:!0,...u,children:n("span",{ref:p,onContextMenu:e=>{e.preventDefault(),f(e.clientX,e.clientY)},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){if(e.preventDefault(),!d.current)return;const t=d.current.getBoundingClientRect();f(t.left+t.width/2,t.top+t.height/2)}},onClick:e=>{e.preventDefault(),h(!1)},role:"button",tabIndex:0,"aria-haspopup":"menu",children:t})})}));p.displayName="ContextMenuTrigger";const x=t((({children:t,className:s,variant:r,size:u,...i},c)=>{const C=e.useContext(m);if(!C)return console.warn("ContextMenuContent should be used in the ContextMenuRoot"),null;const{rootClass:d}=C,p=r??C.variant,x=u??C.size,h=l("context-menu-content",{variant:p,size:x});return n(o.Content,{ref:c,className:a(d&&`${d}-content`,s),...h,...i,children:t})}));x.displayName="ContextMenuContent";const h=t((({children:t,...s},r)=>{const a=e.useContext(m);if(!a)return console.warn("ContextMenuPortal should be used in the ContextMenuRoot"),null;const{rootClass:u}=a;return n(o.Portal,{ref:r,...s,children:t})}));h.displayName="ContextMenuPortal";const f=t((({children:t,className:s,label:r,...u},i)=>{const l=e.useContext(m);if(!l)return console.warn("ContextMenuItem should be used in the ContextMenuRoot"),null;const{rootClass:c}=l;return n(o.Item,{ref:i,className:a(c&&`${c}-item`,s),label:r,...u,children:t})}));f.displayName="ContextMenuItem";const g=t((({children:t,className:s,...r},u)=>{const i=e.useContext(m);if(!i)return console.warn("ContextMenuSub should be used in the ContextMenuRoot"),null;const{rootClass:l}=i;return n(o.Sub,{ref:u,className:a(l&&`${l}-sub`,s),...r,children:t})}));g.displayName="ContextMenuSub";const M=t((({children:t,className:s,...r},u)=>{const i=e.useContext(m);if(!i)return console.warn("ContextMenuSubTrigger should be used in the ContextMenuRoot"),null;const{rootClass:l}=i;return n(o.Trigger,{ref:u,className:a(l&&`${l}-sub-trigger`,s),...r,children:t})}));M.displayName="ContextMenuSubTrigger";const N=t((({className:t,...o},s)=>{const r=e.useContext(m);if(!r)return console.warn("ContextMenuSeparator should be used within ContextMenuRoot"),null;const{rootClass:a}=r;return n(c,{ref:s,customRootClass:a,className:t,...o})}));N.displayName="ContextMenuSeparator";const b=t(((e,t)=>(console.warn("Direct usage of ContextMenu is not supported. Please use ContextMenu.Root, ContextMenu.Item instead."),null)));b.displayName="ContextMenu",b.Root=d,b.Trigger=p,b.Content=x,b.Portal=h,b.Item=f,b.Sub=g,b.SubTrigger=M,b.Separator=N;export{b as default};
|
|
@@ -3,11 +3,14 @@ import { ComponentPropsWithoutRef } from 'react';
|
|
|
3
3
|
|
|
4
4
|
interface DataListRootProps extends ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
customRootClass?: string;
|
|
6
|
+
size?: string;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
type DataListItemProps = ComponentPropsWithoutRef<'div'>;
|
|
9
10
|
|
|
10
|
-
type DataListLabelProps = ComponentPropsWithoutRef<'dt'
|
|
11
|
+
type DataListLabelProps = ComponentPropsWithoutRef<'dt'> & {
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
11
14
|
|
|
12
15
|
type DataListValueProps = ComponentPropsWithoutRef<'dd'>;
|
|
13
16
|
|
|
@@ -15,7 +18,9 @@ declare const DataList: {
|
|
|
15
18
|
(): null;
|
|
16
19
|
Root: React.ForwardRefExoticComponent<DataListRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
20
|
Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
-
Label: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> &
|
|
21
|
+
Label: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
22
|
+
color?: string;
|
|
23
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
19
24
|
Value: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
20
25
|
};
|
|
21
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import{createContext as a,forwardRef as t,useContext as e}from"react";import{u as o}from"./useComponentClass-QwNivz0h.js";import{c as r,b as l}from"./index-eAZUMNef.js";import{c as i}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const c=a({rootClass:"DataList"}),n=t((({children:a,className:t="",customRootClass:e="",size:l="",...n},m)=>{const d=o(e,"DataList"),u=r("datalist",{size:l});return s(c.Provider,{value:{rootClass:d},children:s("div",{ref:m,className:i(d,t),...u,...n,children:a})})}));n.displayName="DataListRoot";const m=t((({children:a,className:t="",...o},r)=>{const{rootClass:l}=e(c);return s("div",{ref:r,className:i(l&&`${l}-item`,t),...o,children:a})}));m.displayName="DataListItem";const d=t((({children:a,className:t="",color:o="",...r},n)=>{const{rootClass:m}=e(c),d=l(o);return s("dt",{ref:n,className:i(m&&`${m}-label`,t),...d,...r,children:a})}));d.displayName="DataListLabel";const u=t((({children:a,className:t="",...o},r)=>{const{rootClass:l}=e(c);return s("dd",{ref:r,className:i(l&&`${l}-value`,t),...o,children:a})}));u.displayName="DataListValue";const p=()=>(console.warn("Direct usage of DataList is not supported. Please use DataList.Root, DataList.Item, etc. instead."),null);p.Root=n,p.Item=m,p.Label=d,p.Value=u;export{p as default};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import DialogPrimitive from '~/core/primitives/Dialog';
|
|
3
|
+
import * as _floating_ui_react from '@floating-ui/react';
|
|
3
4
|
import Primitive from '~/core/primitives/Primitive';
|
|
4
5
|
|
|
5
6
|
type DialogPrimitiveRootProps$1 = {
|
|
@@ -8,6 +9,8 @@ type DialogPrimitiveRootProps$1 = {
|
|
|
8
9
|
onOpenChange?: (open: boolean) => void;
|
|
9
10
|
onClickOutside?: () => void;
|
|
10
11
|
className?: string;
|
|
12
|
+
/** When true, outside pointer events and escape key will not close the dialog. */
|
|
13
|
+
disablePointerDismissal?: boolean;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
type DialogPrimitiveRootProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
|
|
@@ -50,11 +53,9 @@ type DialogPrimitiveOverlayProps = React.ComponentPropsWithoutRef<typeof DialogP
|
|
|
50
53
|
type DialogOverlayProps = DialogPrimitiveOverlayProps & {
|
|
51
54
|
className?: string;
|
|
52
55
|
};
|
|
53
|
-
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<{
|
|
54
|
-
className?: string;
|
|
56
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & _floating_ui_react.FloatingOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
55
57
|
asChild?: boolean;
|
|
56
58
|
forceMount?: boolean;
|
|
57
|
-
children?: React.ReactNode;
|
|
58
59
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
59
60
|
className?: string;
|
|
60
61
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -81,6 +82,7 @@ type DialogPrimitiveCancelProps = {
|
|
|
81
82
|
children: React.ReactNode;
|
|
82
83
|
asChild?: boolean;
|
|
83
84
|
className?: string;
|
|
85
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
type DialogPrimitiveCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Cancel>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{createContext as s,forwardRef as e,useContext as o}from"react";import{jsx as a}from"react/jsx-runtime";import{D as r}from"./index-
|
|
1
|
+
'use client';import{createContext as s,forwardRef as e,useContext as o}from"react";import{jsx as a}from"react/jsx-runtime";import{D as r}from"./index-BbEsAodL.js";import{c as t}from"./clsx-BaVHROc5.js";import{u as l}from"./useComponentClass-QwNivz0h.js";import{P as i}from"./index-m6qHOeQ9.js";import"./index-Db-tduwt.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-gM8bbyw1.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-B9ocQsG4.js";const n=s({rootClass:""}),c="Dialog",m=e((({children:s,customRootClass:e="",className:o="",...i},m)=>{const d=l(e,c),p={rootClass:d};return a(r.Root,{ref:m,className:t(d,o),...i,children:a(n.Provider,{value:p,children:s})})}));m.displayName=c;const d=e((({children:s,asChild:e,className:l="",...i},c)=>{const{rootClass:m}=o(n);return a(r.Trigger,{ref:c,className:t(m&&`${m}-trigger`,l),asChild:e,...i,children:s})}));d.displayName="DialogTrigger";const p=e((({children:s,...e},o)=>a(r.Portal,{...e,children:s})));p.displayName="DialogPortal";const N=e((({className:s="",...e},l)=>{const{rootClass:i}=o(n);return a(r.Overlay,{ref:l,className:t(i&&`${i}-overlay`,s),...e})}));N.displayName="DialogOverlay";const g=e((({children:s,className:e="",...l},i)=>{const{rootClass:c}=o(n);return a(r.Content,{ref:i,className:t(c&&`${c}-content`,e),...l,children:s})}));g.displayName="DialogContent";const C=e((({children:s,className:e="",...r},l)=>{const{rootClass:c}=o(n);return a(i.h2,{ref:l,className:t(c&&`${c}-title`,e),...r,children:s})}));C.displayName="DialogTitle";const h=e((({children:s,className:e="",...r},l)=>{const{rootClass:c}=o(n);return a(i.p,{ref:l,className:t(c&&`${c}-description`,e),...r,children:s})}));h.displayName="DialogDescription";const u=e((({children:s,asChild:e,className:l="",...i},c)=>{const{rootClass:m}=o(n);return a(r.Cancel,{ref:c,className:t(m&&`${m}-close`,l),asChild:e,...i,children:s})}));u.displayName="DialogClose";const f=e((({children:s,className:e="",...l},i)=>{const{rootClass:c}=o(n);return a(r.Footer,{ref:i,className:t(c&&`${c}-footer`,e),...l,children:s})}));f.displayName="DialogFooter";const D=e(((s,e)=>(console.warn("Direct usage of Dialog is not supported. Please use Dialog.Root, Dialog.Content, etc. instead."),null)));D.displayName="Dialog";const y=D;y.Root=m,y.Trigger=d,y.Portal=p,y.Overlay=N,y.Content=g,y.Title=C,y.Description=h,y.Footer=f,y.Close=u;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{createContext as o,useRef as
|
|
1
|
+
'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{createContext as o,useRef as s,useState as i,useCallback as a,useContext as l,useEffect as n,useId as c}from"react";import{u as d}from"./useComponentClass-QwNivz0h.js";import{c as m}from"./clsx-BaVHROc5.js";import{R as u}from"./index-DOVR6Rd5.js";import{C as p}from"./index-Ir5FYyWW.js";import"./ThemeContext-Sm-iNANd.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";const f=o({}),h=t.forwardRef((({children:r,customRootClass:t,"aria-label":o,...l},n)=>{const c=s(null),p=d(t,"Disclosure"),[h,C]=i(null),g=a((e=>{c.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]);return e(f.Provider,{value:{rootClass:p,activeItem:h,setActiveItem:C,disclosureRef:c},children:e(u.Root,{children:e(u.Group,{className:m(p&&`${p}-root`),children:e("div",{...l,className:m(p&&`${p}-root`),ref:g,role:"region","aria-label":o,"data-testid":"disclosure-root",children:r})})})})}));h.displayName="DisclosureRoot";const C=o({}),g=t.forwardRef((({children:r,className:t="",value:o,...s},a)=>{const{activeItem:d,rootClass:u}=l(f),[h,g]=i(o),[v,N]=i(!1);n((()=>{N(d===h)}),[d,h]);const R=c();return e(C.Provider,{value:{itemValue:h,setItemValue:g},children:e(p.Root,{open:v,onOpenChange:N,asChild:!0,children:e("div",{...s,className:m(u&&`${u}-item`,t),ref:a,"data-state":v?"open":"closed",id:`disclosure-data-item-${R}`,role:"region","aria-labelledby":`disclosure-trigger-${R}`,children:r})})})}));g.displayName="DisclosureItem";const v=t.forwardRef((({children:r,className:t,onClick:o,...s},i)=>{const{activeItem:a,setActiveItem:n,rootClass:c}=l(f),{itemValue:d}=l(C);return e(u.Item,{children:e(p.Trigger,{asChild:!0,children:e("button",{...s,ref:i,type:"button",className:m(c&&`${c}-trigger`,t),onClick:e=>{a===d?n(null):a!==d&&n(d),o&&o(e)},"aria-expanded":a===d,"aria-haspopup":"true",children:r})})})}));v.displayName="DisclosureTrigger";const N=t.forwardRef((({children:r,className:t="",...o},s)=>{const{activeItem:i,rootClass:a}=l(f),{itemValue:n}=l(C);return n!==i?null:e(p.Content,{...o,ref:s,className:m(a&&`${a}-content`,t),role:"region","aria-hidden":i!==n,children:r})}));N.displayName="DisclosureContent";const R=t.forwardRef((({items:t,...o},s)=>e(h,{ref:s,...o,children:t.map(((t,o)=>r(g,{value:o,children:[e(v,{children:t.title}),e(N,{children:t.content})]},o)))})));R.Root=h,R.Item=g,R.Trigger=v,R.Content=N,R.displayName="Disclosure";export{R as default};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DialogPrimitive from '~/core/primitives/Dialog';
|
|
3
|
+
import Primitive from '~/core/primitives/Primitive';
|
|
4
|
+
|
|
5
|
+
type DrawerSnapPoint = number | string;
|
|
6
|
+
type DrawerRootActions = {
|
|
7
|
+
close: () => void;
|
|
8
|
+
unmount: () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type DrawerRootProps = {
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
customRootClass?: string;
|
|
15
|
+
/** Uncontrolled initial open state. */
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
/** Controlled open state. */
|
|
18
|
+
open?: boolean;
|
|
19
|
+
/** Called when the drawer opens or closes. */
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
/** Called after open/close animations fully complete. */
|
|
22
|
+
onOpenChangeComplete?: (open: boolean) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Snap points for the drawer. Use 0–1 for viewport fractions,
|
|
25
|
+
* numbers > 1 for pixel values, or strings like '148px' / '30rem'.
|
|
26
|
+
*/
|
|
27
|
+
snapPoints?: DrawerSnapPoint[];
|
|
28
|
+
/** Initial snap point when uncontrolled. */
|
|
29
|
+
defaultSnapPoint?: DrawerSnapPoint | null;
|
|
30
|
+
/** Controlled active snap point. */
|
|
31
|
+
snapPoint?: DrawerSnapPoint | null;
|
|
32
|
+
/** Called when the active snap point changes. */
|
|
33
|
+
onSnapPointChange?: (snapPoint: DrawerSnapPoint | null) => void;
|
|
34
|
+
/** Disables velocity-based snap skipping; drag distance determines next snap point. */
|
|
35
|
+
snapToSequentialPoints?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Modal mode.
|
|
38
|
+
* - `true` (default): focus trapped, scroll locked, outside pointer events disabled.
|
|
39
|
+
* - `false`: full document interaction allowed.
|
|
40
|
+
* - `'trap-focus'`: focus trapped, but scroll and outside pointer events remain enabled.
|
|
41
|
+
*/
|
|
42
|
+
modal?: boolean | 'trap-focus';
|
|
43
|
+
/** When true, clicking outside the drawer does not close it. */
|
|
44
|
+
disablePointerDismissal?: boolean;
|
|
45
|
+
/** Direction the user swipes to dismiss the drawer. */
|
|
46
|
+
swipeDirection?: 'left' | 'right' | 'top' | 'bottom';
|
|
47
|
+
/** ID of the trigger associated with this drawer (controlled). */
|
|
48
|
+
triggerId?: string | null;
|
|
49
|
+
/** ID of the trigger associated with this drawer (uncontrolled / defaultOpen). */
|
|
50
|
+
defaultTriggerId?: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Ref to imperative actions.
|
|
53
|
+
* - `close()`: closes the drawer programmatically.
|
|
54
|
+
* - `unmount()`: when provided, the drawer will not unmount automatically on close;
|
|
55
|
+
* call this to unmount it manually (useful for externally-controlled animations).
|
|
56
|
+
*/
|
|
57
|
+
actionsRef?: React.RefObject<DrawerRootActions | null>;
|
|
58
|
+
};
|
|
59
|
+
declare const DrawerRoot: React.ForwardRefExoticComponent<DrawerRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
|
|
61
|
+
type DialogPrimitiveTriggerProps$1 = {
|
|
62
|
+
children: React.ReactNode;
|
|
63
|
+
asChild?: boolean;
|
|
64
|
+
className?: string;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type DialogPrimitiveTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
|
|
69
|
+
type DrawerTriggerProps = DialogPrimitiveTriggerProps & {
|
|
70
|
+
className?: string;
|
|
71
|
+
};
|
|
72
|
+
declare const DrawerTrigger: React.ForwardRefExoticComponent<Omit<DialogPrimitiveTriggerProps$1 & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
73
|
+
className?: string;
|
|
74
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
75
|
+
|
|
76
|
+
type DialogPrimitivePortalProps$1 = {
|
|
77
|
+
children: React.ReactNode;
|
|
78
|
+
container?: Element | null;
|
|
79
|
+
forceMount?: boolean;
|
|
80
|
+
keepMounted?: boolean;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type DialogPrimitivePortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
|
|
84
|
+
type DrawerPortalProps = DialogPrimitivePortalProps;
|
|
85
|
+
declare const DrawerPortal: React.ForwardRefExoticComponent<DialogPrimitivePortalProps$1 & React.RefAttributes<HTMLDivElement>>;
|
|
86
|
+
|
|
87
|
+
type DrawerOverlayProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
88
|
+
className?: string;
|
|
89
|
+
forceMount?: boolean;
|
|
90
|
+
};
|
|
91
|
+
declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
92
|
+
className?: string;
|
|
93
|
+
forceMount?: boolean;
|
|
94
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
95
|
+
|
|
96
|
+
type DrawerContentProps = React.ComponentPropsWithoutRef<typeof Primitive.div> & {
|
|
97
|
+
className?: string;
|
|
98
|
+
asChild?: boolean;
|
|
99
|
+
forceMount?: boolean;
|
|
100
|
+
};
|
|
101
|
+
declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLElement>>;
|
|
102
|
+
|
|
103
|
+
type PrimitiveHeadingProps = React.ComponentPropsWithoutRef<typeof Primitive.h2>;
|
|
104
|
+
type DrawerTitleProps = PrimitiveHeadingProps & {
|
|
105
|
+
className?: string;
|
|
106
|
+
};
|
|
107
|
+
declare const DrawerTitle: React.ForwardRefExoticComponent<DrawerTitleProps & React.RefAttributes<HTMLElement>>;
|
|
108
|
+
|
|
109
|
+
type PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;
|
|
110
|
+
type DrawerDescriptionProps = PrimitiveParagraphProps & {
|
|
111
|
+
className?: string;
|
|
112
|
+
};
|
|
113
|
+
declare const DrawerDescription: React.ForwardRefExoticComponent<DrawerDescriptionProps & React.RefAttributes<HTMLElement>>;
|
|
114
|
+
|
|
115
|
+
type DialogPrimitiveCancelProps$1 = {
|
|
116
|
+
children: React.ReactNode;
|
|
117
|
+
asChild?: boolean;
|
|
118
|
+
className?: string;
|
|
119
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
type DialogPrimitiveCancelProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Cancel>;
|
|
123
|
+
type DrawerCloseProps = DialogPrimitiveCancelProps & {
|
|
124
|
+
className?: string;
|
|
125
|
+
};
|
|
126
|
+
declare const DrawerClose: React.ForwardRefExoticComponent<Omit<DialogPrimitiveCancelProps$1 & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
127
|
+
className?: string;
|
|
128
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
129
|
+
|
|
130
|
+
type DrawerHandleProps = {
|
|
131
|
+
className?: string;
|
|
132
|
+
/** Distance in px the user must drag outward before the drawer closes. Default: 80 */
|
|
133
|
+
closeThreshold?: number;
|
|
134
|
+
};
|
|
135
|
+
declare const DrawerHandle: React.ForwardRefExoticComponent<DrawerHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
136
|
+
|
|
137
|
+
type DrawerElement = React.ElementRef<'div'>;
|
|
138
|
+
type DrawerProps = React.ComponentPropsWithoutRef<'div'>;
|
|
139
|
+
interface DrawerComponent extends React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<DrawerElement>> {
|
|
140
|
+
Root: typeof DrawerRoot;
|
|
141
|
+
Trigger: typeof DrawerTrigger;
|
|
142
|
+
Portal: typeof DrawerPortal;
|
|
143
|
+
Overlay: typeof DrawerOverlay;
|
|
144
|
+
Content: typeof DrawerContent;
|
|
145
|
+
Title: typeof DrawerTitle;
|
|
146
|
+
Description: typeof DrawerDescription;
|
|
147
|
+
Close: typeof DrawerClose;
|
|
148
|
+
Handle: typeof DrawerHandle;
|
|
149
|
+
}
|
|
150
|
+
declare const Drawer: DrawerComponent;
|
|
151
|
+
|
|
152
|
+
export { Drawer as default };
|
|
153
|
+
export type { DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerHandleProps, DrawerOverlayProps, DrawerPortalProps, DrawerRootActions, DrawerRootProps, DrawerSnapPoint, DrawerTitleProps, DrawerTriggerProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import e,{createContext as t,useContext as r,forwardRef as n,useState as a,useRef as s,useEffect as o,useCallback as i}from"react";import{jsx as l,jsxs as c}from"react/jsx-runtime";import{c as d}from"./clsx-BaVHROc5.js";import{u}from"./useComponentClass-QwNivz0h.js";import{D as m,a as p}from"./index-BbEsAodL.js";import{F as h}from"./index-Db-tduwt.js";import{P as C}from"./index-m6qHOeQ9.js";import"./ThemeContext-Sm-iNANd.js";import"./index-gM8bbyw1.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./mergeProps-B9ocQsG4.js";const f=t({rootClass:"",swipeDirection:"right",snapPoints:[],activeSnapPoint:null,setActiveSnapPoint:()=>{},modal:!0,disablePointerDismissal:!1,onOpenChangeComplete:void 0,registerActions:()=>{},markIntentionalClose:()=>{},childOpenCount:0}),g=t({depth:0,onChildOpenChange:()=>{}});const y="Drawer",b=n((({children:e,customRootClass:t="",className:n="",defaultOpen:c=!1,open:p,onOpenChange:h,onOpenChangeComplete:C,snapPoints:b=[],defaultSnapPoint:v=null,snapPoint:D,onSnapPointChange:N,snapToSequentialPoints:P=!1,modal:w=!0,disablePointerDismissal:O=!1,swipeDirection:k="right",triggerId:x,defaultTriggerId:T,actionsRef:$},j)=>{const F=u(t,y),I=r(g),A=void 0!==p,[S,X]=a(c),Y=A?p:S,M=s(!1),E=s(O);o((()=>{E.current=O}),[O]);const R=i((e=>{(e||!E.current||M.current)&&(M.current=!1,A||X(e),h?.(e))}),[A,h]),q=void 0!==D,[H,L]=a(v??(b.length>0?b[0]:null)),V=q?D:H,z=i((e=>{q||L(e),N?.(e)}),[q,N]),K=i((e=>{$&&"current"in $&&($.current=e)}),[$]);o((()=>{if(!$)return;K({close:()=>{M.current=!0,R(!1)},unmount:()=>{M.current=!0,R(!1)}})}),[$,R,K]);const U=s(!1);o((()=>{Y&&!U.current?(U.current=!0,I.onChildOpenChange(!0)):!Y&&U.current&&(U.current=!1,I.onChildOpenChange(!1))}),[Y,I]),o((()=>()=>{U.current&&(I.onChildOpenChange(!1),U.current=!1)}),[]);const[B,G]=a(0),J=i((e=>{G((t=>Math.max(0,t+(e?1:-1)))),I.onChildOpenChange(e)}),[I]),Q={depth:I.depth+1,onChildOpenChange:J},W={rootClass:F,swipeDirection:k,isOpen:Y,onOpen:()=>R(!0),snapPoints:b,activeSnapPoint:V,setActiveSnapPoint:z,modal:w,disablePointerDismissal:O,onOpenChangeComplete:C,registerActions:K,markIntentionalClose:()=>{M.current=!0},childOpenCount:B};return l(g.Provider,{value:Q,children:l(m.Root,{ref:j,open:Y,onOpenChange:R,className:d(F,n),disablePointerDismissal:O,children:l(f.Provider,{value:W,children:e})})})}));b.displayName=y;const v=n((({children:e,asChild:t,className:n="",...a},s)=>{const{rootClass:o}=r(f);return l(m.Trigger,{ref:s,className:d(o&&`${o}-trigger`,n),asChild:t,...a,children:e})}));v.displayName="DrawerTrigger";const D=n((({children:e,...t},r)=>l(m.Portal,{...t,children:e})));D.displayName="DrawerPortal";const N=n((({className:e="",forceMount:t=!1,...n},i)=>{const{rootClass:c,modal:u,disablePointerDismissal:m,onOpenChangeComplete:C,markIntentionalClose:g}=r(f),{isOpen:y,handleOverlayClick:b}=r(p),[v,D]=a(y),[N,P]=a(y?"open":"closed"),w=s(null);if(o((()=>(w.current&&clearTimeout(w.current),y?(D(!0),requestAnimationFrame((()=>{requestAnimationFrame((()=>P("open")))}))):(P("closed"),w.current=setTimeout((()=>{D(!1),C?.(!1)}),400)),()=>{w.current&&clearTimeout(w.current)})),[y,C]),!v&&!t)return null;const O=m?void 0:()=>{g(),b()},k=!0===u;return l(h.Overlay,{lockScroll:y&&k,ref:i,onClick:O,"data-state":N,style:!1===u?{pointerEvents:"none",background:"transparent"}:void 0,className:d(c&&`${c}-overlay`,e),...n})}));N.displayName="DrawerOverlay";const P=n((({children:t,className:n="",asChild:i=!1,forceMount:u=!1,role:m="dialog","aria-modal":g,"aria-labelledby":y,"aria-describedby":b,style:v,...D},N)=>{const{rootClass:P,swipeDirection:w,modal:O,onOpenChangeComplete:k,childOpenCount:x}=r(f),{isOpen:T,getFloatingProps:$,refs:j,floaterContext:F}=r(p),I=g??!1!==O,[A,S]=a(T),[X,Y]=a(T?"open":"closed"),M=s(null),E=s(null);o((()=>(M.current&&clearTimeout(M.current),E.current&&clearTimeout(E.current),T?(S(!0),requestAnimationFrame((()=>{requestAnimationFrame((()=>{Y("open"),E.current=setTimeout((()=>k?.(!0)),400)}))}))):(Y("closed"),M.current=setTimeout((()=>{S(!1)}),400)),()=>{M.current&&clearTimeout(M.current),E.current&&clearTimeout(E.current)})),[T,k]);const R=h.useMergeRefs([j.setFloating,N]),{style:q,...H}=$()??{};if(!A&&!u)return null;const L=!1!==O,V=20*x,z=V>0?{"--drawer-peek-offset":`${V}px`}:{};return l(h.FocusManager,{context:F,modal:L,initialFocus:0,returnFocus:!0,children:c(C.div,{ref:R,asChild:i,...H,style:{outline:"none",...z,...v},role:m,"aria-modal":I,"aria-hidden":T?void 0:"true","aria-labelledby":T?y:void 0,"aria-describedby":T?b:void 0,"data-state":X,"data-swipe-direction":w,"data-child-open":x>0?"true":void 0,className:d(P&&`${P}-content`,n),...D,children:[e.Children.map(t,(t=>e.isValidElement(t)&&"DrawerHandle"===t.type?.displayName?t:null)),l("div",{className:d(P&&`${P}-content-inner`),children:e.Children.map(t,(t=>e.isValidElement(t)&&"DrawerHandle"===t.type?.displayName?null:t))})]})})}));P.displayName="DrawerContent";const w=n((({children:e,className:t="",...n},a)=>{const{rootClass:s}=r(f);return l(C.h2,{ref:a,className:d(s&&`${s}-title`,t),...n,children:e})}));w.displayName="DrawerTitle";const O=n((({children:e,className:t="",...n},a)=>{const{rootClass:s}=r(f);return l(C.p,{ref:a,className:d(s&&`${s}-description`,t),...n,children:e})}));O.displayName="DrawerDescription";const k=n((({children:e,asChild:t,className:n="",onClick:a,...s},o)=>{const{rootClass:i,markIntentionalClose:c}=r(f);return l(m.Cancel,{ref:o,className:d(i&&`${i}-close`,n),asChild:t,onClick:e=>{c(),a?.(e)},...s,children:e})}));k.displayName="DrawerClose";const x=n((({className:e="",closeThreshold:t=80},n)=>{const{rootClass:c,swipeDirection:u,markIntentionalClose:m}=r(f),{handleOpenChange:h,refs:C}=r(p),g=s(null),y=s(0),[b,v]=a(!1),D=i((()=>C.floating?.current??null),[C]),N=i((e=>{const t=D();if(t)switch(u){case"right":t.style.transform=`translateX(${e}px)`;break;case"left":t.style.transform=`translateX(${-e}px)`;break;case"bottom":t.style.transform=`translateY(${e}px)`;break;case"top":t.style.transform=`translateY(${-e}px)`}}),[u,D]),P=i((e=>{const t=D();if(!t)return;const r=.2*e;switch(u){case"right":t.style.transform=`translateX(${-r}px)`;break;case"left":t.style.transform=`translateX(${r}px)`;break;case"bottom":t.style.transform=`translateY(${-r}px)`;break;case"top":t.style.transform=`translateY(${r}px)`}}),[u,D]),w=i((()=>{const e=D();if(!e)return;y.current=0,v(!0),e.style.transition="transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1)",e.style.transform="";const t=()=>{e.style.transition="",e.removeEventListener("transitionend",t),v(!1)};e.addEventListener("transitionend",t)}),[D]),O=i((e=>{if(0!==e.button)return;e.currentTarget.setPointerCapture(e.pointerId),g.current={startX:e.clientX,startY:e.clientY},y.current=0,v(!1);const t=D();t&&(t.style.transition="none")}),[D]),k=i((e=>{if(!g.current)return;const t=e.clientX-g.current.startX,r=e.clientY-g.current.startY;let n;switch(u){case"right":n=t;break;case"left":n=-t;break;case"bottom":n=r;break;case"top":n=-r}n>=0?(y.current=n,N(n)):(y.current=0,P(Math.abs(n)))}),[u,N,P]),x=i((()=>{if(g.current)if(g.current=null,y.current>=t){m();const e=D();e&&(e.style.transition="",e.style.transform=""),h(!1)}else w()}),[t,m,h,w,D]),T=i((()=>{g.current&&(g.current=null,y.current=0,w())}),[w]);return o((()=>()=>{const e=D();e&&(e.style.transition="",e.style.transform="")}),[D]),l("div",{ref:n,role:"button","aria-label":"Drag to close drawer",tabIndex:0,onPointerDown:O,onPointerMove:k,onPointerUp:x,onPointerCancel:T,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),m(),h(!1))},"data-direction":u,"data-snapping":b?"true":void 0,className:d(c&&`${c}-handle`,e),children:l("div",{className:`${c}-handle-grip`,"aria-hidden":"true"})})}));x.displayName="DrawerHandle";const T=n(((e,t)=>(console.warn("Direct usage of Drawer is not supported. Please use Drawer.Root, Drawer.Content, etc. instead."),null)));T.displayName="Drawer";const $=T;$.Root=b,$.Trigger=v,$.Portal=D,$.Overlay=N,$.Content=P,$.Title=w,$.Description=O,$.Close=k,$.Handle=x;export{$ as default};
|
|
@@ -20,6 +20,8 @@ declare const DropdownMenuRoot: React.ForwardRefExoticComponent<{
|
|
|
20
20
|
defaultOpen?: boolean;
|
|
21
21
|
crossAxisOffset?: number;
|
|
22
22
|
mainAxisOffset?: number;
|
|
23
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
24
|
+
collisionPadding?: number;
|
|
23
25
|
loop?: boolean;
|
|
24
26
|
placement?: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
|
25
27
|
avoidCollision?: boolean;
|
|
@@ -105,6 +107,8 @@ declare const DropdownMenuSub: React.ForwardRefExoticComponent<{
|
|
|
105
107
|
defaultOpen?: boolean;
|
|
106
108
|
crossAxisOffset?: number;
|
|
107
109
|
mainAxisOffset?: number;
|
|
110
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
111
|
+
collisionPadding?: number;
|
|
108
112
|
loop?: boolean;
|
|
109
113
|
placement?: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
|
110
114
|
avoidCollision?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import o,{forwardRef as e}from"react";import{jsx as n}from"react/jsx-runtime";import{M as r}from"./MenuPrimitive-
|
|
1
|
+
'use client';import o,{forwardRef as e}from"react";import{jsx as n}from"react/jsx-runtime";import{M as r}from"./MenuPrimitive-wJbEC-gM.js";import{u as t}from"./useComponentClass-QwNivz0h.js";import{c as s}from"./clsx-BaVHROc5.js";import a from"./Separator.js";import"./index-Db-tduwt.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-wRElCyvx.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";import"./ThemeContext-Sm-iNANd.js";const l=o.createContext(null),u="DropdownMenu",i=e((({children:o,customRootClass:e,className:a,...i},d)=>{const c=t(e,u);return n(l.Provider,{value:{rootClass:c},children:n(r.Root,{ref:d,className:s(c&&`${c}-root`,a),...i,children:o})})}));i.displayName=u;const d=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuTrigger should be used in the DropdownMenuRoot"),null;const{rootClass:d}=i;return n(r.Trigger,{ref:u,className:s(d&&`${d}-trigger`,t),...a,children:e})}));d.displayName="DropdownMenuTrigger";const c=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuContent should be used in the DropdownMenuRoot"),null;const{rootClass:d}=i;return n(r.Content,{ref:u,className:s(d&&`${d}-content`,t),...a,children:e})}));c.displayName="DropdownMenuContent";const p=e((({children:e,...t},s)=>{const a=o.useContext(l);if(!a)return console.warn("DropdownMenuPortal should be used in the DropdownMenuRoot"),null;const{rootClass:u}=a;return n(r.Portal,{ref:s,...t,children:e})}));p.displayName="DropdownMenuPortal";const m=e((({children:e,className:t,label:a,...u},i)=>{const d=o.useContext(l);if(!d)return console.warn("DropdownMenuItem should be used in the DropdownMenuRoot"),null;const{rootClass:c}=d;return n(r.Item,{ref:i,className:s(c&&`${c}-item`,t),label:a,...u,children:e})}));m.displayName="DropdownMenuItem";const w=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuSub should be used in the DropdownMenuRoot"),null;const{rootClass:d}=i;return n(r.Sub,{ref:u,className:s(d&&`${d}-sub`,t),...a,children:e})}));w.displayName="DropdownMenuSub";const h=e((({children:e,className:t,...a},u)=>{const i=o.useContext(l);if(!i)return console.warn("DropdownMenuSubTrigger should be used in the DropdownMenuRoot"),null;const{rootClass:d}=i;return n(r.Trigger,{ref:u,className:s(d&&`${d}-sub-trigger`,t),...a,children:e})}));h.displayName="DropdownMenuSubTrigger";const M=e((({className:e,...r},t)=>{const s=o.useContext(l);if(!s)return console.warn("DropdownMenuSeparator should be used within DropdownMenuRoot"),null;const{rootClass:u}=s;return n(a,{ref:t,customRootClass:u,className:e,...r})}));M.displayName="DropdownMenuSeparator";const D=e(((o,e)=>(console.warn("Direct usage of DropdownMenu is not supported. Please use DropdownMenu.Root, DropdownMenu.Item instead."),null)));D.displayName="DropdownMenu",D.Root=i,D.Trigger=d,D.Content=c,D.Portal=p,D.Item=m,D.Sub=w,D.SubTrigger=h,D.Separator=M;export{D as default};
|
package/dist/components/Em.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import r from"react";import{u as e}from"./useComponentClass-QwNivz0h.js";import{c as m}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const o=r.forwardRef((({children:r,customRootClass:o,className:t,...a},c)=>{const i=e(o,"Em");return s("em",{ref:c,className:m(i,t),...a,children:r})}));o.displayName="Em";export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import s from"react";import{c as e}from"./clsx-BaVHROc5.js";import{
|
|
1
|
+
'use client';import s from"react";import{c as e}from"./clsx-BaVHROc5.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import"./ThemeContext-Sm-iNANd.js";const o=s.forwardRef((({children:o,as:t="h1",customRootClass:r="",className:m="",...c},h)=>{const l=a(r,t),n=["h1","h2","h3","h4","h5","h6"].includes(t)?t:"h1";return s.createElement(n,{className:e(l,m),ref:h,...c},o)}));o.displayName="Heading";export{o as default};
|
|
@@ -9,6 +9,8 @@ type HoverCardRootProps = ComponentPropsWithoutRef<'div'> & {
|
|
|
9
9
|
customRootClass?: string;
|
|
10
10
|
openDelay?: number;
|
|
11
11
|
closeDelay?: number;
|
|
12
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
13
|
+
collisionPadding?: number;
|
|
12
14
|
};
|
|
13
15
|
declare const HoverCardRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
16
|
open?: boolean;
|
|
@@ -16,6 +18,8 @@ declare const HoverCardRoot: React.ForwardRefExoticComponent<Omit<React.Detailed
|
|
|
16
18
|
customRootClass?: string;
|
|
17
19
|
openDelay?: number;
|
|
18
20
|
closeDelay?: number;
|
|
21
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
22
|
+
collisionPadding?: number;
|
|
19
23
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
20
24
|
|
|
21
25
|
type HoverCardTriggerProps = ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
@@ -28,8 +32,12 @@ declare const HoverCardPortal: React.ForwardRefExoticComponent<_floating_ui_reac
|
|
|
28
32
|
rootElement?: HTMLElement | React.MutableRefObject<HTMLElement | null>;
|
|
29
33
|
} & React.RefAttributes<never>>;
|
|
30
34
|
|
|
31
|
-
type HoverCardContentProps = ComponentPropsWithoutRef<'div'
|
|
32
|
-
|
|
35
|
+
type HoverCardContentProps = ComponentPropsWithoutRef<'div'> & {
|
|
36
|
+
size?: string;
|
|
37
|
+
};
|
|
38
|
+
declare const HoverCardContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
39
|
+
size?: string;
|
|
40
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
33
41
|
|
|
34
42
|
type HoverCardArrowProps = Omit<ComponentPropsWithoutRef<typeof Floater.Arrow>, 'context'>;
|
|
35
43
|
declare const HoverCardArrow: React.ForwardRefExoticComponent<HoverCardArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{createContext as e,forwardRef as r,useRef as o,useState as t,useEffect as
|
|
1
|
+
'use client';import{createContext as e,forwardRef as r,useRef as o,useState as t,useEffect as n,useContext as s}from"react";import{jsx as a}from"react/jsx-runtime";import{F as l}from"./index-Db-tduwt.js";import{u as i}from"./useComponentClass-QwNivz0h.js";import{u as c}from"./index-wRElCyvx.js";import{c as u}from"./clsx-BaVHROc5.js";import{P as d}from"./index-m6qHOeQ9.js";import{T as m}from"./ThemeContext-Sm-iNANd.js";import{c as f}from"./index-eAZUMNef.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./mergeProps-B9ocQsG4.js";const g=e({}),p="HoverCard",y=r((({children:e,open:r,onOpenChange:s,customRootClass:d="",className:m="",openDelay:f=100,closeDelay:y=200,collisionBoundary:C=null,collisionPadding:h=4,...v},R)=>{const P=i(d,p),w=i(d,`${p}-trigger`),x=o(null),N=(Array.isArray(C)?C:[C]).filter((e=>null!=e)),T={padding:h,boundary:N,altBoundary:N.length>0},{refs:D,floatingStyles:j,context:H}=l.useFloating({placement:"bottom",strategy:"fixed",middleware:[l.arrow({element:x}),l.offset(10),l.flip({mainAxis:!0,...T}),l.shift({...T})],whileElementsMounted:l.autoUpdate}),[W,E]=c(r,!1,s),[A,F]=t(!1),M=o(null),S=o(null),L=e=>{E(e)},O=l.useRole(H),b=l.useDismiss(H),B=l.useHover(H,{delay:100}),{getReferenceProps:$,getFloatingProps:q}=l.useInteractions([B,O,b]);n((()=>()=>{M.current&&clearTimeout(M.current),S.current&&clearTimeout(S.current)}),[]);const z={isOpen:W,handleOpenChange:L,floatingRefs:D,floatingStyles:j,floatingContext:H,arrowRef:x,getReferenceProps:$,getFloatingProps:q,rootClass:P,rootTriggerClass:w,closeWithDelay:()=>{F(!0),S.current&&clearTimeout(S.current),S.current=setTimeout((()=>{F((e=>(e&&L(!1),e)))}),y)},closeWithoutDelay:()=>{L(!1)},openWithDelay:()=>{F(!1),M.current&&clearTimeout(M.current),M.current=setTimeout((()=>{L(!0)}),f)}};return a(g.Provider,{value:z,children:a("div",{ref:R,className:u(P&&`${P}-root`,m),...v,children:e})})}));y.displayName=p;const C=r((({children:e,className:r="",...o},t)=>{const{floatingRefs:n,closeWithDelay:i,openWithDelay:c,rootTriggerClass:m}=s(g),f=l.useMergeRefs([n.setReference,t]);return a(d.span,{className:u(m,r),onClick:()=>{},onMouseEnter:c,onMouseLeave:i,ref:f,...o,children:e})}));C.displayName="HoverCardTrigger";const h=r((({children:e,rootElement:r,...o},i)=>{const{rootTriggerClass:c}=s(g),u=s(m),[d,f]=t(null);return n((()=>{const e=(r&&"current"in r?r.current:r)||u?.portalRootRef.current||u?.containerRef.current||document.querySelector("[data-rad-ui-portal-root]")||document.querySelector("#rad-ui-theme-container")||document.getElementsByClassName(c)[0]||document.body;f(e)}),[r,c,u]),d?a(l.Portal,{root:d,...o,children:e}):null}));h.displayName="HoverCardPortal";const v=r((({children:e,className:r,size:o="",...t},i)=>{const{isOpen:c,floatingRefs:d,floatingStyles:m,getFloatingProps:p,rootClass:y,closeWithDelay:C,closeWithoutDelay:h,openWithDelay:v}=s(g);n((()=>{const e=()=>h();return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[h]);const R=l.useMergeRefs([d.setFloating,i]),P=f("hover-card",{size:o});return c?a("div",{onPointerEnter:v,onPointerLeave:C,className:u(y,r),ref:R,style:m,...P,...t,...p(),children:e}):null}));v.displayName="HoverCardContent";const R=r(((e,r)=>{const{floatingContext:o,arrowRef:t,rootClass:n}=s(g),i=l.useMergeRefs([t,r]);return a(l.Arrow,{className:u(n&&`${n}-arrow`),...e,context:o,ref:i})}));R.displayName="HoverCardArrow";const P=r(((e,r)=>(console.warn("Direct usage of HoverCard is not supported. Please use HoverCard.Root, HoverCard.Trigger, etc. instead."),null)));P.displayName="HoverCard",P.Root=y,P.Trigger=C,P.Portal=h,P.Content=v,P.Arrow=R;export{P as default};
|
package/dist/components/Kbd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as s}from"react/jsx-runtime";import{forwardRef as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import{forwardRef as e}from"react";import{u as o}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./clsx-BaVHROc5.js";import{c as t}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const m=e((({children:e,customRootClass:m,className:a,size:i="",...c},n)=>{const d=o(m,"Kbd"),l=t("kbd",{size:i});return s("kbd",{ref:n,className:r(d,a),...l,...c,children:e})}));m.displayName="Kbd";export{m as default};
|
package/dist/components/Link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as s}from"react/jsx-runtime";import r from"react";import{c as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import r from"react";import{c as o}from"./clsx-BaVHROc5.js";import{u as e}from"./useComponentClass-QwNivz0h.js";import{a,b as m,c as t}from"./index-eAZUMNef.js";import{P as i}from"./index-m6qHOeQ9.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-B9ocQsG4.js";const c="Link",f=r.forwardRef((({children:r,href:f="#",customRootClass:l,className:n,size:p="",color:d="",asChild:h=!1,...j},u)=>{const x=e(l,c),C=a(t("link",{size:p}),m(d)),N=i.a;return s(N,{ref:u,asChild:h,href:f,className:o(x,n),...C,...j,children:r})}));f.displayName=c;export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import{jsx as e,Fragment as n}from"react/jsx-runtime";import t,{forwardRef as i,useState as s,useRef as l,useContext as o,useEffect as a}from"react";import{F as r}from"./index-Db-tduwt.js";import{u as d}from"./index-wRElCyvx.js";import{P as c}from"./index-m6qHOeQ9.js";import{B as u}from"./index-gM8bbyw1.js";const f=t.createContext(null),m=i((({children:n,className:i,open:o,onOpenChange:a,defaultOpen:c=!1,crossAxisOffset:u,mainAxisOffset:m,collisionBoundary:p=null,collisionPadding:g=4,loop:h=!0,placement:v="bottom-start",avoidCollision:x=!0,rtl:P=!1,...y},N)=>{const[I,b]=d(o,c,a),[C,O]=s(null),[R,F]=s(void 0),M=l([]),A=l([]),k=l([]),S=l(null),T=r.useFloatingNodeId(),j=r.useFloatingParentNodeId(),w=null!=j,B=u??0,H=void 0!==m?m:w?14:4,L=(Array.isArray(p)?p:[p]).filter((e=>null!=e)),E=L.length>0?{boundary:L,altBoundary:!0}:{},D={mainAxis:x,crossAxis:x&&!w,padding:g,...E},q={padding:g,crossAxis:!w,...E},z={padding:g,...E},{refs:U,floatingStyles:X,context:Y}=r.useFloating({open:I,nodeId:T,onOpenChange:b,strategy:"fixed",transform:!1,placement:w?"right-start":v,middleware:[r.offset({mainAxis:H,crossAxis:B}),...x?[r.flip(D),r.shift(q)]:[],...w?[]:[r.size({...z,apply({availableHeight:e,elements:n}){F(e),n.floating.style.maxHeight=`${e}px`}})]],whileElementsMounted:r.autoUpdate}),$=r.useListNavigation(Y,{listRef:A,activeIndex:C,nested:w,rtl:P,loop:h,onNavigate:O}),G=r.useClick(Y,{}),J=r.useHover(Y,{enabled:w,delay:{open:75},handleClose:r.safePolygon({blockPointerEvents:!0})}),K=r.useDismiss(Y,{bubbles:!0}),Q=r.useTypeahead(Y,{listRef:k,onMatch:I?O:void 0,activeIndex:C}),{getReferenceProps:V,getFloatingProps:W,getItemProps:Z}=r.useInteractions([K,G,$,J,Q]),_={isOpen:I,setIsOpen:b,refs:U,floatingStyles:X,maxHeight:R,getReferenceProps:V,getFloatingProps:W,getItemProps:Z,activeIndex:C,setActiveIndex:O,listRef:M,elementsRef:A,labelsRef:k,virtualItemRef:S,nodeId:T,isNested:w,floatingContext:Y,rtl:P},ee=r.useFloatingTree();return t.useEffect((()=>{if(ee)return ee.events.on("click",e),()=>{ee.events.off("click",e)};function e(){b(!1)}}),[ee,T,j]),e("div",{ref:N,className:i,"data-tree":"true",...y,children:e(f.Provider,{value:_,children:e(r.FloatingNode,{id:T,children:n})})})}));m.displayName="MenuComponentRoot";const p=i((({children:n,className:t,open:i,onOpenChange:s,defaultOpen:l=!1,crossAxisOffset:o,mainAxisOffset:a,collisionBoundary:d,collisionPadding:c,...u},f)=>e(r.FloatingTree,{children:e(m,{ref:f,className:t,open:i,onOpenChange:s,defaultOpen:l,crossAxisOffset:o,mainAxisOffset:a,collisionBoundary:d,collisionPadding:c,...u,children:n})})));p.displayName="MenuPrimitiveRoot";const g=i((({children:n,className:i,label:s,disabled:l,asChild:o=!1,onSelect:a,...d},u)=>{const m=t.useContext(f),p=l?null:s,{ref:g,index:h}=r.useListItem({label:p}),v=r.useFloatingTree(),x=t.useCallback((e=>{"function"==typeof g?g(e):g&&(g.current=e),"function"==typeof u?u(e):u&&(u.current=e)}),[g,u]);if(!m)return null;const{activeIndex:P,getItemProps:y}=m,N=P===h;return e(c.button,{ref:x,tabIndex:N?0:-1,className:i,...y({onClick(e){l||(a?a(e):v?.events.emit("click"))}}),disabled:l,asChild:o,...d,children:n})}));g.displayName="MenuPrimitiveItem";const h=i((({children:n,className:t,asChild:i,...s},l)=>{const a=o(f),{ref:d,index:c}=r.useListItem(),m=r.useMergeRefs([a?.refs.setReference,d,l]);if(!a)return null;const{activeIndex:p,getReferenceProps:g,isNested:h}=a;return e(u,{className:t,tabIndex:h?p===c?0:-1:void 0,ref:m,...g(),asChild:i,...s,children:n})}));h.displayName="MenuPrimitiveTrigger";const v=i((({children:t,className:i,...s},l)=>{const a=o(f),d=r.useMergeRefs([a?.refs.setFloating,l]);if(!a||!a.isOpen)return null;const{floatingStyles:c,getFloatingProps:u,elementsRef:m,labelsRef:p,isNested:g,floatingContext:h}=a;return e(n,{children:e(r.FloatingList,{elementsRef:m,labelsRef:p,children:e(r.FocusManager,{context:h,modal:!1,initialFocus:g?-1:0,returnFocus:!g,children:e("div",{ref:d,style:c,...u(),className:i,...s,children:e("div",{style:{overflowY:"auto",overflowX:"hidden"},children:t})})})})})}));v.displayName="MenuPrimitiveContent";const x=i((({children:n,className:t,open:i,onOpenChange:s,defaultOpen:l=!1,...a},r)=>{const d=o(f);return e(m,{ref:r,className:t,open:i,onOpenChange:s,defaultOpen:l,rtl:d&&d.rtl||!1,...a,children:n})}));x.displayName="MenuPrimitiveSub";const P=i((({children:n,...t},i)=>{const l=o(f),[d,c]=s(!1),u=document.querySelector("#rad-ui-theme-container")||document.body;if(a((()=>{u&&c(!0)}),[u]),!l)return null;const{isOpen:m}=l;return m&&d?e(r.Portal,{root:u,...t,children:e("div",{ref:i,children:n})}):null}));P.displayName="MenuPrimitivePortal";const y=()=>(console.warn("Direct usage of MenuPrimitive is not supported. Please use MenuPrimitive.Root, MenuPrimitive.Item instead."),null);y.Root=p,y.Item=g,y.Trigger=h,y.Content=v,y.Sub=x,y.Portal=P;export{y as M,f as a};
|
|
@@ -97,6 +97,8 @@ declare const Menubar: {
|
|
|
97
97
|
defaultOpen?: boolean;
|
|
98
98
|
crossAxisOffset?: number;
|
|
99
99
|
mainAxisOffset?: number;
|
|
100
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
101
|
+
collisionPadding?: number;
|
|
100
102
|
loop?: boolean;
|
|
101
103
|
placement?: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
|
102
104
|
avoidCollision?: boolean;
|
|
@@ -137,6 +139,8 @@ declare const Menubar: {
|
|
|
137
139
|
defaultOpen?: boolean;
|
|
138
140
|
crossAxisOffset?: number;
|
|
139
141
|
mainAxisOffset?: number;
|
|
142
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
143
|
+
collisionPadding?: number;
|
|
140
144
|
loop?: boolean;
|
|
141
145
|
placement?: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
|
142
146
|
avoidCollision?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{forwardRef as r}from"react";import{u as n}from"./useComponentClass-QwNivz0h.js";import{c as o}from"./clsx-BaVHROc5.js";import{F as s}from"./index-Db-tduwt.js";import{M as a}from"./MenuPrimitive-wJbEC-gM.js";import u from"./Separator.js";import"./ThemeContext-Sm-iNANd.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-wRElCyvx.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";const l=t.createContext(null),i=r((({children:r,customRootClass:a,className:u,dir:i,loop:c,...d},m)=>{const b=n(a,"Menubar"),[p,h]=t.useState([]),[M,f]=t.useState(0),C=(e,t)=>{h((r=>r.map((r=>r.id===e?{...r,state:t}:r))))};return e(l.Provider,{value:{rootClass:b,registerItem:(e,t="closed")=>{h((r=>r.find((t=>t.id===e))?r.map((r=>r.id===e?{...r,state:t}:r)):[...r,{id:e,state:t}]))},items:p,updateItemState:C},children:e(s.Composite,{ref:m,className:o(b&&`${b}-root`,u),dir:i,loop:c,...d,activeIndex:M,onNavigate:e=>{const t=p[M],r=p[e];if(t&&C(t.id,"closed"),r){const e="open"===t?.state;C(r.id,e?"open":"closed")}f(e)},children:r})})}));i.displayName="MenubarRoot";const c=t.createContext(null),d=r((({children:r,className:n,...u},i)=>{const d=t.useContext(l),m=t.useContext(c);if(!d)return console.warn("MenubarTrigger should be used in the MenubarRoot"),null;const{rootClass:b}=d;if(!m)return console.warn("MenubarTrigger should be used in the MenubarMenu"),null;const{isOpen:p}=m;return e(s.CompositeItem,{render:()=>e(a.Trigger,{ref:i,className:o(b&&`${b}-trigger`,n),"data-active":p,...u,children:r})})}));d.displayName="MenubarTrigger";const m=r((({children:r,className:n,...s},u)=>{const i=t.useContext(l);if(!i)return console.warn("MenubarContent should be used in the MenubarRoot"),null;const{rootClass:c}=i;return e(a.Content,{ref:u,className:o(c&&`${c}-content`,n),...s,children:r})}));m.displayName="MenubarContent";const b=r((({children:r,...n},o)=>t.useContext(l)?e(a.Portal,{ref:o,...n,children:r}):(console.warn("MenubarPortal should be used in the MenubarRoot"),null)));b.displayName="MenubarPortal";const p=r((({children:r,className:n,label:s,...u},i)=>{const c=t.useContext(l);if(!c)return console.warn("MenubarItem should be used in the MenubarRoot"),null;const{rootClass:d}=c;return e(a.Item,{ref:i,className:o(d&&`${d}-item`,n),label:s,...u,children:r})}));p.displayName="MenubarItem";const h=r((({children:r,className:n,...s},u)=>{const i=t.useContext(l);if(!i)return console.warn("MenubarSub should be used in the MenubarRoot"),null;const{rootClass:c}=i;return e(a.Sub,{ref:u,className:o(c&&`${c}-sub`,n),...s,children:r})}));h.displayName="MenubarSub";const M=r((({children:r,className:n,...s},u)=>{const i=t.useContext(l);if(!i)return console.warn("MenubarSubTrigger should be used in the MenubarRoot"),null;const{rootClass:c}=i;return e(a.Trigger,{ref:u,className:o(c&&`${c}-sub-trigger`,n),...s,children:r})}));M.displayName="MenubarSubTrigger";const f=r((({children:r,className:n,...u},i)=>{const d=t.useContext(l),m=s.useId();if(!d)return console.warn("MenubarMenu should be used in the MenubarRoot"),null;const{rootClass:b,registerItem:p,items:h,updateItemState:M}=d;t.useEffect((()=>{m&&p(m)}),[m]);const f="open"===h.find((e=>e.id===m))?.state;return e(a.Root,{ref:i,className:o(b&&`${b}-menu`,n),"data-id":m,"data-active":f,open:f,onOpenChange:e=>m&&M(m,e?"open":"closed"),...u,children:e(c.Provider,{value:{isOpen:f},children:r})})}));f.displayName="MenubarMenu";const C=r((({className:r,...n},o)=>{const s=t.useContext(l);if(!s)return console.warn("MenubarSeparator should be used within MenubarRoot"),null;const{rootClass:a}=s;return e(u,{ref:o,customRootClass:a,className:r,...n})}));C.displayName="MenubarSeparator";const g=()=>(console.warn("Direct usage of Menubar is not supported. Please use Menubar.Root, Menubar.Item instead."),null);g.Root=i,g.Menu=f,g.Trigger=d,g.Content=m,g.Portal=b,g.Item=p,g.Sub=h,g.SubTrigger=M,g.Separator=C;export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import t,{createContext as r,useRef as n,useEffect as o}from"react";import{c as s}from"./clsx-BaVHROc5.js";import{
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import t,{createContext as r,useRef as n,useEffect as o}from"react";import{c as s}from"./clsx-BaVHROc5.js";import{u as l}from"./useComponentClass-QwNivz0h.js";import{P as i}from"./index-m6qHOeQ9.js";import{R as a}from"./index-DOVR6Rd5.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";import"./mergeRefs-B8eZ_q-T.js";const c=r({rootClass:"",rootRef:null}),u=r({value:"",isVisible:!1}),d=r({visibleItems:[],handleInView:()=>{},handleOutView:()=>{},scrollToItem:()=>{},registerRef:()=>{}});function m(e){if(!e)return null;const t=window.getComputedStyle(e).overflowY;return"auto"===t||"scroll"===t?e:m(e.parentElement)}function h({onEnter:e,onLeave:t,threshold:r=0,rootMargin:s="0px",root:l}){const i=n(null);return o((()=>{if("undefined"==typeof window||!("IntersectionObserver"in window))return;if(!i.current)return;const n=l??m(i.current),o=new IntersectionObserver((r=>{r.forEach((r=>{r.isIntersecting?e?.():t?.()}))}),{threshold:r,rootMargin:s,root:n});return o.observe(i.current),()=>{i.current&&o.unobserve(i.current),o.disconnect()}}),[e,t,r,s,l]),i}const f=Object.assign((()=>(console.warn("Direct usage of Minimap is not supported. Please use Minimap.Root, Minimap.Item instead."),null)),{Root:({children:r,className:n,customRootClass:o="",...u})=>{const d=l(o,"Minimap"),m=t.useRef(null);return e(c.Provider,{value:{rootClass:d,rootRef:m},children:e(a.Root,{loop:!0,orientation:"both",children:e(a.Group,{children:e(i.div,{ref:m,className:s(d,n),...u,children:r})})})})},Item:({children:r,className:n="",value:o,...l})=>{const{rootClass:m}=t.useContext(c)||{rootClass:""},{visibleItems:h,scrollToItem:f}=t.useContext(d),v=h.includes(o),C=t.useMemo((()=>({value:o,isVisible:v})),[o,v]),p=t.useCallback((()=>{f(o)}),[o,f]);return e(u.Provider,{value:C,children:e(a.Item,{value:o,children:e(i.button,{onClick:p,className:s(m&&`${m}-item`,n),"data-in-view":v?"true":"false",...l,children:r})})})},Track:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c);return e("div",{className:s(l&&`${l}-track`,n),...o,children:r})},Line:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c)||{rootClass:""},{value:i}=t.useContext(u)||{value:""},{visibleItems:a}=t.useContext(d),m=a.indexOf(i),h=-1!==m,f=-1!==m&&m<a.length-1,v=h&&f;return e("div",{className:s(l&&`${l}-line`,n),"data-in-view":v?"true":"false",...o,children:r})},Content:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c);return e("div",{className:s(l&&`${l}-content`,n),...o,children:r})},Bubble:({children:r,className:n="",...o})=>{const{rootClass:l}=t.useContext(c)||{rootClass:""},{isVisible:i}=t.useContext(u)||{isVisible:!1};return e("div",{className:s(l&&`${l}-bubble`,n),"data-in-view":i?"true":"false",...o,children:r})},Provider:({children:r,className:n="",scrollable:o,...s})=>{const[l,i]=t.useState([]),a=t.useRef(new Map),c=t.useRef(null),u=t.useCallback(((e,t)=>{t?a.current.set(e,t):a.current.delete(e)}),[]),m=t.useCallback((e=>{i((t=>{if(null===e||t.includes(e))return t;return[...t,e].sort(((e,t)=>{const r=a.current.get(e),n=a.current.get(t);if(!r||!n)return 0;return r.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}))}))}),[]),h=t.useCallback((e=>{i((t=>null!==e&&t.includes(e)?t.filter((t=>t!==e)):t))}),[]),f=t.useCallback((e=>{const t=a.current.get(e);if(!t)return;let r=null;if(o&&c.current)r=c.current;else{const e=t=>{if(!t||t===document.body)return null;const r=window.getComputedStyle(t);return("auto"===r.overflow||"scroll"===r.overflow||"auto"===r.overflowY||"scroll"===r.overflowY)&&t.scrollHeight>t.clientHeight?t:e(t.parentElement)};r=e(t.parentElement)}if(r){const e=t.getBoundingClientRect(),n=r.getBoundingClientRect(),o=e.top-n.top+r.scrollTop,s=r.scrollHeight-r.clientHeight,l=Math.max(0,Math.min(o,s));Math.abs(l-r.scrollTop)>1&&r.scrollTo({top:l,behavior:"smooth"})}}),[]),v=t.useMemo((()=>({visibleItems:l,handleInView:m,handleOutView:h,scrollToItem:f,registerRef:u})),[l,m,h,f,u]);return e(d.Provider,{value:v,children:e("div",{ref:c,className:`${n}`,...s,children:r})})},Waypoint:({children:r,className:n="",value:o="",...l})=>{const{handleInView:i,handleOutView:a,registerRef:c}=t.useContext(d),u=h({onEnter:t.useCallback((()=>{console.log("waypoint",o,"in view"),i(o)}),[o,i]),onLeave:t.useCallback((()=>{console.log("waypoint",o,"out of view"),a(o)}),[o,a]),threshold:.1}),m=t.useCallback((e=>{u&&"current"in u&&(u.current=e),o&&c(o,e)}),[u,o,c]);return e("div",{ref:m,className:s(n),...l,children:r})}});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import n from"react";import{R as r}from"./index-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import n from"react";import{R as r}from"./index-DOVR6Rd5.js";import{u as o}from"./index-wRElCyvx.js";import{u as t}from"./useComponentClass-QwNivz0h.js";import{c as s}from"./clsx-BaVHROc5.js";import{c as a}from"./index-CXzybYmm.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";import"./mergeRefs-B8eZ_q-T.js";import"./ThemeContext-Sm-iNANd.js";const i=n.createContext({isOpen:"",setIsOpen:()=>{},rootClass:""}),l="NavigationMenu",c=n.forwardRef((({children:n,value:a,defaultValue:c="",onValueChange:d,customRootClass:m,className:u,...p},f)=>{const h=t(m,l),[C,g]=o(a,c,d);return e("div",{ref:f,...p,children:e(i.Provider,{value:{isOpen:C,setIsOpen:g,rootClass:h},children:e(r.Root,{children:e(r.Group,{className:s(h&&`${h}-root`,u),children:n})})})})}));c.displayName=l;const d=n.createContext({itemOpen:!1,handleTrigger:()=>{}}),m=n.forwardRef((({value:r,children:o,className:t,onMouseEnter:l,onMouseLeave:c,onKeyDown:m,...u},p)=>{const{isOpen:f,setIsOpen:h,rootClass:C}=n.useContext(i),g=f===r,N=()=>{h(g?"":r)};return e(d.Provider,{value:{itemOpen:g,handleTrigger:N},children:e("div",{ref:p,onMouseEnter:a(l,N),onMouseLeave:a(c,N),className:s(C&&`${C}-item`,t),onKeyDown:a(m,(e=>{"Escape"===e.key&&h("")})),...u,children:o})})}));m.displayName="NavigationMenuItem";const u=n.forwardRef((({children:o,className:t,onClick:l,...c},m)=>{const{handleTrigger:u,itemOpen:p}=n.useContext(d),{rootClass:f}=n.useContext(i);return e(r.Item,{children:e("button",{ref:m,onClick:a(l,u),className:s(f&&`${f}-trigger`,t),"aria-expanded":p,"data-state":p?"open":"closed",...c,children:o})})}));u.displayName="NavigationMenuTrigger";const p=n.forwardRef((({children:o,className:t,...a},l)=>{const{itemOpen:c}=n.useContext(d),{rootClass:m}=n.useContext(i),u=n.useRef(null);return n.useImperativeHandle(l,(()=>u.current)),c?e("div",{ref:u,className:s(m&&`${m}-content`,t),"data-state":c?"open":"closed",...a,children:e(r.Root,{children:e(r.Group,{children:o})})}):null}));p.displayName="NavigationMenuContent";const f=n.forwardRef((({children:o,href:t,className:a,...l},c)=>{const{rootClass:d}=n.useContext(i);return e(r.Item,{children:e("a",{ref:c,href:t,className:s(d&&`${d}-link`,a),...l,children:o})})}));f.displayName="NavigationMenuLink";const h={Root:c,Item:m,Trigger:u,Content:p,Link:f};export{h as default};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
|
|
4
4
|
type NumberFieldRootProps = {
|
|
5
|
+
customRootClass?: string;
|
|
5
6
|
name?: string;
|
|
6
7
|
defaultValue?: number | '';
|
|
7
8
|
value?: number | '';
|
|
@@ -24,6 +25,7 @@ type NumberFieldDecrementProps = ComponentPropsWithoutRef<'button'>;
|
|
|
24
25
|
declare const NumberField: {
|
|
25
26
|
(): null;
|
|
26
27
|
Root: React.ForwardRefExoticComponent<{
|
|
28
|
+
customRootClass?: string;
|
|
27
29
|
name?: string;
|
|
28
30
|
defaultValue?: number | "";
|
|
29
31
|
value?: number | "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import n,{forwardRef as t,useContext as r}from"react";import{u as l}from"./index-wRElCyvx.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as o}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const i=n.createContext(null),s="NumberField",d=t((({children:n,customRootClass:t="",name:r,defaultValue:d="",value:u,onValueChange:m,largeStep:c,step:p,min:b,max:f,disabled:y,readOnly:h,required:N,id:v,className:D="",...w},C)=>{const F=a(t,s),[g,x]=l(u,d,m),I={inputValue:g,handleOnChange:e=>{x(""!==e?void 0!==f&&e>f?f:void 0!==b&&e<b?b:e:"")},handleStep:({type:e,direction:n})=>{let t=0;switch(e){case"small":if(!p)return;t=p;break;case"large":if(!c)return;t=c}"decrement"===n&&(t*=-1),(e=>{x((n=>{let t=n;""===t&&(t=void 0!==b?b:-1);const r=t+e;return void 0!==f&&r>f?f:void 0!==b&&r<b?b:r}))})(t)},id:v,name:r,disabled:y,readOnly:h,required:N,rootClass:F};return e("div",{ref:C,className:o(F&&`${F}-root`,D),...w,children:e(i.Provider,{value:I,children:n})})}));d.displayName=s;const u=t((({className:n,...t},l)=>{const a=r(i);if(!a)return console.error("NumberFieldInput must be used within a NumberField"),null;const{inputValue:s,handleOnChange:d,handleStep:u,id:m,name:c,disabled:p,readOnly:b,required:f,rootClass:y}=a;return e("input",{ref:l,type:"number",onKeyDown:e=>{"ArrowUp"!==e.key||e.shiftKey||(e.preventDefault(),u({direction:"increment",type:"small"})),"ArrowDown"!==e.key||e.shiftKey||(e.preventDefault(),u({direction:"decrement",type:"small"})),"ArrowUp"===e.key&&e.shiftKey&&(e.preventDefault(),u({direction:"increment",type:"large"})),"ArrowDown"===e.key&&e.shiftKey&&(e.preventDefault(),u({direction:"decrement",type:"large"}))},value:""===s?"":s,onChange:e=>{const n=e.target.value;d(""===n?"":Number(n))},id:m,name:c,disabled:p,readOnly:b,required:f,className:o(y&&`${y}-input`,n),...t})}));u.displayName="NumberFieldInput";const m=t((({children:n,className:t,onMouseDown:l,...a},s)=>{const d=r(i);if(!d)return console.error("NumberFieldIncrement must be used within a NumberField"),null;const{handleStep:u,rootClass:m,disabled:c,readOnly:p}=d;return e("button",{ref:s,onClick:()=>u({direction:"increment",type:"small"}),className:o(m&&`${m}-increment`,t),disabled:c||p,type:"button",...a,tabIndex:-1,onMouseDown:e=>{l?.(e),e.defaultPrevented||e.preventDefault()},children:n})}));m.displayName="NumberFieldIncrement";const c=t((({children:n,className:t,onMouseDown:l,...a},s)=>{const d=r(i);if(!d)return console.error("NumberFieldDecrement must be used within a NumberField"),null;const{handleStep:u,rootClass:m,disabled:c,readOnly:p}=d;return e("button",{ref:s,onClick:()=>u({direction:"decrement",type:"small"}),className:o(m&&`${m}-decrement`,t),disabled:c||p,type:"button",...a,tabIndex:-1,onMouseDown:e=>{l?.(e),e.defaultPrevented||e.preventDefault()},children:n})}));c.displayName="NumberFieldDecrement";const p=()=>(console.warn("Direct usage of NumberField is not supported. Please use NumberField.Root, NumberField.Item instead."),null);p.Root=d,p.Input=u,p.Increment=m,p.Decrement=c;export{p as default};
|