@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.
- package/README.md +2 -0
- package/dist/components/Accordion.d.ts +20 -34
- package/dist/components/Accordion.js +1 -1
- package/dist/components/AlertDialog.d.ts +46 -1
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AspectRatio.d.ts +2 -2
- package/dist/components/AspectRatio.js +1 -1
- package/dist/components/Avatar.d.ts +4 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/AvatarGroup.d.ts +9 -1
- package/dist/components/AvatarGroup.js +1 -1
- package/dist/components/AvatarPrimitiveFallback-C1siRii4.js +1 -0
- package/dist/components/Badge.d.ts +3 -3
- package/dist/components/Badge.js +1 -1
- package/dist/components/BlockQuote.js +1 -1
- package/dist/components/Breadcrumb.d.ts +70 -0
- package/dist/components/Breadcrumb.js +1 -0
- package/dist/components/Button.js +1 -1
- package/dist/components/Callout.d.ts +4 -1
- package/dist/components/Callout.js +1 -1
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.d.ts +29 -3
- package/dist/components/Checkbox.js +8 -1
- package/dist/components/CheckboxCards.d.ts +31 -4
- package/dist/components/CheckboxCards.js +1 -1
- package/dist/components/CheckboxGroup.d.ts +29 -2
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/CheckboxGroupPrimitive-DfHQYkep.js +1 -0
- package/dist/components/Code.js +1 -1
- package/dist/components/Collapsible.d.ts +10 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Combobox.d.ts +1 -1
- package/dist/components/Combobox.js +1 -1
- package/dist/components/ComboboxPrimitive-DQcJ8pzQ.js +1 -0
- package/dist/components/Command.d.ts +7 -1
- package/dist/components/Command.js +1 -1
- package/dist/components/ContextMenu.d.ts +23 -23
- package/dist/components/ContextMenu.js +1 -1
- package/dist/components/DataList.d.ts +10 -4
- package/dist/components/DataList.js +1 -1
- package/dist/components/Dialog.d.ts +7 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Disclosure.d.ts +17 -7
- package/dist/components/Disclosure.js +1 -1
- package/dist/components/Drawer.d.ts +95 -17
- package/dist/components/Drawer.js +1 -1
- package/dist/components/DropdownMenu.d.ts +23 -23
- package/dist/components/DropdownMenu.js +1 -1
- package/dist/components/Em.js +1 -1
- package/dist/components/Fieldset.d.ts +43 -0
- package/dist/components/Fieldset.js +1 -0
- package/dist/components/Heading.js +1 -1
- package/dist/components/HoverCard.d.ts +3 -1
- package/dist/components/HoverCard.js +1 -1
- package/dist/components/Kbd.js +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/LiveRegion.d.ts +73 -0
- package/dist/components/LiveRegion.js +1 -0
- package/dist/components/MenuPrimitive-D9VMz2TZ.js +1 -0
- package/dist/components/Menubar.d.ts +119 -29
- package/dist/components/Menubar.js +1 -1
- package/dist/components/Minimap.d.ts +16 -12
- package/dist/components/Minimap.js +1 -1
- package/dist/components/NavigationMenu.d.ts +11 -3
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.d.ts +23 -2
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Popover.d.ts +83 -0
- package/dist/components/Popover.js +1 -0
- package/dist/components/Progress.d.ts +5 -4
- package/dist/components/Progress.js +1 -1
- package/dist/components/Quote.js +1 -1
- package/dist/components/Radio.js +1 -1
- package/dist/components/RadioCards.d.ts +1 -1
- package/dist/components/RadioCards.js +1 -1
- package/dist/components/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/RadioGroupPrimitive-D1PP4y2M.js +1 -0
- package/dist/components/ScrollArea.d.ts +8 -4
- package/dist/components/ScrollArea.js +1 -1
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Separator.js +1 -1
- package/dist/components/Skeleton.d.ts +12 -6
- package/dist/components/Skeleton.js +1 -1
- package/dist/components/Slider.d.ts +2 -2
- package/dist/components/Slider.js +1 -1
- package/dist/components/Spinner.js +1 -1
- package/dist/components/Splitter.d.ts +7 -1
- package/dist/components/Splitter.js +1 -1
- package/dist/components/Steps.d.ts +25 -10
- package/dist/components/Steps.js +1 -1
- package/dist/components/Strong.js +1 -1
- package/dist/components/Switch.d.ts +23 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/TabNav.d.ts +34 -9
- package/dist/components/TabNav.js +1 -1
- package/dist/components/Table.d.ts +66 -19
- package/dist/components/Table.js +1 -1
- package/dist/components/Tabs.d.ts +3 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/Text.d.ts +2 -2
- package/dist/components/Text.js +1 -1
- package/dist/components/TextArea.d.ts +4 -4
- package/dist/components/TextArea.js +1 -1
- package/dist/components/TextField.d.ts +1 -1
- package/dist/components/TextField.js +1 -1
- package/dist/components/Toast.d.ts +325 -0
- package/dist/components/Toast.js +1 -0
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +1 -1
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/Toolbar.d.ts +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Tooltip.d.ts +12 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tree.d.ts +2 -1
- package/dist/components/Tree.js +1 -1
- package/dist/components/VisuallyHidden.js +1 -1
- package/dist/components/{check-DujVUWP-.js → check-ctUdF4Q3.js} +4 -4
- package/dist/components/documentOverlayOpen-coyGmcyL.js +1 -0
- package/dist/components/{floating-ui.react-Byzse64h.js → floating-ui.react-2kiGB4sW.js} +1 -1
- package/dist/components/index-C7dBo_Ry.js +1 -0
- package/dist/components/index-CBcSLg6O.js +1 -0
- package/dist/components/index-CbNq68zs.js +1 -0
- package/dist/components/index-D8I-rMwz.js +1 -0
- package/dist/components/index-DMX7gpdp.js +1 -0
- package/dist/components/index-FITGoHty.js +1 -0
- package/dist/components/index-XF8itt-H.js +1 -0
- package/dist/components/index-nYRBURkR.js +1 -0
- package/dist/components/index-xlB--dex.js +1 -0
- package/dist/components/keyboard-BKF7hXqL.js +1 -0
- package/dist/components/mergeProps-0RucjqeH.js +1 -0
- package/dist/components/useComponentClass-C0isGl1z.js +1 -0
- package/dist/themes/baremetal.css +1 -0
- package/dist/themes/default.css +1 -0
- package/dist/themes/tailwind-presets/default.css +396 -0
- package/package.json +65 -23
- package/dist/components/AvatarPrimitiveFallback-BOYawMc9.js +0 -1
- package/dist/components/CheckboxGroupPrimitive-Cd8ra39e.js +0 -1
- package/dist/components/ComboboxPrimitive-BhHSrtiY.js +0 -1
- package/dist/components/MenuPrimitive-wJbEC-gM.js +0 -1
- package/dist/components/RadioGroupPrimitive-CcvI-_wm.js +0 -1
- package/dist/components/clsx-BaVHROc5.js +0 -1
- package/dist/components/index-BbEsAodL.js +0 -1
- package/dist/components/index-DOVR6Rd5.js +0 -1
- package/dist/components/index-DU_6Msfu.js +0 -1
- package/dist/components/index-Db-tduwt.js +0 -1
- package/dist/components/index-Ir5FYyWW.js +0 -1
- package/dist/components/index-gM8bbyw1.js +0 -1
- package/dist/components/index-m6qHOeQ9.js +0 -1
- package/dist/components/mergeProps-B9ocQsG4.js +0 -1
- package/dist/components/useComponentClass-QwNivz0h.js +0 -1
- package/dist/themes/tailwind-presets/default.js +0 -1
|
@@ -9,11 +9,37 @@ type CheckboxRootProps = {
|
|
|
9
9
|
variant?: string;
|
|
10
10
|
size?: string;
|
|
11
11
|
} & ComponentPropsWithoutRef<typeof CheckboxPrimitiveRoot>;
|
|
12
|
+
declare const CheckboxRoot: React__default.ForwardRefExoticComponent<{
|
|
13
|
+
customRootClass?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
variant?: string;
|
|
16
|
+
size?: string;
|
|
17
|
+
} & Omit<{
|
|
18
|
+
children: React__default.ReactNode;
|
|
19
|
+
checked?: boolean | "indeterminate" | null;
|
|
20
|
+
defaultChecked?: boolean | "indeterminate" | null;
|
|
21
|
+
onCheckedChange?: (value: boolean | "indeterminate" | null) => void;
|
|
22
|
+
name?: string;
|
|
23
|
+
value?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
} & Omit<Omit<Omit<{
|
|
26
|
+
label?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
asChild?: boolean;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
onChange?: any;
|
|
31
|
+
} & Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>, "ref">, "defaultChecked" | "checked"> & React__default.RefAttributes<HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
12
32
|
|
|
13
33
|
type CheckboxIndicatorProps = {
|
|
14
34
|
children?: React__default.ReactNode;
|
|
15
35
|
className?: string;
|
|
16
36
|
} & Omit<ComponentPropsWithoutRef<typeof CheckboxPrimitiveIndicator>, 'children'>;
|
|
37
|
+
declare const CheckboxIndicator: React__default.ForwardRefExoticComponent<{
|
|
38
|
+
children?: React__default.ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
} & Omit<Omit<Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
41
|
+
children: React__default.ReactNode;
|
|
42
|
+
} & React__default.RefAttributes<HTMLSpanElement>, "ref">, "children"> & React__default.RefAttributes<HTMLSpanElement>>;
|
|
17
43
|
|
|
18
44
|
declare const Checkbox: {
|
|
19
45
|
(): null;
|
|
@@ -30,13 +56,13 @@ declare const Checkbox: {
|
|
|
30
56
|
name?: string;
|
|
31
57
|
value?: string;
|
|
32
58
|
id?: string;
|
|
33
|
-
} & Omit<Omit<{
|
|
59
|
+
} & Omit<Omit<Omit<{
|
|
34
60
|
label?: string;
|
|
35
61
|
description?: string;
|
|
36
62
|
asChild?: boolean;
|
|
37
63
|
required?: boolean;
|
|
38
64
|
onChange?: any;
|
|
39
|
-
} & Omit<React$1.DetailedHTMLProps<React$1.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
65
|
+
} & Omit<React$1.DetailedHTMLProps<React$1.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref">, "defaultChecked" | "checked"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
40
66
|
Indicator: React$1.ForwardRefExoticComponent<{
|
|
41
67
|
children?: React.ReactNode;
|
|
42
68
|
className?: string;
|
|
@@ -45,5 +71,5 @@ declare const Checkbox: {
|
|
|
45
71
|
} & React$1.RefAttributes<HTMLSpanElement>, "ref">, "children"> & React$1.RefAttributes<HTMLSpanElement>>;
|
|
46
72
|
};
|
|
47
73
|
|
|
48
|
-
export { Checkbox as default };
|
|
74
|
+
export { CheckboxIndicator as Indicator, CheckboxRoot as Root, Checkbox as default };
|
|
49
75
|
export type { CheckboxIndicatorProps, CheckboxRootProps };
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as
|
|
1
|
+
'use client';import{jsx as e,jsxs as t}from"react/jsx-runtime";import r,{forwardRef as a,useRef as i,useEffect as s,useContext as n}from"react";import{B as d}from"./index-FITGoHty.js";import{c as o}from"./index-CXzybYmm.js";import{u as c}from"./index-wRElCyvx.js";import{u as l,c as m}from"./useComponentClass-C0isGl1z.js";import{c as h,a as u,b as k}from"./index-eAZUMNef.js";import{c as C,C as p}from"./check-ctUdF4Q3.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./ThemeContext-Sm-iNANd.js";const x=r.createContext({isChecked:!1,setIsChecked:()=>{},id:"",required:!1,disabled:!1}),b=a((({children:t,className:a="",onClick:i,...s},n)=>{const{isChecked:c,setIsChecked:l,id:m,required:h,disabled:u}=r.useContext(x),k="indeterminate"===c||null===c?"indeterminate":c?"checked":"unchecked",C="indeterminate"===c||null===c?"mixed":c;return e(d,{ref:n,...s,onClick:o(i,(()=>{l("indeterminate"===c||null===c||!c)})),role:"checkbox",id:m,"aria-checked":C,"aria-required":h,"data-checked":c,"data-state":k,disabled:u,"data-disabled":u?"":void 0,className:a,children:t})}));b.displayName="CheckboxPrimitiveTrigger";const f=a((({children:r,className:a="",checked:n,defaultChecked:d=!1,onCheckedChange:o,disabled:l,required:m,name:h,value:u,id:k,...C},p)=>{const[f,v]=c(n,d,o),N=i(null);s((()=>{N.current&&(N.current.indeterminate="indeterminate"===f||null===f)}),[f]);const j=i(d);s((()=>{const e=N.current?.form;if(!e)return;const t=()=>v(j.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}),[v]);const y={isChecked:f,setIsChecked:v,id:k,required:m,disabled:l};return t(x.Provider,{value:y,children:[e(b,{ref:p,className:a,disabled:l,required:m,...C,children:r}),e("input",{ref:N,type:"checkbox","aria-hidden":"true",tabIndex:-1,style:{position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"},name:h,value:u??"on",checked:!0===f,disabled:l,required:m,onChange:()=>{}})]})}));f.displayName="CheckboxPrimitiveRoot";const v=r.createContext({rootClass:""}),N="Checkbox",j=a((({children:t,className:r="",customRootClass:a,color:i="",variant:s,size:n,...d},o)=>{const c=l(a,N),C=h("checkbox",{variant:s,size:n}),p=k(i),x=u(C,p,{"data-slot":"checkbox-root"});return e(v.Provider,{value:{rootClass:c},children:e(f,{ref:o,className:m(c,r),...d,...x,children:t})})}));j.displayName=N;const y=a((({children:t,className:a="",...i},s)=>{const{isChecked:n,disabled:d}=r.useContext(x),o="indeterminate"===n||null===n;return!0===n||o?e("span",{ref:s,...i,className:a,"data-state":o?"indeterminate":"checked","data-disabled":d?"":void 0,children:t}):null}));y.displayName="CheckboxPrimitiveIndicator";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.575.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
const I=C("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),g=a((({children:r,className:a="",...i},s)=>{const{rootClass:d}=n(v),{isChecked:o}=n(x);return t(y,{ref:s,...i,"data-slot":"checkbox-indicator",children:[e("indeterminate"===o||null===o?I:p,{width:15,height:15,className:m(d&&`${d}-indicator`,a)}),r]})}));g.displayName="CheckboxIndicator";const q=()=>(console.warn("Direct usage of Checkbox is not supported. Please use Checkbox.Root, Checkbox.Indicator instead."),null);q.Root=j,q.Indicator=g;export{g as Indicator,j as Root,q as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import React__default, { ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
import CheckboxGroupPrimitive from '~/core/primitives/CheckboxGroup/CheckboxGroupPrimitive';
|
|
4
4
|
|
|
5
5
|
type CheckboxCardsRootProps = {
|
|
@@ -8,14 +8,41 @@ type CheckboxCardsRootProps = {
|
|
|
8
8
|
variant?: string;
|
|
9
9
|
size?: string;
|
|
10
10
|
} & ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Root>;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
declare const CheckboxCardsRoot: React__default.ForwardRefExoticComponent<{
|
|
12
|
+
customRootClass?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
variant?: string;
|
|
15
|
+
size?: string;
|
|
16
|
+
} & Omit<{
|
|
17
|
+
name?: string;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
dir?: "ltr" | "rtl";
|
|
21
|
+
orientation?: "horizontal" | "vertical" | "both";
|
|
22
|
+
loop?: boolean;
|
|
23
|
+
defaultValue?: string[];
|
|
24
|
+
value?: string[];
|
|
25
|
+
onValueChange?: (value: string[]) => void;
|
|
26
|
+
} & Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React__default.RefAttributes<HTMLDivElement>, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
13
27
|
|
|
14
28
|
type CheckboxCardsItemProps = {
|
|
15
29
|
value: string;
|
|
16
30
|
} & ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Trigger>;
|
|
31
|
+
declare const CheckboxCardsItem: React__default.ForwardRefExoticComponent<{
|
|
32
|
+
value: string;
|
|
33
|
+
} & Omit<{
|
|
34
|
+
value: string;
|
|
35
|
+
required?: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
checked?: boolean;
|
|
38
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
39
|
+
} & Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
|
|
41
|
+
type CheckboxCardsContentProps = ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Content>;
|
|
42
|
+
declare const CheckboxCardsContent: React__default.ForwardRefExoticComponent<Omit<Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React__default.RefAttributes<HTMLSpanElement>, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
|
|
17
43
|
|
|
18
44
|
type CheckboxCardsIndicatorProps = ComponentPropsWithoutRef<'svg'>;
|
|
45
|
+
declare const CheckboxCardsIndicator: React__default.ForwardRefExoticComponent<Omit<React__default.SVGProps<SVGSVGElement>, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
19
46
|
|
|
20
47
|
declare const CheckboxCards: {
|
|
21
48
|
(): null;
|
|
@@ -48,5 +75,5 @@ declare const CheckboxCards: {
|
|
|
48
75
|
Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
49
76
|
};
|
|
50
77
|
|
|
51
|
-
export { CheckboxCards as default };
|
|
78
|
+
export { CheckboxCardsContent as Content, CheckboxCardsIndicator as Indicator, CheckboxCardsItem as Item, CheckboxCardsRoot as Root, CheckboxCards as default };
|
|
52
79
|
export type { CheckboxCardsContentProps, CheckboxCardsIndicatorProps, CheckboxCardsItemProps, CheckboxCardsRootProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as o}from"react/jsx-runtime";import e,{forwardRef as s,useContext as t}from"react";import{C as r}from"./CheckboxGroupPrimitive-DfHQYkep.js";import{u as a,c as i}from"./useComponentClass-C0isGl1z.js";import{c as n,a as c,b as m}from"./index-eAZUMNef.js";import{C as l}from"./check-ctUdF4Q3.js";import"./index-C7dBo_Ry.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";import"./ThemeContext-Sm-iNANd.js";const d=e.createContext({rootClass:""}),C="CheckboxCards",p=s((({children:e,customRootClass:s="",className:t="",color:l="",variant:p="",size:h="",orientation:x="both",...u},b)=>{const f=a(s,C),j=n("checkbox-cards",{variant:p,size:h}),k=m(l),N=c(j,k);return o(d.Provider,{value:{rootClass:f},children:o(r.Root,{ref:b,className:i(f&&`${f}-root`,f,t),...u,...N,orientation:x,children:e})})}));p.displayName=C;const h=s((({children:s,className:t="",value:a,...n},c)=>{const{rootClass:m}=e.useContext(d);return o(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}=e.useContext(d),m=i(c?`${c}-content`:void 0,t)||void 0;return o(r.Content,{ref:n,className:m,...a,children:s})}));x.displayName="CheckboxCardsContent";const u=s((({className:e,...s},r)=>{const{rootClass:a}=t(d);return o(l,{ref:r,width:15,height:15,className:i(a&&`${a}-tick-icon`,e),...s})}));u.displayName="CheckboxCardsIndicator";const b=()=>(console.warn("Direct usage of CheckboxCards is not supported. Please use CheckboxCards.Root, CheckboxCards.Item instead."),null);b.Root=p,b.Content=x,b.Item=h,b.Indicator=u;export{x as Content,u as Indicator,h as Item,p as Root,b as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import React__default, { ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
import CheckboxGroupPrimitive from '~/core/primitives/CheckboxGroup/CheckboxGroupPrimitive';
|
|
4
4
|
import Primitive from '~/core/primitives/Primitive';
|
|
5
5
|
|
|
@@ -9,14 +9,41 @@ type CheckboxGroupRootProps = {
|
|
|
9
9
|
variant?: string;
|
|
10
10
|
size?: string;
|
|
11
11
|
} & ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Root>;
|
|
12
|
+
declare const CheckboxGroupRoot: React__default.ForwardRefExoticComponent<{
|
|
13
|
+
customRootClass?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
variant?: string;
|
|
16
|
+
size?: string;
|
|
17
|
+
} & Omit<{
|
|
18
|
+
name?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
dir?: "ltr" | "rtl";
|
|
22
|
+
orientation?: "horizontal" | "vertical" | "both";
|
|
23
|
+
loop?: boolean;
|
|
24
|
+
defaultValue?: string[];
|
|
25
|
+
value?: string[];
|
|
26
|
+
onValueChange?: (value: string[]) => void;
|
|
27
|
+
} & Omit<React__default.DetailedHTMLProps<React__default.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React__default.RefAttributes<HTMLDivElement>, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
12
28
|
|
|
13
29
|
type CheckboxGroupTriggerProps = {
|
|
14
30
|
value?: string;
|
|
15
31
|
} & ComponentPropsWithoutRef<typeof CheckboxGroupPrimitive.Trigger>;
|
|
32
|
+
declare const CheckboxGroupTrigger: React__default.ForwardRefExoticComponent<{
|
|
33
|
+
value?: string;
|
|
34
|
+
} & Omit<{
|
|
35
|
+
value: string;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
checked?: boolean;
|
|
39
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
40
|
+
} & Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
16
41
|
|
|
17
42
|
type CheckboxGroupLabelProps = ComponentPropsWithoutRef<typeof Primitive.label>;
|
|
43
|
+
declare const CheckboxGroupLabel: React__default.ForwardRefExoticComponent<CheckboxGroupLabelProps & React__default.RefAttributes<HTMLElement>>;
|
|
18
44
|
|
|
19
45
|
type CheckboxGroupIndicatorProps = ComponentPropsWithoutRef<'svg'>;
|
|
46
|
+
declare const CheckboxGroupIndicator: React__default.ForwardRefExoticComponent<Omit<React__default.SVGProps<SVGSVGElement>, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
20
47
|
|
|
21
48
|
declare const CheckboxGroup: {
|
|
22
49
|
(): null;
|
|
@@ -49,5 +76,5 @@ declare const CheckboxGroup: {
|
|
|
49
76
|
Indicator: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
50
77
|
};
|
|
51
78
|
|
|
52
|
-
export { CheckboxGroup as default };
|
|
79
|
+
export { CheckboxGroupIndicator as Indicator, CheckboxGroupLabel as Label, CheckboxGroupRoot as Root, CheckboxGroupTrigger as Trigger, CheckboxGroup as default };
|
|
53
80
|
export type { CheckboxGroupIndicatorProps, CheckboxGroupLabelProps, CheckboxGroupRootProps, CheckboxGroupTriggerProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as
|
|
1
|
+
'use client';import{jsx as o}from"react/jsx-runtime";import e,{forwardRef as r,useContext as s}from"react";import{C as a}from"./CheckboxGroupPrimitive-DfHQYkep.js";import{u as t,c}from"./useComponentClass-C0isGl1z.js";import{c as i,a as l,b as n}from"./index-eAZUMNef.js";import{P as m}from"./index-XF8itt-H.js";import{C as p}from"./check-ctUdF4Q3.js";import"./index-C7dBo_Ry.js";import"./index-FITGoHty.js";import"./keyboard-BKF7hXqL.js";import"./mergeRefs-B8eZ_q-T.js";import"./index-wRElCyvx.js";import"./ThemeContext-Sm-iNANd.js";import"./mergeProps-0RucjqeH.js";const d=e.createContext({rootClass:""}),u="CheckboxGroup",h=r((({children:e,customRootClass:r="",className:s="",color:m="",variant:p="",size:h="",...x},b)=>{const C=t(r,u),g=i("checkbox-group",{variant:p,size:h}),k=n(m),f=l(g,k,{"data-slot":"checkbox-group-root"});return o(d.Provider,{value:{rootClass:C},children:o(a.Root,{ref:b,className:c(C&&`${C}-root`,C,s),...x,...f,children:e})})}));h.displayName=u;const x=r((({children:r,className:s="",value:t,...i},l)=>{const{rootClass:n}=e.useContext(d);return o(a.Trigger,{ref:l,className:c(n&&`${n}-trigger`,s),value:t,"data-slot":"checkbox-group-trigger",...i,children:o(a.Content,{children:r})})}));x.displayName="CheckboxGroupTrigger";const b=r((({children:e,className:r="",...a},t)=>{const{rootClass:i}=s(d);return o(m.label,{ref:t,className:c(i&&`${i}-label`,r),"data-slot":"checkbox-group-label",...a,children:e})}));b.displayName="CheckboxGroupLabel";const C=r((({className:e,...r},a)=>{const{rootClass:t}=s(d);return o(p,{ref:a,width:15,height:15,className:c(t&&`${t}-tick-icon`,e),"data-slot":"checkbox-group-indicator",...r})}));C.displayName="CheckboxGroupIndicator";const g=()=>(console.warn("Direct usage of CheckboxGroup is not supported. Please use CheckboxGroup.Root, CheckboxGroup.Item instead."),null);g.Root=h,g.Trigger=x,g.Label=b,g.Indicator=C;export{C as Indicator,b as Label,h as Root,x as Trigger,g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use client';import{jsxs as e,jsx as r}from"react/jsx-runtime";import t,{forwardRef as i}from"react";import{R as a}from"./index-C7dBo_Ry.js";import{u as n}from"./index-wRElCyvx.js";import{m as o}from"./mergeRefs-B8eZ_q-T.js";const d=t.createContext({checkedValues:[],setCheckedValues:()=>{},name:"",required:!1,disabled:!1}),s=i((({dir:i,orientation:s,loop:c,defaultValue:l=[],value:u,onValueChange:h,children:m,name:p,required:k,disabled:b,className:C="",...v},f)=>{const[x,g]=n(u,l,h),y=t.useRef(null),N=t.useRef(l);return t.useEffect((()=>{const e=y.current?.closest("form");if(!e)return;const r=()=>g(N.current);return e.addEventListener("reset",r),()=>e.removeEventListener("reset",r)}),[g]),e("div",{ref:o(f,y),className:C,"data-disabled":b?"":void 0,...v,children:[r(a.Root,{dir:i,orientation:s??"both",loop:c??!0,children:r(d.Provider,{value:{checkedValues:x,setCheckedValues:g,name:p,required:k,disabled:b},children:r(a.Group,{children:m})})}),k&&r("input",{type:"checkbox","aria-hidden":"true",tabIndex:-1,required:!0,checked:x.length>0,disabled:b,onChange:()=>{},style:{position:"absolute",width:1,height:1,margin:0,opacity:0,pointerEvents:"none"}})]})}));s.displayName="CheckboxGroupPrimitiveRoot";const c=t.createContext({isChecked:!1}),l=i((({children:i,className:n="",value:o,required:s,disabled:l,checked:u,onCheckedChange:h,onClick:m,...p},k)=>{const{checkedValues:b,setCheckedValues:C,name:v,required:f,disabled:x}=t.useContext(d),g=b.includes(o),y=s||f,N=l||x,{role:q,...R}=p;return e("span",{children:[r(c.Provider,{value:{isChecked:g},children:r(a.Item,{ref:k,onClick:e=>{m?.(e),e.preventDefault(),e.stopPropagation(),b.includes(o)?(C(b.filter((e=>e!==o))),h?.(!1)):b.includes(o)||(C([...b,o]),h?.(!0))},className:n,role:"checkbox","aria-checked":g,"aria-selected":void 0,"aria-required":y||void 0,"aria-disabled":N||void 0,disabled:N,...R,"data-state":g?"checked":"unchecked",children:r("button",{type:"button",disabled:N,children:i})})}),r("input",{type:"checkbox",checked:g,name:v,value:o,style:{display:"none"},required:s,disabled:N,"aria-hidden":"true",readOnly:!0})]})}));l.displayName="CheckboxGroupPrimitiveTrigger";const u=i((({children:e,className:i,...a},n)=>{const{isChecked:o}=t.useContext(c);return r("span",{ref:n,className:i,...a,children:o?e:null})}));u.displayName="CheckboxGroupPrimitiveContent";const h=()=>(console.warn("Direct usage of CheckboxGroup is not supported. Please use CheckboxGroup.Root, CheckboxGroup.Item instead."),null);h.Root=s,h.Trigger=l,h.Content=u;export{h as C};
|
package/dist/components/Code.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as s}from"react/jsx-runtime";import
|
|
1
|
+
'use client';import{jsx as s}from"react/jsx-runtime";import a from"react";import{u as e,c as o}from"./useComponentClass-C0isGl1z.js";import{a as r,b as t,c as m}from"./index-eAZUMNef.js";import"./ThemeContext-Sm-iNANd.js";const i="Code",c=a.forwardRef((({children:a,customRootClass:c="",color:n="",variant:d="",size:l="",className:f,...p},u)=>{const C=e(c,i),j=r(m("code",{variant:d,size:l}),t(n));return s("code",{ref:u,className:o(C,f),...j,...p,children:a})}));c.displayName=i;export{c as default};
|
|
@@ -5,10 +5,19 @@ import CollapsiblePrimitive from '~/core/primitives/Collapsible';
|
|
|
5
5
|
type CollapsibleRootProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root> & {
|
|
6
6
|
customRootClass?: string;
|
|
7
7
|
};
|
|
8
|
+
declare const CollapsibleRoot: React__default.ForwardRefExoticComponent<CollapsibleRootProps & React__default.RefAttributes<HTMLElement>>;
|
|
8
9
|
|
|
9
10
|
type CollapsibleTriggerProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;
|
|
11
|
+
declare const CollapsibleTrigger: React__default.ForwardRefExoticComponent<Omit<Omit<{
|
|
12
|
+
label?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
onChange?: any;
|
|
17
|
+
} & Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
10
18
|
|
|
11
19
|
type CollapsibleContentProps = React__default.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;
|
|
20
|
+
declare const CollapsibleContent: React__default.ForwardRefExoticComponent<CollapsibleContentProps & React__default.RefAttributes<HTMLElement>>;
|
|
12
21
|
|
|
13
22
|
declare const Collapsible: {
|
|
14
23
|
(): null;
|
|
@@ -23,5 +32,5 @@ declare const Collapsible: {
|
|
|
23
32
|
Content: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLElement>>;
|
|
24
33
|
};
|
|
25
34
|
|
|
26
|
-
export { Collapsible as default };
|
|
35
|
+
export { CollapsibleContent as Content, CollapsibleRoot as Root, CollapsibleTrigger as Trigger, Collapsible as default };
|
|
27
36
|
export type { CollapsibleContentProps, CollapsibleRootProps, CollapsibleTriggerProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e}from"react/jsx-runtime";import{c as o}from"./
|
|
1
|
+
'use client';import{jsx as e}from"react/jsx-runtime";import{u as s,c as o}from"./useComponentClass-C0isGl1z.js";import r,{createContext as a,useContext as t}from"react";import{C as l}from"./index-DMX7gpdp.js";import"./ThemeContext-Sm-iNANd.js";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./index-wRElCyvx.js";import"./index-FITGoHty.js";import"./keyboard-BKF7hXqL.js";const i=a({rootClass:"",open:!1,onOpenChange:()=>{},disabled:!1,defaultOpen:!1}),n=r.forwardRef((({children:r,className:a="",transitionDuration:t=0,disabled:n,customRootClass:d,...c},m)=>{const p=s(d,"Collapsible");return e(i.Provider,{value:{rootClass:p,disabled:n},children:e(l.Root,{ref:m,className:o(p,a),transitionDuration:t,disabled:n,...c,children:r})})}));n.displayName="CollapsibleRoot";const d=r.forwardRef((({children:s,className:r,disabled:a,...n},d)=>{const{rootClass:c,disabled:m}=t(i),p=c?`${c}-trigger`:"";return e(l.Trigger,{ref:d,className:o(p,r),disabled:a??m,...n,children:s})}));d.displayName="CollapsibleTrigger";const c=r.forwardRef((({children:s,className:r="",...a},n)=>{const{rootClass:d}=t(i),c=d?`${d}-content`:"";return e(l.Content,{ref:n,className:o(c,r),...a,children:s})}));c.displayName="CollapsibleContent";const m=()=>(console.warn("Direct usage of Collapsible is not supported. Please use Collapsible.Root, Collapsible.Trigger, etc. instead."),null);m.Root=n,m.Trigger=d,m.Content=c;export{c as Content,n as Root,d as Trigger,m as default};
|
|
@@ -96,5 +96,5 @@ interface ComboboxComponent extends React.ForwardRefExoticComponent<React.RefAtt
|
|
|
96
96
|
}
|
|
97
97
|
declare const Combobox: ComboboxComponent;
|
|
98
98
|
|
|
99
|
-
export { Combobox as default };
|
|
99
|
+
export { ComboboxContent as Content, ComboboxGroup as Group, ComboboxIndicator as Indicator, ComboboxItem as Item, ComboboxPortal as Portal, ComboboxRoot as Root, ComboboxSearch as Search, ComboboxTrigger as Trigger, Combobox as default };
|
|
100
100
|
export type { ComboboxContentProps, ComboboxItemProps, ComboboxRootProps, ComboboxSearchProps, ComboboxTriggerProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import o,{useContext as e}from"react";import{jsx as
|
|
1
|
+
'use client';import o,{useContext as e}from"react";import{jsx as a}from"react/jsx-runtime";import{c as r,u as s}from"./useComponentClass-C0isGl1z.js";import{C as t,m as i,a as d}from"./ComboboxPrimitive-DQcJ8pzQ.js";import{C as n}from"./check-ctUdF4Q3.js";import"./ThemeContext-Sm-iNANd.js";import"./index-D8I-rMwz.js";import"./floating-ui.react-2kiGB4sW.js";import"react-dom";import"./index-XF8itt-H.js";import"./mergeProps-0RucjqeH.js";import"./keyboard-BKF7hXqL.js";import"./index-CXzybYmm.js";import"./index-wRElCyvx.js";import"./index-CBcSLg6O.js";import"./index-CbNq68zs.js";import"./documentOverlayOpen-coyGmcyL.js";const l=o.createContext({rootClass:""}),m=o.forwardRef((({customRootClass:o,children:s,className:i,position:d="popper",...n},m)=>{const{rootClass:c}=e(l);return a(t.Content,{className:r(c?`${c}-content`:void 0,i)||void 0,position:d,"data-position":d,ref:m,...n,children:s})}));m.displayName="ComboboxContent";const c=o.forwardRef((({customRootClass:o,children:s,className:i,value:d,disabled:n,...m},c)=>{const{rootClass:p}=e(l);return a(t.Item,{className:r(p?`${p}-item`:void 0,i)||void 0,value:d,disabled:n,"data-disabled":n?"":void 0,role:"option","aria-disabled":n?"true":void 0,ref:c,...m,children:a("span",{className:p?`${p}-text`:void 0,children:s})})}));c.displayName="ComboboxItem",i(c);const p=o.forwardRef((({customRootClass:o,children:s,disabled:i,placeholder:d,className:n,...m},c)=>{const{rootClass:p}=e(l),f=r(p?`${p}-trigger`:void 0,n)||void 0;return a(t.Trigger,{className:f,"aria-disabled":i?"true":void 0,"data-placeholder":d?"":void 0,disabled:i,ref:c,...m,children:s})}));p.displayName="ComboboxTrigger";const f=o.forwardRef((({customRootClass:o,children:e,className:i,defaultValue:d,value:n,onValueChange:m,sideOffset:c=4,...p},f)=>{const u=s(o,"Combobox");return a(l.Provider,{value:{rootClass:u},children:a(t.Root,{className:r(u?`${u}-root`:void 0,i)||void 0,defaultValue:d,value:n,onValueChange:m,sideOffset:c,ref:f,...p,children:e})})}));f.displayName="ComboboxRoot";const u=o.forwardRef((({className:o,...s},t)=>{const{rootClass:i}=e(l),d=r(i?`${i}-item-indicator`:void 0,o)||void 0;return a("div",{className:d,ref:t,...s,children:a(n,{width:16,height:16})})}));u.displayName="ComboboxIndicator";const C=o.forwardRef((({children:o,container:e,...r},s)=>a(t.Portal,{ref:s,container:e,...r,children:o})));C.displayName="ComboboxPortal";const b=o.forwardRef((({children:o,className:s,...i},d)=>{const{rootClass:n}=e(l);return a(t.Group,{className:r(n?`${n}-group`:void 0,s)||void 0,ref:d,...i,children:o})}));b.displayName="ComboboxGroup";const h=o.forwardRef((({className:o,...s},i)=>{const{rootClass:d}=e(l),n=r(d?`${d}-search`:void 0,o)||void 0;return a(t.Search,{className:n,ref:i,...s})}));h.displayName="ComboboxSearch",d(h);const v=o.forwardRef(((o,e)=>(console.warn("Direct usage of Combobox is not supported. Please use Combobox.Root, Combobox.Content, etc. instead."),null)));v.displayName="Combobox";const x=v;x.Root=f,x.Content=m,x.Item=c,x.Trigger=p,x.Portal=C,x.Group=b,x.Indicator=u,x.Search=h;export{m as Content,b as Group,u as Indicator,c as Item,C as Portal,f as Root,h as Search,p as Trigger,x 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,useLayoutEffect as s,useState as o,useEffect as l}from"react";import{F as d}from"./index-D8I-rMwz.js";import{P as c}from"./index-XF8itt-H.js";import{K as u}from"./keyboard-BKF7hXqL.js";import{c as f}from"./index-CXzybYmm.js";import{u as m}from"./index-wRElCyvx.js";import{u as p}from"./index-CBcSLg6O.js";import{T as h}from"./ThemeContext-Sm-iNANd.js";const b=i({}),g="__radComboboxSearchPart",v=e=>(e[g]=!0,e);const y=n.forwardRef((({children:i,className:s,style:o,onKeyDownCapture:l,...c},u)=>{const{isOpen:f,elementsRef:m,labelsRef:p,floatingContext:h,refs:v,middlewareData:y,placedPlacement:x,getFloatingProps:R,floatingStyles:C,isPositioned:P,activeIndex:I,hasSearch:w,handleSelect:S,isTypingRef:E}=a(b),N=d.useMergeRefs([v.setFloating,u]),A="undefined"==typeof navigator||!/jsdom/i.test(navigator.userAgent),D=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"}}}(x),k=!P&&A,M=n.Children.toArray(i),O=e=>n.isValidElement(e)&&Boolean(e.type?.[g]),$=M.some(O),L=M.findIndex((e=>!O(e))),T=$?M.filter(((e,t)=>O(e)&&(-1===L||t<L))):[],V=$?M.filter(((e,t)=>O(e)&&-1!==L&&t>L)):[],j=$?M.filter((e=>!O(e))):[],F=R({...c,onKeyDownCapture:e=>{if(l?.(e),e.defaultPrevented||w||e.target!==e.currentTarget||null===I)return;const t=m.current[I];t&&(["ArrowDown","ArrowUp","Home","End"].includes(e.key)?t.focus({preventScroll:!0}):("Enter"===e.key||" "===e.key&&!E.current)&&(e.preventDefault(),S(I)))},className:s,style:{...C,...o,"--rad-ui-floating-transform-origin":D.transformOrigin,visibility:k||y.hide?.referenceHidden?"hidden":o?.visibility||C.visibility,pointerEvents:y.hide?.referenceHidden?"none":o?.pointerEvents},"data-state":f?"open":"closed","data-side":D.side,"data-align":D.align,"data-positioned":P?"":void 0}),{id:K,role:B,"aria-orientation":H,...U}=F;return e(t,{children:f&&e(d.FocusManager,{context:h,disabled:k,children:e(d.FloatingList,{elementsRef:m,labelsRef:p,children:$?r("div",{ref:N,...U,id:`${K}-popup`,children:[T,e("div",{id:K,role:B,"aria-orientation":H,"data-slot":"combobox-listbox",children:j}),V]}):e("div",{ref:N,...U,id:K,role:B,"aria-orientation":H,children:i})})})})}));y.displayName="ComboboxPrimitiveContent";const x=i(null),R="__radComboboxItemPart",C=e=>(e[R]=!0,e);function P(e){return"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(P).join(""):n.isValidElement(e)?P(e.props.children):""}function I(e,t){let r=null;const i=e=>{if(null!==r)return;if(Array.isArray(e))return void e.forEach(i);if(!n.isValidElement(e))return;const a=e.props;if(Boolean(e.type?.[R])&&a.value===t){const e="string"==typeof a.label&&a.label||P(a.children).trim();r=e||null}else n.Children.forEach(a.children,i)};return i(e),r}const w=n.forwardRef((({children:t,value:r,label:i,disabled:s,className:o,...l},f)=>{const m=a(b);if(!m)return console.error("ComboboxPrimitiveItem must be used within a ComboboxPrimitive"),null;const{handleSelect:p,isTypingRef:h,getItemProps:g,activeIndex:v,selectedIndex:y,selectedValue:R,selectedItemRef:C,hasSearch:I,search:w,hiddenIndices:S,disabledIndices:E,setDisabledIndices:N,labelsRef:A,displayLabelsRef:D,valuesRef:k,bumpLabelsVersion:M,idPrefix:O}=m,$=n.useRef(null),L=i||P(t).trim()||r,{ref:T,index:V}=d.useListItem({label:L}),j=S.includes(V),F=v===V,K=y===V||R===r,B=`${O}-option-${r||V}`,H=s||I?-1:F?0:-1,U=a(x);n.useEffect((()=>{if(U?.registerItem)return U.registerItem(B,!j)}),[U,B,j]),n.useEffect((()=>(k.current[V]=r,A.current[V]=L,D.current[V]=L,()=>{delete k.current[V],delete A.current[V],delete D.current[V]})),[D,V,r,L,A,k]),n.useEffect((()=>(M(),()=>{M()})),[V,L,r,M]),n.useEffect((()=>{const e=V;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))}))}}),[V,s,N]);const z=n.useCallback((e=>{K&&!I?C.current=e:C.current===e&&(C.current=null)}),[I,K,C]);return e(c.div,{ref:d.useMergeRefs([T,$,z,f]),id:B,role:"option",className:o,style:{display:j?"none":void 0,...l.style},"data-value":r,"data-label":L,"data-active":F,"aria-selected":K,"aria-disabled":!!s||void 0,"data-disabled":s?"":void 0,...g({tabIndex:H,onClick:()=>!s&&p(V),onKeyDown:e=>{s||(e.key===u.ENTER&&(e.preventDefault(),p(V)),e.key!==u.SPACE||h.current||(e.preventDefault(),p(V)))}}),...l,tabIndex:H,children:t})}));w.displayName="ComboboxPrimitiveItem",C(w);const S=n.forwardRef((({children:t,className:r,disabled:n,asChild:i,onClick:s,renderValue:o,"aria-disabled":l,"data-placeholder":u,...m},p)=>{const{isOpen:h,selectedLabel:g,selectedValue:v,refs:y,getReferenceProps:x,disabled:R}=a(b),C=Boolean(n||R),P=f(s),I=Boolean(g||v),w=I?o?.(v,g||v):void 0;return e(c.button,{type:i?void 0:"button",className:r,"aria-expanded":h,"data-state":h?"open":"closed","aria-disabled":!!C||l,disabled:!!C||void 0,"data-disabled":C?"":void 0,"data-placeholder":u??(I?void 0:""),ref:d.useMergeRefs([y.setReference,p]),role:"combobox",asChild:i,...x({...m,onClick:P,disabled:C}),children:w??(g||v||t)})}));S.displayName="ComboboxPrimitiveTrigger";const E=n.forwardRef((({children:t,className:i,value:a,name:o,defaultValue:l="",onValueChange:u,onClickOutside:f=()=>{},align:h="start",alignOffset:g=0,avoidCollisions:v=!0,collisionBoundary:y=null,collisionPadding:x=8,constrainSize:R=!0,enableFlip:C=!0,enableShift:P=!0,hideWhenDetached:w=!1,matchReferenceWidth:S=!1,offsetValue:E,onPlaced:N,placement:A,positioningStrategy:D="fixed",side:k="bottom",sideOffset:M,sticky:O="partial",updatePositionStrategy:$="optimized",open:L,defaultOpen:T=!1,onOpenChange:V,disabled:j=!1,required:F=!1,...K},B)=>{const[H,U]=m(L,T,V),z=Boolean(H)&&!j,_=n.useId();p(z);const[W,q]=m(a,l,u),[G,J]=n.useState((()=>W?I(t,W)??W:W)),Q=n.useRef(null),X=n.useRef([]),Y=n.useRef([]),Z=n.useRef([]),ee=n.useRef([]),te=n.useRef({}),[re,ne]=n.useState([]),ie=n.useRef(!1),ae=n.useRef(null),se=n.useRef(null),[oe,le]=n.useState(null),[de,ce]=n.useState(null),[ue,fe]=n.useState(!1),[me,pe]=n.useState(""),[he,be]=n.useReducer((e=>e+1),0),ge=n.useMemo((()=>{if(!me)return[];const e=[];for(let t=0;t<Y.current.length;t++){const r=Y.current[t];r&&!r.toLowerCase().includes(me.toLowerCase())&&e.push(t)}return e}),[me,he]),ve=n.useMemo((()=>{const e=new Set([...re,...ge]);return Array.from(e).sort(((e,t)=>e-t))}),[re,ge]),[ye,xe]=n.useState(!1);n.useEffect((()=>{xe(Boolean(ae.current?.closest("form")))}),[]);const Re=n.useRef(null),Ce=n.useRef(l);n.useEffect((()=>{const e=Re.current?.form;if(!e)return;const t=()=>q(Ce.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}),[ye,o,q]);const Pe=A??function(e,t){return"center"===t?e:`${e}-${t}`}(k,h),Ie=M??E??0,we=n.useMemo((()=>Array.isArray(y)?y:[y]),[y]),Se=n.useMemo((()=>{const e=we.filter((e=>null!=e));return{padding:x,boundary:e,altBoundary:e.length>0}}),[we,x]),Ee=n.useMemo((()=>[d.offset({mainAxis:Ie,alignmentAxis:g}),v&&P&&d.shift({mainAxis:!0,crossAxis:!1,limiter:"partial"===O?d.limitShift():void 0,...Se}),v&&C&&d.flip(Se),R&&d.size({...Se,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`),S?i.width=`${t.reference.width}px`:i.removeProperty("width")}}),w&&d.hide({strategy:"referenceHidden",...Se})].filter(Boolean)),[g,v,R,Se,C,P,w,Ie,S,O]),{refs:Ne,floatingStyles:Ae,context:De,isPositioned:ke,middlewareData:Me,update:Oe,placement:$e}=d.useFloating({middleware:Ee,open:z,onOpenChange:e=>{j&&e||U(e)},placement:Pe,strategy:D,whileElementsMounted:(e,t,r)=>d.autoUpdate(e,t,r,{animationFrame:"always"===$})});s((()=>{ke&&N?.()}),[ke,N]);const Le=d.useClick(De),Te=d.useDismiss(De),Ve=d.useRole(De,{role:"listbox"});const je=n.useCallback((e=>{if(null!==e&&!ve.includes(e)&&(ce(e),U(!1),Ne.reference.current?.focus(),null!==e)){const t=X.current[e],r=t?.getAttribute("data-value")||ee.current[e],n=t?.getAttribute("data-label")||Z.current[e]||Y.current[e];r&&(q(r),n&&(te.current[r]=n)),n&&J(n)}}),[ve,Ne,q,U]);s((()=>{const e=ee.current.findIndex((e=>e===W));if(-1===e)return ce(null),void J(te.current[W]||(W?I(t,W):null)||W);ce(e);const r=X.current[e]?.getAttribute("data-label")||Z.current[e]||Y.current[e]||W;te.current[W]=r,J(r)}),[he,W,t]);const Fe=d.useListNavigation(De,{listRef:X,activeIndex:oe,selectedIndex:de,onNavigate:le,virtual:ue,virtualItemRef:se,disabledIndices:ve}),Ke=d.useTypeahead(De,{listRef:Y,activeIndex:oe,selectedIndex:de,enabled:!ue,onMatch:function(e){null===e||ve.includes(e)||(z?le(e):je(e))},onTypingChange(e){ie.current=e}}),{getReferenceProps:Be,getFloatingProps:He,getItemProps:Ue}=d.useInteractions([Le,Te,Ve,Fe,Ke]),ze=n.useMemo((()=>({isOpen:z,setIsOpen:U,handleSelect:je,floatingContext:De,refs:Ne,isPositioned:ke,updatePosition:Oe,middlewareData:Me,placedPlacement:$e,getFloatingProps:He,getReferenceProps:Be,floatingStyles:Ae,getItemProps:Ue,activeIndex:oe,selectedIndex:de,elementsRef:X,labelsRef:Y,displayLabelsRef:Z,valuesRef:ee,disabledIndices:re,setDisabledIndices:ne,setActiveIndex:le,selectedLabel:G,selectedValue:W,isTypingRef:ie,virtualItemRef:se,hasSearch:ue,setHasSearch:fe,search:me,setSearch:pe,hiddenIndices:ge,selectedItemRef:Q,labelsVersion:he,bumpLabelsVersion:be,idPrefix:_,disabled:j})),[z,je,De,Ne,ke,Oe,Me,$e,He,Be,Ae,Ue,oe,de,re,G,W,ue,me,ge,he,_,j,U]);return e(b.Provider,{value:ze,children:r(c.div,{...K,className:i,ref:d.useMergeRefs([ae,B]),"data-state":z?"open":"closed","data-disabled":j?"":void 0,children:[t,(ye||Boolean(o))&&e("select",{ref:Re,name:o,value:W,required:F,disabled:j,"aria-hidden":"true",tabIndex:-1,onChange:()=>{},onFocus:()=>Ne.reference.current?.focus(),style:{position:"absolute",width:1,height:1,margin:0,padding:0,border:0,opacity:0,pointerEvents:"none",overflow:"hidden"},children:e("option",{value:W,children:W})})]})})}));E.displayName="ComboboxPrimitiveRoot";const N=n.forwardRef((({children:t,container:r,...n},i)=>{const{isOpen:s}=a(b),c=a(h),[u,f]=o(!1),m=r??c?.portalRootRef.current??c?.containerRef.current??("undefined"!=typeof document?document.body:null);return l((()=>{m&&f(!0)}),[m]),s&&u?e(d.Portal,{root:m,...n,children:t}):null}));N.displayName="ComboboxPrimitivePortal";const A=n.forwardRef((({children:t,className:r,...i},a)=>{const[s,o]=n.useState(new Set),{search:l}=n.useContext(b),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(x.Provider,{value:f,children:e("div",{className:r,ref:a,...i,style:{display:u?"none":void 0,...i.style},children:t})})}));A.displayName="ComboboxPrimitiveGroup";const D=n.forwardRef((({className:t,...r},i)=>{const s=a(b),{refs:o,handleSelect:l,activeIndex:f,elementsRef:m,virtualItemRef:p,getReferenceProps:h,setHasSearch:g,search:v,setSearch:y,setActiveIndex:x,hiddenIndices:R,disabledIndices:C}=s,P=n.useRef(null);n.useEffect((()=>(g(!0),x(0),()=>{g(!1),y("")})),[g,x,y]);const I=n.useRef(!0);n.useEffect((()=>{if(I.current)return void(I.current=!1);const e=new Set([...R,...C]),t=m.current.findIndex(((t,r)=>null!=t&&!e.has(r)));x(-1===t?null:t)}),[v,R,C,m,x]);const w=e=>{null!==f&&e.key===u.ENTER&&(e.preventDefault(),l(f)),r.onKeyDown?.(e)},{onKeyDown:S,onKeyUp:E,...N}=h({...r,value:v,onChange:e=>y(e.target.value),onKeyDown:w}),A=e=>e===u.SPACE||e===u.ENTER;return e(c.input,{type:"search",className:t,placeholder:"Search...",ref:d.useMergeRefs([P,i]),"aria-activedescendant":p.current?.id||(null!==f?m.current[f]?.id:void 0),...N,"aria-autocomplete":"list",onKeyDown:e=>{A(e.key)?w(e):S?.(e)},onKeyUp:e=>{A(e.key)?r.onKeyUp?.(e):E?.(e)}})}));D.displayName="ComboboxPrimitiveSearch",v(D);const k=n.forwardRef(((e,t)=>(console.warn("Direct usage of Combobox is not supported. Please use Combobox.Root, Combobox.Content, etc. instead."),null)));k.displayName="ComboboxPrimitive";const M=k;M.Root=E,M.Content=y,M.Portal=N,M.Item=w,M.Trigger=S,M.Group=A,M.Search=D;export{M as C,v as a,P as g,C as m};
|
|
@@ -19,11 +19,17 @@ declare const CommandRoot: React.ForwardRefExoticComponent<CommandRootProps & Re
|
|
|
19
19
|
type DialogPrimitiveRootProps$1 = {
|
|
20
20
|
children: React.ReactNode;
|
|
21
21
|
open?: boolean;
|
|
22
|
+
defaultOpen?: boolean;
|
|
22
23
|
onOpenChange?: (open: boolean) => void;
|
|
23
24
|
onClickOutside?: () => void;
|
|
24
25
|
className?: string;
|
|
25
26
|
/** When true, outside pointer events and escape key will not close the dialog. */
|
|
26
27
|
disablePointerDismissal?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* When false, pressing outside the content (including the overlay) does not
|
|
30
|
+
* close the dialog, while Escape still does. Used by AlertDialog.
|
|
31
|
+
*/
|
|
32
|
+
dismissOnOutsidePress?: boolean;
|
|
27
33
|
};
|
|
28
34
|
|
|
29
35
|
type DialogPrimitiveRootProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root>;
|
|
@@ -108,5 +114,5 @@ type CommandComponent = typeof CommandRoot & {
|
|
|
108
114
|
};
|
|
109
115
|
declare const Command: CommandComponent;
|
|
110
116
|
|
|
111
|
-
export { Command as default };
|
|
117
|
+
export { CommandDialog as Dialog, CommandEmpty as Empty, CommandGroup as Group, CommandInput as Input, CommandItem as Item, CommandList as List, CommandLoading as Loading, CommandRoot as Root, CommandSeparator as Separator, CommandShortcut as Shortcut, Command as default };
|
|
112
118
|
export type { CommandDialogProps, CommandEmptyProps, CommandFilter, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandLoadingProps, CommandRootProps, CommandSeparatorProps, CommandShortcutProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react";import{c as
|
|
1
|
+
'use client';import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react";import{u as a,c as r}from"./useComponentClass-C0isGl1z.js";import{P as s}from"./index-XF8itt-H.js";import{u as n}from"./index-wRElCyvx.js";import{m as l}from"./mergeRefs-B8eZ_q-T.js";import{D as i}from"./index-xlB--dex.js";import{K as d,i as c}from"./keyboard-BKF7hXqL.js";import{c as m}from"./mergeProps-0RucjqeH.js";import"./ThemeContext-Sm-iNANd.js";import"./index-D8I-rMwz.js";import"./floating-ui.react-2kiGB4sW.js";import"react-dom";import"./index-CBcSLg6O.js";import"./index-CbNq68zs.js";import"./documentOverlayOpen-coyGmcyL.js";import"./index-FITGoHty.js";const u=o.createContext(null),p=()=>{const e=o.useContext(u);if(!e)throw new Error("Command components must be used within Command.Root or Command.Dialog.");return e},f={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},v=e=>{const{overflowY:t}=getComputedStyle(e);return("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight},g=(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},C=o.forwardRef((({children:i,className:d,customRootClass:c="",value:m,defaultValue:p="",onValueChange:C,label:h="Command menu",shouldFilter:b=!0,filter:y=g,loop:I=!1,...N},R)=>{const w=a(c,"Command"),[k,S]=n(m,p,C),[x,M]=o.useState([]),[E,D]=o.useState([]),[j,A]=o.useState(null),$=o.useRef(0),O=o.useRef(null),[L,P]=o.useState(""),V=o.useId(),T=o.useId(),B=o.useCallback((e=>{S(e.trimStart())}),[S]),G=o.useCallback((e=>{const t=$.current++;return M((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})),()=>{M((t=>t.filter((t=>t.id!==e.id))))}}),[]),K=o.useCallback(((e,t)=>{M((o=>o.map((o=>o.id===e?{...o,...t}:o))))}),[]),H=o.useCallback((e=>{M((t=>t.filter((t=>t.id!==e))))}),[]),W=o.useCallback((e=>{const t=$.current++;return D((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})),()=>{D((t=>t.filter((t=>t.id!==e))))}}),[]),F=k.trim(),_=o.useMemo((()=>x.map((e=>{const t=b&&F?y(e.value,F,e.keywords):1,o=e.forceMount||t>0;return{...e,score:t,visible:o}}))),[y,x,F,b]),U=o.useMemo((()=>_.filter((e=>e.visible&&!e.disabled))),[_]),Y=o.useMemo((()=>U.map((e=>e.id))),[U]),q=o.useMemo((()=>_.reduce(((e,t)=>t.groupId&&t.visible?(e[t.groupId]=(e[t.groupId]||0)+1,e):e),{})),[_]);o.useEffect((()=>{0!==Y.length?A((e=>e&&Y.includes(e)?e:Y[0])):A(null)}),[Y]),o.useEffect((()=>{if(!j)return;const e=x.find((e=>e.id===j)),t=e?.ref.current;t&&((e,t)=>{if(!t)return;let o=e.parentElement;for(;o&&o!==t&&!v(o);)o=o.parentElement;if(!o||o===t&&!v(t))return;const a=o.getBoundingClientRect(),r=e.getBoundingClientRect();r.top<a.top?o.scrollTop-=a.top-r.top:r.bottom>a.bottom&&(o.scrollTop+=r.bottom-a.bottom)})(t,O.current)}),[j,x]);const z=o.useCallback((e=>{if(0===U.length)return;const t=j?U.findIndex((e=>e.id===j)):-1;let o=t+e;-1===t&&(o=1===e?0:U.length-1),I?(o<0&&(o=U.length-1),o>=U.length&&(o=0)):o=Math.max(0,Math.min(U.length-1,o)),A(U[o]?.id||null)}),[j,I,U]),J=o.useCallback((e=>{0!==U.length&&A("start"===e?U[0].id:U[U.length-1].id)}),[U]),Q=o.useCallback((()=>{if(!j)return;const e=U.find((e=>e.id===j));e&&!e.disabled&&e.onSelect?.(e.value)}),[j,U]),X=o.useCallback((e=>{const t=_.find((t=>t.id===e)),o=Boolean(t?.visible),a=j===e;return{active:a,visible:o,selected:a}}),[j,_]),Z=o.useCallback((e=>q[e]||0),[q]),ee=o.useCallback((e=>{const t=E.find((t=>t.id===e));if(!t)return!1;const o=_.some((e=>e.visible&&e.order<t.order)),a=_.some((e=>e.visible&&e.order>t.order));return o&&a}),[_,E]),te=o.useMemo((()=>({rootClass:w,label:h,listId:V,inputId:T,search:k,setSearch:B,loop:I,shouldFilter:b,registerItem:G,updateItem:K,unregisterItem:H,registerSeparator:W,activeItemId:j,setActiveItemId:A,moveActive:z,moveToBoundary:J,selectActiveItem:Q,getItemState:X,visibleItemCount:_.filter((e=>e.visible)).length,getVisibleGroupItemCount:Z,getSeparatorVisible:ee,setEmptyAnnouncement:P})),[j,X,ee,Z,T,h,V,I,z,J,G,W,w,k,Q,B,b,_,H,K]);return e(u.Provider,{value:te,children:t(s.div,{ref:l(R,O),className:r(w,d),"data-slot":"command-root","data-value":F||void 0,...N,children:[i,e("span",{role:"status","aria-live":"polite","aria-atomic":"true","data-slot":"command-announcer",style:f,children:L})]})})}));C.displayName="Command";const h=o.forwardRef((({children:o,className:s,customRootClass:n="",open:l,onOpenChange:d,onClickOutside:c,container:m,overlayClassName:u,contentClassName:p,forceMount:f=!1,contentProps:v,overlayProps:g,...h},b)=>{const y=a(n,"Command");return e(i.Root,{open:l,onOpenChange:d,onClickOutside:c,children:t(i.Portal,{container:m,forceMount:f,children:[e(i.Overlay,{className:r(y&&`${y}-overlay`,u),"data-slot":"command-overlay",...g}),e(i.Content,{ref:b,className:r(y&&`${y}-dialog-content`,p),"data-slot":"command-dialog-content",...v,children:e(C,{customRootClass:n,className:s,...h,children:o})})]})})}));h.displayName="CommandDialog";const b=o.forwardRef((({className:t,value:a,onValueChange:n,onKeyDown:l,...i},c)=>{const{rootClass:m,label:u,listId:f,inputId:v,search:g,setSearch:C,moveActive:h,moveToBoundary:b,selectActiveItem:y,activeItemId:I}=p(),N=a??g;return o.useEffect((()=>{void 0!==a&&a!==g&&C(a)}),[a,g,C]),e(s.input,{ref:c,type:"text",id:v,className:r(m&&`${m}-input`,t),"data-slot":"command-input",role:"combobox","aria-autocomplete":"list","aria-controls":f,"aria-expanded":"true","aria-activedescendant":I??void 0,"aria-label":u,value:N,onChange:e=>{const t=e.currentTarget.value;void 0===a&&C(t),n?.(t)},onKeyDown:e=>{e.key===d.ARROW_DOWN&&(e.preventDefault(),h(1)),e.key===d.ARROW_UP&&(e.preventDefault(),h(-1)),e.key===d.HOME&&(e.preventDefault(),b("start")),e.key===d.END&&(e.preventDefault(),b("end")),e.key===d.ENTER&&(e.preventDefault(),y()),l?.(e)},...i})}));b.displayName="CommandInput";const y=o.forwardRef((({className:t,...o},a)=>{const{rootClass:n,listId:l,label:i}=p();return e(s.div,{ref:a,id:l,className:r(n&&`${n}-list`,t),"data-slot":"command-list",role:"listbox","aria-label":i,...o})}));y.displayName="CommandList";const I=o.createContext(null),N=o.forwardRef((({children:t,className:a,value:n,keywords:l,onSelect:i,disabled:d=!1,forceMount:u=!1,onMouseMove:f,onClick:v,onKeyDown:g,...C},h)=>{const{registerItem:b,updateItem:y,setActiveItemId:N,getItemState:k,rootClass:S}=p(),x=o.useContext(I),M=o.useId(),E=o.useRef(null),D=o.useMemo((()=>l??[]),[l]),j=o.useMemo((()=>{if("string"==typeof n&&n.length>0)return n;const e=R(t).trim();return e.length>0?e:M}),[t,M,n]),A=o.useRef(i);A.current=i;const $=o.useCallback((e=>{A.current?.(e)}),[]),O=o.useMemo((()=>({id:M,value:j,keywords:D,disabled:d,forceMount:u,groupId:x,ref:E,onSelect:$})),[d,u,x,$,j,M,D]),L=o.useRef(O);L.current=O,o.useEffect((()=>b(L.current)),[M,b]);const P=o.useRef(!0);o.useEffect((()=>{P.current?P.current=!1:y(M,O)}),[O,M,y]);const{active:V,visible:T,selected:B}=k(M);return T||u?e(s.div,{ref:m(E,h),id:M,className:r(w(S),a),"data-slot":"command-item","data-disabled":d?"":void 0,"data-selected":B?"":void 0,"data-value":j,role:"option","aria-disabled":d||void 0,"aria-selected":B,tabIndex:-1,hidden:!T,onMouseMove:e=>{d||N(M),f?.(e)},onClick:e=>{d||(N(M),i?.(j)),v?.(e)},onKeyDown:e=>{d||(c(e.key)&&(e.preventDefault(),i?.(j)),g?.(e))},...C,children:t}):null}));function R(e){return"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(R).join(" "):o.isValidElement(e)?R(e.props.children):""}const w=e=>e?`${e}-item`:void 0;N.displayName="CommandItem";const k=o.forwardRef((({children:a,className:n,heading:l,forceMount:i=!1,...d},c)=>{const{rootClass:m,getVisibleGroupItemCount:u}=p(),f=o.useId(),v=o.useId(),g=u(f),C=i||g>0;return e(I.Provider,{value:f,children:t(s.div,{ref:c,className:r(m&&`${m}-group`,n),"data-slot":"command-group",role:"presentation",hidden:!C,...d,children:[l?e(s.div,{className:m?`${m}-group-heading`:void 0,"data-slot":"command-group-heading",id:v,children:l}):null,e(s.div,{className:m?`${m}-group-items`:void 0,"data-slot":"command-group-items",role:"group","aria-labelledby":l?v:void 0,children:a})]})})}));k.displayName="CommandGroup";const S=o.forwardRef((({className:t,forceMount:a=!1,children:n,...i},d)=>{const{rootClass:c,visibleItemCount:m,setEmptyAnnouncement:u}=p(),f=a||0===m,v=o.useRef(null);return o.useEffect((()=>{u(0===m?v.current?.textContent?.trim()??"":"")}),[m,n,u]),o.useEffect((()=>()=>u("")),[u]),f?e(s.div,{ref:l(d,v),className:r(c&&`${c}-empty`,t),"data-slot":"command-empty","data-state":"visible",role:"presentation","aria-hidden":"true",...i,children:n}):null}));S.displayName="CommandEmpty";const x=o.forwardRef((({className:t,...o},a)=>{const{rootClass:n}=p();return e(s.div,{ref:a,className:r(n&&`${n}-loading`,t),"data-slot":"command-loading","aria-live":"polite","aria-busy":"true",...o})}));x.displayName="CommandLoading";const M=o.forwardRef((({className:t,...a},n)=>{const{rootClass:l,registerSeparator:i,getSeparatorVisible:d}=p(),c=o.useId();o.useEffect((()=>i(c)),[i,c]);return d(c)?e(s.div,{ref:n,className:r(l&&`${l}-separator`,t),"data-slot":"command-separator",role:"separator",...a}):null}));M.displayName="CommandSeparator";const E=o.forwardRef((({className:t,...o},a)=>{const{rootClass:n}=p();return e(s.span,{ref:a,className:r(n&&`${n}-shortcut`,t),"data-slot":"command-shortcut",...o})}));E.displayName="CommandShortcut";const D=C;D.Root=C,D.Dialog=h,D.Input=b,D.List=y,D.Item=N,D.Group=k,D.Empty=S,D.Loading=x,D.Separator=M,D.Shortcut=E;export{h as Dialog,S as Empty,k as Group,b as Input,N as Item,y as List,x as Loading,C as Root,M as Separator,E as Shortcut,D as default};
|
|
@@ -32,12 +32,6 @@ declare const ContextMenuRoot: React.ForwardRefExoticComponent<{
|
|
|
32
32
|
rtl?: boolean;
|
|
33
33
|
} & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
34
|
|
|
35
|
-
type MenuPrimitiveTriggerProps = {
|
|
36
|
-
children: React.ReactNode;
|
|
37
|
-
className?: string;
|
|
38
|
-
asChild?: boolean;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
35
|
type ContextMenuTriggerProps = {
|
|
42
36
|
children: React.ReactNode;
|
|
43
37
|
className?: string;
|
|
@@ -45,12 +39,11 @@ type ContextMenuTriggerProps = {
|
|
|
45
39
|
declare const ContextMenuTrigger: React.ForwardRefExoticComponent<{
|
|
46
40
|
children: React.ReactNode;
|
|
47
41
|
className?: string;
|
|
48
|
-
} & Omit<
|
|
49
|
-
|
|
50
|
-
type MenuPrimitiveContentProps = {
|
|
42
|
+
} & Omit<{
|
|
51
43
|
children: React.ReactNode;
|
|
52
44
|
className?: string;
|
|
53
|
-
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "children"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
54
47
|
|
|
55
48
|
type ContextMenuContentProps = {
|
|
56
49
|
children: React.ReactNode;
|
|
@@ -67,7 +60,12 @@ declare const ContextMenuContent: React.ForwardRefExoticComponent<{
|
|
|
67
60
|
variant?: "default" | "soft" | "outline";
|
|
68
61
|
/** Size of the content panel */
|
|
69
62
|
size?: "small" | "medium" | "large";
|
|
70
|
-
} & Omit<
|
|
63
|
+
} & Omit<{
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
className?: string;
|
|
66
|
+
initialFocus?: number;
|
|
67
|
+
focusManagerDisabled?: boolean;
|
|
68
|
+
} & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
71
69
|
|
|
72
70
|
type ContextMenuPortalProps = {
|
|
73
71
|
children: React.ReactNode;
|
|
@@ -78,15 +76,6 @@ declare const ContextMenuPortal: React.ForwardRefExoticComponent<{
|
|
|
78
76
|
children: React.ReactNode;
|
|
79
77
|
} & _floating_ui_react.FloatingPortalProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
80
78
|
|
|
81
|
-
type MenuPrimitiveItemProps = {
|
|
82
|
-
children: React.ReactNode;
|
|
83
|
-
className?: string;
|
|
84
|
-
label?: string;
|
|
85
|
-
disabled?: boolean;
|
|
86
|
-
asChild?: boolean;
|
|
87
|
-
onSelect?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
79
|
type ContextMenuItemProps = {
|
|
91
80
|
children: React.ReactNode;
|
|
92
81
|
className?: string;
|
|
@@ -96,7 +85,14 @@ declare const ContextMenuItem: React.ForwardRefExoticComponent<{
|
|
|
96
85
|
children: React.ReactNode;
|
|
97
86
|
className?: string;
|
|
98
87
|
label?: string;
|
|
99
|
-
} & Omit<
|
|
88
|
+
} & Omit<{
|
|
89
|
+
children: React.ReactNode;
|
|
90
|
+
className?: string;
|
|
91
|
+
label?: string;
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
asChild?: boolean;
|
|
94
|
+
onSelect?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
95
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "children" | "onSelect" | "disabled"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
100
96
|
|
|
101
97
|
type ContextMenuSubProps = {
|
|
102
98
|
children: React.ReactNode;
|
|
@@ -134,7 +130,11 @@ type ContextMenuSubTriggerProps = {
|
|
|
134
130
|
declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<{
|
|
135
131
|
children: React.ReactNode;
|
|
136
132
|
className?: string;
|
|
137
|
-
} & Omit<
|
|
133
|
+
} & Omit<{
|
|
134
|
+
children: React.ReactNode;
|
|
135
|
+
className?: string;
|
|
136
|
+
asChild?: boolean;
|
|
137
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | "children"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
138
138
|
|
|
139
139
|
type PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
140
140
|
type SeparatorProps = {
|
|
@@ -164,5 +164,5 @@ type ContextMenuComponent = React.ForwardRefExoticComponent<ContextMenuProps & R
|
|
|
164
164
|
};
|
|
165
165
|
declare const ContextMenu: ContextMenuComponent;
|
|
166
166
|
|
|
167
|
-
export { ContextMenu as default };
|
|
167
|
+
export { ContextMenuContent as Content, ContextMenuItem as Item, ContextMenuPortal as Portal, ContextMenuRoot as Root, ContextMenuSeparator as Separator, ContextMenuSub as Sub, ContextMenuSubTrigger as SubTrigger, ContextMenuTrigger as Trigger, ContextMenu as default };
|
|
168
168
|
export type { ContextMenuContentProps, ContextMenuElement, ContextMenuItemProps, ContextMenuPortalProps, ContextMenuProps, ContextMenuRootProps, ContextMenuSeparatorProps, ContextMenuSubProps, ContextMenuSubTriggerProps, ContextMenuTriggerProps };
|
|
@@ -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-D9VMz2TZ.js";import{u as r,c as a}from"./useComponentClass-C0isGl1z.js";import{u as i}from"./index-wRElCyvx.js";import{a as u}from"./keyboard-BKF7hXqL.js";import{u as l}from"./floating-ui.react-2kiGB4sW.js";import{c}from"./index-eAZUMNef.js";import m from"./Separator.js";import"./index-D8I-rMwz.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"react-dom";import"./ThemeContext-Sm-iNANd.js";const d=e.createContext(null),C="ContextMenu",p=t((({children:e,customRootClass:t,className:s,open:u,defaultOpen:l=!1,onOpenChange:c,variant:m,size:p,...x},h)=>{const[f,g]=i(u,l,c),M=r(t,C);return n(d.Provider,{value:{rootClass:M,setIsOpen:g,variant:m,size:p},children:n(o.Root,{ref:h,className:a(M&&`${M}-root`,s),open:f,onOpenChange:g,...x,children:e})})}));p.displayName=C;const x=t((({children:t,className:r,...i},c)=>{const m=e.useContext(d),C=e.useContext(s),p=e.useRef(null),x=l([p,c]);if(!m)return console.warn("ContextMenuTrigger should be used in the ContextMenuRoot"),null;const{rootClass:h,setIsOpen:f}=m,g=(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}})}),f(!0)};return n(o.Trigger,{className:a(h&&`${h}-trigger`,r),asChild:!0,...i,children:n("span",{ref:x,onContextMenu:e=>{e.preventDefault(),g(e.clientX,e.clientY)},onKeyDown:e=>{if(u(e.key,e.shiftKey)){if(e.preventDefault(),!p.current)return;const t=p.current.getBoundingClientRect();g(t.left+t.width/2,t.top+t.height/2),C?.setActiveIndex(0)}},onClick:e=>{e.preventDefault(),f(!1)},role:"button",tabIndex:0,"aria-haspopup":"menu",type:void 0,children:t})})}));x.displayName="ContextMenuTrigger";const h=t((({children:t,className:s,variant:r,size:i,...u},l)=>{const m=e.useContext(d);if(!m)return console.warn("ContextMenuContent should be used in the ContextMenuRoot"),null;const{rootClass:C}=m,p=r??m.variant,x=i??m.size,h=c("context-menu-content",{variant:p,size:x});return n(o.Content,{ref:l,className:a(C&&`${C}-content`,s),...h,...u,children:t})}));h.displayName="ContextMenuContent";const f=t((({children:t,...s},r)=>{const a=e.useContext(d);if(!a)return console.warn("ContextMenuPortal should be used in the ContextMenuRoot"),null;const{rootClass:i}=a;return n(o.Portal,{ref:r,...s,children:t})}));f.displayName="ContextMenuPortal";const g=t((({children:t,className:s,label:r,...i},u)=>{const l=e.useContext(d);if(!l)return console.warn("ContextMenuItem should be used in the ContextMenuRoot"),null;const{rootClass:c}=l;return n(o.Item,{ref:u,className:a(c&&`${c}-item`,s),label:r,...i,children:t})}));g.displayName="ContextMenuItem";const M=t((({children:t,className:s,...r},i)=>{const u=e.useContext(d);if(!u)return console.warn("ContextMenuSub should be used in the ContextMenuRoot"),null;const{rootClass:l}=u;return n(o.Sub,{ref:i,className:a(l&&`${l}-sub`,s),...r,children:t})}));M.displayName="ContextMenuSub";const b=t((({children:t,className:s,...r},i)=>{const u=e.useContext(d);if(!u)return console.warn("ContextMenuSubTrigger should be used in the ContextMenuRoot"),null;const{rootClass:l}=u;return n(o.Trigger,{ref:i,className:a(l&&`${l}-sub-trigger`,s),...r,children:t})}));b.displayName="ContextMenuSubTrigger";const N=t((({className:t,...o},s)=>{const r=e.useContext(d);if(!r)return console.warn("ContextMenuSeparator should be used within ContextMenuRoot"),null;const{rootClass:a}=r;return n(m,{ref:s,customRootClass:a,className:t,...o})}));N.displayName="ContextMenuSeparator";const R=t(((e,t)=>(console.warn("Direct usage of ContextMenu is not supported. Please use ContextMenu.Root, ContextMenu.Item instead."),null)));R.displayName="ContextMenu",R.Root=p,R.Trigger=x,R.Content=h,R.Portal=f,R.Item=g,R.Sub=M,R.SubTrigger=b,R.Separator=N;export{h as Content,g as Item,f as Portal,p as Root,N as Separator,M as Sub,b as SubTrigger,x as Trigger,R as default};
|