@radui/ui 0.5.0 → 1.0.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.
Files changed (156) hide show
  1. package/README.md +2 -0
  2. package/dist/components/Accordion.d.ts +20 -34
  3. package/dist/components/Accordion.js +1 -1
  4. package/dist/components/AlertDialog.d.ts +46 -1
  5. package/dist/components/AlertDialog.js +1 -1
  6. package/dist/components/AspectRatio.d.ts +2 -2
  7. package/dist/components/AspectRatio.js +1 -1
  8. package/dist/components/Avatar.d.ts +4 -1
  9. package/dist/components/Avatar.js +1 -1
  10. package/dist/components/AvatarGroup.d.ts +9 -1
  11. package/dist/components/AvatarGroup.js +1 -1
  12. package/dist/components/AvatarPrimitiveFallback-C1siRii4.js +1 -0
  13. package/dist/components/Badge.d.ts +3 -3
  14. package/dist/components/Badge.js +1 -1
  15. package/dist/components/BlockQuote.js +1 -1
  16. package/dist/components/Breadcrumb.d.ts +70 -0
  17. package/dist/components/Breadcrumb.js +1 -0
  18. package/dist/components/Button.js +1 -1
  19. package/dist/components/Callout.d.ts +4 -1
  20. package/dist/components/Callout.js +1 -1
  21. package/dist/components/Card.d.ts +1 -1
  22. package/dist/components/Card.js +1 -1
  23. package/dist/components/Checkbox.d.ts +29 -3
  24. package/dist/components/Checkbox.js +8 -1
  25. package/dist/components/CheckboxCards.d.ts +31 -4
  26. package/dist/components/CheckboxCards.js +1 -1
  27. package/dist/components/CheckboxGroup.d.ts +29 -2
  28. package/dist/components/CheckboxGroup.js +1 -1
  29. package/dist/components/CheckboxGroupPrimitive-DfHQYkep.js +1 -0
  30. package/dist/components/Code.js +1 -1
  31. package/dist/components/Collapsible.d.ts +10 -1
  32. package/dist/components/Collapsible.js +1 -1
  33. package/dist/components/Combobox.d.ts +1 -1
  34. package/dist/components/Combobox.js +1 -1
  35. package/dist/components/ComboboxPrimitive-DQcJ8pzQ.js +1 -0
  36. package/dist/components/Command.d.ts +7 -1
  37. package/dist/components/Command.js +1 -1
  38. package/dist/components/ContextMenu.d.ts +23 -23
  39. package/dist/components/ContextMenu.js +1 -1
  40. package/dist/components/DataList.d.ts +10 -4
  41. package/dist/components/DataList.js +1 -1
  42. package/dist/components/Dialog.d.ts +7 -1
  43. package/dist/components/Dialog.js +1 -1
  44. package/dist/components/Disclosure.d.ts +17 -7
  45. package/dist/components/Disclosure.js +1 -1
  46. package/dist/components/Drawer.d.ts +95 -17
  47. package/dist/components/Drawer.js +1 -1
  48. package/dist/components/DropdownMenu.d.ts +23 -23
  49. package/dist/components/DropdownMenu.js +1 -1
  50. package/dist/components/Em.js +1 -1
  51. package/dist/components/Fieldset.d.ts +43 -0
  52. package/dist/components/Fieldset.js +1 -0
  53. package/dist/components/Heading.js +1 -1
  54. package/dist/components/HoverCard.d.ts +3 -1
  55. package/dist/components/HoverCard.js +1 -1
  56. package/dist/components/Kbd.js +1 -1
  57. package/dist/components/Link.js +1 -1
  58. package/dist/components/LiveRegion.d.ts +73 -0
  59. package/dist/components/LiveRegion.js +1 -0
  60. package/dist/components/MenuPrimitive-D9VMz2TZ.js +1 -0
  61. package/dist/components/Menubar.d.ts +119 -29
  62. package/dist/components/Menubar.js +1 -1
  63. package/dist/components/Minimap.d.ts +16 -12
  64. package/dist/components/Minimap.js +1 -1
  65. package/dist/components/NavigationMenu.d.ts +11 -3
  66. package/dist/components/NavigationMenu.js +1 -1
  67. package/dist/components/NumberField.d.ts +23 -2
  68. package/dist/components/NumberField.js +1 -1
  69. package/dist/components/Popover.d.ts +83 -0
  70. package/dist/components/Popover.js +1 -0
  71. package/dist/components/Progress.d.ts +5 -4
  72. package/dist/components/Progress.js +1 -1
  73. package/dist/components/Quote.js +1 -1
  74. package/dist/components/Radio.js +1 -1
  75. package/dist/components/RadioCards.d.ts +1 -1
  76. package/dist/components/RadioCards.js +1 -1
  77. package/dist/components/RadioGroup.d.ts +1 -1
  78. package/dist/components/RadioGroup.js +1 -1
  79. package/dist/components/RadioGroupPrimitive-D1PP4y2M.js +1 -0
  80. package/dist/components/ScrollArea.d.ts +8 -4
  81. package/dist/components/ScrollArea.js +1 -1
  82. package/dist/components/Select.d.ts +1 -1
  83. package/dist/components/Select.js +1 -1
  84. package/dist/components/Separator.js +1 -1
  85. package/dist/components/Skeleton.d.ts +12 -6
  86. package/dist/components/Skeleton.js +1 -1
  87. package/dist/components/Slider.d.ts +2 -2
  88. package/dist/components/Slider.js +1 -1
  89. package/dist/components/Spinner.js +1 -1
  90. package/dist/components/Splitter.d.ts +7 -1
  91. package/dist/components/Splitter.js +1 -1
  92. package/dist/components/Steps.d.ts +25 -10
  93. package/dist/components/Steps.js +1 -1
  94. package/dist/components/Strong.js +1 -1
  95. package/dist/components/Switch.d.ts +23 -1
  96. package/dist/components/Switch.js +1 -1
  97. package/dist/components/TabNav.d.ts +34 -9
  98. package/dist/components/TabNav.js +1 -1
  99. package/dist/components/Table.d.ts +66 -19
  100. package/dist/components/Table.js +1 -1
  101. package/dist/components/Tabs.d.ts +3 -1
  102. package/dist/components/Tabs.js +1 -1
  103. package/dist/components/Text.d.ts +2 -2
  104. package/dist/components/Text.js +1 -1
  105. package/dist/components/TextArea.d.ts +4 -4
  106. package/dist/components/TextArea.js +1 -1
  107. package/dist/components/TextField.d.ts +1 -1
  108. package/dist/components/TextField.js +1 -1
  109. package/dist/components/Toast.d.ts +325 -0
  110. package/dist/components/Toast.js +1 -0
  111. package/dist/components/Toggle.d.ts +1 -1
  112. package/dist/components/Toggle.js +1 -1
  113. package/dist/components/ToggleGroup.d.ts +1 -1
  114. package/dist/components/ToggleGroup.js +1 -1
  115. package/dist/components/Toolbar.d.ts +1 -1
  116. package/dist/components/Toolbar.js +1 -1
  117. package/dist/components/Tooltip.d.ts +12 -1
  118. package/dist/components/Tooltip.js +1 -1
  119. package/dist/components/Tree.d.ts +2 -1
  120. package/dist/components/Tree.js +1 -1
  121. package/dist/components/VisuallyHidden.js +1 -1
  122. package/dist/components/{check-DujVUWP-.js → check-ctUdF4Q3.js} +4 -4
  123. package/dist/components/documentOverlayOpen-coyGmcyL.js +1 -0
  124. package/dist/components/{floating-ui.react-Byzse64h.js → floating-ui.react-2kiGB4sW.js} +1 -1
  125. package/dist/components/index-C7dBo_Ry.js +1 -0
  126. package/dist/components/index-CBcSLg6O.js +1 -0
  127. package/dist/components/index-CbNq68zs.js +1 -0
  128. package/dist/components/index-D8I-rMwz.js +1 -0
  129. package/dist/components/index-DMX7gpdp.js +1 -0
  130. package/dist/components/index-FITGoHty.js +1 -0
  131. package/dist/components/index-XF8itt-H.js +1 -0
  132. package/dist/components/index-nYRBURkR.js +1 -0
  133. package/dist/components/index-xlB--dex.js +1 -0
  134. package/dist/components/keyboard-BKF7hXqL.js +1 -0
  135. package/dist/components/mergeProps-0RucjqeH.js +1 -0
  136. package/dist/components/useComponentClass-C0isGl1z.js +1 -0
  137. package/dist/themes/baremetal.css +1 -0
  138. package/dist/themes/default.css +1 -0
  139. package/dist/themes/tailwind-presets/default.css +396 -0
  140. package/package.json +65 -23
  141. package/dist/components/AvatarPrimitiveFallback-BOYawMc9.js +0 -1
  142. package/dist/components/CheckboxGroupPrimitive-Cd8ra39e.js +0 -1
  143. package/dist/components/ComboboxPrimitive-BhHSrtiY.js +0 -1
  144. package/dist/components/MenuPrimitive-wJbEC-gM.js +0 -1
  145. package/dist/components/RadioGroupPrimitive-CcvI-_wm.js +0 -1
  146. package/dist/components/clsx-BaVHROc5.js +0 -1
  147. package/dist/components/index-BbEsAodL.js +0 -1
  148. package/dist/components/index-DOVR6Rd5.js +0 -1
  149. package/dist/components/index-DU_6Msfu.js +0 -1
  150. package/dist/components/index-Db-tduwt.js +0 -1
  151. package/dist/components/index-Ir5FYyWW.js +0 -1
  152. package/dist/components/index-gM8bbyw1.js +0 -1
  153. package/dist/components/index-m6qHOeQ9.js +0 -1
  154. package/dist/components/mergeProps-B9ocQsG4.js +0 -1
  155. package/dist/components/useComponentClass-QwNivz0h.js +0 -1
  156. package/dist/themes/tailwind-presets/default.js +0 -1
