@radui/ui 0.4.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/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 +8 -4
- 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 +1 -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 +12 -1
- package/dist/components/ComboboxPrimitive-D5wWLl2_.js +0 -1
- package/dist/components/MenuPrimitive-BvxwQFGM.js +0 -1
- package/dist/components/floating-ui.react-gB901AP2.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-BQ2Hbb_x.js +0 -1
- package/dist/components/index-BoRAvltW.js +0 -1
- package/dist/components/index-DTYJVF-V.js +0 -1
- package/dist/themes/default.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import i,{createContext as
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import i,{createContext as t,useRef as a,useId as o,useContext as n,useCallback as r,isValidElement as s,cloneElement as l}from"react";import{c as d}from"./clsx-BaVHROc5.js";import{u as c}from"./useComponentClass-QwNivz0h.js";import{u as m}from"./index-wRElCyvx.js";import{R as u}from"./index-DOVR6Rd5.js";import{P as p}from"./index-m6qHOeQ9.js";import{C as h}from"./index-Ir5FYyWW.js";import{m as f}from"./mergeRefs-B8eZ_q-T.js";import{m as C,c as g}from"./mergeProps-B9ocQsG4.js";import{B as b}from"./index-gM8bbyw1.js";import"./ThemeContext-Sm-iNANd.js";const v=t({rootClass:"",activeItems:[],setActiveItems:()=>{},accordionRef:void 0,transitionDuration:0,transitionTimingFunction:"ease-out",openMultiple:!1,collapsible:!1,disabled:!1,orientation:"vertical"}),I="Accordion",N=i.forwardRef((({children:i,className:t="",orientation:o="vertical",disableTabIndexing:n=!1,asChild:r,transitionDuration:s=0,transitionTimingFunction:l="linear",customRootClass:h,disabled:f=!1,loop:C=!0,openMultiple:g=!1,type:b,collapsible:N=!1,value:R,defaultValue:x=[],onValueChange:j,dir:T,...y},A)=>{const M=a(null),w=c(h,I),D=c(h,I,"root"),F="multiple"===b||"single"!==b&&g,V=!!F||N,$=void 0!==R?F?R:R.length>0?[R[0]]:[]:void 0,P=F?x:x.length>0?[x[0]]:[],[H,O]=m($,P,j),B="rtl"===T?"rtl":"ltr";return e(v.Provider,{value:{rootClass:w,activeItems:H,setActiveItems:O,accordionRef:M,transitionDuration:s,transitionTimingFunction:l,openMultiple:F,collapsible:V,disabled:f,orientation:o},children:e(u.Root,{orientation:o,loop:C,disableTabIndexing:n,dir:B,children:e(u.Group,{children:e(p.div,{className:d(D,t),dir:T,"data-orientation":o,ref:e=>{const i=e;M.current=i,"function"==typeof A?A(i):A&&(A.current=i)},asChild:r,...y,children:i})})})})}));N.displayName=I;const R=t({itemValue:"",disabled:!1,headerId:""}),x=i.forwardRef((({children:t,value:a,className:s="",disabled:l=!1,asChild:c=!1,...m},u)=>{const C=i.useRef(null),g=o(),b=a??g,I=o(),{rootClass:N,activeItems:x,setActiveItems:j,transitionDuration:T,transitionTimingFunction:y,openMultiple:A,collapsible:M,disabled:w,orientation:D}=n(v),F=l||w,V=x.includes(b),$=r((e=>{F||j(A?i=>e?i.includes(b)?i:[...i,b]:i.filter((e=>e!==b)):e?[b]:e=>!M&&e.includes(b)&&1===e.length?e:[])}),[F,A,b,j,M]);return e(R.Provider,{value:{itemValue:b,disabled:F,headerId:I},children:e(h.Root,{open:V,onOpenChange:$,disabled:F,transitionDuration:T,transitionTimingFunction:y,asChild:!0,children:e(p.div,{ref:f(C,u),className:d(N&&`${N}-item`,s),"data-state":V?"open":"closed","data-disabled":F?"":void 0,"data-orientation":D,asChild:c,...m,children:t})})})}));x.displayName="AccordionItem";const j=i.forwardRef((({children:i,className:t="",asChild:a=!1,...o},r)=>{const{rootClass:c,orientation:m}=n(v),u=d(c&&`${c}-header`,t);if(a&&s(i)){const e=i,t=C({className:u,"data-orientation":m},e.props);return l(e,{...t,ref:g(r,e.ref)})}return e("h3",{ref:r,className:u,"data-orientation":m,...o,children:i})}));j.displayName="AccordionHeader";const T=i.forwardRef((({children:i,className:t="",asChild:a=!1,id:o,...r},s)=>{const{rootClass:l,activeItems:c,orientation:m}=n(v),{itemValue:p,disabled:f,headerId:C}=n(R);return e(u.Item,{domId:o??C,children:e(h.Trigger,{disabled:f,asChild:!0,children:e(b,{className:d(l&&`${l}-trigger`,t),ref:s,"aria-disabled":f,"aria-expanded":c.includes(p),"data-orientation":m,asChild:a,...r,children:i})})})}));T.displayName="AccordionTrigger";const y=i.forwardRef((({children:i,index:t,className:a="",forceMount:o,asChild:r=!1,...s},l)=>{const{rootClass:c,orientation:m}=n(v),{headerId:u}=n(R);return e(h.Content,{ref:l,asChild:r,forceMount:o,className:d(c&&`${c}-content`,a),role:"region","aria-labelledby":u,"data-orientation":m,...s,children:r?i:e("div",{className:c?`${c}-content-inner`:void 0,children:i})})}));y.displayName="AccordionContent";const A=Object.assign(N,{Root:N,Item:x,Header:j,Trigger:T,Content:y});export{A as default};
|
|
@@ -2,6 +2,7 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import DialogPrimitive from '~/core/primitives/Dialog';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import * as _floating_ui_react from '@floating-ui/react';
|
|
5
6
|
import Primitive from '~/core/primitives/Primitive';
|
|
6
7
|
|
|
7
8
|
type DialogPrimitiveActionProps = {
|
|
@@ -14,6 +15,7 @@ type DialogPrimitiveCancelProps = {
|
|
|
14
15
|
children: React__default.ReactNode;
|
|
15
16
|
asChild?: boolean;
|
|
16
17
|
className?: string;
|
|
18
|
+
onClick?: React__default.MouseEventHandler<HTMLButtonElement>;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
type DialogPrimitiveFooterProps = React__default.ComponentPropsWithoutRef<typeof DialogPrimitive.Footer>;
|
|
@@ -27,6 +29,8 @@ type DialogPrimitiveRootProps$1 = {
|
|
|
27
29
|
onOpenChange?: (open: boolean) => void;
|
|
28
30
|
onClickOutside?: () => void;
|
|
29
31
|
className?: string;
|
|
32
|
+
/** When true, outside pointer events and escape key will not close the dialog. */
|
|
33
|
+
disablePointerDismissal?: boolean;
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
type DialogPrimitiveRootProps = React__default.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
|
|
@@ -84,11 +88,9 @@ declare const AlertDialog: {
|
|
|
84
88
|
className?: string;
|
|
85
89
|
disabled?: boolean;
|
|
86
90
|
} & React$1.RefAttributes<HTMLButtonElement>>;
|
|
87
|
-
Overlay: React$1.ForwardRefExoticComponent<Omit<{
|
|
88
|
-
className?: string;
|
|
91
|
+
Overlay: React$1.ForwardRefExoticComponent<Omit<Omit<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & _floating_ui_react.FloatingOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
89
92
|
asChild?: boolean;
|
|
90
93
|
forceMount?: boolean;
|
|
91
|
-
children?: React.ReactNode;
|
|
92
94
|
} & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
93
95
|
className?: string;
|
|
94
96
|
asChild?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import{createContext as s,forwardRef as r,useState as t,useContext as
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import{createContext as s,forwardRef as r,useState as t,useContext as o,useRef as a,useEffect as i}from"react";import{u as l}from"./useComponentClass-QwNivz0h.js";import{c as n}from"./clsx-BaVHROc5.js";import{u as c}from"./index-wRElCyvx.js";import{D as d}from"./index-BbEsAodL.js";import{F as m}from"./index-Db-tduwt.js";import{P as p}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 h=s({rootClass:"",isOpen:!1,setIsOpen:()=>{},titleId:void 0,descriptionId:void 0,setTitleId:()=>{},setDescriptionId:()=>{}}),C="AlertDialog",u=r((({children:s,className:r="",customRootClass:o="",defaultOpen:a=!1,open:i,onOpenChange:m,...p},u)=>{const N=l(o,C),[g,f]=c(i,a,m),[D,I]=t(void 0),[y,A]=t(void 0),v={rootClass:N,isOpen:g,setIsOpen:f,titleId:D,descriptionId:y,setTitleId:I,setDescriptionId:A};return e(d.Root,{open:g,onOpenChange:f,className:n(N,r),...p,children:e(h.Provider,{value:v,children:e("div",{ref:u,className:n(N,r),children:s})})})}));u.displayName=C;const N=r((({children:s,className:r="",asChild:t=!1,forceMount:a=!1,...i},l)=>{const{rootClass:c,titleId:m,descriptionId:p}=o(h);return e(d.Content,{ref:l,className:n(c&&`${c}-content`,r),asChild:t,forceMount:a,role:"alertdialog","aria-modal":!0,"aria-labelledby":m,"aria-describedby":p,...i,children:s})}));N.displayName="AlertDialogContent";const g=r((({children:s,asChild:r,className:t="",disabled:a=!1,...i},l)=>{const{rootClass:c,isOpen:m}=o(h),p=m?"open":"closed",C=a?"":void 0;return e(d.Trigger,{ref:l,className:n(c&&`${c}-trigger`,t),asChild:r,disabled:a,"data-state":p,"data-disabled":C,...i,children:s})}));g.displayName="AlertDialogTrigger";const f=({children:s,...r})=>e(d.Portal,{...r,children:s});f.displayName="AlertDialogPortal";const D=r((({className:s="",asChild:r=!1,forceMount:t=!1,children:a,...i},l)=>{const{rootClass:c}=o(h);return e(d.Overlay,{ref:l,className:n(c&&`${c}-overlay`,s),asChild:r,forceMount:t,...i,children:a})}));D.displayName="AlertDialogOverlay";const I=r((({children:s,asChild:r,className:t="",...a},i)=>{const{rootClass:l}=o(h);return e(d.Cancel,{ref:i,className:n(l&&`${l}-cancel`,t),asChild:r,...a,children:s})}));I.displayName="AlertDialogCancel";const y=r((({children:s,asChild:r,className:t="",...a},i)=>{const{rootClass:l}=o(h);return e(d.Action,{ref:i,className:n(l&&`${l}-action`,t),asChild:r,...a,children:s})}));y.displayName="AlertDialogAction";const A=r((({children:s,className:r="",...t},a)=>{const{rootClass:i}=o(h);return e(d.Footer,{ref:a,className:n(i&&`${i}-footer`,r),...t,children:s})}));A.displayName="AlertDialogFooter";const v=r((({children:s,className:r="",asChild:t=!1,id:l,...c},d)=>{const{rootClass:C,setTitleId:u,titleId:N}=o(h),g=m.useId(),f=l??g,D=a(f),I=a(N);return i((()=>{I.current=N}),[N]),i((()=>(D.current=f,f&&u(f),()=>{I.current===D.current&&u(void 0)})),[f,u]),e(p.h2,{ref:d,id:f,className:n(C&&`${C}-title`,r),asChild:t,...c,children:s})}));v.displayName="AlertDialogTitle";const j=r((({children:s,className:r="",asChild:t=!1,id:l,...c},d)=>{const{rootClass:C,setDescriptionId:u,descriptionId:N}=o(h),g=m.useId(),f=l??g,D=a(f),I=a(N);return i((()=>{I.current=N}),[N]),i((()=>(D.current=f,f&&u(f),()=>{I.current===D.current&&u(void 0)})),[f,u]),e(p.p,{ref:d,id:f,className:n(C&&`${C}-description`,r),asChild:t,...c,children:s})}));j.displayName="AlertDialogDescription";const O=()=>(console.warn("Direct usage of AlertDialog is not supported. Please use AlertDialog.Root, AlertDialog.Content, etc. instead."),null);O.Root=u,O.Trigger=g,O.Overlay=D,O.Portal=f,O.Content=N,O.Title=v,O.Description=j,O.Footer=A,O.Cancel=I,O.Action=y;export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import t from"react";import{u as e}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./clsx-BaVHROc5.js";import"./ThemeContext-Sm-iNANd.js";const a="AspectRatio",o=t.forwardRef((({children:t,customRootClass:o,className:m,ratio:c="1",...i},l)=>{isNaN(Number(c))&&!c.match(/^(\d+)\/(\d+)$/)&&(c="1"),Number(c)<=0&&(c="1");const p=e(o,a);return s("div",{ref:l,style:{aspectRatio:c},className:r(p,m),...i,children:t})}));o.displayName=a;export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as a}from"react/jsx-runtime";import r,{createContext as s,useContext as e}from"react";import{A as o,a as t,b as l}from"./AvatarPrimitiveFallback-
|
|
1
|
+
'use client';import{jsx as a}from"react/jsx-runtime";import r,{createContext as s,useContext as e}from"react";import{A as o,a as t,b as l}from"./AvatarPrimitiveFallback-BOYawMc9.js";import{c as i}from"./clsx-BaVHROc5.js";import{u as c}from"./useComponentClass-QwNivz0h.js";import{c as m,a as n,b as d}from"./index-eAZUMNef.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./ThemeContext-Sm-iNANd.js";const f=s({size:"",variant:"",color:"",rootClass:""}),p="Avatar",v=r.forwardRef((({children:r,customRootClass:s="",className:e="",size:t="",variant:l="",color:v="",...u},A)=>{const N=c(s,p),j=m("avatar",{variant:l,size:t}),C=d(v),b=n(j,C);return a(f.Provider,{value:{size:t,variant:l,color:v,rootClass:N},children:a(o,{ref:A,className:i(N,e),...b,...u,children:r})})}));v.displayName=p;const u=r.forwardRef((({src:r="",alt:s="",className:o,...l},c)=>{const{rootClass:m}=e(f),n=i(m&&`${m}-image`,o)||void 0;return a(t,{ref:c,className:n,src:r,alt:s,...l})}));u.displayName="AvatarImage";const A=r.forwardRef((({children:r,className:s="",...o},t)=>{const{rootClass:c}=e(f);return a(l,{ref:t,className:i(c&&`${c}-fallback`,s),...o,children:r})}));A.displayName="AvatarFallback";const N=()=>(console.warn("Direct usage of Avatar is not supported. Please use Avatar.Root, Avatar.Image, Avatar.Fallback instead."),null);N.displayName="Avatar",N.Root=v,N.Image=u,N.Fallback=A;export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as a}from"react/jsx-runtime";import r,{createContext as s,useContext as t}from"react";import{c as o}from"./clsx-BaVHROc5.js";import{
|
|
1
|
+
'use client';import{jsx as a}from"react/jsx-runtime";import r,{createContext as s,useContext as t}from"react";import{c as o}from"./clsx-BaVHROc5.js";import{u as e}from"./useComponentClass-QwNivz0h.js";import{c as l,a as i,b as c}from"./index-eAZUMNef.js";import{A as m,a as n,b as p}from"./AvatarPrimitiveFallback-BOYawMc9.js";import"./ThemeContext-Sm-iNANd.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";const d=s({rootClass:"",size:"",variant:""}),f="AvatarGroup",u=r.forwardRef((({customRootClass:r="",size:s="",variant:t="",children:c,className:m="",...n},p)=>{const u=e(r,f),v=l("avatar",{variant:t,size:s}),A=i(v);return a(d.Provider,{value:{size:s,variant:t,rootClass:u},children:a("div",{ref:p,className:o(u,m),...A,...n,children:c})})}));u.displayName=f;const v=r.forwardRef((({color:r="",children:s,className:e,...l},n)=>{const{rootClass:p}=t(d),f=c(r),u=i(f);return a(m,{ref:n,className:o(p&&`${p}-item`,e),...u,...l,children:s})}));v.displayName="AvatarGroupItem";const A=r.forwardRef((({src:r,alt:s,...t},o)=>a(n,{ref:o,src:r,alt:s,...t})));A.displayName="AvatarGroupAvatar";const N=r.forwardRef((({children:r,className:s,...e},l)=>{const{rootClass:i}=t(d);return a(p,{ref:l,className:o(i&&`${i}-fallback`,s),...e,children:r})}));N.displayName="AvatarGroupFallback";const G=()=>(console.warn("Direct usage of AvatarGroup is not supported. Please use AvatarGroup.Root, AvatarGroup.Item, AvatarGroup.Avatar, AvatarGroup.Fallback instead."),null);G.Root=u,G.Item=v,G.Avatar=A,G.Fallback=N;export{G as default};
|
package/dist/components/{AvatarPrimitiveFallback-KiY3slgV.js → AvatarPrimitiveFallback-BOYawMc9.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as r}from"react/jsx-runtime";import a,{createContext as e,useState as i,useMemo as s,useContext as o,useEffect as n}from"react";import{P as t}from"./index-
|
|
1
|
+
'use client';import{jsx as r}from"react/jsx-runtime";import a,{createContext as e,useState as i,useMemo as s,useContext as o,useEffect as n}from"react";import{P as t}from"./index-m6qHOeQ9.js";const d=e({}),l=a.forwardRef((({children:e,asChild:o=!1,...n},l)=>{const[m,c]=i(!1),[h,p]=i(!1),f=s((()=>{if(!e)return!1;const r=e=>{if(a.isValidElement(e)){if("img"===e.type&&e.props?.src)return!0;if(e.props?.src)return!0;if(e.props?.children)return a.Children.toArray(e.props.children).some(r)}return!1};return a.Children.toArray(e).some(r)}),[e]),u={isImageLoaded:m,hasError:h,setHasError:p,handleLoadImage:()=>{c(!0),p(!1)},handleErrorImage:()=>{c(!1),p(!0)}};return r(d.Provider,{value:u,children:r(t.span,{ref:l,asChild:o,"data-rad-ui-has-image":f?"":void 0,...n,children:e})})}));l.displayName="AvatarPrimitiveRoot";const m=a.forwardRef((({src:a="",alt:e="",...i},s)=>{const{handleErrorImage:l,handleLoadImage:m,hasError:c}=o(d);return c?null:(n((()=>{a||l()}),[a,l,c]),r(t.img,{ref:s,src:a,alt:e,onError:l,onLoad:m,...i}))}));m.displayName="AvatarPrimitiveImage";const c=a.forwardRef((({children:a,asChild:e=!1,className:i="",...s},n)=>{const{isImageLoaded:l}=o(d);return l?null:r(t.span,{ref:n,asChild:e,className:i,...s,children:a})}));c.displayName="AvatarPrimitiveFallback";export{l as A,m as a,c as b};
|
package/dist/components/Badge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import a from"react";import{u as o}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./clsx-BaVHROc5.js";import{c as e,a as t,b as m}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const i="Badge",c=a.forwardRef((({children:a,customRootClass:c="",className:n="",color:d="",variant:l="solid",size:f="medium",...p},u)=>{const j=o(c,i,"root"),x=e("badge",{variant:l,size:f}),C=m(d),h=t(x,C);return s("div",{ref:u,className:r(j,n),...h,...p,children:a})}));c.displayName=i;export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as o}from"react/jsx-runtime";import a from"react";import{c as
|
|
1
|
+
'use client';import{jsx as o}from"react/jsx-runtime";import a from"react";import{c as t}from"./clsx-BaVHROc5.js";import{u as r}from"./useComponentClass-QwNivz0h.js";import"./ThemeContext-Sm-iNANd.js";const s="BlockQuote",e=a.forwardRef((({children:a,customRootClass:e="",className:m="",color:c="",variant:i="",size:l="",...n},d)=>{const f=r(e,s),p={};return i&&(p["data-variant"]=i),l&&(p["data-size"]=l),c&&(p["data-color"]=c),o("blockquote",{ref:d,className:t(f,m),...n,...p,children:a})}));e.displayName=s;export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as o}from"react/jsx-runtime";import{forwardRef as t}from"react";import{u as s}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./clsx-BaVHROc5.js";import{B as e}from"./index-gM8bbyw1.js";import{c as a,a as i,b as m}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";const n="Button",p=t((({children:t,type:p="button",customRootClass:d="",className:l="",variant:c="",size:f="",color:u="",disabled:j=!1,onClick:x,...b},C)=>{const v=s(d,n,"root"),h=a("button",{variant:c,size:f}),y=m(u),N=i(h,y);return o(e,{ref:C,type:p,disabled:j,"data-disabled":j?"":void 0,className:r(v,l),...N,onClick:o=>{if(j)return o.preventDefault(),void o.stopPropagation();x?.(o)},...b,children:t})}));p.displayName=n;export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as s}from"react/jsx-runtime";import e,{createContext as o,useContext as t}from"react";import{
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import e,{createContext as o,useContext as t}from"react";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as r}from"./clsx-BaVHROc5.js";import{P as l}from"./index-m6qHOeQ9.js";import{c as n,a as c,b as i}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-B9ocQsG4.js";const m=o({rootClass:""}),d="Callout",u=e.forwardRef((({children:e,asChild:o=!1,className:t="",color:u="",variant:f="",intent:p="",size:C="",customRootClass:h="",...x},N)=>{const v=a(h,d),j=n("callout",{variant:"destructive"===f?"":f,intent:p||("destructive"===f?"destructive":""),size:C}),R=i(u),w=c(j,R);return s(m.Provider,{value:{rootClass:v},children:s(l.div,{ref:N,asChild:o,className:r(v,t),...w,...x,children:e})})}));u.displayName=d;const f=e.forwardRef((({children:e,className:o="",...a},n)=>{const{rootClass:c}=t(m);return s(l.span,{ref:n,className:r(c&&`${c}-icon`,o),...a,children:e})}));f.displayName="CalloutIcon";const p=e.forwardRef((({children:e,className:o="",...a},n)=>{const{rootClass:c}=t(m);return s(l.p,{ref:n,className:r(c&&`${c}-text`,o),...a,children:e})}));p.displayName="CalloutText";const C=()=>(console.warn("Direct usage of Callout is not supported. Please use Callout.Root, Callout.Icon, etc. instead."),null);C.Root=u,C.Icon=f,C.Text=p;export{C as default};
|
package/dist/components/Card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as r}from"react/jsx-runtime";import a,{createContext as
|
|
1
|
+
'use client';import{jsx as r}from"react/jsx-runtime";import a,{createContext as s,useMemo as e,useContext as o}from"react";import{u as t}from"./useComponentClass-QwNivz0h.js";import{c}from"./clsx-BaVHROc5.js";import{c as i}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const n=s({rootClass:"rad-ui-card"}),l="Card",d=a.forwardRef((({children:a,customRootClass:s,className:o="",variant:d="",size:m="",...f},C)=>{const N=t(s,l),h=t(s,l,"root"),p=i("card",{variant:d,size:m}),u=e((()=>({rootClass:N})),[N]);return r(n.Provider,{value:u,children:r("div",{ref:C,className:c(h,o),...p,...f,children:a})})}));d.displayName=l;const m=a.forwardRef((({children:a,className:s="",...e},t)=>{const{rootClass:i}=o(n);return r("div",{ref:t,className:c(i&&`${i}-action`,s),...e,children:a})}));m.displayName="CardAction";const f=a.forwardRef((({children:a,className:s="",...e},t)=>{const{rootClass:i}=o(n);return r("div",{ref:t,className:c(i&&`${i}-content`,s),...e,children:a})}));f.displayName="CardContent";const C=a.forwardRef((({children:a,className:s="",...e},t)=>{const{rootClass:i}=o(n);return r("p",{ref:t,className:c(i&&`${i}-description`,s),...e,children:a})}));C.displayName="CardDescription";const N=a.forwardRef((({children:a,className:s="",...e},t)=>{const{rootClass:i}=o(n);return r("div",{ref:t,className:c(i&&`${i}-footer`,s),...e,children:a})}));N.displayName="CardFooter";const h=a.forwardRef((({children:a,className:s="",...e},t)=>{const{rootClass:i}=o(n);return r("div",{ref:t,className:c(i&&`${i}-header`,s),...e,children:a})}));h.displayName="CardHeader";const p=a.forwardRef((({children:a,className:s="",...e},t)=>{const{rootClass:i}=o(n);return r("h3",{ref:t,className:c(i&&`${i}-title`,s),...e,children:a})}));p.displayName="CardTitle";const u=a.forwardRef((({children:a,className:s="",customRootClass:e,variant:o="",size:t="",...i},n)=>r(d,{ref:n,className:c(s),customRootClass:e,variant:o,size:t,...i,children:a})));u.displayName="Card",u.Root=d,u.Action=m,u.Content=f,u.Description=C,u.Footer=N,u.Header=h,u.Title=p;export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import i,{forwardRef as
|
|
1
|
+
'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import i,{forwardRef as s,useRef as a,useEffect as t,useContext as c}from"react";import{B as n}from"./index-gM8bbyw1.js";import{u as o}from"./index-wRElCyvx.js";import{u as d}from"./useComponentClass-QwNivz0h.js";import{c as l}from"./clsx-BaVHROc5.js";import{c as m,a as h,b as u}from"./index-eAZUMNef.js";import{C}from"./check-DujVUWP-.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./ThemeContext-Sm-iNANd.js";const k=i.createContext({isChecked:!1,setIsChecked:()=>{},id:"",required:!1,disabled:!1}),p=s((({children:r,className:s="",...a},t)=>{const{isChecked:c,setIsChecked:o,id:d,required:l,disabled:m}=i.useContext(k);return e(n,{ref:t,onClick:()=>{o("indeterminate"===c||null===c||!c)},role:"checkbox",id:d,"aria-checked":"indeterminate"===c||null===c?"mixed":c,"aria-required":l,"data-checked":c,"data-state":"indeterminate"===c||null===c?"indeterminate":c?"checked":"unchecked",disabled:m,"data-disabled":m,className:s,...a,children:r})}));p.displayName="CheckboxPrimitiveTrigger";const x=s((({children:i,className:s="",checked:c,defaultChecked:n=!1,onCheckedChange:d,disabled:l,required:m,name:h,value:u,id:C,...x},b)=>{const[f,N]=o(c,n,d),v=a(null);t((()=>{v.current&&(v.current.indeterminate="indeterminate"===f||null===f)}),[f]);const j={isChecked:f,setIsChecked:N,id:C,required:m,disabled:l};return r(k.Provider,{value:j,children:[e(p,{ref:b,className:s,disabled:l,required:m,...x,children:i}),e("input",{ref:v,type:"checkbox",id:C,style:{position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"},name:h,value:u,checked:!0===f,disabled:l,required:m,readOnly:!0})]})}));x.displayName="CheckboxPrimitiveRoot";const b=i.createContext({rootClass:""}),f="Checkbox",N=s((({children:r,className:i="",customRootClass:s,color:a="",variant:t,size:c,...n},o)=>{const C=d(s,f),k=m("checkbox",{variant:t,size:c}),p=u(a),N=h(k,p);return e(b.Provider,{value:{rootClass:C},children:e(x,{ref:o,className:l(C,i),...n,...N,children:r})})}));N.displayName=f;const v=s((({children:r,className:s="",...a},t)=>{const{isChecked:c}=i.useContext(k);return!0!==c?null:e("span",{ref:t,className:s,...a,children:r})}));v.displayName="CheckboxPrimitiveIndicator";const j=s((({children:i,className:s="",...a},t)=>{const{rootClass:n}=c(b);return r(v,{ref:t,...a,children:[e(C,{width:15,height:15,className:l(n&&`${n}-indicator`,s)}),i]})}));j.displayName="CheckboxIndicator";const y=()=>(console.warn("Direct usage of Checkbox is not supported. Please use Checkbox.Root, Checkbox.Indicator instead."),null);y.Root=N,y.Indicator=j;export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import o,{forwardRef as s,useContext as t}from"react";import{C as r}from"./CheckboxGroupPrimitive-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import o,{forwardRef as s,useContext as t}from"react";import{C as r}from"./CheckboxGroupPrimitive-Cd8ra39e.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as i}from"./clsx-BaVHROc5.js";import{c as n,a as c,b as m}from"./index-eAZUMNef.js";import{C as l}from"./check-DujVUWP-.js";import"./index-DOVR6Rd5.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-gM8bbyw1.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";const d=o.createContext({rootClass:""}),C="CheckboxCards",p=s((({children:o,customRootClass:s="",className:t="",color:l="",variant:p="",size:h="",orientation:x="both",...u},f)=>{const j=a(s,C),N=n("checkbox-cards",{variant:p,size:h}),b=m(l),k=c(N,b);return e(d.Provider,{value:{rootClass:j},children:e(r.Root,{ref:f,className:i(j&&`${j}-root`,j,t),...u,...k,orientation:x,children:o})})}));p.displayName=C;const h=s((({children:s,className:t="",value:a,...n},c)=>{const{rootClass:m}=o.useContext(d);return e(r.Trigger,{ref:c,className:i(m&&`${m}-item`,t),value:a,...n,children:s})}));h.displayName="CheckboxCardsItem";const x=s((({children:s,className:t,...a},n)=>{const{rootClass:c}=o.useContext(d),m=i(c?`${c}-content`:void 0,t)||void 0;return e(r.Content,{ref:n,className:m,...a,children:s})}));x.displayName="CheckboxCardsContent";const u=s((({className:o,...s},r)=>{const{rootClass:a}=t(d);return e(l,{ref:r,width:15,height:15,className:i(a&&`${a}-tick-icon`,o),...s})}));u.displayName="CheckboxCardsIndicator";const f=()=>(console.warn("Direct usage of CheckboxCards is not supported. Please use CheckboxCards.Root, CheckboxCards.Item instead."),null);f.Root=p,f.Content=x,f.Item=h,f.Indicator=u;export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import o,{forwardRef as r,useContext as s}from"react";import{C as t}from"./CheckboxGroupPrimitive-
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import o,{forwardRef as r,useContext as s}from"react";import{C as t}from"./CheckboxGroupPrimitive-Cd8ra39e.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import{c as i}from"./clsx-BaVHROc5.js";import{c,a as n,b as l}from"./index-eAZUMNef.js";import{P as m}from"./index-m6qHOeQ9.js";import{C as p}from"./check-DujVUWP-.js";import"./index-DOVR6Rd5.js";import"./index-gM8bbyw1.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-B9ocQsG4.js";const u=o.createContext({rootClass:""}),d="CheckboxGroup",h=r((({children:o,customRootClass:r="",className:s="",color:m="",variant:p="",size:h="",...C},x)=>{const f=a(r,d),b=c("checkbox-group",{variant:p,size:h}),g=l(m),j=n(b,g);return e(u.Provider,{value:{rootClass:f},children:e(t.Root,{ref:x,className:i(f&&`${f}-root`,f,s),...C,...j,children:o})})}));h.displayName=d;const C=r((({children:r,className:s="",value:a,...c},n)=>{const{rootClass:l}=o.useContext(u);return e(t.Trigger,{ref:n,className:i(l&&`${l}-trigger`,s),value:a,...c,children:e(t.Content,{children:r})})}));C.displayName="CheckboxGroupTrigger";const x=r((({children:o,className:r="",...t},a)=>{const{rootClass:c}=s(u);return e(m.label,{ref:a,className:i(c&&`${c}-label`,r),...t,children:o})}));x.displayName="CheckboxGroupLabel";const f=r((({className:o,...r},t)=>{const{rootClass:a}=s(u);return e(p,{ref:t,width:15,height:15,className:i(a&&`${a}-tick-icon`,o),...r})}));f.displayName="CheckboxGroupIndicator";const b=()=>(console.warn("Direct usage of CheckboxGroup is not supported. Please use CheckboxGroup.Root, CheckboxGroup.Item instead."),null);b.Root=h,b.Trigger=C,b.Label=x,b.Indicator=f;export{b as default};
|
package/dist/components/{CheckboxGroupPrimitive-DgfnzMT9.js → CheckboxGroupPrimitive-Cd8ra39e.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import i,{forwardRef as a}from"react";import{R as d}from"./index-
|
|
1
|
+
'use client';import{jsx as e,jsxs as r}from"react/jsx-runtime";import i,{forwardRef as a}from"react";import{R as d}from"./index-DOVR6Rd5.js";import{u as o}from"./index-wRElCyvx.js";const t=i.createContext({checkedValues:[],setCheckedValues:()=>{},name:"",required:!1,disabled:!1}),c=a((({dir:r,orientation:i,loop:a,defaultValue:c=[],value:n,onValueChange:s,children:l,name:u,required:h,disabled:m,className:p="",...k},C)=>{const[b,x]=o(n,c,s);return e("div",{ref:C,className:p,...k,children:e(d.Root,{dir:r,orientation:i??"horizontal",loop:a??!0,children:e(t.Provider,{value:{checkedValues:b,setCheckedValues:x,name:u,required:h,disabled:m},children:e(d.Group,{children:l})})})})}));c.displayName="CheckboxGroupPrimitiveRoot";const n=i.createContext({isChecked:!1}),s=a((({children:a,className:o="",value:c,required:s,disabled:l,checked:u,onCheckedChange:h,onClick:m,...p},k)=>{const{checkedValues:C,setCheckedValues:b,name:x,required:v,disabled:f}=i.useContext(t),N=C.includes(c),g=s||v,y=l||f,{role:V,...q}=p;return r("div",{children:[e(n.Provider,{value:{isChecked:N},children:e(d.Item,{ref:k,onClick:e=>{m?.(e),e.preventDefault(),e.stopPropagation(),C.includes(c)?(b(C.filter((e=>e!==c))),h?.(!1)):C.includes(c)||(b([...C,c]),h?.(!0))},className:o,role:"checkbox","aria-checked":N,"aria-required":g,"aria-disabled":y||void 0,disabled:y,...q,"data-state":N?"checked":"unchecked",children:e("button",{type:"button",disabled:y,children:a})})}),e("input",{type:"checkbox",checked:N,name:x,value:c,style:{display:"none"},required:g,disabled:y,"aria-hidden":"true",readOnly:!0})]})}));s.displayName="CheckboxGroupPrimitiveTrigger";const l=a((({children:r,className:a,...d},o)=>{const{isChecked:t}=i.useContext(n);return e("span",{ref:o,className:a,...d,children:t?r:null})}));l.displayName="CheckboxGroupPrimitiveContent";const u=()=>(console.warn("Direct usage of CheckboxGroup is not supported. Please use CheckboxGroup.Root, CheckboxGroup.Item instead."),null);u.Root=c,u.Trigger=s,u.Content=l;export{u as C};
|
package/dist/components/Code.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import o from"react";import{c as r}from"./clsx-BaVHROc5.js";import{u as a}from"./useComponentClass-QwNivz0h.js";import{a as e,b as t,c as m}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const c="Code",i=o.forwardRef((({children:o,customRootClass:i="",color:n="",variant:f="",size:l="",className:d,...p},u)=>{const j=a(i,c),x=e(m("code",{variant:f,size:l}),t(n));return s("code",{ref:u,className:r(j,d),...x,...p,children:o})}));i.displayName=c;export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import{c as o}from"./clsx-BaVHROc5.js";import s,{createContext as r,useContext as
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import{c as o}from"./clsx-BaVHROc5.js";import s,{createContext as r,useContext as t}from"react";import{u as a}from"./useComponentClass-QwNivz0h.js";import{C as l}from"./index-Ir5FYyWW.js";import"./ThemeContext-Sm-iNANd.js";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-wRElCyvx.js";import"./index-gM8bbyw1.js";const i=r({rootClass:"",open:!1,onOpenChange:()=>{},disabled:!1,defaultOpen:!1}),n=s.forwardRef((({children:s,className:r="",transitionDuration:t=0,disabled:n,customRootClass:c,...m},d)=>{const p=a(c,"Collapsible");return e(i.Provider,{value:{rootClass:p},children:e(l.Root,{ref:d,className:o(p,r),transitionDuration:t,disabled:n,...m,children:s})})}));n.displayName="CollapsibleRoot";const c=s.forwardRef((({children:s,className:r,...a},n)=>{const{rootClass:c}=t(i),m=c?`${c}-trigger`:"";return e(l.Trigger,{ref:n,className:o(m,r),...a,children:s})}));c.displayName="CollapsibleTrigger";const m=s.forwardRef((({children:s,className:r="",...a},n)=>{const{rootClass:c}=t(i),m=c?`${c}-content`:"";return e(l.Content,{ref:n,className:o(m,r),...a,children:s})}));m.displayName="CollapsibleContent";const d=()=>(console.warn("Direct usage of Collapsible is not supported. Please use Collapsible.Root, Collapsible.Trigger, etc. instead."),null);d.Root=n,d.Trigger=c,d.Content=m;export{d as default};
|
|
@@ -10,6 +10,7 @@ declare const ComboboxContent: React.ForwardRefExoticComponent<Omit<ComboboxCont
|
|
|
10
10
|
interface ComboboxPrimitiveItemProps {
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
value: string;
|
|
13
|
+
label?: string;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
className?: string;
|
|
15
16
|
[key: string]: any;
|
|
@@ -30,9 +31,10 @@ declare const ComboboxItem: React.ForwardRefExoticComponent<(Omit<Omit<Omit<Comb
|
|
|
30
31
|
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
31
32
|
|
|
32
33
|
type ComboboxPrimitiveTriggerProps = {
|
|
33
|
-
children
|
|
34
|
+
children?: React.ReactNode;
|
|
34
35
|
className?: string;
|
|
35
36
|
disabled?: boolean;
|
|
37
|
+
renderValue?: (value: string, label: string) => React.ReactNode;
|
|
36
38
|
[key: string]: any;
|
|
37
39
|
};
|
|
38
40
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import o,{useContext as e}from"react";import{jsx as r}from"react/jsx-runtime";import{C as a}from"./ComboboxPrimitive-
|
|
1
|
+
'use client';import o,{useContext as e}from"react";import{jsx as r}from"react/jsx-runtime";import{C as a}from"./ComboboxPrimitive-BhHSrtiY.js";import{c as s}from"./clsx-BaVHROc5.js";import{u as t}from"./useComponentClass-QwNivz0h.js";import{C as i}from"./check-DujVUWP-.js";import"./index-Db-tduwt.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-m6qHOeQ9.js";import"./mergeProps-B9ocQsG4.js";import"./index-CXzybYmm.js";import"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";const d=o.createContext({rootClass:""}),l=o.forwardRef((({customRootClass:o,children:s,position:t="popper",...i},l)=>{const{rootClass:n}=e(d);return r(a.Content,{className:n?`${n}-content`:void 0,position:t,"data-position":t,ref:l,...i,children:s})}));l.displayName="ComboboxContent";const n=o.forwardRef((({customRootClass:o,children:s,value:t,disabled:i,...l},n)=>{const{rootClass:c}=e(d);return r(a.Item,{className:c?`${c}-item`:void 0,value:t,disabled:i,"data-disabled":i?"":void 0,role:"option","aria-disabled":i?"true":void 0,ref:n,...l,children:r("span",{className:c?`${c}-text`:void 0,children:s})})}));n.displayName="ComboboxItem";const c=o.forwardRef((({customRootClass:o,children:t,disabled:i,placeholder:l,className:n,...c},m)=>{const{rootClass:p}=e(d),f=s(p?`${p}-trigger`:void 0,n)||void 0;return r(a.Trigger,{className:f,"aria-disabled":i?"true":void 0,"data-placeholder":l?"":void 0,disabled:i,ref:m,...c,children:t})}));c.displayName="ComboboxTrigger";const m=o.forwardRef((({customRootClass:o,children:e,defaultValue:s,value:i,onValueChange:l,sideOffset:n=4,...c},m)=>{const p=t(o,"Combobox");return r(d.Provider,{value:{rootClass:p},children:r(a.Root,{className:p?`${p}-root`:void 0,defaultValue:s,value:i,onValueChange:l,sideOffset:n,ref:m,...c,children:e})})}));m.displayName="ComboboxRoot";const p=o.forwardRef((({className:o,...a},t)=>{const{rootClass:l}=e(d),n=s(l?`${l}-item-indicator`:void 0,o)||void 0;return r("div",{className:n,ref:t,...a,children:r(i,{width:16,height:16})})}));p.displayName="ComboboxIndicator";const f=o.forwardRef((({children:o,container:e,...s},t)=>r(a.Portal,{ref:t,container:e,...s,children:o})));f.displayName="ComboboxPortal";const C=o.forwardRef((({children:o,...s},t)=>{const{rootClass:i}=e(d);return r(a.Group,{className:i?`${i}-group`:void 0,ref:t,...s,children:o})}));C.displayName="ComboboxGroup";const u=o.forwardRef((({className:o,...t},i)=>{const{rootClass:l}=e(d),n=s(l?`${l}-search`:void 0,o)||void 0;return r(a.Search,{className:n,ref:i,...t})}));u.displayName="ComboboxSearch";const b=o.forwardRef(((o,e)=>(console.warn("Direct usage of Combobox is not supported. Please use Combobox.Root, Combobox.Content, etc. instead."),null)));b.displayName="Combobox";const h=b;h.Root=m,h.Content=l,h.Item=n,h.Trigger=c,h.Portal=f,h.Group=C,h.Indicator=p,h.Search=u;export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import n,{createContext as i,useContext as a,useState as s,useEffect as o,useLayoutEffect as l}from"react";import{F as d}from"./index-Db-tduwt.js";import{P as c}from"./index-m6qHOeQ9.js";import{c as u}from"./index-CXzybYmm.js";import{u as f}from"./index-wRElCyvx.js";const m=i({});const p=n.forwardRef((({children:r,className:n,style:i,...s},o)=>{const{isOpen:l,elementsRef:c,labelsRef:u,floatingContext:f,refs:p,middlewareData:h,placedPlacement:g,getFloatingProps:b,floatingStyles:v,isPositioned:R}=a(m),y=d.useMergeRefs([p.setFloating,o]),x="undefined"==typeof navigator||!/jsdom/i.test(navigator.userAgent),I=function(e){const[t,r="center"]=e.split("-"),n="start"===r?"left":"end"===r?"right":"center",i="start"===r?"top":"end"===r?"bottom":"center";switch(t){case"top":return{side:t,align:r,transformOrigin:`${n} bottom`};case"bottom":return{side:t,align:r,transformOrigin:`${n} top`};case"left":return{side:t,align:r,transformOrigin:`right ${i}`};case"right":return{side:t,align:r,transformOrigin:`left ${i}`};default:return{side:"bottom",align:"center",transformOrigin:"center top"}}}(g);return e(t,{children:l&&e(d.FocusManager,{context:f,children:e(d.FloatingList,{elementsRef:c,labelsRef:u,children:e("div",{ref:y,style:{...v,...i,"--rad-ui-floating-transform-origin":I.transformOrigin,visibility:!R&&x||h.hide?.referenceHidden?"hidden":i?.visibility||v.visibility,pointerEvents:h.hide?.referenceHidden?"none":i?.pointerEvents},className:n,"data-state":l?"open":"closed","data-side":I.side,"data-align":I.align,"data-positioned":R?"":void 0,...b(),...s,children:r})})})})}));p.displayName="ComboboxPrimitiveContent";const h=i(null),g=n.forwardRef((({children:t,value:r,label:i,disabled:s,className:o,...l},u)=>{const f=a(m);if(!f)return console.error("ComboboxPrimitiveItem must be used within a ComboboxPrimitive"),null;const{handleSelect:p,isTypingRef:g,getItemProps:b,activeIndex:v,selectedIndex:R,selectedValue:y,virtualItemRef:x,selectedItemRef:I,hasSearch:P,search:C,hiddenIndices:S,disabledIndices:w,setDisabledIndices:N,labelsRef:M,displayLabelsRef:O,valuesRef:A,bumpLabelsVersion:k}=f,D=n.useRef(null),$=i||r,{ref:E,index:F}=d.useListItem({label:$}),L=S.includes(F),V=v===F,j=R===F||y===r,H=r||`select-item-${F}`,T=a(h);n.useEffect((()=>{if(T?.registerItem)return T.registerItem(H,!L)}),[T,H,L]),n.useEffect((()=>(A.current[F]=H,M.current[F]=$,O.current[F]=$,()=>{delete A.current[F],delete M.current[F],delete O.current[F]})),[O,F,H,$,M,A]),n.useEffect((()=>(k(),()=>{k()})),[F,$,r,k]),n.useEffect((()=>{const e=F;return N((t=>{if(s&&t.includes(e))return t;if(!s&&!t.includes(e))return t;const r=new Set(t);return s?r.add(e):r.delete(e),Array.from(r).sort(((e,t)=>e-t))})),()=>{N((t=>{if(!t.includes(e))return t;const r=new Set(t);return r.delete(e),Array.from(r).sort(((e,t)=>e-t))}))}}),[F,s,N]);const z=n.useCallback((e=>{j&&!P?I.current=e:I.current===e&&(I.current=null)}),[P,j,I]);return e(c.div,{ref:d.useMergeRefs([E,D,z,u]),id:H,role:"option",className:o,style:{display:L?"none":void 0,...l.style},"data-value":r,"data-label":$,"data-active":P?x.current?.id==H:V,"aria-selected":j,"aria-disabled":!!s||void 0,"data-disabled":s?"":void 0,...b({tabIndex:s?-1:V?0:-1,onClick:()=>!s&&p(F),onKeyDown:e=>{s||("Enter"===e.key&&(e.preventDefault(),p(F))," "!==e.key||g.current||(e.preventDefault(),p(F)))}}),...l,tabIndex:s?-1:V?0:-1,children:t})}));g.displayName="ComboboxPrimitiveItem";const b=n.forwardRef((({children:t,className:r,disabled:n,asChild:i,onClick:s,renderValue:o,...l},f)=>{const{isOpen:p,setIsOpen:h,selectedLabel:g,selectedValue:b,refs:v,getReferenceProps:R}=a(m),{onClick:y,...x}=R(),I=u(s,(()=>{n||h((e=>!e))})),P=Boolean(g||b)?o?.(b,g||b):void 0;return e(c.button,{type:i?void 0:"button",className:r,"aria-expanded":p,"data-state":p?"open":"closed","aria-disabled":!!n||void 0,disabled:!!n||void 0,ref:d.useMergeRefs([v.setReference,f]),role:"combobox",asChild:i,onClick:I,...x,...l,children:P??(g||b||t)})}));b.displayName="ComboboxPrimitiveTrigger";const v=n.forwardRef((({children:t,className:i,value:a,name:u,defaultValue:p="",onValueChange:h,onClickOutside:g=()=>{},align:b="start",alignOffset:v=0,avoidCollisions:R=!0,collisionBoundary:y=null,collisionPadding:x=8,constrainSize:I=!0,enableFlip:P=!0,enableShift:C=!0,hideWhenDetached:S=!1,matchReferenceWidth:w=!1,offsetValue:N,onPlaced:M,placement:O,positioningStrategy:A="fixed",side:k="bottom",sideOffset:D,sticky:$="partial",updatePositionStrategy:E="optimized",...F},L)=>{const[V,j]=n.useState(!1),[H,T]=f(a,p,h),[z,B]=n.useState(p),W=n.useRef(null),G=n.useRef([]),K=n.useRef([]),q=n.useRef([]),U=n.useRef([]),J=n.useRef({}),[Q,X]=n.useState([]),Y=n.useRef(!1),Z=n.useRef(null),_=n.useRef(null),[ee,te]=n.useState(null),[re,ne]=n.useState(null),[ie,ae]=n.useState(!1),[se,oe]=n.useState(""),[le,de]=n.useReducer((e=>e+1),0),ce=n.useMemo((()=>{if(!se)return[];const e=[];for(let t=0;t<K.current.length;t++){const r=K.current[t];r&&!r.toLowerCase().includes(se.toLowerCase())&&e.push(t)}return e}),[se,le]),ue=n.useMemo((()=>{const e=new Set([...Q,...ce]);return Array.from(e).sort(((e,t)=>e-t))}),[Q,ce]),fe=function(e){const[t,r]=s(!1);return o((()=>{if(!e)return void r(!1);let t=e;for(;t;){if("FORM"===t.tagName)return void r(!0);t=t.parentElement}r(!1)}),[e]),t}(Z.current),me=O??function(e,t){return"center"===t?e:`${e}-${t}`}(k,b),pe=D??N??0,he=n.useMemo((()=>Array.isArray(y)?y:[y]),[y]),ge=n.useMemo((()=>{const e=he.filter((e=>null!=e));return{padding:x,boundary:e,altBoundary:e.length>0}}),[he,x]),be=n.useMemo((()=>[d.offset({mainAxis:pe,alignmentAxis:v}),R&&C&&d.shift({mainAxis:!0,crossAxis:!1,limiter:"partial"===$?d.limitShift():void 0,...ge}),R&&P&&d.flip(ge),I&&d.size({...ge,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const i=e.floating.style;i.setProperty("--rad-ui-floating-available-width",`${Math.max(0,r)}px`),i.setProperty("--rad-ui-floating-available-height",`${Math.max(0,n)}px`),i.setProperty("--rad-ui-floating-reference-width",`${t.reference.width}px`),i.setProperty("--rad-ui-floating-reference-height",`${t.reference.height}px`),w?i.width=`${t.reference.width}px`:i.removeProperty("width")}}),S&&d.hide({strategy:"referenceHidden",...ge})].filter(Boolean)),[v,R,I,ge,P,C,S,pe,w,$]),{refs:ve,floatingStyles:Re,context:ye,isPositioned:xe,middlewareData:Ie,update:Pe,placement:Ce}=d.useFloating({middleware:be,open:V,onOpenChange:j,placement:me,strategy:A,whileElementsMounted:(e,t,r)=>d.autoUpdate(e,t,r,{animationFrame:"always"===E})});l((()=>{xe&&M?.()}),[xe,M]);const Se=d.useClick(ye),we=d.useDismiss(ye),Ne=d.useRole(ye,{role:"listbox"});const Me=n.useCallback((e=>{if(null!==e&&!ue.includes(e)&&(ne(e),j(!1),ve.reference.current?.focus(),null!==e)){const t=G.current[e],r=t?.getAttribute("data-value")||U.current[e],n=t?.getAttribute("data-label")||q.current[e]||K.current[e];r&&(T(r),n&&(J.current[r]=n)),n&&B(n)}}),[ue,ve,T]);l((()=>{const e=U.current.findIndex((e=>e===H));if(-1===e)return ne(null),void B(J.current[H]||H);ne(e);const t=G.current[e]?.getAttribute("data-label")||q.current[e]||K.current[e]||H;J.current[H]=t,B(t)}),[le,H]);const Oe=d.useListNavigation(ye,{listRef:G,activeIndex:ee,selectedIndex:re,onNavigate:te,virtual:ie,virtualItemRef:_,disabledIndices:ue}),Ae=d.useTypeahead(ye,{listRef:K,activeIndex:ee,selectedIndex:re,enabled:!ie,onMatch:function(e){null===e||ue.includes(e)||(V?te(e):Me(e))},onTypingChange(e){Y.current=e}}),{getReferenceProps:ke,getFloatingProps:De,getItemProps:$e}=d.useInteractions([Se,we,Ne,Oe,Ae]),Ee=n.useMemo((()=>({isOpen:V,setIsOpen:j,handleSelect:Me,floatingContext:ye,refs:ve,isPositioned:xe,updatePosition:Pe,middlewareData:Ie,placedPlacement:Ce,getFloatingProps:De,getReferenceProps:ke,floatingStyles:Re,getItemProps:$e,activeIndex:ee,selectedIndex:re,elementsRef:G,labelsRef:K,displayLabelsRef:q,valuesRef:U,disabledIndices:Q,setDisabledIndices:X,setActiveIndex:te,selectedLabel:z,selectedValue:H,isTypingRef:Y,virtualItemRef:_,hasSearch:ie,setHasSearch:ae,search:se,setSearch:oe,hiddenIndices:ce,selectedItemRef:W,labelsVersion:le,bumpLabelsVersion:de})),[V,Me,ye,ve,xe,Pe,Ie,Ce,De,ke,Re,$e,ee,re,Q,z,H,ie,se,ce,le]);return e(m.Provider,{value:Ee,children:r(c.div,{...F,className:i,ref:d.useMergeRefs([Z,L]),"data-state":V?"open":"closed",children:[t,fe&&e("select",{name:u,value:H,hidden:!0,"aria-hidden":"true",tabIndex:-1,onChange:()=>{},children:e("option",{value:H,children:H})})]})})}));v.displayName="ComboboxPrimitiveRoot";const R=n.forwardRef((({children:t,container:r,...n},i)=>{const{isOpen:l}=a(m),[c,u]=s(!1),f=r||document.querySelector("#rad-ui-theme-container")||document.body;return o((()=>{f&&u(!0)}),[f]),l&&c?e(d.Portal,{root:f,...n,children:t}):null}));R.displayName="ComboboxPrimitivePortal";const y=n.forwardRef((({children:t,className:r,...i},a)=>{const[s,o]=n.useState(new Set),{search:l}=n.useContext(m),d=n.useCallback(((e,t)=>(o((r=>{if(t&&r.has(e))return r;if(!t&&!r.has(e))return r;const n=new Set(r);return t?n.add(e):n.delete(e),n})),()=>{o((t=>{if(!t.has(e))return t;const r=new Set(t);return r.delete(e),r}))})),[]),c=s.size>0,u=""!==l&&!c,f=n.useMemo((()=>({registerItem:d})),[d]);return e(h.Provider,{value:f,children:e("div",{className:r,ref:a,...i,style:{display:u?"none":void 0,...i.style},children:t})})}));y.displayName="ComboboxPrimitiveGroup";const x=n.forwardRef((({className:t,...r},i)=>{const s=a(m),{refs:o,handleSelect:l,labelsRef:u,valuesRef:f,activeIndex:p,elementsRef:h,virtualItemRef:g,getReferenceProps:b,setHasSearch:v,search:R,setSearch:y,setActiveIndex:x}=s,I=n.useRef(null);n.useEffect((()=>(v(!0),x(0),()=>{v(!1),y("")})),[v,x,y]);const P=b();return e(c.input,{type:"search",className:t,placeholder:"Search...",ref:d.useMergeRefs([I,i]),value:R,"aria-activedescendant":g.current?.id||(null!==p&&f.current[p]?f.current[p]:void 0),onChange:e=>y(e.target.value),...P,onKeyDown:e=>{null!==p&&"Enter"===e.key&&(e.preventDefault(),l(p))},...r})}));x.displayName="ComboboxPrimitiveSearch";const I=n.forwardRef(((e,t)=>(console.warn("Direct usage of Combobox is not supported. Please use Combobox.Root, Combobox.Content, etc. instead."),null)));I.displayName="ComboboxPrimitive";const P=I;P.Root=v,P.Content=p,P.Portal=R,P.Item=g,P.Trigger=b,P.Group=y,P.Search=x;export{P as C};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Primitive from '~/core/primitives/Primitive';
|
|
3
|
+
import DialogPrimitive from '~/core/primitives/Dialog';
|
|
4
|
+
|
|
5
|
+
type CommandFilter = (value: string, search: string, keywords: string[]) => number;
|
|
6
|
+
|
|
7
|
+
type CommandRootProps = React.ComponentPropsWithoutRef<typeof Primitive.div> & {
|
|
8
|
+
customRootClass?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
label?: string;
|
|
13
|
+
shouldFilter?: boolean;
|
|
14
|
+
filter?: CommandFilter;
|
|
15
|
+
loop?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare const CommandRoot: React.ForwardRefExoticComponent<CommandRootProps & React.RefAttributes<HTMLElement>>;
|
|
18
|
+
|
|
19
|
+
type DialogPrimitiveRootProps$1 = {
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
onClickOutside?: () => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
/** When true, outside pointer events and escape key will not close the dialog. */
|
|
26
|
+
disablePointerDismissal?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type DialogPrimitiveRootProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
|
|
30
|
+
type DialogPrimitivePortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
|
|
31
|
+
type DialogPrimitiveOverlayProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>;
|
|
32
|
+
type DialogPrimitiveContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
|
|
33
|
+
type CommandDialogProps = Omit<CommandRootProps, 'ref'> & Pick<DialogPrimitiveRootProps, 'open' | 'onOpenChange' | 'onClickOutside'> & {
|
|
34
|
+
container?: DialogPrimitivePortalProps['container'];
|
|
35
|
+
overlayClassName?: string;
|
|
36
|
+
contentClassName?: string;
|
|
37
|
+
forceMount?: boolean;
|
|
38
|
+
contentProps?: Omit<DialogPrimitiveContentProps, 'children' | 'className'>;
|
|
39
|
+
overlayProps?: Omit<DialogPrimitiveOverlayProps, 'className'>;
|
|
40
|
+
};
|
|
41
|
+
declare const CommandDialog: React.ForwardRefExoticComponent<Omit<CommandRootProps, "ref"> & Pick<Omit<DialogPrimitiveRootProps$1 & React.RefAttributes<HTMLDivElement>, "ref">, "open" | "onOpenChange" | "onClickOutside"> & {
|
|
42
|
+
container?: DialogPrimitivePortalProps["container"];
|
|
43
|
+
overlayClassName?: string;
|
|
44
|
+
contentClassName?: string;
|
|
45
|
+
forceMount?: boolean;
|
|
46
|
+
contentProps?: Omit<DialogPrimitiveContentProps, "children" | "className">;
|
|
47
|
+
overlayProps?: Omit<DialogPrimitiveOverlayProps, "className">;
|
|
48
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
|
|
50
|
+
type CommandInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> & {
|
|
51
|
+
value?: string;
|
|
52
|
+
onValueChange?: (value: string) => void;
|
|
53
|
+
};
|
|
54
|
+
declare const CommandInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange"> & {
|
|
55
|
+
value?: string;
|
|
56
|
+
onValueChange?: (value: string) => void;
|
|
57
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
58
|
+
|
|
59
|
+
type CommandListProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
60
|
+
declare const CommandList: React.ForwardRefExoticComponent<CommandListProps & React.RefAttributes<HTMLElement>>;
|
|
61
|
+
|
|
62
|
+
type CommandItemProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
63
|
+
value?: string;
|
|
64
|
+
keywords?: string[];
|
|
65
|
+
onSelect?: (value: string) => void;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
forceMount?: boolean;
|
|
68
|
+
};
|
|
69
|
+
declare const CommandItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
70
|
+
value?: string;
|
|
71
|
+
keywords?: string[];
|
|
72
|
+
onSelect?: (value: string) => void;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
forceMount?: boolean;
|
|
75
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
76
|
+
|
|
77
|
+
type CommandGroupProps = React.ComponentPropsWithoutRef<typeof Primitive.div> & {
|
|
78
|
+
heading?: React.ReactNode;
|
|
79
|
+
forceMount?: boolean;
|
|
80
|
+
};
|
|
81
|
+
declare const CommandGroup: React.ForwardRefExoticComponent<CommandGroupProps & React.RefAttributes<HTMLElement>>;
|
|
82
|
+
|
|
83
|
+
type CommandEmptyProps = React.ComponentPropsWithoutRef<typeof Primitive.div> & {
|
|
84
|
+
forceMount?: boolean;
|
|
85
|
+
};
|
|
86
|
+
declare const CommandEmpty: React.ForwardRefExoticComponent<CommandEmptyProps & React.RefAttributes<HTMLElement>>;
|
|
87
|
+
|
|
88
|
+
type CommandLoadingProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
89
|
+
declare const CommandLoading: React.ForwardRefExoticComponent<CommandLoadingProps & React.RefAttributes<HTMLElement>>;
|
|
90
|
+
|
|
91
|
+
type CommandSeparatorProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
92
|
+
declare const CommandSeparator: React.ForwardRefExoticComponent<CommandSeparatorProps & React.RefAttributes<HTMLElement>>;
|
|
93
|
+
|
|
94
|
+
type CommandShortcutProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
95
|
+
declare const CommandShortcut: React.ForwardRefExoticComponent<CommandShortcutProps & React.RefAttributes<HTMLElement>>;
|
|
96
|
+
|
|
97
|
+
type CommandComponent = typeof CommandRoot & {
|
|
98
|
+
Root: typeof CommandRoot;
|
|
99
|
+
Dialog: typeof CommandDialog;
|
|
100
|
+
Input: typeof CommandInput;
|
|
101
|
+
List: typeof CommandList;
|
|
102
|
+
Item: typeof CommandItem;
|
|
103
|
+
Group: typeof CommandGroup;
|
|
104
|
+
Empty: typeof CommandEmpty;
|
|
105
|
+
Loading: typeof CommandLoading;
|
|
106
|
+
Separator: typeof CommandSeparator;
|
|
107
|
+
Shortcut: typeof CommandShortcut;
|
|
108
|
+
};
|
|
109
|
+
declare const Command: CommandComponent;
|
|
110
|
+
|
|
111
|
+
export { Command as default };
|
|
112
|
+
export type { CommandDialogProps, CommandEmptyProps, CommandFilter, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandLoadingProps, CommandRootProps, CommandSeparatorProps, CommandShortcutProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react";import{c as a}from"./clsx-BaVHROc5.js";import{P as r}from"./index-m6qHOeQ9.js";import{u as s}from"./index-wRElCyvx.js";import{u as n}from"./useComponentClass-QwNivz0h.js";import{D as l}from"./index-BbEsAodL.js";import{c as i}from"./mergeProps-B9ocQsG4.js";import"./ThemeContext-Sm-iNANd.js";import"./index-Db-tduwt.js";import"./floating-ui.react-Byzse64h.js";import"react-dom";import"./index-gM8bbyw1.js";const d=o.createContext(null),m=()=>{const e=o.useContext(d);if(!e)throw new Error("Command components must be used within Command.Root or Command.Dialog.");return e},c=(e,t,o)=>{const a=t.trim().toLowerCase();if(!a)return 1;return[e,...o].map((e=>e.toLowerCase())).some((e=>e.includes(a)))?1:0},u=o.forwardRef((({children:t,className:l,customRootClass:i="",value:m,defaultValue:u="",onValueChange:p,label:f="Command menu",shouldFilter:v=!0,filter:C=c,loop:g=!1,...h},b)=>{const y=n(i,"Command"),[I,N]=s(m,u,p),[k,w]=o.useState([]),[x,M]=o.useState([]),[S,R]=o.useState(null),D=o.useRef(0),$=o.useId(),j=o.useId(),E=o.useCallback((e=>{N(e.trimStart())}),[N]),V=o.useCallback((e=>{const t=D.current++;return w((o=>{const a=o.filter((t=>t.id!==e.id));return a.push({...e,order:t}),a.sort(((e,t)=>e.order-t.order)),a})),()=>{w((t=>t.filter((t=>t.id!==e.id))))}}),[]),A=o.useCallback(((e,t)=>{w((o=>o.map((o=>o.id===e?{...o,...t}:o))))}),[]),P=o.useCallback((e=>{w((t=>t.filter((t=>t.id!==e))))}),[]),L=o.useCallback((e=>{const t=D.current++;return M((o=>{const a=o.filter((t=>t.id!==e));return a.push({id:e,order:t}),a.sort(((e,t)=>e.order-t.order)),a})),()=>{M((t=>t.filter((t=>t.id!==e))))}}),[]),O=I.trim(),G=o.useMemo((()=>k.map((e=>{const t=v&&O?C(e.value,O,e.keywords):1,o=e.forceMount||t>0;return{...e,score:t,visible:o}}))),[C,k,O,v]),T=o.useMemo((()=>G.filter((e=>e.visible&&!e.disabled))),[G]),B=o.useMemo((()=>T.map((e=>e.id))),[T]),K=o.useMemo((()=>G.reduce(((e,t)=>t.groupId&&t.visible?(e[t.groupId]=(e[t.groupId]||0)+1,e):e),{})),[G]);o.useEffect((()=>{0!==B.length?R((e=>e&&B.includes(e)?e:B[0])):R(null)}),[B]),o.useEffect((()=>{if(!S)return;const e=k.find((e=>e.id===S)),t=e?.ref.current;t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}),[S,k]);const F=o.useCallback((e=>{if(0===T.length)return;const t=S?T.findIndex((e=>e.id===S)):-1;let o=t+e;-1===t&&(o=1===e?0:T.length-1),g?(o<0&&(o=T.length-1),o>=T.length&&(o=0)):o=Math.max(0,Math.min(T.length-1,o)),R(T[o]?.id||null)}),[S,g,T]),H=o.useCallback((e=>{0!==T.length&&R("start"===e?T[0].id:T[T.length-1].id)}),[T]),U=o.useCallback((()=>{if(!S)return;const e=T.find((e=>e.id===S));e&&!e.disabled&&e.onSelect?.(e.value)}),[S,T]),q=o.useCallback((e=>{const t=G.find((t=>t.id===e)),o=Boolean(t?.visible),a=S===e;return{active:a,visible:o,selected:a}}),[S,G]),z=o.useCallback((e=>K[e]||0),[K]),J=o.useCallback((e=>{const t=x.find((t=>t.id===e));if(!t)return!1;const o=G.some((e=>e.visible&&e.order<t.order)),a=G.some((e=>e.visible&&e.order>t.order));return o&&a}),[G,x]),Q=o.useMemo((()=>({rootClass:y,label:f,listId:$,inputId:j,search:I,setSearch:E,loop:g,shouldFilter:v,registerItem:V,updateItem:A,unregisterItem:P,registerSeparator:L,activeItemId:S,setActiveItemId:R,moveActive:F,moveToBoundary:H,selectActiveItem:U,getItemState:q,visibleItemCount:G.filter((e=>e.visible)).length,getVisibleGroupItemCount:z,getSeparatorVisible:J})),[S,q,J,z,j,f,$,g,F,H,V,L,y,I,U,E,v,G,P,A]);return e(d.Provider,{value:Q,children:e(r.div,{ref:b,className:a(y,l),"data-slot":"command-root","data-value":O||void 0,...h,children:t})})}));u.displayName="Command";const p=o.forwardRef((({children:o,className:r,customRootClass:s="",open:i,onOpenChange:d,onClickOutside:m,container:c,overlayClassName:p,contentClassName:f,forceMount:v=!1,contentProps:C,overlayProps:g,...h},b)=>{const y=n(s,"Command");return e(l.Root,{open:i,onOpenChange:d,onClickOutside:m,children:t(l.Portal,{container:c,forceMount:v,children:[e(l.Overlay,{className:a(y&&`${y}-overlay`,p),"data-slot":"command-overlay",...g}),e(l.Content,{ref:b,className:a(y&&`${y}-dialog-content`,f),"data-slot":"command-dialog-content",...C,children:e(u,{customRootClass:s,className:r,...h,children:o})})]})})}));p.displayName="CommandDialog";const f=o.forwardRef((({className:t,value:o,onValueChange:s,onKeyDown:n,...l},i)=>{const{rootClass:d,label:c,listId:u,inputId:p,search:f,setSearch:v,moveActive:C,moveToBoundary:g,selectActiveItem:h}=m(),b=o??f;return e(r.input,{ref:i,type:"text",id:p,className:a(d&&`${d}-input`,t),"data-slot":"command-input",role:"combobox","aria-autocomplete":"list","aria-controls":u,"aria-expanded":"true","aria-label":c,value:b,onChange:e=>{const t=e.currentTarget.value;void 0===o&&v(t),s?.(t)},onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),C(1)),"ArrowUp"===e.key&&(e.preventDefault(),C(-1)),"Home"===e.key&&(e.preventDefault(),g("start")),"End"===e.key&&(e.preventDefault(),g("end")),"Enter"===e.key&&(e.preventDefault(),h()),n?.(e)},...l})}));f.displayName="CommandInput";const v=o.forwardRef((({className:t,...o},s)=>{const{rootClass:n,listId:l,label:i}=m();return e(r.div,{ref:s,id:l,className:a(n&&`${n}-list`,t),"data-slot":"command-list",role:"listbox","aria-label":i,...o})}));v.displayName="CommandList";const C=o.createContext(null),g=o.forwardRef((({children:t,className:s,value:n,keywords:l,onSelect:d,disabled:c=!1,forceMount:u=!1,onMouseMove:p,onClick:f,...v},g)=>{const{registerItem:b,setActiveItemId:y,getItemState:I,rootClass:N}=m(),k=o.useContext(C),w=o.useId(),x=o.useRef(null),M=o.useMemo((()=>l??[]),[l]),S=o.useMemo((()=>"string"==typeof n&&n.length>0?n:"string"==typeof t||"number"==typeof t?String(t):w),[t,w,n]);o.useEffect((()=>b({id:w,value:S,keywords:M,disabled:c,forceMount:u,groupId:k,ref:x,onSelect:d})),[c,u,k,S,w,M,d,b]);const{active:R,visible:D,selected:$}=I(w);return D||u?e(r.div,{ref:i(x,g),className:a(h(N),s),"data-slot":"command-item","data-disabled":c?"":void 0,"data-selected":$?"":void 0,"data-value":S,role:"option","aria-disabled":c||void 0,"aria-selected":$,tabIndex:c?-1:0,hidden:!D,onMouseMove:e=>{c||y(w),p?.(e)},onClick:e=>{c||(y(w),d?.(S)),f?.(e)},onKeyDown:e=>{c||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d?.(S))},...v,children:t}):null})),h=e=>e?`${e}-item`:void 0;g.displayName="CommandItem";const b=o.forwardRef((({children:s,className:n,heading:l,forceMount:i=!1,...d},c)=>{const{rootClass:u,getVisibleGroupItemCount:p}=m(),f=o.useId(),v=o.useId(),g=p(f),h=i||g>0;return e(C.Provider,{value:f,children:t(r.div,{ref:c,className:a(u&&`${u}-group`,n),"data-slot":"command-group",role:"presentation",hidden:!h,...d,children:[l?e(r.div,{className:u?`${u}-group-heading`:void 0,"data-slot":"command-group-heading",id:v,children:l}):null,e(r.div,{className:u?`${u}-group-items`:void 0,"data-slot":"command-group-items",role:"group","aria-labelledby":l?v:void 0,children:s})]})})}));b.displayName="CommandGroup";const y=o.forwardRef((({className:t,forceMount:o=!1,...s},n)=>{const{rootClass:l,visibleItemCount:i}=m(),d=o||0===i;return d||o?e(r.div,{ref:n,className:a(l&&`${l}-empty`,t),"data-slot":"command-empty",role:"status",hidden:!d,...s}):null}));y.displayName="CommandEmpty";const I=o.forwardRef((({className:t,...o},s)=>{const{rootClass:n}=m();return e(r.div,{ref:s,className:a(n&&`${n}-loading`,t),"data-slot":"command-loading","aria-live":"polite","aria-busy":"true",...o})}));I.displayName="CommandLoading";const N=o.forwardRef((({className:t,...s},n)=>{const{rootClass:l,registerSeparator:i,getSeparatorVisible:d}=m(),c=o.useId();o.useEffect((()=>i(c)),[i,c]);return d(c)?e(r.div,{ref:n,className:a(l&&`${l}-separator`,t),"data-slot":"command-separator",role:"separator",...s}):null}));N.displayName="CommandSeparator";const k=o.forwardRef((({className:t,...o},s)=>{const{rootClass:n}=m();return e(r.span,{ref:s,className:a(n&&`${n}-shortcut`,t),"data-slot":"command-shortcut",...o})}));k.displayName="CommandShortcut";const w=u;w.Root=u,w.Dialog=p,w.Input=f,w.List=v,w.Item=g,w.Group=b,w.Empty=y,w.Loading=I,w.Separator=N,w.Shortcut=k;export{w as default};
|
|
@@ -7,15 +7,15 @@ type ContextMenuRootProps = {
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
customRootClass?: string;
|
|
9
9
|
className?: string;
|
|
10
|
-
variant?:
|
|
11
|
-
size?:
|
|
10
|
+
variant?: string;
|
|
11
|
+
size?: string;
|
|
12
12
|
} & ComponentPropsWithoutRef<typeof MenuPrimitive.Root>;
|
|
13
13
|
declare const ContextMenuRoot: React.ForwardRefExoticComponent<{
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
customRootClass?: string;
|
|
16
16
|
className?: string;
|
|
17
|
-
variant?:
|
|
18
|
-
size?:
|
|
17
|
+
variant?: string;
|
|
18
|
+
size?: string;
|
|
19
19
|
} & Omit<{
|
|
20
20
|
children: React.ReactNode;
|
|
21
21
|
className?: string;
|
|
@@ -24,6 +24,8 @@ declare const ContextMenuRoot: React.ForwardRefExoticComponent<{
|
|
|
24
24
|
defaultOpen?: boolean;
|
|
25
25
|
crossAxisOffset?: number;
|
|
26
26
|
mainAxisOffset?: number;
|
|
27
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
28
|
+
collisionPadding?: number;
|
|
27
29
|
loop?: boolean;
|
|
28
30
|
placement?: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
|
29
31
|
avoidCollision?: boolean;
|
|
@@ -117,6 +119,8 @@ declare const ContextMenuSub: React.ForwardRefExoticComponent<{
|
|
|
117
119
|
defaultOpen?: boolean;
|
|
118
120
|
crossAxisOffset?: number;
|
|
119
121
|
mainAxisOffset?: number;
|
|
122
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
123
|
+
collisionPadding?: number;
|
|
120
124
|
loop?: boolean;
|
|
121
125
|
placement?: "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
|
122
126
|
avoidCollision?: boolean;
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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
|
|