@@ -1,22 +1,28 @@
1
1
  import * as React from 'react';
2
- import { ComponentPropsWithoutRef } from 'react';
2
+ import React__default, { ComponentPropsWithoutRef } from 'react';
3
3
 
4
- interface DataListRootProps extends ComponentPropsWithoutRef<'div'> {
4
+ interface DataListRootProps extends ComponentPropsWithoutRef<'dl'> {
5
5
  customRootClass?: string;
6
6
  size?: string;
7
7
  }
8
+ declare const DataListRoot: React__default.ForwardRefExoticComponent<DataListRootProps & React__default.RefAttributes<HTMLElement>>;
8
9
 
9
10
  type DataListItemProps = ComponentPropsWithoutRef<'div'>;
11
+ declare const DataListItem: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
10
12
 
11
13
  type DataListLabelProps = ComponentPropsWithoutRef<'dt'> & {
12
14
  color?: string;
13
15
  };
16
+ declare const DataListLabel: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
17
+ color?: string;
18
+ } & React__default.RefAttributes<HTMLElement>>;
14
19
 
15
20
  type DataListValueProps = ComponentPropsWithoutRef<'dd'>;
21
+ declare const DataListValue: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React__default.RefAttributes<HTMLElement>>;
16
22
 
17
23
  declare const DataList: {
18
24
  (): null;
19
- Root: React.ForwardRefExoticComponent<DataListRootProps & React.RefAttributes<HTMLDivElement>>;
25
+ Root: React.ForwardRefExoticComponent<DataListRootProps & React.RefAttributes<HTMLElement>>;
20
26
  Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
21
27
  Label: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
22
28
  color?: string;
@@ -24,5 +30,5 @@ declare const DataList: {
24
30
  Value: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
25
31
  };
26
32
 
27
- export { DataList as default };
33
+ export { DataListItem as Item, DataListLabel as Label, DataListRoot as Root, DataListValue as Value, DataList as default };
28
34
  export type { DataListItemProps, DataListLabelProps, DataListRootProps, DataListValueProps };
@@ -1 +1 @@
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
+ 'use client';import{jsx as a}from"react/jsx-runtime";import{createContext as s,forwardRef as t,useContext as e}from"react";import{u as o,c as l}from"./useComponentClass-C0isGl1z.js";import{c as r,b as i}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const c=s({rootClass:"DataList"}),n=t((({children:s,className:t="",customRootClass:e="",size:i="",...n},m)=>{const d=o(e,"DataList"),u=r("datalist",{size:i});return a(c.Provider,{value:{rootClass:d},children:a("dl",{ref:m,className:l(d,t),...u,...n,children:s})})}));n.displayName="DataListRoot";const m=t((({children:s,className:t="",...o},r)=>{const{rootClass:i}=e(c);return a("div",{ref:r,className:l(i&&`${i}-item`,t),...o,children:s})}));m.displayName="DataListItem";const d=t((({children:s,className:t="",color:o="",...r},n)=>{const{rootClass:m}=e(c),d=i(o);return a("dt",{ref:n,className:l(m&&`${m}-label`,t),...d,...r,children:s})}));d.displayName="DataListLabel";const u=t((({children:s,className:t="",...o},r)=>{const{rootClass:i}=e(c);return a("dd",{ref:r,className:l(i&&`${i}-value`,t),...o,children:s})}));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{m as Item,d as Label,n as Root,u as Value,p as default};
@@ -6,11 +6,17 @@ import Primitive from '~/core/primitives/Primitive';
6
6
  type DialogPrimitiveRootProps$1 = {
7
7
  children: React.ReactNode;
8
8
  open?: boolean;
9
+ defaultOpen?: boolean;
9
10
  onOpenChange?: (open: boolean) => void;
10
11
  onClickOutside?: () => void;
11
12
  className?: string;
12
13
  /** When true, outside pointer events and escape key will not close the dialog. */
13
14
  disablePointerDismissal?: boolean;
15
+ /**
16
+ * When false, pressing outside the content (including the overlay) does not
17
+ * close the dialog, while Escape still does. Used by AlertDialog.
18
+ */
19
+ dismissOnOutsidePress?: boolean;
14
20
  };
15
21
 
16
22
  type DialogPrimitiveRootProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
@@ -114,5 +120,5 @@ interface DialogComponent extends React.ForwardRefExoticComponent<DialogProps &
114
120
  }
115
121
  declare const Dialog: DialogComponent;
116
122
 
117
- export { Dialog as default };
123
+ export { DialogClose as Close, DialogContent as Content, DialogDescription as Description, DialogFooter as Footer, DialogOverlay as Overlay, DialogPortal as Portal, DialogRoot as Root, DialogTitle as Title, DialogTrigger as Trigger, Dialog as default };
118
124
  export type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogOverlayProps, DialogPortalProps, DialogRootProps, DialogTitleProps, DialogTriggerProps };
@@ -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-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
+ 'use client';import{createContext as e,forwardRef as s,useState as o,useMemo as a,useContext as t,useEffect as r}from"react";import{jsx as i}from"react/jsx-runtime";import{D as l}from"./index-xlB--dex.js";import{u as n,c as d}from"./useComponentClass-C0isGl1z.js";import{P as c}from"./index-XF8itt-H.js";import{F as m}from"./index-D8I-rMwz.js";import"./index-wRElCyvx.js";import"./index-CBcSLg6O.js";import"./index-CbNq68zs.js";import"./documentOverlayOpen-coyGmcyL.js";import"./index-FITGoHty.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";import"./floating-ui.react-2kiGB4sW.js";import"react-dom";const p=e({rootClass:"",titleId:void 0,descriptionId:void 0,setTitleId:()=>{},setDescriptionId:()=>{}}),g="Dialog",C=s((({children:e,customRootClass:s="",className:t="",...r},c)=>{const m=n(s,g),[C,N]=o(void 0),[h,u]=o(void 0),D=a((()=>({rootClass:m,titleId:C,descriptionId:h,setTitleId:N,setDescriptionId:u})),[m,C,h]);return i(l.Root,{ref:c,className:d(m,t),...r,children:i(p.Provider,{value:D,children:e})})}));C.displayName=g;const N=s((({children:e,asChild:s,className:o="",...a},r)=>{const{rootClass:n}=t(p);return i(l.Trigger,{ref:r,className:d(n&&`${n}-trigger`,o),asChild:s,...a,children:e})}));N.displayName="DialogTrigger";const h=s((({children:e,...s},o)=>i(l.Portal,{...s,children:e})));h.displayName="DialogPortal";const u=s((({className:e="",...s},o)=>{const{rootClass:a}=t(p);return i(l.Overlay,{ref:o,className:d(a&&`${a}-overlay`,e),...s})}));u.displayName="DialogOverlay";const D=s((({children:e,className:s="","aria-labelledby":o,"aria-describedby":a,...r},n)=>{const{rootClass:c,titleId:m,descriptionId:g}=t(p);return i(l.Content,{ref:n,className:d(c&&`${c}-content`,s),"aria-labelledby":o??m,"aria-describedby":a??g,...r,children:e})}));D.displayName="DialogContent";const y=s((({children:e,className:s="",id:o,...a},l)=>{const{rootClass:n,setTitleId:g}=t(p),C=m.useId(),N=o??C;return r((()=>(g(N),()=>g(void 0))),[N,g]),i(c.h2,{ref:l,id:N,className:d(n&&`${n}-title`,s),...a,children:e})}));y.displayName="DialogTitle";const f=s((({children:e,className:s="",id:o,...a},l)=>{const{rootClass:n,setDescriptionId:g}=t(p),C=m.useId(),N=o??C;return r((()=>(g(N),()=>g(void 0))),[N,g]),i(c.p,{ref:l,id:N,className:d(n&&`${n}-description`,s),...a,children:e})}));f.displayName="DialogDescription";const v=s((({children:e,asChild:s,className:o="",...a},r)=>{const{rootClass:n}=t(p);return i(l.Cancel,{ref:r,className:d(n&&`${n}-close`,o),asChild:s,...a,children:e})}));v.displayName="DialogClose";const I=s((({children:e,className:s="",...o},a)=>{const{rootClass:r}=t(p);return i(l.Footer,{ref:a,className:d(r&&`${r}-footer`,s),...o,children:e})}));I.displayName="DialogFooter";const j=s(((e,s)=>(console.warn("Direct usage of Dialog is not supported. Please use Dialog.Root, Dialog.Content, etc. instead."),null)));j.displayName="Dialog";const T=j;T.Root=C,T.Trigger=N,T.Portal=h,T.Overlay=u,T.Content=D,T.Title=y,T.Description=f,T.Footer=I,T.Close=v;export{v as Close,D as Content,f as Description,I as Footer,u as Overlay,h as Portal,C as Root,y as Title,N as Trigger,T as default};
@@ -1,26 +1,36 @@
1
1
  import React from 'react';
2
2
 
3
+ type DisclosureItemValue = number | string;
4
+
3
5
  type DisclosureRootProps = React.ComponentPropsWithoutRef<'div'> & {
4
6
  customRootClass?: string;
5
- defaultOpen?: number | null;
7
+ defaultOpen?: DisclosureItemValue | null;
8
+ loop?: boolean;
6
9
  };
7
10
  declare const DisclosureRoot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
8
11
  customRootClass?: string;
9
- defaultOpen?: number | null;
12
+ defaultOpen?: DisclosureItemValue | null;
13
+ loop?: boolean;
10
14
  } & React.RefAttributes<HTMLDivElement>>;
11
15
 
12
16
  type DisclosureItemProps = React.ComponentPropsWithoutRef<'div'> & {
13
- value: number;
17
+ value: DisclosureItemValue;
14
18
  };
15
19
  declare const DisclosureItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
16
- value: number;
20
+ value: DisclosureItemValue;
17
21
  } & React.RefAttributes<HTMLDivElement>>;
18
22
 
19
23
  type DisclosureTriggerProps = React.ComponentPropsWithoutRef<'button'>;
20
24
  declare const DisclosureTrigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
25
 
22
- type DisclosureContentProps = React.ComponentPropsWithoutRef<'div'>;
23
- declare const DisclosureContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
26
+ type DisclosureContentProps = React.ComponentPropsWithoutRef<'div'> & {
27
+ /** Keep the content mounted while closed. */
28
+ forceMount?: boolean;
29
+ };
30
+ declare const DisclosureContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
31
+ /** Keep the content mounted while closed. */
32
+ forceMount?: boolean;
33
+ } & React.RefAttributes<HTMLDivElement>>;
24
34
 
25
35
  type DisclosureProps = DisclosureRootProps & {
26
36
  items: {
@@ -36,5 +46,5 @@ interface DisclosureComponent extends React.ForwardRefExoticComponent<Disclosure
36
46
  }
37
47
  declare const Disclosure: DisclosureComponent;
38
48
 
39
- export { Disclosure as default };
49
+ export { DisclosureContent as Content, DisclosureItem as Item, DisclosureRoot as Root, DisclosureTrigger as Trigger, Disclosure as default };
40
50
  export type { DisclosureContentProps, DisclosureItemProps, DisclosureProps, DisclosureRootProps, DisclosureTriggerProps };
@@ -1 +1 @@
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};
1
+ 'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{createContext as o,useRef as s,useState as a,useCallback as i,useContext as l,useId as n}from"react";import{u as d,c}from"./useComponentClass-C0isGl1z.js";import{R as m}from"./index-C7dBo_Ry.js";import{C as u}from"./index-DMX7gpdp.js";import"./ThemeContext-Sm-iNANd.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./index-FITGoHty.js";import"./keyboard-BKF7hXqL.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";const p=o({}),f=t.forwardRef((({children:r,className:t,customRootClass:o,defaultOpen:l=null,"aria-label":n,"aria-labelledby":u,loop:f=!0,...h},g)=>{const C=s(null),R=d(o,"Disclosure"),[b,v]=a(l),I=i((e=>{C.current=e,"function"==typeof g?g(e):g&&(g.current=e)}),[g]);return e(p.Provider,{value:{rootClass:R,activeItem:b,setActiveItem:v,disclosureRef:C},children:e(m.Root,{loop:f,orientation:"both",children:e(m.Group,{children:e("div",{...h,className:c(R&&`${R}-root`,t),ref:I,role:n||u?"region":void 0,"aria-label":n,"aria-labelledby":u,"data-slot":"disclosure-root","data-testid":"disclosure-root",children:r})})})})}));f.displayName="DisclosureRoot";const h=o({}),g=()=>{},C=t.forwardRef((({children:r,className:t="",value:o,...s},a)=>{const{activeItem:d,setActiveItem:m,rootClass:f}=l(p),C=n(),R=d===o,b=i((e=>{m(e?o:null)}),[m,o]);return e(h.Provider,{value:{itemValue:o,setItemValue:g,triggerId:C},children:e(u.Root,{open:R,onOpenChange:b,asChild:!0,children:e("div",{...s,className:c(f&&`${f}-item`,t),ref:a,"data-state":R?"open":"closed","data-slot":"disclosure-item",children:r})})})}));C.displayName="DisclosureItem";const R=t.forwardRef((({children:r,className:t,id:o,...s},a)=>{const{rootClass:i}=l(p),{triggerId:n}=l(h),d=o??n;return e(m.Item,{domId:d,children:e(u.Trigger,{asChild:!0,children:e("button",{...s,ref:a,id:d,type:"button",className:c(i&&`${i}-trigger`,t),"data-slot":"disclosure-trigger",children:r})})})}));R.displayName="DisclosureTrigger";const b=t.forwardRef((({children:r,className:t="",...o},s)=>{const{rootClass:a}=l(p),{triggerId:i}=l(h);return e(u.Content,{...o,ref:s,className:c(a&&`${a}-content`,t),"data-slot":"disclosure-content",role:"region","aria-labelledby":i,children:r})}));b.displayName="DisclosureContent";const v=t.forwardRef((({items:t,...o},s)=>e(f,{ref:s,...o,children:t.map(((t,o)=>r(C,{value:o,children:[e(R,{children:t.title}),e(b,{children:t.content})]},o)))})));v.Root=f,v.Item=C,v.Trigger=R,v.Content=b,v.displayName="Disclosure";export{b as Content,C as Item,f as Root,R as Trigger,v as default};
@@ -3,10 +3,27 @@ import DialogPrimitive from '~/core/primitives/Dialog';
3
3
  import Primitive from '~/core/primitives/Primitive';
4
4
 
5
5
  type DrawerSnapPoint = number | string;
6
+
6
7
  type DrawerRootActions = {
7
8
  close: () => void;
8
9
  unmount: () => void;
9
10
  };
11
+ type DrawerChangeReason = 'trigger-press' | 'outside-press' | 'escape-key' | 'close-press' | 'imperative-action' | 'swipe' | 'none';
12
+ type DrawerOpenChangeEventDetails = {
13
+ /** The reason the drawer was asked to open or close. */
14
+ reason: DrawerChangeReason;
15
+ /** Vetoes the pending open state change. */
16
+ cancel: () => void;
17
+ /** True once `cancel` has been called. */
18
+ isCanceled: boolean;
19
+ /**
20
+ * Keeps the drawer mounted through this close, for externally controlled
21
+ * close animations. Release it with `actionsRef.current.unmount()`.
22
+ */
23
+ preventUnmountOnClose: () => void;
24
+ /** The DOM event behind the request, when there was one. */
25
+ event?: Event;
26
+ };
10
27
 
11
28
  type DrawerRootProps = {
12
29
  children?: React.ReactNode;
@@ -16,22 +33,32 @@ type DrawerRootProps = {
16
33
  defaultOpen?: boolean;
17
34
  /** Controlled open state. */
18
35
  open?: boolean;
19
- /** Called when the drawer opens or closes. */
20
- onOpenChange?: (open: boolean) => void;
21
- /** Called after open/close animations fully complete. */
36
+ /**
37
+ * Called when the drawer requests an open state change.
38
+ *
39
+ * Call `eventDetails.cancel()` to veto the change, which is how you show a
40
+ * "discard your changes?" confirmation before the drawer closes. The second
41
+ * argument carries the `reason` so you can react to the source of the request.
42
+ */
43
+ onOpenChange?: (open: boolean, eventDetails: DrawerOpenChangeEventDetails) => void;
44
+ /** Called once the open or close animation has fully completed. */
22
45
  onOpenChangeComplete?: (open: boolean) => void;
23
46
  /**
24
- * Snap points for the drawer. Use 0–1 for viewport fractions,
25
- * numbers > 1 for pixel values, or strings like '148px' / '30rem'.
47
+ * Resting heights for a vertical drawer. Numbers between 0 and 1 are
48
+ * fractions of the viewport height, numbers above 1 are pixels, and strings
49
+ * accept `px` and `rem` (for example `'148px'` or `'30rem'`).
26
50
  */
27
51
  snapPoints?: DrawerSnapPoint[];
28
- /** Initial snap point when uncontrolled. */
52
+ /** Initial snap point when uncontrolled. Defaults to the first snap point. */
29
53
  defaultSnapPoint?: DrawerSnapPoint | null;
30
- /** Controlled active snap point. */
54
+ /** Controlled active snap point. `null` means fully expanded. */
31
55
  snapPoint?: DrawerSnapPoint | null;
32
56
  /** Called when the active snap point changes. */
33
57
  onSnapPointChange?: (snapPoint: DrawerSnapPoint | null) => void;
34
- /** Disables velocity-based snap skipping; drag distance determines next snap point. */
58
+ /**
59
+ * Disables velocity-based snap skipping, so the resting point is decided by
60
+ * drag distance alone. You can still drag past several points.
61
+ */
35
62
  snapToSequentialPoints?: boolean;
36
63
  /**
37
64
  * Modal mode.
@@ -40,10 +67,13 @@ type DrawerRootProps = {
40
67
  * - `'trap-focus'`: focus trapped, but scroll and outside pointer events remain enabled.
41
68
  */
42
69
  modal?: boolean | 'trap-focus';
43
- /** When true, clicking outside the drawer does not close it. */
70
+ /** When true, outside presses and the Escape key do not close the drawer. */
44
71
  disablePointerDismissal?: boolean;
45
- /** Direction the user swipes to dismiss the drawer. */
46
- swipeDirection?: 'left' | 'right' | 'top' | 'bottom';
72
+ /**
73
+ * The side the drawer is docked on, which is also the direction you drag to
74
+ * dismiss it. `up` and `down` are accepted as aliases for `top` and `bottom`.
75
+ */
76
+ swipeDirection?: 'left' | 'right' | 'top' | 'bottom' | 'up' | 'down';
47
77
  /** ID of the trigger associated with this drawer (controlled). */
48
78
  triggerId?: string | null;
49
79
  /** ID of the trigger associated with this drawer (uncontrolled / defaultOpen). */
@@ -51,8 +81,8 @@ type DrawerRootProps = {
51
81
  /**
52
82
  * Ref to imperative actions.
53
83
  * - `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).
84
+ * - `unmount()`: unmounts the drawer. Needed when a close was held open with
85
+ * `eventDetails.preventUnmountOnClose()` for a custom close animation.
56
86
  */
57
87
  actionsRef?: React.RefObject<DrawerRootActions | null>;
58
88
  };
@@ -97,18 +127,32 @@ type DrawerContentProps = React.ComponentPropsWithoutRef<typeof Primitive.div> &
97
127
  className?: string;
98
128
  asChild?: boolean;
99
129
  forceMount?: boolean;
130
+ /**
131
+ * Where focus lands when the drawer opens. `0` focuses the first focusable
132
+ * element, `-1` focuses the popup itself, or pass an element / ref.
133
+ */
134
+ initialFocus?: number | React.RefObject<HTMLElement | null>;
135
+ /** Element focus returns to on close. Defaults to the trigger. */
136
+ finalFocus?: React.RefObject<HTMLElement | null>;
137
+ /**
138
+ * Turns off drag-to-dismiss for this popup. Equivalent to putting
139
+ * `data-swipe-ignore` on it, but as a prop.
140
+ */
141
+ disableSwipeDismiss?: boolean;
100
142
  };
101
143
  declare const DrawerContent: React.ForwardRefExoticComponent<DrawerContentProps & React.RefAttributes<HTMLElement>>;
102
144
 
103
145
  type PrimitiveHeadingProps = React.ComponentPropsWithoutRef<typeof Primitive.h2>;
104
146
  type DrawerTitleProps = PrimitiveHeadingProps & {
105
147
  className?: string;
148
+ id?: string;
106
149
  };
107
150
  declare const DrawerTitle: React.ForwardRefExoticComponent<DrawerTitleProps & React.RefAttributes<HTMLElement>>;
108
151
 
109
152
  type PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;
110
153
  type DrawerDescriptionProps = PrimitiveParagraphProps & {
111
154
  className?: string;
155
+ id?: string;
112
156
  };
113
157
  declare const DrawerDescription: React.ForwardRefExoticComponent<DrawerDescriptionProps & React.RefAttributes<HTMLElement>>;
114
158
 
@@ -129,11 +173,44 @@ declare const DrawerClose: React.ForwardRefExoticComponent<Omit<DialogPrimitiveC
129
173
 
130
174
  type DrawerHandleProps = {
131
175
  className?: string;
132
- /** Distance in px the user must drag outward before the drawer closes. Default: 80 */
133
- closeThreshold?: number;
134
176
  };
135
177
  declare const DrawerHandle: React.ForwardRefExoticComponent<DrawerHandleProps & React.RefAttributes<HTMLDivElement>>;
136
178
 
179
+ type DrawerSwipeZoneProps = React.ComponentPropsWithoutRef<'div'> & {
180
+ className?: string;
181
+ /**
182
+ * How far (px) the user must drag in the open direction before the drawer opens.
183
+ * @default 48
184
+ */
185
+ openThreshold?: number;
186
+ /**
187
+ * Width/height of the hit zone in px (the edge-hugging strip).
188
+ * @default 20
189
+ */
190
+ size?: number;
191
+ /**
192
+ * Disables the swipe zone. The hit area is removed when disabled.
193
+ */
194
+ disabled?: boolean;
195
+ };
196
+ declare const DrawerSwipeZone: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
197
+ className?: string;
198
+ /**
199
+ * How far (px) the user must drag in the open direction before the drawer opens.
200
+ * @default 48
201
+ */
202
+ openThreshold?: number;
203
+ /**
204
+ * Width/height of the hit zone in px (the edge-hugging strip).
205
+ * @default 20
206
+ */
207
+ size?: number;
208
+ /**
209
+ * Disables the swipe zone. The hit area is removed when disabled.
210
+ */
211
+ disabled?: boolean;
212
+ } & React.RefAttributes<HTMLDivElement>>;
213
+
137
214
  type DrawerElement = React.ElementRef<'div'>;
138
215
  type DrawerProps = React.ComponentPropsWithoutRef<'div'>;
139
216
  interface DrawerComponent extends React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<DrawerElement>> {
@@ -146,8 +223,9 @@ interface DrawerComponent extends React.ForwardRefExoticComponent<DrawerProps &
146
223
  Description: typeof DrawerDescription;
147
224
  Close: typeof DrawerClose;
148
225
  Handle: typeof DrawerHandle;
226
+ SwipeZone: typeof DrawerSwipeZone;
149
227
  }
150
228
  declare const Drawer: DrawerComponent;
151
229
 
152
- export { Drawer as default };
153
- export type { DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerHandleProps, DrawerOverlayProps, DrawerPortalProps, DrawerRootActions, DrawerRootProps, DrawerSnapPoint, DrawerTitleProps, DrawerTriggerProps };
230
+ export { DrawerClose as Close, DrawerContent as Content, DrawerDescription as Description, DrawerHandle as Handle, DrawerOverlay as Overlay, DrawerPortal as Portal, DrawerRoot as Root, DrawerSwipeZone as SwipeZone, DrawerTitle as Title, DrawerTrigger as Trigger, Drawer as default };
231
+ export type { DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerHandleProps, DrawerOverlayProps, DrawerPortalProps, DrawerRootActions, DrawerRootProps, DrawerSnapPoint, DrawerSwipeZoneProps, DrawerTitleProps, DrawerTriggerProps };
@@ -1 +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};
1
+ 'use client';import{createContext as e,useContext as t,forwardRef as n,useMemo as r,useState as i,useRef as o,useEffect as s,useCallback as a}from"react";import{jsx as l}from"react/jsx-runtime";import{u as c,c as u}from"./useComponentClass-C0isGl1z.js";import{u as d}from"./index-CBcSLg6O.js";import{D as p,a as m}from"./index-xlB--dex.js";import{F as f}from"./index-D8I-rMwz.js";import{P as h}from"./index-XF8itt-H.js";import"./ThemeContext-Sm-iNANd.js";import"./index-CbNq68zs.js";import"./documentOverlayOpen-coyGmcyL.js";import"./index-wRElCyvx.js";import"./index-FITGoHty.js";import"./floating-ui.react-2kiGB4sW.js";import"react-dom";import"./mergeProps-0RucjqeH.js";const g=e({rootClass:"",side:"right",dismissDirection:"right",isOpen:!1,onOpen:()=>{},snapPoints:[],activeSnapPoint:null,setActiveSnapPoint:()=>{},snapToSequentialPoints:!1,modal:!0,disablePointerDismissal:!1,shouldKeepMounted:!1,requestClose:()=>{},markIntentionalClose:()=>{},setTitleId:()=>{},setDescriptionId:()=>{},popupHeight:0,setPopupHeight:()=>{},registerContentElement:()=>{},childOpenCount:0,nestedSwiping:!1,setNestedSwiping:()=>{},depth:0}),v={movementX:"--rad-ui-drawer-swipe-movement-x",movementY:"--rad-ui-drawer-swipe-movement-y",snapPointOffset:"--rad-ui-drawer-snap-point-offset",progress:"--rad-ui-drawer-swipe-progress",strength:"--rad-ui-drawer-swipe-strength",height:"--rad-ui-drawer-height",nestedDrawers:"--rad-ui-nested-drawers"},y="[data-swipe-ignore],[data-rad-ui-swipe-ignore]";function w(e,t,n){return Math.min(Math.max(e,t),n)}function P(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;default:return t}}function C(e,t){return"left"===t||"right"===t?e.offsetWidth:e.offsetHeight}function x(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if("number"==typeof e)return Number.isFinite(e)?e<=1?w(e,0,1)*t:e:null;const r=e.trim();if(r.endsWith("px")){const e=Number.parseFloat(r);return Number.isFinite(e)?e:null}if(r.endsWith("rem")){const e=Number.parseFloat(r);return Number.isFinite(e)?e*n:null}return null}function b(e,t){let n=-1,r=1/0;for(let i=0;i<e.length;i+=1){const o=Math.abs(e[i].offset-t);o<r&&(r=o,n=i)}return n}function S({snapPoints:e,currentOffset:t,popupHeight:n,dragDelta:r,directionalVelocity:i,snapToSequentialPoints:o}){if(!e.length||n<=0)return{type:"stay"};const s=Math.sign(r),a=w(t+r,0,n),l=Math.abs(i)>=.5?300*w(i,-4,4):0,c=o?a:w(a+l,0,n),u=[...e].sort(((e,t)=>e.offset-t.offset));let d=function(e,t){const n=b(e,t);return-1===n?null:e[n]}(u,c),p=c;if(o){const e=b(u,t);if(0!==s&&Math.sign(i)===s&&Math.abs(i)>=.5){const t=w(e+s,0,u.length-1);if(t!==e){const e=u[t];(s>0?c<e.offset:c>e.offset)&&(d=e,p=e.offset)}else if(s>0)return{type:"close",snapPoint:d}}}else if(i>=.5&&r>0)return{type:"close",snapPoint:d};return Math.abs(p-n)<(d?Math.abs(p-d.offset):1/0)?{type:"close",snapPoint:d}:{type:"settle",snapPoint:d}}const D=e({depth:0,onChildOpenChange:()=>{},onChildSwipingChange:()=>{}});function O(e,t){const n="open"===t?500:400;if(!e||"undefined"==typeof window||!window.getComputedStyle)return n;const r="open"===t?"--rad-ui-drawer-open-duration":"--rad-ui-drawer-close-duration";return function(e){if(!e)return null;const t=e.trim();if(!t||"auto"===t||"normal"===t)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith("ms")?n:t.endsWith("s")?1e3*n:n:null}(window.getComputedStyle(e).getPropertyValue(r))??n}function T(e,t,n){return new Promise((r=>{if(n?.aborted||!e)return void r();let i,o,s,a=!1;const l=()=>{a||(a=!0,void 0!==i&&clearTimeout(i),void 0!==o&&cancelAnimationFrame(o),n&&s&&n.removeEventListener("abort",s),r())},c=e;if("function"!=typeof c.getAnimations)i=setTimeout(l,t);else{let e=[];try{e=c.getAnimations()}catch{e=[]}i=setTimeout(l,t),e.length?Promise.all(e.map((e=>e.finished.catch((()=>{}))))).then(l):o=requestAnimationFrame(l)}n&&(s=l,n.addEventListener("abort",s))}))}const N="Drawer",M=n((({children:e,customRootClass:n="",className:m="",defaultOpen:f=!1,open:h,onOpenChange:v,onOpenChangeComplete:y,snapPoints:w=[],defaultSnapPoint:P=null,snapPoint:C,onSnapPointChange:x,snapToSequentialPoints:b=!1,modal:S=!0,disablePointerDismissal:M=!1,swipeDirection:F="right",triggerId:E,defaultTriggerId:I,actionsRef:H},Y)=>{const A=c(n,N),X=r((()=>function(e){switch(e){case"up":return"top";case"down":return"bottom";default:return e}}(F)),[F]),q=r((()=>function(e){switch(e){case"top":return"up";case"bottom":return"down";default:return e}}(X)),[X]),$=t(D),k=void 0!==h,[L,j]=i(f),R=k?h:L;d(R);const z=o(R);z.current=R;const W=o(null),V=o(!1),K=o(M);s((()=>{K.current=M}),[M]);const[B,Z]=i(!1),U=a(((e="close-press")=>{V.current=!0,W.current=e}),[]),G=a(((e,t)=>{const n=W.current??(e?"trigger-press":"none");W.current=null;const r=V.current;if(V.current=!1,!e&&K.current&&!r)return;let i=!1,o=!1;const s={reason:n,cancel:()=>{i=!0},get isCanceled(){return i},preventUnmountOnClose:()=>{o=!0},event:t};v&&(v.length<=1?v(e):v(e,s)),i||(o&&Z(!0),k||j(e))}),[k,v]);s((()=>{R&&Z(!1)}),[R]);const J=void 0!==C,[Q,_]=i(P??(w.length>0?w[0]:null)),ee=J?C:Q,te=a((e=>{J||_(e),x?.(e)}),[J,x]),[ne,re]=i(0),ie=a((e=>{re((t=>t===e?t:e))}),[]),oe=a((e=>{H&&"current"in H&&(H.current=e)}),[H]);s((()=>{if(!H)return;oe({close:()=>{U("imperative-action"),G(!1)},unmount:()=>{Z(!1),z.current&&!k&&(U("imperative-action"),G(!1)),_(P??w[0]??null)}})}),[H,P,G,k,U,oe,w]);const se=o(null),ae=a((e=>{se.current=e}),[]),le=o(y);le.current=y,s((()=>{const e=new AbortController,t=R,n=requestAnimationFrame((()=>{const n=se.current;le.current&&T(n,O(n,t?"open":"close"),e.signal).then((()=>{e.signal.aborted||le.current?.(z.current)}))}));return()=>{e.abort(),cancelAnimationFrame(n)}}),[R]);const ce=o(!1);s((()=>{R&&!ce.current?(ce.current=!0,$.onChildOpenChange(!0)):!R&&ce.current&&(ce.current=!1,$.onChildOpenChange(!1))}),[R,$]),s((()=>()=>{ce.current&&($.onChildOpenChange(!1),ce.current=!1)}),[]);const[ue,de]=i(0),pe=a((e=>{de((t=>Math.max(0,t+(e?1:-1)))),$.onChildOpenChange(e)}),[$]),[me,fe]=i(!1),he=a((e=>{fe(e),$.onChildSwipingChange(e)}),[$]);s((()=>{ue||fe(!1)}),[ue]);const ge=he,ve=r((()=>({depth:$.depth+1,onChildOpenChange:pe,onChildSwipingChange:he})),[pe,he,$.depth]),ye=a(((e,t)=>{U(e),G(!1,t)}),[G,U]),[we,Pe]=i(void 0),[Ce,xe]=i(void 0),be=a((e=>{Pe((t=>t===e?t:e))}),[]),Se=a((e=>{xe((t=>t===e?t:e))}),[]),De=r((()=>({rootClass:A,side:X,dismissDirection:q,isOpen:R,onOpen:()=>G(!0),snapPoints:w,activeSnapPoint:ee,setActiveSnapPoint:te,snapToSequentialPoints:b,popupHeight:ne,setPopupHeight:ie,modal:S,disablePointerDismissal:M,registerContentElement:ae,shouldKeepMounted:B,requestClose:ye,markIntentionalClose:U,childOpenCount:ue,nestedSwiping:me,setNestedSwiping:ge,titleId:we,descriptionId:Ce,setTitleId:be,setDescriptionId:Se,depth:$.depth})),[ee,ue,Ce,q,M,G,B,R,U,S,$.depth,ne,ae,ye,A,te,Se,ge,ie,be,X,w,b,me,we]);return l(D.Provider,{value:ve,children:l(p.Root,{ref:Y,open:R,onOpenChange:G,className:u(A,m),disablePointerDismissal:M,children:l(g.Provider,{value:De,children:e})})})}));M.displayName=N;const F=n((({children:e,asChild:n,className:r="",...i},o)=>{const{rootClass:s}=t(g);return l(p.Trigger,{ref:o,className:u(s&&`${s}-trigger`,r),asChild:n,...i,children:e})}));F.displayName="DrawerTrigger";const E=n((({children:e,...t},n)=>l(p.Portal,{...t,children:e})));E.displayName="DrawerPortal";const I=n((({className:e="",forceMount:n=!1,...r},a)=>{const{rootClass:c,modal:d,disablePointerDismissal:p,markIntentionalClose:h}=t(g),{isOpen:v,handleOverlayClick:y}=t(m),[w,P]=i(v),[C,x]=i(v?"open":"closed"),b=o(null);if(s((()=>(b.current&&clearTimeout(b.current),v?(P(!0),requestAnimationFrame((()=>{requestAnimationFrame((()=>x("open")))}))):(x("closed"),b.current=setTimeout((()=>{P(!1)}),400)),()=>{b.current&&clearTimeout(b.current)})),[v]),!w&&!n)return null;const S=p?void 0:()=>{h(),y()},D=!0===d;return l(f.Overlay,{lockScroll:v&&D,ref:a,onClick:S,"data-state":C,style:!1===d?{pointerEvents:"none",background:"transparent"}:void 0,className:u(c&&`${c}-overlay`,e),...r})}));I.displayName="DrawerOverlay";const H=e({element:null,height:0,resolvedSnapPoints:[],activeSnapPointOffset:0,activeSnapPoint:null,setActiveSnapPoint:()=>{},expanded:!1,dismissDirection:"right",pointerProps:{onPointerDown:()=>{}},touchProps:{onTouchStart:()=>{},onTouchMove:()=>{},onTouchEnd:()=>{},onTouchCancel:()=>{}}});function Y(){return"undefined"==typeof window?0:window.innerHeight||document.documentElement.clientHeight||0}function A(){if("undefined"==typeof window)return 16;const e=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:16}function X(e,t,n,o){const a="up"===t||"down"===t,[l,c]=i(0),[u,d]=i(16);s((()=>{if(!a||!e.length)return;c(Y()),d(A());const t=()=>{c(Y()),d(A())};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[e.length,a]);const p=r((()=>a&&e.length?function(e,t,n,r){if(!e.length||n<=0)return[];const i=Math.min(n,t||n),o=e.map((e=>{const o=x(e,t,r);if(null===o)return null;const s=w(o,0,i);return{value:e,height:s,offset:Math.max(0,n-s)}})).filter((e=>null!==e));if(o.length<2)return o;const s=[];for(let e=o.length-1;e>=0;e-=1){const t=o[e];s.some((e=>Math.abs(e.height-t.height)<=1))||s.push(t)}return s.reverse()}(e,l||n,n,u):[]),[n,u,e,a,l]);return r((()=>{if(!p.length||null===o)return{resolved:p,active:null,activeOffset:0,expanded:!1};const e=p.find((e=>Object.is(e.value,o)));if(e)return{resolved:p,active:e,activeOffset:e.offset,expanded:1===o};const t=x(o,l||n,u);if(null===t)return{resolved:p,active:null,activeOffset:0,expanded:!1};const r=w(t,0,n||l||t),i=Math.max(0,(n||r)-r);return{resolved:p,active:null,activeOffset:i,expanded:1===o}}),[o,n,p,u,l])}function q(e){return e.timeStamp>0?e.timeStamp:performance.now()}function $(e,t){let n=e;for(;n&&n!==t;){const e=window.getComputedStyle(n),t=("auto"===e.overflowY||"scroll"===e.overflowY)&&n.scrollHeight>n.clientHeight,r=("auto"===e.overflowX||"scroll"===e.overflowX)&&n.scrollWidth>n.clientWidth;if(t||r)return{element:n,axis:t?"y":"x"};n=n.parentElement}return null}function k(e,t,n){return"y"===t?"down"===n?e.scrollTop<=0:e.scrollTop>=e.scrollHeight-e.clientHeight:"right"===n?e.scrollLeft<=0:e.scrollLeft>=e.scrollWidth-e.clientWidth}let L=!1;function j(e){const{elementRef:t,dismissDirection:n,axis:r,enabled:l,disabledByNestedDrawer:c=!1,snapPoints:u,popupHeight:d=0,activeSnapPointOffset:p=0,snapToSequentialPoints:m=!1,onDismiss:f,onSettle:h,onSwipingChange:g,onProgress:x}=e,[b,D]=i(!1),[O,T]=i(!1),N=o(null),M=o(0),F=o(null),E=o(null),I=o(null),H=o(null),Y=o({onDismiss:f,onSettle:h,onSwipingChange:g,onProgress:x});Y.current={onDismiss:f,onSettle:h,onSwipingChange:g,onProgress:x};const A=l&&!c,X=Boolean(u?.length)&&!("left"===(j=n)||"right"===j);var j;s((()=>{if(!u||u.length<2)return void(H.current=null);const e=u.map((e=>e.offset)).sort(((e,t)=>e-t)),t=e[1]-e[0];H.current=t>0?{min:e[0],range:t}:null}),[u]);const R=a((e=>{D(e),Y.current.onSwipingChange?.(e)}),[]),z=a((e=>{const n=t.current;n&&(X?n.style.setProperty(v.movementY,`${function(e,t){const n=e+t;return n>=0?t:-Math.sqrt(-n)-e}(p,e)}px`):"x"===r?n.style.setProperty(v.movementX,`${e}px`):n.style.setProperty(v.movementY,`${e}px`))}),[p,r,t,X]),W=a((e=>{const r=t.current;if(!r)return;const i=H.current;let o;if(i){const t=w((p||i.min)+e,0,d||p+i.range);o=w((t-i.min)/i.range,0,1)}else{const t=C(r,n);o=t>0?w(1-Math.max(0,e)/t,0,1):1}r.style.setProperty(v.progress,String(o)),Y.current.onProgress?.(o)}),[p,n,t,d]),V=a((()=>{const e=t.current;e&&(e.style.removeProperty(v.movementX),e.style.removeProperty(v.movementY),e.style.removeProperty(v.strength),e.style.setProperty(v.progress,"1"))}),[t]),K=a(((e,t,r)=>{const i=F.current;if(F.current={x:e,y:t,time:r},!i)return 0;const o=Math.max(r-i.time,16);return P(n,(e-i.x)/o,(t-i.y)/o)}),[n]),B=a((()=>{const e=t.current;if(M.current=0,R(!1),!e)return void T(!1);I.current&&clearTimeout(I.current),T(!0),V(),Y.current.onProgress?.(1);const n=()=>{e.removeEventListener("transitionend",n),T(!1)};e.addEventListener("transitionend",n),I.current=setTimeout(n,400)}),[V,t,R]),Z=a(((e,r)=>{const i=t.current;if(R(!1),!i)return;const o=function({element:e,direction:t,displacement:n,velocity:r,snapPointOffset:i=0}){const o=C(e,t);if(o<=0)return null;const s=Math.max(0,o-(i+n));if(s<=0)return null;if(r<=.2)return null;const a=w(r,.2,4);return.1+(w(s/a,80,360)-80)/280*.9}({element:i,direction:n,displacement:r,velocity:e,snapPointOffset:X?p:0});null!==o&&i.style.setProperty(v.strength,String(o))}),[p,n,t,R,X]),U=a(((e,t)=>{N.current={start:e,startDisplacement:M.current,startTime:t,axis:null,dragging:!1},M.current=0,F.current={...e,time:t},R(!0)}),[R]),G=a(((e,t)=>{const r=P(n,e,t),i=(X?p:0)+r;let o;var s;i<0?(s=i,o=Math.sign(s)*Math.sqrt(Math.abs(s))):o=r<0?.2*- -r:r,M.current=o,z(o),W(o)}),[p,n,X,z,W]),J=a(((e,r)=>{const i=N.current;if(N.current=null,E.current=null,!i)return void R(!1);if(!i.dragging)return M.current=0,void R(!1);const o=M.current;M.current=0;const s=e.x-i.start.x,a=e.y-i.start.y,l=P(n,s,a),c=r-i.startTime,f=c>0?P(n,s/Math.max(c,50),a/Math.max(c,50)):0;let h=0;const g=F.current;if(g){const t=r-g.time;if(t<=80){const r=Math.max(t,16);h=P(n,(e.x-g.x)/r,(e.y-g.y)/r)}}const v=0!==h?h:f;if(u?.length){const e=S({snapPoints:u,currentOffset:p,popupHeight:d,dragDelta:l,directionalVelocity:v,snapToSequentialPoints:m});if("close"===e.type)return Y.current.onSettle?.(e.snapPoint),Z(v,o),void Y.current.onDismiss();if("settle"===e.type)return Y.current.onSettle?.(e.snapPoint),void B()}const y=t.current,w=y?function(e,t){return Math.max(.5*C(e,t),10)}(y,n):0;h>0&&h>=.5||l>=w?(Z(v,o),Y.current.onDismiss()):B()}),[p,Z,n,t,d,B,u,m,R]),Q=a((e=>{if(!A||0!==e.button)return;if("touch"===e.pointerType)return;const r=e.target;if(r?.closest?.(y))return;if(r?.closest?.('button,a,input,select,textarea,label,summary,[role="button"],[role="slider"],[contenteditable="true"],[data-no-drag]'))return;const i=t.current;if(!i)return;const o=$(r,i);o&&!k(o.element,o.axis,n)||(e.currentTarget.setPointerCapture?.(e.pointerId),E.current=!0,U({x:e.clientX,y:e.clientY},q(e)))}),[A,n,t,U]);s((()=>{const e=t.current;if(!e||!A)return;L||(L=!0,"undefined"!=typeof CSS&&"function"==typeof CSS.registerProperty&&[{name:v.movementX,syntax:"<length>",initialValue:"0px"},{name:v.movementY,syntax:"<length>",initialValue:"0px"},{name:v.snapPointOffset,syntax:"<length>",initialValue:"0px"},{name:v.progress,syntax:"<number>",initialValue:"1"},{name:v.strength,syntax:"<number>",initialValue:"1"}].forEach((e=>{try{CSS.registerProperty({...e,inherits:!1})}catch{}})));let n=null;const i=e=>{const t=N.current;if(!t||null!==n&&e.pointerId!==n)return;if("touch"===e.pointerType)return;null===n&&(n=e.pointerId);const i=e.clientX-t.start.x,o=e.clientY-t.start.y,s="x"===r?Math.abs(i):Math.abs(o),a="x"===r?Math.abs(o):Math.abs(i);if(null===t.axis){if(s<6)return;if(a>s)return N.current=null,E.current=null,void R(!1);t.axis=r}t.dragging=!0,K(e.clientX,e.clientY,q(e)),G(i,o)},o=e=>{null!==n&&e.pointerId!==n||(n=null,J({x:e.clientX,y:e.clientY},q(e)))},s=()=>{n=null,N.current=null,M.current=0,B()};return e.addEventListener("pointermove",i),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",s)}}),[A,G,r,t,J,K,R,B]);const _=a((e=>{const r=e.touches[0];if(!A||!r)return void(E.current=!1);const i=e.target;if(i?.closest?.(y))return void(E.current=!1);const o=t.current;if(!o)return void(E.current=!1);const s=$(i,o);E.current=!(s&&!k(s.element,s.axis,n))&&null,!1!==E.current&&U({x:r.clientX,y:r.clientY},q(e))}),[A,n,t,U]),ee=a((e=>{const t=N.current;if(!1===E.current)return;if(!t)return;const i=e.touches[0];if(!i)return;const o=i.clientX-t.start.x,s=i.clientY-t.start.y,a="x"===r?o:s,l="x"===r?s:o;if(null===t.axis){if(Math.abs(a)<6)return;if(Math.abs(l)>Math.abs(a))return E.current=!1,N.current=null,void R(!1);t.axis=r}if(P(n,o,s)<0)return E.current=!1,N.current=null,void R(!1);E.current=!0,t.dragging=!0,e.cancelable&&e.preventDefault(),K(i.clientX,i.clientY,q(e)),G(o,s)}),[G,r,n,K,R]),te=a((e=>{const t=e.changedTouches[0];if(!t)return N.current=null,void B();J({x:t.clientX,y:t.clientY},q(e))}),[J,B]),ne=a((()=>{E.current=!1,N.current=null,M.current=0,B()}),[B]);return s((()=>()=>{I.current&&clearTimeout(I.current)}),[]),s((()=>{A||(N.current=null,E.current=null,M.current=0,F.current=null,R(!1))}),[A,R]),s((()=>{if(l)return;t.current&&V()}),[V,t,l]),{swiping:b,isSnapping:O,pointerProps:{onPointerDown:Q},touchProps:{onTouchStart:_,onTouchMove:ee,onTouchEnd:te,onTouchCancel:ne}}}const R=n((({children:e,className:n="",asChild:c=!1,forceMount:d=!1,role:p="dialog","aria-modal":y,"aria-labelledby":w,"aria-describedby":P,initialFocus:C=0,finalFocus:x,disableSwipeDismiss:b=!1,style:S,...D},N)=>{const{rootClass:M,side:F,dismissDirection:E,isOpen:I,modal:Y,snapPoints:A,activeSnapPoint:q,setActiveSnapPoint:$,snapToSequentialPoints:k,setPopupHeight:L,registerContentElement:R,shouldKeepMounted:z,requestClose:W,childOpenCount:V,nestedSwiping:K,setNestedSwiping:B,titleId:Z,descriptionId:U}=t(g),{getFloatingProps:G,refs:J,floaterContext:Q}=t(m),_=o(null),[ee,te]=i(null),[ne,re]=i(I?"open":"closed"),ie=a((e=>{_.current=e,te(e),R(e)}),[R]),oe=f.useMergeRefs([J.setFloating,ie,N]);s((()=>{if(!ee)return;const e=()=>L(ee.offsetHeight);if(e(),"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(e);return t.observe(ee),()=>t.disconnect()}),[ee,L]);const se=ee?.offsetHeight??0,{resolved:ae,activeOffset:le,expanded:ce}=X(A,E,se,q),ue=function(e){return"left"===e||"right"===e?"x":"y"}(F),de=a((()=>{W("swipe")}),[W]),pe=a((e=>{$(e?e.value:null)}),[$]),{swiping:me,isSnapping:fe,pointerProps:he,touchProps:ge}=j({elementRef:_,dismissDirection:E,axis:ue,enabled:I&&!b,disabledByNestedDrawer:V>0,snapPoints:ae,popupHeight:se,activeSnapPointOffset:le,snapToSequentialPoints:k,onDismiss:de,onSettle:pe,onSwipingChange:B}),ve=I||d||z,[ye,we]=i(I);s((()=>{if(ve)return void we(!0);const e=new AbortController;return T(ee,O(ee,"close"),e.signal).then((()=>{e.signal.aborted||we(!1)})),()=>e.abort()}),[ee,ve]),s((()=>{if(!ye)return void re("closed");if(!I)return void re("closed");const e=requestAnimationFrame((()=>re("open")));return()=>cancelAnimationFrame(e)}),[I,ye]),s((()=>{if(I||!x?.current)return;const e=requestAnimationFrame((()=>{x.current?.focus()}));return()=>cancelAnimationFrame(e)}),[x,I]);const Pe=y??!1!==Y,Ce=w??Z,xe=P??U,be={outline:"none",[v.nestedDrawers]:String(V),[v.height]:se>0?`${se}px`:void 0,[v.snapPointOffset]:`${le}px`,...V>0?{"--drawer-peek-offset":20*V+"px"}:{},...S},Se=r((()=>({element:ee,height:se,resolvedSnapPoints:ae,activeSnapPointOffset:le,activeSnapPoint:q,setActiveSnapPoint:$,expanded:ce,dismissDirection:E,pointerProps:he,touchProps:ge})),[q,le,E,ee,ce,he,se,ae,$,ge]),{style:De,...Oe}=G()??{};if(!ye)return null;const Te=!1!==Y;return l(H.Provider,{value:Se,children:l(f.FocusManager,{context:Q,disabled:!I||"open"!==ne,modal:Te,initialFocus:C,returnFocus:!x,children:l(h.div,{ref:oe,asChild:c,...Oe,...he,...ge,style:be,role:p,"aria-modal":Pe,"aria-hidden":I?void 0:"true","aria-labelledby":I?Ce:void 0,"aria-describedby":I?xe:void 0,"data-state":ne,"data-swipe-direction":F,"data-swiping":me?"true":void 0,"data-snapping":fe?"true":void 0,"data-swipe-dismiss":b?void 0:"","data-expanded":ae.length>0?ce?"true":"false":void 0,"data-child-open":V>0?"true":void 0,"data-nested-drawer-open":V>0?"true":void 0,"data-nested-drawer-swiping":K?"true":void 0,className:u(M&&`${M}-content`,n),...D,children:l("div",{className:u(M&&`${M}-content-inner`),children:e})})})})}));R.displayName="DrawerContent";const z=n((({children:e,className:n="",id:r,...i},o)=>{const{rootClass:a,setTitleId:c}=t(g),d=f.useId(),p=i.id??r??d;return s((()=>(c(p),()=>c(void 0))),[c,p]),l(h.h2,{ref:o,id:p,className:u(a&&`${a}-title`,n),...i,children:e})}));z.displayName="DrawerTitle";const W=n((({children:e,className:n="",id:r,...i},o)=>{const{rootClass:a,setDescriptionId:c}=t(g),d=f.useId(),p=i.id??r??d;return s((()=>(c(p),()=>c(void 0))),[c,p]),l(h.p,{ref:o,id:p,className:u(a&&`${a}-description`,n),...i,children:e})}));W.displayName="DrawerDescription";const V=n((({children:e,asChild:n,className:r="",onClick:i,...o},s)=>{const{rootClass:a,markIntentionalClose:c}=t(g);return l(p.Cancel,{ref:s,className:u(a&&`${a}-close`,r),asChild:n,onClick:e=>{c(),i?.(e)},...o,children:e})}));V.displayName="DrawerClose";const K=n((({className:e=""},n)=>{const{rootClass:r}=t(g),{pointerProps:i,touchProps:o,dismissDirection:s}=t(H),c=a((e=>{"Escape"!==e.key&&"Enter"!==e.key&&" "!==e.key||e.preventDefault()}),[]);return l("div",{ref:n,"aria-hidden":"true","data-direction":s,onKeyDown:c,className:u(r&&`${r}-handle`,e),...i,...o,children:l("div",{className:`${r}-handle-grip`,"aria-hidden":"true"})})}));K.displayName="DrawerHandle";const B=n((({className:e="",openThreshold:n=48,size:r=20,children:i,style:s,disabled:c=!1,...d},p)=>{const{rootClass:m,side:f,isOpen:h,onOpen:v}=t(g),y=o(null),w=o(0),P=o(null),C=a(((e,t)=>{switch(f){case"right":return-e;case"left":return e;case"bottom":return-t;case"top":return t}}),[f]),x=a((e=>{const t=P.current;if(!t)return;const n=8*e;switch(f){case"right":t.style.transform=`translateX(${-n}px)`;break;case"left":t.style.transform=`translateX(${n}px)`;break;case"bottom":t.style.transform=`translateY(${-n}px)`;break;case"top":t.style.transform=`translateY(${n}px)`}t.style.setProperty("--swipe-progress",String(e))}),[f]),b=a((e=>{const t=P.current;if(t&&(e&&(t.style.transition="transform var(--rad-ui-motion-duration-normal) var(--rad-ui-motion-easing-standard)"),t.style.transform="",t.style.removeProperty("--swipe-progress"),e)){const e=()=>{t.style.transition="",t.removeEventListener("transitionend",e)};t.addEventListener("transitionend",e)}}),[]),S=a((e=>{if(0!==e.button||h)return;e.currentTarget.setPointerCapture(e.pointerId),y.current={startX:e.clientX,startY:e.clientY},w.current=0;const t=P.current;t&&(t.style.transition="none")}),[h]),D=a((e=>{if(!y.current)return;const t=e.clientX-y.current.startX,r=e.clientY-y.current.startY,i=Math.max(0,C(t,r)),o=Math.min(i/n,1);w.current=o,x(o)}),[C,n,x]),O=a((()=>{y.current&&(y.current=null,w.current>=1?(b(!1),v()):b(!0),w.current=0)}),[v,b]),T=a((()=>{y.current&&(y.current=null,w.current=0,b(!0))}),[b]),N=(()=>{const e={position:"fixed",zIndex:"var(--rad-ui-z-index-overlay)",touchAction:"none",userSelect:"none"};switch(f){case"right":return{...e,top:0,right:0,bottom:0,width:r};case"left":return{...e,top:0,left:0,bottom:0,width:r};case"bottom":return{...e,left:0,bottom:0,right:0,height:r};case"top":return{...e,left:0,top:0,right:0,height:r}}})();return c||h?null:l("div",{ref:e=>{P.current=e,"function"==typeof p?p(e):p&&(p.current=e)},"aria-hidden":"true","data-direction":f,onPointerDown:S,onPointerMove:D,onPointerUp:O,onPointerCancel:T,style:{...N,...s},className:u(m&&`${m}-swipe-zone`,e),...d,children:i})}));B.displayName="DrawerSwipeZone";const Z=n(((e,t)=>(console.warn("Direct usage of Drawer is not supported. Please use Drawer.Root, Drawer.Content, etc. instead."),null)));Z.displayName="Drawer";const U=Z;U.Root=M,U.Trigger=F,U.Portal=E,U.Overlay=I,U.Content=R,U.Title=z,U.Description=W,U.Close=V,U.Handle=K,U.SwipeZone=B;export{V as Close,R as Content,W as Description,K as Handle,I as Overlay,E as Portal,M as Root,B as SwipeZone,z as Title,F as Trigger,U as default};
@@ -28,12 +28,6 @@ declare const DropdownMenuRoot: React.ForwardRefExoticComponent<{
28
28
  rtl?: boolean;
29
29
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
30
 
31
- type MenuPrimitiveTriggerProps = {
32
- children: React.ReactNode;
33
- className?: string;
34
- asChild?: boolean;
35
- };
36
-
37
31
  type DropdownMenuTriggerProps = {
38
32
  children: React.ReactNode;
39
33
  className?: string;
@@ -41,12 +35,11 @@ type DropdownMenuTriggerProps = {
41
35
  declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<{
42
36
  children: React.ReactNode;
43
37
  className?: string;
44
- } & Omit<MenuPrimitiveTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
45
-
46
- type MenuPrimitiveContentProps = {
38
+ } & Omit<{
47
39
  children: React.ReactNode;
48
40
  className?: string;
49
- };
41
+ asChild?: boolean;
42
+ } & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "children"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
50
43
 
51
44
  type DropdownMenuContentProps = {
52
45
  children: React.ReactNode;
@@ -55,7 +48,12 @@ type DropdownMenuContentProps = {
55
48
  declare const DropdownMenuContent: React.ForwardRefExoticComponent<{
56
49
  children: React.ReactNode;
57
50
  className?: string;
58
- } & Omit<MenuPrimitiveContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
51
+ } & Omit<{
52
+ children: React.ReactNode;
53
+ className?: string;
54
+ initialFocus?: number;
55
+ focusManagerDisabled?: boolean;
56
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
59
57
 
60
58
  type DropdownMenuPortalProps = {
61
59
  children: React.ReactNode;
@@ -66,15 +64,6 @@ declare const DropdownMenuPortal: React.ForwardRefExoticComponent<{
66
64
  children: React.ReactNode;
67
65
  } & _floating_ui_react.FloatingPortalProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
68
66
 
69
- type MenuPrimitiveItemProps = {
70
- children: React.ReactNode;
71
- className?: string;
72
- label?: string;
73
- disabled?: boolean;
74
- asChild?: boolean;
75
- onSelect?: (event: React.MouseEvent<HTMLButtonElement>) => void;
76
- };
77
-
78
67
  type DropdownMenuItemProps = {
79
68
  children: React.ReactNode;
80
69
  className?: string;
@@ -84,7 +73,14 @@ declare const DropdownMenuItem: React.ForwardRefExoticComponent<{
84
73
  children: React.ReactNode;
85
74
  className?: string;
86
75
  label?: string;
87
- } & Omit<MenuPrimitiveItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
76
+ } & Omit<{
77
+ children: React.ReactNode;
78
+ className?: string;
79
+ label?: string;
80
+ disabled?: boolean;
81
+ asChild?: boolean;
82
+ onSelect?: (event: React.MouseEvent<HTMLButtonElement>) => void;
83
+ } & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "children" | "onSelect" | "disabled"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
88
84
 
89
85
  type DropdownMenuSubProps = {
90
86
  children: React.ReactNode;
@@ -122,7 +118,11 @@ type DropdownMenuSubTriggerProps = {
122
118
  declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<{
123
119
  children: React.ReactNode;
124
120
  className?: string;
125
- } & Omit<MenuPrimitiveTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
121
+ } & Omit<{
122
+ children: React.ReactNode;
123
+ className?: string;
124
+ asChild?: boolean;
125
+ } & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "children"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
126
126
 
127
127
  type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
128
128
  type SeparatorProps = {
@@ -152,5 +152,5 @@ type DropdownMenuComponent = React.ForwardRefExoticComponent<DropdownMenuProps &
152
152
  };
153
153
  declare const DropdownMenu: DropdownMenuComponent;
154
154
 
155
- export { DropdownMenu as default };
155
+ export { DropdownMenuContent as Content, DropdownMenuItem as Item, DropdownMenuPortal as Portal, DropdownMenuRoot as Root, DropdownMenuSeparator as Separator, DropdownMenuSub as Sub, DropdownMenuSubTrigger as SubTrigger, DropdownMenuTrigger as Trigger, DropdownMenu as default };
156
156
  export type { DropdownMenuContentProps, DropdownMenuElement, DropdownMenuItemProps, DropdownMenuPortalProps, DropdownMenuProps, DropdownMenuRootProps, DropdownMenuSeparatorProps, DropdownMenuSubProps, DropdownMenuSubTriggerProps, DropdownMenuTriggerProps };
@@ -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-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};
1
+ 'use client';import o,{forwardRef as e}from"react";import{jsx as n}from"react/jsx-runtime";import{M as r}from"./MenuPrimitive-D9VMz2TZ.js";import{u as t,c as s}from"./useComponentClass-C0isGl1z.js";import a from"./Separator.js";import"./index-D8I-rMwz.js";import"./floating-ui.react-2kiGB4sW.js";import"react-dom";import"./index-wRElCyvx.js";import"./index-CBcSLg6O.js";import"./index-CbNq68zs.js";import"./documentOverlayOpen-coyGmcyL.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./index-FITGoHty.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 g=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})}));g.displayName="DropdownMenuSeparator";const M=e(((o,e)=>(console.warn("Direct usage of DropdownMenu is not supported. Please use DropdownMenu.Root, DropdownMenu.Item instead."),null)));M.displayName="DropdownMenu",M.Root=i,M.Trigger=d,M.Content=c,M.Portal=p,M.Item=m,M.Sub=w,M.SubTrigger=h,M.Separator=g;export{c as Content,m as Item,p as Portal,i as Root,g as Separator,w as Sub,h as SubTrigger,d as Trigger,M as default};
@@ -1 +1 @@
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
+ 'use client';import{jsx as e}from"react/jsx-runtime";import s from"react";import{u as r,c as m}from"./useComponentClass-C0isGl1z.js";import"./ThemeContext-Sm-iNANd.js";const o=s.forwardRef((({children:s,customRootClass:o,className:t,...a},c)=>{const n=r(o,"Em");return e("em",{ref:c,className:m(n,t),...a,children:s})}));o.displayName="Em";export{o as default};
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+
3
+ type FieldsetRootElement = HTMLFieldSetElement;
4
+ type FieldsetRootProps = {
5
+ customRootClass?: string;
6
+ color?: string;
7
+ size?: string;
8
+ variant?: string;
9
+ invalid?: boolean;
10
+ } & React.ComponentPropsWithoutRef<'fieldset'>;
11
+ declare const FieldsetRoot: React.ForwardRefExoticComponent<{
12
+ customRootClass?: string;
13
+ color?: string;
14
+ size?: string;
15
+ variant?: string;
16
+ invalid?: boolean;
17
+ } & Omit<React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref"> & React.RefAttributes<HTMLFieldSetElement>>;
18
+
19
+ type FieldsetLegendProps = React.ComponentPropsWithoutRef<'legend'>;
20
+ declare const FieldsetLegend: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>, "ref"> & React.RefAttributes<HTMLLegendElement>>;
21
+
22
+ type FieldsetDescriptionProps = React.ComponentPropsWithoutRef<'p'>;
23
+ declare const FieldsetDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
24
+
25
+ type FieldsetMessageProps = {
26
+ invalid?: boolean;
27
+ } & React.ComponentPropsWithoutRef<'p'>;
28
+ declare const FieldsetMessage: React.ForwardRefExoticComponent<{
29
+ invalid?: boolean;
30
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
31
+
32
+ declare const COMPONENT_NAME = "Fieldset";
33
+ type FieldsetProps = FieldsetRootProps;
34
+ type FieldsetComponent = React.ForwardRefExoticComponent<FieldsetProps & React.RefAttributes<FieldsetRootElement>> & {
35
+ Root: typeof FieldsetRoot;
36
+ Legend: typeof FieldsetLegend;
37
+ Description: typeof FieldsetDescription;
38
+ Message: typeof FieldsetMessage;
39
+ };
40
+ declare const Fieldset: FieldsetComponent;
41
+
42
+ export { COMPONENT_NAME, FieldsetDescription as Description, FieldsetLegend as Legend, FieldsetMessage as Message, FieldsetRoot as Root, Fieldset as default };
43
+ export type { FieldsetDescriptionProps, FieldsetLegendProps, FieldsetMessageProps, FieldsetProps, FieldsetRootProps };
@@ -0,0 +1 @@
1
+ 'use client';import{jsx as e}from"react/jsx-runtime";import s,{forwardRef as a,useContext as i}from"react";import{u as t,c as d}from"./useComponentClass-C0isGl1z.js";import{c as l,a as o,b as r}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const n=s.createContext({rootClass:"",invalid:!1}),c=e=>{const{registerDescription:a}=s.useContext(n);s.useEffect((()=>{if(a&&e)return a(e)}),[a,e])},m="Fieldset",f=a((({children:a,className:i="",customRootClass:c="",color:f="",disabled:p=!1,invalid:u=!1,size:v="",variant:g="","aria-describedby":N,...C},h)=>{const b=t(c,m),[y,x]=s.useState([]),j=s.useCallback((e=>(x((s=>s.includes(e)?s:[...s,e])),()=>x((s=>s.filter((s=>s!==e)))))),[]),D=[N,...y].filter(Boolean).join(" ")||void 0,F=s.useMemo((()=>({rootClass:b,invalid:u,registerDescription:j})),[b,u,j]),M=l("fieldset",{disabled:p,invalid:u,size:v,variant:g}),L=r(f),R=o(M,L,{"aria-invalid":u||void 0,"aria-describedby":D,"data-slot":"fieldset-root"});return e(n.Provider,{value:F,children:e("fieldset",{ref:h,className:d(b,i),...C,disabled:p,...R,children:a})})}));f.displayName=m;const p=a((({children:s,className:a,...t},l)=>{const{rootClass:o}=i(n);return e("legend",{ref:l,className:d(o&&`${o}-legend`,a),...t,"data-slot":"fieldset-legend",children:s})}));p.displayName="FieldsetLegend";const u=a((({children:a,className:t,id:l,...o},r)=>{const m=s.useId(),f=l??m;c(f);const{rootClass:p}=i(n);return e("p",{ref:r,id:f,className:d(p&&`${p}-description`,t),...o,"data-slot":"fieldset-description",children:a})}));u.displayName="FieldsetDescription";const v=a((({children:a,className:t,id:l,invalid:o,role:r,...m},f)=>{const p=s.useId(),u=l??p;c(u);const{rootClass:v,invalid:g}=i(n),N=o??g;return e("p",{ref:f,id:u,className:d(v&&`${v}-message`,t),...m,role:r??(N?"alert":void 0),"data-invalid":N?"":void 0,"data-slot":"fieldset-message",children:a})}));v.displayName="FieldsetMessage";const g="Fieldset",N=a(((s,a)=>e(f,{ref:a,...s})));N.displayName=g,N.Root=f,N.Legend=p,N.Description=u,N.Message=v;export{g as COMPONENT_NAME,u as Description,p as Legend,v as Message,f as Root,N as default};